@revenuecat/purchases-js 0.3.4 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
- (function(H,X){typeof exports=="object"&&typeof module<"u"?X(exports):typeof define=="function"&&define.amd?define(["exports"],X):(H=typeof globalThis<"u"?globalThis:H||self,X(H.Purchases={}))})(this,function(H){"use strict";var Zo=Object.defineProperty;var es=(H,X,x)=>X in H?Zo(H,X,{enumerable:!0,configurable:!0,writable:!0,value:x}):H[X]=x;var C=(H,X,x)=>(es(H,typeof X!="symbol"?X+"":X,x),x);function X(t){return t!=null}var x=(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))(x||{});class Y{static setLogLevel(e){this.logLevel=e}static log(e,r=this.logLevel){const n=`[Purchases] ${e}`;if(!(this.logLevel<r||r===x.Silent))switch(r){case x.Error:console.error(n);break;case x.Warn:console.warn(n);break;case x.Info:console.info(n);break;case x.Debug:console.debug(n);break;case x.Verbose:console.debug(n);break}}static errorLog(e){this.log(e,x.Error)}static warnLog(e){this.log(e,x.Warn)}static infoLog(e){this.log(e,x.Info)}static debugLog(e){this.log(e,x.Debug)}static verboseLog(e){this.log(e,x.Verbose)}}C(Y,"logLevel",x.Silent);var ie=(t=>(t.Year="year",t.Month="month",t.Week="week",t.Day="day",t))(ie||{});function Ge(t){const e=t.match(/^PT?([0-9]+)([MDYW])$/);if(!e||e.length<3)return Y.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 Y.errorLog(`Invalid ISO 8601 unit duration format: ${t}`),null}}const Ye=(t,e)=>{const r=t/100;return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).format(r)},jt=t=>{const e=t.number;if(e===1)switch(t.unit){case ie.Year:return"yearly";case ie.Month:return"monthly";case ie.Week:return"weekly";case ie.Day:return"daily"}else return`every ${e} ${t.unit}s`},Jt=t=>{const e=t.number;if(e===1)switch(t.unit){case ie.Year:return"1 year";case ie.Month:return"1 month";case ie.Week:return"1 week";case ie.Day:return"1 day"}else return`${e} ${t.unit}s`},nt=t=>{const e=Ge(t);return e?jt(e):"unknown"},Vt=t=>{const e=Ge(t);return e?Jt(e):"unknown"};var rt=(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))(rt||{});const Wt=t=>({amount:t.amount,currency:t.currency,formattedPrice:Ye(t.amount,t.currency)}),it=t=>{const e=t.period_duration;return{periodDuration:e,period:e?Ge(e):null,cycleCount:t.cycle_count,price:t.price?Wt(t.price):null}},zt=t=>t.base==null?(Y.debugLog("Missing base phase for subscription option. Ignoring."),null):{id:t.id,base:it(t.base),trial:t.trial?it(t.trial):null},Xt=(t,e)=>{const r={};if(Object.entries(t.subscription_options).forEach(([s,l])=>{const c=zt(l);c!=null&&(r[s]=c)}),Object.keys(r).length===0)return Y.debugLog(`Product ${t.identifier} has no subscription options. Ignoring.`),null;const n=t.default_subscription_option_id,i=n&&n in r?r[n]:null;if(i==null)return Y.debugLog(`Product ${t.identifier} has no default subscription option. Ignoring.`),null;const o=i.base.price;return o==null?(Y.debugLog(`Product ${t.identifier} default option has no base price. Ignoring.`),null):{identifier:t.identifier,displayName:t.title,title:t.title,description:t.description,currentPrice:o,normalPeriodDuration:i.base.periodDuration,presentedOfferingIdentifier:e,defaultSubscriptionOption:i,subscriptionOptions:r}},Zt=(t,e,r)=>{const n=r[e.platform_product_identifier];if(n===void 0)return null;const i=Xt(n,t);return i===null?null:{identifier:e.identifier,rcBillingProduct:i,packageType:en(e.identifier)}},ot=(t,e)=>{const r=t.packages.map(i=>Zt(t.identifier,i,e)).filter(X),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 en(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 v(){}function tn(t,e){for(const r in e)t[r]=e[r];return t}function st(t){return t()}function lt(){return Object.create(null)}function ge(t){t.forEach(st)}function se(t){return typeof t=="function"}function T(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let De;function ne(t,e){return t===e?!0:(De||(De=document.createElement("a")),De.href=e,t===De.href)}function ct(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function nn(t,e){const r=ct(t.srcset),n=ct(e||"");return n.length===r.length&&n.every(([i,o],s)=>o===r[s][1]&&(ne(r[s][0],i)||ne(i,r[s][0])))}function rn(t){return Object.keys(t).length===0}function J(t,e,r,n){if(t){const i=at(t,e,r,n);return t[0](i)}}function at(t,e,r,n){return t[1]&&n?tn(r.ctx.slice(),t[1](n(e))):r.ctx}function V(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 o=[],s=Math.max(e.dirty.length,i.length);for(let l=0;l<s;l+=1)o[l]=e.dirty[l]|i[l];return o}return e.dirty|i}return e.dirty}function W(t,e,r,n,i,o){if(i){const s=at(e,r,n,o);t.p(s,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 pe(t){return t??""}function M(t,e){t.appendChild(e)}function F(t,e,r){const n=on(t);if(!n.getElementById(e)){const i=k("style");i.id=e,i.textContent=r,sn(n,i)}}function on(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function sn(t,e){return M(t.head||t,e),e.sheet}function p(t,e,r){t.insertBefore(e,r||null)}function g(t){t.parentNode&&t.parentNode.removeChild(t)}function k(t){return document.createElement(t)}function O(t){return document.createTextNode(t)}function Q(){return O(" ")}function re(){return O("")}function _e(t,e,r,n){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r,n)}function ut(t){return function(e){return e.preventDefault(),t.call(this,e)}}function _(t,e,r){r==null?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}const ln=["width","height"];function cn(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&&ln.indexOf(n)===-1?t[n]=e[n]:_(t,n,e[n])}function an(t,e){Object.keys(e).forEach(r=>{un(t,r,e[r])})}function un(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:_(t,e,r)}function fn(t){return/-/.test(t)?an:cn}function dn(t){return Array.from(t.childNodes)}function le(t,e){e=""+e,t.data!==e&&(t.data=e)}function ft(t,e){t.value=e??""}function mn(t,e,{bubbles:r=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:r,cancelable:n})}let Ae;function he(t){Ae=t}function Ee(){if(!Ae)throw new Error("Function called outside component initialization");return Ae}function gn(t){Ee().$$.before_update.push(t)}function Me(t){Ee().$$.on_mount.push(t)}function pn(){const t=Ee();return(e,r,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=mn(e,r,{cancelable:n});return i.slice().forEach(s=>{s.call(t,o)}),!o.defaultPrevented}return!0}}function _n(t,e){return Ee().$$.context.set(t,e),e}function An(t){return Ee().$$.context.get(t)}function dt(t,e){const r=t.$$.callbacks[e.type];r&&r.slice().forEach(n=>n.call(this,e))}const ce=[],Pe=[];let ae=[];const He=[],hn=Promise.resolve();let Ke=!1;function En(){Ke||(Ke=!0,hn.then(mt))}function qe(t){ae.push(t)}function bn(t){He.push(t)}const je=new Set;let ue=0;function mt(){if(ue!==0)return;const t=Ae;do{try{for(;ue<ce.length;){const e=ce[ue];ue++,he(e),In(e.$$)}}catch(e){throw ce.length=0,ue=0,e}for(he(null),ce.length=0,ue=0;Pe.length;)Pe.pop()();for(let e=0;e<ae.length;e+=1){const r=ae[e];je.has(r)||(je.add(r),r())}ae.length=0}while(ce.length);for(;He.length;)He.pop()();Ke=!1,je.clear(),he(t)}function In(t){if(t.fragment!==null){t.update(),ge(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(qe)}}function wn(t){const e=[],r=[];ae.forEach(n=>t.indexOf(n)===-1?e.push(n):r.push(n)),r.forEach(n=>n()),ae=e}const Qe=new Set;let oe;function K(){oe={r:0,c:[],p:oe}}function q(){oe.r||ge(oe.c),oe=oe.p}function f(t,e){t&&t.i&&(Qe.delete(t),t.i(e))}function d(t,e,r,n){if(t&&t.o){if(Qe.has(t))return;Qe.add(t),oe.c.push(()=>{Qe.delete(t),n&&(r&&t.d(1),n())}),t.o(e)}else n&&n()}function kn(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 b(t,e,r){const{fragment:n,after_update:i}=t.$$;n&&n.m(e,r),qe(()=>{const o=t.$$.on_mount.map(st).filter(se);t.$$.on_destroy?t.$$.on_destroy.push(...o):ge(o),t.$$.on_mount=[]}),i.forEach(qe)}function I(t,e){const r=t.$$;r.fragment!==null&&(wn(r.after_update),ge(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function vn(t,e){t.$$.dirty[0]===-1&&(ce.push(t),En(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function N(t,e,r,n,i,o,s=null,l=[-1]){const c=Ae;he(t);const a=t.$$={fragment:null,ctx:[],props:o,update:v,not_equal:i,bound:lt(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:lt(),dirty:l,skip_bound:!1,root:e.target||c.$$.root};s&&s(a.root);let u=!1;if(a.ctx=r?r(t,e.props||{},(m,A,...$)=>{const E=$.length?$[0]:A;return a.ctx&&i(a.ctx[m],a.ctx[m]=E)&&(!a.skip_bound&&a.bound[m]&&a.bound[m](E),u&&vn(t,m)),A}):[],a.update(),u=!0,ge(a.before_update),a.fragment=n?n(a.ctx):!1,e.target){if(e.hydrate){const m=dn(e.target);a.fragment&&a.fragment.l(m),m.forEach(g)}else a.fragment&&a.fragment.c();e.intro&&f(t.$$.fragment),b(t,e.target,e.anchor),mt()}he(c)}class U{constructor(){C(this,"$$");C(this,"$$set")}$destroy(){I(this,1),this.$destroy=v}$on(e,r){if(!se(r))return v;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&&!rn(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const $n="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add($n);function yn(t){F(t,"svelte-1bzqb13",".rcb-modal-section.svelte-1bzqb13{padding:8px 0px;display:flex}section.rcb-modal-section.svelte-1bzqb13{flex-grow:1}.rcb-modal-section.svelte-1bzqb13:last-of-type{padding:0}")}function Je(t){let e,r;const n=t[2].default,i=J(n,t,t[1],null);return{c(){e=k(t[0]),i&&i.c(),fn(t[0])(e,{class:pe("rcb-modal-section")+" svelte-1bzqb13"})},m(o,s){p(o,e,s),i&&i.m(e,null),r=!0},p(o,s){i&&i.p&&(!r||s&2)&&W(i,n,o,o[1],r?V(n,o[1],s,null):z(o[1]),null)},i(o){r||(f(i,o),r=!0)},o(o){d(i,o),r=!1},d(o){o&&g(e),i&&i.d(o)}}}function Bn(t){let e=t[0],r,n,i=t[0]&&Je(t);return{c(){i&&i.c(),r=re()},m(o,s){i&&i.m(o,s),p(o,r,s),n=!0},p(o,[s]){o[0]?e?T(e,o[0])?(i.d(1),i=Je(o),e=o[0],i.c(),i.m(r.parentNode,r)):i.p(o,s):(i=Je(o),e=o[0],i.c(),i.m(r.parentNode,r)):e&&(i.d(1),i=null,e=o[0])},i(o){n||(f(i,o),n=!0)},o(o){d(i,o),n=!1},d(o){o&&g(r),i&&i.d(o)}}}function Dn(t,e,r){let{$$slots:n={},$$scope:i}=e,{as:o="section"}=e;return t.$$set=s=>{"as"in s&&r(0,o=s.as),"$$scope"in s&&r(1,i=s.$$scope)},[o,i,n]}class fe extends U{constructor(e){super(),N(this,e,Dn,Bn,T,{as:0},yn)}}function Mn(t){F(t,"svelte-gf0gr5",".rcb-pricing-info.svelte-gf0gr5{display:flex;flex-direction:column;margin-top:102px;font-weight:500}.rcb-product-price.svelte-gf0gr5{font-size:24px;margin:12px 0px}.rcb-product-price-after-trial.svelte-gf0gr5{margin-bottom:12px}.rcb-product-details.svelte-gf0gr5{opacity:0.6;list-style-type:disc;list-style-position:inside;margin:0px;padding:0px}@media screen and (max-width: 960px){.rcb-pricing-info.svelte-gf0gr5{margin-top:48px}}")}function Pn(t){let e=Vt(t[1].periodDuration)+"",r,n;return{c(){r=O(e),n=O(" free trial")},m(i,o){p(i,r,o),p(i,n,o)},p:v,d(i){i&&(g(r),g(n))}}}function Qn(t){let e=(t[2].currency||"")+"",r,n,i=Ye(t[2].amount,t[2].currency)+"",o;return{c(){r=O(e),n=Q(),o=O(i)},m(s,l){p(s,r,l),p(s,n,l),p(s,o,l)},p:v,d(s){s&&(g(r),g(n),g(o))}}}function Cn(t){let e;return{c(){e=k("span"),e.textContent=`${t[1]&&t[2]&&`${t[2].currency} ${Ye(t[2].amount,t[2].currency)} after end of trial`}`,_(e,"class","rcb-product-price-after-trial svelte-gf0gr5")},m(r,n){p(r,e,n)},p:v,d(r){r&&g(e)}}}function gt(t){let e,r,n=nt(t[0].normalPeriodDuration)+"",i;return{c(){e=k("li"),r=O("Renews "),i=O(n)},m(o,s){p(o,e,s),M(e,r),M(e,i)},p(o,s){s&1&&n!==(n=nt(o[0].normalPeriodDuration)+"")&&le(i,n)},d(o){o&&g(e)}}}function Tn(t){var P,Le;let e,r,n=t[0].displayName+"",i,o,s,l,c,a,u,m,A,$,E,B=((P=t[1])==null?void 0:P.periodDuration)&&Pn(t),h=!((Le=t[1])!=null&&Le.periodDuration)&&t[2]&&Qn(t),y=t[1]&&t[2]&&Cn(t),R=t[0].normalPeriodDuration&&gt(t);return{c(){e=k("div"),r=k("span"),i=O(n),o=Q(),s=k("span"),B&&B.c(),l=Q(),h&&h.c(),c=Q(),y&&y.c(),a=Q(),u=k("ul"),R&&R.c(),m=Q(),A=k("li"),A.textContent="Continues until canceled",$=Q(),E=k("li"),E.textContent="Cancel anytime",_(s,"class","rcb-product-price svelte-gf0gr5"),_(u,"class","rcb-product-details svelte-gf0gr5"),_(e,"class","rcb-pricing-info svelte-gf0gr5")},m(G,S){p(G,e,S),M(e,r),M(r,i),M(e,o),M(e,s),B&&B.m(s,null),M(s,l),h&&h.m(s,null),M(e,c),y&&y.m(e,null),M(e,a),M(e,u),R&&R.m(u,null),M(u,m),M(u,A),M(u,$),M(u,E)},p(G,S){var Fe,xe;S&1&&n!==(n=G[0].displayName+"")&&le(i,n),(Fe=G[1])!=null&&Fe.periodDuration&&B.p(G,S),!((xe=G[1])!=null&&xe.periodDuration)&&G[2]&&h.p(G,S),G[1]&&G[2]&&y.p(G,S),G[0].normalPeriodDuration?R?R.p(G,S):(R=gt(G),R.c(),R.m(u,m)):R&&(R.d(1),R=null)},d(G){G&&g(e),B&&B.d(),h&&h.d(),y&&y.d(),R&&R.d()}}}function Nn(t){let e,r;return e=new fe({props:{$$slots:{default:[Tn]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,[i]){const o={};i&33&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Un(t,e,r){var c;let{productDetails:n}=e,{purchaseOption:i}=e;const o=i,s=o==null?void 0:o.trial,l=(c=o==null?void 0:o.base)==null?void 0:c.price;return t.$$set=a=>{"productDetails"in a&&r(0,n=a.productDetails),"purchaseOption"in a&&r(3,i=a.purchaseOption)},[n,s,l,i]}class pt extends U{constructor(e){super(),N(this,e,Un,Nn,T,{productDetails:0,purchaseOption:3},Mn)}}const Rn="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+gfWgusN6KCCAN7WoITVVXjchBxqERAAIfkEBQQAAQAsDQADACA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JFCxe+frdMDQgAIfkEBQUAAQAsBQADACAAEAAACKYAAwgcSLAgwQcODCpcyNDAAYYQAzhpaIDhFYY+NOBY6HAhkyETFRLZ0CGKQgMVDV4RAoQKQxMdUpx8aJAJECYQnWzYcMQgSoNVgAy5CHGGhhI+aRIkMgRnxCohNvQoiLDgEyFDskQUuINDiK1Hfpgc+ETKQi0nVGxNkkSrwCw/hiBxu7XuFidAhARpgqWu3yxIhgApEtLvVipIgARBYthvlKaNFQYEADs=";function Sn(t){let e,r;return{c(){e=k("img"),ne(e.src,r=Rn)||_(e,"src",r),_(e,"alt","spinner")},m(n,i){p(n,e,i)},p:v,i:v,o:v,d(n){n&&g(e)}}}class On extends U{constructor(e){super(),N(this,e,null,Sn,T,{})}}function Ln(t){F(t,"svelte-1mxx341",".rcb-modal-loader.svelte-1mxx341{width:100%;flex-grow:1;min-height:100%;display:flex;justify-content:center;align-items:center}")}function Fn(t){let e,r,n;return r=new On({}),{c(){e=k("div"),w(r.$$.fragment),_(e,"class","rcb-modal-loader svelte-1mxx341")},m(i,o){p(i,e,o),b(r,e,null),n=!0},p:v,i(i){n||(f(r.$$.fragment,i),n=!0)},o(i){d(r.$$.fragment,i),n=!1},d(i){i&&g(e),I(r)}}}class Ve extends U{constructor(e){super(),N(this,e,null,Fn,T,{},Ln)}}var ee=(t=>(t[t.UnknownError=0]="UnknownError",t[t.UserCancelledError=1]="UserCancelledError",t[t.StoreProblemError=2]="StoreProblemError",t[t.PurchaseNotAllowedError=3]="PurchaseNotAllowedError",t[t.PurchaseInvalidError=4]="PurchaseInvalidError",t[t.ProductNotAvailableForPurchaseError=5]="ProductNotAvailableForPurchaseError",t[t.ProductAlreadyPurchasedError=6]="ProductAlreadyPurchasedError",t[t.ReceiptAlreadyInUseError=7]="ReceiptAlreadyInUseError",t[t.InvalidReceiptError=8]="InvalidReceiptError",t[t.MissingReceiptFileError=9]="MissingReceiptFileError",t[t.NetworkError=10]="NetworkError",t[t.InvalidCredentialsError=11]="InvalidCredentialsError",t[t.UnexpectedBackendResponseError=12]="UnexpectedBackendResponseError",t[t.InvalidAppUserIdError=14]="InvalidAppUserIdError",t[t.OperationAlreadyInProgressError=15]="OperationAlreadyInProgressError",t[t.UnknownBackendError=16]="UnknownBackendError",t[t.InvalidAppleSubscriptionKeyError=17]="InvalidAppleSubscriptionKeyError",t[t.IneligibleError=18]="IneligibleError",t[t.InsufficientPermissionsError=19]="InsufficientPermissionsError",t[t.PaymentPendingError=20]="PaymentPendingError",t[t.InvalidSubscriberAttributesError=21]="InvalidSubscriberAttributesError",t[t.LogOutWithAnonymousUserError=22]="LogOutWithAnonymousUserError",t[t.ConfigurationError=23]="ConfigurationError",t[t.UnsupportedError=24]="UnsupportedError",t[t.EmptySubscriberAttributesError=25]="EmptySubscriberAttributesError",t[t.CustomerInfoError=28]="CustomerInfoError",t[t.SignatureVerificationError=36]="SignatureVerificationError",t[t.InvalidEmailError=38]="InvalidEmailError",t))(ee||{});class be{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.";case 38:return"Email is not valid. Please provide a valid email address."}}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:case 7814:return 4;case 7772:return 6;case 7220:return 14;case 7229:return 2;case 7230:case 7e3:return 23;case 7231:return 2;case 7232:return 18;case 7263:case 7264:return 21;case 7104:case 7234:case 7226:case 7110:return 12;case 7662:return 24;case 7012:case 7834:return 38}}static convertCodeToBackendErrorCode(e){return e in _t?e:null}static convertPurchaseFlowErrorCodeToErrorCode(e){switch(e){case L.ErrorSettingUpPurchase:return 2;case L.ErrorChargingPayment:return 20;case L.NetworkError:return 10;case L.MissingEmailError:return 4;case L.StripeError:return 2;case L.UnknownError:return 0;case L.AlreadySubscribedError:return 6}}}var _t=(t=>(t[t.BackendInvalidPlatform=7e3]="BackendInvalidPlatform",t[t.BackendInvalidEmail=7012]="BackendInvalidEmail",t[t.BackendStoreProblem=7101]="BackendStoreProblem",t[t.BackendCannotTransferPurchase=7102]="BackendCannotTransferPurchase",t[t.BackendInvalidReceiptToken=7103]="BackendInvalidReceiptToken",t[t.BackendInvalidAppStoreSharedSecret=7104]="BackendInvalidAppStoreSharedSecret",t[t.BackendInvalidPaymentModeOrIntroPriceNotProvided=7105]="BackendInvalidPaymentModeOrIntroPriceNotProvided",t[t.BackendProductIdForGoogleReceiptNotProvided=7106]="BackendProductIdForGoogleReceiptNotProvided",t[t.BackendInvalidPlayStoreCredentials=7107]="BackendInvalidPlayStoreCredentials",t[t.BackendInternalServerError=7110]="BackendInternalServerError",t[t.BackendEmptyAppUserId=7220]="BackendEmptyAppUserId",t[t.BackendInvalidAuthToken=7224]="BackendInvalidAuthToken",t[t.BackendInvalidAPIKey=7225]="BackendInvalidAPIKey",t[t.BackendBadRequest=7226]="BackendBadRequest",t[t.BackendPlayStoreQuotaExceeded=7229]="BackendPlayStoreQuotaExceeded",t[t.BackendPlayStoreInvalidPackageName=7230]="BackendPlayStoreInvalidPackageName",t[t.BackendPlayStoreGenericError=7231]="BackendPlayStoreGenericError",t[t.BackendUserIneligibleForPromoOffer=7232]="BackendUserIneligibleForPromoOffer",t[t.BackendInvalidAppleSubscriptionKey=7234]="BackendInvalidAppleSubscriptionKey",t[t.BackendInvalidSubscriberAttributes=7263]="BackendInvalidSubscriberAttributes",t[t.BackendInvalidSubscriberAttributesBody=7264]="BackendInvalidSubscriberAttributesBody",t[t.BackendProductIDsMalformed=7662]="BackendProductIDsMalformed",t[t.BackendAlreadySubscribedError=7772]="BackendAlreadySubscribedError",t[t.BackendOfferNotFound=7814]="BackendOfferNotFound",t[t.BackendNoMXRecordsFound=7834]="BackendNoMXRecordsFound",t))(_t||{});class Z extends Error{constructor(r,n,i){super(n);C(this,"toString",()=>`PurchasesError(code: ${ee[this.errorCode]}, message: ${this.message})`);this.errorCode=r,this.underlyingErrorMessage=i}static getForBackendError(r,n){const i=be.getErrorCodeForBackendErrorCode(r);return new Z(i,be.getPublicMessage(i),n)}static getForPurchasesFlowError(r){return new Z(be.convertPurchaseFlowErrorCodeToErrorCode(r.errorCode),r.message,r.underlyingErrorMessage)}}class At extends Error{constructor(){super("Purchases must be configured before calling getInstance")}}var Ie=(t=>(t.Started="started",t.InProgress="in_progress",t.Succeeded="succeeded",t.Failed="failed",t))(Ie||{}),Ce=(t=>(t[t.SetupIntentCreationFailed=1]="SetupIntentCreationFailed",t[t.PaymentMethodCreationFailed=2]="PaymentMethodCreationFailed",t[t.PaymentChargeFailed=3]="PaymentChargeFailed",t))(Ce||{}),L=(t=>(t[t.ErrorSettingUpPurchase=0]="ErrorSettingUpPurchase",t[t.ErrorChargingPayment=1]="ErrorChargingPayment",t[t.UnknownError=2]="UnknownError",t[t.NetworkError=3]="NetworkError",t[t.StripeError=4]="StripeError",t[t.MissingEmailError=5]="MissingEmailError",t[t.AlreadySubscribedError=6]="AlreadySubscribedError",t))(L||{});class j extends Error{constructor(e,r,n){super(r),this.errorCode=e,this.underlyingErrorMessage=n}static fromPurchasesError(e,r){let n;return e.errorCode===ee.ProductAlreadyPurchasedError?n=6:e.errorCode===ee.InvalidEmailError?n=5:n=r,new j(n,e.message,e.underlyingErrorMessage)}}class xn{constructor(e,r=10){C(this,"operationSessionId",null);C(this,"backend");C(this,"maxNumberAttempts");C(this,"waitMSBetweenAttempts",1e3);this.backend=e,this.maxNumberAttempts=r}async startPurchase(e,r,n,i,o){try{const s=await this.backend.postSubscribe(e,r,i,o,n==null?void 0:n.id);return this.operationSessionId=s.operation_session_id,s}catch(s){if(s instanceof Z)throw j.fromPurchasesError(s,0);{const l="Unknown error starting purchase: "+String(s);throw Y.errorLog(l),new j(2,l)}}}async pollCurrentPurchaseForCompletion(){const e=this.operationSessionId;if(!e)throw new j(0,"No purchase in progress");return new Promise((r,n)=>{const i=(o=1)=>{if(o>this.maxNumberAttempts){this.clearPurchaseInProgress(),n(new j(2,"Max attempts reached trying to get successful purchase status"));return}this.backend.getCheckoutStatus(e).then(s=>{switch(s.operation.status){case Ie.Started:case Ie.InProgress:setTimeout(()=>i(o+1),this.waitMSBetweenAttempts);break;case Ie.Succeeded:this.clearPurchaseInProgress(),r();return;case Ie.Failed:this.clearPurchaseInProgress(),this.handlePaymentError(s.operation.error,n)}}).catch(s=>{const l=j.fromPurchasesError(s,3);n(l)})};i()})}clearPurchaseInProgress(){this.operationSessionId=null}handlePaymentError(e,r){if(e==null){r(new j(2,"Got an error status but error field is empty."));return}switch(e.code){case Ce.SetupIntentCreationFailed:r(new j(0,"Setup intent creation failed"));return;case Ce.PaymentMethodCreationFailed:r(new j(0,"Payment method creation failed"));return;case Ce.PaymentChargeFailed:r(new j(1,"Payment charge failed"));return}}}const Gn="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 Yn(t){F(t,"svelte-1609h93","img.svelte-1609h93{width:124px;height:124px;margin:0 auto}")}function Hn(t){let e,r;return{c(){e=k("img"),ne(e.src,r=Gn)||_(e,"src",r),_(e,"alt","icon"),_(e,"class","rcb-ui-asset-icon svelte-1609h93")},m(n,i){p(n,e,i)},p:v,i:v,o:v,d(n){n&&g(e)}}}class Kn extends U{constructor(e){super(),N(this,e,null,Hn,T,{},Yn)}}function qn(t){F(t,"svelte-1rmxk7q","button.svelte-1rmxk7q{border:none;border-radius:56px;font-size:16px;cursor:pointer;height:56px;color:var(--rc-color-grey-text-dark);background-color:var(--rc-color-grey-ui-dark);display:flex;align-items:center;justify-content:center}button.intent-primary.svelte-1rmxk7q{background-color:var(--rc-color-grey-text-dark);color:var(--rc-color-white);font-size:16px}button.svelte-1rmxk7q:disabled{color:var(--rc-color-grey-text-light)}button.intent-primary.svelte-1rmxk7q:disabled{color:var(--rc-color-grey-text-light)}")}function jn(t){let e,r,n,i,o;const s=t[3].default,l=J(s,t,t[2],null);return{c(){e=k("button"),l&&l.c(),_(e,"class",r=pe(`intent-${t[0]}`)+" svelte-1rmxk7q"),e.disabled=t[1]},m(c,a){p(c,e,a),l&&l.m(e,null),n=!0,i||(o=_e(e,"click",t[4]),i=!0)},p(c,[a]){l&&l.p&&(!n||a&4)&&W(l,s,c,c[2],n?V(s,c[2],a,null):z(c[2]),null),(!n||a&1&&r!==(r=pe(`intent-${c[0]}`)+" svelte-1rmxk7q"))&&_(e,"class",r),(!n||a&2)&&(e.disabled=c[1])},i(c){n||(f(l,c),n=!0)},o(c){d(l,c),n=!1},d(c){c&&g(e),l&&l.d(c),i=!1,o()}}}function Jn(t,e,r){let{$$slots:n={},$$scope:i}=e,{intent:o="primary"}=e,{disabled:s=!1}=e;function l(c){dt.call(this,t,c)}return t.$$set=c=>{"intent"in c&&r(0,o=c.intent),"disabled"in c&&r(1,s=c.disabled),"$$scope"in c&&r(2,i=c.$$scope)},[o,s,i,n,l]}class we extends U{constructor(e){super(),N(this,e,Jn,jn,T,{intent:0,disabled:1},qn)}}function Vn(t){F(t,"svelte-1f9z0o8","footer.svelte-1f9z0o8{display:flex;flex-direction:column}")}function Wn(t){let e,r;const n=t[1].default,i=J(n,t,t[0],null);return{c(){e=k("footer"),i&&i.c(),_(e,"class","rcb-modal-footer svelte-1f9z0o8")},m(o,s){p(o,e,s),i&&i.m(e,null),r=!0},p(o,[s]){i&&i.p&&(!r||s&1)&&W(i,n,o,o[0],r?V(n,o[0],s,null):z(o[0]),null)},i(o){r||(f(i,o),r=!0)},o(o){d(i,o),r=!1},d(o){o&&g(e),i&&i.d(o)}}}function zn(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=o=>{"$$scope"in o&&r(0,i=o.$$scope)},[i,n]}class We extends U{constructor(e){super(),N(this,e,zn,Wn,T,{},Vn)}}function Xn(t){F(t,"svelte-6o8e90",'.column.svelte-6o8e90{display:flex;flex-direction:column;justify-content:flex-start;gap:var(--gap, "8px");flex-grow:1}')}function Zn(t){let e,r,n;const i=t[2].default,o=J(i,t,t[1],null);return{c(){e=k("div"),o&&o.c(),_(e,"class","column svelte-6o8e90"),_(e,"style",r=`--gap:${t[0]};`)},m(s,l){p(s,e,l),o&&o.m(e,null),n=!0},p(s,[l]){o&&o.p&&(!n||l&2)&&W(o,i,s,s[1],n?V(i,s[1],l,null):z(s[1]),null),(!n||l&1&&r!==(r=`--gap:${s[0]};`))&&_(e,"style",r)},i(s){n||(f(o,s),n=!0)},o(s){d(o,s),n=!1},d(s){s&&g(e),o&&o.d(s)}}}function er(t,e,r){let{$$slots:n={},$$scope:i}=e,{gutter:o="8px"}=e;return t.$$set=s=>{"gutter"in s&&r(0,o=s.gutter),"$$scope"in s&&r(1,i=s.$$scope)},[o,i,n]}class ke extends U{constructor(e){super(),N(this,e,er,Zn,T,{gutter:0},Xn)}}const tr="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 nr(t){F(t,"svelte-14xreta",".close-button.svelte-14xreta{border:none;cursor:pointer;background-color:transparent;padding:0px}")}function rr(t){let e,r,n,i,o;return{c(){e=k("button"),r=k("img"),ne(r.src,n=tr)||_(r,"src",n),_(r,"alt","close"),_(e,"class","close-button svelte-14xreta"),e.disabled=t[0]},m(s,l){p(s,e,l),M(e,r),i||(o=_e(e,"click",t[1]),i=!0)},p(s,[l]){l&1&&(e.disabled=s[0])},i:v,o:v,d(s){s&&g(e),i=!1,o()}}}function ir(t,e,r){let{disabled:n=!1}=e;function i(o){dt.call(this,t,o)}return t.$$set=o=>{"disabled"in o&&r(0,n=o.disabled)},[n,i]}class or extends U{constructor(e){super(),N(this,e,ir,rr,T,{disabled:0},nr)}}function sr(t){F(t,"svelte-44qpq9",".rcb-app-icon.svelte-44qpq9{width:40px;height:40px;border-radius:12px;box-shadow:0px 1px 10px 0px rgba(0, 0, 0, 0.1);margin-right:16px}.rcb-app-icon-picture-container.svelte-44qpq9{height:40px}.rcb-app-icon.loading.svelte-44qpq9{background-color:gray}")}function lr(t){let e;return{c(){e=k("div"),_(e,"class","rcb-app-icon loading svelte-44qpq9")},m(r,n){p(r,e,n)},p:v,d(r){r&&g(e)}}}function cr(t){let e,r,n,i,o,s;return{c(){e=k("picture"),r=k("source"),i=Q(),o=k("img"),_(r,"type","image/webp"),nn(r,n=t[1])||_(r,"srcset",n),_(o,"class","rcb-app-icon svelte-44qpq9"),ne(o.src,s=t[0])||_(o,"src",s),_(o,"alt","App icon"),_(e,"class","rcb-app-icon-picture-container svelte-44qpq9")},m(l,c){p(l,e,c),M(e,r),M(e,i),M(e,o)},p(l,c){c&2&&n!==(n=l[1])&&_(r,"srcset",n),c&1&&!ne(o.src,s=l[0])&&_(o,"src",s)},d(l){l&&g(e)}}}function ar(t){let e;function r(o,s){return o[0]!==null?cr:lr}let n=r(t),i=n(t);return{c(){i.c(),e=re()},m(o,s){i.m(o,s),p(o,e,s)},p(o,[s]){n===(n=r(o))&&i?i.p(o,s):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:v,o:v,d(o){o&&g(e),i.d(o)}}}function ur(t,e,r){let{src:n=null}=e,{srcWebp:i=null}=e;return t.$$set=o=>{"src"in o&&r(0,n=o.src),"srcWebp"in o&&r(1,i=o.srcWebp)},[n,i]}class ht extends U{constructor(e){super(),N(this,e,ur,ar,T,{src:0,srcWebp:1},sr)}}const Te=t=>`https://da08ctfrofx1b.cloudfront.net/${t}`;function fr(t){F(t,"svelte-10uf5fq",".app-title.svelte-10uf5fq{font-weight:500;margin:8px 0;font-size:16px}.rcb-header-layout__business-info.svelte-10uf5fq{display:flex;align-items:center}")}function dr(t){let e,r;return e=new ht({}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p:v,i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function mr(t){let e,r,n=t[0].seller_company_name+"",i,o,s=t[0].app_icon_webp!==null&&t[0].app_icon!==null&&Et(t);return{c(){s&&s.c(),e=Q(),r=k("span"),i=O(n),_(r,"class","app-title svelte-10uf5fq")},m(l,c){s&&s.m(l,c),p(l,e,c),p(l,r,c),M(r,i),o=!0},p(l,c){l[0].app_icon_webp!==null&&l[0].app_icon!==null?s?(s.p(l,c),c&1&&f(s,1)):(s=Et(l),s.c(),f(s,1),s.m(e.parentNode,e)):s&&(K(),d(s,1,1,()=>{s=null}),q()),(!o||c&1)&&n!==(n=l[0].seller_company_name+"")&&le(i,n)},i(l){o||(f(s),o=!0)},o(l){d(s),o=!1},d(l){l&&(g(e),g(r)),s&&s.d(l)}}}function Et(t){let e,r;return e=new ht({props:{src:Te(t[0].app_icon),srcWebp:Te(t[0].app_icon_webp)}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){const o={};i&1&&(o.src=Te(n[0].app_icon)),i&1&&(o.srcWebp=Te(n[0].app_icon_webp)),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function gr(t){let e,r,n,i;const o=[mr,dr],s=[];function l(c,a){return c[0]!==null?0:1}return r=l(t),n=s[r]=o[r](t),{c(){e=k("div"),n.c(),_(e,"class","rcb-header-layout__business-info svelte-10uf5fq")},m(c,a){p(c,e,a),s[r].m(e,null),i=!0},p(c,[a]){let u=r;r=l(c),r===u?s[r].p(c,a):(K(),d(s[u],1,1,()=>{s[u]=null}),q(),n=s[r],n?n.p(c,a):(n=s[r]=o[r](c),n.c()),f(n,1),n.m(e,null))},i(c){i||(f(n),i=!0)},o(c){d(n),i=!1},d(c){c&&g(e),s[r].d()}}}function pr(t,e,r){let{brandingInfo:n=null}=e;return t.$$set=i=>{"brandingInfo"in i&&r(0,n=i.brandingInfo)},[n]}class bt extends U{constructor(e){super(),N(this,e,pr,gr,T,{brandingInfo:0},fr)}}function _r(t){F(t,"svelte-17puakv",".rcb-post-purchase-header-layout.svelte-17puakv{display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:-4px}")}function Ar(t){let e,r,n,i,o;return r=new bt({props:{brandingInfo:t[0]}}),i=new or({}),i.$on("click",function(){se(t[1])&&t[1].apply(this,arguments)}),{c(){e=k("div"),w(r.$$.fragment),n=Q(),w(i.$$.fragment),_(e,"class","rcb-post-purchase-header-layout svelte-17puakv")},m(s,l){p(s,e,l),b(r,e,null),M(e,n),b(i,e,null),o=!0},p(s,l){t=s;const c={};l&1&&(c.brandingInfo=t[0]),r.$set(c)},i(s){o||(f(r.$$.fragment,s),f(i.$$.fragment,s),o=!0)},o(s){d(r.$$.fragment,s),d(i.$$.fragment,s),o=!1},d(s){s&&g(e),I(r),I(i)}}}function hr(t){let e,r;return e=new fe({props:{as:"header",$$slots:{default:[Ar]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,[i]){const o={};i&7&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Er(t,e,r){let{brandingInfo:n=null}=e,{onClose:i}=e;return t.$$set=o=>{"brandingInfo"in o&&r(0,n=o.brandingInfo),"onClose"in o&&r(1,i=o.onClose)},[n,i]}class br extends U{constructor(e){super(),N(this,e,Er,hr,T,{brandingInfo:0,onClose:1},_r)}}function Ir(t){F(t,"svelte-10pcqja",".rcb-modal-message.svelte-10pcqja{width:100%;min-height:160px;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center}.title.svelte-10pcqja{font-size:24px;line-height:1.25em}.subtitle.svelte-10pcqja{font-size:16px;line-height:1.25em;overflow-wrap:anywhere}")}const wr=t=>({}),It=t=>({});function kr(t){let e,r,n,i,o;const s=t[4].default,l=J(s,t,t[5],null);return{c(){e=k("span"),r=O(t[2]),n=Q(),i=k("span"),l&&l.c(),_(e,"class","title svelte-10pcqja"),_(i,"class","subtitle svelte-10pcqja")},m(c,a){p(c,e,a),M(e,r),p(c,n,a),p(c,i,a),l&&l.m(i,null),o=!0},p(c,a){(!o||a&4)&&le(r,c[2]),l&&l.p&&(!o||a&32)&&W(l,s,c,c[5],o?V(s,c[5],a,null):z(c[5]),null)},i(c){o||(f(l,c),o=!0)},o(c){d(l,c),o=!1},d(c){c&&(g(e),g(n),g(i)),l&&l.d(c)}}}function vr(t){let e,r,n;const i=t[4].icon,o=J(i,t,t[5],It);return r=new ke({props:{gutter:"16px",$$slots:{default:[kr]},$$scope:{ctx:t}}}),{c(){o&&o.c(),e=Q(),w(r.$$.fragment)},m(s,l){o&&o.m(s,l),p(s,e,l),b(r,s,l),n=!0},p(s,l){o&&o.p&&(!n||l&32)&&W(o,i,s,s[5],n?V(i,s[5],l,wr):z(s[5]),It);const c={};l&36&&(c.$$scope={dirty:l,ctx:s}),r.$set(c)},i(s){n||(f(o,s),f(r.$$.fragment,s),n=!0)},o(s){d(o,s),d(r.$$.fragment,s),n=!1},d(s){s&&g(e),o&&o.d(s),I(r,s)}}}function $r(t){let e,r,n;return r=new ke({props:{gutter:"16px",$$slots:{default:[vr]},$$scope:{ctx:t}}}),{c(){e=k("div"),w(r.$$.fragment),_(e,"class","rcb-modal-message svelte-10pcqja"),_(e,"data-type",t[3])},m(i,o){p(i,e,o),b(r,e,null),n=!0},p(i,o){const s={};o&36&&(s.$$scope={dirty:o,ctx:i}),r.$set(s),(!n||o&8)&&_(e,"data-type",i[3])},i(i){n||(f(r.$$.fragment,i),n=!0)},o(i){d(r.$$.fragment,i),n=!1},d(i){i&&g(e),I(r)}}}function yr(t){let e;return{c(){e=O("Go back to app")},m(r,n){p(r,e,n)},d(r){r&&g(e)}}}function Br(t){let e,r;return e=new we({props:{$$slots:{default:[yr]},$$scope:{ctx:t}}}),e.$on("click",function(){se(t[1])&&t[1].apply(this,arguments)}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){t=n;const o={};i&32&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Dr(t){let e,r,n,i,o,s;return e=new br({props:{brandingInfo:t[0],onClose:t[1]}}),n=new fe({props:{$$slots:{default:[$r]},$$scope:{ctx:t}}}),o=new We({props:{$$slots:{default:[Br]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment),r=Q(),w(n.$$.fragment),i=Q(),w(o.$$.fragment)},m(l,c){b(e,l,c),p(l,r,c),b(n,l,c),p(l,i,c),b(o,l,c),s=!0},p(l,c){const a={};c&1&&(a.brandingInfo=l[0]),c&2&&(a.onClose=l[1]),e.$set(a);const u={};c&44&&(u.$$scope={dirty:c,ctx:l}),n.$set(u);const m={};c&34&&(m.$$scope={dirty:c,ctx:l}),o.$set(m)},i(l){s||(f(e.$$.fragment,l),f(n.$$.fragment,l),f(o.$$.fragment,l),s=!0)},o(l){d(e.$$.fragment,l),d(n.$$.fragment,l),d(o.$$.fragment,l),s=!1},d(l){l&&(g(r),g(i)),I(e,l),I(n,l),I(o,l)}}}function Mr(t){let e,r;return e=new ke({props:{gutter:"32px",$$slots:{default:[Dr]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,[i]){const o={};i&47&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Pr(t,e,r){let{$$slots:n={},$$scope:i}=e,{brandingInfo:o=null}=e,{onContinue:s}=e,{title:l}=e,{type:c}=e;return t.$$set=a=>{"brandingInfo"in a&&r(0,o=a.brandingInfo),"onContinue"in a&&r(1,s=a.onContinue),"title"in a&&r(2,l=a.title),"type"in a&&r(3,c=a.type),"$$scope"in a&&r(5,i=a.$$scope)},[o,s,l,c,n,i]}class wt extends U{constructor(e){super(),N(this,e,Pr,Mr,T,{brandingInfo:0,onContinue:1,title:2,type:3},Ir)}}function kt(t){let e,r,n,i,o;return{c(){e=O("If this error persists, please contact "),r=k("a"),n=O(t[1]),o=O("."),_(r,"href",i="mailto:"+t[1])},m(s,l){p(s,e,l),p(s,r,l),M(r,n),p(s,o,l)},p(s,l){l&2&&le(n,s[1]),l&2&&i!==(i="mailto:"+s[1])&&_(r,"href",i)},d(s){s&&(g(e),g(r),g(o))}}}function Qr(t){let e=t[3]()+"",r,n,i,o=t[1]&&kt(t);return{c(){r=O(e),n=Q(),o&&o.c(),i=re()},m(s,l){p(s,r,l),p(s,n,l),o&&o.m(s,l),p(s,i,l)},p(s,l){s[1]?o?o.p(s,l):(o=kt(s),o.c(),o.m(i.parentNode,i)):o&&(o.d(1),o=null)},d(s){s&&(g(r),g(n),g(i)),o&&o.d(s)}}}function Cr(t){let e,r;return e=new Kn({props:{slot:"icon"}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p:v,i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Tr(t){let e,r;return e=new wt({props:{title:t[4](),brandingInfo:t[0],onContinue:t[2],type:"error",$$slots:{icon:[Cr],default:[Qr]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,[i]){const o={};i&1&&(o.brandingInfo=n[0]),i&4&&(o.onContinue=n[2]),i&66&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Nr(t,e,r){let{brandingInfo:n=null}=e,{lastError:i}=e,{supportEmail:o=null}=e,{onContinue:s}=e;Me(()=>{Y.errorLog(`Displayed error: ${L[i.errorCode]}. Message: ${i.message??"None"}. Underlying error: ${i.underlyingErrorMessage??"None"}`)});function l(){switch(i.errorCode){case L.UnknownError:return"An unknown error occurred.";case L.ErrorSettingUpPurchase:return"Purchase not started due to an error.";case L.ErrorChargingPayment:return"Payment failed.";case L.NetworkError:return"Network error. Please check your internet connection.";case L.StripeError:return i.message;case L.MissingEmailError:return"Email is required to complete the purchase.";case L.AlreadySubscribedError:return"You are already subscribed to this product."}return i.message}function c(){switch(i.errorCode){case L.AlreadySubscribedError:return"Already subscribed";default:return"Something went wrong"}}return t.$$set=a=>{"brandingInfo"in a&&r(0,n=a.brandingInfo),"lastError"in a&&r(5,i=a.lastError),"supportEmail"in a&&r(1,o=a.supportEmail),"onContinue"in a&&r(2,s=a.onContinue)},[n,o,s,l,c,i]}class Ur extends U{constructor(e){super(),N(this,e,Nr,Tr,T,{brandingInfo:0,lastError:5,supportEmail:1,onContinue:2})}}const Rr="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 Sr(t){F(t,"svelte-1609h93","img.svelte-1609h93{width:124px;height:124px;margin:0 auto}")}function Or(t){let e,r;return{c(){e=k("img"),ne(e.src,r=Rr)||_(e,"src",r),_(e,"alt","icon"),_(e,"class","rcb-ui-asset-icon svelte-1609h93")},m(n,i){p(n,e,i)},p:v,i:v,o:v,d(n){n&&g(e)}}}class Lr extends U{constructor(e){super(),N(this,e,null,Or,T,{},Sr)}}function Fr(t){let e;return{c(){e=O("Your plan is now active.")},m(r,n){p(r,e,n)},d(r){r&&g(e)}}}function xr(t){let e,r;return e=new Lr({props:{slot:"icon"}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p:v,i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Gr(t){let e,r;return e=new wt({props:{type:"success",title:"Purchase successful",brandingInfo:t[0],onContinue:t[1],$$slots:{icon:[xr],default:[Fr]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,[i]){const o={};i&1&&(o.brandingInfo=n[0]),i&2&&(o.onContinue=n[1]),i&4&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Yr(t,e,r){let{brandingInfo:n=null}=e,{onContinue:i}=e;return t.$$set=o=>{"brandingInfo"in o&&r(0,n=o.brandingInfo),"onContinue"in o&&r(1,i=o.onContinue)},[n,i]}class Hr extends U{constructor(e){super(),N(this,e,Yr,Gr,T,{brandingInfo:0,onContinue:1})}}function Kr(t,e,r,n,i={}){const o=r.create(e,i);return o.mount(t),o.on("change",s=>n("change",s)),o.on("ready",s=>n("ready",s)),o.on("focus",s=>n("focus",s)),o.on("blur",s=>n("blur",s)),o.on("escape",s=>n("escape",s)),o.on("click",s=>n("click",s)),o.on("loaderror",s=>n("loaderror",s)),o.on("loaderstart",s=>n("loaderstart",s)),o.on("networkschange",s=>n("networkschange",s)),o}const qr=typeof window>"u";function jr(t){if(!qr)return t.registerAppInfo({name:"svelte-stripe-js",url:"https://svelte-stripe-js.vercel.app"})}function Jr(t){let e;return{c(){e=k("div")},m(r,n){p(r,e,n),t[6](e)},p:v,i:v,o:v,d(r){r&&g(e),t[6](null)}}}function Vr(t,e,r){let n,i;const o=pn(),{elements:s}=An("stripe");let{options:l=void 0}=e;Me(()=>(n=Kr(i,"payment",s,o,l),()=>n.destroy()));function c(){n.blur()}function a(){n.clear()}function u(){n.destroy()}function m(){n.focus()}function A($){Pe[$?"unshift":"push"](()=>{i=$,r(0,i)})}return t.$$set=$=>{"options"in $&&r(1,l=$.options)},[i,l,c,a,u,m,A]}class Wr extends U{constructor(e){super(),N(this,e,Vr,Jr,T,{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 vt(t){let e;const r=t[15].default,n=J(r,t,t[14],null);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&16384)&&W(n,r,i,i[14],e?V(r,i[14],o,null):z(i[14]),null)},i(i){e||(f(n,i),e=!0)},o(i){d(n,i),e=!1},d(i){n&&n.d(i)}}}function zr(t){let e,r,n=t[1]&&t[0]&&vt(t);return{c(){n&&n.c(),e=re()},m(i,o){n&&n.m(i,o),p(i,e,o),r=!0},p(i,[o]){i[1]&&i[0]?n?(n.p(i,o),o&3&&f(n,1)):(n=vt(i),n.c(),f(n,1),n.m(e.parentNode,e)):n&&(K(),d(n,1,1,()=>{n=null}),q())},i(i){r||(f(n),r=!0)},o(i){d(n),r=!1},d(i){i&&g(e),n&&n.d(i)}}}function Xr(t,e,r){let n,{$$slots:i={},$$scope:o}=e,{stripe:s}=e,{mode:l=void 0}=e,{theme:c="stripe"}=e,{variables:a={}}=e,{rules:u={}}=e,{labels:m="above"}=e,{loader:A="auto"}=e,{fonts:$=[]}=e,{locale:E="auto"}=e,{currency:B=void 0}=e,{amount:h=void 0}=e,{clientSecret:y=void 0}=e,{elements:R=null}=e;return t.$$set=P=>{"stripe"in P&&r(1,s=P.stripe),"mode"in P&&r(2,l=P.mode),"theme"in P&&r(3,c=P.theme),"variables"in P&&r(4,a=P.variables),"rules"in P&&r(5,u=P.rules),"labels"in P&&r(6,m=P.labels),"loader"in P&&r(7,A=P.loader),"fonts"in P&&r(8,$=P.fonts),"locale"in P&&r(9,E=P.locale),"currency"in P&&r(10,B=P.currency),"amount"in P&&r(11,h=P.amount),"clientSecret"in P&&r(12,y=P.clientSecret),"elements"in P&&r(0,R=P.elements),"$$scope"in P&&r(14,o=P.$$scope)},t.$$.update=()=>{t.$$.dirty&120&&r(13,n={theme:c,variables:a,rules:u,labels:m}),t.$$.dirty&16263&&s&&!R&&(r(0,R=s.elements({mode:l,currency:B,amount:h,appearance:n,clientSecret:y,fonts:$,loader:A,locale:E})),jr(s),_n("stripe",{stripe:s,elements:R})),t.$$.dirty&8705&&R&&R.update({appearance:n,locale:E})},[R,s,l,c,a,u,m,A,$,E,B,h,y,n,o,i]}class Zr extends U{constructor(e){super(),N(this,e,Xr,zr,T,{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 $t="https://js.stripe.com/v3",ei=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,yt="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",ti=function(){for(var e=document.querySelectorAll('script[src^="'.concat($t,'"]')),r=0;r<e.length;r++){var n=e[r];if(ei.test(n.src))return n}return null},Bt=function(e){var r=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat($t).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},ni=function(e,r){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"2.4.0",startTime:r})},ve=null,Ne=null,Ue=null,ri=function(e){return function(){e(new Error("Failed to load Stripe.js"))}},ii=function(e,r){return function(){window.Stripe?e(window.Stripe):r(new Error("Stripe.js not available"))}},oi=function(e){return ve!==null?ve:(ve=new Promise(function(r,n){if(typeof window>"u"||typeof document>"u"){r(null);return}if(window.Stripe&&e&&console.warn(yt),window.Stripe){r(window.Stripe);return}try{var i=ti();if(i&&e)console.warn(yt);else if(!i)i=Bt(e);else if(i&&Ue!==null&&Ne!==null){var o;i.removeEventListener("load",Ue),i.removeEventListener("error",Ne),(o=i.parentNode)===null||o===void 0||o.removeChild(i),i=Bt(e)}Ue=ii(r,n),Ne=ri(n),i.addEventListener("load",Ue),i.addEventListener("error",Ne)}catch(s){n(s);return}}),ve.catch(function(r){return ve=null,Promise.reject(r)}))},si=function(e,r,n){if(e===null)return null;var i=e.apply(void 0,r);return ni(i,n),i},$e,Dt=!1,Mt=function(){return $e||($e=oi(null).catch(function(e){return $e=null,Promise.reject(e)}),$e)};Promise.resolve().then(function(){return Mt()}).catch(function(t){Dt||console.warn(t)});var li=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];Dt=!0;var i=Date.now();return Mt().then(function(o){return si(o,r,i)})};function ci(t){F(t,"svelte-1xe711j",".rcb-header-layout.svelte-1xe711j{display:flex;justify-content:space-between;align-items:center;width:100%;font-size:24px;margin:0;font-weight:500}")}function ai(t){let e,r;const n=t[0].default,i=J(n,t,t[1],null);return{c(){e=k("div"),i&&i.c(),_(e,"class","rcb-header-layout svelte-1xe711j")},m(o,s){p(o,e,s),i&&i.m(e,null),r=!0},p(o,s){i&&i.p&&(!r||s&2)&&W(i,n,o,o[1],r?V(n,o[1],s,null):z(o[1]),null)},i(o){r||(f(i,o),r=!0)},o(o){d(i,o),r=!1},d(o){o&&g(e),i&&i.d(o)}}}function ui(t){let e,r;return e=new fe({props:{as:"header",$$slots:{default:[ai]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,[i]){const o={};i&2&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function fi(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=o=>{"$$scope"in o&&r(1,i=o.$$scope)},[n,i]}class ze extends U{constructor(e){super(),N(this,e,fi,ui,T,{},ci)}}const di="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M18%208H17V6C17%203.24%2014.76%201%2012%201C9.24%201%207%203.24%207%206V8H6C4.9%208%204%208.9%204%2010V20C4%2021.1%204.9%2022%206%2022H18C19.1%2022%2020%2021.1%2020%2020V10C20%208.9%2019.1%208%2018%208ZM12%2017C10.9%2017%2010%2016.1%2010%2015C10%2013.9%2010.9%2013%2012%2013C13.1%2013%2014%2013.9%2014%2015C14%2016.1%2013.1%2017%2012%2017ZM15.1%208H8.9V6C8.9%204.29%2010.29%202.9%2012%202.9C13.71%202.9%2015.1%204.29%2015.1%206V8Z'%20fill='%2311D483'/%3e%3c/svg%3e";function mi(t){let e,r;return{c(){e=k("img"),ne(e.src,r=di)||_(e,"src",r),_(e,"alt","icon"),_(e,"class","rcb-ui-asset-icon")},m(n,i){p(n,e,i)},p:v,i:v,o:v,d(n){n&&g(e)}}}class gi extends U{constructor(e){super(),N(this,e,null,mi,T,{})}}const ye={error:"#f2545b",warning:"#f4e971",focus:"#000080","grey-text-dark":"#000000","grey-text-light":"#767676","grey-ui-dark":"#dfdfdf",white:"#ffffff"};function pi(t){F(t,"svelte-rjmul6",`.processing.svelte-rjmul6{width:12px;aspect-ratio:1;border-radius:50%;animation:svelte-rjmul6-l5 1.5s infinite linear}@keyframes svelte-rjmul6-l5{0%{box-shadow:20px 0 #fff2,
1
+ (function(H,Z){typeof exports=="object"&&typeof module<"u"?Z(exports):typeof define=="function"&&define.amd?define(["exports"],Z):(H=typeof globalThis<"u"?globalThis:H||self,Z(H.Purchases={}))})(this,function(H){"use strict";var ts=Object.defineProperty;var ns=(H,Z,x)=>Z in H?ts(H,Z,{enumerable:!0,configurable:!0,writable:!0,value:x}):H[Z]=x;var M=(H,Z,x)=>(ns(H,typeof Z!="symbol"?Z+"":Z,x),x);function Z(t){return t!=null}var x=(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))(x||{});class Y{static setLogLevel(e){this.logLevel=e}static log(e,r=this.logLevel){const n=`[Purchases] ${e}`;if(!(this.logLevel<r||r===x.Silent))switch(r){case x.Error:console.error(n);break;case x.Warn:console.warn(n);break;case x.Info:console.info(n);break;case x.Debug:console.debug(n);break;case x.Verbose:console.debug(n);break}}static errorLog(e){this.log(e,x.Error)}static warnLog(e){this.log(e,x.Warn)}static infoLog(e){this.log(e,x.Info)}static debugLog(e){this.log(e,x.Debug)}static verboseLog(e){this.log(e,x.Verbose)}}M(Y,"logLevel",x.Silent);var ie=(t=>(t.Year="year",t.Month="month",t.Week="week",t.Day="day",t))(ie||{});function xe(t){const e=t.match(/^PT?([0-9]+)([MDYW])$/);if(!e||e.length<3)return Y.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 Y.errorLog(`Invalid ISO 8601 unit duration format: ${t}`),null}}const Ge=(t,e)=>{const r=t/100;return new Intl.NumberFormat("en-US",{style:"currency",currency:e}).format(r)},jt=t=>{const e=t.number;if(e===1)switch(t.unit){case ie.Year:return"yearly";case ie.Month:return"monthly";case ie.Week:return"weekly";case ie.Day:return"daily"}else return`every ${e} ${t.unit}s`},Jt=t=>{const e=t.number;if(e===1)switch(t.unit){case ie.Year:return"1 year";case ie.Month:return"1 month";case ie.Week:return"1 week";case ie.Day:return"1 day"}else return`${e} ${t.unit}s`},nt=t=>{const e=xe(t);return e?jt(e):"unknown"},Vt=t=>{const e=xe(t);return e?Jt(e):"unknown"};var rt=(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))(rt||{});const Wt=t=>({amount:t.amount,currency:t.currency,formattedPrice:Ge(t.amount,t.currency)}),it=t=>{const e=t.period_duration;return{periodDuration:e,period:e?xe(e):null,cycleCount:t.cycle_count,price:t.price?Wt(t.price):null}},zt=t=>t.base==null?(Y.debugLog("Missing base phase for subscription option. Ignoring."),null):{id:t.id,base:it(t.base),trial:t.trial?it(t.trial):null},Xt=(t,e)=>{const r={};if(Object.entries(t.subscription_options).forEach(([s,l])=>{const c=zt(l);c!=null&&(r[s]=c)}),Object.keys(r).length===0)return Y.debugLog(`Product ${t.identifier} has no subscription options. Ignoring.`),null;const n=t.default_subscription_option_id,i=n&&n in r?r[n]:null;if(i==null)return Y.debugLog(`Product ${t.identifier} has no default subscription option. Ignoring.`),null;const o=i.base.price;return o==null?(Y.debugLog(`Product ${t.identifier} default option has no base price. Ignoring.`),null):{identifier:t.identifier,displayName:t.title,title:t.title,description:t.description,currentPrice:o,normalPeriodDuration:i.base.periodDuration,presentedOfferingIdentifier:e,defaultSubscriptionOption:i,subscriptionOptions:r}},Zt=(t,e,r)=>{const n=r[e.platform_product_identifier];if(n===void 0)return null;const i=Xt(n,t);return i===null?null:{identifier:e.identifier,rcBillingProduct:i,packageType:en(e.identifier)}},ot=(t,e)=>{const r=t.packages.map(i=>Zt(t.identifier,i,e)).filter(Z),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 en(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 tn(t,e){for(const r in e)t[r]=e[r];return t}function st(t){return t()}function lt(){return Object.create(null)}function me(t){t.forEach(st)}function se(t){return typeof t=="function"}function T(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let Be;function ne(t,e){return t===e?!0:(Be||(Be=document.createElement("a")),Be.href=e,t===Be.href)}function ct(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function nn(t,e){const r=ct(t.srcset),n=ct(e||"");return n.length===r.length&&n.every(([i,o],s)=>o===r[s][1]&&(ne(r[s][0],i)||ne(i,r[s][0])))}function rn(t){return Object.keys(t).length===0}function J(t,e,r,n){if(t){const i=at(t,e,r,n);return t[0](i)}}function at(t,e,r,n){return t[1]&&n?tn(r.ctx.slice(),t[1](n(e))):r.ctx}function V(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 o=[],s=Math.max(e.dirty.length,i.length);for(let l=0;l<s;l+=1)o[l]=e.dirty[l]|i[l];return o}return e.dirty|i}return e.dirty}function W(t,e,r,n,i,o){if(i){const s=at(e,r,n,o);t.p(s,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 P(t,e){t.appendChild(e)}function F(t,e,r){const n=on(t);if(!n.getElementById(e)){const i=k("style");i.id=e,i.textContent=r,sn(n,i)}}function on(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function sn(t,e){return P(t.head||t,e),e.sheet}function p(t,e,r){t.insertBefore(e,r||null)}function g(t){t.parentNode&&t.parentNode.removeChild(t)}function k(t){return document.createElement(t)}function O(t){return document.createTextNode(t)}function Q(){return O(" ")}function re(){return O("")}function pe(t,e,r,n){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r,n)}function ut(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 ln=["width","height"];function cn(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&&ln.indexOf(n)===-1?t[n]=e[n]:h(t,n,e[n])}function an(t,e){Object.keys(e).forEach(r=>{un(t,r,e[r])})}function un(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 fn(t){return/-/.test(t)?an:cn}function dn(t){return Array.from(t.childNodes)}function le(t,e){e=""+e,t.data!==e&&(t.data=e)}function ft(t,e){t.value=e??""}function mn(t,e,{bubbles:r=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:r,cancelable:n})}let he;function _e(t){he=t}function Ae(){if(!he)throw new Error("Function called outside component initialization");return he}function gn(t){Ae().$$.before_update.push(t)}function De(t){Ae().$$.on_mount.push(t)}function pn(){const t=Ae();return(e,r,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=mn(e,r,{cancelable:n});return i.slice().forEach(s=>{s.call(t,o)}),!o.defaultPrevented}return!0}}function hn(t,e){return Ae().$$.context.set(t,e),e}function _n(t){return Ae().$$.context.get(t)}function dt(t,e){const r=t.$$.callbacks[e.type];r&&r.slice().forEach(n=>n.call(this,e))}const ce=[],Pe=[];let ae=[];const Ye=[],An=Promise.resolve();let He=!1;function En(){He||(He=!0,An.then(mt))}function Ke(t){ae.push(t)}function bn(t){Ye.push(t)}const qe=new Set;let ue=0;function mt(){if(ue!==0)return;const t=he;do{try{for(;ue<ce.length;){const e=ce[ue];ue++,_e(e),In(e.$$)}}catch(e){throw ce.length=0,ue=0,e}for(_e(null),ce.length=0,ue=0;Pe.length;)Pe.pop()();for(let e=0;e<ae.length;e+=1){const r=ae[e];qe.has(r)||(qe.add(r),r())}ae.length=0}while(ce.length);for(;Ye.length;)Ye.pop()();He=!1,qe.clear(),_e(t)}function In(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(Ke)}}function wn(t){const e=[],r=[];ae.forEach(n=>t.indexOf(n)===-1?e.push(n):r.push(n)),r.forEach(n=>n()),ae=e}const Ce=new Set;let oe;function K(){oe={r:0,c:[],p:oe}}function q(){oe.r||me(oe.c),oe=oe.p}function f(t,e){t&&t.i&&(Ce.delete(t),t.i(e))}function d(t,e,r,n){if(t&&t.o){if(Ce.has(t))return;Ce.add(t),oe.c.push(()=>{Ce.delete(t),n&&(r&&t.d(1),n())}),t.o(e)}else n&&n()}function kn(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 b(t,e,r){const{fragment:n,after_update:i}=t.$$;n&&n.m(e,r),Ke(()=>{const o=t.$$.on_mount.map(st).filter(se);t.$$.on_destroy?t.$$.on_destroy.push(...o):me(o),t.$$.on_mount=[]}),i.forEach(Ke)}function I(t,e){const r=t.$$;r.fragment!==null&&(wn(r.after_update),me(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function yn(t,e){t.$$.dirty[0]===-1&&(ce.push(t),En(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function N(t,e,r,n,i,o,s=null,l=[-1]){const c=he;_e(t);const a=t.$$={fragment:null,ctx:[],props:o,update:y,not_equal:i,bound:lt(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:lt(),dirty:l,skip_bound:!1,root:e.target||c.$$.root};s&&s(a.root);let u=!1;if(a.ctx=r?r(t,e.props||{},(m,_,...v)=>{const E=v.length?v[0]:_;return a.ctx&&i(a.ctx[m],a.ctx[m]=E)&&(!a.skip_bound&&a.bound[m]&&a.bound[m](E),u&&yn(t,m)),_}):[],a.update(),u=!0,me(a.before_update),a.fragment=n?n(a.ctx):!1,e.target){if(e.hydrate){const m=dn(e.target);a.fragment&&a.fragment.l(m),m.forEach(g)}else a.fragment&&a.fragment.c();e.intro&&f(t.$$.fragment),b(t,e.target,e.anchor),mt()}_e(c)}class U{constructor(){M(this,"$$");M(this,"$$set")}$destroy(){I(this,1),this.$destroy=y}$on(e,r){if(!se(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&&!rn(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const vn="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(vn);function $n(t){F(t,"svelte-1bzqb13",".rcb-modal-section.svelte-1bzqb13{padding:8px 0px;display:flex}section.rcb-modal-section.svelte-1bzqb13{flex-grow:1}.rcb-modal-section.svelte-1bzqb13:last-of-type{padding:0}")}function je(t){let e,r;const n=t[2].default,i=J(n,t,t[1],null);return{c(){e=k(t[0]),i&&i.c(),fn(t[0])(e,{class:ge("rcb-modal-section")+" svelte-1bzqb13"})},m(o,s){p(o,e,s),i&&i.m(e,null),r=!0},p(o,s){i&&i.p&&(!r||s&2)&&W(i,n,o,o[1],r?V(n,o[1],s,null):z(o[1]),null)},i(o){r||(f(i,o),r=!0)},o(o){d(i,o),r=!1},d(o){o&&g(e),i&&i.d(o)}}}function Bn(t){let e=t[0],r,n,i=t[0]&&je(t);return{c(){i&&i.c(),r=re()},m(o,s){i&&i.m(o,s),p(o,r,s),n=!0},p(o,[s]){o[0]?e?T(e,o[0])?(i.d(1),i=je(o),e=o[0],i.c(),i.m(r.parentNode,r)):i.p(o,s):(i=je(o),e=o[0],i.c(),i.m(r.parentNode,r)):e&&(i.d(1),i=null,e=o[0])},i(o){n||(f(i,o),n=!0)},o(o){d(i,o),n=!1},d(o){o&&g(r),i&&i.d(o)}}}function Dn(t,e,r){let{$$slots:n={},$$scope:i}=e,{as:o="section"}=e;return t.$$set=s=>{"as"in s&&r(0,o=s.as),"$$scope"in s&&r(1,i=s.$$scope)},[o,i,n]}class fe extends U{constructor(e){super(),N(this,e,Dn,Bn,T,{as:0},$n)}}function Pn(t){F(t,"svelte-gf0gr5",".rcb-pricing-info.svelte-gf0gr5{display:flex;flex-direction:column;margin-top:102px;font-weight:500}.rcb-product-price.svelte-gf0gr5{font-size:24px;margin:12px 0px}.rcb-product-price-after-trial.svelte-gf0gr5{margin-bottom:12px}.rcb-product-details.svelte-gf0gr5{opacity:0.6;list-style-type:disc;list-style-position:inside;margin:0px;padding:0px}@media screen and (max-width: 960px){.rcb-pricing-info.svelte-gf0gr5{margin-top:48px}}")}function Cn(t){let e=Vt(t[1].periodDuration)+"",r,n;return{c(){r=O(e),n=O(" free trial")},m(i,o){p(i,r,o),p(i,n,o)},p:y,d(i){i&&(g(r),g(n))}}}function Mn(t){let e=(t[2].currency||"")+"",r,n,i=Ge(t[2].amount,t[2].currency)+"",o;return{c(){r=O(e),n=Q(),o=O(i)},m(s,l){p(s,r,l),p(s,n,l),p(s,o,l)},p:y,d(s){s&&(g(r),g(n),g(o))}}}function Qn(t){let e;return{c(){e=k("span"),e.textContent=`${t[1]&&t[2]&&`${t[2].currency} ${Ge(t[2].amount,t[2].currency)} after end of trial`}`,h(e,"class","rcb-product-price-after-trial svelte-gf0gr5")},m(r,n){p(r,e,n)},p:y,d(r){r&&g(e)}}}function gt(t){let e,r,n=nt(t[0].normalPeriodDuration)+"",i;return{c(){e=k("li"),r=O("Renews "),i=O(n)},m(o,s){p(o,e,s),P(e,r),P(e,i)},p(o,s){s&1&&n!==(n=nt(o[0].normalPeriodDuration)+"")&&le(i,n)},d(o){o&&g(e)}}}function Tn(t){var C,Oe;let e,r,n=t[0].displayName+"",i,o,s,l,c,a,u,m,_,v,E,B=((C=t[1])==null?void 0:C.periodDuration)&&Cn(t),A=!((Oe=t[1])!=null&&Oe.periodDuration)&&t[2]&&Mn(t),$=t[1]&&t[2]&&Qn(t),R=t[0].normalPeriodDuration&&gt(t);return{c(){e=k("div"),r=k("span"),i=O(n),o=Q(),s=k("span"),B&&B.c(),l=Q(),A&&A.c(),c=Q(),$&&$.c(),a=Q(),u=k("ul"),R&&R.c(),m=Q(),_=k("li"),_.textContent="Continues until canceled",v=Q(),E=k("li"),E.textContent="Cancel anytime",h(s,"class","rcb-product-price svelte-gf0gr5"),h(u,"class","rcb-product-details svelte-gf0gr5"),h(e,"class","rcb-pricing-info svelte-gf0gr5")},m(G,S){p(G,e,S),P(e,r),P(r,i),P(e,o),P(e,s),B&&B.m(s,null),P(s,l),A&&A.m(s,null),P(e,c),$&&$.m(e,null),P(e,a),P(e,u),R&&R.m(u,null),P(u,m),P(u,_),P(u,v),P(u,E)},p(G,S){var Le,Fe;S&1&&n!==(n=G[0].displayName+"")&&le(i,n),(Le=G[1])!=null&&Le.periodDuration&&B.p(G,S),!((Fe=G[1])!=null&&Fe.periodDuration)&&G[2]&&A.p(G,S),G[1]&&G[2]&&$.p(G,S),G[0].normalPeriodDuration?R?R.p(G,S):(R=gt(G),R.c(),R.m(u,m)):R&&(R.d(1),R=null)},d(G){G&&g(e),B&&B.d(),A&&A.d(),$&&$.d(),R&&R.d()}}}function Nn(t){let e,r;return e=new fe({props:{$$slots:{default:[Tn]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,[i]){const o={};i&33&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Un(t,e,r){var c;let{productDetails:n}=e,{purchaseOption:i}=e;const o=i,s=o==null?void 0:o.trial,l=(c=o==null?void 0:o.base)==null?void 0:c.price;return t.$$set=a=>{"productDetails"in a&&r(0,n=a.productDetails),"purchaseOption"in a&&r(3,i=a.purchaseOption)},[n,s,l,i]}class pt extends U{constructor(e){super(),N(this,e,Un,Nn,T,{productDetails:0,purchaseOption:3},Pn)}}const Rn="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/wCzcBFIcKDBgggPKkzIcCEXLlq4bIEokeLE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AACJQAAwgcSLCgwRIkDCpcqIHDwoFHHm7Y8DCACgMJFWroUBGHgQNMFE6sGGDCAQsaHVY8csAAD4MjSX4w8MDgRpIBoCQwsKIgQpwBUBxIULEHkYcUUC580tDEE6AGbXSYKKMKVIJSUnDQIGIHl6sQS0w8AZagjxAsyqpdy7at24pJfgwBMkQukCRQjQQBIgTIXiFGoAYEACH5BAUFAAEALAMAAwAXABcAAAiVAAMIHEiwoMEMGQwqXPggwsKBTLQshPDgYYAaD1owdPjQB4QIThRGgGAxwIYIIBQ2LMlkJBCDFEsGOPEgA5aCK0tKmQChRkGEMgPIiDDhoRYjTR56CPGwiooXN6oENQikhYsWP65MJXglx4sVMoZsJdikRosWOMYSRPJih9q3cOPKnWuRSxa7eO9O3cJFCxe+frdMDQgAIfkEBQUAAQAsBQADACAAEAAACKYAAwgcSLAgwQcODCpcyNDAAYYQAzhpaIDhFYY+NOBY6HAhkyETFRLZ0CGKQgMVDV4RAoQKQxMdUpx8aJAJECYQnWzYcMQgSoNVgAy5CHGGhhI+aRIkMgRnxCohNvQoiLDgEyFDskQUuINDiK1Hfpgc+ETKQi0nVGxNkkSrwCw/hiBxu7XuFidAhARpgqWu3yxIhgApEtLvVipIgARBYthvlKaNFQYEADs=";function Sn(t){let e,r;return{c(){e=k("img"),ne(e.src,r=Rn)||h(e,"src",r),h(e,"alt","spinner")},m(n,i){p(n,e,i)},p:y,i:y,o:y,d(n){n&&g(e)}}}class On extends U{constructor(e){super(),N(this,e,null,Sn,T,{})}}function Ln(t){F(t,"svelte-1mxx341",".rcb-modal-loader.svelte-1mxx341{width:100%;flex-grow:1;min-height:100%;display:flex;justify-content:center;align-items:center}")}function Fn(t){let e,r,n;return r=new On({}),{c(){e=k("div"),w(r.$$.fragment),h(e,"class","rcb-modal-loader svelte-1mxx341")},m(i,o){p(i,e,o),b(r,e,null),n=!0},p:y,i(i){n||(f(r.$$.fragment,i),n=!0)},o(i){d(r.$$.fragment,i),n=!1},d(i){i&&g(e),I(r)}}}class Je extends U{constructor(e){super(),N(this,e,null,Fn,T,{},Ln)}}var ee=(t=>(t[t.UnknownError=0]="UnknownError",t[t.UserCancelledError=1]="UserCancelledError",t[t.StoreProblemError=2]="StoreProblemError",t[t.PurchaseNotAllowedError=3]="PurchaseNotAllowedError",t[t.PurchaseInvalidError=4]="PurchaseInvalidError",t[t.ProductNotAvailableForPurchaseError=5]="ProductNotAvailableForPurchaseError",t[t.ProductAlreadyPurchasedError=6]="ProductAlreadyPurchasedError",t[t.ReceiptAlreadyInUseError=7]="ReceiptAlreadyInUseError",t[t.InvalidReceiptError=8]="InvalidReceiptError",t[t.MissingReceiptFileError=9]="MissingReceiptFileError",t[t.NetworkError=10]="NetworkError",t[t.InvalidCredentialsError=11]="InvalidCredentialsError",t[t.UnexpectedBackendResponseError=12]="UnexpectedBackendResponseError",t[t.InvalidAppUserIdError=14]="InvalidAppUserIdError",t[t.OperationAlreadyInProgressError=15]="OperationAlreadyInProgressError",t[t.UnknownBackendError=16]="UnknownBackendError",t[t.InvalidAppleSubscriptionKeyError=17]="InvalidAppleSubscriptionKeyError",t[t.IneligibleError=18]="IneligibleError",t[t.InsufficientPermissionsError=19]="InsufficientPermissionsError",t[t.PaymentPendingError=20]="PaymentPendingError",t[t.InvalidSubscriberAttributesError=21]="InvalidSubscriberAttributesError",t[t.LogOutWithAnonymousUserError=22]="LogOutWithAnonymousUserError",t[t.ConfigurationError=23]="ConfigurationError",t[t.UnsupportedError=24]="UnsupportedError",t[t.EmptySubscriberAttributesError=25]="EmptySubscriberAttributesError",t[t.CustomerInfoError=28]="CustomerInfoError",t[t.SignatureVerificationError=36]="SignatureVerificationError",t[t.InvalidEmailError=38]="InvalidEmailError",t))(ee||{});class Ee{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.";case 38:return"Email is not valid. Please provide a valid email address."}}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:case 7814:return 4;case 7772:return 6;case 7220:return 14;case 7229:return 2;case 7230:case 7e3:return 23;case 7231:return 2;case 7232:return 18;case 7263:case 7264:return 21;case 7104:case 7234:case 7226:case 7110:return 12;case 7662:return 24;case 7012:case 7834:return 38}}static convertCodeToBackendErrorCode(e){return e in ht?e:null}static convertPurchaseFlowErrorCodeToErrorCode(e){switch(e){case L.ErrorSettingUpPurchase:return 2;case L.ErrorChargingPayment:return 20;case L.NetworkError:return 10;case L.MissingEmailError:return 4;case L.StripeError:return 2;case L.UnknownError:return 0;case L.AlreadySubscribedError:return 6}}}var ht=(t=>(t[t.BackendInvalidPlatform=7e3]="BackendInvalidPlatform",t[t.BackendInvalidEmail=7012]="BackendInvalidEmail",t[t.BackendStoreProblem=7101]="BackendStoreProblem",t[t.BackendCannotTransferPurchase=7102]="BackendCannotTransferPurchase",t[t.BackendInvalidReceiptToken=7103]="BackendInvalidReceiptToken",t[t.BackendInvalidAppStoreSharedSecret=7104]="BackendInvalidAppStoreSharedSecret",t[t.BackendInvalidPaymentModeOrIntroPriceNotProvided=7105]="BackendInvalidPaymentModeOrIntroPriceNotProvided",t[t.BackendProductIdForGoogleReceiptNotProvided=7106]="BackendProductIdForGoogleReceiptNotProvided",t[t.BackendInvalidPlayStoreCredentials=7107]="BackendInvalidPlayStoreCredentials",t[t.BackendInternalServerError=7110]="BackendInternalServerError",t[t.BackendEmptyAppUserId=7220]="BackendEmptyAppUserId",t[t.BackendInvalidAuthToken=7224]="BackendInvalidAuthToken",t[t.BackendInvalidAPIKey=7225]="BackendInvalidAPIKey",t[t.BackendBadRequest=7226]="BackendBadRequest",t[t.BackendPlayStoreQuotaExceeded=7229]="BackendPlayStoreQuotaExceeded",t[t.BackendPlayStoreInvalidPackageName=7230]="BackendPlayStoreInvalidPackageName",t[t.BackendPlayStoreGenericError=7231]="BackendPlayStoreGenericError",t[t.BackendUserIneligibleForPromoOffer=7232]="BackendUserIneligibleForPromoOffer",t[t.BackendInvalidAppleSubscriptionKey=7234]="BackendInvalidAppleSubscriptionKey",t[t.BackendInvalidSubscriberAttributes=7263]="BackendInvalidSubscriberAttributes",t[t.BackendInvalidSubscriberAttributesBody=7264]="BackendInvalidSubscriberAttributesBody",t[t.BackendProductIDsMalformed=7662]="BackendProductIDsMalformed",t[t.BackendAlreadySubscribedError=7772]="BackendAlreadySubscribedError",t[t.BackendOfferNotFound=7814]="BackendOfferNotFound",t[t.BackendNoMXRecordsFound=7834]="BackendNoMXRecordsFound",t))(ht||{});class X extends Error{constructor(r,n,i){super(n);M(this,"toString",()=>`PurchasesError(code: ${ee[this.errorCode]}, message: ${this.message})`);this.errorCode=r,this.underlyingErrorMessage=i}static getForBackendError(r,n){const i=Ee.getErrorCodeForBackendErrorCode(r);return new X(i,Ee.getPublicMessage(i),n)}static getForPurchasesFlowError(r){return new X(Ee.convertPurchaseFlowErrorCodeToErrorCode(r.errorCode),r.message,r.underlyingErrorMessage)}}class _t extends Error{constructor(){super("Purchases must be configured before calling getInstance")}}var be=(t=>(t.Started="started",t.InProgress="in_progress",t.Succeeded="succeeded",t.Failed="failed",t))(be||{}),Me=(t=>(t[t.SetupIntentCreationFailed=1]="SetupIntentCreationFailed",t[t.PaymentMethodCreationFailed=2]="PaymentMethodCreationFailed",t[t.PaymentChargeFailed=3]="PaymentChargeFailed",t))(Me||{}),L=(t=>(t[t.ErrorSettingUpPurchase=0]="ErrorSettingUpPurchase",t[t.ErrorChargingPayment=1]="ErrorChargingPayment",t[t.UnknownError=2]="UnknownError",t[t.NetworkError=3]="NetworkError",t[t.StripeError=4]="StripeError",t[t.MissingEmailError=5]="MissingEmailError",t[t.AlreadySubscribedError=6]="AlreadySubscribedError",t))(L||{});class j extends Error{constructor(e,r,n){super(r),this.errorCode=e,this.underlyingErrorMessage=n}static fromPurchasesError(e,r){let n;return e.errorCode===ee.ProductAlreadyPurchasedError?n=6:e.errorCode===ee.InvalidEmailError?n=5:n=r,new j(n,e.message,e.underlyingErrorMessage)}}class xn{constructor(e,r=10){M(this,"operationSessionId",null);M(this,"backend");M(this,"maxNumberAttempts");M(this,"waitMSBetweenAttempts",1e3);this.backend=e,this.maxNumberAttempts=r}async startPurchase(e,r,n,i,o){try{const s=await this.backend.postSubscribe(e,r,i,o,n==null?void 0:n.id);return this.operationSessionId=s.operation_session_id,s}catch(s){if(s instanceof X)throw j.fromPurchasesError(s,0);{const l="Unknown error starting purchase: "+String(s);throw Y.errorLog(l),new j(2,l)}}}async pollCurrentPurchaseForCompletion(){const e=this.operationSessionId;if(!e)throw new j(0,"No purchase in progress");return new Promise((r,n)=>{const i=(o=1)=>{if(o>this.maxNumberAttempts){this.clearPurchaseInProgress(),n(new j(2,"Max attempts reached trying to get successful purchase status"));return}this.backend.getCheckoutStatus(e).then(s=>{switch(s.operation.status){case be.Started:case be.InProgress:setTimeout(()=>i(o+1),this.waitMSBetweenAttempts);break;case be.Succeeded:this.clearPurchaseInProgress(),r();return;case be.Failed:this.clearPurchaseInProgress(),this.handlePaymentError(s.operation.error,n)}}).catch(s=>{const l=j.fromPurchasesError(s,3);n(l)})};i()})}clearPurchaseInProgress(){this.operationSessionId=null}handlePaymentError(e,r){if(e==null){r(new j(2,"Got an error status but error field is empty."));return}switch(e.code){case Me.SetupIntentCreationFailed:r(new j(0,"Setup intent creation failed"));return;case Me.PaymentMethodCreationFailed:r(new j(0,"Payment method creation failed"));return;case Me.PaymentChargeFailed:r(new j(1,"Payment charge failed"));return}}}const Gn="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 Yn(t){F(t,"svelte-1609h93","img.svelte-1609h93{width:124px;height:124px;margin:0 auto}")}function Hn(t){let e,r;return{c(){e=k("img"),ne(e.src,r=Gn)||h(e,"src",r),h(e,"alt","icon"),h(e,"class","rcb-ui-asset-icon svelte-1609h93")},m(n,i){p(n,e,i)},p:y,i:y,o:y,d(n){n&&g(e)}}}class Kn extends U{constructor(e){super(),N(this,e,null,Hn,T,{},Yn)}}function qn(t){F(t,"svelte-1rmxk7q","button.svelte-1rmxk7q{border:none;border-radius:56px;font-size:16px;cursor:pointer;height:56px;color:var(--rc-color-grey-text-dark);background-color:var(--rc-color-grey-ui-dark);display:flex;align-items:center;justify-content:center}button.intent-primary.svelte-1rmxk7q{background-color:var(--rc-color-grey-text-dark);color:var(--rc-color-white);font-size:16px}button.svelte-1rmxk7q:disabled{color:var(--rc-color-grey-text-light)}button.intent-primary.svelte-1rmxk7q:disabled{color:var(--rc-color-grey-text-light)}")}function jn(t){let e,r,n,i,o;const s=t[3].default,l=J(s,t,t[2],null);return{c(){e=k("button"),l&&l.c(),h(e,"class",r=ge(`intent-${t[0]}`)+" svelte-1rmxk7q"),e.disabled=t[1]},m(c,a){p(c,e,a),l&&l.m(e,null),n=!0,i||(o=pe(e,"click",t[4]),i=!0)},p(c,[a]){l&&l.p&&(!n||a&4)&&W(l,s,c,c[2],n?V(s,c[2],a,null):z(c[2]),null),(!n||a&1&&r!==(r=ge(`intent-${c[0]}`)+" svelte-1rmxk7q"))&&h(e,"class",r),(!n||a&2)&&(e.disabled=c[1])},i(c){n||(f(l,c),n=!0)},o(c){d(l,c),n=!1},d(c){c&&g(e),l&&l.d(c),i=!1,o()}}}function Jn(t,e,r){let{$$slots:n={},$$scope:i}=e,{intent:o="primary"}=e,{disabled:s=!1}=e;function l(c){dt.call(this,t,c)}return t.$$set=c=>{"intent"in c&&r(0,o=c.intent),"disabled"in c&&r(1,s=c.disabled),"$$scope"in c&&r(2,i=c.$$scope)},[o,s,i,n,l]}class Ie extends U{constructor(e){super(),N(this,e,Jn,jn,T,{intent:0,disabled:1},qn)}}function Vn(t){F(t,"svelte-1f9z0o8","footer.svelte-1f9z0o8{display:flex;flex-direction:column}")}function Wn(t){let e,r;const n=t[1].default,i=J(n,t,t[0],null);return{c(){e=k("footer"),i&&i.c(),h(e,"class","rcb-modal-footer svelte-1f9z0o8")},m(o,s){p(o,e,s),i&&i.m(e,null),r=!0},p(o,[s]){i&&i.p&&(!r||s&1)&&W(i,n,o,o[0],r?V(n,o[0],s,null):z(o[0]),null)},i(o){r||(f(i,o),r=!0)},o(o){d(i,o),r=!1},d(o){o&&g(e),i&&i.d(o)}}}function zn(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=o=>{"$$scope"in o&&r(0,i=o.$$scope)},[i,n]}class Ve extends U{constructor(e){super(),N(this,e,zn,Wn,T,{},Vn)}}function Xn(t){F(t,"svelte-6o8e90",'.column.svelte-6o8e90{display:flex;flex-direction:column;justify-content:flex-start;gap:var(--gap, "8px");flex-grow:1}')}function Zn(t){let e,r,n;const i=t[2].default,o=J(i,t,t[1],null);return{c(){e=k("div"),o&&o.c(),h(e,"class","column svelte-6o8e90"),h(e,"style",r=`--gap:${t[0]};`)},m(s,l){p(s,e,l),o&&o.m(e,null),n=!0},p(s,[l]){o&&o.p&&(!n||l&2)&&W(o,i,s,s[1],n?V(i,s[1],l,null):z(s[1]),null),(!n||l&1&&r!==(r=`--gap:${s[0]};`))&&h(e,"style",r)},i(s){n||(f(o,s),n=!0)},o(s){d(o,s),n=!1},d(s){s&&g(e),o&&o.d(s)}}}function er(t,e,r){let{$$slots:n={},$$scope:i}=e,{gutter:o="8px"}=e;return t.$$set=s=>{"gutter"in s&&r(0,o=s.gutter),"$$scope"in s&&r(1,i=s.$$scope)},[o,i,n]}class we extends U{constructor(e){super(),N(this,e,er,Zn,T,{gutter:0},Xn)}}const tr="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 nr(t){F(t,"svelte-14xreta",".close-button.svelte-14xreta{border:none;cursor:pointer;background-color:transparent;padding:0px}")}function rr(t){let e,r,n,i,o;return{c(){e=k("button"),r=k("img"),ne(r.src,n=tr)||h(r,"src",n),h(r,"alt","close"),h(e,"class","close-button svelte-14xreta"),e.disabled=t[0]},m(s,l){p(s,e,l),P(e,r),i||(o=pe(e,"click",t[1]),i=!0)},p(s,[l]){l&1&&(e.disabled=s[0])},i:y,o:y,d(s){s&&g(e),i=!1,o()}}}function ir(t,e,r){let{disabled:n=!1}=e;function i(o){dt.call(this,t,o)}return t.$$set=o=>{"disabled"in o&&r(0,n=o.disabled)},[n,i]}class or extends U{constructor(e){super(),N(this,e,ir,rr,T,{disabled:0},nr)}}function sr(t){F(t,"svelte-44qpq9",".rcb-app-icon.svelte-44qpq9{width:40px;height:40px;border-radius:12px;box-shadow:0px 1px 10px 0px rgba(0, 0, 0, 0.1);margin-right:16px}.rcb-app-icon-picture-container.svelte-44qpq9{height:40px}.rcb-app-icon.loading.svelte-44qpq9{background-color:gray}")}function lr(t){let e;return{c(){e=k("div"),h(e,"class","rcb-app-icon loading svelte-44qpq9")},m(r,n){p(r,e,n)},p:y,d(r){r&&g(e)}}}function cr(t){let e,r,n,i,o,s;return{c(){e=k("picture"),r=k("source"),i=Q(),o=k("img"),h(r,"type","image/webp"),nn(r,n=t[1])||h(r,"srcset",n),h(o,"class","rcb-app-icon svelte-44qpq9"),ne(o.src,s=t[0])||h(o,"src",s),h(o,"alt","App icon"),h(e,"class","rcb-app-icon-picture-container svelte-44qpq9")},m(l,c){p(l,e,c),P(e,r),P(e,i),P(e,o)},p(l,c){c&2&&n!==(n=l[1])&&h(r,"srcset",n),c&1&&!ne(o.src,s=l[0])&&h(o,"src",s)},d(l){l&&g(e)}}}function ar(t){let e;function r(o,s){return o[0]!==null?cr:lr}let n=r(t),i=n(t);return{c(){i.c(),e=re()},m(o,s){i.m(o,s),p(o,e,s)},p(o,[s]){n===(n=r(o))&&i?i.p(o,s):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:y,o:y,d(o){o&&g(e),i.d(o)}}}function ur(t,e,r){let{src:n=null}=e,{srcWebp:i=null}=e;return t.$$set=o=>{"src"in o&&r(0,n=o.src),"srcWebp"in o&&r(1,i=o.srcWebp)},[n,i]}class At extends U{constructor(e){super(),N(this,e,ur,ar,T,{src:0,srcWebp:1},sr)}}const Qe=t=>`https://da08ctfrofx1b.cloudfront.net/${t}`;function fr(t){F(t,"svelte-10uf5fq",".app-title.svelte-10uf5fq{font-weight:500;margin:8px 0;font-size:16px}.rcb-header-layout__business-info.svelte-10uf5fq{display:flex;align-items:center}")}function dr(t){let e,r;return e=new At({}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p:y,i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function mr(t){let e,r,n=t[0].seller_company_name+"",i,o,s=t[0].app_icon_webp!==null&&t[0].app_icon!==null&&Et(t);return{c(){s&&s.c(),e=Q(),r=k("span"),i=O(n),h(r,"class","app-title svelte-10uf5fq")},m(l,c){s&&s.m(l,c),p(l,e,c),p(l,r,c),P(r,i),o=!0},p(l,c){l[0].app_icon_webp!==null&&l[0].app_icon!==null?s?(s.p(l,c),c&1&&f(s,1)):(s=Et(l),s.c(),f(s,1),s.m(e.parentNode,e)):s&&(K(),d(s,1,1,()=>{s=null}),q()),(!o||c&1)&&n!==(n=l[0].seller_company_name+"")&&le(i,n)},i(l){o||(f(s),o=!0)},o(l){d(s),o=!1},d(l){l&&(g(e),g(r)),s&&s.d(l)}}}function Et(t){let e,r;return e=new At({props:{src:Qe(t[0].app_icon),srcWebp:Qe(t[0].app_icon_webp)}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){const o={};i&1&&(o.src=Qe(n[0].app_icon)),i&1&&(o.srcWebp=Qe(n[0].app_icon_webp)),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function gr(t){let e,r,n,i;const o=[mr,dr],s=[];function l(c,a){return c[0]!==null?0:1}return r=l(t),n=s[r]=o[r](t),{c(){e=k("div"),n.c(),h(e,"class","rcb-header-layout__business-info svelte-10uf5fq")},m(c,a){p(c,e,a),s[r].m(e,null),i=!0},p(c,[a]){let u=r;r=l(c),r===u?s[r].p(c,a):(K(),d(s[u],1,1,()=>{s[u]=null}),q(),n=s[r],n?n.p(c,a):(n=s[r]=o[r](c),n.c()),f(n,1),n.m(e,null))},i(c){i||(f(n),i=!0)},o(c){d(n),i=!1},d(c){c&&g(e),s[r].d()}}}function pr(t,e,r){let{brandingInfo:n=null}=e;return t.$$set=i=>{"brandingInfo"in i&&r(0,n=i.brandingInfo)},[n]}class bt extends U{constructor(e){super(),N(this,e,pr,gr,T,{brandingInfo:0},fr)}}function hr(t){F(t,"svelte-17puakv",".rcb-post-purchase-header-layout.svelte-17puakv{display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:-4px}")}function _r(t){let e,r,n,i,o;return r=new bt({props:{brandingInfo:t[0]}}),i=new or({}),i.$on("click",function(){se(t[1])&&t[1].apply(this,arguments)}),{c(){e=k("div"),w(r.$$.fragment),n=Q(),w(i.$$.fragment),h(e,"class","rcb-post-purchase-header-layout svelte-17puakv")},m(s,l){p(s,e,l),b(r,e,null),P(e,n),b(i,e,null),o=!0},p(s,l){t=s;const c={};l&1&&(c.brandingInfo=t[0]),r.$set(c)},i(s){o||(f(r.$$.fragment,s),f(i.$$.fragment,s),o=!0)},o(s){d(r.$$.fragment,s),d(i.$$.fragment,s),o=!1},d(s){s&&g(e),I(r),I(i)}}}function Ar(t){let e,r;return e=new fe({props:{as:"header",$$slots:{default:[_r]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,[i]){const o={};i&7&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Er(t,e,r){let{brandingInfo:n=null}=e,{onClose:i}=e;return t.$$set=o=>{"brandingInfo"in o&&r(0,n=o.brandingInfo),"onClose"in o&&r(1,i=o.onClose)},[n,i]}class br extends U{constructor(e){super(),N(this,e,Er,Ar,T,{brandingInfo:0,onClose:1},hr)}}function Ir(t){F(t,"svelte-10pcqja",".rcb-modal-message.svelte-10pcqja{width:100%;min-height:160px;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center}.title.svelte-10pcqja{font-size:24px;line-height:1.25em}.subtitle.svelte-10pcqja{font-size:16px;line-height:1.25em;overflow-wrap:anywhere}")}const wr=t=>({}),It=t=>({});function kr(t){let e,r,n,i,o;const s=t[4].default,l=J(s,t,t[5],null);return{c(){e=k("span"),r=O(t[2]),n=Q(),i=k("span"),l&&l.c(),h(e,"class","title svelte-10pcqja"),h(i,"class","subtitle svelte-10pcqja")},m(c,a){p(c,e,a),P(e,r),p(c,n,a),p(c,i,a),l&&l.m(i,null),o=!0},p(c,a){(!o||a&4)&&le(r,c[2]),l&&l.p&&(!o||a&32)&&W(l,s,c,c[5],o?V(s,c[5],a,null):z(c[5]),null)},i(c){o||(f(l,c),o=!0)},o(c){d(l,c),o=!1},d(c){c&&(g(e),g(n),g(i)),l&&l.d(c)}}}function yr(t){let e,r,n;const i=t[4].icon,o=J(i,t,t[5],It);return r=new we({props:{gutter:"16px",$$slots:{default:[kr]},$$scope:{ctx:t}}}),{c(){o&&o.c(),e=Q(),w(r.$$.fragment)},m(s,l){o&&o.m(s,l),p(s,e,l),b(r,s,l),n=!0},p(s,l){o&&o.p&&(!n||l&32)&&W(o,i,s,s[5],n?V(i,s[5],l,wr):z(s[5]),It);const c={};l&36&&(c.$$scope={dirty:l,ctx:s}),r.$set(c)},i(s){n||(f(o,s),f(r.$$.fragment,s),n=!0)},o(s){d(o,s),d(r.$$.fragment,s),n=!1},d(s){s&&g(e),o&&o.d(s),I(r,s)}}}function vr(t){let e,r,n;return r=new we({props:{gutter:"16px",$$slots:{default:[yr]},$$scope:{ctx:t}}}),{c(){e=k("div"),w(r.$$.fragment),h(e,"class","rcb-modal-message svelte-10pcqja"),h(e,"data-type",t[3])},m(i,o){p(i,e,o),b(r,e,null),n=!0},p(i,o){const s={};o&36&&(s.$$scope={dirty:o,ctx:i}),r.$set(s),(!n||o&8)&&h(e,"data-type",i[3])},i(i){n||(f(r.$$.fragment,i),n=!0)},o(i){d(r.$$.fragment,i),n=!1},d(i){i&&g(e),I(r)}}}function $r(t){let e;return{c(){e=O("Go back to app")},m(r,n){p(r,e,n)},d(r){r&&g(e)}}}function Br(t){let e,r;return e=new Ie({props:{$$slots:{default:[$r]},$$scope:{ctx:t}}}),e.$on("click",function(){se(t[1])&&t[1].apply(this,arguments)}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){t=n;const o={};i&32&&(o.$$scope={dirty:i,ctx:t}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Dr(t){let e,r,n,i,o,s;return e=new br({props:{brandingInfo:t[0],onClose:t[1]}}),n=new fe({props:{$$slots:{default:[vr]},$$scope:{ctx:t}}}),o=new Ve({props:{$$slots:{default:[Br]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment),r=Q(),w(n.$$.fragment),i=Q(),w(o.$$.fragment)},m(l,c){b(e,l,c),p(l,r,c),b(n,l,c),p(l,i,c),b(o,l,c),s=!0},p(l,c){const a={};c&1&&(a.brandingInfo=l[0]),c&2&&(a.onClose=l[1]),e.$set(a);const u={};c&44&&(u.$$scope={dirty:c,ctx:l}),n.$set(u);const m={};c&34&&(m.$$scope={dirty:c,ctx:l}),o.$set(m)},i(l){s||(f(e.$$.fragment,l),f(n.$$.fragment,l),f(o.$$.fragment,l),s=!0)},o(l){d(e.$$.fragment,l),d(n.$$.fragment,l),d(o.$$.fragment,l),s=!1},d(l){l&&(g(r),g(i)),I(e,l),I(n,l),I(o,l)}}}function Pr(t){let e,r;return e=new we({props:{gutter:"32px",$$slots:{default:[Dr]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,[i]){const o={};i&47&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Cr(t,e,r){let{$$slots:n={},$$scope:i}=e,{brandingInfo:o=null}=e,{onContinue:s}=e,{title:l}=e,{type:c}=e;return t.$$set=a=>{"brandingInfo"in a&&r(0,o=a.brandingInfo),"onContinue"in a&&r(1,s=a.onContinue),"title"in a&&r(2,l=a.title),"type"in a&&r(3,c=a.type),"$$scope"in a&&r(5,i=a.$$scope)},[o,s,l,c,n,i]}class wt extends U{constructor(e){super(),N(this,e,Cr,Pr,T,{brandingInfo:0,onContinue:1,title:2,type:3},Ir)}}function kt(t){let e,r,n,i,o;return{c(){e=O("If this error persists, please contact "),r=k("a"),n=O(t[1]),o=O("."),h(r,"href",i="mailto:"+t[1])},m(s,l){p(s,e,l),p(s,r,l),P(r,n),p(s,o,l)},p(s,l){l&2&&le(n,s[1]),l&2&&i!==(i="mailto:"+s[1])&&h(r,"href",i)},d(s){s&&(g(e),g(r),g(o))}}}function Mr(t){let e=t[3]()+"",r,n,i,o=t[1]&&kt(t);return{c(){r=O(e),n=Q(),o&&o.c(),i=re()},m(s,l){p(s,r,l),p(s,n,l),o&&o.m(s,l),p(s,i,l)},p(s,l){s[1]?o?o.p(s,l):(o=kt(s),o.c(),o.m(i.parentNode,i)):o&&(o.d(1),o=null)},d(s){s&&(g(r),g(n),g(i)),o&&o.d(s)}}}function Qr(t){let e,r;return e=new Kn({props:{slot:"icon"}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p:y,i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Tr(t){let e,r;return e=new wt({props:{title:t[4](),brandingInfo:t[0],onContinue:t[2],type:"error",$$slots:{icon:[Qr],default:[Mr]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,[i]){const o={};i&1&&(o.brandingInfo=n[0]),i&4&&(o.onContinue=n[2]),i&66&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Nr(t,e,r){let{brandingInfo:n=null}=e,{lastError:i}=e,{supportEmail:o=null}=e,{onContinue:s}=e;De(()=>{Y.errorLog(`Displayed error: ${L[i.errorCode]}. Message: ${i.message??"None"}. Underlying error: ${i.underlyingErrorMessage??"None"}`)});function l(){switch(i.errorCode){case L.UnknownError:return"An unknown error occurred.";case L.ErrorSettingUpPurchase:return"Purchase not started due to an error.";case L.ErrorChargingPayment:return"Payment failed.";case L.NetworkError:return"Network error. Please check your internet connection.";case L.StripeError:return i.message;case L.MissingEmailError:return"Email is required to complete the purchase.";case L.AlreadySubscribedError:return"You are already subscribed to this product."}return i.message}function c(){switch(i.errorCode){case L.AlreadySubscribedError:return"Already subscribed";default:return"Something went wrong"}}return t.$$set=a=>{"brandingInfo"in a&&r(0,n=a.brandingInfo),"lastError"in a&&r(5,i=a.lastError),"supportEmail"in a&&r(1,o=a.supportEmail),"onContinue"in a&&r(2,s=a.onContinue)},[n,o,s,l,c,i]}class Ur extends U{constructor(e){super(),N(this,e,Nr,Tr,T,{brandingInfo:0,lastError:5,supportEmail:1,onContinue:2})}}const Rr="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 Sr(t){F(t,"svelte-1609h93","img.svelte-1609h93{width:124px;height:124px;margin:0 auto}")}function Or(t){let e,r;return{c(){e=k("img"),ne(e.src,r=Rr)||h(e,"src",r),h(e,"alt","icon"),h(e,"class","rcb-ui-asset-icon svelte-1609h93")},m(n,i){p(n,e,i)},p:y,i:y,o:y,d(n){n&&g(e)}}}class Lr extends U{constructor(e){super(),N(this,e,null,Or,T,{},Sr)}}function Fr(t){let e;return{c(){e=O("Your plan is now active.")},m(r,n){p(r,e,n)},d(r){r&&g(e)}}}function xr(t){let e,r;return e=new Lr({props:{slot:"icon"}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p:y,i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Gr(t){let e,r;return e=new wt({props:{type:"success",title:"Purchase successful",brandingInfo:t[0],onContinue:t[1],$$slots:{icon:[xr],default:[Fr]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,[i]){const o={};i&1&&(o.brandingInfo=n[0]),i&2&&(o.onContinue=n[1]),i&4&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Yr(t,e,r){let{brandingInfo:n=null}=e,{onContinue:i}=e;return t.$$set=o=>{"brandingInfo"in o&&r(0,n=o.brandingInfo),"onContinue"in o&&r(1,i=o.onContinue)},[n,i]}class Hr extends U{constructor(e){super(),N(this,e,Yr,Gr,T,{brandingInfo:0,onContinue:1})}}function Kr(t,e,r,n,i={}){const o=r.create(e,i);return o.mount(t),o.on("change",s=>n("change",s)),o.on("ready",s=>n("ready",s)),o.on("focus",s=>n("focus",s)),o.on("blur",s=>n("blur",s)),o.on("escape",s=>n("escape",s)),o.on("click",s=>n("click",s)),o.on("loaderror",s=>n("loaderror",s)),o.on("loaderstart",s=>n("loaderstart",s)),o.on("networkschange",s=>n("networkschange",s)),o}const qr=typeof window>"u";function jr(t){if(!qr)return t.registerAppInfo({name:"svelte-stripe-js",url:"https://svelte-stripe-js.vercel.app"})}function Jr(t){let e;return{c(){e=k("div")},m(r,n){p(r,e,n),t[6](e)},p:y,i:y,o:y,d(r){r&&g(e),t[6](null)}}}function Vr(t,e,r){let n,i;const o=pn(),{elements:s}=_n("stripe");let{options:l=void 0}=e;De(()=>(n=Kr(i,"payment",s,o,l),()=>n.destroy()));function c(){n.blur()}function a(){n.clear()}function u(){n.destroy()}function m(){n.focus()}function _(v){Pe[v?"unshift":"push"](()=>{i=v,r(0,i)})}return t.$$set=v=>{"options"in v&&r(1,l=v.options)},[i,l,c,a,u,m,_]}class Wr extends U{constructor(e){super(),N(this,e,Vr,Jr,T,{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 yt(t){let e;const r=t[15].default,n=J(r,t,t[14],null);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&16384)&&W(n,r,i,i[14],e?V(r,i[14],o,null):z(i[14]),null)},i(i){e||(f(n,i),e=!0)},o(i){d(n,i),e=!1},d(i){n&&n.d(i)}}}function zr(t){let e,r,n=t[1]&&t[0]&&yt(t);return{c(){n&&n.c(),e=re()},m(i,o){n&&n.m(i,o),p(i,e,o),r=!0},p(i,[o]){i[1]&&i[0]?n?(n.p(i,o),o&3&&f(n,1)):(n=yt(i),n.c(),f(n,1),n.m(e.parentNode,e)):n&&(K(),d(n,1,1,()=>{n=null}),q())},i(i){r||(f(n),r=!0)},o(i){d(n),r=!1},d(i){i&&g(e),n&&n.d(i)}}}function Xr(t,e,r){let n,{$$slots:i={},$$scope:o}=e,{stripe:s}=e,{mode:l=void 0}=e,{theme:c="stripe"}=e,{variables:a={}}=e,{rules:u={}}=e,{labels:m="above"}=e,{loader:_="auto"}=e,{fonts:v=[]}=e,{locale:E="auto"}=e,{currency:B=void 0}=e,{amount:A=void 0}=e,{clientSecret:$=void 0}=e,{elements:R=null}=e;return t.$$set=C=>{"stripe"in C&&r(1,s=C.stripe),"mode"in C&&r(2,l=C.mode),"theme"in C&&r(3,c=C.theme),"variables"in C&&r(4,a=C.variables),"rules"in C&&r(5,u=C.rules),"labels"in C&&r(6,m=C.labels),"loader"in C&&r(7,_=C.loader),"fonts"in C&&r(8,v=C.fonts),"locale"in C&&r(9,E=C.locale),"currency"in C&&r(10,B=C.currency),"amount"in C&&r(11,A=C.amount),"clientSecret"in C&&r(12,$=C.clientSecret),"elements"in C&&r(0,R=C.elements),"$$scope"in C&&r(14,o=C.$$scope)},t.$$.update=()=>{t.$$.dirty&120&&r(13,n={theme:c,variables:a,rules:u,labels:m}),t.$$.dirty&16263&&s&&!R&&(r(0,R=s.elements({mode:l,currency:B,amount:A,appearance:n,clientSecret:$,fonts:v,loader:_,locale:E})),jr(s),hn("stripe",{stripe:s,elements:R})),t.$$.dirty&8705&&R&&R.update({appearance:n,locale:E})},[R,s,l,c,a,u,m,_,v,E,B,A,$,n,o,i]}class Zr extends U{constructor(e){super(),N(this,e,Xr,zr,T,{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 vt="https://js.stripe.com/v3",ei=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,$t="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",ti=function(){for(var e=document.querySelectorAll('script[src^="'.concat(vt,'"]')),r=0;r<e.length;r++){var n=e[r];if(ei.test(n.src))return n}return null},Bt=function(e){var r=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(vt).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},ni=function(e,r){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"2.4.0",startTime:r})},ke=null,Te=null,Ne=null,ri=function(e){return function(){e(new Error("Failed to load Stripe.js"))}},ii=function(e,r){return function(){window.Stripe?e(window.Stripe):r(new Error("Stripe.js not available"))}},oi=function(e){return ke!==null?ke:(ke=new Promise(function(r,n){if(typeof window>"u"||typeof document>"u"){r(null);return}if(window.Stripe&&e&&console.warn($t),window.Stripe){r(window.Stripe);return}try{var i=ti();if(i&&e)console.warn($t);else if(!i)i=Bt(e);else if(i&&Ne!==null&&Te!==null){var o;i.removeEventListener("load",Ne),i.removeEventListener("error",Te),(o=i.parentNode)===null||o===void 0||o.removeChild(i),i=Bt(e)}Ne=ii(r,n),Te=ri(n),i.addEventListener("load",Ne),i.addEventListener("error",Te)}catch(s){n(s);return}}),ke.catch(function(r){return ke=null,Promise.reject(r)}))},si=function(e,r,n){if(e===null)return null;var i=e.apply(void 0,r);return ni(i,n),i},ye,Dt=!1,Pt=function(){return ye||(ye=oi(null).catch(function(e){return ye=null,Promise.reject(e)}),ye)};Promise.resolve().then(function(){return Pt()}).catch(function(t){Dt||console.warn(t)});var li=function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];Dt=!0;var i=Date.now();return Pt().then(function(o){return si(o,r,i)})};function ci(t){F(t,"svelte-1xe711j",".rcb-header-layout.svelte-1xe711j{display:flex;justify-content:space-between;align-items:center;width:100%;font-size:24px;margin:0;font-weight:500}")}function ai(t){let e,r;const n=t[0].default,i=J(n,t,t[1],null);return{c(){e=k("div"),i&&i.c(),h(e,"class","rcb-header-layout svelte-1xe711j")},m(o,s){p(o,e,s),i&&i.m(e,null),r=!0},p(o,s){i&&i.p&&(!r||s&2)&&W(i,n,o,o[1],r?V(n,o[1],s,null):z(o[1]),null)},i(o){r||(f(i,o),r=!0)},o(o){d(i,o),r=!1},d(o){o&&g(e),i&&i.d(o)}}}function ui(t){let e,r;return e=new fe({props:{as:"header",$$slots:{default:[ai]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,[i]){const o={};i&2&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function fi(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=o=>{"$$scope"in o&&r(1,i=o.$$scope)},[n,i]}class We extends U{constructor(e){super(),N(this,e,fi,ui,T,{},ci)}}const di="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M18%208H17V6C17%203.24%2014.76%201%2012%201C9.24%201%207%203.24%207%206V8H6C4.9%208%204%208.9%204%2010V20C4%2021.1%204.9%2022%206%2022H18C19.1%2022%2020%2021.1%2020%2020V10C20%208.9%2019.1%208%2018%208ZM12%2017C10.9%2017%2010%2016.1%2010%2015C10%2013.9%2010.9%2013%2012%2013C13.1%2013%2014%2013.9%2014%2015C14%2016.1%2013.1%2017%2012%2017ZM15.1%208H8.9V6C8.9%204.29%2010.29%202.9%2012%202.9C13.71%202.9%2015.1%204.29%2015.1%206V8Z'%20fill='%2311D483'/%3e%3c/svg%3e";function mi(t){let e,r;return{c(){e=k("img"),ne(e.src,r=di)||h(e,"src",r),h(e,"alt","icon"),h(e,"class","rcb-ui-asset-icon")},m(n,i){p(n,e,i)},p:y,i:y,o:y,d(n){n&&g(e)}}}class gi extends U{constructor(e){super(),N(this,e,null,mi,T,{})}}const ve={error:"#f2545b",warning:"#f4e971",focus:"#000080","grey-text-dark":"#000000","grey-text-light":"#767676","grey-ui-dark":"#dfdfdf",white:"#ffffff"};function pi(t){F(t,"svelte-rjmul6",`.processing.svelte-rjmul6{width:12px;aspect-ratio:1;border-radius:50%;animation:svelte-rjmul6-l5 1.5s infinite linear}@keyframes svelte-rjmul6-l5{0%{box-shadow:20px 0 #fff2,
2
2
  -20px 0 #fff2;background:#fff2}25%{box-shadow:20px 0 #fff2,
3
3
  -20px 0 #ffff;background:#fff2}50%{box-shadow:20px 0 #fff2,
4
4
  -20px 0 #fff2;background:#ffff}75%{box-shadow:20px 0 #ffff,
5
5
  -20px 0 #fff2;background:#fff2}100%{box-shadow:20px 0 #fff2,
6
- -20px 0 #fff2;background:#fff2}}`)}function _i(t){let e;return{c(){e=k("div"),_(e,"class","processing svelte-rjmul6")},m(r,n){p(r,e,n)},p:v,i:v,o:v,d(r){r&&g(e)}}}class Pt extends U{constructor(e){super(),N(this,e,null,_i,T,{},pi)}}function Ai(t){F(t,"svelte-1wxt892",".rcb-stripe-elements-container.svelte-1wxt892{width:100%;margin-top:32px;margin-bottom:24px}")}function hi(t){let e,r;return e=new Ve({}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p:v,i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Ei(t){let e,r,n,i,o,s;function l(a){t[9](a)}let c={stripe:t[3],clientSecret:t[4],loader:"always",theme:"stripe",variables:{borderRadius:"12px",fontSizeBase:"16px",fontSizeSm:"16px",spacingGridRow:"16px",colorText:ye["grey-text-dark"],focusBoxShadow:"none",colorDanger:ye.error},rules:{".Input":{boxShadow:"none",border:`2px solid ${ye["grey-ui-dark"]}`},".Input:focus":{border:`2px solid ${ye.focus}`,outline:"none"},".Label":{marginBottom:"8px",fontWeight:"500",lineHeight:"22px"},".Input--invalid":{boxShadow:"none"}},$$slots:{default:[Di]},$$scope:{ctx:t}};return t[2]!==void 0&&(c.elements=t[2]),r=new Zr({props:c}),Pe.push(()=>kn(r,"elements",l)),{c(){e=k("form"),w(r.$$.fragment)},m(a,u){p(a,e,u),b(r,e,null),i=!0,o||(s=_e(e,"submit",ut(t[5])),o=!0)},p(a,u){const m={};u&8&&(m.stripe=a[3]),u&2051&&(m.$$scope={dirty:u,ctx:a}),!n&&u&4&&(n=!0,m.elements=a[2],bn(()=>n=!1)),r.$set(m)},i(a){i||(f(r.$$.fragment,a),i=!0)},o(a){d(r.$$.fragment,a),i=!1},d(a){a&&g(e),I(r),o=!1,s()}}}function bi(t){let e,r,n,i;return n=new gi({}),{c(){e=k("div"),e.textContent="Secure Checkout",r=Q(),w(n.$$.fragment)},m(o,s){p(o,e,s),p(o,r,s),b(n,o,s),i=!0},p:v,i(o){i||(f(n.$$.fragment,o),i=!0)},o(o){d(n.$$.fragment,o),i=!1},d(o){o&&(g(e),g(r)),I(n,o)}}}function Ii(t){let e,r,n;return r=new Wr({}),{c(){e=k("div"),w(r.$$.fragment),_(e,"class","rcb-stripe-elements-container svelte-1wxt892")},m(i,o){p(i,e,o),b(r,e,null),n=!0},p:v,i(i){n||(f(r.$$.fragment,i),n=!0)},o(i){d(r.$$.fragment,i),n=!1},d(i){i&&g(e),I(r)}}}function wi(t){let e;return{c(){e=O("Pay")},m(r,n){p(r,e,n)},i:v,o:v,d(r){r&&g(e)}}}function ki(t){let e,r;return e=new Pt({}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function vi(t){let e,r,n,i;const o=[ki,wi],s=[];function l(c,a){return c[0]?0:1}return e=l(t),r=s[e]=o[e](t),{c(){r.c(),n=re()},m(c,a){s[e].m(c,a),p(c,n,a),i=!0},p(c,a){let u=e;e=l(c),e!==u&&(K(),d(s[u],1,1,()=>{s[u]=null}),q(),r=s[e],r||(r=s[e]=o[e](c),r.c()),f(r,1),r.m(n.parentNode,n))},i(c){i||(f(r),i=!0)},o(c){d(r),i=!1},d(c){c&&g(n),s[e].d(c)}}}function $i(t){let e;return{c(){e=O("Close")},m(r,n){p(r,e,n)},d(r){r&&g(e)}}}function yi(t){let e,r,n,i;return e=new we({props:{disabled:t[0],$$slots:{default:[vi]},$$scope:{ctx:t}}}),n=new we({props:{disabled:t[0],intent:"secondary",$$slots:{default:[$i]},$$scope:{ctx:t}}}),n.$on("click",function(){se(t[1])&&t[1].apply(this,arguments)}),{c(){w(e.$$.fragment),r=Q(),w(n.$$.fragment)},m(o,s){b(e,o,s),p(o,r,s),b(n,o,s),i=!0},p(o,s){t=o;const l={};s&1&&(l.disabled=t[0]),s&2049&&(l.$$scope={dirty:s,ctx:t}),e.$set(l);const c={};s&1&&(c.disabled=t[0]),s&2048&&(c.$$scope={dirty:s,ctx:t}),n.$set(c)},i(o){i||(f(e.$$.fragment,o),f(n.$$.fragment,o),i=!0)},o(o){d(e.$$.fragment,o),d(n.$$.fragment,o),i=!1},d(o){o&&g(r),I(e,o),I(n,o)}}}function Bi(t){let e,r;return e=new ke({props:{$$slots:{default:[yi]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){const o={};i&2051&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Di(t){let e,r,n,i,o,s;return e=new ze({props:{$$slots:{default:[bi]},$$scope:{ctx:t}}}),n=new fe({props:{$$slots:{default:[Ii]},$$scope:{ctx:t}}}),o=new We({props:{$$slots:{default:[Bi]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment),r=Q(),w(n.$$.fragment),i=Q(),w(o.$$.fragment)},m(l,c){b(e,l,c),p(l,r,c),b(n,l,c),p(l,i,c),b(o,l,c),s=!0},p(l,c){const a={};c&2048&&(a.$$scope={dirty:c,ctx:l}),e.$set(a);const u={};c&2048&&(u.$$scope={dirty:c,ctx:l}),n.$set(u);const m={};c&2051&&(m.$$scope={dirty:c,ctx:l}),o.$set(m)},i(l){s||(f(e.$$.fragment,l),f(n.$$.fragment,l),f(o.$$.fragment,l),s=!0)},o(l){d(e.$$.fragment,l),d(n.$$.fragment,l),d(o.$$.fragment,l),s=!1},d(l){l&&(g(r),g(i)),I(e,l),I(n,l),I(o,l)}}}function Mi(t){let e,r,n,i;const o=[Ei,hi],s=[];function l(c,a){return c[3]&&c[4]?0:1}return r=l(t),n=s[r]=o[r](t),{c(){e=k("div"),n.c()},m(c,a){p(c,e,a),s[r].m(e,null),i=!0},p(c,[a]){let u=r;r=l(c),r===u?s[r].p(c,a):(K(),d(s[u],1,1,()=>{s[u]=null}),q(),n=s[r],n?n.p(c,a):(n=s[r]=o[r](c),n.c()),f(n,1),n.m(e,null))},i(c){i||(f(n),i=!0)},o(c){d(n),i=!1},d(c){c&&g(e),s[r].d()}}}function Pi(t,e,r){let{onClose:n}=e,{onContinue:i}=e,{onError:o}=e,{paymentInfoCollectionMetadata:s}=e,{processing:l=!1}=e;const c=s.data.client_secret;let a=null,u,m;Me(async()=>{const E=s.data.publishable_api_key,B=s.data.stripe_account_id;if(!E||!B)throw new Error("Stripe publishable key or account ID not found");r(3,a=await li(E,{stripeAccount:B}))});const A=async()=>{if(l||!a||!m)return;r(0,l=!0);const E=await a.confirmSetup({elements:m,redirect:"if_required"});E.error?(r(0,l=!1),o(new j(L.StripeError,E.error.message))):i()};function $(E){u=E,r(2,u)}return t.$$set=E=>{"onClose"in E&&r(1,n=E.onClose),"onContinue"in E&&r(6,i=E.onContinue),"onError"in E&&r(7,o=E.onError),"paymentInfoCollectionMetadata"in E&&r(8,s=E.paymentInfoCollectionMetadata),"processing"in E&&r(0,l=E.processing)},t.$$.update=()=>{t.$$.dirty&4&&u&&u._elements.length>0&&(m=u)},[l,n,u,a,c,A,i,o,s,$]}class Qi extends U{constructor(e){super(),N(this,e,Pi,Mi,T,{onClose:1,onContinue:6,onError:7,paymentInfoCollectionMetadata:8,processing:0},Ai)}}function Ci(t){return t.trim()===""?"You need to provide your email address to continue.":t.match(/^[^@]+@[^@]+\.[^@]+$/)?null:"Email is not valid. Please provide a valid email address."}function Ti(t){F(t,"svelte-favd20","form.svelte-favd20.svelte-favd20{display:flex;flex-direction:column;min-height:100%;flex-grow:1}.form-container.svelte-favd20.svelte-favd20{display:flex;flex-direction:column;width:100%;margin-top:32px;margin-bottom:16px}.form-label.svelte-favd20.svelte-favd20{margin-top:8px;margin-bottom:8px;display:block;font-weight:500;line-height:22px}.form-input.error.svelte-favd20 input.svelte-favd20{border-color:var(--rc-color-error)}.form-error.svelte-favd20.svelte-favd20{margin-top:4px;font-size:16px;line-height:20px;min-height:40px;color:var(--rc-color-error)}input.svelte-favd20.svelte-favd20{width:100%;box-sizing:border-box;padding:8px;border:2px solid var(--rc-color-grey-ui-dark);border-radius:12px;font-size:16px;height:48px;padding:6px 14px}input.svelte-favd20.svelte-favd20:focus{outline:none;border:2px solid var(--rc-color-focus)}")}function Ni(t){let e;return{c(){e=O("Billing email address")},m(r,n){p(r,e,n)},d(r){r&&g(e)}}}function Qt(t){let e,r;return{c(){e=k("div"),r=O(t[2]),_(e,"class","form-error svelte-favd20")},m(n,i){p(n,e,i),M(e,r)},p(n,i){i&4&&le(r,n[2])},d(n){n&&g(e)}}}function Ui(t){let e,r,n,i,o,s,l,c,a,u=t[2]&&Qt(t);return{c(){e=k("div"),r=k("div"),r.innerHTML='<label for="email">Email</label>',n=Q(),i=k("div"),o=k("input"),l=Q(),u&&u.c(),_(r,"class","form-label svelte-favd20"),_(o,"name","email"),_(o,"placeholder","john@appleseed.com"),_(o,"autocapitalize","off"),_(o,"class","svelte-favd20"),_(i,"class",s="form-input "+t[4]+" svelte-favd20"),_(e,"class","form-container svelte-favd20")},m(m,A){p(m,e,A),M(e,r),M(e,n),M(e,i),M(i,o),ft(o,t[3]),M(e,l),u&&u.m(e,null),c||(a=_e(o,"input",t[8]),c=!0)},p(m,A){A&8&&o.value!==m[3]&&ft(o,m[3]),A&16&&s!==(s="form-input "+m[4]+" svelte-favd20")&&_(i,"class",s),m[2]?u?u.p(m,A):(u=Qt(m),u.c(),u.m(e,null)):u&&(u.d(1),u=null)},d(m){m&&g(e),u&&u.d(),c=!1,a()}}}function Ri(t){let e;return{c(){e=O("Continue")},m(r,n){p(r,e,n)},i:v,o:v,d(r){r&&g(e)}}}function Si(t){let e,r;return e=new Pt({}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Oi(t){let e,r,n,i;const o=[Si,Ri],s=[];function l(c,a){return c[1]?0:1}return e=l(t),r=s[e]=o[e](t),{c(){r.c(),n=re()},m(c,a){s[e].m(c,a),p(c,n,a),i=!0},p(c,a){let u=e;e=l(c),e!==u&&(K(),d(s[u],1,1,()=>{s[u]=null}),q(),r=s[e],r||(r=s[e]=o[e](c),r.c()),f(r,1),r.m(n.parentNode,n))},i(c){i||(f(r),i=!0)},o(c){d(r),i=!1},d(c){c&&g(n),s[e].d(c)}}}function Li(t){let e;return{c(){e=O("Close")},m(r,n){p(r,e,n)},d(r){r&&g(e)}}}function Fi(t){let e,r,n,i;return e=new we({props:{disabled:t[1],$$slots:{default:[Oi]},$$scope:{ctx:t}}}),n=new we({props:{intent:"secondary",disabled:t[1],$$slots:{default:[Li]},$$scope:{ctx:t}}}),n.$on("click",function(){se(t[0])&&t[0].apply(this,arguments)}),{c(){w(e.$$.fragment),r=Q(),w(n.$$.fragment)},m(o,s){b(e,o,s),p(o,r,s),b(n,o,s),i=!0},p(o,s){t=o;const l={};s&2&&(l.disabled=t[1]),s&514&&(l.$$scope={dirty:s,ctx:t}),e.$set(l);const c={};s&2&&(c.disabled=t[1]),s&512&&(c.$$scope={dirty:s,ctx:t}),n.$set(c)},i(o){i||(f(e.$$.fragment,o),f(n.$$.fragment,o),i=!0)},o(o){d(e.$$.fragment,o),d(n.$$.fragment,o),i=!1},d(o){o&&g(r),I(e,o),I(n,o)}}}function xi(t){let e,r;return e=new ke({props:{$$slots:{default:[Fi]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){const o={};i&515&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Gi(t){let e,r,n,i,o,s,l,c,a;return r=new ze({props:{$$slots:{default:[Ni]},$$scope:{ctx:t}}}),i=new fe({props:{$$slots:{default:[Ui]},$$scope:{ctx:t}}}),s=new We({props:{$$slots:{default:[xi]},$$scope:{ctx:t}}}),{c(){e=k("form"),w(r.$$.fragment),n=Q(),w(i.$$.fragment),o=Q(),w(s.$$.fragment),_(e,"class","svelte-favd20")},m(u,m){p(u,e,m),b(r,e,null),M(e,n),b(i,e,null),M(e,o),b(s,e,null),l=!0,c||(a=_e(e,"submit",ut(t[5])),c=!0)},p(u,[m]){const A={};m&512&&(A.$$scope={dirty:m,ctx:u}),r.$set(A);const $={};m&540&&($.$$scope={dirty:m,ctx:u}),i.$set($);const E={};m&515&&(E.$$scope={dirty:m,ctx:u}),s.$set(E)},i(u){l||(f(r.$$.fragment,u),f(i.$$.fragment,u),f(s.$$.fragment,u),l=!0)},o(u){d(r.$$.fragment,u),d(i.$$.fragment,u),d(s.$$.fragment,u),l=!1},d(u){u&&g(e),I(r),I(i),I(s),c=!1,a()}}}function Yi(t,e,r){let n,i,o,{onContinue:s}=e,{onClose:l}=e,{processing:c}=e,{lastError:a}=e;const u=async()=>{const A=Ci(n);A?r(2,i=A):s({email:n})};gn(async()=>{r(2,i=(a==null?void 0:a.message)??"")});function m(){n=this.value,r(3,n)}return t.$$set=A=>{"onContinue"in A&&r(6,s=A.onContinue),"onClose"in A&&r(0,l=A.onClose),"processing"in A&&r(1,c=A.processing),"lastError"in A&&r(7,a=A.lastError)},t.$$.update=()=>{t.$$.dirty&4&&r(4,o=i?"error":"")},r(3,n=""),r(2,i=""),[l,c,i,n,o,u,s,a,m]}class Hi extends U{constructor(e){super(),N(this,e,Yi,Gi,T,{onContinue:6,onClose:0,processing:1,lastError:7},Ti)}}function Ki(t){F(t,"svelte-17tslso",".rcb-modal-backdrop.svelte-17tslso{position:fixed;top:0;left:0;right:0;min-width:100%;width:100vw;width:100dvw;min-height:100%;height:100vh;height:100dvh;background-color:rgba(40, 40, 40, 0.75);display:flex;flex-direction:column;justify-content:space-around;z-index:1000001}")}function qi(t){let e,r;const n=t[1].default,i=J(n,t,t[0],null);return{c(){e=k("div"),i&&i.c(),_(e,"class","rcb-modal-backdrop svelte-17tslso")},m(o,s){p(o,e,s),i&&i.m(e,null),r=!0},p(o,[s]){i&&i.p&&(!r||s&1)&&W(i,n,o,o[0],r?V(n,o[0],s,null):z(o[0]),null)},i(o){r||(f(i,o),r=!0)},o(o){d(i,o),r=!1},d(o){o&&g(e),i&&i.d(o)}}}function ji(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=o=>{"$$scope"in o&&r(0,i=o.$$scope)},[i,n]}class Ji extends U{constructor(e){super(),N(this,e,ji,qi,T,{},Ki)}}function Vi(t){F(t,"svelte-ioxu5d",".rcb-modal-container.svelte-ioxu5d{width:100%}.rcb-modal-main.svelte-ioxu5d{box-sizing:border-box;border-radius:8px;background-color:var(--rc-color-white);color:var(--rc-color-grey-text-dark);min-height:460px;padding:40px;flex-direction:column;display:flex}.rcb-modal-dark.svelte-ioxu5d{background-color:var(--rc-color-grey-text-dark);color:var(--rc-color-white);min-height:0px}@media screen and (max-width: 960px){.rcb-modal-container.svelte-ioxu5d{width:calc(100% - 32px);min-width:300px;max-width:640px;margin:auto}.rcb-modal-main.svelte-ioxu5d,.rcb-modal-dark.svelte-ioxu5d{min-width:300px;max-width:640px;padding:32px}}")}function Wi(t){let e,r,n,i;const o=t[2].default,s=J(o,t,t[1],null);return{c(){e=k("div"),r=k("main"),s&&s.c(),_(r,"class",n=pe(`rcb-modal-main ${t[0]?"rcb-modal-dark":""}`)+" svelte-ioxu5d"),_(e,"class","rcb-modal-container svelte-ioxu5d")},m(l,c){p(l,e,c),M(e,r),s&&s.m(r,null),i=!0},p(l,[c]){s&&s.p&&(!i||c&2)&&W(s,o,l,l[1],i?V(o,l[1],c,null):z(l[1]),null),(!i||c&1&&n!==(n=pe(`rcb-modal-main ${l[0]?"rcb-modal-dark":""}`)+" svelte-ioxu5d"))&&_(r,"class",n)},i(l){i||(f(s,l),i=!0)},o(l){d(s,l),i=!1},d(l){l&&g(e),s&&s.d(l)}}}function zi(t,e,r){let{$$slots:n={},$$scope:i}=e,{dark:o=!1}=e;return t.$$set=s=>{"dark"in s&&r(0,o=s.dark),"$$scope"in s&&r(1,i=s.$$scope)},[o,i,n]}class Xi extends U{constructor(e){super(),N(this,e,zi,Wi,T,{dark:0},Vi)}}function Zi(t){let e;const r=t[1].default,n=J(r,t,t[2],null);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&4)&&W(n,r,i,i[2],e?V(r,i[2],o,null):z(i[2]),null)},i(i){e||(f(n,i),e=!0)},o(i){d(n,i),e=!1},d(i){n&&n.d(i)}}}function eo(t){let e,r;return e=new Ji({props:{$$slots:{default:[to]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){const o={};i&4&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function to(t){let e;const r=t[1].default,n=J(r,t,t[2],null);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&4)&&W(n,r,i,i[2],e?V(r,i[2],o,null):z(i[2]),null)},i(i){e||(f(n,i),e=!0)},o(i){d(n,i),e=!1},d(i){n&&n.d(i)}}}function no(t){let e,r,n,i;const o=[eo,Zi],s=[];function l(c,a){return c[0]?0:1}return e=l(t),r=s[e]=o[e](t),{c(){r.c(),n=re()},m(c,a){s[e].m(c,a),p(c,n,a),i=!0},p(c,[a]){let u=e;e=l(c),e===u?s[e].p(c,a):(K(),d(s[u],1,1,()=>{s[u]=null}),q(),r=s[e],r?r.p(c,a):(r=s[e]=o[e](c),r.c()),f(r,1),r.m(n.parentNode,n))},i(c){i||(f(r),i=!0)},o(c){d(r),i=!1},d(c){c&&g(n),s[e].d(c)}}}function ro(t,e,r){let{$$slots:n={},$$scope:i}=e,{condition:o=!1}=e;return t.$$set=s=>{"condition"in s&&r(0,o=s.condition),"$$scope"in s&&r(2,i=s.$$scope)},[o,n,i]}class io extends U{constructor(e){super(),N(this,e,ro,no,T,{condition:0})}}const oo=t=>({}),Ct=t=>({});function so(t){let e,r;const n=t[1].header,i=J(n,t,t[2],Ct),o=t[1].default,s=J(o,t,t[2],null);return{c(){i&&i.c(),e=Q(),s&&s.c()},m(l,c){i&&i.m(l,c),p(l,e,c),s&&s.m(l,c),r=!0},p(l,c){i&&i.p&&(!r||c&4)&&W(i,n,l,l[2],r?V(n,l[2],c,oo):z(l[2]),Ct),s&&s.p&&(!r||c&4)&&W(s,o,l,l[2],r?V(o,l[2],c,null):z(l[2]),null)},i(l){r||(f(i,l),f(s,l),r=!0)},o(l){d(i,l),d(s,l),r=!1},d(l){l&&g(e),i&&i.d(l),s&&s.d(l)}}}function lo(t){let e,r;return e=new Xi({props:{dark:t[0],$$slots:{default:[so]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,[i]){const o={};i&1&&(o.dark=n[0]),i&4&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function co(t,e,r){let{$$slots:n={},$$scope:i}=e,{dark:o=!1}=e;return t.$$set=s=>{"dark"in s&&r(0,o=s.dark),"$$scope"in s&&r(2,i=s.$$scope)},[o,n,i]}class Tt extends U{constructor(e){super(),N(this,e,co,lo,T,{dark:0})}}const ao="0.3.4",de="https://api.revenuecat.com";var Re;(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"})(Re||(Re={}));function Xe(t){return t?t.startsWith("rcb_sb_"):!1}async function me(t,e,r,n){try{const i=await fetch(t.url(),{method:t.method,headers:mo(e,n),body:fo(r)});return await uo(i,t),await i.json()}catch(i){throw i instanceof TypeError?new Z(ee.NetworkError,be.getPublicMessage(ee.NetworkError),i.message):i}}async function uo(t,e){const r=t.status;if(r>=Re.INTERNAL_SERVER_ERROR)Ze(e,r,await t.text());else if(r>=Re.BAD_REQUEST){const n=await t.json(),i=n?JSON.stringify(n):null,o=n==null?void 0:n.code,s=n==null?void 0:n.message;if(o!=null){const l=be.convertCodeToBackendErrorCode(o);if(l==null)Ze(e,r,i);else throw Z.getForBackendError(l,s)}else Ze(e,r,i)}}function Ze(t,e,r){throw new Z(ee.UnknownBackendError,`Unknown backend error. Request: ${t.name}. Status code: ${e}. Body: ${r}.`)}function fo(t){return t==null?null:JSON.stringify(t)}function mo(t,e){let r={Authorization:`Bearer ${t}`,"Content-Type":"application/json",Accept:"application/json","X-Platform":"web","X-Version":ao,"X-Is-Sandbox":`${Xe(t)}`};return e!=null&&(r={...r,...e}),r}const Nt="/v1/subscribers",Se="/rcbilling/v1";class go{constructor(e){C(this,"appUserId");C(this,"method","GET");C(this,"name","getOfferings");this.appUserId=e}url(){const e=encodeURIComponent(this.appUserId);return`${de}${Nt}/${e}/offerings`}}class po{constructor(){C(this,"method","POST");C(this,"name","subscribe")}url(){return`${de}${Se}/subscribe`}}class _o{constructor(e,r){C(this,"method","GET");C(this,"name","getProducts");C(this,"appUserId");C(this,"productIds");this.appUserId=e,this.productIds=r}url(){const e=encodeURIComponent(this.appUserId),r=this.productIds.map(encodeURIComponent).join("&id=");return`${de}${Se}/subscribers/${e}/products?id=${r}`}}class Ao{constructor(e){C(this,"method","GET");C(this,"name","getCustomerInfo");C(this,"appUserId");this.appUserId=e}url(){const e=encodeURIComponent(this.appUserId);return`${de}${Nt}/${e}`}}class ho{constructor(){C(this,"method","GET");C(this,"name","getBrandingInfo")}url(){return`${de}${Se}/branding`}}class Eo{constructor(e){C(this,"method","GET");C(this,"name","getCheckoutStatus");C(this,"operationSessionId");this.operationSessionId=e}url(){return`${de}${Se}/checkout/${this.operationSessionId}`}}class bo{constructor(e){C(this,"API_KEY");this.API_KEY=e}async getOfferings(e){return await me(new go(e),this.API_KEY)}async getCustomerInfo(e){return await me(new Ao(e),this.API_KEY)}async getProducts(e,r){return await me(new _o(e,r),this.API_KEY)}async getBrandingInfo(){return await me(new ho,this.API_KEY)}async postSubscribe(e,r,n,i,o){const s={app_user_id:e,product_id:r,email:n,presented_offering_identifier:i};return o&&o!=="base_option"&&(s.offer_id=o),await me(new po,this.API_KEY,s)}async getCheckoutStatus(e){return await me(new Eo(e),this.API_KEY)}}const Io="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 wo(t){let e,r;return{c(){e=k("img"),ne(e.src,r=Io)||_(e,"src",r),_(e,"alt","icon"),_(e,"class","rcb-ui-asset-icon")},m(n,i){p(n,e,i)},p:v,i:v,o:v,d(n){n&&g(e)}}}class ko extends U{constructor(e){super(),N(this,e,null,wo,T,{})}}function vo(t){F(t,"svelte-1rhrjxe","div.svelte-1rhrjxe{background-color:var(--rc-color-warning);color:var(--rc-color-grey-text-dark);font-size:10px;font-weight:bold;text-transform:uppercase;padding:4px 10px;line-height:10px;border-radius:9px;margin:0px;margin-left:16px}")}function $o(t){let e;return{c(){e=k("div"),e.textContent="Sandbox",_(e,"class","svelte-1rhrjxe")},m(r,n){p(r,e,n)},p:v,i:v,o:v,d(r){r&&g(e)}}}class yo extends U{constructor(e){super(),N(this,e,null,$o,T,{},vo)}}function Bo(t){F(t,"svelte-1qect5g",`.rcb-ui-container.svelte-1qect5g{color-scheme:none;font-size:16px;line-height:1.5em;font-weight:400;font-family:-apple-system, "system-ui", "Segoe UI", Roboto, Oxygen, Ubuntu,
7
- Cantarell, "Open Sans", "Helvetica Neue", sans-serif}.rcb-ui-layout.svelte-1qect5g{width:100vw;width:100 dvw;margin-right:auto;display:flex;justify-content:center;align-items:flex-start;position:relative;padding:0px 80px;box-sizing:border-box}.rcb-ui-aside.svelte-1qect5g{margin-right:16px;flex:320px 1 0;max-width:480px}.rcb-ui-main.svelte-1qect5g{flex:480px 1 0;max-width:640px}@media screen and (max-width: 960px){.rcb-ui-layout.svelte-1qect5g{flex-direction:column;align-items:center;justify-content:center;height:100%;min-width:100%}.rcb-ui-aside.svelte-1qect5g{margin-right:0;margin-bottom:16px;min-width:100%;display:flex;flex-direction:column;align-items:center;flex:none;max-width:none}.rcb-ui-main.svelte-1qect5g{flex:none;max-width:none;min-width:100%}}@media screen and (max-width: 960px) and (max-height: 960px){.rcb-ui-layout.svelte-1qect5g{overflow-y:scroll;justify-content:flex-start;padding:16px 0px}}`)}function Ut(t){let e,r,n;return r=new Tt({props:{dark:!0,$$slots:{header:[Co],default:[Do]},$$scope:{ctx:t}}}),{c(){e=k("div"),w(r.$$.fragment),_(e,"class","rcb-ui-aside svelte-1qect5g")},m(i,o){p(i,e,o),b(r,e,null),n=!0},p(i,o){const s={};o&67108878&&(s.$$scope={dirty:o,ctx:i}),r.$set(s)},i(i){n||(f(r.$$.fragment,i),n=!0)},o(i){d(r.$$.fragment,i),n=!1},d(i){i&&g(e),I(r)}}}function Rt(t){let e,r;return e=new pt({props:{productDetails:t[2],purchaseOption:t[8]}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){const o={};i&4&&(o.productDetails=n[2]),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Do(t){let e,r,n=t[2]&&t[8]&&Rt(t);return{c(){n&&n.c(),e=re()},m(i,o){n&&n.m(i,o),p(i,e,o),r=!0},p(i,o){i[2]&&i[8]?n?(n.p(i,o),o&4&&f(n,1)):(n=Rt(i),n.c(),f(n,1),n.m(e.parentNode,e)):n&&(K(),d(n,1,1,()=>{n=null}),q())},i(i){r||(f(n),r=!0)},o(i){d(n),r=!1},d(i){i&&g(e),n&&n.d(i)}}}function Mo(t){let e,r;return e=new ko({}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Po(t){let e,r;return e=new yo({}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Qo(t){let e,r,n,i,o,s,l;e=new bt({props:{brandingInfo:t[3]}});const c=[Po,Mo],a=[];function u(m,A){return A&2&&(n=null),n==null&&(n=!!m[1].isSandbox()),n?0:1}return i=u(t,-1),o=a[i]=c[i](t),{c(){w(e.$$.fragment),r=Q(),o.c(),s=re()},m(m,A){b(e,m,A),p(m,r,A),a[i].m(m,A),p(m,s,A),l=!0},p(m,A){const $={};A&8&&($.brandingInfo=m[3]),e.$set($);let E=i;i=u(m,A),i!==E&&(K(),d(a[E],1,1,()=>{a[E]=null}),q(),o=a[i],o||(o=a[i]=c[i](m),o.c()),f(o,1),o.m(s.parentNode,s))},i(m){l||(f(e.$$.fragment,m),f(o),l=!0)},o(m){d(e.$$.fragment,m),d(o),l=!1},d(m){m&&(g(r),g(s)),I(e,m),a[i].d(m)}}}function Co(t){let e,r;return e=new ze({props:{slot:"header",$$slots:{default:[Qo]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){const o={};i&67108874&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function St(t){let e,r;return e=new pt({props:{productDetails:t[2],purchaseOption:t[8]}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){const o={};i&4&&(o.productDetails=n[2]),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Ot(t){let e,r;return e=new Ve({}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Lt(t){let e,r;return e=new Hi({props:{onContinue:t[11],onClose:t[10],processing:t[6]==="processing-auth-info",lastError:t[5]}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){const o={};i&64&&(o.processing=n[6]==="processing-auth-info"),i&32&&(o.lastError=n[5]),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Ft(t){let e,r;return e=new Qi({props:{paymentInfoCollectionMetadata:t[4],onContinue:t[11],onClose:t[10],onError:t[12],processing:t[6]==="polling-purchase-status"}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){const o={};i&16&&(o.paymentInfoCollectionMetadata=n[4]),i&64&&(o.processing=n[6]==="polling-purchase-status"),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function xt(t){let e,r;return e=new Ve({}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Gt(t){var n;let e,r;return e=new Ur({props:{brandingInfo:t[3],lastError:t[5]??new j(L.UnknownError,"Unknown error without state set."),supportEmail:(n=t[3])==null?void 0:n.seller_company_support_email,onContinue:t[13]}}),{c(){w(e.$$.fragment)},m(i,o){b(e,i,o),r=!0},p(i,o){var l;const s={};o&8&&(s.brandingInfo=i[3]),o&32&&(s.lastError=i[5]??new j(L.UnknownError,"Unknown error without state set.")),o&8&&(s.supportEmail=(l=i[3])==null?void 0:l.seller_company_support_email),e.$set(s)},i(i){r||(f(e.$$.fragment,i),r=!0)},o(i){d(e.$$.fragment,i),r=!1},d(i){I(e,i)}}}function Yt(t){let e,r;return e=new Hr({props:{brandingInfo:t[3],onContinue:t[11]}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){const o={};i&8&&(o.brandingInfo=n[3]),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function To(t){let e,r,n,i,o,s,l,c,a=t[6]==="present-offer"&&t[2]&&t[8]&&St(t),u=t[6]==="present-offer"&&!t[2]&&Ot(),m=(t[6]==="needs-auth-info"||t[6]==="processing-auth-info")&&Lt(t),A=t[4]&&(t[6]==="needs-payment-info"||t[6]==="polling-purchase-status")&&Ft(t),$=t[6]==="loading"&&xt(),E=t[6]==="error"&&Gt(t),B=t[6]==="success"&&Yt(t);return{c(){a&&a.c(),e=Q(),u&&u.c(),r=Q(),m&&m.c(),n=Q(),A&&A.c(),i=Q(),$&&$.c(),o=Q(),E&&E.c(),s=Q(),B&&B.c(),l=re()},m(h,y){a&&a.m(h,y),p(h,e,y),u&&u.m(h,y),p(h,r,y),m&&m.m(h,y),p(h,n,y),A&&A.m(h,y),p(h,i,y),$&&$.m(h,y),p(h,o,y),E&&E.m(h,y),p(h,s,y),B&&B.m(h,y),p(h,l,y),c=!0},p(h,y){h[6]==="present-offer"&&h[2]&&h[8]?a?(a.p(h,y),y&68&&f(a,1)):(a=St(h),a.c(),f(a,1),a.m(e.parentNode,e)):a&&(K(),d(a,1,1,()=>{a=null}),q()),h[6]==="present-offer"&&!h[2]?u?y&68&&f(u,1):(u=Ot(),u.c(),f(u,1),u.m(r.parentNode,r)):u&&(K(),d(u,1,1,()=>{u=null}),q()),h[6]==="needs-auth-info"||h[6]==="processing-auth-info"?m?(m.p(h,y),y&64&&f(m,1)):(m=Lt(h),m.c(),f(m,1),m.m(n.parentNode,n)):m&&(K(),d(m,1,1,()=>{m=null}),q()),h[4]&&(h[6]==="needs-payment-info"||h[6]==="polling-purchase-status")?A?(A.p(h,y),y&80&&f(A,1)):(A=Ft(h),A.c(),f(A,1),A.m(i.parentNode,i)):A&&(K(),d(A,1,1,()=>{A=null}),q()),h[6]==="loading"?$?y&64&&f($,1):($=xt(),$.c(),f($,1),$.m(o.parentNode,o)):$&&(K(),d($,1,1,()=>{$=null}),q()),h[6]==="error"?E?(E.p(h,y),y&64&&f(E,1)):(E=Gt(h),E.c(),f(E,1),E.m(s.parentNode,s)):E&&(K(),d(E,1,1,()=>{E=null}),q()),h[6]==="success"?B?(B.p(h,y),y&64&&f(B,1)):(B=Yt(h),B.c(),f(B,1),B.m(l.parentNode,l)):B&&(K(),d(B,1,1,()=>{B=null}),q())},i(h){c||(f(a),f(u),f(m),f(A),f($),f(E),f(B),c=!0)},o(h){d(a),d(u),d(m),d(A),d($),d(E),d(B),c=!1},d(h){h&&(g(e),g(r),g(n),g(i),g(o),g(s),g(l)),a&&a.d(h),u&&u.d(h),m&&m.d(h),A&&A.d(h),$&&$.d(h),E&&E.d(h),B&&B.d(h)}}}function No(t){let e,r=t[9].includes(t[6]),n,i,o,s,l=r&&Ut(t);return o=new Tt({props:{$$slots:{default:[To]},$$scope:{ctx:t}}}),{c(){e=k("div"),l&&l.c(),n=Q(),i=k("div"),w(o.$$.fragment),_(i,"class","rcb-ui-main svelte-1qect5g"),_(e,"class","rcb-ui-layout svelte-1qect5g"),_(e,"style",t[7])},m(c,a){p(c,e,a),l&&l.m(e,null),M(e,n),M(e,i),b(o,i,null),s=!0},p(c,a){a&64&&(r=c[9].includes(c[6])),r?l?(l.p(c,a),a&64&&f(l,1)):(l=Ut(c),l.c(),f(l,1),l.m(e,n)):l&&(K(),d(l,1,1,()=>{l=null}),q());const u={};a&67108988&&(u.$$scope={dirty:a,ctx:c}),o.$set(u)},i(c){s||(f(l),f(o.$$.fragment,c),s=!0)},o(c){d(l),d(o.$$.fragment,c),s=!1},d(c){c&&g(e),l&&l.d(),I(o)}}}function Uo(t){let e,r,n;return r=new io({props:{condition:t[0],$$slots:{default:[No]},$$scope:{ctx:t}}}),{c(){e=k("div"),w(r.$$.fragment),_(e,"class","rcb-ui-container svelte-1qect5g")},m(i,o){p(i,e,o),b(r,e,null),n=!0},p(i,[o]){const s={};o&1&&(s.condition=i[0]),o&67108990&&(s.$$scope={dirty:o,ctx:i}),r.$set(s)},i(i){n||(f(r.$$.fragment,i),n=!0)},o(i){d(r.$$.fragment,i),n=!1},d(i){i&&g(e),I(r)}}}function Ro(t,e,r){var Kt,qt;let{asModal:n=!0}=e,{customerEmail:i}=e,{appUserId:o}=e,{rcPackage:s}=e,{purchaseOption:l}=e,{onFinished:c}=e,{onError:a}=e,{onClose:u}=e,{purchases:m}=e,{backend:A}=e,{purchaseOperationHelper:$}=e;const E=Object.entries(ye).map(([D,tt])=>`--rc-color-${D}: ${tt}`).join("; ");let B=null,h=null,y=null,R=null;const P=((Kt=s==null?void 0:s.rcBillingProduct)==null?void 0:Kt.identifier)??null,Le=(qt=s==null?void 0:s.rcBillingProduct)==null?void 0:qt.defaultSubscriptionOption,G=l||Le;let S="present-offer";const Fe=["present-offer","needs-auth-info","processing-auth-info","needs-payment-info","polling-purchase-status","loading"];Me(async()=>{if(r(2,B=s.rcBillingProduct),r(3,h=await A.getBrandingInfo()),S==="present-offer"){i?Ht():r(6,S="needs-auth-info");return}});const xe=()=>{u()},Ht=()=>{if(P===null){Be(new j(L.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}else S==="present-offer"&&r(6,S="loading");if(!i){Be(new j(L.MissingEmailError));return}$.startPurchase(o,P,G,i,s.rcBillingProduct.presentedOfferingIdentifier).then(D=>{if(D.next_action==="collect_payment_info"){r(5,R=null),r(6,S="needs-payment-info"),r(4,y=D);return}if(D.next_action==="completed"){r(5,R=null),r(6,S="success");return}}).catch(D=>{Be(D)})},zo=D=>{if(S==="needs-auth-info"){D&&(r(14,i=D.email),r(6,S="processing-auth-info")),Ht();return}if(S==="needs-payment-info"){r(6,S="polling-purchase-status"),$.pollCurrentPurchaseForCompletion().then(()=>{r(6,S="success")}).catch(tt=>{Be(tt)});return}if(S==="success"||S==="error"){c();return}r(6,S="success")},Be=D=>{if(S==="processing-auth-info"){r(5,R=D),r(6,S="needs-auth-info");return}r(5,R=D),r(6,S="error")},Xo=()=>{a(R??new j(L.UnknownError,"Unknown error without state set."))};return t.$$set=D=>{"asModal"in D&&r(0,n=D.asModal),"customerEmail"in D&&r(14,i=D.customerEmail),"appUserId"in D&&r(15,o=D.appUserId),"rcPackage"in D&&r(16,s=D.rcPackage),"purchaseOption"in D&&r(17,l=D.purchaseOption),"onFinished"in D&&r(18,c=D.onFinished),"onError"in D&&r(19,a=D.onError),"onClose"in D&&r(20,u=D.onClose),"purchases"in D&&r(1,m=D.purchases),"backend"in D&&r(21,A=D.backend),"purchaseOperationHelper"in D&&r(22,$=D.purchaseOperationHelper)},[n,m,B,h,y,R,S,E,G,Fe,xe,zo,Be,Xo,i,o,s,l,c,a,u,A,$]}class So extends U{constructor(e){super(),N(this,e,Ro,Uo,T,{asModal:0,customerEmail:14,appUserId:15,rcPackage:16,purchaseOption:17,onFinished:18,onError:19,onClose:20,purchases:1,backend:21,purchaseOperationHelper:22},Bo)}}function Oo(t){return t.expires_date==null?!0:new Date(t.expires_date)>new Date}function Lo(t,e,r,n){const i=e.product_identifier;if(i in r)return Fo(t,e,r[i]);if(i in n)return xo(t,e,n[i]);throw new Z(ee.CustomerInfoError,"Could not find entitlement product in subscriptions or non-subscriptions.")}function Fo(t,e,r){return{identifier:t,isActive:Oo(e),willRenew:Ho(e,r),store:(r==null?void 0:r.store)??"unknown",latestPurchaseDate:new Date(e.purchase_date),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 xo(t,e,r){return{identifier:t,isActive:!0,willRenew:!1,store:r.store,latestPurchaseDate:new Date(e.purchase_date),originalPurchaseDate:new Date(r.original_purchase_date),expirationDate:null,productIdentifier:e.product_identifier,unsubscribeDetectedAt:null,billingIssueDetectedAt:null,isSandbox:r.is_sandbox,periodType:"normal"}}function Go(t,e,r){const n={},i={};for(const o in t){const s=Lo(o,t[o],e,r);n[o]=s,s.isActive&&(i[o]=s)}return{all:n,active:i}}function Oe(t){return t==null?null:new Date(t)}function Yo(t){const e=qo(t),r=t.subscriber,n=Jo(r.non_subscriptions);return{entitlements:Go(r.entitlements,r.subscriptions,n),allExpirationDatesByProduct:e,allPurchaseDatesByProduct:Ko(t,n),activeSubscriptions:jo(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 Ho(t,e){if(e==null)return!1;const r=e.store=="promotional",n=t.expires_date==null,i=e.unsubscribe_detected_at!=null,o=e.billing_issues_detected_at!=null;return!(r||n||i||o)}function Ko(t,e){const r={};for(const n in t.subscriber.subscriptions){const i=t.subscriber.subscriptions[n];r[n]=new Date(i.purchase_date)}for(const n in e){const i=e[n].purchase_date;i==null?r[n]=null:r[n]=new Date(i)}return r}function qo(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 jo(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}function Jo(t){const e={};for(const r in t){if(t[r].length===0)continue;const n=t[r].length;e[r]=t[r][n-1]}return e}function Vo(t){if(!/^rcb_[a-zA-Z0-9_.-]+$/.test(t))throw new Z(ee.InvalidCredentialsError,"Invalid API key. Use your RevenueCat Billing API key.")}function Wo(t){if(new Set(["no_user","null","none","nil","(null)","NaN","\\x00","","unidentified","undefined","unknown"]).has(t)||t.includes("/"))throw new Z(ee.InvalidAppUserIdError,'Provided user id: "'+t+'" is not valid. See https://www.revenuecat.com/docs/customers/user-ids#tips-for-setting-app-user-ids for more information.')}const te=class te{constructor(e,r){C(this,"_API_KEY");C(this,"_appUserId");C(this,"backend");C(this,"purchaseOperationHelper");C(this,"toOfferings",(e,r)=>{const n=e.offerings.find(l=>l.identifier===e.current_offering_id)??null,i={};r.product_details.forEach(l=>{i[l.identifier]=l});const o=n==null?null:ot(n,i),s={};return e.offerings.forEach(l=>{const c=ot(l,i);c!=null&&(s[l.identifier]=c)}),Object.keys(s).length==0&&Y.debugLog("Empty offerings. Please make sure you've configured offerings correctly in the RevenueCat dashboard and that the products are properly configured."),{all:s,current:o}});this._API_KEY=e,this._appUserId=r,Xe(e)&&Y.debugLog("Initializing Purchases SDK with sandbox API Key"),this.backend=new bo(this._API_KEY),this.purchaseOperationHelper=new xn(this.backend)}static setLogLevel(e){Y.setLogLevel(e)}static getSharedInstance(){if(te.isConfigured())return te.instance;throw new At}static isConfigured(){return te.instance!==void 0}static configure(e,r){return te.instance!==void 0&&Y.warnLog("Purchases is already initialized. You normally should only configure Purchases once. Creating and returning new instance."),Vo(e),Wo(r),te.instance=new te(e,r),te.getSharedInstance()}async getOfferings(){const e=this._appUserId,r=await this.backend.getOfferings(e),n=r.offerings.flatMap(o=>o.packages).map(o=>o.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){return this.purchase({rcPackage:e,customerEmail:r,htmlTarget:n})}purchase(e){const{rcPackage:r,purchaseOption:n,htmlTarget:i,customerEmail:o}=e;let s=i??document.getElementById("rcb-ui-root");if(s===null){const u=document.createElement("div");u.className="rcb-ui-root",document.body.appendChild(u),s=u}if(s===null)throw new Error("Could not generate a mount point for the billing widget");const l=s,c=!i,a=this._appUserId;return Y.debugLog(`Presenting purchase form for package ${r.identifier}`),new Promise((u,m)=>{new So({target:l,props:{appUserId:a,rcPackage:r,purchaseOption:n,customerEmail:o,onFinished:async()=>{Y.debugLog("Purchase finished"),l.innerHTML="",u({customerInfo:await this._getCustomerInfoForUserId(a)})},onClose:()=>{l.innerHTML="",Y.debugLog("Purchase cancelled by user"),m(new Z(ee.UserCancelledError))},onError:A=>{l.innerHTML="",m(Z.getForPurchasesFlowError(A))},purchases:this,backend:this.backend,purchaseOperationHelper:this.purchaseOperationHelper,asModal:c}})})}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(o=>n[o.identifier]=o);const i=[];e.forEach(o=>{n[o]===void 0&&i.push(o)}),i.length>0&&Y.debugLog(`Could not find product data for product ids:
6
+ -20px 0 #fff2;background:#fff2}}`)}function hi(t){let e;return{c(){e=k("div"),h(e,"class","processing svelte-rjmul6")},m(r,n){p(r,e,n)},p:y,i:y,o:y,d(r){r&&g(e)}}}class Ct extends U{constructor(e){super(),N(this,e,null,hi,T,{},pi)}}function _i(t){F(t,"svelte-1wxt892",".rcb-stripe-elements-container.svelte-1wxt892{width:100%;margin-top:32px;margin-bottom:24px}")}function Ai(t){let e,r;return e=new Je({}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p:y,i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Ei(t){let e,r,n,i,o,s;function l(a){t[9](a)}let c={stripe:t[3],clientSecret:t[4],loader:"always",theme:"stripe",variables:{borderRadius:"12px",fontSizeBase:"16px",fontSizeSm:"16px",spacingGridRow:"16px",colorText:ve["grey-text-dark"],focusBoxShadow:"none",colorDanger:ve.error},rules:{".Input":{boxShadow:"none",border:`2px solid ${ve["grey-ui-dark"]}`},".Input:focus":{border:`2px solid ${ve.focus}`,outline:"none"},".Label":{marginBottom:"8px",fontWeight:"500",lineHeight:"22px"},".Input--invalid":{boxShadow:"none"}},$$slots:{default:[Di]},$$scope:{ctx:t}};return t[2]!==void 0&&(c.elements=t[2]),r=new Zr({props:c}),Pe.push(()=>kn(r,"elements",l)),{c(){e=k("form"),w(r.$$.fragment)},m(a,u){p(a,e,u),b(r,e,null),i=!0,o||(s=pe(e,"submit",ut(t[5])),o=!0)},p(a,u){const m={};u&8&&(m.stripe=a[3]),u&2051&&(m.$$scope={dirty:u,ctx:a}),!n&&u&4&&(n=!0,m.elements=a[2],bn(()=>n=!1)),r.$set(m)},i(a){i||(f(r.$$.fragment,a),i=!0)},o(a){d(r.$$.fragment,a),i=!1},d(a){a&&g(e),I(r),o=!1,s()}}}function bi(t){let e,r,n,i;return n=new gi({}),{c(){e=k("div"),e.textContent="Secure Checkout",r=Q(),w(n.$$.fragment)},m(o,s){p(o,e,s),p(o,r,s),b(n,o,s),i=!0},p:y,i(o){i||(f(n.$$.fragment,o),i=!0)},o(o){d(n.$$.fragment,o),i=!1},d(o){o&&(g(e),g(r)),I(n,o)}}}function Ii(t){let e,r,n;return r=new Wr({}),{c(){e=k("div"),w(r.$$.fragment),h(e,"class","rcb-stripe-elements-container svelte-1wxt892")},m(i,o){p(i,e,o),b(r,e,null),n=!0},p:y,i(i){n||(f(r.$$.fragment,i),n=!0)},o(i){d(r.$$.fragment,i),n=!1},d(i){i&&g(e),I(r)}}}function wi(t){let e;return{c(){e=O("Pay")},m(r,n){p(r,e,n)},i:y,o:y,d(r){r&&g(e)}}}function ki(t){let e,r;return e=new Ct({}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function yi(t){let e,r,n,i;const o=[ki,wi],s=[];function l(c,a){return c[0]?0:1}return e=l(t),r=s[e]=o[e](t),{c(){r.c(),n=re()},m(c,a){s[e].m(c,a),p(c,n,a),i=!0},p(c,a){let u=e;e=l(c),e!==u&&(K(),d(s[u],1,1,()=>{s[u]=null}),q(),r=s[e],r||(r=s[e]=o[e](c),r.c()),f(r,1),r.m(n.parentNode,n))},i(c){i||(f(r),i=!0)},o(c){d(r),i=!1},d(c){c&&g(n),s[e].d(c)}}}function vi(t){let e;return{c(){e=O("Close")},m(r,n){p(r,e,n)},d(r){r&&g(e)}}}function $i(t){let e,r,n,i;return e=new Ie({props:{disabled:t[0],$$slots:{default:[yi]},$$scope:{ctx:t}}}),n=new Ie({props:{disabled:t[0],intent:"secondary",$$slots:{default:[vi]},$$scope:{ctx:t}}}),n.$on("click",function(){se(t[1])&&t[1].apply(this,arguments)}),{c(){w(e.$$.fragment),r=Q(),w(n.$$.fragment)},m(o,s){b(e,o,s),p(o,r,s),b(n,o,s),i=!0},p(o,s){t=o;const l={};s&1&&(l.disabled=t[0]),s&2049&&(l.$$scope={dirty:s,ctx:t}),e.$set(l);const c={};s&1&&(c.disabled=t[0]),s&2048&&(c.$$scope={dirty:s,ctx:t}),n.$set(c)},i(o){i||(f(e.$$.fragment,o),f(n.$$.fragment,o),i=!0)},o(o){d(e.$$.fragment,o),d(n.$$.fragment,o),i=!1},d(o){o&&g(r),I(e,o),I(n,o)}}}function Bi(t){let e,r;return e=new we({props:{$$slots:{default:[$i]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){const o={};i&2051&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Di(t){let e,r,n,i,o,s;return e=new We({props:{$$slots:{default:[bi]},$$scope:{ctx:t}}}),n=new fe({props:{$$slots:{default:[Ii]},$$scope:{ctx:t}}}),o=new Ve({props:{$$slots:{default:[Bi]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment),r=Q(),w(n.$$.fragment),i=Q(),w(o.$$.fragment)},m(l,c){b(e,l,c),p(l,r,c),b(n,l,c),p(l,i,c),b(o,l,c),s=!0},p(l,c){const a={};c&2048&&(a.$$scope={dirty:c,ctx:l}),e.$set(a);const u={};c&2048&&(u.$$scope={dirty:c,ctx:l}),n.$set(u);const m={};c&2051&&(m.$$scope={dirty:c,ctx:l}),o.$set(m)},i(l){s||(f(e.$$.fragment,l),f(n.$$.fragment,l),f(o.$$.fragment,l),s=!0)},o(l){d(e.$$.fragment,l),d(n.$$.fragment,l),d(o.$$.fragment,l),s=!1},d(l){l&&(g(r),g(i)),I(e,l),I(n,l),I(o,l)}}}function Pi(t){let e,r,n,i;const o=[Ei,Ai],s=[];function l(c,a){return c[3]&&c[4]?0:1}return r=l(t),n=s[r]=o[r](t),{c(){e=k("div"),n.c()},m(c,a){p(c,e,a),s[r].m(e,null),i=!0},p(c,[a]){let u=r;r=l(c),r===u?s[r].p(c,a):(K(),d(s[u],1,1,()=>{s[u]=null}),q(),n=s[r],n?n.p(c,a):(n=s[r]=o[r](c),n.c()),f(n,1),n.m(e,null))},i(c){i||(f(n),i=!0)},o(c){d(n),i=!1},d(c){c&&g(e),s[r].d()}}}function Ci(t,e,r){let{onClose:n}=e,{onContinue:i}=e,{onError:o}=e,{paymentInfoCollectionMetadata:s}=e,{processing:l=!1}=e;const c=s.data.client_secret;let a=null,u,m;De(async()=>{const E=s.data.publishable_api_key,B=s.data.stripe_account_id;if(!E||!B)throw new Error("Stripe publishable key or account ID not found");r(3,a=await li(E,{stripeAccount:B}))});const _=async()=>{if(l||!a||!m)return;r(0,l=!0);const E=await a.confirmSetup({elements:m,redirect:"if_required"});E.error?(r(0,l=!1),o(new j(L.StripeError,E.error.message))):i()};function v(E){u=E,r(2,u)}return t.$$set=E=>{"onClose"in E&&r(1,n=E.onClose),"onContinue"in E&&r(6,i=E.onContinue),"onError"in E&&r(7,o=E.onError),"paymentInfoCollectionMetadata"in E&&r(8,s=E.paymentInfoCollectionMetadata),"processing"in E&&r(0,l=E.processing)},t.$$.update=()=>{t.$$.dirty&4&&u&&u._elements.length>0&&(m=u)},[l,n,u,a,c,_,i,o,s,v]}class Mi extends U{constructor(e){super(),N(this,e,Ci,Pi,T,{onClose:1,onContinue:6,onError:7,paymentInfoCollectionMetadata:8,processing:0},_i)}}function Qi(t){return t.trim()===""?"You need to provide your email address to continue.":t.match(/^[^@]+@[^@]+\.[^@]+$/)?null:"Email is not valid. Please provide a valid email address."}function Ti(t){F(t,"svelte-favd20","form.svelte-favd20.svelte-favd20{display:flex;flex-direction:column;min-height:100%;flex-grow:1}.form-container.svelte-favd20.svelte-favd20{display:flex;flex-direction:column;width:100%;margin-top:32px;margin-bottom:16px}.form-label.svelte-favd20.svelte-favd20{margin-top:8px;margin-bottom:8px;display:block;font-weight:500;line-height:22px}.form-input.error.svelte-favd20 input.svelte-favd20{border-color:var(--rc-color-error)}.form-error.svelte-favd20.svelte-favd20{margin-top:4px;font-size:16px;line-height:20px;min-height:40px;color:var(--rc-color-error)}input.svelte-favd20.svelte-favd20{width:100%;box-sizing:border-box;padding:8px;border:2px solid var(--rc-color-grey-ui-dark);border-radius:12px;font-size:16px;height:48px;padding:6px 14px}input.svelte-favd20.svelte-favd20:focus{outline:none;border:2px solid var(--rc-color-focus)}")}function Ni(t){let e;return{c(){e=O("Billing email address")},m(r,n){p(r,e,n)},d(r){r&&g(e)}}}function Mt(t){let e,r;return{c(){e=k("div"),r=O(t[2]),h(e,"class","form-error svelte-favd20")},m(n,i){p(n,e,i),P(e,r)},p(n,i){i&4&&le(r,n[2])},d(n){n&&g(e)}}}function Ui(t){let e,r,n,i,o,s,l,c,a,u=t[2]&&Mt(t);return{c(){e=k("div"),r=k("div"),r.innerHTML='<label for="email">Email</label>',n=Q(),i=k("div"),o=k("input"),l=Q(),u&&u.c(),h(r,"class","form-label svelte-favd20"),h(o,"name","email"),h(o,"placeholder","john@appleseed.com"),h(o,"autocapitalize","off"),h(o,"class","svelte-favd20"),h(i,"class",s="form-input "+t[4]+" svelte-favd20"),h(e,"class","form-container svelte-favd20")},m(m,_){p(m,e,_),P(e,r),P(e,n),P(e,i),P(i,o),ft(o,t[3]),P(e,l),u&&u.m(e,null),c||(a=pe(o,"input",t[8]),c=!0)},p(m,_){_&8&&o.value!==m[3]&&ft(o,m[3]),_&16&&s!==(s="form-input "+m[4]+" svelte-favd20")&&h(i,"class",s),m[2]?u?u.p(m,_):(u=Mt(m),u.c(),u.m(e,null)):u&&(u.d(1),u=null)},d(m){m&&g(e),u&&u.d(),c=!1,a()}}}function Ri(t){let e;return{c(){e=O("Continue")},m(r,n){p(r,e,n)},i:y,o:y,d(r){r&&g(e)}}}function Si(t){let e,r;return e=new Ct({}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Oi(t){let e,r,n,i;const o=[Si,Ri],s=[];function l(c,a){return c[1]?0:1}return e=l(t),r=s[e]=o[e](t),{c(){r.c(),n=re()},m(c,a){s[e].m(c,a),p(c,n,a),i=!0},p(c,a){let u=e;e=l(c),e!==u&&(K(),d(s[u],1,1,()=>{s[u]=null}),q(),r=s[e],r||(r=s[e]=o[e](c),r.c()),f(r,1),r.m(n.parentNode,n))},i(c){i||(f(r),i=!0)},o(c){d(r),i=!1},d(c){c&&g(n),s[e].d(c)}}}function Li(t){let e;return{c(){e=O("Close")},m(r,n){p(r,e,n)},d(r){r&&g(e)}}}function Fi(t){let e,r,n,i;return e=new Ie({props:{disabled:t[1],$$slots:{default:[Oi]},$$scope:{ctx:t}}}),n=new Ie({props:{intent:"secondary",disabled:t[1],$$slots:{default:[Li]},$$scope:{ctx:t}}}),n.$on("click",function(){se(t[0])&&t[0].apply(this,arguments)}),{c(){w(e.$$.fragment),r=Q(),w(n.$$.fragment)},m(o,s){b(e,o,s),p(o,r,s),b(n,o,s),i=!0},p(o,s){t=o;const l={};s&2&&(l.disabled=t[1]),s&514&&(l.$$scope={dirty:s,ctx:t}),e.$set(l);const c={};s&2&&(c.disabled=t[1]),s&512&&(c.$$scope={dirty:s,ctx:t}),n.$set(c)},i(o){i||(f(e.$$.fragment,o),f(n.$$.fragment,o),i=!0)},o(o){d(e.$$.fragment,o),d(n.$$.fragment,o),i=!1},d(o){o&&g(r),I(e,o),I(n,o)}}}function xi(t){let e,r;return e=new we({props:{$$slots:{default:[Fi]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){const o={};i&515&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Gi(t){let e,r,n,i,o,s,l,c,a;return r=new We({props:{$$slots:{default:[Ni]},$$scope:{ctx:t}}}),i=new fe({props:{$$slots:{default:[Ui]},$$scope:{ctx:t}}}),s=new Ve({props:{$$slots:{default:[xi]},$$scope:{ctx:t}}}),{c(){e=k("form"),w(r.$$.fragment),n=Q(),w(i.$$.fragment),o=Q(),w(s.$$.fragment),h(e,"class","svelte-favd20")},m(u,m){p(u,e,m),b(r,e,null),P(e,n),b(i,e,null),P(e,o),b(s,e,null),l=!0,c||(a=pe(e,"submit",ut(t[5])),c=!0)},p(u,[m]){const _={};m&512&&(_.$$scope={dirty:m,ctx:u}),r.$set(_);const v={};m&540&&(v.$$scope={dirty:m,ctx:u}),i.$set(v);const E={};m&515&&(E.$$scope={dirty:m,ctx:u}),s.$set(E)},i(u){l||(f(r.$$.fragment,u),f(i.$$.fragment,u),f(s.$$.fragment,u),l=!0)},o(u){d(r.$$.fragment,u),d(i.$$.fragment,u),d(s.$$.fragment,u),l=!1},d(u){u&&g(e),I(r),I(i),I(s),c=!1,a()}}}function Yi(t,e,r){let n,i,o,{onContinue:s}=e,{onClose:l}=e,{processing:c}=e,{lastError:a}=e;const u=async()=>{const _=Qi(n);_?r(2,i=_):s({email:n})};gn(async()=>{r(2,i=(a==null?void 0:a.message)??"")});function m(){n=this.value,r(3,n)}return t.$$set=_=>{"onContinue"in _&&r(6,s=_.onContinue),"onClose"in _&&r(0,l=_.onClose),"processing"in _&&r(1,c=_.processing),"lastError"in _&&r(7,a=_.lastError)},t.$$.update=()=>{t.$$.dirty&4&&r(4,o=i?"error":"")},r(3,n=""),r(2,i=""),[l,c,i,n,o,u,s,a,m]}class Hi extends U{constructor(e){super(),N(this,e,Yi,Gi,T,{onContinue:6,onClose:0,processing:1,lastError:7},Ti)}}function Ki(t){F(t,"svelte-17tslso",".rcb-modal-backdrop.svelte-17tslso{position:fixed;top:0;left:0;right:0;min-width:100%;width:100vw;width:100dvw;min-height:100%;height:100vh;height:100dvh;background-color:rgba(40, 40, 40, 0.75);display:flex;flex-direction:column;justify-content:space-around;z-index:1000001}")}function qi(t){let e,r;const n=t[1].default,i=J(n,t,t[0],null);return{c(){e=k("div"),i&&i.c(),h(e,"class","rcb-modal-backdrop svelte-17tslso")},m(o,s){p(o,e,s),i&&i.m(e,null),r=!0},p(o,[s]){i&&i.p&&(!r||s&1)&&W(i,n,o,o[0],r?V(n,o[0],s,null):z(o[0]),null)},i(o){r||(f(i,o),r=!0)},o(o){d(i,o),r=!1},d(o){o&&g(e),i&&i.d(o)}}}function ji(t,e,r){let{$$slots:n={},$$scope:i}=e;return t.$$set=o=>{"$$scope"in o&&r(0,i=o.$$scope)},[i,n]}class Ji extends U{constructor(e){super(),N(this,e,ji,qi,T,{},Ki)}}function Vi(t){F(t,"svelte-ioxu5d",".rcb-modal-container.svelte-ioxu5d{width:100%}.rcb-modal-main.svelte-ioxu5d{box-sizing:border-box;border-radius:8px;background-color:var(--rc-color-white);color:var(--rc-color-grey-text-dark);min-height:460px;padding:40px;flex-direction:column;display:flex}.rcb-modal-dark.svelte-ioxu5d{background-color:var(--rc-color-grey-text-dark);color:var(--rc-color-white);min-height:0px}@media screen and (max-width: 960px){.rcb-modal-container.svelte-ioxu5d{width:calc(100% - 32px);min-width:300px;max-width:640px;margin:auto}.rcb-modal-main.svelte-ioxu5d,.rcb-modal-dark.svelte-ioxu5d{min-width:300px;max-width:640px;padding:32px}}")}function Wi(t){let e,r,n,i;const o=t[2].default,s=J(o,t,t[1],null);return{c(){e=k("div"),r=k("main"),s&&s.c(),h(r,"class",n=ge(`rcb-modal-main ${t[0]?"rcb-modal-dark":""}`)+" svelte-ioxu5d"),h(e,"class","rcb-modal-container svelte-ioxu5d")},m(l,c){p(l,e,c),P(e,r),s&&s.m(r,null),i=!0},p(l,[c]){s&&s.p&&(!i||c&2)&&W(s,o,l,l[1],i?V(o,l[1],c,null):z(l[1]),null),(!i||c&1&&n!==(n=ge(`rcb-modal-main ${l[0]?"rcb-modal-dark":""}`)+" svelte-ioxu5d"))&&h(r,"class",n)},i(l){i||(f(s,l),i=!0)},o(l){d(s,l),i=!1},d(l){l&&g(e),s&&s.d(l)}}}function zi(t,e,r){let{$$slots:n={},$$scope:i}=e,{dark:o=!1}=e;return t.$$set=s=>{"dark"in s&&r(0,o=s.dark),"$$scope"in s&&r(1,i=s.$$scope)},[o,i,n]}class Xi extends U{constructor(e){super(),N(this,e,zi,Wi,T,{dark:0},Vi)}}function Zi(t){let e;const r=t[1].default,n=J(r,t,t[2],null);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&4)&&W(n,r,i,i[2],e?V(r,i[2],o,null):z(i[2]),null)},i(i){e||(f(n,i),e=!0)},o(i){d(n,i),e=!1},d(i){n&&n.d(i)}}}function eo(t){let e,r;return e=new Ji({props:{$$slots:{default:[to]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){const o={};i&4&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function to(t){let e;const r=t[1].default,n=J(r,t,t[2],null);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&4)&&W(n,r,i,i[2],e?V(r,i[2],o,null):z(i[2]),null)},i(i){e||(f(n,i),e=!0)},o(i){d(n,i),e=!1},d(i){n&&n.d(i)}}}function no(t){let e,r,n,i;const o=[eo,Zi],s=[];function l(c,a){return c[0]?0:1}return e=l(t),r=s[e]=o[e](t),{c(){r.c(),n=re()},m(c,a){s[e].m(c,a),p(c,n,a),i=!0},p(c,[a]){let u=e;e=l(c),e===u?s[e].p(c,a):(K(),d(s[u],1,1,()=>{s[u]=null}),q(),r=s[e],r?r.p(c,a):(r=s[e]=o[e](c),r.c()),f(r,1),r.m(n.parentNode,n))},i(c){i||(f(r),i=!0)},o(c){d(r),i=!1},d(c){c&&g(n),s[e].d(c)}}}function ro(t,e,r){let{$$slots:n={},$$scope:i}=e,{condition:o=!1}=e;return t.$$set=s=>{"condition"in s&&r(0,o=s.condition),"$$scope"in s&&r(2,i=s.$$scope)},[o,n,i]}class io extends U{constructor(e){super(),N(this,e,ro,no,T,{condition:0})}}const oo=t=>({}),Qt=t=>({});function so(t){let e,r;const n=t[1].header,i=J(n,t,t[2],Qt),o=t[1].default,s=J(o,t,t[2],null);return{c(){i&&i.c(),e=Q(),s&&s.c()},m(l,c){i&&i.m(l,c),p(l,e,c),s&&s.m(l,c),r=!0},p(l,c){i&&i.p&&(!r||c&4)&&W(i,n,l,l[2],r?V(n,l[2],c,oo):z(l[2]),Qt),s&&s.p&&(!r||c&4)&&W(s,o,l,l[2],r?V(o,l[2],c,null):z(l[2]),null)},i(l){r||(f(i,l),f(s,l),r=!0)},o(l){d(i,l),d(s,l),r=!1},d(l){l&&g(e),i&&i.d(l),s&&s.d(l)}}}function lo(t){let e,r;return e=new Xi({props:{dark:t[0],$$slots:{default:[so]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,[i]){const o={};i&1&&(o.dark=n[0]),i&4&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function co(t,e,r){let{$$slots:n={},$$scope:i}=e,{dark:o=!1}=e;return t.$$set=s=>{"dark"in s&&r(0,o=s.dark),"$$scope"in s&&r(2,i=s.$$scope)},[o,n,i]}class Tt extends U{constructor(e){super(),N(this,e,co,lo,T,{dark:0})}}const ao="0.4.0",uo="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 ze(t){return t?t.startsWith("rcb_sb_"):!1}async function de(t,e){const{apiKey:r,body:n,headers:i,httpConfig:o}=e,l=`${(o==null?void 0:o.proxyURL)??uo}${t.urlPath()}`;try{const c=await fetch(l,{method:t.method,headers:go(r,i,o==null?void 0:o.additionalHeaders),body:mo(n)});return await fo(c,t),await c.json()}catch(c){throw c instanceof TypeError?new X(ee.NetworkError,Ee.getPublicMessage(ee.NetworkError),c.message):c}}async function fo(t,e){const r=t.status;if(r>=Ue.INTERNAL_SERVER_ERROR)Xe(e,r,await t.text());else if(r>=Ue.BAD_REQUEST){const n=await t.json(),i=n?JSON.stringify(n):null,o=n==null?void 0:n.code,s=n==null?void 0:n.message;if(o!=null){const l=Ee.convertCodeToBackendErrorCode(o);if(l==null)Xe(e,r,i);else throw X.getForBackendError(l,s)}else Xe(e,r,i)}}function Xe(t,e,r){throw new X(ee.UnknownBackendError,`Unknown backend error. Request: ${t.name}. Status code: ${e}. Body: ${r}.`)}function mo(t){return t==null?null:JSON.stringify(t)}function go(t,e,r){let n={Authorization:`Bearer ${t}`,"Content-Type":"application/json",Accept:"application/json","X-Platform":"web","X-Version":ao,"X-Is-Sandbox":`${ze(t)}`};return e&&(n={...n,...e}),r&&(n={...r,...n}),n}const Nt="/v1/subscribers",Re="/rcbilling/v1";class po{constructor(e){M(this,"appUserId");M(this,"method","GET");M(this,"name","getOfferings");this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${Nt}/${e}/offerings`}}class ho{constructor(){M(this,"method","POST");M(this,"name","subscribe")}urlPath(){return`${Re}/subscribe`}}class _o{constructor(e,r){M(this,"method","GET");M(this,"name","getProducts");M(this,"appUserId");M(this,"productIds");this.appUserId=e,this.productIds=r}urlPath(){const e=encodeURIComponent(this.appUserId),r=this.productIds.map(encodeURIComponent).join("&id=");return`${Re}/subscribers/${e}/products?id=${r}`}}class Ao{constructor(e){M(this,"method","GET");M(this,"name","getCustomerInfo");M(this,"appUserId");this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${Nt}/${e}`}}class Eo{constructor(){M(this,"method","GET");M(this,"name","getBrandingInfo")}urlPath(){return`${Re}/branding`}}class bo{constructor(e){M(this,"method","GET");M(this,"name","getCheckoutStatus");M(this,"operationSessionId");this.operationSessionId=e}urlPath(){return`${Re}/checkout/${this.operationSessionId}`}}const Ze={};class Io{constructor(e,r=Ze){M(this,"API_KEY");M(this,"httpConfig");this.API_KEY=e,this.httpConfig=r}async getOfferings(e){return await de(new po(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getCustomerInfo(e){return await de(new Ao(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getProducts(e,r){return await de(new _o(e,r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getBrandingInfo(){return await de(new Eo,{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async postSubscribe(e,r,n,i,o){const s={app_user_id:e,product_id:r,email:n,presented_offering_identifier:i};return o&&o!=="base_option"&&(s.offer_id=o),await de(new ho,{apiKey:this.API_KEY,body:s,httpConfig:this.httpConfig})}async getCheckoutStatus(e){return await de(new bo(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}}const wo="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 ko(t){let e,r;return{c(){e=k("img"),ne(e.src,r=wo)||h(e,"src",r),h(e,"alt","icon"),h(e,"class","rcb-ui-asset-icon")},m(n,i){p(n,e,i)},p:y,i:y,o:y,d(n){n&&g(e)}}}class yo extends U{constructor(e){super(),N(this,e,null,ko,T,{})}}function vo(t){F(t,"svelte-1rhrjxe","div.svelte-1rhrjxe{background-color:var(--rc-color-warning);color:var(--rc-color-grey-text-dark);font-size:10px;font-weight:bold;text-transform:uppercase;padding:4px 10px;line-height:10px;border-radius:9px;margin:0px;margin-left:16px}")}function $o(t){let e;return{c(){e=k("div"),e.textContent="Sandbox",h(e,"class","svelte-1rhrjxe")},m(r,n){p(r,e,n)},p:y,i:y,o:y,d(r){r&&g(e)}}}class Bo extends U{constructor(e){super(),N(this,e,null,$o,T,{},vo)}}function Do(t){F(t,"svelte-1qect5g",`.rcb-ui-container.svelte-1qect5g{color-scheme:none;font-size:16px;line-height:1.5em;font-weight:400;font-family:-apple-system, "system-ui", "Segoe UI", Roboto, Oxygen, Ubuntu,
7
+ Cantarell, "Open Sans", "Helvetica Neue", sans-serif}.rcb-ui-layout.svelte-1qect5g{width:100vw;width:100 dvw;margin-right:auto;display:flex;justify-content:center;align-items:flex-start;position:relative;padding:0px 80px;box-sizing:border-box}.rcb-ui-aside.svelte-1qect5g{margin-right:16px;flex:320px 1 0;max-width:480px}.rcb-ui-main.svelte-1qect5g{flex:480px 1 0;max-width:640px}@media screen and (max-width: 960px){.rcb-ui-layout.svelte-1qect5g{flex-direction:column;align-items:center;justify-content:center;height:100%;min-width:100%}.rcb-ui-aside.svelte-1qect5g{margin-right:0;margin-bottom:16px;min-width:100%;display:flex;flex-direction:column;align-items:center;flex:none;max-width:none}.rcb-ui-main.svelte-1qect5g{flex:none;max-width:none;min-width:100%}}@media screen and (max-width: 960px) and (max-height: 960px){.rcb-ui-layout.svelte-1qect5g{overflow-y:scroll;justify-content:flex-start;padding:16px 0px}}`)}function Ut(t){let e,r,n;return r=new Tt({props:{dark:!0,$$slots:{header:[To],default:[Po]},$$scope:{ctx:t}}}),{c(){e=k("div"),w(r.$$.fragment),h(e,"class","rcb-ui-aside svelte-1qect5g")},m(i,o){p(i,e,o),b(r,e,null),n=!0},p(i,o){const s={};o&67108878&&(s.$$scope={dirty:o,ctx:i}),r.$set(s)},i(i){n||(f(r.$$.fragment,i),n=!0)},o(i){d(r.$$.fragment,i),n=!1},d(i){i&&g(e),I(r)}}}function Rt(t){let e,r;return e=new pt({props:{productDetails:t[2],purchaseOption:t[8]}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){const o={};i&4&&(o.productDetails=n[2]),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Po(t){let e,r,n=t[2]&&t[8]&&Rt(t);return{c(){n&&n.c(),e=re()},m(i,o){n&&n.m(i,o),p(i,e,o),r=!0},p(i,o){i[2]&&i[8]?n?(n.p(i,o),o&4&&f(n,1)):(n=Rt(i),n.c(),f(n,1),n.m(e.parentNode,e)):n&&(K(),d(n,1,1,()=>{n=null}),q())},i(i){r||(f(n),r=!0)},o(i){d(n),r=!1},d(i){i&&g(e),n&&n.d(i)}}}function Co(t){let e,r;return e=new yo({}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Mo(t){let e,r;return e=new Bo({}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Qo(t){let e,r,n,i,o,s,l;e=new bt({props:{brandingInfo:t[3]}});const c=[Mo,Co],a=[];function u(m,_){return _&2&&(n=null),n==null&&(n=!!m[1].isSandbox()),n?0:1}return i=u(t,-1),o=a[i]=c[i](t),{c(){w(e.$$.fragment),r=Q(),o.c(),s=re()},m(m,_){b(e,m,_),p(m,r,_),a[i].m(m,_),p(m,s,_),l=!0},p(m,_){const v={};_&8&&(v.brandingInfo=m[3]),e.$set(v);let E=i;i=u(m,_),i!==E&&(K(),d(a[E],1,1,()=>{a[E]=null}),q(),o=a[i],o||(o=a[i]=c[i](m),o.c()),f(o,1),o.m(s.parentNode,s))},i(m){l||(f(e.$$.fragment,m),f(o),l=!0)},o(m){d(e.$$.fragment,m),d(o),l=!1},d(m){m&&(g(r),g(s)),I(e,m),a[i].d(m)}}}function To(t){let e,r;return e=new We({props:{slot:"header",$$slots:{default:[Qo]},$$scope:{ctx:t}}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){const o={};i&67108874&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function St(t){let e,r;return e=new pt({props:{productDetails:t[2],purchaseOption:t[8]}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){const o={};i&4&&(o.productDetails=n[2]),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Ot(t){let e,r;return e=new Je({}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Lt(t){let e,r;return e=new Hi({props:{onContinue:t[11],onClose:t[10],processing:t[6]==="processing-auth-info",lastError:t[5]}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){const o={};i&64&&(o.processing=n[6]==="processing-auth-info"),i&32&&(o.lastError=n[5]),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Ft(t){let e,r;return e=new Mi({props:{paymentInfoCollectionMetadata:t[4],onContinue:t[11],onClose:t[10],onError:t[12],processing:t[6]==="polling-purchase-status"}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){const o={};i&16&&(o.paymentInfoCollectionMetadata=n[4]),i&64&&(o.processing=n[6]==="polling-purchase-status"),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function xt(t){let e,r;return e=new Je({}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function Gt(t){var n;let e,r;return e=new Ur({props:{brandingInfo:t[3],lastError:t[5]??new j(L.UnknownError,"Unknown error without state set."),supportEmail:(n=t[3])==null?void 0:n.seller_company_support_email,onContinue:t[13]}}),{c(){w(e.$$.fragment)},m(i,o){b(e,i,o),r=!0},p(i,o){var l;const s={};o&8&&(s.brandingInfo=i[3]),o&32&&(s.lastError=i[5]??new j(L.UnknownError,"Unknown error without state set.")),o&8&&(s.supportEmail=(l=i[3])==null?void 0:l.seller_company_support_email),e.$set(s)},i(i){r||(f(e.$$.fragment,i),r=!0)},o(i){d(e.$$.fragment,i),r=!1},d(i){I(e,i)}}}function Yt(t){let e,r;return e=new Hr({props:{brandingInfo:t[3],onContinue:t[11]}}),{c(){w(e.$$.fragment)},m(n,i){b(e,n,i),r=!0},p(n,i){const o={};i&8&&(o.brandingInfo=n[3]),e.$set(o)},i(n){r||(f(e.$$.fragment,n),r=!0)},o(n){d(e.$$.fragment,n),r=!1},d(n){I(e,n)}}}function No(t){let e,r,n,i,o,s,l,c,a=t[6]==="present-offer"&&t[2]&&t[8]&&St(t),u=t[6]==="present-offer"&&!t[2]&&Ot(),m=(t[6]==="needs-auth-info"||t[6]==="processing-auth-info")&&Lt(t),_=t[4]&&(t[6]==="needs-payment-info"||t[6]==="polling-purchase-status")&&Ft(t),v=t[6]==="loading"&&xt(),E=t[6]==="error"&&Gt(t),B=t[6]==="success"&&Yt(t);return{c(){a&&a.c(),e=Q(),u&&u.c(),r=Q(),m&&m.c(),n=Q(),_&&_.c(),i=Q(),v&&v.c(),o=Q(),E&&E.c(),s=Q(),B&&B.c(),l=re()},m(A,$){a&&a.m(A,$),p(A,e,$),u&&u.m(A,$),p(A,r,$),m&&m.m(A,$),p(A,n,$),_&&_.m(A,$),p(A,i,$),v&&v.m(A,$),p(A,o,$),E&&E.m(A,$),p(A,s,$),B&&B.m(A,$),p(A,l,$),c=!0},p(A,$){A[6]==="present-offer"&&A[2]&&A[8]?a?(a.p(A,$),$&68&&f(a,1)):(a=St(A),a.c(),f(a,1),a.m(e.parentNode,e)):a&&(K(),d(a,1,1,()=>{a=null}),q()),A[6]==="present-offer"&&!A[2]?u?$&68&&f(u,1):(u=Ot(),u.c(),f(u,1),u.m(r.parentNode,r)):u&&(K(),d(u,1,1,()=>{u=null}),q()),A[6]==="needs-auth-info"||A[6]==="processing-auth-info"?m?(m.p(A,$),$&64&&f(m,1)):(m=Lt(A),m.c(),f(m,1),m.m(n.parentNode,n)):m&&(K(),d(m,1,1,()=>{m=null}),q()),A[4]&&(A[6]==="needs-payment-info"||A[6]==="polling-purchase-status")?_?(_.p(A,$),$&80&&f(_,1)):(_=Ft(A),_.c(),f(_,1),_.m(i.parentNode,i)):_&&(K(),d(_,1,1,()=>{_=null}),q()),A[6]==="loading"?v?$&64&&f(v,1):(v=xt(),v.c(),f(v,1),v.m(o.parentNode,o)):v&&(K(),d(v,1,1,()=>{v=null}),q()),A[6]==="error"?E?(E.p(A,$),$&64&&f(E,1)):(E=Gt(A),E.c(),f(E,1),E.m(s.parentNode,s)):E&&(K(),d(E,1,1,()=>{E=null}),q()),A[6]==="success"?B?(B.p(A,$),$&64&&f(B,1)):(B=Yt(A),B.c(),f(B,1),B.m(l.parentNode,l)):B&&(K(),d(B,1,1,()=>{B=null}),q())},i(A){c||(f(a),f(u),f(m),f(_),f(v),f(E),f(B),c=!0)},o(A){d(a),d(u),d(m),d(_),d(v),d(E),d(B),c=!1},d(A){A&&(g(e),g(r),g(n),g(i),g(o),g(s),g(l)),a&&a.d(A),u&&u.d(A),m&&m.d(A),_&&_.d(A),v&&v.d(A),E&&E.d(A),B&&B.d(A)}}}function Uo(t){let e,r=t[9].includes(t[6]),n,i,o,s,l=r&&Ut(t);return o=new Tt({props:{$$slots:{default:[No]},$$scope:{ctx:t}}}),{c(){e=k("div"),l&&l.c(),n=Q(),i=k("div"),w(o.$$.fragment),h(i,"class","rcb-ui-main svelte-1qect5g"),h(e,"class","rcb-ui-layout svelte-1qect5g"),h(e,"style",t[7])},m(c,a){p(c,e,a),l&&l.m(e,null),P(e,n),P(e,i),b(o,i,null),s=!0},p(c,a){a&64&&(r=c[9].includes(c[6])),r?l?(l.p(c,a),a&64&&f(l,1)):(l=Ut(c),l.c(),f(l,1),l.m(e,n)):l&&(K(),d(l,1,1,()=>{l=null}),q());const u={};a&67108988&&(u.$$scope={dirty:a,ctx:c}),o.$set(u)},i(c){s||(f(l),f(o.$$.fragment,c),s=!0)},o(c){d(l),d(o.$$.fragment,c),s=!1},d(c){c&&g(e),l&&l.d(),I(o)}}}function Ro(t){let e,r,n;return r=new io({props:{condition:t[0],$$slots:{default:[Uo]},$$scope:{ctx:t}}}),{c(){e=k("div"),w(r.$$.fragment),h(e,"class","rcb-ui-container svelte-1qect5g")},m(i,o){p(i,e,o),b(r,e,null),n=!0},p(i,[o]){const s={};o&1&&(s.condition=i[0]),o&67108990&&(s.$$scope={dirty:o,ctx:i}),r.$set(s)},i(i){n||(f(r.$$.fragment,i),n=!0)},o(i){d(r.$$.fragment,i),n=!1},d(i){i&&g(e),I(r)}}}function So(t,e,r){var Kt,qt;let{asModal:n=!0}=e,{customerEmail:i}=e,{appUserId:o}=e,{rcPackage:s}=e,{purchaseOption:l}=e,{onFinished:c}=e,{onError:a}=e,{onClose:u}=e,{purchases:m}=e,{backend:_}=e,{purchaseOperationHelper:v}=e;const E=Object.entries(ve).map(([D,tt])=>`--rc-color-${D}: ${tt}`).join("; ");let B=null,A=null,$=null,R=null;const C=((Kt=s==null?void 0:s.rcBillingProduct)==null?void 0:Kt.identifier)??null,Oe=(qt=s==null?void 0:s.rcBillingProduct)==null?void 0:qt.defaultSubscriptionOption,G=l||Oe;let S="present-offer";const Le=["present-offer","needs-auth-info","processing-auth-info","needs-payment-info","polling-purchase-status","loading"];De(async()=>{if(r(2,B=s.rcBillingProduct),r(3,A=await _.getBrandingInfo()),S==="present-offer"){i?Ht():r(6,S="needs-auth-info");return}});const Fe=()=>{u()},Ht=()=>{if(C===null){$e(new j(L.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}else S==="present-offer"&&r(6,S="loading");if(!i){$e(new j(L.MissingEmailError));return}v.startPurchase(o,C,G,i,s.rcBillingProduct.presentedOfferingIdentifier).then(D=>{if(D.next_action==="collect_payment_info"){r(5,R=null),r(6,S="needs-payment-info"),r(4,$=D);return}if(D.next_action==="completed"){r(5,R=null),r(6,S="success");return}}).catch(D=>{$e(D)})},Zo=D=>{if(S==="needs-auth-info"){D&&(r(14,i=D.email),r(6,S="processing-auth-info")),Ht();return}if(S==="needs-payment-info"){r(6,S="polling-purchase-status"),v.pollCurrentPurchaseForCompletion().then(()=>{r(6,S="success")}).catch(tt=>{$e(tt)});return}if(S==="success"||S==="error"){c();return}r(6,S="success")},$e=D=>{if(S==="processing-auth-info"){r(5,R=D),r(6,S="needs-auth-info");return}r(5,R=D),r(6,S="error")},es=()=>{a(R??new j(L.UnknownError,"Unknown error without state set."))};return t.$$set=D=>{"asModal"in D&&r(0,n=D.asModal),"customerEmail"in D&&r(14,i=D.customerEmail),"appUserId"in D&&r(15,o=D.appUserId),"rcPackage"in D&&r(16,s=D.rcPackage),"purchaseOption"in D&&r(17,l=D.purchaseOption),"onFinished"in D&&r(18,c=D.onFinished),"onError"in D&&r(19,a=D.onError),"onClose"in D&&r(20,u=D.onClose),"purchases"in D&&r(1,m=D.purchases),"backend"in D&&r(21,_=D.backend),"purchaseOperationHelper"in D&&r(22,v=D.purchaseOperationHelper)},[n,m,B,A,$,R,S,E,G,Le,Fe,Zo,$e,es,i,o,s,l,c,a,u,_,v]}class Oo extends U{constructor(e){super(),N(this,e,So,Ro,T,{asModal:0,customerEmail:14,appUserId:15,rcPackage:16,purchaseOption:17,onFinished:18,onError:19,onClose:20,purchases:1,backend:21,purchaseOperationHelper:22},Do)}}function Lo(t){return t.expires_date==null?!0:new Date(t.expires_date)>new Date}function Fo(t,e,r,n){const i=e.product_identifier;if(i in r)return xo(t,e,r[i]);if(i in n)return Go(t,e,n[i]);throw new X(ee.CustomerInfoError,"Could not find entitlement product in subscriptions or non-subscriptions.")}function xo(t,e,r){return{identifier:t,isActive:Lo(e),willRenew:Ko(e,r),store:(r==null?void 0:r.store)??"unknown",latestPurchaseDate:new Date(e.purchase_date),originalPurchaseDate:new Date(e.purchase_date),expirationDate:Se(e.expires_date),productIdentifier:e.product_identifier,unsubscribeDetectedAt:Se(r==null?void 0:r.unsubscribe_detected_at),billingIssueDetectedAt:Se(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 Go(t,e,r){return{identifier:t,isActive:!0,willRenew:!1,store:r.store,latestPurchaseDate:new Date(e.purchase_date),originalPurchaseDate:new Date(r.original_purchase_date),expirationDate:null,productIdentifier:e.product_identifier,unsubscribeDetectedAt:null,billingIssueDetectedAt:null,isSandbox:r.is_sandbox,periodType:"normal"}}function Yo(t,e,r){const n={},i={};for(const o in t){const s=Fo(o,t[o],e,r);n[o]=s,s.isActive&&(i[o]=s)}return{all:n,active:i}}function Se(t){return t==null?null:new Date(t)}function Ho(t){const e=jo(t),r=t.subscriber,n=Vo(r.non_subscriptions);return{entitlements:Yo(r.entitlements,r.subscriptions,n),allExpirationDatesByProduct:e,allPurchaseDatesByProduct:qo(t,n),activeSubscriptions:Jo(e),managementURL:r.management_url,requestDate:new Date(t.request_date),firstSeenDate:new Date(r.first_seen),originalPurchaseDate:Se(r.original_purchase_date),originalAppUserId:t.subscriber.original_app_user_id}}function Ko(t,e){if(e==null)return!1;const r=e.store=="promotional",n=t.expires_date==null,i=e.unsubscribe_detected_at!=null,o=e.billing_issues_detected_at!=null;return!(r||n||i||o)}function qo(t,e){const r={};for(const n in t.subscriber.subscriptions){const i=t.subscriber.subscriptions[n];r[n]=new Date(i.purchase_date)}for(const n in e){const i=e[n].purchase_date;i==null?r[n]=null:r[n]=new Date(i)}return r}function jo(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 Jo(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}function Vo(t){const e={};for(const r in t){if(t[r].length===0)continue;const n=t[r].length;e[r]=t[r][n-1]}return e}function Wo(t){if(!/^rcb_[a-zA-Z0-9_.-]+$/.test(t))throw new X(ee.InvalidCredentialsError,"Invalid API key. Use your RevenueCat Billing API key.")}function zo(t){if(new Set(["no_user","null","none","nil","(null)","NaN","\\x00","","unidentified","undefined","unknown"]).has(t)||t.includes("/"))throw new X(ee.InvalidAppUserIdError,'Provided user id: "'+t+'" is not valid. See https://www.revenuecat.com/docs/customers/user-ids#tips-for-setting-app-user-ids for more information.')}function Xo(t){if(t!=null&&t.endsWith("/"))throw new X(ee.ConfigurationError,"Invalid proxy URL. The proxy URL should not end with a trailing slash.")}const te=class te{constructor(e,r,n=Ze){M(this,"_API_KEY");M(this,"_appUserId");M(this,"backend");M(this,"purchaseOperationHelper");M(this,"toOfferings",(e,r)=>{const n=e.offerings.find(l=>l.identifier===e.current_offering_id)??null,i={};r.product_details.forEach(l=>{i[l.identifier]=l});const o=n==null?null:ot(n,i),s={};return e.offerings.forEach(l=>{const c=ot(l,i);c!=null&&(s[l.identifier]=c)}),Object.keys(s).length==0&&Y.debugLog("Empty offerings. Please make sure you've configured offerings correctly in the RevenueCat dashboard and that the products are properly configured."),{all:s,current:o}});this._API_KEY=e,this._appUserId=r,ze(e)&&Y.debugLog("Initializing Purchases SDK with sandbox API Key"),this.backend=new Io(this._API_KEY,n),this.purchaseOperationHelper=new xn(this.backend)}static setLogLevel(e){Y.setLogLevel(e)}static getSharedInstance(){if(te.isConfigured())return te.instance;throw new _t}static isConfigured(){return te.instance!==void 0}static configure(e,r,n=Ze){return te.instance!==void 0&&Y.warnLog("Purchases is already initialized. You normally should only configure Purchases once. Creating and returning new instance."),Wo(e),zo(r),Xo(n.proxyURL),te.instance=new te(e,r,n),te.getSharedInstance()}async getOfferings(){const e=this._appUserId,r=await this.backend.getOfferings(e),n=r.offerings.flatMap(o=>o.packages).map(o=>o.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){return this.purchase({rcPackage:e,customerEmail:r,htmlTarget:n})}purchase(e){const{rcPackage:r,purchaseOption:n,htmlTarget:i,customerEmail:o}=e;let s=i??document.getElementById("rcb-ui-root");if(s===null){const u=document.createElement("div");u.className="rcb-ui-root",document.body.appendChild(u),s=u}if(s===null)throw new Error("Could not generate a mount point for the billing widget");const l=s,c=!i,a=this._appUserId;return Y.debugLog(`Presenting purchase form for package ${r.identifier}`),new Promise((u,m)=>{new Oo({target:l,props:{appUserId:a,rcPackage:r,purchaseOption:n,customerEmail:o,onFinished:async()=>{Y.debugLog("Purchase finished"),l.innerHTML="",u({customerInfo:await this._getCustomerInfoForUserId(a)})},onClose:()=>{l.innerHTML="",Y.debugLog("Purchase cancelled by user"),m(new X(ee.UserCancelledError))},onError:_=>{l.innerHTML="",m(X.getForPurchasesFlowError(_))},purchases:this,backend:this.backend,purchaseOperationHelper:this.purchaseOperationHelper,asModal:c}})})}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(o=>n[o.identifier]=o);const i=[];e.forEach(o=>{n[o]===void 0&&i.push(o)}),i.length>0&&Y.debugLog(`Could not find product data for product ids:
8
8
  ${i.join()}.
9
- Please check that your product configuration is correct.`)}isSandbox(){return Xe(this._API_KEY)}close(){te.instance===this?te.instance=void 0:Y.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 Yo(r)}};C(te,"instance");let et=te;H.ErrorCode=ee,H.LogLevel=x,H.PackageType=rt,H.Purchases=et,H.PurchasesError=Z,H.UninitializedPurchasesError=At,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})});
9
+ Please check that your product configuration is correct.`)}isSandbox(){return ze(this._API_KEY)}close(){te.instance===this?te.instance=void 0:Y.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 Ho(r)}};M(te,"instance");let et=te;H.ErrorCode=ee,H.LogLevel=x,H.PackageType=rt,H.Purchases=et,H.PurchasesError=X,H.UninitializedPurchasesError=_t,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@revenuecat/purchases-js",
3
3
  "description": "Web subscriptions made easy. Powered by RevenueCat",
4
4
  "private": false,
5
- "version": "0.3.4",
5
+ "version": "0.4.0",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"