PageSourceSearch

https://copenhagenbamboo.com/cdn/shopifycloud/checkout-web/assets/…ts-PaymentMethodProgressionHost.BmXVNMRw.js

js copenhagenbamboo.com collected 2026-09-30 21:58:39 UTC 136,205 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["component-PayPalExpressPaymentMethod.AFxZv95U.js","esnext-vendor.BDPAaZdq.js","Choice.BIzIW4rp.js","hydrate.B0xlt2dG.js","hooks-useReplaceShopPayInHistory.C8UL-mAH.js","app.D1P6yWfp.js","assets/app.BuSMBobh.css","assets/useReplaceShopPayInHistory.BpuyvRSB.css","helpers-getNormalizedPaymentMethodName.B-mE5wnL.js","shared-permissions.BaDWlj5_.js","hooks-useShopPayExternalAppContext.DyGXtar4.js","assets/previous.SPd9u6sV.css","Checkbox.CiixBh9Z.js","assets/Checkbox.SrYMuQu4.css","assets/Choice.B7lVAtpz.css","localization-index.Bo8bPuxq.js","helpers-credit-card-disabled.BnSr1GsQ.js","assets/index.CIy8uDiZ.css","hooks-usePaypalRowEffects.CTzKbnMt.js","components-RedirectionNotice.module.BGJWZ6-9.js","assets/RedirectionNotice.B8v_QGNW.css","components-useVaultedMsiInstallments.Br5peiWP.js","amazon-pay-useAmazonPayPaymentLine.BXwZMsYY.js","PaymentIcon.CQXs-ePm.js","assets/PaymentIcon.gzvCNwz_.css","PaymentLine.BkPc0Zsc.js","assets/PaymentLine.BGhbZYQP.css","EmptyState.b83C9ddY.js","assets/EmptyState.BEvzDDvy.css","hooks-useUpdateCheckoutAddress.xu8w67CI.js","helpers-derivations.DLW2fhKL.js","graphql-PaymentSessionMutation.BhOnX3QJ.js","money-toShopPayMoneyInput.-nuohgDW.js","redemption-promotions.CgqGtCd-.js","shop-pay-normalizeBuyerDetails.ThnUnxcv.js","checkout-updaters-helpers.BAeH3ddd.js","helpers-setAddressErrors.BA8OjimY.js","assets/useVaultedMsiInstallments.BcTJoNaV.css","PayButton-helpers.Dg5kgVMm.js","Section._KuAKpGQ.js","assets/Section.CU18S7Ap.css","ImpressionEventCapture.iMEQlBKs.js","ChangeCompanyLocationLink.Ci5U9F_D.js","BillingAddressForm.aTSlVDrG.js","FormLayout.CMVyKzjL.js","assets/FormLayout.CrYq3At_.css","PhoneField.ykPh8SPx.js","hooks-useSuppressShopPayModalOnLoad.brztd70E.js","assets/PhoneField.uZEuHncj.css","Popover.BUTwaoOa.js","assets/Popover.Bi1nHaU-.css","AddressPresenter.B0qw2vWQ.js","assets/BillingAddressForm.BdwN7V1K.css","hooks-useShopPayProgressIntercepts.Sxhi7oHx.js","assets/useShopPayProgressIntercepts.xO_7ctnq.css","MissingFields.DB7ri4eR.js","useAddressMutationsWithNegotiation.BfzEjUy6.js","assets/MissingFields.BbxB_6wt.css","Rollup.iQVJ47hC.js","assets/Rollup.DKll7CHa.css","utilities-publishMessage.BORnEDuA.js","utilities-stable-ref.Dvd2X3ul.js","hooks-useGeneralPaymentErrorMessage.Zl8_48Ok.js","component-lazyBankPaymentMethod.DRDx6Xmg.js","WalletsSandbox-WalletSandbox.Dp4t7VmS.js","hooks-useStableHostMethodsReferences.DLE4q0sj.js","assets/WalletSandbox.BoV0vp4z.css","assets/lazyBankPaymentMethod.Bunr75uw.css","component-lazyPaymentMethods.BiEwX9TN.js","assets/lazyPaymentMethods.1ZqBR0y1.css","assets/payment-selector-transitions.Wfh8Woqf.css"])))=>i.map(i=>d[i]);
2import{f as ue,T as j,q as k,k as X,h as F,a as pt,u as n,S as W,e as _e,A as z,o as qs,n as Ks,X as js,x as Xs,i as be,D as Js,g as we,W as Pa,N as qn,_ as mn,l as Aa,d as wt,r as Tt,aA as Zs}from"./esnext-vendor.BDPAaZdq.js";import{Q as se,O as S,bY as pn,ba as Nt,ce as et,bh as Te,V as Me,cg as lt,cA as Dt,j2 as Qs,j3 as er,fz as Ea,bb as Bt,j4 as tr,j5 as nr,bH as ar,eS as sr,aS as Ne,b0 as Ma,j6 as Kn,aq as yn,S as rr,X as ir,P as pe,aK as or,aJ as lr,j7 as dr,j8 as cr,a$ as ur,g5 as Ia,b$ as ae,j9 as mr,ja as 
2La,_ as dt,b9 as ka,ae as pr,aL as yr,v as wa,gU as fr,jb as hr,a8 as Ta,jc as jn,eo as gr,N as Na,jd as _r,je as vr,d7 as Kt,T as fn,d6 as br,jf as Da,bZ as Cr,aW as Sr,du as tn,dw as Pr,jg as Ar,H as Er,hB as Se,U as ke,cC as Ba,jh as Mr,G as nn,ji as Ir,ad as Fa,eK as Lr,eL as kr,bj as wr,b7 as Mt,aF as an,jj as Tr,jk as Nr,aX as Dr,a6 as Br,bA as Fr,jl as xr,gW as Xn,b_ as Rr,dk as Or,c2 as Vr,b8 as zr}from"./hooks-useReplaceShopPayInHistory.C8UL-mAH.js";import{bR as Ft,h as xt,a1 as xa,e6 as sn,c as N,aw as We,F as Je,o as V,gF as hn,k as Hr,B as le,br as Ra,bs as gn,dl as Ur,dz as $r,e4 as Oa,gJ as Gr,_ as _n,aL as Wr,aN as Yr,aO as Va,aJ as Rt,b as Ee,a3 as qr,H as Ot,I as ve,P as de,l as Ze,a as Kr,eM as za,be as jr,hY as vn,hZ as Xr,A as Ha,C as Ua,d0 as Ge,cb as $a,d as Ga,W as xe,E as Oe,fl as bn,en as Cn,fo as Jr,L as Re,M as Zr,bY as Qr,bZ as ei,h_ as ti,e as ni,af as Wa,a4 as Vt,h$ as Jn,i0 as ai,ad as si,i1 as Ya,i2 as ri,i3 as ii,i4 as oi,i5 as li,a7 as di,t as he,cv as ci,cw as jt,ab as ui,aa as Sn,av as mi,h5 as Pn,bd as An,e9 as pi,ea as yi,a5 as fi,bB as qa,h6 as hi,ec as gi,am as Ka,x as En,Q as _i,eV as vi,bl as bi,al as ja,eU as Mn,bH as In,i6 as Zn,i7 as Ci,ew as Si,c$ as Xa,eX as Pi,i8 as Ai,cU as Ei,bx as Ja,hJ as Mi,hK as Qn,i9 as Ln,eb as Ii,ed as Li}from"./hydrate.B0xlt2dG.js";import{u as $e,a as ea}from"./graphql-PaymentSessionMutation.BhOnX3QJ.js";import{a as ki}from"./Section._KuAKpGQ.js";import{h as kn,_ as yt}from"./app.D1P6yWfp.js";import{b as fe,a as zt,_ as wi,C as Ti}from"./Choice.BIzIW4rp.js";import{I as Ue}from"./ImpressionEventCapture.iMEQlBKs.js";import{S as Ni,A as ta,a as Di}from"./ChangeCompanyLocationLink.Ci5U9F_D.js";import{A as ft,B as Bi,l as Fi,C as xi,j as Ri,m as ge,E as Za,F as ct,H as Qa,I as Ht,P as Oi,M as es,J as Ut,K as Vi,L as zi,O as Hi,Q as Ui,D as ut,R as $i,U as Gi,W as Wi,N as it,f as Yi,k as qi}from"./components-useVaultedMsiInstallments.Br5peiWP.js";import{a as wn,i as Ki}from"./money-toShopPayMoneyInput.-nuohgDW.js";import{C as ht}from"./Checkbox.CiixBh9Z.js";import{b as ji,u as Xi,A as Ji,B as It,c as Zi}from"./BillingAddressForm.aTSlVDrG.js";import{b as Qi,W as Tn,a as eo}from"./localization-index.Bo8bPuxq.js";import{u as ts,O as Nn,M as to}from"./hooks-useShopPayProgressIntercepts.Sxhi7oHx.js";import{v as no}from"./helpers-credit-card-disabled.BnSr1GsQ.js";import{c as ao,C as Dn,M as so,A as ns,d as ro}from"./MissingFields.DB7ri4eR.js";import{R as gt}from"./Rollup.iQVJ47hC.js";import{T as $t}from"./utilities-publishMessage.BORnEDuA.js";import{b as Bn,u as io,a as oo}from"./useAddressMutationsWithNegotiation.BfzEjUy6.js";import{e as rn,t as na,h as lo}from"./PayButton-helpers.Dg5kgVMm.js";import{a as co}from"./EmptyState.b83C9ddY.js";import{d as uo,a as mo,c as as,b as Fn}from"./hooks-useGeneralPaymentErrorMessage.Zl8_48Ok.js";import{P as tt,w as Lt}from"./PaymentIcon.CQXs-ePm.js";import{F as xn,a as on}from"./FormLayout.CMVyKzjL.js";import{S as kt,O as aa,s as po}from"./helpers-setAddressErrors.BA8OjimY.js";import{P as yo}
2from"./Popover.BUTwaoOa.js";import{g as fo}from"./PaymentLine.BkPc0Zsc.js";import{a as ss,u as ho,b as go}from"./hooks-useUpdateCheckoutAddress.xu8w67CI.js";import{f as _o,a as vo}from"./helpers-derivations.DLW2fhKL.js";function Rn(){const{paymentLines:e}=se();return ue(()=>{const a=e.value.find(s=>!!(s.method?.type==="direct"&&s.method?.creditCardLastFourDigits&&s.method?.brand));if(a)return a.method})}class bo extends Error{constructor(){super(...arguments),this.name="EmptyPaymentLinesError"}}function rs(){const{observability:e,shop:{paymentMethodAutoSelectionDisabled:t,paymentGateways:a}}=S(),s=Ft(),r=Rn(),i=!t,o=pn(),l=Nt("paymentMethods"),c=j(()=>a?.map(d=>d.name)??[],[a]);return k(d=>{const u=typeof a<"u"&&a.length>0,p=!l.value&&o.value.length>0;if(!u||!p)return;const _={hasSessionCard:!!r.value,paymentGateways:c,paymentMethodAutoSelectionDisabled:t,paymentRequired:s.value,stage:d};i&&e.error(new bo(`Payment lines are unexpectedly empty during "${d}" stage. Negotiation was blocked.`),{severity:"error",metadata:{app:_}})},[i,o,r,l,e,c,a,t,s])}function _m(){const{i18n:e,observability:t}=S(),a=Ft(),r=se().paymentLines.value,[i,o]=X(!1),[l,c]=X(!1),{negotiate:d}=xt(),u=rs(),p=k(async()=>{l||(c(!0),await d({force:!1,fieldsToResolve:["taxes","paymentMethods"],include:["paymentLines"],onComplete(){o(!0),c(!1)}}))},[d,l]);F(()=>{const m=r.find(v=>["paymentOnDelivery","manualPayment","customManualPayment"].includes(v.method.type));(r.find(v=>v.method.type==="offsite")||m)&&!i&&p()},[r,p,i]),xa({active:l}),et(({parts:m,reason:_})=>{if(_!=="progression"&&_!=="completion"||!a.value)return{behavior:"allow"};const g=m.paymentLines.peek()[0];if(g===void 0)return u(_),{behavior:"block",reason:Te.EmptyPaymentLines,errors:[{message:e.translate("field_errors.payment_gateway_missing"),target:sn}],perform:()=>{}};switch(g.method.type){case"giftCard":case"local":case"customOnsite":case"direct":case"offsite":case"redeemable":return{behavior:"allow"};case"deferred":{const y={method:{type:"deferred"}};return{behavior:"allow",perform(){$e(m,y)}}}case"paymentOnDelivery":{const{additionalDetails:y,paymentInstructions:f,paymentMethodIdentifier:b,availablePresentmentCurrencies:P}=g.method,C={method:{type:"paymentOnDelivery",additionalDetails:y,paymentInstructions:f,paymentMethodIdentifier:b,availablePresentmentCurrencies:P}};return{behavior:"allow",perform(){$e(m,C)}}}case"manualPayment":{const{id:y,name:f,additionalDetails:b,paymentInstructions:P,paymentMethodIdentifier:C,availablePresentmentCurrencies:A}=g.method,I={method:{id:y,type:"manualPayment",name:f,additionalDetails:b,paymentInstructions:P,paymentMethodIdentifier:C,availablePresentmentCurrencies:A}};return{behavior:"allow",perform(){$e(m,I)}}}case"customManualPayment":{const{id:y,name:f,additionalDetails:b,paymentInstructions:P,paymentMethodIdentifier:C,availablePresentmentCurrencies:A}=g.method,I={method:{id:y,type:"customManualPayment",name:f,additionalDetails:b,paymentInstructions:P,paymentMethodIdentifier:C,availablePresentmentCurrencies:A}};return{behavior:"allow",perform(){$e(m,I)}}}case"wallet":{if(g.method.name!=="PAYPAL_EXPRESS")return{behavior:"allow"};const{walletContent:y}=g.method;return{behavior:"allow",async perform({behavior:f}){if(f!=="allow")return;$e(m,{method:{type:"wallet",name:"PAYPAL_EXPRESS",walletContent:y}})}}}case"walletsPlatformPaymentMethod":{const{name:y,walletParams:f}=g.method;return{behavior:"allow",perform(){$e(m,{method:{type:"walletsPlatformPaymentMethod",name:y,walletParams:f}})}}}case Me.CreditCard:case Me.PayPal:case"bank":case"shopWallet":return{behavior:"allow"};case"noop":case"other":return t.log("payment_unexpected_payment_line_detected","Unexpected payment line",{type:g.method.type}),{behavior:"allow"};default:pt(g.method)}})}const Co="network-selector-";function So(e){return`${Co}${e.toLowerCase()}`}const Po="o0Dix",Ao="fmZaX",sa={NetworkSelector:Po,NetworkSelectorPressable:Ao};function Eo({selectableBrands:e=[],activeBrand:t,onSelectBrand:a,viewTransitionKey:s,size:r}){const{i18n:i}=S(),o=(c,d)=>{const u=e.length-1;let p;switch(c.key){case"ArrowRight":case"ArrowDown":p=d===u?0:d+1;break;case"ArrowLeft":case"ArrowUp":p=d===0?u:d-1;break;case"Home":p=0;break;case"End":p=u;break;default:return}if(p<0)return;c.preventDefault();const m=c.currentTarget.parentElement?.children[p];
2m&&(m.focus(),a(e[p]))},l=(c,d)=>{c.preventDefault(),a(d)};return n("div",{className:sa.NetworkSelector,role:"radiogroup","aria-label":i.translate("payment.network_card_payment_options"),children:n(N,{direction:"inline",gap:"small-400",children:e.map((c,d)=>{const u=t===c,p=t?u:void 0,m=t?!p:void 0,_=u||!t&&d===0?0:-1,h={viewTransitionName:`vt-${s}-${c}`},v=So(c);return n("button",{id:v,"aria-label":lt(c),"aria-checked":u,role:"radio",className:sa.NetworkSelectorPressable,style:h,onClick:g=>l(g,c),onKeyDown:g=>o(g,d),tabIndex:_,type:"button",children:n(tt,{type:c,size:r,disabled:m,active:p,accessibilityVisibility:"hidden"})},c)})})})}const Mo="mpn0m",Io="_6f3AR",Lo="KOEBK",ln={PaymentIcons:Mo,PaymentIcon:Io,morePaymentBrandsIcon:Lo};function ra({paymentBrands:e,activeIconDisplayed:t,activePaymentBrand:a,viewTransitionKey:s,size:r}){const{i18n:i}=S();return n(W,{children:e.map(o=>{const l=n(tt,{type:o,size:r,disabled:t&&a!==o,active:a===o}),c=s?`vt-${s}-${o}`:void 0,u=c?n("span",{id:c,style:{viewTransitionName:c,display:"flex"},className:ln.PaymentIcon,children:l},o):n(W,{children:l},o);return o==="BOGUS"?n(We,{accessibilityLabel:i.translate("payment_gateway.bogus_label"),overlay:n(hn,{children:i.translate("payment_gateway.bogus_label")}),children:u},o):u})})}function dn({paymentBrands:e,activePaymentBrand:t,viewTransitionKey:a,brandCountOverride:s,size:r,maxVisibleBrands:i,overflowIndicatorRef:o}){const l=e.filter(h=>Dt(h)),c=Qs(l.length,i),{visiblePaymentBrands:d,hiddenPaymentBrands:u}=er(l,c),p=t?!!d.includes(t):!1,m=u.length>0||s,_=s?`+${s}`:`+${u.length}`;return n("div",{className:ln.PaymentIcons,children:n(N,{direction:"inline",gap:"small-400",alignItems:"center",children:[n(ra,{paymentBrands:d,activeIconDisplayed:p,activePaymentBrand:t,viewTransitionKey:a,size:r}),m&&n(We,{ref:o,accessibilityVisibility:"hidden",overlay:s?null:n(hn,{id:"additional-payment-brand-icons",children:n(N,{direction:"inline",gap:"small-400",alignItems:"center",children:n(ra,{paymentBrands:u,activeIconDisplayed:p,activePaymentBrand:t,viewTransitionKey:a,size:r})})}),className:ln.morePaymentBrandsIcon,children:n(Je,{justifyItems:"center",justifyContent:"center",alignItems:"center",alignContent:"center",children:n(V,{size:"extraSmall",tone:"accent",children:_})})})]})})}const ko=6;function wo({animate:e,announceNetworkSelector:t,announceOverflowBrands:a,size:s,maxVisibleBrands:r,overflowIndicatorRef:i}){const{activePaymentBrand:o,binLength:l,paymentMethod:c,selectableBrands:d,selectedSavedCreditCardBrand:u,setSelectedNetwork:p}=ft(),m=!!c?.supportsNetworkSelection;return c?n(To,{animate:e,announceNetworkSelector:t,announceOverflowBrands:a,size:s,maxVisibleBrands:r,overflowIndicatorRef:i,activeBrand:o,availableBrands:c.paymentBrands,networkSelectionEnabled:m,onSelectBrand:p,savedCardBrand:u,selectableBrands:d,viewTransitionKey:c.paymentMethodIdentifier,binLength:l}):null}function To({animate:e=!0,availableBrands:t,selectableBrands:a=[],activeBrand:s,savedCardBrand:r,onSelectBrand:i,viewTransitionKey:o,networkSelectionEnabled:l=!1,binLength:c,announceNetworkSelector:d=!1,announceOverflowBrands:u=!1,size:p,maxVisibleBrands:m,overflowIndicatorRef:_}){const{i18n:h}=S(),v=Hr(),g=c>=ko||!!r,y=_e([]),f=e&&!v,b=k(M=>{f?kn(()=>y.value=M,["payment-icons"]):y.value=M},[y,f]);F(()=>{let M=[];g&&(r?M=[r]:a.length?M=a:s&&t.includes(s)&&(M=[s])),Ea(y.value,M)||b(M)},[g,s,t,r,a,y,b]);const P=t.filter(M=>y.value.length?y.value.includes(M):!0),C=s&&(!f||y.value.includes(s))?s:void 0,A=l&&y.value.length>1,I=y.value.length>0&&P[0]?[P[0]]:P;let L=I;A?L=[]:l&&(L=P);const x=u?Bt(h,L,void 0,m):"",D=x?`${h.translate("tooltip.additional_payment_methods")}: ${x}`:"",T=d&&A?h.translate("payment.network_card_payment_options"):D;return n(W,{children:[(d||u)&&n(le,{accessibilityRole:"status",accessibilityVisibility:"exclusive",children:T}),l?n(W,{children:A?n(Eo,{selectableBrands:a,activeBrand:s,onSelectBrand:i,viewTransitionKey:o,size:p}):n(dn,{activePaymentBrand:C,viewTransitionKey:o,paymentBrands:P,size:p,maxVisibleBrands:m,overflowIndicatorRef:_})}):n(dn,{activePaymentBrand:C,viewTransitionKey:o,paymentBrands:I,size:p,maxVisibleBrands:m,overflowIndicatorRef:_})]})}const is=1,ia=14;function No(e){const t=_e(Math.min(e,is)),a=z(null),s=z(null),r=z(null),i=z(null),o=z(null),l=z(null),c=z(null),d=k(()=>{const m=a.current,_=s.current,h=r.current,v=i.current;m===null||_===null||h===null||v===null||(t.value=Do(m,e,_,h,v))},[t,e]),u=k(m=>{const _=o.current;_&&c.current?.unobserve(_),o.current=m;const h=m?.parentElement;if(h){const v=getComputedStyle(h),g=parseFloat(v.fontSize)||ia;
2s.current=parseFloat(v.columnGap)||0,r.current=Lt.base.inlineSize/ia*g,i.current=m.getBoundingClientRect().width,c.current?.observe(m)}d()},[d]);return{ref:k(m=>{if(c.current?.disconnect(),c.current=null,l.current=m,!m)return;if(typeof ResizeObserver>"u"){t.value=e;return}const _=new ResizeObserver(h=>{for(const v of h){const g=v.target===o.current?v.target.getBoundingClientRect().width:v.contentBoxSize?.[0]?.inlineSize??v.contentRect.width;g<=0||(v.target===o.current?i.current=g:v.target===l.current&&(a.current=g))}d()});_.observe(m),o.current&&_.observe(o.current),c.current=_},[t,e,d]),overflowIndicatorRef:u,maxVisibleBrands:t}}function Do(e,t,a,s,r){return t*s+(t-1)*a<=e?t:Math.max(is,Math.floor((e-r)/(s+a)))}const Bo=()=>{const e=Ft(),t=tr(),a=nr("STORE_CREDIT"),s=ar(),r=Nt("deliveryNext"),i=z(null),o=ue(()=>({giftCard:t.value,storeCredit:a.value,redeemables:s.value,freeOrder:!e.value}));return qs(()=>{r.value||(i.current=o.value)}),ue(()=>{const l=o.value;return r.value?i.current??l:l})};function Fo(e,t){return e.current.value==="shopPay"?t:null}const xo=e=>({address:e,valid:!0,lastUsedAt:new Date().toISOString(),requiresVerification:!0,userPreferred:!1,id:"",uuid:""});function Ro({addressErrors:e,billingAddressOption:t,billingAddressValue:a}){const{shopPay:s,checkout:r}=S(),{configuration:i}=r,o=Qi(),l=i.addressSettings.billingAddressSettings.value,c=Ra(a?.countryCode,void 0,l),d=r.addressManager.billing.value,u=r.addressManager.shipping.value,p=s.session.selectedShippingAddress.value,m=gn().value,_=Ur();return ts("billingAddress",async()=>{if(t.value==="shipping"&&p?.id===d.selectedAddress.value?.id&&!m)return{success:!0};if(t.value!=="shipping"&&p?.id!==d.selectedAddress.value?.id)return{success:!0};if(s.user.flow.peek()!=="authenticated_user")return no({addressType:"billing",validate:()=>c(a,"billing"),setErrors:y=>{Ks(()=>{for(const[f,b]of y)e[f].value=b})}});!m&&t.value==="custom"&&s.session.unstable_updateSelectedBillingAddress(xo(a));const g=!m&&(!r.isShippingRequired.value||_.value)?await d.createAddress({address:a,addressErrorsOverride:e}):null;return!p?.id&&m&&await u.createAddress({address:a,addressErrorsOverride:e}),g===void 0?{success:!1,location:"intercept_billing_address_add_new",errors:Object.values(e).some(f=>f.value!==void 0)?[]:[o({offerGuestCheckout:!0})]}:{success:!0}}),null}const os=js({});function Oo({settings:e,children:t,additionalFieldGroups:a,addressSettings:s}){const{checkout:r,shopPay:i}=S(),{configuration:o}=r,c=Xs(os)?.addressErrors??r.validation.billingAddressErrors;ji(c);const{billingAddress:d,billingAddressOption:u,paymentLines:p}=se(),m=sr(),_=$r(),h=p.value[0]?.method?.type==="wallet",v=Oa(),g=i.session.isInstallmentsSelected.value,y=v!==null&&g&&r.installments.supportedCountryOptions.value.length>0?r.installments.supportedCountryOptions.value:m,f=Gr(r),b=d.value,{updateCountryCodeForSPIBillingAddress:P}=Xi(d.fields.countryCode,y),C=v!==null;F(()=>{C&&g&&P()},[C,g,P]);const A=o.defaultPhoneNumber.value;return A&&f.isRequired("phone",{useMerchantSettings:!0})&&!b.phone&&(d.value={...b,phone:A}),n(_n,{onSubmit:()=>{if(!_)return;document.getElementById(_.id)?.dispatchEvent(new Event("submit"))},children:[n(Ji,{id:"billingAddressForm",addressType:"billing",addressErrors:c,address:d,countries:y,settings:e,additionalFieldGroups:a,addressSettings:s??f,shouldSkipAddressValidation:h,children:t}),Vo({identity:r.identity})&&n(Ro,{addressErrors:c,billingAddressOption:u,billingAddressValue:b})]})}function Vo({identity:e}){return e.current.value==="shopPay"}function ls(){const{i18n:e}=S(),t=Wr(),{billingAddressOption:a,billingAddress:s,shippingAddress:r}=se(),i=r.value,o=Yr(),{billing:l}=Ne();Va(),F(()=>()=>{l.value=!1},[l]);const c=k(({billing:p})=>{p.value=!0},[]),d=k(({billing:p})=>{p.value=!1},[]);return n(le,{children:[n(be,{when:()=>t.value==="selector",children:n(ht,{id:"billingAddressCheckbox",name:"billingAddress",checked:a.value==="shipping",onChange:p=>{p?(a.value="shipping",o()):(a.value="custom",u())},label:e.translate("payment.same_billing_address_checkbox_label")})}
2),n(Rt,{id:"billingAddressDetails",open:a.value!=="shipping",children:[n(Ee,{blockSize:"large-300"}),n(qr,{accessibilityRole:"group",accessibilityLabelledBy:"billingAddress",children:[n(Ot,{id:"billingAddress",level:2,children:e.translate("payment.billing_address_title")}),n(Ee,{blockSize:"base"}),n(Ni,{onValid:c,onInvalid:d,children:n(Oo,{})})]})]})]});function u(){const p=Ma({zoneCode:void 0,countryCode:i.countryCode});s.value=p}}function ds(){const{shopPay:e,checkout:t}=S(),a=e.user.addresses,s=t.installments.config,r=e.session.isInstallmentsSelected;return ue(()=>{const i=a.value,o=s.value,l=o!==void 0&&r.value,c=l&&o?i.filter(p=>!rn(p.address,o)):i,d=l&&o?i.filter(p=>rn(p.address,o)):[],u=[...c.map(p=>na({address:p})),...d.map(p=>na({address:p,isDisabled:()=>!0}))];return{validAddresses:c,disabledAddresses:d,addresses:u}})}function zo({selectedAddress:e,setSelectedAddress:t}){const{checkout:a}=S(),s=ds(),r=a.installments.config.value??null;return{setFirstSpiSupportedAddress:k(()=>{const{validAddresses:o}=s.value,[l]=o;if(!e||!r||!l)return;rn(e,r)&&t(l.id)},[s,r,e,t])}}function Ho({addressType:e,addressCount:t,onPress:a}){const s=e==="shipping",{i18n:r}=S(),i=t>=Kn;return n(Ze,{variant:"plain",inlineSize:"fill",inlineAlignment:"start",onClick:a,disabled:i,children:n(N,{direction:"inline",gap:"small-100",alignItems:"center",children:[n(ve,{type:"plus",size:"base"}),n(N,{alignItems:"start",gap:"small-400",children:[n(de,{textAlign:"start",color:i?"subdued":void 0,children:s?r.translate("shipping.add_address"):r.translate("billing.add_address")}),i&&n(de,{textAlign:"start",type:"small",children:n(V,{type:"strong",children:r.translate("address_management.address_form.max_address",{max_addresses:Kn})})})]})]})})}function Uo({id:e,label:t,addressType:a,onAddAction:s}){const{i18n:r,userEvents:i,source:o,checkout:l,shop:c,shopPay:d}=S(),u=d.user.addresses.value,{selectAddress:p}=Bn(a),m=l.addressManager[a].value.selectedAddress,_=z(m.peek()),[h,v]=X(!m.peek()),y=Oa()!==null&&d.session.isInstallmentsSelected.value,f=ds(),{addresses:b,validAddresses:P}=f.value,{setFirstSpiSupportedAddress:C}=zo({selectedAddress:m.value?.address,setSelectedAddress:p});F(()=>{!y||a!=="billing"||C()},[y,a,C,P]),F(()=>{const M=m.value,B=a==="billing"&&_.current&&!M;M||v(!0),_.current=M,B&&Kr({content:r.translate("general.choose_billing_address"),role:"status"})},[a,r,m.value]);const A=k(()=>{const M=a==="shipping"?"shipping_addresses":"billing_addresses";i.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...yn(o,l,c),action:h?`${M}_collapse`:`${M}_expand`}}),v(B=>!B)},[i,o,l,c,a,h]),{nameLine:I,primary:L,secondary:x}=za({address:m.value?.address??{},nameLinePosition:"block"}),D=m.value?I:void 0,T=m.value?n(N,{children:[L&&n(V,{children:L}),x&&n(V,{children:x})]}):n(de,{children:r.translate("address_management.address_form.add_address")});return n($t,{theme:{rollup:{inlinePadding:"none"}},children:n(gt,{open:h,id:e,label:t,onToggle:A,primaryContent:D,secondaryContent:T,children:n(N,{gap:"small-200",children:[n(ao,{id:"billing_address_credit_card",addresses:b,addressType:"billing",onChange:M=>p(M,{source:"shop-pay-address-review-item"}),selectedId:m.value?.id}),n(le,{padding:"none small-100",children:n(Ho,{addressType:a,addressCount:u.length,onPress:s})})]})})})}function $o({billingAddressInContext:e}){const{i18n:t,checkout:a}=S(),[s,r]=X(!1),i=Bi(),o=a.configuration.addressSettings.billingAddressSettings.value,l=j(()=>({addressErrors:a.validation.billingAddressErrors,addressSettings:o}),[o,a.validation.billingAddressErrors]),c=l.addressErrors,{createAddress:d}=Bn("billing"),u=k(p=>d({address:p,addressErrorsOverride:c}),[c,d]);return n(W,{children:[e?n(os.Provider,{value:l,children:n(ls,{})}):n(le,{border:"base",borderRadius:"base",padding:"none base",children:n(Uo,{id:"payment_selector_billing_address",addressType:"billing",label:t.translate("payment_ux.bill_to"),onAddAction:()=>r(!0)})}),n(Nn,{open:s,heading:t.translate("address_management.address_form.add"),onHide:()=>r(!1),children:n(Dn,{addressType:"billing",addressErrorsSignal:c,editableAddress:i,onCancel:()=>r(!1),onSuccess:()=>r(!1),onSave:u,cancelText:t.translate("credit_card_form.go_back"),saveText:t.translate("edit_credit_card_modal.save_billing_address")})})]})}function Go({identity:e,paymentLines:t,shop:a,isBareCardOnly:s}){return e.current.value!=="shopPay"||s?"inlineDirectMethod":!a.hasFlagEnabled(rr)&&ir(t,"APPLE_PAY")?"none":"footer"}function Wo({identity:e,billingAddressInContext:t,billingAddressVariant:a,customerAccountBillingAddressSection:s,businessCustomerBillingAddressSection:r}){return e.current.value==="shopPay"&&a==="footer"?n($o,{billingAddressInContext:t}):a!=="inlineDirectMethod"?null:e.current.value==="customerAccount"?s??null:e.current.value==="businessCustomer"?r??null:null}function cs({experienceType:e}){const{managedByMarketsPro:t}=pe(),{value:a}=pn({deferClientOnlyWalletsUntilHydrated:!0}),s=e==="bareCreditCardOnly",{paymentLines:r,billingAddress:i,shippingAddress:o,billingAddressOption:l}=se(),{shop:c,shopPay:d,checkout:u}=S(),p=or({managedByMarketsPro:t.value}),m=ss(),_=u.installments.isSupported.value,v=!gn().value&&l.value==="shipping"&&u.isShippingRequired.value?o.value:i.value,g=Go({identity:u.identity,paymentLines:r.value,shop:c,isBareCardOnly:s}),y=lr(d.app.config),f=d.session.isInstallmentsSelected.value;return{displayedPaymentMethods:j(()=>_o(a??[],{identity:u.identity,installmentsSelected:_&&f,isApplePayAvailable:m.value,idealEnabled:p,isBareCardOnly:s,isShopAppLayout:y,shopAppVersion:d.app.config.version}),[a,u.identity,_,f,d.app.config.version,m.value,p,s,y]),renderAsBareCard:s,billingAddressVariant:g,selectedBillingAddress:v,isApplePayAvailable:m.value}}function Yo({shop:e,source:t,checkout:a},s){return a.configuration.layout.isOnePage.value?!1:dr({identitySource:a.identity.current.value,isOrderSession:ur(t),storeVaultEnabled:e.storeVaultEnabled,customerProfile:s.buyerIdentity.value?.customerProfile,hasCustomerStoredPaymentMethod:cr({availablePaymentMethods:s.paymentMethods.value??[],paymentMethodHistory:s.paymentMethodHistory?.value??[]})})}function qo(e){return e===2||e===3||e===4}const Ko={2:28,3:17,4:11},jo={2:18,3:13,4:18};function Xo(e,t){const a=Ko[e],s=jo[e];return t==="compact-narrow"||t==="compact"?s:t==="wide"?a:Math.min(a,s)}function Jo(e){const t=us(e);
2return{...t,eligibility:Zo(e,t)}}function Zo(e,t){const{renderFeatures:a}=e,s=a.tiles&&a.singleCreditCard?t:us({...e,renderFeatures:{...a,tiles:!0,singleCreditCard:!0}});return{tileEligible:s.mode==="tiles",fallbackReason:s.fallbackReason,tileIneligibility:s.metadata.tileIneligibility}}function us({renderFeatures:e,displayedPaymentMethods:t,tileContainerSize:a,getTileMetadata:s}){const r=t.length,{choiceListPresentation:i}=e,o={displayedPaymentMethodCount:r,tileEligibilityChecked:!1,tileIneligibility:[]};if(r===0)return{mode:"choiceList",choiceListPresentation:i,fallbackReason:"no_displayed_payment_methods",metadata:o};if(e.knownBuyerSharedSelector)return{mode:"knownBuyerShared",choiceListPresentation:i,metadata:o};const[l]=t;if(r===1&&l!==void 0&&e.singleCreditCard&&Ia(l))return Qo(l)?{mode:"choiceList",choiceListPresentation:i,fallbackReason:"custom_payment_method_label",metadata:o}:{mode:"singlePaymentMethodCreditCard",choiceListPresentation:i,metadata:o};if(e.tiles&&qo(r)){if(r===3&&(a===void 0||a==="compact-narrow"))return{mode:"choiceList",choiceListPresentation:i,fallbackReason:a===void 0?"tile_container_unmeasured":"tile_container_too_narrow",metadata:o};const c=el(t,r,a,s),d={displayedPaymentMethodCount:r,tileEligibilityChecked:!0,tileIneligibility:c};return c.length===0?{mode:"tiles",choiceListPresentation:i,metadata:d}:{mode:"choiceList",choiceListPresentation:i,fallbackReason:"tile_ineligible_methods",metadata:d}}return{mode:"choiceList",choiceListPresentation:i,metadata:o}}function Qo(e){return!!e.displayName?.trim()}function el(e,t,a,s){const r=Xo(t,a);return e.flatMap(i=>{const o=ae(i),l=mr(i),c=s(i);if(!c)return[{key:o,methodName:l,reasons:["missing_tile_metadata"]}];const d=tl(c,r);return d.length>0?[{key:o,methodName:l,reasons:d}]:[]})}function tl(e,t){const a=[];return e.label.trim().length===0&&a.push("missing_label"),e.hasSubtitle&&a.push("subtitle_present"),e.label.length>t&&a.push("label_may_wrap"),e.iconCount<1&&a.push("missing_icon"),e.iconCount>1&&a.push("multiple_icons"),e.hasIncentiveBadge&&a.push("incentive_badge_present"),a}const nl=3;function ms(e,{i18n:t,identitySource:a,isOnePageCheckout:s,isVenmoCheckout:r=!1,forceDebitCardLabel:i=!1,tileSupportedCustomOnsitePaymentMethods:o}){switch(e.type){case"direct":return{label:La({identitySource:a,i18n:t},e,{forceDebitCardLabel:i}),iconBrand:"generic",iconCount:1,hasSubtitle:!1,hasIncentiveBadge:!1};case"wallet":return sl(e,t,r);case Me.PayPal:return ps(t,r);case"walletsPlatform":return rl(e,t,s);case"local":return ol(e.displayName??"",e.name);case"offsite":return ys(e.name,e.paymentBrands);case"customOnsite":return jr(e)||!o.has(e.paymentMethodIdentifier)?void 0:ll(e.name,e.paymentBrands);case"bank":return il(e);case"paymentOnDelivery":case"manualPayment":case"customManualPayment":return oa(e.name);case"deferred":return oa(e.displayName??t.translate("payment_gateway.deferred_payment_label"));default:return}}function al(e,t){const a=ms(e,t);if(a)return{label:a.label,hasSubtitle:a.hasSubtitle,iconCount:a.iconCount,hasIncentiveBadge:a.hasIncentiveBadge}}function sl(e,t,a){switch(e.name){case"PAYPAL_EXPRESS":return ps(t,a);case"APPLE_PAY":return mt(t.translate("brand.apple_pay"),"apple_pay");case"SHOP_PAY":case"SHOPIFY_INSTALLMENTS":return{...mt(t.translate("payment_gateway.shop_pay.name"),"shop_pay"),hasSubtitle:e.name==="SHOPIFY_INSTALLMENTS"};case"GOOGLE_PAY":case"VENMO":return;default:return}}function rl(e,t,a){if(e.name===dt.AmazonPay)return a?void 0:mt(t.translate("brand.amazon_pay"),"amazon_pay")}function il(e){const t=e.availableInstruments[0]?.bankName;return t?{label:e.displayName??"",iconBrand:fo(t),iconCount:1,hasSubtitle:!1,hasIncentiveBadge:!1}:{label:e.displayName??"",iconBrand:null,iconCount:nl,hasSubtitle:!1,hasIncentiveBadge:!1}}function ps(e,t){return t?mt(e.translate("brand.venmo"),"venmo"):mt(e.translate("brand.paypal"),"paypal")}function mt(e,t){return{label:e,iconBrand:t,iconCount:1,hasSubtitle:!1,hasIncentiveBadge:!1}}function ol(e,t){const a=Dt(t);return{label:e,iconBrand:a?t:null,iconCount:a?1:0,hasSubtitle:!1,hasIncentiveBadge:!1}}function ys(e,t){const a=(t??[]).filter(Dt);return{label:e,iconBrand:a[0]??null,iconCount:a.length,hasSubtitle:!1,hasIncentiveBadge:!1}}function ll(e,t){const a=ys(e,t);if(!a.iconBrand)return a;const s=a.iconBrand.replace(/[-_]/g," "),r=a.iconBrand.toUpperCase(),i=lt(r);return{...a,accessibilityLabel:`${e}, ${i===r?s:i}`}}function oa(e){return{label:e,iconBrand:null,iconCount:0,hasSubtitle:!1,hasIncentiveBadge:!1}}function dl({identity:e}){return e.current.value}const fs=new Set;function hs(e,t=fs){const{showPaymentTiles:a,showSingleCreditCard:s}=vn(),r=Xr(),i=S(),{i18n:o,checkout:l}=i,c=pe(),d=Yo(i,c),u=Ha(),p=Ua(u),m=dl({identity:l.identity});return k((_,h,v)=>Jo({renderFeatures:{tiles:a,singleCreditCard:s,choiceListPresentation:r,knownBuyerSharedSelector:d},displayedPaymentMethods:e,tileContainerSize:_,getTileMetadata:g=>al(g,{i18n:o,identitySource:m,isOnePageCheckout:h,isVenmoCheckout:p,forceDebitC
2ardLabel:v,tileSupportedCustomOnsitePaymentMethods:t})}),[e,a,s,r,d,o,m,p,t])}function vm(e,t,a=fs){const s=hs(e,a),{checkout:r}=S(),i=r.configuration.layout.isOnePage,o=r.installments.paymentMethodMustSupportDebitCardOnly.value;return j(()=>s(t,i.value,o),[s,t,i.value,o])}const cl="#",ul=50;function bm({showHeading:e=!0}){const{i18n:t,checkout:{validation:a}}=S(),{purchaseOrderNumber:s}=se(),{poNumberError:r}=a,i=t.translate("payment.purchase_order_number.title");return n(ki,{condition:e,accessibilityLabel:t.translate("payment.purchase_order_number.title"),padding:"none",children:n(N,{gap:"small-200",children:[e&&n(Ot,{children:i}),n(Ge,{name:"poNumber",label:t.translate("payment.purchase_order_number.label"),value:s.value,onChange:o=>{s.value=o.trim()},prefix:cl,autocomplete:"off",maxLength:ul,error:r.value})]})})}function gs({forceVaultingEligible:e=!1,blockNegotiations:t=!1,borderless:a=!1}={}){const s=pe(),r=ka(),i=$a(),o=_e(void 0),{acceptPaymentVaulting:l,paymentLines:c}=se(),{i18n:d,shop:u}=S(),p=Ga(),m=ue(()=>p.value||e);function _(g){m.value&&(l.value=g),o.value=""}et(({reason:g})=>(t&&g==="negotiation"||g!=="negotiation")&&m.value&&(s.paymentFlexibilityPaymentTermsTemplate.value&&!i.value||r.value)&&!l.value?{behavior:"block",reason:Te.BlankVaultingAgreement,perform(){o.value=d.translate("field_errors.vaulting_agreement_blank")}}:g!=="completion"?{behavior:"allow"}:m.value?{behavior:"allow"}:{behavior:"allow",perform(){o.value=""}});const h=ue(()=>c.value.some(g=>g.method.type==="bank")?d.translate("payment.business_customer_with_bank_account_vaulting_payment_label",{company:u.name}):s.buyerIdentity.value?.purchasingCompany?d.translate("payment.business_customer_vaulting_payment_label",{company:u.name}):d.translate("payment.vaulting_agreement_label",{company:u.name})),v=ue(()=>m.value?l.value:void 0);return n(W,{children:n(N,{gap:"base",border:a?void 0:"base",borderRadius:a?void 0:"base",padding:a?void 0:"small-100",children:[n(be,{when:o,children:n(xe,{tone:"critical",errorType:Oe.PaymentError,children:o})}),n(ht,{name:"vaulting_and_subscription_agreement",checked:v.value,onChange:g=>{_(g)},error:o.value?" ":void 0,label:h.value})]})})}function ml(e){switch(e){case"singlePaymentMethodCreditCard":return"bare_card";case"tiles":return"tiles";case"choiceList":return"list";case"knownBuyerShared":return"known_buyer_shared";default:return pt(e)}}function pl(e){switch(e){case void 0:return"none";case"tile_ineligible_methods":return"ineligible_methods";case"tile_container_unmeasured":return"container_unmeasured";case"tile_container_too_narrow":return"container_too_narrow";case"no_displayed_payment_methods":return"no_methods";case"custom_payment_method_label":return"custom_label";default:return pt(e)}}function yl(e){const t=new Set,a=[];for(const{methodName:s,reasons:r}of e)for(const i of r)t.add(i),a.push(`tile_ineligible:${i}:${s}`);return[...Array.from(t,s=>`tile_ineligible_reason:${s}`),...a]}function la(e,t){return[...e,`selector_mode:${ml(t.mode)}`,`fallback_reason:${pl(t.eligibility.fallbackReason)}`,`tile_eligible:${t.eligibility.tileEligible}`,`method_count:${t.metadata.displayedPaymentMethodCount}`,...yl(t.eligibility.tileIneligibility)]}const fl="/cdn/shopifycloud/checkout-web/assets/c1/assets/payment.BidoBI-H.svg";function hl({error:e}){const{i18n:t}=S(),a=j(()=>{switch(e){case"configuration":return t.translate("payment.not_configured_error");case"technical":return t.translate("payment.technical_error");case"no_methods":return t.translate("payment.no_method_error");case"script":return t.translate("payment.no_working_method_error")}},[e,t]);return n(le,{background:"subdued",borderRadius:"base",padding:"large-100",accessibilityRole:e==="script"?"alert":void 0,children:n(N,{gap:"small-200",alignItems:"center",children:[n(co,{children:n("img",{src:fl,alt:""})}),n(de,{color:"subdued",textAlign:"center",children:a})]})})}const _s=pr("PaymentMethodsContext");function gl(){return yr(_s)}function _l({children:e,billingAddressInContext:t,errorBannerInContext:a,isInModal:s,selectedPaymentMethod:r,billingAddressVariant:i,cardNickname:o,onCardNicknameChange:l}){const c=j(()=>({billingAddressInContext:t,errorBannerInContext:a,isInModal:s,selectedPaymentMethod:r,billingAddressVariant:i??"inlineDirectMethod",cardNickname:o,onCardNicknameChange:l}),[t,a,s,r,i,o,l]);return n(_s.Provider,{value:c,children:e})}function On(){const{shop:e}=S(),{paymentMethods:t}=pe(),{paymentLines:a}=se(),s=ue(()=>Fi(t.value)),r=ue(()=>xi({paymentLines:a.value,storeVaultGuestCvvVerificationEnabled:e.storeVaultGuestCvvVerificationEnabled}));return ue(()=>Ri({hasBogusGateway:s.value,hasAmexCvvOnlyField:r.value}))}function Vn({handle:e}){const{validate:t,sdk:a,errors:s,loading:r}=ge(),{vaultCardWithSelectedNetwork:i,setSelectedNetwork:o,detectedNetworks:l,selectedNetwork:c}=ft(),d=k(u=>a.setErrors(u),[a]);return F(()=>(e.value={validate:t,vaultCardWithSelectedNetwork:i,setSelectedNetwork:o,setFieldErrors:d,hasSDKError:!!s.sdk,isSDKLoading:r,detectedNetworks:l,selectedNetwork:c},()=>{e.value=null}),[e,t,i,o,d,s.sdk,r,l,c]),null}const vl=new Set(["name","number","verification_value","expiry","expiry_month","expiry_year","issue_date","issue_number"]);function bl(e){return vl.has(e)}const Cl=["number","expiry","verification_value","name"];async function Sl(e,t){const a=await t(e.length);return new Map(e.map((s,r)=>{const i=a[r];if(i===void 0)throw new TypeError(`Missing payment session for shop ${s} at index ${r}`);return[s,i]}))}function Pl(e,t){const{observability:a,shop:s,webMcp:r,checkout:{wallets:i}}=S(),{id:o}=s,l=wa(s),c=Ft(),d=Rn(),{validate:u,cardBrand:p}=ge(),{vaultCardWithSelectedNetwork:m,vaultCardMultipleTimesWithSelectedNetwork:_}=ft(),h=rs(),v=fr(),g=se();et(({parts:y,reason:f})=>{const b=g.remotePaymentDetails.value,P=y.paymentLines.peek(),C=P[0],A=i.activeSession.value;if(f!=="progression"&&f!=="completion"||!c.value||!e||A)return f==="completion"&&A&&P.length===1&&C?.method.type==="direct"&&(a.leaveErrorBreadcrumb("[useDirectPaymentMethodCustomizations] activeSession is set and the first payment line is direct",{activeSession:A}),a.error(new hr("activeSession is set and the first payment line is direct. This will block checkout",{metadata:{conflictType:"DirectPaymentConflict",wallet:{active:A}}}))),{behavior:"allow"};if(C===void 0)return h(f),{behavior:"block",reason:Te.EmptyPaymentLines,perform:()=>{}};if(C.method.type!=="direct")return{behavior:"allow"};const{acceptedSubscriptionTerms:I,paymentMethodIdentifier:L,paymentAttributes:x,alternative:D}=C.method,T=r?.getSubmittingAgenticToken();return d.value&&!T?{behavior:"allow",perform:()=>{}}:T||u(!1,t).isValid?{behavior:"allow",async perform({behavior:w}){if(w!=="allow")return;let O;if(T)O=T;else if(!b||b.size===0)O=await m();else{const R=[...v.value.length>0?[o]:[],...b.keys()],H=await Sl(R,_);O=H.get(o)??null;const G=new Map(b);for(const[U,te]of G)G.set(U,{...te,sessionId:H.get(U)});g.remotePaymentDetails.value=G}if(O){const H=y.paymentLines.peek().find(U=>U.method.type==="direct")?.method?.creditCardInstallments,G={method:{type:"direct",sessionId:O,acceptedSubscriptionTerms:I,paymentMethodIdentifier:L,paymentAttributes:x,alternative:D,...p&&{brand:Za(p)},...H!=null&&{creditCardInstallments:H}}};$e(y,G,l)}}}:{behavior:"block",reason:Te.CardFieldInputIsInvalid,perform:()=>{}}})}const Al={rollup:{blockPadding:"base",inlinePadding:"none"}};function El({open:e,onClose:t,heading:a,cardForm:s,sdkAvailable:r=!0,billingAddressSection:i,afterBillingAddress:o,beforeCardForm:l,error:c,onSave:d,loading:u,disabled:p,blocking:m,externalContent:_,createAddressForm:h,size:v,accessibilityLabel:g,dataTestIdForScrollableContent:y,submitText:f}){const{i18n:b,shop:P}=S(),C=m?{blocking:!0,onHide:void 0}:{blocking:!1,onHide:t},A=h?.open??!1,I=n(bn,{submitText:f??b.translate("payment.card_form.save"),cancelText:b.translate("payment.card_form.cancel"),loading:r?u:!1,disabled:!r||p||u,handleSubmit:d,handleCancel:t}),L=n(_n,{onSubmit:d,children:n(N,{gap:"base",children:[c&&n(le,{padding:"none none base none",children:n(xe,{tone:"critical",errorType:Oe.PaymentError,children:c})}),l,s,r&&i,o]})}),x=P.hasFlagEnabled(Ta)?n($t,{theme:Al,children:L}):L;return n(W,{children:[_,n(Nn,{dataTestIdForScrollableContent:y,open:e,accessibilityLabel:g,heading:a,size:v,primaryAction:A?void 0:I,...C,children:[n(le,{display:A?"none":"block",children:x}),A&&h?.content]}
2)]})}function vs({hideAddressModal:e}){const{checkout:t}=S(),a=t.addressManager.billing.value,s=Bn("billing"),{isMissingPhone:r}=io({addressType:"billing"}),{isMissingFirstName:i}=oo({addressType:"billing"}),o=r||i,l=k(c=>s.selectAddress(c.id),[s]);return n(ns,{addressType:"billing",addresses:a.addresses.value,immutableAddresses:a.immutableAddresses.value,immutableAddressSections:a.immutableAddressSections.value,addressesTitle:a.addressesTitle,selectedAddress:a.selectedAddress.value,onSelectAddress:l,onCreateAddress:s.createAddress,onUpdateAddress:s.updateAddress,onDeleteAddress:s.deleteAddress,getAddressDisplayName:a.getAddressDisplayName,addressErrorsSignal:a.errors.fields,canCreateAddress:a.canCreateAddress.value,canUpdateAddress:a.canUpdateAddress.value,canDeleteAddress:a.canDeleteAddress.value,canSetDefaultAddress:a.canSetDefaultAddress.value,onSetDefault:a.setDefaultAddress,errorBannerMessage:a.errors.banner,hideAddressModal:e,selectedAddressDetails:o?n(so,{addressType:"billing"}):void 0})}function Ml({hideAddressModal:e}){const{checkout:t}=S(),{isLoading:a,isValid:s}=t.addressManager.billing.value.suggestedAddress.value;return!s&&!a?n(It,{}):n(vs,{hideAddressModal:e})}function bs({hideAddressModal:e=!1}={}){const{checkout:t}=S();return Il(t.identity.current.value)?t.addressManager.billing.value.isMissingValidSuggestedAddress.value?n(It,{}):t.identity.current.value==="shopPay"?n(vs,{hideAddressModal:e}):n(Ml,{hideAddressModal:e}):n(It,{})}function Il(e){return e==="shopPay"||e==="businessCustomer"}async function Ll({validateCardFields:e,vaultCard:t,paymentMethodIdentifier:a,getDue:s,parts:r,newCard:i,buyerHasActedSignal:o,negotiate:l,setLoading:c,beforeSubmit:d,openBilling:u,close:p,onAddressError:m,fixSubscriptionRedeemablePaymentAmount:_=!1}){o.value=!0,c(!0),await d?.();const{isValid:h}=e();if(!h){c(!1);return}let v;try{v=await t()}catch{c(!1);return}const g=r.paymentLines.value;if(v){const b={type:"direct",sessionId:v,paymentMethodIdentifier:a},P=g.filter(A=>A.method.type==="giftCard"||_&&A.method.type==="redeemable"),C=s();r.paymentLines.value=[{method:b},...C?[{method:b,due:C}]:[],...P]}function y(b){if(b.status!=="success"&&b.status!=="error")return;if(b.violations.some(C=>jn.has(C.code)))return"address";if(b.errors.length!==0){for(const C of b.errors){if(jn.has(C.code))return"address";if(gr.has(C.code))return"card"}return"other"}}const f=()=>{r.paymentLines.value=g};l({fieldsToResolve:["paymentMethods"],onComplete(b){switch(c(!1),b.status){case"success":case"error":{const P=y(b);if(P==="address"){f(),u(),m(b.violations);return}if(P==="card"){f();return}if(P==="other"){p();return}if(b.status==="success"){const C=kl(b);C&&(i.value=C.method),p()}break}case"invalid":{if(b.reasons.includes(Te.BlankVaultingAgreement)){f();return}p();break}default:p();break}}})}function kl(e){return e.negotiated.paymentLines?.lines?.find(t=>t.method.type==="direct")}function wl({open:e,onToggle:t}){const{i18n:a,checkout:s}=S(),{billingAddress:r}=se(),i=Cn(r.value),o=s.addressManager.billing.value.isMissingValidSuggestedAddress.value;return n(gt,{id:"billingAddress",label:a.translate("payment.billing_address_title"),open:e||o,onToggle:o?void 0:t,primaryContent:o?void 0:i,children:n(N,{gap:"base",children:[n(Jr,{section:"payment"}),n(bs,{hideAddressModal:!0})]})})}const Tl="H5k1u",Nl={CreateAddressButton:Tl},Dl={rollup:{inlinePadding:"none"}};function Bl({addresses:e,selectedAddress:t,onSelectAddress:a,onAddAddress:s,canCreateAddress:r,canUpdateAddress:i,onUpdateAddress:o,open:l,onToggle:c,id:d,label:u,summary:p,errorAddress:m,onEditErrorAddress:_}){const{i18n:h}=S(),{nameLine:v,primary:g,secondary:y}=za({address:t?.address??{},nameLinePosition:"block"}),f=t?v:void 0,b=t?n(N,{children:[g&&n(V,{children:g}),y&&n(V,{children:y})]}):n(de,{children:h.translate("billing.address_form.add_address")}),P=m?.value,C=l||!!P;return n($t,{theme:Dl,children:n(gt,{id:d??"billingAddress",label:u??h.translate("payment.billing_address_title"),open:C,onToggle:()=>c(C),primaryContent:p??f,secondaryContent:p?void 0:b,children:[P&&_&&n(le,{padding:"none none base none",children:n(Fl,{onEdit:_})}),n(ns,{addressType:"billing",noticesSection:"payment",addresses:e,selectedAddress:t,onSelectAddress:a,canU
2pdateAddress:i,onUpdateAddress:o,showNotices:!1,hideAddressModal:!0}),r&&n(We,{className:Nl.CreateAddressButton,inlineSize:"100%",padding:"base",onClick:s,children:n(N,{direction:"inline",gap:"small-100",alignItems:"center",children:[n(ve,{type:"plus",size:"base"}),n(V,{children:h.translate("billing.add_address")})]})})]})})}function Fl({onEdit:e}){const{i18n:t}=S();return n(xe,{errorType:Oe.PaymentError,tone:"critical",children:n(V,{children:t.translate("address_management.invalid_billing_address_selected_with_update_link",{update_address_link:n(Re,{tone:"monochrome",onClick:e,children:t.translate("address_management.billing_address_update")})})})})}function xl({open:e,onToggle:t,onAddAddress:a,errorAddress:s,onEditErrorAddress:r}){const{checkout:i}=S(),o=i.addressManager.billing,l=o.value,c=k(d=>{s.value=void 0,o.value.selectAddress(d.id)},[o,s]);return n(Bl,{addresses:l.addresses.value,selectedAddress:l.selectedAddress.value,onSelectAddress:c,onAddAddress:a,canCreateAddress:l.canCreateAddress.value,canUpdateAddress:l.canUpdateAddress.value,onUpdateAddress:d=>l.updateAddress(d),open:e,onToggle:t,errorAddress:s,onEditErrorAddress:r})}const Rl="cRSsz",Ol="WUohw",Vl="bl714",zl="GLY0v",ot={CardFieldWrapper:Rl,isDisabled:Ol,"CardFieldWrapper-borderNone":"cssC4",isFocused:Vl,hasError:zl,"CardFieldWrapper-borderFull":"J1Wf0","CardFieldWrapper-borderBlockEnd":"_7rHVa"},Cs=Js(({hidden:e,border:t,error:a,focused:s,loading:r,children:i},o)=>{const l=Zr();return n("div",{"data-protected-input":!0,ref:o,hidden:e,className:we(ot.CardFieldWrapper,Na({focusRing:"resting",colorLayer:a?"controlInvalid":"control"}),t&&ot[Pa("CardFieldWrapper-border",t)],{[ot.hasError]:!!a,[ot.isFocused]:s&&!l,[ot.isDisabled]:l}),"aria-busy":r||void 0,"aria-disabled":l||void 0,children:i})}),Hl="NM5yz",Ul="kyKRO",$l="GcTEr",Xt={LoadingContainer:Hl,ready:Ul,LoadingSlider:$l};function Ss({ready:e}){const[t,a]=X(!0),s=()=>a(!1);return F(()=>{e||a(!0)},[e]),t?n("div",{className:we(Xt.LoadingContainer,{[Xt.ready]:e}),onTransitionEnd:s,children:n("div",{className:Xt.LoadingSlider})}):null}function Ps({placeholder:e,label:t,name:a,initialValue:s,onChange:r,themeStyles:i,themeStylesVersion:o,onBlur:l=()=>{},empty:c}){const{filled:d,focusedField:u,sdk:p,loading:m}=ge(),_=Qr(),h=ei(),v=ti(),[g,y]=X(u===a),f=typeof s=="string"&&s.trim().length>0,b=ni(),P=e??t;return F(function(){if(u===a){v("payment"),y(!0);const A=b.value.currentFocus.value;b.value.currentFocus.value="payment",A!=="payment"&&(_("sectionInteraction",{section:"payment",timestamp:new Date}),h({type:"section_interaction",section:"payment"}))}else g&&(l(),v("payment"),_("change",{element:{tagName:"INPUT",type:"text",label:a},section:"payment",timestamp:new Date}),y(!1))},[_,v,b,u,g,t,a,l,p,h]),F(function(){d[a]?(r(!1),p.setPlaceholderContent(a,""),v("payment")):r(!0)},[d,a,r,p,v]),F(function(){p.setTranslation(a,t)},[a,t,p]),F(function(){c?(p.setPlaceholderContent(a,P),p.setStyles({field:a,styles:{padding:i.padding.default}})):(p.setPlaceholderContent(a,""),p.setStyles({field:a,styles:{padding:i.padding.floating}}))},[c,P,a,i,o,p,m]),{hasInitialValue:f,isFilled:d[a]}}const Gl=26,da="--accessory-width";function Wl(e){const t=z(null),a=z(null);return F(()=>{const s=t.current,r=a.current,i=()=>{s?.style.removeProperty(da)};if(!e||!s||!r){i();return}const o=()=>{s.style.setProperty(da,`${r.offsetWidth+Gl}px`)};if(o(),typeof ResizeObserver>"u")return i;const l=new ResizeObserver(o);return l.observe(r),()=>{l.disconnect(),i()}},[e]),{wrapperRef:t,accessoryRef:a}}const Yl="DCpNs",ql="_4VRZE",Jt={CardField:Yl,"CardField-hasAccessory":"_211UF",Accessory:ql};function Kl({accessory:e,border:t,error:a,focused:s,hidden:r,label:i,loading:o,name:l,placeholder:c,onChange:d,empty:u,themeStyles:p,themeStylesVersion:m}){const{i18n:_}=S(),{sdk:h}=ge(),v=c??i,g=Wa({active:!!a}),{wrapperRef:y,accessoryRef:f}=Wl(!!e);return Ps({placeholder:c,label:i,name:l,themeStyles:p,themeStylesVersion:m,onChange:d,empty:u}),n(Cs,{ref:y,...{hidden:r,border:t,loading:o,error:a,focused:s},children:[n("div",{ref:g,className:we(Jt.CardField,{[Jt["CardField-hasAccessory"]]:!!e}),id:l,"data-card-fields":l,"data-card-field-placeholder":v,"data-card-field-prefix":_.translate("payment.card_fields_container_prefix"),tabIndex:-1,onFocus:()=>{h.setFocus(l)}}),e&&n("div",{ref:f,className:Jt.Accessory,children:e}),n(Ss,{ready:!o})]})}const jl="Uq6Ln",Xl="W16eS",Jl="lxxqW",Zl="z8T28",Ql="KAqU2",Qe={Wrapper:jl,FieldContainer:Xl,ClearButton:Jl,Flex:Zl,CardField:Ql,"CardField-hasAccessory":"_3fIVg"};function Ce(e){const{error:t,label:a,name:s,initialValue:r}=e,{control:{border:i,labelPosition:o="inside"},textField:{border:l}}=Vt(),c=l||i||"full",[d,u]=X(!r),p=k(_=>u(_),[]),m={...e,border:c,onChange:p,empty:d};return n("div",{className:we(Qe.Wrapper,Ya[o==="outside"?"labelOutside":"labelInside"],o==="inside"&&Na({colorLayer:t?"controlInvalid":"control"})),children:[o==="outside"&&n(Jn,{variant:"outside",htmlFor:s,label:a}),n("div",{className:we(Qe.FieldContainer,o==="inside"&&!d&&ai.floating),children:[o==="inside"&&n(Jn,{variant:"inside",htmlFor:s,label:a}),s==="name"?n(ed,{...m,initialValue:r}):n(Kl,{...m})]}),t&&n(si,{controlID:s,children:t})]})}function ed({name:e,label:t,placeholder:a,error:s,loading:r,focused:i,hidden:o,border:l,initialValue:c,allowClear:d,onChange:u,empty:p,themeStyles:m,themeStylesVersion:_}){const{i18n:h}=S(),{setFilled:v,filled:g,sdk:y,touched:f}=ge(),b=a??t,[P,C]=qn(()=>!0,!1),A={status:"empty"},[I,L]=qn((Y,Z)=>{switch(Z.type){case"buyerModifiedField":return!P&&f.name&&C(),{status:"modified"};case"setInitialValue":return Y.status==="modified"?Y:Z.value&&Z.value.trim().length>0?(w(),{status:"prefilled",value:Z.value}):{status:"empty"};case"prefillValueChanged":return Y.status==="modified"?Y:Z.value&&Z.value.trim().length>0?(O(Z.value),{status:"prefilled",value:Z.value}):(R(),{status:"empty"});case"clearField":return C(),R(),y.setFocus(e),{status:"modified"}}},A),x=k(()=>{L({type:"buyerModifiedField"})},[]),D=Wa({active:!!s}),T=k(Y=>{i&&!Y&&L({type:"buyerModifiedField"}),u(Y)},[u,i]),{hasInitialValue:M,isFilled:B}=Ps({placeholder:a,label:t,name:e,initialValue:c,themeStyles:m,themeStylesVersion:_,onChange:T,onBlur:x,empty:p}),w=k(()=>{v("name"),u(!1),y.setPlaceholderContent(e,""),y.setStyles({field:e,styles:{padding:m.padding.floating}})},[e,y,m,v,u]),O=k(Y=>{y.setValue("name",Y),y.setErrors({name:null}),w()},[y,w]),R=k(()=>{u(!0),y.clearField(e),y.setPlaceholderContent(e,b),y.setStyles({field:e,styles:{padding:m.padding.default}})},[u,y,b,e,m]),[H,G]=X(c);c!==H&&(L({type:"prefillValueChanged",value:c}),G(c)),I.status==="empty"&&M&&!g[e]&&L({type:"setInitialValue",value:c});const U=k(()=>{L({type:"clearField"})},[]),te={hidden:o,border:l,loading:r,error:s,focused:i},$=B&&d&&!P;return n(Cs,{...te,children:[n("div",{className:we(Qe.CardField,{[Qe["CardField-hasAccessory"]]:$}),id:e,"data-card-fields":e,"data-card-field-placeholder":b,"data-card-field-prefix":h.translate("payment.card_fields_container_prefix"),"data-card-field-name-initial-value":c,ref:D,tabIndex:-1,onFocus:()=>{y.setFocus(e)}}),$&&n(td,{onPress:U}),n(Ss,{ready:!r})]})}function td({onPress:e}){const{i18n:t}=S();return n("div",{className:Qe.ClearButton,children:n("div",{className:Qe.Flex,children:n(Re,{accessibilityLabel:t.translate("payment.clear"),onClick:e,children:n(ve,{type:"x"})})})})}
2function nd({icon:e,children:t,controlLabel:a}){return n(We,{overlay:n(hn,{children:t}),accessibilityLabel:a,children:n(ve,{type:e||"question"})})}const ad="1.35rem",ca="1.1rem",sd="2.05rem",rd="0.55rem",id={padding:{default:ct(`${ad} ${ca}`),floating:ct(`${sd} ${ca} ${rd}`)}};function od(){const{control:{labelPosition:e="inside"},textField:t}=Vt(),a=z(),s=z(id),r=z(!1),[i,o]=X(0),l=j(()=>({padding:{get default(){return s.current.padding.default},get floating(){return s.current.padding.floating}}}),[]),c=k(d=>{if(d===null)return;d&&(a.current=d);const u=a.current;if(!u)return;const p=getComputedStyle(u),m=p.getPropertyValue("--empty-padding-block").trim(),_=p.getPropertyValue("--filled-padding-block-start").trim(),h=p.getPropertyValue("--filled-padding-block-end").trim(),v=p.getPropertyValue("--padding-inline").trim();if(!m||!_||!h||!v)return;const g={padding:{default:ct(`${m} ${v}`),floating:ct(`${_} ${v} ${h}`)}},y=g.padding.default!==s.current.padding.default||g.padding.floating!==s.current.padding.floating,f=r.current;r.current=!0,y&&(s.current=g,f&&o(b=>b+1))},[]);return F(()=>{const d=setTimeout(()=>c(),0);return()=>clearTimeout(d)},[e,t.typography?.size,c]),{themeStyles:l,themeStylesVersion:i,updateThemeStyles:c}}function Xe({errorMessageRef:e,fieldName:t,errorMessage:a,targetPath:s,shouldLog:r=!1}){const i=z(ri()),{observability:o}=S();F(()=>{if(!(!a||a===e)&&(i.current({errorType:Oe.InputInvalid,value:"<redacted>",target:s,message:a,timestamp:new Date}),r)){const l={[t]:a};o.log("hosted_fields_payment_blocked","[Hosted Fields] Payment blocked due to validation errors",{cardFieldErrorLogs:l,origin:"inline"})}},[a,e,t,r,s,o])}const ld="CsSsR",dd={HostedFields:ld};function cd(){const{sdk:e}=ge(),[t,a]=X(0),[s,r]=X();return F(()=>{(async()=>{const o=await e.getCardField("number");r(o?._iFrame)})()},[e,t]),F(()=>{const i=()=>{a(o=>o+1)};return s?.addEventListener("load",i),()=>{s?.removeEventListener("load",i)}},[s]),t}function Zt(e){return e.replace(/^var\(|\)$/g,"")}const Qt={background:Zt(Kt.color.default.control.background),text:Zt(Kt.color.default.control.text),textSubdued:Zt(Kt.color.default.control.textSubdued)},ud={base:"base",loose:"loose",xloose:"xLoose"},ua=new Map([["title","capitalize"],["upper","uppercase"],["lower","lowercase"],["none","none"]]);function As({cardBrands:e,prefillCardholderName:t=!1,customHostedFields:a,cvvOnly:s=!1,isSelected:r,paymentMethodIdentifier:i,cardNumberAccessory:o}){const l=ii(),{client:c,i18n:d,checkout:u,observability:p,shop:m,webMcp:_}=S(),h=c.enableAgenticCardEntry.value&&!!_&&m.hasFlagEnabled(_r),v=o??n(ve,{type:"lock"}),g=u.latestReceipt.value,y=g?.id;let f=!1;if(g&&oi(g)){const K=g.failure;li(K)&&(f=!0)}const b=["ja","ja-jp"].includes(d.locale.toLowerCase()),P=t&&!b?l.value:void 0,C=z(null),{themeStyles:A,themeStylesVersion:I,updateThemeStyles:L}=od(),x=e.includes("MAESTRO"),{loading:D,focusedField:T,cardBrand:M,sdk:B,errors:w,subscribe:O,unsubscribe:R,emptyFields:H,resetTouched:G}=ge(),U=M?Za(M):void 0,te=x&&U==="MAESTRO",$=uo(),Y=z({}),{negotiated:Z}=u.proposal,J=c.unstable_getSerialization("shopifyIdentificationSignature"),Q=Z.fields.checkoutCardsinkCallerIdentificationSignature?.value??J,{control:{labelPosition:ne="inside"},global:ce,textField:{typography:ie},typographyPrimary:E,typographySecondary:ee}=Vt(),oe=di().customProperties.value,me={extraSmall:oe.fontSize?.extraSmall??he.fontSize.extraSmall,small:oe.fontSize?.small??he.fontSize.small,base:oe.fontSize?.base??he.fontSize.base,medium:oe.fontSize?.medium??he.fontSize.medium,large:oe.fontSize?.large??he.fontSize.large,extraLarge:oe.fontSize?.extraLarge??he.fontSize.extraLarge,extraExtraLarge:oe.fontSize?.extraExtraLarge??he.fontSize.extraExtraLarge},De=se().paymentLines.value,Ie=ie?.fonts,Le=Ie?{primary:E.fonts,secondary:ee.fonts}[Ie]:E.fonts,re=vr(Le)??he.fontFamily.base,Pe=C.current&&getComputedStyle(C.current),Be=Pe?.getPropertyValue(Qt.text),Ve=Pe?.getPropertyValue(Qt.textSubdued),ze=Pe?.getPropertyValue(Qt.background)??he.color.global.controlBackground,_t=Be??he.color.global.controlText,vt=Ve??he.color.global.controlTextSubdued,bt=ct(me[ie?.size??"base"]),nt=he.lineHeight.base,at=he.letterSpacing[ud[ie?.kerning??"base"]],Ct=ie?.decoration??"none",St=ie?.letterCase??ce.typographyLetterCase,st=St?ua.get(St):ua.get("none"),qe=j(()=>({"background-color":ze,"placeholder-lightness":"22","placeholder-color":vt,"font-family":re,"font-size":bt,"letter-spacing":at,"line-height":nt,color:_t,"text-decoration":Ct,"text-transform":st}),[ze,re,bt,at,nt,_t,vt,Ct,st]),Ke=j(()=>({transition:"padding .2s ease-out"}),[]),Pt=we(dd.HostedFields,Ya[ne==="outside"?"labelOutside":"labelInside"]),At=k(K=>{C.current=K,L(K)},[L]);function Gt(){return U?U==="AMEX"?d.translate("payment.card_verification_value_explanation_amex"):d.translate("payment.card_verification_value_explanation_other"):d.translate("payment.card_verification_value_explanation")}const q=j(()=>{const K=[];return E?.sourceBase&&E?.fonts&&K.push({name:E.fonts,source:E.sourceBase}),ee?.sourceBase&&ee?.fonts&&K.push({name:ee.fonts,source:ee.sourceBase}),K},[E,ee]),ye=j(()=>["name","number","expiry","verification_value","issue_date","issue_number"],[]),He=k(()=>{G(),ye.forEach(K=>{B.clearField(K)}),B.setErrors({})},[G,B,ye]);F(()=>{y&&f&&He()},[y,f,He]),mn(()=>{let K,rt=!1;function je(Ys){rt||!K||(rt=!0,p.histogram({name:"hosted_fields_loading_duration",value:performance.now()-K,attributes:{isTimeout:Ys}}))}let Fe=!1;function Et(){Fe=!0}window.addEventListener("blur",Et,{once:!0});let qt;function Gs(){qt=setTimeout(()=>{je(!0),p.counter({name:"hosted_fields_timeout",value:1,attributes:{buyerLeftBrowsingContext:Fe}}),p.log("hosted_fields_loading_timed_out","[HostedFields] Hosted fields timed out while loading.")},25e3)}async function Ws(){C.current&&(O(),await B.setup(C.current,{agenticCardEntry:h,callerIdentificationSignature:Q,locale:d.locale,styles:{...qe},translations:{name:d.translate("payment.name_on_card_placeholder"),number:d.translate("payment.card_number_placeholder"),expiry:d.translate("payment.card_expiry_placeholder"),verification_value:d.translate("payment.card_verification_value_placeholder"),issue_date:d.translate("payment.card_start_placeholder"),issue_number:d.translate("payment.card_issue_number_placeholder")},fonts:{local:q},errorMessages:{name:d.translate("field_errors.credit_card_name_invalid"),number:d.translate("field_errors.credit_card_number_invalid"),number_blank:d.translate("field_errors.credit_card_number_blank"),expiry:d.translate("field_errors.credit_card_expiry_invalid"),verification_value:d.translate("field_errors.credit_card_verification_value_blank"),issue_date:d.translate("payment.card_fields.errors.required.issue_date"),issue_number:d.translate("payment.card_fields.errors.required.issue_number")},validationSetting:"mixed"},()=>{K=performance.now(),Gs()}),clearTimeout(qt),je(!1))}return Ws(),()=>{window.removeEventListener("blur",Et),clearTimeout(qt)}},[C,O,B,h,Q,qe,d,q,p]),F(()=>()=>{R(),H(),B.teardown()},[R,H,B]),F(()=>{D||(B.setStyles({styles:{...Ke,...qe}}),q.length&&B.loadFonts({local:q}))},[D,Ke,qe,B,q]),F(()=>{function K(Fe){return Fe?.number?Fe.number.origin==="server"?d.translate("field_errors.credit_card_number_invalid"):Fe.number.message:null}if($?.paymentMethodIdentifier!==i)return;const je={name:$.name&&(!a||a.includes("name"))?d.translate("field_errors.credit_card_name_invalid"):null,number:K($),expiry:$.expiry&&(!a||a.includes("expiry"))?d.translate("field_errors.credit_card_expiry_invalid"):null,verification_value:$.verificationValue&&(!a||a.includes("verification_value"))?d.translate("field_errors.credit_card_verification_value_blank"):null,issue_date:$.issueDate&&(!a||a.includes("issue_date"))?d.translate("payment.card_fields.errors.required.issue_date"):null,issue_number:$.issueNumber&&(!a||a.includes("issue_number"))?d.translate("payment.card_fields.errors.required.issue_number"):null};B.setErrors(je)},[B,d,$,i,a]),F(()=>{const{number:K,name:rt,expiry:je,verificationValue:Fe}=$;if($?.number||$?.name||$?.expiry||$?.verificationValue){const Et={number:K?.message,name:rt?.message,expiry:je?.message,verification_value:Fe?.message};p.log("hosted_fields_payment_blocked","[Hosted Fields] Payment blocked due to validation errors",{cardFieldErrorLogs:Et,origin:"progression"})}},[$,p]),Xe({errorMessageRef:Y.current.number,fieldName:"number",errorMessage:w.number,targetPath:"cart.paymentLines[0].card.number",shouldLog:!0}),Xe({errorMessageRef:Y.current.expiry,fieldName:"expiry",errorMessage:w.expiry,targetPath:"cart.paymentLines[0].card.expiry",shouldLog:!0}),Xe({errorMessageRef:Y.current.verification_value,fieldName:"verification_value",errorMessage:w.verification_value,targetPath:"cart.paymentLines[0].card.verificationValue",shouldLog:!0}),Xe({errorMessageRef:Y.current.name,fieldName:"name",errorMessage:w.name,targetPath:"cart.paymentLines[0].card.name",shouldLog:!0}),Xe({errorMessageRef:Y.current.issue_number,fieldName:"issue_number",errorMessage:w.issue_number,targetPath:"cart.paymentLines[0].card.issueNumber"}),Xe({errorMessageRef:Y.current.issue_date,fieldName:"issue_date",errorMessage:w.issue_date,targetPath:"cart.paymentLines[0].card.issueDate"});const Wt=De.some(K=>K.method.type==="direct");xa({active:(r??Wt)&&(D||!!w.sdk)});const Ae=K=>a?!a.includes(K):!1,Gn=n("div",{hidden:Ae("expiry"),children:n(Ce,{name:"expiry",label:d.translate("payment.card_expiry_label"),placeholder:d.translate("payment.card_expiry_placeholder"),loading:D,focused:T==="expiry",error:w.expiry,hidden:Ae("expiry"),themeStyles:A,themeStylesVersion:I})}),Wn=n("div",{hidden:Ae("issue_date"),children:n(Ce,{name:"issue_date",label:d.translate("payment.card_start_label"),placeholder:d.translate("payment.card_start_placeholder"),hidden:!te||Ae("issue_date"),error:w.issue_date,themeStyles:A,themeStylesVersion:I})}),Yn=n("div",{hidden:Ae("issue_number"),children:n(Ce,{name:"issue_number",label:d.translate("payment.card_issue_number_label"),placeholder:d.translate("payment.card_issue_number_placeholder"),hidden:!te||Ae("issue_number"),error:w.issue_number,themeStyles:A,themeStylesVersion:I})}),Yt=n("div",{hidden:Ae("verification_value"),children:n(Ce,{name:"verification_value",label:d.translate("payment.card_verification_value_label"),placeholder:d.translate("payment.card_verification_value_placeholder"),loading:D,focused:T==="verification_value",error:w.verification_value,accessory:n(nd,{control
2Label:d.translate("tooltip.accessibility_label_context",{context:d.translate("payment.card_verification_value_label")}),children:Gt()}),hidden:Ae("verification_value"),themeStyles:A,themeStylesVersion:I})});if(s)return n("div",{ref:At,className:Pt,children:[Yt,n(Ce,{name:"name",hidden:!0,label:d.translate("payment.name_on_card_label"),themeStyles:A,themeStylesVersion:I}),n(Ce,{name:"number",hidden:!0,label:d.translate("payment.card_number_label"),themeStyles:A,themeStylesVersion:I}),n(Ce,{name:"expiry",hidden:!0,label:d.translate("payment.card_expiry_label"),themeStyles:A,themeStylesVersion:I}),n(Ce,{name:"issue_date",hidden:!0,label:d.translate("payment.card_start_label"),themeStyles:A,themeStylesVersion:I}),n(Ce,{name:"issue_number",hidden:!0,label:d.translate("payment.card_issue_number_label"),themeStyles:A,themeStylesVersion:I})]});const Us=a&&a.filter(K=>K==="expiry"||K==="verification_value").length<=1,$s=a&&a.filter(K=>K==="issue_date"||K==="issue_number").length<=1;return n("div",{ref:At,className:Pt,children:n(xn,{children:[n(Ce,{name:"number",label:d.translate("payment.card_number_label"),placeholder:d.translate("payment.card_number_placeholder"),loading:D,focused:T==="number",error:w.number,accessory:v,themeStyles:A,themeStylesVersion:I}),Us?n(W,{children:[Gn,Yt]}):n(on,{children:[Gn,Yt]}),n("div",{hidden:!te,children:$s?n(W,{children:[Wn,Yn]}):n(on,{children:[Wn,Yn]})}),n("div",{hidden:Ae("name"),children:n(Ce,{name:"name",label:d.translate("payment.name_on_card_label"),placeholder:d.translate("payment.name_on_card_placeholder"),loading:D,focused:T==="name",error:w.name,initialValue:P,allowClear:t,hidden:Ae("name"),themeStyles:A,themeStylesVersion:I})})]})})}function md({open:e}={}){const{i18n:t}=S(),{selectedNetwork:a}=ft();return n(Rt,{id:"network-selection-info-banner",duration:"fast",open:e??!!a,children:n(V,{size:"small",color:"subdued",children:t.translate("payment.network_card_persistence_description")})})}const pd="1",yd="2",fd="3",hd="https://help.shopify.com/en/manual/checkout-settings/test-orders/payments-test-mode#test-payment-gateway";function gd(){const{i18n:e}=S();return n(ui,{children:n(N,{gap:"small-300",children:[n(Ot,{level:3,children:e.translate("payment.bogus_test_checkout.title")}),n(N,{gap:"small-400",children:[n(de,{children:e.translate("payment.bogus_test_checkout.intro")}),n(ci,{gap:"small-400",children:[n(jt,{children:e.translate("payment.bogus_test_checkout.approved_transaction",{card_number:n(V,{type:"strong",children:pd})})}),n(jt,{children:e.translate("payment.bogus_test_checkout.declined_transaction",{card_number:n(V,{type:"strong",children:yd})})}),n(jt,{children:e.translate("payment.bogus_test_checkout.gateway_failure",{card_number:n(V,{type:"strong",children:fd})})})]}),n(de,{children:e.translate("payment.bogus_test_checkout.additional_instructions")})]}),n(V,{color:"subdued",children:n(Re,{href:hd,target:"_blank",tone:"monochrome",children:e.translate("payment.bogus_test_checkout.support_link")})})]})})}function _d(){const{checkout:e}=S(),{buyerIdentity:t,paymentMethods:a}=pe(),{paymentLines:s}=se();return ue(()=>{const r=e.addressManager.billing.value.suggestedAddress,i=t.value?.purchasingCompany,o=!!fn(a.value).length,l=r.value.type,c=s.value.some(({method:d})=>d.type==="direct");return!i||o||!c?null:l?"selector":"form"})}function vd(){const{i18n:e,checkout:t}=S(),a=_d(),s=t.addressManager.billing.value,r=s.suggestedAddress.value,i=r.address,o=r.type,l=se().shippingAddress.value;Va();function c(){const m=Ma({countryCode:l.countryCode});s.addresses.value.some(h=>h.id===aa)?s.updateAddress({id:aa,address:m}):s.createAddress({address:m})}const d=s.selectedAddress.value?.id===kt,u=Cn(i),p=(()=>
2{if(o==="billing-fact")return e.translate("payment.use_order_billing_address_label");if(o==="billing")return e.translate("payment.use_location_billing_address_label");if(o==="shipping")return e.translate("payment.use_location_shipping_address_label")})();return n(le,{children:[n(be,{when:()=>a.value==="selector",children:n(ht,{id:"billingAddress",name:"billingAddress",checked:d,onChange:m=>{m&&i&&o?s.selectAddress(kt):c()},label:n(W,{children:[p,n(de,{color:"subdued",children:u})]})})}),n(be,{when:a,children:n(Rt,{id:"billingAddressDetails",open:o===null||!d,children:[n(Ee,{blockSize:"large-300"}),n(Ot,{level:2,children:e.translate("payment.billing_address_title")}),n(Ee,{blockSize:"base"}),n(It,{})]})})]})}const bd=e=>n("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 60 60",...e,children:n("g",{fillRule:"evenodd",children:[n("path",{d:"M30 60C13.43 60 0 46.57 0 30S13.43 0 30 0s30 13.43 30 30-13.43 30-30 30m0-2c15.464 0 28-12.536 28-28S45.464 2 30 2 2 14.536 2 30s12.536 28 28 28"}),n("path",{fillRule:"nonzero",d:"M30.134 48.856a2.5 2.5 0 0 0 0-5 2.5 2.5 0 0 0 0 5"}),n("rect",{width:2,height:27,x:29,y:11,rx:1})]})}),Cd="e3sCv",Sd="hevoz",ma={Container:Cd,WarningIcon:Sd};function Pd(){const{errors:e,sdkLoadDiagnostics:t}=ge(),{router:a,i18n:s,observability:r}=S();return F(()=>{if(e.sdk){const i=t?.errorCause;r.counter({name:"card_fields_sdk_load_error",value:1,attributes:{error:e.sdk,...typeof i=="string"?{error_cause:i}:{}}}),r.log("card_fields_sdk_load_failed","[CardFieldsSDKLoadError] An error occurred when attempting to load the Card Fields SDK.",{cause:e.sdk,...t?{diagnostics:t}:{}})}},[e.sdk,r,t]),n("div",{className:ma.Container,children:[n(bd,{className:ma.WarningIcon}),n(N,{gap:"small-200",children:n(de,{children:n(Sn,{children:s.translate("payment.card_fields_unavailable_html",{count:1,current_url:a.currentUrl.value.toString()})})})})]})}const Ad=e=>n("svg",{xmlns:"http://www.w3.org/2000/svg",width:102,height:52,viewBox:"-270.8 371 102 52",...e,children:[n("path",{fill:"none",stroke:"inherit",strokeMiterlimit:10,strokeWidth:2,d:"M-182 404v16.8c0 .7-.4 1.2-1 1.2h-75.7c-.7 0-1.2-.6-1.2-1.2v-47.6c0-.7.6-1.2 1.2-1.2h75.7c.7 0 1 .6 1 1.2V395m-78-14h78m-17 18h27m-3.9-4.6 4.5 4.6-4.5 4.6"}),n("circle",{cx:-255.5,cy:376.5,r:1.5,fill:"inherit"}),n("circle",{cx:-250.5,cy:376.5,r:1.5,fill:"inherit"}),n("circle",{cx:-245.5,cy:376.5,r:1.5,fill:"inherit"})]}),Ed="_2wkMu",Md="H55oQ",pa={Container:Ed,OffsiteIcon:Md};function Id(){const{i18n:e}=S();return n("div",{className:pa.Container,children:n(N,{gap:"large-200",children:[n(Ad,{className:pa.OffsiteIcon}),n(de,{children:e.translate("payment.no_js_credit_card_fields_redirect_hint")})]})})}const Ld="_1yB1O",kd={cardDigitsWrapper:Ld};function wd({id:e,brand:t,displayLastDigits:a,details:s,onEdit:r,onDelete:i,requiresVerification:o}){const{i18n:l}=S(),{closeOverlay:c}=mi(),d=lt(t),u=`${l.translate("payment.masked_digits_label",{last_digits:a})}`,p=`• ${a}`,m=()=>{i&&i(e),c("actions-overlay")};return n(N,{gap:"small-500",children:[n(Je,{gridAutoFlow:"column",gridTemplateColumns:"minmax(auto, max-content) minmax(0, 1fr) minmax(auto, max-content)",gridTemplateRows:"minmax(0, 1fr)",gap:"small-300",alignItems:"center",alignContent:"center",children:[n(tt,{type:t}),n(de,{children:n(V,{type:"strong",children:[d," ",n("span",{className:kd.cardDigitsWrapper,children:o?p:u})]})}),n(Je,{gridAutoFlow:"column",gridAutoColumns:"minmax(0, 1fr)",gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",children:[!r&&i?n(We,{onClick:m,accessibilityLabel:l.translate("payment.delete_credit_card_modal.title"),children:n(ve,{type:"delete",size:"small"})}):null,o?n(ve,{type:"alert-triangle",size:"small"}):null,r?n(We,{overlay:n(yo,{connector:"none",offset:10,id:"actions-overlay",children:n(Je,{gridAutoRows:"minmax(0, 1fr)",gridAutoColumns:"minmax(0, 1fr)",gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",gap:"base",justifyContent:"start",justifyItems:"start",children:[r&&n(Re,{textDecoration:"none",onClick:()=>{r(),c("actions-overlay")},children:l.translate("payment.saved_credit_card_actions.edit")}
2),i&&n(Ze,{variant:"plain",textDecoration:"none",tone:"critical",onClick:m,children:l.translate("payment.saved_credit_card_actions.delete")})]})}),children:n(ve,{type:"menu-vertical"})}):null]})]}),n(de,{children:n("bdi",{children:s})})]})}function cn(e){const t=S(),{details:a,onEdit:s,onDelete:r}=Td(e,t);return n(wd,{id:e.id,brand:e.brand,displayLastDigits:e.displayLastDigits,details:a,onEdit:s,onDelete:r,requiresVerification:e.requiresVerification})}function Td(e,{checkout:t}){return t.identity.current.value==="businessCustomer"?{details:e.displayCardholderName,onEdit:void 0,onDelete:e.isVaultedCard?void 0:e.onDelete}:{details:e.displayAddress,onEdit:e.onEdit,onDelete:e.onDelete}}const Nd=["session_card"],Dd=()=>{};function Bd({cardDetails:e}){const{shippingAddress:t,billingAddress:a,billingAddressOption:s}=se(),r=br(),{getAccessibilityLabel:i}=Qa(),o=i(e),l=s.value==="shipping"?t.value.address1:a.value.address1;return n(zt,{values:Nd,onChange:Dd,variant:"grid",children:n(fe,{id:"session_card",value:"session_card",accessibilityLabel:o,children:n(cn,{id:"session",isVaultedCard:!1,displayLastDigits:e.creditCardLastFourDigits,brand:e.brand,displayCardholderName:e.cardholderName,displayAddress:l,onDelete:()=>r()})},"session_card")})}function Es({offsite:e,paymentMethod:t,sessionCard:a,isSelected:s,cardNumberAccessory:r}){const{errors:i}=ge(),{i18n:o,shop:l,shopPay:c,checkout:d}=S(),u=t.paymentBrands?.includes("BOGUS")??!1,p=Pn(t),{bankIdNumberSignal:m}=Ne(),_=d.configuration.layout.isOnePage.value,h=cd(),v=pe().buyerIdentity.value?.purchasingCompany,g=Ht().value,y=se(),f=mo(y.directPaymentErrors),{errorBannerInContext:b,billingAddressInContext:P,billingAddressVariant:C,isInModal:A,cardNickname:I,onCardNicknameChange:L}=gl();F(()=>{let U;return a?.creditCardFirstDigits&&(m.value?.replace(/\s/g,"")??"").length<a.creditCardFirstDigits.length&&(U=a.creditCardFirstDigits,m.value=U),()=>{U!==void 0&&m.value===U&&(m.value=void 0)}},[a?.creditCardFirstDigits,m]);const x=!g&&P&&C==="inlineDirectMethod",D=An("Checkout::PaymentMethod::HostedFields::RenderAfter",t?.uiExtension===void 0?[]:[t.uiExtension]),T=y.shippingAddress.value,M=j(()=>({paymentMethodIdentifier:t.paymentMethodIdentifier}),[t.paymentMethodIdentifier]);if(i.sdk)return n(Pd,{});if(e)return n(Id,{});const B=b&&f?n(xe,{errorType:Oe.PaymentError,tone:"critical",children:o.translate("payment.generic_incorrect_card_info")}):null,w=a&&n(Bd,{cardDetails:a}),O=v&&_?n(vd,{}):n(ls,{}),R=xd({checkout:d,shop:l,shopPay:c},T),H=Rd({checkout:d},t),G=n("div",{hidden:!!a,children:[n(As,{cardBrands:t.paymentBrands??[],prefillCardholderName:R,isSelected:s,paymentMethodIdentifier:H,cardNumberAccessory:r},h),Fd({identity:d.identity})&&n(md,{})]});return n(N,{gap:"base",children:[B,u&&!a&&n(gd,{}),A&&L?n(xn,{children:[G,n(Ge,{name:"cardNickname",label:o.translate("payment.card_nickname_label"),value:I??"",onChange:L,maxLength:Da})]}):G,w,D.length>0&&s&&t.paymentMethodIdentifier&&n(Oi,{options:M,paymentMethodExtension:D}),p&&!A?n(es,{paymentMethod:t,isSelected:s,canEditBin:!a}):null,x&&O]})}function Fd({identity:e}){return e.current.value==="shopPay"}function xd({checkout:e,shop:t,shopPay:a},s){return e.identity.current.value!=="shopPay"?t.sameBillingAndShippingAddress:!s?.firstName||!s?.lastName?!1:a.user.addresses.value.some(({address:r})=>r.firstName===s.firstName&&r.lastName===s.lastName)}function Rd({checkout:e},t){if(e.identity.current.value!=="shopPay")return t.paymentMethodIdentifier}function Od({children:e,addCardModalOpen:t}){return F(()=>()=>{t.value=!1},[t]),n(W,{children:e})}function Vd({paymentMethod:e,addCardModalOpen:t}){const{createAddressParts:a,buyerHasActedSignal:s}=Ne(),{i18n:r,checkout:i,shop:o}=S(),[l,c]=X(!1),d=as(),[u,p]=X(!1),m=_e(void 0),_=se(),h=_.billingAddress.value,v=_.acceptPaymentVaulting,g=Cn(h),y=Cr(),f=Sr(),b=pe(),{value:P}=b.paymentFlexibilityPaymentTermsTemplate,{sdk:C,loading:A,validate:I,resetTouched:L}=ge(),[x,D]=X(!1),T=pi().value,{negotiate:M}=xt(),B=Ut(),w=ue(()=>!B.value),{rollup:{action:{tone:O}={}}={}}=Vt(),R=i.addressManager.billing,H=R.value,G=pe().buyerIdentity,U=G.value?.purchasingCompany,te=!U&&G.value?.customerProfile?.__typename==="CustomerProfile",$=H.errors.fields,Y=yi(h?.countryCode),Z=k(q=>{Y("billing_address",q).forEach((He,Wt)=>{$[Wt].value=He})},[$,Y]),{value:J}=b.deferredTotal,Q=a.addressModalState.value,ne=_e(void 0),ce=_e(!1),ie=Q.addressType==="billing"&&(Q.status==="editing"||Q.status==="adding"),E=ne.value!=null||ie,ee=ie&&Q.status==="editing",oe=ce.value||ee?r.translate("edit_credit_card_modal.edit_address_title"):r.translate("billing.address_form.add_address"),me=_e(void 0),De=k(async q=>R.value.createAddress({address:q}),[R]),Ie=k(async q=>{const ye=me.value??(a.addressModalState.value.status==="editing"?a.addressModalState.value.addressId:void 0);return ye?await R.value.updateAddress({id:ye,address:q}):void 0},[R,me,a.addressModalState]),Le=ee||ce.value&&te?Ie:De,re=k(async q=>{const ye=await Le(q);return ye&&te&&await M({fieldsToResolve:["paymentMethods"]}),ye},[Le,M,te]),Pe=k(()=>{l&&E?(ne.value=void 0,ce.value=!1,me.value=void 0,m.value=void 0,ie&&(a.addressModalState.value={status:"idle",addressType:"billing",setAsDefault:"default"})):x||(d(),L(),v.value=!1,c(!1),p(!1),a.addressModalState.value={status:"idle",addressType:"shipping",setAsDefault:"default"})},[l,E,ie,x,a.addressModalState,v,d,L,m,ne,ce,me]),Be=()=>{U||(_.billingAddressOption.value="custom"),p(q=>!q)},Ve=k(()=>{const q=H.addresses.value[0],ye=i.configuration.addressSettings.billingAddressSettings.value.defaultShippingDetails.country.code,He=tn({firstName:q?.address.firstName,lastName:q?.address.lastName,countryCode:ye??q?.address.countryCode},{extendedAddressMode:i.address.extendedAddressMode});ne.value=He},[H.addresses,i,ne]),Ye=()=>{c(!0),t.value=!0,d(),L(),ne.value=void 0;const q=H.selectedAddress.value;te&&q&&(_.billingAddress.value=q.address,_.billingAddressOption.value="custom")},ze=wa(o),_t=k(async()=>{await Ll({validateCardFields:I,vaultCard:()=>C.vaultCard(),paymentMethodIdentifier:e.paymentMethodIdentifier,getDue:()=>Pr(J,!!y.value,f.value,P?.type),parts:_,newCard:B,buyerHasActedSignal:s,negotiate:M,setLoa
2ding:D,fixSubscriptionRedeemablePaymentAmount:ze,openBilling:()=>p(!0),close:()=>{c(!1),p(!1)},onAddressError:q=>{if(te){const ye=R.value.selectedAddress.value;ye&&(m.value=ye,Z(q))}else Z&&Z(q)}})},[B,s,I,e,M,C,J,y,f,_,Z,P?.type,te,R,m,ze]),vt=Aa(Q),bt=ue(()=>vt.value.addressType==="billing"?i.configuration.addressSettings.billingAddressSettings.value:i.configuration.addressSettings.nonBillingAddressSettings.value),nt=Q.addressType==="shipping",at=()=>{ne.value=void 0,ce.value=!1,me.value=void 0,m.value=void 0,p(!1),ie&&(a.addressModalState.value={status:"idle",addressType:Q.addressType,setAsDefault:"default"})},Ct=nt?r.translate("address_management.address_form.save"):r.translate("billing.address_form.save"),St=nt?r.translate("address_management.address_form.cancel"):r.translate("billing.address_form.cancel"),st=U&&Q.addressType==="shipping"?r.translate("shipping.address_form.one_time_address_subtitle"):"",qe=E?oe:r.translate("payment.add_credit_card_modal.title"),Ke=H.isMissingValidSuggestedAddress.value,Pt=zd(i.identity),At=te?n(xl,{open:u,onToggle:Be,onAddAddress:Ve,errorAddress:m,onEditErrorAddress:()=>{const q=H.selectedAddress.value;q&&(ce.value=!0,me.value=q.id,ne.value=tn(q.address,{extendedAddressMode:i.address.extendedAddressMode}))}}):Pt?n(wl,{open:u,onToggle:Be}):n(gt,{id:"billingAddress",label:r.translate("payment.billing_address_title"),open:u||Ke,onToggle:Ke?void 0:Be,primaryContent:Ke?void 0:g,children:n(N,{gap:"base",children:n(bs,{hideAddressModal:!0})})}),Gt=l&&E?{open:!0,content:n(W,{children:[st&&n(le,{padding:"base",children:n(de,{color:"subdued",children:st})}),n(N,{gap:"base",children:n(Dn,{editableAddress:ne.value??Q.address,addressType:ne.value?"billing":Q.addressType,saveText:Ct,cancelText:St,onSave:re,onSuccess:at,onCancel:at,showSavedAddressSelector:ne.value!=null&&!ce.value||H.canCreateAddress.value,addressErrorsSignal:$,combineViolationAndValidationErrors:ee,addressSettings:bt.value})})]})}:void 0;return n(N,{gap:"base",children:[n(be,{when:w,children:n(Ze,{tone:O==="custom"?"custom":void 0,onClick:Ye,variant:"plain",textDecoration:"none",children:n(N,{direction:"inline",gap:"small-400",alignItems:"center",justifyContent:"center",children:[n(ve,{type:"plus",size:"small"}),n(V,{children:r.translate("payment.use_different_credit_card_label")})]})})}),n(El,{size:"large",open:l,onClose:Pe,heading:qe,cardForm:n(Od,{addCardModalOpen:t,children:n(Es,{paymentMethod:e})}),billingAddressSection:At,afterBillingAddress:T?n(gs,{forceVaultingEligible:!0,blockNegotiations:!0}):void 0,onSave:_t,loading:x||A,createAddressForm:Gt})]})}function zd(e){return e.current.value==="businessCustomer"}const Hd={rollup:{blockPadding:"base",inlinePadding:"none"}};function Ud({open:e,onCancel:t,onSave:a,card:s,billingAddress:r,isDefaultCard:i,onDefaultCardChange:o,error:l,addressErrorsSignal:c,initialShowAddressForm:d=!1}){const{i18n:u,checkout:p,shop:m}=S(),_=Zi(),h=p.configuration.addressSettings.billingAddressSettings.value,{nickname:v}=s,[g,y]=X(!1),f=_e(!1),b=_e(v);F(()=>{e&&(f.value=d,b.value=v)},[e,v,f,b,d]);const P=async()=>{y(!0),await a(r,b.value)&&t(),y(!1)},C=async D=>await a(D,b.value)?{id:"edit-card-billing",address:D}:void 0,A=v!==void 0,I=o!==void 0,L=()=>{const D=n(le,{border:"base",borderRadius:"base",padding:"none base",children:n(gt,{label:u.translate("payment_ux.bill_to"),primaryAction:n(Ze,{variant:"plain",onClick:()=>{f.value=!0},children:n(V,{children:u.translate("edit_credit_card_modal.edit_button")})}),primaryContent:n(ro,{address:r,nameLinePosition:"block"})})});return n(W,{children:[l&&n(N,{gap:"base",padding:"base none",children:n(xe,{tone:"critical",errorType:Oe.PaymentError,children:l})}),I&&n(W,{children:[n(ht,{id:"default",name:"default",checked:i??!1,onChange:o,label:u.translate("payment.edit_credit_card_modal.fields.default")}),n(Ee,{blockSize:"small-200"})]}),n(V,{children:u.translate("edit_credit_card_modal.edit_address_only_note")}),n(Ee,{blockSize:"small-200"}),n(_n,{disabled:!1,onSubmit:P,children:n(xn,{children:[n(Ge,{name:"cardNumber",label:u.translate("payment.card_number_label"),readOnly:!0,value:`···· ···· ···· ${s.lastDigits}`,disabled:!0}),n(on,{children:[n(Ge,{name:"expiryLabel",label:u.translate("payment.card_expiry_label"),readOnly:!0,value:Ar(s.expiryMonth,s.expiryYear),disabled:!0}),n(Ge,{name:"cardVerification",label:u.translate("payment.card_verification_value_label"),readOnly:!0,value:"···",disabled:!0})]}),n(Ge,{name:"cardHolderName",label:u.translate("payment.name_on_card_label"),readOnly:!0,value:s.cardholderName||"············",disabled:!0}),A&&n(Ge,{name:"cardNickname",label:u.translate("payment.card_nickname_label"),value:b.value||"",onChange:T=>{b.value=T},maxLength:Da})]})}),n(Ee,{blockSize:"base"}),m.hasFlagEnabled(Ta)?n($t,{theme:Hd,children:D}):D]})},x=n(bn,{submitText:u.translate("payment.card_form.save"),cancelText:u.translate("payment.card_form.cancel"),loading:g,disabled:g,handleSubmit:P,handleCancel:t});return n(Nn,{open:e,heading:f.value?u.translate("edit_credit_card_modal.edit_address_title"):u.translate("edit_credit_card_modal.edit_card_title"),onHide:t,primaryAction:f.value?void 0:x,children:n(be,{when:f,fallback:L(),children:n(Dn,{onCancel:()=>{f.value=!1},onSuccess:t,onSave:C,cancelText:u.translate("credit_card_form.go_back"),saveText:u.translate("edit_credit_card_modal.save_billing_address"),editableAddress:tn(r,{extendedAddressMode:p.address.extendedAddressMode}),addressType:"billing",countriesOverride:_.value,addressErrorsSignal:c,addressSettings:h})})})}async function $d({address:e,defaultPaymentMethod:t,token:a,onEditCardSubmit:s,negotiate:r}){const{token:i}=await s({defaultPaymentMethod:t,address:e,token:a});return i?new Promise(o=>{r({fieldsToResolve:["paymentMethods"],force:!0,onComplete(l){o(l.status==="success")}})}):!1}function Gd({paymentMethodId:e,cvvError:t}={}){const{i18n:a}=S(),{sdk:s,validate:r,loading:i}=ge(),o=se(),l=t==="INCORRECT_CVC"?a.translate("payment_errors.incorrect_cvc"):null;return F(()=>(i||s.setErrors({verification_value:l}),()=>{s.setErrors({verification_value:null})}),[s,l,i]),et(async({reason:c})=>{if(c!=="completion")return{behavior:"allow"};const{isValid:d}=r(!0);if(!d)return{behavior:"block",reason:Te.CvvFieldIsInvalid};const u=await s.vaultCard(),p=o.paymentLines.peek();return o.paymentLines.value=p.map(m=>
2m.method.type!==Me.CreditCard||e&&m.method.token!==e?m:{...m,method:{...m.method,cvvSessionId:u}}),{behavior:"allow"}}),n(le,{children:[n(Ee,{blockSize:"base"}),n(fi,{}),n(Ee,{blockSize:"base"}),n(N,{gap:"small-300",children:[n(de,{color:"subdued",children:a.translate("payment.saved_credit_card_cvv_verification")}),n(Je,{gridAutoFlow:"column",gridTemplateColumns:"minmax(0, 1.5fr) minmax(0, 1fr)",gridAutoColumns:"1fr",gridTemplateRows:"minmax(0, 1fr)",gap:"none",alignItems:"center",alignContent:"center",children:n(As,{cardBrands:[],prefillCardholderName:!1,cvvOnly:!0})})]})]})}function Wd(){const{i18n:e,checkout:{address:{extendedAddressMode:t}},graphql:{coreGraphql:a}}=S(),[s,r]=X("");return{onSubmit:async({address:l,defaultPaymentMethod:c,token:d})=>{if(!d)return{token:void 0};r("");const u=await Vi({graphql:a,address:l,extendedAddressMode:t,defaultPaymentMethod:c,token:d,genericError:e.translate("shipping.address_form.generic_error")});return u.error&&r(u.error),{token:u.token}},error:s,resetError:()=>r("")}}async function Yd({token:e,savedCreditCards:t,newCardValue:a,setSelected:s,deleteVaultedCreditCard:r,negotiate:i,onComplete:o}){if(t.length===1)s("direct");else{const c=t.find(d=>d.token!==e);if(c){const d=a?"direct":Se(c);s(d)}}const{token:l}=await r(e);l&&await i({fieldsToResolve:["paymentMethods"],force:!0,onComplete(c){c.status==="success"&&o()}})}function qd(e){if(e.immutableAddresses.value.find(s=>s.id===kt)){e.selectAddress(kt);return}const a=e.suggestedAddress.value;a.address&&e.createAddress({address:a.address})}function Kd({billingAddress:e,billingAddressOption:t,shippingAddress:a}){const{countryCode:s,zoneCode:r}=e.value??{};e.value={...Er(void 0,s,r),...a.value},t.value="shipping"}function jd({newCardSignal:e,savedCreditCards:t,setSelected:a,paymentLines:s,acceptPaymentVaulting:r,isBusinessCustomer:i,billingManager:o,billingAddress:l,billingAddressOption:c,shippingAddress:d,onComplete:u}){if(!e.value)return u?.(),!1;e.value=void 0,r.value=!1;const p=t[0];return p?(a(Se(p)),o&&qd(o)):s.value=s.value.filter(m=>m.method.type!=="direct"),i||Kd({billingAddress:l,billingAddressOption:c,shippingAddress:d}),u?.(),!0}function Xd(){const{i18n:e,graphql:{coreGraphql:t}}=S(),[a,s]=X("");return{onSubmit:async o=>{if(!o)return{token:void 0};s("");const l=await zi({graphql:t,token:o,genericError:e.translate("customer_payment_methods.delete_customer_mandate.generic_error")});return l.error&&s(l.error),{token:l.token}},error:a,resetError:()=>s("")}}
2class Jd extends Error{constructor(){super(...arguments),this.name="DeleteCardModalError"}}function Zd({paymentToDelete:e,onClose:t,setSelected:a}){const{checkout:s,i18n:r,observability:i}=S(),o=s.addressManager.billing.value,{negotiate:l}=xt(),{paymentMethods:c,shippingAddress:d,buyerIdentity:u}=pe(),p=fn(c.value),m=Ut(),{acceptPaymentVaulting:_,billingAddress:h,billingAddressOption:v,paymentLines:g}=se(),[y,f]=X(!1),b=u.value?.purchasingCompany,{onSubmit:P,error:C,resetError:A}=Xd(),I=async()=>{f(!0);try{e?.token?await Yd({token:e.token,savedCreditCards:p,newCardValue:m.value,setSelected:a,deleteVaultedCreditCard:P,negotiate:l,onComplete:t}):e?.id===ke?jd({newCardSignal:m,savedCreditCards:p,setSelected:a,paymentLines:g,acceptPaymentVaulting:_,isBusinessCustomer:!!b,billingManager:o,billingAddress:h,billingAddressOption:v,shippingAddress:d,onComplete:t}):i.error(new Jd("Delete pressed with no actionable paymentToDelete"))}finally{f(!1)}},L=()=>{t(),A()},x=C?n(N,{gap:"base",children:n(xe,{tone:"critical",errorType:Oe.PaymentError,children:C})}):null;return n(qa,{size:"base",open:!!e,heading:r.translate("payment.delete_credit_card_modal.title"),onHide:L,children:[n(N,{gap:"base",padding:"base none large-300 none",children:[x,n(de,{children:n(V,{color:"subdued",children:r.translate("payment.delete_credit_card_modal.confirmation",{brandName:e?.brandLabel??"",lastDigits:e?.lastDigits??""})})})]}),n(bn,{submitText:r.translate("payment.delete_credit_card_modal.delete"),cancelText:r.translate("payment.delete_credit_card_modal.cancel"),submitButtonAppearance:"critical",handleSubmit:I,handleCancel:t,loading:y,disabled:y})]})}function Ms({savedCreditCards:e,selected:t,setSelected:a,isSelected:s,isInModal:r,setSelectedSavedCreditCardBrand:i,addCardModalOpen:o,msiAvailable:l=!1}){const{userEvents:c,shop:{id:d,storeVaultEnabled:u,storeVaultGuestCvvVerificationEnabled:p},source:{checkoutSessionIdentifier:m}}=S(),_=Ut(),{bankIdNumberSignal:h,lastNegotiatedBinSignal:v}=Ne(),[g,y]=X(null),[f,b]=X(!1),{onSubmit:P,error:C,resetError:A}=Wd(),[I,L]=X(!1),x=j(()=>Ba(),[]),[D,T]=X(null),M=Ht().value,B=o?.value??!1,w=se(),O=w.billingAddress.value,{getAccessibilityLabel:R}=Qa(),H=E=>e.find(ee=>{const oe=E.split("-")[1];return ee.token===oe}),G=H(t),U=_.value,te=s&&G?.requiresCvvConfirmation&&p&&!B&&!r,$=z(t);F(()=>{const E=$.current;if($.current=t,i?.(G?.brand),t!==ke){h.value=G?.firstDigits;return}if(M){const ee=U?.creditCardFirstDigits;(!l||!ea(h.value,ee))&&(h.value=ee);return}E!==ke&&(h.value=void 0)},[h,i,G,t,U,M,l]),F(()=>{g&&L(g.defaultPaymentMethod)},[g]);const Y=E=>{E===ke&&T({id:E,lastDigits:_.value?.creditCardLastFourDigits??"",brandLabel:_.value?.brand?lt(_.value?.brand):""})},Z=()=>{T(null)},{negotiate:J}=xt(),Q=k(E=>$d({address:E,defaultPaymentMethod:I,token:g?.token,onEditCardSubmit:P,negotiate:J}),[I,g,J,P]),ne=k(()=>{b(!1),A()},[A]),ce=E=>{const ee=H(E),oe=h.peek();let me;E===ke?me=M?U?.creditCardFirstDigits:void 0:me=ee?.firstDigits,l&&E===ke&&M&&ea(oe,me)||(h.value=me);const Ie=h.peek();l&&(w.paymentLines.value=hi(w.paymentLines.value),v.value=Ie),J({force:!0,negotiationStage:"negotiation"}).catch(()=>{l&&v.peek()===Ie&&(v.value=void 0)}),a(E),ee&&Hi({userEvents:c,shopId:d,checkoutSessionIdentifier:m,card:ee})},ie={lastDigits:g?.displayLastDigits??"",expiryMonth:g?.expiryMonth??0,expiryYear:g?.expiryYear??0,cardholderName:g?.cardholderName??""};return n(zt,{values:[t],onChange:E=>ce(E[0]??""),variant:"grid",children:[M&&n(be,{when:_,children:E=>n(fe,{id:"direct",value:"direct",accessibilityLabel:R(E),children:E.brand&&E.creditCardLastFourDigits&&n(cn,{id:"direct",isVaultedCard:!1,brand:E.brand,displayLastDigits:E.creditCardLastFourDigits,displayCardholderName:E.cardholderName,displayAddress:O.address1,onDelete:Y})},"direct")}),e.map(E=>{const ee=()=>{y(E),b(!0)},oe=()=>T({token:E?.token,lastDigits:E.displayLastDigits,brandLabel:E?.brand?lt(E?.brand):""});return n(fe,{id:Se(E),value:Se(E),accessibilityLabel:R(E),children:n(cn,{id:Se(E),isVaultedCard:!0,brand:E.brand,displayLastDigits:E.displayLastDigits,displayCardholderName:E.cardholderName||void 0,displayAddress:E.billingAddress.address1,requiresVerification:p&&E?.requiresCvvConfirmation,onEdit:u?ee:void 0,onDelete:u&&E.deletable?oe:void 0})},Se(E))}),(M||u)&&n(W,{children:[n(Zd,{setSelected:a,paymentToDelete:D,onClose:Z}),g&&n(Ud,{open:f,onCancel:ne,onSave:Q,card:ie,billingAddress:g.billingAddress,isDefaultCard:I,onDefaultCardChange:L,error:C,addressErrorsSignal:x})]}),te&&n(Gd,{})]})}function Is({numExpired:e}){const{i18n:t}=S();return n(de,{type:"small",color:"subdued",children:t.translate("payment.expired_cards_info",{count:e})})}function Qd({savedCreditCards:e,selected:t,setSelected:a,isSelected:s,isModalOpen:r,onModalClose:i}){const{i18n:o}=S(),l=Ui(),[c,d]=X(t);F(()=>{d(t)},[t]);const u=()=>{i(),c&&a(c)},p="@media (inline-size >= small) fit-content, fill",m=n(Ze,{variant:"primary",inlineSize:p,onClick:u,children:o.translate("payment.saved_credit_cards_modal.done")}),_=n(Ze,{variant:"plain",inlineSize:p,onClick:i,children:o.translate("payment.saved_credit_cards_modal.cancel")});return n(qa,{open:r,heading:o.translate("payment.saved_credit_cards_modal.view_all_label"),onHide:i,primaryAction:m,secondaryActions:_,children:n(N,{gap:"small-300",children:[n(Ms,{savedCreditCards:e,selected:c,setSelected:h=>d(h),isSelected:s,isInModal:!0}),n(Ee,{blockSize:"small-500"}),n(be,{when:l,children:h=>n(Is,{numExpired:h})})]})})}function ec({offsite:e=!1,paymentMethod:t,setSelected:a,isSelected:s,showExistingCreditCards:r=!0,setSelectedSavedCreditCardBrand:i,cardNumberAccessory:o}){const{i18n:l,checkout:{identity:c},userEvents:d,shop:{id:u},source:{checkoutSessionIdentifier:p}}=S(),m=Pn(t),{paymentMethods:_}=pe(),h=r?sc({identity:c},_.value):[],v=h.length>0,g=Ut(),[y,f]=X(h),b=y?.length>4,[P,C]=X(!1),A=()=>C(!1),I=Mr().value,L=I.length,x=L>0,{paymentLines:D}=se(),T=D.value,M=v?tc(T,y):ke,B=M===ke,w=J=>{a(J),f(Q=>ac(J,Q))},O=Rn(),R=r?O.value:void 0,H=Ht().value,G=_e(!1),{resetTouched:U}=ge(),te=as(),$=()=>{te(),U()},Y=J=>{a(J),$()},Z=(J,Q)=>{const ne=E=>E.expired?{isHidden:!0,hiddenReason:"expired"}:Q>=4?{isHidden:!0,hiddenReason:"pagination"}:{isHidden:!1,hiddenReason:""},{isHidden:ce,hiddenReason:ie}=ne(J);d.monorailEvent({schemaId:"checkout_vaulted_payment_method_rendered/1.0",payload:{shopId:parseInt(nn(u),10),checkoutSessionIdentifier:p||"",paymentMethodId:parseInt(nn(J.id),10),paymentInstrumentAccessorId:-1,isSelectedByDefault:M===Se(J),order:Q,cvvRequired:J.requiresCvvConfirmation||!1,isHidden:ce,hiddenReason:ie}})};return F(()=>{R?i(R.brand):!g.value&&!v&&i(void 0)},[i,R,g.value,v]),F(()=>
2{f(h),[...h,...I].forEach(Z)},[JSON.stringify(h)]),n(N,{gap:"base",children:[v&&n(W,{children:[n(Ms,{savedCreditCards:nc(y),selected:M,setSelected:Y,isSelected:s,setSelectedSavedCreditCardBrand:i,addCardModalOpen:G,msiAvailable:m}),m&&(!B||g.value?.creditCardFirstDigits)&&n(es,{paymentMethod:t,isSelected:s,canEditBin:!1}),n(N,{gap:"base",alignItems:"start",children:[b&&n(W,{children:[n(Re,{onClick:()=>C(!0),children:n(N,{direction:"inline",gap:"small-200",alignItems:"center",children:[n(ve,{type:"arrow-up-right",size:"small"}),l.translate("payment.saved_credit_cards_modal.view_all_label")]})}),n(Qd,{savedCreditCards:y,selected:M,setSelected:w,isSelected:s,isModalOpen:P,onModalClose:A})]}),H?n(Vd,{paymentMethod:t,addCardModalOpen:G}):n(ht,{id:"selectDirectPaymentMethod",name:"selectDirectPaymentMethod",checked:B,onChange:J=>{$(),a(J?ke:Se(y[0]))},label:l.translate("payment.use_different_credit_card_label")})]})]}),H&&v?null:n(Rt,{id:"directPaymentMethodDetails",open:B,children:n(Es,{offsite:e,paymentMethod:t,sessionCard:R,isSelected:s,cardNumberAccessory:o},M)}),x&&!b&&n(Is,{numExpired:L})]})}function tc(e,t){const a=t.find(r=>r.defaultPaymentMethod),s=e.find(r=>[Me.CreditCard,"direct"].includes(r.method.type))?.method;return s?s.type===Me.CreditCard?Se(s):s.type:Se(a||t[0])}function nc(e){return e.slice(0,4)}function ac(e,t){const[a,s]=e.split("-");let r;const i=t.filter(o=>(o.token===s&&(r=o),o.token!==s));return[r,...i]}function sc({identity:e},t){return e.current.value==="shopPay"?[]:fn(t)}const rc="YuaRt",ic="BqUj3",ya={EndIcons:rc,EndIconsContent:ic};function zn({setSelected:e,isSelected:t,paymentMethod:a,bare:s,iconPlacement:r="end",showExistingCreditCards:i=!0,disabled:o,details:l,selectedContentFooter:c}){const{i18n:d,checkout:u}=S(),{identity:p}=u,{bankIdNumber:m,filled:_,touched:h}=ge(),{setSelectedSavedCreditCardBrand:v}=ft(),{bankIdNumberSignal:g,directPaymentFieldsFilled:y}=Ne(),{variant:f}=vn(),{paymentLines:b}=se(),C=Pn(a)&&b.value.length>0&&b.value.every(J=>J.method.type===Me.CreditCard);F(()=>{C||(m||h.number)&&(g.value=m)},[m,g,h.number,C]),F(()=>{const J=(a.checkoutHostedFields??Cl).filter(bl);return y.value=J.every(Q=>_[Q]),()=>{y.value=!1}},[y,_,a.checkoutHostedFields]);const A=u.installments.paymentMethodMustSupportDebitCardOnly.value,I=r==="cardNumber",L=r==="inline",x=r==="end",D=s===!0&&I,T=f!==Ir.Control,{ref:M,overflowIndicatorRef:B,maxVisibleBrands:w}=No(a.paymentBrands.filter(Dt).length),O=n(wo,{animate:T,announceNetworkSelector:x,announceOverflowBrands:D,size:I||L?"small":void 0,maxVisibleBrands:x?w.value:void 0,overflowIndicatorRef:x?B:void 0}),R=n(W,{children:[n(oc,{isSelected:t,customHostedFields:a.checkoutHostedFields}),n(ec,{offsite:!1,paymentMethod:a,setSelected:e,isSelected:t,showExistingCreditCards:i,setSelectedSavedCreditCardBrand:v,cardNumberAccessory:I?O:void 0})]}),H=c?n(N,{gap:"base",children:[R,c]}):R;if(s)return H;const G=lc({identity:p,i18n:d},A,a),U=Bt(d,a.paymentBrands,void 0,x?w.value:void 0),te=U?`${G}, ${U}`:G,$=n(tt,{type:"generic",accessibilityVisibility:"hidden"}),Z={end:n("div",{ref:M,className:ya.EndIcons,children:n(N,{direction:"inline",gap:"none",alignItems:"center",justifyContent:"end",className:ya.EndIconsContent,children:O})}),cardNumber:$,inline:void 0}[r];return n(W,{children:n(fe,{value:ae(a),disabled:o,details:l,secondaryContent:Z,renderSelectedContentWhenCollapsed:!0,selectedContent:H,accessibilityLabel:te,children:L?n(N,{direction:"inline",gap:"small-200",alignItems:"center",children:[n(V,{type:"strong",children:G}),O]}):n(V,{type:"strong",children:G})})})}function oc({isSelected:e,customHostedFields:t}){return Pl(e,t),null}function lc({identity:e,i18n:t},a,s){return La({identitySource:e.current.value,i18n:t},s,{forceDebitCardLabel:a})}function dc({method:e,onSelect:t,vaultHandle:a,blockFooter:s,selectedContentFooter:r}){const i=Fn(),o=On(),l=ae(e);return n(N,{gap:"base",children:[n(ut,{publishesCardNetworkDetection:!0,directPaymentMethodConfig:e,blurValidationEnabled:!0,blurValidationFieldDenylist:o.value,onSetFieldErrors:i,children:[n(Vn,{handle:a}),n(zn,{id:l,paymentMethod:e,setSelected:t,isSelected:!0,bare:!0,selectedContentFooter:r})]}),s]})}function cc({inlinePaymentMethod:e=!1}){const{i18n:t}=S(),a=gi({clearPii:!1});return n(le,{padding:e?"none":"base",children:n(We,{onClick:a,inlineSize:"100%",children:n(N,{direction:"inline",gap:"small-200",alignItems:"center",children:[n(V,{tone:"accent",children:t.translate("credit_card_form.more_payment_options")}),n(ve,{type:"arrow-up-right",size:"small",tone:"accent"})]})})})}function uc({identity:e,guestCheckoutPaymentMethodCount:t,inlinePaymentMethod:a=!1}){return e.current.value!=="shopPay"||t===0?null:n(cc,{inlinePaymentMethod:a})}
2function mc({id:e,displayName:t}){const{i18n:a}=S(),s=t??a.translate("payment_gateway.deferred_payment_label");return n(fe,{value:e,accessibilityLabel:s,children:n(V,{type:"strong",children:s})})}const pc=["BANCONTACT","IDEAL"];function Ls(e){return pc.includes(e)}function yc({name:e}){return Ls(e)?null:n(dn,{paymentBrands:[e]})}function fc({name:e,displayName:t}){return n(W,{children:Ls(e)?n(tt,{type:e}):n(V,{type:"strong",children:t})})}function hc({name:e,displayName:t}){return n(fe,{value:e,secondaryContent:n(yc,{name:e}),accessibilityLabel:t,children:n(fc,{name:e,displayName:t})})}function gc({manualPaymentMethod:e}){const t=pe().alternativePaymentCurrency,a=Nt("alternativePaymentCurrency"),{i18n:s}=S(),r=ue(()=>{if(!a.value)return t.value});return n(N,{gap:"base",children:n(Sn,{children:n(be,{when:r,fallback:n(Ka,{inlineSize:"base"}),children:i=>{const o={amount_due:n(V,{type:"strong",children:s.formatCurrency(i.totalWithoutGiftCards.amount,{currency:i.totalWithoutGiftCards.currencyCode,form:"explicit"})})};return e?s.translate("payment.alternative_payment_currency_total_manual_payment_notice",o):s.translate("payment.alternative_payment_currency_total_notice",o)}})})})}function ks({additionalDetails:e,alignItems:t}){const a=pe().alternativePaymentCurrency,{hasNegotiatedAlternativePaymentCurrencySignal:s}=Ne(),r=Fa(),i=ue(()=>r.value&&s.value||!!a.value),o=e?.trim();return!o&&!i.value?null:n(N,{alignItems:t,gap:"large-100",children:[o?n(de,{children:n(Sn,{children:e})}):null,n(be,{when:i,children:n(gc,{manualPaymentMethod:!0})})]})}function _c({id:e,label:t,additionalDetails:a,showSelectedContent:s=!0}){return n(fe,{value:e,selectedContent:s?n(ks,{additionalDetails:a}):void 0,accessibilityLabel:t,children:n(V,{type:"strong",children:t})})}function vc({id:e,additionalDetails:t,name:a,showSelectedContent:s=!0}){const r=En();return n(fe,{value:e,selectedContent:s?n(ks,{additionalDetails:t,alignItems:r?void 0:"center"}):void 0,accessibilityLabel:a,children:n(V,{type:"strong",children:a})})}function bc({bare:e}){return e?null:n(fe,{value:"PAYPAL_EXPRESS"})}const Hn=wt({displayName:"PayPalExpressPaymentMethod",load:()=>Tt(()=>yt(()=>import("./component-PayPalExpressPaymentMethod.AFxZv95U.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62]))),renderLoading:bc});function Cc(){const{i18n:e}=S(),t=e.translate("brand.apple_pay");return n(fe,{value:"APPLE_PAY",secondaryContent:n(Tn,{wallet:"APPLE_PAY",size:"xxxsmall"}),accessibilityLabel:t,children:n(V,{type:"strong",children:t})})}function Sc(){const{checkout:e,router:t}=S(),{validation:{contactErrors:{emailInputError:a,phoneInputError:s}}}=e,{origin:r,prefix:i,searchParams:o}=t.currentUrl.value,{deliveryMethodsAddressErrors:l}=Ne(),{nextPage:c}=_i(),{resetAddressErrors:d}=vi(l),u=bi().current.token,p=e.configuration.renderContextToken.token.value;et(async({parts:m,reason:_})=>{if(_==="completion"||_==="progression"&&c.id==="review"){const v=m.paymentLines.peek()[0]?.method,g=o.get("channel");if(v?.type==="wallet"&&v.name==="SHOPIFY_INSTALLMENTS"){const f=new URLSearchParams;f.set("payment","shop_pay"),f.set(Lr,kr.ShopPayInstallmentsAsPaymentMethod),u&&f.set(wr,u),g&&f.set("channel",g),p?f.set("rctx",p):f.delete("rctx");const b=`${r}${i}?${f.toString()}`;return{behavior:"block",reason:Te.RedirectingToShopPay,perform(){a.value=void 0,s.value=void 0,d(),window.location.assign(b)}}}}return{behavior:"allow"}})}const Pc="•";function fa({label:e,installmentsLabel:t,installments:a}){return Sc(),n(fe,{value:"SHOPIFY_INSTALLMENTS",secondaryContent:n(Tn,{wallet:"SHOP_PAY",size:"xxxsmall"}),accessibilityLabel:e,children:n(N,{direction:"@media (inline-size >= extraSmall) inline, block",gap:"small-400",children:[n(V,{type:"strong",children:e}),a&&n(W,{children:[n(le,{display:"@media (inline-size >= extraSmall) auto, none",children:n(V,{color:"subdued",children:Pc})}),n(V,{color:"subdued",children:t})]})]})})}function ws({method:e,showSelectedContent:t=!0,bare:a=!1}){const{i18n:s}=S();switch(e.name){case"PAYPAL_EXPRESS":return n(Hn,{method:e,showSelectedContent:t,bare:a});case"APPLE_PAY":return a?null:n(Cc,{});case"SHOPIFY_INSTALLMENTS":{if(a)return null;const r=s.translate("payment_gateway.shop_pay.name"),i=s.translate("payment_gateway.shop_pay.installments_label");return n(fa,{label:r,installmentsLabel:i,installments:!0})}case"SHOP_PAY":{if(a)return null;const r=s.translate("payment_gateway.shop_pay.name");return n(fa,{label:r})}case"GOOGLE_PAY":return null;case"VENMO":return null;default:pt(e)}}const Ac="H3Xuw",Ec="ldo89",ha={Content:Ac,Redesigned:Ec};function Mc({children:e}){const t=En();return n("div",{className:we(ha.Content,t&&ha.Redesigned),children:e})}function Ic({label:e,bare:t=!1}){const{descriptor:a,brand:s}=$i().value,r=En()||t,i=n(Mc,{children:n(N,{gap:"base",alignItems:r?"start":"center",children:n(N,{direction:"inline",gap:"base",children:[n(Gi,{brand:s,descriptor:a}),n(Wi,{})]})})});return t?n(W,{children:[n(ta,{isSdkOnly:!0}),i]}):n(W,{children:[n(ta,{isSdkOnly:!0}),n(fe,{value:dt.AmazonPay,selectedContent:i,secondaryContent:n(le,{blockAlignment:"center",children:n(Tn,{wallet:dt.AmazonPay,size:"small"})}),accessibilityLabel:e,children:n(V,{type:"strong",children:e})})]})}function Ts({method:e,bare:t=!1}){const{i18n:a,checkout:s}=S(),r=s.configuration.layout.isOnePage.value;switch(e.name){case dt.AmazonPay:{const i=a.translate("brand.amazon_pay");return r?null:n(Ic,{label:i,bare:t})}case dt.BuyWithPrime:return null;default:return pt(e.name)}
2}const Lc={PAYPAL_EXPRESS:"paypal",APPLE_PAY:"apple_pay",GOOGLE_PAY:"google_pay",SHOP_PAY:"shop_pay",amazon_pay:"amazon_pay"};function Cm(e){if("paymentBrands"in e&&Array.isArray(e.paymentBrands))return e.paymentBrands;if("name"in e&&e.name){const t=Lc[e.name];return t?[t]:[]}return[]}function Un(e){return"name"in e?e.name:e.type}function Ns(e,t){return!e||!t||e.length!==t.length?!1:e===t?!0:t.every((a,s)=>kc(a,e[s]))}function kc(e,t){return e===t?!0:!e||!t?!1:Ea(ga(e),ga(t))}function ga(e){const t=Un(e),{type:a,orderingIndex:s}=e;return{type:a,name:t,orderingIndex:s}}function wc({identity:e,methodCount:t}){return t!==1?!1:e.current.value==="shopPay"?wi:!0}function $n({value:e,label:t,accessibilityLabel:a=t,showIconPlaceholder:s=!1}){const{i18n:r}=S();return n(fe,{value:e,accessibilityLabel:a,secondaryContent:n(W,{children:[s?n(ja,{inlineSize:Mt(Lt.base.inlineSize),blockSize:Mt(Lt.base.blockSize),contentDisplay:"block"}):null,n(V,{accessibilityVisibility:"exclusive",children:r.translate("general.loading")})]}),children:n(V,{type:"strong",children:t})})}function Tc({id:e,method:t}){const{i18n:a}=S();return n($n,{value:e,label:t.displayName??a.translate("payment.bank_payment_method_label"),showIconPlaceholder:!0})}const Ds=wt({displayName:"BankPaymentMethod",useError:Mn("BankPaymentMethod"),load:()=>Tt(async()=>({default:(await yt(async()=>{const{BankPaymentMethod:e}=await import("./component-lazyBankPaymentMethod.DRDx6Xmg.js");return{BankPaymentMethod:e}},__vite__mapDeps([63,1,2,3,4,5,6,7,8,9,10,11,12,13,14,23,24,25,26,64,65,22,66,31,39,40,41,42,43,44,45,46,47,48,49,50,51,52,21,27,15,16,17,28,29,30,32,33,34,35,36,37,53,54,55,19,20,56,57,58,59,60,61,38,62,67]))).BankPaymentMethod})),renderLoading:({id:e,method:t,bare:a})=>a?null:n(Tc,{id:e,method:t})});function Nc({id:e,method:t,bare:a}){const{i18n:s}=S();if(!An("Checkout::PaymentMethod::Render",t.uiExtension===void 0?[]:[t.uiExtension]).length||a)return null;const i=Bt(s,t.paymentBrands),o=i?`${t.name}, ${i}`:t.name;return n($n,{value:e,label:t.name,accessibilityLabel:o,showIconPlaceholder:!0})}const Bs=wt({displayName:"CustomOnsitePaymentMethod",useError:Mn("CustomOnsitePaymentMethod"),load:()=>Tt(async()=>({default:(await yt(async()=>{const{CustomOnsitePaymentMethod:e}=await import("./component-lazyPaymentMethods.BiEwX9TN.js");return{CustomOnsitePaymentMethod:e}},__vite__mapDeps([68,1,3,4,5,6,7,8,9,10,11,2,12,13,14,53,54,21,22,23,24,25,26,27,15,16,17,28,29,30,31,32,33,34,35,36,37,19,20,39,40,41,42,43,44,45,46,47,48,49,50,51,52,55,56,57,58,59,60,61,38,62,69]))).CustomOnsitePaymentMethod})),renderLoading:e=>n(Nc,{...e})});function Dc({name:e,paymentBrands:t}){const{i18n:a}=S(),s=Bt(a,t),r=s?`${e}, ${s}`:e;return n($n,{value:e,label:e,accessibilityLabel:r,showIconPlaceholder:!0})}const Fs=wt({displayName:"OffsitePaymentMethod",useError:Mn("OffsitePaymentMethod"),load:()=>Tt(async()=>({default:(await yt(async()=>{const{OffsitePaymentMethod:e}=await import("./component-lazyPaymentMethods.BiEwX9TN.js");return{OffsitePaymentMethod:e}},__vite__mapDeps([68,1,3,4,5,6,7,8,9,10,11,2,12,13,14,53,54,21,22,23,24,25,26,27,15,16,17,28,29,30,31,32,33,34,35,36,37,19,20,39,40,41,42,43,44,45,46,47,48,49,50,51,52,55,56,57,58,59,60,61,38,62,69]))).OffsitePaymentMethod})),renderLoading:({name:e,paymentBrands:t,bare:a})=>a?null:n(Dc,{name:e,paymentBrands:t})}),xs={offsite:Fs,customOnsite:Bs,bank:Ds};function Rs(){const e=Fs.useLoadState(),t=Bs.useLoadState(),a=Ds.useLoadState();return k(s=>{switch(s.type){case"offsite":return e;case"customOnsite":return t;case"bank":return a;default:return}},[e,t,a])}const{offsite:Bc,customOnsite:Fc,bank:xc}=xs;function Rc({methods:e,selected:t,onSelect:a,renderAsBareCard:s,vaultHandle:r,blockFooter:i,choiceListName:o="basic",showSelectedContent:l=!0,showExistingCreditCards:c=!0,radioControlMethodCount:d,directMethodDisabled:u=!1,directMethodDetails:p,directMethodSelectedContentFooter:m}){const _=Fn(),{checkout:{identity:h}}=S(),v=On(),g=j(()=>t?[t]:[],[t]),y=k(([f])=>{f&&a(f)},[a]);return n(zt,{name:o,values:g,hideRadioControl:wc({identity:h,methodCount:d??e.length}),onChange:y,variant:s?"list":"block",blockFooter:i,children:e.map(f=>{const b=ae(f),P=t===b;return f.type==="direct"?n(ut,{publishesCardNetworkDetection:!0,directPaymentMethodConfig:f,blurValidationEnabled:!0,blurValidationFieldDenylist:v.value,onSetFieldErrors:_,children:[P&&n(Vn,{handle:r}),n(zn,{id:b,paymentMethod:f,setSelected:a,isSelected:P,bare:s,showExistingCreditCards:c,disabled:u,details:p,selectedContentFooter:P?m:void 0})]},b):f.type==="wallet"?n(ut,{blurValidationFieldDenylist:v.value,onSetFieldErrors:_,children:n(ws,{method:f,showSelectedContent:l})},b):f.type==="walletsPlatform"?n(Ts,{method:f},b):f.type===Me.PayPal?n(Hn,{method:f,showSelectedContent:l},b):f.type==="local"?n(hc,{name:f.name,displayName:f.displayName},b):f.type==="paymentOnDelivery"?n(vc,{id:f.type,additionalDetails:f.additionalDetails,name:f.name,showSelectedContent:l},b):f.type==="manualPayment"||f.type==="customManualPayment"?n(_c,{id:`${f.type}-${f.id}`,label:f.name,additionalDetails:f.additionalDetails,showSelectedContent:l},b):f.type==="offsite"?n(Bc,{name:f.name,paymentBrands:f.paymentBrands,showRedirectionNotice:f.showRedirectionNotice,showSelectedContent:l},b):f.type==="deferred"?n(mc,{id:f.type,displayName:f.displayName},b):f.type==="customOnsite"?n(Fc,{id:f.name,selected:l&&P,method:f,showSelectedContent:l},b):f.type==="bank"?n(xc,{id:b,method:f,setSelected:a,showSelectedContent:l},b):null})})}function Oc(){const{i18n:e}=S();return n(In,{tone:"warning",children:e.translate("payment_errors.test_mode_enabled_only_test_cards")})}function Vc(){const{client:e}=S();return e.unstable_getSerialization("invoiceLoginType")}function Os(){const[e,t]=X(!0),a=Vc(),s=pe().buyerIdentity.value?.purchasingCompany,{client:r,i18n:i}=S();function o(){t(!1)}const l=(()=>{const d=r.unstable_getSerialization("loginUrl")||"";switch(a){case Ci:return i.translate("payment_gateway.login_prompt.no_access.message",{logIn:n(Re,{tone:"monochrome",href:d,children:i.translate("payment_gateway.login_prompt.no_access.link")})});case Zn:case void 0:return null}return null})();return e&&a&&s&&l?n(In,{onDismiss:o,tone:a===Zn?"success":"info",children:l}):null}Os.displayName="OrderInvoiceLoginBanner";function zc({selectedPaymentMethod:e}){const{i18n:t}=S(),a=Si(),s=Aa(e),r=ka(),i=pe(),o=Nt("paymentFlexibilityPaymentTermsTemplate"),l=$a(),c=t.numberFormatter({style:"percent",minimumFractionDigits:0,maximumFractionDigits:2}),d=ue(()=>{const u=i.paymentFlexibilityPaymentTermsTemplate.value,p=i.depositConfiguration.value,m=s.value==="deferred",_=s.value==="creditCards",h=u?.type==="FIXED",v=u?.type==="FULFILLMENT",g=u?.type==="RECEIPT",y=p?.percentage?c.format(p?.percentage/100):null;if(r.value)return h?t.translate("payment_gateway.draft_order_payment_due_later_terms",{translatedName:u.translatedName.toLocaleLowerCase()}):v?y?t.translate("payment_gateway.draft_order_deposit_due_on_fulfillment",{depositAmount:y}):t.translate("payment_gateway.draft_order_payment_due_on_fulfillment"):u==null?m?t.translate("payment_gateway.draft_order_payment_due_later_no_terms"):t.translate("payment_gateway.draft_order_payment_due_later_no_terms_payment_selected"):y?t.translate("payment_gateway.draft_order_deposit_due_later",{depositAmount:y,translatedName:u.translatedName}):t.translate("payment_gateway.draft_order_payment_due_later_terms",{translatedName:u.translatedName});if(u==null||l.value)return;if(v){if(y)return t.translate("payment_gateway.order_deposit_due_on_fulfillment",{depositAmount:y});if(_)return t.translate("payment_gateway.order_due_on_fulfillment_payment");
2if(m)return t.translate("payment_gateway.order_due_on_fulfillment_choose_later")}if(g)return y?t.translate("payment_gateway.order_deposit_due_on_receipt",{depositAmount:y}):t.translate("payment_gateway.order_due_on_receipt_choose_later");if(!u.dueDate)return;const f={translatedName:u.translatedName,dueDate:a(u.dueDate)};return _&&!y?h?t.translate("payment_gateway.fixed_direct_payment_terms",{dueDate:f.dueDate}):t.translate("payment_gateway.direct_payment_terms",f):h?y?t.translate("payment_gateway.order_deposit_due_on_fixed_date",{depositAmount:y,dueDate:f.dueDate}):t.translate("payment_gateway.fixed_payment_label",{dueDate:f.dueDate}):y?t.translate("payment_gateway.order_deposit_due_now",{depositAmount:y,...f}):t.translate("payment_gateway.generic_payment_terms",f)});return n(be,{when:d,children:n(In,{tone:"info",children:n(be,{when:()=>!o.value,fallback:n(Ka,{inlineSize:"large"}),children:d})})})}function Hc(){const{paymentErrors:e}=Xa().value,t=n(Pi,{errors:e,errorType:Oe.PaymentError});return e.length>0&&t}function Uc({selectedPaymentMethod:e}){const{shopPay:t,source:a}=S(),s=t.user.hasFlag(lo);return n(W,{children:[n(Hc,{}),Ai(a.type)&&n(Os,{}),s&&n(Oc,{}),n(zc,{selectedPaymentMethod:e})]})}const{inlineSize:$c,blockSize:Gc}=Lt.base;function Wc(e,t){if(e)return n(ja,{inlineSize:Mt($c),blockSize:Mt(Gc),contentDisplay:"block"});if(t)return n(tt,{type:t})}function Yc({identity:e}){return e.current.value}function qc({methods:e,selected:t,onSelect:a,selectorShowsTiles:s,tileSupportedCustomOnsitePaymentMethods:r}){mn(()=>{if(s)return s.value=!0,()=>{s.value=!1}},[s]);const{i18n:i,checkout:o}=S(),l=o.configuration.layout.isOnePage.value,c=Rs(),d=Ha(),u=Ua(d),p=o.installments.paymentMethodMustSupportDebitCardOnly.value,m=j(()=>t?[t]:[],[t]),_=k(([h])=>{h&&a(h)},[a]);return n(zt,{name:"payment-tiles",label:i.translate("payment.payment_method"),labelAccessibilityVisibility:"exclusive",variant:"grid-compact",values:m,onChange:_,children:e.flatMap(h=>{const v=ae(h),g=ms(h,{i18n:i,identitySource:Yc({identity:o.identity}),isOnePageCheckout:l,isVenmoCheckout:u,forceDebitCardLabel:p,tileSupportedCustomOnsitePaymentMethods:r});if(!g)return[];const y=c(h)==="loading",f=y?i.translate("general.loading"):void 0,b=g.accessibilityLabel&&f?`${g.accessibilityLabel}, ${f}`:g.accessibilityLabel;return n(fe,{value:v,icon:Wc(y,g.iconBrand),accessibilityLabel:b,children:[n(V,{type:"strong",children:g.label}),f&&!b?n(V,{accessibilityVisibility:"exclusive",children:f}):null]},v)})})}const _a={loaded:!1},Sm={start:"payment-transition-extensions-enter-start",end:"payment-transition-extensions-enter-end"},Pm="payment-transition-extensions-clip";function Kc(){return Zs(async()=>{typeof window>"u"||(await yt(()=>Promise.resolve({}),__vite__mapDeps([70])),_a.loaded=!0)}),_a}const jc="Yqd2o",Xc="_9Jwvk",Jc={PaymentSelector:jc,PaymentDetails:Xc};function va({children:e,variant:t}){return Kc(),n("div",{className:`${Jc[Pa("Payment",t)]} payment-transition-${t}`,children:e})}const Zc="fMWDI",Qc="_6d3Zy",ba={HideOnEmpty:Zc,RenderedButHidden:Qc},{offsite:eu,bank:tu,customOnsite:nu}=xs;function au({methods:e,selected:t,onSelect:a,vaultHandle:s,directMethodSelectedContentFooter:r}){return n(W,{children:e.map(i=>{const o=ae(i),l=o===t,c=!l&&i.type==="direct";return n("div",{className:we(ba.HideOnEmpty,c&&ba.RenderedButHidden),hidden:!l&&!c,"data-collapsed":!l,"aria-hidden":c||void 0,children:n(le,{paddingBlockEnd:"large-100",children:n(su,{method:i,isSelected:l,onSelect:a,vaultHandle:s,directMethodSelectedContentFooter:r})})},o)})})}function su({method:e,isSelected:t,onSelect:a,vaultHandle:s,directMethodSelectedContentFooter:r}){const i=Fn(),o=On(),l=ae(e);switch(e.type){case"direct":return n(ut,{publishesCardNetworkDetection:!0,directPaymentMethodConfig:e,blurValidationEnabled:!0,blurValidationFieldDenylist:o.value,onSetFieldErrors:i,children:[t&&n(Vn,{handle:s}),n(zn,{id:l,paymentMethod:e,setSelected:a,isSelected:t,bare:!0,selectedContentFooter:t?r:void 0,iconPlacement:"cardNumber"})]});case"offsite":return n(eu,{name:e.name,paymentBrands:e.paymentBrands,showRedirectionNotice:e.showRedirectionNotice,bare:!0});case"bank":return n(tu,{id:l,method:e,setSelected:a,bare:!0});case"customOnsite":return n(nu,{id:l,method:e,selected:t,bare:!0});case"wallet":return e.name!=="PAYPAL_EXPRESS"?null:n(ut,{blurValidationFieldDenylist:o.value,onSetFieldErrors:i,children:n(ws,{method:e,bare:!0})});case"walletsPlatform":return n(Ts,{method:e,bare:!0});case Me.PayPal:return n(Hn,{method:e,bare:!0});default:return null}}function ru({availablePaymentMethods:e,previousAvailablePaymentMethods:t,i
2dentity:a,shopPay:s,isApplePayAvailable:r}){if(a.current.value!=="shopPay")return;const i=e.map(c=>ae(c)),o=t?.map(c=>ae(c));if(i.every(c=>o?.includes(c)))return;const l=s.user.paymentMethodHistory.value;if(l.length!==0)for(const c of l){if(!c.lastUsedAt)continue;const d=e.find(u=>!!(r&&c.paymentMethod==="APPLE_PAY"&&an(u)||u.type==="customOnsite"&&c.paymentMethod==="CUSTOM_ONSITE"&&"paymentBrand"in c&&(u.paymentBrands?.map(m=>m.toLowerCase())??[]).includes(c.paymentBrand.toLowerCase())));if(d)return ae(d)}}function iu(e,t){const a=e.map(r=>ae(r)),s=t?.map(r=>ae(r));return!a.every(r=>s?.includes(r))}const ou=new Set(["direct","offsite","customOnsite","manualPayment","customManualPayment","paymentOnDelivery","local","wallet","walletsPlatform","deferred","bank"]);function lu(e){return ou.has(e)}function du(e){const t=new URLSearchParams(e),a=t.get(Tr);if(!a||!lu(a))return;const s=t.get(Nr);return{paymentMethod:a,paymentMethodIdentifier:s||void 0}}function cu(e,t){if(t.paymentMethodIdentifier){const s=e.find(r=>r.type===t.paymentMethod&&"paymentMethodIdentifier"in r&&r.paymentMethodIdentifier===t.paymentMethodIdentifier);if(s)return s}return e.find(s=>s.type===t.paymentMethod)}function uu({identity:e}){switch(e.current.value){case"guest":return"guest_checkout";case"shopPay":return"shop_pay_payment_options";default:return e.current.value}}function Vs(e){return e.type===Me.CreditCard?Se(e):ae(e)}function mu(e,t,a,s,r,i,o,l,c){i.forEach((d,u)=>{const p=Vs(d),m=!l&&p===r,_=l&&p===r;e.monorailEvent({schemaId:"checkout_payment_method_rendered/1.1",payload:{shopId:parseInt(nn(t),10),checkoutSessionIdentifier:o||"",paymentMethodIdentifier:"paymentMethodIdentifier"in d?d.paymentMethodIdentifier:void 0,buyerCountryCode:c,eventTriggerReason:s,iterationNumber:a,orderInTheList:u,displayName:Un(d)||"",isAutoSelected:m,isBuyerSelected:_,isOrderedFirst:u===0,isOrderedLast:u===i.length-1}})})}function zs(e){return"displayName"in e&&e.displayName?e.displayName:"name"in e&&e.name?e.name:e.type}function pu({availableMethods:e,seen:t,userEvents:a,source:s,checkout:r,shop:i}){r.identity.current.value==="shopPay"&&e?.forEach(o=>{const l=ae(o);t.has(l)||(t.add(l),a.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...yn(s,r,i),action:"payment_method_rendered",paymentMethodName:zs(o)}}))})}function yu(){const{userEvents:e,shop:t,source:a}=S(),{buyerIdentity:s,shippingAddress:r}=pe(),{id:i}=t,{checkoutSessionIdentifier:o}=a,l=r.value?.countryCode||s.value?.countryCode,c=z(0),d=z(""),u=z([]),p=z(!1);return k(({displayedPaymentMethods:m,selectedPaymentMethod:_,buyerHasActed:h})=>{const v=_?Vs(_):"",g=!Ns(u.current,m);g&&c.current++;let y;!p.current&&m.length>0?(y="initialRender",p.current=!0):g?y="paymentMethodsChanged":d.current!==v&&(y=h?"buyerSelectedPaymentMethod":"autoSelectedPaymentMethod"),y&&mu(e,i,c.current,y,v,m,o,h,l),u.current=m,d.current=v},[l,o,e,i])}function fu({displayedPaymentMethods:e,selectedPaymentMethod:t,buyerHasActed:a}){const s=yu();F(()=>{s({displayedPaymentMethods:e,selectedPaymentMethod:t,buyerHasActed:a})},[a,e,s,t])}function hu({displayedPaymentMethods:e,selected:t,setSelected:a,buyerHasActed:s}){const{shop:r,shopPay:i,userEvents:o,source:l,checkout:c,router:d}=S(),u=d.currentUrl.value,{paymentMethodAutoSelectionDisabled:p}=r,m=ss(),_=Fa(),h=!!Dr(c.proposal.proposed.paymentLines.value),v=e.find(C=>ae(C)===t);fu({displayedPaymentMethods:e,selectedPaymentMethod:v,buyerHasActed:s});const g=z([]),y=z(),f=z(new Set),b=z(du(u.search)),P=z(!1);F(()=>{pu({availableMethods:e,seen:f.current,userEvents:o,source:l,checkout:c,shop:r})},[e,o,l,c,r]),F(()=>{const[C]=e;!h&&c.identity.current.value==="shopPay"&&t==="SHOP_PAY"&&C!==void 0&&a(ae(C))},[t,a,e,c.identity,h]),F(()=>{if(h){g.current=e,y.current=e;return}const[C]=e,A=!Ns(g.current,e);if(!p&&C!==void 0){const I=!s&&!P.current&&b.current?cu(e,b.current):void 0;if(I){const L=ae(I);P.current=!0,t!==L&&a(L,void 0,{rebuild:!0})}else if(b.current&&!P.current&&_.value&&(P.current=!0),i.user.paymentMethodHistory.value.length>0&&iu(e,y.current)){const D=ru({availablePaymentMethods:e,previousAvailablePaymentMethods:y.current,identity:c.identity,shopPay:i,isApplePayAvailable:m.value});y.current=e,D?a(D):A&&!v&&a(ae(C))}else A&&!v&&a(ae(C))}g.current=e},[t,v,a,s,e,i,m.value,p,h,c.identity,i.user.paymentMethodHistory.value,_.value])}function gu(e,t,a){const s=z(t),r=z(null);if(s.current!==t){const i=s.current.some(o=>!t.includes(o));r.current=i?_u(e.current,a):null,s.current=t}mn(()=>{const i=r.current;if(r.current=null,i===null||document.activeElement!==document.body)return;const o=Hs(e.current,a);
2o.length!==0&&o[Math.min(i,o.length-1)]?.focus({preventScroll:!0})},[a,e,t])}function Hs(e,t){return e?[...e.querySelectorAll('input[type="radio"]')].filter(a=>a.name===t):[]}function _u(e,t){const a=document.activeElement;if(!(a instanceof HTMLInputElement))return null;const s=Hs(e,t).indexOf(a);return s===-1?null:s}const vu=new Set(["bank","customOnsite"]);function bu({displayedPaymentMethods:e,selected:t,loadStateForMethod:a}){const{checkout:s,i18n:r,observability:i}=S(),{wallets:o}=s,l=wn();et(({reason:c})=>{if(c!=="progression"&&c!=="completion")return{behavior:"allow"};if(Ki(l.value))return{behavior:"allow"};if(o.activeSession.value!==null)return{behavior:"allow"};const d=e.find(p=>ae(p)===t);if(!d)return{behavior:"allow"};const u=a(d);return u==="failed"?(i.log("lazy_payment_method_submission_blocked",`Blocked ${c}: selected ${d.type} method's chunk failed to load`,{methodType:d.type,loadState:u}),{behavior:"block",reason:Te.PaymentMethodUnavailable,errors:[{message:r.translate("payment.payment_method_unavailable_error"),target:sn}]}):u==="loading"&&vu.has(d.type)?(i.log("lazy_payment_method_submission_blocked",`Blocked ${c}: selected ${d.type} method's chunk is still loading`,{methodType:d.type,loadState:u}),{behavior:"block",reason:Te.PaymentMethodLoading,errors:[{message:r.translate("payment.payment_method_loading_error"),target:sn}]}):{behavior:"allow"}})}function Ca(e){return e==="choiceList"||e==="tiles"}function Cu({containerSize:e,enabled:t,methodCount:a,mode:s}){const{observability:r}=S(),i=z(t&&Ca(s)?{containerSize:e,methodCount:a,mode:s}:void 0);F(()=>{if(!t||!Ca(s)){i.current=void 0;return}const o={containerSize:e,methodCount:a,mode:s},l=i.current;if(i.current=o,!l||l.methodCount!==a||l.mode===s)return;const c=l.containerSize===void 0&&e!==void 0,d=l.containerSize!==void 0&&e!==void 0&&l.containerSize!==e;!c&&!d||r.counter({name:"payment_selector_mode_changed",value:1,attributes:{from_container_size:l.containerSize??"unmeasured",from_mode:l.mode,method_count:a,to_container_size:e,to_mode:s,transition_source:c?"initial_measurement":"resize"}})},[e,t,a,s,r])}const Su=498,Pu=380;function Au(e){return e>=Su?"wide":e>=Pu?"compact":"compact-narrow"}function Eu(e){const t=_e(void 0),a=z(null),s=z(e);s.current=e,F(()=>()=>{a.current?.disconnect(),a.current=null},[]);const r=k(o=>{const l=Au(o),c=t.value;if(c===l)return;const d=()=>{t.value=l};c!==void 0&&(s.current?.(c,l)??!1)?kn(d,["payment-selector-change"]):d()},[t]),i=k(o=>{if(a.current?.disconnect(),a.current=null,t.value=void 0,!o||typeof ResizeObserver>"u")return;const l=new ResizeObserver(([c])=>{c&&r(c.contentRect.width)});l.observe(o),a.current=l},[t,r]);return{containerSize:t,registerContainer:i}}function Mu({displayedPaymentMethods:e,selectedBillingAddress:t,allowPreselect:a=!0}){const{observability:s,userEvents:r,source:i,checkout:o,shop:l}=S(),{buyerHasActedSignal:c}=Ne(),[d,u]=ho({allowPreselect:a,displayedPaymentMethods:e}),{paymentErrors:p}=Xa().value,m=Br(),{updateCheckoutAddress:_}=go(),h=k(async(v,g)=>{c.value=!0,u(v,g,{buyerInitiated:!0});const y=e.find(f=>ae(f)===v);if(y){const f=y.type,b=Un(y)||y.type,P="paymentBrands"in y&&y.paymentBrands?y.paymentBrands.slice().sort().join(","):"";s.counter({name:"payment_method_selected",value:1,attributes:{payment_method_type:f,payment_method_name:b,payment_brands:P,location:uu({identity:o.identity}),is_mobile:Fr()}}),o.identity.current.value==="shopPay"&&(r.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...yn(i,o,l),action:"payment_method_selected",paymentMethodName:zs(y)}}),t&&xr(v.toUpperCase())&&_({billingAddress:t},!0))}p.length>0&&await m.negotiate({silenceViolations:["all"],negotiationStage:"negotiation"})},[c,u,p.length,m,e,s,r,t,_,i,o,l]);return{selected:d,setSelected:u,setSelectedByBuyer:h,buyerHasActed:c.value}}function Iu(e,t){const a=new Set;for(const s of e)s.lastUsedAt&&"id"in s&&a.add(s.id.toLowerCase());for(const s of t)s.lastUsedAt&&(s.paymentBrand!=null&&a.add(s.paymentBrand.toLowerCase()),s.name!=null&&a.add(s.name.toLowerCase()));return a}function Sa(e,t,a){const s=ae(e).toLowerCase(),r="name"in e?e.name.toLowerCase():"";if(a.has(s)||Xn(e)&&a.has("ideal")||an(e)&&a.has("wallet-apple-pay")||e.type==="customOnsite"&&e.paymentBrands.some(i=>a.has(i.toLowerCase())))return!0;for(const i of t){const o=i.id.toLowerCase();if(o===s||o===r||i.name!=null&&i.name.toLowerCase()===s||i.paymentMethod==="IDEAL"&&Xn(e)||i.paymentMethod==="APPLE_PAY"&&an(e))return!0;
2if(e.type==="customOnsite"&&"paymentBrands"in i&&Array.isArray(i.paymentBrands)){const l=e.paymentBrands.map(c=>c.toLowerCase());if(i.paymentBrands.some(c=>l.includes(c.toLowerCase())))return!0}}return!1}function Lu(){const{shopPay:e}=S(),{showGuestCheckoutPaymentMethods:t}=e.visibility,{value:a}=pn({deferClientOnlyWalletsUntilHydrated:!0}),{displayedPaymentMethods:s,renderAsBareCard:r,billingAddressVariant:i,selectedBillingAddress:o}=cs({experienceType:"list"}),l=e.session.promotedPaymentMethods.value,c=j(()=>Iu(e.user.paymentMethods.value??[],e.user.paymentMethodHistory.value??[]),[e.user.paymentMethods.value,e.user.paymentMethodHistory.value]),d=j(()=>s.filter(h=>!Sa(h,l,c)),[s,l,c]),u=j(()=>{if(!t)return[];const h=new Set(d);return(a??[]).filter(v=>!Sa(v,l,c)).filter(v=>!h.has(v)).filter(v=>!Rr(v))},[a,l,c,t,d]),p=j(()=>[...d,...u],[u,d]),m=l.some(h=>h.paymentMethod!=="CREDIT_CARD"),_=r||!!(d.length>0&&u.length===0&&!m&&d.every(h=>h.type==="direct"));return{shopPayPaymentMethods:d,guestCheckoutPaymentMethods:u,combinedPaymentMethods:p,renderAsBareCard:_,billingAddressVariant:i,selectedBillingAddress:o}}function ku(e){const t=j(()=>e.filter(i=>i.type==="customOnsite"),[e]),a=j(()=>t.flatMap(({uiExtension:i})=>i?[i]:[]),[t]),s=An("Checkout::PaymentMethod::Render",a),r=j(()=>s.map(Or),[s]);return j(()=>{const i=r.some(o=>o.type==="local");return new Set(t.flatMap(o=>i||o.uiExtension!==void 0&&r.includes(o.uiExtension)?[o.paymentMethodIdentifier]:[]))},[t,r])}function Am({errorBannerInContext:e,billingAddressInContext:t,vaultHandle:a,selectorShowsTiles:s,afterPaymentSelector:r,experienceType:i="list",renderVaultingAgreementInline:o}){const c=Bo().value,d=wn(),{checkout:u,i18n:p}=S(),m=u.configuration.layout.isOnePage.value,_=u.installments.paymentMethodMustSupportDebitCardOnly.value,{displayedPaymentMethods:h,renderAsBareCard:v,billingAddressVariant:g,selectedBillingAddress:y}=cs({experienceType:i}),f=Di(),{guestCheckoutPaymentMethods:b}=Lu(),P=Rs(),C=j(()=>h.filter(re=>P(re)!=="failed"),[h,P]),{selected:A,setSelected:I,setSelectedByBuyer:L,buyerHasActed:x}=Mu({displayedPaymentMethods:C,selectedBillingAddress:y}),D=Ga().value,T=Ht().value,M=se().paymentLines,w=m&&!o&&D&&M.value.some(re=>re.method.type==="direct")?void 0:"large-100",[O=""]=Vr(M.value);bu({displayedPaymentMethods:h,selected:O,loadStateForMethod:P}),hu({displayedPaymentMethods:C,selected:A,setSelected:I,buyerHasActed:x});const R=z(null),H=j(()=>C.map(ae),[C]);gu(R,H,"basic");const G=_e(null),U=a??G,{showPaymentTiles:te}=vn(),$=ku(C),Y=hs(C,$),{containerSize:Z,registerContainer:J}=Eu((re,Pe)=>Y(re,m,_).mode!==Y(Pe,m,_).mode),Q=k((re,Pe)=>{const Be=C.map(ae),Ve=Be.indexOf(re),Ye=Be.indexOf(A);if(Ve===-1||Ve===Ye){L(re,Pe);return}const ze=Ye===-1||Ve>Ye?"payment-details-slide-end":"payment-details-slide-start";kn(()=>{L(re,Pe)},[ze])},[C,A,L]),ne=j(()=>Y(Z.value,m,_),[Y,Z.value,m,_]);Cu({containerSize:Z.value,enabled:te,methodCount:C.length,mode:ne.mode});const[ce]=C,ie=ne.mode==="singlePaymentMethodCreditCard"&&ce!==void 0&&Ia(ce)?ce:void 0,E=uc({identity:u.identity,guestCheckoutPaymentMethodCount:b.length,inlinePaymentMethod:!!ie})??void 0,ee=o&&!T&&D?n(gs,{borderless:!0}):void 0,oe=j(()=>C.map(re=>"name"in re?re.name:re.type),[C]),me=A==="deferred"||A==="creditCards"?A:void 0,De=Fo(u.identity,d.value);if(De)return n(Ue,{impressionType:"payment",impressionFeatures:[De],children:n(it,{reason:De,minimal:m})});if(c.freeOrder)return n(Ue,{impressionType:"payment",impressionFeatures:["freeOrder"],children:n(it,{reason:"freeOrder",minimal:m})});if(c.giftCard)return n(Ue,{impressionType:"payment",impressionFeatures:["giftCard"],children:n(it,{reason:"giftCard",minimal:m})});if(c.storeCredit)return n(Ue,{impressionType:"payment",impressionFeatures:["storeCredit"],children:n(it,{reason:"storeCredit",minimal:m})});if(c.redeemables)return n(Ue,{impressionType:"payment",impressionFeatures:["redeemables"],children:n(it,{reason:"redeemables",minimal:m})});if(f.value)return n(Je,{background:"subdued",borderRadius:"base",paddingBlock:"large-500",placeItems:"center",children:n(de,{color:"subdued",textAlign:"center",children:p.translate("payment.loading")})});if(C.length===0)return n(Ue,{impressionType:"payment",impressionFeatures:la(oe,ne),children:n(hl,{error:h.length>0?"script":"no_methods"})});const Ie=Wo({identity:u.identity,billingAddressInContext:t,billingAddressVariant:g});let Le;if(ie)Le=n(le,{paddingBlockEnd:w,children:n(dc,{method:ie,onSelect:L,vaultHandle:U,blockFooter:E,selectedContentFooter:ee})});else if(ne.mode==="tiles"){const re=n(qc,{methods:C,selected:A,onSelect:Q,selectorShowsTiles:s,tileSupportedCustomOnsitePaymentMethods:$});Le=n(N,{gap:"large-100",children:[ne.choiceListPresentation==="redesigned"?n(Ti,{borderSelected:"large100",children:re}):re,n(va,{variant:"details",children:n(au,{methods:C,selected:A,onSelect:Q,vaultHandle:U,directMethodSelectedContentFooter:ee})}),E]})}else Le=n(le,{paddingBlockEnd:w,ref:R,children:n(Rc,{methods:C,selected:A,onSelect:L,renderAsBareCard:v,vaultHandle:U,blockFooter:E,directMethodSelectedContentFooter:ee})});return n(Ei,{target:"cart.paymentLines[0]",children:n(Ue,{impressionType:"payment",impressionFeatures:la(oe,ne),children:n(_l,{errorBannerInContext:e,billingAddressInContext:t,selectedPaymentMethod:A,billingAddressVariant:g,children:n(N,{ref:J,gap:"base",children:[!v&&n(Uc,{selectedPaymentMethod:me}),n(va,{variant:"selector",children:Le}),r,Ie]})})})})}const wu="3.7.0",Tu="/pay/account/installments";function Nu(e){return new URL(Tu,e).href}function Du(e){return vo(e,wu)}function Bu(){const{i18n:e,environment:t,shopPay:a}=S(),s=Ja(),{surface:r,version:i}=a.app.config,o=r!=="web";if(o&&!Du(i))return n(W,{children:e.translate("payment_errors.duplicate_autopay_card_without_link")});const l=n(W,{children:[e.translate("payment_errors.duplicate_autopay_card_link")," ",n(ve,{type:"external",size:"small",display:"inline"})]});return n(W,{children:e.translate("payment_errors.duplicate_autopay_card",{update_payment_details_link:o?n(Re,{onClick:()=>s.notify({open_upcoming_payments:!0}),children:l}):n(Re,{href:Nu(t.services.shopServer.url),target:"_blank",children:l})})})}function Fu(e){const{i18n:t,observability:a,userEvents:s,source:r,checkout:{configuration:i},shop:o}=S(),l=j(()=>Ba(),[]),c=e||l;function d(u,p){po({addressErrors:c,shopPayErrors:u,i18n:t,observability:a,userEvents:s,source:r,configuration:i,shop:o,addressContext:"billing",submittedAddress:p})}return[c,d]}const en="Timed out while processing the 3DS challenge modal.";function xu(e){return{listenerType:"shop_pay_three_ds_listener",modalSourceType:e.modalSourceType,sourceHostCategory:Ln(e.source),selectedPaymentMethod:e.selectedPaymentMethod,isInstallmentsSelected:e.isInstallmentsSelected,...e.buyerCountryCode?{buyerCountryCode:e.buyerCountryCode}:{},surface:e.surface}}const Ru=()=>{const e=z(!1),[t,a]=X(void 0),{observability:s}=S();return F(()=>
2{if(t)return window.addEventListener("message",t.messageListener),t.telemetryAttributes&&s.log("shop_pay_three_ds_listener_started","[ShopPay] 3DS postMessage listener started",t.telemetryAttributes),()=>window.removeEventListener("message",t.messageListener)},[t,s]),{listen:k(({onComplete:i,telemetryContext:o})=>{e.current=!1;const l=Date.now(),c=o?xu(o):void 0,d=(m,_)=>{if(!e.current){e.current=!0;try{_?.()}catch{}try{i(...m)}catch(h){s.error(new zr(`Error in 3DS onComplete handler: ${h}`,{groupingHash:"ShopPayError::ThreeDSecureOnComplete"}))}}},u=setTimeout(()=>{a(void 0),d([{errors:[{message:en}]}],()=>{s.log("use_three_ds_listener_timed_out",en),c&&s.log("shop_pay_three_ds_listener_timed_out",en,{...c,elapsedTimeMs:Date.now()-l})})},Mi);async function p({data:m,origin:_}){m.type===Qn&&(e.current||(a(void 0),clearTimeout(u),d([],()=>{c&&s.log("shop_pay_three_ds_listener_completed","[ShopPay] 3DS postMessage received",{...c,dataType:Qn,originHostCategory:Ln(_),elapsedTimeMs:Date.now()-l})})))}a({messageListener:p,telemetryAttributes:c})},[s])}};function Ou({onAddressValidationErrors:e,onSaveCardErrors:t,onDuplicateAutopayCard:a,onSaveCardBillingAddressErrors:s,onThreeDSUrlChange:r,validateCardFields:i,vaultCardWithSelectedNetwork:o}){const{shopPay:l,checkout:c,observability:d}=S(),u=wn(),{paymentLines:p,billingAddressOption:m,shippingAddress:_,billingAddress:h}=se(),v=c.installments.paymentMethodMustSupportDebitCardOnly,g=gn(),y=c.isShippingRequired.value&&m.value==="shipping"&&!g.value?_.value:h.value,f=c.configuration.addressSettings.billingAddressSettings.value,b=Ra(y?.countryCode,void 0,f),P=Yi(),{listen:C}=Ru(),{creditCardDisabled:A}=eo(),I=l.user.flow.peek()==="authenticated_user",L=k(T=>A(T)?{success:!1,location:"intercept_card_not_good_for_installments"}:{success:!0},[A]),x=k(async({errors:T}={},M,B)=>{if(T||!y){t(),r(null),B({success:!1,location:"intercept_3ds_challenge_complete_error"});return}let w=null;try{const O=await P.completeCreditCardVerificationAndVault({verificationId:M,billingAddress:y,nickname:null,debitOnly:v.value});O.status==="success"?w=l.session.isInstallmentsSelected.value?L(O.creditCard):{success:!0}:O.status==="blocked_by_autopay"?(a(),w={success:!1,location:"intercept_credit_card_blocked_by_autopay"}):(t(O.errors),w={success:!1,location:"intercept_complete_credit_card_verification_failed"})}catch{t(),w={success:!1,location:"intercept_complete_credit_card_verification_error_caught"}}r(null),B(w)},[y,P,v,l.session.isInstallmentsSelected,L,a,t,r]),D=k(async(T,M)=>new Promise(B=>{C({onComplete:w=>x(w??{},T,B),telemetryContext:{buyerCountryCode:y?.countryCode,isInstallmentsSelected:l.session.isInstallmentsSelected.value,modalSourceType:"shop_pay_interceptor_three_ds_modal_url",selectedPaymentMethod:l.session.isInstallmentsSelected.value?"shop_pay_installments":"shop_pay",source:M,surface:"checkout-web"}})}),[x,C,y?.countryCode,l.session.isInstallmentsSelected]);return k(async()=>{try{if(u.value)return{success:!0};const[T]=p.value;if(!T)return{success:!1,location:"intercept_no_payment_lines"};if(T.method.type!=="direct")return{success:!0};if(!y)return{success:!1,location:"intercept_no_selected_billing_address"};const{isValid:M}=i(),B=b(y,"billing");if((m.value!=="shipping"||!c.isShippingRequired.value)&&e(B),!M)return{success:!1,location:"intercept_credit_card_not_valid"};if(B.size!==0)return{success:!1,location:"intercept_billing_address_has_errors"};if(!I)return{success:!0};const w=await o(),O=await P.addCreditCard({sessionId:w,billingAddress:y,nickname:null,debitOnly:v.value,isBlocking:!0});if(O.status==="success")return l.session.isInstallmentsSelected.value?L(O.creditCard):{success:!0};if(O.status==="requires_redirect"){const{redirectUrl:R,verificationId:H}=O.threeDSecureAuthenticationRequest;return l.session.isInstallmentsSelected.value&&d.log("shop_pay_installments_3ds_modal_url_set","[ShopPayPaymentMethodInterceptor] Shop Pay Installments 3DS modal URL set",{buyerCountryCode:y?.countryCode,isInstallmentsSelected:!0,modalSourceType:"shop_pay_interceptor_three_ds_modal_url",selectedPaymentMethod:"shop_pay_installments",sourceHostCategory:Ln(R),surface:"checkout-web"}),r(R),D(H,R)}else return O.status==="blocked_by_autopay"?(a(),{success:!1,location:"intercept_credit_card_blocked_by_autopay"}):(t(O.errors),s(O.errors?.filter(R=>R.field[0]==="billingAddress"),y),{success:!1,location:"intercept_credit_card_not_saved"})}catch(T){if(T instanceof un)return t(),{success:!1,location:"intercept_vault_handle_unavailable"};throw T}},[u,p,y,i,b,m,c.isShippingRequired,I,o,P,v,l.session.isInstallmentsSelected,D,L,d,a,t,s,e,r])}
2class un extends Error{constructor(){super("Card fields functions are unavailable"),this.name="CardFieldsFunctionsUnavailableError"}}function Vu(){const[e,t]=X(null),a=Ja(),{checkoutProtocolModalEventSignal:s}=Ne(),r=k(i=>{const o=i===null?"modal_close":"modal_open";s.value=o==="modal_open"?"redesign":"none",a.notify({checkout_ui:{type:o,payload:{duration:to}}}),t(i)},[a,s]);return[e,r]}function zu({vaultHandle:e}){const{checkout:{validation:t},i18n:a}=S(),{creditCardErrors:s,setCreditCardErrors:r,blockDuplicateAutopayCard:i}=qi(),[o,l]=Fu(t.billingAddressErrors),[c,d]=Vu(),u=Ii({source:c,logMessage:"[ShopPayPaymentMethodProgressionHost] Action required modal iframe loaded; this does not prove issuer challenge rendered",telemetryContext:{modalSourceType:"shop_pay_interceptor_three_ds_modal_url"}}),p=k(()=>{const h=e.value;if(!h)throw new un;return h.validate()},[e]),m=k(async()=>{const h=e.value;if(!h)throw new un;return h.vaultCardWithSelectedNetwork()},[e]);F(()=>{const h=e.value;h&&h.setFieldErrors(s.fieldErrors)},[s,e]);const _=Ou({onAddressValidationErrors:h=>{for(const[v,g]of Array.from(h))o[v].value=g},onSaveCardErrors:r,onDuplicateAutopayCard:i,onSaveCardBillingAddressErrors:l,onThreeDSUrlChange:d,validateCardFields:p,vaultCardWithSelectedNetwork:m});return ts("paymentMethod",_),n(W,{children:[n(Li,{source:c,title:a.translate("processing.action_required"),onIframeLoad:u}),s.baseMessage&&n(xe,{tone:"critical",children:s.baseMessage}
2),s.blockedByDuplicateAutopayCard&&n(xe,{tone:"critical",children:n(Bu,{})})]})}function Em({vaultHandle:e}){const{checkout:{identity:{current:t}}}=S();return t.value==="shopPay"?n(zu,{vaultHandle:e}):null}export{gc as A,bs as B,Mc as C,Bu as D,Pm as E,Cm as F,Vn as G,zn as H,As as I,Mu as J,bu as K,Sc as L,$n as M,Eo as N,ks as O,dn as P,Gd as Q,Ud as R,qd as S,Kd as T,gs as V,vm as a,Bo as b,No as c,To as d,bm as e,la as f,Fo as g,Am as h,_m as i,Em as j,Oo as k,Ru as l,wo as m,md as n,Wo as o,_l as p,Uc as q,Rc as r,Ll as s,El as t,cs as u,xl as v,wl as w,fu as x,Kc as y,Sm as z};

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.