1 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6ba92946-4159-5b0d-a9f2-b491d72e76e0")}catch(e){}}(); 3import{o as e}from"./rolldown-runtime-CMxvf4Kt.js";import{Ca as t,Ft as n,Ji as r,Ta as i,Zi as a,ci as o,zr as s,zt as c}from"./frosted-ui-IuunJNEA.js";import{a as l}from"./react-BBpLUrWf.js";import{n as u,t as d}from"./react-client-D5SPP8rz.js";import{t as f}from"./ChevronDown12-iDXFt0Tp.js";import{t as p}from"./XMark12-CPhGvjyY.js";import{t as m}from"./cn-CIC46yv0.js";import{t as h}from"./proxy-BIsypWPM.js";import{t as ee}from"./AnimatePresence-PPyKX-5K.js";import{t as g}from"./use-reduced-motion-Ceq-MfXd.js";import{b as _}from"./Client-B_pmEYgI.js";import{T as v,_ as y,d as b,i as te,r as x,s as S,u as C,y as w}from"./builder-Co1ciMTd.js";import{C as ne,D as re,E as T,F as ie,I as E,L as D,M as ae,N as oe,O as se,P as ce,S as O,T as k,_ as le,a as ue,b as de,c as fe,d as pe,f as me,g as he,h as ge,i as A,j as _e,k as ve,m as ye,n as be,o as xe,p as Se,r as j,s as Ce,t as M,v as N,w as we,x as P,y as Te}from"./controller-DltsyOJx.js";import{t as Ee}from"./animated-submit-button-R6kK9JVX.js";import{n as De,r as F,s as I,t as L}from"./money-tMbdBxC6.js";import{_ as R,a as Oe,c as ke,g as z,i as B,l as V,n as Ae,o as H,r as U,s as W,t as G,y as je}from"./next-action-Dxoof7Yc.js";import{n as Me,t as Ne}from"./terms-CW_WDBa8.js";import{a as Pe,h as K,i as Fe,l as q}from"./complete-payment-flow-Cld_TBNN.js";import{a as Ie,c as J,d as Le,f as Re,i as ze,l as Be,n as Ve,o as He,p as Ue,r as Y,s as We,t as Ge,u as Ke}from"./session-api-Bv5VyMBp.js";import{n as qe,t as Je}from"./affiliate-code-candidates-2YrcPx03.js";var X=e(i()),Z=t(),Ye=class extends Error{code=`CHECKOUT_UNAVAILABLE`;constructor(e){super(`[CHECKOUT_UNAVAILABLE] ${e}`),this.name=`CheckoutUnavailableError`}};function Xe(e){let t=e?.statusCode;return t===404||t===409}function Ze(e){return e.exception?.values?.some(e=>e.type===`CheckoutUnavailableError`)??!1}var Qe=({color:e=`currentColor`,...t})=>X.createElement(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"data-fui-icon":`Tag12`,...t},X.createElement(`path`,{d:`M9.746 0c1.242 0 2.25 1.008 2.25 2.25v3c0 .795-.317 1.559-.88 2.121l-3.824 3.823c-1.074 1.074-2.815 1.074-3.889 0L.805 8.596c-1.073-1.074-1.074-2.815 0-3.888l3.83-3.83C5.197.317 5.96 0 6.755 0h2.99zm-2.99 1.5c-.398 0-.78.158-1.06.44l-3.83 3.828c-.488.488-.488 1.28 0 1.768l2.598 2.598c.488.488 1.28.488 1.767 0l3.825-3.824c.281-.281.44-.663.44-1.06v-3c0-.414-.337-.75-.75-.75h-2.99zM7.5 3C8.329 3 9 3.673 9 4.5 9 5.33 8.329 6 7.5 6 6.672 6 6 5.33 6 4.5 6 3.673 6.672 3 7.5 3z`,fill:e}));Qe.category=`Interface General`;var $e={InvalidNumber:`invalid_number`,CountryNotSupported:`country_not_supported`,VoipNotSupported:`voip_not_supported`,SendThrottled:`send_throttled`,SendFailed:`send_failed`,InvalidCode:`invalid_code`,CodeExpired:`code_expired`,PhoneNumberMissing:`phone_number_missing`,SessionNotOpen:`session_not_open`,SmsNotSupported:`sms_not_supported`,SendBlocked:`send_blocked`,Unsubscribed:`unsubscribed`,RateLimited:`rate_limited`};function et({button:e}){return(0,Z.jsx)(`span`,{"data-submit-button":``,"aria-hidden":`true`,style:{"--submit-button-light-color":e.light.color,"--submit-button-light-image":`url("${e.light.image}")`,"--submit-button-dark-color":e.dark.color,"--submit-button-dark-image":`url("${e.dark.image}")`},className:`h-[55px] w-full bg-[color:var(--submit-button-light-color)] bg-[image:var(--submit-button-light-image)] bg-[length:auto_100%] bg-center bg-no-repeat [.dark_&]:bg-[color:var(--submit-button-dark-color)] [.dark_&]:bg-[image:var(--submit-button-dark-image)] [.light_&]:!bg-[color:var(--submit-button-light-color)] [.light_&]:!bg-[image:var(--submit-button-light-image)] [.light_.dark_&]:!bg-[color:var(--submit-button-dark-color)] [.light_.dark_&]:!bg-[image:var(--submit-button-dark-image)]`})}var tt=nt(`[data-checkout-preview] [data-checkout-preview-surface]`);function nt(e){let t=e=>`color-mix(in srgb, var(--checkout-background-text-color) ${e}%, transparent)`,n=e=>`color-mix(in srgb, var(--checkout-background-text-color) ${e}%, var(--checkout-background-color))`;return` 4 ${e} { 5 background-color: var(--checkout-background-color); 6 color: var(--checkout-background-text-color); 7 --color-background: var(--checkout-background-color); 8 --color-panel-solid: var(--checkout-background-color); 9 --color-surface: ${t(3)}; 10 --color-stroke: ${t(11)}; 11 --gray-1: var(--checkout-background-color); 12 --gray-2: ${n(3)}; 13 --gray-3: ${n(6)}; 14 --gray-4: ${n(11)}; 15 --gray-5: ${n(14)}; 16 --gray-6: ${n(17)}; 17 --gray-7: ${n(21)}; 18 --gray-8: ${n(24)}; 19 --gray-9: ${t(45)}; 20 --gray-10: ${t(50)}; 21 --gray-11: ${t(70)}; 22 --gray-12: var(--checkout-background-text-color); 23 --gray-a3: ${t(7)}; 24 --gray-a4: ${t(9)}; 25 --gray-a5: ${t(11)}; 26 --gray-a6: ${t(13)}; 27 --gray-a7: ${t(18)}; 28 --gray-a8: ${t(22)}; 29 --gray-a9: ${t(45)}; 30 --gray-a10: ${t(50)}; 31 --gray-a11: ${t(70)}; 32 --gray-a12: var(--checkout-background-text-color); 33 --color-gray-1: var(--gray-1); 34 --color-gray-2: var(--gray-2); 35 --color-gray-3: var(--gray-3); 36 --color-gray-4: var(--gray-4); 37 --color-gray-5: var(--gray-5); 38 --color-gray-6: var(--gray-6); 39 --color-gray-7: var(--gray-7); 40 --color-gray-8: var(--gray-8); 41 --color-gray-9: var(--gray-9); 42 --color-gray-10: var(--gray-10); 43 --color-gray-11: var(--gray-11); 44 --color-gray-12: var(--gray-12); 45 --color-gray-a3: var(--gray-a3); 46 --color-gray-a4: var(--gray-a4); 47 --color-gray-a5: var(--gray-a5); 48 --color-gray-a6: var(--gray-a6); 49 --color-gray-a7: var(--gray-a7); 50 --color-gray-a8: var(--gray-a8);
51 --color-gray-a9: var(--gray-a9); 52 --color-gray-a10: var(--gray-a10); 53 --color-gray-a11: var(--gray-a11); 54 --color-gray-a12: var(--gray-a12); 55 } 56 `}var rt={pill:{"--radius-factor":`2.4`,"--radius-1":`6px`,"--radius-2":`8px`,"--radius-3":`12px`,"--radius-4":`16px`,"--radius-5":`20px`,"--radius-6":`24px`,"--radius-sm":`8px`,"--radius-md":`12px`,"--radius-lg":`16px`,"--radius-xl":`20px`,"--radius-2xl":`24px`},rounded:{},rectangular:{"--radius-factor":`0.15`,"--radius-thumb":`2px`,"--radius-1":`1px`,"--radius-2":`2px`,"--radius-3":`2px`,"--radius-4":`2px`,"--radius-5":`3px`,"--radius-6":`4px`,"--radius-sm":`2px`,"--radius-md":`2px`,"--radius-lg":`2px`,"--radius-xl":`3px`,"--radius-2xl":`4px`}};function it(e){return typeof e==`string`&&/^#[0-9a-fA-F]{6}$/.test(e)}function at(e){if(!e)return;let t=it(e.background_color)?e.background_color:null,n=it(e.button_color)?e.button_color:null,r={...e.border_style?rt[e.border_style]??{}:{}};t&&(r[`--checkout-background-color`]=t,e.background_text_color&&(r[`--checkout-background-text-color`]=e.background_text_color)),n&&(r[`--accent-9`]=n,r[`--accent-10`]=n,r[`--color-accent-9`]=n,r[`--color-accent-10`]=n,e.button_text_color&&(r[`--accent-9-contrast`]=e.button_text_color,r[`--color-accent-9-contrast`]=e.button_text_color)),e.resolved_font_family&&(r[`font-family`]=e.resolved_font_family);let i=e.font_url??null;if(!(Object.keys(r).length===0&&!i))return{vars:r,fontUrl:i,recolored:!!t}}var ot=`data-checkout-branded`;function st(){return nt(`[${ot}]`)}var ct;function lt(){return ct===void 0?{runtime:`direct`,build:`3f2efcc2d3fdc72da40e1b538645a2d4d26805f4`}:{runtime:`iframe`,build:ct}}var ut=36e5,dt=1e3,ft=class{now;startedAt;lastVisibilityAt;visible=!0;visibleMs=0;hiddenMs=0;submitCount=0;fields={};focusedSince=new Map;firstChangeAt=new Map;constructor(e=()=>performance.now()){this.now=e,this.startedAt=e(),this.lastVisibilityAt=this.startedAt}setVisible(e){let t=this.now(),n=Math.max(0,t-this.lastVisibilityAt);this.visible?this.visibleMs=Math.min(ut,this.visibleMs+n):this.hiddenMs=Math.min(ut,this.hiddenMs+n);for(let e of this.focusedSince.keys())this.accumulateFocus(e,t);this.lastVisibilityAt=t,this.visible=e}record(e,t){let n=this.now(),r=this.fields[e]??={},i=`${t}_count`,a=`first_${t}_ms`;if(r[i]=Math.min(dt,(r[i]??0)+1),r[a]??=this.elapsed(n),t===`focus`&&!this.focusedSince.has(e))r.focused_visible_ms??=0,r.revisit_count=Math.min(dt,(r.revisit_count??-1)+1),this.focusedSince.set(e,n);else if(t===`blur`)this.endFocus(e);else if(t===`change`){let t=this.firstChangeAt.get(e)??n;this.firstChangeAt.set(e,t),r.last_change_ms=this.elapsed(n),r.edit_span_ms=Math.min(ut,Math.max(0,Math.round(n-t)))}}setFieldState(e,t){this.fields[e]={...this.fields[e],...t}}endFocus(e){this.accumulateFocus(e,this.now()),this.focusedSince.delete(e)}submission(){return this.submitCount=Math.min(dt,this.submitCount+1),this.setVisible(this.visible),{elapsed_ms:this.elapsed(),visible_ms:Math.round(this.visibleMs),hidden_ms:Math.round(this.hiddenMs),submit_count:this.submitCount,fields:Object.fromEntries(Object.entries(this.fields).map(([e,t])=>[e,{...t,...t.focused_visible_ms===void 0?{}:{focused_visible_ms:Math.round(t.focused_visible_ms)}}]))}}accumulateFocus(e,t){let n=this.focusedSince.get(e),r=this.fields[e];n===void 0||!r||(this.visible&&(r.focused_visible_ms=Math.min(ut,(r.focused_visible_ms??0)+Math.max(0,t-n))),this.focusedSince.set(e,t))}elapsed(e=this.now()){return Math.min(ut,Math.max(0,Math.round(e-this.startedAt)))}},pt=class{behavior;root=null;observer;prefilled=!1;edited=!1;failed=!1;attachCount=0;constructor(e){this.behavior=new ft(e)}visibility=()=>this.behavior.setVisible(document.visibilityState===`visible`);record=e=>{let t=e.target;if(!(!(t instanceof HTMLInputElement)||t.type!==`email`))switch(e.type){case`focusin`:this.behavior.record(`email`,`focus`);break;case`focusout`:this.behavior.record(`email`,`blur`),t.value&&this.behavior.record(`email`,t.validity.valid?`complete`:`invalid`);break;case`input`:this.edited=!0,this.behavior.record(`email`,`change`);break;case`paste`:this.behavior.record(`email`,`paste`);break;case`invalid`:this.behavior.record(`email`,`invalid`);break}};events=[`focusin`,`focusout`,`input`,`paste`,`invalid`];inspectEmail=()=>{let e=this.root?.querySelector(`input[type="email"]`);return!this.edited&&e?.value&&(this.prefilled=!0),(!e||e.disabled||e.readOnly)&&this.behavior.endFocus(`email`),e};attach=e=>{if(this.detach(),this.root=e,e)try{this.visibility(),this.inspectEmail();for(let t of this.events)e.addEventListener(t,this.record,!0);document.addEventListener(`visibilitychange`,this.visibility),this.observer=new MutationObserver(this.inspectEmail),this.observer.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`disabled`,`readonly`,`value`]}),this.attachCount=Math.min(this.attachCount+1,1e3)}catch{this.failed=!0,this.detach()}};detach=()=>{for(let e of this.events)this.root?.removeEventListener(e,this.record,!0);typeof document<`u`&&document.removeEventListener(`visibilitychange`,this.visibility),this.observer?.disconnect(),this.behavior.endFocus(`email`),this.root=null};capture(){try{if(!this.failed)return this.snapshot()}catch{this.failed=!0}return{version:1,source:`elements_checkout`,status:`collection_error`,collector:this.diagnostics()}}diagnostics(){return{revision:1,attached:!!this.root,attach_count:this.attachCount,...lt()}}
56snapshot(){let e=this.inspectEmail(),t=this.behavior.submission();return{...t,version:1,source:`elements_checkout`,collector:this.diagnostics(),fields:{email:{...t.fields.email,rendered:!!e,editable:!!(e&&!e.disabled&&!e.readOnly),prefilled:this.prefilled}},sardine:v()}}},mt=`ticked`,ht=[`name`,`line1`,`line2`,`city`,`state`,`postal_code`,`country`];function gt(e){if(typeof e!=`object`||!e)return``;let t={};for(let n of ht){let r=e[n];typeof r==`string`&&r.trim()!==``&&(t[n]=r)}return t.name?JSON.stringify(t):``}function _t(e){if(e.trim()===``)return null;try{let t=gt(JSON.parse(e));return t===``?null:JSON.parse(t)}catch{return null}}var vt=`text`,yt=new Set([`custom_password`,`email`,`terms`,`custom_fields`,`shipping_address`,`phone_number`]);function bt(e){if(!Array.isArray(e))return[];let t=[],n=new Set,r=0;for(let i of e){if(typeof i!=`object`||!i)continue;let e=i;if(typeof e.type!=`string`||!yt.has(e.type))continue;let a=e.type;if(a!==`custom_fields`){if(n.has(a))continue;n.add(a),t.push({key:a,type:a,holdsSale:a!==`phone_number`,verify:e.verify===!0||void 0});continue}for(let i of Array.isArray(e.fields)?e.fields:[]){let e=xt(i);if(!e)continue;let o=`custom_fields:${e.id}`;if(!n.has(o)){if(r>=20)break;r+=1,n.add(o),t.push({key:o,type:a,holdsSale:e.required,field:e})}}}return t}function xt(e){if(typeof e!=`object`||!e)return null;let t=e;return typeof t.id!=`string`||t.id===``||typeof t.name!=`string`||t.name.trim()===``||t.field_type!==vt?null:{id:t.id,name:t.name,description:typeof t.description==`string`&&t.description!==``?t.description:null,placeholder:typeof t.placeholder==`string`&&t.placeholder!==``?t.placeholder:null,field_type:t.field_type,required:t.required!==!1}}function St(e){return yt.has(e.type)}function Ct(e,t){return e.filter(e=>e.holdsSale?!St(e)||e.type===`custom_password`?!0:(t[e.key]??``).trim()===``:!1)}function wt(e){return e.filter(e=>e.holdsSale&&!St(e))}function Tt(e,t){let n=new Map((t.custom_field_responses??[]).map(e=>[e.id,e.value])),r={};for(let i of e){let e=i.type===`email`?t.buyer_email:i.type===`phone_number`?t.phone_number:i.type===`shipping_address`?gt(t.shipping_address):i.field?n.get(i.field.id):void 0;typeof e==`string`&&e!==``&&(r[i.key]=e)}return r}function Et(e,t){let n=[],r={},i=!1;for(let a of e){if(!St(a))continue;if(a.type===`phone_number`){if(a.verify)continue;r.phone_number=(t[a.key]??``).trim()||null;continue}if(a.type===`shipping_address`){r.shipping_address=_t(t[a.key]??``);continue}if(!a.field)continue;i=!0;let e=(t[a.key]??``).trim();e!==``&&n.push({id:a.field.id,value:e})}return i&&(r.custom_field_responses=n),r}function Dt(e){return e.some(e=>St(e)&&(e.field!==void 0||e.type===`phone_number`&&!e.verify||e.type===`shipping_address`))}function Ot(e,t){let n=e.find(e=>e.type===`terms`);return n?(t[n.key]??``)!==``:!0}function kt(e,t){let n=e.find(e=>e.type===`email`);if(n)return(t[n.key]??``).trim()||void 0}var At=e=>e===`email`||e===`shipping_address`||e===`phone_number`,jt=2500,Mt=[`apple_pay`,`google_pay`],Nt={auto:`flex flex-col gap-3 @5xl:flex-row @5xl:gap-2`,horizontal:`flex flex-row gap-2`,vertical:`flex flex-col gap-3`};function Pt({origins:e,handoff:t,accountId:n,currency:r,total:i,offerAmounts:o,setupFutureUsage:s,requirements:c,paymentMethodRequired:d,paymentMethodConfiguration:f,brandingPreview:p,nextActionBlocks:h,ctaLabel:ee,mode:g,transfer:_,confirming:v,promoPending:y,currencyPending:b,phoneCodePending:te,showPromoInput:S,promoCode:C,promo:w,activeWallet:T=null,submissionButtonState:ie,isSubmissionEnabled:E=!0,previewWallets:D,wallets:oe=Mt,layout:se=`auto`,sessionRef:ce,minting:ue,onMintingChange:fe,onSubmissionStarted:pe,onPaymentFailed:me,onPaymentCanceled:A,onSubmissionAnimationComplete:_e,onOfferedWalletsChange:ve,showDivider:ye=!0,refusePay:be,values:xe,onValue:Se,onConfirmationToken:j,onIncomplete:Ce,standalone:M}){let N=u(),P=l(),Te=ae(),Ee=(0,X.useId)(),F=(0,X.useRef)({}),L=(0,X.useRef)(!1),R=(0,X.useRef)(void 0),Oe=(0,X.useRef)(!1),[ke,z]=(0,X.useState)({}),[B,V]=(0,X.useState)(),Ae=d!==!1&&!p&&!h&&ee!==`join_waitlist`&&g!==`setup`&&_==null&&c.every(e=>At(e.type)),H=c.some(e=>e.type===`shipping_address`),U=c.some(e=>e.type===`phone_number`),W=S&&ce!==void 0,G=w?.promo_type===`percentage`?N(`wC04pZ`,{amount:w.amount_off*100}):w?.promo_type===`flat_amount`&&w.currency?N(`+Fpuds`,{amount:De(w.amount_off,w.currency,P)}):void 0,Me=Mt.filter(e=>oe.includes(e)&&ge(e,f)),Ne=Me.join(`|`),Pe=I(Number(i.amount),i.currency),K=Pe===0?{feeInclusive:0,feeFree:0}:o??{feeInclusive:Pe,feeFree:Pe},Fe=`${r}|${K.feeInclusive}|${K.feeFree}|${s??``}`;(0,X.useEffect)(()=>
56{if(!Ae||D)return;let i=Me.map(i=>{let a=ne({origins:e,handoff:t,accountId:n,currency:r,setupFutureUsage:s,owner:`${Ee}:${i}`,type:i,requestShipping:H,requestPayerPhone:U,...W?{promo:{applied:C??void 0,appliedDescription:G}}:{},amounts:{feeInclusive:K.feeInclusive,feeFree:K.feeFree},onStatus:(e,t)=>{F.current[i]?.key===a&&z(n=>({...n,[i]:{available:e===`ready`,supportsBuyerFee:t.supportsBuyerFee,submitButton:t.submitButton}}))}});return F.current[i]={key:a,chargeIdentity:Fe},a}),a=Oe.current?void 0:setTimeout(()=>{Oe.current=!0,z(e=>({...e}))},jt);return()=>{a!==void 0&&clearTimeout(a);for(let e of i)re(e);for(let e of Me)i.includes(F.current[e]?.key??``)&&delete F.current[e]}},[Ae,D,Ne,Ee,n,r,s,H,U,W,C,G,K.feeInclusive,K.feeFree,e,t]);let q=D?{...D.apple_pay?{apple_pay:{available:!0,...D.apple_pay}}:{},...D.google_pay?{google_pay:{available:!0,...D.google_pay}}:{}}:ke,Ie=D!==void 0||Me.every(e=>q[e]!==void 0),J=O().filter(e=>Me.includes(e)&&q[e]?.available&&q[e]?.submitButton),Le=Ae&&(Ie||Oe.current),Re=Le&&J.includes(`apple_pay`),ze=Le&&J.includes(`google_pay`);if((0,X.useLayoutEffect)(()=>{let e=[];Re&&e.push(`apple_pay`),ze&&e.push(`google_pay`),ve?.(e)},[Re,ze,ve]),!Ae)return null;if(!(Ie||Oe.current))return M?(0,Z.jsx)(Z.Fragment,{children:M.pending}):null;if(J.length===0)return null;let Be=!E||ue||v||y||b||te,Ve=e=>{if(L.current||Be)return;let t=F.current[e],n=q[e];if(!t||!n?.available||!n.submitButton)return;let i=e===`apple_pay`?`Apple Pay`:`Google Pay`,a=Ct(c.filter(e=>!At(e.type)),xe);if(a.length>0){Ce(a.map(e=>e.key));return}if(be?.())return;if(t.chargeIdentity!==Fe){V(N(`lS/77U`,{wallet:i}));return}let o=k(t.key);if(o!==`ready`){V(N(o===`failed`?`BdHWeL`:`9EYxiY`,{wallet:i}));return}let s=we(t.key);if(!s)return;V(void 0),L.current=!0,R.current=void 0;let l=ce?he(s,ce,{supportsBuyerFee:n.supportsBuyerFee,currency:r,...W?{promo:{onCodeApplied:e=>{R.current=e},describeApplied:e=>e?N(`+Fpuds`,{amount:De(Math.abs(Number(e.amount)),e.currency,P)}):N(`SJt4EZ`),failureMessage:N(`U6tJsW`)}}:{}}):void 0,u=kt(c,xe)?.trim(),d=u?.includes(`@`)?{email:u}:void 0;de();let f=s.show(e,d);le(),pe?.(e),fe(!0),f.then(t=>{let n={...xe},r=c.find(e=>e.type===`email`),i=t.payer.email;r&&i&&(n[r.key]=i,Se(r.key,i));let a=c.find(e=>e.type===`shipping_address`),o=t.shipping?.address;if(a&&o){let e=gt({name:o.recipient,line1:o.line1,line2:o.line2,city:o.city,state:o.state,postal_code:o.postal_code,country:o.country});e&&(n[a.key]=e,Se(a.key,e))}let s=c.find(e=>e.type===`phone_number`),l=t.payer.phone?.trim()||void 0,u;s&&l&&(s.verify?u=l:(n[s.key]=l,Se(s.key,l))),j(t.ctok,n,e,R.current,u)}).catch(t=>{if(t instanceof Error&&t.message===`payment_request_cancelled`)A?.();else{let n=je(t);V(n?.message??(t instanceof Error?t.message:N(`oEtik0`))),ce&&Te.emit({type:`error`,sessionId:ce.id,stage:`confirmation_token`,errorCode:n?.code??`confirmation_token_failed`,errorMessage:`A payment confirmation token could not be created.`,failureStage:n?.failureStage,paymentMethodType:e}),me?.()}fe(!1)}).finally(()=>{L.current=!1,l?.()})};return(0,Z.jsxs)(`div`,{className:m(`flex flex-col gap-4 px-1`,M&&`@container`,x(`CheckoutExpress`,`The express checkout row â one-press wallet payments above the form`)),children:[(0,Z.jsx)(`div`,{className:m(Nt[se],x(`CheckoutExpressButtons`,`The wallet button stack â vertical in a narrow container, side by side in a wide one`)),children:J.map(e=>{let t=q[e]?.submitButton;if(!t)return null;let n=e===T&&ie?ie:T||Be?`disabled`:`ready`,r=n===`disabled`&&(!E||T!==null&&e!==T),i=n===`loading`?N(`CRl9hx`):n===`success`?N(`iZ/Q2q`):n===`error`?N(`qV+TFm`):void 0;return(0,Z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Z.jsx)(It,{art:t,buttonState:n,preservesReadyAppearance:r,onAnimationComplete:e===T?_e:void 0,onClick:()=>Ve(e),statusText:i,wallet:e})},e)})}),B&&T===null&&(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`1`,className:m(`text-red-11 px-1`,x(`CheckoutExpressError`,`The retryable error line under the express button`)),children:B}),!M&&ye?(0,Z.jsxs)(`div`,{className:m(`flex items-center gap-3`,x(`CheckoutExpressDivider`,`The divider between express checkout and the form`)),children:[(0,Z.jsx)(`span`,{className:`bg-gray-a5 h-px flex-1`}),(0,Z.jsx)(a,{size:`1`,className:`text-gray-a10`,children:N(`lMtEw3`)}),(0,Z.jsx)(`span`,{className:`bg-gray-a5 h-px flex-1`})]}):null]})}var Ft=`m-0 box-border h-[55px] min-h-[55px] w-full appearance-none overflow-hidden rounded-lg border-0 p-0`;function It({wallet:e,onClick:t,art:n,buttonState:r,preservesReadyAppearance:i,statusText:a,onAnimationComplete:o}){return(0,Z.jsx)(Ee,{type:`button`,"aria-label":u()(`NCAmTB`,{wallet:e===`apple_pay`?`Apple Pay`:`Google Pay`}),buttonState:r,color:`gray`,highContrast:r===`ready`||i,isColorPreserved:i,onAnimationComplete:o,onClick:t,size:`3`,statusText:a,variant:`solid`,className:m(Ft,(r===`ready`||i)&&`bg-black [.dark_&]:bg-white`,e===`apple_pay`?x(`CheckoutExpressApplePay`,`The Apple Pay express button`):x(`CheckoutExpressGooglePay`,`The Google Pay express button`)),children:(0,Z.jsx)(et,{button:n})})}function Lt(){let e=u();return t=>{switch(t){case`invalid_number`:return e(`tYnM+9`);case`country_not_supported`:return e(`xPPy4X`);case`voip_not_supported`:return e(`cEK9M8`);case`sms_not_supported`:return e(`2LIGmR`);case`send_blocked`:return e(`oqNLaC`);case`unsubscribed`:return e(`ZDlELK`);case`send_throttled`:return e(`hSgrqG`);case`rate_limited`:return e(`9hd+QP`);case`send_failed`:return e(`q9cqIn`);case`invalid_code`:return e(`FmTy5E`);case`code_expired`:return e(`MUayZd`);case`phone_number_missing`:return e(`vb9FKo`);case`session_not_open`:return e(`Ifm2D/`);case`cancel_failed`:return e(`qNzWH1`);case`confirm_failed`:return e(`Uj+isI`);default:return e(`cdxpF3`)}}}function Rt({phoneNumber:e,phoneNumberChanged:t,sentTo:n,pending:r,errorCode:i,sessionBusy:o,children:s}){let c=u(),l=n!==void 0,d=r||o,f=Lt(),p=i&&!l?f(i):void 0;return(0,Z.jsxs)(`div`,{className:m(`flex flex-col gap-1`,x(`CheckoutPhoneVerification`,`The phone-verification ceremony â number entry, then the texted code`)),children:[(0,Z.jsxs)(a,{size:`2`,
56weight:`medium`,className:m(`text-gray-11 break-words`,x(`CheckoutRequirementLabel`,`A collected valueâs label`)),children:[c(`jdJhOL`),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:m(`text-red-11 ml-1`,x(`CheckoutRequirementRequired`,`The marker beside a value an answer is required for`)),children:`*`})]}),(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`1`,className:m(`text-gray-a10 py-1`,x(`CheckoutPhoneVerificationHint`,`The line explaining why the seller asks for a verified number`)),children:l?c(`HwxD9P`,{number:n}):c(`OuWS9I`)}),(0,Z.jsx)(`input`,{type:`tel`,autoComplete:`tel`,value:e,disabled:d||l,onChange:n=>t(me(n.target.value,e)),"aria-label":c(`Jpuxyv`,{label:c(`jdJhOL`)}),placeholder:c(`v30i60`),className:m(`text-2 h-11 min-w-0 rounded-lg border border-[var(--gray-a6)] bg-transparent px-3 outline-none focus:border-[var(--accent-8)]`,x(`CheckoutPhoneVerificationInput`,`The phone numberâs input`))}),p&&(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`1`,className:m(`text-red-11`,x(`CheckoutPhoneVerificationError`,`The ceremonyâs refusal line â a wrong code, a bad number`)),children:p}),!l&&s]})}function zt(){try{return window.self!==window.top}catch{return!0}}function Bt(e,t){let n=(0,X.useRef)(e);(0,X.useEffect)(()=>{n.current=e});let r=(0,X.useMemo)(()=>zt()?{request:e=>n.current.request(e),conclude:(e,t)=>n.current.conclude({id:e,outcome:t})}:void 0,[]);return(0,X.useEffect)(()=>r?P(r,t):void 0,[r,t]),r}function Vt({quote:e,displayCurrency:t,availableCurrencies:n,currencyPending:r,currencyFailed:i,disabled:o,onSwitch:s}){let c=u(),d=l(),f=n.find(e=>e!==t),p=e.base_currency===e.currency?null:e.exchange_rate;return!f&&p===null?null:(0,Z.jsxs)(`div`,{className:m(`flex min-w-0 flex-col gap-1`,x(`CheckoutCurrencyRow`,`The pay-in-currency row â the conversion disclosure, the switch affordance, and its refusal line`)),children:[p!==null&&(0,Z.jsx)(a,{size:`1`,className:m(`text-gray-a10 break-words`,x(`CheckoutCurrencyNote`,`The conversion disclosure â what the payment converted from, and at what rate`)),children:c(`Drur7W`,{base:e.base_currency.toUpperCase(),rate:L(p,d),currency:e.currency.toUpperCase()})}),f&&(0,Z.jsx)(`button`,{type:`button`,disabled:o||r,onClick:()=>s(f),className:m(`text-1 text-gray-a11 max-w-full self-start text-left underline decoration-dotted underline-offset-2 disabled:opacity-50`,x(`CheckoutCurrencyToggle`,`The "pay in another currency" affordance`)),children:r?c(`HZlipu`):c(`/4e/Il`,{currency:f.toUpperCase()})}),i&&(0,Z.jsx)(a,{size:`1`,className:m(`text-red-11 break-words`,x(`CheckoutFieldError`,`Every inline field-level error line (email, promo, currency)`)),children:c(`mh/pyI`,{currency:t.toUpperCase()})})]})}function Ht({promoCode:e,promoCodeRefused:t,promo:n,breakdown:r,promoError:i,promoPending:o,disabled:c,onApply:d,onRemove:f}){let h=u(),ee=l(),[g,_]=(0,X.useState)(!!i||!!t),[v,y]=(0,X.useState)(t??``),b=(0,X.useRef)(null),te=(0,X.useRef)(null),[S,C]=(0,X.useState)(null);(0,X.useEffect)(()=>{te.current&&!g&&S===null&&C(te.current.offsetWidth)},[g,S]),(0,X.useEffect)(()=>{g&&b.current?.focus()},[g]);let w=()=>{v.trim()===``||c||d(v.trim())};if(e){let t;n?.promo_type===`percentage`?t=h(`wC04pZ`,{amount:n.amount_off*100}):n?.promo_type===`flat_amount`&&n.currency&&(t=h(`Zvhdul`,{amount:De(n.amount_off,n.currency,ee)}));let o=r.adjustments.some(e=>e.kind===`discount`),l=r.upcoming.some(e=>e.type===`recurring`||e.type===`installments`),u;return u=!l||!n?h(`/0obmp`):n.duration===`forever`?h(`/hVKIB`):n.duration===`repeating`?h(`D6D96K`,{count:n.number_of_intervals??1}):h(o?`/0obmp`:`7Z6ucB`),(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,Z.jsxs)(`div`,{className:m(`flex flex-row items-center justify-between gap-3`,x(`CheckoutPromoApplied`,`The applied-promo row â the code chip beside what it takes off`)),children:[(0,Z.jsxs)(s,{checked:!0,disabled:c,onClick:()=>{y(``),_(!1),f()},size:`2`,className:m(`rounded-lg`,x(`CheckoutPromoChip`,`The applied code â a chip that removes it on click`)),children:[(0,Z.jsx)(Qe,{}),e.toUpperCase(),(0,Z.jsx)(p,{})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col items-end`,children:[t&&(0,Z.jsx)(a,{size:`2`,className:m(`text-green-11`,x(`CheckoutPromoDiscount`,`What the code takes off each covered charge`)),children:t}),(0,Z.jsx)(a,{size:`2`,className:m(`text-gray-a10`,x(`CheckoutPromoPeriod`,`Which charges the discount covers`)),children:u})]})]}),i&&(0,Z.jsx)(a,{size:`1`,className:m(`text-red-11`,x(`CheckoutFieldError`,`Every inline field-level error line (email, promo, currency)`)),children:i})]})}return(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,Z.jsx)(`div`,{ref:te,role:g?void 0:`button`,tabIndex:g?void 0:0,onClick:g?void 0:()=>_(!0),onKeyDown:g?void 0:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),_(!0))},className:m(`flex h-9 items-center rounded-lg transition-[width,background-color,border-color] duration-300 ease-out outline-none`,g?`bg-background border-gray-a5 border`:`bg-gray-a3 cursor-pointer`,x(`CheckoutPromoRow`,`The promo code affordance â a pill that grows into the input`)),style:{width:g?`100%`:S?`${S}px`:`fit-content`},children:g?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`input`,{ref:b,value:v,disabled:c,onChange:e=>y(e.target.value),onBlur:()=>{v.trim()===``&&!o&&_(!1)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),w()),e.key===`Escape`&&v.trim()===``&&_(!1)},placeholder:h(`0x9QMC`),className:m(`text-2 h-9 min-w-0 flex-1 bg-transparent px-3 outline-none`,x(`CheckoutPromoInput`,`The promo code input`))}),(0,Z.jsx)(`span`,{className:m(`flex shrink-0 items-center gap-1 pr-1`,x(`CheckoutPromoActions`,`The slot holding the apply-promo button`)),children:(0,Z.jsx)(`button`,{type:`button`,disabled:c||v.trim()===``,onMouseDown:e=>e.preventDefault(),onClick:w,className:m(`text-2 h-7 rounded-md px-2 font-medium whitespace-nowrap transition-opacity duration-200`,v.trim()===``?`pointer-events-none opacity-0`:`bg-gray-12 text-gray-1 opacity-100`,x(`CheckoutPromoApply`,`The apply-promo button`)),children:h(o?`isZXYe`:`EWw/tK`)})})]}
56):(0,Z.jsx)(a,{size:`2`,weight:`medium`,className:`flex items-center px-3 whitespace-nowrap select-none`,children:h(`0x9QMC`)})}),i&&(0,Z.jsx)(a,{size:`1`,className:m(`text-red-11`,x(`CheckoutFieldError`,`Every inline field-level error line (email, promo, currency)`)),children:i})]})}function Ut(e){let t=u();if(e?.interval_days==null)return``;let n=String(e.interval_days);return e.remaining_payments==null?e.total_payments==null?t(`sYFhXJ`,{period:n}):t(`FxU+/W`,{period:n,payments:e.total_payments}):t(`aNdOJS`,{period:n,payments:e.remaining_payments})}function Wt({row:e}){let t=u(),n=l(),r=Ut(e.detail),i=e.detail,a=e=>{let t=typeof e==`string`?Date.parse(e):NaN;return Number.isFinite(t)?new Intl.DateTimeFormat(n,{dateStyle:`long`}).format(new Date(t)):``};switch(e.kind){case`then_starting`:{let r=e.amount?F(e.amount,n):``,o=a(i?.charge_at);if(i?.remaining_payments!=null){let e=t(`t6fPg2`,{period:String(i.interval_days??``)});return t(`5abpR0`,{count:i.remaining_payments,amount:r,period:e,date:o})}return i?.interval_days==null?t(`7naoI1`,{amount:r,date:o}):t(`cmhaar`,{amount:r,period:String(i.interval_days),date:o})}case`then_after_trial`:{let r=e.amount?F(e.amount,n):``;if(i?.interval_days==null)return e.text??``;if(i.remaining_payments!=null){let e=t(`t6fPg2`,{period:String(i.interval_days)});return t(`S/YdGT`,{count:i.remaining_payments,amount:r,period:e})}return t(`gs0qMA`,{amount:r,period:String(i.interval_days)})}case`promo_free_period`:return i?.interval_days!=null&&i.code?t(`C6OZ89`,{period:String(i.interval_days),code:i.code}):e.text??``;case`due_today`:return i?.initial_fee?t(`If+WvL`,{amount:F(i.initial_fee,n)}):t(`QUXFCm`);case`period`:return r;case`trial_window`:return i?.trial_days==null?e.text??``:t(`Or/+OJ`,{days:i.trial_days});case`one_time_payment`:return i?.invoice?t(`JFAWTD`):i?.access_days==null?t(`YuiwBp`):t(`Au9sXE`,{days:i.access_days});case`access_window`:return i?.access_days==null?e.text??``:t(`WkHVlq`,{days:i.access_days});case`access_until`:return i?.access_until==null?e.text??``:t(`8O18LQ`,{date:a(i.access_until)});case`free_forever`:return t(`zAWTPU`);case`waitlist_notice`:return t(`N7fdYj`);case`waitlist_trial_notice`:return t(`OwLdXS`);case`tax_included`:return t(`wJ951y`);default:return e.text??``}}function Gt({row:e,strong:t,muted:n}){let r=u(),i=l(),a=Ut(e.detail),o=e.detail,s=e.amount?F(e.amount,i):``,c=a?`${s} ${a}`:s,d,f;switch(e.kind){case`initial_fee`:d=r(`b47mnz`),f=s;break;case`renewal_fee`:d=r(`eUayx6`),f=c;break;case`tax_today`:d=o?.rate&&Number.isFinite(Number(o.rate))?r(`5Cax1Z`,{rate:new Intl.NumberFormat(i,{style:`percent`,maximumFractionDigits:2}).format(Number(o.rate))}):r(`AwzkSM`),f=o?.applied===`included`?r(`20VP4r`,{amount:s}):s;break;case`total_due_today`:d=r(`MxAykv`),f=s;break;case`total_if_accepted`:d=r(`zR8X8a`),f=s;break;case`total_due_starting`:{let t=typeof o?.charge_at==`string`?Date.parse(o.charge_at):NaN;d=Number.isFinite(t)?r(`nCStS8`,{date:new Intl.DateTimeFormat(i,{dateStyle:`short`}).format(new Date(t))}):e.label??``,f=s;break}case`total_after_trial`:{let e=o?.trial_days??0;d=o?.paid_trial?o.without_tax?r(`al4FiA`,{duration:e}):r(`4QqweD`,{duration:e}):o?.without_tax?r(`BZp2My`,{duration:e}):r(`QVTw2k`),f=c;break}case`post_promo`:d=r(`45FFfu`),f=c;break;case`service_fee`:d=r(`G0bXT7`),f=s;break;case`item_subtotal`:d=e.label??``,f=s;break;default:d=e.label??``,f=e.text??s}return e.status===`pending`&&(f=(0,Z.jsx)(`span`,{role:`status`,"aria-label":r(`s885jr`),className:m(`whop-skeleton inline-block h-3.5 w-12 rounded`,x(`CheckoutBreakdownPending`,`The placeholder shown for a figure that is still being calculated`))})),(0,Z.jsxs)(`div`,{className:m(`text-2 flex items-center justify-between gap-4`,n?`text-gray-a10`:`text-gray-12`,x(`CheckoutDetailRow`,`One label/value row of the pricing details section`)),children:[(0,Z.jsx)(`span`,{className:t?`font-medium`:void 0,children:d}),(0,Z.jsx)(`span`,{className:m(`text-right`,t?`font-semibold`:void 0,n&&`text-gray-12`),children:f})]})}function Kt({display:e}
56){let t=u(),[n,r]=(0,X.useState)(!1),i=e?.sections;if(!i)return null;let a=i.line_items??[],o=i.charges??[],s=i.totals??[],l=i.fee_breakdown??[];return a.length+o.length+s.length+l.length===0?null:(0,Z.jsxs)(`div`,{className:m(`flex flex-col gap-6`,x(`CheckoutPricingDetails`,`The itemized pricing details below the promo code â line items, tax, the totals block, and the price breakdown`)),children:[a.length>0&&(0,Z.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>(0,Z.jsx)(Gt,{row:e},e.kind))}),o.map(e=>(0,Z.jsx)(Gt,{row:e,strong:!0},e.kind)),(s.length>0||l.length>0)&&(0,Z.jsxs)(`div`,{className:`border-gray-a5 flex flex-col gap-2 border-t pt-4`,children:[s.map((e,t)=>(0,Z.jsx)(Gt,{row:e,strong:t===0},e.kind)),l.length>0&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(c,{type:`button`,variant:`ghost`,color:`gray`,size:`1`,onClick:()=>r(e=>!e),className:m(`h-auto w-fit justify-start p-0 hover:bg-transparent`,x(`CheckoutBreakdownToggle`,`The "Price breakdown" disclosure that opens the subtotal and service fee rows`)),children:[t(`R6eWmW`),(0,Z.jsx)(f,{className:m(`transition-transform duration-200`,n&&`rotate-180`)})]}),(0,Z.jsx)(`div`,{className:m(`grid overflow-hidden transition-all duration-150 ease-in-out`,n?`grid-rows-[1fr]`:`grid-rows-[0fr]`),children:(0,Z.jsx)(`div`,{className:`min-h-0`,children:(0,Z.jsx)(`div`,{className:m(`flex flex-col gap-2 pl-2`,x(`CheckoutBreakdownRows`,`The opened price breakdown â the itemâs own subtotal and the service fee`)),children:l.map(e=>(0,Z.jsx)(Gt,{row:e,muted:!0},e.kind))})})})]})]})]})}function qt({dueAt:e}){let t=u(),n=l(),r=Date.parse(e);if(!Number.isFinite(r))return null;let i=Date.now()>r,o=Math.floor((Date.now()-r)/864e5),s=new Intl.DateTimeFormat(n,{dateStyle:`long`}).format(new Date(r));return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 ${x(`CheckoutInvoiceDue`,`The invoice due-date block â when this invoice checkoutâs payment is due, red once it is behind`)}`,children:[(0,Z.jsx)(a,{size:`1`,weight:`medium`,className:`text-gray-11`,children:t(`l3AfOI`)}),i?(0,Z.jsx)(a,{size:`1`,weight:`medium`,className:`text-red-11`,children:o>0?t(`yd0M3K`,{date:s,days:o}):t(`6d2QVw`,{date:s})}):(0,Z.jsx)(a,{size:`1`,className:`text-gray-a10`,children:s})]})}function Jt({description:e}){let t=u();return(0,Z.jsxs)(`div`,{className:m(`flex flex-col gap-1`,x(`CheckoutItemDescription`,`The itemâs long description block, under its own heading`)),children:[(0,Z.jsx)(a,{size:`1`,weight:`medium`,className:`text-gray-11`,children:t(`Q8Qw5B`)}),(0,Z.jsx)(a,{size:`1`,className:`text-gray-a10 break-words whitespace-pre-line`,children:e})]})}var Q=S(`checkout`).doc(`The full checkout surface â order summary with the live quote, promo code entry, the currency the buyer pays in, everything this checkout has to collect from the buyer, the composed payment methods surface, and the pay flow. What it collects is whatever the seller set up (email, their own questions, a phone number, a shipping address for physical goods, an explicit agreement to their terms), rendered together on one screen in the order they chose â so a seller who starts asking for something new needs no change here. Renders the whole purchase; the checkout controller owns the session and the credential. After a payment that needs an off-site step, this same surface renders the outcome the server reports when the buyer comes back.`).props(e=>({checkoutSurface:e.direct().embedDefault(`embedded_checkout`).doc("Which checkout this mount is, forwarded into the composed payment surface so the matrix only offers methods that serve it. An embedded mount is fixed to `embedded_checkout` â a seller's page can never claim a first-party surface; the first-party direct mounts say which they are (`direct_checkout` on the hosted checkout page, `modal_checkout` in the storepage overlay)."),showComingSoonPaymentMethods:e.direct().default(!1).doc(`Direct mode only. Shows demand-test payment methods in the composed payment surface.`),compact:e.direct().default(!1).doc(`Direct mode only. Render one-click payment controls without the full checkout layout.`),buyerEmail:e.default(``).doc(`Prefills the buyer email the host page already knows: the authenticated first-party viewerâs, the one a checkout link carried, or the one a merchant page collected before mounting. A session that already holds its buyerâs email wins over it. Empty (default) leaves the field for the buyer.`),lockBuyerEmail:e.default(!1).doc("Keeps the buyer from editing the prefilled `buyerEmail` â an invoice link names who it was issued to. Only holds while the field still shows that email; a session email that already differs is never locked to it, and without a `buyerEmail` there is nothing to lock."),defaultValues:e.default(void 0).doc("Prefills what the host page already knows about the buyer. The buyer can edit every prefilled field, and a phone number or complete shipping address the session already holds wins over it. `phone` fills the checkout's phone number field when the seller collects one, in E.164 format such as `+14155552671`; when that field exists it also supplies the billing phone for methods that need one, so pass `phone` rather than `billingDetails.phone`. `shippingAddress` fills the shipping address when the checkout collects one (`country` is an ISO 3166-1 alpha-2 code; with a country the form cannot use, only the name is prefilled). `billingDetails` prefills the payment method's billing details like the payment element's `defaultValues.billingDetails`. Use `buyerEmail` for the email."),checkoutRequested:e.direct().doc(`Direct mode only. Called when the compact checkout needs the full checkout surface.`),checkoutInitiated:e.direct().doc(`Direct mode only. Called when the buyer initiates the compact checkout.`),purchaseCompleted:e.direct().doc(`Direct mode only. Reports a successful purchase so the host can refresh fulfilled content.`),status:e.fromController().analytics().doc(`The session status driving which face renders.`),mode:e.fromController().analytics().doc("What kind of checkout the session is, off the server: `payment` charges for the items at confirm; `setup` saves a payment method and charges nothing â the summary, the terms and every status line say so instead of naming a payment."),seller:e.fromController().doc(`The seller this checkout purchases from, with the legal surface its terms disclosure names.`),items:e.fromController().doc(`What the buyer is purchasing, with its server-resolved display â name, headline, long description, and art. The display keys are absent on a session read from a deployment that predates them, and the summary simply shows less.`),quote:e.fromController().doc(`The server-written price of the items â the number confirm charges.`),displayCurrency:e.fromController().analytics().doc(`The currency this checkout is priced and CHARGED in â the buyer's own where the seller offers it.`),availableCurrencies:e.fromController().doc(`The currencies the server will accept for this checkout: the seller's, plus the buyer's local one when adaptive pricing applies.`),promoCode:e.fromController().analytics().doc(`The promo code applied to the quote, or null.`),promo:e.fromController().doc(`The applied codeâs resolved semantics â what it takes off and which charges it covers â or null. It is what lets the promo row say what the code actually touched instead of asserting "todayâs charge" for a code that discounts a trialâs first real payment.`),showPromoInput:e.fromController().analytics().doc(`Whether the seller offers promo entry on this checkout â false hides the input (a code already applied or refused still shows its row, so it stays explicable and removable).`),requirements:e.fromController().doc(`What this session declares its form must collect, in the order the server declared it â the surface renders exactly this and nothing of its own. LIVE: the list moves mid-checkout (a right password makes its entry disappear; moving onto a password-protected plan adds one), so the form re-derives from it rather than reading it once.`),requirementValues:e.fromController().doc(`The values the session already holds for those requirements, so a form re-mounting after an off-site step does not ask again for what the buyer already gave.`),nextActionType:e.fromController().analytics().doc(`The TYPE of the one thing the server says to do now, or null â what the surface EXPLAINS. The actionâs payloads (the payment credential, the destination url) stay in the controller frame that executes them.`),nextActionBlocks:e.fromController().doc("Whether that action holds the sale â read off the actionâs own `blocking` in the controller frame, never derived from the type here. `authenticate` takes both forms (a gate before the charge, an offer after it), so a surface deriving it would release the pay button in front of a step the server demands."),awaitClaimState:e.fromController().doc("Which copy the completed face wears while the session rests on `await_claim` â `check_email` while the purchase is still unclaimed (the buyerâs move is in their inbox), `handed_off` when it was completed on another device (a first-party read, or an older server: an embedded read of a recorded claim is handed the parking-page `redirect` instead and leaves). Null for every other action. The one action payload that travels, because it is presentational and never a credential."),redirectBlocked:e.fromController().doc('True when the embedding page refused a tab navigation this checkout owes the buyer â the trip to the sellerâs `returnUrl` after a finished checkout, or the paymentâs own off-site step (a method whose step only renders full_page) â so the face renders a "Continue" press that makes the same trip under the buyerâs own gesture. The destination url itself never travels here: it stays in the controller frame that navigates.'),returnUrl:e.fromController().doc(`Where the buyer lands after an off-site payment step.`),payment:e.fromController().doc(`The payment a successful confirm created, or null.`),entry:e.fromController().doc(`The waitlist entry a successful confirm created, or null. A completed session carrying one (and no payment) joined a queue the seller accepts later â the completed face says so instead of claiming a purchase.`),setup:e.fromController().doc("The setup intent a successful confirm created on a `setup`-mode session, or null. A completed session carrying one (and no payment) saved a payment method and bought nothing â the completed face says the method is saved instead of claiming a purchase."),resultStatus:e.fromController().analytics().doc("Where the completed sessionâs result stands â what the completed faces select on, since `completed` alone stopped meaning success: `succeeded` wears the success face, `requires_action` the finish-your-payment re-entry, `processing` the clearing copy, `failed` the honest failure face. Null while open or when the wire predates the field, which reads as the success floor."),resultSettling:e.fromController().doc(`True when a succeeded purchaseâs money is still clearing â a bank debit the provider accepted while access was already granted. The success face keeps its check and says the payment is still processing; it never holds the buyer.`),pendingStepType:e.fromController().doc("The TYPE of the paymentâs own pending step (`next_action.type` off the payment status wire), read once when the drive rests on a still-pending ceremony. It forks the finish-payment faceâs copy: `display_instructions` is a voucher or bank transfer whose remaining step is paying, not verifying. Null until known, which keeps the verification copy."),transfer:e.fromController().doc(`The membership transfer this checkout performs, or null for an ordinary purchase. The order-details column explains it: the buyer is accepting an existing membership, nothing is charged today, and the timing it inherits rides the two nullable timestamps.`),invoiceDueAt:e.fromController().doc(`When this checkoutâs invoice is due (ISO 8601), or null for everything that is not an invoice checkout â the summary states the date, red once it is behind.`),paymentMethodRequired:e.fromController().analytics().doc(`Whether this checkout collects a payment method at all â read off the session, never derived (a $0-today trial still collects; only the wire knows). Null when the wire never said (fixtures, older deployments), and the two consumers default OPPOSITE ways: the payments composition renders unless the wire says false â withholding collection on an ambiguous wire loses the sale â while the waitlist saved-method copy claims a vault only when the wire says true.`),confirmError:e.fromController().doc(`Why the most recent confirm attempt did n
56ot complete â the session stays open for retry.`),blockingError:e.fromController().doc('Why this open session cannot confirm as it stands, or null â known without an attempt: a sold-out plan, an archived one, a spent transfer link. The surface renders it in place of the payment collection, because a form in front of it would gather answers for a purchase the server already refused. Live off every session read, so a restock clears it by itself. `offered` is the sellerâs standing stance and the posture for a code this bundle predates â true reads as "check back later", false as "no longer available" â with the wire message as its copy.'),confirming:e.fromController().doc(`True while a confirm attempt is in flight.`),confirmNonce:e.fromController().doc(`Bumps every time a confirm attempt settles â the pay button releases on it.`),confirmAttemptNonce:e.fromController().doc(`Bumps when a confirm request enters the controller, including attempts that fail before dispatch.`),purchaseDispatchNonce:e.fromController().doc(`Bumps only when a validated purchase attempt is dispatched to the checkout API.`),purchasePaymentMethodType:e.fromController().doc(`The payment method type belonging to the most recently dispatched purchase attempt.`),promoPending:e.fromController().doc(`True while a promo update is in flight.`),promoError:e.fromController().doc(`Why the last promo update was refused.`),passwordPending:e.fromController().doc(`True while a password unlock attempt is in flight.`),passwordFailed:e.fromController().doc(`True when the last password attempt did not unlock the checkout â the requirement still stands and the buyer retries. The satisfied signal is the requirement itself disappearing from the live list, never a flag.`),phoneNumber:e.fromController().doc(`The phone number already collected by this checkout session.`),phoneVerified:e.fromController().doc("Whether the sessionâs stored phone number passed the SMS ceremony â what satisfies a sellerâs `verify` mode, anonymously: the blocking `verify_phone` action disappears from the next read once true."),phoneCodePending:e.fromController().doc(`True while a ceremony leg (the code-bearing confirm, or a resend) is in flight.`),phoneCodeError:e.fromController().doc("The last ceremony refusalâs STABLE code (`invalid_code`, `send_throttled`, â¦) â the surface localizes off it; server prose never renders."),phoneCodeSentTo:e.fromController().doc(`The number the last delivered code was texted to (the confirm that carried it also parked the paymentâs credentials) â the ceremony shows its code screen off this.`),promoCodeRefused:e.fromController().doc(`The promo code the session refused when it was created, or null. The session holds no code in that case, so this is the only thing that can tell the buyer WHICH code did not apply.`),currencyPending:e.fromController().doc(`True while a currency switch is in flight.`),currencyFailed:e.fromController().doc(`True when the last attempt to switch the currency was refused â the buyer keeps paying in the current one.`),paymentMethodConfiguration:e.fromController().doc(`The checkout's method filtering, read off the session and threaded into the payment surface.`),breakdown:e.fromController().doc("The price itemized â lines, adjustments, the total, and what is owed later. ONE shape whichever copy it is: the session's own until tax has been priced for this buyer, the calculated one after. An adjustment carrying `status: 'pending'` has no figure yet and renders as a loading row; an adjustment that does not apply is absent entirely. Injected."),offerAmounts:e.fromController().doc(`The totals the payment method list gates its offers on, in minor units, one per buyer-fee posture â each method is judged against the total THAT method would charge, so a fee-free pick (which re-prices the displayed total) can never re-gate the list and drop itself. Injected; absent only on fabricated snapshots, where the displayed amount gates every method.`),taxBehavior:e.fromController().analytics().doc(`Whether this checkout collects tax and how its price reads â null when it collects none. It decides how much address the payment surface asks for: placing tax needs a full one (rates vary by subdivision in the US and Canada), and a checkout with no tax should not interrogate the buyer for it.`),taxI
56d:e.fromController().doc(`The tax registration the session already holds, or null â it seeds the company-purchase row on a resume, and is what the row diffs against before PATCHing.`),collectTaxId:e.fromController().analytics().doc(`Whether the seller offers tax ID entry on checkout (their VAT ID setting) â the company-purchase row renders only when they do, the same seller switch legacy's VAT ID field rendered off.`),taxIdPending:e.fromController().doc(`True while a tax registration update is in flight.`),taxIdFailed:e.fromController().doc(`True when the last tax registration was refused â the session keeps whatever it held and the buyer corrects the id where they typed it.`),setupFutureUsage:e.fromController().analytics().doc("The future-usage attestation threaded into the payment surface: derived from the billing schedule for a renewal, and always set on a `setup`-mode session, whose whole purpose is a method saved for later."),pricing:e.fromController().doc(`The checkout's billing schedule â trial length, renewal price and billing period, installment count â derived from the SAME breakdown copy the rows and total render (the calculated one once it answers), so the schedule line and the figures beside it can never state two different renewals. It is what the summary discloses beyond today's quote.`),ctaLabel:e.fromController().analytics().doc("The pay button's verb, published by the session as a closed set the element translates. `null` on a session from a deployment that predates the field â the label derives from the billing schedule then."),branding:e.fromController().doc("The SELLER's own checkout branding â colors, font, and corner shape â resolved from the plan resource. Independent of the `appearance` an embedding page asks for: this is what the seller configured, not what the host requested."),brandingPreview:e.fromController().analytics().doc(`True only for the synthetic checkout-branding session, enabling the production-preview presentation.`)})).events(e=>({walletHandoffRequested:e.hostInternal().doc(`A framed Chromium Apple Pay press asks the PAGE to run the ceremony, where Appleâs handoff modal has the whole viewport instead of this frameâs box. The controllerâs host reaction runs it; no consumer callback ever hears it.`),walletHandoffConcluded:e.hostInternal().doc(`The confirm outcome for a page-side sheet holding its verdict open â the controllerâs host reaction concludes that sheet with it, so the checkmark follows the confirm, never precedes it.`),applyPromo:e.internal().analytics(`code`).doc(`The buyer applied (or removed) a promo code â the controller PATCHes it.`),submitPassword:e.internal().doc("The buyer answered the `custom_password` requirement â the controller PATCHes it. The PATCH is the validation: right removes the requirement from the refreshed session, wrong projects `passwordFailed`."),detailsRequested:e.internal().doc(`The buyer asked for the order-details sheet â the controller opens it (narrow containers only).`),selectDisplayCurrency:e.internal().analytics(`currency`).doc(`The buyer switched the currency they pay in â the controller PATCHes it and the quote re-prices.`),confirmRequested:e.internal().analytics(`paymentMethodType`,`promoCode`).doc("The pay click minted a confirmation token â the controller confirms the session with it. `confirmationToken` is null exactly when the session collects no payment method (`payment_method_required` false): no payments surface is mounted, so there is nothing to mint and the confirm goes out token-less, which is the free/waitlist engines' own contract. `values` is the whole filled requirements form, keyed by requirement, and it is the ONE thing the surface asserts: the controller writes it onto the session, re-judges every required entry against the list it holds itself, and reads the buyer's terms acceptance out of it rather than being told a boolean. `promoCode` rides only from the express row's OS sheet â the code its coupon field applied (null = removed the prefill; absent = untouched), pushed with the confirm because that is the one write the buyer authorized. No quote identity rides the confirm: the server charges the session's own current quote, and the display rails own what the buyer sees."),taxAddressChanged:e.internal().doc("The billing address the payment surface collects changed â debounced and deduped by the payment element itself, so this maps one-to-one onto a re-price. The controller prices tax for it; `null` means the buyer cleared it and the server falls back to locating them by IP."),shippingAddressChanged:e.internal().doc("The shipping address the requirements form collects changed â debounced and deduped with the billing railâs discipline; `null` while the address is incomplete. The TAX lane only: `calculate_breakdown` falls back to the sessionâs shipping address when no billing one is in force, so the controller re-prices for it exactly as it does for billing. The VALUE itself never rides this event â it lands on the session through the pay-time PATCH with the rest of the form."),taxIdChanged:e.internal().doc("The buyer entered (or cleared) their tax registration â the controller PATCHes it onto the session and the quote re-prices: a changed registration changes the tax, and a valid EU B2B id reverse-charges it. `null` is the buyer unchecking the company-purchase row."),buyerFeeSupportChanged:e.internal().analytics(`supportsBuyerFee`).doc('The buyer picked a payment method whose service-fee answer differs from the last one â the controller re-prices for the BOOLEAN. Never the method type: every method with the same answer prices the same, and `null` is "nothing picked", which leaves the sessionâs method-blind fee standing.'),surfaceReady:e.internal().doc(`The surface finished its first mou
56nt, on EVERY face â the controller runs the sessionâs pending action off it, and the session most in need of that is a completed one resumed with a claim or a hand-off still on it. Fires once per mount: re-emitting would re-drive the loop.`),identityStepRequested:e.internal().doc(`The buyerâs identity moved or wants to move, or a re-entry affordance was pressed (the verify-phone notice, the finish-your-payment face). The controller re-reads the session and drives whatever action the fresh read names â which is exactly what every one of those needs.`),redirectRetryRequested:e.internal().doc(`The buyer pressed âContinueâ on a blocked-navigation face â the completed face owed the sellerâs returnUrl, or the finish-payment face owed the paymentâs off-site step â and the controller retries the embedding-tab navigation inside the clickâs own activation (where a user-activation-gated refusal passes), falling back to opening the destination in a new tab. The url never leaves the controller frame; the press travels instead.`)})).state(()=>({sessionRef:void 0})).contributes(e=>({driveNextAction:e.required().doc(`Runs the payment's pending off-site step through the MOUNTED payments controller, answering with what the drive left behind (a refused tab navigation carries its destination back). It has to be a contribution: the def-level static has no ctx.open, so the frameable 3DS dialog can only be opened by a handle that is actually mounted â and the provider below closes over exactly that one.`),driveVerifyPhone:e.required().doc("Asks the composed payments surface to present the phone-verification ceremony â a contribution for exactly the driveNextAction reason: the capability lives in the render tree (the composed Payment elementâs ref, whose ask the payments controllerâs own reaction turns into the dialog â `verifyPhone` has no consumer surface). Resolves when the ask is DELIVERED, not when the ceremony concludes: the landing announces itself through identityStepRequested.")})).actions(e=>({walletHandoffChanged:e.hostInternal(async(e,t)=>{"use embed";return await T(t)}).doc(`A page-side sheet ask (the billing reprice, a shipping address or option, a promo code) relayed into this frameâs own handlers; answers with what they changed. Called by the controllerâs host reaction while a handoff is in flight.`),walletHandoffSettled:e.hostInternal(async(e,t)=>{"use embed";ve(t)}).doc(`The page sheetâs verdict for the pending handoff â the mint result, or the failure (a dismissal is cancelled). Called by the controllerâs host reaction; settles the press exactly as an in-frame sheet would.`),runNextAction:e.controllerOnly(async(e,t)=>{"use embed";return await e.contributions.driveNextAction(t)}).doc(`Drives the confirmed payment's pending step through the mounted payments handle and reports what the drive left behind â a refused tab navigation comes back with its destination. Controller-only â the checkout controller calls it after a confirm that did not settle.`),runVerifyPhone:e.controllerOnly(async e=>{"use embed";await e.contributions.driveVerifyPhone()}).doc("Asks the composed payments surface to present the phone-verification ceremony, resolving when the ask is delivered. Controller-only â the checkout controller's action loop calls it when the session's next_action is `verify_phone`, and then RESTS: the ceremony's landing re-drives the loop through identityStepRequested."),concludeWalletSheet:e.controllerOnly(async(e,t)=>{"use embed";Te(t.success?`success`:`failure`)}).analytics(`success`).doc(`Delivers the confirm outcome to an OS wallet sheet holding its conclusion open in this frame. Controller-only â the checkout controller's confirm reaction calls it on every settle, success or refusal.`),adoptSessionReference:e.controllerOnly(async(e,t)=>{"use embed";e.setState({sessionRef:t})}).doc(`The controller's delivery of the session's identity + credential over the same-origin bus (the adoptSession shape) â what lets the composed sign-in name this checkout so the backend records the proven buyer on it. Never a projection: the client_secret is the session's whole authorization.`)})).loading(()=>{"use loading";let e=(e,t=14)=>({height:t,width:e,borderRadius:4,background:`var(--gray-a3, #f0f0f3)`});return(0,Z.jsx)(`div`,{"aria-busy":`true`,className:`whop-skeleton @container animate-pulse`,children:(0,Z.jsxs)(`div`,{className:`min-h-viewport flex flex-col @5xl:flex-row @5xl:items-stretch`,children:[(0,Z.jsx)(`div`,{className:`@5xl:h-viewport flex min-w-0 flex-col gap-4 px-4 pt-4 pb-6 @5xl:sticky @5xl:top-0 @5xl:w-1/2 @5xl:shrink-0 @5xl:flex-row @5xl:items-start @5xl:justify-end @5xl:p-20`,children:(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4 @5xl:w-[380px] @5xl:min-w-[380px]`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(`div`,{style:e(`45%`,16)}),(0,Z.jsx)(`div`,{className:`@5xl:hidden`,style:e(`28%`,14)})]}
56),(0,Z.jsx)(`div`,{className:`mt-4 self-center @5xl:mt-1 @5xl:self-start`,style:e(`60%`,15)}),(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-1 pt-3 @5xl:items-start @5xl:pt-0`,children:[(0,Z.jsx)(`div`,{style:e(`40%`,34)}),(0,Z.jsx)(`div`,{style:e(`55%`,13)})]})]}),(0,Z.jsx)(`div`,{className:`hidden @5xl:block`,style:{height:36,width:148,borderRadius:8,background:`var(--gray-a3, #f0f0f3)`}})]})}),(0,Z.jsx)(`div`,{className:`bg-background flex min-w-0 flex-1 flex-col px-4 pt-2 pb-4 @5xl:w-1/2 @5xl:items-start @5xl:justify-start @5xl:p-20 @5xl:pb-20`,children:(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-6 @5xl:w-[380px] @5xl:min-w-[380px]`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`div`,{style:e(`22%`,14)}),(0,Z.jsx)(`div`,{style:{height:44,borderRadius:8,background:`var(--gray-a3, #f0f0f3)`}})]}),(0,Z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,Z.jsx)(`div`,{style:{height:232,borderRadius:12,background:`var(--gray-a3, #f0f0f3)`}}),(0,Z.jsx)(`div`,{style:e(`62%`,14)}),(0,Z.jsx)(`div`,{style:{height:55,borderRadius:8,background:`var(--gray-a3, #f0f0f3)`}}),(0,Z.jsx)(`div`,{style:e(`80%`,12)})]})]})})]})})}).error(()=>{"use embed";return(0,Z.jsx)(on,{})}).demo(e=>e.props(()=>({promoError:void 0,promoCodeRefused:null,promo:null,showPromoInput:!0,passwordPending:!1,passwordFailed:!1,phoneNumber:void 0,phoneVerified:!1,phoneCodePending:!1,phoneCodeError:void 0,phoneCodeSentTo:void 0,paymentMethodConfiguration:void 0,setupFutureUsage:void 0,offerAmounts:void 0,pricing:void 0,branding:void 0,ctaLabel:null,taxId:null,collectTaxId:!1,taxIdPending:!1,taxIdFailed:!1,entry:null,transfer:null,paymentMethodRequired:!0,requirements:[{key:`email`,type:`email`,holdsSale:!0}],requirementValues:{},nextActionType:null,nextActionBlocks:!1,awaitClaimState:null,resultStatus:null,resultSettling:!1,pendingStepType:null,confirmAttemptNonce:0,purchaseDispatchNonce:0,purchasePaymentMethodType:void 0}))).render(()=>{"use embed";return(0,Z.jsx)(Yt,{})});function Yt(){let{props:e,emit:t,state:n}=b(),r=(0,X.useRef)(e.status===`open`);e.status===`open`&&(r.current=!0);let i=ae(),a=(0,X.useMemo)(()=>{let t=n.sessionRef?.id,r=e.items[0]?.plan,i=e.pricing,a=Number(e.breakdown.total.amount);if(!(!t||!r||!i||!Number.isFinite(a)))return{sessionId:t,planId:r,planType:i.planType,isFree:e.ctaLabel!==`join_waitlist`&&e.paymentMethodRequired===!1,isWaitlist:e.ctaLabel===`join_waitlist`,amount:a,currency:e.breakdown.total.currency,amountUsd:_e({amount:a,currency:e.breakdown.total.currency,baseCurrency:e.quote.base_currency,exchangeRate:e.quote.exchange_rate}),botId:e.seller.id}},[n.sessionRef?.id,e.items,e.pricing,e.breakdown.total.amount,e.breakdown.total.currency,e.quote.base_currency,e.quote.exchange_rate,e.ctaLabel,e.paymentMethodRequired,e.seller.id]),o=(0,X.useRef)(!1),s=(0,X.useRef)(!1),c=(0,X.useRef)(!1),l=(0,X.useRef)(0),u=(0,X.useRef)(null);return(0,X.useEffect)(()=>{!(e.status===`completed`&&(e.resultStatus===null||e.resultStatus===`succeeded`)&&e.entry===null&&e.setup===null)||o.current||(o.current=!0,e.purchaseCompleted?.())},[e.status,e.resultStatus,e.entry,e.setup,e.purchaseCompleted]),(0,X.useEffect)(()=>{t(`surfaceReady`,{})},[]),(0,X.useEffect)(()=>{e.status!==`open`||!a||c.current||(c.current=!0,i.emit({type:`initiate`,facts:a}))},[i,a,e.status]),(0,X.useEffect)(()=>{!a||e.purchaseDispatchNonce<=l.current||(l.current=e.purchaseDispatchNonce,i.emit({type:`submit_purchase`,facts:a,paymentMethodType:e.purchasePaymentMethodType}))},[i,a,e.purchaseDispatchNonce,e.purchasePaymentMethodType]),(0,X.useEffect)(()=>{!(e.status===`completed`&&(e.resultStatus===null||e.resultStatus===`succeeded`)&&e.entry===null&&e.setup===null)||!a||s.current||(s.current=!0,i.emit({type:`complete`,facts:a,receiptId:e.payment??void 0}))},[i,a,e.status,e.resultStatus,e.entry,e.setup,e.payment]),(0,X.useEffect)(()=>{let t=e.confirmError,r=n.sessionRef?.id,a=u.current;u.current=t,!(!t||!r||e.confirmAttemptNonce===0||t===a)&&i.emit({type:`error`,sessionId:r,stage:`confirm`,errorCode:t.code,errorMessage:`The checkout confirmation was not completed.`})},[i,e.confirmAttemptNonce,e.confirmError,n.sessionRef?.id]),!r.current||e.compact&&e.status!==`open`?(0,Z.jsx)(Xt,{}):(0,Z.jsx)(ln,{})}function Xt({paymentsProvided:e=!1}){let{props:t}=b();return t.status===`completed`?t.resultStatus===`requires_action`?(0,Z.jsx)(en,{paymentsProvided:e}):t.resultStatus===`processing`?(0,Z.jsx)(nn,{}):t.resultStatus===`failed`?(0,Z.jsx)(rn,{}):(0,Z.jsx)(Zt,{}):t.status===`expired`?(0,Z.jsx)(an,{}):null}function Zt(){let e=u(),{props:t}=b(),n=t.entry!==null&&t.payment===null,r=t.setup!==null&&t.payment===null,i=t.nextActionType===`upgrade_authentication`||t.nextActionType===`authenticate`,o=typeof window<`u`&&!V()&&t.status===`completed`,s=n?e(`Y01r3v`):r?e(`JePOJl`):t.resultSettling?e(`q1TP4z`):e(`iZ/Q2q`),
56c=r?e(`zuQ6yX`,{seller:t.seller.title}):t.resultSettling?e(`8Ji6QQ`,{seller:t.seller.title}):e(`BQEJCk`,{seller:t.seller.title});return(0,Z.jsxs)(`div`,{className:m(`flex flex-col items-center gap-2 py-8 text-center`,x(`CheckoutCompleted`,`The success face shown once the checkout completed`)),children:[(0,Z.jsx)(`span`,{className:`bg-green-a3 text-green-11 text-4 flex size-10 items-center justify-center rounded-full`,children:`â`}),(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`3`,weight:`semi-bold`,children:s}),(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`2`,className:`text-gray-a11`,children:n?e(`LgkEiC`,{seller:t.seller.title}):c}),n&&t.paymentMethodRequired&&(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`2`,className:m(`text-gray-a11`,x(`CheckoutWaitlistVaulted`,`The line on the waitlist-joined face saying the saved payment method is only charged on acceptance`)),children:e(`LS6B1C`)}),o&&i&&(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`2`,className:m(`text-gray-a11`,x(`CheckoutClaimOffer`,`The embedded claim-offer line on the success face`)),children:e(n?`cAUu1n`:r?`X9j/je`:`zOewUK`)}),t.awaitClaimState===`check_email`&&(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`2`,className:m(`text-gray-a11`,x(`CheckoutAwaitClaim`,`The resting await_claim line on the success face`)),children:e(n?`KLesMV`:r?`z304TQ`:`/znk8+`)}),t.awaitClaimState===`handed_off`&&(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`2`,className:m(`text-gray-a11`,x(`CheckoutAwaitClaim`,`The resting await_claim line on the success face`)),children:e(n?`72K1EG`:r?`rrqR84`:`Yq0Nmp`)}),o&&(i||t.awaitClaimState===`check_email`||t.nextActionType===`redirect`)&&(0,Z.jsx)($t,{}),t.redirectBlocked&&(0,Z.jsx)(Qt,{})]})}function Qt(){let e=u(),{emit:t}=b();return(0,Z.jsx)(c,{size:`2`,variant:`classic`,onClick:()=>t(`redirectRetryRequested`,{}),className:x(`CheckoutContinue`,`The blocked-navigation press â finishes the trip the embedding page refused: the sellerâs returnUrl on the completed face, the paymentâs off-site step on the finish-payment face`),children:e(`acrOoz`)})}function $t(){let{emit:e}=b();return(0,X.useEffect)(()=>{let t=document.visibilityState===`hidden`,n=()=>{let n=document.visibilityState===`hidden`,r=t&&!n;t=n,r&&e(`identityStepRequested`,{})};return document.addEventListener(`visibilitychange`,n),()=>document.removeEventListener(`visibilitychange`,n)},[e]),null}function en({paymentsProvided:e=!1}){let t=u(),{props:n,emit:r,state:i}=b(),o=n.entry!==null&&n.payment===null,s=n.setup!==null&&n.payment===null,l=n.redirectBlocked,d=l?o||s?t(`I89G8i`):t(`QBA+vS`,{seller:n.seller.title}):o?t(`FNl9FK`,{seller:n.seller.title}):s?t(`5oaLQ7`,{seller:n.seller.title}):n.pendingStepType===`display_instructions`?t(`mkSu7U`,{seller:n.seller.title}):t(`P24wAg`,{seller:n.seller.title}),f=(0,Z.jsxs)(`div`,{className:m(`flex flex-col items-center gap-2 py-8 text-center`,x(`CheckoutFinishPayment`,`The face shown while the payment still needs a step the buyer dismissed â carries the re-entry button`)),children:[(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`3`,weight:`semi-bold`,children:t(o?`FVA8zg`:s?`XuF6an`:`TIY+Ua`)}),(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`2`,className:`text-gray-a11`,children:d}),l?(0,Z.jsx)(Qt,{}):(0,Z.jsx)(c,{size:`2`,variant:`solid`,color:`gray`,highContrast:!0,disabled:n.confirming,onClick:()=>r(`identityStepRequested`,{}),className:x(`CheckoutFinishPaymentButton`,`The re-entry button that re-runs the paymentâs pending step`),children:t(o||s?`kJJ9EG`:`7q0SIO`)}),!e&&(0,Z.jsx)(pe,{})]});return e?f:(0,Z.jsxs)(be,{accountId:n.seller.id,currency:n.quote.currency,...n.mode===`setup`?{mode:`setup`}:{amount:I(Number(n.breakdown.total.amount),n.breakdown.total.currency)},returnUrl:n.returnUrl??void 0,checkoutSession:i.sessionRef,children:[(0,Z.jsx)(tn,{}),f]})}function tn(){let e=C(be);return y(Q,`driveNextAction`,({clientSecret:t})=>Ae(()=>e.handleNextAction({clientSecret:t})),!0),null}function nn(){let e=u(),{props:t,emit:n}=b(),r=t.entry!==null&&t.payment===null,i=t.setup!==null&&t.payment===null;return(0,Z.jsxs)(`div`,{className:m(`flex flex-col items-center gap-2 py-8 text-center`,x(`CheckoutSettling`,`The face shown while an accepted payment is still clearing`)),children:[(0,Z.jsx)($t,{}),(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`3`,weight:`semi-bold`,children:e(r||i?`8uMIp5`:`6DylOe`)}),(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`2`,className:`text-gray-a11`,children:r?e(`ptthQ6`,{seller:t.seller.title}):i?e(`Ymi73Q`):e(`21K4aN`,{seller:t.seller.title})}),(0,Z.jsx)(c,{size:`2`,variant:`surface`,color:`gray`,disabled:t.confirming,onClick:()=>
56n(`identityStepRequested`,{}),className:x(`CheckoutSettlingCheck`,`The settling faceâs re-check â re-reads the session for a charge that may have decided`),children:e(`1A8Z/l`)})]})}function rn(){let e=u(),{props:t,emit:n}=b(),r=t.entry!==null&&t.payment===null,i=t.setup!==null&&t.payment===null;return(0,Z.jsxs)(`div`,{className:m(`flex flex-col items-center gap-2 py-8 text-center`,x(`CheckoutFailed`,`The face shown when the completed sessionâs charge or vault died â the payment did not go through`)),children:[(0,Z.jsx)(`span`,{className:`bg-red-a3 text-red-11 text-4 flex size-10 items-center justify-center rounded-full`,children:`â`}),(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`3`,weight:`semi-bold`,children:e(r?`nlxeFB`:i?`rM2tD8`:`p0Ud3Y`)}),(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`2`,className:`text-gray-a11`,children:e(r?`vRRlWu`:i?`ayIPga`:`9qpESs`,{seller:t.seller.title})}),(0,Z.jsx)(c,{size:`2`,variant:`solid`,color:`gray`,highContrast:!0,disabled:t.confirming,onClick:()=>n(`identityStepRequested`,{}),className:x(`CheckoutFailedRetry`,`The failure faceâs button â re-reads the reopened session so the buyer can pay again`),children:e(`FazwRl`)})]})}function an(){let e=u();return(0,Z.jsxs)(`div`,{className:m(`flex flex-col items-center gap-2 py-8 text-center`,x(`CheckoutExpired`,`The face shown when the session expired before completing`)),children:[(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`3`,weight:`semi-bold`,children:e(`fL0I3N`)}),(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`2`,className:`text-gray-a11`,children:e(`/ActXo`)})]})}function on(){let e=u();return(0,Z.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-8 text-center`,children:[(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`3`,weight:`semi-bold`,children:e(`7dYyKX`)}),(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`2`,className:`text-gray-a11`,children:e(`54uX9A`)})]})}function sn(e){let t=u();switch(e.code){case`out_of_stock`:return{title:t(`WHgdsk`),body:t(`wZJEr7`)};case`plan_archived`:return{title:t(`g41uEF`),body:t(`jyH6k/`)};
56case`product_archived`:return{title:t(`g41uEF`),body:t(`PjIoAN`)};case`purchases_disabled`:return{title:t(`2L1W5j`),body:t(`dl4dCg`)};case`blocked_country`:return{title:t(`S55xSO`),body:t(`KzsoVr`)};case`quick_link_out_of_stock`:return{title:t(`9D8j3I`),body:t(`aauVBr`)};case`quick_link_expired`:return{title:t(`WHFEY0`),body:t(`7aXygP`)};default:{let n=e;return{title:n.offered?t(`lkwOBf`):t(`g41uEF`),body:n.message}}}}function cn({error:e,compact:t=!1}){let{title:n,body:r}=sn(e);return t?(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`2`,className:m(`text-gray-a11 py-2 text-center`,x(`CheckoutBlocked`,`The notice standing in for the pay flow while the session carries a blocking error`)),children:n}):(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:m(`flex flex-1 flex-col items-center justify-center gap-2 py-8 text-center`,x(`CheckoutBlocked`,`The notice standing in for the pay flow while the session carries a blocking error`)),children:[(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`3`,weight:`semi-bold`,children:n}),(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`2`,className:`text-gray-a11`,children:r})]}),(0,Z.jsx)(pe,{})]})}function ln(){let e=(0,X.useMemo)(()=>new pt,[]);(0,X.useEffect)(()=>()=>e.detach(),[e]);let t=u(),r=l(),i=g(),{props:s,emit:d,Loading:f,state:p,origins:_}=b(),v=Bt({request:e=>d(`walletHandoffRequested`,e),conclude:e=>d(`walletHandoffConcluded`,e)},_),[y,te]=(0,X.useState)(!1),[S,C]=(0,X.useState)(`ready`),[w,ne]=(0,X.useState)(null),re=(0,X.useRef)(null),T=(0,X.useRef)({confirmAttemptNonce:s.confirmAttemptNonce,confirmNonce:s.confirmNonce});T.current={confirmAttemptNonce:s.confirmAttemptNonce,confirmNonce:s.confirmNonce};let ie=(0,X.useCallback)(e=>{te(e),e&&(re.current=T.current,C(`loading`))},[]),E=(0,X.useCallback)(()=>C(`error`),[]),D=(0,X.useCallback)(()=>{re.current=null,ne(null),C(`ready`)},[]),ae=(0,X.useCallback)(()=>ne({kind:`main`}),[]),oe=(0,X.useCallback)(e=>ne({kind:`express`,wallet:e}),[]),[se,ce]=(0,X.useState)([]),[O,k]=(0,X.useState)(null),[le,ue]=(0,X.useState)({}),[de,fe]=(0,X.useState)(()=>s.phoneNumber||ye(s.defaultValues?.phone)||``),[pe,me]=(0,X.useState)(!1),he=s.phoneCodeSentTo,ge=(0,X.useRef)(he);(0,X.useEffect)(()=>{ge.current!==void 0&&he===void 0&&fe(``),ge.current=he},[he]);let[A,_e]=(0,X.useState)(()=>{let e={...s.requirementValues};for(let t of s.requirements){let n=vn(t,s.buyerEmail,s.defaultValues?.phone);!e[t.key]&&n&&(e[t.key]=n)}return e});(0,X.useEffect)(()=>{_e(e=>{let t=e;for(let n of s.requirements){let r=n.key;r in t||(t===e&&(t={...e}),t[r]=s.requirementValues[r]??vn(n,s.buyerEmail,s.defaultValues?.phone)??``)}return t})},[s.buyerEmail,s.defaultValues?.phone,s.requirements,s.requirementValues]);let ve=(e,t)=>{_e(n=>({...n,[e]:t})),ue(t=>e in t?xn(t,e):t)},xe=s.quote,j=s.items[0],Ce=s.items.length>1,M=s.pricing,N=M?Me(M):void 0,we=(0,X.useRef)(null),P=p.sessionRef?.id??null;P&&we.current?.session!==P&&(we.current={session:P,skipped:!!s.quote.trial_skipped});let Ee=!!(s.quote.trial_skipped&&P&&we.current&&!we.current.skipped),De=`${P??``}|${s.breakdown.total.currency}|${s.breakdown.total.amount}`,[L,R]=(0,X.useState)(null),Oe=L===De,[ke,z]=(0,X.useState)(!1),B=(0,X.useRef)({required:Ee,acked:Oe});B.current={required:Ee,acked:Oe};let V=M?.planType===`renewal`&&(M.splitPayRequiredPayments??0)<=1,Ae=s.ctaLabel===`join_waitlist`,H=F(s.breakdown.total,r),U=s.breakdown.display?.headline,W=U?.kind===`free`&&U.free_until?Date.parse(U.free_until):NaN,G=U?.kind===`trial`&&U.trial_days!=null?t(`NIzL2Z`,{count:U.trial_days}):U?.kind===`free`?Number.isFinite(W)?t(`/Sm9Xa`,{date:new Intl.DateTimeFormat(r,{dateStyle:`long`}).format(new Date(W))}):t(`tf1lIh`):U?.kind===`setup`?t(`FObTyz`):U?.amount?F(U.amount,r):H,je=U?.kind===`free`||U?.kind===`setup`,Ne=U?.original_amount?F(U.original_amount,r):void 0,Pe=U?.context??[],K=s.breakdown.display?.sections,Fe=!!K&&[K.line_items,K.charges,K.totals,K.fee_breakdown].some(e=>e.length>0),q=s.branding,Ie=s.requirements.find(e=>e.type===`terms`),J=Ie?{...A,[Ie.key]:mt}:A,Le=s.requirements.filter(e=>e.type!==`terms`),Re=kt(s.requirements,A),ze=s.seller.terms?.required===!1&&Le.every(e=>e.type===`email`)&&Ct(Le,A).length===0&&(Re===void 0||Re.includes(`@`))&&s.taxBehavior===null&&!s.collectTaxId&&!s.nextActionBlocks&&!Ae&&s.transfer===null&&!s.quote.trial_skipped,Be=()=>s.checkoutInitiated?.(),Ve=()=>{Be(),s.checkoutRequested?.()},He=e=>ue(n=>({...n,[e]:t(`ehNe6V`)})),Ue=!s.phoneVerified&&s.requirements.some(e=>e.type===`phone_number`&&e.verify),Y=s.requirements.find(e=>e.type===`phone_number`),We=s.phoneNumber?Se(s.phoneNumber):void 0,Ge=Y!==void 0||We!==void 0,Ke=Y?.key,qe=(0,X.useCallback)(e=>{me(e),!e&&Ke&&ue(e=>Ke in e?xn(e,Ke):e)},[Ke]),Je=Y?.verify?Se(de)??s.phoneNumber:Y?Se(A[Y.key]??``):We,Ye=Ue&&s.phoneCodeSentTo===void 0?Se(de):void 0,Xe=(t,n=A,r,i,a)=>
56{if(B.current.required&&!B.current.acked){z(!0),te(!1),D(),Te(`failure`);return}d(`confirmRequested`,{browserBehavior:e.capture(),confirmationToken:t,paymentMethodType:r,values:n,...i===void 0?{}:{promoCode:i},...a===void 0?Ye===void 0?{}:{phoneNumber:Ye}:{phoneNumber:a}})},Ze=e=>ue(n=>({...n,...Object.fromEntries(e.map(e=>[e,e===Ke&&A[e]?.trim()&&!Je?t(`Sw8YrN`):t(e===`custom_password`?`i3mk5k`:e===`shipping_address`?`B+DPhI`:e===`terms`?`rsbPrv`:`80UWXL`)]))}));(0,X.useEffect)(()=>{if(S!==`loading`)return;let e=re.current;if(!(!e||s.confirmAttemptNonce<=e.confirmAttemptNonce||s.confirmNonce<=e.confirmNonce||s.confirming)){if(s.status===`completed`){s.resultStatus===`failed`?C(`error`):s.resultStatus===`processing`||s.resultStatus===`requires_action`?C(`result`):C(`success`);return}if(s.status===`expired`){C(`result`);return}if(s.nextActionType===`verify_phone`&&!s.phoneVerified&&s.phoneCodeSentTo!==void 0){re.current=null,ne(null),C(`ready`);return}C(`error`)}},[s.confirmAttemptNonce,s.confirming,s.confirmNonce,s.nextActionType,s.phoneCodeSentTo,s.phoneVerified,s.resultStatus,s.status,S]),(0,X.useEffect)(()=>{S!==`result`||s.status!==`open`||(re.current=null,ne(null),C(`ready`))},[s.status,S]),(0,X.useEffect)(()=>{S!==`ready`||s.status===`open`||C(`result`)},[s.status,S]);let Qe=(0,X.useCallback)(e=>{if(ne(null),e===`success`){C(`result`);return}if(s.status===`completed`&&s.resultStatus===`failed`){C(`result`),d(`identityStepRequested`,{});return}re.current=null,C(`ready`)},[d,s.resultStatus,s.status]),$e=S===`loading`&&w!==null,et=$e?s.ctaLabel===`join_waitlist`?t(`LA3i/a`):s.mode===`setup`?t(`3DuWdr`):t(`CRl9hx`):void 0,tt=S===`result`,nt=S===`loading`||S===`error`||S===`success`?S:void 0,rt=w?.kind===`express`?w.wallet:null,it=rt?nt:void 0,at=w?.kind===`main`?nt:w?.kind===`express`?`disabled`:void 0,ct=s.blockingError&&!y&&!s.confirming&&S===`ready`?s.blockingError:null;return s.compact?(0,Z.jsxs)(be,{fallback:(0,Z.jsx)(f,{}),accountId:s.seller.id,currency:xe.currency,...s.mode===`setup`?{mode:`setup`}:{amount:I(Number(s.breakdown.total.amount),s.breakdown.total.currency),offerAmounts:s.offerAmounts},paymentMethodConfiguration:s.paymentMethodConfiguration,setupFutureUsage:s.setupFutureUsage,returnUrl:s.returnUrl??void 0,checkoutSession:p.sessionRef,children:[(0,Z.jsx)(On,{}),ct?(0,Z.jsx)(cn,{compact:!0,error:ct}):ze?(0,Z.jsx)(wn,{behaviorRootRef:e.attach,compact:!0,billingPhone:Je,checkoutCollectsPhone:Ge,onBillingPhoneRequiredChange:qe,minting:y,onMintingChange:ie,onSubmissionStarted:ae,submissionButtonState:nt,onSubmissionFailed:E,onSubmissionCanceled:D,onSubmissionAnimationComplete:Qe,values:A,implicitTermsValues:J,onEmailInvalid:He,onConfirmationToken:Xe,total:H,schedule:N,pricing:M,onIncomplete:Ze,beforePay:Be,onCheckoutRequested:Ve}):(0,Z.jsx)(c,{type:`button`,size:`3`,variant:`solid`,className:`w-full`,onClick:Ve,children:t(`ciFSHC`,{amount:H})})]}):(0,Z.jsxs)(be,{fallback:(0,Z.jsx)(f,{}),accountId:s.seller.id,currency:xe.currency,...s.mode===`setup`?{mode:`setup`}:{amount:I(Number(s.breakdown.total.amount),s.breakdown.total.currency),offerAmounts:s.offerAmounts},paymentMethodConfiguration:s.paymentMethodConfiguration,setupFutureUsage:s.setupFutureUsage,previewWalletAvailability:s.brandingPreview?{applePay:!1,googlePay:!0}:void 0,returnUrl:s.returnUrl??void 0,checkoutSession:p.sessionRef,children:[(0,Z.jsx)(On,{}),(0,Z.jsxs)(`div`,{ref:e.attach,className:m(`@container`,x(`Checkout`,`The checkout element root`)),style:q?.vars,children:[q?.fontUrl?(0,Z.jsx)(`link`,{href:q.fontUrl,rel:`stylesheet`}):null,q?.recolored?(0,Z.jsx)(`style`,{children:st()}):null,(0,Z.jsxs)(`div`,{className:m(`flex min-h-viewport flex-col gap-0 @5xl:flex-row @5xl:items-stretch @5xl:gap-0`,x(`CheckoutLayout`,`The two-column/stacked layout row â order details and collection side by side in wide containers, stacked in narrow ones`)),children:[(0,Z.jsx)(`div`,{className:m(`flex min-w-0 flex-col gap-4 px-4 pt-4 pb-6 @5xl:sticky @5xl:top-0 @5xl:h-viewport @5xl:w-1/2 @5xl:shrink-0 @5xl:flex-row @5xl:items-start @5xl:justify-end @5xl:p-20`,x(`CheckoutDetails`,`The order-details column â summary, currency, promo. Sits beside the collection column in wide containers, above it in narrow ones`)),...q?.recolored?{[ot]:``}:{},children:(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-4 @5xl:w-[380px] @5xl:min-w-[380px]`,children:[s.brandingPreview?(0,Z.jsx)(fn,{total:H}):(0,Z.jsxs)(`div`,{className:m(`flex w-full flex-col gap-1`,x(`CheckoutSummary`,`The order summary block â seller, items, and the live total`)),children:[(0,Z.jsxs)(`div`,{className:m(`flex items-start justify-between gap-3`,x(`CheckoutSummaryHead`,`The seller line, with the order-details trigger opposite it in a narrow container`)),children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,Z.jsx)(n,{fallback:s.seller.title,shape:`square`,size:`1`,src:s.seller.logo_url??void 0,className:m(`shrink-0`,x(`CheckoutSellerLogo`,`The seller logo beside the seller title, initials when none is uploaded`))}
56),(0,Z.jsx)(a,{size:`2`,weight:`medium`,className:m(`text-gray-11 min-w-0 flex-1 break-words`,x(`CheckoutSeller`,`The seller title line`)),children:s.seller.title})]}),(!je||Fe)&&(0,Z.jsx)(`button`,{type:`button`,onClick:()=>d(`detailsRequested`,{}),className:m(`text-2 text-gray-11 shrink-0 underline underline-offset-2 @5xl:hidden`,x(`CheckoutDetailsToggle`,`The narrow-container affordance that opens the order-details sheet`)),children:s.showPromoInput||s.promoCode||s.promoCodeRefused?t(`Z8+DhZ`):t(`Lv0zJu`)})]}),!Ce&&j?.name&&(0,Z.jsxs)(`div`,{className:m(`mt-4 flex min-w-0 items-center justify-center gap-2 @5xl:mt-1 @5xl:justify-start`,x(`CheckoutItem`,`The item line â what is being bought, named the way the seller sells it. Centered above the price in a narrow container, left-aligned beside the collection column`)),children:[j.image_url&&(0,Z.jsx)(n,{fallback:j.name,shape:`square`,size:`1`,src:j.image_url,className:`shrink-0`}),(0,Z.jsx)(a,{size:`2`,weight:`medium`,className:`text-gray-a11 min-w-0 text-center break-words @5xl:flex-1 @5xl:text-left`,children:V?t(`NRANk9`,{name:j.name}):j.name})]}),!Ce&&j?.headline&&(0,Z.jsx)(a,{size:`1`,className:m(`text-gray-a10 text-center break-words @5xl:text-left`,x(`CheckoutItemHeadline`,`The one-line description under the item â the checkout linkâs own wording, else the productâs headline`)),children:j.headline}),(0,Z.jsxs)(`div`,{className:m(`flex flex-col items-center gap-1 pt-3 @5xl:items-start @5xl:pt-0`,x(`CheckoutPrice`,`The price block â centered under the seller line in a narrow container, left-aligned beside the collection column`)),children:[(0,Z.jsxs)(`span`,{className:`flex shrink-0 flex-col items-center @5xl:flex-row @5xl:items-baseline @5xl:gap-2`,children:[Ne&&(0,Z.jsx)(`s`,{className:m(`text-2 text-gray-a10 whitespace-nowrap`,x(`CheckoutTotalOriginal`,`The pre-promo total, struck through beside the discounted one`)),children:Ne}),(0,Z.jsx)(a,{size:`8`,weight:`semi-bold`,className:m(`shrink-0 whitespace-nowrap`,x(`CheckoutTotal`,`The quoted total the buyer pays`)),children:G})]}),Pe.map((e,t)=>(0,Z.jsx)(a,{size:`1`,className:`text-gray-a10 text-center break-words @5xl:text-left ${x(`CheckoutPriceContext`,`Each context line under the quoted total â the billing period, "Due today", what follows the trial, and a stepping promoâs return price`)}`,children:(0,Z.jsx)(Wt,{row:e})},`${e.kind}-${t}`))]}),Ce&&(0,Z.jsx)(un,{items:s.items,breakdown:s.breakdown}),!Ce&&j&&j.quantity>1&&(0,Z.jsx)(a,{size:`1`,className:m(`text-gray-a10`,x(`CheckoutQuantity`,`The quantity line, shown above 1`)),children:t(`lVEq9q`,{count:String(j.quantity)})}),s.quote.trial_skipped&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 ${x(`CheckoutTrialSkippedNotice`,`The notice shown when the buyer has already used the planâs free trial and is charged the full price today`)}`,children:[(0,Z.jsx)(a,{size:`1`,className:`text-amber-11 break-words`,children:t(`R6mRMq`,{amount:H})}),Ee&&(0,Z.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 ${x(`CheckoutTrialSkippedAck`,`The acknowledgment a buyer must tick when the trial skip was resolved only after they signed in mid-checkout`)}`,children:[(0,Z.jsx)(o,{checked:Oe,onCheckedChange:e=>{R(e===!0?De:null),z(!1)},className:`mt-0.5 ${x(`CheckoutTrialSkippedCheckbox`,`The acknowledgment checkbox itself`)}`}),(0,Z.jsx)(a,{size:`1`,className:`break-words`,children:t(`eJ8EHn`,{amount:H})})]}),ke&&(0,Z.jsx)(a,{size:`1`,className:`text-red-11 ${x(`CheckoutFieldError`,`Every inline field-level error line (email, promo, currency)`)}`,children:t(`QCJy67`)})]}),s.invoiceDueAt&&(0,Z.jsx)(qt,{dueAt:s.invoiceDueAt})]}),(0,Z.jsxs)(`div`,{className:`hidden flex-col gap-4 @5xl:flex`,children:[(0,Z.jsx)(Sn,{locked:y}),(s.showPromoInput||s.promoCode||s.promoCodeRefused)&&(0,Z.jsx)(Cn,{locked:y}),(0,Z.jsx)(Kt,{display:s.breakdown.display}),j?.description&&(0,Z.jsx)(Jt,{description:j.description})]})]})}),(0,Z.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,role:`status`,children:et}),(0,Z.jsx)(`div`,{"aria-busy":$e?!0:void 0,className:m(`bg-background flex min-w-0 flex-1 flex-col px-4 pt-2 pb-4 @5xl:w-1/2 @5xl:items-start @5xl:justify-start @5xl:p-20 @5xl:pb-20`,tt&&`@5xl:justify-center`,x(`CheckoutCollection`,`The collection column â email, payment methods, and the pay flow`)),children:(0,Z.jsx)(`div`,{className:m(`flex w-full flex-col @5xl:w-[380px] @5xl:min-w-[380px]`,ct&&`flex-1`),"data-submission-state":S,inert:$e?!0:void 0,children:ct?(0,Z.jsx)(cn,{error:ct}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(dn,{visible:!tt,children:(0,Z.jsx)(`div`,{className:m(se.length>0&&`pb-6`),children:(0,Z.jsx)(Pt,{origins:_,handoff:v,accountId:s.seller.id,currency:s.quote.currency,total:s.breakdown.total,offerAmounts:s.offerAmounts,setupFutureUsage:s.setupFutureUsage,requirements:s.requirements,paymentMethodRequired:s.paymentMethodRequired,paymentMethodConfiguration:s.paymentMethodConfiguration,brandingPreview:s.brandingPreview,nextActionBlocks:s.nextActionBlocks,ctaLabel:s.ctaLabel,mode:s.mode,transfer:s.transfer,confirming:s.confirming,promoPending:s.promoPending,currencyPending:s.currencyPending,phoneCodePending:s.phoneCodePending,showPromoInput:s.showPromoInput,promoCode:s.promoCode,promo:s.promo,activeWallet:rt,submissionButtonState:it,isSubmissionEnabled:w?.kind!==`main`,sessionRef:p.sessionRef,minting:y,onMintingChange:ie,onSubmissionStarted:oe,onPaymentFailed:E,onPaymentCanceled:D,onSubmissionAnimationComplete:Qe,onOfferedWalletsChange:ce,showDivider:O===!0,values:A,onValue:ve,onConfirmationToken:Xe,onIncomplete:Ze,refusePay:()=>B.current.required&&!B.current.acked?(z(!0),!0):!1})})}),(0,Z.jsx)(dn,{visible:!tt,children:(0,Z.jsx)(`div`,{className:`pb-6`,children:(0,Z.jsx)(pn,{values:A,errors:le,onValue:ve,except:[`terms`],billingPhoneRequired:pe})})}),(0,Z.jsx)(dn,{visible:!tt,children:(0,Z.jsx)(En,{phoneNumber:de,ph
56oneNumberChanged:fe})}),(0,Z.jsx)(ee,{initial:!1,children:tt?(0,Z.jsx)(h.div,{animate:{opacity:1,y:0},exit:i?{opacity:0}:{opacity:0,y:-8},initial:i?{opacity:1}:{opacity:0,y:8},transition:{duration:i?0:.24,ease:[.23,1,.32,1]},children:(0,Z.jsx)(Xt,{paymentsProvided:!0})},`checkout-result`):null}),(0,Z.jsx)(dn,{visible:!tt,children:(0,Z.jsx)(wn,{minting:y,onMintingChange:ie,phoneRideReady:Ye!==void 0,billingPhone:Je,checkoutCollectsPhone:Ge,onBillingPhoneRequiredChange:qe,onSubmissionStarted:ae,submissionButtonState:at,resultVisible:tt,onSubmissionFailed:E,onSubmissionCanceled:D,onSubmissionAnimationComplete:Qe,excludedPaymentMethodTypes:se,alternativePaymentMethodsAvailable:O,alternativePaymentMethodAvailabilityChanged:k,values:A,onEmailInvalid:He,onConfirmationToken:Xe,total:H,schedule:N,pricing:M,onIncomplete:Ze,refusePay:()=>B.current.required&&!B.current.acked?(z(!0),!0):!1,beforeSubmit:(0,Z.jsx)(pn,{values:A,errors:le,onValue:ve,only:[`terms`]})})})]})})})]})]})]})}function un({items:e,breakdown:t}){let r=u(),i=l();return(0,Z.jsx)(`div`,{className:m(`border-gray-a5 mt-3 flex flex-col gap-3 border-t pt-4`,x(`CheckoutCartItems`,`The itemized cart directly below the total for a checkout containing multiple items`)),children:e.map((e,o)=>{let s=t.lines[o],c=e.name??s?.description??r(`5ujeDa`);return(0,Z.jsxs)(`div`,{className:m(`flex min-w-0 items-center justify-between gap-3`,x(`CheckoutCartItem`,`One product, quantity, and server-priced amount in a multi-item cart`)),children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[e.image_url&&(0,Z.jsx)(n,{fallback:c,shape:`square`,size:`1`,src:e.image_url,className:`shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(a,{size:`2`,weight:`medium`,className:`min-w-0 break-words`,children:c}),e.quantity>1&&(0,Z.jsx)(a,{size:`1`,className:`text-gray-a10`,children:r(`lVEq9q`,{count:String(e.quantity)})})]})]}),s?.amount&&(0,Z.jsx)(a,{size:`2`,weight:`medium`,className:`shrink-0 whitespace-nowrap`,children:F(s.amount,i)})]},e.plan)})})}function dn({visible:e,children:t}){let n=g();return(0,Z.jsx)(h.div,{animate:e?{height:`auto`,opacity:1,y:0}:{height:0,opacity:0,y:-8},"aria-hidden":e?void 0:!0,className:`overflow-hidden`,initial:!1,inert:e?void 0:!0,transition:{duration:n?0:.28,ease:[.23,1,.32,1]},children:t})}function fn({total:e}){let t=u(),{props:r}=b();return(0,Z.jsxs)(`div`,{className:m(`flex w-full flex-col gap-4`,x(`CheckoutSummary`,`The order summary block â seller, items, and the live total`)),children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[r.seller.logo_url?(0,Z.jsx)(n,{fallback:r.seller.title,shape:`square`,size:`2`,src:r.seller.logo_url}):null,(0,Z.jsx)(a,{size:`2`,weight:`medium`,className:m(`text-gray-11 min-w-0 flex-1 truncate`,x(`CheckoutSeller`,`The seller title line`)),children:r.seller.title})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(a,{size:`2`,className:`text-gray-a10`,children:t(`6jaT0l`,{seller:r.seller.title})}),(0,Z.jsx)(a,{size:`8`,weight:`semi-bold`,className:x(`CheckoutTotal`,`The quoted total the buyer pays`),children:e}),(0,Z.jsx)(a,{size:`1`,className:`text-gray-a10`,children:t(`Rw82/V`)})]}),(0,Z.jsxs)(`div`,{className:`border-gray-a5 flex items-center justify-between border-t pt-4`,children:[(0,Z.jsx)(a,{size:`1`,weight:`medium`,children:t(`MxAykv`)}),(0,Z.jsx)(a,{size:`1`,weight:`semi-bold`,children:e})]})]})}function pn({billingPhoneRequired:e=!1,values:t,errors:n,onValue:r,only:i,except:a}){let{props:o}=b(),s=o.requirements.filter(St).filter(e=>!(e.type===`phone_number`&&e.verify)).filter(e=>i?i.includes(e.type):!0).filter(e=>a?!a.includes(e.type):!0),c=wt(o.requirements);return s.length===0&&c.length===0?null:(0,Z.jsxs)(`div`,{className:m(`flex flex-col gap-3 px-1`,x(`CheckoutRequirements`,`The requirements form â every value this checkout collects, rendered as one block in the order the server declared`)),children:[s.map(i=>(0,Z.jsx)(mn,{row:i.type===`phone_number`&&e?{...i,holdsSale:!0}:i,value:t[i.key]??``,error:n[i.key],onValue:r},i.key)),c.length>0&&(0,Z.jsx)(bn,{})]})}function mn({row:e,value:t,error:n,onValue:r}){let i=u(),s=(0,X.useId)(),{props:c}=b(),l=e.key;if(e.type===`email`)return(0,Z.jsx)(hn,{rowKey:l,value:t,error:n,onValue:r});if(e.type===`custom_password`)return(0,Z.jsx)(gn,{rowKey:l,value:t,error:n,onValue:r});if(e.type===`shipping_address`)return(0,Z.jsx)(yn,{row:e,value:t,error:n,onValue:r});if(e.type===`terms`)return(0,Z.jsxs)(`div`,{className:m(`flex flex-col gap-1`,x(`CheckoutRequirementRow`,`One collected value â its label, its input, and its inline error`)),children:[(0,Z.jsxs)(`label`,{className:m(`flex items-start gap-2`,x(`CheckoutTermsAccept`,`The explicit terms-acceptance row, rendered only when the session requires an explicit act of acceptance`)),children:[(0,Z.jsx)(o,{size:`1`,checked:t!==``,onCheckedChange:e=>r(l,e?mt:``),"aria-invalid":n?!0:void 0,"aria-describedby":n?s:void 0,className:m(`mt-0.5`,x(`CheckoutTermsCheckbox`,`The terms-acceptance checkbox`))}),(0,Z.jsx)(a,{size:`2`,children:c.brandingPreview?i(`0ItmS4`,{seller:c.seller.title}):i(`DPrgWW`)})]}),n&&(0,Z.jsx)(a,{id:s,size:`1`,className:m(`text-red-11`,x(`CheckoutFieldError`,`Every inline field-level error line (email, promo, currency)`)),children:n})]});let d=e.type===`phone_number`?{label:i(`jdJhOL`),type:`tel`,autoComplete:`tel`,placeholder:i(`v30i60`)}:e.field?{label:e.field.name,type:`text`,autoComplete:`off`,placeholder:e.field.placeholder??``}:null;return d?(0,Z.jsxs)(`label`,{className:m(`flex flex-col gap-1`,x(`CheckoutRequirementRow`,`One collected value â its label, its input, and its inline error`)),children:[(0,Z.jsxs)(a,{size:`2`,
56weight:`medium`,className:m(`text-gray-11 break-words`,x(`CheckoutRequirementLabel`,`A collected valueâs label`)),children:[d.label,e.holdsSale&&!c.brandingPreview&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:m(`text-red-11 ml-1`,x(`CheckoutRequirementRequired`,`The marker beside a value an answer is required for`)),children:`*`})]}),(0,Z.jsx)(`input`,{type:d.type,value:t,required:e.holdsSale,autoComplete:d.autoComplete,onChange:e=>r(l,e.target.value),placeholder:d.placeholder,"aria-label":e.holdsSale?i(`Jpuxyv`,{label:d.label}):d.label,className:m(`text-2 h-11 rounded-lg border border-[var(--gray-a6)] bg-transparent px-3 outline-none focus:border-[var(--accent-8)]`,x(`CheckoutRequirementInput`,`A collected valueâs input`))}),n&&(0,Z.jsx)(a,{size:`1`,className:m(`text-red-11`,x(`CheckoutFieldError`,`Every inline field-level error line (email, promo, currency)`)),children:n})]}):null}function hn({rowKey:e,value:t,error:n,onValue:r}){let{props:i}=b(),o=(0,X.useRef)(null);return y(Q,`driveVerifyPhone`,async()=>{await o.current?.requestPhoneVerification()},i.paymentMethodRequired===!1),(0,Z.jsxs)(`div`,{className:m(`-mx-1 flex flex-col gap-1`,x(`CheckoutRequirementRow`,`One collected value â its label, its input, and its inline error`)),children:[(0,Z.jsx)(fe,{ref:o,defaultValue:t,locked:!!(i.lockBuyerEmail&&i.buyerEmail&&t===i.buyerEmail),onChange:({email:t})=>r(e,t)}),n&&(0,Z.jsx)(a,{size:`1`,className:m(`text-red-11`,x(`CheckoutFieldError`,`Every inline field-level error line (email, promo, currency)`)),children:n})]})}function gn({rowKey:e,value:t,error:n,onValue:r}){let i=u(),{props:o,emit:s}=b(),l=(0,X.useRef)(null),d=e=>{let n=t.trim();n===``||o.passwordPending||o.phoneCodePending||o.confirming||!e&&l.current===n||(l.current=n,s(`submitPassword`,{password:n}))},f=n??(o.passwordFailed?i(`hMu67v`):void 0);return(0,Z.jsxs)(`div`,{className:m(`flex flex-col gap-1`,x(`CheckoutRequirementRow`,`One collected value â its label, its input, and its inline error`)),children:[(0,Z.jsxs)(a,{size:`2`,weight:`medium`,className:m(`text-gray-11 break-words`,x(`CheckoutRequirementLabel`,`A collected valueâs label`)),children:[i(`5sg7KC`),(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:m(`text-red-11 ml-1`,x(`CheckoutRequirementRequired`,`The marker beside a value an answer is required for`)),children:`*`})]}),(0,Z.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[(0,Z.jsx)(`input`,{type:`password`,value:t,required:!0,autoComplete:`off`,onChange:t=>r(e,t.target.value),onBlur:()=>d(!1),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d(!0))},"aria-label":i(`Jpuxyv`,{label:i(`5sg7KC`)}),className:m(`text-2 h-11 min-w-0 flex-1 rounded-lg border border-[var(--gray-a6)] bg-transparent px-3 outline-none focus:border-[var(--accent-8)]`,x(`CheckoutRequirementInput`,`A collected valueâs input`))}),(0,Z.jsx)(c,{type:`button`,size:`2`,variant:`surface`,color:`gray`,disabled:o.passwordPending||o.phoneCodePending||o.confirming||t.trim()===``,onClick:()=>d(!0),className:m(`h-11 shrink-0`,x(`CheckoutPasswordUnlock`,`The control that submits the checkout password`)),children:o.passwordPending?i(`PfxzLv`):i(`qXCbgZ`)})]}),f&&(0,Z.jsx)(a,{size:`1`,className:m(`text-red-11`,x(`CheckoutFieldError`,`Every inline field-level error line (email, promo, currency)`)),children:f})]})}var _n={mode:`shipping`,layout:`compact`,scope:`full`,name:`combined`,organization:`none`,line2:`always`,autocomplete:!0};
56function vn(e,t,n){if(e.type===`email`)return t||void 0;if(e.type===`phone_number`&&!e.verify)return ye(n)}function yn({row:e,value:t,error:n,onValue:r}){let i=u(),{props:o,emit:s}=b(),c=e.key,l=oe({detectCountry:!0}),d=(0,X.useRef)(null),f=(0,X.useCallback)(e=>{d.current=e},[]),[p]=(0,X.useState)(()=>_t(t||o.requirementValues[c]||``)??o.defaultValues?.shippingAddress),h=Ce(({complete:e,address:t})=>s(`shippingAddressChanged`,{address:e?t:null})),ee=(0,X.useRef)(null),g=(0,X.useCallback)(e=>{let t=e.complete?gt(e.address):``;ee.current!==t&&(ee.current=t,r(c,t)),h.publish(c,{complete:e.complete,address:xe(e.address)})},[c,r,h]);return(0,X.useEffect)(()=>{n&&d.current?.snapshot({revealErrors:!0})},[n]),(0,Z.jsxs)(`div`,{className:m(`flex flex-col gap-1`,x(`CheckoutRequirementRow`,`One collected value â its label, its input, and its inline error`),x(`CheckoutShippingAddress`,`The shipping address section, rendered when the session requires one`)),children:[(0,Z.jsxs)(a,{size:`2`,weight:`medium`,className:m(`text-gray-11 break-words`,x(`CheckoutRequirementLabel`,`A collected valueâs label`)),children:[i(`ZpVtCa`),e.holdsSale&&!o.brandingPreview&&(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:m(`text-red-11 ml-1`,x(`CheckoutRequirementRequired`,`The marker beside a value an answer is required for`)),children:`*`})]}),l.ready&&l.catalog?(0,Z.jsx)(E,{config:_n,catalog:l.catalog,seed:{defaultValues:p?{address:p}:void 0,detectedCountry:l.detectedCountry,countryHint:D(o.displayCurrency)},children:(0,Z.jsx)(ce,{config:_n,catalog:l.catalog,connect:f,onSnapshot:g})}):(0,Z.jsxs)(`div`,{"aria-busy":`true`,className:`border-gray-a6 animate-pulse overflow-hidden rounded-lg border`,children:[(0,Z.jsx)(`div`,{className:`flex h-11 items-center px-3`,children:(0,Z.jsx)(`div`,{className:`bg-gray-a3 h-3 w-24 rounded`})}),(0,Z.jsx)(`div`,{className:`border-gray-a5 flex h-11 items-center border-t px-3`,children:(0,Z.jsx)(`div`,{className:`bg-gray-a3 h-3 w-32 rounded`})}),(0,Z.jsx)(`div`,{className:`border-gray-a5 flex h-11 items-center border-t px-3`,children:(0,Z.jsx)(`div`,{className:`bg-gray-a3 h-3 w-20 rounded`})}),(0,Z.jsxs)(`div`,{className:`border-gray-a5 flex border-t`,children:[(0,Z.jsx)(`div`,{className:`flex h-11 flex-1 items-center px-3`,children:(0,Z.jsx)(`div`,{className:`bg-gray-a3 h-3 w-16 rounded`})}),(0,Z.jsx)(`div`,{className:`border-gray-a5 flex h-11 flex-1 items-center border-l px-3`,children:(0,Z.jsx)(`div`,{className:`bg-gray-a3 h-3 w-12 rounded`})})]})]}),n&&(0,Z.jsx)(a,{size:`1`,className:m(`text-red-11`,x(`CheckoutFieldError`,`Every inline field-level error line (email, promo, currency)`)),children:n})]})}function bn(){let e=u();return(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`1`,className:m(`text-red-11`,x(`CheckoutUncollectable`,`The line shown when the checkout requires something this surface cannot collect`)),children:e(`fOihtV`)})}function xn(e,t){let{[t]:n,...r}=e;return r}function Sn({locked:e}){let{props:t,emit:n}=b();return(0,Z.jsx)(Vt,{quote:t.quote,displayCurrency:t.displayCurrency,availableCurrencies:t.availableCurrencies,currencyPending:t.currencyPending,currencyFailed:t.currencyFailed,disabled:e||t.promoPending||t.phoneCodePending||t.confirming,onSwitch:e=>n(`selectDisplayCurrency`,{currency:e})})}function Cn({locked:e}){let{props:t,emit:n}=b();return(0,Z.jsx)(Ht,{promoCode:t.promoCode,promoCodeRefused:t.promoCodeRefused,promo:t.promo,breakdown:t.breakdown,promoError:t.promoError,promoPending:t.promoPending,disabled:e||t.promoPending||t.currencyPending||t.phoneCodePending||t.confirming,onApply:e=>n(`applyPromo`,{code:e}),onRemove:()=>n(`applyPromo`,{code:null})})}function wn({behaviorRootRef:e,compact:t=!1,billingPhone:n,checkoutCollectsPhone:r=!1,onBillingPhoneRequiredChange:i,phoneRideReady:o=!1,minting:s,onMintingChange:c,excludedPaymentMethodTypes:l=[],alternativePaymentMethodsAvailable:d=null,alternativePaymentMethodAvailabilityChanged:f,values:p,implicitTermsValues:h,onEmailInvalid:ee,onConfirmationToken:g,total:_,schedule:v,pricing:te,beforeSubmit:S,beforePay:w,onSubmissionStarted:ne,onCheckoutRequested:re,onIncomplete:T,refusePay:ie,submissionButtonState:E,resultVisible:D=!1,onSubmissionFailed:oe,onSubmissionCanceled:se,onSubmissionAnimationComplete:ce}){let O=u(),{props:k,emit:fe,state:me}=b(),he=ae(),ge=C(be),A=k.paymentMethodRequired!==!1,_e=l.length===0||d===!0,ve=k.availableCurrencies.find(e=>e!==k.displayCurrency),ye=(0,X.useRef)(null),xe=e=>fe(`taxAddressChanged`,{address:e}),[Se,j]=(0,X.useState)(``),[Ce,M]=(0,X.useState)(),N=ge.state.selectedType,we=A&&N===`splitit`,P=r&&N===`splitit`;(0,X.useEffect)(()=>{i?.(we)},[we,i]),(0,X.useEffect)(()=>{let e=me.sessionRef?.id;!N||!e||he.emit({type:`payment_method_resolved`,sessionId:e,botId:k.seller.id,paymentMethodType:N})},[he,N,me.sessionRef?.id,k.seller.id]);let[Te,De]=(0,X.useState)(null);y(Q,`driveNextAction`,({clientSecret:e})=>Ae(()=>ge.handleNextAction({clientSecret:e})),!0),y(Q,`driveVerifyPhone`,async()=>{await ye.current?.requestPhoneVerification()},A),(0,X.useEffect)(()=>{c(!1)},[k.confirming,k.confirmNonce]);let F=s||k.confirming,I=k.promoPending||k.currencyPending||k.phoneCodePending,L=h??p,R=Ct(k.requirements,L).length===0,Oe=!k.phoneVerified&&k.requirements.some(e=>e.type===`phone_number`&&e.verify)&&k.phoneCodeSentTo===void 0&&!o,ke=k.nextActionBlocks&&!(o&&k.nextActionType===`verify_phone`&&!k.phoneVerified)||Oe,z=E??(F?`loading`:I||ke||t&&A&&Te===null?`disabled`:`ready`),B=ge.state.selectedSubmitButton,V=B!==void 0&&(z===`ready`||z===`disabled`)&&!t,H=kt(k.requirements,L),U=async()=>
56{if(F||I||ke)return;if(!R){T(Ct(k.requirements,L).map(e=>e.key));return}if(we&&P&&!n){let e=k.requirements.find(e=>e.type===`phone_number`);e&&T([e.key]);return}if(ie?.())return;let e=k.requirements.find(e=>e.type===`email`);if(e&&H!==void 0&&!H.includes(`@`)){ee(e.key);return}if(M(void 0),ne?.(),c(!0),w?.(),!A){g(null,L);return}de();try{let{confirmationToken:e,type:t}=await ge.createConfirmationToken({billingDetails:{...H?{email:H}:{},...P&&n?{phone:n}:{}}});g(e,L,t)}catch(e){if(e instanceof Error&&e.message===`payment_request_cancelled`){se?.(),c(!1);return}let t=je(e);M((t?.code===`billing_details_incomplete`?O(`gTrUZx`):t?.message)??(e instanceof Error?e.message:O(`oEtik0`))),me.sessionRef&&he.emit({type:`error`,sessionId:me.sessionRef.id,stage:`confirmation_token`,errorCode:t?.code??`confirmation_token_failed`,errorMessage:`A payment confirmation token could not be created.`,failureStage:t?.failureStage,paymentMethodType:N}),oe?.(),c(!1)}finally{le()}},W=k.ctaLabel===`join_waitlist`,G=k.mode===`setup`,Me=z===`loading`?O(W?`LA3i/a`:G?`3DuWdr`:`CRl9hx`):z===`success`?O(W?`rphbMp`:G?`JePOJl`:`iZ/Q2q`):z===`error`?O(W?`FY0wLd`:G?`IYisxL`:`qV+TFm`):void 0;return(0,Z.jsxs)(`div`,{ref:e,className:`flex flex-col`,children:[(0,Z.jsx)(dn,{visible:!D,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 pb-3`,children:[A&&(0,Z.jsx)(ue,{ref:ye,savedOnly:t,savedMethodAvailabilityChanged:t?De:void 0,changeSavedMethodRequested:t?re:void 0,checkoutSurface:k.checkoutSurface,showComingSoonPaymentMethods:k.showComingSoonPaymentMethods,composedPlan:k.items[0]?.plan,composedPromoCode:k.promoCode,excludedPaymentMethodTypes:l,alternativePaymentMethodAvailabilityChanged:f,currencyFallback:ve?{currency:ve,pending:k.currencyPending}:void 0,onCurrencyFallbackRequested:({currency:e})=>fe(`selectDisplayCurrency`,{currency:e}),defaultValues:k.defaultValues?.billingDetails?{billingDetails:k.defaultValues.billingDetails}:void 0,fields:{billingDetails:k.taxBehavior?`full`:`minimal`,phone:P?`never`:`auto`},onChange:({supportsBuyerFee:e})=>{fe(`buyerFeeSupportChanged`,{supportsBuyerFee:e??null})},onAddressChange:({complete:e,address:t})=>{j(t.country??``),xe(e?t:null)}}),k.collectTaxId&&A&&!k.brandingPreview&&(0,Z.jsx)(Tn,{country:Se}),k.brandingPreview?null:S,(0,Z.jsx)(Dn,{})]})}),!D&&E!==`loading`&&E!==`success`&&(Ce??k.confirmError)&&(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`1`,className:m(`text-red-11 px-1 pb-3`,x(`CheckoutError`,`The retryable error line under the payment surface`)),children:Ce??(0,Z.jsx)(Mn,{error:k.confirmError,saving:G})}),(0,Z.jsx)(`div`,{className:`px-1`,hidden:D,children:(!A||_e||E!==void 0||D)&&(0,Z.jsx)(Ee,{type:`button`,size:`3`,variant:`solid`,color:V?void 0:`gray`,highContrast:!V,buttonState:z,isColorPreserved:E===`disabled`,statusText:Me,onAnimationComplete:ce,onClick:t&&A&&Te===!1?re:U,className:m(`min-h-[55px] w-full`,V&&`overflow-hidden !p-0 disabled:!opacity-50`,x(`CheckoutPayButton`,`The pay button`)),children:t&&A&&Te===null?O(`T4VxQN`):t?O(`ciFSHC`,{amount:_}):V?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(et,{button:B}),(0,Z.jsx)(`span`,{className:`sr-only`,children:(0,Z.jsx)(kn,{ctaLabel:k.ctaLabel,schedule:v,pricing:te})})]}):(0,Z.jsx)(kn,{ctaLabel:k.ctaLabel,schedule:v,pricing:te})})}),(0,Z.jsx)(dn,{visible:!D,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3 pt-3`,children:[k.brandingPreview&&!D?S:null,!t&&!D&&(0,Z.jsx)(jn,{schedule:v}),(0,Z.jsx)(pe,{})]})})]})}function Tn({country:e}){let t=u(),{props:n,emit:r}=b(),i=n.taxId??null,[s,c]=(0,X.useState)(i!==null&&i.value!==``),l=n.taxIdPending||n.phoneCodePending||n.confirming,d=({taxId:e})=>{l||i!==null&&i.type===e.type&&i.value===e.value||r(`taxIdChanged`,{taxId:e})},f=e=>{c(e),!(e||i===null||i.value===``)&&r(`taxIdChanged`,{taxId:null})};return(0,Z.jsxs)(`div`,{className:m(`flex flex-col gap-2 px-1`,x(`CheckoutCompanyPurchase`,`The company-purchase block â the checkbox and the tax registration fields it reveals`)),children:[(0,Z.jsxs)(`label`,{className:`flex items-start gap-2`,children:[(0,Z.jsx)(o,{size:`1`,checked:s,disabled:l,onCheckedChange:e=>f(e===!0),className:m(`mt-0.5`,x(`CheckoutCompanyPurchaseCheckbox`,`The checkbox that reveals the tax registration fields`))}),(0,Z.jsx)(a,{size:`2`,children:t(`VGLqq1`)})]}),s&&(0,Z.jsx)(j,{country:e,defaultValue:i??void 0,disabled:l,error:n.taxIdFailed?t(`J8wDkk`):``,onChange:d})]})}function En({phoneNumber:e,phoneNumberChanged:t}){let{props:n}=b();return n.phoneVerified||!n.requirements.some(e=>e.type===`phone_number`&&e.verify)?null:(0,Z.jsx)(`div`,{className:`px-1 pb-6`,children:(0,Z.jsx)(Rt,{phoneNumber:e,phoneNumberChanged:t,sentTo:n.phoneCodeSentTo,pending:n.phoneCodePending,errorCode:n.phoneCodeError,sessionBusy:n.confirming||n.promoPending||n.currencyPending||n.passwordPending||n.taxIdPending})})}function Dn(){let e=u(),{props:t,emit:n}=b();if(!t.nextActionBlocks)return null;if(t.nextActionType===`authenticate`){let n=t.transfer!=null;return(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`1`,className:m(`text-gray-a11 px-1`,x(`CheckoutNextActionNotice`,`The line explaining a step the server requires before this checkout can be paid`)),children:n?e(`jDNym/`):t.paymentMethodRequired===!1?e(`I6xz73`):e(`F/org4`)})}return t.nextActionType!==`verify_phone`||!t.phoneVerified?null:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 px-1`,children:[(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`1`,className:m(`text-gray-a11`,x(`CheckoutNextActionNotice`,`The line explaining a step the server requires before this checkout can be paid`)),children:e(`Xb5a6f`)}),(0,Z.jsx)(c,{type:`button`,size:`2`,variant:`surface`,color:`gray`,disabled:t.confirming,onClick:()=>
56n(`identityStepRequested`,{}),className:x(`CheckoutVerifyPhone`,`The control that (re)opens the phone-verification ceremony`),children:e(`7frda3`)})]})}function On(){let{emit:e}=b(),t=C(be),n=t.state.sessionNonce,r=t.state.phoneVerifiedNonce,i=(0,X.useRef)(null);return(0,X.useEffect)(()=>{if(!(typeof n!=`number`||typeof r!=`number`)){if(i.current===null){i.current={session:n,phone:r};return}i.current.session===n&&i.current.phone===r||(i.current={session:n,phone:r},e(`identityStepRequested`,{}))}},[n,r,e]),null}function kn({ctaLabel:e,schedule:t,pricing:n}){let r=u(),i={accept_transfer:r(`df6Mb3`),pay:r(`lD3+8a`),continue:r(`acrOoz`),start_trial:r(`4Zuvkw`),subscribe:r(`gczcC5`),join_waitlist:r(`iZKwrf`),apply_now:r(`VR4TEV`),call_now:r(`ujkMRA`),complete_order:r(`w8g8zN`),contact_us:r(`WnQ/AZ`),donate_now:r(`Oc4Fge`),get_access:r(`4Zuvkw`),get_offer:r(`AUTd0d`),join:r(`P6PLpi`),order_now:r(`WBBaGW`),purchase:r(`J6Eyds`),shop_now:r(`xvenUV`),sign_up:r(`8HJxXG`)};return e!==null&&e in i?i[e]:t?.recurring?.trialDays==null?t?.free?r(`acrOoz`):n?.planType===`one_time`||t?.recurring&&t.recurring.totalPayments!==null?r(`lD3+8a`):t?.recurring?r(`gczcC5`):r(`lD3+8a`):r(`4Zuvkw`)}function An(e){if(typeof e!=`string`||e===``)return!1;try{let{protocol:t}=new URL(e);return t===`https:`||t===`http:`}catch{return!1}}function jn({schedule:e}){let t=u(),n=d(),{props:r}=b(),i=r.seller.terms,o=r.seller.title,s=[{href:i?.terms_url,label:t(`32rBNK`)},{href:i?.privacy_policy_url,label:t(`vx0nkZ`)},{href:i?.return_policy_url,label:t(`icpBB/`)},{href:i?.eula_url,label:t(`WurkNE`)}].filter(e=>An(e.href));if(r.brandingPreview)return(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`1`,className:m(`text-gray-a10 px-1`,x(`CheckoutTerms`,`The terms disclosure under the pay button â the seller policies and the Whop buyer terms`)),children:t.rich(`VPMP6x`,{terms:e=>(0,Z.jsx)(`a`,{href:`https://whop.com/buyer-terms/`,target:`_blank`,rel:`noreferrer noopener`,className:m(`whitespace-nowrap text-inherit no-underline decoration-dotted underline-offset-2 hover:underline`,x(`CheckoutPolicyLink`,`Each link to a seller-published policy document in the terms disclosure`)),children:e}),privacy:e=>(0,Z.jsx)(`a`,{href:`https://whop.com/privacy/`,target:`_blank`,rel:`noreferrer noopener`,className:m(`whitespace-nowrap text-inherit no-underline decoration-dotted underline-offset-2 hover:underline`,x(`CheckoutPolicyLink`,`Each link to a seller-published policy document in the terms disclosure`)),children:e})})});let c=()=>n.list(s.map(e=>(0,Z.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer noopener`,className:m(`whitespace-nowrap text-inherit no-underline decoration-dotted underline-offset-2 hover:underline`,x(`CheckoutPolicyLink`,`Each link to a seller-published policy document in the terms disclosure`)),children:e.label},e.href)),{type:`conjunction`}),l;return l=r.ctaLabel===`join_waitlist`?s.length>0?t.rich(`DQtP8Q`,{seller:o,policies:c}):t(`Iv/piv`,{seller:o}):r.mode===`setup`?s.length>0?t.rich(`atksj7`,{seller:o,policies:c}):t(`Ff8hYy`,{seller:o}):e?.recurring?s.length>0?t.rich(`OePjVr`,{seller:o,policies:c}):t(`YvNEVo`,{seller:o}):s.length>0?t.rich(`kXEZ8H`,{seller:o,policies:c}):t(`E1laWz`,{seller:o}),(0,Z.jsx)(`div`,{className:m(`text-gray-a10 flex flex-col gap-1 px-1 text-center`,x(`CheckoutTerms`,`The terms disclosure under the pay button â the seller policies and the Whop buyer terms`)),children:(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`1`,className:`text-[13px] leading-[1.2] tracking-[-0.09px]`,children:l})})}function Mn({error:e,saving:t}){let n=u();if(!e)return null;switch(e.code){case`session_updating`:return n(t?`WuL1Ee`:`hz3e2s`);case`quote_changed`:return n(`27cQd9`);case`payment_failed`:return e.message.trim()||n(t?`EfXvRW`:`6sCE1v`);case`quote_expired`:return n(`5HUUBF`);case`rate_expired`:return n(`XqdX5N`);case`engine_unavailable`:return n(t?`O0ybju`:`Uowh4h`);case`confirm_in_progress`:return n(t?`QE09XO`:`MMAOSH`);case`token_invalid`:return n(t?`Vvhka5`:`g63X6R`);case`confirm_request_failed`:return n(t?`EiDAkj`:`PrS8Ha`);default:return e.message}}var Nn=S(`checkout-details`).doc(`The order-details sheet a narrow checkout opens for the promo code, currency, and totals.`).internal().props(e=>({quote:e.fromController().doc(`The server-written price the confirm collects.`),breakdown:e.fromController().doc(`The itemized price â the SAME copy the summary renders, so the two can never disagree.`),displayCurrency:e.fromController().analytics().doc(`The currency the buyer pays in.`),availableCurrencies:e.fromController().doc(`Everything display_currency accepts.`),promoCode:e.fromController().analytics().doc(`The applied promo code, or null.`),promo:e.fromController().doc(`The applied codeâs resolved semantics â what it takes off and which charges it covers â or null.`),promoCodeRefused:e.fromController().doc(`A code that was refused, so it can be shown back.`),showPromoInput:e.fromController().analytics().doc(`Whether the account offers promo entry â false hides the input unless a code is applied or refused.`),promoError:e.fromController().doc(`Why the last promo update was refused.`),promoPending:e.fromController().doc(`True while a promo update is in flight.`),currencyPending:e.fromController().doc(`True while a currency switch is in flight.`),currencyF
56ailed:e.fromController().doc(`True when the last currency switch was refused.`),locked:e.fromController().doc(`True while a confirm is in flight â nothing here may change.`),itemDescription:e.fromController().doc(`The itemâs long description as the seller wrote it, or null â the sheet is where a narrow container reads it.`),invoiceDueAt:e.fromController().doc(`When this checkoutâs invoice is due (ISO 8601), or null when it does not collect an invoice.`)})).events(e=>({applyPromo:e.internal().analytics(`code`).doc(`The buyer applied (or removed) a promo code â the checkout controller PATCHes it.`),selectDisplayCurrency:e.internal().analytics(`currency`).doc(`The buyer switched the currency they pay in â the checkout controller PATCHes it.`)})).modal(()=>{"use embed";return{header:(0,Z.jsx)(Pn,{})}}).loading(()=>{"use loading";let e={borderRadius:8,background:`var(--gray-a3, #f0f0f3)`};return(0,Z.jsxs)(`div`,{"aria-busy":`true`,className:`whop-skeleton`,style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,Z.jsx)(`div`,{style:{...e,height:14,width:`45%`}}),(0,Z.jsx)(`div`,{style:{...e,height:36,width:148}}),(0,Z.jsx)(`div`,{style:{...e,height:14,width:`60%`}})]})}).render(()=>{"use embed";return(0,Z.jsx)(Fn,{})});function Pn(){return(0,Z.jsx)(a,{size:`3`,weight:`semi-bold`,children:u()(`NfwDx2`)})}function Fn(){let{props:e,emit:t}=b();return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(Vt,{quote:e.quote,displayCurrency:e.displayCurrency,availableCurrencies:e.availableCurrencies,currencyPending:e.currencyPending,currencyFailed:e.currencyFailed,disabled:e.locked||e.promoPending,onSwitch:e=>t(`selectDisplayCurrency`,{currency:e})}),(e.showPromoInput||e.promoCode||e.promoCodeRefused)&&(0,Z.jsx)(Ht,{promoCode:e.promoCode,promoCodeRefused:e.promoCodeRefused,promo:e.promo,breakdown:e.breakdown,promoError:e.promoError,promoPending:e.promoPending,disabled:e.locked||e.promoPending||e.currencyPending,onApply:e=>t(`applyPromo`,{code:e}),onRemove:()=>t(`applyPromo`,{code:null})}),e.invoiceDueAt?(0,Z.jsx)(qt,{dueAt:e.invoiceDueAt}):null,e.itemDescription?(0,Z.jsx)(Jt,{description:e.itemDescription}):null,(0,Z.jsx)(Kt,{display:e.breakdown.display})]})}var In={apple_pay:{supportsBuyerFee:!0,submitButton:{light:{color:`#000000`,image:`https://content.whop.com/payment_methods/apple-pay/submit_buttons/light.svg`},dark:{color:`#FFFFFF`,image:`https://content.whop.com/payment_methods/apple-pay/submit_buttons/dark.svg`}}},google_pay:{supportsBuyerFee:!0,submitButton:{light:{color:`#000000`,image:`https://content.whop.com/payment_methods/google-pay/submit_buttons/light.svg`},dark:{color:`#FFFFFF`,image:`https://content.whop.com/payment_methods/google-pay/submit_buttons/dark.svg`}}}},Ln=S(`express-checkout`).doc(`One-press Apple Pay and Google Pay buttons for a checkout â the OS payment sheet collects whatever the session still needs (the buyer's email, a phone number where the seller collects one, a shipping address for physical goods, and in Apple Pay a promo code where the seller offers entry) and one press finishes the purchase. It shares the checkout's entry slot with the full checkout element, so a handle mounts exactly one of the two: this button alone where the purchase is simple enough for a sheet to finish, or the full checkout surface for everything else. Renders only the wallets the buyer's device can actually pay with â and the checkout's own payment method configuration allows â using the served button art, and renders nothing where no wallet is available. Both wallets require the page's domain to be a verified payment method domain: first-party whop.com pages are pre-approved, and any other site must register its domain through the Payment Method Domains API before either button renders there. Offering Google Pay on your own site is subject to the Google Pay API Terms of Service. A checkout the sheet cannot honestly finish â a waitlist join, a transfer, a form question only a page can ask â refuses loudly instead of rendering a doomed button.`).props(e=>({seller:e.fromController().doc(`The seller this checkout purchases from â the account the wallet sheets charge for.`),quote:e.fromController().doc(`The server-written price of the items â the currency the sheet charges in.`),breakdown:e.fromController().doc(`The itemized price â its total is the figure the OS sheet displays and authorizes.`),offerAmounts:e.fromController().doc(`The totals wallet offers are judged against, in minor units, one per buyer-fee posture â absent only on fabricated snapshots, where the displayed total gates.`),setupFutureUsage:e.fromController().analytics().doc(`The renewal-vault attestation derived from the billing schedule, threaded into the sheet prime.`),requirements:e.fromController().doc(`What this session declares it must collect. The button renders only when every row is one the OS sheet answers â email, phone number or shipping address â and the list is LIVE: a row appearing mid-checkout is re-judged at press t
56ime.`),requirementValues:e.fromController().doc(`The values the session already holds for those requirements â an email the session knows rides into the sheet and suppresses its ask.`),paymentMethodRequired:e.fromController().analytics().doc(`Whether this checkout collects a payment method at all, read off the session. A checkout that collects none has nothing for a wallet to do.`),paymentMethodConfiguration:e.fromController().doc(`The sessionâs resolved method filtering â the same configuration the full checkoutâs method list applies. A wallet the plan or account disabled never renders a button, whatever the buyerâs device offers.`),transfer:e.fromController().doc(`The membership transfer this checkout performs, or null â a transfer is not a purchase a sheet can make.`),ctaLabel:e.fromController().analytics().doc(`The sessionâs own verb for the sale â a waitlist join is not a purchase, so it never gets a pay button.`),mode:e.fromController().analytics().doc("What kind of checkout the session is â a `setup` saves a payment method and charges nothing, which is not a purchase an OS payment sheet can make."),nextActionBlocks:e.fromController().doc("Whether a server-declared step holds the sale â read off the actionâs own `blocking` in the controller frame. A blocked sale must never open a payment sheet."),nextActionType:e.fromController().doc("WHICH blocking step stands â this face forks on it: `verify_phone` keeps the wallet row (the sheet collected the number, and the code modal owns the step); every other blocking step keeps the loud refusal."),phoneCodePending:e.fromController().doc(`True while a phone-ceremony leg (send or verify) is in flight â the wallet row locks with it.`),phoneCodeError:e.fromController().doc("The number-carrying confirmâs send refusal as its STABLE code (`invalid_number`, `country_not_supported`, â¦) â a number the server cannot text. Rendered under the row in the ceremonyâs own words: the sheetâs number has no field to correct, so the line is the buyerâs whole explanation."),brandingPreview:e.fromController().analytics().doc(`True only for the synthetic checkout-branding session, which nobody can pay through.`),confirming:e.fromController().doc(`True while a confirm attempt is in flight.`),confirmNonce:e.fromController().doc(`Bumps every time a confirm attempt settles â the mint lock releases on it.`),confirmError:e.fromController().doc(`Why the most recent confirm attempt did not complete â the session stays open for retry.`),blockingError:e.fromController().doc(`Why this open session cannot confirm as it stands, or null â a sold-out plan, an archived one, a spent transfer link. This element renders NOTHING for one, the same collapse as no wallet being available: the block is the planâs state, not a mount the embedder got wrong, so the loud refusal face would blame the wrong party.`),promoPending:e.fromController().doc(`True while a promo update is in flight.`),showPromoInput:e.fromController().analytics().doc(`Whether the seller offers promo-code entry. Apple Payâs sheet renders its own coupon field only when they do; Google Payâs does once Google enables offers for the merchant.`),promoCode:e.fromController().analytics().doc(`The code the session already holds â prefilled into the sheetâs coupon field so the buyer can remove it.`),promo:e.fromController().doc(`The stored codeâs resolved semantics â the applied-code caption where the sheet shows one.`),currencyPending:e.fromController().doc(`True while a currency switch is in flight.`),returnUrl:e.fromController().doc(`Where the buyer lands after an off-site payment step, threaded into the next-action rail.`),status:e.fromController().analytics().doc(`The session status â the element renders its outcome line off it once the purchase settles.`),resultStatus:e.fromController().analytics().doc("Where the completed sessionâs result stands â `completed` alone stopped meaning success, so the outcome line selects on this."),resultSettling:e.fromController().doc(`True when a succeeded purchaseâs money is still clearing â a bank debit the provider accepted while access was already granted. The outcome line says the order is complete and the payment still processing.`),redirectBlocked:e.fromController().doc(`True when the embedding page refused the tab navigation the paymentâs pending step needs (a method whose step only renders full_page) â the requires_action face renders a "Continue" press that makes the same trip under the buyerâs own gesture instead of a re-entry that would ask the host again outside one. The destination url itself never travels here: it stays in the controller frame that navigates.`),previewWallets:e.fromController().doc(`Stated wallet availability with served art â the demo/preview rail. Undefined on every real mount, where the device probes answer instead.`),wallets:e.default([`apple_pay`,`google_pay`]).doc(`Which wallets may render â a filter over what the buyerâs device actually offers. The element never shows a wallet the device, the served matrix, or the checkoutâs payment method configuration cannot back, and the render order stays best-native-first whatever order this lists. An empty list renders nothing (warned in dev builds). Both wallets need the pageâs domain verified as a [payment method domain](/api-reference/beta/payment-method-domains/payment-method-domain) â first-party whop.com pages are pre-approved; on any other site, register and verify the domain or the buttons stay hidden. Offering Google Pay on your own site is subject to the [Google Pay API Terms of Service](https://payments.developers.google.com/terms/sellertos).`),layout:e.default(`auto`).analytics().doc("How the buttons stack. `auto` follows the elementâs own container â stacked in narrow containers, side by side in wide ones; `horizontal` and `vertical` force one arrangement.")})).events(e=>({walletHandoffRequested:e.hostInternal().doc(`A framed Chromium Apple Pay press asks the PAGE to run the ceremony, where Appleâs handoff modal has the whole viewport instead of this frameâs box. The controllerâs host reaction runs it; no consumer callback ever hears it.`),walletHandoffConcluded:e.hostInternal().doc(`The confirm outcome for a page-side sheet holding its verdict open â the controllerâs host reaction concludes that sheet with it, so the checkmark follows the confirm, never precedes it.`),confirmRequested:e.internal().analytics(`paymentMethodType`,`promoCode`).doc("A press minted a confirmation token â the controller confirms the session with it, exactly as it does for the full checkout surface. `values` is the requirement value map with the sheetâs own answers written in. `promoCode` is the code the sheetâs own coupon field applied (null when the buyer removed the prefilled one; absent when untouched) â it rides the confirm, which is where a sheet-entered code actually lands on the session. `phoneNumber` is the number the sheet collected for a verify seller â it rides the confirm that texts the code."),surfaceReady:e.internal().doc(`The surface finished its first mou
56nt â the controller delivers the session reference and runs the sessionâs pending action off it. Fires once per mount.`),identityStepRequested:e.internal().doc(`The buyer pressed the finish-payment re-entry â the controller re-reads the session and drives whatever step the fresh read names, exactly as it does for the full checkout surface.`),redirectRetryRequested:e.internal().doc(`The buyer pressed âContinueâ on the blocked-navigation face â the controller retries the embedding-tab navigation inside the clickâs own activation, falling back to opening the destination in a new tab, exactly as it does for the full checkout surface. The url never leaves the controller frame; the press travels instead.`)})).state(()=>({sessionRef:void 0})).contributes(e=>({driveNextAction:e.required().doc(`Runs the paymentâs pending off-site step through this mountâs own composed payments controller, answering with what the drive left behind â a contribution for the checkout elementâs reason: the frameable 3DS dialog can only be opened by a handle that is actually mounted.`)})).actions(e=>({walletHandoffChanged:e.hostInternal(async(e,t)=>{"use embed";return await T(t)}).doc(`A page-side sheet ask (the billing reprice, a shipping address or option, a promo code) relayed into this frameâs own handlers; answers with what they changed. Called by the controllerâs host reaction while a handoff is in flight.`),walletHandoffSettled:e.hostInternal(async(e,t)=>{"use embed";ve(t)}).doc(`The page sheetâs verdict for the pending handoff â the mint result, or the failure (a dismissal is cancelled). Called by the controllerâs host reaction; settles the press exactly as an in-frame sheet would.`),runNextAction:e.controllerOnly(async(e,t)=>{"use embed";return await e.contributions.driveNextAction(t)}).doc(`Drives the confirmed paymentâs pending step through this mountâs composed payments handle and reports what the drive left behind. Controller-only â the checkout controller calls it after a confirm that did not settle.`),runVerifyPhone:e.controllerOnly(async()=>{"use embed";throw Error(`The express checkout element has no phone-verification surface of its own â the wallet sheet collects the number and the code modal owns the step.`)}).doc(`Refuses: the express surface has no in-place phone-verification ceremony. The sheet collects the number, the number-carrying confirm opens the code modal, and nothing else may drive a phone step here.`),concludeWalletSheet:e.controllerOnly(async(e,t)=>{"use embed";Te(t.success?`success`:`failure`)}).analytics(`success`).doc(`Delivers the confirm outcome to an OS wallet sheet holding its conclusion open in this frame. Controller-only â the checkout controllerâs confirm reaction calls it on every settle.`),adoptSessionReference:e.controllerOnly(async(e,t)=>{"use embed";e.setState({sessionRef:t})}).doc(`The controllerâs delivery of the sessionâs identity + credential over the same-origin bus (the adoptSession shape). Never a projection: the client_secret is the sessionâs whole authorization.`)})).loading(()=>{"use loading";return(0,Z.jsx)(`div`,{"aria-busy":`true`,className:`whop-skeleton animate-pulse`,children:(0,Z.jsx)(`div`,{style:{height:55,borderRadius:8,background:`var(--gray-a3, #f0f0f3)`}})})}).error(()=>{"use embed";return(0,Z.jsx)(Hn,{})}).demo(e=>e.controls(e=>({layout:e.select(`auto`,[`auto`,`horizontal`,`vertical`],{label:`Button layout`}),applePay:e.boolean(!0,{label:`Offer Apple Pay`}),googlePay:e.boolean(!0,{label:`Offer Google Pay`})})).props(e=>({layout:e.layout,wallets:[...e.applePay?[`apple_pay`]:[],...e.googlePay?[`google_pay`]:[]],setupFutureUsage:void 0,offerAmounts:void 0,ctaLabel:null,transfer:null,paymentMethodRequired:!0,paymentMethodConfiguration:void 0,requirements:[{key:`email`,type:`email`,holdsSale:!0}],requirementValues:{},nextActionBlocks:!1,nextActionType:null,phoneCodePending:!1,phoneCodeError:void 0,brandingPreview:!1,resultStatus:null,resultSettling:!1,redirectBlocked:!1,confirmError:null,previewWallets:In}))).render(()=>{"use embed";return(0,Z.jsx)(Rn,{})});function Rn(){let{props:e,state:t,emit:n}=b(),[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(()=>({...e.requirementValues}));if((0,X.useEffect)(()=>{c(t=>{let n=t;for(let r of e.requirements)r.key in n||(n===t&&(n={...t}),n[r.key]=e.requirementValues[r.key]??``);return n})},[e.requirements,e.requirementValues]),(0,X.useEffect)(()=>{n(`surfaceReady`,{})},[]),(0,X.useEffect)(()=>{i(!1)},[e.confirming,e.confirmNonce]),e.status===`expired`)throw Error(`This checkout session has expired â mount a new checkout to sell again.`);let l=e.status===`open`&&!r&&!e.confirming&&e.blockingError!==null;if(!l&&e.status===`open`&&!r&&!e.confirming){let t=e.paymentMethodRequired===!1?`this checkout collects no payment`:e.ctaLabel===`join_waitlist`?`a waitlist join is not a purchase a payment sheet can make`:e.mode===`setup`?`saving a payment method is not a purchase a payment sheet can make`:e.transfer==null?e.requirements.every(e=>At(e.type))?e.nextActionBlocks&&e.nextActionType!==`verify_phone`?`a blocking step stands before the sale`:void 0:`the session collects answers an OS payment sheet cannot (${e.requirements.filter(e=>!At(e.type)).map(e=>e.type).join(`, `)})`:`a membership transfer is not a purchase a payment sheet can make`;if(t)throw Error(`This checkout cannot be paid with an express wallet button â ${t}. Mount the full checkout element instead.`)}return(0,Z.jsxs)(be,{accountId:e.seller.id,currency:e.quote.currency,amount:I(Number(e.breakdown.total.amount),e.breakdown.total.currency),returnUrl:e.returnUrl??void 0,checkoutSession:t.sessionRef,children:[(0,Z.jsx)(Vn,{}),l?null:e.status===`completed`?(0,Z.jsx)(Bn,{}):(0,Z.jsx)(zn,{minting:r,setMinting:i,values:s,setValues:c,onOffered:o}),!l&&(a||r||e.confirming||e.status===`completed`)&&(0,Z.jsx)(pe,{})]})}function zn({minting:e,setMinting:t,values:n,setValues:r,onOffered:i}){let o=u(),s=Lt(),{props:c,state:l,emit:d,Loading:f,origins:p}=b();return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Pt,{origins:p,handoff:Bt({request:e=>d(`walletHandoffRequested`,e),conclude:e=>d(`walletHandoffConcluded`,e)},p),accountId:c.seller.id,currency:c.quote.currency,total:c.breakdown.total,offerAmounts:c.offerAmounts,setupFutureUsage:c.setupFutureUsage,requirements:c.requirements,paymentMethodRequired:c.paymentMethodRequired,paymentMethodConfiguration:c.paymentMethodConfiguration,brandingPreview:c.brandingPreview,nextActionBlocks:c.nextActionBlocks,ctaLabel:c.ctaLabel,mode:c.mode,transfer:c.transfer,confirming:c.confirming,promoPending:c.promoPending,currencyPending:c.currencyPending,phoneCodePending:c.phoneCodePending,showPromoInput:c.showPromoInput,promoCode:c.promoCode,promo:c.promo,previewWallets:c.previewWallets,wallets:c.wallets,layout:c.layout,sessionRef:l.sessionRef,minting:e,onMintingChange:t,values:n,onValue:(e,t)=>
56r(n=>({...n,[e]:t})),onOfferedWalletsChange:e=>i(e.length>0),onConfirmationToken:(e,t,n,r,i)=>d(`confirmRequested`,{confirmationToken:e,paymentMethodType:n,values:t,...r===void 0?{}:{promoCode:r},...i===void 0?{}:{phoneNumber:i}}),onIncomplete:()=>{},standalone:{pending:(0,Z.jsx)(f,{})}}),c.confirmError&&!e&&!c.confirming&&(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`1`,className:m(`text-red-11 px-1`,x(`CheckoutExpressError`,`The retryable error line under the express button`)),children:o(`1tXgcq`)}),c.phoneCodeError&&!e&&!c.confirming&&(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`1`,className:m(`text-red-11 px-1`,x(`CheckoutExpressPhoneError`,`The refusal line for a wallet-collected phone number the server could not text`)),children:s(c.phoneCodeError)})]})}function Bn(){let e=u(),{props:t,emit:n}=b();return t.resultStatus===`requires_action`?(0,Z.jsxs)(`div`,{className:m(`flex flex-col items-start gap-2 px-1`,x(`CheckoutExpress`,`The express checkout row â one-press wallet payments above the form`)),children:[(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`2`,className:m(`text-gray-a11`,x(`CheckoutExpressFinishPayment`,`The finish-payment line shown while the payment still needs a step the buyer dismissed`)),children:t.redirectBlocked?e(`ZQtA2N`):e(`LkHona`)}),t.redirectBlocked?(0,Z.jsx)(c,{size:`2`,variant:`classic`,onClick:()=>n(`redirectRetryRequested`,{}),className:x(`CheckoutExpressContinue`,`The blocked-navigation press on the express row â finishes the trip to the paymentâs off-site step`),children:e(`acrOoz`)}):(0,Z.jsx)(c,{size:`2`,variant:`solid`,color:`gray`,highContrast:!0,disabled:t.confirming,onClick:()=>n(`identityStepRequested`,{}),className:x(`CheckoutExpressFinishPaymentButton`,`The re-entry button that re-runs the paymentâs pending step`),children:e(`7q0SIO`)})]}):t.resultStatus===`failed`?(0,Z.jsxs)(`div`,{className:m(`flex flex-col items-start gap-2 px-1`,x(`CheckoutExpress`,`The express checkout row â one-press wallet payments above the form`)),children:[(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`2`,className:m(`text-red-11`,x(`CheckoutExpressError`,`The retryable error line under the express button`)),children:e(`O2rr0K`)}),(0,Z.jsx)(c,{size:`2`,variant:`solid`,color:`gray`,highContrast:!0,disabled:t.confirming,onClick:()=>n(`identityStepRequested`,{}),className:x(`CheckoutExpressRetry`,`The failed restâs button â re-reads the reopened session so the buyer can pay again`),children:e(`FazwRl`)})]}):(0,Z.jsx)(`div`,{className:m(`flex flex-col gap-2 px-1`,x(`CheckoutExpress`,`The express checkout row â one-press wallet payments above the form`)),children:(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`2`,className:m(`text-gray-11`,x(`CheckoutExpressComplete`,`The standalone express buttonâs settled outcome line`)),children:t.resultStatus===`processing`?e(`T9yAXE`):t.resultSettling?e(`cT9KqQ`):e(`jEtW4d`)})})}function Vn(){let e=C(be);return y(Ln,`driveNextAction`,({clientSecret:t})=>Ae(()=>e.handleNextAction({clientSecret:t})),!0),null}function Hn(){let e=u();return(0,Z.jsxs)(`div`,{className:m(`flex flex-col gap-1 px-1`,x(`CheckoutExpressUnavailable`,`The face shown when an express button cannot serve this checkout`)),children:[(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`2`,weight:`medium`,children:e(`vFBeZk`)}),(0,Z.jsx)(a,{render:(0,Z.jsx)(`p`,{}),size:`1`,className:`text-gray-a11`,children:e(`g2SuAM`)})]})}var Un=[[`utmSource`,`utm_source`],[`utmMedium`,`utm_medium`],[`utmCampaign`,`utm_campaign`],[`utmTerm`,`utm_term`],[`utmContent`,`utm_content`],[`trackingLinkId`,`tracking_link_id`],[`funnelId`,`funnel_id`],[`source`,`source`]];function Wn(e){if(!e)return;let t={};for(let[n,r]of Un){let i=e[n];typeof i==`string`&&i.trim()!==``&&(t[r]=i)}return Object.keys(t).length>0?t:void 0}function Gn(e){if(!e)return;let t={};for(let n of Object.keys(e).sort()){let r=e[n];typeof r==`string`&&(t[n]=r)}return Object.keys(t).length>0?t:void 0}var Kn=new Set(Object.values($e));function qn(e){return Kn.has(e)}var Jn=S(`phone-code-modal`).doc(`The verify_phone ceremonyâs code dialog â the checkout controller opens it while the session holds a texted, unanswered code. The code rides a confirm of its own (the server completes the parked payment on a pass); dismissing the dialog cancels the ceremony with a session write. Internal
56coordination behind the checkout and express-checkout elements, no consumer surface.`).internal().props(e=>({sentTo:e.fromController().doc(`The number the pending code was texted to â the session-derived fact this dialog exists for. Its clearing (a passed code, a landed cancel) is the dialogâs own close signal.`),resendAvailableAt:e.fromController().doc(`When redelivery unlocks (the verify_phone actionâs own resend_available_at) â the resend control waits it out with a countdown, the same treatment the sign-in code dialog gives its challenge.`),pending:e.fromController().doc(`True while a ceremony leg (the code-bearing confirm, or a resend) is in flight.`),errorCode:e.fromController().doc("The last ceremony refusalâs STABLE code (`invalid_code`, `cancel_failed`, `confirm_failed`, â¦) â localized here; server prose never renders."),sessionBusy:e.fromController().doc(`The controller is mid-write (a confirm, or any session PATCH): the writer lattice would silently refuse a leg dispatched now, so the controls hold instead.`)})).state(()=>({code:``,lastLeg:void 0})).events(e=>({submitPhoneCode:e.internal().doc(`The buyer answered the texted code â the code rides a CONFIRM of its own: the server checks it against the sessionâs stored number, restores the credentials the number-carrying confirm parked, and completes the payment on a pass. A free checkoutâs buyer email rides beside it from CONTROLLER state (captured off the parked confirmâs own values â the server never holds it), so the payload carries the code alone.`),resendPhoneCode:e.internal().doc(`The buyer asked for their code again â the controller hits the redelivery endpoint, which texts the sessionâs own STORED number (a resend can never retarget).`)})).modal(e=>{"use embed";return{header:(0,Z.jsx)(Yn,{}),footer:(0,Z.jsx)(Zn,{close:e.close})}},{maxWidth:420}).loading(()=>{"use loading";return(0,Z.jsxs)(`div`,{"aria-busy":`true`,className:`whop-skeleton`,style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,Z.jsx)(`div`,{style:{height:14,width:220,borderRadius:4,background:`var(--gray-a3, #f0f0f3)`}}),(0,Z.jsx)(`div`,{style:{height:44,borderRadius:8,background:`var(--gray-a3, #f0f0f3)`}})]})}).render(()=>{"use embed";return(0,Z.jsx)(Xn,{})});function Yn(){return(0,Z.jsx)(a,{size:`3`,weight:`semi-bold`,children:u()(`QofabW`)})}function Xn(){let e=u(),t=(0,X.useId)(),{props:n,state:i,setState:o,emit:s}=b(),c=n.pending||n.sessionBusy,l=e=>{let t=e.replace(/\D/g,``).slice(0,6);o({code:t,lastLeg:t.length===6?`verify`:i.lastLeg}),t.length===6&&!c&&n.sentTo!==void 0&&s(`submitPhoneCode`,{code:t})},d=Lt(),f=n.errorCode?d(n.errorCode):void 0;return n.sentTo===void 0?null:(0,Z.jsxs)(`div`,{className:m(`flex flex-col gap-6`,x(`CheckoutPhoneVerification`,`The phone-verification ceremony â number entry, then the texted code`)),"data-whop-autofill":``,children:[(0,Z.jsx)(ie,{}),(0,Z.jsx)(a,{render:(0,Z.jsx)(`label`,{htmlFor:t}),size:`2`,className:m(`text-gray-a11 text-balance text-center`,x(`CheckoutPhoneVerificationHint`,`The line explaining why the seller asks for a verified number`)),children:e.rich(`FJLYD6`,{strong:()=>(0,Z.jsx)(r,{children:n.sentTo})})}),(0,Z.jsx)(A,{inputId:t,code:i.code,locked:c,submitting:n.pending&&i.lastLeg===`verify`,failure:f,onCode:l})]})}function Zn({close:e}){let t=u(),{props:n,state:r,setState:i,emit:a}=b(),o=n.pending||n.sessionBusy,s=n.resendAvailableAt?Date.parse(n.resendAvailableAt):NaN,[c,l]=(0,X.useState)(()=>Date.now()),d=Number.isFinite(s)&&s>c;(0,X.useEffect)(()=>{if(!d)return;let e=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(e)},[d]);let f=n.sentTo===void 0;return(0,X.useEffect)(()=>{f&&e()},[f,e]),(0,Z.jsxs)(`div`,{className:`flex w-full items-center gap-3`,children:[(0,Z.jsx)(`button`,{type:`button`,disabled:o||d,onClick:()=>{o||(i({lastLeg:`send`,code:``}),a(`resendPhoneCode`,{}))},className:m(`text-1 text-gray-a10 cursor-pointer underline underline-offset-2 disabled:cursor-default`,x(`CheckoutPhoneVerificationResend`,`The control that re-texts the code`)),children:n.pending&&r.lastLeg===`send`?t(`ff2VGL`):d?t(`XPklVO`,{seconds:String(Math.max(1,Math.ceil((s-c)/1e3)))}):t(`ZD48TW`)}),(0,Z.jsx)(`button`,{type:`button`,disabled:o,onClick:()=>e(),className:m(`text-1 text-gray-a10 cursor-pointer underline underline-offset-2 disabled:cursor-default`,x(`CheckoutPhoneVerificationChangeNumber`,`The way back to the number entry â clears the stored number`)),children:t(`WCI6uY`)})]})}var Qn=`usd`,$n=.9219138932423712;function er(e){return e?{country:e.country??null,state:e.state??null,postal_code:e.postal_code??null,city:e.city??null,line1:e.line1??null,line2:e.line2??null}:null}function tr(e){return JSON.stringify({currency:e.currency,address:er(e.address),supportsBuyerFee:e.supportsBuyerFee??null,quotedAt:e.quotedAt})}function nr(e){return{currency:e.snapshot.quote.currency,address:e.taxAddress??e.shippingTaxAddress,supportsBuyerFee:e.supportsBuyerFee,quotedAt:e.snapshot.quote.quoted_at}}function rr(e){let t=nr(e),n=e.breakdownPreview;return n&&e.breakdownKey===tr(t)?n:ir(e.snapshot.quote.breakdown,ur(e,t))}function ir(e,t){if(!t)return e;let n=e.adjustments.filter(e=>e.status!==`pending`||!or(t,e.kind));return n.length===e.adjustments.length?e:{...e,adjustments:n,display:ar(e.dis
56play)}}function ar(e){return e?.sections?{...e,sections:{...e.sections,charges:e.sections.charges.filter(e=>e.status!==`pending`),totals:e.sections.totals.map(e=>e.status===`pending`?{...e,status:void 0}:e)}}:e}function or(e,t){return!e.adjustments.some(e=>e.kind===t&&(e.status===`pending`||e.amount==null||Number(e.amount.amount)!==0))}function sr(e){return e.breakdownPreview!==void 0||e.snapshot.quote.breakdown.adjustments.some(e=>e.status===`pending`)}var cr=new Map;function lr(e){return{currency:e.currency,address:e.address,quotedAt:e.quotedAt}}function ur(e,t){return e.feeBasisKey===tr(lr(t))?e.feeBasisPreview:void 0}async function dr(e,t,n){let r=`${e.state.clientSecretHeld}:${n}`,i=tr(t),a=(cr.get(r)??0)+1;cr.set(r,a);let o=()=>cr.get(r)!==a;try{let n=await Ge(e.sdk,e.state.clientSecretHeld,{address:t.address,supports_buyer_fee:t.supportsBuyerFee});if(o())return{outcome:`superseded`};let r=n.calculated_for;return!r||tr({currency:r.currency,address:r.address??void 0,supportsBuyerFee:r.supports_buyer_fee??void 0,quotedAt:t.quotedAt})!==i?{outcome:`refused`}:{outcome:`answered`,breakdown:n}}catch{return o()?{outcome:`superseded`}:{outcome:`refused`}}}async function fr(e,t){e.setState({breakdownPreview:void 0,breakdownKey:tr(t)});let n=lr(t),r=tr(n),i=t=>e.setState({feeBasisPreview:t,feeBasisKey:r}),a=[];t.supportsBuyerFee===!1&&pr(e.state.snapshot.quote.breakdown)&&a.push(dr(e,n,`basis`).then(e=>{e.outcome===`answered`&&i(e.breakdown)})),a.push(dr(e,t,`display`).then(n=>{if(n.outcome!==`answered`){n.outcome===`refused`&&e.setState({breakdownPreview:void 0});return}e.setState({breakdownPreview:n.breakdown}),t.supportsBuyerFee!==!1&&i(n.breakdown)})),await Promise.all(a)}function pr(e){let t=e.adjustments.find(e=>e.kind===`buyer_fee`&&e.applied===`added`&&e.status!==`pending`);return t?.amount?{...t,amount:t.amount}:void 0}function mr(e){let t=e.upcoming.find(e=>e.type===`recurring`||e.type===`installments`);if(!t)return 0;let n=I(Number(t.amount.amount),t.amount.currency);if(n>0)return n;let r=t.post_promo_amount;return r?I(Number(r.amount),r.currency):0}function hr(e){let t=gr(e);if(t.feeInclusive>0||t.feeFree>0)return t;let n=mr(e.snapshot.quote.breakdown);return n>0?{feeInclusive:n,feeFree:n}:t}function gr(e){let t=e.snapshot.quote.breakdown,n=e=>I(Number(e.total.amount),e.total.currency);if(!pr(t)){let t=n(rr(e));return{feeInclusive:t,feeFree:t}}let r=ur(e,nr(e))??t,i=pr(r),a=n(r);return{feeInclusive:a,feeFree:i?a-I(Number(i.amount.amount),i.amount.currency):a}}async function _r(e,t){if(!(e.state.currencyPending||e.state.promoPending||e.state.phoneCodePending||e.state.confirming)){e.setState({currencyPending:!0,currencyError:void 0});try{$(e,await Ue(e.sdk,e.state.clientSecretHeld,{display_currency:t})),e.setState({currencyPending:!1,confirmTransportError:void 0})}catch(t){e.setState({currencyPending:!1,currencyError:R(t,`display currency patch failed`)})}}}async function vr(e,t){if(!(e.state.promoPending||e.state.currencyPending||e.state.phoneCodePending||e.state.confirming)){e.setState({promoPending:!0,promoError:void 0});try{$(e,await Ue(e.sdk,e.state.clientSecretHeld,{promo_code:t})),e.setState({promoPending:!1,confirmTransportError:void 0})}catch(t){e.setState({promoPending:!1,promoError:R(t,`The promo code could not be applied.`)})}}}function $(e,t){if(!ri(e.state.snapshot.quote,t.quote)){e.setState({snapshot:ii(t),phoneCodeSentTo:J(t)});return}e.setState({snapshot:ii(t),phoneCodeSentTo:J(t),pricing:Ne(t),breakdownPreview:void 0,breakdownKey:void 0}),sr({snapshot:t,breakdownPreview:e.state.breakdownPreview})&&fr(e,nr({...e.state,snapshot:t}))}function yr(e,t){let n=e.snapshot,r=Ne(n);return{clientSecretHeld:t,snapshot:ii(n),returnUrl:n.return_url??void 0,paymentMethodConfiguration:n.payment_method_configuration??void 0,setupFutureUsage:n.mode===`setup`||r?.planType===`renewal`?`off_session`:void 0,branding:at(n.branding),breakdownPreview:void 0,breakdownKey:void 0,feeBasisPreview:void 0,feeBasisKey:void 0,taxAddress:void 0,shippingTaxAddress:void 0,supportsBuyerFee:void 0,taxIdPending:!1,taxIdError:void 0,confirming:!1,confirmTransportError:void 0,settleNotice:void 0,blockedRedirectUrl:void 0,pendingStepType:void 0,promoPending:!1,promoError:e.promoError,promoCodeRefused:e.promoCodeRefused,currencyPending:!1,currencyError:void 0,passwordPending:!1,passwordError:void 0,expressWalletPreview:void 0,phoneCodePending:!1,phoneCodeError:void 0,phoneCodeSentTo:J(n)}}function br(e){let t=z(e);return t!==void 0&&qn(t)?t:void 0}var xr=new Set;async function Sr(e,t){if(!(t===void 0||e.children.phoneCodeModal.created)&&!xr.has(e.state.clientSecretHeld)){xr.add(e.state.clientSecretHeld);try{await e.open(`phoneCodeModal`)}catch{}finally{xr.delete(e.state.clientSecretHeld)}}}async function Cr(e,t){if(Sr(e,e.state.phoneCodeSentTo),t.adoptSessionReference({id:e.state.snapshot.id,clientSecret:e.state.clientSecretHeld}).catch(()=>{}),sr(e.state)&&fr(e,nr(e.state)),e.state.confirming)return;let n=e.state.snapshot;if(!n.next_action){Ve(n)&&G(Y(n));return}e.setState({confirming:!0,confirmTransportError:void 0,settleNotice:void 0,blockedRedirectUrl:void 0}),await Fr({client:e.sdk,clientSecret:e.state.clientSecretHeld,runNextAction:e=>t.runNextAction(e),runVerifyPhone:()=>t.runVerifyPhone(),allowCompletionNavigation:()=>e.props.allowCompletionNavigation!==!1,onSnapshot:t=>$(e,t),onRedirectBlocked:t=>e.setState({blockedRedirectUrl:t}),onCompleteRest:t=>void Pr(e,t)},e.state.snapshot),e.setState({confirming:!1,confirmNonce:e.state.confirmNonce+1})}async function wr(e,t){if(e.state.confirming||e.state.phoneCodePending)return;e.setState({confirming:!0,confirmTransportError:void 0,settleNotice:void 0,blockedRedirectUrl:void 0});let n,r=K();try{n=await Ir(e.sdk,e.state.clientSecretHeld,r)}catch{e.setState({confirming:!1,confirmNonce:e.state.confirmNonce+1});return}finally{r.dispose()}$(e,n),Sr(e,J(n)),await Fr({client:e.sdk,clientSecret:e.state.clientSecretHeld,runNextAction:e=>t.runNextAction(e),runVerifyPhone:()=>t.runVerifyPhone(),allowCompletionNavigation:()=>e.props.allowCompletionNavigation!==!1,onSnapshot:t=>$(e,t),onRedirectBlocked:t=>e.setState({blockedRedirectUrl:t}),onCompleteRest:t=>void Pr(e,t)},n),e.setState({confirming:!1,confirmNonce:e.state.confirmNonce+1})}async function Tr(e,t,n){if(e.state.confirming)return;e.setState({confirmAttemptNonce:e.state.confirmAttemptNonce+1});let r=e=>void t.concludeWalletSheet({success:e}).catch(()=>{});if(e.state.promoPending||e.state.currencyPending||e.state.phoneCodePending){r(!1),e.setState({confirmNonce:e.state.confirmNonce+1,settleNotice:{code:`session_updating`,message:`The order was still updating when you paid.`}});return}let i=bt(e.state.snapshot.requirements),a=n.phoneNumber!==void 0&&e.state.snapshot.next_action?.type===`verify_phone`;if(ke(e.state.snapshot.next_action)&&!a||Ct(i,n.values).length>0){r(!1),e.setState({confirmNonce:e.state.confirmNonce+1});return}e.setState({confirming:!0,confirmTransportError:void 0,settleNotice:void 0,blockedRedirectUrl:void 0});try{Dt(i)&&await Ue(e.sdk,e.state.clientSecretHeld,Et(i,n.values)),e.setState({purchaseDispatchNonce:e.state.purchaseDispatchNonce+1,purchasePaymentMethodType:n.paymentMethodType});let a=await ze(e.sdk,e.state.clientSecretHeld,{browser_behavior_v1:n.browserBehavior,...n.confirmationToken===null?{}:{confirmation_token:n.confirmationToken},...n.promoCode===void 0?{}:{promo_code:n.promoCode},...n.confirmationToken===null&&kt(i,n.values)?{email:kt(i,n.values)}:{},...n.phoneNumber===void 0?{}
56:{phone_number:n.phoneNumber},attestations:{tos_accepted:Ot(i,n.values)}});$(e,a),r(!a.last_confirm_error),n.phoneNumber!==void 0&&a.next_action?.type===`verify_phone`&&(e.setState({phoneCodeError:void 0}),Sr(e,J(a))),e.setState({confirming:!0,confirmNonce:e.state.confirmNonce+1}),await Fr({client:e.sdk,clientSecret:e.state.clientSecretHeld,runNextAction:e=>t.runNextAction(e),runVerifyPhone:()=>t.runVerifyPhone(),allowCompletionNavigation:()=>e.props.allowCompletionNavigation!==!1,onSnapshot:t=>$(e,t),onRedirectBlocked:t=>e.setState({blockedRedirectUrl:t}),onCompleteRest:t=>void Pr(e,t)},a),e.setState({confirming:!1,confirmNonce:e.state.confirmNonce+2})}catch(t){r(!1);let i=n.phoneNumber===void 0?void 0:br(t);if(i!==void 0){e.setState({confirming:!1,confirmNonce:e.state.confirmNonce+1,phoneCodeError:i});return}e.setState({confirming:!1,confirmNonce:e.state.confirmNonce+1,confirmTransportError:{code:`confirm_request_failed`,message:R(t,`The payment could not be submitted.`)}})}}async function Er(e,t,n){if(!(e.state.confirming||e.state.phoneCodePending||e.state.promoPending||e.state.currencyPending)){e.setState({confirming:!0,phoneCodePending:!0,phoneCodeError:void 0,confirmTransportError:void 0,settleNotice:void 0,blockedRedirectUrl:void 0});try{let r=await ze(e.sdk,e.state.clientSecretHeld,{phone_code:n.code});e.setState({phoneCodePending:!1}),$(e,r),e.setState({confirming:!0,confirmNonce:e.state.confirmNonce+1}),await Fr({client:e.sdk,clientSecret:e.state.clientSecretHeld,runNextAction:e=>t.runNextAction(e),runVerifyPhone:()=>t.runVerifyPhone(),allowCompletionNavigation:()=>e.props.allowCompletionNavigation!==!1,onSnapshot:t=>$(e,t),onRedirectBlocked:t=>e.setState({blockedRedirectUrl:t}),onCompleteRest:t=>void Pr(e,t)},r),e.setState({confirming:!1,confirmNonce:e.state.confirmNonce+2})}catch(t){e.setState({confirming:!1,phoneCodePending:!1,confirmNonce:e.state.confirmNonce+1,phoneCodeError:br(t)??`confirm_failed`}),Sr(e,J(e.state.snapshot))}}}async function Dr(e){if(!(e.state.confirming||e.state.phoneCodePending||e.state.promoPending||e.state.currencyPending)){e.setState({phoneCodePending:!0,phoneCodeError:void 0});try{await Be(e.sdk,e.state.clientSecretHeld);try{$(e,await Re(e.sdk,e.state.clientSecretHeld))}catch{}e.setState({phoneCodePending:!1})}catch(t){e.setState({phoneCodePending:!1,phoneCodeError:br(t)??`send_failed`})}}}async function Or(e){if(e.state.confirming||e.state.phoneCodePending||e.state.promoPending||e.state.currencyPending)return!1;e.setState({phoneCodePending:!0,phoneCodeError:void 0,phoneCodeSentTo:void 0});try{let t=await Ue(e.sdk,e.state.clientSecretHeld,{phone_number:null});return e.setState({phoneCodePending:!1}),$(e,t),!0}catch(t){return e.setState({phoneCodePending:!1,phoneCodeError:z(t)??`cancel_failed`,phoneCodeSentTo:J(e.state.snapshot)}),!1}}var kr=te(`checkout`).doc("Drives a full hosted checkout for one or more plans â itemized price summary, promo codes, the currency the buyer pays in, and the whole payment collection surface (the payments elements, composed inside) â against the Whop checkout sessions API. Mount it with `items`, a single `plan`, or a `checkoutConfiguration` you authored and the element opens the checkout session itself; the session credential never leaves the element. A setup-mode checkout configuration mounts the same element as a payment-method save: nothing is charged, the buyerâs method is stored for you to charge later, and the finished checkout redirects with `setup_intent_id`. The buyer pays inside the element, and a finished checkout redirects the current tab to `returnUrl`, including the page that contains the element. Fulfill from webhooks rather than a browser callback. Without a `returnUrl`, the buyer rests on the elementâs own success face. The element automatically drives an off-site payment step, such as 3DS or a bank page. On whop.com, it brings the buyer back into the restored checkout; in an embed, the buyer returns to the same `returnUrl`. A failed payment reopens the same checkout with the reason shown, so the buyer can pay again. Every option is set at creation: the element mints a checkout session from these values when it mounts. Changing one later with `update()` or new React props fails instead of changing the existing order. Mount a new checkout to change what is being purchased.").props(e=>({plan:e.default(void 0).analytics().doc("Existing plan ID, prefixed `plan_`. Shorthand for an `items` array containing this plan and `quantity`. The plan defines the price; nothing about amounts can be asserted client-side. Pass either `plan`, `items`, or a `checkoutConfiguration`. Set at create only: the session is minted from it, and changing it later refuses."),items:e.default(void 0).analytics(`plan`,`quantity`).doc("The plans in this checkout and how many units of each to purchase. Every item must belong to the same seller and use compatible billing terms; the API validates the complete cart and prices it as one charge. Pass this instead of `plan`, `quantity`, or `checkoutConfiguration`. Set at create only: the session is minted from this exact cart, and changing it later refuses."),checkoutConfiguration:e.default(void 0).analytics().doc("Existing checkout configuration ID, prefixed `ch_`. The element creates the checkout session from it: the configuration names the plan being sold (or, in `setup` mode, no plan â the checkout saves a payment method and charges nothing) and seeds its own affiliate code, metadata, redirect and payment-method presets â an option passed here beside it wins over the configurationâs copy, field by field. Pass `plan` alongside only to set `quantity`; it must be the configurationâs own plan, which can never be swapped out from under its presets. Set at create only."),quantity:e.default(void 0).analytics().doc(`How many units to purchase. Plans that disallow multiples refuse values above 1. Set at create only: the session is minted with it, and changing it later refuses. @default 1`),promoCode:e.default(void 0).analytics().doc(`A promo code to apply before the buyer ever sees the price â the discount is on the first quote, and the buyer can still change or remove it. Pass the code a marketing link carried: a code that has expired or was never valid opens the checkout at full price with the reason on the promo row, never a checkout that will not open. Set at create only.`),affiliateCode:e.default(void 0).analytics().doc(`The affiliate this checkout is attributed to. Set at create only.`),attribution:e.default(void 0).doc("Where this sale came from, for the account's reporting: the campaign parameters of the link the buyer arrived on (`utmSource`, `utmMedium`, `utmCampaign`, `utmTerm`, `utmContent`, a Whop `trackingLinkId`, a `funnelId`, and your own `source`). Everything here is recorded against the order and is never shown to the buyer. Set at create only."),metadata:e.default(void 0).doc(`Your own key/value pairs to record against the order and read back on the payment â order IDs, cart IDs, or anything you reconcile against. Up to 40 string pairs. Set at create only.`),returnUrl:e.default(void 0).doc(`Where the buyer lands after an off-site payment step. Https-only (http for localhost). Set at create only.`),session:e.direct().doc("DIRECT MODE ONLY â the whole session object exactly as the server-side create or retrieve returned it, with its `client_secret` on it. The element boots straight from it: no read round trip, no empty first paint. Set at create only."),resumeSession:e.direct().doc("Direct mode only. Checkout session ID, prefixed `chs_`, from the page URL. The API-origin resume cookie authorizes the read, and the response carries the credential back, so nothing secret ever r
56ides the URL. A 404 â no cookie, someone elseâs session, or an ID pointing at nothing â falls through to opening a fresh session from `plan` or `checkoutConfiguration`, so an unrestorable link strands nobody. Transient restore failures remain loud rather than minting a duplicate session. A restored session that already finished still boots; the elementâs own terminal faces say so. Set at create only."),claimLink:e.direct().doc("Direct mode only. The claim code a membership-transfer email carries (`/activate?code=â¦`), spent through the createâs `link` field: the code names no plan, so the server resolves the origin membershipâs own plan from the code itself. The session it mints is the claim â the URL rewrite plus the resume cookie is what a refresh restores, never a second spend. A spent or expired code still opens the session, which says so through `blocking_error` â the checkout renders with the refusal where the payment collection would be; only a code that matches nothing refuses the create, and the elementâs own unavailable face is the honest rendering for that. Set at create only."),password:e.direct().doc("DIRECT MODE ONLY â the password a legacy `?password=` link bakes in for a password-protected plan, forwarded into the session create. The right value clears the planâs gate up front for the sessionâs whole life; a wrong or absent one still opens the checkout, and the formâs own requirement asks. Set at create only."),forwardAttributionCookies:e.direct().doc(`DIRECT MODE ONLY â forwards host-only attribution cookies when opening a checkout on whop.com.`),sessionAddressed:e.direct().doc("DIRECT MODE ONLY â called once per boot with the minted or restored sessionâs id (`chs_â¦`): the hosted pageâs URL-sync hook, so a refresh restores the same checkout. The id is addressing, safe in a query parameter â the credential stays in the controller frame (§5) and neither it nor the session object ever rides this callback."),allowCompletionNavigation:e.direct().doc(`DIRECT MODE ONLY â whether a completed checkout may navigate away for a redirect or account claim.`)})).state(async(e,t)=>{let n=e.sdk,r=e.props,i=r.session?Ur(r.session):void 0;i??=r.resumeSession?await Wr(n,r.resumeSession):void 0,i??=await Gr(n,r);let a=i.clientSecret;if(!a)throw Error(`The checkout session came back without its client_secret.`);try{r.sessionAddressed?.(i.snapshot.id)}catch{}return{...yr(i,a),bootOptionsKey:$r(r),optionsKey:t.sync(e=>$r(e.props),[`plan`,`items`,`checkoutConfiguration`,`quantity`,`promoCode`,`affiliateCode`,`attribution`,`metadata`,`session`,`resumeSession`,`claimLink`,`password`,`forwardAttributionCookies`,`returnUrl`]),confirmNonce:0,confirmAttemptNonce:0,purchaseDispatchNonce:0,purchasePaymentMethodType:void 0}}).flowSurface(`checkout`,e=>e.snapshot.buyer_id??void 0).children(e=>({checkoutDetails:e(Nn).fromController(({state:e})=>{"use controller";let t=e.snapshot,n=rr(e);return{quote:t.quote,breakdown:n,displayCurrency:t.display_currency,availableCurrencies:t.available_currencies,promoCode:t.promo_code,promo:t.promo??null,promoCodeRefused:e.promoCodeRefused??null,promoError:e.promoError,promoPending:e.promoPending,showPromoInput:t.show_promo_code_input??!0,currencyPending:e.currencyPending,currencyFailed:!!e.currencyError,locked:e.confirming||e.phoneCodePending,itemDescription:t.items?.[0]?.description??null,invoiceDueAt:t.invoice_due_at??null}}),phoneCodeModal:e(Jn).fromController(({state:e})=>{"use controller";let t=e.snapshot.next_action;return{sentTo:e.phoneCodeSentTo,resendAvailableAt:t?.type===`verify_phone`?t.resend_available_at:void 0,pending:e.phoneCodePending,errorCode:e.phoneCodeError,sessionBusy:e.confirming||e.promoPending||e.currencyPending||e.passwordPending||e.taxIdPending}}),checkout:e(Q).slot(`entry`).fromController(({state:e})=>{"use controller";ei(e.bootOptionsKey,e.optionsKey);let t=e.snapshot,n=bt(t.requirements),r=rr(e);return{status:t.status,mode:t.mode,seller:t.seller,items:t.items,quote:t.quote,displayCurrency:t.display_currency,availableCurrencies:t.available_currencies,promoCode:t.promo_code,promo:t.promo??null,showPromoInput:t.show_promo_code_input??!0,returnUrl:e.returnUrl??t.return_url,payment:He(t),entry:t.entry?.id??null,setup:t.setup?.id??null,resultStatus:Le(t),resultSettling:We(t),pendingStepType:e.pendingStepType??null,transfer:t.transfer??null,invoiceDueAt:t.invoice_due_at??null,paymentMethodRequired:t.payment_method_required??null,confirmError:e.confirmTransportError??e.settleNotice??t.last_confirm_error,blockingError:t.blocking_error??null,confirming:e.confirming,confirmNonce:e.confirmNonce,confirmAttemptNonce:e.confirmAttemptNonce,purchaseDispatchNonce:e.purchaseDispatchNonce,purchasePaymentMethodType:e.purchasePaymentMethodType,promoPending:e.promoPending,promoError:e.promoError,promoCodeRefused:e.promoCodeRefused??null,currencyPending:e.currencyPending,currencyF
56ailed:e.currencyError!==void 0,passwordPending:e.passwordPending,passwordFailed:e.passwordError!==void 0,phoneNumber:t.phone_number??void 0,phoneVerified:t.phone_verified??!1,phoneCodePending:e.phoneCodePending,phoneCodeError:e.phoneCodeError,phoneCodeSentTo:e.phoneCodeSentTo,paymentMethodConfiguration:e.paymentMethodConfiguration,setupFutureUsage:e.setupFutureUsage,taxBehavior:t.tax_behavior??null,taxId:t.tax_id??null,collectTaxId:t.collect_tax_id??!1,taxIdPending:e.taxIdPending,taxIdFailed:e.taxIdError!==void 0,breakdown:r,offerAmounts:hr(e),pricing:Ne({items:t.items,quote:{breakdown:r}}),branding:e.branding,ctaLabel:t.cta_label??null,brandingPreview:t.metadata?.presentation===`branding_preview`,requirements:n,requirementValues:Tt(n,t),nextActionType:t.next_action?.type??null,redirectBlocked:e.blockedRedirectUrl!==void 0,nextActionBlocks:ke(t.next_action),awaitClaimState:t.next_action?.type===`await_claim`?t.next_action.state:null}}),expressCheckout:e(Ln).slot(`entry`).fromController(({state:e})=>{"use controller";ei(e.bootOptionsKey,e.optionsKey);let t=e.snapshot,n=bt(t.requirements);return{status:t.status,mode:t.mode,seller:t.seller,quote:t.quote,breakdown:rr(e),offerAmounts:hr(e),setupFutureUsage:e.setupFutureUsage,requirements:n,requirementValues:Tt(n,t),paymentMethodRequired:t.payment_method_required??null,paymentMethodConfiguration:e.paymentMethodConfiguration,transfer:t.transfer??null,ctaLabel:t.cta_label??null,nextActionBlocks:ke(t.next_action),brandingPreview:t.metadata?.presentation===`branding_preview`,confirming:e.confirming,confirmNonce:e.confirmNonce,confirmError:e.confirmTransportError??e.settleNotice??t.last_confirm_error,blockingError:t.blocking_error??null,promoPending:e.promoPending,showPromoInput:t.show_promo_code_input??!0,promoCode:t.promo_code,promo:t.promo??null,currencyPending:e.currencyPending,returnUrl:e.returnUrl??t.return_url,resultStatus:Le(t),resultSettling:We(t),redirectBlocked:e.blockedRedirectUrl!==void 0,nextActionType:t.next_action?.type??null,phoneCodePending:e.phoneCodePending,phoneCodeError:e.phoneCodeError,previewWallets:e.expressWalletPreview}})})).demo(e=>e.controls(e=>({amount:e.number(29,{label:`Plan price (major units)`,min:1,max:5e3,step:1}),currency:e.select(`eur`,[`eur`,`usd`],{label:`Buyerâs currency (the seller prices in USD)`}),promo:e.text(``,{label:`Applied promo code`}),pricing:e.select(`one_time`,[`one_time`,`subscription`,`trial`,`split_pay`,`initial_fee`,`free`],{label:`Pricing structure`}),requireTerms:e.boolean(!1,{label:`Seller requires explicit terms acceptance`}),questions:e.boolean(!1,{label:`Seller asks a required question`})})).props(()=>({plan:`plan_demo_1`})).state(e=>({clientSecretHeld:`chs_demo_secret_demo`,bootOptionsKey:`{"plan":"plan_demo_1"}`,optionsKey:`{"plan":"plan_demo_1"}`,snapshot:Br(e,zr(Hr(e.pricing,Qn,e.amount),e.currency),e.promo||null),returnUrl:`https://example.com/checkout/complete`,paymentMethodConfiguration:void 0,setupFutureUsage:void 0,breakdownPreview:void 0,breakdownKey:void 0,taxAddress:void 0,shippingTaxAddress:void 0,supportsBuyerFee:void 0,taxIdPending:!1,taxIdError:void 0,confirming:!1,confirmNonce:0,confirmAttemptNonce:0,purchaseDispatchNonce:0,purchasePaymentMethodType:void 0,confirmTransportError:void 0,settleNotice:void 0,promoPending:!1,promoError:void 0,promoCodeRefused:void 0,currencyPending:!1,currencyError:void 0,passwordPending:!1,passwordError:void 0,expressWalletPreview:In,phoneCodePending:!1,phoneCodeError:void 0,phoneCodeSentTo:void 0})).sdk(()=>{let e={pricing:`one_time`,amount:29,currency:`eur`,requireTerms:!1,questions:!1},t={...Br(e,zr(Hr(e.pricing,Qn,e.amount),e.currency),null),client_secret:`chs_demo_secret_demo`};return{users:{me:{id:`user_demo_1`,object:`user`,email:null,username:`demo`}},sessions:{destroyCurrent:null},sessionIntents:{recognize:{object:`session_intent_recognition`,recognized:!1},verify:{object:`session_intent`,id:`sess_demo_1`,status:`active`,client_secret:null},resend:{object:`session_intent`,id:`sess_demo_1`,status:`requires_verification`}},plans:{retrieve:{id:`plan_demo_1`,object:`plan`,currency:Qn,initial_price:e.amount,renewal_price:0,initial_price_due:{currency:Qn,amount:e.amount.toFixed(2),decimals:2,display_decimals:2},plan_type:`one_time`,account:{id:`biz_demo`,title:`Demo Seller`},payment_method_configuration:null}},paymentMethodTypes:M,checkoutSessions:{create:t,retrieve:t,update:t,confirm:{...t,status:`completed`,payment:{id:`pay_demo_1`,status:`succeeded`}}}}})).on(e=>{e.controller(Q,`detailsRequested`,async e=>{"use controller";await e.open(`checkoutDetails`)}),e.controller(`checkoutDetails`,`applyPromo`,async(e,t)=>{"use controller";await vr(e,t.code)}),e.controller(`checkoutDetails`,`selectDisplayCurrency`,async(e,t)=>{"use controller";await _r(e,t.currency)}),e.controller(Q,`applyPromo`,async(e,t)=>{"use controller";await vr(e,t.code)}),e.controller(Q,`submitPassword`,async(e,t)=>{"use controller";if(!(e.state.passwordPending||e.state.promoPending||e.state.currencyPending||e.state.phoneCodePending||e.state.confirming)){e.setState({passwordPending:!0,passwordError:void 0});try{$(e,await Ue(e.sdk,e.state.clientSecretHeld,{password:t.password})),e.setState({passwordPending:!1})}catch(t){e.setState({passwordPending:!1,passwordError:R(t,`password patch refused`)})}}}),e.controller(Q,`selectDisplayCurrency`,async(e,t)=>{"use controller";await _r(e,t.currency)}),e.controller(Jn,`submitPhoneCode`,async(e,t)=>{"use controller";await Er(e,e.slotOccupant(`entry`)===`expressCheckout`?e.children.expressCheckout:e.children.checkout,t)}),e.controller(Jn,`resendPhoneCode`,async e=>{"use controller";await Dr(e)}),e.controller(Jn,w.destroyed,async e=>{"use controller";e.state.phoneCodeSentTo!==void 0&&e.slotOccupant(`entry`)!==null&&(await new Promise(e=>setTimeout(e,0)),!e.children.phoneCodeModal.created&&e.state.phoneCodeSentTo!==void 0&&(await Or(e)||await Sr(e,J(e.state.snapshot))))}),e.controller(Q,`taxAddressChanged`,async(e,t)=>{"use controller";let n=t.address??void 0;e.setState({taxAddress:n}),await fr(e,{...nr(e.state),address:n??e.state.shippingTaxAddress})}),e.controller(Q,`shippingAddressChanged`,async(e,t)=>{"use controller";let n=t.address??void 0;e.setState({shippingTaxAddress:n}),!e.state.taxAddress&&await fr(e,{...nr(e.state),address:n})}),e.controller(Q,`taxIdChanged`,async(e,t)=>{"use controller";if(!(e.state.taxIdPending||e.state.promoPending||e.state.currencyPending||e.state.phoneCodePending||e.state.confirming)){e.setState({taxIdPending:!0,taxIdError:void 0});try{$(e,await Ue(e.sdk,e.state.clientSecretHeld,{tax_id:t.taxId})),e.setState({taxIdPending:!1})}catch(t){e.setState({taxIdPending:!1,taxIdError:R(t,`tax id patch refused`)})}}}),e.controller(Q,`buyerFeeSupportChanged`,async(e,t)=>{"use controller";let n=t.supportsBuyerFee??void 0;
56n!==e.state.supportsBuyerFee&&(e.setState({supportsBuyerFee:n}),await fr(e,{...nr(e.state),supportsBuyerFee:n}))}),e.controller(Q,`surfaceReady`,async e=>{"use controller";await Cr(e,e.slotOccupant(`entry`)===`expressCheckout`?e.children.expressCheckout:e.children.checkout)}),e.controller(Ln,`surfaceReady`,async e=>{"use controller";await Cr(e,e.slotOccupant(`entry`)===`expressCheckout`?e.children.expressCheckout:e.children.checkout)}),e.controller(Q,`identityStepRequested`,async e=>{"use controller";await wr(e,e.slotOccupant(`entry`)===`expressCheckout`?e.children.expressCheckout:e.children.checkout)}),e.controller(Ln,`identityStepRequested`,async e=>{"use controller";await wr(e,e.slotOccupant(`entry`)===`expressCheckout`?e.children.expressCheckout:e.children.checkout)}),e.controller(Q,`redirectRetryRequested`,e=>{"use controller";let t=e.state.blockedRedirectUrl;typeof t==`string`&&(W(t)||window.open(t,`_blank`,`noopener`))}),e.controller(Ln,`redirectRetryRequested`,e=>{"use controller";let t=e.state.blockedRedirectUrl;typeof t==`string`&&(W(t)||window.open(t,`_blank`,`noopener`))}),e.host(Q,`walletHandoffRequested`,(e,t)=>{"use host";let n=e.children.checkout;se(t,{change:e=>n.walletHandoffChanged(e),settle:e=>n.walletHandoffSettled(e)})}),e.host(Q,`walletHandoffConcluded`,(e,t)=>{"use host";N(t.id,t.outcome)}),e.host(Ln,`walletHandoffRequested`,(e,t)=>{"use host";let n=e.children.expressCheckout;se(t,{change:e=>n.walletHandoffChanged(e),settle:e=>n.walletHandoffSettled(e)})}),e.host(Ln,`walletHandoffConcluded`,(e,t)=>{"use host";N(t.id,t.outcome)}),e.controller(Q,`confirmRequested`,async(e,t)=>{"use controller";await Tr(e,e.slotOccupant(`entry`)===`expressCheckout`?e.children.expressCheckout:e.children.checkout,t)}),e.controller(Ln,`confirmRequested`,async(e,t)=>{"use controller";await Tr(e,e.slotOccupant(`entry`)===`expressCheckout`?e.children.expressCheckout:e.children.checkout,t)})}),Ar=8,jr=5,Mr=1500,Nr=new Set;async function Pr(e,t){try{let n=await Pe(q(t),Fe(t));e.setState({pendingStepType:n.next_action?.type})}catch{}}async function Fr(e,t){if(Nr.has(e.clientSecret))return;Nr.add(e.clientSecret);let n=K();try{await Lr(e,t,n)}finally{n.dispose(),Nr.delete(e.clientSecret)}}async function Ir(e,t,n){let r=0;for(;;)try{return await Re(e,t)}catch(e){if(r+=1,r>=jr)throw e;await n.wait(Mr)}}async function Lr(e,t,n){let r=t,i=!1,a=!1;for(let t=0;t<Ar;t+=1){let t=r.next_action;if(!t)break;if(t.type===`complete`){if(a){e.onCompleteRest(t.client_secret);break}a=!0}t.type===`redirect`&&(i=!0);let o=await Rr(e,t,r,n);if(o===`left`)return;if(o===`stop`)break;try{r=await Ir(e.client,e.clientSecret,n)}catch{return}e.onSnapshot(r)}r.next_action?.type!==`wait_for_payment`&&!i&&Ve(r)&&G(Y(r))}async function Rr(e,t,n,r){switch(t.type){case`complete`:try{let n=await e.runNextAction({clientSecret:t.client_secret});if(n.blockedUrl!==void 0)return e.onRedirectBlocked(n.blockedUrl),`stop`}catch{}return`advanced`;case`redirect`:{if(!e.allowCompletionNavigation())return G(Y(n)),`stop`;let r=H(t.destination_url);return r?U(r,Y(n))===`blocked`?(e.onRedirectBlocked(r),`stop`):`left`:(G(Y(n)),`stop`)}case`authenticate`:return n.status===`completed`&&e.allowCompletionNavigation()&&B(n.id)?`left`:`stop`;case`upgrade_authentication`:return n.status===`completed`&&e.allowCompletionNavigation()&&B(n.id)?`left`:`stop`;case`wait_for_payment`:return await r.wait(Oe(t.poll_after_seconds)),`advanced`;case`verify_phone`:return`stop`;case`await_claim`:return`stop`;default:return`stop`}}function zr(e,t){let n=Me(e).dueToday,r=e.planType===`one_time`&&n>0&&t!==Qn,i=r?t:Qn,a=e=>r?Number((e*$n).toFixed(2)):e,o=a(n),s=e=>({currency:i,amount:e.toFixed(2),decimals:2,display_decimals:2}),c=(e.planType===`renewal`&&e.trialPeriodDays===null?[e.initialPrice,e.renewalPrice]:[e.initialPrice]).map(a).filter(e=>e>0),l=e.planType===`renewal`&&e.renewalPrice>0&&e.billingPeriod!==null?[{type:e.splitPayRequiredPayments===null?`recurring`:`installments`,description:`Demo plan`,amount:s(e.renewalPrice),charge_at:new Date(Date.now()+(e.trialPeriodDays??e.billingPeriod)*864e5).toISOString(),interval_days:e.billingPeriod,...e.trialPeriodDays===null?{}:{trial_days:e.trialPeriodDays},...e.splitPayRequiredPayments===null?{}:{remaining:e.splitPayRequiredPayments-+(o>0)}}]:[],u=Me(e),d=l[0],f=e.trialPeriodDays!==null,p=e.planType===`renew
56al`?a(e.initialPrice):0,m=e.splitPayRequiredPayments,h=d?{interval_days:e.billingPeriod,...m===null?{}:p>0||f?{remaining_payments:m-+(o>0)}:{total_payments:m}}:{},ee=d?{kind:`then_starting`,text:``,amount:d.amount,detail:{charge_at:d.charge_at,interval_days:e.billingPeriod}}:null,g=u.free?u.accessDays===null?null:{kind:`access_window`,text:``,detail:{access_days:u.accessDays}}:d?f?ee:p>0?{kind:`due_today`,text:`Due today`}:{kind:`period`,text:``,detail:h}:u.accessDays===null?{kind:`one_time_payment`,text:`One-time payment.`}:{kind:`one_time_payment`,text:``,detail:{access_days:u.accessDays}},_=f&&p===0&&d?{kind:`trial`,text:`${e.trialPeriodDays} days free`,amount:null,original_amount:null,trial_days:e.trialPeriodDays,free_until:null,context:[ee]}:u.free?{kind:`free`,text:`Free`,amount:null,original_amount:null,trial_days:null,free_until:null,context:g?[g]:[]}:{kind:`amount`,text:``,amount:s(o),original_amount:null,trial_days:null,free_until:null,context:g?[g]:[]},v=!u.free&&d&&p>0?[{kind:`initial_fee`,label:`Initial fee`,text:``,amount:s(p)},...f?[]:[{kind:`renewal_fee`,label:`Renewal fee`,text:``,amount:d.amount,detail:h}]]:[],y=u.free?[]:[{kind:`total_due_today`,text:``,amount:s(o)},...f&&d?[{kind:`total_after_trial`,text:``,amount:d.amount,detail:{trial_days:e.trialPeriodDays,...p>0?{paid_trial:!0}:{},...h}}]:[]];return{currency:i,base_currency:Qn,base_amount:n,exchange_rate:r?$n:null,quoted_at:`2026-01-01T00:00:00.000Z`,expires_at:`2026-01-01T00:15:00.000Z`,breakdown:{currency:i,lines:(c.length>0?c:[0]).map(e=>({kind:`plan`,description:`Demo plan`,quantity:1,unit_amount:s(e),amount:s(e)})),subtotal:s(o),adjustments:[],total:s(o),upcoming:l,display:{headline:_,sections:{line_items:v,charges:[],totals:y,fee_breakdown:[]}}}}}function Br(e,t,n){let r=[{type:`email`,fields:null,verify:null}];return e.questions&&r.push({type:`custom_fields`,fields:[{id:`field_demo_1`,name:`Discord username`,description:null,placeholder:`ada#0001`,field_type:`text`,required:!0}],verify:null}),e.requireTerms&&r.push({type:`terms`,fields:null,verify:null}),{id:`chs_demo`,object:`checkout_session`,status:`open`,mode:`payment`,tax_behavior:null,seller:{id:`biz_demo`,title:`Demo Seller`,logo_url:null,terms:{terms_url:`https://example.com/terms`,privacy_policy_url:`https://example.com/privacy`,return_policy_url:null,eula_url:null}},requirements:r,next_action:null,items:[{plan:`plan_demo_1`,quantity:1,expiration_days:e.pricing===`one_time`?365:null}],display_currency:t.currency,available_currencies:Vr(t.currency),quote:t,buyer_email:null,promo_code:n,promo:null,show_promo_code_input:!0,affiliate_code:null,custom_field_responses:[],shipping_address:null,phone_number:null,metadata:null,return_url:`https://example.com/checkout/complete`,payment:null,setup:null,last_confirm_error:null,blocking_error:null,created_at:`2026-01-01T00:00:00.000Z`,expires_at:`2026-01-31T00:00:00.000Z`}}function Vr(e){return e===Qn?[Qn]:[Qn,e]}function Hr(e,t,n){let r={currency:t,planType:`renewal`,initialPrice:0,renewalPrice:n,postPromoRenewalPrice:null,billingPeriod:30,trialPeriodDays:null,splitPayRequiredPayments:null,expirationDays:null};switch(e){case`subscription`:return r;case`trial`:return{...r,trialPeriodDays:7};case`split_pay`:return{...r,splitPayRequiredPayments:4};case`initial_fee`:return{...r,initialPrice:Math.round(n/2)};case`free`:return{...r,planType:`one_time`,renewalPrice:0,billingPeriod:null};default:return{...r,planType:`one_time`,initialPrice:n,renewalPrice:0,billingPeriod:null,expirationDays:365}}}function Ur(e){let t=e;return{snapshot:t,clientSecret:t.client_secret,...Xr}}async function Wr(e,t){try{let n=await Ke(e,t),r=n.client_secret;if(!r)throw Error(`The restored checkout session came back without its client_secret.`);return{snapshot:n,clientSecret:r,...Xr}}catch(e){if(e instanceof _&&e.statusCode===404)return;throw e}}async function Gr(e,t){let n=t.forwardAttributionCookies&&typeof document<`u`?document.cookie:``,r={...Jr(t),affiliate_code:t.affiliateCode,password:t.password,attribution:Wn(t.attribution),metadata:Gn(t.metadata),return_url:t.returnUrl,tracking_link_ids_by_account:t.forwardAttributionCookies?qe(n):void 0,affiliate_code_candidates:t.forwardAttributionCookies?Je(n):void 0},i=t.promoCode?.trim();if(!i)try{return Yr(await Kr(e,r),Xr)}catch(e){qr(e)}try{return Yr(await Kr(e,{...r,promo_code:i}),Xr)}catch(t){if(!Zr(t))throw t;try{return Yr(await Kr(e,r),{promoError:R(t,`That promo code could not be applied.`),promoCodeRefused:i})}catch(e){qr(e)}}}async function Kr(e,t){try{return await Ie(e,t)}catch(e){throw Xe(e)?new Ye(R(e,`This checkout is not available.`)):e}}function qr(e){throw Zr(e)?new ni(R(e,`This checkout could not be created.`)):e}function Jr(e){if(e.claimLink)return{link:e.claimLink};if(e.items!==void 0){if(e.plan||e.quantity!==void 0||e.checkoutConfiguration)throw new ti(`CHECKOUT_ITEMS_AMBIGUOUS`,"`items` is the complete cart â do not combine it with `plan`, `quantity`, or `checkoutConfiguration`.");return{items:Qr(e.items)}}if(e.checkoutConfiguration){if(e.plan)return{checkout_configuration:e.checkoutConfiguration,items:[{plan:e.plan,quantity:e.quantity??1}]};if(e.quantity!==void 0)throw new ti(`CHECKOUT_QUANTITY_NEEDS_PLAN`,"`quantity` rides the `items` form, which must name the configurationâs own plan â pass `plan` beside `checkoutConfiguration` to set it.");return{checkout_configuration:e.checkoutConfiguration}}if(!e.plan)throw new ti(`CHECKOUT_PLAN_MISSING`,"Mount the checkout with a `plan` (`plan_â¦`) or a `checkoutConfiguration` (`ch_â¦`) â it is what the checkout session is created from.");return{items:[{plan:e.plan,quantity:e.quantity??1}]}}function Yr(e,t){return{snapshot:e,clientSecret:e.client_secret,...t}}var Xr={promoError:void 0,promoCodeRefused:void 0};function Zr(e){return e instanceof _&&e.statusCode===400}function Qr(e){if(e.length===0)throw new ti(`CHECKOUT_ITEMS_EMPTY`,"`items` must contain at least one plan.");return e.map(e=>{let t=e.quantity??1;if(!e.plan||!Number.isSafeInteger(t)||t<1)throw new ti(`CHECKOUT_ITEM_INVALID`,`Every checkout item needs a plan ID and a positive whole-number quantity.`);return{plan:e.plan,quantity:t}})}function $r(e){return JSON.stringify(e.session?{session:e.session.id}:{plan:e.plan??null,items:e.items?.map(e=>({plan:e.plan,quantity:e.quantity??1}))??null,checkoutConfiguration:e.checkoutConfiguration??null,quantity:e.quantity??1,promoCode:e.promoCode?.trim()||null,affiliateCode:e.affiliateCode??null,attribution:Wn(e.attribution)??null,metadata:Gn(e.metadata)??null,resumeSession:e.resumeSession??null,claimLink:e.claimLink??null,password:e.password??null,forwardAttributionCookies:e.forwardAttributionCookies??!1,returnUrl:e.returnUrl??null})}function ei(e,t){if(e!==t)throw new ti(`CHECKOUT_OPTIONS_FROZEN`,`Checkout options are create-time: this handle already minted a session from the options it booted with, so changing plan, items, checkoutConfiguration, quantity, promoCode, affiliateCode, attribution, metadata, session, resumeSession, claimLink, password, forwardAttributionCookies, or returnUrl cannot move it. Destroy this checkout and create a new one to change what is being bought.`)}
56var ti=class extends Error{code;constructor(e,t){super(`[${e}] ${t}`),this.name=`CheckoutOptionsError`,this.code=e}},ni=class extends Error{code=`CHECKOUT_REQUEST_REFUSED`;constructor(e){super(`[CHECKOUT_REQUEST_REFUSED] ${e}`),this.name=`CheckoutRequestRefusedError`}};function ri(e,t){return e.breakdown.total.amount!==t.breakdown.total.amount||e.currency!==t.currency||e.quoted_at!==t.quoted_at}function ii(e){let{client_secret:t,...n}=e;return n}export{Ze as i,Q as n,tt as r,kr as t}; 57//# debugId=6ba92946-4159-5b0d-a9f2-b491d72e76e0
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.