PageSourceSearch

https://synced.sg/cdn/shopifycloud/checkout-web/assets/c1/86720dbb.Dtbs-eZv.js

js synced.sg collected 2026-10-06 02:58:13 UTC 133,794 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["75f3a0c7.C6jjKvRO.js","2c1ab0fe.RaLGJvq2.js","efa0389a.4jo1XZ5U.js","22345fd4.BOPeNj8v.js","164ad2e3.bPUx3Fg0.js","f67abd2c.BTHhdhoM.js","app.CPIYcwpp.js","assets/app.BuSMBobh.css","assets/shipping.CwV2frA-.css","d0bb51ec.BIqtCEEY.js","60a453ce.BHWO3gHr.js","e12db40c.CeuzD2R-.js","9dba8418.DCzpk36x.js","assets/hydrate.D12j_P4G.css","assets/Choice.CIaVEvsx.css","7a8217fd.BsB9ld7l.js","8599b02a.DeY28qKv.js","assets/useShopPayProgressIntercepts.CiYh36Pk.css","50130ded.DTG2ynWI.js","f692f62f.5kQNxwXF.js","9babe369.DDn7FcEm.js","a422df8c.FHHIb5NR.js","4b1c22b7.DKftNOPJ.js","assets/EmptyState.CZwDb_Yh.css","b684bff6.xM1h11AS.js","064f6ac1.TjWXwVYS.js","assets/Popover.Bi1nHaU-.css","bf513f9c.mwf0ps-z.js","0e67bd3b.fkjEM38r.js","74835653.2Ngy7fqB.js","3ca8ef7e.mdJTe1BI.js","2495faa4.DD6nJl2C.js","a9fa9fda.D5UMnVmk.js","ca3e798e.BWruLT5k.js","47b970b2.D1oAm8Vb.js","assets/PhoneField.-WW1pYgW.css","assets/BillingAddressForm.2HXntA0X.css","assets/RedirectionNotice.DgiInWJ-.css","f3fe2775.CJPIHBqD.js","ac5a19ff.IFRwIDsW.js","598fef4e.Ct7NLKKD.js","assets/PaymentIcon.DUuFvlux.css","e77f7fe0.D6YnMnfe.js","assets/PaymentLine.C6U8-oga.css","cc6ff67d.CAlDrn_a.js","08a3b809.KmYN0HWk.js","d25d1b95.Ctc7RP1h.js","e39bc11c.B4ndlA32.js","cf29e63b.CjXLGgdv.js","assets/hasViolationsIgnoringCodes.CQ_TUsw-.css","dfca5da5.DfW8DdKj.js","dae24aab.CZ5rWyZM.js","assets/Section.CU18S7Ap.css","55098bf1.lh4L-ucv.js","6f2620f5.bY_JOuNn.js","79974aab.BHkkF4M9.js","58314944.DgleaEYK.js","4a3d8599.NSaWOAcI.js","8536083a.eNqBGQZI.js","ee2bb050.Cl9T4Znf.js","17e57de1.BQ0yd3rN.js","1d34c07e.h4dJAaCz.js","assets/ExpressCheckoutButton.BnDF3H7t.css","assets/WalletSandbox.DOuxlppk.css","3a819064.D6Tou8y7.js","assets/lazyBankPaymentMethod.Bunr75uw.css","04164916.pllUvULM.js","7bc8057b.BUn-23WY.js","assets/constants.DIc3vsmn.css","assets/lazyPaymentMethods.J240_loH.css","assets/payment-selector-transitions.Wfh8Woqf.css"])))=>i.map(i=>d[i]);
2import{k as e,T as t,q as n,z as a,h as r,G as s,u as i,S as l,o as d,g as o,p as c,n as u,X as m,x as p,w as y,D as h,m as g,a6 as v,a0 as f,_ as b,s as _,i as C,j as S,aE as A}from"./2c1ab0fe.RaLGJvq2.js";import{a as k,bG as P,b3 as w,N as M,b_ as x,a$ as E,E as I,d$ as L,ct as B,j2 as D,j3 as T,f2 as N,aW as F,j4 as O,j5 as V,bp as z,gS as R,aM as H,j6 as j,al as $,J as U,G as q,t as Y,q as W,j7 as G,j8 as K,C as X,fN as J,bJ as Q,j9 as Z,ja as ee,W as te,b2 as ne,ab as ae,u as re,dj as se,gl as ie,jb as le,a4 as de,jc as oe,ee as ce,v as ue,jd as me,je as pe,cU as ye,K as he,cP as ge,jf as ve,bH as fe,aF as be,dk as _e,dm as Ce,jg as Se,o as Ae,hy as ke,hi as Pe,cv as we,jh as Me,p as xe,ji as Ee,a8 as Ie,ey as Le,ez as Be,aT as De,as as Te,jj as Ne,jk as Fe,aG as Oe,j as Ve,bg as ze,jl as Re,gn as He,bI as je,h as $e,bM as Ue,aU as qe}from"./f67abd2c.BTHhdhoM.js";import{c7 as Ye,r as We,ak as Ge,eb as Ke,S as Xe,aJ as Je,aa as Qe,i as Ze,gs as et,W as tt,b as nt,bE as at,bF as rt,dG as st,d5 as it,gw as lt,ah as dt,aU as ot,aW as ct,aX as ut,cD as mt,aS as pt,d as yt,h as ht,H as gt,a0 as vt,f as ft,B as bt,z as _t,eM as Ct,bl as St,hd as At,he as kt,a6 as Pt,a7 as wt,d2 as Mt,eQ as xt,Q as Et,a8 as It,a9 as Lt,h9 as Bt,ep as Dt,hf as Tt,L as Nt,ac as Ft,l as Ot,c4 as Vt,hg as zt,j as Rt,by as Ht,J as jt,hh as $t,hi as Ut,bz as qt,hj as Yt,hk as Wt,hl as Gt,A as Kt,hm as Xt,al as Jt,X as Qt,cB as Zt,cC as en,an as tn,G as nn,aI as an,gD as rn,bk as sn,ed as ln,ee as dn,ai as on,M as cn,gE as un,eg as mn,E as pn,a3 as yn,w as hn,eS as gn,bs as vn,at as fn,eR as bn,bT as _n,hn as Cn,ho as Sn,ex as An,d1 as kn,eU as Pn,hp as wn,c_ as Mn,bK as xn,gZ as En,g_ as In,hq as Ln,ef as Bn,eh as Dn}from"./164ad2e3.bPUx3Fg0.js";import{u as Tn,s as Nn}from"./d25d1b95.Ctc7RP1h.js";import{a as Fn}from"./dfca5da5.DfW8DdKj.js";import{s as On,_ as Vn}from"./app.CPIYcwpp.js";import{b as zn,a as Rn,_ as Hn,C as jn}from"./efa0389a.4jo1XZ5U.js";import{I as $n}from"./55098bf1.lh4L-ucv.js";import{S as Un,A as qn,a as Yn}from"./0e67bd3b.fkjEM38r.js";import{B as Wn,C as Gn,l as Kn,E as Xn,j as Jn,m as Qn,F as Zn,H as ea,I as ta,J as na,P as aa,M as ra,K as sa,L as ia,O as la,Q as da,R as oa,D as ca,U as ua,W as ma,X as pa,N as ya,f as ha,k as ga}
2from"./f3fe2775.CJPIHBqD.js";import{a as va,i as fa}from"./bf513f9c.mwf0ps-z.js";import{u as ba,b as _a,A as Ca,B as Sa,c as Aa}from"./74835653.2Ngy7fqB.js";import{b as ka,a as Pa,O as wa,W as Ma,u as xa,M as Ea}from"./7a8217fd.BsB9ld7l.js";import{v as Ia}from"./6f2620f5.bY_JOuNn.js";import{c as La,C as Ba,M as Da,A as Ta,d as Na}from"./f692f62f.5kQNxwXF.js";import{R as Fa,g as Oa}from"./e77f7fe0.D6YnMnfe.js";import{T as Va}from"./79974aab.BHkkF4M9.js";import{b as za,u as Ra,a as Ha}from"./b684bff6.xM1h11AS.js";import{b as ja,t as $a,c as Ua}from"./2495faa4.DD6nJl2C.js";import{a as qa}from"./a422df8c.FHHIb5NR.js";import{d as Ya,a as Wa,c as Ga,b as Ka}from"./58314944.DgleaEYK.js";import{P as Xa,w as Ja}from"./598fef4e.Ct7NLKKD.js";import{F as Qa,a as Za}from"./3ca8ef7e.mdJTe1BI.js";import{S as er,O as tr,s as nr}from"./cf29e63b.CjXLGgdv.js";import{P as ar}from"./064f6ac1.TjWXwVYS.js";import{a as rr,u as sr,b as ir}from"./cc6ff67d.CAlDrn_a.js";import{f as lr,a as dr}from"./08a3b809.KmYN0HWk.js";function or(){const{checkout:{negotiator:t}}=k(),{paymentLines:n}=t.parts;return e(()=>{const e=n.value.find(e=>Boolean("direct"===e.method?.type&&e.method?.creditCardLastFourDigits&&e.method?.brand));if(e)return e.method})}class cr extends Error{constructor(){super(...arguments),this.name="EmptyPaymentLinesError"}}function ur(){const{observability:e,shop:{paymentMethodAutoSelectionDisabled:a,paymentGateways:r}}=k(),s=Ye(),i=or(),l=!a,d=P(),o=w("paymentMethods"),c=t(()=>r?.map(e=>e.name)??[],[r]);return n(t=>{const n=void 0!==r&&r.length>0,u=!o.value&&d.value.length>0;if(!n||!u)return;const m={hasSessionCard:Boolean(i.value),paymentGateways:c,paymentMethodAutoSelectionDisabled:a,paymentRequired:s.value,stage:t};l&&e.error(new cr(`Payment lines are unexpectedly empty during "${t}" stage. Negotiation was blocked.`),{severity:"error",metadata:{app:m}})},[l,d,i,o,e,c,r,a,s])}function mr(){const{i18n:e,observability:t,checkout:{negotiator:i}}=k(),l=Ye(),d=i.parts.paymentLines.value,[o,c]=a(!1),[u,m]=a(!1),{negotiate:p}=We(),y=ur(),h=n(async()=>{u||(m(!0),await p({legacyFiltering:{include:["paymentLines"]},force:!1,fieldsToResolve:["taxes","paymentMethods"],silenceViolations:M(["paymentLines"]),onComplete(){c(!0),m(!1)}}))},[p,u]);r(()=>{const e=d.find(e=>["paymentOnDelivery","manualPayment","customManualPayment"].includes(e.method.type));(d.find(e=>"offsite"===e.method.type)||e)&&!o&&h()},[d,h,o]),Ge({active:u}),x(({parts:n,reason:a})=>{if("progression"!==a&&"completion"!==a||!l.value)return{behavior:"allow"};const r=n.paymentLines.peek()[0];if(void 0===r)return y(a),{behavior:"block",reason:E.EmptyPaymentLines,errors:[{message:e.translate("field_errors.payment_gateway_missing"),target:Ke}],perform:()=>{}};switch(r.method.type){case"giftCard":case"local":case"customOnsite":case"direct":case"offsite":case"redeemable":return{behavior:"allow"};case"deferred":{const e={method:{type:"deferred"}};return{behavior:"allow",perform(){Tn(n,e)}}}case"paymentOnDelivery":{const{additionalDetails:e,paymentInstructions:t,paymentMethodIdentifier:a,availablePresentmentCurrencies:s}=r.method,i={method:{type:"paymentOnDelivery",additionalDetails:e,paymentInstructions:t,paymentMethodIdentifier:a,availablePresentmentCurrencies:s}};return{behavior:"allow",perform(){Tn(n,i)}}}case"manualPayment":{const{id:e,name:t,additionalDetails:a,paymentInstructions:s,paymentMethodIdentifier:i,availablePresentmentCurrencies:l}=r.method,d={method:{id:e,type:"manualPayment",name:t,additionalDetails:a,paymentInstructions:s,paymentMethodIdentifier:i,availablePresentmentCurrencies:l}};return{behavior:"allow",perform(){Tn(n,d)}}}case"customManualPayment":{const{id:e,name:t,additionalDetails:a,paymentInstructions:s,paymentMethodIdentifier:i,availablePresentmentCurrencies:l}=r.method,d={method:{id:e,type:"customManualPayment",name:t,additionalDetails:a,paymentInstructions:s,paymentMethodIdentifier:i,availablePresentmentCurrencies:l}};return{behavior:"allow",perform(){Tn(n,d)}}}case"wallet":{if("PAYPAL_EXPRESS"!==r.method.name)return{behavior:"allow"};const{walletContent:e}=r.method;return{behavior:"allow",async perform({behavior:t}){"allow"===t&&Tn(n,{method:{type:"wallet",name:"PAYPAL_EXPRESS",walletContent:e}})}}}case"walletsPlatformPaymentMethod":{const{name:e,walletParams:t}=r.method;return{behavior:"allow",perform(){Tn(n,{method:{type:"walletsPlatformPaymentMethod",name:e,walletParams:t}})}}}case I.CreditCard:case I.PayPal:case"bank":case"shopWallet":return{behavior:"allow"};case"noop":case"other":return t.log("payment_unexpected_payment_line_detected","Unexpected payment line",{type:r.method.type}),{behavior:"allow"};default:s(r.method)}})}function pr({selectableBrands:e=[],activeBrand:t,onSelectBrand:n,viewTransitionKey:a,size:r}){const{i18n:s}=k();return i("div",{className:"o0Dix",role:"radiogroup","aria-label":s.translate("payment.network_card_payment_options"),children:i(Xe,{direction:"inline",gap:"small-400",children:e.map((s,l)=>{const d=t===s,o=t?d:void 0,c=t?!o:void 0,u=d||!t&&0===l?0:-1,m={viewTransitionName:`vt-${a}-${s}`},p=function(e){return`network-selector-${e.toLowerCase()}`}(s);return i("button",{id:p,"aria-label":L(s),"aria-checked":d,role:"radio",className:"fmZaX",style:m,onClick:e=>((e,t)=>{e.preventDefault(),n(t)}
2)(e,s),onKeyDown:t=>((t,a)=>{const r=e.length-1;let s;switch(t.key){case"ArrowRight":case"ArrowDown":s=a===r?0:a+1;break;case"ArrowLeft":case"ArrowUp":s=0===a?r:a-1;break;case"Home":s=0;break;case"End":s=r;break;default:return}if(s<0)return;t.preventDefault();const i=t.currentTarget.parentElement?.children[s];i&&(i.focus(),n(e[s]))})(t,l),tabIndex:u,type:"button",children:i(Xa,{type:s,size:r,disabled:c,active:o,accessibilityVisibility:"hidden"})},s)})})})}function yr({paymentBrands:e,activeIconDisplayed:t,activePaymentBrand:n,viewTransitionKey:a,size:r}){const{i18n:s}=k();return i(l,{children:e.map(e=>{const d=i(Xa,{type:e,size:r,disabled:t&&n!==e,active:n===e}),o=a?`vt-${a}-${e}`:void 0,c=o?i("span",{id:o,style:{viewTransitionName:o,display:"flex"},className:"_6f3AR",children:d},e):i(l,{children:d},e);return"BOGUS"===e?i(Je,{accessibilityLabel:s.translate("payment_gateway.bogus_label"),overlay:i(et,{children:s.translate("payment_gateway.bogus_label")}),children:c},e):c})})}function hr({paymentBrands:e,activePaymentBrand:t,viewTransitionKey:n,brandCountOverride:a,size:r,maxVisibleBrands:s,overflowIndicatorRef:l}){const d=e.filter(e=>B(e)),o=D(d.length,s),{visiblePaymentBrands:c,hiddenPaymentBrands:u}=T(d,o),m=!!t&&Boolean(c.includes(t)),p=u.length>0||a,y=a?`+${a}`:`+${u.length}`;return i("div",{className:"mpn0m",children:i(Xe,{direction:"inline",gap:"small-400",alignItems:"center",children:[i(yr,{paymentBrands:c,activeIconDisplayed:m,activePaymentBrand:t,viewTransitionKey:n,size:r}),p&&i(Je,{ref:l,accessibilityVisibility:"hidden",overlay:a?null:i(et,{id:"additional-payment-brand-icons",children:i(Xe,{direction:"inline",gap:"small-400",alignItems:"center",children:i(yr,{paymentBrands:u,activeIconDisplayed:m,activePaymentBrand:t,viewTransitionKey:n,size:r})})}),className:"KOEBK",children:i(Qe,{justifyItems:"center",justifyContent:"center",alignItems:"center",alignContent:"center",children:i(Ze,{size:"extraSmall",tone:"accent",children:y})})})]})})}function gr({animate:e,announceNetworkSelector:t,announceOverflowBrands:n,size:a,maxVisibleBrands:r,overflowIndicatorRef:s}){const{activePaymentBrand:l,binLength:d,paymentMethod:o,selectableBrands:c,selectedSavedCreditCardBrand:u,setSelectedNetwork:m}=Wn(),p=Boolean(o?.supportsNetworkSelection);return o?i(vr,{animate:e,announceNetworkSelector:t,announceOverflowBrands:n,size:a,maxVisibleBrands:r,overflowIndicatorRef:s,activeBrand:l,availableBrands:o.paymentBrands,networkSelectionEnabled:p,onSelectBrand:m,savedCardBrand:u,selectableBrands:c,viewTransitionKey:o.paymentMethodIdentifier,binLength:d}):null}function vr({animate:e=!0,availableBrands:t,selectableBrands:a=[],activeBrand:s,savedCardBrand:o,onSelectBrand:c,viewTransitionKey:u,networkSelectionEnabled:m=!1,binLength:p,announceNetworkSelector:y=!1,announceOverflowBrands:h=!1,size:g,maxVisibleBrands:v,overflowIndicatorRef:f}){const{i18n:b}=k(),_=tt(),C=p>=6||Boolean(o),S=d([]),A=e&&!_,P=n(e=>{A?On(()=>S.value=e,["payment-icons"]):S.value=e},[S,A]);r(()=>{let e=[];C&&(o?e=[o]:a.length?e=a:s&&t.includes(s)&&(e=[s])),N(S.value,e)||P(e)},[C,s,t,o,a,S,P]);const w=t.filter(e=>!S.value.length||S.value.includes(e)),M=!s||A&&!S.value.includes(s)?void 0:s,x=m&&S.value.length>1,E=S.value.length>0&&w[0]?[w[0]]:w;let I=E;x?I=[]:m&&(I=w);const L=h?F(b,I,void 0,v):"",B=L?`${b.translate("tooltip.additional_payment_methods")}: ${L}`:"",D=y&&x?b.translate("payment.network_card_payment_options"):B;return i(l,{children:[(y||h)&&i(nt,{accessibilityRole:"status",accessibilityVisibility:"exclusive",children:D}),m?i(l,{children:x?i(pr,{selectableBrands:a,activeBrand:s,onSelectBrand:c,viewTransitionKey:u,size:g}):i(hr,{activePaymentBrand:M,viewTransitionKey:u,paymentBrands:w,size:g,maxVisibleBrands:v,overflowIndicatorRef:f})}):i(hr,{activePaymentBrand:M,viewTransitionKey:u,paymentBrands:E,size:g,maxVisibleBrands:v,overflowIndicatorRef:f})]})}function fr(e){const t=d(Math.min(e,1)),a=o(null),r=o(null),s=o(null),i=o(null),l=o(null),c=o(null),u=o(null),m=n(()=>{const n=a.current,l=r.current,d=s.current,o=i.current;null!==n&&null!==l&&null!==d&&null!==o&&(t.value=function(e,t,n,a,r){return t*a+(t-1)*n<=e?t:Math.max(1,Math.floor((e-r)/(a+n)))}(n,e,l,d,o))},[t,e]),p=n(e=>{const t=l.current;t&&u.current?.unobserve(t),l.current=e;const n=e?.parentElement;if(n){const t=getComputedStyle(n),a=parseFloat(t.fontSize)||14;
2r.current=parseFloat(t.columnGap)||0,s.current=Ja.base.inlineSize/14*a,i.current=e.getBoundingClientRect().width,u.current?.observe(e)}m()},[m]);return{ref:n(n=>{if(u.current?.disconnect(),u.current=null,c.current=n,!n)return;if("undefined"==typeof ResizeObserver)return void(t.value=e);const r=new ResizeObserver(e=>{for(const t of e){const e=t.target===l.current?t.target.getBoundingClientRect().width:t.contentBoxSize?.[0]?.inlineSize??t.contentRect.width;e<=0||(t.target===l.current?i.current=e:t.target===c.current&&(a.current=e))}m()});r.observe(n),l.current&&r.observe(l.current),u.current=r},[t,e,m]),overflowIndicatorRef:p,maxVisibleBrands:t}}const br=()=>{const t=Ye(),n=O(),a=V("STORE_CREDIT"),r=z(),s=w("deliveryNext"),i=o(null),l=e(()=>({giftCard:n.value,storeCredit:a.value,redeemables:r.value,freeOrder:!t.value}));return c(()=>{s.value||(i.current=l.value)}),e(()=>{const e=l.value;return s.value?i.current??e:e})};function _r(e,t){return"shopPay"===e.current.value?t:null}function Cr({addressErrors:e,billingAddressOption:t,billingAddressValue:n}){const{shopPay:a,checkout:r}=k(),{configuration:s}=r,i=ka(),l=s.addressSettings.billingAddressSettings.value,d=at(n?.countryCode,void 0,l),o=r.addressManager.billing.value,c=r.addressManager.shipping.value,m=a.session.selectedShippingAddress.value,p=rt().value,y=st();return Pa("billingAddress",async()=>{if("shipping"===t.value&&m?.id===o.selectedAddress.value?.id&&!p)return{success:!0};if("shipping"!==t.value&&m?.id!==o.selectedAddress.value?.id)return{success:!0};if("authenticated_user"!==a.user.flow.peek())return Ia({addressType:"billing",validate:()=>d(n,"billing"),setErrors:t=>{u(()=>{for(const[n,a]of t)e[n].value=a})}});!p&&"custom"===t.value&&a.session.unstable_updateSelectedBillingAddress({address:n,valid:!0,lastUsedAt:(new Date).toISOString(),requiresVerification:!0,userPreferred:!1,id:"",uuid:""});const s=p||r.isShippingRequired.value&&!y.value?null:await o.createAddress({address:n,addressErrorsOverride:e});return!m?.id&&p&&await c.createAddress({address:n,addressErrorsOverride:e}),void 0===s?{success:!1,location:"intercept_billing_address_add_new",errors:Object.values(e).some(e=>void 0!==e.value)?[]:[i({offerGuestCheckout:!0})]}:{success:!0}}),null}const Sr=m({});function Ar({settings:e,children:t,additionalFieldGroups:n,addressSettings:a}){const{checkout:s,shopPay:l}=k(),{configuration:d}=s,o=p(Sr),c=o?.addressErrors??s.validation.billingAddressErrors;ba(c);const{billingAddress:u,billingAddressOption:m,paymentLines:y}=s.negotiator.parts,h=R(),g=it(),v="wallet"===y.value[0]?.method?.type,f=s.installments.isSupported.value,b=l.session.isInstallmentsSelected.value,_=f&&b&&s.installments.supportedCountryOptions.value.length>0?s.installments.supportedCountryOptions.value:h,C=lt(s),S=u.value,{updateCountryCodeForSPIBillingAddress:A}=_a(u.fields.countryCode,_);r(()=>{f&&b&&A()},[f,b,A]);const P=d.defaultPhoneNumber.value;return P&&C.isRequired("phone",{useMerchantSettings:!0})&&!S.phone&&(u.value={...S,phone:P}),i(dt,{onSubmit:()=>{if(!g)return;const e=document.getElementById(g.id);e?.dispatchEvent(new Event("submit"))},children:[i(Ca,{id:"billingAddressForm",addressType:"billing",addressErrors:c,address:u,countries:_,settings:e,additionalFieldGroups:n,addressSettings:a??C,shouldSkipAddressValidation:v,children:t}),kr({identity:s.identity})&&i(Cr,{addressErrors:c,billingAddressOption:m,billingAddressValue:S})]})}function kr({identity:e}){return"shopPay"===e.current.value}function Pr(){const{i18n:e,checkout:{negotiator:t}}=k(),a=ot(),{billingAddressOption:s,billingAddress:l,shippingAddress:d}=t.parts,o=d.value,c=ct(),{billing:u}=t.context;ut(),r(()=>()=>{u.value=!1},[u]);const m=n(({billing:e})=>{e.value=!0},[]),p=n(({billing:e})=>{e.value=!1},[]);return i(nt,{children:[i(y,{when:()=>"selector"===a.value,children:i(mt,{id:"billingAddressCheckbox",name:"billingAddress",checked:"shipping"===s.value,onChange:e=>{e?(s.value="shipping",c()):(s.value="custom",function(){const e=H({zoneCode:void 0,countryCode:o.countryCode});l.value=e}())},label:e.translate("payment.same_billing_address_checkbox_label")})}
2),i(pt,{id:"billingAddressDetails",open:"shipping"!==s.value,children:[i(yt,{blockSize:"large-300"}),i(ht,{accessibilityRole:"group",accessibilityLabelledBy:"billingAddress",children:[i(gt,{id:"billingAddress",level:2,children:e.translate("payment.billing_address_title")}),i(yt,{blockSize:"base"}),i(Un,{onValid:m,onInvalid:p,children:i(Ar,{})})]})]})]})}function wr(){const{shopPay:t,checkout:n}=k(),a=t.user.addresses,r=n.installments.config,s=t.session.isInstallmentsSelected;return e(()=>{const e=a.value,t=r.value,n=void 0!==t&&s.value,i=n&&t?e.filter(e=>!ja(e.address,t)):e,l=n&&t?e.filter(e=>ja(e.address,t)):[],d=[...i.map(e=>$a({address:e})),...l.map(e=>$a({address:e,isDisabled:()=>!0}))];return{validAddresses:i,disabledAddresses:l,addresses:d}})}function Mr({addressType:e,addressCount:t,onPress:n}){const a="shipping"===e,{i18n:r}=k(),s=t>=j;return i(bt,{variant:"plain",inlineSize:"fill",inlineAlignment:"start",onClick:n,disabled:s,children:i(Xe,{direction:"inline",gap:"small-100",alignItems:"center",children:[i(vt,{type:"plus",size:"base"}),i(Xe,{alignItems:"start",gap:"small-400",children:[i(ft,{textAlign:"start",color:s?"subdued":void 0,children:a?r.translate("shipping.add_address"):r.translate("billing.add_address")}),s&&i(ft,{textAlign:"start",type:"small",children:i(Ze,{type:"strong",children:r.translate("address_management.address_form.max_address",{max_addresses:j})})})]})]})})}function xr({id:e,label:t,addressType:s,onAddAction:l}){const{i18n:d,userEvents:c,source:u,checkout:m,shop:p,shopPay:y}=k(),h=y.user.addresses.value,{selectAddress:g}=za(s),v=m.addressManager[s].value.selectedAddress,f=o(v.peek()),[b,_]=a(!v.peek()),C=m.installments.isSupported.value&&y.session.isInstallmentsSelected.value,S=wr(),{addresses:A,validAddresses:P}=S.value,{setFirstSpiSupportedAddress:w}=function({selectedAddress:e,setSelectedAddress:t}){const{checkout:a}=k(),r=wr(),s=a.installments.config.value??null;return{setFirstSpiSupportedAddress:n(()=>{const{validAddresses:n}=r.value,[a]=n;e&&s&&a&&ja(e,s)&&t(a.id)},[r,s,e,t])}}({selectedAddress:v.value?.address,setSelectedAddress:g});r(()=>{C&&"billing"===s&&w()},[C,s,w,P]),r(()=>{const e=v.value,t="billing"===s&&f.current&&!e;e||_(!0),f.current=e,t&&_t({content:d.translate("general.choose_billing_address"),role:"status"})},[s,d,v.value]);const M=n(()=>{const e="shipping"===s?"shipping_addresses":"billing_addresses";c.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...$(u,m,p),action:b?`${e}_collapse`:`${e}_expand`}}),_(e=>!e)},[c,u,m,p,s,b]),{nameLine:x,primary:E,secondary:I}=Ct({address:v.value?.address??{},nameLinePosition:"block"}),L=v.value?x:void 0,B=v.value?i(Xe,{children:[E&&i(Ze,{children:E}),I&&i(Ze,{children:I})]}):i(ft,{children:d.translate("address_management.address_form.add_address")});return i(Va,{theme:{rollup:{inlinePadding:"none"}},children:i(Fa,{open:b,id:e,label:t,onToggle:M,primaryContent:L,secondaryContent:B,children:i(Xe,{gap:"small-200",children:[i(La,{id:"billing_address_credit_card",addresses:A,addressType:"billing",onChange:e=>g(e,{source:"shop-pay-address-review-item"}),selectedId:v.value?.id}),i(nt,{padding:"none small-100",children:i(Mr,{addressType:s,addressCount:h.length,onPress:l})})]})})})}function Er({billingAddressInContext:e}){const{i18n:r,checkout:s}=k(),[d,o]=a(!1),c=Gn(),u=s.configuration.addressSettings.billingAddressSettings.value,m=t(()=>({addressErrors:s.validation.billingAddressErrors,addressSettings:u}),[u,s.validation.billingAddressErrors]),p=m.addressErrors,{createAddress:y}=za("billing"),h=n(e=>y({address:e,addressErrorsOverride:p}),[p,y]);return i(l,{children:[e?i(Sr.Provider,{value:m,children:i(Pr,{})}):i(nt,{border:"base",borderRadius:"base",padding:"none base",children:i(xr,{id:"payment_selector_billing_address",addressType:"billing",label:r.translate("payment_ux.bill_to"),onAddAction:()=>o(!0)})}),i(wa,{open:d,heading:r.translate("address_management.address_form.add"),onHide:()=>o(!1),children:i(Ba,{addressType:"billing",addressErrorsSignal:p,editableAddress:c,onCancel:()=>o(!1),onSuccess:()=>o(!1),onSave:h,cancelText:r.translate("credit_card_form.go_back"),saveText:r.translate("edit_credit_card_modal.save_billing_address")})})]})}function Ir({identity:e,billingAddressInContext:t,billingAddressVariant:n,customerAccountBillingAddressSection:a,businessCustomerBillingAddressSection:r}){return"shopPay"===e.current.value&&"footer"===n?i(Er,{billingAddressInContext:t}
2):"inlineDirectMethod"!==n?null:"customerAccount"===e.current.value?a??null:"businessCustomer"===e.current.value?r??null:null}function Lr({experienceType:e}){const{value:n}=P({deferClientOnlyWalletsUntilHydrated:!0}),a="bareCreditCardOnly"===e,{shop:r,shopPay:s,checkout:i}=k(),{managedByMarketsPro:l}=i.negotiator.current.fields,{paymentLines:d,billingAddress:o,shippingAddress:c,billingAddressOption:u}=i.negotiator.parts,m=Y({managedByMarketsPro:l.value}),p=rr(),y=i.installments.isSupported.value,h=!rt().value&&"shipping"===u.value&&i.isShippingRequired.value?c.value:o.value,g=function({identity:e,paymentLines:t,shop:n,isBareCardOnly:a}){return"shopPay"!==e.current.value||a?"inlineDirectMethod":!n.hasFlagEnabled(U)&&q(t,"APPLE_PAY")?"none":"footer"}({identity:i.identity,paymentLines:d.value,shop:r,isBareCardOnly:a}),v=W(s.app.config),f=s.session.isInstallmentsSelected.value;return{displayedPaymentMethods:t(()=>lr(n??[],{identity:i.identity,installmentsSelected:y&&f,isApplePayAvailable:p.value,idealEnabled:m,isBareCardOnly:a,isShopAppLayout:v,shopAppVersion:s.app.config.version}),[n,i.identity,y,f,s.app.config.version,p.value,m,a,v]),renderAsBareCard:a,billingAddressVariant:g,selectedBillingAddress:h,isApplePayAvailable:p.value}}const Br={2:28,3:17,4:11},Dr={2:18,3:13,4:18};function Tr(e,t){const{renderFeatures:n}=e,a=n.tiles&&n.singleCreditCard?t:Nr({...e,renderFeatures:{...n,tiles:!0,singleCreditCard:!0}});return{tileEligible:"tiles"===a.mode,fallbackReason:a.fallbackReason,tileIneligibility:a.metadata.tileIneligibility}}function Nr({renderFeatures:e,displayedPaymentMethods:t,tileContainerSize:n,getTileMetadata:a}){const r=t.length,{choiceListPresentation:s}=e,i={displayedPaymentMethodCount:r,tileEligibilityChecked:!1,tileIneligibility:[]};if(0===r)return{mode:"choiceList",choiceListPresentation:s,fallbackReason:"no_displayed_payment_methods",metadata:i};if(e.knownBuyerSharedSelector)return{mode:"knownBuyerShared",choiceListPresentation:s,metadata:i};const[l]=t;if(1===r&&void 0!==l&&e.singleCreditCard&&J(l))return d=l,Boolean(d.displayName?.trim())?{mode:"choiceList",choiceListPresentation:s,fallbackReason:"custom_payment_method_label",metadata:i}:{mode:"singlePaymentMethodCreditCard",choiceListPresentation:s,metadata:i};var d,o;if(e.tiles&&(2===(o=r)||3===o||4===o)){if(3===r&&(void 0===n||"compact-narrow"===n))return{mode:"choiceList",choiceListPresentation:s,fallbackReason:void 0===n?"tile_container_unmeasured":"tile_container_too_narrow",metadata:i};const e=function(e,t,n,a){const r=function(e,t){const n=Br[e],a=Dr[e];return"compact-narrow"===t||"compact"===t?a:"wide"===t?n:Math.min(n,a)}(t,n);return e.flatMap(e=>{const t=Q(e),n=Z(e),s=a(e);if(!s)return[{key:t,methodName:n,reasons:["missing_tile_metadata"]}];const i=function(e,t){const n=[];return 0===e.label.trim().length&&n.push("missing_label"),e.hasSubtitle&&n.push("subtitle_present"),e.label.length>t&&n.push("label_may_wrap"),e.iconCount<1&&n.push("missing_icon"),e.iconCount>1&&n.push("multiple_icons"),e.hasIncentiveBadge&&n.push("incentive_badge_present"),n}(s,r);return i.length>0?[{key:t,methodName:n,reasons:i}]:[]})}(t,r,n,a),l={displayedPaymentMethodCount:r,tileEligibilityChecked:!0,tileIneligibility:e};return 0===e.length?{mode:"tiles",choiceListPresentation:s,metadata:l}:{mode:"choiceList",choiceListPresentation:s,fallbackReason:"tile_ineligible_methods",metadata:l}}return{mode:"choiceList",choiceListPresentation:s,metadata:i}}function Fr(e,{i18n:t,identitySource:n,isOnePageCheckout:a,isVenmoCheckout:r=!1,forceDebitCardLabel:s=!1,tileSupportedCustomOnsitePaymentMethods:i}){switch(e.type){case"direct":return{label:ee({identitySource:n,i18n:t},e,{forceDebitCardLabel:s}),iconBrand:"generic",iconCount:1,hasSubtitle:!1,hasIncentiveBadge:!1};case"wallet":return function(e,t,n){switch(e.name){case"PAYPAL_EXPRESS":return Or(t,n);case"APPLE_PAY":return Vr(t.translate("brand.apple_pay"),"apple_pay");case"SHOP_PAY":case"SHOPIFY_INSTALLMENTS":return{...Vr(t.translate("payment_gateway.shop_pay.name"),"shop_pay"),hasSubtitle:"SHOPIFY_INSTALLMENTS"===e.name};default:return}}(e,t,r);case I.PayPal:return Or(t,r);case"walletsPlatform":return function(e,t,n){if(e.name===te.AmazonPay)return n?void 0:Vr(t.translate("brand.amazon_pay"),"amazon_pay")}(e,t,a);case"local":return function(e,t){const n=B(t);return{label:e,iconBrand:n?t:null,iconCount:n?1:0,hasSubtitle:!1,hasIncentiveBadge:!1}}(e.displayName??"",e.name);case"offsite":return zr(e.name,e.paymentBrands);case"customOnsite":if(St(e)||!i.has(e.paymentMethodIdentifier))return;return function(e,t){const n=zr(e,t);if(!n.iconBrand)return n;const a=n.iconBrand.replace(/[-_]/g," "),r=n.iconBrand.toUpperCase(),s=L(r),i=s===r?a:s;return{...n,accessibilityLabel:`${e}, ${i}`}}(e.name,e.paymentBrands);case"bank":return function(e){const t=e.availableInstruments[0]?.bankName;return t?{label:e.displayName??"",iconBrand:Oa(t),iconCount:1,hasSubtitle:!1,hasIncentiveBadge:!1}:{label:e.displayName??"",iconBrand:null,iconCount:3,hasSubtitle:!1,hasIncentiveBadge:!1}}(e);case"paymentOnDelivery":case"manualPayment":case"customManualPayment":return Rr(e.name);case"deferred":return Rr(e.displayName??t.translate("payment_gateway.deferred_payment_label"));default:return}}function Or(e,t){return t?Vr(e.translate("brand.venmo"),"venmo"):Vr(e.translate("brand.paypal"),"paypal")}function Vr(e,t){return{label:e,iconBrand:t,iconCount:1,hasSubtitle:!1,hasIncentiveBadge:!1}}
2function zr(e,t){const n=(t??[]).filter(B);return{label:e,iconBrand:n[0]??null,iconCount:n.length,hasSubtitle:!1,hasIncentiveBadge:!1}}function Rr(e){return{label:e,iconBrand:null,iconCount:0,hasSubtitle:!1,hasIncentiveBadge:!1}}const Hr=new Set;function jr(e,t=Hr){const{showPaymentTiles:a,showSingleCreditCard:r}=At(),s=kt(),i=k(),{i18n:l,checkout:d}=i,o=function({shop:e,source:t,checkout:n},a){return!n.configuration.layout.isOnePage.value&&G({identitySource:n.identity.current.value,isOrderSession:X(t),storeVaultEnabled:e.storeVaultEnabled,customerProfile:a.buyerIdentity.value?.customerProfile,hasCustomerStoredPaymentMethod:K({availablePaymentMethods:a.paymentMethods.value??[],paymentMethodHistory:a.paymentMethodHistory?.value??[]})})}(i,i.checkout.negotiator.current.fields),c=Pt(),u=wt(c),m=function({identity:e}){return e.current.value}({identity:d.identity});return n((n,i,d)=>function(e){const t=Nr(e);return{...t,eligibility:Tr(e,t)}}({renderFeatures:{tiles:a,singleCreditCard:r,choiceListPresentation:s,knownBuyerSharedSelector:o},displayedPaymentMethods:e,tileContainerSize:n,getTileMetadata:e=>function(e,t){const n=Fr(e,t);if(n)return{label:n.label,hasSubtitle:n.hasSubtitle,iconCount:n.iconCount,hasIncentiveBadge:n.hasIncentiveBadge}}(e,{i18n:l,identitySource:m,isOnePageCheckout:i,isVenmoCheckout:u,forceDebitCardLabel:d,tileSupportedCustomOnsitePaymentMethods:t})}),[e,a,r,s,o,l,m,u,t])}function $r(e,n,a=Hr){const r=jr(e,a),{checkout:s}=k(),i=s.configuration.layout.isOnePage,l=s.installments.paymentMethodMustSupportDebitCardOnly.value;return t(()=>r(n,i.value,l),[r,n,i.value,l])}function Ur({showHeading:e=!0}){const{i18n:t,checkout:{validation:n,negotiator:a}}=k(),{purchaseOrderNumber:r}=a.parts,{poNumberError:s}=n,l=t.translate("payment.purchase_order_number.title");return i(Fn,{condition:e,accessibilityLabel:t.translate("payment.purchase_order_number.title"),padding:"none",children:i(Xe,{gap:"small-200",children:[e&&i(gt,{children:l}),i(Mt,{name:"poNumber",label:t.translate("payment.purchase_order_number.label"),value:r.value,onChange:e=>{r.value=e.trim()},prefix:"#",autocomplete:"off",maxLength:50,error:s.value})]})})}function qr({forceVaultingEligible:t=!1,blockNegotiations:n=!1,borderless:a=!1}={}){const r=ne(),s=xt(),o=d(void 0),{i18n:c,shop:u,checkout:{negotiator:m}}=k(),{acceptPaymentVaulting:p,paymentLines:h}=m.parts,g=Et(),v=e(()=>g.value||t);x(({reason:e})=>(n&&"negotiation"===e||"negotiation"!==e)&&v.value&&(m.current.fields.paymentFlexibilityPaymentTermsTemplate.value&&!s.value||r.value)&&!p.value?{behavior:"block",reason:E.BlankVaultingAgreement,perform(){o.value=c.translate("field_errors.vaulting_agreement_blank")}}:"completion"!==e||v.value?{behavior:"allow"}:{behavior:"allow",perform(){o.value=""}});const f=e(()=>h.value.some(e=>"bank"===e.method.type)?c.translate("payment.business_customer_with_bank_account_vaulting_payment_label",{company:u.name}):m.current.fields.buyerIdentity.value?.purchasingCompany?c.translate("payment.business_customer_vaulting_payment_label",{company:u.name}):c.translate("payment.vaulting_agreement_label",{company:u.name})),b=e(()=>v.value?p.value:void 0);return i(l,{children:i(Xe,{gap:"base",border:a?void 0:"base",borderRadius:a?void 0:"base",padding:a?void 0:"small-100",children:[i(y,{when:o,children:i(It,{tone:"critical",errorType:Lt.PaymentError,children:o})}),i(mt,{name:"vaulting_and_subscription_agreement",checked:b.value,onChange:e=>{!function(e){v.value&&(p.value=e),o.value=""}(e)},error:o.value?" ":void 0,label:f.value})]})})}function Yr(e){switch(e){case"singlePaymentMethodCreditCard":return"bare_card";case"tiles":return"tiles";case"choiceList":return"list";case"knownBuyerShared":return"known_buyer_shared";default:return s(e)}}function Wr(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 s(e)}}function Gr(e){const t=new Set,n=[];for(const{methodName:a,reasons:r}of e)for(const e of r)t.add(e),n.push(`tile_ineligible:${e}:${a}`);return[...Array.from(t,e=>`tile_ineligible_reason:${e}`),...n]}function Kr(e,t){return[...e,`selector_mode:${Yr(t.mode)}`,`fallback_reason:${Wr(t.eligibility.fallbackReason)}`,`tile_eligible:${t.eligibility.tileEligible}`,`method_count:${t.metadata.displayedPaymentMethodCount}`,...Gr(t.eligibility.tileIneligibility)]}function Xr({error:e}){const{i18n:n}=k(),a=t(()=>{switch(e){case"configuration":return n.translate("payment.not_configured_error");case"technical":return n.translate("payment.technical_error");case"no_methods":return n.translate("payment.no_method_error");case"script":return n.translate("payment.no_working_method_error")}},[e,n]);return i(nt,{background:"subdued",borderRadius:"base",padding:"large-100",accessibilityRole:"script"===e?"alert":void 0,children:i(Xe,{gap:"small-200",alignItems:"center",children:[i(qa,{children:i("img",{src:"/cdn/shopifycloud/checkout-web/assets/c1/assets/payment.BidoBI-H.svg",alt:""})}),i(ft,{color:"subdued",textAlign:"center",children:a})]})})}const Jr=ae("PaymentMethodsContext");function Qr({children:e,billingAddressInContext:n,errorBannerInContext:a,isInModal:r,selectedPaymentMethod:s,billingAddressVariant:l,cardNickname:d,onCardNicknameChange:o}){const c=t(()=>({billingAddressInContext:n,errorBannerInContext:a,isInModal:r,selectedPaymentMethod:s,billingAddressVariant:l??"inlineDirectMethod",cardNickname:d,onCardNicknameChange:o}),[n,a,r,s,l,d,o]);return i(Jr.Provider,{value:c,children:e})}function Zr(){const{shop:t,checkout:{negotiator:n}}=k(),{paymentMethods:a}=n.current.fields,{paymentLines:r}=n.parts,s=e(()=>Kn(a.value)),i=e(()=>Xn({paymentLines:r.value,storeVaultGuestCvvVerificationEnabled:t.storeVaultGuestCvvVerificationEnabled}));return e(()=>Jn({hasBogusGateway:s.value,hasAmexCvvOnlyField:i.value}))}function es({handle:e}){const{validate:t,sdk:a,errors:s,loading:i}=Qn(),{vaultCardWithSelectedNetwork:l,setSelectedNetwork:d,detectedNetworks:o,selectedNetwork:c}=Wn(),u=n(e=>a.setErrors(e),[a]);return r(()=>(e.value={validate:t,vaultCardWithSelectedNetwork:l,setSelectedNetwork:d,setFieldErrors:u,hasSDKError:Boolean(s.sdk),isSDKLoading:i,detectedNetworks:o,selectedNetwork:c},()=>{e.value=null}),[e,t,l,d,u,s.sdk,i,o,c]),null}const ts=new Set(["name","number","verification_value","expiry","expiry_month","expiry_year","issue_date","issue_number"]);function ns(e){return ts.has(e)}const as=["number","expiry","verification_value","name"];const rs={rollup:{blockPadding:"base",inlinePadding:"none"}};function ss({open:e,onClose:t,heading:n,cardForm:a,sdkAvailable:r=!0,billingAddressSection:s,afterBillingAddress:d,beforeCardForm:o,error:c,onSave:u,loading:m,disabled:p,blocking:y,externalContent:h,createAddressForm:g,size:v,accessibilityLabel:f,dataTestIdForScrollableContent:b,submitText:_}){const{i18n:C,shop:S}=k(),A=y?{blocking:!0,onHide:void 0}:{blocking:!1,onHide:t},P=g?.open??!1,w=i(Bt,{submitText:_??C.translate("payment.card_form.save"),cancelText:C.translate("payment.card_form.cancel"),loading:!!r&&m,disabled:!r||p||m,handleSubmit:u,handleCancel:t}),M=i(dt,{onSubmit:u,children:i(Xe,{gap:"base",children:[c&&i(nt,{padding:"none none base none",children:i(It,{tone:"critical",errorType:Lt.PaymentError,children:c})}),o,a,r&&s,d]})}),x=S.hasFlagEnabled(de)?i(Va,{theme:rs,children:M}):M;return i(l,{children:[h,i(wa,{dataTestIdForScrollableContent:b,open:e,accessibilityLabel:f,heading:n,size:v,primaryAction:P?void 0:w,...A,children:[i(nt,{display:P?"none":"block",children:x}),P&&g?.content]}
2)]})}function is({hideAddressModal:e}){const{checkout:t}=k(),a=t.addressManager.billing.value,r=za("billing"),{isMissingPhone:s}=Ra({addressType:"billing"}),{isMissingFirstName:l}=Ha({addressType:"billing"}),d=s||l,o=n(e=>r.selectAddress(e.id),[r]);return i(Ta,{addressType:"billing",addresses:a.addresses.value,immutableAddresses:a.immutableAddresses.value,immutableAddressSections:a.immutableAddressSections.value,addressesTitle:a.addressesTitle,selectedAddress:a.selectedAddress.value,onSelectAddress:o,onCreateAddress:r.createAddress,onUpdateAddress:r.updateAddress,onDeleteAddress:r.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:d?i(Da,{addressType:"billing"}):void 0})}function ls({hideAddressModal:e}){const{checkout:t}=k(),{isLoading:n,isValid:a}=t.addressManager.billing.value.suggestedAddress.value;return a||n?i(is,{hideAddressModal:e}):i(Sa,{})}function ds({hideAddressModal:e=!1}={}){const{checkout:t}=k();return"shopPay"!==(n=t.identity.current.value)&&"businessCustomer"!==n||t.addressManager.billing.value.isMissingValidSuggestedAddress.value?i(Sa,{}):"shopPay"===t.identity.current.value?i(is,{hideAddressModal:e}):i(ls,{hideAddressModal:e});var n}async function os({validateCardFields:e,vaultCard:t,paymentMethodIdentifier:n,getDue:a,parts:r,newCard:s,buyerHasActedSignal:i,negotiate:l,setLoading:d,beforeSubmit:o,openBilling:c,close:u,onAddressError:m,fixSubscriptionRedeemablePaymentAmount:p=!1}){i.value=!0,d(!0),await(o?.());const{isValid:y}=e();if(!y)return void d(!1);let h;try{h=await t()}catch{return void d(!1)}const g=r.paymentLines.value;if(h){const e={type:"direct",sessionId:h,paymentMethodIdentifier:n},t=g.filter(e=>"giftCard"===e.method.type||p&&"redeemable"===e.method.type),s=a();r.paymentLines.value=[{method:e},...s?[{method:e,due:s}]:[],...t]}const v=()=>{r.paymentLines.value=g};l({fieldsToResolve:["paymentMethods"],onComplete(e){switch(d(!1),e.status){case"success":case"error":{const t=function(e){if("success"===e.status||"error"===e.status){if(e.violations.some(e=>oe.has(e.code)))return"address";if(0!==e.errors.length){for(const t of e.errors){if(oe.has(t.code))return"address";if(ce.has(t.code))return"card"}return"other"}}}(e);if("address"===t)return v(),c(),void m(e.violations);if("card"===t)return void v();if("other"===t)return void u();if("success"===e.status){const t=function(e){return e.negotiated.paymentLines?.lines?.find(e=>"direct"===e.method.type)}(e);t&&(s.value=t.method),u()}break}case"invalid":if(e.reasons.includes(E.BlankVaultingAgreement))return void v();u();break;default:u()}}})}function cs({open:e,onToggle:t}){const{i18n:n,checkout:a}=k(),{billingAddress:r}=a.negotiator.parts,s=Dt(r.value),l=a.addressManager.billing.value.isMissingValidSuggestedAddress.value;return i(Fa,{id:"billingAddress",label:n.translate("payment.billing_address_title"),open:e||l,onToggle:l?void 0:t,primaryContent:l?void 0:s,children:i(Xe,{gap:"base",children:[i(Tt,{section:"payment"}),i(ds,{hideAddressModal:!0})]})})}const us={rollup:{inlinePadding:"none"}};function ms({addresses:e,selectedAddress:t,onSelectAddress:n,onAddAddress:a,canCreateAddress:r,canUpdateAddress:s,onUpdateAddress:l,open:d,onToggle:o,id:c,label:u,summary:m,errorAddress:p,onEditErrorAddress:y}){const{i18n:h}=k(),{nameLine:g,primary:v,secondary:f}=Ct({address:t?.address??{},nameLinePosition:"block"}),b=t?g:void 0,_=t?i(Xe,{children:[v&&i(Ze,{children:v}),f&&i(Ze,{children:f})]}):i(ft,{children:h.translate("billing.address_form.add_address")}),C=p?.value,S=d||Boolean(C);return i(Va,{theme:us,children:i(Fa,{id:c??"billingAddress",label:u??h.translate("payment.billing_address_title"),open:S,onToggle:()=>o(S),primaryContent:m??b,secondaryContent:m?void 0:_,children:[C&&y&&i(nt,{padding:"none none base none",children:i(ps,{onEdit:y})}),i(Ta,{addressType:"billing",noticesSection:"payment",addresses:e,selectedAddress:t,onSelectAddress:n,canUpdateAddress:s,onUpdateAddress:l,showNotices:!1,hideAddressModal:!0}),r&&i(Je,{className:"H5k1u",inlineSize:"100%",padding:"base",onClick:a,children:i(Xe,{direction:"inline",gap:"small-100",alignItems:"center",children:[i(vt,{type:"plus",size:"base"}),i(Ze,{children:h.translate("billing.add_address")})]})})]})})}function ps({onEdit:e}){const{i18n:t}=k();return i(It,{errorType:Lt.PaymentError,tone:"critical",children:i(Ze,{children:t.translate("address_management.invali
2d_billing_address_selected_with_update_link",{update_address_link:i(Nt,{tone:"monochrome",onClick:e,children:t.translate("address_management.billing_address_update")})})})})}function ys({open:e,onToggle:t,onAddAddress:a,errorAddress:r,onEditErrorAddress:s}){const{checkout:l}=k(),d=l.addressManager.billing,o=d.value,c=n(e=>{r.value=void 0,d.value.selectAddress(e.id)},[d,r]);return i(ms,{addresses:o.addresses.value,selectedAddress:o.selectedAddress.value,onSelectAddress:c,onAddAddress:a,canCreateAddress:o.canCreateAddress.value,canUpdateAddress:o.canUpdateAddress.value,onUpdateAddress:e=>o.updateAddress(e),open:e,onToggle:t,errorAddress:r,onEditErrorAddress:s})}const hs={CardFieldWrapper:"cRSsz",isDisabled:"WUohw","CardFieldWrapper-borderNone":"cssC4",isFocused:"bl714",hasError:"GLY0v","CardFieldWrapper-borderFull":"J1Wf0","CardFieldWrapper-borderBlockEnd":"_7rHVa"},gs=h(({hidden:e,border:t,error:n,focused:a,loading:r,children:s},l)=>{const d=Ft();return i("div",{"data-protected-input":!0,ref:l,hidden:e,className:g(hs.CardFieldWrapper,ue({focusRing:"resting",colorLayer:n?"controlInvalid":"control"}),t&&hs[v("CardFieldWrapper-border",t)],{[hs.hasError]:Boolean(n),[hs.isFocused]:a&&!d,[hs.isDisabled]:d}),"aria-busy":r||void 0,"aria-disabled":d||void 0,children:s})}),vs="kyKRO";function fs({ready:e}){const[t,n]=a(!0);return r(()=>{e||n(!0)},[e]),t?i("div",{className:g("NM5yz",{[vs]:e}),onTransitionEnd:()=>n(!1),children:i("div",{className:"GcTEr"})}):null}function bs({placeholder:e,label:t,name:n,initialValue:s,onChange:i,themeStyles:l,themeStylesVersion:d,onBlur:o=()=>{},empty:c}){const{filled:u,focusedField:m,sdk:p,loading:y}=Qn(),h=Ot(),g=Vt(),v=zt(),[f,b]=a(m===n),_="string"==typeof s&&s.trim().length>0,C=Rt(),S=e??t;return r(function(){if(m===n){v("payment"),b(!0);const e=C.value.currentFocus.value;C.value.currentFocus.value="payment","payment"!==e&&(h("sectionInteraction",{section:"payment",timestamp:new Date}),g({type:"section_interaction",section:"payment"}))}else f&&(o(),v("payment"),h("change",{element:{tagName:"INPUT",type:"text",label:n},section:"payment",timestamp:new Date}),b(!1))},[h,v,C,m,f,t,n,o,p,g]),r(function(){u[n]?(i(!1),p.setPlaceholderContent(n,""),v("payment")):i(!0)},[u,n,i,p,v]),r(function(){p.setTranslation(n,t)},[n,t,p]),r(function(){c?(p.setPlaceholderContent(n,S),p.setStyles({field:n,styles:{padding:l.padding.default}})):(p.setPlaceholderContent(n,""),p.setStyles({field:n,styles:{padding:l.padding.floating}}))},[c,S,n,l,d,p,y]),{hasInitialValue:_,isFilled:u[n]}}const _s="--accessory-width",Cs="_211UF";function Ss({accessory:e,border:t,error:n,focused:a,hidden:s,label:l,loading:d,name:c,placeholder:u,onChange:m,empty:p,themeStyles:y,themeStylesVersion:h}){const{i18n:v}=k(),{sdk:f}=Qn(),b=u??l,_=Ht({active:Boolean(n)}),{wrapperRef:C,accessoryRef:S}=function(e){const t=o(null),n=o(null);return r(()=>{const a=t.current,r=n.current,s=()=>{a?.style.removeProperty(_s)};if(!e||!a||!r)return void s();const i=()=>{a.style.setProperty(_s,`${r.offsetWidth+26}px`)};if(i(),"undefined"==typeof ResizeObserver)return s;const l=new ResizeObserver(i);return l.observe(r),()=>{l.disconnect(),s()}},[e]),{wrapperRef:t,accessoryRef:n}}(Boolean(e));return bs({placeholder:u,label:l,name:c,themeStyles:y,themeStylesVersion:h,onChange:m,empty:p}),i(gs,{ref:C,hidden:s,border:t,loading:d,error:n,focused:a,children:[i("div",{ref:_,className:g("DCpNs",{[Cs]:Boolean(e)}),id:c,"data-card-fields":c,"data-card-field-placeholder":b,"data-card-field-prefix":v.translate("payment.card_fields_container_prefix"),tabIndex:-1,onFocus:()=>{f.setFocus(c)}}),e&&i("div",{ref:S,className:"_4VRZE",children:e}),i(fs,{ready:!d})]})}const As="_3fIVg";function ks(e){const{error:t,label:r,name:s,initialValue:l}=e,{control:{border:d,labelPosition:o="inside"},textField:{border:c}}=jt(),u=c||d||"full",[m,p]=a(!l),y=n(e=>p(e),[]),h={...e,border:u,onChange:y,empty:m};return i("div",{className:g("Uq6Ln",Yt["outside"===o?"labelOutside":"labelInside"],"inside"===o&&ue({colorLayer:t?"controlInvalid":"control"})),children:["outside"===o&&i($t,{variant:"outside",htmlFor:s,label:r}),i("div",{className:g("W16eS","inside"===o&&!m&&Ut.floating),children:["inside"===o&&i($t,{variant:"inside",htmlFor:s,label:r}),"name"===s?i(Ps,{...h,initialValue:l}):i(Ss,{...h})]}),t&&i(qt,{controlID:s,children:t})]})}function Ps({name:e,label:t,placeholder:r,error:s,loading:l,focused:d,hidden:o,border:c,initialValue:u,allowClear:m,onChange:p,empty:y,themeStyles:h,themeStylesVersion:v}){const{i18n:b}=k(),{setFilled:_,filled:C,sdk:S,touched:A}=Qn(),P=r??t,[w,M]=f(()=>!0,!1),[x,E]=f((t,n)=>{switch(n.type){case"buyerModifiedField":return!w&&A.name&&M(),{status:"modified"};case"setInitialValue":return"modified"===t.status?t:n.value&&n.value.trim().length>0?(N(),{status:"prefilled",value:n.value}):{status:"empty"};case"prefillValueChanged":return"modified"===t.status?t:n.value&&n.value.trim().length>0?(F(n.value),{status:"prefilled",value:n.value}):(O(),{status:"empty"});case"clearField":return M(),O(),S.setFocus(e),{status:"modified"}}},{status:"empty"}),I=n(()=>{E({type:"buyerModifiedField"})},[]),L=Ht({active:Boolean(s)}),B=n(e=>{d&&!e&&E({type:"buyerModifiedField"}),p(e)},[p,d]),{hasInitialValue:D,isFilled:T}=bs({placeholder:r,label:t,name:e,initialValue:u,themeStyles:h,themeStylesVersion:v,onChange:B,onBlur:I,empty:y}),N=n(()=>{_("name"),p(!1),S.setPlaceholderContent(e,""),S.setStyles({field:e,styles:{padding:h.padding.floating}})},[e,S,h,_,p]),F=n(e=>{S.setValue("name",e),S.setErrors({name:null}),N()},[S,N]),O=n(()=>{p(!0),S.clearField(e),S.setPlaceholderContent(e,P),S.setStyles({field:e,styles:{padding:h.padding.default}})},[p,S,P,e,h]),[V,z]=a(u);u!==V&&(E({type:"prefillValueChanged",value:u}),z(u)),"empty"===x.status&&D&&!C[e]&&E({type:"setInitialValue",value:u});const R=n(()=>{E({type:"clearField"})},[]),H=T&&m&&!w;return i(gs,{hidden:o,border:c,loading:l,error:s,focused:d,children:[i("div",{className:g("KAqU2",{[As]:H}),id:e,"data-card-fields":e,"data-card-field-placeholder":P,"data-card-field-prefix":b.translate("payment.card_fields_container_prefix"),"data-card-field-name-initial-value":u,ref:L,tabIndex:-1,onFocus:()=>{S.setFocus(e)}}),H&&i(ws,{onPress:R}),i(fs,{ready:!l})]})}function ws({onPress:e}){const{i18n:t}=k();return i("div",{className:"lxxqW",children:i("div",{className:"z8T28",children:i(Nt,{accessibilityLabel:t.translate("payment.clear"),onClick:e,children:i(vt,{type:"x"})})})})}function Ms({icon:e,children:t,controlLabel:n}){return i(Je,{overlay:i(et,{children:t}),accessibilityLabel:n,children:i(vt,{type:e||"question"})})}const xs="1.1rem",Es={padding:{default:ea(`1.35rem ${xs}`),floating:ea(`2.05rem ${xs} 0.55rem`)}};function Is({errorMessageRef:e,fieldName:t,errorMessage:n,targetPath:a,shouldLog:s=!1}){const i=o(Wt()),{observability:l}=k();r(()=>{if(n&&n!==e&&(i.current({errorType:Lt.InputInvalid,value:"<redacted>",target:a,message:n,timestamp:new Date}
2),s)){const e={[t]:n};l.log("hosted_fields_payment_blocked","[Hosted Fields] Payment blocked due to validation errors",{cardFieldErrorLogs:e,origin:"inline"})}},[n,e,t,s,a,l])}function Ls(e){return e.replace(/^var\(|\)$/g,"")}const Bs={background:Ls(ye.color.default.control.background),text:Ls(ye.color.default.control.text),textSubdued:Ls(ye.color.default.control.textSubdued)},Ds={base:"base",loose:"loose",xloose:"xLoose"},Ts=new Map([["title","capitalize"],["upper","uppercase"],["lower","lowercase"],["none","none"]]);function Ns({cardBrands:e,prefillCardholderName:s=!1,customHostedFields:d,cvvOnly:c=!1,isSelected:u,paymentMethodIdentifier:m,cardNumberAccessory:p}){const y=Gt(),{client:h,i18n:v,checkout:f,observability:_,shop:C,webMcp:S}=k(),A=h.enableAgenticCardEntry.value&&Boolean(S)&&C.hasFlagEnabled(me),P=p??i(vt,{type:"lock"}),w=f.latestReceipt.value,M=w?.id;let x=!1;if(w&&Kt(w)){const e=w.failure;Xt(e)&&(x=!0)}const E=["ja","ja-jp"].includes(v.locale.toLowerCase()),I=s&&!E?y.value:void 0,L=o(null),{themeStyles:B,themeStylesVersion:D,updateThemeStyles:T}=function(){const{control:{labelPosition:e="inside"},textField:s}=jt(),i=o(),l=o(Es),d=o(!1),[c,u]=a(0),m=t(()=>({padding:{get default(){return l.current.padding.default},get floating(){return l.current.padding.floating}}}),[]),p=n(e=>{if(null===e)return;e&&(i.current=e);const t=i.current;if(!t)return;const n=getComputedStyle(t),a=n.getPropertyValue("--empty-padding-block").trim(),r=n.getPropertyValue("--filled-padding-block-start").trim(),s=n.getPropertyValue("--filled-padding-block-end").trim(),o=n.getPropertyValue("--padding-inline").trim();if(!(a&&r&&s&&o))return;const c={padding:{default:ea(`${a} ${o}`),floating:ea(`${r} ${o} ${s}`)}},m=c.padding.default!==l.current.padding.default||c.padding.floating!==l.current.padding.floating,p=d.current;d.current=!0,m&&(l.current=c,p&&u(e=>e+1))},[]);return r(()=>{const e=setTimeout(()=>p(),0);return()=>clearTimeout(e)},[e,s.typography?.size,p]),{themeStyles:m,themeStylesVersion:c,updateThemeStyles:p}}(),N=e.includes("MAESTRO"),{loading:F,focusedField:O,cardBrand:V,sdk:z,errors:R,subscribe:H,unsubscribe:j,emptyFields:$,resetTouched:U}=Qn(),q=V?Zn(V):void 0,Y=N&&"MAESTRO"===q,W=Ya(),G=o({}),{negotiated:K}=f.proposal,X=h.unstable_getSerialization("shopifyIdentificationSignature"),J=K.fields.checkoutCardsinkCallerIdentificationSignature?.value??X,{control:{labelPosition:Q="inside"},global:Z,textField:{typography:ee},typographyPrimary:te,typographySecondary:ne}=jt(),ae=Jt().customProperties.value,re={extraSmall:ae.fontSize?.extraSmall??Qt.fontSize.extraSmall,small:ae.fontSize?.small??Qt.fontSize.small,base:ae.fontSize?.base??Qt.fontSize.base,medium:ae.fontSize?.medium??Qt.fontSize.medium,large:ae.fontSize?.large??Qt.fontSize.large,extraLarge:ae.fontSize?.extraLarge??Qt.fontSize.extraLarge,extraExtraLarge:ae.fontSize?.extraExtraLarge??Qt.fontSize.extraExtraLarge},se=f.negotiator.parts.paymentLines.value,ie=ee?.fonts,le=ie?{primary:te.fonts,secondary:ne.fonts}[ie]:te.fonts,de=pe(le)??Qt.fontFamily.base,oe=L.current&&getComputedStyle(L.current),ce=oe?.getPropertyValue(Bs.text),ue=oe?.getPropertyValue(Bs.textSubdued),ye=oe?.getPropertyValue(Bs.background),he=ye??Qt.color.global.controlBackground,ge=ce??Qt.color.global.controlText,ve=ue??Qt.color.global.controlTextSubdued,fe=ea(re[ee?.size??"base"]),be=Qt.lineHeight.base,_e=Qt.letterSpacing[Ds[ee?.kerning??"base"]],Ce=ee?.decoration??"none",Se=ee?.letterCase??Z.typographyLetterCase,Ae=Se?Ts.get(Se):Ts.get("none"),ke=t(()=>({"background-color":he,"placeholder-lightness":"22","placeholder-color":ve,"font-family":de,"font-size":fe,"letter-spacing":_e,"line-height":be,color:ge,"text-decoration":Ce,"text-transform":Ae}),[he,de,fe,_e,be,ge,ve,Ce,Ae]),Pe=t(()=>({transition:"padding .2s ease-out"}),[]),we=g("CsSsR",Yt["outside"===Q?"labelOutside":"labelInside"]),Me=n(e=>{L.current=e,T(e)},[T]),xe=t(()=>{const e=[];return te?.sourceBase&&te?.fonts&&e.push({name:te.fonts,source:te.sourceBase}),ne?.sourceBase&&ne?.fonts&&e.push({name:ne.fonts,source:ne.sourceBase}),e},[te,ne]),Ee=t(()=>["name","number","expiry","verification_value","issue_date","issue_number"],[]),Ie=n(()=>
2{U(),Ee.forEach(e=>{z.clearField(e)}),z.setErrors({})},[U,z,Ee]);r(()=>{M&&x&&Ie()},[M,x,Ie]),b(()=>{let e,t=!1;function n(n){!t&&e&&(t=!0,_.histogram({name:"hosted_fields_loading_duration",value:performance.now()-e,attributes:{isTimeout:n}}))}let a,r=!1;function s(){r=!0}return window.addEventListener("blur",s,{once:!0}),async function(){L.current&&(H(),await z.setup(L.current,{agenticCardEntry:A,callerIdentificationSignature:J,locale:v.locale,styles:{...ke},translations:{name:v.translate("payment.name_on_card_placeholder"),number:v.translate("payment.card_number_placeholder"),expiry:v.translate("payment.card_expiry_placeholder"),verification_value:v.translate("payment.card_verification_value_placeholder"),issue_date:v.translate("payment.card_start_placeholder"),issue_number:v.translate("payment.card_issue_number_placeholder")},fonts:{local:xe},errorMessages:{name:v.translate("field_errors.credit_card_name_invalid"),number:v.translate("field_errors.credit_card_number_invalid"),number_blank:v.translate("field_errors.credit_card_number_blank"),expiry:v.translate("field_errors.credit_card_expiry_invalid"),verification_value:v.translate("field_errors.credit_card_verification_value_blank"),issue_date:v.translate("payment.card_fields.errors.required.issue_date"),issue_number:v.translate("payment.card_fields.errors.required.issue_number")},validationSetting:"mixed"},()=>{e=performance.now(),a=setTimeout(()=>{n(!0),_.counter({name:"hosted_fields_timeout",value:1,attributes:{buyerLeftBrowsingContext:r}}),_.log("hosted_fields_loading_timed_out","[HostedFields] Hosted fields timed out while loading.")},25e3)}),clearTimeout(a),n(!1))}(),()=>{window.removeEventListener("blur",s),clearTimeout(a)}},[L,H,z,A,J,ke,v,xe,_]),r(()=>()=>{j(),$(),z.teardown()},[j,$,z]),r(()=>{F||(z.setStyles({styles:{...Pe,...ke}}),xe.length&&z.loadFonts({local:xe}))},[F,Pe,ke,z,xe]),r(()=>{const e=W?.paymentMethodIdentifier;if(e!==m)return;const t={name:!W.name||d&&!d.includes("name")?null:v.translate("field_errors.credit_card_name_invalid"),number:(n=W,n?.number?"server"===n.number.origin?v.translate("field_errors.credit_card_number_invalid"):n.number.message:null),expiry:!W.expiry||d&&!d.includes("expiry")?null:v.translate("field_errors.credit_card_expiry_invalid"),verification_value:!W.verificationValue||d&&!d.includes("verification_value")?null:v.translate("field_errors.credit_card_verification_value_blank"),issue_date:!W.issueDate||d&&!d.includes("issue_date")?null:v.translate("payment.card_fields.errors.required.issue_date"),issue_number:!W.issueNumber||d&&!d.includes("issue_number")?null:v.translate("payment.card_fields.errors.required.issue_number")};var n;z.setErrors(t)},[z,v,W,m,d]),r(()=>{const{number:e,name:t,expiry:n,verificationValue:a}=W;if(W?.number||W?.name||W?.expiry||W?.verificationValue){const r={number:e?.message,name:t?.message,expiry:n?.message,verification_value:a?.message};_.log("hosted_fields_payment_blocked","[Hosted Fields] Payment blocked due to validation errors",{cardFieldErrorLogs:r,origin:"progression"})}},[W,_]),Is({errorMessageRef:G.current.number,fieldName:"number",errorMessage:R.number,targetPath:"cart.paymentLines[0].card.number",shouldLog:!0}),Is({errorMessageRef:G.current.expiry,fieldName:"expiry",errorMessage:R.expiry,targetPath:"cart.paymentLines[0].card.expiry",shouldLog:!0}),Is({errorMessageRef:G.current.verification_value,fieldName:"verification_value",errorMessage:R.verification_value,targetPath:"cart.paymentLines[0].card.verificationValue",shouldLog:!0}),Is({errorMessageRef:G.current.name,fieldName:"name",errorMessage:R.name,targetPath:"cart.paymentLines[0].card.name",shouldLog:!0}),Is({errorMessageRef:G.current.issue_number,fieldName:"issue_number",errorMessage:R.issue_number,targetPath:"cart.paymentLines[0].card.issueNumber"}),Is({errorMessageRef:G.current.issue_date,fieldName:"issue_date",errorMessage:R.issue_date,targetPath:"cart.paymentLines[0].card.issueDate"});const Le=se.some(e=>"direct"===e.method.type);Ge({active:(null==u?Le:u)&&(F||Boolean(R.sdk))});const Be=e=>!!d&&!d.includes(e),De=i("div",{hidden:Be("expiry"),children:i(ks,{name:"expiry",label:v.translate("payment.card_expiry_label"),placeholder:v.translate("payment.card_expiry_placeholder"),loading:F,focused:"expiry"===O,error:R.expiry,hidden:Be("expiry"),themeStyles:B,themeStylesVersion:D})}),Te=i("div",{hidden:Be("issue_date"),children:i(ks,{name:"issue_date",label:v.translate("payment.card_start_label"),placeholder:v.translate("payment.card_start_placeholder"),hidden:!Y||Be("issue_date"),error:R.issue_date,themeStyles:B,themeStylesVersion:D})}),Ne=i("div",{hidden:Be("issue_number"),children:i(ks,{name:"issue_number",label:v.translate("payment.card_issue_number_label"),placeholder:v.translate("payment.card_issue_number_placeholder"),hidden:!Y||Be("issue_number"),error:R.issue_number,themeStyles:B,themeStylesVersion:D})}),Fe=i("div",{hidden:Be("verification_value"),children:i(ks,{name:"verification_value",label:v.translate("payment.card_verification_value_label"),placeholder:v.translate("payment.card_verification_value_placeholder"),loading:F,focused:"verification_value"===O,error:R.verification_value,accessory:i(Ms,{control
2Label:v.translate("tooltip.accessibility_label_context",{context:v.translate("payment.card_verification_value_label")}),children:q?"AMEX"===q?v.translate("payment.card_verification_value_explanation_amex"):v.translate("payment.card_verification_value_explanation_other"):v.translate("payment.card_verification_value_explanation")}),hidden:Be("verification_value"),themeStyles:B,themeStylesVersion:D})});if(c)return i("div",{ref:Me,className:we,children:[Fe,i(ks,{name:"name",hidden:!0,label:v.translate("payment.name_on_card_label"),themeStyles:B,themeStylesVersion:D}),i(ks,{name:"number",hidden:!0,label:v.translate("payment.card_number_label"),themeStyles:B,themeStylesVersion:D}),i(ks,{name:"expiry",hidden:!0,label:v.translate("payment.card_expiry_label"),themeStyles:B,themeStylesVersion:D}),i(ks,{name:"issue_date",hidden:!0,label:v.translate("payment.card_start_label"),themeStyles:B,themeStylesVersion:D}),i(ks,{name:"issue_number",hidden:!0,label:v.translate("payment.card_issue_number_label"),themeStyles:B,themeStylesVersion:D})]});const Oe=d&&d.filter(e=>"expiry"===e||"verification_value"===e).length<=1,Ve=d&&d.filter(e=>"issue_date"===e||"issue_number"===e).length<=1;return i("div",{ref:Me,className:we,children:i(Qa,{children:[i(ks,{name:"number",label:v.translate("payment.card_number_label"),placeholder:v.translate("payment.card_number_placeholder"),loading:F,focused:"number"===O,error:R.number,accessory:P,themeStyles:B,themeStylesVersion:D}),i(Oe?l:Za,{children:[De,Fe]}),i("div",{hidden:!Y,children:i(Ve?l:Za,{children:[Te,Ne]})}),i("div",{hidden:Be("name"),children:i(ks,{name:"name",label:v.translate("payment.name_on_card_label"),placeholder:v.translate("payment.name_on_card_placeholder"),loading:F,focused:"name"===O,error:R.name,initialValue:I,allowClear:s,hidden:Be("name"),themeStyles:B,themeStylesVersion:D})})]})})}function Fs({open:e}={}){const{i18n:t}=k(),{selectedNetwork:n}=Wn();return i(pt,{id:"network-selection-info-banner",duration:"fast",open:e??Boolean(n),children:i(Ze,{size:"small",color:"subdued",children:t.translate("payment.network_card_persistence_description")})})}function Os(){const{i18n:e}=k();return i(tn,{children:i(Xe,{gap:"small-300",children:[i(gt,{level:3,children:e.translate("payment.bogus_test_checkout.title")}),i(Xe,{gap:"small-400",children:[i(ft,{children:e.translate("payment.bogus_test_checkout.intro")}),i(Zt,{gap:"small-400",children:[i(en,{children:e.translate("payment.bogus_test_checkout.approved_transaction",{card_number:i(Ze,{type:"strong",children:"1"})})}),i(en,{children:e.translate("payment.bogus_test_checkout.declined_transaction",{card_number:i(Ze,{type:"strong",children:"2"})})}),i(en,{children:e.translate("payment.bogus_test_checkout.gateway_failure",{card_number:i(Ze,{type:"strong",children:"3"})})})]}),i(ft,{children:e.translate("payment.bogus_test_checkout.additional_instructions")})]}),i(Ze,{color:"subdued",children:i(Nt,{href:"https://help.shopify.com/en/manual/checkout-settings/test-orders/payments-test-mode#test-payment-gateway",target:"_blank",tone:"monochrome",children:e.translate("payment.bogus_test_checkout.support_link")})})]})})}function Vs(){const{i18n:t,checkout:n}=k(),a=function(){const{checkout:t}=k(),{buyerIdentity:n,paymentMethods:a}=t.negotiator.current.fields,{paymentLines:r}=t.negotiator.parts;return e(()=>{const e=t.addressManager.billing.value.suggestedAddress,s=n.value?.purchasingCompany,i=Boolean(he(a.value).length),l=e.value.type,d=r.value.some(({method:e})=>"direct"===e.type);return s?i||!d?null:l?"selector":"form":null})}(),r=n.addressManager.billing.value,s=r.suggestedAddress.value,d=s.address,o=s.type,c=n.negotiator.parts.shippingAddress.value;ut();const u=r.selectedAddress.value?.id===er,m=Dt(d),p="billing-fact"===o?t.translate("payment.use_order_billing_address_label"):"billing"===o?t.translate("payment.use_location_billing_address_label"):"shipping"===o?t.translate("payment.use_location_shipping_address_label"):void 0;return i(nt,{children:[i(y,{when:()=>"selector"===a.value,children:i(mt,{id:"billingAddress",name:"billingAddress",checked:u,onChange:e=>{e&&d&&o?r.selectAddress(er):function(){const e=H({countryCode:c.countryCode});r.addresses.value.some(e=>e.id===tr)?r.updateAddress({id:tr,address:e}):r.createAddress({address:e})}()},label:i(l,{children:[p,i(ft,{color:"subdued",children:m})]})})}
2),i(y,{when:a,children:i(pt,{id:"billingAddressDetails",open:null===o||!u,children:[i(yt,{blockSize:"large-300"}),i(gt,{level:2,children:t.translate("payment.billing_address_title")}),i(yt,{blockSize:"base"}),i(Sa,{})]})})]})}const zs=e=>i("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 60 60",...e,children:i("g",{fillRule:"evenodd",children:[i("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"}),i("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"}),i("rect",{width:2,height:27,x:29,y:11,rx:1})]})});function Rs(){const{errors:e,sdkLoadDiagnostics:t}=Qn(),{router:n,i18n:a,observability:s}=k();return r(()=>{if(e.sdk){const n=t?.errorCause;s.counter({name:"card_fields_sdk_load_error",value:1,attributes:{error:e.sdk,..."string"==typeof n?{error_cause:n}:{}}}),s.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,s,t]),i("div",{className:"e3sCv",children:[i(zs,{className:"hevoz"}),i(Xe,{gap:"small-200",children:i(ft,{children:i(nn,{children:a.translate("payment.card_fields_unavailable_html",{count:1,current_url:n.currentUrl.value.toString()})})})})]})}const Hs=e=>i("svg",{xmlns:"http://www.w3.org/2000/svg",width:102,height:52,viewBox:"-270.8 371 102 52",...e,children:[i("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"}),i("circle",{cx:-255.5,cy:376.5,r:1.5,fill:"inherit"}),i("circle",{cx:-250.5,cy:376.5,r:1.5,fill:"inherit"}),i("circle",{cx:-245.5,cy:376.5,r:1.5,fill:"inherit"})]});function js(){const{i18n:e}=k();return i("div",{className:"_2wkMu",children:i(Xe,{gap:"large-200",children:[i(Hs,{className:"H55oQ"}),i(ft,{children:e.translate("payment.no_js_credit_card_fields_redirect_hint")})]})})}function $s({id:e,brand:t,displayLastDigits:n,details:a,onEdit:r,onDelete:s,requiresVerification:l}){const{i18n:d}=k(),{closeOverlay:o}=an(),c=L(t),u=`${d.translate("payment.masked_digits_label",{last_digits:n})}`,m=`• ${n}`,p=()=>{s&&s(e),o("actions-overlay")};return i(Xe,{gap:"small-500",children:[i(Qe,{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:[i(Xa,{type:t}),i(ft,{children:i(Ze,{type:"strong",children:[c," ",i("span",{className:"_1yB1O",children:l?m:u})]})}),i(Qe,{gridAutoFlow:"column",gridAutoColumns:"minmax(0, 1fr)",gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",children:[!r&&s?i(Je,{onClick:p,accessibilityLabel:d.translate("payment.delete_credit_card_modal.title"),children:i(vt,{type:"delete",size:"small"})}):null,l?i(vt,{type:"alert-triangle",size:"small"}):null,r?i(Je,{overlay:i(ar,{connector:"none",offset:10,id:"actions-overlay",children:i(Qe,{gridAutoRows:"minmax(0, 1fr)",gridAutoColumns:"minmax(0, 1fr)",gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",gap:"base",justifyContent:"start",justifyItems:"start",children:[r&&i(Nt,{textDecoration:"none",onClick:()=>{r(),o("actions-overlay")},children:d.translate("payment.saved_credit_card_actions.edit")}),s&&i(bt,{variant:"plain",textDecoration:"none",tone:"critical",onClick:p,children:d.translate("payment.saved_credit_card_actions.delete")})]})}),children:i(vt,{type:"menu-vertical"})}):null]})]}),i(ft,{children:i("bdi",{children:a})})]})}function Us(e){const t=k(),{details:n,onEdit:a,onDelete:r}=function(e,{checkout:t}){return"businessCustomer"===t.identity.current.value?{details:e.displayCardholderName,onEdit:void 0,onDelete:e.isVaultedCard?void 0:e.onDelete}:{details:e.displayAddress,onEdit:e.onEdit,onDelete:e.onDelete}}(e,t);return i($s,{id:e.id,brand:e.brand,displayLastDigits:e.displayLastDigits,details:n,onEdit:a,onDelete:r,requiresVerification:e.requiresVerification})}const qs=["session_card"],Ys=()=>{};
2function Ws({cardDetails:e}){const{checkout:{negotiator:t}}=k(),{shippingAddress:n,billingAddress:a,billingAddressOption:r}=t.parts,s=ge(),{getAccessibilityLabel:l}=ta(),d=l(e),o="shipping"===r.value?n.value.address1:a.value.address1;return i(Rn,{values:qs,onChange:Ys,variant:"grid",children:i(zn,{id:"session_card",value:"session_card",accessibilityLabel:d,children:i(Us,{id:"session",isVaultedCard:!1,displayLastDigits:e.creditCardLastFourDigits,brand:e.brand,displayCardholderName:e.cardholderName,displayAddress:o,onDelete:()=>s()})},"session_card")})}function Gs({offsite:e,paymentMethod:n,sessionCard:s,isSelected:l,cardNumberAccessory:d}){const{errors:o}=Qn(),{i18n:c,shop:u,shopPay:m,checkout:p}=k(),y=n.paymentBrands?.includes("BOGUS")??!1,h=rn(n),{bankIdNumberSignal:g}=p.negotiator.context,v=p.configuration.layout.isOnePage.value,f=function(){const{sdk:e}=Qn(),[t,n]=a(0),[s,i]=a();return r(()=>{(async()=>{const t=await e.getCardField("number");i(t?._iFrame)})()},[e,t]),r(()=>{const e=()=>{n(e=>e+1)};return s?.addEventListener("load",e),()=>{s?.removeEventListener("load",e)}},[s]),t}(),b=p.negotiator.current.fields.buyerIdentity.value?.purchasingCompany,_=na().value,C=Wa(p.negotiator.parts.directPaymentErrors),{errorBannerInContext:S,billingAddressInContext:A,billingAddressVariant:P,isInModal:w,cardNickname:M,onCardNicknameChange:x}=re(Jr);r(()=>{let e;return s?.creditCardFirstDigits&&(g.value?.replace(/\s/g,"")??"").length<s.creditCardFirstDigits.length&&(e=s.creditCardFirstDigits,g.value=e),()=>{void 0!==e&&g.value===e&&(g.value=void 0)}},[s?.creditCardFirstDigits,g]);const E=!_&&A&&"inlineDirectMethod"===P,I=sn("Checkout::PaymentMethod::HostedFields::RenderAfter",void 0===n?.uiExtension?[]:[n.uiExtension]),L=p.negotiator.parts.shippingAddress.value,B=t(()=>({paymentMethodIdentifier:n.paymentMethodIdentifier}),[n.paymentMethodIdentifier]);if(o.sdk)return i(Rs,{});if(e)return i(js,{});const D=S&&C?i(It,{errorType:Lt.PaymentError,tone:"critical",children:c.translate("payment.generic_incorrect_card_info")}):null,T=s&&i(Ws,{cardDetails:s}),N=Boolean(b)&&v?i(Vs,{}):i(Pr,{}),F=function({checkout:e,shop:t,shopPay:n},a){return"shopPay"!==e.identity.current.value?t.sameBillingAndShippingAddress:!(!a?.firstName||!a?.lastName)&&n.user.addresses.value.some(({address:e})=>e.firstName===a.firstName&&e.lastName===a.lastName)}({checkout:p,shop:u,shopPay:m},L),O=function({checkout:e},t){if("shopPay"!==e.identity.current.value)return t.paymentMethodIdentifier}({checkout:p},n),V=i("div",{hidden:Boolean(s),children:[i(Ns,{cardBrands:n.paymentBrands??[],prefillCardholderName:F,isSelected:l,paymentMethodIdentifier:O,cardNumberAccessory:d},f),Ks({identity:p.identity})&&i(Fs,{})]});return i(Xe,{gap:"base",children:[D,y&&!s&&i(Os,{}),w&&x?i(Qa,{children:[V,i(Mt,{name:"cardNickname",label:c.translate("payment.card_nickname_label"),value:M??"",onChange:x,maxLength:ve})]}):V,T,I.length>0&&l&&n.paymentMethodIdentifier&&i(aa,{options:B,paymentMethodExtension:I}),h&&!w?i(ra,{paymentMethod:n,isSelected:l,canEditBin:!s}):null,E&&N]})}function Ks({identity:e}){return"shopPay"===e.current.value}function Xs({children:e,addCardModalOpen:t}){return r(()=>()=>{t.value=!1},[t]),i(l,{children:e})}function Js({paymentMethod:t,addCardModalOpen:r}){const{i18n:s,checkout:o,shop:c}=k(),{createAddressParts:u,buyerHasActedSignal:m}=o.negotiator.context,[p,h]=a(!1),g=Ga(),[v,f]=a(!1),b=d(void 0),C=o.negotiator.parts.billingAddress.value,S=o.negotiator.parts.acceptPaymentVaulting,A=Dt(C),P=fe(),w=be(),{value:M}=o.negotiator.current.fields.paymentFlexibilityPaymentTermsTemplate,{sdk:x,loading:E,validate:I,resetTouched:L}=Qn(),[B,D]=a(!1),T=ln().value,{negotiate:N}=We(),F=sa(),O=e(()=>!F.value),{rollup:{action:{tone:V}={}}={}}=jt(),z=o.addressManager.billing,R=z.value,H=o.negotiator.current.fields.buyerIdentity,j=H.value?.purchasingCompany,$=!j&&"CustomerProfile"===H.value?.customerProfile?.__typename,U=R.errors.fields,q=dn(C?.countryCode),Y=n(e=>{q("billing_address",e).forEach((e,t)=>{U[t].value=e})},[U,q]),{value:W}=o.negotiator.current.fields.deferredTotal,G=u.addressModalState.value,K=d(void 0),X=d(!1),J="billing"===G.addressType&&("editing"===G.status||"adding"===G.status),Q=null!=K.value||J,Z=J&&"editing"===G.status,ee=X.value||Z?s.translate("edit_credit_card_modal.edit_address_title"):s.translate("billing.address_form.add_address"),te=d(void 0),ne=n(async e=>z.value.createAddress({address:e}),[z]),ae=n(async e=>{const t=te.value??("editing"===u.addressModalState.value.status?u.addressModalState.value.addressId:void 0);if(t)return await z.value.updateAddress({id:t,address:e})},[z,te,u.addressModalState]),re=Z||X.value&&$?ae:ne,ie=n(async e=>{const t=await re(e);return t&&$&&await N({fieldsToResolve:["paymentMethods"]}),t},[re,N,$]),le=n(()=>{p&&Q?(K.value=void 0,X.value=!1,te.value=void 0,b.value=void 0,J&&(u.addressModalState.value={status:"idle",addressType:"billing",setAsDefault:"default"})):B||(g(),L(),S.value=!1,h(!1),f(!1),u.addressModalState.value={status:"idle",addressType:"shipping",setAsDefault:"default"})},[p,Q,J,B,u.addressModalState,S,g,L,b,K,X,te]),de=()=>{j||(o.negotiator.parts.billingAddressOption.value="custom"),f(e=>!e)},oe=n(()=>{const e=R.addresses.value[0],t=o.configuration.addressSettings.billingAddressSettings.value.defaultShippingDetails.country.code,n=_e({firstName:e?.address.firstName,lastName:e?.address.lastName,countryCode:t??e?.address.countryCode},{extendedAddressMode:o.address.extendedAddressMode});K.value=n},[R.addresses,o,K]),ce=se(c),ue=n(async()=>{await os({validateCardFields:I,vaultCard:()=>x.vaultCard(),paymentMethodIdentifier:t.paymentMethodIdentifier,getDue:()=>Ce(W,Boolean(P.value),w.value,M?.type),parts:o.negotiator.parts,newCard:F,buyerHasActedSignal:m,negotiate:N,setLoading:D,fixSubscriptionRedeemablePaymentAmount:ce,openBilling:()=>f(!0),close:()=>{h(!1),f(!1)},onAddressError:e=>{if($){const t=z.value.selectedAddress.value;t&&(b.value=t,Y(e))}else Y&&Y(e)}})},[F,m,I,t,N,x,W,P,w,o.negotiator.parts,Y,M?.type,$,z,b,ce]),me=_(G),pe=e(()=>"billing"===me.value.addressType?o.configuration.addressSettings.billingAddressSettings.value:o.configuration.addressSettings.nonBillingAddressSettings.value),ye="shipping"===G.addressType,he=()=>{K.value=void 0,X.value=!1,te.value=void 0,b.value=void 0,f(!1),J&&(u.addressModalState.value={status:"idle",addressType:G.addressType,setAsDefault:"default"})},ge=ye?s.translate("address_management.address_form.save"):s.translate("billing.address_form.save"),ve=ye?s.translate("address_management.address_form.cancel"):s.translate("billing.address_form.cancel"),Se=Boolean(j)&&"shipping"===G.addressType?s.translate("shipping.address_form.one_time_address_subtitle"):"",Ae=Q?ee:s.translate("payment.add_credit_card_modal.title"),ke=R.isMissingValidSuggestedAddress.value,Pe="businessCustomer"===o.identity.current.value,we=$?i(ys,{open:v,onToggle:de,onAddAddress:oe,errorAddress:b,onEditErrorAddress:()=>{const e=R.selectedAddress.value;e&&(X.value=!0,te.value=e.id,K.value=_e(e.address,{extendedAddressMode:o.address.extendedAddressMode}))}}):Pe?i(cs,{open:v,onToggle:de}):i(Fa,{id:"billingAddress",label:s.translate("payment.billing_address_title"),open:v||ke,onToggle:ke?void 0:de,primaryContent:ke?void 0:A,children:i(Xe,{gap:"base",children:i(ds,{hideAddressModal:!0})})}),Me=p&&Q?{open:!0,content:i(l,{children:[Se&&i(nt,{padding:"base",children:i(ft,{color:"subdued",children:Se})}),i(Xe,{gap:"base",children:i(Ba,{editableAddress:K.value??G.address,addressType:K.value?"billing":G.addressType,saveText:ge,cancelText:ve,onSave:ie,onSuccess:he,onCancel:he,showSavedAddressSelector:null!=K.value&&!X.value||R.canCreateAddress.value,addressErrorsSignal:U,combineViolationAndValidationErrors:Z,addressSettings:pe.value})})]})}:void 0;return i(Xe,{gap:"base",children:[i(y,{when:O,children:i(bt,{tone:"custom"===V?"custom"
2:void 0,onClick:()=>{h(!0),r.value=!0,g(),L(),K.value=void 0;const e=R.selectedAddress.value;$&&e&&(o.negotiator.parts.billingAddress.value=e.address,o.negotiator.parts.billingAddressOption.value="custom")},variant:"plain",textDecoration:"none",children:i(Xe,{direction:"inline",gap:"small-400",alignItems:"center",justifyContent:"center",children:[i(vt,{type:"plus",size:"small"}),i(Ze,{children:s.translate("payment.use_different_credit_card_label")})]})})}),i(ss,{size:"large",open:p,onClose:le,heading:Ae,cardForm:i(Xs,{addCardModalOpen:r,children:i(Gs,{paymentMethod:t})}),billingAddressSection:we,afterBillingAddress:T?i(qr,{forceVaultingEligible:!0,blockNegotiations:!0}):void 0,onSave:ue,loading:B||E,createAddressForm:Me})]})}const Qs={rollup:{blockPadding:"base",inlinePadding:"none"}};function Zs({open:e,onCancel:t,onSave:n,card:s,billingAddress:o,isDefaultCard:c,onDefaultCardChange:u,error:m,addressErrorsSignal:p,initialShowAddressForm:h=!1}){const{i18n:g,checkout:v,shop:f}=k(),b=Aa(),_=v.configuration.addressSettings.billingAddressSettings.value,{nickname:C}=s,[S,A]=a(!1),P=d(!1),w=d(C);r(()=>{e&&(P.value=h,w.value=C)},[e,C,P,w,h]);const M=async()=>{A(!0),await n(o,w.value)&&t(),A(!1)},x=void 0!==C,E=void 0!==u,I=i(Bt,{submitText:g.translate("payment.card_form.save"),cancelText:g.translate("payment.card_form.cancel"),loading:S,disabled:S,handleSubmit:M,handleCancel:t});return i(wa,{open:e,heading:P.value?g.translate("edit_credit_card_modal.edit_address_title"):g.translate("edit_credit_card_modal.edit_card_title"),onHide:t,primaryAction:P.value?void 0:I,children:i(y,{when:P,fallback:(()=>{const e=i(nt,{border:"base",borderRadius:"base",padding:"none base",children:i(Fa,{label:g.translate("payment_ux.bill_to"),primaryAction:i(bt,{variant:"plain",onClick:()=>{P.value=!0},children:i(Ze,{children:g.translate("edit_credit_card_modal.edit_button")})}),primaryContent:i(Na,{address:o,nameLinePosition:"block"})})});return i(l,{children:[m&&i(Xe,{gap:"base",padding:"base none",children:i(It,{tone:"critical",errorType:Lt.PaymentError,children:m})}),E&&i(l,{children:[i(mt,{id:"default",name:"default",checked:c??!1,onChange:u,label:g.translate("payment.edit_credit_card_modal.fields.default")}),i(yt,{blockSize:"small-200"})]}),i(Ze,{children:g.translate("edit_credit_card_modal.edit_address_only_note")}),i(yt,{blockSize:"small-200"}),i(dt,{disabled:!1,onSubmit:M,children:i(Qa,{children:[i(Mt,{name:"cardNumber",label:g.translate("payment.card_number_label"),readOnly:!0,value:`···· ···· ···· ${s.lastDigits}`,disabled:!0}),i(Za,{children:[i(Mt,{name:"expiryLabel",label:g.translate("payment.card_expiry_label"),readOnly:!0,value:Se(s.expiryMonth,s.expiryYear),disabled:!0}),i(Mt,{name:"cardVerification",label:g.translate("payment.card_verification_value_label"),readOnly:!0,value:"···",disabled:!0})]}),i(Mt,{name:"cardHolderName",label:g.translate("payment.name_on_card_label"),readOnly:!0,value:s.cardholderName||"············",disabled:!0}),x&&i(Mt,{name:"cardNickname",label:g.translate("payment.card_nickname_label"),value:w.value||"",onChange:e=>{w.value=e},maxLength:ve})]})}),i(yt,{blockSize:"base"}),f.hasFlagEnabled(de)?i(Va,{theme:Qs,children:e}):e]})})(),children:i(Ba,{onCancel:()=>{P.value=!1},onSuccess:t,onSave:async e=>await n(e,w.value)?{id:"edit-card-billing",address:e}:void 0,cancelText:g.translate("credit_card_form.go_back"),saveText:g.translate("edit_credit_card_modal.save_billing_address"),editableAddress:_e(o,{extendedAddressMode:v.address.extendedAddressMode}),addressType:"billing",countriesOverride:b.value,addressErrorsSignal:p,addressSettings:_})})})}function ei({paymentMethodId:e,cvvError:t}={}){const{i18n:n,checkout:{negotiator:a}}=k(),{sdk:s,validate:l,loading:d}=Qn(),o="INCORRECT_CVC"===t?n.translate("payment_errors.incorrect_cvc"):null;return r(()=>(d||s.setErrors({verification_value:o}),()=>{s.setErrors({verification_value:null})}),[s,o,d]),x(async({reason:t})=>{if("completion"!==t)return{behavior:"allow"};const{isValid:n}=l(!0);if(!n)return{behavior:"block",reason:E.CvvFieldIsInvalid};const r=await s.vaultCard(),i=a.parts.paymentLines.peek();return a.parts.paymentLines.value=i.map(t=>t.method.type!==I.CreditCard||e&&t.method.token!==e?t:{...t,method:{...t.method,cvvSessionId:r}}),{behavior:"allow"}}
2),i(nt,{children:[i(yt,{blockSize:"base"}),i(on,{}),i(yt,{blockSize:"base"}),i(Xe,{gap:"small-300",children:[i(ft,{color:"subdued",children:n.translate("payment.saved_credit_card_cvv_verification")}),i(Qe,{gridAutoFlow:"column",gridTemplateColumns:"minmax(0, 1.5fr) minmax(0, 1fr)",gridAutoColumns:"1fr",gridTemplateRows:"minmax(0, 1fr)",gap:"none",alignItems:"center",alignContent:"center",children:i(Ns,{cardBrands:[],prefillCardholderName:!1,cvvOnly:!0})})]})]})}function ti(e){if(e.immutableAddresses.value.find(e=>e.id===er))return void e.selectAddress(er);const t=e.suggestedAddress.value;t.address&&e.createAddress({address:t.address})}function ni({billingAddress:e,billingAddressOption:t,shippingAddress:n}){const{countryCode:a,zoneCode:r}=e.value??{};e.value={...Ae(void 0,a,r),...n.value},t.value="shipping"}class ai extends Error{constructor(){super(...arguments),this.name="DeleteCardModalError"}}function ri({paymentToDelete:e,onClose:t,setSelected:n}){const{checkout:r,i18n:s,observability:l}=k(),d=r.addressManager.billing.value,{negotiate:o}=We(),{paymentMethods:c,shippingAddress:u,buyerIdentity:m}=r.negotiator.current.fields,p=he(c.value),y=sa(),{acceptPaymentVaulting:h,billingAddress:g,billingAddressOption:v,paymentLines:f}=r.negotiator.parts,[b,_]=a(!1),C=m.value?.purchasingCompany,{onSubmit:S,error:A,resetError:P}=function(){const{i18n:e,graphql:{coreGraphql:t}}=k(),[n,r]=a("");return{onSubmit:async n=>{if(!n)return{token:void 0};r("");const a=await la({graphql:t,token:n,genericError:e.translate("customer_payment_methods.delete_customer_mandate.generic_error")});return a.error&&r(a.error),{token:a.token}},error:n,resetError:()=>r("")}}(),w=A?i(Xe,{gap:"base",children:i(It,{tone:"critical",errorType:Lt.PaymentError,children:A})}):null;return i(cn,{size:"base",open:Boolean(e),heading:s.translate("payment.delete_credit_card_modal.title"),onHide:()=>{t(),P()},children:[i(Xe,{gap:"base",padding:"base none large-300 none",children:[w,i(ft,{children:i(Ze,{color:"subdued",children:s.translate("payment.delete_credit_card_modal.confirmation",{brandName:e?.brandLabel??"",lastDigits:e?.lastDigits??""})})})]}),i(Bt,{submitText:s.translate("payment.delete_credit_card_modal.delete"),cancelText:s.translate("payment.delete_credit_card_modal.cancel"),submitButtonAppearance:"critical",handleSubmit:async()=>{_(!0);try{e?.token?await async function({token:e,savedCreditCards:t,newCardValue:n,setSelected:a,deleteVaultedCreditCard:r,negotiate:s,onComplete:i}){if(1===t.length)a("direct");else{const r=t.find(t=>t.token!==e);r&&a(n?"direct":ke(r))}const{token:l}=await r(e);l&&await s({fieldsToResolve:["paymentMethods"],force:!0,onComplete(e){"success"===e.status&&i()}})}({token:e.token,savedCreditCards:p,newCardValue:y.value,setSelected:n,deleteVaultedCreditCard:S,negotiate:o,onComplete:t}):e?.id===Pe?function({newCardSignal:e,savedCreditCards:t,setSelected:n,paymentLines:a,acceptPaymentVaulting:r,isBusinessCustomer:s,billingManager:i,billingAddress:l,billingAddressOption:d,shippingAddress:o,onComplete:c}){if(!e.value)return c?.(),!1;e.value=void 0,r.value=!1;const u=t[0];u?(n(ke(u)),i&&ti(i)):a.value=a.value.filter(e=>"direct"!==e.method.type),s||ni({billingAddress:l,billingAddressOption:d,shippingAddress:o}),c?.()}({newCardSignal:y,savedCreditCards:p,setSelected:n,paymentLines:f,acceptPaymentVaulting:h,isBusinessCustomer:Boolean(C),billingManager:d,billingAddress:g,billingAddressOption:v,shippingAddress:u,onComplete:t}
2):l.error(new ai("Delete pressed with no actionable paymentToDelete"))}finally{_(!1)}},handleCancel:t,loading:b,disabled:b})]})}function si({savedCreditCards:e,selected:s,setSelected:d,isSelected:c,isInModal:u,setSelectedSavedCreditCardBrand:m,addCardModalOpen:p,msiAvailable:h=!1}){const{userEvents:g,shop:{id:v,storeVaultEnabled:f,storeVaultGuestCvvVerificationEnabled:b},source:{checkoutSessionIdentifier:_},checkout:{negotiator:C}}=k(),S=sa(),{bankIdNumberSignal:A,lastNegotiatedBinSignal:P}=C.context,[w,M]=a(null),[x,E]=a(!1),{onSubmit:I,error:B,resetError:D}=function(){const{i18n:e,checkout:{address:{extendedAddressMode:t}},graphql:{coreGraphql:n}}=k(),[r,s]=a("");return{onSubmit:async({address:a,defaultPaymentMethod:r,token:i})=>{if(!i)return{token:void 0};s("");const l=await ia({graphql:n,address:a,extendedAddressMode:t,defaultPaymentMethod:r,token:i,genericError:e.translate("shipping.address_form.generic_error")});return l.error&&s(l.error),{token:l.token}},error:r,resetError:()=>s("")}}(),[T,N]=a(!1),F=t(()=>we(),[]),[O,V]=a(null),z=na().value,R=p?.value??!1,H=C.parts.billingAddress.value,{getAccessibilityLabel:j}=ta(),$=t=>e.find(e=>{const n=t.split("-")[1];return e.token===n}),U=$(s),q=S.value,Y=c&&U?.requiresCvvConfirmation&&b&&!R&&!u,W=o(s);r(()=>{const e=W.current;if(W.current=s,m?.(U?.brand),s===Pe){if(z){const e=q?.creditCardFirstDigits;return void(h&&Nn(A.value,e)||(A.value=e))}e!==Pe&&(A.value=void 0)}else A.value=U?.firstDigits},[A,m,U,s,q,z,h]),r(()=>{w&&N(w.defaultPaymentMethod)},[w]);const G=e=>{e===Pe&&V({id:e,lastDigits:S.value?.creditCardLastFourDigits??"",brandLabel:S.value?.brand?L(S.value?.brand):""})},{negotiate:K}=We(),X=n(e=>async function({address:e,defaultPaymentMethod:t,token:n,onEditCardSubmit:a,negotiate:r}){const{token:s}=await a({defaultPaymentMethod:t,address:e,token:n});return!!s&&new Promise(e=>{r({fieldsToResolve:["paymentMethods"],force:!0,onComplete(t){e("success"===t.status)}})})}({address:e,defaultPaymentMethod:T,token:w?.token,onEditCardSubmit:I,negotiate:K}),[T,w,K,I]),J=n(()=>{E(!1),D()},[D]),Q={lastDigits:w?.displayLastDigits??"",expiryMonth:w?.expiryMonth??0,expiryYear:w?.expiryYear??0,cardholderName:w?.cardholderName??""};return i(Rn,{values:[s],onChange:e=>(e=>{const t=$(e),n=A.peek();let a;a=e===Pe?z?q?.creditCardFirstDigits:void 0:t?.firstDigits,h&&e===Pe&&z&&Nn(n,a)||(A.value=a);const r=A.peek();h&&(C.parts.paymentLines.value=un(C.parts.paymentLines.value),P.value=r),K({force:!0,negotiationStage:"negotiation"}).catch(()=>{h&&P.peek()===r&&(P.value=void 0)}),d(e),t&&da({userEvents:g,shopId:v,checkoutSessionIdentifier:_,card:t})})(e[0]??""),variant:"grid",children:[z&&i(y,{when:S,children:e=>i(zn,{id:"direct",value:"direct",accessibilityLabel:j(e),children:e.brand&&e.creditCardLastFourDigits&&i(Us,{id:"direct",isVaultedCard:!1,brand:e.brand,displayLastDigits:e.creditCardLastFourDigits,displayCardholderName:e.cardholderName,displayAddress:H.address1,onDelete:G})},"direct")}),e.map(e=>i(zn,{id:ke(e),value:ke(e),accessibilityLabel:j(e),children:i(Us,{id:ke(e),isVaultedCard:!0,brand:e.brand,displayLastDigits:e.displayLastDigits,displayCardholderName:e.cardholderName||void 0,displayAddress:e.billingAddress.address1,requiresVerification:b&&e?.requiresCvvConfirmation,onEdit:f?()=>{M(e),E(!0)}:void 0,onDelete:f&&e.deletable?()=>V({token:e?.token,lastDigits:e.displayLastDigits,brandLabel:e?.brand?L(e?.brand):""}):void 0})},ke(e))),(z||f)&&i(l,{children:[i(ri,{setSelected:d,paymentToDelete:O,onClose:()=>{V(null)}}),w&&i(Zs,{open:x,onCancel:J,onSave:X,card:Q,billingAddress:w.billingAddress,isDefaultCard:T,onDefaultCardChange:N,error:B,addressErrorsSignal:F})]}),Y&&i(ei,{})]})}function ii({numExpired:e}){const{i18n:t}=k();return i(ft,{type:"small",color:"subdued",children:t.translate("payment.expired_cards_info",{count:e})})}function li({savedCreditCards:e,selected:t,setSelected:n,isSelected:s,isModalOpen:l,onModalClose:d}){const{i18n:o}=k(),c=oa(),[u,m]=a(t);r(()=>{m(t)},[t]);const p="@media (inline-size >= small) fit-content, fill",h=i(bt,{variant:"primary",inlineSize:p,onClick:()=>{d(),u&&n(u)},children:o.translate("payment.saved_credit_cards_modal.done")}),g=i(bt,{variant:"plain",inlineSize:p,onClick:d,children:o.translate("payment.saved_credit_cards_modal.cancel")});return i(cn,{open:l,heading:o.translate("payment.saved_credit_cards_modal.view_all_label"),onHide:d,primaryAction:h,secondaryActions:g,children:i(Xe,{gap:"small-300",children:[i(si,{savedCreditCards:e,selected:u,setSelected:e=>m(e),isSelected:s,isInModal:!0}),i(yt,{blockSize:"small-500"}),i(y,{when:c,children:e=>i(ii,{numExpired:e})})]})})}function di({offsite:e=!1,paymentMethod:t,setSelected:n,isSelected:s,showExistingCreditCards:o=!0,setSelectedSavedCreditCardBrand:c,cardNumberAccessory:u}){const{i18n:m,checkout:{identity:p,negotiator:y},userEvents:h,shop:{id:g},source:{checkoutSessionIdentifier:v}}=k(),f=rn(t),{paymentMethods:b}=y.current.fields,_=o?function({identity:e},t){return"shopPay"===e.current.value?[]:he(t)}({identity:p},b.value):[],C=_.length>0,S=sa(),[A,P]=a(_),w=A?.length>4,[M,x]=a(!1),E=Me().value,L=E.length,B=L>0,{paymentLines:D}=y.parts,T=D.value,N=C?function(e,t){const n=t.find(e=>e.defaultPaymentMethod),a=e.find(e=>[I.CreditCard,"direct"].includes(e.method.type))?.method;return a?a.type===I.CreditCard?ke(a):a.type:ke(n||t[0])}(T,A):Pe,F=N===Pe,O=or(),V=o?O.value:void 0,z=na().value,R=d(!1),{resetTouched:H}=Qn(),j=Ga(),$=()=>{j(),H()},U=(e,t)=>{const{isHidden:n,hiddenReason:a}=e.expired?{isHidden:!0,hiddenReason:"expired"}:t>=4?{isHidden:!0,hiddenReason:"pagination"}:{isHidden:!1,hiddenReason:""};h.monorailEvent({schemaId:"checkout_vaulted_payment_method_rendered/1.0",payload:{shopId:parseInt(xe(g),10),checkoutSessionIdentifier:v||"",paymentMethodId:parseInt(xe(e.id),10),paymentInstrumentAccessorId:-1,isSelectedByDefault:N===ke(e),order:t,cvvRequired:e.requiresCvvConfirmation||!1,isHidden:n,hiddenReason:a}})};return r(()=>{V?c(V.brand):S.value||C||c(void 0)},[c,V,S.value,C]),r(()=>
2{P(_),[..._,...E].forEach(U)},[JSON.stringify(_)]),i(Xe,{gap:"base",children:[C&&i(l,{children:[i(si,{savedCreditCards:oi(A),selected:N,setSelected:e=>{n(e),$()},isSelected:s,setSelectedSavedCreditCardBrand:c,addCardModalOpen:R,msiAvailable:f}),f&&(!F||S.value?.creditCardFirstDigits)&&i(ra,{paymentMethod:t,isSelected:s,canEditBin:!1}),i(Xe,{gap:"base",alignItems:"start",children:[w&&i(l,{children:[i(Nt,{onClick:()=>x(!0),children:i(Xe,{direction:"inline",gap:"small-200",alignItems:"center",children:[i(vt,{type:"arrow-up-right",size:"small"}),m.translate("payment.saved_credit_cards_modal.view_all_label")]})}),i(li,{savedCreditCards:A,selected:N,setSelected:e=>{n(e),P(t=>function(e,t){const[n,a]=e.split("-");let r;const s=t.filter(e=>(e.token===a&&(r=e),e.token!==a));return[r,...s]}(e,t))},isSelected:s,isModalOpen:M,onModalClose:()=>x(!1)})]}),z?i(Js,{paymentMethod:t,addCardModalOpen:R}):i(mt,{id:"selectDirectPaymentMethod",name:"selectDirectPaymentMethod",checked:F,onChange:e=>{$(),n(e?Pe:ke(A[0]))},label:m.translate("payment.use_different_credit_card_label")})]})]}),z&&C?null:i(pt,{id:"directPaymentMethodDetails",open:F,children:i(Gs,{offsite:e,paymentMethod:t,sessionCard:V,isSelected:s,cardNumberAccessory:u},N)}),B&&!w&&i(ii,{numExpired:L})]})}function oi(e){return e.slice(0,4)}function ci({setSelected:e,isSelected:t,paymentMethod:n,bare:a,iconPlacement:s="end",showExistingCreditCards:d=!0,disabled:o,details:c,selectedContentFooter:u}){const{i18n:m,checkout:p}=k(),{identity:y}=p,{bankIdNumber:h,filled:g,touched:v}=Qn(),{setSelectedSavedCreditCardBrand:f}=Wn(),{bankIdNumberSignal:b,directPaymentFieldsFilled:_}=p.negotiator.context,{variant:C}=At(),{paymentLines:S}=p.negotiator.parts,A=rn(n)&&S.value.length>0&&S.value.every(e=>e.method.type===I.CreditCard);r(()=>{A||(h||v.number)&&(b.value=h)},[h,b,v.number,A]),r(()=>{const e=(n.checkoutHostedFields??as).filter(ns);return _.value=e.every(e=>g[e]),()=>{_.value=!1}},[_,g,n.checkoutHostedFields]);const P=p.installments.paymentMethodMustSupportDebitCardOnly.value,w="cardNumber"===s,M="inline"===s,x="end"===s,E=!0===a&&w,L=C!==Ee.Control,{ref:D,overflowIndicatorRef:T,maxVisibleBrands:N}=fr(n.paymentBrands.filter(B).length),O=i(gr,{animate:L,announceNetworkSelector:x,announceOverflowBrands:E,size:w||M?"small":void 0,maxVisibleBrands:x?N.value:void 0,overflowIndicatorRef:x?T:void 0}),V=i(l,{children:[i(ui,{isSelected:t,customHostedFields:n.checkoutHostedFields}),i(di,{offsite:!1,paymentMethod:n,setSelected:e,isSelected:t,showExistingCreditCards:d,setSelectedSavedCreditCardBrand:f,cardNumberAccessory:w?O:void 0})]}),z=u?i(Xe,{gap:"base",children:[V,u]}):V;if(a)return z;const R=function({identity:e,i18n:t},n,a){return ee({identitySource:e.current.value,i18n:t},a,{forceDebitCardLabel:n})}({identity:y,i18n:m},P,n),H=F(m,n.paymentBrands,void 0,x?N.value:void 0),j=H?`${R}, ${H}`:R,$=i(Xa,{type:"generic",accessibilityVisibility:"hidden"}),U={end:i("div",{ref:D,className:"YuaRt",children:i(Xe,{direction:"inline",gap:"none",alignItems:"center",justifyContent:"end",className:"BqUj3",children:O})}),cardNumber:$,inline:void 0}[s];return i(l,{children:i(zn,{value:Q(n),disabled:o,details:c,secondaryContent:U,renderSelectedContentWhenCollapsed:!0,selectedContent:z,accessibilityLabel:j,children:M?i(Xe,{direction:"inline",gap:"small-200",alignItems:"center",children:[i(Ze,{type:"strong",children:R}),O]}):i(Ze,{type:"strong",children:R})})})}function ui({isSelected:e,customHostedFields:t}){return function(e,t){const{observability:n,shop:a,webMcp:r,checkout:{wallets:s,negotiator:i}}=k(),{id:l}=a,d=se(a),o=Ye(),c=or(),{validate:u,cardBrand:m}=Qn(),{vaultCardWithSelectedNetwork:p,vaultCardMultipleTimesWithSelectedNetwork:y}=Wn(),h=ur(),g=ie();x(({parts:a,reason:v})=>{const f=i.parts.remotePaymentDetails.value,b=a.paymentLines.peek(),_=b[0],C=s.activeSession.value;if("progression"!==v&&"completion"!==v||!o.value||!e||C)return"completion"===v&&C&&1===b.length&&"direct"===_?.method.type&&(n.leaveErrorBreadcrumb("[useDirectPaymentMethodCustomizations] activeSession is set and the first payment line is direct",{activeSession:C}),n.error(new le("activeSession is set and the first payment line is direct. This will block checkout",{metadata:{conflictType:"DirectPaymentConflict",wallet:{active:C}}}))),{behavior:"allow"};if(void 0===_)return h(v),{behavior:"block",reason:E.EmptyPaymentLines,perform:()=>{}};if("direct"!==_.method.type)return{behavior:"allow"};const{acceptedSubscriptionTerms:S,paymentMethodIdentifier:A,paymentAttributes:k,alternative:P}=_.method,w=r?.getSubmittingAgenticToken();return c.value&&!w?{behavior:"allow",perform:()=>{}}:w||u(!1,t).isValid?{behavior:"allow",async perform({behavior:e}){if("allow"!==e)return;let t;if(w)t=w;else if(f&&0!==f.size){const e=[...g.value.length>0?[l]:[],...f.keys()],n=await async function(e,t){const n=await t(e.length);return new Map(e.map((e,t)=>{const a=n[t];if(void 0===a)throw new TypeError(`Missing payment session for shop ${e} at index ${t}`);return[e,a]}))}(e,y);t=n.get(l)??null;const a=new Map(f);for(const[t,r]of a)a.set(t,{...r,sessionId:n.get(t)});i.parts.remotePaymentDetails.value=a}else t=await p();if(t){const e=a.paymentLines.peek().find(e=>"direct"===e.method.type),n=e?.method?.creditCardInstallments,r={method:{type:"direct",sessionId:t,acceptedSubscriptionTerms:S,paymentMethodIdentifier:A,paymentAttributes:k,alternative:P,...m&&{brand:Zn(m)},...null!=n&&{creditCardInstallments:n}}};Tn(a,r,d)}}}:{behavior:"block",reason:E.CardFieldInputIsInvalid,perform:()=>{}}})}(e,t),null}function mi({method:e,onSelect:t,vaultHandle:n,blockFooter:a,selectedContentFooter:r}){const s=Ka(),l=Zr(),d=Q(e);return i(Xe,{gap:"base",children:[i(ca,{publishesCardNetworkDetection:!0,directPaymentMethodConfig:e,blurValidationEnabled:!0,blurValidationFieldDenylist:l.value,onSetFieldErrors:s,children:[i(es,{handle:n}),i(ci,{id:d,paymentMethod:e,setSelected:t,isSelected:!0,bare:!0,selectedContentFooter:r})]}),a]})}function pi({inlinePaymentMethod:e=!1}){const{i18n:t}=k(),n=mn({clearPii:!1});return i(nt,{padding:e?"none":"base",children:i(Je,{onClick:n,inlineSize:"100%",children:i(Xe,{direction:"inline",gap:"small-200",alignItems:"center",children:[i(Ze,{tone:"accent",children:t.translate("credit_card_form.more_payment_options")}),i(vt,{type:"arrow-up-right",size:"small",tone:"accent"})]})})})}
2function yi({id:e,displayName:t}){const{i18n:n}=k(),a=t??n.translate("payment_gateway.deferred_payment_label");return i(zn,{value:e,accessibilityLabel:a,children:i(Ze,{type:"strong",children:a})})}const hi=["BANCONTACT","IDEAL"];function gi(e){return hi.includes(e)}function vi({name:e}){return gi(e)?null:i(hr,{paymentBrands:[e]})}function fi({name:e,displayName:t}){return i(l,{children:gi(e)?i(Xa,{type:e}):i(Ze,{type:"strong",children:t})})}function bi({name:e,displayName:t}){return i(zn,{value:e,secondaryContent:i(vi,{name:e}),accessibilityLabel:t,children:i(fi,{name:e,displayName:t})})}function _i({manualPaymentMethod:t}){const n=w("alternativePaymentCurrency"),{i18n:a,checkout:{negotiator:r}}=k(),s=r.current.fields.alternativePaymentCurrency,l=e(()=>{if(!n.value)return s.value});return i(Xe,{gap:"base",children:i(nn,{children:i(y,{when:l,fallback:i(pn,{inlineSize:"base"}),children:e=>{const n={amount_due:i(Ze,{type:"strong",children:a.formatCurrency(e.totalWithoutGiftCards.amount,{currency:e.totalWithoutGiftCards.currencyCode,form:"explicit"})})};return t?a.translate("payment.alternative_payment_currency_total_manual_payment_notice",n):a.translate("payment.alternative_payment_currency_total_notice",n)}})})})}function Ci({additionalDetails:t,alignItems:n}){const{checkout:{negotiator:a}}=k(),r=a.current.fields.alternativePaymentCurrency,{hasNegotiatedAlternativePaymentCurrencySignal:s}=a.context,l=Ie(),d=e(()=>l.value&&s.value||Boolean(r.value)),o=t?.trim();return o||d.value?i(Xe,{alignItems:n,gap:"large-100",children:[o?i(ft,{children:i(nn,{children:t})}):null,i(y,{when:d,children:i(_i,{manualPaymentMethod:!0})})]}):null}function Si({id:e,label:t,additionalDetails:n,showSelectedContent:a=!0}){return i(zn,{value:e,selectedContent:a?i(Ci,{additionalDetails:n}):void 0,accessibilityLabel:t,children:i(Ze,{type:"strong",children:t})})}function Ai({id:e,additionalDetails:t,name:n,showSelectedContent:a=!0}){const r=yn();return i(zn,{value:e,selectedContent:a?i(Ci,{additionalDetails:t,alignItems:r?void 0:"center"}):void 0,accessibilityLabel:n,children:i(Ze,{type:"strong",children:n})})}const ki=C({displayName:"PayPalExpressPaymentMethod",load:()=>S(()=>Vn(()=>import("./75f3a0c7.C6jjKvRO.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]))),renderLoading:function({bare:e}){return e?null:i(zn,{value:"PAYPAL_EXPRESS"})}});function Pi(){const{i18n:e}=k(),t=e.translate("brand.apple_pay");return i(zn,{value:"APPLE_PAY",secondaryContent:i(Ma,{wallet:"APPLE_PAY",size:"xxxsmall"}),accessibilityLabel:t,children:i(Ze,{type:"strong",children:t})})}function wi(){const{checkout:e,router:t}=k(),{validation:{contactErrors:{emailInputError:n,phoneInputError:a}}}=e,{origin:r,prefix:s,searchParams:i}=t.currentUrl.value,{deliveryMethodsAddressErrors:l}=e.negotiator.context,{nextPage:d}=hn(),{resetAddressErrors:o}=gn(l),c=e.negotiator.throttleState.peek().token,u=e.configuration.renderContextToken.token.value;x(async({parts:e,reason:t})=>{if("completion"===t||"progression"===t&&"review"===d.id){const t=e.paymentLines.peek(),l=t[0]?.method,d=i.get("channel");if("wallet"===l?.type&&"SHOPIFY_INSTALLMENTS"===l.name){const e=new URLSearchParams;e.set("payment","shop_pay"),e.set(Le,Be.ShopPayInstallmentsAsPaymentMethod),c&&e.set(vn,c),d&&e.set("channel",d),u?e.set("rctx",u):e.delete("rctx");const t=`${r}${s}?${e.toString()}`;return{behavior:"block",reason:E.RedirectingToShopPay,perform(){n.value=void 0,a.value=void 0,o(),window.location.assign(t)}}}}return{behavior:"allow"}})}function Mi({label:e,installmentsLabel:t,installments:n}){return wi(),i(zn,{value:"SHOPIFY_INSTALLMENTS",secondaryContent:i(Ma,{wallet:"SHOP_PAY",size:"xxxsmall"}),accessibilityLabel:e,children:i(Xe,{direction:"@media (inline-size >= extraSmall) inline, block",gap:"small-400",children:[i(Ze,{type:"strong",children:e}),n&&i(l,{children:[i(nt,{display:"@media (inline-size >= extraSmall) auto, none",children:i(Ze,{color:"subdued",children:"•"})}),i(Ze,{color:"subdued",children:t})]})]})})}function xi({method:e,showSelectedContent:t=!0,bare:n=!1}){const{i18n:a}=k();switch(e.name){case"PAYPAL_EXPRESS":return i(ki,{method:e,showSelectedContent:t,bare:n});case"APPLE_PAY":return n?null:i(Pi,{});case"SHOPIFY_INSTALLMENTS":{if(n)return null;const e=a.translate("payment_gateway.shop_pay.name"),t=a.translate("payment_gateway.shop_pay.installments_label");return i(Mi,{label:e,installmentsLabel:t,installments:!0})}case"SHOP_PAY":{if(n)return null;const e=a.translate("payment_gateway.shop_pay.name");return i(Mi,{label:e})}case"GOOGLE_PAY":case"VENMO":return null;default:s(e)}}function Ei({children:e}){const t=yn();return i("div",{className:g("H3Xuw",t&&"ldo89"),children:e})}function Ii({label:e,bare:t=!1}){const{descriptor:n,brand:a}=ua().value,r=yn()||t,s=i(Ei,{children:i(Xe,{gap:"base",alignItems:r?"start":"center",children:i(Xe,{direction:"inline",gap:"base",children:[i(ma,{brand:a,descriptor:n}),i(pa,{})]})})});return i(l,t?{children:[i(qn,{isSdkOnly:!0}),s]}:{children:[i(qn,{isSdkOnly:!0}),i(zn,{value:te.AmazonPay,selectedContent:s,secondaryContent:i(nt,{blockAlignment:"center",children:i(Ma,{wallet:te.AmazonPay,size:"small"})}),accessibilityLabel:e,children:i(Ze,{type:"strong",children:e})})]})}function Li({method:e,bare:t=!1}){const{i18n:n,checkout:a}=k(),r=a.configuration.layout.isOnePage.value;switch(e.name){case te.AmazonPay:{const e=n.translate("brand.amazon_pay");return r?null:i(Ii,{label:e,bare:t})}case te.BuyWithPrime:return null;default:return s(e.name)}}const Bi={PAYPAL_EXPRESS:"paypal",APPLE_PAY:"apple_pay",GOOGLE_PAY:"google_pay",SHOP_PAY:"shop_pay",amazon_pay:"amazon_pay"};function Di(e){if("paymentBrands"in e&&Array.isArray(e.paymentBrands))return e.paymentBrands;if("name"in e&&e.name){const t=Bi[e.name];return t?[t]:[]}return[]}function Ti(e){return"name"in e?e.name:e.type}function Ni(e,t){return!(!e||!t||e.length!==t.length)&&(e===t||t.every((t,n)=>{return(a=t)===(r=e[n])||!!a&&!!r&&N(Fi(a),Fi(r));var a,r}))}function Fi(e){const t=Ti(e),{type:n,orderingIndex:a}=e;return{type:n,name:t,orderingIndex:a}}function Oi({identity:e,methodCount:t}){return 1===t&&("shopPay"!==e.current.value||Hn)}function Vi({value:e,label:t,accessibilityLabel:n=t,showIconPlaceholder:a=!1}){const{i18n:r}=k();return i(zn,{value:e,accessibilityLabel:n,secondaryContent:i(l,{children:[a?i(fn,{inlineSize:De(Ja.base.inlineSize),blockSize:De(Ja.base.blockSize),contentDisplay:"block"}):null,i(Ze,{accessibilityVisibility:"exclusive",children:r.translate("general.loading")})]}),children:i(Ze,{type:"strong",children:t})})}function zi({id:e,method:t}){const{i18n:n}=k();return i(Vi,{value:e,label:t.displayName??n.translate("payment.bank_payment_method_label"),showIconPlaceholder:!0})}const Ri=C({displayName:"BankPaymentMethod",useError:bn("BankPaymentMethod"),load:()=>S(async()=>({default:(await Vn(async()=>{const{BankPaymentMethod:e}=await(import("./4a3d8599.NSaWOAcI.js"));return{BankPaymentMethod:e}},__vite__mapDeps([57,1,2,3,4,5,6,7,8,9,10,11,12,13,14,40,41,42,22,43,58,59,60,33,61,62,63,64,46,50,51,52,53,28,29,30,31,32,34,35,25,26,36,38,39,21,23,44,45,27,47,15,16,17,48,49,54,19,20,24,37,55,56,65]))).BankPaymentMethod})),renderLoading:({id:e,method:t,bare:n})=>n?null:i(zi,{id:e,method:t})});function Hi({id:e,method:t,bare:n}){const{i18n:a}=k();if(!sn("Checkout::PaymentMethod::Render",void 0===t.uiExtension?[]:[t.uiExtension]).length)return null;if(n)return null;const r=F(a,t.paymentBrands),s=r?`${t.name}, ${r}`:t.name;return i(Vi,{value:e,label:t.name,accessibilityLabel:s,showIconPlaceholder:!0})}const ji=C({displayName:"CustomOnsitePaymentMethod",useError:bn("CustomOnsitePaymentMethod"),load:()=>S(async()=>({default:(await Vn(async()=>{const{CustomOnsitePaymentMethod:e}=await(import("./04164916.pllUvULM.js"));return{CustomOnsitePaymentMethod:e}},__vite__mapDeps([66,1,4,5,6,7,8,9,10,11,12,13,2,3,14,67,68,38,39,40,41,42,22,43,21,23,44,45,46,27,47,15,16,17,48,49,19,20,24,25,26,28,29,30,31,32,33,34,35,36,37,50,51,52,53,54,55,56,69]))).CustomOnsitePaymentMethod})),renderLoading:e=>i(Hi,{...e})});function $i({name:e,paymentBrands:t}){const{i18n:n}=k(),a=F(n,t);return i(Vi,{value:e,label:e,accessibilityLabel:a?`${e}, ${a}`:e,showIconPlaceholder:!0})}
2const Ui=C({displayName:"OffsitePaymentMethod",useError:bn("OffsitePaymentMethod"),load:()=>S(async()=>({default:(await Vn(async()=>{const{OffsitePaymentMethod:e}=await(import("./04164916.pllUvULM.js"));return{OffsitePaymentMethod:e}},__vite__mapDeps([66,1,4,5,6,7,8,9,10,11,12,13,2,3,14,67,68,38,39,40,41,42,22,43,21,23,44,45,46,27,47,15,16,17,48,49,19,20,24,25,26,28,29,30,31,32,33,34,35,36,37,50,51,52,53,54,55,56,69]))).OffsitePaymentMethod})),renderLoading:({name:e,paymentBrands:t,bare:n})=>n?null:i($i,{name:e,paymentBrands:t})}),qi={offsite:Ui,customOnsite:ji,bank:Ri};function Yi(){const e=Ui.useLoadState(),t=ji.useLoadState(),a=Ri.useLoadState();return n(n=>{switch(n.type){case"offsite":return e;case"customOnsite":return t;case"bank":return a;default:return}},[e,t,a])}const{offsite:Wi,customOnsite:Gi,bank:Ki}=qi;function Xi({methods:e,selected:a,onSelect:r,renderAsBareCard:s,vaultHandle:l,blockFooter:d,choiceListName:o="basic",showSelectedContent:c=!0,showExistingCreditCards:u=!0,radioControlMethodCount:m,directMethodDisabled:p=!1,directMethodDetails:y,directMethodSelectedContentFooter:h}){const g=Ka(),{checkout:{identity:v}}=k(),f=Zr(),b=t(()=>a?[a]:[],[a]),_=n(([e])=>{e&&r(e)},[r]);return i(Rn,{name:o,values:b,hideRadioControl:Oi({identity:v,methodCount:m??e.length}),onChange:_,variant:s?"list":"block",blockFooter:d,children:e.map(e=>{const t=Q(e),n=a===t;return"direct"===e.type?i(ca,{publishesCardNetworkDetection:!0,directPaymentMethodConfig:e,blurValidationEnabled:!0,blurValidationFieldDenylist:f.value,onSetFieldErrors:g,children:[n&&i(es,{handle:l}),i(ci,{id:t,paymentMethod:e,setSelected:r,isSelected:n,bare:s,showExistingCreditCards:u,disabled:p,details:y,selectedContentFooter:n?h:void 0})]},t):"wallet"===e.type?i(ca,{blurValidationFieldDenylist:f.value,onSetFieldErrors:g,children:i(xi,{method:e,showSelectedContent:c})},t):"walletsPlatform"===e.type?i(Li,{method:e},t):e.type===I.PayPal?i(ki,{method:e,showSelectedContent:c},t):"local"===e.type?i(bi,{name:e.name,displayName:e.displayName},t):"paymentOnDelivery"===e.type?i(Ai,{id:e.type,additionalDetails:e.additionalDetails,name:e.name,showSelectedContent:c},t):"manualPayment"===e.type||"customManualPayment"===e.type?i(Si,{id:`${e.type}-${e.id}`,label:e.name,additionalDetails:e.additionalDetails,showSelectedContent:c},t):"offsite"===e.type?i(Wi,{name:e.name,paymentBrands:e.paymentBrands,showRedirectionNotice:e.showRedirectionNotice,showSelectedContent:c},t):"deferred"===e.type?i(yi,{id:e.type,displayName:e.displayName},t):"customOnsite"===e.type?i(Gi,{id:e.name,selected:c&&n,method:e,showSelectedContent:c},t):"bank"===e.type?i(Ki,{id:t,method:e,setSelected:r,showSelectedContent:c},t):null})})}function Ji(){const{i18n:e}=k();return i(_n,{tone:"warning",children:e.translate("payment_errors.test_mode_enabled_only_test_cards")})}function Qi(){const[e,t]=a(!0),n=function(){const{client:e}=k();return e.unstable_getSerialization("invoiceLoginType")}(),{client:r,i18n:s,checkout:{negotiator:l}}=k(),d=l.current.fields.buyerIdentity.value?.purchasingCompany,o=(()=>{const e=r.unstable_getSerialization("loginUrl")||"";switch(n){case Sn:return s.translate("payment_gateway.login_prompt.no_access.message",{logIn:i(Nt,{tone:"monochrome",href:e,children:s.translate("payment_gateway.login_prompt.no_access.link")})});case Cn:case void 0:return null}return null})();return e&&n&&d&&o?i(_n,{onDismiss:function(){t(!1)},tone:n===Cn?"success":"info",children:o}):null}function Zi({selectedPaymentMethod:t}){const{i18n:n,checkout:{negotiator:a}}=k(),r=An(),s=_(t),l=ne(),d=w("paymentFlexibilityPaymentTermsTemplate"),o=xt(),c=n.numberFormatter({style:"percent",minimumFractionDigits:0,maximumFractionDigits:2}),u=e(()=>{const e=a.current.fields.paymentFlexibilityPaymentTermsTemplate.value,t=a.current.fields.depositConfiguration.value,i="deferred"===s.value,d="creditCards"===s.value,u="FIXED"===e?.type,m="FULFILLMENT"===e?.type,p="RECEIPT"===e?.type,y=t?.percentage?c.format(t?.percentage/100):null;if(l.value)return u?n.translate("payment_gateway.draft_order_payment_due_later_terms",{translatedName:e.translatedName.toLocaleLowerCase()}):m?y?n.translate("payment_gateway.draft_order_deposit_due_on_fulfillment",{depositAmount:y}):n.translate("payment_gateway.draft_order_payment_due_on_fulfillment"):null==e?i?n.translate("payment_gateway.draft_order_payment_due_later_no_terms"):n.translate("payment_gateway.draft_order_payment_due_later_no_terms_payment_selected"):y?n.translate("payment_gateway.draft_order_deposit_due_later",{depositAmount:y,translatedName:e.translatedName}):n.translate("payment_gateway.draft_order_payment_due_later_terms",{translatedName:e.translatedName});if(null==e||o.value)return;if(m){if(y)return n.translate("payment_gateway.order_deposit_due_on_fulfillment",{depositAmount:y});if(d)return n.translate("payment_gateway.order_due_on_fulfillment_payment");
2if(i)return n.translate("payment_gateway.order_due_on_fulfillment_choose_later")}if(p)return y?n.translate("payment_gateway.order_deposit_due_on_receipt",{depositAmount:y}):n.translate("payment_gateway.order_due_on_receipt_choose_later");if(!e.dueDate)return;const h={translatedName:e.translatedName,dueDate:r(e.dueDate)};return d&&!y?u?n.translate("payment_gateway.fixed_direct_payment_terms",{dueDate:h.dueDate}):n.translate("payment_gateway.direct_payment_terms",h):u?y?n.translate("payment_gateway.order_deposit_due_on_fixed_date",{depositAmount:y,dueDate:h.dueDate}):n.translate("payment_gateway.fixed_payment_label",{dueDate:h.dueDate}):y?n.translate("payment_gateway.order_deposit_due_now",{depositAmount:y,...h}):n.translate("payment_gateway.generic_payment_terms",h)});return i(y,{when:u,children:i(_n,{tone:"info",children:i(y,{when:()=>!d.value,fallback:i(pn,{inlineSize:"large"}),children:u})})})}function el(){const{paymentErrors:e}=kn().value,t=i(Pn,{errors:e,errorType:Lt.PaymentError});return e.length>0&&t}function tl({selectedPaymentMethod:e}){const{shopPay:t,source:n}=k(),a=t.user.hasFlag(Ua);return i(l,{children:[i(el,{}),wn(n.type)&&i(Qi,{}),a&&i(Ji,{}),i(Zi,{selectedPaymentMethod:e})]})}Qi.displayName="OrderInvoiceLoginBanner";const{inlineSize:nl,blockSize:al}=Ja.base;function rl(e,t){return e?i(fn,{inlineSize:De(nl),blockSize:De(al),contentDisplay:"block"}):t?i(Xa,{type:t}):void 0}function sl({identity:e}){return e.current.value}function il({methods:e,selected:a,onSelect:r,selectorShowsTiles:s,tileSupportedCustomOnsitePaymentMethods:l}){b(()=>{if(s)return s.value=!0,()=>{s.value=!1}},[s]);const{i18n:d,checkout:o}=k(),c=o.configuration.layout.isOnePage.value,u=Yi(),m=Pt(),p=wt(m),y=o.installments.paymentMethodMustSupportDebitCardOnly.value,h=t(()=>a?[a]:[],[a]),g=n(([e])=>{e&&r(e)},[r]);return i(Rn,{name:"payment-tiles",label:d.translate("payment.payment_method"),labelAccessibilityVisibility:"exclusive",variant:"grid-compact",values:h,onChange:g,children:e.flatMap(e=>{const t=Q(e),n=Fr(e,{i18n:d,identitySource:sl({identity:o.identity}),isOnePageCheckout:c,isVenmoCheckout:p,forceDebitCardLabel:y,tileSupportedCustomOnsitePaymentMethods:l});if(!n)return[];const a="loading"===u(e),r=a?d.translate("general.loading"):void 0,s=n.accessibilityLabel&&r?`${n.accessibilityLabel}, ${r}`:n.accessibilityLabel;return i(zn,{value:t,icon:rl(a,n.iconBrand),accessibilityLabel:s,children:[i(Ze,{type:"strong",children:n.label}),r&&!s?i(Ze,{accessibilityVisibility:"exclusive",children:r}):null]},t)})})}const ll={loaded:!1},dl={start:"payment-transition-extensions-enter-start",end:"payment-transition-extensions-enter-end"},ol="payment-transition-extensions-clip";function cl(){return A(async()=>{"undefined"!=typeof window&&(await Vn(()=>Promise.resolve({}),__vite__mapDeps([70])),ll.loaded=!0)}),ll}const ul={PaymentSelector:"Yqd2o",PaymentDetails:"_9Jwvk"};function ml({children:e,variant:t}){return cl(),i("div",{className:`${ul[v("Payment",t)]} payment-transition-${t}`,children:e})}const{offsite:pl,bank:yl,customOnsite:hl}=qi;function gl({methods:e,selected:t,onSelect:n,vaultHandle:a,directMethodSelectedContentFooter:r}){return i(l,{children:e.map(e=>{const s=Q(e),l=s===t,d=!l&&"direct"===e.type;return i("div",{className:g("fMWDI",d&&"_6d3Zy"),hidden:!l&&!d,"data-collapsed":!l,"aria-hidden":d||void 0,children:i(nt,{paddingBlockEnd:"large-100",children:i(vl,{method:e,isSelected:l,onSelect:n,vaultHandle:a,directMethodSelectedContentFooter:r})})},s)})})}function vl({method:e,isSelected:t,onSelect:n,vaultHandle:a,directMethodSelectedContentFooter:r}){const s=Ka(),l=Zr(),d=Q(e);switch(e.type){case"direct":return i(ca,{publishesCardNetworkDetection:!0,directPaymentMethodConfig:e,blurValidationEnabled:!0,blurValidationFieldDenylist:l.value,onSetFieldErrors:s,children:[t&&i(es,{handle:a}),i(ci,{id:d,paymentMethod:e,setSelected:n,isSelected:t,bare:!0,selectedContentFooter:t?r:void 0,iconPlacement:"cardNumber"})]});case"offsite":return i(pl,{name:e.name,paymentBrands:e.paymentBrands,showRedirectionNotice:e.showRedirectionNotice,bare:!0});case"bank":return i(yl,{id:d,method:e,setSelected:n,bare:!0});case"customOnsite":return i(hl,{id:d,method:e,selected:t,bare:!0});case"wallet":return"PAYPAL_EXPRESS"!==e.name?null:i(ca,{blurValidationFieldDenylist:l.value,onSetFieldErrors:s,children:i(xi,{method:e,bare:!0})});case"walletsPlatform":return i(Li,{method:e,bare:!0});case I.PayPal:return i(ki,{method:e,bare:!0});default:return null}}const fl=new Set(["direct","offsite","customOnsite","manualPayment","customManualPayment","paymentOnDelivery","local","wallet","walletsPlatform","deferred","bank"]);function bl({identity:e}){switch(e.current.value){case"guest":return"guest_checkout";case"shopPay":return"shop_pay_payment_options";default:return e.current.value}}function _l(e){return e.type===I.CreditCard?ke(e):Q(e)}function Cl(e){return"displayName"in e&&e.displayName?e.displayName:"name"in e&&e.name?e.name:e.type}function Sl({displayedPaymentMethods:e,selectedPaymentMethod:t,buyerHasActed:a}){const s=function(){const{userEvents:e,shop:t,source:a,checkout:{negotiator:r}}=k(),{buyerIdentity:s,shippingAddress:i}=r.current.fields,{id:l}=t,{checkoutSessionIdentifier:d}=a,c=i.value?.countryCode||s.value?.countryCode,u=o(0),m=o(""),p=o([]),y=o(!1);return n(({displayedPaymentMethods:t,selectedPaymentMethod:n,buyerHasActed:a})=>{const r=n?_l(n):"",s=!Ni(p.current,t);let i;s&&u.current++,!y.current&&t.length>0?(i="initialRender",y.current=!0):s?i="paymentMethodsChanged":m.current!==r&&(i=a?"buyerSelectedPaymentMethod":"autoSelectedPaymentMethod"),i&&function(e,t,n,a,r,s,i,l,d){s.forEac
2h((o,c)=>{const u=_l(o),m=!l&&u===r,p=l&&u===r;e.monorailEvent({schemaId:"checkout_payment_method_rendered/1.1",payload:{shopId:parseInt(xe(t),10),checkoutSessionIdentifier:i||"",paymentMethodIdentifier:"paymentMethodIdentifier"in o?o.paymentMethodIdentifier:void 0,buyerCountryCode:d,eventTriggerReason:a,iterationNumber:n,orderInTheList:c,displayName:Ti(o)||"",isAutoSelected:m,isBuyerSelected:p,isOrderedFirst:0===c,isOrderedLast:c===s.length-1}})})}(e,l,u.current,i,r,t,d,a,c),p.current=t,m.current=r},[c,d,e,l])}();r(()=>{s({displayedPaymentMethods:e,selectedPaymentMethod:t,buyerHasActed:a})},[a,e,s,t])}function Al({displayedPaymentMethods:e,selected:t,setSelected:n,buyerHasActed:a}){const{shop:s,shopPay:i,userEvents:l,source:d,checkout:c,router:u}=k(),m=u.currentUrl.value,{paymentMethodAutoSelectionDisabled:p}=s,y=rr(),h=Ie(),g=Boolean(Oe(c.proposal.proposed.paymentLines.value)),v=e.find(e=>Q(e)===t);Sl({displayedPaymentMethods:e,selectedPaymentMethod:v,buyerHasActed:a});const f=o([]),b=o(),_=o(new Set),C=o(function(e){const t=new URLSearchParams(e),n=t.get(Ne);var a;if(n&&(a=n,fl.has(a)))return{paymentMethod:n,paymentMethodIdentifier:t.get(Fe)||void 0}}(m.search)),S=o(!1);r(()=>{!function({availableMethods:e,seen:t,userEvents:n,source:a,checkout:r,shop:s}){"shopPay"===r.identity.current.value&&e?.forEach(e=>{const i=Q(e);t.has(i)||(t.add(i),n.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...$(a,r,s),action:"payment_method_rendered",paymentMethodName:Cl(e)}}))})}({availableMethods:e,seen:_.current,userEvents:l,source:d,checkout:c,shop:s})},[e,l,d,c,s]),r(()=>{const[a]=e;g||"shopPay"!==c.identity.current.value||"SHOP_PAY"!==t||void 0===a||n(Q(a))},[t,n,e,c.identity,g]),r(()=>{if(g)return f.current=e,void(b.current=e);const[r]=e,s=!Ni(f.current,e);if(!p&&void 0!==r){const l=a||S.current||!C.current?void 0:function(e,t){if(t.paymentMethodIdentifier){const n=e.find(e=>e.type===t.paymentMethod&&"paymentMethodIdentifier"in e&&e.paymentMethodIdentifier===t.paymentMethodIdentifier);if(n)return n}return e.find(e=>e.type===t.paymentMethod)}(e,C.current);if(l){const e=Q(l);S.current=!0,t!==e&&n(e,void 0,{rebuild:!0})}else if(C.current&&!S.current&&h.value&&(S.current=!0),i.user.paymentMethodHistory.value.length>0&&function(e,t){const n=e.map(e=>Q(e)),a=t?.map(e=>Q(e));return!n.every(e=>a?.includes(e))}(e,b.current)){const t=function({availablePaymentMethods:e,previousAvailablePaymentMethods:t,identity:n,shopPay:a,isApplePayAvailable:r}){if("shopPay"!==n.current.value)return;const s=e.map(e=>Q(e)),i=t?.map(e=>Q(e));if(s.every(e=>i?.includes(e)))return;const l=a.user.paymentMethodHistory.value;if(0!==l.length)for(const d of l){if(!d.lastUsedAt)continue;const t=e.find(e=>!(!r||"APPLE_PAY"!==d.paymentMethod||!Te(e))||!("customOnsite"!==e.type||"CUSTOM_ONSITE"!==d.paymentMethod||!("paymentBrand"in d)||!(e.paymentBrands?.map(e=>e.toLowerCase())??[]).includes(d.paymentBrand.toLowerCase())));if(t)return Q(t)}}({availablePaymentMethods:e,previousAvailablePaymentMethods:b.current,identity:c.identity,shopPay:i,isApplePayAvailable:y.value});b.current=e,t?n(t):s&&!v&&n(Q(r))}else s&&!v&&n(Q(r))}f.current=e},[t,v,n,a,e,i,y.value,p,g,c.identity,i.user.paymentMethodHistory.value,h.value])}function kl(e,t){return e?[...e.querySelectorAll('input[type="radio"]')].filter(e=>e.name===t):[]}const Pl=new Set(["bank","customOnsite"]);function wl({displayedPaymentMethods:e,selected:t,loadStateForMethod:n}){const{checkout:a,i18n:r,observability:s}=k(),{wallets:i}=a,l=va();x(({reason:a})=>{if("progression"!==a&&"completion"!==a)return{behavior:"allow"};if(fa(l.value))return{behavior:"allow"};if(null!==i.activeSession.value)return{behavior:"allow"};const d=e.find(e=>Q(e)===t);if(!d)return{behavior:"allow"};const o=n(d);return"failed"===o?(s.log("lazy_payment_method_submission_blocked",`Blocked ${a}: selected ${d.type} method's chunk failed to load`,{methodType:d.type,loadState:o}),{behavior:"block",reason:E.PaymentMethodUnavailable,errors:[{message:r.translate("payment.payment_method_unavailable_error"),target:Ke}]}):"loading"===o&&Pl.has(d.type)?(s.log("lazy_payment_method_submission_blocked",`Blocked ${a}: selected ${d.type} method's chunk is still loading`,{methodType:d.type,loadState:o}),{behavior:"block",reason:E.PaymentMethodLoading,errors:[{message:r.translate("payment.payment_method_loading_error"),target:Ke}]}):{behavior:"allow"}}
2)}function Ml(e){return"choiceList"===e||"tiles"===e}function xl({displayedPaymentMethods:e,selectedBillingAddress:t,allowPreselect:a=!0}){const{observability:r,userEvents:s,source:i,checkout:l,shop:d}=k(),{buyerHasActedSignal:o}=l.negotiator.context,[c,u]=sr({allowPreselect:a,displayedPaymentMethods:e}),{paymentErrors:m}=kn().value,p=l.negotiator,{updateCheckoutAddress:y}=ir(),h=n(async(n,a)=>{o.value=!0,u(n,a,{buyerInitiated:!0});const c=e.find(e=>Q(e)===n);if(c){const e=c.type,a=Ti(c)||c.type,o="paymentBrands"in c&&c.paymentBrands?c.paymentBrands.slice().sort().join(","):"";r.counter({name:"payment_method_selected",value:1,attributes:{payment_method_type:e,payment_method_name:a,payment_brands:o,location:bl({identity:l.identity}),is_mobile:ze()}}),"shopPay"===l.identity.current.value&&(s.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...$(i,l,d),action:"payment_method_selected",paymentMethodName:Cl(c)}}),t&&Re(n.toUpperCase())&&y({billingAddress:t},!0))}m.length>0&&await p.negotiate({silenceViolations:["all"],negotiationStage:"negotiation"})},[o,u,m.length,p,e,r,s,t,y,i,l,d]);return{selected:c,setSelected:u,setSelectedByBuyer:h,buyerHasActed:o.value}}function El(e,t,n){const a=Q(e).toLowerCase(),r="name"in e?e.name.toLowerCase():"";if(n.has(a))return!0;if(He(e)&&n.has("ideal"))return!0;if(Te(e)&&n.has("wallet-apple-pay"))return!0;if("customOnsite"===e.type&&e.paymentBrands.some(e=>n.has(e.toLowerCase())))return!0;for(const s of t){const t=s.id.toLowerCase();if(t===a||t===r)return!0;if(null!=s.name&&s.name.toLowerCase()===a)return!0;if("IDEAL"===s.paymentMethod&&He(e))return!0;if("APPLE_PAY"===s.paymentMethod&&Te(e))return!0;if("customOnsite"===e.type&&"paymentBrands"in s&&Array.isArray(s.paymentBrands)){const t=e.paymentBrands.map(e=>e.toLowerCase());if(s.paymentBrands.some(e=>t.includes(e.toLowerCase())))return!0}}return!1}function Il({errorBannerInContext:e,billingAddressInContext:a,vaultHandle:s,selectorShowsTiles:l,afterPaymentSelector:c,experienceType:u="list",renderVaultingAgreementInline:m}){const p=br().value,y=va(),{checkout:h,i18n:g}=k(),v=h.configuration.layout.isOnePage.value,f=h.installments.paymentMethodMustSupportDebitCardOnly.value,{displayedPaymentMethods:_,renderAsBareCard:C,billingAddressVariant:S,selectedBillingAddress:A}=Lr({experienceType:u}),w=Yn(),{guestCheckoutPaymentMethods:M}=function(){const{shopPay:e}=k(),{showGuestCheckoutPaymentMethods:n}=e.visibility,{value:a}=P({deferClientOnlyWalletsUntilHydrated:!0}),{displayedPaymentMethods:r,renderAsBareCard:s,billingAddressVariant:i,selectedBillingAddress:l}=Lr({experienceType:"list"}),d=e.session.promotedPaymentMethods.value,o=t(()=>function(e,t){const n=new Set;for(const a of e)a.lastUsedAt&&"id"in a&&n.add(a.id.toLowerCase());for(const a of t)a.lastUsedAt&&(null!=a.paymentBrand&&n.add(a.paymentBrand.toLowerCase()),null!=a.name&&n.add(a.name.toLowerCase()));return n}(e.user.paymentMethods.value??[],e.user.paymentMethodHistory.value??[]),[e.user.paymentMethods.value,e.user.paymentMethodHistory.value]),c=t(()=>r.filter(e=>!El(e,d,o)),[r,d,o]),u=t(()=>{if(!n)return[];const e=new Set(c);return(a??[]).filter(e=>!El(e,d,o)).filter(t=>!e.has(t)).filter(e=>!je(e))},[a,d,o,n,c]),m=t(()=>[...c,...u],[u,c]),p=d.some(e=>"CREDIT_CARD"!==e.paymentMethod),y=s||Boolean(c.length>0&&0===u.length&&!p&&c.every(e=>"direct"===e.type));return{shopPayPaymentMethods:c,guestCheckoutPaymentMethods:u,combinedPaymentMethods:m,renderAsBareCard:y,billingAddressVariant:i,selectedBillingAddress:l}}(),x=Yi(),E=t(()=>_.filter(e=>"failed"!==x(e)),[_,x]),{selected:I,setSelected:L,setSelectedByBuyer:B,buyerHasActed:D}=xl({displayedPaymentMethods:E,selectedBillingAddress:A}),T=Et().value,N=na().value,F=h.negotiator.parts.paymentLines,O=v&&!m&&T&&F.value.some(e=>"direct"===e.method.type)?void 0:"large-100",[V=""]=Ue(F.value);wl({displayedPaymentMethods:_,selected:V,loadStateForMethod:x}),Al({displayedPaymentMethods:E,selected:I,setSelected:L,buyerHasActed:D});const z=o(null);!function(e,t,n){const a=o(t),r=o(null);if(a.current!==t){const s=a.current.some(e=>!t.includes(e));r.current=s?function(e,t){const n=document.activeElement;if(!(n instanceof HTMLInputElement))return null;const a=kl(e,t).indexOf(n);return-1===a?null:a}(e.current,n):null,a.current=t}b(()=>{const t=r.current;if(r.current=null,null===t)return;if(document.activeElement!==document.body)return;const a=kl(e.current,n);
20!==a.length&&a[Math.min(t,a.length-1)]?.focus({preventScroll:!0})},[n,e,t])}(z,t(()=>E.map(Q),[E]),"basic");const R=d(null),H=s??R,{showPaymentTiles:j}=At(),$=function(e){const n=t(()=>e.filter(e=>"customOnsite"===e.type),[e]),a=t(()=>n.flatMap(({uiExtension:e})=>e?[e]:[]),[n]),r=sn("Checkout::PaymentMethod::Render",a),s=t(()=>r.map($e),[r]);return t(()=>{const e=s.some(e=>"local"===e.type);return new Set(n.flatMap(t=>e||void 0!==t.uiExtension&&s.includes(t.uiExtension)?[t.paymentMethodIdentifier]:[]))},[n,s])}(E),U=jr(E,$),{containerSize:q,registerContainer:Y}=function(){const e=d(void 0),t=o(null),a=Ve((e,t)=>U(e,v,f).mode!==U(t,v,f).mode);r(()=>()=>{t.current?.disconnect(),t.current=null},[]);const s=n(t=>{const n=function(e){return e>=498?"wide":e>=380?"compact":"compact-narrow"}(t),r=e.value;if(r===n)return;const s=()=>{e.value=n};void 0!==r&&a.current?.(r,n)?On(s,["payment-selector-change"]):s()},[e,a]),i=n(n=>{if(t.current?.disconnect(),t.current=null,e.value=void 0,!n)return;if("undefined"==typeof ResizeObserver)return;const a=new ResizeObserver(([e])=>{e&&s(e.contentRect.width)});a.observe(n),t.current=a},[e,s]);return{containerSize:e,registerContainer:i}}(),W=n((e,t)=>{const n=E.map(Q),a=n.indexOf(e),r=n.indexOf(I);-1!==a&&a!==r?On(()=>{B(e,t)},[-1===r||a>r?"payment-details-slide-end":"payment-details-slide-start"]):B(e,t)},[E,I,B]),G=t(()=>U(q.value,v,f),[U,q.value,v,f]);!function({containerSize:e,enabled:t,methodCount:n,mode:a}){const{observability:s}=k(),i=o(t&&Ml(a)?{containerSize:e,methodCount:n,mode:a}:void 0);r(()=>{if(!t||!Ml(a))return void(i.current=void 0);const r={containerSize:e,methodCount:n,mode:a},l=i.current;if(i.current=r,!l||l.methodCount!==n)return;if(l.mode===a)return;const d=void 0===l.containerSize&&void 0!==e,o=void 0!==l.containerSize&&void 0!==e&&l.containerSize!==e;(d||o)&&s.counter({name:"payment_selector_mode_changed",value:1,attributes:{from_container_size:l.containerSize??"unmeasured",from_mode:l.mode,method_count:n,to_container_size:e,to_mode:a,transition_source:d?"initial_measurement":"resize"}})},[e,t,n,a,s])}({containerSize:q.value,enabled:j,methodCount:E.length,mode:G.mode});const[K]=E,X="singlePaymentMethodCreditCard"===G.mode&&void 0!==K&&J(K)?K:void 0,Z=function({identity:e,guestCheckoutPaymentMethodCount:t,inlinePaymentMethod:n=!1}){return"shopPay"!==e.current.value||0===t?null:i(pi,{inlinePaymentMethod:n})}({identity:h.identity,guestCheckoutPaymentMethodCount:M.length,inlinePaymentMethod:Boolean(X)})??void 0,ee=m&&!N&&T?i(qr,{borderless:!0}):void 0,te=t(()=>E.map(e=>"name"in e?e.name:e.type),[E]),ne="deferred"===I||"creditCards"===I?I:void 0,ae=_r(h.identity,y.value);if(ae)return i($n,{impressionType:"payment",impressionFeatures:[ae],children:i(ya,{reason:ae,minimal:v})});if(p.freeOrder)return i($n,{impressionType:"payment",impressionFeatures:["freeOrder"],children:i(ya,{reason:"freeOrder",minimal:v})});if(p.giftCard)return i($n,{impressionType:"payment",impressionFeatures:["giftCard"],children:i(ya,{reason:"giftCard",minimal:v})});if(p.storeCredit)return i($n,{impressionType:"payment",impressionFeatures:["storeCredit"],children:i(ya,{reason:"storeCredit",minimal:v})});if(p.redeemables)return i($n,{impressionType:"payment",impressionFeatures:["redeemables"],children:i(ya,{reason:"redeemables",minimal:v})});if(w.value)return i(Qe,{background:"subdued",borderRadius:"base",paddingBlock:"large-500",placeItems:"center",children:i(ft,{color:"subdued",textAlign:"center",children:g.translate("payment.loading")})});if(0===E.length)return i($n,{impressionType:"payment",impressionFeatures:Kr(te,G),children:i(Xr,{error:_.length>0?"script":"no_methods"})});const re=Ir({identity:h.identity,billingAddressInContext:a,billingAddressVariant:S});let se;if(X)se=i(nt,{paddingBlockEnd:O,children:i(mi,{method:X,onSelect:B,vaultHandle:H,blockFooter:Z,selectedContentFooter:ee})});else if("tiles"===G.mode){const e=i(il,{methods:E,selected:I,onSelect:W,selectorShowsTiles:l,tileSupportedCustomOnsitePaymentMethods:$});se=i(Xe,{gap:"large-100",children:["redesigned"===G.choiceListPresentation?i(jn,{borderSelected:"large100",children:e}):e,i(ml,{variant:"details",children:i(gl,{methods:E,selected:I,onSelect:W,vaultHandle:H,directMethodSelectedContentFooter:ee})}),Z]})}else se=i(nt,{paddingBlockEnd:O,ref:z,children:i(Xi,{methods:E,selected:I,onSelect:B,renderAsBareCard:C,vaultHandle:H,blockFooter:Z,directMethodSelectedContentFooter:ee})});return i(Mn,{target:"cart.paymentLines[0]",children:i($n,{impressionType:"payment",impressionFeatures:Kr(te,G),children:i(Qr,{errorBannerInContext:e,billingAddressInContext:a,selectedPaymentMethod:I,billingAddressVariant:S,children:i(Xe,{ref:Y,gap:"base",children:[!C&&i(tl,{selectedPaymentMethod:ne}),i(ml,{variant:"selector",children:se}),c,re]}
2)})})})}function Ll(){const{i18n:e,environment:t,shopPay:n}=k(),a=xn(),{surface:r,version:s}=n.app.config,d="web"!==r;if(d&&!dr(s,"3.7.0"))return i(l,{children:e.translate("payment_errors.duplicate_autopay_card_without_link")});const o=i(l,{children:[e.translate("payment_errors.duplicate_autopay_card_link")," ",i(vt,{type:"external",size:"small",display:"inline"})]});return i(l,{children:e.translate("payment_errors.duplicate_autopay_card",{update_payment_details_link:i(Nt,d?{onClick:()=>a.notify({open_upcoming_payments:!0}),children:o}:{href:(c=t.services.shopServer.url,new URL("/pay/account/installments",c).href),target:"_blank",children:o})})});var c}const Bl="Timed out while processing the 3DS challenge modal.",Dl=()=>{const e=o(!1),[t,s]=a(void 0),{observability:i}=k();return r(()=>{if(t)return window.addEventListener("message",t.messageListener),t.telemetryAttributes&&i.log("shop_pay_three_ds_listener_started","[ShopPay] 3DS postMessage listener started",t.telemetryAttributes),()=>window.removeEventListener("message",t.messageListener)},[t,i]),{listen:n(({onComplete:t,telemetryContext:n})=>{e.current=!1;const a=Date.now(),r=n?function(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}}(n):void 0,l=(n,a)=>{if(!e.current){e.current=!0;try{a?.()}catch{}try{t(...n)}catch(r){i.error(new qe(`Error in 3DS onComplete handler: ${r}`,{groupingHash:"ShopPayError::ThreeDSecureOnComplete"}))}}},d=setTimeout(()=>{s(void 0),l([{errors:[{message:Bl}]}],()=>{i.log("use_three_ds_listener_timed_out",Bl),r&&i.log("shop_pay_three_ds_listener_timed_out",Bl,{...r,elapsedTimeMs:Date.now()-a})})},En);s({messageListener:async function({data:t,origin:n}){t.type===In&&(e.current||(s(void 0),clearTimeout(d),l([],()=>{r&&i.log("shop_pay_three_ds_listener_completed","[ShopPay] 3DS postMessage received",{...r,dataType:In,originHostCategory:Ln(n),elapsedTimeMs:Date.now()-a})})))},telemetryAttributes:r})},[i])}};class Tl extends Error{constructor(){super("Card fields functions are unavailable"),this.name="CardFieldsFunctionsUnavailableError"}}function Nl({vaultHandle:e}){const{checkout:{validation:s},i18n:d}=k(),{creditCardErrors:o,setCreditCardErrors:c,blockDuplicateAutopayCard:u}=ga(),[m,p]=function(e){const{i18n:n,observability:a,userEvents:r,source:s,checkout:{configuration:i},shop:l}=k(),d=t(()=>we(),[]),o=e||d;return[o,function(e,t){nr({addressErrors:o,shopPayErrors:e,i18n:n,observability:a,userEvents:r,source:s,configuration:i,shop:l,addressContext:"billing",submittedAddress:t})}]}(s.billingAddressErrors),[y,h]=function(){const[e,t]=a(null),r=xn(),{checkout:{negotiator:s}}=k(),{checkoutProtocolModalEventSignal:i}=s.context;return[e,n(e=>{const n=null===e?"modal_close":"modal_open";i.value="modal_open"===n?"redesign":"none",r.notify({checkout_ui:{type:n,payload:{duration:Ea}}}),t(e)},[r,i])]}(),g=Bn({source:y,logMessage:"[ShopPayPaymentMethodProgressionHost] Action required modal iframe loaded; this does not prove issuer challenge rendered",telemetryContext:{modalSourceType:"shop_pay_interceptor_three_ds_modal_url"}}),v=n(()=>{const t=e.value;if(!t)throw new Tl;return t.validate()},[e]),f=n(async()=>{const t=e.value;if(!t)throw new Tl;return t.vaultCardWithSelectedNetwork()},[e]);r(()=>{const t=e.value;t&&t.setFieldErrors(o.fieldErrors)},[o,e]);const b=function({onAddressValidationErrors:e,onSaveCardErrors:t,onDuplicateAutopayCard:a,onSaveCardBillingAddressErrors:r,onThreeDSUrlChange:s,validateCardFields:i,vaultCardWithSelectedNetwork:l}){const{shopPay:d,checkout:o,observability:c}=k(),u=va(),{paymentLines:m,billingAddressOption:p,shippingAddress:y,billingAddress:h}=o.negotiator.parts,g=o.installments.paymentMethodMustSupportDebitCardOnly,v=rt(),f=o.isShippingRequired.value&&"shipping"===p.value&&!v.value?y.value:h.value,b=o.configuration.addressSettings.billingAddressSettings.value,_=at(f?.countryCode,void 0,b),C=ha(),{listen:S}
2=Dl(),{creditCardDisabled:A}=xa(),P="authenticated_user"===d.user.flow.peek(),w=n(e=>A(e)?{success:!1,location:"intercept_card_not_good_for_installments"}:{success:!0},[A]),M=n(async({errors:e}={},n,r)=>{if(e||!f)return t(),s(null),void r({success:!1,location:"intercept_3ds_challenge_complete_error"});let i=null;try{const e=await C.completeCreditCardVerificationAndVault({verificationId:n,billingAddress:f,nickname:null,debitOnly:g.value});"success"===e.status?i=d.session.isInstallmentsSelected.value?w(e.creditCard):{success:!0}:"blocked_by_autopay"===e.status?(a(),i={success:!1,location:"intercept_credit_card_blocked_by_autopay"}):(t(e.errors),i={success:!1,location:"intercept_complete_credit_card_verification_failed"})}catch{t(),i={success:!1,location:"intercept_complete_credit_card_verification_error_caught"}}s(null),r(i)},[f,C,g,d.session.isInstallmentsSelected,w,a,t,s]),x=n(async(e,t)=>new Promise(n=>{S({onComplete:t=>M(t??{},e,n),telemetryContext:{buyerCountryCode:f?.countryCode,isInstallmentsSelected:d.session.isInstallmentsSelected.value,modalSourceType:"shop_pay_interceptor_three_ds_modal_url",selectedPaymentMethod:d.session.isInstallmentsSelected.value?"shop_pay_installments":"shop_pay",source:t,surface:"checkout-web"}})}),[M,S,f?.countryCode,d.session.isInstallmentsSelected]);return n(async()=>{try{if(u.value)return{success:!0};const[n]=m.value;if(!n)return{success:!1,location:"intercept_no_payment_lines"};if("direct"!==n.method.type)return{success:!0};if(!f)return{success:!1,location:"intercept_no_selected_billing_address"};const{isValid:y}=i(),h=_(f,"billing");if("shipping"===p.value&&o.isShippingRequired.value||e(h),!y)return{success:!1,location:"intercept_credit_card_not_valid"};if(0!==h.size)return{success:!1,location:"intercept_billing_address_has_errors"};if(!P)return{success:!0};const v=await l(),b=await C.addCreditCard({sessionId:v,billingAddress:f,nickname:null,debitOnly:g.value,isBlocking:!0});if("success"===b.status)return d.session.isInstallmentsSelected.value?w(b.creditCard):{success:!0};if("requires_redirect"===b.status){const{redirectUrl:e,verificationId:t}=b.threeDSecureAuthenticationRequest;return d.session.isInstallmentsSelected.value&&c.log("shop_pay_installments_3ds_modal_url_set","[ShopPayPaymentMethodInterceptor] Shop Pay Installments 3DS modal URL set",{buyerCountryCode:f?.countryCode,isInstallmentsSelected:!0,modalSourceType:"shop_pay_interceptor_three_ds_modal_url",selectedPaymentMethod:"shop_pay_installments",sourceHostCategory:Ln(e),surface:"checkout-web"}),s(e),x(t,e)}return"blocked_by_autopay"===b.status?(a(),{success:!1,location:"intercept_credit_card_blocked_by_autopay"}):(t(b.errors),r(b.errors?.filter(e=>"billingAddress"===e.field[0]),f),{success:!1,location:"intercept_credit_card_not_saved"})}catch(n){if(n instanceof Tl)return t(),{success:!1,location:"intercept_vault_handle_unavailable"};throw n}},[u,m,f,i,_,p,o.isShippingRequired,P,l,C,g,d.session.isInstallmentsSelected,x,w,c,a,t,r,e,s])}({onAddressValidationErrors:e=>{for(const[t,n]of Array.from(e))m[t].value=n},onSaveCardErrors:c,onDuplicateAutopayCard:u,onSaveCardBillingAddressErrors:p,onThreeDSUrlChange:h,validateCardFields:v,vaultCardWithSelectedNetwork:f});return Pa("paymentMethod",b),i(l,{children:[i(Dn,{source:y,title:d.translate("processing.action_required"),onIframeLoad:g}),o.baseMessage&&i(It,{tone:"critical",children:o.baseMessage}
2),o.blockedByDuplicateAutopayCard&&i(It,{tone:"critical",children:i(Ll,{})})]})}function Fl({vaultHandle:e}){const{checkout:{identity:{current:t}}}=k();return"shopPay"===t.value?i(Nl,{vaultHandle:e}):null}export{_i as A,ds as B,Ei as C,Ll as D,ol as E,Di as F,es as G,ci as H,Ns as I,xl as J,wl as K,wi as L,Vi as M,pr as N,Ci as O,hr as P,ei as Q,Zs as R,ti as S,ni as T,qr as V,$r as a,br as b,fr as c,vr as d,Ur as e,Kr as f,_r as g,Il as h,mr as i,Fl as j,Ar as k,Dl as l,gr as m,Fs as n,Ir as o,Qr as p,tl as q,Xi as r,os as s,ss as t,Lr as u,ys as v,cs as w,Sl as x,cl as y,dl 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.