@namiml/web-sdk
Version:
Subscription monetization infrastructure — drop-in SDK with no-code paywalls, onboarding flows, A/B testing for web
1 lines • 1.89 MB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).NamiWebSdk={})}(this,function(e){"use strict";function t(e,t){this.v=e,this.k=t}function n(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 i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(e){return new t(e,0)}function r(e,t,n){return t=v(t),b(e,g()?Reflect.construct(t,n||[],v(e).constructor):t.apply(e,n))}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(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 u=0;function l(e){return"__private_"+u+++"_"+e}function d(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,_(i.key),i)}}function c(e,t,n){return t&&d(e.prototype,t),n&&d(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return n(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(e,t):void 0}}(e))||t){i&&(e=i);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 m(){return m=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},m.apply(null,arguments)}function f(){return f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var i=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=v(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}},f.apply(null,arguments)}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}function p(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 g(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(g=function(){return!!e})()}function y(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 b(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 i(e)}function w(){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 E(l,"_invoke",function(n,i,a){var r,s,u,l=0,d=a||[],c=!1,h={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,n){return r=t,s=0,u=e,h.n=n,o}};function m(n,i){for(s=n,u=i,t=0;!c&&l&&!a&&t<d.length;t++){var a,r=d[t],m=h.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,h.v=i,h.n=r[1]):m<f&&(a=n<3||r[0]>i||i>f)&&(r[4]=n,r[5]=i,h.n=f,s=0))}if(a||n>1)return o;throw c=!0,i}return function(a,d,f){if(l>1)throw TypeError("Generator is already running");for(c&&1===d&&m(d,f),s=d,u=f;(t=s<2?e:u)||!c;){r||(s?s<3?(s>1&&(h.n=-1),m(s,u)):h.n=u:h.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=(c=h.n<0)?u:n.call(i,h))!==o)break}catch(t){r=e,s=1,u=t}finally{l=1}}return{value:t,done:c}}}(n,a,r),!0),l}var o={};function s(){}function u(){}function l(){}t=Object.getPrototypeOf;var d=[][i]?t(t([][i]())):(E(t={},i,function(){return this}),t),c=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,E(e,a,"GeneratorFunction")),e.prototype=Object.create(c),e}return u.prototype=l,E(c,"constructor",l),E(l,"constructor",u),u.displayName="GeneratorFunction",E(l,a,"GeneratorFunction"),E(c),E(c,a,"Generator"),E(c,i,function(){return this}),E(c,"toString",function(){return"[object Generator]"}),(w=function(){return{w:r,m:h}})()}function k(e,t,n,i,a){var r=function(e,t,n,i,a){return new S(w().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 S(e,n){function i(a,r,o,s){try{var u=e[a](r),l=u.value;return l instanceof t?n.resolve(l.v).then(function(e){i("next",e,o,s)},function(e){i("throw",e,o,s)}):n.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||(E(S.prototype),E(S.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),E(this,"_invoke",function(e,t,r){function o(){return new n(function(t,n){i(e,r,t,n)})}return a=a?a.then(o,o):o()},!0)}function E(e,t,n,i){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}E=function(e,t,n,i){function r(t,n){E(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))},E(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=f(v(e.prototype),t,n);return"function"==typeof a?function(e){return a.apply(n,e)}:a}function _(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 M(e){var t="function"==typeof Map?new Map:void 0;return M=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(g())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,v(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),P(n,e)},M(e)}var A,D,x,C,I,L,R,F,O,$,N,W,j=function(){return c(function e(t){o(this,e),this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",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},z=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={__proto__:null,enumerable:!0};Object.freeze(U);var H=($=function(){return c(function e(t,n={}){if(o(this,e),A.set(this,!1),D.set(this,!1),x.set(this,!1),C.set(this,!1),I.set(this,Date.now()),L.set(this,!1),R.set(this,void 0),F.set(this,void 0),O.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,A,!!a,"f"),B(this,D,!!i,"f"),B(this,x,!!r,"f"),B(this,R,`${t}`,"f"),B(this,F,null,"f"),B(this,O,!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,C,!0,"f")}},{key:"target",get:function(){return z(this,F,"f")}},{key:"currentTarget",get:function(){return z(this,F,"f")}},{key:"srcElement",get:function(){return z(this,F,"f")}},{key:"type",get:function(){return z(this,R,"f")}},{key:"cancelable",get:function(){return z(this,A,"f")}},{key:"defaultPrevented",get:function(){return z(this,A,"f")&&z(this,C,"f")}},{key:"timeStamp",get:function(){return z(this,I,"f")}},{key:"composedPath",value:function(){return z(this,O,"f")?[z(this,F,"f")]:[]}},{key:"returnValue",get:function(){return!z(this,A,"f")||!z(this,C,"f")}},{key:"bubbles",get:function(){return z(this,D,"f")}},{key:"composed",get:function(){return z(this,x,"f")}},{key:"eventPhase",get:function(){return z(this,O,"f")?$.AT_TARGET:$.NONE}},{key:"cancelBubble",get:function(){return z(this,L,"f")},set:function(e){e&&B(this,L,!0,"f")}},{key:"stopPropagation",value:function(){B(this,L,!0,"f")}},{key:"isTrusted",get:function(){return!1}}])}(),A=new WeakMap,D=new WeakMap,x=new WeakMap,C=new WeakMap,I=new WeakMap,L=new WeakMap,R=new WeakMap,F=new WeakMap,O=new WeakMap,$.NONE=0,$.CAPTURING_PHASE=1,$.AT_TARGET=2,$.BUBBLING_PHASE=3,$);Object.defineProperties(H.prototype,{initEvent:U,stopImmediatePropagation:U,preventDefault:U,target:U,currentTarget:U,srcElement:U,type:U,cancelable:U,defaultPrevented:U,timeStamp:U,composedPath:U,returnValue:U,bubbles:U,composed:U,eventPhase:U,cancelBubble:U,stopPropagation:U,isTrusted:U});var G=(W=function(e){function t(e,n={}){var i,a;return o(this,t),a=r(this,t,[e,n]),N.set(a,void 0),B(a,N,null!==(i=null==n?void 0:n.detail)&&void 0!==i?i:null,"f"),a}return p(t,e),c(t,[{key:"initCustomEvent",value:function(e,t,n,i){throw new Error("Method not implemented.")}},{key:"detail",get:function(){return z(this,N,"f")}}])}(H),N=new WeakMap,W);Object.defineProperties(G.prototype,{detail:U});var V,K,X,Y,q=H,J=G;(V=function(){return c(function e(){o(this,e),this.STYLE_RULE=1,this.CHARSET_RULE=2,this.IMPORT_RULE=3,this.MEDIA_RULE=4,this.FONT_FACE_RULE=5,this.PAGE_RULE=6,this.NAMESPACE_RULE=10,this.KEYFRAMES_RULE=7,this.KEYFRAME_RULE=8,this.SUPPORTS_RULE=12,this.COUNTER_STYLE_RULE=11,this.FONT_FEATURE_VALUES_RULE=14,this.MARGIN_RULE=9,this.__parentStyleSheet=null,this.cssText=""},[{key:"parentRule",get:function(){return null}},{key:"parentStyleSheet",get:function(){return this.__parentStyleSheet}},{key:"type",get:function(){return 0}}])}()).STYLE_RULE=1,V.CHARSET_RULE=2,V.IMPORT_RULE=3,V.MEDIA_RULE=4,V.FONT_FACE_RULE=5,V.PAGE_RULE=6,V.NAMESPACE_RULE=10,V.KEYFRAMES_RULE=7,V.KEYFRAME_RULE=8,V.SUPPORTS_RULE=12,V.COUNTER_STYLE_RULE=11,V.FONT_FEATURE_VALUES_RULE=14,V.MARGIN_RULE=9,null!==(K=globalThis.Event)&&void 0!==K||(globalThis.Event=q),null!==(X=globalThis.CustomEvent)&&void 0!==X||(globalThis.CustomEvent=J);var Q=Symbol(),Z=e=>{var t;return"boolean"==typeof e?e:null!==(t=null==e?void 0:e.capture)&&void 0!==t&&t},ee={__proto__:null,enumerable:!0};Object.freeze(ee);var te=function(){return c(function e(){o(this,e),this.__eventListeners=new Map,this.__captureEventListeners=new Map},[{key:"addEventListener",value:function(e,t,n){var i;if(null!=t){var a=Z(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=Z(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.__resolveFullEventPath();!e.composed&&this.__host&&(t=t.slice(0,t.indexOf(this.__host)));var n=!1,i=!1,a=q.NONE,r=null,o=null,s=null,u=e.stopPropagation,l=e.stopImmediatePropagation;Object.defineProperties(e,{target:m({get:()=>null!=r?r:o},ee),srcElement:m({get:()=>e.target},ee),currentTarget:m({get:()=>s},ee),eventPhase:m({get:()=>a},ee),composedPath:m({value:()=>t},ee),stopPropagation:m({value:()=>{n=!0,u.call(e)}},ee),stopImmediatePropagation:m({value:()=>{i=!0,l.call(e)}},ee)});var d=(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=()=>(s=null,a=q.NONE,!e.defaultPrevented),f=t.slice().reverse();r=this.__host&&e.composed?null:this;for(var v,p=e=>{for(o=this;o.__host&&e.includes(o.__host);)o=o.__host},g=h(f);!(v=g()).done;){var y=v.value;r||o&&o!==y.__host||p(f.slice(f.indexOf(y))),s=y,a=y===e.target?q.AT_TARGET:q.CAPTURING_PHASE;var b=y.__captureEventListeners.get(e.type);if(b)for(var w,k=h(b);!(w=k()).done;){var S=w.value;if(d(S[0],S[1],b),i)return c()}if(n)return c()}var E=e.bubbles?t:[this];o=null;for(var P,T=h(E);!(P=T()).done;){var _=P.value;r||o&&_!==o.__host||p(E.slice(0,E.indexOf(_)+1)),s=_,a=_===e.target?q.AT_TARGET:q.BUBBLING_PHASE;var M=_.__eventListeners.get(e.type);if(M)for(var A,D=h(M);!(A=D()).done;){var x=A.value;if(d(x[0],x[1],M),i)return c()}if(n)return c()}return c()}},{key:"__resolveFullEventPath",value:function(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,oe,pe]}}])}(),ne=new WeakMap,ie=e=>{var t=ne.get(e);return void 0===t&&ne.set(e,t=new Map),t},ae=function(e){function t(){return o(this,t),r(this,t,arguments)}return p(t,e),c(t,[{key:"getRootNode",value:function(e){var t;if(null!=e&&e.composed)return se;var n=this.__host;return null!==(t=null==n?void 0:n.__shadowRoot)&&void 0!==t?t:se}}])}(te),re=function(e){function t(){return o(this,t),r(this,t,arguments)}return p(t,e),c(t,[{key:"adoptedStyleSheets",get:function(){return[]}},{key:"createTreeWalker",value:function(){return{}}},{key:"createTextNode",value:function(){return{}}},{key:"createElement",value:function(){return{}}}])}(ae),oe=new re,se=oe,ue=function(e){function t(e){var n;if(o(this,t),n=r(this,t),e!==Q)throw new TypeError("Illegal constructor");return Object.assign(n,globalThis,{CustomElementRegistry:fe,customElements:ve,document:se,Document:re,Element:le,EventTarget:te,HTMLElement:de,Node:ae,ShadowRoot:he,window:n,Window:ue}),n}return p(t,e),c(t)}(ae),le=function(e){function t(){var e;return o(this,t),(e=r(this,t,arguments)).__shadowRootMode=null,e.__shadowRoot=null,e.__internals=null,e}return p(t,e),c(t,[{key:"attributes",get:function(){return Array.from(ie(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){ie(this).set(e,String(t))}},{key:"removeAttribute",value:function(e){ie(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 ie(this).has(e)}},{key:"attachShadow",value:function(e){this.__shadowRootMode=e.mode;var t=new he(Q,e);return t.__eventTargetParent=this,t.__host=this,this.__shadowRoot=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 j(this);return this.__internals=e,e}},{key:"getAttribute",value:function(e){var t=ie(this).get(e);return null!=t?t:null}}])}(ae),de=function(e){function t(){return o(this,t),r(this,t,arguments)}return p(t,e),c(t)}(le),ce=de,he=function(e){function t(e,n){var i;if(o(this,t),i=r(this,t),e!=e)throw new TypeError("Illegal constructor");return i.mode=n.mode,i}return p(t,e),c(t,[{key:"host",get:function(){return this.__host}}])}(ae);function me(){var e,t;return{promise:new Promise((n,i)=>{e=n,t=i}),resolve:e,reject:t}}null!==(Y=globalThis.litServerRoot)&&void 0!==Y||(globalThis.litServerRoot=Object.defineProperty(new ce,"localName",{get:()=>"lit-server-root"}));var fe=function(){return c(function e(){o(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:"initialize",value:function(e){throw new Error("customElements.initialize is not currently supported in SSR. Please file a bug if you need it.")}},{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 k(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=me(),this.__pendingWhenDefineds.set(e,n)),i.a(2,n.promise)}},null,this,null,Promise)}}])}(),ve=new fe,pe=new ue(Q);"undefined"==typeof HTMLElement&&(globalThis.HTMLElement=ce);var ge=["action"],ye=null;var be={storage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},getAllKeys:()=>[]},device:{getDeviceData:()=>({os_version:"",os_name:"",browser_name:"",browser_version:"",sdk_client:"",sdk_version:"",language:"en"}),getDeviceFormFactor:()=>"desktop",getDeviceScaleFactor:()=>1,generateUUID:()=>{throw new Error("No platform adapter registered — call registerPlatformAdapters() before Nami.configure()")},getScreenInfo:()=>({width:0,height:0,scale:1}),getLanguage:()=>"en"},ui:{createPaywall:()=>null,reRenderPaywall:()=>{},flowNavigateToScreen:()=>{}}};function we(){return null!=ye?ye:be}function ke(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("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 Ee(e,t,n,i,a){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;var Pe;!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"}(Pe||(Pe={}));var Te,_e={},Me=_e.NAMI_SDK_VERSION,Ae=void 0===Me?"3.4.4":Me,De=_e.NAMI_SDK_PACKAGE_VERSION,xe=void 0===De?"3.4.4":De,Ce=_e.PLATFORM_ID_REQUIRED,Ie=void 0===Ce?"Platform ID is required":Ce,Le=_e.DEVICE_ID_REQUIRED,Re=void 0===Le?"Device ID is required":Le,Fe=_e.EXTERNAL_ID_REQUIRED,Oe=void 0===Fe?"External ID is required":Fe,$e=_e.SDK_NOT_INITIALIZED,Ne=void 0===$e?"SDK has not been initialized. Make sure to call Nami.configure() first!":$e,We=_e.CAMPAIGN_NOT_AVAILABLE,je=void 0===We?"Campaign is not available":We,Be=_e.FLOW_SCREENS_NOT_AVAILABLE,ze=void 0===Be?"Flow screens not available":Be,Ue=_e.UNABLE_TO_UPDATE_CDP_ID,He=void 0===Ue?"Unable to update CDP id in anonymous mode":Ue,Ge=_e.ANONYMOUS_MODE_ALREADY_ON,Ve=void 0===Ge?"Anonymous mode is already turned on.":Ge,Ke=_e.ANONYMOUS_MODE_ALREADY_OFF,Xe=void 0===Ke?"Anonymous mode is already turned off.":Ke,Ye=_e.DEVICE_ID_NOT_SET,qe=void 0===Ye?"Nami Device ID is not set":Ye,Je=_e.AUTH_DEVICE,Qe=void 0===Je?"nami_auth_device":Je,Ze=_e.NAMI_CONFIGURATION,et=void 0===Ze?"nami_configuration":Ze,tt=_e.NAMI_PROFILE,nt=void 0===tt?"nami_profile":tt,it=_e.API_CONFIG,at=void 0===it?"api_config":it,rt=_e.API_CAMPAIGN_RULES,ot=void 0===rt?"api_campaign_rules":rt,st=_e.API_PAYWALLS,ut=void 0===st?"api_paywalls":st,lt=_e.API_CAMPAIGN_SESSION_TIMESTAMP,dt=void 0===lt?"api_campaign_session_timestamp":lt,ct=_e.API_PRODUCTS,ht=void 0===ct?"api_products":ct,mt=_e.API_ACTIVE_ENTITLEMENTS,ft=void 0===mt?"api_active_entitlements":mt,vt=_e.SERVER_NAMI_ENTITLEMENTS,pt=void 0===vt?"server_active_entitlements":vt,gt=_e.INITIAL_APP_CONFIG,yt=void 0===gt?"initial_app_config":gt,bt=_e.INITIAL_CAMPAIGN_RULES,wt=void 0===bt?"initial_campaign_rules":bt,kt=_e.INITIAL_PAYWALLS,St=void 0===kt?"initial_paywalls":kt,Et=_e.INITIAL_PRODUCTS,Pt=void 0===Et?"initial_products":Et,Tt=_e.LOCAL_NAMI_ENTITLEMENTS,_t=void 0===Tt?"local_active_entitlements":Tt,Mt=_e.CUSTOMER_ATTRIBUTES_KEY_PREFIX,At=void 0===Mt?"nami_cmr_attributes_":Mt,Dt=_e.NAMI_CUSTOMER_JOURNEY_STATE,xt=void 0===Dt?"nami_customer_journey_state":Dt,Ct=_e.ANONYMOUS_MODE,It=void 0===Ct?"nami_anonymous_mode_v2":Ct,Lt=_e.ANONYMOUS_UUID,Rt=void 0===Lt?"nami_anonymous_uuid":Lt,Ft=_e.KEY_SESSION_COUNTER,Ot=void 0===Ft?"nami_session_counter":Ft,$t=_e.INITIAL_SESSION_COUNTER_VALUE,Nt=void 0===$t?1:$t,Wt=_e.NAMI_LAST_IMPRESSION_ID,jt=void 0===Wt?"nami_last_impression_id":Wt,Bt=_e.NAMI_PURCHASE_IMPRESSION_ID,zt=void 0===Bt?"nami_purchase_impression_id":Bt,Ut=_e.NAMI_LAUNCH_ID,Ht=void 0===Ut?"nami_launch_id":Ut,Gt=_e.NAMI_SESSION_ID,Vt=void 0===Gt?"nami_session_id":Gt,Kt=_e.NAMI_LANGUAGE_CODE,Xt=void 0===Kt?"nami_language_code":Kt,Yt=_e.NAMI_PURCHASE_CHANNEL,qt=void 0===Yt?"nami_purchase_channel":Yt,Jt=_e.API_VERSION,Qt=_e.BASE_URL_PATH,Zt=void 0===Qt?`sdk/${void 0===Jt?"v3":Jt}/platform`:Qt,en=_e.BASE_URL,tn=void 0===en?"https://app.namiml.com":en,nn=_e.BASE_STAGING_URL,an=void 0===nn?"https://app-staging.namiml.com":nn,rn=_e.CUSTOM_HOST_PREFIX,on=void 0===rn?"namiAPIHost=":rn,sn=_e.USE_STAGING_API,un=void 0===sn?"useStagingAPI":sn,ln=_e.EXTENDED_CLIENT_INFO_PREFIX,dn=void 0===ln?"extendedClientInfo":ln,cn=_e.EXTENDED_CLIENT_INFO_DELIMITER,hn=void 0===cn?":":cn,mn=_e.VALIDATE_PRODUCT_GROUPS,fn=void 0===mn?"validateProductGroups":mn,vn=_e.LOG_HTTP_REQUESTS,pn=void 0===vn?"logHTTPRequests":vn,gn=_e.LOG_HTTP_TRAFFIC,yn=void 0===gn?"logHTTPTraffic":gn,bn=_e.STARTUP_TELEMETRY,wn=void 0===bn?"startupTelemetry":bn,kn=_e.API_MAX_CALLS_LIMIT,Sn=void 0===kn?2:kn,En=_e.API_RETRY_DELAY_SEC,Pn=void 0===En?2:En,Tn=_e.API_TIMEOUT_LIMIT,_n=void 0===Tn?2e4:Tn,Mn=_e.DEVICE_API_TIMEOUT_LIMIT,An=void 0===Mn?2e3:Mn,Dn=_e.STATUS_BAD_REQUEST,xn=void 0===Dn?400:Dn,Cn=_e.STATUS_NOT_FOUND,In=void 0===Cn?404:Cn,Ln=_e.STATUS_CONFLICT,Rn=void 0===Ln?409:Ln,Fn=_e.STATUS_INTERNAL_SERVER_ERROR,On=void 0===Fn?500:Fn,$n=_e.INITIAL_SUCCESS,Nn=void 0===$n?"Initial success":$n,Wn=_e.RECONFIG_SUCCESS,jn=void 0===Wn?"Reconfig success":Wn,Bn=_e.ALREADY_CONFIGURED,zn=void 0===Bn?"Already configured":Bn,Un=_e.AVAILABLE_CAMPAIGNS_CHANGED,Hn=void 0===Un?"AvailableCampaignsChanged":Un,Gn=_e.PAYWALL_ACTION_EVENT,Vn=void 0===Gn?"PaywallActionEvent":Gn,Kn=_e.AVAILABLE_ACTIVE_ENTITLEMENTS_CHANGED,Xn=void 0===Kn?"AvailableActiveEntitlementsChanged":Kn,Yn=_e.CUSTOMER_JOURNEY_STATE_CHANGED,qn=void 0===Yn?"CustomerJourneyStateChanged":Yn,Jn=_e.SKU_TEXT_REGEX,Qn=void 0===Jn?/\$\{sku\.(\w+)(:\d+)?\}/g:Jn,Zn=_e.VAR_REGEX,ei=void 0===Zn?/\$\{\s*(\w+(\.[a-zA-Z\d_:${}-]{0,99})*?)\s*}/g:Zn,ti=_e.SMART_TEXT_PATTERN,ni=void 0===ti?"${":ti,ii=_e.LIQUID_VARIABLE_REGEX,ai=void 0===ii?/\${[A-Za-z0-9.]+}/g:ii,ri=[Qe,et,nt,at,ot,ut,dt,ht,ft,pt,yt,wt,St,Pt,_t,xt,It,Rt,Ot,jt,zt,Ht,Vt,Xt,qt];e.LogLevel=void 0,(Te=e.LogLevel||(e.LogLevel={}))[Te.DEBUG=1]="DEBUG",Te[Te.INFO=2]="INFO",Te[Te.WARN=3]="WARN",Te[Te.ERROR=4]="ERROR";var oi={debug:e.LogLevel.DEBUG,info:e.LogLevel.INFO,warn:e.LogLevel.WARN,error:e.LogLevel.ERROR},si=function(){return c(function t(){o(this,t),this.currentLogLevel=e.LogLevel.DEBUG,this.setLogger=t=>{this.currentLogLevel=t?oi[t]:e.LogLevel.WARN}},[{key:"debug",value:function(t,...n){this.shouldLog(e.LogLevel.DEBUG)&&console.debug(this.formatMessage(e.LogLevel.DEBUG,t,...n))}},{key:"info",value:function(t,...n){this.shouldLog(e.LogLevel.INFO)&&console.info(this.formatMessage(e.LogLevel.INFO,t,...n))}},{key:"warn",value:function(t,...n){this.shouldLog(e.LogLevel.WARN)&&console.warn(this.formatMessage(e.LogLevel.WARN,t,...n))}},{key:"error",value:function(t,...n){this.shouldLog(e.LogLevel.ERROR)&&console.error(this.formatMessage(e.LogLevel.ERROR,t,...n))}},{key:"shouldLog",value:function(e){return e>=this.currentLogLevel}},{key:"formatMessage",value:function(t,n,...i){var a=e.LogLevel[t];return`[${(new Date).toISOString()}] [${a}] ${n} ${i=i.map(e=>"object"==typeof e?JSON.stringify(e):e)}`}}])}(),ui=new si;function li(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 di(e,t){return e===t||e!=e&&t!=t}function ci(e,t){for(var n=e.length;n--;)if(di(e[n][0],t))return n;return-1}var hi=Array.prototype.splice;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])}}mi.prototype.clear=function(){this.__data__=[],this.size=0},mi.prototype.delete=function(e){var t=this.__data__,n=ci(t,e);return!(n<0)&&(n==t.length-1?t.pop():hi.call(t,n,1),--this.size,!0)},mi.prototype.get=function(e){var t=this.__data__,n=ci(t,e);return n<0?void 0:t[n][1]},mi.prototype.has=function(e){return ci(this.__data__,e)>-1},mi.prototype.set=function(e,t){var n=this.__data__,i=ci(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};var fi="object"==typeof global&&global&&global.Object===Object&&global,vi="object"==typeof self&&self&&self.Object===Object&&self,pi=fi||vi||Function("return this")(),gi=pi.Symbol,yi=Object.prototype,bi=yi.hasOwnProperty,wi=yi.toString,ki=gi?gi.toStringTag:void 0;var Si=Object.prototype.toString;var Ei=gi?gi.toStringTag:void 0;function Pi(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Ei&&Ei in Object(e)?function(e){var t=bi.call(e,ki),n=e[ki];try{e[ki]=void 0;var i=!0}catch(e){}var a=wi.call(e);return i&&(t?e[ki]=n:delete e[ki]),a}(e):function(e){return Si.call(e)}(e)}function Ti(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function _i(e){if(!Ti(e))return!1;var t=Pi(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var Mi,Ai=pi["__core-js_shared__"],Di=(Mi=/[^.]+$/.exec(Ai&&Ai.keys&&Ai.keys.IE_PROTO||""))?"Symbol(src)_1."+Mi:"";var xi=Function.prototype.toString;function Ci(e){if(null!=e){try{return xi.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var Ii=/^\[object .+?Constructor\]$/,Li=Function.prototype,Ri=Object.prototype,Fi=Li.toString,Oi=Ri.hasOwnProperty,$i=RegExp("^"+Fi.call(Oi).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ni(e){return!(!Ti(e)||(t=e,Di&&Di in t))&&(_i(e)?$i:Ii).test(Ci(e));var t}function Wi(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Ni(n)?n:void 0}var ji=Wi(pi,"Map"),Bi=Wi(Object,"create");var zi=Object.prototype.hasOwnProperty;var Ui=Object.prototype.hasOwnProperty;function Hi(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 Gi(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 Vi(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])}}Hi.prototype.clear=function(){this.__data__=Bi?Bi(null):{},this.size=0},Hi.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Hi.prototype.get=function(e){var t=this.__data__;if(Bi){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return zi.call(t,e)?t[e]:void 0},Hi.prototype.has=function(e){var t=this.__data__;return Bi?void 0!==t[e]:Ui.call(t,e)},Hi.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},Vi.prototype.clear=function(){this.size=0,this.__data__={hash:new Hi,map:new(ji||mi),string:new Hi}},Vi.prototype.delete=function(e){var t=Gi(this,e).delete(e);return this.size-=t?1:0,t},Vi.prototype.get=function(e){return Gi(this,e).get(e)},Vi.prototype.has=function(e){return Gi(this,e).has(e)},Vi.prototype.set=function(e,t){var n=Gi(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};function Ki(e){var t=this.__data__=new mi(e);this.size=t.size}Ki.prototype.clear=function(){this.__data__=new mi,this.size=0},Ki.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Ki.prototype.get=function(e){return this.__data__.get(e)},Ki.prototype.has=function(e){return this.__data__.has(e)},Ki.prototype.set=function(e,t){var n=this.__data__;if(n instanceof mi){var i=n.__data__;if(!ji||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new Vi(i)}return n.set(e,t),this.size=n.size,this};function Xi(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Vi;++t<n;)this.add(e[t])}function Yi(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 qi(e,t){return e.has(t)}Xi.prototype.add=Xi.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Xi.prototype.has=function(e){return this.__data__.has(e)};function Ji(e,t,n,i,a,r){var o=1&n,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 c=-1,h=!0,m=2&n?new Xi:void 0;for(r.set(e,t),r.set(t,e);++c<s;){var f=e[c],v=t[c];if(i)var p=o?i(v,f,c,t,e,r):i(f,v,c,e,t,r);if(void 0!==p){if(p)continue;h=!1;break}if(m){if(!Yi(t,function(e,t){if(!qi(m,t)&&(f===e||a(f,e,n,i,r)))return m.push(t)})){h=!1;break}}else if(f!==v&&!a(f,v,n,i,r)){h=!1;break}}return r.delete(e),r.delete(t),h}var Qi=pi.Uint8Array;function Zi(e){var t=-1,n=Array(e.size);return e.forEach(function(e,i){n[++t]=[i,e]}),n}function ea(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var ta=gi?gi.prototype:void 0,na=ta?ta.valueOf:void 0;var ia=Array.isArray;var aa=Object.prototype.propertyIsEnumerable,ra=Object.getOwnPropertySymbols,oa=ra?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}(ra(e),function(t){return aa.call(e,t)}))}:function(){return[]};function sa(e){return null!=e&&"object"==typeof e}function ua(e){return sa(e)&&"[object Arguments]"==Pi(e)}var la=Object.prototype,da=la.hasOwnProperty,ca=la.propertyIsEnumerable,ha=ua(function(){return arguments}())?ua:function(e){return sa(e)&&da.call(e,"callee")&&!ca.call(e,"callee")};var ma="object"==typeof e&&e&&!e.nodeType&&e,fa=ma&&"object"==typeof module&&module&&!module.nodeType&&module,va=fa&&fa.exports===ma?pi.Buffer:void 0,pa=(va?va.isBuffer:void 0)||function(){return!1},ga=/^(?:0|[1-9]\d*)$/;function ya(e,t){var n=typeof e;return!!(t=t??9007199254740991)&&("number"==n||"symbol"!=n&&ga.test(e))&&e>-1&&e%1==0&&e<t}function ba(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}var wa={};function ka(e){return function(t){return e(t)}}wa["[object Float32Array]"]=wa["[object Float64Array]"]=wa["[object Int8Array]"]=wa["[object Int16Array]"]=wa["[object Int32Array]"]=wa["[object Uint8Array]"]=wa["[object Uint8ClampedArray]"]=wa["[object Uint16Array]"]=wa["[object Uint32Array]"]=!0,wa["[object Arguments]"]=wa["[object Array]"]=wa["[object ArrayBuffer]"]=wa["[object Boolean]"]=wa["[object DataView]"]=wa["[object Date]"]=wa["[object Error]"]=wa["[object Function]"]=wa["[object Map]"]=wa["[object Number]"]=wa["[object Object]"]=wa["[object RegExp]"]=wa["[object Set]"]=wa["[object String]"]=wa["[object WeakMap]"]=!1;var Sa="object"==typeof e&&e&&!e.nodeType&&e,Ea=Sa&&"object"==typeof module&&module&&!module.nodeType&&module,Pa=Ea&&Ea.exports===Sa&&fi.process,Ta=function(){try{var e=Ea&&Ea.require&&Ea.require("util").types;return e||Pa&&Pa.binding&&Pa.binding("util")}catch(e){}}(),_a=Ta&&Ta.isTypedArray,Ma=_a?ka(_a):function(e){return sa(e)&&ba(e.length)&&!!wa[Pi(e)]},Aa=Object.prototype.hasOwnProperty;function Da(e,t){var n=ia(e),i=!n&&ha(e),a=!n&&!i&&pa(e),r=!n&&!i&&!a&&Ma(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)!Aa.call(e,l)||o&&("length"==l||a&&("offset"==l||"parent"==l)||r&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||ya(l,u))||s.push(l);return s}var xa=Object.prototype;function Ca(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||xa)}function Ia(e,t){return function(n){return e(t(n))}}var La=Ia(Object.keys,Object),Ra=Object.prototype.hasOwnProperty;function Fa(e){return null!=(t=e)&&ba(t.length)&&!_i(t)?Da(e):function(e){if(!Ca(e))return La(e);var t=[];for(var n in Object(e))Ra.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e);var t}function Oa(e){return function(e,t,n){var i=t(e);return ia(e)?i:function(e,t){for(var n=-1,i=t.length,a=e.length;++n<i;)e[a+n]=t[n];return e}(i,n(e))}(e,Fa,oa)}var $a=Object.prototype.hasOwnProperty;var Na=Wi(pi,"DataView"),Wa=Wi(pi,"Promise"),ja=Wi(pi,"Set"),Ba=Wi(pi,"WeakMap"),za="[object Map]",Ua="[object Promise]",Ha="[object Set]",Ga="[object WeakMap]",Va="[object DataView]",Ka=Ci(Na),Xa=Ci(ji),Ya=Ci(Wa),qa=Ci(ja),Ja=Ci(Ba),Qa=Pi;(Na&&Qa(new Na(new ArrayBuffer(1)))!=Va||ji&&Qa(new ji)!=za||Wa&&Qa(Wa.resolve())!=Ua||ja&&Qa(new ja)!=Ha||Ba&&Qa(new Ba)!=Ga)&&(Qa=function(e){var t=Pi(e),n="[object Object]"==t?e.constructor:void 0,i=n?Ci(n):"";if(i)switch(i){case Ka:return Va;case Xa:return za;case Ya:return Ua;case qa:return Ha;case Ja:return Ga}return t});var Za="[object Arguments]",er="[object Array]",tr="[object Object]",nr=Object.prototype.hasOwnProperty;function ir(e,t,n,i,a,r){var o=ia(e),s=ia(t),u=o?er:Qa(e),l=s?er:Qa(t),d=(u=u==Za?tr:u)==tr,c=(l=l==Za?tr:l)==tr,h=u==l;if(h&&pa(e)){if(!pa(t))return!1;o=!0,d=!1}if(h&&!d)return r||(r=new Ki),o||Ma(e)?Ji(e,t,n,i,a,r):function(e,t,n,i,a,r,o){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!r(new Qi(e),new Qi(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return di(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var s=Zi;case"[object Set]":var u=1&i;if(s||(s=ea),e.size!=t.size&&!u)return!1;var l=o.get(e);if(l)return l==t;i|=2,o.set(e,t);var d=Ji(s(e),s(t),i,a,r,o);return o.delete(e),d;case"[object Symbol]":if(na)return na.call(e)==na.call(t)}return!1}(e,t,u,n,i,a,r);if(!(1&n)){var m=d&&nr.call(e,"__wrapped__"),f=c&&nr.call(t,"__wrapped__");if(m||f){var v=m?e.value():e,p=f?t.value():t;return r||(r=new Ki),a(v,p,n,i,r)}}return!!h&&(r||(r=new Ki),function(e,t,n,i,a,r){var o=1&n,s=Oa(e),u=s.length;if(u!=Oa(t).length&&!o)return!1;for(var l=u;l--;){var d=s[l];if(!(o?d in t:$a.call(t,d)))return!1}var c=r.get(e),h=r.get(t);if(c&&h)return c==t&&h==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 ar(e,t,n,i,a){return e===t||(null==e||null==t||!sa(e)&&!sa(t)?e!=e&&t!=t:ir(e,t,n,i,ar,a))}function rr(e){return e==e&&!Ti(e)}function or(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}function sr(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,rr(a)]}return t}(e);return 1==t.length&&t[0][2]?or(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 if(!ar(l,u,3,i,new Ki))return!1}return!0}(n,0,t)}}function ur(e){return"symbol"==typeof e||sa(e)&&"[object Symbol]"==Pi(e)}var lr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,dr=/^\w*$/;function cr(e,t){if(ia(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!ur(e))||(dr.test(e)||!lr.test(e)||null!=t&&e in Object(t))}function hr(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");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(hr.Cache||Vi),n}hr.Cache=Vi;var mr,fr,vr,pr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gr=/\\(\\)?/g,yr=(mr=function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(pr,function(e,n,i,a){t.push(i?a.replace(gr,"$1"):n||e)}),t},fr=hr(mr,function(e){return 500===vr.size&&vr.clear(),e}),vr=fr.cache,fr);var br=gi?gi.prototype:void 0,wr=br?br.toString:void 0;function kr(e){if("string"==typeof e)return e;if(ia(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,kr)+"";if(ur(e))return wr?wr.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Sr(e,t){return ia(e)?e:cr(e,t)?[e]:yr(function(e){return null==e?"":kr(e)}(e))}function Er(e){if("string"==typeof e||ur(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Pr(e,t){for(var n=0,i=(t=Sr(t,e)).length;null!=e&&n<i;)e=e[Er(t[n++])];return n&&n==i?e:void 0}function Tr(e,t){return null!=e&&t in Object(e)}function _r(e,t){return null!=e&&function(e,t,n){for(var i=-1,a=(t=Sr(t,e)).length,r=!1;++i<a;){var o=Er(t[i]);if(!(r=null!=e&&n(e,o)))break;e=e[o]}return r||++i!=a?r:!!(a=null==e?0:e.length)&&ba(a)&&ya(o,a)&&(ia(e)||ha(e))}(e,t,Tr)}function Mr(e,t){return cr(e)&&rr(t)?or(Er(e),t):function(n){var i=function(e,t,n){var i=null==e?void 0:Pr(e,t);return void 0===i?n:i}(n,e);return void 0===i&&i===t?_r(n,e):ar(t,i,3)}}function Ar(e){return e}function Dr(e){return cr(e)?(t=Er(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return Pr(t,e)}}(e);var t}function xr(e){return e!=e}function Cr(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,xr,n)}(e,t,0)>-1}var Ir=ja&&1/ea(new ja([,-0]))[1]==1/0?function(e){return new ja(e)}:function(){};function Lr(e,t){return e&&e.length?function(e,t,n){var i=-1,a=Cr,r=e.length,o=!0,s=[],u=s;if(r>=200){var l=t?null:Ir(e);if(l)return ea(l);o=!1,a=qi,u=new Xi}else u=t?[]:s;e:for(;++i<r;){var d=e[i],c=t?t(d):d;if(d=0!==d?d:0,o&&c==c){for(var h=u.length;h--;)if(u[h]===c)continue e;t&&u.push(c),s.push(d)}else a(u,c,n)||(u!==s&&u.push(c),s.push(d))}return s}(e,"function"==typeof(n=t)?n:null==n?Ar:"object"==typeof n?ia(n)?Mr(n[0],n[1]):sr(n):Dr(n)):[];var n}var Rr=function(){return c(function e(){o(this,e),this.memoryStore={}},[{key:"storage",get:function(){return we().storage}},{key:"setDevice",value:function(e){this.setItem(Qe,e)}},{key:"getDevice",value:function(){return this.getItem(Qe)}},{key:"resetDevice",value:function(){this.resetItem(Qe)}},{key:"getAnonymousMode",value:function(){return this.getItem(It)||!1}},{key:"setAnonymousMode",value:function(e){this.setItem(It,e)}},{key:"clearAnonymousMode",value:function(){this.resetItem(It)}},{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!==wt?e!==ot||0!==this.getCampaignCacheTtl()?this.setItem(e,t):this.memoryStore[ot]=JSON.stringify(t):this.memoryStore[wt]=JSON.stringify(t)}},{key:"getCampaignRules",value:function(e){if(e===wt)return this.memoryStore[wt]?JSON.parse(this.memoryStore[wt]):null;if(e===ot){var t=this.memoryStore[ot];if(null!=t)return JSON.parse(t);var n=this.getItem(ot);if(null===n)return null;if("string"==typeof n)try{n=JSON.parse(n)}catch(e){return n}return this.isLegacyTimestampedCache(n)?n.data:n}return this.getItem(e)}},{key:"setPaywalls",value:function(e,t){e!==St?e!==ut||0!==this.getCampaignCacheTtl()?this.setItem(e,t):this.memoryStore[ut]=JSON.stringify(t):this.memoryStore[St]=JSON.stringify(t)}},{key:"getPaywalls",value:function(e){if(e===St)return this.memoryStore[St]?JSON.parse(this.memoryStore[St]):null;if(e===ut){var t=this.memoryStore[ut];if(null!=t)return JSON.parse(t);var n=this.getItem(ut);if(null===n)return null;if("string"==typeof n)try{n=JSON.parse(n)}catch(e){return n}return this.isLegacyTimestampedCache(n)?n.data:n}return 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(ht))&&void 0!==e?e:[];return Lr(li([...null!==(t=this.getItem(Pt))&&void 0!==t?t:[],...n]),"sku_ref_id")}},{key:"setNamiConfig",value:function(e){this.setItem(et,e)}},{key:"getNamiConfig",value:function(){return this.getItem(et)}},{key:"setCustomerAttribute",value:function(e,t){this.setItem(At+e,t)}},{key:"getCustomerAttribute",value:function(e){return this.getItem(At+e)}},{key:"getAllCustomerAttributes",value:function(){return this.storage.getAllKeys().map(e=>[e,this.storage.getItem(e)]).filter(([e])=>e.includes(At)).map(([e,t])=>e.replace(At,"")+":"+t)}},{key:"getAllCustomerAttributesKeys",value:function(){return this.storage.getAllKeys().filter(e=>e.includes(At)).map(e=>e.replace(At,""))}},{key:"getAllCustomerAttributesMap",value:function(){var e={};return this.getAllCustomerAttributesKeys().forEach(t=>{var n=this.getCustomerAttribute(t);null!=n&&(e[t]=String(n))}),e}},{key:"clearCustomerAttribute",value:function(e){var t=At+e,n=this.getItem(t);return n&&this.resetItem(t),!!n}},{key:"clearAllCustomerAttributes",value:function(){this.storage.getAllKeys().filter(e=>e.includes(At)).map(e=>this.resetItem(e))}},{key:"setNamiProfile",value:function(e){this.setItem(nt,e)}},{key:"getNamiProfile",value:function(){return this.getItem(nt)}},{key:"removeNamiProfile",value:function(){this.resetItem(nt)}},{key:"setCustomerJourneyState",value:function(e){this.setItem(xt,e)}},{key:"getCustomerJourneyState",value:function(){return this.getItem(xt)}},{key:"setSessionCounter",value:function(){var e=this.getItem(Ot),t=e?parseInt(e):Nt||Nt;this.setItem(Ot,t+1)}},{key:"getSessionCounter",value:function(){var e=this.getItem(Ot);return e?parseInt(e):Nt}},{key:"setLastImpressionId",value:function(e){this.setItem(jt,e)}},{key:"getLastImpressionId",value:function(){var e;return null!==(e=this.getItem(jt))&&void 0!==e?e:""}},{key:"setPurchaseImpression",value:function(){var e,t=null!==(e=this.getLastImpressionId())&&void 0!==e?e:"";this.setItem(zt,t)}},{key:"getPurchaseImpression",value:function(){var e;return null!==(e=this.getItem(zt))&&void 0!==e?e:""}},{key:"setSessionId",value:function(e){e&&this.setItem(Vt,e)}},{key:"getSessionId",value:function(){var e;return null!==(e=this.getItem(Vt))&&void 0!==e?e:""}},{key:"clearSessionId",value:function(){this.resetItem(Vt)}},{key:"setLaunchId",value:function(e){e&&this.setItem(Ht,e)}},{key:"getLaunchId",value:function(){var e;return null!==(e=this.getItem(Ht))&&void 0!==e?e:""}},{key:"clearLaunchId",value:function(){this.resetItem(Ht)}},{key:"setPurchaseChannel",value:function(e){e&&this.setItem(qt,e)}},{key:"getPurchaseChannel",value:function(){return this.getItem(qt)}},{key:"getAnonymousUUID",value:function(){return this.getItem(Rt)}},{key:"setAnonymousUUID",value:function(e){this.setItem(Rt,e)}},{key:"clearAnonymousUUID",value:function(){this.resetItem(Rt)}},{key:"setApiCampaignSessionTimestamp",value:function(){this.setItem(dt,Date.now())}},{key:"getApiCampaignSessionTimestamp",value:function(){return this.getItem(dt)}},{key:"purgeApiCampaignCache",value:function(){this.resetItem(ut),this.resetItem(ot),this.resetItem(dt)}},{key:"getCampaignCacheTtl",value:function(){var e,t=this.getAppConfig(at)||this.getAppConfig(yt);return null!==(e=null==t?void 0:t.campaign_cache_ttl)&&void 0!==e?e:null}},{key:"isLegacyTimestampedCache",value:function(e){return"object"==typeof e&&null!==e&&"cachedAt"in e&&"data"in e}},{key:"setItem",value:function(e,t){var n;try{n=JSON.stringify(t)}catch(t){return void ui.error(`Serialization failed for ${e}`,t)}try{this.storage.setItem(e,n)}catch(t){ui.error("Error setting item in localStorage:",t),this.resetItem(e),this.memoryStore[e]=n}}},{key:"getItem",value:function(e){try{var t=this.storage.getItem(e);if(null!==t)return JSON.parse(t)}catch(t){ui.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{this.storage.removeItem(e)}catch(t){ui.error("Error removing item from localStorage:",e,": ",t)}delete this.memoryStore[e]}},{key:"clearAll",value:function(){ri.forEach(e=>this.resetItem(e)),this.clearAllCustomerAttributes(),this.memoryStore={}}},{key:"clear",value:function(){try{this.storage.clear()}catch(e){ui.error("Error clearing localStorage:",e)}this.memoryStore={}}}])}