@salla.sa/base 2.12.29 → 2.12.30

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.
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("process")):"function"==typeof define&&define.amd?define(["process"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Salla=t(e.process)}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function r(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(e)}var n=t(e);function i(e,t){void 0===t&&(t=!1),e+="";for(var r,n=["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"],i=["0","1","2","3","4","5","6","7","8","9"],o=(t=t||!Salla.config.get("store.settings.arabic_numbers_enabled"))?n:i,s=t?i:n,a=0;a<o.length;a++)r=new RegExp(o[a],"g"),e=e.replace(r,s[a]);return e.replace(t?"٫":".",t?".":"٫")}function o(e){var t=("".concat(e).match(/\./g)||[]).length;return t&&1!==t?o(e.replace(/\.(.+)\./g,".$1")):e}String.prototype.toStudlyCase=function(){return this.trim().replace(/([^a-zA-Z\d].)/g,(function(e){return e.toUpperCase().replace(/[^a-zA-Z\d]/g,"")}))},String.prototype.toDatasetName=function(){return this.startsWith("data-")?this.substr(5).toStudlyCase():this.toStudlyCase()},String.prototype.toSelector=function(){return this.trim().startsWith(".")||this.trim().startsWith("#")?this.toString():"#"+this.toString()},String.prototype.replaceArray=function(e,t){for(var r,n=this,i=0;i<e.length;i++)r=new RegExp(e[i],"g"),n=n.replace(r,t[i]);return n},String.prototype.rtrim=function(e){return void 0===e&&(e="\\s"),this.replace(new RegExp("["+e+"]*$"),"")},String.prototype.ltrim=function(e){return void 0===e&&(e="\\s"),this.replace(new RegExp("^["+e+"]*"),"")},String.prototype.digitsOnly=function(){return Salla.helpers.digitsOnly(this)};var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},a=Array.isArray;function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}var c="object"==l(s)&&s&&s.Object===Object&&s,u="object"==("undefined"==typeof self?"undefined":l(self))&&self&&self.Object===Object&&self,f=c||u||Function("return this")(),p=f.Symbol,h=p,d=Object.prototype,v=d.hasOwnProperty,y=d.toString,g=h?h.toStringTag:void 0;var _=function(e){var t=v.call(e,g),r=e[g];try{e[g]=void 0;var n=!0}catch(e){}var i=y.call(e);return n&&(t?e[g]=r:delete e[g]),i},m=Object.prototype.toString;var b=_,w=function(e){return m.call(e)},S=p?p.toStringTag:void 0;var L=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":S&&S in Object(e)?b(e):w(e)};var j=L,E=function(e){return null!=e&&"object"==l(e)};var x=function(e){return"symbol"==l(e)||E(e)&&"[object Symbol]"==j(e)},O=a,A=x,k=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,T=/^\w*$/;var P=function(e,t){if(O(e))return!1;var r=l(e);return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!A(e))||(T.test(e)||!k.test(e)||null!=t&&e in Object(t))};var F=function(e){var t=l(e);return null!=e&&("object"==t||"function"==t)},N=L,R=F;var z,$=function(e){if(!R(e))return!1;var t=N(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},C=f["__core-js_shared__"],M=(z=/[^.]+$/.exec(C&&C.keys&&C.keys.IE_PROTO||""))?"Symbol(src)_1."+z:"";var I=function(e){return!!M&&M in e},U=Function.prototype.toString;var D=$,W=I,G=F,J=function(e){if(null!=e){try{return U.call(e)}catch(e){}try{return e+""}catch(e){}}return""},q=/^\[object .+?Constructor\]$/,Z=Function.prototype,H=Object.prototype,K=Z.toString,B=H.hasOwnProperty,Q=RegExp("^"+K.call(B).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var V=function(e){return!(!G(e)||W(e))&&(D(e)?Q:q).test(J(e))},X=function(e,t){return null==e?void 0:e[t]};var Y=function(e,t){var r=X(e,t);return V(r)?r:void 0},ee=Y(Object,"create"),te=ee;var re=function(){this.__data__=te?te(null):{},this.size=0};var ne=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ie=ee,oe=Object.prototype.hasOwnProperty;var se=function(e){var t=this.__data__;if(ie){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return oe.call(t,e)?t[e]:void 0},ae=ee,le=Object.prototype.hasOwnProperty;var ce=ee;var ue=re,fe=ne,pe=se,he=function(e){var t=this.__data__;return ae?void 0!==t[e]:le.call(t,e)},de=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};function ve(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])}}ve.prototype.clear=ue,ve.prototype.delete=fe,ve.prototype.get=pe,ve.prototype.has=he,ve.prototype.set=de;var ye=ve;var ge=function(){this.__data__=[],this.size=0};var _e=function(e,t){return e===t||e!=e&&t!=t};var me=function(e,t){for(var r=e.length;r--;)if(_e(e[r][0],t))return r;return-1},be=me,we=Array.prototype.splice;var Se=me;var Le=me;var je=me;var Ee=ge,xe=function(e){var t=this.__data__,r=be(t,e);return!(r<0)&&(r==t.length-1?t.pop():we.call(t,r,1),--this.size,!0)},Oe=function(e){var t=this.__data__,r=Se(t,e);return r<0?void 0:t[r][1]},Ae=function(e){return Le(this.__data__,e)>-1},ke=function(e,t){var r=this.__data__,n=je(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function Te(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])}}Te.prototype.clear=Ee,Te.prototype.delete=xe,Te.prototype.get=Oe,Te.prototype.has=Ae,Te.prototype.set=ke;var Pe=Te,Fe=Y(f,"Map"),Ne=ye,Re=Pe,ze=Fe;var $e=function(e){var t=l(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Ce=function(e,t){var r=e.__data__;return $e(t)?r["string"==typeof t?"string":"hash"]:r.map},Me=Ce;var Ie=Ce;var Ue=Ce;var De=Ce;var We=function(){this.size=0,this.__data__={hash:new Ne,map:new(ze||Re),string:new Ne}},Ge=function(e){var t=Me(this,e).delete(e);return this.size-=t?1:0,t},Je=function(e){return Ie(this,e).get(e)},qe=function(e){return Ue(this,e).has(e)},Ze=function(e,t){var r=De(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function He(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])}}He.prototype.clear=We,He.prototype.delete=Ge,He.prototype.get=Je,He.prototype.has=qe,He.prototype.set=Ze;var Ke=He;function Be(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function r(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(Be.Cache||Ke),r}Be.Cache=Ke;var Qe=Be;var Ve=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Xe=/\\(\\)?/g,Ye=function(e){var t=Qe(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Ve,(function(e,r,n,i){t.push(n?i.replace(Xe,"$1"):r||e)})),t})),et=Ye;var tt=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},rt=a,nt=x,it=p?p.prototype:void 0,ot=it?it.toString:void 0;var st=function e(t){if("string"==typeof t)return t;if(rt(t))return tt(t,e)+"";if(nt(t))return ot?ot.call(t):"";var r=t+"";return"0"==r&&1/t==-Infinity?"-0":r},at=st;var lt=a,ct=P,ut=et,ft=function(e){return null==e?"":at(e)};var pt=x;var ht=function(e,t){return lt(e)?e:ct(e,t)?[e]:ut(ft(e))},dt=function(e){if("string"==typeof e||pt(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var vt=function(e,t){for(var r=0,n=(t=ht(t,e)).length;null!=e&&r<n;)e=e[dt(t[r++])];return r&&r==n?e:void 0};var yt=function(e,t,r){var n=null==e?void 0:vt(e,t);return void 0===n?r:n};function gt(e){return"".concat(e).startsWith("https://")||"".concat(e).startsWith("http://")}function _t(e){if(gt(e))return e;var t=Salla.config.get("store.url");return t||(t=window.location.href.split("/").slice(0,-1).join("/"),Salla.config.set("store.url",t)),t.rtrim("/")+"/"+(null==e?void 0:e.ltrim("/"))}function mt(e,t,r){if(r=r||window.location.href,!t||!e)return r;var n=new RegExp("([?&])"+e+"=[^&]+[&]?","g");return(r=r.replace(n,"$1").split("#")[0].replace(/&$|\?$/,"")).includes("?")?r+="&":r+=(r.endsWith("/")?"":"/")+"?",(r+e+"="+encodeURIComponent(t)).replace(/&$|\?$/,"")}function bt(e){return window.location.origin+"/"+(null==e?void 0:e.ltrim("/"))}function wt(e){return gt(e)?e:Salla.config.get("theme.assets")?Salla.config.get("theme.assets").replace(":path",null==e?void 0:e.ltrim("/")):bt("themes/"+Salla.config.get("theme.name")+"/"+(null==e?void 0:e.ltrim("/")))}function St(e,t,r){var n,i=e[0];return r&&0==e.length?Array.isArray(r)?(r.push(t),r):[r,t]:Array.isArray(r)?(r.push(t),r):"string"==typeof r?[r,t]:r?(r[i]=St(e.slice(1),t,r[i]),r):i?((n={})[i]=St(e.slice(1),t),n):""===i?[t]:t}var Lt={digitsOnly:function(e){return i(e,!0).replace(/[^0-9.]/g,"").replace("..",".").rtrim(".")},inputDigitsOnly:function e(t,r){if(void 0===r&&(r=!1),"string"==typeof t)return document.querySelectorAll(t).forEach((function(t){return e(t,r)}));if(t){var n=Salla.helpers.digitsOnly(t.value);return t.min&&n<parseInt(t.min)?t.value=t.min:t.max&&n>parseInt(t.max)?t.value=t.max:t.maxLength>=1&&n.toString().length>t.maxLength?t.value=n.toString().substring(0,t.maxLength):t.value=r||t.dataset.hasOwnProperty("digitsWithDecimal")?o(n):n.replace(/\D/g,"")}Salla.logger.warn("Can't find Object With Id: "+t)},number:i,money:function(e){var t=Salla.config.currency(null==e?void 0:e.currency).symbol;return i(e="object"==typeof e?e.amount:e)+" "+t},setNested:function(e,t,r){for(var n=e,i=t.split("."),o=i.length,s=0;s<o-1;s++){var a=i[s];n[a]||(n[a]={}),n=n[a]}return n[i[o-1]]=r,e},getNested:function(e,t,r){var n=yt(e,t);return void 0!==n?n:r},inputData:function(e,t,r){if(void 0===r&&(r={}),e.includes("[")){var n=e.split("]").join("").split("[");return{name:n[0],value:St(n.slice(1),t,r[n[0]])}}return{name:e,value:t}},url:Object.freeze({__proto__:null,is_full_url:gt,base:function(e){return gt(e)?e:"https://"+new URL(_t("/")).hostname+"/"+(null==e?void 0:e.ltrim("/"))},get:_t,domain:function(e){return gt(e)?e:"".concat(Salla.config.get("store.url",window.location.href.split("/").slice(0,-1).join("/")).rtrim("/"),"/").concat(null==e?void 0:e.ltrim("/"))},addParamToUrl:mt,baseUrl:bt,asset:wt,cdn:function(e){return"https://cdn.salla.network/"+(null==e?void 0:e.ltrim("/"))},api:function(e){var t;return(null===(t=Salla.config.get("store.api",_t("")))||void 0===t?void 0:t.rtrim("/"))+"/"+(null==e?void 0:e.ltrim("/"))},is_page:function(e){return e&&Salla.config.get("page.slug")===e},is_placeholder:function(e){return wt(salla.config.get("theme.settings.placeholder"))===wt(e)}}),addParamToUrl:mt,debounce:function(e,t){t=t||100;var r,n=[];return function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return clearTimeout(r),r=setTimeout((function(){var t=e.apply(void 0,i);n.forEach((function(e){return e(t)})),n=[]}),t),new Promise((function(e){return n.push(e)}))}}},jt=function(e,t){return jt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},jt(e,t)};var Et=function(){return Et=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Et.apply(this,arguments)};function xt(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var Ot,At,kt=(Ot=console,At={log:function(e,t){if(Ot&&salla.config.isDebug()){"trace"===salla.config.get("debug")&&(t="trace");var r=Ot.log,n=void 0===t?r:this.__dict__[t]||r,i=["%cTwilight","color: #5cd5c4;font-weight:bold; border:1px solid #5cd5c4; padding: 2px 6px; border-radius: 5px;"],o={event:"#CFF680",backend:"#7b68ee"}[t];o&&(i[0]+="%c"+t[0].toUpperCase()+t.substring(1),i.push("margin-left: 5px;color: ".concat(o,";font-weight:bold; border:1px solid ").concat(o,"; padding: 2px 6px; border-radius: 5px;"))),n.call.apply(n,xt([Ot],i.concat.apply(i,e),!1))}},__dict__:{trace:Ot.trace,debug:Ot.debug,info:Ot.info,warn:Ot.warn,error:Ot.error}},{event:function(){At.log(arguments,"event")},trace:function(){At.log(arguments,"trace")},debug:function(){At.log(arguments,"debug")},info:function(){At.log(arguments,"info")},warn:function(){At.log(arguments,"warn")},error:function(){At.log(arguments,"error")},log:function(){At.log(arguments,void 0)},backend:function(){At.log(arguments,"backend")},logs:function(e){[e].flat().forEach((function(e){return e&&At.log([e].flat(),"backend")}))}}),Tt=function(){function e(e,t){void 0===e&&(e={}),void 0===t&&(t={}),this.default_properties=t,this.properties_=Et(Et({},this.default_properties),e)}return e.prototype.merge=function(e){var t;return this.properties_=Et(Et({},this.properties_),e),this.properties_.store=Et(Et({},(null===(t=this.default_properties)||void 0===t?void 0:t.store)||{}),this.properties_.store),this},e.prototype.set=function(e,t){return e.includes(".")?(Salla.helpers.setNested(this.properties_,e,t),this):(this.properties_[e]=t,this)},e.prototype.currency=function(e){return void 0===e&&(e=void 0),e=e||this.get("user.currency_code"),this.get("currencies."+e)||Object.values(this.get("currencies"))[0]},e.prototype.get=function(e,t){return void 0===t&&(t=null),e.includes(".")?Salla.helpers.getNested(this.properties_,e,t):this.properties_.hasOwnProperty(e)?this.properties_[e]||t:t||void 0},e.prototype.all=function(){return this.properties_},e.prototype.isDebug=function(){return this.get("debug")||Salla.storage.get("debug")},e}(),Pt={exports:{}};!function(e,t){!function(t){var r=Object.hasOwnProperty,i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},o="object"==l(n.default)&&"function"==typeof n.default.nextTick,s="function"==typeof Symbol,a="object"===("undefined"==typeof Reflect?"undefined":l(Reflect)),c="function"==typeof setImmediate?setImmediate:setTimeout,u=s?a&&"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 f(){this._events={},this._conf&&p.call(this,this._conf)}function p(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!==n.default&&n.default.emitWarning){var i=new Error(r);i.name="MaxListenersExceededWarning",i.emitter=this,i.count=e,n.default.emitWarning(i)}else console.error(r),console.trace&&console.trace()}var d=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 v(e,r){for(var n={},i=e.length,o=r?r.length:0,s=0;s<i;s++)n[e[s]]=s<o?r[s]:t;return n}function y(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 o=e._observers;o?o.push(this):e._observers=[this]}function g(e,n,i,o){var s=Object.assign({},n);if(!e)return s;if("object"!==l(e))throw TypeError("options must be an object");var a,c,u,f=Object.keys(e),p=f.length;function h(e){throw Error('Invalid "'+a+'" option value'+(e?". Reason: "+e:""))}for(var d=0;d<p;d++){if(a=f[d],!o&&!r.call(n,a))throw Error('Unknown "'+a+'" option');(c=e[a])!==t&&(u=i[a],s[a]=u?u(c,h):c)}return s}function _(e,t){return"function"==typeof e&&e.hasOwnProperty("prototype")||t("value must be a constructor"),e}function m(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(l(e)===n)return e;r(t)}:2===r?function(e,r){var o=l(e);if(o===n||o===i)return e;r(t)}:function(n,i){for(var o=l(n),s=r;s-- >0;)if(o===e[s])return n;i(t)}}Object.assign(y.prototype,{subscribe:function(e,t,r){var n=this,i=this._target,o=this._emitter,s=this._listeners,a=function(){var n=d.apply(null,arguments),s={data:n,name:t,original:e};r?!1!==r.call(i,s)&&o.emit.apply(o,[s.name].concat(n)):o.emit.apply(o,[t].concat(n))};if(s[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,o._newListener&&o._removeListener&&!n._onNewListener?(this._onNewListener=function(r){r===t&&null===s[e]&&(s[e]=a,n._on.call(i,e,a))},o.on("newListener",this._onNewListener),this._onRemoveListener=function(r){r===t&&!o.hasListeners(r)&&s[e]&&(s[e]=null,n._off.call(i,e,a))},s[e]=null,o.on("removeListener",this._onRemoveListener)):(s[e]=a,n._on.call(i,e,a))},unsubscribe:function(e){var t,r,n,i=this,o=this._listeners,s=this._emitter,a=this._off,l=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function c(){i._onNewListener&&(s.off("newListener",i._onNewListener),s.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=L.call(s,i);s._observers.splice(e,1)}if(e){if(!(t=o[e]))return;a.call(l,e,t),delete o[e],--this._listenersCount||c()}else{for(n=(r=u(o)).length;n-- >0;)e=r[n],a.call(l,e,o[e]);this._listeners={},this._listenersCount=0,c()}}});var b=m(["function"]),w=m(["object","function"]);function S(e,t,r){var n,i,o,s=0,a=new e((function(l,c,u){function f(){i&&(i=null),s&&(clearTimeout(s),s=0)}r=g(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 p=function(e){f(),l(e)},h=function(e){f(),c(e)};n?t(p,h,u):(i=[function(e){h(e||Error("canceled"))}],t(p,h,(function(e){if(o)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)})),o=!0),r.timeout>0&&(s=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",s=0,a.cancel(e),c(e)}),r.timeout))}));return n||(a.cancel=function(e){if(i){for(var t=i.length,r=1;r<t;r++)i[r](e);i[0](e),i=null}}),a}function L(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 j(e,t,r,n,i){if(!r)return null;if(0===n){var o=l(t);if("string"===o){var s,a,c=0,f=0,p=this.delimiter,h=p.length;if(-1!==(a=t.indexOf(p))){s=new Array(5);do{s[c++]=t.slice(f,a),f=a+h}while(-1!==(a=t.indexOf(p,f)));s[c++]=t.slice(f),t=s,i=c}else t=[t],i=1}else"object"===o?i=t.length:(t=[t],i=1)}var d,v,y,g,_,m,b,w=null,S=t[n],L=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("*"===S){for(a=(m=u(r)).length;a-- >0;)"_listeners"!==(d=m[a])&&(b=j(e,t,r[d],n+1,i))&&(w?w.push.apply(w,b):w=b);return w}if("**"===S){for((_=n+1===i||n+2===i&&"*"===L)&&r._listeners&&(w=j(e,t,r,i,i)),a=(m=u(r)).length;a-- >0;)"_listeners"!==(d=m[a])&&("*"===d||"**"===d?(r[d]._listeners&&!_&&(b=j(e,t,r[d],i,i))&&(w?w.push.apply(w,b):w=b),b=j(e,t,r[d],n,i)):b=j(e,t,r[d],d===L?n+2:n,i),b&&(w?w.push.apply(w,b):w=b));return w}r[S]&&(w=j(e,t,r[S],n+1,i))}if((v=r["*"])&&j(e,t,v,n+1,i),y=r["**"])if(n<i)for(y._listeners&&j(e,t,y,i,i),a=(m=u(y)).length;a-- >0;)"_listeners"!==(d=m[a])&&(d===L?j(e,t,y[d],n+2,i):d===S?j(e,t,y[d],n+1,i):((g={})[d]=y[d],j(e,t,{"**":g},n+1,i)));else y._listeners?j(e,t,y,i,i):y["*"]&&y["*"]._listeners&&j(e,t,y["*"],i,i);return w}function E(e,t,r){var n,i,o=0,s=0,a=this.delimiter,l=a.length;if("string"==typeof e)if(-1!==(n=e.indexOf(a))){i=new Array(5);do{i[o++]=e.slice(s,n),s=n+l}while(-1!==(n=e.indexOf(a,s)));i[o++]=e.slice(s)}else i=[e],o=1;else i=e,o=e.length;if(o>1)for(n=0;n+1<o;n++)if("**"===i[n]&&"**"===i[n+1])return;var c,u=this.listenerTree;for(n=0;n<o;n++)if(u=u[c=i[n]]||(u[c]={}),n===o-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 x(e,t,r,n){for(var i,o,s,a,c=u(e),f=c.length,p=e._listeners;f-- >0;)i=e[o=c[f]],s="_listeners"===o?r:r?r.concat(o):[o],a=n||"symbol"===l(o),p&&t.push(a?s:s.join(this.delimiter)),"object"===l(i)&&x.call(this,i,t,s,a);return t}function O(e){for(var t,r,n,i=u(e),o=i.length;o-- >0;)(t=e[r=i[o]])&&(n=!0,"_listeners"===r||O(t)||delete e[r]);return n}function A(e,t,r){this.emitter=e,this.event=t,this.listener=r}function k(e,r,i){if(!0===i)a=!0;else if(!1===i)s=!0;else{if(!i||"object"!==l(i))throw TypeError("options should be an object or true");var s=i.async,a=i.promisify,u=i.nextTick,f=i.objectify}if(s||u||a){var p=r,h=r._origin||r;if(u&&!o)throw Error("process.nextTick is not supported");a===t&&(a="AsyncFunction"===r.constructor.name),r=function(){var e=arguments,t=this,r=this.event;return a?u?Promise.resolve():new Promise((function(e){c(e)})).then((function(){return t.event=r,p.apply(t,e)})):(u?n.default.nextTick:c)((function(){t.event=r,p.apply(t,e)}))},r._async=!0,r._origin=h}return[r,f?new A(this,e,r):this]}function T(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,p.call(this,e)}A.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},T.EventEmitter2=T,T.prototype.listenTo=function(e,r,n){if("object"!==l(e))throw TypeError("target musts be an object");var o=this;function s(t){if("object"!==l(t))throw TypeError("events must be an object");var r,i=n.reducers,s=L.call(o,e);r=-1===s?new y(o,e,n):o._observers[s];for(var a,c=u(t),f=c.length,p="function"==typeof i,h=0;h<f;h++)a=c[h],r.subscribe(a,t[a]||a,p?i:i&&i[a])}return n=g(n,{on:t,off:t,reducers:t},{on:b,off:b,reducers:w}),i(r)?s(v(r)):s("string"==typeof r?v(r.split(/\s+/)):r),this},T.prototype.stopListeningTo=function(e,t){var r=this._observers;if(!r)return!1;var n,i=r.length,o=!1;if(e&&"object"!==l(e))throw TypeError("target should be an object");for(;i-- >0;)n=r[i],e&&n._target!==e||(n.unsubscribe(t),o=!0);return o},T.prototype.delimiter=".",T.prototype.setMaxListeners=function(e){e!==t&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},T.prototype.getMaxListeners=function(){return this._maxListeners},T.prototype.event="",T.prototype.once=function(e,t,r){return this._once(e,t,!1,r)},T.prototype.prependOnceListener=function(e,t,r){return this._once(e,t,!0,r)},T.prototype._once=function(e,t,r,n){return this._many(e,1,t,r,n)},T.prototype.many=function(e,t,r,n){return this._many(e,t,r,!1,n)},T.prototype.prependMany=function(e,t,r,n){return this._many(e,t,r,!0,n)},T.prototype._many=function(e,t,r,n,i){var o=this;if("function"!=typeof r)throw new Error("many only accepts instances of Function");function s(){return 0==--t&&o.off(e,s),r.apply(this,arguments)}return s._origin=r,this._on(e,s,n,i)},T.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||f.call(this);var e,t,r,n,i,o,a=arguments[0],c=this.wildcard;if("newListener"===a&&!this._newListener&&!this._events.newListener)return!1;if(c&&(e=a,"newListener"!==a&&"removeListener"!==a&&"object"===l(a))){if(r=a.length,s)for(n=0;n<r;n++)if("symbol"===l(a[n])){o=!0;break}o||(a=a.join(this.delimiter))}var u,p=arguments.length;if(this._all&&this._all.length)for(n=0,r=(u=this._all.slice()).length;n<r;n++)switch(this.event=a,p){case 1:u[n].call(this,a);break;case 2:u[n].call(this,a,arguments[1]);break;case 3:u[n].call(this,a,arguments[1],arguments[2]);break;default:u[n].apply(this,arguments)}if(c)u=[],j.call(this,u,e,this.listenerTree,0,r);else{if("function"==typeof(u=this._events[a])){switch(this.event=a,p){case 1:u.call(this);break;case 2:u.call(this,arguments[1]);break;case 3:u.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(p-1),i=1;i<p;i++)t[i-1]=arguments[i];u.apply(this,t)}return!0}u&&(u=u.slice())}if(u&&u.length){if(p>3)for(t=new Array(p-1),i=1;i<p;i++)t[i-1]=arguments[i];for(n=0,r=u.length;n<r;n++)switch(this.event=a,p){case 1:u[n].call(this);break;case 2:u[n].call(this,arguments[1]);break;case 3:u[n].call(this,arguments[1],arguments[2]);break;default:u[n].apply(this,t)}return!0}if(!this.ignoreErrors&&!this._all&&"error"===a)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},T.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||f.call(this);var e,t,r,n,i,o,a=arguments[0],c=this.wildcard;if("newListener"===a&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(c&&(e=a,"newListener"!==a&&"removeListener"!==a&&"object"===l(a))){if(n=a.length,s)for(i=0;i<n;i++)if("symbol"===l(a[i])){t=!0;break}t||(a=a.join(this.delimiter))}var u,p=[],h=arguments.length;if(this._all)for(i=0,n=this._all.length;i<n;i++)switch(this.event=a,h){case 1:p.push(this._all[i].call(this,a));break;case 2:p.push(this._all[i].call(this,a,arguments[1]));break;case 3:p.push(this._all[i].call(this,a,arguments[1],arguments[2]));break;default:p.push(this._all[i].apply(this,arguments))}if(c?(u=[],j.call(this,u,e,this.listenerTree,0)):u=this._events[a],"function"==typeof u)switch(this.event=a,h){case 1:p.push(u.call(this));break;case 2:p.push(u.call(this,arguments[1]));break;case 3:p.push(u.call(this,arguments[1],arguments[2]));break;default:for(r=new Array(h-1),o=1;o<h;o++)r[o-1]=arguments[o];p.push(u.apply(this,r))}else if(u&&u.length){if(u=u.slice(),h>3)for(r=new Array(h-1),o=1;o<h;o++)r[o-1]=arguments[o];for(i=0,n=u.length;i<n;i++)switch(this.event=a,h){case 1:p.push(u[i].call(this));break;case 2:p.push(u[i].call(this,arguments[1]));break;case 3:p.push(u[i].call(this,arguments[1],arguments[2]));break;default:p.push(u[i].apply(this,r))}}else if(!this.ignoreErrors&&!this._all&&"error"===a)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(p)},T.prototype.on=function(e,t,r){return this._on(e,t,!1,r)},T.prototype.prependListener=function(e,t,r){return this._on(e,t,!0,r)},T.prototype.onAny=function(e){return this._onAny(e,!1)},T.prototype.prependAny=function(e){return this._onAny(e,!0)},T.prototype.addListener=T.prototype.on,T.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},T.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||f.call(this);var o,s=this;return i!==t&&(r=(o=k.call(this,e,r,i))[0],s=o[1]),this._newListener&&this.emit("newListener",e,r),this.wildcard?(E.call(this,e,r,n),s):(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,s)},T.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r,n=[];if(this.wildcard){var o="string"==typeof e?e.split(this.delimiter):e.slice();if(!(n=j.call(this,null,o,this.listenerTree,0)))return this}else{if(!this._events[e])return this;r=this._events[e],n.push({_listeners:r})}for(var s=0;s<n.length;s++){var a=n[s];if(r=a._listeners,i(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?a._listeners.splice(l,1):this._events[e].splice(l,1),0===r.length&&(this.wildcard?delete a._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 a._listeners:delete this._events[e],this._removeListener&&this.emit("removeListener",e,t))}return this.listenerTree&&O(this.listenerTree),this},T.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},T.prototype.removeListener=T.prototype.off,T.prototype.removeAllListeners=function(e){if(e===t)return!this._events||f.call(this),this;if(this.wildcard){var r,n=j.call(this,null,e,this.listenerTree,0);if(!n)return this;for(r=0;r<n.length;r++)n[r]._listeners=null;this.listenerTree&&O(this.listenerTree)}else this._events&&(this._events[e]=null);return this},T.prototype.listeners=function(e){var r,n,i,o,s,a=this._events;if(e===t){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!a)return[];for(o=(r=u(a)).length,i=[];o-- >0;)"function"==typeof(n=a[r[o]])?i.push(n):i.push.apply(i,n);return i}if(this.wildcard){if(!(s=this.listenerTree))return[];var l=[],c="string"==typeof e?e.split(this.delimiter):e.slice();return j.call(this,l,c,s,0),l}return a&&(n=a[e])?"function"==typeof n?[n]:n:[]},T.prototype.eventNames=function(e){var t=this._events;return this.wildcard?x.call(this,this.listenerTree,[],null,e):t?u(t):[]},T.prototype.listenerCount=function(e){return this.listeners(e).length},T.prototype.hasListeners=function(e){if(this.wildcard){var r=[],n="string"==typeof e?e.split(this.delimiter):e.slice();return j.call(this,r,n,this.listenerTree,0),r.length>0}var i=this._events,o=this._all;return!!(o&&o.length||i&&(e===t?u(i).length:i[e]))},T.prototype.listenersAny=function(){return this._all?this._all:[]},T.prototype.waitFor=function(e,r){var n=this,i=l(r);return"number"===i?r={timeout:r}:"function"===i&&(r={filter:r}),S((r=g(r,{timeout:0,filter:t,handleError:!1,Promise:Promise,overload:!1},{filter:b,Promise:_})).Promise,(function(t,i,o){function s(){var o=r.filter;if(!o||o.apply(n,arguments))if(n.off(e,s),r.handleError){var a=arguments[0];a?i(a):t(d.apply(null,arguments).slice(1))}else t(d.apply(null,arguments))}o((function(){n.off(e,s)})),n._on(e,s,!1)}),{timeout:r.timeout,overload:r.overload})};var P=T.prototype;Object.defineProperties(T,{defaultMaxListeners:{get:function(){return P._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");P._maxListeners=e},enumerable:!0},once:{value:function(e,t,r){return S((r=g(r,{Promise:Promise,timeout:0,overload:!1},{Promise:_})).Promise,(function(r,n,i){var o;if("function"==typeof e.addEventListener)return o=function(){r(d.apply(null,arguments))},i((function(){e.removeEventListener(t,o)})),void e.addEventListener(t,o,{once:!0});var s,a=function(){s&&e.removeListener("error",s),r(d.apply(null,arguments))};"error"!==t&&(s=function(r){e.removeListener(t,a),n(r)},e.once("error",s)),i((function(){s&&e.removeListener("error",s),e.removeListener(t,a)})),e.once(t,a)}),{timeout:r.timeout,overload:r.overload})},writable:!0,configurable:!0}}),Object.defineProperties(P,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),"function"==typeof t&&t.amd?t((function(){return T})):e.exports=T}()}(Pt);var Ft=function(e){function t(){var t=this;return(t=e.call(this,{wildcard:!0,delimiter:"::",newListener:!1,removeListener:!1,maxListeners:10,verboseMemoryLeak:!1,ignoreErrors:!1})||this).delimiter="::","undefined"!=typeof document&&(t.body=document.querySelector("body")),t.logableEvents=["cart::item.added.failed","cart::item.deleted.failed"],t.ingoreLogEvents=["document::click","document::keyup","document::change"],t.noneFireableActions=["document.request"],t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}jt(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(t,e),t.prototype.createAndDispatch=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this.dispatch.apply(this,xt([e],t,!1))},t.prototype.emit=function(t){for(var r,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var o=t.replace("::",".");if(!this.noneFireableActions.includes(o)&&Salla.call&&"function"==typeof Salla.call(o))return Salla.log("'Salla.".concat(o,"(...)' triggered using event '").concat(t,"'")),o=o.split("."),Array.isArray(n[0])&&(n=n[0]),void(r=salla[o[0]])[o[1]].apply(r,n);e.prototype.emit.apply(this,xt([t],n,!1)),this.trackEvents.apply(this,xt([t],n,!1))},t.prototype.emitAsync=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=e.prototype.emitAsync.apply(this,xt([t],r,!1));try{this.trackEvents.apply(this,xt([t],r,!1))}catch(e){Salla.logger.warn("error on tracking event (".concat(t,")"),r,e)}return i},t.prototype.trackEvents=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];if("undefined"!=typeof window)try{window.dataLayer=window.dataLayer||[];var i={event:e};r.map((function(e){return"object"==typeof e&&(i=Et(Et({},i),e))})),window.dataLayer.push(i)}catch(e){salla.logger.error(e.message)}Salla.logger&&!this.ingoreLogEvents.includes(e)&&(t=Salla.logger).event.apply(t,xt([e],r,!1)),this.dispatchMobileEvent.apply(this,xt([e],r,!1))},t.prototype.dispatch=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return this.emit.apply(this,xt([e],t,!1))},t.prototype.dispatchEvents=function(e){if(e)if("object"!=typeof e||Array.isArray(e))Salla.log("Events object is wrong, it should be object of {event:payload}",e);else for(var t=0,r=Object.entries(e);t<r.length;t++){var n=r[t],i=n[0],o=n[1];this.dispatch(i,o)}else Salla.log("No Events To Dispatch!",e)},t.prototype.addListener=function(e,t,r){return this.on(e,t,r)},t.prototype.addEventListener=function(e,t,r){return this.on(e,t,r)},t.prototype.listen=function(e,t){return this.on(e,t)},t.prototype.registerGlobalListener=function(e,t){return this.onAny(t)},t.prototype.dispatchMobileEvent=function(e,t){if(void 0===t&&(t={}),!("undefined"!=typeof window&&window.dataLayer&&window.dataLayer[0]&&window.dataLayer[0].page&&window.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(void 0!==window.Android)try{window.Android.customEventWithData(e,JSON.stringify({details:t}))}catch(e){Salla.log(e,"The native context does not exist yet")}},t}(Pt.exports.EventEmitter2),Nt=Object.assign?Object.assign:function(e,t,r,n){for(var i=1;i<arguments.length;i++)It(Object(arguments[i]),(function(t,r){e[r]=t}));return e},Rt=function(){if(Object.create)return function(e,t,r,n){var i=Mt(arguments,1);return Nt.apply(this,[Object.create(e)].concat(i))};var e=function(){};return function(t,r,n,i){var o=Mt(arguments,1);return e.prototype=t,Nt.apply(this,[new e].concat(o))}}(),zt=String.prototype.trim?function(e){return String.prototype.trim.call(e)}:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},$t="undefined"!=typeof window?window:s,Ct={assign:Nt,create:Rt,trim:zt,bind:function(e,t){return function(){return t.apply(e,Array.prototype.slice.call(arguments,0))}},slice:Mt,each:It,map:function(e,t){var r=Dt(e)?[]:{};return Ut(e,(function(e,n){return r[n]=t(e,n),!1})),r},pluck:Ut,isList:Dt,isFunction:function(e){return e&&"[object Function]"==={}.toString.call(e)},isObject:function(e){return e&&"[object Object]"==={}.toString.call(e)},Global:$t};function Mt(e,t){return Array.prototype.slice.call(e,t||0)}function It(e,t){Ut(e,(function(e,r){return t(e,r),!1}))}function Ut(e,t){if(Dt(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 Dt(e){return null!=e&&"function"!=typeof e&&"number"==typeof e.length}var Wt=Ct.slice,Gt=Ct.pluck,Jt=Ct.each,qt=Ct.bind,Zt=Ct.create,Ht=Ct.isList,Kt=Ct.isFunction,Bt=Ct.isObject,Qt={createStore:Xt},Vt={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 Xt.apply(this,arguments)},addPlugin:function(e){this._addPlugin(e)},namespace:function(e){return Xt(this.storage,this.plugins,e)}};function Xt(e,t,r){r||(r=""),e&&!Ht(e)&&(e=[e]),t&&!Ht(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 o={_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=Wt(arguments,0),n=this;var i=[function(){if(r)return Jt(arguments,(function(e,r){t[r]=e})),r.apply(n,t)}].concat(t);return e.apply(n,i)}},_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(Ht(e))Jt(e,(function(e){t._addPlugin(e)}));else if(!Gt(this.plugins,(function(t){return e===t}))){if(this.plugins.push(e),!Kt(e))throw new Error("Plugins must be function values that return objects");var r=e.call(this);if(!Bt(r))throw new Error("Plugins must return an object of function properties");Jt(r,(function(r,n){if(!Kt(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;e&&(e.warn?e.warn:e.log).apply(e,arguments)}("store.addStorage(storage) is deprecated. Use createStore([storages])"),this._addStorage(e)}},s=Zt(o,Vt,{plugins:[]});return s.raw={},Jt(s,(function(e,t){Kt(e)&&(s.raw[t]=qt(s,e))})),Jt(e,(function(e){s._addStorage(e)})),Jt(t,(function(e){s._addPlugin(e)})),s}var Yt=Ct.Global,er={name:"localStorage",read:rr,write:function(e,t){return tr().setItem(e,t)},each:function(e){for(var t=tr().length-1;t>=0;t--){var r=tr().key(t);e(rr(r),r)}},remove:function(e){return tr().removeItem(e)},clearAll:function(){return tr().clear()}};function tr(){return Yt.localStorage}function rr(e){return tr().getItem(e)}var nr=r({__proto__:null,default:er},[er]),ir=Ct.Global,or={name:"sessionStorage",read:ar,write:function(e,t){return sr().setItem(e,t)},each:function(e){for(var t=sr().length-1;t>=0;t--){var r=sr().key(t);e(ar(r),r)}},remove:function(e){return sr().removeItem(e)},clearAll:function(){return sr().clear()}};function sr(){return ir.sessionStorage}function ar(e){return sr().getItem(e)}var lr=r({__proto__:null,default:or},[or]),cr=Ct.trim,ur={name:"cookieStorage",read:function(e){if(!e||!dr(e))return null;var t="(?:^|.*;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(fr.cookie.replace(new RegExp(t),"$1"))},write:function(e,t){if(!e)return;fr.cookie=escape(e)+"="+escape(t)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/"},each:pr,remove:hr,clearAll:function(){pr((function(e,t){hr(t)}))}},fr=Ct.Global.document;function pr(e){for(var t=fr.cookie.split(/; ?/g),r=t.length-1;r>=0;r--)if(cr(t[r])){var n=t[r].split("="),i=unescape(n[0]);e(unescape(n[1]),i)}}function hr(e){e&&dr(e)&&(fr.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function dr(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(fr.cookie)}var vr=r({__proto__:null,default:ur},[ur]),yr={name:"memoryStorage",read:function(e){return gr[e]},write:function(e,t){gr[e]=t},each:function(e){for(var t in gr)gr.hasOwnProperty(t)&&e(gr[t],t)},remove:function(e){delete gr[e]},clearAll:function(e){gr={}}},gr={};var _r=r({__proto__:null,default:yr},[yr]),mr=Qt.createStore([nr,lr,vr,_r],[]),br=function(){function e(){var e=this;Salla.event.on("storage::item.remove",(function(t){return e.remove(t)})),Salla.event.on("storage::item.set",(function(t,r){return e.set(t,r)})),this.store=mr}return e.prototype.set=function(e,t){var r;if(e.includes(".")){var n=e.split(".")[0],i=((r={})[n]=this.store.get(n),r);return i=Salla.helpers.setNested(i,e,t),this.store.set(n,i[n])}return this.store.set(e,t)},e.prototype.remove=function(e){return this.store.remove(e)},e.prototype.clearAll=function(){return this.store.clearAll()},e.prototype.get=function(e,t){var r;if(e.includes(".")){var n=e.split(".")[0];return Salla.helpers.getNested(((r={})[n]=this.store.get(n),r),e)}return this.store.get(e,t)},e}(),wr=function(){function e(){var e=this;Salla.event.on("cookies::remove",(function(t){return e.remove(t)})),Salla.event.on("cookies::add",(function(t,r){return e.set(t,r)}))}return e.prototype.get=function(e){var t;return null===(t=document.cookie.split("; ").find((function(t){return t.startsWith(e+"=")})))||void 0===t?void 0:t.split("=")[1]},e.prototype.set=function(e,t,r){void 0===t&&(t=""),void 0===r&&(r=10);var n="";if(r){var i=new Date;i.setTime(i.getTime()+24*r*60*60*1e3),n="; expires="+i.toUTCString()}return document.cookie="".concat(e,"=").concat(t).concat(n,'"; path=/; secure; SameSite=Lax"'),this},e.prototype.remove=function(e){return document.cookie="".concat(e,"=; Max-Age=0; path=/;"),this},e.prototype.clearAll=function(){for(var e=document.cookie.split(";"),t=0;t<e.length;t++){var r=e[t],n=r.indexOf("="),i=n>-1?r.substr(0,n):r;this.remove(i)}},e}();return"undefined"!=typeof window&&(window.salla=window.salla||window.Salla||{},window.Salla=window.salla),"undefined"!=typeof global&&(global.salla=global.salla||global.Salla||{},global.Salla=global.salla),Salla.status="base",Salla.config=new Tt,Salla.logger=kt,Salla.event=new Ft,Salla.helpers=Lt,Salla.storage=new br,Salla.cookie=new wr,Salla.log=Salla.logger.log,Salla.money=Salla.helpers.money,Salla.url=Salla.helpers.url,Salla.versions={base:"2.12.28"},Salla}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("process")):"function"==typeof define&&define.amd?define(["process"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Salla=t(e.process)}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function r(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(e)}var n=t(e);function i(e,t){void 0===t&&(t=!1),e+="";for(var r,n=["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"],i=["0","1","2","3","4","5","6","7","8","9"],o=(t=t||!Salla.config.get("store.settings.arabic_numbers_enabled"))?n:i,s=t?i:n,a=0;a<o.length;a++)r=new RegExp(o[a],"g"),e=e.replace(r,s[a]);return e.replace(t?"٫":".",t?".":"٫")}function o(e){var t=("".concat(e).match(/\./g)||[]).length;return t&&1!==t?o(e.replace(/\.(.+)\./g,".$1")):e}String.prototype.toStudlyCase=function(){return this.trim().replace(/([^a-zA-Z\d].)/g,(function(e){return e.toUpperCase().replace(/[^a-zA-Z\d]/g,"")}))},String.prototype.toDatasetName=function(){return this.startsWith("data-")?this.substr(5).toStudlyCase():this.toStudlyCase()},String.prototype.toSelector=function(){return this.trim().startsWith(".")||this.trim().startsWith("#")?this.toString():"#"+this.toString()},String.prototype.replaceArray=function(e,t){for(var r,n=this,i=0;i<e.length;i++)r=new RegExp(e[i],"g"),n=n.replace(r,t[i]);return n},String.prototype.rtrim=function(e){return void 0===e&&(e="\\s"),this.replace(new RegExp("["+e+"]*$"),"")},String.prototype.ltrim=function(e){return void 0===e&&(e="\\s"),this.replace(new RegExp("^["+e+"]*"),"")},String.prototype.digitsOnly=function(){return Salla.helpers.digitsOnly(this)};var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},a=Array.isArray;function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}var c="object"==l(s)&&s&&s.Object===Object&&s,u="object"==("undefined"==typeof self?"undefined":l(self))&&self&&self.Object===Object&&self,f=c||u||Function("return this")(),p=f.Symbol,h=p,d=Object.prototype,v=d.hasOwnProperty,y=d.toString,g=h?h.toStringTag:void 0;var _=function(e){var t=v.call(e,g),r=e[g];try{e[g]=void 0;var n=!0}catch(e){}var i=y.call(e);return n&&(t?e[g]=r:delete e[g]),i},m=Object.prototype.toString;var b=_,w=function(e){return m.call(e)},S=p?p.toStringTag:void 0;var L=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":S&&S in Object(e)?b(e):w(e)};var j=L,E=function(e){return null!=e&&"object"==l(e)};var x=function(e){return"symbol"==l(e)||E(e)&&"[object Symbol]"==j(e)},O=a,A=x,k=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,T=/^\w*$/;var P=function(e,t){if(O(e))return!1;var r=l(e);return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!A(e))||(T.test(e)||!k.test(e)||null!=t&&e in Object(t))};var F=function(e){var t=l(e);return null!=e&&("object"==t||"function"==t)},N=L,R=F;var z,$=function(e){if(!R(e))return!1;var t=N(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},C=f["__core-js_shared__"],M=(z=/[^.]+$/.exec(C&&C.keys&&C.keys.IE_PROTO||""))?"Symbol(src)_1."+z:"";var I=function(e){return!!M&&M in e},U=Function.prototype.toString;var D=$,W=I,G=F,J=function(e){if(null!=e){try{return U.call(e)}catch(e){}try{return e+""}catch(e){}}return""},q=/^\[object .+?Constructor\]$/,Z=Function.prototype,H=Object.prototype,K=Z.toString,B=H.hasOwnProperty,Q=RegExp("^"+K.call(B).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var V=function(e){return!(!G(e)||W(e))&&(D(e)?Q:q).test(J(e))},X=function(e,t){return null==e?void 0:e[t]};var Y=function(e,t){var r=X(e,t);return V(r)?r:void 0},ee=Y(Object,"create"),te=ee;var re=function(){this.__data__=te?te(null):{},this.size=0};var ne=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ie=ee,oe=Object.prototype.hasOwnProperty;var se=function(e){var t=this.__data__;if(ie){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return oe.call(t,e)?t[e]:void 0},ae=ee,le=Object.prototype.hasOwnProperty;var ce=ee;var ue=re,fe=ne,pe=se,he=function(e){var t=this.__data__;return ae?void 0!==t[e]:le.call(t,e)},de=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};function ve(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])}}ve.prototype.clear=ue,ve.prototype.delete=fe,ve.prototype.get=pe,ve.prototype.has=he,ve.prototype.set=de;var ye=ve;var ge=function(){this.__data__=[],this.size=0};var _e=function(e,t){return e===t||e!=e&&t!=t};var me=function(e,t){for(var r=e.length;r--;)if(_e(e[r][0],t))return r;return-1},be=me,we=Array.prototype.splice;var Se=me;var Le=me;var je=me;var Ee=ge,xe=function(e){var t=this.__data__,r=be(t,e);return!(r<0)&&(r==t.length-1?t.pop():we.call(t,r,1),--this.size,!0)},Oe=function(e){var t=this.__data__,r=Se(t,e);return r<0?void 0:t[r][1]},Ae=function(e){return Le(this.__data__,e)>-1},ke=function(e,t){var r=this.__data__,n=je(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function Te(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])}}Te.prototype.clear=Ee,Te.prototype.delete=xe,Te.prototype.get=Oe,Te.prototype.has=Ae,Te.prototype.set=ke;var Pe=Te,Fe=Y(f,"Map"),Ne=ye,Re=Pe,ze=Fe;var $e=function(e){var t=l(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Ce=function(e,t){var r=e.__data__;return $e(t)?r["string"==typeof t?"string":"hash"]:r.map},Me=Ce;var Ie=Ce;var Ue=Ce;var De=Ce;var We=function(){this.size=0,this.__data__={hash:new Ne,map:new(ze||Re),string:new Ne}},Ge=function(e){var t=Me(this,e).delete(e);return this.size-=t?1:0,t},Je=function(e){return Ie(this,e).get(e)},qe=function(e){return Ue(this,e).has(e)},Ze=function(e,t){var r=De(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function He(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])}}He.prototype.clear=We,He.prototype.delete=Ge,He.prototype.get=Je,He.prototype.has=qe,He.prototype.set=Ze;var Ke=He;function Be(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function r(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(Be.Cache||Ke),r}Be.Cache=Ke;var Qe=Be;var Ve=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Xe=/\\(\\)?/g,Ye=function(e){var t=Qe(e,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Ve,(function(e,r,n,i){t.push(n?i.replace(Xe,"$1"):r||e)})),t})),et=Ye;var tt=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},rt=a,nt=x,it=p?p.prototype:void 0,ot=it?it.toString:void 0;var st=function e(t){if("string"==typeof t)return t;if(rt(t))return tt(t,e)+"";if(nt(t))return ot?ot.call(t):"";var r=t+"";return"0"==r&&1/t==-Infinity?"-0":r},at=st;var lt=a,ct=P,ut=et,ft=function(e){return null==e?"":at(e)};var pt=x;var ht=function(e,t){return lt(e)?e:ct(e,t)?[e]:ut(ft(e))},dt=function(e){if("string"==typeof e||pt(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var vt=function(e,t){for(var r=0,n=(t=ht(t,e)).length;null!=e&&r<n;)e=e[dt(t[r++])];return r&&r==n?e:void 0};var yt=function(e,t,r){var n=null==e?void 0:vt(e,t);return void 0===n?r:n};function gt(e){return"".concat(e).startsWith("https://")||"".concat(e).startsWith("http://")}function _t(e){if(gt(e))return e;var t=Salla.config.get("store.url");return t||(t=window.location.href.split("/").slice(0,-1).join("/"),Salla.config.set("store.url",t)),t.rtrim("/")+"/"+(null==e?void 0:e.ltrim("/"))}function mt(e,t,r){if(r=r||window.location.href,!t||!e)return r;var n=new RegExp("([?&])"+e+"=[^&]+[&]?","g");return(r=r.replace(n,"$1").split("#")[0].replace(/&$|\?$/,"")).includes("?")?r+="&":r+=(r.endsWith("/")?"":"/")+"?",(r+e+"="+encodeURIComponent(t)).replace(/&$|\?$/,"")}function bt(e){return window.location.origin+"/"+(null==e?void 0:e.ltrim("/"))}function wt(e){return gt(e)?e:Salla.config.get("theme.assets")?Salla.config.get("theme.assets").replace(":path",null==e?void 0:e.ltrim("/")):bt("themes/"+Salla.config.get("theme.name")+"/"+(null==e?void 0:e.ltrim("/")))}function St(e,t,r){var n,i=e[0];return r&&0==e.length?Array.isArray(r)?(r.push(t),r):[r,t]:Array.isArray(r)?(r.push(t),r):"string"==typeof r?[r,t]:r?(r[i]=St(e.slice(1),t,r[i]),r):i?((n={})[i]=St(e.slice(1),t),n):""===i?[t]:t}var Lt={digitsOnly:function(e){return i(e,!0).replace(/[^0-9.]/g,"").replace("..",".").rtrim(".")},inputDigitsOnly:function e(t,r){if(void 0===r&&(r=!1),"string"==typeof t)return document.querySelectorAll(t).forEach((function(t){return e(t,r)}));if(t){var n=Salla.helpers.digitsOnly(t.value);return t.min&&n<parseInt(t.min)?t.value=t.min:t.max&&n>parseInt(t.max)?t.value=t.max:t.maxLength>=1&&n.toString().length>t.maxLength?t.value=n.toString().substring(0,t.maxLength):t.value=r||t.dataset.hasOwnProperty("digitsWithDecimal")?o(n):n.replace(/\D/g,"")}Salla.logger.warn("Can't find Object With Id: "+t)},number:i,money:function(e){var t=Salla.config.currency(null==e?void 0:e.currency).symbol;return i(e="object"==typeof e?e.amount:e)+" "+t},setNested:function(e,t,r){for(var n=e,i=t.split("."),o=i.length,s=0;s<o-1;s++){var a=i[s];n[a]||(n[a]={}),n=n[a]}return n[i[o-1]]=r,e},getNested:function(e,t,r){var n=yt(e,t);return void 0!==n?n:r},inputData:function(e,t,r){if(void 0===r&&(r={}),e.includes("[")){var n=e.split("]").join("").split("[");return{name:n[0],value:St(n.slice(1),t,r[n[0]])}}return{name:e,value:t}},url:Object.freeze({__proto__:null,is_full_url:gt,base:function(e){return gt(e)?e:"https://"+new URL(_t("/")).hostname+"/"+(null==e?void 0:e.ltrim("/"))},get:_t,domain:function(e){return gt(e)?e:"".concat(Salla.config.get("store.url",window.location.href.split("/").slice(0,-1).join("/")).rtrim("/"),"/").concat(null==e?void 0:e.ltrim("/"))},addParamToUrl:mt,baseUrl:bt,asset:wt,cdn:function(e){return"https://cdn.salla.network/"+(null==e?void 0:e.ltrim("/"))},api:function(e){var t;return(null===(t=Salla.config.get("store.api",_t("")))||void 0===t?void 0:t.rtrim("/"))+"/"+(null==e?void 0:e.ltrim("/"))},is_page:function(e){return e&&Salla.config.get("page.slug")===e},is_placeholder:function(e){return wt(salla.config.get("theme.settings.placeholder"))===wt(e)}}),addParamToUrl:mt,debounce:function(e,t){t=t||100;var r,n=[];return function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return clearTimeout(r),r=setTimeout((function(){var t=e.apply(void 0,i);n.forEach((function(e){return e(t)})),n=[]}),t),new Promise((function(e){return n.push(e)}))}}},jt=function(e,t){return jt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},jt(e,t)};var Et=function(){return Et=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Et.apply(this,arguments)};function xt(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var Ot,At,kt=(Ot=console,At={log:function(e,t){if(Ot&&salla.config.isDebug()){"trace"===salla.config.get("debug")&&(t="trace");var r=Ot.log,n=void 0===t?r:this.__dict__[t]||r,i=["%cTwilight","color: #5cd5c4;font-weight:bold; border:1px solid #5cd5c4; padding: 2px 6px; border-radius: 5px;"],o={event:"#CFF680",backend:"#7b68ee"}[t];o&&(i[0]+="%c"+t[0].toUpperCase()+t.substring(1),i.push("margin-left: 5px;color: ".concat(o,";font-weight:bold; border:1px solid ").concat(o,"; padding: 2px 6px; border-radius: 5px;"))),n.call.apply(n,xt([Ot],i.concat.apply(i,e),!1))}},__dict__:{trace:Ot.trace,debug:Ot.debug,info:Ot.info,warn:Ot.warn,error:Ot.error}},{event:function(){At.log(arguments,"event")},trace:function(){At.log(arguments,"trace")},debug:function(){At.log(arguments,"debug")},info:function(){At.log(arguments,"info")},warn:function(){At.log(arguments,"warn")},error:function(){At.log(arguments,"error")},log:function(){At.log(arguments,void 0)},backend:function(){At.log(arguments,"backend")},logs:function(e){[e].flat().forEach((function(e){return e&&At.log([e].flat(),"backend")}))}}),Tt=function(){function e(e,t){void 0===e&&(e={}),void 0===t&&(t={}),this.default_properties=t,this.properties_=Et(Et({},this.default_properties),e)}return e.prototype.merge=function(e){var t;return this.properties_=Et(Et({},this.properties_),e),this.properties_.store=Et(Et({},(null===(t=this.default_properties)||void 0===t?void 0:t.store)||{}),this.properties_.store),this},e.prototype.set=function(e,t){return e.includes(".")?(Salla.helpers.setNested(this.properties_,e,t),this):(this.properties_[e]=t,this)},e.prototype.currency=function(e){return void 0===e&&(e=void 0),e=e||this.get("user.currency_code"),this.get("currencies."+e)||Object.values(this.get("currencies"))[0]},e.prototype.get=function(e,t){return void 0===t&&(t=null),e.includes(".")?Salla.helpers.getNested(this.properties_,e,t):this.properties_.hasOwnProperty(e)?this.properties_[e]||t:t||void 0},e.prototype.all=function(){return this.properties_},e.prototype.isDebug=function(){return this.get("debug")||Salla.storage.get("debug")},e}(),Pt={exports:{}};!function(e,t){!function(t){var r=Object.hasOwnProperty,i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},o="object"==l(n.default)&&"function"==typeof n.default.nextTick,s="function"==typeof Symbol,a="object"===("undefined"==typeof Reflect?"undefined":l(Reflect)),c="function"==typeof setImmediate?setImmediate:setTimeout,u=s?a&&"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 f(){this._events={},this._conf&&p.call(this,this._conf)}function p(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!==n.default&&n.default.emitWarning){var i=new Error(r);i.name="MaxListenersExceededWarning",i.emitter=this,i.count=e,n.default.emitWarning(i)}else console.error(r),console.trace&&console.trace()}var d=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 v(e,r){for(var n={},i=e.length,o=r?r.length:0,s=0;s<i;s++)n[e[s]]=s<o?r[s]:t;return n}function y(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 o=e._observers;o?o.push(this):e._observers=[this]}function g(e,n,i,o){var s=Object.assign({},n);if(!e)return s;if("object"!==l(e))throw TypeError("options must be an object");var a,c,u,f=Object.keys(e),p=f.length;function h(e){throw Error('Invalid "'+a+'" option value'+(e?". Reason: "+e:""))}for(var d=0;d<p;d++){if(a=f[d],!o&&!r.call(n,a))throw Error('Unknown "'+a+'" option');(c=e[a])!==t&&(u=i[a],s[a]=u?u(c,h):c)}return s}function _(e,t){return"function"==typeof e&&e.hasOwnProperty("prototype")||t("value must be a constructor"),e}function m(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(l(e)===n)return e;r(t)}:2===r?function(e,r){var o=l(e);if(o===n||o===i)return e;r(t)}:function(n,i){for(var o=l(n),s=r;s-- >0;)if(o===e[s])return n;i(t)}}Object.assign(y.prototype,{subscribe:function(e,t,r){var n=this,i=this._target,o=this._emitter,s=this._listeners,a=function(){var n=d.apply(null,arguments),s={data:n,name:t,original:e};r?!1!==r.call(i,s)&&o.emit.apply(o,[s.name].concat(n)):o.emit.apply(o,[t].concat(n))};if(s[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,o._newListener&&o._removeListener&&!n._onNewListener?(this._onNewListener=function(r){r===t&&null===s[e]&&(s[e]=a,n._on.call(i,e,a))},o.on("newListener",this._onNewListener),this._onRemoveListener=function(r){r===t&&!o.hasListeners(r)&&s[e]&&(s[e]=null,n._off.call(i,e,a))},s[e]=null,o.on("removeListener",this._onRemoveListener)):(s[e]=a,n._on.call(i,e,a))},unsubscribe:function(e){var t,r,n,i=this,o=this._listeners,s=this._emitter,a=this._off,l=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function c(){i._onNewListener&&(s.off("newListener",i._onNewListener),s.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=L.call(s,i);s._observers.splice(e,1)}if(e){if(!(t=o[e]))return;a.call(l,e,t),delete o[e],--this._listenersCount||c()}else{for(n=(r=u(o)).length;n-- >0;)e=r[n],a.call(l,e,o[e]);this._listeners={},this._listenersCount=0,c()}}});var b=m(["function"]),w=m(["object","function"]);function S(e,t,r){var n,i,o,s=0,a=new e((function(l,c,u){function f(){i&&(i=null),s&&(clearTimeout(s),s=0)}r=g(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 p=function(e){f(),l(e)},h=function(e){f(),c(e)};n?t(p,h,u):(i=[function(e){h(e||Error("canceled"))}],t(p,h,(function(e){if(o)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)})),o=!0),r.timeout>0&&(s=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",s=0,a.cancel(e),c(e)}),r.timeout))}));return n||(a.cancel=function(e){if(i){for(var t=i.length,r=1;r<t;r++)i[r](e);i[0](e),i=null}}),a}function L(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 j(e,t,r,n,i){if(!r)return null;if(0===n){var o=l(t);if("string"===o){var s,a,c=0,f=0,p=this.delimiter,h=p.length;if(-1!==(a=t.indexOf(p))){s=new Array(5);do{s[c++]=t.slice(f,a),f=a+h}while(-1!==(a=t.indexOf(p,f)));s[c++]=t.slice(f),t=s,i=c}else t=[t],i=1}else"object"===o?i=t.length:(t=[t],i=1)}var d,v,y,g,_,m,b,w=null,S=t[n],L=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("*"===S){for(a=(m=u(r)).length;a-- >0;)"_listeners"!==(d=m[a])&&(b=j(e,t,r[d],n+1,i))&&(w?w.push.apply(w,b):w=b);return w}if("**"===S){for((_=n+1===i||n+2===i&&"*"===L)&&r._listeners&&(w=j(e,t,r,i,i)),a=(m=u(r)).length;a-- >0;)"_listeners"!==(d=m[a])&&("*"===d||"**"===d?(r[d]._listeners&&!_&&(b=j(e,t,r[d],i,i))&&(w?w.push.apply(w,b):w=b),b=j(e,t,r[d],n,i)):b=j(e,t,r[d],d===L?n+2:n,i),b&&(w?w.push.apply(w,b):w=b));return w}r[S]&&(w=j(e,t,r[S],n+1,i))}if((v=r["*"])&&j(e,t,v,n+1,i),y=r["**"])if(n<i)for(y._listeners&&j(e,t,y,i,i),a=(m=u(y)).length;a-- >0;)"_listeners"!==(d=m[a])&&(d===L?j(e,t,y[d],n+2,i):d===S?j(e,t,y[d],n+1,i):((g={})[d]=y[d],j(e,t,{"**":g},n+1,i)));else y._listeners?j(e,t,y,i,i):y["*"]&&y["*"]._listeners&&j(e,t,y["*"],i,i);return w}function E(e,t,r){var n,i,o=0,s=0,a=this.delimiter,l=a.length;if("string"==typeof e)if(-1!==(n=e.indexOf(a))){i=new Array(5);do{i[o++]=e.slice(s,n),s=n+l}while(-1!==(n=e.indexOf(a,s)));i[o++]=e.slice(s)}else i=[e],o=1;else i=e,o=e.length;if(o>1)for(n=0;n+1<o;n++)if("**"===i[n]&&"**"===i[n+1])return;var c,u=this.listenerTree;for(n=0;n<o;n++)if(u=u[c=i[n]]||(u[c]={}),n===o-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 x(e,t,r,n){for(var i,o,s,a,c=u(e),f=c.length,p=e._listeners;f-- >0;)i=e[o=c[f]],s="_listeners"===o?r:r?r.concat(o):[o],a=n||"symbol"===l(o),p&&t.push(a?s:s.join(this.delimiter)),"object"===l(i)&&x.call(this,i,t,s,a);return t}function O(e){for(var t,r,n,i=u(e),o=i.length;o-- >0;)(t=e[r=i[o]])&&(n=!0,"_listeners"===r||O(t)||delete e[r]);return n}function A(e,t,r){this.emitter=e,this.event=t,this.listener=r}function k(e,r,i){if(!0===i)a=!0;else if(!1===i)s=!0;else{if(!i||"object"!==l(i))throw TypeError("options should be an object or true");var s=i.async,a=i.promisify,u=i.nextTick,f=i.objectify}if(s||u||a){var p=r,h=r._origin||r;if(u&&!o)throw Error("process.nextTick is not supported");a===t&&(a="AsyncFunction"===r.constructor.name),r=function(){var e=arguments,t=this,r=this.event;return a?u?Promise.resolve():new Promise((function(e){c(e)})).then((function(){return t.event=r,p.apply(t,e)})):(u?n.default.nextTick:c)((function(){t.event=r,p.apply(t,e)}))},r._async=!0,r._origin=h}return[r,f?new A(this,e,r):this]}function T(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,p.call(this,e)}A.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},T.EventEmitter2=T,T.prototype.listenTo=function(e,r,n){if("object"!==l(e))throw TypeError("target musts be an object");var o=this;function s(t){if("object"!==l(t))throw TypeError("events must be an object");var r,i=n.reducers,s=L.call(o,e);r=-1===s?new y(o,e,n):o._observers[s];for(var a,c=u(t),f=c.length,p="function"==typeof i,h=0;h<f;h++)a=c[h],r.subscribe(a,t[a]||a,p?i:i&&i[a])}return n=g(n,{on:t,off:t,reducers:t},{on:b,off:b,reducers:w}),i(r)?s(v(r)):s("string"==typeof r?v(r.split(/\s+/)):r),this},T.prototype.stopListeningTo=function(e,t){var r=this._observers;if(!r)return!1;var n,i=r.length,o=!1;if(e&&"object"!==l(e))throw TypeError("target should be an object");for(;i-- >0;)n=r[i],e&&n._target!==e||(n.unsubscribe(t),o=!0);return o},T.prototype.delimiter=".",T.prototype.setMaxListeners=function(e){e!==t&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},T.prototype.getMaxListeners=function(){return this._maxListeners},T.prototype.event="",T.prototype.once=function(e,t,r){return this._once(e,t,!1,r)},T.prototype.prependOnceListener=function(e,t,r){return this._once(e,t,!0,r)},T.prototype._once=function(e,t,r,n){return this._many(e,1,t,r,n)},T.prototype.many=function(e,t,r,n){return this._many(e,t,r,!1,n)},T.prototype.prependMany=function(e,t,r,n){return this._many(e,t,r,!0,n)},T.prototype._many=function(e,t,r,n,i){var o=this;if("function"!=typeof r)throw new Error("many only accepts instances of Function");function s(){return 0==--t&&o.off(e,s),r.apply(this,arguments)}return s._origin=r,this._on(e,s,n,i)},T.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||f.call(this);var e,t,r,n,i,o,a=arguments[0],c=this.wildcard;if("newListener"===a&&!this._newListener&&!this._events.newListener)return!1;if(c&&(e=a,"newListener"!==a&&"removeListener"!==a&&"object"===l(a))){if(r=a.length,s)for(n=0;n<r;n++)if("symbol"===l(a[n])){o=!0;break}o||(a=a.join(this.delimiter))}var u,p=arguments.length;if(this._all&&this._all.length)for(n=0,r=(u=this._all.slice()).length;n<r;n++)switch(this.event=a,p){case 1:u[n].call(this,a);break;case 2:u[n].call(this,a,arguments[1]);break;case 3:u[n].call(this,a,arguments[1],arguments[2]);break;default:u[n].apply(this,arguments)}if(c)u=[],j.call(this,u,e,this.listenerTree,0,r);else{if("function"==typeof(u=this._events[a])){switch(this.event=a,p){case 1:u.call(this);break;case 2:u.call(this,arguments[1]);break;case 3:u.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(p-1),i=1;i<p;i++)t[i-1]=arguments[i];u.apply(this,t)}return!0}u&&(u=u.slice())}if(u&&u.length){if(p>3)for(t=new Array(p-1),i=1;i<p;i++)t[i-1]=arguments[i];for(n=0,r=u.length;n<r;n++)switch(this.event=a,p){case 1:u[n].call(this);break;case 2:u[n].call(this,arguments[1]);break;case 3:u[n].call(this,arguments[1],arguments[2]);break;default:u[n].apply(this,t)}return!0}if(!this.ignoreErrors&&!this._all&&"error"===a)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},T.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||f.call(this);var e,t,r,n,i,o,a=arguments[0],c=this.wildcard;if("newListener"===a&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(c&&(e=a,"newListener"!==a&&"removeListener"!==a&&"object"===l(a))){if(n=a.length,s)for(i=0;i<n;i++)if("symbol"===l(a[i])){t=!0;break}t||(a=a.join(this.delimiter))}var u,p=[],h=arguments.length;if(this._all)for(i=0,n=this._all.length;i<n;i++)switch(this.event=a,h){case 1:p.push(this._all[i].call(this,a));break;case 2:p.push(this._all[i].call(this,a,arguments[1]));break;case 3:p.push(this._all[i].call(this,a,arguments[1],arguments[2]));break;default:p.push(this._all[i].apply(this,arguments))}if(c?(u=[],j.call(this,u,e,this.listenerTree,0)):u=this._events[a],"function"==typeof u)switch(this.event=a,h){case 1:p.push(u.call(this));break;case 2:p.push(u.call(this,arguments[1]));break;case 3:p.push(u.call(this,arguments[1],arguments[2]));break;default:for(r=new Array(h-1),o=1;o<h;o++)r[o-1]=arguments[o];p.push(u.apply(this,r))}else if(u&&u.length){if(u=u.slice(),h>3)for(r=new Array(h-1),o=1;o<h;o++)r[o-1]=arguments[o];for(i=0,n=u.length;i<n;i++)switch(this.event=a,h){case 1:p.push(u[i].call(this));break;case 2:p.push(u[i].call(this,arguments[1]));break;case 3:p.push(u[i].call(this,arguments[1],arguments[2]));break;default:p.push(u[i].apply(this,r))}}else if(!this.ignoreErrors&&!this._all&&"error"===a)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(p)},T.prototype.on=function(e,t,r){return this._on(e,t,!1,r)},T.prototype.prependListener=function(e,t,r){return this._on(e,t,!0,r)},T.prototype.onAny=function(e){return this._onAny(e,!1)},T.prototype.prependAny=function(e){return this._onAny(e,!0)},T.prototype.addListener=T.prototype.on,T.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},T.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||f.call(this);var o,s=this;return i!==t&&(r=(o=k.call(this,e,r,i))[0],s=o[1]),this._newListener&&this.emit("newListener",e,r),this.wildcard?(E.call(this,e,r,n),s):(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,s)},T.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r,n=[];if(this.wildcard){var o="string"==typeof e?e.split(this.delimiter):e.slice();if(!(n=j.call(this,null,o,this.listenerTree,0)))return this}else{if(!this._events[e])return this;r=this._events[e],n.push({_listeners:r})}for(var s=0;s<n.length;s++){var a=n[s];if(r=a._listeners,i(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?a._listeners.splice(l,1):this._events[e].splice(l,1),0===r.length&&(this.wildcard?delete a._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 a._listeners:delete this._events[e],this._removeListener&&this.emit("removeListener",e,t))}return this.listenerTree&&O(this.listenerTree),this},T.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},T.prototype.removeListener=T.prototype.off,T.prototype.removeAllListeners=function(e){if(e===t)return!this._events||f.call(this),this;if(this.wildcard){var r,n=j.call(this,null,e,this.listenerTree,0);if(!n)return this;for(r=0;r<n.length;r++)n[r]._listeners=null;this.listenerTree&&O(this.listenerTree)}else this._events&&(this._events[e]=null);return this},T.prototype.listeners=function(e){var r,n,i,o,s,a=this._events;if(e===t){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!a)return[];for(o=(r=u(a)).length,i=[];o-- >0;)"function"==typeof(n=a[r[o]])?i.push(n):i.push.apply(i,n);return i}if(this.wildcard){if(!(s=this.listenerTree))return[];var l=[],c="string"==typeof e?e.split(this.delimiter):e.slice();return j.call(this,l,c,s,0),l}return a&&(n=a[e])?"function"==typeof n?[n]:n:[]},T.prototype.eventNames=function(e){var t=this._events;return this.wildcard?x.call(this,this.listenerTree,[],null,e):t?u(t):[]},T.prototype.listenerCount=function(e){return this.listeners(e).length},T.prototype.hasListeners=function(e){if(this.wildcard){var r=[],n="string"==typeof e?e.split(this.delimiter):e.slice();return j.call(this,r,n,this.listenerTree,0),r.length>0}var i=this._events,o=this._all;return!!(o&&o.length||i&&(e===t?u(i).length:i[e]))},T.prototype.listenersAny=function(){return this._all?this._all:[]},T.prototype.waitFor=function(e,r){var n=this,i=l(r);return"number"===i?r={timeout:r}:"function"===i&&(r={filter:r}),S((r=g(r,{timeout:0,filter:t,handleError:!1,Promise:Promise,overload:!1},{filter:b,Promise:_})).Promise,(function(t,i,o){function s(){var o=r.filter;if(!o||o.apply(n,arguments))if(n.off(e,s),r.handleError){var a=arguments[0];a?i(a):t(d.apply(null,arguments).slice(1))}else t(d.apply(null,arguments))}o((function(){n.off(e,s)})),n._on(e,s,!1)}),{timeout:r.timeout,overload:r.overload})};var P=T.prototype;Object.defineProperties(T,{defaultMaxListeners:{get:function(){return P._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");P._maxListeners=e},enumerable:!0},once:{value:function(e,t,r){return S((r=g(r,{Promise:Promise,timeout:0,overload:!1},{Promise:_})).Promise,(function(r,n,i){var o;if("function"==typeof e.addEventListener)return o=function(){r(d.apply(null,arguments))},i((function(){e.removeEventListener(t,o)})),void e.addEventListener(t,o,{once:!0});var s,a=function(){s&&e.removeListener("error",s),r(d.apply(null,arguments))};"error"!==t&&(s=function(r){e.removeListener(t,a),n(r)},e.once("error",s)),i((function(){s&&e.removeListener("error",s),e.removeListener(t,a)})),e.once(t,a)}),{timeout:r.timeout,overload:r.overload})},writable:!0,configurable:!0}}),Object.defineProperties(P,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),"function"==typeof t&&t.amd?t((function(){return T})):e.exports=T}()}(Pt);var Ft=function(e){function t(){var t=this;return(t=e.call(this,{wildcard:!0,delimiter:"::",newListener:!1,removeListener:!1,maxListeners:10,verboseMemoryLeak:!1,ignoreErrors:!1})||this).delimiter="::","undefined"!=typeof document&&(t.body=document.querySelector("body")),t.logableEvents=["cart::item.added.failed","cart::item.deleted.failed"],t.ingoreLogEvents=["document::click","document::keyup","document::change"],t.noneFireableActions=["document.request"],t}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}jt(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(t,e),t.prototype.createAndDispatch=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this.dispatch.apply(this,xt([e],t,!1))},t.prototype.emit=function(t){for(var r,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var o=t.replace("::",".");if(!this.noneFireableActions.includes(o)&&Salla.call&&"function"==typeof Salla.call(o))return Salla.log("'Salla.".concat(o,"(...)' triggered using event '").concat(t,"'")),o=o.split("."),Array.isArray(n[0])&&(n=n[0]),void(r=salla[o[0]])[o[1]].apply(r,n);e.prototype.emit.apply(this,xt([t],n,!1)),this.trackEvents.apply(this,xt([t],n,!1))},t.prototype.emitAsync=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=e.prototype.emitAsync.apply(this,xt([t],r,!1));try{this.trackEvents.apply(this,xt([t],r,!1))}catch(e){Salla.logger.warn("error on tracking event (".concat(t,")"),r,e)}return i},t.prototype.trackEvents=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];if("undefined"!=typeof window)try{window.dataLayer=window.dataLayer||[];var i={event:e};r.map((function(e){return"object"==typeof e&&(i=Et(Et({},i),e))})),window.dataLayer.push(i)}catch(e){salla.logger.error(e.message)}Salla.logger&&!this.ingoreLogEvents.includes(e)&&(t=Salla.logger).event.apply(t,xt([e],r,!1)),this.dispatchMobileEvent.apply(this,xt([e],r,!1))},t.prototype.dispatch=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return this.emit.apply(this,xt([e],t,!1))},t.prototype.dispatchEvents=function(e){if(e)if("object"!=typeof e||Array.isArray(e))Salla.log("Events object is wrong, it should be object of {event:payload}",e);else for(var t=0,r=Object.entries(e);t<r.length;t++){var n=r[t],i=n[0],o=n[1];this.dispatch(i,o)}else Salla.log("No Events To Dispatch!",e)},t.prototype.addListener=function(e,t,r){return this.on(e,t,r)},t.prototype.addEventListener=function(e,t,r){return this.on(e,t,r)},t.prototype.listen=function(e,t){return this.on(e,t)},t.prototype.registerGlobalListener=function(e,t){return this.onAny(t)},t.prototype.dispatchMobileEvent=function(e,t){if(void 0===t&&(t={}),!("undefined"!=typeof window&&window.dataLayer&&window.dataLayer[0]&&window.dataLayer[0].page&&window.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(void 0!==window.Android)try{window.Android.customEventWithData(e,JSON.stringify({details:t}))}catch(e){Salla.log(e,"The native context does not exist yet")}},t}(Pt.exports.EventEmitter2),Nt=Object.assign?Object.assign:function(e,t,r,n){for(var i=1;i<arguments.length;i++)It(Object(arguments[i]),(function(t,r){e[r]=t}));return e},Rt=function(){if(Object.create)return function(e,t,r,n){var i=Mt(arguments,1);return Nt.apply(this,[Object.create(e)].concat(i))};var e=function(){};return function(t,r,n,i){var o=Mt(arguments,1);return e.prototype=t,Nt.apply(this,[new e].concat(o))}}(),zt=String.prototype.trim?function(e){return String.prototype.trim.call(e)}:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},$t="undefined"!=typeof window?window:s,Ct={assign:Nt,create:Rt,trim:zt,bind:function(e,t){return function(){return t.apply(e,Array.prototype.slice.call(arguments,0))}},slice:Mt,each:It,map:function(e,t){var r=Dt(e)?[]:{};return Ut(e,(function(e,n){return r[n]=t(e,n),!1})),r},pluck:Ut,isList:Dt,isFunction:function(e){return e&&"[object Function]"==={}.toString.call(e)},isObject:function(e){return e&&"[object Object]"==={}.toString.call(e)},Global:$t};function Mt(e,t){return Array.prototype.slice.call(e,t||0)}function It(e,t){Ut(e,(function(e,r){return t(e,r),!1}))}function Ut(e,t){if(Dt(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 Dt(e){return null!=e&&"function"!=typeof e&&"number"==typeof e.length}var Wt=Ct.slice,Gt=Ct.pluck,Jt=Ct.each,qt=Ct.bind,Zt=Ct.create,Ht=Ct.isList,Kt=Ct.isFunction,Bt=Ct.isObject,Qt={createStore:Xt},Vt={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 Xt.apply(this,arguments)},addPlugin:function(e){this._addPlugin(e)},namespace:function(e){return Xt(this.storage,this.plugins,e)}};function Xt(e,t,r){r||(r=""),e&&!Ht(e)&&(e=[e]),t&&!Ht(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 o={_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=Wt(arguments,0),n=this;var i=[function(){if(r)return Jt(arguments,(function(e,r){t[r]=e})),r.apply(n,t)}].concat(t);return e.apply(n,i)}},_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(Ht(e))Jt(e,(function(e){t._addPlugin(e)}));else if(!Gt(this.plugins,(function(t){return e===t}))){if(this.plugins.push(e),!Kt(e))throw new Error("Plugins must be function values that return objects");var r=e.call(this);if(!Bt(r))throw new Error("Plugins must return an object of function properties");Jt(r,(function(r,n){if(!Kt(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;e&&(e.warn?e.warn:e.log).apply(e,arguments)}("store.addStorage(storage) is deprecated. Use createStore([storages])"),this._addStorage(e)}},s=Zt(o,Vt,{plugins:[]});return s.raw={},Jt(s,(function(e,t){Kt(e)&&(s.raw[t]=qt(s,e))})),Jt(e,(function(e){s._addStorage(e)})),Jt(t,(function(e){s._addPlugin(e)})),s}var Yt=Ct.Global,er={name:"localStorage",read:rr,write:function(e,t){return tr().setItem(e,t)},each:function(e){for(var t=tr().length-1;t>=0;t--){var r=tr().key(t);e(rr(r),r)}},remove:function(e){return tr().removeItem(e)},clearAll:function(){return tr().clear()}};function tr(){return Yt.localStorage}function rr(e){return tr().getItem(e)}var nr=r({__proto__:null,default:er},[er]),ir=Ct.Global,or={name:"sessionStorage",read:ar,write:function(e,t){return sr().setItem(e,t)},each:function(e){for(var t=sr().length-1;t>=0;t--){var r=sr().key(t);e(ar(r),r)}},remove:function(e){return sr().removeItem(e)},clearAll:function(){return sr().clear()}};function sr(){return ir.sessionStorage}function ar(e){return sr().getItem(e)}var lr=r({__proto__:null,default:or},[or]),cr=Ct.trim,ur={name:"cookieStorage",read:function(e){if(!e||!dr(e))return null;var t="(?:^|.*;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(fr.cookie.replace(new RegExp(t),"$1"))},write:function(e,t){if(!e)return;fr.cookie=escape(e)+"="+escape(t)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/"},each:pr,remove:hr,clearAll:function(){pr((function(e,t){hr(t)}))}},fr=Ct.Global.document;function pr(e){for(var t=fr.cookie.split(/; ?/g),r=t.length-1;r>=0;r--)if(cr(t[r])){var n=t[r].split("="),i=unescape(n[0]);e(unescape(n[1]),i)}}function hr(e){e&&dr(e)&&(fr.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function dr(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(fr.cookie)}var vr=r({__proto__:null,default:ur},[ur]),yr={name:"memoryStorage",read:function(e){return gr[e]},write:function(e,t){gr[e]=t},each:function(e){for(var t in gr)gr.hasOwnProperty(t)&&e(gr[t],t)},remove:function(e){delete gr[e]},clearAll:function(e){gr={}}},gr={};var _r=r({__proto__:null,default:yr},[yr]),mr=Qt.createStore([nr,lr,vr,_r],[]),br=function(){function e(){var e=this;Salla.event.on("storage::item.remove",(function(t){return e.remove(t)})),Salla.event.on("storage::item.set",(function(t,r){return e.set(t,r)})),this.store=mr}return e.prototype.set=function(e,t){var r;if(e.includes(".")){var n=e.split(".")[0],i=((r={})[n]=this.store.get(n),r);return i=Salla.helpers.setNested(i,e,t),this.store.set(n,i[n])}return this.store.set(e,t)},e.prototype.remove=function(e){return this.store.remove(e)},e.prototype.clearAll=function(){return this.store.clearAll()},e.prototype.get=function(e,t){var r;if(e.includes(".")){var n=e.split(".")[0];return Salla.helpers.getNested(((r={})[n]=this.store.get(n),r),e)}return this.store.get(e,t)},e}(),wr=function(){function e(){var e=this;Salla.event.on("cookies::remove",(function(t){return e.remove(t)})),Salla.event.on("cookies::add",(function(t,r){return e.set(t,r)}))}return e.prototype.get=function(e){var t;return null===(t=document.cookie.split("; ").find((function(t){return t.startsWith(e+"=")})))||void 0===t?void 0:t.split("=")[1]},e.prototype.set=function(e,t,r){void 0===t&&(t=""),void 0===r&&(r=10);var n="";if(r){var i=new Date;i.setTime(i.getTime()+24*r*60*60*1e3),n="; expires="+i.toUTCString()}return document.cookie="".concat(e,"=").concat(t).concat(n,'"; path=/; secure; SameSite=Lax"'),this},e.prototype.remove=function(e){return document.cookie="".concat(e,"=; Max-Age=0; path=/;"),this},e.prototype.clearAll=function(){for(var e=document.cookie.split(";"),t=0;t<e.length;t++){var r=e[t],n=r.indexOf("="),i=n>-1?r.substr(0,n):r;this.remove(i)}},e}();return"undefined"!=typeof window&&(window.salla=window.salla||window.Salla||{},window.Salla=window.salla),"undefined"!=typeof global&&(global.salla=global.salla||global.Salla||{},global.Salla=global.salla),Salla.status="base",Salla.config=new Tt,Salla.logger=kt,Salla.event=new Ft,Salla.helpers=Lt,Salla.storage=new br,Salla.cookie=new wr,Salla.log=Salla.logger.log,Salla.money=Salla.helpers.money,Salla.url=Salla.helpers.url,Salla.versions={base:"2.12.29"},Salla}));
2
2
  //# sourceMappingURL=base.min.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salla.sa/base",
3
- "version": "2.12.29",
3
+ "version": "2.12.30",
4
4
  "description": "Salla Base",
5
5
  "main": "dist/cjs/",
6
6
  "module": "dist/esm/",
@@ -61,5 +61,5 @@
61
61
  "sinon": "^15.0.1",
62
62
  "tslib": "^2.6.1"
63
63
  },
64
- "gitHead": "21f5ec9da8a79351d0e27054b3a80cf15405a41b"
64
+ "gitHead": "a4203f1c5c9d61337f321efc079c226c5431b60a"
65
65
  }