UNPKG

@salla.sa/twilight-components

Version:
4 lines 353 kB
/*! * Crafted with ❤ by Salla */ function t(t,e){e.forEach((function(e){e&&typeof e!=="string"&&!Array.isArray(e)&&Object.keys(e).forEach((function(n){if(n!=="default"&&!(n in t)){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:true,get:function(){return e[n]}})}}))}));return Object.freeze(t)}const e="twilight";const n={hydratedSelectorName:"hydrated",lazyLoad:true,shadowDom:false,slotRelocation:true,updatable:true};var r=typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}var s=i;var a=o;if(typeof r.setTimeout==="function"){s=setTimeout}if(typeof r.clearTimeout==="function"){a=clearTimeout}function u(t){if(s===setTimeout){return setTimeout(t,0)}if((s===i||!s)&&setTimeout){s=setTimeout;return setTimeout(t,0)}try{return s(t,0)}catch(e){try{return s.call(null,t,0)}catch(e){return s.call(this,t,0)}}}function l(t){if(a===clearTimeout){return clearTimeout(t)}if((a===o||!a)&&clearTimeout){a=clearTimeout;return clearTimeout(t)}try{return a(t)}catch(e){try{return a.call(null,t)}catch(e){return a.call(this,t)}}}var c=[];var f=false;var d;var h=-1;function v(){if(!f||!d){return}f=false;if(d.length){c=d.concat(c)}else{h=-1}if(c.length){p()}}function p(){if(f){return}var t=u(v);f=true;var e=c.length;while(e){d=c;c=[];while(++h<e){if(d){d[h].run()}}h=-1;e=c.length}d=null;f=false;l(t)}function g(t){var e=new Array(arguments.length-1);if(arguments.length>1){for(var n=1;n<arguments.length;n++){e[n-1]=arguments[n]}}c.push(new m(t,e));if(c.length===1&&!f){u(p)}}function m(t,e){this.fun=t;this.array=e}m.prototype.run=function(){this.fun.apply(null,this.array)};var b="browser";var w="browser";var y=true;var S={};var k=[];var _="";var j={};var x={};var O={};function E(){}var $=E;var I=E;var T=E;var A=E;var P=E;var R=E;var z=E;function F(t){throw new Error("process.binding is not supported")}function C(){return"/"}function U(t){throw new Error("process.chdir is not supported")}function N(){return 0}var D=r.performance||{};var L=D.now||D.mozNow||D.msNow||D.oNow||D.webkitNow||function(){return(new Date).getTime()};function q(t){var e=L.call(D)*.001;var n=Math.floor(e);var r=Math.floor(e%1*1e9);if(t){n=n-t[0];r=r-t[1];if(r<0){n--;r+=1e9}}return[n,r]}var M=new Date;function B(){var t=new Date;var e=t-M;return e/1e3}var J={nextTick:g,title:b,browser:y,env:S,argv:k,version:_,versions:j,on:$,addListener:I,once:T,off:A,removeListener:P,removeAllListeners:R,emit:z,binding:F,cwd:C,chdir:U,umask:N,hrtime:q,platform:w,release:x,config:O,uptime:B};var G=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};function V(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t["default"]:t}var H;var W;function Q(){if(W)return H;W=1;var t=Array.isArray;H=t;return H}var K;var X;function Z(){if(X)return K;X=1;var t=typeof G=="object"&&G&&G.Object===Object&&G;K=t;return K}var Y;var tt;function et(){if(tt)return Y;tt=1;var t=Z();var e=typeof self=="object"&&self&&self.Object===Object&&self;var n=t||e||Function("return this")();Y=n;return Y}var nt;var rt;function it(){if(rt)return nt;rt=1;var t=et();var e=t.Symbol;nt=e;return nt}var ot;var st;function at(){if(st)return ot;st=1;var t=it();var e=Object.prototype;var n=e.hasOwnProperty;var r=e.toString;var i=t?t.toStringTag:undefined;function o(t){var e=n.call(t,i),o=t[i];try{t[i]=undefined;var s=true}catch(t){}var a=r.call(t);if(s){if(e){t[i]=o}else{delete t[i]}}return a}ot=o;return ot}var ut;var lt;function ct(){if(lt)return ut;lt=1;var t=Object.prototype;var e=t.toString;function n(t){return e.call(t)}ut=n;return ut}var ft;var dt;function ht(){if(dt)return ft;dt=1;var t=it(),e=at(),n=ct();var r="[object Null]",i="[object Undefined]";var o=t?t.toStringTag:undefined;function s(t){if(t==null){return t===undefined?i:r}return o&&o in Object(t)?e(t):n(t)}ft=s;return ft}var vt;var pt;function gt(){if(pt)return vt;pt=1;function t(t){return t!=null&&typeof t=="object"}vt=t;return vt}var mt;var bt;function wt(){if(bt)return mt;bt=1;var t=ht(),e=gt();var n="[object Symbol]";function r(r){return typeof r=="symbol"||e(r)&&t(r)==n}mt=r;return mt}var yt;var St;function kt(){if(St)return yt;St=1;var t=Q(),e=wt();var n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(i,o){if(t(i)){return false}var s=typeof i;if(s=="number"||s=="symbol"||s=="boolean"||i==null||e(i)){return true}return r.test(i)||!n.test(i)||o!=null&&i in Object(o)}yt=i;return yt}var _t;var jt;function xt(){if(jt)return _t;jt=1;function t(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}_t=t;return _t}var Ot;var Et;function $t(){if(Et)return Ot;Et=1;var t=ht(),e=xt();var n="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",o="[object Proxy]";function s(s){if(!e(s)){return false}var a=t(s);return a==r||a==i||a==n||a==o}Ot=s;return Ot}var It;var Tt;function At(){if(Tt)return It;Tt=1;var t=et();var e=t["__core-js_shared__"];It=e;return It}var Pt;var Rt;function zt(){if(Rt)return Pt;Rt=1;var t=At();var e=function(){var e=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function n(t){return!!e&&e in t}Pt=n;return Pt}var Ft;var Ct;function Ut(){if(Ct)return Ft;Ct=1;var t=Function.prototype;var e=t.toString;function n(t){if(t!=null){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}Ft=n;return Ft}var Nt;var Dt;function Lt(){if(Dt)return Nt;Dt=1;var t=$t(),e=zt(),n=xt(),r=Ut();var i=/[\\^$.*+?()[\]{}|]/g;var o=/^\[object .+?Constructor\]$/;var s=Function.prototype,a=Object.prototype;var u=s.toString;var l=a.hasOwnProperty;var c=RegExp("^"+u.call(l).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(i){if(!n(i)||e(i)){return false}var s=t(i)?c:o;return s.test(r(i))}Nt=f;return Nt}var qt;var Mt;function Bt(){if(Mt)return qt;Mt=1;function t(t,e){return t==null?undefined:t[e]}qt=t;return qt}var Jt;var Gt;function Vt(){if(Gt)return Jt;Gt=1;var t=Lt(),e=Bt();function n(n,r){var i=e(n,r);return t(i)?i:undefined}Jt=n;return Jt}var Ht;var Wt;function Qt(){if(Wt)return Ht;Wt=1;var t=Vt();var e=t(Object,"create");Ht=e;return Ht}var Kt;var Xt;function Zt(){if(Xt)return Kt;Xt=1;var t=Qt();function e(){this.__data__=t?t(null):{};this.size=0}Kt=e;return Kt}var Yt;var te;function ee(){if(te)return Yt;te=1;function t(t){var e=this.has(t)&&delete this.__data__[t];this.size-=e?1:0;return e}Yt=t;return Yt}var ne;var re;function ie(){if(re)return ne;re=1;var t=Qt();var e="__lodash_hash_undefined__";var n=Object.prototype;var r=n.hasOwnProperty;function i(n){var i=this.__data__;if(t){var o=i[n];return o===e?undefined:o}return r.call(i,n)?i[n]:undefined}ne=i;return ne}var oe;var se;function ae(){if(se)return oe;se=1;var t=Qt();var e=Object.prototype;var n=e.hasOwnProperty;function r(e){var r=this.__data__;return t?r[e]!==undefined:n.call(r,e)}oe=r;return oe}var ue;var le;function ce(){if(le)return ue;le=1;var t=Qt();var e="__lodash_hash_undefined__";function n(n,r){var i=this.__data__;this.size+=this.has(n)?0:1;i[n]=t&&r===undefined?e:r;return this}ue=n;return ue}var fe;var de;function he(){if(de)return fe;de=1;var t=Zt(),e=ee(),n=ie(),r=ae(),i=ce();function o(t){var e=-1,n=t==null?0:t.length;this.clear();while(++e<n){var r=t[e];this.set(r[0],r[1])}}o.prototype.clear=t;o.prototype["delete"]=e;o.prototype.get=n;o.prototype.has=r;o.prototype.set=i;fe=o;return fe}var ve;var pe;function ge(){if(pe)return ve;pe=1;function t(){this.__data__=[];this.size=0}ve=t;return ve}var me;var be;function we(){if(be)return me;be=1;function t(t,e){return t===e||t!==t&&e!==e}me=t;return me}var ye;var Se;function ke(){if(Se)return ye;Se=1;var t=we();function e(e,n){var r=e.length;while(r--){if(t(e[r][0],n)){return r}}return-1}ye=e;return ye}var _e;var je;function xe(){if(je)return _e;je=1;var t=ke();var e=Array.prototype;var n=e.splice;function r(e){var r=this.__data__,i=t(r,e);if(i<0){return false}var o=r.length-1;if(i==o){r.pop()}else{n.call(r,i,1)}--this.size;return true}_e=r;return _e}var Oe;var Ee;function $e(){if(Ee)return Oe;Ee=1;var t=ke();function e(e){var n=this.__data__,r=t(n,e);return r<0?undefined:n[r][1]}Oe=e;return Oe}var Ie;var Te;function Ae(){if(Te)return Ie;Te=1;var t=ke();function e(e){return t(this.__data__,e)>-1}Ie=e;return Ie}var Pe;var Re;function ze(){if(Re)return Pe;Re=1;var t=ke();function e(e,n){var r=this.__data__,i=t(r,e);if(i<0){++this.size;r.push([e,n])}else{r[i][1]=n}return this}Pe=e;return Pe}var Fe;var Ce;function Ue(){if(Ce)return Fe;Ce=1;var t=ge(),e=xe(),n=$e(),r=Ae(),i=ze();function o(t){var e=-1,n=t==null?0:t.length;this.clear();while(++e<n){var r=t[e];this.set(r[0],r[1])}}o.prototype.clear=t;o.prototype["delete"]=e;o.prototype.get=n;o.prototype.has=r;o.prototype.set=i;Fe=o;return Fe}var Ne;var De;function Le(){if(De)return Ne;De=1;var t=Vt(),e=et();var n=t(e,"Map");Ne=n;return Ne}var qe;var Me;function Be(){if(Me)return qe;Me=1;var t=he(),e=Ue(),n=Le();function r(){this.size=0;this.__data__={hash:new t,map:new(n||e),string:new t}}qe=r;return qe}var Je;var Ge;function Ve(){if(Ge)return Je;Ge=1;function t(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}Je=t;return Je}var He;var We;function Qe(){if(We)return He;We=1;var t=Ve();function e(e,n){var r=e.__data__;return t(n)?r[typeof n=="string"?"string":"hash"]:r.map}He=e;return He}var Ke;var Xe;function Ze(){if(Xe)return Ke;Xe=1;var t=Qe();function e(e){var n=t(this,e)["delete"](e);this.size-=n?1:0;return n}Ke=e;return Ke}var Ye;var tn;function en(){if(tn)return Ye;tn=1;var t=Qe();function e(e){return t(this,e).get(e)}Ye=e;return Ye}var nn;var rn;function on(){if(rn)return nn;rn=1;var t=Qe();function e(e){return t(this,e).has(e)}nn=e;return nn}var sn;var an;function un(){if(an)return sn;an=1;var t=Qe();function e(e,n){var r=t(this,e),i=r.size;r.set(e,n);this.size+=r.size==i?0:1;return this}sn=e;return sn}var ln;var cn;function fn(){if(cn)return ln;cn=1;var t=Be(),e=Ze(),n=en(),r=on(),i=un();function o(t){var e=-1,n=t==null?0:t.length;this.clear();while(++e<n){var r=t[e];this.set(r[0],r[1])}}o.prototype.clear=t;o.prototype["delete"]=e;o.prototype.get=n;o.prototype.has=r;o.prototype.set=i;ln=o;return ln}var dn;var hn;function vn(){if(hn)return dn;hn=1;var t=fn();var e="Expected a function";function n(r,i){if(typeof r!="function"||i!=null&&typeof i!="function"){throw new TypeError(e)}var o=function(){var t=arguments,e=i?i.apply(this,t):t[0],n=o.cache;if(n.has(e)){return n.get(e)}var s=r.apply(this,t);o.cache=n.set(e,s)||n;return s};o.cache=new(n.Cache||t);return o}n.Cache=t;dn=n;return dn}var pn;var gn;function mn(){if(gn)return pn;gn=1;var t=vn();var e=500;function n(n){var r=t(n,(function(t){if(i.size===e){i.clear()}return t}));var i=r.cache;return r}pn=n;return pn}var bn;var wn;function yn(){if(wn)return bn;wn=1;var t=mn();var e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;var n=/\\(\\)?/g;var r=t((function(t){var r=[];if(t.charCodeAt(0)===46){r.push("")}t.replace(e,(function(t,e,i,o){r.push(i?o.replace(n,"$1"):e||t)}));return r}));bn=r;return bn}var Sn;var kn;function _n(){if(kn)return Sn;kn=1;function t(t,e){var n=-1,r=t==null?0:t.length,i=Array(r);while(++n<r){i[n]=e(t[n],n,t)}return i}Sn=t;return Sn}var jn;var xn;function On(){if(xn)return jn;xn=1;var t=it(),e=_n(),n=Q(),r=wt();var i=t?t.prototype:undefined,o=i?i.toString:undefined;function s(t){if(typeof t=="string"){return t}if(n(t)){return e(t,s)+""}if(r(t)){return o?o.call(t):""}var i=t+"";return i=="0"&&1/t==-Infinity?"-0":i}jn=s;return jn}var En;var $n;function In(){if($n)return En;$n=1;var t=On();function e(e){return e==null?"":t(e)}En=e;return En}var Tn;var An;function Pn(){if(An)return Tn;An=1;var t=Q(),e=kt(),n=yn(),r=In();function i(i,o){if(t(i)){return i}return e(i,o)?[i]:n(r(i))}Tn=i;return Tn}var Rn;var zn;function Fn(){if(zn)return Rn;zn=1;var t=wt();function e(e){if(typeof e=="string"||t(e)){return e}var n=e+"";return n=="0"&&1/e==-Infinity?"-0":n}Rn=e;return Rn}var Cn;var Un;function Nn(){if(Un)return Cn;Un=1;var t=Pn(),e=Fn();function n(n,r){r=t(r,n);var i=0,o=r.length;while(n!=null&&i<o){n=n[e(r[i++])]}return i&&i==o?n:undefined}Cn=n;return Cn}var Dn;var Ln;function qn(){if(Ln)return Dn;Ln=1;var t=Nn();function e(e,n,r){var i=e==null?undefined:t(e,n);return i===undefined?r:i}Dn=e;return Dn}var Mn=qn();var Bn=V(Mn);var Jn={exports:{}};var Gn;function Vn(){if(Gn)return Jn.exports;Gn=1;(function(t,e){!function(e){var n=Object.hasOwnProperty;var r=Array.isArray?Array.isArray:function t(e){return Object.prototype.toString.call(e)==="[object Array]"};var i=10;var o=typeof J=="object"&&typeof J.nextTick=="function";var s=typeof Symbol==="function";var a=typeof Reflect==="object";var u=typeof setImmediate==="function";var l=u?setImmediate:setTimeout;var c=s?a&&typeof Reflect.ownKeys==="function"?Reflect.ownKeys:function(t){var e=Object.getOwnPropertyNames(t);e.push.apply(e,Object.getOwnPropertySymbols(t));return e}:Object.keys;function f(){this._events={};if(this._conf){d.call(this,this._conf)}}function d(t){if(t){this._conf=t;t.delimiter&&(this.delimiter=t.delimiter);if(t.maxListeners!==e){this._maxListeners=t.maxListeners}t.wildcard&&(this.wildcard=t.wildcard);t.newListener&&(this._newListener=t.newListener);t.removeListener&&(this._removeListener=t.removeListener);t.verboseMemoryLeak&&(this.verboseMemoryLeak=t.verboseMemoryLeak);t.ignoreErrors&&(this.ignoreErrors=t.ignoreErrors);if(this.wildcard){this.listenerTree={}}}}function h(t,e){var n="(node) warning: possible EventEmitter memory "+"leak detected. "+t+" listeners added. "+"Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak){n+=" Event name: "+e+"."}if(typeof J!=="undefined"&&J.emitWarning){var r=new Error(n);r.name="MaxListenersExceededWarning";r.emitter=this;r.count=t;J.emitWarning(r)}else{console.error(n);if(console.trace){console.trace()}}}var v=function(t,e,n){var r=arguments.length;switch(r){case 0:return[];case 1:return[t];case 2:return[t,e];case 3:return[t,e,n];default:var i=new Array(r);while(r--){i[r]=arguments[r]}return i}};function p(t,n){var r={};var i;var o=t.length;var s=0;for(var a=0;a<o;a++){i=t[a];r[i]=a<s?n[a]:e}return r}function g(t,e,n){this._emitter=t;this._target=e;this._listeners={};this._listenersCount=0;var r,i;if(n.on||n.off){r=n.on;i=n.off}if(e.addEventListener){r=e.addEventListener;i=e.removeEventListener}else if(e.addListener){r=e.addListener;i=e.removeListener}else if(e.on){r=e.on;i=e.off}if(!r&&!i){throw Error("target does not implement any known event API")}if(typeof r!=="function"){throw TypeError("on method must be a function")}if(typeof i!=="function"){throw TypeError("off method must be a function")}this._on=r;this._off=i;var o=t._observers;if(o){o.push(this)}else{t._observers=[this]}}Object.assign(g.prototype,{subscribe:function(t,e,n){var r=this;var i=this._target;var o=this._emitter;var s=this._listeners;var a=function(){var r=v.apply(null,arguments);var s={data:r,name:e,original:t};if(n){var a=n.call(i,s);if(a!==false){o.emit.apply(o,[s.name].concat(r))}return}o.emit.apply(o,[e].concat(r))};if(s[t]){throw Error("Event '"+t+"' is already listening")}this._listenersCount++;if(o._newListener&&o._removeListener&&!r._onNewListener){this._onNewListener=function(n){if(n===e&&s[t]===null){s[t]=a;r._on.call(i,t,a)}};o.on("newListener",this._onNewListener);this._onRemoveListener=function(n){if(n===e&&!o.hasListeners(n)&&s[t]){s[t]=null;r._off.call(i,t,a)}};s[t]=null;o.on("removeListener",this._onRemoveListener)}else{s[t]=a;r._on.call(i,t,a)}},unsubscribe:function(t){var e=this;var n=this._listeners;var r=this._emitter;var i;var o;var s=this._off;var a=this._target;var u;if(t&&typeof t!=="string"){throw TypeError("event must be a string")}function l(){if(e._onNewListener){r.off("newListener",e._onNewListener);r.off("removeListener",e._onRemoveListener);e._onNewListener=null;e._onRemoveListener=null}var t=_.call(r,e);r._observers.splice(t,1)}if(t){i=n[t];if(!i)return;s.call(a,t,i);delete n[t];if(! --this._listenersCount){l()}}else{o=c(n);u=o.length;while(u-- >0){t=o[u];s.call(a,t,n[t])}this._listeners={};this._listenersCount=0;l()}}});function m(t,r,i,o){var s=Object.assign({},r);if(!t)return s;if(typeof t!=="object"){throw TypeError("options must be an object")}var a=Object.keys(t);var u=a.length;var l,c;var f;function d(t){throw Error('Invalid "'+l+'" option value'+(t?". Reason: "+t:""))}for(var h=0;h<u;h++){l=a[h];if(!n.call(r,l)){throw Error('Unknown "'+l+'" option')}c=t[l];if(c!==e){f=i[l];s[l]=f?f(c,d):c}}return s}function b(t,e){if(typeof t!=="function"||!t.hasOwnProperty("prototype")){e("value must be a constructor")}return t}function w(t){var e="value must be type of "+t.join("|");var n=t.length;var r=t[0];var i=t[1];if(n===1){return function(t,n){if(typeof t===r){return t}n(e)}}if(n===2){return function(t,n){var o=typeof t;if(o===r||o===i)return t;n(e)}}return function(r,i){var o=typeof r;var s=n;while(s-- >0){if(o===t[s])return r}i(e)}}var y=w(["function"]);var S=w(["object","function"]);function k(t,e,n){var r;var i;var o=0;var s;var a=new t((function(u,l,c){n=m(n,{timeout:0,overload:false},{timeout:function(t,e){t*=1;if(typeof t!=="number"||t<0||!Number.isFinite(t)){e("timeout must be a positive number")}return t}});r=!n.overload&&typeof t.prototype.cancel==="function"&&typeof c==="function";function f(){if(i){i=null}if(o){clearTimeout(o);o=0}}var d=function(t){f();u(t)};var h=function(t){f();l(t)};if(r){e(d,h,c)}else{i=[function(t){h(t||Error("canceled"))}];e(d,h,(function(t){if(s){throw Error("Unable to subscribe on cancel event asynchronously")}if(typeof t!=="function"){throw TypeError("onCancel callback must be a function")}i.push(t)}));s=true}if(n.timeout>0){o=setTimeout((function(){var t=Error("timeout");t.code="ETIMEDOUT";o=0;a.cancel(t);l(t)}),n.timeout)}}));if(!r){a.cancel=function(t){if(!i){return}var e=i.length;for(var n=1;n<e;n++){i[n](t)}i[0](t);i=null}}return a}function _(t){var e=this._observers;if(!e){return-1}var n=e.length;for(var r=0;r<n;r++){if(e[r]._target===t)return r}return-1}function j(t,e,n,r,i){if(!n){return null}if(r===0){var o=typeof e;if(o==="string"){var s,a,u=0,l=0,f=this.delimiter,d=f.length;if((a=e.indexOf(f))!==-1){s=new Array(5);do{s[u++]=e.slice(l,a);l=a+d}while((a=e.indexOf(f,l))!==-1);s[u++]=e.slice(l);e=s;i=u}else{e=[e];i=1}}else if(o==="object"){i=e.length}else{e=[e];i=1}}var h=null,v,p,g,m,b,w=e[r],y=e[r+1],S,k;if(r===i){if(n._listeners){if(typeof n._listeners==="function"){t&&t.push(n._listeners);h=[n]}else{t&&t.push.apply(t,n._listeners);h=[n]}}}else{if(w==="*"){S=c(n);a=S.length;while(a-- >0){v=S[a];if(v!=="_listeners"){k=j(t,e,n[v],r+1,i);if(k){if(h){h.push.apply(h,k)}else{h=k}}}}return h}else if(w==="**"){b=r+1===i||r+2===i&&y==="*";if(b&&n._listeners){h=j(t,e,n,i,i)}S=c(n);a=S.length;while(a-- >0){v=S[a];if(v!=="_listeners"){if(v==="*"||v==="**"){if(n[v]._listeners&&!b){k=j(t,e,n[v],i,i);if(k){if(h){h.push.apply(h,k)}else{h=k}}}k=j(t,e,n[v],r,i)}else if(v===y){k=j(t,e,n[v],r+2,i)}else{k=j(t,e,n[v],r,i)}if(k){if(h){h.push.apply(h,k)}else{h=k}}}}return h}else if(n[w]){h=j(t,e,n[w],r+1,i)}}p=n["*"];if(p){j(t,e,p,r+1,i)}g=n["**"];if(g){if(r<i){if(g._listeners){j(t,e,g,i,i)}S=c(g);a=S.length;while(a-- >0){v=S[a];if(v!=="_listeners"){if(v===y){j(t,e,g[v],r+2,i)}else if(v===w){j(t,e,g[v],r+1,i)}else{m={};m[v]=g[v];j(t,e,{"**":m},r+1,i)}}}}else if(g._listeners){j(t,e,g,i,i)}else if(g["*"]&&g["*"]._listeners){j(t,e,g["*"],i,i)}}return h}function x(t,e,n){var r=0,i=0,o,s=this.delimiter,a=s.length,u;if(typeof t==="string"){if((o=t.indexOf(s))!==-1){u=new Array(5);do{u[r++]=t.slice(i,o);i=o+a}while((o=t.indexOf(s,i))!==-1);u[r++]=t.slice(i)}else{u=[t];r=1}}else{u=t;r=t.length}if(r>1){for(o=0;o+1<r;o++){if(u[o]==="**"&&u[o+1]==="**"){return}}}var l=this.listenerTree,c;for(o=0;o<r;o++){c=u[o];l=l[c]||(l[c]={});if(o===r-1){if(!l._listeners){l._listeners=e}else{if(typeof l._listeners==="function"){l._listeners=[l._listeners]}if(n){l._listeners.unshift(e)}else{l._listeners.push(e)}if(!l._listeners.warned&&this._maxListeners>0&&l._listeners.length>this._maxListeners){l._listeners.warned=true;h.call(this,l._listeners.length,c)}}return true}}return true}function O(t,e,n,r){var i=c(t);var o=i.length;var s,a,u;var l=t["_listeners"];var f;while(o-- >0){a=i[o];s=t[a];if(a==="_listeners"){u=n}else{u=n?n.concat(a):[a]}f=r||typeof a==="symbol";l&&e.push(f?u:u.join(this.delimiter));if(typeof s==="object"){O.call(this,s,e,u,f)}}return e}function E(t){var e=c(t);var n=e.length;var r,i,o;while(n-- >0){i=e[n];r=t[i];if(r){o=true;if(i!=="_listeners"&&!E(r)){delete t[i]}}}return o}function $(t,e,n){this.emitter=t;this.event=e;this.listener=n}$.prototype.off=function(){this.emitter.off(this.event,this.listener);return this};function I(t,n,r){if(r===true){s=true}else if(r===false){i=true}else{if(!r||typeof r!=="object"){throw TypeError("options should be an object or true")}var i=r.async;var s=r.promisify;var a=r.nextTick;var u=r.objectify}if(i||a||s){var c=n;var f=n._origin||n;if(a&&!o){throw Error("process.nextTick is not supported")}if(s===e){s=n.constructor.name==="AsyncFunction"}n=function(){var t=arguments;var e=this;var n=this.event;return s?a?Promise.resolve():new Promise((function(t){l(t)})).then((function(){e.event=n;return c.apply(e,t)})):(a?J.nextTick:l)((function(){e.event=n;c.apply(e,t)}))};n._async=true;n._origin=f}return[n,u?new $(this,t,n):this]}function T(t){this._events={};this._newListener=false;this._removeListener=false;this.verboseMemoryLeak=false;d.call(this,t)}T.EventEmitter2=T;T.prototype.listenTo=function(t,n,i){if(typeof t!=="object"){throw TypeError("target musts be an object")}var o=this;i=m(i,{on:e,off:e,reducers:e},{on:y,off:y,reducers:S});function s(e){if(typeof e!=="object"){throw TypeError("events must be an object")}var n=i.reducers;var r=_.call(o,t);var s;if(r===-1){s=new g(o,t,i)}else{s=o._observers[r]}var a=c(e);var u=a.length;var l;var f=typeof n==="function";for(var d=0;d<u;d++){l=a[d];s.subscribe(l,e[l]||l,f?n:n&&n[l])}}r(n)?s(p(n)):typeof n==="string"?s(p(n.split(/\s+/))):s(n);return this};T.prototype.stopListeningTo=function(t,e){var n=this._observers;if(!n){return false}var r=n.length;var i;var o=false;if(t&&typeof t!=="object"){throw TypeError("target should be an object")}while(r-- >0){i=n[r];if(!t||i._target===t){i.unsubscribe(e);o=true}}return o};T.prototype.delimiter=".";T.prototype.setMaxListeners=function(t){if(t!==e){this._maxListeners=t;if(!this._conf)this._conf={};this._conf.maxListeners=t}};T.prototype.getMaxListeners=function(){return this._maxListeners};T.prototype.event="";T.prototype.once=function(t,e,n){return this._once(t,e,false,n)};T.prototype.prependOnceListener=function(t,e,n){return this._once(t,e,true,n)};T.prototype._once=function(t,e,n,r){return this._many(t,1,e,n,r)};T.prototype.many=function(t,e,n,r){return this._many(t,e,n,false,r)};T.prototype.prependMany=function(t,e,n,r){return this._many(t,e,n,true,r)};T.prototype._many=function(t,e,n,r,i){var o=this;if(typeof n!=="function"){throw new Error("many only accepts instances of Function")}function s(){if(--e===0){o.off(t,s)}return n.apply(this,arguments)}s._origin=n;return this._on(t,s,r,i)};T.prototype.emit=function(){if(!this._events&&!this._all){return false}this._events||f.call(this);var t=arguments[0],e,n=this.wildcard;var r,i,o,a,u;if(t==="newListener"&&!this._newListener){if(!this._events.newListener){return false}}if(n){e=t;if(t!=="newListener"&&t!=="removeListener"){if(typeof t==="object"){i=t.length;if(s){for(o=0;o<i;o++){if(typeof t[o]==="symbol"){u=true;break}}}if(!u){t=t.join(this.delimiter)}}}}var l=arguments.length;var c;if(this._all&&this._all.length){c=this._all.slice();for(o=0,i=c.length;o<i;o++){this.event=t;switch(l){case 1:c[o].call(this,t);break;case 2:c[o].call(this,t,arguments[1]);break;case 3:c[o].call(this,t,arguments[1],arguments[2]);break;default:c[o].apply(this,arguments)}}}if(n){c=[];j.call(this,c,e,this.listenerTree,0,i)}else{c=this._events[t];if(typeof c==="function"){this.event=t;switch(l){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:r=new Array(l-1);for(a=1;a<l;a++)r[a-1]=arguments[a];c.apply(this,r)}return true}else if(c){c=c.slice()}}if(c&&c.length){if(l>3){r=new Array(l-1);for(a=1;a<l;a++)r[a-1]=arguments[a]}for(o=0,i=c.length;o<i;o++){this.event=t;switch(l){case 1:c[o].call(this);break;case 2:c[o].call(this,arguments[1]);break;case 3:c[o].call(this,arguments[1],arguments[2]);break;default:c[o].apply(this,r)}}return true}else if(!this.ignoreErrors&&!this._all&&t==="error"){if(arguments[1]instanceof Error){throw arguments[1]}else{throw new Error("Uncaught, unspecified 'error' event.")}}return!!this._all};T.prototype.emitAsync=function(){if(!this._events&&!this._all){return false}this._events||f.call(this);var t=arguments[0],e=this.wildcard,n,r;var i,o,a,u;if(t==="newListener"&&!this._newListener){if(!this._events.newListener){return Promise.resolve([false])}}if(e){n=t;if(t!=="newListener"&&t!=="removeListener"){if(typeof t==="object"){o=t.length;if(s){for(a=0;a<o;a++){if(typeof t[a]==="symbol"){r=true;break}}}if(!r){t=t.join(this.delimiter)}}}}var l=[];var c=arguments.length;var d;if(this._all){for(a=0,o=this._all.length;a<o;a++){this.event=t;switch(c){case 1:l.push(this._all[a].call(this,t));break;case 2:l.push(this._all[a].call(this,t,arguments[1]));break;case 3:l.push(this._all[a].call(this,t,arguments[1],arguments[2]));break;default:l.push(this._all[a].apply(this,arguments))}}}if(e){d=[];j.call(this,d,n,this.listenerTree,0)}else{d=this._events[t]}if(typeof d==="function"){this.event=t;switch(c){case 1:l.push(d.call(this));break;case 2:l.push(d.call(this,arguments[1]));break;case 3:l.push(d.call(this,arguments[1],arguments[2]));break;default:i=new Array(c-1);for(u=1;u<c;u++)i[u-1]=arguments[u];l.push(d.apply(this,i))}}else if(d&&d.length){d=d.slice();if(c>3){i=new Array(c-1);for(u=1;u<c;u++)i[u-1]=arguments[u]}for(a=0,o=d.length;a<o;a++){this.event=t;switch(c){case 1:l.push(d[a].call(this));break;case 2:l.push(d[a].call(this,arguments[1]));break;case 3:l.push(d[a].call(this,arguments[1],arguments[2]));break;default:l.push(d[a].apply(this,i))}}}else if(!this.ignoreErrors&&!this._all&&t==="error"){if(arguments[1]instanceof Error){return Promise.reject(arguments[1])}else{return Promise.reject("Uncaught, unspecified 'error' event.")}}return Promise.all(l)};T.prototype.on=function(t,e,n){return this._on(t,e,false,n)};T.prototype.prependListener=function(t,e,n){return this._on(t,e,true,n)};T.prototype.onAny=function(t){return this._onAny(t,false)};T.prototype.prependAny=function(t){return this._onAny(t,true)};T.prototype.addListener=T.prototype.on;T.prototype._onAny=function(t,e){if(typeof t!=="function"){throw new Error("onAny only accepts instances of Function")}if(!this._all){this._all=[]}if(e){this._all.unshift(t)}else{this._all.push(t)}return this};T.prototype._on=function(t,n,r,i){if(typeof t==="function"){this._onAny(t,n);return this}if(typeof n!=="function"){throw new Error("on only accepts instances of Function")}this._events||f.call(this);var o=this,s;if(i!==e){s=I.call(this,t,n,i);n=s[0];o=s[1]}if(this._newListener){this.emit("newListener",t,n)}if(this.wildcard){x.call(this,t,n,r);return o}if(!this._events[t]){this._events[t]=n}else{if(typeof this._events[t]==="function"){this._events[t]=[this._events[t]]}if(r){this._events[t].unshift(n)}else{this._events[t].push(n)}if(!this._events[t].warned&&this._maxListeners>0&&this._events[t].length>this._maxListeners){this._events[t].warned=true;h.call(this,this._events[t].length,t)}}return o};T.prototype.off=function(t,e){if(typeof e!=="function"){throw new Error("removeListener only takes instances of Function")}var n,i=[];if(this.wildcard){var o=typeof t==="string"?t.split(this.delimiter):t.slice();i=j.call(this,null,o,this.listenerTree,0);if(!i)return this}else{if(!this._events[t])return this;n=this._events[t];i.push({_listeners:n})}for(var s=0;s<i.length;s++){var a=i[s];n=a._listeners;if(r(n)){var u=-1;for(var l=0,c=n.length;l<c;l++){if(n[l]===e||n[l].listener&&n[l].listener===e||n[l]._origin&&n[l]._origin===e){u=l;break}}if(u<0){continue}if(this.wildcard){a._listeners.splice(u,1)}else{this._events[t].splice(u,1)}if(n.length===0){if(this.wildcard){delete a._listeners}else{delete this._events[t]}}if(this._removeListener)this.emit("removeListener",t,e);return this}else if(n===e||n.listener&&n.listener===e||n._origin&&n._origin===e){if(this.wildcard){delete a._listeners}else{delete this._events[t]}if(this._removeListener)this.emit("removeListener",t,e)}}this.listenerTree&&E(this.listenerTree);return this};T.prototype.offAny=function(t){var e=0,n=0,r;if(t&&this._all&&this._all.length>0){r=this._all;for(e=0,n=r.length;e<n;e++){if(t===r[e]){r.splice(e,1);if(this._removeListener)this.emit("removeListenerAny",t);return this}}}else{r=this._all;if(this._removeListener){for(e=0,n=r.length;e<n;e++)this.emit("removeListenerAny",r[e])}this._all=[]}return this};T.prototype.removeListener=T.prototype.off;T.prototype.removeAllListeners=function(t){if(t===e){!this._events||f.call(this);return this}if(this.wildcard){var n=j.call(this,null,t,this.listenerTree,0),r,i;if(!n)return this;for(i=0;i<n.length;i++){r=n[i];r._listeners=null}this.listenerTree&&E(this.listenerTree)}else if(this._events){this._events[t]=null}return this};T.prototype.listeners=function(t){var n=this._events;var r,i,o;var s;var a;if(t===e){if(this.wildcard){throw Error("event name required for wildcard emitter")}if(!n){return[]}r=c(n);s=r.length;o=[];while(s-- >0){i=n[r[s]];if(typeof i==="function"){o.push(i)}else{o.push.apply(o,i)}}return o}else{if(this.wildcard){a=this.listenerTree;if(!a)return[];var u=[];var l=typeof t==="string"?t.split(this.delimiter):t.slice();j.call(this,u,l,a,0);return u}if(!n){return[]}i=n[t];if(!i){return[]}return typeof i==="function"?[i]:i}};T.prototype.eventNames=function(t){var e=this._events;return this.wildcard?O.call(this,this.listenerTree,[],null,t):e?c(e):[]};T.prototype.listenerCount=function(t){return this.listeners(t).length};T.prototype.hasListeners=function(t){if(this.wildcard){var n=[];var r=typeof t==="string"?t.split(this.delimiter):t.slice();j.call(this,n,r,this.listenerTree,0);return n.length>0}var i=this._events;var o=this._all;return!!(o&&o.length||i&&(t===e?c(i).length:i[t]))};T.prototype.listenersAny=function(){if(this._all){return this._all}else{return[]}};T.prototype.waitFor=function(t,n){var r=this;var i=typeof n;if(i==="number"){n={timeout:n}}else if(i==="function"){n={filter:n}}n=m(n,{timeout:0,filter:e,handleError:false,Promise,overload:false},{filter:y,Promise:b});return k(n.Promise,(function(e,i,o){function s(){var o=n.filter;if(o&&!o.apply(r,arguments)){return}r.off(t,s);if(n.handleError){var a=arguments[0];a?i(a):e(v.apply(null,arguments).slice(1))}else{e(v.apply(null,arguments))}}o((function(){r.off(t,s)}));r._on(t,s,false)}),{timeout:n.timeout,overload:n.overload})};function A(t,e,n){n=m(n,{Promise,timeout:0,overload:false},{Promise:b});var r=n.Promise;return k(r,(function(n,r,i){var o;if(typeof t.addEventListener==="function"){o=function(){n(v.apply(null,arguments))};i((function(){t.removeEventListener(e,o)}));t.addEventListener(e,o,{once:true});return}var s=function(){a&&t.removeListener("error",a);n(v.apply(null,arguments))};var a;if(e!=="error"){a=function(n){t.removeListener(e,s);r(n)};t.once("error",a)}i((function(){a&&t.removeListener("error",a);t.removeListener(e,s)}));t.once(e,s)}),{timeout:n.timeout,overload:n.overload})}var P=T.prototype;Object.defineProperties(T,{defaultMaxListeners:{get:function(){return P._maxListeners},set:function(t){if(typeof t!=="number"||t<0||Number.isNaN(t)){throw TypeError("n must be a non-negative number")}P._maxListeners=t},enumerable:true},once:{value:A,writable:true,configurable:true}});Object.defineProperties(P,{_maxListeners:{value:i,writable:true,configurable:true},_observers:{value:null,writable:true,configurable:true}});{t.exports=T}}()})(Jn);return Jn.exports}var Hn=Vn();var Wn;var Qn;function Kn(){if(Qn)return Wn;Qn=1;var t=i();var e=o();var n=s();var r=typeof window!=="undefined"?window:G;Wn={assign:t,create:e,trim:n,bind:a,slice:u,each:l,map:c,pluck:f,isList:d,isFunction:h,isObject:v,Global:r};function i(){if(Object.assign){return Object.assign}else{return function t(e,n,r,i){for(var o=1;o<arguments.length;o++){l(Object(arguments[o]),(function(t,n){e[n]=t}))}return e}}}function o(){if(Object.create){return function e(n,r,i,o){var s=u(arguments,1);return t.apply(this,[Object.create(n)].concat(s))}}else{function e(){}return function n(r,i,o,s){var a=u(arguments,1);e.prototype=r;return t.apply(this,[new e].concat(a))}}}function s(){if(String.prototype.trim){return function t(e){return String.prototype.trim.call(e)}}else{return function t(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}}}function a(t,e){return function(){return e.apply(t,Array.prototype.slice.call(arguments,0))}}function u(t,e){return Array.prototype.slice.call(t,e||0)}function l(t,e){f(t,(function(t,n){e(t,n);return false}))}function c(t,e){var n=d(t)?[]:{};f(t,(function(t,r){n[r]=e(t,r);return false}));return n}function f(t,e){if(d(t)){for(var n=0;n<t.length;n++){if(e(t[n],n)){return t[n]}}}else{for(var r in t){if(t.hasOwnProperty(r)){if(e(t[r],r)){return t[r]}}}}}function d(t){return t!=null&&typeof t!="function"&&typeof t.length=="number"}function h(t){return t&&{}.toString.call(t)==="[object Function]"}function v(t){return t&&{}.toString.call(t)==="[object Object]"}return Wn}var Xn;var Zn;function Yn(){if(Zn)return Xn;Zn=1;var t=Kn();var e=t.slice;var n=t.pluck;var r=t.each;var i=t.bind;var o=t.create;var s=t.isList;var a=t.isFunction;var u=t.isObject;Xn={createStore:f};var l={version:"2.0.12",enabled:false,get:function(t,e){var n=this.storage.read(this._namespacePrefix+t);return this._deserialize(n,e)},set:function(t,e){if(e===undefined){return this.remove(t)}this.storage.write(this._namespacePrefix+t,this._serialize(e));return e},remove:function(t){this.storage.remove(this._namespacePrefix+t)},each:function(t){var e=this;this.storage.each((function(n,r){t.call(e,e._deserialize(n),(r||"").replace(e._namespaceRegexp,""))}))},clearAll:function(){this.storage.clearAll()},hasNamespace:function(t){return this._namespacePrefix=="__storejs_"+t+"_"},createStore:function(){return f.apply(this,arguments)},addPlugin:function(t){this._addPlugin(t)},namespace:function(t){return f(this.storage,this.plugins,t)}};function c(){var t=typeof console=="undefined"?null:console;if(!t){return}var e=t.warn?t.warn:t.log;e.apply(t,arguments)}function f(t,f,d){if(!d){d=""}if(t&&!s(t)){t=[t]}if(f&&!s(f)){f=[f]}var h=d?"__storejs_"+d+"_":"";var v=d?new RegExp("^"+h):null;var p=/^[a-zA-Z0-9_\-]*$/;if(!p.test(d)){throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes")}var g={_namespacePrefix:h,_namespaceRegexp:v,_testStorage:function(t){try{var e="__storejs__test__";t.write(e,e);var n=t.read(e)===e;t.remove(e);return n}catch(t){return false}},_assignPluginFnProp:function(t,n){var i=this[n];this[n]=function n(){var o=e(arguments,0);var s=this;function a(){if(!i){return}r(arguments,(function(t,e){o[e]=t}));return i.apply(s,o)}var u=[a].concat(o);return t.apply(s,u)}},_serialize:function(t){return JSON.stringify(t)},_deserialize:function(t,e){if(!t){return e}var n="";try{n=JSON.parse(t)}catch(e){n=t}return n!==undefined?n:e},_addStorage:function(t){if(this.enabled){return}if(this._testStorage(t)){this.storage=t;this.enabled=true}},_addPlugin:function(t){var e=this;if(s(t)){r(t,(function(t){e._addPlugin(t)}));return}var i=n(this.plugins,(function(e){return t===e}));if(i){return}this.plugins.push(t);if(!a(t)){throw new Error("Plugins must be function values that return objects")}var o=t.call(this);if(!u(o)){throw new Error("Plugins must return an object of function properties")}r(o,(function(n,r){if(!a(n)){throw new Error("Bad plugin property: "+r+" from plugin "+t.name+". Plugins should only return functions.")}e._assignPluginFnProp(n,r)}))},addStorage:function(t){c("store.addStorage(storage) is deprecated. Use createStore([storages])");this._addStorage(t)}};var m=o(g,l,{plugins:[]});m.raw={};r(m,(function(t,e){if(a(t)){m.raw[e]=i(m,t)}}));r(t,(function(t){m._addStorage(t)}));r(f,(function(t){m._addPlugin(t)}));return m}return Xn}var tr=Yn();var er;var nr;function rr(){if(nr)return er;nr=1;var t=Kn();var e=t.Global;er={name:"localStorage",read:r,write:i,each:o,remove:s,clearAll:a};function n(){return e.localStorage}function r(t){return n().getItem(t)}function i(t,e){return n().setItem(t,e)}function o(t){for(var e=n().length-1;e>=0;e--){var i=n().key(e);t(r(i),i)}}function s(t){return n().removeItem(t)}function a(){return n().clear()}return er}var ir=rr();var or=V(ir);var sr=t({__proto__:null,default:or},[ir]);var ar;var ur;function lr(){if(ur)return ar;ur=1;var t=Kn();var e=t.Global;ar={name:"sessionStorage",read:r,write:i,each:o,remove:s,clearAll:a};function n(){return e.sessionStorage}function r(t){return n().getItem(t)}function i(t,e){return n().setItem(t,e)}function o(t){for(var e=n().length-1;e>=0;e--){var i=n().key(e);t(r(i),i)}}function s(t){return n().removeItem(t)}function a(){return n().clear()}return ar}var cr=lr();var fr=V(cr);var dr=t({__proto__:null,default:fr},[cr]);var hr;var vr;function pr(){if(vr)return hr;vr=1;var t=Kn();var e=t.Global;var n=t.trim;hr={name:"cookieStorage",read:i,write:s,each:o,remove:a,clearAll:u};var r=e.document;function i(t){if(!t||!l(t)){return null}var e="(?:^|.*;\\s*)"+escape(t).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(r.cookie.replace(new RegExp(e),"$1"))}function o(t){var e=r.cookie.split(/; ?/g);for(var i=e.length-1;i>=0;i--){if(!n(e[i])){continue}var o=e[i].split("=");var s=unescape(o[0]);var a=unescape(o[1]);t(a,s)}}function s(t,e){if(!t){return}r.cookie=escape(t)+"="+escape(e)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/"}function a(t){if(!t||!l(t)){return}r.cookie=escape(t)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/"}function u(){o((function(t,e){a(e)}))}function l(t){return new RegExp("(?:^|;\\s*)"+escape(t).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(r.cookie)}return hr}var gr=pr();var mr=V(gr);var br=t({__proto__:null,default:mr},[gr]);var wr;var yr;function Sr(){if(yr)return wr;yr=1;wr={name:"memoryStorage",read:e,write:n,each:r,remove:i,clearAll:o};var t={};function e(e){return t[e]}function n(e,n){t[e]=n}function r(e){for(var n in t){if(t.hasOwnProperty(n)){e(t[n],n)}}}function i(e){delete t[e]}function o(e){t={}}return wr}var kr=Sr();var _r=V(kr);var jr=t({__proto__:null,default:_r},[kr]);function xr(t,e){void 0===e&&(e=false),t+="";for(var n,r=["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"],i=["0","1","2","3","4","5","6","7","8","9"],o=(e=e||!Salla.config.get("store.settings.arabic_numbers_enabled"))?r:i,s=e?i:r,a=0;a<o.length;a++)n=new RegExp(o[a],"g"),t=t.replace(n,s[a]);return t.replace(e?"٫":".",e?".":"٫")}function Or(t){var e=("".concat(t).match(/\./g)||[]).length;return e&&1!==e?Or(t.replace(/\.(.+)\./g,".$1")):t}function Er(t){return"".concat(t).startsWith("https://")||"".concat(t).startsWith("http://")}function $r(t){if(Er(t))return t;var e=Salla.config.get("store.url");return e||(e=window.location.href.split("/").slice(0,-1).join("/"),Salla.config.set("store.url",e)),e.rtrim("/")+"/"+(null==t?void 0:t.ltrim("/"))}function Ir(t,e,n){if(n=n||window.location.href,!e||!t)return n;var r=new RegExp("([?&])"+t+"=[^&]+[&]?","g");return(n=n.replace(r,"$1").split("#")[0].replace(/&$|\?$/,"")).includes("?")?n+="&":n+=(n.endsWith("/")?"":"/")+"?",(n+t+"="+encodeURIComponent(e)).replace(/&$|\?$/,"")}function Tr(t){return window.location.origin+"/"+(null==t?void 0:t.ltrim("/"))}function Ar(t){return Er(t)?t:Salla.config.get("theme.assets")?Salla.config.get("theme.assets").replace(":path",null==t?void 0:t.ltrim("/")):Tr("themes/"+Salla.config.get("theme.name")+"/"+(null==t?void 0:t.ltrim("/")))}function Pr(t,e,n){var r,i=t[0];return n&&0==t.length?Array.isArray(n)?(n.push(e),n):[n,e]:Array.isArray(n)?(n.push(e),n):"string"==typeof n?[n,e]:n?(n[i]=Pr(t.slice(1),e,n[i]),n):i?((r={})[i]=Pr(t.slice(1),e),r):""===i?[e]:e}function Rr(){return window.self!==window.top}String.prototype.toStudlyCase=function(){return this.trim().replace(/([^a-zA-Z\d].)/g,(function(t){return t.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(t,e){for(var n,r=this,i=0;i<t.length;i++)n=new RegExp(t[i],"g"),r=r.replace(n,e[i]);return r},String.prototype.rtrim=function(t){return void 0===t&&(t="\\s"),this.replace(new RegExp("["+t+"]*$"),"")},String.prototype.ltrim=function(t){return void 0===t&&(t="\\s"),this.replace(new RegExp("^["+t+"]*"),"")},String.prototype.digitsOnly=function(){return Salla.helpers.digitsOnly(this)};var zr={digitsOnly:function(t){return xr(t,true).replace(/[^0-9.]/g,"").replace("..",".").rtrim(".")},inputDigitsOnly:function t(e,n){if(void 0===n&&(n=false),"string"==typeof e)return document.querySelectorAll(e).forEach((function(e){return t(e,n)}));if(e){var r=Salla.helpers.digitsOnly(e.value);return e.min&&r<parseInt(e.min)?e.value=e.min:e.max&&r>parseInt(e.max)?e.value=e.max:e.maxLength>=1&&r.toString().length>e.maxLength?e.value=r.toString().substring(0,e.maxLength):e.value=n||e.dataset.hasOwnProperty("digitsWithDecimal")?Or(r):r.replace(/\D/g,"")}Salla.logger.warn("Can't find Object With Id: "+e)},number:xr,money:function(t,e){void 0===e&&(e=true);var n=Salla.config.currency(null==t?void 0:t.currency).symbol;return t=xr(t="object"==typeof t?t.amount:t)+" "+n,e&&["SAR","ر.س"].includes(n)&&Salla.config.get("store.settings.use_sar_symbol")&&(t=t.replace(n,"<i class=sicon-sar></i>")),t},isIframe:Rr,isPreview:function(){return Rr()},setNested:function(t,e,n){for(var r=t,i=e.split("."),o=i.length,s=0;s<o-1;s++){var a=i[s];r[a]||(r[a]={}),r=r[a]}return r[i[o-1]]=n,t},getNested:function(t,e,n){var r=Bn.default?Bn.default(t,e):Bn(t,e);return void 0!==r?r:n},inputData:function(t,e,n){if(void 0===n&&(n={}),t.includes("[")){var r=t.split("]").join("").split("["),i=r[0],o=n&&"object"==typeof n?n[i]:void 0;return{name:i,value:Pr(r.slice(1),e,o)}}return{name:t,value:e}},url:Object.freeze({__proto__:null,addParamToUrl:Ir,api:function(t){var e;return(null===(e=Salla.config.get("store.api",$r("")))||void 0===e?void 0:e.rtrim("/"))+"/"+(null==t?void 0:t.ltrim("/"))},asset:Ar,base:function(t){return Er(t)?t:"https://"+new URL($r("/")).hostname+"/"+(null==t?void 0:t.ltrim("/"))},baseUrl:Tr,cdn:function(t,e,n){var r="https://cdn.salla.network/";return(e||n)&&(e=e?",width=".concat(e):"",n=n?",height=".concat(n):"",r+="cdn-cgi/image/fit=scale-down".concat(e).concat(n,",onerror=redirect,format=auto/")),r+(null==t?void 0:t.ltrim("/"))},create:function(t,e){return"custom"===t?e:$r("offers"===t?t:"redirect/".concat(t,"/").concat(e))},domain:function(t){return Er(t)?t:"".concat(Salla.config.get("store.url",window.location.href.split("/").slice(0,-1).join("/")).rtrim("/"),"/").concat(null==t?void 0:t.ltrim("/"))},get:$r,is_full_url:Er,is_page:function(t){return t&&Salla.config.get("page.slug")===t},is_placeholder:function(t){return Ar(salla.config.get("theme.settings.placeholder"))===Ar(t)}}),addParamToUrl:Ir,debounce:function(t,e){e=e||100;var n,r=[];return function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return clearTimeout(n),n=setTimeout((function(){var e=t.apply(void 0,i);r.forEach((function(t){return t(e)})),r=[]}),e),new Promise((function(t){return r.push(t)}))}},hasApplePay:function(){var t;try{return!!(null===(t=window.ApplePaySession)||void 0===t?void 0:t.canMakePayments())}catch(t){return console.error(t),false}}},Fr=function(t,e){return Fr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},Fr(t,e)};var Cr=function(){return Cr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Cr.apply(this,arguments)};function Ur(t,e,n){if(2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var Nr,Dr,Lr,qr,Mr=(Nr=console,Dr=[],Lr=[],qr={log:function(t,e){if(Nr&&salla.config.isDebug()){Dr.push([e,t]),"trace"===salla.config.get("debug")&&(e="trace");var n=Nr.log,r=void 0===e?n:this.__dict__[e]||n,i=["%cTwilight","color: #5cd5c4;font-weight:bold; border:1px solid #5cd5c4; padding: 2px 6px; border-radius: 5px;"];Lr.forEach((function(t){i[0]+=t[0],i.push(t[1])}));var o={event:"#CFF680",backend:"#7b68ee"}[e];o&&(i[0]+="%c"+e[0].toUpperCase()+e.substring(1),i.push("margin-left: 5px;color: ".concat(o,";font-weight:bold; border:1px solid ").concat(o,"; padding: 2px 6px; border-radius: 5px;"))),r.call.apply(r,Ur([Nr],i.concat.apply(i,t),false))}},__dict__:{trace:Nr.trace,debug:Nr.debug,info:Nr.info,warn:Nr.warn,error:Nr.error}},{event:function(){qr.log(arguments,"event")},trace:function(){qr.log(arguments,"trace")},debug:function(){qr.log(arguments,"debug")},info:function(){qr.log(arguments,"info")},warn:function(){qr.log(arguments,"warn")},error:function(){qr.log(arguments,"error")},log:function(){qr.log(arguments,void 0)},backend:function(){qr.log(arguments,"backend")},logs:function(t){[t].flat().forEach((function(t){return t&&qr.log([t].flat(),"backend")}))},history:function(){return Dr.map((function(t){return Nr.log.apply(Nr,Ur([t[0]],t[1],false))})),Dr},addPrefix:function(t){return Array.isArray(t)?Lr.unshift(t):this.warn("addPrefix receives array only!"),this}}),Br=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e={}),this.default_properties=e,this.properties_=Cr(Cr({},this.default_properties),t)}return t.prototype.merge=function(t){var e;return this.properties_=Cr(Cr({},this.properties_),t),this.properties_.store=Cr(Cr({},(null===(e=this.default_properties)||void 0===e?void 0:e.store)||{}),this.properties_.store),this},t.prototype.set=function(t,e){return t.includes(".")?(Salla.helpers.setNested(this.properties_,t,e),this):(this.properties_[t]=e,this)},t.prototype.currency=function(t){return void 0===t&&(t=void 0),t=t||this.get("user.currency_code"),this.get("currencies."+t)||Object.values(this.get("currencies"))[0]},t.prototype.get=function(t,e){return void 0===e&&(e=null),t.includes(".")?Salla.helpers.getNested(this.properties_,t,e):this.properties_.hasOwnProperty(t)?this.properties_[t]||e:e||void 0},t.prototype.all=function(){return this.properties_},t.prototype.isDebug=function(){return this.get("debug")||Salla.storage.get("debug")},t}(),Jr=function(t){function e(){var e=this;return(e=t.call(this,{wildcard:true,delimiter:"::",newListener:false,removeListener:false,maxListeners:10,verboseMemoryLeak:false,ignoreErrors:false})||this).delimiter="::","undefined"!=typeof document&&(e.body=document.querySelector("body")),e.logableEvents=["cart::item.added.failed","cart::item.deleted.failed"],e.ingoreLogEvents=["document::click","document::keyup","document::change"],e.noneFireableActions=["document.request"],e.emittedEvents=new Set,e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Fr(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.createAndDispatch=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];this.dispatch.apply(this,Ur([t],e,false))},e.prototype.emit=function(e){for(var n,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];this.emittedEvents.add(e);var o=e.replace("::",".");if(!this.noneFireableActions.includes(o)&&Salla.call&&"function"==typeof Salla.call(o))return Salla.log("'Salla.".concat(o,"(...)' triggered using event '").concat(e,"'")),o=o.split("."),Array.isArray(r[0])&&(r=r[0]),void(n=salla[o[0]])[o[1]].apply(n,r);t.prototype.emit.apply(this,Ur([e],r,false)),this.trackEvents.apply(this,Ur([e],r,false))},e.prototype.onlyWhen=function(t,e){var n=this;return e=e||function(){},new Promise((function(r){return n.emittedEvents.has(t)?r(e()):n.once(t,(function(){return r(e())}))}))},e.prototype.emitAsync=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.emittedEvents.add(e);var i=t.prototype.emitAsync.apply(this,Ur([e],n,false));try{this.trackEvents.apply(this,Ur([e],n,false))}catch(t){Salla.logger.warn("error on tracking event (".concat(e,")"),n,t)}return i},e.prototype.trackEvents=function(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if("undefined"!=typeof window)try{window.dataLayer=window.dataLayer||[];var i={event:t};n.map((function(t){return"object"==typeof t&&(i=Cr(Cr({},i),t))})),window.dataLayer.push(i)}catch(t){salla.logger.error(t.message)}Salla.logger&&!this.ingoreLogEvents.includes(t)&&(e=Salla.logger).event.apply(e,Ur([t],n,false)),this.dispatchMobileEvent.apply(this,Ur([t],n,false))},e.prototype.dispatch=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return this.emit.apply(this,Ur([t],e,false))},e.prototype.dispatchEvents=function(t){if(t)if("object"!=typeof t||Array.isArray(t))Salla.log("Events object is wrong, it should be object of {event:payload}",t);el