@revenuecat/purchases-js 0.15.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Purchases.es.js +6 -4
- package/dist/Purchases.umd.js +3 -3
- package/package.json +1 -1
package/dist/Purchases.es.js
CHANGED
|
@@ -5553,7 +5553,7 @@ const wu = {
|
|
|
5553
5553
|
"grey-text-light": "rgba(0,0,0,0.5)",
|
|
5554
5554
|
"grey-ui-dark": "rgba(0,0,0,0.125)",
|
|
5555
5555
|
"grey-ui-light": "rgba(0,0,0,0.005)",
|
|
5556
|
-
"input-background": "
|
|
5556
|
+
"input-background": "white",
|
|
5557
5557
|
background: "white"
|
|
5558
5558
|
}, Pu = {
|
|
5559
5559
|
error: "#f2545b",
|
|
@@ -5567,7 +5567,7 @@ const wu = {
|
|
|
5567
5567
|
"grey-text-light": "rgba(255,255,255,0.5)",
|
|
5568
5568
|
"grey-ui-dark": "rgba(255,255,255,0.125)",
|
|
5569
5569
|
"grey-ui-light": "rgba(255,255,255,0.005)",
|
|
5570
|
-
"input-background": "
|
|
5570
|
+
"input-background": "#000000",
|
|
5571
5571
|
background: "#000000"
|
|
5572
5572
|
}, co = {
|
|
5573
5573
|
error: "color_error",
|
|
@@ -5576,9 +5576,11 @@ const wu = {
|
|
|
5576
5576
|
primary: "color_buttons_primary"
|
|
5577
5577
|
}, ku = {
|
|
5578
5578
|
...co,
|
|
5579
|
+
"input-background": "color_form_bg",
|
|
5579
5580
|
background: "color_form_bg"
|
|
5580
5581
|
}, Eu = {
|
|
5581
5582
|
...co,
|
|
5583
|
+
"input-background": "color_product_info_bg",
|
|
5582
5584
|
background: "color_product_info_bg"
|
|
5583
5585
|
}, _o = {
|
|
5584
5586
|
"input-border-radius": "12px",
|
|
@@ -5809,7 +5811,7 @@ function Uu(e, r) {
|
|
|
5809
5811
|
".Input": {
|
|
5810
5812
|
boxShadow: "none",
|
|
5811
5813
|
border: `2px solid ${h["grey-ui-dark"]}`,
|
|
5812
|
-
backgroundColor: "
|
|
5814
|
+
backgroundColor: h["input-background"],
|
|
5813
5815
|
color: h["grey-text-dark"]
|
|
5814
5816
|
},
|
|
5815
5817
|
".Input:focus": {
|
|
@@ -6714,7 +6716,7 @@ function Mc(e) {
|
|
|
6714
6716
|
}
|
|
6715
6717
|
return r;
|
|
6716
6718
|
}
|
|
6717
|
-
const Nc = "0.15.
|
|
6719
|
+
const Nc = "0.15.1", Cc = "https://api.revenuecat.com";
|
|
6718
6720
|
var gt;
|
|
6719
6721
|
(function(e) {
|
|
6720
6722
|
e[e.CONTINUE = 100] = "CONTINUE", e[e.SWITCHING_PROTOCOLS = 101] = "SWITCHING_PROTOCOLS", e[e.PROCESSING = 102] = "PROCESSING", e[e.EARLY_HINTS = 103] = "EARLY_HINTS", e[e.OK = 200] = "OK", e[e.CREATED = 201] = "CREATED", e[e.ACCEPTED = 202] = "ACCEPTED", e[e.NON_AUTHORITATIVE_INFORMATION = 203] = "NON_AUTHORITATIVE_INFORMATION", e[e.NO_CONTENT = 204] = "NO_CONTENT", e[e.RESET_CONTENT = 205] = "RESET_CONTENT", e[e.PARTIAL_CONTENT = 206] = "PARTIAL_CONTENT", e[e.MULTI_STATUS = 207] = "MULTI_STATUS", e[e.MULTIPLE_CHOICES = 300] = "MULTIPLE_CHOICES", e[e.MOVED_PERMANENTLY = 301] = "MOVED_PERMANENTLY", e[e.MOVED_TEMPORARILY = 302] = "MOVED_TEMPORARILY", e[e.SEE_OTHER = 303] = "SEE_OTHER", e[e.NOT_MODIFIED = 304] = "NOT_MODIFIED", e[e.USE_PROXY = 305] = "USE_PROXY", e[e.TEMPORARY_REDIRECT = 307] = "TEMPORARY_REDIRECT", e[e.PERMANENT_REDIRECT = 308] = "PERMANENT_REDIRECT", e[e.BAD_REQUEST = 400] = "BAD_REQUEST", e[e.UNAUTHORIZED = 401] = "UNAUTHORIZED", e[e.PAYMENT_REQUIRED = 402] = "PAYMENT_REQUIRED", e[e.FORBIDDEN = 403] = "FORBIDDEN", e[e.NOT_FOUND = 404] = "NOT_FOUND", e[e.METHOD_NOT_ALLOWED = 405] = "METHOD_NOT_ALLOWED", e[e.NOT_ACCEPTABLE = 406] = "NOT_ACCEPTABLE", e[e.PROXY_AUTHENTICATION_REQUIRED = 407] = "PROXY_AUTHENTICATION_REQUIRED", e[e.REQUEST_TIMEOUT = 408] = "REQUEST_TIMEOUT", e[e.CONFLICT = 409] = "CONFLICT", e[e.GONE = 410] = "GONE", e[e.LENGTH_REQUIRED = 411] = "LENGTH_REQUIRED", e[e.PRECONDITION_FAILED = 412] = "PRECONDITION_FAILED", e[e.REQUEST_TOO_LONG = 413] = "REQUEST_TOO_LONG", e[e.REQUEST_URI_TOO_LONG = 414] = "REQUEST_URI_TOO_LONG", e[e.UNSUPPORTED_MEDIA_TYPE = 415] = "UNSUPPORTED_MEDIA_TYPE", e[e.REQUESTED_RANGE_NOT_SATISFIABLE = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE", e[e.EXPECTATION_FAILED = 417] = "EXPECTATION_FAILED", e[e.IM_A_TEAPOT = 418] = "IM_A_TEAPOT", e[e.INSUFFICIENT_SPACE_ON_RESOURCE = 419] = "INSUFFICIENT_SPACE_ON_RESOURCE", e[e.METHOD_FAILURE = 420] = "METHOD_FAILURE", e[e.MISDIRECTED_REQUEST = 421] = "MISDIRECTED_REQUEST", e[e.UNPROCESSABLE_ENTITY = 422] = "UNPROCESSABLE_ENTITY", e[e.LOCKED = 423] = "LOCKED", e[e.FAILED_DEPENDENCY = 424] = "FAILED_DEPENDENCY", e[e.UPGRADE_REQUIRED = 426] = "UPGRADE_REQUIRED", e[e.PRECONDITION_REQUIRED = 428] = "PRECONDITION_REQUIRED", e[e.TOO_MANY_REQUESTS = 429] = "TOO_MANY_REQUESTS", e[e.REQUEST_HEADER_FIELDS_TOO_LARGE = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE", e[e.UNAVAILABLE_FOR_LEGAL_REASONS = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS", e[e.INTERNAL_SERVER_ERROR = 500] = "INTERNAL_SERVER_ERROR", e[e.NOT_IMPLEMENTED = 501] = "NOT_IMPLEMENTED", e[e.BAD_GATEWAY = 502] = "BAD_GATEWAY", e[e.SERVICE_UNAVAILABLE = 503] = "SERVICE_UNAVAILABLE", e[e.GATEWAY_TIMEOUT = 504] = "GATEWAY_TIMEOUT", e[e.HTTP_VERSION_NOT_SUPPORTED = 505] = "HTTP_VERSION_NOT_SUPPORTED", e[e.INSUFFICIENT_STORAGE = 507] = "INSUFFICIENT_STORAGE", e[e.NETWORK_AUTHENTICATION_REQUIRED = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
|
package/dist/Purchases.umd.js
CHANGED
|
@@ -90,10 +90,10 @@
|
|
|
90
90
|
-20px 0 #fff2;
|
|
91
91
|
background: #fff2;
|
|
92
92
|
}
|
|
93
|
-
}`};function uo(e){H(e,hu);var r=mu();h(e,r)}const yu={error:"#f2545b",warning:"#f4e971",focus:"#000080",accent:"#767676",primary:"#000000","primary-text":"#ffffff",white:"#ffffff","grey-text-dark":"rgba(0,0,0,1)","grey-text-light":"rgba(0,0,0,0.5)","grey-ui-dark":"rgba(0,0,0,0.125)","grey-ui-light":"rgba(0,0,0,0.005)","input-background":"
|
|
93
|
+
}`};function uo(e){H(e,hu);var r=mu();h(e,r)}const yu={error:"#f2545b",warning:"#f4e971",focus:"#000080",accent:"#767676",primary:"#000000","primary-text":"#ffffff",white:"#ffffff","grey-text-dark":"rgba(0,0,0,1)","grey-text-light":"rgba(0,0,0,0.5)","grey-ui-dark":"rgba(0,0,0,0.125)","grey-ui-light":"rgba(0,0,0,0.005)","input-background":"white",background:"white"},gu={error:"#f2545b",warning:"#f4e971",focus:"#000080",accent:"#767676",primary:"#ffffff","primary-text":"#000000",white:"#ffffff","grey-text-dark":"rgba(255,255,255,1)","grey-text-light":"rgba(255,255,255,0.5)","grey-ui-dark":"rgba(255,255,255,0.125)","grey-ui-light":"rgba(255,255,255,0.005)","input-background":"#000000",background:"#000000"},co={error:"color_error",focus:"color_accent",accent:"color_accent",primary:"color_buttons_primary"},vu={...co,"input-background":"color_form_bg",background:"color_form_bg"},bu={...co,"input-background":"color_product_info_bg",background:"color_product_info_bg"},_o={"input-border-radius":"12px","input-button-border-radius":"12px","modal-border-radius":"16px"},wu={"input-border-radius":"0px","input-button-border-radius":"0px","modal-border-radius":"0px"},Pu={"input-border-radius":"24px","input-button-border-radius":"56px","modal-border-radius":"16px"},po=_o,fo=e=>e.length==7?{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16)}:e.length==4?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null,mo=({r:e,g:r,b:t,luminanceThreshold:n})=>{const a=s=>(s=s/255,s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4));return .2126*a(e)+.7152*a(r)+.0722*a(t)>n},ho=.37,ku=(e,r=ho)=>{const t=mo({...e,luminanceThreshold:r})?"0,0,0":"255,255,255";return{"grey-text-dark":`rgb(${t})`,"grey-text-light":`rgba(${t},0.50)`,"grey-ui-dark":`rgba(${t},0.125)`,"grey-ui-light":`rgba(${t},0.05)`}},Eu=(e,r,t,n=ho)=>{const a={"grey-text-dark":t["grey-text-dark"],"grey-text-light":t["grey-text-light"],"grey-ui-dark":t["grey-ui-dark"],"grey-ui-light":t["grey-ui-light"],"primary-text":t["primary-text"]};if(e!=null&&e.startsWith("#")){const o=fo(e);o!==null&&Object.assign(a,ku(o))}if(r!=null&&r.startsWith("#")){const o=fo(r);o!==null&&(a["primary-text"]=mo({...o,luminanceThreshold:n})?"black":"white")}return a},xu=(e,r)=>e||r,Su=(e,r,t)=>{const n=Object.entries(e).map(([a,o])=>[a,xu(t?t[o]:null,r[a])]);return Object.fromEntries(n)},yo=(e,r,t)=>{const n=Su(e,r,t);return t?{...r,...n,...Eu(n.background,n.primary,r)}:{...r}},Iu=e=>yo(bu,gu,e),go=e=>yo(vu,yu,e),Tn=e=>{if(!e)return po;switch(e.shapes){case"rounded":return _o;case"rectangle":return wu;case"pill":return Pu;default:return po}},Lt=(e="",r)=>r.map(([t,n])=>`--rc-${e}-${t}: ${n}`).join("; "),vo=e=>{const r=Lt("color",Object.entries(Iu(e))),t=Lt("shape",Object.entries(Tn(e)));return[r,t].join("; ")},qu=e=>{const r=Lt("color",Object.entries(go(e))),t=Lt("shape",Object.entries(Tn(e)));return[r,t].join("; ")};class Fn{constructor(r){this.brandingAppearance=r}get shape(){return Tn(this.brandingAppearance)}get formColors(){return go(this.brandingAppearance)}get formStyleVars(){return qu(this.brandingAppearance)}get productInfoStyleVars(){return vo(this.brandingAppearance)}}var Tu=x('<div class="rcb-header-wrapper svelte-1a9rihw"><!> <div class="rcb-step-title svelte-1a9rihw"><!></div></div> <!>',1),Fu=x('<div class="rcb-stripe-elements-container svelte-1a9rihw"><!></div> <!>',1),Au=x("<!> <!>",1),Ou=x("<!> <form><!></form>",1),Du=x("<div><!></div>");const Mu={hash:"svelte-1a9rihw",code:`.rcb-header-wrapper.svelte-1a9rihw {display:flex;align-items:center;}.rcb-step-title.svelte-1a9rihw {margin-left:10px;}.rcb-stripe-elements-container.svelte-1a9rihw {width:100%;
|
|
94
94
|
|
|
95
95
|
/* The standard height of the payment form from Stripe */
|
|
96
|
-
/* Added to avoid the card getting smaller while loading */min-height:320px;margin-top:32px;margin-bottom:24px;}`};function Nu(e,r){var we;ne(r,!1),H(e,Mu);let t=g(r,"onClose",8),n=g(r,"onContinue",8),a=g(r,"paymentInfoCollectionMetadata",8),o=g(r,"processing",12,!1),s=g(r,"productDetails",8),i=g(r,"purchaseOptionToUse",8),l=g(r,"brandingInfo",8);const u=a().data.client_secret;let c=Se(null),d=Se(),_=Se(),f=Se(void 0),m=Se(!1);Ct(async()=>{const Y=a().data.publishable_api_key,M=a().data.stripe_account_id;if(!Y||!M)throw new Error("Stripe publishable key or account ID not found");A(c,await lu(Y,{stripeAccount:M}))});const y=async()=>{if(o()||!p(c)||!p(_)||!u)return;o(!0);const Y=u.startsWith("seti_");let M;Y?M=(await p(c).confirmSetup({elements:p(_),redirect:"if_required"})).error:M=(await p(c).confirmPayment({elements:p(_),redirect:"if_required"})).error,M?(o(!1),w(M)&&A(f,M.message)):n()()};function w(Y){const M=["card_declined","expired_card","incorrect_cvc","incorrect_number"];return!(Y.type==="card_error"&&Y.code&&M.includes(Y.code))}const P=()=>{A(f,void 0)},E=new Fn((we=l())==null?void 0:we.appearance);let I=E.shape,b=E.formColors;const v=xr(Sr)||Ve.fallback(),T=v.locale||v.fallbackLocale,O=(Y=>{if(["ca","hi","uk"].includes(Y))return"auto";const se={zh_Hans:"zh",zh_Hant:"zh"};return Object.keys(se).includes(Y)?se[Y]:Y})(T);kr(()=>p(d),()=>{p(d)&&p(d)._elements.length>0&&A(_,p(d))}),sn(),ze();var G=Du(),D=q(G);{var oe=Y=>{var M=Ou(),se=j(M);qn(se,{children:(Ke,qr)=>{var ir=Tu(),Xe=j(ir),yr=q(Xe);fu(yr);var ke=N(yr,2),gr=q(ke);ue(gr,{get key(){return C.StateNeedsPaymentInfoPaymentStepTitle}});var L=N(Xe,2);Sn(L,{$$events:{click(...$){var de;(de=t())==null||de.apply(this,$)}}}),h(Ke,ir)},$$slots:{default:!0}});var Pe=N(se,2),sr=q(Pe),hr=re(()=>({borderRadius:I["input-border-radius"],fontSizeBase:"16px",fontSizeSm:"16px",spacingGridRow:"16px",focusBoxShadow:"none",colorDanger:b.error,colorTextPlaceholder:b["grey-text-light"],colorText:b["grey-text-dark"],colorTextSecondary:b["grey-text-light"]})),Wt=re(()=>({".Input":{boxShadow:"none",border:`2px solid ${b["grey-ui-dark"]}`,backgroundColor:"
|
|
96
|
+
/* Added to avoid the card getting smaller while loading */min-height:320px;margin-top:32px;margin-bottom:24px;}`};function Nu(e,r){var we;ne(r,!1),H(e,Mu);let t=g(r,"onClose",8),n=g(r,"onContinue",8),a=g(r,"paymentInfoCollectionMetadata",8),o=g(r,"processing",12,!1),s=g(r,"productDetails",8),i=g(r,"purchaseOptionToUse",8),l=g(r,"brandingInfo",8);const u=a().data.client_secret;let c=Se(null),d=Se(),_=Se(),f=Se(void 0),m=Se(!1);Ct(async()=>{const Y=a().data.publishable_api_key,M=a().data.stripe_account_id;if(!Y||!M)throw new Error("Stripe publishable key or account ID not found");A(c,await lu(Y,{stripeAccount:M}))});const y=async()=>{if(o()||!p(c)||!p(_)||!u)return;o(!0);const Y=u.startsWith("seti_");let M;Y?M=(await p(c).confirmSetup({elements:p(_),redirect:"if_required"})).error:M=(await p(c).confirmPayment({elements:p(_),redirect:"if_required"})).error,M?(o(!1),w(M)&&A(f,M.message)):n()()};function w(Y){const M=["card_declined","expired_card","incorrect_cvc","incorrect_number"];return!(Y.type==="card_error"&&Y.code&&M.includes(Y.code))}const P=()=>{A(f,void 0)},E=new Fn((we=l())==null?void 0:we.appearance);let I=E.shape,b=E.formColors;const v=xr(Sr)||Ve.fallback(),T=v.locale||v.fallbackLocale,O=(Y=>{if(["ca","hi","uk"].includes(Y))return"auto";const se={zh_Hans:"zh",zh_Hant:"zh"};return Object.keys(se).includes(Y)?se[Y]:Y})(T);kr(()=>p(d),()=>{p(d)&&p(d)._elements.length>0&&A(_,p(d))}),sn(),ze();var G=Du(),D=q(G);{var oe=Y=>{var M=Ou(),se=j(M);qn(se,{children:(Ke,qr)=>{var ir=Tu(),Xe=j(ir),yr=q(Xe);fu(yr);var ke=N(yr,2),gr=q(ke);ue(gr,{get key(){return C.StateNeedsPaymentInfoPaymentStepTitle}});var L=N(Xe,2);Sn(L,{$$events:{click(...$){var de;(de=t())==null||de.apply(this,$)}}}),h(Ke,ir)},$$slots:{default:!0}});var Pe=N(se,2),sr=q(Pe),hr=re(()=>({borderRadius:I["input-border-radius"],fontSizeBase:"16px",fontSizeSm:"16px",spacingGridRow:"16px",focusBoxShadow:"none",colorDanger:b.error,colorTextPlaceholder:b["grey-text-light"],colorText:b["grey-text-dark"],colorTextSecondary:b["grey-text-light"]})),Wt=re(()=>({".Input":{boxShadow:"none",border:`2px solid ${b["grey-ui-dark"]}`,backgroundColor:b["input-background"],color:b["grey-text-dark"]},".Input:focus":{border:`2px solid ${b.focus}`,outline:"none"},".Label":{marginBottom:"8px",fontWeight:"500",lineHeight:"22px",color:b["grey-text-dark"]},".Input--invalid":{boxShadow:"none"},".Tab":{boxShadow:"none",backgroundColor:"transparent",color:b["grey-text-light"],border:`2px solid ${b["grey-ui-dark"]}`},".Tab:hover, .Tab:focus, .Tab--selected, .Tab--selected:hover, .Tab--selected:focus":{boxShadow:"none",color:b["grey-text-dark"]},".Tab:focus, .Tab--selected, .Tab--selected:hover, .Tab--selected:focus":{border:`2px solid ${b.focus}`},".TabIcon":{fill:b["grey-text-light"]},".TabIcon--selected":{fill:b["grey-text-dark"]},".Block":{boxShadow:"none",backgroundColor:"transparent",border:`2px solid ${b["grey-ui-dark"]}`}}));eu(sr,{get stripe(){return p(c)},clientSecret:u,loader:"always",locale:O,theme:"stripe",get variables(){return p(hr)},get rules(){return p(Wt)},get elements(){return p(d)},set elements(Ke){A(d,Ke)},children:(Ke,qr)=>{var ir=Au(),Xe=j(ir);Lr(Xe,{children:(ke,gr)=>{var L=Fu(),$=j(L),de=q($),Ie=re(()=>{var Ee;return{business:(Ee=l())!=null&&Ee.app_name?{name:l().app_name}:void 0,layout:{type:"tabs"}}});$l(de,{get options(){return p(Ie)},$$events:{change:Ee=>{A(m,Ee.detail.complete)}}});var $e=N($,2);{var je=Ee=>{var He=re(()=>v.translate(C.StateErrorButtonTryAgain));In(Ee,{title:null,type:"error",get closeButtonTitle(){return p(He)},onContinue:P,brandingInfo:null,children:(vr,Ae)=>{var Gr=_t();Z(()=>ar(Gr,p(f))),h(vr,Gr)},$$slots:{default:!0,icon:(vr,Ae)=>{eo(vr)}}})};U($e,Ee=>{p(f)&&Ee(je)})}Z(()=>$.hidden=!!p(f)),h(ke,L)},$$slots:{default:!0}});var yr=N(Xe,2);xn(yr,{children:(ke,gr)=>{var L=ie(),$=j(L);{var de=Ie=>{mt(Ie,{children:($e,je)=>{var Ee=re(()=>o()||!p(m));En($e,{get disabled(){return p(Ee)},testId:"PayButton",children:(He,vr)=>{var Ae=ie(),Gr=j(Ae);{var Zt=br=>{uo(br)},Hn=br=>{var Qt=ie(),Q=j(Qt);{var Tr=lr=>{ue(lr,{get key(){return C.StateNeedsPaymentInfoButtonStartTrial}})},Yn=lr=>{ue(lr,{get key(){return C.StateNeedsPaymentInfoButtonPay}})};U(Q,lr=>{var jo,Ro;(Ro=(jo=s().subscriptionOptions)==null?void 0:jo[i().id])!=null&&Ro.trial?lr(Tr):lr(Yn,!1)},!0)}h(br,Qt)};U(Gr,br=>{o()?br(Zt):br(Hn,!1)})}h(He,Ae)},$$slots:{default:!0}})},$$slots:{default:!0}})};U($,Ie=>{p(f)||Ie(de)})}h(ke,L)},$$slots:{default:!0}}),h(Ke,ir)},$$slots:{default:!0},$$legacy:!0}),Mt("submit",Pe,La(y)),h(Y,M)},_e=Y=>{kn(Y)};U(D,Y=>{p(c)&&u?Y(oe):Y(_e,!1)})}h(e,G),ae()}function Cu(e){return e.trim()===""?"You need to provide your email address to continue.":e.match(/^[^@]+@[^@]+\.[^@]+$/)?null:"Email is not valid. Please provide a valid email address."}function ju(e){if(e&&!e.match(/^[A-Z]{3}$/)){const r=`Currency code ${e} is not valid. Please provide a valid ISO 4217 currency code.`;throw X.errorLog(r),new fe(ge.ConfigurationError,r)}}var Ru=x("<span><!></span> <!>",1),Uu=x('<div class="form-error svelte-1rq8p9w"> </div>'),Lu=x('<div class="form-container svelte-1rq8p9w"><div class="form-label svelte-1rq8p9w"><label for="email"><!></label></div> <div><input name="email" autocapitalize="off" class="svelte-1rq8p9w"></div> <!></div>'),Bu=x('<div class="container svelte-1rq8p9w"><!> <form class="svelte-1rq8p9w"><!> <!></form></div>');const zu={hash:"svelte-1rq8p9w",code:".container.svelte-1rq8p9w {display:flex;flex-direction:column;flex-grow:1;}form.svelte-1rq8p9w {display:flex;flex-direction:column;min-height:100%;flex-grow:1;}.form-container.svelte-1rq8p9w {display:flex;flex-direction:column;width:100%;margin-top:32px;margin-bottom:16px;}.form-label.svelte-1rq8p9w {margin-top:8px;margin-bottom:8px;display:block;font-weight:500;line-height:22px;}.form-input.error.svelte-1rq8p9w input:where(.svelte-1rq8p9w) {border-color:var(--rc-color-error);}.form-error.svelte-1rq8p9w {margin-top:4px;font-size:16px;line-height:20px;min-height:40px;color:var(--rc-color-error);}input.svelte-1rq8p9w {width:100%;box-sizing:border-box;padding:8px;border:2px solid var(--rc-color-grey-ui-dark);border-radius:var(--rc-shape-input-border-radius);font-size:16px;height:48px;padding:6px 14px;background:var(--rc-color-input-background);color:inherit;}input.svelte-1rq8p9w:focus {outline:none;border:2px solid var(--rc-color-focus);}"};function Vu(e,r){ne(r,!1),H(e,zu);const t=Se(),n=Se(),a=Se();let o=g(r,"onContinue",8),s=g(r,"onClose",8),i=g(r,"processing",8),l=g(r,"lastError",8);const u=async()=>{const w=Cu(p(t));w?A(n,w):o()({email:p(t)})};ei(async()=>{var w;A(n,((w=l())==null?void 0:w.message)??"")});const c=xr(Sr)||Ve.fallback();kr(()=>{},()=>{A(t,"")}),kr(()=>{},()=>{A(n,"")}),kr(()=>p(n),()=>{A(a,p(n)?"error":"")}),sn(),ze();var d=Bu(),_=q(d);qn(_,{children:(w,P)=>{var E=Ru(),I=j(E),b=q(I);ue(b,{get key(){return C.StateNeedsAuthInfoEmailStepTitle}});var v=N(I,2);Sn(v,{$$events:{click(...T){var k;(k=s())==null||k.apply(this,T)}}}),h(w,E)},$$slots:{default:!0}});var f=N(_,2),m=q(f);Lr(m,{children:(w,P)=>{var E=Lu(),I=q(E),b=q(I),v=q(b);ue(v,{get key(){return C.StateNeedsAuthInfoEmailInputLabel}});var T=N(I,2),k=q(T);Z(()=>K(k,"placeholder",c.translate(C.StateNeedsAuthInfoEmailInputPlaceholder)));var O=N(T,2);{var G=D=>{var oe=Uu(),_e=q(oe);Z(()=>ar(_e,p(n))),h(D,oe)};U(O,D=>{p(n)&&D(G)})}Z(()=>gn(T,`form-input ${p(a)??""} svelte-1rq8p9w`)),Js(k,()=>p(t),D=>A(t,D)),h(w,E)},$$slots:{default:!0}});var y=N(m,2);xn(y,{children:(w,P)=>{mt(w,{children:(E,I)=>{En(E,{get disabled(){return i()},type:"submit",children:(b,v)=>{var T=ie(),k=j(T);{var O=D=>{uo(D)},G=D=>{ue(D,{get key(){return C.StateNeedsAuthInfoButtonContinue}})};U(k,D=>{i()?D(O):D(G,!1)})}h(b,T)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}}),Mt("submit",f,La(u)),h(e,d),ae()}var Hu=x('<div class="rcb-modal-backdrop svelte-17tslso"><!></div>');const Yu={hash:"svelte-17tslso",code:".rcb-modal-backdrop.svelte-17tslso {position:fixed;top:0;left:0;right:0;min-width:100%;width:100vw;width:100dvw;min-height:100%;height:100vh;height:100dvh;background-color:rgba(40, 40, 40, 0.75);display:flex;flex-direction:column;justify-content:space-around;z-index:1000001;}"};function Gu(e,r){H(e,Yu);var t=Hu(),n=q(t);pe(n,r,"default",{}),h(e,t)}var Wu=x('<div class="rcb-modal-container svelte-15w05wv"><main class="rcb-modal-main svelte-15w05wv"><!></main></div>');const Zu={hash:"svelte-15w05wv",code:`.rcb-modal-container.svelte-15w05wv {width:100%;}.rcb-modal-main.svelte-15w05wv {box-sizing:border-box;border-radius:var(--rc-shape-modal-border-radius);background-color:var(--rc-color-background);color:var(--rc-color-grey-text-dark);padding:40px;flex-direction:column;display:flex;}
|
|
97
97
|
|
|
98
98
|
@media screen and (max-width: 960px) {.rcb-modal-container.svelte-15w05wv {width:calc(100% - 32px);min-width:300px;max-width:640px;margin:auto;}.rcb-modal-main.svelte-15w05wv {min-width:300px;max-width:640px;padding:32px;}
|
|
99
99
|
}`};function bo(e,r){H(e,Zu);let t=g(r,"style",8,"");var n=Wu(),a=q(n),o=q(a);pe(o,r,"default",{}),Z(()=>K(a,"style",t())),h(e,n)}function Qu(e,r){let t=g(r,"condition",8,!1);var n=ie(),a=j(n);{var o=i=>{Gu(i,{children:(l,u)=>{var c=ie(),d=j(c);pe(d,r,"default",{}),h(l,c)},$$slots:{default:!0}})},s=i=>{var l=ie(),u=j(l);pe(u,r,"default",{}),h(i,l)};U(a,i=>{t()?i(o):i(s,!1)})}h(e,n)}const Ju=`<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
}`};function _c(e,r){ne(r,!1),H(e,cc);let t=g(r,"brandingAppearance",8,void 0),n=new Fn(t()).productInfoStyleVars;ze();var a=uc();K(a,"style",n);var o=q(a);bo(o,{children:(s,i)=>{var l=lc(),u=j(l);pe(u,r,"header",{});var c=N(u,2);pe(c,r,"default",{}),h(s,l)},$$slots:{default:!0}}),h(e,a),ae()}var dc=x("<!> <!>",1),pc=x('<div class="rcb-ui-main svelte-kxew5e"><!></div>');const fc={hash:"svelte-kxew5e",code:`.rcb-ui-main.svelte-kxew5e {flex:480px 1 0;max-width:640px;}
|
|
122
122
|
|
|
123
123
|
@media screen and (max-width: 960px) {.rcb-ui-main.svelte-kxew5e {flex:none;max-width:none;min-width:100%;}
|
|
124
|
-
}`};function mc(e,r){ne(r,!1),H(e,fc);let t=g(r,"brandingAppearance",8,void 0),n=new Fn(t()).formStyleVars;ze();var a=pc();K(a,"style",n);var o=q(a);bo(o,{style:"min-height: 360px;",children:(s,i)=>{var l=dc(),u=j(l);pe(u,r,"header",{});var c=N(u,2);pe(c,r,"default",{}),h(s,l)},$$slots:{default:!0}}),h(e,a),ae()}var hc=x("<!> <!>",1),yc=x("<!> <!> <!> <!> <!> <!> <!>",1),gc=x("<!> <!>",1);function vc(e,r){ne(r,!1);let t=g(r,"asModal",8,!0),n=g(r,"customerEmail",12),a=g(r,"appUserId",8),o=g(r,"rcPackage",8),s=g(r,"purchaseOption",8),i=g(r,"brandingInfo",8),l=g(r,"onFinished",8),u=g(r,"onError",8),c=g(r,"onClose",8),d=g(r,"purchases",8),_=g(r,"purchaseOperationHelper",8),f=g(r,"selectedLocale",8,or),m=g(r,"defaultLocale",8,or),y=g(r,"customTranslations",24,()=>({})),w=Se(""),P=Se(null),E=Se(null),I=Se(null);const b=o().rcBillingProduct.identifier??null,v=o().rcBillingProduct.defaultPurchaseOption,T=s()?s():v;let k=Se("present-offer"),O=null;const G=["present-offer","needs-auth-info","processing-auth-info","needs-payment-info","polling-purchase-status","loading"];pn(Sr,new Ve(y(),f(),m())),Ct(async()=>{var M;if(A(P,o().rcBillingProduct),A(w,vo((M=i())==null?void 0:M.appearance)),p(k)==="present-offer"){n()?oe():A(k,"needs-auth-info");return}});const D=()=>{c()()},oe=()=>{if(b===null){we(new me(ce.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}else p(k)==="present-offer"&&A(k,"loading");if(!n()){we(new me(ce.MissingEmailError));return}_().startPurchase(a(),b,T,n(),o().rcBillingProduct.presentedOfferingContext).then(M=>{if(M.next_action==="collect_payment_info"){A(I,null),A(k,"needs-payment-info"),A(E,M);return}if(M.next_action==="completed"){A(I,null),A(k,"success");return}}).catch(M=>{we(M)})},_e=M=>{if(p(k)==="needs-auth-info"){M&&(n(M.email),A(k,"processing-auth-info")),oe();return}if(p(k)==="needs-payment-info"){A(k,"polling-purchase-status"),_().pollCurrentPurchaseForCompletion().then(se=>{A(k,"success"),O=se.redemptionInfo}).catch(se=>{we(se)});return}if(p(k)==="success"||p(k)==="error"){l()(O);return}A(k,"success")},we=M=>{if(p(k)==="processing-auth-info"&&M.isRecoverable()){A(I,M),A(k,"needs-auth-info");return}A(I,M),A(k,"error")},Y=()=>{u()(p(I)??new me(ce.UnknownError,"Unknown error without state set."))};ze(),ic(e,{children:(M,se)=>{Qu(M,{get condition(){return t()},children:(Pe,sr)=>{ac(Pe,{get style(){return p(w)},children:(hr,Wt)=>{var Ke=gc(),qr=j(Ke);{var ir=ke=>{var gr=re(()=>{var L;return(L=i())==null?void 0:L.appearance});_c(ke,{get brandingAppearance(){return p(gr)},children:(L,$)=>{var de=ie(),Ie=j(de);{var $e=je=>{var Ee=re(()=>{var He;return(He=i())==null?void 0:He.appearance});Ka(je,{get productDetails(){return p(P)},get brandingAppearance(){return p(Ee)},purchaseOption:T})};U(Ie,je=>{p(P)&&T&&je($e)})}h(L,de)},$$slots:{default:!0,header:(L,$)=>{qn(L,{slot:"header",children:(de,Ie)=>{var $e=hc(),je=j($e);no(je,{get brandingInfo(){return i()}});var Ee=N(je,2);{var He=Ae=>{rc(Ae)},vr=Ae=>{Xu(Ae)};U(Ee,Ae=>{d().isSandbox()?Ae(He):Ae(vr,!1)})}h(de,$e)},$$slots:{default:!0}})}}})};U(qr,ke=>{G.includes(p(k))&&ke(ir)})}var Xe=N(qr,2),yr=re(()=>{var ke;return(ke=i())==null?void 0:ke.appearance});mc(Xe,{get brandingAppearance(){return p(yr)},children:(ke,gr)=>{var L=yc(),$=j(L);{var de=Q=>{Ka(Q,{get productDetails(){return p(P)},purchaseOption:T})};U($,Q=>{p(k)==="present-offer"&&p(P)&&T&&Q(de)})}var Ie=N($,2);{var $e=Q=>{kn(Q)};U(Ie,Q=>{p(k)==="present-offer"&&!p(P)&&Q($e)})}var je=N(Ie,2);{var Ee=Q=>{var Tr=re(()=>p(k)==="processing-auth-info");Vu(Q,{onContinue:_e,onClose:D,get processing(){return p(Tr)},get lastError(){return p(I)}})};U(je,Q=>{(p(k)==="needs-auth-info"||p(k)==="processing-auth-info")&&Q(Ee)})}var He=N(je,2);{var vr=Q=>{var Tr=re(()=>p(k)==="polling-purchase-status");Nu(Q,{get paymentInfoCollectionMetadata(){return p(E)},onContinue:_e,onClose:D,get processing(){return p(Tr)},get productDetails(){return p(P)},purchaseOptionToUse:T,get brandingInfo(){return i()}})};U(He,Q=>{p(E)&&(p(k)==="needs-payment-info"||p(k)==="polling-purchase-status")&&p(P)&&T&&Q(vr)})}var Ae=N(He,2);{var Gr=Q=>{kn(Q)};U(Ae,Q=>{p(k)==="loading"&&Q(Gr)})}var Zt=N(Ae,2);{var Hn=Q=>{var Tr=re(()=>p(I)??new me(ce.UnknownError,"Unknown error without state set.")),Yn=re(()=>{var lr;return(lr=i())==null?void 0:lr.support_email});Vl(Q,{get brandingInfo(){return i()},get lastError(){return p(Tr)},get supportEmail(){return p(Yn)},get productDetails(){return p(P)},onContinue:Y})};U(Zt,Q=>{p(k)==="error"&&Q(Hn)})}var br=N(Zt,2);{var Qt=Q=>{Zl(Q,{get productDetails(){return p(P)},get brandingInfo(){return i()},onContinue:_e})};U(br,Q=>{p(k)==="success"&&Q(Qt)})}h(ke,L)},$$slots:{default:!0}}),h(hr,Ke)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}}),ae()}function bc(e){return e.expires_date==null?!0:new Date(e.expires_date)>new Date}function wc(e,r,t,n){const a=r.product_identifier;if(a in t)return Pc(e,r,t[a]);if(a in n)return kc(e,r,n[a]);throw new fe(ge.CustomerInfoError,"Could not find entitlement product in subscriptions or non-subscriptions.")}function Pc(e,r,t){return{identifier:e,isActive:bc(r),willRenew:Sc(r,t),store:(t==null?void 0:t.store)??"unknown",latestPurchaseDate:new Date(r.purchase_date),originalPurchaseDate:new Date(r.purchase_date),expirationDate:Bt(r.expires_date),productIdentifier:r.product_identifier,unsubscribeDetectedAt:Bt(t==null?void 0:t.unsubscribe_detected_at),billingIssueDetectedAt:Bt(t==null?void 0:t.billing_issues_detected_at),isSandbox:(t==null?void 0:t.is_sandbox)??!1,periodType:(t==null?void 0:t.period_type)??"normal"}}function kc(e,r,t){return{identifier:e,isActive:!0,willRenew:!1,store:t.store,latestPurchaseDate:new Date(r.purchase_date),originalPurchaseDate:new Date(t.original_purchase_date),expirationDate:null,productIdentifier:r.product_identifier,unsubscribeDetectedAt:null,billingIssueDetectedAt:null,isSandbox:t.is_sandbox,periodType:"normal"}}function Ec(e,r,t){const n={},a={};for(const o in e){const s=wc(o,e[o],r,t);n[o]=s,s.isActive&&(a[o]=s)}return{all:n,active:a}}function Bt(e){return e==null?null:new Date(e)}function xc(e){const r=qc(e),t=e.subscriber,n=Fc(t.non_subscriptions);return{entitlements:Ec(t.entitlements,t.subscriptions,n),allExpirationDatesByProduct:r,allPurchaseDatesByProduct:Ic(e,n),activeSubscriptions:Tc(r),managementURL:t.management_url,requestDate:new Date(e.request_date),firstSeenDate:new Date(t.first_seen),originalPurchaseDate:Bt(t.original_purchase_date),originalAppUserId:e.subscriber.original_app_user_id}}function Sc(e,r){if(r==null)return!1;const t=r.store=="promotional",n=e.expires_date==null,a=r.unsubscribe_detected_at!=null,o=r.billing_issues_detected_at!=null;return!(t||n||a||o)}function Ic(e,r){const t={};for(const n in e.subscriber.subscriptions){const a=e.subscriber.subscriptions[n];t[n]=new Date(a.purchase_date)}for(const n in r){const a=r[n].purchase_date;a==null?t[n]=null:t[n]=new Date(a)}return t}function qc(e){const r={};for(const t in e.subscriber.subscriptions){const n=e.subscriber.subscriptions[t];n.expires_date==null?r[t]=null:r[t]=new Date(n.expires_date)}return r}function Tc(e){const r=new Set,t=new Date;for(const n in e){const a=e[n];(a==null||a>t)&&r.add(n)}return r}function Fc(e){const r={};for(const t in e){if(e[t].length===0)continue;const n=e[t].length;r[t]=e[t][n-1]}return r}const Ac="0.15.0",Oc="https://api.revenuecat.com";var zt;(function(e){e[e.CONTINUE=100]="CONTINUE",e[e.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",e[e.PROCESSING=102]="PROCESSING",e[e.EARLY_HINTS=103]="EARLY_HINTS",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.RESET_CONTENT=205]="RESET_CONTENT",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.MULTI_STATUS=207]="MULTI_STATUS",e[e.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.MOVED_TEMPORARILY=302]="MOVED_TEMPORARILY",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.NOT_MODIFIED=304]="NOT_MODIFIED",e[e.USE_PROXY=305]="USE_PROXY",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.REQUEST_TOO_LONG=413]="REQUEST_TOO_LONG",e[e.REQUEST_URI_TOO_LONG=414]="REQUEST_URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.IM_A_TEAPOT=418]="IM_A_TEAPOT",e[e.INSUFFICIENT_SPACE_ON_RESOURCE=419]="INSUFFICIENT_SPACE_ON_RESOURCE",e[e.METHOD_FAILURE=420]="METHOD_FAILURE",e[e.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.LOCKED=423]="LOCKED",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",e[e.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",e[e.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",e[e.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(zt||(zt={}));function An(e){return e?e.startsWith("rcb_sb_"):!1}async function Vr(e,r){const{apiKey:t,body:n,headers:a,httpConfig:o}=r,i=`${(o==null?void 0:o.proxyURL)??Oc}${e.urlPath()}`;try{const l=await fetch(i,{method:e.method,headers:Cc(t,a,o==null?void 0:o.additionalHeaders),body:Mc(n)});return await Dc(l,e),await l.json()}catch(l){throw l instanceof TypeError?new fe(ge.NetworkError,pt.getPublicMessage(ge.NetworkError),l.message):l}}async function Dc(e,r){const t=e.status;if(t>=zt.INTERNAL_SERVER_ERROR)On(r,t,await e.text());else if(t>=zt.BAD_REQUEST){const n=await e.json(),a=n?JSON.stringify(n):null,o=n==null?void 0:n.code,s=n==null?void 0:n.message;if(o!=null){const i=pt.convertCodeToBackendErrorCode(o);if(i==null)On(r,t,a,o);else throw fe.getForBackendError(i,s)}else On(r,t,a)}}function On(e,r,t,n){throw new fe(ge.UnknownBackendError,"Unknown backend error.",`Request: ${e.name}. Status code: ${r}. Body: ${t}.`,{backendErrorCode:n})}function Mc(e){return e==null?null:JSON.stringify(e)}const wo="Authorization",Po="Content-Type",ko="Accept",Eo="X-Platform",xo="X-Version",So="X-Is-Sandbox",Nc=new Set([wo,Po,ko,Eo,xo,So]);function Cc(e,r,t){let n={[wo]:`Bearer ${e}`,[Po]:"application/json",[ko]:"application/json",[Eo]:"web",[xo]:Ac,[So]:`${An(e)}`};return r&&(n={...n,...r}),t&&(n={...t,...n}),n}const Io="/v1/subscribers",Vt="/rcbilling/v1";class jc{constructor(r){V(this,"appUserId");V(this,"method","GET");V(this,"name","getOfferings");this.appUserId=r}urlPath(){const r=encodeURIComponent(this.appUserId);return`${Io}/${r}/offerings`}}class Rc{constructor(){V(this,"method","POST");V(this,"name","purchase")}urlPath(){return`${Vt}/purchase`}}class Uc{constructor(r,t,n){V(this,"method","GET");V(this,"name","getProducts");V(this,"appUserId");V(this,"productIds");V(this,"currency");this.appUserId=r,this.productIds=t,this.currency=n}urlPath(){const r=encodeURIComponent(this.appUserId),t=this.productIds.map(encodeURIComponent).join("&id="),n=this.currency?`¤cy=${this.currency}`:"";return`${Vt}/subscribers/${r}/products?id=${t}${n}`}}class Lc{constructor(r){V(this,"method","GET");V(this,"name","getCustomerInfo");V(this,"appUserId");this.appUserId=r}urlPath(){const r=encodeURIComponent(this.appUserId);return`${Io}/${r}`}}class Bc{constructor(){V(this,"method","GET");V(this,"name","getBrandingInfo")}urlPath(){return`${Vt}/branding`}}class zc{constructor(r){V(this,"method","GET");V(this,"name","getCheckoutStatus");V(this,"operationSessionId");this.operationSessionId=r}urlPath(){return`${Vt}/checkout/${this.operationSessionId}`}}const Dn={};class Vc{constructor(r,t=Dn){V(this,"API_KEY");V(this,"httpConfig");this.API_KEY=r,this.httpConfig=t}async getOfferings(r){return await Vr(new jc(r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getCustomerInfo(r){return await Vr(new Lc(r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getProducts(r,t,n){return await Vr(new Uc(r,t,n),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getBrandingInfo(){return await Vr(new Bc,{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async postPurchase(r,t,n,a,o){const s={app_user_id:r,product_id:t,email:n,price_id:o.priceId,presented_offering_identifier:a.offeringIdentifier,supports_direct_payment:!0};return o.id!=="base_option"&&(s.offer_id=o.id),a.targetingContext&&(s.applied_targeting_rule={rule_id:a.targetingContext.ruleId,revision:a.targetingContext.revision}),a.placementIdentifier&&(s.presented_placement_identifier=a.placementIdentifier),await Vr(new Rc,{apiKey:this.API_KEY,body:s,httpConfig:this.httpConfig})}async getCheckoutStatus(r){return await Vr(new zc(r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}}function Hc(e){if(!/^rcb_[a-zA-Z0-9_.-]+$/.test(e))throw new fe(ge.InvalidCredentialsError,"Invalid API key. Use your RevenueCat Billing API key.")}function Yc(e){if(new Set(["no_user","null","none","nil","(null)","NaN","\\x00","","unidentified","undefined","unknown"]).has(e)||e.includes("/"))throw new fe(ge.InvalidAppUserIdError,'Provided user id: "'+e+'" is not valid. See https://www.revenuecat.com/docs/customers/user-ids#tips-for-setting-app-user-ids for more information.')}function Gc(e){if(e!=null&&e.endsWith("/"))throw new fe(ge.ConfigurationError,"Invalid proxy URL. The proxy URL should not end with a trailing slash.")}function Wc(e){if(e){for(const r in e)if(Nc.has(r))throw new fe(ge.ConfigurationError,"Invalid additional headers. Some headers are reserved for internal use.")}}var Mn=(e=>(e.Current="current",e))(Mn||{});function Zc(e,r){async function t(...n){return await this.preload(),await e.call(this,...n)}return t}const qo=(e,r)=>({...e,rcBillingProduct:{...e.rcBillingProduct,presentedOfferingContext:{...e.rcBillingProduct.presentedOfferingContext,placementIdentifier:r}}}),Ir=(e,r)=>e==null?null:qo(e,r),Qc=(e,r,t)=>{const n=e.offering_ids_by_placement??null;if(n==null)return null;const a=e.fallback_offering_id??null;let o;if(t in n){const i=n[t]??null;if(i==null)return null;o=r[i],o==null&&(o=r[a])}else o=r[a];if(o==null)return null;const s=Object.fromEntries(Object.entries(o.packagesById).map(([i,l])=>[i,qo(l,t)]));return{...o,packagesById:s,availablePackages:Object.values(s),weekly:Ir(o.weekly,t),monthly:Ir(o.monthly,t),twoMonth:Ir(o.twoMonth,t),threeMonth:Ir(o.threeMonth,t),sixMonth:Ir(o.sixMonth,t),annual:Ir(o.annual,t),lifetime:Ir(o.lifetime,t)}};function Jc(e,r){const t={};r.product_details.forEach(o=>{t[o.identifier]=o});const n={};e.offerings.forEach(o=>{const s=o.identifier===e.current_offering_id,i=Ji(s,o,t,e.targeting);i!=null&&(n[o.identifier]=i)});const a=e.current_offering_id?n[e.current_offering_id]??null:null;return Object.keys(n).length==0&&X.debugLog("Empty offerings. Please make sure you've configured offerings correctly in the RevenueCat dashboard and that the products are properly configured."),{all:n,current:a}}var Nn;(function(e){e.body_s="p",e.body_m="p",e.body_l="p",e.body_xl="p",e.heading_xs="h6",e.heading_s="h5",e.heading_m="h4",e.heading_l="h3",e.heading_xl="h2",e.heading_xxl="h1"})(Nn||(Nn={}));var Ht;(function(e){e[e.extra_light=100]="extra_light",e[e.thin=200]="thin",e[e.light=300]="light",e[e.regular=400]="regular",e[e.medium=500]="medium",e[e.semibold=600]="semibold",e[e.bold=700]="bold",e[e.extra_bold=800]="extra_bold",e[e.black=900]="black"})(Ht||(Ht={}));var Yt;(function(e){e.body_s="13px",e.body_m="14px",e.body_l="15px",e.body_xl="16px",e.heading_xs="14px",e.heading_s="16px",e.heading_m="18px",e.heading_l="20px",e.heading_xl="26px",e.heading_xxl="32px"})(Yt||(Yt={}));var Cn;(function(e){e.vertical="column",e.horizontal="row"})(Cn||(Cn={}));var jn;(function(e){e.top="flex-start",e.leading="flex-start",e.center="center",e.bottom="flex-end",e.trailing="flex-end"})(jn||(jn={}));var Rn;(function(e){e.space_between="space-between",e.space_around="space-around",e.space_evenly="space-evenly",e.start="flex-start",e.center="center",e.end="flex-end"})(Rn||(Rn={}));const Hr=[];function Kc(e,r){return{subscribe:Xc(e,r).subscribe}}function Xc(e,r=Ye){let t=null;const n=new Set;function a(i){if(ea(e,i)&&(e=i,t)){const l=!Hr.length;for(const u of n)u[1](),Hr.push(u,e);if(l){for(let u=0;u<Hr.length;u+=2)Hr[u][0](Hr[u+1]);Hr.length=0}}}function o(i){a(i(e))}function s(i,l=Ye){const u=[i,l];return n.add(u),n.size===1&&(t=r(a,o)||Ye),i(e),()=>{n.delete(u),n.size===0&&t&&(t(),t=null)}}return{set:a,update:o,subscribe:s}}const To=Kc(!1,e=>{if(typeof window<"u"){const r=window.matchMedia("(prefers-color-scheme: dark)");e(r.matches);const t=n=>e(n.matches);return r.addEventListener("change",t),()=>r.removeEventListener("change",t)}return()=>{}}),$c=(e,r)=>{var t;(t=r.onclick)==null||t.call(r)};var e_=x("<button><!></button>");const r_={hash:"svelte-g3k3fu",code:"button.svelte-g3k3fu {border:none;cursor:pointer;background:transparent;padding:0;width:100%;display:flex;align-items:center;justify-content:center;}"};function Fo(e,r){ne(r,!0),H(e,r_);var t=e_();t.__click=[$c,r];var n=q(t);yn(n,()=>r.children??Ye),Z(()=>{gn(t,`${r.class??""} svelte-g3k3fu`),t.disabled=!r.onclick,K(t,"style",r.style)}),h(e,t),ae()}hn(["click"]);function Ao(e,r){return!e||!r?"":{[`--${r}-block-start`]:`${e.top??0}px`,[`--${r}-inline-end`]:`${e.trailing??0}px`,[`--${r}-block-end`]:`${e.bottom??0}px`,[`--${r}-inline-start`]:`${e.leading??0}px`}}function t_(e){return Nn[e]}function Yr({colorMap:e,colorMode:r="light",fallback:t="FFFFFF"}){if(!e)return t;const n=e[r]||e.light;let a="";switch(n.type){case"hex":case"alias":return n.value??t;case"linear":return a=(n.points||[]).map(o=>`${o.color} ${o.percent}%`).join(", "),`linear-gradient(${n.degrees}deg, ${a})`;case"radial":return a=(n.points||[]).map(o=>`${o.color} ${o.percent}%`).join(", "),`radial-gradient(${a})`}return t}function n_(e,r="light"){const t=Yr({colorMap:e.color,colorMode:r});return`${e.width}px solid ${t}`}function Oo(e){return`${e.top_leading}px ${e.top_trailing}px ${e.bottom_trailing}px ${e.bottom_leading}px`}function Un({backgroundColor:e,border:r,margin:t,padding:n,textColor:a,colorMode:o="light",shape:s,shadow:i}){const l={"--margin-block-start":"0px","--margin-inline-end":"0px","--margin-block-end":"0px","--margin-inline-start":"0px","--padding-block-start":"0px","--padding-inline-end":"0px","--padding-block-end":"0px","--padding-inline-start":"0px","--background":"transparent","--text-color":"#000000","--border":"none","--border-radius":"0px","--shadow":"none"};return n&&Object.assign(l,Ao(n,"padding")),t&&Object.assign(l,Ao(t,"margin")),e&&(l["--background"]=Yr({colorMap:e,colorMode:o,fallback:"transparent"})),a&&(l["--text-color"]=Yr({colorMap:a,colorMode:o,fallback:"#000000"})),r&&(l["--border"]=n_(r,o)),(s==null?void 0:s.type)==="rectangle"&&s.corners&&(l["--border-radius"]=Oo(s.corners)),(s==null?void 0:s.type)==="pill"&&(l["--border-radius"]="9999px"),i&&(l["--shadow"]=`${i.x}px ${i.y}px ${i.radius}px
|
|
124
|
+
}`};function mc(e,r){ne(r,!1),H(e,fc);let t=g(r,"brandingAppearance",8,void 0),n=new Fn(t()).formStyleVars;ze();var a=pc();K(a,"style",n);var o=q(a);bo(o,{style:"min-height: 360px;",children:(s,i)=>{var l=dc(),u=j(l);pe(u,r,"header",{});var c=N(u,2);pe(c,r,"default",{}),h(s,l)},$$slots:{default:!0}}),h(e,a),ae()}var hc=x("<!> <!>",1),yc=x("<!> <!> <!> <!> <!> <!> <!>",1),gc=x("<!> <!>",1);function vc(e,r){ne(r,!1);let t=g(r,"asModal",8,!0),n=g(r,"customerEmail",12),a=g(r,"appUserId",8),o=g(r,"rcPackage",8),s=g(r,"purchaseOption",8),i=g(r,"brandingInfo",8),l=g(r,"onFinished",8),u=g(r,"onError",8),c=g(r,"onClose",8),d=g(r,"purchases",8),_=g(r,"purchaseOperationHelper",8),f=g(r,"selectedLocale",8,or),m=g(r,"defaultLocale",8,or),y=g(r,"customTranslations",24,()=>({})),w=Se(""),P=Se(null),E=Se(null),I=Se(null);const b=o().rcBillingProduct.identifier??null,v=o().rcBillingProduct.defaultPurchaseOption,T=s()?s():v;let k=Se("present-offer"),O=null;const G=["present-offer","needs-auth-info","processing-auth-info","needs-payment-info","polling-purchase-status","loading"];pn(Sr,new Ve(y(),f(),m())),Ct(async()=>{var M;if(A(P,o().rcBillingProduct),A(w,vo((M=i())==null?void 0:M.appearance)),p(k)==="present-offer"){n()?oe():A(k,"needs-auth-info");return}});const D=()=>{c()()},oe=()=>{if(b===null){we(new me(ce.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}else p(k)==="present-offer"&&A(k,"loading");if(!n()){we(new me(ce.MissingEmailError));return}_().startPurchase(a(),b,T,n(),o().rcBillingProduct.presentedOfferingContext).then(M=>{if(M.next_action==="collect_payment_info"){A(I,null),A(k,"needs-payment-info"),A(E,M);return}if(M.next_action==="completed"){A(I,null),A(k,"success");return}}).catch(M=>{we(M)})},_e=M=>{if(p(k)==="needs-auth-info"){M&&(n(M.email),A(k,"processing-auth-info")),oe();return}if(p(k)==="needs-payment-info"){A(k,"polling-purchase-status"),_().pollCurrentPurchaseForCompletion().then(se=>{A(k,"success"),O=se.redemptionInfo}).catch(se=>{we(se)});return}if(p(k)==="success"||p(k)==="error"){l()(O);return}A(k,"success")},we=M=>{if(p(k)==="processing-auth-info"&&M.isRecoverable()){A(I,M),A(k,"needs-auth-info");return}A(I,M),A(k,"error")},Y=()=>{u()(p(I)??new me(ce.UnknownError,"Unknown error without state set."))};ze(),ic(e,{children:(M,se)=>{Qu(M,{get condition(){return t()},children:(Pe,sr)=>{ac(Pe,{get style(){return p(w)},children:(hr,Wt)=>{var Ke=gc(),qr=j(Ke);{var ir=ke=>{var gr=re(()=>{var L;return(L=i())==null?void 0:L.appearance});_c(ke,{get brandingAppearance(){return p(gr)},children:(L,$)=>{var de=ie(),Ie=j(de);{var $e=je=>{var Ee=re(()=>{var He;return(He=i())==null?void 0:He.appearance});Ka(je,{get productDetails(){return p(P)},get brandingAppearance(){return p(Ee)},purchaseOption:T})};U(Ie,je=>{p(P)&&T&&je($e)})}h(L,de)},$$slots:{default:!0,header:(L,$)=>{qn(L,{slot:"header",children:(de,Ie)=>{var $e=hc(),je=j($e);no(je,{get brandingInfo(){return i()}});var Ee=N(je,2);{var He=Ae=>{rc(Ae)},vr=Ae=>{Xu(Ae)};U(Ee,Ae=>{d().isSandbox()?Ae(He):Ae(vr,!1)})}h(de,$e)},$$slots:{default:!0}})}}})};U(qr,ke=>{G.includes(p(k))&&ke(ir)})}var Xe=N(qr,2),yr=re(()=>{var ke;return(ke=i())==null?void 0:ke.appearance});mc(Xe,{get brandingAppearance(){return p(yr)},children:(ke,gr)=>{var L=yc(),$=j(L);{var de=Q=>{Ka(Q,{get productDetails(){return p(P)},purchaseOption:T})};U($,Q=>{p(k)==="present-offer"&&p(P)&&T&&Q(de)})}var Ie=N($,2);{var $e=Q=>{kn(Q)};U(Ie,Q=>{p(k)==="present-offer"&&!p(P)&&Q($e)})}var je=N(Ie,2);{var Ee=Q=>{var Tr=re(()=>p(k)==="processing-auth-info");Vu(Q,{onContinue:_e,onClose:D,get processing(){return p(Tr)},get lastError(){return p(I)}})};U(je,Q=>{(p(k)==="needs-auth-info"||p(k)==="processing-auth-info")&&Q(Ee)})}var He=N(je,2);{var vr=Q=>{var Tr=re(()=>p(k)==="polling-purchase-status");Nu(Q,{get paymentInfoCollectionMetadata(){return p(E)},onContinue:_e,onClose:D,get processing(){return p(Tr)},get productDetails(){return p(P)},purchaseOptionToUse:T,get brandingInfo(){return i()}})};U(He,Q=>{p(E)&&(p(k)==="needs-payment-info"||p(k)==="polling-purchase-status")&&p(P)&&T&&Q(vr)})}var Ae=N(He,2);{var Gr=Q=>{kn(Q)};U(Ae,Q=>{p(k)==="loading"&&Q(Gr)})}var Zt=N(Ae,2);{var Hn=Q=>{var Tr=re(()=>p(I)??new me(ce.UnknownError,"Unknown error without state set.")),Yn=re(()=>{var lr;return(lr=i())==null?void 0:lr.support_email});Vl(Q,{get brandingInfo(){return i()},get lastError(){return p(Tr)},get supportEmail(){return p(Yn)},get productDetails(){return p(P)},onContinue:Y})};U(Zt,Q=>{p(k)==="error"&&Q(Hn)})}var br=N(Zt,2);{var Qt=Q=>{Zl(Q,{get productDetails(){return p(P)},get brandingInfo(){return i()},onContinue:_e})};U(br,Q=>{p(k)==="success"&&Q(Qt)})}h(ke,L)},$$slots:{default:!0}}),h(hr,Ke)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}}),ae()}function bc(e){return e.expires_date==null?!0:new Date(e.expires_date)>new Date}function wc(e,r,t,n){const a=r.product_identifier;if(a in t)return Pc(e,r,t[a]);if(a in n)return kc(e,r,n[a]);throw new fe(ge.CustomerInfoError,"Could not find entitlement product in subscriptions or non-subscriptions.")}function Pc(e,r,t){return{identifier:e,isActive:bc(r),willRenew:Sc(r,t),store:(t==null?void 0:t.store)??"unknown",latestPurchaseDate:new Date(r.purchase_date),originalPurchaseDate:new Date(r.purchase_date),expirationDate:Bt(r.expires_date),productIdentifier:r.product_identifier,unsubscribeDetectedAt:Bt(t==null?void 0:t.unsubscribe_detected_at),billingIssueDetectedAt:Bt(t==null?void 0:t.billing_issues_detected_at),isSandbox:(t==null?void 0:t.is_sandbox)??!1,periodType:(t==null?void 0:t.period_type)??"normal"}}function kc(e,r,t){return{identifier:e,isActive:!0,willRenew:!1,store:t.store,latestPurchaseDate:new Date(r.purchase_date),originalPurchaseDate:new Date(t.original_purchase_date),expirationDate:null,productIdentifier:r.product_identifier,unsubscribeDetectedAt:null,billingIssueDetectedAt:null,isSandbox:t.is_sandbox,periodType:"normal"}}function Ec(e,r,t){const n={},a={};for(const o in e){const s=wc(o,e[o],r,t);n[o]=s,s.isActive&&(a[o]=s)}return{all:n,active:a}}function Bt(e){return e==null?null:new Date(e)}function xc(e){const r=qc(e),t=e.subscriber,n=Fc(t.non_subscriptions);return{entitlements:Ec(t.entitlements,t.subscriptions,n),allExpirationDatesByProduct:r,allPurchaseDatesByProduct:Ic(e,n),activeSubscriptions:Tc(r),managementURL:t.management_url,requestDate:new Date(e.request_date),firstSeenDate:new Date(t.first_seen),originalPurchaseDate:Bt(t.original_purchase_date),originalAppUserId:e.subscriber.original_app_user_id}}function Sc(e,r){if(r==null)return!1;const t=r.store=="promotional",n=e.expires_date==null,a=r.unsubscribe_detected_at!=null,o=r.billing_issues_detected_at!=null;return!(t||n||a||o)}function Ic(e,r){const t={};for(const n in e.subscriber.subscriptions){const a=e.subscriber.subscriptions[n];t[n]=new Date(a.purchase_date)}for(const n in r){const a=r[n].purchase_date;a==null?t[n]=null:t[n]=new Date(a)}return t}function qc(e){const r={};for(const t in e.subscriber.subscriptions){const n=e.subscriber.subscriptions[t];n.expires_date==null?r[t]=null:r[t]=new Date(n.expires_date)}return r}function Tc(e){const r=new Set,t=new Date;for(const n in e){const a=e[n];(a==null||a>t)&&r.add(n)}return r}function Fc(e){const r={};for(const t in e){if(e[t].length===0)continue;const n=e[t].length;r[t]=e[t][n-1]}return r}const Ac="0.15.1",Oc="https://api.revenuecat.com";var zt;(function(e){e[e.CONTINUE=100]="CONTINUE",e[e.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",e[e.PROCESSING=102]="PROCESSING",e[e.EARLY_HINTS=103]="EARLY_HINTS",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.RESET_CONTENT=205]="RESET_CONTENT",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.MULTI_STATUS=207]="MULTI_STATUS",e[e.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.MOVED_TEMPORARILY=302]="MOVED_TEMPORARILY",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.NOT_MODIFIED=304]="NOT_MODIFIED",e[e.USE_PROXY=305]="USE_PROXY",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.REQUEST_TOO_LONG=413]="REQUEST_TOO_LONG",e[e.REQUEST_URI_TOO_LONG=414]="REQUEST_URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.IM_A_TEAPOT=418]="IM_A_TEAPOT",e[e.INSUFFICIENT_SPACE_ON_RESOURCE=419]="INSUFFICIENT_SPACE_ON_RESOURCE",e[e.METHOD_FAILURE=420]="METHOD_FAILURE",e[e.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.LOCKED=423]="LOCKED",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",e[e.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",e[e.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",e[e.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(zt||(zt={}));function An(e){return e?e.startsWith("rcb_sb_"):!1}async function Vr(e,r){const{apiKey:t,body:n,headers:a,httpConfig:o}=r,i=`${(o==null?void 0:o.proxyURL)??Oc}${e.urlPath()}`;try{const l=await fetch(i,{method:e.method,headers:Cc(t,a,o==null?void 0:o.additionalHeaders),body:Mc(n)});return await Dc(l,e),await l.json()}catch(l){throw l instanceof TypeError?new fe(ge.NetworkError,pt.getPublicMessage(ge.NetworkError),l.message):l}}async function Dc(e,r){const t=e.status;if(t>=zt.INTERNAL_SERVER_ERROR)On(r,t,await e.text());else if(t>=zt.BAD_REQUEST){const n=await e.json(),a=n?JSON.stringify(n):null,o=n==null?void 0:n.code,s=n==null?void 0:n.message;if(o!=null){const i=pt.convertCodeToBackendErrorCode(o);if(i==null)On(r,t,a,o);else throw fe.getForBackendError(i,s)}else On(r,t,a)}}function On(e,r,t,n){throw new fe(ge.UnknownBackendError,"Unknown backend error.",`Request: ${e.name}. Status code: ${r}. Body: ${t}.`,{backendErrorCode:n})}function Mc(e){return e==null?null:JSON.stringify(e)}const wo="Authorization",Po="Content-Type",ko="Accept",Eo="X-Platform",xo="X-Version",So="X-Is-Sandbox",Nc=new Set([wo,Po,ko,Eo,xo,So]);function Cc(e,r,t){let n={[wo]:`Bearer ${e}`,[Po]:"application/json",[ko]:"application/json",[Eo]:"web",[xo]:Ac,[So]:`${An(e)}`};return r&&(n={...n,...r}),t&&(n={...t,...n}),n}const Io="/v1/subscribers",Vt="/rcbilling/v1";class jc{constructor(r){V(this,"appUserId");V(this,"method","GET");V(this,"name","getOfferings");this.appUserId=r}urlPath(){const r=encodeURIComponent(this.appUserId);return`${Io}/${r}/offerings`}}class Rc{constructor(){V(this,"method","POST");V(this,"name","purchase")}urlPath(){return`${Vt}/purchase`}}class Uc{constructor(r,t,n){V(this,"method","GET");V(this,"name","getProducts");V(this,"appUserId");V(this,"productIds");V(this,"currency");this.appUserId=r,this.productIds=t,this.currency=n}urlPath(){const r=encodeURIComponent(this.appUserId),t=this.productIds.map(encodeURIComponent).join("&id="),n=this.currency?`¤cy=${this.currency}`:"";return`${Vt}/subscribers/${r}/products?id=${t}${n}`}}class Lc{constructor(r){V(this,"method","GET");V(this,"name","getCustomerInfo");V(this,"appUserId");this.appUserId=r}urlPath(){const r=encodeURIComponent(this.appUserId);return`${Io}/${r}`}}class Bc{constructor(){V(this,"method","GET");V(this,"name","getBrandingInfo")}urlPath(){return`${Vt}/branding`}}class zc{constructor(r){V(this,"method","GET");V(this,"name","getCheckoutStatus");V(this,"operationSessionId");this.operationSessionId=r}urlPath(){return`${Vt}/checkout/${this.operationSessionId}`}}const Dn={};class Vc{constructor(r,t=Dn){V(this,"API_KEY");V(this,"httpConfig");this.API_KEY=r,this.httpConfig=t}async getOfferings(r){return await Vr(new jc(r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getCustomerInfo(r){return await Vr(new Lc(r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getProducts(r,t,n){return await Vr(new Uc(r,t,n),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getBrandingInfo(){return await Vr(new Bc,{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async postPurchase(r,t,n,a,o){const s={app_user_id:r,product_id:t,email:n,price_id:o.priceId,presented_offering_identifier:a.offeringIdentifier,supports_direct_payment:!0};return o.id!=="base_option"&&(s.offer_id=o.id),a.targetingContext&&(s.applied_targeting_rule={rule_id:a.targetingContext.ruleId,revision:a.targetingContext.revision}),a.placementIdentifier&&(s.presented_placement_identifier=a.placementIdentifier),await Vr(new Rc,{apiKey:this.API_KEY,body:s,httpConfig:this.httpConfig})}async getCheckoutStatus(r){return await Vr(new zc(r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}}function Hc(e){if(!/^rcb_[a-zA-Z0-9_.-]+$/.test(e))throw new fe(ge.InvalidCredentialsError,"Invalid API key. Use your RevenueCat Billing API key.")}function Yc(e){if(new Set(["no_user","null","none","nil","(null)","NaN","\\x00","","unidentified","undefined","unknown"]).has(e)||e.includes("/"))throw new fe(ge.InvalidAppUserIdError,'Provided user id: "'+e+'" is not valid. See https://www.revenuecat.com/docs/customers/user-ids#tips-for-setting-app-user-ids for more information.')}function Gc(e){if(e!=null&&e.endsWith("/"))throw new fe(ge.ConfigurationError,"Invalid proxy URL. The proxy URL should not end with a trailing slash.")}function Wc(e){if(e){for(const r in e)if(Nc.has(r))throw new fe(ge.ConfigurationError,"Invalid additional headers. Some headers are reserved for internal use.")}}var Mn=(e=>(e.Current="current",e))(Mn||{});function Zc(e,r){async function t(...n){return await this.preload(),await e.call(this,...n)}return t}const qo=(e,r)=>({...e,rcBillingProduct:{...e.rcBillingProduct,presentedOfferingContext:{...e.rcBillingProduct.presentedOfferingContext,placementIdentifier:r}}}),Ir=(e,r)=>e==null?null:qo(e,r),Qc=(e,r,t)=>{const n=e.offering_ids_by_placement??null;if(n==null)return null;const a=e.fallback_offering_id??null;let o;if(t in n){const i=n[t]??null;if(i==null)return null;o=r[i],o==null&&(o=r[a])}else o=r[a];if(o==null)return null;const s=Object.fromEntries(Object.entries(o.packagesById).map(([i,l])=>[i,qo(l,t)]));return{...o,packagesById:s,availablePackages:Object.values(s),weekly:Ir(o.weekly,t),monthly:Ir(o.monthly,t),twoMonth:Ir(o.twoMonth,t),threeMonth:Ir(o.threeMonth,t),sixMonth:Ir(o.sixMonth,t),annual:Ir(o.annual,t),lifetime:Ir(o.lifetime,t)}};function Jc(e,r){const t={};r.product_details.forEach(o=>{t[o.identifier]=o});const n={};e.offerings.forEach(o=>{const s=o.identifier===e.current_offering_id,i=Ji(s,o,t,e.targeting);i!=null&&(n[o.identifier]=i)});const a=e.current_offering_id?n[e.current_offering_id]??null:null;return Object.keys(n).length==0&&X.debugLog("Empty offerings. Please make sure you've configured offerings correctly in the RevenueCat dashboard and that the products are properly configured."),{all:n,current:a}}var Nn;(function(e){e.body_s="p",e.body_m="p",e.body_l="p",e.body_xl="p",e.heading_xs="h6",e.heading_s="h5",e.heading_m="h4",e.heading_l="h3",e.heading_xl="h2",e.heading_xxl="h1"})(Nn||(Nn={}));var Ht;(function(e){e[e.extra_light=100]="extra_light",e[e.thin=200]="thin",e[e.light=300]="light",e[e.regular=400]="regular",e[e.medium=500]="medium",e[e.semibold=600]="semibold",e[e.bold=700]="bold",e[e.extra_bold=800]="extra_bold",e[e.black=900]="black"})(Ht||(Ht={}));var Yt;(function(e){e.body_s="13px",e.body_m="14px",e.body_l="15px",e.body_xl="16px",e.heading_xs="14px",e.heading_s="16px",e.heading_m="18px",e.heading_l="20px",e.heading_xl="26px",e.heading_xxl="32px"})(Yt||(Yt={}));var Cn;(function(e){e.vertical="column",e.horizontal="row"})(Cn||(Cn={}));var jn;(function(e){e.top="flex-start",e.leading="flex-start",e.center="center",e.bottom="flex-end",e.trailing="flex-end"})(jn||(jn={}));var Rn;(function(e){e.space_between="space-between",e.space_around="space-around",e.space_evenly="space-evenly",e.start="flex-start",e.center="center",e.end="flex-end"})(Rn||(Rn={}));const Hr=[];function Kc(e,r){return{subscribe:Xc(e,r).subscribe}}function Xc(e,r=Ye){let t=null;const n=new Set;function a(i){if(ea(e,i)&&(e=i,t)){const l=!Hr.length;for(const u of n)u[1](),Hr.push(u,e);if(l){for(let u=0;u<Hr.length;u+=2)Hr[u][0](Hr[u+1]);Hr.length=0}}}function o(i){a(i(e))}function s(i,l=Ye){const u=[i,l];return n.add(u),n.size===1&&(t=r(a,o)||Ye),i(e),()=>{n.delete(u),n.size===0&&t&&(t(),t=null)}}return{set:a,update:o,subscribe:s}}const To=Kc(!1,e=>{if(typeof window<"u"){const r=window.matchMedia("(prefers-color-scheme: dark)");e(r.matches);const t=n=>e(n.matches);return r.addEventListener("change",t),()=>r.removeEventListener("change",t)}return()=>{}}),$c=(e,r)=>{var t;(t=r.onclick)==null||t.call(r)};var e_=x("<button><!></button>");const r_={hash:"svelte-g3k3fu",code:"button.svelte-g3k3fu {border:none;cursor:pointer;background:transparent;padding:0;width:100%;display:flex;align-items:center;justify-content:center;}"};function Fo(e,r){ne(r,!0),H(e,r_);var t=e_();t.__click=[$c,r];var n=q(t);yn(n,()=>r.children??Ye),Z(()=>{gn(t,`${r.class??""} svelte-g3k3fu`),t.disabled=!r.onclick,K(t,"style",r.style)}),h(e,t),ae()}hn(["click"]);function Ao(e,r){return!e||!r?"":{[`--${r}-block-start`]:`${e.top??0}px`,[`--${r}-inline-end`]:`${e.trailing??0}px`,[`--${r}-block-end`]:`${e.bottom??0}px`,[`--${r}-inline-start`]:`${e.leading??0}px`}}function t_(e){return Nn[e]}function Yr({colorMap:e,colorMode:r="light",fallback:t="FFFFFF"}){if(!e)return t;const n=e[r]||e.light;let a="";switch(n.type){case"hex":case"alias":return n.value??t;case"linear":return a=(n.points||[]).map(o=>`${o.color} ${o.percent}%`).join(", "),`linear-gradient(${n.degrees}deg, ${a})`;case"radial":return a=(n.points||[]).map(o=>`${o.color} ${o.percent}%`).join(", "),`radial-gradient(${a})`}return t}function n_(e,r="light"){const t=Yr({colorMap:e.color,colorMode:r});return`${e.width}px solid ${t}`}function Oo(e){return`${e.top_leading}px ${e.top_trailing}px ${e.bottom_trailing}px ${e.bottom_leading}px`}function Un({backgroundColor:e,border:r,margin:t,padding:n,textColor:a,colorMode:o="light",shape:s,shadow:i}){const l={"--margin-block-start":"0px","--margin-inline-end":"0px","--margin-block-end":"0px","--margin-inline-start":"0px","--padding-block-start":"0px","--padding-inline-end":"0px","--padding-block-end":"0px","--padding-inline-start":"0px","--background":"transparent","--text-color":"#000000","--border":"none","--border-radius":"0px","--shadow":"none"};return n&&Object.assign(l,Ao(n,"padding")),t&&Object.assign(l,Ao(t,"margin")),e&&(l["--background"]=Yr({colorMap:e,colorMode:o,fallback:"transparent"})),a&&(l["--text-color"]=Yr({colorMap:a,colorMode:o,fallback:"#000000"})),r&&(l["--border"]=n_(r,o)),(s==null?void 0:s.type)==="rectangle"&&s.corners&&(l["--border-radius"]=Oo(s.corners)),(s==null?void 0:s.type)==="pill"&&(l["--border-radius"]="9999px"),i&&(l["--shadow"]=`${i.x}px ${i.y}px ${i.radius}px
|
|
125
125
|
${Yr({colorMap:i.color,colorMode:o,fallback:"#000000"})}`),l}function Gt(e){function r(o){return o.type==="fixed"?`${o.value}px`:o.type==="fit"?"fit-content":o.type==="fill"?navigator.userAgent.match(/firefox|fxios/i)?"-moz-available":"-webkit-fill-available":"unset"}const t=r(e.width),n=r(e.height),a=e.width.type==="fill"||e.height.type==="fill";return{"--width":t,"--height":n,"--flex":a?"unset":"0 1 auto"}}function a_(e,r){return r?{"--background":`linear-gradient(${r.map(t=>{var n;return((n=t[e])==null?void 0:n.value)||t.light.value}).join(", ")})`}:{"--background":"none"}}const o_=e=>{const r={"--corner-radius":"0px","--clip-path":"none"};return(e==null?void 0:e.type)==="circle"&&(r["--corner-radius"]="50%"),(e==null?void 0:e.type)==="rectangle"&&e.corners&&(r["--corner-radius"]=Oo(e.corners)),(e==null?void 0:e.type)==="convex"&&(r["--corner-radius"]="0 0 50% 50%;"),(e==null?void 0:e.type)==="concave"&&(r["--clip-path"]="polygon(0 0, 100% 0, 100% 100%, 50% 110%, 0 100%);"),r};function s_(e){const r={"--direction":"initial","--alignment":"initial","--distribution":"initial"};return e.type==="zlayer"||(r["--direction"]=Cn[e.type],r["--alignment"]=jn[e.alignment],e.distribution&&(r["--distribution"]=Rn[e.distribution])),r}function i_(e,r="light"){var l,u;const{font_size:t,horizontal_alignment:n,font_weight:a,font_name:o,color:s}=e,i={"--text-align":"initial","--font-weight":400,"--font-size":"initial","--font-family":"sans-serif","--background-clip":"initial","--text-fill-color":"initial"};return i["--text-align"]=n,i["--font-weight"]=Ht[a]||Ht.regular,i["--font-size"]=Yt[t]||Yt.body_m,i["--font-family"]=o||"sans-serif",s&&(((l=s[r])==null?void 0:l.type)==="linear"||((u=s[r])==null?void 0:u.type)==="radial")&&(i["--background-clip"]="text",i["--text-fill-color"]="transparent",i["--background"]=Yr({colorMap:s,colorMode:r})),i}function gt(e){return Object.entries(e).map(([r,t])=>`${r}: ${t}`).join("; ")}function Do(e,r,t,n){var o;const a=(o=n[t])==null?void 0:o[e];return(n[r]||{})[e]?n[r][e]:a}function l_(e){const r=n=>{if(n.type==="package"&&n.is_selected_by_default)return n;if(n.components&&Array.isArray(n.components))for(const a of n.components){const o=r(a);if(o)return o}if(n.stack!==void 0){const a=r(n.stack);if(a)return a}},t=r(e.components_config.base.stack);if(t!==void 0)return t.package_id}const Ln=(e,r)=>r?u_(r).reduce((a,o)=>{if(e){const s=e[o]||{};return{...a,...s}}return a},{}):{},u_=e=>e?Object.entries(e).reduce((t,[n,a])=>(a&&t.push(n),t),[]):[],c_=e=>{const{background_color:r,margin:t,padding:n,spacing:a,size:o,border:s,shape:i,colorMode:l,shadow:u,dimension:c,componentState:d,overrides:_}=e,f=Ln(_,d),m=Un({backgroundColor:r,margin:t,padding:n,border:s,colorMode:l,shape:i,shadow:u,...f}),y=s_({...c,...f});return{...Gt({...o,...f}),...y,...m,"--spacing":`${a||0}px`}};var __=x('<div class="stack svelte-hkx1fg"></div>');const d_={hash:"svelte-hkx1fg",code:".stack.svelte-hkx1fg {box-sizing:border-box;display:flex;flex-direction:var(--direction, unset);width:var(--width, unset);height:var(--height, unset);gap:var(--spacing, 0);background:var(--background, none);border:var(--border, none);border-radius:var(--border-radius, 0);box-shadow:var(--shadow, none);justify-content:var(--distribution, flex-start);align-items:var(--alignment, flex-start);padding-block-start:var(--padding-block-start, 0);padding-inline-end:var(--padding-inline-end, 0);padding-block-end:var(--padding-block-end, 0);padding-inline-start:var(--padding-inline-start, 0);margin-block-start:var(--margin-block-start, 0);margin-inline-end:var(--margin-inline-end, 0);margin-block-end:var(--margin-block-end, 0);margin-inline-start:var(--margin-inline-start, 0);flex:var(--flex, 0 1 auto);}"};function vt(e,r){ne(r,!0),H(e,d_);const t=wn(r,["$$slots","$$events","$$legacy","id","components","labels","onAction","purchaseState","variableDictionary"]),n=ee(()=>gt(c_({id:r.id,components:r.components,labels:r.labels,onAction:r.onAction,purchaseState:r.purchaseState,...t})));var a=__();Da(a,21,()=>r.components,Oa,(o,s)=>{Bn(o,{get nodeData(){return p(s)},get labels(){return r.labels},get onAction(){return r.onAction},get purchaseState(){return r.purchaseState},get variableDictionary(){return r.variableDictionary}})}),Z(()=>{K(a,"id",r.id),K(a,"style",p(n))}),h(e,a),ae()}function p_(e,r){ne(r,!0),Fo(e,{onclick:()=>{r.onAction&&r.onAction(r.action)},children:(n,a)=>{vt(n,dt(()=>r.stack,{get labels(){return r.labels},get purchaseState(){return r.purchaseState},get variableDictionary(){return r.variableDictionary}}))},$$slots:{default:!0}}),ae()}const f_=e=>{const{font_size:r="body_m",color:t={dark:{type:"hex",value:"#000000"},light:{type:"hex",value:"#000000"}},background_color:n={dark:{type:"hex",value:"#FFFFFF"},light:{type:"hex",value:"#FFFFFF"}},padding:a,margin:o,colorMode:s,size:i}=e,l=Ln(e.overrides,e.componentState),u=t_(r),c=i_({...e,...l},s),d=Un({backgroundColor:n,textColor:t,margin:o,padding:a,colorMode:s,...l}),_=Gt({...i,...l});return{textStyles:{...d,...c,..._},tagToRender:u}},m_={hash:"svelte-vi0oj2",code:".text-block.svelte-vi0oj2 {display:block;padding-block-start:var(--padding-block-start, unset);padding-inline-end:var(--padding-inline-end, unset);padding-block-end:var(--padding-block-end, unset);padding-inline-start:var(--padding-inline-start, unset);margin-block-start:var(--margin-block-start, unset);margin-inline-end:var(--margin-inline-end, unset);margin-block-end:var(--margin-block-end, unset);margin-inline-start:var(--margin-inline-start, unset);color:var(--text-color, #ffffff);background:var(--background, none);font-size:var(--font-size, 1rem);font-weight:var(--font-weight, normal);text-align:var(--text-align, center);font-family:var(--font-family, sans-serif);-webkit-background-clip:var(--background-clip, initial);background-clip:var(--background-clip, initial);-webkit-text-fill-color:var(--text-fill-color, initial);}"};function h_(e,r){ne(r,!0),H(e,m_);const t=g(r,"styleVariables",3,""),n=g(r,"component",3,"p");var a=ie(),o=j(a);Na(o,n,!1,(s,i)=>{let l;Z(()=>l=Ca(s,l,{id:r.id,style:t(),class:"text-block"},"svelte-vi0oj2",s.namespaceURI===Jr,s.nodeName.includes("-")));var u=ie(),c=j(u);yn(c,()=>r.children??Ye),h(i,u)}),h(e,a),ae()}const y_=["product_name","price","price_per_period","price_per_period_full","total_price_and_per_month","total_price_and_per_month_full","sub_price_per_month","sub_price_per_week","sub_duration","sub_duration_in_months","sub_period","sub_period_length","sub_period_abbreviated","sub_offer_duration","sub_offer_duration_2","sub_offer_price","sub_offer_price_2","sub_relative_discount"],g_=({value:e="",variableDictionary:r})=>r?y_.reduce((t,n)=>{var o;return t.replaceAll(`{{ ${n} }}`,((o=r[n])==null?void 0:o.toString())||"N/A")},e):e;var v_=x('<span class="text-wrapper svelte-1wjl3r3"><!></span>');const b_={hash:"svelte-1wjl3r3",code:".text-wrapper.svelte-1wjl3r3 {display:block;height:var(--height, unset);width:var(--width, unset);background:var(--background, none);}"};function w_(e,r){ne(r,!0),H(e,b_);const t=wn(r,["$$slots","$$events","$$legacy","id","labels","text_lid","purchaseState","variableDictionary","background_color","size"]),n=ee(()=>f_({id:r.id,labels:r.labels,text_lid:r.text_lid,purchaseState:r.purchaseState,background_color:r.background_color,size:r.size,...t})),a=ee(()=>p(n).tagToRender),o=ee(()=>p(n).textStyles),s=ee(()=>gt({...Un({backgroundColor:r.background_color,...t}),...Gt(r.size)})),i=ee(()=>gt(p(o))),l=ee(()=>Do(r.text_lid,r.purchaseState.locale,r.purchaseState.defaultLocale,r.labels)),u=ee(()=>g_({value:p(l),variableDictionary:r.variableDictionary}));var c=v_(),d=q(c);h_(d,{get styleVariables(){return p(i)},get component(){return p(a)},get id(){return r.id},children:(_,f)=>{var m=_t();Z(()=>ar(m,p(u))),h(_,m)},$$slots:{default:!0}}),Z(()=>K(c,"style",p(s))),h(e,c),ae()}function Bn(e,r){ne(r,!0);const t=Ya(),n=()=>Ha(To,"$prefersDarkMode",t),a={text:w_,stack:vt,image:O_,button:p_,purchase_button:M_,package:R_,footer:L_},o=ee(()=>a[r.nodeData.type]);var s=ie(),i=j(s);Gs(i,()=>p(o),(l,u)=>{u(l,dt(()=>r.nodeData||{},{get labels(){return r.labels},get prefersDarkMode(){return n()},get onAction(){return r.onAction},get purchaseState(){return r.purchaseState},get variableDictionary(){return r.variableDictionary},children:(c,d)=>{var _=ie(),f=j(_);Da(f,17,()=>r.nodeData.components,Oa,(m,y)=>{Bn(m,{get nodeData(){return p(y)},get labels(){return r.labels},get onAction(){return r.onAction},get purchaseState(){return r.purchaseState},get variableDictionary(){return r.variableDictionary}})}),h(c,_)},$$slots:{default:!0}}))}),h(e,s),ae()}function P_({background:e,colorMode:r}){if(!e)return"";if(e.type==="color")return`--background: ${Yr({colorMap:e.value,colorMode:r,fallback:"transparent"})};`}function k_(e,r){var n,a,o,s;if(((a=(n=e.components_config.base)==null?void 0:n.background)==null?void 0:a.type)!=="image")return"";const t=e.components_config.base.background;return((o=t.value[r])==null?void 0:o.original)||((s=t.value.light)==null?void 0:s.original)}var E_=x('<div class="paywall-background svelte-mzlfw9"></div>'),x_=x('<div class="paywall-background image-container svelte-mzlfw9"><img class="image svelte-mzlfw9" alt=""></div>'),S_=x('<div class="paywall svelte-mzlfw9"><!> <!></div>');const I_={hash:"svelte-mzlfw9",code:`
|
|
126
126
|
/* 1. Use a more-intuitive box-sizing model */.svelte-mzlfw9,
|
|
127
127
|
.svelte-mzlfw9::before,
|