@salla.sa/twilight 2.8.1-alpha.4 → 2.8.1-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +674 -0
- package/dist/@salla.sa/twilight.min.js +1 -1
- package/dist/@salla.sa/twilight.min.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("process"),require("buffer")):"function"==typeof define&&define.amd?define(["exports","process","buffer"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Salla={},e.process$1,e.buffer)}(this,(function(e,t,r){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=n(t),s="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},o=Array.isArray,l="object"==typeof a&&a&&a.Object===Object&&a,c="object"==typeof self&&self&&self.Object===Object&&self,u=l||c||Function("return this")(),d=u.Symbol,h=d,f=Object.prototype,p=f.hasOwnProperty,g=f.toString,m=h?h.toStringTag:void 0;var v=function(e){var t=p.call(e,m),r=e[m];try{e[m]=void 0;var n=!0}catch(e){}var i=g.call(e);return n&&(t?e[m]=r:delete e[m]),i},y=Object.prototype.toString;var b=v,w=function(e){return y.call(e)},_=d?d.toStringTag:void 0;var S=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":_&&_ in Object(e)?b(e):w(e)};var E=S,x=function(e){return null!=e&&"object"==typeof e};var A=function(e){return"symbol"==typeof e||x(e)&&"[object Symbol]"==E(e)},P=o,F=A,L=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,O=/^\w*$/;var T=function(e,t){if(P(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!F(e))||(O.test(e)||!L.test(e)||null!=t&&e in Object(t))};var k=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},j=S,C=k;var R,I=function(e){if(!C(e))return!1;var t=j(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},q=u["__core-js_shared__"],N=(R=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||""))?"Symbol(src)_1."+R:"";var D=function(e){return!!N&&N in e},U=Function.prototype.toString;var $=I,M=D,H=k,z=function(e){if(null!=e){try{return U.call(e)}catch(e){}try{return e+""}catch(e){}}return""},B=/^\[object .+?Constructor\]$/,G=Function.prototype,W=Object.prototype,V=G.toString,J=W.hasOwnProperty,Q=RegExp("^"+V.call(J).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var K=function(e){return!(!H(e)||M(e))&&($(e)?Q:B).test(z(e))},Z=function(e,t){return null==e?void 0:e[t]};var X=function(e,t){var r=Z(e,t);return K(r)?r:void 0},Y=X(Object,"create"),ee=Y;var te=function(){this.__data__=ee?ee(null):{},this.size=0};var re=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ne=Y,ie=Object.prototype.hasOwnProperty;var se=function(e){var t=this.__data__;if(ne){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return ie.call(t,e)?t[e]:void 0},ae=Y,oe=Object.prototype.hasOwnProperty;var le=function(e){var t=this.__data__;return ae?void 0!==t[e]:oe.call(t,e)},ce=Y;var ue=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ce&&void 0===t?"__lodash_hash_undefined__":t,this},de=te,he=re,fe=se,pe=le,ge=ue;function me(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}me.prototype.clear=de,me.prototype.delete=he,me.prototype.get=fe,me.prototype.has=pe,me.prototype.set=ge;var ve=me;var ye=function(){this.__data__=[],this.size=0};var be=function(e,t){return e===t||e!=e&&t!=t};var we=function(e,t){for(var r=e.length;r--;)if(be(e[r][0],t))return r;return-1},_e=we,Se=Array.prototype.splice;var Ee=function(e){var t=this.__data__,r=_e(t,e);return!(r<0)&&(r==t.length-1?t.pop():Se.call(t,r,1),--this.size,!0)},xe=we;var Ae=function(e){var t=this.__data__,r=xe(t,e);return r<0?void 0:t[r][1]},Pe=we;var Fe=we;var Le=function(e,t){var r=this.__data__,n=Fe(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Oe=ye,Te=Ee,ke=Ae,je=function(e){return Pe(this.__data__,e)>-1},Ce=Le;function Re(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Re.prototype.clear=Oe,Re.prototype.delete=Te,Re.prototype.get=ke,Re.prototype.has=je,Re.prototype.set=Ce;var Ie=Re,qe=X(u,"Map"),Ne=ve,De=Ie,Ue=qe;var $e=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Me=function(e,t){var r=e.__data__;return $e(t)?r["string"==typeof t?"string":"hash"]:r.map},He=Me;var ze=Me;var Be=Me;var Ge=Me;var We=function(e,t){var r=Ge(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Ve=function(){this.size=0,this.__data__={hash:new Ne,map:new(Ue||De),string:new Ne}},Je=function(e){var t=He(this,e).delete(e);return this.size-=t?1:0,t},Qe=function(e){return ze(this,e).get(e)},Ke=function(e){return Be(this,e).has(e)},Ze=We;function Xe(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Xe.prototype.clear=Ve,Xe.prototype.delete=Je,Xe.prototype.get=Qe,Xe.prototype.has=Ke,Xe.prototype.set=Ze;var Ye=Xe;function et(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var a=e.apply(this,n);return r.cache=s.set(i,a)||s,a};return r.cache=new(et.Cache||Ye),r}et.Cache=Ye;var tt=et;var rt=function(e){var t=tt(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t},nt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,it=/\\(\\)?/g,st=rt((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(nt,(function(e,r,n,i){t.push(n?i.replace(it,"$1"):r||e)})),t}));var at=function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i},ot=o,lt=A,ct=d?d.prototype:void 0,ut=ct?ct.toString:void 0;var dt=function e(t){if("string"==typeof t)return t;if(ot(t))return at(t,e)+"";if(lt(t))return ut?ut.call(t):"";var r=t+"";return"0"==r&&1/t==-Infinity?"-0":r},ht=dt;var ft=o,pt=T,gt=st,mt=function(e){return null==e?"":ht(e)};var vt=A;var yt=function(e,t){return ft(e)?e:pt(e,t)?[e]:gt(mt(e))},bt=function(e){if("string"==typeof e||vt(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var wt=function(e,t){for(var r=0,n=(t=yt(t,e)).length;null!=e&&r<n;)e=e[bt(t[r++])];return r&&r==n?e:void 0};var _t=function(e,t,r){var n=null==e?void 0:wt(e,t);return void 0===n?r:n},St={exports:{}};!function(e,t){!function(t){var r=Object.hasOwnProperty,n=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},s="object"==typeof i.default&&"function"==typeof i.default.nextTick,a="function"==typeof Symbol,o="object"==typeof Reflect,l="function"==typeof setImmediate?setImmediate:setTimeout,c=a?o&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function u(){this._events={},this._conf&&d.call(this,this._conf)}function d(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),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),this.wildcard&&(this.listenerTree={}))}function h(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+"."),void 0!==i.default&&i.default.emitWarning){var n=new Error(r);n.name="MaxListenersExceededWarning",n.emitter=this,n.count=e,i.default.emitWarning(n)}else console.error(r),console.trace&&console.trace()}var f=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:for(var i=new Array(n);n--;)i[n]=arguments[n];return i}};function p(e,r){for(var n={},i=e.length,s=r?r.length:0,a=0;a<i;a++)n[e[a]]=a<s?r[a]:t;return n}function g(e,t,r){var n,i;if(this._emitter=e,this._target=t,this._listeners={},this._listenersCount=0,(r.on||r.off)&&(n=r.on,i=r.off),t.addEventListener?(n=t.addEventListener,i=t.removeEventListener):t.addListener?(n=t.addListener,i=t.removeListener):t.on&&(n=t.on,i=t.off),!n&&!i)throw Error("target does not implement any known event API");if("function"!=typeof n)throw TypeError("on method must be a function");if("function"!=typeof i)throw TypeError("off method must be a function");this._on=n,this._off=i;var s=e._observers;s?s.push(this):e._observers=[this]}function m(e,n,i,s){var a=Object.assign({},n);if(!e)return a;if("object"!=typeof e)throw TypeError("options must be an object");var o,l,c,u=Object.keys(e),d=u.length;function h(e){throw Error('Invalid "'+o+'" option value'+(e?". Reason: "+e:""))}for(var f=0;f<d;f++){if(o=u[f],!s&&!r.call(n,o))throw Error('Unknown "'+o+'" option');(l=e[o])!==t&&(c=i[o],a[o]=c?c(l,h):l)}return a}function v(e,t){return"function"==typeof e&&e.hasOwnProperty("prototype")||t("value must be a constructor"),e}function y(e){var t="value must be type of "+e.join("|"),r=e.length,n=e[0],i=e[1];return 1===r?function(e,r){if(typeof e===n)return e;r(t)}:2===r?function(e,r){var s=typeof e;if(s===n||s===i)return e;r(t)}:function(n,i){for(var s=typeof n,a=r;a-- >0;)if(s===e[a])return n;i(t)}}Object.assign(g.prototype,{subscribe:function(e,t,r){var n=this,i=this._target,s=this._emitter,a=this._listeners,o=function(){var n=f.apply(null,arguments),a={data:n,name:t,original:e};if(r){var o=r.call(i,a);!1!==o&&s.emit.apply(s,[a.name].concat(n))}else s.emit.apply(s,[t].concat(n))};if(a[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,s._newListener&&s._removeListener&&!n._onNewListener?(this._onNewListener=function(r){r===t&&null===a[e]&&(a[e]=o,n._on.call(i,e,o))},s.on("newListener",this._onNewListener),this._onRemoveListener=function(r){r===t&&!s.hasListeners(r)&&a[e]&&(a[e]=null,n._off.call(i,e,o))},a[e]=null,s.on("removeListener",this._onRemoveListener)):(a[e]=o,n._on.call(i,e,o))},unsubscribe:function(e){var t,r,n,i=this,s=this._listeners,a=this._emitter,o=this._off,l=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function u(){i._onNewListener&&(a.off("newListener",i._onNewListener),a.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=S.call(a,i);a._observers.splice(e,1)}if(e){if(!(t=s[e]))return;o.call(l,e,t),delete s[e],--this._listenersCount||u()}else{for(n=(r=c(s)).length;n-- >0;)e=r[n],o.call(l,e,s[e]);this._listeners={},this._listenersCount=0,u()}}});var b=y(["function"]),w=y(["object","function"]);function _(e,t,r){var n,i,s,a=0,o=new e((function(l,c,u){function d(){i&&(i=null),a&&(clearTimeout(a),a=0)}r=m(r,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),n=!r.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof u;var h=function(e){d(),l(e)},f=function(e){d(),c(e)};n?t(h,f,u):(i=[function(e){f(e||Error("canceled"))}],t(h,f,(function(e){if(s)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)})),s=!0),r.timeout>0&&(a=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",a=0,o.cancel(e),c(e)}),r.timeout))}));return n||(o.cancel=function(e){if(i){for(var t=i.length,r=1;r<t;r++)i[r](e);i[0](e),i=null}}),o}function S(e){var t=this._observers;if(!t)return-1;for(var r=t.length,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(0===n){var s=typeof t;if("string"===s){var a,o,l=0,u=0,d=this.delimiter,h=d.length;if(-1!==(o=t.indexOf(d))){a=new Array(5);do{a[l++]=t.slice(u,o),u=o+h}while(-1!==(o=t.indexOf(d,u)));a[l++]=t.slice(u),t=a,i=l}else t=[t],i=1}else"object"===s?i=t.length:(t=[t],i=1)}var f,p,g,m,v,y,b,w=null,_=t[n],S=t[n+1];if(n===i)r._listeners&&("function"==typeof r._listeners?(e&&e.push(r._listeners),w=[r]):(e&&e.push.apply(e,r._listeners),w=[r]));else{if("*"===_){for(o=(y=c(r)).length;o-- >0;)"_listeners"!==(f=y[o])&&(b=E(e,t,r[f],n+1,i))&&(w?w.push.apply(w,b):w=b);return w}if("**"===_){for((v=n+1===i||n+2===i&&"*"===S)&&r._listeners&&(w=E(e,t,r,i,i)),o=(y=c(r)).length;o-- >0;)"_listeners"!==(f=y[o])&&("*"===f||"**"===f?(r[f]._listeners&&!v&&(b=E(e,t,r[f],i,i))&&(w?w.push.apply(w,b):w=b),b=E(e,t,r[f],n,i)):b=E(e,t,r[f],f===S?n+2:n,i),b&&(w?w.push.apply(w,b):w=b));return w}r[_]&&(w=E(e,t,r[_],n+1,i))}if((p=r["*"])&&E(e,t,p,n+1,i),g=r["**"])if(n<i)for(g._listeners&&E(e,t,g,i,i),o=(y=c(g)).length;o-- >0;)"_listeners"!==(f=y[o])&&(f===S?E(e,t,g[f],n+2,i):f===_?E(e,t,g[f],n+1,i):((m={})[f]=g[f],E(e,t,{"**":m},n+1,i)));else g._listeners?E(e,t,g,i,i):g["*"]&&g["*"]._listeners&&E(e,t,g["*"],i,i);return w}function x(e,t,r){var n,i,s=0,a=0,o=this.delimiter,l=o.length;if("string"==typeof e)if(-1!==(n=e.indexOf(o))){i=new Array(5);do{i[s++]=e.slice(a,n),a=n+l}while(-1!==(n=e.indexOf(o,a)));i[s++]=e.slice(a)}else i=[e],s=1;else i=e,s=e.length;if(s>1)for(n=0;n+1<s;n++)if("**"===i[n]&&"**"===i[n+1])return;var c,u=this.listenerTree;for(n=0;n<s;n++)if(u=u[c=i[n]]||(u[c]={}),n===s-1)return u._listeners?("function"==typeof u._listeners&&(u._listeners=[u._listeners]),r?u._listeners.unshift(t):u._listeners.push(t),!u._listeners.warned&&this._maxListeners>0&&u._listeners.length>this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,c))):u._listeners=t,!0;return!0}function A(e,t,r,n){for(var i,s,a,o,l=c(e),u=l.length,d=e._listeners;u-- >0;)i=e[s=l[u]],a="_listeners"===s?r:r?r.concat(s):[s],o=n||"symbol"==typeof s,d&&t.push(o?a:a.join(this.delimiter)),"object"==typeof i&&A.call(this,i,t,a,o);return t}function P(e){for(var t,r,n,i=c(e),s=i.length;s-- >0;)(t=e[r=i[s]])&&(n=!0,"_listeners"===r||P(t)||delete e[r]);return n}function F(e,t,r){this.emitter=e,this.event=t,this.listener=r}function L(e,r,n){if(!0===n)o=!0;else if(!1===n)a=!0;else{if(!n||"object"!=typeof n)throw TypeError("options should be an object or true");var a=n.async,o=n.promisify,c=n.nextTick,u=n.objectify}if(a||c||o){var d=r,h=r._origin||r;if(c&&!s)throw Error("process.nextTick is not supported");o===t&&(o="AsyncFunction"===r.constructor.name),r=function(){var e=arguments,t=this,r=this.event;return o?c?Promise.resolve():new Promise((function(e){l(e)})).then((function(){return t.event=r,d.apply(t,e)})):(c?i.default.nextTick:l)((function(){t.event=r,d.apply(t,e)}))},r._async=!0,r._origin=h}return[r,u?new F(this,e,r):this]}function O(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,d.call(this,e)}F.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},O.EventEmitter2=O,O.prototype.listenTo=function(e,r,i){if("object"!=typeof e)throw TypeError("target musts be an object");var s=this;function a(t){if("object"!=typeof t)throw TypeError("events must be an object");var r,n=i.reducers,a=S.call(s,e);r=-1===a?new g(s,e,i):s._observers[a];for(var o,l=c(t),u=l.length,d="function"==typeof n,h=0;h<u;h++)o=l[h],r.subscribe(o,t[o]||o,d?n:n&&n[o])}return i=m(i,{on:t,off:t,reducers:t},{on:b,off:b,reducers:w}),n(r)?a(p(r)):a("string"==typeof r?p(r.split(/\s+/)):r),this},O.prototype.stopListeningTo=function(e,t){var r=this._observers;if(!r)return!1;var n,i=r.length,s=!1;if(e&&"object"!=typeof e)throw TypeError("target should be an object");for(;i-- >0;)n=r[i],e&&n._target!==e||(n.unsubscribe(t),s=!0);return s},O.prototype.delimiter=".",O.prototype.setMaxListeners=function(e){e!==t&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},O.prototype.getMaxListeners=function(){return this._maxListeners},O.prototype.event="",O.prototype.once=function(e,t,r){return this._once(e,t,!1,r)},O.prototype.prependOnceListener=function(e,t,r){return this._once(e,t,!0,r)},O.prototype._once=function(e,t,r,n){return this._many(e,1,t,r,n)},O.prototype.many=function(e,t,r,n){return this._many(e,t,r,!1,n)},O.prototype.prependMany=function(e,t,r,n){return this._many(e,t,r,!0,n)},O.prototype._many=function(e,t,r,n,i){var s=this;if("function"!=typeof r)throw new Error("many only accepts instances of Function");function a(){return 0==--t&&s.off(e,a),r.apply(this,arguments)}return a._origin=r,this._on(e,a,n,i)},O.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||u.call(this);var e,t,r,n,i,s,o=arguments[0],l=this.wildcard;if("newListener"===o&&!this._newListener&&!this._events.newListener)return!1;if(l&&(e=o,"newListener"!==o&&"removeListener"!==o&&"object"==typeof o)){if(r=o.length,a)for(n=0;n<r;n++)if("symbol"==typeof o[n]){s=!0;break}s||(o=o.join(this.delimiter))}var c,d=arguments.length;if(this._all&&this._all.length)for(n=0,r=(c=this._all.slice()).length;n<r;n++)switch(this.event=o,d){case 1:c[n].call(this,o);break;case 2:c[n].call(this,o,arguments[1]);break;case 3:c[n].call(this,o,arguments[1],arguments[2]);break;default:c[n].apply(this,arguments)}if(l)c=[],E.call(this,c,e,this.listenerTree,0,r);else{if("function"==typeof(c=this._events[o])){switch(this.event=o,d){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:for(t=new Array(d-1),i=1;i<d;i++)t[i-1]=arguments[i];c.apply(this,t)}return!0}c&&(c=c.slice())}if(c&&c.length){if(d>3)for(t=new Array(d-1),i=1;i<d;i++)t[i-1]=arguments[i];for(n=0,r=c.length;n<r;n++)switch(this.event=o,d){case 1:c[n].call(this);break;case 2:c[n].call(this,arguments[1]);break;case 3:c[n].call(this,arguments[1],arguments[2]);break;default:c[n].apply(this,t)}return!0}if(!this.ignoreErrors&&!this._all&&"error"===o)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},O.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||u.call(this);var e,t,r,n,i,s,o=arguments[0],l=this.wildcard;if("newListener"===o&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(l&&(e=o,"newListener"!==o&&"removeListener"!==o&&"object"==typeof o)){if(n=o.length,a)for(i=0;i<n;i++)if("symbol"==typeof o[i]){t=!0;break}t||(o=o.join(this.delimiter))}var c,d=[],h=arguments.length;if(this._all)for(i=0,n=this._all.length;i<n;i++)switch(this.event=o,h){case 1:d.push(this._all[i].call(this,o));break;case 2:d.push(this._all[i].call(this,o,arguments[1]));break;case 3:d.push(this._all[i].call(this,o,arguments[1],arguments[2]));break;default:d.push(this._all[i].apply(this,arguments))}if(l?(c=[],E.call(this,c,e,this.listenerTree,0)):c=this._events[o],"function"==typeof c)switch(this.event=o,h){case 1:d.push(c.call(this));break;case 2:d.push(c.call(this,arguments[1]));break;case 3:d.push(c.call(this,arguments[1],arguments[2]));break;default:for(r=new Array(h-1),s=1;s<h;s++)r[s-1]=arguments[s];d.push(c.apply(this,r))}else if(c&&c.length){if(c=c.slice(),h>3)for(r=new Array(h-1),s=1;s<h;s++)r[s-1]=arguments[s];for(i=0,n=c.length;i<n;i++)switch(this.event=o,h){case 1:d.push(c[i].call(this));break;case 2:d.push(c[i].call(this,arguments[1]));break;case 3:d.push(c[i].call(this,arguments[1],arguments[2]));break;default:d.push(c[i].apply(this,r))}}else if(!this.ignoreErrors&&!this._all&&"error"===o)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(d)},O.prototype.on=function(e,t,r){return this._on(e,t,!1,r)},O.prototype.prependListener=function(e,t,r){return this._on(e,t,!0,r)},O.prototype.onAny=function(e){return this._onAny(e,!1)},O.prototype.prependAny=function(e){return this._onAny(e,!0)},O.prototype.addListener=O.prototype.on,O.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},O.prototype._on=function(e,r,n,i){if("function"==typeof e)return this._onAny(e,r),this;if("function"!=typeof r)throw new Error("on only accepts instances of Function");this._events||u.call(this);var s,a=this;return i!==t&&(r=(s=L.call(this,e,r,i))[0],a=s[1]),this._newListener&&this.emit("newListener",e,r),this.wildcard?(x.call(this,e,r,n),a):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),n?this._events[e].unshift(r):this._events[e].push(r),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=r,a)},O.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r,i=[];if(this.wildcard){var s="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=E.call(this,null,s,this.listenerTree,0)))return this}else{if(!this._events[e])return this;r=this._events[e],i.push({_listeners:r})}for(var a=0;a<i.length;a++){var o=i[a];if(r=o._listeners,n(r)){for(var l=-1,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;return this.wildcard?o._listeners.splice(l,1):this._events[e].splice(l,1),0===r.length&&(this.wildcard?delete o._listeners:delete this._events[e]),this._removeListener&&this.emit("removeListener",e,t),this}(r===t||r.listener&&r.listener===t||r._origin&&r._origin===t)&&(this.wildcard?delete o._listeners:delete this._events[e],this._removeListener&&this.emit("removeListener",e,t))}return this.listenerTree&&P(this.listenerTree),this},O.prototype.offAny=function(e){var t,r=0,n=0;if(e&&this._all&&this._all.length>0){for(r=0,n=(t=this._all).length;r<n;r++)if(e===t[r])return t.splice(r,1),this._removeListener&&this.emit("removeListenerAny",e),this}else{if(t=this._all,this._removeListener)for(r=0,n=t.length;r<n;r++)this.emit("removeListenerAny",t[r]);this._all=[]}return this},O.prototype.removeListener=O.prototype.off,O.prototype.removeAllListeners=function(e){if(e===t)return!this._events||u.call(this),this;if(this.wildcard){var r,n=E.call(this,null,e,this.listenerTree,0);if(!n)return this;for(r=0;r<n.length;r++)n[r]._listeners=null;this.listenerTree&&P(this.listenerTree)}else this._events&&(this._events[e]=null);return this},O.prototype.listeners=function(e){var r,n,i,s,a,o=this._events;if(e===t){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!o)return[];for(s=(r=c(o)).length,i=[];s-- >0;)"function"==typeof(n=o[r[s]])?i.push(n):i.push.apply(i,n);return i}if(this.wildcard){if(!(a=this.listenerTree))return[];var l=[],u="string"==typeof e?e.split(this.delimiter):e.slice();return E.call(this,l,u,a,0),l}return o&&(n=o[e])?"function"==typeof n?[n]:n:[]},O.prototype.eventNames=function(e){var t=this._events;return this.wildcard?A.call(this,this.listenerTree,[],null,e):t?c(t):[]},O.prototype.listenerCount=function(e){return this.listeners(e).length},O.prototype.hasListeners=function(e){if(this.wildcard){var r=[],n="string"==typeof e?e.split(this.delimiter):e.slice();return E.call(this,r,n,this.listenerTree,0),r.length>0}var i=this._events,s=this._all;return!!(s&&s.length||i&&(e===t?c(i).length:i[e]))},O.prototype.listenersAny=function(){return this._all?this._all:[]},O.prototype.waitFor=function(e,r){var n=this,i=typeof r;return"number"===i?r={timeout:r}:"function"===i&&(r={filter:r}),_((r=m(r,{timeout:0,filter:t,handleError:!1,Promise:Promise,overload:!1},{filter:b,Promise:v})).Promise,(function(t,i,s){function a(){var s=r.filter;if(!s||s.apply(n,arguments))if(n.off(e,a),r.handleError){var o=arguments[0];o?i(o):t(f.apply(null,arguments).slice(1))}else t(f.apply(null,arguments))}s((function(){n.off(e,a)})),n._on(e,a,!1)}),{timeout:r.timeout,overload:r.overload})};var T=O.prototype;Object.defineProperties(O,{defaultMaxListeners:{get:function(){return T._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");T._maxListeners=e},enumerable:!0},once:{value:function(e,t,r){return _((r=m(r,{Promise:Promise,timeout:0,overload:!1},{Promise:v})).Promise,(function(r,n,i){var s;if("function"==typeof e.addEventListener)return s=function(){r(f.apply(null,arguments))},i((function(){e.removeEventListener(t,s)})),void e.addEventListener(t,s,{once:!0});var a,o=function(){a&&e.removeListener("error",a),r(f.apply(null,arguments))};"error"!==t&&(a=function(r){e.removeListener(t,o),n(r)},e.once("error",a)),i((function(){a&&e.removeListener("error",a),e.removeListener(t,o)})),e.once(t,o)}),{timeout:r.timeout,overload:r.overload})},writable:!0,configurable:!0}}),Object.defineProperties(T,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),e.exports=O}()}(St);var Et=St.exports,xt=Object.assign?Object.assign:function(e,t,r,n){for(var i=1;i<arguments.length;i++)Tt(Object(arguments[i]),(function(t,r){e[r]=t}));return e},At=function(){if(Object.create)return function(e,t,r,n){var i=Ot(arguments,1);return xt.apply(this,[Object.create(e)].concat(i))};{function e(){}return function(t,r,n,i){var s=Ot(arguments,1);return e.prototype=t,xt.apply(this,[new e].concat(s))}}}(),Pt=String.prototype.trim?function(e){return String.prototype.trim.call(e)}:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},Ft="undefined"!=typeof window?window:a,Lt={assign:xt,create:At,trim:Pt,bind:function(e,t){return function(){return t.apply(e,Array.prototype.slice.call(arguments,0))}},slice:Ot,each:Tt,map:function(e,t){var r=jt(e)?[]:{};return kt(e,(function(e,n){return r[n]=t(e,n),!1})),r},pluck:kt,isList:jt,isFunction:function(e){return e&&"[object Function]"==={}.toString.call(e)},isObject:function(e){return e&&"[object Object]"==={}.toString.call(e)},Global:Ft};function Ot(e,t){return Array.prototype.slice.call(e,t||0)}function Tt(e,t){kt(e,(function(e,r){return t(e,r),!1}))}function kt(e,t){if(jt(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)&&t(e[n],n))return e[n]}function jt(e){return null!=e&&"function"!=typeof e&&"number"==typeof e.length}var Ct=Lt.slice,Rt=Lt.pluck,It=Lt.each,qt=Lt.bind,Nt=Lt.create,Dt=Lt.isList,Ut=Lt.isFunction,$t=Lt.isObject,Mt={createStore:zt},Ht={version:"2.0.12",enabled:!1,get:function(e,t){var r=this.storage.read(this._namespacePrefix+e);return this._deserialize(r,t)},set:function(e,t){return void 0===t?this.remove(e):(this.storage.write(this._namespacePrefix+e,this._serialize(t)),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 zt.apply(this,arguments)},addPlugin:function(e){this._addPlugin(e)},namespace:function(e){return zt(this.storage,this.plugins,e)}};function zt(e,t,r){r||(r=""),e&&!Dt(e)&&(e=[e]),t&&!Dt(t)&&(t=[t]);var n=r?"__storejs_"+r+"_":"",i=r?new RegExp("^"+n):null;if(!/^[a-zA-Z0-9_\-]*$/.test(r))throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes");var s={_namespacePrefix:n,_namespaceRegexp:i,_testStorage:function(e){try{var t="__storejs__test__";e.write(t,t);var r=e.read(t)===t;return e.remove(t),r}catch(e){return!1}},_assignPluginFnProp:function(e,t){var r=this[t];this[t]=function(){var t=Ct(arguments,0),n=this;function i(){if(r)return It(arguments,(function(e,r){t[r]=e})),r.apply(n,t)}var s=[i].concat(t);return e.apply(n,s)}},_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 void 0!==r?r:t},_addStorage:function(e){this.enabled||this._testStorage(e)&&(this.storage=e,this.enabled=!0)},_addPlugin:function(e){var t=this;if(Dt(e))It(e,(function(e){t._addPlugin(e)}));else if(!Rt(this.plugins,(function(t){return e===t}))){if(this.plugins.push(e),!Ut(e))throw new Error("Plugins must be function values that return objects");var r=e.call(this);if(!$t(r))throw new Error("Plugins must return an object of function properties");It(r,(function(r,n){if(!Ut(r))throw new Error("Bad plugin property: "+n+" from plugin "+e.name+". Plugins should only return functions.");t._assignPluginFnProp(r,n)}))}},addStorage:function(e){!function(){var e="undefined"==typeof console?null:console;if(e){(e.warn?e.warn:e.log).apply(e,arguments)}}("store.addStorage(storage) is deprecated. Use createStore([storages])"),this._addStorage(e)}},a=Nt(s,Ht,{plugins:[]});return a.raw={},It(a,(function(e,t){Ut(e)&&(a.raw[t]=qt(a,e))})),It(e,(function(e){a._addStorage(e)})),It(t,(function(e){a._addPlugin(e)})),a}var Bt=Lt.Global,Gt={name:"localStorage",read:Vt,write:function(e,t){return Wt().setItem(e,t)},each:function(e){for(var t=Wt().length-1;t>=0;t--){var r=Wt().key(t);e(Vt(r),r)}},remove:function(e){return Wt().removeItem(e)},clearAll:function(){return Wt().clear()}};function Wt(){return Bt.localStorage}function Vt(e){return Wt().getItem(e)}var Jt=Lt.Global,Qt={name:"sessionStorage",read:Zt,write:function(e,t){return Kt().setItem(e,t)},each:function(e){for(var t=Kt().length-1;t>=0;t--){var r=Kt().key(t);e(Zt(r),r)}},remove:function(e){return Kt().removeItem(e)},clearAll:function(){return Kt().clear()}};function Kt(){return Jt.sessionStorage}function Zt(e){return Kt().getItem(e)}var Xt=Lt.trim,Yt={name:"cookieStorage",read:function(e){if(!e||!nr(e))return null;var t="(?:^|.*;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(er.cookie.replace(new RegExp(t),"$1"))},write:function(e,t){if(!e)return;er.cookie=escape(e)+"="+escape(t)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/"},each:tr,remove:rr,clearAll:function(){tr((function(e,t){rr(t)}))}},er=Lt.Global.document;function tr(e){for(var t=er.cookie.split(/; ?/g),r=t.length-1;r>=0;r--)if(Xt(t[r])){var n=t[r].split("="),i=unescape(n[0]);e(unescape(n[1]),i)}}function rr(e){e&&nr(e)&&(er.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function nr(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(er.cookie)}var ir={name:"memoryStorage",read:function(e){return sr[e]},write:function(e,t){sr[e]=t},each:function(e){for(var t in sr)sr.hasOwnProperty(t)&&e(sr[t],t)},remove:function(e){delete sr[e]},clearAll:function(e){sr={}}},sr={};function ar(e,t=!1){e+="";let r,n=["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"],i=["0","1","2","3","4","5","6","7","8","9"],s=(t=t||!Salla.config.get("store.settings.arabic_numbers_enabled"))?n:i,a=t?i:n;for(let t=0;t<s.length;t++)r=new RegExp(s[t],"g"),e=e.replace(r,a[t]);return e}function or(e){let t=(e.match(/\./g)||[]).length;return t&&1!==t?or(e.replace(/\.(.+)\./g,".$1")):e}function lr(e,t,r){let n=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[n]=lr(e.slice(1),t,r[n]),r):n?{[n]:lr(e.slice(1),t)}:""===n?[t]:t}function cr(e){return Salla.config.get("store.url",window.location.href.split("/").slice(0,-1).join("/")).rtrim("/")+"/"+e.ltrim("/")}var ur={digitsOnly:function(e){return ar(e,!0).replace(/[^0-9.]/g,"").replace("..",".").rtrim(".")},inputDigitsOnly:function e(t,r=!1){if("string"==typeof t)return document.querySelectorAll(t).forEach((t=>e(t,r)));if(!t)return void Salla.logger.warn("Can't find Object With Id: "+t);let n=Salla.helpers.digitsOnly(t.value);return t.min&&n<t.min?t.value=t.min:t.max&&n>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")?or(n):n.replace(/\D/g,"")},number:ar,money:function(e){return ar(e?.amount|e)+" "+Salla.config.currency(e?.currency).symbol},setNested:function(e,t,r){let n=e,i=t.split("."),s=i.length;for(let e=0;e<s-1;e++){let t=i[e];n[t]||(n[t]={}),n=n[t]}return n[i[s-1]]=r,e},getNested:function(e,t,r){let n=_t(e,t);return void 0!==n?n:r},inputData:function(e,t,r={}){if(e.includes("[")){let n=e.split("]").join("").split("[");return{name:n[0],value:lr(n.slice(1),t,r[n[0]])}}return{name:e,value:t}},url:{get:cr,asset:function(e){return function(e){return window.location.origin+"/"+e.ltrim("/")}("themes/"+Salla.config.get("theme.name")+"/"+e.ltrim("/"))},cdn:function(e){return"https://cdn.salla.network/"+e.ltrim("/")},is_page:function(e){return e&&Salla.config.get("page.slug")===e},api:function(e){return Salla.config.get("store.api",cr("")).rtrim("/")+"/"+e.ltrim("/")}},addParamToUrl:function(e,t){if(!t||!e)return window.location.href;let r=new RegExp("([?&])"+e+"=[^&]+[&]?","g"),n=window.location.href.replace(r,"$1").replace(/&$|\?$/,"");return n+=(n.includes("?")?"&":"?")+e+"="+encodeURIComponent(t),n.replace(/&$|\?$/,"")},debounce:function(e,t){t=t||100;let r,n=[];return function(...i){return clearTimeout(r),r=setTimeout((()=>{let t=e(...i);n.forEach((e=>e(t))),n=[]}),t),new Promise((e=>n.push(e)))}}},dr=function(e){let t={log:function(t,r){if(!e)return;"trace"===salla.config.get("debug")&&(r="trace");let n=e.log,i=void 0===r?n:this.__dict__[r]||n,s=["%cTwilight","color: #5cd5c4;font-weight:bold; border:1px solid #5cd5c4; padding: 2px 6px; border-radius: 5px;"],a={event:"#CFF680",backend:"#7b68ee"}[r];a&&(s[0]+="%c"+r[0].toUpperCase()+r.substring(1),s.push(`margin-left: 5px;color: ${a};font-weight:bold; border:1px solid ${a}; padding: 2px 6px; border-radius: 5px;`)),i.call(e,...s.concat(...t))},__dict__:{trace:e.trace,debug:e.debug,info:e.info,warn:e.warn,error:e.error}};return{event:function(){t.log(arguments,"event")},trace:function(){t.log(arguments,"trace")},debug:function(){t.log(arguments,"debug")},info:function(){t.log(arguments,"info")},warn:function(){t.log(arguments,"warn")},error:function(){t.log(arguments,"error")},log:function(){t.log(arguments,void 0)},backend:function(){t.log(arguments,"backend")},logs:function(e){[e].flat().forEach((e=>e&&t.log([e].flat(),"backend")))}}}(console);const hr=Mt.createStore([Gt,Qt,Yt,ir],[]);void 0===s?(window.salla=window.salla||window.Salla||{},window.Salla=window.salla):(s.salla=s.salla||s.Salla||{},s.Salla=s.salla),Salla.config=new class{default_properties={};constructor(e={},t={}){this.default_properties=t,this.properties_={...this.default_properties,...e}}merge(e){return Object.assign(this.properties_,e),this.properties_.store={...this.default_properties.store,...this.properties_.store},this}set(e,t){return e.includes(".")?(Salla.helpers.setNested(this.properties_,e,t),this):(this.properties_[e]=t,this)}get(e,t=null){return e.includes(".")?Salla.helpers.getNested(this.properties_,e,t):this.properties_.hasOwnProperty(e)?this.properties_[e]||t:t||void 0}all(){return this.properties_}},Salla.logger=dr,Salla.event=new class extends Et{constructor(){super({wildcard:!0,delimiter:"::",newListener:!1,removeListener:!1,maxListeners:10,verboseMemoryLeak:!1,ignoreErrors:!1}),this.delimiter="::","undefined"!=typeof document&&(this.body=document.querySelector("body")),this.logableEvents=["cart::item.added.failed","cart::item.deleted.failed"],this.ingoreLogEvents=["document::click","document::keyup","document::change"],this.noneFireableActions=["document.request"]}createAndDispatch(e,...t){this.dispatch(e,...t)}emit(e,...t){let r=e.replace("::",".");if(!this.noneFireableActions.includes(r)&&void 0!==Salla.call&&"function"==typeof Salla.call(r))return Salla.log(`'Salla.${r}(...)' triggered using event '${e}'`),r=r.split("."),void salla[r[0]][r[1]](...t);super.emit(e,...t),"undefined"!=typeof window&&(window.dataLayer=window.dataLayer||[],window.dataLayer.push(Object.assign({event:e},...t.values()))),!this.ingoreLogEvents.includes(e)&&(void 0!==Salla.config&&Salla.config.get("debug")||this.logableEvents.includes(e))&&void 0!==Salla.logger&&Salla.logger.event(e,...t),this.dispatchMobileEvent(e,{...t.values()})}dispatch(e,...t){return this.emit(e,...t)}dispatchEvents(e){if(e&&"object"==typeof e)for(const[t,r]of Object.entries(e))this.dispatch(t,r);else Salla.log("No Events To Dispatch!",e)}addListener(e,t){return this.on(e,t)}addEventListener(e,t){return this.on(e,t)}listen(e,t){return this.on(e,t)}registerGlobalListener(e,t){return this.onAny(t)}dispatchMobileEvent(e,t={}){if(!("undefined"!=typeof window&&window.dataLayer&&dataLayer[0]&&dataLayer[0].page&&dataLayer[0].page.mobileApp))return"";if(window.webkit)try{window.webkit.messageHandlers.callbackHandler.postMessage(JSON.stringify({event:e,details:t}))}catch(e){Salla.log(e,"The native context does not exist yet")}else if(Android)try{Android.customEventWithData(e,JSON.stringify({details:t}))}catch(e){Salla.log(e,"The native context does not exist yet")}}},Salla.storage=new class{constructor(){Salla.event.on("storage::item.remove",(e=>this.remove(e))),Salla.event.on("storage::item.set",((e,t)=>this.set(e,t))),this.store=hr}set(e,t){if(e.includes(".")){let r=e.split(".")[0],n={[r]:this.store.get(r)};return n=Salla.helpers.setNested(n,e,t),this.store.set(r,n[r])}return this.store.set(e,t)}remove(e){return this.store.remove(e)}get(e,t){if(e.includes(".")){let t=e.split(".")[0];return Salla.helpers.getNested({[t]:this.store.get(t)},e)}return this.store.get(e,t)}},Salla.cookie=new class{constructor(){Salla.event.on("cookies::remove",(e=>this.remove(e))),Salla.event.on("cookies::add",((e,t)=>this.set(e,t)))}get(e){return document.cookie.split("; ").find((t=>t.startsWith(e+"=")))?.split("=")[1]}set(e,t="",r=10){let n="";if(r){let e=new Date;e.setTime(e.getTime()+24*r*60*60*1e3),n="; expires="+e.toUTCString()}return document.cookie=`${e}=${t}${n}"; path=/; secure; SameSite=Lax"`,this}remove(e){return document.cookie=`${e}=; Max-Age=0; path=/;`,this}},Salla.helpers=ur,Salla.log=Salla.logger.log,Salla.money=Salla.helpers.money,Salla.url=Salla.helpers.url;var fr=Salla;let pr=function(e,t,r){return alert(e)},gr=function(e,t){return pr(e,mr.error,t)},mr={error:"error",success:"success",info:"info"};var vr={fire:function(e,t,r){return pr(e,t,r)},setNotifier:function(e){pr=e},error:gr,success:function(e,t){return pr(e,mr.success,t)},info:function(e,t){return pr(e,mr.info,t)},sallaInitiated:function(){let e=window.location.href.match(/([\?\&]danger=)[^&]+/g);e&&e.forEach((e=>{gr(decodeURI(e.replace("?danger=","").replace("&danger=","")))}))},types:mr};class yr{constructor(e,t){return this.api=e,this.event=t,new Proxy(this,{get:function(r,n){return"event"===n?t:"api"===n?e:e&&e[n]||r[n]}})}}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:"#"+this},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)},Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){for(var t=this;t;){if(t.matches(e))return t;t=t.parentElement}}),Element.prototype.getElementSallaData=function(e,...t){if(!this.getAttribute)return;if(this.hasAttribute("data-json"))try{return JSON.parse(this.getAttribute("data-json"))}catch(e){}let r=this.getAttribute("data-function");if(r&&window[r])return"function"==typeof window[r]?this.getFilteredData(window[r].call(this,...t)):this.getFilteredData(window[r]);let n=this.hasAttribute("data-form-selector")?document.querySelector(this.dataset.formSelector):void 0;if(n="FORM"===this.tagName?this:n||this.closest("form")||this.closest("[salla-form-data]")||this,n&&"FORM"===n.tagName)return this.getFilteredData(new FormData(n),null,n);let i=n.querySelectorAll("[name]");if(!i.length)return this.getFilteredData();let s=Object.assign({},this.dataset);return i.forEach((e=>{if(!["checkbox","radio"].includes(e.type)||e.checked)try{let t=Salla.helpers.inputData(e.name,e.value,s);s[t.name]=t.value}catch(t){Salla.log(e.name+" can't be send")}})),this.getFilteredData(s)},Element.prototype.canEventFireHook=function(e){return!!this.hasAttribute&&this.hasAttribute(Salla.api.hooksPrefix+e.type)},Element.prototype.hasAttributeStartsWith=function(e,t){e=e.toLowerCase();for(var r=0;r<this.attributes.length;r++){let n=this.attributes[r].name.toLowerCase();if(0===n.indexOf(e))return!t||n}return!1},HTMLFormElement.prototype.getAjaxFormData=function(e){var t=this.querySelectorAll('input[type="file"]');t.forEach((e=>{e.files.length||e.setAttribute("disabled","")}));var r=new FormData(this);return t.forEach((e=>{e.files.length||e.removeAttribute("disabled")})),{formData:this.getFilteredData(r,e),url:this.getAttribute("action"),method:this.getAttribute("method")||"post",events:{success:this.dataset.onSuccess,fail:this.dataset.onFail}}},Element.prototype.getFilteredData=function(e=null,t=null,r=null){return e=e||r?.dataset||this.dataset,r&&this.name&&void 0!==this.value&&(e=function(e,t,r){e instanceof FormData?e.append(t,r):e[t]=r;return e}(e,this.name,this.value)),["filterBeforeSubmit","filterBeforeSend"].forEach((n=>{let i=r?.dataset[n]||this.dataset[n];if(i){var s=window[i];if("function"==typeof s){if(!s(e,r||this,t)&&e)throw`Data failed to be pass verify function window.${i}(formData, element, event)!`;return s(e,r||this,t)}Salla.log("window."+i+"() not found!")}})),e},HTMLAnchorElement.prototype.getAjaxFormData=function(e){return{formData:this.getFilteredData(null,e),url:this.getAttribute("href"),method:this.dataset.type||"get",events:{success:this.dataset.onSuccess,fail:this.dataset.onFail}}};class br{constructor(){this.events={},this.namespace="";let e=/function (.{1,})\(/.exec(this.constructor.toString());this.className=(e&&e.length>1?e[1]:"").toLowerCase()}after_init(){this.createDynamicFunctions()}createDynamicFunctions(){Object.keys(this.events).forEach((e=>{this.createDynamicEventFuns(e),this.createDynamicListenerFuns(e)}))}createDynamicEventFuns(e){if(this[e])return;let t=this;this[e]=function(...r){return t.dispatch(e,...r)}}createDynamicListenerFuns(e){let t="on"+e.charAt(0).toUpperCase()+e.slice(1);if(this[t])return;let r=this;this[t]=function(t){return r.on(e,t)}}getEventName(e){return e=this.events[e]||e,!this.namespace||e.includes("::")?e:this.namespace+Salla.event.delimiter+e}dispatch(e,...t){return Salla.event.dispatch(this.getEventName(e),...t)}on(e,t){return Salla.event.addListener(this.getEventName(e),t)}once(e,t){return Salla.event.once(this.getEventName(e),t)}}function wr(e){e&&e.sallaInitiated&&!e.initiated&&(e.sallaInitiated(),e.initiated=!0)}Salla.event.auth=new class extends br{constructor(){super(),this.namespace="auth",this.events={login:"login",logout:"logout",codeSent:"code.sent",codeNotSent:"code.not-sent",verified:"verified",verificationFailed:"verification.failed",loggedIn:"logged.in",registered:"registered",registrationFailed:"registration.failed",loggedOut:"logged.out",failedLogout:"failed.logout",refreshFailed:"refresh.failed"},this.after_init()}login(e){return e?(e.type&&this.setTypeActionOnVerified(e.type),this.next_event=e.next_event||null,this.dispatch("login",...arguments)):(this.next_event=null,this.dispatch("login",...arguments))}loggedIn(e){Salla.profile.info().then((e=>{salla.config.set("user",{id:e.data.id,type:"user",email:e.data.email,mobile:e.data.phone.code+e.data.phone.number,country_code:e.data.phone.country,language_code:e.data.language,currency_code:e.data.currency})})).finally((()=>this.dispatch("loggedIn",e)))}setTypeActionOnVerified(e){this.type_action_on_verified=e}getTypeActionOnVerified(){return this.type_action_on_verified||"redirect"}},Salla.event.cart=new class extends br{constructor(){super(),this.namespace="cart",this.events={latestFetched:"latest.fetched",latestFailed:"latest.failed",updated:"updated",itemUpdated:"item.updated",itemUpdatedFailed:"item.updated.failed",itemAdded:"item.added",itemAddedFailed:"item.added.failed",itemDeleted:"item.deleted",itemDeletedFailed:"item.deleted.failed",submitted:"submitted",submitFailed:"submit.failed",imageDeleted:"image.deleted",imageNotDeleted:"image.not.deleted",detailsFetched:"details.fetched",detailsNotFetched:"details.not.fetched",successReset:"success.reset",couponAdded:"coupon.added",couponDeleted:"coupon.deleted",couponAdditionFailed:"coupon.addition.failed",couponDeletionFailed:"coupon.deletion.failed"},this.after_init()}updated(e){return Salla.cookie.set("fresh_summary",1),e&&"object"==typeof e?(e.offer&&salla.product.event.offerExisted(e.offer),salla.storage.set("cart.summary",{total:e.cart.total,sub_total:e.cart.sub_total,discount:e.cart.discount,real_shipping_cost:e.cart.real_shipping_cost,count:e.cart.count,shipping_cost:e.cart.free_shipping_bar?.has_free_shipping?0:e.cart.real_shipping_cost}),this.dispatch("updated",e.cart)):(Salla.logger.info("Cart summary not an object!",e),this.dispatch("updated"))}latestFetched(e){return this.updated(e.data),this.dispatch("latestFetched",e)}itemAdded(e,t){return this.updated(e.data),this.dispatch("itemAdded",e,t)}itemDeleted(e,t){return this.updated(e.data),this.dispatch("itemDeleted",e,t)}itemUpdated(e,t){return this.updated(e.data),this.dispatch("itemUpdated",e,t)}couponAdded(e,t){return this.updated(e.data),this.dispatch("couponAdded",e,t)}couponDeleted(e,t){return this.updated(e.data),this.dispatch("couponDeleted",e,t)}},Salla.event.order=new class extends br{constructor(){super(),this.namespace="order",this.events={canceled:"canceled",notCanceled:"not.canceled",orderCreated:"order.created",orderCreationFailed:"order.creation.failed",invoiceSent:"invoice.sent",invoiceNotSent:"invoice.not.sent"},this.after_init()}},Salla.event.scope=new class extends br{constructor(){super(),this.namespace="scope",this.events={fetched:"fetched",notFetched:"not.fetched",productAvailabilityFetched:"product-availability.fetched",productAvailabilityNotFetched:"product-availability.not.fetched",changeSucceeded:"changed",changeFailed:"not.changed"},this.after_init()}},Salla.event.rating=new class extends br{constructor(){super(),this.namespace="rating",this.events={orderNotFetched:"order.not.fetched",orderFetched:"order.fetched",storeRated:"store.rated",storeFailed:"store.failed",productsRated:"products.rated",productsFailed:"products.failed",shippingRated:"shipping.rated",shippingFailed:"shipping.failed"},this.after_init()}},Salla.event.comment=new class extends br{constructor(){super(),this.namespace="comment",this.events={added:"added",additionFailed:"addition.failed"},this.after_init()}},Salla.event.loyalty=new class extends br{constructor(){super(),this.namespace="loyalty",this.events={exchangeSucceeded:"exchange.succeeded",exchangeFailed:"exchange.failed",programFetched:"program.fetched",programNotFetched:"program.not.fetched",resetSucceeded:"exchange-reset.succeeded",resetFailed:"exchange-reset.failed"},this.after_init()}},Salla.event.product=new class extends br{constructor(){super(),this.namespace="product",this.events={priceUpdated:"price.updated",priceUpdateFailed:"price.updated.failed",availabilitySubscribed:"availability.subscribed",availabilitySubscribeFailed:"availability.subscribe.failed",categoriesFetched:"categories.fetched",categoriesFailed:"categories.failed",searchFailed:"search.failed",searchResults:"search.results",offerExisted:"offer.existed",fetchOffersFailed:"fetch.offers.failed",offersFetched:"offers.fetched",sizeGuideFetched:"size-guide.fetched",SizeGuideFetchFailed:"size-guide.failed",giftFetched:"gift.fetched",giftFetchFailed:"gift.failed",addGiftToCartSucceeded:"gift.add-to-cart.succeeded",addGiftToCartFailed:"gift.add-to-cart.failed",giftImageUploadSucceeded:"gift.image-upload.succeeded",giftImageUploadFailed:"gift.image-upload.failed"},this.after_init()}},Salla.event.profile=new class extends br{constructor(){super(),this.namespace="profile",this.events={updated:"updated",updateFailed:"update.failed",verificationCodeSent:"verification.code.sent",updateContactsFailed:"update.contacts.failed",verified:"verified",unverified:"unverified",infoFetched:"info.fetched",infoNotFetched:"info.not.fetched"},this.after_init()}},Salla.event.currency=new class extends br{constructor(){super(),this.namespace="currency",this.events={changed:"changed",failed:"failed",fetched:"fetched",failedToFetch:"failed.to.fetch"},this.after_init()}},Salla.event.document=new class extends br{constructor(){super(),this.namespace="document",this.events={click:"click",change:"change",submit:"submit",keyup:"keyup",leaving:"leaving",request:"request",requestFailed:"request.failed"},this.after_init()}onClick(e,t){this.fireCallableFuns("click",e,t)}onChange(e,t){this.fireCallableFuns("change",e,t)}onSubmit(e,t){this.fireCallableFuns("submit",e,t)}onKeyup(e,t){this.fireCallableFuns("keyup",e,t)}fireCallableFuns(e,t,r){this.on(e,(e=>{"function"!=typeof t?"function"==typeof r&&e.target.matches(t)&&r(e):t(e)}))}fireEvent(e,t,...r){return this.fireEventForElements(e,t,!1,...r)}fireEventForAll(e,t,...r){return this.fireEventForElements(e,t,!0,...r)}fireEventForElements(e,t,r,...n){if("string"==typeof e){if(r)return document.querySelectorAll(e).forEach((e=>this.fireEventForElements(e,t,!1,...n)));e=document.querySelector(e)}if(!e)return void salla.log("Failed To get element to fire event: "+t);const i=new CustomEvent(t,...n);return e.dispatchEvent(i)}},Salla.event.wishlist=new class extends br{constructor(){super(),this.namespace="wishlist",this.events={added:"added",removed:"removed",additionFailed:"addition.failed",removingFailed:"removing.failed"},this.after_init()}},Salla.event.infiniteScroll=new class extends br{constructor(){super(),this.namespace="infiniteScroll",this.events={scrollThreshold:"scroll.threshold",request:"request",load:"load",append:"append",error:"error",last:"last",history:"history"},this.after_init()}},Salla.event.on("twilight::initiated",(()=>{Object.keys(Salla).forEach((e=>{"object"==typeof(e=Salla[e])&&(wr(e),Object.keys(e).forEach((t=>{wr(e[t])})))}))})),Salla.config.default_properties={debug:"undefined"!=typeof process&&"development"===process.env.NODE_ENV,token:null,fastRequests:!0,canLeave:!0,store:{api:"https://api.salla.dev/store/v1/"},currencies:{SAR:{code:"SAR",name:"ريال سعودي",symbol:"ر.س",amount:1,country_code:"sa"}}},Salla.config.merge(Salla.config.default_properties),Salla.config.triedToGetCurrencies_=!1,Salla.config.triedToGetLanguages_=!1,Salla.config.isUser=()=>"user"===Salla.config.get("user.type"),Salla.config.isGuest=()=>!Salla.config.isUser(),Salla.config.languages=async()=>{if(Salla.config.triedToGetLanguages_)return Salla.config.get("languages");Salla.config.triedToGetLanguages_=!0;let e=!0,t=[];return(await salla.document.api.request("languages",null,"get"))?.data?.map((r=>{e&&(t=[],e=!1),r.code=r.code||r.iso_code,r.url=salla.url.get(r.code),r.is_rtl=r.is_rtl||r.rtl,t.push(r)})),Salla.config.set("languages",t)},Salla.config.currencies=async()=>{if(Salla.config.triedToGetCurrencies_)return Salla.config.get("currencies");Salla.config.triedToGetCurrencies_=!0;let e=!0,t={};return(await salla.currency.api.list())?.data?.map((r=>{e&&(t={},e=!1),r.country_code=r.code.substr(0,2).toLowerCase(),t[r.code]=r})),Salla.config.set("currencies",t)},Salla.config.currency=e=>(e=e||Salla.config.get("user.currency_code"),Salla.config.get("currencies."+e)||Object.values(Salla.config.get("currencies"))[0]);var _r,Sr={exports:{}},Er={exports:{}},xr={exports:{}};function Ar(){return _r||(_r=1,function(e){!function(t,r){e.exports?e.exports=r():t.EvEmitter=r()}("undefined"!=typeof window?window:a,(function(){function e(){}let t=e.prototype;return t.on=function(e,t){if(!e||!t)return this;let r=this._events=this._events||{},n=r[e]=r[e]||[];return n.includes(t)||n.push(t),this},t.once=function(e,t){if(!e||!t)return this;this.on(e,t);let r=this._onceEvents=this._onceEvents||{};return(r[e]=r[e]||{})[t]=!0,this},t.off=function(e,t){let r=this._events&&this._events[e];if(!r||!r.length)return this;let n=r.indexOf(t);return-1!=n&&r.splice(n,1),this},t.emitEvent=function(e,t){let r=this._events&&this._events[e];if(!r||!r.length)return this;r=r.slice(0),t=t||[];let n=this._onceEvents&&this._onceEvents[e];for(let i of r){n&&n[i]&&(this.off(e,i),delete n[i]),i.apply(this,t)}return this},t.allOff=function(){return delete this._events,delete this._onceEvents,this},e}))}(xr)),xr.exports}var Pr,Fr,Lr={exports:{}};function Or(){return Pr||(Pr=1,function(e){!function(t,r){e.exports?e.exports=r(t):t.fizzyUIUtils=r(t)}(a,(function(e){let t={extend:function(e,t){return Object.assign(e,t)},modulo:function(e,t){return(e%t+t)%t},makeArray:function(e){if(Array.isArray(e))return e;if(null==e)return[];return"object"==typeof e&&"number"==typeof e.length?[...e]:[e]},removeFrom:function(e,t){let r=e.indexOf(t);-1!=r&&e.splice(r,1)},getParent:function(e,t){for(;e.parentNode&&e!=document.body;)if((e=e.parentNode).matches(t))return e},getQueryElement:function(e){return"string"==typeof e?document.querySelector(e):e},handleEvent:function(e){let t="on"+e.type;this[t]&&this[t](e)},filterFindElements:function(e,r){return(e=t.makeArray(e)).filter((e=>e instanceof HTMLElement)).reduce(((e,t)=>{if(!r)return e.push(t),e;t.matches(r)&&e.push(t);let n=t.querySelectorAll(r);return e=e.concat(...n)}),[])},debounceMethod:function(e,t,r){r=r||100;let n=e.prototype[t],i=t+"Timeout";e.prototype[t]=function(){clearTimeout(this[i]);let e=arguments;this[i]=setTimeout((()=>{n.apply(this,e),delete this[i]}),r)}},docReady:function(e){let t=document.readyState;"complete"==t||"interactive"==t?setTimeout(e):document.addEventListener("DOMContentLoaded",e)},toDashed:function(e){return e.replace(/(.)([A-Z])/g,(function(e,t,r){return t+"-"+r})).toLowerCase()}},r=e.console;return t.htmlInit=function(n,i){t.docReady((function(){let s="data-"+t.toDashed(i),a=document.querySelectorAll(`[${s}]`),o=e.jQuery;[...a].forEach((e=>{let t,a=e.getAttribute(s);try{t=a&&JSON.parse(a)}catch(t){return void(r&&r.error(`Error parsing ${s} on ${e.className}: ${t}`))}let l=new n(e,t);o&&o.data(e,i,l)}))}))},t}))}(Lr)),Lr.exports}function Tr(){return Fr||(Fr=1,function(e){!function(t,r){e.exports?e.exports=r(t,Ar(),Or()):t.InfiniteScroll=r(t,t.EvEmitter,t.fizzyUIUtils)}(window,(function(e,t,r){let n=e.jQuery,i={};function s(e,t){let a=r.getQueryElement(e);if(a){if((e=a).infiniteScrollGUID){let r=i[e.infiniteScrollGUID];return r.option(t),r}this.element=e,this.options={...s.defaults},this.option(t),n&&(this.$element=n(this.element)),this.create()}else console.error("Bad element for InfiniteScroll: "+(a||e))}s.defaults={},s.create={},s.destroy={};let a=s.prototype;Object.assign(a,t.prototype);let o=0;a.create=function(){let e=this.guid=++o;if(this.element.infiniteScrollGUID=e,i[e]=this,this.pageIndex=1,this.loadCount=0,this.updateGetPath(),this.getPath&&this.getPath()){this.updateGetAbsolutePath(),this.log("initialized",[this.element.className]),this.callOnInit();for(let e in s.create)s.create[e].call(this)}else console.error("Disabling InfiniteScroll")},a.option=function(e){Object.assign(this.options,e)},a.callOnInit=function(){let e=this.options.onInit;e&&e.call(this,this)},a.dispatchEvent=function(e,t,r){this.log(e,r);let i=t?[t].concat(r):r;if(this.emitEvent(e,i),!n||!this.$element)return;let s=e+=".infiniteScroll";if(t){let r=n.Event(t);r.type=e,s=r}this.$element.trigger(s,r)};let l={initialized:e=>`on ${e}`,request:e=>`URL: ${e}`,load:(e,t)=>`${e.title||""}. URL: ${t}`,error:(e,t)=>`${e}. URL: ${t}`,append:(e,t,r)=>`${r.length} items. URL: ${t}`,last:(e,t)=>`URL: ${t}`,history:(e,t)=>`URL: ${t}`,pageIndex:function(e,t){return`current page determined to be: ${e} from ${t}`}};a.log=function(e,t){if(!this.options.debug)return;let r=`[InfiniteScroll] ${e}`,n=l[e];n&&(r+=". "+n.apply(this,t)),console.log(r)},a.updateMeasurements=function(){this.windowHeight=e.innerHeight;let t=this.element.getBoundingClientRect();this.top=t.top+e.scrollY},a.updateScroller=function(){let t=this.options.elementScroll;if(t){if(this.scroller=!0===t?this.element:r.getQueryElement(t),!this.scroller)throw new Error(`Unable to find elementScroll: ${t}`)}else this.scroller=e},a.updateGetPath=function(){let e=this.options.path;if(!e)return void console.error(`InfiniteScroll path option required. Set as: ${e}`);let t=typeof e;"function"!=t?"string"==t&&e.match("{{#}}")?this.updateGetPathTemplate(e):this.updateGetPathSelector(e):this.getPath=e},a.updateGetPathTemplate=function(e){this.getPath=()=>{let t=this.pageIndex+1;return e.replace("{{#}}",t)};let t=e.replace(/(\\\?|\?)/,"\\?").replace("{{#}}","(\\d\\d?\\d?)"),r=new RegExp(t),n=location.href.match(r);n&&(this.pageIndex=parseInt(n[1],10),this.log("pageIndex",[this.pageIndex,"template string"]))};let c=[/^(.*?\/?page\/?)(\d\d?\d?)(.*?$)/,/^(.*?\/?\?page=)(\d\d?\d?)(.*?$)/,/(.*?)(\d\d?\d?)(?!.*\d)(.*?$)/],u=s.getPathParts=function(e){if(e)for(let t of c){let r=e.match(t);if(r){let[,e,t,n]=r;return{begin:e,index:t,end:n}}}};a.updateGetPathSelector=function(e){let t=document.querySelector(e);if(!t)return void console.error(`Bad InfiniteScroll path option. Next link not found: ${e}`);let r=t.getAttribute("href"),n=u(r);if(!n)return void console.error(`InfiniteScroll unable to parse next link href: ${r}`);let{begin:i,index:s,end:a}=n;this.isPathSelector=!0,this.getPath=()=>i+(this.pageIndex+1)+a,this.pageIndex=parseInt(s,10)-1,this.log("pageIndex",[this.pageIndex,"next link"])},a.updateGetAbsolutePath=function(){let e=this.getPath();if(e.match(/^http/)||e.match(/^\//))return void(this.getAbsolutePath=this.getPath);let{pathname:t}=location,r=e.match(/^\?/),n=t.substring(0,t.lastIndexOf("/")),i=r?t:n+"/";this.getAbsolutePath=()=>i+this.getPath()},s.create.hideNav=function(){let e=r.getQueryElement(this.options.hideNav);e&&(e.style.display="none",this.nav=e)},s.destroy.hideNav=function(){this.nav&&(this.nav.style.display="")},a.destroy=function(){this.allOff();for(let e in s.destroy)s.destroy[e].call(this);delete this.element.infiniteScrollGUID,delete i[this.guid],n&&this.$element&&n.removeData(this.element,"infiniteScroll")},s.throttle=function(e,t){let r,n;return t=t||200,function(){let i=+new Date,s=arguments,a=()=>{r=i,e.apply(this,s)};r&&i<r+t?(clearTimeout(n),n=setTimeout(a,t)):a()}},s.data=function(e){let t=(e=r.getQueryElement(e))&&e.infiniteScrollGUID;return t&&i[t]},s.setJQuery=function(e){n=e},r.htmlInit(s,"infinite-scroll"),a._init=function(){};let{jQueryBridget:d}=e;return n&&d&&d("infiniteScroll",s,n),s}))}(Er)),Er.exports}var kr,jr={exports:{}};function Cr(){return kr||(kr=1,function(e){!function(t,r){e.exports?e.exports=r(t,Tr()):r(t,t.InfiniteScroll)}(window,(function(e,t){let r=t.prototype;Object.assign(t.defaults,{loadOnScroll:!0,checkLastPage:!0,responseBody:"text",domParseResponse:!0}),t.create.pageLoad=function(){this.canLoad=!0,this.on("scrollThreshold",this.onScrollThresholdLoad),this.on("load",this.checkLastPage),this.options.outlayer&&this.on("append",this.onAppendOutlayer)},r.onScrollThresholdLoad=function(){this.options.loadOnScroll&&this.loadNextPage()};let n=new DOMParser;function i(e){let t=document.createDocumentFragment();return e&&t.append(...e),t}return r.loadNextPage=function(){if(this.isLoading||!this.canLoad)return;let{responseBody:e,domParseResponse:t,fetchOptions:r}=this.options,i=this.getAbsolutePath();this.isLoading=!0,"function"==typeof r&&(r=r());let s=fetch(i,r).then((r=>{if(!r.ok){let e=new Error(r.statusText);return this.onPageError(e,i,r),{response:r}}return r[e]().then((s=>("text"==e&&t&&(s=n.parseFromString(s,"text/html")),204==r.status?(this.lastPageReached(s,i),{body:s,response:r}):this.onPageLoad(s,i,r))))})).catch((e=>{this.onPageError(e,i)}));return this.dispatchEvent("request",null,[i,s]),s},r.onPageLoad=function(e,t,r){return this.options.append||(this.isLoading=!1),this.pageIndex++,this.loadCount++,this.dispatchEvent("load",null,[e,t,r]),this.appendNextPage(e,t,r)},r.appendNextPage=function(e,t,r){let{append:n,responseBody:s,domParseResponse:a}=this.options;if(!("text"==s&&a)||!n)return{body:e,response:r};let o=e.querySelectorAll(n),l={body:e,response:r,items:o};if(!o||!o.length)return this.lastPageReached(e,t),l;let c=i(o),u=()=>(this.appendItems(o,c),this.isLoading=!1,this.dispatchEvent("append",null,[e,t,o,r]),l);return this.options.outlayer?this.appendOutlayerItems(c,u):u()},r.appendItems=function(e,t){e&&e.length&&(function(e){let t=e.querySelectorAll("script");for(let e of t){let t=document.createElement("script"),r=e.attributes;for(let e of r)t.setAttribute(e.name,e.value);t.innerHTML=e.innerHTML,e.parentNode.replaceChild(t,e)}}(t=t||i(e)),this.element.appendChild(t))},r.appendOutlayerItems=function(r,n){let i=t.imagesLoaded||e.imagesLoaded;return i?new Promise((function(e){i(r,(function(){let t=n();e(t)}))})):(console.error("[InfiniteScroll] imagesLoaded required for outlayer option"),void(this.isLoading=!1))},r.onAppendOutlayer=function(e,t,r){this.options.outlayer.appended(r)},r.checkLastPage=function(e,t){let r,{checkLastPage:n,path:i}=this.options;if(n){if("function"==typeof i){if(!this.getPath())return void this.lastPageReached(e,t)}"string"==typeof n?r=n:this.isPathSelector&&(r=i),r&&e.querySelector&&(e.querySelector(r)||this.lastPageReached(e,t))}},r.lastPageReached=function(e,t){this.canLoad=!1,this.dispatchEvent("last",null,[e,t])},r.onPageError=function(e,t,r){return this.isLoading=!1,this.canLoad=!1,this.dispatchEvent("error",null,[e,t,r]),e},t.create.prefill=function(){if(!this.options.prefill)return;let e=this.options.append;e?(this.updateMeasurements(),this.updateScroller(),this.isPrefilling=!0,this.on("append",this.prefill),this.once("error",this.stopPrefill),this.once("last",this.stopPrefill),this.prefill()):console.error(`append option required for prefill. Set as :${e}`)},r.prefill=function(){let e=this.getPrefillDistance();this.isPrefilling=e>=0,this.isPrefilling?(this.log("prefill"),this.loadNextPage()):this.stopPrefill()},r.getPrefillDistance=function(){return this.options.elementScroll?this.scroller.clientHeight-this.scroller.scrollHeight:this.windowHeight-this.element.clientHeight},r.stopPrefill=function(){this.log("stopPrefill"),this.off("append",this.prefill)},t}))}(jr)),jr.exports}var Rr,Ir={exports:{}};function qr(){return Rr||(Rr=1,function(e){!function(t,r){e.exports?e.exports=r(t,Tr(),Or()):r(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,(function(e,t,r){let n=t.prototype;return Object.assign(t.defaults,{scrollThreshold:400}),t.create.scrollWatch=function(){this.pageScrollHandler=this.onPageScroll.bind(this),this.resizeHandler=this.onResize.bind(this);let e=this.options.scrollThreshold;(e||0===e)&&this.enableScrollWatch()},t.destroy.scrollWatch=function(){this.disableScrollWatch()},n.enableScrollWatch=function(){this.isScrollWatching||(this.isScrollWatching=!0,this.updateMeasurements(),this.updateScroller(),this.on("last",this.disableScrollWatch),this.bindScrollWatchEvents(!0))},n.disableScrollWatch=function(){this.isScrollWatching&&(this.bindScrollWatchEvents(!1),delete this.isScrollWatching)},n.bindScrollWatchEvents=function(t){let r=t?"addEventListener":"removeEventListener";this.scroller[r]("scroll",this.pageScrollHandler),e[r]("resize",this.resizeHandler)},n.onPageScroll=t.throttle((function(){this.getBottomDistance()<=this.options.scrollThreshold&&this.dispatchEvent("scrollThreshold")})),n.getBottomDistance=function(){let t,r;return this.options.elementScroll?(t=this.scroller.scrollHeight,r=this.scroller.scrollTop+this.scroller.clientHeight):(t=this.top+this.element.clientHeight,r=e.scrollY+this.windowHeight),t-r},n.onResize=function(){this.updateMeasurements()},r.debounceMethod(t,"onResize",150),t}))}(Ir)),Ir.exports}var Nr,Dr={exports:{}};function Ur(){return Nr||(Nr=1,function(e){!function(t,r){e.exports?e.exports=r(t,Tr(),Or()):r(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,(function(e,t,r){let n=t.prototype;Object.assign(t.defaults,{history:"replace"});let i=document.createElement("a");return t.create.history=function(){if(!this.options.history)return;i.href=this.getAbsolutePath(),(i.origin||i.protocol+"//"+i.host)==location.origin?this.options.append?this.createHistoryAppend():this.createHistoryPageLoad():console.error(`[InfiniteScroll] cannot set history with different origin: ${i.origin} on ${location.origin} . History behavior disabled.`)},n.createHistoryAppend=function(){this.updateMeasurements(),this.updateScroller(),this.scrollPages=[{top:0,path:location.href,title:document.title}],this.scrollPage=this.scrollPages[0],this.scrollHistoryHandler=this.onScrollHistory.bind(this),this.unloadHandler=this.onUnload.bind(this),this.scroller.addEventListener("scroll",this.scrollHistoryHandler),this.on("append",this.onAppendHistory),this.bindHistoryAppendEvents(!0)},n.bindHistoryAppendEvents=function(t){let r=t?"addEventListener":"removeEventListener";this.scroller[r]("scroll",this.scrollHistoryHandler),e[r]("unload",this.unloadHandler)},n.createHistoryPageLoad=function(){this.on("load",this.onPageLoadHistory)},t.destroy.history=n.destroyHistory=function(){this.options.history&&this.options.append&&this.bindHistoryAppendEvents(!1)},n.onAppendHistory=function(e,t,r){if(!r||!r.length)return;let n=r[0],s=this.getElementScrollY(n);i.href=t,this.scrollPages.push({top:s,path:i.href,title:e.title})},n.getElementScrollY=function(t){if(this.options.elementScroll)return t.offsetTop-this.top;return t.getBoundingClientRect().top+e.scrollY},n.onScrollHistory=function(){let e=this.getClosestScrollPage();e!=this.scrollPage&&(this.scrollPage=e,this.setHistory(e.title,e.path))},r.debounceMethod(t,"onScrollHistory",150),n.getClosestScrollPage=function(){let t,r;t=this.options.elementScroll?this.scroller.scrollTop+this.scroller.clientHeight/2:e.scrollY+this.windowHeight/2;for(let e of this.scrollPages){if(e.top>=t)break;r=e}return r},n.setHistory=function(e,t){let r=this.options.history;r&&history[r+"State"]&&(history[r+"State"](null,e,t),this.options.historyTitle&&(document.title=e),this.dispatchEvent("history",null,[e,t]))},n.onUnload=function(){if(0===this.scrollPage.top)return;let t=e.scrollY-this.scrollPage.top+this.top;this.destroyHistory(),scrollTo(0,t)},n.onPageLoadHistory=function(e,t){this.setHistory(e.title,t)},t}))}(Dr)),Dr.exports}var $r,Mr={exports:{}};function Hr(){return $r||($r=1,function(e){!function(t,r){e.exports?e.exports=r(t,Tr(),Or()):r(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,(function(e,t,r){class n{constructor(e,t){this.element=e,this.infScroll=t,this.clickHandler=this.onClick.bind(this),this.element.addEventListener("click",this.clickHandler),t.on("request",this.disable.bind(this)),t.on("load",this.enable.bind(this)),t.on("error",this.hide.bind(this)),t.on("last",this.hide.bind(this))}onClick(e){e.preventDefault(),this.infScroll.loadNextPage()}enable(){this.element.removeAttribute("disabled")}disable(){this.element.disabled="disabled"}hide(){this.element.style.display="none"}destroy(){this.element.removeEventListener("click",this.clickHandler)}}return t.create.button=function(){let e=r.getQueryElement(this.options.button);e&&(this.button=new n(e,this))},t.destroy.button=function(){this.button&&this.button.destroy()},t.Button=n,t}))}(Mr)),Mr.exports}var zr,Br={exports:{}};function Gr(){return zr||(zr=1,function(e){!function(t,r){e.exports?e.exports=r(t,Tr(),Or()):r(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,(function(e,t,r){let n=t.prototype;function i(e){a(e,"none")}function s(e){a(e,"block")}function a(e,t){e&&(e.style.display=t)}return t.create.status=function(){let e=r.getQueryElement(this.options.status);e&&(this.statusElement=e,this.statusEventElements={request:e.querySelector(".infinite-scroll-request"),error:e.querySelector(".infinite-scroll-error"),last:e.querySelector(".infinite-scroll-last")},this.on("request",this.showRequestStatus),this.on("error",this.showErrorStatus),this.on("last",this.showLastStatus),this.bindHideStatus("on"))},n.bindHideStatus=function(e){let t=this.options.append?"append":"load";this[e](t,this.hideAllStatus)},n.showRequestStatus=function(){this.showStatus("request")},n.showErrorStatus=function(){this.showStatus("error")},n.showLastStatus=function(){this.showStatus("last"),this.bindHideStatus("off")},n.showStatus=function(e){s(this.statusElement),this.hideStatusEventElements(),s(this.statusEventElements[e])},n.hideAllStatus=function(){i(this.statusElement),this.hideStatusEventElements()},n.hideStatusEventElements=function(){for(let e in this.statusEventElements){i(this.statusEventElements[e])}},t}))}(Br)),Br.exports}
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("process"),require("buffer")):"function"==typeof define&&define.amd?define(["exports","process","buffer"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Salla={},e.process$1,e.buffer)}(this,(function(e,t,r){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=n(t),s="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},o=Array.isArray,l="object"==typeof a&&a&&a.Object===Object&&a,c="object"==typeof self&&self&&self.Object===Object&&self,u=l||c||Function("return this")(),d=u.Symbol,h=d,f=Object.prototype,p=f.hasOwnProperty,g=f.toString,m=h?h.toStringTag:void 0;var v=function(e){var t=p.call(e,m),r=e[m];try{e[m]=void 0;var n=!0}catch(e){}var i=g.call(e);return n&&(t?e[m]=r:delete e[m]),i},y=Object.prototype.toString;var b=v,w=function(e){return y.call(e)},_=d?d.toStringTag:void 0;var S=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":_&&_ in Object(e)?b(e):w(e)};var E=S,x=function(e){return null!=e&&"object"==typeof e};var A=function(e){return"symbol"==typeof e||x(e)&&"[object Symbol]"==E(e)},P=o,F=A,L=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,O=/^\w*$/;var T=function(e,t){if(P(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!F(e))||(O.test(e)||!L.test(e)||null!=t&&e in Object(t))};var k=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},j=S,C=k;var R,I=function(e){if(!C(e))return!1;var t=j(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},q=u["__core-js_shared__"],N=(R=/[^.]+$/.exec(q&&q.keys&&q.keys.IE_PROTO||""))?"Symbol(src)_1."+R:"";var D=function(e){return!!N&&N in e},U=Function.prototype.toString;var $=I,M=D,H=k,z=function(e){if(null!=e){try{return U.call(e)}catch(e){}try{return e+""}catch(e){}}return""},B=/^\[object .+?Constructor\]$/,G=Function.prototype,W=Object.prototype,V=G.toString,J=W.hasOwnProperty,Q=RegExp("^"+V.call(J).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var K=function(e){return!(!H(e)||M(e))&&($(e)?Q:B).test(z(e))},Z=function(e,t){return null==e?void 0:e[t]};var X=function(e,t){var r=Z(e,t);return K(r)?r:void 0},Y=X(Object,"create"),ee=Y;var te=function(){this.__data__=ee?ee(null):{},this.size=0};var re=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ne=Y,ie=Object.prototype.hasOwnProperty;var se=function(e){var t=this.__data__;if(ne){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return ie.call(t,e)?t[e]:void 0},ae=Y,oe=Object.prototype.hasOwnProperty;var le=function(e){var t=this.__data__;return ae?void 0!==t[e]:oe.call(t,e)},ce=Y;var ue=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ce&&void 0===t?"__lodash_hash_undefined__":t,this},de=te,he=re,fe=se,pe=le,ge=ue;function me(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}me.prototype.clear=de,me.prototype.delete=he,me.prototype.get=fe,me.prototype.has=pe,me.prototype.set=ge;var ve=me;var ye=function(){this.__data__=[],this.size=0};var be=function(e,t){return e===t||e!=e&&t!=t};var we=function(e,t){for(var r=e.length;r--;)if(be(e[r][0],t))return r;return-1},_e=we,Se=Array.prototype.splice;var Ee=function(e){var t=this.__data__,r=_e(t,e);return!(r<0)&&(r==t.length-1?t.pop():Se.call(t,r,1),--this.size,!0)},xe=we;var Ae=function(e){var t=this.__data__,r=xe(t,e);return r<0?void 0:t[r][1]},Pe=we;var Fe=we;var Le=function(e,t){var r=this.__data__,n=Fe(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Oe=ye,Te=Ee,ke=Ae,je=function(e){return Pe(this.__data__,e)>-1},Ce=Le;function Re(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Re.prototype.clear=Oe,Re.prototype.delete=Te,Re.prototype.get=ke,Re.prototype.has=je,Re.prototype.set=Ce;var Ie=Re,qe=X(u,"Map"),Ne=ve,De=Ie,Ue=qe;var $e=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Me=function(e,t){var r=e.__data__;return $e(t)?r["string"==typeof t?"string":"hash"]:r.map},He=Me;var ze=Me;var Be=Me;var Ge=Me;var We=function(e,t){var r=Ge(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Ve=function(){this.size=0,this.__data__={hash:new Ne,map:new(Ue||De),string:new Ne}},Je=function(e){var t=He(this,e).delete(e);return this.size-=t?1:0,t},Qe=function(e){return ze(this,e).get(e)},Ke=function(e){return Be(this,e).has(e)},Ze=We;function Xe(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Xe.prototype.clear=Ve,Xe.prototype.delete=Je,Xe.prototype.get=Qe,Xe.prototype.has=Ke,Xe.prototype.set=Ze;var Ye=Xe;function et(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var a=e.apply(this,n);return r.cache=s.set(i,a)||s,a};return r.cache=new(et.Cache||Ye),r}et.Cache=Ye;var tt=et;var rt=function(e){var t=tt(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t},nt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,it=/\\(\\)?/g,st=rt((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(nt,(function(e,r,n,i){t.push(n?i.replace(it,"$1"):r||e)})),t}));var at=function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i},ot=o,lt=A,ct=d?d.prototype:void 0,ut=ct?ct.toString:void 0;var dt=function e(t){if("string"==typeof t)return t;if(ot(t))return at(t,e)+"";if(lt(t))return ut?ut.call(t):"";var r=t+"";return"0"==r&&1/t==-Infinity?"-0":r},ht=dt;var ft=o,pt=T,gt=st,mt=function(e){return null==e?"":ht(e)};var vt=A;var yt=function(e,t){return ft(e)?e:pt(e,t)?[e]:gt(mt(e))},bt=function(e){if("string"==typeof e||vt(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var wt=function(e,t){for(var r=0,n=(t=yt(t,e)).length;null!=e&&r<n;)e=e[bt(t[r++])];return r&&r==n?e:void 0};var _t=function(e,t,r){var n=null==e?void 0:wt(e,t);return void 0===n?r:n},St={exports:{}};!function(e,t){!function(t){var r=Object.hasOwnProperty,n=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},s="object"==typeof i.default&&"function"==typeof i.default.nextTick,a="function"==typeof Symbol,o="object"==typeof Reflect,l="function"==typeof setImmediate?setImmediate:setTimeout,c=a?o&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function u(){this._events={},this._conf&&d.call(this,this._conf)}function d(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),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),this.wildcard&&(this.listenerTree={}))}function h(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+"."),void 0!==i.default&&i.default.emitWarning){var n=new Error(r);n.name="MaxListenersExceededWarning",n.emitter=this,n.count=e,i.default.emitWarning(n)}else console.error(r),console.trace&&console.trace()}var f=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:for(var i=new Array(n);n--;)i[n]=arguments[n];return i}};function p(e,r){for(var n={},i=e.length,s=r?r.length:0,a=0;a<i;a++)n[e[a]]=a<s?r[a]:t;return n}function g(e,t,r){var n,i;if(this._emitter=e,this._target=t,this._listeners={},this._listenersCount=0,(r.on||r.off)&&(n=r.on,i=r.off),t.addEventListener?(n=t.addEventListener,i=t.removeEventListener):t.addListener?(n=t.addListener,i=t.removeListener):t.on&&(n=t.on,i=t.off),!n&&!i)throw Error("target does not implement any known event API");if("function"!=typeof n)throw TypeError("on method must be a function");if("function"!=typeof i)throw TypeError("off method must be a function");this._on=n,this._off=i;var s=e._observers;s?s.push(this):e._observers=[this]}function m(e,n,i,s){var a=Object.assign({},n);if(!e)return a;if("object"!=typeof e)throw TypeError("options must be an object");var o,l,c,u=Object.keys(e),d=u.length;function h(e){throw Error('Invalid "'+o+'" option value'+(e?". Reason: "+e:""))}for(var f=0;f<d;f++){if(o=u[f],!s&&!r.call(n,o))throw Error('Unknown "'+o+'" option');(l=e[o])!==t&&(c=i[o],a[o]=c?c(l,h):l)}return a}function v(e,t){return"function"==typeof e&&e.hasOwnProperty("prototype")||t("value must be a constructor"),e}function y(e){var t="value must be type of "+e.join("|"),r=e.length,n=e[0],i=e[1];return 1===r?function(e,r){if(typeof e===n)return e;r(t)}:2===r?function(e,r){var s=typeof e;if(s===n||s===i)return e;r(t)}:function(n,i){for(var s=typeof n,a=r;a-- >0;)if(s===e[a])return n;i(t)}}Object.assign(g.prototype,{subscribe:function(e,t,r){var n=this,i=this._target,s=this._emitter,a=this._listeners,o=function(){var n=f.apply(null,arguments),a={data:n,name:t,original:e};if(r){var o=r.call(i,a);!1!==o&&s.emit.apply(s,[a.name].concat(n))}else s.emit.apply(s,[t].concat(n))};if(a[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,s._newListener&&s._removeListener&&!n._onNewListener?(this._onNewListener=function(r){r===t&&null===a[e]&&(a[e]=o,n._on.call(i,e,o))},s.on("newListener",this._onNewListener),this._onRemoveListener=function(r){r===t&&!s.hasListeners(r)&&a[e]&&(a[e]=null,n._off.call(i,e,o))},a[e]=null,s.on("removeListener",this._onRemoveListener)):(a[e]=o,n._on.call(i,e,o))},unsubscribe:function(e){var t,r,n,i=this,s=this._listeners,a=this._emitter,o=this._off,l=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function u(){i._onNewListener&&(a.off("newListener",i._onNewListener),a.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=S.call(a,i);a._observers.splice(e,1)}if(e){if(!(t=s[e]))return;o.call(l,e,t),delete s[e],--this._listenersCount||u()}else{for(n=(r=c(s)).length;n-- >0;)e=r[n],o.call(l,e,s[e]);this._listeners={},this._listenersCount=0,u()}}});var b=y(["function"]),w=y(["object","function"]);function _(e,t,r){var n,i,s,a=0,o=new e((function(l,c,u){function d(){i&&(i=null),a&&(clearTimeout(a),a=0)}r=m(r,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),n=!r.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof u;var h=function(e){d(),l(e)},f=function(e){d(),c(e)};n?t(h,f,u):(i=[function(e){f(e||Error("canceled"))}],t(h,f,(function(e){if(s)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)})),s=!0),r.timeout>0&&(a=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",a=0,o.cancel(e),c(e)}),r.timeout))}));return n||(o.cancel=function(e){if(i){for(var t=i.length,r=1;r<t;r++)i[r](e);i[0](e),i=null}}),o}function S(e){var t=this._observers;if(!t)return-1;for(var r=t.length,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(0===n){var s=typeof t;if("string"===s){var a,o,l=0,u=0,d=this.delimiter,h=d.length;if(-1!==(o=t.indexOf(d))){a=new Array(5);do{a[l++]=t.slice(u,o),u=o+h}while(-1!==(o=t.indexOf(d,u)));a[l++]=t.slice(u),t=a,i=l}else t=[t],i=1}else"object"===s?i=t.length:(t=[t],i=1)}var f,p,g,m,v,y,b,w=null,_=t[n],S=t[n+1];if(n===i)r._listeners&&("function"==typeof r._listeners?(e&&e.push(r._listeners),w=[r]):(e&&e.push.apply(e,r._listeners),w=[r]));else{if("*"===_){for(o=(y=c(r)).length;o-- >0;)"_listeners"!==(f=y[o])&&(b=E(e,t,r[f],n+1,i))&&(w?w.push.apply(w,b):w=b);return w}if("**"===_){for((v=n+1===i||n+2===i&&"*"===S)&&r._listeners&&(w=E(e,t,r,i,i)),o=(y=c(r)).length;o-- >0;)"_listeners"!==(f=y[o])&&("*"===f||"**"===f?(r[f]._listeners&&!v&&(b=E(e,t,r[f],i,i))&&(w?w.push.apply(w,b):w=b),b=E(e,t,r[f],n,i)):b=E(e,t,r[f],f===S?n+2:n,i),b&&(w?w.push.apply(w,b):w=b));return w}r[_]&&(w=E(e,t,r[_],n+1,i))}if((p=r["*"])&&E(e,t,p,n+1,i),g=r["**"])if(n<i)for(g._listeners&&E(e,t,g,i,i),o=(y=c(g)).length;o-- >0;)"_listeners"!==(f=y[o])&&(f===S?E(e,t,g[f],n+2,i):f===_?E(e,t,g[f],n+1,i):((m={})[f]=g[f],E(e,t,{"**":m},n+1,i)));else g._listeners?E(e,t,g,i,i):g["*"]&&g["*"]._listeners&&E(e,t,g["*"],i,i);return w}function x(e,t,r){var n,i,s=0,a=0,o=this.delimiter,l=o.length;if("string"==typeof e)if(-1!==(n=e.indexOf(o))){i=new Array(5);do{i[s++]=e.slice(a,n),a=n+l}while(-1!==(n=e.indexOf(o,a)));i[s++]=e.slice(a)}else i=[e],s=1;else i=e,s=e.length;if(s>1)for(n=0;n+1<s;n++)if("**"===i[n]&&"**"===i[n+1])return;var c,u=this.listenerTree;for(n=0;n<s;n++)if(u=u[c=i[n]]||(u[c]={}),n===s-1)return u._listeners?("function"==typeof u._listeners&&(u._listeners=[u._listeners]),r?u._listeners.unshift(t):u._listeners.push(t),!u._listeners.warned&&this._maxListeners>0&&u._listeners.length>this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,c))):u._listeners=t,!0;return!0}function A(e,t,r,n){for(var i,s,a,o,l=c(e),u=l.length,d=e._listeners;u-- >0;)i=e[s=l[u]],a="_listeners"===s?r:r?r.concat(s):[s],o=n||"symbol"==typeof s,d&&t.push(o?a:a.join(this.delimiter)),"object"==typeof i&&A.call(this,i,t,a,o);return t}function P(e){for(var t,r,n,i=c(e),s=i.length;s-- >0;)(t=e[r=i[s]])&&(n=!0,"_listeners"===r||P(t)||delete e[r]);return n}function F(e,t,r){this.emitter=e,this.event=t,this.listener=r}function L(e,r,n){if(!0===n)o=!0;else if(!1===n)a=!0;else{if(!n||"object"!=typeof n)throw TypeError("options should be an object or true");var a=n.async,o=n.promisify,c=n.nextTick,u=n.objectify}if(a||c||o){var d=r,h=r._origin||r;if(c&&!s)throw Error("process.nextTick is not supported");o===t&&(o="AsyncFunction"===r.constructor.name),r=function(){var e=arguments,t=this,r=this.event;return o?c?Promise.resolve():new Promise((function(e){l(e)})).then((function(){return t.event=r,d.apply(t,e)})):(c?i.default.nextTick:l)((function(){t.event=r,d.apply(t,e)}))},r._async=!0,r._origin=h}return[r,u?new F(this,e,r):this]}function O(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,d.call(this,e)}F.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},O.EventEmitter2=O,O.prototype.listenTo=function(e,r,i){if("object"!=typeof e)throw TypeError("target musts be an object");var s=this;function a(t){if("object"!=typeof t)throw TypeError("events must be an object");var r,n=i.reducers,a=S.call(s,e);r=-1===a?new g(s,e,i):s._observers[a];for(var o,l=c(t),u=l.length,d="function"==typeof n,h=0;h<u;h++)o=l[h],r.subscribe(o,t[o]||o,d?n:n&&n[o])}return i=m(i,{on:t,off:t,reducers:t},{on:b,off:b,reducers:w}),n(r)?a(p(r)):a("string"==typeof r?p(r.split(/\s+/)):r),this},O.prototype.stopListeningTo=function(e,t){var r=this._observers;if(!r)return!1;var n,i=r.length,s=!1;if(e&&"object"!=typeof e)throw TypeError("target should be an object");for(;i-- >0;)n=r[i],e&&n._target!==e||(n.unsubscribe(t),s=!0);return s},O.prototype.delimiter=".",O.prototype.setMaxListeners=function(e){e!==t&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},O.prototype.getMaxListeners=function(){return this._maxListeners},O.prototype.event="",O.prototype.once=function(e,t,r){return this._once(e,t,!1,r)},O.prototype.prependOnceListener=function(e,t,r){return this._once(e,t,!0,r)},O.prototype._once=function(e,t,r,n){return this._many(e,1,t,r,n)},O.prototype.many=function(e,t,r,n){return this._many(e,t,r,!1,n)},O.prototype.prependMany=function(e,t,r,n){return this._many(e,t,r,!0,n)},O.prototype._many=function(e,t,r,n,i){var s=this;if("function"!=typeof r)throw new Error("many only accepts instances of Function");function a(){return 0==--t&&s.off(e,a),r.apply(this,arguments)}return a._origin=r,this._on(e,a,n,i)},O.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||u.call(this);var e,t,r,n,i,s,o=arguments[0],l=this.wildcard;if("newListener"===o&&!this._newListener&&!this._events.newListener)return!1;if(l&&(e=o,"newListener"!==o&&"removeListener"!==o&&"object"==typeof o)){if(r=o.length,a)for(n=0;n<r;n++)if("symbol"==typeof o[n]){s=!0;break}s||(o=o.join(this.delimiter))}var c,d=arguments.length;if(this._all&&this._all.length)for(n=0,r=(c=this._all.slice()).length;n<r;n++)switch(this.event=o,d){case 1:c[n].call(this,o);break;case 2:c[n].call(this,o,arguments[1]);break;case 3:c[n].call(this,o,arguments[1],arguments[2]);break;default:c[n].apply(this,arguments)}if(l)c=[],E.call(this,c,e,this.listenerTree,0,r);else{if("function"==typeof(c=this._events[o])){switch(this.event=o,d){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:for(t=new Array(d-1),i=1;i<d;i++)t[i-1]=arguments[i];c.apply(this,t)}return!0}c&&(c=c.slice())}if(c&&c.length){if(d>3)for(t=new Array(d-1),i=1;i<d;i++)t[i-1]=arguments[i];for(n=0,r=c.length;n<r;n++)switch(this.event=o,d){case 1:c[n].call(this);break;case 2:c[n].call(this,arguments[1]);break;case 3:c[n].call(this,arguments[1],arguments[2]);break;default:c[n].apply(this,t)}return!0}if(!this.ignoreErrors&&!this._all&&"error"===o)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},O.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||u.call(this);var e,t,r,n,i,s,o=arguments[0],l=this.wildcard;if("newListener"===o&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(l&&(e=o,"newListener"!==o&&"removeListener"!==o&&"object"==typeof o)){if(n=o.length,a)for(i=0;i<n;i++)if("symbol"==typeof o[i]){t=!0;break}t||(o=o.join(this.delimiter))}var c,d=[],h=arguments.length;if(this._all)for(i=0,n=this._all.length;i<n;i++)switch(this.event=o,h){case 1:d.push(this._all[i].call(this,o));break;case 2:d.push(this._all[i].call(this,o,arguments[1]));break;case 3:d.push(this._all[i].call(this,o,arguments[1],arguments[2]));break;default:d.push(this._all[i].apply(this,arguments))}if(l?(c=[],E.call(this,c,e,this.listenerTree,0)):c=this._events[o],"function"==typeof c)switch(this.event=o,h){case 1:d.push(c.call(this));break;case 2:d.push(c.call(this,arguments[1]));break;case 3:d.push(c.call(this,arguments[1],arguments[2]));break;default:for(r=new Array(h-1),s=1;s<h;s++)r[s-1]=arguments[s];d.push(c.apply(this,r))}else if(c&&c.length){if(c=c.slice(),h>3)for(r=new Array(h-1),s=1;s<h;s++)r[s-1]=arguments[s];for(i=0,n=c.length;i<n;i++)switch(this.event=o,h){case 1:d.push(c[i].call(this));break;case 2:d.push(c[i].call(this,arguments[1]));break;case 3:d.push(c[i].call(this,arguments[1],arguments[2]));break;default:d.push(c[i].apply(this,r))}}else if(!this.ignoreErrors&&!this._all&&"error"===o)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(d)},O.prototype.on=function(e,t,r){return this._on(e,t,!1,r)},O.prototype.prependListener=function(e,t,r){return this._on(e,t,!0,r)},O.prototype.onAny=function(e){return this._onAny(e,!1)},O.prototype.prependAny=function(e){return this._onAny(e,!0)},O.prototype.addListener=O.prototype.on,O.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},O.prototype._on=function(e,r,n,i){if("function"==typeof e)return this._onAny(e,r),this;if("function"!=typeof r)throw new Error("on only accepts instances of Function");this._events||u.call(this);var s,a=this;return i!==t&&(r=(s=L.call(this,e,r,i))[0],a=s[1]),this._newListener&&this.emit("newListener",e,r),this.wildcard?(x.call(this,e,r,n),a):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),n?this._events[e].unshift(r):this._events[e].push(r),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=r,a)},O.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r,i=[];if(this.wildcard){var s="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=E.call(this,null,s,this.listenerTree,0)))return this}else{if(!this._events[e])return this;r=this._events[e],i.push({_listeners:r})}for(var a=0;a<i.length;a++){var o=i[a];if(r=o._listeners,n(r)){for(var l=-1,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;return this.wildcard?o._listeners.splice(l,1):this._events[e].splice(l,1),0===r.length&&(this.wildcard?delete o._listeners:delete this._events[e]),this._removeListener&&this.emit("removeListener",e,t),this}(r===t||r.listener&&r.listener===t||r._origin&&r._origin===t)&&(this.wildcard?delete o._listeners:delete this._events[e],this._removeListener&&this.emit("removeListener",e,t))}return this.listenerTree&&P(this.listenerTree),this},O.prototype.offAny=function(e){var t,r=0,n=0;if(e&&this._all&&this._all.length>0){for(r=0,n=(t=this._all).length;r<n;r++)if(e===t[r])return t.splice(r,1),this._removeListener&&this.emit("removeListenerAny",e),this}else{if(t=this._all,this._removeListener)for(r=0,n=t.length;r<n;r++)this.emit("removeListenerAny",t[r]);this._all=[]}return this},O.prototype.removeListener=O.prototype.off,O.prototype.removeAllListeners=function(e){if(e===t)return!this._events||u.call(this),this;if(this.wildcard){var r,n=E.call(this,null,e,this.listenerTree,0);if(!n)return this;for(r=0;r<n.length;r++)n[r]._listeners=null;this.listenerTree&&P(this.listenerTree)}else this._events&&(this._events[e]=null);return this},O.prototype.listeners=function(e){var r,n,i,s,a,o=this._events;if(e===t){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!o)return[];for(s=(r=c(o)).length,i=[];s-- >0;)"function"==typeof(n=o[r[s]])?i.push(n):i.push.apply(i,n);return i}if(this.wildcard){if(!(a=this.listenerTree))return[];var l=[],u="string"==typeof e?e.split(this.delimiter):e.slice();return E.call(this,l,u,a,0),l}return o&&(n=o[e])?"function"==typeof n?[n]:n:[]},O.prototype.eventNames=function(e){var t=this._events;return this.wildcard?A.call(this,this.listenerTree,[],null,e):t?c(t):[]},O.prototype.listenerCount=function(e){return this.listeners(e).length},O.prototype.hasListeners=function(e){if(this.wildcard){var r=[],n="string"==typeof e?e.split(this.delimiter):e.slice();return E.call(this,r,n,this.listenerTree,0),r.length>0}var i=this._events,s=this._all;return!!(s&&s.length||i&&(e===t?c(i).length:i[e]))},O.prototype.listenersAny=function(){return this._all?this._all:[]},O.prototype.waitFor=function(e,r){var n=this,i=typeof r;return"number"===i?r={timeout:r}:"function"===i&&(r={filter:r}),_((r=m(r,{timeout:0,filter:t,handleError:!1,Promise:Promise,overload:!1},{filter:b,Promise:v})).Promise,(function(t,i,s){function a(){var s=r.filter;if(!s||s.apply(n,arguments))if(n.off(e,a),r.handleError){var o=arguments[0];o?i(o):t(f.apply(null,arguments).slice(1))}else t(f.apply(null,arguments))}s((function(){n.off(e,a)})),n._on(e,a,!1)}),{timeout:r.timeout,overload:r.overload})};var T=O.prototype;Object.defineProperties(O,{defaultMaxListeners:{get:function(){return T._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");T._maxListeners=e},enumerable:!0},once:{value:function(e,t,r){return _((r=m(r,{Promise:Promise,timeout:0,overload:!1},{Promise:v})).Promise,(function(r,n,i){var s;if("function"==typeof e.addEventListener)return s=function(){r(f.apply(null,arguments))},i((function(){e.removeEventListener(t,s)})),void e.addEventListener(t,s,{once:!0});var a,o=function(){a&&e.removeListener("error",a),r(f.apply(null,arguments))};"error"!==t&&(a=function(r){e.removeListener(t,o),n(r)},e.once("error",a)),i((function(){a&&e.removeListener("error",a),e.removeListener(t,o)})),e.once(t,o)}),{timeout:r.timeout,overload:r.overload})},writable:!0,configurable:!0}}),Object.defineProperties(T,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),e.exports=O}()}(St);var Et=St.exports,xt=Object.assign?Object.assign:function(e,t,r,n){for(var i=1;i<arguments.length;i++)Tt(Object(arguments[i]),(function(t,r){e[r]=t}));return e},At=function(){if(Object.create)return function(e,t,r,n){var i=Ot(arguments,1);return xt.apply(this,[Object.create(e)].concat(i))};{function e(){}return function(t,r,n,i){var s=Ot(arguments,1);return e.prototype=t,xt.apply(this,[new e].concat(s))}}}(),Pt=String.prototype.trim?function(e){return String.prototype.trim.call(e)}:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},Ft="undefined"!=typeof window?window:a,Lt={assign:xt,create:At,trim:Pt,bind:function(e,t){return function(){return t.apply(e,Array.prototype.slice.call(arguments,0))}},slice:Ot,each:Tt,map:function(e,t){var r=jt(e)?[]:{};return kt(e,(function(e,n){return r[n]=t(e,n),!1})),r},pluck:kt,isList:jt,isFunction:function(e){return e&&"[object Function]"==={}.toString.call(e)},isObject:function(e){return e&&"[object Object]"==={}.toString.call(e)},Global:Ft};function Ot(e,t){return Array.prototype.slice.call(e,t||0)}function Tt(e,t){kt(e,(function(e,r){return t(e,r),!1}))}function kt(e,t){if(jt(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)&&t(e[n],n))return e[n]}function jt(e){return null!=e&&"function"!=typeof e&&"number"==typeof e.length}var Ct=Lt.slice,Rt=Lt.pluck,It=Lt.each,qt=Lt.bind,Nt=Lt.create,Dt=Lt.isList,Ut=Lt.isFunction,$t=Lt.isObject,Mt={createStore:zt},Ht={version:"2.0.12",enabled:!1,get:function(e,t){var r=this.storage.read(this._namespacePrefix+e);return this._deserialize(r,t)},set:function(e,t){return void 0===t?this.remove(e):(this.storage.write(this._namespacePrefix+e,this._serialize(t)),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 zt.apply(this,arguments)},addPlugin:function(e){this._addPlugin(e)},namespace:function(e){return zt(this.storage,this.plugins,e)}};function zt(e,t,r){r||(r=""),e&&!Dt(e)&&(e=[e]),t&&!Dt(t)&&(t=[t]);var n=r?"__storejs_"+r+"_":"",i=r?new RegExp("^"+n):null;if(!/^[a-zA-Z0-9_\-]*$/.test(r))throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes");var s={_namespacePrefix:n,_namespaceRegexp:i,_testStorage:function(e){try{var t="__storejs__test__";e.write(t,t);var r=e.read(t)===t;return e.remove(t),r}catch(e){return!1}},_assignPluginFnProp:function(e,t){var r=this[t];this[t]=function(){var t=Ct(arguments,0),n=this;function i(){if(r)return It(arguments,(function(e,r){t[r]=e})),r.apply(n,t)}var s=[i].concat(t);return e.apply(n,s)}},_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 void 0!==r?r:t},_addStorage:function(e){this.enabled||this._testStorage(e)&&(this.storage=e,this.enabled=!0)},_addPlugin:function(e){var t=this;if(Dt(e))It(e,(function(e){t._addPlugin(e)}));else if(!Rt(this.plugins,(function(t){return e===t}))){if(this.plugins.push(e),!Ut(e))throw new Error("Plugins must be function values that return objects");var r=e.call(this);if(!$t(r))throw new Error("Plugins must return an object of function properties");It(r,(function(r,n){if(!Ut(r))throw new Error("Bad plugin property: "+n+" from plugin "+e.name+". Plugins should only return functions.");t._assignPluginFnProp(r,n)}))}},addStorage:function(e){!function(){var e="undefined"==typeof console?null:console;if(e){(e.warn?e.warn:e.log).apply(e,arguments)}}("store.addStorage(storage) is deprecated. Use createStore([storages])"),this._addStorage(e)}},a=Nt(s,Ht,{plugins:[]});return a.raw={},It(a,(function(e,t){Ut(e)&&(a.raw[t]=qt(a,e))})),It(e,(function(e){a._addStorage(e)})),It(t,(function(e){a._addPlugin(e)})),a}var Bt=Lt.Global,Gt={name:"localStorage",read:Vt,write:function(e,t){return Wt().setItem(e,t)},each:function(e){for(var t=Wt().length-1;t>=0;t--){var r=Wt().key(t);e(Vt(r),r)}},remove:function(e){return Wt().removeItem(e)},clearAll:function(){return Wt().clear()}};function Wt(){return Bt.localStorage}function Vt(e){return Wt().getItem(e)}var Jt=Lt.Global,Qt={name:"sessionStorage",read:Zt,write:function(e,t){return Kt().setItem(e,t)},each:function(e){for(var t=Kt().length-1;t>=0;t--){var r=Kt().key(t);e(Zt(r),r)}},remove:function(e){return Kt().removeItem(e)},clearAll:function(){return Kt().clear()}};function Kt(){return Jt.sessionStorage}function Zt(e){return Kt().getItem(e)}var Xt=Lt.trim,Yt={name:"cookieStorage",read:function(e){if(!e||!nr(e))return null;var t="(?:^|.*;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(er.cookie.replace(new RegExp(t),"$1"))},write:function(e,t){if(!e)return;er.cookie=escape(e)+"="+escape(t)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/"},each:tr,remove:rr,clearAll:function(){tr((function(e,t){rr(t)}))}},er=Lt.Global.document;function tr(e){for(var t=er.cookie.split(/; ?/g),r=t.length-1;r>=0;r--)if(Xt(t[r])){var n=t[r].split("="),i=unescape(n[0]);e(unescape(n[1]),i)}}function rr(e){e&&nr(e)&&(er.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function nr(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(er.cookie)}var ir={name:"memoryStorage",read:function(e){return sr[e]},write:function(e,t){sr[e]=t},each:function(e){for(var t in sr)sr.hasOwnProperty(t)&&e(sr[t],t)},remove:function(e){delete sr[e]},clearAll:function(e){sr={}}},sr={};function ar(e,t=!1){e+="";let r,n=["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"],i=["0","1","2","3","4","5","6","7","8","9"],s=(t=t||!Salla.config.get("store.settings.arabic_numbers_enabled"))?n:i,a=t?i:n;for(let t=0;t<s.length;t++)r=new RegExp(s[t],"g"),e=e.replace(r,a[t]);return e}function or(e){let t=(e.match(/\./g)||[]).length;return t&&1!==t?or(e.replace(/\.(.+)\./g,".$1")):e}function lr(e,t,r){let n=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[n]=lr(e.slice(1),t,r[n]),r):n?{[n]:lr(e.slice(1),t)}:""===n?[t]:t}function cr(e){return Salla.config.get("store.url",window.location.href.split("/").slice(0,-1).join("/")).rtrim("/")+"/"+e.ltrim("/")}var ur={digitsOnly:function(e){return ar(e,!0).replace(/[^0-9.]/g,"").replace("..",".").rtrim(".")},inputDigitsOnly:function e(t,r=!1){if("string"==typeof t)return document.querySelectorAll(t).forEach((t=>e(t,r)));if(!t)return void Salla.logger.warn("Can't find Object With Id: "+t);let n=Salla.helpers.digitsOnly(t.value);return t.min&&n<t.min?t.value=t.min:t.max&&n>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")?or(n):n.replace(/\D/g,"")},number:ar,money:function(e){return ar(e?.amount|e)+" "+Salla.config.currency(e?.currency).symbol},setNested:function(e,t,r){let n=e,i=t.split("."),s=i.length;for(let e=0;e<s-1;e++){let t=i[e];n[t]||(n[t]={}),n=n[t]}return n[i[s-1]]=r,e},getNested:function(e,t,r){let n=_t(e,t);return void 0!==n?n:r},inputData:function(e,t,r={}){if(e.includes("[")){let n=e.split("]").join("").split("[");return{name:n[0],value:lr(n.slice(1),t,r[n[0]])}}return{name:e,value:t}},url:{get:cr,asset:function(e){return function(e){return window.location.origin+"/"+e.ltrim("/")}("themes/"+Salla.config.get("theme.name")+"/"+e.ltrim("/"))},cdn:function(e){return"https://cdn.salla.network/"+e.ltrim("/")},is_page:function(e){return e&&Salla.config.get("page.slug")===e},api:function(e){return Salla.config.get("store.api",cr("")).rtrim("/")+"/"+e.ltrim("/")}},addParamToUrl:function(e,t){if(!t||!e)return window.location.href;let r=new RegExp("([?&])"+e+"=[^&]+[&]?","g"),n=window.location.href.replace(r,"$1").replace(/&$|\?$/,"");return n+=(n.includes("?")?"&":"?")+e+"="+encodeURIComponent(t),n.replace(/&$|\?$/,"")},debounce:function(e,t){t=t||100;let r,n=[];return function(...i){return clearTimeout(r),r=setTimeout((()=>{let t=e(...i);n.forEach((e=>e(t))),n=[]}),t),new Promise((e=>n.push(e)))}}},dr=function(e){let t={log:function(t,r){if(!e)return;"trace"===salla.config.get("debug")&&(r="trace");let n=e.log,i=void 0===r?n:this.__dict__[r]||n,s=["%cTwilight","color: #5cd5c4;font-weight:bold; border:1px solid #5cd5c4; padding: 2px 6px; border-radius: 5px;"],a={event:"#CFF680",backend:"#7b68ee"}[r];a&&(s[0]+="%c"+r[0].toUpperCase()+r.substring(1),s.push(`margin-left: 5px;color: ${a};font-weight:bold; border:1px solid ${a}; padding: 2px 6px; border-radius: 5px;`)),i.call(e,...s.concat(...t))},__dict__:{trace:e.trace,debug:e.debug,info:e.info,warn:e.warn,error:e.error}};return{event:function(){t.log(arguments,"event")},trace:function(){t.log(arguments,"trace")},debug:function(){t.log(arguments,"debug")},info:function(){t.log(arguments,"info")},warn:function(){t.log(arguments,"warn")},error:function(){t.log(arguments,"error")},log:function(){t.log(arguments,void 0)},backend:function(){t.log(arguments,"backend")},logs:function(e){[e].flat().forEach((e=>e&&t.log([e].flat(),"backend")))}}}(console);const hr=Mt.createStore([Gt,Qt,Yt,ir],[]);void 0===s?(window.salla=window.salla||window.Salla||{},window.Salla=window.salla):(s.salla=s.salla||s.Salla||{},s.Salla=s.salla),Salla.config=new class{default_properties={};constructor(e={},t={}){this.default_properties=t,this.properties_={...this.default_properties,...e}}merge(e){return Object.assign(this.properties_,e),this.properties_.store={...this.default_properties.store,...this.properties_.store},this}set(e,t){return e.includes(".")?(Salla.helpers.setNested(this.properties_,e,t),this):(this.properties_[e]=t,this)}get(e,t=null){return e.includes(".")?Salla.helpers.getNested(this.properties_,e,t):this.properties_.hasOwnProperty(e)?this.properties_[e]||t:t||void 0}all(){return this.properties_}},Salla.logger=dr,Salla.event=new class extends Et{constructor(){super({wildcard:!0,delimiter:"::",newListener:!1,removeListener:!1,maxListeners:10,verboseMemoryLeak:!1,ignoreErrors:!1}),this.delimiter="::","undefined"!=typeof document&&(this.body=document.querySelector("body")),this.logableEvents=["cart::item.added.failed","cart::item.deleted.failed"],this.ingoreLogEvents=["document::click","document::keyup","document::change"],this.noneFireableActions=["document.request"]}createAndDispatch(e,...t){this.dispatch(e,...t)}emit(e,...t){let r=e.replace("::",".");if(!this.noneFireableActions.includes(r)&&void 0!==Salla.call&&"function"==typeof Salla.call(r))return Salla.log(`'Salla.${r}(...)' triggered using event '${e}'`),r=r.split("."),void salla[r[0]][r[1]](...t);super.emit(e,...t),"undefined"!=typeof window&&(window.dataLayer=window.dataLayer||[],window.dataLayer.push(Object.assign({event:e},...t.values()))),!this.ingoreLogEvents.includes(e)&&(void 0!==Salla.config&&Salla.config.get("debug")||this.logableEvents.includes(e))&&void 0!==Salla.logger&&Salla.logger.event(e,...t),this.dispatchMobileEvent(e,{...t.values()})}dispatch(e,...t){return this.emit(e,...t)}dispatchEvents(e){if(e&&"object"==typeof e)for(const[t,r]of Object.entries(e))this.dispatch(t,r);else Salla.log("No Events To Dispatch!",e)}addListener(e,t){return this.on(e,t)}addEventListener(e,t){return this.on(e,t)}listen(e,t){return this.on(e,t)}registerGlobalListener(e,t){return this.onAny(t)}dispatchMobileEvent(e,t={}){if(!("undefined"!=typeof window&&window.dataLayer&&dataLayer[0]&&dataLayer[0].page&&dataLayer[0].page.mobileApp))return"";if(window.webkit)try{window.webkit.messageHandlers.callbackHandler.postMessage(JSON.stringify({event:e,details:t}))}catch(e){Salla.log(e,"The native context does not exist yet")}else if(Android)try{Android.customEventWithData(e,JSON.stringify({details:t}))}catch(e){Salla.log(e,"The native context does not exist yet")}}},Salla.storage=new class{constructor(){Salla.event.on("storage::item.remove",(e=>this.remove(e))),Salla.event.on("storage::item.set",((e,t)=>this.set(e,t))),this.store=hr}set(e,t){if(e.includes(".")){let r=e.split(".")[0],n={[r]:this.store.get(r)};return n=Salla.helpers.setNested(n,e,t),this.store.set(r,n[r])}return this.store.set(e,t)}remove(e){return this.store.remove(e)}get(e,t){if(e.includes(".")){let t=e.split(".")[0];return Salla.helpers.getNested({[t]:this.store.get(t)},e)}return this.store.get(e,t)}},Salla.cookie=new class{constructor(){Salla.event.on("cookies::remove",(e=>this.remove(e))),Salla.event.on("cookies::add",((e,t)=>this.set(e,t)))}get(e){return document.cookie.split("; ").find((t=>t.startsWith(e+"=")))?.split("=")[1]}set(e,t="",r=10){let n="";if(r){let e=new Date;e.setTime(e.getTime()+24*r*60*60*1e3),n="; expires="+e.toUTCString()}return document.cookie=`${e}=${t}${n}"; path=/; secure; SameSite=Lax"`,this}remove(e){return document.cookie=`${e}=; Max-Age=0; path=/;`,this}},Salla.helpers=ur,Salla.log=Salla.logger.log,Salla.money=Salla.helpers.money,Salla.url=Salla.helpers.url;var fr=Salla;let pr=function(e,t,r){return alert(e)},gr=function(e,t){return pr(e,mr.error,t)},mr={error:"error",success:"success",info:"info"};var vr={fire:function(e,t,r){return pr(e,t,r)},setNotifier:function(e){pr=e},error:gr,success:function(e,t){return pr(e,mr.success,t)},info:function(e,t){return pr(e,mr.info,t)},sallaInitiated:function(){let e=window.location.href.match(/([\?\&]danger=)[^&]+/g);e&&e.forEach((e=>{gr(decodeURI(e.replace("?danger=","").replace("&danger=","")))}))},types:mr};class yr{constructor(e,t){return this.api=e,this.event=t,new Proxy(this,{get:function(r,n){return"event"===n?t:"api"===n?e:e&&e[n]||r[n]}})}}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:"#"+this},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)},Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){for(var t=this;t;){if(t.matches(e))return t;t=t.parentElement}}),Element.prototype.getElementSallaData=function(e,...t){if(!this.getAttribute)return;if(this.hasAttribute("data-json"))try{return JSON.parse(this.getAttribute("data-json"))}catch(e){}let r=this.getAttribute("data-function");if(r&&window[r])return"function"==typeof window[r]?this.getFilteredData(window[r].call(this,...t)):this.getFilteredData(window[r]);let n=this.hasAttribute("data-form-selector")?document.querySelector(this.dataset.formSelector):void 0;if(n="FORM"===this.tagName?this:n||this.closest("form")||this.closest("[salla-form-data]")||this,n&&"FORM"===n.tagName)return this.getFilteredData(new FormData(n),null,n);let i=n.querySelectorAll("[name]");if(!i.length)return this.getFilteredData();let s=Object.assign({},this.dataset);return i.forEach((e=>{if(!["checkbox","radio"].includes(e.type)||e.checked)try{let t=Salla.helpers.inputData(e.name,e.value,s);s[t.name]=t.value}catch(t){Salla.log(e.name+" can't be send")}})),this.getFilteredData(s)},Element.prototype.canEventFireHook=function(e){return!!this.hasAttribute&&this.hasAttribute(Salla.api.hooksPrefix+e.type)},Element.prototype.hasAttributeStartsWith=function(e,t){e=e.toLowerCase();for(var r=0;r<this.attributes.length;r++){let n=this.attributes[r].name.toLowerCase();if(0===n.indexOf(e))return!t||n}return!1},HTMLFormElement.prototype.getAjaxFormData=function(e){var t=this.querySelectorAll('input[type="file"]');t.forEach((e=>{e.files.length||e.setAttribute("disabled","")}));var r=new FormData(this);return t.forEach((e=>{e.files.length||e.removeAttribute("disabled")})),{formData:this.getFilteredData(r,e),url:this.getAttribute("action"),method:this.getAttribute("method")||"post",events:{success:this.dataset.onSuccess,fail:this.dataset.onFail}}},Element.prototype.getFilteredData=function(e=null,t=null,r=null){return e=e||r?.dataset||this.dataset,r&&this.name&&void 0!==this.value&&(e=function(e,t,r){e instanceof FormData?e.append(t,r):e[t]=r;return e}(e,this.name,this.value)),["filterBeforeSubmit","filterBeforeSend"].forEach((n=>{let i=r?.dataset[n]||this.dataset[n];if(i){var s=window[i];if("function"==typeof s){if(!s(e,r||this,t)&&e)throw`Data failed to be pass verify function window.${i}(formData, element, event)!`;return s(e,r||this,t)}Salla.log("window."+i+"() not found!")}})),e},HTMLAnchorElement.prototype.getAjaxFormData=function(e){return{formData:this.getFilteredData(null,e),url:this.getAttribute("href"),method:this.dataset.type||"get",events:{success:this.dataset.onSuccess,fail:this.dataset.onFail}}};class br{constructor(){this.events={},this.namespace="";let e=/function (.{1,})\(/.exec(this.constructor.toString());this.className=(e&&e.length>1?e[1]:"").toLowerCase()}after_init(){this.createDynamicFunctions()}createDynamicFunctions(){Object.keys(this.events).forEach((e=>{this.createDynamicEventFuns(e),this.createDynamicListenerFuns(e)}))}createDynamicEventFuns(e){if(this[e])return;let t=this;this[e]=function(...r){return t.dispatch(e,...r)}}createDynamicListenerFuns(e){let t="on"+e.charAt(0).toUpperCase()+e.slice(1);if(this[t])return;let r=this;this[t]=function(t){return r.on(e,t)}}getEventName(e){return e=this.events[e]||e,!this.namespace||e.includes("::")?e:this.namespace+Salla.event.delimiter+e}dispatch(e,...t){return Salla.event.dispatch(this.getEventName(e),...t)}on(e,t){return Salla.event.addListener(this.getEventName(e),t)}once(e,t){return Salla.event.once(this.getEventName(e),t)}}function wr(e){e&&e.sallaInitiated&&!e.initiated&&(e.sallaInitiated(),e.initiated=!0)}Salla.event.auth=new class extends br{constructor(){super(),this.namespace="auth",this.events={login:"login",logout:"logout",codeSent:"code.sent",codeNotSent:"code.not-sent",verified:"verified",verificationFailed:"verification.failed",loggedIn:"logged.in",registered:"registered",registrationFailed:"registration.failed",loggedOut:"logged.out",failedLogout:"failed.logout",refreshFailed:"refresh.failed"},this.after_init()}login(e){return e?(e.type&&this.setTypeActionOnVerified(e.type),this.next_event=e.next_event||null,this.dispatch("login",...arguments)):(this.next_event=null,this.dispatch("login",...arguments))}loggedIn(e){Salla.profile.info().then((e=>{salla.config.set("user",{id:e.data.id,type:"user",email:e.data.email,mobile:e.data.phone.code+e.data.phone.number,country_code:e.data.phone.country,language_code:e.data.language,currency_code:e.data.currency})})).finally((()=>this.dispatch("loggedIn",e)))}setTypeActionOnVerified(e){this.type_action_on_verified=e}getTypeActionOnVerified(){return this.type_action_on_verified||"redirect"}},Salla.event.cart=new class extends br{constructor(){super(),this.namespace="cart",this.events={latestFetched:"latest.fetched",latestFailed:"latest.failed",updated:"updated",itemUpdated:"item.updated",itemUpdatedFailed:"item.updated.failed",itemAdded:"item.added",itemAddedFailed:"item.added.failed",itemDeleted:"item.deleted",itemDeletedFailed:"item.deleted.failed",submitted:"submitted",submitFailed:"submit.failed",imageDeleted:"image.deleted",imageNotDeleted:"image.not.deleted",detailsFetched:"details.fetched",detailsNotFetched:"details.not.fetched",successReset:"success.reset",couponAdded:"coupon.added",couponDeleted:"coupon.deleted",couponAdditionFailed:"coupon.addition.failed",couponDeletionFailed:"coupon.deletion.failed"},this.after_init()}updated(e){return Salla.cookie.set("fresh_summary",1),e&&"object"==typeof e?(e.offer&&salla.product.event.offerExisted(e.offer),salla.storage.set("cart.summary",{total:e.cart.total,sub_total:e.cart.sub_total,discount:e.cart.discount,real_shipping_cost:e.cart.real_shipping_cost,count:e.cart.count,shipping_cost:e.cart.free_shipping_bar?.has_free_shipping?0:e.cart.real_shipping_cost}),this.dispatch("updated",e.cart)):(Salla.logger.info("Cart summary not an object!",e),this.dispatch("updated"))}latestFetched(e){return this.updated(e.data),this.dispatch("latestFetched",e)}itemAdded(e,t){return this.updated(e.data),this.dispatch("itemAdded",e,t)}itemDeleted(e,t){return this.updated(e.data),this.dispatch("itemDeleted",e,t)}itemUpdated(e,t){return this.updated(e.data),this.dispatch("itemUpdated",e,t)}couponAdded(e,t){return this.updated(e.data),this.dispatch("couponAdded",e,t)}couponDeleted(e,t){return this.updated(e.data),this.dispatch("couponDeleted",e,t)}},Salla.event.order=new class extends br{constructor(){super(),this.namespace="order",this.events={canceled:"canceled",notCanceled:"not.canceled",orderCreated:"order.created",orderCreationFailed:"order.creation.failed",invoiceSent:"invoice.sent",invoiceNotSent:"invoice.not.sent"},this.after_init()}},Salla.event.scope=new class extends br{constructor(){super(),this.namespace="scope",this.events={fetched:"fetched",notFetched:"not.fetched",productAvailabilityFetched:"product-availability.fetched",productAvailabilityNotFetched:"product-availability.not.fetched",changeSucceeded:"changed",changeFailed:"not.changed"},this.after_init()}},Salla.event.rating=new class extends br{constructor(){super(),this.namespace="rating",this.events={orderNotFetched:"order.not.fetched",orderFetched:"order.fetched",storeRated:"store.rated",storeFailed:"store.failed",productsRated:"products.rated",productsFailed:"products.failed",shippingRated:"shipping.rated",shippingFailed:"shipping.failed"},this.after_init()}},Salla.event.comment=new class extends br{constructor(){super(),this.namespace="comment",this.events={added:"added",additionFailed:"addition.failed"},this.after_init()}},Salla.event.loyalty=new class extends br{constructor(){super(),this.namespace="loyalty",this.events={exchangeSucceeded:"exchange.succeeded",exchangeFailed:"exchange.failed",programFetched:"program.fetched",programNotFetched:"program.not.fetched",resetSucceeded:"exchange-reset.succeeded",resetFailed:"exchange-reset.failed"},this.after_init()}},Salla.event.product=new class extends br{constructor(){super(),this.namespace="product",this.events={priceUpdated:"price.updated",priceUpdateFailed:"price.updated.failed",availabilitySubscribed:"availability.subscribed",availabilitySubscribeFailed:"availability.subscribe.failed",categoriesFetched:"categories.fetched",categoriesFailed:"categories.failed",searchFailed:"search.failed",searchResults:"search.results",offerExisted:"offer.existed",fetchOffersFailed:"fetch.offers.failed",offersFetched:"offers.fetched",sizeGuideFetched:"size-guide.fetched",SizeGuideFetchFailed:"size-guide.failed",giftFetched:"gift.fetched",giftFetchFailed:"gift.failed",addGiftToCartSucceeded:"gift.add-to-cart.succeeded",addGiftToCartFailed:"gift.add-to-cart.failed",giftImageUploadSucceeded:"gift.image-upload.succeeded",giftImageUploadFailed:"gift.image-upload.failed"},this.after_init()}},Salla.event.profile=new class extends br{constructor(){super(),this.namespace="profile",this.events={updated:"updated",updateFailed:"update.failed",verificationCodeSent:"verification.code.sent",updateContactsFailed:"update.contacts.failed",verified:"verified",unverified:"unverified",infoFetched:"info.fetched",infoNotFetched:"info.not.fetched"},this.after_init()}},Salla.event.currency=new class extends br{constructor(){super(),this.namespace="currency",this.events={changed:"changed",failed:"failed",fetched:"fetched",failedToFetch:"failed.to.fetch"},this.after_init()}},Salla.event.document=new class extends br{constructor(){super(),this.namespace="document",this.events={click:"click",change:"change",submit:"submit",keyup:"keyup",leaving:"leaving",request:"request",requestFailed:"request.failed"},this.after_init()}onClick(e,t){this.fireCallableFuns("click",e,t)}onChange(e,t){this.fireCallableFuns("change",e,t)}onSubmit(e,t){this.fireCallableFuns("submit",e,t)}onKeyup(e,t){this.fireCallableFuns("keyup",e,t)}fireCallableFuns(e,t,r){this.on(e,(e=>{"function"!=typeof t?"function"==typeof r&&e.target.matches(t)&&r(e):t(e)}))}fireEvent(e,t,...r){return this.fireEventForElements(e,t,!1,...r)}fireEventForAll(e,t,...r){return this.fireEventForElements(e,t,!0,...r)}fireEventForElements(e,t,r,...n){if("string"==typeof e){if(r)return document.querySelectorAll(e).forEach((e=>this.fireEventForElements(e,t,!1,...n)));e=document.querySelector(e)}if(!e)return void salla.log("Failed To get element to fire event: "+t);const i=new CustomEvent(t,...n);return e.dispatchEvent(i)}},Salla.event.wishlist=new class extends br{constructor(){super(),this.namespace="wishlist",this.events={added:"added",removed:"removed",additionFailed:"addition.failed",removingFailed:"removing.failed"},this.after_init()}},Salla.event.infiniteScroll=new class extends br{constructor(){super(),this.namespace="infiniteScroll",this.events={scrollThreshold:"scroll.threshold",request:"request",load:"load",append:"append",error:"error",last:"last",history:"history"},this.after_init()}},Salla.event.on("twilight::initiated",(()=>{Object.keys(Salla).forEach((e=>{"object"==typeof(e=Salla[e])&&(wr(e),Object.keys(e).forEach((t=>{wr(e[t])})))}))})),Salla.config.default_properties={debug:"undefined"!=typeof process&&"development"===process.env.NODE_ENV,token:null,fastRequests:!0,canLeave:!0,store:{api:"https://api.salla.dev/store/v1/"},currencies:{SAR:{code:"SAR",name:"ريال سعودي",symbol:"ر.س",amount:1,country_code:"sa"}}},Salla.config.merge(Salla.config.default_properties),Salla.config.triedToGetCurrencies_=!1,Salla.config.triedToGetLanguages_=!1,Salla.config.isUser=()=>"user"===Salla.config.get("user.type"),Salla.config.isGuest=()=>!Salla.config.isUser(),Salla.config.languages=async()=>{if(Salla.config.triedToGetLanguages_)return Salla.config.get("languages");Salla.config.triedToGetLanguages_=!0;let e=!0,t=[];return(await salla.document.api.request("languages",null,"get"))?.data?.map((r=>{e&&(t=[],e=!1),r.code=r.code||r.iso_code,r.url=salla.url.get(r.code),r.is_rtl=r.is_rtl||r.rtl,t.push(r)})),Salla.config.set("languages",t),t},Salla.config.currencies=async()=>{if(Salla.config.triedToGetCurrencies_)return Salla.config.get("currencies");Salla.config.triedToGetCurrencies_=!0;let e=!0,t={};return(await salla.currency.api.list())?.data?.map((r=>{e&&(t={},e=!1),r.country_code=r.code.substr(0,2).toLowerCase(),t[r.code]=r})),Salla.config.set("currencies",t),t},Salla.config.currency=e=>(e=e||Salla.config.get("user.currency_code"),Salla.config.get("currencies."+e)||Object.values(Salla.config.get("currencies"))[0]);var _r,Sr={exports:{}},Er={exports:{}},xr={exports:{}};function Ar(){return _r||(_r=1,function(e){!function(t,r){e.exports?e.exports=r():t.EvEmitter=r()}("undefined"!=typeof window?window:a,(function(){function e(){}let t=e.prototype;return t.on=function(e,t){if(!e||!t)return this;let r=this._events=this._events||{},n=r[e]=r[e]||[];return n.includes(t)||n.push(t),this},t.once=function(e,t){if(!e||!t)return this;this.on(e,t);let r=this._onceEvents=this._onceEvents||{};return(r[e]=r[e]||{})[t]=!0,this},t.off=function(e,t){let r=this._events&&this._events[e];if(!r||!r.length)return this;let n=r.indexOf(t);return-1!=n&&r.splice(n,1),this},t.emitEvent=function(e,t){let r=this._events&&this._events[e];if(!r||!r.length)return this;r=r.slice(0),t=t||[];let n=this._onceEvents&&this._onceEvents[e];for(let i of r){n&&n[i]&&(this.off(e,i),delete n[i]),i.apply(this,t)}return this},t.allOff=function(){return delete this._events,delete this._onceEvents,this},e}))}(xr)),xr.exports}var Pr,Fr,Lr={exports:{}};function Or(){return Pr||(Pr=1,function(e){!function(t,r){e.exports?e.exports=r(t):t.fizzyUIUtils=r(t)}(a,(function(e){let t={extend:function(e,t){return Object.assign(e,t)},modulo:function(e,t){return(e%t+t)%t},makeArray:function(e){if(Array.isArray(e))return e;if(null==e)return[];return"object"==typeof e&&"number"==typeof e.length?[...e]:[e]},removeFrom:function(e,t){let r=e.indexOf(t);-1!=r&&e.splice(r,1)},getParent:function(e,t){for(;e.parentNode&&e!=document.body;)if((e=e.parentNode).matches(t))return e},getQueryElement:function(e){return"string"==typeof e?document.querySelector(e):e},handleEvent:function(e){let t="on"+e.type;this[t]&&this[t](e)},filterFindElements:function(e,r){return(e=t.makeArray(e)).filter((e=>e instanceof HTMLElement)).reduce(((e,t)=>{if(!r)return e.push(t),e;t.matches(r)&&e.push(t);let n=t.querySelectorAll(r);return e=e.concat(...n)}),[])},debounceMethod:function(e,t,r){r=r||100;let n=e.prototype[t],i=t+"Timeout";e.prototype[t]=function(){clearTimeout(this[i]);let e=arguments;this[i]=setTimeout((()=>{n.apply(this,e),delete this[i]}),r)}},docReady:function(e){let t=document.readyState;"complete"==t||"interactive"==t?setTimeout(e):document.addEventListener("DOMContentLoaded",e)},toDashed:function(e){return e.replace(/(.)([A-Z])/g,(function(e,t,r){return t+"-"+r})).toLowerCase()}},r=e.console;return t.htmlInit=function(n,i){t.docReady((function(){let s="data-"+t.toDashed(i),a=document.querySelectorAll(`[${s}]`),o=e.jQuery;[...a].forEach((e=>{let t,a=e.getAttribute(s);try{t=a&&JSON.parse(a)}catch(t){return void(r&&r.error(`Error parsing ${s} on ${e.className}: ${t}`))}let l=new n(e,t);o&&o.data(e,i,l)}))}))},t}))}(Lr)),Lr.exports}function Tr(){return Fr||(Fr=1,function(e){!function(t,r){e.exports?e.exports=r(t,Ar(),Or()):t.InfiniteScroll=r(t,t.EvEmitter,t.fizzyUIUtils)}(window,(function(e,t,r){let n=e.jQuery,i={};function s(e,t){let a=r.getQueryElement(e);if(a){if((e=a).infiniteScrollGUID){let r=i[e.infiniteScrollGUID];return r.option(t),r}this.element=e,this.options={...s.defaults},this.option(t),n&&(this.$element=n(this.element)),this.create()}else console.error("Bad element for InfiniteScroll: "+(a||e))}s.defaults={},s.create={},s.destroy={};let a=s.prototype;Object.assign(a,t.prototype);let o=0;a.create=function(){let e=this.guid=++o;if(this.element.infiniteScrollGUID=e,i[e]=this,this.pageIndex=1,this.loadCount=0,this.updateGetPath(),this.getPath&&this.getPath()){this.updateGetAbsolutePath(),this.log("initialized",[this.element.className]),this.callOnInit();for(let e in s.create)s.create[e].call(this)}else console.error("Disabling InfiniteScroll")},a.option=function(e){Object.assign(this.options,e)},a.callOnInit=function(){let e=this.options.onInit;e&&e.call(this,this)},a.dispatchEvent=function(e,t,r){this.log(e,r);let i=t?[t].concat(r):r;if(this.emitEvent(e,i),!n||!this.$element)return;let s=e+=".infiniteScroll";if(t){let r=n.Event(t);r.type=e,s=r}this.$element.trigger(s,r)};let l={initialized:e=>`on ${e}`,request:e=>`URL: ${e}`,load:(e,t)=>`${e.title||""}. URL: ${t}`,error:(e,t)=>`${e}. URL: ${t}`,append:(e,t,r)=>`${r.length} items. URL: ${t}`,last:(e,t)=>`URL: ${t}`,history:(e,t)=>`URL: ${t}`,pageIndex:function(e,t){return`current page determined to be: ${e} from ${t}`}};a.log=function(e,t){if(!this.options.debug)return;let r=`[InfiniteScroll] ${e}`,n=l[e];n&&(r+=". "+n.apply(this,t)),console.log(r)},a.updateMeasurements=function(){this.windowHeight=e.innerHeight;let t=this.element.getBoundingClientRect();this.top=t.top+e.scrollY},a.updateScroller=function(){let t=this.options.elementScroll;if(t){if(this.scroller=!0===t?this.element:r.getQueryElement(t),!this.scroller)throw new Error(`Unable to find elementScroll: ${t}`)}else this.scroller=e},a.updateGetPath=function(){let e=this.options.path;if(!e)return void console.error(`InfiniteScroll path option required. Set as: ${e}`);let t=typeof e;"function"!=t?"string"==t&&e.match("{{#}}")?this.updateGetPathTemplate(e):this.updateGetPathSelector(e):this.getPath=e},a.updateGetPathTemplate=function(e){this.getPath=()=>{let t=this.pageIndex+1;return e.replace("{{#}}",t)};let t=e.replace(/(\\\?|\?)/,"\\?").replace("{{#}}","(\\d\\d?\\d?)"),r=new RegExp(t),n=location.href.match(r);n&&(this.pageIndex=parseInt(n[1],10),this.log("pageIndex",[this.pageIndex,"template string"]))};let c=[/^(.*?\/?page\/?)(\d\d?\d?)(.*?$)/,/^(.*?\/?\?page=)(\d\d?\d?)(.*?$)/,/(.*?)(\d\d?\d?)(?!.*\d)(.*?$)/],u=s.getPathParts=function(e){if(e)for(let t of c){let r=e.match(t);if(r){let[,e,t,n]=r;return{begin:e,index:t,end:n}}}};a.updateGetPathSelector=function(e){let t=document.querySelector(e);if(!t)return void console.error(`Bad InfiniteScroll path option. Next link not found: ${e}`);let r=t.getAttribute("href"),n=u(r);if(!n)return void console.error(`InfiniteScroll unable to parse next link href: ${r}`);let{begin:i,index:s,end:a}=n;this.isPathSelector=!0,this.getPath=()=>i+(this.pageIndex+1)+a,this.pageIndex=parseInt(s,10)-1,this.log("pageIndex",[this.pageIndex,"next link"])},a.updateGetAbsolutePath=function(){let e=this.getPath();if(e.match(/^http/)||e.match(/^\//))return void(this.getAbsolutePath=this.getPath);let{pathname:t}=location,r=e.match(/^\?/),n=t.substring(0,t.lastIndexOf("/")),i=r?t:n+"/";this.getAbsolutePath=()=>i+this.getPath()},s.create.hideNav=function(){let e=r.getQueryElement(this.options.hideNav);e&&(e.style.display="none",this.nav=e)},s.destroy.hideNav=function(){this.nav&&(this.nav.style.display="")},a.destroy=function(){this.allOff();for(let e in s.destroy)s.destroy[e].call(this);delete this.element.infiniteScrollGUID,delete i[this.guid],n&&this.$element&&n.removeData(this.element,"infiniteScroll")},s.throttle=function(e,t){let r,n;return t=t||200,function(){let i=+new Date,s=arguments,a=()=>{r=i,e.apply(this,s)};r&&i<r+t?(clearTimeout(n),n=setTimeout(a,t)):a()}},s.data=function(e){let t=(e=r.getQueryElement(e))&&e.infiniteScrollGUID;return t&&i[t]},s.setJQuery=function(e){n=e},r.htmlInit(s,"infinite-scroll"),a._init=function(){};let{jQueryBridget:d}=e;return n&&d&&d("infiniteScroll",s,n),s}))}(Er)),Er.exports}var kr,jr={exports:{}};function Cr(){return kr||(kr=1,function(e){!function(t,r){e.exports?e.exports=r(t,Tr()):r(t,t.InfiniteScroll)}(window,(function(e,t){let r=t.prototype;Object.assign(t.defaults,{loadOnScroll:!0,checkLastPage:!0,responseBody:"text",domParseResponse:!0}),t.create.pageLoad=function(){this.canLoad=!0,this.on("scrollThreshold",this.onScrollThresholdLoad),this.on("load",this.checkLastPage),this.options.outlayer&&this.on("append",this.onAppendOutlayer)},r.onScrollThresholdLoad=function(){this.options.loadOnScroll&&this.loadNextPage()};let n=new DOMParser;function i(e){let t=document.createDocumentFragment();return e&&t.append(...e),t}return r.loadNextPage=function(){if(this.isLoading||!this.canLoad)return;let{responseBody:e,domParseResponse:t,fetchOptions:r}=this.options,i=this.getAbsolutePath();this.isLoading=!0,"function"==typeof r&&(r=r());let s=fetch(i,r).then((r=>{if(!r.ok){let e=new Error(r.statusText);return this.onPageError(e,i,r),{response:r}}return r[e]().then((s=>("text"==e&&t&&(s=n.parseFromString(s,"text/html")),204==r.status?(this.lastPageReached(s,i),{body:s,response:r}):this.onPageLoad(s,i,r))))})).catch((e=>{this.onPageError(e,i)}));return this.dispatchEvent("request",null,[i,s]),s},r.onPageLoad=function(e,t,r){return this.options.append||(this.isLoading=!1),this.pageIndex++,this.loadCount++,this.dispatchEvent("load",null,[e,t,r]),this.appendNextPage(e,t,r)},r.appendNextPage=function(e,t,r){let{append:n,responseBody:s,domParseResponse:a}=this.options;if(!("text"==s&&a)||!n)return{body:e,response:r};let o=e.querySelectorAll(n),l={body:e,response:r,items:o};if(!o||!o.length)return this.lastPageReached(e,t),l;let c=i(o),u=()=>(this.appendItems(o,c),this.isLoading=!1,this.dispatchEvent("append",null,[e,t,o,r]),l);return this.options.outlayer?this.appendOutlayerItems(c,u):u()},r.appendItems=function(e,t){e&&e.length&&(function(e){let t=e.querySelectorAll("script");for(let e of t){let t=document.createElement("script"),r=e.attributes;for(let e of r)t.setAttribute(e.name,e.value);t.innerHTML=e.innerHTML,e.parentNode.replaceChild(t,e)}}(t=t||i(e)),this.element.appendChild(t))},r.appendOutlayerItems=function(r,n){let i=t.imagesLoaded||e.imagesLoaded;return i?new Promise((function(e){i(r,(function(){let t=n();e(t)}))})):(console.error("[InfiniteScroll] imagesLoaded required for outlayer option"),void(this.isLoading=!1))},r.onAppendOutlayer=function(e,t,r){this.options.outlayer.appended(r)},r.checkLastPage=function(e,t){let r,{checkLastPage:n,path:i}=this.options;if(n){if("function"==typeof i){if(!this.getPath())return void this.lastPageReached(e,t)}"string"==typeof n?r=n:this.isPathSelector&&(r=i),r&&e.querySelector&&(e.querySelector(r)||this.lastPageReached(e,t))}},r.lastPageReached=function(e,t){this.canLoad=!1,this.dispatchEvent("last",null,[e,t])},r.onPageError=function(e,t,r){return this.isLoading=!1,this.canLoad=!1,this.dispatchEvent("error",null,[e,t,r]),e},t.create.prefill=function(){if(!this.options.prefill)return;let e=this.options.append;e?(this.updateMeasurements(),this.updateScroller(),this.isPrefilling=!0,this.on("append",this.prefill),this.once("error",this.stopPrefill),this.once("last",this.stopPrefill),this.prefill()):console.error(`append option required for prefill. Set as :${e}`)},r.prefill=function(){let e=this.getPrefillDistance();this.isPrefilling=e>=0,this.isPrefilling?(this.log("prefill"),this.loadNextPage()):this.stopPrefill()},r.getPrefillDistance=function(){return this.options.elementScroll?this.scroller.clientHeight-this.scroller.scrollHeight:this.windowHeight-this.element.clientHeight},r.stopPrefill=function(){this.log("stopPrefill"),this.off("append",this.prefill)},t}))}(jr)),jr.exports}var Rr,Ir={exports:{}};function qr(){return Rr||(Rr=1,function(e){!function(t,r){e.exports?e.exports=r(t,Tr(),Or()):r(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,(function(e,t,r){let n=t.prototype;return Object.assign(t.defaults,{scrollThreshold:400}),t.create.scrollWatch=function(){this.pageScrollHandler=this.onPageScroll.bind(this),this.resizeHandler=this.onResize.bind(this);let e=this.options.scrollThreshold;(e||0===e)&&this.enableScrollWatch()},t.destroy.scrollWatch=function(){this.disableScrollWatch()},n.enableScrollWatch=function(){this.isScrollWatching||(this.isScrollWatching=!0,this.updateMeasurements(),this.updateScroller(),this.on("last",this.disableScrollWatch),this.bindScrollWatchEvents(!0))},n.disableScrollWatch=function(){this.isScrollWatching&&(this.bindScrollWatchEvents(!1),delete this.isScrollWatching)},n.bindScrollWatchEvents=function(t){let r=t?"addEventListener":"removeEventListener";this.scroller[r]("scroll",this.pageScrollHandler),e[r]("resize",this.resizeHandler)},n.onPageScroll=t.throttle((function(){this.getBottomDistance()<=this.options.scrollThreshold&&this.dispatchEvent("scrollThreshold")})),n.getBottomDistance=function(){let t,r;return this.options.elementScroll?(t=this.scroller.scrollHeight,r=this.scroller.scrollTop+this.scroller.clientHeight):(t=this.top+this.element.clientHeight,r=e.scrollY+this.windowHeight),t-r},n.onResize=function(){this.updateMeasurements()},r.debounceMethod(t,"onResize",150),t}))}(Ir)),Ir.exports}var Nr,Dr={exports:{}};function Ur(){return Nr||(Nr=1,function(e){!function(t,r){e.exports?e.exports=r(t,Tr(),Or()):r(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,(function(e,t,r){let n=t.prototype;Object.assign(t.defaults,{history:"replace"});let i=document.createElement("a");return t.create.history=function(){if(!this.options.history)return;i.href=this.getAbsolutePath(),(i.origin||i.protocol+"//"+i.host)==location.origin?this.options.append?this.createHistoryAppend():this.createHistoryPageLoad():console.error(`[InfiniteScroll] cannot set history with different origin: ${i.origin} on ${location.origin} . History behavior disabled.`)},n.createHistoryAppend=function(){this.updateMeasurements(),this.updateScroller(),this.scrollPages=[{top:0,path:location.href,title:document.title}],this.scrollPage=this.scrollPages[0],this.scrollHistoryHandler=this.onScrollHistory.bind(this),this.unloadHandler=this.onUnload.bind(this),this.scroller.addEventListener("scroll",this.scrollHistoryHandler),this.on("append",this.onAppendHistory),this.bindHistoryAppendEvents(!0)},n.bindHistoryAppendEvents=function(t){let r=t?"addEventListener":"removeEventListener";this.scroller[r]("scroll",this.scrollHistoryHandler),e[r]("unload",this.unloadHandler)},n.createHistoryPageLoad=function(){this.on("load",this.onPageLoadHistory)},t.destroy.history=n.destroyHistory=function(){this.options.history&&this.options.append&&this.bindHistoryAppendEvents(!1)},n.onAppendHistory=function(e,t,r){if(!r||!r.length)return;let n=r[0],s=this.getElementScrollY(n);i.href=t,this.scrollPages.push({top:s,path:i.href,title:e.title})},n.getElementScrollY=function(t){if(this.options.elementScroll)return t.offsetTop-this.top;return t.getBoundingClientRect().top+e.scrollY},n.onScrollHistory=function(){let e=this.getClosestScrollPage();e!=this.scrollPage&&(this.scrollPage=e,this.setHistory(e.title,e.path))},r.debounceMethod(t,"onScrollHistory",150),n.getClosestScrollPage=function(){let t,r;t=this.options.elementScroll?this.scroller.scrollTop+this.scroller.clientHeight/2:e.scrollY+this.windowHeight/2;for(let e of this.scrollPages){if(e.top>=t)break;r=e}return r},n.setHistory=function(e,t){let r=this.options.history;r&&history[r+"State"]&&(history[r+"State"](null,e,t),this.options.historyTitle&&(document.title=e),this.dispatchEvent("history",null,[e,t]))},n.onUnload=function(){if(0===this.scrollPage.top)return;let t=e.scrollY-this.scrollPage.top+this.top;this.destroyHistory(),scrollTo(0,t)},n.onPageLoadHistory=function(e,t){this.setHistory(e.title,t)},t}))}(Dr)),Dr.exports}var $r,Mr={exports:{}};function Hr(){return $r||($r=1,function(e){!function(t,r){e.exports?e.exports=r(t,Tr(),Or()):r(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,(function(e,t,r){class n{constructor(e,t){this.element=e,this.infScroll=t,this.clickHandler=this.onClick.bind(this),this.element.addEventListener("click",this.clickHandler),t.on("request",this.disable.bind(this)),t.on("load",this.enable.bind(this)),t.on("error",this.hide.bind(this)),t.on("last",this.hide.bind(this))}onClick(e){e.preventDefault(),this.infScroll.loadNextPage()}enable(){this.element.removeAttribute("disabled")}disable(){this.element.disabled="disabled"}hide(){this.element.style.display="none"}destroy(){this.element.removeEventListener("click",this.clickHandler)}}return t.create.button=function(){let e=r.getQueryElement(this.options.button);e&&(this.button=new n(e,this))},t.destroy.button=function(){this.button&&this.button.destroy()},t.Button=n,t}))}(Mr)),Mr.exports}var zr,Br={exports:{}};function Gr(){return zr||(zr=1,function(e){!function(t,r){e.exports?e.exports=r(t,Tr(),Or()):r(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,(function(e,t,r){let n=t.prototype;function i(e){a(e,"none")}function s(e){a(e,"block")}function a(e,t){e&&(e.style.display=t)}return t.create.status=function(){let e=r.getQueryElement(this.options.status);e&&(this.statusElement=e,this.statusEventElements={request:e.querySelector(".infinite-scroll-request"),error:e.querySelector(".infinite-scroll-error"),last:e.querySelector(".infinite-scroll-last")},this.on("request",this.showRequestStatus),this.on("error",this.showErrorStatus),this.on("last",this.showLastStatus),this.bindHideStatus("on"))},n.bindHideStatus=function(e){let t=this.options.append?"append":"load";this[e](t,this.hideAllStatus)},n.showRequestStatus=function(){this.showStatus("request")},n.showErrorStatus=function(){this.showStatus("error")},n.showLastStatus=function(){this.showStatus("last"),this.bindHideStatus("off")},n.showStatus=function(e){s(this.statusElement),this.hideStatusEventElements(),s(this.statusEventElements[e])},n.hideAllStatus=function(){i(this.statusElement),this.hideStatusEventElements()},n.hideStatusEventElements=function(){for(let e in this.statusEventElements){i(this.statusEventElements[e])}},t}))}(Br)),Br.exports}
|
|
2
2
|
/*!
|
|
3
3
|
* Infinite Scroll v4.0.1
|
|
4
4
|
* Automatically add next page
|