@namiml/web-sdk 3.4.3-dev.202606120301 → 3.4.3-dev.202606121440

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.
package/dist/nami-web.cjs CHANGED
@@ -251,7 +251,7 @@
251
251
  .nami-modal-content nami-content-container {
252
252
  overflow: visible;
253
253
  }
254
- `)),Fe=e=>(t,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)},Oe=globalThis,We=Oe.ShadowRoot&&(void 0===Oe.ShadyCSS||Oe.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,$e=Symbol(),Ne=new WeakMap,je=function(){return m(function e(t,i,n){if(u(this,e),this._$cssResult$=!0,n!==$e)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=i},[{key:"styleSheet",get:function(){var e=this.o,t=this.t;if(We&&void 0===e){var i=void 0!==t&&1===t.length;i&&(e=Ne.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Ne.set(t,e))}return e}},{key:"toString",value:function(){return this.cssText}}])}(),Be=(e,t)=>{if(We)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(var i,n=f(t);!(i=n()).done;){var a=i.value,r=document.createElement("style"),o=Oe.litNonce;void 0!==o&&r.setAttribute("nonce",o),r.textContent=a.cssText,e.appendChild(r)}},ze=We?e=>e:e=>e instanceof CSSStyleSheet?(e=>{for(var t,i="",n=f(e.cssRules);!(t=n()).done;){i+=t.value.cssText}return(e=>new je("string"==typeof e?e:e+"",void 0,$e))(i)})(e):e,Ue=Object.is,He=Object.defineProperty,Ge=Object.getOwnPropertyDescriptor,Ve=Object.getOwnPropertyNames,Ke=Object.getOwnPropertySymbols,Xe=Object.getPrototypeOf,Ye=globalThis,qe=Ye.trustedTypes,Je=qe?qe.emptyScript:"",Qe=Ye.reactiveElementPolyfillSupport,Ze=(e,t)=>e,et={toAttribute(e,t){switch(t){case Boolean:e=e?Je:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){var i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},tt=(e,t)=>!Ue(e,t),it={attribute:!0,type:String,converter:et,reflect:!1,useDefault:!1,hasChanged:tt};null!==(Ce=Symbol.metadata)&&void 0!==Ce||(Symbol.metadata=Symbol("metadata")),null!==(Ie=Ye.litPropertyMetadata)&&void 0!==Ie||(Ye.litPropertyMetadata=new WeakMap);var nt=function(){function e(){var t;return u(this,e),(t=s(this,e))._$Ep=void 0,t.isUpdatePending=!1,t.hasUpdated=!1,t._$Em=null,t._$Ev(),t}return y(e,D(HTMLElement)),m(e,[{key:"_$Ev",value:function(){var e;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),null===(e=this.constructor.l)||void 0===e||e.forEach(e=>e(this))}},{key:"addController",value:function(e){var t,i;(null!==(t=this._$EO)&&void 0!==t?t:this._$EO=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&(null===(i=e.hostConnected)||void 0===i||i.call(e))}},{key:"removeController",value:function(e){var t;null===(t=this._$EO)||void 0===t||t.delete(e)}},{key:"_$E_",value:function(){for(var e,t=new Map,i=f(this.constructor.elementProperties.keys());!(e=i()).done;){var n=e.value;this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n])}t.size>0&&(this._$Ep=t)}},{key:"createRenderRoot",value:function(){var e,t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return Be(t,this.constructor.elementStyles),t}},{key:"connectedCallback",value:function(){var e,t;null!==(e=this.renderRoot)&&void 0!==e||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$EO)||void 0===t||t.forEach(e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)})}},{key:"enableUpdating",value:function(e){}},{key:"disconnectedCallback",value:function(){var e;null===(e=this._$EO)||void 0===e||e.forEach(e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)})}},{key:"attributeChangedCallback",value:function(e,t,i){this._$AK(e,i)}},{key:"_$ET",value:function(e,t){var i=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,i);if(void 0!==n&&!0===i.reflect){var a,r=(void 0!==(null===(a=i.converter)||void 0===a?void 0:a.toAttribute)?i.converter:et).toAttribute(t,i.type);this._$Em=e,null==r?this.removeAttribute(n):this.setAttribute(n,r),this._$Em=null}}},{key:"_$AK",value:function(e,t){var i=this.constructor,n=i._$Eh.get(e);if(void 0!==n&&this._$Em!==n){var a,r,o,s=i.getPropertyOptions(n),u="function"==typeof s.converter?{fromAttribute:s.converter}:void 0!==(null===(a=s.converter)||void 0===a?void 0:a.fromAttribute)?s.converter:et;this._$Em=n;var l=u.fromAttribute(t,s.type);this[n]=null!==(r=null!=l?l:null===(o=this._$Ej)||void 0===o?void 0:o.get(n))&&void 0!==r?r:l,this._$Em=null}}},{key:"requestUpdate",value:function(e,t,i,n=!1,a){if(void 0!==e){var r,o,s=this.constructor;if(!1===n&&(a=this[e]),null!=i||(i=s.getPropertyOptions(e)),!((null!==(r=i.hasChanged)&&void 0!==r?r:tt)(a,t)||i.useDefault&&i.reflect&&a===(null===(o=this._$Ej)||void 0===o?void 0:o.get(e))&&!this.hasAttribute(s._$Eu(e,i))))return;this.C(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}},{key:"C",value:function(e,t,{useDefault:i,reflect:n,wrapped:a},r){var o,s,u;i&&!(null!==(o=this._$Ej)&&void 0!==o?o:this._$Ej=new Map).has(e)&&(this._$Ej.set(e,null!==(s=null!=r?r:t)&&void 0!==s?s:this[e]),!0!==a||void 0!==r)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),!0===n&&this._$Em!==e&&(null!==(u=this._$Eq)&&void 0!==u?u:this._$Eq=new Set).add(e))}},{key:"_$EP",value:function(){var e,t;return S(function(i){for(;;)switch(i.p=i.n){case 0:return this.isUpdatePending=!0,i.p=1,i.n=2,o(this._$ES);case 2:i.n=4;break;case 3:i.p=3,t=i.v,Promise.reject(t);case 4:if(e=this.scheduleUpdate(),!(null!=e)){i.n=5;break}return i.n=5,o(e);case 5:return i.a(2,!this.isUpdatePending)}},null,this,[[1,3]],Promise)}},{key:"scheduleUpdate",value:function(){return this.performUpdate()}},{key:"performUpdate",value:function(){if(this.isUpdatePending){if(!this.hasUpdated){var e;if(null!==(e=this.renderRoot)&&void 0!==e||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(var t,i=f(this._$Ep);!(t=i()).done;){var n=t.value,a=n[0],r=n[1];this[a]=r}this._$Ep=void 0}var o=this.constructor.elementProperties;if(o.size>0)for(var s,u=f(o);!(s=u()).done;){var l=s.value,d=l[0],h=l[1],c=h.wrapped,m=this[d];!0!==c||this._$AL.has(d)||void 0===m||this.C(d,void 0,h,m)}}var v=!1,p=this._$AL;try{var g;(v=this.shouldUpdate(p))?(this.willUpdate(p),null!==(g=this._$EO)&&void 0!==g&&g.forEach(e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)}),this.update(p)):this._$EM()}catch(p){throw v=!1,this._$EM(),p}v&&this._$AE(p)}}},{key:"willUpdate",value:function(e){}},{key:"_$AE",value:function(e){var t;null!==(t=this._$EO)&&void 0!==t&&t.forEach(e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}},{key:"_$EM",value:function(){this._$AL=new Map,this.isUpdatePending=!1}},{key:"updateComplete",get:function(){return this.getUpdateComplete()}},{key:"getUpdateComplete",value:function(){return this._$ES}},{key:"shouldUpdate",value:function(e){return!0}},{key:"update",value:function(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(e=>this._$ET(e,this[e]))),this._$EM()}},{key:"updated",value:function(e){}},{key:"firstUpdated",value:function(e){}}],[{key:"addInitializer",value:function(e){var t;this._$Ei(),(null!==(t=this.l)&&void 0!==t?t:this.l=[]).push(e)}},{key:"observedAttributes",get:function(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}},{key:"createProperty",value:function(e,t=it){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){var i=Symbol(),n=this.getPropertyDescriptor(e,i,t);void 0!==n&&He(this.prototype,e,n)}}},{key:"getPropertyDescriptor",value:function(e,t,i){var n,a=null!==(n=Ge(this.prototype,e))&&void 0!==n?n:{get(){return this[t]},set(e){this[t]=e}},r=a.get,o=a.set;return{get:r,set(t){var n=null==r?void 0:r.call(this);null!=o&&o.call(this,t),this.requestUpdate(e,n,i)},configurable:!0,enumerable:!0}}},{key:"getPropertyOptions",value:function(e){var t;return null!==(t=this.elementProperties.get(e))&&void 0!==t?t:it}},{key:"_$Ei",value:function(){if(!this.hasOwnProperty(Ze("elementProperties"))){var e=Xe(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}}},{key:"finalize",value:function(){if(!this.hasOwnProperty(Ze("finalized"))){if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ze("properties")))for(var e=this.properties,t=0,i=[...Ve(e),...Ke(e)];t<i.length;t++){var n=i[t];this.createProperty(n,e[n])}var a=this[Symbol.metadata];if(null!==a){var r=litPropertyMetadata.get(a);if(void 0!==r)for(var o,s=f(r);!(o=s()).done;){var u=o.value,l=u[0],d=u[1];this.elementProperties.set(l,d)}}this._$Eh=new Map;for(var h,c=f(this.elementProperties);!(h=c()).done;){var m=h.value,v=m[0],p=m[1],g=this._$Eu(v,p);void 0!==g&&this._$Eh.set(g,v)}this.elementStyles=this.finalizeStyles(this.styles)}}},{key:"finalizeStyles",value:function(e){var t=[];if(Array.isArray(e))for(var i,n=f(new Set(e.flat(1/0).reverse()));!(i=n()).done;){var a=i.value;t.unshift(ze(a))}else void 0!==e&&t.push(ze(e));return t}},{key:"_$Eu",value:function(e,t){var i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}}])}();nt.elementStyles=[],nt.shadowRootOptions={mode:"open"},nt[Ze("elementProperties")]=new Map,nt[Ze("finalized")]=new Map,null!=Qe&&Qe({ReactiveElement:nt}),(null!==(Le=Ye.reactiveElementVersions)&&void 0!==Le?Le:Ye.reactiveElementVersions=[]).push("2.1.2");var at={attribute:!0,type:String,converter:et,reflect:!1,hasChanged:tt},rt=(e=at,t,i)=>{var n=i.kind,a=i.metadata,r=globalThis.litPropertyMetadata.get(a);if(void 0===r&&globalThis.litPropertyMetadata.set(a,r=new Map),"setter"===n&&((e=Object.create(e)).wrapped=!0),r.set(i.name,e),"accessor"===n){var o=i.name;return{set(i){var n=t.get.call(this);t.set.call(this,i),this.requestUpdate(o,n,e,!0,i)},init(t){return void 0!==t&&this.C(o,void 0,e,t),t}}}if("setter"===n){var s=i.name;return function(i){var n=this[s];t.call(this,i),this.requestUpdate(s,n,e,!0,i)}}throw Error("Unsupported decorator location: "+n)};function ot(e){return(t,i)=>"object"==typeof i?rt(e,t,i):((e,t,i)=>{var n=t.hasOwnProperty(i);return t.constructor.createProperty(i,e),n?Object.getOwnPropertyDescriptor(t,i):void 0})(e,t,i)}function st(e){return ot(v({},e,{state:!0,attribute:!1}))}var ut=function(){function t(e,i,n){var a;return u(this,t),(a=s(this,t,[e,i,n])).host=null,a.defineDynamicStateProps(),a}return y(t,e.PaywallState),m(t,[{key:"hostConnected",value:function(){}},{key:"hostDisconnected",value:function(){this.subscribers.clear()}},{key:"onStateChanged",value:function(){this.defineDynamicStateProps(),this.host&&this.host.requestUpdate()}},{key:"defineDynamicStateProps",value:function(){Object.defineProperty(this.state,"tvQuality",{get:this.getTVQuality.bind(this),enumerable:!1,configurable:!0}),Object.defineProperty(this.state,"viewportWidth",{get:this.getViewportWidth.bind(this),enumerable:!1,configurable:!0}),Object.defineProperty(this.state,"viewportHeight",{get:this.getViewportHeight.bind(this),enumerable:!1,configurable:!0})}},{key:"getTVQuality",value:function(){var e,t;if("television"!==this.getFormFactor())return"";var i=window.devicePixelRatio||1,n=window.innerWidth||(null===(e=window.screen)||void 0===e?void 0:e.availWidth),a=window.innerHeight||(null===(t=window.screen)||void 0===t?void 0:t.availHeight);if(!n||!a)return"720p";var r=Math.max(n,a)*i,o=Math.min(n,a)*i;return r>=3840||o>=2160?"4K":r>=1920||o>=1080?"1080p":"720p"}},{key:"getViewportWidth",value:function(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth}},{key:"getViewportHeight",value:function(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}}],[{key:"create",value:function(e,i,n){var a=new t(e,i,n);return this.providers.push(a),a}},{key:"remove",value:function(e){this.providers=this.providers.filter(t=>t!==e)}},{key:"currentProvider",get:function(){return this.providers[0]}}])}();var lt=e=>{var t;return S(function(i){for(;;)if(0===i.n)return t=new Set(Array.from(document.fonts.values()).map(e=>e.family)),e.forEach(e=>{var i=dt(e);if(!t.has(i)){var n=new FontFace(i,`url(${e.file})`);document.fonts.add(n)}}),i.a(2,document.fonts.ready.then())},null,null,null,Promise)};function dt(e){return`${e.family}-${e.style}`.replace(/ /g,"")}function ht(t,i,n){var a,r,o,s,u,l,d,h;if("undefined"==typeof window||!t||!i)return e.logger.debug("Swipe detection is not supported in this environment."),{destroy(){},updateOptions(){}};var c={minDistance:null!==(a=null==n?void 0:n.minDistance)&&void 0!==a?a:30,maxDuration:null!==(r=null==n?void 0:n.maxDuration)&&void 0!==r?r:600,lockAxis:null===(o=null==n?void 0:n.lockAxis)||void 0===o||o,preventScrollOnSwipe:null!==(s=null==n?void 0:n.preventScrollOnSwipe)&&void 0!==s&&s,pointerTypes:null!==(u=null==n?void 0:n.pointerTypes)&&void 0!==u?u:["touch"],passiveListeners:null===(l=null==n?void 0:n.passiveListeners)||void 0===l||l,axisHint:null!==(d=null==n?void 0:n.axisHint)&&void 0!==d?d:"y",edgeLeakThreshold:null!==(h=null==n?void 0:n.edgeLeakThreshold)&&void 0!==h?h:24},m=t.style.touchAction;c.preventScrollOnSwipe&&(t.style.touchAction="none");var f=null,v=0,p=0,g=0,y=0,b=0,w=null,k=null,S=!1,E=!1,T=!1,P=e=>{try{var t=window.getComputedStyle(e);if(!t)return!1;var i=t.overflowY;if("auto"!==i&&"scroll"!==i)return!1;var n=e;return n.scrollHeight>n.clientHeight}catch(e){return!1}},M=e=>c.pointerTypes.includes(e.pointerType),A=e=>{var i=e.composedPath?e.composedPath()[0]:e.target;if(M(e)&&null===f){f=e.pointerId,v=g=e.clientX,p=y=e.clientY,b=performance.now(),w=null,T=!1,S=!1,E=!1,(k="y"===c.axisHint?((e,t)=>{for(var i=e;i&&i!==t&&i instanceof HTMLElement;){var n,a;if(P(i))return i;i=i.parentElement||(null!==(n=null===(a=i.parentNode)||void 0===a?void 0:a.host)&&void 0!==n?n:null)}return null})(i,t):null)||(E=!0);try{var n;null==t||null===(n=t.setPointerCapture)||void 0===n||n.call(t,e.pointerId)}catch(t){try{var a;null==i||null===(a=i.setPointerCapture)||void 0===a||a.call(i,e.pointerId)}catch(e){}}}},D=e=>{if(e.pointerId===f&&M(e)){if(g=e.clientX,y=e.clientY,c.lockAxis&&!w){var t=Math.abs(g-v),n=Math.abs(y-p);(t>2||n>2)&&(w=n>=t?"y":"x")}if("y"===c.axisHint&&("y"===w||!c.lockAxis)){var a=y-p,r=a<0?"up":"down",o=Math.abs(a),s=performance.now()-b,u=o/Math.max(s,1),l=o>=c.minDistance||u>.5;if(k)if(l)E=!0;else if(((e,t)=>!!e&&("down"===t?e.scrollTop>0:e.scrollTop+e.clientHeight<e.scrollHeight-1))(k,r)){if(!(("down"===r&&k.scrollTop<=50||"up"===r&&k.scrollTop+k.clientHeight>=k.scrollHeight-50)&&u>.3))return void(S=!0);E=!0}else E=!0;var d=!k||o>=c.edgeLeakThreshold;if(!T&&!S&&E&&d&&o>=c.minDistance){T=!0;var h=performance.now(),m={direction:"up"===r?"up":"down",distanceX:g-v,distanceY:a,absX:Math.abs(g-v),absY:o,duration:h-b,velocity:o/Math.max(h-b,1),startX:v,startY:p,endX:g,endY:y,startedAt:b,endedAt:h,originalEvent:e};i(m)}}}},x=e=>{if(e.pointerId===f)if(M(e))if(k)C();else if(T||S)C();else{var t,n=performance.now(),a=n-b,r=g-v,o=y-p,s=Math.abs(r),u=Math.abs(o),l="x"===(t=c.lockAxis&&w?w:"x"===c.axisHint?"x":"y"===c.axisHint?"y":s>=u?"x":"y")?s:u,d=a<=c.maxDuration,h=c.minDistance;if(k&&"y"===t&&E&&(h+=c.edgeLeakThreshold),d&&l>=h){var m;m="x"===t?r>0?"right":"left":o>0?"down":"up";var P=l/Math.max(a,1);i({direction:m,distanceX:r,distanceY:o,absX:s,absY:u,duration:a,velocity:P,startX:v,startY:p,endX:g,endY:y,startedAt:b,endedAt:n,originalEvent:e})}C()}else C()},C=()=>{f=null,w=null,b=0,k=null,E=!1,S=!1,T=!1},I=!!c.passiveListeners&&{passive:!0},L=c.passiveListeners?{passive:!0,capture:!0}:{capture:!0};t.addEventListener("pointerdown",A,L),t.addEventListener("pointermove",D,I),t.addEventListener("pointerup",x,I),t.addEventListener("pointercancel",x,I),t.addEventListener("lostpointercapture",x,I);return{destroy:()=>{t.removeEventListener("pointerdown",A,L),t.removeEventListener("pointermove",D,I),t.removeEventListener("pointerup",x,I),t.removeEventListener("pointercancel",x,I),t.removeEventListener("lostpointercapture",x,I),c.preventScrollOnSwipe&&(t.style.touchAction=m),C()},updateOptions:e=>{Object.assign(c,e),"boolean"==typeof e.preventScrollOnSwipe&&(e.preventScrollOnSwipe?t.style.touchAction="none":t.style.touchAction=m)}}}var ct={},mt=ct.NAMI_CLOSE_PAYWALL,ft=void 0===mt?"namiClosePaywall":mt,vt=ct.NAMI_RESTORE_PURCHASES,pt=void 0===vt?"namiRestorePurchases":vt,gt=ct.NAMI_SIGN_IN,yt=void 0===gt?"namiSignIn":gt,bt=ct.NAMI_BUY_SKU,wt=void 0===bt?"namiBuySKU":bt,kt=ct.SET_STATE,St=void 0===kt?"setState":kt,Et=ct.NAMI_SELECT_SKU,Tt=void 0===Et?"namiSelectSKU":Et,Pt=ct.NAMI_PURCHASE_SELECTED_SKU,Mt=void 0===Pt?"namiPurchaseSelectedSKU":Pt,At=ct.NAMI_DEEP_LINK,Dt=void 0===At?"namiDeeplink":At,xt=ct.NAMI_NAVIGATE_TO_SCREEN,Ct=void 0===xt?"namiNavigateToScreen":xt,It=ct.NAMI_RELOAD_PRODUCTS,Lt=void 0===It?"namiReloadProducts":It,_t=ct.NAMI_PLAY_VIDEO,Rt=void 0===_t?"namiPlayVideo":_t,Ft=ct.NAMI_PAUSE_VIDEO,Ot=void 0===Ft?"namiPauseVideo":Ft,Wt=ct.NAMI_MUTE_VIDEO,$t=void 0===Wt?"namiMuteVideo":Wt,Nt=ct.NAMI_UNMUTE_VIDEO,jt=void 0===Nt?"namiUnmuteVideo":Nt,Bt=e=>"subscription"===e;function zt(e){if(Bt(null==e?void 0:e.product_type)){var t=Ht(e);if(t.length>0)return t[0].billingPeriod}return null}function Ut(e){var t=function(e){if(!e)return[];var t=e.offers.filter(e=>"promo"===e.offer_type);return Gt(t,e.subscription_period)}(e).find(e=>0===e.priceAmountMicros);return(null==t?void 0:t.billingPeriod)||null}function Ht(e){return e?Gt(e.offers.filter(e=>"default"===e.offer_type),e.subscription_period):[]}function Gt(e,t){return e.map(e=>Vt(e,t))}function Vt(e,t){var i,n,a,r,o,s,u,l;if(!e)return{};var d=null!==(i=null===(n=e.promo_period)||void 0===n?void 0:n.count)&&void 0!==i?i:null==t?void 0:t.count,h=null!==(a=null===(r=e.promo_period)||void 0===r?void 0:r.type)&&void 0!==a?a:null==t?void 0:t.type,c=null!==(o=null===(s=e.promo_price)||void 0===s?void 0:s.price)&&void 0!==o?o:e.price,m=null!==(u=null===(l=e.promo_price)||void 0===l?void 0:l.currency)&&void 0!==u?u:e.currency;return{priceAmountMicros:1e6*c,priceCurrencyCode:m,billingPeriod:h?`P${d}${h[0].toUpperCase()}`:"",formattedPrice:Yt(m).format(c)}}function Kt(t,i=!1,n=!1,a=!1,r=!1){if(!t)return null;var o=t.match(/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?/);if(!o)return null;var s=o.slice(1).map(e=>parseInt(e)),u=s[0],l=s[1],d=s[2],h=s[3],c=(t,i,n,a,o)=>{var s=(e=>r?`${e}_abbrev`:e)(o),u=(e=>r?`${e}_abbrev_plural`:`${e}_plural`)(o),l=e.getTranslate(s),d=e.getTranslate(u);return r||l!==s||(l=e.getTranslate(`${o}_abbrev`)),r||d!==u||(d=e.getTranslate(`${o}_abbrev_plural`)),a?t.toString():n?1===t||i?l:d:1===t||i?`${t} ${l}`:`${t} ${d}`};switch(t.at(-1)){case"D":return c(h,i,n,a,"nami_day");case"W":return c(d,i,n,a,"nami_week");case"M":return c(l,i,n,a,"nami_month");case"Y":return c(u,i,n,a,"nami_year")}return null}function Xt(e){var t;if(!e||e.length<2)return!1;var i=null===(t=e.at(-1))||void 0===t?void 0:t.toUpperCase();return"M"===i||"Y"===i}function Yt(e){var t={maximumFractionDigits:2,minimumFractionDigits:0};try{return new Intl.NumberFormat(navigator.language,v({},t,{style:"currency",currency:e}))}catch(e){return new Intl.NumberFormat(navigator.language,v({},t,{style:"currency",currency:"USD"}))}}var qt=(e,t,i)=>e&&t&&i?i.format(e-t):null,Jt=(e,t,i,n)=>{if(e&&t&&i&&n){var a=100*(1-e/(i/n*t));return`${Math.round(a)}%`}return null},Qt=(e,t)=>{if(""!=t){var i=parseInt(t)-1;return i>=0&&i<(null==e?void 0:e.length)?e[i]:null==e?void 0:e.find(e=>e.sku_ref_id===t)}},Zt=e=>ti(e.priceAmountMicros)/ei(e.billingPeriod),ei=e=>{var t=parseInt(e[1]);return e.includes("Y")&&(t*=12),t},ti=e=>e/1e6;function ii(e){return parseFloat((Math.round(e)/100).toFixed(2))}var ni=(t,i,n=[])=>({price:()=>ri(t),name:()=>null==t?void 0:t.name,title:()=>null==t?void 0:t.name,description:()=>null==t?void 0:t.description,duration:()=>oi(t),durationSingular:()=>oi(t,!0),period:()=>oi(t,!1,!0),periodNumber:()=>oi(t,!1,!1,!0),freeTrialDuration:()=>si(t),freeTrialDurationSingular:()=>si(t,!0),freeTrialPeriod:()=>si(t,!1,!0),freeTrialPeriodNumber:()=>si(t,!1,!1,!0),pricePerMonth:()=>ui(t),pricePerMonthRounded:()=>ui(t,!0),periodInMonths:()=>li(t),durationInMonths:()=>di(t),durationInMonthsSingular:()=>di(t,!0),periodNumberInMonths:()=>hi(t),percentagePriceDifferenceFromSku:()=>ci(t,i,n),priceDifferenceFromSku:()=>mi(t,i,n),promoEligible:()=>null===fi(t)&&null!==vi(t,i),freeTrialEligible:()=>null!==fi(t),promo:()=>{var e;return null===(e=vi(t,i))||void 0===e?void 0:e.offer_ref_id},promoCode:()=>"XXXXX",promoPrice:()=>{var e;return null===(e=pi(t,i))||void 0===e?void 0:e.formattedPrice},promoPeriod:()=>gi(t,i,!1,!0),promoPeriodNumber:()=>gi(t,i,!1,!1,!0),promoDuration:()=>gi(t,i),promoDurationSingular:()=>gi(t,i,!0),introEligible:()=>!1,pricePerDay:()=>Si(t),pricePerWeek:()=>Ei(t),pricePerWeekRounded:()=>Ei(t,!0),introductoryPrice:()=>wi(t,i),introductoryPeriod:()=>bi(t,i,!1,!0),introductoryPeriodNumber:()=>bi(t,i,!1,!1,!0),introductoryDuration:()=>bi(t,i),introductoryDurationSingular:()=>bi(t,i,!0),introductoryPricePerMonth:()=>ki(t,i),introductoryPricePerMonthRounded:()=>ki(t,i,!0),durationAbbrev:()=>oi(t,!1,!1,!1,!0),freeTrialDurationAbbrev:()=>si(t,!1,!1,!1,!0),introductoryDurationAbbrev:()=>bi(t,i,!1,!1,!1,!0),promoDurationAbbrev:()=>gi(t,i,!1,!1,!1,!0),promoDurationPhase2Abbrev:()=>gi(t,i,!0,!0,!1,!0),durationInMonthsAbbrev:()=>di(t,!1,!1,!1,!0),durationSingularAbbrev:()=>oi(t,!0,!1,!1,!0),freeTrialDurationSingularAbbrev:()=>si(t,!0,!1,!1,!0),introductoryDurationSingularAbbrev:()=>bi(t,i,!0,!1,!1,!0),promoDurationSingularAbbrev:()=>gi(t,i,!0,!1,!1,!0),promoDurationSingularPhase2Abbrev:()=>gi(t,i,!0,!0,!1,!0),durationInMonthsSingularAbbrev:()=>di(t,!0,!1,!1,!0),periodAbbrev:()=>oi(t,!1,!0,!1,!0),freeTrialPeriodAbbrev:()=>si(t,!1,!0,!1,!0),introductoryPeriodAbbrev:()=>bi(t,i,!1,!0,!1,!0),promoPeriodAbbrev:()=>gi(t,i,!1,!0,!1,!0),promoPeriodPhase2Abbrev:()=>gi(t,i,!1,!0,!0,!0),periodInMonthsAbbrev:()=>di(t,!1,!0,!1,!0),periodly:()=>function(t){if(!t)return null;var i=t.match(/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?/);if(!i)return null;var n=i[1],a=i[2],r=i[3],o=i[4],s=void 0!==n?parseInt(n,10):0,u=void 0!==a?parseInt(a,10):0,l=void 0!==r?parseInt(r,10):0;return(void 0!==o?parseInt(o,10):0)>0?null:l>0?1===l?e.getTranslate("nami_weekly"):2===l?e.getTranslate("nami_biweekly"):null:u>0?1===u?e.getTranslate("nami_monthly"):2===u?e.getTranslate("nami_bimonthly"):3===u?e.getTranslate("nami_quarterly"):6===u?e.getTranslate("nami_biannually"):12===u?e.getTranslate("nami_yearly"):e.getTranslate("nami_monthly"):s>0?e.getTranslate("nami_yearly"):null}(zt(t)),iso_subscription_duration:()=>Ti(t),invalid:()=>!1,unavailable:()=>!1}),ai=(e,t,i,n=[])=>{if(!t)return null;var a=ni(t,i,n);return a[e]?a[e]():null},ri=e=>{var t=Ht(e);return t&&t.length?t[0].formattedPrice:null},oi=(e,t,i,n,a)=>Kt(zt(e),t,i,n,a),si=(e,t,i,n,a)=>Kt(Ut(e),t,i,n,a),ui=(e,t)=>{var i=Ht(e);if(!i||0===i.length)return null;var n=Zt(i[0]);return n?Yt(i[0].priceCurrencyCode).format(t?Math.round(n):n):null},li=(e,t)=>{var i=Ht(e);if(!i||0===i.length)return null;var n=i[0].billingPeriod;return Xt(n)?Kt("P1Y"===n?"P12M":n,!1,!1,!1,t):null},di=(e,t,i,n,a)=>{var r=Ht(e);if(!r||0===r.length)return null;var o=r[0].billingPeriod;return Xt(o)?Kt("P1Y"===o?"P12M":o,t,i,n,a):null},hi=e=>{if(!e)return 0;var t=Ht(e);return t&&t.length?ei(t[0].billingPeriod):0},ci=(e,t,i=[])=>{var n,a=Ht(e);if(!a||0===a.length)return null;var r=null===(n=Qt(i,null!=t?t:""))||void 0===n?void 0:n.product_details;if(!t||!r)return Jt(ii(a[0].priceAmountMicros),hi(e));var o=Ht(r);return Jt(ii(a[0].priceAmountMicros),hi(e),(null==o?void 0:o.length)>0?ii(o[0].priceAmountMicros):0,hi(r))},mi=(e,t,i=[])=>{var n,a=Ht(e);if(!a||0===a.length)return null;var r=null===(n=Qt(i,null!=t?t:""))||void 0===n?void 0:n.product_details;if(!t||!r)return qt(Zt(a[0]));var o=Ht(r);return qt(Zt(a[0]),Zt(o[0]),Yt(o[0].priceCurrencyCode))},fi=e=>Ut(e),vi=(e,t)=>{if(!e)return null;var i=e.offers.filter(e=>"promo"===e.offer_type);if(!t)return i[0]||null;var n=i[parseInt(t)];return n?n||null:i.find(e=>e.offer_ref_id===t)||null},pi=(e,t)=>{if(!e)return null;var i=vi(e,t);return i?Vt(i,e.subscription_period):null},gi=(e,t,i,n,a,r)=>{var o=pi(e,t);return Kt((null==o?void 0:o.billingPeriod)||null,i,n,a,r)},yi=(e,t)=>{if(!e)return null;var i=((e,t)=>{if(!e)return null;var i=e.offers.filter(e=>"intro"===e.offer_type);if(!t)return i[0]||null;var n=i[parseInt(t)];return n?n||null:i.find(e=>e.offer_ref_id===t)||null})(e,t);return i?Vt(i,e.subscription_period):null},bi=(e,t,i,n,a,r)=>{var o=yi(e,t);return Kt((null==o?void 0:o.billingPeriod)||null,i,n,a,r)},wi=(e,t)=>{var i=yi(e,t);return i?i.formattedPrice:null},ki=(e,t,i)=>{var n=yi(e,t);if(!n)return null;var a=Zt(n);return a?Yt(n.priceCurrencyCode).format(i?Math.round(a):a):null},Si=e=>{var t=Ht(e);if(!t||0===t.length)return null;var i,n,a=ti(t[0].priceAmountMicros)/(i=t[0].billingPeriod,(n=ei(i))?30.437*n:1);return Yt(t[0].priceCurrencyCode).format(a)},Ei=(e,t)=>{var i=Ht(e);if(!i||0===i.length)return null;var n,a,r=ti(i[0].priceAmountMicros)/(n=i[0].billingPeriod,(a=ei(n))?52*a/12:1);return Yt(i[0].priceCurrencyCode).format(t?Math.round(r):r)},Ti=e=>{var t=Ht(e)[0];return t?t.billingPeriod:null},Pi="object"==typeof global&&global&&global.Object===Object&&global,Mi="object"==typeof self&&self&&self.Object===Object&&self,Ai=Pi||Mi||Function("return this")(),Di=Ai.Symbol;var xi=Array.isArray,Ci=Object.prototype,Ii=Ci.hasOwnProperty,Li=Ci.toString,_i=Di?Di.toStringTag:void 0;var Ri=Object.prototype.toString;var Fi=Di?Di.toStringTag:void 0;function Oi(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Fi&&Fi in Object(e)?function(e){var t=Ii.call(e,_i),i=e[_i];try{e[_i]=void 0;var n=!0}catch(e){}var a=Li.call(e);return n&&(t?e[_i]=i:delete e[_i]),a}(e):function(e){return Ri.call(e)}(e)}function Wi(e){return null!=e&&"object"==typeof e}var $i=Di?Di.prototype:void 0,Ni=$i?$i.toString:void 0;function ji(e){if("string"==typeof e)return e;if(xi(e))return function(e,t){for(var i=-1,n=null==e?0:e.length,a=Array(n);++i<n;)a[i]=t(e[i],i,e);return a}(e,ji)+"";if(function(e){return"symbol"==typeof e||Wi(e)&&"[object Symbol]"==Oi(e)}(e))return Ni?Ni.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Bi(e){return null==e?"":ji(e)}function zi(e,t,i){var n=e.length;return i=void 0===i?n:i,!t&&i>=n?e:function(e,t,i){var n=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(i=i>a?a:i)<0&&(i+=a),a=t>i?0:i-t>>>0,t>>>=0;for(var r=Array(a);++n<a;)r[n]=e[n+t];return r}(e,t,i)}var Ui=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");function Hi(e){return Ui.test(e)}var Gi="\\ud800-\\udfff",Vi="["+Gi+"]",Ki="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Xi="\\ud83c[\\udffb-\\udfff]",Yi="[^"+Gi+"]",qi="(?:\\ud83c[\\udde6-\\uddff]){2}",Ji="[\\ud800-\\udbff][\\udc00-\\udfff]",Qi="(?:"+Ki+"|"+Xi+")"+"?",Zi="[\\ufe0e\\ufe0f]?",en=Zi+Qi+("(?:\\u200d(?:"+[Yi,qi,Ji].join("|")+")"+Zi+Qi+")*"),tn="(?:"+[Yi+Ki+"?",Ki,qi,Ji,Vi].join("|")+")",nn=RegExp(Xi+"(?="+Xi+")|"+tn+en,"g");function an(e){return Hi(e)?function(e){return e.match(nn)||[]}(e):function(e){return e.split("")}(e)}var rn,on=(rn="toUpperCase",function(e){var t=Hi(e=Bi(e))?an(e):void 0,i=t?t[0]:e.charAt(0),n=t?zi(t,1).join(""):e.slice(1);return i[rn]()+n});var sn,un=(sn={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},function(e){return null==sn?void 0:sn[e]}),ln=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,dn=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");var hn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var cn=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var mn="\\ud800-\\udfff",fn="\\u2700-\\u27bf",vn="a-z\\xdf-\\xf6\\xf8-\\xff",pn="A-Z\\xc0-\\xd6\\xd8-\\xde",gn="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",yn="["+gn+"]",bn="\\d+",wn="["+fn+"]",kn="["+vn+"]",Sn="[^"+mn+gn+bn+fn+vn+pn+"]",En="(?:\\ud83c[\\udde6-\\uddff]){2}",Tn="[\\ud800-\\udbff][\\udc00-\\udfff]",Pn="["+pn+"]",Mn="(?:"+kn+"|"+Sn+")",An="(?:"+Pn+"|"+Sn+")",Dn="(?:['’](?:d|ll|m|re|s|t|ve))?",xn="(?:['’](?:D|LL|M|RE|S|T|VE))?",Cn="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",In="[\\ufe0e\\ufe0f]?",Ln=In+Cn+("(?:\\u200d(?:"+["[^"+mn+"]",En,Tn].join("|")+")"+In+Cn+")*"),_n="(?:"+[wn,En,Tn].join("|")+")"+Ln,Rn=RegExp([Pn+"?"+kn+"+"+Dn+"(?="+[yn,Pn,"$"].join("|")+")",An+"+"+xn+"(?="+[yn,Pn+Mn,"$"].join("|")+")",Pn+"?"+Mn+"+"+Dn,Pn+"+"+xn,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",bn,_n].join("|"),"g");function Fn(e,t,i){return e=Bi(e),void 0===t?function(e){return cn.test(e)}(e)?function(e){return e.match(Rn)||[]}(e):function(e){return e.match(hn)||[]}(e):e.match(t)||[]}var On=RegExp("['’]","g");var Wn,$n=(Wn=function(e,t,i){return t=t.toLowerCase(),e+(i?on(Bi(t).toLowerCase()):t)},function(e){return function(e,t,i){for(var n=-1,a=null==e?0:e.length;++n<a;)i=t(i,e[n],n,e);return i}(Fn(function(e){return(e=Bi(e))&&e.replace(ln,un).replace(dn,"")}(e).replace(On,"")),Wn,"")});function Nn(e,t,i){var n,a,r=null!==(n=null===(a=t.find(e=>e.id===i))||void 0===a?void 0:a.products)&&void 0!==n?n:[];return r.forEach(t=>{t.product_details=Un(e,t.sku_ref_id||""),t.variables=function(e,t,i){if(!t)return{};var n=t.variables;if(!n)return v({},t);Object.keys(n).forEach(t=>{if(jn(n[t])){var a=zn(n[t],e,i);n[t]=function(e){if(!e||e.includes("null")||e.includes("undefined"))return"";if(/\$\{\s*(launch\.customAttributes\.|sku\.)\w+\s*}/.test(e))return"";return e}(a)}});var a={};return(()=>Object.keys(ni({})))().forEach(t=>{if(void 0===n[t]){var r=ai(t,e,void 0,i);null!==r&&(a[t]=r)}}),v({},t,a,n)}(t.product_details,t,r)}),r}function jn(t){return"string"==typeof t&&t.includes(e.SMART_TEXT_PATTERN)}function Bn(e,t,i){return t?(Object.keys(t).forEach(n=>{jn(t[n])&&(t[n]=t[$n(n)]=zn(t[n],e,i))}),v({},t)):{}}var zn=(t,i,n)=>t.replace(e.SKU_TEXT_REGEX,(a,r)=>{var o,s,u,l,d=(null===(o=e.SKU_TEXT_REGEX.exec(t))||void 0===o?void 0:o.slice(1))||[];r=null!==(s=d[0])&&void 0!==s?s:r;var h=null!==(u=null===(l=d[1])||void 0===l?void 0:l.replace(":",""))&&void 0!==u?u:"";return ai(r,i,h,n)});function Un(e=[],t=""){return e.find(e=>e.product_ref_id===t)||null}var Hn=["conditionAttributes"];function Gn(e,t){return Array.isArray(e)?e.reduce((e,i)=>{var n=Gn(i,t);return Array.isArray(n)?[...e,...n]:[...e,n]},[]):null==e?e:"object"==typeof e?Object.entries(e).reduce((e,[i,n])=>{var a="newRow"===i?n:Gn(n,t);return v({},e,{[i]:a})},{}):"string"==typeof e?Zn(e,t):e}function Vn(t,i,n,a={}){var r=n.productBaseComponents||n.components||[],o=n.productFeaturedComponents||r;return i.map(i=>{var n,s,u,l=i.featured?o:r,d=i.entitlements.map(e=>e.entitlement_ref_id),h=Un(t.productDetails,i.sku_ref_id),c={freeTrialEligible:1==ai("freeTrialEligible",h),introEligible:1==ai("introEligible",h),promoEligible:1==ai("promoEligible",h),invalid:ai("invalid",h),unavailable:ai("unavailable",h)},m=v({},i,i.variables,c,{id:i.id,entitlements:d});s=i,u=t=>{for(var i,n=f(t);!(i=n()).done;){var a=i.value;a.sku=e.toNamiSKU(s),a.components&&u(a.components),a.collapseHeader&&a.collapseHeader.components&&u(a.collapseHeader.components)}},u(l);var p={sku:m,media:Qn(a,{convertToUrl:!0})};return[null!==(n=i.featured)&&void 0!==n&&n,Gn(l,Gn(p,p))]},[])}function Kn(e,t){if(!t.loopSource)return[];var i="string"==typeof t.loopSource?JSON.parse(t.loopSource):t.loopSource,n=(null!=i?i:[]).filter(i=>{var n;return!(null!==(n=t.loopSourceConditions)&&void 0!==n&&n.length)||t.loopSourceConditions.every(t=>Jn(e,t,i))}),a=t.groupBy,r=t.groupHeaderTemplate,o=e=>Gn(t.components,Gn({block:e},{block:e}));if(!a||!r)return[{key:"",header:null,items:n.map(o).filter(e=>null!=e)}];for(var s,u=[],l=new Map,d=f(n);!(s=d()).done;){var h=s.value,c=Gn(a,Gn({block:h},{block:h})),m=null==c?"":String(c);l.has(m)||(u.push(m),l.set(m,[])),l.get(m).push(h)}return u.map(e=>{var t={key:e};return{key:e,header:[Gn(r,Gn({group:t},{group:t}))],items:l.get(e).map(o)}})}function Xn(e,t){return t.assertions?t.assertions.every(Jn.bind(null,e)):!!t.orAssertions&&(!t.orAssertions.length||t.orAssertions.some(Jn.bind(null,e)))}function Yn(e,t){var i=t.conditionAttributes,n=function(e,t){if(null==e)return{};var i={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;i[n]=e[n]}return i}(t,Hn);return i?i.reduce((t,i)=>Xn(e,i)?(Object.entries(i.attributes).forEach(([t,n])=>{i.attributes[t]=qn(e,n)}),v({},t,i.attributes)):t,n):n}function qn(t,i,n,a=null){var r,o=null!==(r=null==t?void 0:t.flow)&&void 0!==r?r:{},s=o.manager,u=o.previousStepAvailable,l=o.nextStepAvailable,d=t.state,h={};return a&&(h={block:a}),h=v({},h,{state:d,urlParams:e.getUrlParams(),flow:{isLaunched:!(null==s||!s.flowOpen),previousStepAvailable:!!u,nextStepAvailable:!!l},launch:d.launch,sku:d.sku,customer:d.customer}),"string"==typeof i&&i.includes(e.SMART_TEXT_PATTERN)&&(i=Zn(i,h)),i}function Jn(t,{value:i,expected:n,operator:a},r){if(i=qn(t,i,0,r),n=qn(t,n,0,r),"equals"===a)return i===n;if("notEquals"===a)return i!==n;if("contains"===a){var o;if(Array.isArray(i)||"string"==typeof i||i instanceof String||(i=i.toString()),"collapse"==n)n+="_"+(null===(o=t.getCurrentCollapsibleSku())||void 0===o?void 0:o.skuId);return i.includes(n)}return"notContains"===a?(Array.isArray(i)||"string"==typeof i||i instanceof String||(i=i.toString()),!i.includes(n)):"set"===a?"boolean"==typeof n?!!i&&!i.toString().match(e.LIQUID_VARIABLE_REGEX)===n:!!i&&!i.toString().match(e.LIQUID_VARIABLE_REGEX):"notSet"===a?!i||i.toString().match(e.LIQUID_VARIABLE_REGEX):"gt"===a?i>n:"gte"===a?i>=n:"lt"===a?i<n:"lte"===a&&i<=n}function Qn(e,{convertToUrl:t}={convertToUrl:!1}){return Object.entries(e).reduce((e,[i,{content:n}])=>(t&&"string"!=typeof n&&n&&(n=URL.createObjectURL(n)),v({},e,{[i]:n})),{})}function Zn(t,i){var n=t;if("string"!=typeof t)return n;for(var a,r=new RegExp(e.VAR_REGEX.source,e.VAR_REGEX.flags),o=[];null!==(a=r.exec(t))&&(o.push(a),r.global);)a.index===r.lastIndex&&r.lastIndex++;for(var s=0,u=o;s<u.length;s++){var l=u[s],d=l[0],h=l[1],c=Zn(h,i);if(d===t)return m(d,c);c!==h&&(n=n.replace(h,c)),n=n.replace(e.VAR_REGEX,m)}return n;function m(e,t){var n=String(t).split("."),a=n[0];if(!a)return e;var r=ea(i,a);if(void 0===r)return e;if("object"==typeof r&&null!==r&&0===Object.keys(r).length)return"";var o=ea(i,...n);return void 0===o?"":"string"!=typeof o?o:Zn(o,i)}}function ea(e,...t){for(var i=e,n=0,a=t;n<a.length;n++){var r=a[n];if(null==i)return;i=Array.isArray(i)?i[+r]:i[r]}return i}var ta=e=>{var t=e.state.timeSpentOnPaywall;if(t)return Date.now()-t},ia=e=>{if(!e)return null;if(e.includes("#"))return e;var t=e.match(/[\d.]+/g);if(!t||t.length<3)return null;var i=t.map(Number),n=i[0],a=i[1],r=i[2],o=i[3],s=e=>Math.round(e).toString(16).padStart(2,"0"),u=void 0!==o&&o<1?s(255*o):"";return`#${s(n)}${s(a)}${s(r)}${u}`},na=(e,t)=>{if(!e||!t)return!0;var i=null!=e&&e.includes("rgb")?ia(e):e,n=null!=t&&t.includes("rgb")?ia(t):t;return(null==i?void 0:i.toLowerCase())===(null==n?void 0:n.toLowerCase())};function aa(e){var t,i,n,a,r,o,s,u,l,d,h,c,m;return{width:null!==(t=e.width)&&void 0!==t?t:20,railSpacing:null!==(i=e.railSpacing)&&void 0!==i?i:12,dotLineSpacing:null!==(n=e.dotLineSpacing)&&void 0!==n?n:10,lineTopOffset:null!==(a=e.lineTopOffset)&&void 0!==a?a:0,lineBottomOffset:null!==(r=e.lineBottomOffset)&&void 0!==r?r:0,lineWidth:null!==(o=e.lineWidth)&&void 0!==o?o:1,lineColor:null!==(s=e.lineColor)&&void 0!==s?s:"#C6CBD7",lineCornerRadius:null!==(u=e.lineCornerRadius)&&void 0!==u?u:0,dotSize:null!==(l=e.dotSize)&&void 0!==l?l:6,dotColor:null!==(d=e.dotColor)&&void 0!==d?d:"#C6CBD7",dotCornerRadius:null!==(h=e.dotCornerRadius)&&void 0!==h?h:3,dotBorderWidth:null!==(c=e.dotBorderWidth)&&void 0!==c?c:0,dotBorderColor:null!==(m=e.dotBorderColor)&&void 0!==m?m:"transparent",conditionAttributes:e.conditionAttributes}}function ra(e,t,i){for(var n,a=aa(t),r={key:i},o=Gn(t,Gn({group:r},{group:r})),s={dotSize:a.dotSize,dotColor:a.dotColor,dotCornerRadius:a.dotCornerRadius,dotBorderWidth:a.dotBorderWidth,dotBorderColor:a.dotBorderColor},u=f(null!==(l=o.conditionAttributes)&&void 0!==l?l:[]);!(n=u()).done;){var l,d,h=n.value;if(Xn(e,h)){var c=null!==(d=h.attributes)&&void 0!==d?d:{};s={dotSize:"number"==typeof c.dotSize?c.dotSize:s.dotSize,dotColor:"string"==typeof c.dotColor?c.dotColor:s.dotColor,dotCornerRadius:"number"==typeof c.dotCornerRadius?c.dotCornerRadius:s.dotCornerRadius,dotBorderWidth:"number"==typeof c.dotBorderWidth?c.dotBorderWidth:s.dotBorderWidth,dotBorderColor:"string"==typeof c.dotBorderColor?c.dotBorderColor:s.dotBorderColor}}}return s.dotCornerRadius=Math.min(s.dotCornerRadius,s.dotSize/2),s}var oa=!0,sa=!1,ua=!1,la=!1,da=!1,ha=!1,ca=null,ma=null,fa=null,va=null,pa=!1,ga="",ya=!1,ba=null,wa=null,ka=null,Sa=null,Ea=null,Ta=null,Pa=null,Ma=null,Aa=!1,Da=null,xa="",Ca=0,Ia=1,La=null,_a=[],Ra=new WeakMap,Fa=new WeakMap,Oa=1;function Wa(e){var t=Fa.get(e);return t||(t=Oa++,Fa.set(e,t)),String(t)}var $a=null,Na=null,ja=null,Ba=null;function za(e){return!0===e||"true"===e||"1"===e||"yes"===e}function Ua(e,t){if(function(){if("undefined"==typeof window)return!1;try{var e,t;return!!za(window.NAMI_TTS_DEBUG)||za(null===(e=window.localStorage)||void 0===e?void 0:e.getItem("nami:tts:debug"))||za(null===(t=window.localStorage)||void 0===t?void 0:t.getItem("NAMI_TTS_DEBUG"))}catch(e){return!1}}())try{t?console.debug(`[Nami TTS] ${e}`,t):console.debug(`[Nami TTS] ${e}`)}catch(e){}}function Ha(e="TTS is unavailable in this runtime."){sa||(sa=!0,Ua(e))}function Ga(e){if(!e)return"none";var t=e.id?`#${e.id}`:"",i=e.getAttribute("data-testid"),n=i?`[data-testid="${i}"]`:"";return`${e.tagName.toLowerCase()}${t}${n}`}function Va(e){return function(e){return null==e?"":String(e).replace(/[^.!?\n]*\$\{[^}]*subscribeUrl[^}]*\}[^.!?\n]*[.!?]?/gi,"To subscribe, follow the on-screen instructions.").replace(/\$\{[^}]+\}/g," ").replace(/\s+([.,!?;:])/g,"$1").replace(/\s+/g," ").trim()}(e)}function Ka(e){return e.toLowerCase().replace(/[^a-z0-9$]+/g," ").replace(/\s+/g," ").trim()}function Xa(e){return Va(String(null!=e?e:"").replace(/<[^>]*>/g," ").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`#>~]/g," "))}function Ya(e,t){var i=Va(t);i&&e[e.length-1]!==i&&e.push(i)}function qa(e,t=[]){var i=[];return[...e,...t].forEach(e=>{var t=function(e){var t=Va(e);if(!t)return[];for(var i=[],n=0,a=0;a<t.length;a+=1){var r=t.charAt(a),o=t.charAt(a+1);if(("."===r||"!"===r||"?"===r)&&(!o||/\s/.test(o))){var s=Va(t.slice(n,a+1));for(s&&i.push(s);a+1<t.length&&/\s/.test(t.charAt(a+1));)a+=1;n=a+1}}var u=Va(t.slice(n));u&&i.push(u);return i.length?i:[t]}(e);t.length||Ya(i,e),t.forEach(e=>Ya(i,e))}),i.slice(0,60)}function Ja(e){return Va(e.join(". ").replace(/\.\s*([.!?])/g,"$1"))}function Qa(e){var t,i=La;i&&(e&&i.id===e||(i.status="cancelled",(null===(t=La)||void 0===t?void 0:t.id)===i.id&&(La=null)))}function Za(){if("undefined"==typeof document)return null;for(var e=document.activeElement;e&&null!==(t=e.shadowRoot)&&void 0!==t&&t.activeElement;){var t,i,n;e=null!==(i=null===(n=e.shadowRoot)||void 0===n?void 0:n.activeElement)&&void 0!==i?i:e}return e}function er(e){return"undefined"!=typeof ShadowRoot&&e instanceof ShadowRoot}function tr(e){for(var t=[],i=null!=e?e:null;i;){i instanceof Element&&-1===t.indexOf(i)&&t.push(i);var n=i.parentNode;i=er(n)?n.host:n}return t}function ir(e,t){return!!t&&-1!==tr(t).indexOf(e)}function nr(e,t){if(!t)return!1;if(t===e)return!0;if(e.contains(t))return!0;var i=e.shadowRoot;return!!i&&(i.activeElement===t||i.contains(t))}function ar(e,t){t&&-1===e.indexOf(t)&&e.push(t)}function rr(e,t){var i=t.shadowRoot;i&&i.querySelectorAll('button,[role="button"],a,input,select,textarea,[tabindex]:not([tabindex="-1"])').forEach(t=>ar(e,t))}function or(e,t){var i,n=("function"==typeof(null==t?void 0:t.composedPath)?t.composedPath():null!==(i=null==t?void 0:t.composedPath)&&void 0!==i?i:[]).filter(e=>e instanceof Element);return n.length?n:tr(e)}function sr(e,t=[],i={}){var n=[];if(i.focusedElementOnly)return ar(n,e),n;var a=(t.length?t:tr(e)).filter(e=>e.isConnected),r=function(e,t){var i,n=t.find(e=>e.matches("nami-product-container"));if(n)return n;var a=tr(e).find(e=>e.matches("nami-product-container"));if(a)return a;var r=va&&"querySelectorAll"in va?va:"undefined"!=typeof document?document:null;return r&&null!==(i=Array.prototype.slice.call(r.querySelectorAll("nami-product-container")).find(t=>ir(t,e)))&&void 0!==i?i:null}(e,a);return ar(n,e),rr(n,e),a.forEach(t=>{var i=!!r&&(t===r||ir(r,t)),a=t!==e&&ir(t,e),o=t.matches('nami-product-container,nami-button,[role="button"],button,[tabindex]:not([tabindex="-1"])');(i||a||t===e)&&o&&(ar(n,t),rr(n,t))}),null!=r&&r.isConnected&&(ar(n,r),rr(n,r)),n}function ur(e){return Ra.has(e)}function lr(e,t,i=[]){var n=Va(t);if(!n)return!1;mr(),dr(void 0,"new-composite",!0);var a=sr(e,i,Dr()||Ar()?{focusedElementOnly:!1}:{focusedElementOnly:!0});return a.forEach(e=>function(e,t){var i=Va(t);return!!i&&(Ra.has(e)||Ra.set(e,{"aria-label":e.getAttribute("aria-label")}),e.setAttribute("aria-label",i),!0)}(e,n)),_a=a,!0}function dr(e,t="manual",i=!1){var n=e&&-1===_a.indexOf(e)?sr(e):_a;n.length&&(!i&&La&&n.some(e=>Ra.has(e))?Ua("composite restore skipped: transaction still active",{reason:t}):(mr(),n.forEach(e=>{var t=Ra.get(e);t&&(!function(e,t,i){null===i?e.removeAttribute(t):e.setAttribute(t,i)}(e,"aria-label",t["aria-label"]),Ra.delete(e))}),e&&-1===_a.indexOf(e)||(_a=[])))}function hr(e,t){Ra.has(e)&&(t instanceof Element&&nr(e,t)||(mr(),ka=setTimeout(()=>{(ka=null,e.isConnected)?nr(e,Za())||dr(e,"blur"):dr(e,"blur-disconnected",!0)},50)))}function cr(e){_a.length&&dr(void 0,e,!0)}function mr(){ka&&(clearTimeout(ka),ka=null)}function fr(){Sa&&(clearTimeout(Sa),Sa=null),$a=null}function vr(){Ea&&(clearTimeout(Ea),Ea=null)}function pr(){Ta&&(clearTimeout(Ta),Ta=null)}function gr(){Pa&&(clearTimeout(Pa),Pa=null)}function yr(){Ma&&(clearTimeout(Ma),Ma=null)}function br(e){Aa=!0,yr(),Ma=setTimeout(()=>{Ma=null,Aa=!1},kr(e)+500)}function wr(){yr(),Aa=!1}function kr(e){var t=Va(e),i=350*(t?t.split(/\s+/).filter(Boolean).length:0);return Math.min(3e4,Math.max(4e3,i))}function Sr(){return"undefined"==typeof window?null:window}function Er(){var e,t=null===(e=Sr())||void 0===e||null===(e=e.webOS)||void 0===e||null===(e=e.service)||void 0===e?void 0:e.request;return"function"==typeof t?t:null}function Tr(){return!!Er()}function Pr(){var e;if("undefined"==typeof window)return null;var t=null===(e=window.VIZIO)||void 0===e?void 0:e.Chromevox;return t&&"function"==typeof t.play?t:null}function Mr(){return"undefined"!=typeof window&&void 0!==window.speechSynthesis&&"function"==typeof window.speechSynthesis.speak&&"function"==typeof window.SpeechSynthesisUtterance}function Ar(){var e;if("undefined"==typeof window)return!1;var t=window,i=(null===(e=window.navigator)||void 0===e||null===(e=e.userAgent)||void 0===e?void 0:e.toLowerCase())||"";return!(!t.VIZIO&&-1===i.indexOf("vizio"))}function Dr(){var e,t;if("undefined"==typeof window)return!1;if(Ar())return!1;var i=(null===(e=window.navigator)||void 0===e||null===(e=e.userAgent)||void 0===e?void 0:e.toLowerCase())||"",n=Sr();return!!(null!=n&&n.webOS||null!=n&&n.webOSDev||null!=n&&n.PalmSystem||null!=n&&null!==(t=n.webOS)&&void 0!==t&&null!==(t=t.platform)&&void 0!==t&&t.tv||-1!==i.indexOf("webos")||-1!==i.indexOf("netcast"))}function xr(){var e;if("undefined"==typeof window)return!1;var t=window,i=(null===(e=window.navigator)||void 0===e||null===(e=e.userAgent)||void 0===e?void 0:e.toLowerCase())||"";return!!(t.tizen||-1!==i.indexOf("tizen")||-1!==i.indexOf("samsung")&&(-1!==i.indexOf("smart-tv")||-1!==i.indexOf("smarttv"))||-1!==i.indexOf("samsungbrowser")&&-1!==i.indexOf("tv"))}function Cr(e){return"string"==typeof e&&-1!==e.toLowerCase().indexOf("xbox")}function Ir(){var e,t,i;if("undefined"==typeof window)return!1;if(!0===ja)return!0;var n=window.navigator;return[n.userAgent,n.platform,n.vendor,null===(e=n.userAgentData)||void 0===e?void 0:e.platform,...(null!==(t=null===(i=n.userAgentData)||void 0===i?void 0:i.brands)&&void 0!==t?t:[]).map(e=>e.brand)].some(Cr)}function Lr(){if("undefined"==typeof window)return!1;try{return"television"===e.getDeviceFormFactor()}catch(e){return!1}}function _r(){if(da)return!1;var e=Pr();if(!e)return!1;try{return"function"!=typeof e.isEnabled||e.isEnabled()}catch(e){return!1}}function Rr(){return{televisionRuntime:Lr(),televisionTtsRuntime:Fr(),webos:Dr(),tizen:xr(),vizio:Ar(),xbox:Ir(),xboxClientHintsResult:ja,hasWebOsServiceRequest:Tr(),webOsRequestType:typeof Er(),hasWebSpeechApi:Mr(),webSpeechUnavailableForSession:ua,webOsLunaUnavailableForSession:la,vizioChromevoxUnavailableForSession:da}}function Fr(){return Lr()||Dr()||Ar()||xr()}function Or(){return Fr()&&!ua&&Mr()}function Wr(e){if(ha=e,Ua("set media playing",{playing:e,hasDeferredUtterance:!!ca}),!e&&ca){var t,i=ca;if(ca=null,i.options.transactionId&&(null===(t=La)||void 0===t?void 0:t.id)!==i.options.transactionId)return void Ua("drop stale deferred speech",{transactionId:i.options.transactionId,reason:i.options.reason});to(i.text,i.options)}}function $r(e){ua=!0,Ha(Dr()?"Web Speech TTS unavailable in this webOS runtime":"Web Speech TTS unavailable in this runtime"),Ua("web speech unavailable",{error:e})}function Nr(e){la=!0,Ua("webOS Luna unavailable",{error:e})}function jr(e,t){ca={text:e,options:t}}var Br={name:"webos-luna-tts",platform:"webos",isAvailable:function(){return Fr()&&!Ar()&&!la&&Tr()},speak:function(e,t){Ua("speakViaWebOsLuna:enter",{textPreview:e.slice(0,160),reason:t.reason,transactionId:t.transactionId,requestType:typeof Er()});var i=Er();if(!i)return Ua("speakViaWebOsLuna:no-request"),!1;var n="composite"===t.reason,a=!1,r=()=>{var r,o;if(Ta=null,t.transactionId&&(null===(r=La)||void 0===r?void 0:r.id)!==t.transactionId)return Ua("speakViaWebOsLuna:drop-stale-delayed-speak",{transactionId:t.transactionId,activeTransaction:null===(o=La)||void 0===o?void 0:o.id,reason:t.reason}),!1;if(ha)return Ua("speakViaWebOsLuna:defer-delayed-speak-media-playing",{transactionId:t.transactionId,reason:t.reason}),jr(e,t),!0;var s=!1;try{Ua("speakViaWebOsLuna:request",{uri:"luna://com.webos.service.tts",method:"speak",delayedComposite:n,textPreview:e.slice(0,160)}),i("luna://com.webos.service.tts",{method:"speak",parameters:{text:e,clear:!0,feedback:!0},onSuccess:e=>{var i;if(Ua("speakViaWebOsLuna:onSuccess",{response:e,transactionId:t.transactionId}),!t.transactionId||(null===(i=La)||void 0===i?void 0:i.id)===t.transactionId){var n,r=function(e){var t,i=Va(null!==(t=null==e?void 0:e.msgStatus)&&void 0!==t?t:null==e?void 0:e.status).toLowerCase();return"done"===i||"stopped"===i||"canceled"===i||"cancelled"===i||"error"===i}(e),o=!(null==e||!e.returnValue||"msgStatus"in Object(null!=e?e:{}));if(!a&&(r||o))a=!0,t.transactionId&&(null===(n=La)||void 0===n?void 0:n.id)===t.transactionId&&(La.status="ended",La=null)}},onFailure:e=>{var i;s=!0,Ua("speakViaWebOsLuna:onFailure",{error:e,transactionId:t.transactionId});var n=!t.transactionId||(null===(i=La)||void 0===i?void 0:i.id)===t.transactionId;t.transactionId&&n&&La&&(La.status="cancelled",La=null),Nr(e)}})}catch(e){var u;return t.transactionId&&(null===(u=La)||void 0===u?void 0:u.id)===t.transactionId&&(La.status="cancelled",La=null),Nr(e),!1}return!s};if(n)return pr(),Ua("speakViaWebOsLuna:delay-composite-until-focus-settles",{delayMs:250,transactionId:t.transactionId}),Ta=setTimeout(r,250),!0;return r()},stop:Hr},zr={name:"web-speech",platform:"web",isAvailable:Or,speak:function(e,t){if(!Or())return!1;try{var i=new window.SpeechSynthesisUtterance(e);return i.onstart=()=>{var e;t.transactionId&&(null===(e=La)||void 0===e?void 0:e.id)===t.transactionId&&(La.status="started")},i.onend=()=>{var e=La,i=!t.transactionId||(null==e?void 0:e.id)===t.transactionId;t.transactionId&&i&&e&&(e.status="ended",La=null)},i.onerror=e=>{var i,n=e.error;t.transactionId&&(null===(i=La)||void 0===i?void 0:i.id)===t.transactionId&&(La.status="cancelled",La=null),"synthesis-failed"===n&&$r(n)},window.speechSynthesis.speak(i),!0}catch(e){return $r("exception"),!1}},stop:()=>{if(Mr())try{window.speechSynthesis.cancel()}catch(e){}}},Ur={name:"vizio-chromevox",platform:"vizio",isAvailable:_r,speak:Vr,stop:Gr};function Hr(){var e=Er();if(e)try{e("luna://com.webos.service.tts",{method:"stop",parameters:{},onFailure:e=>Ua("webOS Luna stop failed",{error:e})})}catch(e){Ua("webOS Luna stop threw",{error:e})}}function Gr(e=!0){var t=!!Ea,i=Aa;vr();var n=Pr(),a=function(){var e;if("undefined"==typeof window)return null;var t=null===(e=window.chrome)||void 0===e||null===(e=e.tts)||void 0===e?void 0:e.stop;return"function"==typeof t?t:null}();if((n||a)&&(i||t||a)&&(i||!t||a))try{var r=!1;n&&"function"==typeof n.stop&&(n.stop(),r=!0),n&&"function"==typeof n.cancel&&n.cancel(),n&&"function"==typeof n.pause&&n.pause(),a&&(a(),r=!0),n&&e&&!r&&i&&n.play(""),wr()}catch(e){wr(),Ua("VIZIO stop threw",{error:e})}}function Vr(e,t){var i=Pr();if(!i)return!1;try{var n,a,r=!0===(null===(n=t.element)||void 0===n?void 0:n.isConnected),o="composite"===t.reason?1400:"focus"===t.reason?700:0;return o>0?(vr(),Ea=setTimeout(()=>{var n;if(Ea=null,!t.transactionId||!La||La.id===t.transactionId)if(t.element&&r&&!t.element.isConnected){var a;t.transactionId&&(null===(a=La)||void 0===a?void 0:a.id)===t.transactionId&&(La.status="cancelled",La=null)}else{if(ha)return fr(),Na=null,void jr(e,t);i.play(e),br(e),t.transactionId&&(null===(n=La)||void 0===n?void 0:n.id)===t.transactionId&&(La.status="ended",La=null)}},o),!0):(i.play(e),br(e),t.transactionId&&(null===(a=La)||void 0===a?void 0:a.id)===t.transactionId&&(La.status="ended",La=null),!0)}catch(e){return function(e){da=!0,Ua("VIZIO Chromevox unavailable",{error:e})}(e),!1}}function Kr(e){return"high"===e?3:"normal"===e?2:1}function Xr(){return Date.now()-Ca<1500}function Yr(e){return Ka(e)}function qr(e){if(!e)return"";var t=function(e){return e?[e.tagName.toLowerCase(),e.id||"",e.getAttribute("data-component-id")||"",e.getAttribute("data-nami-id")||"",e.getAttribute("data-testid")||"",`el-${Wa(e)}`].filter(Boolean).join("|"):""}(e);return Ka(t||oo(e))}function Jr(e){var t=Yr(e);return"clickable"===t||"button"===t||"focusable"===t||"selected"===t||"unselected"===t}function Qr(e,t,i){var n;if(Na={textKey:Yr(e),reason:t.reason,timestamp:Date.now()},"high"===i){var a=kr(e),r=Date.now();$a={transactionId:t.transactionId,pageKey:ga,element:null!==(n=t.element)&&void 0!==n?n:null,elementKey:qr(t.element),textKey:Yr(e),startedAt:r,suppressUntil:r+a},Sa&&clearTimeout(Sa),Sa=setTimeout(()=>{Sa=null,$a=null},a)}}function Zr(e,t=!0){var i,n,a,r=!(!e||(null===(i=La)||void 0===i?void 0:i.id)!==e||"pending"!==La.status);if(Ua("stopSpeech",{preserveTransactionId:e,allowVizioEmptyFallback:t,activeTransaction:null===(n=La)||void 0===n?void 0:n.id,reason:null===(a=La)||void 0===a?void 0:a.reason,preservingCurrentTransaction:r}),ca=null,r||(gr(),pr()),e||(fr(),mr(),cr("stop")),Qa(e),wa&&(clearTimeout(wa),wa=null),!r){if(Mr())try{window.speechSynthesis.cancel()}catch(e){}Dr()&&Hr(),Ar()&&Gr(t)}}function eo(){Zr()}function to(e,t={}){var i,n,a;Ua("speakText:enter",{textPreview:Va(e).slice(0,160),reason:t.reason,transactionId:t.transactionId,element:Ga(t.element),runtime:Rr()});var r=Va(e);if(!r)return!1;if(!Fr())return Ua("skip speech: non-CTV runtime"),!1;var o={interrupt:!1!==t.interrupt,reason:null!==(i=t.reason)&&void 0!==i?i:"manual",transactionId:t.transactionId,element:t.element,focusPath:t.focusPath,priority:t.priority},s=function(e,t){return t.priority?t.priority:"composite"===t.reason?"high":Jr(e)?"low":"normal"}(r,o);if(function(e,t,i){var n=Yr(e),a=Date.now(),r=qr(t.element);if(Jr(e))return!0;if(Na&&Na.reason===t.reason&&Na.textKey===n&&a-Na.timestamp<600)return Ua("suppress:duplicate-request",{reason:t.reason,textPreview:e.slice(0,120)}),!0;if(!$a)return!1;if(Kr(i)>=Kr("high"))return!1;if("focus"===t.reason){var o=$a.textKey;if(!Xr()&&(n===o||n.includes(o)))return Ua("suppress:focus-text-is-active-composite",{textPreview:e.slice(0,120),transactionId:$a.transactionId,element:Ga(t.element)}),!0}var s=function(e,t){return!!e&&!!t&&e===t}(t.element,$a.element),u=!!r&&$a.elementKey===r,l=!$a.pageKey||$a.pageKey===ga,d=Xr(),h=l&&!d&&a<$a.startedAt+2500;return!(!s&&!u&&(l&&"focus"===t.reason&&t.element&&$a.element!==t.element||"low"!==i&&!h)&&(fr(),1))}(r,o,s))return!1;if(o.interrupt&&Zr(o.transactionId,!1),ha)return jr(r,o),!0;var u=function(e){var t;return"manual"!==(null!==(t=e.reason)&&void 0!==t?t:"manual")&&e.element?Dr()||Ar()?"programmatic":"accessibility-label":"programmatic"}(o);Ua("speakText:owner",{owner:u,reason:o.reason,element:Ga(o.element)});var l,d,h="programmatic"===u?function(){if(!Fr())return null;var e=Ar(),t=Dr();return Ur.isAvailable()?(Ua("resolveTtsEngine:selected",{engine:"vizio-chromevox"}),Ur):e?null:Br.isAvailable()?(Ua("resolveTtsEngine:selected",{engine:"webos-luna-tts"}),Br):zr.isAvailable()?(Ua("resolveTtsEngine:selected",{engine:"web-speech"}),zr):(Ua("tts engine unavailable",{webos:t,vizio:e}),null)}():null;(Ua("speakText:engine",{engine:null!==(n=null==h?void 0:h.name)&&void 0!==n?n:null,owner:u}),"composite"===o.reason&&o.transactionId&&o.element&&function(e){return"accessibility-label"===e||Dr()}(u))&&lr(o.element,r,null!==(l=o.focusPath)&&void 0!==l?l:[]);if("accessibility-label"===u)return"focus"===o.reason&&o.element&&o.element.setAttribute("aria-label",r),o.transactionId&&(null===(d=La)||void 0===d?void 0:d.id)===o.transactionId&&(La.status="started"),Qr(r,o,s),!0;if(!h)return function(e,t){if(!Ar()||da)return!1;var i=Date.now(),n=()=>{var a;Pa=null,t.transactionId&&La&&La.id!==t.transactionId||(_r()?Vr(e,t):Date.now()-i>=8e3?t.transactionId&&(null===(a=La)||void 0===a?void 0:a.id)===t.transactionId&&(La.status="cancelled",La=null):Pa=setTimeout(n,250))};return gr(),Pa=setTimeout(n,250),!0}(r,o)?(Qr(r,o,s),!0):(Ha(),!1);var c=h.speak(r,o);if(Ua("speakText:engine-result",{engine:h.name,accepted:c,reason:o.reason,transactionId:o.transactionId}),c)return Qr(r,o,s),c;if(!o.element)return c;var m=lr(o.element,r,null!==(a=o.focusPath)&&void 0!==a?a:[]);return Ua("speakText:aria-label-fallback",{engine:h.name,accepted:m,reason:o.reason}),m&&Qr(r,o,s),m}function io(e){var t=e.component;return e.hasAttribute("data-nami-primary-cta")||!0===(null==t?void 0:t.focused)||"productButton"===(null==t?void 0:t.namiComponentType)}function no(e){var t,i=null===(t=e.getAttribute("role"))||void 0===t?void 0:t.toLowerCase();return"button"===e.tagName.toLowerCase()||"button"===i||e.matches("nami-button,nami-play-pause-button,nami-volume-button,nami-toggle-button")}function ao(e){return Va(e).replace(/(?:,\s*)?\bbutton\b\s*$/i,"").trim()||Va(e)}function ro(e){return Va(e.innerText||e.textContent||"")}function oo(e){if(!e)return"";if(ur(e)){var t=function(e){var t=Ra.get(e);return t?Va(t["aria-label"]||e.getAttribute("title")||""):""}(e);if(t)return t;var i=so(e.component);if(i)return i}var n=e.getAttribute("data-tts-spoken-label");if(n)return Va(n);var a=so(e.component);if(a)return a;var r=e.getAttribute("aria-label")||e.getAttribute("title");return r?Va(r):ro(e)}function so(e){var t=lo(e,fa);if(!t)return"";var i=t,n=Va(uo(i.speechLabel)||uo(i.speech_label)||uo(i.screenreaderText)||uo(i.title)||uo(i.alt)||uo(i.text)||(Array.isArray(i.texts)?i.texts.map(e=>uo(e)).join(", "):""));if(n)return n;for(var a,r=f(co(i));!(a=r()).done;){var o=so(a.value);if(o)return o}return""}function uo(e,t=fa){return t?qn(t,e):e}function lo(e,t){if(!e||e.hidden)return null;var i=e;if("condition"===i.component)return t&&Xn(t,i)?e:null;if(i.conditionAttributes&&t){var n=Yn(t,i);return n.hidden?null:n}return e}function ho(e,t){if(Ua("applySpeechAttributes:enter",{element:Ga(e),label:t,activeComposite:ur(e)}),!ur(e)){var i=Va(t),n=function(e,t){var i=Va(t);return i?no(e)?ao(i):i:""}(e,t);if(!n)return e.removeAttribute("data-tts-spoken-label"),void e.removeAttribute("aria-label");i?e.setAttribute("data-tts-spoken-label",i):e.removeAttribute("data-tts-spoken-label"),e.setAttribute("aria-label",function(e,t){return no(e)?ao(t):Va(t)}(e,n))}}function co(e){for(var t=[],i=0,n=["components","playingComponents","pausedComponents","mutedComponents","volumeComponents","productBaseComponents","productFeaturedComponents"];i<n.length;i++){var a=null==e?void 0:e[n[i]];Array.isArray(a)&&t.push(...a)}return null!=e&&e.collapseHeader&&(Array.isArray(e.collapseHeader)?t.push(...e.collapseHeader):t.push(e.collapseHeader)),t}function mo(e,t,i){var n=lo(e,fa);if(n&&!function(e){var t=lo(e,fa);if(!t)return!1;var i=t,n=String(i.component||i.namiComponentType||"").toLowerCase();return-1!==n.indexOf("button")||-1!==n.indexOf("toggle")||-1!==n.indexOf("checkbox")||-1!==n.indexOf("radio")||-1!==n.indexOf("select")||-1!==n.indexOf("input")||!!i.onTap||!!i.sku||!0===i.focused}(n)){var a=function(e){var t=lo(e,fa);if(!t)return"";var i=t;switch(t.component){case"text":case"countdownTimerText":return Xa(uo(i.screenreaderText)||uo(i.text));case"text-list":return Array.isArray(i.texts)?Xa(i.texts.map(e=>uo(e)).join(", ")):"";case"videoUrl":case"progressBar":return Va(uo(i.screenreaderText));default:return""}}(n);Ya(t,a),co(n).forEach(e=>mo(e,t))}}function fo(e,t){var i=[];if(!e)return i;var n=e;return[n.header,n.contentContainer,n.footer,n.backgroundContainer,n.components].forEach(e=>{Array.isArray(e)?e.forEach(e=>mo(e,i)):mo(e,i)}),i}function vo(e,t){var i=fo(e),n=function(e){if(!e)return"";var t=so(e.component),i=e.getAttribute("aria-label")||e.getAttribute("title")||ro(e),n=Va(t||i);return n?no(e)&&!/\bbutton\b\s*$/i.test(n)?Va(`${n} button`):n:""}(t);return Ja(qa(i,n?[n]:[]))}function po(e){return e?Ka(`${Va(e.id||e.name||"")}|${Ja(qa(fo(e),[]))}`):""}function go(){return ya}function yo(e,t=null){!function(){if(null===ja&&null===Ba){var e=navigator.userAgentData;"function"==typeof(null==e?void 0:e.getHighEntropyValues)?Ba=e.getHighEntropyValues(["platform","model"]).then(e=>{var t,i,n=(null!==(t=e.platform)&&void 0!==t?t:"").toLowerCase(),a=(null!==(i=e.model)&&void 0!==i?i:"").toLowerCase();ja=n.includes("xbox")||a.includes("xbox"),Ua("xbox client hints resolved",{platform:n,model:a,result:ja})}).catch(()=>{ja=!1}).finally(()=>{Ba=null}):ja=!1}}(),Ua("setActivePage:enter",{nextKey:po(e),previousKey:ga,activePageAnnounced:pa,pageName:Va((null==e?void 0:e.name)||(null==e?void 0:e.id)||"")});var i=ga;ma=e,fa=t,function(e){var t=po(e);if(t!==ga){var i=!ga&&!!Da;pa=!1,ga=t,ya=i,Da=null,xa=""}}(e),i!==ga&&Zr(void 0,!1)}function bo(e,t){if(Ua("prepareInitialComposite:enter",{element:Ga(e),activePageKey:ga,activePageAnnounced:pa,blockedByNavigation:go(),label:oo(e),isPrimary:io(e)}),!ma||pa||!io(e)||go())return Ua("prepareInitialComposite:skip",{hasActivePage:!!ma,activePageAnnounced:pa,isPrimary:io(e),blockedByNavigation:go()}),!1;var i=vo(ma,e);if(!i)return!1;var n=or(e,t),a=function(e,t,i){var n={id:Ia++,reason:e,element:i,text:t,page:ma,status:"pending"};return La=n,n}("composite",i,e);pa=!0,Da=e,xa=qr(e);var r,o=to(i,{reason:"composite",interrupt:!0,transactionId:a.id,element:e,focusPath:n,priority:"high"});o||(pa=!1,(null===(r=La)||void 0===r?void 0:r.id)===a.id&&(La.status="cancelled",La=null));return o}function wo(e,t){Ua("preparePrimaryCtaCompositeFocus:enter",{element:Ga(e),label:oo(e),activePageKey:ga,activePageAnnounced:pa});var i=bo(e,t);return Ua("preparePrimaryCtaCompositeFocus:result",{result:i,activePageKey:ga,activePageAnnounced:pa}),i}function ko(e){Ua("handleNativeFocusIn:enter",{target:e.target instanceof Element?Ga(e.target):String(e.target),activePageKey:ga,activePageAnnounced:pa});var t=function(e){for(var t,i=null,n=f("function"==typeof e.composedPath?e.composedPath():[]);!(t=n()).done;){var a=t.value;if(a instanceof Element&&oo(a)){if(a.tagName.toLowerCase().startsWith("nami-"))return a;i||(i=a)}}return null!=i?i:e.target instanceof Element?e.target:null}(e);t&&So(t,e)}function So(e,t){if(Ua("handleFocusedElementForSpeech:enter",{element:Ga(e),label:oo(e),ttsEnabled:oa,runtime:Rr(),activePageKey:ga,activePageAnnounced:pa,lastFocused:Ga(Da),lastFocusedElementIdentity:xa}),!e)return Ua("handleFocusedElementForSpeech:skip-basic",{hasElement:!!e,ttsEnabled:oa}),!1;if(!Fr())return!1;var i=qr(e);if($a&&$a.pageKey===ga&&Date.now()<$a.startedAt+2500){var n=$a.element===e,a=!!i&&$a.elementKey===i;if(!Xr()&&(n||a))return Ua("handleFocusedElementForSpeech:skip-during-initial-composite-lock",{element:Ga(e),sameCompositeElement:n,sameCompositeElementKey:a}),!1;var r=oo(e),o=r?Yr(r):"";if(!Xr()&&o&&$a.textKey.includes(o))return Ua("handleFocusedElementForSpeech:skip-composite-contained-label-during-initial-lock",{element:Ga(e),labelPreview:r.slice(0,120),transactionId:$a.transactionId}),Da=e,xa=i,!1}if(Da===e||i&&i===xa&&!pa)return Ua("handleFocusedElementForSpeech:skip-same-element",{element:Ga(e),activePageAnnounced:pa,elementIdentity:i,lastFocusedElementIdentity:xa}),!1;if(!pa&&ma&&io(e)&&!Da&&!go())return bo(e,t);var s=oo(e);if(!s)return!1;if($a){var u=Yr(s),l=$a.textKey;if(!Xr()&&(u===l||u.includes(l)))return Ua("handleFocusedElementForSpeech:skip-active-composite-label",{element:Ga(e),labelPreview:s.slice(0,120),transactionId:$a.transactionId}),Da=e,xa=i,!1}return Da=e,xa=i,wa&&clearTimeout(wa),wa=setTimeout(()=>{wa=null,Da===e&&to(s,{reason:"focus",interrupt:!0,element:e,focusPath:or(e,t),priority:"normal"})},120),!0}function Eo(e=document){var t;if(Ua("attachFocusSpeechListeners:enter",{root:e instanceof Element?Ga(e):e instanceof DocumentFragment?"document-fragment":"document",runtime:Rr()}),To(),!Fr())return Ua("focus speech listeners not attached: non-CTV runtime"),To;var i,n=e=>ko(e),a=()=>(Ua("handleUserNavigationKey",{activePageKey:ga,activePageAnnounced:pa}),Ca=Date.now(),void(ya=!0));e.addEventListener("focusin",n,!0),e.addEventListener("keydown",a,!0);var r=window;if("undefined"!=typeof window&&null!==(t=r.TVJS)&&void 0!==t&&t.DirectionalNavigation){var o=r.TVJS.DirectionalNavigation;i=o.onfocuschanged,o.onfocuschanged=e=>{var t;null===(t=i)||void 0===t||t.call(o,e),function(e){var t,i=null===(t=e.detail)||void 0===t?void 0:t.nextFocusElement;i&&So(i,e)}(e)}}return ba={root:e,focusListener:n,keyListener:a,previousTvjsHandler:i},To}function To(){var e;if(Ua("detachFocusSpeechListeners:enter",{hasCleanup:!!ba}),ba){var t=ba,i=t.root,n=t.focusListener,a=t.keyListener,r=t.previousTvjsHandler;i.removeEventListener("focusin",n,!0),a&&i.removeEventListener("keydown",a,!0);var o=window;null!==(e=o.TVJS)&&void 0!==e&&e.DirectionalNavigation&&r&&(o.TVJS.DirectionalNavigation.onfocuschanged=r),ba=null}}function Po(){var e;Ua("resetScreenreaderState:enter",{activePageKey:ga,activePageAnnounced:pa,activeTransaction:null===(e=La)||void 0===e?void 0:e.id,lastFocused:Ga(Da)}),To(),ca=null,ha=!1,ma=null,fa=null,va=null,pa=!1,ga="",ya=!1,Da=null,xa="",Ca=0,Na=null,fr(),mr(),vr(),pr(),gr(),wr(),wa&&(clearTimeout(wa),wa=null),cr("reset"),Qa(),La=null}var Mo=function(){return m(function t(i,n,a="",r=""){var o;u(this,t),this.playing=!1,this.toggling=!1,this.handleVideoEvents=t=>{this.video.onended=()=>{Wr(!1),this.handlePlayerAnalytics(t,e.NamiPaywallAction.VIDEO_ENDED)},this.video.onpause=()=>{Wr(!1),this.toggling||this.handlePlayerAnalytics(t,e.NamiPaywallAction.VIDEO_PAUSED)},this.video.onplay=()=>{Wr(!this.video.muted),this.toggling||this.handlePlayerAnalytics(t,this.video.currentTime>.05?e.NamiPaywallAction.VIDEO_RESUMED:e.NamiPaywallAction.VIDEO_STARTED)},this.video.onvolumechange=()=>{this.toggling||(this.muted=this.video.muted,Wr(!this.video.paused&&!this.video.ended&&!this.muted),this.handlePlayerAnalytics(t,this.muted?e.NamiPaywallAction.VIDEO_MUTED:e.NamiPaywallAction.VIDEO_UNMUTED))}},this.removeVideoEvents=()=>{this.video&&(Wr(!1),this.video.onended=null,this.video.onpause=null,this.video.onplay=null,this.video.onvolumechange=null,this.toggling=!1)},this.video=null!=n?n:this.video,null!==(o=t.instance)&&void 0!==o&&o.videoSrc&&n.src!=t.instance.videoSrc&&this.handlePlayerAnalytics(i,e.NamiPaywallAction.VIDEO_CHANGED),this.videoSrc=n.src,this.video&&(this.muteByDefault=n.muted,this.loopVideo=n.loop,this.autoplayVideo=n.autoplay,this.muted=this.video.muted,this.videoComponentName=a,this.videoComponentId=r,this.playing=!(!(this.video.currentTime>0)||this.video.paused||this.video.ended),Wr(this.playing&&!this.video.muted),this.handleVideoEvents(i))},[{key:"togglePlayVideo",value:function(e){this.toggling=!0,this.playing?this.video.pause():this.video.play(),this.playing=!this.playing,this.handlePlayerAnalytics(e)}},{key:"toggleMuteVideo",value:function(t){this.toggling=!0,this.video.muted=!this.video.muted,this.muted=this.video.muted,this.handlePlayerAnalytics(t,this.muted?e.NamiPaywallAction.VIDEO_MUTED:e.NamiPaywallAction.VIDEO_UNMUTED)}},{key:"videoPlayingAction",value:function(){var t,i;return(null===(t=this.video)||void 0===t?void 0:t.currentTime)<=0?e.NamiPaywallAction.VIDEO_STARTED:this.video.paused?e.NamiPaywallAction.VIDEO_PAUSED:this.video.ended?e.NamiPaywallAction.VIDEO_ENDED:(null===(i=this.video)||void 0===i?void 0:i.currentTime)>.05?e.NamiPaywallAction.VIDEO_RESUMED:e.NamiPaywallAction.UNKNOWN}},{key:"handlePlayerAnalytics",value:function(t,i){if(this.video){var n={id:this.videoComponentId,name:this.videoComponentName,url:this.video.src,loopVideo:this.loopVideo,muteByDefault:this.muteByDefault,autoplayVideo:this.autoplayVideo,contentDuration:this.video.duration/1e3,contentTimecode:this.video.currentTime/1e3};e.NamiEventEmitter.getInstance().emit(e.PAYWALL_ACTION_EVENT,{action:null!=i?i:this.videoPlayingAction(),videoMetaData:n,timeSpentOnPaywall:ta(t)})}}}])}();Mo.instance=null;var Ao=({onTap:t,sku:i,componentChange:n,contextProvider:a}={})=>{var r,o,s,u,l,d,h,c,m,f,p,g=e.NamiPaywallAction.UNKNOWN;switch(null==t?void 0:t.function){case ft:g=e.NamiPaywallAction.CLOSE_PAYWALL,p=ta(a),Do(),null===(r=Mo.instance)||void 0===r||r.handlePlayerAnalytics(a,e.NamiPaywallAction.VIDEO_ENDED);break;case pt:g=e.NamiPaywallAction.RESTORE_PURCHASES,xo();break;case yt:g=e.NamiPaywallAction.SIGN_IN,Co();break;case Dt:Io(null===(o=t.parameters)||void 0===o?void 0:o.url);break;case wt:i&&(g=e.NamiPaywallAction.BUY_SKU,i=Lo(a,t,i));break;case Ct:g=e.NamiPaywallAction.PAGE_CHANGE,n={name:null==t||null===(s=t.parameters)||void 0===s?void 0:s.screen},_o(a,null==t||null===(u=t.parameters)||void 0===u?void 0:u.screen);break;case St:g=e.NamiPaywallAction.TOGGLE_CHANGE,n=Ro(a,null==t||null===(l=t.parameters)||void 0===l?void 0:l.formId,null==t||null===(d=t.parameters)||void 0===d?void 0:d.value);break;case Tt:i&&(g=e.NamiPaywallAction.SELECT_SKU,Fo(a,i));break;case Mt:i&&(g=e.NamiPaywallAction.PURCHASE_SELECTED_SKU,Oo(a,i));break;case Lt:break;case Rt:null===(h=Mo.instance)||void 0===h||h.togglePlayVideo(a);break;case Ot:null===(c=Mo.instance)||void 0===c||c.togglePlayVideo(a);break;case $t:null===(m=Mo.instance)||void 0===m||m.toggleMuteVideo(a);break;case jt:null===(f=Mo.instance)||void 0===f||f.toggleMuteVideo(a)}g!==e.NamiPaywallAction.UNKNOWN&&e.NamiEventEmitter.getInstance().emit(e.PAYWALL_ACTION_EVENT,v({},a.getPaywallActionEventData(),{action:g,sku:i,timeSpentOnPaywall:p,componentChange:n,purchaseError:void 0,purchases:void 0}))},Do=()=>{eo(),e.storageService.clearLaunchId(),Wo(e.PaywallManagerEvents.Close)||"undefined"==typeof window||window.history.back()},xo=()=>{var t=e.hasCapability(e.Capabilities.THIRD_PARTY_TRANSACTIONS);Wo(e.PaywallManagerEvents.Restore)||t||e.logger.warn("NamiPaywallManager.registerRestoreHandler is not registered, so restore option on the paywall will use default behavior.")},Co=()=>{Wo(e.PaywallManagerEvents.SignIn)},Io=t=>{t?Wo(e.PaywallManagerEvents.DeeplinkAction,t)||"undefined"!=typeof window&&window.open(t,"_blank"):e.logger.debug("Paywall deep link action invoked, but no url present.")},Lo=(t,i,n)=>{var a,r=null===(a=i.parameters)||void 0===a?void 0:a.promo,o=n;if(r)e.logger.debug(`promo id is not null ${null==n?void 0:n.id}`),o.promoId=r.toString();else{e.logger.debug(`promo id is null for ${n.id}, product details: ${JSON.stringify(n.productDetails)}`);var s=n.productDetails;if(Bt(null==s?void 0:s.product_type)){var u=function(e){return e.offers.find(e=>"promo"===e.offer_type&&0===e.price)}(s);if(u&&u.offer_ref_id)e.logger.debug(`Found a free trial offer ${u.offer_ref_id}`),o.promoId=u.offer_ref_id.toString();else{var l,d=s.offers[0];if(d)e.logger.debug(`Found an offer ${d.offer_ref_id}`),o.promoId=null===(l=d.offer_ref_id)||void 0===l?void 0:l.toString()}}}return function(t,i){if(e.hasCapability(e.Capabilities.THIRD_PARTY_TRANSACTIONS)){if(e.storageService.setPurchaseImpression(),e.NamiEventEmitter.getInstance().listenerCount(e.PaywallManagerEvents.BuySku)<=0)return void e.logger.warn("In order for Nami to hand off the purchase so the transaction can be handled by, you must register a NamiBuySkuHandler callbackwith NamiPaywallManager.registerBuySkuHandler.");e.logger.info(`Handing off purchase for processing by developer skuId=${i.skuId} promoId=${i.promoId}`),Wo(e.PaywallManagerEvents.BuySku,i)}else{var n=e.namiBuySKU(i.skuId);if(n&&(e.logger.info(`Purchase flow completed, success=${n.success}, code=${n.billingResponseCode}, message=${n.message}`),n.success)){var a;e.NamiEventEmitter.getInstance().emit(e.PAYWALL_ACTION_EVENT,{action:e.NamiPaywallAction.CLOSE_PAYWALL,sku:i,timeSpentOnPaywall:ta(t)}),null===(a=Mo.instance)||void 0===a||a.handlePlayerAnalytics(t,e.NamiPaywallAction.VIDEO_ENDED);var r=t.getSelectedCampaign();r&&r.conversion_event_type==e.CampaignRuleConversionEventType.IN_APP&&r.conversion_event_url?(e.storageService.clearLaunchId(),window.location.href=r.conversion_event_url):Do()}}}(t,o),o},_o=(e,t)=>{var i;t&&((null===(i=window.history.state)||void 0===i?void 0:i.prevUrl)==t?window.history.back():e.setCurrentPage(t))},Ro=(e,t,i)=>{if(t)return e.setCurrentFormId(t,i),{formId:t,value:i};var n=e.getCurrentGroupId(),a=e.getCurrentGroupName();return e.setCurrentGroupData(n,a),{id:n,name:a}},Fo=(e,t)=>{var i=e.getCurrentGroupId(),n=e.selectedProducts();i&&t.id!=n[i]&&(n[i]=t.id,e.setSelectedProducts(n))},Oo=(e,t)=>{e.setPurchase(!0,t)};function Wo(t,...i){var n=e.NamiEventEmitter.getInstance();return n.emit(t,...i),n.listenerCount(t)>0}var $o,No,jo,Bo,zo,Uo,Ho,Go,Vo,Ko,Xo,Yo=e=>e,qo=e._internal.NamiFlowManager,Jo=250,Qo=function(){function n(t,i,a){var r;return u(this,n),(r=s(this,n)).pages=[],r.currentOffset=0,r.presentationStyle="fullscreen",r._sheetEntranceActive=!0,r.formFactor=e.getDeviceFormFactor(),r.timeSpentOnPaywall=0,r.animation={transition:"none",direction:"forward"},r._originalBodyStyles={},r._originalDocumentStyles={},r._savedScrollY=0,r._sheetDragStartY=0,r._sheetIsDragging=!1,r._dismissThreshold=100,r._boundHandleKeyDownEvent=e=>r.handleKeyDownEvent(e),r._stylesAlreadySaved=!1,r.type=t,r.value=i,r.context=a,r.setPaywallData(),r.presentationStyle=r.getPresentationStyle(r.paywall),r.applyPresentationHostClasses(),w(r,r)}return y(n,t.LitElement),m(n,[{key:"applyPresentationHostClasses",value:function(){this.classList.toggle("nami-half-sheet-mode",this.isOverlaySheet),this.classList.toggle("nami-modal-mode",this.isModal),this.classList.toggle("nami-modal-phone",this.isModal&&"phone"===this.formFactor),this.classList.toggle("nami-modal-wide",this.isModal&&"phone"!==this.formFactor)}},{key:"setPaywallData",value:function(){var t=e.getPaywallDataFromLabel(this.value,this.type);this.paywall=t.paywall,this.campaign=t.campaign}},{key:"getPresentationStyle",value:function(t){var i,n,a,r=null!==(i=null==t||null===(n=t.template)||void 0===n||null===(n=n.initialState)||void 0===n?void 0:n.presentationStyle)&&void 0!==i?i:null==t||null===(a=t.template)||void 0===a||null===(a=a.initialState)||void 0===a?void 0:a.presentation_style;return e.getEffectiveWebStyle(r)}},{key:"isHalfSheet",get:function(){return"compact_sheet"===this.presentationStyle}},{key:"isSheet",get:function(){return"sheet"===this.presentationStyle}},{key:"isOverlaySheet",get:function(){return this.isHalfSheet||this.isSheet}},{key:"isModal",get:function(){return"modal"===this.presentationStyle}},{key:"isOverlay",get:function(){return this.isOverlaySheet||this.isModal}},{key:"connectedCallback",value:function(){var e;M(n,"connectedCallback",this)([]),null!==(e=window.TVJS)&&void 0!==e&&e.DirectionalNavigation&&(window.TVJS.DirectionalNavigation.focusRoot=this),this._detachFocusSpeechListeners=Eo(this),document.addEventListener("keydown",this._boundHandleKeyDownEvent),this._swipeHandler=ht(this,this.handleSwipeEvent.bind(this),{axisHint:"y",lockAxis:!0,minDistance:25,edgeLeakThreshold:15,preventScrollOnSwipe:!1,pointerTypes:["touch"]}),this.setOriginalStyles()}},{key:"disconnectedCallback",value:function(){var t,i,a;M(n,"disconnectedCallback",this)([]),eo(),null===(t=this._detachFocusSpeechListeners)||void 0===t||t.call(this),this._detachFocusSpeechListeners=void 0,Po(),e.storageService.clearLaunchId(),null!==(i=window.TVJS)&&void 0!==i&&i.DirectionalNavigation&&(window.TVJS.DirectionalNavigation.focusRoot=document.body),document.removeEventListener("keydown",this._boundHandleKeyDownEvent),e.NamiEventEmitter.getInstance().removeAllListeners(e.PAYWALL_ACTION_EVENT),this.restoreStyles(),null===(a=this._halfSheetAbortController)||void 0===a||a.abort(),this._swipeHandler.destroy()}},{key:"setOriginalStyles",value:function(){this._stylesAlreadySaved||(this._stylesAlreadySaved=!0,this._originalBodyStyles.background=document.body.style.background,this._originalBodyStyles.overflow=document.body.style.overflow||null,this._originalBodyStyles.position=document.body.style.position||null,this._originalBodyStyles.top=document.body.style.top||null,this._originalBodyStyles.width=document.body.style.width||null,"phone"===this.formFactor&&(this._originalBodyStyles["overscroll-behavior"]=document.body.style.overscrollBehavior||null,this._originalDocumentStyles["overscroll-behavior"]=document.documentElement.style.overscrollBehavior||null)),"television"===this.formFactor&&(document.body.style.overflow="hidden"),"phone"===this.formFactor&&(document.body.style.overscrollBehavior="none",document.documentElement.style.overscrollBehavior="none",this.isOverlay||(document.body.style.overflow="hidden")),this.isOverlay&&(this._savedScrollY=window.scrollY,document.body.style.position="fixed",document.body.style.top=`-${this._savedScrollY}px`,document.body.style.width="100%",document.body.style.overflow="hidden")}},{key:"restoreStyles",value:function(){Object.entries(this._originalBodyStyles).forEach(([e,t])=>{null!==t?document.body.style.setProperty(e,t):document.body.style.removeProperty(e)}),Object.entries(this._originalDocumentStyles).forEach(([e,t])=>{null!==t?document.documentElement.style.setProperty(e,t):document.documentElement.style.removeProperty(e)}),this._savedScrollY>0&&(window.scrollTo(0,this._savedScrollY),this._savedScrollY=0)}},{key:"handleKeyDownEvent",value:function(t){(10009===t.keyCode||27===t.keyCode||166===t.keyCode||196===t.keyCode||"Backspace"===t.key||"GoBack"===t.key||"BrowserBack"===t.key||"XF86Back"===t.key)&&(t.preventDefault(),eo(),this.flow?this.flow.triggerActions(e.NamiReservedActions.REMOTE_BACK):this.isModal&&this.animateSheetDismiss().then(()=>Do()))}},{key:"handleBackdropClick",value:function(e){var t;(e.stopPropagation(),this.flow)?null!==(t=this.flow.currentStepHasHoistedPrimaryActions("__swipe_down__"))&&void 0!==t&&t?this.flow.triggerActions("__swipe_down__"):this.animateSheetDismiss().then(()=>{var e;null===(e=this.flow)||void 0===e||e.finished(),Do()}):this.animateSheetDismiss().then(()=>Do())}},{key:"animateSheetDismiss",value:function(){var e,t,i,n,a;return S(function(r){for(;;)switch(r.n){case 0:return i=this.shadowRoot,n=null!==(e=null==i?void 0:i.querySelector(".nami-half-sheet-container"))&&void 0!==e?e:null==i?void 0:i.querySelector(".nami-modal-container"),a=null!==(t=null==i?void 0:i.querySelector(".nami-half-sheet-backdrop"))&&void 0!==t?t:null==i?void 0:i.querySelector(".nami-modal-backdrop"),n&&n.classList.add("nami-dismissing"),a&&a.classList.add("nami-dismissing"),r.n=1,o(new Promise(e=>setTimeout(e,200)));case 1:return r.a(2)}},null,this,null,Promise)}},{key:"handleSwipeEvent",value:function({direction:e}){var t;if("down"===e)null===(t=this.flow)||void 0===t||t.triggerActions("__swipe_down__");else if("up"===e){var i;null===(i=this.flow)||void 0===i||i.triggerActions("__swipe_up__")}}},{key:"setupHalfSheetDragTracking",value:function(){var e,t,i;null===(e=this._halfSheetAbortController)||void 0===e||e.abort(),this._halfSheetAbortController=new AbortController;var n=this._halfSheetAbortController.signal,a=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".nami-half-sheet-container"),r=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelector(".nami-half-sheet-content");if(a&&r){a.addEventListener("touchstart",e=>{r.scrollTop>0||(this._sheetDragStartY=e.touches[0].clientY,this._sheetIsDragging=!0)},{passive:!0,signal:n}),a.addEventListener("touchmove",e=>{if(this._sheetIsDragging){var t=e.touches[0].clientY-this._sheetDragStartY;t>0&&(a.style.transform=`translateY(${t}px)`,a.style.transition="none",e.preventDefault())}},{passive:!1,signal:n}),a.addEventListener("touchend",()=>{if(this._sheetIsDragging){this._sheetIsDragging=!1;var e,t,i=a.style.transform.match(/translateY\((\d+(?:\.\d+)?)px\)/);if((i?parseFloat(i[1]):0)>this._dismissThreshold)if(null!==(e=null===(t=this.flow)||void 0===t?void 0:t.currentStepHasHoistedPrimaryActions("__swipe_down__"))&&void 0!==e&&e){var n;a.style.transform="translateY(0)",a.style.transition="transform 0.2s ease-out",null===(n=this.flow)||void 0===n||n.triggerActions("__swipe_down__")}else{var r;a.style.transform="translateY(100%)",a.style.transition="transform 0.2s ease-in";var o=null===(r=this.shadowRoot)||void 0===r?void 0:r.querySelector(".nami-half-sheet-backdrop");o&&o.classList.add("nami-dismissing"),setTimeout(()=>{var e;null===(e=this.flow)||void 0===e||e.finished()},200)}else a.style.transform="translateY(0)",a.style.transition="transform 0.2s ease-out"}},{signal:n})}}},{key:"setupHalfSheetFocusTrap",value:function(){var e,t,i,n,a=null!==(e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".nami-half-sheet-container"))&&void 0!==e?e:null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelector(".nami-modal-container");if(a){a.focus();var r=null===(n=this._halfSheetAbortController)||void 0===n?void 0:n.signal;a.addEventListener("keydown",e=>{if("Tab"===e.key){var t=a.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(0!==t.length){var i,n,r=t[0],o=t[t.length-1];if(e.shiftKey)document.activeElement!==r&&(null===(i=this.shadowRoot)||void 0===i?void 0:i.activeElement)!==r||(e.preventDefault(),o.focus());else document.activeElement!==o&&(null===(n=this.shadowRoot)||void 0===n?void 0:n.activeElement)!==o||(e.preventDefault(),r.focus())}}},r?{signal:r}:void 0)}}},{key:"firstUpdated",value:function(){var t;this.timeSpentOnPaywall=Date.now(),null===(t=this._detachFocusSpeechListeners)||void 0===t||t.call(this),this._detachFocusSpeechListeners=Eo(this.renderRoot),e.isNamiFlowCampaign(this.campaign)&&(this.flow=qo.instance.presentFlow(this.campaign,this,this.context)),this.isOverlay&&this.updateComplete.then(()=>{this.isOverlaySheet&&this.setupHalfSheetDragTracking(),this.setupHalfSheetFocusTrap()})}},{key:"updated",value:function(e){if(M(n,"updated",this)([e]),e.has("presentationStyle")){var t=e.get("presentationStyle");("compact_sheet"===t||"sheet"===t||"modal"===t)!==this.isOverlay&&(this.restoreStyles(),this._stylesAlreadySaved=!1,this.setOriginalStyles()),this.isOverlay&&(this.isOverlaySheet&&this.setupHalfSheetDragTracking(),this.setupHalfSheetFocusTrap())}}},{key:"getAnimationStyles",value:function(e){var t="backward"===this.animation.direction?-1:1;switch(this.animation.transition){case"verticalSlide":return`transform: translateY(${100*(e-this.currentOffset)*t}vh);`;case"slide":return`transform: translateX(${100*(e-this.currentOffset)*t}vw);`;case"fade":return`opacity: ${e===this.currentOffset?1:0};`;default:return""}}},{key:"updatePages",value:function(e){var t,i,n;return S(function(a){for(;;)switch(a.n){case 0:if(0!==this.pages.length&&"none"!==this.animation.transition){a.n=1;break}return this.pages=[e],a.a(2);case 1:if((null==(t=this.pages[this.pages.length-1])?void 0:t.id)!==e.id){a.n=2;break}return a.a(2);case 2:return i=null,this.isOverlaySheet&&(i=null===(n=this.shadowRoot)||void 0===n?void 0:n.querySelector(".nami-half-sheet-content"))&&(i.style.height=`${i.clientHeight}px`),this.pages=[t,e],this.currentOffset=0,a.n=3,o(this.updateComplete);case 3:requestAnimationFrame(()=>{this.currentOffset=1,setTimeout(()=>{this.pages=[e],this.currentOffset=0,this.paywall=e,i&&(i.style.height="")},Jo)});case 4:return a.a(2)}},null,this,null,Promise)}},{key:"animateFullscreenEntry",value:function(){return S(function(e){for(;;)switch(e.n){case 0:return e.n=1,o(new Promise(e=>requestAnimationFrame(()=>e())));case 1:return this.classList.remove("nami-fullscreen-entering"),this.classList.add("nami-fullscreen-entering-active"),e.n=2,o(new Promise(e=>setTimeout(e,Jo)));case 2:this.classList.remove("nami-fullscreen-entering-active");case 3:return e.a(2)}},null,this,null,Promise)}},{key:"_captureExitOverlay",value:function(e){var t=this.shadowRoot;if(!t)return null;var i=t.querySelector(".nami-flow-container"),n=document.createElement("div");if(n.className="nami-fullscreen-exit-overlay",n.style.cssText=`\n position: fixed; inset: 0; z-index: 10000;\n pointer-events: none;\n background: ${e};\n overflow: hidden;\n `,i){var a=i.cloneNode(!0);a.style.transform="none",a.style.transition="none",n.appendChild(a)}return t.appendChild(n),n.offsetHeight,n}},{key:"_slideExitOverlayAway",value:function(e){var t;return S(function(i){for(;;)switch(i.n){case 0:if(e){i.n=1;break}return i.a(2);case 1:return t="undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,e.style.transition=t?"none":"transform 250ms ease-in",e.style.transform="translateY(100%)",i.n=2,o(new Promise(e=>setTimeout(e,t?0:Jo)));case 2:e.remove();case 3:return i.a(2)}},null,null,null,Promise)}},{key:"flowNavigateToScreen",value:function(t,i){var n,a,r,s,u,l,d,h,c,m,f;return S(function(v){for(;;)switch(v.n){case 0:if(null!==(n=this.flow)&&void 0!==n&&n.previousFlowStep&&this.flow.executeLifecycle(this.flow.previousFlowStep,e.NamiReservedActions.DISAPPEAR),r=this.presentationStyle,s=this.getPresentationStyle(t),u=0===this.pages.length,l="backward"===i.direction,"compact_sheet"!==r&&"sheet"!==r||"fullscreen"!==s){v.n=3;break}return this.classList.add("nami-fullscreen-entering"),this.presentationStyle="fullscreen",this.applyPresentationHostClasses(),v.n=1,o(this.updateComplete);case 1:return v.n=2,o(this.animateFullscreenEntry());case 2:v.n=11;break;case 3:if("fullscreen"!==r||"compact_sheet"!==s&&"sheet"!==s){v.n=10;break}if(!u&&!l){v.n=8;break}if(!l){v.n=6;break}return d=document.body.style.background||getComputedStyle(this).backgroundColor||"#000",this._sheetEntranceActive=!1,h=this._captureExitOverlay(d),this.presentationStyle=s,this.applyPresentationHostClasses(),this.pages=[t],this.paywall=t,v.n=4,o(this.updateComplete);case 4:return v.n=5,o(this._slideExitOverlayAway(h));case 5:v.n=7;break;case 6:this.presentationStyle=s,this.applyPresentationHostClasses();case 7:v.n=9;break;case 8:console.warn(`Unsupported forward transition: fullscreen → ${s}. Presenting as fullscreen.`);case 9:v.n=11;break;case 10:this.presentationStyle=s,this.applyPresentationHostClasses();case 11:return c=("compact_sheet"===r||"sheet"===r)&&"fullscreen"===s,m="fullscreen"===r&&("compact_sheet"===s||"sheet"===s),f=!("compact_sheet"!==r&&"sheet"!==r||"compact_sheet"!==s&&"sheet"!==s||r===s)||c||m,this.animation=f?{transition:"fade",direction:i.direction}:i,v.n=12,o(this.updatePages(t));case 12:null!==(a=this.flow)&&void 0!==a&&a.currentFlowStep&&this.flow.executeLifecycle(this.flow.currentFlowStep,e.NamiReservedActions.APPEAR);case 13:return v.a(2)}},null,this,null,Promise)}},{key:"getSelectedSlideIndexForCurrentCarousel",value:function(){return ut.getSelectedSlideIndex()}},{key:"renderFlow",value:function(){return"undefined"==typeof document?t.html($o||($o=Yo``)):this.isOverlaySheet?this.renderHalfSheet():this.isModal?this.renderModal(this.renderFlowContainer()):this.renderFlowContainer()}},{key:"renderFlowContainer",value:function(){return t.html(No||(No=Yo`
254
+ `)),Fe=e=>(t,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)},Oe=globalThis,We=Oe.ShadowRoot&&(void 0===Oe.ShadyCSS||Oe.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,$e=Symbol(),Ne=new WeakMap,je=function(){return m(function e(t,i,n){if(u(this,e),this._$cssResult$=!0,n!==$e)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=i},[{key:"styleSheet",get:function(){var e=this.o,t=this.t;if(We&&void 0===e){var i=void 0!==t&&1===t.length;i&&(e=Ne.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Ne.set(t,e))}return e}},{key:"toString",value:function(){return this.cssText}}])}(),Be=(e,t)=>{if(We)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(var i,n=f(t);!(i=n()).done;){var a=i.value,r=document.createElement("style"),o=Oe.litNonce;void 0!==o&&r.setAttribute("nonce",o),r.textContent=a.cssText,e.appendChild(r)}},ze=We?e=>e:e=>e instanceof CSSStyleSheet?(e=>{for(var t,i="",n=f(e.cssRules);!(t=n()).done;){i+=t.value.cssText}return(e=>new je("string"==typeof e?e:e+"",void 0,$e))(i)})(e):e,Ue=Object.is,He=Object.defineProperty,Ge=Object.getOwnPropertyDescriptor,Ve=Object.getOwnPropertyNames,Ke=Object.getOwnPropertySymbols,Xe=Object.getPrototypeOf,Ye=globalThis,qe=Ye.trustedTypes,Je=qe?qe.emptyScript:"",Qe=Ye.reactiveElementPolyfillSupport,Ze=(e,t)=>e,et={toAttribute(e,t){switch(t){case Boolean:e=e?Je:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){var i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},tt=(e,t)=>!Ue(e,t),it={attribute:!0,type:String,converter:et,reflect:!1,useDefault:!1,hasChanged:tt};null!==(Ce=Symbol.metadata)&&void 0!==Ce||(Symbol.metadata=Symbol("metadata")),null!==(Ie=Ye.litPropertyMetadata)&&void 0!==Ie||(Ye.litPropertyMetadata=new WeakMap);var nt=function(){function e(){var t;return u(this,e),(t=s(this,e))._$Ep=void 0,t.isUpdatePending=!1,t.hasUpdated=!1,t._$Em=null,t._$Ev(),t}return y(e,D(HTMLElement)),m(e,[{key:"_$Ev",value:function(){var e;this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),null===(e=this.constructor.l)||void 0===e||e.forEach(e=>e(this))}},{key:"addController",value:function(e){var t,i;(null!==(t=this._$EO)&&void 0!==t?t:this._$EO=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&(null===(i=e.hostConnected)||void 0===i||i.call(e))}},{key:"removeController",value:function(e){var t;null===(t=this._$EO)||void 0===t||t.delete(e)}},{key:"_$E_",value:function(){for(var e,t=new Map,i=f(this.constructor.elementProperties.keys());!(e=i()).done;){var n=e.value;this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n])}t.size>0&&(this._$Ep=t)}},{key:"createRenderRoot",value:function(){var e,t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return Be(t,this.constructor.elementStyles),t}},{key:"connectedCallback",value:function(){var e,t;null!==(e=this.renderRoot)&&void 0!==e||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$EO)||void 0===t||t.forEach(e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)})}},{key:"enableUpdating",value:function(e){}},{key:"disconnectedCallback",value:function(){var e;null===(e=this._$EO)||void 0===e||e.forEach(e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)})}},{key:"attributeChangedCallback",value:function(e,t,i){this._$AK(e,i)}},{key:"_$ET",value:function(e,t){var i=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,i);if(void 0!==n&&!0===i.reflect){var a,r=(void 0!==(null===(a=i.converter)||void 0===a?void 0:a.toAttribute)?i.converter:et).toAttribute(t,i.type);this._$Em=e,null==r?this.removeAttribute(n):this.setAttribute(n,r),this._$Em=null}}},{key:"_$AK",value:function(e,t){var i=this.constructor,n=i._$Eh.get(e);if(void 0!==n&&this._$Em!==n){var a,r,o,s=i.getPropertyOptions(n),u="function"==typeof s.converter?{fromAttribute:s.converter}:void 0!==(null===(a=s.converter)||void 0===a?void 0:a.fromAttribute)?s.converter:et;this._$Em=n;var l=u.fromAttribute(t,s.type);this[n]=null!==(r=null!=l?l:null===(o=this._$Ej)||void 0===o?void 0:o.get(n))&&void 0!==r?r:l,this._$Em=null}}},{key:"requestUpdate",value:function(e,t,i,n=!1,a){if(void 0!==e){var r,o,s=this.constructor;if(!1===n&&(a=this[e]),null!=i||(i=s.getPropertyOptions(e)),!((null!==(r=i.hasChanged)&&void 0!==r?r:tt)(a,t)||i.useDefault&&i.reflect&&a===(null===(o=this._$Ej)||void 0===o?void 0:o.get(e))&&!this.hasAttribute(s._$Eu(e,i))))return;this.C(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}},{key:"C",value:function(e,t,{useDefault:i,reflect:n,wrapped:a},r){var o,s,u;i&&!(null!==(o=this._$Ej)&&void 0!==o?o:this._$Ej=new Map).has(e)&&(this._$Ej.set(e,null!==(s=null!=r?r:t)&&void 0!==s?s:this[e]),!0!==a||void 0!==r)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),!0===n&&this._$Em!==e&&(null!==(u=this._$Eq)&&void 0!==u?u:this._$Eq=new Set).add(e))}},{key:"_$EP",value:function(){var e,t;return S(function(i){for(;;)switch(i.p=i.n){case 0:return this.isUpdatePending=!0,i.p=1,i.n=2,o(this._$ES);case 2:i.n=4;break;case 3:i.p=3,t=i.v,Promise.reject(t);case 4:if(e=this.scheduleUpdate(),!(null!=e)){i.n=5;break}return i.n=5,o(e);case 5:return i.a(2,!this.isUpdatePending)}},null,this,[[1,3]],Promise)}},{key:"scheduleUpdate",value:function(){return this.performUpdate()}},{key:"performUpdate",value:function(){if(this.isUpdatePending){if(!this.hasUpdated){var e;if(null!==(e=this.renderRoot)&&void 0!==e||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(var t,i=f(this._$Ep);!(t=i()).done;){var n=t.value,a=n[0],r=n[1];this[a]=r}this._$Ep=void 0}var o=this.constructor.elementProperties;if(o.size>0)for(var s,u=f(o);!(s=u()).done;){var l=s.value,d=l[0],h=l[1],c=h.wrapped,m=this[d];!0!==c||this._$AL.has(d)||void 0===m||this.C(d,void 0,h,m)}}var v=!1,p=this._$AL;try{var g;(v=this.shouldUpdate(p))?(this.willUpdate(p),null!==(g=this._$EO)&&void 0!==g&&g.forEach(e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)}),this.update(p)):this._$EM()}catch(p){throw v=!1,this._$EM(),p}v&&this._$AE(p)}}},{key:"willUpdate",value:function(e){}},{key:"_$AE",value:function(e){var t;null!==(t=this._$EO)&&void 0!==t&&t.forEach(e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}},{key:"_$EM",value:function(){this._$AL=new Map,this.isUpdatePending=!1}},{key:"updateComplete",get:function(){return this.getUpdateComplete()}},{key:"getUpdateComplete",value:function(){return this._$ES}},{key:"shouldUpdate",value:function(e){return!0}},{key:"update",value:function(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(e=>this._$ET(e,this[e]))),this._$EM()}},{key:"updated",value:function(e){}},{key:"firstUpdated",value:function(e){}}],[{key:"addInitializer",value:function(e){var t;this._$Ei(),(null!==(t=this.l)&&void 0!==t?t:this.l=[]).push(e)}},{key:"observedAttributes",get:function(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}},{key:"createProperty",value:function(e,t=it){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){var i=Symbol(),n=this.getPropertyDescriptor(e,i,t);void 0!==n&&He(this.prototype,e,n)}}},{key:"getPropertyDescriptor",value:function(e,t,i){var n,a=null!==(n=Ge(this.prototype,e))&&void 0!==n?n:{get(){return this[t]},set(e){this[t]=e}},r=a.get,o=a.set;return{get:r,set(t){var n=null==r?void 0:r.call(this);null!=o&&o.call(this,t),this.requestUpdate(e,n,i)},configurable:!0,enumerable:!0}}},{key:"getPropertyOptions",value:function(e){var t;return null!==(t=this.elementProperties.get(e))&&void 0!==t?t:it}},{key:"_$Ei",value:function(){if(!this.hasOwnProperty(Ze("elementProperties"))){var e=Xe(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}}},{key:"finalize",value:function(){if(!this.hasOwnProperty(Ze("finalized"))){if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ze("properties")))for(var e=this.properties,t=0,i=[...Ve(e),...Ke(e)];t<i.length;t++){var n=i[t];this.createProperty(n,e[n])}var a=this[Symbol.metadata];if(null!==a){var r=litPropertyMetadata.get(a);if(void 0!==r)for(var o,s=f(r);!(o=s()).done;){var u=o.value,l=u[0],d=u[1];this.elementProperties.set(l,d)}}this._$Eh=new Map;for(var h,c=f(this.elementProperties);!(h=c()).done;){var m=h.value,v=m[0],p=m[1],g=this._$Eu(v,p);void 0!==g&&this._$Eh.set(g,v)}this.elementStyles=this.finalizeStyles(this.styles)}}},{key:"finalizeStyles",value:function(e){var t=[];if(Array.isArray(e))for(var i,n=f(new Set(e.flat(1/0).reverse()));!(i=n()).done;){var a=i.value;t.unshift(ze(a))}else void 0!==e&&t.push(ze(e));return t}},{key:"_$Eu",value:function(e,t){var i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}}])}();nt.elementStyles=[],nt.shadowRootOptions={mode:"open"},nt[Ze("elementProperties")]=new Map,nt[Ze("finalized")]=new Map,null!=Qe&&Qe({ReactiveElement:nt}),(null!==(Le=Ye.reactiveElementVersions)&&void 0!==Le?Le:Ye.reactiveElementVersions=[]).push("2.1.2");var at={attribute:!0,type:String,converter:et,reflect:!1,hasChanged:tt},rt=(e=at,t,i)=>{var n=i.kind,a=i.metadata,r=globalThis.litPropertyMetadata.get(a);if(void 0===r&&globalThis.litPropertyMetadata.set(a,r=new Map),"setter"===n&&((e=Object.create(e)).wrapped=!0),r.set(i.name,e),"accessor"===n){var o=i.name;return{set(i){var n=t.get.call(this);t.set.call(this,i),this.requestUpdate(o,n,e,!0,i)},init(t){return void 0!==t&&this.C(o,void 0,e,t),t}}}if("setter"===n){var s=i.name;return function(i){var n=this[s];t.call(this,i),this.requestUpdate(s,n,e,!0,i)}}throw Error("Unsupported decorator location: "+n)};function ot(e){return(t,i)=>"object"==typeof i?rt(e,t,i):((e,t,i)=>{var n=t.hasOwnProperty(i);return t.constructor.createProperty(i,e),n?Object.getOwnPropertyDescriptor(t,i):void 0})(e,t,i)}function st(e){return ot(v({},e,{state:!0,attribute:!1}))}var ut=function(){function t(e,i,n){var a;return u(this,t),(a=s(this,t,[e,i,n])).host=null,a.defineDynamicStateProps(),a}return y(t,e.PaywallState),m(t,[{key:"hostConnected",value:function(){}},{key:"hostDisconnected",value:function(){this.subscribers.clear()}},{key:"onStateChanged",value:function(){this.defineDynamicStateProps(),this.host&&this.host.requestUpdate()}},{key:"defineDynamicStateProps",value:function(){Object.defineProperty(this.state,"tvQuality",{get:this.getTVQuality.bind(this),enumerable:!1,configurable:!0}),Object.defineProperty(this.state,"viewportWidth",{get:this.getViewportWidth.bind(this),enumerable:!1,configurable:!0}),Object.defineProperty(this.state,"viewportHeight",{get:this.getViewportHeight.bind(this),enumerable:!1,configurable:!0})}},{key:"getTVQuality",value:function(){var e,t;if("television"!==this.getFormFactor())return"";var i=window.devicePixelRatio||1,n=window.innerWidth||(null===(e=window.screen)||void 0===e?void 0:e.availWidth),a=window.innerHeight||(null===(t=window.screen)||void 0===t?void 0:t.availHeight);if(!n||!a)return"720p";var r=Math.max(n,a)*i,o=Math.min(n,a)*i;return r>=3840||o>=2160?"4K":r>=1920||o>=1080?"1080p":"720p"}},{key:"getViewportWidth",value:function(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth}},{key:"getViewportHeight",value:function(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}}],[{key:"create",value:function(e,i,n){var a=new t(e,i,n);return this.providers.push(a),a}},{key:"remove",value:function(e){this.providers=this.providers.filter(t=>t!==e)}},{key:"currentProvider",get:function(){return this.providers[0]}}])}();var lt=e=>{var t;return S(function(i){for(;;)if(0===i.n)return t=new Set(Array.from(document.fonts.values()).map(e=>e.family)),e.forEach(e=>{var i=dt(e);if(!t.has(i)){var n=new FontFace(i,`url(${e.file})`);document.fonts.add(n)}}),i.a(2,document.fonts.ready.then())},null,null,null,Promise)};function dt(e){return`${e.family}-${e.style}`.replace(/ /g,"")}function ht(t,i,n){var a,r,o,s,u,l,d,h;if("undefined"==typeof window||!t||!i)return e.logger.debug("Swipe detection is not supported in this environment."),{destroy(){},updateOptions(){}};var c={minDistance:null!==(a=null==n?void 0:n.minDistance)&&void 0!==a?a:30,maxDuration:null!==(r=null==n?void 0:n.maxDuration)&&void 0!==r?r:600,lockAxis:null===(o=null==n?void 0:n.lockAxis)||void 0===o||o,preventScrollOnSwipe:null!==(s=null==n?void 0:n.preventScrollOnSwipe)&&void 0!==s&&s,pointerTypes:null!==(u=null==n?void 0:n.pointerTypes)&&void 0!==u?u:["touch"],passiveListeners:null===(l=null==n?void 0:n.passiveListeners)||void 0===l||l,axisHint:null!==(d=null==n?void 0:n.axisHint)&&void 0!==d?d:"y",edgeLeakThreshold:null!==(h=null==n?void 0:n.edgeLeakThreshold)&&void 0!==h?h:24},m=t.style.touchAction;c.preventScrollOnSwipe&&(t.style.touchAction="none");var f=null,v=0,p=0,g=0,y=0,b=0,w=null,k=null,S=!1,E=!1,T=!1,P=e=>{try{var t=window.getComputedStyle(e);if(!t)return!1;var i=t.overflowY;if("auto"!==i&&"scroll"!==i)return!1;var n=e;return n.scrollHeight>n.clientHeight}catch(e){return!1}},M=e=>c.pointerTypes.includes(e.pointerType),A=e=>{var i=e.composedPath?e.composedPath()[0]:e.target;if(M(e)&&null===f){f=e.pointerId,v=g=e.clientX,p=y=e.clientY,b=performance.now(),w=null,T=!1,S=!1,E=!1,(k="y"===c.axisHint?((e,t)=>{for(var i=e;i&&i!==t&&i instanceof HTMLElement;){var n,a;if(P(i))return i;i=i.parentElement||(null!==(n=null===(a=i.parentNode)||void 0===a?void 0:a.host)&&void 0!==n?n:null)}return null})(i,t):null)||(E=!0);try{var n;null==t||null===(n=t.setPointerCapture)||void 0===n||n.call(t,e.pointerId)}catch(t){try{var a;null==i||null===(a=i.setPointerCapture)||void 0===a||a.call(i,e.pointerId)}catch(e){}}}},D=e=>{if(e.pointerId===f&&M(e)){if(g=e.clientX,y=e.clientY,c.lockAxis&&!w){var t=Math.abs(g-v),n=Math.abs(y-p);(t>2||n>2)&&(w=n>=t?"y":"x")}if("y"===c.axisHint&&("y"===w||!c.lockAxis)){var a=y-p,r=a<0?"up":"down",o=Math.abs(a),s=performance.now()-b,u=o/Math.max(s,1),l=o>=c.minDistance||u>.5;if(k)if(l)E=!0;else if(((e,t)=>!!e&&("down"===t?e.scrollTop>0:e.scrollTop+e.clientHeight<e.scrollHeight-1))(k,r)){if(!(("down"===r&&k.scrollTop<=50||"up"===r&&k.scrollTop+k.clientHeight>=k.scrollHeight-50)&&u>.3))return void(S=!0);E=!0}else E=!0;var d=!k||o>=c.edgeLeakThreshold;if(!T&&!S&&E&&d&&o>=c.minDistance){T=!0;var h=performance.now(),m={direction:"up"===r?"up":"down",distanceX:g-v,distanceY:a,absX:Math.abs(g-v),absY:o,duration:h-b,velocity:o/Math.max(h-b,1),startX:v,startY:p,endX:g,endY:y,startedAt:b,endedAt:h,originalEvent:e};i(m)}}}},x=e=>{if(e.pointerId===f)if(M(e))if(k)C();else if(T||S)C();else{var t,n=performance.now(),a=n-b,r=g-v,o=y-p,s=Math.abs(r),u=Math.abs(o),l="x"===(t=c.lockAxis&&w?w:"x"===c.axisHint?"x":"y"===c.axisHint?"y":s>=u?"x":"y")?s:u,d=a<=c.maxDuration,h=c.minDistance;if(k&&"y"===t&&E&&(h+=c.edgeLeakThreshold),d&&l>=h){var m;m="x"===t?r>0?"right":"left":o>0?"down":"up";var P=l/Math.max(a,1);i({direction:m,distanceX:r,distanceY:o,absX:s,absY:u,duration:a,velocity:P,startX:v,startY:p,endX:g,endY:y,startedAt:b,endedAt:n,originalEvent:e})}C()}else C()},C=()=>{f=null,w=null,b=0,k=null,E=!1,S=!1,T=!1},I=!!c.passiveListeners&&{passive:!0},L=c.passiveListeners?{passive:!0,capture:!0}:{capture:!0};t.addEventListener("pointerdown",A,L),t.addEventListener("pointermove",D,I),t.addEventListener("pointerup",x,I),t.addEventListener("pointercancel",x,I),t.addEventListener("lostpointercapture",x,I);return{destroy:()=>{t.removeEventListener("pointerdown",A,L),t.removeEventListener("pointermove",D,I),t.removeEventListener("pointerup",x,I),t.removeEventListener("pointercancel",x,I),t.removeEventListener("lostpointercapture",x,I),c.preventScrollOnSwipe&&(t.style.touchAction=m),C()},updateOptions:e=>{Object.assign(c,e),"boolean"==typeof e.preventScrollOnSwipe&&(e.preventScrollOnSwipe?t.style.touchAction="none":t.style.touchAction=m)}}}var ct={},mt=ct.NAMI_CLOSE_PAYWALL,ft=void 0===mt?"namiClosePaywall":mt,vt=ct.NAMI_RESTORE_PURCHASES,pt=void 0===vt?"namiRestorePurchases":vt,gt=ct.NAMI_SIGN_IN,yt=void 0===gt?"namiSignIn":gt,bt=ct.NAMI_BUY_SKU,wt=void 0===bt?"namiBuySKU":bt,kt=ct.SET_STATE,St=void 0===kt?"setState":kt,Et=ct.NAMI_SELECT_SKU,Tt=void 0===Et?"namiSelectSKU":Et,Pt=ct.NAMI_PURCHASE_SELECTED_SKU,Mt=void 0===Pt?"namiPurchaseSelectedSKU":Pt,At=ct.NAMI_DEEP_LINK,Dt=void 0===At?"namiDeeplink":At,xt=ct.NAMI_NAVIGATE_TO_SCREEN,Ct=void 0===xt?"namiNavigateToScreen":xt,It=ct.NAMI_RELOAD_PRODUCTS,Lt=void 0===It?"namiReloadProducts":It,_t=ct.NAMI_PLAY_VIDEO,Rt=void 0===_t?"namiPlayVideo":_t,Ft=ct.NAMI_PAUSE_VIDEO,Ot=void 0===Ft?"namiPauseVideo":Ft,Wt=ct.NAMI_MUTE_VIDEO,$t=void 0===Wt?"namiMuteVideo":Wt,Nt=ct.NAMI_UNMUTE_VIDEO,jt=void 0===Nt?"namiUnmuteVideo":Nt,Bt=e=>"subscription"===e;function zt(e){if(Bt(null==e?void 0:e.product_type)){var t=Ht(e);if(t.length>0)return t[0].billingPeriod}return null}function Ut(e){var t=function(e){if(!e)return[];var t=e.offers.filter(e=>"promo"===e.offer_type);return Gt(t,e.subscription_period)}(e).find(e=>0===e.priceAmountMicros);return(null==t?void 0:t.billingPeriod)||null}function Ht(e){return e?Gt(e.offers.filter(e=>"default"===e.offer_type),e.subscription_period):[]}function Gt(e,t){return e.map(e=>Vt(e,t))}function Vt(e,t){var i,n,a,r,o,s,u,l;if(!e)return{};var d=null!==(i=null===(n=e.promo_period)||void 0===n?void 0:n.count)&&void 0!==i?i:null==t?void 0:t.count,h=null!==(a=null===(r=e.promo_period)||void 0===r?void 0:r.type)&&void 0!==a?a:null==t?void 0:t.type,c=null!==(o=null===(s=e.promo_price)||void 0===s?void 0:s.price)&&void 0!==o?o:e.price,m=null!==(u=null===(l=e.promo_price)||void 0===l?void 0:l.currency)&&void 0!==u?u:e.currency;return{priceAmountMicros:1e6*c,priceCurrencyCode:m,billingPeriod:h?`P${d}${h[0].toUpperCase()}`:"",formattedPrice:Yt(m).format(c)}}function Kt(t,i=!1,n=!1,a=!1,r=!1){if(!t)return null;var o=t.match(/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?/);if(!o)return null;var s=o.slice(1).map(e=>parseInt(e)),u=s[0],l=s[1],d=s[2],h=s[3],c=(t,i,n,a,o)=>{var s=(e=>r?`${e}_abbrev`:e)(o),u=(e=>r?`${e}_abbrev_plural`:`${e}_plural`)(o),l=e.getTranslate(s),d=e.getTranslate(u);return r||l!==s||(l=e.getTranslate(`${o}_abbrev`)),r||d!==u||(d=e.getTranslate(`${o}_abbrev_plural`)),a?t.toString():n?1===t||i?l:d:1===t||i?`${t} ${l}`:`${t} ${d}`};switch(t.at(-1)){case"D":return c(h,i,n,a,"nami_day");case"W":return c(d,i,n,a,"nami_week");case"M":return c(l,i,n,a,"nami_month");case"Y":return c(u,i,n,a,"nami_year")}return null}function Xt(e){var t;if(!e||e.length<2)return!1;var i=null===(t=e.at(-1))||void 0===t?void 0:t.toUpperCase();return"M"===i||"Y"===i}function Yt(e){var t={maximumFractionDigits:2,minimumFractionDigits:0};try{return new Intl.NumberFormat(navigator.language,v({},t,{style:"currency",currency:e}))}catch(e){return new Intl.NumberFormat(navigator.language,v({},t,{style:"currency",currency:"USD"}))}}var qt=(e,t,i)=>e&&t&&i?i.format(e-t):null,Jt=(e,t,i,n)=>{if(e&&t&&i&&n){var a=100*(1-e/(i/n*t));return`${Math.round(a)}%`}return null},Qt=(e,t)=>{if(""!=t){var i=parseInt(t)-1;return i>=0&&i<(null==e?void 0:e.length)?e[i]:null==e?void 0:e.find(e=>e.sku_ref_id===t)}},Zt=e=>ti(e.priceAmountMicros)/ei(e.billingPeriod),ei=e=>{var t=parseInt(e[1]);return e.includes("Y")&&(t*=12),t},ti=e=>e/1e6;function ii(e){return parseFloat((Math.round(e)/100).toFixed(2))}var ni=(t,i,n=[])=>({price:()=>ri(t),name:()=>null==t?void 0:t.name,title:()=>null==t?void 0:t.name,description:()=>null==t?void 0:t.description,duration:()=>oi(t),durationSingular:()=>oi(t,!0),period:()=>oi(t,!1,!0),periodNumber:()=>oi(t,!1,!1,!0),freeTrialDuration:()=>si(t),freeTrialDurationSingular:()=>si(t,!0),freeTrialPeriod:()=>si(t,!1,!0),freeTrialPeriodNumber:()=>si(t,!1,!1,!0),pricePerMonth:()=>ui(t),pricePerMonthRounded:()=>ui(t,!0),periodInMonths:()=>li(t),durationInMonths:()=>di(t),durationInMonthsSingular:()=>di(t,!0),periodNumberInMonths:()=>hi(t),percentagePriceDifferenceFromSku:()=>ci(t,i,n),priceDifferenceFromSku:()=>mi(t,i,n),promoEligible:()=>null===fi(t)&&null!==vi(t,i),freeTrialEligible:()=>null!==fi(t),promo:()=>{var e;return null===(e=vi(t,i))||void 0===e?void 0:e.offer_ref_id},promoCode:()=>"XXXXX",promoPrice:()=>{var e;return null===(e=pi(t,i))||void 0===e?void 0:e.formattedPrice},promoPeriod:()=>gi(t,i,!1,!0),promoPeriodNumber:()=>gi(t,i,!1,!1,!0),promoDuration:()=>gi(t,i),promoDurationSingular:()=>gi(t,i,!0),introEligible:()=>!1,pricePerDay:()=>Si(t),pricePerWeek:()=>Ei(t),pricePerWeekRounded:()=>Ei(t,!0),introductoryPrice:()=>wi(t,i),introductoryPeriod:()=>bi(t,i,!1,!0),introductoryPeriodNumber:()=>bi(t,i,!1,!1,!0),introductoryDuration:()=>bi(t,i),introductoryDurationSingular:()=>bi(t,i,!0),introductoryPricePerMonth:()=>ki(t,i),introductoryPricePerMonthRounded:()=>ki(t,i,!0),durationAbbrev:()=>oi(t,!1,!1,!1,!0),freeTrialDurationAbbrev:()=>si(t,!1,!1,!1,!0),introductoryDurationAbbrev:()=>bi(t,i,!1,!1,!1,!0),promoDurationAbbrev:()=>gi(t,i,!1,!1,!1,!0),promoDurationPhase2Abbrev:()=>gi(t,i,!0,!0,!1,!0),durationInMonthsAbbrev:()=>di(t,!1,!1,!1,!0),durationSingularAbbrev:()=>oi(t,!0,!1,!1,!0),freeTrialDurationSingularAbbrev:()=>si(t,!0,!1,!1,!0),introductoryDurationSingularAbbrev:()=>bi(t,i,!0,!1,!1,!0),promoDurationSingularAbbrev:()=>gi(t,i,!0,!1,!1,!0),promoDurationSingularPhase2Abbrev:()=>gi(t,i,!0,!0,!1,!0),durationInMonthsSingularAbbrev:()=>di(t,!0,!1,!1,!0),periodAbbrev:()=>oi(t,!1,!0,!1,!0),freeTrialPeriodAbbrev:()=>si(t,!1,!0,!1,!0),introductoryPeriodAbbrev:()=>bi(t,i,!1,!0,!1,!0),promoPeriodAbbrev:()=>gi(t,i,!1,!0,!1,!0),promoPeriodPhase2Abbrev:()=>gi(t,i,!1,!0,!0,!0),periodInMonthsAbbrev:()=>di(t,!1,!0,!1,!0),periodly:()=>function(t){if(!t)return null;var i=t.match(/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?/);if(!i)return null;var n=i[1],a=i[2],r=i[3],o=i[4],s=void 0!==n?parseInt(n,10):0,u=void 0!==a?parseInt(a,10):0,l=void 0!==r?parseInt(r,10):0;return(void 0!==o?parseInt(o,10):0)>0?null:l>0?1===l?e.getTranslate("nami_weekly"):2===l?e.getTranslate("nami_biweekly"):null:u>0?1===u?e.getTranslate("nami_monthly"):2===u?e.getTranslate("nami_bimonthly"):3===u?e.getTranslate("nami_quarterly"):6===u?e.getTranslate("nami_biannually"):12===u?e.getTranslate("nami_yearly"):e.getTranslate("nami_monthly"):s>0?e.getTranslate("nami_yearly"):null}(zt(t)),iso_subscription_duration:()=>Ti(t),invalid:()=>!1,unavailable:()=>!1}),ai=(e,t,i,n=[])=>{if(!t)return null;var a=ni(t,i,n);return a[e]?a[e]():null},ri=e=>{var t=Ht(e);return t&&t.length?t[0].formattedPrice:null},oi=(e,t,i,n,a)=>Kt(zt(e),t,i,n,a),si=(e,t,i,n,a)=>Kt(Ut(e),t,i,n,a),ui=(e,t)=>{var i=Ht(e);if(!i||0===i.length)return null;var n=Zt(i[0]);return n?Yt(i[0].priceCurrencyCode).format(t?Math.round(n):n):null},li=(e,t)=>{var i=Ht(e);if(!i||0===i.length)return null;var n=i[0].billingPeriod;return Xt(n)?Kt("P1Y"===n?"P12M":n,!1,!1,!1,t):null},di=(e,t,i,n,a)=>{var r=Ht(e);if(!r||0===r.length)return null;var o=r[0].billingPeriod;return Xt(o)?Kt("P1Y"===o?"P12M":o,t,i,n,a):null},hi=e=>{if(!e)return 0;var t=Ht(e);return t&&t.length?ei(t[0].billingPeriod):0},ci=(e,t,i=[])=>{var n,a=Ht(e);if(!a||0===a.length)return null;var r=null===(n=Qt(i,null!=t?t:""))||void 0===n?void 0:n.product_details;if(!t||!r)return Jt(ii(a[0].priceAmountMicros),hi(e));var o=Ht(r);return Jt(ii(a[0].priceAmountMicros),hi(e),(null==o?void 0:o.length)>0?ii(o[0].priceAmountMicros):0,hi(r))},mi=(e,t,i=[])=>{var n,a=Ht(e);if(!a||0===a.length)return null;var r=null===(n=Qt(i,null!=t?t:""))||void 0===n?void 0:n.product_details;if(!t||!r)return qt(Zt(a[0]));var o=Ht(r);return qt(Zt(a[0]),Zt(o[0]),Yt(o[0].priceCurrencyCode))},fi=e=>Ut(e),vi=(e,t)=>{if(!e)return null;var i=e.offers.filter(e=>"promo"===e.offer_type);if(!t)return i[0]||null;var n=i[parseInt(t)];return n?n||null:i.find(e=>e.offer_ref_id===t)||null},pi=(e,t)=>{if(!e)return null;var i=vi(e,t);return i?Vt(i,e.subscription_period):null},gi=(e,t,i,n,a,r)=>{var o=pi(e,t);return Kt((null==o?void 0:o.billingPeriod)||null,i,n,a,r)},yi=(e,t)=>{if(!e)return null;var i=((e,t)=>{if(!e)return null;var i=e.offers.filter(e=>"intro"===e.offer_type);if(!t)return i[0]||null;var n=i[parseInt(t)];return n?n||null:i.find(e=>e.offer_ref_id===t)||null})(e,t);return i?Vt(i,e.subscription_period):null},bi=(e,t,i,n,a,r)=>{var o=yi(e,t);return Kt((null==o?void 0:o.billingPeriod)||null,i,n,a,r)},wi=(e,t)=>{var i=yi(e,t);return i?i.formattedPrice:null},ki=(e,t,i)=>{var n=yi(e,t);if(!n)return null;var a=Zt(n);return a?Yt(n.priceCurrencyCode).format(i?Math.round(a):a):null},Si=e=>{var t=Ht(e);if(!t||0===t.length)return null;var i,n,a=ti(t[0].priceAmountMicros)/(i=t[0].billingPeriod,(n=ei(i))?30.437*n:1);return Yt(t[0].priceCurrencyCode).format(a)},Ei=(e,t)=>{var i=Ht(e);if(!i||0===i.length)return null;var n,a,r=ti(i[0].priceAmountMicros)/(n=i[0].billingPeriod,(a=ei(n))?52*a/12:1);return Yt(i[0].priceCurrencyCode).format(t?Math.round(r):r)},Ti=e=>{var t=Ht(e)[0];return t?t.billingPeriod:null},Pi="object"==typeof global&&global&&global.Object===Object&&global,Mi="object"==typeof self&&self&&self.Object===Object&&self,Ai=Pi||Mi||Function("return this")(),Di=Ai.Symbol;var xi=Array.isArray,Ci=Object.prototype,Ii=Ci.hasOwnProperty,Li=Ci.toString,_i=Di?Di.toStringTag:void 0;var Ri=Object.prototype.toString;var Fi=Di?Di.toStringTag:void 0;function Oi(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Fi&&Fi in Object(e)?function(e){var t=Ii.call(e,_i),i=e[_i];try{e[_i]=void 0;var n=!0}catch(e){}var a=Li.call(e);return n&&(t?e[_i]=i:delete e[_i]),a}(e):function(e){return Ri.call(e)}(e)}function Wi(e){return null!=e&&"object"==typeof e}var $i=Di?Di.prototype:void 0,Ni=$i?$i.toString:void 0;function ji(e){if("string"==typeof e)return e;if(xi(e))return function(e,t){for(var i=-1,n=null==e?0:e.length,a=Array(n);++i<n;)a[i]=t(e[i],i,e);return a}(e,ji)+"";if(function(e){return"symbol"==typeof e||Wi(e)&&"[object Symbol]"==Oi(e)}(e))return Ni?Ni.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Bi(e){return null==e?"":ji(e)}function zi(e,t,i){var n=e.length;return i=void 0===i?n:i,!t&&i>=n?e:function(e,t,i){var n=-1,a=e.length;t<0&&(t=-t>a?0:a+t),(i=i>a?a:i)<0&&(i+=a),a=t>i?0:i-t>>>0,t>>>=0;for(var r=Array(a);++n<a;)r[n]=e[n+t];return r}(e,t,i)}var Ui=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");function Hi(e){return Ui.test(e)}var Gi="\\ud800-\\udfff",Vi="["+Gi+"]",Ki="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Xi="\\ud83c[\\udffb-\\udfff]",Yi="[^"+Gi+"]",qi="(?:\\ud83c[\\udde6-\\uddff]){2}",Ji="[\\ud800-\\udbff][\\udc00-\\udfff]",Qi="(?:"+Ki+"|"+Xi+")"+"?",Zi="[\\ufe0e\\ufe0f]?",en=Zi+Qi+("(?:\\u200d(?:"+[Yi,qi,Ji].join("|")+")"+Zi+Qi+")*"),tn="(?:"+[Yi+Ki+"?",Ki,qi,Ji,Vi].join("|")+")",nn=RegExp(Xi+"(?="+Xi+")|"+tn+en,"g");function an(e){return Hi(e)?function(e){return e.match(nn)||[]}(e):function(e){return e.split("")}(e)}var rn,on=(rn="toUpperCase",function(e){var t=Hi(e=Bi(e))?an(e):void 0,i=t?t[0]:e.charAt(0),n=t?zi(t,1).join(""):e.slice(1);return i[rn]()+n});var sn,un=(sn={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},function(e){return null==sn?void 0:sn[e]}),ln=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,dn=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");var hn=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var cn=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var mn="\\ud800-\\udfff",fn="\\u2700-\\u27bf",vn="a-z\\xdf-\\xf6\\xf8-\\xff",pn="A-Z\\xc0-\\xd6\\xd8-\\xde",gn="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",yn="["+gn+"]",bn="\\d+",wn="["+fn+"]",kn="["+vn+"]",Sn="[^"+mn+gn+bn+fn+vn+pn+"]",En="(?:\\ud83c[\\udde6-\\uddff]){2}",Tn="[\\ud800-\\udbff][\\udc00-\\udfff]",Pn="["+pn+"]",Mn="(?:"+kn+"|"+Sn+")",An="(?:"+Pn+"|"+Sn+")",Dn="(?:['’](?:d|ll|m|re|s|t|ve))?",xn="(?:['’](?:D|LL|M|RE|S|T|VE))?",Cn="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",In="[\\ufe0e\\ufe0f]?",Ln=In+Cn+("(?:\\u200d(?:"+["[^"+mn+"]",En,Tn].join("|")+")"+In+Cn+")*"),_n="(?:"+[wn,En,Tn].join("|")+")"+Ln,Rn=RegExp([Pn+"?"+kn+"+"+Dn+"(?="+[yn,Pn,"$"].join("|")+")",An+"+"+xn+"(?="+[yn,Pn+Mn,"$"].join("|")+")",Pn+"?"+Mn+"+"+Dn,Pn+"+"+xn,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",bn,_n].join("|"),"g");function Fn(e,t,i){return e=Bi(e),void 0===t?function(e){return cn.test(e)}(e)?function(e){return e.match(Rn)||[]}(e):function(e){return e.match(hn)||[]}(e):e.match(t)||[]}var On=RegExp("['’]","g");var Wn,$n=(Wn=function(e,t,i){return t=t.toLowerCase(),e+(i?on(Bi(t).toLowerCase()):t)},function(e){return function(e,t,i){for(var n=-1,a=null==e?0:e.length;++n<a;)i=t(i,e[n],n,e);return i}(Fn(function(e){return(e=Bi(e))&&e.replace(ln,un).replace(dn,"")}(e).replace(On,"")),Wn,"")});function Nn(e,t,i){var n,a,r=null!==(n=null===(a=t.find(e=>e.id===i))||void 0===a?void 0:a.products)&&void 0!==n?n:[];return r.forEach(t=>{t.product_details=Un(e,t.sku_ref_id||""),t.variables=function(e,t,i){if(!t)return{};var n=t.variables;if(!n)return v({},t);Object.keys(n).forEach(t=>{if(jn(n[t])){var a=zn(n[t],e,i);n[t]=function(e){if(!e||e.includes("null")||e.includes("undefined"))return"";if(/\$\{\s*(launch\.customAttributes\.|sku\.)\w+\s*}/.test(e))return"";return e}(a)}});var a={};return(()=>Object.keys(ni({})))().forEach(t=>{if(void 0===n[t]){var r=ai(t,e,void 0,i);null!==r&&(a[t]=r)}}),v({},t,a,n)}(t.product_details,t,r)}),r}function jn(t){return"string"==typeof t&&t.includes(e.SMART_TEXT_PATTERN)}function Bn(e,t,i){return t?(Object.keys(t).forEach(n=>{jn(t[n])&&(t[n]=t[$n(n)]=zn(t[n],e,i))}),v({},t)):{}}var zn=(t,i,n)=>t.replace(e.SKU_TEXT_REGEX,(a,r)=>{var o,s,u,l,d=(null===(o=e.SKU_TEXT_REGEX.exec(t))||void 0===o?void 0:o.slice(1))||[];r=null!==(s=d[0])&&void 0!==s?s:r;var h=null!==(u=null===(l=d[1])||void 0===l?void 0:l.replace(":",""))&&void 0!==u?u:"";return ai(r,i,h,n)});function Un(e=[],t=""){return e.find(e=>e.product_ref_id===t)||null}var Hn=["conditionAttributes"];function Gn(e,t){return Array.isArray(e)?e.reduce((e,i)=>{var n=Gn(i,t);return Array.isArray(n)?[...e,...n]:[...e,n]},[]):null==e?e:"object"==typeof e?Object.entries(e).reduce((e,[i,n])=>{var a="newRow"===i?n:Gn(n,t);return v({},e,{[i]:a})},{}):"string"==typeof e?Zn(e,t):e}function Vn(t,i,n,a={}){var r=n.productBaseComponents||n.components||[],o=n.productFeaturedComponents||r;return i.map(i=>{var n,s,u,l=i.featured?o:r,d=i.entitlements.map(e=>e.entitlement_ref_id),h=Un(t.productDetails,i.sku_ref_id),c={freeTrialEligible:1==ai("freeTrialEligible",h),introEligible:1==ai("introEligible",h),promoEligible:1==ai("promoEligible",h),invalid:ai("invalid",h),unavailable:ai("unavailable",h)},m=v({},i,i.variables,c,{id:i.id,entitlements:d});s=i,u=t=>{for(var i,n=f(t);!(i=n()).done;){var a=i.value;a.sku=e.toNamiSKU(s),a.components&&u(a.components),a.collapseHeader&&a.collapseHeader.components&&u(a.collapseHeader.components)}},u(l);var p={sku:m,media:Qn(a,{convertToUrl:!0})};return[null!==(n=i.featured)&&void 0!==n&&n,Gn(l,Gn(p,p))]},[])}function Kn(e,t){if(!t.loopSource)return[];var i="string"==typeof t.loopSource?JSON.parse(t.loopSource):t.loopSource,n=(null!=i?i:[]).filter(i=>{var n;return!(null!==(n=t.loopSourceConditions)&&void 0!==n&&n.length)||t.loopSourceConditions.every(t=>Jn(e,t,i))}),a=t.groupBy,r=t.groupHeaderTemplate,o=e=>Gn(t.components,Gn({block:e},{block:e}));if(!a||!r)return[{key:"",header:null,items:n.map(o).filter(e=>null!=e)}];for(var s,u=[],l=new Map,d=f(n);!(s=d()).done;){var h=s.value,c=Gn(a,Gn({block:h},{block:h})),m=null==c?"":String(c);l.has(m)||(u.push(m),l.set(m,[])),l.get(m).push(h)}return u.map(e=>{var t={key:e};return{key:e,header:[Gn(r,Gn({group:t},{group:t}))],items:l.get(e).map(o)}})}function Xn(e,t){return t.assertions?t.assertions.every(Jn.bind(null,e)):!!t.orAssertions&&(!t.orAssertions.length||t.orAssertions.some(Jn.bind(null,e)))}function Yn(e,t){var i=t.conditionAttributes,n=function(e,t){if(null==e)return{};var i={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;i[n]=e[n]}return i}(t,Hn);return i?i.reduce((t,i)=>Xn(e,i)?(Object.entries(i.attributes).forEach(([t,n])=>{i.attributes[t]=qn(e,n)}),v({},t,i.attributes)):t,n):n}function qn(t,i,n,a=null){var r,o=null!==(r=null==t?void 0:t.flow)&&void 0!==r?r:{},s=o.manager,u=o.previousStepAvailable,l=o.nextStepAvailable,d=t.state,h={};return a&&(h={block:a}),h=v({},h,{state:d,urlParams:e.getUrlParams(),flow:{isLaunched:!(null==s||!s.flowOpen),previousStepAvailable:!!u,nextStepAvailable:!!l},launch:d.launch,sku:d.sku,customer:d.customer}),"string"==typeof i&&i.includes(e.SMART_TEXT_PATTERN)&&(i=Zn(i,h)),i}function Jn(t,{value:i,expected:n,operator:a},r){if(i=qn(t,i,0,r),n=qn(t,n,0,r),"equals"===a)return i===n;if("notEquals"===a)return i!==n;if("contains"===a){var o;if(Array.isArray(i)||"string"==typeof i||i instanceof String||(i=i.toString()),"collapse"==n)n+="_"+(null===(o=t.getCurrentCollapsibleSku())||void 0===o?void 0:o.skuId);return i.includes(n)}if("notContains"===a)return Array.isArray(i)||"string"==typeof i||i instanceof String||(i=i.toString()),!i.includes(n);if("set"===a){var s=null!=i&&""!==i&&!i.toString().match(e.LIQUID_VARIABLE_REGEX);return"boolean"==typeof n?s===n:s}return"notSet"===a?null==i||""===i||!!i.toString().match(e.LIQUID_VARIABLE_REGEX):"gt"===a?i>n:"gte"===a?i>=n:"lt"===a?i<n:"lte"===a&&i<=n}function Qn(e,{convertToUrl:t}={convertToUrl:!1}){return Object.entries(e).reduce((e,[i,{content:n}])=>(t&&"string"!=typeof n&&n&&(n=URL.createObjectURL(n)),v({},e,{[i]:n})),{})}function Zn(t,i){var n=t;if("string"!=typeof t)return n;for(var a,r=new RegExp(e.VAR_REGEX.source,e.VAR_REGEX.flags),o=[];null!==(a=r.exec(t))&&(o.push(a),r.global);)a.index===r.lastIndex&&r.lastIndex++;for(var s=0,u=o;s<u.length;s++){var l=u[s],d=l[0],h=l[1],c=Zn(h,i);if(d===t)return m(d,c);c!==h&&(n=n.replace(h,c)),n=n.replace(e.VAR_REGEX,m)}return n;function m(e,t){var n=String(t).split("."),a=n[0];if(!a)return e;var r=ea(i,a);if(void 0===r)return e;if("object"==typeof r&&null!==r&&0===Object.keys(r).length)return"";var o=ea(i,...n);return void 0===o?"":"string"!=typeof o?o:Zn(o,i)}}function ea(e,...t){for(var i=e,n=0,a=t;n<a.length;n++){var r=a[n];if(null==i)return;i=Array.isArray(i)?i[+r]:i[r]}return i}var ta=e=>{var t=e.state.timeSpentOnPaywall;if(t)return Date.now()-t},ia=e=>{if(!e)return null;if(e.includes("#"))return e;var t=e.match(/[\d.]+/g);if(!t||t.length<3)return null;var i=t.map(Number),n=i[0],a=i[1],r=i[2],o=i[3],s=e=>Math.round(e).toString(16).padStart(2,"0"),u=void 0!==o&&o<1?s(255*o):"";return`#${s(n)}${s(a)}${s(r)}${u}`},na=(e,t)=>{if(!e||!t)return!0;var i=null!=e&&e.includes("rgb")?ia(e):e,n=null!=t&&t.includes("rgb")?ia(t):t;return(null==i?void 0:i.toLowerCase())===(null==n?void 0:n.toLowerCase())};function aa(e){var t,i,n,a,r,o,s,u,l,d,h,c,m;return{width:null!==(t=e.width)&&void 0!==t?t:20,railSpacing:null!==(i=e.railSpacing)&&void 0!==i?i:12,dotLineSpacing:null!==(n=e.dotLineSpacing)&&void 0!==n?n:10,lineTopOffset:null!==(a=e.lineTopOffset)&&void 0!==a?a:0,lineBottomOffset:null!==(r=e.lineBottomOffset)&&void 0!==r?r:0,lineWidth:null!==(o=e.lineWidth)&&void 0!==o?o:1,lineColor:null!==(s=e.lineColor)&&void 0!==s?s:"#C6CBD7",lineCornerRadius:null!==(u=e.lineCornerRadius)&&void 0!==u?u:0,dotSize:null!==(l=e.dotSize)&&void 0!==l?l:6,dotColor:null!==(d=e.dotColor)&&void 0!==d?d:"#C6CBD7",dotCornerRadius:null!==(h=e.dotCornerRadius)&&void 0!==h?h:3,dotBorderWidth:null!==(c=e.dotBorderWidth)&&void 0!==c?c:0,dotBorderColor:null!==(m=e.dotBorderColor)&&void 0!==m?m:"transparent",conditionAttributes:e.conditionAttributes}}function ra(e,t,i){for(var n,a=aa(t),r={key:i},o=Gn(t,Gn({group:r},{group:r})),s={dotSize:a.dotSize,dotColor:a.dotColor,dotCornerRadius:a.dotCornerRadius,dotBorderWidth:a.dotBorderWidth,dotBorderColor:a.dotBorderColor},u=f(null!==(l=o.conditionAttributes)&&void 0!==l?l:[]);!(n=u()).done;){var l,d,h=n.value;if(Xn(e,h)){var c=null!==(d=h.attributes)&&void 0!==d?d:{};s={dotSize:"number"==typeof c.dotSize?c.dotSize:s.dotSize,dotColor:"string"==typeof c.dotColor?c.dotColor:s.dotColor,dotCornerRadius:"number"==typeof c.dotCornerRadius?c.dotCornerRadius:s.dotCornerRadius,dotBorderWidth:"number"==typeof c.dotBorderWidth?c.dotBorderWidth:s.dotBorderWidth,dotBorderColor:"string"==typeof c.dotBorderColor?c.dotBorderColor:s.dotBorderColor}}}return s.dotCornerRadius=Math.min(s.dotCornerRadius,s.dotSize/2),s}var oa=!0,sa=!1,ua=!1,la=!1,da=!1,ha=!1,ca=null,ma=null,fa=null,va=null,pa=!1,ga="",ya=!1,ba=null,wa=null,ka=null,Sa=null,Ea=null,Ta=null,Pa=null,Ma=null,Aa=!1,Da=null,xa="",Ca=0,Ia=1,La=null,_a=[],Ra=new WeakMap,Fa=new WeakMap,Oa=1;function Wa(e){var t=Fa.get(e);return t||(t=Oa++,Fa.set(e,t)),String(t)}var $a=null,Na=null,ja=null,Ba=null;function za(e){return!0===e||"true"===e||"1"===e||"yes"===e}function Ua(e,t){if(function(){if("undefined"==typeof window)return!1;try{var e,t;return!!za(window.NAMI_TTS_DEBUG)||za(null===(e=window.localStorage)||void 0===e?void 0:e.getItem("nami:tts:debug"))||za(null===(t=window.localStorage)||void 0===t?void 0:t.getItem("NAMI_TTS_DEBUG"))}catch(e){return!1}}())try{t?console.debug(`[Nami TTS] ${e}`,t):console.debug(`[Nami TTS] ${e}`)}catch(e){}}function Ha(e="TTS is unavailable in this runtime."){sa||(sa=!0,Ua(e))}function Ga(e){if(!e)return"none";var t=e.id?`#${e.id}`:"",i=e.getAttribute("data-testid"),n=i?`[data-testid="${i}"]`:"";return`${e.tagName.toLowerCase()}${t}${n}`}function Va(e){return function(e){return null==e?"":String(e).replace(/[^.!?\n]*\$\{[^}]*subscribeUrl[^}]*\}[^.!?\n]*[.!?]?/gi,"To subscribe, follow the on-screen instructions.").replace(/\$\{[^}]+\}/g," ").replace(/\s+([.,!?;:])/g,"$1").replace(/\s+/g," ").trim()}(e)}function Ka(e){return e.toLowerCase().replace(/[^a-z0-9$]+/g," ").replace(/\s+/g," ").trim()}function Xa(e){return Va(String(null!=e?e:"").replace(/<[^>]*>/g," ").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`#>~]/g," "))}function Ya(e,t){var i=Va(t);i&&e[e.length-1]!==i&&e.push(i)}function qa(e,t=[]){var i=[];return[...e,...t].forEach(e=>{var t=function(e){var t=Va(e);if(!t)return[];for(var i=[],n=0,a=0;a<t.length;a+=1){var r=t.charAt(a),o=t.charAt(a+1);if(("."===r||"!"===r||"?"===r)&&(!o||/\s/.test(o))){var s=Va(t.slice(n,a+1));for(s&&i.push(s);a+1<t.length&&/\s/.test(t.charAt(a+1));)a+=1;n=a+1}}var u=Va(t.slice(n));u&&i.push(u);return i.length?i:[t]}(e);t.length||Ya(i,e),t.forEach(e=>Ya(i,e))}),i.slice(0,60)}function Ja(e){return Va(e.join(". ").replace(/\.\s*([.!?])/g,"$1"))}function Qa(e){var t,i=La;i&&(e&&i.id===e||(i.status="cancelled",(null===(t=La)||void 0===t?void 0:t.id)===i.id&&(La=null)))}function Za(){if("undefined"==typeof document)return null;for(var e=document.activeElement;e&&null!==(t=e.shadowRoot)&&void 0!==t&&t.activeElement;){var t,i,n;e=null!==(i=null===(n=e.shadowRoot)||void 0===n?void 0:n.activeElement)&&void 0!==i?i:e}return e}function er(e){return"undefined"!=typeof ShadowRoot&&e instanceof ShadowRoot}function tr(e){for(var t=[],i=null!=e?e:null;i;){i instanceof Element&&-1===t.indexOf(i)&&t.push(i);var n=i.parentNode;i=er(n)?n.host:n}return t}function ir(e,t){return!!t&&-1!==tr(t).indexOf(e)}function nr(e,t){if(!t)return!1;if(t===e)return!0;if(e.contains(t))return!0;var i=e.shadowRoot;return!!i&&(i.activeElement===t||i.contains(t))}function ar(e,t){t&&-1===e.indexOf(t)&&e.push(t)}function rr(e,t){var i=t.shadowRoot;i&&i.querySelectorAll('button,[role="button"],a,input,select,textarea,[tabindex]:not([tabindex="-1"])').forEach(t=>ar(e,t))}function or(e,t){var i,n=("function"==typeof(null==t?void 0:t.composedPath)?t.composedPath():null!==(i=null==t?void 0:t.composedPath)&&void 0!==i?i:[]).filter(e=>e instanceof Element);return n.length?n:tr(e)}function sr(e,t=[],i={}){var n=[];if(i.focusedElementOnly)return ar(n,e),n;var a=(t.length?t:tr(e)).filter(e=>e.isConnected),r=function(e,t){var i,n=t.find(e=>e.matches("nami-product-container"));if(n)return n;var a=tr(e).find(e=>e.matches("nami-product-container"));if(a)return a;var r=va&&"querySelectorAll"in va?va:"undefined"!=typeof document?document:null;return r&&null!==(i=Array.prototype.slice.call(r.querySelectorAll("nami-product-container")).find(t=>ir(t,e)))&&void 0!==i?i:null}(e,a);return ar(n,e),rr(n,e),a.forEach(t=>{var i=!!r&&(t===r||ir(r,t)),a=t!==e&&ir(t,e),o=t.matches('nami-product-container,nami-button,[role="button"],button,[tabindex]:not([tabindex="-1"])');(i||a||t===e)&&o&&(ar(n,t),rr(n,t))}),null!=r&&r.isConnected&&(ar(n,r),rr(n,r)),n}function ur(e){return Ra.has(e)}function lr(e,t,i=[]){var n=Va(t);if(!n)return!1;mr(),dr(void 0,"new-composite",!0);var a=sr(e,i,Dr()||Ar()?{focusedElementOnly:!1}:{focusedElementOnly:!0});return a.forEach(e=>function(e,t){var i=Va(t);return!!i&&(Ra.has(e)||Ra.set(e,{"aria-label":e.getAttribute("aria-label")}),e.setAttribute("aria-label",i),!0)}(e,n)),_a=a,!0}function dr(e,t="manual",i=!1){var n=e&&-1===_a.indexOf(e)?sr(e):_a;n.length&&(!i&&La&&n.some(e=>Ra.has(e))?Ua("composite restore skipped: transaction still active",{reason:t}):(mr(),n.forEach(e=>{var t=Ra.get(e);t&&(!function(e,t,i){null===i?e.removeAttribute(t):e.setAttribute(t,i)}(e,"aria-label",t["aria-label"]),Ra.delete(e))}),e&&-1===_a.indexOf(e)||(_a=[])))}function hr(e,t){Ra.has(e)&&(t instanceof Element&&nr(e,t)||(mr(),ka=setTimeout(()=>{(ka=null,e.isConnected)?nr(e,Za())||dr(e,"blur"):dr(e,"blur-disconnected",!0)},50)))}function cr(e){_a.length&&dr(void 0,e,!0)}function mr(){ka&&(clearTimeout(ka),ka=null)}function fr(){Sa&&(clearTimeout(Sa),Sa=null),$a=null}function vr(){Ea&&(clearTimeout(Ea),Ea=null)}function pr(){Ta&&(clearTimeout(Ta),Ta=null)}function gr(){Pa&&(clearTimeout(Pa),Pa=null)}function yr(){Ma&&(clearTimeout(Ma),Ma=null)}function br(e){Aa=!0,yr(),Ma=setTimeout(()=>{Ma=null,Aa=!1},kr(e)+500)}function wr(){yr(),Aa=!1}function kr(e){var t=Va(e),i=350*(t?t.split(/\s+/).filter(Boolean).length:0);return Math.min(3e4,Math.max(4e3,i))}function Sr(){return"undefined"==typeof window?null:window}function Er(){var e,t=null===(e=Sr())||void 0===e||null===(e=e.webOS)||void 0===e||null===(e=e.service)||void 0===e?void 0:e.request;return"function"==typeof t?t:null}function Tr(){return!!Er()}function Pr(){var e;if("undefined"==typeof window)return null;var t=null===(e=window.VIZIO)||void 0===e?void 0:e.Chromevox;return t&&"function"==typeof t.play?t:null}function Mr(){return"undefined"!=typeof window&&void 0!==window.speechSynthesis&&"function"==typeof window.speechSynthesis.speak&&"function"==typeof window.SpeechSynthesisUtterance}function Ar(){var e;if("undefined"==typeof window)return!1;var t=window,i=(null===(e=window.navigator)||void 0===e||null===(e=e.userAgent)||void 0===e?void 0:e.toLowerCase())||"";return!(!t.VIZIO&&-1===i.indexOf("vizio"))}function Dr(){var e,t;if("undefined"==typeof window)return!1;if(Ar())return!1;var i=(null===(e=window.navigator)||void 0===e||null===(e=e.userAgent)||void 0===e?void 0:e.toLowerCase())||"",n=Sr();return!!(null!=n&&n.webOS||null!=n&&n.webOSDev||null!=n&&n.PalmSystem||null!=n&&null!==(t=n.webOS)&&void 0!==t&&null!==(t=t.platform)&&void 0!==t&&t.tv||-1!==i.indexOf("webos")||-1!==i.indexOf("netcast"))}function xr(){var e;if("undefined"==typeof window)return!1;var t=window,i=(null===(e=window.navigator)||void 0===e||null===(e=e.userAgent)||void 0===e?void 0:e.toLowerCase())||"";return!!(t.tizen||-1!==i.indexOf("tizen")||-1!==i.indexOf("samsung")&&(-1!==i.indexOf("smart-tv")||-1!==i.indexOf("smarttv"))||-1!==i.indexOf("samsungbrowser")&&-1!==i.indexOf("tv"))}function Cr(e){return"string"==typeof e&&-1!==e.toLowerCase().indexOf("xbox")}function Ir(){var e,t,i;if("undefined"==typeof window)return!1;if(!0===ja)return!0;var n=window.navigator;return[n.userAgent,n.platform,n.vendor,null===(e=n.userAgentData)||void 0===e?void 0:e.platform,...(null!==(t=null===(i=n.userAgentData)||void 0===i?void 0:i.brands)&&void 0!==t?t:[]).map(e=>e.brand)].some(Cr)}function Lr(){if("undefined"==typeof window)return!1;try{return"television"===e.getDeviceFormFactor()}catch(e){return!1}}function _r(){if(da)return!1;var e=Pr();if(!e)return!1;try{return"function"!=typeof e.isEnabled||e.isEnabled()}catch(e){return!1}}function Rr(){return{televisionRuntime:Lr(),televisionTtsRuntime:Fr(),webos:Dr(),tizen:xr(),vizio:Ar(),xbox:Ir(),xboxClientHintsResult:ja,hasWebOsServiceRequest:Tr(),webOsRequestType:typeof Er(),hasWebSpeechApi:Mr(),webSpeechUnavailableForSession:ua,webOsLunaUnavailableForSession:la,vizioChromevoxUnavailableForSession:da}}function Fr(){return Lr()||Dr()||Ar()||xr()}function Or(){return Fr()&&!ua&&Mr()}function Wr(e){if(ha=e,Ua("set media playing",{playing:e,hasDeferredUtterance:!!ca}),!e&&ca){var t,i=ca;if(ca=null,i.options.transactionId&&(null===(t=La)||void 0===t?void 0:t.id)!==i.options.transactionId)return void Ua("drop stale deferred speech",{transactionId:i.options.transactionId,reason:i.options.reason});to(i.text,i.options)}}function $r(e){ua=!0,Ha(Dr()?"Web Speech TTS unavailable in this webOS runtime":"Web Speech TTS unavailable in this runtime"),Ua("web speech unavailable",{error:e})}function Nr(e){la=!0,Ua("webOS Luna unavailable",{error:e})}function jr(e,t){ca={text:e,options:t}}var Br={name:"webos-luna-tts",platform:"webos",isAvailable:function(){return Fr()&&!Ar()&&!la&&Tr()},speak:function(e,t){Ua("speakViaWebOsLuna:enter",{textPreview:e.slice(0,160),reason:t.reason,transactionId:t.transactionId,requestType:typeof Er()});var i=Er();if(!i)return Ua("speakViaWebOsLuna:no-request"),!1;var n="composite"===t.reason,a=!1,r=()=>{var r,o;if(Ta=null,t.transactionId&&(null===(r=La)||void 0===r?void 0:r.id)!==t.transactionId)return Ua("speakViaWebOsLuna:drop-stale-delayed-speak",{transactionId:t.transactionId,activeTransaction:null===(o=La)||void 0===o?void 0:o.id,reason:t.reason}),!1;if(ha)return Ua("speakViaWebOsLuna:defer-delayed-speak-media-playing",{transactionId:t.transactionId,reason:t.reason}),jr(e,t),!0;var s=!1;try{Ua("speakViaWebOsLuna:request",{uri:"luna://com.webos.service.tts",method:"speak",delayedComposite:n,textPreview:e.slice(0,160)}),i("luna://com.webos.service.tts",{method:"speak",parameters:{text:e,clear:!0,feedback:!0},onSuccess:e=>{var i;if(Ua("speakViaWebOsLuna:onSuccess",{response:e,transactionId:t.transactionId}),!t.transactionId||(null===(i=La)||void 0===i?void 0:i.id)===t.transactionId){var n,r=function(e){var t,i=Va(null!==(t=null==e?void 0:e.msgStatus)&&void 0!==t?t:null==e?void 0:e.status).toLowerCase();return"done"===i||"stopped"===i||"canceled"===i||"cancelled"===i||"error"===i}(e),o=!(null==e||!e.returnValue||"msgStatus"in Object(null!=e?e:{}));if(!a&&(r||o))a=!0,t.transactionId&&(null===(n=La)||void 0===n?void 0:n.id)===t.transactionId&&(La.status="ended",La=null)}},onFailure:e=>{var i;s=!0,Ua("speakViaWebOsLuna:onFailure",{error:e,transactionId:t.transactionId});var n=!t.transactionId||(null===(i=La)||void 0===i?void 0:i.id)===t.transactionId;t.transactionId&&n&&La&&(La.status="cancelled",La=null),Nr(e)}})}catch(e){var u;return t.transactionId&&(null===(u=La)||void 0===u?void 0:u.id)===t.transactionId&&(La.status="cancelled",La=null),Nr(e),!1}return!s};if(n)return pr(),Ua("speakViaWebOsLuna:delay-composite-until-focus-settles",{delayMs:250,transactionId:t.transactionId}),Ta=setTimeout(r,250),!0;return r()},stop:Hr},zr={name:"web-speech",platform:"web",isAvailable:Or,speak:function(e,t){if(!Or())return!1;try{var i=new window.SpeechSynthesisUtterance(e);return i.onstart=()=>{var e;t.transactionId&&(null===(e=La)||void 0===e?void 0:e.id)===t.transactionId&&(La.status="started")},i.onend=()=>{var e=La,i=!t.transactionId||(null==e?void 0:e.id)===t.transactionId;t.transactionId&&i&&e&&(e.status="ended",La=null)},i.onerror=e=>{var i,n=e.error;t.transactionId&&(null===(i=La)||void 0===i?void 0:i.id)===t.transactionId&&(La.status="cancelled",La=null),"synthesis-failed"===n&&$r(n)},window.speechSynthesis.speak(i),!0}catch(e){return $r("exception"),!1}},stop:()=>{if(Mr())try{window.speechSynthesis.cancel()}catch(e){}}},Ur={name:"vizio-chromevox",platform:"vizio",isAvailable:_r,speak:Vr,stop:Gr};function Hr(){var e=Er();if(e)try{e("luna://com.webos.service.tts",{method:"stop",parameters:{},onFailure:e=>Ua("webOS Luna stop failed",{error:e})})}catch(e){Ua("webOS Luna stop threw",{error:e})}}function Gr(e=!0){var t=!!Ea,i=Aa;vr();var n=Pr(),a=function(){var e;if("undefined"==typeof window)return null;var t=null===(e=window.chrome)||void 0===e||null===(e=e.tts)||void 0===e?void 0:e.stop;return"function"==typeof t?t:null}();if((n||a)&&(i||t||a)&&(i||!t||a))try{var r=!1;n&&"function"==typeof n.stop&&(n.stop(),r=!0),n&&"function"==typeof n.cancel&&n.cancel(),n&&"function"==typeof n.pause&&n.pause(),a&&(a(),r=!0),n&&e&&!r&&i&&n.play(""),wr()}catch(e){wr(),Ua("VIZIO stop threw",{error:e})}}function Vr(e,t){var i=Pr();if(!i)return!1;try{var n,a,r=!0===(null===(n=t.element)||void 0===n?void 0:n.isConnected),o="composite"===t.reason?1400:"focus"===t.reason?700:0;return o>0?(vr(),Ea=setTimeout(()=>{var n;if(Ea=null,!t.transactionId||!La||La.id===t.transactionId)if(t.element&&r&&!t.element.isConnected){var a;t.transactionId&&(null===(a=La)||void 0===a?void 0:a.id)===t.transactionId&&(La.status="cancelled",La=null)}else{if(ha)return fr(),Na=null,void jr(e,t);i.play(e),br(e),t.transactionId&&(null===(n=La)||void 0===n?void 0:n.id)===t.transactionId&&(La.status="ended",La=null)}},o),!0):(i.play(e),br(e),t.transactionId&&(null===(a=La)||void 0===a?void 0:a.id)===t.transactionId&&(La.status="ended",La=null),!0)}catch(e){return function(e){da=!0,Ua("VIZIO Chromevox unavailable",{error:e})}(e),!1}}function Kr(e){return"high"===e?3:"normal"===e?2:1}function Xr(){return Date.now()-Ca<1500}function Yr(e){return Ka(e)}function qr(e){if(!e)return"";var t=function(e){return e?[e.tagName.toLowerCase(),e.id||"",e.getAttribute("data-component-id")||"",e.getAttribute("data-nami-id")||"",e.getAttribute("data-testid")||"",`el-${Wa(e)}`].filter(Boolean).join("|"):""}(e);return Ka(t||oo(e))}function Jr(e){var t=Yr(e);return"clickable"===t||"button"===t||"focusable"===t||"selected"===t||"unselected"===t}function Qr(e,t,i){var n;if(Na={textKey:Yr(e),reason:t.reason,timestamp:Date.now()},"high"===i){var a=kr(e),r=Date.now();$a={transactionId:t.transactionId,pageKey:ga,element:null!==(n=t.element)&&void 0!==n?n:null,elementKey:qr(t.element),textKey:Yr(e),startedAt:r,suppressUntil:r+a},Sa&&clearTimeout(Sa),Sa=setTimeout(()=>{Sa=null,$a=null},a)}}function Zr(e,t=!0){var i,n,a,r=!(!e||(null===(i=La)||void 0===i?void 0:i.id)!==e||"pending"!==La.status);if(Ua("stopSpeech",{preserveTransactionId:e,allowVizioEmptyFallback:t,activeTransaction:null===(n=La)||void 0===n?void 0:n.id,reason:null===(a=La)||void 0===a?void 0:a.reason,preservingCurrentTransaction:r}),ca=null,r||(gr(),pr()),e||(fr(),mr(),cr("stop")),Qa(e),wa&&(clearTimeout(wa),wa=null),!r){if(Mr())try{window.speechSynthesis.cancel()}catch(e){}Dr()&&Hr(),Ar()&&Gr(t)}}function eo(){Zr()}function to(e,t={}){var i,n,a;Ua("speakText:enter",{textPreview:Va(e).slice(0,160),reason:t.reason,transactionId:t.transactionId,element:Ga(t.element),runtime:Rr()});var r=Va(e);if(!r)return!1;if(!Fr())return Ua("skip speech: non-CTV runtime"),!1;var o={interrupt:!1!==t.interrupt,reason:null!==(i=t.reason)&&void 0!==i?i:"manual",transactionId:t.transactionId,element:t.element,focusPath:t.focusPath,priority:t.priority},s=function(e,t){return t.priority?t.priority:"composite"===t.reason?"high":Jr(e)?"low":"normal"}(r,o);if(function(e,t,i){var n=Yr(e),a=Date.now(),r=qr(t.element);if(Jr(e))return!0;if(Na&&Na.reason===t.reason&&Na.textKey===n&&a-Na.timestamp<600)return Ua("suppress:duplicate-request",{reason:t.reason,textPreview:e.slice(0,120)}),!0;if(!$a)return!1;if(Kr(i)>=Kr("high"))return!1;if("focus"===t.reason){var o=$a.textKey;if(!Xr()&&(n===o||n.includes(o)))return Ua("suppress:focus-text-is-active-composite",{textPreview:e.slice(0,120),transactionId:$a.transactionId,element:Ga(t.element)}),!0}var s=function(e,t){return!!e&&!!t&&e===t}(t.element,$a.element),u=!!r&&$a.elementKey===r,l=!$a.pageKey||$a.pageKey===ga,d=Xr(),h=l&&!d&&a<$a.startedAt+2500;return!(!s&&!u&&(l&&"focus"===t.reason&&t.element&&$a.element!==t.element||"low"!==i&&!h)&&(fr(),1))}(r,o,s))return!1;if(o.interrupt&&Zr(o.transactionId,!1),ha)return jr(r,o),!0;var u=function(e){var t;return"manual"!==(null!==(t=e.reason)&&void 0!==t?t:"manual")&&e.element?Dr()||Ar()?"programmatic":"accessibility-label":"programmatic"}(o);Ua("speakText:owner",{owner:u,reason:o.reason,element:Ga(o.element)});var l,d,h="programmatic"===u?function(){if(!Fr())return null;var e=Ar(),t=Dr();return Ur.isAvailable()?(Ua("resolveTtsEngine:selected",{engine:"vizio-chromevox"}),Ur):e?null:Br.isAvailable()?(Ua("resolveTtsEngine:selected",{engine:"webos-luna-tts"}),Br):zr.isAvailable()?(Ua("resolveTtsEngine:selected",{engine:"web-speech"}),zr):(Ua("tts engine unavailable",{webos:t,vizio:e}),null)}():null;(Ua("speakText:engine",{engine:null!==(n=null==h?void 0:h.name)&&void 0!==n?n:null,owner:u}),"composite"===o.reason&&o.transactionId&&o.element&&function(e){return"accessibility-label"===e||Dr()}(u))&&lr(o.element,r,null!==(l=o.focusPath)&&void 0!==l?l:[]);if("accessibility-label"===u)return"focus"===o.reason&&o.element&&o.element.setAttribute("aria-label",r),o.transactionId&&(null===(d=La)||void 0===d?void 0:d.id)===o.transactionId&&(La.status="started"),Qr(r,o,s),!0;if(!h)return function(e,t){if(!Ar()||da)return!1;var i=Date.now(),n=()=>{var a;Pa=null,t.transactionId&&La&&La.id!==t.transactionId||(_r()?Vr(e,t):Date.now()-i>=8e3?t.transactionId&&(null===(a=La)||void 0===a?void 0:a.id)===t.transactionId&&(La.status="cancelled",La=null):Pa=setTimeout(n,250))};return gr(),Pa=setTimeout(n,250),!0}(r,o)?(Qr(r,o,s),!0):(Ha(),!1);var c=h.speak(r,o);if(Ua("speakText:engine-result",{engine:h.name,accepted:c,reason:o.reason,transactionId:o.transactionId}),c)return Qr(r,o,s),c;if(!o.element)return c;var m=lr(o.element,r,null!==(a=o.focusPath)&&void 0!==a?a:[]);return Ua("speakText:aria-label-fallback",{engine:h.name,accepted:m,reason:o.reason}),m&&Qr(r,o,s),m}function io(e){var t=e.component;return e.hasAttribute("data-nami-primary-cta")||!0===(null==t?void 0:t.focused)||"productButton"===(null==t?void 0:t.namiComponentType)}function no(e){var t,i=null===(t=e.getAttribute("role"))||void 0===t?void 0:t.toLowerCase();return"button"===e.tagName.toLowerCase()||"button"===i||e.matches("nami-button,nami-play-pause-button,nami-volume-button,nami-toggle-button")}function ao(e){return Va(e).replace(/(?:,\s*)?\bbutton\b\s*$/i,"").trim()||Va(e)}function ro(e){return Va(e.innerText||e.textContent||"")}function oo(e){if(!e)return"";if(ur(e)){var t=function(e){var t=Ra.get(e);return t?Va(t["aria-label"]||e.getAttribute("title")||""):""}(e);if(t)return t;var i=so(e.component);if(i)return i}var n=e.getAttribute("data-tts-spoken-label");if(n)return Va(n);var a=so(e.component);if(a)return a;var r=e.getAttribute("aria-label")||e.getAttribute("title");return r?Va(r):ro(e)}function so(e){var t=lo(e,fa);if(!t)return"";var i=t,n=Va(uo(i.speechLabel)||uo(i.speech_label)||uo(i.screenreaderText)||uo(i.title)||uo(i.alt)||uo(i.text)||(Array.isArray(i.texts)?i.texts.map(e=>uo(e)).join(", "):""));if(n)return n;for(var a,r=f(co(i));!(a=r()).done;){var o=so(a.value);if(o)return o}return""}function uo(e,t=fa){return t?qn(t,e):e}function lo(e,t){if(!e||e.hidden)return null;var i=e;if("condition"===i.component)return t&&Xn(t,i)?e:null;if(i.conditionAttributes&&t){var n=Yn(t,i);return n.hidden?null:n}return e}function ho(e,t){if(Ua("applySpeechAttributes:enter",{element:Ga(e),label:t,activeComposite:ur(e)}),!ur(e)){var i=Va(t),n=function(e,t){var i=Va(t);return i?no(e)?ao(i):i:""}(e,t);if(!n)return e.removeAttribute("data-tts-spoken-label"),void e.removeAttribute("aria-label");i?e.setAttribute("data-tts-spoken-label",i):e.removeAttribute("data-tts-spoken-label"),e.setAttribute("aria-label",function(e,t){return no(e)?ao(t):Va(t)}(e,n))}}function co(e){for(var t=[],i=0,n=["components","playingComponents","pausedComponents","mutedComponents","volumeComponents","productBaseComponents","productFeaturedComponents"];i<n.length;i++){var a=null==e?void 0:e[n[i]];Array.isArray(a)&&t.push(...a)}return null!=e&&e.collapseHeader&&(Array.isArray(e.collapseHeader)?t.push(...e.collapseHeader):t.push(e.collapseHeader)),t}function mo(e,t,i){var n=lo(e,fa);if(n&&!function(e){var t=lo(e,fa);if(!t)return!1;var i=t,n=String(i.component||i.namiComponentType||"").toLowerCase();return-1!==n.indexOf("button")||-1!==n.indexOf("toggle")||-1!==n.indexOf("checkbox")||-1!==n.indexOf("radio")||-1!==n.indexOf("select")||-1!==n.indexOf("input")||!!i.onTap||!!i.sku||!0===i.focused}(n)){var a=function(e){var t=lo(e,fa);if(!t)return"";var i=t;switch(t.component){case"text":case"countdownTimerText":return Xa(uo(i.screenreaderText)||uo(i.text));case"text-list":return Array.isArray(i.texts)?Xa(i.texts.map(e=>uo(e)).join(", ")):"";case"videoUrl":case"progressBar":return Va(uo(i.screenreaderText));default:return""}}(n);Ya(t,a),co(n).forEach(e=>mo(e,t))}}function fo(e,t){var i=[];if(!e)return i;var n=e;return[n.header,n.contentContainer,n.footer,n.backgroundContainer,n.components].forEach(e=>{Array.isArray(e)?e.forEach(e=>mo(e,i)):mo(e,i)}),i}function vo(e,t){var i=fo(e),n=function(e){if(!e)return"";var t=so(e.component),i=e.getAttribute("aria-label")||e.getAttribute("title")||ro(e),n=Va(t||i);return n?no(e)&&!/\bbutton\b\s*$/i.test(n)?Va(`${n} button`):n:""}(t);return Ja(qa(i,n?[n]:[]))}function po(e){return e?Ka(`${Va(e.id||e.name||"")}|${Ja(qa(fo(e),[]))}`):""}function go(){return ya}function yo(e,t=null){!function(){if(null===ja&&null===Ba){var e=navigator.userAgentData;"function"==typeof(null==e?void 0:e.getHighEntropyValues)?Ba=e.getHighEntropyValues(["platform","model"]).then(e=>{var t,i,n=(null!==(t=e.platform)&&void 0!==t?t:"").toLowerCase(),a=(null!==(i=e.model)&&void 0!==i?i:"").toLowerCase();ja=n.includes("xbox")||a.includes("xbox"),Ua("xbox client hints resolved",{platform:n,model:a,result:ja})}).catch(()=>{ja=!1}).finally(()=>{Ba=null}):ja=!1}}(),Ua("setActivePage:enter",{nextKey:po(e),previousKey:ga,activePageAnnounced:pa,pageName:Va((null==e?void 0:e.name)||(null==e?void 0:e.id)||"")});var i=ga;ma=e,fa=t,function(e){var t=po(e);if(t!==ga){var i=!ga&&!!Da;pa=!1,ga=t,ya=i,Da=null,xa=""}}(e),i!==ga&&Zr(void 0,!1)}function bo(e,t){if(Ua("prepareInitialComposite:enter",{element:Ga(e),activePageKey:ga,activePageAnnounced:pa,blockedByNavigation:go(),label:oo(e),isPrimary:io(e)}),!ma||pa||!io(e)||go())return Ua("prepareInitialComposite:skip",{hasActivePage:!!ma,activePageAnnounced:pa,isPrimary:io(e),blockedByNavigation:go()}),!1;var i=vo(ma,e);if(!i)return!1;var n=or(e,t),a=function(e,t,i){var n={id:Ia++,reason:e,element:i,text:t,page:ma,status:"pending"};return La=n,n}("composite",i,e);pa=!0,Da=e,xa=qr(e);var r,o=to(i,{reason:"composite",interrupt:!0,transactionId:a.id,element:e,focusPath:n,priority:"high"});o||(pa=!1,(null===(r=La)||void 0===r?void 0:r.id)===a.id&&(La.status="cancelled",La=null));return o}function wo(e,t){Ua("preparePrimaryCtaCompositeFocus:enter",{element:Ga(e),label:oo(e),activePageKey:ga,activePageAnnounced:pa});var i=bo(e,t);return Ua("preparePrimaryCtaCompositeFocus:result",{result:i,activePageKey:ga,activePageAnnounced:pa}),i}function ko(e){Ua("handleNativeFocusIn:enter",{target:e.target instanceof Element?Ga(e.target):String(e.target),activePageKey:ga,activePageAnnounced:pa});var t=function(e){for(var t,i=null,n=f("function"==typeof e.composedPath?e.composedPath():[]);!(t=n()).done;){var a=t.value;if(a instanceof Element&&oo(a)){if(a.tagName.toLowerCase().startsWith("nami-"))return a;i||(i=a)}}return null!=i?i:e.target instanceof Element?e.target:null}(e);t&&So(t,e)}function So(e,t){if(Ua("handleFocusedElementForSpeech:enter",{element:Ga(e),label:oo(e),ttsEnabled:oa,runtime:Rr(),activePageKey:ga,activePageAnnounced:pa,lastFocused:Ga(Da),lastFocusedElementIdentity:xa}),!e)return Ua("handleFocusedElementForSpeech:skip-basic",{hasElement:!!e,ttsEnabled:oa}),!1;if(!Fr())return!1;var i=qr(e);if($a&&$a.pageKey===ga&&Date.now()<$a.startedAt+2500){var n=$a.element===e,a=!!i&&$a.elementKey===i;if(!Xr()&&(n||a))return Ua("handleFocusedElementForSpeech:skip-during-initial-composite-lock",{element:Ga(e),sameCompositeElement:n,sameCompositeElementKey:a}),!1;var r=oo(e),o=r?Yr(r):"";if(!Xr()&&o&&$a.textKey.includes(o))return Ua("handleFocusedElementForSpeech:skip-composite-contained-label-during-initial-lock",{element:Ga(e),labelPreview:r.slice(0,120),transactionId:$a.transactionId}),Da=e,xa=i,!1}if(Da===e||i&&i===xa&&!pa)return Ua("handleFocusedElementForSpeech:skip-same-element",{element:Ga(e),activePageAnnounced:pa,elementIdentity:i,lastFocusedElementIdentity:xa}),!1;if(!pa&&ma&&io(e)&&!Da&&!go())return bo(e,t);var s=oo(e);if(!s)return!1;if($a){var u=Yr(s),l=$a.textKey;if(!Xr()&&(u===l||u.includes(l)))return Ua("handleFocusedElementForSpeech:skip-active-composite-label",{element:Ga(e),labelPreview:s.slice(0,120),transactionId:$a.transactionId}),Da=e,xa=i,!1}return Da=e,xa=i,wa&&clearTimeout(wa),wa=setTimeout(()=>{wa=null,Da===e&&to(s,{reason:"focus",interrupt:!0,element:e,focusPath:or(e,t),priority:"normal"})},120),!0}function Eo(e=document){var t;if(Ua("attachFocusSpeechListeners:enter",{root:e instanceof Element?Ga(e):e instanceof DocumentFragment?"document-fragment":"document",runtime:Rr()}),To(),!Fr())return Ua("focus speech listeners not attached: non-CTV runtime"),To;var i,n=e=>ko(e),a=()=>(Ua("handleUserNavigationKey",{activePageKey:ga,activePageAnnounced:pa}),Ca=Date.now(),void(ya=!0));e.addEventListener("focusin",n,!0),e.addEventListener("keydown",a,!0);var r=window;if("undefined"!=typeof window&&null!==(t=r.TVJS)&&void 0!==t&&t.DirectionalNavigation){var o=r.TVJS.DirectionalNavigation;i=o.onfocuschanged,o.onfocuschanged=e=>{var t;null===(t=i)||void 0===t||t.call(o,e),function(e){var t,i=null===(t=e.detail)||void 0===t?void 0:t.nextFocusElement;i&&So(i,e)}(e)}}return ba={root:e,focusListener:n,keyListener:a,previousTvjsHandler:i},To}function To(){var e;if(Ua("detachFocusSpeechListeners:enter",{hasCleanup:!!ba}),ba){var t=ba,i=t.root,n=t.focusListener,a=t.keyListener,r=t.previousTvjsHandler;i.removeEventListener("focusin",n,!0),a&&i.removeEventListener("keydown",a,!0);var o=window;null!==(e=o.TVJS)&&void 0!==e&&e.DirectionalNavigation&&r&&(o.TVJS.DirectionalNavigation.onfocuschanged=r),ba=null}}function Po(){var e;Ua("resetScreenreaderState:enter",{activePageKey:ga,activePageAnnounced:pa,activeTransaction:null===(e=La)||void 0===e?void 0:e.id,lastFocused:Ga(Da)}),To(),ca=null,ha=!1,ma=null,fa=null,va=null,pa=!1,ga="",ya=!1,Da=null,xa="",Ca=0,Na=null,fr(),mr(),vr(),pr(),gr(),wr(),wa&&(clearTimeout(wa),wa=null),cr("reset"),Qa(),La=null}var Mo=function(){return m(function t(i,n,a="",r=""){var o;u(this,t),this.playing=!1,this.toggling=!1,this.handleVideoEvents=t=>{this.video.onended=()=>{Wr(!1),this.handlePlayerAnalytics(t,e.NamiPaywallAction.VIDEO_ENDED)},this.video.onpause=()=>{Wr(!1),this.toggling||this.handlePlayerAnalytics(t,e.NamiPaywallAction.VIDEO_PAUSED)},this.video.onplay=()=>{Wr(!this.video.muted),this.toggling||this.handlePlayerAnalytics(t,this.video.currentTime>.05?e.NamiPaywallAction.VIDEO_RESUMED:e.NamiPaywallAction.VIDEO_STARTED)},this.video.onvolumechange=()=>{this.toggling||(this.muted=this.video.muted,Wr(!this.video.paused&&!this.video.ended&&!this.muted),this.handlePlayerAnalytics(t,this.muted?e.NamiPaywallAction.VIDEO_MUTED:e.NamiPaywallAction.VIDEO_UNMUTED))}},this.removeVideoEvents=()=>{this.video&&(Wr(!1),this.video.onended=null,this.video.onpause=null,this.video.onplay=null,this.video.onvolumechange=null,this.toggling=!1)},this.video=null!=n?n:this.video,null!==(o=t.instance)&&void 0!==o&&o.videoSrc&&n.src!=t.instance.videoSrc&&this.handlePlayerAnalytics(i,e.NamiPaywallAction.VIDEO_CHANGED),this.videoSrc=n.src,this.video&&(this.muteByDefault=n.muted,this.loopVideo=n.loop,this.autoplayVideo=n.autoplay,this.muted=this.video.muted,this.videoComponentName=a,this.videoComponentId=r,this.playing=!(!(this.video.currentTime>0)||this.video.paused||this.video.ended),Wr(this.playing&&!this.video.muted),this.handleVideoEvents(i))},[{key:"togglePlayVideo",value:function(e){this.toggling=!0,this.playing?this.video.pause():this.video.play(),this.playing=!this.playing,this.handlePlayerAnalytics(e)}},{key:"toggleMuteVideo",value:function(t){this.toggling=!0,this.video.muted=!this.video.muted,this.muted=this.video.muted,this.handlePlayerAnalytics(t,this.muted?e.NamiPaywallAction.VIDEO_MUTED:e.NamiPaywallAction.VIDEO_UNMUTED)}},{key:"videoPlayingAction",value:function(){var t,i;return(null===(t=this.video)||void 0===t?void 0:t.currentTime)<=0?e.NamiPaywallAction.VIDEO_STARTED:this.video.paused?e.NamiPaywallAction.VIDEO_PAUSED:this.video.ended?e.NamiPaywallAction.VIDEO_ENDED:(null===(i=this.video)||void 0===i?void 0:i.currentTime)>.05?e.NamiPaywallAction.VIDEO_RESUMED:e.NamiPaywallAction.UNKNOWN}},{key:"handlePlayerAnalytics",value:function(t,i){if(this.video){var n={id:this.videoComponentId,name:this.videoComponentName,url:this.video.src,loopVideo:this.loopVideo,muteByDefault:this.muteByDefault,autoplayVideo:this.autoplayVideo,contentDuration:this.video.duration/1e3,contentTimecode:this.video.currentTime/1e3};e.NamiEventEmitter.getInstance().emit(e.PAYWALL_ACTION_EVENT,{action:null!=i?i:this.videoPlayingAction(),videoMetaData:n,timeSpentOnPaywall:ta(t)})}}}])}();Mo.instance=null;var Ao=({onTap:t,sku:i,componentChange:n,contextProvider:a}={})=>{var r,o,s,u,l,d,h,c,m,f,p,g=e.NamiPaywallAction.UNKNOWN;switch(null==t?void 0:t.function){case ft:g=e.NamiPaywallAction.CLOSE_PAYWALL,p=ta(a),Do(),null===(r=Mo.instance)||void 0===r||r.handlePlayerAnalytics(a,e.NamiPaywallAction.VIDEO_ENDED);break;case pt:g=e.NamiPaywallAction.RESTORE_PURCHASES,xo();break;case yt:g=e.NamiPaywallAction.SIGN_IN,Co();break;case Dt:Io(null===(o=t.parameters)||void 0===o?void 0:o.url);break;case wt:i&&(g=e.NamiPaywallAction.BUY_SKU,i=Lo(a,t,i));break;case Ct:g=e.NamiPaywallAction.PAGE_CHANGE,n={name:null==t||null===(s=t.parameters)||void 0===s?void 0:s.screen},_o(a,null==t||null===(u=t.parameters)||void 0===u?void 0:u.screen);break;case St:g=e.NamiPaywallAction.TOGGLE_CHANGE,n=Ro(a,null==t||null===(l=t.parameters)||void 0===l?void 0:l.formId,null==t||null===(d=t.parameters)||void 0===d?void 0:d.value);break;case Tt:i&&(g=e.NamiPaywallAction.SELECT_SKU,Fo(a,i));break;case Mt:i&&(g=e.NamiPaywallAction.PURCHASE_SELECTED_SKU,Oo(a,i));break;case Lt:break;case Rt:null===(h=Mo.instance)||void 0===h||h.togglePlayVideo(a);break;case Ot:null===(c=Mo.instance)||void 0===c||c.togglePlayVideo(a);break;case $t:null===(m=Mo.instance)||void 0===m||m.toggleMuteVideo(a);break;case jt:null===(f=Mo.instance)||void 0===f||f.toggleMuteVideo(a)}g!==e.NamiPaywallAction.UNKNOWN&&e.NamiEventEmitter.getInstance().emit(e.PAYWALL_ACTION_EVENT,v({},a.getPaywallActionEventData(),{action:g,sku:i,timeSpentOnPaywall:p,componentChange:n,purchaseError:void 0,purchases:void 0}))},Do=()=>{eo(),e.storageService.clearLaunchId(),Wo(e.PaywallManagerEvents.Close)||"undefined"==typeof window||window.history.back()},xo=()=>{var t=e.hasCapability(e.Capabilities.THIRD_PARTY_TRANSACTIONS);Wo(e.PaywallManagerEvents.Restore)||t||e.logger.warn("NamiPaywallManager.registerRestoreHandler is not registered, so restore option on the paywall will use default behavior.")},Co=()=>{Wo(e.PaywallManagerEvents.SignIn)},Io=t=>{t?Wo(e.PaywallManagerEvents.DeeplinkAction,t)||"undefined"!=typeof window&&window.open(t,"_blank"):e.logger.debug("Paywall deep link action invoked, but no url present.")},Lo=(t,i,n)=>{var a,r=null===(a=i.parameters)||void 0===a?void 0:a.promo,o=n;if(r)e.logger.debug(`promo id is not null ${null==n?void 0:n.id}`),o.promoId=r.toString();else{e.logger.debug(`promo id is null for ${n.id}, product details: ${JSON.stringify(n.productDetails)}`);var s=n.productDetails;if(Bt(null==s?void 0:s.product_type)){var u=function(e){return e.offers.find(e=>"promo"===e.offer_type&&0===e.price)}(s);if(u&&u.offer_ref_id)e.logger.debug(`Found a free trial offer ${u.offer_ref_id}`),o.promoId=u.offer_ref_id.toString();else{var l,d=s.offers[0];if(d)e.logger.debug(`Found an offer ${d.offer_ref_id}`),o.promoId=null===(l=d.offer_ref_id)||void 0===l?void 0:l.toString()}}}return function(t,i){if(e.hasCapability(e.Capabilities.THIRD_PARTY_TRANSACTIONS)){if(e.storageService.setPurchaseImpression(),e.NamiEventEmitter.getInstance().listenerCount(e.PaywallManagerEvents.BuySku)<=0)return void e.logger.warn("In order for Nami to hand off the purchase so the transaction can be handled by, you must register a NamiBuySkuHandler callbackwith NamiPaywallManager.registerBuySkuHandler.");e.logger.info(`Handing off purchase for processing by developer skuId=${i.skuId} promoId=${i.promoId}`),Wo(e.PaywallManagerEvents.BuySku,i)}else{var n=e.namiBuySKU(i.skuId);if(n&&(e.logger.info(`Purchase flow completed, success=${n.success}, code=${n.billingResponseCode}, message=${n.message}`),n.success)){var a;e.NamiEventEmitter.getInstance().emit(e.PAYWALL_ACTION_EVENT,{action:e.NamiPaywallAction.CLOSE_PAYWALL,sku:i,timeSpentOnPaywall:ta(t)}),null===(a=Mo.instance)||void 0===a||a.handlePlayerAnalytics(t,e.NamiPaywallAction.VIDEO_ENDED);var r=t.getSelectedCampaign();r&&r.conversion_event_type==e.CampaignRuleConversionEventType.IN_APP&&r.conversion_event_url?(e.storageService.clearLaunchId(),window.location.href=r.conversion_event_url):Do()}}}(t,o),o},_o=(e,t)=>{var i;t&&((null===(i=window.history.state)||void 0===i?void 0:i.prevUrl)==t?window.history.back():e.setCurrentPage(t))},Ro=(e,t,i)=>{if(t)return e.setCurrentFormId(t,i),{formId:t,value:i};var n=e.getCurrentGroupId(),a=e.getCurrentGroupName();return e.setCurrentGroupData(n,a),{id:n,name:a}},Fo=(e,t)=>{var i=e.getCurrentGroupId(),n=e.selectedProducts();i&&t.id!=n[i]&&(n[i]=t.id,e.setSelectedProducts(n))},Oo=(e,t)=>{e.setPurchase(!0,t)};function Wo(t,...i){var n=e.NamiEventEmitter.getInstance();return n.emit(t,...i),n.listenerCount(t)>0}var $o,No,jo,Bo,zo,Uo,Ho,Go,Vo,Ko,Xo,Yo=e=>e,qo=e._internal.NamiFlowManager,Jo=250,Qo=function(){function n(t,i,a){var r;return u(this,n),(r=s(this,n)).pages=[],r.currentOffset=0,r.presentationStyle="fullscreen",r._sheetEntranceActive=!0,r.formFactor=e.getDeviceFormFactor(),r.timeSpentOnPaywall=0,r.animation={transition:"none",direction:"forward"},r._originalBodyStyles={},r._originalDocumentStyles={},r._savedScrollY=0,r._sheetDragStartY=0,r._sheetIsDragging=!1,r._dismissThreshold=100,r._boundHandleKeyDownEvent=e=>r.handleKeyDownEvent(e),r._stylesAlreadySaved=!1,r.type=t,r.value=i,r.context=a,r.setPaywallData(),r.presentationStyle=r.getPresentationStyle(r.paywall),r.applyPresentationHostClasses(),w(r,r)}return y(n,t.LitElement),m(n,[{key:"applyPresentationHostClasses",value:function(){this.classList.toggle("nami-half-sheet-mode",this.isOverlaySheet),this.classList.toggle("nami-modal-mode",this.isModal),this.classList.toggle("nami-modal-phone",this.isModal&&"phone"===this.formFactor),this.classList.toggle("nami-modal-wide",this.isModal&&"phone"!==this.formFactor)}},{key:"setPaywallData",value:function(){var t=e.getPaywallDataFromLabel(this.value,this.type);this.paywall=t.paywall,this.campaign=t.campaign}},{key:"getPresentationStyle",value:function(t){var i,n,a,r=null!==(i=null==t||null===(n=t.template)||void 0===n||null===(n=n.initialState)||void 0===n?void 0:n.presentationStyle)&&void 0!==i?i:null==t||null===(a=t.template)||void 0===a||null===(a=a.initialState)||void 0===a?void 0:a.presentation_style;return e.getEffectiveWebStyle(r)}},{key:"isHalfSheet",get:function(){return"compact_sheet"===this.presentationStyle}},{key:"isSheet",get:function(){return"sheet"===this.presentationStyle}},{key:"isOverlaySheet",get:function(){return this.isHalfSheet||this.isSheet}},{key:"isModal",get:function(){return"modal"===this.presentationStyle}},{key:"isOverlay",get:function(){return this.isOverlaySheet||this.isModal}},{key:"connectedCallback",value:function(){var e;M(n,"connectedCallback",this)([]),null!==(e=window.TVJS)&&void 0!==e&&e.DirectionalNavigation&&(window.TVJS.DirectionalNavigation.focusRoot=this),this._detachFocusSpeechListeners=Eo(this),document.addEventListener("keydown",this._boundHandleKeyDownEvent),this._swipeHandler=ht(this,this.handleSwipeEvent.bind(this),{axisHint:"y",lockAxis:!0,minDistance:25,edgeLeakThreshold:15,preventScrollOnSwipe:!1,pointerTypes:["touch"]}),this.setOriginalStyles()}},{key:"disconnectedCallback",value:function(){var t,i,a;M(n,"disconnectedCallback",this)([]),eo(),null===(t=this._detachFocusSpeechListeners)||void 0===t||t.call(this),this._detachFocusSpeechListeners=void 0,Po(),e.storageService.clearLaunchId(),null!==(i=window.TVJS)&&void 0!==i&&i.DirectionalNavigation&&(window.TVJS.DirectionalNavigation.focusRoot=document.body),document.removeEventListener("keydown",this._boundHandleKeyDownEvent),e.NamiEventEmitter.getInstance().removeAllListeners(e.PAYWALL_ACTION_EVENT),this.restoreStyles(),null===(a=this._halfSheetAbortController)||void 0===a||a.abort(),this._swipeHandler.destroy()}},{key:"setOriginalStyles",value:function(){this._stylesAlreadySaved||(this._stylesAlreadySaved=!0,this._originalBodyStyles.background=document.body.style.background,this._originalBodyStyles.overflow=document.body.style.overflow||null,this._originalBodyStyles.position=document.body.style.position||null,this._originalBodyStyles.top=document.body.style.top||null,this._originalBodyStyles.width=document.body.style.width||null,"phone"===this.formFactor&&(this._originalBodyStyles["overscroll-behavior"]=document.body.style.overscrollBehavior||null,this._originalDocumentStyles["overscroll-behavior"]=document.documentElement.style.overscrollBehavior||null)),"television"===this.formFactor&&(document.body.style.overflow="hidden"),"phone"===this.formFactor&&(document.body.style.overscrollBehavior="none",document.documentElement.style.overscrollBehavior="none",this.isOverlay||(document.body.style.overflow="hidden")),this.isOverlay&&(this._savedScrollY=window.scrollY,document.body.style.position="fixed",document.body.style.top=`-${this._savedScrollY}px`,document.body.style.width="100%",document.body.style.overflow="hidden")}},{key:"restoreStyles",value:function(){Object.entries(this._originalBodyStyles).forEach(([e,t])=>{null!==t?document.body.style.setProperty(e,t):document.body.style.removeProperty(e)}),Object.entries(this._originalDocumentStyles).forEach(([e,t])=>{null!==t?document.documentElement.style.setProperty(e,t):document.documentElement.style.removeProperty(e)}),this._savedScrollY>0&&(window.scrollTo(0,this._savedScrollY),this._savedScrollY=0)}},{key:"handleKeyDownEvent",value:function(t){(10009===t.keyCode||27===t.keyCode||166===t.keyCode||196===t.keyCode||"Backspace"===t.key||"GoBack"===t.key||"BrowserBack"===t.key||"XF86Back"===t.key)&&(t.preventDefault(),eo(),this.flow?this.flow.triggerActions(e.NamiReservedActions.REMOTE_BACK):this.isModal&&this.animateSheetDismiss().then(()=>Do()))}},{key:"handleBackdropClick",value:function(e){var t;(e.stopPropagation(),this.flow)?null!==(t=this.flow.currentStepHasHoistedPrimaryActions("__swipe_down__"))&&void 0!==t&&t?this.flow.triggerActions("__swipe_down__"):this.animateSheetDismiss().then(()=>{var e;null===(e=this.flow)||void 0===e||e.finished(),Do()}):this.animateSheetDismiss().then(()=>Do())}},{key:"animateSheetDismiss",value:function(){var e,t,i,n,a;return S(function(r){for(;;)switch(r.n){case 0:return i=this.shadowRoot,n=null!==(e=null==i?void 0:i.querySelector(".nami-half-sheet-container"))&&void 0!==e?e:null==i?void 0:i.querySelector(".nami-modal-container"),a=null!==(t=null==i?void 0:i.querySelector(".nami-half-sheet-backdrop"))&&void 0!==t?t:null==i?void 0:i.querySelector(".nami-modal-backdrop"),n&&n.classList.add("nami-dismissing"),a&&a.classList.add("nami-dismissing"),r.n=1,o(new Promise(e=>setTimeout(e,200)));case 1:return r.a(2)}},null,this,null,Promise)}},{key:"handleSwipeEvent",value:function({direction:e}){var t;if("down"===e)null===(t=this.flow)||void 0===t||t.triggerActions("__swipe_down__");else if("up"===e){var i;null===(i=this.flow)||void 0===i||i.triggerActions("__swipe_up__")}}},{key:"setupHalfSheetDragTracking",value:function(){var e,t,i;null===(e=this._halfSheetAbortController)||void 0===e||e.abort(),this._halfSheetAbortController=new AbortController;var n=this._halfSheetAbortController.signal,a=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".nami-half-sheet-container"),r=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelector(".nami-half-sheet-content");if(a&&r){a.addEventListener("touchstart",e=>{r.scrollTop>0||(this._sheetDragStartY=e.touches[0].clientY,this._sheetIsDragging=!0)},{passive:!0,signal:n}),a.addEventListener("touchmove",e=>{if(this._sheetIsDragging){var t=e.touches[0].clientY-this._sheetDragStartY;t>0&&(a.style.transform=`translateY(${t}px)`,a.style.transition="none",e.preventDefault())}},{passive:!1,signal:n}),a.addEventListener("touchend",()=>{if(this._sheetIsDragging){this._sheetIsDragging=!1;var e,t,i=a.style.transform.match(/translateY\((\d+(?:\.\d+)?)px\)/);if((i?parseFloat(i[1]):0)>this._dismissThreshold)if(null!==(e=null===(t=this.flow)||void 0===t?void 0:t.currentStepHasHoistedPrimaryActions("__swipe_down__"))&&void 0!==e&&e){var n;a.style.transform="translateY(0)",a.style.transition="transform 0.2s ease-out",null===(n=this.flow)||void 0===n||n.triggerActions("__swipe_down__")}else{var r;a.style.transform="translateY(100%)",a.style.transition="transform 0.2s ease-in";var o=null===(r=this.shadowRoot)||void 0===r?void 0:r.querySelector(".nami-half-sheet-backdrop");o&&o.classList.add("nami-dismissing"),setTimeout(()=>{var e;null===(e=this.flow)||void 0===e||e.finished()},200)}else a.style.transform="translateY(0)",a.style.transition="transform 0.2s ease-out"}},{signal:n})}}},{key:"setupHalfSheetFocusTrap",value:function(){var e,t,i,n,a=null!==(e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".nami-half-sheet-container"))&&void 0!==e?e:null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelector(".nami-modal-container");if(a){a.focus();var r=null===(n=this._halfSheetAbortController)||void 0===n?void 0:n.signal;a.addEventListener("keydown",e=>{if("Tab"===e.key){var t=a.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(0!==t.length){var i,n,r=t[0],o=t[t.length-1];if(e.shiftKey)document.activeElement!==r&&(null===(i=this.shadowRoot)||void 0===i?void 0:i.activeElement)!==r||(e.preventDefault(),o.focus());else document.activeElement!==o&&(null===(n=this.shadowRoot)||void 0===n?void 0:n.activeElement)!==o||(e.preventDefault(),r.focus())}}},r?{signal:r}:void 0)}}},{key:"firstUpdated",value:function(){var t;this.timeSpentOnPaywall=Date.now(),null===(t=this._detachFocusSpeechListeners)||void 0===t||t.call(this),this._detachFocusSpeechListeners=Eo(this.renderRoot),e.isNamiFlowCampaign(this.campaign)&&(this.flow=qo.instance.presentFlow(this.campaign,this,this.context)),this.isOverlay&&this.updateComplete.then(()=>{this.isOverlaySheet&&this.setupHalfSheetDragTracking(),this.setupHalfSheetFocusTrap()})}},{key:"updated",value:function(e){if(M(n,"updated",this)([e]),e.has("presentationStyle")){var t=e.get("presentationStyle");("compact_sheet"===t||"sheet"===t||"modal"===t)!==this.isOverlay&&(this.restoreStyles(),this._stylesAlreadySaved=!1,this.setOriginalStyles()),this.isOverlay&&(this.isOverlaySheet&&this.setupHalfSheetDragTracking(),this.setupHalfSheetFocusTrap())}}},{key:"getAnimationStyles",value:function(e){var t="backward"===this.animation.direction?-1:1;switch(this.animation.transition){case"verticalSlide":return`transform: translateY(${100*(e-this.currentOffset)*t}vh);`;case"slide":return`transform: translateX(${100*(e-this.currentOffset)*t}vw);`;case"fade":return`opacity: ${e===this.currentOffset?1:0};`;default:return""}}},{key:"updatePages",value:function(e){var t,i,n;return S(function(a){for(;;)switch(a.n){case 0:if(0!==this.pages.length&&"none"!==this.animation.transition){a.n=1;break}return this.pages=[e],a.a(2);case 1:if((null==(t=this.pages[this.pages.length-1])?void 0:t.id)!==e.id){a.n=2;break}return a.a(2);case 2:return i=null,this.isOverlaySheet&&(i=null===(n=this.shadowRoot)||void 0===n?void 0:n.querySelector(".nami-half-sheet-content"))&&(i.style.height=`${i.clientHeight}px`),this.pages=[t,e],this.currentOffset=0,a.n=3,o(this.updateComplete);case 3:requestAnimationFrame(()=>{this.currentOffset=1,setTimeout(()=>{this.pages=[e],this.currentOffset=0,this.paywall=e,i&&(i.style.height="")},Jo)});case 4:return a.a(2)}},null,this,null,Promise)}},{key:"animateFullscreenEntry",value:function(){return S(function(e){for(;;)switch(e.n){case 0:return e.n=1,o(new Promise(e=>requestAnimationFrame(()=>e())));case 1:return this.classList.remove("nami-fullscreen-entering"),this.classList.add("nami-fullscreen-entering-active"),e.n=2,o(new Promise(e=>setTimeout(e,Jo)));case 2:this.classList.remove("nami-fullscreen-entering-active");case 3:return e.a(2)}},null,this,null,Promise)}},{key:"_captureExitOverlay",value:function(e){var t=this.shadowRoot;if(!t)return null;var i=t.querySelector(".nami-flow-container"),n=document.createElement("div");if(n.className="nami-fullscreen-exit-overlay",n.style.cssText=`\n position: fixed; inset: 0; z-index: 10000;\n pointer-events: none;\n background: ${e};\n overflow: hidden;\n `,i){var a=i.cloneNode(!0);a.style.transform="none",a.style.transition="none",n.appendChild(a)}return t.appendChild(n),n.offsetHeight,n}},{key:"_slideExitOverlayAway",value:function(e){var t;return S(function(i){for(;;)switch(i.n){case 0:if(e){i.n=1;break}return i.a(2);case 1:return t="undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,e.style.transition=t?"none":"transform 250ms ease-in",e.style.transform="translateY(100%)",i.n=2,o(new Promise(e=>setTimeout(e,t?0:Jo)));case 2:e.remove();case 3:return i.a(2)}},null,null,null,Promise)}},{key:"flowNavigateToScreen",value:function(t,i){var n,a,r,s,u,l,d,h,c,m,f;return S(function(v){for(;;)switch(v.n){case 0:if(null!==(n=this.flow)&&void 0!==n&&n.previousFlowStep&&this.flow.executeLifecycle(this.flow.previousFlowStep,e.NamiReservedActions.DISAPPEAR),r=this.presentationStyle,s=this.getPresentationStyle(t),u=0===this.pages.length,l="backward"===i.direction,"compact_sheet"!==r&&"sheet"!==r||"fullscreen"!==s){v.n=3;break}return this.classList.add("nami-fullscreen-entering"),this.presentationStyle="fullscreen",this.applyPresentationHostClasses(),v.n=1,o(this.updateComplete);case 1:return v.n=2,o(this.animateFullscreenEntry());case 2:v.n=11;break;case 3:if("fullscreen"!==r||"compact_sheet"!==s&&"sheet"!==s){v.n=10;break}if(!u&&!l){v.n=8;break}if(!l){v.n=6;break}return d=document.body.style.background||getComputedStyle(this).backgroundColor||"#000",this._sheetEntranceActive=!1,h=this._captureExitOverlay(d),this.presentationStyle=s,this.applyPresentationHostClasses(),this.pages=[t],this.paywall=t,v.n=4,o(this.updateComplete);case 4:return v.n=5,o(this._slideExitOverlayAway(h));case 5:v.n=7;break;case 6:this.presentationStyle=s,this.applyPresentationHostClasses();case 7:v.n=9;break;case 8:console.warn(`Unsupported forward transition: fullscreen → ${s}. Presenting as fullscreen.`);case 9:v.n=11;break;case 10:this.presentationStyle=s,this.applyPresentationHostClasses();case 11:return c=("compact_sheet"===r||"sheet"===r)&&"fullscreen"===s,m="fullscreen"===r&&("compact_sheet"===s||"sheet"===s),f=!("compact_sheet"!==r&&"sheet"!==r||"compact_sheet"!==s&&"sheet"!==s||r===s)||c||m,this.animation=f?{transition:"fade",direction:i.direction}:i,v.n=12,o(this.updatePages(t));case 12:null!==(a=this.flow)&&void 0!==a&&a.currentFlowStep&&this.flow.executeLifecycle(this.flow.currentFlowStep,e.NamiReservedActions.APPEAR);case 13:return v.a(2)}},null,this,null,Promise)}},{key:"getSelectedSlideIndexForCurrentCarousel",value:function(){return ut.getSelectedSlideIndex()}},{key:"renderFlow",value:function(){return"undefined"==typeof document?t.html($o||($o=Yo``)):this.isOverlaySheet?this.renderHalfSheet():this.isModal?this.renderModal(this.renderFlowContainer()):this.renderFlowContainer()}},{key:"renderFlowContainer",value:function(){return t.html(No||(No=Yo`
255
255
  <div class="nami-flow-container">
256
256
  ${0}
257
257
  </div>