UNPKG

@salla.sa/twilight-components

Version:
4 lines 297 kB
var __extends=this&&this.__extends||function(){var e=function(t,r){e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r))e[r]=t[r]};return e(t,r)};return function(t,r){if(typeof r!=="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i))e[i]=t[i]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,r,n){function i(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n["throw"](e))}catch(e){a(e)}}function l(e){e.done?r(e.value):i(e.value).then(o,s)}l((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return l([e,t])}}function l(s){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,s[0]&&(r=0)),r)try{if(n=1,i&&(a=s[0]&2?i["return"]:s[0]?i["throw"]||((a=i["return"])&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;if(i=0,a)s=[s[0]&2,a.value];switch(s[0]){case 0:case 1:a=s;break;case 4:r.label++;return{value:s[1],done:false};case 5:r.label++;i=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(a=r.trys,a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){r.label=s[1];break}if(s[0]===6&&r.label<a[1]){r.label=a[1];a=s;break}if(a&&r.label<a[2]){r.label=a[2];r.ops.push(s);break}if(a[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];i=0}finally{n=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,a;n<i;n++){if(a||!(n in t)){if(!a)a=Array.prototype.slice.call(t,0,n);a[n]=t[n]}}return e.concat(a||Array.prototype.slice.call(t))};var _q; /*! * Crafted with ❤ by Salla */import{c as commonjsGlobal,a as createCommonjsModule}from"./_commonjsHelpers-1415ffd3.js";var isArray$1=Array.isArray;var isArray_1=isArray$1;var freeGlobal=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal;var _freeGlobal=freeGlobal;var freeSelf=typeof self=="object"&&self&&self.Object===Object&&self;var root=_freeGlobal||freeSelf||Function("return this")();var _root=root;var Symbol$1=_root.Symbol;var _Symbol=Symbol$1;var objectProto$4=Object.prototype;var hasOwnProperty$3=objectProto$4.hasOwnProperty;var nativeObjectToString$1=objectProto$4.toString;var symToStringTag$1=_Symbol?_Symbol.toStringTag:undefined;function getRawTag(e){var t=hasOwnProperty$3.call(e,symToStringTag$1),r=e[symToStringTag$1];try{e[symToStringTag$1]=undefined;var n=true}catch(e){}var i=nativeObjectToString$1.call(e);if(n){if(t){e[symToStringTag$1]=r}else{delete e[symToStringTag$1]}}return i}var _getRawTag=getRawTag;var objectProto$3=Object.prototype;var nativeObjectToString=objectProto$3.toString;function objectToString(e){return nativeObjectToString.call(e)}var _objectToString=objectToString;var nullTag="[object Null]",undefinedTag="[object Undefined]";var symToStringTag=_Symbol?_Symbol.toStringTag:undefined;function baseGetTag(e){if(e==null){return e===undefined?undefinedTag:nullTag}return symToStringTag&&symToStringTag in Object(e)?_getRawTag(e):_objectToString(e)}var _baseGetTag=baseGetTag;function isObjectLike(e){return e!=null&&typeof e=="object"}var isObjectLike_1=isObjectLike;var symbolTag="[object Symbol]";function isSymbol(e){return typeof e=="symbol"||isObjectLike_1(e)&&_baseGetTag(e)==symbolTag}var isSymbol_1=isSymbol;var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(e,t){if(isArray_1(e)){return false}var r=typeof e;if(r=="number"||r=="symbol"||r=="boolean"||e==null||isSymbol_1(e)){return true}return reIsPlainProp.test(e)||!reIsDeepProp.test(e)||t!=null&&e in Object(t)}var _isKey=isKey;function isObject$3(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var isObject_1=isObject$3;var asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$3(e){if(!isObject_1(e)){return false}var t=_baseGetTag(e);return t==funcTag||t==genTag||t==asyncTag||t==proxyTag}var isFunction_1=isFunction$3;var coreJsData=_root["__core-js_shared__"];var _coreJsData=coreJsData;var maskSrcKey=function(){var e=/[^.]+$/.exec(_coreJsData&&_coreJsData.keys&&_coreJsData.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}var _isMasked=isMasked;var funcProto$1=Function.prototype;var funcToString$1=funcProto$1.toString;function toSource(e){if(e!=null){try{return funcToString$1.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var _toSource=toSource;var reRegExpChar=/[\\^$.*+?()[\]{}|]/g;var reIsHostCtor=/^\[object .+?Constructor\]$/;var funcProto=Function.prototype,objectProto$2=Object.prototype;var funcToString=funcProto.toString;var hasOwnProperty$2=objectProto$2.hasOwnProperty;var reIsNative=RegExp("^"+funcToString.call(hasOwnProperty$2).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(e){if(!isObject_1(e)||_isMasked(e)){return false}var t=isFunction_1(e)?reIsNative:reIsHostCtor;return t.test(_toSource(e))}var _baseIsNative=baseIsNative;function getValue(e,t){return e==null?undefined:e[t]}var _getValue=getValue;function getNative(e,t){var r=_getValue(e,t);return _baseIsNative(r)?r:undefined}var _getNative=getNative;var nativeCreate=_getNative(Object,"create");var _nativeCreate=nativeCreate;function hashClear(){this.__data__=_nativeCreate?_nativeCreate(null):{};this.size=0}var _hashClear=hashClear;function hashDelete(e){var t=this.has(e)&&delete this.__data__[e];this.size-=t?1:0;return t}var _hashDelete=hashDelete;var HASH_UNDEFINED$1="__lodash_hash_undefined__";var objectProto$1=Object.prototype;var hasOwnProperty$1=objectProto$1.hasOwnProperty;function hashGet(e){var t=this.__data__;if(_nativeCreate){var r=t[e];return r===HASH_UNDEFINED$1?undefined:r}return hasOwnProperty$1.call(t,e)?t[e]:undefined}var _hashGet=hashGet;var objectProto=Object.prototype;var hasOwnProperty=objectProto.hasOwnProperty;function hashHas(e){var t=this.__data__;return _nativeCreate?t[e]!==undefined:hasOwnProperty.call(t,e)}var _hashHas=hashHas;var HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet(e,t){var r=this.__data__;this.size+=this.has(e)?0:1;r[e]=_nativeCreate&&t===undefined?HASH_UNDEFINED:t;return this}var _hashSet=hashSet;function Hash(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var n=e[t];this.set(n[0],n[1])}}Hash.prototype.clear=_hashClear;Hash.prototype["delete"]=_hashDelete;Hash.prototype.get=_hashGet;Hash.prototype.has=_hashHas;Hash.prototype.set=_hashSet;var _Hash=Hash;function listCacheClear(){this.__data__=[];this.size=0}var _listCacheClear=listCacheClear;function eq(e,t){return e===t||e!==e&&t!==t}var eq_1=eq;function assocIndexOf(e,t){var r=e.length;while(r--){if(eq_1(e[r][0],t)){return r}}return-1}var _assocIndexOf=assocIndexOf;var arrayProto=Array.prototype;var splice=arrayProto.splice;function listCacheDelete(e){var t=this.__data__,r=_assocIndexOf(t,e);if(r<0){return false}var n=t.length-1;if(r==n){t.pop()}else{splice.call(t,r,1)}--this.size;return true}var _listCacheDelete=listCacheDelete;function listCacheGet(e){var t=this.__data__,r=_assocIndexOf(t,e);return r<0?undefined:t[r][1]}var _listCacheGet=listCacheGet;function listCacheHas(e){return _assocIndexOf(this.__data__,e)>-1}var _listCacheHas=listCacheHas;function listCacheSet(e,t){var r=this.__data__,n=_assocIndexOf(r,e);if(n<0){++this.size;r.push([e,t])}else{r[n][1]=t}return this}var _listCacheSet=listCacheSet;function ListCache(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var n=e[t];this.set(n[0],n[1])}}ListCache.prototype.clear=_listCacheClear;ListCache.prototype["delete"]=_listCacheDelete;ListCache.prototype.get=_listCacheGet;ListCache.prototype.has=_listCacheHas;ListCache.prototype.set=_listCacheSet;var _ListCache=ListCache;var Map=_getNative(_root,"Map");var _Map=Map;function mapCacheClear(){this.size=0;this.__data__={hash:new _Hash,map:new(_Map||_ListCache),string:new _Hash}}var _mapCacheClear=mapCacheClear;function isKeyable(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var _isKeyable=isKeyable;function getMapData(e,t){var r=e.__data__;return _isKeyable(t)?r[typeof t=="string"?"string":"hash"]:r.map}var _getMapData=getMapData;function mapCacheDelete(e){var t=_getMapData(this,e)["delete"](e);this.size-=t?1:0;return t}var _mapCacheDelete=mapCacheDelete;function mapCacheGet(e){return _getMapData(this,e).get(e)}var _mapCacheGet=mapCacheGet;function mapCacheHas(e){return _getMapData(this,e).has(e)}var _mapCacheHas=mapCacheHas;function mapCacheSet(e,t){var r=_getMapData(this,e),n=r.size;r.set(e,t);this.size+=r.size==n?0:1;return this}var _mapCacheSet=mapCacheSet;function MapCache(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var n=e[t];this.set(n[0],n[1])}}MapCache.prototype.clear=_mapCacheClear;MapCache.prototype["delete"]=_mapCacheDelete;MapCache.prototype.get=_mapCacheGet;MapCache.prototype.has=_mapCacheHas;MapCache.prototype.set=_mapCacheSet;var _MapCache=MapCache;var FUNC_ERROR_TEXT="Expected a function";function memoize(e,t){if(typeof e!="function"||t!=null&&typeof t!="function"){throw new TypeError(FUNC_ERROR_TEXT)}var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i)){return a.get(i)}var o=e.apply(this,n);r.cache=a.set(i,o)||a;return o};r.cache=new(memoize.Cache||_MapCache);return r}memoize.Cache=_MapCache;var memoize_1=memoize;var MAX_MEMOIZE_SIZE=500;function memoizeCapped(e){var t=memoize_1(e,(function(e){if(r.size===MAX_MEMOIZE_SIZE){r.clear()}return e}));var r=t.cache;return t}var _memoizeCapped=memoizeCapped;var rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;var reEscapeChar=/\\(\\)?/g;var stringToPath=_memoizeCapped((function(e){var t=[];if(e.charCodeAt(0)===46){t.push("")}e.replace(rePropName,(function(e,r,n,i){t.push(n?i.replace(reEscapeChar,"$1"):r||e)}));return t}));var _stringToPath=stringToPath;function arrayMap(e,t){var r=-1,n=e==null?0:e.length,i=Array(n);while(++r<n){i[r]=t(e[r],r,e)}return i}var _arrayMap=arrayMap;var INFINITY$1=1/0;var symbolProto=_Symbol?_Symbol.prototype:undefined,symbolToString=symbolProto?symbolProto.toString:undefined;function baseToString(e){if(typeof e=="string"){return e}if(isArray_1(e)){return _arrayMap(e,baseToString)+""}if(isSymbol_1(e)){return symbolToString?symbolToString.call(e):""}var t=e+"";return t=="0"&&1/e==-INFINITY$1?"-0":t}var _baseToString=baseToString;function toString$1(e){return e==null?"":_baseToString(e)}var toString_1=toString$1;function castPath(e,t){if(isArray_1(e)){return e}return _isKey(e,t)?[e]:_stringToPath(toString_1(e))}var _castPath=castPath;var INFINITY=1/0;function toKey(e){if(typeof e=="string"||isSymbol_1(e)){return e}var t=e+"";return t=="0"&&1/e==-INFINITY?"-0":t}var _toKey=toKey;function baseGet(e,t){t=_castPath(t,e);var r=0,n=t.length;while(e!=null&&r<n){e=e[_toKey(t[r++])]}return r&&r==n?e:undefined}var _baseGet=baseGet;function get(e,t,r){var n=e==null?undefined:_baseGet(e,t);return n===undefined?r:n}var get_1=get;var eventemitter2=createCommonjsModule((function(e,t){!function(t){var r=Object.hasOwnProperty;var n=Array.isArray?Array.isArray:function e(t){return Object.prototype.toString.call(t)==="[object Array]"};var i=10;var a=typeof process=="object"&&typeof process.nextTick=="function";var o=typeof Symbol==="function";var s=typeof Reflect==="object";var l=typeof setImmediate==="function";var c=l?setImmediate:setTimeout;var u=o?s&&typeof Reflect.ownKeys==="function"?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);t.push.apply(t,Object.getOwnPropertySymbols(e));return t}:Object.keys;function d(){this._events={};if(this._conf){f.call(this,this._conf)}}function f(e){if(e){this._conf=e;e.delimiter&&(this.delimiter=e.delimiter);if(e.maxListeners!==t){this._maxListeners=e.maxListeners}e.wildcard&&(this.wildcard=e.wildcard);e.newListener&&(this._newListener=e.newListener);e.removeListener&&(this._removeListener=e.removeListener);e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak);e.ignoreErrors&&(this.ignoreErrors=e.ignoreErrors);if(this.wildcard){this.listenerTree={}}}}function p(e,t){var r="(node) warning: possible EventEmitter memory "+"leak detected. "+e+" listeners added. "+"Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak){r+=" Event name: "+t+"."}if(typeof process!=="undefined"&&process.emitWarning){var n=new Error(r);n.name="MaxListenersExceededWarning";n.emitter=this;n.count=e;process.emitWarning(n)}else{console.error(r);if(console.trace){console.trace()}}}var h=function(e,t,r){var n=arguments.length;switch(n){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,r];default:var i=new Array(n);while(n--){i[n]=arguments[n]}return i}};function g(e,r){var n={};var i;var a=e.length;var o=r?r.length:0;for(var s=0;s<a;s++){i=e[s];n[i]=s<o?r[s]:t}return n}function v(e,t,r){this._emitter=e;this._target=t;this._listeners={};this._listenersCount=0;var n,i;if(r.on||r.off){n=r.on;i=r.off}if(t.addEventListener){n=t.addEventListener;i=t.removeEventListener}else if(t.addListener){n=t.addListener;i=t.removeListener}else if(t.on){n=t.on;i=t.off}if(!n&&!i){throw Error("target does not implement any known event API")}if(typeof n!=="function"){throw TypeError("on method must be a function")}if(typeof i!=="function"){throw TypeError("off method must be a function")}this._on=n;this._off=i;var a=e._observers;if(a){a.push(this)}else{e._observers=[this]}}Object.assign(v.prototype,{subscribe:function(e,t,r){var n=this;var i=this._target;var a=this._emitter;var o=this._listeners;var s=function(){var n=h.apply(null,arguments);var o={data:n,name:t,original:e};if(r){var s=r.call(i,o);if(s!==false){a.emit.apply(a,[o.name].concat(n))}return}a.emit.apply(a,[t].concat(n))};if(o[e]){throw Error("Event '"+e+"' is already listening")}this._listenersCount++;if(a._newListener&&a._removeListener&&!n._onNewListener){this._onNewListener=function(r){if(r===t&&o[e]===null){o[e]=s;n._on.call(i,e,s)}};a.on("newListener",this._onNewListener);this._onRemoveListener=function(r){if(r===t&&!a.hasListeners(r)&&o[e]){o[e]=null;n._off.call(i,e,s)}};o[e]=null;a.on("removeListener",this._onRemoveListener)}else{o[e]=s;n._on.call(i,e,s)}},unsubscribe:function(e){var t=this;var r=this._listeners;var n=this._emitter;var i;var a;var o=this._off;var s=this._target;var l;if(e&&typeof e!=="string"){throw TypeError("event must be a string")}function c(){if(t._onNewListener){n.off("newListener",t._onNewListener);n.off("removeListener",t._onRemoveListener);t._onNewListener=null;t._onRemoveListener=null}var e=$.call(n,t);n._observers.splice(e,1)}if(e){i=r[e];if(!i)return;o.call(s,e,i);delete r[e];if(! --this._listenersCount){c()}}else{a=u(r);l=a.length;while(l-- >0){e=a[l];o.call(s,e,r[e])}this._listeners={};this._listenersCount=0;c()}}});function m(e,n,i,a){var o=Object.assign({},n);if(!e)return o;if(typeof e!=="object"){throw TypeError("options must be an object")}var s=Object.keys(e);var l=s.length;var c,u;var d;function f(e){throw Error('Invalid "'+c+'" option value'+(e?". Reason: "+e:""))}for(var p=0;p<l;p++){c=s[p];if(!a&&!r.call(n,c)){throw Error('Unknown "'+c+'" option')}u=e[c];if(u!==t){d=i[c];o[c]=d?d(u,f):u}}return o}function y(e,t){if(typeof e!=="function"||!e.hasOwnProperty("prototype")){t("value must be a constructor")}return e}function b(e){var t="value must be type of "+e.join("|");var r=e.length;var n=e[0];var i=e[1];if(r===1){return function(e,r){if(typeof e===n){return e}r(t)}}if(r===2){return function(e,r){var a=typeof e;if(a===n||a===i)return e;r(t)}}return function(n,i){var a=typeof n;var o=r;while(o-- >0){if(a===e[o])return n}i(t)}}var _=b(["function"]);var w=b(["object","function"]);function S(e,t,r){var n;var i;var a=0;var o;var s=new e((function(l,c,u){r=m(r,{timeout:0,overload:false},{timeout:function(e,t){e*=1;if(typeof e!=="number"||e<0||!Number.isFinite(e)){t("timeout must be a positive number")}return e}});n=!r.overload&&typeof e.prototype.cancel==="function"&&typeof u==="function";function d(){if(i){i=null}if(a){clearTimeout(a);a=0}}var f=function(e){d();l(e)};var p=function(e){d();c(e)};if(n){t(f,p,u)}else{i=[function(e){p(e||Error("canceled"))}];t(f,p,(function(e){if(o){throw Error("Unable to subscribe on cancel event asynchronously")}if(typeof e!=="function"){throw TypeError("onCancel callback must be a function")}i.push(e)}));o=true}if(r.timeout>0){a=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT";a=0;s.cancel(e);c(e)}),r.timeout)}}));if(!n){s.cancel=function(e){if(!i){return}var t=i.length;for(var r=1;r<t;r++){i[r](e)}i[0](e);i=null}}return s}function $(e){var t=this._observers;if(!t){return-1}var r=t.length;for(var n=0;n<r;n++){if(t[n]._target===e)return n}return-1}function E(e,t,r,n,i){if(!r){return null}if(n===0){var a=typeof t;if(a==="string"){var o,s,l=0,c=0,d=this.delimiter,f=d.length;if((s=t.indexOf(d))!==-1){o=new Array(5);do{o[l++]=t.slice(c,s);c=s+f}while((s=t.indexOf(d,c))!==-1);o[l++]=t.slice(c);t=o;i=l}else{t=[t];i=1}}else if(a==="object"){i=t.length}else{t=[t];i=1}}var p=null,h,g,v,m,y,b=t[n],_=t[n+1],w,S;if(n===i){if(r._listeners){if(typeof r._listeners==="function"){e&&e.push(r._listeners);p=[r]}else{e&&e.push.apply(e,r._listeners);p=[r]}}}else{if(b==="*"){w=u(r);s=w.length;while(s-- >0){h=w[s];if(h!=="_listeners"){S=E(e,t,r[h],n+1,i);if(S){if(p){p.push.apply(p,S)}else{p=S}}}}return p}else if(b==="**"){y=n+1===i||n+2===i&&_==="*";if(y&&r._listeners){p=E(e,t,r,i,i)}w=u(r);s=w.length;while(s-- >0){h=w[s];if(h!=="_listeners"){if(h==="*"||h==="**"){if(r[h]._listeners&&!y){S=E(e,t,r[h],i,i);if(S){if(p){p.push.apply(p,S)}else{p=S}}}S=E(e,t,r[h],n,i)}else if(h===_){S=E(e,t,r[h],n+2,i)}else{S=E(e,t,r[h],n,i)}if(S){if(p){p.push.apply(p,S)}else{p=S}}}}return p}else if(r[b]){p=E(e,t,r[b],n+1,i)}}g=r["*"];if(g){E(e,t,g,n+1,i)}v=r["**"];if(v){if(n<i){if(v._listeners){E(e,t,v,i,i)}w=u(v);s=w.length;while(s-- >0){h=w[s];if(h!=="_listeners"){if(h===_){E(e,t,v[h],n+2,i)}else if(h===b){E(e,t,v[h],n+1,i)}else{m={};m[h]=v[h];E(e,t,{"**":m},n+1,i)}}}}else if(v._listeners){E(e,t,v,i,i)}else if(v["*"]&&v["*"]._listeners){E(e,t,v["*"],i,i)}}return p}function k(e,t,r){var n=0,i=0,a,o=this.delimiter,s=o.length,l;if(typeof e==="string"){if((a=e.indexOf(o))!==-1){l=new Array(5);do{l[n++]=e.slice(i,a);i=a+s}while((a=e.indexOf(o,i))!==-1);l[n++]=e.slice(i)}else{l=[e];n=1}}else{l=e;n=e.length}if(n>1){for(a=0;a+1<n;a++){if(l[a]==="**"&&l[a+1]==="**"){return}}}var c=this.listenerTree,u;for(a=0;a<n;a++){u=l[a];c=c[u]||(c[u]={});if(a===n-1){if(!c._listeners){c._listeners=t}else{if(typeof c._listeners==="function"){c._listeners=[c._listeners]}if(r){c._listeners.unshift(t)}else{c._listeners.push(t)}if(!c._listeners.warned&&this._maxListeners>0&&c._listeners.length>this._maxListeners){c._listeners.warned=true;p.call(this,c._listeners.length,u)}}return true}}return true}function x(e,t,r,n){var i=u(e);var a=i.length;var o,s,l;var c=e["_listeners"];var d;while(a-- >0){s=i[a];o=e[s];if(s==="_listeners"){l=r}else{l=r?r.concat(s):[s]}d=n||typeof s==="symbol";c&&t.push(d?l:l.join(this.delimiter));if(typeof o==="object"){x.call(this,o,t,l,d)}}return t}function I(e){var t=u(e);var r=t.length;var n,i,a;while(r-- >0){i=t[r];n=e[i];if(n){a=true;if(i!=="_listeners"&&!I(n)){delete e[i]}}}return a}function j(e,t,r){this.emitter=e;this.event=t;this.listener=r}j.prototype.off=function(){this.emitter.off(this.event,this.listener);return this};function A(e,r,n){if(n===true){o=true}else if(n===false){i=true}else{if(!n||typeof n!=="object"){throw TypeError("options should be an object or true")}var i=n.async;var o=n.promisify;var s=n.nextTick;var l=n.objectify}if(i||s||o){var u=r;var d=r._origin||r;if(s&&!a){throw Error("process.nextTick is not supported")}if(o===t){o=r.constructor.name==="AsyncFunction"}r=function(){var e=arguments;var t=this;var r=this.event;return o?s?Promise.resolve():new Promise((function(e){c(e)})).then((function(){t.event=r;return u.apply(t,e)})):(s?process.nextTick:c)((function(){t.event=r;u.apply(t,e)}))};r._async=true;r._origin=d}return[r,l?new j(this,e,r):this]}function P(e){this._events={};this._newListener=false;this._removeListener=false;this.verboseMemoryLeak=false;f.call(this,e)}P.EventEmitter2=P;P.prototype.listenTo=function(e,r,i){if(typeof e!=="object"){throw TypeError("target musts be an object")}var a=this;i=m(i,{on:t,off:t,reducers:t},{on:_,off:_,reducers:w});function o(t){if(typeof t!=="object"){throw TypeError("events must be an object")}var r=i.reducers;var n=$.call(a,e);var o;if(n===-1){o=new v(a,e,i)}else{o=a._observers[n]}var s=u(t);var l=s.length;var c;var d=typeof r==="function";for(var f=0;f<l;f++){c=s[f];o.subscribe(c,t[c]||c,d?r:r&&r[c])}}n(r)?o(g(r)):typeof r==="string"?o(g(r.split(/\s+/))):o(r);return this};P.prototype.stopListeningTo=function(e,t){var r=this._observers;if(!r){return false}var n=r.length;var i;var a=false;if(e&&typeof e!=="object"){throw TypeError("target should be an object")}while(n-- >0){i=r[n];if(!e||i._target===e){i.unsubscribe(t);a=true}}return a};P.prototype.delimiter=".";P.prototype.setMaxListeners=function(e){if(e!==t){this._maxListeners=e;if(!this._conf)this._conf={};this._conf.maxListeners=e}};P.prototype.getMaxListeners=function(){return this._maxListeners};P.prototype.event="";P.prototype.once=function(e,t,r){return this._once(e,t,false,r)};P.prototype.prependOnceListener=function(e,t,r){return this._once(e,t,true,r)};P.prototype._once=function(e,t,r,n){return this._many(e,1,t,r,n)};P.prototype.many=function(e,t,r,n){return this._many(e,t,r,false,n)};P.prototype.prependMany=function(e,t,r,n){return this._many(e,t,r,true,n)};P.prototype._many=function(e,t,r,n,i){var a=this;if(typeof r!=="function"){throw new Error("many only accepts instances of Function")}function o(){if(--t===0){a.off(e,o)}return r.apply(this,arguments)}o._origin=r;return this._on(e,o,n,i)};P.prototype.emit=function(){if(!this._events&&!this._all){return false}this._events||d.call(this);var e=arguments[0],t,r=this.wildcard;var n,i,a,s,l;if(e==="newListener"&&!this._newListener){if(!this._events.newListener){return false}}if(r){t=e;if(e!=="newListener"&&e!=="removeListener"){if(typeof e==="object"){i=e.length;if(o){for(a=0;a<i;a++){if(typeof e[a]==="symbol"){l=true;break}}}if(!l){e=e.join(this.delimiter)}}}}var c=arguments.length;var u;if(this._all&&this._all.length){u=this._all.slice();for(a=0,i=u.length;a<i;a++){this.event=e;switch(c){case 1:u[a].call(this,e);break;case 2:u[a].call(this,e,arguments[1]);break;case 3:u[a].call(this,e,arguments[1],arguments[2]);break;default:u[a].apply(this,arguments)}}}if(r){u=[];E.call(this,u,t,this.listenerTree,0,i)}else{u=this._events[e];if(typeof u==="function"){this.event=e;switch(c){case 1:u.call(this);break;case 2:u.call(this,arguments[1]);break;case 3:u.call(this,arguments[1],arguments[2]);break;default:n=new Array(c-1);for(s=1;s<c;s++)n[s-1]=arguments[s];u.apply(this,n)}return true}else if(u){u=u.slice()}}if(u&&u.length){if(c>3){n=new Array(c-1);for(s=1;s<c;s++)n[s-1]=arguments[s]}for(a=0,i=u.length;a<i;a++){this.event=e;switch(c){case 1:u[a].call(this);break;case 2:u[a].call(this,arguments[1]);break;case 3:u[a].call(this,arguments[1],arguments[2]);break;default:u[a].apply(this,n)}}return true}else if(!this.ignoreErrors&&!this._all&&e==="error"){if(arguments[1]instanceof Error){throw arguments[1]}else{throw new Error("Uncaught, unspecified 'error' event.")}}return!!this._all};P.prototype.emitAsync=function(){if(!this._events&&!this._all){return false}this._events||d.call(this);var e=arguments[0],t=this.wildcard,r,n;var i,a,s,l;if(e==="newListener"&&!this._newListener){if(!this._events.newListener){return Promise.resolve([false])}}if(t){r=e;if(e!=="newListener"&&e!=="removeListener"){if(typeof e==="object"){a=e.length;if(o){for(s=0;s<a;s++){if(typeof e[s]==="symbol"){n=true;break}}}if(!n){e=e.join(this.delimiter)}}}}var c=[];var u=arguments.length;var f;if(this._all){for(s=0,a=this._all.length;s<a;s++){this.event=e;switch(u){case 1:c.push(this._all[s].call(this,e));break;case 2:c.push(this._all[s].call(this,e,arguments[1]));break;case 3:c.push(this._all[s].call(this,e,arguments[1],arguments[2]));break;default:c.push(this._all[s].apply(this,arguments))}}}if(t){f=[];E.call(this,f,r,this.listenerTree,0)}else{f=this._events[e]}if(typeof f==="function"){this.event=e;switch(u){case 1:c.push(f.call(this));break;case 2:c.push(f.call(this,arguments[1]));break;case 3:c.push(f.call(this,arguments[1],arguments[2]));break;default:i=new Array(u-1);for(l=1;l<u;l++)i[l-1]=arguments[l];c.push(f.apply(this,i))}}else if(f&&f.length){f=f.slice();if(u>3){i=new Array(u-1);for(l=1;l<u;l++)i[l-1]=arguments[l]}for(s=0,a=f.length;s<a;s++){this.event=e;switch(u){case 1:c.push(f[s].call(this));break;case 2:c.push(f[s].call(this,arguments[1]));break;case 3:c.push(f[s].call(this,arguments[1],arguments[2]));break;default:c.push(f[s].apply(this,i))}}}else if(!this.ignoreErrors&&!this._all&&e==="error"){if(arguments[1]instanceof Error){return Promise.reject(arguments[1])}else{return Promise.reject("Uncaught, unspecified 'error' event.")}}return Promise.all(c)};P.prototype.on=function(e,t,r){return this._on(e,t,false,r)};P.prototype.prependListener=function(e,t,r){return this._on(e,t,true,r)};P.prototype.onAny=function(e){return this._onAny(e,false)};P.prototype.prependAny=function(e){return this._onAny(e,true)};P.prototype.addListener=P.prototype.on;P.prototype._onAny=function(e,t){if(typeof e!=="function"){throw new Error("onAny only accepts instances of Function")}if(!this._all){this._all=[]}if(t){this._all.unshift(e)}else{this._all.push(e)}return this};P.prototype._on=function(e,r,n,i){if(typeof e==="function"){this._onAny(e,r);return this}if(typeof r!=="function"){throw new Error("on only accepts instances of Function")}this._events||d.call(this);var a=this,o;if(i!==t){o=A.call(this,e,r,i);r=o[0];a=o[1]}if(this._newListener){this.emit("newListener",e,r)}if(this.wildcard){k.call(this,e,r,n);return a}if(!this._events[e]){this._events[e]=r}else{if(typeof this._events[e]==="function"){this._events[e]=[this._events[e]]}if(n){this._events[e].unshift(r)}else{this._events[e].push(r)}if(!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners){this._events[e].warned=true;p.call(this,this._events[e].length,e)}}return a};P.prototype.off=function(e,t){if(typeof t!=="function"){throw new Error("removeListener only takes instances of Function")}var r,i=[];if(this.wildcard){var a=typeof e==="string"?e.split(this.delimiter):e.slice();i=E.call(this,null,a,this.listenerTree,0);if(!i)return this}else{if(!this._events[e])return this;r=this._events[e];i.push({_listeners:r})}for(var o=0;o<i.length;o++){var s=i[o];r=s._listeners;if(n(r)){var l=-1;for(var c=0,u=r.length;c<u;c++){if(r[c]===t||r[c].listener&&r[c].listener===t||r[c]._origin&&r[c]._origin===t){l=c;break}}if(l<0){continue}if(this.wildcard){s._listeners.splice(l,1)}else{this._events[e].splice(l,1)}if(r.length===0){if(this.wildcard){delete s._listeners}else{delete this._events[e]}}if(this._removeListener)this.emit("removeListener",e,t);return this}else if(r===t||r.listener&&r.listener===t||r._origin&&r._origin===t){if(this.wildcard){delete s._listeners}else{delete this._events[e]}if(this._removeListener)this.emit("removeListener",e,t)}}this.listenerTree&&I(this.listenerTree);return this};P.prototype.offAny=function(e){var t=0,r=0,n;if(e&&this._all&&this._all.length>0){n=this._all;for(t=0,r=n.length;t<r;t++){if(e===n[t]){n.splice(t,1);if(this._removeListener)this.emit("removeListenerAny",e);return this}}}else{n=this._all;if(this._removeListener){for(t=0,r=n.length;t<r;t++)this.emit("removeListenerAny",n[t])}this._all=[]}return this};P.prototype.removeListener=P.prototype.off;P.prototype.removeAllListeners=function(e){if(e===t){!this._events||d.call(this);return this}if(this.wildcard){var r=E.call(this,null,e,this.listenerTree,0),n,i;if(!r)return this;for(i=0;i<r.length;i++){n=r[i];n._listeners=null}this.listenerTree&&I(this.listenerTree)}else if(this._events){this._events[e]=null}return this};P.prototype.listeners=function(e){var r=this._events;var n,i,a;var o;var s;if(e===t){if(this.wildcard){throw Error("event name required for wildcard emitter")}if(!r){return[]}n=u(r);o=n.length;a=[];while(o-- >0){i=r[n[o]];if(typeof i==="function"){a.push(i)}else{a.push.apply(a,i)}}return a}else{if(this.wildcard){s=this.listenerTree;if(!s)return[];var l=[];var c=typeof e==="string"?e.split(this.delimiter):e.slice();E.call(this,l,c,s,0);return l}if(!r){return[]}i=r[e];if(!i){return[]}return typeof i==="function"?[i]:i}};P.prototype.eventNames=function(e){var t=this._events;return this.wildcard?x.call(this,this.listenerTree,[],null,e):t?u(t):[]};P.prototype.listenerCount=function(e){return this.listeners(e).length};P.prototype.hasListeners=function(e){if(this.wildcard){var r=[];var n=typeof e==="string"?e.split(this.delimiter):e.slice();E.call(this,r,n,this.listenerTree,0);return r.length>0}var i=this._events;var a=this._all;return!!(a&&a.length||i&&(e===t?u(i).length:i[e]))};P.prototype.listenersAny=function(){if(this._all){return this._all}else{return[]}};P.prototype.waitFor=function(e,r){var n=this;var i=typeof r;if(i==="number"){r={timeout:r}}else if(i==="function"){r={filter:r}}r=m(r,{timeout:0,filter:t,handleError:false,Promise:Promise,overload:false},{filter:_,Promise:y});return S(r.Promise,(function(t,i,a){function o(){var a=r.filter;if(a&&!a.apply(n,arguments)){return}n.off(e,o);if(r.handleError){var s=arguments[0];s?i(s):t(h.apply(null,arguments).slice(1))}else{t(h.apply(null,arguments))}}a((function(){n.off(e,o)}));n._on(e,o,false)}),{timeout:r.timeout,overload:r.overload})};function O(e,t,r){r=m(r,{Promise:Promise,timeout:0,overload:false},{Promise:y});var n=r.Promise;return S(n,(function(r,n,i){var a;if(typeof e.addEventListener==="function"){a=function(){r(h.apply(null,arguments))};i((function(){e.removeEventListener(t,a)}));e.addEventListener(t,a,{once:true});return}var o=function(){s&&e.removeListener("error",s);r(h.apply(null,arguments))};var s;if(t!=="error"){s=function(r){e.removeListener(t,o);n(r)};e.once("error",s)}i((function(){s&&e.removeListener("error",s);e.removeListener(t,o)}));e.once(t,o)}),{timeout:r.timeout,overload:r.overload})}var C=P.prototype;Object.defineProperties(P,{defaultMaxListeners:{get:function(){return C._maxListeners},set:function(e){if(typeof e!=="number"||e<0||Number.isNaN(e)){throw TypeError("n must be a non-negative number")}C._maxListeners=e},enumerable:true},once:{value:O,writable:true,configurable:true}});Object.defineProperties(C,{_maxListeners:{value:i,writable:true,configurable:true},_observers:{value:null,writable:true,configurable:true}});if(typeof t==="function"&&t.amd){t((function(){return P}))}else{e.exports=P}}()}));var assign=make_assign();var create$2=make_create();var trim$2=make_trim();var Global$3=typeof window!=="undefined"?window:commonjsGlobal;var util={assign:assign,create:create$2,trim:trim$2,bind:bind$2,slice:slice$1,each:each$5,map:map,pluck:pluck$1,isList:isList$1,isFunction:isFunction$2,isObject:isObject$2,Global:Global$3};function make_assign(){if(Object.assign){return Object.assign}else{return function e(t,r,n,i){for(var a=1;a<arguments.length;a++){each$5(Object(arguments[a]),(function(e,r){t[r]=e}))}return t}}}function make_create(){if(Object.create){return function e(t,r,n,i){var a=slice$1(arguments,1);return assign.apply(this,[Object.create(t)].concat(a))}}else{function e(){}return function t(r,n,i,a){var o=slice$1(arguments,1);e.prototype=r;return assign.apply(this,[new e].concat(o))}}}function make_trim(){if(String.prototype.trim){return function e(t){return String.prototype.trim.call(t)}}else{return function e(t){return t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}}}function bind$2(e,t){return function(){return t.apply(e,Array.prototype.slice.call(arguments,0))}}function slice$1(e,t){return Array.prototype.slice.call(e,t||0)}function each$5(e,t){pluck$1(e,(function(e,r){t(e,r);return false}))}function map(e,t){var r=isList$1(e)?[]:{};pluck$1(e,(function(e,n){r[n]=t(e,n);return false}));return r}function pluck$1(e,t){if(isList$1(e)){for(var r=0;r<e.length;r++){if(t(e[r],r)){return e[r]}}}else{for(var n in e){if(e.hasOwnProperty(n)){if(t(e[n],n)){return e[n]}}}}}function isList$1(e){return e!=null&&typeof e!="function"&&typeof e.length=="number"}function isFunction$2(e){return e&&{}.toString.call(e)==="[object Function]"}function isObject$2(e){return e&&{}.toString.call(e)==="[object Object]"}var slice=util.slice;var pluck=util.pluck;var each$4=util.each;var bind$1=util.bind;var create$1=util.create;var isList=util.isList;var isFunction$1=util.isFunction;var isObject$1=util.isObject;var storeEngine={createStore:createStore};var storeAPI={version:"2.0.12",enabled:false,get:function(e,t){var r=this.storage.read(this._namespacePrefix+e);return this._deserialize(r,t)},set:function(e,t){if(t===undefined){return this.remove(e)}this.storage.write(this._namespacePrefix+e,this._serialize(t));return t},remove:function(e){this.storage.remove(this._namespacePrefix+e)},each:function(e){var t=this;this.storage.each((function(r,n){e.call(t,t._deserialize(r),(n||"").replace(t._namespaceRegexp,""))}))},clearAll:function(){this.storage.clearAll()},hasNamespace:function(e){return this._namespacePrefix=="__storejs_"+e+"_"},createStore:function(){return createStore.apply(this,arguments)},addPlugin:function(e){this._addPlugin(e)},namespace:function(e){return createStore(this.storage,this.plugins,e)}};function _warn(){var e=typeof console=="undefined"?null:console;if(!e){return}var t=e.warn?e.warn:e.log;t.apply(e,arguments)}function createStore(e,t,r){if(!r){r=""}if(e&&!isList(e)){e=[e]}if(t&&!isList(t)){t=[t]}var n=r?"__storejs_"+r+"_":"";var i=r?new RegExp("^"+n):null;var a=/^[a-zA-Z0-9_\-]*$/;if(!a.test(r)){throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes")}var o={_namespacePrefix:n,_namespaceRegexp:i,_testStorage:function(e){try{var t="__storejs__test__";e.write(t,t);var r=e.read(t)===t;e.remove(t);return r}catch(e){return false}},_assignPluginFnProp:function(e,t){var r=this[t];this[t]=function t(){var n=slice(arguments,0);var i=this;function a(){if(!r){return}each$4(arguments,(function(e,t){n[t]=e}));return r.apply(i,n)}var o=[a].concat(n);return e.apply(i,o)}},_serialize:function(e){return JSON.stringify(e)},_deserialize:function(e,t){if(!e){return t}var r="";try{r=JSON.parse(e)}catch(t){r=e}return r!==undefined?r:t},_addStorage:function(e){if(this.enabled){return}if(this._testStorage(e)){this.storage=e;this.enabled=true}},_addPlugin:function(e){var t=this;if(isList(e)){each$4(e,(function(e){t._addPlugin(e)}));return}var r=pluck(this.plugins,(function(t){return e===t}));if(r){return}this.plugins.push(e);if(!isFunction$1(e)){throw new Error("Plugins must be function values that return objects")}var n=e.call(this);if(!isObject$1(n)){throw new Error("Plugins must return an object of function properties")}each$4(n,(function(r,n){if(!isFunction$1(r)){throw new Error("Bad plugin property: "+n+" from plugin "+e.name+". Plugins should only return functions.")}t._assignPluginFnProp(r,n)}))},addStorage:function(e){_warn("store.addStorage(storage) is deprecated. Use createStore([storages])");this._addStorage(e)}};var s=create$1(o,storeAPI,{plugins:[]});s.raw={};each$4(s,(function(e,t){if(isFunction$1(e)){s.raw[t]=bind$1(s,e)}}));each$4(e,(function(e){s._addStorage(e)}));each$4(t,(function(e){s._addPlugin(e)}));return s}var Global$2=util.Global;var localStorage_1={name:"localStorage",read:read$3,write:write$3,each:each$3,remove:remove$3,clearAll:clearAll$3};function localStorage$1(){return Global$2.localStorage}function read$3(e){return localStorage$1().getItem(e)}function write$3(e,t){return localStorage$1().setItem(e,t)}function each$3(e){for(var t=localStorage$1().length-1;t>=0;t--){var r=localStorage$1().key(t);e(read$3(r),r)}}function remove$3(e){return localStorage$1().removeItem(e)}function clearAll$3(){return localStorage$1().clear()}var n$5=Object.freeze(Object.assign(Object.create(null),localStorage_1,{default:localStorage_1}));var Global$1=util.Global;var sessionStorage_1={name:"sessionStorage",read:read$2,write:write$2,each:each$2,remove:remove$2,clearAll:clearAll$2};function sessionStorage$1(){return Global$1.sessionStorage}function read$2(e){return sessionStorage$1().getItem(e)}function write$2(e,t){return sessionStorage$1().setItem(e,t)}function each$2(e){for(var t=sessionStorage$1().length-1;t>=0;t--){var r=sessionStorage$1().key(t);e(read$2(r),r)}}function remove$2(e){return sessionStorage$1().removeItem(e)}function clearAll$2(){return sessionStorage$1().clear()}var o$4=Object.freeze(Object.assign(Object.create(null),sessionStorage_1,{default:sessionStorage_1}));var Global=util.Global;var trim$1=util.trim;var cookieStorage$1={name:"cookieStorage",read:read$1,write:write$1,each:each$1,remove:remove$1,clearAll:clearAll$1};var doc=Global.document;function read$1(e){if(!e||!_has(e)){return null}var t="(?:^|.*;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(doc.cookie.replace(new RegExp(t),"$1"))}function each$1(e){var t=doc.cookie.split(/; ?/g);for(var r=t.length-1;r>=0;r--){if(!trim$1(t[r])){continue}var n=t[r].split("=");var i=unescape(n[0]);var a=unescape(n[1]);e(a,i)}}function write$1(e,t){if(!e){return}doc.cookie=escape(e)+"="+escape(t)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/"}function remove$1(e){if(!e||!_has(e)){return}doc.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/"}function clearAll$1(){each$1((function(e,t){remove$1(t)}))}function _has(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(doc.cookie)}var i$3=Object.freeze(Object.assign(Object.create(null),cookieStorage$1,{default:cookieStorage$1}));var memoryStorage_1={name:"memoryStorage",read:read,write:write,each:each,remove:remove,clearAll:clearAll};var memoryStorage={};function read(e){return memoryStorage[e]}function write(e,t){memoryStorage[e]=t}function each(e){for(var t in memoryStorage){if(memoryStorage.hasOwnProperty(t)){e(memoryStorage[t],t)}}}function remove(e){delete memoryStorage[e]}function clearAll(e){memoryStorage={}}var a$3=Object.freeze(Object.assign(Object.create(null),memoryStorage_1,{default:memoryStorage_1}));function s$1(e,t){void 0===t&&(t=!1),e+="";for(var r,n=["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"],i=["0","1","2","3","4","5","6","7","8","9"],a=(t=t||!Salla.config.get("store.settings.arabic_numbers_enabled"))?n:i,o=t?i:n,s=0;s<a.length;s++)r=new RegExp(a[s],"g"),e=e.replace(r,o[s]);return e.replace(t?"٫":".",t?".":"٫")}function l$2(e){var t=("".concat(e).match(/\./g)||[]).length;return t&&1!==t?l$2(e.replace(/\.(.+)\./g,".$1")):e}function c$3(e){return"".concat(e).startsWith("https://")||"".concat(e).startsWith("http://")}function u$3(e){if(c$3(e))return e;var t=Salla.config.get("store.url");return t||(t=window.location.href.split("/").slice(0,-1).join("/"),Salla.config.set("store.url",t)),t.rtrim("/")+"/"+(null==e?void 0:e.ltrim("/"))}function p$1(e,t,r){if(r=r||window.location.href,!t||!e)return r;var n=new RegExp("([?&])"+e+"=[^&]+[&]?","g");return(r=r.replace(n,"$1").split("#")[0].replace(/&$|\?$/,"")).includes("?")?r+="&":r+=(r.endsWith("/")?"":"/")+"?",(r+e+"="+encodeURIComponent(t)).replace(/&$|\?$/,"")}function f$2(e){return window.location.origin+"/"+(null==e?void 0:e.ltrim("/"))}function d$3(e){return c$3(e)?e:Salla.config.get("theme.assets")?Salla.config.get("theme.assets").replace(":path",null==e?void 0:e.ltrim("/")):f$2("themes/"+Salla.config.get("theme.name")+"/"+(null==e?void 0:e.ltrim("/")))}function g$3(e,t,r){var n,i=e[0];return r&&0==e.length?Array.isArray(r)?(r.push(t),r):[r,t]:Array.isArray(r)?(r.push(t),r):"string"==typeof r?[r,t]:r?(r[i]=g$3(e.slice(1),t,r[i]),r):i?((n={})[i]=g$3(e.slice(1),t),n):""===i?[t]:t}function h$3(){return window.self!==window.top}String.prototype.toStudlyCase=function(){return this.trim().replace(/([^a-zA-Z\d].)/g,(function(e){return e.toUpperCase().replace(/[^a-zA-Z\d]/g,"")}))},String.prototype.toDatasetName=function(){return this.startsWith("data-")?this.substr(5).toStudlyCase():this.toStudlyCase()},String.prototype.toSelector=function(){return this.trim().startsWith(".")||this.trim().startsWith("#")?this.toString():"#"+this.toString()},String.prototype.replaceArray=function(e,t){for(var r,n=this,i=0;i<e.length;i++)r=new RegExp(e[i],"g"),n=n.replace(r,t[i]);return n},String.prototype.rtrim=function(e){return void 0===e&&(e="\\s"),this.replace(new RegExp("["+e+"]*$"),"")},String.prototype.ltrim=function(e){return void 0===e&&(e="\\s"),this.replace(new RegExp("^["+e+"]*"),"")},String.prototype.digitsOnly=function(){return Salla.helpers.digitsOnly(this)};var v$2={digitsOnly:function(e){return s$1(e,!0).replace(/[^0-9.]/g,"").replace("..",".").rtrim(".")},inputDigitsOnly:function e(t,r){if(void 0===r&&(r=!1),"string"==typeof t)return document.querySelectorAll(t).forEach((function(t){return e(t,r)}));if(t){var n=Salla.helpers.digitsOnly(t.value);return t.min&&n<parseInt(t.min)?t.value=t.min:t.max&&n>parseInt(t.max)?t.value=t.max:t.maxLength>=1&&n.toString().length>t.maxLength?t.value=n.toString().substring(0,t.maxLength):t.value=r||t.dataset.hasOwnProperty("digitsWithDecimal")?l$2(n):n.replace(/\D/g,"")}Salla.logger.warn("Can't find Object With Id: "+t)},number:s$1,money:function(e,t){void 0===t&&(t=!0);var r=Salla.config.currency(null==e?void 0:e.currency).symbol;return e=s$1(e="object"==typeof e?e.amount:e)+" "+r,t&&["SAR","ر.س"].includes(r)&&Salla.config.get("store.settings.use_sar_symbol")&&(e=e.replace(r,"<i class=sicon-sar></i>")),e},isIframe:h$3,isPreview:function(){return h$3()},setNested:function(e,t,r){for(var n=e,i=t.split("."),a=i.length,o=0;o<a-1;o++){var s=i[o];n[s]||(n[s]={}),n=n[s]}return n[i[a-1]]=r,e},getNested:function(e,t,r){var n=get_1(e,t);return void 0!==n?n:r},inputData:function(e,t,r){if(void 0===r&&(r={}),e.includes("[")){var n=e.split("]").join("").split("["),i=n[0],a=r&&"object"==typeof r?r[i]:void 0;return{name:i,value:g$3(n.slice(1),t,a)}}return{name:e,value:t}},url:Object.freeze({__proto__:null,is_full_url:c$3,base:function(e){return c$3(e)?e:"https://"+new URL(u$3("/")).hostname+"/"+(null==e?void 0:e.ltrim("/"))},get:u$3,domain:function(e){return c$3(e)?e:"".concat(Salla.config.get("store.url",window.location.href.split("/").slice(0,-1).join("/")).rtrim("/"),"/").concat(null==e?void 0:e.ltrim("/"))},addParamToUrl:p$1,baseUrl:f$2,asset:d$3,cdn:function(e,t,r){var n="https://cdn.salla.network/";return(t||r)&&(t=t?",width=".concat(t):"",r=r?",height=".concat(r):"",n+="cdn-cgi/image/fit=scale-down".concat(t).concat(r,",onerror=redirect,format=auto/")),n+(null==e?void 0:e.ltrim("/"))},api:function(e){var t;return(null===(t=Salla.config.get("store.api",u$3("")))||void 0===t?void 0:t.rtrim("/"))+"/"+(null==e?void 0:e.ltrim("/"))},is_page:function(e){return e&&Salla.config.get("page.slug")===e},is_placeholder:function(e){return d$3(salla.config.get("theme.settings.placeholder"))===d$3(e)}}),addParamToUrl:p$1,debounce:function(e,t){t=t||100;var r,n=[];return function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];return clearTimeout(r),r=setTimeout((function(){var t=e.apply(void 0,i);n.forEach((function(e){return e(t)})),n=[]}),t),new Promise((function(e){return n.push(e)}))}},hasApplePay:function(){var e;try{return!!(null===(e=window.ApplePaySession)||void 0===e?void 0:e.canMakePayments())&&!/snapchat/i.test(navigator.userAgent)}catch(e){return console.error(e),!1}}},y$3=function(e,t){return y$3=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},y$3(e,t)};var m$3=function(){return m$3=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},m$3.apply(this,arguments)};function w$2(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var S$2,b$5,_$2,x$3,A$3=(S$2=console,b$5=[],_$2=[],x$3={log:function(e,t){if(S$2&&salla.config.isDebug()){b$5.push([t,e]),"trace"===salla.config.get("debug")&&(t="trace");var r=S$2.log,n=void 0===t?r:this.__dict__[t]||r,i=["%cTwilight","color: #5cd5c4;font-weight:bold; border:1px solid #5cd5c4; padding: 2px 6px; border-radius: 5px;"];_$2.forEach((function(e){i[0]+=e[0],i.push(e[1])}));var a={event:"#CFF680",backend:"#7b68ee"}[t];a&&(i[0]+="%c"+t[0].toUpperCase()+t.substring(1),i.push("margin-left: 5px;color: ".concat(a,";font-weight:bold; border:1px solid ").concat(a,"; padding: 2px 6px; border-radius: 5px;"))),n.call.apply(n,w$2([S$2],i.concat.apply(i,e),!1))}},__dict__:{trace:S$2.trace,debug:S$2.debug,info:S$2.info,warn:S$2.warn,error:S$2.error}},{event:function(){x$3.log(arguments,"event")},trace:function(){x$3.log(arguments,"trace")},debug:function(){x$3.log(arguments,"debug")},info:function(){x$3.log(arguments,"info")},warn:function(){x$3.log(arguments,"warn")},error:function(){x$3.log(arguments,"error")},log:function(){x$3.log(arguments,void 0)},backend:function(){x$3.log(arguments,"backend")},logs:function(e){[e].flat().forEach((function(e){return e&&x$3.log([e].flat(),"backend")}))},history:function(){return b$5.map((function(e){return S$2.log.apply(S$2,w$2([e[0]],e[1],!1))})),b$5},addPrefix:function(e){return Array.isArray(e)?_$2.unshift(e):this.warn("addPrefix receives array only!"),this}}),E$3=function(){function e(e,t){void 0===e&&(e={}),void 0===t&&(t={}),this.default_properties=t,this.properties_=m$3(m$3({},this.default_properties),e)}return e.prototype.merge=function(e){var t;return this.properties_=m$3(m$3({},this.properties_),e),this.properties_.store=m$3(m$3({},(null===(t=this.default_properties)||void 0===t?void 0:t.store)||{}),this.properties_.store),this},e.prototype.set=function(e,t){return e.includes(".")?(Salla.helpers.setNested(this.properties_,e,t),this):(this.properties_[e]=t,this)},e.prototype.currency=function(e){return void 0===e&&(e=void 0),e=e||this.get("user.currency_code"),this.get("currencies."+e)||Object.values(this.get("currencies"))[0]},e.prototype.get=function(e,t){return void 0===t&&(t=null),e.includes(".")?Salla.helpers.getNested(this.properties_,e,t):this.properties_.hasOwnProperty(e)?this.properties_[e]||t:t||void 0},e.prototype.all=function(){return this.properties_},e.prototype.isDebug=function(){return this.get("debug")||Salla.storage.get("debug")},e}(),k$3=function(e){function t(){var t=this;return(t=e.call(this,{wildcard:!0,delimiter:"::",newListener:!1,removeListener:!1,maxListeners:10,verboseMemoryLeak:!1,ignoreErrors:!1})||this).delimiter="::","undefined"!=typeof document&&(t.body=document.querySelector("body")),t.logableEvents=["cart::item.added.failed","cart::item.deleted.failed"],t.ingoreLogEvents=["document::click","document::keyup","document::change"],t.noneFireableActions=["document.request"],t.emittedEvents=new Set,t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}y$3(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(t,e),t.prototype.createAndDispatch=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this.dispatch.apply(this,w$2([e],t,!1))},t.prototype.emit=function(t){for(var r,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];this.emittedEvents.add(t);var a=t.replace("::",".");if(!this.noneFireableActions.includes(a)&&Salla.call&&"function"==typeof Salla.call(a))return Salla.log("'Salla.".concat(a,"(...)' triggered using event '").concat(t,"'")),a=a.split("."),Array.isArray(n[0])&&(n=n[0]),void(r=salla[a[0]])[a[1]].apply(r,n);e.prototype.emit.apply(this,w$2([t],n,!1)),this.trackEvents.apply(this,w$2([t],n,!1))},t.prototype.onlyWhen=function(e,t){var r=this;return t=t||function(){},new Promise((function(n){return r.emittedEvents.has(e)?n(t()):r.once(e,(function(){return n(t())}))}))},t.prototype.emitAsync=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.emittedEvents.add(t);var i=e.prototype.emitAsync.apply(this,w$2([t],r,!1));try{this.trackEvents.apply(this,w$2([t],r,!1))}catch(e){Salla.logger.warn("error on tracking event (".concat(t,")"),r,e)}return i},t.prototype.trackEvents=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];if("undefined"!=typeof window)try{window.dataLayer=window.dataLayer||[];var i={event:e};r.map((function(e){return"object"==typeof e&&(i=m$3(m$3({},i),e))})),window.dataLayer.push(i)}catch(e){salla.logger.error(e.message)}Salla.logger&&!this.ingoreLogEvents.i