Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@salla.sa/base

Package Overview
Dependencies
Maintainers
39
Versions
280
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@salla.sa/base - npm Package Compare versions

Comparing version 1.6.15-alpha.3 to 1.6.15-alpha.4

2

dist/@salla.sa/base.min.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("process")):"function"==typeof define&&define.amd?define(["exports","process"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Salla={},e.process)}(this,(function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t);function i(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}function o(e){let t=(e.match(/\./g)||[]).length;return t&&1!==t?o(e.replace(/\.(.+)\./g,".$1")):e}var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},a=Array.isArray,l="object"==typeof s&&s&&s.Object===Object&&s,c="object"==typeof self&&self&&self.Object===Object&&self,u=l||c||Function("return this")(),f=u.Symbol,h=f,p=Object.prototype,d=p.hasOwnProperty,v=p.toString,g=h?h.toStringTag:void 0;var y=function(e){var t=d.call(e,g),r=e[g];try{e[g]=void 0;var n=!0}catch(e){}var i=v.call(e);return n&&(t?e[g]=r:delete e[g]),i},_=Object.prototype.toString;var m=y,b=function(e){return _.call(e)},w=f?f.toStringTag:void 0;var L=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":w&&w in Object(e)?m(e):b(e)};var S=L,j=function(e){return null!=e&&"object"==typeof e};var E=function(e){return"symbol"==typeof e||j(e)&&"[object Symbol]"==S(e)},x=a,k=E,O=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,A=/^\w*$/;var T=function(e,t){if(x(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!k(e))||(A.test(e)||!O.test(e)||null!=t&&e in Object(t))};var P=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},F=L,$=P;var N,M=function(e){if(!$(e))return!1;var t=F(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},z=u["__core-js_shared__"],R=(N=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+N:"";var I=function(e){return!!R&&R in e},C=Function.prototype.toString;var U=M,D=I,G=P,W=function(e){if(null!=e){try{return C.call(e)}catch(e){}try{return e+""}catch(e){}}return""},J=/^\[object .+?Constructor\]$/,q=Function.prototype,H=Object.prototype,K=q.toString,B=H.hasOwnProperty,Z=RegExp("^"+K.call(B).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Q=function(e){return!(!G(e)||D(e))&&(U(e)?Z:J).test(W(e))},V=function(e,t){return null==e?void 0:e[t]};var X=function(e,t){var r=V(e,t);return Q(r)?r:void 0},Y=X(Object,"create"),ee=Y;var te=function(){this.__data__=ee?ee(null):{},this.size=0};var re=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ne=Y,ie=Object.prototype.hasOwnProperty;var oe=function(e){var t=this.__data__;if(ne){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return ie.call(t,e)?t[e]:void 0},se=Y,ae=Object.prototype.hasOwnProperty;var le=Y;var ce=te,ue=re,fe=oe,he=function(e){var t=this.__data__;return se?void 0!==t[e]:ae.call(t,e)},pe=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=le&&void 0===t?"__lodash_hash_undefined__":t,this};function de(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])}}de.prototype.clear=ce,de.prototype.delete=ue,de.prototype.get=fe,de.prototype.has=he,de.prototype.set=pe;var ve=de;var ge=function(){this.__data__=[],this.size=0};var ye=function(e,t){return e===t||e!=e&&t!=t};var _e=function(e,t){for(var r=e.length;r--;)if(ye(e[r][0],t))return r;return-1},me=_e,be=Array.prototype.splice;var we=_e;var Le=_e;var Se=_e;var je=ge,Ee=function(e){var t=this.__data__,r=me(t,e);return!(r<0)&&(r==t.length-1?t.pop():be.call(t,r,1),--this.size,!0)},xe=function(e){var t=this.__data__,r=we(t,e);return r<0?void 0:t[r][1]},ke=function(e){return Le(this.__data__,e)>-1},Oe=function(e,t){var r=this.__data__,n=Se(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=je,Ae.prototype.delete=Ee,Ae.prototype.get=xe,Ae.prototype.has=ke,Ae.prototype.set=Oe;var Te=Ae,Pe=X(u,"Map"),Fe=ve,$e=Te,Ne=Pe;var Me=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var ze=function(e,t){var r=e.__data__;return Me(t)?r["string"==typeof t?"string":"hash"]:r.map},Re=ze;var Ie=ze;var Ce=ze;var Ue=ze;var De=function(){this.size=0,this.__data__={hash:new Fe,map:new(Ne||$e),string:new Fe}},Ge=function(e){var t=Re(this,e).delete(e);return this.size-=t?1:0,t},We=function(e){return Ie(this,e).get(e)},Je=function(e){return Ce(this,e).has(e)},qe=function(e,t){var r=Ue(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=De,He.prototype.delete=Ge,He.prototype.get=We,He.prototype.has=Je,He.prototype.set=qe;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(){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 Ze=Be;var Qe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ve=/\\(\\)?/g,Xe=function(e){var t=Ze(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(Qe,(function(e,r,n,i){t.push(n?i.replace(Ve,"$1"):r||e)})),t})),Ye=Xe;var et=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},tt=a,rt=E,nt=f?f.prototype:void 0,it=nt?nt.toString:void 0;var ot=function e(t){if("string"==typeof t)return t;if(tt(t))return et(t,e)+"";if(rt(t))return it?it.call(t):"";var r=t+"";return"0"==r&&1/t==-Infinity?"-0":r},st=ot;var at=a,lt=T,ct=Ye,ut=function(e){return null==e?"":st(e)};var ft=E;var ht=function(e,t){return at(e)?e:lt(e,t)?[e]:ct(ut(e))},pt=function(e){if("string"==typeof e||ft(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var dt=function(e,t){for(var r=0,n=(t=ht(t,e)).length;null!=e&&r<n;)e=e[pt(t[r++])];return r&&r==n?e:void 0};var vt=function(e,t,r){var n=null==e?void 0:dt(e,t);return void 0===n?r:n};function gt(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]=gt(e.slice(1),t,r[n]),r):n?{[n]:gt(e.slice(1),t)}:""===n?[t]:t}function yt(e){return Salla.config.get("store.url",window.location.href.split("/").slice(0,-1).join("/")).rtrim("/")+"/"+e.ltrim("/")}var _t={digitsOnly:function(e){return i(e,!0).replace(/[^0-9.]/g,"").replace("..",".").rtrim(".")},inputDigitsOnly:function e(t,r=!1){if("string"==typeof t)return document.querySelectorAll(t).forEach((t=>e(t,r)));if(!t)return void Salla.logger.warn("Can't find Object With Id: "+t);let n=Salla.helpers.digitsOnly(t.value);return t.min&&n<t.min?t.value=t.min:t.max&&n>t.max?t.value=t.max:t.maxLength>=1&&n.toString().length>t.maxLength?t.value=n.toString().substring(0,t.maxLength):t.value=r||t.dataset.hasOwnProperty("digitsWithDecimal")?o(n):n.replace(/\D/g,"")},number:i,money:function(e){return i(e?.amount|e)+" "+Salla.config.currency(e?.currency).symbol},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=vt(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:gt(n.slice(1),t,r[n[0]])}}return{name:e,value:t}},url:{get:yt,asset:function(e){return function(e){return window.location.origin+"/"+e.ltrim("/")}("themes/"+Salla.config.get("theme.name")+"/"+e.ltrim("/"))},cdn:function(e){return"https://cdn.salla.network/"+e.ltrim("/")},is_page:function(e){return e&&Salla.config.get("page.slug")===e},api:function(e){return Salla.config.get("store.api",yt("")).rtrim("/")+"/"+e.ltrim("/")}},addParamToUrl:function(e,t){if(!t||!e)return window.location.href;let r=new RegExp("([?&])"+e+"=[^&]+[&]?","g"),n=window.location.href.replace(r,"$1").replace(/&$|\?$/,"");return n+=(n.includes("?")?"&":"?")+e+"="+encodeURIComponent(t),n.replace(/&$|\?$/,"")},debounce:function(e,t){t=t||100;let r,n=[];return function(...i){return clearTimeout(r),r=setTimeout((()=>{let t=e(...i);n.forEach((e=>e(t))),n=[]}),t),new Promise((e=>n.push(e)))}}},mt=function(e){let t={log:function(t,r){if(!e)return;"trace"===salla.config.get("debug")&&(r="trace");let n=e.log,i=void 0===r?n:this.__dict__[r]||n,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 bt={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"==typeof n.default&&"function"==typeof n.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 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 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,n,i,o){var s=Object.assign({},n);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&&!r.call(n,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 O(e,r,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=r,h=r._origin||r;if(c&&!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?c?Promise.resolve():new Promise((function(e){l(e)})).then((function(){return t.event=r,f.apply(t,e)})):(c?n.default.nextTick:l)((function(){t.event=r,f.apply(t,e)}))},r._async=!0,r._origin=h}return[r,u?new k(this,e,r):this]}function A(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},A.EventEmitter2=A,A.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},A.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},A.prototype.delimiter=".",A.prototype.setMaxListeners=function(e){e!==t&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},A.prototype.getMaxListeners=function(){return this._maxListeners},A.prototype.event="",A.prototype.once=function(e,t,r){return this._once(e,t,!1,r)},A.prototype.prependOnceListener=function(e,t,r){return this._once(e,t,!0,r)},A.prototype._once=function(e,t,r,n){return this._many(e,1,t,r,n)},A.prototype.many=function(e,t,r,n){return this._many(e,t,r,!1,n)},A.prototype.prependMany=function(e,t,r,n){return this._many(e,t,r,!0,n)},A.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)},A.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},A.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)},A.prototype.on=function(e,t,r){return this._on(e,t,!1,r)},A.prototype.prependListener=function(e,t,r){return this._on(e,t,!0,r)},A.prototype.onAny=function(e){return this._onAny(e,!1)},A.prototype.prependAny=function(e){return this._onAny(e,!0)},A.prototype.addListener=A.prototype.on,A.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},A.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=O.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)},A.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},A.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},A.prototype.removeListener=A.prototype.off,A.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},A.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:[]},A.prototype.eventNames=function(e){var t=this._events;return this.wildcard?E.call(this,this.listenerTree,[],null,e):t?c(t):[]},A.prototype.listenerCount=function(e){return this.listeners(e).length},A.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]))},A.prototype.listenersAny=function(){return this._all?this._all:[]},A.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=A.prototype;Object.defineProperties(A,{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=A}()}(bt);var wt=bt.exports;var Lt=Object.assign?Object.assign:function(e,t,r,n){for(var i=1;i<arguments.length;i++)Ot(Object(arguments[i]),(function(t,r){e[r]=t}));return e},St=function(){if(Object.create)return function(e,t,r,n){var i=kt(arguments,1);return Lt.apply(this,[Object.create(e)].concat(i))};{function e(){}return function(t,r,n,i){var o=kt(arguments,1);return e.prototype=t,Lt.apply(this,[new e].concat(o))}}}(),jt=String.prototype.trim?function(e){return String.prototype.trim.call(e)}:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},Et="undefined"!=typeof window?window:s,xt={assign:Lt,create:St,trim:jt,bind:function(e,t){return function(){return t.apply(e,Array.prototype.slice.call(arguments,0))}},slice:kt,each:Ot,map:function(e,t){var r=Tt(e)?[]:{};return At(e,(function(e,n){return r[n]=t(e,n),!1})),r},pluck:At,isList:Tt,isFunction:function(e){return e&&"[object Function]"==={}.toString.call(e)},isObject:function(e){return e&&"[object Object]"==={}.toString.call(e)},Global:Et};function kt(e,t){return Array.prototype.slice.call(e,t||0)}function Ot(e,t){At(e,(function(e,r){return t(e,r),!1}))}function At(e,t){if(Tt(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 Tt(e){return null!=e&&"function"!=typeof e&&"number"==typeof e.length}var Pt=xt.slice,Ft=xt.pluck,$t=xt.each,Nt=xt.bind,Mt=xt.create,zt=xt.isList,Rt=xt.isFunction,It=xt.isObject,Ct={createStore:Dt},Ut={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 Dt.apply(this,arguments)},addPlugin:function(e){this._addPlugin(e)},namespace:function(e){return Dt(this.storage,this.plugins,e)}};function Dt(e,t,r){r||(r=""),e&&!zt(e)&&(e=[e]),t&&!zt(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=Pt(arguments,0),n=this;function i(){if(r)return $t(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(zt(e))$t(e,(function(e){t._addPlugin(e)}));else if(!Ft(this.plugins,(function(t){return e===t}))){if(this.plugins.push(e),!Rt(e))throw new Error("Plugins must be function values that return objects");var r=e.call(this);if(!It(r))throw new Error("Plugins must return an object of function properties");$t(r,(function(r,n){if(!Rt(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=Mt(o,Ut,{plugins:[]});return s.raw={},$t(s,(function(e,t){Rt(e)&&(s.raw[t]=Nt(s,e))})),$t(e,(function(e){s._addStorage(e)})),$t(t,(function(e){s._addPlugin(e)})),s}var Gt=xt.Global,Wt={name:"localStorage",read:qt,write:function(e,t){return Jt().setItem(e,t)},each:function(e){for(var t=Jt().length-1;t>=0;t--){var r=Jt().key(t);e(qt(r),r)}},remove:function(e){return Jt().removeItem(e)},clearAll:function(){return Jt().clear()}};function Jt(){return Gt.localStorage}function qt(e){return Jt().getItem(e)}var Ht=xt.Global,Kt={name:"sessionStorage",read:Zt,write:function(e,t){return Bt().setItem(e,t)},each:function(e){for(var t=Bt().length-1;t>=0;t--){var r=Bt().key(t);e(Zt(r),r)}},remove:function(e){return Bt().removeItem(e)},clearAll:function(){return Bt().clear()}};function Bt(){return Ht.sessionStorage}function Zt(e){return Bt().getItem(e)}var Qt=xt.trim,Vt={name:"cookieStorage",read:function(e){if(!e||!tr(e))return null;var t="(?:^|.*;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(Xt.cookie.replace(new RegExp(t),"$1"))},write:function(e,t){if(!e)return;Xt.cookie=escape(e)+"="+escape(t)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/"},each:Yt,remove:er,clearAll:function(){Yt((function(e,t){er(t)}))}},Xt=xt.Global.document;function Yt(e){for(var t=Xt.cookie.split(/; ?/g),r=t.length-1;r>=0;r--)if(Qt(t[r])){var n=t[r].split("="),i=unescape(n[0]);e(unescape(n[1]),i)}}function er(e){e&&tr(e)&&(Xt.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function tr(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(Xt.cookie)}var rr={name:"memoryStorage",read:function(e){return nr[e]},write:function(e,t){nr[e]=t},each:function(e){for(var t in nr)nr.hasOwnProperty(t)&&e(nr[t],t)},remove:function(e){delete nr[e]},clearAll:function(e){nr={}}},nr={};const ir=Ct.createStore([Wt,Kt,Vt,rr],[]);"undefined"==typeof global?(window.salla=window.salla||window.Salla||{},window.Salla=window.salla):(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 Object.assign(this.properties_,e),this.properties_.store={...this.default_properties.store,...this.properties_.store},this}set(e,t){return e.includes(".")?(Salla.helpers.setNested(this.properties_,e,t),this):(this.properties_[e]=t,this)}get(e,t=null){return e.includes(".")?Salla.helpers.getNested(this.properties_,e,t):this.properties_.hasOwnProperty(e)?this.properties_[e]||t:t||void 0}all(){return this.properties_}},Salla.logger=mt,Salla.event=new class extends wt{constructor(){super({wildcard:!0,delimiter:"::",newListener:!1,removeListener:!1,maxListeners:10,verboseMemoryLeak:!1,ignoreErrors:!1}),this.delimiter="::","undefined"!=typeof document&&(this.body=document.querySelector("body")),this.logableEvents=["cart::item.added.failed","cart::item.deleted.failed"],this.ingoreLogEvents=["document::click","document::keyup","document::change"],this.noneFireableActions=["document.request"]}createAndDispatch(e,...t){this.dispatch(e,...t)}emit(e,...t){let r=e.replace("::",".");if(!this.noneFireableActions.includes(r)&&void 0!==Salla.call&&"function"==typeof Salla.call(r))return Salla.log(`'Salla.${r}(...)' triggered using event '${e}'`),r=r.split("."),void salla[r[0]][r[1]](...t);super.emit(e,...t),"undefined"!=typeof window&&(window.dataLayer=window.dataLayer||[],window.dataLayer.push(Object.assign({event:e},...t.values()))),!this.ingoreLogEvents.includes(e)&&(void 0!==Salla.config&&Salla.config.get("debug")||this.logableEvents.includes(e))&&void 0!==Salla.logger&&Salla.logger.event(e,...t),this.dispatchMobileEvent(e,{...t.values()})}dispatch(e,...t){return this.emit(e,...t)}dispatchEvents(e){if(e&&"object"==typeof e)for(const[t,r]of Object.entries(e))this.dispatch(t,r);else Salla.log("No Events To Dispatch!",e)}addListener(e,t){return this.on(e,t)}addEventListener(e,t){return this.on(e,t)}listen(e,t){return this.on(e,t)}registerGlobalListener(e,t){return this.onAny(t)}dispatchMobileEvent(e,t={}){if(!("undefined"!=typeof window&&window.dataLayer&&dataLayer[0]&&dataLayer[0].page&&dataLayer[0].page.mobileApp))return"";if(window.webkit)try{window.webkit.messageHandlers.callbackHandler.postMessage(JSON.stringify({event:e,details:t}))}catch(e){Salla.log(e,"The native context does not exist yet")}else if(Android)try{Android.customEventWithData(e,JSON.stringify({details:t}))}catch(e){Salla.log(e,"The native context does not exist yet")}}},Salla.storage=new class{constructor(){Salla.event.on("storage::item.remove",(e=>this.remove(e))),Salla.event.on("storage::item.set",((e,t)=>this.set(e,t))),this.store=ir}set(e,t){if(e.includes(".")){let r=e.split(".")[0],n={[r]:this.store.get(r)};return n=Salla.helpers.setNested(n,e,t),this.store.set(r,n[r])}return this.store.set(e,t)}remove(e){return this.store.remove(e)}get(e,t){if(e.includes(".")){let t=e.split(".")[0];return Salla.helpers.getNested({[t]:this.store.get(t)},e)}return this.store.get(e,t)}},Salla.cookie=new class{constructor(){Salla.event.on("cookies::remove",(e=>this.remove(e))),Salla.event.on("cookies::add",((e,t)=>this.set(e,t)))}get(e){return document.cookie.split("; ").find((t=>t.startsWith(e+"=")))?.split("=")[1]}set(e,t="",r=10){let n="";if(r){let e=new Date;e.setTime(e.getTime()+24*r*60*60*1e3),n="; expires="+e.toUTCString()}return document.cookie=`${e}=${t}${n}"; path=/; secure; SameSite=Lax"`,this}remove(e){return document.cookie=`${e}=; Max-Age=0; path=/;`,this}},Salla.helpers=_t,Salla.log=Salla.logger.log,Salla.money=Salla.helpers.money,Salla.url=Salla.helpers.url,Salla.versions={base:"1.6.15-alpha.2"};var or=Salla;e.default=or,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("process")):"function"==typeof define&&define.amd?define(["exports","process"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Salla={},e.process)}(this,(function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t);function i(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}function o(e){let t=(e.match(/\./g)||[]).length;return t&&1!==t?o(e.replace(/\.(.+)\./g,".$1")):e}var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},a=Array.isArray,l="object"==typeof s&&s&&s.Object===Object&&s,c="object"==typeof self&&self&&self.Object===Object&&self,u=l||c||Function("return this")(),f=u.Symbol,h=f,p=Object.prototype,d=p.hasOwnProperty,v=p.toString,g=h?h.toStringTag:void 0;var y=function(e){var t=d.call(e,g),r=e[g];try{e[g]=void 0;var n=!0}catch(e){}var i=v.call(e);return n&&(t?e[g]=r:delete e[g]),i},_=Object.prototype.toString;var m=y,b=function(e){return _.call(e)},w=f?f.toStringTag:void 0;var L=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":w&&w in Object(e)?m(e):b(e)};var S=L,j=function(e){return null!=e&&"object"==typeof e};var E=function(e){return"symbol"==typeof e||j(e)&&"[object Symbol]"==S(e)},x=a,k=E,O=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,A=/^\w*$/;var T=function(e,t){if(x(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!k(e))||(A.test(e)||!O.test(e)||null!=t&&e in Object(t))};var P=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},F=L,$=P;var N,M=function(e){if(!$(e))return!1;var t=F(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},z=u["__core-js_shared__"],R=(N=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+N:"";var I=function(e){return!!R&&R in e},C=Function.prototype.toString;var U=M,D=I,G=P,W=function(e){if(null!=e){try{return C.call(e)}catch(e){}try{return e+""}catch(e){}}return""},J=/^\[object .+?Constructor\]$/,q=Function.prototype,H=Object.prototype,K=q.toString,B=H.hasOwnProperty,Z=RegExp("^"+K.call(B).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Q=function(e){return!(!G(e)||D(e))&&(U(e)?Z:J).test(W(e))},V=function(e,t){return null==e?void 0:e[t]};var X=function(e,t){var r=V(e,t);return Q(r)?r:void 0},Y=X(Object,"create"),ee=Y;var te=function(){this.__data__=ee?ee(null):{},this.size=0};var re=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},ne=Y,ie=Object.prototype.hasOwnProperty;var oe=function(e){var t=this.__data__;if(ne){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return ie.call(t,e)?t[e]:void 0},se=Y,ae=Object.prototype.hasOwnProperty;var le=Y;var ce=te,ue=re,fe=oe,he=function(e){var t=this.__data__;return se?void 0!==t[e]:ae.call(t,e)},pe=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=le&&void 0===t?"__lodash_hash_undefined__":t,this};function de(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])}}de.prototype.clear=ce,de.prototype.delete=ue,de.prototype.get=fe,de.prototype.has=he,de.prototype.set=pe;var ve=de;var ge=function(){this.__data__=[],this.size=0};var ye=function(e,t){return e===t||e!=e&&t!=t};var _e=function(e,t){for(var r=e.length;r--;)if(ye(e[r][0],t))return r;return-1},me=_e,be=Array.prototype.splice;var we=_e;var Le=_e;var Se=_e;var je=ge,Ee=function(e){var t=this.__data__,r=me(t,e);return!(r<0)&&(r==t.length-1?t.pop():be.call(t,r,1),--this.size,!0)},xe=function(e){var t=this.__data__,r=we(t,e);return r<0?void 0:t[r][1]},ke=function(e){return Le(this.__data__,e)>-1},Oe=function(e,t){var r=this.__data__,n=Se(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=je,Ae.prototype.delete=Ee,Ae.prototype.get=xe,Ae.prototype.has=ke,Ae.prototype.set=Oe;var Te=Ae,Pe=X(u,"Map"),Fe=ve,$e=Te,Ne=Pe;var Me=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};var ze=function(e,t){var r=e.__data__;return Me(t)?r["string"==typeof t?"string":"hash"]:r.map},Re=ze;var Ie=ze;var Ce=ze;var Ue=ze;var De=function(){this.size=0,this.__data__={hash:new Fe,map:new(Ne||$e),string:new Fe}},Ge=function(e){var t=Re(this,e).delete(e);return this.size-=t?1:0,t},We=function(e){return Ie(this,e).get(e)},Je=function(e){return Ce(this,e).has(e)},qe=function(e,t){var r=Ue(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=De,He.prototype.delete=Ge,He.prototype.get=We,He.prototype.has=Je,He.prototype.set=qe;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(){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 Ze=Be;var Qe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ve=/\\(\\)?/g,Xe=function(e){var t=Ze(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(Qe,(function(e,r,n,i){t.push(n?i.replace(Ve,"$1"):r||e)})),t})),Ye=Xe;var et=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},tt=a,rt=E,nt=f?f.prototype:void 0,it=nt?nt.toString:void 0;var ot=function e(t){if("string"==typeof t)return t;if(tt(t))return et(t,e)+"";if(rt(t))return it?it.call(t):"";var r=t+"";return"0"==r&&1/t==-Infinity?"-0":r},st=ot;var at=a,lt=T,ct=Ye,ut=function(e){return null==e?"":st(e)};var ft=E;var ht=function(e,t){return at(e)?e:lt(e,t)?[e]:ct(ut(e))},pt=function(e){if("string"==typeof e||ft(e))return e;var t=e+"";return"0"==t&&1/e==-Infinity?"-0":t};var dt=function(e,t){for(var r=0,n=(t=ht(t,e)).length;null!=e&&r<n;)e=e[pt(t[r++])];return r&&r==n?e:void 0};var vt=function(e,t,r){var n=null==e?void 0:dt(e,t);return void 0===n?r:n};function gt(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]=gt(e.slice(1),t,r[n]),r):n?{[n]:gt(e.slice(1),t)}:""===n?[t]:t}function yt(e){return Salla.config.get("store.url",window.location.href.split("/").slice(0,-1).join("/")).rtrim("/")+"/"+e.ltrim("/")}var _t={digitsOnly:function(e){return i(e,!0).replace(/[^0-9.]/g,"").replace("..",".").rtrim(".")},inputDigitsOnly:function e(t,r=!1){if("string"==typeof t)return document.querySelectorAll(t).forEach((t=>e(t,r)));if(!t)return void Salla.logger.warn("Can't find Object With Id: "+t);let n=Salla.helpers.digitsOnly(t.value);return t.min&&n<t.min?t.value=t.min:t.max&&n>t.max?t.value=t.max:t.maxLength>=1&&n.toString().length>t.maxLength?t.value=n.toString().substring(0,t.maxLength):t.value=r||t.dataset.hasOwnProperty("digitsWithDecimal")?o(n):n.replace(/\D/g,"")},number:i,money:function(e){return i(e?.amount|e)+" "+Salla.config.currency(e?.currency).symbol},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=vt(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:gt(n.slice(1),t,r[n[0]])}}return{name:e,value:t}},url:{get:yt,asset:function(e){return function(e){return window.location.origin+"/"+e.ltrim("/")}("themes/"+Salla.config.get("theme.name")+"/"+e.ltrim("/"))},cdn:function(e){return"https://cdn.salla.network/"+e.ltrim("/")},is_page:function(e){return e&&Salla.config.get("page.slug")===e},api:function(e){return Salla.config.get("store.api",yt("")).rtrim("/")+"/"+e.ltrim("/")}},addParamToUrl:function(e,t){if(!t||!e)return window.location.href;let r=new RegExp("([?&])"+e+"=[^&]+[&]?","g"),n=window.location.href.replace(r,"$1").replace(/&$|\?$/,"");return n+=(n.includes("?")?"&":"?")+e+"="+encodeURIComponent(t),n.replace(/&$|\?$/,"")},debounce:function(e,t){t=t||100;let r,n=[];return function(...i){return clearTimeout(r),r=setTimeout((()=>{let t=e(...i);n.forEach((e=>e(t))),n=[]}),t),new Promise((e=>n.push(e)))}}},mt=function(e){let t={log:function(t,r){if(!e)return;"trace"===salla.config.get("debug")&&(r="trace");let n=e.log,i=void 0===r?n:this.__dict__[r]||n,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 bt={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"==typeof n.default&&"function"==typeof n.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 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 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,n,i,o){var s=Object.assign({},n);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&&!r.call(n,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 O(e,r,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=r,h=r._origin||r;if(c&&!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?c?Promise.resolve():new Promise((function(e){l(e)})).then((function(){return t.event=r,f.apply(t,e)})):(c?n.default.nextTick:l)((function(){t.event=r,f.apply(t,e)}))},r._async=!0,r._origin=h}return[r,u?new k(this,e,r):this]}function A(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},A.EventEmitter2=A,A.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},A.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},A.prototype.delimiter=".",A.prototype.setMaxListeners=function(e){e!==t&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},A.prototype.getMaxListeners=function(){return this._maxListeners},A.prototype.event="",A.prototype.once=function(e,t,r){return this._once(e,t,!1,r)},A.prototype.prependOnceListener=function(e,t,r){return this._once(e,t,!0,r)},A.prototype._once=function(e,t,r,n){return this._many(e,1,t,r,n)},A.prototype.many=function(e,t,r,n){return this._many(e,t,r,!1,n)},A.prototype.prependMany=function(e,t,r,n){return this._many(e,t,r,!0,n)},A.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)},A.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},A.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)},A.prototype.on=function(e,t,r){return this._on(e,t,!1,r)},A.prototype.prependListener=function(e,t,r){return this._on(e,t,!0,r)},A.prototype.onAny=function(e){return this._onAny(e,!1)},A.prototype.prependAny=function(e){return this._onAny(e,!0)},A.prototype.addListener=A.prototype.on,A.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},A.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=O.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)},A.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},A.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},A.prototype.removeListener=A.prototype.off,A.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},A.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:[]},A.prototype.eventNames=function(e){var t=this._events;return this.wildcard?E.call(this,this.listenerTree,[],null,e):t?c(t):[]},A.prototype.listenerCount=function(e){return this.listeners(e).length},A.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]))},A.prototype.listenersAny=function(){return this._all?this._all:[]},A.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=A.prototype;Object.defineProperties(A,{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=A}()}(bt);var wt=bt.exports;var Lt=Object.assign?Object.assign:function(e,t,r,n){for(var i=1;i<arguments.length;i++)Ot(Object(arguments[i]),(function(t,r){e[r]=t}));return e},St=function(){if(Object.create)return function(e,t,r,n){var i=kt(arguments,1);return Lt.apply(this,[Object.create(e)].concat(i))};{function e(){}return function(t,r,n,i){var o=kt(arguments,1);return e.prototype=t,Lt.apply(this,[new e].concat(o))}}}(),jt=String.prototype.trim?function(e){return String.prototype.trim.call(e)}:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},Et="undefined"!=typeof window?window:s,xt={assign:Lt,create:St,trim:jt,bind:function(e,t){return function(){return t.apply(e,Array.prototype.slice.call(arguments,0))}},slice:kt,each:Ot,map:function(e,t){var r=Tt(e)?[]:{};return At(e,(function(e,n){return r[n]=t(e,n),!1})),r},pluck:At,isList:Tt,isFunction:function(e){return e&&"[object Function]"==={}.toString.call(e)},isObject:function(e){return e&&"[object Object]"==={}.toString.call(e)},Global:Et};function kt(e,t){return Array.prototype.slice.call(e,t||0)}function Ot(e,t){At(e,(function(e,r){return t(e,r),!1}))}function At(e,t){if(Tt(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 Tt(e){return null!=e&&"function"!=typeof e&&"number"==typeof e.length}var Pt=xt.slice,Ft=xt.pluck,$t=xt.each,Nt=xt.bind,Mt=xt.create,zt=xt.isList,Rt=xt.isFunction,It=xt.isObject,Ct={createStore:Dt},Ut={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 Dt.apply(this,arguments)},addPlugin:function(e){this._addPlugin(e)},namespace:function(e){return Dt(this.storage,this.plugins,e)}};function Dt(e,t,r){r||(r=""),e&&!zt(e)&&(e=[e]),t&&!zt(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=Pt(arguments,0),n=this;function i(){if(r)return $t(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(zt(e))$t(e,(function(e){t._addPlugin(e)}));else if(!Ft(this.plugins,(function(t){return e===t}))){if(this.plugins.push(e),!Rt(e))throw new Error("Plugins must be function values that return objects");var r=e.call(this);if(!It(r))throw new Error("Plugins must return an object of function properties");$t(r,(function(r,n){if(!Rt(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=Mt(o,Ut,{plugins:[]});return s.raw={},$t(s,(function(e,t){Rt(e)&&(s.raw[t]=Nt(s,e))})),$t(e,(function(e){s._addStorage(e)})),$t(t,(function(e){s._addPlugin(e)})),s}var Gt=xt.Global,Wt={name:"localStorage",read:qt,write:function(e,t){return Jt().setItem(e,t)},each:function(e){for(var t=Jt().length-1;t>=0;t--){var r=Jt().key(t);e(qt(r),r)}},remove:function(e){return Jt().removeItem(e)},clearAll:function(){return Jt().clear()}};function Jt(){return Gt.localStorage}function qt(e){return Jt().getItem(e)}var Ht=xt.Global,Kt={name:"sessionStorage",read:Zt,write:function(e,t){return Bt().setItem(e,t)},each:function(e){for(var t=Bt().length-1;t>=0;t--){var r=Bt().key(t);e(Zt(r),r)}},remove:function(e){return Bt().removeItem(e)},clearAll:function(){return Bt().clear()}};function Bt(){return Ht.sessionStorage}function Zt(e){return Bt().getItem(e)}var Qt=xt.trim,Vt={name:"cookieStorage",read:function(e){if(!e||!tr(e))return null;var t="(?:^|.*;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(Xt.cookie.replace(new RegExp(t),"$1"))},write:function(e,t){if(!e)return;Xt.cookie=escape(e)+"="+escape(t)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/"},each:Yt,remove:er,clearAll:function(){Yt((function(e,t){er(t)}))}},Xt=xt.Global.document;function Yt(e){for(var t=Xt.cookie.split(/; ?/g),r=t.length-1;r>=0;r--)if(Qt(t[r])){var n=t[r].split("="),i=unescape(n[0]);e(unescape(n[1]),i)}}function er(e){e&&tr(e)&&(Xt.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function tr(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(Xt.cookie)}var rr={name:"memoryStorage",read:function(e){return nr[e]},write:function(e,t){nr[e]=t},each:function(e){for(var t in nr)nr.hasOwnProperty(t)&&e(nr[t],t)},remove:function(e){delete nr[e]},clearAll:function(e){nr={}}},nr={};const ir=Ct.createStore([Wt,Kt,Vt,rr],[]);"undefined"==typeof global?(window.salla=window.salla||window.Salla||{},window.Salla=window.salla):(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 Object.assign(this.properties_,e),this.properties_.store={...this.default_properties.store,...this.properties_.store},this}set(e,t){return e.includes(".")?(Salla.helpers.setNested(this.properties_,e,t),this):(this.properties_[e]=t,this)}get(e,t=null){return e.includes(".")?Salla.helpers.getNested(this.properties_,e,t):this.properties_.hasOwnProperty(e)?this.properties_[e]||t:t||void 0}all(){return this.properties_}},Salla.logger=mt,Salla.event=new class extends wt{constructor(){super({wildcard:!0,delimiter:"::",newListener:!1,removeListener:!1,maxListeners:10,verboseMemoryLeak:!1,ignoreErrors:!1}),this.delimiter="::","undefined"!=typeof document&&(this.body=document.querySelector("body")),this.logableEvents=["cart::item.added.failed","cart::item.deleted.failed"],this.ingoreLogEvents=["document::click","document::keyup","document::change"],this.noneFireableActions=["document.request"]}createAndDispatch(e,...t){this.dispatch(e,...t)}emit(e,...t){let r=e.replace("::",".");if(!this.noneFireableActions.includes(r)&&void 0!==Salla.call&&"function"==typeof Salla.call(r))return Salla.log(`'Salla.${r}(...)' triggered using event '${e}'`),r=r.split("."),void salla[r[0]][r[1]](...t);super.emit(e,...t),"undefined"!=typeof window&&(window.dataLayer=window.dataLayer||[],window.dataLayer.push(Object.assign({event:e},...t.values()))),!this.ingoreLogEvents.includes(e)&&(void 0!==Salla.config&&Salla.config.get("debug")||this.logableEvents.includes(e))&&void 0!==Salla.logger&&Salla.logger.event(e,...t),this.dispatchMobileEvent(e,{...t.values()})}dispatch(e,...t){return this.emit(e,...t)}dispatchEvents(e){if(e&&"object"==typeof e)for(const[t,r]of Object.entries(e))this.dispatch(t,r);else Salla.log("No Events To Dispatch!",e)}addListener(e,t){return this.on(e,t)}addEventListener(e,t){return this.on(e,t)}listen(e,t){return this.on(e,t)}registerGlobalListener(e,t){return this.onAny(t)}dispatchMobileEvent(e,t={}){if(!("undefined"!=typeof window&&window.dataLayer&&dataLayer[0]&&dataLayer[0].page&&dataLayer[0].page.mobileApp))return"";if(window.webkit)try{window.webkit.messageHandlers.callbackHandler.postMessage(JSON.stringify({event:e,details:t}))}catch(e){Salla.log(e,"The native context does not exist yet")}else if(Android)try{Android.customEventWithData(e,JSON.stringify({details:t}))}catch(e){Salla.log(e,"The native context does not exist yet")}}},Salla.storage=new class{constructor(){Salla.event.on("storage::item.remove",(e=>this.remove(e))),Salla.event.on("storage::item.set",((e,t)=>this.set(e,t))),this.store=ir}set(e,t){if(e.includes(".")){let r=e.split(".")[0],n={[r]:this.store.get(r)};return n=Salla.helpers.setNested(n,e,t),this.store.set(r,n[r])}return this.store.set(e,t)}remove(e){return this.store.remove(e)}get(e,t){if(e.includes(".")){let t=e.split(".")[0];return Salla.helpers.getNested({[t]:this.store.get(t)},e)}return this.store.get(e,t)}},Salla.cookie=new class{constructor(){Salla.event.on("cookies::remove",(e=>this.remove(e))),Salla.event.on("cookies::add",((e,t)=>this.set(e,t)))}get(e){return document.cookie.split("; ").find((t=>t.startsWith(e+"=")))?.split("=")[1]}set(e,t="",r=10){let n="";if(r){let e=new Date;e.setTime(e.getTime()+24*r*60*60*1e3),n="; expires="+e.toUTCString()}return document.cookie=`${e}=${t}${n}"; path=/; secure; SameSite=Lax"`,this}remove(e){return document.cookie=`${e}=; Max-Age=0; path=/;`,this}},Salla.helpers=_t,Salla.log=Salla.logger.log,Salla.money=Salla.helpers.money,Salla.url=Salla.helpers.url,Salla.versions={base:"1.6.15-alpha.3"};var or=Salla;e.default=or,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=base.min.js.map
{
"name": "@salla.sa/base",
"version": "1.6.15-alpha.3",
"version": "1.6.15-alpha.4",
"description": "Salla Base",

@@ -57,3 +57,3 @@ "main": "dist/cjs/",

},
"gitHead": "388f87439b78174807988951d3877e9681278f00"
"gitHead": "f9a3f2ef255c5a6088d52385400947747cb69cac"
}

@@ -61,3 +61,3 @@

## Overview
**Salla Core JS** Salla Core JS package is based on the Event-Driven Architecture, which is a modern design approach centered on data that represents "events" (i.e., a product has been added to the cart). In event-driven programming, an event is the result of a single or multiple actions. Subscribers can listen to that event and take action after it is released by the emitter.
**Salla Core JS** package is based on the Event-Driven Architecture, which is a modern design approach centered on data that represents "events" (i.e., a product has been added to the cart). In event-driven programming, an event is the result of a single or multiple actions. Subscribers can listen to that event and take action after it is released by the emitter.

@@ -64,0 +64,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc