@revenuecat/purchases-js 0.12.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,24 +1,95 @@
1
- (function(E,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(E=typeof globalThis<"u"?globalThis:E||self,h(E.Purchases={}))})(this,function(E){"use strict";var Al=Object.create;var ht=Object.defineProperty;var Ol=Object.getOwnPropertyDescriptor;var On=(E,h)=>(h=Symbol[E])?h:Symbol.for("Symbol."+E),Fe=E=>{throw TypeError(E)};var Nn=(E,h,B)=>h in E?ht(E,h,{enumerable:!0,configurable:!0,writable:!0,value:B}):E[h]=B;var Pn=(E,h)=>ht(E,"name",{value:h,configurable:!0});var Un=E=>[,,,Al((E==null?void 0:E[On("metadata")])??null)],Rn=["class","method","getter","setter","accessor","field","value","get","set"],Ce=E=>E!==void 0&&typeof E!="function"?Fe("Function expected"):E,Nl=(E,h,B,oe,G)=>({kind:Rn[E],name:h,metadata:oe,addInitializer:Y=>B._?Fe("Already initialized"):G.push(Ce(Y||null))}),bt=(E,h)=>Nn(h,On("metadata"),E[3]),Ln=(E,h,B,oe)=>{for(var G=0,Y=E[h>>1],ne=Y&&Y.length;G<ne;G++)h&1?Y[G].call(B):oe=Y[G].call(B,oe);return oe},Sn=(E,h,B,oe,G,Y)=>{var ne,A,pe,ce,ge,j=h&7,ke=!!(h&8),H=!!(h&16),he=j>3?E.length+1:j?ke?1:2:0,z=Rn[j+5],W=j>3&&(E[he-1]=[]),K=E[he]||(E[he]=[]),re=j&&(!H&&!ke&&(G=G.prototype),j<5&&(j>3||!H)&&Ol(j<4?G:{get[B](){return Tn(this,Y)},set[B](R){return An(this,Y,R)}},B));j?H&&j<4&&Pn(Y,(j>2?"set ":j>1?"get ":"")+B):Pn(G,B);for(var L=oe.length-1;L>=0;L--)ce=Nl(j,B,pe={},E[3],K),j&&(ce.static=ke,ce.private=H,ge=ce.access={has:H?R=>Ul(G,R):R=>B in R},j^3&&(ge.get=H?R=>(j^1?Tn:Rl)(R,G,j^4?Y:re.get):R=>R[B]),j>2&&(ge.set=H?(R,Pe)=>An(R,G,Pe,j^4?Y:re.set):(R,Pe)=>R[B]=Pe)),A=(0,oe[L])(j?j<4?H?Y:re[z]:j>4?void 0:{get:re.get,set:re.set}:G,ce),pe._=1,j^4||A===void 0?Ce(A)&&(j>4?W.unshift(A):j?H?Y=A:re[z]=A:G=A):typeof A!="object"||A===null?Fe("Object expected"):(Ce(ne=A.get)&&(re.get=ne),Ce(ne=A.set)&&(re.set=ne),Ce(ne=A.init)&&W.unshift(ne));return j||bt(E,G),re&&ht(G,B,re),H?j^4?Y:re:G},M=(E,h,B)=>Nn(E,typeof h!="symbol"?h+"":h,B),wt=(E,h,B)=>h.has(E)||Fe("Cannot "+B),Ul=(E,h)=>Object(h)!==h?Fe('Cannot use the "in" operator on this value'):E.has(h),Tn=(E,h,B)=>(wt(E,h,"read from private field"),B?B.call(E):h.get(E));var An=(E,h,B,oe)=>(wt(E,h,"write to private field"),oe?oe.call(E,B):h.set(E,B),B),Rl=(E,h,B)=>(wt(E,h,"access private method"),B);var $n,_t;function h(){}function B(t,e){for(const n in e)t[n]=e[n];return t}function oe(t){return t()}function G(){return Object.create(null)}function Y(t){t.forEach(oe)}function ne(t){return typeof t=="function"}function A(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let pe;function ce(t,e){return t===e?!0:(pe||(pe=document.createElement("a")),pe.href=e,t===pe.href)}function ge(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function j(t,e){const n=ge(t.srcset),r=ge(e||"");return r.length===n.length&&r.every(([i,o],s)=>o===n[s][1]&&(ce(n[s][0],i)||ce(i,n[s][0])))}function ke(t){return Object.keys(t).length===0}function H(t,e,n,r){if(t){const i=he(t,e,n,r);return t[0](i)}}function he(t,e,n,r){return t[1]&&r?B(n.ctx.slice(),t[1](r(e))):n.ctx}function z(t,e,n,r){if(t[2]&&r){const i=t[2](r(n));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],s=Math.max(e.dirty.length,i.length);for(let l=0;l<s;l+=1)o[l]=e.dirty[l]|i[l];return o}return e.dirty|i}return e.dirty}function W(t,e,n,r,i,o){if(i){const s=he(e,n,r,o);t.p(s,i)}}function K(t){if(t.ctx.length>32){const e=[],n=t.ctx.length/32;for(let r=0;r<n;r++)e[r]=-1;return e}return-1}function re(t){return t??""}function L(t,e){t.appendChild(e)}function R(t,e,n){const r=Pe(t);if(!r.getElementById(e)){const i=I("style");i.id=e,i.textContent=n,Mn(r,i)}}function Pe(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function Mn(t,e){return L(t.head||t,e),e.sheet}function g(t,e,n){t.insertBefore(e,n||null)}function _(t){t.parentNode&&t.parentNode.removeChild(t)}function I(t){return document.createElement(t)}function V(t){return document.createTextNode(t)}function S(){return V(" ")}function ae(){return V("")}function Te(t,e,n,r){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)}function yt(t){return function(e){return e.preventDefault(),t.call(this,e)}}function b(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}const Dn=["width","height"];function Bn(t,e){const n=Object.getOwnPropertyDescriptors(t.__proto__);for(const r in e)e[r]==null?t.removeAttribute(r):r==="style"?t.style.cssText=e[r]:r==="__value"?t.value=t[r]=e[r]:n[r]&&n[r].set&&Dn.indexOf(r)===-1?t[r]=e[r]:b(t,r,e[r])}function Cn(t,e){Object.keys(e).forEach(n=>{Fn(t,n,e[n])})}function Fn(t,e,n){const r=e.toLowerCase();r in t?t[r]=typeof t[r]=="boolean"&&n===""?!0:n:e in t?t[e]=typeof t[e]=="boolean"&&n===""?!0:n:b(t,e,n)}function jn(t){return/-/.test(t)?Cn:Bn}function Hn(t){return Array.from(t.childNodes)}function ue(t,e){e=""+e,t.data!==e&&(t.data=e)}function Et(t,e){t.value=e??""}function fe(t,e,n,r){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,"")}function qn(t,e,{bubbles:n=!1,cancelable:r=!1}={}){return new CustomEvent(t,{detail:e,bubbles:n,cancelable:r})}let Ae;function Oe(t){Ae=t}function Ne(){if(!Ae)throw new Error("Function called outside component initialization");return Ae}function xn(t){Ne().$$.before_update.push(t)}function je(t){Ne().$$.on_mount.push(t)}function Gn(){const t=Ne();return(e,n,{cancelable:r=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=qn(e,n,{cancelable:r});return i.slice().forEach(s=>{s.call(t,o)}),!o.defaultPrevented}return!0}}function Vn(t,e){return Ne().$$.context.set(t,e),e}function Yn(t){return Ne().$$.context.get(t)}function It(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}const be=[],He=[];let we=[];const Xe=[],zn=Promise.resolve();let Ze=!1;function Wn(){Ze||(Ze=!0,zn.then(vt))}function Je(t){we.push(t)}function Kn(t){Xe.push(t)}const et=new Set;let ye=0;function vt(){if(ye!==0)return;const t=Ae;do{try{for(;ye<be.length;){const e=be[ye];ye++,Oe(e),Qn(e.$$)}}catch(e){throw be.length=0,ye=0,e}for(Oe(null),be.length=0,ye=0;He.length;)He.pop()();for(let e=0;e<we.length;e+=1){const n=we[e];et.has(n)||(et.add(n),n())}we.length=0}while(be.length);for(;Xe.length;)Xe.pop()();Ze=!1,et.clear(),Oe(t)}function Qn(t){if(t.fragment!==null){t.update(),Y(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(Je)}}function Xn(t){const e=[],n=[];we.forEach(r=>t.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),we=e}const qe=new Set;let me;function X(){me={r:0,c:[],p:me}}function Z(){me.r||Y(me.c),me=me.p}function d(t,e){t&&t.i&&(qe.delete(t),t.i(e))}function p(t,e,n,r){if(t&&t.o){if(qe.has(t))return;qe.add(t),me.c.push(()=>{qe.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}function Zn(t,e,n){const r=t.$$.props[e];r!==void 0&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}function T(t){t&&t.c()}function k(t,e,n){const{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),Je(()=>{const o=t.$$.on_mount.map(oe).filter(ne);t.$$.on_destroy?t.$$.on_destroy.push(...o):Y(o),t.$$.on_mount=[]}),i.forEach(Je)}function P(t,e){const n=t.$$;n.fragment!==null&&(Xn(n.after_update),Y(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function Jn(t,e){t.$$.dirty[0]===-1&&(be.push(t),Wn(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function C(t,e,n,r,i,o,s=null,l=[-1]){const a=Ae;Oe(t);const c=t.$$={fragment:null,ctx:[],props:o,update:h,not_equal:i,bound:G(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:G(),dirty:l,skip_bound:!1,root:e.target||a.$$.root};s&&s(c.root);let u=!1;if(c.ctx=n?n(t,e.props||{},(f,m,...w)=>{const v=w.length?w[0]:m;return c.ctx&&i(c.ctx[f],c.ctx[f]=v)&&(!c.skip_bound&&c.bound[f]&&c.bound[f](v),u&&Jn(t,f)),m}):[],c.update(),u=!0,Y(c.before_update),c.fragment=r?r(c.ctx):!1,e.target){if(e.hydrate){const f=Hn(e.target);c.fragment&&c.fragment.l(f),f.forEach(_)}else c.fragment&&c.fragment.c();e.intro&&d(t.$$.fragment),k(t,e.target,e.anchor),vt()}Oe(a)}class F{constructor(){M(this,"$$");M(this,"$$set")}$destroy(){P(this,1),this.$destroy=h}$on(e,n){if(!ne(n))return h;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!ke(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const er="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(er);function tr(t){R(t,"svelte-1bzqb13",".rcb-modal-section.svelte-1bzqb13{padding:8px 0px;display:flex}section.rcb-modal-section.svelte-1bzqb13{flex-grow:1}.rcb-modal-section.svelte-1bzqb13:last-of-type{padding:0}")}function tt(t){let e,n;const r=t[2].default,i=H(r,t,t[1],null);return{c(){e=I(t[0]),i&&i.c(),jn(t[0])(e,{class:re("rcb-modal-section")+" svelte-1bzqb13"})},m(o,s){g(o,e,s),i&&i.m(e,null),n=!0},p(o,s){i&&i.p&&(!n||s&2)&&W(i,r,o,o[1],n?z(r,o[1],s,null):K(o[1]),null)},i(o){n||(d(i,o),n=!0)},o(o){p(i,o),n=!1},d(o){o&&_(e),i&&i.d(o)}}}function nr(t){let e=t[0],n,r,i=t[0]&&tt(t);return{c(){i&&i.c(),n=ae()},m(o,s){i&&i.m(o,s),g(o,n,s),r=!0},p(o,[s]){o[0]?e?A(e,o[0])?(i.d(1),i=tt(o),e=o[0],i.c(),i.m(n.parentNode,n)):i.p(o,s):(i=tt(o),e=o[0],i.c(),i.m(n.parentNode,n)):e&&(i.d(1),i=null,e=o[0])},i(o){r||(d(i,o),r=!0)},o(o){p(i,o),r=!1},d(o){o&&_(n),i&&i.d(o)}}}function rr(t,e,n){let{$$slots:r={},$$scope:i}=e,{as:o="section"}=e;return t.$$set=s=>{"as"in s&&n(0,o=s.as),"$$scope"in s&&n(1,i=s.$$scope)},[o,i,r]}class Ee extends F{constructor(e){super(),C(this,e,rr,nr,A,{as:0},tr)}}var se=(t=>(t[t.Silent=0]="Silent",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug",t[t.Verbose=5]="Verbose",t))(se||{});class q{static setLogLevel(e){this.logLevel=e}static log(e,n=this.logLevel){const r=`[Purchases] ${e}`;if(!(this.logLevel<n||n===se.Silent))switch(n){case se.Error:console.error(r);break;case se.Warn:console.warn(r);break;case se.Info:console.info(r);break;case se.Debug:console.debug(r);break;case se.Verbose:console.debug(r);break}}static errorLog(e){this.log(e,se.Error)}static warnLog(e){this.log(e,se.Warn)}static infoLog(e){this.log(e,se.Info)}static debugLog(e){this.log(e,se.Debug)}static verboseLog(e){this.log(e,se.Verbose)}}M(q,"logLevel",se.Silent);var de=(t=>(t.Year="year",t.Month="month",t.Week="week",t.Day="day",t))(de||{});function nt(t){const e=t.match(/^PT?([0-9]+)([MDYW])$/);if(!e||e.length<3)return q.errorLog(`Invalid ISO 8601 duration format: ${t}`),null;const n=parseInt(e[1]);switch(e[2]){case"Y":return{number:n,unit:"year"};case"M":return{number:n,unit:"month"};case"W":return{number:n,unit:"week"};case"D":return{number:n,unit:"day"};default:return q.errorLog(`Invalid ISO 8601 unit duration format: ${t}`),null}}const ir=(t,e,n)=>{const r=t/1e6;return new Intl.NumberFormat(n,{style:"currency",currency:e}).format(r)},or=t=>{const e=t.number;if(e===1)switch(t.unit){case de.Year:return"yearly";case de.Month:return"monthly";case de.Week:return"weekly";case de.Day:return"daily"}else return`every ${e} ${t.unit}s`},sr=t=>{const e=t.number;if(e===1)switch(t.unit){case de.Year:return"1 year";case de.Month:return"1 month";case de.Week:return"1 week";case de.Day:return"1 day"}else return`${e} ${t.unit}s`},$t=t=>{const e=nt(t);return e?or(e):"unknown"},lr=t=>{const e=nt(t);return e?sr(e):"unknown"};function ar(t){return t!=null}var kt=(t=>(t.Unknown="unknown",t.Custom="custom",t.Lifetime="$rc_lifetime",t.Annual="$rc_annual",t.SixMonth="$rc_six_month",t.ThreeMonth="$rc_three_month",t.TwoMonth="$rc_two_month",t.Monthly="$rc_monthly",t.Weekly="$rc_weekly",t))(kt||{}),Ie=(t=>(t.Subscription="subscription",t.Consumable="consumable",t.NonConsumable="non_consumable",t))(Ie||{});const Pt=t=>({amount:t.amount_micros/1e4,amountMicros:t.amount_micros,currency:t.currency,formattedPrice:ir(t.amount_micros,t.currency)}),Tt=t=>{const e=t.period_duration;return{periodDuration:e,period:e?nt(e):null,cycleCount:t.cycle_count,price:t.price?Pt(t.price):null}},cr=t=>t.base==null?(q.debugLog("Missing base phase for subscription option. Ignoring."),null):{id:t.id,priceId:t.price_id,base:Tt(t.base),trial:t.trial?Tt(t.trial):null},ur=t=>t.base_price==null?(q.debugLog("Missing base price for non-subscription option. Ignoring."),null):{id:t.id,priceId:t.price_id,basePrice:Pt(t.base_price)},fr=(t,e)=>{const n=t.product_type;return n==="subscription"?pr(t,e,n):dr(t,e,n)},dr=(t,e,n)=>{const r={};if(Object.entries(t.purchase_options).forEach(([s,l])=>{const a=ur(l);a!=null&&(r[s]=a)}),Object.keys(r).length===0)return q.debugLog(`Product ${t.identifier} has no purchase options. Ignoring.`),null;const i=t.default_purchase_option_id,o=i&&i in t.purchase_options?r[i]:null;return o==null?(q.debugLog(`Product ${t.identifier} has no default purchase option. Ignoring.`),null):{identifier:t.identifier,displayName:t.title,title:t.title,description:t.description,productType:n,currentPrice:o.basePrice,normalPeriodDuration:null,presentedOfferingIdentifier:e.offeringIdentifier,presentedOfferingContext:e,defaultPurchaseOption:o,defaultSubscriptionOption:null,subscriptionOptions:{},defaultNonSubscriptionOption:o}},pr=(t,e,n)=>{const r={};if(Object.entries(t.purchase_options).forEach(([l,a])=>{const c=cr(a);c!=null&&(r[l]=c)}),Object.keys(r).length===0)return q.debugLog(`Product ${t.identifier} has no subscription options. Ignoring.`),null;const i=t.default_purchase_option_id,o=i&&i in r?r[i]:null;if(o==null)return q.debugLog(`Product ${t.identifier} has no default subscription option. Ignoring.`),null;const s=o.base.price;return s==null?(q.debugLog(`Product ${t.identifier} default option has no base price. Ignoring.`),null):{identifier:t.identifier,displayName:t.title,title:t.title,description:t.description,productType:n,currentPrice:s,normalPeriodDuration:o.base.periodDuration,presentedOfferingIdentifier:e.offeringIdentifier,presentedOfferingContext:e,defaultPurchaseOption:o,defaultSubscriptionOption:o,subscriptionOptions:r,defaultNonSubscriptionOption:null}},mr=(t,e,n)=>{const r=n[e.platform_product_identifier];if(r===void 0)return null;const i=fr(r,t);return i===null?null:{identifier:e.identifier,rcBillingProduct:i,packageType:gr(e.identifier)}},_r=(t,e,n,r)=>{const i={offeringIdentifier:e.identifier,targetingContext:t&&r?{ruleId:r.rule_id,revision:r.revision}:null,placementIdentifier:null},o=e.packages.map(l=>mr(i,l,n)).filter(ar),s={};for(const l of o)l!=null&&(s[l.identifier]=l);return o.length==0?null:{identifier:e.identifier,serverDescription:e.description,metadata:e.metadata,packagesById:s,availablePackages:o,lifetime:s.$rc_lifetime??null,annual:s.$rc_annual??null,sixMonth:s.$rc_six_month??null,threeMonth:s.$rc_three_month??null,twoMonth:s.$rc_two_month??null,monthly:s.$rc_monthly??null,weekly:s.$rc_weekly??null}};function gr(t){switch(t){case"$rc_lifetime":return"$rc_lifetime";case"$rc_annual":return"$rc_annual";case"$rc_six_month":return"$rc_six_month";case"$rc_three_month":return"$rc_three_month";case"$rc_two_month":return"$rc_two_month";case"$rc_monthly":return"$rc_monthly";case"$rc_weekly":return"$rc_weekly";default:return t.startsWith("$rc_")?"unknown":"custom"}}function hr(t){R(t,"svelte-1mdrqnh",".rcb-pricing-info.svelte-1mdrqnh{display:flex;flex-direction:column;margin-top:102px;font-weight:500}.rcb-product-price.svelte-1mdrqnh{color:var(--rc-color-grey-text-dark);font-size:24px;margin:12px 0px}.rcb-product-description.svelte-1mdrqnh{color:var(--rc-color-grey-text-dark);margin:0 0 12px 0}.rcb-product-price-after-trial.svelte-1mdrqnh{margin-bottom:12px}.rcb-product-details.svelte-1mdrqnh{color:var(--rc-color-grey-text-light);list-style-type:disc;list-style-position:inside;margin:0px;padding:0px}@media screen and (max-width: 960px){.rcb-pricing-info.svelte-1mdrqnh{margin-top:48px}}")}function br(t){var y,N,ie;let e,n,r,i,o,s,l,a,c,u,f=((y=t[3])==null?void 0:y.periodDuration)&&wr(t),m=!((N=t[3])!=null&&N.periodDuration)&&t[4]&&yr(t),w=t[3]&&t[4]&&Er(t),v=((ie=t[1])==null?void 0:ie.show_product_description)&&t[0].description&&At(t),O=t[0].normalPeriodDuration&&Ot(t);return{c(){e=I("span"),f&&f.c(),n=S(),m&&m.c(),r=S(),w&&w.c(),i=S(),v&&v.c(),o=S(),s=I("ul"),O&&O.c(),l=S(),a=I("li"),a.textContent="Continues until canceled",c=S(),u=I("li"),u.textContent="Cancel anytime",b(e,"class","rcb-product-price svelte-1mdrqnh"),b(s,"class","rcb-product-details svelte-1mdrqnh")},m($,U){g($,e,U),f&&f.m(e,null),L(e,n),m&&m.m(e,null),g($,r,U),w&&w.m($,U),g($,i,U),v&&v.m($,U),g($,o,U),g($,s,U),O&&O.m(s,null),L(s,l),L(s,a),L(s,c),L(s,u)},p($,U){var x,De,Qe;(x=$[3])!=null&&x.periodDuration&&f.p($,U),!((De=$[3])!=null&&De.periodDuration)&&$[4]&&m.p($,U),$[3]&&$[4]&&w.p($,U),(Qe=$[1])!=null&&Qe.show_product_description&&$[0].description?v?v.p($,U):(v=At($),v.c(),v.m(o.parentNode,o)):v&&(v.d(1),v=null),$[0].normalPeriodDuration?O?O.p($,U):(O=Ot($),O.c(),O.m(s,l)):O&&(O.d(1),O=null)},d($){$&&(_(e),_(r),_(i),_(o),_(s)),f&&f.d(),m&&m.d(),w&&w.d($),v&&v.d($),O&&O.d()}}}function wr(t){let e=lr(t[3].periodDuration)+"",n,r;return{c(){n=V(e),r=V(" free trial")},m(i,o){g(i,n,o),g(i,r,o)},p:h,d(i){i&&(_(n),_(r))}}}function yr(t){let e=t[4].formattedPrice+"",n;return{c(){n=V(e)},m(r,i){g(r,n,i)},p:h,d(r){r&&_(n)}}}function Er(t){let e;return{c(){e=I("span"),e.textContent=`${t[3]&&t[4]&&`${t[4].formattedPrice} after end of trial`}`,b(e,"class","rcb-product-price-after-trial svelte-1mdrqnh")},m(n,r){g(n,e,r)},p:h,d(n){n&&_(e)}}}function At(t){let e,n=t[0].description+"",r;return{c(){e=I("span"),r=V(n),b(e,"class","rcb-product-description svelte-1mdrqnh")},m(i,o){g(i,e,o),L(e,r)},p(i,o){o&1&&n!==(n=i[0].description+"")&&ue(r,n)},d(i){i&&_(e)}}}function Ot(t){let e,n,r=$t(t[0].normalPeriodDuration)+"",i;return{c(){e=I("li"),n=V("Renews "),i=V(r)},m(o,s){g(o,e,s),L(e,n),L(e,i)},p(o,s){s&1&&r!==(r=$t(o[0].normalPeriodDuration)+"")&&ue(i,r)},d(o){o&&_(e)}}}function Ir(t){var o;let e,n,r,i=((o=t[1])==null?void 0:o.show_product_description)&&Nt(t);return{c(){var s;e=I("span"),e.textContent=`${(s=t[5])==null?void 0:s.formattedPrice}`,n=S(),i&&i.c(),r=ae(),b(e,"class","rcb-product-price svelte-1mdrqnh")},m(s,l){g(s,e,l),g(s,n,l),i&&i.m(s,l),g(s,r,l)},p(s,l){var a;(a=s[1])!=null&&a.show_product_description?i?i.p(s,l):(i=Nt(s),i.c(),i.m(r.parentNode,r)):i&&(i.d(1),i=null)},d(s){s&&(_(e),_(n),_(r)),i&&i.d(s)}}}function Nt(t){let e,n=t[0].description+"",r;return{c(){e=I("span"),r=V(n),b(e,"class","rcb-product-description svelte-1mdrqnh")},m(i,o){g(i,e,o),L(e,r)},p(i,o){o&1&&n!==(n=i[0].description+"")&&ue(r,n)},d(i){i&&_(e)}}}function vr(t){let e,n,r=t[0].title+"",i,o,s,l=t[2]&&br(t),a=!t[2]&&Ir(t);return{c(){e=I("div"),n=I("span"),i=V(r),o=S(),l&&l.c(),s=S(),a&&a.c(),b(n,"class","rc-product-title"),b(e,"class","rcb-pricing-info svelte-1mdrqnh")},m(c,u){g(c,e,u),L(e,n),L(n,i),L(e,o),l&&l.m(e,null),L(e,s),a&&a.m(e,null)},p(c,u){u&1&&r!==(r=c[0].title+"")&&ue(i,r),c[2]&&l.p(c,u),c[2]||a.p(c,u)},d(c){c&&_(e),l&&l.d(),a&&a.d()}}}function $r(t){let e,n;return e=new Ee({props:{$$slots:{default:[vr]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p(r,[i]){const o={};i&515&&(o.$$scope={dirty:i,ctx:r}),e.$set(o)},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function kr(t,e,n){var m;let{productDetails:r}=e,{purchaseOption:i}=e,{brandingAppearance:o=void 0}=e;const s=r.productType===Ie.Subscription,l=i,a=i,c=l==null?void 0:l.trial,u=(m=l==null?void 0:l.base)==null?void 0:m.price,f=a==null?void 0:a.basePrice;return t.$$set=w=>{"productDetails"in w&&n(0,r=w.productDetails),"purchaseOption"in w&&n(6,i=w.purchaseOption),"brandingAppearance"in w&&n(1,o=w.brandingAppearance)},[r,o,s,c,u,f,i]}class Ut extends F{constructor(e){super(),C(this,e,kr,$r,A,{productDetails:0,purchaseOption:6,brandingAppearance:1},hr)}}const Pr='<svg width="80" height="80" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg" transform="rotate(0 0 0)"><path d="M12 3.5C7.30558 3.5 3.5 7.30558 3.5 12C3.5 16.6944 7.30558 20.5 12 20.5C16.6944 20.5 20.5 16.6944 20.5 12C20.5 11.5858 20.8358 11.25 21.25 11.25C21.6642 11.25 22 11.5858 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C12.4142 2 12.75 2.33579 12.75 2.75C12.75 3.16421 12.4142 3.5 12 3.5Z" fill="currentColor"/></svg>';function Tr(t){R(t,"svelte-16h2a8k","@-webkit-keyframes svelte-16h2a8k-rotating{from{-webkit-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes svelte-16h2a8k-rotating{from{-ms-transform:rotate(0deg);-moz-transform:rotate(0deg);-webkit-transform:rotate(0deg);-o-transform:rotate(0deg);transform:rotate(0deg)}to{-ms-transform:rotate(360deg);-moz-transform:rotate(360deg);-webkit-transform:rotate(360deg);-o-transform:rotate(360deg);transform:rotate(360deg)}}div.svelte-16h2a8k{width:80px;height:80px;-webkit-animation:svelte-16h2a8k-rotating 2s ease-in-out infinite;-moz-animation:svelte-16h2a8k-rotating 2s ease-in-out infinite;-ms-animation:svelte-16h2a8k-rotating 2s ease-in-out infinite;-o-animation:svelte-16h2a8k-rotating 2s ease-in-out infinite;animation:svelte-16h2a8k-rotating 2s ease-in-out infinite}")}function Ar(t){let e;return{c(){e=I("div"),fe(e,"color","var(--rc-color-accent)"),b(e,"class","rcb-ui-asset-icon svelte-16h2a8k")},m(n,r){g(n,e,r),e.innerHTML=Pr},p:h,i:h,o:h,d(n){n&&_(e)}}}class Or extends F{constructor(e){super(),C(this,e,null,Ar,A,{},Tr)}}function Nr(t){R(t,"svelte-l57ojl",".rcb-modal-loader.svelte-l57ojl{width:100%;flex-grow:1;min-height:100%;display:flex;justify-content:center;align-items:center}")}function Ur(t){let e,n,r;return n=new Or({}),{c(){e=I("div"),T(n.$$.fragment),b(e,"class","rcb-modal-loader svelte-l57ojl")},m(i,o){g(i,e,o),k(n,e,null),r=!0},p:h,i(i){r||(d(n.$$.fragment,i),r=!0)},o(i){p(n.$$.fragment,i),r=!1},d(i){i&&_(e),P(n)}}}class rt extends F{constructor(e){super(),C(this,e,null,Ur,A,{},Nr)}}var ee=(t=>(t[t.UnknownError=0]="UnknownError",t[t.UserCancelledError=1]="UserCancelledError",t[t.StoreProblemError=2]="StoreProblemError",t[t.PurchaseNotAllowedError=3]="PurchaseNotAllowedError",t[t.PurchaseInvalidError=4]="PurchaseInvalidError",t[t.ProductNotAvailableForPurchaseError=5]="ProductNotAvailableForPurchaseError",t[t.ProductAlreadyPurchasedError=6]="ProductAlreadyPurchasedError",t[t.ReceiptAlreadyInUseError=7]="ReceiptAlreadyInUseError",t[t.InvalidReceiptError=8]="InvalidReceiptError",t[t.MissingReceiptFileError=9]="MissingReceiptFileError",t[t.NetworkError=10]="NetworkError",t[t.InvalidCredentialsError=11]="InvalidCredentialsError",t[t.UnexpectedBackendResponseError=12]="UnexpectedBackendResponseError",t[t.InvalidAppUserIdError=14]="InvalidAppUserIdError",t[t.OperationAlreadyInProgressError=15]="OperationAlreadyInProgressError",t[t.UnknownBackendError=16]="UnknownBackendError",t[t.InvalidAppleSubscriptionKeyError=17]="InvalidAppleSubscriptionKeyError",t[t.IneligibleError=18]="IneligibleError",t[t.InsufficientPermissionsError=19]="InsufficientPermissionsError",t[t.PaymentPendingError=20]="PaymentPendingError",t[t.InvalidSubscriberAttributesError=21]="InvalidSubscriberAttributesError",t[t.LogOutWithAnonymousUserError=22]="LogOutWithAnonymousUserError",t[t.ConfigurationError=23]="ConfigurationError",t[t.UnsupportedError=24]="UnsupportedError",t[t.EmptySubscriberAttributesError=25]="EmptySubscriberAttributesError",t[t.CustomerInfoError=28]="CustomerInfoError",t[t.SignatureVerificationError=36]="SignatureVerificationError",t[t.InvalidEmailError=38]="InvalidEmailError",t))(ee||{});class Ue{static getPublicMessage(e){switch(e){case 0:return"Unknown error.";case 1:return"Purchase was cancelled.";case 2:return"There was a problem with the store.";case 3:return"The device or user is not allowed to make the purchase.";case 4:return"One or more of the arguments provided are invalid.";case 5:return"The product is not available for purchase.";case 6:return"This product is already active for the user.";case 7:return"There is already another active subscriber using the same receipt.";case 8:return"The receipt is not valid.";case 9:return"The receipt is missing.";case 10:return"Error performing request. Please check your network connection and try again.";case 11:return"There was a credentials issue. Check the underlying error for more details.";case 12:return"Received unexpected response from the backend.";case 14:return"The app user id is not valid.";case 15:return"The operation is already in progress.";case 16:return"There was an unknown backend error.";case 17:return"Apple Subscription Key is invalid or not present. In order to provide subscription offers, you must first generate a subscription key. Please see https://docs.revenuecat.com/docs/ios-subscription-offers for more info.";case 18:return"The User is ineligible for that action.";case 19:return"App does not have sufficient permissions to make purchases.";case 20:return"The payment is pending.";case 21:return"One or more of the attributes sent could not be saved.";case 22:return"Called logOut but the current user is anonymous.";case 23:return"There is an issue with your configuration. Check the underlying error for more details.";case 24:return"There was a problem with the operation. Looks like we doesn't support that yet. Check the underlying error for more details.";case 25:return"A request for subscriber attributes returned none.";case 28:return"There was a problem related to the customer info.";case 36:return"Request failed signature verification. Please see https://rev.cat/trusted-entitlements for more info.";case 38:return"Email is not valid. Please provide a valid email address."}}static getErrorCodeForBackendErrorCode(e){switch(e){case 7101:case 7773:return 2;case 7102:return 7;case 7103:return 8;case 7107:case 7224:case 7225:return 11;case 7105:case 7106:case 7814:return 4;case 7772:return 6;case 7220:return 14;case 7229:return 2;case 7230:case 7e3:return 23;case 7231:return 2;case 7232:return 18;case 7263:case 7264:return 21;case 7104:case 7234:case 7226:case 7110:return 12;case 7662:return 24;case 7012:case 7834:return 38}}static convertCodeToBackendErrorCode(e){return e in Rt?e:null}static convertPurchaseFlowErrorCodeToErrorCode(e){switch(e){case te.ErrorSettingUpPurchase:return 2;case te.ErrorChargingPayment:return 20;case te.NetworkError:return 10;case te.MissingEmailError:return 4;case te.StripeError:return 2;case te.UnknownError:return 0;case te.AlreadyPurchasedError:return 6}}}var Rt=(t=>(t[t.BackendInvalidPlatform=7e3]="BackendInvalidPlatform",t[t.BackendInvalidEmail=7012]="BackendInvalidEmail",t[t.BackendStoreProblem=7101]="BackendStoreProblem",t[t.BackendCannotTransferPurchase=7102]="BackendCannotTransferPurchase",t[t.BackendInvalidReceiptToken=7103]="BackendInvalidReceiptToken",t[t.BackendInvalidAppStoreSharedSecret=7104]="BackendInvalidAppStoreSharedSecret",t[t.BackendInvalidPaymentModeOrIntroPriceNotProvided=7105]="BackendInvalidPaymentModeOrIntroPriceNotProvided",t[t.BackendProductIdForGoogleReceiptNotProvided=7106]="BackendProductIdForGoogleReceiptNotProvided",t[t.BackendInvalidPlayStoreCredentials=7107]="BackendInvalidPlayStoreCredentials",t[t.BackendInternalServerError=7110]="BackendInternalServerError",t[t.BackendEmptyAppUserId=7220]="BackendEmptyAppUserId",t[t.BackendInvalidAuthToken=7224]="BackendInvalidAuthToken",t[t.BackendInvalidAPIKey=7225]="BackendInvalidAPIKey",t[t.BackendBadRequest=7226]="BackendBadRequest",t[t.BackendPlayStoreQuotaExceeded=7229]="BackendPlayStoreQuotaExceeded",t[t.BackendPlayStoreInvalidPackageName=7230]="BackendPlayStoreInvalidPackageName",t[t.BackendPlayStoreGenericError=7231]="BackendPlayStoreGenericError",t[t.BackendUserIneligibleForPromoOffer=7232]="BackendUserIneligibleForPromoOffer",t[t.BackendInvalidAppleSubscriptionKey=7234]="BackendInvalidAppleSubscriptionKey",t[t.BackendInvalidSubscriberAttributes=7263]="BackendInvalidSubscriberAttributes",t[t.BackendInvalidSubscriberAttributesBody=7264]="BackendInvalidSubscriberAttributesBody",t[t.BackendProductIDsMalformed=7662]="BackendProductIDsMalformed",t[t.BackendAlreadySubscribedError=7772]="BackendAlreadySubscribedError",t[t.BackendPaymentGatewayGenericError=7773]="BackendPaymentGatewayGenericError",t[t.BackendOfferNotFound=7814]="BackendOfferNotFound",t[t.BackendNoMXRecordsFound=7834]="BackendNoMXRecordsFound",t))(Rt||{});class J extends Error{constructor(n,r,i,o){super(r);M(this,"toString",()=>`PurchasesError(code: ${ee[this.errorCode]}, message: ${this.message})`);this.errorCode=n,this.underlyingErrorMessage=i,this.extra=o}static getForBackendError(n,r){const i=Ue.getErrorCodeForBackendErrorCode(n);return new J(i,Ue.getPublicMessage(i),r,{backendErrorCode:n})}static getForPurchasesFlowError(n){return new J(Ue.convertPurchaseFlowErrorCodeToErrorCode(n.errorCode),n.message,n.underlyingErrorMessage)}}class Lt extends Error{constructor(){super("Purchases must be configured before calling getInstance")}}var Re=(t=>(t.Started="started",t.InProgress="in_progress",t.Succeeded="succeeded",t.Failed="failed",t))(Re||{}),ve=(t=>(t[t.SetupIntentCreationFailed=1]="SetupIntentCreationFailed",t[t.PaymentMethodCreationFailed=2]="PaymentMethodCreationFailed",t[t.PaymentChargeFailed=3]="PaymentChargeFailed",t[t.SetupIntentCompletionFailed=4]="SetupIntentCompletionFailed",t[t.AlreadyPurchased=5]="AlreadyPurchased",t))(ve||{});function Rr(t){var e;return t.operation.redemption_info?{redeemUrl:((e=t.operation.redemption_info)==null?void 0:e.redeem_url)??null}:null}var te=(t=>(t[t.ErrorSettingUpPurchase=0]="ErrorSettingUpPurchase",t[t.ErrorChargingPayment=1]="ErrorChargingPayment",t[t.UnknownError=2]="UnknownError",t[t.NetworkError=3]="NetworkError",t[t.StripeError=4]="StripeError",t[t.MissingEmailError=5]="MissingEmailError",t[t.AlreadyPurchasedError=6]="AlreadyPurchasedError",t))(te||{});class Q extends Error{constructor(e,n,r,i,o){super(n),this.errorCode=e,this.underlyingErrorMessage=r,this.purchasesErrorCode=i,this.extra=o}isRecoverable(){switch(this.errorCode){case 3:case 5:return!0;case 0:case 1:case 6:case 4:case 2:return!1}}getPublicErrorMessage(e){var r;const n=((r=this.extra)==null?void 0:r.backendErrorCode)??this.purchasesErrorCode??this.errorCode;switch(this.errorCode){case 2:return`An unknown error occurred. Error code: ${n}.`;case 0:return`Purchase not started due to an error. Error code: ${n}.`;case 1:return"Payment failed.";case 3:return"Network error. Please check your internet connection.";case 4:return this.message;case 5:return"Email is required to complete the purchase.";case 6:return(e==null?void 0:e.productType)===Ie.Subscription?"You are already subscribed to this product.":"You have already purchased this product."}}static fromPurchasesError(e,n){let r;return e.errorCode===ee.ProductAlreadyPurchasedError?r=6:e.errorCode===ee.InvalidEmailError?r=5:e.errorCode===ee.NetworkError?r=3:r=n,new Q(r,e.message,e.underlyingErrorMessage,e.errorCode,e.extra)}}class Lr{constructor(e,n=10){M(this,"operationSessionId",null);M(this,"backend");M(this,"maxNumberAttempts");M(this,"waitMSBetweenAttempts",1e3);this.backend=e,this.maxNumberAttempts=n}async startPurchase(e,n,r,i,o){try{const s=await this.backend.postPurchase(e,n,i,o,r);return this.operationSessionId=s.operation_session_id,s}catch(s){if(s instanceof J)throw Q.fromPurchasesError(s,0);{const l="Unknown error starting purchase: "+String(s);throw q.errorLog(l),new Q(2,l)}}}async pollCurrentPurchaseForCompletion(){const e=this.operationSessionId;if(!e)throw new Q(0,"No purchase in progress");return new Promise((n,r)=>{const i=(o=1)=>{if(o>this.maxNumberAttempts){this.clearPurchaseInProgress(),r(new Q(2,"Max attempts reached trying to get successful purchase status"));return}this.backend.getCheckoutStatus(e).then(s=>{switch(s.operation.status){case Re.Started:case Re.InProgress:setTimeout(()=>i(o+1),this.waitMSBetweenAttempts);break;case Re.Succeeded:this.clearPurchaseInProgress(),n({redemptionInfo:Rr(s)});return;case Re.Failed:this.clearPurchaseInProgress(),this.handlePaymentError(s.operation.error,r)}}).catch(s=>{const l=Q.fromPurchasesError(s,3);r(l)})};i()})}clearPurchaseInProgress(){this.operationSessionId=null}handlePaymentError(e,n){if(e==null){n(new Q(2,"Got an error status but error field is empty."));return}switch(e.code){case ve.SetupIntentCreationFailed:n(new Q(0,"Setup intent creation failed"));return;case ve.PaymentMethodCreationFailed:n(new Q(0,"Payment method creation failed"));return;case ve.PaymentChargeFailed:n(new Q(1,"Payment charge failed"));return;case ve.SetupIntentCompletionFailed:n(new Q(0,"Setup intent completion failed"));return;case ve.AlreadyPurchased:n(new Q(6,"Purchased was already completed"));return;default:n(new Q(2,"Unknown error code received"));return}}}const Sr=`<svg width="96" height="96" viewBox="0 0 124 124" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
1
+ (function(_,P){typeof exports=="object"&&typeof module<"u"?P(exports):typeof define=="function"&&define.amd?define(["exports"],P):(_=typeof globalThis<"u"?globalThis:_||self,P(_.Purchases={}))})(this,function(_){"use strict";var Ql=Object.create;var Ht=Object.defineProperty;var Zl=Object.getOwnPropertyDescriptor;var Ii=(_,P)=>(P=Symbol[_])?P:Symbol.for("Symbol."+_),Cr=_=>{throw TypeError(_)};var xi=(_,P,N)=>P in _?Ht(_,P,{enumerable:!0,configurable:!0,writable:!0,value:N}):_[P]=N;var yi=(_,P)=>Ht(_,"name",{value:P,configurable:!0});var Pi=_=>[,,,Ql((_==null?void 0:_[Ii("metadata")])??null)],Ti=["class","method","getter","setter","accessor","field","value","get","set"],jr=_=>_!==void 0&&typeof _!="function"?Cr("Function expected"):_,Xl=(_,P,N,ve,Y)=>({kind:Ti[_],name:P,metadata:ve,addInitializer:Z=>N._?Cr("Already initialized"):Y.push(jr(Z||null))}),Vt=(_,P)=>xi(P,Ii("metadata"),_[3]),Ai=(_,P,N,ve)=>{for(var Y=0,Z=_[P>>1],Oe=Z&&Z.length;Y<Oe;Y++)P&1?Z[Y].call(N):ve=Z[Y].call(N,ve);return ve},Oi=(_,P,N,ve,Y,Z)=>{var Oe,oe,Hr,Ve,mr,k=P&7,Je=!!(P&8),Ee=!!(P&16),Me=k>3?_.length+1:k?Je?1:2:0,Vr=Ti[k+5],Gr=k>3&&(_[Me-1]=[]),Le=_[Me]||(_[Me]=[]),ae=k&&(!Ee&&!Je&&(Y=Y.prototype),k<5&&(k>3||!Ee)&&Zl(k<4?Y:{get[N](){return Ei(this,Z)},set[N](te){return wi(this,Z,te)}},N));k?Ee&&k<4&&yi(Z,(k>2?"set ":k>1?"get ":"")+N):yi(Y,N);for(var br=ve.length-1;br>=0;br--)Ve=Xl(k,N,Hr={},_[3],Le),k&&(Ve.static=Je,Ve.private=Ee,mr=Ve.access={has:Ee?te=>Jl(Y,te):te=>N in te},k^3&&(mr.get=Ee?te=>(k^1?Ei:ec)(te,Y,k^4?Z:ae.get):te=>te[N]),k>2&&(mr.set=Ee?(te,Be)=>wi(te,Y,Be,k^4?Z:ae.set):(te,Be)=>te[N]=Be)),oe=(0,ve[br])(k?k<4?Ee?Z:ae[Vr]:k>4?void 0:{get:ae.get,set:ae.set}:Y,Ve),Hr._=1,k^4||oe===void 0?jr(oe)&&(k>4?Gr.unshift(oe):k?Ee?Z=oe:ae[Vr]=oe:Y=oe):typeof oe!="object"||oe===null?Cr("Object expected"):(jr(Oe=oe.get)&&(ae.get=Oe),jr(Oe=oe.set)&&(ae.set=Oe),jr(Oe=oe.init)&&Gr.unshift(Oe));return k||Vt(_,Y),ae&&Ht(Y,N,ae),Ee?k^4?Z:ae:Y},D=(_,P,N)=>xi(_,typeof P!="symbol"?P+"":P,N),Gt=(_,P,N)=>P.has(_)||Cr("Cannot "+N),Jl=(_,P)=>Object(P)!==P?Cr('Cannot use the "in" operator on this value'):_.has(P),Ei=(_,P,N)=>(Gt(_,P,"read from private field"),N?N.call(_):P.get(_));var wi=(_,P,N,ve)=>(Gt(_,P,"write to private field"),ve?ve.call(_,N):P.set(_,N),N),ec=(_,P,N)=>(Gt(_,P,"access private method"),N);var mi,jt;const P="5";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(P);let N=!1;function ve(){N=!0}ve();const Y=1,Z=2,Oe=4,oe=8,Hr=16,Ve=1,mr=2,k=Symbol(),Je="http://www.w3.org/2000/svg",Ee=!1;var Me=Array.isArray,Vr=Array.from,Gr=Object.defineProperty,Le=Object.getOwnPropertyDescriptor,ae=Object.getOwnPropertyDescriptors,br=Object.prototype,te=Array.prototype,Be=Object.getPrototypeOf;function ki(e){return e()}function dt(e){for(var r=0;r<e.length;r++)e[r]()}const $e=2,Yt=4,yr=8,vt=16,xe=32,Er=64,Ge=128,Yr=256,ne=512,Fe=1024,er=2048,rr=4096,wr=8192,Ni=16384,Wr=32768,Ri=65536,Si=1<<18,Wt=1<<19,tr=Symbol("$state"),Ui=Symbol("");function zt(e){return e===this.v}function Li(e,r){return e!=e?r==r:e!==r||e!==null&&typeof e=="object"||typeof e=="function"}function pt(e){return!Li(e,this.v)}function $i(e){throw new Error("effect_in_teardown")}function Di(){throw new Error("effect_in_unowned_derived")}function Mi(e){throw new Error("effect_orphan")}function Bi(){throw new Error("effect_update_depth_exceeded")}function Fi(e){throw new Error("lifecycle_legacy_only")}function qi(e){throw new Error("props_invalid_value")}function ji(){throw new Error("state_descriptors_fixed")}function Ci(){throw new Error("state_prototype_fixed")}function Hi(){throw new Error("state_unsafe_local_read")}function Vi(){throw new Error("state_unsafe_mutation")}function ke(e){return{f:0,v:e,reactions:null,equals:zt,version:0}}function Kt(e,r=!1){var n;const t=ke(e);return r||(t.equals=pt),N&&U!==null&&U.l!==null&&((n=U.l).s??(n.s=[])).push(t),t}function pe(e,r=!1){return Gi(Kt(e,r))}function Gi(e){return q!==null&&q.f&$e&&(Re===null?Ji([e]):Re.push(e)),e}function R(e,r){return q!==null&&Xr()&&q.f&($e|vt)&&(Re===null||!Re.includes(e))&&Vi(),Yi(e,r)}function Yi(e,r){return e.equals(r)||(e.v=r,e.version=dn(),Qt(e,Fe),Xr()&&M!==null&&M.f&ne&&!(M.f&xe)&&(J!==null&&J.includes(e)?(Pe(M,Fe),Jr(M)):Ce===null?eo([e]):Ce.push(e))),r}function Qt(e,r){var t=e.reactions;if(t!==null)for(var n=Xr(),i=t.length,o=0;o<i;o++){var a=t[o],s=a.f;s&Fe||!n&&a===M||(Pe(a,r),s&(ne|Ge)&&(s&$e?Qt(a,er):Jr(a)))}}function zr(e){var r=$e|Fe;M===null?r|=Ge:M.f|=Wt;const t={children:null,ctx:U,deps:null,equals:zt,f:r,fn:e,reactions:null,v:null,version:0,parent:M};if(q!==null&&q.f&$e){var n=q;(n.children??(n.children=[])).push(t)}return t}function he(e){const r=zr(e);return r.equals=pt,r}function Zt(e){var r=e.children;if(r!==null){e.children=null;for(var t=0;t<r.length;t+=1){var n=r[t];n.f&$e?ht(n):qe(n)}}}function Xt(e){var r,t=M;Ne(e.parent);try{Zt(e),r=vn(e)}finally{Ne(t)}return r}function Jt(e){var r=Xt(e),t=(or||e.f&Ge)&&e.deps!==null?er:ne;Pe(e,t),e.equals(r)||(e.v=r,e.version=dn())}function ht(e){Zt(e),Ar(e,0),Pe(e,wr),e.v=e.children=e.deps=e.ctx=e.reactions=null}function en(e){M===null&&q===null&&Mi(),q!==null&&q.f&Ge&&Di(),It&&$i()}function Wi(e,r){var t=r.last;t===null?r.last=r.first=e:(t.next=e,e.prev=t,r.last=e)}function nr(e,r,t,n=!0){var i=(e&Er)!==0,o=M,a={ctx:U,deps:null,deriveds:null,nodes_start:null,nodes_end:null,f:e|Fe,first:null,fn:r,last:null,next:null,parent:i?null:o,prev:null,teardown:null,transitions:null,version:0};if(t){var s=ir;try{cn(!0),Or(a),a.f|=Ni}catch(u){throw qe(a),u}finally{cn(s)}}else r!==null&&Jr(a);var c=t&&a.deps===null&&a.first===null&&a.nodes_start===null&&a.teardown===null&&(a.f&Wt)===0;if(!c&&!i&&n&&(o!==null&&Wi(a,o),q!==null&&q.f&$e)){var l=q;(l.children??(l.children=[])).push(a)}return a}function rn(e){const r=nr(yr,null,!1);return Pe(r,ne),r.teardown=e,r}function gt(e){en();var r=M!==null&&(M.f&xe)!==0&&U!==null&&!U.m;if(r){var t=U;(t.e??(t.e=[])).push({fn:e,effect:M,reaction:q})}else{var n=_t(e);return n}}function zi(e){return en(),Ir(e)}function Ki(e){const r=nr(Er,e,!0);return()=>{qe(r)}}function _t(e){return nr(Yt,e,!1)}function Ye(e,r){var t=U,n={effect:null,ran:!1};t.l.r1.push(n),n.effect=Ir(()=>{e(),!n.ran&&(n.ran=!0,R(t.l.r2,!0),sr(r))})}function mt(){var e=U;Ir(()=>{if(v(e.l.r2)){for(var r of e.l.r1){var t=r.effect;t.f&ne&&Pe(t,er),ar(t)&&Or(t),r.ran=!1}e.l.r2.v=!1}})}function Ir(e){return nr(yr,e,!0)}function G(e){return Kr(e)}function Kr(e,r=0){return nr(yr|vt|r,e,!0)}function xr(e,r=!0){return nr(yr|xe,e,!0,r)}function tn(e){var r=e.teardown;if(r!==null){const t=It,n=q;un(!0),je(null);try{r.call(null)}finally{un(t),je(n)}}}function nn(e){var r=e.deriveds;if(r!==null){e.deriveds=null;for(var t=0;t<r.length;t+=1)ht(r[t])}}function on(e,r=!1){var t=e.first;for(e.first=e.last=null;t!==null;){var n=t.next;qe(t,r),t=n}}function Qi(e){for(var r=e.first;r!==null;){var t=r.next;r.f&xe||qe(r),r=t}}function qe(e,r=!0){var t=!1;if((r||e.f&Si)&&e.nodes_start!==null){for(var n=e.nodes_start,i=e.nodes_end;n!==null;){var o=n===i?null:Tt(n);n.remove(),n=o}t=!0}on(e,r&&!t),nn(e),Ar(e,0),Pe(e,wr);var a=e.transitions;if(a!==null)for(const c of a)c.stop();tn(e);var s=e.parent;s!==null&&s.first!==null&&an(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.parent=e.fn=e.nodes_start=e.nodes_end=null}function an(e){var r=e.parent,t=e.prev,n=e.next;t!==null&&(t.next=n),n!==null&&(n.prev=t),r!==null&&(r.first===e&&(r.first=n),r.last===e&&(r.last=t))}function bt(e,r){var t=[];sn(e,t,!0),Zi(t,()=>{qe(e),r&&r()})}function Zi(e,r){var t=e.length;if(t>0){var n=()=>--t||r();for(var i of e)i.out(n)}else r()}function sn(e,r,t){if(!(e.f&rr)){if(e.f^=rr,e.transitions!==null)for(const a of e.transitions)(a.is_global||t)&&r.push(a);for(var n=e.first;n!==null;){var i=n.next,o=(n.f&Wr)!==0||(n.f&xe)!==0;sn(n,r,o?t:!1),n=i}}}function yt(e){ln(e,!0)}function ln(e,r){if(e.f&rr){ar(e)&&Or(e),e.f^=rr;for(var t=e.first;t!==null;){var n=t.next,i=(t.f&Wr)!==0||(t.f&xe)!==0;ln(t,i?r:!1),t=n}if(e.transitions!==null)for(const o of e.transitions)(o.is_global||r)&&o.in()}}let Et=!1,wt=[];function Xi(){Et=!1;const e=wt.slice();wt=[],dt(e)}function Pr(e){Et||(Et=!0,queueMicrotask(Xi)),wt.push(e)}function Qr(e){throw new Error("lifecycle_outside_component")}let Zr=!1,ir=!1,It=!1;function cn(e){ir=e}function un(e){It=e}let xt=[],Tr=0,rc=[],q=null;function je(e){q=e}let M=null;function Ne(e){M=e}let Re=null;function Ji(e){Re=e}let J=null,ge=0,Ce=null;function eo(e){Ce=e}let fn=0,or=!1,U=null;function dn(){return++fn}function Xr(){return!N||U!==null&&U.l===null}function ar(e){var a,s;var r=e.f;if(r&Fe)return!0;if(r&er){var t=e.deps,n=(r&Ge)!==0;if(t!==null){var i;if(r&Yr){for(i=0;i<t.length;i++)((a=t[i]).reactions??(a.reactions=[])).push(e);e.f^=Yr}for(i=0;i<t.length;i++){var o=t[i];if(ar(o)&&Jt(o),n&&M!==null&&!or&&!((s=o==null?void 0:o.reactions)!=null&&s.includes(e))&&(o.reactions??(o.reactions=[])).push(e),o.version>e.version)return!0}}n||Pe(e,ne)}return!1}function ro(e,r,t){throw e}function vn(e){var d;var r=J,t=ge,n=Ce,i=q,o=or,a=Re,s=U,c=e.f;J=null,ge=0,Ce=null,q=c&(xe|Er)?null:e,or=!ir&&(c&Ge)!==0,Re=null,U=e.ctx;try{var l=(0,e.fn)(),u=e.deps;if(J!==null){var f;if(Ar(e,ge),u!==null&&ge>0)for(u.length=ge+J.length,f=0;f<J.length;f++)u[ge+f]=J[f];else e.deps=u=J;if(!or)for(f=ge;f<u.length;f++)((d=u[f]).reactions??(d.reactions=[])).push(e)}else u!==null&&ge<u.length&&(Ar(e,ge),u.length=ge);return l}finally{J=r,ge=t,Ce=n,q=i,or=o,Re=a,U=s}}function to(e,r){let t=r.reactions;if(t!==null){var n=t.indexOf(e);if(n!==-1){var i=t.length-1;i===0?t=r.reactions=null:(t[n]=t[i],t.pop())}}t===null&&r.f&$e&&(J===null||!J.includes(r))&&(Pe(r,er),r.f&(Ge|Yr)||(r.f^=Yr),Ar(r,0))}function Ar(e,r){var t=e.deps;if(t!==null)for(var n=r;n<t.length;n++)to(e,t[n])}function Or(e){var r=e.f;if(!(r&wr)){Pe(e,ne);var t=M;M=e;try{r&vt?Qi(e):on(e),nn(e),tn(e);var n=vn(e);e.teardown=typeof n=="function"?n:null,e.version=fn}catch(i){ro(i)}finally{M=t}}}function no(){Tr>1e3&&(Tr=0,Bi()),Tr++}function io(e){var r=e.length;if(r!==0){no();var t=ir;ir=!0;try{for(var n=0;n<r;n++){var i=e[n];i.f&ne||(i.f^=ne);var o=[];pn(i,o),oo(o)}}finally{ir=t}}}function oo(e){var r=e.length;if(r!==0)for(var t=0;t<r;t++){var n=e[t];!(n.f&(wr|rr))&&ar(n)&&(Or(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?an(n):n.fn=null))}}function ao(){if(Zr=!1,Tr>1001)return;const e=xt;xt=[],io(e),Zr||(Tr=0)}function Jr(e){Zr||(Zr=!0,queueMicrotask(ao));for(var r=e;r.parent!==null;){r=r.parent;var t=r.f;if(t&(Er|xe)){if(!(t&ne))return;r.f^=ne}}xt.push(r)}function pn(e,r){var t=e.first,n=[];e:for(;t!==null;){var i=t.f,o=(i&xe)!==0,a=o&&(i&ne)!==0;if(!a&&!(i&rr))if(i&yr){o?t.f^=ne:ar(t)&&Or(t);var s=t.first;if(s!==null){t=s;continue}}else i&Yt&&n.push(t);var c=t.next;if(c===null){let f=t.parent;for(;f!==null;){if(e===f)break e;var l=f.next;if(l!==null){t=l;continue e}f=f.parent}}t=c}for(var u=0;u<n.length;u++)s=n[u],r.push(s),pn(s,r)}function v(e){var s;var r=e.f,t=(r&$e)!==0;if(t&&r&wr){var n=Xt(e);return ht(e),n}if(q!==null){Re!==null&&Re.includes(e)&&Hi();var i=q.deps;J===null&&i!==null&&i[ge]===e?ge++:J===null?J=[e]:J.push(e),Ce!==null&&M!==null&&M.f&ne&&!(M.f&xe)&&Ce.includes(e)&&(Pe(M,Fe),Jr(M))}else if(t&&e.deps===null){var o=e,a=o.parent;a!==null&&!((s=a.deriveds)!=null&&s.includes(o))&&(a.deriveds??(a.deriveds=[])).push(o)}return t&&(o=e,ar(o)&&Jt(o)),e.v}function sr(e){const r=q;try{return q=null,e()}finally{q=r}}const so=~(Fe|er|ne);function Pe(e,r){e.f=e.f&so|r}function lo(e){return gn().get(e)}function hn(e,r){return gn().set(e,r),r}function gn(e){return U===null&&Qr(),U.c??(U.c=new Map(co(U)||void 0))}function co(e){let r=e.p;for(;r!==null;){const t=r.c;if(t!==null)return t;r=r.p}return null}function we(e,r=!1,t){U={p:U,c:null,e:null,m:!1,s:e,x:null,l:null},N&&!r&&(U.l={s:null,u:null,r1:[],r2:ke(!1)})}function Ie(e){const r=U;if(r!==null){e!==void 0&&(r.x=e);const a=r.e;if(a!==null){var t=M,n=q;r.e=null;try{for(var i=0;i<a.length;i++){var o=a[i];Ne(o.effect),je(o.reaction),_t(o.fn)}}finally{Ne(t),je(n)}}U=r.p,r.m=!0}return e||{}}function ee(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(tr in e)Pt(e);else if(!Array.isArray(e))for(let r in e){const t=e[r];typeof t=="object"&&t&&tr in t&&Pt(t)}}}function Pt(e,r=new Set){if(typeof e=="object"&&e!==null&&!(e instanceof EventTarget)&&!r.has(e)){r.add(e),e instanceof Date&&e.getTime();for(let n in e)try{Pt(e[n],r)}catch{}const t=Be(e);if(t!==Object.prototype&&t!==Array.prototype&&t!==Map.prototype&&t!==Set.prototype&&t!==Date.prototype){const n=ae(t);for(let i in n){const o=n[i].get;if(o)try{o.call(e)}catch{}}}}}function lr(e,r=null,t){if(typeof e!="object"||e===null||tr in e)return e;const n=Be(e);if(n!==br&&n!==te)return e;var i=new Map,o=Me(e),a=ke(0);o&&i.set("length",ke(e.length));var s;return new Proxy(e,{defineProperty(c,l,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&ji();var f=i.get(l);return f===void 0?(f=ke(u.value),i.set(l,f)):R(f,lr(u.value,s)),!0},deleteProperty(c,l){var u=i.get(l);if(u===void 0)l in c&&i.set(l,ke(k));else{if(o&&typeof l=="string"){var f=i.get("length"),d=Number(l);Number.isInteger(d)&&d<f.v&&R(f,d)}R(u,k),_n(a)}return!0},get(c,l,u){var w;if(l===tr)return e;var f=i.get(l),d=l in c;if(f===void 0&&(!d||(w=Le(c,l))!=null&&w.writable)&&(f=ke(lr(d?c[l]:k,s)),i.set(l,f)),f!==void 0){var m=v(f);return m===k?void 0:m}return Reflect.get(c,l,u)},getOwnPropertyDescriptor(c,l){var u=Reflect.getOwnPropertyDescriptor(c,l);if(u&&"value"in u){var f=i.get(l);f&&(u.value=v(f))}else if(u===void 0){var d=i.get(l),m=d==null?void 0:d.v;if(d!==void 0&&m!==k)return{enumerable:!0,configurable:!0,value:m,writable:!0}}return u},has(c,l){var m;if(l===tr)return!0;var u=i.get(l),f=u!==void 0&&u.v!==k||Reflect.has(c,l);if(u!==void 0||M!==null&&(!f||(m=Le(c,l))!=null&&m.writable)){u===void 0&&(u=ke(f?lr(c[l],s):k),i.set(l,u));var d=v(u);if(d===k)return!1}return f},set(c,l,u,f){var A;var d=i.get(l),m=l in c;if(o&&l==="length")for(var w=u;w<d.v;w+=1){var g=i.get(w+"");g!==void 0?R(g,k):w in c&&(g=ke(k),i.set(w+"",g))}d===void 0?(!m||(A=Le(c,l))!=null&&A.writable)&&(d=ke(void 0),R(d,lr(u,s)),i.set(l,d)):(m=d.v!==k,R(d,lr(u,s)));var T=Reflect.getOwnPropertyDescriptor(c,l);if(T!=null&&T.set&&T.set.call(f,u),!m){if(o&&typeof l=="string"){var b=i.get("length"),I=Number(l);Number.isInteger(I)&&I>=b.v&&R(b,I+1)}_n(a)}return!0},ownKeys(c){v(a);var l=Reflect.ownKeys(c).filter(d=>{var m=i.get(d);return m===void 0||m.v!==k});for(var[u,f]of i)f.v!==k&&!(u in c)&&l.push(u);return l},setPrototypeOf(){Ci()}})}function _n(e,r=1){R(e,e.v+r)}var mn,bn,yn;function uo(){if(mn===void 0){mn=window;var e=Element.prototype,r=Node.prototype;bn=Le(r,"firstChild").get,yn=Le(r,"nextSibling").get,e.__click=void 0,e.__className="",e.__attributes=null,e.__styles=null,e.__e=void 0,Text.prototype.__t=void 0}}function et(e=""){return document.createTextNode(e)}function kr(e){return bn.call(e)}function Tt(e){return yn.call(e)}function x(e,r){return kr(e)}function B(e,r){{var t=kr(e);return t instanceof Comment&&t.data===""?Tt(t):t}}function L(e,r=1,t=!1){let n=e;for(;r--;)n=Tt(n);return n}let fo=!1;function vo(e,r){if(r){const t=document.body;e.autofocus=!0,Pr(()=>{document.activeElement===t&&e.focus()})}}let En=!1;function po(){En||(En=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var r;if(!e.defaultPrevented)for(const t of e.target.elements)(r=t.__on_r)==null||r.call(t)})},{capture:!0}))}function wn(e){var r=q,t=M;je(null),Ne(null);try{return e()}finally{je(r),Ne(t)}}function ho(e,r,t,n=t){e.addEventListener(r,()=>wn(t));const i=e.__on_r;i?e.__on_r=()=>{i(),n()}:e.__on_r=n,po()}const In=new Set,At=new Set;function xn(e,r,t,n){function i(o){if(n.capture||Nr.call(r,o),!o.cancelBubble)return wn(()=>t.call(this,o))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?Pr(()=>{r.addEventListener(e,i,n)}):r.addEventListener(e,i,n),i}function rt(e,r,t,n,i){var o={capture:n,passive:i},a=xn(e,r,t,o);(r===document.body||r===window||r===document)&&rn(()=>{r.removeEventListener(e,a,o)})}function go(e){for(var r=0;r<e.length;r++)In.add(e[r]);for(var t of At)t(e)}function Nr(e){var I;var r=this,t=r.ownerDocument,n=e.type,i=((I=e.composedPath)==null?void 0:I.call(e))||[],o=i[0]||e.target,a=0,s=e.__root;if(s){var c=i.indexOf(s);if(c!==-1&&(r===document||r===window)){e.__root=r;return}var l=i.indexOf(r);if(l===-1)return;c<=l&&(a=c)}if(o=i[a]||e.target,o!==r){Gr(e,"currentTarget",{configurable:!0,get(){return o||t}});var u=q,f=M;je(null),Ne(null);try{for(var d,m=[];o!==null;){var w=o.assignedSlot||o.parentNode||o.host||null;try{var g=o["__"+n];if(g!==void 0&&!o.disabled)if(Me(g)){var[T,...b]=g;T.apply(o,[e,...b])}else g.call(o,e)}catch(A){d?m.push(A):d=A}if(e.cancelBubble||w===r||w===null)break;o=w}if(d){for(let A of m)queueMicrotask(()=>{throw A});throw d}}finally{e.__root=r,delete e.currentTarget,je(u),Ne(f)}}}function Pn(e){var r=document.createElement("template");return r.innerHTML=e,r.content}function cr(e,r){var t=M;t.nodes_start===null&&(t.nodes_start=e,t.nodes_end=r)}function E(e,r){var t=(r&Ve)!==0,n=(r&mr)!==0,i,o=!e.startsWith("<!>");return()=>{i===void 0&&(i=Pn(o?e:"<!>"+e),t||(i=kr(i)));var a=n?document.importNode(i,!0):i.cloneNode(!0);if(t){var s=kr(a),c=a.lastChild;cr(s,c)}else cr(a,a);return a}}function We(e=""){{var r=et(e+"");return cr(r,r),r}}function _e(){var e=document.createDocumentFragment(),r=document.createComment(""),t=et();return e.append(r,t),cr(r,t),e}function p(e,r){e!==null&&e.before(r)}function _o(e){return e.endsWith("capture")&&e!=="gotpointercapture"&&e!=="lostpointercapture"}const mo=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function bo(e){return mo.includes(e)}const yo={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly"};function Eo(e){return e=e.toLowerCase(),yo[e]??e}const wo=["touchstart","touchmove"];function Io(e){return wo.includes(e)}function se(e,r){var t=r==null?"":typeof r=="object"?r+"":r;t!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=t,e.nodeValue=t==null?"":t+"")}function xo(e,r){return Po(e,r)}const ur=new Map;function Po(e,{target:r,anchor:t,props:n={},events:i,context:o,intro:a=!0}){uo();var s=new Set,c=f=>{for(var d=0;d<f.length;d++){var m=f[d];if(!s.has(m)){s.add(m);var w=Io(m);r.addEventListener(m,Nr,{passive:w});var g=ur.get(m);g===void 0?(document.addEventListener(m,Nr,{passive:w}),ur.set(m,1)):ur.set(m,g+1)}}};c(Vr(In)),At.add(c);var l=void 0,u=Ki(()=>{var f=t??r.appendChild(et());return xr(()=>{if(o){we({});var d=U;d.c=o}i&&(n.$$events=i),l=e(f,n)||{},o&&Ie()}),()=>{var w;for(var d of s){r.removeEventListener(d,Nr);var m=ur.get(d);--m===0?(document.removeEventListener(d,Nr),ur.delete(d)):ur.set(d,m)}At.delete(c),Tn.delete(l),f!==t&&((w=f.parentNode)==null||w.removeChild(f))}});return Tn.set(l,u),l}let Tn=new WeakMap;function F(e,r,t,n=null,i=!1){var o=e,a=null,s=null,c=null,l=i?Wr:0;Kr(()=>{c!==(c=!!r())&&(c?(a?yt(a):a=xr(()=>t(o)),s&&bt(s,()=>{s=null})):(s?yt(s):n&&(s=xr(()=>n(o))),a&&bt(a,()=>{a=null})))},l)}function Rr(e,r,t,n,i){var o=e,a="",s;Kr(()=>{a!==(a=r()??"")&&(s!==void 0&&(qe(s),s=void 0),a!==""&&(s=xr(()=>{var c=a+"",l=Pn(c);cr(kr(l),l.lastChild),o.before(l)})))})}function K(e,r,t,n,i){var s;var o=(s=r.$$slots)==null?void 0:s[t],a=!1;o===!0&&(o=r[t==="default"?"children":t],a=!0),o===void 0||o(e,a?()=>n:n)}function To(e,r,t,n,i,o){var a,s,c=null,l=e,u;Kr(()=>{const f=r()||null;var d=f==="svg"?Je:null;f!==a&&(u&&(f===null?bt(u,()=>{u=null,s=null}):f===s?yt(u):qe(u)),f&&f!==s&&(u=xr(()=>{if(c=d?document.createElementNS(d,f):document.createElement(f),cr(c,c),n){var m=c.appendChild(et());n(c,m)}M.nodes_end=c,l.before(c)})),a=f,a&&(s=a))},Wr)}function j(e,r){Pr(()=>{var t=e.getRootNode(),n=t.host?t:t.head??t.ownerDocument.head;if(!n.querySelector("#"+r.hash)){const i=document.createElement("style");i.id=r.hash,i.textContent=r.code,n.appendChild(i)}})}function le(e,r,t,n){var i=e.__attributes??(e.__attributes={});i[r]!==(i[r]=t)&&(r==="style"&&"__styles"in e&&(e.__styles={}),r==="loading"&&(e[Ui]=t),t==null?e.removeAttribute(r):typeof t!="string"&&On(e).includes(r)?e[r]=t:e.setAttribute(r,t))}function Ao(e,r,t,n,i=!1,o=!1,a=!1){var s={},c=e.tagName==="OPTION";for(var l in r)l in t||(t[l]=null);t.class=t.class?t.class+" "+n:n;var u=On(e),f=e.__attributes??(e.__attributes={}),d=[];for(const b in t){let I=t[b];if(c&&b==="value"&&I==null){e.value=e.__value="",s[b]=I;continue}var m=s[b];if(I!==m){s[b]=I;var w=b[0]+b[1];if(w!=="$$"){if(w==="on"){const A={},y="$$"+b;let O=b.slice(2);var g=bo(O);if(_o(O)&&(O=O.slice(0,-7),A.capture=!0),!g&&m){if(I!=null)continue;e.removeEventListener(O,s[y],A),s[y]=null}if(I!=null)if(g)e[`__${O}`]=I,go([O]);else{let V=function($){s[b].call(this,$)};d.push([b,I,()=>s[y]=xn(O,e,V,A)])}}else if(b==="style"&&I!=null)e.style.cssText=I+"";else if(b==="autofocus")vo(e,!!I);else if(b==="__value"||b==="value"&&I!=null)e.value=e[b]=e.__value=I;else{var T=b;i||(T=Eo(T)),I==null&&!o?(f[b]=null,e.removeAttribute(b)):u.includes(T)&&(o||typeof I!="string")?e[T]=I:typeof I!="function"&&le(e,T,I)}b==="style"&&"__styles"in e&&(e.__styles={})}}}return Pr(()=>{if(e.isConnected)for(const[b,I,A]of d)s[b]===I&&A()}),s}var An=new Map;function On(e){var r=An.get(e.nodeName);if(r)return r;An.set(e.nodeName,r=[]);for(var t,n=Be(e),i=Element.prototype;i!==n;){t=ae(n);for(var o in t)t[o].set&&r.push(o);n=Be(n)}return r}function kn(e,r){var t=e.__className,n=Oo(r);(t!==n||fo)&&(r==null?e.removeAttribute("class"):e.className=n,e.__className=n)}function Oo(e){return e??""}function ko(e,r,t=r){var n=Xr();ho(e,"input",()=>{var i=Nn(e)?Rn(e.value):e.value;t(i),n&&i!==(i=r())&&(e.value=i??"")}),Ir(()=>{var i=r();Nn(e)&&i===Rn(e.value)||e.type==="date"&&!i&&!e.value||i!==e.value&&(e.value=i??"")})}function Nn(e){var r=e.type;return r==="number"||r==="range"}function Rn(e){return e===""?null:+e}function tt(e,r,t){var n=Le(e,r);n&&n.set&&(e[r]=t,rn(()=>{e[r]=null}))}function Sn(e,r){return e===r||(e==null?void 0:e[tr])===r}function No(e={},r,t,n){return _t(()=>{var i,o;return Ir(()=>{i=o,o=[],sr(()=>{e!==t(...o)&&(r(e,...o),i&&Sn(t(...i),e)&&r(null,...i))})}),()=>{Pr(()=>{o&&Sn(t(...o),e)&&r(null,...o)})}}),e}function Un(e){return function(...r){var t=r[0];return t.preventDefault(),e==null?void 0:e.apply(this,r)}}function Te(e=!1){const r=U,t=r.l.u;if(!t)return;let n=()=>ee(r.s);if(e){let i=0,o={};const a=zr(()=>{let s=!1;const c=r.s;for(const l in c)c[l]!==o[l]&&(o[l]=c[l],s=!0);return s&&i++,i});n=()=>v(a)}t.b.length&&zi(()=>{Ln(r,n),dt(t.b)}),gt(()=>{const i=sr(()=>t.m.map(ki));return()=>{for(const o of i)typeof o=="function"&&o()}}),t.a.length&&gt(()=>{Ln(r,n),dt(t.a)})}function Ln(e,r){if(e.l.s)for(const t of e.l.s)v(t);r()}function $n(e,r){var o;var t=(o=e.$$events)==null?void 0:o[r.type],n=Me(t)?t.slice():t==null?[]:[t];for(var i of n)i.call(this,r)}function nt(e){U===null&&Qr(),N&&U.l!==null?Dn(U).m.push(e):gt(()=>{const r=sr(e);if(typeof r=="function")return r})}function Ro(e,r,{bubbles:t=!1,cancelable:n=!1}={}){return new CustomEvent(e,{detail:r,bubbles:t,cancelable:n})}function So(){const e=U;return e===null&&Qr(),(r,t,n)=>{var o;const i=(o=e.s.$$events)==null?void 0:o[r];if(i){const a=Me(i)?i.slice():[i],s=Ro(r,t,n);for(const c of a)c.call(e.x,s);return!s.defaultPrevented}return!0}}function Uo(e){U===null&&Qr(),U.l===null&&Fi(),Dn(U).b.push(e)}function Dn(e){var r=e.l;return r.u??(r.u={a:[],b:[],m:[]})}let it=!1;function Lo(e){var r=it;try{return it=!1,[e(),it]}finally{it=r}}function Mn(e){for(var r=M,t=M;r!==null&&!(r.f&(xe|Er));)r=r.parent;try{return Ne(r),e()}finally{Ne(t)}}function h(e,r,t,n){var V;var i=(t&Y)!==0,o=!N||(t&Z)!==0,a=(t&oe)!==0,s=(t&Hr)!==0,c=!1,l;a?[l,c]=Lo(()=>e[r]):l=e[r];var u=(V=Le(e,r))==null?void 0:V.set,f=n,d=!0,m=!1,w=()=>(m=!0,d&&(d=!1,s?f=sr(n):f=n),f);l===void 0&&n!==void 0&&(u&&o&&qi(),l=w(),u&&u(l));var g;if(o)g=()=>{var $=e[r];return $===void 0?w():(d=!0,m=!1,$)};else{var T=Mn(()=>(i?zr:he)(()=>e[r]));T.f|=Ri,g=()=>{var $=v(T);return $!==void 0&&(f=void 0),$===void 0?f:$}}if(!(t&Oe))return g;if(u){var b=e.$$legacy;return function($,H){return arguments.length>0?((!o||!H||b||c)&&u(H?g():$),$):g()}}var I=!1,A=!1,y=Kt(l),O=Mn(()=>zr(()=>{var $=g(),H=v(y);return I?(I=!1,A=!0,H):(A=!1,y.v=$)}));return i||(O.equals=pt),function($,H){if(arguments.length>0){const Q=H?v(O):o&&a?lr($):$;return O.equals(Q)||(I=!0,R(y,Q),m&&f!==void 0&&(f=Q),sr(()=>v(O))),$}return v(O)}}const $o={hash:"svelte-1bzqb13",code:".rcb-modal-section.svelte-1bzqb13 {padding:8px 0px;display:flex;}section.rcb-modal-section.svelte-1bzqb13 {flex-grow:1;}.rcb-modal-section.svelte-1bzqb13:last-of-type {padding:0;}"};function fr(e,r){j(e,$o);let t=h(r,"as",8,"section");var n=_e(),i=B(n);To(i,t,!1,(o,a)=>{Ao(o,null,{class:"rcb-modal-section"},"svelte-1bzqb13",o.namespaceURI===Je,o.nodeName.includes("-"));var s=_e(),c=B(s);K(c,r,"default",{}),p(a,s)}),p(e,n)}var ce=(e=>(e[e.Silent=0]="Silent",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Info=3]="Info",e[e.Debug=4]="Debug",e[e.Verbose=5]="Verbose",e))(ce||{});class C{static setLogLevel(r){this.logLevel=r}static log(r,t=this.logLevel){const n=`[Purchases] ${r}`;if(!(this.logLevel<t||t===ce.Silent))switch(t){case ce.Error:console.error(n);break;case ce.Warn:console.warn(n);break;case ce.Info:console.info(n);break;case ce.Debug:console.debug(n);break;case ce.Verbose:console.debug(n);break}}static errorLog(r){this.log(r,ce.Error)}static warnLog(r){this.log(r,ce.Warn)}static infoLog(r){this.log(r,ce.Info)}static debugLog(r){this.log(r,ce.Debug)}static verboseLog(r){this.log(r,ce.Verbose)}}D(C,"logLevel",ce.Silent);var De=(e=>(e.Year="year",e.Month="month",e.Week="week",e.Day="day",e))(De||{});function Ot(e){const r=e.match(/^PT?([0-9]+)([MDYW])$/);if(!r||r.length<3)return C.errorLog(`Invalid ISO 8601 duration format: ${e}`),null;const t=parseInt(r[1]);switch(r[2]){case"Y":return{number:t,unit:"year"};case"M":return{number:t,unit:"month"};case"W":return{number:t,unit:"week"};case"D":return{number:t,unit:"day"};default:return C.errorLog(`Invalid ISO 8601 unit duration format: ${e}`),null}}const Do=(e,r,t)=>{const n=e/1e6;return new Intl.NumberFormat(t,{style:"currency",currency:r}).format(n)},Mo=e=>{const r=e.number;if(r===1)switch(e.unit){case De.Year:return"yearly";case De.Month:return"monthly";case De.Week:return"weekly";case De.Day:return"daily"}else return`every ${r} ${e.unit}s`},Bo=e=>{const r=e.number;if(r===1)switch(e.unit){case De.Year:return"1 year";case De.Month:return"1 month";case De.Week:return"1 week";case De.Day:return"1 day"}else return`${r} ${e.unit}s`},Fo=e=>{const r=Ot(e);return r?Mo(r):"unknown"},qo=e=>{const r=Ot(e);return r?Bo(r):"unknown"};function jo(e){return e!=null}var Bn=(e=>(e.Unknown="unknown",e.Custom="custom",e.Lifetime="$rc_lifetime",e.Annual="$rc_annual",e.SixMonth="$rc_six_month",e.ThreeMonth="$rc_three_month",e.TwoMonth="$rc_two_month",e.Monthly="$rc_monthly",e.Weekly="$rc_weekly",e))(Bn||{}),dr=(e=>(e.Subscription="subscription",e.Consumable="consumable",e.NonConsumable="non_consumable",e))(dr||{});const Fn=e=>({amount:e.amount_micros/1e4,amountMicros:e.amount_micros,currency:e.currency,formattedPrice:Do(e.amount_micros,e.currency)}),qn=e=>{const r=e.period_duration;return{periodDuration:r,period:r?Ot(r):null,cycleCount:e.cycle_count,price:e.price?Fn(e.price):null}},Co=e=>e.base==null?(C.debugLog("Missing base phase for subscription option. Ignoring."),null):{id:e.id,priceId:e.price_id,base:qn(e.base),trial:e.trial?qn(e.trial):null},Ho=e=>e.base_price==null?(C.debugLog("Missing base price for non-subscription option. Ignoring."),null):{id:e.id,priceId:e.price_id,basePrice:Fn(e.base_price)},Vo=(e,r)=>{const t=e.product_type;return t==="subscription"?Yo(e,r,t):Go(e,r,t)},Go=(e,r,t)=>{const n={};if(Object.entries(e.purchase_options).forEach(([a,s])=>{const c=Ho(s);c!=null&&(n[a]=c)}),Object.keys(n).length===0)return C.debugLog(`Product ${e.identifier} has no purchase options. Ignoring.`),null;const i=e.default_purchase_option_id,o=i&&i in e.purchase_options?n[i]:null;return o==null?(C.debugLog(`Product ${e.identifier} has no default purchase option. Ignoring.`),null):{identifier:e.identifier,displayName:e.title,title:e.title,description:e.description,productType:t,currentPrice:o.basePrice,normalPeriodDuration:null,presentedOfferingIdentifier:r.offeringIdentifier,presentedOfferingContext:r,defaultPurchaseOption:o,defaultSubscriptionOption:null,subscriptionOptions:{},defaultNonSubscriptionOption:o}},Yo=(e,r,t)=>{const n={};if(Object.entries(e.purchase_options).forEach(([s,c])=>{const l=Co(c);l!=null&&(n[s]=l)}),Object.keys(n).length===0)return C.debugLog(`Product ${e.identifier} has no subscription options. Ignoring.`),null;const i=e.default_purchase_option_id,o=i&&i in n?n[i]:null;if(o==null)return C.debugLog(`Product ${e.identifier} has no default subscription option. Ignoring.`),null;const a=o.base.price;return a==null?(C.debugLog(`Product ${e.identifier} default option has no base price. Ignoring.`),null):{identifier:e.identifier,displayName:e.title,title:e.title,description:e.description,productType:t,currentPrice:a,normalPeriodDuration:o.base.periodDuration,presentedOfferingIdentifier:r.offeringIdentifier,presentedOfferingContext:r,defaultPurchaseOption:o,defaultSubscriptionOption:o,subscriptionOptions:n,defaultNonSubscriptionOption:null}},Wo=(e,r,t)=>{const n=t[r.platform_product_identifier];if(n===void 0)return null;const i=Vo(n,e);return i===null?null:{identifier:r.identifier,rcBillingProduct:i,packageType:Ko(r.identifier)}},zo=(e,r,t,n)=>{const i={offeringIdentifier:r.identifier,targetingContext:e&&n?{ruleId:n.rule_id,revision:n.revision}:null,placementIdentifier:null},o=r.packages.map(s=>Wo(i,s,t)).filter(jo),a={};for(const s of o)s!=null&&(a[s.identifier]=s);return o.length==0?null:{identifier:r.identifier,serverDescription:r.description,metadata:r.metadata,packagesById:a,availablePackages:o,lifetime:a.$rc_lifetime??null,annual:a.$rc_annual??null,sixMonth:a.$rc_six_month??null,threeMonth:a.$rc_three_month??null,twoMonth:a.$rc_two_month??null,monthly:a.$rc_monthly??null,weekly:a.$rc_weekly??null}};function Ko(e){switch(e){case"$rc_lifetime":return"$rc_lifetime";case"$rc_annual":return"$rc_annual";case"$rc_six_month":return"$rc_six_month";case"$rc_three_month":return"$rc_three_month";case"$rc_two_month":return"$rc_two_month";case"$rc_monthly":return"$rc_monthly";case"$rc_weekly":return"$rc_weekly";default:return e.startsWith("$rc_")?"unknown":"custom"}}var Qo=E('<span class="rcb-product-price-after-trial svelte-1mdrqnh"> </span>'),Zo=E('<span class="rcb-product-description svelte-1mdrqnh"> </span>'),Xo=E("<li> </li>"),Jo=E('<span class="rcb-product-price svelte-1mdrqnh"><!> <!></span> <!> <!> <ul class="rcb-product-details svelte-1mdrqnh"><!> <li>Continues until canceled</li> <li>Cancel anytime</li></ul>',1),ea=E('<span class="rcb-product-description svelte-1mdrqnh"> </span>'),ra=E('<span class="rcb-product-price svelte-1mdrqnh"> </span> <!>',1),ta=E('<div class="rcb-pricing-info svelte-1mdrqnh"><span class="rc-product-title"> </span> <!> <!></div>');const na={hash:"svelte-1mdrqnh",code:`.rcb-pricing-info.svelte-1mdrqnh {display:flex;flex-direction:column;margin-top:102px;font-weight:500;}.rcb-product-price.svelte-1mdrqnh {color:var(--rc-color-grey-text-dark);font-size:24px;margin:12px 0px;}.rcb-product-description.svelte-1mdrqnh {color:var(--rc-color-grey-text-dark);margin:0 0 12px 0;}.rcb-product-price-after-trial.svelte-1mdrqnh {margin-bottom:12px;}.rcb-product-details.svelte-1mdrqnh {color:var(--rc-color-grey-text-light);list-style-type:disc;list-style-position:inside;margin:0px;padding:0px;}
2
+
3
+ @media screen and (max-width: 960px) {.rcb-pricing-info.svelte-1mdrqnh {margin-top:48px;}
4
+ }`};function jn(e,r){var f;we(r,!1),j(e,na);let t=h(r,"productDetails",8),n=h(r,"purchaseOption",8),i=h(r,"brandingAppearance",8,void 0);const o=t().productType===dr.Subscription,a=n(),s=n(),c=a==null?void 0:a.trial,l=(f=a==null?void 0:a.base)==null?void 0:f.price,u=s==null?void 0:s.basePrice;Te(),fr(e,{children:(d,m)=>{var w=ta(),g=x(w),T=x(g),b=L(g,2);F(b,()=>o,A=>{var y=Jo(),O=B(y),V=x(O);F(V,()=>c==null?void 0:c.periodDuration,S=>{var W=We();G(()=>se(W,`${qo(c.periodDuration)??""} free trial`)),p(S,W)});var $=L(V,2);F($,()=>!(c!=null&&c.periodDuration)&&l,S=>{var W=We();G(()=>se(W,l.formattedPrice)),p(S,W)});var H=L(O,2);F(H,()=>c&&l,S=>{var W=Qo(),be=x(W);G(()=>se(be,c&&l&&`${l.formattedPrice} after end of trial`)),p(S,W)});var Q=L(H,2);F(Q,()=>{var S;return((S=i())==null?void 0:S.show_product_description)&&t().description},S=>{var W=Zo(),be=x(W);G(()=>se(be,t().description)),p(S,W)});var me=L(Q,2),Ke=x(me);F(Ke,()=>t().normalPeriodDuration,S=>{var W=Xo(),be=x(W);G(()=>se(be,`Renews ${Fo(t().normalPeriodDuration)??""}`)),p(S,W)}),p(A,y)});var I=L(b,2);F(I,()=>!o,A=>{var y=ra(),O=B(y),V=x(O),$=L(O,2);F($,()=>{var H;return(H=i())==null?void 0:H.show_product_description},H=>{var Q=ea(),me=x(Q);G(()=>se(me,t().description)),p(H,Q)}),G(()=>se(V,u==null?void 0:u.formattedPrice)),p(A,y)}),G(()=>se(T,t().title)),p(d,w)},$$slots:{default:!0}}),Ie()}const ia='<svg width="80" height="80" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg" transform="rotate(0 0 0)"><path d="M12 3.5C7.30558 3.5 3.5 7.30558 3.5 12C3.5 16.6944 7.30558 20.5 12 20.5C16.6944 20.5 20.5 16.6944 20.5 12C20.5 11.5858 20.8358 11.25 21.25 11.25C21.6642 11.25 22 11.5858 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C12.4142 2 12.75 2.33579 12.75 2.75C12.75 3.16421 12.4142 3.5 12 3.5Z" fill="currentColor"/></svg>';var oa=E('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-16h2a8k"><!></div>');const aa={hash:"svelte-16h2a8k",code:`
5
+ @-webkit-keyframes svelte-16h2a8k-rotating /* Safari and Chrome */ {
6
+ from {
7
+ -webkit-transform: rotate(0deg);
8
+ -o-transform: rotate(0deg);
9
+ transform: rotate(0deg);
10
+ }
11
+ to {
12
+ -webkit-transform: rotate(360deg);
13
+ -o-transform: rotate(360deg);
14
+ transform: rotate(360deg);
15
+ }
16
+ }
17
+ @keyframes svelte-16h2a8k-rotating {
18
+ from {
19
+ -ms-transform: rotate(0deg);
20
+ -moz-transform: rotate(0deg);
21
+ -webkit-transform: rotate(0deg);
22
+ -o-transform: rotate(0deg);
23
+ transform: rotate(0deg);
24
+ }
25
+ to {
26
+ -ms-transform: rotate(360deg);
27
+ -moz-transform: rotate(360deg);
28
+ -webkit-transform: rotate(360deg);
29
+ -o-transform: rotate(360deg);
30
+ transform: rotate(360deg);
31
+ }
32
+ }div.svelte-16h2a8k {width:80px;height:80px;
33
+ -webkit-animation: svelte-16h2a8k-rotating 2s ease-in-out infinite;
34
+ -moz-animation: svelte-16h2a8k-rotating 2s ease-in-out infinite;
35
+ -ms-animation: svelte-16h2a8k-rotating 2s ease-in-out infinite;
36
+ -o-animation: svelte-16h2a8k-rotating 2s ease-in-out infinite;
37
+ animation: svelte-16h2a8k-rotating 2s ease-in-out infinite;}`};function sa(e){j(e,aa);var r=oa(),t=x(r);Rr(t,()=>ia),p(e,r)}var la=E('<div class="rcb-modal-loader svelte-l57ojl"><!></div>');const ca={hash:"svelte-l57ojl",code:".rcb-modal-loader.svelte-l57ojl {width:100%;flex-grow:1;min-height:100%;display:flex;justify-content:center;align-items:center;}"};function kt(e){j(e,ca);var r=la(),t=x(r);sa(t),p(e,r)}var re=(e=>(e[e.UnknownError=0]="UnknownError",e[e.UserCancelledError=1]="UserCancelledError",e[e.StoreProblemError=2]="StoreProblemError",e[e.PurchaseNotAllowedError=3]="PurchaseNotAllowedError",e[e.PurchaseInvalidError=4]="PurchaseInvalidError",e[e.ProductNotAvailableForPurchaseError=5]="ProductNotAvailableForPurchaseError",e[e.ProductAlreadyPurchasedError=6]="ProductAlreadyPurchasedError",e[e.ReceiptAlreadyInUseError=7]="ReceiptAlreadyInUseError",e[e.InvalidReceiptError=8]="InvalidReceiptError",e[e.MissingReceiptFileError=9]="MissingReceiptFileError",e[e.NetworkError=10]="NetworkError",e[e.InvalidCredentialsError=11]="InvalidCredentialsError",e[e.UnexpectedBackendResponseError=12]="UnexpectedBackendResponseError",e[e.InvalidAppUserIdError=14]="InvalidAppUserIdError",e[e.OperationAlreadyInProgressError=15]="OperationAlreadyInProgressError",e[e.UnknownBackendError=16]="UnknownBackendError",e[e.InvalidAppleSubscriptionKeyError=17]="InvalidAppleSubscriptionKeyError",e[e.IneligibleError=18]="IneligibleError",e[e.InsufficientPermissionsError=19]="InsufficientPermissionsError",e[e.PaymentPendingError=20]="PaymentPendingError",e[e.InvalidSubscriberAttributesError=21]="InvalidSubscriberAttributesError",e[e.LogOutWithAnonymousUserError=22]="LogOutWithAnonymousUserError",e[e.ConfigurationError=23]="ConfigurationError",e[e.UnsupportedError=24]="UnsupportedError",e[e.EmptySubscriberAttributesError=25]="EmptySubscriberAttributesError",e[e.CustomerInfoError=28]="CustomerInfoError",e[e.SignatureVerificationError=36]="SignatureVerificationError",e[e.InvalidEmailError=38]="InvalidEmailError",e))(re||{});class Sr{static getPublicMessage(r){switch(r){case 0:return"Unknown error.";case 1:return"Purchase was cancelled.";case 2:return"There was a problem with the store.";case 3:return"The device or user is not allowed to make the purchase.";case 4:return"One or more of the arguments provided are invalid.";case 5:return"The product is not available for purchase.";case 6:return"This product is already active for the user.";case 7:return"There is already another active subscriber using the same receipt.";case 8:return"The receipt is not valid.";case 9:return"The receipt is missing.";case 10:return"Error performing request. Please check your network connection and try again.";case 11:return"There was a credentials issue. Check the underlying error for more details.";case 12:return"Received unexpected response from the backend.";case 14:return"The app user id is not valid.";case 15:return"The operation is already in progress.";case 16:return"There was an unknown backend error.";case 17:return"Apple Subscription Key is invalid or not present. In order to provide subscription offers, you must first generate a subscription key. Please see https://docs.revenuecat.com/docs/ios-subscription-offers for more info.";case 18:return"The User is ineligible for that action.";case 19:return"App does not have sufficient permissions to make purchases.";case 20:return"The payment is pending.";case 21:return"One or more of the attributes sent could not be saved.";case 22:return"Called logOut but the current user is anonymous.";case 23:return"There is an issue with your configuration. Check the underlying error for more details.";case 24:return"There was a problem with the operation. Looks like we doesn't support that yet. Check the underlying error for more details.";case 25:return"A request for subscriber attributes returned none.";case 28:return"There was a problem related to the customer info.";case 36:return"Request failed signature verification. Please see https://rev.cat/trusted-entitlements for more info.";case 38:return"Email is not valid. Please provide a valid email address."}}static getErrorCodeForBackendErrorCode(r){switch(r){case 7101:case 7773:return 2;case 7102:return 7;case 7103:return 8;case 7107:case 7224:case 7225:return 11;case 7105:case 7106:case 7814:return 4;case 7772:return 6;case 7220:return 14;case 7229:return 2;case 7230:case 7e3:return 23;case 7231:return 2;case 7232:return 18;case 7263:case 7264:return 21;case 7104:case 7234:case 7226:case 7110:return 12;case 7662:return 24;case 7012:case 7834:return 38}}static convertCodeToBackendErrorCode(r){return r in Cn?r:null}static convertPurchaseFlowErrorCodeToErrorCode(r){switch(r){case ie.ErrorSettingUpPurchase:return 2;case ie.ErrorChargingPayment:return 20;case ie.NetworkError:return 10;case ie.MissingEmailError:return 4;case ie.StripeError:return 2;case ie.UnknownError:return 0;case ie.AlreadyPurchasedError:return 6}}}var Cn=(e=>(e[e.BackendInvalidPlatform=7e3]="BackendInvalidPlatform",e[e.BackendInvalidEmail=7012]="BackendInvalidEmail",e[e.BackendStoreProblem=7101]="BackendStoreProblem",e[e.BackendCannotTransferPurchase=7102]="BackendCannotTransferPurchase",e[e.BackendInvalidReceiptToken=7103]="BackendInvalidReceiptToken",e[e.BackendInvalidAppStoreSharedSecret=7104]="BackendInvalidAppStoreSharedSecret",e[e.BackendInvalidPaymentModeOrIntroPriceNotProvided=7105]="BackendInvalidPaymentModeOrIntroPriceNotProvided",e[e.BackendProductIdForGoogleReceiptNotProvided=7106]="BackendProductIdForGoogleReceiptNotProvided",e[e.BackendInvalidPlayStoreCredentials=7107]="BackendInvalidPlayStoreCredentials",e[e.BackendInternalServerError=7110]="BackendInternalServerError",e[e.BackendEmptyAppUserId=7220]="BackendEmptyAppUserId",e[e.BackendInvalidAuthToken=7224]="BackendInvalidAuthToken",e[e.BackendInvalidAPIKey=7225]="BackendInvalidAPIKey",e[e.BackendBadRequest=7226]="BackendBadRequest",e[e.BackendPlayStoreQuotaExceeded=7229]="BackendPlayStoreQuotaExceeded",e[e.BackendPlayStoreInvalidPackageName=7230]="BackendPlayStoreInvalidPackageName",e[e.BackendPlayStoreGenericError=7231]="BackendPlayStoreGenericError",e[e.BackendUserIneligibleForPromoOffer=7232]="BackendUserIneligibleForPromoOffer",e[e.BackendInvalidAppleSubscriptionKey=7234]="BackendInvalidAppleSubscriptionKey",e[e.BackendInvalidSubscriberAttributes=7263]="BackendInvalidSubscriberAttributes",e[e.BackendInvalidSubscriberAttributesBody=7264]="BackendInvalidSubscriberAttributesBody",e[e.BackendProductIDsMalformed=7662]="BackendProductIDsMalformed",e[e.BackendAlreadySubscribedError=7772]="BackendAlreadySubscribedError",e[e.BackendPaymentGatewayGenericError=7773]="BackendPaymentGatewayGenericError",e[e.BackendOfferNotFound=7814]="BackendOfferNotFound",e[e.BackendNoMXRecordsFound=7834]="BackendNoMXRecordsFound",e))(Cn||{});class X extends Error{constructor(t,n,i,o){super(n);D(this,"toString",()=>`PurchasesError(code: ${re[this.errorCode]}, message: ${this.message})`);this.errorCode=t,this.underlyingErrorMessage=i,this.extra=o}static getForBackendError(t,n){const i=Sr.getErrorCodeForBackendErrorCode(t);return new X(i,Sr.getPublicMessage(i),n,{backendErrorCode:t})}static getForPurchasesFlowError(t){return new X(Sr.convertPurchaseFlowErrorCodeToErrorCode(t.errorCode),t.message,t.underlyingErrorMessage)}}class Hn extends Error{constructor(){super("Purchases must be configured before calling getInstance")}}var Ur=(e=>(e.Started="started",e.InProgress="in_progress",e.Succeeded="succeeded",e.Failed="failed",e))(Ur||{}),vr=(e=>(e[e.SetupIntentCreationFailed=1]="SetupIntentCreationFailed",e[e.PaymentMethodCreationFailed=2]="PaymentMethodCreationFailed",e[e.PaymentChargeFailed=3]="PaymentChargeFailed",e[e.SetupIntentCompletionFailed=4]="SetupIntentCompletionFailed",e[e.AlreadyPurchased=5]="AlreadyPurchased",e))(vr||{});function ua(e){var r;return e.operation.redemption_info?{redeemUrl:((r=e.operation.redemption_info)==null?void 0:r.redeem_url)??null}:null}var ie=(e=>(e[e.ErrorSettingUpPurchase=0]="ErrorSettingUpPurchase",e[e.ErrorChargingPayment=1]="ErrorChargingPayment",e[e.UnknownError=2]="UnknownError",e[e.NetworkError=3]="NetworkError",e[e.StripeError=4]="StripeError",e[e.MissingEmailError=5]="MissingEmailError",e[e.AlreadyPurchasedError=6]="AlreadyPurchasedError",e))(ie||{});class z extends Error{constructor(r,t,n,i,o){super(t),this.errorCode=r,this.underlyingErrorMessage=n,this.purchasesErrorCode=i,this.extra=o}isRecoverable(){switch(this.errorCode){case 3:case 5:return!0;case 0:case 1:case 6:case 4:case 2:return!1}}getPublicErrorMessage(r){var n;const t=((n=this.extra)==null?void 0:n.backendErrorCode)??this.purchasesErrorCode??this.errorCode;switch(this.errorCode){case 2:return`An unknown error occurred. Error code: ${t}.`;case 0:return`Purchase not started due to an error. Error code: ${t}.`;case 1:return"Payment failed.";case 3:return"Network error. Please check your internet connection.";case 4:return this.message;case 5:return"Email is required to complete the purchase.";case 6:return(r==null?void 0:r.productType)===dr.Subscription?"You are already subscribed to this product.":"You have already purchased this product."}}static fromPurchasesError(r,t){let n;return r.errorCode===re.ProductAlreadyPurchasedError?n=6:r.errorCode===re.InvalidEmailError?n=5:r.errorCode===re.NetworkError?n=3:n=t,new z(n,r.message,r.underlyingErrorMessage,r.errorCode,r.extra)}}class fa{constructor(r,t=10){D(this,"operationSessionId",null);D(this,"backend");D(this,"maxNumberAttempts");D(this,"waitMSBetweenAttempts",1e3);this.backend=r,this.maxNumberAttempts=t}async startPurchase(r,t,n,i,o){try{const a=await this.backend.postPurchase(r,t,i,o,n);return this.operationSessionId=a.operation_session_id,a}catch(a){if(a instanceof X)throw z.fromPurchasesError(a,0);{const s="Unknown error starting purchase: "+String(a);throw C.errorLog(s),new z(2,s)}}}async pollCurrentPurchaseForCompletion(){const r=this.operationSessionId;if(!r)throw new z(0,"No purchase in progress");return new Promise((t,n)=>{const i=(o=1)=>{if(o>this.maxNumberAttempts){this.clearPurchaseInProgress(),n(new z(2,"Max attempts reached trying to get successful purchase status"));return}this.backend.getCheckoutStatus(r).then(a=>{switch(a.operation.status){case Ur.Started:case Ur.InProgress:setTimeout(()=>i(o+1),this.waitMSBetweenAttempts);break;case Ur.Succeeded:this.clearPurchaseInProgress(),t({redemptionInfo:ua(a)});return;case Ur.Failed:this.clearPurchaseInProgress(),this.handlePaymentError(a.operation.error,n)}}).catch(a=>{const s=z.fromPurchasesError(a,3);n(s)})};i()})}clearPurchaseInProgress(){this.operationSessionId=null}handlePaymentError(r,t){if(r==null){t(new z(2,"Got an error status but error field is empty."));return}switch(r.code){case vr.SetupIntentCreationFailed:t(new z(0,"Setup intent creation failed"));return;case vr.PaymentMethodCreationFailed:t(new z(0,"Payment method creation failed"));return;case vr.PaymentChargeFailed:t(new z(1,"Payment charge failed"));return;case vr.SetupIntentCompletionFailed:t(new z(0,"Setup intent completion failed"));return;case vr.AlreadyPurchased:t(new z(6,"Purchased was already completed"));return;default:t(new z(2,"Unknown error code received"));return}}}const da=`<svg width="96" height="96" viewBox="0 0 124 124" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
2
38
  <circle cx="62" cy="62" r="62" fill="currentColor"/>
3
39
  <path d="M87.6668 41.504L82.4968 36.334L62.0002 56.8307L41.5035 36.334L36.3335 41.504L56.8302 62.0006L36.3335 82.4973L41.5035 87.6673L62.0002 67.1706L82.4968 87.6673L87.6668 82.4973L67.1702 62.0006L87.6668 41.504Z"
4
40
  fill="white"/>
5
41
  </svg>
6
- `;function Mr(t){R(t,"svelte-7wiquz",".rcb-ui-asset-icon.svelte-7wiquz{width:96px;height:96px;margin:0 auto}")}function Dr(t){let e;return{c(){e=I("div"),fe(e,"color","var(--rc-color-error)"),b(e,"class","rcb-ui-asset-icon svelte-7wiquz")},m(n,r){g(n,e,r),e.innerHTML=Sr},p:h,i:h,o:h,d(n){n&&_(e)}}}class Br extends F{constructor(e){super(),C(this,e,null,Dr,A,{},Mr)}}function Cr(t){R(t,"svelte-2xwwo","button.svelte-2xwwo{border:none;border-radius:var(--rc-shape-input-button-border-radius);font-size:16px;cursor:pointer;height:56px;color:var(--rc-color-grey-text-dark);background-color:var(--rc-color-grey-ui-dark);display:flex;align-items:center;justify-content:center;-webkit-tap-highlight-color:rgba(0, 0, 0, 0);-webkit-tap-highlight-color:transparent}button.svelte-2xwwo:focus,button.svelte-2xwwo:active{outline:2px solid var(--rc-color-focus)}button.intent-primary.svelte-2xwwo{background-color:var(--rc-color-primary);color:var(--rc-color-primary-text);font-size:16px}button.svelte-2xwwo:disabled{color:var(--rc-color-grey-text-light);background-color:var(--rc-color-grey-ui-dark)}button.intent-primary.svelte-2xwwo:disabled{color:var(--rc-color-grey-text-light);background-color:var(--rc-color-grey-ui-dark)}")}function Fr(t){let e,n,r,i,o;const s=t[5].default,l=H(s,t,t[4],null);return{c(){e=I("button"),l&&l.c(),b(e,"class",n=re(`intent-${t[0]}`)+" svelte-2xwwo"),e.disabled=t[1],b(e,"data-testid",t[2]),b(e,"type",t[3])},m(a,c){g(a,e,c),l&&l.m(e,null),r=!0,i||(o=Te(e,"click",t[6]),i=!0)},p(a,[c]){l&&l.p&&(!r||c&16)&&W(l,s,a,a[4],r?z(s,a[4],c,null):K(a[4]),null),(!r||c&1&&n!==(n=re(`intent-${a[0]}`)+" svelte-2xwwo"))&&b(e,"class",n),(!r||c&2)&&(e.disabled=a[1]),(!r||c&4)&&b(e,"data-testid",a[2]),(!r||c&8)&&b(e,"type",a[3])},i(a){r||(d(l,a),r=!0)},o(a){p(l,a),r=!1},d(a){a&&_(e),l&&l.d(a),i=!1,o()}}}function jr(t,e,n){let{$$slots:r={},$$scope:i}=e,{intent:o="primary"}=e,{disabled:s=!1}=e,{testId:l=void 0}=e,{type:a=void 0}=e;function c(u){It.call(this,t,u)}return t.$$set=u=>{"intent"in u&&n(0,o=u.intent),"disabled"in u&&n(1,s=u.disabled),"testId"in u&&n(2,l=u.testId),"type"in u&&n(3,a=u.type),"$$scope"in u&&n(4,i=u.$$scope)},[o,s,l,a,i,r,c]}class it extends F{constructor(e){super(),C(this,e,jr,Fr,A,{intent:0,disabled:1,testId:2,type:3},Cr)}}function Hr(t){R(t,"svelte-1f9z0o8","footer.svelte-1f9z0o8{display:flex;flex-direction:column}")}function qr(t){let e,n;const r=t[1].default,i=H(r,t,t[0],null);return{c(){e=I("footer"),i&&i.c(),b(e,"class","rcb-modal-footer svelte-1f9z0o8")},m(o,s){g(o,e,s),i&&i.m(e,null),n=!0},p(o,[s]){i&&i.p&&(!n||s&1)&&W(i,r,o,o[0],n?z(r,o[0],s,null):K(o[0]),null)},i(o){n||(d(i,o),n=!0)},o(o){p(i,o),n=!1},d(o){o&&_(e),i&&i.d(o)}}}function xr(t,e,n){let{$$slots:r={},$$scope:i}=e;return t.$$set=o=>{"$$scope"in o&&n(0,i=o.$$scope)},[i,r]}class ot extends F{constructor(e){super(),C(this,e,xr,qr,A,{},Hr)}}function Gr(t){R(t,"svelte-6o8e90",'.column.svelte-6o8e90{display:flex;flex-direction:column;justify-content:flex-start;gap:var(--gap, "8px");flex-grow:1}')}function Vr(t){let e,n,r;const i=t[2].default,o=H(i,t,t[1],null);return{c(){e=I("div"),o&&o.c(),b(e,"class","column svelte-6o8e90"),b(e,"style",n=`--gap:${t[0]};`)},m(s,l){g(s,e,l),o&&o.m(e,null),r=!0},p(s,[l]){o&&o.p&&(!r||l&2)&&W(o,i,s,s[1],r?z(i,s[1],l,null):K(s[1]),null),(!r||l&1&&n!==(n=`--gap:${s[0]};`))&&b(e,"style",n)},i(s){r||(d(o,s),r=!0)},o(s){p(o,s),r=!1},d(s){s&&_(e),o&&o.d(s)}}}function Yr(t,e,n){let{$$slots:r={},$$scope:i}=e,{gutter:o="8px"}=e;return t.$$set=s=>{"gutter"in s&&n(0,o=s.gutter),"$$scope"in s&&n(1,i=s.$$scope)},[o,i,r]}class Le extends F{constructor(e){super(),C(this,e,Yr,Vr,A,{gutter:0},Gr)}}const zr="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='mdi_close'%3e%3cpath%20id='Vector'%20d='M19%206.41L17.59%205L12%2010.59L6.41%205L5%206.41L10.59%2012L5%2017.59L6.41%2019L12%2013.41L17.59%2019L19%2017.59L13.41%2012L19%206.41Z'%20fill='%23767676'/%3e%3c/g%3e%3c/svg%3e";function Wr(t){R(t,"svelte-1hv9ta1",".close-button.svelte-1hv9ta1{border:none;cursor:pointer;background-color:transparent;padding:0px;height:24px;border-radius:50%}.close-button.svelte-1hv9ta1:focus{outline:2px solid var(--rc-color-focus)}")}function Kr(t){let e,n,r,i,o;return{c(){e=I("button"),n=I("img"),ce(n.src,r=zr)||b(n,"src",r),b(n,"alt","close"),b(e,"class","close-button svelte-1hv9ta1"),e.disabled=t[0]},m(s,l){g(s,e,l),L(e,n),i||(o=Te(e,"click",t[1]),i=!0)},p(s,[l]){l&1&&(e.disabled=s[0])},i:h,o:h,d(s){s&&_(e),i=!1,o()}}}function Qr(t,e,n){let{disabled:r=!1}=e;function i(o){It.call(this,t,o)}return t.$$set=o=>{"disabled"in o&&n(0,r=o.disabled)},[r,i]}class st extends F{constructor(e){super(),C(this,e,Qr,Kr,A,{disabled:0},Wr)}}function Xr(t){R(t,"svelte-44qpq9",".rcb-app-icon.svelte-44qpq9{width:40px;height:40px;border-radius:12px;box-shadow:0px 1px 10px 0px rgba(0, 0, 0, 0.1);margin-right:16px}.rcb-app-icon-picture-container.svelte-44qpq9{height:40px}.rcb-app-icon.loading.svelte-44qpq9{background-color:gray}")}function Zr(t){let e;return{c(){e=I("div"),b(e,"class","rcb-app-icon loading svelte-44qpq9")},m(n,r){g(n,e,r)},p:h,d(n){n&&_(e)}}}function Jr(t){let e,n,r,i,o,s;return{c(){e=I("picture"),n=I("source"),i=S(),o=I("img"),b(n,"type","image/webp"),j(n,r=t[1])||b(n,"srcset",r),b(o,"class","rcb-app-icon svelte-44qpq9"),ce(o.src,s=t[0])||b(o,"src",s),b(o,"alt","App icon"),b(e,"class","rcb-app-icon-picture-container svelte-44qpq9")},m(l,a){g(l,e,a),L(e,n),L(e,i),L(e,o)},p(l,a){a&2&&r!==(r=l[1])&&b(n,"srcset",r),a&1&&!ce(o.src,s=l[0])&&b(o,"src",s)},d(l){l&&_(e)}}}function ei(t){let e;function n(o,s){return o[0]!==null?Jr:Zr}let r=n(t),i=r(t);return{c(){i.c(),e=ae()},m(o,s){i.m(o,s),g(o,e,s)},p(o,[s]){r===(r=n(o))&&i?i.p(o,s):(i.d(1),i=r(o),i&&(i.c(),i.m(e.parentNode,e)))},i:h,o:h,d(o){o&&_(e),i.d(o)}}}function ti(t,e,n){let{src:r=null}=e,{srcWebp:i=null}=e;return t.$$set=o=>{"src"in o&&n(0,r=o.src),"srcWebp"in o&&n(1,i=o.srcWebp)},[r,i]}class St extends F{constructor(e){super(),C(this,e,ti,ei,A,{src:0,srcWebp:1},Xr)}}const xe=t=>`https://da08ctfrofx1b.cloudfront.net/${t}`;function ni(t){R(t,"svelte-10uf5fq",".app-title.svelte-10uf5fq{font-weight:500;margin:8px 0;font-size:16px}.rcb-header-layout__business-info.svelte-10uf5fq{display:flex;align-items:center}")}function ri(t){let e,n;return e=new St({}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p:h,i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function ii(t){let e,n,r=t[0].seller_company_name+"",i,o,s=t[0].app_icon_webp!==null&&t[0].app_icon!==null&&Mt(t);return{c(){s&&s.c(),e=S(),n=I("span"),i=V(r),b(n,"class","app-title svelte-10uf5fq")},m(l,a){s&&s.m(l,a),g(l,e,a),g(l,n,a),L(n,i),o=!0},p(l,a){l[0].app_icon_webp!==null&&l[0].app_icon!==null?s?(s.p(l,a),a&1&&d(s,1)):(s=Mt(l),s.c(),d(s,1),s.m(e.parentNode,e)):s&&(X(),p(s,1,1,()=>{s=null}),Z()),(!o||a&1)&&r!==(r=l[0].seller_company_name+"")&&ue(i,r)},i(l){o||(d(s),o=!0)},o(l){p(s),o=!1},d(l){l&&(_(e),_(n)),s&&s.d(l)}}}function Mt(t){let e,n;return e=new St({props:{src:xe(t[0].app_icon),srcWebp:xe(t[0].app_icon_webp)}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p(r,i){const o={};i&1&&(o.src=xe(r[0].app_icon)),i&1&&(o.srcWebp=xe(r[0].app_icon_webp)),e.$set(o)},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function oi(t){let e,n,r,i;const o=[ii,ri],s=[];function l(a,c){return a[0]!==null?0:1}return n=l(t),r=s[n]=o[n](t),{c(){e=I("div"),r.c(),b(e,"class","rcb-header-layout__business-info svelte-10uf5fq")},m(a,c){g(a,e,c),s[n].m(e,null),i=!0},p(a,[c]){let u=n;n=l(a),n===u?s[n].p(a,c):(X(),p(s[u],1,1,()=>{s[u]=null}),Z(),r=s[n],r?r.p(a,c):(r=s[n]=o[n](a),r.c()),d(r,1),r.m(e,null))},i(a){i||(d(r),i=!0)},o(a){p(r),i=!1},d(a){a&&_(e),s[n].d()}}}function si(t,e,n){let{brandingInfo:r=null}=e;return t.$$set=i=>{"brandingInfo"in i&&n(0,r=i.brandingInfo)},[r]}class Dt extends F{constructor(e){super(),C(this,e,si,oi,A,{brandingInfo:0},ni)}}function li(t){R(t,"svelte-17puakv",".rcb-post-purchase-header-layout.svelte-17puakv{display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:-4px}")}function ai(t){let e,n,r,i,o;return n=new Dt({props:{brandingInfo:t[0]}}),i=new st({}),i.$on("click",function(){ne(t[1])&&t[1].apply(this,arguments)}),{c(){e=I("div"),T(n.$$.fragment),r=S(),T(i.$$.fragment),b(e,"class","rcb-post-purchase-header-layout svelte-17puakv")},m(s,l){g(s,e,l),k(n,e,null),L(e,r),k(i,e,null),o=!0},p(s,l){t=s;const a={};l&1&&(a.brandingInfo=t[0]),n.$set(a)},i(s){o||(d(n.$$.fragment,s),d(i.$$.fragment,s),o=!0)},o(s){p(n.$$.fragment,s),p(i.$$.fragment,s),o=!1},d(s){s&&_(e),P(n),P(i)}}}function ci(t){let e,n;return e=new Ee({props:{as:"header",$$slots:{default:[ai]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p(r,[i]){const o={};i&7&&(o.$$scope={dirty:i,ctx:r}),e.$set(o)},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function ui(t,e,n){let{brandingInfo:r=null}=e,{onClose:i}=e;return t.$$set=o=>{"brandingInfo"in o&&n(0,r=o.brandingInfo),"onClose"in o&&n(1,i=o.onClose)},[r,i]}class fi extends F{constructor(e){super(),C(this,e,ui,ci,A,{brandingInfo:0,onClose:1},li)}}function di(t){R(t,"svelte-idou50",".rcb-modal-message.svelte-idou50{width:100%;min-height:160px;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;margin-bottom:16px;margin-top:16px}.title.svelte-idou50{font-size:24px;line-height:1.25em}.subtitle.svelte-idou50{font-size:16px;line-height:1.25em;overflow-wrap:anywhere}")}const pi=t=>({}),Bt=t=>({});function mi(t){let e,n,r,i,o;const s=t[5].default,l=H(s,t,t[6],null);return{c(){e=I("span"),n=V(t[2]),r=S(),i=I("span"),l&&l.c(),b(e,"class","title svelte-idou50"),b(i,"class","subtitle svelte-idou50")},m(a,c){g(a,e,c),L(e,n),g(a,r,c),g(a,i,c),l&&l.m(i,null),o=!0},p(a,c){(!o||c&4)&&ue(n,a[2]),l&&l.p&&(!o||c&64)&&W(l,s,a,a[6],o?z(s,a[6],c,null):K(a[6]),null)},i(a){o||(d(l,a),o=!0)},o(a){p(l,a),o=!1},d(a){a&&(_(e),_(r),_(i)),l&&l.d(a)}}}function _i(t){let e,n,r;const i=t[5].icon,o=H(i,t,t[6],Bt);return n=new Le({props:{gutter:"16px",$$slots:{default:[mi]},$$scope:{ctx:t}}}),{c(){o&&o.c(),e=S(),T(n.$$.fragment)},m(s,l){o&&o.m(s,l),g(s,e,l),k(n,s,l),r=!0},p(s,l){o&&o.p&&(!r||l&64)&&W(o,i,s,s[6],r?z(i,s[6],l,pi):K(s[6]),Bt);const a={};l&68&&(a.$$scope={dirty:l,ctx:s}),n.$set(a)},i(s){r||(d(o,s),d(n.$$.fragment,s),r=!0)},o(s){p(o,s),p(n.$$.fragment,s),r=!1},d(s){s&&_(e),o&&o.d(s),P(n,s)}}}function gi(t){let e,n,r;return n=new Le({props:{gutter:"48px",$$slots:{default:[_i]},$$scope:{ctx:t}}}),{c(){e=I("div"),T(n.$$.fragment),b(e,"class","rcb-modal-message svelte-idou50"),b(e,"data-type",t[3])},m(i,o){g(i,e,o),k(n,e,null),r=!0},p(i,o){const s={};o&68&&(s.$$scope={dirty:o,ctx:i}),n.$set(s),(!r||o&8)&&b(e,"data-type",i[3])},i(i){r||(d(n.$$.fragment,i),r=!0)},o(i){p(n.$$.fragment,i),r=!1},d(i){i&&_(e),P(n)}}}function hi(t){let e;return{c(){e=V(t[4])},m(n,r){g(n,e,r)},p(n,r){r&16&&ue(e,n[4])},d(n){n&&_(e)}}}function bi(t){let e,n;return e=new it({props:{type:"submit",$$slots:{default:[hi]},$$scope:{ctx:t}}}),e.$on("click",function(){ne(t[1])&&t[1].apply(this,arguments)}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p(r,i){t=r;const o={};i&80&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function wi(t){let e,n,r,i,o,s;return e=new fi({props:{brandingInfo:t[0],onClose:t[1]}}),r=new Ee({props:{$$slots:{default:[gi]},$$scope:{ctx:t}}}),o=new ot({props:{$$slots:{default:[bi]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment),n=S(),T(r.$$.fragment),i=S(),T(o.$$.fragment)},m(l,a){k(e,l,a),g(l,n,a),k(r,l,a),g(l,i,a),k(o,l,a),s=!0},p(l,a){const c={};a&1&&(c.brandingInfo=l[0]),a&2&&(c.onClose=l[1]),e.$set(c);const u={};a&76&&(u.$$scope={dirty:a,ctx:l}),r.$set(u);const f={};a&82&&(f.$$scope={dirty:a,ctx:l}),o.$set(f)},i(l){s||(d(e.$$.fragment,l),d(r.$$.fragment,l),d(o.$$.fragment,l),s=!0)},o(l){p(e.$$.fragment,l),p(r.$$.fragment,l),p(o.$$.fragment,l),s=!1},d(l){l&&(_(n),_(i)),P(e,l),P(r,l),P(o,l)}}}function yi(t){let e,n;return e=new Le({props:{gutter:"32px",$$slots:{default:[wi]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p(r,[i]){const o={};i&95&&(o.$$scope={dirty:i,ctx:r}),e.$set(o)},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function Ei(t,e,n){let{$$slots:r={},$$scope:i}=e,{brandingInfo:o=null}=e,{onContinue:s}=e,{title:l}=e,{type:a}=e,{closeButtonTitle:c="Go back to app"}=e;return t.$$set=u=>{"brandingInfo"in u&&n(0,o=u.brandingInfo),"onContinue"in u&&n(1,s=u.onContinue),"title"in u&&n(2,l=u.title),"type"in u&&n(3,a=u.type),"closeButtonTitle"in u&&n(4,c=u.closeButtonTitle),"$$scope"in u&&n(6,i=u.$$scope)},[o,s,l,a,c,r,i]}class Ct extends F{constructor(e){super(),C(this,e,Ei,yi,A,{brandingInfo:0,onContinue:1,title:2,type:3,closeButtonTitle:4},di)}}function Ft(t){let e,n,r,i,o,s;return{c(){e=I("br"),n=V("If this error persists, please contact "),r=I("a"),i=V(t[2]),s=V("."),b(r,"href",o="mailto:"+t[2])},m(l,a){g(l,e,a),g(l,n,a),g(l,r,a),L(r,i),g(l,s,a)},p(l,a){a&4&&ue(i,l[2]),a&4&&o!==(o="mailto:"+l[2])&&b(r,"href",o)},d(l){l&&(_(e),_(n),_(r),_(s))}}}function Ii(t){let e=t[1].getPublicErrorMessage(t[3])+"",n,r,i,o=t[2]&&Ft(t);return{c(){n=V(e),r=S(),o&&o.c(),i=ae()},m(s,l){g(s,n,l),g(s,r,l),o&&o.m(s,l),g(s,i,l)},p(s,l){l&10&&e!==(e=s[1].getPublicErrorMessage(s[3])+"")&&ue(n,e),s[2]?o?o.p(s,l):(o=Ft(s),o.c(),o.m(i.parentNode,i)):o&&(o.d(1),o=null)},d(s){s&&(_(n),_(r),_(i)),o&&o.d(s)}}}function vi(t){let e,n;return e=new Br({props:{slot:"icon"}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p:h,i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function $i(t){let e,n;return e=new Ct({props:{title:t[5](),brandingInfo:t[0],onContinue:t[4],type:"error",closeButtonTitle:"Try Again",$$slots:{icon:[vi],default:[Ii]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p(r,[i]){const o={};i&1&&(o.brandingInfo=r[0]),i&16&&(o.onContinue=r[4]),i&78&&(o.$$scope={dirty:i,ctx:r}),e.$set(o)},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function ki(t,e,n){let{brandingInfo:r=null}=e,{lastError:i}=e,{supportEmail:o=null}=e,{productDetails:s=null}=e,{onContinue:l}=e;je(()=>{q.errorLog(`Displayed error: ${te[i.errorCode]}. Message: ${i.message??"None"}. Underlying error: ${i.underlyingErrorMessage??"None"}`)});function a(){switch(i.errorCode){case te.AlreadyPurchasedError:return(s==null?void 0:s.productType)===Ie.Subscription?"Already subscribed":"Already purchased";default:return"Something went wrong"}}return t.$$set=c=>{"brandingInfo"in c&&n(0,r=c.brandingInfo),"lastError"in c&&n(1,i=c.lastError),"supportEmail"in c&&n(2,o=c.supportEmail),"productDetails"in c&&n(3,s=c.productDetails),"onContinue"in c&&n(4,l=c.onContinue)},[r,i,o,s,l,a]}class Pi extends F{constructor(e){super(),C(this,e,ki,$i,A,{brandingInfo:0,lastError:1,supportEmail:2,productDetails:3,onContinue:4})}}const Ti=`<svg width="96" height="96" viewBox="0 0 124 124" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
42
+ `;var va=E('<div style="color:var(--rc-color-error);" class="rcb-ui-asset-icon svelte-7wiquz"><!></div>');const pa={hash:"svelte-7wiquz",code:".rcb-ui-asset-icon.svelte-7wiquz {width:96px;height:96px;margin:0 auto;}"};function ha(e){j(e,pa);var r=va(),t=x(r);Rr(t,()=>da),p(e,r)}var ga=E("<button><!></button>");const _a={hash:"svelte-2xwwo",code:`button.svelte-2xwwo {border:none;border-radius:var(--rc-shape-input-button-border-radius);font-size:16px;cursor:pointer;height:56px;color:var(--rc-color-grey-text-dark);background-color:var(--rc-color-grey-ui-dark);display:flex;align-items:center;justify-content:center;-webkit-tap-highlight-color:rgba(0, 0, 0, 0);-webkit-tap-highlight-color:transparent;}button.svelte-2xwwo:focus,
43
+ button.svelte-2xwwo:active {outline:2px solid var(--rc-color-focus);}button.intent-primary.svelte-2xwwo {background-color:var(--rc-color-primary);color:var(--rc-color-primary-text);font-size:16px;}button.svelte-2xwwo:disabled {color:var(--rc-color-grey-text-light);background-color:var(--rc-color-grey-ui-dark);}button.intent-primary.svelte-2xwwo:disabled {color:var(--rc-color-grey-text-light);background-color:var(--rc-color-grey-ui-dark);}`};function Nt(e,r){j(e,_a);let t=h(r,"intent",8,"primary"),n=h(r,"disabled",8,!1),i=h(r,"testId",8,void 0),o=h(r,"type",8,void 0);var a=ga(),s=x(a);K(s,r,"default",{}),G(()=>{kn(a,`${`intent-${t()}`??""} svelte-2xwwo`),a.disabled=n(),le(a,"data-testid",i()),le(a,"type",o())}),rt("click",a,function(c){$n.call(this,r,c)}),p(e,a)}var ma=E('<footer class="rcb-modal-footer svelte-1f9z0o8"><!></footer>');const ba={hash:"svelte-1f9z0o8",code:"footer.svelte-1f9z0o8 {display:flex;flex-direction:column;}"};function Rt(e,r){j(e,ba);var t=ma(),n=x(t);K(n,r,"default",{}),p(e,t)}var ya=E('<div class="column svelte-6o8e90"><!></div>');const Ea={hash:"svelte-6o8e90",code:'.column.svelte-6o8e90 {display:flex;flex-direction:column;justify-content:flex-start;gap:var(--gap, "8px");flex-grow:1;}'};function Lr(e,r){j(e,Ea);let t=h(r,"gutter",8,"8px");var n=ya(),i=x(n);K(i,r,"default",{}),G(()=>le(n,"style",`--gap:${t()};`)),p(e,n)}const wa="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='mdi_close'%3e%3cpath%20id='Vector'%20d='M19%206.41L17.59%205L12%2010.59L6.41%205L5%206.41L10.59%2012L5%2017.59L6.41%2019L12%2013.41L17.59%2019L19%2017.59L13.41%2012L19%206.41Z'%20fill='%23767676'/%3e%3c/g%3e%3c/svg%3e";var Ia=E('<button class="close-button svelte-1hv9ta1"><img alt="close"></button>');const xa={hash:"svelte-1hv9ta1",code:".close-button.svelte-1hv9ta1 {border:none;cursor:pointer;background-color:transparent;padding:0px;height:24px;border-radius:50%;}.close-button.svelte-1hv9ta1:focus {outline:2px solid var(--rc-color-focus);}"};function St(e,r){j(e,xa);let t=h(r,"disabled",8,!1);var n=Ia(),i=x(n);le(i,"src",wa),G(()=>n.disabled=t()),rt("click",n,function(o){$n.call(this,r,o)}),p(e,n)}var Pa=E('<picture class="rcb-app-icon-picture-container svelte-44qpq9"><source type="image/webp"> <img class="rcb-app-icon svelte-44qpq9" alt="App icon"></picture>'),Ta=E('<div class="rcb-app-icon loading svelte-44qpq9"></div>');const Aa={hash:"svelte-44qpq9",code:".rcb-app-icon.svelte-44qpq9 {width:40px;height:40px;border-radius:12px;box-shadow:0px 1px 10px 0px rgba(0, 0, 0, 0.1);margin-right:16px;}.rcb-app-icon-picture-container.svelte-44qpq9 {height:40px;}.rcb-app-icon.loading.svelte-44qpq9 {background-color:gray;}"};function Vn(e,r){j(e,Aa);let t=h(r,"src",8,null),n=h(r,"srcWebp",8,null);var i=_e(),o=B(i);F(o,()=>t()!==null,a=>{var s=Pa(),c=x(s),l=L(c,2);G(()=>{le(c,"srcset",n()),le(l,"src",t())}),p(a,s)},a=>{var s=Ta();p(a,s)}),p(e,i)}const Gn=e=>`https://da08ctfrofx1b.cloudfront.net/${e}`;var Oa=E('<!> <span class="app-title svelte-10uf5fq"> </span>',1),ka=E('<div class="rcb-header-layout__business-info svelte-10uf5fq"><!></div>');const Na={hash:"svelte-10uf5fq",code:".app-title.svelte-10uf5fq {font-weight:500;margin:8px 0;font-size:16px;}.rcb-header-layout__business-info.svelte-10uf5fq {display:flex;align-items:center;}"};function Yn(e,r){we(r,!1),j(e,Na);let t=h(r,"brandingInfo",8,null);Te();var n=ka(),i=x(n);F(i,()=>t()!==null,o=>{var a=Oa(),s=B(a);F(s,()=>t().app_icon_webp!==null&&t().app_icon!==null,u=>{var f=he(()=>Gn(t().app_icon)),d=he(()=>Gn(t().app_icon_webp));Vn(u,{get src(){return v(f)},get srcWebp(){return v(d)}})});var c=L(s,2),l=x(c);G(()=>se(l,t().seller_company_name)),p(o,a)},o=>{Vn(o,{})}),p(e,n),Ie()}var Ra=E('<div class="rcb-post-purchase-header-layout svelte-17puakv"><!> <!></div>');const Sa={hash:"svelte-17puakv",code:".rcb-post-purchase-header-layout.svelte-17puakv {display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:-4px;}"};function Ua(e,r){j(e,Sa);let t=h(r,"brandingInfo",8,null),n=h(r,"onClose",8);fr(e,{as:"header",children:(i,o)=>{var a=Ra(),s=x(a);Yn(s,{get brandingInfo(){return t()}});var c=L(s,2);St(c,{$$events:{click(...l){var u;(u=n())==null||u.apply(this,l)}}}),p(i,a)},$$slots:{default:!0}})}var La=E('<span class="title svelte-idou50"> </span> <span class="subtitle svelte-idou50"><!></span>',1),$a=E("<!> <!>",1),Da=E('<div class="rcb-modal-message svelte-idou50"><!></div>'),Ma=E("<!> <!> <!>",1);const Ba={hash:"svelte-idou50",code:".rcb-modal-message.svelte-idou50 {width:100%;min-height:160px;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;margin-bottom:16px;margin-top:16px;}.title.svelte-idou50 {font-size:24px;line-height:1.25em;}.subtitle.svelte-idou50 {font-size:16px;line-height:1.25em;overflow-wrap:anywhere;}"};function Wn(e,r){j(e,Ba);let t=h(r,"brandingInfo",8,null),n=h(r,"onContinue",8),i=h(r,"title",8),o=h(r,"type",8),a=h(r,"closeButtonTitle",8,"Go back to app");Lr(e,{gutter:"32px",children:(s,c)=>{var l=Ma(),u=B(l);Ua(u,{get brandingInfo(){return t()},get onClose(){return n()}});var f=L(u,2);fr(f,{children:(m,w)=>{var g=Da(),T=x(g);Lr(T,{gutter:"48px",children:(b,I)=>{var A=$a(),y=B(A);K(y,r,"icon",{});var O=L(y,2);Lr(O,{gutter:"16px",children:(V,$)=>{var H=La(),Q=B(H),me=x(Q),Ke=L(Q,2),S=x(Ke);K(S,r,"default",{}),G(()=>se(me,i())),p(V,H)},$$slots:{default:!0}}),p(b,A)},$$slots:{default:!0}}),G(()=>le(g,"data-type",o())),p(m,g)},$$slots:{default:!0}});var d=L(f,2);Rt(d,{children:(m,w)=>{Nt(m,{type:"submit",$$events:{click(...g){var T;(T=n())==null||T.apply(this,g)}},children:(g,T)=>{var b=We();G(()=>se(b,a())),p(g,b)},$$slots:{default:!0}})},$$slots:{default:!0}}),p(s,l)},$$slots:{default:!0}})}var Fa=E("<br>If this error persists, please contact <a> </a>.",1),qa=E(" <!>",1);function ja(e,r){we(r,!1);let t=h(r,"brandingInfo",8,null),n=h(r,"lastError",8),i=h(r,"supportEmail",8,null),o=h(r,"productDetails",8,null),a=h(r,"onContinue",8);nt(()=>{C.errorLog(`Displayed error: ${ie[n().errorCode]}. Message: ${n().message??"None"}. Underlying error: ${n().underlyingErrorMessage??"None"}`)});function s(){var l;switch(n().errorCode){case ie.AlreadyPurchasedError:return((l=o())==null?void 0:l.productType)===dr.Subscription?"Already subscribed":"Already purchased";default:return"Something went wrong"}}Te();var c=he(s);Wn(e,{get title(){return v(c)},get brandingInfo(){return t()},get onContinue(){return a()},type:"error",closeButtonTitle:"Try Again",children:(l,u)=>{var f=qa(),d=B(f);G(()=>se(d,`${n().getPublicErrorMessage(o())??""} `));var m=L(d);F(m,i,w=>{var g=Fa(),T=L(B(g),2),b=x(T);G(()=>{le(T,"href",`mailto:${i()??""}`),se(b,i())}),p(w,g)}),p(l,f)},$$slots:{default:!0,icon:(l,u)=>{ha(l)}}}),Ie()}const Ca=`<svg width="96" height="96" viewBox="0 0 124 124" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
7
44
  <circle cx="62" cy="62" r="62" fill="currentColor"/>
8
45
  <rect x="44.1116" y="56" width="27.5" height="11" transform="rotate(45 44.1116 56)" fill="white"/>
9
46
  <rect x="79.1133" y="44.334" width="11" height="44" transform="rotate(45 79.1133 44.334)" fill="white"/>
10
47
  </svg>
11
- `;function Ai(t){R(t,"svelte-7wiquz",".rcb-ui-asset-icon.svelte-7wiquz{width:96px;height:96px;margin:0 auto}")}function Oi(t){let e;return{c(){e=I("div"),fe(e,"color","var(--rc-color-accent)"),b(e,"class","rcb-ui-asset-icon svelte-7wiquz")},m(n,r){g(n,e,r),e.innerHTML=Ti},p:h,i:h,o:h,d(n){n&&_(e)}}}class Ni extends F{constructor(e){super(),C(this,e,null,Oi,A,{},Ai)}}function Ui(t){let e;return{c(){e=V("Your plan is now active.")},m(n,r){g(n,e,r)},d(n){n&&_(e)}}}function Ri(t){let e,n=t[2]&&Ui();return{c(){n&&n.c(),e=ae()},m(r,i){n&&n.m(r,i),g(r,e,i)},p:h,d(r){r&&_(e),n&&n.d(r)}}}function Li(t){let e,n;return e=new Ni({props:{slot:"icon"}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p:h,i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function Si(t){let e,n;return e=new Ct({props:{type:"success",title:"Purchase successful",brandingInfo:t[0],onContinue:t[1],closeButtonTitle:"Close",$$slots:{icon:[Li],default:[Ri]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p(r,[i]){const o={};i&1&&(o.brandingInfo=r[0]),i&2&&(o.onContinue=r[1]),i&16&&(o.$$scope={dirty:i,ctx:r}),e.$set(o)},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function Mi(t,e,n){let{productDetails:r=null}=e,{brandingInfo:i=null}=e,{onContinue:o}=e;const s=(r==null?void 0:r.productType)===Ie.Subscription;return t.$$set=l=>{"productDetails"in l&&n(3,r=l.productDetails),"brandingInfo"in l&&n(0,i=l.brandingInfo),"onContinue"in l&&n(1,o=l.onContinue)},[i,o,s,r]}class Di extends F{constructor(e){super(),C(this,e,Mi,Si,A,{productDetails:3,brandingInfo:0,onContinue:1})}}function Bi(t,e,n,r,i={}){const o=n.create(e,i);return o.mount(t),o.on("change",s=>r("change",s)),o.on("ready",s=>r("ready",s)),o.on("focus",s=>r("focus",s)),o.on("blur",s=>r("blur",s)),o.on("escape",s=>r("escape",s)),o.on("click",s=>r("click",s)),o.on("loaderror",s=>r("loaderror",s)),o.on("loaderstart",s=>r("loaderstart",s)),o.on("networkschange",s=>r("networkschange",s)),o}const Ci=typeof window>"u";function Fi(t){if(!Ci)return t.registerAppInfo({name:"svelte-stripe-js",url:"https://svelte-stripe-js.vercel.app"})}function ji(t){let e;return{c(){e=I("div")},m(n,r){g(n,e,r),t[6](e)},p:h,i:h,o:h,d(n){n&&_(e),t[6](null)}}}function Hi(t,e,n){let r,i;const o=Gn(),{elements:s}=Yn("stripe");let{options:l=void 0}=e;je(()=>(r=Bi(i,"payment",s,o,l),()=>r.destroy()));function a(){r.blur()}function c(){r.clear()}function u(){r.destroy()}function f(){r.focus()}function m(w){He[w?"unshift":"push"](()=>{i=w,n(0,i)})}return t.$$set=w=>{"options"in w&&n(1,l=w.options)},[i,l,a,c,u,f,m]}class qi extends F{constructor(e){super(),C(this,e,Hi,ji,A,{options:1,blur:2,clear:3,destroy:4,focus:5})}get blur(){return this.$$.ctx[2]}get clear(){return this.$$.ctx[3]}get destroy(){return this.$$.ctx[4]}get focus(){return this.$$.ctx[5]}}function jt(t){let e;const n=t[15].default,r=H(n,t,t[14],null);return{c(){r&&r.c()},m(i,o){r&&r.m(i,o),e=!0},p(i,o){r&&r.p&&(!e||o&16384)&&W(r,n,i,i[14],e?z(n,i[14],o,null):K(i[14]),null)},i(i){e||(d(r,i),e=!0)},o(i){p(r,i),e=!1},d(i){r&&r.d(i)}}}function xi(t){let e,n,r=t[1]&&t[0]&&jt(t);return{c(){r&&r.c(),e=ae()},m(i,o){r&&r.m(i,o),g(i,e,o),n=!0},p(i,[o]){i[1]&&i[0]?r?(r.p(i,o),o&3&&d(r,1)):(r=jt(i),r.c(),d(r,1),r.m(e.parentNode,e)):r&&(X(),p(r,1,1,()=>{r=null}),Z())},i(i){n||(d(r),n=!0)},o(i){p(r),n=!1},d(i){i&&_(e),r&&r.d(i)}}}function Gi(t,e,n){let r,{$$slots:i={},$$scope:o}=e,{stripe:s}=e,{mode:l=void 0}=e,{theme:a="stripe"}=e,{variables:c={}}=e,{rules:u={}}=e,{labels:f="above"}=e,{loader:m="auto"}=e,{fonts:w=[]}=e,{locale:v="auto"}=e,{currency:O=void 0}=e,{amount:y=void 0}=e,{clientSecret:N=void 0}=e,{elements:ie=null}=e;return t.$$set=$=>{"stripe"in $&&n(1,s=$.stripe),"mode"in $&&n(2,l=$.mode),"theme"in $&&n(3,a=$.theme),"variables"in $&&n(4,c=$.variables),"rules"in $&&n(5,u=$.rules),"labels"in $&&n(6,f=$.labels),"loader"in $&&n(7,m=$.loader),"fonts"in $&&n(8,w=$.fonts),"locale"in $&&n(9,v=$.locale),"currency"in $&&n(10,O=$.currency),"amount"in $&&n(11,y=$.amount),"clientSecret"in $&&n(12,N=$.clientSecret),"elements"in $&&n(0,ie=$.elements),"$$scope"in $&&n(14,o=$.$$scope)},t.$$.update=()=>{t.$$.dirty&120&&n(13,r={theme:a,variables:c,rules:u,labels:f}),t.$$.dirty&16263&&s&&!ie&&(n(0,ie=s.elements({mode:l,currency:O,amount:y,appearance:r,clientSecret:N,fonts:w,loader:m,locale:v})),Fi(s),Vn("stripe",{stripe:s,elements:ie})),t.$$.dirty&8705&&ie&&ie.update({appearance:r,locale:v})},[ie,s,l,a,c,u,f,m,w,v,O,y,N,r,o,i]}class Vi extends F{constructor(e){super(),C(this,e,Gi,xi,A,{stripe:1,mode:2,theme:3,variables:4,rules:5,labels:6,loader:7,fonts:8,locale:9,currency:10,amount:11,clientSecret:12,elements:0})}}var Ht="https://js.stripe.com/v3",Yi=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,qt="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",zi=function(){for(var e=document.querySelectorAll('script[src^="'.concat(Ht,'"]')),n=0;n<e.length;n++){var r=e[n];if(Yi.test(r.src))return r}return null},xt=function(e){var n="",r=document.createElement("script");r.src="".concat(Ht).concat(n);var i=document.head||document.body;if(!i)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return i.appendChild(r),r},Wi=function(e,n){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"2.4.0",startTime:n})},Se=null,Ge=null,Ve=null,Ki=function(e){return function(){e(new Error("Failed to load Stripe.js"))}},Qi=function(e,n){return function(){window.Stripe?e(window.Stripe):n(new Error("Stripe.js not available"))}},Xi=function(e){return Se!==null?Se:(Se=new Promise(function(n,r){if(typeof window>"u"||typeof document>"u"){n(null);return}if(window.Stripe&&e&&console.warn(qt),window.Stripe){n(window.Stripe);return}try{var i=zi();if(i&&e)console.warn(qt);else if(!i)i=xt(e);else if(i&&Ve!==null&&Ge!==null){var o;i.removeEventListener("load",Ve),i.removeEventListener("error",Ge),(o=i.parentNode)===null||o===void 0||o.removeChild(i),i=xt(e)}Ve=Qi(n,r),Ge=Ki(r),i.addEventListener("load",Ve),i.addEventListener("error",Ge)}catch(s){r(s);return}}),Se.catch(function(n){return Se=null,Promise.reject(n)}))},Zi=function(e,n,r){if(e===null)return null;var i=e.apply(void 0,n);return Wi(i,r),i},Me,Gt=!1,Vt=function(){return Me||(Me=Xi(null).catch(function(e){return Me=null,Promise.reject(e)}),Me)};Promise.resolve().then(function(){return Vt()}).catch(function(t){Gt||console.warn(t)});var Ji=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];Gt=!0;var i=Date.now();return Vt().then(function(o){return Zi(o,n,i)})};function eo(t){R(t,"svelte-1xe711j",".rcb-header-layout.svelte-1xe711j{display:flex;justify-content:space-between;align-items:center;width:100%;font-size:24px;margin:0;font-weight:500}")}function to(t){let e,n;const r=t[0].default,i=H(r,t,t[1],null);return{c(){e=I("div"),i&&i.c(),b(e,"class","rcb-header-layout svelte-1xe711j")},m(o,s){g(o,e,s),i&&i.m(e,null),n=!0},p(o,s){i&&i.p&&(!n||s&2)&&W(i,r,o,o[1],n?z(r,o[1],s,null):K(o[1]),null)},i(o){n||(d(i,o),n=!0)},o(o){p(i,o),n=!1},d(o){o&&_(e),i&&i.d(o)}}}function no(t){let e,n;return e=new Ee({props:{as:"header",$$slots:{default:[to]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p(r,[i]){const o={};i&2&&(o.$$scope={dirty:i,ctx:r}),e.$set(o)},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function ro(t,e,n){let{$$slots:r={},$$scope:i}=e;return t.$$set=o=>{"$$scope"in o&&n(1,i=o.$$scope)},[r,i]}class lt extends F{constructor(e){super(),C(this,e,ro,no,A,{},eo)}}const io=`<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"
48
+ `;var Ha=E('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-7wiquz"><!></div>');const Va={hash:"svelte-7wiquz",code:".rcb-ui-asset-icon.svelte-7wiquz {width:96px;height:96px;margin:0 auto;}"};function Ga(e){j(e,Va);var r=Ha(),t=x(r);Rr(t,()=>Ca),p(e,r)}function Ya(e,r){var a;we(r,!1);let t=h(r,"productDetails",8,null),n=h(r,"brandingInfo",8,null),i=h(r,"onContinue",8);const o=((a=t())==null?void 0:a.productType)===dr.Subscription;Te(),Wn(e,{type:"success",title:"Purchase successful",get brandingInfo(){return n()},get onContinue(){return i()},closeButtonTitle:"Close",children:(s,c)=>{var l=_e(),u=B(l);F(u,()=>o,f=>{var d=We("Your plan is now active.");p(f,d)}),p(s,l)},$$slots:{default:!0,icon:(s,c)=>{Ga(s)}}}),Ie()}function Wa(e,r,t,n,i={}){const o=t.create(r,i);return o.mount(e),o.on("change",a=>n("change",a)),o.on("ready",a=>n("ready",a)),o.on("focus",a=>n("focus",a)),o.on("blur",a=>n("blur",a)),o.on("escape",a=>n("escape",a)),o.on("click",a=>n("click",a)),o.on("loaderror",a=>n("loaderror",a)),o.on("loaderstart",a=>n("loaderstart",a)),o.on("networkschange",a=>n("networkschange",a)),o}const za=typeof window>"u";function Ka(e){if(!za)return e.registerAppInfo({name:"svelte-stripe-js",url:"https://svelte-stripe-js.vercel.app"})}var Qa=E("<div></div>");function Za(e,r){we(r,!1);let t,n=pe();const i=So(),{elements:o}=lo("stripe");let a=h(r,"options",8,void 0);nt(()=>(t=Wa(v(n),"payment",o,i,a()),()=>t.destroy()));function s(){t.blur()}function c(){t.clear()}function l(){t.destroy()}function u(){t.focus()}Te();var f=Qa();return No(f,d=>R(n,d),()=>v(n)),p(e,f),tt(r,"blur",s),tt(r,"clear",c),tt(r,"destroy",l),tt(r,"focus",u),Ie({blur:s,clear:c,destroy:l,focus:u})}function Xa(e,r){we(r,!1);const t=pe();let n=h(r,"stripe",8),i=h(r,"mode",8,void 0),o=h(r,"theme",8,"stripe"),a=h(r,"variables",24,()=>({})),s=h(r,"rules",24,()=>({})),c=h(r,"labels",8,"above"),l=h(r,"loader",8,"auto"),u=h(r,"fonts",24,()=>[]),f=h(r,"locale",8,"auto"),d=h(r,"currency",8,void 0),m=h(r,"amount",8,void 0),w=h(r,"clientSecret",8,void 0),g=h(r,"elements",12,null);Ye(()=>(ee(o()),ee(a()),ee(s()),ee(c())),()=>{R(t,{theme:o(),variables:a(),rules:s(),labels:c()})}),Ye(()=>(ee(n()),ee(g()),ee(i()),ee(d()),ee(m()),v(t),ee(w()),ee(u()),ee(l()),ee(f()),hn),()=>{n()&&!g()&&(g(n().elements({mode:i(),currency:d(),amount:m(),appearance:v(t),clientSecret:w(),fonts:u(),loader:l(),locale:f()})),Ka(n()),hn("stripe",{stripe:n(),elements:g()}))}),Ye(()=>(ee(g()),v(t),ee(f())),()=>{g()&&g().update({appearance:v(t),locale:f()})}),mt(),Te();var T=_e(),b=B(T);F(b,()=>n()&&g(),I=>{var A=_e(),y=B(A);K(y,r,"default",{}),p(I,A)}),p(e,T),Ie()}var zn="https://js.stripe.com/v3",Ja=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,Kn="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",es=function(){for(var r=document.querySelectorAll('script[src^="'.concat(zn,'"]')),t=0;t<r.length;t++){var n=r[t];if(Ja.test(n.src))return n}return null},Qn=function(r){var t="",n=document.createElement("script");n.src="".concat(zn).concat(t);var i=document.head||document.body;if(!i)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return i.appendChild(n),n},rs=function(r,t){!r||!r._registerWrapper||r._registerWrapper({name:"stripe-js",version:"4.6.0",startTime:t})},$r=null,ot=null,at=null,ts=function(r){return function(){r(new Error("Failed to load Stripe.js"))}},ns=function(r,t){return function(){window.Stripe?r(window.Stripe):t(new Error("Stripe.js not available"))}},is=function(r){return $r!==null?$r:($r=new Promise(function(t,n){if(typeof window>"u"||typeof document>"u"){t(null);return}if(window.Stripe&&r&&console.warn(Kn),window.Stripe){t(window.Stripe);return}try{var i=es();if(i&&r)console.warn(Kn);else if(!i)i=Qn(r);else if(i&&at!==null&&ot!==null){var o;i.removeEventListener("load",at),i.removeEventListener("error",ot),(o=i.parentNode)===null||o===void 0||o.removeChild(i),i=Qn(r)}at=ns(t,n),ot=ts(n),i.addEventListener("load",at),i.addEventListener("error",ot)}catch(a){n(a);return}}),$r.catch(function(t){return $r=null,Promise.reject(t)}))},os=function(r,t,n){if(r===null)return null;var i=r.apply(void 0,t);return rs(i,n),i},Dr,Zn=!1,Xn=function(){return Dr||(Dr=is(null).catch(function(r){return Dr=null,Promise.reject(r)}),Dr)};Promise.resolve().then(function(){return Xn()}).catch(function(e){Zn||console.warn(e)});var as=function(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];Zn=!0;var i=Date.now();return Xn().then(function(o){return os(o,t,i)})},ss=E('<div class="rcb-header-layout svelte-1xe711j"><!></div>');const ls={hash:"svelte-1xe711j",code:".rcb-header-layout.svelte-1xe711j {display:flex;justify-content:space-between;align-items:center;width:100%;font-size:24px;margin:0;font-weight:500;}"};function Ut(e,r){j(e,ls),fr(e,{as:"header",children:(t,n)=>{var i=ss(),o=x(i);K(o,r,"default",{}),p(t,i)},$$slots:{default:!0}})}const cs=`<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"
12
49
  xmlns="http://www.w3.org/2000/svg">
13
50
  <path d="M18 8H17V6C17 3.24 14.76 1 12 1C9.24 1 7 3.24 7 6V8H6C4.9 8 4 8.9 4 10V20C4 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V10C20 8.9 19.1 8 18 8ZM12 17C10.9 17 10 16.1 10 15C10 13.9 10.9 13 12 13C13.1 13 14 13.9 14 15C14 16.1 13.1 17 12 17ZM15.1 8H8.9V6C8.9 4.29 10.29 2.9 12 2.9C13.71 2.9 15.1 4.29 15.1 6V8Z"
14
51
  fill="currentColor"/>
15
52
  </svg>
16
- `;function oo(t){R(t,"svelte-1z0jca3","div.svelte-1z0jca3{height:24px;width:24px}")}function so(t){let e;return{c(){e=I("div"),fe(e,"color","var(--rc-color-accent)"),b(e,"class","rcb-ui-asset-icon svelte-1z0jca3")},m(n,r){g(n,e,r),e.innerHTML=io},p:h,i:h,o:h,d(n){n&&_(e)}}}class lo extends F{constructor(e){super(),C(this,e,null,so,A,{},oo)}}function ao(t){R(t,"svelte-rjmul6",`.processing.svelte-rjmul6{width:12px;aspect-ratio:1;border-radius:50%;animation:svelte-rjmul6-l5 1.5s infinite linear}@keyframes svelte-rjmul6-l5{0%{box-shadow:20px 0 #fff2,
17
- -20px 0 #fff2;background:#fff2}25%{box-shadow:20px 0 #fff2,
18
- -20px 0 #ffff;background:#fff2}50%{box-shadow:20px 0 #fff2,
19
- -20px 0 #fff2;background:#ffff}75%{box-shadow:20px 0 #ffff,
20
- -20px 0 #fff2;background:#fff2}100%{box-shadow:20px 0 #fff2,
21
- -20px 0 #fff2;background:#fff2}}`)}function co(t){let e;return{c(){e=I("div"),b(e,"class","processing svelte-rjmul6")},m(n,r){g(n,e,r)},p:h,i:h,o:h,d(n){n&&_(e)}}}class Yt extends F{constructor(e){super(),C(this,e,null,co,A,{},ao)}}const uo={error:"#f2545b",warning:"#f4e971",focus:"#000080",accent:"#767676",primary:"#000000","primary-text":"#ffffff",white:"#ffffff","grey-text-dark":"rgba(0,0,0,1)","grey-text-light":"rgba(0,0,0,0.5)","grey-ui-dark":"rgba(0,0,0,0.125)","grey-ui-light":"rgba(0,0,0,0.005)","input-background":"transparent",background:"white"},fo={error:"#f2545b",warning:"#f4e971",focus:"#000080",accent:"#767676",primary:"#ffffff","primary-text":"#000000",white:"#ffffff","grey-text-dark":"rgba(255,255,255,1)","grey-text-light":"rgba(255,255,255,0.5)","grey-ui-dark":"rgba(255,255,255,0.125)","grey-ui-light":"rgba(255,255,255,0.005)","input-background":"transparent",background:"#000000"},zt={error:"color_error",focus:"color_accent",accent:"color_accent",primary:"color_buttons_primary"},po={...zt,background:"color_form_bg"},mo={...zt,background:"color_product_info_bg"},Wt={"input-border-radius":"12px","input-button-border-radius":"12px","modal-border-radius":"16px"},_o={"input-border-radius":"0px","input-button-border-radius":"0px","modal-border-radius":"0px"},go={"input-border-radius":"24px","input-button-border-radius":"56px","modal-border-radius":"16px"},Kt=Wt,Qt=t=>t.length==7?{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16)}:t.length==4?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null,Xt=({r:t,g:e,b:n,luminanceThreshold:r})=>{const i=s=>(s=s/255,s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4));return .2126*i(t)+.7152*i(e)+.0722*i(n)>r},Zt=.37,ho=(t,e=Zt)=>{const n=Xt({...t,luminanceThreshold:e})?"0,0,0":"255,255,255";return{"grey-text-dark":`rgba(${n},1.0)`,"grey-text-light":`rgba(${n},0.50)`,"grey-ui-dark":`rgba(${n},0.125)`,"grey-ui-light":`rgba(${n},0.05)`}},bo=(t,e,n,r=Zt)=>{const i={"grey-text-dark":n["grey-text-dark"],"grey-text-light":n["grey-text-light"],"grey-ui-dark":n["grey-ui-dark"],"grey-ui-light":n["grey-ui-light"],"primary-text":n["primary-text"]};if(t!=null&&t.startsWith("#")){const o=Qt(t);o!==null&&Object.assign(i,ho(o))}if(e!=null&&e.startsWith("#")){const o=Qt(e);o!==null&&(i["primary-text"]=Xt({...o,luminanceThreshold:r})?"black":"white")}return i},wo=(t,e)=>t||e,yo=(t,e,n)=>{const r=Object.entries(t).map(([i,o])=>[i,wo(n?n[o]:null,e[i])]);return Object.fromEntries(r)},Jt=(t,e,n)=>{const r=yo(t,e,n);return n?{...e,...r,...bo(r.background,r.primary,e)}:{...e}},Eo=t=>Jt(mo,fo,t),en=t=>Jt(po,uo,t),at=t=>{if(!t)return Kt;switch(t.shapes){case"rounded":return Wt;case"rectangle":return _o;case"pill":return go;default:return Kt}},Ye=(t="",e)=>e.map(([n,r])=>`--rc-${t}-${n}: ${r}`).join("; "),tn=t=>{const e=Ye("color",Object.entries(Eo(t))),n=Ye("shape",Object.entries(at(t)));return[e,n].join("; ")},Io=t=>{const e=Ye("color",Object.entries(en(t))),n=Ye("shape",Object.entries(at(t)));return[e,n].join("; ")};class ct{constructor(e){this.brandingAppearance=e}get shape(){return at(this.brandingAppearance)}get formColors(){return en(this.brandingAppearance)}get formStyleVars(){return Io(this.brandingAppearance)}get productInfoStyleVars(){return tn(this.brandingAppearance)}}function vo(t){R(t,"svelte-8jsoa8",".rcb-stripe-elements-container.svelte-8jsoa8{width:100%;min-height:320px;margin-top:32px;margin-bottom:24px}")}function $o(t){let e,n;return e=new rt({}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p:h,i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function ko(t){let e,n,r,i,o,s,l,a;e=new lt({props:{$$slots:{default:[Po]},$$scope:{ctx:t}}});function c(f){t[14](f)}let u={stripe:t[5],clientSecret:t[6],loader:"always",locale:"en",theme:"stripe",variables:{borderRadius:t[8]["input-border-radius"],fontSizeBase:"16px",fontSizeSm:"16px",spacingGridRow:"16px",focusBoxShadow:"none",colorDanger:t[9].error,colorTextPlaceholder:t[9]["grey-text-light"]},rules:{".Input":{boxShadow:"none",border:`2px solid ${t[9]["grey-ui-dark"]}`,backgroundColor:"transparent",color:t[9]["grey-text-dark"]},".Input:focus":{border:`2px solid ${t[9].focus}`,outline:"none"},".Label":{marginBottom:"8px",fontWeight:"500",lineHeight:"22px",color:t[9]["grey-text-dark"]},".Input--invalid":{boxShadow:"none"},".Tab":{boxShadow:"none",backgroundColor:"transparent"}},$$slots:{default:[So]},$$scope:{ctx:t}};return t[4]!==void 0&&(u.elements=t[4]),i=new Vi({props:u}),He.push(()=>Zn(i,"elements",c)),{c(){T(e.$$.fragment),n=S(),r=I("form"),T(i.$$.fragment)},m(f,m){k(e,f,m),g(f,n,m),g(f,r,m),k(i,r,null),s=!0,l||(a=Te(r,"submit",yt(t[7])),l=!0)},p(f,m){const w={};m&131074&&(w.$$scope={dirty:m,ctx:f}),e.$set(w);const v={};m&32&&(v.stripe=f[5]),m&131085&&(v.$$scope={dirty:m,ctx:f}),!o&&m&16&&(o=!0,v.elements=f[4],Kn(()=>o=!1)),i.$set(v)},i(f){s||(d(e.$$.fragment,f),d(i.$$.fragment,f),s=!0)},o(f){p(e.$$.fragment,f),p(i.$$.fragment,f),s=!1},d(f){f&&(_(n),_(r)),P(e,f),P(i),l=!1,a()}}}function Po(t){let e,n,r,i,o,s,l;return n=new lo({}),s=new st({}),s.$on("click",function(){ne(t[1])&&t[1].apply(this,arguments)}),{c(){e=I("div"),T(n.$$.fragment),r=S(),i=I("div"),i.textContent="Secure Checkout",o=S(),T(s.$$.fragment),fe(i,"margin-left","10px"),fe(e,"display","flex"),fe(e,"align-items","center"),fe(e,"justify-content","baseline")},m(a,c){g(a,e,c),k(n,e,null),L(e,r),L(e,i),g(a,o,c),k(s,a,c),l=!0},p(a,c){t=a},i(a){l||(d(n.$$.fragment,a),d(s.$$.fragment,a),l=!0)},o(a){p(n.$$.fragment,a),p(s.$$.fragment,a),l=!1},d(a){a&&(_(e),_(o)),P(n),P(s,a)}}}function To(t){let e,n,r;return n=new qi({}),{c(){e=I("div"),T(n.$$.fragment),b(e,"class","rcb-stripe-elements-container svelte-8jsoa8")},m(i,o){g(i,e,o),k(n,e,null),r=!0},p:h,i(i){r||(d(n.$$.fragment,i),r=!0)},o(i){p(n.$$.fragment,i),r=!1},d(i){i&&_(e),P(n)}}}function Ao(t){let e;return{c(){e=V("Pay")},m(n,r){g(n,e,r)},i:h,o:h,d(n){n&&_(e)}}}function Oo(t){let e;return{c(){e=V("Start Trial")},m(n,r){g(n,e,r)},i:h,o:h,d(n){n&&_(e)}}}function No(t){let e,n;return e=new Yt({}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function Uo(t){let e,n,r,i;const o=[No,Oo,Ao],s=[];function l(a,c){var u,f;return a[0]?0:(f=(u=a[2].subscriptionOptions)==null?void 0:u[a[3].id])!=null&&f.trial?1:2}return e=l(t),n=s[e]=o[e](t),{c(){n.c(),r=ae()},m(a,c){s[e].m(a,c),g(a,r,c),i=!0},p(a,c){let u=e;e=l(a),e!==u&&(X(),p(s[u],1,1,()=>{s[u]=null}),Z(),n=s[e],n||(n=s[e]=o[e](a),n.c()),d(n,1),n.m(r.parentNode,r))},i(a){i||(d(n),i=!0)},o(a){p(n),i=!1},d(a){a&&_(r),s[e].d(a)}}}function Ro(t){let e,n;return e=new it({props:{disabled:t[0],testId:"PayButton",$$slots:{default:[Uo]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p(r,i){const o={};i&1&&(o.disabled=r[0]),i&131085&&(o.$$scope={dirty:i,ctx:r}),e.$set(o)},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function Lo(t){let e,n;return e=new Le({props:{$$slots:{default:[Ro]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p(r,i){const o={};i&131085&&(o.$$scope={dirty:i,ctx:r}),e.$set(o)},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function So(t){let e,n,r,i;return e=new Ee({props:{$$slots:{default:[To]},$$scope:{ctx:t}}}),r=new ot({props:{$$slots:{default:[Lo]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment),n=S(),T(r.$$.fragment)},m(o,s){k(e,o,s),g(o,n,s),k(r,o,s),i=!0},p(o,s){const l={};s&131072&&(l.$$scope={dirty:s,ctx:o}),e.$set(l);const a={};s&131085&&(a.$$scope={dirty:s,ctx:o}),r.$set(a)},i(o){i||(d(e.$$.fragment,o),d(r.$$.fragment,o),i=!0)},o(o){p(e.$$.fragment,o),p(r.$$.fragment,o),i=!1},d(o){o&&_(n),P(e,o),P(r,o)}}}function Mo(t){let e,n,r,i;const o=[ko,$o],s=[];function l(a,c){return a[5]&&a[6]?0:1}return n=l(t),r=s[n]=o[n](t),{c(){e=I("div"),r.c()},m(a,c){g(a,e,c),s[n].m(e,null),i=!0},p(a,[c]){let u=n;n=l(a),n===u?s[n].p(a,c):(X(),p(s[u],1,1,()=>{s[u]=null}),Z(),r=s[n],r?r.p(a,c):(r=s[n]=o[n](a),r.c()),d(r,1),r.m(e,null))},i(a){i||(d(r),i=!0)},o(a){p(r),i=!1},d(a){a&&_(e),s[n].d()}}}function Do(t,e,n){let{onClose:r}=e,{onContinue:i}=e,{onError:o}=e,{paymentInfoCollectionMetadata:s}=e,{processing:l=!1}=e,{productDetails:a}=e,{purchaseOptionToUse:c}=e,{brandingInfo:u}=e;const f=s.data.client_secret;let m=null,w,v;je(async()=>{const U=s.data.publishable_api_key,x=s.data.stripe_account_id;if(!U||!x)throw new Error("Stripe publishable key or account ID not found");n(5,m=await Ji(U,{stripeAccount:x}))});const O=async()=>{if(l||!m||!v)return;n(0,l=!0);const U=await m.confirmSetup({elements:v,redirect:"if_required"});U.error?(n(0,l=!1),o(new Q(te.StripeError,U.error.message))):i()},y=new ct(u==null?void 0:u.appearance);let N=y.shape,ie=y.formColors;function $(U){w=U,n(4,w)}return t.$$set=U=>{"onClose"in U&&n(1,r=U.onClose),"onContinue"in U&&n(10,i=U.onContinue),"onError"in U&&n(11,o=U.onError),"paymentInfoCollectionMetadata"in U&&n(12,s=U.paymentInfoCollectionMetadata),"processing"in U&&n(0,l=U.processing),"productDetails"in U&&n(2,a=U.productDetails),"purchaseOptionToUse"in U&&n(3,c=U.purchaseOptionToUse),"brandingInfo"in U&&n(13,u=U.brandingInfo)},t.$$.update=()=>{t.$$.dirty&16&&w&&w._elements.length>0&&(v=w)},[l,r,a,c,w,m,f,O,N,ie,i,o,s,u,$]}class Bo extends F{constructor(e){super(),C(this,e,Do,Mo,A,{onClose:1,onContinue:10,onError:11,paymentInfoCollectionMetadata:12,processing:0,productDetails:2,purchaseOptionToUse:3,brandingInfo:13},vo)}}function Co(t){return t.trim()===""?"You need to provide your email address to continue.":t.match(/^[^@]+@[^@]+\.[^@]+$/)?null:"Email is not valid. Please provide a valid email address."}function Fo(t){if(t&&!t.match(/^[A-Z]{3}$/)){const e=`Currency code ${t} is not valid. Please provide a valid ISO 4217 currency code.`;throw q.errorLog(e),new J(ee.ConfigurationError,e)}}function jo(t){R(t,"svelte-yf01ty",".container.svelte-yf01ty.svelte-yf01ty{display:flex;flex-direction:column;flex-grow:1}form.svelte-yf01ty.svelte-yf01ty{display:flex;flex-direction:column;min-height:100%;flex-grow:1}.form-container.svelte-yf01ty.svelte-yf01ty{display:flex;flex-direction:column;width:100%;margin-top:32px;margin-bottom:16px}.form-label.svelte-yf01ty.svelte-yf01ty{margin-top:8px;margin-bottom:8px;display:block;font-weight:500;line-height:22px}.form-input.error.svelte-yf01ty input.svelte-yf01ty{border-color:var(--rc-color-error)}.form-error.svelte-yf01ty.svelte-yf01ty{margin-top:4px;font-size:16px;line-height:20px;min-height:40px;color:var(--rc-color-error)}input.svelte-yf01ty.svelte-yf01ty{width:100%;box-sizing:border-box;padding:8px;border:2px solid var(--rc-color-grey-ui-dark);border-radius:var(--rc-shape-input-border-radius);font-size:16px;height:48px;padding:6px 14px;background:var(--rc-color-input-background);color:inherit}input.svelte-yf01ty.svelte-yf01ty:focus{outline:none;border:2px solid var(--rc-color-focus)}")}function Ho(t){let e,n,r,i;return r=new st({}),r.$on("click",function(){ne(t[0])&&t[0].apply(this,arguments)}),{c(){e=I("span"),e.textContent="Billing email address",n=S(),T(r.$$.fragment)},m(o,s){g(o,e,s),g(o,n,s),k(r,o,s),i=!0},p(o,s){t=o},i(o){i||(d(r.$$.fragment,o),i=!0)},o(o){p(r.$$.fragment,o),i=!1},d(o){o&&(_(e),_(n)),P(r,o)}}}function nn(t){let e,n;return{c(){e=I("div"),n=V(t[2]),b(e,"class","form-error svelte-yf01ty")},m(r,i){g(r,e,i),L(e,n)},p(r,i){i&4&&ue(n,r[2])},d(r){r&&_(e)}}}function qo(t){let e,n,r,i,o,s,l,a,c,u=t[2]&&nn(t);return{c(){e=I("div"),n=I("div"),n.innerHTML='<label for="email">Email</label>',r=S(),i=I("div"),o=I("input"),l=S(),u&&u.c(),b(n,"class","form-label svelte-yf01ty"),b(o,"name","email"),b(o,"placeholder","john@appleseed.com"),b(o,"autocapitalize","off"),b(o,"class","svelte-yf01ty"),b(i,"class",s="form-input "+t[4]+" svelte-yf01ty"),b(e,"class","form-container svelte-yf01ty")},m(f,m){g(f,e,m),L(e,n),L(e,r),L(e,i),L(i,o),Et(o,t[3]),L(e,l),u&&u.m(e,null),a||(c=Te(o,"input",t[8]),a=!0)},p(f,m){m&8&&o.value!==f[3]&&Et(o,f[3]),m&16&&s!==(s="form-input "+f[4]+" svelte-yf01ty")&&b(i,"class",s),f[2]?u?u.p(f,m):(u=nn(f),u.c(),u.m(e,null)):u&&(u.d(1),u=null)},d(f){f&&_(e),u&&u.d(),a=!1,c()}}}function xo(t){let e;return{c(){e=V("Continue")},m(n,r){g(n,e,r)},i:h,o:h,d(n){n&&_(e)}}}function Go(t){let e,n;return e=new Yt({}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function Vo(t){let e,n,r,i;const o=[Go,xo],s=[];function l(a,c){return a[1]?0:1}return e=l(t),n=s[e]=o[e](t),{c(){n.c(),r=ae()},m(a,c){s[e].m(a,c),g(a,r,c),i=!0},p(a,c){let u=e;e=l(a),e!==u&&(X(),p(s[u],1,1,()=>{s[u]=null}),Z(),n=s[e],n||(n=s[e]=o[e](a),n.c()),d(n,1),n.m(r.parentNode,r))},i(a){i||(d(n),i=!0)},o(a){p(n),i=!1},d(a){a&&_(r),s[e].d(a)}}}function Yo(t){let e,n;return e=new it({props:{disabled:t[1],type:"submit",$$slots:{default:[Vo]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p(r,i){const o={};i&2&&(o.disabled=r[1]),i&514&&(o.$$scope={dirty:i,ctx:r}),e.$set(o)},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function zo(t){let e,n;return e=new Le({props:{$$slots:{default:[Yo]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p(r,i){const o={};i&514&&(o.$$scope={dirty:i,ctx:r}),e.$set(o)},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function Wo(t){let e,n,r,i,o,s,l,a,c,u;return n=new lt({props:{$$slots:{default:[Ho]},$$scope:{ctx:t}}}),o=new Ee({props:{$$slots:{default:[qo]},$$scope:{ctx:t}}}),l=new ot({props:{$$slots:{default:[zo]},$$scope:{ctx:t}}}),{c(){e=I("div"),T(n.$$.fragment),r=S(),i=I("form"),T(o.$$.fragment),s=S(),T(l.$$.fragment),b(i,"class","svelte-yf01ty"),b(e,"class","container svelte-yf01ty")},m(f,m){g(f,e,m),k(n,e,null),L(e,r),L(e,i),k(o,i,null),L(i,s),k(l,i,null),a=!0,c||(u=Te(i,"submit",yt(t[5])),c=!0)},p(f,[m]){const w={};m&513&&(w.$$scope={dirty:m,ctx:f}),n.$set(w);const v={};m&540&&(v.$$scope={dirty:m,ctx:f}),o.$set(v);const O={};m&514&&(O.$$scope={dirty:m,ctx:f}),l.$set(O)},i(f){a||(d(n.$$.fragment,f),d(o.$$.fragment,f),d(l.$$.fragment,f),a=!0)},o(f){p(n.$$.fragment,f),p(o.$$.fragment,f),p(l.$$.fragment,f),a=!1},d(f){f&&_(e),P(n),P(o),P(l),c=!1,u()}}}function Ko(t,e,n){let r,i,o,{onContinue:s}=e,{onClose:l}=e,{processing:a}=e,{lastError:c}=e;const u=async()=>{const m=Co(r);m?n(2,i=m):s({email:r})};xn(async()=>{n(2,i=(c==null?void 0:c.message)??"")});function f(){r=this.value,n(3,r)}return t.$$set=m=>{"onContinue"in m&&n(6,s=m.onContinue),"onClose"in m&&n(0,l=m.onClose),"processing"in m&&n(1,a=m.processing),"lastError"in m&&n(7,c=m.lastError)},t.$$.update=()=>{t.$$.dirty&4&&n(4,o=i?"error":"")},n(3,r=""),n(2,i=""),[l,a,i,r,o,u,s,c,f]}class Qo extends F{constructor(e){super(),C(this,e,Ko,Wo,A,{onContinue:6,onClose:0,processing:1,lastError:7},jo)}}function Xo(t){R(t,"svelte-17tslso",".rcb-modal-backdrop.svelte-17tslso{position:fixed;top:0;left:0;right:0;min-width:100%;width:100vw;width:100dvw;min-height:100%;height:100vh;height:100dvh;background-color:rgba(40, 40, 40, 0.75);display:flex;flex-direction:column;justify-content:space-around;z-index:1000001}")}function Zo(t){let e,n;const r=t[1].default,i=H(r,t,t[0],null);return{c(){e=I("div"),i&&i.c(),b(e,"class","rcb-modal-backdrop svelte-17tslso")},m(o,s){g(o,e,s),i&&i.m(e,null),n=!0},p(o,[s]){i&&i.p&&(!n||s&1)&&W(i,r,o,o[0],n?z(r,o[0],s,null):K(o[0]),null)},i(o){n||(d(i,o),n=!0)},o(o){p(i,o),n=!1},d(o){o&&_(e),i&&i.d(o)}}}function Jo(t,e,n){let{$$slots:r={},$$scope:i}=e;return t.$$set=o=>{"$$scope"in o&&n(0,i=o.$$scope)},[i,r]}class es extends F{constructor(e){super(),C(this,e,Jo,Zo,A,{},Xo)}}function ts(t){R(t,"svelte-1fufj5b",".rcb-modal-container.svelte-1fufj5b{width:100%}.rcb-modal-main.svelte-1fufj5b{box-sizing:border-box;border-radius:var(--rc-shape-modal-border-radius);background-color:var(--rc-color-background);color:var(--rc-color-grey-text-dark);padding:40px;flex-direction:column;display:flex}@media screen and (max-width: 960px){.rcb-modal-container.svelte-1fufj5b{width:calc(100% - 32px);min-width:300px;max-width:640px;margin:auto}.rcb-modal-main.svelte-1fufj5b{min-width:300px;max-width:640px;padding:32px}}")}function ns(t){let e,n,r;const i=t[2].default,o=H(i,t,t[1],null);return{c(){e=I("div"),n=I("main"),o&&o.c(),b(n,"class","rcb-modal-main svelte-1fufj5b"),b(n,"style",t[0]),b(e,"class","rcb-modal-container svelte-1fufj5b")},m(s,l){g(s,e,l),L(e,n),o&&o.m(n,null),r=!0},p(s,[l]){o&&o.p&&(!r||l&2)&&W(o,i,s,s[1],r?z(i,s[1],l,null):K(s[1]),null),(!r||l&1)&&b(n,"style",s[0])},i(s){r||(d(o,s),r=!0)},o(s){p(o,s),r=!1},d(s){s&&_(e),o&&o.d(s)}}}function rs(t,e,n){let{$$slots:r={},$$scope:i}=e,{style:o=""}=e;return t.$$set=s=>{"style"in s&&n(0,o=s.style),"$$scope"in s&&n(1,i=s.$$scope)},[o,i,r]}class rn extends F{constructor(e){super(),C(this,e,rs,ns,A,{style:0},ts)}}function is(t){let e;const n=t[1].default,r=H(n,t,t[2],null);return{c(){r&&r.c()},m(i,o){r&&r.m(i,o),e=!0},p(i,o){r&&r.p&&(!e||o&4)&&W(r,n,i,i[2],e?z(n,i[2],o,null):K(i[2]),null)},i(i){e||(d(r,i),e=!0)},o(i){p(r,i),e=!1},d(i){r&&r.d(i)}}}function os(t){let e,n;return e=new es({props:{$$slots:{default:[ss]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p(r,i){const o={};i&4&&(o.$$scope={dirty:i,ctx:r}),e.$set(o)},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function ss(t){let e;const n=t[1].default,r=H(n,t,t[2],null);return{c(){r&&r.c()},m(i,o){r&&r.m(i,o),e=!0},p(i,o){r&&r.p&&(!e||o&4)&&W(r,n,i,i[2],e?z(n,i[2],o,null):K(i[2]),null)},i(i){e||(d(r,i),e=!0)},o(i){p(r,i),e=!1},d(i){r&&r.d(i)}}}function ls(t){let e,n,r,i;const o=[os,is],s=[];function l(a,c){return a[0]?0:1}return e=l(t),n=s[e]=o[e](t),{c(){n.c(),r=ae()},m(a,c){s[e].m(a,c),g(a,r,c),i=!0},p(a,[c]){let u=e;e=l(a),e===u?s[e].p(a,c):(X(),p(s[u],1,1,()=>{s[u]=null}),Z(),n=s[e],n?n.p(a,c):(n=s[e]=o[e](a),n.c()),d(n,1),n.m(r.parentNode,r))},i(a){i||(d(n),i=!0)},o(a){p(n),i=!1},d(a){a&&_(r),s[e].d(a)}}}function as(t,e,n){let{$$slots:r={},$$scope:i}=e,{condition:o=!1}=e;return t.$$set=s=>{"condition"in s&&n(0,o=s.condition),"$$scope"in s&&n(2,i=s.$$scope)},[o,r,i]}class cs extends F{constructor(e){super(),C(this,e,as,ls,A,{condition:0})}}const us=`<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"
53
+ `;var us=E('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-1z0jca3"><!></div>');const fs={hash:"svelte-1z0jca3",code:"div.svelte-1z0jca3 {height:24px;width:24px;}"};function ds(e){j(e,fs);var r=us(),t=x(r);Rr(t,()=>cs),p(e,r)}var vs=E('<div class="processing svelte-rjmul6"></div>');const ps={hash:"svelte-rjmul6",code:`.processing.svelte-rjmul6 {width:12px;aspect-ratio:1;border-radius:50%;
54
+ animation: svelte-rjmul6-l5 1.5s infinite linear;}
55
+ @keyframes svelte-rjmul6-l5 {
56
+ 0% {
57
+ box-shadow:
58
+ 20px 0 #fff2,
59
+ -20px 0 #fff2;
60
+ background: #fff2;
61
+ }
62
+ 25% {
63
+ box-shadow:
64
+ 20px 0 #fff2,
65
+ -20px 0 #ffff;
66
+ background: #fff2;
67
+ }
68
+ 50% {
69
+ box-shadow:
70
+ 20px 0 #fff2,
71
+ -20px 0 #fff2;
72
+ background: #ffff;
73
+ }
74
+ 75% {
75
+ box-shadow:
76
+ 20px 0 #ffff,
77
+ -20px 0 #fff2;
78
+ background: #fff2;
79
+ }
80
+ 100% {
81
+ box-shadow:
82
+ 20px 0 #fff2,
83
+ -20px 0 #fff2;
84
+ background: #fff2;
85
+ }
86
+ }`};function Jn(e){j(e,ps);var r=vs();p(e,r)}const hs={error:"#f2545b",warning:"#f4e971",focus:"#000080",accent:"#767676",primary:"#000000","primary-text":"#ffffff",white:"#ffffff","grey-text-dark":"rgba(0,0,0,1)","grey-text-light":"rgba(0,0,0,0.5)","grey-ui-dark":"rgba(0,0,0,0.125)","grey-ui-light":"rgba(0,0,0,0.005)","input-background":"transparent",background:"white"},gs={error:"#f2545b",warning:"#f4e971",focus:"#000080",accent:"#767676",primary:"#ffffff","primary-text":"#000000",white:"#ffffff","grey-text-dark":"rgba(255,255,255,1)","grey-text-light":"rgba(255,255,255,0.5)","grey-ui-dark":"rgba(255,255,255,0.125)","grey-ui-light":"rgba(255,255,255,0.005)","input-background":"transparent",background:"#000000"},ei={error:"color_error",focus:"color_accent",accent:"color_accent",primary:"color_buttons_primary"},_s={...ei,background:"color_form_bg"},ms={...ei,background:"color_product_info_bg"},ri={"input-border-radius":"12px","input-button-border-radius":"12px","modal-border-radius":"16px"},bs={"input-border-radius":"0px","input-button-border-radius":"0px","modal-border-radius":"0px"},ys={"input-border-radius":"24px","input-button-border-radius":"56px","modal-border-radius":"16px"},ti=ri,ni=e=>e.length==7?{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16)}:e.length==4?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null,ii=({r:e,g:r,b:t,luminanceThreshold:n})=>{const i=a=>(a=a/255,a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4));return .2126*i(e)+.7152*i(r)+.0722*i(t)>n},oi=.37,Es=(e,r=oi)=>{const t=ii({...e,luminanceThreshold:r})?"0,0,0":"255,255,255";return{"grey-text-dark":`rgba(${t},1.0)`,"grey-text-light":`rgba(${t},0.50)`,"grey-ui-dark":`rgba(${t},0.125)`,"grey-ui-light":`rgba(${t},0.05)`}},ws=(e,r,t,n=oi)=>{const i={"grey-text-dark":t["grey-text-dark"],"grey-text-light":t["grey-text-light"],"grey-ui-dark":t["grey-ui-dark"],"grey-ui-light":t["grey-ui-light"],"primary-text":t["primary-text"]};if(e!=null&&e.startsWith("#")){const o=ni(e);o!==null&&Object.assign(i,Es(o))}if(r!=null&&r.startsWith("#")){const o=ni(r);o!==null&&(i["primary-text"]=ii({...o,luminanceThreshold:n})?"black":"white")}return i},Is=(e,r)=>e||r,xs=(e,r,t)=>{const n=Object.entries(e).map(([i,o])=>[i,Is(t?t[o]:null,r[i])]);return Object.fromEntries(n)},ai=(e,r,t)=>{const n=xs(e,r,t);return t?{...r,...n,...ws(n.background,n.primary,r)}:{...r}},Ps=e=>ai(ms,gs,e),si=e=>ai(_s,hs,e),Lt=e=>{if(!e)return ti;switch(e.shapes){case"rounded":return ri;case"rectangle":return bs;case"pill":return ys;default:return ti}},st=(e="",r)=>r.map(([t,n])=>`--rc-${e}-${t}: ${n}`).join("; "),li=e=>{const r=st("color",Object.entries(Ps(e))),t=st("shape",Object.entries(Lt(e)));return[r,t].join("; ")},Ts=e=>{const r=st("color",Object.entries(si(e))),t=st("shape",Object.entries(Lt(e)));return[r,t].join("; ")};class $t{constructor(r){this.brandingAppearance=r}get shape(){return Lt(this.brandingAppearance)}get formColors(){return si(this.brandingAppearance)}get formStyleVars(){return Ts(this.brandingAppearance)}get productInfoStyleVars(){return li(this.brandingAppearance)}}var As=E('<div style="display: flex; align-items: center; justify-content: baseline;"><!> <div style="margin-left: 10px">Secure Checkout</div></div> <!>',1),Os=E('<div class="rcb-stripe-elements-container svelte-8jsoa8"><!></div>'),ks=E("<!> <!>",1),Ns=E("<!> <form><!></form>",1),Rs=E("<div><!></div>");const Ss={hash:"svelte-8jsoa8",code:`.rcb-stripe-elements-container.svelte-8jsoa8 {width:100%;
87
+
88
+ /* The standard height of the payment form from Stripe */
89
+ /* Added to avoid the card getting smaller while loading */min-height:320px;margin-top:32px;margin-bottom:24px;}`};function Us(e,r){var y;we(r,!1),j(e,Ss);let t=h(r,"onClose",8),n=h(r,"onContinue",8),i=h(r,"onError",8),o=h(r,"paymentInfoCollectionMetadata",8),a=h(r,"processing",12,!1),s=h(r,"productDetails",8),c=h(r,"purchaseOptionToUse",8),l=h(r,"brandingInfo",8);const u=o().data.client_secret;let f=pe(null),d=pe(),m=pe();nt(async()=>{const O=o().data.publishable_api_key,V=o().data.stripe_account_id;if(!O||!V)throw new Error("Stripe publishable key or account ID not found");R(f,await as(O,{stripeAccount:V}))});const w=async()=>{if(a()||!v(f)||!v(m))return;a(!0);const O=await v(f).confirmSetup({elements:v(m),redirect:"if_required"});O.error?(a(!1),i()(new z(ie.StripeError,O.error.message))):n()()},g=new $t((y=l())==null?void 0:y.appearance);let T=g.shape,b=g.formColors;Ye(()=>v(d),()=>{v(d)&&v(d)._elements.length>0&&R(m,v(d))}),mt(),Te();var I=Rs(),A=x(I);F(A,()=>v(f)&&u,O=>{var V=Ns(),$=B(V);Ut($,{children:(S,W)=>{var be=As(),hr=B(be),Mr=x(hr);ds(Mr);var gr=L(hr,2);St(gr,{$$events:{click(..._r){var Se;(Se=t())==null||Se.apply(this,_r)}}}),p(S,be)},$$slots:{default:!0}});var H=L($,2),Q=x(H),me=he(()=>({borderRadius:T["input-border-radius"],fontSizeBase:"16px",fontSizeSm:"16px",spacingGridRow:"16px",focusBoxShadow:"none",colorDanger:b.error,colorTextPlaceholder:b["grey-text-light"]})),Ke=he(()=>({".Input":{boxShadow:"none",border:`2px solid ${b["grey-ui-dark"]}`,backgroundColor:"transparent",color:b["grey-text-dark"]},".Input:focus":{border:`2px solid ${b.focus}`,outline:"none"},".Label":{marginBottom:"8px",fontWeight:"500",lineHeight:"22px",color:b["grey-text-dark"]},".Input--invalid":{boxShadow:"none"},".Tab":{boxShadow:"none",backgroundColor:"transparent"}}));Xa(Q,{get stripe(){return v(f)},clientSecret:u,loader:"always",locale:"en",get elements(){return v(d)},set elements(S){R(d,S)},theme:"stripe",get variables(){return v(me)},get rules(){return v(Ke)},children:(S,W)=>{var be=ks(),hr=B(be);fr(hr,{children:(gr,_r)=>{var Se=Os(),ft=x(Se);Za(ft,{}),p(gr,Se)},$$slots:{default:!0}});var Mr=L(hr,2);Rt(Mr,{children:(gr,_r)=>{Lr(gr,{children:(Se,ft)=>{Nt(Se,{get disabled(){return a()},testId:"PayButton",children:(Ct,Qe)=>{var Br=_e(),Ae=B(Br);F(Ae,a,He=>{Jn(He)},He=>{var Ue=_e(),Ze=B(Ue);F(Ze,()=>{var fe,de;return(de=(fe=s().subscriptionOptions)==null?void 0:fe[c().id])==null?void 0:de.trial},fe=>{var de=We("Start Trial");p(fe,de)},fe=>{var de=We("Pay");p(fe,de)},!0),p(He,Ue)}),p(Ct,Br)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}}),p(S,be)},$$slots:{default:!0},$$legacy:!0}),rt("submit",H,Un(w)),p(O,V)},O=>{kt(O)}),p(e,I),Ie()}function Ls(e){return e.trim()===""?"You need to provide your email address to continue.":e.match(/^[^@]+@[^@]+\.[^@]+$/)?null:"Email is not valid. Please provide a valid email address."}function $s(e){if(e&&!e.match(/^[A-Z]{3}$/)){const r=`Currency code ${e} is not valid. Please provide a valid ISO 4217 currency code.`;throw C.errorLog(r),new X(re.ConfigurationError,r)}}var Ds=E("<span>Billing email address</span> <!>",1),Ms=E('<div class="form-error svelte-yf01ty"> </div>'),Bs=E('<div class="form-container svelte-yf01ty"><div class="form-label svelte-yf01ty"><label for="email">Email</label></div> <div><input name="email" placeholder="john@appleseed.com" autocapitalize="off" class="svelte-yf01ty"></div> <!></div>'),Fs=E('<div class="container svelte-yf01ty"><!> <form class="svelte-yf01ty"><!> <!></form></div>');const qs={hash:"svelte-yf01ty",code:".container.svelte-yf01ty {display:flex;flex-direction:column;flex-grow:1;}form.svelte-yf01ty {display:flex;flex-direction:column;min-height:100%;flex-grow:1;}.form-container.svelte-yf01ty {display:flex;flex-direction:column;width:100%;margin-top:32px;margin-bottom:16px;}.form-label.svelte-yf01ty {margin-top:8px;margin-bottom:8px;display:block;font-weight:500;line-height:22px;}.form-input.error.svelte-yf01ty input:where(.svelte-yf01ty) {border-color:var(--rc-color-error);}.form-error.svelte-yf01ty {margin-top:4px;font-size:16px;line-height:20px;min-height:40px;color:var(--rc-color-error);}input.svelte-yf01ty {width:100%;box-sizing:border-box;padding:8px;border:2px solid var(--rc-color-grey-ui-dark);border-radius:var(--rc-shape-input-border-radius);font-size:16px;height:48px;padding:6px 14px;background:var(--rc-color-input-background);color:inherit;}input.svelte-yf01ty:focus {outline:none;border:2px solid var(--rc-color-focus);}"};function js(e,r){we(r,!1),j(e,qs);const t=pe(),n=pe(),i=pe();let o=h(r,"onContinue",8),a=h(r,"onClose",8),s=h(r,"processing",8),c=h(r,"lastError",8);const l=async()=>{const g=Ls(v(t));g?R(n,g):o()({email:v(t)})};Uo(async()=>{var g;R(n,((g=c())==null?void 0:g.message)??"")}),Ye(()=>{},()=>{R(t,"")}),Ye(()=>{},()=>{R(n,"")}),Ye(()=>v(n),()=>{R(i,v(n)?"error":"")}),mt(),Te();var u=Fs(),f=x(u);Ut(f,{children:(g,T)=>{var b=Ds(),I=L(B(b),2);St(I,{$$events:{click(...A){var y;(y=a())==null||y.apply(this,A)}}}),p(g,b)},$$slots:{default:!0}});var d=L(f,2),m=x(d);fr(m,{children:(g,T)=>{var b=Bs(),I=L(x(b),2),A=x(I),y=L(I,2);F(y,()=>v(n),O=>{var V=Ms(),$=x(V);G(()=>se($,v(n))),p(O,V)}),G(()=>kn(I,`form-input ${v(i)??""} svelte-yf01ty`)),ko(A,()=>v(t),O=>R(t,O)),p(g,b)},$$slots:{default:!0}});var w=L(m,2);Rt(w,{children:(g,T)=>{Lr(g,{children:(b,I)=>{Nt(b,{get disabled(){return s()},type:"submit",children:(A,y)=>{var O=_e(),V=B(O);F(V,s,$=>{Jn($)},$=>{var H=We("Continue");p($,H)}),p(A,O)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}}),rt("submit",d,Un(l)),p(e,u),Ie()}var Cs=E('<div class="rcb-modal-backdrop svelte-17tslso"><!></div>');const Hs={hash:"svelte-17tslso",code:".rcb-modal-backdrop.svelte-17tslso {position:fixed;top:0;left:0;right:0;min-width:100%;width:100vw;width:100dvw;min-height:100%;height:100vh;height:100dvh;background-color:rgba(40, 40, 40, 0.75);display:flex;flex-direction:column;justify-content:space-around;z-index:1000001;}"};function Vs(e,r){j(e,Hs);var t=Cs(),n=x(t);K(n,r,"default",{}),p(e,t)}var Gs=E('<div class="rcb-modal-container svelte-1fufj5b"><main class="rcb-modal-main svelte-1fufj5b"><!></main></div>');const Ys={hash:"svelte-1fufj5b",code:`.rcb-modal-container.svelte-1fufj5b {width:100%;}.rcb-modal-main.svelte-1fufj5b {box-sizing:border-box;border-radius:var(--rc-shape-modal-border-radius);background-color:var(--rc-color-background);color:var(--rc-color-grey-text-dark);padding:40px;flex-direction:column;display:flex;}
90
+
91
+ @media screen and (max-width: 960px) {.rcb-modal-container.svelte-1fufj5b {width:calc(100% - 32px);min-width:300px;max-width:640px;margin:auto;}.rcb-modal-main.svelte-1fufj5b {min-width:300px;max-width:640px;padding:32px;}
92
+ }`};function ci(e,r){j(e,Ys);let t=h(r,"style",8,"");var n=Gs(),i=x(n),o=x(i);K(o,r,"default",{}),G(()=>le(i,"style",t())),p(e,n)}function Ws(e,r){let t=h(r,"condition",8,!1);var n=_e(),i=B(n);F(i,t,o=>{Vs(o,{children:(a,s)=>{var c=_e(),l=B(c);K(l,r,"default",{}),p(a,c)},$$slots:{default:!0}})},o=>{var a=_e(),s=B(a);K(s,r,"default",{}),p(o,a)}),p(e,n)}const zs=`<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"
22
93
  xmlns="http://www.w3.org/2000/svg">
23
94
  <g opacity="0.5" clip-path="url(#clip0_344_3390)">
24
95
  <path d="M7 18C5.9 18 5.01 18.9 5.01 20C5.01 21.1 5.9 22 7 22C8.1 22 9 21.1 9 20C9 18.9 8.1 18 7 18ZM1 2V4H3L6.6 11.59L5.25 14.04C5.09 14.32 5 14.65 5 15C5 16.1 5.9 17 7 17H19V15H7.42C7.28 15 7.17 14.89 7.17 14.75L7.2 14.63L8.1 13H15.55C16.3 13 16.96 12.59 17.3 11.97L20.88 5.48C20.96 5.34 21 5.17 21 5C21 4.45 20.55 4 20 4H5.21L4.27 2H1ZM17 18C15.9 18 15.01 18.9 15.01 20C15.01 21.1 15.9 22 17 22C18.1 22 19 21.1 19 20C19 18.9 18.1 18 17 18Z"
@@ -30,7 +101,19 @@
30
101
  </clipPath>
31
102
  </defs>
32
103
  </svg>
33
- `;function fs(t){let e;return{c(){e=I("div"),fe(e,"color","var(--rc-color-gray-text-dark)")},m(n,r){g(n,e,r),e.innerHTML=us},p:h,i:h,o:h,d(n){n&&_(e)}}}class ds extends F{constructor(e){super(),C(this,e,null,fs,A,{})}}function ps(t){R(t,"svelte-1ny4y2s","div.svelte-1ny4y2s{background-color:var(--rc-color-warning);color:rgba(0,0,0,1);font-size:10px;font-weight:bold;text-transform:uppercase;padding:4px 10px;line-height:10px;border-radius:9px;margin:0px;margin-left:16px}")}function ms(t){let e;return{c(){e=I("div"),e.textContent="Sandbox",b(e,"class","svelte-1ny4y2s")},m(n,r){g(n,e,r)},p:h,i:h,o:h,d(n){n&&_(e)}}}class _s extends F{constructor(e){super(),C(this,e,null,ms,A,{},ps)}}function gs(t){R(t,"svelte-1iuls9l",".rcb-ui-layout.svelte-1iuls9l{width:100vw;margin-right:auto;display:flex;justify-content:center;align-items:flex-start;position:relative;padding:0px 80px;box-sizing:border-box}@media screen and (max-width: 960px){.rcb-ui-layout.svelte-1iuls9l{flex-direction:column;align-items:center;justify-content:center;height:100%;min-width:100%}}@media screen and (max-width: 960px) and (max-height: 960px){.rcb-ui-layout.svelte-1iuls9l{overflow-y:scroll;justify-content:flex-start;padding:16px 0}}")}function hs(t){let e,n;const r=t[2].default,i=H(r,t,t[1],null);return{c(){e=I("div"),i&&i.c(),b(e,"class","rcb-ui-layout svelte-1iuls9l"),b(e,"style",t[0])},m(o,s){g(o,e,s),i&&i.m(e,null),n=!0},p(o,[s]){i&&i.p&&(!n||s&2)&&W(i,r,o,o[1],n?z(r,o[1],s,null):K(o[1]),null),(!n||s&1)&&b(e,"style",o[0])},i(o){n||(d(i,o),n=!0)},o(o){p(i,o),n=!1},d(o){o&&_(e),i&&i.d(o)}}}function bs(t,e,n){let{$$slots:r={},$$scope:i}=e,{style:o=""}=e;return t.$$set=s=>{"style"in s&&n(0,o=s.style),"$$scope"in s&&n(1,i=s.$$scope)},[o,i,r]}class ws extends F{constructor(e){super(),C(this,e,bs,hs,A,{style:0},gs)}}function ys(t){R(t,"svelte-1sfb5if",`.rcb-ui-container.svelte-1sfb5if{color-scheme:none;font-size:16px;line-height:1.5em;font-weight:400;font-family:-apple-system, "system-ui", "Segoe UI", Roboto, Oxygen, Ubuntu,
34
- Cantarell, "Open Sans", "Helvetica Neue", sans-serif}`)}function Es(t){let e,n;const r=t[2].default,i=H(r,t,t[1],null);return{c(){e=I("div"),i&&i.c(),b(e,"class","rcb-ui-container svelte-1sfb5if"),b(e,"style",t[0])},m(o,s){g(o,e,s),i&&i.m(e,null),n=!0},p(o,[s]){i&&i.p&&(!n||s&2)&&W(i,r,o,o[1],n?z(r,o[1],s,null):K(o[1]),null),(!n||s&1)&&b(e,"style",o[0])},i(o){n||(d(i,o),n=!0)},o(o){p(i,o),n=!1},d(o){o&&_(e),i&&i.d(o)}}}function Is(t,e,n){let{$$slots:r={},$$scope:i}=e,{style:o=""}=e;return t.$$set=s=>{"style"in s&&n(0,o=s.style),"$$scope"in s&&n(1,i=s.$$scope)},[o,i,r]}class vs extends F{constructor(e){super(),C(this,e,Is,Es,A,{style:0},ys)}}function $s(t){R(t,"svelte-17dr902",".rcb-ui-aside.svelte-17dr902{margin-right:16px;flex:320px 1 0;max-width:480px}@media screen and (max-width: 960px){.rcb-ui-aside.svelte-17dr902{margin-right:0;margin-bottom:16px;min-width:100%;display:flex;flex-direction:column;align-items:center;flex:none;max-width:none}}")}const ks=t=>({}),on=t=>({});function Ps(t){let e,n;const r=t[2].header,i=H(r,t,t[3],on),o=t[2].default,s=H(o,t,t[3],null);return{c(){i&&i.c(),e=S(),s&&s.c()},m(l,a){i&&i.m(l,a),g(l,e,a),s&&s.m(l,a),n=!0},p(l,a){i&&i.p&&(!n||a&8)&&W(i,r,l,l[3],n?z(r,l[3],a,ks):K(l[3]),on),s&&s.p&&(!n||a&8)&&W(s,o,l,l[3],n?z(o,l[3],a,null):K(l[3]),null)},i(l){n||(d(i,l),d(s,l),n=!0)},o(l){p(i,l),p(s,l),n=!1},d(l){l&&_(e),i&&i.d(l),s&&s.d(l)}}}function Ts(t){let e,n,r;return n=new rn({props:{$$slots:{default:[Ps]},$$scope:{ctx:t}}}),{c(){e=I("div"),T(n.$$.fragment),b(e,"class","rcb-ui-aside svelte-17dr902"),b(e,"style",t[0])},m(i,o){g(i,e,o),k(n,e,null),r=!0},p(i,[o]){const s={};o&8&&(s.$$scope={dirty:o,ctx:i}),n.$set(s)},i(i){r||(d(n.$$.fragment,i),r=!0)},o(i){p(n.$$.fragment,i),r=!1},d(i){i&&_(e),P(n)}}}function As(t,e,n){let{$$slots:r={},$$scope:i}=e,{brandingAppearance:o=void 0}=e,s=new ct(o).productInfoStyleVars;return t.$$set=l=>{"brandingAppearance"in l&&n(1,o=l.brandingAppearance),"$$scope"in l&&n(3,i=l.$$scope)},[s,o,r,i]}class Os extends F{constructor(e){super(),C(this,e,As,Ts,A,{brandingAppearance:1},$s)}}function Ns(t){R(t,"svelte-vpgys",".rcb-ui-main.svelte-vpgys{flex:480px 1 0;max-width:640px}@media screen and (max-width: 960px){.rcb-ui-main.svelte-vpgys{flex:none;max-width:none;min-width:100%}}")}const Us=t=>({}),sn=t=>({});function Rs(t){let e,n;const r=t[2].header,i=H(r,t,t[3],sn),o=t[2].default,s=H(o,t,t[3],null);return{c(){i&&i.c(),e=S(),s&&s.c()},m(l,a){i&&i.m(l,a),g(l,e,a),s&&s.m(l,a),n=!0},p(l,a){i&&i.p&&(!n||a&8)&&W(i,r,l,l[3],n?z(r,l[3],a,Us):K(l[3]),sn),s&&s.p&&(!n||a&8)&&W(s,o,l,l[3],n?z(o,l[3],a,null):K(l[3]),null)},i(l){n||(d(i,l),d(s,l),n=!0)},o(l){p(i,l),p(s,l),n=!1},d(l){l&&_(e),i&&i.d(l),s&&s.d(l)}}}function Ls(t){let e,n,r;return n=new rn({props:{style:"min-height: 360px;",$$slots:{default:[Rs]},$$scope:{ctx:t}}}),{c(){e=I("div"),T(n.$$.fragment),b(e,"class","rcb-ui-main svelte-vpgys"),b(e,"style",t[0])},m(i,o){g(i,e,o),k(n,e,null),r=!0},p(i,[o]){const s={};o&8&&(s.$$scope={dirty:o,ctx:i}),n.$set(s)},i(i){r||(d(n.$$.fragment,i),r=!0)},o(i){p(n.$$.fragment,i),r=!1},d(i){i&&_(e),P(n)}}}function Ss(t,e,n){let{$$slots:r={},$$scope:i}=e,{brandingAppearance:o=void 0}=e,s=new ct(o).formStyleVars;return t.$$set=l=>{"brandingAppearance"in l&&n(1,o=l.brandingAppearance),"$$scope"in l&&n(3,i=l.$$scope)},[s,o,r,i]}class Ms extends F{constructor(e){super(),C(this,e,Ss,Ls,A,{brandingAppearance:1},Ns)}}function ln(t){var r;let e,n;return e=new Os({props:{brandingAppearance:(r=t[1])==null?void 0:r.appearance,$$slots:{header:[js],default:[Ds]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(i,o){k(e,i,o),n=!0},p(i,o){var l;const s={};o&2&&(s.brandingAppearance=(l=i[1])==null?void 0:l.appearance),o&67108886&&(s.$$scope={dirty:o,ctx:i}),e.$set(s)},i(i){n||(d(e.$$.fragment,i),n=!0)},o(i){p(e.$$.fragment,i),n=!1},d(i){P(e,i)}}}function an(t){var r;let e,n;return e=new Ut({props:{productDetails:t[4],brandingAppearance:(r=t[1])==null?void 0:r.appearance,purchaseOption:t[8]}}),{c(){T(e.$$.fragment)},m(i,o){k(e,i,o),n=!0},p(i,o){var l;const s={};o&16&&(s.productDetails=i[4]),o&2&&(s.brandingAppearance=(l=i[1])==null?void 0:l.appearance),e.$set(s)},i(i){n||(d(e.$$.fragment,i),n=!0)},o(i){p(e.$$.fragment,i),n=!1},d(i){P(e,i)}}}function Ds(t){let e,n,r=t[4]&&t[8]&&an(t);return{c(){r&&r.c(),e=ae()},m(i,o){r&&r.m(i,o),g(i,e,o),n=!0},p(i,o){i[4]&&i[8]?r?(r.p(i,o),o&16&&d(r,1)):(r=an(i),r.c(),d(r,1),r.m(e.parentNode,e)):r&&(X(),p(r,1,1,()=>{r=null}),Z())},i(i){n||(d(r),n=!0)},o(i){p(r),n=!1},d(i){i&&_(e),r&&r.d(i)}}}function Bs(t){let e,n;return e=new ds({}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function Cs(t){let e,n;return e=new _s({}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function Fs(t){let e,n,r,i,o,s,l;e=new Dt({props:{brandingInfo:t[1]}});const a=[Cs,Bs],c=[];function u(f,m){return m&4&&(r=null),r==null&&(r=!!f[2].isSandbox()),r?0:1}return i=u(t,-1),o=c[i]=a[i](t),{c(){T(e.$$.fragment),n=S(),o.c(),s=ae()},m(f,m){k(e,f,m),g(f,n,m),c[i].m(f,m),g(f,s,m),l=!0},p(f,m){const w={};m&2&&(w.brandingInfo=f[1]),e.$set(w);let v=i;i=u(f,m),i!==v&&(X(),p(c[v],1,1,()=>{c[v]=null}),Z(),o=c[i],o||(o=c[i]=a[i](f),o.c()),d(o,1),o.m(s.parentNode,s))},i(f){l||(d(e.$$.fragment,f),d(o),l=!0)},o(f){p(e.$$.fragment,f),p(o),l=!1},d(f){f&&(_(n),_(s)),P(e,f),c[i].d(f)}}}function js(t){let e,n;return e=new lt({props:{slot:"header",$$slots:{default:[Fs]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p(r,i){const o={};i&67108870&&(o.$$scope={dirty:i,ctx:r}),e.$set(o)},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function cn(t){let e,n;return e=new Ut({props:{productDetails:t[4],purchaseOption:t[8]}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p(r,i){const o={};i&16&&(o.productDetails=r[4]),e.$set(o)},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function un(t){let e,n;return e=new rt({}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function fn(t){let e,n;return e=new Qo({props:{onContinue:t[11],onClose:t[10],processing:t[7]==="processing-auth-info",lastError:t[6]}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p(r,i){const o={};i&128&&(o.processing=r[7]==="processing-auth-info"),i&64&&(o.lastError=r[6]),e.$set(o)},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function dn(t){let e,n;return e=new Bo({props:{paymentInfoCollectionMetadata:t[5],onContinue:t[11],onClose:t[10],onError:t[12],processing:t[7]==="polling-purchase-status",productDetails:t[4],purchaseOptionToUse:t[8],brandingInfo:t[1]}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p(r,i){const o={};i&32&&(o.paymentInfoCollectionMetadata=r[5]),i&128&&(o.processing=r[7]==="polling-purchase-status"),i&16&&(o.productDetails=r[4]),i&2&&(o.brandingInfo=r[1]),e.$set(o)},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function pn(t){let e,n;return e=new rt({}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function mn(t){var r;let e,n;return e=new Pi({props:{brandingInfo:t[1],lastError:t[6]??new Q(te.UnknownError,"Unknown error without state set."),supportEmail:(r=t[1])==null?void 0:r.seller_company_support_email,productDetails:t[4],onContinue:t[13]}}),{c(){T(e.$$.fragment)},m(i,o){k(e,i,o),n=!0},p(i,o){var l;const s={};o&2&&(s.brandingInfo=i[1]),o&64&&(s.lastError=i[6]??new Q(te.UnknownError,"Unknown error without state set.")),o&2&&(s.supportEmail=(l=i[1])==null?void 0:l.seller_company_support_email),o&16&&(s.productDetails=i[4]),e.$set(s)},i(i){n||(d(e.$$.fragment,i),n=!0)},o(i){p(e.$$.fragment,i),n=!1},d(i){P(e,i)}}}function _n(t){let e,n;return e=new Di({props:{productDetails:t[4],brandingInfo:t[1],onContinue:t[11]}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p(r,i){const o={};i&16&&(o.productDetails=r[4]),i&2&&(o.brandingInfo=r[1]),e.$set(o)},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function Hs(t){let e,n,r,i,o,s,l,a,c=t[7]==="present-offer"&&t[4]&&t[8]&&cn(t),u=t[7]==="present-offer"&&!t[4]&&un(),f=(t[7]==="needs-auth-info"||t[7]==="processing-auth-info")&&fn(t),m=t[5]&&(t[7]==="needs-payment-info"||t[7]==="polling-purchase-status")&&t[4]&&t[8]&&dn(t),w=t[7]==="loading"&&pn(),v=t[7]==="error"&&mn(t),O=t[7]==="success"&&_n(t);return{c(){c&&c.c(),e=S(),u&&u.c(),n=S(),f&&f.c(),r=S(),m&&m.c(),i=S(),w&&w.c(),o=S(),v&&v.c(),s=S(),O&&O.c(),l=ae()},m(y,N){c&&c.m(y,N),g(y,e,N),u&&u.m(y,N),g(y,n,N),f&&f.m(y,N),g(y,r,N),m&&m.m(y,N),g(y,i,N),w&&w.m(y,N),g(y,o,N),v&&v.m(y,N),g(y,s,N),O&&O.m(y,N),g(y,l,N),a=!0},p(y,N){y[7]==="present-offer"&&y[4]&&y[8]?c?(c.p(y,N),N&144&&d(c,1)):(c=cn(y),c.c(),d(c,1),c.m(e.parentNode,e)):c&&(X(),p(c,1,1,()=>{c=null}),Z()),y[7]==="present-offer"&&!y[4]?u?N&144&&d(u,1):(u=un(),u.c(),d(u,1),u.m(n.parentNode,n)):u&&(X(),p(u,1,1,()=>{u=null}),Z()),y[7]==="needs-auth-info"||y[7]==="processing-auth-info"?f?(f.p(y,N),N&128&&d(f,1)):(f=fn(y),f.c(),d(f,1),f.m(r.parentNode,r)):f&&(X(),p(f,1,1,()=>{f=null}),Z()),y[5]&&(y[7]==="needs-payment-info"||y[7]==="polling-purchase-status")&&y[4]&&y[8]?m?(m.p(y,N),N&176&&d(m,1)):(m=dn(y),m.c(),d(m,1),m.m(i.parentNode,i)):m&&(X(),p(m,1,1,()=>{m=null}),Z()),y[7]==="loading"?w?N&128&&d(w,1):(w=pn(),w.c(),d(w,1),w.m(o.parentNode,o)):w&&(X(),p(w,1,1,()=>{w=null}),Z()),y[7]==="error"?v?(v.p(y,N),N&128&&d(v,1)):(v=mn(y),v.c(),d(v,1),v.m(s.parentNode,s)):v&&(X(),p(v,1,1,()=>{v=null}),Z()),y[7]==="success"?O?(O.p(y,N),N&128&&d(O,1)):(O=_n(y),O.c(),d(O,1),O.m(l.parentNode,l)):O&&(X(),p(O,1,1,()=>{O=null}),Z())},i(y){a||(d(c),d(u),d(f),d(m),d(w),d(v),d(O),a=!0)},o(y){p(c),p(u),p(f),p(m),p(w),p(v),p(O),a=!1},d(y){y&&(_(e),_(n),_(r),_(i),_(o),_(s),_(l)),c&&c.d(y),u&&u.d(y),f&&f.d(y),m&&m.d(y),w&&w.d(y),v&&v.d(y),O&&O.d(y)}}}function qs(t){var s;let e=t[9].includes(t[7]),n,r,i,o=e&&ln(t);return r=new Ms({props:{brandingAppearance:(s=t[1])==null?void 0:s.appearance,$$slots:{default:[Hs]},$$scope:{ctx:t}}}),{c(){o&&o.c(),n=S(),T(r.$$.fragment)},m(l,a){o&&o.m(l,a),g(l,n,a),k(r,l,a),i=!0},p(l,a){var u;a&128&&(e=l[9].includes(l[7])),e?o?(o.p(l,a),a&128&&d(o,1)):(o=ln(l),o.c(),d(o,1),o.m(n.parentNode,n)):o&&(X(),p(o,1,1,()=>{o=null}),Z());const c={};a&2&&(c.brandingAppearance=(u=l[1])==null?void 0:u.appearance),a&67109106&&(c.$$scope={dirty:a,ctx:l}),r.$set(c)},i(l){i||(d(o),d(r.$$.fragment,l),i=!0)},o(l){p(o),p(r.$$.fragment,l),i=!1},d(l){l&&_(n),o&&o.d(l),P(r,l)}}}function xs(t){let e,n;return e=new ws({props:{style:t[3],$$slots:{default:[qs]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p(r,i){const o={};i&8&&(o.style=r[3]),i&67109110&&(o.$$scope={dirty:i,ctx:r}),e.$set(o)},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function Gs(t){let e,n;return e=new cs({props:{condition:t[0],$$slots:{default:[xs]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p(r,i){const o={};i&1&&(o.condition=r[0]),i&67109118&&(o.$$scope={dirty:i,ctx:r}),e.$set(o)},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function Vs(t){let e,n;return e=new vs({props:{$$slots:{default:[Gs]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(r,i){k(e,r,i),n=!0},p(r,[i]){const o={};i&67109119&&(o.$$scope={dirty:i,ctx:r}),e.$set(o)},i(r){n||(d(e.$$.fragment,r),n=!0)},o(r){p(e.$$.fragment,r),n=!1},d(r){P(e,r)}}}function Ys(t,e,n){let{asModal:r=!0}=e,{customerEmail:i}=e,{appUserId:o}=e,{rcPackage:s}=e,{purchaseOption:l}=e,{brandingInfo:a}=e,{onFinished:c}=e,{onError:u}=e,{onClose:f}=e,{purchases:m}=e,{purchaseOperationHelper:w}=e,v="",O=null,y=null,N=null;const ie=s.rcBillingProduct.identifier??null,$=s.rcBillingProduct.defaultPurchaseOption,U=l||$;let x="present-offer",De=null;const Qe=["present-offer","needs-auth-info","processing-auth-info","needs-payment-info","polling-purchase-status","loading"];je(async()=>{if(n(4,O=s.rcBillingProduct),n(3,v=tn(a==null?void 0:a.appearance)),x==="present-offer"){i?kn():n(7,x="needs-auth-info");return}});const kl=()=>{f()},kn=()=>{if(ie===null){Be(new Q(te.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}else x==="present-offer"&&n(7,x="loading");if(!i){Be(new Q(te.MissingEmailError));return}w.startPurchase(o,ie,U,i,s.rcBillingProduct.presentedOfferingContext).then(D=>{if(D.next_action==="collect_payment_info"){n(6,N=null),n(7,x="needs-payment-info"),n(5,y=D);return}if(D.next_action==="completed"){n(6,N=null),n(7,x="success");return}}).catch(D=>{Be(D)})},Pl=D=>{if(x==="needs-auth-info"){D&&(n(14,i=D.email),n(7,x="processing-auth-info")),kn();return}if(x==="needs-payment-info"){n(7,x="polling-purchase-status"),w.pollCurrentPurchaseForCompletion().then(gt=>{n(7,x="success"),De=gt.redemptionInfo}).catch(gt=>{Be(gt)});return}if(x==="success"||x==="error"){c(De);return}n(7,x="success")},Be=D=>{if(x==="processing-auth-info"&&D.isRecoverable()){n(6,N=D),n(7,x="needs-auth-info");return}n(6,N=D),n(7,x="error")},Tl=()=>{u(N??new Q(te.UnknownError,"Unknown error without state set."))};return t.$$set=D=>{"asModal"in D&&n(0,r=D.asModal),"customerEmail"in D&&n(14,i=D.customerEmail),"appUserId"in D&&n(15,o=D.appUserId),"rcPackage"in D&&n(16,s=D.rcPackage),"purchaseOption"in D&&n(17,l=D.purchaseOption),"brandingInfo"in D&&n(1,a=D.brandingInfo),"onFinished"in D&&n(18,c=D.onFinished),"onError"in D&&n(19,u=D.onError),"onClose"in D&&n(20,f=D.onClose),"purchases"in D&&n(2,m=D.purchases),"purchaseOperationHelper"in D&&n(21,w=D.purchaseOperationHelper)},[r,a,m,v,O,y,N,x,U,Qe,kl,Pl,Be,Tl,i,o,s,l,c,u,f,w]}class zs extends F{constructor(e){super(),C(this,e,Ys,Vs,A,{asModal:0,customerEmail:14,appUserId:15,rcPackage:16,purchaseOption:17,brandingInfo:1,onFinished:18,onError:19,onClose:20,purchases:2,purchaseOperationHelper:21})}}function Ws(t){return t.expires_date==null?!0:new Date(t.expires_date)>new Date}function Ks(t,e,n,r){const i=e.product_identifier;if(i in n)return Qs(t,e,n[i]);if(i in r)return Xs(t,e,r[i]);throw new J(ee.CustomerInfoError,"Could not find entitlement product in subscriptions or non-subscriptions.")}function Qs(t,e,n){return{identifier:t,isActive:Ws(e),willRenew:el(e,n),store:(n==null?void 0:n.store)??"unknown",latestPurchaseDate:new Date(e.purchase_date),originalPurchaseDate:new Date(e.purchase_date),expirationDate:ze(e.expires_date),productIdentifier:e.product_identifier,unsubscribeDetectedAt:ze(n==null?void 0:n.unsubscribe_detected_at),billingIssueDetectedAt:ze(n==null?void 0:n.billing_issues_detected_at),isSandbox:(n==null?void 0:n.is_sandbox)??!1,periodType:(n==null?void 0:n.period_type)??"normal"}}function Xs(t,e,n){return{identifier:t,isActive:!0,willRenew:!1,store:n.store,latestPurchaseDate:new Date(e.purchase_date),originalPurchaseDate:new Date(n.original_purchase_date),expirationDate:null,productIdentifier:e.product_identifier,unsubscribeDetectedAt:null,billingIssueDetectedAt:null,isSandbox:n.is_sandbox,periodType:"normal"}}function Zs(t,e,n){const r={},i={};for(const o in t){const s=Ks(o,t[o],e,n);r[o]=s,s.isActive&&(i[o]=s)}return{all:r,active:i}}function ze(t){return t==null?null:new Date(t)}function Js(t){const e=nl(t),n=t.subscriber,r=il(n.non_subscriptions);return{entitlements:Zs(n.entitlements,n.subscriptions,r),allExpirationDatesByProduct:e,allPurchaseDatesByProduct:tl(t,r),activeSubscriptions:rl(e),managementURL:n.management_url,requestDate:new Date(t.request_date),firstSeenDate:new Date(n.first_seen),originalPurchaseDate:ze(n.original_purchase_date),originalAppUserId:t.subscriber.original_app_user_id}}function el(t,e){if(e==null)return!1;const n=e.store=="promotional",r=t.expires_date==null,i=e.unsubscribe_detected_at!=null,o=e.billing_issues_detected_at!=null;return!(n||r||i||o)}function tl(t,e){const n={};for(const r in t.subscriber.subscriptions){const i=t.subscriber.subscriptions[r];n[r]=new Date(i.purchase_date)}for(const r in e){const i=e[r].purchase_date;i==null?n[r]=null:n[r]=new Date(i)}return n}function nl(t){const e={};for(const n in t.subscriber.subscriptions){const r=t.subscriber.subscriptions[n];r.expires_date==null?e[n]=null:e[n]=new Date(r.expires_date)}return e}function rl(t){const e=new Set,n=new Date;for(const r in t){const i=t[r];(i==null||i>n)&&e.add(r)}return e}function il(t){const e={};for(const n in t){if(t[n].length===0)continue;const r=t[n].length;e[n]=t[n][r-1]}return e}const ol="0.12.0",sl="https://api.revenuecat.com";var We;(function(t){t[t.CONTINUE=100]="CONTINUE",t[t.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",t[t.PROCESSING=102]="PROCESSING",t[t.EARLY_HINTS=103]="EARLY_HINTS",t[t.OK=200]="OK",t[t.CREATED=201]="CREATED",t[t.ACCEPTED=202]="ACCEPTED",t[t.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",t[t.NO_CONTENT=204]="NO_CONTENT",t[t.RESET_CONTENT=205]="RESET_CONTENT",t[t.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",t[t.MULTI_STATUS=207]="MULTI_STATUS",t[t.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",t[t.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",t[t.MOVED_TEMPORARILY=302]="MOVED_TEMPORARILY",t[t.SEE_OTHER=303]="SEE_OTHER",t[t.NOT_MODIFIED=304]="NOT_MODIFIED",t[t.USE_PROXY=305]="USE_PROXY",t[t.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",t[t.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",t[t.BAD_REQUEST=400]="BAD_REQUEST",t[t.UNAUTHORIZED=401]="UNAUTHORIZED",t[t.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",t[t.FORBIDDEN=403]="FORBIDDEN",t[t.NOT_FOUND=404]="NOT_FOUND",t[t.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",t[t.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",t[t.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",t[t.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",t[t.CONFLICT=409]="CONFLICT",t[t.GONE=410]="GONE",t[t.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",t[t.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",t[t.REQUEST_TOO_LONG=413]="REQUEST_TOO_LONG",t[t.REQUEST_URI_TOO_LONG=414]="REQUEST_URI_TOO_LONG",t[t.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",t[t.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",t[t.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",t[t.IM_A_TEAPOT=418]="IM_A_TEAPOT",t[t.INSUFFICIENT_SPACE_ON_RESOURCE=419]="INSUFFICIENT_SPACE_ON_RESOURCE",t[t.METHOD_FAILURE=420]="METHOD_FAILURE",t[t.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",t[t.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",t[t.LOCKED=423]="LOCKED",t[t.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",t[t.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",t[t.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",t[t.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",t[t.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",t[t.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",t[t.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",t[t.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",t[t.BAD_GATEWAY=502]="BAD_GATEWAY",t[t.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",t[t.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",t[t.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",t[t.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",t[t.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(We||(We={}));function ut(t){return t?t.startsWith("rcb_sb_"):!1}async function $e(t,e){const{apiKey:n,body:r,headers:i,httpConfig:o}=e,l=`${(o==null?void 0:o.proxyURL)??sl}${t.urlPath()}`;try{const a=await fetch(l,{method:t.method,headers:ul(n,i,o==null?void 0:o.additionalHeaders),body:al(r)});return await ll(a,t),await a.json()}catch(a){throw a instanceof TypeError?new J(ee.NetworkError,Ue.getPublicMessage(ee.NetworkError),a.message):a}}async function ll(t,e){const n=t.status;if(n>=We.INTERNAL_SERVER_ERROR)ft(e,n,await t.text());else if(n>=We.BAD_REQUEST){const r=await t.json(),i=r?JSON.stringify(r):null,o=r==null?void 0:r.code,s=r==null?void 0:r.message;if(o!=null){const l=Ue.convertCodeToBackendErrorCode(o);if(l==null)ft(e,n,i,o);else throw J.getForBackendError(l,s)}else ft(e,n,i)}}function ft(t,e,n,r){throw new J(ee.UnknownBackendError,"Unknown backend error.",`Request: ${t.name}. Status code: ${e}. Body: ${n}.`,{backendErrorCode:r})}function al(t){return t==null?null:JSON.stringify(t)}const gn="Authorization",hn="Content-Type",bn="Accept",wn="X-Platform",yn="X-Version",En="X-Is-Sandbox",cl=new Set([gn,hn,bn,wn,yn,En]);function ul(t,e,n){let r={[gn]:`Bearer ${t}`,[hn]:"application/json",[bn]:"application/json",[wn]:"web",[yn]:ol,[En]:`${ut(t)}`};return e&&(r={...r,...e}),n&&(r={...n,...r}),r}const In="/v1/subscribers",Ke="/rcbilling/v1";class fl{constructor(e){M(this,"appUserId");M(this,"method","GET");M(this,"name","getOfferings");this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${In}/${e}/offerings`}}class dl{constructor(){M(this,"method","POST");M(this,"name","purchase")}urlPath(){return`${Ke}/purchase`}}class pl{constructor(e,n,r){M(this,"method","GET");M(this,"name","getProducts");M(this,"appUserId");M(this,"productIds");M(this,"currency");this.appUserId=e,this.productIds=n,this.currency=r}urlPath(){const e=encodeURIComponent(this.appUserId),n=this.productIds.map(encodeURIComponent).join("&id="),r=this.currency?`&currency=${this.currency}`:"";return`${Ke}/subscribers/${e}/products?id=${n}${r}`}}class ml{constructor(e){M(this,"method","GET");M(this,"name","getCustomerInfo");M(this,"appUserId");this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${In}/${e}`}}class _l{constructor(){M(this,"method","GET");M(this,"name","getBrandingInfo")}urlPath(){return`${Ke}/branding`}}class gl{constructor(e){M(this,"method","GET");M(this,"name","getCheckoutStatus");M(this,"operationSessionId");this.operationSessionId=e}urlPath(){return`${Ke}/checkout/${this.operationSessionId}`}}const dt={};class hl{constructor(e,n=dt){M(this,"API_KEY");M(this,"httpConfig");this.API_KEY=e,this.httpConfig=n}async getOfferings(e){return await $e(new fl(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getCustomerInfo(e){return await $e(new ml(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getProducts(e,n,r){return await $e(new pl(e,n,r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getBrandingInfo(){return await $e(new _l,{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async postPurchase(e,n,r,i,o){const s={app_user_id:e,product_id:n,email:r,price_id:o.priceId,presented_offering_identifier:i.offeringIdentifier};return o.id!=="base_option"&&(s.offer_id=o.id),i.targetingContext&&(s.applied_targeting_rule={rule_id:i.targetingContext.ruleId,revision:i.targetingContext.revision}),i.placementIdentifier&&(s.presented_placement_identifier=i.placementIdentifier),await $e(new dl,{apiKey:this.API_KEY,body:s,httpConfig:this.httpConfig})}async getCheckoutStatus(e){return await $e(new gl(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}}function bl(t){if(!/^rcb_[a-zA-Z0-9_.-]+$/.test(t))throw new J(ee.InvalidCredentialsError,"Invalid API key. Use your RevenueCat Billing API key.")}function wl(t){if(new Set(["no_user","null","none","nil","(null)","NaN","\\x00","","unidentified","undefined","unknown"]).has(t)||t.includes("/"))throw new J(ee.InvalidAppUserIdError,'Provided user id: "'+t+'" is not valid. See https://www.revenuecat.com/docs/customers/user-ids#tips-for-setting-app-user-ids for more information.')}function yl(t){if(t!=null&&t.endsWith("/"))throw new J(ee.ConfigurationError,"Invalid proxy URL. The proxy URL should not end with a trailing slash.")}function El(t){if(t){for(const e in t)if(cl.has(e))throw new J(ee.ConfigurationError,"Invalid additional headers. Some headers are reserved for internal use.")}}var pt=(t=>(t.Current="current",t))(pt||{});function Il(t,e){async function n(...r){return await this.preload(),await t.call(this,...r)}return n}const vn=(t,e)=>({...t,rcBillingProduct:{...t.rcBillingProduct,presentedOfferingContext:{...t.rcBillingProduct.presentedOfferingContext,placementIdentifier:e}}}),_e=(t,e)=>t==null?null:vn(t,e),vl=(t,e,n)=>{const r=t.offering_ids_by_placement??null;if(r==null)return null;const i=t.fallback_offering_id??null;let o;if(n in r){const l=r[n]??null;if(l==null)return null;o=e[l],o==null&&(o=e[i])}else o=e[i];if(o==null)return null;const s=Object.fromEntries(Object.entries(o.packagesById).map(([l,a])=>[l,vn(a,n)]));return{...o,packagesById:s,availablePackages:Object.values(s),weekly:_e(o.weekly,n),monthly:_e(o.monthly,n),twoMonth:_e(o.twoMonth,n),threeMonth:_e(o.threeMonth,n),sixMonth:_e(o.sixMonth,n),annual:_e(o.annual,n),lifetime:_e(o.lifetime,n)}};function $l(t,e){const n={};e.product_details.forEach(o=>{n[o.identifier]=o});const r={};t.offerings.forEach(o=>{const s=o.identifier===t.current_offering_id,l=_r(s,o,n,t.targeting);l!=null&&(r[o.identifier]=l)});const i=t.current_offering_id?r[t.current_offering_id]??null:null;return Object.keys(r).length==0&&q.debugLog("Empty offerings. Please make sure you've configured offerings correctly in the RevenueCat dashboard and that the products are properly configured."),{all:r,current:i}}$n=[Il];const le=class le{constructor(e,n,r=dt){Ln(_t,5,this);M(this,"_API_KEY");M(this,"_appUserId");M(this,"_brandingInfo",null);M(this,"_loadingResourcesPromise",null);M(this,"backend");M(this,"purchaseOperationHelper");this._API_KEY=e,this._appUserId=n,ut(e)&&q.debugLog("Initializing Purchases SDK with sandbox API Key"),this.backend=new hl(this._API_KEY,r),this.purchaseOperationHelper=new Lr(this.backend)}static setLogLevel(e){q.setLogLevel(e)}static getSharedInstance(){if(le.isConfigured())return le.instance;throw new Lt}static isConfigured(){return le.instance!==void 0}static configure(e,n,r=dt){return le.instance!==void 0&&q.warnLog("Purchases is already initialized. You normally should only configure Purchases once. Creating and returning new instance."),bl(e),wl(n),yl(r.proxyURL),El(r.additionalHeaders),le.instance=new le(e,n,r),le.getSharedInstance()}async preload(){if(this.hasLoadedResources()){q.verboseLog("Purchases resources are loaded. Skipping.");return}if(this._loadingResourcesPromise!==null){q.verboseLog("Purchases resources are loading. Waiting."),await this._loadingResourcesPromise;return}return this._loadingResourcesPromise=this.backend.getBrandingInfo().then(e=>{this._brandingInfo=e}).catch(e=>{let n=`${e}`;e instanceof J&&(n=`${e.message}. ${e.underlyingErrorMessage?`Underlying error: ${e.underlyingErrorMessage}`:""}`),q.errorLog(`Error fetching branding info: ${n}`)}).finally(()=>{this._loadingResourcesPromise=null}),this._loadingResourcesPromise}hasLoadedResources(){return this._brandingInfo!==null}async getOfferings(e){Fo(e==null?void 0:e.currency);const n=this._appUserId,r=await this.backend.getOfferings(n),i=(e==null?void 0:e.offeringIdentifier)===pt.Current?r.current_offering_id:e==null?void 0:e.offeringIdentifier;return i&&(r.offerings=r.offerings.filter(o=>o.identifier===i)),await this.getAllOfferings(r,n,e)}async getCurrentOfferingForPlacement(e,n){const r=this._appUserId,i=await this.backend.getOfferings(r),o=await this.getAllOfferings(i,r,n),s=i.placements??null;return s==null?null:vl(s,o.all,e)}async getAllOfferings(e,n,r){const i=e.offerings.flatMap(s=>s.packages).map(s=>s.platform_product_identifier),o=await this.backend.getProducts(n,i,r==null?void 0:r.currency);return this.logMissingProductIds(i,o.product_details),$l(e,o)}async isEntitledTo(e){const n=await this.getCustomerInfo();return e in n.entitlements.active}purchasePackage(e,n,r){return this.purchase({rcPackage:e,customerEmail:n,htmlTarget:r})}purchase(e){const{rcPackage:n,purchaseOption:r,htmlTarget:i,customerEmail:o}=e;let s=i??document.getElementById("rcb-ui-root");if(s===null){const u=document.createElement("div");u.className="rcb-ui-root",document.body.appendChild(u),s=u}if(s===null)throw new Error("Could not generate a mount point for the billing widget");const l=s,a=!i,c=this._appUserId;return q.debugLog(`Presenting purchase form for package ${n.identifier}`),new Promise((u,f)=>{new zs({target:l,props:{appUserId:c,rcPackage:n,purchaseOption:r,customerEmail:o,onFinished:async m=>{q.debugLog("Purchase finished"),l.innerHTML="";const w={customerInfo:await this._getCustomerInfoForUserId(c),redemptionInfo:m};u(w)},onClose:()=>{l.innerHTML="",q.debugLog("Purchase cancelled by user"),f(new J(ee.UserCancelledError))},onError:m=>{l.innerHTML="",f(J.getForPurchasesFlowError(m))},purchases:this,brandingInfo:this._brandingInfo,purchaseOperationHelper:this.purchaseOperationHelper,asModal:a}})})}async getCustomerInfo(){return await this._getCustomerInfoForUserId(this._appUserId)}getAppUserId(){return this._appUserId}async changeUser(e){return this._appUserId=e,await this.getCustomerInfo()}logMissingProductIds(e,n){const r={};n.forEach(o=>r[o.identifier]=o);const i=[];e.forEach(o=>{r[o]===void 0&&i.push(o)}),i.length>0&&q.debugLog(`Could not find product data for product ids:
104
+ `;var Ks=E('<div style="color:var(--rc-color-gray-text-dark);"><!></div>');function Qs(e){var r=Ks(),t=x(r);Rr(t,()=>zs),p(e,r)}var Zs=E('<div class="svelte-1ny4y2s">Sandbox</div>');const Xs={hash:"svelte-1ny4y2s",code:"div.svelte-1ny4y2s {background-color:var(--rc-color-warning);color:rgba(0,0,0,1);font-size:10px;font-weight:bold;text-transform:uppercase;padding:4px 10px;line-height:10px;border-radius:9px;margin:0px;margin-left:16px;}"};function Js(e){j(e,Xs);var r=Zs();p(e,r)}var el=E('<div class="rcb-ui-layout svelte-1iuls9l"><!></div>');const rl={hash:"svelte-1iuls9l",code:`.rcb-ui-layout.svelte-1iuls9l {width:100vw;margin-right:auto;display:flex;justify-content:center;align-items:flex-start;position:relative;padding:0px 80px;box-sizing:border-box;}
105
+
106
+ @media screen and (max-width: 960px) {.rcb-ui-layout.svelte-1iuls9l {flex-direction:column;align-items:center;justify-content:center;height:100%;min-width:100%;}
107
+ }
108
+
109
+ @media screen and (max-width: 960px) and (max-height: 960px) {.rcb-ui-layout.svelte-1iuls9l {overflow-y:scroll;justify-content:flex-start;padding:16px 0;}
110
+ }`};function tl(e,r){j(e,rl);let t=h(r,"style",8,"");var n=el(),i=x(n);K(i,r,"default",{}),G(()=>le(n,"style",t())),p(e,n)}var nl=E('<div class="rcb-ui-container svelte-1sfb5if"><!></div>');const il={hash:"svelte-1sfb5if",code:`.rcb-ui-container.svelte-1sfb5if {color-scheme:none;font-size:16px;line-height:1.5em;font-weight:400;font-family:-apple-system, "system-ui", "Segoe UI", Roboto, Oxygen, Ubuntu,
111
+ Cantarell, "Open Sans", "Helvetica Neue", sans-serif;}`};function ol(e,r){j(e,il);let t=h(r,"style",8,"");var n=nl(),i=x(n);K(i,r,"default",{}),G(()=>le(n,"style",t())),p(e,n)}var al=E("<!> <!>",1),sl=E('<div class="rcb-ui-aside svelte-17dr902"><!></div>');const ll={hash:"svelte-17dr902",code:`.rcb-ui-aside.svelte-17dr902 {margin-right:16px;flex:320px 1 0;max-width:480px;}
112
+
113
+ @media screen and (max-width: 960px) {.rcb-ui-aside.svelte-17dr902 {margin-right:0;margin-bottom:16px;min-width:100%;display:flex;flex-direction:column;align-items:center;flex:none;max-width:none;}
114
+ }`};function cl(e,r){we(r,!1),j(e,ll);let t=h(r,"brandingAppearance",8,void 0),n=new $t(t()).productInfoStyleVars;Te();var i=sl();le(i,"style",n);var o=x(i);ci(o,{children:(a,s)=>{var c=al(),l=B(c);K(l,r,"header",{});var u=L(l,2);K(u,r,"default",{}),p(a,c)},$$slots:{default:!0}}),p(e,i),Ie()}var ul=E("<!> <!>",1),fl=E('<div class="rcb-ui-main svelte-vpgys"><!></div>');const dl={hash:"svelte-vpgys",code:`.rcb-ui-main.svelte-vpgys {flex:480px 1 0;max-width:640px;}
115
+
116
+ @media screen and (max-width: 960px) {.rcb-ui-main.svelte-vpgys {flex:none;max-width:none;min-width:100%;}
117
+ }`};function vl(e,r){we(r,!1),j(e,dl);let t=h(r,"brandingAppearance",8,void 0),n=new $t(t()).formStyleVars;Te();var i=fl();le(i,"style",n);var o=x(i);ci(o,{style:"min-height: 360px;",children:(a,s)=>{var c=ul(),l=B(c);K(l,r,"header",{});var u=L(l,2);K(u,r,"default",{}),p(a,c)},$$slots:{default:!0}}),p(e,i),Ie()}var pl=E("<!> <!>",1),hl=E("<!> <!> <!> <!> <!> <!> <!>",1),gl=E("<!> <!>",1);function _l(e,r){we(r,!1);let t=h(r,"asModal",8,!0),n=h(r,"customerEmail",12),i=h(r,"appUserId",8),o=h(r,"rcPackage",8),a=h(r,"purchaseOption",8),s=h(r,"brandingInfo",8),c=h(r,"onFinished",8),l=h(r,"onError",8),u=h(r,"onClose",8),f=h(r,"purchases",8),d=h(r,"purchaseOperationHelper",8),m=pe(""),w=pe(null),g=pe(null),T=pe(null);const b=o().rcBillingProduct.identifier??null,I=o().rcBillingProduct.defaultPurchaseOption,A=a()?a():I;let y=pe("present-offer"),O=null;const V=["present-offer","needs-auth-info","processing-auth-info","needs-payment-info","polling-purchase-status","loading"];nt(async()=>{var S;if(R(w,o().rcBillingProduct),R(m,li((S=s())==null?void 0:S.appearance)),v(y)==="present-offer"){n()?H():R(y,"needs-auth-info");return}});const $=()=>{u()()},H=()=>{if(b===null){me(new z(ie.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}else v(y)==="present-offer"&&R(y,"loading");if(!n()){me(new z(ie.MissingEmailError));return}d().startPurchase(i(),b,A,n(),o().rcBillingProduct.presentedOfferingContext).then(S=>{if(S.next_action==="collect_payment_info"){R(T,null),R(y,"needs-payment-info"),R(g,S);return}if(S.next_action==="completed"){R(T,null),R(y,"success");return}}).catch(S=>{me(S)})},Q=S=>{if(v(y)==="needs-auth-info"){S&&(n(S.email),R(y,"processing-auth-info")),H();return}if(v(y)==="needs-payment-info"){R(y,"polling-purchase-status"),d().pollCurrentPurchaseForCompletion().then(W=>{R(y,"success"),O=W.redemptionInfo}).catch(W=>{me(W)});return}if(v(y)==="success"||v(y)==="error"){c()(O);return}R(y,"success")},me=S=>{if(v(y)==="processing-auth-info"&&S.isRecoverable()){R(T,S),R(y,"needs-auth-info");return}R(T,S),R(y,"error")},Ke=()=>{l()(v(T)??new z(ie.UnknownError,"Unknown error without state set."))};Te(),ol(e,{children:(S,W)=>{Ws(S,{get condition(){return t()},children:(be,hr)=>{tl(be,{get style(){return v(m)},children:(Mr,gr)=>{var _r=gl(),Se=B(_r);F(Se,()=>V.includes(v(y)),Qe=>{var Br=he(()=>{var Ae;return(Ae=s())==null?void 0:Ae.appearance});cl(Qe,{get brandingAppearance(){return v(Br)},children:(Ae,He)=>{var Ue=_e(),Ze=B(Ue);F(Ze,()=>v(w)&&A,fe=>{var de=he(()=>{var Xe;return(Xe=s())==null?void 0:Xe.appearance});jn(fe,{get productDetails(){return v(w)},get brandingAppearance(){return v(de)},purchaseOption:A})}),p(Ae,Ue)},$$slots:{default:!0,header:(Ae,He)=>{Ut(Ae,{slot:"header",children:(Ue,Ze)=>{var fe=pl(),de=B(fe);Yn(de,{get brandingInfo(){return s()}});var Xe=L(de,2);F(Xe,()=>f().isSandbox(),Fr=>{Js(Fr)},Fr=>{Qs(Fr)}),p(Ue,fe)},$$slots:{default:!0}})}}})});var ft=L(Se,2),Ct=he(()=>{var Qe;return(Qe=s())==null?void 0:Qe.appearance});vl(ft,{get brandingAppearance(){return v(Ct)},children:(Qe,Br)=>{var Ae=hl(),He=B(Ae);F(He,()=>v(y)==="present-offer"&&v(w)&&A,ye=>{jn(ye,{get productDetails(){return v(w)},purchaseOption:A})});var Ue=L(He,2);F(Ue,()=>v(y)==="present-offer"&&!v(w),ye=>{kt(ye)});var Ze=L(Ue,2);F(Ze,()=>v(y)==="needs-auth-info"||v(y)==="processing-auth-info",ye=>{var qr=he(()=>v(y)==="processing-auth-info");js(ye,{onContinue:Q,onClose:$,get processing(){return v(qr)},get lastError(){return v(T)}})});var fe=L(Ze,2);F(fe,()=>v(g)&&(v(y)==="needs-payment-info"||v(y)==="polling-purchase-status")&&v(w)&&A,ye=>{var qr=he(()=>v(y)==="polling-purchase-status");Us(ye,{get paymentInfoCollectionMetadata(){return v(g)},onContinue:Q,onClose:$,onError:me,get processing(){return v(qr)},get productDetails(){return v(w)},purchaseOptionToUse:A,get brandingInfo(){return s()}})});var de=L(fe,2);F(de,()=>v(y)==="loading",ye=>{kt(ye)});var Xe=L(de,2);F(Xe,()=>v(y)==="error",ye=>{var qr=he(()=>v(T)??new z(ie.UnknownError,"Unknown error without state set.")),Kl=he(()=>{var bi;return(bi=s())==null?void 0:bi.seller_company_support_email});ja(ye,{get brandingInfo(){return s()},get lastError(){return v(qr)},get supportEmail(){return v(Kl)},get productDetails(){return v(w)},onContinue:Ke})});var Fr=L(Xe,2);F(Fr,()=>v(y)==="success",ye=>{Ya(ye,{get productDetails(){return v(w)},get brandingInfo(){return s()},onContinue:Q})}),p(Qe,Ae)},$$slots:{default:!0}}),p(Mr,_r)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}}),Ie()}function ml(e){return e.expires_date==null?!0:new Date(e.expires_date)>new Date}function bl(e,r,t,n){const i=r.product_identifier;if(i in t)return yl(e,r,t[i]);if(i in n)return El(e,r,n[i]);throw new X(re.CustomerInfoError,"Could not find entitlement product in subscriptions or non-subscriptions.")}function yl(e,r,t){return{identifier:e,isActive:ml(r),willRenew:xl(r,t),store:(t==null?void 0:t.store)??"unknown",latestPurchaseDate:new Date(r.purchase_date),originalPurchaseDate:new Date(r.purchase_date),expirationDate:lt(r.expires_date),productIdentifier:r.product_identifier,unsubscribeDetectedAt:lt(t==null?void 0:t.unsubscribe_detected_at),billingIssueDetectedAt:lt(t==null?void 0:t.billing_issues_detected_at),isSandbox:(t==null?void 0:t.is_sandbox)??!1,periodType:(t==null?void 0:t.period_type)??"normal"}}function El(e,r,t){return{identifier:e,isActive:!0,willRenew:!1,store:t.store,latestPurchaseDate:new Date(r.purchase_date),originalPurchaseDate:new Date(t.original_purchase_date),expirationDate:null,productIdentifier:r.product_identifier,unsubscribeDetectedAt:null,billingIssueDetectedAt:null,isSandbox:t.is_sandbox,periodType:"normal"}}function wl(e,r,t){const n={},i={};for(const o in e){const a=bl(o,e[o],r,t);n[o]=a,a.isActive&&(i[o]=a)}return{all:n,active:i}}function lt(e){return e==null?null:new Date(e)}function Il(e){const r=Tl(e),t=e.subscriber,n=Ol(t.non_subscriptions);return{entitlements:wl(t.entitlements,t.subscriptions,n),allExpirationDatesByProduct:r,allPurchaseDatesByProduct:Pl(e,n),activeSubscriptions:Al(r),managementURL:t.management_url,requestDate:new Date(e.request_date),firstSeenDate:new Date(t.first_seen),originalPurchaseDate:lt(t.original_purchase_date),originalAppUserId:e.subscriber.original_app_user_id}}function xl(e,r){if(r==null)return!1;const t=r.store=="promotional",n=e.expires_date==null,i=r.unsubscribe_detected_at!=null,o=r.billing_issues_detected_at!=null;return!(t||n||i||o)}function Pl(e,r){const t={};for(const n in e.subscriber.subscriptions){const i=e.subscriber.subscriptions[n];t[n]=new Date(i.purchase_date)}for(const n in r){const i=r[n].purchase_date;i==null?t[n]=null:t[n]=new Date(i)}return t}function Tl(e){const r={};for(const t in e.subscriber.subscriptions){const n=e.subscriber.subscriptions[t];n.expires_date==null?r[t]=null:r[t]=new Date(n.expires_date)}return r}function Al(e){const r=new Set,t=new Date;for(const n in e){const i=e[n];(i==null||i>t)&&r.add(n)}return r}function Ol(e){const r={};for(const t in e){if(e[t].length===0)continue;const n=e[t].length;r[t]=e[t][n-1]}return r}const kl="0.12.1",Nl="https://api.revenuecat.com";var ct;(function(e){e[e.CONTINUE=100]="CONTINUE",e[e.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",e[e.PROCESSING=102]="PROCESSING",e[e.EARLY_HINTS=103]="EARLY_HINTS",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.RESET_CONTENT=205]="RESET_CONTENT",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.MULTI_STATUS=207]="MULTI_STATUS",e[e.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.MOVED_TEMPORARILY=302]="MOVED_TEMPORARILY",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.NOT_MODIFIED=304]="NOT_MODIFIED",e[e.USE_PROXY=305]="USE_PROXY",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.REQUEST_TOO_LONG=413]="REQUEST_TOO_LONG",e[e.REQUEST_URI_TOO_LONG=414]="REQUEST_URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.IM_A_TEAPOT=418]="IM_A_TEAPOT",e[e.INSUFFICIENT_SPACE_ON_RESOURCE=419]="INSUFFICIENT_SPACE_ON_RESOURCE",e[e.METHOD_FAILURE=420]="METHOD_FAILURE",e[e.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.LOCKED=423]="LOCKED",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",e[e.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",e[e.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",e[e.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(ct||(ct={}));function Dt(e){return e?e.startsWith("rcb_sb_"):!1}async function pr(e,r){const{apiKey:t,body:n,headers:i,httpConfig:o}=r,s=`${(o==null?void 0:o.proxyURL)??Nl}${e.urlPath()}`;try{const c=await fetch(s,{method:e.method,headers:Ll(t,i,o==null?void 0:o.additionalHeaders),body:Sl(n)});return await Rl(c,e),await c.json()}catch(c){throw c instanceof TypeError?new X(re.NetworkError,Sr.getPublicMessage(re.NetworkError),c.message):c}}async function Rl(e,r){const t=e.status;if(t>=ct.INTERNAL_SERVER_ERROR)Mt(r,t,await e.text());else if(t>=ct.BAD_REQUEST){const n=await e.json(),i=n?JSON.stringify(n):null,o=n==null?void 0:n.code,a=n==null?void 0:n.message;if(o!=null){const s=Sr.convertCodeToBackendErrorCode(o);if(s==null)Mt(r,t,i,o);else throw X.getForBackendError(s,a)}else Mt(r,t,i)}}function Mt(e,r,t,n){throw new X(re.UnknownBackendError,"Unknown backend error.",`Request: ${e.name}. Status code: ${r}. Body: ${t}.`,{backendErrorCode:n})}function Sl(e){return e==null?null:JSON.stringify(e)}const ui="Authorization",fi="Content-Type",di="Accept",vi="X-Platform",pi="X-Version",hi="X-Is-Sandbox",Ul=new Set([ui,fi,di,vi,pi,hi]);function Ll(e,r,t){let n={[ui]:`Bearer ${e}`,[fi]:"application/json",[di]:"application/json",[vi]:"web",[pi]:kl,[hi]:`${Dt(e)}`};return r&&(n={...n,...r}),t&&(n={...t,...n}),n}const gi="/v1/subscribers",ut="/rcbilling/v1";class $l{constructor(r){D(this,"appUserId");D(this,"method","GET");D(this,"name","getOfferings");this.appUserId=r}urlPath(){const r=encodeURIComponent(this.appUserId);return`${gi}/${r}/offerings`}}class Dl{constructor(){D(this,"method","POST");D(this,"name","purchase")}urlPath(){return`${ut}/purchase`}}class Ml{constructor(r,t,n){D(this,"method","GET");D(this,"name","getProducts");D(this,"appUserId");D(this,"productIds");D(this,"currency");this.appUserId=r,this.productIds=t,this.currency=n}urlPath(){const r=encodeURIComponent(this.appUserId),t=this.productIds.map(encodeURIComponent).join("&id="),n=this.currency?`&currency=${this.currency}`:"";return`${ut}/subscribers/${r}/products?id=${t}${n}`}}class Bl{constructor(r){D(this,"method","GET");D(this,"name","getCustomerInfo");D(this,"appUserId");this.appUserId=r}urlPath(){const r=encodeURIComponent(this.appUserId);return`${gi}/${r}`}}class Fl{constructor(){D(this,"method","GET");D(this,"name","getBrandingInfo")}urlPath(){return`${ut}/branding`}}class ql{constructor(r){D(this,"method","GET");D(this,"name","getCheckoutStatus");D(this,"operationSessionId");this.operationSessionId=r}urlPath(){return`${ut}/checkout/${this.operationSessionId}`}}const Bt={};class jl{constructor(r,t=Bt){D(this,"API_KEY");D(this,"httpConfig");this.API_KEY=r,this.httpConfig=t}async getOfferings(r){return await pr(new $l(r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getCustomerInfo(r){return await pr(new Bl(r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getProducts(r,t,n){return await pr(new Ml(r,t,n),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getBrandingInfo(){return await pr(new Fl,{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async postPurchase(r,t,n,i,o){const a={app_user_id:r,product_id:t,email:n,price_id:o.priceId,presented_offering_identifier:i.offeringIdentifier};return o.id!=="base_option"&&(a.offer_id=o.id),i.targetingContext&&(a.applied_targeting_rule={rule_id:i.targetingContext.ruleId,revision:i.targetingContext.revision}),i.placementIdentifier&&(a.presented_placement_identifier=i.placementIdentifier),await pr(new Dl,{apiKey:this.API_KEY,body:a,httpConfig:this.httpConfig})}async getCheckoutStatus(r){return await pr(new ql(r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}}function Cl(e){if(!/^rcb_[a-zA-Z0-9_.-]+$/.test(e))throw new X(re.InvalidCredentialsError,"Invalid API key. Use your RevenueCat Billing API key.")}function Hl(e){if(new Set(["no_user","null","none","nil","(null)","NaN","\\x00","","unidentified","undefined","unknown"]).has(e)||e.includes("/"))throw new X(re.InvalidAppUserIdError,'Provided user id: "'+e+'" is not valid. See https://www.revenuecat.com/docs/customers/user-ids#tips-for-setting-app-user-ids for more information.')}function Vl(e){if(e!=null&&e.endsWith("/"))throw new X(re.ConfigurationError,"Invalid proxy URL. The proxy URL should not end with a trailing slash.")}function Gl(e){if(e){for(const r in e)if(Ul.has(r))throw new X(re.ConfigurationError,"Invalid additional headers. Some headers are reserved for internal use.")}}var Ft=(e=>(e.Current="current",e))(Ft||{});function Yl(e,r){async function t(...n){return await this.preload(),await e.call(this,...n)}return t}const _i=(e,r)=>({...e,rcBillingProduct:{...e.rcBillingProduct,presentedOfferingContext:{...e.rcBillingProduct.presentedOfferingContext,placementIdentifier:r}}}),ze=(e,r)=>e==null?null:_i(e,r),Wl=(e,r,t)=>{const n=e.offering_ids_by_placement??null;if(n==null)return null;const i=e.fallback_offering_id??null;let o;if(t in n){const s=n[t]??null;if(s==null)return null;o=r[s],o==null&&(o=r[i])}else o=r[i];if(o==null)return null;const a=Object.fromEntries(Object.entries(o.packagesById).map(([s,c])=>[s,_i(c,t)]));return{...o,packagesById:a,availablePackages:Object.values(a),weekly:ze(o.weekly,t),monthly:ze(o.monthly,t),twoMonth:ze(o.twoMonth,t),threeMonth:ze(o.threeMonth,t),sixMonth:ze(o.sixMonth,t),annual:ze(o.annual,t),lifetime:ze(o.lifetime,t)}};function zl(e,r){const t={};r.product_details.forEach(o=>{t[o.identifier]=o});const n={};e.offerings.forEach(o=>{const a=o.identifier===e.current_offering_id,s=zo(a,o,t,e.targeting);s!=null&&(n[o.identifier]=s)});const i=e.current_offering_id?n[e.current_offering_id]??null:null;return Object.keys(n).length==0&&C.debugLog("Empty offerings. Please make sure you've configured offerings correctly in the RevenueCat dashboard and that the products are properly configured."),{all:n,current:i}}mi=[Yl];const ue=class ue{constructor(r,t,n=Bt){Ai(jt,5,this);D(this,"_API_KEY");D(this,"_appUserId");D(this,"_brandingInfo",null);D(this,"_loadingResourcesPromise",null);D(this,"backend");D(this,"purchaseOperationHelper");this._API_KEY=r,this._appUserId=t,Dt(r)&&C.debugLog("Initializing Purchases SDK with sandbox API Key"),this.backend=new jl(this._API_KEY,n),this.purchaseOperationHelper=new fa(this.backend)}static setLogLevel(r){C.setLogLevel(r)}static getSharedInstance(){if(ue.isConfigured())return ue.instance;throw new Hn}static isConfigured(){return ue.instance!==void 0}static configure(r,t,n=Bt){return ue.instance!==void 0&&C.warnLog("Purchases is already initialized. You normally should only configure Purchases once. Creating and returning new instance."),Cl(r),Hl(t),Vl(n.proxyURL),Gl(n.additionalHeaders),ue.instance=new ue(r,t,n),ue.getSharedInstance()}async preload(){if(this.hasLoadedResources()){C.verboseLog("Purchases resources are loaded. Skipping.");return}if(this._loadingResourcesPromise!==null){C.verboseLog("Purchases resources are loading. Waiting."),await this._loadingResourcesPromise;return}return this._loadingResourcesPromise=this.backend.getBrandingInfo().then(r=>{this._brandingInfo=r}).catch(r=>{let t=`${r}`;r instanceof X&&(t=`${r.message}. ${r.underlyingErrorMessage?`Underlying error: ${r.underlyingErrorMessage}`:""}`),C.errorLog(`Error fetching branding info: ${t}`)}).finally(()=>{this._loadingResourcesPromise=null}),this._loadingResourcesPromise}hasLoadedResources(){return this._brandingInfo!==null}async getOfferings(r){$s(r==null?void 0:r.currency);const t=this._appUserId,n=await this.backend.getOfferings(t),i=(r==null?void 0:r.offeringIdentifier)===Ft.Current?n.current_offering_id:r==null?void 0:r.offeringIdentifier;return i&&(n.offerings=n.offerings.filter(o=>o.identifier===i)),await this.getAllOfferings(n,t,r)}async getCurrentOfferingForPlacement(r,t){const n=this._appUserId,i=await this.backend.getOfferings(n),o=await this.getAllOfferings(i,n,t),a=i.placements??null;return a==null?null:Wl(a,o.all,r)}async getAllOfferings(r,t,n){const i=r.offerings.flatMap(a=>a.packages).map(a=>a.platform_product_identifier),o=await this.backend.getProducts(t,i,n==null?void 0:n.currency);return this.logMissingProductIds(i,o.product_details),zl(r,o)}async isEntitledTo(r){const t=await this.getCustomerInfo();return r in t.entitlements.active}purchasePackage(r,t,n){return this.purchase({rcPackage:r,customerEmail:t,htmlTarget:n})}purchase(r){const{rcPackage:t,purchaseOption:n,htmlTarget:i,customerEmail:o}=r;let a=i??document.getElementById("rcb-ui-root");if(a===null){const u=document.createElement("div");u.className="rcb-ui-root",document.body.appendChild(u),a=u}if(a===null)throw new Error("Could not generate a mount point for the billing widget");const s=a,c=!i,l=this._appUserId;return C.debugLog(`Presenting purchase form for package ${t.identifier}`),new Promise((u,f)=>{xo(_l,{target:s,props:{appUserId:l,rcPackage:t,purchaseOption:n,customerEmail:o,onFinished:async d=>{C.debugLog("Purchase finished"),s.innerHTML="";const m={customerInfo:await this._getCustomerInfoForUserId(l),redemptionInfo:d};u(m)},onClose:()=>{s.innerHTML="",C.debugLog("Purchase cancelled by user"),f(new X(re.UserCancelledError))},onError:d=>{s.innerHTML="",f(X.getForPurchasesFlowError(d))},purchases:this,brandingInfo:this._brandingInfo,purchaseOperationHelper:this.purchaseOperationHelper,asModal:c}})})}async getCustomerInfo(){return await this._getCustomerInfoForUserId(this._appUserId)}getAppUserId(){return this._appUserId}async changeUser(r){return this._appUserId=r,await this.getCustomerInfo()}logMissingProductIds(r,t){const n={};t.forEach(o=>n[o.identifier]=o);const i=[];r.forEach(o=>{n[o]===void 0&&i.push(o)}),i.length>0&&C.debugLog(`Could not find product data for product ids:
35
118
  ${i.join()}.
36
- Please check that your product configuration is correct.`)}isSandbox(){return ut(this._API_KEY)}close(){le.instance===this?le.instance=void 0:q.warnLog("Trying to close a Purchases instance that is not the current instance. Ignoring.")}async _getCustomerInfoForUserId(e){const n=await this.backend.getCustomerInfo(e);return Js(n)}};_t=Un(null),Sn(_t,1,"purchase",$n,le),bt(_t,le),M(le,"instance");let mt=le;E.ErrorCode=ee,E.LogLevel=se,E.OfferingKeyword=pt,E.PackageType=kt,E.ProductType=Ie,E.Purchases=mt,E.PurchasesError=J,E.UninitializedPurchasesError=Lt,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
119
+ Please check that your product configuration is correct.`)}isSandbox(){return Dt(this._API_KEY)}close(){ue.instance===this?ue.instance=void 0:C.warnLog("Trying to close a Purchases instance that is not the current instance. Ignoring.")}async _getCustomerInfoForUserId(r){const t=await this.backend.getCustomerInfo(r);return Il(t)}};jt=Pi(null),Oi(jt,1,"purchase",mi,ue),Vt(jt,ue),D(ue,"instance");let qt=ue;_.ErrorCode=re,_.LogLevel=ce,_.OfferingKeyword=Ft,_.PackageType=Bn,_.ProductType=dr,_.Purchases=qt,_.PurchasesError=X,_.UninitializedPurchasesError=Hn,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});