PageSourceSearch

https://procaccini.com/cdn/shopifycloud/checkout-web/assets/c1/f692f62f.4xq3n272.js

js procaccini.com collected 2026-10-06 19:17:20 UTC 26,286 bytes, 1 lines download raw bytes

1import{z as e,g as s,T as a,h as d,n as t,u as n,S as r,x as i,o as l,_ as o,q as c,N as u,k as p,w as m,p as g}from"./2c1ab0fe.Bywc2Brn.js";import{bE as h,ee as f,b$ as b,cF as A,j as v,ha as S,d as y,ai as _,aD as C,B as w,eM as D,S as M,f as P,b as I,ab as N,i9 as E,a9 as T,aa as k,r as x,c_ as B,ia as O,s as L,K as V,a1 as F,hg as z,bU as j,d4 as $}from"./164ad2e3.DHuJhR22.js";import{b as R}from"./efa0389a.BrVghuh8.js";import{c as q,b9 as U,e2 as W,gR as H,cE as J,e6 as K,bK as Q,d1 as G,e$ as Y,dl as X,kf as Z,gs as ee,bt as se,fQ as ae,fB as de,c8 as te,b4 as ne,b2 as re,iY as ie,jL as le,jS as oe}from"./9dba8418.DInoCEzY.js";import{O as ce}from"./9babe369.D342A3FZ.js";import{C as ue}from"./a422df8c.69YDwZq9.js";import{O as pe,a as me}from"./7a8217fd.BZYlxizD.js";import{M as ge,a as he,u as fe}from"./b684bff6.6xaGXwIR.js";import{C as be}from"./0e67bd3b.CXnH6HFm.js";import{b as Ae,A as ve}from"./74835653.CZU0gWLB.js";import{P as Se}from"./47b970b2.CJVz388Q.js";import{u as ye}from"./22345fd4.DBXfVnfa.js";function _e({id:i,editableAddress:l,addressType:o,countriesOverride:c,saveText:u,cancelText:p,onSave:m,onSuccess:g,onCancel:C,showSavedAddressSelector:w=!0,addressErrorsSignal:D,combineViolationAndValidationErrors:M=!0,addressSettings:P,showDefaultAddressCheckbox:I=!1,onAddressAutoComplete:N}){const[E,T]=e(!1),{i18n:k,checkout:x,shopPay:B}=q(),{createAddressParts:O}=x.negotiator.context,L=O.addressModalState.value,V=U("shippingAddress").value,F=U("billingAddress").value,z="shipping"===o,j=x.installments.isSupported.value,$=W(),R=H(),G=c??(z?$:R),Y="billing"===o,X=j&&B.session.isInstallmentsSelected.value&&x.installments.supportedCountryOptions.value.length>0?x.installments.supportedCountryOptions.value:R,Z=Y&&j&&B.session.isInstallmentsSelected.value,ee=Z?X:G,{updateCountryCodeForSPIBillingAddress:se}=Ae(l.fields.countryCode,ee),ae=Y?x.configuration.addressSettings.billingAddressSettings.value:x.configuration.addressSettings.nonBillingAddressSettings.value,de=j?function({i18n:e,paymentMethodMustSupportInterestBearingLoans:s,supportedCountryOptions:a}){const d=a.map(e=>e.label).join(", ");return s?d?e.translate("installments.installments_debit_cards_supported_countries",{countries:d}):e.translate("installments.installments_valid_debit_cards_fallback"):d?e.translate("installments.installments_cards_supported_countries",{countries:d}):e.translate("installments.installments_valid_cards_fallback")}({i18n:k,paymentMethodMustSupportInterestBearingLoans:x.installments.paymentMethodMustSupportInterestBearingLoans.value,supportedCountryOptions:x.installments.supportedCountryOptions.value}):"",te=l.value,ne=s({...te}),re=l.fields?.countryCode.value,ie=P??ae,le=h(re,ee,ie),oe=f(re),ce=a(()=>J(),[]),ue=D??ce,pe=z?K:Q,{violations:me,clearViolations:ge}=b(pe);d(()=>{("shipping"===o&&V||"billing"===o&&F)&&ge()},[ge,o,V,F]),d(()=>{if("editing"!==L.status)return;const e=oe(o,Array.from(me)),s=Array.from(e).filter(([e])=>te[e]===ne.current?.[e]);if(0===s.length)return;const a=le(te,o),d=M?s.concat(Array.from(a)):Array.from(a);t(()=>{for(const[e,s]of d)ue[e].value=s})},[ue,L.status,o,M,te,le,me,oe]);const he=s(()=>{for(const e of Object.keys(ue))ue[e].value=void 0});d(()=>{const e=he.current;return()=>e()},[]),d(()=>{Z&&se()},[Z,se]);const fe=x.configuration.defaultPhoneNumber.value;d(()=>{if(!fe)return;const e=ie?.isRequired("phone",{useMerchantSettings:!0});e&&!l.fields.phone.value&&(l.fields.phone.value=fe)},[fe,ie,l.fields.phone]);const be=n(r,{children:[I?n(A,{id:`${i??`${o}AddressForm`}_default_address`,name:"default_address",checked:"default"===L.setAsDefault||"enabled"===L.setAsDefault,disabled:"default"===L.setAsDefault,onCh
1ange:e=>{O.addressModalState.value={...L,setAsDefault:e?"enabled":"disabled"}},label:"default"===L.setAsDefault?n(v,{color:"subdued",children:k.translate("address_management.address_form.default_address")}):k.translate("address_management.address_form.default_address")}):null,n(S,{submitText:u??k.translate("address_management.address_form.save"),cancelText:p??k.translate("address_management.address_form.cancel"),loading:E,handleCancel:C})]});return n(_,{onSubmit:async()=>{if(E)return;T(!0);const e=le(te,o);if(e.size)return t(()=>{for(const[s,a]of e)ue[s].value=a}),void T(!1);await(m?.(te))&&g?.(),T(!1)},children:[Z?n(r,{children:[n(v,{children:de}),n(y,{blockSize:"base"})]}):null,n(ve,{id:i??`${o}AddressForm`,address:l,addressType:o,addressErrors:ue,showSavedAddressSelector:w,addressSettings:ie,onAddressAutoComplete:N,countries:ee,children:be})]})}function Ce({explicitlyPreferred:e,onSetDefault:s,showBadge:a=!0,badgeSize:d="base"}){const{i18n:t}=q(),i=!e&&s;return n(r,{children:[e&&a&&n(r,{children:[n(y,{blockSize:"small-400"}),"small"===d?n("span",{className:"CctLS",children:n(C,{size:"small",children:t.translate("payment.default")})}):n(C,{size:d,children:t.translate("payment.default")})]}),i&&n(w,{inlineSize:"fill",variant:"plain",onClick:s,accessibilityLabel:t.translate("shipping.address_default"),inlineAlignment:"start",textDecoration:"none",children:t.translate("shipping.address_default")})]})}function we({address:e,actions:a,nameLinePosition:d,addressDisplayName:t,explicitlyPreferred:c,onSetDefault:u,isImmutableAddress:p,isSelected:m,showsMoreOptionsWhenSelected:g,showPhone:h}){const{i18n:f}=q(),{nameLine:b,primary:A,secondary:S}=D({address:e,nameLinePosition:d,addressDisplayName:t,showPhone:h}),_=i(ce),w=_&&Boolean(c)&&!p,{nameRef:T,probeRef:k,showProbe:x,inlineBadgeFits:B}=function({enabled:e,primary:a,isSelected:d,showsMoreOptionsWhenSelected:t}){const n=s(null),r=s(null),i=l(!1),c=l(!1);return o(()=>{c.value=e},[e,c]),o(()=>{const s=n.current,a=r.current;if(!e||!s||!a)return;const l=()=>{const e=s.closest("label"),n=e?.parentElement,r=s.getClientRects();if(!n||1!==r.length)return void(i.value=!1);const[l]=r,o=n.getBoundingClientRect(),c=getComputedStyle(n),u="rtl"===c.direction?l.left-o.left:o.right-l.right,p=a.getBoundingClientRect().width,m=t&&!d?function(e){const s=parseFloat(getComputedStyle(document.documentElement).fontSize),a=Me(e.getPropertyValue(Pe(G.fontSize.base)),s)*E+Me(e.getPropertyValue(Pe(G.spacing.small100)),s);return Number.isFinite(a)?a:De}(c):0;i.value=p>0&&u-m>=p};let o=!1;return l(),document.fonts?.ready.then(()=>{o||l()}).catch(()=>{}),window.addEventListener("resize",l),()=>{o=!0,window.removeEventListener("resize",l)}},[e,c.value,a,d,t,i]),{nameRef:n,probeRef:r,showProbe:c,inlineBadgeFits:i}}({enabled:w,primary:A,isSelected:m,showsMoreOptionsWhenSelected:g}),O=n(r,{children:[n(y,{display:"inline",inlineSize:"small-200"}),n("span",{className:"_2x9LQ",children:n(C,{size:"small",children:f.translate("payment.default")})})]});return n(N,{gridAutoFlow:"column",gridTemplateColumns:"minmax(0, 1fr) minmax(auto, max-content)",gridTemplateRows:"minmax(0, 1fr)",gap:"base",alignItems:"start",alignContent:"start",children:[n(M,{alignItems:"start",children:n("div",{className:"bAwqP",children:["block"===d&&n(P,{children:b}),w?n(I,{children:[n("span",{ref:T,children:n(v,{type:"strong",children:A})}),x.value&&n("span",{"aria-hidden":!0,className:"Oic4c",ref:k,children:O}),B.value&&O]}):n(P,{children:n(v,{type:"strong",children:A})}),n(P,{children:S}),!p&&n(Ce,{explicitlyPreferred:c,onSetDefault:m?u:void 0,showBadge:!_||!B.value,badgeSize:_?"small":"base"})]})}),a]})}const De=24;function Me(e,s){const a=e.trim();return a.endsWith("rem")?Y(a,s):a.endsWith("px")?parseFloat(a):NaN}function Pe(e){return e.replace(/^var\(|\)$/g,"")}function Ie({state:e,description:s,error:a,onConfirm:d,onCancel:t}){const{i18n:i}=q();return n(r,{children:[a?n(M,{gap:"base",children:n(T,{tone:"critical",errorType:k.PaymentError,children:a})}):null,n(P,{children:s}),n(y,{blockSize:"base"}),n(S,{submitText:i.translate("shipping.delete"),cancelText:i.translate("address_management.address_form.cancel"),loading:"deleting"===e,handleSubmit:d,handleCancel:t,submitButtonAppearance:"critical"})]})}function Ne({state:e,title:s,description:a,error:d,onConfirm:t,onCancel:r}){return n(pe,{open:"active"===e||"deleting"===e,heading:s,onHide:r,children:n(Ie,{state:e,description:a,error:d,onConfirm:t,onCancel:r})})}const Ee="addressSelector--",Te=L("AddressSelector");
1function ke({id:s,selectedId:d="",addressType:t="shipping",onChange:i,onEdit:l,onDelete:o,onSetDefault:u,addresses:p,addressesTitle:m,immutableAddresses:g=[],immutableAddressSections:h=[],getAddressDisplayName:f,selectedAddressDetails:b}){const A=x(s,Te),{i18n:S}=q(),[_,C]=e("idle"),w=B(),D=a(()=>p.filter(e=>!e.disabled),[p]),M=a(()=>p.filter(e=>e.disabled),[p]),P="shipping"===t,I=O(t),N=c(e=>(l||o)&&e===d,[l,o,d]),[E,T]=e(I),k=a(()=>l?{accessibilityLabel:P?S.translate("shipping.address_edit"):S.translate("billing.address_edit"),onClick:l,label:P?S.translate("shipping.edit"):S.translate("billing.edit")}:void 0,[l,P,S]),L=c(()=>(T(I),C("active")),[I]),V=a(()=>o?{accessibilityLabel:P?S.translate("shipping.address_delete"):S.translate("billing.address_delete"),onClick:L,label:P?S.translate("shipping.delete"):S.translate("billing.delete"),destructive:!0}:void 0,[o,P,S,L]),F=d?xe(d,A):void 0,z=c(([e=""])=>{const s=function(e,s=""){return e.replace(`${s}${Ee}`,"")}(e,A);s&&i(s)},[i,A]),{ungroupedImmutableAddresses:j,groupedImmutableAddresses:$}=function(e,s){return a(()=>{const a=new Map(e.map(e=>[e.id,e])),d=new Set(s.flatMap(({addressIds:e})=>[...e]));return{ungroupedImmutableAddresses:e.filter(({id:e})=>!d.has(e)),groupedImmutableAddresses:s.map(({title:e,addressIds:s})=>({title:e,addresses:Array.from(s).flatMap(e=>{const s=a.get(e);return s?[s]:[]})}))}},[e,s])}(g,h),R=p.length+g.length===1,U=P?S.translate("shipping.address_more"):S.translate("billing.address_more"),W=a(()=>[...k?[k]:[],...V?[V]:[]],[k,V]),H=j.length>0&&p.length>0&&m,J=a(()=>F?[F]:[],[F]);return n(r,{children:[n(ue,{name:`${t}Address`,values:J,onChange:z,hideRadioControl:R,selectedContentBackground:b?"selected":void 0,children:[n(Be,{addresses:j,formId:A,selectedId:d,isImmutable:!0,getAddressDisplayName:f,onSetDefault:u}),H&&n(r,{children:[n(y,{blockSize:"base"}),n(v,{color:"subdued",children:m}),n(y,{blockSize:"base"})]}),n(Be,{addresses:D,formId:A,selectedId:d,shouldShowMoreOptionsButton:N,moreOptionsAccessibilityLabel:U,moreOptionsActions:W,getAddressDisplayName:f,onSetDefault:u,selectedAddressDetails:b}),n(Be,{addresses:M,formId:A,selectedId:d,shouldShowMoreOptionsButton:N,moreOptionsAccessibilityLabel:U,moreOptionsActions:W,getAddressDisplayName:f,onSetDefault:u}),$.map(({title:e,addresses:s})=>n(Be,{title:e,addresses:s,formId:A,selectedId:d,isImmutable:!0,selectedAddressDetails:b},e))]}),o&&n(Ne,{state:_,title:P?S.translate("shipping.address_delete"):S.translate("billing.address_delete"),description:S.translate("address_management.confirm_address_deletion",{address:E}),onConfirm:async()=>{C("deleting"),await o(),w.current&&C("idle")},onCancel:()=>C("idle")})]})}function xe(e,s=""){return`${s}${Ee}${e}`}function Be({title:e,addresses:s,formId:a,selectedId:d,isImmutable:t=!1,shouldShowMoreOptionsButton:i,moreOptionsAccessibilityLabel:l,moreOptionsActions:o,getAddressDisplayName:c,onSetDefault:u,selectedAddressDetails:p}){const m=s.map(e=>n(Oe,{addressId:e.id,address:e.address,choiceValue:xe(e.id,a),disabled:e.disabled,isImmutableAddress:t,showMoreOptionsButton:Boolean(i?.(e.id)),moreOptionsAccessibilityLabel:l,moreOptionsActions:o,addressDisplayName:c?.(e.id),explicitlyPreferred:e.default,onSetDefault:u,isSelected:d===e.id,details:d===e.id?p:void 0},e.id));return n(r,e?{children:[n(y,{blockSize:"base"}),n(v,{color:"subdued",children:e}),n(y,{blockSize:"base"}),m]}:{children:m})}const Oe=u(function({addressId:e,address:s,choiceValue:a,disabled:d=!1,isImmutableAddress:t=!1,showMoreOptionsButton:r=!1,moreOptionsAccessibilityLabel:l="",moreOptionsActions:o=[],addressDisplayName:c,explicitlyPreferred:u,onSetDefault:p,isSelected:m,details:g}){const h=i(ce),f=n(R,{value:a,disabled:d,selectedContent:g,selectedContentPadding:g?"none":void 0,secondaryContent:r&&!t&&n(ge,{accessibilityLabel:l,options:o}),children:n(N,{gridAutoFlow:"column",gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",alignItems:"center",alignContent:"center",children:n(M,{gap:"small-400",children:n(we,{nameLinePosition:"inline",address:s,addressDisplayName:c,explicitlyPreferred:u,isImmutableAddress:t,onSetDefault:p,isSelected:m,showsMoreOptionsWhenSelected:!t&&o.length>0,showPhone:!0})})})},e);return h?f:n(N,{gridAutoFlow:"column",gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",alignItems:"start",alignContent:"start",children:f},e)});function Le({onClick:e,textLabel:s}){const{rollup:{action:{tone:a}={}}={}}=V();
1return n(w,{tone:"custom"===a?"custom":void 0,variant:"plain",textDecoration:"none",onClick:e,children:n(M,{direction:"inline",gap:"small-100",alignItems:"center",children:[n(F,{type:"plus",size:"base"}),n(v,{children:s})]})})}function Ve({open:e,isEditing:s,address:a,addressType:d,onSave:t,onClose:i,id:l,saveText:o,cancelText:c,showSavedAddressSelector:u,combineViolationAndValidationErrors:g,addressErrorsSignal:h,addressSettings:f,modalSubtitle:b,showDefaultAddressCheckbox:A,errorBannerMessage:v}){const{i18n:S}=q(),_="shipping"===d,C=_?S.translate("address_management.address_form.add"):S.translate("billing.address_form.add_address"),w=_?S.translate("shipping.address_edit"):S.translate("billing.address_edit"),D=s?w:C,I=_?S.translate("address_management.address_form.save"):S.translate("billing.address_form.save"),N=_?S.translate("address_management.address_form.cancel"):S.translate("billing.address_form.cancel"),E=void 0===g?s:g,x=p(()=>v?.value??void 0);return n(pe,{open:e,heading:D,onHide:i,children:[b?n(r,{children:[n(P,{color:"subdued",children:b}),n(y,{blockSize:"base"})]}):null,n(M,{gap:"base",children:[n(m,{when:x,children:e=>n(T,{tone:"critical",errorType:"shipping"===d?k.DeliveryError:k.PaymentError,children:n(P,{children:e})})}),a&&n(_e,{id:l,editableAddress:a,addressType:d,saveText:o??I,cancelText:c??N,onSave:t,onSuccess:i,onCancel:i,showSavedAddressSelector:u,addressErrorsSignal:h,combineViolationAndValidationErrors:E,addressSettings:f,showDefaultAddressCheckbox:A})]})]})}function Fe({id:e,addressType:s="shipping",onSave:a,onAddAction:d,showSavedAddressSelector:t=!0,addressErrorsSignal:i,errorBannerMessage:l,showNewAddressButton:o=!0,combineViolationAndValidationErrors:c,addressSettings:u,modalSubtitle:p,showDefaultAddressCheckbox:m=!1,hideAddressModal:g=!1}){const{i18n:h,checkout:{negotiator:f}}=q(),{createAddressParts:b}=f.context,A=b.addressModalState.value,v="shipping"===s,S="editing"===A.status,y=A.addressType===s&&("editing"===A.status||"adding"===A.status),_=!g&&y,C=v?h.translate("shipping.add_address"):h.translate("billing.add_address");return n(r,{children:[o&&n(Le,{onClick:d,textLabel:C}),n(Ve,{open:_,isEditing:S,address:A.address,addressType:s,onSave:a,onClose:()=>{l&&(l.value=void 0),b.addressModalState.value={status:"idle",addressType:s,address:A.address,setAsDefault:"default"}},id:e,showSavedAddressSelector:t,addressErrorsSignal:i,errorBannerMessage:l,combineViolationAndValidationErrors:c,addressSettings:u,modalSubtitle:p,showDefaultAddressCheckbox:m})]})}class ze extends Error{constructor(e,s){super(e),this.name="InvalidSelectedAddressError",this.groupingHash="AddressEdit::InvalidSelectedAddressError",this.name="InvalidSelectedAddressError",this.groupingHash=s}}function je({addressType:s,addresses:d,immutableAddresses:t=[],immutableAddressSections:r=[],addressesTitle:i,selectedAddress:l,onSelectAddress:o,onCreateAddress:u=async()=>{},onUpdateAddress:p=async()=>{},onDeleteAddress:m=async()=>!1,onSetDefault:g=async()=>!1,addressErrorsSignal:h,canCreateAddress:f=!1,canUpdateAddress:b=!1,canDeleteAddress:A=!1,canSetDefaultAddress:v=!1,getAddressDisplayName:S,addressSettings:y,modalSubtitle:_,canChangeCompanyLocation:C=!1,createAddressFormId:w,errorBannerMessage:D,noticesSection:P="delivery",selectedAddressDetails:N,showNotices:E=!0,onBeforeSelectAddress:T,onBeforeCreateAddress:k,onBeforeUpdateAddress:x,onBeforeDeleteAddress:B,hideAddressModal:O=!1}){const{checkout:L,i18n:V,observability:F}=q(),{createAddressParts:$}=L.negotiator.context,{extendedAddressMode:R}=L.address,U="shipping"===s&&L.proposal.negotiated.fields.mustSelectProvidedAddress.value,{defaultShippingDetails:W}=L.configuration.addressSettings.nonBillingAddressSettings.value,H=W.country.code,J=a(()=>d.map($e),[d]),K=a(()=>t.map($e),[t]),Q=a(()=>J.filter(e=>!e.disabled),[J]),[G,Y]=e(0),Z=c(e=>{const s=[...Q,...K],a=s.find(({id:s})=>s===e);if(!a){const a=s.map(({id:e})=>e).join(",");return void F.error(new ze(`Unexpected address id: '${e}' not found in choices ${a}`,"AddressEdit::handleChange::InvalidSelectedAddressError"))}if(T){let e=!1;T(a,()=>{e=!0,o(a)}),e||Y(e=>e+1)}else o(a)},[Q,K,o,T,F]),ee=c(()=>
1{if(!l)throw new ze("Attempted to edit an address without a selected address","AddressEdit::handleEditAction::InvalidSelectedAddressError");$.addressModalState.value={status:"editing",address:X(l.address,{extendedAddressMode:R}),addressType:s,addressId:l.id,setAsDefault:l.default?"default":"disabled"}},[l,s,$.addressModalState,R]),se=c(()=>{const e=Q?.[0],a=X({firstName:e?.address.firstName,lastName:e?.address.lastName,countryCode:H??e?.address.countryCode},{extendedAddressMode:R});$.addressModalState.value={status:"adding",address:a,addressType:s,setAsDefault:"disabled"}},[s,Q,$.addressModalState,H,R]),ae=c(async()=>{if(!l)throw new ze("Attempted to delete an address without a selected address","AddressEdit::handleDelete::InvalidSelectedAddressError");const e=l.id;return B?B(e,()=>m(e)):m(e)},[m,B,l]),de=c(async e=>{const s=$.addressModalState.value,a="enabled"===s.setAsDefault;if("adding"===s.status){const s={address:e,setDefault:a};return k?k(s,()=>u(s)):u(s)}if("editing"===s.status){const d={id:s.addressId,address:e,setDefault:a};return x?x(d,()=>p(d)):p(d)}},[$.addressModalState,u,p,k,x]),te=c(async()=>{if(!l)throw new ze("Attempted to set a default address without a selected address","AddressEdit::handleSetDefault::InvalidSelectedAddressError");l.default||await g(l.id)},[g,l]),ne=A&&Q.length>1,re=f||b,ie=$.addressModalState.value,le="editing"===ie.status&&J.some(({id:e})=>e===ie.addressId),oe=v&&("editing"!==ie.status||le);return n(M,{gap:"base",children:[E&&n(z,{section:P}),U?n(j,{tone:"info",children:V.translate("address_management.must_use_address_banner")}):null,n(ke,{id:"shipping"===s?"shippingAddressSelector":void 0,addressType:s,selectedId:l?.id,onChange:Z,onEdit:b?ee:void 0,getAddressDisplayName:S,addresses:J,addressesTitle:i,immutableAddresses:K,immutableAddressSections:r,onDelete:ne?ae:void 0,onSetDefault:v?te:void 0,selectedAddressDetails:N},G),C&&n(I,{padding:"none small-100",children:n(be,{showIcon:!0})}),re&&n(I,{padding:"none small-100",children:n(Fe,{id:w,addressType:s,onSave:de,onAddAction:se,showNewAddressButton:f,showSavedAddressSelector:!1,addressErrorsSignal:h,errorBannerMessage:D,modalSubtitle:_,addressSettings:y,showDefaultAddressCheckbox:oe,hideAddressModal:O})})]})}function $e(e){return{...e,id:e.id?e.id:Z(e.address)}}const Re=e=>!e.firstName?.trim();function qe(e,s,a,d){!function(e,s,a){const d=e.selectedPaymentMethod.value;if(!d||!se(d))return;const t=d.paymentAttributes.billingAddress.address;Re(t)&&ae(t,s)&&e.selectPaymentMethod({...d,paymentAttributes:{...d.paymentAttributes,billingAddressValid:a,billingAddress:{...d.paymentAttributes.billingAddress,address:{...t,firstName:s.firstName}}}})}(e,a,d),function(e,s,a){t(()=>{for(const d of e.paymentMethods.value){if(!se(d))continue;const{billingAddress:t}=d.paymentAttributes;Re(t.address)&&ae(t.address,s)&&e.updateCreditCard(d.id,{billingAddressValid:a,billingAddress:{...t,address:{...t.address,firstName:s.firstName}}})}})}(s,a,d)}function Ue({addressType:e="shipping",onPersistSuccess:s}={}){const{i18n:a,checkout:{validation:d,negotiator:t},shopPay:r}=q(),{isMissingFirstName:i}=he({addressType:e}),l=p(()=>{const s="billing"===e?r.session.selectedBillingAddress.value:r.session.selectedShippingAddress.value;return s?.id===de?s:s?.id??("billing"===e?t.parts.billingAddress.value:t.parts.shippingAddress.value)}),o=d.missingFields.firstName.input,u=d.missingFields.firstName.error;(function({enabled:e,addressType:s,onPersistSuccess:a}){const{i18n:d,shopPay:t,observability:n,checkout:r}=q(),i=r.negotiator,l=r.validation.missingFields.firstName.input,o=r.validation.missingFields.firstName.error,c="billing"===s?le:oe;function u(){o.value="",("billing"===s?r.addressManager.billing.value:r.addressManager.shipping.value).errors.fields.firstName.value=void 0,i.removeViolations(c)}function p(e){const s=t.session.selectedBillingAddress.value;s&&s.id===e.id&&ae(s.address,e.address)&&(t.session.unstable_updateSelectedBillingAddress(e),r.negotiator.parts.billingAddress.value=e.address)}me("firstName",async()=>{if(!e)return{success:!0};const i=l.value.trim();if(!i)return o.value=d.translate("field_errors.address_first_name_blank"),{success:!1,location:"first_name_blank"};const c=function(e,s,a,d){return"billing"===e?a?s.find(e=>ee(e.address,a,["phone","firstName"]))??null:null:d??null}(s,t.user.addresses.value,r.negotiator.parts.billingAddress.value,t.session.selectedShippingAddress.value);return c?t.user.addresses.value.some(e=>e.id===c.id)?async function(e,s,i){const l="billing"===i,c=l?r.addressManager.billing.value:r.addressManager.shipping.value,m={...e,address:{...e.address,firstName:s}},g=await c.updateAddress({id:e.id,address:m.address}),h=t.user.addresses.value.find(s=>
1s.id===e.id)??m;return g?(l?(r.negotiator.parts.billingAddress.value=g.address,qe(t.session,t.user,h.address,h.valid)):(p(h),qe(t.session,t.user,h.address,h.valid)),u(),a?.(),{success:!0}):(n.leaveErrorBreadcrumb("Shop Pay update address first name failed"),o.value=d.translate("field_errors.address_generic_error"),{success:!1,location:"first_name_update_failed"})}(c,i,s):function(e,d){const n={...e,address:{...e.address,firstName:d}};return"billing"===s?(t.session.unstable_updateSelectedBillingAddress(n),r.negotiator.parts.billingAddress.value=n.address):(t.session.unstable_updateSelectedShippingAddress(n),r.negotiator.parts.shippingAddress.value=n.address,p(n)),u(),a?.(),{success:!0}}(c,i):"billing"===s?function(e){const s=r.negotiator.parts.billingAddress.value;if(!s)return{success:!1,location:"first_name_no_address"};const d={...s,firstName:e};return r.negotiator.parts.billingAddress.value=d,u(),a?.(),{success:!0}}(i):{success:!1,location:"first_name_no_address"}})})({enabled:i,addressType:e,onPersistSuccess:s}),g(()=>{if(l.value)return()=>{o.value="",u.value=""}});const m=c(e=>{if(!te(e))return a.translate("field_errors.address_first_name_blank")},[a]),h=ne(o,u,m);re(o,u,m);const f=u.value,b=ie(f)?f.message:f;return n($,{name:"firstName",label:a.translate("contact.first_name_label"),required:!0,autocomplete:"given-name",...h,error:h.error||b})}function We(e,s,a){return te(e)?a(e,s)?{isValid:!0}:{isValid:!1,reason:"phone_invalid"}:{isValid:!1,reason:"phone_blank"}}const He={id:"fb48dec1806e3e11b7375d723d9e47d5006dda9d3285b2f42dc9138fade9163b",type:"mutation",name:"AddPhone",source:"mutation AddPhone($phone:String!,$payAddressUuid:String){addPhone(phone:$phone,payAddressUuid:$payAddressUuid){userErrors{field message __typename}__typename}}"};function Je({addressType:e="shipping"}={}){const{i18n:s,checkout:{validation:t,negotiator:r}}=q(),{validatePhoneNumber:i}=ye(),{isMissingPhone:l}=fe({addressType:e}),o="billing"===e?r.parts.billingAddress.value:r.parts.shippingAddress.value,u=o?.countryCode,p=t.missingFields.phone.input,m=t.missingFields.phone.error,h=t.missingFields.phone.isValid;(function(e,s,{enabled:d,addressType:t="shipping"}){const{i18n:n,graphql:{shopPayGraphql:r},shopPay:i,observability:l,checkout:{negotiator:o}}=q(),{formatPhoneNumber:c,validatePhoneNumber:u}=ye(),p="billing"===t?o.parts.billingAddress.value:o.parts.shippingAddress.value,m=p?.countryCode,g=a(()=>function({graphql:e,observability:s}){return async(a,d)=>{const{data:t,error:n}=await e.mutate(He,{variables:{phone:a,payAddressUuid:d}});return n||null==t||null==t.addPhone?(s.leaveErrorBreadcrumb("Shop Pay add phone mutation failed with a transport or null-response error"),!1):!(t.addPhone.userErrors?.length>0&&(s.leaveErrorBreadcrumb("Shop Pay add phone mutation returned user errors",{userErrors:JSON.stringify(t.addPhone.userErrors)}),1))}}({graphql:r,observability:l}),[r,l]);me("phone",async()=>{if(!d)return{success:!0};const a=We(s.value,m,u);if(!a.isValid)return e.value=function(e,s){return"phone_blank"===e?s.translate("field_errors.phone_blank"):s.translate("field_errors.shipping_line_phone_invalid")}(a.reason,n),{success:!1,location:a.reason};e.value=void 0;const r=c(s.value,m);if(!r)return e.value=n.translate("field_errors.shipping_line_phone_invalid"),{success:!1,location:"phone_format_failed"};const l="billing"===t?i.session.selectedBillingAddress.value?.uuid:i.session.selectedShippingAddress.value?.uuid;return await g(r,l)?(i.user.unstable_setPhoneNumber(r),{success:!0}):(e.value=n.translate("field_errors.shipping_line_phone_invalid"),{success:!1,location:"add_phone_mutation_failed"})})})(m,p,{enabled:l,addressType:e}),g(()=>{const e=We(p.value,u,i);h.value=e.isValid}),d(()=>()=>{h.value=!0,m.value=""},[h,m]);const f=c(e=>te(e)?i(e??"",u)?void 0:s.translate("field_errors.shipping_line_phone_invalid"):s.translate("field_errors.phone_blank"),[i,u,s]),{onInput:b,...A}=ne(p,m,f);re(p,m,f);const v=m.value,S=ie(v)?v.message:v;return n(Se,{name:"phone",countryCode:u??"",label:s.translate("contact.phone_label"),prefillCountryCode:!0,required:!0,autocomplete:"billing"===e?"billing tel-national":"shipping tel-national",...A,onInput:e=>{b?.(e),p.value=e??""},error:A.error||S})}function Ke({addressType:e="shipping",onFirstNamePersisted:s}={}){const{isMissingPhone:a}=fe({addressType:e}),{isMissingFirstName:d}=he({addressType:e});return a||d?n(I,{paddingInline:"base",paddingBlockStart:"small-200",paddingBlockEnd:"base",children:n(M,{direction:"block",gap:"base",children:[d&&n(Ue,{addressType:e,onPersistSuccess:s}),a&&n(Je,{addressType:e})]})}):null}const Qe={RedirectionNotice:"p97qJ"};export{je as A,_e as C,Ke as M,Le as a,Ne as b,ke as c,we as d,Qe as s};

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.