@revenuecat/purchases-js 0.0.16 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(Y,K){typeof exports=="object"&&typeof module<"u"?K(exports):typeof define=="function"&&define.amd?define(["exports"],K):(Y=typeof globalThis<"u"?globalThis:Y||self,K(Y.Purchases={}))})(this,function(Y){"use strict";var as=Object.defineProperty;var us=(Y,K,z)=>K in Y?as(Y,K,{enumerable:!0,configurable:!0,writable:!0,value:z}):Y[K]=z;var Q=(Y,K,z)=>(us(Y,typeof K!="symbol"?K+"":K,z),z);function K(t){return t!=null}var z=(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))(z||{});const Tt=(t,e)=>({identifier:t.identifier,displayName:t.title,currentPrice:t.current_price,normalPeriodDuration:t.normal_period_duration,presentedOfferingIdentifier:e}),Pt=(t,e,r)=>{const n=r[e.platform_product_identifier];return n===void 0?null:{identifier:e.identifier,rcBillingProduct:Tt(n,t),packageType:Ut(e.identifier)}},He=(t,e)=>{const r=t.packages.map(i=>Pt(t.identifier,i,e)).filter(K),n={};for(const i of r)i!=null&&(n[i.identifier]=i);return r.length==0?null:{identifier:t.identifier,serverDescription:t.description,metadata:t.metadata,packagesById:n,availablePackages:r,lifetime:n.$rc_lifetime??null,annual:n.$rc_annual??null,sixMonth:n.$rc_six_month??null,threeMonth:n.$rc_three_month??null,twoMonth:n.$rc_two_month??null,monthly:n.$rc_monthly??null,weekly:n.$rc_weekly??null}};function Ut(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 y(){}function Nt(t,e){for(const r in e)t[r]=e[r];return t}function Ke(t){return t()}function je(){return Object.create(null)}function ue(t){t.forEach(Ke)}function re(t){return typeof t=="function"}function N(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let we;function W(t,e){return t===e?!0:(we||(we=document.createElement("a")),we.href=e,t===we.href)}function Je(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function Rt(t,e){const r=Je(t.srcset),n=Je(e||"");return n.length===r.length&&n.every(([i,s],l)=>s===r[l][1]&&(W(r[l][0],i)||W(i,r[l][0])))}function Ct(t){return Object.keys(t).length===0}function J(t,e,r,n){if(t){const i=xe(t,e,r,n);return t[0](i)}}function xe(t,e,r,n){return t[1]&&n?Nt(r.ctx.slice(),t[1](n(e))):r.ctx}function x(t,e,r,n){if(t[2]&&n){const i=t[2](n(r));if(e.dirty===void 0)return i;if(typeof i=="object"){const s=[],l=Math.max(e.dirty.length,i.length);for(let o=0;o<l;o+=1)s[o]=e.dirty[o]|i[o];return s}return e.dirty|i}return e.dirty}function V(t,e,r,n,i,s){if(i){const l=xe(e,r,n,s);t.p(l,i)}}function q(t){if(t.ctx.length>32){const e=[],r=t.ctx.length/32;for(let n=0;n<r;n++)e[n]=-1;return e}return-1}function fe(t){return t??""}function M(t,e){t.appendChild(e)}function S(t,e,r){const n=St(t);if(!n.getElementById(e)){const i=$("style");i.id=e,i.textContent=r,Ot(n,i)}}function St(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function Ot(t,e){return M(t.head||t,e),e.sheet}function A(t,e,r){t.insertBefore(e,r||null)}function m(t){t.parentNode&&t.parentNode.removeChild(t)}function $(t){return document.createElement(t)}function L(t){return document.createTextNode(t)}function P(){return L(" ")}function ee(){return L("")}function de(t,e,r,n){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r,n)}function Ve(t){return function(e){return e.preventDefault(),t.call(this,e)}}function h(t,e,r){r==null?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}const Lt=["width","height"];function Ft(t,e){const r=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:r[n]&&r[n].set&&Lt.indexOf(n)===-1?t[n]=e[n]:h(t,n,e[n])}function Gt(t,e){Object.keys(e).forEach(r=>{Yt(t,r,e[r])})}function Yt(t,e,r){const n=e.toLowerCase();n in t?t[n]=typeof t[n]=="boolean"&&r===""?!0:r:e in t?t[e]=typeof t[e]=="boolean"&&r===""?!0:r:h(t,e,r)}function Ht(t){return/-/.test(t)?Gt:Ft}function Kt(t){return Array.from(t.childNodes)}function ie(t,e){e=""+e,t.data!==e&&(t.data=e)}function qe(t,e){t.value=e??""}function jt(t,e,{bubbles:r=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:r,cancelable:n})}let me;function ge(t){me=t}function be(){if(!me)throw new Error("Function called outside component initialization");return me}function $e(t){be().$$.on_mount.push(t)}function Jt(){const t=be();return(e,r,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const s=jt(e,r,{cancelable:n});return i.slice().forEach(l=>{l.call(t,s)}),!s.defaultPrevented}return!0}}function xt(t,e){return be().$$.context.set(t,e),e}function Vt(t){return be().$$.context.get(t)}function We(t,e){const r=t.$$.callbacks[e.type];r&&r.slice().forEach(n=>n.call(this,e))}const se=[],Be=[];let le=[];const Ce=[],qt=Promise.resolve();let Se=!1;function Wt(){Se||(Se=!0,qt.then(ze))}function Oe(t){le.push(t)}function zt(t){Ce.push(t)}const Le=new Set;let oe=0;function ze(){if(oe!==0)return;const t=me;do{try{for(;oe<se.length;){const e=se[oe];oe++,ge(e),Xt(e.$$)}}catch(e){throw se.length=0,oe=0,e}for(ge(null),se.length=0,oe=0;Be.length;)Be.pop()();for(let e=0;e<le.length;e+=1){const r=le[e];Le.has(r)||(Le.add(r),r())}le.length=0}while(se.length);for(;Ce.length;)Ce.pop()();Se=!1,Le.clear(),ge(t)}function Xt(t){if(t.fragment!==null){t.update(),ue(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(Oe)}}function Zt(t){const e=[],r=[];le.forEach(n=>t.indexOf(n)===-1?e.push(n):r.push(n)),r.forEach(n=>n()),le=e}const ke=new Set;let te;function F(){te={r:0,c:[],p:te}}function G(){te.r||ue(te.c),te=te.p}function a(t,e){t&&t.i&&(ke.delete(t),t.i(e))}function f(t,e,r,n){if(t&&t.o){if(ke.has(t))return;ke.add(t),te.c.push(()=>{ke.delete(t),n&&(r&&t.d(1),n())}),t.o(e)}else n&&n()}function en(t,e,r){const n=t.$$.props[e];n!==void 0&&(t.$$.bound[n]=r,r(t.$$.ctx[n]))}function b(t){t&&t.c()}function E(t,e,r){const{fragment:n,after_update:i}=t.$$;n&&n.m(e,r),Oe(()=>{const s=t.$$.on_mount.map(Ke).filter(re);t.$$.on_destroy?t.$$.on_destroy.push(...s):ue(s),t.$$.on_mount=[]}),i.forEach(Oe)}function I(t,e){const r=t.$$;r.fragment!==null&&(Zt(r.after_update),ue(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function tn(t,e){t.$$.dirty[0]===-1&&(se.push(t),Wt(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function R(t,e,r,n,i,s,l=null,o=[-1]){const c=me;ge(t);const u=t.$$={fragment:null,ctx:[],props:s,update:y,not_equal:i,bound:je(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:je(),dirty:o,skip_bound:!1,root:e.target||c.$$.root};l&&l(u.root);let _=!1;if(u.ctx=r?r(t,e.props||{},(g,B,...k)=>{const w=k.length?k[0]:B;return u.ctx&&i(u.ctx[g],u.ctx[g]=w)&&(!u.skip_bound&&u.bound[g]&&u.bound[g](w),_&&tn(t,g)),B}):[],u.update(),_=!0,ue(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const g=Kt(e.target);u.fragment&&u.fragment.l(g),g.forEach(m)}else u.fragment&&u.fragment.c();e.intro&&a(t.$$.fragment),E(t,e.target,e.anchor),ze()}ge(c)}class C{constructor(){Q(this,"$$");Q(this,"$$set")}$destroy(){I(this,1),this.$destroy=y}$on(e,r){if(!re(r))return y;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(r),()=>{const i=n.indexOf(r);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!Ct(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const nn="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(nn);function rn(t){S(t,"svelte-8uc6s0","aside.svelte-8uc6s0{color:yellowgreen;font-weight:bold;text-transform:uppercase;padding:0.5rem 0;width:100%;font-size:0.75rem;border-radius:0.5rem}")}function sn(t){let e;return{c(){e=$("aside"),e.innerHTML="<span>Sandbox Mode</span>",h(e,"class","svelte-8uc6s0")},m(r,n){A(r,e,n)},p:y,i:y,o:y,d(r){r&&m(e)}}}class ln extends C{constructor(e){super(),R(this,e,null,sn,N,{},rn)}}function on(t){S(t,"svelte-ujomz3",".rcb-modal-section.svelte-ujomz3{padding:0.5rem 0rem;display:flex}.rcb-modal-section.svelte-ujomz3:last-of-type{padding:0}")}function Fe(t){let e,r;const n=t[2].default,i=J(n,t,t[1],null);return{c(){e=$(t[0]),i&&i.c(),Ht(t[0])(e,{class:fe("rcb-modal-section")+" svelte-ujomz3"})},m(s,l){A(s,e,l),i&&i.m(e,null),r=!0},p(s,l){i&&i.p&&(!r||l&2)&&V(i,n,s,s[1],r?x(n,s[1],l,null):q(s[1]),null)},i(s){r||(a(i,s),r=!0)},o(s){f(i,s),r=!1},d(s){s&&m(e),i&&i.d(s)}}}function cn(t){let e=t[0],r,n,i=t[0]&&Fe(t);return{c(){i&&i.c(),r=ee()},m(s,l){i&&i.m(s,l),A(s,r,l),n=!0},p(s,[l]){s[0]?e?N(e,s[0])?(i.d(1),i=Fe(s),e=s[0],i.c(),i.m(r.parentNode,r)):i.p(s,l):(i=Fe(s),e=s[0],i.c(),i.m(r.parentNode,r)):e&&(i.d(1),i=null,e=s[0])},i(s){n||(a(i,s),n=!0)},o(s){f(i,s),n=!1},d(s){s&&m(r),i&&i.d(s)}}}function an(t,e,r){let{$$slots:n={},$$scope:i}=e,{as:s="section"}=e;return t.$$set=l=>{"as"in l&&r(0,s=l.as),"$$scope"in l&&r(1,i=l.$$scope)},[s,i,n]}class X extends C{constructor(e){super(),R(this,e,an,cn,N,{as:0},on)}}const un={Y:"year",M:"month",W:"week",D:"day",H:"hour"},Xe=(t,e)=>{const r=t/100;return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).format(r)},Ze=t=>{const e=t.slice(-1);return e==="D"?"daily":`${un[e]}ly`};function fn(t){S(t,"svelte-1oa6nu8",".rcb-pricing-info.svelte-1oa6nu8{display:flex;flex-direction:column;height:10rem;justify-content:flex-end}.rcb-product-price.svelte-1oa6nu8{font-size:1.5rem}.rcb-product-duration.svelte-1oa6nu8{opacity:0.6}")}function dn(t){let e,r,n=t[0].displayName+"",i,s,l,o=t[0].currentPrice.currency+"",c,u=" ",_,g=Xe(t[0].currentPrice.amount,t[0].currentPrice.currency)+"",B,k,w,D,T=Ze(t[0].normalPeriodDuration)+"",U;return{c(){e=$("div"),r=$("span"),i=L(n),s=P(),l=$("span"),c=L(o),_=L(u),B=L(g),k=P(),w=$("span"),D=L("Billed "),U=L(T),h(l,"class","rcb-product-price svelte-1oa6nu8"),h(w,"class","rcb-product-duration svelte-1oa6nu8"),h(e,"class","rcb-pricing-info svelte-1oa6nu8")},m(d,p){A(d,e,p),M(e,r),M(r,i),M(e,s),M(e,l),M(l,c),M(l,_),M(l,B),M(e,k),M(e,w),M(w,D),M(w,U)},p(d,p){p&1&&n!==(n=d[0].displayName+"")&&ie(i,n),p&1&&o!==(o=d[0].currentPrice.currency+"")&&ie(c,o),p&1&&g!==(g=Xe(d[0].currentPrice.amount,d[0].currentPrice.currency)+"")&&ie(B,g),p&1&&T!==(T=Ze(d[0].normalPeriodDuration)+"")&&ie(U,T)},d(d){d&&m(e)}}}function mn(t){let e,r;return e=new X({props:{$$slots:{default:[dn]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&3&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function gn(t,e,r){let{productDetails:n}=e;return t.$$set=i=>{"productDetails"in i&&r(0,n=i.productDetails)},[n]}class et extends C{constructor(e){super(),R(this,e,gn,mn,N,{productDetails:0},fn)}}const An="data:image/gif;base64,R0lGODlhMgAyAPcBAAAAAAD/AAMDAwcHBxERERUVFSoqKi0tLTAwMDg4OD09PURERElJSUtLS1BQUFJSUlVVVVdXV1paWl9fX2NjY2ZmZmlpaWxsbG1tbXNzc3t7e39/f4GBgYKCgoSEhIaGhoeHh4iIiIuLi5KSkpSUlJaWlp2dnaGhoaOjo6SkpKWlpaenp6ioqKqqqqurq6ysrLCwsLGxsbS0tLa2tri4uLm5ub29vb6+vsDAwMHBwcLCwsXFxcjIyMnJyc3Nzc7OztPT09TU1NXV1dfX19nZ2dra2tvb29zc3N7e3uDg4OHh4eLi4uPj4+fn5+np6ezs7O7u7vDw8PHx8fLy8vPz8/X19fb29vj4+Pn5+fz8/P39/f7+/v///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////yH/C05FVFNDQVBFMi4wAwEAAAAh+QQFBAABACwAAAAAMgAyAIcAAAAA/wADAwMHBwcREREVFRUqKiotLS0wMDA4ODg9PT1ERERJSUlLS0tQUFBSUlJVVVVXV1daWlpfX19jY2NmZmZpaWlsbGxtbW1zc3N7e3t/f3+BgYGCgoKEhISGhoaHh4eIiIiLi4uSkpKUlJSWlpadnZ2hoaGjo6OkpKSlpaWnp6eoqKiqqqqrq6usrKywsLCxsbG0tLS2tra4uLi5ubm9vb2+vr7AwMDBwcHCwsLFxcXIyMjJycnNzc3Ozs7T09PU1NTV1dXX19fZ2dna2trb29vc3Nze3t7g4ODh4eHi4uLj4+Pn5+fp6ens7Ozu7u7w8PDx8fHy8vLz8/P19fX29vb4+Pj5+fn8/Pz9/f3+/v7///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8I/wCzcBFIcKDBgggPKkzIcCEXLlq4bIEokeLEiBcrYrTIcaNHjRobinQ4sqRCkBlTdtR44MBKlR9TmjQJQMBMkgZfdpwSMSYAACgpRtHpcSYSFUIa1mz448UQnAWDfmzSooUVmD9XVnnBwglMlDdvvMjhcOlCHit23CSqcUrVJiizpnTC4sXQmB1vZvmxwgYWhWYLznjRA+rJryqvxGhxxGNLjkVcwMCCN6ZeLkNevDCcRYYKJJfZptyCQwdiijl0CDxdlLPryw2lymY9WzTs17ijVq69mzbM28Bd8x7u23bu46F7i16uXEvw5ziJM5duGbl1k9OLN5cKvfvh7OC3b0jxTv6h+PDUy3unzl67RPXXc56fnz4+/PbofcOHnr9/5f3x4UeffvYVqJuACP5m4IIJ+gfWgusN6KCCAN7WoITVVXjchBxqERAAIfkEBQQAAQAsDQADACAAEAAACKcAA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DQgAIfkEBQUAAQAsBQADACAAEAAACKYAAwgcSLAgwQcODCpcyNDAAYYQAzhpaIDhFYY+NOBY6HAhkyETFRLZ0CGKQgMVDV4RAoQKQxMdUpx8aJAJECYQnWzYcMQgSoNVgAy5CHGGhhI+aRIkMgRnxCohNvQoiLDgEyFDskQUuINDiK1Hfpgc+ETKQi0nVGxNkkSrwCw/hiBxu7XuFidAhARpgqWu3yxIhgApEtLvVipIgARBYthvlKaNFQYEADs=";function _n(t){let e,r;return{c(){e=$("img"),W(e.src,r=An)||h(e,"src",r),h(e,"alt","spinner")},m(n,i){A(n,e,i)},p:y,i:y,o:y,d(n){n&&m(e)}}}class pn extends C{constructor(e){super(),R(this,e,null,_n,N,{})}}function hn(t){S(t,"svelte-4wmtg7",".rcb-modal-loader.svelte-4wmtg7{width:100%;min-height:10rem;display:flex;justify-content:center;align-items:center}")}function En(t){let e,r,n;return r=new pn({}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-modal-loader svelte-4wmtg7")},m(i,s){A(i,e,s),E(r,e,null),n=!0},p:y,i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&m(e),I(r)}}}class ye extends C{constructor(e){super(),R(this,e,null,En,N,{},hn)}}var Ae=(t=>(t.Started="started",t.InProgress="in_progress",t.Succeeded="succeeded",t.Failed="failed",t))(Ae||{}),De=(t=>(t[t.SetupIntentCreationFailed=1]="SetupIntentCreationFailed",t[t.PaymentMethodCreationFailed=2]="PaymentMethodCreationFailed",t[t.PaymentChargeFailed=3]="PaymentChargeFailed",t))(De||{}),O=(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))(O||{});class H extends Error{constructor(e,r,n){super(r),this.errorCode=e,this.underlyingErrorMessage=n}}class In{constructor(e,r=10){Q(this,"operationSessionId",null);Q(this,"backend");Q(this,"maxNumberAttempts");Q(this,"waitMSBetweenAttempts",1e3);this.backend=e,this.maxNumberAttempts=r}async startPurchase(e,r,n){const i=await this.backend.postSubscribe(e,r,n);return this.operationSessionId=i.operation_session_id,i}async pollCurrentPurchaseForCompletion(){const e=this.operationSessionId;if(!e)throw new H(0,"No purchase in progress");return new Promise((r,n)=>{const i=(s=1)=>{if(s>this.maxNumberAttempts){this.clearPurchaseInProgress(),n(new H(2,"Max attempts reached trying to get successful purchase status"));return}this.backend.getCheckoutStatus(e).then(l=>{switch(l.operation.status){case Ae.Started:case Ae.InProgress:setTimeout(()=>i(s+1),this.waitMSBetweenAttempts);break;case Ae.Succeeded:this.clearPurchaseInProgress(),r();return;case Ae.Failed:this.clearPurchaseInProgress(),this.handlePaymentError(l.operation.error,n)}}).catch(l=>{n(new H(3,l.message))})};i()})}clearPurchaseInProgress(){this.operationSessionId=null}handlePaymentError(e,r){if(e==null){r(new H(2,"Got an error status but error field is empty."));return}switch(e.code){case De.SetupIntentCreationFailed:r(new H(0,"Setup intent creation failed"));return;case De.PaymentMethodCreationFailed:r(new H(0,"Payment method creation failed"));return;case De.PaymentChargeFailed:r(new H(1,"Payment charge failed"));return}}}function wn(t){S(t,"svelte-igat39","button.svelte-igat39{border:none;border-radius:3.5rem;font-size:1rem;cursor:pointer;height:3.5rem;color:black;background-color:#dfdfdf}button.intent-primary.svelte-igat39{background-color:#000;color:white;font-size:1rem}")}function bn(t){let e,r,n,i,s;const l=t[3].default,o=J(l,t,t[2],null);return{c(){e=$("button"),o&&o.c(),h(e,"class",r=fe(`intent-${t[0]}`)+" svelte-igat39"),e.disabled=t[1]},m(c,u){A(c,e,u),o&&o.m(e,null),n=!0,i||(s=de(e,"click",t[4]),i=!0)},p(c,[u]){o&&o.p&&(!n||u&4)&&V(o,l,c,c[2],n?x(l,c[2],u,null):q(c[2]),null),(!n||u&1&&r!==(r=fe(`intent-${c[0]}`)+" svelte-igat39"))&&h(e,"class",r),(!n||u&2)&&(e.disabled=c[1])},i(c){n||(a(o,c),n=!0)},o(c){f(o,c),n=!1},d(c){c&&m(e),o&&o.d(c),i=!1,s()}}}function $n(t,e,r){let{$$slots:n={},$$scope:i}=e,{intent:s="primary"}=e,{disabled:l=!1}=e;function o(c){We.call(this,t,c)}return t.$$set=c=>{"intent"in c&&r(0,s=c.intent),"disabled"in c&&r(1,l=c.disabled),"$$scope"in c&&r(2,i=c.$$scope)},[s,l,i,n,o]}class _e extends C{constructor(e){super(),R(this,e,$n,bn,N,{intent:0,disabled:1},wn)}}function Bn(t){S(t,"svelte-1f9z0o8","footer.svelte-1f9z0o8{display:flex;flex-direction:column}")}function kn(t){let e,r;const n=t[1].default,i=J(n,t,t[0],null);return{c(){e=$("footer"),i&&i.c(),h(e,"class","rcb-modal-footer svelte-1f9z0o8")},m(s,l){A(s,e,l),i&&i.m(e,null),r=!0},p(s,[l]){i&&i.p&&(!r||l&1)&&V(i,n,s,s[0],r?x(n,s[0],l,null):q(s[0]),null)},i(s){r||(a(i,s),r=!0)},o(s){f(i,s),r=!1},d(s){s&&m(e),i&&i.d(s)}}}function yn(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=s=>{"$$scope"in s&&r(0,i=s.$$scope)},[i,n]}class ve extends C{constructor(e){super(),R(this,e,yn,kn,N,{},Bn)}}const Dn="data:image/svg+xml,%3csvg%20width='124'%20height='124'%20viewBox='0%200%20124%20124'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='62'%20cy='62'%20r='62'%20fill='%23767676'/%3e%3cpath%20d='M87.6668%2041.504L82.4968%2036.334L62.0002%2056.8307L41.5035%2036.334L36.3335%2041.504L56.8302%2062.0006L36.3335%2082.4973L41.5035%2087.6673L62.0002%2067.1706L82.4968%2087.6673L87.6668%2082.4973L67.1702%2062.0006L87.6668%2041.504Z'%20fill='white'/%3e%3c/svg%3e";function vn(t){S(t,"svelte-7khg4b","img.svelte-7khg4b{width:7.75rem;height:7.75rem;margin:0 auto}")}function Qn(t){let e,r;return{c(){e=$("img"),W(e.src,r=Dn)||h(e,"src",r),h(e,"alt","icon"),h(e,"class","rcb-ui-asset-icon svelte-7khg4b")},m(n,i){A(n,e,i)},p:y,i:y,o:y,d(n){n&&m(e)}}}class Mn extends C{constructor(e){super(),R(this,e,null,Qn,N,{},vn)}}function Tn(t){S(t,"svelte-18njhoa",'.column.svelte-18njhoa{display:flex;flex-direction:column;justify-content:flex-start;gap:var(--gap, "0.5rem")}')}function Pn(t){let e,r,n;const i=t[2].default,s=J(i,t,t[1],null);return{c(){e=$("div"),s&&s.c(),h(e,"class","column svelte-18njhoa"),h(e,"style",r=`--gap:${t[0]};`)},m(l,o){A(l,e,o),s&&s.m(e,null),n=!0},p(l,[o]){s&&s.p&&(!n||o&2)&&V(s,i,l,l[1],n?x(i,l[1],o,null):q(l[1]),null),(!n||o&1&&r!==(r=`--gap:${l[0]};`))&&h(e,"style",r)},i(l){n||(a(s,l),n=!0)},o(l){f(s,l),n=!1},d(l){l&&m(e),s&&s.d(l)}}}function Un(t,e,r){let{$$slots:n={},$$scope:i}=e,{gutter:s="0.5rem"}=e;return t.$$set=l=>{"gutter"in l&&r(0,s=l.gutter),"$$scope"in l&&r(1,i=l.$$scope)},[s,i,n]}class ne extends C{constructor(e){super(),R(this,e,Un,Pn,N,{gutter:0},Tn)}}const Nn="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 Rn(t){S(t,"svelte-r1ujja",".close-button.svelte-r1ujja{border:none;cursor:pointer;background-color:transparent}")}function Cn(t){let e,r,n,i,s;return{c(){e=$("button"),r=$("img"),W(r.src,n=Nn)||h(r,"src",n),h(r,"alt","close"),h(e,"class","close-button svelte-r1ujja"),e.disabled=t[0]},m(l,o){A(l,e,o),M(e,r),i||(s=de(e,"click",t[1]),i=!0)},p(l,[o]){o&1&&(e.disabled=l[0])},i:y,o:y,d(l){l&&m(e),i=!1,s()}}}function Sn(t,e,r){let{disabled:n=!1}=e;function i(s){We.call(this,t,s)}return t.$$set=s=>{"disabled"in s&&r(0,n=s.disabled)},[n,i]}class On extends C{constructor(e){super(),R(this,e,Sn,Cn,N,{disabled:0},Rn)}}function Ln(t){S(t,"svelte-10u48yl",".rcb-app-icon.svelte-10u48yl{width:2.5rem;height:2.5rem;border-radius:0.75rem;box-shadow:0px 1px 10px 0px rgba(0, 0, 0, 0.1);margin-right:1rem}.rcb-app-icon-picture-container.svelte-10u48yl{height:2.5rem}.rcb-app-icon.loading.svelte-10u48yl{background-color:gray}")}function Fn(t){let e;return{c(){e=$("div"),h(e,"class","rcb-app-icon loading svelte-10u48yl")},m(r,n){A(r,e,n)},p:y,d(r){r&&m(e)}}}function Gn(t){let e,r,n,i,s,l;return{c(){e=$("picture"),r=$("source"),i=P(),s=$("img"),h(r,"type","image/webp"),Rt(r,n=t[1])||h(r,"srcset",n),h(s,"class","rcb-app-icon svelte-10u48yl"),W(s.src,l=t[0])||h(s,"src",l),h(s,"alt","App icon"),h(e,"class","rcb-app-icon-picture-container svelte-10u48yl")},m(o,c){A(o,e,c),M(e,r),M(e,i),M(e,s)},p(o,c){c&2&&n!==(n=o[1])&&h(r,"srcset",n),c&1&&!W(s.src,l=o[0])&&h(s,"src",l)},d(o){o&&m(e)}}}function Yn(t){let e;function r(s,l){return s[0]!==null?Gn:Fn}let n=r(t),i=n(t);return{c(){i.c(),e=ee()},m(s,l){i.m(s,l),A(s,e,l)},p(s,[l]){n===(n=r(s))&&i?i.p(s,l):(i.d(1),i=n(s),i&&(i.c(),i.m(e.parentNode,e)))},i:y,o:y,d(s){s&&m(e),i.d(s)}}}function Hn(t,e,r){let{src:n=null}=e,{srcWebp:i=null}=e;return t.$$set=s=>{"src"in s&&r(0,n=s.src),"srcWebp"in s&&r(1,i=s.srcWebp)},[n,i]}class tt extends C{constructor(e){super(),R(this,e,Hn,Yn,N,{src:0,srcWebp:1},Ln)}}const Qe=t=>`https://da08ctfrofx1b.cloudfront.net/${t}`;function Kn(t){S(t,"svelte-1tdgim9",".app-title.svelte-1tdgim9{font-weight:500;margin:0.5rem 0;font-size:1rem}.rcb-header-layout__business-info.svelte-1tdgim9{display:flex;align-items:center}")}function jn(t){let e,r;return e=new tt({}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p:y,i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Jn(t){let e,r,n=t[0].seller_company_name+"",i,s,l=t[0].app_icon_webp!==null&&t[0].app_icon!==null&&nt(t);return{c(){l&&l.c(),e=P(),r=$("span"),i=L(n),h(r,"class","app-title svelte-1tdgim9")},m(o,c){l&&l.m(o,c),A(o,e,c),A(o,r,c),M(r,i),s=!0},p(o,c){o[0].app_icon_webp!==null&&o[0].app_icon!==null?l?(l.p(o,c),c&1&&a(l,1)):(l=nt(o),l.c(),a(l,1),l.m(e.parentNode,e)):l&&(F(),f(l,1,1,()=>{l=null}),G()),(!s||c&1)&&n!==(n=o[0].seller_company_name+"")&&ie(i,n)},i(o){s||(a(l),s=!0)},o(o){f(l),s=!1},d(o){o&&(m(e),m(r)),l&&l.d(o)}}}function nt(t){let e,r;return e=new tt({props:{src:Qe(t[0].app_icon),srcWebp:Qe(t[0].app_icon_webp)}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&1&&(s.src=Qe(n[0].app_icon)),i&1&&(s.srcWebp=Qe(n[0].app_icon_webp)),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function xn(t){let e,r,n,i;const s=[Jn,jn],l=[];function o(c,u){return c[0]!==null?0:1}return r=o(t),n=l[r]=s[r](t),{c(){e=$("div"),n.c(),h(e,"class","rcb-header-layout__business-info svelte-1tdgim9")},m(c,u){A(c,e,u),l[r].m(e,null),i=!0},p(c,[u]){let _=r;r=o(c),r===_?l[r].p(c,u):(F(),f(l[_],1,1,()=>{l[_]=null}),G(),n=l[r],n?n.p(c,u):(n=l[r]=s[r](c),n.c()),a(n,1),n.m(e,null))},i(c){i||(a(n),i=!0)},o(c){f(n),i=!1},d(c){c&&m(e),l[r].d()}}}function Vn(t,e,r){let{brandingInfo:n=null}=e;return t.$$set=i=>{"brandingInfo"in i&&r(0,n=i.brandingInfo)},[n]}class rt extends C{constructor(e){super(),R(this,e,Vn,xn,N,{brandingInfo:0},Kn)}}function qn(t){S(t,"svelte-j03lz1",".rcb-post-purchase-header-layout.svelte-j03lz1{display:flex;justify-content:space-between;align-items:center;width:100%}")}function Wn(t){let e,r,n,i,s;return r=new rt({props:{brandingInfo:t[0]}}),i=new On({}),i.$on("click",function(){re(t[1])&&t[1].apply(this,arguments)}),{c(){e=$("div"),b(r.$$.fragment),n=P(),b(i.$$.fragment),h(e,"class","rcb-post-purchase-header-layout svelte-j03lz1")},m(l,o){A(l,e,o),E(r,e,null),M(e,n),E(i,e,null),s=!0},p(l,o){t=l;const c={};o&1&&(c.brandingInfo=t[0]),r.$set(c)},i(l){s||(a(r.$$.fragment,l),a(i.$$.fragment,l),s=!0)},o(l){f(r.$$.fragment,l),f(i.$$.fragment,l),s=!1},d(l){l&&m(e),I(r),I(i)}}}function zn(t){let e,r;return e=new X({props:{as:"header",$$slots:{default:[Wn]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&7&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Xn(t,e,r){let{brandingInfo:n=null}=e,{onClose:i}=e;return t.$$set=s=>{"brandingInfo"in s&&r(0,n=s.brandingInfo),"onClose"in s&&r(1,i=s.onClose)},[n,i]}class it extends C{constructor(e){super(),R(this,e,Xn,zn,N,{brandingInfo:0,onClose:1},qn)}}function Zn(t){S(t,"svelte-ahi052",".rcb-modal-error.svelte-ahi052{width:100%;min-height:10rem;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center}.title.svelte-ahi052{font-size:24px}.subtitle.svelte-ahi052{font-size:16px}")}function st(t){let e,r,n,i,s;return{c(){e=L("If this error persists, please contact "),r=$("a"),n=L(t[1]),s=L("."),h(r,"href",i="mailto:"+t[1])},m(l,o){A(l,e,o),A(l,r,o),M(r,n),A(l,s,o)},p(l,o){o&2&&ie(n,l[1]),o&2&&i!==(i="mailto:"+l[1])&&h(r,"href",i)},d(l){l&&(m(e),m(r),m(s))}}}function er(t){let e,r,n,i=t[3]()+"",s,l,o=t[1]&&st(t);return{c(){e=$("span"),e.textContent="Something went wrong.",r=P(),n=$("span"),s=L(i),l=P(),o&&o.c(),h(e,"class","title svelte-ahi052"),h(n,"class","subtitle svelte-ahi052")},m(c,u){A(c,e,u),A(c,r,u),A(c,n,u),M(n,s),M(n,l),o&&o.m(n,null)},p(c,u){c[1]?o?o.p(c,u):(o=st(c),o.c(),o.m(n,null)):o&&(o.d(1),o=null)},d(c){c&&(m(e),m(r),m(n)),o&&o.d()}}}function tr(t){let e,r,n,i;return e=new Mn({}),n=new ne({props:{gutter:"1rem",$$slots:{default:[er]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment)},m(s,l){E(e,s,l),A(s,r,l),E(n,s,l),i=!0},p(s,l){const o={};l&34&&(o.$$scope={dirty:l,ctx:s}),n.$set(o)},i(s){i||(a(e.$$.fragment,s),a(n.$$.fragment,s),i=!0)},o(s){f(e.$$.fragment,s),f(n.$$.fragment,s),i=!1},d(s){s&&m(r),I(e,s),I(n,s)}}}function nr(t){let e,r,n;return r=new ne({props:{gutter:"1rem",$$slots:{default:[tr]},$$scope:{ctx:t}}}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-modal-error svelte-ahi052")},m(i,s){A(i,e,s),E(r,e,null),n=!0},p(i,s){const l={};s&34&&(l.$$scope={dirty:s,ctx:i}),r.$set(l)},i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&m(e),I(r)}}}function rr(t){let e;return{c(){e=L("Go back to app")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function ir(t){let e,r;return e=new _e({props:{$$slots:{default:[rr]},$$scope:{ctx:t}}}),e.$on("click",function(){re(t[2])&&t[2].apply(this,arguments)}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){t=n;const s={};i&32&&(s.$$scope={dirty:i,ctx:t}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function sr(t){let e,r,n,i,s,l;return e=new it({props:{brandingInfo:t[0],onClose:t[2]}}),n=new X({props:{$$slots:{default:[nr]},$$scope:{ctx:t}}}),s=new ve({props:{$$slots:{default:[ir]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment),i=P(),b(s.$$.fragment)},m(o,c){E(e,o,c),A(o,r,c),E(n,o,c),A(o,i,c),E(s,o,c),l=!0},p(o,c){const u={};c&1&&(u.brandingInfo=o[0]),c&4&&(u.onClose=o[2]),e.$set(u);const _={};c&34&&(_.$$scope={dirty:c,ctx:o}),n.$set(_);const g={};c&36&&(g.$$scope={dirty:c,ctx:o}),s.$set(g)},i(o){l||(a(e.$$.fragment,o),a(n.$$.fragment,o),a(s.$$.fragment,o),l=!0)},o(o){f(e.$$.fragment,o),f(n.$$.fragment,o),f(s.$$.fragment,o),l=!1},d(o){o&&(m(r),m(i)),I(e,o),I(n,o),I(s,o)}}}function lr(t){let e,r;return e=new ne({props:{gutter:"2rem",$$slots:{default:[sr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&39&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function or(t,e,r){let{brandingInfo:n=null}=e,{lastError:i}=e,{supportEmail:s=null}=e,{onContinue:l}=e;$e(()=>{console.debug(`Displayed error: ${O[i.errorCode]}. Message: ${i.message??"None"}. Underlying error: ${i.underlyingErrorMessage??"None"}`)});function o(){switch(i.errorCode){case O.UnknownError:return"An unknown error occurred.";case O.ErrorSettingUpPurchase:return"Purchase not started due to an error.";case O.ErrorChargingPayment:return"Payment failed.";case O.NetworkError:return"Network error. Please check your internet connection.";case O.StripeError:return i.message;case O.MissingEmailError:return"Email is required to complete the purchase."}return i.message}return t.$$set=c=>{"brandingInfo"in c&&r(0,n=c.brandingInfo),"lastError"in c&&r(4,i=c.lastError),"supportEmail"in c&&r(1,s=c.supportEmail),"onContinue"in c&&r(2,l=c.onContinue)},[n,s,l,o,i]}class cr extends C{constructor(e){super(),R(this,e,or,lr,N,{brandingInfo:0,lastError:4,supportEmail:1,onContinue:2},Zn)}}const ar="data:image/svg+xml,%3csvg%20width='124'%20height='124'%20viewBox='0%200%20124%20124'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='62'%20cy='62'%20r='62'%20fill='%23576CDB'/%3e%3crect%20x='44.1116'%20y='56'%20width='27.5'%20height='11'%20transform='rotate(45%2044.1116%2056)'%20fill='white'/%3e%3crect%20x='79.1133'%20y='44.334'%20width='11'%20height='44'%20transform='rotate(45%2079.1133%2044.334)'%20fill='white'/%3e%3c/svg%3e";function ur(t){S(t,"svelte-7khg4b","img.svelte-7khg4b{width:7.75rem;height:7.75rem;margin:0 auto}")}function fr(t){let e,r;return{c(){e=$("img"),W(e.src,r=ar)||h(e,"src",r),h(e,"alt","icon"),h(e,"class","rcb-ui-asset-icon svelte-7khg4b")},m(n,i){A(n,e,i)},p:y,i:y,o:y,d(n){n&&m(e)}}}class dr extends C{constructor(e){super(),R(this,e,null,fr,N,{},ur)}}function mr(t){S(t,"svelte-1lcsna9",".rcb-modal-success.svelte-1lcsna9{width:100%;min-height:10rem;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center}.title.svelte-1lcsna9{font-size:24px}.subtitle.svelte-1lcsna9{font-size:16px}")}function gr(t){let e,r,n;return{c(){e=$("span"),e.textContent="Purchase Successful",r=P(),n=$("span"),n.textContent="Your plan is now active.",h(e,"class","title svelte-1lcsna9"),h(n,"class","subtitle svelte-1lcsna9")},m(i,s){A(i,e,s),A(i,r,s),A(i,n,s)},p:y,d(i){i&&(m(e),m(r),m(n))}}}function Ar(t){let e,r,n,i;return e=new dr({}),n=new ne({props:{gutter:"1rem",$$slots:{default:[gr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment)},m(s,l){E(e,s,l),A(s,r,l),E(n,s,l),i=!0},p(s,l){const o={};l&4&&(o.$$scope={dirty:l,ctx:s}),n.$set(o)},i(s){i||(a(e.$$.fragment,s),a(n.$$.fragment,s),i=!0)},o(s){f(e.$$.fragment,s),f(n.$$.fragment,s),i=!1},d(s){s&&m(r),I(e,s),I(n,s)}}}function _r(t){let e,r,n;return r=new ne({props:{gutter:"1rem",$$slots:{default:[Ar]},$$scope:{ctx:t}}}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-modal-success svelte-1lcsna9")},m(i,s){A(i,e,s),E(r,e,null),n=!0},p(i,s){const l={};s&4&&(l.$$scope={dirty:s,ctx:i}),r.$set(l)},i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&m(e),I(r)}}}function pr(t){let e;return{c(){e=L("Go back to app")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function hr(t){let e,r;return e=new _e({props:{$$slots:{default:[pr]},$$scope:{ctx:t}}}),e.$on("click",function(){re(t[1])&&t[1].apply(this,arguments)}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){t=n;const s={};i&4&&(s.$$scope={dirty:i,ctx:t}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Er(t){let e,r,n,i,s,l;return e=new it({props:{brandingInfo:t[0],onClose:t[1]}}),n=new X({props:{$$slots:{default:[_r]},$$scope:{ctx:t}}}),s=new ve({props:{$$slots:{default:[hr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment),i=P(),b(s.$$.fragment)},m(o,c){E(e,o,c),A(o,r,c),E(n,o,c),A(o,i,c),E(s,o,c),l=!0},p(o,c){const u={};c&1&&(u.brandingInfo=o[0]),c&2&&(u.onClose=o[1]),e.$set(u);const _={};c&4&&(_.$$scope={dirty:c,ctx:o}),n.$set(_);const g={};c&6&&(g.$$scope={dirty:c,ctx:o}),s.$set(g)},i(o){l||(a(e.$$.fragment,o),a(n.$$.fragment,o),a(s.$$.fragment,o),l=!0)},o(o){f(e.$$.fragment,o),f(n.$$.fragment,o),f(s.$$.fragment,o),l=!1},d(o){o&&(m(r),m(i)),I(e,o),I(n,o),I(s,o)}}}function Ir(t){let e,r;return e=new ne({props:{gutter:"2rem",$$slots:{default:[Er]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&7&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function wr(t,e,r){let{brandingInfo:n=null}=e,{onContinue:i}=e;return t.$$set=s=>{"brandingInfo"in s&&r(0,n=s.brandingInfo),"onContinue"in s&&r(1,i=s.onContinue)},[n,i]}class br extends C{constructor(e){super(),R(this,e,wr,Ir,N,{brandingInfo:0,onContinue:1},mr)}}function $r(t,e,r,n,i={}){const s=r.create(e,i);return s.mount(t),s.on("change",l=>n("change",l)),s.on("ready",l=>n("ready",l)),s.on("focus",l=>n("focus",l)),s.on("blur",l=>n("blur",l)),s.on("escape",l=>n("escape",l)),s.on("click",l=>n("click",l)),s.on("loaderror",l=>n("loaderror",l)),s.on("loaderstart",l=>n("loaderstart",l)),s.on("networkschange",l=>n("networkschange",l)),s}const Br=typeof window>"u";function kr(t){if(!Br)return t.registerAppInfo({name:"svelte-stripe-js",url:"https://svelte-stripe-js.vercel.app"})}function yr(t){let e;return{c(){e=$("div")},m(r,n){A(r,e,n),t[6](e)},p:y,i:y,o:y,d(r){r&&m(e),t[6](null)}}}function Dr(t,e,r){let n,i;const s=Jt(),{elements:l}=Vt("stripe");let{options:o=void 0}=e;$e(()=>(n=$r(i,"payment",l,s,o),()=>n.destroy()));function c(){n.blur()}function u(){n.clear()}function _(){n.destroy()}function g(){n.focus()}function B(k){Be[k?"unshift":"push"](()=>{i=k,r(0,i)})}return t.$$set=k=>{"options"in k&&r(1,o=k.options)},[i,o,c,u,_,g,B]}class vr extends C{constructor(e){super(),R(this,e,Dr,yr,N,{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 lt(t){let e;const r=t[15].default,n=J(r,t,t[14],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&16384)&&V(n,r,i,i[14],e?x(r,i[14],s,null):q(i[14]),null)},i(i){e||(a(n,i),e=!0)},o(i){f(n,i),e=!1},d(i){n&&n.d(i)}}}function Qr(t){let e,r,n=t[1]&&t[0]&&lt(t);return{c(){n&&n.c(),e=ee()},m(i,s){n&&n.m(i,s),A(i,e,s),r=!0},p(i,[s]){i[1]&&i[0]?n?(n.p(i,s),s&3&&a(n,1)):(n=lt(i),n.c(),a(n,1),n.m(e.parentNode,e)):n&&(F(),f(n,1,1,()=>{n=null}),G())},i(i){r||(a(n),r=!0)},o(i){f(n),r=!1},d(i){i&&m(e),n&&n.d(i)}}}function Mr(t,e,r){let n,{$$slots:i={},$$scope:s}=e,{stripe:l}=e,{mode:o=void 0}=e,{theme:c="stripe"}=e,{variables:u={}}=e,{rules:_={}}=e,{labels:g="above"}=e,{loader:B="auto"}=e,{fonts:k=[]}=e,{locale:w="auto"}=e,{currency:D=void 0}=e,{amount:T=void 0}=e,{clientSecret:U=void 0}=e,{elements:d=null}=e;return t.$$set=p=>{"stripe"in p&&r(1,l=p.stripe),"mode"in p&&r(2,o=p.mode),"theme"in p&&r(3,c=p.theme),"variables"in p&&r(4,u=p.variables),"rules"in p&&r(5,_=p.rules),"labels"in p&&r(6,g=p.labels),"loader"in p&&r(7,B=p.loader),"fonts"in p&&r(8,k=p.fonts),"locale"in p&&r(9,w=p.locale),"currency"in p&&r(10,D=p.currency),"amount"in p&&r(11,T=p.amount),"clientSecret"in p&&r(12,U=p.clientSecret),"elements"in p&&r(0,d=p.elements),"$$scope"in p&&r(14,s=p.$$scope)},t.$$.update=()=>{t.$$.dirty&120&&r(13,n={theme:c,variables:u,rules:_,labels:g}),t.$$.dirty&16263&&l&&!d&&(r(0,d=l.elements({mode:o,currency:D,amount:T,appearance:n,clientSecret:U,fonts:k,loader:B,locale:w})),kr(l),xt("stripe",{stripe:l,elements:d})),t.$$.dirty&8705&&d&&d.update({appearance:n,locale:w})},[d,l,o,c,u,_,g,B,k,w,D,T,U,n,s,i]}class Tr extends C{constructor(e){super(),R(this,e,Mr,Qr,N,{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 ot="https://js.stripe.com/v3",Pr=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,ct="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",Ur=function(){for(var e=document.querySelectorAll('script[src^="'.concat(ot,'"]')),r=0;r<e.length;r++){var n=e[r];if(Pr.test(n.src))return n}return null},at=function(e){var r=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(ot).concat(r);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},Nr=function(e,r){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"2.3.0",startTime:r})},pe=null,Me=null,Te=null,Rr=function(e){return function(){e(new Error("Failed to load Stripe.js"))}},Cr=function(e,r){return function(){window.Stripe?e(window.Stripe):r(new Error("Stripe.js not available"))}},Sr=function(e){return pe!==null?pe:(pe=new Promise(function(r,n){if(typeof window>"u"||typeof document>"u"){r(null);return}if(window.Stripe&&e&&console.warn(ct),window.Stripe){r(window.Stripe);return}try{var i=Ur();if(i&&e)console.warn(ct);else if(!i)i=at(e);else if(i&&Te!==null&&Me!==null){var s;i.removeEventListener("load",Te),i.removeEventListener("error",Me),(s=i.parentNode)===null||s===void 0||s.removeChild(i),i=at(e)}Te=Cr(r,n),Me=Rr(n),i.addEventListener("load",Te),i.addEventListener("error",Me)}catch(l){n(l);return}}),pe.catch(function(r){return pe=null,Promise.reject(r)}))},Or=function(e,r,n){if(e===null)return null;var i=e.apply(void 0,r);return Nr(i,n),i},he,ut=!1,ft=function(){return he||(he=Sr(null).catch(function(e){return he=null,Promise.reject(e)}),he)};Promise.resolve().then(function(){return ft()}).catch(function(t){ut||console.warn(t)});var Lr=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];ut=!0;var i=Date.now();return ft().then(function(s){return Or(s,r,i)})};function Fr(t){S(t,"svelte-1fwwzeb",".rcb-stripe-elements-container.svelte-1fwwzeb{width:100%;margin-bottom:1rem}")}function Gr(t){let e,r;return e=new ye({}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p:y,i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Yr(t){let e,r,n,i,s,l;function o(u){t[9](u)}let c={stripe:t[2],clientSecret:t[4],loader:"always",$$slots:{default:[Wr]},$$scope:{ctx:t}};return t[1]!==void 0&&(c.elements=t[1]),r=new Tr({props:c}),Be.push(()=>en(r,"elements",o)),{c(){e=$("form"),b(r.$$.fragment)},m(u,_){A(u,e,_),E(r,e,null),i=!0,s||(l=de(e,"submit",Ve(t[5])),s=!0)},p(u,_){const g={};_&4&&(g.stripe=u[2]),_&2057&&(g.$$scope={dirty:_,ctx:u}),!n&&_&2&&(n=!0,g.elements=u[1],zt(()=>n=!1)),r.$set(g)},i(u){i||(a(r.$$.fragment,u),i=!0)},o(u){f(r.$$.fragment,u),i=!1},d(u){u&&m(e),I(r),s=!1,l()}}}function Hr(t){let e,r,n;return r=new vr({}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-stripe-elements-container svelte-1fwwzeb")},m(i,s){A(i,e,s),E(r,e,null),n=!0},p:y,i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&m(e),I(r)}}}function Kr(t){let e;return{c(){e=L("Pay")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function jr(t){let e;return{c(){e=L("Processing...")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function Jr(t){let e;function r(s,l){return s[3]?jr:Kr}let n=r(t),i=n(t);return{c(){i.c(),e=ee()},m(s,l){i.m(s,l),A(s,e,l)},p(s,l){n!==(n=r(s))&&(i.d(1),i=n(s),i&&(i.c(),i.m(e.parentNode,e)))},d(s){s&&m(e),i.d(s)}}}function xr(t){let e;return{c(){e=L("Close")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function Vr(t){let e,r,n,i;return e=new _e({props:{disabled:t[3],$$slots:{default:[Jr]},$$scope:{ctx:t}}}),n=new _e({props:{disabled:t[3],intent:"secondary",$$slots:{default:[xr]},$$scope:{ctx:t}}}),n.$on("click",function(){re(t[0])&&t[0].apply(this,arguments)}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment)},m(s,l){E(e,s,l),A(s,r,l),E(n,s,l),i=!0},p(s,l){t=s;const o={};l&8&&(o.disabled=t[3]),l&2056&&(o.$$scope={dirty:l,ctx:t}),e.$set(o);const c={};l&8&&(c.disabled=t[3]),l&2048&&(c.$$scope={dirty:l,ctx:t}),n.$set(c)},i(s){i||(a(e.$$.fragment,s),a(n.$$.fragment,s),i=!0)},o(s){f(e.$$.fragment,s),f(n.$$.fragment,s),i=!1},d(s){s&&m(r),I(e,s),I(n,s)}}}function qr(t){let e,r;return e=new ne({props:{$$slots:{default:[Vr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&2057&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Wr(t){let e,r,n,i;return e=new X({props:{$$slots:{default:[Hr]},$$scope:{ctx:t}}}),n=new ve({props:{$$slots:{default:[qr]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment),r=P(),b(n.$$.fragment)},m(s,l){E(e,s,l),A(s,r,l),E(n,s,l),i=!0},p(s,l){const o={};l&2048&&(o.$$scope={dirty:l,ctx:s}),e.$set(o);const c={};l&2057&&(c.$$scope={dirty:l,ctx:s}),n.$set(c)},i(s){i||(a(e.$$.fragment,s),a(n.$$.fragment,s),i=!0)},o(s){f(e.$$.fragment,s),f(n.$$.fragment,s),i=!1},d(s){s&&m(r),I(e,s),I(n,s)}}}function zr(t){let e,r,n,i;const s=[Yr,Gr],l=[];function o(c,u){return c[2]&&c[4]?0:1}return r=o(t),n=l[r]=s[r](t),{c(){e=$("div"),n.c()},m(c,u){A(c,e,u),l[r].m(e,null),i=!0},p(c,[u]){let _=r;r=o(c),r===_?l[r].p(c,u):(F(),f(l[_],1,1,()=>{l[_]=null}),G(),n=l[r],n?n.p(c,u):(n=l[r]=s[r](c),n.c()),a(n,1),n.m(e,null))},i(c){i||(a(n),i=!0)},o(c){f(n),i=!1},d(c){c&&m(e),l[r].d()}}}function Xr(t,e,r){let{onClose:n}=e,{onContinue:i}=e,{onError:s}=e,{paymentInfoCollectionMetadata:l}=e;const o=l.data.client_secret;let c=null,u,_=!1,g;$e(async()=>{const w=l.data.publishable_api_key,D=l.data.stripe_account_id;if(!w||!D)throw new Error("Stripe publishable key or account ID not found");r(2,c=await Lr(w,{stripeAccount:D}))});const B=async()=>{if(_||!c||!g)return;r(3,_=!0);const w=await c.confirmSetup({elements:g,redirect:"if_required"});w.error?(r(3,_=!1),s(new H(O.StripeError,w.error.message))):i()};function k(w){u=w,r(1,u)}return t.$$set=w=>{"onClose"in w&&r(0,n=w.onClose),"onContinue"in w&&r(6,i=w.onContinue),"onError"in w&&r(7,s=w.onError),"paymentInfoCollectionMetadata"in w&&r(8,l=w.paymentInfoCollectionMetadata)},t.$$.update=()=>{t.$$.dirty&2&&u&&u._elements.length>0&&(g=u)},[n,u,c,_,o,B,i,s,l,k]}class Zr extends C{constructor(e){super(),R(this,e,Xr,zr,N,{onClose:0,onContinue:6,onError:7,paymentInfoCollectionMetadata:8},Fr)}}function ei(t){S(t,"svelte-1xardyz",".form-container.svelte-1xardyz{display:flex;flex-direction:column;width:100%}.form-label.svelte-1xardyz{margin-top:0.5rem;margin-bottom:0.5rem;display:block}.form-input.svelte-1xardyz{margin-bottom:1rem}.title.svelte-1xardyz{font-size:1.5rem;margin:0;margin-bottom:0.5rem}input.svelte-1xardyz{width:94%;padding:0.5rem;border:1px solid #ccc;border-radius:0.25rem}")}function ti(t){let e;return{c(){e=$("span"),e.textContent="User authentication",h(e,"class","title svelte-1xardyz")},m(r,n){A(r,e,n)},p:y,d(r){r&&m(e)}}}function ni(t){let e,r,n,i,s,l,o;return{c(){e=$("div"),r=$("div"),r.innerHTML='<label for="email">E-mail</label>',n=P(),i=$("div"),s=$("input"),h(r,"class","form-label svelte-1xardyz"),h(s,"name","email"),h(s,"placeholder","john@appleseed.com"),h(s,"class","svelte-1xardyz"),h(i,"class","form-input svelte-1xardyz"),h(e,"class","form-container svelte-1xardyz")},m(c,u){A(c,e,u),M(e,r),M(e,n),M(e,i),M(i,s),qe(s,t[0]),l||(o=de(s,"input",t[3]),l=!0)},p(c,u){u&1&&s.value!==c[0]&&qe(s,c[0])},d(c){c&&m(e),l=!1,o()}}}function ri(t){let e;return{c(){e=L("Continue")},m(r,n){A(r,e,n)},d(r){r&&m(e)}}}function ii(t){let e,r;return e=new _e({props:{$$slots:{default:[ri]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&16&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function si(t){let e,r,n,i,s,l,o,c,u,_;return n=new X({props:{$$slots:{default:[ti]},$$scope:{ctx:t}}}),s=new X({props:{$$slots:{default:[ni]},$$scope:{ctx:t}}}),o=new ve({props:{$$slots:{default:[ii]},$$scope:{ctx:t}}}),{c(){e=$("div"),r=$("form"),b(n.$$.fragment),i=P(),b(s.$$.fragment),l=P(),b(o.$$.fragment)},m(g,B){A(g,e,B),M(e,r),E(n,r,null),M(r,i),E(s,r,null),M(r,l),E(o,r,null),c=!0,u||(_=de(r,"submit",Ve(t[1])),u=!0)},p(g,[B]){const k={};B&16&&(k.$$scope={dirty:B,ctx:g}),n.$set(k);const w={};B&17&&(w.$$scope={dirty:B,ctx:g}),s.$set(w);const D={};B&16&&(D.$$scope={dirty:B,ctx:g}),o.$set(D)},i(g){c||(a(n.$$.fragment,g),a(s.$$.fragment,g),a(o.$$.fragment,g),c=!0)},o(g){f(n.$$.fragment,g),f(s.$$.fragment,g),f(o.$$.fragment,g),c=!1},d(g){g&&m(e),I(n),I(s),I(o),u=!1,_()}}}function li(t,e,r){let n,{onContinue:i}=e;const s=async()=>{i({email:n})};function l(){n=this.value,r(0,n)}return t.$$set=o=>{"onContinue"in o&&r(2,i=o.onContinue)},r(0,n=""),[n,s,i,l]}class oi extends C{constructor(e){super(),R(this,e,li,si,N,{onContinue:2},ei)}}const ci="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%20opacity='0.5'%20clip-path='url(%23clip0_344_3390)'%3e%3cpath%20d='M7%2018C5.9%2018%205.01%2018.9%205.01%2020C5.01%2021.1%205.9%2022%207%2022C8.1%2022%209%2021.1%209%2020C9%2018.9%208.1%2018%207%2018ZM1%202V4H3L6.6%2011.59L5.25%2014.04C5.09%2014.32%205%2014.65%205%2015C5%2016.1%205.9%2017%207%2017H19V15H7.42C7.28%2015%207.17%2014.89%207.17%2014.75L7.2%2014.63L8.1%2013H15.55C16.3%2013%2016.96%2012.59%2017.3%2011.97L20.88%205.48C20.96%205.34%2021%205.17%2021%205C21%204.45%2020.55%204%2020%204H5.21L4.27%202H1ZM17%2018C15.9%2018%2015.01%2018.9%2015.01%2020C15.01%2021.1%2015.9%2022%2017%2022C18.1%2022%2019%2021.1%2019%2020C19%2018.9%2018.1%2018%2017%2018Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_344_3390'%3e%3crect%20width='24'%20height='24'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";function ai(t){let e,r;return{c(){e=$("img"),W(e.src,r=ci)||h(e,"src",r),h(e,"alt","icon"),h(e,"class","rcb-ui-asset-icon")},m(n,i){A(n,e,i)},p:y,i:y,o:y,d(n){n&&m(e)}}}class ui extends C{constructor(e){super(),R(this,e,null,ai,N,{})}}function fi(t){S(t,"svelte-1ggdgso",".rcb-header-layout.svelte-1ggdgso{display:flex;justify-content:space-between;align-items:center;width:100%}")}function di(t){let e,r,n,i,s;return r=new rt({props:{brandingInfo:t[0]}}),i=new ui({}),{c(){e=$("div"),b(r.$$.fragment),n=P(),b(i.$$.fragment),h(e,"class","rcb-header-layout svelte-1ggdgso")},m(l,o){A(l,e,o),E(r,e,null),M(e,n),E(i,e,null),s=!0},p(l,o){const c={};o&1&&(c.brandingInfo=l[0]),r.$set(c)},i(l){s||(a(r.$$.fragment,l),a(i.$$.fragment,l),s=!0)},o(l){f(r.$$.fragment,l),f(i.$$.fragment,l),s=!1},d(l){l&&m(e),I(r),I(i)}}}function mi(t){let e,r;return e=new X({props:{as:"header",$$slots:{default:[di]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&3&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function gi(t,e,r){let{brandingInfo:n=null}=e;return t.$$set=i=>{"brandingInfo"in i&&r(0,n=i.brandingInfo)},[n]}class Ai extends C{constructor(e){super(),R(this,e,gi,mi,N,{brandingInfo:0},fi)}}function _i(t){S(t,"svelte-17dhulw",".rcb-modal-backdrop.svelte-17dhulw{position:fixed;top:0;left:0;width:100vw;height:100vh;background-color:rgba(40, 40, 40, 0.75);display:flex;flex-direction:column;justify-content:space-around}")}function pi(t){let e,r;const n=t[1].default,i=J(n,t,t[0],null);return{c(){e=$("div"),i&&i.c(),h(e,"class","rcb-modal-backdrop svelte-17dhulw")},m(s,l){A(s,e,l),i&&i.m(e,null),r=!0},p(s,[l]){i&&i.p&&(!r||l&1)&&V(i,n,s,s[0],r?x(n,s[0],l,null):q(s[0]),null)},i(s){r||(a(i,s),r=!0)},o(s){f(i,s),r=!1},d(s){s&&m(e),i&&i.d(s)}}}function hi(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=s=>{"$$scope"in s&&r(0,i=s.$$scope)},[i,n]}class Ei extends C{constructor(e){super(),R(this,e,hi,pi,N,{},_i)}}function Ii(t){S(t,"svelte-m6kocx",".rcb-modal-main.svelte-m6kocx{box-sizing:border-box;border-radius:0.5rem;background-color:#fff;color:black;max-width:40rem;min-width:30rem;overflow-y:auto;padding:2.5rem}.rcb-modal-dark.svelte-m6kocx{background-color:#000;color:#fff;max-width:30rem;min-width:20rem}@media screen and (max-width: 60rem){.rcb-modal-main.svelte-m6kocx,.rcb-modal-dark.svelte-m6kocx{max-width:40rem;min-width:90vw}}")}function wi(t){let e,r,n;const i=t[2].default,s=J(i,t,t[1],null);return{c(){e=$("main"),s&&s.c(),h(e,"class",r=fe(`rcb-modal-main ${t[0]?"rcb-modal-dark":""}`)+" svelte-m6kocx")},m(l,o){A(l,e,o),s&&s.m(e,null),n=!0},p(l,[o]){s&&s.p&&(!n||o&2)&&V(s,i,l,l[1],n?x(i,l[1],o,null):q(l[1]),null),(!n||o&1&&r!==(r=fe(`rcb-modal-main ${l[0]?"rcb-modal-dark":""}`)+" svelte-m6kocx"))&&h(e,"class",r)},i(l){n||(a(s,l),n=!0)},o(l){f(s,l),n=!1},d(l){l&&m(e),s&&s.d(l)}}}function bi(t,e,r){let{$$slots:n={},$$scope:i}=e,{dark:s=!1}=e;return t.$$set=l=>{"dark"in l&&r(0,s=l.dark),"$$scope"in l&&r(1,i=l.$$scope)},[s,i,n]}class $i extends C{constructor(e){super(),R(this,e,bi,wi,N,{dark:0},Ii)}}function Bi(t){let e;const r=t[1].default,n=J(r,t,t[2],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&4)&&V(n,r,i,i[2],e?x(r,i[2],s,null):q(i[2]),null)},i(i){e||(a(n,i),e=!0)},o(i){f(n,i),e=!1},d(i){n&&n.d(i)}}}function ki(t){let e,r;return e=new Ei({props:{$$slots:{default:[yi]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&4&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function yi(t){let e;const r=t[1].default,n=J(r,t,t[2],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&4)&&V(n,r,i,i[2],e?x(r,i[2],s,null):q(i[2]),null)},i(i){e||(a(n,i),e=!0)},o(i){f(n,i),e=!1},d(i){n&&n.d(i)}}}function Di(t){let e,r,n,i;const s=[ki,Bi],l=[];function o(c,u){return c[0]?0:1}return e=o(t),r=l[e]=s[e](t),{c(){r.c(),n=ee()},m(c,u){l[e].m(c,u),A(c,n,u),i=!0},p(c,[u]){let _=e;e=o(c),e===_?l[e].p(c,u):(F(),f(l[_],1,1,()=>{l[_]=null}),G(),r=l[e],r?r.p(c,u):(r=l[e]=s[e](c),r.c()),a(r,1),r.m(n.parentNode,n))},i(c){i||(a(r),i=!0)},o(c){f(r),i=!1},d(c){c&&m(n),l[e].d(c)}}}function vi(t,e,r){let{$$slots:n={},$$scope:i}=e,{condition:s=!1}=e;return t.$$set=l=>{"condition"in l&&r(0,s=l.condition),"$$scope"in l&&r(2,i=l.$$scope)},[s,n,i]}class Qi extends C{constructor(e){super(),R(this,e,vi,Di,N,{condition:0})}}function dt(t){let e,r;return e=new Ai({props:{brandingInfo:t[2]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&4&&(s.brandingInfo=n[2]),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Mi(t){let e,r,n=t[1]&&dt(t);const i=t[3].default,s=J(i,t,t[4],null);return{c(){n&&n.c(),e=P(),s&&s.c()},m(l,o){n&&n.m(l,o),A(l,e,o),s&&s.m(l,o),r=!0},p(l,o){l[1]?n?(n.p(l,o),o&2&&a(n,1)):(n=dt(l),n.c(),a(n,1),n.m(e.parentNode,e)):n&&(F(),f(n,1,1,()=>{n=null}),G()),s&&s.p&&(!r||o&16)&&V(s,i,l,l[4],r?x(i,l[4],o,null):q(l[4]),null)},i(l){r||(a(n),a(s,l),r=!0)},o(l){f(n),f(s,l),r=!1},d(l){l&&m(e),n&&n.d(l),s&&s.d(l)}}}function Ti(t){let e,r;return e=new $i({props:{dark:t[0],$$slots:{default:[Mi]},$$scope:{ctx:t}}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&1&&(s.dark=n[0]),i&22&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Pi(t,e,r){let{$$slots:n={},$$scope:i}=e,{dark:s=!1}=e,{showHeader:l=!1}=e,{brandingInfo:o=null}=e;return t.$$set=c=>{"dark"in c&&r(0,s=c.dark),"showHeader"in c&&r(1,l=c.showHeader),"brandingInfo"in c&&r(2,o=c.brandingInfo),"$$scope"in c&&r(4,i=c.$$scope)},[s,l,o,n,i]}class mt extends C{constructor(e){super(),R(this,e,Pi,Ti,N,{dark:0,showHeader:1,brandingInfo:2})}}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))(Ee||{});class Pe{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.";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."}}static getErrorCodeForBackendErrorCode(e){switch(e){case 7101:return 2;case 7102:return 7;case 7103:return 8;case 7107:case 7224:case 7225:return 11;case 7105:case 7106:return 4;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}}static convertCodeToBackendErrorCode(e){return e in gt?e:null}static convertPurchaseFlowErrorCodeToErrorCode(e){switch(e){case O.ErrorSettingUpPurchase:return 2;case O.ErrorChargingPayment:return 20;case O.NetworkError:return 10;case O.MissingEmailError:return 4;case O.StripeError:return 2;case O.UnknownError:return 0}}}var gt=(t=>(t[t.BackendInvalidPlatform=7e3]="BackendInvalidPlatform",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))(gt||{});class Z extends Error{constructor(r,n,i){super(n);Q(this,"toString",()=>`PurchasesError(code: ${Ee[this.errorCode]}, message: ${this.message})`);this.errorCode=r,this.underlyingErrorMessage=i}static getForBackendError(r,n){const i=Pe.getErrorCodeForBackendErrorCode(r);return new Z(i,Pe.getPublicMessage(i),n)}static getForPurchasesFlowError(r){return new Z(Pe.convertPurchaseFlowErrorCodeToErrorCode(r.errorCode),r.message,r.underlyingErrorMessage)}}class At extends Error{constructor(){super("Purchases must be configured before calling getInstance")}}const Ui="0.0.10",ce="https://api.revenuecat.com";var Ue;(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"})(Ue||(Ue={}));function _t(t){return t?t.startsWith("rcb_sb_"):!1}async function ae(t,e,r,n){const i=await fetch(t.url(),{method:t.method,headers:Ci(e,n),body:Ri(r)});return await Ni(i,t),await i.json()}async function Ni(t,e){const r=t.status;if(r>=Ue.INTERNAL_SERVER_ERROR)Ge(e,r,await t.text());else if(r>=Ue.BAD_REQUEST){const n=await t.json(),i=n?JSON.stringify(n):null,s=n==null?void 0:n.code,l=n==null?void 0:n.message;if(s!=null){const o=Pe.convertCodeToBackendErrorCode(s);if(o==null)Ge(e,r,i);else throw Z.getForBackendError(o,l)}else Ge(e,r,i)}}function Ge(t,e,r){throw new Z(Ee.UnknownBackendError,`Unknown backend error. Request: ${t.name}. Status code: ${e}. Body: ${r}.`)}function Ri(t){return t==null?null:JSON.stringify(t)}function Ci(t,e){let r={Authorization:`Bearer ${t}`,"Content-Type":"application/json",Accept:"application/json","X-Platform":"web","X-Version":Ui,"X-Is-Sandbox":`${_t(t)}`};return e!=null&&(r={...r,...e}),r}const pt="/v1/subscribers",Ne="/rcbilling/v1";class Si{constructor(e){Q(this,"appUserId");Q(this,"method","GET");Q(this,"name","getOfferings");this.appUserId=e}url(){return`${ce}${pt}/${this.appUserId}/offerings`}}class Oi{constructor(){Q(this,"method","POST");Q(this,"name","subscribe")}url(){return`${ce}${Ne}/subscribe`}}class Li{constructor(e,r){Q(this,"method","GET");Q(this,"name","getProducts");Q(this,"appUserId");Q(this,"productIds");this.appUserId=e,this.productIds=r}url(){return`${ce}${Ne}/subscribers/${this.appUserId}/products?id=${this.productIds.join("&id=")}`}}class Fi{constructor(e){Q(this,"method","GET");Q(this,"name","getCustomerInfo");Q(this,"appUserId");this.appUserId=e}url(){return`${ce}${pt}/${this.appUserId}`}}class Gi{constructor(){Q(this,"method","GET");Q(this,"name","getBrandingInfo")}url(){return`${ce}${Ne}/branding`}}class Yi{constructor(e){Q(this,"method","GET");Q(this,"name","getCheckoutStatus");Q(this,"operationSessionId");this.operationSessionId=e}url(){return`${ce}${Ne}/checkout/${this.operationSessionId}`}}class Hi{constructor(e){Q(this,"API_KEY");this.API_KEY=e}async getOfferings(e){return await ae(new Si(e),this.API_KEY)}async getCustomerInfo(e){return await ae(new Fi(e),this.API_KEY)}async getProducts(e,r){return await ae(new Li(e,r),this.API_KEY)}async getBrandingInfo(){return await ae(new Gi,this.API_KEY)}async postSubscribe(e,r,n){return await ae(new Oi,this.API_KEY,{app_user_id:e,product_id:r,email:n})}async getCheckoutStatus(e){return await ae(new Yi(e),this.API_KEY)}}function Ki(t){S(t,"svelte-ofxzf4",`.rcb-ui-container.svelte-ofxzf4{color-scheme:none;font-family:"PP Object Sans",
1
+ (function(F,j){typeof exports=="object"&&typeof module<"u"?j(exports):typeof define=="function"&&define.amd?define(["exports"],j):(F=typeof globalThis<"u"?globalThis:F||self,j(F.Purchases={}))})(this,function(F){"use strict";var gs=Object.defineProperty;var As=(F,j,Z)=>j in F?gs(F,j,{enumerable:!0,configurable:!0,writable:!0,value:Z}):F[j]=Z;var v=(F,j,Z)=>(As(F,typeof j!="symbol"?j+"":j,Z),Z);function j(t){return t!=null}var Z=(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))(Z||{});const Rt=(t,e)=>({identifier:t.identifier,displayName:t.title,currentPrice:t.current_price,normalPeriodDuration:t.normal_period_duration,presentedOfferingIdentifier:e}),Ut=(t,e,r)=>{const n=r[e.platform_product_identifier];return n===void 0?null:{identifier:e.identifier,rcBillingProduct:Rt(n,t),packageType:Ct(e.identifier)}},Ve=(t,e)=>{const r=t.packages.map(i=>Ut(t.identifier,i,e)).filter(j),n={};for(const i of r)i!=null&&(n[i.identifier]=i);return r.length==0?null:{identifier:t.identifier,serverDescription:t.description,metadata:t.metadata,packagesById:n,availablePackages:r,lifetime:n.$rc_lifetime??null,annual:n.$rc_annual??null,sixMonth:n.$rc_six_month??null,threeMonth:n.$rc_three_month??null,twoMonth:n.$rc_two_month??null,monthly:n.$rc_monthly??null,weekly:n.$rc_weekly??null}};function Ct(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 y(){}function St(t,e){for(const r in e)t[r]=e[r];return t}function xe(t){return t()}function We(){return Object.create(null)}function me(t){t.forEach(xe)}function re(t){return typeof t=="function"}function R(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let ke;function X(t,e){return t===e?!0:(ke||(ke=document.createElement("a")),ke.href=e,t===ke.href)}function qe(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function Ot(t,e){const r=qe(t.srcset),n=qe(e||"");return n.length===r.length&&n.every(([i,s],l)=>s===r[l][1]&&(X(r[l][0],i)||X(i,r[l][0])))}function Lt(t){return Object.keys(t).length===0}function x(t,e,r,n){if(t){const i=ze(t,e,r,n);return t[0](i)}}function ze(t,e,r,n){return t[1]&&n?St(r.ctx.slice(),t[1](n(e))):r.ctx}function W(t,e,r,n){if(t[2]&&n){const i=t[2](n(r));if(e.dirty===void 0)return i;if(typeof i=="object"){const s=[],l=Math.max(e.dirty.length,i.length);for(let o=0;o<l;o+=1)s[o]=e.dirty[o]|i[o];return s}return e.dirty|i}return e.dirty}function q(t,e,r,n,i,s){if(i){const l=ze(e,r,n,s);t.p(l,i)}}function z(t){if(t.ctx.length>32){const e=[],r=t.ctx.length/32;for(let n=0;n<r;n++)e[n]=-1;return e}return-1}function ge(t){return t??""}function M(t,e){t.appendChild(e)}function S(t,e,r){const n=Ft(t);if(!n.getElementById(e)){const i=$("style");i.id=e,i.textContent=r,Gt(n,i)}}function Ft(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function Gt(t,e){return M(t.head||t,e),e.sheet}function g(t,e,r){t.insertBefore(e,r||null)}function m(t){t.parentNode&&t.parentNode.removeChild(t)}function $(t){return document.createElement(t)}function L(t){return document.createTextNode(t)}function T(){return L(" ")}function ie(){return L("")}function Ae(t,e,r,n){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r,n)}function Xe(t){return function(e){return e.preventDefault(),t.call(this,e)}}function h(t,e,r){r==null?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}const Yt=["width","height"];function Ht(t,e){const r=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:r[n]&&r[n].set&&Yt.indexOf(n)===-1?t[n]=e[n]:h(t,n,e[n])}function Kt(t,e){Object.keys(e).forEach(r=>{jt(t,r,e[r])})}function jt(t,e,r){const n=e.toLowerCase();n in t?t[n]=typeof t[n]=="boolean"&&r===""?!0:r:e in t?t[e]=typeof t[e]=="boolean"&&r===""?!0:r:h(t,e,r)}function Jt(t){return/-/.test(t)?Kt:Ht}function Vt(t){return Array.from(t.childNodes)}function le(t,e){e=""+e,t.data!==e&&(t.data=e)}function Ze(t,e){t.value=e??""}function xt(t,e,{bubbles:r=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:r,cancelable:n})}let _e;function pe(t){_e=t}function Be(){if(!_e)throw new Error("Function called outside component initialization");return _e}function ye(t){Be().$$.on_mount.push(t)}function Wt(){const t=Be();return(e,r,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const s=xt(e,r,{cancelable:n});return i.slice().forEach(l=>{l.call(t,s)}),!s.defaultPrevented}return!0}}function qt(t,e){return Be().$$.context.set(t,e),e}function zt(t){return Be().$$.context.get(t)}function et(t,e){const r=t.$$.callbacks[e.type];r&&r.slice().forEach(n=>n.call(this,e))}const oe=[],De=[];let ce=[];const Le=[],Xt=Promise.resolve();let Fe=!1;function Zt(){Fe||(Fe=!0,Xt.then(tt))}function Ge(t){ce.push(t)}function en(t){Le.push(t)}const Ye=new Set;let ae=0;function tt(){if(ae!==0)return;const t=_e;do{try{for(;ae<oe.length;){const e=oe[ae];ae++,pe(e),tn(e.$$)}}catch(e){throw oe.length=0,ae=0,e}for(pe(null),oe.length=0,ae=0;De.length;)De.pop()();for(let e=0;e<ce.length;e+=1){const r=ce[e];Ye.has(r)||(Ye.add(r),r())}ce.length=0}while(oe.length);for(;Le.length;)Le.pop()();Fe=!1,Ye.clear(),pe(t)}function tn(t){if(t.fragment!==null){t.update(),me(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(Ge)}}function nn(t){const e=[],r=[];ce.forEach(n=>t.indexOf(n)===-1?e.push(n):r.push(n)),r.forEach(n=>n()),ce=e}const ve=new Set;let se;function G(){se={r:0,c:[],p:se}}function Y(){se.r||me(se.c),se=se.p}function a(t,e){t&&t.i&&(ve.delete(t),t.i(e))}function f(t,e,r,n){if(t&&t.o){if(ve.has(t))return;ve.add(t),se.c.push(()=>{ve.delete(t),n&&(r&&t.d(1),n())}),t.o(e)}else n&&n()}function rn(t,e,r){const n=t.$$.props[e];n!==void 0&&(t.$$.bound[n]=r,r(t.$$.ctx[n]))}function w(t){t&&t.c()}function E(t,e,r){const{fragment:n,after_update:i}=t.$$;n&&n.m(e,r),Ge(()=>{const s=t.$$.on_mount.map(xe).filter(re);t.$$.on_destroy?t.$$.on_destroy.push(...s):me(s),t.$$.on_mount=[]}),i.forEach(Ge)}function I(t,e){const r=t.$$;r.fragment!==null&&(nn(r.after_update),me(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function sn(t,e){t.$$.dirty[0]===-1&&(oe.push(t),Zt(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function U(t,e,r,n,i,s,l=null,o=[-1]){const c=_e;pe(t);const u=t.$$={fragment:null,ctx:[],props:s,update:y,not_equal:i,bound:We(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:We(),dirty:o,skip_bound:!1,root:e.target||c.$$.root};l&&l(u.root);let _=!1;if(u.ctx=r?r(t,e.props||{},(A,k,...B)=>{const b=B.length?B[0]:k;return u.ctx&&i(u.ctx[A],u.ctx[A]=b)&&(!u.skip_bound&&u.bound[A]&&u.bound[A](b),_&&sn(t,A)),k}):[],u.update(),_=!0,me(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const A=Vt(e.target);u.fragment&&u.fragment.l(A),A.forEach(m)}else u.fragment&&u.fragment.c();e.intro&&a(t.$$.fragment),E(t,e.target,e.anchor),tt()}pe(c)}class C{constructor(){v(this,"$$");v(this,"$$set")}$destroy(){I(this,1),this.$destroy=y}$on(e,r){if(!re(r))return y;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(r),()=>{const i=n.indexOf(r);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!Lt(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const ln="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(ln);function on(t){S(t,"svelte-8uc6s0","aside.svelte-8uc6s0{color:yellowgreen;font-weight:bold;text-transform:uppercase;padding:0.5rem 0;width:100%;font-size:0.75rem;border-radius:0.5rem}")}function cn(t){let e;return{c(){e=$("aside"),e.innerHTML="<span>Sandbox Mode</span>",h(e,"class","svelte-8uc6s0")},m(r,n){g(r,e,n)},p:y,i:y,o:y,d(r){r&&m(e)}}}class an extends C{constructor(e){super(),U(this,e,null,cn,R,{},on)}}function un(t){S(t,"svelte-ujomz3",".rcb-modal-section.svelte-ujomz3{padding:0.5rem 0rem;display:flex}.rcb-modal-section.svelte-ujomz3:last-of-type{padding:0}")}function He(t){let e,r;const n=t[2].default,i=x(n,t,t[1],null);return{c(){e=$(t[0]),i&&i.c(),Jt(t[0])(e,{class:ge("rcb-modal-section")+" svelte-ujomz3"})},m(s,l){g(s,e,l),i&&i.m(e,null),r=!0},p(s,l){i&&i.p&&(!r||l&2)&&q(i,n,s,s[1],r?W(n,s[1],l,null):z(s[1]),null)},i(s){r||(a(i,s),r=!0)},o(s){f(i,s),r=!1},d(s){s&&m(e),i&&i.d(s)}}}function fn(t){let e=t[0],r,n,i=t[0]&&He(t);return{c(){i&&i.c(),r=ie()},m(s,l){i&&i.m(s,l),g(s,r,l),n=!0},p(s,[l]){s[0]?e?R(e,s[0])?(i.d(1),i=He(s),e=s[0],i.c(),i.m(r.parentNode,r)):i.p(s,l):(i=He(s),e=s[0],i.c(),i.m(r.parentNode,r)):e&&(i.d(1),i=null,e=s[0])},i(s){n||(a(i,s),n=!0)},o(s){f(i,s),n=!1},d(s){s&&m(r),i&&i.d(s)}}}function dn(t,e,r){let{$$slots:n={},$$scope:i}=e,{as:s="section"}=e;return t.$$set=l=>{"as"in l&&r(0,s=l.as),"$$scope"in l&&r(1,i=l.$$scope)},[s,i,n]}class ee extends C{constructor(e){super(),U(this,e,dn,fn,R,{as:0},un)}}var H=(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))(H||{});class J{static setLogLevel(e){this.logLevel=e}static log(e,r=this.logLevel){const n=`[Purchases] ${e}`;if(!(this.logLevel<r||r===H.Silent))switch(r){case H.Error:console.error(n);break;case H.Warn:console.warn(n);break;case H.Info:console.info(n);break;case H.Debug:console.debug(n);break;case H.Verbose:console.debug(n);break}}static errorLog(e){this.log(e,H.Error)}static warnLog(e){this.log(e,H.Warn)}static infoLog(e){this.log(e,H.Info)}static debugLog(e){this.log(e,H.Debug)}static verboseLog(e){this.log(e,H.Verbose)}}v(J,"logLevel",H.Silent);var he=(t=>(t.Year="year",t.Month="month",t.Week="week",t.Day="day",t))(he||{});function mn(t){const e=t.match(/^PT?([0-9]+)([MDYW])$/);if(!e||e.length<3)return J.errorLog(`Invalid ISO 8601 duration format: ${t}`),null;const r=parseInt(e[1]);switch(e[2]){case"Y":return{number:r,unit:"year"};case"M":return{number:r,unit:"month"};case"W":return{number:r,unit:"week"};case"D":return{number:r,unit:"day"};default:return J.errorLog(`Invalid ISO 8601 unit duration format: ${t}`),null}}const nt=(t,e)=>{const r=t/100;return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).format(r)},rt=t=>{const e=mn(t);if(!e)return"unknown";const r=e.number;if(r===1)switch(e.unit){case he.Year:return"yearly";case he.Month:return"monthly";case he.Week:return"weekly";case he.Day:return"daily"}else return`every ${r} ${e.unit}s`};function gn(t){S(t,"svelte-1oa6nu8",".rcb-pricing-info.svelte-1oa6nu8{display:flex;flex-direction:column;height:10rem;justify-content:flex-end}.rcb-product-price.svelte-1oa6nu8{font-size:1.5rem}.rcb-product-duration.svelte-1oa6nu8{opacity:0.6}")}function An(t){let e,r,n=t[0].displayName+"",i,s,l,o=t[0].currentPrice.currency+"",c,u=" ",_,A=nt(t[0].currentPrice.amount,t[0].currentPrice.currency)+"",k,B,b,D,P=rt(t[0].normalPeriodDuration)+"",N;return{c(){e=$("div"),r=$("span"),i=L(n),s=T(),l=$("span"),c=L(o),_=L(u),k=L(A),B=T(),b=$("span"),D=L("Billed "),N=L(P),h(l,"class","rcb-product-price svelte-1oa6nu8"),h(b,"class","rcb-product-duration svelte-1oa6nu8"),h(e,"class","rcb-pricing-info svelte-1oa6nu8")},m(d,p){g(d,e,p),M(e,r),M(r,i),M(e,s),M(e,l),M(l,c),M(l,_),M(l,k),M(e,B),M(e,b),M(b,D),M(b,N)},p(d,p){p&1&&n!==(n=d[0].displayName+"")&&le(i,n),p&1&&o!==(o=d[0].currentPrice.currency+"")&&le(c,o),p&1&&A!==(A=nt(d[0].currentPrice.amount,d[0].currentPrice.currency)+"")&&le(k,A),p&1&&P!==(P=rt(d[0].normalPeriodDuration)+"")&&le(N,P)},d(d){d&&m(e)}}}function _n(t){let e,r;return e=new ee({props:{$$slots:{default:[An]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&3&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function pn(t,e,r){let{productDetails:n}=e;return t.$$set=i=>{"productDetails"in i&&r(0,n=i.productDetails)},[n]}class it extends C{constructor(e){super(),U(this,e,pn,_n,R,{productDetails:0},gn)}}const hn="data:image/gif;base64,R0lGODlhMgAyAPcBAAAAAAD/AAMDAwcHBxERERUVFSoqKi0tLTAwMDg4OD09PURERElJSUtLS1BQUFJSUlVVVVdXV1paWl9fX2NjY2ZmZmlpaWxsbG1tbXNzc3t7e39/f4GBgYKCgoSEhIaGhoeHh4iIiIuLi5KSkpSUlJaWlp2dnaGhoaOjo6SkpKWlpaenp6ioqKqqqqurq6ysrLCwsLGxsbS0tLa2tri4uLm5ub29vb6+vsDAwMHBwcLCwsXFxcjIyMnJyc3Nzc7OztPT09TU1NXV1dfX19nZ2dra2tvb29zc3N7e3uDg4OHh4eLi4uPj4+fn5+np6ezs7O7u7vDw8PHx8fLy8vPz8/X19fb29vj4+Pn5+fz8/P39/f7+/v///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////yH/C05FVFNDQVBFMi4wAwEAAAAh+QQFBAABACwAAAAAMgAyAIcAAAAA/wADAwMHBwcREREVFRUqKiotLS0wMDA4ODg9PT1ERERJSUlLS0tQUFBSUlJVVVVXV1daWlpfX19jY2NmZmZpaWlsbGxtbW1zc3N7e3t/f3+BgYGCgoKEhISGhoaHh4eIiIiLi4uSkpKUlJSWlpadnZ2hoaGjo6OkpKSlpaWnp6eoqKiqqqqrq6usrKywsLCxsbG0tLS2tra4uLi5ubm9vb2+vr7AwMDBwcHCwsLFxcXIyMjJycnNzc3Ozs7T09PU1NTV1dXX19fZ2dna2trb29vc3Nze3t7g4ODh4eHi4uLj4+Pn5+fp6ens7Ozu7u7w8PDx8fHy8vLz8/P19fX29vb4+Pj5+fn8/Pz9/f3+/v7///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8I/wCzcBFIcKDBgggPKkzIcCEXLlq4bIEokeLEiBcrYrTIcaNHjRobinQ4sqRCkBlTdtR44MBKlR9TmjQJQMBMkgZfdpwSMS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GGDCAQsaHVY8csAAD4MjSX4w8MDgRpIBoCQwsKIgQpwBUBxIULEHkYcUUC580tDEE6AGbXSYKKMKVIJSUnDQIGIHl6sQS0w8AZagjxAsyqpdy7at24pJfgwBMkQukCRQjQQBIgTIXiFGoAYEACH5BAUFAAEALAMAAwAXABcAAAiVAAMIHEiwoMEMGQwqXPggwsKBTLQshPDgYYAaD1owdPjQB4QIThRGgGAxwIYIIBQ2LMlkJBCDFEsGOPEgA5aCK0tKmQChRkGEMgPIiDDhoRYjTR56CPGwiooXN6oENQikhYsWP65MJXglx4sVMoZsJdikRosWOMYSRPJih9q3cOPKnWuRSxa7eO9O3cJFCxe+frdMDQgAIfkEBQUAAQAsBQADACAAEAAACKYAAwgcSLAgwQcODCpcyNDAAYYQAzhpaIDhFYY+NOBY6HAhkyETFRLZ0CGKQgMVDV4RAoQKQxMdUpx8aJAJECYQnWzYcMQgSoNVgAy5CHGGhhI+aRIkMgRnxCohNvQoiLDgEyFDskQUuINDiK1Hfpgc+ETKQi0nVGxNkkSrwCw/hiBxu7XuFidAhARpgqWu3yxIhgApEtLvVipIgARBYthvlKaNFQYEADs=";function En(t){let e,r;return{c(){e=$("img"),X(e.src,r=hn)||h(e,"src",r),h(e,"alt","spinner")},m(n,i){g(n,e,i)},p:y,i:y,o:y,d(n){n&&m(e)}}}class In extends C{constructor(e){super(),U(this,e,null,En,R,{})}}function wn(t){S(t,"svelte-4wmtg7",".rcb-modal-loader.svelte-4wmtg7{width:100%;min-height:10rem;display:flex;justify-content:center;align-items:center}")}function bn(t){let e,r,n;return r=new In({}),{c(){e=$("div"),w(r.$$.fragment),h(e,"class","rcb-modal-loader svelte-4wmtg7")},m(i,s){g(i,e,s),E(r,e,null),n=!0},p:y,i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&m(e),I(r)}}}class Qe extends C{constructor(e){super(),U(this,e,null,bn,R,{},wn)}}var Ee=(t=>(t.Started="started",t.InProgress="in_progress",t.Succeeded="succeeded",t.Failed="failed",t))(Ee||{}),Me=(t=>(t[t.SetupIntentCreationFailed=1]="SetupIntentCreationFailed",t[t.PaymentMethodCreationFailed=2]="PaymentMethodCreationFailed",t[t.PaymentChargeFailed=3]="PaymentChargeFailed",t))(Me||{}),O=(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))(O||{});class K extends Error{constructor(e,r,n){super(r),this.errorCode=e,this.underlyingErrorMessage=n}}class $n{constructor(e,r=10){v(this,"operationSessionId",null);v(this,"backend");v(this,"maxNumberAttempts");v(this,"waitMSBetweenAttempts",1e3);this.backend=e,this.maxNumberAttempts=r}async startPurchase(e,r,n){const i=await this.backend.postSubscribe(e,r,n);return this.operationSessionId=i.operation_session_id,i}async pollCurrentPurchaseForCompletion(){const e=this.operationSessionId;if(!e)throw new K(0,"No purchase in progress");return new Promise((r,n)=>{const i=(s=1)=>{if(s>this.maxNumberAttempts){this.clearPurchaseInProgress(),n(new K(2,"Max attempts reached trying to get successful purchase status"));return}this.backend.getCheckoutStatus(e).then(l=>{switch(l.operation.status){case Ee.Started:case Ee.InProgress:setTimeout(()=>i(s+1),this.waitMSBetweenAttempts);break;case Ee.Succeeded:this.clearPurchaseInProgress(),r();return;case Ee.Failed:this.clearPurchaseInProgress(),this.handlePaymentError(l.operation.error,n)}}).catch(l=>{n(new K(3,l.message))})};i()})}clearPurchaseInProgress(){this.operationSessionId=null}handlePaymentError(e,r){if(e==null){r(new K(2,"Got an error status but error field is empty."));return}switch(e.code){case Me.SetupIntentCreationFailed:r(new K(0,"Setup intent creation failed"));return;case Me.PaymentMethodCreationFailed:r(new K(0,"Payment method creation failed"));return;case Me.PaymentChargeFailed:r(new K(1,"Payment charge failed"));return}}}function kn(t){S(t,"svelte-igat39","button.svelte-igat39{border:none;border-radius:3.5rem;font-size:1rem;cursor:pointer;height:3.5rem;color:black;background-color:#dfdfdf}button.intent-primary.svelte-igat39{background-color:#000;color:white;font-size:1rem}")}function Bn(t){let e,r,n,i,s;const l=t[3].default,o=x(l,t,t[2],null);return{c(){e=$("button"),o&&o.c(),h(e,"class",r=ge(`intent-${t[0]}`)+" svelte-igat39"),e.disabled=t[1]},m(c,u){g(c,e,u),o&&o.m(e,null),n=!0,i||(s=Ae(e,"click",t[4]),i=!0)},p(c,[u]){o&&o.p&&(!n||u&4)&&q(o,l,c,c[2],n?W(l,c[2],u,null):z(c[2]),null),(!n||u&1&&r!==(r=ge(`intent-${c[0]}`)+" svelte-igat39"))&&h(e,"class",r),(!n||u&2)&&(e.disabled=c[1])},i(c){n||(a(o,c),n=!0)},o(c){f(o,c),n=!1},d(c){c&&m(e),o&&o.d(c),i=!1,s()}}}function yn(t,e,r){let{$$slots:n={},$$scope:i}=e,{intent:s="primary"}=e,{disabled:l=!1}=e;function o(c){et.call(this,t,c)}return t.$$set=c=>{"intent"in c&&r(0,s=c.intent),"disabled"in c&&r(1,l=c.disabled),"$$scope"in c&&r(2,i=c.$$scope)},[s,l,i,n,o]}class ue extends C{constructor(e){super(),U(this,e,yn,Bn,R,{intent:0,disabled:1},kn)}}function Dn(t){S(t,"svelte-1f9z0o8","footer.svelte-1f9z0o8{display:flex;flex-direction:column}")}function vn(t){let e,r;const n=t[1].default,i=x(n,t,t[0],null);return{c(){e=$("footer"),i&&i.c(),h(e,"class","rcb-modal-footer svelte-1f9z0o8")},m(s,l){g(s,e,l),i&&i.m(e,null),r=!0},p(s,[l]){i&&i.p&&(!r||l&1)&&q(i,n,s,s[0],r?W(n,s[0],l,null):z(s[0]),null)},i(s){r||(a(i,s),r=!0)},o(s){f(i,s),r=!1},d(s){s&&m(e),i&&i.d(s)}}}function Qn(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=s=>{"$$scope"in s&&r(0,i=s.$$scope)},[i,n]}class Te extends C{constructor(e){super(),U(this,e,Qn,vn,R,{},Dn)}}const Mn="data:image/svg+xml,%3csvg%20width='124'%20height='124'%20viewBox='0%200%20124%20124'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='62'%20cy='62'%20r='62'%20fill='%23767676'/%3e%3cpath%20d='M87.6668%2041.504L82.4968%2036.334L62.0002%2056.8307L41.5035%2036.334L36.3335%2041.504L56.8302%2062.0006L36.3335%2082.4973L41.5035%2087.6673L62.0002%2067.1706L82.4968%2087.6673L87.6668%2082.4973L67.1702%2062.0006L87.6668%2041.504Z'%20fill='white'/%3e%3c/svg%3e";function Tn(t){S(t,"svelte-7khg4b","img.svelte-7khg4b{width:7.75rem;height:7.75rem;margin:0 auto}")}function Pn(t){let e,r;return{c(){e=$("img"),X(e.src,r=Mn)||h(e,"src",r),h(e,"alt","icon"),h(e,"class","rcb-ui-asset-icon svelte-7khg4b")},m(n,i){g(n,e,i)},p:y,i:y,o:y,d(n){n&&m(e)}}}class Nn extends C{constructor(e){super(),U(this,e,null,Pn,R,{},Tn)}}function Rn(t){S(t,"svelte-18njhoa",'.column.svelte-18njhoa{display:flex;flex-direction:column;justify-content:flex-start;gap:var(--gap, "0.5rem")}')}function Un(t){let e,r,n;const i=t[2].default,s=x(i,t,t[1],null);return{c(){e=$("div"),s&&s.c(),h(e,"class","column svelte-18njhoa"),h(e,"style",r=`--gap:${t[0]};`)},m(l,o){g(l,e,o),s&&s.m(e,null),n=!0},p(l,[o]){s&&s.p&&(!n||o&2)&&q(s,i,l,l[1],n?W(i,l[1],o,null):z(l[1]),null),(!n||o&1&&r!==(r=`--gap:${l[0]};`))&&h(e,"style",r)},i(l){n||(a(s,l),n=!0)},o(l){f(s,l),n=!1},d(l){l&&m(e),s&&s.d(l)}}}function Cn(t,e,r){let{$$slots:n={},$$scope:i}=e,{gutter:s="0.5rem"}=e;return t.$$set=l=>{"gutter"in l&&r(0,s=l.gutter),"$$scope"in l&&r(1,i=l.$$scope)},[s,i,n]}class te extends C{constructor(e){super(),U(this,e,Cn,Un,R,{gutter:0},Rn)}}const Sn="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 On(t){S(t,"svelte-r1ujja",".close-button.svelte-r1ujja{border:none;cursor:pointer;background-color:transparent}")}function Ln(t){let e,r,n,i,s;return{c(){e=$("button"),r=$("img"),X(r.src,n=Sn)||h(r,"src",n),h(r,"alt","close"),h(e,"class","close-button svelte-r1ujja"),e.disabled=t[0]},m(l,o){g(l,e,o),M(e,r),i||(s=Ae(e,"click",t[1]),i=!0)},p(l,[o]){o&1&&(e.disabled=l[0])},i:y,o:y,d(l){l&&m(e),i=!1,s()}}}function Fn(t,e,r){let{disabled:n=!1}=e;function i(s){et.call(this,t,s)}return t.$$set=s=>{"disabled"in s&&r(0,n=s.disabled)},[n,i]}class Gn extends C{constructor(e){super(),U(this,e,Fn,Ln,R,{disabled:0},On)}}function Yn(t){S(t,"svelte-10u48yl",".rcb-app-icon.svelte-10u48yl{width:2.5rem;height:2.5rem;border-radius:0.75rem;box-shadow:0px 1px 10px 0px rgba(0, 0, 0, 0.1);margin-right:1rem}.rcb-app-icon-picture-container.svelte-10u48yl{height:2.5rem}.rcb-app-icon.loading.svelte-10u48yl{background-color:gray}")}function Hn(t){let e;return{c(){e=$("div"),h(e,"class","rcb-app-icon loading svelte-10u48yl")},m(r,n){g(r,e,n)},p:y,d(r){r&&m(e)}}}function Kn(t){let e,r,n,i,s,l;return{c(){e=$("picture"),r=$("source"),i=T(),s=$("img"),h(r,"type","image/webp"),Ot(r,n=t[1])||h(r,"srcset",n),h(s,"class","rcb-app-icon svelte-10u48yl"),X(s.src,l=t[0])||h(s,"src",l),h(s,"alt","App icon"),h(e,"class","rcb-app-icon-picture-container svelte-10u48yl")},m(o,c){g(o,e,c),M(e,r),M(e,i),M(e,s)},p(o,c){c&2&&n!==(n=o[1])&&h(r,"srcset",n),c&1&&!X(s.src,l=o[0])&&h(s,"src",l)},d(o){o&&m(e)}}}function jn(t){let e;function r(s,l){return s[0]!==null?Kn:Hn}let n=r(t),i=n(t);return{c(){i.c(),e=ie()},m(s,l){i.m(s,l),g(s,e,l)},p(s,[l]){n===(n=r(s))&&i?i.p(s,l):(i.d(1),i=n(s),i&&(i.c(),i.m(e.parentNode,e)))},i:y,o:y,d(s){s&&m(e),i.d(s)}}}function Jn(t,e,r){let{src:n=null}=e,{srcWebp:i=null}=e;return t.$$set=s=>{"src"in s&&r(0,n=s.src),"srcWebp"in s&&r(1,i=s.srcWebp)},[n,i]}class st extends C{constructor(e){super(),U(this,e,Jn,jn,R,{src:0,srcWebp:1},Yn)}}const Pe=t=>`https://da08ctfrofx1b.cloudfront.net/${t}`;function Vn(t){S(t,"svelte-1tdgim9",".app-title.svelte-1tdgim9{font-weight:500;margin:0.5rem 0;font-size:1rem}.rcb-header-layout__business-info.svelte-1tdgim9{display:flex;align-items:center}")}function xn(t){let e,r;return e=new st({}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p:y,i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Wn(t){let e,r,n=t[0].seller_company_name+"",i,s,l=t[0].app_icon_webp!==null&&t[0].app_icon!==null&&lt(t);return{c(){l&&l.c(),e=T(),r=$("span"),i=L(n),h(r,"class","app-title svelte-1tdgim9")},m(o,c){l&&l.m(o,c),g(o,e,c),g(o,r,c),M(r,i),s=!0},p(o,c){o[0].app_icon_webp!==null&&o[0].app_icon!==null?l?(l.p(o,c),c&1&&a(l,1)):(l=lt(o),l.c(),a(l,1),l.m(e.parentNode,e)):l&&(G(),f(l,1,1,()=>{l=null}),Y()),(!s||c&1)&&n!==(n=o[0].seller_company_name+"")&&le(i,n)},i(o){s||(a(l),s=!0)},o(o){f(l),s=!1},d(o){o&&(m(e),m(r)),l&&l.d(o)}}}function lt(t){let e,r;return e=new st({props:{src:Pe(t[0].app_icon),srcWebp:Pe(t[0].app_icon_webp)}}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&1&&(s.src=Pe(n[0].app_icon)),i&1&&(s.srcWebp=Pe(n[0].app_icon_webp)),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function qn(t){let e,r,n,i;const s=[Wn,xn],l=[];function o(c,u){return c[0]!==null?0:1}return r=o(t),n=l[r]=s[r](t),{c(){e=$("div"),n.c(),h(e,"class","rcb-header-layout__business-info svelte-1tdgim9")},m(c,u){g(c,e,u),l[r].m(e,null),i=!0},p(c,[u]){let _=r;r=o(c),r===_?l[r].p(c,u):(G(),f(l[_],1,1,()=>{l[_]=null}),Y(),n=l[r],n?n.p(c,u):(n=l[r]=s[r](c),n.c()),a(n,1),n.m(e,null))},i(c){i||(a(n),i=!0)},o(c){f(n),i=!1},d(c){c&&m(e),l[r].d()}}}function zn(t,e,r){let{brandingInfo:n=null}=e;return t.$$set=i=>{"brandingInfo"in i&&r(0,n=i.brandingInfo)},[n]}class ot extends C{constructor(e){super(),U(this,e,zn,qn,R,{brandingInfo:0},Vn)}}function Xn(t){S(t,"svelte-j03lz1",".rcb-post-purchase-header-layout.svelte-j03lz1{display:flex;justify-content:space-between;align-items:center;width:100%}")}function Zn(t){let e,r,n,i,s;return r=new ot({props:{brandingInfo:t[0]}}),i=new Gn({}),i.$on("click",function(){re(t[1])&&t[1].apply(this,arguments)}),{c(){e=$("div"),w(r.$$.fragment),n=T(),w(i.$$.fragment),h(e,"class","rcb-post-purchase-header-layout svelte-j03lz1")},m(l,o){g(l,e,o),E(r,e,null),M(e,n),E(i,e,null),s=!0},p(l,o){t=l;const c={};o&1&&(c.brandingInfo=t[0]),r.$set(c)},i(l){s||(a(r.$$.fragment,l),a(i.$$.fragment,l),s=!0)},o(l){f(r.$$.fragment,l),f(i.$$.fragment,l),s=!1},d(l){l&&m(e),I(r),I(i)}}}function er(t){let e,r;return e=new ee({props:{as:"header",$$slots:{default:[Zn]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&7&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function tr(t,e,r){let{brandingInfo:n=null}=e,{onClose:i}=e;return t.$$set=s=>{"brandingInfo"in s&&r(0,n=s.brandingInfo),"onClose"in s&&r(1,i=s.onClose)},[n,i]}class ct extends C{constructor(e){super(),U(this,e,tr,er,R,{brandingInfo:0,onClose:1},Xn)}}function nr(t){S(t,"svelte-ahi052",".rcb-modal-error.svelte-ahi052{width:100%;min-height:10rem;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center}.title.svelte-ahi052{font-size:24px}.subtitle.svelte-ahi052{font-size:16px}")}function at(t){let e,r,n,i,s;return{c(){e=L("If this error persists, please contact "),r=$("a"),n=L(t[1]),s=L("."),h(r,"href",i="mailto:"+t[1])},m(l,o){g(l,e,o),g(l,r,o),M(r,n),g(l,s,o)},p(l,o){o&2&&le(n,l[1]),o&2&&i!==(i="mailto:"+l[1])&&h(r,"href",i)},d(l){l&&(m(e),m(r),m(s))}}}function rr(t){let e,r,n,i=t[3]()+"",s,l,o=t[1]&&at(t);return{c(){e=$("span"),e.textContent="Something went wrong.",r=T(),n=$("span"),s=L(i),l=T(),o&&o.c(),h(e,"class","title svelte-ahi052"),h(n,"class","subtitle svelte-ahi052")},m(c,u){g(c,e,u),g(c,r,u),g(c,n,u),M(n,s),M(n,l),o&&o.m(n,null)},p(c,u){c[1]?o?o.p(c,u):(o=at(c),o.c(),o.m(n,null)):o&&(o.d(1),o=null)},d(c){c&&(m(e),m(r),m(n)),o&&o.d()}}}function ir(t){let e,r,n,i;return e=new Nn({}),n=new te({props:{gutter:"1rem",$$slots:{default:[rr]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment),r=T(),w(n.$$.fragment)},m(s,l){E(e,s,l),g(s,r,l),E(n,s,l),i=!0},p(s,l){const o={};l&34&&(o.$$scope={dirty:l,ctx:s}),n.$set(o)},i(s){i||(a(e.$$.fragment,s),a(n.$$.fragment,s),i=!0)},o(s){f(e.$$.fragment,s),f(n.$$.fragment,s),i=!1},d(s){s&&m(r),I(e,s),I(n,s)}}}function sr(t){let e,r,n;return r=new te({props:{gutter:"1rem",$$slots:{default:[ir]},$$scope:{ctx:t}}}),{c(){e=$("div"),w(r.$$.fragment),h(e,"class","rcb-modal-error svelte-ahi052")},m(i,s){g(i,e,s),E(r,e,null),n=!0},p(i,s){const l={};s&34&&(l.$$scope={dirty:s,ctx:i}),r.$set(l)},i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&m(e),I(r)}}}function lr(t){let e;return{c(){e=L("Go back to app")},m(r,n){g(r,e,n)},d(r){r&&m(e)}}}function or(t){let e,r;return e=new ue({props:{$$slots:{default:[lr]},$$scope:{ctx:t}}}),e.$on("click",function(){re(t[2])&&t[2].apply(this,arguments)}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){t=n;const s={};i&32&&(s.$$scope={dirty:i,ctx:t}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function cr(t){let e,r,n,i,s,l;return e=new ct({props:{brandingInfo:t[0],onClose:t[2]}}),n=new ee({props:{$$slots:{default:[sr]},$$scope:{ctx:t}}}),s=new Te({props:{$$slots:{default:[or]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment),r=T(),w(n.$$.fragment),i=T(),w(s.$$.fragment)},m(o,c){E(e,o,c),g(o,r,c),E(n,o,c),g(o,i,c),E(s,o,c),l=!0},p(o,c){const u={};c&1&&(u.brandingInfo=o[0]),c&4&&(u.onClose=o[2]),e.$set(u);const _={};c&34&&(_.$$scope={dirty:c,ctx:o}),n.$set(_);const A={};c&36&&(A.$$scope={dirty:c,ctx:o}),s.$set(A)},i(o){l||(a(e.$$.fragment,o),a(n.$$.fragment,o),a(s.$$.fragment,o),l=!0)},o(o){f(e.$$.fragment,o),f(n.$$.fragment,o),f(s.$$.fragment,o),l=!1},d(o){o&&(m(r),m(i)),I(e,o),I(n,o),I(s,o)}}}function ar(t){let e,r;return e=new te({props:{gutter:"2rem",$$slots:{default:[cr]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&39&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function ur(t,e,r){let{brandingInfo:n=null}=e,{lastError:i}=e,{supportEmail:s=null}=e,{onContinue:l}=e;ye(()=>{J.errorLog(`Displayed error: ${O[i.errorCode]}. Message: ${i.message??"None"}. Underlying error: ${i.underlyingErrorMessage??"None"}`)});function o(){switch(i.errorCode){case O.UnknownError:return"An unknown error occurred.";case O.ErrorSettingUpPurchase:return"Purchase not started due to an error.";case O.ErrorChargingPayment:return"Payment failed.";case O.NetworkError:return"Network error. Please check your internet connection.";case O.StripeError:return i.message;case O.MissingEmailError:return"Email is required to complete the purchase."}return i.message}return t.$$set=c=>{"brandingInfo"in c&&r(0,n=c.brandingInfo),"lastError"in c&&r(4,i=c.lastError),"supportEmail"in c&&r(1,s=c.supportEmail),"onContinue"in c&&r(2,l=c.onContinue)},[n,s,l,o,i]}class fr extends C{constructor(e){super(),U(this,e,ur,ar,R,{brandingInfo:0,lastError:4,supportEmail:1,onContinue:2},nr)}}const dr="data:image/svg+xml,%3csvg%20width='124'%20height='124'%20viewBox='0%200%20124%20124'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='62'%20cy='62'%20r='62'%20fill='%23576CDB'/%3e%3crect%20x='44.1116'%20y='56'%20width='27.5'%20height='11'%20transform='rotate(45%2044.1116%2056)'%20fill='white'/%3e%3crect%20x='79.1133'%20y='44.334'%20width='11'%20height='44'%20transform='rotate(45%2079.1133%2044.334)'%20fill='white'/%3e%3c/svg%3e";function mr(t){S(t,"svelte-7khg4b","img.svelte-7khg4b{width:7.75rem;height:7.75rem;margin:0 auto}")}function gr(t){let e,r;return{c(){e=$("img"),X(e.src,r=dr)||h(e,"src",r),h(e,"alt","icon"),h(e,"class","rcb-ui-asset-icon svelte-7khg4b")},m(n,i){g(n,e,i)},p:y,i:y,o:y,d(n){n&&m(e)}}}class Ar extends C{constructor(e){super(),U(this,e,null,gr,R,{},mr)}}function _r(t){S(t,"svelte-1lcsna9",".rcb-modal-success.svelte-1lcsna9{width:100%;min-height:10rem;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center}.title.svelte-1lcsna9{font-size:24px}.subtitle.svelte-1lcsna9{font-size:16px}")}function pr(t){let e,r,n;return{c(){e=$("span"),e.textContent="Purchase Successful",r=T(),n=$("span"),n.textContent="Your plan is now active.",h(e,"class","title svelte-1lcsna9"),h(n,"class","subtitle svelte-1lcsna9")},m(i,s){g(i,e,s),g(i,r,s),g(i,n,s)},p:y,d(i){i&&(m(e),m(r),m(n))}}}function hr(t){let e,r,n,i;return e=new Ar({}),n=new te({props:{gutter:"1rem",$$slots:{default:[pr]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment),r=T(),w(n.$$.fragment)},m(s,l){E(e,s,l),g(s,r,l),E(n,s,l),i=!0},p(s,l){const o={};l&4&&(o.$$scope={dirty:l,ctx:s}),n.$set(o)},i(s){i||(a(e.$$.fragment,s),a(n.$$.fragment,s),i=!0)},o(s){f(e.$$.fragment,s),f(n.$$.fragment,s),i=!1},d(s){s&&m(r),I(e,s),I(n,s)}}}function Er(t){let e,r,n;return r=new te({props:{gutter:"1rem",$$slots:{default:[hr]},$$scope:{ctx:t}}}),{c(){e=$("div"),w(r.$$.fragment),h(e,"class","rcb-modal-success svelte-1lcsna9")},m(i,s){g(i,e,s),E(r,e,null),n=!0},p(i,s){const l={};s&4&&(l.$$scope={dirty:s,ctx:i}),r.$set(l)},i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&m(e),I(r)}}}function Ir(t){let e;return{c(){e=L("Go back to app")},m(r,n){g(r,e,n)},d(r){r&&m(e)}}}function wr(t){let e,r;return e=new ue({props:{$$slots:{default:[Ir]},$$scope:{ctx:t}}}),e.$on("click",function(){re(t[1])&&t[1].apply(this,arguments)}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){t=n;const s={};i&4&&(s.$$scope={dirty:i,ctx:t}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function br(t){let e,r,n,i,s,l;return e=new ct({props:{brandingInfo:t[0],onClose:t[1]}}),n=new ee({props:{$$slots:{default:[Er]},$$scope:{ctx:t}}}),s=new Te({props:{$$slots:{default:[wr]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment),r=T(),w(n.$$.fragment),i=T(),w(s.$$.fragment)},m(o,c){E(e,o,c),g(o,r,c),E(n,o,c),g(o,i,c),E(s,o,c),l=!0},p(o,c){const u={};c&1&&(u.brandingInfo=o[0]),c&2&&(u.onClose=o[1]),e.$set(u);const _={};c&4&&(_.$$scope={dirty:c,ctx:o}),n.$set(_);const A={};c&6&&(A.$$scope={dirty:c,ctx:o}),s.$set(A)},i(o){l||(a(e.$$.fragment,o),a(n.$$.fragment,o),a(s.$$.fragment,o),l=!0)},o(o){f(e.$$.fragment,o),f(n.$$.fragment,o),f(s.$$.fragment,o),l=!1},d(o){o&&(m(r),m(i)),I(e,o),I(n,o),I(s,o)}}}function $r(t){let e,r;return e=new te({props:{gutter:"2rem",$$slots:{default:[br]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&7&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function kr(t,e,r){let{brandingInfo:n=null}=e,{onContinue:i}=e;return t.$$set=s=>{"brandingInfo"in s&&r(0,n=s.brandingInfo),"onContinue"in s&&r(1,i=s.onContinue)},[n,i]}class Br extends C{constructor(e){super(),U(this,e,kr,$r,R,{brandingInfo:0,onContinue:1},_r)}}function yr(t,e,r,n,i={}){const s=r.create(e,i);return s.mount(t),s.on("change",l=>n("change",l)),s.on("ready",l=>n("ready",l)),s.on("focus",l=>n("focus",l)),s.on("blur",l=>n("blur",l)),s.on("escape",l=>n("escape",l)),s.on("click",l=>n("click",l)),s.on("loaderror",l=>n("loaderror",l)),s.on("loaderstart",l=>n("loaderstart",l)),s.on("networkschange",l=>n("networkschange",l)),s}const Dr=typeof window>"u";function vr(t){if(!Dr)return t.registerAppInfo({name:"svelte-stripe-js",url:"https://svelte-stripe-js.vercel.app"})}function Qr(t){let e;return{c(){e=$("div")},m(r,n){g(r,e,n),t[6](e)},p:y,i:y,o:y,d(r){r&&m(e),t[6](null)}}}function Mr(t,e,r){let n,i;const s=Wt(),{elements:l}=zt("stripe");let{options:o=void 0}=e;ye(()=>(n=yr(i,"payment",l,s,o),()=>n.destroy()));function c(){n.blur()}function u(){n.clear()}function _(){n.destroy()}function A(){n.focus()}function k(B){De[B?"unshift":"push"](()=>{i=B,r(0,i)})}return t.$$set=B=>{"options"in B&&r(1,o=B.options)},[i,o,c,u,_,A,k]}class Tr extends C{constructor(e){super(),U(this,e,Mr,Qr,R,{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 ut(t){let e;const r=t[15].default,n=x(r,t,t[14],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&16384)&&q(n,r,i,i[14],e?W(r,i[14],s,null):z(i[14]),null)},i(i){e||(a(n,i),e=!0)},o(i){f(n,i),e=!1},d(i){n&&n.d(i)}}}function Pr(t){let e,r,n=t[1]&&t[0]&&ut(t);return{c(){n&&n.c(),e=ie()},m(i,s){n&&n.m(i,s),g(i,e,s),r=!0},p(i,[s]){i[1]&&i[0]?n?(n.p(i,s),s&3&&a(n,1)):(n=ut(i),n.c(),a(n,1),n.m(e.parentNode,e)):n&&(G(),f(n,1,1,()=>{n=null}),Y())},i(i){r||(a(n),r=!0)},o(i){f(n),r=!1},d(i){i&&m(e),n&&n.d(i)}}}function Nr(t,e,r){let n,{$$slots:i={},$$scope:s}=e,{stripe:l}=e,{mode:o=void 0}=e,{theme:c="stripe"}=e,{variables:u={}}=e,{rules:_={}}=e,{labels:A="above"}=e,{loader:k="auto"}=e,{fonts:B=[]}=e,{locale:b="auto"}=e,{currency:D=void 0}=e,{amount:P=void 0}=e,{clientSecret:N=void 0}=e,{elements:d=null}=e;return t.$$set=p=>{"stripe"in p&&r(1,l=p.stripe),"mode"in p&&r(2,o=p.mode),"theme"in p&&r(3,c=p.theme),"variables"in p&&r(4,u=p.variables),"rules"in p&&r(5,_=p.rules),"labels"in p&&r(6,A=p.labels),"loader"in p&&r(7,k=p.loader),"fonts"in p&&r(8,B=p.fonts),"locale"in p&&r(9,b=p.locale),"currency"in p&&r(10,D=p.currency),"amount"in p&&r(11,P=p.amount),"clientSecret"in p&&r(12,N=p.clientSecret),"elements"in p&&r(0,d=p.elements),"$$scope"in p&&r(14,s=p.$$scope)},t.$$.update=()=>{t.$$.dirty&120&&r(13,n={theme:c,variables:u,rules:_,labels:A}),t.$$.dirty&16263&&l&&!d&&(r(0,d=l.elements({mode:o,currency:D,amount:P,appearance:n,clientSecret:N,fonts:B,loader:k,locale:b})),vr(l),qt("stripe",{stripe:l,elements:d})),t.$$.dirty&8705&&d&&d.update({appearance:n,locale:b})},[d,l,o,c,u,_,A,k,B,b,D,P,N,n,s,i]}class Rr extends C{constructor(e){super(),U(this,e,Nr,Pr,R,{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 ft="https://js.stripe.com/v3",Ur=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,dt="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",Cr=function(){for(var e=document.querySelectorAll('script[src^="'.concat(ft,'"]')),r=0;r<e.length;r++){var n=e[r];if(Ur.test(n.src))return n}return null},mt=function(e){var r=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(ft).concat(r);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},Sr=function(e,r){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"2.3.0",startTime:r})},Ie=null,Ne=null,Re=null,Or=function(e){return function(){e(new Error("Failed to load Stripe.js"))}},Lr=function(e,r){return function(){window.Stripe?e(window.Stripe):r(new Error("Stripe.js not available"))}},Fr=function(e){return Ie!==null?Ie:(Ie=new Promise(function(r,n){if(typeof window>"u"||typeof document>"u"){r(null);return}if(window.Stripe&&e&&console.warn(dt),window.Stripe){r(window.Stripe);return}try{var i=Cr();if(i&&e)console.warn(dt);else if(!i)i=mt(e);else if(i&&Re!==null&&Ne!==null){var s;i.removeEventListener("load",Re),i.removeEventListener("error",Ne),(s=i.parentNode)===null||s===void 0||s.removeChild(i),i=mt(e)}Re=Lr(r,n),Ne=Or(n),i.addEventListener("load",Re),i.addEventListener("error",Ne)}catch(l){n(l);return}}),Ie.catch(function(r){return Ie=null,Promise.reject(r)}))},Gr=function(e,r,n){if(e===null)return null;var i=e.apply(void 0,r);return Sr(i,n),i},we,gt=!1,At=function(){return we||(we=Fr(null).catch(function(e){return we=null,Promise.reject(e)}),we)};Promise.resolve().then(function(){return At()}).catch(function(t){gt||console.warn(t)});var Yr=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];gt=!0;var i=Date.now();return At().then(function(s){return Gr(s,r,i)})};function Hr(t){S(t,"svelte-1fwwzeb",".rcb-stripe-elements-container.svelte-1fwwzeb{width:100%;margin-bottom:1rem}")}function Kr(t){let e,r;return e=new Qe({}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p:y,i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function jr(t){let e,r,n,i,s,l;function o(u){t[9](u)}let c={stripe:t[2],clientSecret:t[4],loader:"always",$$slots:{default:[Zr]},$$scope:{ctx:t}};return t[1]!==void 0&&(c.elements=t[1]),r=new Rr({props:c}),De.push(()=>rn(r,"elements",o)),{c(){e=$("form"),w(r.$$.fragment)},m(u,_){g(u,e,_),E(r,e,null),i=!0,s||(l=Ae(e,"submit",Xe(t[5])),s=!0)},p(u,_){const A={};_&4&&(A.stripe=u[2]),_&2057&&(A.$$scope={dirty:_,ctx:u}),!n&&_&2&&(n=!0,A.elements=u[1],en(()=>n=!1)),r.$set(A)},i(u){i||(a(r.$$.fragment,u),i=!0)},o(u){f(r.$$.fragment,u),i=!1},d(u){u&&m(e),I(r),s=!1,l()}}}function Jr(t){let e,r,n;return r=new Tr({}),{c(){e=$("div"),w(r.$$.fragment),h(e,"class","rcb-stripe-elements-container svelte-1fwwzeb")},m(i,s){g(i,e,s),E(r,e,null),n=!0},p:y,i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&m(e),I(r)}}}function Vr(t){let e;return{c(){e=L("Pay")},m(r,n){g(r,e,n)},d(r){r&&m(e)}}}function xr(t){let e;return{c(){e=L("Processing...")},m(r,n){g(r,e,n)},d(r){r&&m(e)}}}function Wr(t){let e;function r(s,l){return s[3]?xr:Vr}let n=r(t),i=n(t);return{c(){i.c(),e=ie()},m(s,l){i.m(s,l),g(s,e,l)},p(s,l){n!==(n=r(s))&&(i.d(1),i=n(s),i&&(i.c(),i.m(e.parentNode,e)))},d(s){s&&m(e),i.d(s)}}}function qr(t){let e;return{c(){e=L("Close")},m(r,n){g(r,e,n)},d(r){r&&m(e)}}}function zr(t){let e,r,n,i;return e=new ue({props:{disabled:t[3],$$slots:{default:[Wr]},$$scope:{ctx:t}}}),n=new ue({props:{disabled:t[3],intent:"secondary",$$slots:{default:[qr]},$$scope:{ctx:t}}}),n.$on("click",function(){re(t[0])&&t[0].apply(this,arguments)}),{c(){w(e.$$.fragment),r=T(),w(n.$$.fragment)},m(s,l){E(e,s,l),g(s,r,l),E(n,s,l),i=!0},p(s,l){t=s;const o={};l&8&&(o.disabled=t[3]),l&2056&&(o.$$scope={dirty:l,ctx:t}),e.$set(o);const c={};l&8&&(c.disabled=t[3]),l&2048&&(c.$$scope={dirty:l,ctx:t}),n.$set(c)},i(s){i||(a(e.$$.fragment,s),a(n.$$.fragment,s),i=!0)},o(s){f(e.$$.fragment,s),f(n.$$.fragment,s),i=!1},d(s){s&&m(r),I(e,s),I(n,s)}}}function Xr(t){let e,r;return e=new te({props:{$$slots:{default:[zr]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&2057&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Zr(t){let e,r,n,i;return e=new ee({props:{$$slots:{default:[Jr]},$$scope:{ctx:t}}}),n=new Te({props:{$$slots:{default:[Xr]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment),r=T(),w(n.$$.fragment)},m(s,l){E(e,s,l),g(s,r,l),E(n,s,l),i=!0},p(s,l){const o={};l&2048&&(o.$$scope={dirty:l,ctx:s}),e.$set(o);const c={};l&2057&&(c.$$scope={dirty:l,ctx:s}),n.$set(c)},i(s){i||(a(e.$$.fragment,s),a(n.$$.fragment,s),i=!0)},o(s){f(e.$$.fragment,s),f(n.$$.fragment,s),i=!1},d(s){s&&m(r),I(e,s),I(n,s)}}}function ei(t){let e,r,n,i;const s=[jr,Kr],l=[];function o(c,u){return c[2]&&c[4]?0:1}return r=o(t),n=l[r]=s[r](t),{c(){e=$("div"),n.c()},m(c,u){g(c,e,u),l[r].m(e,null),i=!0},p(c,[u]){let _=r;r=o(c),r===_?l[r].p(c,u):(G(),f(l[_],1,1,()=>{l[_]=null}),Y(),n=l[r],n?n.p(c,u):(n=l[r]=s[r](c),n.c()),a(n,1),n.m(e,null))},i(c){i||(a(n),i=!0)},o(c){f(n),i=!1},d(c){c&&m(e),l[r].d()}}}function ti(t,e,r){let{onClose:n}=e,{onContinue:i}=e,{onError:s}=e,{paymentInfoCollectionMetadata:l}=e;const o=l.data.client_secret;let c=null,u,_=!1,A;ye(async()=>{const b=l.data.publishable_api_key,D=l.data.stripe_account_id;if(!b||!D)throw new Error("Stripe publishable key or account ID not found");r(2,c=await Yr(b,{stripeAccount:D}))});const k=async()=>{if(_||!c||!A)return;r(3,_=!0);const b=await c.confirmSetup({elements:A,redirect:"if_required"});b.error?(r(3,_=!1),s(new K(O.StripeError,b.error.message))):i()};function B(b){u=b,r(1,u)}return t.$$set=b=>{"onClose"in b&&r(0,n=b.onClose),"onContinue"in b&&r(6,i=b.onContinue),"onError"in b&&r(7,s=b.onError),"paymentInfoCollectionMetadata"in b&&r(8,l=b.paymentInfoCollectionMetadata)},t.$$.update=()=>{t.$$.dirty&2&&u&&u._elements.length>0&&(A=u)},[n,u,c,_,o,k,i,s,l,B]}class ni extends C{constructor(e){super(),U(this,e,ti,ei,R,{onClose:0,onContinue:6,onError:7,paymentInfoCollectionMetadata:8},Hr)}}function ri(t){S(t,"svelte-1xardyz",".form-container.svelte-1xardyz{display:flex;flex-direction:column;width:100%}.form-label.svelte-1xardyz{margin-top:0.5rem;margin-bottom:0.5rem;display:block}.form-input.svelte-1xardyz{margin-bottom:1rem}.title.svelte-1xardyz{font-size:1.5rem;margin:0;margin-bottom:0.5rem}input.svelte-1xardyz{width:94%;padding:0.5rem;border:1px solid #ccc;border-radius:0.25rem}")}function ii(t){let e;return{c(){e=$("span"),e.textContent="User authentication",h(e,"class","title svelte-1xardyz")},m(r,n){g(r,e,n)},p:y,d(r){r&&m(e)}}}function si(t){let e,r,n,i,s,l,o;return{c(){e=$("div"),r=$("div"),r.innerHTML='<label for="email">E-mail</label>',n=T(),i=$("div"),s=$("input"),h(r,"class","form-label svelte-1xardyz"),h(s,"name","email"),h(s,"placeholder","john@appleseed.com"),h(s,"class","svelte-1xardyz"),h(i,"class","form-input svelte-1xardyz"),h(e,"class","form-container svelte-1xardyz")},m(c,u){g(c,e,u),M(e,r),M(e,n),M(e,i),M(i,s),Ze(s,t[1]),l||(o=Ae(s,"input",t[4]),l=!0)},p(c,u){u&2&&s.value!==c[1]&&Ze(s,c[1])},d(c){c&&m(e),l=!1,o()}}}function li(t){let e;return{c(){e=L("Continue")},m(r,n){g(r,e,n)},d(r){r&&m(e)}}}function oi(t){let e;return{c(){e=L("Close")},m(r,n){g(r,e,n)},d(r){r&&m(e)}}}function ci(t){let e,r,n,i;return e=new ue({props:{$$slots:{default:[li]},$$scope:{ctx:t}}}),n=new ue({props:{intent:"secondary",$$slots:{default:[oi]},$$scope:{ctx:t}}}),n.$on("click",function(){re(t[0])&&t[0].apply(this,arguments)}),{c(){w(e.$$.fragment),r=T(),w(n.$$.fragment)},m(s,l){E(e,s,l),g(s,r,l),E(n,s,l),i=!0},p(s,l){t=s;const o={};l&32&&(o.$$scope={dirty:l,ctx:t}),e.$set(o);const c={};l&32&&(c.$$scope={dirty:l,ctx:t}),n.$set(c)},i(s){i||(a(e.$$.fragment,s),a(n.$$.fragment,s),i=!0)},o(s){f(e.$$.fragment,s),f(n.$$.fragment,s),i=!1},d(s){s&&m(r),I(e,s),I(n,s)}}}function ai(t){let e,r;return e=new te({props:{$$slots:{default:[ci]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&33&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function ui(t){let e,r,n,i,s,l,o,c,u,_;return n=new ee({props:{$$slots:{default:[ii]},$$scope:{ctx:t}}}),s=new ee({props:{$$slots:{default:[si]},$$scope:{ctx:t}}}),o=new Te({props:{$$slots:{default:[ai]},$$scope:{ctx:t}}}),{c(){e=$("div"),r=$("form"),w(n.$$.fragment),i=T(),w(s.$$.fragment),l=T(),w(o.$$.fragment)},m(A,k){g(A,e,k),M(e,r),E(n,r,null),M(r,i),E(s,r,null),M(r,l),E(o,r,null),c=!0,u||(_=Ae(r,"submit",Xe(t[2])),u=!0)},p(A,[k]){const B={};k&32&&(B.$$scope={dirty:k,ctx:A}),n.$set(B);const b={};k&34&&(b.$$scope={dirty:k,ctx:A}),s.$set(b);const D={};k&33&&(D.$$scope={dirty:k,ctx:A}),o.$set(D)},i(A){c||(a(n.$$.fragment,A),a(s.$$.fragment,A),a(o.$$.fragment,A),c=!0)},o(A){f(n.$$.fragment,A),f(s.$$.fragment,A),f(o.$$.fragment,A),c=!1},d(A){A&&m(e),I(n),I(s),I(o),u=!1,_()}}}function fi(t,e,r){let n,{onContinue:i}=e,{onClose:s}=e;const l=async()=>{i({email:n})};function o(){n=this.value,r(1,n)}return t.$$set=c=>{"onContinue"in c&&r(3,i=c.onContinue),"onClose"in c&&r(0,s=c.onClose)},r(1,n=""),[s,n,l,i,o]}class di extends C{constructor(e){super(),U(this,e,fi,ui,R,{onContinue:3,onClose:0},ri)}}const mi="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%20opacity='0.5'%20clip-path='url(%23clip0_344_3390)'%3e%3cpath%20d='M7%2018C5.9%2018%205.01%2018.9%205.01%2020C5.01%2021.1%205.9%2022%207%2022C8.1%2022%209%2021.1%209%2020C9%2018.9%208.1%2018%207%2018ZM1%202V4H3L6.6%2011.59L5.25%2014.04C5.09%2014.32%205%2014.65%205%2015C5%2016.1%205.9%2017%207%2017H19V15H7.42C7.28%2015%207.17%2014.89%207.17%2014.75L7.2%2014.63L8.1%2013H15.55C16.3%2013%2016.96%2012.59%2017.3%2011.97L20.88%205.48C20.96%205.34%2021%205.17%2021%205C21%204.45%2020.55%204%2020%204H5.21L4.27%202H1ZM17%2018C15.9%2018%2015.01%2018.9%2015.01%2020C15.01%2021.1%2015.9%2022%2017%2022C18.1%2022%2019%2021.1%2019%2020C19%2018.9%2018.1%2018%2017%2018Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_344_3390'%3e%3crect%20width='24'%20height='24'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e";function gi(t){let e,r;return{c(){e=$("img"),X(e.src,r=mi)||h(e,"src",r),h(e,"alt","icon"),h(e,"class","rcb-ui-asset-icon")},m(n,i){g(n,e,i)},p:y,i:y,o:y,d(n){n&&m(e)}}}class Ai extends C{constructor(e){super(),U(this,e,null,gi,R,{})}}function _i(t){S(t,"svelte-1ggdgso",".rcb-header-layout.svelte-1ggdgso{display:flex;justify-content:space-between;align-items:center;width:100%}")}function pi(t){let e,r,n,i,s;return r=new ot({props:{brandingInfo:t[0]}}),i=new Ai({}),{c(){e=$("div"),w(r.$$.fragment),n=T(),w(i.$$.fragment),h(e,"class","rcb-header-layout svelte-1ggdgso")},m(l,o){g(l,e,o),E(r,e,null),M(e,n),E(i,e,null),s=!0},p(l,o){const c={};o&1&&(c.brandingInfo=l[0]),r.$set(c)},i(l){s||(a(r.$$.fragment,l),a(i.$$.fragment,l),s=!0)},o(l){f(r.$$.fragment,l),f(i.$$.fragment,l),s=!1},d(l){l&&m(e),I(r),I(i)}}}function hi(t){let e,r;return e=new ee({props:{as:"header",$$slots:{default:[pi]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&3&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Ei(t,e,r){let{brandingInfo:n=null}=e;return t.$$set=i=>{"brandingInfo"in i&&r(0,n=i.brandingInfo)},[n]}class Ii extends C{constructor(e){super(),U(this,e,Ei,hi,R,{brandingInfo:0},_i)}}function wi(t){S(t,"svelte-17dhulw",".rcb-modal-backdrop.svelte-17dhulw{position:fixed;top:0;left:0;width:100vw;height:100vh;background-color:rgba(40, 40, 40, 0.75);display:flex;flex-direction:column;justify-content:space-around}")}function bi(t){let e,r;const n=t[1].default,i=x(n,t,t[0],null);return{c(){e=$("div"),i&&i.c(),h(e,"class","rcb-modal-backdrop svelte-17dhulw")},m(s,l){g(s,e,l),i&&i.m(e,null),r=!0},p(s,[l]){i&&i.p&&(!r||l&1)&&q(i,n,s,s[0],r?W(n,s[0],l,null):z(s[0]),null)},i(s){r||(a(i,s),r=!0)},o(s){f(i,s),r=!1},d(s){s&&m(e),i&&i.d(s)}}}function $i(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=s=>{"$$scope"in s&&r(0,i=s.$$scope)},[i,n]}class ki extends C{constructor(e){super(),U(this,e,$i,bi,R,{},wi)}}function Bi(t){S(t,"svelte-m6kocx",".rcb-modal-main.svelte-m6kocx{box-sizing:border-box;border-radius:0.5rem;background-color:#fff;color:black;max-width:40rem;min-width:30rem;overflow-y:auto;padding:2.5rem}.rcb-modal-dark.svelte-m6kocx{background-color:#000;color:#fff;max-width:30rem;min-width:20rem}@media screen and (max-width: 60rem){.rcb-modal-main.svelte-m6kocx,.rcb-modal-dark.svelte-m6kocx{max-width:40rem;min-width:90vw}}")}function yi(t){let e,r,n;const i=t[2].default,s=x(i,t,t[1],null);return{c(){e=$("main"),s&&s.c(),h(e,"class",r=ge(`rcb-modal-main ${t[0]?"rcb-modal-dark":""}`)+" svelte-m6kocx")},m(l,o){g(l,e,o),s&&s.m(e,null),n=!0},p(l,[o]){s&&s.p&&(!n||o&2)&&q(s,i,l,l[1],n?W(i,l[1],o,null):z(l[1]),null),(!n||o&1&&r!==(r=ge(`rcb-modal-main ${l[0]?"rcb-modal-dark":""}`)+" svelte-m6kocx"))&&h(e,"class",r)},i(l){n||(a(s,l),n=!0)},o(l){f(s,l),n=!1},d(l){l&&m(e),s&&s.d(l)}}}function Di(t,e,r){let{$$slots:n={},$$scope:i}=e,{dark:s=!1}=e;return t.$$set=l=>{"dark"in l&&r(0,s=l.dark),"$$scope"in l&&r(1,i=l.$$scope)},[s,i,n]}class vi extends C{constructor(e){super(),U(this,e,Di,yi,R,{dark:0},Bi)}}function Qi(t){let e;const r=t[1].default,n=x(r,t,t[2],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&4)&&q(n,r,i,i[2],e?W(r,i[2],s,null):z(i[2]),null)},i(i){e||(a(n,i),e=!0)},o(i){f(n,i),e=!1},d(i){n&&n.d(i)}}}function Mi(t){let e,r;return e=new ki({props:{$$slots:{default:[Ti]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&4&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Ti(t){let e;const r=t[1].default,n=x(r,t,t[2],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&4)&&q(n,r,i,i[2],e?W(r,i[2],s,null):z(i[2]),null)},i(i){e||(a(n,i),e=!0)},o(i){f(n,i),e=!1},d(i){n&&n.d(i)}}}function Pi(t){let e,r,n,i;const s=[Mi,Qi],l=[];function o(c,u){return c[0]?0:1}return e=o(t),r=l[e]=s[e](t),{c(){r.c(),n=ie()},m(c,u){l[e].m(c,u),g(c,n,u),i=!0},p(c,[u]){let _=e;e=o(c),e===_?l[e].p(c,u):(G(),f(l[_],1,1,()=>{l[_]=null}),Y(),r=l[e],r?r.p(c,u):(r=l[e]=s[e](c),r.c()),a(r,1),r.m(n.parentNode,n))},i(c){i||(a(r),i=!0)},o(c){f(r),i=!1},d(c){c&&m(n),l[e].d(c)}}}function Ni(t,e,r){let{$$slots:n={},$$scope:i}=e,{condition:s=!1}=e;return t.$$set=l=>{"condition"in l&&r(0,s=l.condition),"$$scope"in l&&r(2,i=l.$$scope)},[s,n,i]}class Ri extends C{constructor(e){super(),U(this,e,Ni,Pi,R,{condition:0})}}function _t(t){let e,r;return e=new Ii({props:{brandingInfo:t[2]}}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&4&&(s.brandingInfo=n[2]),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Ui(t){let e,r,n=t[1]&&_t(t);const i=t[3].default,s=x(i,t,t[4],null);return{c(){n&&n.c(),e=T(),s&&s.c()},m(l,o){n&&n.m(l,o),g(l,e,o),s&&s.m(l,o),r=!0},p(l,o){l[1]?n?(n.p(l,o),o&2&&a(n,1)):(n=_t(l),n.c(),a(n,1),n.m(e.parentNode,e)):n&&(G(),f(n,1,1,()=>{n=null}),Y()),s&&s.p&&(!r||o&16)&&q(s,i,l,l[4],r?W(i,l[4],o,null):z(l[4]),null)},i(l){r||(a(n),a(s,l),r=!0)},o(l){f(n),f(s,l),r=!1},d(l){l&&m(e),n&&n.d(l),s&&s.d(l)}}}function Ci(t){let e,r;return e=new vi({props:{dark:t[0],$$slots:{default:[Ui]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,[i]){const s={};i&1&&(s.dark=n[0]),i&22&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Si(t,e,r){let{$$slots:n={},$$scope:i}=e,{dark:s=!1}=e,{showHeader:l=!1}=e,{brandingInfo:o=null}=e;return t.$$set=c=>{"dark"in c&&r(0,s=c.dark),"showHeader"in c&&r(1,l=c.showHeader),"brandingInfo"in c&&r(2,o=c.brandingInfo),"$$scope"in c&&r(4,i=c.$$scope)},[s,l,o,n,i]}class pt extends C{constructor(e){super(),U(this,e,Si,Ci,R,{dark:0,showHeader:1,brandingInfo:2})}}var be=(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))(be||{});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.";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."}}static getErrorCodeForBackendErrorCode(e){switch(e){case 7101:return 2;case 7102:return 7;case 7103:return 8;case 7107:case 7224:case 7225:return 11;case 7105:case 7106:return 4;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}}static convertCodeToBackendErrorCode(e){return e in ht?e:null}static convertPurchaseFlowErrorCodeToErrorCode(e){switch(e){case O.ErrorSettingUpPurchase:return 2;case O.ErrorChargingPayment:return 20;case O.NetworkError:return 10;case O.MissingEmailError:return 4;case O.StripeError:return 2;case O.UnknownError:return 0}}}var ht=(t=>(t[t.BackendInvalidPlatform=7e3]="BackendInvalidPlatform",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))(ht||{});class ne extends Error{constructor(r,n,i){super(n);v(this,"toString",()=>`PurchasesError(code: ${be[this.errorCode]}, message: ${this.message})`);this.errorCode=r,this.underlyingErrorMessage=i}static getForBackendError(r,n){const i=Ue.getErrorCodeForBackendErrorCode(r);return new ne(i,Ue.getPublicMessage(i),n)}static getForPurchasesFlowError(r){return new ne(Ue.convertPurchaseFlowErrorCodeToErrorCode(r.errorCode),r.message,r.underlyingErrorMessage)}}class Et extends Error{constructor(){super("Purchases must be configured before calling getInstance")}}const Oi="0.0.10",fe="https://api.revenuecat.com";var Ce;(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"})(Ce||(Ce={}));function Ke(t){return t?t.startsWith("rcb_sb_"):!1}async function de(t,e,r,n){const i=await fetch(t.url(),{method:t.method,headers:Gi(e,n),body:Fi(r)});return await Li(i,t),await i.json()}async function Li(t,e){const r=t.status;if(r>=Ce.INTERNAL_SERVER_ERROR)je(e,r,await t.text());else if(r>=Ce.BAD_REQUEST){const n=await t.json(),i=n?JSON.stringify(n):null,s=n==null?void 0:n.code,l=n==null?void 0:n.message;if(s!=null){const o=Ue.convertCodeToBackendErrorCode(s);if(o==null)je(e,r,i);else throw ne.getForBackendError(o,l)}else je(e,r,i)}}function je(t,e,r){throw new ne(be.UnknownBackendError,`Unknown backend error. Request: ${t.name}. Status code: ${e}. Body: ${r}.`)}function Fi(t){return t==null?null:JSON.stringify(t)}function Gi(t,e){let r={Authorization:`Bearer ${t}`,"Content-Type":"application/json",Accept:"application/json","X-Platform":"web","X-Version":Oi,"X-Is-Sandbox":`${Ke(t)}`};return e!=null&&(r={...r,...e}),r}const It="/v1/subscribers",Se="/rcbilling/v1";class Yi{constructor(e){v(this,"appUserId");v(this,"method","GET");v(this,"name","getOfferings");this.appUserId=e}url(){return`${fe}${It}/${this.appUserId}/offerings`}}class Hi{constructor(){v(this,"method","POST");v(this,"name","subscribe")}url(){return`${fe}${Se}/subscribe`}}class Ki{constructor(e,r){v(this,"method","GET");v(this,"name","getProducts");v(this,"appUserId");v(this,"productIds");this.appUserId=e,this.productIds=r}url(){return`${fe}${Se}/subscribers/${this.appUserId}/products?id=${this.productIds.join("&id=")}`}}class ji{constructor(e){v(this,"method","GET");v(this,"name","getCustomerInfo");v(this,"appUserId");this.appUserId=e}url(){return`${fe}${It}/${this.appUserId}`}}class Ji{constructor(){v(this,"method","GET");v(this,"name","getBrandingInfo")}url(){return`${fe}${Se}/branding`}}class Vi{constructor(e){v(this,"method","GET");v(this,"name","getCheckoutStatus");v(this,"operationSessionId");this.operationSessionId=e}url(){return`${fe}${Se}/checkout/${this.operationSessionId}`}}class xi{constructor(e){v(this,"API_KEY");this.API_KEY=e}async getOfferings(e){return await de(new Yi(e),this.API_KEY)}async getCustomerInfo(e){return await de(new ji(e),this.API_KEY)}async getProducts(e,r){return await de(new Ki(e,r),this.API_KEY)}async getBrandingInfo(){return await de(new Ji,this.API_KEY)}async postSubscribe(e,r,n){return await de(new Hi,this.API_KEY,{app_user_id:e,product_id:r,email:n})}async getCheckoutStatus(e){return await de(new Vi(e),this.API_KEY)}}function Wi(t){S(t,"svelte-ofxzf4",`.rcb-ui-container.svelte-ofxzf4{color-scheme:none;font-family:"PP Object Sans",
2
2
  -apple-system,
3
3
  BlinkMacSystemFont,
4
4
  avenir next,
@@ -11,4 +11,6 @@
11
11
  roboto,
12
12
  noto,
13
13
  arial,
14
- sans-serif}.rcb-ui-layout.svelte-ofxzf4{display:flex;justify-content:center;align-items:flex-start}.rcb-ui-aside.svelte-ofxzf4{margin-right:1rem}@media screen and (max-width: 60rem){.rcb-ui-layout.svelte-ofxzf4{flex-direction:column;align-items:center;justify-content:flex-end;height:100%}.rcb-ui-aside.svelte-ofxzf4{margin-right:0;margin-bottom:1rem}}`)}function ht(t){let e,r,n,i=t[1].isSandbox(),s;r=new mt({props:{dark:!0,showHeader:!0,brandingInfo:t[3],$$slots:{default:[ji]},$$scope:{ctx:t}}});let l=i&&It();return{c(){e=$("div"),b(r.$$.fragment),n=P(),l&&l.c(),h(e,"class","rcb-ui-aside svelte-ofxzf4")},m(o,c){A(o,e,c),E(r,e,null),M(e,n),l&&l.m(e,null),s=!0},p(o,c){const u={};c&8&&(u.brandingInfo=o[3]),c&4194308&&(u.$$scope={dirty:c,ctx:o}),r.$set(u),c&2&&(i=o[1].isSandbox()),i?l?c&2&&a(l,1):(l=It(),l.c(),a(l,1),l.m(e,null)):l&&(F(),f(l,1,1,()=>{l=null}),G())},i(o){s||(a(r.$$.fragment,o),a(l),s=!0)},o(o){f(r.$$.fragment,o),f(l),s=!1},d(o){o&&m(e),I(r),l&&l.d()}}}function Et(t){let e,r;return e=new et({props:{productDetails:t[2]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&4&&(s.productDetails=n[2]),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function ji(t){let e,r,n=t[2]&&Et(t);return{c(){n&&n.c(),e=ee()},m(i,s){n&&n.m(i,s),A(i,e,s),r=!0},p(i,s){i[2]?n?(n.p(i,s),s&4&&a(n,1)):(n=Et(i),n.c(),a(n,1),n.m(e.parentNode,e)):n&&(F(),f(n,1,1,()=>{n=null}),G())},i(i){r||(a(n),r=!0)},o(i){f(n),r=!1},d(i){i&&m(e),n&&n.d(i)}}}function It(t){let e,r;return e=new ln({}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function wt(t){let e,r;return e=new et({props:{productDetails:t[2]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&4&&(s.productDetails=n[2]),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function bt(t){let e,r;return e=new ye({}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function $t(t){let e,r;return e=new ye({}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Bt(t){let e,r;return e=new oi({props:{onContinue:t[9]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p:y,i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function kt(t){let e,r;return e=new Zr({props:{paymentInfoCollectionMetadata:t[4],onContinue:t[9],onClose:t[8],onError:t[10]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&16&&(s.paymentInfoCollectionMetadata=n[4]),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function yt(t){let e,r;return e=new ye({}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Dt(t){var n;let e,r;return e=new cr({props:{brandingInfo:t[3],lastError:t[5]??new H(O.UnknownError,"Unknown error without state set."),supportEmail:(n=t[3])==null?void 0:n.seller_company_support_email,onContinue:t[11]}}),{c(){b(e.$$.fragment)},m(i,s){E(e,i,s),r=!0},p(i,s){var o;const l={};s&8&&(l.brandingInfo=i[3]),s&32&&(l.lastError=i[5]??new H(O.UnknownError,"Unknown error without state set.")),s&8&&(l.supportEmail=(o=i[3])==null?void 0:o.seller_company_support_email),e.$set(l)},i(i){r||(a(e.$$.fragment,i),r=!0)},o(i){f(e.$$.fragment,i),r=!1},d(i){I(e,i)}}}function vt(t){let e,r;return e=new br({props:{brandingInfo:t[3],onContinue:t[9]}}),{c(){b(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&8&&(s.brandingInfo=n[3]),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Ji(t){let e,r,n,i,s,l,o,c,u,_=t[6]==="present-offer"&&t[2]&&wt(t),g=t[6]==="present-offer"&&!t[2]&&bt(),B=t[6]==="polling-purchase-status"&&$t(),k=t[6]==="needs-auth-info"&&Bt(t),w=t[6]==="needs-payment-info"&&t[4]&&kt(t),D=t[6]==="loading"&&yt(),T=t[6]==="error"&&Dt(t),U=t[6]==="success"&&vt(t);return{c(){_&&_.c(),e=P(),g&&g.c(),r=P(),B&&B.c(),n=P(),k&&k.c(),i=P(),w&&w.c(),s=P(),D&&D.c(),l=P(),T&&T.c(),o=P(),U&&U.c(),c=ee()},m(d,p){_&&_.m(d,p),A(d,e,p),g&&g.m(d,p),A(d,r,p),B&&B.m(d,p),A(d,n,p),k&&k.m(d,p),A(d,i,p),w&&w.m(d,p),A(d,s,p),D&&D.m(d,p),A(d,l,p),T&&T.m(d,p),A(d,o,p),U&&U.m(d,p),A(d,c,p),u=!0},p(d,p){d[6]==="present-offer"&&d[2]?_?(_.p(d,p),p&68&&a(_,1)):(_=wt(d),_.c(),a(_,1),_.m(e.parentNode,e)):_&&(F(),f(_,1,1,()=>{_=null}),G()),d[6]==="present-offer"&&!d[2]?g?p&68&&a(g,1):(g=bt(),g.c(),a(g,1),g.m(r.parentNode,r)):g&&(F(),f(g,1,1,()=>{g=null}),G()),d[6]==="polling-purchase-status"?B?p&64&&a(B,1):(B=$t(),B.c(),a(B,1),B.m(n.parentNode,n)):B&&(F(),f(B,1,1,()=>{B=null}),G()),d[6]==="needs-auth-info"?k?(k.p(d,p),p&64&&a(k,1)):(k=Bt(d),k.c(),a(k,1),k.m(i.parentNode,i)):k&&(F(),f(k,1,1,()=>{k=null}),G()),d[6]==="needs-payment-info"&&d[4]?w?(w.p(d,p),p&80&&a(w,1)):(w=kt(d),w.c(),a(w,1),w.m(s.parentNode,s)):w&&(F(),f(w,1,1,()=>{w=null}),G()),d[6]==="loading"?D?p&64&&a(D,1):(D=yt(),D.c(),a(D,1),D.m(l.parentNode,l)):D&&(F(),f(D,1,1,()=>{D=null}),G()),d[6]==="error"?T?(T.p(d,p),p&64&&a(T,1)):(T=Dt(d),T.c(),a(T,1),T.m(o.parentNode,o)):T&&(F(),f(T,1,1,()=>{T=null}),G()),d[6]==="success"?U?(U.p(d,p),p&64&&a(U,1)):(U=vt(d),U.c(),a(U,1),U.m(c.parentNode,c)):U&&(F(),f(U,1,1,()=>{U=null}),G())},i(d){u||(a(_),a(g),a(B),a(k),a(w),a(D),a(T),a(U),u=!0)},o(d){f(_),f(g),f(B),f(k),f(w),f(D),f(T),f(U),u=!1},d(d){d&&(m(e),m(r),m(n),m(i),m(s),m(l),m(o),m(c)),_&&_.d(d),g&&g.d(d),B&&B.d(d),k&&k.d(d),w&&w.d(d),D&&D.d(d),T&&T.d(d),U&&U.d(d)}}}function xi(t){let e,r=t[7].includes(t[6]),n,i,s,l=r&&ht(t);return i=new mt({props:{$$slots:{default:[Ji]},$$scope:{ctx:t}}}),{c(){e=$("div"),l&&l.c(),n=P(),b(i.$$.fragment),h(e,"class","rcb-ui-layout svelte-ofxzf4")},m(o,c){A(o,e,c),l&&l.m(e,null),M(e,n),E(i,e,null),s=!0},p(o,c){c&64&&(r=o[7].includes(o[6])),r?l?(l.p(o,c),c&64&&a(l,1)):(l=ht(o),l.c(),a(l,1),l.m(e,n)):l&&(F(),f(l,1,1,()=>{l=null}),G());const u={};c&4194428&&(u.$$scope={dirty:c,ctx:o}),i.$set(u)},i(o){s||(a(l),a(i.$$.fragment,o),s=!0)},o(o){f(l),f(i.$$.fragment,o),s=!1},d(o){o&&m(e),l&&l.d(),I(i)}}}function Vi(t){let e,r,n;return r=new Qi({props:{condition:t[0],$$slots:{default:[xi]},$$scope:{ctx:t}}}),{c(){e=$("div"),b(r.$$.fragment),h(e,"class","rcb-ui-container svelte-ofxzf4")},m(i,s){A(i,e,s),E(r,e,null),n=!0},p(i,[s]){const l={};s&1&&(l.condition=i[0]),s&4194430&&(l.$$scope={dirty:s,ctx:i}),r.$set(l)},i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&m(e),I(r)}}}function qi(t,e,r){var Mt;let{asModal:n=!0}=e,{customerEmail:i}=e,{appUserId:s}=e,{rcPackage:l}=e,{onFinished:o}=e,{onError:c}=e,{onClose:u}=e,{purchases:_}=e,{backend:g}=e,{purchaseOperationHelper:B}=e,k=null,w=null,D=null,T=null;const U=((Mt=l.rcBillingProduct)==null?void 0:Mt.identifier)??null;let d="present-offer";const p=["present-offer","needs-auth-info","needs-payment-info","loading"];$e(async()=>{if(r(2,k=l.rcBillingProduct),r(3,w=await g.getBrandingInfo()),d==="present-offer"){i?Qt():r(6,d="needs-auth-info");return}});const ss=()=>{u()},Qt=()=>{if(U===null){Ie(new H(O.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}else r(6,d="loading");if(!i){Ie(new H(O.MissingEmailError));return}B.startPurchase(s,U,i).then(v=>{if(v.next_action==="collect_payment_info"){r(6,d="needs-payment-info"),r(4,D=v);return}if(v.next_action==="completed"){r(6,d="success");return}}).catch(v=>{Ie(new H(O.ErrorSettingUpPurchase,v.message,v.underlyingErrorMessage))})},ls=v=>{if(d==="needs-auth-info"){v&&r(12,i=v.email),Qt();return}if(d==="needs-payment-info"){r(6,d="polling-purchase-status"),B.pollCurrentPurchaseForCompletion().then(()=>{r(6,d="success")}).catch(cs=>{Ie(cs)});return}if(d==="success"||d==="error"){o();return}r(6,d="success")},Ie=v=>{r(5,T=v),r(6,d="error")},os=()=>{c(T??new H(O.UnknownError,"Unknown error without state set."))};return t.$$set=v=>{"asModal"in v&&r(0,n=v.asModal),"customerEmail"in v&&r(12,i=v.customerEmail),"appUserId"in v&&r(13,s=v.appUserId),"rcPackage"in v&&r(14,l=v.rcPackage),"onFinished"in v&&r(15,o=v.onFinished),"onError"in v&&r(16,c=v.onError),"onClose"in v&&r(17,u=v.onClose),"purchases"in v&&r(1,_=v.purchases),"backend"in v&&r(18,g=v.backend),"purchaseOperationHelper"in v&&r(19,B=v.purchaseOperationHelper)},[n,_,k,w,D,T,d,p,ss,ls,Ie,os,i,s,l,o,c,u,g,B]}class Wi extends C{constructor(e){super(),R(this,e,qi,Vi,N,{asModal:0,customerEmail:12,appUserId:13,rcPackage:14,onFinished:15,onError:16,onClose:17,purchases:1,backend:18,purchaseOperationHelper:19},Ki)}}function zi(t){return t.expires_date==null?!0:new Date(t.expires_date)>new Date}function Xi(t,e,r){return{identifier:t,isActive:zi(e),willRenew:ts(e,r),store:(r==null?void 0:r.store)??"unknown",originalPurchaseDate:new Date(e.purchase_date),expirationDate:Re(e.expires_date),productIdentifier:e.product_identifier,unsubscribeDetectedAt:Re(r==null?void 0:r.unsubscribe_detected_at),billingIssueDetectedAt:Re(r==null?void 0:r.billing_issues_detected_at),isSandbox:(r==null?void 0:r.is_sandbox)??!1,periodType:(r==null?void 0:r.period_type)??"normal"}}function Zi(t,e){const r={},n={};for(const i in t){const s=e[i]??null,l=Xi(i,t[i],s);r[i]=l,l.isActive&&(n[i]=l)}return{all:r,active:n}}function Re(t){return t==null?null:new Date(t)}function es(t){const e=rs(t),r=t.subscriber;return{entitlements:Zi(r.entitlements,r.subscriptions),allExpirationDatesByProduct:e,allPurchaseDatesByProduct:ns(t),activeSubscriptions:is(e),managementURL:r.management_url,requestDate:new Date(t.request_date),firstSeenDate:new Date(r.first_seen),originalPurchaseDate:Re(r.original_purchase_date),originalAppUserId:t.subscriber.original_app_user_id}}function ts(t,e){if(e==null)return!1;const r=e.store=="promotional",n=t.expires_date==null,i=e.unsubscribe_detected_at!=null,s=e.billing_issues_detected_at!=null;return!(r||n||i||s)}function ns(t){const e={};for(const r in t.subscriber.subscriptions){const n=t.subscriber.subscriptions[r];e[r]=new Date(n.purchase_date)}return e}function rs(t){const e={};for(const r in t.subscriber.subscriptions){const n=t.subscriber.subscriptions[r];n.expires_date==null?e[r]=null:e[r]=new Date(n.expires_date)}return e}function is(t){const e=new Set,r=new Date;for(const n in t){const i=t[n];(i==null||i>r)&&e.add(n)}return e}const j=class j{constructor(e,r){Q(this,"_API_KEY");Q(this,"_appUserId");Q(this,"backend");Q(this,"purchaseOperationHelper");Q(this,"toOfferings",(e,r)=>{const n=e.offerings.find(o=>o.identifier===e.current_offering_id)??null,i={};r.product_details.forEach(o=>{i[o.identifier]=o});const s=n==null?null:He(n,i),l={};return e.offerings.forEach(o=>{const c=He(o,i);c!=null&&(l[o.identifier]=c)}),Object.keys(l).length==0&&console.debug("Empty offerings. Please make sure you've configured offerings correctly in the RevenueCat dashboard and that the products are properly configured."),{all:l,current:s}});this._API_KEY=e,this._appUserId=r,this.backend=new Hi(this._API_KEY),this.purchaseOperationHelper=new In(this.backend)}static getSharedInstance(){if(j.isConfigured())return j.instance;throw new At}static isConfigured(){return j.instance!==void 0}static configure(e,r){return j.instance!==void 0?(console.warn("Purchases is already initialized. Ignoring and returning existing instance."),j.getSharedInstance()):(j.instance=new j(e,r),j.getSharedInstance())}async getOfferings(){const e=this._appUserId,r=await this.backend.getOfferings(e),n=r.offerings.flatMap(s=>s.packages).map(s=>s.platform_product_identifier),i=await this.backend.getProducts(e,n);return this.logMissingProductIds(n,i.product_details),this.toOfferings(r,i)}async isEntitledTo(e){const r=await this.getCustomerInfo();return e in r.entitlements.active}purchasePackage(e,r,n){let i=n??document.getElementById("rcb-ui-root");if(i===null){const c=document.createElement("div");c.className="rcb-ui-root",document.body.appendChild(c),i=c}if(i===null)throw new Error("Could not generate a mount point for the billing widget");const s=i,l=!n,o=this._appUserId;return new Promise((c,u)=>{new Wi({target:s,props:{appUserId:o,rcPackage:e,customerEmail:r,onFinished:async()=>{s.innerHTML="",c({customerInfo:await this._getCustomerInfoForUserId(o)})},onClose:()=>{s.innerHTML="",u(new Z(Ee.UserCancelledError))},onError:_=>{s.innerHTML="",u(Z.getForPurchasesFlowError(_))},purchases:this,backend:this.backend,purchaseOperationHelper:this.purchaseOperationHelper,asModal:l}})})}async getCustomerInfo(){return await this._getCustomerInfoForUserId(this._appUserId)}getAppUserId(){return this._appUserId}async changeUser(e){return this._appUserId=e,await this.getCustomerInfo()}logMissingProductIds(e,r){const n={};r.forEach(s=>n[s.identifier]=s);const i=[];e.forEach(s=>{n[s]===void 0&&i.push(s)}),i.length>0&&console.debug("Could not find product data for product ids: ",i,". Please check that your product configuration is correct.")}isSandbox(){return _t(this._API_KEY)}close(){j.instance===this?j.instance=void 0:console.warn("Trying to close a Purchases instance that is not the current instance. Ignoring.")}async _getCustomerInfoForUserId(e){const r=await this.backend.getCustomerInfo(e);return es(r)}};Q(j,"instance");let Ye=j;Y.ErrorCode=Ee,Y.PackageType=z,Y.Purchases=Ye,Y.PurchasesError=Z,Y.UninitializedPurchasesError=At,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})});
14
+ sans-serif}.rcb-ui-layout.svelte-ofxzf4{display:flex;justify-content:center;align-items:flex-start}.rcb-ui-aside.svelte-ofxzf4{margin-right:1rem}@media screen and (max-width: 60rem){.rcb-ui-layout.svelte-ofxzf4{flex-direction:column;align-items:center;justify-content:flex-end;height:100%}.rcb-ui-aside.svelte-ofxzf4{margin-right:0;margin-bottom:1rem}}`)}function wt(t){let e,r,n,i=t[1].isSandbox(),s;r=new pt({props:{dark:!0,showHeader:!0,brandingInfo:t[3],$$slots:{default:[qi]},$$scope:{ctx:t}}});let l=i&&$t();return{c(){e=$("div"),w(r.$$.fragment),n=T(),l&&l.c(),h(e,"class","rcb-ui-aside svelte-ofxzf4")},m(o,c){g(o,e,c),E(r,e,null),M(e,n),l&&l.m(e,null),s=!0},p(o,c){const u={};c&8&&(u.brandingInfo=o[3]),c&4194308&&(u.$$scope={dirty:c,ctx:o}),r.$set(u),c&2&&(i=o[1].isSandbox()),i?l?c&2&&a(l,1):(l=$t(),l.c(),a(l,1),l.m(e,null)):l&&(G(),f(l,1,1,()=>{l=null}),Y())},i(o){s||(a(r.$$.fragment,o),a(l),s=!0)},o(o){f(r.$$.fragment,o),f(l),s=!1},d(o){o&&m(e),I(r),l&&l.d()}}}function bt(t){let e,r;return e=new it({props:{productDetails:t[2]}}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&4&&(s.productDetails=n[2]),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function qi(t){let e,r,n=t[2]&&bt(t);return{c(){n&&n.c(),e=ie()},m(i,s){n&&n.m(i,s),g(i,e,s),r=!0},p(i,s){i[2]?n?(n.p(i,s),s&4&&a(n,1)):(n=bt(i),n.c(),a(n,1),n.m(e.parentNode,e)):n&&(G(),f(n,1,1,()=>{n=null}),Y())},i(i){r||(a(n),r=!0)},o(i){f(n),r=!1},d(i){i&&m(e),n&&n.d(i)}}}function $t(t){let e,r;return e=new an({}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function kt(t){let e,r;return e=new it({props:{productDetails:t[2]}}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&4&&(s.productDetails=n[2]),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Bt(t){let e,r;return e=new Qe({}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function yt(t){let e,r;return e=new Qe({}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Dt(t){let e,r;return e=new di({props:{onContinue:t[9],onClose:t[8]}}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p:y,i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function vt(t){let e,r;return e=new ni({props:{paymentInfoCollectionMetadata:t[4],onContinue:t[9],onClose:t[8],onError:t[10]}}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&16&&(s.paymentInfoCollectionMetadata=n[4]),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Qt(t){let e,r;return e=new Qe({}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Mt(t){var n;let e,r;return e=new fr({props:{brandingInfo:t[3],lastError:t[5]??new K(O.UnknownError,"Unknown error without state set."),supportEmail:(n=t[3])==null?void 0:n.seller_company_support_email,onContinue:t[11]}}),{c(){w(e.$$.fragment)},m(i,s){E(e,i,s),r=!0},p(i,s){var o;const l={};s&8&&(l.brandingInfo=i[3]),s&32&&(l.lastError=i[5]??new K(O.UnknownError,"Unknown error without state set.")),s&8&&(l.supportEmail=(o=i[3])==null?void 0:o.seller_company_support_email),e.$set(l)},i(i){r||(a(e.$$.fragment,i),r=!0)},o(i){f(e.$$.fragment,i),r=!1},d(i){I(e,i)}}}function Tt(t){let e,r;return e=new Br({props:{brandingInfo:t[3],onContinue:t[9]}}),{c(){w(e.$$.fragment)},m(n,i){E(e,n,i),r=!0},p(n,i){const s={};i&8&&(s.brandingInfo=n[3]),e.$set(s)},i(n){r||(a(e.$$.fragment,n),r=!0)},o(n){f(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function zi(t){let e,r,n,i,s,l,o,c,u,_=t[6]==="present-offer"&&t[2]&&kt(t),A=t[6]==="present-offer"&&!t[2]&&Bt(),k=t[6]==="polling-purchase-status"&&yt(),B=t[6]==="needs-auth-info"&&Dt(t),b=t[6]==="needs-payment-info"&&t[4]&&vt(t),D=t[6]==="loading"&&Qt(),P=t[6]==="error"&&Mt(t),N=t[6]==="success"&&Tt(t);return{c(){_&&_.c(),e=T(),A&&A.c(),r=T(),k&&k.c(),n=T(),B&&B.c(),i=T(),b&&b.c(),s=T(),D&&D.c(),l=T(),P&&P.c(),o=T(),N&&N.c(),c=ie()},m(d,p){_&&_.m(d,p),g(d,e,p),A&&A.m(d,p),g(d,r,p),k&&k.m(d,p),g(d,n,p),B&&B.m(d,p),g(d,i,p),b&&b.m(d,p),g(d,s,p),D&&D.m(d,p),g(d,l,p),P&&P.m(d,p),g(d,o,p),N&&N.m(d,p),g(d,c,p),u=!0},p(d,p){d[6]==="present-offer"&&d[2]?_?(_.p(d,p),p&68&&a(_,1)):(_=kt(d),_.c(),a(_,1),_.m(e.parentNode,e)):_&&(G(),f(_,1,1,()=>{_=null}),Y()),d[6]==="present-offer"&&!d[2]?A?p&68&&a(A,1):(A=Bt(),A.c(),a(A,1),A.m(r.parentNode,r)):A&&(G(),f(A,1,1,()=>{A=null}),Y()),d[6]==="polling-purchase-status"?k?p&64&&a(k,1):(k=yt(),k.c(),a(k,1),k.m(n.parentNode,n)):k&&(G(),f(k,1,1,()=>{k=null}),Y()),d[6]==="needs-auth-info"?B?(B.p(d,p),p&64&&a(B,1)):(B=Dt(d),B.c(),a(B,1),B.m(i.parentNode,i)):B&&(G(),f(B,1,1,()=>{B=null}),Y()),d[6]==="needs-payment-info"&&d[4]?b?(b.p(d,p),p&80&&a(b,1)):(b=vt(d),b.c(),a(b,1),b.m(s.parentNode,s)):b&&(G(),f(b,1,1,()=>{b=null}),Y()),d[6]==="loading"?D?p&64&&a(D,1):(D=Qt(),D.c(),a(D,1),D.m(l.parentNode,l)):D&&(G(),f(D,1,1,()=>{D=null}),Y()),d[6]==="error"?P?(P.p(d,p),p&64&&a(P,1)):(P=Mt(d),P.c(),a(P,1),P.m(o.parentNode,o)):P&&(G(),f(P,1,1,()=>{P=null}),Y()),d[6]==="success"?N?(N.p(d,p),p&64&&a(N,1)):(N=Tt(d),N.c(),a(N,1),N.m(c.parentNode,c)):N&&(G(),f(N,1,1,()=>{N=null}),Y())},i(d){u||(a(_),a(A),a(k),a(B),a(b),a(D),a(P),a(N),u=!0)},o(d){f(_),f(A),f(k),f(B),f(b),f(D),f(P),f(N),u=!1},d(d){d&&(m(e),m(r),m(n),m(i),m(s),m(l),m(o),m(c)),_&&_.d(d),A&&A.d(d),k&&k.d(d),B&&B.d(d),b&&b.d(d),D&&D.d(d),P&&P.d(d),N&&N.d(d)}}}function Xi(t){let e,r=t[7].includes(t[6]),n,i,s,l=r&&wt(t);return i=new pt({props:{$$slots:{default:[zi]},$$scope:{ctx:t}}}),{c(){e=$("div"),l&&l.c(),n=T(),w(i.$$.fragment),h(e,"class","rcb-ui-layout svelte-ofxzf4")},m(o,c){g(o,e,c),l&&l.m(e,null),M(e,n),E(i,e,null),s=!0},p(o,c){c&64&&(r=o[7].includes(o[6])),r?l?(l.p(o,c),c&64&&a(l,1)):(l=wt(o),l.c(),a(l,1),l.m(e,n)):l&&(G(),f(l,1,1,()=>{l=null}),Y());const u={};c&4194428&&(u.$$scope={dirty:c,ctx:o}),i.$set(u)},i(o){s||(a(l),a(i.$$.fragment,o),s=!0)},o(o){f(l),f(i.$$.fragment,o),s=!1},d(o){o&&m(e),l&&l.d(),I(i)}}}function Zi(t){let e,r,n;return r=new Ri({props:{condition:t[0],$$slots:{default:[Xi]},$$scope:{ctx:t}}}),{c(){e=$("div"),w(r.$$.fragment),h(e,"class","rcb-ui-container svelte-ofxzf4")},m(i,s){g(i,e,s),E(r,e,null),n=!0},p(i,[s]){const l={};s&1&&(l.condition=i[0]),s&4194430&&(l.$$scope={dirty:s,ctx:i}),r.$set(l)},i(i){n||(a(r.$$.fragment,i),n=!0)},o(i){f(r.$$.fragment,i),n=!1},d(i){i&&m(e),I(r)}}}function es(t,e,r){var Nt;let{asModal:n=!0}=e,{customerEmail:i}=e,{appUserId:s}=e,{rcPackage:l}=e,{onFinished:o}=e,{onError:c}=e,{onClose:u}=e,{purchases:_}=e,{backend:A}=e,{purchaseOperationHelper:k}=e,B=null,b=null,D=null,P=null;const N=((Nt=l.rcBillingProduct)==null?void 0:Nt.identifier)??null;let d="present-offer";const p=["present-offer","needs-auth-info","needs-payment-info","loading"];ye(async()=>{if(r(2,B=l.rcBillingProduct),r(3,b=await A.getBrandingInfo()),d==="present-offer"){i?Pt():r(6,d="needs-auth-info");return}});const us=()=>{u()},Pt=()=>{if(N===null){$e(new K(O.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}else r(6,d="loading");if(!i){$e(new K(O.MissingEmailError));return}k.startPurchase(s,N,i).then(Q=>{if(Q.next_action==="collect_payment_info"){r(6,d="needs-payment-info"),r(4,D=Q);return}if(Q.next_action==="completed"){r(6,d="success");return}}).catch(Q=>{$e(new K(O.ErrorSettingUpPurchase,Q.message,Q.underlyingErrorMessage))})},fs=Q=>{if(d==="needs-auth-info"){Q&&r(12,i=Q.email),Pt();return}if(d==="needs-payment-info"){r(6,d="polling-purchase-status"),k.pollCurrentPurchaseForCompletion().then(()=>{r(6,d="success")}).catch(ms=>{$e(ms)});return}if(d==="success"||d==="error"){o();return}r(6,d="success")},$e=Q=>{r(5,P=Q),r(6,d="error")},ds=()=>{c(P??new K(O.UnknownError,"Unknown error without state set."))};return t.$$set=Q=>{"asModal"in Q&&r(0,n=Q.asModal),"customerEmail"in Q&&r(12,i=Q.customerEmail),"appUserId"in Q&&r(13,s=Q.appUserId),"rcPackage"in Q&&r(14,l=Q.rcPackage),"onFinished"in Q&&r(15,o=Q.onFinished),"onError"in Q&&r(16,c=Q.onError),"onClose"in Q&&r(17,u=Q.onClose),"purchases"in Q&&r(1,_=Q.purchases),"backend"in Q&&r(18,A=Q.backend),"purchaseOperationHelper"in Q&&r(19,k=Q.purchaseOperationHelper)},[n,_,B,b,D,P,d,p,us,fs,$e,ds,i,s,l,o,c,u,A,k]}class ts extends C{constructor(e){super(),U(this,e,es,Zi,R,{asModal:0,customerEmail:12,appUserId:13,rcPackage:14,onFinished:15,onError:16,onClose:17,purchases:1,backend:18,purchaseOperationHelper:19},Wi)}}function ns(t){return t.expires_date==null?!0:new Date(t.expires_date)>new Date}function rs(t,e,r){return{identifier:t,isActive:ns(e),willRenew:ls(e,r),store:(r==null?void 0:r.store)??"unknown",originalPurchaseDate:new Date(e.purchase_date),expirationDate:Oe(e.expires_date),productIdentifier:e.product_identifier,unsubscribeDetectedAt:Oe(r==null?void 0:r.unsubscribe_detected_at),billingIssueDetectedAt:Oe(r==null?void 0:r.billing_issues_detected_at),isSandbox:(r==null?void 0:r.is_sandbox)??!1,periodType:(r==null?void 0:r.period_type)??"normal"}}function is(t,e){const r={},n={};for(const i in t){const s=e[i]??null,l=rs(i,t[i],s);r[i]=l,l.isActive&&(n[i]=l)}return{all:r,active:n}}function Oe(t){return t==null?null:new Date(t)}function ss(t){const e=cs(t),r=t.subscriber;return{entitlements:is(r.entitlements,r.subscriptions),allExpirationDatesByProduct:e,allPurchaseDatesByProduct:os(t),activeSubscriptions:as(e),managementURL:r.management_url,requestDate:new Date(t.request_date),firstSeenDate:new Date(r.first_seen),originalPurchaseDate:Oe(r.original_purchase_date),originalAppUserId:t.subscriber.original_app_user_id}}function ls(t,e){if(e==null)return!1;const r=e.store=="promotional",n=t.expires_date==null,i=e.unsubscribe_detected_at!=null,s=e.billing_issues_detected_at!=null;return!(r||n||i||s)}function os(t){const e={};for(const r in t.subscriber.subscriptions){const n=t.subscriber.subscriptions[r];e[r]=new Date(n.purchase_date)}return e}function cs(t){const e={};for(const r in t.subscriber.subscriptions){const n=t.subscriber.subscriptions[r];n.expires_date==null?e[r]=null:e[r]=new Date(n.expires_date)}return e}function as(t){const e=new Set,r=new Date;for(const n in t){const i=t[n];(i==null||i>r)&&e.add(n)}return e}const V=class V{constructor(e,r){v(this,"_API_KEY");v(this,"_appUserId");v(this,"backend");v(this,"purchaseOperationHelper");v(this,"toOfferings",(e,r)=>{const n=e.offerings.find(o=>o.identifier===e.current_offering_id)??null,i={};r.product_details.forEach(o=>{i[o.identifier]=o});const s=n==null?null:Ve(n,i),l={};return e.offerings.forEach(o=>{const c=Ve(o,i);c!=null&&(l[o.identifier]=c)}),Object.keys(l).length==0&&J.debugLog("Empty offerings. Please make sure you've configured offerings correctly in the RevenueCat dashboard and that the products are properly configured."),{all:l,current:s}});this._API_KEY=e,this._appUserId=r,Ke(e)&&J.debugLog("Initializing Purchases SDK with sandbox API Key"),this.backend=new xi(this._API_KEY),this.purchaseOperationHelper=new $n(this.backend)}static setLogLevel(e){J.setLogLevel(e)}static getSharedInstance(){if(V.isConfigured())return V.instance;throw new Et}static isConfigured(){return V.instance!==void 0}static configure(e,r){return V.instance!==void 0?(J.warnLog("Purchases is already initialized. Ignoring and returning existing instance."),V.getSharedInstance()):(V.instance=new V(e,r),V.getSharedInstance())}async getOfferings(){const e=this._appUserId,r=await this.backend.getOfferings(e),n=r.offerings.flatMap(s=>s.packages).map(s=>s.platform_product_identifier),i=await this.backend.getProducts(e,n);return this.logMissingProductIds(n,i.product_details),this.toOfferings(r,i)}async isEntitledTo(e){const r=await this.getCustomerInfo();return e in r.entitlements.active}purchasePackage(e,r,n){let i=n??document.getElementById("rcb-ui-root");if(i===null){const c=document.createElement("div");c.className="rcb-ui-root",document.body.appendChild(c),i=c}if(i===null)throw new Error("Could not generate a mount point for the billing widget");const s=i,l=!n,o=this._appUserId;return J.debugLog(`Presenting purchase form for package ${e.identifier}`),new Promise((c,u)=>{new ts({target:s,props:{appUserId:o,rcPackage:e,customerEmail:r,onFinished:async()=>{J.debugLog("Purchase finished"),s.innerHTML="",c({customerInfo:await this._getCustomerInfoForUserId(o)})},onClose:()=>{s.innerHTML="",J.debugLog("Purchase cancelled by user"),u(new ne(be.UserCancelledError))},onError:_=>{s.innerHTML="",u(ne.getForPurchasesFlowError(_))},purchases:this,backend:this.backend,purchaseOperationHelper:this.purchaseOperationHelper,asModal:l}})})}async getCustomerInfo(){return await this._getCustomerInfoForUserId(this._appUserId)}getAppUserId(){return this._appUserId}async changeUser(e){return this._appUserId=e,await this.getCustomerInfo()}logMissingProductIds(e,r){const n={};r.forEach(s=>n[s.identifier]=s);const i=[];e.forEach(s=>{n[s]===void 0&&i.push(s)}),i.length>0&&J.debugLog(`Could not find product data for product ids:
15
+ ${i.join()}.
16
+ Please check that your product configuration is correct.`)}isSandbox(){return Ke(this._API_KEY)}close(){V.instance===this?V.instance=void 0:J.warnLog("Trying to close a Purchases instance that is not the current instance. Ignoring.")}async _getCustomerInfoForUserId(e){const r=await this.backend.getCustomerInfo(e);return ss(r)}};v(V,"instance");let Je=V;F.ErrorCode=be,F.LogLevel=H,F.PackageType=Z,F.Purchases=Je,F.PurchasesError=ne,F.UninitializedPurchasesError=Et,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@revenuecat/purchases-js",
3
3
  "private": false,
4
- "version": "0.0.16",
4
+ "version": "0.0.18",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -34,11 +34,9 @@
34
34
  "svelte-check": "svelte-check",
35
35
  "storybook": "storybook dev -p 6006",
36
36
  "build-storybook": "storybook build",
37
- "extract-api": "api-extractor run --local --verbose",
38
- "generate-docs": "api-documenter markdown --input-folder api-report --output-folder docs"
37
+ "extract-api": "api-extractor run --local --verbose"
39
38
  },
40
39
  "devDependencies": {
41
- "@microsoft/api-documenter": "^7.23.23",
42
40
  "@microsoft/api-extractor": "^7.40.1",
43
41
  "@storybook/addon-essentials": "^7.5.3",
44
42
  "@storybook/addon-interactions": "^7.5.3",
@@ -67,6 +65,7 @@
67
65
  "svelte": "^4.2.7",
68
66
  "svelte-check": "^3.6.3",
69
67
  "svelte-stripe": "^1.1.2",
68
+ "typedoc": "^0.25.8",
70
69
  "typescript": "^5.2.2",
71
70
  "vite": "^5.0.0",
72
71
  "vite-plugin-dts": "^3.6.3",
@@ -1,11 +0,0 @@
1
- // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
- // It should be published with your NPM package. It should not be tracked by Git.
3
- {
4
- "tsdocVersion": "0.12",
5
- "toolPackages": [
6
- {
7
- "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.40.1"
9
- }
10
- ]
11
- }