@salla.sa/base 2.11.123 → 2.11.126

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}}var r=t(e);function n(e,t=!1){e+="";let 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;for(let t=0;t<o.length;t++)r=new RegExp(o[t],"g"),e=e.replace(r,s[t]);return e.replace(t?"٫":".",t?".":"٫")}function i(e){let t=(`${e}`.match(/\./g)||[]).length;return t&&1!==t?i(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:"#"+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)};var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},s=Array.isArray,a="object"==typeof o&&o&&o.Object===Object&&o,l="object"==typeof self&&self&&self.Object===Object&&self,c=a||l||Function("return this")(),u=c.Symbol,f=u,h=Object.prototype,p=h.hasOwnProperty,d=h.toString,v=f?f.toStringTag:void 0;var g=function(e){var t=p.call(e,v),r=e[v];try{e[v]=void 0;var n=!0}catch(e){}var i=d.call(e);return n&&(t?e[v]=r:delete e[v]),i},y=Object.prototype.toString;var _=g,m=function(e){return y.call(e)},b=u?u.toStringTag:void 0;var w=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":b&&b in Object(e)?_(e):m(e)};var L=w,S=function(e){return null!=e&&"object"==typeof e};var j=function(e){return"symbol"==typeof e||S(e)&&"[object Symbol]"==L(e)},E=s,x=j,k=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,A=/^\w*$/;var O=function(e,t){if(E(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!x(e))||(A.test(e)||!k.test(e)||null!=t&&e in Object(t))};var T=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},P=w,$=T;var F,N=function(e){if(!$(e))return!1;var t=P(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},R=c["__core-js_shared__"],z=(F=/[^.]+$/.exec(R&&R.keys&&R.keys.IE_PROTO||""))?"Symbol(src)_1."+F:"";var M=function(e){return!!z&&z in e},C=Function.prototype.toString;var I=N,U=M,W=T,D=function(e){if(null!=e){try{return C.call(e)}catch(e){}try{return e+""}catch(e){}}return""},G=/^\[object .+?Constructor\]$/,J=Function.prototype,q=Object.prototype,Z=J.toString,H=q.hasOwnProperty,K=RegExp("^"+Z.call(H).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var B=function(e){return!(!W(e)||U(e))&&(I(e)?K:G).test(D(e))},Q=function(e,t){return null==e?void 0:e[t]};var V=function(e,t){var r=Q(e,t);return B(r)?r:void 0},X=V(Object,"create"),Y=X;var ee=function(){this.__data__=Y?Y(null):{},this.size=0};var te=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},re=X,ne=Object.prototype.hasOwnProperty;var ie=function(e){var t=this.__data__;if(re){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return ne.call(t,e)?t[e]:void 0},oe=X,se=Object.prototype.hasOwnProperty;var ae=X;var le=ee,ce=te,ue=ie,fe=function(e){var t=this.__data__;return oe?void 0!==t[e]:se.call(t,e)},he=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ae&&void 0===t?"__lodash_hash_undefined__":t,this};function pe(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])}}pe.prototype.clear=le,pe.prototype.delete=ce,pe.prototype.get=ue,pe.prototype.has=fe,pe.prototype.set=he;var de=pe;var ve=function(){this.__data__=[],this.size=0};var ge=function(e,t){return e===t||e!=e&&t!=t};var ye=function(e,t){for(var r=e.length;r--;)if(ge(e[r][0],t))return r;return-1},_e=ye,me=Array.prototype.splice;var be=ye;var we=ye;var Le=ye;var Se=ve,je=function(e){var t=this.__data__,r=_e(t,e);return!(r<0)&&(r==t.length-1?t.pop():me.call(t,r,1),--this.size,!0)},Ee=function(e){var t=this.__data__,r=be(t,e);return r<0?void 0:t[r][1]},xe=function(e){return we(this.__data__,e)>-1},ke=function(e,t){var r=this.__data__,n=Le(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function Ae(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])}}Ae.prototype.clear=Se,Ae.prototype.delete=je,Ae.prototype.get=Ee,Ae.prototype.has=xe,Ae.prototype.set=ke;var Oe=Ae,Te=V(c,"Map"),Pe=de,$e=Oe,Fe=Te;var Ne=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Re=function(e,t){var r=e.__data__;return Ne(t)?r["string"==typeof t?"string":"hash"]:r.map},ze=Re;var Me=Re;var Ce=Re;var Ie=Re;var Ue=function(){this.size=0,this.__data__={hash:new Pe,map:new(Fe||$e),string:new Pe}},We=function(e){var t=ze(this,e).delete(e);return this.size-=t?1:0,t},De=function(e){return Me(this,e).get(e)},Ge=function(e){return Ce(this,e).has(e)},Je=function(e,t){var r=Ie(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function qe(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])}}qe.prototype.clear=Ue,qe.prototype.delete=We,qe.prototype.get=De,qe.prototype.has=Ge,qe.prototype.set=Je;var Ze=qe;function He(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],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(He.Cache||Ze),r}He.Cache=Ze;var Ke=He;var Be=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qe=/\\(\\)?/g,Ve=function(e){var t=Ke(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(Be,(function(e,r,n,i){t.push(n?i.replace(Qe,"$1"):r||e)})),t})),Xe=Ve;var Ye=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},et=s,tt=j,rt=u?u.prototype:void 0,nt=rt?rt.toString:void 0;var it=function e(t){if("string"==typeof t)return t;if(et(t))return Ye(t,e)+"";if(tt(t))return nt?nt.call(t):"";var r=t+"";return"0"==r&&1/t==-Infinity?"-0":r},ot=it;var st=s,at=O,lt=Xe,ct=function(e){return null==e?"":ot(e)};var ut=j;var ft=function(e,t){return st(e)?e:at(e,t)?[e]:lt(ct(e))},ht=function(e){if("string"==typeof e||ut(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var pt=function(e,t){for(var r=0,n=(t=ft(t,e)).length;null!=e&&r<n;)e=e[ht(t[r++])];return r&&r==n?e:void 0};var dt=function(e,t,r){var n=null==e?void 0:pt(e,t);return void 0===n?r:n};function vt(e){return`${e}`.startsWith("https://")||`${e}`.startsWith("http://")}function gt(e){if(vt(e))return e;let 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("/")+"/"+e?.ltrim("/")}function yt(e,t,r){if(r=r||window.location.href,!t||!e)return r;let 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 _t(e){return window.location.origin+"/"+e?.ltrim("/")}function mt(e){return vt(e)?e:Salla.config.get("theme.assets")?Salla.config.get("theme.assets").replace(":path",e?.ltrim("/")):_t("themes/"+Salla.config.get("theme.name")+"/"+e?.ltrim("/"))}function bt(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]=bt(e.slice(1),t,r[n]),r):n?{[n]:bt(e.slice(1),t)}:""===n?[t]:t}var wt={digitsOnly:function(e){return n(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<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")?i(n):n.replace(/\D/g,"")},number:n,money:function(e){let t=Salla.config.currency(e?.currency).symbol;return n(e="object"==typeof e?e.amount:e)+" "+t},setNested:function(e,t,r){let n=e,i=t.split("."),o=i.length;for(let e=0;e<o-1;e++){let t=i[e];n[t]||(n[t]={}),n=n[t]}return n[i[o-1]]=r,e},getNested:function(e,t,r){let n=dt(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:bt(n.slice(1),t,r[n[0]])}}return{name:e,value:t}},url:Object.freeze({__proto__:null,is_full_url:vt,base:function(e){if(vt(e))return e;const{hostname:t}=new URL(gt("/"));return"https://"+t+"/"+e?.ltrim("/")},get:gt,domain:function(e){return vt(e)?e:Salla.config.get("store.url",window.location.href.split("/").slice(0,-1).join("/")).rtrim("/")+"/"+e?.ltrim("/")},addParamToUrl:yt,baseUrl:_t,asset:mt,cdn:function(e){return"https://cdn.salla.network/"+e?.ltrim("/")},api:function(e){return Salla.config.get("store.api",gt(""))?.rtrim("/")+"/"+e?.ltrim("/")},is_page:function(e){return e&&Salla.config.get("page.slug")===e},is_placeholder:function(e){return mt(salla.config.get("theme.settings.placeholder"))===mt(e)}}),addParamToUrl:yt,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)))}}},Lt=function(e){let t={log:function(t,r){if(!e)return;if(!salla.config.isDebug())return;"trace"===salla.config.get("debug")&&(r="trace");let n=e.log,i=void 0===r?n:this.__dict__[r]||n,o=["%cTwilight","color: #5cd5c4;font-weight:bold; border:1px solid #5cd5c4; padding: 2px 6px; border-radius: 5px;"],s={event:"#CFF680",backend:"#7b68ee"}[r];s&&(o[0]+="%c"+r[0].toUpperCase()+r.substring(1),o.push(`margin-left: 5px;color: ${s};font-weight:bold; border:1px solid ${s}; padding: 2px 6px; border-radius: 5px;`)),i.call(e,...o.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);var St={exports:{}};!function(e,t){!function(t){var n=Object.hasOwnProperty,i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},o="object"==typeof r.default&&"function"==typeof r.default.nextTick,s="function"==typeof Symbol,a="object"==typeof Reflect,l="function"==typeof setImmediate?setImmediate:setTimeout,c=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 u(){this._events={},this._conf&&f.call(this,this._conf)}function f(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 n="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(n+=" Event name: "+t+"."),void 0!==r.default&&r.default.emitWarning){var i=new Error(n);i.name="MaxListenersExceededWarning",i.emitter=this,i.count=e,r.default.emitWarning(i)}else console.error(n),console.trace&&console.trace()}var p=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 d(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 v(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,r,i,o){var s=Object.assign({},r);if(!e)return s;if("object"!=typeof e)throw TypeError("options must be an object");var a,l,c,u=Object.keys(e),f=u.length;function h(e){throw Error('Invalid "'+a+'" option value'+(e?". Reason: "+e:""))}for(var p=0;p<f;p++){if(a=u[p],!o&&!n.call(r,a))throw Error('Unknown "'+a+'" option');(l=e[a])!==t&&(c=i[a],s[a]=c?c(l,h):l)}return s}function y(e,t){return"function"==typeof e&&e.hasOwnProperty("prototype")||t("value must be a constructor"),e}function _(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 o=typeof e;if(o===n||o===i)return e;r(t)}:function(n,i){for(var o=typeof n,s=r;s-- >0;)if(o===e[s])return n;i(t)}}Object.assign(v.prototype,{subscribe:function(e,t,r){var n=this,i=this._target,o=this._emitter,s=this._listeners,a=function(){var n=p.apply(null,arguments),s={data:n,name:t,original:e};if(r){var a=r.call(i,s);!1!==a&&o.emit.apply(o,[s.name].concat(n))}else 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 u(){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||u()}else{for(n=(r=c(o)).length;n-- >0;)e=r[n],a.call(l,e,o[e]);this._listeners={},this._listenersCount=0,u()}}});var m=_(["function"]),b=_(["object","function"]);function w(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 h=function(e){f(),l(e)},p=function(e){f(),c(e)};n?t(h,p,u):(i=[function(e){p(e||Error("canceled"))}],t(h,p,(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 S(e,t,r,n,i){if(!r)return null;if(0===n){var o=typeof t;if("string"===o){var s,a,l=0,u=0,f=this.delimiter,h=f.length;if(-1!==(a=t.indexOf(f))){s=new Array(5);do{s[l++]=t.slice(u,a),u=a+h}while(-1!==(a=t.indexOf(f,u)));s[l++]=t.slice(u),t=s,i=l}else t=[t],i=1}else"object"===o?i=t.length:(t=[t],i=1)}var p,d,v,g,y,_,m,b=null,w=t[n],L=t[n+1];if(n===i)r._listeners&&("function"==typeof r._listeners?(e&&e.push(r._listeners),b=[r]):(e&&e.push.apply(e,r._listeners),b=[r]));else{if("*"===w){for(a=(_=c(r)).length;a-- >0;)"_listeners"!==(p=_[a])&&(m=S(e,t,r[p],n+1,i))&&(b?b.push.apply(b,m):b=m);return b}if("**"===w){for((y=n+1===i||n+2===i&&"*"===L)&&r._listeners&&(b=S(e,t,r,i,i)),a=(_=c(r)).length;a-- >0;)"_listeners"!==(p=_[a])&&("*"===p||"**"===p?(r[p]._listeners&&!y&&(m=S(e,t,r[p],i,i))&&(b?b.push.apply(b,m):b=m),m=S(e,t,r[p],n,i)):m=S(e,t,r[p],p===L?n+2:n,i),m&&(b?b.push.apply(b,m):b=m));return b}r[w]&&(b=S(e,t,r[w],n+1,i))}if((d=r["*"])&&S(e,t,d,n+1,i),v=r["**"])if(n<i)for(v._listeners&&S(e,t,v,i,i),a=(_=c(v)).length;a-- >0;)"_listeners"!==(p=_[a])&&(p===L?S(e,t,v[p],n+2,i):p===w?S(e,t,v[p],n+1,i):((g={})[p]=v[p],S(e,t,{"**":g},n+1,i)));else v._listeners?S(e,t,v,i,i):v["*"]&&v["*"]._listeners&&S(e,t,v["*"],i,i);return b}function j(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 E(e,t,r,n){for(var i,o,s,a,l=c(e),u=l.length,f=e._listeners;u-- >0;)i=e[o=l[u]],s="_listeners"===o?r:r?r.concat(o):[o],a=n||"symbol"==typeof o,f&&t.push(a?s:s.join(this.delimiter)),"object"==typeof i&&E.call(this,i,t,s,a);return t}function x(e){for(var t,r,n,i=c(e),o=i.length;o-- >0;)(t=e[r=i[o]])&&(n=!0,"_listeners"===r||x(t)||delete e[r]);return n}function k(e,t,r){this.emitter=e,this.event=t,this.listener=r}function A(e,n,i){if(!0===i)a=!0;else if(!1===i)s=!0;else{if(!i||"object"!=typeof i)throw TypeError("options should be an object or true");var s=i.async,a=i.promisify,c=i.nextTick,u=i.objectify}if(s||c||a){var f=n,h=n._origin||n;if(c&&!o)throw Error("process.nextTick is not supported");a===t&&(a="AsyncFunction"===n.constructor.name),n=function(){var e=arguments,t=this,n=this.event;return a?c?Promise.resolve():new Promise((function(e){l(e)})).then((function(){return t.event=n,f.apply(t,e)})):(c?r.default.nextTick:l)((function(){t.event=n,f.apply(t,e)}))},n._async=!0,n._origin=h}return[n,u?new k(this,e,n):this]}function O(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,f.call(this,e)}k.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},O.EventEmitter2=O,O.prototype.listenTo=function(e,r,n){if("object"!=typeof e)throw TypeError("target musts be an object");var o=this;function s(t){if("object"!=typeof t)throw TypeError("events must be an object");var r,i=n.reducers,s=L.call(o,e);r=-1===s?new v(o,e,n):o._observers[s];for(var a,l=c(t),u=l.length,f="function"==typeof i,h=0;h<u;h++)a=l[h],r.subscribe(a,t[a]||a,f?i:i&&i[a])}return n=g(n,{on:t,off:t,reducers:t},{on:m,off:m,reducers:b}),i(r)?s(d(r)):s("string"==typeof r?d(r.split(/\s+/)):r),this},O.prototype.stopListeningTo=function(e,t){var r=this._observers;if(!r)return!1;var n,i=r.length,o=!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),o=!0);return o},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 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)},O.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||u.call(this);var e,t,r,n,i,o,a=arguments[0],l=this.wildcard;if("newListener"===a&&!this._newListener&&!this._events.newListener)return!1;if(l&&(e=a,"newListener"!==a&&"removeListener"!==a&&"object"==typeof a)){if(r=a.length,s)for(n=0;n<r;n++)if("symbol"==typeof a[n]){o=!0;break}o||(a=a.join(this.delimiter))}var c,f=arguments.length;if(this._all&&this._all.length)for(n=0,r=(c=this._all.slice()).length;n<r;n++)switch(this.event=a,f){case 1:c[n].call(this,a);break;case 2:c[n].call(this,a,arguments[1]);break;case 3:c[n].call(this,a,arguments[1],arguments[2]);break;default:c[n].apply(this,arguments)}if(l)c=[],S.call(this,c,e,this.listenerTree,0,r);else{if("function"==typeof(c=this._events[a])){switch(this.event=a,f){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(f-1),i=1;i<f;i++)t[i-1]=arguments[i];c.apply(this,t)}return!0}c&&(c=c.slice())}if(c&&c.length){if(f>3)for(t=new Array(f-1),i=1;i<f;i++)t[i-1]=arguments[i];for(n=0,r=c.length;n<r;n++)switch(this.event=a,f){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"===a)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,o,a=arguments[0],l=this.wildcard;if("newListener"===a&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(l&&(e=a,"newListener"!==a&&"removeListener"!==a&&"object"==typeof a)){if(n=a.length,s)for(i=0;i<n;i++)if("symbol"==typeof a[i]){t=!0;break}t||(a=a.join(this.delimiter))}var c,f=[],h=arguments.length;if(this._all)for(i=0,n=this._all.length;i<n;i++)switch(this.event=a,h){case 1:f.push(this._all[i].call(this,a));break;case 2:f.push(this._all[i].call(this,a,arguments[1]));break;case 3:f.push(this._all[i].call(this,a,arguments[1],arguments[2]));break;default:f.push(this._all[i].apply(this,arguments))}if(l?(c=[],S.call(this,c,e,this.listenerTree,0)):c=this._events[a],"function"==typeof c)switch(this.event=a,h){case 1:f.push(c.call(this));break;case 2:f.push(c.call(this,arguments[1]));break;case 3:f.push(c.call(this,arguments[1],arguments[2]));break;default:for(r=new Array(h-1),o=1;o<h;o++)r[o-1]=arguments[o];f.push(c.apply(this,r))}else if(c&&c.length){if(c=c.slice(),h>3)for(r=new Array(h-1),o=1;o<h;o++)r[o-1]=arguments[o];for(i=0,n=c.length;i<n;i++)switch(this.event=a,h){case 1:f.push(c[i].call(this));break;case 2:f.push(c[i].call(this,arguments[1]));break;case 3:f.push(c[i].call(this,arguments[1],arguments[2]));break;default:f.push(c[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(f)},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 o,s=this;return i!==t&&(r=(o=A.call(this,e,r,i))[0],s=o[1]),this._newListener&&this.emit("newListener",e,r),this.wildcard?(j.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)},O.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=S.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&&x(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=S.call(this,null,e,this.listenerTree,0);if(!n)return this;for(r=0;r<n.length;r++)n[r]._listeners=null;this.listenerTree&&x(this.listenerTree)}else this._events&&(this._events[e]=null);return this},O.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=c(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=[],u="string"==typeof e?e.split(this.delimiter):e.slice();return S.call(this,l,u,s,0),l}return a&&(n=a[e])?"function"==typeof n?[n]:n:[]},O.prototype.eventNames=function(e){var t=this._events;return this.wildcard?E.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 S.call(this,r,n,this.listenerTree,0),r.length>0}var i=this._events,o=this._all;return!!(o&&o.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}),w((r=g(r,{timeout:0,filter:t,handleError:!1,Promise:Promise,overload:!1},{filter:m,Promise:y})).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(p.apply(null,arguments).slice(1))}else t(p.apply(null,arguments))}o((function(){n.off(e,s)})),n._on(e,s,!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 w((r=g(r,{Promise:Promise,timeout:0,overload:!1},{Promise:y})).Promise,(function(r,n,i){var o;if("function"==typeof e.addEventListener)return o=function(){r(p.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(p.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(T,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),e.exports=O}()}(St);var jt=St.exports;var Et=Object.assign?Object.assign:function(e,t,r,n){for(var i=1;i<arguments.length;i++)Pt(Object(arguments[i]),(function(t,r){e[r]=t}));return e},xt=function(){if(Object.create)return function(e,t,r,n){var i=Tt(arguments,1);return Et.apply(this,[Object.create(e)].concat(i))};{function e(){}return function(t,r,n,i){var o=Tt(arguments,1);return e.prototype=t,Et.apply(this,[new e].concat(o))}}}(),kt=String.prototype.trim?function(e){return String.prototype.trim.call(e)}:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},At="undefined"!=typeof window?window:o,Ot={assign:Et,create:xt,trim:kt,bind:function(e,t){return function(){return t.apply(e,Array.prototype.slice.call(arguments,0))}},slice:Tt,each:Pt,map:function(e,t){var r=Ft(e)?[]:{};return $t(e,(function(e,n){return r[n]=t(e,n),!1})),r},pluck:$t,isList:Ft,isFunction:function(e){return e&&"[object Function]"==={}.toString.call(e)},isObject:function(e){return e&&"[object Object]"==={}.toString.call(e)},Global:At};function Tt(e,t){return Array.prototype.slice.call(e,t||0)}function Pt(e,t){$t(e,(function(e,r){return t(e,r),!1}))}function $t(e,t){if(Ft(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 Ft(e){return null!=e&&"function"!=typeof e&&"number"==typeof e.length}var Nt=Ot.slice,Rt=Ot.pluck,zt=Ot.each,Mt=Ot.bind,Ct=Ot.create,It=Ot.isList,Ut=Ot.isFunction,Wt=Ot.isObject,Dt={createStore:Jt},Gt={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 Jt.apply(this,arguments)},addPlugin:function(e){this._addPlugin(e)},namespace:function(e){return Jt(this.storage,this.plugins,e)}};function Jt(e,t,r){r||(r=""),e&&!It(e)&&(e=[e]),t&&!It(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=Nt(arguments,0),n=this;function i(){if(r)return zt(arguments,(function(e,r){t[r]=e})),r.apply(n,t)}var o=[i].concat(t);return e.apply(n,o)}},_serialize:function(e){return JSON.stringify(e)},_deserialize:function(e,t){if(!e)return t;var r="";try{r=JSON.parse(e)}catch(t){r=e}return 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(It(e))zt(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(!Wt(r))throw new Error("Plugins must return an object of function properties");zt(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)}},s=Ct(o,Gt,{plugins:[]});return s.raw={},zt(s,(function(e,t){Ut(e)&&(s.raw[t]=Mt(s,e))})),zt(e,(function(e){s._addStorage(e)})),zt(t,(function(e){s._addPlugin(e)})),s}var qt=Ot.Global,Zt={name:"localStorage",read:Kt,write:function(e,t){return Ht().setItem(e,t)},each:function(e){for(var t=Ht().length-1;t>=0;t--){var r=Ht().key(t);e(Kt(r),r)}},remove:function(e){return Ht().removeItem(e)},clearAll:function(){return Ht().clear()}};function Ht(){return qt.localStorage}function Kt(e){return Ht().getItem(e)}var Bt=Ot.Global,Qt={name:"sessionStorage",read:Xt,write:function(e,t){return Vt().setItem(e,t)},each:function(e){for(var t=Vt().length-1;t>=0;t--){var r=Vt().key(t);e(Xt(r),r)}},remove:function(e){return Vt().removeItem(e)},clearAll:function(){return Vt().clear()}};function Vt(){return Bt.sessionStorage}function Xt(e){return Vt().getItem(e)}var Yt=Ot.trim,er={name:"cookieStorage",read:function(e){if(!e||!ir(e))return null;var t="(?:^|.*;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(tr.cookie.replace(new RegExp(t),"$1"))},write:function(e,t){if(!e)return;tr.cookie=escape(e)+"="+escape(t)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/"},each:rr,remove:nr,clearAll:function(){rr((function(e,t){nr(t)}))}},tr=Ot.Global.document;function rr(e){for(var t=tr.cookie.split(/; ?/g),r=t.length-1;r>=0;r--)if(Yt(t[r])){var n=t[r].split("="),i=unescape(n[0]);e(unescape(n[1]),i)}}function nr(e){e&&ir(e)&&(tr.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function ir(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(tr.cookie)}var or={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={};const ar=Dt.createStore([Zt,Qt,er,or],[]);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 class{constructor(e={},t={}){this.default_properties=t,this.properties_={...this.default_properties,...e}}merge(e){return this.properties_={...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)}currency(e){return e=e||this.get("user.currency_code"),this.get("currencies."+e)||Object.values(this.get("currencies"))[0]}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_}isDebug(){return this.get("debug")||Salla.storage.get("debug")}},Salla.logger=Lt,Salla.event=new class extends jt{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)&&Salla.call&&"function"==typeof Salla.call(r))return Salla.log(`'Salla.${r}(...)' triggered using event '${e}'`),r=r.split("."),Array.isArray(t[0])&&(t=t[0]),void salla[r[0]][r[1]](...t);super.emit(e,...t),this.trackEvents(e,...t)}emitAsync(e,...t){let r=super.emitAsync(e,...t);try{this.trackEvents(e,...t)}catch(r){Salla.logger.warn(`error on tracking event (${e})`,t,r)}return r}trackEvents(e,...t){if("undefined"!=typeof window)try{window.dataLayer=window.dataLayer||[];let r={event:e};t.map((e=>"object"==typeof e&&(r={...r,...e}))),window.dataLayer.push(r)}catch(e){salla.logger.error(e.message)}Salla.logger&&!this.ingoreLogEvents.includes(e)&&Salla.logger.event(e,...t),this.dispatchMobileEvent(e,...t)}dispatch(e,...t){return this.emit(e,...t)}dispatchEvents(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(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("undefined"!=typeof Android)try{Android.customEventWithData(e,JSON.stringify({details:t}))}catch(e){Salla.log(e,"The native context does not exist yet")}}},Salla.helpers=wt,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=ar}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)}clearAll(){return this.store.clearAll()}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}clearAll(){let e=document.cookie.split(";");for(let t=0;t<e.length;t++){let r=e[t],n=r.indexOf("="),i=n>-1?r.substr(0,n):r;this.remove(i)}}},Salla.log=Salla.logger.log,Salla.money=Salla.helpers.money,Salla.url=Salla.helpers.url,Salla.versions={base:"2.11.122"},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}}var r=t(e);function n(e,t=!1){e+="";let 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;for(let t=0;t<o.length;t++)r=new RegExp(o[t],"g"),e=e.replace(r,s[t]);return e.replace(t?"٫":".",t?".":"٫")}function i(e){let t=(`${e}`.match(/\./g)||[]).length;return t&&1!==t?i(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:"#"+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)};var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},s=Array.isArray,a="object"==typeof o&&o&&o.Object===Object&&o,l="object"==typeof self&&self&&self.Object===Object&&self,c=a||l||Function("return this")(),u=c.Symbol,f=u,h=Object.prototype,p=h.hasOwnProperty,d=h.toString,v=f?f.toStringTag:void 0;var g=function(e){var t=p.call(e,v),r=e[v];try{e[v]=void 0;var n=!0}catch(e){}var i=d.call(e);return n&&(t?e[v]=r:delete e[v]),i},y=Object.prototype.toString;var _=g,m=function(e){return y.call(e)},b=u?u.toStringTag:void 0;var w=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":b&&b in Object(e)?_(e):m(e)};var L=w,S=function(e){return null!=e&&"object"==typeof e};var j=function(e){return"symbol"==typeof e||S(e)&&"[object Symbol]"==L(e)},E=s,x=j,k=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,A=/^\w*$/;var O=function(e,t){if(E(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!x(e))||(A.test(e)||!k.test(e)||null!=t&&e in Object(t))};var T=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},P=w,$=T;var F,N=function(e){if(!$(e))return!1;var t=P(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},R=c["__core-js_shared__"],z=(F=/[^.]+$/.exec(R&&R.keys&&R.keys.IE_PROTO||""))?"Symbol(src)_1."+F:"";var M=function(e){return!!z&&z in e},C=Function.prototype.toString;var I=N,U=M,W=T,D=function(e){if(null!=e){try{return C.call(e)}catch(e){}try{return e+""}catch(e){}}return""},G=/^\[object .+?Constructor\]$/,J=Function.prototype,q=Object.prototype,Z=J.toString,H=q.hasOwnProperty,K=RegExp("^"+Z.call(H).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var B=function(e){return!(!W(e)||U(e))&&(I(e)?K:G).test(D(e))},Q=function(e,t){return null==e?void 0:e[t]};var V=function(e,t){var r=Q(e,t);return B(r)?r:void 0},X=V(Object,"create"),Y=X;var ee=function(){this.__data__=Y?Y(null):{},this.size=0};var te=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},re=X,ne=Object.prototype.hasOwnProperty;var ie=function(e){var t=this.__data__;if(re){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return ne.call(t,e)?t[e]:void 0},oe=X,se=Object.prototype.hasOwnProperty;var ae=X;var le=ee,ce=te,ue=ie,fe=function(e){var t=this.__data__;return oe?void 0!==t[e]:se.call(t,e)},he=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ae&&void 0===t?"__lodash_hash_undefined__":t,this};function pe(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])}}pe.prototype.clear=le,pe.prototype.delete=ce,pe.prototype.get=ue,pe.prototype.has=fe,pe.prototype.set=he;var de=pe;var ve=function(){this.__data__=[],this.size=0};var ge=function(e,t){return e===t||e!=e&&t!=t};var ye=function(e,t){for(var r=e.length;r--;)if(ge(e[r][0],t))return r;return-1},_e=ye,me=Array.prototype.splice;var be=ye;var we=ye;var Le=ye;var Se=ve,je=function(e){var t=this.__data__,r=_e(t,e);return!(r<0)&&(r==t.length-1?t.pop():me.call(t,r,1),--this.size,!0)},Ee=function(e){var t=this.__data__,r=be(t,e);return r<0?void 0:t[r][1]},xe=function(e){return we(this.__data__,e)>-1},ke=function(e,t){var r=this.__data__,n=Le(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};function Ae(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])}}Ae.prototype.clear=Se,Ae.prototype.delete=je,Ae.prototype.get=Ee,Ae.prototype.has=xe,Ae.prototype.set=ke;var Oe=Ae,Te=V(c,"Map"),Pe=de,$e=Oe,Fe=Te;var Ne=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var Re=function(e,t){var r=e.__data__;return Ne(t)?r["string"==typeof t?"string":"hash"]:r.map},ze=Re;var Me=Re;var Ce=Re;var Ie=Re;var Ue=function(){this.size=0,this.__data__={hash:new Pe,map:new(Fe||$e),string:new Pe}},We=function(e){var t=ze(this,e).delete(e);return this.size-=t?1:0,t},De=function(e){return Me(this,e).get(e)},Ge=function(e){return Ce(this,e).has(e)},Je=function(e,t){var r=Ie(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function qe(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])}}qe.prototype.clear=Ue,qe.prototype.delete=We,qe.prototype.get=De,qe.prototype.has=Ge,qe.prototype.set=Je;var Ze=qe;function He(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],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(He.Cache||Ze),r}He.Cache=Ze;var Ke=He;var Be=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qe=/\\(\\)?/g,Ve=function(e){var t=Ke(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(Be,(function(e,r,n,i){t.push(n?i.replace(Qe,"$1"):r||e)})),t})),Xe=Ve;var Ye=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},et=s,tt=j,rt=u?u.prototype:void 0,nt=rt?rt.toString:void 0;var it=function e(t){if("string"==typeof t)return t;if(et(t))return Ye(t,e)+"";if(tt(t))return nt?nt.call(t):"";var r=t+"";return"0"==r&&1/t==-Infinity?"-0":r},ot=it;var st=s,at=O,lt=Xe,ct=function(e){return null==e?"":ot(e)};var ut=j;var ft=function(e,t){return st(e)?e:at(e,t)?[e]:lt(ct(e))},ht=function(e){if("string"==typeof e||ut(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var pt=function(e,t){for(var r=0,n=(t=ft(t,e)).length;null!=e&&r<n;)e=e[ht(t[r++])];return r&&r==n?e:void 0};var dt=function(e,t,r){var n=null==e?void 0:pt(e,t);return void 0===n?r:n};function vt(e){return`${e}`.startsWith("https://")||`${e}`.startsWith("http://")}function gt(e){if(vt(e))return e;let 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("/")+"/"+e?.ltrim("/")}function yt(e,t,r){if(r=r||window.location.href,!t||!e)return r;let 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 _t(e){return window.location.origin+"/"+e?.ltrim("/")}function mt(e){return vt(e)?e:Salla.config.get("theme.assets")?Salla.config.get("theme.assets").replace(":path",e?.ltrim("/")):_t("themes/"+Salla.config.get("theme.name")+"/"+e?.ltrim("/"))}function bt(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]=bt(e.slice(1),t,r[n]),r):n?{[n]:bt(e.slice(1),t)}:""===n?[t]:t}var wt={digitsOnly:function(e){return n(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<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")?i(n):n.replace(/\D/g,"")},number:n,money:function(e){let t=Salla.config.currency(e?.currency).symbol;return n(e="object"==typeof e?e.amount:e)+" "+t},setNested:function(e,t,r){let n=e,i=t.split("."),o=i.length;for(let e=0;e<o-1;e++){let t=i[e];n[t]||(n[t]={}),n=n[t]}return n[i[o-1]]=r,e},getNested:function(e,t,r){let n=dt(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:bt(n.slice(1),t,r[n[0]])}}return{name:e,value:t}},url:Object.freeze({__proto__:null,is_full_url:vt,base:function(e){if(vt(e))return e;const{hostname:t}=new URL(gt("/"));return"https://"+t+"/"+e?.ltrim("/")},get:gt,domain:function(e){return vt(e)?e:Salla.config.get("store.url",window.location.href.split("/").slice(0,-1).join("/")).rtrim("/")+"/"+e?.ltrim("/")},addParamToUrl:yt,baseUrl:_t,asset:mt,cdn:function(e){return"https://cdn.salla.network/"+e?.ltrim("/")},api:function(e){return Salla.config.get("store.api",gt(""))?.rtrim("/")+"/"+e?.ltrim("/")},is_page:function(e){return e&&Salla.config.get("page.slug")===e},is_placeholder:function(e){return mt(salla.config.get("theme.settings.placeholder"))===mt(e)}}),addParamToUrl:yt,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)))}}},Lt=function(e){let t={log:function(t,r){if(!e)return;if(!salla.config.isDebug())return;"trace"===salla.config.get("debug")&&(r="trace");let n=e.log,i=void 0===r?n:this.__dict__[r]||n,o=["%cTwilight","color: #5cd5c4;font-weight:bold; border:1px solid #5cd5c4; padding: 2px 6px; border-radius: 5px;"],s={event:"#CFF680",backend:"#7b68ee"}[r];s&&(o[0]+="%c"+r[0].toUpperCase()+r.substring(1),o.push(`margin-left: 5px;color: ${s};font-weight:bold; border:1px solid ${s}; padding: 2px 6px; border-radius: 5px;`)),i.call(e,...o.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);var St={exports:{}};!function(e,t){!function(t){var n=Object.hasOwnProperty,i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},o="object"==typeof r.default&&"function"==typeof r.default.nextTick,s="function"==typeof Symbol,a="object"==typeof Reflect,l="function"==typeof setImmediate?setImmediate:setTimeout,c=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 u(){this._events={},this._conf&&f.call(this,this._conf)}function f(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 n="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(n+=" Event name: "+t+"."),void 0!==r.default&&r.default.emitWarning){var i=new Error(n);i.name="MaxListenersExceededWarning",i.emitter=this,i.count=e,r.default.emitWarning(i)}else console.error(n),console.trace&&console.trace()}var p=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 d(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 v(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,r,i,o){var s=Object.assign({},r);if(!e)return s;if("object"!=typeof e)throw TypeError("options must be an object");var a,l,c,u=Object.keys(e),f=u.length;function h(e){throw Error('Invalid "'+a+'" option value'+(e?". Reason: "+e:""))}for(var p=0;p<f;p++){if(a=u[p],!o&&!n.call(r,a))throw Error('Unknown "'+a+'" option');(l=e[a])!==t&&(c=i[a],s[a]=c?c(l,h):l)}return s}function y(e,t){return"function"==typeof e&&e.hasOwnProperty("prototype")||t("value must be a constructor"),e}function _(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 o=typeof e;if(o===n||o===i)return e;r(t)}:function(n,i){for(var o=typeof n,s=r;s-- >0;)if(o===e[s])return n;i(t)}}Object.assign(v.prototype,{subscribe:function(e,t,r){var n=this,i=this._target,o=this._emitter,s=this._listeners,a=function(){var n=p.apply(null,arguments),s={data:n,name:t,original:e};if(r){var a=r.call(i,s);!1!==a&&o.emit.apply(o,[s.name].concat(n))}else 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 u(){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||u()}else{for(n=(r=c(o)).length;n-- >0;)e=r[n],a.call(l,e,o[e]);this._listeners={},this._listenersCount=0,u()}}});var m=_(["function"]),b=_(["object","function"]);function w(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 h=function(e){f(),l(e)},p=function(e){f(),c(e)};n?t(h,p,u):(i=[function(e){p(e||Error("canceled"))}],t(h,p,(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 S(e,t,r,n,i){if(!r)return null;if(0===n){var o=typeof t;if("string"===o){var s,a,l=0,u=0,f=this.delimiter,h=f.length;if(-1!==(a=t.indexOf(f))){s=new Array(5);do{s[l++]=t.slice(u,a),u=a+h}while(-1!==(a=t.indexOf(f,u)));s[l++]=t.slice(u),t=s,i=l}else t=[t],i=1}else"object"===o?i=t.length:(t=[t],i=1)}var p,d,v,g,y,_,m,b=null,w=t[n],L=t[n+1];if(n===i)r._listeners&&("function"==typeof r._listeners?(e&&e.push(r._listeners),b=[r]):(e&&e.push.apply(e,r._listeners),b=[r]));else{if("*"===w){for(a=(_=c(r)).length;a-- >0;)"_listeners"!==(p=_[a])&&(m=S(e,t,r[p],n+1,i))&&(b?b.push.apply(b,m):b=m);return b}if("**"===w){for((y=n+1===i||n+2===i&&"*"===L)&&r._listeners&&(b=S(e,t,r,i,i)),a=(_=c(r)).length;a-- >0;)"_listeners"!==(p=_[a])&&("*"===p||"**"===p?(r[p]._listeners&&!y&&(m=S(e,t,r[p],i,i))&&(b?b.push.apply(b,m):b=m),m=S(e,t,r[p],n,i)):m=S(e,t,r[p],p===L?n+2:n,i),m&&(b?b.push.apply(b,m):b=m));return b}r[w]&&(b=S(e,t,r[w],n+1,i))}if((d=r["*"])&&S(e,t,d,n+1,i),v=r["**"])if(n<i)for(v._listeners&&S(e,t,v,i,i),a=(_=c(v)).length;a-- >0;)"_listeners"!==(p=_[a])&&(p===L?S(e,t,v[p],n+2,i):p===w?S(e,t,v[p],n+1,i):((g={})[p]=v[p],S(e,t,{"**":g},n+1,i)));else v._listeners?S(e,t,v,i,i):v["*"]&&v["*"]._listeners&&S(e,t,v["*"],i,i);return b}function j(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 E(e,t,r,n){for(var i,o,s,a,l=c(e),u=l.length,f=e._listeners;u-- >0;)i=e[o=l[u]],s="_listeners"===o?r:r?r.concat(o):[o],a=n||"symbol"==typeof o,f&&t.push(a?s:s.join(this.delimiter)),"object"==typeof i&&E.call(this,i,t,s,a);return t}function x(e){for(var t,r,n,i=c(e),o=i.length;o-- >0;)(t=e[r=i[o]])&&(n=!0,"_listeners"===r||x(t)||delete e[r]);return n}function k(e,t,r){this.emitter=e,this.event=t,this.listener=r}function A(e,n,i){if(!0===i)a=!0;else if(!1===i)s=!0;else{if(!i||"object"!=typeof i)throw TypeError("options should be an object or true");var s=i.async,a=i.promisify,c=i.nextTick,u=i.objectify}if(s||c||a){var f=n,h=n._origin||n;if(c&&!o)throw Error("process.nextTick is not supported");a===t&&(a="AsyncFunction"===n.constructor.name),n=function(){var e=arguments,t=this,n=this.event;return a?c?Promise.resolve():new Promise((function(e){l(e)})).then((function(){return t.event=n,f.apply(t,e)})):(c?r.default.nextTick:l)((function(){t.event=n,f.apply(t,e)}))},n._async=!0,n._origin=h}return[n,u?new k(this,e,n):this]}function O(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,f.call(this,e)}k.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},O.EventEmitter2=O,O.prototype.listenTo=function(e,r,n){if("object"!=typeof e)throw TypeError("target musts be an object");var o=this;function s(t){if("object"!=typeof t)throw TypeError("events must be an object");var r,i=n.reducers,s=L.call(o,e);r=-1===s?new v(o,e,n):o._observers[s];for(var a,l=c(t),u=l.length,f="function"==typeof i,h=0;h<u;h++)a=l[h],r.subscribe(a,t[a]||a,f?i:i&&i[a])}return n=g(n,{on:t,off:t,reducers:t},{on:m,off:m,reducers:b}),i(r)?s(d(r)):s("string"==typeof r?d(r.split(/\s+/)):r),this},O.prototype.stopListeningTo=function(e,t){var r=this._observers;if(!r)return!1;var n,i=r.length,o=!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),o=!0);return o},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 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)},O.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||u.call(this);var e,t,r,n,i,o,a=arguments[0],l=this.wildcard;if("newListener"===a&&!this._newListener&&!this._events.newListener)return!1;if(l&&(e=a,"newListener"!==a&&"removeListener"!==a&&"object"==typeof a)){if(r=a.length,s)for(n=0;n<r;n++)if("symbol"==typeof a[n]){o=!0;break}o||(a=a.join(this.delimiter))}var c,f=arguments.length;if(this._all&&this._all.length)for(n=0,r=(c=this._all.slice()).length;n<r;n++)switch(this.event=a,f){case 1:c[n].call(this,a);break;case 2:c[n].call(this,a,arguments[1]);break;case 3:c[n].call(this,a,arguments[1],arguments[2]);break;default:c[n].apply(this,arguments)}if(l)c=[],S.call(this,c,e,this.listenerTree,0,r);else{if("function"==typeof(c=this._events[a])){switch(this.event=a,f){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(f-1),i=1;i<f;i++)t[i-1]=arguments[i];c.apply(this,t)}return!0}c&&(c=c.slice())}if(c&&c.length){if(f>3)for(t=new Array(f-1),i=1;i<f;i++)t[i-1]=arguments[i];for(n=0,r=c.length;n<r;n++)switch(this.event=a,f){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"===a)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,o,a=arguments[0],l=this.wildcard;if("newListener"===a&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(l&&(e=a,"newListener"!==a&&"removeListener"!==a&&"object"==typeof a)){if(n=a.length,s)for(i=0;i<n;i++)if("symbol"==typeof a[i]){t=!0;break}t||(a=a.join(this.delimiter))}var c,f=[],h=arguments.length;if(this._all)for(i=0,n=this._all.length;i<n;i++)switch(this.event=a,h){case 1:f.push(this._all[i].call(this,a));break;case 2:f.push(this._all[i].call(this,a,arguments[1]));break;case 3:f.push(this._all[i].call(this,a,arguments[1],arguments[2]));break;default:f.push(this._all[i].apply(this,arguments))}if(l?(c=[],S.call(this,c,e,this.listenerTree,0)):c=this._events[a],"function"==typeof c)switch(this.event=a,h){case 1:f.push(c.call(this));break;case 2:f.push(c.call(this,arguments[1]));break;case 3:f.push(c.call(this,arguments[1],arguments[2]));break;default:for(r=new Array(h-1),o=1;o<h;o++)r[o-1]=arguments[o];f.push(c.apply(this,r))}else if(c&&c.length){if(c=c.slice(),h>3)for(r=new Array(h-1),o=1;o<h;o++)r[o-1]=arguments[o];for(i=0,n=c.length;i<n;i++)switch(this.event=a,h){case 1:f.push(c[i].call(this));break;case 2:f.push(c[i].call(this,arguments[1]));break;case 3:f.push(c[i].call(this,arguments[1],arguments[2]));break;default:f.push(c[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(f)},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 o,s=this;return i!==t&&(r=(o=A.call(this,e,r,i))[0],s=o[1]),this._newListener&&this.emit("newListener",e,r),this.wildcard?(j.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)},O.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=S.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&&x(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=S.call(this,null,e,this.listenerTree,0);if(!n)return this;for(r=0;r<n.length;r++)n[r]._listeners=null;this.listenerTree&&x(this.listenerTree)}else this._events&&(this._events[e]=null);return this},O.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=c(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=[],u="string"==typeof e?e.split(this.delimiter):e.slice();return S.call(this,l,u,s,0),l}return a&&(n=a[e])?"function"==typeof n?[n]:n:[]},O.prototype.eventNames=function(e){var t=this._events;return this.wildcard?E.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 S.call(this,r,n,this.listenerTree,0),r.length>0}var i=this._events,o=this._all;return!!(o&&o.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}),w((r=g(r,{timeout:0,filter:t,handleError:!1,Promise:Promise,overload:!1},{filter:m,Promise:y})).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(p.apply(null,arguments).slice(1))}else t(p.apply(null,arguments))}o((function(){n.off(e,s)})),n._on(e,s,!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 w((r=g(r,{Promise:Promise,timeout:0,overload:!1},{Promise:y})).Promise,(function(r,n,i){var o;if("function"==typeof e.addEventListener)return o=function(){r(p.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(p.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(T,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),e.exports=O}()}(St);var jt=St.exports;var Et=Object.assign?Object.assign:function(e,t,r,n){for(var i=1;i<arguments.length;i++)Pt(Object(arguments[i]),(function(t,r){e[r]=t}));return e},xt=function(){if(Object.create)return function(e,t,r,n){var i=Tt(arguments,1);return Et.apply(this,[Object.create(e)].concat(i))};{function e(){}return function(t,r,n,i){var o=Tt(arguments,1);return e.prototype=t,Et.apply(this,[new e].concat(o))}}}(),kt=String.prototype.trim?function(e){return String.prototype.trim.call(e)}:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},At="undefined"!=typeof window?window:o,Ot={assign:Et,create:xt,trim:kt,bind:function(e,t){return function(){return t.apply(e,Array.prototype.slice.call(arguments,0))}},slice:Tt,each:Pt,map:function(e,t){var r=Ft(e)?[]:{};return $t(e,(function(e,n){return r[n]=t(e,n),!1})),r},pluck:$t,isList:Ft,isFunction:function(e){return e&&"[object Function]"==={}.toString.call(e)},isObject:function(e){return e&&"[object Object]"==={}.toString.call(e)},Global:At};function Tt(e,t){return Array.prototype.slice.call(e,t||0)}function Pt(e,t){$t(e,(function(e,r){return t(e,r),!1}))}function $t(e,t){if(Ft(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 Ft(e){return null!=e&&"function"!=typeof e&&"number"==typeof e.length}var Nt=Ot.slice,Rt=Ot.pluck,zt=Ot.each,Mt=Ot.bind,Ct=Ot.create,It=Ot.isList,Ut=Ot.isFunction,Wt=Ot.isObject,Dt={createStore:Jt},Gt={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 Jt.apply(this,arguments)},addPlugin:function(e){this._addPlugin(e)},namespace:function(e){return Jt(this.storage,this.plugins,e)}};function Jt(e,t,r){r||(r=""),e&&!It(e)&&(e=[e]),t&&!It(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=Nt(arguments,0),n=this;function i(){if(r)return zt(arguments,(function(e,r){t[r]=e})),r.apply(n,t)}var o=[i].concat(t);return e.apply(n,o)}},_serialize:function(e){return JSON.stringify(e)},_deserialize:function(e,t){if(!e)return t;var r="";try{r=JSON.parse(e)}catch(t){r=e}return 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(It(e))zt(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(!Wt(r))throw new Error("Plugins must return an object of function properties");zt(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)}},s=Ct(o,Gt,{plugins:[]});return s.raw={},zt(s,(function(e,t){Ut(e)&&(s.raw[t]=Mt(s,e))})),zt(e,(function(e){s._addStorage(e)})),zt(t,(function(e){s._addPlugin(e)})),s}var qt=Ot.Global,Zt={name:"localStorage",read:Kt,write:function(e,t){return Ht().setItem(e,t)},each:function(e){for(var t=Ht().length-1;t>=0;t--){var r=Ht().key(t);e(Kt(r),r)}},remove:function(e){return Ht().removeItem(e)},clearAll:function(){return Ht().clear()}};function Ht(){return qt.localStorage}function Kt(e){return Ht().getItem(e)}var Bt=Ot.Global,Qt={name:"sessionStorage",read:Xt,write:function(e,t){return Vt().setItem(e,t)},each:function(e){for(var t=Vt().length-1;t>=0;t--){var r=Vt().key(t);e(Xt(r),r)}},remove:function(e){return Vt().removeItem(e)},clearAll:function(){return Vt().clear()}};function Vt(){return Bt.sessionStorage}function Xt(e){return Vt().getItem(e)}var Yt=Ot.trim,er={name:"cookieStorage",read:function(e){if(!e||!ir(e))return null;var t="(?:^|.*;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(tr.cookie.replace(new RegExp(t),"$1"))},write:function(e,t){if(!e)return;tr.cookie=escape(e)+"="+escape(t)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/"},each:rr,remove:nr,clearAll:function(){rr((function(e,t){nr(t)}))}},tr=Ot.Global.document;function rr(e){for(var t=tr.cookie.split(/; ?/g),r=t.length-1;r>=0;r--)if(Yt(t[r])){var n=t[r].split("="),i=unescape(n[0]);e(unescape(n[1]),i)}}function nr(e){e&&ir(e)&&(tr.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function ir(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(tr.cookie)}var or={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={};const ar=Dt.createStore([Zt,Qt,er,or],[]);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 class{constructor(e={},t={}){this.default_properties=t,this.properties_={...this.default_properties,...e}}merge(e){return this.properties_={...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)}currency(e){return e=e||this.get("user.currency_code"),this.get("currencies."+e)||Object.values(this.get("currencies"))[0]}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_}isDebug(){return this.get("debug")||Salla.storage.get("debug")}},Salla.logger=Lt,Salla.event=new class extends jt{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)&&Salla.call&&"function"==typeof Salla.call(r))return Salla.log(`'Salla.${r}(...)' triggered using event '${e}'`),r=r.split("."),Array.isArray(t[0])&&(t=t[0]),void salla[r[0]][r[1]](...t);super.emit(e,...t),this.trackEvents(e,...t)}emitAsync(e,...t){let r=super.emitAsync(e,...t);try{this.trackEvents(e,...t)}catch(r){Salla.logger.warn(`error on tracking event (${e})`,t,r)}return r}trackEvents(e,...t){if("undefined"!=typeof window)try{window.dataLayer=window.dataLayer||[];let r={event:e};t.map((e=>"object"==typeof e&&(r={...r,...e}))),window.dataLayer.push(r)}catch(e){salla.logger.error(e.message)}Salla.logger&&!this.ingoreLogEvents.includes(e)&&Salla.logger.event(e,...t),this.dispatchMobileEvent(e,...t)}dispatch(e,...t){return this.emit(e,...t)}dispatchEvents(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(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("undefined"!=typeof Android)try{Android.customEventWithData(e,JSON.stringify({details:t}))}catch(e){Salla.log(e,"The native context does not exist yet")}}},Salla.helpers=wt,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=ar}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)}clearAll(){return this.store.clearAll()}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}clearAll(){let e=document.cookie.split(";");for(let t=0;t<e.length;t++){let r=e[t],n=r.indexOf("="),i=n>-1?r.substr(0,n):r;this.remove(i)}}},Salla.log=Salla.logger.log,Salla.money=Salla.helpers.money,Salla.url=Salla.helpers.url,Salla.versions={base:"2.11.123"},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.11.123",
3
+ "version": "2.11.126",
4
4
  "description": "Salla Base",
5
5
  "main": "dist/cjs/",
6
6
  "module": "dist/esm/",
@@ -59,5 +59,5 @@
59
59
  "rollup-plugin-version-injector": "^1.3.3",
60
60
  "sinon": "^15.0.1"
61
61
  },
62
- "gitHead": "859f60a1b88e796780a42e0e0bdc2c6c92dfadc0"
62
+ "gitHead": "47ced296eee60e49ad1e93ebba80fb51e1ad63e4"
63
63
  }