UNPKG

@namiml/web-sdk

Version:

Nami Web SDK makes subscriptions & in-app purchases easy, with powerful built-in paywalls and A/B testing

1 lines 1.56 MB
"use strict";var e=require("lit"),t=require("lit/directives/repeat.js");function n(e,t){this.v=e,this.k=t}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function r(e){return new n(e,0)}function o(e,t,n){return t=p(t),w(e,y()?Reflect.construct(t,n||[],p(e).constructor):t.apply(e,n))}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!{}.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}(()=>{if("undefined"==typeof globalThis){var e="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:Function("return this")();Object.defineProperty(e,"globalThis",{value:e,writable:!0,enumerable:!1,configurable:!0})}})(),"undefined"!=typeof Element&&"function"!=typeof Element.prototype.getAttributeNames&&(Element.prototype.getAttributeNames=function(){for(var e=this.attributes,t=new Array(e.length),n=0;n<e.length;n+=1)t[n]=e[n].name;return t});var l=0;function d(e){return"__private_"+l+++"_"+e}function h(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,D(i.key),i)}}function c(e,t,n){return t&&h(e.prototype,t),n&&h(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function m(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return i(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e))||t){n&&(e=n);var a=0;return function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},f.apply(null,arguments)}function v(){return v="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var i=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=p(e)););return e}(e,t);if(i){var a=Object.getOwnPropertyDescriptor(i,t);return a.get?a.get.call(arguments.length<3?e:n):a.value}},v.apply(null,arguments)}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function g(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&P(e,t)}function y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(y=function(){return!!e})()}function b(e,t){if(null==e)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;n[i]=e[i]}return n}function w(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return a(e)}function k(){var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function r(n,i,a,r){var u=i&&i.prototype instanceof s?i:s,l=Object.create(u.prototype);return M(l,"_invoke",function(n,i,a){var r,s,u,l=0,d=a||[],h=!1,c={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return r=t,s=0,u=e,c.n=n,o}};function m(n,i){for(s=n,u=i,t=0;!h&&l&&!a&&t<d.length;t++){var a,r=d[t],m=c.p,f=r[2];n>3?(a=f===i)&&(u=r[(s=r[4])?5:(s=3,3)],r[4]=r[5]=e):r[0]<=m&&((a=n<2&&m<r[1])?(s=0,c.v=i,c.n=r[1]):m<f&&(a=n<3||r[0]>i||i>f)&&(r[4]=n,r[5]=i,c.n=f,s=0))}if(a||n>1)return o;throw h=!0,i}return function(a,d,f){if(l>1)throw TypeError("Generator is already running");for(h&&1===d&&m(d,f),s=d,u=f;(t=s<2?e:u)||!h;){r||(s?s<3?(s>1&&(c.n=-1),m(s,u)):c.n=u:c.v=u);try{if(l=2,r){if(s||(a="next"),t=r[a]){if(!(t=t.call(r,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,s<2&&(s=0)}else 1===s&&(t=r.return)&&t.call(r),s<2&&(u=TypeError("The iterator does not provide a '"+a+"' method"),s=1);r=e}else if((t=(h=c.n<0)?u:n.call(i,c))!==o)break}catch(t){r=e,s=1,u=t}finally{l=1}}return{value:t,done:h}}}(n,a,r),!0),l}var o={};function s(){}function u(){}function l(){}t=Object.getPrototypeOf;var d=[][i]?t(t([][i]())):(M(t={},i,(function(){return this})),t),h=l.prototype=s.prototype=Object.create(d);function c(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,M(e,a,"GeneratorFunction")),e.prototype=Object.create(h),e}return u.prototype=l,M(h,"constructor",l),M(l,"constructor",u),u.displayName="GeneratorFunction",M(l,a,"GeneratorFunction"),M(h),M(h,a,"Generator"),M(h,i,(function(){return this})),M(h,"toString",(function(){return"[object Generator]"})),(k=function(){return{w:r,m:c}})()}function S(e,t,n,i,a){var r=function(e,t,n,i,a){return new E(k().w(e,t,n,i),a||Promise)}(e,t,n,i,a);return r.next().then((function(e){return e.done?e.value:r.next()}))}function E(e,t){function i(a,r,o,s){try{var u=e[a](r),l=u.value;return l instanceof n?t.resolve(l.v).then((function(e){i("next",e,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(l).then((function(e){u.value=e,o(u)}),(function(e){return i("throw",e,o,s)}))}catch(e){s(e)}}var a;this.next||(M(E.prototype),M(E.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",(function(){return this}))),M(this,"_invoke",(function(e,n,r){function o(){return new t((function(t,n){i(e,r,t,n)}))}return a=a?a.then(o,o):o()}),!0)}function M(e,t,n,i){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}M=function(e,t,n,i){function r(t,n){M(e,t,(function(e){return this._invoke(t,n,e)}))}t?a?a(e,t,{value:n,enumerable:!i,configurable:!i,writable:!i}):e[t]=n:(r("next",0),r("throw",1),r("return",2))},M(e,t,n,i)}function P(e,t){return P=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},P(e,t)}function T(e,t,n,i){var a=v(p(e.prototype),t,n);return"function"==typeof a?function(e){return a.apply(n,e)}:a}function D(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function A(e){var t="function"==typeof Map?new Map:void 0;return A=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(y())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,t);var a=new(e.bind.apply(e,i));return n&&P(a,n.prototype),a}(e,arguments,p(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),P(n,e)},A(e)}var x,C,L,I,_,F,R,W,N,O,j,$,z=function(){return c((function e(t){s(this,e),this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColSpan="",this.ariaCurrent="",this.ariaDescription="",this.ariaDisabled="",this.ariaExpanded="",this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=t}),[{key:"shadowRoot",get:function(){return this.__host.__shadowRoot}},{key:"checkValidity",value:function(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}},{key:"reportValidity",value:function(){return!0}},{key:"setFormValue",value:function(){}},{key:"setValidity",value:function(){}}])}(),B=function(e,t,n,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,n):a?a.value=n:t.set(e,n),n},H=function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)},U=e=>{var t;return"boolean"==typeof e?e:null!==(t=null==e?void 0:e.capture)&&void 0!==t&&t},G=function(){return c((function e(){s(this,e),this.__eventListeners=new Map,this.__captureEventListeners=new Map}),[{key:"addEventListener",value:function(e,t,n){var i;if(null!=t){var a=U(n)?this.__captureEventListeners:this.__eventListeners,r=a.get(e);if(void 0===r)r=new Map,a.set(e,r);else if(r.has(t))return;var o="object"==typeof n&&n?n:{};null===(i=o.signal)||void 0===i||i.addEventListener("abort",(()=>this.removeEventListener(e,t,n))),r.set(t,null!=o?o:{})}}},{key:"removeEventListener",value:function(e,t,n){if(null!=t){var i=U(n)?this.__captureEventListeners:this.__eventListeners,a=i.get(e);void 0!==a&&(a.delete(t),a.size||i.delete(e))}}},{key:"dispatchEvent",value:function(e){var t=[this],n=this.__eventTargetParent;if(e.composed)for(;n;)t.push(n),n=n.__eventTargetParent;else for(;n&&n!==this.__host;)t.push(n),n=n.__eventTargetParent;var i=!1,a=!1,r=0,o=null,s=null,u=null,l=e.stopPropagation,d=e.stopImmediatePropagation;Object.defineProperties(e,{target:f({get:()=>null!=o?o:s},X),srcElement:f({get:()=>e.target},X),currentTarget:f({get:()=>u},X),eventPhase:f({get:()=>r},X),composedPath:f({value:()=>t},X),stopPropagation:f({value:()=>{i=!0,l.call(e)}},X),stopImmediatePropagation:f({value:()=>{a=!0,d.call(e)}},X)});var h=(t,n,i)=>{"function"==typeof t?t(e):"function"==typeof(null==t?void 0:t.handleEvent)&&t.handleEvent(e),n.once&&i.delete(t)},c=()=>(u=null,r=0,!e.defaultPrevented),v=t.slice().reverse();o=this.__host&&e.composed?null:this;for(var p,g=e=>{for(s=this;s.__host&&e.includes(s.__host);)s=s.__host},y=m(v);!(p=y()).done;){var b=p.value;o||s&&s!==b.__host||g(v.slice(v.indexOf(b))),u=b,r=b===e.target?2:1;var w=b.__captureEventListeners.get(e.type);if(w)for(var k,S=m(w);!(k=S()).done;){var E=k.value;if(h(E[0],E[1],w),a)return c()}if(i)return c()}var M=e.bubbles?t:[this];s=null;for(var P,T=m(M);!(P=T()).done;){var D=P.value;o||s&&D!==s.__host||g(M.slice(0,M.indexOf(D)+1)),u=D,r=D===e.target?2:3;var A=D.__eventListeners.get(e.type);if(A)for(var x,C=m(A);!(x=C()).done;){var L=x.value;if(h(L[0],L[1],A),a)return c()}if(i)return c()}return c()}}])}(),V=G,X={__proto__:null,enumerable:!0};Object.freeze(X);var K=(O=function(){return c((function e(t,n={}){if(s(this,e),x.set(this,!1),C.set(this,!1),L.set(this,!1),I.set(this,!1),_.set(this,Date.now()),F.set(this,!1),R.set(this,void 0),W.set(this,void 0),N.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,0===arguments.length)throw new Error("The type argument must be specified");if("object"!=typeof n||!n)throw new Error('The "options" argument must be an object');var i=n.bubbles,a=n.cancelable,r=n.composed;B(this,x,!!a,"f"),B(this,C,!!i,"f"),B(this,L,!!r,"f"),B(this,R,`${t}`,"f"),B(this,W,null,"f"),B(this,N,!1,"f")}),[{key:"initEvent",value:function(e,t,n){throw new Error("Method not implemented.")}},{key:"stopImmediatePropagation",value:function(){this.stopPropagation()}},{key:"preventDefault",value:function(){B(this,I,!0,"f")}},{key:"target",get:function(){return H(this,W,"f")}},{key:"currentTarget",get:function(){return H(this,W,"f")}},{key:"srcElement",get:function(){return H(this,W,"f")}},{key:"type",get:function(){return H(this,R,"f")}},{key:"cancelable",get:function(){return H(this,x,"f")}},{key:"defaultPrevented",get:function(){return H(this,x,"f")&&H(this,I,"f")}},{key:"timeStamp",get:function(){return H(this,_,"f")}},{key:"composedPath",value:function(){return H(this,N,"f")?[H(this,W,"f")]:[]}},{key:"returnValue",get:function(){return!H(this,x,"f")||!H(this,I,"f")}},{key:"bubbles",get:function(){return H(this,C,"f")}},{key:"composed",get:function(){return H(this,L,"f")}},{key:"eventPhase",get:function(){return H(this,N,"f")?O.AT_TARGET:O.NONE}},{key:"cancelBubble",get:function(){return H(this,F,"f")},set:function(e){e&&B(this,F,!0,"f")}},{key:"stopPropagation",value:function(){B(this,F,!0,"f")}},{key:"isTrusted",get:function(){return!1}}])}(),x=new WeakMap,C=new WeakMap,L=new WeakMap,I=new WeakMap,_=new WeakMap,F=new WeakMap,R=new WeakMap,W=new WeakMap,N=new WeakMap,O.NONE=0,O.CAPTURING_PHASE=1,O.AT_TARGET=2,O.BUBBLING_PHASE=3,O);Object.defineProperties(K.prototype,{initEvent:X,stopImmediatePropagation:X,preventDefault:X,target:X,currentTarget:X,srcElement:X,type:X,cancelable:X,defaultPrevented:X,timeStamp:X,composedPath:X,returnValue:X,bubbles:X,composed:X,eventPhase:X,cancelBubble:X,stopPropagation:X,isTrusted:X});var Y=($=function(){function e(t,n={}){var i,a;return s(this,e),a=o(this,e,[t,n]),j.set(a,void 0),B(a,j,null!==(i=null==n?void 0:n.detail)&&void 0!==i?i:null,"f"),a}return g(e,K),c(e,[{key:"initCustomEvent",value:function(e,t,n,i){throw new Error("Method not implemented.")}},{key:"detail",get:function(){return H(this,j,"f")}}])}(),j=new WeakMap,$);Object.defineProperties(Y.prototype,{detail:X});var q,J,Q,Z=K,ee=Y;null!==(q=globalThis.Event)&&void 0!==q||(globalThis.Event=Z),null!==(J=globalThis.CustomEvent)&&void 0!==J||(globalThis.CustomEvent=ee);var te=new WeakMap,ne=e=>{var t=te.get(e);return void 0===t&&te.set(e,t=new Map),t},ie=function(){function e(){var t;return s(this,e),(t=o(this,e,arguments)).__shadowRootMode=null,t.__shadowRoot=null,t.__internals=null,t}return g(e,V),c(e,[{key:"attributes",get:function(){return Array.from(ne(this)).map((([e,t])=>({name:e,value:t})))}},{key:"shadowRoot",get:function(){return"closed"===this.__shadowRootMode?null:this.__shadowRoot}},{key:"localName",get:function(){return this.constructor.__localName}},{key:"tagName",get:function(){var e;return null===(e=this.localName)||void 0===e?void 0:e.toUpperCase()}},{key:"setAttribute",value:function(e,t){ne(this).set(e,String(t))}},{key:"removeAttribute",value:function(e){ne(this).delete(e)}},{key:"toggleAttribute",value:function(e,t){return this.hasAttribute(e)?!(void 0===t||!t)||(this.removeAttribute(e),!1):!(void 0!==t&&!t)&&(this.setAttribute(e,""),!0)}},{key:"hasAttribute",value:function(e){return ne(this).has(e)}},{key:"attachShadow",value:function(e){var t={host:this};return this.__shadowRootMode=e.mode,e&&"open"===e.mode&&(this.__shadowRoot=t),t}},{key:"attachInternals",value:function(){if(null!==this.__internals)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");var e=new z(this);return this.__internals=e,e}},{key:"getAttribute",value:function(e){var t=ne(this).get(e);return null!=t?t:null}}])}(),ae=function(){function e(){return s(this,e),o(this,e,arguments)}return g(e,ie),c(e)}();function re(){var e,t;return{promise:new Promise(((n,i)=>{e=n,t=i})),resolve:e,reject:t}}function oe(e,t,n,i){var a,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(o=(r<3?a(o):r>3?a(t,n,o):a(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o}function se(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function ue(e,t,n,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,n):a?a.value=n:t.set(e,n),n}null!==(Q=globalThis.litServerRoot)&&void 0!==Q||(globalThis.litServerRoot=Object.defineProperty(new ae,"localName",{get:()=>"lit-server-root"})),new(function(){return c((function e(){s(this,e),this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}),[{key:"define",value:function(e,t){var n,i;if(this.__definitions.has(e)){if("development"!==process.env.NODE_ENV)throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${e}" has already been used with this registry`);console.warn(`'CustomElementRegistry' already has "${e}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.\nMake sure to test your application with a production build as repeat registrations will throw in production.`)}if(this.__reverseDefinitions.has(t))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(t)}`);t.__localName=e,this.__definitions.set(e,{ctor:t,observedAttributes:null!==(n=t.observedAttributes)&&void 0!==n?n:[]}),this.__reverseDefinitions.set(t,e),null===(i=this.__pendingWhenDefineds.get(e))||void 0===i||i.resolve(t),this.__pendingWhenDefineds.delete(e)}},{key:"get",value:function(e){var t=this.__definitions.get(e);return null==t?void 0:t.ctor}},{key:"getName",value:function(e){var t;return null!==(t=this.__reverseDefinitions.get(e))&&void 0!==t?t:null}},{key:"upgrade",value:function(e){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}},{key:"whenDefined",value:function(e){var t,n;return S((function(i){for(;;)switch(i.n){case 0:if(!(t=this.__definitions.get(e))){i.n=1;break}return i.a(2,t.ctor);case 1:return(n=this.__pendingWhenDefineds.get(e))||(n=re(),this.__pendingWhenDefineds.set(e,n)),i.a(2,n.promise)}}),null,this,null,Promise)}}])}()),"undefined"==typeof HTMLElement&&(globalThis.HTMLElement=ae),"function"==typeof SuppressedError&&SuppressedError;var le;!function(e){e.SDK="sdk",e.ML="ml",e.THIRD_PARTY_ANALYTICS="third_party_analytics",e.THIRD_PARTY_TRANSACTIONS="third_party_transactions",e.PAYWALL_PERSONALIZATION="paywall_personalization",e.ANONYMOUS_MODE_CAPABILITY="anonymous_allowed",e.LANGUAGE_MANAGEMENT="language_management",e.ENTITLEMENT_MANAGEMENT="entitlement_management"}(le||(le={}));var de,he={},ce=he.NAMI_SDK_VERSION,me=void 0===ce?"3.3.4":ce,fe=he.PLATFORM_ID_REQUIRED,ve=void 0===fe?"Platform ID is required":fe,pe=he.DEVICE_ID_REQUIRED,ge=void 0===pe?"Device ID is required":pe,ye=he.EXTERNAL_ID_REQUIRED,be=void 0===ye?"External ID is required":ye,we=he.SDK_NOT_INITIALIZED,ke=void 0===we?"SDK has not been initialized. Make sure to call Nami.configure() first!":we,Se=he.CAMPAIGN_NOT_AVAILABLE,Ee=void 0===Se?"Campaign is not available":Se,Me=he.FLOW_SCREENS_NOT_AVAILABLE,Pe=void 0===Me?"Flow screens not available":Me,Te=he.UNABLE_TO_UPDATE_CDP_ID,De=void 0===Te?"Unable to update CDP id in anonymous mode":Te,Ae=he.ANONYMOUS_MODE_ALREADY_ON,xe=void 0===Ae?"Anonymous mode is already turned on.":Ae,Ce=he.ANONYMOUS_MODE_ALREADY_OFF,Le=void 0===Ce?"Anonymous mode is already turned off.":Ce,Ie=he.DEVICE_ID_NOT_SET,_e=void 0===Ie?"Nami Device ID is not set":Ie,Fe=he.AUTH_DEVICE,Re=void 0===Fe?"nami_auth_device":Fe,We=he.NAMI_CONFIGURATION,Ne=void 0===We?"nami_configuration":We,Oe=he.NAMI_PROFILE,je=void 0===Oe?"nami_profile":Oe,$e=he.API_CONFIG,ze=void 0===$e?"api_config":$e,Be=he.API_CAMPAIGN_RULES,He=void 0===Be?"api_campaign_rules":Be,Ue=he.API_PAYWALLS,Ge=void 0===Ue?"api_paywalls":Ue,Ve=he.API_PRODUCTS,Xe=void 0===Ve?"api_products":Ve,Ke=he.API_ACTIVE_ENTITLEMENTS,Ye=void 0===Ke?"api_active_entitlements":Ke,qe=he.SERVER_NAMI_ENTITLEMENTS,Je=void 0===qe?"server_active_entitlements":qe,Qe=he.INITIAL_APP_CONFIG,Ze=void 0===Qe?"initial_app_config":Qe,et=he.INITIAL_CAMPAIGN_RULES,tt=void 0===et?"initial_campaign_rules":et,nt=he.INITIAL_PAYWALLS,it=void 0===nt?"initial_paywalls":nt,at=he.INITIAL_PRODUCTS,rt=void 0===at?"initial_products":at,ot=he.LOCAL_NAMI_ENTITLEMENTS,st=void 0===ot?"local_active_entitlements":ot,ut=he.CUSTOMER_ATTRIBUTES_KEY_PREFIX,lt=void 0===ut?"nami_cmr_attributes_":ut,dt=he.NAMI_CUSTOMER_JOURNEY_STATE,ht=void 0===dt?"nami_customer_journey_state":dt,ct=he.ANONYMOUS_MODE,mt=void 0===ct?"nami_anonymous_mode_v2":ct,ft=he.ANONYMOUS_UUID,vt=void 0===ft?"nami_anonymous_uuid":ft,pt=he.KEY_SESSION_COUNTER,gt=void 0===pt?"nami_session_counter":pt,yt=he.INITIAL_SESSION_COUNTER_VALUE,bt=void 0===yt?1:yt,wt=he.NAMI_LAST_IMPRESSION_ID,kt=void 0===wt?"nami_last_impression_id":wt,St=he.NAMI_PURCHASE_IMPRESSION_ID,Et=void 0===St?"nami_purchase_impression_id":St,Mt=he.NAMI_LAUNCH_ID,Pt=void 0===Mt?"nami_launch_id":Mt,Tt=he.NAMI_SESSION_ID,Dt=void 0===Tt?"nami_session_id":Tt,At=he.NAMI_LANGUAGE_CODE,xt=void 0===At?"nami_language_code":At,Ct=he.NAMI_PURCHASE_CHANNEL,Lt=void 0===Ct?"nami_purchase_channel":Ct,It=he.API_VERSION,_t=he.BASE_URL_PATH,Ft=void 0===_t?`sdk/${void 0===It?"v3":It}/platform`:_t,Rt=he.BASE_URL,Wt=void 0===Rt?"https://app.namiml.com":Rt,Nt=he.BASE_STAGING_URL,Ot=void 0===Nt?"https://app-staging.namiml.com":Nt,jt=he.CUSTOM_HOST_PREFIX,$t=void 0===jt?"namiAPIHost=":jt,zt=he.USE_STAGING_API,Bt=void 0===zt?"useStagingAPI":zt,Ht=he.EXTENDED_CLIENT_INFO_PREFIX,Ut=void 0===Ht?"extendedClientInfo":Ht,Gt=he.EXTENDED_CLIENT_INFO_DELIMITER,Vt=void 0===Gt?":":Gt,Xt=he.VALIDATE_PRODUCT_GROUPS,Kt=void 0===Xt?"validateProductGroups":Xt,Yt=he.API_MAX_CALLS_LIMIT,qt=void 0===Yt?2:Yt,Jt=he.API_RETRY_DELAY_SEC,Qt=void 0===Jt?2:Jt,Zt=he.API_TIMEOUT_LIMIT,en=void 0===Zt?2e4:Zt,tn=he.DEVICE_API_TIMEOUT_LIMIT,nn=void 0===tn?3e3:tn,an=he.STATUS_BAD_REQUEST,rn=void 0===an?400:an,on=he.STATUS_NOT_FOUND,sn=void 0===on?404:on,un=he.STATUS_CONFLICT,ln=void 0===un?409:un,dn=he.STATUS_INTERNAL_SERVER_ERROR,hn=void 0===dn?500:dn,cn=he.INITIAL_SUCCESS,mn=void 0===cn?"Initial success":cn,fn=he.RECONFIG_SUCCESS,vn=void 0===fn?"Reconfig success":fn,pn=he.ALREADY_CONFIGURED,gn=void 0===pn?"Already configured":pn,yn=he.AVAILABLE_CAMPAIGNS_CHANGED,bn=void 0===yn?"AvailableCampaignsChanged":yn,wn=he.PAYWALL_ACTION_EVENT,kn=void 0===wn?"PaywallActionEvent":wn,Sn=he.AVAILABLE_ACTIVE_ENTITLEMENTS_CHANGED,En=void 0===Sn?"AvailableActiveEntitlementsChanged":Sn,Mn=he.CUSTOMER_JOURNEY_STATE_CHANGED,Pn=void 0===Mn?"CustomerJourneyStateChanged":Mn,Tn=he.SKU_TEXT_REGEX,Dn=void 0===Tn?/\$\{sku\.(\w+)(:\d+)?\}/g:Tn,An=he.VAR_REGEX,xn=void 0===An?/\$\{\s*(\w+(\.[a-zA-Z\d_:${}-]{0,99})*?)\s*}/g:An,Cn=he.SMART_TEXT_PATTERN,Ln=void 0===Cn?"${":Cn;exports.LogLevel=void 0,(de=exports.LogLevel||(exports.LogLevel={}))[de.DEBUG=1]="DEBUG",de[de.INFO=2]="INFO",de[de.WARN=3]="WARN",de[de.ERROR=4]="ERROR";var In={debug:exports.LogLevel.DEBUG,info:exports.LogLevel.INFO,warn:exports.LogLevel.WARN,error:exports.LogLevel.ERROR},_n=function(){return c((function e(){s(this,e),this.currentLogLevel=exports.LogLevel.DEBUG,this.setLogger=e=>{this.currentLogLevel=e?In[e]:exports.LogLevel.WARN}}),[{key:"debug",value:function(e,...t){this.shouldLog(exports.LogLevel.DEBUG)&&console.debug(this.formatMessage(exports.LogLevel.DEBUG,e,...t))}},{key:"info",value:function(e,...t){this.shouldLog(exports.LogLevel.INFO)&&console.info(this.formatMessage(exports.LogLevel.INFO,e,...t))}},{key:"warn",value:function(e,...t){this.shouldLog(exports.LogLevel.WARN)&&console.warn(this.formatMessage(exports.LogLevel.WARN,e,...t))}},{key:"error",value:function(e,...t){this.shouldLog(exports.LogLevel.ERROR)&&console.error(this.formatMessage(exports.LogLevel.ERROR,e,...t))}},{key:"shouldLog",value:function(e){return e>=this.currentLogLevel}},{key:"formatMessage",value:function(e,t,...n){var i=exports.LogLevel[e];return`[${(new Date).toISOString()}] [${i}] ${t} ${n=n.map((e=>"object"==typeof e?JSON.stringify(e):e))}`}}])}(),Fn=new _n;function Rn(e){for(var t=-1,n=null==e?0:e.length,i=0,a=[];++t<n;){var r=e[t];r&&(a[i++]=r)}return a}function Wn(e,t){return e===t||e!=e&&t!=t}function Nn(e,t){for(var n=e.length;n--;)if(Wn(e[n][0],t))return n;return-1}var On=Array.prototype.splice;function jn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}jn.prototype.clear=function(){this.__data__=[],this.size=0},jn.prototype.delete=function(e){var t=this.__data__,n=Nn(t,e);return!(n<0)&&(n==t.length-1?t.pop():On.call(t,n,1),--this.size,!0)},jn.prototype.get=function(e){var t=this.__data__,n=Nn(t,e);return n<0?void 0:t[n][1]},jn.prototype.has=function(e){return Nn(this.__data__,e)>-1},jn.prototype.set=function(e,t){var n=this.__data__,i=Nn(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};var $n="object"==typeof global&&global&&global.Object===Object&&global,zn="object"==typeof self&&self&&self.Object===Object&&self,Bn=$n||zn||Function("return this")(),Hn=Bn.Symbol,Un=Object.prototype,Gn=Un.hasOwnProperty,Vn=Un.toString,Xn=Hn?Hn.toStringTag:void 0;var Kn=Object.prototype.toString;var Yn="[object Null]",qn="[object Undefined]",Jn=Hn?Hn.toStringTag:void 0;function Qn(e){return null==e?void 0===e?qn:Yn:Jn&&Jn in Object(e)?function(e){var t=Gn.call(e,Xn),n=e[Xn];try{e[Xn]=void 0;var i=!0}catch(e){}var a=Vn.call(e);return i&&(t?e[Xn]=n:delete e[Xn]),a}(e):function(e){return Kn.call(e)}(e)}function Zn(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var ei="[object AsyncFunction]",ti="[object Function]",ni="[object GeneratorFunction]",ii="[object Proxy]";function ai(e){if(!Zn(e))return!1;var t=Qn(e);return t==ti||t==ni||t==ei||t==ii}var ri,oi=Bn["__core-js_shared__"],si=(ri=/[^.]+$/.exec(oi&&oi.keys&&oi.keys.IE_PROTO||""))?"Symbol(src)_1."+ri:"";var ui=Function.prototype.toString;function li(e){if(null!=e){try{return ui.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var di=/^\[object .+?Constructor\]$/,hi=Function.prototype,ci=Object.prototype,mi=hi.toString,fi=ci.hasOwnProperty,vi=RegExp("^"+mi.call(fi).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function pi(e){return!(!Zn(e)||(t=e,si&&si in t))&&(ai(e)?vi:di).test(li(e));var t}function gi(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return pi(n)?n:void 0}var yi=gi(Bn,"Map"),bi=gi(Object,"create");var wi=Object.prototype.hasOwnProperty;var ki=Object.prototype.hasOwnProperty;function Si(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function Ei(e,t){var n,i,a=e.__data__;return("string"==(i=typeof(n=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==n:null===n)?a["string"==typeof t?"string":"hash"]:a.map}function Mi(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Si.prototype.clear=function(){this.__data__=bi?bi(null):{},this.size=0},Si.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Si.prototype.get=function(e){var t=this.__data__;if(bi){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return wi.call(t,e)?t[e]:void 0},Si.prototype.has=function(e){var t=this.__data__;return bi?void 0!==t[e]:ki.call(t,e)},Si.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=bi&&void 0===t?"__lodash_hash_undefined__":t,this},Mi.prototype.clear=function(){this.size=0,this.__data__={hash:new Si,map:new(yi||jn),string:new Si}},Mi.prototype.delete=function(e){var t=Ei(this,e).delete(e);return this.size-=t?1:0,t},Mi.prototype.get=function(e){return Ei(this,e).get(e)},Mi.prototype.has=function(e){return Ei(this,e).has(e)},Mi.prototype.set=function(e,t){var n=Ei(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};function Pi(e){var t=this.__data__=new jn(e);this.size=t.size}Pi.prototype.clear=function(){this.__data__=new jn,this.size=0},Pi.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Pi.prototype.get=function(e){return this.__data__.get(e)},Pi.prototype.has=function(e){return this.__data__.has(e)},Pi.prototype.set=function(e,t){var n=this.__data__;if(n instanceof jn){var i=n.__data__;if(!yi||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new Mi(i)}return n.set(e,t),this.size=n.size,this};function Ti(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Mi;++t<n;)this.add(e[t])}function Di(e,t){for(var n=-1,i=null==e?0:e.length;++n<i;)if(t(e[n],n,e))return!0;return!1}function Ai(e,t){return e.has(t)}Ti.prototype.add=Ti.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Ti.prototype.has=function(e){return this.__data__.has(e)};var xi=1,Ci=2;function Li(e,t,n,i,a,r){var o=n&xi,s=e.length,u=t.length;if(s!=u&&!(o&&u>s))return!1;var l=r.get(e),d=r.get(t);if(l&&d)return l==t&&d==e;var h=-1,c=!0,m=n&Ci?new Ti:void 0;for(r.set(e,t),r.set(t,e);++h<s;){var f=e[h],v=t[h];if(i)var p=o?i(v,f,h,t,e,r):i(f,v,h,e,t,r);if(void 0!==p){if(p)continue;c=!1;break}if(m){if(!Di(t,(function(e,t){if(!Ai(m,t)&&(f===e||a(f,e,n,i,r)))return m.push(t)}))){c=!1;break}}else if(f!==v&&!a(f,v,n,i,r)){c=!1;break}}return r.delete(e),r.delete(t),c}var Ii=Bn.Uint8Array;function _i(e){var t=-1,n=Array(e.size);return e.forEach((function(e,i){n[++t]=[i,e]})),n}function Fi(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var Ri=1,Wi=2,Ni="[object Boolean]",Oi="[object Date]",ji="[object Error]",$i="[object Map]",zi="[object Number]",Bi="[object RegExp]",Hi="[object Set]",Ui="[object String]",Gi="[object Symbol]",Vi="[object ArrayBuffer]",Xi="[object DataView]",Ki=Hn?Hn.prototype:void 0,Yi=Ki?Ki.valueOf:void 0;function qi(e,t){for(var n=-1,i=t.length,a=e.length;++n<i;)e[a+n]=t[n];return e}var Ji=Array.isArray;function Qi(e,t,n){var i=t(e);return Ji(e)?i:qi(i,n(e))}function Zi(){return[]}var ea=Object.prototype.propertyIsEnumerable,ta=Object.getOwnPropertySymbols,na=ta?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,i=null==e?0:e.length,a=0,r=[];++n<i;){var o=e[n];t(o,n,e)&&(r[a++]=o)}return r}(ta(e),(function(t){return ea.call(e,t)})))}:Zi;function ia(e){return null!=e&&"object"==typeof e}function aa(e){return ia(e)&&"[object Arguments]"==Qn(e)}var ra=Object.prototype,oa=ra.hasOwnProperty,sa=ra.propertyIsEnumerable,ua=aa(function(){return arguments}())?aa:function(e){return ia(e)&&oa.call(e,"callee")&&!sa.call(e,"callee")};var la="object"==typeof exports&&exports&&!exports.nodeType&&exports,da=la&&"object"==typeof module&&module&&!module.nodeType&&module,ha=da&&da.exports===la?Bn.Buffer:void 0,ca=(ha?ha.isBuffer:void 0)||function(){return!1},ma=9007199254740991,fa=/^(?:0|[1-9]\d*)$/;function va(e,t){var n=typeof e;return!!(t=null==t?ma:t)&&("number"==n||"symbol"!=n&&fa.test(e))&&e>-1&&e%1==0&&e<t}var pa=9007199254740991;function ga(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=pa}var ya={};function ba(e){return function(t){return e(t)}}ya["[object Float32Array]"]=ya["[object Float64Array]"]=ya["[object Int8Array]"]=ya["[object Int16Array]"]=ya["[object Int32Array]"]=ya["[object Uint8Array]"]=ya["[object Uint8ClampedArray]"]=ya["[object Uint16Array]"]=ya["[object Uint32Array]"]=!0,ya["[object Arguments]"]=ya["[object Array]"]=ya["[object ArrayBuffer]"]=ya["[object Boolean]"]=ya["[object DataView]"]=ya["[object Date]"]=ya["[object Error]"]=ya["[object Function]"]=ya["[object Map]"]=ya["[object Number]"]=ya["[object Object]"]=ya["[object RegExp]"]=ya["[object Set]"]=ya["[object String]"]=ya["[object WeakMap]"]=!1;var wa="object"==typeof exports&&exports&&!exports.nodeType&&exports,ka=wa&&"object"==typeof module&&module&&!module.nodeType&&module,Sa=ka&&ka.exports===wa&&$n.process,Ea=function(){try{var e=ka&&ka.require&&ka.require("util").types;return e||Sa&&Sa.binding&&Sa.binding("util")}catch(e){}}(),Ma=Ea&&Ea.isTypedArray,Pa=Ma?ba(Ma):function(e){return ia(e)&&ga(e.length)&&!!ya[Qn(e)]},Ta=Object.prototype.hasOwnProperty;function Da(e,t){var n=Ji(e),i=!n&&ua(e),a=!n&&!i&&ca(e),r=!n&&!i&&!a&&Pa(e),o=n||i||a||r,s=o?function(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}(e.length,String):[],u=s.length;for(var l in e)!t&&!Ta.call(e,l)||o&&("length"==l||a&&("offset"==l||"parent"==l)||r&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||va(l,u))||s.push(l);return s}var Aa=Object.prototype;function xa(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Aa)}function Ca(e,t){return function(n){return e(t(n))}}var La=Ca(Object.keys,Object),Ia=Object.prototype.hasOwnProperty;function _a(e){return null!=e&&ga(e.length)&&!ai(e)}function Fa(e){return _a(e)?Da(e):function(e){if(!xa(e))return La(e);var t=[];for(var n in Object(e))Ia.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}function Ra(e){return Qi(e,Fa,na)}var Wa=1,Na=Object.prototype.hasOwnProperty;var Oa=gi(Bn,"DataView"),ja=gi(Bn,"Promise"),$a=gi(Bn,"Set"),za=gi(Bn,"WeakMap"),Ba="[object Map]",Ha="[object Promise]",Ua="[object Set]",Ga="[object WeakMap]",Va="[object DataView]",Xa=li(Oa),Ka=li(yi),Ya=li(ja),qa=li($a),Ja=li(za),Qa=Qn;(Oa&&Qa(new Oa(new ArrayBuffer(1)))!=Va||yi&&Qa(new yi)!=Ba||ja&&Qa(ja.resolve())!=Ha||$a&&Qa(new $a)!=Ua||za&&Qa(new za)!=Ga)&&(Qa=function(e){var t=Qn(e),n="[object Object]"==t?e.constructor:void 0,i=n?li(n):"";if(i)switch(i){case Xa:return Va;case Ka:return Ba;case Ya:return Ha;case qa:return Ua;case Ja:return Ga}return t});var Za=1,er="[object Arguments]",tr="[object Array]",nr="[object Object]",ir=Object.prototype.hasOwnProperty;function ar(e,t,n,i,a,r){var o=Ji(e),s=Ji(t),u=o?tr:Qa(e),l=s?tr:Qa(t),d=(u=u==er?nr:u)==nr,h=(l=l==er?nr:l)==nr,c=u==l;if(c&&ca(e)){if(!ca(t))return!1;o=!0,d=!1}if(c&&!d)return r||(r=new Pi),o||Pa(e)?Li(e,t,n,i,a,r):function(e,t,n,i,a,r,o){switch(n){case Xi:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Vi:return!(e.byteLength!=t.byteLength||!r(new Ii(e),new Ii(t)));case Ni:case Oi:case zi:return Wn(+e,+t);case ji:return e.name==t.name&&e.message==t.message;case Bi:case Ui:return e==t+"";case $i:var s=_i;case Hi:var u=i&Ri;if(s||(s=Fi),e.size!=t.size&&!u)return!1;var l=o.get(e);if(l)return l==t;i|=Wi,o.set(e,t);var d=Li(s(e),s(t),i,a,r,o);return o.delete(e),d;case Gi:if(Yi)return Yi.call(e)==Yi.call(t)}return!1}(e,t,u,n,i,a,r);if(!(n&Za)){var m=d&&ir.call(e,"__wrapped__"),f=h&&ir.call(t,"__wrapped__");if(m||f){var v=m?e.value():e,p=f?t.value():t;return r||(r=new Pi),a(v,p,n,i,r)}}return!!c&&(r||(r=new Pi),function(e,t,n,i,a,r){var o=n&Wa,s=Ra(e),u=s.length;if(u!=Ra(t).length&&!o)return!1;for(var l=u;l--;){var d=s[l];if(!(o?d in t:Na.call(t,d)))return!1}var h=r.get(e),c=r.get(t);if(h&&c)return h==t&&c==e;var m=!0;r.set(e,t),r.set(t,e);for(var f=o;++l<u;){var v=e[d=s[l]],p=t[d];if(i)var g=o?i(p,v,d,t,e,r):i(v,p,d,e,t,r);if(!(void 0===g?v===p||a(v,p,n,i,r):g)){m=!1;break}f||(f="constructor"==d)}if(m&&!f){var y=e.constructor,b=t.constructor;y==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof b&&b instanceof b||(m=!1)}return r.delete(e),r.delete(t),m}(e,t,n,i,a,r))}function rr(e,t,n,i,a){return e===t||(null==e||null==t||!ia(e)&&!ia(t)?e!=e&&t!=t:ar(e,t,n,i,rr,a))}var or=1,sr=2;function ur(e){return e==e&&!Zn(e)}function lr(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}function dr(e){var t=function(e){for(var t=Fa(e),n=t.length;n--;){var i=t[n],a=e[i];t[n]=[i,a,ur(a)]}return t}(e);return 1==t.length&&t[0][2]?lr(t[0][0],t[0][1]):function(n){return n===e||function(e,t,n,i){var a=n.length,r=a;if(null==e)return!r;for(e=Object(e);a--;){var o=n[a];if(o[2]?o[1]!==e[o[0]]:!(o[0]in e))return!1}for(;++a<r;){var s=(o=n[a])[0],u=e[s],l=o[1];if(o[2]){if(void 0===u&&!(s in e))return!1}else{var d=new Pi;if(!rr(l,u,or|sr,i,d))return!1}}return!0}(n,0,t)}}var hr="[object Symbol]";function cr(e){return"symbol"==typeof e||ia(e)&&Qn(e)==hr}var mr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,fr=/^\w*$/;function vr(e,t){if(Ji(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!cr(e))||(fr.test(e)||!mr.test(e)||null!=t&&e in Object(t))}var pr="Expected a function";function gr(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(pr);var n=function(){var i=arguments,a=t?t.apply(this,i):i[0],r=n.cache;if(r.has(a))return r.get(a);var o=e.apply(this,i);return n.cache=r.set(a,o)||r,o};return n.cache=new(gr.Cache||Mi),n}gr.Cache=Mi;var yr,br,wr,kr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Sr=/\\(\\)?/g,Er=(yr=function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(kr,(function(e,n,i,a){t.push(i?a.replace(Sr,"$1"):n||e)})),t},br=gr(yr,(function(e){return 500===wr.size&&wr.clear(),e})),wr=br.cache,br);var Mr=1/0,Pr=Hn?Hn.prototype:void 0,Tr=Pr?Pr.toString:void 0;function Dr(e){if("string"==typeof e)return e;if(Ji(e))return function(e,t){for(var n=-1,i=null==e?0:e.length,a=Array(i);++n<i;)a[n]=t(e[n],n,e);return a}(e,Dr)+"";if(cr(e))return Tr?Tr.call(e):"";var t=e+"";return"0"==t&&1/e==-Mr?"-0":t}function Ar(e){return null==e?"":Dr(e)}function xr(e,t){return Ji(e)?e:vr(e,t)?[e]:Er(Ar(e))}var Cr=1/0;function Lr(e){if("string"==typeof e||cr(e))return e;var t=e+"";return"0"==t&&1/e==-Cr?"-0":t}function Ir(e,t){for(var n=0,i=(t=xr(t,e)).length;null!=e&&n<i;)e=e[Lr(t[n++])];return n&&n==i?e:void 0}function _r(e,t){return null!=e&&t in Object(e)}function Fr(e,t){return null!=e&&function(e,t,n){for(var i=-1,a=(t=xr(t,e)).length,r=!1;++i<a;){var o=Lr(t[i]);if(!(r=null!=e&&n(e,o)))break;e=e[o]}return r||++i!=a?r:!!(a=null==e?0:e.length)&&ga(a)&&va(o,a)&&(Ji(e)||ua(e))}(e,t,_r)}var Rr=1,Wr=2;function Nr(e,t){return vr(e)&&ur(t)?lr(Lr(e),t):function(n){var i=function(e,t,n){var i=null==e?void 0:Ir(e,t);return void 0===i?n:i}(n,e);return void 0===i&&i===t?Fr(n,e):rr(t,i,Rr|Wr)}}function Or(e){return e}function jr(e){return vr(e)?(t=Lr(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return Ir(t,e)}}(e);var t}function $r(e){return e!=e}function zr(e,t){return!!(null==e?0:e.length)&&function(e,t,n){return t==t?function(e,t,n){for(var i=n-1,a=e.length;++i<a;)if(e[i]===t)return i;return-1}(e,t,n):function(e,t,n){for(var i=e.length,a=n+-1;++a<i;)if(t(e[a],a,e))return a;return-1}(e,$r,n)}(e,t,0)>-1}var Br=$a&&1/Fi(new $a([,-0]))[1]==1/0?function(e){return new $a(e)}:function(){},Hr=200;function Ur(e,t){return e&&e.length?function(e,t,n){var i=-1,a=zr,r=e.length,o=!0,s=[],u=s;if(r>=Hr){var l=t?null:Br(e);if(l)return Fi(l);o=!1,a=Ai,u=new Ti}else u=t?[]:s;e:for(;++i<r;){var d=e[i],h=t?t(d):d;if(d=0!==d?d:0,o&&h==h){for(var c=u.length;c--;)if(u[c]===h)continue e;t&&u.push(h),s.push(d)}else a(u,h,n)||(u!==s&&u.push(h),s.push(d))}return s}(e,"function"==typeof(n=t)?n:null==n?Or:"object"==typeof n?Ji(n)?Nr(n[0],n[1]):dr(n):jr(n)):[];var n}var Gr=function(){return c((function e(){s(this,e),this.memoryStore={}}),[{key:"setDevice",value:function(e){this.setItem(Re,e)}},{key:"getDevice",value:function(){return this.getItem(Re)}},{key:"resetDevice",value:function(){this.resetItem(Re)}},{key:"getAnonymousMode",value:function(){return this.getItem(mt)||!1}},{key:"setAnonymousMode",value:function(e){this.setItem(mt,e)}},{key:"clearAnonymousMode",value:function(){this.resetItem(mt)}},{key:"setAppConfig",value:function(e,t){this.setItem(e,t)}},{key:"getAppConfig",value:function(e){return this.getItem(e)}},{key:"setLanguageCode",value:function(e){this.setItem(xt,e||"en")}},{key:"getLanguageCode",value:function(){return this.getItem(xt)||"en"}},{key:"setCampaignRules",value:function(e,t){e!==tt?this.setItem(e,t):this.memoryStore[tt]=JSON.stringify(t)}},{key:"getCampaignRules",value:function(e){return e===tt?this.memoryStore[tt]?JSON.parse(this.memoryStore[tt]):null:this.getItem(e)}},{key:"setPaywalls",value:function(e,t){e!==it?this.setItem(e,t):this.memoryStore[it]=JSON.stringify(t)}},{key:"getPaywalls",value:function(e){return e===it?this.memoryStore[it]?JSON.parse(this.memoryStore[it]):null:this.getItem(e)}},{key:"setActiveEntitlements",value:function(e,t){this.setItem(e,t)}},{key:"getActiveEntitlements",value:function(e){return this.getItem(e)||[]}},{key:"setNamiEntitlements",value:function(e,t){this.setItem(e,t)}},{key:"getNamiEntitlements",value:function(e){return this.getItem(e)||[]}},{key:"setProducts",value:function(e,t){this.setItem(e,t)}},{key:"getProducts",value:function(e){return this.getItem(e)}},{key:"getCachedProducts",value:function(){var e,t,n=null!==(e=this.getItem(Xe))&&void 0!==e?e:[];return Ur(Rn([...null!==(t=this.getItem(rt))&&void 0!==t?t:[],...n]),"sku_ref_id")}},{key:"setNamiConfig",value:function(e){this.setItem(Ne,e)}},{key:"getNamiConfig",value:function(){return this.getItem(Ne)}},{key:"setCustomerAttribute",value:function(e,t){this.setItem(lt+e,t)}},{key:"getCustomerAttribute",value:function(e){return this.getItem(lt+e)}},{key:"getAllCustomerAttributes",value:function(){return Object.entries(localStorage).filter((([e])=>e.includes(lt))).map((([e,t])=>e.replace(lt,"")+":"+t))}},{key:"getAllCustomerAttributesKeys",value:function(){return Object.keys(localStorage).filter((e=>e.includes(lt))).map((e=>e.replace(lt,"")))}},{key:"clearCustomerAttribute",value:function(e){var t=lt+e,n=this.getItem(t);return n&&this.resetItem(t),!!n}},{key:"clearAllCustomerAttributes",value:function(){Object.keys(localStorage).filter((e=>e.includes(lt))).map((e=>this.resetItem(e)))}},{key:"setNamiProfile",value:function(e){this.setItem(je,e)}},{key:"getNamiProfile",value:function(){return this.getItem(je)}},{key:"removeNamiProfile",value:function(){this.resetItem(je)}},{key:"setCustomerJourneyState",value:function(e){this.setItem(ht,e)}},{key:"getCustomerJourneyState",value:function(){return this.getItem(ht)}},{key:"setSessionCounter",value:function(){var e=this.getItem(gt),t=e?parseInt(e):bt||bt;this.setItem(gt,t+1)}},{key:"getSessionCounter",value:function(){var e=this.getItem(gt);return e?parseInt(e):bt}},{key:"setLastImpressionId",value:function(e){this.setItem(kt,e)}},{key:"getLastImpressionId",value:function(){var e;return null!==(e=this.getItem(kt))&&void 0!==e?e:""}},{key:"setPurchaseImpression",value:function(){var e,t=null!==(e=this.getLastImpressionId())&&void 0!==e?e:"";this.setItem(Et,t)}},{key:"getPurchaseImpression",value:function(){var e;return null!==(e=this.getItem(Et))&&void 0!==e?e:""}},{key:"setSessionId",value:function(e){e&&this.setItem(Dt,e)}},{key:"getSessionId",value:function(){var e;return null!==(e=this.getItem(Dt))&&void 0!==e?e:""}},{key:"clearSessionId",value:function(){this.resetItem(Dt)}},{key:"setLaunchId",value:function(e){e&&this.setItem(Pt,e)}},{key:"getLaunchId",value:function(){var e;return null!==(e=this.getItem(Pt))&&void 0!==e?e:""}},{key:"clearLaunchId",value:function(){this.resetItem(Pt)}},{key:"setPurchaseChannel",value:function(e){e&&this.setItem(Lt,e)}},{key:"getPurchaseChannel",value:function(){return this.getItem(Lt)}},{key:"getAnonymousUUID",value:function(){return this.getItem(vt)}},{key:"setAnonymousUUID",value:function(e){this.setItem(vt,e)}},{key:"clearAnonymousUUID",value:function(){this.resetItem(vt)}},{key:"setItem",value:function(e,t){var n;try{n=JSON.stringify(t)}catch(t){return void Fn.error(`Serialization failed for ${e}`,t)}try{localStorage.setItem(e,n)}catch(t){Fn.error("Error setting item in localStorage:",t),this.resetItem(e),this.memoryStore[e]=n}}},{key:"getItem",value:function(e){try{var t=localStorage.getItem(e);if(null!==t)return JSON.parse(t)}catch(t){"undefined"!=typeof window&&Fn.error("Error getting item from localStorage:",e,": ",t)}var n=this.memoryStore[e];return null!=n?JSON.parse(n):null}},{key:"resetItem",value:function(e){try{localStorage.removeItem(e)}catch(t){"undefined"!=typeof window&&Fn.error("Error removing item from localStorage:",e,": ",t)}delete this.memoryStore[e]}},{key:"clear",value:function(){try{localStorage.clear()}catch(e){Fn.error("Error clearing localStorage:",e)}this.memoryStore={}}}])}(),Vr=new Gr,Xr=function(){function e(t,n){var i;return s(this,e),(i=o(this,e,[n])).statusCode=t,i.status=t,i.message=`RetryLimitExceededError: ${i.message}`,i}return g(e,A(Error)),c(e)}(),Kr=function(){function e(){return s(this,e),o(this,e,arguments)}return g(e,A(Error)),c(e)}(),Yr=function(){function e(){var t;return s(this,e),(t=o(this,e)).status=409,t.name="ConflictError",t.message="ConflictError: Server responded with conflict",t}return g(e,Kr),c(e)}(),qr=function(){function e(){return s(this,e),o(this,e,[ke])}return g(e,A(Error)),c(e)}(),Jr=function(){function e(){return s(this,e),o(this,e,[ve])}return g(e,A(Error)),c(e)}(),Qr=function(){function e(){return s(this,e),o(this,e,[ge])}return g(e,A(Error)),c(e)}(),Zr=function(){function e(){return s(this,e),o(this,e,[be])}return g(e,A(Error)),c(e)}(),eo=function(){function e(){return s(this,e),o(this,e,[Ee])}return g(e,A(Error)),c(e)}(),to=function(){function e(){return s(this,e),o(this,e,[Pe])}return g(e,A(Error)),c(e)}(),no=function(){function e(){return s(this,e),o(this,e,[xe])}return g(e,A(Error)),c(e)}(),io=function(){function e(){return s(this,e),o(this,e,[Le])}return g(e,A(Error)),c(e)}(),ao=function(){function e(){return s(this,e),o(this,e,[Le])}return g(e,A(Error)),c(e)}(),ro=function(){function e(){return s(this,e),o(this,e,[De])}return g(e,A(Error)),c(e)}(),oo=function(){function e(t){var n;return s(this,e),(n=o(this,e,[t])).message=`BadRequestError: ${n.message}`,n}return g(e,Kr),c(e)}(),so=function(){function e(t){var n;return s(this,e),(n=o(this,e,[t])).message=`NotFoundError: ${n.message}`,n}return g(e,Kr),c(e)}(),uo=function(){function e(t,n){var i;return s(this,e),(i=o(this,e,[n])).statusCode=t,i.message=`ClientError: ${i.message}`,i}return g(e,Kr),c(e)}(),lo=function(){function e(t){var n;return s(this,e),(n=o(this,e,[t])).message=`ServerError: ${n.message}`,n}return g(e,Kr),c(e)}(),ho=(e,t)=>{if(e==rn)throw new oo(t);if(e==sn)throw new so(t);if(e==ln)throw new Yr;if(e>rn&&e<hn)throw new uo(e,t);if(e>=hn)throw new lo(t)};function co(e,t,n=en,i=qt){var a,o,s;return S((function(u){for(;;)switch(u.n){case 0:return a=0,o=()=>{var s,u;return S((function(l){for(;;)switch(l.n){case 0:return l.n=1,r(mo(e,t,n));case 1:if((s=l.v).ok){l.n=5;break}if(s.status!=ln){l.n=2;break}throw new Yr;case 2:if(!(++a<=i)){l.n=4;break}return u=1e3*(a+Qt),l.n=3,r(new Promise((e=>setTimeout(e,u))));case 3:return l.a(2,o());case 4:throw new Xr(s.status,`Request failed after ${i} retries`);case 5:return l.a(2,s)}}),null,null,null,Promise)},u.n=1,r(o());case 1:return s=u.v,u.a(2,s.json())}}),null,null,null,Promise)}function mo(e,t={},n){var i,a,o;return S((function(s){for(;;)switch(s.n){case 0:return i=new AbortController,a=setTimeout((()=>i.abort()),n),t.signal=i.signal,s.n=1,r(fetch(e,t));case 1:return o=s.v,clearTimeout(a),s.a(2,o)}}),null,null,null,Promise)}function fo(e){for(var t=e.length;--t>=0;)e[t]=0}fo(new Array(576)),fo(new Array(60)),fo(new Array(512)),fo(new Array(256)),fo(new Array(29)),fo(new Array(30));var vo=(e,t,n,i)=>{for(var a=65535&e,r=e>>>16&65535,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{r=r+(a=a+t[i++]|0)|0}while(--o);a%=65521,r%=65521}return a|r<<16},po=new Uint32Array((()=>{for(var e,t=[],n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t})()),go=(e,t,n,i)=>{var a=po,r=i+n;e^=-1;for(var o=i;o<r;o++)e=e>>>8^a[255&(e^t[o])];return~e},yo={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},bo={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},wo=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),ko={assign:function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!=typeof n)throw new TypeError(n+"must be non-object");for(var i in n)wo(n,i)&&(e[i]=n[i])}}return e},flattenChunks:e=>{for(var t=0,n=0,i=e.length;n<i;n++)t+=e[n].length;for(var a=new Uint8Array(t),r=0,o=0,s=e.length;r<s;r++){var u=e[r];a.set(u,o),o+=u.length}return a}},So=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){So=!1}for(var Eo=new Uint8Array(256),Mo=0;Mo<256;Mo++)Eo[Mo]=Mo>=252?6:Mo>=248?5:Mo>=240?4:Mo>=224?3:Mo>=192?2:1;Eo[254]=Eo[254]=1;var Po={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(ne