@revenuecat/purchases-js 1.26.4 → 1.27.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.
- package/README.md +3 -3
- package/dist/Purchases.es.js +1 -1
- package/dist/Purchases.umd.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,18 +47,18 @@ pnpm install
|
|
|
47
47
|
pnpm run build:dev
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
To avoid publishing the package you can use
|
|
50
|
+
To avoid publishing the package you can use pnpm's link feature:
|
|
51
51
|
|
|
52
52
|
1. In the purchases-js directory, register the package:
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
|
-
|
|
55
|
+
pnpm link
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
2. In your testing project, link to the registered package:
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
|
-
|
|
61
|
+
pnpm link "@revenuecat/purchases-js"
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
> **Note:** Any changes you make to the library will be automatically reflected in your testing project after running `pnpm run build:dev` or `pnpm run build`.
|
package/dist/Purchases.es.js
CHANGED
|
@@ -17539,7 +17539,7 @@ function Jw(e) {
|
|
|
17539
17539
|
}
|
|
17540
17540
|
return r;
|
|
17541
17541
|
}
|
|
17542
|
-
const ep = "1.
|
|
17542
|
+
const ep = "1.27.0", Qw = "https://api.revenuecat.com", eP = "https://e.revenue.cat";
|
|
17543
17543
|
var Ao;
|
|
17544
17544
|
(function(e) {
|
|
17545
17545
|
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
|
@@ -371,7 +371,7 @@ Minimum version required to store current data is: `+N+`.
|
|
|
371
371
|
|
|
372
372
|
@media (min-width: 768px) {.rcb-fullscreen-header.svelte-skuziz {padding-top:var(--rc-spacing-gapXXLarge-desktop);}.rcb-fullscreen-content.svelte-skuziz {padding:0 var(--rc-spacing-outerPadding-desktop)
|
|
373
373
|
var(--rc-spacing-outerPadding-desktop);}
|
|
374
|
-
}`};function Mw(e,r){ee(r,!0),se(e,Fw);const t=y(()=>{var u;return new ma((u=r.brandingInfo)==null?void 0:u.appearance).pageStyleVars}),n=y(()=>{var u,d;return((d=(u=r.brandingInfo)==null?void 0:u.appearance)==null?void 0:d.color_page_bg)??"#ffffff"}),a=y(()=>Vd(r.brandingInfo)),o=y(()=>i(a).wordmarkSrc),s=y(()=>i(a).wordmarkSrcWebp),l=y(()=>i(a).src),c=y(()=>i(a).srcWebp);{let u=y(()=>{var p;return(p=r.brandingInfo)==null?void 0:p.appearance}),d=y(()=>{var p;return(p=r.brandingInfo)==null?void 0:p.brand_font_config});Nd(e,{get brandingAppearance(){return i(u)},get brandFontConfig(){return i(d)},get isInElement(){return r.isInElement},children:(p,_)=>{var g=zw(),f=te(g);{var w=P=>{Ud(P,{get style(){return i(t)},get isInElement(){return r.isInElement},get brandingInfo(){return r.brandingInfo}})};Y(f,P=>{r.isSandbox&&P(w)})}var k=U(f,2),m=z(k);let h;var b=z(m);{var v=P=>{Hd(P,{get src(){return i(o)},get srcWebp(){return i(s)}})},E=P=>{var I=Pe(),A=te(I);{var N=D=>{Rd(D,{get src(){return i(l)},get srcWebp(){return i(c)}})},M=D=>{var F=Pe(),H=te(F);{var C=q=>{Ee(q,{size:"body-base",children:(j,G)=>{var W=Ce();R(()=>he(W,r.brandingInfo.app_name)),S(j,W)},$$slots:{default:!0}})};Y(H,q=>{var j;(j=r.brandingInfo)!=null&&j.app_name&&q(C)},!0)}S(D,F)};Y(A,D=>{i(l)!==null&&i(c)!==null?D(N):D(M,!1)},!0)}S(P,I)};Y(b,P=>{i(o)!==null?P(v):P(E,!1)})}var T=U(m,2),x=z(T);rr(x,()=>r.mainContent??Fe),R(()=>{xe(k,`${i(t)??""}; background-color: ${i(n)??""}`),h=ar(m,1,"rcb-fullscreen-header svelte-skuziz",null,h,{"static-header":r.isInElement})}),S(p,g)},$$slots:{default:!0}})}re()}var jw=B("<!> <!> <!>",1),Nw=B('<div class="rcb-ui-loading-container svelte-1r889ax"><!></div>');const Ow={hash:"svelte-1r889ax",code:".rcb-ui-loading-container.svelte-1r889ax {display:flex;flex-direction:column;align-items:center;}"};function Lw(e,r){ee(r,!0),se(e,Ow);const t=()=>be(o,"$translator",n),[n,a]=Oe(),o=He(xr);Mw(e,{get brandingInfo(){return r.brandingInfo},get isInElement(){return r.isInElement},get isSandbox(){return r.isSandbox},mainContent:l=>{var c=Pe(),u=te(c);{var d=_=>{var g=Nw(),f=z(g);Ms(f,{gap:"medium",align:"center",children:(w,k)=>{var m=jw(),h=te(m);gd(h,{color:"var(--rc-color-grey-text-dark)"});var b=U(h,2);Ee(b,{size:"heading-md",children:(E,T)=>{var x=Ce();R(P=>he(x,P),[()=>t().translate(Z.LoadingPageProcessingPayment)]),S(E,x)},$$slots:{default:!0}});var v=U(b,2);Ee(v,{size:"body-small",children:(E,T)=>{var x=Ce();R(P=>he(x,P),[()=>t().translate(Z.LoadingPageKeepPageOpen)]),S(E,x)},$$slots:{default:!0}}),S(w,m)},$$slots:{default:!0}}),S(_,g)},p=_=>{var g=Pe(),f=te(g);{var w=m=>{jd(m,{get onContinue(){return r.onContinue},fullWidth:!0})},k=m=>{var h=Pe(),b=te(h);{var v=E=>{{let T=y(()=>{var P;return((P=r.brandingInfo)==null?void 0:P.support_email)??null}),x=y(()=>{var P;return((P=r.brandingInfo)==null?void 0:P.app_name)??null});Md(E,{get lastError(){return r.lastError},get productDetails(){return r.productDetails},get supportEmail(){return i(T)},get onDismiss(){return r.closeWithError},get appName(){return i(x)},fullWidth:!0})}};Y(b,E=>{r.currentPage==="error"&&E(v)},!0)}S(m,h)};Y(f,m=>{r.currentPage==="success"?m(w):m(k,!1)},!0)}S(_,g)};Y(u,_=>{r.currentPage==="loading"?_(d):_(p,!1)})}S(l,c)},$$slots:{mainContent:!0}}),re(),a()}function Bw(e,r){var b;ee(r,!0);const t=K(r,"customTranslations",19,()=>({})),n=K(r,"skipSuccessPage",3,!1);let a=new An(t(),r.selectedLocale,r.defaultLocale),o=Xr(a);cr(xr,o),cr(Qa,(b=r.brandingInfo)==null?void 0:b.appearance),cr(Jo,r.eventsTracker);let s=$(!1),l=$(null),c=$(null),u=$("waiting");Cr(()=>{i(u)==="success"&&i(l)&&n()&&r.onFinished(i(l))});const d=()=>{i(u)==="success"&&i(l)&&r.onFinished(i(l))},p=()=>{r.onError(i(c)??new oe(ne.UnknownError,"Unknown error without state set.")),r.unmountPaddlePurchaseUi()},_=(v,E)=>v instanceof oe?v:v instanceof Le?oe.fromPurchasesError(v,ne.UnknownError):new oe(ne.UnknownError,E);let g=null,f=null,w=null;fr(async()=>{var x;r.isInElement||(g=document.documentElement.style.height,f=document.documentElement.style.overflow,w=document.body.style.height,document.documentElement.style.height="100%",document.body.style.height="100%",document.documentElement.style.overflow="hidden");const v=()=>{L(u,"loading")},E={offeringIdentifier:r.productDetails.presentedOfferingContext.offeringIdentifier,targetingContext:null,placementIdentifier:null};let T;try{T=await r.paddleService.startCheckout({appUserId:r.appUserId,productId:r.productDetails.identifier,presentedOfferingContext:E,purchaseOption:r.purchaseOption,customerEmail:r.customerEmail,metadata:r.metadata}),L(s,T.paddle_billing_params.is_sandbox,!0)}catch(P){const I=_(P,`Start Paddle checkout failed: ${P}`);L(c,I,!0),L(u,"error"),r.onError(I);return}try{const P=await r.paddleService.purchase({operationSessionId:T.operation_session_id,transactionId:(x=T.paddle_billing_params)==null?void 0:x.transaction_id,onCheckoutLoaded:v,onClose:r.onClose,params:{rcPackage:r.rcPackage,purchaseOption:r.purchaseOption,appUserId:r.appUserId,presentedOfferingIdentifier:r.productDetails.presentedOfferingContext.offeringIdentifier,customerEmail:r.customerEmail,locale:r.selectedLocale||r.defaultLocale}});n()?r.onFinished(P):(L(l,P,!0),L(u,"success"))}catch(P){const I=_(P,`Paddle purchase failed: ${P}`);L(c,I,!0),L(u,"error"),r.onError(I)}}),un(()=>{if(!r.isInElement){const v=(E,T,x)=>{x===""?E.style.removeProperty(T):E.style.setProperty(T,x)};v(document.documentElement,"height",g),v(document.body,"height",w),v(document.documentElement,"overflow",f)}});var k=Pe(),m=te(k);{var h=v=>{Lw(v,{get currentPage(){return i(u)},get brandingInfo(){return r.brandingInfo},get productDetails(){return r.productDetails},get isSandbox(){return i(s)},get lastError(){return i(c)},get isInElement(){return r.isInElement},onContinue:d,closeWithError:p})};Y(m,v=>{i(u)!=="waiting"&&v(h)})}S(e,k),re()}function Jd(e){return e==null?!0:new Date(e)>new Date}function Uw(e,r,t,n){const a=r.product_identifier;if(a in t)return Rw(e,r,t[a]);if(a in n)return Vw(e,r,n[a]);throw new Le($e.CustomerInfoError,"Could not find entitlement product in subscriptions or non-subscriptions.")}function Rw(e,r,t){return{identifier:e,isActive:Jd(r.expires_date),willRenew:Qd(r.expires_date,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,productPlanIdentifier:r.product_plan_identifier??null,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",ownershipType:(t==null?void 0:t.ownership_type)??"UNKNOWN"}}function Vw(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,productPlanIdentifier:null,unsubscribeDetectedAt:null,billingIssueDetectedAt:null,isSandbox:t.is_sandbox,periodType:"normal",ownershipType:"UNKNOWN"}}function Hw(e,r,t){const n={},a={};for(const o in e){const s=Uw(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 ol(e){const r=Yw(e),t=e.subscriber,n=Kw(t.non_subscriptions),a=Object.entries(e.subscriber.non_subscriptions).flatMap(([l,c])=>c.map(u=>({transactionIdentifier:u.id,productIdentifier:l,purchaseDate:new Date(u.purchase_date||u.original_purchase_date),storeTransactionId:u.store_transaction_id||null,store:u.store}))),o=new Date(e.request_date),s=Object.fromEntries(Object.entries(e.subscriber.subscriptions).map(([l,c])=>[l,{productIdentifier:l,purchaseDate:new Date(c.purchase_date),originalPurchaseDate:Bt(c.original_purchase_date),expiresDate:Bt(c.expires_date),store:c.store,unsubscribeDetectedAt:Bt(c.unsubscribe_detected_at),isSandbox:c.is_sandbox,billingIssuesDetectedAt:Bt(c.billing_issues_detected_at),gracePeriodExpiresDate:Bt(c.grace_period_expires_date),ownershipType:c.ownership_type??"UNKNOWN",periodType:c.period_type,refundedAt:Bt(c.refunded_at),storeTransactionId:c.store_transaction_id||null,managementURL:c.management_url??null,isActive:Jd(c.expires_date),willRenew:Qd(c.expires_date,c)}]));return{entitlements:Hw(t.entitlements,t.subscriptions,n),allExpirationDatesByProduct:r,allPurchaseDatesByProduct:Ww(e,n),activeSubscriptions:Gw(r),managementURL:t.management_url,requestDate:o,firstSeenDate:new Date(t.first_seen),originalPurchaseDate:Bt(t.original_purchase_date),originalAppUserId:e.subscriber.original_app_user_id,nonSubscriptionTransactions:a,subscriptionsByProductIdentifier:s}}function Qd(e,r){if(r==null)return!1;const t=r.store=="promotional",n=e==null,a=r.unsubscribe_detected_at!=null,o=r.billing_issues_detected_at!=null;return!(t||n||a||o)}function Ww(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 Yw(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 Gw(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 Kw(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 ep="1.26.4",$w="https://api.revenuecat.com",Xw="https://e.revenue.cat";var si;(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"})(si||(si={}));const Zw=/^rcb_[a-zA-Z0-9_.-]+$/,Jw=/^pdl_[a-zA-Z0-9_.-]+$/,Qw=/^test_[a-zA-Z0-9_.-]+$/;function li(e){return e?e.startsWith("rcb_sb_"):!1}function il(e){return e?Zw.test(e):!1}function rp(e){return e?Jw.test(e):!1}function jn(e){return e?Qw.test(e):!1}async function lt(e,r,t){return(await tp(e,r,t)).data}async function tp(e,r,t){const{apiKey:n,body:a,headers:o,httpConfig:s}=r,c=`${(s==null?void 0:s.proxyURL)??$w}${e.urlPath()}`;try{const u=await fetch(c,{method:e.method,headers:dp(n,o,s==null?void 0:s.additionalHeaders),body:rP(a),signal:t});await eP(u,e);const d=u.status;return{data:await u.json(),statusCode:d}}catch(u){throw u instanceof TypeError?new Le($e.NetworkError,sa.getPublicMessage($e.NetworkError),u.message):u}}async function eP(e,r){const t=e.status;if(t>=si.INTERNAL_SERVER_ERROR)sl(r,t,await e.text());else if(t>=si.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 l=sa.convertCodeToBackendErrorCode(o);if(l==null)sl(r,t,a,o);else throw Le.getForBackendError(l,s)}else sl(r,t,a)}}function sl(e,r,t,n){throw new Le($e.UnknownBackendError,"Unknown backend error.",`Request: ${e.name}. Status code: ${r}. Body: ${t}.`,{backendErrorCode:n})}function rP(e){return e==null?null:JSON.stringify(e)}const np="Authorization",ap="Content-Type",op="Accept",ip="X-Platform",sp="X-Version",lp="X-Platform-Flavor",cp="X-Platform-Flavor-Version",up="X-Is-Sandbox",tP=new Set([np,ap,op,ip,sp,up,lp,cp]);function dp(e,r,t){let n={[np]:`Bearer ${e}`,[ap]:"application/json",[op]:"application/json",[ip]:"web",[sp]:ep,[up]:`${li(e)}`};const a=pi.getPlatformInfo();if(a){const o={[lp]:a.flavor,[cp]:a.version};n={...n,...o}}return r&&(n={...n,...r}),t&&(n={...t,...n}),n}const uo="/v1/subscribers",Nn="/rcbilling/v1";class nP{constructor(r){V(this,"appUserId");V(this,"method","GET");V(this,"name","getOfferings");this.appUserId=r}urlPath(){const r=encodeURIComponent(this.appUserId);return`${uo}/${r}/offerings`}}class aP{constructor(r,t,n,a){V(this,"method","GET");V(this,"name","getProducts");V(this,"appUserId");V(this,"productIds");V(this,"currency");V(this,"discountCode");this.appUserId=r,this.productIds=t,this.currency=n,this.discountCode=a}urlPath(){const r=encodeURIComponent(this.appUserId),t=this.productIds.map(encodeURIComponent).join("&id="),n=this.currency?`¤cy=${this.currency}`:"",a=this.discountCode?`&discount_code=${encodeURIComponent(this.discountCode)}`:"";return`${Nn}/subscribers/${r}/products?id=${t}${n}${a}`}}class oP{constructor(r){V(this,"method","GET");V(this,"name","getCustomerInfo");V(this,"appUserId");this.appUserId=r}urlPath(){const r=encodeURIComponent(this.appUserId);return`${uo}/${r}`}}class iP{constructor(){V(this,"method","POST");V(this,"name","identify")}urlPath(){return`${uo}/identify`}}class sP{constructor(){V(this,"method","GET");V(this,"name","getBrandingInfo")}urlPath(){return`${Nn}/branding`}}class lP{constructor(){V(this,"method","POST");V(this,"name","postCheckoutPrepare")}urlPath(){return`${Nn}/checkout/prepare`}}class cP{constructor(){V(this,"method","POST");V(this,"name","postCheckoutStart")}urlPath(){return`${Nn}/checkout/start`}}class uP{constructor(r){V(this,"method","POST");V(this,"name","postCheckoutCalculateTax");V(this,"operationSessionId");this.operationSessionId=r}urlPath(){return`${Nn}/checkout/${this.operationSessionId}/calculate_taxes`}}class dP{constructor(r){V(this,"method","POST");V(this,"name","postCheckoutComplete");V(this,"operationSessionId");this.operationSessionId=r}urlPath(){return`${Nn}/checkout/${this.operationSessionId}/complete`}}class pP{constructor(r){V(this,"method","GET");V(this,"name","getCheckoutStatus");V(this,"operationSessionId");this.operationSessionId=r}urlPath(){return`${Nn}/checkout/${this.operationSessionId}`}}class _P{constructor(r){V(this,"method","POST");V(this,"name","setAttributes");V(this,"appUserId");this.appUserId=r}urlPath(){const r=encodeURIComponent(this.appUserId);return`${uo}/${r}/attributes`}}class gP{constructor(){V(this,"method","POST");V(this,"name","postReceipt")}urlPath(){return"/v1/receipts"}}class fP{constructor(r){V(this,"method","GET");V(this,"name","getVirtualCurrencies");V(this,"appUserId");this.appUserId=r}urlPath(){const r=encodeURIComponent(this.appUserId);return`${uo}/${r}/virtual_currencies`}}const ll={};class mP{constructor(r,t=ll,n){V(this,"API_KEY");V(this,"httpConfig");V(this,"isSandbox");V(this,"purchasesContext");this.API_KEY=r,this.httpConfig=t,this.isSandbox=li(r),this.purchasesContext=n}getIsSandbox(){return this.isSandbox}async getOfferings(r){return await lt(new nP(r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getCustomerInfo(r){return await lt(new oP(r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async identify(r,t){const n={app_user_id:r,new_app_user_id:t},a=await tp(new iP,{apiKey:this.API_KEY,body:n,httpConfig:this.httpConfig}),o=a.statusCode===201;return{...a.data,was_created:o}}async getProducts(r,t,n,a){return await lt(new aP(r,t,n,a),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getBrandingInfo(){return await lt(new sP,{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async postCheckoutPrepare(r,t){const n={product_id:r,price_id:t.priceId};return t.id!=="base_option"&&(n.offer_id=t.id),await lt(new lP,{apiKey:this.API_KEY,body:n,httpConfig:this.httpConfig})}async postCheckoutStart(r,t,n,a,o,s,l=void 0,c){var d,p;const u={app_user_id:r,product_id:t,email:s,price_id:a.priceId,presented_offering_identifier:n.offeringIdentifier,trace_id:o};return l&&(u.metadata=l),a.id!=="base_option"&&(u.offer_id=a.id),n.targetingContext&&(u.applied_targeting_rule={rule_id:n.targetingContext.ruleId,revision:n.targetingContext.revision}),n.placementIdentifier&&(u.presented_placement_identifier=n.placementIdentifier),(p=(d=this.purchasesContext)==null?void 0:d.workflowContext)!=null&&p.workflowIdentifier&&(u.presented_workflow_id=this.purchasesContext.workflowContext.workflowIdentifier),c&&(u.presented_step_id=c),await lt(new cP,{apiKey:this.API_KEY,body:u,httpConfig:this.httpConfig})}async postCheckoutCalculateTax(r,t,n,a){const o={country_code:t,postal_code:n};return await lt(new uP(r),{apiKey:this.API_KEY,body:o,httpConfig:this.httpConfig},a)}async postCheckoutComplete(r,t){const n={email:t};return await lt(new dP(r),{apiKey:this.API_KEY,body:n,httpConfig:this.httpConfig})}async getCheckoutStatus(r){return await lt(new pP(r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async setAttributes(r,t){const n=Date.now(),a={};for(const[s,l]of Object.entries(t))a[s]={value:l,updated_at_ms:n};const o={attributes:a};return await lt(new _P(r),{apiKey:this.API_KEY,body:o,httpConfig:this.httpConfig})}async postReceipt(r,t,n,a,o,s){var u,d;let l=null;o.targetingContext&&(l={rule_id:o.targetingContext.ruleId,revision:o.targetingContext.revision});const c={fetch_token:a,product_id:t,currency:n,app_user_id:r,presented_offering_identifier:o.offeringIdentifier,presented_placement_identifier:o.placementIdentifier,presented_workflow_id:(d=(u=this.purchasesContext)==null?void 0:u.workflowContext)==null?void 0:d.workflowIdentifier,applied_targeting_rule:l,initiation_source:s};return await lt(new gP,{apiKey:this.API_KEY,body:c,httpConfig:this.httpConfig})}async getVirtualCurrencies(r){return await lt(new fP(r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}}function hP(e){if(!(il(e)||jn(e)||rp(e)))throw new Le($e.InvalidCredentialsError,"Invalid API key. Use your Web Billing API key.")}function cl(e){if(!e||new Set(["no_user","null","none","nil","(null)","NaN","\\x00","","unidentified","undefined","unknown"]).has(e)||e.includes("/"))throw new Le($e.InvalidAppUserIdError,'Provided user id: "'+(e??"[Not provided]")+'" is not valid. See https://www.revenuecat.com/docs/customers/user-ids#tips-for-setting-app-user-ids for more information.')}function yP(e){if(e!=null&&e.endsWith("/"))throw new Le($e.ConfigurationError,"Invalid proxy URL. The proxy URL should not end with a trailing slash.")}function bP(e){if(e){for(const r in e)if(tP.has(r))throw new Le($e.ConfigurationError,"Invalid additional headers. Some headers are reserved for internal use.")}}var ul=(e=>(e.Current="current",e))(ul||{});function pp(e,r){async function t(...n){return await this.preload(),await e.call(this,...n)}return t}const _p=(e,r)=>{const t={...e.webBillingProduct,presentedOfferingContext:{...e.webBillingProduct.presentedOfferingContext,placementIdentifier:r}};return{...e,webBillingProduct:t,rcBillingProduct:t}},On=(e,r)=>e==null?null:_p(e,r),vP=(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 l=n[t]??null;if(l==null)return null;o=r[l],o==null&&(o=r[a])}else o=r[a];if(o==null)return null;const s=Object.fromEntries(Object.entries(o.packagesById).map(([l,c])=>[l,_p(c,t)]));return{...o,packagesById:s,availablePackages:Object.values(s),weekly:On(o.weekly,t),monthly:On(o.monthly,t),twoMonth:On(o.twoMonth,t),threeMonth:On(o.threeMonth,t),sixMonth:On(o.sixMonth,t),annual:On(o.annual,t),lifetime:On(o.lifetime,t)}};function kP(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,l=lv(s,o,t,e.targeting,e.ui_config);l!=null&&(n[o.identifier]=l)});const a=e.current_offering_id?n[e.current_offering_id]??null:null;return Object.keys(n).length==0&&le.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}}const wP=1000001;function PP(e,r,t){const n=t.formatPrice(e.amountMicros,e.currency);return r?r.unit===ue.Year?t.formatPrice(e.amountMicros/Zs/r.number,e.currency):r.unit===ue.Month?t.formatPrice(e.amountMicros/ni/r.number,e.currency):r.unit===ue.Week?t.formatPrice(e.amountMicros/Xs/r.number,e.currency):r.unit===ue.Day?t.formatPrice(e.amountMicros/r.number,e.currency):n:n}function xP(e,r,t){const n=t.formatPrice(e.amountMicros,e.currency);return r?r.unit===ue.Year?t.formatPrice(e.amountMicros/Js/r.number,e.currency):r.unit===ue.Month?t.formatPrice(e.amountMicros/ai/r.number,e.currency):r.unit===ue.Week?t.formatPrice(e.amountMicros/r.number,e.currency):r.unit===ue.Day?t.formatPrice(e.amountMicros*Xs/r.number,e.currency):n:n}function EP(e,r,t){return r?r.unit===ue.Year?t.formatPrice(e.amountMicros/oi,e.currency):r.unit===ue.Month?t.formatPrice(e.amountMicros/r.number,e.currency):r.unit===ue.Week?t.formatPrice(e.amountMicros*ai/r.number,e.currency):r.unit===ue.Day?t.formatPrice(e.amountMicros*ni/r.number,e.currency):t.formatPrice(e.amountMicros/(r.number||1),e.currency):t.formatPrice(e.amountMicros,e.currency)}function SP(e,r,t){const n=t.formatPrice(e.amountMicros,e.currency);return r?r.unit===ue.Year?t.formatPrice(e.amountMicros/r.number,e.currency):r.unit===ue.Month?t.formatPrice(e.amountMicros*oi/r.number,e.currency):r.unit===ue.Week?t.formatPrice(e.amountMicros*Js/r.number,e.currency):r.unit===ue.Day?t.formatPrice(e.amountMicros*Zs/r.number,e.currency):n:n}function gp(e,r,t){return{pricePerDay:PP(e,r,t),pricePerWeek:xP(e,r,t),pricePerMonth:EP(e,r,t),pricePerYear:SP(e,r,t)}}function TP(e,r){const t=new Date;switch(e.unit){case ue.Year:t.setFullYear(t.getFullYear()+e.number);break;case ue.Month:t.setMonth(t.getMonth()+e.number);break;case ue.Week:t.setDate(t.getDate()+e.number*7);break;case ue.Day:t.setDate(t.getDate()+e.number);break}return r.translateDate(t,{dateStyle:"long"})??""}function IP(e,r,t){const n=e.discount??e.trial??e.introPrice,a=e.trial&&!e.discount?e.introPrice:null;if(n===null)return;const{period:o,price:s}=n;if(s!==null){const l=gp(s,o,r);t["product.offer_price"]=r.formatPrice(s.amountMicros,s.currency),t["product.offer_price_per_day"]=l.pricePerDay,t["product.offer_price_per_week"]=l.pricePerWeek,t["product.offer_price_per_month"]=l.pricePerMonth,t["product.offer_price_per_year"]=l.pricePerYear}if(o!==null){const l=el(o,r);t["product.offer_period"]=l.period,t["product.offer_period_abbreviated"]=l.periodAbbreviated,t["product.offer_period_with_unit"]=l.periodWithUnit,t["product.offer_period_in_days"]=l.periodInDays,t["product.offer_period_in_weeks"]=l.periodInWeeks,t["product.offer_period_in_months"]=l.periodInMonths,t["product.offer_period_in_years"]=l.periodInYears,t["product.offer_end_date"]=TP(o,r)}if(a!==null&&(a.price!==null&&(t["product.secondary_offer_price"]=r.formatPrice(a.price.amountMicros,a.price.currency)),a.period!==null)){const l=el(a.period,r);t["product.secondary_offer_period"]=l.period,t["product.secondary_offer_period_abbreviated"]=l.periodAbbreviated}}function DP(e,r,t){var a;const n=((a=e.discount)==null?void 0:a.price)??null;n!==null&&(t["product.offer_price"]=r.formatPrice(n.amountMicros,n.currency))}function fp(e,r={}){var a;if(r.translator)return yp(e,r.translator);const t=((a=e.paywallComponents)==null?void 0:a.default_locale)||Lr,n=new An(r.customTranslations??{},r.selectedLocale??t,r.fallbackLocale??t);return yp(e,n)}function ci(e){var a;const r=e.webBillingProduct.price,t=mp(e),n=e.webBillingProduct.period||((a=t==null?void 0:t.base)==null?void 0:a.period);if(!n||!n.number||n.number<=0)return r.amountMicros;switch(n.unit){case ue.Year:return r.amountMicros/oi;case ue.Month:return r.amountMicros/n.number;case ue.Week:return r.amountMicros*ai/n.number;case ue.Day:return r.amountMicros*ni/n.number;default:return r.amountMicros/(n.number||1)}}function mp(e){return e.webBillingProduct.productType===yt.Subscription?e.webBillingProduct.defaultSubscriptionOption:e.webBillingProduct.productType===yt.NonConsumable||e.webBillingProduct.productType===yt.Consumable?e.webBillingProduct.defaultNonSubscriptionOption:e.webBillingProduct.defaultPurchaseOption}function CP(e,r){return e===yt.Subscription&&r!=null}function AP(e,r){return e!==yt.Subscription&&r!=null}function hp(e,r,t,n=!1){return t.translate(Z.PaywallVariablesPricePerPeriod,{formattedPrice:e,period:r.base.period?r.base.period.number===1?t.translatePeriodUnit(r.base.period.unit,{noWhitespace:!0,short:!n}):t.translatePeriod(r.base.period.number,r.base.period.unit,{noWhitespace:!0,short:!n}):""})}function yp(e,r){const t=e.availablePackages,n=t.reduce((a,o)=>{const s=ci(a),l=ci(o);return s>l?a:o});return t.reduce((a,o)=>(a[o.identifier]=qP(o,n,r),a),{})}function qP(e,r,t){const n=e.webBillingProduct,a=n.price,o=t.formatPrice(a.amountMicros,a.currency),s=mp(e),l=n.productType,c={"product.store_product_name":n.title,"product.price":o,"product.price_per_period":"","product.price_per_period_abbreviated":"","product.price_per_day":"","product.price_per_week":"","product.price_per_month":"","product.price_per_year":"","product.period":"","product.period_abbreviated":"","product.periodly":"","product.period_in_days":"","product.period_in_weeks":"","product.period_in_months":"","product.period_in_years":"","product.period_with_unit":"","product.currency_code":a.currency,"product.currency_symbol":t.formatPrice(0,a.currency).replace("0",""),"product.offer_price":"","product.offer_price_per_day":"","product.offer_price_per_week":"","product.offer_price_per_month":"","product.offer_price_per_year":"","product.offer_period":"","product.offer_period_abbreviated":"","product.offer_period_in_days":"","product.offer_period_in_weeks":"","product.offer_period_in_months":"","product.offer_period_in_years":"","product.offer_period_with_unit":"","product.offer_end_date":"","product.secondary_offer_price":"","product.secondary_offer_period":"","product.secondary_offer_period_abbreviated":"","product.relative_discount":""};if(CP(l,s)){c["product.price_per_period_abbreviated"]=hp(o,s,t),c["product.price_per_period"]=hp(o,s,t,!0);const u=n.period||s.base.period,d=gp(a,u,t);if(c["product.price_per_day"]=d.pricePerDay,c["product.price_per_week"]=d.pricePerWeek,c["product.price_per_month"]=d.pricePerMonth,c["product.price_per_year"]=d.pricePerYear,u){const f=el(u,t);c["product.period"]=f.period,c["product.period_abbreviated"]=f.periodAbbreviated,c["product.period_with_unit"]=f.periodWithUnit,c["product.period_in_days"]=f.periodInDays,c["product.period_in_weeks"]=f.periodInWeeks,c["product.period_in_months"]=f.periodInMonths,c["product.period_in_years"]=f.periodInYears,c["product.periodly"]=t.translatePeriodFrequency(u.number,u.unit)||""}const p=ci(e),_=ci(r),g=(_-p)*100/_;c["product.relative_discount"]=g<1?"":t.translate(Z.PaywallVariablesSubRelativeDiscount,{discount:g.toFixed(0)}),IP(s,t,c)}return AP(l,s)&&(c["product.price"]=o,c["product.price_per_period"]=o,c["product.price_per_period_abbreviated"]=o,c["product.price_per_month"]=o,c["product.period_with_unit"]=t.translate(Z.PeriodsLifetime),c["product.period_in_months"]=t.translate(Z.PeriodsLifetime),c["product.periodly"]=t.translate(Z.PeriodsLifetime),c["product.price_per_week"]="",c["product.relative_discount"]="",c["product.period"]="",c["product.period_abbreviated"]="",DP(s,t,c)),c}var zP=/(%?)(%([sdijo]))/g;function FP(e,r){switch(r){case"s":return e;case"d":case"i":return Number(e);case"j":return JSON.stringify(e);case"o":{if(typeof e=="string")return e;const t=JSON.stringify(e);return t==="{}"||t==="[]"||/^\[object .+?\]$/.test(t)?e:t}}}function dl(e,...r){if(r.length===0)return e;let t=0,n=e.replace(zP,(a,o,s,l)=>{const c=r[t],u=FP(c,l);return o?a:(t++,u)});return t<r.length&&(n+=` ${r.slice(t).join(" ")}`),n=n.replace(/%{2,2}/g,"%"),n}var MP=2;function jP(e){if(!e.stack)return;const r=e.stack.split(`
|
|
374
|
+
}`};function Mw(e,r){ee(r,!0),se(e,Fw);const t=y(()=>{var u;return new ma((u=r.brandingInfo)==null?void 0:u.appearance).pageStyleVars}),n=y(()=>{var u,d;return((d=(u=r.brandingInfo)==null?void 0:u.appearance)==null?void 0:d.color_page_bg)??"#ffffff"}),a=y(()=>Vd(r.brandingInfo)),o=y(()=>i(a).wordmarkSrc),s=y(()=>i(a).wordmarkSrcWebp),l=y(()=>i(a).src),c=y(()=>i(a).srcWebp);{let u=y(()=>{var p;return(p=r.brandingInfo)==null?void 0:p.appearance}),d=y(()=>{var p;return(p=r.brandingInfo)==null?void 0:p.brand_font_config});Nd(e,{get brandingAppearance(){return i(u)},get brandFontConfig(){return i(d)},get isInElement(){return r.isInElement},children:(p,_)=>{var g=zw(),f=te(g);{var w=P=>{Ud(P,{get style(){return i(t)},get isInElement(){return r.isInElement},get brandingInfo(){return r.brandingInfo}})};Y(f,P=>{r.isSandbox&&P(w)})}var k=U(f,2),m=z(k);let h;var b=z(m);{var v=P=>{Hd(P,{get src(){return i(o)},get srcWebp(){return i(s)}})},E=P=>{var I=Pe(),A=te(I);{var N=D=>{Rd(D,{get src(){return i(l)},get srcWebp(){return i(c)}})},M=D=>{var F=Pe(),H=te(F);{var C=q=>{Ee(q,{size:"body-base",children:(j,G)=>{var W=Ce();R(()=>he(W,r.brandingInfo.app_name)),S(j,W)},$$slots:{default:!0}})};Y(H,q=>{var j;(j=r.brandingInfo)!=null&&j.app_name&&q(C)},!0)}S(D,F)};Y(A,D=>{i(l)!==null&&i(c)!==null?D(N):D(M,!1)},!0)}S(P,I)};Y(b,P=>{i(o)!==null?P(v):P(E,!1)})}var T=U(m,2),x=z(T);rr(x,()=>r.mainContent??Fe),R(()=>{xe(k,`${i(t)??""}; background-color: ${i(n)??""}`),h=ar(m,1,"rcb-fullscreen-header svelte-skuziz",null,h,{"static-header":r.isInElement})}),S(p,g)},$$slots:{default:!0}})}re()}var jw=B("<!> <!> <!>",1),Nw=B('<div class="rcb-ui-loading-container svelte-1r889ax"><!></div>');const Ow={hash:"svelte-1r889ax",code:".rcb-ui-loading-container.svelte-1r889ax {display:flex;flex-direction:column;align-items:center;}"};function Lw(e,r){ee(r,!0),se(e,Ow);const t=()=>be(o,"$translator",n),[n,a]=Oe(),o=He(xr);Mw(e,{get brandingInfo(){return r.brandingInfo},get isInElement(){return r.isInElement},get isSandbox(){return r.isSandbox},mainContent:l=>{var c=Pe(),u=te(c);{var d=_=>{var g=Nw(),f=z(g);Ms(f,{gap:"medium",align:"center",children:(w,k)=>{var m=jw(),h=te(m);gd(h,{color:"var(--rc-color-grey-text-dark)"});var b=U(h,2);Ee(b,{size:"heading-md",children:(E,T)=>{var x=Ce();R(P=>he(x,P),[()=>t().translate(Z.LoadingPageProcessingPayment)]),S(E,x)},$$slots:{default:!0}});var v=U(b,2);Ee(v,{size:"body-small",children:(E,T)=>{var x=Ce();R(P=>he(x,P),[()=>t().translate(Z.LoadingPageKeepPageOpen)]),S(E,x)},$$slots:{default:!0}}),S(w,m)},$$slots:{default:!0}}),S(_,g)},p=_=>{var g=Pe(),f=te(g);{var w=m=>{jd(m,{get onContinue(){return r.onContinue},fullWidth:!0})},k=m=>{var h=Pe(),b=te(h);{var v=E=>{{let T=y(()=>{var P;return((P=r.brandingInfo)==null?void 0:P.support_email)??null}),x=y(()=>{var P;return((P=r.brandingInfo)==null?void 0:P.app_name)??null});Md(E,{get lastError(){return r.lastError},get productDetails(){return r.productDetails},get supportEmail(){return i(T)},get onDismiss(){return r.closeWithError},get appName(){return i(x)},fullWidth:!0})}};Y(b,E=>{r.currentPage==="error"&&E(v)},!0)}S(m,h)};Y(f,m=>{r.currentPage==="success"?m(w):m(k,!1)},!0)}S(_,g)};Y(u,_=>{r.currentPage==="loading"?_(d):_(p,!1)})}S(l,c)},$$slots:{mainContent:!0}}),re(),a()}function Bw(e,r){var b;ee(r,!0);const t=K(r,"customTranslations",19,()=>({})),n=K(r,"skipSuccessPage",3,!1);let a=new An(t(),r.selectedLocale,r.defaultLocale),o=Xr(a);cr(xr,o),cr(Qa,(b=r.brandingInfo)==null?void 0:b.appearance),cr(Jo,r.eventsTracker);let s=$(!1),l=$(null),c=$(null),u=$("waiting");Cr(()=>{i(u)==="success"&&i(l)&&n()&&r.onFinished(i(l))});const d=()=>{i(u)==="success"&&i(l)&&r.onFinished(i(l))},p=()=>{r.onError(i(c)??new oe(ne.UnknownError,"Unknown error without state set.")),r.unmountPaddlePurchaseUi()},_=(v,E)=>v instanceof oe?v:v instanceof Le?oe.fromPurchasesError(v,ne.UnknownError):new oe(ne.UnknownError,E);let g=null,f=null,w=null;fr(async()=>{var x;r.isInElement||(g=document.documentElement.style.height,f=document.documentElement.style.overflow,w=document.body.style.height,document.documentElement.style.height="100%",document.body.style.height="100%",document.documentElement.style.overflow="hidden");const v=()=>{L(u,"loading")},E={offeringIdentifier:r.productDetails.presentedOfferingContext.offeringIdentifier,targetingContext:null,placementIdentifier:null};let T;try{T=await r.paddleService.startCheckout({appUserId:r.appUserId,productId:r.productDetails.identifier,presentedOfferingContext:E,purchaseOption:r.purchaseOption,customerEmail:r.customerEmail,metadata:r.metadata}),L(s,T.paddle_billing_params.is_sandbox,!0)}catch(P){const I=_(P,`Start Paddle checkout failed: ${P}`);L(c,I,!0),L(u,"error"),r.onError(I);return}try{const P=await r.paddleService.purchase({operationSessionId:T.operation_session_id,transactionId:(x=T.paddle_billing_params)==null?void 0:x.transaction_id,onCheckoutLoaded:v,onClose:r.onClose,params:{rcPackage:r.rcPackage,purchaseOption:r.purchaseOption,appUserId:r.appUserId,presentedOfferingIdentifier:r.productDetails.presentedOfferingContext.offeringIdentifier,customerEmail:r.customerEmail,locale:r.selectedLocale||r.defaultLocale}});n()?r.onFinished(P):(L(l,P,!0),L(u,"success"))}catch(P){const I=_(P,`Paddle purchase failed: ${P}`);L(c,I,!0),L(u,"error"),r.onError(I)}}),un(()=>{if(!r.isInElement){const v=(E,T,x)=>{x===""?E.style.removeProperty(T):E.style.setProperty(T,x)};v(document.documentElement,"height",g),v(document.body,"height",w),v(document.documentElement,"overflow",f)}});var k=Pe(),m=te(k);{var h=v=>{Lw(v,{get currentPage(){return i(u)},get brandingInfo(){return r.brandingInfo},get productDetails(){return r.productDetails},get isSandbox(){return i(s)},get lastError(){return i(c)},get isInElement(){return r.isInElement},onContinue:d,closeWithError:p})};Y(m,v=>{i(u)!=="waiting"&&v(h)})}S(e,k),re()}function Jd(e){return e==null?!0:new Date(e)>new Date}function Uw(e,r,t,n){const a=r.product_identifier;if(a in t)return Rw(e,r,t[a]);if(a in n)return Vw(e,r,n[a]);throw new Le($e.CustomerInfoError,"Could not find entitlement product in subscriptions or non-subscriptions.")}function Rw(e,r,t){return{identifier:e,isActive:Jd(r.expires_date),willRenew:Qd(r.expires_date,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,productPlanIdentifier:r.product_plan_identifier??null,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",ownershipType:(t==null?void 0:t.ownership_type)??"UNKNOWN"}}function Vw(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,productPlanIdentifier:null,unsubscribeDetectedAt:null,billingIssueDetectedAt:null,isSandbox:t.is_sandbox,periodType:"normal",ownershipType:"UNKNOWN"}}function Hw(e,r,t){const n={},a={};for(const o in e){const s=Uw(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 ol(e){const r=Yw(e),t=e.subscriber,n=Kw(t.non_subscriptions),a=Object.entries(e.subscriber.non_subscriptions).flatMap(([l,c])=>c.map(u=>({transactionIdentifier:u.id,productIdentifier:l,purchaseDate:new Date(u.purchase_date||u.original_purchase_date),storeTransactionId:u.store_transaction_id||null,store:u.store}))),o=new Date(e.request_date),s=Object.fromEntries(Object.entries(e.subscriber.subscriptions).map(([l,c])=>[l,{productIdentifier:l,purchaseDate:new Date(c.purchase_date),originalPurchaseDate:Bt(c.original_purchase_date),expiresDate:Bt(c.expires_date),store:c.store,unsubscribeDetectedAt:Bt(c.unsubscribe_detected_at),isSandbox:c.is_sandbox,billingIssuesDetectedAt:Bt(c.billing_issues_detected_at),gracePeriodExpiresDate:Bt(c.grace_period_expires_date),ownershipType:c.ownership_type??"UNKNOWN",periodType:c.period_type,refundedAt:Bt(c.refunded_at),storeTransactionId:c.store_transaction_id||null,managementURL:c.management_url??null,isActive:Jd(c.expires_date),willRenew:Qd(c.expires_date,c)}]));return{entitlements:Hw(t.entitlements,t.subscriptions,n),allExpirationDatesByProduct:r,allPurchaseDatesByProduct:Ww(e,n),activeSubscriptions:Gw(r),managementURL:t.management_url,requestDate:o,firstSeenDate:new Date(t.first_seen),originalPurchaseDate:Bt(t.original_purchase_date),originalAppUserId:e.subscriber.original_app_user_id,nonSubscriptionTransactions:a,subscriptionsByProductIdentifier:s}}function Qd(e,r){if(r==null)return!1;const t=r.store=="promotional",n=e==null,a=r.unsubscribe_detected_at!=null,o=r.billing_issues_detected_at!=null;return!(t||n||a||o)}function Ww(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 Yw(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 Gw(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 Kw(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 ep="1.27.0",$w="https://api.revenuecat.com",Xw="https://e.revenue.cat";var si;(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"})(si||(si={}));const Zw=/^rcb_[a-zA-Z0-9_.-]+$/,Jw=/^pdl_[a-zA-Z0-9_.-]+$/,Qw=/^test_[a-zA-Z0-9_.-]+$/;function li(e){return e?e.startsWith("rcb_sb_"):!1}function il(e){return e?Zw.test(e):!1}function rp(e){return e?Jw.test(e):!1}function jn(e){return e?Qw.test(e):!1}async function lt(e,r,t){return(await tp(e,r,t)).data}async function tp(e,r,t){const{apiKey:n,body:a,headers:o,httpConfig:s}=r,c=`${(s==null?void 0:s.proxyURL)??$w}${e.urlPath()}`;try{const u=await fetch(c,{method:e.method,headers:dp(n,o,s==null?void 0:s.additionalHeaders),body:rP(a),signal:t});await eP(u,e);const d=u.status;return{data:await u.json(),statusCode:d}}catch(u){throw u instanceof TypeError?new Le($e.NetworkError,sa.getPublicMessage($e.NetworkError),u.message):u}}async function eP(e,r){const t=e.status;if(t>=si.INTERNAL_SERVER_ERROR)sl(r,t,await e.text());else if(t>=si.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 l=sa.convertCodeToBackendErrorCode(o);if(l==null)sl(r,t,a,o);else throw Le.getForBackendError(l,s)}else sl(r,t,a)}}function sl(e,r,t,n){throw new Le($e.UnknownBackendError,"Unknown backend error.",`Request: ${e.name}. Status code: ${r}. Body: ${t}.`,{backendErrorCode:n})}function rP(e){return e==null?null:JSON.stringify(e)}const np="Authorization",ap="Content-Type",op="Accept",ip="X-Platform",sp="X-Version",lp="X-Platform-Flavor",cp="X-Platform-Flavor-Version",up="X-Is-Sandbox",tP=new Set([np,ap,op,ip,sp,up,lp,cp]);function dp(e,r,t){let n={[np]:`Bearer ${e}`,[ap]:"application/json",[op]:"application/json",[ip]:"web",[sp]:ep,[up]:`${li(e)}`};const a=pi.getPlatformInfo();if(a){const o={[lp]:a.flavor,[cp]:a.version};n={...n,...o}}return r&&(n={...n,...r}),t&&(n={...t,...n}),n}const uo="/v1/subscribers",Nn="/rcbilling/v1";class nP{constructor(r){V(this,"appUserId");V(this,"method","GET");V(this,"name","getOfferings");this.appUserId=r}urlPath(){const r=encodeURIComponent(this.appUserId);return`${uo}/${r}/offerings`}}class aP{constructor(r,t,n,a){V(this,"method","GET");V(this,"name","getProducts");V(this,"appUserId");V(this,"productIds");V(this,"currency");V(this,"discountCode");this.appUserId=r,this.productIds=t,this.currency=n,this.discountCode=a}urlPath(){const r=encodeURIComponent(this.appUserId),t=this.productIds.map(encodeURIComponent).join("&id="),n=this.currency?`¤cy=${this.currency}`:"",a=this.discountCode?`&discount_code=${encodeURIComponent(this.discountCode)}`:"";return`${Nn}/subscribers/${r}/products?id=${t}${n}${a}`}}class oP{constructor(r){V(this,"method","GET");V(this,"name","getCustomerInfo");V(this,"appUserId");this.appUserId=r}urlPath(){const r=encodeURIComponent(this.appUserId);return`${uo}/${r}`}}class iP{constructor(){V(this,"method","POST");V(this,"name","identify")}urlPath(){return`${uo}/identify`}}class sP{constructor(){V(this,"method","GET");V(this,"name","getBrandingInfo")}urlPath(){return`${Nn}/branding`}}class lP{constructor(){V(this,"method","POST");V(this,"name","postCheckoutPrepare")}urlPath(){return`${Nn}/checkout/prepare`}}class cP{constructor(){V(this,"method","POST");V(this,"name","postCheckoutStart")}urlPath(){return`${Nn}/checkout/start`}}class uP{constructor(r){V(this,"method","POST");V(this,"name","postCheckoutCalculateTax");V(this,"operationSessionId");this.operationSessionId=r}urlPath(){return`${Nn}/checkout/${this.operationSessionId}/calculate_taxes`}}class dP{constructor(r){V(this,"method","POST");V(this,"name","postCheckoutComplete");V(this,"operationSessionId");this.operationSessionId=r}urlPath(){return`${Nn}/checkout/${this.operationSessionId}/complete`}}class pP{constructor(r){V(this,"method","GET");V(this,"name","getCheckoutStatus");V(this,"operationSessionId");this.operationSessionId=r}urlPath(){return`${Nn}/checkout/${this.operationSessionId}`}}class _P{constructor(r){V(this,"method","POST");V(this,"name","setAttributes");V(this,"appUserId");this.appUserId=r}urlPath(){const r=encodeURIComponent(this.appUserId);return`${uo}/${r}/attributes`}}class gP{constructor(){V(this,"method","POST");V(this,"name","postReceipt")}urlPath(){return"/v1/receipts"}}class fP{constructor(r){V(this,"method","GET");V(this,"name","getVirtualCurrencies");V(this,"appUserId");this.appUserId=r}urlPath(){const r=encodeURIComponent(this.appUserId);return`${uo}/${r}/virtual_currencies`}}const ll={};class mP{constructor(r,t=ll,n){V(this,"API_KEY");V(this,"httpConfig");V(this,"isSandbox");V(this,"purchasesContext");this.API_KEY=r,this.httpConfig=t,this.isSandbox=li(r),this.purchasesContext=n}getIsSandbox(){return this.isSandbox}async getOfferings(r){return await lt(new nP(r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getCustomerInfo(r){return await lt(new oP(r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async identify(r,t){const n={app_user_id:r,new_app_user_id:t},a=await tp(new iP,{apiKey:this.API_KEY,body:n,httpConfig:this.httpConfig}),o=a.statusCode===201;return{...a.data,was_created:o}}async getProducts(r,t,n,a){return await lt(new aP(r,t,n,a),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getBrandingInfo(){return await lt(new sP,{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async postCheckoutPrepare(r,t){const n={product_id:r,price_id:t.priceId};return t.id!=="base_option"&&(n.offer_id=t.id),await lt(new lP,{apiKey:this.API_KEY,body:n,httpConfig:this.httpConfig})}async postCheckoutStart(r,t,n,a,o,s,l=void 0,c){var d,p;const u={app_user_id:r,product_id:t,email:s,price_id:a.priceId,presented_offering_identifier:n.offeringIdentifier,trace_id:o};return l&&(u.metadata=l),a.id!=="base_option"&&(u.offer_id=a.id),n.targetingContext&&(u.applied_targeting_rule={rule_id:n.targetingContext.ruleId,revision:n.targetingContext.revision}),n.placementIdentifier&&(u.presented_placement_identifier=n.placementIdentifier),(p=(d=this.purchasesContext)==null?void 0:d.workflowContext)!=null&&p.workflowIdentifier&&(u.presented_workflow_id=this.purchasesContext.workflowContext.workflowIdentifier),c&&(u.presented_step_id=c),await lt(new cP,{apiKey:this.API_KEY,body:u,httpConfig:this.httpConfig})}async postCheckoutCalculateTax(r,t,n,a){const o={country_code:t,postal_code:n};return await lt(new uP(r),{apiKey:this.API_KEY,body:o,httpConfig:this.httpConfig},a)}async postCheckoutComplete(r,t){const n={email:t};return await lt(new dP(r),{apiKey:this.API_KEY,body:n,httpConfig:this.httpConfig})}async getCheckoutStatus(r){return await lt(new pP(r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async setAttributes(r,t){const n=Date.now(),a={};for(const[s,l]of Object.entries(t))a[s]={value:l,updated_at_ms:n};const o={attributes:a};return await lt(new _P(r),{apiKey:this.API_KEY,body:o,httpConfig:this.httpConfig})}async postReceipt(r,t,n,a,o,s){var u,d;let l=null;o.targetingContext&&(l={rule_id:o.targetingContext.ruleId,revision:o.targetingContext.revision});const c={fetch_token:a,product_id:t,currency:n,app_user_id:r,presented_offering_identifier:o.offeringIdentifier,presented_placement_identifier:o.placementIdentifier,presented_workflow_id:(d=(u=this.purchasesContext)==null?void 0:u.workflowContext)==null?void 0:d.workflowIdentifier,applied_targeting_rule:l,initiation_source:s};return await lt(new gP,{apiKey:this.API_KEY,body:c,httpConfig:this.httpConfig})}async getVirtualCurrencies(r){return await lt(new fP(r),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}}function hP(e){if(!(il(e)||jn(e)||rp(e)))throw new Le($e.InvalidCredentialsError,"Invalid API key. Use your Web Billing API key.")}function cl(e){if(!e||new Set(["no_user","null","none","nil","(null)","NaN","\\x00","","unidentified","undefined","unknown"]).has(e)||e.includes("/"))throw new Le($e.InvalidAppUserIdError,'Provided user id: "'+(e??"[Not provided]")+'" is not valid. See https://www.revenuecat.com/docs/customers/user-ids#tips-for-setting-app-user-ids for more information.')}function yP(e){if(e!=null&&e.endsWith("/"))throw new Le($e.ConfigurationError,"Invalid proxy URL. The proxy URL should not end with a trailing slash.")}function bP(e){if(e){for(const r in e)if(tP.has(r))throw new Le($e.ConfigurationError,"Invalid additional headers. Some headers are reserved for internal use.")}}var ul=(e=>(e.Current="current",e))(ul||{});function pp(e,r){async function t(...n){return await this.preload(),await e.call(this,...n)}return t}const _p=(e,r)=>{const t={...e.webBillingProduct,presentedOfferingContext:{...e.webBillingProduct.presentedOfferingContext,placementIdentifier:r}};return{...e,webBillingProduct:t,rcBillingProduct:t}},On=(e,r)=>e==null?null:_p(e,r),vP=(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 l=n[t]??null;if(l==null)return null;o=r[l],o==null&&(o=r[a])}else o=r[a];if(o==null)return null;const s=Object.fromEntries(Object.entries(o.packagesById).map(([l,c])=>[l,_p(c,t)]));return{...o,packagesById:s,availablePackages:Object.values(s),weekly:On(o.weekly,t),monthly:On(o.monthly,t),twoMonth:On(o.twoMonth,t),threeMonth:On(o.threeMonth,t),sixMonth:On(o.sixMonth,t),annual:On(o.annual,t),lifetime:On(o.lifetime,t)}};function kP(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,l=lv(s,o,t,e.targeting,e.ui_config);l!=null&&(n[o.identifier]=l)});const a=e.current_offering_id?n[e.current_offering_id]??null:null;return Object.keys(n).length==0&&le.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}}const wP=1000001;function PP(e,r,t){const n=t.formatPrice(e.amountMicros,e.currency);return r?r.unit===ue.Year?t.formatPrice(e.amountMicros/Zs/r.number,e.currency):r.unit===ue.Month?t.formatPrice(e.amountMicros/ni/r.number,e.currency):r.unit===ue.Week?t.formatPrice(e.amountMicros/Xs/r.number,e.currency):r.unit===ue.Day?t.formatPrice(e.amountMicros/r.number,e.currency):n:n}function xP(e,r,t){const n=t.formatPrice(e.amountMicros,e.currency);return r?r.unit===ue.Year?t.formatPrice(e.amountMicros/Js/r.number,e.currency):r.unit===ue.Month?t.formatPrice(e.amountMicros/ai/r.number,e.currency):r.unit===ue.Week?t.formatPrice(e.amountMicros/r.number,e.currency):r.unit===ue.Day?t.formatPrice(e.amountMicros*Xs/r.number,e.currency):n:n}function EP(e,r,t){return r?r.unit===ue.Year?t.formatPrice(e.amountMicros/oi,e.currency):r.unit===ue.Month?t.formatPrice(e.amountMicros/r.number,e.currency):r.unit===ue.Week?t.formatPrice(e.amountMicros*ai/r.number,e.currency):r.unit===ue.Day?t.formatPrice(e.amountMicros*ni/r.number,e.currency):t.formatPrice(e.amountMicros/(r.number||1),e.currency):t.formatPrice(e.amountMicros,e.currency)}function SP(e,r,t){const n=t.formatPrice(e.amountMicros,e.currency);return r?r.unit===ue.Year?t.formatPrice(e.amountMicros/r.number,e.currency):r.unit===ue.Month?t.formatPrice(e.amountMicros*oi/r.number,e.currency):r.unit===ue.Week?t.formatPrice(e.amountMicros*Js/r.number,e.currency):r.unit===ue.Day?t.formatPrice(e.amountMicros*Zs/r.number,e.currency):n:n}function gp(e,r,t){return{pricePerDay:PP(e,r,t),pricePerWeek:xP(e,r,t),pricePerMonth:EP(e,r,t),pricePerYear:SP(e,r,t)}}function TP(e,r){const t=new Date;switch(e.unit){case ue.Year:t.setFullYear(t.getFullYear()+e.number);break;case ue.Month:t.setMonth(t.getMonth()+e.number);break;case ue.Week:t.setDate(t.getDate()+e.number*7);break;case ue.Day:t.setDate(t.getDate()+e.number);break}return r.translateDate(t,{dateStyle:"long"})??""}function IP(e,r,t){const n=e.discount??e.trial??e.introPrice,a=e.trial&&!e.discount?e.introPrice:null;if(n===null)return;const{period:o,price:s}=n;if(s!==null){const l=gp(s,o,r);t["product.offer_price"]=r.formatPrice(s.amountMicros,s.currency),t["product.offer_price_per_day"]=l.pricePerDay,t["product.offer_price_per_week"]=l.pricePerWeek,t["product.offer_price_per_month"]=l.pricePerMonth,t["product.offer_price_per_year"]=l.pricePerYear}if(o!==null){const l=el(o,r);t["product.offer_period"]=l.period,t["product.offer_period_abbreviated"]=l.periodAbbreviated,t["product.offer_period_with_unit"]=l.periodWithUnit,t["product.offer_period_in_days"]=l.periodInDays,t["product.offer_period_in_weeks"]=l.periodInWeeks,t["product.offer_period_in_months"]=l.periodInMonths,t["product.offer_period_in_years"]=l.periodInYears,t["product.offer_end_date"]=TP(o,r)}if(a!==null&&(a.price!==null&&(t["product.secondary_offer_price"]=r.formatPrice(a.price.amountMicros,a.price.currency)),a.period!==null)){const l=el(a.period,r);t["product.secondary_offer_period"]=l.period,t["product.secondary_offer_period_abbreviated"]=l.periodAbbreviated}}function DP(e,r,t){var a;const n=((a=e.discount)==null?void 0:a.price)??null;n!==null&&(t["product.offer_price"]=r.formatPrice(n.amountMicros,n.currency))}function fp(e,r={}){var a;if(r.translator)return yp(e,r.translator);const t=((a=e.paywallComponents)==null?void 0:a.default_locale)||Lr,n=new An(r.customTranslations??{},r.selectedLocale??t,r.fallbackLocale??t);return yp(e,n)}function ci(e){var a;const r=e.webBillingProduct.price,t=mp(e),n=e.webBillingProduct.period||((a=t==null?void 0:t.base)==null?void 0:a.period);if(!n||!n.number||n.number<=0)return r.amountMicros;switch(n.unit){case ue.Year:return r.amountMicros/oi;case ue.Month:return r.amountMicros/n.number;case ue.Week:return r.amountMicros*ai/n.number;case ue.Day:return r.amountMicros*ni/n.number;default:return r.amountMicros/(n.number||1)}}function mp(e){return e.webBillingProduct.productType===yt.Subscription?e.webBillingProduct.defaultSubscriptionOption:e.webBillingProduct.productType===yt.NonConsumable||e.webBillingProduct.productType===yt.Consumable?e.webBillingProduct.defaultNonSubscriptionOption:e.webBillingProduct.defaultPurchaseOption}function CP(e,r){return e===yt.Subscription&&r!=null}function AP(e,r){return e!==yt.Subscription&&r!=null}function hp(e,r,t,n=!1){return t.translate(Z.PaywallVariablesPricePerPeriod,{formattedPrice:e,period:r.base.period?r.base.period.number===1?t.translatePeriodUnit(r.base.period.unit,{noWhitespace:!0,short:!n}):t.translatePeriod(r.base.period.number,r.base.period.unit,{noWhitespace:!0,short:!n}):""})}function yp(e,r){const t=e.availablePackages,n=t.reduce((a,o)=>{const s=ci(a),l=ci(o);return s>l?a:o});return t.reduce((a,o)=>(a[o.identifier]=qP(o,n,r),a),{})}function qP(e,r,t){const n=e.webBillingProduct,a=n.price,o=t.formatPrice(a.amountMicros,a.currency),s=mp(e),l=n.productType,c={"product.store_product_name":n.title,"product.price":o,"product.price_per_period":"","product.price_per_period_abbreviated":"","product.price_per_day":"","product.price_per_week":"","product.price_per_month":"","product.price_per_year":"","product.period":"","product.period_abbreviated":"","product.periodly":"","product.period_in_days":"","product.period_in_weeks":"","product.period_in_months":"","product.period_in_years":"","product.period_with_unit":"","product.currency_code":a.currency,"product.currency_symbol":t.formatPrice(0,a.currency).replace("0",""),"product.offer_price":"","product.offer_price_per_day":"","product.offer_price_per_week":"","product.offer_price_per_month":"","product.offer_price_per_year":"","product.offer_period":"","product.offer_period_abbreviated":"","product.offer_period_in_days":"","product.offer_period_in_weeks":"","product.offer_period_in_months":"","product.offer_period_in_years":"","product.offer_period_with_unit":"","product.offer_end_date":"","product.secondary_offer_price":"","product.secondary_offer_period":"","product.secondary_offer_period_abbreviated":"","product.relative_discount":""};if(CP(l,s)){c["product.price_per_period_abbreviated"]=hp(o,s,t),c["product.price_per_period"]=hp(o,s,t,!0);const u=n.period||s.base.period,d=gp(a,u,t);if(c["product.price_per_day"]=d.pricePerDay,c["product.price_per_week"]=d.pricePerWeek,c["product.price_per_month"]=d.pricePerMonth,c["product.price_per_year"]=d.pricePerYear,u){const f=el(u,t);c["product.period"]=f.period,c["product.period_abbreviated"]=f.periodAbbreviated,c["product.period_with_unit"]=f.periodWithUnit,c["product.period_in_days"]=f.periodInDays,c["product.period_in_weeks"]=f.periodInWeeks,c["product.period_in_months"]=f.periodInMonths,c["product.period_in_years"]=f.periodInYears,c["product.periodly"]=t.translatePeriodFrequency(u.number,u.unit)||""}const p=ci(e),_=ci(r),g=(_-p)*100/_;c["product.relative_discount"]=g<1?"":t.translate(Z.PaywallVariablesSubRelativeDiscount,{discount:g.toFixed(0)}),IP(s,t,c)}return AP(l,s)&&(c["product.price"]=o,c["product.price_per_period"]=o,c["product.price_per_period_abbreviated"]=o,c["product.price_per_month"]=o,c["product.period_with_unit"]=t.translate(Z.PeriodsLifetime),c["product.period_in_months"]=t.translate(Z.PeriodsLifetime),c["product.periodly"]=t.translate(Z.PeriodsLifetime),c["product.price_per_week"]="",c["product.relative_discount"]="",c["product.period"]="",c["product.period_abbreviated"]="",DP(s,t,c)),c}var zP=/(%?)(%([sdijo]))/g;function FP(e,r){switch(r){case"s":return e;case"d":case"i":return Number(e);case"j":return JSON.stringify(e);case"o":{if(typeof e=="string")return e;const t=JSON.stringify(e);return t==="{}"||t==="[]"||/^\[object .+?\]$/.test(t)?e:t}}}function dl(e,...r){if(r.length===0)return e;let t=0,n=e.replace(zP,(a,o,s,l)=>{const c=r[t],u=FP(c,l);return o?a:(t++,u)});return t<r.length&&(n+=` ${r.slice(t).join(" ")}`),n=n.replace(/%{2,2}/g,"%"),n}var MP=2;function jP(e){if(!e.stack)return;const r=e.stack.split(`
|
|
375
375
|
`);r.splice(1,MP),e.stack=r.join(`
|
|
376
376
|
`)}var NP=class extends Error{constructor(e,...r){super(e),this.message=e,this.name="Invariant Violation",this.message=dl(e,...r),jP(this)}},bp=(e,r,...t)=>{if(!e)throw new NP(r,...t)};bp.as=(e,r,t,...n)=>{if(!r){const a=n.length===0?t:dl(t,...n);let o;try{o=Reflect.construct(e,[a])}catch{o=e(a)}throw o}};const OP="[MSW]";function pl(e,...r){const t=dl(e,...r);return`${OP} ${t}`}function LP(e,...r){console.warn(pl(e,...r))}function BP(e,...r){console.error(pl(e,...r))}const UP={formatMessage:pl,warn:LP,error:BP};function RP(){bp(typeof URL<"u",UP.formatMessage(`Global "URL" class is not defined. This likely means that you're running MSW in an environment that doesn't support all Node.js standard API (e.g. React Native). If that's the case, please use an appropriate polyfill for the "URL" class, like "react-native-url-polyfill".`))}var vp=(e=>(e.HEAD="HEAD",e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH",e.OPTIONS="OPTIONS",e.DELETE="DELETE",e))(vp||{});RP();class VP{constructor(r,t,n,a){V(this,"initialDelay");V(this,"maxDelay");V(this,"jitterPercent");V(this,"callback");V(this,"currentDelay");V(this,"timeoutId");V(this,"executingCallback",!1);V(this,"stopped",!1);V(this,"currentFlushPromise",null);this.initialDelay=r,this.currentDelay=r,this.maxDelay=t,this.jitterPercent=n,this.callback=a}tryFlush(){if(!this.stopped){if(this.backingOff()){le.debugLog("Backing off, not flushing");return}this.clearTimeout(),this.executeCallbackWithRetries().catch(()=>{})}}start(){this.stopped=!1,this.currentDelay=this.initialDelay}stop(){this.stopped=!0,this.clearTimeout()}flushImmediately(r){return this.clearTimeout(),this.executeCallbackWithRetries(r)}async flushUntilDrain(r){const t=this.currentFlushPromise;if(t)try{await t}catch{}this.stop();try{let n=!1;for(;!n;)n=await this.flushImmediately(r)}finally{this.start()}}schedule(r){if(this.stopped||this.timeoutId!==void 0)return;const t=this.addJitter(r||this.currentDelay);this.timeoutId=setTimeout(()=>{this.timeoutId=void 0,this.executeCallbackWithRetries().catch(()=>{})},t)}backoff(){const r=this.currentDelay,t=Math.min(this.currentDelay*2,this.maxDelay);le.debugLog(`Backing next off to ${r}ms delay`),this.clearTimeout(),this.currentDelay=t,this.schedule(r)}reset(){this.currentDelay!==this.initialDelay&&(this.clearTimeout(),this.currentDelay=this.initialDelay)}async executeCallbackWithRetries(r){if(this.executingCallback)return le.debugLog("Callback already running, rescheduling"),this.schedule(),!0;this.executingCallback=!0;let t;try{t=Promise.resolve(this.callback(r))}catch(n){t=Promise.reject(n)}this.currentFlushPromise=t.then(()=>{},()=>{});try{const n=await t;return this.reset(),n}catch{return this.backoff(),!0}finally{this.executingCallback=!1,this.currentFlushPromise=null}}backingOff(){return this.currentDelay>this.initialDelay}clearTimeout(){clearTimeout(this.timeoutId),this.timeoutId=void 0}addJitter(r){const t=r*this.jitterPercent,n=r-t,a=r+t;return Math.floor(Math.random()*(a-n+1)+n)}}function ui(){if(typeof window<"u")return window;throw new Le($e.UnsupportedError,"window is not available. This SDK requires a browser environment for this operation.")}function di(){if(typeof window<"u")return window}function _l(){if(typeof document<"u")return document;throw new Le($e.UnsupportedError,"document is not available. This SDK requires a browser environment for this operation.")}function HP(){if(typeof document<"u")return document}function WP(e,r){const t=di(),n=t!=null&&t.location?new URLSearchParams(t.location.search):new URLSearchParams;let a=null,o=null;typeof screen<"u"&&screen&&(a=screen.width,o=screen.height);const s=HP(),l=(s==null?void 0:s.referrer)??null,c=(s==null?void 0:s.title)??null;return{libraryName:"purchases-js",libraryVersion:ep,locale:navigator.language,userAgent:navigator.userAgent,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,screenWidth:a,screenHeight:o,utmSource:n.get("utm_source")??null,utmMedium:n.get("utm_medium")??null,utmCampaign:n.get("utm_campaign")??null,utmContent:n.get("utm_content")??null,utmTerm:n.get("utm_term")??null,pageReferrer:l,pageUrl:t!=null&&t.location?`${t.location.origin}${t.location.pathname}`:"",pageTitle:c,source:e,rcSource:r}}const YP=2e3,GP=5*6e4,KP=.1,kp=50*1024;class $P{constructor(r){V(this,"apiKey");V(this,"eventsQueue",[]);V(this,"eventsUrl");V(this,"flushManager");V(this,"traceId");V(this,"appUserId");V(this,"isSilent");V(this,"rcSource");V(this,"workflowContext");V(this,"isDisposed",!1);var t;this.apiKey=r.apiKey,this.eventsUrl=`${((t=r.httpConfig)==null?void 0:t.eventsURL)??Xw}/v1/events`,this.appUserId=r.appUserId,this.isSilent=r.silent||!1,this.rcSource=r.rcSource,this.workflowContext=r.workflowContext,this.traceId=r.trace_id||eo(),this.flushManager=new VP(YP,GP,KP,this.doFlush.bind(this))}async updateUser(r){this.appUserId=r}getTraceId(){return this.traceId}trackSDKEvent(r){this.trackEvent({...r,source:"sdk"})}trackExternalEvent(r){this.trackEvent({...r})}trackEvent(r){var t;if(this.isSilent){le.verboseLog("Skipping event tracking, the EventsTracker is silent");return}try{const n=new Vy({eventName:r.eventName,traceId:this.traceId,appUserId:this.appUserId,context:WP(r.source,this.rcSource),workflowIdentifier:(t=this.workflowContext)==null?void 0:t.workflowIdentifier,properties:r.properties||{mode:zr}});this.eventsQueue.push(n),this.flushManager.tryFlush()}catch(n){le.errorLog(`Error while tracking event ${r.eventName}: ${n}`)}}dispose(){this.isDisposed||(this.flushManager.stop(),this.eventsQueue.length>0&&this.flushManager.flushUntilDrain({ignoreDisposed:!0}).catch(r=>{le.debugLog(`Failed to flush events on dispose: ${r}`)}),this.isDisposed=!0)}async flushAllEvents(){this.isDisposed||(await this.flushManager.flushUntilDrain(),!this.isDisposed&&this.eventsQueue.length>0&&this.flushManager.schedule())}estimateSingleEventSize(r){try{return JSON.stringify(r).length}catch{return kp}}batchEventsForKeepalive(){const r=[];let t=16;for(const n of this.eventsQueue){const a=this.estimateSingleEventSize(n),o=r.length>0?1:0,s=t+a+o;if(s<=kp)r.push(n),t=s;else{if(r.length===0)return le.warnLog(`Event exceeds keepalive size limit (${a} bytes): ${n.data.eventName}`),this.eventsQueue.shift(),null;break}}return r}doFlush(r){if(!(r!=null&&r.ignoreDisposed)&&this.isDisposed||this.eventsQueue.length===0)return Promise.resolve(!0);const t=this.batchEventsForKeepalive();return t?fetch(this.eventsUrl,{method:vp.POST,headers:dp(this.apiKey),body:JSON.stringify({events:t}),keepalive:!0}).then(n=>{if(n.status===200||n.status===201)return this.eventsQueue.splice(0,t.length),this.eventsQueue.length>0&&this.flushManager.schedule(),this.eventsQueue.length===0;throw le.debugLog("Events failed to flush due to server error"),new Error("Events failed to flush due to server error")}).catch(n=>{throw le.debugLog("Error while flushing events"),n}):Promise.resolve(this.eventsQueue.length===0)}}const gl=()=>{const e=di(),r=e!=null&&e.location?new URLSearchParams(e.location.search):new URLSearchParams,t=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],n={};return t.forEach(a=>{const o=r.get(a);o!==null&&(n[a]=o)}),n},XP=["app","embedded"],fl={autoCollectUTMAsMetadata:!0,collectAnalyticsEvents:!0};var ZP=B('<p class="svelte-17914yi"><strong>Free Trial:</strong> </p>'),JP=B('<p class="svelte-17914yi"><strong>Intro Price:</strong> </p>'),QP=B('<p class="svelte-17914yi"><strong>Discount Price:</strong> </p>'),e1=B('<div class="rc-simulated-store-modal-overlay svelte-17914yi"><div class="rc-simulated-store-modal svelte-17914yi"><div class="rc-simulated-store-modal-content svelte-17914yi"><h2 class="rc-simulated-store-modal-title svelte-17914yi">Test Store Purchase</h2> <div class="rc-simulated-store-modal-details svelte-17914yi"><div><p class="svelte-17914yi"><strong>Product:</strong> </p> <p class="svelte-17914yi"><strong>Type:</strong> </p> <p class="svelte-17914yi"><strong>Price:</strong> </p> <!> <!> <!></div></div> <div class="rc-simulated-store-modal-buttons svelte-17914yi"><button type="button" class="rc-simulated-store-modal-button rc-simulated-store-modal-button-primary svelte-17914yi">Test valid purchase</button> <button type="button" class="rc-simulated-store-modal-button rc-simulated-store-modal-button-secondary svelte-17914yi">Test failed purchase</button> <button type="button" class="rc-simulated-store-modal-button rc-simulated-store-modal-button-cancel svelte-17914yi">Cancel</button></div></div></div></div>');const r1={hash:"svelte-17914yi",code:`.rc-simulated-store-modal-overlay.svelte-17914yi {position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0, 0, 0, 0.5);display:flex;justify-content:center;align-items:center;
|
|
377
377
|
/** One more than the paywall */z-index:1000002;}.rc-simulated-store-modal.svelte-17914yi {background:white;border-radius:8px;padding:0;max-width:500px;width:90%;max-height:90%;overflow-y:auto;box-shadow:0 4px 20px rgba(0, 0, 0, 0.15);}.rc-simulated-store-modal-content.svelte-17914yi {padding:24px;}.rc-simulated-store-modal-title.svelte-17914yi {margin:0 0 20px 0;font-size:24px;font-weight:600;color:#333;}.rc-simulated-store-modal-details.svelte-17914yi {margin-bottom:24px;}.rc-simulated-store-modal-details.svelte-17914yi p:where(.svelte-17914yi) {margin:8px 0;color:#666;line-height:1.5;}.rc-simulated-store-modal-buttons.svelte-17914yi {display:flex;flex-direction:column;gap:12px;}.rc-simulated-store-modal-button.svelte-17914yi {padding:12px 24px;border:none;border-radius:6px;font-size:16px;font-weight:500;cursor:pointer;transition:background-color 0.2s ease;}.rc-simulated-store-modal-button-primary.svelte-17914yi {background-color:#007aff;color:white;}.rc-simulated-store-modal-button-primary.svelte-17914yi:hover {background-color:#0056cc;}.rc-simulated-store-modal-button-secondary.svelte-17914yi {background-color:#ff3b30;color:white;}.rc-simulated-store-modal-button-secondary.svelte-17914yi:hover {background-color:#cc2e24;}.rc-simulated-store-modal-button-cancel.svelte-17914yi {background-color:#f2f2f7;color:#333;}.rc-simulated-store-modal-button-cancel.svelte-17914yi:hover {background-color:#e5e5ea;}
|