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.51 MB
!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";(()=>{if("undefined"!=typeof globalThis)return;const 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(){const e=this.attributes,t=new Array(e.length);for(let n=0;n<e.length;n+=1)t[n]=e[n].name;return t});const t=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(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=e}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var n,i,a,r,o,s,l,d,u,c,h,m,f=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},p=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)};const g=e=>"boolean"==typeof e?e:e?.capture??!1;const v=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(e,t,n){if(null==t)return;const i=g(n)?this.__captureEventListeners:this.__eventListeners;let a=i.get(e);if(void 0===a)a=new Map,i.set(e,a);else if(a.has(t))return;const r="object"==typeof n&&n?n:{};r.signal?.addEventListener("abort",(()=>this.removeEventListener(e,t,n))),a.set(t,r??{})}removeEventListener(e,t,n){if(null==t)return;const i=g(n)?this.__captureEventListeners:this.__eventListeners,a=i.get(e);void 0!==a&&(a.delete(t),a.size||i.delete(e))}dispatchEvent(e){const t=[this];let 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;let i=!1,a=!1,r=0,o=null,s=null,l=null;const d=e.stopPropagation,u=e.stopImmediatePropagation;Object.defineProperties(e,{target:{get:()=>o??s,...y},srcElement:{get:()=>e.target,...y},currentTarget:{get:()=>l,...y},eventPhase:{get:()=>r,...y},composedPath:{value:()=>t,...y},stopPropagation:{value:()=>{i=!0,d.call(e)},...y},stopImmediatePropagation:{value:()=>{a=!0,u.call(e)},...y}});const c=(t,n,i)=>{"function"==typeof t?t(e):"function"==typeof t?.handleEvent&&t.handleEvent(e),n.once&&i.delete(t)},h=()=>(l=null,r=0,!e.defaultPrevented),m=t.slice().reverse();o=this.__host&&e.composed?null:this;const f=e=>{for(s=this;s.__host&&e.includes(s.__host);)s=s.__host};for(const t of m){o||s&&s!==t.__host||f(m.slice(m.indexOf(t))),l=t,r=t===e.target?2:1;const n=t.__captureEventListeners.get(e.type);if(n)for(const[e,t]of n)if(c(e,t,n),a)return h();if(i)return h()}const p=e.bubbles?t:[this];s=null;for(const t of p){o||s&&t!==s.__host||f(p.slice(0,p.indexOf(t)+1)),l=t,r=t===e.target?2:3;const n=t.__eventListeners.get(e.type);if(n)for(const[e,t]of n)if(c(e,t,n),a)return h();if(i)return h()}return h()}},y={__proto__:null,enumerable:!0};Object.freeze(y);const b=(c=class{constructor(e,t={}){if(n.set(this,!1),i.set(this,!1),a.set(this,!1),r.set(this,!1),o.set(this,Date.now()),s.set(this,!1),l.set(this,void 0),d.set(this,void 0),u.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 t||!t)throw new Error('The "options" argument must be an object');const{bubbles:c,cancelable:h,composed:m}=t;f(this,n,!!h,"f"),f(this,i,!!c,"f"),f(this,a,!!m,"f"),f(this,l,`${e}`,"f"),f(this,d,null,"f"),f(this,u,!1,"f")}initEvent(e,t,n){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){f(this,r,!0,"f")}get target(){return p(this,d,"f")}get currentTarget(){return p(this,d,"f")}get srcElement(){return p(this,d,"f")}get type(){return p(this,l,"f")}get cancelable(){return p(this,n,"f")}get defaultPrevented(){return p(this,n,"f")&&p(this,r,"f")}get timeStamp(){return p(this,o,"f")}composedPath(){return p(this,u,"f")?[p(this,d,"f")]:[]}get returnValue(){return!p(this,n,"f")||!p(this,r,"f")}get bubbles(){return p(this,i,"f")}get composed(){return p(this,a,"f")}get eventPhase(){return p(this,u,"f")?c.AT_TARGET:c.NONE}get cancelBubble(){return p(this,s,"f")}set cancelBubble(e){e&&f(this,s,!0,"f")}stopPropagation(){f(this,s,!0,"f")}get isTrusted(){return!1}},n=new WeakMap,i=new WeakMap,a=new WeakMap,r=new WeakMap,o=new WeakMap,s=new WeakMap,l=new WeakMap,d=new WeakMap,u=new WeakMap,c.NONE=0,c.CAPTURING_PHASE=1,c.AT_TARGET=2,c.BUBBLING_PHASE=3,c);Object.defineProperties(b.prototype,{initEvent:y,stopImmediatePropagation:y,preventDefault:y,target:y,currentTarget:y,srcElement:y,type:y,cancelable:y,defaultPrevented:y,timeStamp:y,composedPath:y,returnValue:y,bubbles:y,composed:y,eventPhase:y,cancelBubble:y,stopPropagation:y,isTrusted:y});const w=(m=class extends b{constructor(e,t={}){super(e,t),h.set(this,void 0),f(this,h,t?.detail??null,"f")}initCustomEvent(e,t,n,i){throw new Error("Method not implemented.")}get detail(){return p(this,h,"f")}},h=new WeakMap,m);Object.defineProperties(w.prototype,{detail:y});const k=b,S=w;globalThis.Event??=k,globalThis.CustomEvent??=S;const M=new WeakMap,E=e=>{let t=M.get(e);return void 0===t&&M.set(e,t=new Map),t},P=class extends v{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(E(this)).map((([e,t])=>({name:e,value:t})))}get shadowRoot(){return"closed"===this.__shadowRootMode?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(e,t){E(this).set(e,String(t))}removeAttribute(e){E(this).delete(e)}toggleAttribute(e,t){return this.hasAttribute(e)?!(void 0===t||!t)||(this.removeAttribute(e),!1):!(void 0!==t&&!t)&&(this.setAttribute(e,""),!0)}hasAttribute(e){return E(this).has(e)}attachShadow(e){const t={host:this};return this.__shadowRootMode=e.mode,e&&"open"===e.mode&&(this.__shadowRoot=t),t}attachInternals(){if(null!==this.__internals)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");const e=new t(this);return this.__internals=e,e}getAttribute(e){return E(this).get(e)??null}},T=class extends P{};function x(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 A(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)}globalThis.litServerRoot??=Object.defineProperty(new T,"localName",{get:()=>"lit-server-root"}),"undefined"==typeof HTMLElement&&(globalThis.HTMLElement=T),"function"==typeof SuppressedError&&SuppressedError;var _;!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"}(_||(_={}));const{NAMI_SDK_VERSION:C="3.3.4",PRODUCTION:L="production",DEVELOPMENT:I="development",PLATFORM_ID_REQUIRED:D="Platform ID is required",DEVICE_ID_REQUIRED:R="Device ID is required",EXTERNAL_ID_REQUIRED:W="External ID is required",SDK_NOT_INITIALIZED:N="SDK has not been initialized. Make sure to call Nami.configure() first!",CAMPAIGN_NOT_AVAILABLE:O="Campaign is not available",FLOW_SCREENS_NOT_AVAILABLE:F="Flow screens not available",UNABLE_TO_UPDATE_CDP_ID:$="Unable to update CDP id in anonymous mode",ANONYMOUS_MODE_ALREADY_ON:j="Anonymous mode is already turned on.",ANONYMOUS_MODE_ALREADY_OFF:z="Anonymous mode is already turned off.",ANONYMOUS_MODE_LOGIN_NOT_ALLOWED:H="Login/logout are not available in anonymous mode",SESSION_REQUIRED:B="Session is required",DEVICE_ID_NOT_SET:U="Nami Device ID is not set",AUTH_DEVICE:G="nami_auth_device",NAMI_CONFIGURATION:V="nami_configuration",NAMI_PROFILE:X="nami_profile",API_CONFIG:K="api_config",API_CAMPAIGN_RULES:Y="api_campaign_rules",API_PAYWALLS:q="api_paywalls",API_PRODUCTS:J="api_products",API_ACTIVE_ENTITLEMENTS:Q="api_active_entitlements",SERVER_NAMI_ENTITLEMENTS:Z="server_active_entitlements",INITIAL_APP_CONFIG:ee="initial_app_config",INITIAL_CAMPAIGN_RULES:te="initial_campaign_rules",INITIAL_PAYWALLS:ne="initial_paywalls",INITIAL_PRODUCTS:ie="initial_products",LOCAL_NAMI_ENTITLEMENTS:ae="local_active_entitlements",CUSTOMER_ATTRIBUTES_KEY_PREFIX:re="nami_cmr_attributes_",NAMI_CUSTOMER_JOURNEY_STATE:oe="nami_customer_journey_state",ANONYMOUS_MODE:se="nami_anonymous_mode_v2",ANONYMOUS_UUID:le="nami_anonymous_uuid",KEY_SESSION_COUNTER:de="nami_session_counter",INITIAL_SESSION_COUNTER_VALUE:ue=1,NAMI_LAST_IMPRESSION_ID:ce="nami_last_impression_id",NAMI_PURCHASE_IMPRESSION_ID:he="nami_purchase_impression_id",NAMI_LAUNCH_ID:me="nami_launch_id",NAMI_SESSION_ID:fe="nami_session_id",NAMI_LANGUAGE_CODE:pe="nami_language_code",NAMI_PURCHASE_CHANNEL:ge="nami_purchase_channel",API_VERSION:ve="v3",BASE_URL_PATH:ye=`sdk/${ve}/platform`,BASE_URL:be="https://app.namiml.com",BASE_STAGING_URL:we="https://app-staging.namiml.com",CUSTOM_HOST_PREFIX:ke="namiAPIHost=",USE_STAGING_API:Se="useStagingAPI",EXTENDED_CLIENT_INFO_PREFIX:Me="extendedClientInfo",EXTENDED_CLIENT_INFO_DELIMITER:Ee=":",VALIDATE_PRODUCT_GROUPS:Pe="validateProductGroups",EXTENDED_PLATFORM:Te="extended-platform",EXTENDED_PLATFORM_VERSION:xe="extended-platform-version",API_MAX_CALLS_LIMIT:Ae=2,API_RETRY_DELAY_SEC:_e=2,API_TIMEOUT_LIMIT:Ce=2e4,DEVICE_API_TIMEOUT_LIMIT:Le=3e3,STATUS_SUCCESS:Ie=200,STATUS_BAD_REQUEST:De=400,STATUS_NOT_FOUND:Re=404,STATUS_CONFLICT:We=409,STATUS_INTERNAL_SERVER_ERROR:Ne=500,INITIAL_SUCCESS:Oe="Initial success",RECONFIG_SUCCESS:Fe="Reconfig success",ALREADY_CONFIGURED:$e="Already configured",AVAILABLE_CAMPAIGNS_CHANGED:je="AvailableCampaignsChanged",PAYWALL_ACTION_EVENT:ze="PaywallActionEvent",AVAILABLE_ACTIVE_ENTITLEMENTS_CHANGED:He="AvailableActiveEntitlementsChanged",CUSTOMER_JOURNEY_STATE_CHANGED:Be="CustomerJourneyStateChanged",SKU_TEXT_REGEX:Ue=/\$\{sku\.(\w+)(:\d+)?\}/g,VAR_REGEX:Ge=/\$\{\s*(\w+(\.[a-zA-Z\d_:${}-]{0,99})*?)\s*}/g,HTML_REGEX:Ve=/<\/?[a-z][\s\S]*>/i,SMART_TEXT_PATTERN:Xe="${"}={};var Ke;e.LogLevel=void 0,(Ke=e.LogLevel||(e.LogLevel={}))[Ke.DEBUG=1]="DEBUG",Ke[Ke.INFO=2]="INFO",Ke[Ke.WARN=3]="WARN",Ke[Ke.ERROR=4]="ERROR";const Ye={debug:e.LogLevel.DEBUG,info:e.LogLevel.INFO,warn:e.LogLevel.WARN,error:e.LogLevel.ERROR};const qe=new class{constructor(){this.currentLogLevel=e.LogLevel.DEBUG,this.setLogger=t=>{this.currentLogLevel=t?Ye[t]:e.LogLevel.WARN}}debug(t,...n){this.shouldLog(e.LogLevel.DEBUG)&&console.debug(this.formatMessage(e.LogLevel.DEBUG,t,...n))}info(t,...n){this.shouldLog(e.LogLevel.INFO)&&console.info(this.formatMessage(e.LogLevel.INFO,t,...n))}warn(t,...n){this.shouldLog(e.LogLevel.WARN)&&console.warn(this.formatMessage(e.LogLevel.WARN,t,...n))}error(t,...n){this.shouldLog(e.LogLevel.ERROR)&&console.error(this.formatMessage(e.LogLevel.ERROR,t,...n))}shouldLog(e){return e>=this.currentLogLevel}formatMessage(t,n,...i){const a=e.LogLevel[t];return`[${(new Date).toISOString()}] [${a}] ${n} ${i=i.map((e=>"object"==typeof e?JSON.stringify(e):e))}`}};function Je(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 Qe(e,t){return e===t||e!=e&&t!=t}function Ze(e,t){for(var n=e.length;n--;)if(Qe(e[n][0],t))return n;return-1}var et=Array.prototype.splice;function tt(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])}}tt.prototype.clear=function(){this.__data__=[],this.size=0},tt.prototype.delete=function(e){var t=this.__data__,n=Ze(t,e);return!(n<0)&&(n==t.length-1?t.pop():et.call(t,n,1),--this.size,!0)},tt.prototype.get=function(e){var t=this.__data__,n=Ze(t,e);return n<0?void 0:t[n][1]},tt.prototype.has=function(e){return Ze(this.__data__,e)>-1},tt.prototype.set=function(e,t){var n=this.__data__,i=Ze(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};var nt="object"==typeof global&&global&&global.Object===Object&&global,it="object"==typeof self&&self&&self.Object===Object&&self,at=nt||it||Function("return this")(),rt=at.Symbol,ot=Object.prototype,st=ot.hasOwnProperty,lt=ot.toString,dt=rt?rt.toStringTag:void 0;var ut=Object.prototype.toString;var ct="[object Null]",ht="[object Undefined]",mt=rt?rt.toStringTag:void 0;function ft(e){return null==e?void 0===e?ht:ct:mt&&mt in Object(e)?function(e){var t=st.call(e,dt),n=e[dt];try{e[dt]=void 0;var i=!0}catch(e){}var a=lt.call(e);return i&&(t?e[dt]=n:delete e[dt]),a}(e):function(e){return ut.call(e)}(e)}function pt(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var gt="[object AsyncFunction]",vt="[object Function]",yt="[object GeneratorFunction]",bt="[object Proxy]";function wt(e){if(!pt(e))return!1;var t=ft(e);return t==vt||t==yt||t==gt||t==bt}var kt,St=at["__core-js_shared__"],Mt=(kt=/[^.]+$/.exec(St&&St.keys&&St.keys.IE_PROTO||""))?"Symbol(src)_1."+kt:"";var Et=Function.prototype.toString;function Pt(e){if(null!=e){try{return Et.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var Tt=/^\[object .+?Constructor\]$/,xt=Function.prototype,At=Object.prototype,_t=xt.toString,Ct=At.hasOwnProperty,Lt=RegExp("^"+_t.call(Ct).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function It(e){return!(!pt(e)||(t=e,Mt&&Mt in t))&&(wt(e)?Lt:Tt).test(Pt(e));var t}function Dt(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return It(n)?n:void 0}var Rt=Dt(at,"Map"),Wt=Dt(Object,"create");var Nt=Object.prototype.hasOwnProperty;var Ot=Object.prototype.hasOwnProperty;function Ft(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 $t(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 jt(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])}}Ft.prototype.clear=function(){this.__data__=Wt?Wt(null):{},this.size=0},Ft.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Ft.prototype.get=function(e){var t=this.__data__;if(Wt){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Nt.call(t,e)?t[e]:void 0},Ft.prototype.has=function(e){var t=this.__data__;return Wt?void 0!==t[e]:Ot.call(t,e)},Ft.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Wt&&void 0===t?"__lodash_hash_undefined__":t,this},jt.prototype.clear=function(){this.size=0,this.__data__={hash:new Ft,map:new(Rt||tt),string:new Ft}},jt.prototype.delete=function(e){var t=$t(this,e).delete(e);return this.size-=t?1:0,t},jt.prototype.get=function(e){return $t(this,e).get(e)},jt.prototype.has=function(e){return $t(this,e).has(e)},jt.prototype.set=function(e,t){var n=$t(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};function zt(e){var t=this.__data__=new tt(e);this.size=t.size}zt.prototype.clear=function(){this.__data__=new tt,this.size=0},zt.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},zt.prototype.get=function(e){return this.__data__.get(e)},zt.prototype.has=function(e){return this.__data__.has(e)},zt.prototype.set=function(e,t){var n=this.__data__;if(n instanceof tt){var i=n.__data__;if(!Rt||i.length<199)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new jt(i)}return n.set(e,t),this.size=n.size,this};function Ht(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new jt;++t<n;)this.add(e[t])}function Bt(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 Ut(e,t){return e.has(t)}Ht.prototype.add=Ht.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Ht.prototype.has=function(e){return this.__data__.has(e)};var Gt=1,Vt=2;function Xt(e,t,n,i,a,r){var o=n&Gt,s=e.length,l=t.length;if(s!=l&&!(o&&l>s))return!1;var d=r.get(e),u=r.get(t);if(d&&u)return d==t&&u==e;var c=-1,h=!0,m=n&Vt?new Ht:void 0;for(r.set(e,t),r.set(t,e);++c<s;){var f=e[c],p=t[c];if(i)var g=o?i(p,f,c,t,e,r):i(f,p,c,e,t,r);if(void 0!==g){if(g)continue;h=!1;break}if(m){if(!Bt(t,(function(e,t){if(!Ut(m,t)&&(f===e||a(f,e,n,i,r)))return m.push(t)}))){h=!1;break}}else if(f!==p&&!a(f,p,n,i,r)){h=!1;break}}return r.delete(e),r.delete(t),h}var Kt=at.Uint8Array;function Yt(e){var t=-1,n=Array(e.size);return e.forEach((function(e,i){n[++t]=[i,e]})),n}function qt(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var Jt=1,Qt=2,Zt="[object Boolean]",en="[object Date]",tn="[object Error]",nn="[object Map]",an="[object Number]",rn="[object RegExp]",on="[object Set]",sn="[object String]",ln="[object Symbol]",dn="[object ArrayBuffer]",un="[object DataView]",cn=rt?rt.prototype:void 0,hn=cn?cn.valueOf:void 0;function mn(e,t){for(var n=-1,i=t.length,a=e.length;++n<i;)e[a+n]=t[n];return e}var fn=Array.isArray;function pn(e,t,n){var i=t(e);return fn(e)?i:mn(i,n(e))}function gn(){return[]}var vn=Object.prototype.propertyIsEnumerable,yn=Object.getOwnPropertySymbols,bn=yn?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}(yn(e),(function(t){return vn.call(e,t)})))}:gn;function wn(e){return null!=e&&"object"==typeof e}function kn(e){return wn(e)&&"[object Arguments]"==ft(e)}var Sn=Object.prototype,Mn=Sn.hasOwnProperty,En=Sn.propertyIsEnumerable,Pn=kn(function(){return arguments}())?kn:function(e){return wn(e)&&Mn.call(e,"callee")&&!En.call(e,"callee")};var Tn="object"==typeof e&&e&&!e.nodeType&&e,xn=Tn&&"object"==typeof module&&module&&!module.nodeType&&module,An=xn&&xn.exports===Tn?at.Buffer:void 0,_n=(An?An.isBuffer:void 0)||function(){return!1},Cn=9007199254740991,Ln=/^(?:0|[1-9]\d*)$/;function In(e,t){var n=typeof e;return!!(t=null==t?Cn:t)&&("number"==n||"symbol"!=n&&Ln.test(e))&&e>-1&&e%1==0&&e<t}var Dn=9007199254740991;function Rn(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=Dn}var Wn={};function Nn(e){return function(t){return e(t)}}Wn["[object Float32Array]"]=Wn["[object Float64Array]"]=Wn["[object Int8Array]"]=Wn["[object Int16Array]"]=Wn["[object Int32Array]"]=Wn["[object Uint8Array]"]=Wn["[object Uint8ClampedArray]"]=Wn["[object Uint16Array]"]=Wn["[object Uint32Array]"]=!0,Wn["[object Arguments]"]=Wn["[object Array]"]=Wn["[object ArrayBuffer]"]=Wn["[object Boolean]"]=Wn["[object DataView]"]=Wn["[object Date]"]=Wn["[object Error]"]=Wn["[object Function]"]=Wn["[object Map]"]=Wn["[object Number]"]=Wn["[object Object]"]=Wn["[object RegExp]"]=Wn["[object Set]"]=Wn["[object String]"]=Wn["[object WeakMap]"]=!1;var On="object"==typeof e&&e&&!e.nodeType&&e,Fn=On&&"object"==typeof module&&module&&!module.nodeType&&module,$n=Fn&&Fn.exports===On&&nt.process,jn=function(){try{var e=Fn&&Fn.require&&Fn.require("util").types;return e||$n&&$n.binding&&$n.binding("util")}catch(e){}}(),zn=jn&&jn.isTypedArray,Hn=zn?Nn(zn):function(e){return wn(e)&&Rn(e.length)&&!!Wn[ft(e)]},Bn=Object.prototype.hasOwnProperty;function Un(e,t){var n=fn(e),i=!n&&Pn(e),a=!n&&!i&&_n(e),r=!n&&!i&&!a&&Hn(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):[],l=s.length;for(var d in e)!t&&!Bn.call(e,d)||o&&("length"==d||a&&("offset"==d||"parent"==d)||r&&("buffer"==d||"byteLength"==d||"byteOffset"==d)||In(d,l))||s.push(d);return s}var Gn=Object.prototype;function Vn(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Gn)}function Xn(e,t){return function(n){return e(t(n))}}var Kn=Xn(Object.keys,Object),Yn=Object.prototype.hasOwnProperty;function qn(e){return null!=e&&Rn(e.length)&&!wt(e)}function Jn(e){return qn(e)?Un(e):function(e){if(!Vn(e))return Kn(e);var t=[];for(var n in Object(e))Yn.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}function Qn(e){return pn(e,Jn,bn)}var Zn=1,ei=Object.prototype.hasOwnProperty;var ti=Dt(at,"DataView"),ni=Dt(at,"Promise"),ii=Dt(at,"Set"),ai=Dt(at,"WeakMap"),ri="[object Map]",oi="[object Promise]",si="[object Set]",li="[object WeakMap]",di="[object DataView]",ui=Pt(ti),ci=Pt(Rt),hi=Pt(ni),mi=Pt(ii),fi=Pt(ai),pi=ft;(ti&&pi(new ti(new ArrayBuffer(1)))!=di||Rt&&pi(new Rt)!=ri||ni&&pi(ni.resolve())!=oi||ii&&pi(new ii)!=si||ai&&pi(new ai)!=li)&&(pi=function(e){var t=ft(e),n="[object Object]"==t?e.constructor:void 0,i=n?Pt(n):"";if(i)switch(i){case ui:return di;case ci:return ri;case hi:return oi;case mi:return si;case fi:return li}return t});var gi=1,vi="[object Arguments]",yi="[object Array]",bi="[object Object]",wi=Object.prototype.hasOwnProperty;function ki(e,t,n,i,a,r){var o=fn(e),s=fn(t),l=o?yi:pi(e),d=s?yi:pi(t),u=(l=l==vi?bi:l)==bi,c=(d=d==vi?bi:d)==bi,h=l==d;if(h&&_n(e)){if(!_n(t))return!1;o=!0,u=!1}if(h&&!u)return r||(r=new zt),o||Hn(e)?Xt(e,t,n,i,a,r):function(e,t,n,i,a,r,o){switch(n){case un:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case dn:return!(e.byteLength!=t.byteLength||!r(new Kt(e),new Kt(t)));case Zt:case en:case an:return Qe(+e,+t);case tn:return e.name==t.name&&e.message==t.message;case rn:case sn:return e==t+"";case nn:var s=Yt;case on:var l=i&Jt;if(s||(s=qt),e.size!=t.size&&!l)return!1;var d=o.get(e);if(d)return d==t;i|=Qt,o.set(e,t);var u=Xt(s(e),s(t),i,a,r,o);return o.delete(e),u;case ln:if(hn)return hn.call(e)==hn.call(t)}return!1}(e,t,l,n,i,a,r);if(!(n&gi)){var m=u&&wi.call(e,"__wrapped__"),f=c&&wi.call(t,"__wrapped__");if(m||f){var p=m?e.value():e,g=f?t.value():t;return r||(r=new zt),a(p,g,n,i,r)}}return!!h&&(r||(r=new zt),function(e,t,n,i,a,r){var o=n&Zn,s=Qn(e),l=s.length;if(l!=Qn(t).length&&!o)return!1;for(var d=l;d--;){var u=s[d];if(!(o?u in t:ei.call(t,u)))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;++d<l;){var p=e[u=s[d]],g=t[u];if(i)var v=o?i(g,p,u,t,e,r):i(p,g,u,e,t,r);if(!(void 0===v?p===g||a(p,g,n,i,r):v)){m=!1;break}f||(f="constructor"==u)}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 Si(e,t,n,i,a){return e===t||(null==e||null==t||!wn(e)&&!wn(t)?e!=e&&t!=t:ki(e,t,n,i,Si,a))}var Mi=1,Ei=2;function Pi(e){return e==e&&!pt(e)}function Ti(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}function xi(e){var t=function(e){for(var t=Jn(e),n=t.length;n--;){var i=t[n],a=e[i];t[n]=[i,a,Pi(a)]}return t}(e);return 1==t.length&&t[0][2]?Ti(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],l=e[s],d=o[1];if(o[2]){if(void 0===l&&!(s in e))return!1}else{var u=new zt;if(!Si(d,l,Mi|Ei,i,u))return!1}}return!0}(n,0,t)}}var Ai="[object Symbol]";function _i(e){return"symbol"==typeof e||wn(e)&&ft(e)==Ai}var Ci=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Li=/^\w*$/;function Ii(e,t){if(fn(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!_i(e))||(Li.test(e)||!Ci.test(e)||null!=t&&e in Object(t))}var Di="Expected a function";function Ri(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(Di);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(Ri.Cache||jt),n}Ri.Cache=jt;var Wi,Ni,Oi,Fi=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$i=/\\(\\)?/g,ji=(Wi=function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Fi,(function(e,n,i,a){t.push(i?a.replace($i,"$1"):n||e)})),t},Ni=Ri(Wi,(function(e){return 500===Oi.size&&Oi.clear(),e})),Oi=Ni.cache,Ni);var zi=1/0,Hi=rt?rt.prototype:void 0,Bi=Hi?Hi.toString:void 0;function Ui(e){if("string"==typeof e)return e;if(fn(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,Ui)+"";if(_i(e))return Bi?Bi.call(e):"";var t=e+"";return"0"==t&&1/e==-zi?"-0":t}function Gi(e){return null==e?"":Ui(e)}function Vi(e,t){return fn(e)?e:Ii(e,t)?[e]:ji(Gi(e))}var Xi=1/0;function Ki(e){if("string"==typeof e||_i(e))return e;var t=e+"";return"0"==t&&1/e==-Xi?"-0":t}function Yi(e,t){for(var n=0,i=(t=Vi(t,e)).length;null!=e&&n<i;)e=e[Ki(t[n++])];return n&&n==i?e:void 0}function qi(e,t){return null!=e&&t in Object(e)}function Ji(e,t){return null!=e&&function(e,t,n){for(var i=-1,a=(t=Vi(t,e)).length,r=!1;++i<a;){var o=Ki(t[i]);if(!(r=null!=e&&n(e,o)))break;e=e[o]}return r||++i!=a?r:!!(a=null==e?0:e.length)&&Rn(a)&&In(o,a)&&(fn(e)||Pn(e))}(e,t,qi)}var Qi=1,Zi=2;function ea(e,t){return Ii(e)&&Pi(t)?Ti(Ki(e),t):function(n){var i=function(e,t,n){var i=null==e?void 0:Yi(e,t);return void 0===i?n:i}(n,e);return void 0===i&&i===t?Ji(n,e):Si(t,i,Qi|Zi)}}function ta(e){return e}function na(e){return Ii(e)?(t=Ki(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return Yi(t,e)}}(e);var t}function ia(e){return e!=e}function aa(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,ia,n)}(e,t,0)>-1}var ra=ii&&1/qt(new ii([,-0]))[1]==1/0?function(e){return new ii(e)}:function(){},oa=200;function sa(e,t){return e&&e.length?function(e,t,n){var i=-1,a=aa,r=e.length,o=!0,s=[],l=s;if(r>=oa){var d=t?null:ra(e);if(d)return qt(d);o=!1,a=Ut,l=new Ht}else l=t?[]:s;e:for(;++i<r;){var u=e[i],c=t?t(u):u;if(u=0!==u?u:0,o&&c==c){for(var h=l.length;h--;)if(l[h]===c)continue e;t&&l.push(c),s.push(u)}else a(l,c,n)||(l!==s&&l.push(c),s.push(u))}return s}(e,"function"==typeof(n=t)?n:null==n?ta:"object"==typeof n?fn(n)?ea(n[0],n[1]):xi(n):na(n)):[];var n}const la=new class{constructor(){this.memoryStore={}}setDevice(e){this.setItem(G,e)}getDevice(){return this.getItem(G)}resetDevice(){this.resetItem(G)}getAnonymousMode(){return this.getItem(se)||!1}setAnonymousMode(e){this.setItem(se,e)}clearAnonymousMode(){this.resetItem(se)}setAppConfig(e,t){this.setItem(e,t)}getAppConfig(e){return this.getItem(e)}setLanguageCode(e){this.setItem(pe,e||"en")}getLanguageCode(){return this.getItem(pe)||"en"}setCampaignRules(e,t){e!==te?this.setItem(e,t):this.memoryStore[te]=JSON.stringify(t)}getCampaignRules(e){return e===te?this.memoryStore[te]?JSON.parse(this.memoryStore[te]):null:this.getItem(e)}setPaywalls(e,t){e!==ne?this.setItem(e,t):this.memoryStore[ne]=JSON.stringify(t)}getPaywalls(e){return e===ne?this.memoryStore[ne]?JSON.parse(this.memoryStore[ne]):null:this.getItem(e)}setActiveEntitlements(e,t){this.setItem(e,t)}getActiveEntitlements(e){return this.getItem(e)||[]}setNamiEntitlements(e,t){this.setItem(e,t)}getNamiEntitlements(e){return this.getItem(e)||[]}setProducts(e,t){this.setItem(e,t)}getProducts(e){return this.getItem(e)}getCachedProducts(){const e=this.getItem(J)??[];return sa(Je([...this.getItem(ie)??[],...e]),"sku_ref_id")}setNamiConfig(e){this.setItem(V,e)}getNamiConfig(){return this.getItem(V)}setCustomerAttribute(e,t){this.setItem(re+e,t)}getCustomerAttribute(e){return this.getItem(re+e)}getAllCustomerAttributes(){return Object.entries(localStorage).filter((([e])=>e.includes(re))).map((([e,t])=>e.replace(re,"")+":"+t))}getAllCustomerAttributesKeys(){return Object.keys(localStorage).filter((e=>e.includes(re))).map((e=>e.replace(re,"")))}clearCustomerAttribute(e){const t=re+e,n=this.getItem(t);return n&&this.resetItem(t),!!n}clearAllCustomerAttributes(){Object.keys(localStorage).filter((e=>e.includes(re))).map((e=>this.resetItem(e)))}setNamiProfile(e){this.setItem(X,e)}getNamiProfile(){return this.getItem(X)}removeNamiProfile(){this.resetItem(X)}setCustomerJourneyState(e){this.setItem(oe,e)}getCustomerJourneyState(){return this.getItem(oe)}setSessionCounter(){const e=this.getItem(de),t=e?parseInt(e):ue||ue;this.setItem(de,t+1)}getSessionCounter(){const e=this.getItem(de);return e?parseInt(e):ue}setLastImpressionId(e){this.setItem(ce,e)}getLastImpressionId(){return this.getItem(ce)??""}setPurchaseImpression(){const e=this.getLastImpressionId()??"";this.setItem(he,e)}getPurchaseImpression(){return this.getItem(he)??""}setSessionId(e){e&&this.setItem(fe,e)}getSessionId(){return this.getItem(fe)??""}clearSessionId(){this.resetItem(fe)}setLaunchId(e){e&&this.setItem(me,e)}getLaunchId(){return this.getItem(me)??""}clearLaunchId(){this.resetItem(me)}setPurchaseChannel(e){e&&this.setItem(ge,e)}getPurchaseChannel(){return this.getItem(ge)}getAnonymousUUID(){return this.getItem(le)}setAnonymousUUID(e){this.setItem(le,e)}clearAnonymousUUID(){this.resetItem(le)}setItem(e,t){let n;try{n=JSON.stringify(t)}catch(t){return void qe.error(`Serialization failed for ${e}`,t)}try{localStorage.setItem(e,n)}catch(t){qe.error("Error setting item in localStorage:",t),this.resetItem(e),this.memoryStore[e]=n}}getItem(e){try{const t=localStorage.getItem(e);if(null!==t)return JSON.parse(t)}catch(t){"undefined"!=typeof window&&qe.error("Error getting item from localStorage:",e,": ",t)}const t=this.memoryStore[e];return null!=t?JSON.parse(t):null}resetItem(e){try{localStorage.removeItem(e)}catch(t){"undefined"!=typeof window&&qe.error("Error removing item from localStorage:",e,": ",t)}delete this.memoryStore[e]}clear(){try{localStorage.clear()}catch(e){qe.error("Error clearing localStorage:",e)}this.memoryStore={}}};class da extends Error{constructor(e,t){super(t),this.statusCode=e,this.status=e,this.message=`RetryLimitExceededError: ${this.message}`}}class ua extends Error{}class ca extends ua{constructor(){super(),this.status=409,this.name="ConflictError",this.message="ConflictError: Server responded with conflict"}}class ha extends Error{constructor(){super(N)}}class ma extends Error{constructor(){super(D)}}class fa extends Error{constructor(){super(R)}}class pa extends Error{constructor(){super(W)}}class ga extends Error{constructor(){super(O)}}class va extends Error{constructor(){super(F)}}class ya extends Error{constructor(){super(j)}}class ba extends Error{constructor(){super(z)}}class wa extends Error{constructor(){super(z)}}class ka extends Error{constructor(){super($)}}class Sa extends ua{constructor(e){super(e),this.message=`BadRequestError: ${this.message}`}}class Ma extends ua{constructor(e){super(e),this.message=`NotFoundError: ${this.message}`}}class Ea extends ua{constructor(e,t){super(t),this.statusCode=e,this.message=`ClientError: ${this.message}`}}class Pa extends ua{constructor(e){super(e),this.message=`ServerError: ${this.message}`}}const Ta=(e,t)=>{if(e==De)throw new Sa(t);if(e==Re)throw new Ma(t);if(e==We)throw new ca;if(e>De&&e<Ne)throw new Ea(e,t);if(e>=Ne)throw new Pa(t)};async function xa(e,t,n=Ce,i=Ae){let a=0;const r=async()=>{const o=await async function(e,t={},n){const i=new AbortController,a=setTimeout((()=>i.abort()),n);t.signal=i.signal;const r=await fetch(e,t);return clearTimeout(a),r}(e,t,n);if(!o.ok){if(o.status==We)throw new ca;if(a++,a<=i){const e=1e3*(a+_e);return await new Promise((t=>setTimeout(t,e))),r()}throw new da(o.status,`Request failed after ${i} retries`)}return o};return(await r()).json()}function Aa(e){let t=e.length;for(;--t>=0;)e[t]=0}const _a=256,Ca=286,La=30,Ia=15,Da=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Ra=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Wa=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Na=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Oa=new Array(576);Aa(Oa);const Fa=new Array(60);Aa(Fa);const $a=new Array(512);Aa($a);const ja=new Array(256);Aa(ja);const za=new Array(29);Aa(za);const Ha=new Array(La);function Ba(e,t,n,i,a){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=i,this.max_length=a,this.has_stree=e&&e.length}let Ua,Ga,Va;function Xa(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}Aa(Ha);const Ka=e=>e<256?$a[e]:$a[256+(e>>>7)],Ya=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},qa=(e,t,n)=>{e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,Ya(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},Ja=(e,t,n)=>{qa(e,n[2*t],n[2*t+1])},Qa=(e,t)=>{let n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1},Za=(e,t,n)=>{const i=new Array(16);let a,r,o=0;for(a=1;a<=Ia;a++)o=o+n[a-1]<<1,i[a]=o;for(r=0;r<=t;r++){let t=e[2*r+1];0!==t&&(e[2*r]=Qa(i[t]++,t))}},er=e=>{let t;for(t=0;t<Ca;t++)e.dyn_ltree[2*t]=0;for(t=0;t<La;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},tr=e=>{e.bi_valid>8?Ya(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},nr=(e,t,n,i)=>{const a=2*t,r=2*n;return e[a]<e[r]||e[a]===e[r]&&i[t]<=i[n]},ir=(e,t,n)=>{const i=e.heap[n];let a=n<<1;for(;a<=e.heap_len&&(a<e.heap_len&&nr(t,e.heap[a+1],e.heap[a],e.depth)&&a++,!nr(t,i,e.heap[a],e.depth));)e.heap[n]=e.heap[a],n=a,a<<=1;e.heap[n]=i},ar=(e,t,n)=>{let i,a,r,o,s=0;if(0!==e.sym_next)do{i=255&e.pending_buf[e.sym_buf+s++],i+=(255&e.pending_buf[e.sym_buf+s++])<<8,a=e.pending_buf[e.sym_buf+s++],0===i?Ja(e,a,t):(r=ja[a],Ja(e,r+_a+1,t),o=Da[r],0!==o&&(a-=za[r],qa(e,a,o)),i--,r=Ka(i),Ja(e,r,n),o=Ra[r],0!==o&&(i-=Ha[r],qa(e,i,o)))}while(s<e.sym_next);Ja(e,256,t)},rr=(e,t)=>{const n=t.dyn_tree,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,r=t.stat_desc.elems;let o,s,l,d=-1;for(e.heap_len=0,e.heap_max=573,o=0;o<r;o++)0!==n[2*o]?(e.heap[++e.heap_len]=d=o,e.depth[o]=0):n[2*o+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=d<2?++d:0,n[2*l]=1,e.depth[l]=0,e.opt_len--,a&&(e.static_len-=i[2*l+1]);for(t.max_code=d,o=e.heap_len>>1;o>=1;o--)ir(e,n,o);l=r;do{o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],ir(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,n[2*l]=n[2*o]+n[2*s],e.depth[l]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,n[2*o+1]=n[2*s+1]=l,e.heap[1]=l++,ir(e,n,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const n=t.dyn_tree,i=t.max_code,a=t.stat_desc.static_tree,r=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,l=t.stat_desc.max_length;let d,u,c,h,m,f,p=0;for(h=0;h<=Ia;h++)e.bl_count[h]=0;for(n[2*e.heap[e.heap_max]+1]=0,d=e.heap_max+1;d<573;d++)u=e.heap[d],h=n[2*n[2*u+1]+1]+1,h>l&&(h=l,p++),n[2*u+1]=h,u>i||(e.bl_count[h]++,m=0,u>=s&&(m=o[u-s]),f=n[2*u],e.opt_len+=f*(h+m),r&&(e.static_len+=f*(a[2*u+1]+m)));if(0!==p){do{for(h=l-1;0===e.bl_count[h];)h--;e.bl_count[h]--,e.bl_count[h+1]+=2,e.bl_count[l]--,p-=2}while(p>0);for(h=l;0!==h;h--)for(u=e.bl_count[h];0!==u;)c=e.heap[--d],c>i||(n[2*c+1]!==h&&(e.opt_len+=(h-n[2*c+1])*n[2*c],n[2*c+1]=h),u--)}})(e,t),Za(n,d,e.bl_count)},or=(e,t,n)=>{let i,a,r=-1,o=t[1],s=0,l=7,d=4;for(0===o&&(l=138,d=3),t[2*(n+1)+1]=65535,i=0;i<=n;i++)a=o,o=t[2*(i+1)+1],++s<l&&a===o||(s<d?e.bl_tree[2*a]+=s:0!==a?(a!==r&&e.bl_tree[2*a]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,r=a,0===o?(l=138,d=3):a===o?(l=6,d=3):(l=7,d=4))},sr=(e,t,n)=>{let i,a,r=-1,o=t[1],s=0,l=7,d=4;for(0===o&&(l=138,d=3),i=0;i<=n;i++)if(a=o,o=t[2*(i+1)+1],!(++s<l&&a===o)){if(s<d)do{Ja(e,a,e.bl_tree)}while(0!=--s);else 0!==a?(a!==r&&(Ja(e,a,e.bl_tree),s--),Ja(e,16,e.bl_tree),qa(e,s-3,2)):s<=10?(Ja(e,17,e.bl_tree),qa(e,s-3,3)):(Ja(e,18,e.bl_tree),qa(e,s-11,7));s=0,r=a,0===o?(l=138,d=3):a===o?(l=6,d=3):(l=7,d=4)}};let lr=!1;const dr=(e,t,n,i)=>{qa(e,0+(i?1:0),3),tr(e),Ya(e,n),Ya(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n};var ur=e=>{lr||((()=>{let e,t,n,i,a;const r=new Array(16);for(n=0,i=0;i<28;i++)for(za[i]=n,e=0;e<1<<Da[i];e++)ja[n++]=i;for(ja[n-1]=i,a=0,i=0;i<16;i++)for(Ha[i]=a,e=0;e<1<<Ra[i];e++)$a[a++]=i;for(a>>=7;i<La;i++)for(Ha[i]=a<<7,e=0;e<1<<Ra[i]-7;e++)$a[256+a++]=i;for(t=0;t<=Ia;t++)r[t]=0;for(e=0;e<=143;)Oa[2*e+1]=8,e++,r[8]++;for(;e<=255;)Oa[2*e+1]=9,e++,r[9]++;for(;e<=279;)Oa[2*e+1]=7,e++,r[7]++;for(;e<=287;)Oa[2*e+1]=8,e++,r[8]++;for(Za(Oa,287,r),e=0;e<La;e++)Fa[2*e+1]=5,Fa[2*e]=Qa(e,5);Ua=new Ba(Oa,Da,257,Ca,Ia),Ga=new Ba(Fa,Ra,0,La,Ia),Va=new Ba(new Array(0),Wa,0,19,7)})(),lr=!0),e.l_desc=new Xa(e.dyn_ltree,Ua),e.d_desc=new Xa(e.dyn_dtree,Ga),e.bl_desc=new Xa(e.bl_tree,Va),e.bi_buf=0,e.bi_valid=0,er(e)},cr=(e,t,n,i)=>{let a,r,o=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<_a;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),rr(e,e.l_desc),rr(e,e.d_desc),o=(e=>{let t;for(or(e,e.dyn_ltree,e.l_desc.max_code),or(e,e.dyn_dtree,e.d_desc.max_code),rr(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Na[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),a=e.opt_len+3+7>>>3,r=e.static_len+3+7>>>3,r<=a&&(a=r)):a=r=n+5,n+4<=a&&-1!==t?dr(e,t,n,i):4===e.strategy||r===a?(qa(e,2+(i?1:0),3),ar(e,Oa,Fa)):(qa(e,4+(i?1:0),3),((e,t,n,i)=>{let a;for(qa(e,t-257,5),qa(e,n-1,5),qa(e,i-4,4),a=0;a<i;a++)qa(e,e.bl_tree[2*Na[a]+1],3);sr(e,e.dyn_ltree,t-1),sr(e,e.dyn_dtree,n-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),ar(e,e.dyn_ltree,e.dyn_dtree)),er(e),i&&tr(e)},hr=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(ja[n]+_a+1)]++,e.dyn_dtree[2*Ka(t)]++),e.sym_next===e.sym_end),mr=e=>{qa(e,2,3),Ja(e,256,Oa),(e=>{16===e.bi_valid?(Ya(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)},fr={_tr_init:ur,_tr_stored_block:dr,_tr_flush_block:cr,_tr_tally:hr,_tr_align:mr};var pr=(e,t,n,i)=>{let a=65535&e,r=e>>>16&65535,o=0;for(;0!==n;){o=n>2e3?2e3:n,n-=o;do{a=a+t[i++]|0,r=r+a|0}while(--o);a%=65521,r%=65521}return a|r<<16};const gr=new Uint32Array((()=>{let e,t=[];for(var 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})());var vr=(e,t,n,i)=>{const a=gr,r=i+n;e^=-1;for(let n=i;n<r;n++)e=e>>>8^a[255&(e^t[n])];return~e},yr={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"},br={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};const{_tr_init:wr,_tr_stored_block:kr,_tr_flush_block:Sr,_tr_tally:Mr,_tr_align:Er}=fr,{Z_NO_FLUSH:Pr,Z_PARTIAL_FLUSH:Tr,Z_FULL_FLUSH:xr,Z_FINISH:Ar,Z_BLOCK:_r,Z_OK:Cr,Z_STREAM_END:Lr,Z_STREAM_ERROR:Ir,Z_DATA_ERROR:Dr,Z_BUF_ERROR:Rr,Z_DEFAULT_COMPRESSION:Wr,Z_FILTERED:Nr,Z_HUFFMAN_ONLY:Or,Z_RLE:Fr,Z_FIXED:$r,Z_DEFAULT_STRATEGY:jr,Z_UNKNOWN:zr,Z_DEFLATED:Hr}=br,Br=258,Ur=262,Gr=42,Vr=113,Xr=666,Kr=(e,t)=>(e.msg=yr[t],t),Yr=e=>2*e-(e>4?9:0),qr=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Jr=e=>{let t,n,i,a=e.w_size;t=e.hash_size,i=t;do{n=e.head[--i],e.head[i]=n>=a?n-a:0}while(--t);t=a,i=t;do{n=e.prev[--i],e.prev[i]=n>=a?n-a:0}while(--t)};let Qr=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask;const Zr=e=>{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))},eo=(e,t)=>{Sr(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Zr(e.strm)},to=(e,t)=>{e.pending_buf[e.pending++]=t},no=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},io=(e,t,n,i)=>{let a=e.avail_in;return a>i&&(a=i),0===a?0:(e.avail_in-=a,t.set(e.input.subarray(e.next_in,e.next_in+a),n),1===e.state.wrap?e.adler=pr(e.adler,t,a,n):2===e.state.wrap&&(e.adler=vr(e.adler,t,a,n)),e.next_in+=a,e.total_in+=a,a)},ao=(e,t)=>{let n,i,a=e.max_chain_length,r=e.strstart,o=e.prev_length,s=e.nice_match;const l=e.strstart>e.w_size-Ur?e.strstart-(e.w_size-Ur):0,d=e.window,u=e.w_mask,c=e.prev,h=e.strstart+Br;let m=d[r+o-1],f=d[r+o];e.prev_length>=e.good_match&&(a>>=2),s>e.lookahead&&(s=e.lookahead);do{if(n=t,d[n+o]===f&&d[n+o-1]===m&&d[n]===d[r]&&d[++n]===d[r+1]){r+=2,n++;do{}while(d[++r]===d[++n]&&d[++r]===d[++n]&&d[++r]===d[++n]&&d[++r]===d[++n]&&d[++r]===d[++n]&&d[++r]===d[++n]&&d[++r]===d[++n]&&d[++r]===d[++n]&&r<h);if(i=Br-(h-r),r=h-Br,i>o){if(e.match_start=t,o=i,i>=s)break;m=d[r+o-1],f=d[r+o]}}}while((t=c[t&u])>l&&0!=--a);return o<=e.lookahead?o:e.lookahead},ro=e=>{const t=e.w_size;let n,i,a;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Ur)&&(e.window.set(e.window.subarray(t,t+t-i),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Jr(e),i+=t),0===e.strm.avail_in)break;if(n=io(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=n,e.lookahead+e.insert>=3)for(a=e.strstart-e.insert,e.ins_h=e.window[a],e.ins_h=Qr(e,e.ins_h,e.window[a+1]);e.insert&&(e.ins_h=Qr(e,e.ins_h,e.window[a+3-1]),e.prev[a&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=a,a++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<Ur&&0!==e.strm.avail_in)},oo=(e,t)=>{let n,i,a,r=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,o=0,s=e.strm.avail_in;do{if(n=65535,a=e.bi_valid+42>>3,e.strm.avail_out<a)break;if(a=e.strm.avail_out-a,i=e.strstart-e.block_start,n>i+e.strm.avail_in&&(n=i+e.strm.avail_in),n>a&&(n=a),n<r&&(0===n&&t!==Ar||t===Pr||n!==i+e.strm.avail_in))break;o=t===Ar&&n===i+e.strm.avail_in?1:0,kr(e,0,0,o),e.pending_buf[e.pending-4]=n,e.pending_buf[e.pending-3]=n>>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,Zr(e.strm),i&&(i>n&&(i=n),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,n-=i),n&&(io(e.strm,e.strm.output,e.strm.next_out,n),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n)}while(0===o);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),o?4:t!==Pr&&t!==Ar&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(a=e.window_size-e.strstart,e.strm.avail_in>a&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,a+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),a>e.strm.avail_in&&(a=e.strm.avail_in),a&&(io(e.strm,e.window,e.strstart,a),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.high_water<e.strstart&&(e.high_water=e.strstart),a=e.bi_valid+42>>3,a=e.pending_buf_size-a>65535?65535:e.pending_buf_size-a,r=a>e.w_size?e.w_size:a,i=e.strstart-e.block_start,(i>=r||(i||t===Ar)&&t!==Pr&&0===e.strm.avail_in&&i<=a)&&(n=i>a?a:i,o=t===Ar&&0===e.strm.avail_in&&n===i?1:0,kr(e,e.block_start,n,o),e.block_start+=n,Zr(e.strm)),o?3:1)},so=(e,t)=>{let n,i;for(;;){if(e.lookahead<Ur){if(ro(e),e.lookahead<Ur&&t===Pr)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=Qr(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-Ur&&(e.match_length=ao(e,n)),e.match_length>=3)if(i=Mr(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=Qr(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Qr(e,e.ins_h,e.window[e.strstart+1]);else i=Mr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(eo(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===Ar?(eo(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(eo(e,!1),0===e.strm.avail_out)?1:2},lo=(e,t)=>{let n,i,a;for(;;){if(e.lookahead<Ur){if(ro(e),e.lookahead<Ur&&t===Pr)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=Qr(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-Ur&&(e.match_length=ao(e,n),e.match_length<=5&&(e.strategy===Nr||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){a=e.strstart+e.lookahead-3,i=Mr(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=a&&(e.ins_h=Qr(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(eo(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=Mr(e,0,e.window[e.strstart-1]),i&&eo(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=Mr(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===Ar?(eo(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(eo(e,!1),0===e.strm.avail_out)?1:2};function uo(e,t,n,i,a){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=i,this.func=a}const co=[new uo(0,0,0,0,oo),new uo(4,4,8,4,so),new uo(4,5,16,8,so),new uo(4,6,32,32,so),new uo(4,4,16,16,lo),new uo(8,16,32,32,lo),new uo(8,16,128,128,lo),new uo(8,32,128,256,lo),new uo(32,128,258,1024,lo),new uo(32,258,258,4096,lo)];function ho(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Hr,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),qr(this.dyn_ltree),qr(this.dyn_dtree),qr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),qr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),qr(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const mo=e=>{if(!e)retur