@namiml/web-sdk 0.0.1-alpha.6 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- !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";const{PRODUCTION:t="production",DEVELOPMENT:n="development",PLATFORM_ID_REQUIRED:r="Platform ID is required",DEVICE_ID_REQUIRED:s="Device ID is required",EXTERNAL_ID_REQUIRED:i="External ID is required",SDK_NOT_INITIALIZED:o="SDK has not been initialized. Make sure to call Nami.configure() first!",CAMPAIGN_NOT_AVAILABLE:a="Campaign is not available",UNABLE_TO_UPDATE_CDP_ID:c="Unable to update CDP id in anonymous mode",AUTH_DEVICE:l="nami_auth_device",NAMI_CONFIGURATION:u="nami_configuration",NAMI_PROFILE:h="nami_profile",API_CONFIG:p="api_config",API_CAMPAIGN_RULES:d="api_campaign_rules",API_PAYWALLS:f="api_paywalls",API_PRODUCTS:g="api_products",INITIAL_APP_CONFIG:m="initial_app_config",INITIAL_CAMPAIGN_RULES:b="initial_campaign_rules",INITIAL_PAYWALLS:y="initial_paywalls",INITIAL_PRODUCTS:_="initial_products",CUSTOMER_ATTRIBUTES_KEY_PREFIX:w="nami_cmr_attributes_",ANONYMOUS_MODE:v="nami_anonymous_mode",BASE_URL:k="https://app.namiml.com/sdk/v3/platform",BASE_STAGING_URL:A="https://app-staging.namiml.com/sdk/v3/platform",CUSTOM_HOST_PREFIX:S="namiAPIHost=",USE_STAGING_API:x="useStagingAPI",EXTENDED_CLIENT_INFO_PREFIX:$="extendedClientInfo",EXTENDED_CLIENT_INFO_DELIMITER:E=":",EXTENDED_PLATFORM:I="extended-platform",EXTENDED_PLATFORM_VERSION:C="extended-platform-version",API_MAX_CALLS_LIMIT:P=2,API_RETRY_DELAY_SEC:O=2,STATUS_SUCCESS:R=200,STATUS_BAD_REQUEST:T=400,STATUS_NOT_FOUND:L=404,STATUS_INTERNAL_SERVER_ERROR:N=500,INITIAL_SUCCESS:M="Initial success",RECONFIG_SUCCESS:D="Reconfig success",ALREADY_CONFIGURED:z="Already configured",AVAILABLE_CAMPAIGNS_CHANGED:U="AvailableCampaignsChanged",PAYWALL_ACTION_EVENT:F="PaywallActionEvent",SKU_TEXT_REGEX:j=/\$\{sku\.(\w+)(:\d+)?\}/g,VAR_REGEX:B=/\$\{\s*(\w+(\.[a-zA-Z\d_:${}-]{0,99})*?)\s*}/g,CORS_PROXY_URL:H="https://hosted-content-staging.namiml.com",CORS_PROXY_URL_LOCAL:W="http://localhost:8001"}={};var G;!function(e){e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR"}(G||(G={}));const q={debug:G.DEBUG,info:G.INFO,warn:G.WARN,error:G.ERROR};const K=new class{currentLogLevel;setLogger=e=>{this.currentLogLevel=q[e]||G.WARN};debug(e,...t){this.shouldLog(G.DEBUG)&&console.debug(this.formatMessage(G.DEBUG,e,...t))}info(e,...t){this.shouldLog(G.INFO)&&console.info(this.formatMessage(G.INFO,e,...t))}warn(e,...t){this.shouldLog(G.WARN)&&console.warn(this.formatMessage(G.WARN,e,...t))}error(e,...t){this.shouldLog(G.ERROR)&&console.error(this.formatMessage(G.ERROR,e,...t))}shouldLog(e){return e>=this.currentLogLevel}formatMessage(e,t,...n){const r=G[e];return`[${(new Date).toISOString()}] [${r}] ${t} ${n=n.map((e=>"object"==typeof e?JSON.stringify(e):e))}`}};const V=new class{setDevice(e){this.setItem(l,e)}getDevice(){return this.getItem(l)}getAnonymousMode(){return this.getItem(v)}resetDevice(){this.resetItem(l)}setAppConfig(e,t){this.setItem(e,t)}getAppConfig(e){return this.getItem(e)}setCampaignRules(e,t){this.setItem(e,t)}getCampaignRules(e){return this.getItem(e)}setPaywalls(e,t){this.setItem(e,t)}getPaywalls(e){return this.getItem(e)}setProducts(e,t){this.setItem(e,t)}getProducts(e){return this.getItem(e)}setNamiConfig(e){this.setItem(u,e)}getNamiConfig(){return this.getItem(u)}setCustomerAttribute(e,t){this.setItem(w+e,t)}getCustomerAttribute(e){return this.getItem(w+e)}getAllCustomerAttributes(){return Object.keys(localStorage).filter((e=>e.includes(w))).map((e=>e.replace(w,"")))}clearCustomerAttribute(e){const t=w+e,n=this.getItem(t);return n&&this.resetItem(t),!!n}clearAllCustomerAttributes(){Object.keys(localStorage).filter((e=>e.includes(w))).map((e=>this.resetItem(e)))}setNamiProfile(e){this.setItem(h,e)}getNamiProfile(){return this.getItem(h)}removeNamiProfile(){this.resetItem(h)}setItem(e,t){try{const n=JSON.stringify(t);localStorage.setItem(e,n)}catch(e){K.error("Error setting item in localStorage:",e)}}getItem(e){try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch(t){return K.error("Error getting item from localStorage:",e,": ",t),null}}resetItem(e){try{localStorage.removeItem(e)}catch(e){K.error("Error removing item from localStorage:",e)}}clear(){try{localStorage.clear()}catch(e){K.error("Error clearing localStorage:",e)}}};class Y extends Error{statusCode;status;constructor(e,t){super(t),this.statusCode=e,this.status=e,this.message=`RetryLimitExceededError: ${this.message}`}}class X extends Error{constructor(){super(o)}}class Q extends Error{constructor(){super(r)}}class Z extends Error{constructor(){super(s)}}class J extends Error{constructor(){super(i)}}class ee extends Error{constructor(){super(a)}}class te extends Error{constructor(e){super(e),this.message=`BadRequestError: ${this.message}`}}class ne extends Error{constructor(e){super(e),this.message=`NotFoundError: ${this.message}`}}class re extends Error{statusCode;constructor(e,t){super(t),this.statusCode=e,this.message=`ClientError: ${this.message}`}}class se extends Error{constructor(e){super(e),this.message=`ServerError: ${this.message}`}}const ie=(e,t)=>{if(e==T)throw new te(t);if(e==L)throw new ne(t);if(e>T&&e<N)throw new re(e,t);if(e>=N)throw new se(t)};function oe(e,t,n,r){var s,i=arguments.length,o=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(i<3?s(o):i>3?s(t,n,o):s(t,n))||o);return i>3&&o&&Object.defineProperty(t,n,o),o}async function ae(e,t,n=P){let r=0;const s=async()=>{const i=t?await fetch(e,t):await fetch(e);if(!i.ok){if(r++,r<=n){const e=1e3*(r+O);return await new Promise((t=>setTimeout(t,e))),s()}throw new Y(i.status,`Request failed after ${n} retries`)}return i};return(await s()).json()}"function"==typeof SuppressedError&&SuppressedError;const ce=e=>{let t;if(e?.includes(x))t=A;else{const n=e?.find((e=>e.includes(S)));t=n?n.split("=")[1]:k}return t.replace(/\/$/,"")},le=e=>{const t=V.getAppConfig(p)||V.getAppConfig(m);return t?.capabilities?.includes(e)};function ue(e,t,n){const r=n.value;return n.value=function(...e){if(!this.platformID)throw new Q;return r.apply(this,e)},n}function he(e,t,n){const r=n.value;return n.value=function(...e){const t=V.getDevice();if(!t?.id)throw new Z;return r.apply(this,e)},n}class pe{static instance=new pe;baseURL;platformID;get deviceID(){return V.getDevice().id}static configure(e){this.instance.configure(e)}configure(e){this.baseURL=ce(e.namiCommands),this.platformID=e.appPlatformId}async login(e){if(!e)throw new J;const t=`device/${this.deviceID}/login/`,n={external_id:e};return await this.requestBodyAPI(t,n,"PUT")}async logout(){const e=`device/${this.deviceID}/logout/`;return await this.requestBodyAPI(e,{},"PUT")}async fetchAPI(e){const t=`${this.baseURL}/${this.platformID}/`+e;return await ae(t)}async requestBodyAPI(e,t,n="POST"){const r=`${this.baseURL}/${this.platformID}/`+e,s={method:n,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)};return await ae(r,s)}}oe([he],pe.prototype,"login",null),oe([he],pe.prototype,"logout",null),oe([ue],pe.prototype,"fetchAPI",null),oe([ue],pe.prototype,"requestBodyAPI",null);var de="object"==typeof global&&global&&global.Object===Object&&global,fe="object"==typeof self&&self&&self.Object===Object&&self,ge=de||fe||Function("return this")(),me=ge.Symbol,be=Object.prototype,ye=be.hasOwnProperty,_e=be.toString,we=me?me.toStringTag:void 0;var ve=Object.prototype.toString;var ke="[object Null]",Ae="[object Undefined]",Se=me?me.toStringTag:void 0;function xe(e){return null==e?void 0===e?Ae:ke:Se&&Se in Object(e)?function(e){var t=ye.call(e,we),n=e[we];try{e[we]=void 0;var r=!0}catch(e){}var s=_e.call(e);return r&&(t?e[we]=n:delete e[we]),s}(e):function(e){return ve.call(e)}(e)}function $e(e){return null!=e&&"object"==typeof e}var Ee="[object Symbol]";function Ie(e){return"symbol"==typeof e||$e(e)&&xe(e)==Ee}var Ce=Array.isArray,Pe=1/0,Oe=me?me.prototype:void 0,Re=Oe?Oe.toString:void 0;function Te(e){if("string"==typeof e)return e;if(Ce(e))return function(e,t){for(var n=-1,r=null==e?0:e.length,s=Array(r);++n<r;)s[n]=t(e[n],n,e);return s}(e,Te)+"";if(Ie(e))return Re?Re.call(e):"";var t=e+"";return"0"==t&&1/e==-Pe?"-0":t}function Le(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ne(e){return e}var Me="[object AsyncFunction]",De="[object Function]",ze="[object GeneratorFunction]",Ue="[object Proxy]";function Fe(e){if(!Le(e))return!1;var t=xe(e);return t==De||t==ze||t==Me||t==Ue}var je,Be=ge["__core-js_shared__"],He=(je=/[^.]+$/.exec(Be&&Be.keys&&Be.keys.IE_PROTO||""))?"Symbol(src)_1."+je:"";var We=Function.prototype.toString;function Ge(e){if(null!=e){try{return We.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var qe=/^\[object .+?Constructor\]$/,Ke=Function.prototype,Ve=Object.prototype,Ye=Ke.toString,Xe=Ve.hasOwnProperty,Qe=RegExp("^"+Ye.call(Xe).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ze(e){return!(!Le(e)||(t=e,He&&He in t))&&(Fe(e)?Qe:qe).test(Ge(e));var t}function Je(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Ze(n)?n:void 0}var et=Je(ge,"WeakMap");function tt(e){return e!=e}function nt(e,t){return!!(null==e?0:e.length)&&function(e,t,n){return t==t?function(e,t,n){for(var r=n-1,s=e.length;++r<s;)if(e[r]===t)return r;return-1}(e,t,n):function(e,t,n,r){for(var s=e.length,i=n+-1;++i<s;)if(t(e[i],i,e))return i;return-1}(e,tt,n)}(e,t,0)>-1}var rt=9007199254740991,st=/^(?:0|[1-9]\d*)$/;function it(e,t){var n=typeof e;return!!(t=null==t?rt:t)&&("number"==n||"symbol"!=n&&st.test(e))&&e>-1&&e%1==0&&e<t}function ot(e,t){return e===t||e!=e&&t!=t}var at=9007199254740991;function ct(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=at}var lt=Object.prototype;function ut(e){return $e(e)&&"[object Arguments]"==xe(e)}var ht=Object.prototype,pt=ht.hasOwnProperty,dt=ht.propertyIsEnumerable,ft=ut(function(){return arguments}())?ut:function(e){return $e(e)&&pt.call(e,"callee")&&!dt.call(e,"callee")};var gt="object"==typeof e&&e&&!e.nodeType&&e,mt=gt&&"object"==typeof module&&module&&!module.nodeType&&module,bt=mt&&mt.exports===gt?ge.Buffer:void 0,yt=(bt?bt.isBuffer:void 0)||function(){return!1},_t={};_t["[object Float32Array]"]=_t["[object Float64Array]"]=_t["[object Int8Array]"]=_t["[object Int16Array]"]=_t["[object Int32Array]"]=_t["[object Uint8Array]"]=_t["[object Uint8ClampedArray]"]=_t["[object Uint16Array]"]=_t["[object Uint32Array]"]=!0,_t["[object Arguments]"]=_t["[object Array]"]=_t["[object ArrayBuffer]"]=_t["[object Boolean]"]=_t["[object DataView]"]=_t["[object Date]"]=_t["[object Error]"]=_t["[object Function]"]=_t["[object Map]"]=_t["[object Number]"]=_t["[object Object]"]=_t["[object RegExp]"]=_t["[object Set]"]=_t["[object String]"]=_t["[object WeakMap]"]=!1;var wt,vt="object"==typeof e&&e&&!e.nodeType&&e,kt=vt&&"object"==typeof module&&module&&!module.nodeType&&module,At=kt&&kt.exports===vt&&de.process,St=function(){try{var e=kt&&kt.require&&kt.require("util").types;return e||At&&At.binding&&At.binding("util")}catch(e){}}(),xt=St&&St.isTypedArray,$t=xt?(wt=xt,function(e){return wt(e)}):function(e){return $e(e)&&ct(e.length)&&!!_t[xe(e)]},Et=Object.prototype.hasOwnProperty;function It(e,t){var n=Ce(e),r=!n&&ft(e),s=!n&&!r&&yt(e),i=!n&&!r&&!s&&$t(e),o=n||r||s||i,a=o?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],c=a.length;for(var l in e)!Et.call(e,l)||o&&("length"==l||s&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||it(l,c))||a.push(l);return a}var Ct=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),Pt=Object.prototype.hasOwnProperty;function Ot(e){if(n=(t=e)&&t.constructor,t!==("function"==typeof n&&n.prototype||lt))return Ct(e);var t,n,r=[];for(var s in Object(e))Pt.call(e,s)&&"constructor"!=s&&r.push(s);return r}function Rt(e){return null!=(t=e)&&ct(t.length)&&!Fe(t)?It(e):Ot(e);var t}var Tt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Lt=/^\w*$/;function Nt(e,t){if(Ce(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Ie(e))||(Lt.test(e)||!Tt.test(e)||null!=t&&e in Object(t))}var Mt=Je(Object,"create");var Dt=Object.prototype.hasOwnProperty;var zt=Object.prototype.hasOwnProperty;function Ut(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ft(e,t){for(var n=e.length;n--;)if(ot(e[n][0],t))return n;return-1}Ut.prototype.clear=function(){this.__data__=Mt?Mt(null):{},this.size=0},Ut.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Ut.prototype.get=function(e){var t=this.__data__;if(Mt){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Dt.call(t,e)?t[e]:void 0},Ut.prototype.has=function(e){var t=this.__data__;return Mt?void 0!==t[e]:zt.call(t,e)},Ut.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Mt&&void 0===t?"__lodash_hash_undefined__":t,this};var jt=Array.prototype.splice;function Bt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Bt.prototype.clear=function(){this.__data__=[],this.size=0},Bt.prototype.delete=function(e){var t=this.__data__,n=Ft(t,e);return!(n<0)&&(n==t.length-1?t.pop():jt.call(t,n,1),--this.size,!0)},Bt.prototype.get=function(e){var t=this.__data__,n=Ft(t,e);return n<0?void 0:t[n][1]},Bt.prototype.has=function(e){return Ft(this.__data__,e)>-1},Bt.prototype.set=function(e,t){var n=this.__data__,r=Ft(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var Ht=Je(ge,"Map");function Wt(e,t){var n,r,s=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?s["string"==typeof t?"string":"hash"]:s.map}function Gt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Gt.prototype.clear=function(){this.size=0,this.__data__={hash:new Ut,map:new(Ht||Bt),string:new Ut}},Gt.prototype.delete=function(e){var t=Wt(this,e).delete(e);return this.size-=t?1:0,t},Gt.prototype.get=function(e){return Wt(this,e).get(e)},Gt.prototype.has=function(e){return Wt(this,e).has(e)},Gt.prototype.set=function(e,t){var n=Wt(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};var qt="Expected a function";function Kt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(qt);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],i=n.cache;if(i.has(s))return i.get(s);var o=e.apply(this,r);return n.cache=i.set(s,o)||i,o};return n.cache=new(Kt.Cache||Gt),n}Kt.Cache=Gt;var Vt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Yt=/\\(\\)?/g,Xt=function(e){var t=Kt(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Vt,(function(e,n,r,s){t.push(r?s.replace(Yt,"$1"):n||e)})),t}));function Qt(e,t){return Ce(e)?e:Nt(e,t)?[e]:Xt(function(e){return null==e?"":Te(e)}(e))}var Zt=1/0;function Jt(e){if("string"==typeof e||Ie(e))return e;var t=e+"";return"0"==t&&1/e==-Zt?"-0":t}function en(e,t){for(var n=0,r=(t=Qt(t,e)).length;null!=e&&n<r;)e=e[Jt(t[n++])];return n&&n==r?e:void 0}function tn(e){var t=this.__data__=new Bt(e);this.size=t.size}tn.prototype.clear=function(){this.__data__=new Bt,this.size=0},tn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},tn.prototype.get=function(e){return this.__data__.get(e)},tn.prototype.has=function(e){return this.__data__.has(e)},tn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Bt){var r=n.__data__;if(!Ht||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Gt(r)}return n.set(e,t),this.size=n.size,this};var nn=Object.prototype.propertyIsEnumerable,rn=Object.getOwnPropertySymbols,sn=rn?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,s=0,i=[];++n<r;){var o=e[n];t(o,n,e)&&(i[s++]=o)}return i}(rn(e),(function(t){return nn.call(e,t)})))}:function(){return[]};function on(e){return function(e,t,n){var r=t(e);return Ce(e)?r:function(e,t){for(var n=-1,r=t.length,s=e.length;++n<r;)e[s+n]=t[n];return e}(r,n(e))}(e,Rt,sn)}var an=Je(ge,"DataView"),cn=Je(ge,"Promise"),ln=Je(ge,"Set"),un="[object Map]",hn="[object Promise]",pn="[object Set]",dn="[object WeakMap]",fn="[object DataView]",gn=Ge(an),mn=Ge(Ht),bn=Ge(cn),yn=Ge(ln),_n=Ge(et),wn=xe;(an&&wn(new an(new ArrayBuffer(1)))!=fn||Ht&&wn(new Ht)!=un||cn&&wn(cn.resolve())!=hn||ln&&wn(new ln)!=pn||et&&wn(new et)!=dn)&&(wn=function(e){var t=xe(e),n="[object Object]"==t?e.constructor:void 0,r=n?Ge(n):"";if(r)switch(r){case gn:return fn;case mn:return un;case bn:return hn;case yn:return pn;case _n:return dn}return t});var vn=ge.Uint8Array;function kn(e){for(var t=-1,n=null==e?0:e.length,r=0,s=[];++t<n;){var i=e[t];i&&(s[r++]=i)}return s}function An(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Gt;++t<n;)this.add(e[t])}function Sn(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function xn(e,t){return e.has(t)}An.prototype.add=An.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},An.prototype.has=function(e){return this.__data__.has(e)};var $n=1,En=2;function In(e,t,n,r,s,i){var o=n&$n,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var l=i.get(e),u=i.get(t);if(l&&u)return l==t&&u==e;var h=-1,p=!0,d=n&En?new An:void 0;for(i.set(e,t),i.set(t,e);++h<a;){var f=e[h],g=t[h];if(r)var m=o?r(g,f,h,t,e,i):r(f,g,h,e,t,i);if(void 0!==m){if(m)continue;p=!1;break}if(d){if(!Sn(t,(function(e,t){if(!xn(d,t)&&(f===e||s(f,e,n,r,i)))return d.push(t)}))){p=!1;break}}else if(f!==g&&!s(f,g,n,r,i)){p=!1;break}}return i.delete(e),i.delete(t),p}function Cn(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function Pn(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var On=1,Rn=2,Tn="[object Boolean]",Ln="[object Date]",Nn="[object Error]",Mn="[object Map]",Dn="[object Number]",zn="[object RegExp]",Un="[object Set]",Fn="[object String]",jn="[object Symbol]",Bn="[object ArrayBuffer]",Hn="[object DataView]",Wn=me?me.prototype:void 0,Gn=Wn?Wn.valueOf:void 0;var qn=1,Kn=Object.prototype.hasOwnProperty;var Vn=1,Yn="[object Arguments]",Xn="[object Array]",Qn="[object Object]",Zn=Object.prototype.hasOwnProperty;function Jn(e,t,n,r,s,i){var o=Ce(e),a=Ce(t),c=o?Xn:wn(e),l=a?Xn:wn(t),u=(c=c==Yn?Qn:c)==Qn,h=(l=l==Yn?Qn:l)==Qn,p=c==l;if(p&&yt(e)){if(!yt(t))return!1;o=!0,u=!1}if(p&&!u)return i||(i=new tn),o||$t(e)?In(e,t,n,r,s,i):function(e,t,n,r,s,i,o){switch(n){case Hn:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Bn:return!(e.byteLength!=t.byteLength||!i(new vn(e),new vn(t)));case Tn:case Ln:case Dn:return ot(+e,+t);case Nn:return e.name==t.name&&e.message==t.message;case zn:case Fn:return e==t+"";case Mn:var a=Cn;case Un:var c=r&On;if(a||(a=Pn),e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=Rn,o.set(e,t);var u=In(a(e),a(t),r,s,i,o);return o.delete(e),u;case jn:if(Gn)return Gn.call(e)==Gn.call(t)}return!1}(e,t,c,n,r,s,i);if(!(n&Vn)){var d=u&&Zn.call(e,"__wrapped__"),f=h&&Zn.call(t,"__wrapped__");if(d||f){var g=d?e.value():e,m=f?t.value():t;return i||(i=new tn),s(g,m,n,r,i)}}return!!p&&(i||(i=new tn),function(e,t,n,r,s,i){var o=n&qn,a=on(e),c=a.length;if(c!=on(t).length&&!o)return!1;for(var l=c;l--;){var u=a[l];if(!(o?u in t:Kn.call(t,u)))return!1}var h=i.get(e),p=i.get(t);if(h&&p)return h==t&&p==e;var d=!0;i.set(e,t),i.set(t,e);for(var f=o;++l<c;){var g=e[u=a[l]],m=t[u];if(r)var b=o?r(m,g,u,t,e,i):r(g,m,u,e,t,i);if(!(void 0===b?g===m||s(g,m,n,r,i):b)){d=!1;break}f||(f="constructor"==u)}if(d&&!f){var y=e.constructor,_=t.constructor;y==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof _&&_ instanceof _||(d=!1)}return i.delete(e),i.delete(t),d}(e,t,n,r,s,i))}function er(e,t,n,r,s){return e===t||(null==e||null==t||!$e(e)&&!$e(t)?e!=e&&t!=t:Jn(e,t,n,r,er,s))}var tr=1,nr=2;function rr(e){return e==e&&!Le(e)}function sr(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}function ir(e){var t=function(e){for(var t=Rt(e),n=t.length;n--;){var r=t[n],s=e[r];t[n]=[r,s,rr(s)]}return t}(e);return 1==t.length&&t[0][2]?sr(t[0][0],t[0][1]):function(n){return n===e||function(e,t,n,r){var s=n.length,i=s;if(null==e)return!i;for(e=Object(e);s--;){var o=n[s];if(o[2]?o[1]!==e[o[0]]:!(o[0]in e))return!1}for(;++s<i;){var a=(o=n[s])[0],c=e[a],l=o[1];if(o[2]){if(void 0===c&&!(a in e))return!1}else{var u=new tn;if(!er(l,c,tr|nr,r,u))return!1}}return!0}(n,0,t)}}function or(e,t){return null!=e&&t in Object(e)}function ar(e,t){return null!=e&&function(e,t,n){for(var r=-1,s=(t=Qt(t,e)).length,i=!1;++r<s;){var o=Jt(t[r]);if(!(i=null!=e&&n(e,o)))break;e=e[o]}return i||++r!=s?i:!!(s=null==e?0:e.length)&&ct(s)&&it(o,s)&&(Ce(e)||ft(e))}(e,t,or)}var cr=1,lr=2;function ur(e,t){return Nt(e)&&rr(t)?sr(Jt(e),t):function(n){var r=function(e,t,n){var r=null==e?void 0:en(e,t);return void 0===r?n:r}(n,e);return void 0===r&&r===t?ar(n,e):er(t,r,cr|lr)}}function hr(e){return Nt(e)?(t=Jt(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return en(t,e)}}(e);var t}function pr(e,t){return er(e,t)}var dr=ln&&1/Pn(new ln([,-0]))[1]==1/0?function(e){return new ln(e)}:function(){},fr=200;function gr(e,t){return e&&e.length?function(e,t,n){var r=-1,s=nt,i=e.length,o=!0,a=[],c=a;if(i>=fr){var l=t?null:dr(e);if(l)return Pn(l);o=!1,s=xn,c=new An}else c=t?[]:a;e:for(;++r<i;){var u=e[r],h=t?t(u):u;if(u=0!==u?u:0,o&&h==h){for(var p=c.length;p--;)if(c[p]===h)continue e;t&&c.push(h),a.push(u)}else s(c,h,n)||(c!==a&&c.push(h),a.push(u))}return a}(e,"function"==typeof(n=t)?n:null==n?Ne:"object"==typeof n?Ce(n)?ur(n[0],n[1]):ir(n):hr(n)):[];var n}var mr,br="object"==typeof Reflect?Reflect:null,yr=br&&"function"==typeof br.apply?br.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};mr=br&&"function"==typeof br.ownKeys?br.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var _r=Number.isNaN||function(e){return e!=e};function wr(){wr.init.call(this)}wr.EventEmitter=wr,wr.prototype._events=void 0,wr.prototype._eventsCount=0,wr.prototype._maxListeners=void 0;var vr=10;function kr(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function Ar(e){return void 0===e._maxListeners?wr.defaultMaxListeners:e._maxListeners}function Sr(e,t,n,r){var s,i,o,a;if(kr(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),o=i[t]),void 0===o)o=i[t]=n,++e._eventsCount;else if("function"==typeof o?o=i[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(s=Ar(e))>0&&o.length>s&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,a=c,console&&console.warn&&console.warn(a)}return e}function xr(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function $r(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},s=xr.bind(r);return s.listener=n,r.wrapFn=s,s}function Er(e,t,n){var r=e._events;if(void 0===r)return[];var s=r[t];return void 0===s?[]:"function"==typeof s?n?[s.listener||s]:[s]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(s):Cr(s,s.length)}function Ir(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function Cr(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}Object.defineProperty(wr,"defaultMaxListeners",{enumerable:!0,get:function(){return vr},set:function(e){if("number"!=typeof e||e<0||_r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");vr=e}}),wr.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},wr.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||_r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},wr.prototype.getMaxListeners=function(){return Ar(this)},wr.prototype.emit=function(e){var t=[];for(let e=1;e<arguments.length;e++)t.push(arguments[e]);var n="error"===e,r=this._events;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return!1;if(n){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var i=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw i.context=s,i}var o=r[e];if(void 0===o)return!1;if("function"==typeof o)yr(o,this,t);else{var a=o.length,c=Cr(o,a);for(let e=0;e<a;++e)yr(c[e],this,t)}return!0},wr.prototype.addListener=function(e,t){return Sr(this,e,t,!1)},wr.prototype.on=wr.prototype.addListener,wr.prototype.prependListener=function(e,t){return Sr(this,e,t,!0)},wr.prototype.once=function(e,t){return kr(t),this.on(e,$r(this,e,t)),this},wr.prototype.prependOnceListener=function(e,t){return kr(t),this.prependListener(e,$r(this,e,t)),this},wr.prototype.removeListener=function(e,t){var n,r,s,i,o;if(kr(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(s=-1,i=n.length-1;i>=0;i--)if(n[i]===t||n[i].listener===t){o=n[i].listener,s=i;break}if(s<0)return this;0===s?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,s),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,o||t)}return this},wr.prototype.off=wr.prototype.removeListener,wr.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var s,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(s=i[r])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},wr.prototype.listeners=function(e){return Er(this,e,!0)},wr.prototype.rawListeners=function(e){return Er(this,e,!1)},wr.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Ir.call(e,t)},wr.prototype.listenerCount=Ir,wr.prototype.eventNames=function(){return this._eventsCount>0?mr(this._events):[]};class Pr{static instance;emitter=new wr;static getInstance(){return this.instance||(this.instance=new Pr),this.instance}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}emit(e,...t){this.emitter.emit(e,...t)}addListener(e,t){this.emitter.addListener(e,t)}removeListener(e,t){this.emitter.removeListener(e,t)}listeners(e){return this.emitter.listeners(e)}listenerCount(e){return this.emitter.listenerCount(e)}}class Or extends pe{currentFormFactor;static instance;constructor(e,t){super(),super.configure(e),this.currentFormFactor=t}async fetchCampaignRules(e){const t=V.getDevice();if(!t?.id)throw new Z;const n=`device/${t.id}/campaign_rules/`;let r;try{r=await this.fetchAPI(n)}catch(e){if(r=this.fallbackData(),!r)throw K.error(ie(e.status,n)),e}let s=r.results.filter((e=>e.form_factors.some((e=>e.form_factor===this.currentFormFactor))));return s=s.filter((t=>{const n=e.find((e=>e.id==t.paywall));if(n)return t})),V.setCampaignRules(d,s),this.invokeAvailableCampaignsResponseHandler(),s}invokeAvailableCampaignsResponseHandler(e){const t=Pr.getInstance(),n=t.listeners(U);if(!e){const t=V.getCampaignRules(d)??[],n=V.getCampaignRules(b)??[];e=gr(kn([...t,...n]),"rule")}n.forEach((n=>{n(e),t.removeListener(U,n)}))}fallbackData(){const e=V.getCampaignRules(d)||V.getCampaignRules(b);return e?{count:e.length,results:e}:null}}class Rr extends pe{static instance;constructor(e){super(),super.configure(e)}async createOrUpdateDevice(e){const t=V.getDevice();return t?.id?this.isEqualDevices(t,e)?t:this.updateDevice(t.id,e):this.createDevice(e)}async createDevice(e){const t=await this.requestAPIData("device/",e);return t&&V.setDevice(t),t}async updateDevice(e,t){const n=await this.requestAPIData(`device/${e}`,t,"PUT");return n&&V.setDevice(n),n}async updateDeviceField(e,t){const n={[e]:t},r=V.getDevice();if(!r?.id)throw new Z;const s=await this.requestAPIData(`device/${r.id}`,n,"PATCH");return s&&V.setDevice(s),s}async requestAPIData(e,t,n="POST"){let r=null;try{r=await this.requestBodyAPI(e,t,n)}catch(t){if(r=V.getDevice(),!r)throw K.error(ie(t.status,e)),t}return r}isEqualDevices(e,t){const n={...e,...t},r=Object.keys(e).reduce(((e,t)=>(e[t]=n[t],e)),{});return pr(r,e)}}class Tr extends pe{static instance;constructor(e){super(),super.configure(e)}async fetchProducts(){let e;try{e=await this.fetchAPI("products/")}catch(t){if(e=this.fallbackData(),!e)throw K.error(ie(t.status,"products/")),t}return e.results&&V.setProducts(g,e.results),e.results}fallbackData(){const e=V.getProducts(g)||V.getProducts(_);return e?{count:e.length,results:e}:null}}class Lr extends pe{static instance;constructor(e){super(),super.configure(e)}async fetchPaywalls(){const e=V.getDevice();if(!e?.id)throw new Z;const t=`device/${e.id}/paywalls/`;let n;try{n=await this.fetchAPI(t)}catch(e){if(n=this.fallbackData(),!n)throw K.error(ie(e.status,t)),e}return n.results&&V.setPaywalls(f,n.results),n.results}fallbackData(){const e=V.getPaywalls(f)||V.getPaywalls(y);return e?{count:e.length,results:e}:null}}class Nr extends pe{static instance;constructor(e){super(),super.configure(e)}async fetchConfig(){let e=null;try{e=await this.fetchAPI("config/")}catch(t){if(e=V.getAppConfig(p)||V.getAppConfig(m),!e)throw K.error(ie(t.status,"config/")),t}return e&&V.setAppConfig(p,e),e}}const Mr={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},Dr={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},zr={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},Ur={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},Fr={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class jr{static getFirstMatch(e,t){const n=t.match(e);return n&&n.length>0&&n[1]||""}static getSecondMatch(e,t){const n=t.match(e);return n&&n.length>1&&n[2]||""}static matchAndReturnConst(e,t,n){if(e.test(t))return n}static getWindowsVersionName(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(e){const t=e.split(".").splice(0,2).map((e=>parseInt(e,10)||0));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(e){const t=e.split(".").splice(0,2).map((e=>parseInt(e,10)||0));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,t,n=!1){const r=jr.getVersionPrecision(e),s=jr.getVersionPrecision(t);let i=Math.max(r,s),o=0;const a=jr.map([e,t],(e=>{const t=i-jr.getVersionPrecision(e),n=e+new Array(t+1).join(".0");return jr.map(n.split("."),(e=>new Array(20-e.length).join("0")+e)).reverse()}));for(n&&(o=i-Math.min(r,s)),i-=1;i>=o;){if(a[0][i]>a[1][i])return 1;if(a[0][i]===a[1][i]){if(i===o)return 0;i-=1}else if(a[0][i]<a[1][i])return-1}}static map(e,t){const n=[];let r;if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1)n.push(t(e[r]));return n}static find(e,t){let n,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,r=e.length;n<r;n+=1){const r=e[n];if(t(r,n))return r}}static assign(e,...t){const n=e;let r,s;if(Object.assign)return Object.assign(e,...t);for(r=0,s=t.length;r<s;r+=1){const e=t[r];if("object"==typeof e&&null!==e){Object.keys(e).forEach((t=>{n[t]=e[t]}))}}return e}static getBrowserAlias(e){return Mr[e]}static getBrowserTypeByAlias(e){return Dr[e]||""}}const Br=/version\/(\d+(\.?_?\d+)+)/i,Hr=[{test:[/googlebot/i],describe(e){const t={name:"Googlebot"},n=jr.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/opera/i],describe(e){const t={name:"Opera"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe(e){const t={name:"Opera"},n=jr.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe(e){const t={name:"Samsung Internet for Android"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe(e){const t={name:"NAVER Whale Browser"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe(e){const t={name:"MZ Browser"},n=jr.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/focus/i],describe(e){const t={name:"Focus"},n=jr.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/swing/i],describe(e){const t={name:"Swing"},n=jr.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/coast/i],describe(e){const t={name:"Opera Coast"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(e){const t={name:"Opera Touch"},n=jr.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe(e){const t={name:"Yandex Browser"},n=jr.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe(e){const t={name:"UC Browser"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe(e){const t={name:"Maxthon"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe(e){const t={name:"Epiphany"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe(e){const t={name:"Puffin"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe(e){const t={name:"Sleipnir"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe(e){const t={name:"K-Meleon"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe(e){const t={name:"WeChat"},n=jr.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe(e){const t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=jr.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe(e){const t={name:"Internet Explorer"},n=jr.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe(e){const t={name:"Microsoft Edge"},n=jr.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe(e){const t={name:"Microsoft Edge"},n=jr.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe(e){const t={name:"Vivaldi"},n=jr.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe(e){const t={name:"SeaMonkey"},n=jr.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe(e){const t={name:"Sailfish"},n=jr.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe(e){const t={name:"Amazon Silk"},n=jr.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe(e){const t={name:"PhantomJS"},n=jr.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe(e){const t={name:"SlimerJS"},n=jr.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t={name:"BlackBerry"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe(e){const t={name:"WebOS Browser"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe(e){const t={name:"Bada"},n=jr.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe(e){const t={name:"Tizen"},n=jr.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe(e){const t={name:"QupZilla"},n=jr.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe(e){const t={name:"Firefox"},n=jr.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe(e){const t={name:"Electron"},n=jr.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe(e){const t={name:"Miui"},n=jr.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe(e){const t={name:"Chromium"},n=jr.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe(e){const t={name:"Chrome"},n=jr.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe(e){const t={name:"Google Search"},n=jr.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test(e){const t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe(e){const t={name:"Android Browser"},n=jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe(e){const t={name:"PlayStation 4"},n=jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe(e){const t={name:"Safari"},n=jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/.*/i],describe(e){const t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:jr.getFirstMatch(t,e),version:jr.getSecondMatch(t,e)}}}];var Wr=[{test:[/Roku\/DVP/],describe(e){const t=jr.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:Ur.Roku,version:t}}},{test:[/windows phone/i],describe(e){const t=jr.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:Ur.WindowsPhone,version:t}}},{test:[/windows /i],describe(e){const t=jr.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=jr.getWindowsVersionName(t);return{name:Ur.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(e){const t={name:Ur.iOS},n=jr.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe(e){const t=jr.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=jr.getMacOSVersionName(t),r={name:Ur.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe(e){const t=jr.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:Ur.iOS,version:t}}},{test(e){const t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe(e){const t=jr.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=jr.getAndroidVersionName(t),r={name:Ur.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe(e){const t=jr.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:Ur.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t=jr.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||jr.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||jr.getFirstMatch(/\bbb(\d+)/i,e);return{name:Ur.BlackBerry,version:t}}},{test:[/bada/i],describe(e){const t=jr.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:Ur.Bada,version:t}}},{test:[/tizen/i],describe(e){const t=jr.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:Ur.Tizen,version:t}}},{test:[/linux/i],describe:()=>({name:Ur.Linux})},{test:[/CrOS/],describe:()=>({name:Ur.ChromeOS})},{test:[/PlayStation 4/],describe(e){const t=jr.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:Ur.PlayStation4,version:t}}}],Gr=[{test:[/googlebot/i],describe:()=>({type:"bot",vendor:"Google"})},{test:[/huawei/i],describe(e){const t=jr.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:zr.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:zr.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:zr.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:zr.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:zr.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:zr.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:zr.tablet})},{test(e){const t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe(e){const t=jr.getFirstMatch(/(ipod|iphone)/i,e);return{type:zr.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:zr.mobile,vendor:"Nexus"})},{test:[/[^-]mobi/i],describe:()=>({type:zr.mobile})},{test:e=>"blackberry"===e.getBrowserName(!0),describe:()=>({type:zr.mobile,vendor:"BlackBerry"})},{test:e=>"bada"===e.getBrowserName(!0),describe:()=>({type:zr.mobile})},{test:e=>"windows phone"===e.getBrowserName(),describe:()=>({type:zr.mobile,vendor:"Microsoft"})},{test(e){const t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:()=>({type:zr.tablet})},{test:e=>"android"===e.getOSName(!0),describe:()=>({type:zr.mobile})},{test:e=>"macos"===e.getOSName(!0),describe:()=>({type:zr.desktop,vendor:"Apple"})},{test:e=>"windows"===e.getOSName(!0),describe:()=>({type:zr.desktop})},{test:e=>"linux"===e.getOSName(!0),describe:()=>({type:zr.desktop})},{test:e=>"playstation 4"===e.getOSName(!0),describe:()=>({type:zr.tv})},{test:e=>"roku"===e.getOSName(!0),describe:()=>({type:zr.tv})}],qr=[{test:e=>"microsoft edge"===e.getBrowserName(!0),describe(e){if(/\sedg\//i.test(e))return{name:Fr.Blink};const t=jr.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:Fr.EdgeHTML,version:t}}},{test:[/trident/i],describe(e){const t={name:Fr.Trident},n=jr.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:e=>e.test(/presto/i),describe(e){const t={name:Fr.Presto},n=jr.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test(e){const t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe(e){const t={name:Fr.Gecko},n=jr.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:()=>({name:Fr.Blink})},{test:[/(apple)?webkit/i],describe(e){const t={name:Fr.WebKit},n=jr.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];class Kr{constructor(e,t=!1){if(null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=jr.find(Hr,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const e=jr.find(Wr,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os}getOSName(e){const{name:t}=this.getOS();return e?String(t).toLowerCase()||"":t||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:t}=this.getPlatform();return e?String(t).toLowerCase()||"":t||""}parsePlatform(){this.parsedResult.platform={};const e=jr.find(Gr,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const e=jr.find(qr,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return jr.assign({},this.parsedResult)}satisfies(e){const t={};let n=0;const r={};let s=0;if(Object.keys(e).forEach((i=>{const o=e[i];"string"==typeof o?(r[i]=o,s+=1):"object"==typeof o&&(t[i]=o,n+=1)})),n>0){const e=Object.keys(t),n=jr.find(e,(e=>this.isOS(e)));if(n){const e=this.satisfies(t[n]);if(void 0!==e)return e}const r=jr.find(e,(e=>this.isPlatform(e)));if(r){const e=this.satisfies(t[r]);if(void 0!==e)return e}}if(s>0){const e=Object.keys(r),t=jr.find(e,(e=>this.isBrowser(e,!0)));if(void 0!==t)return this.compareVersion(r[t])}}isBrowser(e,t=!1){const n=this.getBrowserName().toLowerCase();let r=e.toLowerCase();const s=jr.getBrowserTypeByAlias(r);return t&&s&&(r=s.toLowerCase()),r===n}compareVersion(e){let t=[0],n=e,r=!1;const s=this.getBrowserVersion();if("string"==typeof s)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(jr.compareVersions(s,n,r))>-1}isOS(e){return this.getOSName(!0)===String(e).toLowerCase()}isPlatform(e){return this.getPlatformType(!0)===String(e).toLowerCase()}isEngine(e){return this.getEngineName(!0)===String(e).toLowerCase()}is(e,t=!1){return this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some((e=>this.is(e)))}}class Vr{static getParser(e,t=!1){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new Kr(e,t)}static parse(e){return new Kr(e).getResult()}static get BROWSER_MAP(){return Dr}static get ENGINE_MAP(){return Fr}static get OS_MAP(){return Ur}static get PLATFORMS_MAP(){return zr}}const Yr={tablet:"tablet",mobile:"phone",tv:"television",desktop:"desktop"},Xr=e=>{const t=Vr.getParser(window.navigator.userAgent),n=t.getPlatform(),r={os_version:t.getOSVersion()||null,os_name:t.getOSName()||null,browser_name:t.getBrowserName()||null,browser_version:t.getBrowserVersion()||null,sdk_client:"web",sdk_version:"3.2.0",language:window.navigator.language};if(n.type&&(r.form_factor=Yr[n.type]),n.model&&(r.device_model=n.model),e&&e.length>0){const t=(e=>{const t=e?.find((e=>e.includes($)));if(!e||!t)return null;const n=t.split(E);return{platform:n[1],version:n[2]}})(e);r.extended_platform=t?.platform||null,r.extended_platform_version=t?.version||null}return r};class Qr{static instance=new Qr;async init(e){this.storeInitialValues(e),await this.initAndFetchRequiredData(e)}storeInitialValues(e){V.setNamiConfig(e);const t=e.initialConfig;t?.campaign_rules&&V.setCampaignRules(b,t.campaign_rules),t?.appConfig&&V.setAppConfig(m,t.appConfig),t?.paywalls&&V.setPaywalls(y,t.paywalls),t?.products&&V.setProducts(_,t.products)}async initAndFetchRequiredData(e){const t=new Rr(e),n=Xr(e.namiCommands),r=await t.createOrUpdateDevice(n),s=e.formFactor??r.form_factor;Or.instance=new Or(e,s),Lr.instance=new Lr(e),Tr.instance=new Tr(e),Nr.instance=new Nr(e),Rr.instance=t,await Promise.all([Nr.instance.fetchConfig(),Tr.instance.fetchProducts(),Lr.instance.fetchPaywalls().then((e=>Or.instance.fetchCampaignRules(e)))])}}class Zr{static instance=new Zr;#e=!1;get isInitialized(){return this.#e}static async configure(e){if(!e.appPlatformId)throw new Q;return await Zr.instance.initializeSDK(e)}async initializeSDK(e){let t=!1,n=!1;const r=this.#e?V.getNamiConfig():null;if(K.setLogger(e.logLevel),null!==r){if(pr(e,r))return K.warn("Nami SDK is already configured, ignoring this configure call."),{sdkInitialized:!0,configureState:z};n=!0;const s=ce(e.namiCommands),i=ce(r.namiCommands);e.appPlatformId==r.appPlatformId&&s==i||(t=!0),e.languageCode===r.languageCode&&e.logLevel==r.logLevel||(n=!0)}t&&(K.info("SDK full reconfigure called"),V.resetDevice()),this.#e=!0,pe.configure(e),await Qr.instance.init(e),K.info("SDK successfully initialized!");return{sdkInitialized:!0,configureState:n||t?D:M}}}var Jr,es;!function(e){e.REGISTER_BUY_SKU="RegisterBuySKU",e.PAYWALL_CLOSE_REQUESTED="PaywallCloseRequested",e.PAYWALL_SIGNIN_REQUESTED="PaywallSignInRequested",e.PAYWALL_RESTORE_REQUESTED="PaywallRestoreRequested",e.PAYWALL_DEEPLINK_ACTION="PaywallDeeplinkAction"}(Jr||(Jr={})),e.NamiPaywallAction=void 0,(es=e.NamiPaywallAction||(e.NamiPaywallAction={})).BUY_SKU="BUY_SKU",es.SELECT_SKU="SELECT_SKU",es.RESTORE_PURCHASES="RESTORE_PURCHASES",es.SIGN_IN="SIGN_IN",es.CLOSE_PAYWALL="CLOSE_PAYWALL",es.SHOW_PAYWALL="SHOW_PAYWALL",es.PURCHASE_SELECTED_SKU="PURCHASE_SELECTED_SKU",es.PURCHASE_SUCCESS="PURCHASE_SUCCESS",es.PURCHASE_FAILED="PURCHASE_FAILED",es.PURCHASE_CANCELLED="PURCHASE_CANCELLED",es.PURCHASE_PENDING="PURCHASE_PENDING",es.PURCHASE_UNKNOWN="PURCHASE_UNKNOWN",es.PURCHASE_DEFERRED="PURCHASE_DEFERRED";class ts{static instance=new ts;emitter=Pr.getInstance();productDetails;static allPaywalls(){if(!this.instance.sdkInitialized)throw new X;return gr(kn([...V.getPaywalls(f)??[],...V.getPaywalls(y)??[]]),"id")}static setProductDetails(e){this.instance.productDetails=e}static registerSignInHandler(e){return this.instance.emitter.addListener(Jr.PAYWALL_SIGNIN_REQUESTED,e),()=>{this.instance.emitter.removeListener(Jr.PAYWALL_SIGNIN_REQUESTED,e)}}static registerCloseHandler(e){return this.instance.emitter.addListener(Jr.PAYWALL_CLOSE_REQUESTED,e),()=>{this.instance.emitter.removeListener(Jr.PAYWALL_CLOSE_REQUESTED,e)}}static registerDeeplinkActionHandler(e){return this.instance.emitter.addListener(Jr.PAYWALL_DEEPLINK_ACTION,e),()=>{this.instance.emitter.removeListener(Jr.PAYWALL_DEEPLINK_ACTION,e)}}static registerBuySkuHandler(e){return this.instance.emitter.addListener(Jr.REGISTER_BUY_SKU,e),()=>{this.instance.emitter.removeListener(Jr.REGISTER_BUY_SKU,e)}}static registerRestoreHandler(e){return this.instance.emitter.addListener(Jr.PAYWALL_RESTORE_REQUESTED,e),()=>{this.instance.emitter.removeListener(Jr.PAYWALL_RESTORE_REQUESTED,e)}}static buySkuComplete(){K.info("TODO: Implement buySkuComplete")}static buySkuCancel(){K.info("TODO: Implement buySkuCancel")}get sdkInitialized(){return Zr.instance.isInitialized}getProductDetails(e){return(this.productDetails??[]).find((t=>t.name===e))}}const ns=globalThis,rs=ns.ShadowRoot&&(void 0===ns.ShadyCSS||ns.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ss=Symbol(),is=new WeakMap;let os=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==ss)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(rs&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=is.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&is.set(t,e))}return e}toString(){return this.cssText}};const as=e=>new os("string"==typeof e?e:e+"",void 0,ss),cs=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[r+1]),e[0]);return new os(n,e,ss)},ls=(e,t)=>{if(rs)e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of t){const t=document.createElement("style"),r=ns.litNonce;void 0!==r&&t.setAttribute("nonce",r),t.textContent=n.cssText,e.appendChild(t)}},us=rs?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return as(t)})(e):e,{is:hs,defineProperty:ps,getOwnPropertyDescriptor:ds,getOwnPropertyNames:fs,getOwnPropertySymbols:gs,getPrototypeOf:ms}=Object,bs=globalThis,ys=bs.trustedTypes,_s=ys?ys.emptyScript:"",ws=bs.reactiveElementPolyfillSupport,vs=(e,t)=>e,ks={toAttribute(e,t){switch(t){case Boolean:e=e?_s:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},As=(e,t)=>!hs(e,t),Ss={attribute:!0,type:String,converter:ks,reflect:!1,hasChanged:As};Symbol.metadata??=Symbol("metadata"),bs.litPropertyMetadata??=new WeakMap;class xs extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ss){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),r=this.getPropertyDescriptor(e,n,t);void 0!==r&&ps(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){const{get:r,set:s}=ds(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return r?.call(this)},set(t){const i=r?.call(this);s.call(this,t),this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ss}static _$Ei(){if(this.hasOwnProperty(vs("elementProperties")))return;const e=ms(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(vs("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(vs("properties"))){const e=this.properties,t=[...fs(e),...gs(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(us(e))}else void 0!==e&&t.push(us(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ls(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){const n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(void 0!==r&&!0===n.reflect){const s=(void 0!==n.converter?.toAttribute?n.converter:ks).toAttribute(t,n.type);this._$Em=e,null==s?this.removeAttribute(r):this.setAttribute(r,s),this._$Em=null}}_$AK(e,t){const n=this.constructor,r=n._$Eh.get(e);if(void 0!==r&&this._$Em!==r){const e=n.getPropertyOptions(r),s="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:ks;this._$Em=r,this[r]=s.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){if(n??=this.constructor.getPropertyOptions(e),!(n.hasChanged??As)(this[e],t))return;this.P(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e)!0!==n.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],n)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(e){}firstUpdated(e){}}xs.elementStyles=[],xs.shadowRootOptions={mode:"open"},xs[vs("elementProperties")]=new Map,xs[vs("finalized")]=new Map,ws?.({ReactiveElement:xs}),(bs.reactiveElementVersions??=[]).push("2.0.4");const $s=globalThis,Es=$s.trustedTypes,Is=Es?Es.createPolicy("lit-html",{createHTML:e=>e}):void 0,Cs="$lit$",Ps=`lit$${Math.random().toFixed(9).slice(2)}$`,Os="?"+Ps,Rs=`<${Os}>`,Ts=document,Ls=()=>Ts.createComment(""),Ns=e=>null===e||"object"!=typeof e&&"function"!=typeof e,Ms=Array.isArray,Ds="[ \t\n\f\r]",zs=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Us=/-->/g,Fs=/>/g,js=RegExp(`>|${Ds}(?:([^\\s"'>=/]+)(${Ds}*=${Ds}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Bs=/'/g,Hs=/"/g,Ws=/^(?:script|style|textarea|title)$/i,Gs=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),qs=Symbol.for("lit-noChange"),Ks=Symbol.for("lit-nothing"),Vs=new WeakMap,Ys=Ts.createTreeWalker(Ts,129);function Xs(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==Is?Is.createHTML(t):t}const Qs=(e,t)=>{const n=e.length-1,r=[];let s,i=2===t?"<svg>":"",o=zs;for(let t=0;t<n;t++){const n=e[t];let a,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),null!==c);)u=o.lastIndex,o===zs?"!--"===c[1]?o=Us:void 0!==c[1]?o=Fs:void 0!==c[2]?(Ws.test(c[2])&&(s=RegExp("</"+c[2],"g")),o=js):void 0!==c[3]&&(o=js):o===js?">"===c[0]?(o=s??zs,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,a=c[1],o=void 0===c[3]?js:'"'===c[3]?Hs:Bs):o===Hs||o===Bs?o=js:o===Us||o===Fs?o=zs:(o=js,s=void 0);const h=o===js&&e[t+1].startsWith("/>")?" ":"";i+=o===zs?n+Rs:l>=0?(r.push(a),n.slice(0,l)+Cs+n.slice(l)+Ps+h):n+Ps+(-2===l?t:h)}return[Xs(e,i+(e[n]||"<?>")+(2===t?"</svg>":"")),r]};class Zs{constructor({strings:e,_$litType$:t},n){let r;this.parts=[];let s=0,i=0;const o=e.length-1,a=this.parts,[c,l]=Qs(e,t);if(this.el=Zs.createElement(c,n),Ys.currentNode=this.el.content,2===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(r=Ys.nextNode())&&a.length<o;){if(1===r.nodeType){if(r.hasAttributes())for(const e of r.getAttributeNames())if(e.endsWith(Cs)){const t=l[i++],n=r.getAttribute(e).split(Ps),o=/([.?@])?(.*)/.exec(t);a.push({type:1,index:s,name:o[2],strings:n,ctor:"."===o[1]?ri:"?"===o[1]?si:"@"===o[1]?ii:ni}),r.removeAttribute(e)}else e.startsWith(Ps)&&(a.push({type:6,index:s}),r.removeAttribute(e));if(Ws.test(r.tagName)){const e=r.textContent.split(Ps),t=e.length-1;if(t>0){r.textContent=Es?Es.emptyScript:"";for(let n=0;n<t;n++)r.append(e[n],Ls()),Ys.nextNode(),a.push({type:2,index:++s});r.append(e[t],Ls())}}}else if(8===r.nodeType)if(r.data===Os)a.push({type:2,index:s});else{let e=-1;for(;-1!==(e=r.data.indexOf(Ps,e+1));)a.push({type:7,index:s}),e+=Ps.length-1}s++}}static createElement(e,t){const n=Ts.createElement("template");return n.innerHTML=e,n}}function Js(e,t,n=e,r){if(t===qs)return t;let s=void 0!==r?n._$Co?.[r]:n._$Cl;const i=Ns(t)?void 0:t._$litDirective$;return s?.constructor!==i&&(s?._$AO?.(!1),void 0===i?s=void 0:(s=new i(e),s._$AT(e,n,r)),void 0!==r?(n._$Co??=[])[r]=s:n._$Cl=s),void 0!==s&&(t=Js(e,s._$AS(e,t.values),s,r)),t}class ei{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??Ts).importNode(t,!0);Ys.currentNode=r;let s=Ys.nextNode(),i=0,o=0,a=n[0];for(;void 0!==a;){if(i===a.index){let t;2===a.type?t=new ti(s,s.nextSibling,this,e):1===a.type?t=new a.ctor(s,a.name,a.strings,this,e):6===a.type&&(t=new oi(s,this,e)),this._$AV.push(t),a=n[++o]}i!==a?.index&&(s=Ys.nextNode(),i++)}return Ys.currentNode=Ts,r}p(e){let t=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class ti{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=Ks,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Js(this,e,t),Ns(e)?e===Ks||null==e||""===e?(this._$AH!==Ks&&this._$AR(),this._$AH=Ks):e!==this._$AH&&e!==qs&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>Ms(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==Ks&&Ns(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ts.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,r="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=Zs.createElement(Xs(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{const e=new ei(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Vs.get(e.strings);return void 0===t&&Vs.set(e.strings,t=new Zs(e)),t}k(e){Ms(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,r=0;for(const s of e)r===t.length?t.push(n=new ti(this.S(Ls()),this.S(Ls()),this,this.options)):n=t[r],n._$AI(s),r++;r<t.length&&(this._$AR(n&&n._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class ni{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,s){this.type=1,this._$AH=Ks,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=s,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Ks}_$AI(e,t=this,n,r){const s=this.strings;let i=!1;if(void 0===s)e=Js(this,e,t,0),i=!Ns(e)||e!==this._$AH&&e!==qs,i&&(this._$AH=e);else{const r=e;let o,a;for(e=s[0],o=0;o<s.length-1;o++)a=Js(this,r[n+o],t,o),a===qs&&(a=this._$AH[o]),i||=!Ns(a)||a!==this._$AH[o],a===Ks?e=Ks:e!==Ks&&(e+=(a??"")+s[o+1]),this._$AH[o]=a}i&&!r&&this.j(e)}j(e){e===Ks?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class ri extends ni{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Ks?void 0:e}}class si extends ni{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Ks)}}class ii extends ni{constructor(e,t,n,r,s){super(e,t,n,r,s),this.type=5}_$AI(e,t=this){if((e=Js(this,e,t,0)??Ks)===qs)return;const n=this._$AH,r=e===Ks&&n!==Ks||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==Ks&&(n===Ks||r);r&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class oi{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Js(this,e)}}const ai=$s.litHtmlPolyfillSupport;ai?.(Zs,ti),($s.litHtmlVersions??=[]).push("3.1.3");class ci extends xs{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,n)=>{const r=n?.renderBefore??t;let s=r._$litPart$;if(void 0===s){const e=n?.renderBefore??null;r._$litPart$=s=new ti(t.insertBefore(Ls(),e),e,void 0,n??{})}return s._$AI(e),s})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return qs}}ci._$litElement$=!0,ci.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:ci});const li=globalThis.litElementPolyfillSupport;li?.({LitElement:ci}),(globalThis.litElementVersions??=[]).push("4.0.5");const ui=cs`
1
+ !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";const{PRODUCTION:t="production",DEVELOPMENT:n="development",PLATFORM_ID_REQUIRED:r="Platform ID is required",DEVICE_ID_REQUIRED:s="Device ID is required",EXTERNAL_ID_REQUIRED:i="External ID is required",SDK_NOT_INITIALIZED:o="SDK has not been initialized. Make sure to call Nami.configure() first!",CAMPAIGN_NOT_AVAILABLE:a="Campaign is not available",UNABLE_TO_UPDATE_CDP_ID:c="Unable to update CDP id in anonymous mode",AUTH_DEVICE:l="nami_auth_device",NAMI_CONFIGURATION:u="nami_configuration",NAMI_PROFILE:h="nami_profile",API_CONFIG:p="api_config",API_CAMPAIGN_RULES:d="api_campaign_rules",API_PAYWALLS:f="api_paywalls",API_PRODUCTS:g="api_products",INITIAL_APP_CONFIG:m="initial_app_config",INITIAL_CAMPAIGN_RULES:b="initial_campaign_rules",INITIAL_PAYWALLS:y="initial_paywalls",INITIAL_PRODUCTS:_="initial_products",CUSTOMER_ATTRIBUTES_KEY_PREFIX:v="nami_cmr_attributes_",ANONYMOUS_MODE:w="nami_anonymous_mode",BASE_URL:k="https://app.namiml.com/sdk/v3/platform",BASE_STAGING_URL:A="https://app-staging.namiml.com/sdk/v3/platform",CUSTOM_HOST_PREFIX:S="namiAPIHost=",USE_STAGING_API:x="useStagingAPI",EXTENDED_CLIENT_INFO_PREFIX:$="extendedClientInfo",EXTENDED_CLIENT_INFO_DELIMITER:E=":",EXTENDED_PLATFORM:C="extended-platform",EXTENDED_PLATFORM_VERSION:I="extended-platform-version",API_MAX_CALLS_LIMIT:P=2,API_RETRY_DELAY_SEC:M=2,STATUS_SUCCESS:O=200,STATUS_BAD_REQUEST:R=400,STATUS_NOT_FOUND:L=404,STATUS_INTERNAL_SERVER_ERROR:T=500,INITIAL_SUCCESS:z="Initial success",RECONFIG_SUCCESS:N="Reconfig success",ALREADY_CONFIGURED:D="Already configured",AVAILABLE_CAMPAIGNS_CHANGED:U="AvailableCampaignsChanged",PAYWALL_ACTION_EVENT:F="PaywallActionEvent",SKU_TEXT_REGEX:j=/\$\{sku\.(\w+)(:\d+)?\}/g,VAR_REGEX:B=/\$\{\s*(\w+(\.[a-zA-Z\d_:${}-]{0,99})*?)\s*}/g,CORS_PROXY_URL:H="https://hosted-content-staging.namiml.com",CORS_PROXY_URL_LOCAL:X="http://localhost:8001"}={};var V;!function(e){e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR"}(V||(V={}));const W={debug:V.DEBUG,info:V.INFO,warn:V.WARN,error:V.ERROR};const q=new class{currentLogLevel;setLogger=e=>{this.currentLogLevel=W[e]||V.WARN};debug(e,...t){this.shouldLog(V.DEBUG)&&console.debug(this.formatMessage(V.DEBUG,e,...t))}info(e,...t){this.shouldLog(V.INFO)&&console.info(this.formatMessage(V.INFO,e,...t))}warn(e,...t){this.shouldLog(V.WARN)&&console.warn(this.formatMessage(V.WARN,e,...t))}error(e,...t){this.shouldLog(V.ERROR)&&console.error(this.formatMessage(V.ERROR,e,...t))}shouldLog(e){return e>=this.currentLogLevel}formatMessage(e,t,...n){const r=V[e];return`[${(new Date).toISOString()}] [${r}] ${t} ${n=n.map((e=>"object"==typeof e?JSON.stringify(e):e))}`}};const G=new class{setDevice(e){this.setItem(l,e)}getDevice(){return this.getItem(l)}getAnonymousMode(){return this.getItem(w)}resetDevice(){this.resetItem(l)}setAppConfig(e,t){this.setItem(e,t)}getAppConfig(e){return this.getItem(e)}setCampaignRules(e,t){this.setItem(e,t)}getCampaignRules(e){return this.getItem(e)}setPaywalls(e,t){this.setItem(e,t)}getPaywalls(e){return this.getItem(e)}setProducts(e,t){this.setItem(e,t)}getProducts(e){return this.getItem(e)}setNamiConfig(e){this.setItem(u,e)}getNamiConfig(){return this.getItem(u)}setCustomerAttribute(e,t){this.setItem(v+e,t)}getCustomerAttribute(e){return this.getItem(v+e)}getAllCustomerAttributes(){return Object.keys(localStorage).filter((e=>e.includes(v))).map((e=>e.replace(v,"")))}clearCustomerAttribute(e){const t=v+e,n=this.getItem(t);return n&&this.resetItem(t),!!n}clearAllCustomerAttributes(){Object.keys(localStorage).filter((e=>e.includes(v))).map((e=>this.resetItem(e)))}setNamiProfile(e){this.setItem(h,e)}getNamiProfile(){return this.getItem(h)}removeNamiProfile(){this.resetItem(h)}setItem(e,t){try{const n=JSON.stringify(t);localStorage.setItem(e,n)}catch(e){q.error("Error setting item in localStorage:",e)}}getItem(e){try{const t=localStorage.getItem(e);return t?JSON.parse(t):null}catch(t){return q.error("Error getting item from localStorage:",e,": ",t),null}}resetItem(e){try{localStorage.removeItem(e)}catch(e){q.error("Error removing item from localStorage:",e)}}clear(){try{localStorage.clear()}catch(e){q.error("Error clearing localStorage:",e)}}};class K extends Error{statusCode;status;constructor(e,t){super(t),this.statusCode=e,this.status=e,this.message=`RetryLimitExceededError: ${this.message}`}}class Y extends Error{constructor(){super(o)}}class Q extends Error{constructor(){super(r)}}class Z extends Error{constructor(){super(s)}}class J extends Error{constructor(){super(i)}}class ee extends Error{constructor(){super(a)}}class te extends Error{constructor(e){super(e),this.message=`BadRequestError: ${this.message}`}}class ne extends Error{constructor(e){super(e),this.message=`NotFoundError: ${this.message}`}}class re extends Error{statusCode;constructor(e,t){super(t),this.statusCode=e,this.message=`ClientError: ${this.message}`}}class se extends Error{constructor(e){super(e),this.message=`ServerError: ${this.message}`}}const ie=(e,t)=>{if(e==R)throw new te(t);if(e==L)throw new ne(t);if(e>R&&e<T)throw new re(e,t);if(e>=T)throw new se(t)};function oe(e,t,n,r){var s,i=arguments.length,o=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(i<3?s(o):i>3?s(t,n,o):s(t,n))||o);return i>3&&o&&Object.defineProperty(t,n,o),o}async function ae(e,t,n=P){let r=0;const s=async()=>{const i=t?await fetch(e,t):await fetch(e);if(!i.ok){if(r++,r<=n){const e=1e3*(r+M);return await new Promise((t=>setTimeout(t,e))),s()}throw new K(i.status,`Request failed after ${n} retries`)}return i};return(await s()).json()}"function"==typeof SuppressedError&&SuppressedError;const ce=e=>{let t;if(e?.includes(x))t=A;else{const n=e?.find((e=>e.includes(S)));t=n?n.split("=")[1]:k}return t.replace(/\/$/,"")},le=e=>{const t=G.getAppConfig(p)||G.getAppConfig(m);return t?.capabilities?.includes(e)};function ue(e,t,n){const r=n.value;return n.value=function(...e){if(!this.platformID)throw new Q;return r.apply(this,e)},n}function he(e,t,n){const r=n.value;return n.value=function(...e){const t=G.getDevice();if(!t?.id)throw new Z;return r.apply(this,e)},n}class pe{static instance=new pe;baseURL;platformID;get deviceID(){return G.getDevice().id}static configure(e){this.instance.configure(e)}configure(e){this.baseURL=ce(e.namiCommands),this.platformID=e.appPlatformId}async login(e){if(!e)throw new J;const t=`device/${this.deviceID}/login/`,n={external_id:e};return await this.requestBodyAPI(t,n,"PUT")}async logout(){const e=`device/${this.deviceID}/logout/`;return await this.requestBodyAPI(e,{},"PUT")}async fetchAPI(e){const t=`${this.baseURL}/${this.platformID}/`+e;return await ae(t)}async requestBodyAPI(e,t,n="POST"){const r=`${this.baseURL}/${this.platformID}/`+e,s={method:n,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)};return await ae(r,s)}}oe([he],pe.prototype,"login",null),oe([he],pe.prototype,"logout",null),oe([ue],pe.prototype,"fetchAPI",null),oe([ue],pe.prototype,"requestBodyAPI",null);var de="object"==typeof global&&global&&global.Object===Object&&global,fe="object"==typeof self&&self&&self.Object===Object&&self,ge=de||fe||Function("return this")(),me=ge.Symbol,be=Object.prototype,ye=be.hasOwnProperty,_e=be.toString,ve=me?me.toStringTag:void 0;var we=Object.prototype.toString;var ke="[object Null]",Ae="[object Undefined]",Se=me?me.toStringTag:void 0;function xe(e){return null==e?void 0===e?Ae:ke:Se&&Se in Object(e)?function(e){var t=ye.call(e,ve),n=e[ve];try{e[ve]=void 0;var r=!0}catch(e){}var s=_e.call(e);return r&&(t?e[ve]=n:delete e[ve]),s}(e):function(e){return we.call(e)}(e)}function $e(e){return null!=e&&"object"==typeof e}var Ee="[object Symbol]";function Ce(e){return"symbol"==typeof e||$e(e)&&xe(e)==Ee}var Ie=Array.isArray,Pe=1/0,Me=me?me.prototype:void 0,Oe=Me?Me.toString:void 0;function Re(e){if("string"==typeof e)return e;if(Ie(e))return function(e,t){for(var n=-1,r=null==e?0:e.length,s=Array(r);++n<r;)s[n]=t(e[n],n,e);return s}(e,Re)+"";if(Ce(e))return Oe?Oe.call(e):"";var t=e+"";return"0"==t&&1/e==-Pe?"-0":t}function Le(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Te(e){return e}var ze="[object AsyncFunction]",Ne="[object Function]",De="[object GeneratorFunction]",Ue="[object Proxy]";function Fe(e){if(!Le(e))return!1;var t=xe(e);return t==Ne||t==De||t==ze||t==Ue}var je,Be=ge["__core-js_shared__"],He=(je=/[^.]+$/.exec(Be&&Be.keys&&Be.keys.IE_PROTO||""))?"Symbol(src)_1."+je:"";var Xe=Function.prototype.toString;function Ve(e){if(null!=e){try{return Xe.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var We=/^\[object .+?Constructor\]$/,qe=Function.prototype,Ge=Object.prototype,Ke=qe.toString,Ye=Ge.hasOwnProperty,Qe=RegExp("^"+Ke.call(Ye).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ze(e){return!(!Le(e)||(t=e,He&&He in t))&&(Fe(e)?Qe:We).test(Ve(e));var t}function Je(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Ze(n)?n:void 0}var et=Je(ge,"WeakMap");function tt(e){return e!=e}function nt(e,t){return!!(null==e?0:e.length)&&function(e,t,n){return t==t?function(e,t,n){for(var r=n-1,s=e.length;++r<s;)if(e[r]===t)return r;return-1}(e,t,n):function(e,t,n,r){for(var s=e.length,i=n+-1;++i<s;)if(t(e[i],i,e))return i;return-1}(e,tt,n)}(e,t,0)>-1}var rt=9007199254740991,st=/^(?:0|[1-9]\d*)$/;function it(e,t){var n=typeof e;return!!(t=null==t?rt:t)&&("number"==n||"symbol"!=n&&st.test(e))&&e>-1&&e%1==0&&e<t}function ot(e,t){return e===t||e!=e&&t!=t}var at=9007199254740991;function ct(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=at}var lt=Object.prototype;function ut(e){return $e(e)&&"[object Arguments]"==xe(e)}var ht=Object.prototype,pt=ht.hasOwnProperty,dt=ht.propertyIsEnumerable,ft=ut(function(){return arguments}())?ut:function(e){return $e(e)&&pt.call(e,"callee")&&!dt.call(e,"callee")};var gt="object"==typeof e&&e&&!e.nodeType&&e,mt=gt&&"object"==typeof module&&module&&!module.nodeType&&module,bt=mt&&mt.exports===gt?ge.Buffer:void 0,yt=(bt?bt.isBuffer:void 0)||function(){return!1},_t={};_t["[object Float32Array]"]=_t["[object Float64Array]"]=_t["[object Int8Array]"]=_t["[object Int16Array]"]=_t["[object Int32Array]"]=_t["[object Uint8Array]"]=_t["[object Uint8ClampedArray]"]=_t["[object Uint16Array]"]=_t["[object Uint32Array]"]=!0,_t["[object Arguments]"]=_t["[object Array]"]=_t["[object ArrayBuffer]"]=_t["[object Boolean]"]=_t["[object DataView]"]=_t["[object Date]"]=_t["[object Error]"]=_t["[object Function]"]=_t["[object Map]"]=_t["[object Number]"]=_t["[object Object]"]=_t["[object RegExp]"]=_t["[object Set]"]=_t["[object String]"]=_t["[object WeakMap]"]=!1;var vt,wt="object"==typeof e&&e&&!e.nodeType&&e,kt=wt&&"object"==typeof module&&module&&!module.nodeType&&module,At=kt&&kt.exports===wt&&de.process,St=function(){try{var e=kt&&kt.require&&kt.require("util").types;return e||At&&At.binding&&At.binding("util")}catch(e){}}(),xt=St&&St.isTypedArray,$t=xt?(vt=xt,function(e){return vt(e)}):function(e){return $e(e)&&ct(e.length)&&!!_t[xe(e)]},Et=Object.prototype.hasOwnProperty;function Ct(e,t){var n=Ie(e),r=!n&&ft(e),s=!n&&!r&&yt(e),i=!n&&!r&&!s&&$t(e),o=n||r||s||i,a=o?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],c=a.length;for(var l in e)!Et.call(e,l)||o&&("length"==l||s&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||it(l,c))||a.push(l);return a}var It=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),Pt=Object.prototype.hasOwnProperty;function Mt(e){if(n=(t=e)&&t.constructor,t!==("function"==typeof n&&n.prototype||lt))return It(e);var t,n,r=[];for(var s in Object(e))Pt.call(e,s)&&"constructor"!=s&&r.push(s);return r}function Ot(e){return null!=(t=e)&&ct(t.length)&&!Fe(t)?Ct(e):Mt(e);var t}var Rt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Lt=/^\w*$/;function Tt(e,t){if(Ie(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!Ce(e))||(Lt.test(e)||!Rt.test(e)||null!=t&&e in Object(t))}var zt=Je(Object,"create");var Nt=Object.prototype.hasOwnProperty;var Dt=Object.prototype.hasOwnProperty;function Ut(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ft(e,t){for(var n=e.length;n--;)if(ot(e[n][0],t))return n;return-1}Ut.prototype.clear=function(){this.__data__=zt?zt(null):{},this.size=0},Ut.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Ut.prototype.get=function(e){var t=this.__data__;if(zt){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Nt.call(t,e)?t[e]:void 0},Ut.prototype.has=function(e){var t=this.__data__;return zt?void 0!==t[e]:Dt.call(t,e)},Ut.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=zt&&void 0===t?"__lodash_hash_undefined__":t,this};var jt=Array.prototype.splice;function Bt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Bt.prototype.clear=function(){this.__data__=[],this.size=0},Bt.prototype.delete=function(e){var t=this.__data__,n=Ft(t,e);return!(n<0)&&(n==t.length-1?t.pop():jt.call(t,n,1),--this.size,!0)},Bt.prototype.get=function(e){var t=this.__data__,n=Ft(t,e);return n<0?void 0:t[n][1]},Bt.prototype.has=function(e){return Ft(this.__data__,e)>-1},Bt.prototype.set=function(e,t){var n=this.__data__,r=Ft(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var Ht=Je(ge,"Map");function Xt(e,t){var n,r,s=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?s["string"==typeof t?"string":"hash"]:s.map}function Vt(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Vt.prototype.clear=function(){this.size=0,this.__data__={hash:new Ut,map:new(Ht||Bt),string:new Ut}},Vt.prototype.delete=function(e){var t=Xt(this,e).delete(e);return this.size-=t?1:0,t},Vt.prototype.get=function(e){return Xt(this,e).get(e)},Vt.prototype.has=function(e){return Xt(this,e).has(e)},Vt.prototype.set=function(e,t){var n=Xt(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};var Wt="Expected a function";function qt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(Wt);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],i=n.cache;if(i.has(s))return i.get(s);var o=e.apply(this,r);return n.cache=i.set(s,o)||i,o};return n.cache=new(qt.Cache||Vt),n}qt.Cache=Vt;var Gt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Kt=/\\(\\)?/g,Yt=function(e){var t=qt(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Gt,(function(e,n,r,s){t.push(r?s.replace(Kt,"$1"):n||e)})),t}));function Qt(e,t){return Ie(e)?e:Tt(e,t)?[e]:Yt(function(e){return null==e?"":Re(e)}(e))}var Zt=1/0;function Jt(e){if("string"==typeof e||Ce(e))return e;var t=e+"";return"0"==t&&1/e==-Zt?"-0":t}function en(e,t){for(var n=0,r=(t=Qt(t,e)).length;null!=e&&n<r;)e=e[Jt(t[n++])];return n&&n==r?e:void 0}function tn(e){var t=this.__data__=new Bt(e);this.size=t.size}tn.prototype.clear=function(){this.__data__=new Bt,this.size=0},tn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},tn.prototype.get=function(e){return this.__data__.get(e)},tn.prototype.has=function(e){return this.__data__.has(e)},tn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Bt){var r=n.__data__;if(!Ht||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Vt(r)}return n.set(e,t),this.size=n.size,this};var nn=Object.prototype.propertyIsEnumerable,rn=Object.getOwnPropertySymbols,sn=rn?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,s=0,i=[];++n<r;){var o=e[n];t(o,n,e)&&(i[s++]=o)}return i}(rn(e),(function(t){return nn.call(e,t)})))}:function(){return[]};function on(e){return function(e,t,n){var r=t(e);return Ie(e)?r:function(e,t){for(var n=-1,r=t.length,s=e.length;++n<r;)e[s+n]=t[n];return e}(r,n(e))}(e,Ot,sn)}var an=Je(ge,"DataView"),cn=Je(ge,"Promise"),ln=Je(ge,"Set"),un="[object Map]",hn="[object Promise]",pn="[object Set]",dn="[object WeakMap]",fn="[object DataView]",gn=Ve(an),mn=Ve(Ht),bn=Ve(cn),yn=Ve(ln),_n=Ve(et),vn=xe;(an&&vn(new an(new ArrayBuffer(1)))!=fn||Ht&&vn(new Ht)!=un||cn&&vn(cn.resolve())!=hn||ln&&vn(new ln)!=pn||et&&vn(new et)!=dn)&&(vn=function(e){var t=xe(e),n="[object Object]"==t?e.constructor:void 0,r=n?Ve(n):"";if(r)switch(r){case gn:return fn;case mn:return un;case bn:return hn;case yn:return pn;case _n:return dn}return t});var wn=ge.Uint8Array;function kn(e){for(var t=-1,n=null==e?0:e.length,r=0,s=[];++t<n;){var i=e[t];i&&(s[r++]=i)}return s}function An(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Vt;++t<n;)this.add(e[t])}function Sn(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function xn(e,t){return e.has(t)}An.prototype.add=An.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},An.prototype.has=function(e){return this.__data__.has(e)};var $n=1,En=2;function Cn(e,t,n,r,s,i){var o=n&$n,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var l=i.get(e),u=i.get(t);if(l&&u)return l==t&&u==e;var h=-1,p=!0,d=n&En?new An:void 0;for(i.set(e,t),i.set(t,e);++h<a;){var f=e[h],g=t[h];if(r)var m=o?r(g,f,h,t,e,i):r(f,g,h,e,t,i);if(void 0!==m){if(m)continue;p=!1;break}if(d){if(!Sn(t,(function(e,t){if(!xn(d,t)&&(f===e||s(f,e,n,r,i)))return d.push(t)}))){p=!1;break}}else if(f!==g&&!s(f,g,n,r,i)){p=!1;break}}return i.delete(e),i.delete(t),p}function In(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function Pn(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var Mn=1,On=2,Rn="[object Boolean]",Ln="[object Date]",Tn="[object Error]",zn="[object Map]",Nn="[object Number]",Dn="[object RegExp]",Un="[object Set]",Fn="[object String]",jn="[object Symbol]",Bn="[object ArrayBuffer]",Hn="[object DataView]",Xn=me?me.prototype:void 0,Vn=Xn?Xn.valueOf:void 0;var Wn=1,qn=Object.prototype.hasOwnProperty;var Gn=1,Kn="[object Arguments]",Yn="[object Array]",Qn="[object Object]",Zn=Object.prototype.hasOwnProperty;function Jn(e,t,n,r,s,i){var o=Ie(e),a=Ie(t),c=o?Yn:vn(e),l=a?Yn:vn(t),u=(c=c==Kn?Qn:c)==Qn,h=(l=l==Kn?Qn:l)==Qn,p=c==l;if(p&&yt(e)){if(!yt(t))return!1;o=!0,u=!1}if(p&&!u)return i||(i=new tn),o||$t(e)?Cn(e,t,n,r,s,i):function(e,t,n,r,s,i,o){switch(n){case Hn:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Bn:return!(e.byteLength!=t.byteLength||!i(new wn(e),new wn(t)));case Rn:case Ln:case Nn:return ot(+e,+t);case Tn:return e.name==t.name&&e.message==t.message;case Dn:case Fn:return e==t+"";case zn:var a=In;case Un:var c=r&Mn;if(a||(a=Pn),e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=On,o.set(e,t);var u=Cn(a(e),a(t),r,s,i,o);return o.delete(e),u;case jn:if(Vn)return Vn.call(e)==Vn.call(t)}return!1}(e,t,c,n,r,s,i);if(!(n&Gn)){var d=u&&Zn.call(e,"__wrapped__"),f=h&&Zn.call(t,"__wrapped__");if(d||f){var g=d?e.value():e,m=f?t.value():t;return i||(i=new tn),s(g,m,n,r,i)}}return!!p&&(i||(i=new tn),function(e,t,n,r,s,i){var o=n&Wn,a=on(e),c=a.length;if(c!=on(t).length&&!o)return!1;for(var l=c;l--;){var u=a[l];if(!(o?u in t:qn.call(t,u)))return!1}var h=i.get(e),p=i.get(t);if(h&&p)return h==t&&p==e;var d=!0;i.set(e,t),i.set(t,e);for(var f=o;++l<c;){var g=e[u=a[l]],m=t[u];if(r)var b=o?r(m,g,u,t,e,i):r(g,m,u,e,t,i);if(!(void 0===b?g===m||s(g,m,n,r,i):b)){d=!1;break}f||(f="constructor"==u)}if(d&&!f){var y=e.constructor,_=t.constructor;y==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof _&&_ instanceof _||(d=!1)}return i.delete(e),i.delete(t),d}(e,t,n,r,s,i))}function er(e,t,n,r,s){return e===t||(null==e||null==t||!$e(e)&&!$e(t)?e!=e&&t!=t:Jn(e,t,n,r,er,s))}var tr=1,nr=2;function rr(e){return e==e&&!Le(e)}function sr(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}function ir(e){var t=function(e){for(var t=Ot(e),n=t.length;n--;){var r=t[n],s=e[r];t[n]=[r,s,rr(s)]}return t}(e);return 1==t.length&&t[0][2]?sr(t[0][0],t[0][1]):function(n){return n===e||function(e,t,n,r){var s=n.length,i=s;if(null==e)return!i;for(e=Object(e);s--;){var o=n[s];if(o[2]?o[1]!==e[o[0]]:!(o[0]in e))return!1}for(;++s<i;){var a=(o=n[s])[0],c=e[a],l=o[1];if(o[2]){if(void 0===c&&!(a in e))return!1}else{var u=new tn;if(!er(l,c,tr|nr,r,u))return!1}}return!0}(n,0,t)}}function or(e,t){return null!=e&&t in Object(e)}function ar(e,t){return null!=e&&function(e,t,n){for(var r=-1,s=(t=Qt(t,e)).length,i=!1;++r<s;){var o=Jt(t[r]);if(!(i=null!=e&&n(e,o)))break;e=e[o]}return i||++r!=s?i:!!(s=null==e?0:e.length)&&ct(s)&&it(o,s)&&(Ie(e)||ft(e))}(e,t,or)}var cr=1,lr=2;function ur(e,t){return Tt(e)&&rr(t)?sr(Jt(e),t):function(n){var r=function(e,t,n){var r=null==e?void 0:en(e,t);return void 0===r?n:r}(n,e);return void 0===r&&r===t?ar(n,e):er(t,r,cr|lr)}}function hr(e){return Tt(e)?(t=Jt(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return en(t,e)}}(e);var t}function pr(e,t){return er(e,t)}var dr=ln&&1/Pn(new ln([,-0]))[1]==1/0?function(e){return new ln(e)}:function(){},fr=200;function gr(e,t){return e&&e.length?function(e,t,n){var r=-1,s=nt,i=e.length,o=!0,a=[],c=a;if(i>=fr){var l=t?null:dr(e);if(l)return Pn(l);o=!1,s=xn,c=new An}else c=t?[]:a;e:for(;++r<i;){var u=e[r],h=t?t(u):u;if(u=0!==u?u:0,o&&h==h){for(var p=c.length;p--;)if(c[p]===h)continue e;t&&c.push(h),a.push(u)}else s(c,h,n)||(c!==a&&c.push(h),a.push(u))}return a}(e,"function"==typeof(n=t)?n:null==n?Te:"object"==typeof n?Ie(n)?ur(n[0],n[1]):ir(n):hr(n)):[];var n}var mr,br="object"==typeof Reflect?Reflect:null,yr=br&&"function"==typeof br.apply?br.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};mr=br&&"function"==typeof br.ownKeys?br.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var _r=Number.isNaN||function(e){return e!=e};function vr(){vr.init.call(this)}vr.EventEmitter=vr,vr.prototype._events=void 0,vr.prototype._eventsCount=0,vr.prototype._maxListeners=void 0;var wr=10;function kr(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function Ar(e){return void 0===e._maxListeners?vr.defaultMaxListeners:e._maxListeners}function Sr(e,t,n,r){var s,i,o,a;if(kr(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),o=i[t]),void 0===o)o=i[t]=n,++e._eventsCount;else if("function"==typeof o?o=i[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(s=Ar(e))>0&&o.length>s&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,a=c,console&&console.warn&&console.warn(a)}return e}function xr(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function $r(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},s=xr.bind(r);return s.listener=n,r.wrapFn=s,s}function Er(e,t,n){var r=e._events;if(void 0===r)return[];var s=r[t];return void 0===s?[]:"function"==typeof s?n?[s.listener||s]:[s]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(s):Ir(s,s.length)}function Cr(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function Ir(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}Object.defineProperty(vr,"defaultMaxListeners",{enumerable:!0,get:function(){return wr},set:function(e){if("number"!=typeof e||e<0||_r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");wr=e}}),vr.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},vr.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||_r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},vr.prototype.getMaxListeners=function(){return Ar(this)},vr.prototype.emit=function(e){var t=[];for(let e=1;e<arguments.length;e++)t.push(arguments[e]);var n="error"===e,r=this._events;if(void 0!==r)n=n&&void 0===r.error;else if(!n)return!1;if(n){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var i=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw i.context=s,i}var o=r[e];if(void 0===o)return!1;if("function"==typeof o)yr(o,this,t);else{var a=o.length,c=Ir(o,a);for(let e=0;e<a;++e)yr(c[e],this,t)}return!0},vr.prototype.addListener=function(e,t){return Sr(this,e,t,!1)},vr.prototype.on=vr.prototype.addListener,vr.prototype.prependListener=function(e,t){return Sr(this,e,t,!0)},vr.prototype.once=function(e,t){return kr(t),this.on(e,$r(this,e,t)),this},vr.prototype.prependOnceListener=function(e,t){return kr(t),this.prependListener(e,$r(this,e,t)),this},vr.prototype.removeListener=function(e,t){var n,r,s,i,o;if(kr(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(s=-1,i=n.length-1;i>=0;i--)if(n[i]===t||n[i].listener===t){o=n[i].listener,s=i;break}if(s<0)return this;0===s?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,s),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,o||t)}return this},vr.prototype.off=vr.prototype.removeListener,vr.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var s,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(s=i[r])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},vr.prototype.listeners=function(e){return Er(this,e,!0)},vr.prototype.rawListeners=function(e){return Er(this,e,!1)},vr.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Cr.call(e,t)},vr.prototype.listenerCount=Cr,vr.prototype.eventNames=function(){return this._eventsCount>0?mr(this._events):[]};class Pr{static instance;emitter=new vr;static getInstance(){return this.instance||(this.instance=new Pr),this.instance}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}emit(e,...t){this.emitter.emit(e,...t)}addListener(e,t){this.emitter.addListener(e,t)}removeListener(e,t){this.emitter.removeListener(e,t)}listeners(e){return this.emitter.listeners(e)}listenerCount(e){return this.emitter.listenerCount(e)}}class Mr extends pe{currentFormFactor;static instance;constructor(e,t){super(),super.configure(e),this.currentFormFactor=t}async fetchCampaignRules(e){const t=G.getDevice();if(!t?.id)throw new Z;const n=`device/${t.id}/campaign_rules/`;let r;try{r=await this.fetchAPI(n)}catch(e){if(r=this.fallbackData(),!r)throw q.error(ie(e.status,n)),e}let s=r.results.filter((e=>e.form_factors.some((e=>e.form_factor===this.currentFormFactor))));return s=s.filter((t=>{const n=e.find((e=>e.id==t.paywall));if(n)return t})),G.setCampaignRules(d,s),this.invokeAvailableCampaignsResponseHandler(),s}invokeAvailableCampaignsResponseHandler(e){const t=Pr.getInstance().listeners(U);if(!e){const t=G.getCampaignRules(d)??[],n=G.getCampaignRules(b)??[];e=gr(kn([...t,...n]),"rule")}t.forEach((t=>{t(e)}))}fallbackData(){const e=G.getCampaignRules(d)||G.getCampaignRules(b);return e?{count:e.length,results:e}:null}}class Or extends pe{static instance;constructor(e){super(),super.configure(e)}async createOrUpdateDevice(e){const t=G.getDevice();return t?.id?this.isEqualDevices(t,e)?t:this.updateDevice(t.id,e):this.createDevice(e)}async createDevice(e){const t=await this.requestAPIData("device/",e);return t&&G.setDevice(t),t}async updateDevice(e,t){const n=await this.requestAPIData(`device/${e}/`,t,"PUT");return n&&G.setDevice(n),n}async updateDeviceField(e,t){const n={[e]:t},r=G.getDevice();if(!r?.id)throw new Z;const s=await this.requestAPIData(`device/${r.id}/`,n,"PATCH");return s&&G.setDevice(s),s}async requestAPIData(e,t,n="POST"){let r=null;try{r=await this.requestBodyAPI(e,t,n)}catch(t){if(r=G.getDevice(),!r)throw q.error(ie(t.status,e)),t}return r}isEqualDevices(e,t){const n={...e,...t},r=Object.keys(e).reduce(((e,t)=>(e[t]=n[t],e)),{});return pr(r,e)}}class Rr extends pe{static instance;constructor(e){super(),super.configure(e)}async fetchProducts(){let e;try{e=await this.fetchAPI("products/")}catch(t){if(e=this.fallbackData(),!e)throw q.error(ie(t.status,"products/")),t}return e.results&&G.setProducts(g,e.results),e.results}fallbackData(){const e=G.getProducts(g)||G.getProducts(_);return e?{count:e.length,results:e}:null}}class Lr extends pe{static instance;constructor(e){super(),super.configure(e)}async fetchPaywalls(){const e=G.getDevice();if(!e?.id)throw new Z;const t=`device/${e.id}/paywalls/`;let n;try{n=await this.fetchAPI(t)}catch(e){if(n=this.fallbackData(),!n)throw q.error(ie(e.status,t)),e}return n.results&&G.setPaywalls(f,n.results),n.results}fallbackData(){const e=G.getPaywalls(f)||G.getPaywalls(y);return e?{count:e.length,results:e}:null}}class Tr extends pe{static instance;constructor(e){super(),super.configure(e)}async fetchConfig(){let e=null;try{e=await this.fetchAPI("config/")}catch(t){if(e=G.getAppConfig(p)||G.getAppConfig(m),!e)throw q.error(ie(t.status,"config/")),t}return e&&G.setAppConfig(p,e),e}}const zr={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},Nr={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},Dr={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},Ur={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},Fr={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class jr{static getFirstMatch(e,t){const n=t.match(e);return n&&n.length>0&&n[1]||""}static getSecondMatch(e,t){const n=t.match(e);return n&&n.length>1&&n[2]||""}static matchAndReturnConst(e,t,n){if(e.test(t))return n}static getWindowsVersionName(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(e){const t=e.split(".").splice(0,2).map((e=>parseInt(e,10)||0));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(e){const t=e.split(".").splice(0,2).map((e=>parseInt(e,10)||0));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,t,n=!1){const r=jr.getVersionPrecision(e),s=jr.getVersionPrecision(t);let i=Math.max(r,s),o=0;const a=jr.map([e,t],(e=>{const t=i-jr.getVersionPrecision(e),n=e+new Array(t+1).join(".0");return jr.map(n.split("."),(e=>new Array(20-e.length).join("0")+e)).reverse()}));for(n&&(o=i-Math.min(r,s)),i-=1;i>=o;){if(a[0][i]>a[1][i])return 1;if(a[0][i]===a[1][i]){if(i===o)return 0;i-=1}else if(a[0][i]<a[1][i])return-1}}static map(e,t){const n=[];let r;if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1)n.push(t(e[r]));return n}static find(e,t){let n,r;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(n=0,r=e.length;n<r;n+=1){const r=e[n];if(t(r,n))return r}}static assign(e,...t){const n=e;let r,s;if(Object.assign)return Object.assign(e,...t);for(r=0,s=t.length;r<s;r+=1){const e=t[r];if("object"==typeof e&&null!==e){Object.keys(e).forEach((t=>{n[t]=e[t]}))}}return e}static getBrowserAlias(e){return zr[e]}static getBrowserTypeByAlias(e){return Nr[e]||""}}const Br=/version\/(\d+(\.?_?\d+)+)/i,Hr=[{test:[/googlebot/i],describe(e){const t={name:"Googlebot"},n=jr.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/opera/i],describe(e){const t={name:"Opera"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe(e){const t={name:"Opera"},n=jr.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe(e){const t={name:"Samsung Internet for Android"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe(e){const t={name:"NAVER Whale Browser"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe(e){const t={name:"MZ Browser"},n=jr.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/focus/i],describe(e){const t={name:"Focus"},n=jr.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/swing/i],describe(e){const t={name:"Swing"},n=jr.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/coast/i],describe(e){const t={name:"Opera Coast"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(e){const t={name:"Opera Touch"},n=jr.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe(e){const t={name:"Yandex Browser"},n=jr.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe(e){const t={name:"UC Browser"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe(e){const t={name:"Maxthon"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe(e){const t={name:"Epiphany"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe(e){const t={name:"Puffin"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe(e){const t={name:"Sleipnir"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe(e){const t={name:"K-Meleon"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe(e){const t={name:"WeChat"},n=jr.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe(e){const t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=jr.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe(e){const t={name:"Internet Explorer"},n=jr.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe(e){const t={name:"Microsoft Edge"},n=jr.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe(e){const t={name:"Microsoft Edge"},n=jr.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe(e){const t={name:"Vivaldi"},n=jr.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe(e){const t={name:"SeaMonkey"},n=jr.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe(e){const t={name:"Sailfish"},n=jr.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe(e){const t={name:"Amazon Silk"},n=jr.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe(e){const t={name:"PhantomJS"},n=jr.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe(e){const t={name:"SlimerJS"},n=jr.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t={name:"BlackBerry"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe(e){const t={name:"WebOS Browser"},n=jr.getFirstMatch(Br,e)||jr.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe(e){const t={name:"Bada"},n=jr.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe(e){const t={name:"Tizen"},n=jr.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe(e){const t={name:"QupZilla"},n=jr.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe(e){const t={name:"Firefox"},n=jr.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe(e){const t={name:"Electron"},n=jr.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe(e){const t={name:"Miui"},n=jr.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe(e){const t={name:"Chromium"},n=jr.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe(e){const t={name:"Chrome"},n=jr.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe(e){const t={name:"Google Search"},n=jr.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test(e){const t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe(e){const t={name:"Android Browser"},n=jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe(e){const t={name:"PlayStation 4"},n=jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe(e){const t={name:"Safari"},n=jr.getFirstMatch(Br,e);return n&&(t.version=n),t}},{test:[/.*/i],describe(e){const t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:jr.getFirstMatch(t,e),version:jr.getSecondMatch(t,e)}}}];var Xr=[{test:[/Roku\/DVP/],describe(e){const t=jr.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:Ur.Roku,version:t}}},{test:[/windows phone/i],describe(e){const t=jr.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:Ur.WindowsPhone,version:t}}},{test:[/windows /i],describe(e){const t=jr.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=jr.getWindowsVersionName(t);return{name:Ur.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(e){const t={name:Ur.iOS},n=jr.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe(e){const t=jr.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=jr.getMacOSVersionName(t),r={name:Ur.MacOS,version:t};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe(e){const t=jr.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:Ur.iOS,version:t}}},{test(e){const t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe(e){const t=jr.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=jr.getAndroidVersionName(t),r={name:Ur.Android,version:t};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe(e){const t=jr.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:Ur.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t=jr.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||jr.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||jr.getFirstMatch(/\bbb(\d+)/i,e);return{name:Ur.BlackBerry,version:t}}},{test:[/bada/i],describe(e){const t=jr.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:Ur.Bada,version:t}}},{test:[/tizen/i],describe(e){const t=jr.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:Ur.Tizen,version:t}}},{test:[/linux/i],describe:()=>({name:Ur.Linux})},{test:[/CrOS/],describe:()=>({name:Ur.ChromeOS})},{test:[/PlayStation 4/],describe(e){const t=jr.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:Ur.PlayStation4,version:t}}}],Vr=[{test:[/googlebot/i],describe:()=>({type:"bot",vendor:"Google"})},{test:[/huawei/i],describe(e){const t=jr.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:Dr.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:()=>({type:Dr.tablet,vendor:"Nexus"})},{test:[/ipad/i],describe:()=>({type:Dr.tablet,vendor:"Apple",model:"iPad"})},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:()=>({type:Dr.tablet,vendor:"Apple",model:"iPad"})},{test:[/kftt build/i],describe:()=>({type:Dr.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"})},{test:[/silk/i],describe:()=>({type:Dr.tablet,vendor:"Amazon"})},{test:[/tablet(?! pc)/i],describe:()=>({type:Dr.tablet})},{test(e){const t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe(e){const t=jr.getFirstMatch(/(ipod|iphone)/i,e);return{type:Dr.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:()=>({type:Dr.mobile,vendor:"Nexus"})},{test:[/[^-]mobi/i],describe:()=>({type:Dr.mobile})},{test:e=>"blackberry"===e.getBrowserName(!0),describe:()=>({type:Dr.mobile,vendor:"BlackBerry"})},{test:e=>"bada"===e.getBrowserName(!0),describe:()=>({type:Dr.mobile})},{test:e=>"windows phone"===e.getBrowserName(),describe:()=>({type:Dr.mobile,vendor:"Microsoft"})},{test(e){const t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:()=>({type:Dr.tablet})},{test:e=>"android"===e.getOSName(!0),describe:()=>({type:Dr.mobile})},{test:e=>"macos"===e.getOSName(!0),describe:()=>({type:Dr.desktop,vendor:"Apple"})},{test:e=>"windows"===e.getOSName(!0),describe:()=>({type:Dr.desktop})},{test:e=>"linux"===e.getOSName(!0),describe:()=>({type:Dr.desktop})},{test:e=>"playstation 4"===e.getOSName(!0),describe:()=>({type:Dr.tv})},{test:e=>"roku"===e.getOSName(!0),describe:()=>({type:Dr.tv})}],Wr=[{test:e=>"microsoft edge"===e.getBrowserName(!0),describe(e){if(/\sedg\//i.test(e))return{name:Fr.Blink};const t=jr.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:Fr.EdgeHTML,version:t}}},{test:[/trident/i],describe(e){const t={name:Fr.Trident},n=jr.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:e=>e.test(/presto/i),describe(e){const t={name:Fr.Presto},n=jr.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test(e){const t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe(e){const t={name:Fr.Gecko},n=jr.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe:()=>({name:Fr.Blink})},{test:[/(apple)?webkit/i],describe(e){const t={name:Fr.WebKit},n=jr.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];class qr{constructor(e,t=!1){if(null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=jr.find(Hr,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.browser=e.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const e=jr.find(Xr,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os}getOSName(e){const{name:t}=this.getOS();return e?String(t).toLowerCase()||"":t||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:t}=this.getPlatform();return e?String(t).toLowerCase()||"":t||""}parsePlatform(){this.parsedResult.platform={};const e=jr.find(Vr,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const e=jr.find(Wr,(e=>{if("function"==typeof e.test)return e.test(this);if(e.test instanceof Array)return e.test.some((e=>this.test(e)));throw new Error("Browser's test function is not valid")}));return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return jr.assign({},this.parsedResult)}satisfies(e){const t={};let n=0;const r={};let s=0;if(Object.keys(e).forEach((i=>{const o=e[i];"string"==typeof o?(r[i]=o,s+=1):"object"==typeof o&&(t[i]=o,n+=1)})),n>0){const e=Object.keys(t),n=jr.find(e,(e=>this.isOS(e)));if(n){const e=this.satisfies(t[n]);if(void 0!==e)return e}const r=jr.find(e,(e=>this.isPlatform(e)));if(r){const e=this.satisfies(t[r]);if(void 0!==e)return e}}if(s>0){const e=Object.keys(r),t=jr.find(e,(e=>this.isBrowser(e,!0)));if(void 0!==t)return this.compareVersion(r[t])}}isBrowser(e,t=!1){const n=this.getBrowserName().toLowerCase();let r=e.toLowerCase();const s=jr.getBrowserTypeByAlias(r);return t&&s&&(r=s.toLowerCase()),r===n}compareVersion(e){let t=[0],n=e,r=!1;const s=this.getBrowserVersion();if("string"==typeof s)return">"===e[0]||"<"===e[0]?(n=e.substr(1),"="===e[1]?(r=!0,n=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?n=e.substr(1):"~"===e[0]&&(r=!0,n=e.substr(1)),t.indexOf(jr.compareVersions(s,n,r))>-1}isOS(e){return this.getOSName(!0)===String(e).toLowerCase()}isPlatform(e){return this.getPlatformType(!0)===String(e).toLowerCase()}isEngine(e){return this.getEngineName(!0)===String(e).toLowerCase()}is(e,t=!1){return this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some((e=>this.is(e)))}}class Gr{static getParser(e,t=!1){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new qr(e,t)}static parse(e){return new qr(e).getResult()}static get BROWSER_MAP(){return Nr}static get ENGINE_MAP(){return Fr}static get OS_MAP(){return Ur}static get PLATFORMS_MAP(){return Dr}}const Kr={tablet:"tablet",mobile:"phone",tv:"television",desktop:"desktop"},Yr=e=>{const t=Gr.getParser(window.navigator.userAgent),n=t.getPlatform(),r={os_version:t.getOSVersion()||null,os_name:t.getOSName()||null,browser_name:t.getBrowserName()||null,browser_version:t.getBrowserVersion()||null,sdk_client:"web",sdk_version:"3.2.0",language:window.navigator.language};if(n.type&&(r.form_factor=Kr[n.type]),n.model&&(r.device_model=n.model),e&&e.length>0){const t=(e=>{const t=e?.find((e=>e.includes($)));if(!e||!t)return null;const n=t.split(E);return{platform:n[1],version:n[2]}})(e);r.extended_platform=t?.platform||null,r.extended_platform_version=t?.version||null}return r};class Qr{static instance=new Qr;async init(e){this.storeInitialValues(e),await this.initAndFetchRequiredData(e)}storeInitialValues(e){G.setNamiConfig(e);const t=e.initialConfig;t?.campaign_rules&&G.setCampaignRules(b,t.campaign_rules),t?.appConfig&&G.setAppConfig(m,t.appConfig),t?.paywalls&&G.setPaywalls(y,t.paywalls),t?.products&&G.setProducts(_,t.products)}async initAndFetchRequiredData(e){const t=new Or(e),n=Yr(e.namiCommands),r=await t.createOrUpdateDevice(n),s=e.formFactor??r.form_factor;Mr.instance=new Mr(e,s),Lr.instance=new Lr(e),Rr.instance=new Rr(e),Tr.instance=new Tr(e),Or.instance=t,await Promise.all([Tr.instance.fetchConfig(),Rr.instance.fetchProducts(),Lr.instance.fetchPaywalls().then((e=>Mr.instance.fetchCampaignRules(e)))])}}class Zr{static instance=new Zr;#e=!1;get isInitialized(){return this.#e}static async configure(e){if(!e.appPlatformId)throw new Q;return await Zr.instance.initializeSDK(e)}async initializeSDK(e){let t=!1,n=!1;const r=this.#e?G.getNamiConfig():null;if(q.setLogger(e.logLevel),null!==r){if(pr(e,r))return q.warn("Nami SDK is already configured, ignoring this configure call."),{sdkInitialized:!0,configureState:D};n=!0;const s=ce(e.namiCommands),i=ce(r.namiCommands);e.appPlatformId==r.appPlatformId&&s==i||(t=!0),e.languageCode===r.languageCode&&e.logLevel==r.logLevel||(n=!0)}t&&(q.info("SDK full reconfigure called"),G.resetDevice()),this.#e=!0,pe.configure(e),await Qr.instance.init(e),q.info("SDK successfully initialized!");return{sdkInitialized:!0,configureState:n||t?N:z}}}var Jr,es;!function(e){e.REGISTER_BUY_SKU="RegisterBuySKU",e.PAYWALL_CLOSE_REQUESTED="PaywallCloseRequested",e.PAYWALL_SIGNIN_REQUESTED="PaywallSignInRequested",e.PAYWALL_RESTORE_REQUESTED="PaywallRestoreRequested",e.PAYWALL_DEEPLINK_ACTION="PaywallDeeplinkAction"}(Jr||(Jr={})),e.NamiPaywallAction=void 0,(es=e.NamiPaywallAction||(e.NamiPaywallAction={})).BUY_SKU="BUY_SKU",es.SELECT_SKU="SELECT_SKU",es.RESTORE_PURCHASES="RESTORE_PURCHASES",es.SIGN_IN="SIGN_IN",es.CLOSE_PAYWALL="CLOSE_PAYWALL",es.SHOW_PAYWALL="SHOW_PAYWALL",es.PURCHASE_SELECTED_SKU="PURCHASE_SELECTED_SKU",es.PURCHASE_SUCCESS="PURCHASE_SUCCESS",es.PURCHASE_FAILED="PURCHASE_FAILED",es.PURCHASE_CANCELLED="PURCHASE_CANCELLED",es.PURCHASE_PENDING="PURCHASE_PENDING",es.PURCHASE_UNKNOWN="PURCHASE_UNKNOWN",es.PURCHASE_DEFERRED="PURCHASE_DEFERRED";class ts{static instance=new ts;emitter=Pr.getInstance();productDetails;static allPaywalls(){if(!this.instance.sdkInitialized)throw new Y;return gr(kn([...G.getPaywalls(f)??[],...G.getPaywalls(y)??[]]),"id")}static setProductDetails(e){this.instance.productDetails=e}static registerSignInHandler(e){return this.instance.emitter.addListener(Jr.PAYWALL_SIGNIN_REQUESTED,e),()=>{this.instance.emitter.removeListener(Jr.PAYWALL_SIGNIN_REQUESTED,e)}}static registerCloseHandler(e){return this.instance.emitter.addListener(Jr.PAYWALL_CLOSE_REQUESTED,e),()=>{this.instance.emitter.removeListener(Jr.PAYWALL_CLOSE_REQUESTED,e)}}static registerDeeplinkActionHandler(e){return this.instance.emitter.addListener(Jr.PAYWALL_DEEPLINK_ACTION,e),()=>{this.instance.emitter.removeListener(Jr.PAYWALL_DEEPLINK_ACTION,e)}}static registerBuySkuHandler(e){return this.instance.emitter.addListener(Jr.REGISTER_BUY_SKU,e),()=>{this.instance.emitter.removeListener(Jr.REGISTER_BUY_SKU,e)}}static registerRestoreHandler(e){return this.instance.emitter.addListener(Jr.PAYWALL_RESTORE_REQUESTED,e),()=>{this.instance.emitter.removeListener(Jr.PAYWALL_RESTORE_REQUESTED,e)}}static buySkuComplete(){q.info("TODO: Implement buySkuComplete")}static buySkuCancel(){q.info("TODO: Implement buySkuCancel")}get sdkInitialized(){return Zr.instance.isInitialized}getProductDetails(e){return(this.productDetails??[]).find((t=>t.name===e))}}const ns=globalThis,rs=ns.ShadowRoot&&(void 0===ns.ShadyCSS||ns.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ss=Symbol(),is=new WeakMap;let os=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==ss)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(rs&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=is.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&is.set(t,e))}return e}toString(){return this.cssText}};const as=e=>new os("string"==typeof e?e:e+"",void 0,ss),cs=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[r+1]),e[0]);return new os(n,e,ss)},ls=(e,t)=>{if(rs)e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of t){const t=document.createElement("style"),r=ns.litNonce;void 0!==r&&t.setAttribute("nonce",r),t.textContent=n.cssText,e.appendChild(t)}},us=rs?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return as(t)})(e):e,{is:hs,defineProperty:ps,getOwnPropertyDescriptor:ds,getOwnPropertyNames:fs,getOwnPropertySymbols:gs,getPrototypeOf:ms}=Object,bs=globalThis,ys=bs.trustedTypes,_s=ys?ys.emptyScript:"",vs=bs.reactiveElementPolyfillSupport,ws=(e,t)=>e,ks={toAttribute(e,t){switch(t){case Boolean:e=e?_s:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},As=(e,t)=>!hs(e,t),Ss={attribute:!0,type:String,converter:ks,reflect:!1,hasChanged:As};Symbol.metadata??=Symbol("metadata"),bs.litPropertyMetadata??=new WeakMap;let xs=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ss){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),r=this.getPropertyDescriptor(e,n,t);void 0!==r&&ps(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){const{get:r,set:s}=ds(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get(){return r?.call(this)},set(t){const i=r?.call(this);s.call(this,t),this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ss}static _$Ei(){if(this.hasOwnProperty(ws("elementProperties")))return;const e=ms(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(ws("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ws("properties"))){const e=this.properties,t=[...fs(e),...gs(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(us(e))}else void 0!==e&&t.push(us(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ls(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EC(e,t){const n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(void 0!==r&&!0===n.reflect){const s=(void 0!==n.converter?.toAttribute?n.converter:ks).toAttribute(t,n.type);this._$Em=e,null==s?this.removeAttribute(r):this.setAttribute(r,s),this._$Em=null}}_$AK(e,t){const n=this.constructor,r=n._$Eh.get(e);if(void 0!==r&&this._$Em!==r){const e=n.getPropertyOptions(r),s="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:ks;this._$Em=r,this[r]=s.fromAttribute(t,e.type),this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){if(n??=this.constructor.getPropertyOptions(e),!(n.hasChanged??As)(this[e],t))return;this.P(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,t,n){this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e)!0!==n.wrapped||this._$AL.has(t)||void 0===this[t]||this.P(t,this[t],n)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(e){}firstUpdated(e){}};xs.elementStyles=[],xs.shadowRootOptions={mode:"open"},xs[ws("elementProperties")]=new Map,xs[ws("finalized")]=new Map,vs?.({ReactiveElement:xs}),(bs.reactiveElementVersions??=[]).push("2.0.4");const $s=globalThis,Es=$s.trustedTypes,Cs=Es?Es.createPolicy("lit-html",{createHTML:e=>e}):void 0,Is="$lit$",Ps=`lit$${Math.random().toFixed(9).slice(2)}$`,Ms="?"+Ps,Os=`<${Ms}>`,Rs=document,Ls=()=>Rs.createComment(""),Ts=e=>null===e||"object"!=typeof e&&"function"!=typeof e,zs=Array.isArray,Ns="[ \t\n\f\r]",Ds=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Us=/-->/g,Fs=/>/g,js=RegExp(`>|${Ns}(?:([^\\s"'>=/]+)(${Ns}*=${Ns}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Bs=/'/g,Hs=/"/g,Xs=/^(?:script|style|textarea|title)$/i,Vs=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),Ws=Vs(1),qs=Vs(2),Gs=Symbol.for("lit-noChange"),Ks=Symbol.for("lit-nothing"),Ys=new WeakMap,Qs=Rs.createTreeWalker(Rs,129);function Zs(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==Cs?Cs.createHTML(t):t}const Js=(e,t)=>{const n=e.length-1,r=[];let s,i=2===t?"<svg>":"",o=Ds;for(let t=0;t<n;t++){const n=e[t];let a,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),null!==c);)u=o.lastIndex,o===Ds?"!--"===c[1]?o=Us:void 0!==c[1]?o=Fs:void 0!==c[2]?(Xs.test(c[2])&&(s=RegExp("</"+c[2],"g")),o=js):void 0!==c[3]&&(o=js):o===js?">"===c[0]?(o=s??Ds,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,a=c[1],o=void 0===c[3]?js:'"'===c[3]?Hs:Bs):o===Hs||o===Bs?o=js:o===Us||o===Fs?o=Ds:(o=js,s=void 0);const h=o===js&&e[t+1].startsWith("/>")?" ":"";i+=o===Ds?n+Os:l>=0?(r.push(a),n.slice(0,l)+Is+n.slice(l)+Ps+h):n+Ps+(-2===l?t:h)}return[Zs(e,i+(e[n]||"<?>")+(2===t?"</svg>":"")),r]};class ei{constructor({strings:e,_$litType$:t},n){let r;this.parts=[];let s=0,i=0;const o=e.length-1,a=this.parts,[c,l]=Js(e,t);if(this.el=ei.createElement(c,n),Qs.currentNode=this.el.content,2===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(r=Qs.nextNode())&&a.length<o;){if(1===r.nodeType){if(r.hasAttributes())for(const e of r.getAttributeNames())if(e.endsWith(Is)){const t=l[i++],n=r.getAttribute(e).split(Ps),o=/([.?@])?(.*)/.exec(t);a.push({type:1,index:s,name:o[2],strings:n,ctor:"."===o[1]?ii:"?"===o[1]?oi:"@"===o[1]?ai:si}),r.removeAttribute(e)}else e.startsWith(Ps)&&(a.push({type:6,index:s}),r.removeAttribute(e));if(Xs.test(r.tagName)){const e=r.textContent.split(Ps),t=e.length-1;if(t>0){r.textContent=Es?Es.emptyScript:"";for(let n=0;n<t;n++)r.append(e[n],Ls()),Qs.nextNode(),a.push({type:2,index:++s});r.append(e[t],Ls())}}}else if(8===r.nodeType)if(r.data===Ms)a.push({type:2,index:s});else{let e=-1;for(;-1!==(e=r.data.indexOf(Ps,e+1));)a.push({type:7,index:s}),e+=Ps.length-1}s++}}static createElement(e,t){const n=Rs.createElement("template");return n.innerHTML=e,n}}function ti(e,t,n=e,r){if(t===Gs)return t;let s=void 0!==r?n._$Co?.[r]:n._$Cl;const i=Ts(t)?void 0:t._$litDirective$;return s?.constructor!==i&&(s?._$AO?.(!1),void 0===i?s=void 0:(s=new i(e),s._$AT(e,n,r)),void 0!==r?(n._$Co??=[])[r]=s:n._$Cl=s),void 0!==s&&(t=ti(e,s._$AS(e,t.values),s,r)),t}class ni{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??Rs).importNode(t,!0);Qs.currentNode=r;let s=Qs.nextNode(),i=0,o=0,a=n[0];for(;void 0!==a;){if(i===a.index){let t;2===a.type?t=new ri(s,s.nextSibling,this,e):1===a.type?t=new a.ctor(s,a.name,a.strings,this,e):6===a.type&&(t=new ci(s,this,e)),this._$AV.push(t),a=n[++o]}i!==a?.index&&(s=Qs.nextNode(),i++)}return Qs.currentNode=Rs,r}p(e){let t=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class ri{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=Ks,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=ti(this,e,t),Ts(e)?e===Ks||null==e||""===e?(this._$AH!==Ks&&this._$AR(),this._$AH=Ks):e!==this._$AH&&e!==Gs&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>zs(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}S(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.S(e))}_(e){this._$AH!==Ks&&Ts(this._$AH)?this._$AA.nextSibling.data=e:this.T(Rs.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,r="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=ei.createElement(Zs(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{const e=new ni(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Ys.get(e.strings);return void 0===t&&Ys.set(e.strings,t=new ei(e)),t}k(e){zs(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,r=0;for(const s of e)r===t.length?t.push(n=new ri(this.S(Ls()),this.S(Ls()),this,this.options)):n=t[r],n._$AI(s),r++;r<t.length&&(this._$AR(n&&n._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class si{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,s){this.type=1,this._$AH=Ks,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=s,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Ks}_$AI(e,t=this,n,r){const s=this.strings;let i=!1;if(void 0===s)e=ti(this,e,t,0),i=!Ts(e)||e!==this._$AH&&e!==Gs,i&&(this._$AH=e);else{const r=e;let o,a;for(e=s[0],o=0;o<s.length-1;o++)a=ti(this,r[n+o],t,o),a===Gs&&(a=this._$AH[o]),i||=!Ts(a)||a!==this._$AH[o],a===Ks?e=Ks:e!==Ks&&(e+=(a??"")+s[o+1]),this._$AH[o]=a}i&&!r&&this.j(e)}j(e){e===Ks?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class ii extends si{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Ks?void 0:e}}class oi extends si{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Ks)}}class ai extends si{constructor(e,t,n,r,s){super(e,t,n,r,s),this.type=5}_$AI(e,t=this){if((e=ti(this,e,t,0)??Ks)===Gs)return;const n=this._$AH,r=e===Ks&&n!==Ks||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==Ks&&(n===Ks||r);r&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class ci{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){ti(this,e)}}const li=$s.litHtmlPolyfillSupport;li?.(ei,ri),($s.litHtmlVersions??=[]).push("3.1.3");class ui extends xs{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,n)=>{const r=n?.renderBefore??t;let s=r._$litPart$;if(void 0===s){const e=n?.renderBefore??null;r._$litPart$=s=new ri(t.insertBefore(Ls(),e),e,void 0,n??{})}return s._$AI(e),s})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Gs}}ui._$litElement$=!0,ui.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:ui});const hi=globalThis.litElementPolyfillSupport;hi?.({LitElement:ui}),(globalThis.litElementVersions??=[]).push("4.0.5");const pi=cs`
2
2
  :host {
3
3
  -webkit-font-smoothing: antialiased;
4
4
  }
@@ -15,13 +15,13 @@
15
15
  :host p, :host h1, :host h2, :host h3, :host h4, :host h5, :host h6 {
16
16
  overflow-wrap: break-word;
17
17
  }
18
- `,hi=(e,t)=>{const n=ts.instance.getProductDetails(e);switch(t){case"price":return pi(n);case"name":return e;case"title":return"title";case"description":return"description";case"duration":case"durationSingular":case"freeTrialDuration":case"freeTrialDurationSingular":case"freeTrialPeriod":case"periodInMonths":case"durationInMonths":case"durationInMonthsSingular":case"promo":case"promoPeriod":case"promoDuration":case"promoDurationSingular":case"introductoryPrice":case"introductoryDuration":case"introductoryDurationSingular":return"XXXXX";case"period":return n?.subscription_period?.type??"XXXXX";case"periodNumber":case"freeTrialPeriodNumber":case"periodNumberInMonths":case"promoPeriodNumber":case"introductoryPeriodNumber":return"X";case"pricePerMonth":case"priceDifferenceFromSku":case"promoPrice":case"introductoryPeriod":return"$XX.XX";case"pricePerMonthRounded":case"pricePerWeekRounded":return"$XX";case"percentagePriceDifferenceFromSku":return"XX%";case"promoEligible":case"introEligible":case"invalid":case"unavailable":return!1;case"freeTrialEligible":return!0;case"pricePerDay":case"pricePerWeek":return"$X.XX";default:return"XXXX"}},pi=e=>e?`$${e.offers[0].price.toFixed(2)}`:"$XX.XX";function di(e,t){const n=t?.flatMap((e=>e.products)).find((t=>t.id===e.selectedProducts[e.currentGroupId]));return gi(n)}function fi(e,t){const n=e?.find((e=>t===e.id))?.products||[];return n.forEach((e=>{gi(e)})),n||[]}function gi(e){if(!e)return{};const t=e.variables;return Object.keys(t).forEach((n=>{"string"==typeof t[n]&&t[n].includes("${")&&(t[n]=t[n].replace(j,((t,n)=>hi(e.name,n))))})),e.entitlements=e.entitlements?.map((e=>e?.entitlement_ref_id)),{...e,...t}}function mi(e,t){return yi(e,t)?.some((()=>1==hi("","freeTrialEligible")))??!1}function bi(e,t){return!mi(e,t)&&(yi(e,t)?.some((()=>1==hi("","promoEligible")))??!1)}function yi(e,t){const n=e?.filter((e=>t?.some((t=>t===e.ref)))),r=n?.filter((t=>e.find((e=>e.products?.some((e=>e.id===t.id))))))?.map((e=>e.products))[0];return r}const _i={paywallId:"",livePaywalls:[],selectedPaywall:void 0,campaignRules:[],anySkuHasTrialOffer:!1,anySkuHasIntroOffer:!1,anySkuHasPromoOffer:!1,isLoggedIn:!1,darkMode:!1,safeAreaTop:0,groups:[],selectedProducts:{},currentPage:"page1",currentGroupId:"",fullScreenPresentation:!1,launch:{productGroups:[],customAttributes:{}},sku:{},orientation:"portrait",focusedState:!1,platformId:null,mediaList:{},skuItems:[],customer:{},hasNotch:!1};const wi=new class{host=null;state;subscribers;constructor(){this.state=_i,this.subscribers=new Set}subscribe(e){return this.subscribers.add(e),()=>this.unsubscribe(e)}unsubscribe(e){this.subscribers.delete(e)}hostConnected(){}hostDisconnected(){this.subscribers.forEach((e=>this.unsubscribe(e)))}setState(e){this.state=e,this.subscribers.forEach((e=>e())),this.host&&this.host.requestUpdate()}setCurrentGroupId(e){this.setState({...this.state,currentGroupId:e})}setSelectedProdcuts(e){this.setState({...this.state,selectedProducts:e})}setPaywall(e){const t=e.template.initialState.groups?.map((e=>e.ref))||[],n={...this.state,...e.template.initialState,anySkuHasTrialOffer:mi(e.sku_menus,t),anySkuHasPromoOffer:bi(e.sku_menus,t),paywallId:e.id,selectedPaywall:e,launch:{...this.state.launch,productGroups:t},sku:di(e.template.initialState,e.sku_menus),skuItems:fi(e.sku_menus,e.template.initialState.currentGroupId)};this.setState(n)}setCustomerAttribute(e){this.setState({...this.state,customer:{...this.state.customer,...e}})}removeCustomerAttribute(e){delete this.state.customer[e],this.setState(this.state)}setIsLoggedIn(e){this.setState({...this.state,isLoggedIn:e})}setMediaList(e){this.setState({...this.state,mediaList:e.reduce(((e,t)=>({...e,[t.name]:t})))})}setSafeAreaTop(e){this.setState({...this.state,safeAreaTop:e})}setFullScreenPresentation(e){this.setState({...this.state,fullScreenPresentation:e})}};class vi{host;state;constructor(e){this.host=e,this.state=wi.state,e.addController(this),this.handleStateChange=this.handleStateChange.bind(this),wi.subscribe(this.handleStateChange)}handleStateChange(){this.state=wi.state,this.host.requestUpdate()}hostConnected(){}hostDisconnected(){wi.unsubscribe(this.handleStateChange)}}class ki extends ci{contextConsumer=new vi(this);styles(){return cs``}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ls(e,[ui,this.styles()]),e}disconnectedCallback(){super.disconnectedCallback(),this.contextConsumer.hostDisconnected()}}const Ai=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)},Si={attribute:!0,type:String,converter:ks,reflect:!1,hasChanged:As},xi=(e=Si,t,n)=>{const{kind:r,metadata:s}=n;let i=globalThis.litPropertyMetadata.get(s);if(void 0===i&&globalThis.litPropertyMetadata.set(s,i=new Map),i.set(n.name,e),"accessor"===r){const{name:r}=n;return{set(n){const s=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,s,e)},init(t){return void 0!==t&&this.P(r,void 0,e),t}}}if("setter"===r){const{name:r}=n;return function(n){const s=this[r];t.call(this,n),this.requestUpdate(r,s,e)}}throw Error("Unsupported decorator location: "+r)};function $i(e){return(t,n)=>"object"==typeof n?xi(e,t,n):((e,t,n)=>{const r=t.hasOwnProperty(n);return t.constructor.createProperty(n,r?{...e,wrapped:!0}:e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}const Ei=async e=>{const t=new Set(Array.from(document.fonts.values()).map((e=>e.family)));return e.forEach((e=>{const n=function(e){return t=`${e.family}-${e.style}`,t.replace(/ /g,"");var t}(e);if(t.has(n))return;const r=new FontFace(n,`url(${e.file})`);document.fonts.add(r)})),document.fonts.ready.then()};let Ii=class extends ki{formFactor;styles(){return cs`
18
+ `;function di(e){if("subscription"===e?.product_type){const t=function(e){if(!e)return null;const t=e.offers.filter((e=>"promo"===e.offer_type));return gi(t,e.subscription_period)}(e).find((e=>0===e.priceAmountMicros));return t?.billingPeriod}return null}function fi(e){if(!e)return null;return gi(e.offers.filter((e=>"default"===e.offer_type)),e.subscription_period)}function gi(e,t){return e.map((e=>mi(e,t)))}function mi(e,t){return e?{priceAmountMicros:1e6*e.price,priceCurrencyCode:e.currency,billingPeriod:`P${t.count}${t.type[0].toUpperCase()}`,formattedPrice:yi(e.currency).format(e.price)}:null}function bi(e,t=!1,n=!1,r=!1){if(!e)return null;const s=e.match(/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?/);if(!s)return null;const[i,o,a]=s.slice(1).map((e=>parseInt(e))),c=(e,t,n,r,s,i)=>r?e.toString():n?t?s:i:1===e||t?`${e} ${s}`:`${e} ${i}`;switch(e.at(-1)){case"D":return c(a,t,n,r,"day","days");case"W":return c(a/7,t,n,r,"week","weeks");case"M":return c(o,t,n,r,"month","months");case"Y":return c(i,t,n,r,"year","years")}return null}function yi(e){const t={maximumFractionDigits:2,minimumFractionDigits:0};try{return new Intl.NumberFormat(navigator.language,{...t,style:"currency",currency:e})}catch(e){return new Intl.NumberFormat(navigator.language,{...t,style:"currency",currency:"USD"})}}const _i=(e,t)=>{const n=parseInt(t);return n>=0&&n<e?.length?e[n]:e?.find((e=>e.sku_ref_id===t))},vi=e=>ki(e.priceAmountMicros)/wi(e.billingPeriod),wi=e=>{let t=parseInt(e[1]);return e.includes("Y")&&(t*=12),t||null},ki=e=>e/1e6;function Ai(e){return parseFloat((Math.round(e)/100).toFixed(2))}const Si=(e,t,n,r)=>{q.info("TODO: remove default XXX.. values once product details will be fully implemented");const s=ts.instance.getProductDetails(e),i={price:()=>xi(s)??"$XX.XX",name:()=>e,title:()=>s.name,description:()=>s.description,duration:()=>$i(s)??"XXXXX",durationSingular:()=>$i(s,!0)??"XXXXX",period:()=>$i(s,!1,!0)??"XXXXX",periodNumber:()=>$i(s,!1,!1,!0)??"X",freeTrialDuration:()=>Ei(s)??"XXXXX",freeTrialDurationSingular:()=>Ei(s,!0)??"XXXXX",freeTrialPeriod:()=>Ei(s,!1,!0)??"XXXXX",freeTrialPeriodNumber:()=>Ei(s,!1,!1,!0)??"X",pricePerMonth:()=>Ci(s)??"$XX.XX",pricePerMonthRounded:()=>Ci(s,!0)??"$XX",periodInMonths:()=>Ii(s)??"XXXXX",durationInMonths:()=>Pi(s)??"XXXXX",durationInMonthsSingular:()=>Pi(s,!0)??"XXXXX",periodNumberInMonths:()=>Mi(s)??"X",percentagePriceDifferenceFromSku:()=>Oi(s,n,r)??"XX%",priceDifferenceFromSku:()=>Ri(s,n,r)??"$XX.XX",promoEligible:()=>null===Li(s)&&null!==Ti(s,n),freeTrialEligible:()=>null!==Li(s),promo:()=>Ti(s,n)?.offer_ref_id??"XXXXX",promoCode:()=>"XXXXX",promoPrice:()=>zi(s,n)?.formattedPrice??"$XX.XX",promoPeriod:()=>Ni(s,n,!1,!0)??"XXXXX",promoPeriodNumber:()=>Ni(s,n,!1,!1,!0)??"X",promoDuration:()=>Ni(s,n)??"XXXXX",promoDurationSingular:()=>Ni(s,n,!0)??"XXXXX",introEligible:()=>!1,pricePerDay:()=>Di(s)??"$X.XX",pricePerWeek:()=>Ui(s)??"$X.XX",pricePerWeekRounded:()=>Ui(s,!0)??"$XX",introductoryPrice:()=>Fi(s,n)??"$XX.XX",introductoryPeriod:()=>ji(s,n,!1,!0)??"XXXXX",introductoryPeriodNumber:()=>ji(s,n,!1,!1,!0)??"X",introductoryDuration:()=>ji(s,n)??"XXXXX",introductoryDurationSingular:()=>ji(s,n,!0)??"XXXXX",invalid:()=>!1,unavailable:()=>!1}[t];return i?i():null},xi=e=>{if("subscription"===e?.product_type){const t=fi(e);return t&&t.length?t[0].formattedPrice:null}return null},$i=(e,t,n,r)=>bi(function(e){if("subscription"===e?.product_type){const t=fi(e);if(t.length>0)return t[0].billingPeriod}return null}(e),t,n,r),Ei=(e,t,n,r)=>bi(di(e),t,n,r),Ci=(e,t)=>{const n=fi(e);if(!n||0===n.length)return null;const r=vi(n[0]);return r?yi(n[0].priceCurrencyCode).format(t?Math.round(r):r):null},Ii=e=>{const t=fi(e);return"P1Y"===t[0].billingPeriod&&(t[0].billingPeriod="P12M"),t&&t.length?bi(t[0].billingPeriod):null},Pi=(e,t,n,r)=>{const s=fi(e);return s&&0!==s.length?("P1Y"===s[0].billingPeriod&&(s[0].billingPeriod="P12M"),bi(s[0].billingPeriod,t,n,r)):null},Mi=e=>{const t=fi(e);return t&&t.length?wi(t[0].billingPeriod):null},Oi=(e,t,n)=>{const r=fi(e);if(!r||0===r.length)return null;const s=_i(n,t)?.product_details||null,i=fi(s);return((e,t,n,r)=>{if(e&&t&&n&&r){const s=100*(1-e/(n/r*t));return`${Math.round(s)}%`}return null})(Ai(r[0].priceAmountMicros),Mi(e),i?.length>0?Ai(i[0].priceAmountMicros):0,Mi(s))},Ri=(e,t,n)=>{const r=fi(e);if(!r||0===r.length)return null;const s=fi(_i(n,t)?.productDetails||null);return i=vi(r[0]),o=s?.length>0?vi(s[0]):null,a=s?.length>0?yi(s[0].priceCurrencyCode):null,i&&o?a.format(i-o):null;var i,o,a},Li=e=>di(e),Ti=(e,t)=>{if(!e)return null;const n=e?.offers.filter((e=>"promo"===e.offer_type));if(!t)return n[0];const r=n[parseInt(t)];return r||(n.find((e=>e.offer_ref_id===t))||null)},zi=(e,t)=>mi(Ti(e,t),e?.subscription_period),Ni=(e,t,n,r,s)=>{const i=zi(e,t);return bi(i?.billingPeriod,n,r,s)},Di=(e,t)=>{const n=fi(e);if(!n&&0===n.length)return null;const r=ki(n[0].priceAmountMicros)/(e=>{const t=wi(e);return t?30.437*t:null})(n[0].billingPeriod);return r?yi(n[0].priceCurrencyCode).format(r):null},Ui=(e,t)=>{const n=fi(e);if(!n&&0===n.length)return null;const r=ki(n[0].priceAmountMicros)/(e=>{const t=wi(e);return t?52*t/12:null})(n[0].billingPeriod);return r?yi(n[0].priceCurrencyCode).format(t?Math.round(r):r):null},Fi=(e,t)=>{const n=Bi(e,t);return n?.formattedPrice||null},ji=(e,t,n,r,s)=>{const i=Bi(e,t);return bi(i?.billingPeriod,n,r,s)},Bi=(e,t)=>{if(!e)return null;let n=null;return t||(n=e?.offers[0]),n=e?.offers[parseInt(t)],n||(n=e?.offers.find((e=>e.offer_ref_id===t))||null),mi(n,e.subscription_period)};function Hi(e,t,n){const r=t?.flatMap((e=>e.products)).find((t=>t.id===e.selectedProducts[e.currentGroupId]));return Xi(r,n)}function Xi(e,t){if(!e)return{};const n=e.variables;return Object.keys(n).forEach((r=>{var s;"string"==typeof n[r]&&n[r].includes("${")&&(n[r]=(s=n[r]).replace(j,((n,r)=>{const i=j.exec(s)?.slice(1)||[];r=i[0]??r;const o=i[1]?.replace(":","")??"";return Si(e.name,r,o,t)})))})),e.entitlements=e.entitlements?.map((e=>e?.entitlement_ref_id)),{...e,...n}}function Vi(e,t){return qi(e,t)?.some((()=>1==Si("","freeTrialEligible")))??!1}function Wi(e,t){return!Vi(e,t)&&(qi(e,t)?.some((()=>1==Si("","promoEligible")))??!1)}function qi(e,t){const n=e?.filter((e=>t?.some((t=>t===e.ref)))),r=n?.filter((t=>e.find((e=>e.products?.some((e=>e.id===t.id))))))?.map((e=>e.products))[0];return r}const Gi={paywallId:"",livePaywalls:[],selectedPaywall:void 0,campaignRules:[],anySkuHasTrialOffer:!1,anySkuHasIntroOffer:!1,anySkuHasPromoOffer:!1,isLoggedIn:!1,darkMode:!1,safeAreaTop:0,groups:[],selectedProducts:{},currentPage:"page1",currentGroupId:"",fullScreenPresentation:!1,launch:{productGroups:[],customAttributes:{}},sku:{},orientation:"portrait",focusedState:!1,platformId:null,mediaList:{},skuItems:[],customer:{},hasNotch:!1};const Ki=new class{host=null;state;subscribers;constructor(){this.state=Gi,this.subscribers=new Set}subscribe(e){return this.subscribers.add(e),()=>this.unsubscribe(e)}unsubscribe(e){this.subscribers.delete(e)}hostConnected(){}hostDisconnected(){this.subscribers.forEach((e=>this.unsubscribe(e)))}setState(e){this.state=e,this.subscribers.forEach((e=>e())),this.host&&this.host.requestUpdate()}setCurrentGroupId(e){this.setState({...this.state,currentGroupId:e})}setSelectedProdcuts(e){this.setState({...this.state,selectedProducts:e})}setPaywall(e){const t=e.template.initialState.groups?.map((e=>e.ref))||[],n=function(e,t){const n=e?.find((e=>t===e.id))?.products||[];return n.map((e=>{e.product_details=ts.instance.getProductDetails(e.name)})),n.forEach((e=>{Xi(e,n)})),n||[]}(e.sku_menus,e.template.initialState.currentGroupId),r={...this.state,...e.template.initialState,anySkuHasTrialOffer:Vi(e.sku_menus,t),anySkuHasPromoOffer:Wi(e.sku_menus,t),paywallId:e.id,selectedPaywall:e,launch:{...this.state.launch,productGroups:t},sku:Hi(e.template.initialState,e.sku_menus,n),skuItems:n};this.setState(r)}setCustomerAttribute(e){this.setState({...this.state,customer:{...this.state.customer,...e}})}removeCustomerAttribute(e){delete this.state.customer[e],this.setState(this.state)}setIsLoggedIn(e){this.setState({...this.state,isLoggedIn:e})}setMediaList(e){this.setState({...this.state,mediaList:e.reduce(((e,t)=>({...e,[t.name]:t})))})}setSafeAreaTop(e){this.setState({...this.state,safeAreaTop:e})}setFullScreenPresentation(e){this.setState({...this.state,fullScreenPresentation:e})}};class Yi{host;state;constructor(e){this.host=e,this.state=Ki.state,e.addController(this),this.handleStateChange=this.handleStateChange.bind(this),Ki.subscribe(this.handleStateChange)}handleStateChange(){this.state=Ki.state,this.host.requestUpdate()}hostConnected(){}hostDisconnected(){Ki.unsubscribe(this.handleStateChange)}}class Qi extends ui{contextConsumer=new Yi(this);styles(){return cs``}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ls(e,[pi,this.styles()]),e}disconnectedCallback(){super.disconnectedCallback(),this.contextConsumer.hostDisconnected()}}const Zi=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)},Ji={attribute:!0,type:String,converter:ks,reflect:!1,hasChanged:As},eo=(e=Ji,t,n)=>{const{kind:r,metadata:s}=n;let i=globalThis.litPropertyMetadata.get(s);if(void 0===i&&globalThis.litPropertyMetadata.set(s,i=new Map),i.set(n.name,e),"accessor"===r){const{name:r}=n;return{set(n){const s=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,s,e)},init(t){return void 0!==t&&this.P(r,void 0,e),t}}}if("setter"===r){const{name:r}=n;return function(n){const s=this[r];t.call(this,n),this.requestUpdate(r,s,e)}}throw Error("Unsupported decorator location: "+r)};function to(e){return(t,n)=>"object"==typeof n?eo(e,t,n):((e,t,n)=>{const r=t.hasOwnProperty(n);return t.constructor.createProperty(n,r?{...e,wrapped:!0}:e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}const no=async e=>{const t=new Set(Array.from(document.fonts.values()).map((e=>e.family)));return e.forEach((e=>{const n=function(e){return t=`${e.family}-${e.style}`,t.replace(/ /g,"");var t}(e);if(t.has(n))return;const r=new FontFace(n,`url(${e.file})`);document.fonts.add(r)})),document.fonts.ready.then()};let ro=class extends Qi{formFactor;styles(){return cs`
19
19
  :host {
20
20
  box-sizing: border-box;
21
21
  width: 100%;
22
22
  position: relative;
23
23
  }
24
- `}constructor(e,t){super(),wi.setPaywall(e),this.formFactor=t}getTemplate(){const{currentPage:e,selectedPaywall:t}=this.contextConsumer.state;return t.template.pages.find((t=>t.name===e))}render(){const e=this.getTemplate(),{backgroundContainer:t,header:r=[],footer:s=[],contentContainer:i}=e;return function(e){const t=Object.values(e).map((({id:e,family:t,style:r,file:s})=>("production"===n&&(s=s.replace(H,W)),{id:e,family:t,style:r,file:s})));Ei(t)}(this.contextConsumer.state.selectedPaywall.fonts),Gs`
24
+ `}constructor(e,t){super(),Ki.setPaywall(e),this.formFactor=t}getTemplate(){const{currentPage:e,selectedPaywall:t}=this.contextConsumer.state;return t.template.pages.find((t=>t.name===e))}render(){const e=this.getTemplate(),{backgroundContainer:t,header:r=[],footer:s=[],contentContainer:i}=e;return function(e){const t=Object.values(e).map((({id:e,family:t,style:r,file:s})=>("production"===n&&(s=s.replace(H,X)),{id:e,family:t,style:r,file:s})));no(t)}(this.contextConsumer.state.selectedPaywall.fonts),Ws`
25
25
  <nami-background-container
26
26
  .component=${t}
27
27
  .device=${this.formFactor}>
@@ -38,15 +38,12 @@
38
38
  <nami-footer
39
39
  .components=${s}>
40
40
  </nami-footer>
41
- `}};Ii=oe([Ai("nami-paywall")],Ii);class Ci{static instance=new Ci;emitter=Pr.getInstance();static allCampaigns(){if(!this.instance.sdkInitialized)throw new X;return gr(kn([...V.getCampaignRules(d)??[],...V.getCampaignRules(b)??[]]),"rule")}static isCampaignAvailable(e){if(!this.instance.sdkInitialized)throw new X;let t,n;"string"==typeof e?(t="label",n=e):e instanceof URL?(t="url",n=e.href):(t=e.type??"label",n=e.value);let r=kn(this.allCampaigns().filter((e=>e.type===t&&e.value===n)));return r=r.flatMap((e=>{const t=ts.allPaywalls().find((t=>t.id===e.paywall));return t?[e]:[]})),r.length>0}static async refresh(e){if(!this.instance.sdkInitialized)throw new X;const t=await Lr.instance.fetchPaywalls();await Or.instance.fetchCampaignRules(t),e&&e(this.allCampaigns())}static registerAvailableCampaignsHandler(e){this.instance.emitter.addListener(U,e)}static launch(e,t){let n,r;if("string"==typeof e?(r=e,n="label"):e instanceof URL?(r=e.href,n="url"):(({type:n,value:r}=e),n||="label"),!this.instance.sdkInitialized)throw new X;const s=kn(this.allCampaigns().filter((e=>e.type==n&&e.value==r))),i=ts.allPaywalls().find((e=>s.find((t=>t.paywall===e.id))));if(!i)throw new ee;const o=new Ii(i,Or.instance.currentFormFactor);if(t){const e=s.find((e=>e.paywall===i.id));this.instance.emitter.addListener(F,(({action:n,sku:r})=>{t({action:n,campaignId:e.rule,campaignName:e.name,paywallId:i.id,paywallName:i.name,skuId:r?.id})}))}return o}get sdkInitialized(){return Zr.instance.isInitialized}}class Pi{static instance=new Pi;externalId;constructor(){this.load()}setExternalId(e){return this.externalId=e,this}getExternalId(){return this.externalId}isLoggedIn(){return!!this.externalId}save(){return this.externalId?V.setNamiProfile({externalId:this.externalId}):V.removeNamiProfile(),this}load(){const e=V.getNamiProfile();e&&(this.externalId=e.externalId)}async login(e){const t=await pe.instance.login(e);t.external_id&&wi.setIsLoggedIn(!0),this.setExternalId(t.external_id).save()}async logout(){await pe.instance.logout(),wi.setIsLoggedIn(!1),this.setExternalId(void 0).save()}}var Oi,Ri;!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"}(Oi||(Oi={})),function(e){e.LOGIN="login",e.LOGOUT="logout",e.ADVERTISING_ID_SET="advertising_id_set",e.ADVERTISING_ID_CLEARED="advertising_id_cleared",e.VENDOR_ID_SET="vendor_id_set",e.VENDOR_ID_CLEARED="vendor_id_cleared",e.CUSTOMER_DATA_PLATFORM_ID_SET="customer_data_platform_id_set",e.CUSTOMER_DATA_PLATFORM_ID_CLEARED="customer_data_platform_id_cleared",e.ANONYMOUS_MODE_ON="anonymous_mode_on",e.ANONYMOUS_MODE_OFF="anonymous_mode_off",e.NAMI_DEVICE_ID_SET="nami_device_id_set",e.NAMI_DEVICE_ID_CLEARED="nami_device_id_cleared"}(Ri||(Ri={}));class Ti{static instance=new Ti;emitter=Pr.getInstance();static isLoggedIn(){return Pi.instance.isLoggedIn()}static loggedInId(){return this.instance.isSDKInitialized||K.debug(o),Pi.instance.getExternalId()}static async login(e){if(!this.instance.isSDKInitialized){const e=new X;throw this.invokeStateHandler(Ri.LOGIN,!1,e),e}try{await Pi.instance.login(e),this.invokeStateHandler(Ri.LOGIN,!0)}catch(e){throw this.invokeStateHandler(Ri.LOGIN,!1,e),e}}static async logout(){if(!this.instance.isSDKInitialized){const e=new X;throw this.invokeStateHandler(Ri.LOGOUT,!1,e),e}try{await Pi.instance.logout(),this.invokeStateHandler(Ri.LOGOUT,!0)}catch(e){throw this.invokeStateHandler(Ri.LOGOUT,!1,e),e}}static async setCustomerDataPlatformId(e){await this.updateCustomerDataPlatformId(e)}static async clearCustomerDataPlatformId(){await this.updateCustomerDataPlatformId(null)}static registerAccountStateHandler(e){return this.instance.emitter.on("accountStateChange",e),()=>{this.instance.emitter.off("accountStateChange",e)}}static setAnonymousMode(e){if(!this.instance.isSDKInitialized){const e=new X;throw this.invokeStateHandler(Ri.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e),e}K.info(`TODO: Setting anonymous mode: ${e}`)}static inAnonymousMode(){if(!this.instance.isSDKInitialized){const e=new Error(o);throw this.invokeStateHandler(Ri.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e),e}return V.getAnonymousMode()}static setCustomerAttribute(e,t){if(!this.instance.isSDKInitialized)throw new Error(o);V.setCustomerAttribute(e,t),le(Oi.PAYWALL_PERSONALIZATION)?(wi.setCustomerAttribute({[e]:t}),K.debug(`This customer attribute you set is now available for paywall personalization using the smart text variable: ${e}`)):K.warn(`The customer attribute ${e} is not available for using on a paywall, because your account's plan does not include paywall personalization. Contact support@nami.ml for details.`)}static getCustomerAttribute(e){if(!this.instance.isSDKInitialized)throw new Error(o);const t=V.getCustomerAttribute(e);return null!=t?le(Oi.PAYWALL_PERSONALIZATION)?K.debug(`Found customer attribute. ${e} is available for paywall personalization on this device.`):K.warn(`Found customer attribute. ${e} is not available for use on a paywall because paywall personalization is not included in your account's plan. Contact support@nami.ml for details.`):K.warn(`No ${e} customer attribute found.`),t}static clearCustomerAttribute(e){if(!this.instance.isSDKInitialized)throw new Error(o);V.clearCustomerAttribute(e)?(wi.removeCustomerAttribute(e),K.warn(`This customer attribute has been cleared. ${e} is no longer available for paywall personalization on this device. A default value will be used if set in the Nami Control Center.`)):K.warn(`No value to clear for attribute ${e}.`)}static clearAllCustomerAttributes(){if(!this.instance.isSDKInitialized)throw new Error(o);V.getAllCustomerAttributes().forEach((e=>{wi.removeCustomerAttribute(e)})),V.clearAllCustomerAttributes(),K.warn("All customer attribute have been cleared. customer's smart text will no longer be personalized for this device. A default value will be used if set in the Nami Control Center.")}static invokeStateHandler(e,t,n){this.instance.emitter.emit("accountStateChange",e,t,n)}get isSDKInitialized(){return Zr.instance.isInitialized}static async updateCustomerDataPlatformId(e){if(!this.instance.isSDKInitialized){const e=new Error(o);throw this.invokeStateHandler(Ri.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e),e}if(this.inAnonymousMode()){const e=new Error(c);throw this.invokeStateHandler(Ri.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e),e}try{await Rr.instance.updateDeviceField("customer_data_platform_id",e),this.invokeStateHandler(Ri.CUSTOMER_DATA_PLATFORM_ID_SET,!0)}catch(e){this.invokeStateHandler(Ri.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e)}}}function Li(e,t){return Array.isArray(e)?e.reduce(((e,n)=>{const r=Li(n,t);return Array.isArray(r)?[...e,...r]:[...e,r]}),[]):null==e?e:"object"==typeof e?Object.entries(e).reduce(((e,[n,r])=>{const s="newRow"===n?r:Li(r,t);return{...e,[n]:s}}),{}):"string"==typeof e?Ui(e,t):e}function Ni(e){return e.assertions?e.assertions.every(Di):!!e.orAssertions&&(!e.orAssertions.length||e.orAssertions.some(Di))}function Mi(e,t){const n=wi.state,r={state:n,launch:n.launch,sku:n.sku,customer:n.customer};return"string"==typeof e&&e.startsWith("${")&&(e=Ui(e,r)),e}function Di({value:e,expected:t,operator:n}){const r=/\${[A-Za-z.]+}/g;return e=Mi(e),t=Mi(t),"equals"===n?e===t:"notEquals"===n?e!==t:"contains"===n?(Array.isArray(e)||"string"==typeof e||e instanceof String||(e=e.toString()),e.includes(t)):"notContains"===n?(Array.isArray(e)||"string"==typeof e||e instanceof String||(e=e.toString()),!e.includes(t)):"set"===n?!!e&&!e.toString().match(r):"notSet"===n&&(!e||e.toString().match(r))}function zi(e,{convertToUrl:t}={convertToUrl:!1}){return Object.entries(e).reduce(((e,[n,{content:r}])=>(t&&"string"!=typeof r&&r&&(r=URL.createObjectURL(r)),{...e,[n]:r})),{})}function Ui(e,t){let n=e;if("string"!=typeof e)return n;for(const[s,i]of Array.from(e.matchAll(B))){const o=Ui(i,t);if(s===e)return r(s,o);o!==i&&(n=n.replace(i,o)),n=n.replace(B,r)}return n;function r(e,n){const r=function(e,...t){let n=e;for(const e of t){if(null==n)return;n=Array.isArray(n)?n[+e]:n[e]}return n}(t,...n.split("."));return void 0===r?e:"string"!=typeof r?r:Ui(r,t)}}const Fi={};function ji(e,t){Fi[e]=t}function Bi(e){if("condition"===e.component){if(!Ni(e))return null;const t=e.components?.map((e=>Bi(e)));return t}return e.conditionAttributes&&(e=function({conditionAttributes:e,...t}){return e?e.reduce(((e,t)=>Ni(t)?(Object.entries(t.attributes).forEach((([e,n])=>{t.attributes[e]=Mi(n)})),{...e,...t.attributes}):e),t):t}(e)),Object.keys(e).forEach((t=>{e[t]=Mi(e[t])})),e?.component in Fi?new Fi[e.component](e):(K.debug("Cannot render component:",e?.component),null)}const Hi={upperLeft:"border-top-left-radius",upperRight:"border-top-right-radius",lowerLeft:"border-bottom-left-radius",lowerRight:"border-bottom-right-radius"},Wi={left:"border-left-style",right:"border-right-style",top:"border-top-style",bottom:"border-bottom-style"},Gi={top:"start",left:"start",right:"end",bottom:"end",center:"center"};function qi(e){let t;return t="number"==typeof e?`${e}px`:"fitContent"==e?"fit-content":e,`${t} !important`}function Ki(e,t){return(n=e.fillColor||"transparent").includes("gradient")?`background-image: ${n};`:`background-color: ${n};`;var n}function Vi({direction:e}){return`flex-direction: ${"vertical"===e?"column":"row"};`}function Yi(e){return`\n padding-right: ${e.rightPadding??0}px;\n padding-left: ${e.leftPadding??0}px;\n padding-top: ${e.topPadding??0}px;\n padding-bottom: ${e.bottomPadding??0}px;\n margin-right: ${e.rightMargin??0}px;\n margin-left: ${e.leftMargin??0}px;\n margin-top: ${e.topMargin??0}px;\n margin-bottom: ${e.bottomMargin??0}px;\n `}function Xi({alignment:e}){return`\n justify-content: ${e&&Gi[e]||"center"};\n `}function Qi(e){return e?"\n text-decoration: line-through;\n text-decoration-thickness: auto;\n ":""}function Zi({fontName:e}){const[t]=(e||"").split("-");return`font-family: '${e}', '${t}', 'Helvetica';`}function Ji(e,t){return`\n transition: all 0.3s;\n ${function({grow:e}){return e?"flex-grow: 1;":""}(e)}\n ${Yi(e)}\n ${function({moveX:e=0,moveY:t=0}){return`\n position: relative;\n left: ${"number"==typeof e?`${e}px`:e};\n transform: translate(\n 0,\n ${"number"==typeof t?`${t}px`:t}\n );\n `}(e)}\n ${function(e,t){const n=t&&e.focusedBorderColor?e.focusedBorderColor:e.borderColor,r=t&&e.focusedBorderRadius?e.focusedBorderRadius:e.borderRadius??0,s=t&&e.focusedRoundBorders?e.focusedRoundBorders:e.roundBorders||null,i=s?s.map((e=>`${Hi[e]}: ${r}px;`)).join("\n"):`border-radius: ${r}px;`,o=t&&e.focusedBorderWidth?e.focusedBorderWidth:e.borderWidth||0,a=t&&e.focusedBorders?e.focusedBorders:e.borders||[];return`\n border-color: ${n?`${n} !important`:"transparent"};\n border-width: ${o}px !important;\n ${a.length?a.map((e=>`${Wi[e]}: solid;`)).join("\n"):"border-style: solid;"}\n ${i}\n `}(e,t)}\n ${function({alignment:e}){return`\n align-items: ${e&&Gi[e]||"center"};\n `}(e)}\n ${Xi(e)}\n ${function(e){const t=e.width||e.fixedWidth,n=e.height||e.fixedHeight;return`\n max-width: 100%;\n ${void 0!==t?`width: ${qi(t)};`:""}\n ${void 0!==n?`height: ${qi(n)};`:""}\n `}(e)}\n ${function({zIndex:e}){return`z-index: ${e??"initial"};`}(e)}\n ${function(e){if(!e.dropShadow)return"";const t=new RegExp("(-?[0-9]+)\\s(-?[0-9]+)\\s([0-9]+)\\s(rgba?\\([0-9\\s\\/.]+\\))","gi").exec(e.dropShadow);return t&&5===t.length?`\n box-shadow: ${t[1]}px ${t[2]}px\n ${t[3]}px ${t[4]};\n `:""}(e)}\n `}function eo(e){if(!e)return"";const[t,n]=e.split("-");return`\n align-self: ${t};\n ${n}: 0;\n `}let to=class extends ki{component;constructor(e){super(),this.component=e}styles(){const e=this.component,t=e.height||e.fixedHeight||e.width||e.fixedWidth;return as(`\n :host {\n display: block;\n ${t?"":"flex-grow: 1;"}\n ${Ji(e)}\n }\n `)}render(){return Gs``}};oe([$i({type:Object})],to.prototype,"component",void 0),to=oe([Ai("nami-spacer")],to),ji("spacer",to);const{NAMI_CLOSE_PAYWALL:no="namiClosePaywall",NAMI_RESTORE_PURCHASES:ro="namiRestorePurchases",NAMI_SIGN_IN:so="namiSignIn",NAMI_BUY_SKU:io="namiBuySKU",SET_STATE:oo="setState",NAMI_SELECT_SKU:ao="namiSelectSKU",NAMI_PURCHASE_SELECTED_SKU:co="namiPurchaseSelectedSKU",NAMI_DEEP_LINK:lo="namiDeeplink",NAMI_NAVIGATE_TO_SCREEN:uo="namiNavigateToScreen",NAMI_RELOAD_PRODUCTS:ho="namiReloadProducts",UNSUPPORTED:po="",NAMI_PURCHASE_SUCCESS:fo="namiPurchaseSuccess",NAMI_PURCHASE_CANCELLED:go="namiPurchaseCancelled",NAMI_PURCHASE_FAILED:mo="namiPurchaseFailed",NAMI_PURCHASE_PENDING:bo="namiPurchasePending",NAMI_PURCHASE_UNKNOWN:yo="namiPurchaseUnknown",NAMI_SHOW_PAYWALL:_o="namiShowPaywall",NAMI_PAGE_CHANGE:wo="namiPageChange",NAMI_TOGGLE_CHANGE:vo="namiToggleChange",NAMI_SLIDE_CHANGE:ko="namiSlideChange"}={};function Ao(t,n,r){!function(t,n){let r;switch(t.function){case no:r=e.NamiPaywallAction.CLOSE_PAYWALL,function(){if(!So(Jr.PAYWALL_CLOSE_REQUESTED)&&window)window.history.back()}();break;case ro:r=e.NamiPaywallAction.RESTORE_PURCHASES,function(){const e=le(Oi.THIRD_PARTY_TRANSACTIONS);So(Jr.PAYWALL_RESTORE_REQUESTED)||e||(K.warn("NamiPaywallManager.registerRestoreHandler is not registered, so restore option on the paywall will use default behavior."),K.info("TODO: restore default purchase"))}();break;case so:r=e.NamiPaywallAction.SIGN_IN,So(Jr.PAYWALL_SIGNIN_REQUESTED);break;case lo:s=t.parameters?.url,null!=s?So(Jr.PAYWALL_DEEPLINK_ACTION,s)||"undefined"!=typeof window&&window.open(s,"_blank"):K.debug("Paywall deep link action invoked, but no url present.");break;case po:break;case io:r=e.NamiPaywallAction.BUY_SKU,function(e){K.info("TODO: implement buySKU",e)}(n);break;case uo:!function(e){if(e.parameters?.screen){const t=e.parameters.screen;window.location.replace(t),K.info("TODO: implement navigateToScreen with data")}}(t);break;case oo:!function(){const e=ts.allPaywalls().find((e=>e.id==wi.state?.paywallId));e.template.initialState={...e.template.initialState,currentGroupId:wi.state?.currentGroupId},wi.setPaywall(e)}();break;case ao:r=e.NamiPaywallAction.SELECT_SKU,function(e){const t=wi.state?.currentGroupId,n=wi.state?.selectedProducts;t&&e.id!=n[t]&&(n[t]=e.id,wi.setSelectedProdcuts(n))}(n);break;case co:r=e.NamiPaywallAction.PURCHASE_SELECTED_SKU,K.info("TODO: implement purchase selected SKU");break;case ho:K.info("TODO: implement reload products")}var s;r&&Pr.getInstance().emit(F,{action:r,sku:n});Mi(t.parameters?.promo),K.info("TODO: create paywall context and invoke PaywallActionHandler")}(t||{function:n,parameters:null},r)}function So(e,...t){const n=Pr.getInstance();return n.emit(e,...t),n.listenerCount(e)>0}let xo=class extends ki{component;constructor(e){super(),this.component=e,this.addEventListener("click",this._handleClick)}_handleClick=()=>{Ao(this.component.onTap,this.component.actionTap)};styles(){const e="vertical"===this.component.direction?"margin-top":"margin-left";return as(`\n :host {\n display: flex;\n flex-direction: column;\n cursor: pointer;\n ${Ki(this.component)}\n ${Vi(this.component)}\n ${Ji(this.component)}\n }\n\n :host > :not(:first-child) {\n ${e}: ${this.component.spacing||0}px;\n }\n }\n `)}render(){return function(e){const t={sku:wi.state.sku};return Li(e.components||[],Li(t,t))}(this.component).map((e=>Bi(e)))}};oe([$i({type:Object})],xo.prototype,"component",void 0),xo=oe([Ai("nami-button")],xo),ji("button",xo);let $o=class extends ki{components=[];zIndex="2";device="desktop";inFullScreen;styles(){return as(`\n :host {\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: center;\n z-index: ${parseInt(this.zIndex,10)};\n margin-top: ${"phone"!==this.device||this.inFullScreen?0:40}px;\n }`)}render(){return this.components.map((e=>Bi(e)))}};oe([$i({type:Array})],$o.prototype,"components",void 0),oe([$i({type:String})],$o.prototype,"zIndex",void 0),oe([$i({type:String})],$o.prototype,"device",void 0),oe([$i({type:Boolean})],$o.prototype,"inFullScreen",void 0),$o=oe([Ai("nami-header")],$o);let Eo=class extends ki{components=[];zIndex="3";styles(){return as(`\n :host {\n text-align: center !important;\n bottom: 0;\n position: absolute;\n width: 100%;\n z-index: ${this.zIndex};\n transition: all 0.3s;\n }\n `)}render(){return this.components.map((e=>Bi(e)))}};oe([$i({type:Array})],Eo.prototype,"components",void 0),oe([$i({type:String})],Eo.prototype,"zIndex",void 0),Eo=oe([Ai("nami-footer")],Eo);const Io=2;class Co{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}class Po extends Co{constructor(e){if(super(e),this.it=Ks,e.type!==Io)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Ks||null==e)return this._t=void 0,this.it=e;if(e===qs)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}Po.directiveName="unsafeHTML",Po.resultType=1;const Oo=(e=>(...t)=>({_$litDirective$:e,values:t}))(Po);function Ro(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let To={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function Lo(e){To=e}const No=/[&<>"']/,Mo=new RegExp(No.source,"g"),Do=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,zo=new RegExp(Do.source,"g"),Uo={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Fo=e=>Uo[e];function jo(e,t){if(t){if(No.test(e))return e.replace(Mo,Fo)}else if(Do.test(e))return e.replace(zo,Fo);return e}const Bo=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function Ho(e){return e.replace(Bo,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const Wo=/(^|[^\[])\^/g;function Go(e,t){let n="string"==typeof e?e:e.source;t=t||"";const r={replace:(e,t)=>{let s="string"==typeof t?t:t.source;return s=s.replace(Wo,"$1"),n=n.replace(e,s),r},getRegex:()=>new RegExp(n,t)};return r}function qo(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const Ko={exec:()=>null};function Vo(e,t){const n=e.replace(/\|/g,((e,t,n)=>{let r=!1,s=t;for(;--s>=0&&"\\"===n[s];)r=!r;return r?"|":" |"})).split(/ \|/);let r=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(/\\\|/g,"|");return n}function Yo(e,t,n){const r=e.length;if(0===r)return"";let s=0;for(;s<r;){const i=e.charAt(r-s-1);if(i!==t||n){if(i===t||!n)break;s++}else s++}return e.slice(0,r-s)}function Xo(e,t,n,r){const s=t.href,i=t.title?jo(t.title):null,o=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){r.state.inLink=!0;const e={type:"link",raw:n,href:s,title:i,text:o,tokens:r.inlineTokens(o)};return r.state.inLink=!1,e}return{type:"image",raw:n,href:s,title:i,text:jo(o)}}class Qo{options;rules;lexer;constructor(e){this.options=e||To}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:Yo(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t){const n=e.match(/^(\s+)(?:```)/);if(null===n)return t;const r=n[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[n]=t;return n.length>=r.length?e.slice(r.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=Yo(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let e=t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,"\n $1");e=Yo(e.replace(/^ *>[ \t]?/gm,""),"\n");const n=this.lexer.state.top;this.lexer.state.top=!0;const r=this.lexer.blockTokens(e);return this.lexer.state.top=n,{type:"blockquote",raw:t[0],tokens:r,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const r=n.length>1,s={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");const i=new RegExp(`^( {0,3}${n})((?:[\t ][^\\n]*)?(?:\\n|$))`);let o="",a="",c=!1;for(;e;){let n=!1;if(!(t=i.exec(e)))break;if(this.rules.block.hr.test(e))break;o=t[0],e=e.substring(o.length);let r=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),l=e.split("\n",1)[0],u=0;this.options.pedantic?(u=2,a=r.trimStart()):(u=t[2].search(/[^ ]/),u=u>4?1:u,a=r.slice(u),u+=t[1].length);let h=!1;if(!r&&/^ *$/.test(l)&&(o+=l+"\n",e=e.substring(l.length+1),n=!0),!n){const t=new RegExp(`^ {0,${Math.min(3,u-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),n=new RegExp(`^ {0,${Math.min(3,u-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),s=new RegExp(`^ {0,${Math.min(3,u-1)}}(?:\`\`\`|~~~)`),i=new RegExp(`^ {0,${Math.min(3,u-1)}}#`);for(;e;){const c=e.split("\n",1)[0];if(l=c,this.options.pedantic&&(l=l.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),s.test(l))break;if(i.test(l))break;if(t.test(l))break;if(n.test(e))break;if(l.search(/[^ ]/)>=u||!l.trim())a+="\n"+l.slice(u);else{if(h)break;if(r.search(/[^ ]/)>=4)break;if(s.test(r))break;if(i.test(r))break;if(n.test(r))break;a+="\n"+l}h||l.trim()||(h=!0),o+=c+"\n",e=e.substring(c.length+1),r=l.slice(u)}}s.loose||(c?s.loose=!0:/\n *\n *$/.test(o)&&(c=!0));let p,d=null;this.options.gfm&&(d=/^\[[ xX]\] /.exec(a),d&&(p="[ ] "!==d[0],a=a.replace(/^\[[ xX]\] +/,""))),s.items.push({type:"list_item",raw:o,task:!!d,checked:p,loose:!1,text:a,tokens:[]}),s.raw+=o}s.items[s.items.length-1].raw=o.trimEnd(),s.items[s.items.length-1].text=a.trimEnd(),s.raw=s.raw.trimEnd();for(let e=0;e<s.items.length;e++)if(this.lexer.state.top=!1,s.items[e].tokens=this.lexer.blockTokens(s.items[e].text,[]),!s.loose){const t=s.items[e].tokens.filter((e=>"space"===e.type)),n=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));s.loose=n}if(s.loose)for(let e=0;e<s.items.length;e++)s.items[e].loose=!0;return s}}html(e){const t=this.rules.block.html.exec(e);if(t){return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}}def(e){const t=this.rules.block.def.exec(e);if(t){const e=t[1].toLowerCase().replace(/\s+/g," "),n=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:r}}}table(e){const t=this.rules.block.table.exec(e);if(!t)return;if(!/[:|]/.test(t[2]))return;const n=Vo(t[1]),r=t[2].replace(/^\||\| *$/g,"").split("|"),s=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[],i={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(const e of r)/^ *-+: *$/.test(e)?i.align.push("right"):/^ *:-+: *$/.test(e)?i.align.push("center"):/^ *:-+ *$/.test(e)?i.align.push("left"):i.align.push(null);for(const e of n)i.header.push({text:e,tokens:this.lexer.inline(e)});for(const e of s)i.rows.push(Vo(e,i.header.length).map((e=>({text:e,tokens:this.lexer.inline(e)}))));return i}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:jo(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const t=Yo(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let r=0;r<e.length;r++)if("\\"===e[r])r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return-1}(t[2],"()");if(e>-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],r="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^</.test(n)&&(n=this.options.pedantic&&!/>$/.test(e)?n.slice(1):n.slice(1,-1)),Xo(t,{href:n?n.replace(this.rules.inline.anyPunctuation,"$1"):n,title:r?r.replace(this.rules.inline.anyPunctuation,"$1"):r},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const e=t[(n[2]||n[1]).replace(/\s+/g," ").toLowerCase()];if(!e){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return Xo(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r)return;if(r[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(r[1]||r[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const n=[...r[0]].length-1;let s,i,o=n,a=0;const c="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);null!=(r=c.exec(t));){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(i=[...s].length,r[3]||r[4]){o+=i;continue}if((r[5]||r[6])&&n%3&&!((n+i)%3)){a+=i;continue}if(o-=i,o>0)continue;i=Math.min(i,i+o+a);const t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+i);if(Math.min(n,i)%2){const e=c.slice(1,-1);return{type:"em",raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}const l=c.slice(2,-2);return{type:"strong",raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const n=/[^ ]/.test(e),r=/^ /.test(e)&&/ $/.test(e);return n&&r&&(e=e.substring(1,e.length-1)),e=jo(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=jo(t[1]),n="mailto:"+e):(e=jo(t[1]),n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=jo(t[0]),n="mailto:"+e;else{let r;do{r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(r!==t[0]);e=jo(t[0]),n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:jo(t[0]),{type:"text",raw:t[0],text:e}}}}const Zo=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Jo=/(?:[*+-]|\d{1,9}[.)])/,ea=Go(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,Jo).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),ta=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,na=/(?!\s*\])(?:\\.|[^\[\]\\])+/,ra=Go(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",na).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),sa=Go(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Jo).getRegex(),ia="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",oa=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,aa=Go("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",oa).replace("tag",ia).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ca=Go(ta).replace("hr",Zo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ia).getRegex(),la={blockquote:Go(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ca).getRegex(),code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,def:ra,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:Zo,html:aa,lheading:ea,list:sa,newline:/^(?: *(?:\n|$))+/,paragraph:ca,table:Ko,text:/^[^\n]+/},ua=Go("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Zo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ia).getRegex(),ha={...la,table:ua,paragraph:Go(ta).replace("hr",Zo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ua).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ia).getRegex()},pa={...la,html:Go("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",oa).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ko,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Go(ta).replace("hr",Zo).replace("heading"," *#{1,6} *[^\n]").replace("lheading",ea).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},da=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,fa=/^( {2,}|\\)\n(?!\s*$)/,ga="\\p{P}\\p{S}",ma=Go(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,ga).getRegex(),ba=Go(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,ga).getRegex(),ya=Go("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,ga).getRegex(),_a=Go("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,ga).getRegex(),wa=Go(/\\([punct])/,"gu").replace(/punct/g,ga).getRegex(),va=Go(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ka=Go(oa).replace("(?:--\x3e|$)","--\x3e").getRegex(),Aa=Go("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",ka).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Sa=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,xa=Go(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Sa).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),$a=Go(/^!?\[(label)\]\[(ref)\]/).replace("label",Sa).replace("ref",na).getRegex(),Ea=Go(/^!?\[(ref)\](?:\[\])?/).replace("ref",na).getRegex(),Ia={_backpedal:Ko,anyPunctuation:wa,autolink:va,blockSkip:/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,br:fa,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:Ko,emStrongLDelim:ba,emStrongRDelimAst:ya,emStrongRDelimUnd:_a,escape:da,link:xa,nolink:Ea,punctuation:ma,reflink:$a,reflinkSearch:Go("reflink|nolink(?!\\()","g").replace("reflink",$a).replace("nolink",Ea).getRegex(),tag:Aa,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:Ko},Ca={...Ia,link:Go(/^!?\[(label)\]\((.*?)\)/).replace("label",Sa).getRegex(),reflink:Go(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Sa).getRegex()},Pa={...Ia,escape:Go(da).replace("])","~|])").getRegex(),url:Go(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Oa={...Pa,br:Go(fa).replace("{2,}","*").getRegex(),text:Go(Pa.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ra={normal:la,gfm:ha,pedantic:pa},Ta={normal:Ia,gfm:Pa,breaks:Oa,pedantic:Ca};class La{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||To,this.options.tokenizer=this.options.tokenizer||new Qo,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:Ra.normal,inline:Ta.normal};this.options.pedantic?(t.block=Ra.pedantic,t.inline=Ta.pedantic):this.options.gfm&&(t.block=Ra.gfm,this.options.breaks?t.inline=Ta.breaks:t.inline=Ta.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ra,inline:Ta}}static lex(e,t){return new La(t).lex(e)}static lexInline(e,t){return new La(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){const t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){let n,r,s,i;for(e=this.options.pedantic?e.replace(/\t/g," ").replace(/^ +$/gm,""):e.replace(/^( *)(\t+)/gm,((e,t,n)=>t+" ".repeat(n.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),r=t[t.length-1],!r||"paragraph"!==r.type&&"text"!==r.type?t.push(n):(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=r.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),r=t[t.length-1],!r||"paragraph"!==r.type&&"text"!==r.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(r.raw+="\n"+n.raw,r.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=r.text);else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(s=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const n=e.slice(1);let r;this.options.extensions.startBlock.forEach((e=>{r=e.call({lexer:this},n),"number"==typeof r&&r>=0&&(t=Math.min(t,r))})),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(s)))r=t[t.length-1],i&&"paragraph"===r.type?(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n),i=s.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),r=t[t.length-1],r&&"text"===r.type?(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,r,s,i,o,a,c=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(i=this.tokenizer.rules.inline.reflinkSearch.exec(c));)e.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(c=c.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(i=this.tokenizer.rules.inline.blockSkip.exec(c));)c=c.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(i=this.tokenizer.rules.inline.anyPunctuation.exec(c));)c=c.slice(0,i.index)+"++"+c.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(o||(a=""),o=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.escape(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(e))e=e.substring(n.raw.length),r=t[t.length-1],r&&"text"===n.type&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);else if(n=this.tokenizer.link(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(n.raw.length),r=t[t.length-1],r&&"text"===n.type&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(e,c,a))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(e))e=e.substring(n.raw.length),t.push(n);else if(this.state.inLink||!(n=this.tokenizer.url(e))){if(s=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const n=e.slice(1);let r;this.options.extensions.startInline.forEach((e=>{r=e.call({lexer:this},n),"number"==typeof r&&r>=0&&(t=Math.min(t,r))})),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(s))e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(a=n.raw.slice(-1)),o=!0,r=t[t.length-1],r&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(n.raw.length),t.push(n);return t}}class Na{options;constructor(e){this.options=e||To}code(e,t,n){const r=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",r?'<pre><code class="language-'+jo(r)+'">'+(n?e:jo(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:jo(e,!0))+"</code></pre>\n"}blockquote(e){return`<blockquote>\n${e}</blockquote>\n`}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}>\n`}hr(){return"<hr>\n"}list(e,t,n){const r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+r+">\n"}listitem(e,t,n){return`<li>${e}</li>\n`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>\n`}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}tablerow(e){return`<tr>\n${e}</tr>\n`}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>\n`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){const r=qo(e);if(null===r)return n;let s='<a href="'+(e=r)+'"';return t&&(s+=' title="'+t+'"'),s+=">"+n+"</a>",s}image(e,t,n){const r=qo(e);if(null===r)return n;let s=`<img src="${e=r}" alt="${n}"`;return t&&(s+=` title="${t}"`),s+=">",s}text(e){return e}}class Ma{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class Da{options;renderer;textRenderer;constructor(e){this.options=e||To,this.options.renderer=this.options.renderer||new Na,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ma}static parse(e,t){return new Da(t).parse(e)}static parseInline(e,t){return new Da(t).parseInline(e)}parse(e,t=!0){let n="";for(let r=0;r<e.length;r++){const s=e[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]){const e=s,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){n+=t||"";continue}}switch(s.type){case"space":continue;case"hr":n+=this.renderer.hr();continue;case"heading":{const e=s;n+=this.renderer.heading(this.parseInline(e.tokens),e.depth,Ho(this.parseInline(e.tokens,this.textRenderer)));continue}case"code":{const e=s;n+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case"table":{const e=s;let t="",r="";for(let t=0;t<e.header.length;t++)r+=this.renderer.tablecell(this.parseInline(e.header[t].tokens),{header:!0,align:e.align[t]});t+=this.renderer.tablerow(r);let i="";for(let t=0;t<e.rows.length;t++){const n=e.rows[t];r="";for(let t=0;t<n.length;t++)r+=this.renderer.tablecell(this.parseInline(n[t].tokens),{header:!1,align:e.align[t]});i+=this.renderer.tablerow(r)}n+=this.renderer.table(t,i);continue}case"blockquote":{const e=s,t=this.parse(e.tokens);n+=this.renderer.blockquote(t);continue}case"list":{const e=s,t=e.ordered,r=e.start,i=e.loose;let o="";for(let t=0;t<e.items.length;t++){const n=e.items[t],r=n.checked,s=n.task;let a="";if(n.task){const e=this.renderer.checkbox(!!r);i?n.tokens.length>0&&"paragraph"===n.tokens[0].type?(n.tokens[0].text=e+" "+n.tokens[0].text,n.tokens[0].tokens&&n.tokens[0].tokens.length>0&&"text"===n.tokens[0].tokens[0].type&&(n.tokens[0].tokens[0].text=e+" "+n.tokens[0].tokens[0].text)):n.tokens.unshift({type:"text",text:e+" "}):a+=e+" "}a+=this.parse(n.tokens,i),o+=this.renderer.listitem(a,s,!!r)}n+=this.renderer.list(o,t,r);continue}case"html":{const e=s;n+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=s;n+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let i=s,o=i.tokens?this.parseInline(i.tokens):i.text;for(;r+1<e.length&&"text"===e[r+1].type;)i=e[++r],o+="\n"+(i.tokens?this.parseInline(i.tokens):i.text);n+=t?this.renderer.paragraph(o):o;continue}default:{const e='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let r=0;r<e.length;r++){const s=e[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]){const e=this.options.extensions.renderers[s.type].call({parser:this},s);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){n+=e||"";continue}}switch(s.type){case"escape":{const e=s;n+=t.text(e.text);break}case"html":{const e=s;n+=t.html(e.text);break}case"link":{const e=s;n+=t.link(e.href,e.title,this.parseInline(e.tokens,t));break}case"image":{const e=s;n+=t.image(e.href,e.title,e.text);break}case"strong":{const e=s;n+=t.strong(this.parseInline(e.tokens,t));break}case"em":{const e=s;n+=t.em(this.parseInline(e.tokens,t));break}case"codespan":{const e=s;n+=t.codespan(e.text);break}case"br":n+=t.br();break;case"del":{const e=s;n+=t.del(this.parseInline(e.tokens,t));break}case"text":{const e=s;n+=t.text(e.text);break}default:{const e='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}}class za{options;constructor(e){this.options=e||To}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}const Ua=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.#t(La.lex,Da.parse);parseInline=this.#t(La.lexInline,Da.parseInline);Parser=Da;Renderer=Na;TextRenderer=Ma;Lexer=La;Tokenizer=Qo;Hooks=za;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(const r of e)switch(n=n.concat(t.call(this,r)),r.type){case"table":{const e=r;for(const r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(const r of e.rows)for(const e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{const e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((r=>{const s=e[r].flat(1/0);n=n.concat(this.walkTokens(s,t))})):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let r=e.renderer.apply(this,t);return!1===r&&(r=n.apply(this,t)),r}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){const t=this.defaults.renderer||new Na(this.defaults);for(const n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if("options"===n)continue;const r=n,s=e.renderer[r],i=t[r];t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=i.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new Qo(this.defaults);for(const n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;const r=n,s=e.tokenizer[r],i=t[r];t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new za;for(const n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if("options"===n)continue;const r=n,s=e.hooks[r],i=t[r];za.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(s.call(t,e)).then((e=>i.call(t,e)));const n=s.call(t,e);return i.call(t,n)}:t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return La.lex(e,t??this.defaults)}parser(e,t){return Da.parse(e,t??this.defaults)}#t(e,t){return(n,r)=>{const s={...r},i={...this.defaults,...s};!0===this.defaults.async&&!1===s.async&&(i.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),i.async=!0);const o=this.#n(!!i.silent,!!i.async);if(null==n)return o(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof n)return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(i.hooks&&(i.hooks.options=i),i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(n):n).then((t=>e(t,i))).then((e=>i.hooks?i.hooks.processAllTokens(e):e)).then((e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then((()=>e)):e)).then((e=>t(e,i))).then((e=>i.hooks?i.hooks.postprocess(e):e)).catch(o);try{i.hooks&&(n=i.hooks.preprocess(n));let r=e(n,i);i.hooks&&(r=i.hooks.processAllTokens(r)),i.walkTokens&&this.walkTokens(r,i.walkTokens);let s=t(r,i);return i.hooks&&(s=i.hooks.postprocess(s)),s}catch(e){return o(e)}}}#n(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="<p>An error occurred:</p><pre>"+jo(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Fa(e,t){return Ua.parse(e,t)}function ja(e,t=""){const n=e.linkColor||"blue";return as(`\n ${t} a:link {\n color: ${n};\n text-decoration-line: underline;\n }\n ${t} a:visited {\n color: ${n};\n text-decoration-line: underline;\n }\n ${t} a:hover {\n color: ${n};\n }\n ${t} a:active {\n color: ${n};\n text-decoration-line: underline;\n }\n `)}Fa.options=Fa.setOptions=function(e){return Ua.setOptions(e),Fa.defaults=Ua.defaults,Lo(Fa.defaults),Fa},Fa.getDefaults=Ro,Fa.defaults=To,Fa.use=function(...e){return Ua.use(...e),Fa.defaults=Ua.defaults,Lo(Fa.defaults),Fa},Fa.walkTokens=function(e,t){return Ua.walkTokens(e,t)},Fa.parseInline=Ua.parseInline,Fa.Parser=Da,Fa.parser=Da.parse,Fa.Renderer=Na,Fa.TextRenderer=Ma,Fa.Lexer=La,Fa.lexer=La.lex,Fa.Tokenizer=Qo,Fa.Hooks=za,Fa.parse=Fa,Fa.options,Fa.setOptions,Fa.use,Fa.walkTokens,Fa.parseInline,Da.parse,La.lex;let Ba=class extends ki{component;constructor(e){super(),this.component=e}styles(){const{component:e}=this;return"legal"===e.textType?as(`\n :host {\n display: block;\n overflow-wrap: break-word;\n width: fit-content;\n ${Ki(e)}\n color: ${e.fontColor};\n font-size: ${e.fontSize??12}px;\n text-align: ${e.alignment||"center"};\n ${Zi(e)}\n ${Ji(e)}\n }\n :host p {\n margin: 0;\n }\n ${ja(e,":host")}\n `):as(`\n :host {\n display: flex;\n width: fit-content;\n ${function(e){return"fitContent"===e.width?"white-space: nowrap;":"overflow-wrap: anywhere;"}(e)}\n ${Ki(e)}\n ${e.fontColor?`color: ${e.fontColor};`:""}\n font-size: ${e.fontSize??12}px;\n text-align: ${e.alignment||"center"};\n ${Qi("string"!=typeof e.strikethrough&&e.strikethrough)}\n ${Zi(e)}\n ${Ji(e)}\n }\n :host p {\n margin: 0;\n }\n ${as(ja(e,":host"))}\n `)}render(){if(!this.component.text)return this.style.display="none",null;const e=Fa.parse(this.component.text);return Gs`${Oo(e)}`}};oe([$i({type:Object})],Ba.prototype,"component",void 0),Ba=oe([Ai("nami-text")],Ba);let Ha=class extends ki{component;constructor(e){super(),this.component=e}styles(){return as(`\n :host { \n display: flex;\n transition: all 0.3s;\n &:not(:first-child) {\n margin-top: ${this.component.spacing||0}px;\n }\n }\n `)}render(){return Gs`<slot></slot>`}};oe([$i({type:Object})],Ha.prototype,"component",void 0),Ha=oe([Ai("nami-text-list-item-wrapper")],Ha);let Wa=class extends ki{component;constructor(e){super(),this.component=e}styles(){return as(`\n :host { \n display: flex;\n overflow-wrap: anywhere;\n transition: all 0.3s;\n margin-right: ${this.component.rightMargin||this.component.spacing||0}px;\n ${Ki(this.component)}\n color: ${this.component.fontColor};\n font-size: ${this.component.fontSize??12}px;\n }\n `)}render(){return Gs`<slot></slot>`}};oe([$i({type:Object})],Wa.prototype,"component",void 0),Wa=oe([Ai("nami-symbol")],Wa);let Ga=class extends ki{component;constructor(e){super(),this.component=e}styles(){return as(`\n :host {\n line-height: 1.5715;\n display: grid;\n overflow-wrap: anywhere;\n width: fit-content;\n ${Ki(this.component)}\n color: ${this.component.fontColor};\n font-size: ${this.component.fontSize??12}px;\n text-align: ${this.component.alignment||"center"};\n ${Qi("string"!=typeof this.component.strikethrough&&this.component.strikethrough)}\n ${Zi(this.component)}\n ${Ji(this.component)}\n ${ja(this.component)}\n ${Vi(this.component)}\n ${Xi(this.component)}\n }\n :host > :not(:first-child) {\n margin-top: ${this.component.spacing||0}px;\n }\n .anticon {\n text-rendering: optimizelegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n color: inherit;\n display: inline-block;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -.125em;\n }\n .anticon svg {\n display: inline-block;\n line-height: 1;\n }\n\n :host .bullet-text-wrapper {\n line-height: 1.5715;\n display: inline;\n overflow-wrap: anywhere;\n width: fit-content;\n ${Ki(this.component)}\n color: ${this.component.fontColor};\n font-size: ${this.component.fontSize??12}px;\n text-align: ${this.component.alignment||"center"};\n ${Qi("string"!=typeof this.component.strikethrough&&this.component.strikethrough)}\n ${Zi(this.component)}\n }\n :host .bullet-text-wrapper p {\n margin: 0;\n line-height: 1.2em;\n }\n ${ja(this.component,":host .bullet-text-wrapper")}\n `)}render(){const{fontColor:e,fontSize:t,bulletComponent:n,texts:r,spacing:s}=this.component,i=n?{fontColor:e,fontSize:t,spacing:s,...n}:null;if(!Array.isArray(r))return null;const o=r.map((e=>e?Gs`<nami-text-list-item-wrapper .component=${this.component}>
42
- ${i&&Gs`
43
- <nami-symbol .component=${i}>
44
- <span role="img" aria-label="check-circle" class="anticon anticon-check-circle">
45
- <svg viewBox="64 64 896 896" focusable="false" data-icon="check-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true">
46
- <path d="M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z"></path><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"></path>
47
- </svg>
48
- </span>
49
- </nami-symbol>
50
- `}
51
- <div class="bullet-text-wrapper">${Oo(`${Fa.parse(e)}`)}</div>
52
- </nami-text-list-item-wrapper>`:null));return Gs`${o}`}};oe([$i({type:Object})],Ga.prototype,"component",void 0),Ga=oe([Ai("nami-text-list")],Ga),ji("text",Ba),ji("text-list",Ga);let qa=class extends ki{component;constructor(e){super(),this.component=e}styles(){const e=this.component,t="vertical"===e.direction,n=t?"width":"height",r=t?"margin-top":"margin-left",s=e.fillImage?as(`\n line-height: 1.5715;\n background-image: url(${e.fillImage});\n background-size: cover;\n background-position: center;\n background-repeat: no-repeat;\n height: 100%;\n width: 100%;\n `):as(Ki(e));return as(`\n :host {\n display: flex;\n ${s};\n ${eo(e.position)}\n ${Vi(e)}\n ${Ji(e)}\n }\n :host > * {\n ${n}: 100%;\n }\n :host > :not(:first-child) {\n ${r}: ${e.spacing||0}px;\n }\n `)}render(){return this.component.components.map((e=>Bi(e)))}};oe([$i({type:Object})],qa.prototype,"component",void 0),qa=oe([Ai("nami-container")],qa),ji("container",qa);let Ka=class extends ki{component;constructor(e){super(),this.component=e}styles(){const e="vertical"===this.component.direction,t=e?"width":"height",n=e?"margin-top":"margin-left",r=this.component.fillImage?as(`\n line-height: 1.5715;\n background-image: url(${this.component.fillImage});\n background-size: cover;\n background-position: center;\n background-repeat: no-repeat;\n height: 100%;\n width: 100%;\n `):as(Ki(this.component));return as(`\n :host {\n display: flex;\n ${r};\n ${eo(this.component.position)}\n ${Vi(this.component)}\n ${Ji(this.component)}\n justify-content: center;\n }\n :host > * {\n ${t}: 100%;\n }\n :host > :not(:first-child) {\n ${n}: ${this.component.spacing||0}px;\n }\n `)}_offerState(){const{anySkuHasTrialOffer:e,anySkuHasIntroOffer:t,anySkuHasPromoOffer:n}=wi.state;return{freeTrialEligible:e,introEligible:t,promoEligible:n}}render(){const{skuItems:e,mediaList:t}=wi.state,n=function(e,t,n={},r){const s=t.productBaseComponents||t.components||[],i=t.productFeaturedComponents||s;return e.map((e=>{const t=e.featured?i:s,o={sku:{...e,...e.variables,...r,id:e.sku_ref_id},media:zi(n,{convertToUrl:!0})};return[e.featured,Li(t,Li(o,o))]}),[])}(e,this.component,t,this._offerState());return n.map((([,e])=>e.map((e=>Bi(e)))))}};oe([$i({type:Object})],Ka.prototype,"component",void 0),Ka=oe([Ai("nami-product-container")],Ka),ji("productContainer",Ka);let Va=class extends ki{component;constructor(e){super(),this.component=e}styles(){const{url:e,imageCropping:t,alignment:n,height:r,width:s,rightMargin:i,spacing:o}=this.component;return as(`\n :host {\n box-sizing: border-box;\n position: relative;\n transition: all 0.3s;\n background-image: url(${e});\n background-size: ${"fit"===t?"contain":"cover"};\n background-position: ${n||""} center;\n background-repeat: no-repeat;\n height: ${qi(r??"100%")};\n width: ${qi(s??"100%")};\n margin-right: ${i||o||0}px;\n ${Yi(this.component)}\n }\n `)}render(){return Gs``}};oe([$i({type:Object})],Va.prototype,"component",void 0),Va=oe([Ai("nami-image")],Va),ji("image",Va);let Ya=class extends ki{component;device="desktop";zIndex=1;fullscreen=!1;styles(){return as(`\n :host {\n display: flex;\n flex-direction: column;\n justify-content: center;\n overflow: hidden;\n align-items: center;\n position: absolute;\n width: 100%;\n bottom: -1px;\n background-repeat: no-repeat;\n background-size: cover;\n background-position: center;\n z-index: ${this.component.zIndex};\n border-radius: ${"phone"===this.device?this.fullscreen?0:30:0}px;\n top: ${"phone"===this.device?this.fullscreen?0:40:0}px;\n ${Ki(this.component)}\n transition: all 0.3s;\n ${Yi(this.component)}\n }\n `)}render(){return this.component.components.map((e=>Bi(e)))}};oe([$i({type:Object})],Ya.prototype,"component",void 0),oe([$i({type:String})],Ya.prototype,"device",void 0),oe([$i({type:Number})],Ya.prototype,"zIndex",void 0),oe([$i({type:Boolean})],Ya.prototype,"fullscreen",void 0),Ya=oe([Ai("nami-background-container")],Ya);let Xa=class extends ki{component;zIndex=2;device="desktop";inFocusedState=!1;styles(){return as(`\n :host {\n display: flex;\n ${Vi(this.component)}\n height: 100%;\n ${"phone"!==this.device?"width: 100%":""};\n align-items: center;\n justify-content: start;\n z-index: ${this.zIndex};\n transition: all 0.3s;\n overflow-y: scroll;\n overflow-x: hidden;\n scrollbar-width: none;\n ::-webkit-scrollbar {\n display: none;\n }\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n ${Yi(this.component)}\n }\n :host > * {\n width: 100%;\n }\n \n :host > *:not(:first-child) {\n ${"vertical"===this.component.direction?`margin-top: ${this.component.spacing||0}px;`:`margin-left: ${this.component.spacing||0}px;`}\n `)}render(){return this.component.components.map((e=>Bi(e)))}};oe([$i({type:Object})],Xa.prototype,"component",void 0),oe([$i({type:Number})],Xa.prototype,"zIndex",void 0),oe([$i({type:String})],Xa.prototype,"device",void 0),oe([$i({type:Boolean})],Xa.prototype,"inFocusedState",void 0),Xa=oe([Ai("nami-content-container")],Xa);let Qa=class extends ki{component;constructor(e){super(),this.component=e,this.addEventListener("click",this._handleClick)}_handleClick=()=>{Ao(this.component.onTap)};styles(){return as(`\n :host {\n cursor: pointer;\n ${Ki(this.component)}\n ${Ji(this.component)}\n }\n `)}render(){return this.component.components.map((e=>Bi(e)))}};oe([$i({type:Object})],Qa.prototype,"component",void 0),Qa=oe([Ai("nami-segment-picker")],Qa),ji("segmentPicker",Qa);let Za=class extends ki{component;inFocusedState=!1;constructor(e){super(),this.component=e,this.classList.toggle("active",e.id===wi.state.currentGroupId),this.addEventListener("click",this._handleClick),this.addEventListener("mouseover",this._handleHover)}_handleClick=()=>{wi.setCurrentGroupId(this.component.id)};_handleHover=()=>{this.inFocusedState=!0};getComponentStyles(e){return Object.keys(this.component).filter((t=>t.startsWith(e))).reduce(((t,n)=>(t[this.formatKey(n,e)]=this.component[n],t)),{})}formatKey(e,t){const n=e.replace(t,"");return n.charAt(0).toLowerCase()+n.slice(1)}applyStyles(e){return`\n ${Ki(e)}\n ${e.fontColor?`color: ${e.fontColor};`:""}\n font-size: ${e.fontSize??12}px;\n text-align: ${e.alignment||"center"};\n font-family: '${e.fontName}', '${(e.fontName||"").split("-")}', 'Helvetica';\n ${Ji(e,this.inFocusedState)}\n width: 50% !important;\n height: 100% !important;\n `}styles(){const e=this.getComponentStyles("active"),t=this.getComponentStyles("inactive");return as(`\n :host {\n display: inline-flex;\n cursor: pointer;\n ${this.applyStyles({...t,...this.component})}\n }\n\n :host(.active), :host(:hover) {\n ${this.applyStyles({...e,...this.component})}\n }\n `)}render(){return Gs`<span>${this.component.text}</span>`}};oe([$i({type:Object})],Za.prototype,"component",void 0),oe([$i({type:Boolean})],Za.prototype,"inFocusedState",void 0),Za=oe([Ai("nami-segment-picker-item")],Za),ji("segmentPickerItem",Za),e.Nami=Zr,e.NamiCampaignManager=Ci,e.NamiCustomerManager=Ti,e.NamiPaywallManager=ts}));
41
+ `}};ro=oe([Zi("nami-paywall")],ro);class so{static instance=new so;emitter=Pr.getInstance();static allCampaigns(){if(!this.instance.sdkInitialized)throw new Y;return gr(kn([...G.getCampaignRules(d)??[],...G.getCampaignRules(b)??[]]),"rule")}static isCampaignAvailable(e){if(!this.instance.sdkInitialized)throw new Y;let t,n;"string"==typeof e?(t="label",n=e):e instanceof URL?(t="url",n=e.href):(t=e.type??"label",n=e.value);let r=kn(this.allCampaigns().filter((e=>e.type===t&&e.value===n)));return r=r.flatMap((e=>{const t=ts.allPaywalls().find((t=>t.id===e.paywall));return t?[e]:[]})),r.length>0}static async refresh(){if(!this.instance.sdkInitialized)throw new Y;const e=await Lr.instance.fetchPaywalls();return await Mr.instance.fetchCampaignRules(e),this.allCampaigns()}static registerAvailableCampaignsHandler(e){return this.instance.emitter.addListener(U,e),()=>{this.instance.emitter.removeListener(U,e)}}static launch(e,t){let n,r;if("string"==typeof e?(r=e,n="label"):e instanceof URL?(r=e.href,n="url"):(({type:n,value:r}=e),n||="label"),!this.instance.sdkInitialized)throw new Y;const s=kn(this.allCampaigns().filter((e=>e.type==n&&e.value==r))),i=ts.allPaywalls().find((e=>s.find((t=>t.paywall===e.id))));if(!i)throw new ee;const o=new ro(i,Mr.instance.currentFormFactor);if(t){const e=s.find((e=>e.paywall===i.id));this.instance.emitter.addListener(F,(({action:n,sku:r})=>{t({action:n,campaignId:e.rule,campaignName:e.name,paywallId:i.id,paywallName:i.name,skuId:r?.id})}))}return o}get sdkInitialized(){return Zr.instance.isInitialized}}class io{static instance=new io;externalId;constructor(){this.load()}setExternalId(e){return this.externalId=e,this}getExternalId(){return this.externalId}isLoggedIn(){return!!this.externalId}save(){return this.externalId?G.setNamiProfile({externalId:this.externalId}):G.removeNamiProfile(),this}load(){const e=G.getNamiProfile();e&&(this.externalId=e.externalId)}async login(e){const t=await pe.instance.login(e);t.external_id&&Ki.setIsLoggedIn(!0),this.setExternalId(t.external_id).save()}async logout(){await pe.instance.logout(),Ki.setIsLoggedIn(!1),this.setExternalId(void 0).save()}}var oo,ao;!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"}(oo||(oo={})),function(e){e.LOGIN="login",e.LOGOUT="logout",e.ADVERTISING_ID_SET="advertising_id_set",e.ADVERTISING_ID_CLEARED="advertising_id_cleared",e.VENDOR_ID_SET="vendor_id_set",e.VENDOR_ID_CLEARED="vendor_id_cleared",e.CUSTOMER_DATA_PLATFORM_ID_SET="customer_data_platform_id_set",e.CUSTOMER_DATA_PLATFORM_ID_CLEARED="customer_data_platform_id_cleared",e.ANONYMOUS_MODE_ON="anonymous_mode_on",e.ANONYMOUS_MODE_OFF="anonymous_mode_off",e.NAMI_DEVICE_ID_SET="nami_device_id_set",e.NAMI_DEVICE_ID_CLEARED="nami_device_id_cleared"}(ao||(ao={}));class co{static instance=new co;emitter=Pr.getInstance();static isLoggedIn(){return io.instance.isLoggedIn()}static loggedInId(){return this.instance.isSDKInitialized||q.debug(o),io.instance.getExternalId()}static async login(e){if(!this.instance.isSDKInitialized){const e=new Y;throw this.invokeStateHandler(ao.LOGIN,!1,e),e}try{await io.instance.login(e),this.invokeStateHandler(ao.LOGIN,!0)}catch(e){throw this.invokeStateHandler(ao.LOGIN,!1,e),e}}static async logout(){if(!this.instance.isSDKInitialized){const e=new Y;throw this.invokeStateHandler(ao.LOGOUT,!1,e),e}try{await io.instance.logout(),this.invokeStateHandler(ao.LOGOUT,!0)}catch(e){throw this.invokeStateHandler(ao.LOGOUT,!1,e),e}}static async setCustomerDataPlatformId(e){await this.updateCustomerDataPlatformId(e)}static async clearCustomerDataPlatformId(){await this.updateCustomerDataPlatformId(null)}static registerAccountStateHandler(e){return this.instance.emitter.on("accountStateChange",e),()=>{this.instance.emitter.off("accountStateChange",e)}}static setAnonymousMode(e){if(!this.instance.isSDKInitialized){const e=new Y;throw this.invokeStateHandler(ao.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e),e}q.info(`TODO: Setting anonymous mode: ${e}`)}static inAnonymousMode(){if(!this.instance.isSDKInitialized){const e=new Error(o);throw this.invokeStateHandler(ao.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e),e}return G.getAnonymousMode()}static setCustomerAttribute(e,t){if(!this.instance.isSDKInitialized)throw new Error(o);G.setCustomerAttribute(e,t),le(oo.PAYWALL_PERSONALIZATION)?(Ki.setCustomerAttribute({[e]:t}),q.debug(`This customer attribute you set is now available for paywall personalization using the smart text variable: ${e}`)):q.warn(`The customer attribute ${e} is not available for using on a paywall, because your account's plan does not include paywall personalization. Contact support@nami.ml for details.`)}static getCustomerAttribute(e){if(!this.instance.isSDKInitialized)throw new Error(o);const t=G.getCustomerAttribute(e);return null!=t?le(oo.PAYWALL_PERSONALIZATION)?q.debug(`Found customer attribute. ${e} is available for paywall personalization on this device.`):q.warn(`Found customer attribute. ${e} is not available for use on a paywall because paywall personalization is not included in your account's plan. Contact support@nami.ml for details.`):q.warn(`No ${e} customer attribute found.`),t}static clearCustomerAttribute(e){if(!this.instance.isSDKInitialized)throw new Error(o);G.clearCustomerAttribute(e)?(Ki.removeCustomerAttribute(e),q.warn(`This customer attribute has been cleared. ${e} is no longer available for paywall personalization on this device. A default value will be used if set in the Nami Control Center.`)):q.warn(`No value to clear for attribute ${e}.`)}static clearAllCustomerAttributes(){if(!this.instance.isSDKInitialized)throw new Error(o);G.getAllCustomerAttributes().forEach((e=>{Ki.removeCustomerAttribute(e)})),G.clearAllCustomerAttributes(),q.warn("All customer attribute have been cleared. customer's smart text will no longer be personalized for this device. A default value will be used if set in the Nami Control Center.")}static invokeStateHandler(e,t,n){this.instance.emitter.emit("accountStateChange",e,t,n)}get isSDKInitialized(){return Zr.instance.isInitialized}static async updateCustomerDataPlatformId(e){if(!this.instance.isSDKInitialized){const e=new Error(o);throw this.invokeStateHandler(ao.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e),e}if(this.inAnonymousMode()){const e=new Error(c);throw this.invokeStateHandler(ao.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e),e}try{await Or.instance.updateDeviceField("customer_data_platform_id",e),this.invokeStateHandler(ao.CUSTOMER_DATA_PLATFORM_ID_SET,!0)}catch(e){this.invokeStateHandler(ao.CUSTOMER_DATA_PLATFORM_ID_SET,!1,e)}}}function lo(e,t){return Array.isArray(e)?e.reduce(((e,n)=>{const r=lo(n,t);return Array.isArray(r)?[...e,...r]:[...e,r]}),[]):null==e?e:"object"==typeof e?Object.entries(e).reduce(((e,[n,r])=>{const s="newRow"===n?r:lo(r,t);return{...e,[n]:s}}),{}):"string"==typeof e?go(e,t):e}function uo(e){return e.assertions?e.assertions.every(po):!!e.orAssertions&&(!e.orAssertions.length||e.orAssertions.some(po))}function ho(e,t){const n=Ki.state,r={state:n,launch:n.launch,sku:n.sku,customer:n.customer};return"string"==typeof e&&e.startsWith("${")&&(e=go(e,r)),e}function po({value:e,expected:t,operator:n}){const r=/\${[A-Za-z.]+}/g;return e=ho(e),t=ho(t),"equals"===n?e===t:"notEquals"===n?e!==t:"contains"===n?(Array.isArray(e)||"string"==typeof e||e instanceof String||(e=e.toString()),e.includes(t)):"notContains"===n?(Array.isArray(e)||"string"==typeof e||e instanceof String||(e=e.toString()),!e.includes(t)):"set"===n?!!e&&!e.toString().match(r):"notSet"===n&&(!e||e.toString().match(r))}function fo(e,{convertToUrl:t}={convertToUrl:!1}){return Object.entries(e).reduce(((e,[n,{content:r}])=>(t&&"string"!=typeof r&&r&&(r=URL.createObjectURL(r)),{...e,[n]:r})),{})}function go(e,t){let n=e;if("string"!=typeof e)return n;for(const[s,i]of Array.from(e.matchAll(B))){const o=go(i,t);if(s===e)return r(s,o);o!==i&&(n=n.replace(i,o)),n=n.replace(B,r)}return n;function r(e,n){const r=function(e,...t){let n=e;for(const e of t){if(null==n)return;n=Array.isArray(n)?n[+e]:n[e]}return n}(t,...n.split("."));return void 0===r?e:"string"!=typeof r?r:go(r,t)}}const mo={};function bo(e,t){mo[e]=t}function yo(e){if("condition"===e.component){if(!uo(e))return null;const t=e.components?.map((e=>yo(e)));return t}return e.conditionAttributes&&(e=function({conditionAttributes:e,...t}){return e?e.reduce(((e,t)=>uo(t)?(Object.entries(t.attributes).forEach((([e,n])=>{t.attributes[e]=ho(n)})),{...e,...t.attributes}):e),t):t}(e)),Object.keys(e).forEach((t=>{e[t]=ho(e[t])})),e?.component in mo?new mo[e.component](e):(q.debug("Cannot render component:",e?.component),null)}const _o={upperLeft:"border-top-left-radius",upperRight:"border-top-right-radius",lowerLeft:"border-bottom-left-radius",lowerRight:"border-bottom-right-radius"},vo={left:"border-left-style",right:"border-right-style",top:"border-top-style",bottom:"border-bottom-style"},wo={top:"start",left:"start",right:"end",bottom:"end",center:"center"};function ko(e){let t;return t="number"==typeof e?`${e}px`:"fitContent"==e?"fit-content":e,`${t} !important`}function Ao(e,t){return(n=e.fillColor||"transparent").includes("gradient")?`background-image: ${n};`:`background-color: ${n};`;var n}function So({direction:e}){return`flex-direction: ${"vertical"===e?"column":"row"};`}function xo(e){return`\n padding-right: ${e.rightPadding??0}px;\n padding-left: ${e.leftPadding??0}px;\n padding-top: ${e.topPadding??0}px;\n padding-bottom: ${e.bottomPadding??0}px;\n margin-right: ${e.rightMargin??0}px;\n margin-left: ${e.leftMargin??0}px;\n margin-top: ${e.topMargin??0}px;\n margin-bottom: ${e.bottomMargin??0}px;\n `}function $o({alignment:e}){return`\n justify-content: ${e&&wo[e]||"center"};\n `}function Eo(e){return e?"\n text-decoration: line-through;\n text-decoration-thickness: auto;\n ":""}function Co({fontName:e}){const[t]=(e||"").split("-");return`font-family: '${e}', '${t}', 'Helvetica';`}function Io(e,t){return`\n transition: all 0.3s;\n ${function({grow:e}){return e?"flex-grow: 1;":""}(e)}\n ${xo(e)}\n ${function({moveX:e=0,moveY:t=0}){return`\n position: relative;\n left: ${"number"==typeof e?`${e}px`:e};\n transform: translate(\n 0,\n ${"number"==typeof t?`${t}px`:t}\n );\n `}(e)}\n ${function(e,t){const n=t&&e.focusedBorderColor?e.focusedBorderColor:e.borderColor,r=t&&e.focusedBorderRadius?e.focusedBorderRadius:e.borderRadius??0,s=t&&e.focusedRoundBorders?e.focusedRoundBorders:e.roundBorders||null,i=s?s.map((e=>`${_o[e]}: ${r}px;`)).join("\n"):`border-radius: ${r}px;`,o=t&&e.focusedBorderWidth?e.focusedBorderWidth:e.borderWidth||0,a=t&&e.focusedBorders?e.focusedBorders:e.borders||[];return`\n border-color: ${n?`${n} !important`:"transparent"};\n border-width: ${o}px !important;\n ${a.length?a.map((e=>`${vo[e]}: solid;`)).join("\n"):"border-style: solid;"}\n ${i}\n `}(e,t)}\n ${function({alignment:e}){return`\n align-items: ${e&&wo[e]||"center"};\n `}(e)}\n ${$o(e)}\n ${function(e){const t=e.width||e.fixedWidth,n=e.height||e.fixedHeight;return`\n max-width: 100%;\n ${void 0!==t?`width: ${ko(t)};`:""}\n ${void 0!==n?`height: ${ko(n)};`:""}\n `}(e)}\n ${function({zIndex:e}){return`z-index: ${e??"initial"};`}(e)}\n ${function(e){if(!e.dropShadow)return"";const t=new RegExp("(-?[0-9]+)\\s(-?[0-9]+)\\s([0-9]+)\\s(rgba?\\([0-9\\s\\/.]+\\))","gi").exec(e.dropShadow);return t&&5===t.length?`\n box-shadow: ${t[1]}px ${t[2]}px\n ${t[3]}px ${t[4]};\n `:""}(e)}\n `}function Po(e){if(!e)return"";const[t,n]=e.split("-");return`\n align-self: ${t};\n ${n}: 0;\n `}let Mo=class extends Qi{component;constructor(e){super(),this.component=e}styles(){const e=this.component,t=e.height||e.fixedHeight||e.width||e.fixedWidth;return as(`\n :host {\n display: block;\n ${t?"":"flex-grow: 1;"}\n ${Io(e)}\n }\n `)}render(){return Ws``}};oe([to({type:Object})],Mo.prototype,"component",void 0),Mo=oe([Zi("nami-spacer")],Mo),bo("spacer",Mo);const{NAMI_CLOSE_PAYWALL:Oo="namiClosePaywall",NAMI_RESTORE_PURCHASES:Ro="namiRestorePurchases",NAMI_SIGN_IN:Lo="namiSignIn",NAMI_BUY_SKU:To="namiBuySKU",SET_STATE:zo="setState",NAMI_SELECT_SKU:No="namiSelectSKU",NAMI_PURCHASE_SELECTED_SKU:Do="namiPurchaseSelectedSKU",NAMI_DEEP_LINK:Uo="namiDeeplink",NAMI_NAVIGATE_TO_SCREEN:Fo="namiNavigateToScreen",NAMI_RELOAD_PRODUCTS:jo="namiReloadProducts",UNSUPPORTED:Bo="",NAMI_PURCHASE_SUCCESS:Ho="namiPurchaseSuccess",NAMI_PURCHASE_CANCELLED:Xo="namiPurchaseCancelled",NAMI_PURCHASE_FAILED:Vo="namiPurchaseFailed",NAMI_PURCHASE_PENDING:Wo="namiPurchasePending",NAMI_PURCHASE_UNKNOWN:qo="namiPurchaseUnknown",NAMI_SHOW_PAYWALL:Go="namiShowPaywall",NAMI_PAGE_CHANGE:Ko="namiPageChange",NAMI_TOGGLE_CHANGE:Yo="namiToggleChange",NAMI_SLIDE_CHANGE:Qo="namiSlideChange"}={};function Zo(t,n,r){!function(t,n){let r;switch(t.function){case Oo:r=e.NamiPaywallAction.CLOSE_PAYWALL,function(){if(!Jo(Jr.PAYWALL_CLOSE_REQUESTED)&&window)window.history.back()}();break;case Ro:r=e.NamiPaywallAction.RESTORE_PURCHASES,function(){const e=le(oo.THIRD_PARTY_TRANSACTIONS);Jo(Jr.PAYWALL_RESTORE_REQUESTED)||e||(q.warn("NamiPaywallManager.registerRestoreHandler is not registered, so restore option on the paywall will use default behavior."),q.info("TODO: restore default purchase"))}();break;case Lo:r=e.NamiPaywallAction.SIGN_IN,Jo(Jr.PAYWALL_SIGNIN_REQUESTED);break;case Uo:s=t.parameters?.url,null!=s?Jo(Jr.PAYWALL_DEEPLINK_ACTION,s)||"undefined"!=typeof window&&window.open(s,"_blank"):q.debug("Paywall deep link action invoked, but no url present.");break;case Bo:break;case To:r=e.NamiPaywallAction.BUY_SKU,function(e){q.info("TODO: implement buySKU",e)}(n);break;case Fo:!function(e){if(e.parameters?.screen){const t=e.parameters.screen;window.location.replace(t),q.info("TODO: implement navigateToScreen with data")}}(t);break;case zo:!function(){const e=ts.allPaywalls().find((e=>e.id==Ki.state?.paywallId));e.template.initialState={...e.template.initialState,currentGroupId:Ki.state?.currentGroupId},Ki.setPaywall(e)}();break;case No:r=e.NamiPaywallAction.SELECT_SKU,function(e){const t=Ki.state?.currentGroupId,n=Ki.state?.selectedProducts;t&&e.id!=n[t]&&(n[t]=e.id,Ki.setSelectedProdcuts(n))}(n);break;case Do:r=e.NamiPaywallAction.PURCHASE_SELECTED_SKU,q.info("TODO: implement purchase selected SKU");break;case jo:q.info("TODO: implement reload products")}var s;r&&Pr.getInstance().emit(F,{action:r,sku:n});ho(t.parameters?.promo),q.info("TODO: create paywall context and invoke PaywallActionHandler")}(t||{function:n,parameters:null},r)}function Jo(e,...t){const n=Pr.getInstance();return n.emit(e,...t),n.listenerCount(e)>0}let ea=class extends Qi{component;constructor(e){super(),this.component=e,this.addEventListener("click",this._handleClick)}_handleClick=()=>{Zo(this.component.onTap,this.component.actionTap)};styles(){const e="vertical"===this.component.direction?"margin-top":"margin-left";return as(`\n :host {\n display: flex;\n flex-direction: column;\n cursor: pointer;\n ${Ao(this.component)}\n ${So(this.component)}\n ${Io(this.component)}\n }\n\n :host > :not(:first-child) {\n ${e}: ${this.component.spacing||0}px;\n }\n }\n `)}render(){return function(e){const t={sku:Ki.state.sku};return lo(e.components||[],lo(t,t))}(this.component).map((e=>yo(e)))}};oe([to({type:Object})],ea.prototype,"component",void 0),ea=oe([Zi("nami-button")],ea),bo("button",ea);let ta=class extends Qi{components=[];zIndex="2";device="desktop";inFullScreen;styles(){return as(`\n :host {\n display: flex;\n width: 100%;\n align-items: center;\n justify-content: center;\n z-index: ${parseInt(this.zIndex,10)};\n margin-top: ${"phone"!==this.device||this.inFullScreen?0:40}px;\n }`)}render(){return this.components.map((e=>yo(e)))}};oe([to({type:Array})],ta.prototype,"components",void 0),oe([to({type:String})],ta.prototype,"zIndex",void 0),oe([to({type:String})],ta.prototype,"device",void 0),oe([to({type:Boolean})],ta.prototype,"inFullScreen",void 0),ta=oe([Zi("nami-header")],ta);let na=class extends Qi{components=[];zIndex="3";styles(){return as(`\n :host {\n text-align: center !important;\n bottom: 0;\n position: absolute;\n width: 100%;\n z-index: ${this.zIndex};\n transition: all 0.3s;\n }\n `)}render(){return this.components.map((e=>yo(e)))}};oe([to({type:Array})],na.prototype,"components",void 0),oe([to({type:String})],na.prototype,"zIndex",void 0),na=oe([Zi("nami-footer")],na);const ra=2;class sa{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}class ia extends sa{constructor(e){if(super(e),this.it=Ks,e.type!==ra)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Ks||null==e)return this._t=void 0,this.it=e;if(e===Gs)return e;if("string"!=typeof e)throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;const t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}}ia.directiveName="unsafeHTML",ia.resultType=1;const oa=(e=>(...t)=>({_$litDirective$:e,values:t}))(ia);function aa(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let ca={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};function la(e){ca=e}const ua=/[&<>"']/,ha=new RegExp(ua.source,"g"),pa=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,da=new RegExp(pa.source,"g"),fa={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ga=e=>fa[e];function ma(e,t){if(t){if(ua.test(e))return e.replace(ha,ga)}else if(pa.test(e))return e.replace(da,ga);return e}const ba=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function ya(e){return e.replace(ba,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const _a=/(^|[^\[])\^/g;function va(e,t){let n="string"==typeof e?e:e.source;t=t||"";const r={replace:(e,t)=>{let s="string"==typeof t?t:t.source;return s=s.replace(_a,"$1"),n=n.replace(e,s),r},getRegex:()=>new RegExp(n,t)};return r}function wa(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const ka={exec:()=>null};function Aa(e,t){const n=e.replace(/\|/g,((e,t,n)=>{let r=!1,s=t;for(;--s>=0&&"\\"===n[s];)r=!r;return r?"|":" |"})).split(/ \|/);let r=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(/\\\|/g,"|");return n}function Sa(e,t,n){const r=e.length;if(0===r)return"";let s=0;for(;s<r;){const i=e.charAt(r-s-1);if(i!==t||n){if(i===t||!n)break;s++}else s++}return e.slice(0,r-s)}function xa(e,t,n,r){const s=t.href,i=t.title?ma(t.title):null,o=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){r.state.inLink=!0;const e={type:"link",raw:n,href:s,title:i,text:o,tokens:r.inlineTokens(o)};return r.state.inLink=!1,e}return{type:"image",raw:n,href:s,title:i,text:ma(o)}}class $a{options;rules;lexer;constructor(e){this.options=e||ca}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:Sa(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t){const n=e.match(/^(\s+)(?:```)/);if(null===n)return t;const r=n[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[n]=t;return n.length>=r.length?e.slice(r.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=Sa(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let e=t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,"\n $1");e=Sa(e.replace(/^ *>[ \t]?/gm,""),"\n");const n=this.lexer.state.top;this.lexer.state.top=!0;const r=this.lexer.blockTokens(e);return this.lexer.state.top=n,{type:"blockquote",raw:t[0],tokens:r,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const r=n.length>1,s={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");const i=new RegExp(`^( {0,3}${n})((?:[\t ][^\\n]*)?(?:\\n|$))`);let o="",a="",c=!1;for(;e;){let n=!1;if(!(t=i.exec(e)))break;if(this.rules.block.hr.test(e))break;o=t[0],e=e.substring(o.length);let r=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),l=e.split("\n",1)[0],u=0;this.options.pedantic?(u=2,a=r.trimStart()):(u=t[2].search(/[^ ]/),u=u>4?1:u,a=r.slice(u),u+=t[1].length);let h=!1;if(!r&&/^ *$/.test(l)&&(o+=l+"\n",e=e.substring(l.length+1),n=!0),!n){const t=new RegExp(`^ {0,${Math.min(3,u-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),n=new RegExp(`^ {0,${Math.min(3,u-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),s=new RegExp(`^ {0,${Math.min(3,u-1)}}(?:\`\`\`|~~~)`),i=new RegExp(`^ {0,${Math.min(3,u-1)}}#`);for(;e;){const c=e.split("\n",1)[0];if(l=c,this.options.pedantic&&(l=l.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),s.test(l))break;if(i.test(l))break;if(t.test(l))break;if(n.test(e))break;if(l.search(/[^ ]/)>=u||!l.trim())a+="\n"+l.slice(u);else{if(h)break;if(r.search(/[^ ]/)>=4)break;if(s.test(r))break;if(i.test(r))break;if(n.test(r))break;a+="\n"+l}h||l.trim()||(h=!0),o+=c+"\n",e=e.substring(c.length+1),r=l.slice(u)}}s.loose||(c?s.loose=!0:/\n *\n *$/.test(o)&&(c=!0));let p,d=null;this.options.gfm&&(d=/^\[[ xX]\] /.exec(a),d&&(p="[ ] "!==d[0],a=a.replace(/^\[[ xX]\] +/,""))),s.items.push({type:"list_item",raw:o,task:!!d,checked:p,loose:!1,text:a,tokens:[]}),s.raw+=o}s.items[s.items.length-1].raw=o.trimEnd(),s.items[s.items.length-1].text=a.trimEnd(),s.raw=s.raw.trimEnd();for(let e=0;e<s.items.length;e++)if(this.lexer.state.top=!1,s.items[e].tokens=this.lexer.blockTokens(s.items[e].text,[]),!s.loose){const t=s.items[e].tokens.filter((e=>"space"===e.type)),n=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));s.loose=n}if(s.loose)for(let e=0;e<s.items.length;e++)s.items[e].loose=!0;return s}}html(e){const t=this.rules.block.html.exec(e);if(t){return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}}def(e){const t=this.rules.block.def.exec(e);if(t){const e=t[1].toLowerCase().replace(/\s+/g," "),n=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:r}}}table(e){const t=this.rules.block.table.exec(e);if(!t)return;if(!/[:|]/.test(t[2]))return;const n=Aa(t[1]),r=t[2].replace(/^\||\| *$/g,"").split("|"),s=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[],i={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(const e of r)/^ *-+: *$/.test(e)?i.align.push("right"):/^ *:-+: *$/.test(e)?i.align.push("center"):/^ *:-+ *$/.test(e)?i.align.push("left"):i.align.push(null);for(const e of n)i.header.push({text:e,tokens:this.lexer.inline(e)});for(const e of s)i.rows.push(Aa(e,i.header.length).map((e=>({text:e,tokens:this.lexer.inline(e)}))));return i}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:ma(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const t=Sa(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let r=0;r<e.length;r++)if("\\"===e[r])r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return-1}(t[2],"()");if(e>-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],r="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^</.test(n)&&(n=this.options.pedantic&&!/>$/.test(e)?n.slice(1):n.slice(1,-1)),xa(t,{href:n?n.replace(this.rules.inline.anyPunctuation,"$1"):n,title:r?r.replace(this.rules.inline.anyPunctuation,"$1"):r},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const e=t[(n[2]||n[1]).replace(/\s+/g," ").toLowerCase()];if(!e){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return xa(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r)return;if(r[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(r[1]||r[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const n=[...r[0]].length-1;let s,i,o=n,a=0;const c="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);null!=(r=c.exec(t));){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(i=[...s].length,r[3]||r[4]){o+=i;continue}if((r[5]||r[6])&&n%3&&!((n+i)%3)){a+=i;continue}if(o-=i,o>0)continue;i=Math.min(i,i+o+a);const t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+i);if(Math.min(n,i)%2){const e=c.slice(1,-1);return{type:"em",raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}const l=c.slice(2,-2);return{type:"strong",raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const n=/[^ ]/.test(e),r=/^ /.test(e)&&/ $/.test(e);return n&&r&&(e=e.substring(1,e.length-1)),e=ma(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=ma(t[1]),n="mailto:"+e):(e=ma(t[1]),n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=ma(t[0]),n="mailto:"+e;else{let r;do{r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??""}while(r!==t[0]);e=ma(t[0]),n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:ma(t[0]),{type:"text",raw:t[0],text:e}}}}const Ea=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ca=/(?:[*+-]|\d{1,9}[.)])/,Ia=va(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,Ca).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),Pa=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ma=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Oa=va(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",Ma).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ra=va(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ca).getRegex(),La="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ta=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,za=va("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",Ta).replace("tag",La).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Na=va(Pa).replace("hr",Ea).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",La).getRegex(),Da={blockquote:va(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Na).getRegex(),code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,def:Oa,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:Ea,html:za,lheading:Ia,list:Ra,newline:/^(?: *(?:\n|$))+/,paragraph:Na,table:ka,text:/^[^\n]+/},Ua=va("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ea).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",La).getRegex(),Fa={...Da,table:Ua,paragraph:va(Pa).replace("hr",Ea).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ua).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",La).getRegex()},ja={...Da,html:va("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Ta).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ka,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:va(Pa).replace("hr",Ea).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Ia).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ba=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ha=/^( {2,}|\\)\n(?!\s*$)/,Xa="\\p{P}\\p{S}",Va=va(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Xa).getRegex(),Wa=va(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Xa).getRegex(),qa=va("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Xa).getRegex(),Ga=va("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Xa).getRegex(),Ka=va(/\\([punct])/,"gu").replace(/punct/g,Xa).getRegex(),Ya=va(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Qa=va(Ta).replace("(?:--\x3e|$)","--\x3e").getRegex(),Za=va("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Qa).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ja=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ec=va(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Ja).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),tc=va(/^!?\[(label)\]\[(ref)\]/).replace("label",Ja).replace("ref",Ma).getRegex(),nc=va(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ma).getRegex(),rc={_backpedal:ka,anyPunctuation:Ka,autolink:Ya,blockSkip:/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,br:Ha,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:ka,emStrongLDelim:Wa,emStrongRDelimAst:qa,emStrongRDelimUnd:Ga,escape:Ba,link:ec,nolink:nc,punctuation:Va,reflink:tc,reflinkSearch:va("reflink|nolink(?!\\()","g").replace("reflink",tc).replace("nolink",nc).getRegex(),tag:Za,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:ka},sc={...rc,link:va(/^!?\[(label)\]\((.*?)\)/).replace("label",Ja).getRegex(),reflink:va(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ja).getRegex()},ic={...rc,escape:va(Ba).replace("])","~|])").getRegex(),url:va(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},oc={...ic,br:va(Ha).replace("{2,}","*").getRegex(),text:va(ic.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ac={normal:Da,gfm:Fa,pedantic:ja},cc={normal:rc,gfm:ic,breaks:oc,pedantic:sc};class lc{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ca,this.options.tokenizer=this.options.tokenizer||new $a,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:ac.normal,inline:cc.normal};this.options.pedantic?(t.block=ac.pedantic,t.inline=cc.pedantic):this.options.gfm&&(t.block=ac.gfm,this.options.breaks?t.inline=cc.breaks:t.inline=cc.gfm),this.tokenizer.rules=t}static get rules(){return{block:ac,inline:cc}}static lex(e,t){return new lc(t).lex(e)}static lexInline(e,t){return new lc(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){const t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){let n,r,s,i;for(e=this.options.pedantic?e.replace(/\t/g," ").replace(/^ +$/gm,""):e.replace(/^( *)(\t+)/gm,((e,t,n)=>t+" ".repeat(n.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),r=t[t.length-1],!r||"paragraph"!==r.type&&"text"!==r.type?t.push(n):(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=r.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),r=t[t.length-1],!r||"paragraph"!==r.type&&"text"!==r.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(r.raw+="\n"+n.raw,r.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=r.text);else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(s=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const n=e.slice(1);let r;this.options.extensions.startBlock.forEach((e=>{r=e.call({lexer:this},n),"number"==typeof r&&r>=0&&(t=Math.min(t,r))})),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(s)))r=t[t.length-1],i&&"paragraph"===r.type?(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n),i=s.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),r=t[t.length-1],r&&"text"===r.type?(r.raw+="\n"+n.raw,r.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,r,s,i,o,a,c=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(i=this.tokenizer.rules.inline.reflinkSearch.exec(c));)e.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(c=c.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(i=this.tokenizer.rules.inline.blockSkip.exec(c));)c=c.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+c.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(i=this.tokenizer.rules.inline.anyPunctuation.exec(c));)c=c.slice(0,i.index)+"++"+c.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(o||(a=""),o=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.escape(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(e))e=e.substring(n.raw.length),r=t[t.length-1],r&&"text"===n.type&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);else if(n=this.tokenizer.link(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(n.raw.length),r=t[t.length-1],r&&"text"===n.type&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(e,c,a))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(e))e=e.substring(n.raw.length),t.push(n);else if(this.state.inLink||!(n=this.tokenizer.url(e))){if(s=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const n=e.slice(1);let r;this.options.extensions.startInline.forEach((e=>{r=e.call({lexer:this},n),"number"==typeof r&&r>=0&&(t=Math.min(t,r))})),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(s))e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(a=n.raw.slice(-1)),o=!0,r=t[t.length-1],r&&"text"===r.type?(r.raw+=n.raw,r.text+=n.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(n.raw.length),t.push(n);return t}}class uc{options;constructor(e){this.options=e||ca}code(e,t,n){const r=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",r?'<pre><code class="language-'+ma(r)+'">'+(n?e:ma(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:ma(e,!0))+"</code></pre>\n"}blockquote(e){return`<blockquote>\n${e}</blockquote>\n`}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}>\n`}hr(){return"<hr>\n"}list(e,t,n){const r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+r+">\n"}listitem(e,t,n){return`<li>${e}</li>\n`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>\n`}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}tablerow(e){return`<tr>\n${e}</tr>\n`}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>\n`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){const r=wa(e);if(null===r)return n;let s='<a href="'+(e=r)+'"';return t&&(s+=' title="'+t+'"'),s+=">"+n+"</a>",s}image(e,t,n){const r=wa(e);if(null===r)return n;let s=`<img src="${e=r}" alt="${n}"`;return t&&(s+=` title="${t}"`),s+=">",s}text(e){return e}}class hc{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class pc{options;renderer;textRenderer;constructor(e){this.options=e||ca,this.options.renderer=this.options.renderer||new uc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new hc}static parse(e,t){return new pc(t).parse(e)}static parseInline(e,t){return new pc(t).parseInline(e)}parse(e,t=!0){let n="";for(let r=0;r<e.length;r++){const s=e[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]){const e=s,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){n+=t||"";continue}}switch(s.type){case"space":continue;case"hr":n+=this.renderer.hr();continue;case"heading":{const e=s;n+=this.renderer.heading(this.parseInline(e.tokens),e.depth,ya(this.parseInline(e.tokens,this.textRenderer)));continue}case"code":{const e=s;n+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case"table":{const e=s;let t="",r="";for(let t=0;t<e.header.length;t++)r+=this.renderer.tablecell(this.parseInline(e.header[t].tokens),{header:!0,align:e.align[t]});t+=this.renderer.tablerow(r);let i="";for(let t=0;t<e.rows.length;t++){const n=e.rows[t];r="";for(let t=0;t<n.length;t++)r+=this.renderer.tablecell(this.parseInline(n[t].tokens),{header:!1,align:e.align[t]});i+=this.renderer.tablerow(r)}n+=this.renderer.table(t,i);continue}case"blockquote":{const e=s,t=this.parse(e.tokens);n+=this.renderer.blockquote(t);continue}case"list":{const e=s,t=e.ordered,r=e.start,i=e.loose;let o="";for(let t=0;t<e.items.length;t++){const n=e.items[t],r=n.checked,s=n.task;let a="";if(n.task){const e=this.renderer.checkbox(!!r);i?n.tokens.length>0&&"paragraph"===n.tokens[0].type?(n.tokens[0].text=e+" "+n.tokens[0].text,n.tokens[0].tokens&&n.tokens[0].tokens.length>0&&"text"===n.tokens[0].tokens[0].type&&(n.tokens[0].tokens[0].text=e+" "+n.tokens[0].tokens[0].text)):n.tokens.unshift({type:"text",text:e+" "}):a+=e+" "}a+=this.parse(n.tokens,i),o+=this.renderer.listitem(a,s,!!r)}n+=this.renderer.list(o,t,r);continue}case"html":{const e=s;n+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=s;n+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let i=s,o=i.tokens?this.parseInline(i.tokens):i.text;for(;r+1<e.length&&"text"===e[r+1].type;)i=e[++r],o+="\n"+(i.tokens?this.parseInline(i.tokens):i.text);n+=t?this.renderer.paragraph(o):o;continue}default:{const e='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let r=0;r<e.length;r++){const s=e[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]){const e=this.options.extensions.renderers[s.type].call({parser:this},s);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){n+=e||"";continue}}switch(s.type){case"escape":{const e=s;n+=t.text(e.text);break}case"html":{const e=s;n+=t.html(e.text);break}case"link":{const e=s;n+=t.link(e.href,e.title,this.parseInline(e.tokens,t));break}case"image":{const e=s;n+=t.image(e.href,e.title,e.text);break}case"strong":{const e=s;n+=t.strong(this.parseInline(e.tokens,t));break}case"em":{const e=s;n+=t.em(this.parseInline(e.tokens,t));break}case"codespan":{const e=s;n+=t.codespan(e.text);break}case"br":n+=t.br();break;case"del":{const e=s;n+=t.del(this.parseInline(e.tokens,t));break}case"text":{const e=s;n+=t.text(e.text);break}default:{const e='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}}class dc{options;constructor(e){this.options=e||ca}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}const fc=new class{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.#t(lc.lex,pc.parse);parseInline=this.#t(lc.lexInline,pc.parseInline);Parser=pc;Renderer=uc;TextRenderer=hc;Lexer=lc;Tokenizer=$a;Hooks=dc;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(const r of e)switch(n=n.concat(t.call(this,r)),r.type){case"table":{const e=r;for(const r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(const r of e.rows)for(const e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{const e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((r=>{const s=e[r].flat(1/0);n=n.concat(this.walkTokens(s,t))})):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let r=e.renderer.apply(this,t);return!1===r&&(r=n.apply(this,t)),r}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){const t=this.defaults.renderer||new uc(this.defaults);for(const n in e.renderer){if(!(n in t))throw new Error(`renderer '${n}' does not exist`);if("options"===n)continue;const r=n,s=e.renderer[r],i=t[r];t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=i.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new $a(this.defaults);for(const n in e.tokenizer){if(!(n in t))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;const r=n,s=e.tokenizer[r],i=t[r];t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new dc;for(const n in e.hooks){if(!(n in t))throw new Error(`hook '${n}' does not exist`);if("options"===n)continue;const r=n,s=e.hooks[r],i=t[r];dc.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(s.call(t,e)).then((e=>i.call(t,e)));const n=s.call(t,e);return i.call(t,n)}:t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return lc.lex(e,t??this.defaults)}parser(e,t){return pc.parse(e,t??this.defaults)}#t(e,t){return(n,r)=>{const s={...r},i={...this.defaults,...s};!0===this.defaults.async&&!1===s.async&&(i.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),i.async=!0);const o=this.#n(!!i.silent,!!i.async);if(null==n)return o(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof n)return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(i.hooks&&(i.hooks.options=i),i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(n):n).then((t=>e(t,i))).then((e=>i.hooks?i.hooks.processAllTokens(e):e)).then((e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then((()=>e)):e)).then((e=>t(e,i))).then((e=>i.hooks?i.hooks.postprocess(e):e)).catch(o);try{i.hooks&&(n=i.hooks.preprocess(n));let r=e(n,i);i.hooks&&(r=i.hooks.processAllTokens(r)),i.walkTokens&&this.walkTokens(r,i.walkTokens);let s=t(r,i);return i.hooks&&(s=i.hooks.postprocess(s)),s}catch(e){return o(e)}}}#n(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="<p>An error occurred:</p><pre>"+ma(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function gc(e,t){return fc.parse(e,t)}gc.options=gc.setOptions=function(e){return fc.setOptions(e),gc.defaults=fc.defaults,la(gc.defaults),gc},gc.getDefaults=aa,gc.defaults=ca,gc.use=function(...e){return fc.use(...e),gc.defaults=fc.defaults,la(gc.defaults),gc},gc.walkTokens=function(e,t){return fc.walkTokens(e,t)},gc.parseInline=fc.parseInline,gc.Parser=pc,gc.parser=pc.parse,gc.Renderer=uc,gc.TextRenderer=hc,gc.Lexer=lc,gc.lexer=lc.lex,gc.Tokenizer=$a,gc.Hooks=dc,gc.parse=gc,gc.options,gc.setOptions,gc.use,gc.walkTokens,gc.parseInline,pc.parse,lc.lex;const mc={check_circleFilled:qs`<path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z" />`,check_circle:qs`<path d="M699 353h-46.9c-10.2 0-19.9 4.9-25.9 13.3L469 584.3l-71.2-98.8c-6-8.3-15.6-13.3-25.9-13.3H325c-6.5 0-10.3 7.4-6.5 12.7l124.6 172.8a31.8 31.8 0 0051.7 0l210.6-292c3.9-5.3.1-12.7-6.4-12.7z" /><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" />`,check:qs`<path d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z" />`,infoFilled:qs`<path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 010-96 48.01 48.01 0 010 96z" />`,info:qs`<path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" /><path d="M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z" />`,add:qs`<path d="M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z" /><path d="M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z" />`,add_circleFilled:qs`<path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm192 472c0 4.4-3.6 8-8 8H544v152c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V544H328c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h152V328c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v152h152c4.4 0 8 3.6 8 8v48z" />`,add_circle_outline:qs`<path d="M696 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z" /><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" />`,cancelFilled:qs`<path d="M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z" />`,cancel:qs`<path d="M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z" />`,close:qs`<path d="M799.86 166.31c.02 0 .04.02.08.06l57.69 57.7c.04.03.05.05.06.08a.12.12 0 010 .06c0 .03-.02.05-.06.09L569.93 512l287.7 287.7c.04.04.05.06.06.09a.12.12 0 010 .07c0 .02-.02.04-.06.08l-57.7 57.69c-.03.04-.05.05-.07.06a.12.12 0 01-.07 0c-.03 0-.05-.02-.09-.06L512 569.93l-287.7 287.7c-.04.04-.06.05-.09.06a.12.12 0 01-.07 0c-.02 0-.04-.02-.08-.06l-57.69-57.7c-.04-.03-.05-.05-.06-.07a.12.12 0 010-.07c0-.03.02-.05.06-.09L454.07 512l-287.7-287.7c-.04-.04-.05-.06-.06-.09a.12.12 0 010-.07c0-.02.02-.04.06-.08l57.7-57.69c.03-.04.05-.05.07-.06a.12.12 0 01.07 0c.03 0 .05.02.09.06L512 454.07l287.7-287.7c.04-.04.06-.05.09-.06a.12.12 0 01.07 0z" />`,helpFilled:qs`<path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 708c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zm62.9-219.5a48.3 48.3 0 00-30.9 44.8V620c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8v-21.5c0-23.1 6.7-45.9 19.9-64.9 12.9-18.6 30.9-32.8 52.1-40.9 34-13.1 56-41.6 56-72.7 0-44.1-43.1-80-96-80s-96 35.9-96 80v7.6c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V420c0-39.3 17.2-76 48.4-103.3C430.4 290.4 470 276 512 276s81.6 14.5 111.6 40.7C654.8 344 672 380.7 672 420c0 57.8-38.1 109.8-97.1 132.5z" />`,help_outline:qs`<path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" /><path d="M623.6 316.7C593.6 290.4 554 276 512 276s-81.6 14.5-111.6 40.7C369.2 344 352 380.7 352 420v7.6c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V420c0-44.1 43.1-80 96-80s96 35.9 96 80c0 31.1-22 59.6-56.1 72.7-21.2 8.1-39.2 22.3-52.1 40.9-13.1 19-19.9 41.8-19.9 64.9V620c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8v-22.7a48.3 48.3 0 0130.9-44.8c59-22.7 97.1-74.7 97.1-132.5.1-39.3-17.1-76-48.3-103.3zM472 732a40 40 0 1080 0 40 40 0 10-80 0z" />`,question_mark:qs`<path d="M764 280.9c-14-30.6-33.9-58.1-59.3-81.6C653.1 151.4 584.6 125 512 125s-141.1 26.4-192.7 74.2c-25.4 23.6-45.3 51-59.3 81.7-14.6 32-22 65.9-22 100.9v27c0 6.2 5 11.2 11.2 11.2h54c6.2 0 11.2-5 11.2-11.2v-27c0-99.5 88.6-180.4 197.6-180.4s197.6 80.9 197.6 180.4c0 40.8-14.5 79.2-42 111.2-27.2 31.7-65.6 54.4-108.1 64-24.3 5.5-46.2 19.2-61.7 38.8a110.85 110.85 0 00-23.9 68.6v31.4c0 6.2 5 11.2 11.2 11.2h54c6.2 0 11.2-5 11.2-11.2v-31.4c0-15.7 10.9-29.5 26-32.9 58.4-13.2 111.4-44.7 149.3-88.7 19.1-22.3 34-47.1 44.3-74 10.7-27.9 16.1-57.2 16.1-87 0-35-7.4-69-22-100.9zM512 787c-30.9 0-56 25.1-56 56s25.1 56 56 56 56-25.1 56-56-25.1-56-56-56z" />`,notificationsFilled:qs`<path d="M816 768h-24V428c0-141.1-104.3-257.8-240-277.2V112c0-22.1-17.9-40-40-40s-40 17.9-40 40v38.8C336.3 170.2 232 286.9 232 428v340h-24c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h216c0 61.8 50.2 112 112 112s112-50.2 112-112h216c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM512 888c-26.5 0-48-21.5-48-48h96c0 26.5-21.5 48-48 48z" />`,notifications:qs`<path d="M816 768h-24V428c0-141.1-104.3-257.7-240-277.1V112c0-22.1-17.9-40-40-40s-40 17.9-40 40v38.9c-135.7 19.4-240 136-240 277.1v340h-24c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h216c0 61.8 50.2 112 112 112s112-50.2 112-112h216c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM512 888c-26.5 0-48-21.5-48-48h96c0 26.5-21.5 48-48 48zM304 768V428c0-55.6 21.6-107.8 60.9-147.1S456.4 220 512 220c55.6 0 107.8 21.6 147.1 60.9S720 372.4 720 428v340H304z" />`,boltFilled:qs`<path d="M848 359.3H627.7L825.8 109c4.1-5.3.4-13-6.3-13H436c-2.8 0-5.5 1.5-6.9 4L170 547.5c-3.1 5.3.7 12 6.9 12h174.4l-89.4 357.6c-1.9 7.8 7.5 13.3 13.3 7.7L853.5 373c5.2-4.9 1.7-13.7-5.5-13.7z" />`,calendar_month:qs`<path d="M880 184H712v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H384v-64c0-4.4-3.6-8-8-8h-56c-4.4 0-8 3.6-8 8v64H144c-17.7 0-32 14.3-32 32v664c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V216c0-17.7-14.3-32-32-32zm-40 656H184V460h656v380zM184 392V256h128v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h256v48c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-48h128v136H184z" />`,cloudFilled:qs`<path d="M811.4 418.7C765.6 297.9 648.9 212 512.2 212S258.8 297.8 213 418.6C127.3 441.1 64 519.1 64 612c0 110.5 89.5 200 199.9 200h496.2C870.5 812 960 722.5 960 612c0-92.7-63.1-170.7-148.6-193.3z" />`,cloud:qs`<path d="M811.4 418.7C765.6 297.9 648.9 212 512.2 212S258.8 297.8 213 418.6C127.3 441.1 64 519.1 64 612c0 110.5 89.5 200 199.9 200h496.2C870.5 812 960 722.5 960 612c0-92.7-63.1-170.7-148.6-193.3zm36.3 281a123.07 123.07 0 01-87.6 36.3H263.9c-33.1 0-64.2-12.9-87.6-36.3A123.3 123.3 0 01140 612c0-28 9.1-54.3 26.2-76.3a125.7 125.7 0 0166.1-43.7l37.9-9.9 13.9-36.6c8.6-22.8 20.6-44.1 35.7-63.4a245.6 245.6 0 0152.4-49.9c41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.2c19.9 14 37.5 30.8 52.4 49.9 15.1 19.3 27.1 40.7 35.7 63.4l13.8 36.5 37.8 10c54.3 14.5 92.1 63.8 92.1 120 0 33.1-12.9 64.3-36.3 87.7z" />`,local_fire_departmentFilled:qs`<path d="M834.1 469.2A347.49 347.49 0 00751.2 354l-29.1-26.7a8.09 8.09 0 00-13 3.3l-13 37.3c-8.1 23.4-23 47.3-44.1 70.8-1.4 1.5-3 1.9-4.1 2-1.1.1-2.8-.1-4.3-1.5-1.4-1.2-2.1-3-2-4.8 3.7-60.2-14.3-128.1-53.7-202C555.3 171 510 123.1 453.4 89.7l-41.3-24.3c-5.4-3.2-12.3 1-12 7.3l2.2 48c1.5 32.8-2.3 61.8-11.3 85.9-11 29.5-26.8 56.9-47 81.5a295.64 295.64 0 01-47.5 46.1 352.6 352.6 0 00-100.3 121.5A347.75 347.75 0 00160 610c0 47.2 9.3 92.9 27.7 136a349.4 349.4 0 0075.5 110.9c32.4 32 70 57.2 111.9 74.7C418.5 949.8 464.5 959 512 959s93.5-9.2 136.9-27.3A348.6 348.6 0 00760.8 857c32.4-32 57.8-69.4 75.5-110.9a344.2 344.2 0 0027.7-136c0-48.8-10-96.2-29.9-140.9z" />`,local_fire_department:qs`<path d="M834.1 469.2A347.49 347.49 0 00751.2 354l-29.1-26.7a8.09 8.09 0 00-13 3.3l-13 37.3c-8.1 23.4-23 47.3-44.1 70.8-1.4 1.5-3 1.9-4.1 2-1.1.1-2.8-.1-4.3-1.5-1.4-1.2-2.1-3-2-4.8 3.7-60.2-14.3-128.1-53.7-202C555.3 171 510 123.1 453.4 89.7l-41.3-24.3c-5.4-3.2-12.3 1-12 7.3l2.2 48c1.5 32.8-2.3 61.8-11.3 85.9-11 29.5-26.8 56.9-47 81.5a295.64 295.64 0 01-47.5 46.1 352.6 352.6 0 00-100.3 121.5A347.75 347.75 0 00160 610c0 47.2 9.3 92.9 27.7 136a349.4 349.4 0 0075.5 110.9c32.4 32 70 57.2 111.9 74.7C418.5 949.8 464.5 959 512 959s93.5-9.2 136.9-27.3A348.6 348.6 0 00760.8 857c32.4-32 57.8-69.4 75.5-110.9a344.2 344.2 0 0027.7-136c0-48.8-10-96.2-29.9-140.9zM713 808.5c-53.7 53.2-125 82.4-201 82.4s-147.3-29.2-201-82.4c-53.5-53.1-83-123.5-83-198.4 0-43.5 9.8-85.2 29.1-124 18.8-37.9 46.8-71.8 80.8-97.9a349.6 349.6 0 0058.6-56.8c25-30.5 44.6-64.5 58.2-101a240 240 0 0012.1-46.5c24.1 22.2 44.3 49 61.2 80.4 33.4 62.6 48.8 118.3 45.8 165.7a74.01 74.01 0 0024.4 59.8 73.36 73.36 0 0053.4 18.8c19.7-1 37.8-9.7 51-24.4 13.3-14.9 24.8-30.1 34.4-45.6 14 17.9 25.7 37.4 35 58.4 15.9 35.8 24 73.9 24 113.1 0 74.9-29.5 145.4-83 198.4z" />`,favoriteFilled:qs`<path d="M923 283.6a260.04 260.04 0 00-56.9-82.8 264.4 264.4 0 00-84-55.5A265.34 265.34 0 00679.7 125c-49.3 0-97.4 13.5-139.2 39-10 6.1-19.5 12.8-28.5 20.1-9-7.3-18.5-14-28.5-20.1-41.8-25.5-89.9-39-139.2-39-35.5 0-69.9 6.8-102.4 20.3-31.4 13-59.7 31.7-84 55.5a258.44 258.44 0 00-56.9 82.8c-13.9 32.3-21 66.6-21 101.9 0 33.3 6.8 68 20.3 103.3 11.3 29.5 27.5 60.1 48.2 91 32.8 48.9 77.9 99.9 133.9 151.6 92.8 85.7 184.7 144.9 188.6 147.3l23.7 15.2c10.5 6.7 24 6.7 34.5 0l23.7-15.2c3.9-2.5 95.7-61.6 188.6-147.3 56-51.7 101.1-102.7 133.9-151.6 20.7-30.9 37-61.5 48.2-91 13.5-35.3 20.3-70 20.3-103.3.1-35.3-7-69.6-20.9-101.9z" />`,favorite:qs`<path d="M923 283.6a260.04 260.04 0 00-56.9-82.8 264.4 264.4 0 00-84-55.5A265.34 265.34 0 00679.7 125c-49.3 0-97.4 13.5-139.2 39-10 6.1-19.5 12.8-28.5 20.1-9-7.3-18.5-14-28.5-20.1-41.8-25.5-89.9-39-139.2-39-35.5 0-69.9 6.8-102.4 20.3-31.4 13-59.7 31.7-84 55.5a258.44 258.44 0 00-56.9 82.8c-13.9 32.3-21 66.6-21 101.9 0 33.3 6.8 68 20.3 103.3 11.3 29.5 27.5 60.1 48.2 91 32.8 48.9 77.9 99.9 133.9 151.6 92.8 85.7 184.7 144.9 188.6 147.3l23.7 15.2c10.5 6.7 24 6.7 34.5 0l23.7-15.2c3.9-2.5 95.7-61.6 188.6-147.3 56-51.7 101.1-102.7 133.9-151.6 20.7-30.9 37-61.5 48.2-91 13.5-35.3 20.3-70 20.3-103.3.1-35.3-7-69.6-20.9-101.9zM512 814.8S156 586.7 156 385.5C156 283.6 240.3 201 344.3 201c73.1 0 136.5 40.8 167.7 100.4C543.2 241.8 606.6 201 679.7 201c104 0 188.3 82.6 188.3 184.5 0 201.2-356 429.3-356 429.3z" />`,lightbulbFilled:qs`<path d="M348 676.1C250 619.4 184 513.4 184 392c0-181.1 146.9-328 328-328s328 146.9 328 328c0 121.4-66 227.4-164 284.1V792c0 17.7-14.3 32-32 32H380c-17.7 0-32-14.3-32-32V676.1zM392 888h240c4.4 0 8 3.6 8 8v32c0 17.7-14.3 32-32 32H416c-17.7 0-32-14.3-32-32v-32c0-4.4 3.6-8 8-8z" />`,lightbulb_outline:qs`<path d="M632 888H392c-4.4 0-8 3.6-8 8v32c0 17.7 14.3 32 32 32h192c17.7 0 32-14.3 32-32v-32c0-4.4-3.6-8-8-8zM512 64c-181.1 0-328 146.9-328 328 0 121.4 66 227.4 164 284.1V792c0 17.7 14.3 32 32 32h264c17.7 0 32-14.3 32-32V676.1c98-56.7 164-162.7 164-284.1 0-181.1-146.9-328-328-328zm127.9 549.8L604 634.6V752H420V634.6l-35.9-20.8C305.4 568.3 256 484.5 256 392c0-141.4 114.6-256 256-256s256 114.6 256 256c0 92.5-49.4 176.3-128.1 221.8z" />`,chatFilled:qs`<path d="M924.3 338.4a447.57 447.57 0 00-96.1-143.3 443.09 443.09 0 00-143-96.3A443.91 443.91 0 00512 64h-2c-60.5.3-119 12.3-174.1 35.9a444.08 444.08 0 00-141.7 96.5 445 445 0 00-95 142.8A449.89 449.89 0 0065 514.1c.3 69.4 16.9 138.3 47.9 199.9v152c0 25.4 20.6 46 45.9 46h151.8a447.72 447.72 0 00199.5 48h2.1c59.8 0 117.7-11.6 172.3-34.3A443.2 443.2 0 00827 830.5c41.2-40.9 73.6-88.7 96.3-142 23.5-55.2 35.5-113.9 35.8-174.5.2-60.9-11.6-120-34.8-175.6zM312.4 560c-26.4 0-47.9-21.5-47.9-48s21.5-48 47.9-48 47.9 21.5 47.9 48-21.4 48-47.9 48zm199.6 0c-26.4 0-47.9-21.5-47.9-48s21.5-48 47.9-48 47.9 21.5 47.9 48-21.5 48-47.9 48zm199.6 0c-26.4 0-47.9-21.5-47.9-48s21.5-48 47.9-48 47.9 21.5 47.9 48-21.5 48-47.9 48z" />`,chat:qs`<path d="M464 512a48 48 0 1096 0 48 48 0 10-96 0zm200 0a48 48 0 1096 0 48 48 0 10-96 0zm-400 0a48 48 0 1096 0 48 48 0 10-96 0zm661.2-173.6c-22.6-53.7-55-101.9-96.3-143.3a444.35 444.35 0 00-143.3-96.3C630.6 75.7 572.2 64 512 64h-2c-60.6.3-119.3 12.3-174.5 35.9a445.35 445.35 0 00-142 96.5c-40.9 41.3-73 89.3-95.2 142.8-23 55.4-34.6 114.3-34.3 174.9A449.4 449.4 0 00112 714v152a46 46 0 0046 46h152.1A449.4 449.4 0 00510 960h2.1c59.9 0 118-11.6 172.7-34.3a444.48 444.48 0 00142.8-95.2c41.3-40.9 73.8-88.7 96.5-142 23.6-55.2 35.6-113.9 35.9-174.5.3-60.9-11.5-120-34.8-175.6zm-151.1 438C704 845.8 611 884 512 884h-1.7c-60.3-.3-120.2-15.3-173.1-43.5l-8.4-4.5H188V695.2l-4.5-8.4C155.3 633.9 140.3 574 140 513.7c-.4-99.7 37.7-193.3 107.6-263.8 69.8-70.5 163.1-109.5 262.8-109.9h1.7c50 0 98.5 9.7 144.2 28.9 44.6 18.7 84.6 45.6 119 80 34.3 34.3 61.3 74.4 80 119 19.4 46.2 29.1 95.2 28.9 145.8-.6 99.6-39.7 192.9-110.1 262.7z" />`,emoji_emotionsFilled:qs`<path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zM288 421a48.01 48.01 0 0196 0 48.01 48.01 0 01-96 0zm224 272c-85.5 0-155.6-67.3-160-151.6a8 8 0 018-8.4h48.1c4.2 0 7.8 3.2 8.1 7.4C420 589.9 461.5 629 512 629s92.1-39.1 95.8-88.6c.3-4.2 3.9-7.4 8.1-7.4H664a8 8 0 018 8.4C667.6 625.7 597.5 693 512 693zm176-224a48.01 48.01 0 010-96 48.01 48.01 0 010 96z" />`,emoji_emotions:qs`<path d="M288 421a48 48 0 1096 0 48 48 0 10-96 0zm352 0a48 48 0 1096 0 48 48 0 10-96 0zM512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm263 711c-34.2 34.2-74 61-118.3 79.8C611 874.2 562.3 884 512 884c-50.3 0-99-9.8-144.8-29.2A370.4 370.4 0 01248.9 775c-34.2-34.2-61-74-79.8-118.3C149.8 611 140 562.3 140 512s9.8-99 29.2-144.8A370.4 370.4 0 01249 248.9c34.2-34.2 74-61 118.3-79.8C413 149.8 461.7 140 512 140c50.3 0 99 9.8 144.8 29.2A370.4 370.4 0 01775.1 249c34.2 34.2 61 74 79.8 118.3C874.2 413 884 461.7 884 512s-9.8 99-29.2 144.8A368.89 368.89 0 01775 775zM664 533h-48.1c-4.2 0-7.8 3.2-8.1 7.4C604 589.9 562.5 629 512 629s-92.1-39.1-95.8-88.6c-.3-4.2-3.9-7.4-8.1-7.4H360a8 8 0 00-8 8.4c4.4 84.3 74.5 151.6 160 151.6s155.6-67.3 160-151.6a8 8 0 00-8-8.4z" />`,starFilled:qs`<path d="M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3z" />`,star:qs`<path d="M908.1 353.1l-253.9-36.9L540.7 86.1c-3.1-6.3-8.2-11.4-14.5-14.5-15.8-7.8-35-1.3-42.9 14.5L369.8 316.2l-253.9 36.9c-7 1-13.4 4.3-18.3 9.3a32.05 32.05 0 00.6 45.3l183.7 179.1-43.4 252.9a31.95 31.95 0 0046.4 33.7L512 754l227.1 119.4c6.2 3.3 13.4 4.4 20.3 3.2 17.4-3 29.1-19.5 26.1-36.9l-43.4-252.9 183.7-179.1c5-4.9 8.3-11.3 9.3-18.3 2.7-17.5-9.5-33.7-27-36.3zM664.8 561.6l36.1 210.3L512 672.7 323.1 772l36.1-210.3-152.8-149L417.6 382 512 190.7 606.4 382l211.2 30.7-152.8 148.9z" />`,block:qs`<path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372 0-89 31.3-170.8 83.5-234.8l523.3 523.3C682.8 852.7 601 884 512 884zm288.5-137.2L277.2 223.5C341.2 171.3 423 140 512 140c205.4 0 372 166.6 372 372 0 89-31.3 170.8-83.5 234.8z" />`,thumb_upFilled:qs`<path d="M885.9 533.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.4-65.5-111.1a67.67 67.67 0 00-34.3-9.3H572.4l6-122.9c1.4-29.7-9.1-57.9-29.5-79.4A106.62 106.62 0 00471 99.9c-52 0-98 35-111.8 85.1l-85.9 311h-.3v428h472.3c9.2 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7-.2-12.6-2-25.1-5.6-37.1zM112 528v364c0 17.7 14.3 32 32 32h65V496h-65c-17.7 0-32 14.3-32 32z" />`,thumb_up:qs`<path d="M885.9 533.7c16.8-22.2 26.1-49.4 26.1-77.7 0-44.9-25.1-87.4-65.5-111.1a67.67 67.67 0 00-34.3-9.3H572.4l6-122.9c1.4-29.7-9.1-57.9-29.5-79.4A106.62 106.62 0 00471 99.9c-52 0-98 35-111.8 85.1l-85.9 311H144c-17.7 0-32 14.3-32 32v364c0 17.7 14.3 32 32 32h601.3c9.2 0 18.2-1.8 26.5-5.4 47.6-20.3 78.3-66.8 78.3-118.4 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7 0-12.6-1.8-25-5.4-37 16.8-22.2 26.1-49.4 26.1-77.7-.2-12.6-2-25.1-5.6-37.1zM184 852V568h81v284h-81zm636.4-353l-21.9 19 13.9 25.4a56.2 56.2 0 016.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 016.9 27.3c0 16.5-7.2 32.2-19.6 43l-21.9 19 13.9 25.4a56.2 56.2 0 016.9 27.3c0 22.4-13.2 42.6-33.6 51.8H329V564.8l99.5-360.5a44.1 44.1 0 0142.2-32.3c7.6 0 15.1 2.2 21.1 6.7 9.9 7.4 15.2 18.6 14.6 30.5l-9.6 198.4h314.4C829 418.5 840 436.9 840 456c0 16.5-7.2 32.1-19.6 43z" />`,lock_open:qs`<path d="M832 464H332V240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v68c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-68c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zm-40 376H232V536h560v304zM484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 10-56 0z" />`,lock_openFilled:qs`<path d="M832 464H332V240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v68c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-68c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM540 701v53c0 4.4-3.6 8-8 8h-40c-4.4 0-8-3.6-8-8v-53a48.01 48.01 0 1156 0z" />`,arrow_drop_down:qs`<path d="M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z" />`,arrow_left:qs`<path d="M689 165.1L308.2 493.5c-10.9 9.4-10.9 27.5 0 37L689 858.9c14.2 12.2 35 1.2 35-18.5V183.6c0-19.7-20.8-30.7-35-18.5z" />`,arrow_right:qs`<path d="M715.8 493.5L335 165.1c-14.2-12.2-35-1.2-35 18.5v656.8c0 19.7 20.8 30.7 35 18.5l380.8-328.4c10.9-9.4 10.9-27.6 0-37z" />`,arrow_drop_up:qs`<path d="M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z" />`,expand_more:qs`<path d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z" />`,chevron_left:qs`<path d="M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z" />`,chevron_right:qs`<path d="M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z" />`,expand_less:qs`<path d="M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z" />`};function bc(e,t=""){const n=e.linkColor||"blue";return as(`\n ${t} a:link {\n color: ${n};\n text-decoration-line: underline;\n }\n ${t} a:visited {\n color: ${n};\n text-decoration-line: underline;\n }\n ${t} a:hover {\n color: ${n};\n }\n ${t} a:active {\n color: ${n};\n text-decoration-line: underline;\n }\n `)}let yc=class extends Qi{component;constructor(e){super(),this.component=e}styles(){const{component:e}=this;return"legal"===e.textType?as(`\n :host {\n display: block;\n overflow-wrap: break-word;\n width: fit-content;\n ${Ao(e)}\n color: ${e.fontColor};\n font-size: ${e.fontSize??12}px;\n text-align: ${e.alignment||"center"};\n ${Co(e)}\n ${Io(e)}\n }\n :host p {\n margin: 0;\n }\n ${bc(e,":host")}\n `):as(`\n :host {\n display: flex;\n width: fit-content;\n ${function(e){return"fitContent"===e.width?"white-space: nowrap;":"overflow-wrap: anywhere;"}(e)}\n ${Ao(e)}\n ${e.fontColor?`color: ${e.fontColor};`:""}\n font-size: ${e.fontSize??12}px;\n text-align: ${e.alignment||"center"};\n ${Eo("string"!=typeof e.strikethrough&&e.strikethrough)}\n ${Co(e)}\n ${Io(e)}\n }\n :host p {\n margin: 0;\n }\n ${as(bc(e,":host"))}\n `)}render(){if(!this.component.text)return this.style.display="none",null;const e=gc.parse(this.component.text);return Ws`${oa(e)}`}};oe([to({type:Object})],yc.prototype,"component",void 0),yc=oe([Zi("nami-text")],yc);let _c=class extends Qi{component;constructor(e){super(),this.component=e}styles(){return as(`\n :host { \n display: flex;\n transition: all 0.3s;\n &:not(:first-child) {\n margin-top: ${this.component.spacing||0}px;\n }\n }\n `)}render(){return Ws`<slot></slot>`}};oe([to({type:Object})],_c.prototype,"component",void 0),_c=oe([Zi("nami-text-list-item-wrapper")],_c);let vc=class extends Qi{component;constructor(e){super(),this.component=e}styles(){return as(`\n :host { \n display: flex;\n overflow-wrap: anywhere;\n transition: all 0.3s;\n margin-right: ${this.component.rightMargin||this.component.spacing||0}px;\n ${Ao(this.component)}\n color: ${this.component.fontColor};\n font-size: ${this.component.fontSize??12}px;\n }\n `)}render(){let e=Ws`<slot></slot>`;var t;return this.component,e=Ws`
42
+ <span role="img" aria-label="${this.component.name}" class="anticon anticon-${this.component.name}">
43
+ <svg viewBox="64 64 896 896" focusable="false" data-icon="${this.component.name}" width="1em" height="1em" fill="currentColor" aria-hidden="true">
44
+ ${t=this.component.name,mc[t]||mc.check_circle}
45
+ </svg>
46
+ </span>`,e}};oe([to({type:Object})],vc.prototype,"component",void 0),vc=oe([Zi("nami-symbol")],vc);let wc=class extends Qi{component;constructor(e){super(),this.component=e}styles(){return as(`\n :host {\n line-height: 1.5715;\n display: grid;\n overflow-wrap: anywhere;\n width: fit-content;\n ${Ao(this.component)}\n color: ${this.component.fontColor};\n font-size: ${this.component.fontSize??12}px;\n text-align: ${this.component.alignment||"center"};\n ${Eo("string"!=typeof this.component.strikethrough&&this.component.strikethrough)}\n ${Co(this.component)}\n ${Io(this.component)}\n ${bc(this.component)}\n ${So(this.component)}\n ${$o(this.component)}\n }\n :host > :not(:first-child) {\n margin-top: ${this.component.spacing||0}px;\n }\n .anticon {\n text-rendering: optimizelegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n color: inherit;\n display: inline-block;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -.125em;\n }\n .anticon svg {\n display: inline-block;\n line-height: 1;\n }\n\n :host .bullet-text-wrapper {\n line-height: 1.5715;\n display: inline;\n overflow-wrap: anywhere;\n width: fit-content;\n ${Ao(this.component)}\n color: ${this.component.fontColor};\n font-size: ${this.component.fontSize??12}px;\n text-align: ${this.component.alignment||"center"};\n ${Eo("string"!=typeof this.component.strikethrough&&this.component.strikethrough)}\n ${Co(this.component)}\n }\n :host .bullet-text-wrapper p {\n margin: 0;\n line-height: 1.2em;\n }\n ${bc(this.component,":host .bullet-text-wrapper")}\n `)}render(){const{fontColor:e,fontSize:t,bulletComponent:n,texts:r,spacing:s}=this.component,i=n?{fontColor:e,fontSize:t,spacing:s,...n}:null;if(!Array.isArray(r))return null;const o=r.map((e=>e?Ws`<nami-text-list-item-wrapper .component=${this.component}>
47
+ ${i&&Ws`<nami-symbol .component=${i}></nami-symbol>`}
48
+ <div class="bullet-text-wrapper">${oa(`${gc.parse(e)}`)}</div>
49
+ </nami-text-list-item-wrapper>`:null));return Ws`${o}`}};oe([to({type:Object})],wc.prototype,"component",void 0),wc=oe([Zi("nami-text-list")],wc),bo("text",yc),bo("text-list",wc),bo("symbol",vc);let kc=class extends Qi{component;constructor(e){super(),this.component=e}styles(){const e=this.component,t="vertical"===e.direction,n=t?"width":"height",r=t?"margin-top":"margin-left",s=e.fillImage?as(`\n line-height: 1.5715;\n background-image: url(${e.fillImage});\n background-size: cover;\n background-position: center;\n background-repeat: no-repeat;\n height: 100%;\n width: 100%;\n `):as(Ao(e));return as(`\n :host {\n display: flex;\n ${s};\n ${Po(e.position)}\n ${So(e)}\n ${Io(e)}\n }\n :host > * {\n ${n}: 100%;\n }\n :host > :not(:first-child) {\n ${r}: ${e.spacing||0}px;\n }\n `)}render(){return this.component.components.map((e=>yo(e)))}};oe([to({type:Object})],kc.prototype,"component",void 0),kc=oe([Zi("nami-container")],kc),bo("container",kc);let Ac=class extends Qi{component;constructor(e){super(),this.component=e}styles(){const e="vertical"===this.component.direction,t=e?"width":"height",n=e?"margin-top":"margin-left",r=this.component.fillImage?as(`\n line-height: 1.5715;\n background-image: url(${this.component.fillImage});\n background-size: cover;\n background-position: center;\n background-repeat: no-repeat;\n height: 100%;\n width: 100%;\n `):as(Ao(this.component));return as(`\n :host {\n display: flex;\n ${r};\n ${Po(this.component.position)}\n ${So(this.component)}\n ${Io(this.component)}\n justify-content: center;\n }\n :host > * {\n ${t}: 100%;\n }\n :host > :not(:first-child) {\n ${n}: ${this.component.spacing||0}px;\n }\n `)}_offerState(){const{anySkuHasTrialOffer:e,anySkuHasIntroOffer:t,anySkuHasPromoOffer:n}=Ki.state;return{freeTrialEligible:e,introEligible:t,promoEligible:n}}render(){const{skuItems:e,mediaList:t}=Ki.state,n=function(e,t,n={},r){const s=t.productBaseComponents||t.components||[],i=t.productFeaturedComponents||s;return e.map((e=>{const t=e.featured?i:s,o={sku:{...e,...e.variables,...r,id:e.sku_ref_id},media:fo(n,{convertToUrl:!0})};return[e.featured,lo(t,lo(o,o))]}),[])}(e,this.component,t,this._offerState());return n.map((([,e])=>e.map((e=>yo(e)))))}};oe([to({type:Object})],Ac.prototype,"component",void 0),Ac=oe([Zi("nami-product-container")],Ac),bo("productContainer",Ac);let Sc=class extends Qi{component;constructor(e){super(),this.component=e}styles(){const{url:e,imageCropping:t,alignment:n,height:r,width:s,rightMargin:i,spacing:o}=this.component;return as(`\n :host {\n box-sizing: border-box;\n position: relative;\n transition: all 0.3s;\n background-image: url(${e});\n background-size: ${"fit"===t?"contain":"cover"};\n background-position: ${n||""} center;\n background-repeat: no-repeat;\n height: ${ko(r??"100%")};\n width: ${ko(s??"100%")};\n margin-right: ${i||o||0}px;\n ${xo(this.component)}\n }\n `)}render(){return Ws``}};oe([to({type:Object})],Sc.prototype,"component",void 0),Sc=oe([Zi("nami-image")],Sc),bo("image",Sc);let xc=class extends Qi{component;device="desktop";zIndex=1;fullscreen=!1;styles(){return as(`\n :host {\n display: flex;\n flex-direction: column;\n justify-content: center;\n overflow: hidden;\n align-items: center;\n position: absolute;\n width: 100%;\n bottom: -1px;\n background-repeat: no-repeat;\n background-size: cover;\n background-position: center;\n z-index: ${this.component.zIndex};\n border-radius: ${"phone"===this.device?this.fullscreen?0:30:0}px;\n top: ${"phone"===this.device?this.fullscreen?0:40:0}px;\n ${Ao(this.component)}\n transition: all 0.3s;\n ${xo(this.component)}\n }\n `)}render(){return this.component.components.map((e=>yo(e)))}};oe([to({type:Object})],xc.prototype,"component",void 0),oe([to({type:String})],xc.prototype,"device",void 0),oe([to({type:Number})],xc.prototype,"zIndex",void 0),oe([to({type:Boolean})],xc.prototype,"fullscreen",void 0),xc=oe([Zi("nami-background-container")],xc);let $c=class extends Qi{component;zIndex=2;device="desktop";inFocusedState=!1;styles(){return as(`\n :host {\n display: flex;\n ${So(this.component)}\n height: 100%;\n ${"phone"!==this.device?"width: 100%":""};\n align-items: center;\n justify-content: start;\n z-index: ${this.zIndex};\n transition: all 0.3s;\n overflow-y: scroll;\n overflow-x: hidden;\n scrollbar-width: none;\n ::-webkit-scrollbar {\n display: none;\n }\n -ms-overflow-style: none; /* IE and Edge */\n scrollbar-width: none; /* Firefox */\n ${xo(this.component)}\n }\n :host > * {\n width: 100%;\n }\n \n :host > *:not(:first-child) {\n ${"vertical"===this.component.direction?`margin-top: ${this.component.spacing||0}px;`:`margin-left: ${this.component.spacing||0}px;`}\n `)}render(){return this.component.components.map((e=>yo(e)))}};oe([to({type:Object})],$c.prototype,"component",void 0),oe([to({type:Number})],$c.prototype,"zIndex",void 0),oe([to({type:String})],$c.prototype,"device",void 0),oe([to({type:Boolean})],$c.prototype,"inFocusedState",void 0),$c=oe([Zi("nami-content-container")],$c);let Ec=class extends Qi{component;constructor(e){super(),this.component=e,this.addEventListener("click",this._handleClick)}_handleClick=()=>{Zo(this.component.onTap)};styles(){return as(`\n :host {\n cursor: pointer;\n ${Ao(this.component)}\n ${Io(this.component)}\n }\n `)}render(){return this.component.components.map((e=>yo(e)))}};oe([to({type:Object})],Ec.prototype,"component",void 0),Ec=oe([Zi("nami-segment-picker")],Ec),bo("segmentPicker",Ec);let Cc=class extends Qi{component;inFocusedState=!1;constructor(e){super(),this.component=e,this.classList.toggle("active",e.id===Ki.state.currentGroupId),this.addEventListener("click",this._handleClick),this.addEventListener("mouseover",this._handleHover)}_handleClick=()=>{Ki.setCurrentGroupId(this.component.id)};_handleHover=()=>{this.inFocusedState=!0};getComponentStyles(e){return Object.keys(this.component).filter((t=>t.startsWith(e))).reduce(((t,n)=>(t[this.formatKey(n,e)]=this.component[n],t)),{})}formatKey(e,t){const n=e.replace(t,"");return n.charAt(0).toLowerCase()+n.slice(1)}applyStyles(e){return`\n ${Ao(e)}\n ${e.fontColor?`color: ${e.fontColor};`:""}\n font-size: ${e.fontSize??12}px;\n text-align: ${e.alignment||"center"};\n font-family: '${e.fontName}', '${(e.fontName||"").split("-")}', 'Helvetica';\n ${Io(e,this.inFocusedState)}\n width: 50% !important;\n height: 100% !important;\n `}styles(){const e=this.getComponentStyles("active"),t=this.getComponentStyles("inactive");return as(`\n :host {\n display: inline-flex;\n cursor: pointer;\n ${this.applyStyles({...t,...this.component})}\n }\n\n :host(.active), :host(:hover) {\n ${this.applyStyles({...e,...this.component})}\n }\n `)}render(){return Ws`<span>${this.component.text}</span>`}};oe([to({type:Object})],Cc.prototype,"component",void 0),oe([to({type:Boolean})],Cc.prototype,"inFocusedState",void 0),Cc=oe([Zi("nami-segment-picker-item")],Cc),bo("segmentPickerItem",Cc),e.Nami=Zr,e.NamiCampaignManager=so,e.NamiCustomerManager=co,e.NamiPaywallManager=ts}));