PageSourceSearch

https://obermeyer.com/cdn/shopifycloud/checkout-web/assets/c1/7114e006.Dn0MarCB.js

js obermeyer.com collected 2026-10-02 11:34:33 UTC 26,010 bytes, 1 lines download raw bytes

1import{x as e,l as s,T as d,m as a,n as t,u as n,S as r,E as i,q as l,_ as o,s as c,N as u,t as p,w as m,C as f}from"./2c1ab0fe.GMbxnz74.js";import{bp as h,ec as g,bN as b,cx as A,o as v,fl as S,b as y,_,fc as C,l as w,eN as D,c as M,P,B as I,J as N,fm as T,W as E,F as x,M as B,cT as k,fn as O,Q as F,a4 as V,I as L,fo as z,bF as $,c$ as j}from"./164ad2e3.BbIvMjRY.js";import{b as R}from"./efa0389a.Cyj781OI.js";import{S as q,aZ as U,bh as W,er as H,f3 as J,cQ as Q,ev as G,c1 as Z,df as K,f4 as X,dJ as Y,f5 as ee,e as se,l as de,f6 as ae,W as te,f7 as ne,cr as re,bq as ie,bo as le,f8 as oe,aa as ce,f9 as ue,fa as pe}from"./4c290a1e.C6TDJ9Fn.js";import{O as me}from"./f692f62f.DHgy7Fzw.js";import{C as fe}from"./a422df8c.BXxALpKm.js";import{O as he,u as ge}from"./7a8217fd.CuaDs8we.js";import{M as be,a as Ae,u as ve}from"./b684bff6.BpL4wH2U.js";import{C as Se}from"./0e67bd3b.rrDC0LWO.js";import{u as ye,A as _e}from"./74835653.CRP9zX7D.js";import{P as Ce}from"./47b970b2.hK1atmf1.js";import{u as we}from"./53bbdad9.CGJC_1cv.js";function De({id:i,editableAddress:l,addressType:o,countriesOverride:c,saveText:u,cancelText:p,onSave:m,onSuccess:f,onCancel:C,showSavedAddressSelector:w=!0,addressErrorsSignal:D,combineViolationAndValidationErrors:M=!0,addressSettings:P,showDefaultAddressCheckbox:I=!1,onAddressAutoComplete:N}){const[T,E]=e(!1),{i18n:x,checkout:B,shopPay:k}=q(),{createAddressParts:O}=U(),F=O.addressModalState.value,V=W("shippingAddress").value,L=W("billingAddress").value,z="shipping"===o,$=B.installments.isSupported.value,j=H(),R=J(),K=c??(z?j:R),X="billing"===o,Y=$&&k.session.isInstallmentsSelected.value&&B.installments.supportedCountryOptions.value.length>0?B.installments.supportedCountryOptions.value:R,ee=X&&$&&k.session.isInstallmentsSelected.value,se=ee?Y:K,{updateCountryCodeForSPIBillingAddress:de}=ye(l.fields.countryCode,se),ae=X?B.configuration.addressSettings.billingAddressSettings.value:B.configuration.addressSettings.nonBillingAddressSettings.value,te=$?function({i18n:e,paymentMethodMustSupportInterestBearingLoans:s,supportedCountryOptions:d}){const a=d.map(e=>e.label).join(", ");return s?a?e.translate("installments.installments_debit_cards_supported_countries",{countries:a}):e.translate("installments.installments_valid_debit_cards_fallback"):a?e.translate("installments.installments_cards_supported_countries",{countries:a}):e.translate("installments.installments_valid_cards_fallback")}({i18n:x,paymentMethodMustSupportInterestBearingLoans:B.installments.paymentMethodMustSupportInterestBearingLoans.value,supportedCountryOptions:B.installments.supportedCountryOptions.value}):"",ne=l.value,re=s({...ne}),ie=l.fields?.countryCode.value,le=P??ae,oe=h(ie,se,le),ce=g(ie),ue=d(()=>Q(),[]),pe=D??ue,me=z?G:Z,{violations:fe,clearViolations:he}=b(me);a(()=>{("shipping"===o&&V||"billing"===o&&L)&&he()},[he,o,V,L]),a(()=>{if("editing"!==F.status)return;const e=ce(o,Array.from(fe)),s=Array.from(e).filter(([e])=>ne[e]===re.current?.[e]);if(0===s.length)return;const d=oe(ne,o),a=M?s.concat(Array.from(d)):Array.from(d);t(()=>{for(const[e,s]of a)pe[e].value=s})},[pe,F.status,o,M,ne,oe,fe,ce]);const ge=s(()=>{for(const e of Object.keys(pe))pe[e].value=void 0});a(()=>{const e=ge.current;return()=>e()},[]),a(()=>{ee&&de()},[ee,de]);const be=B.configuration.defaultPhoneNumber.value;a(()=>{if(!be)return;const e=le?.isRequired("phone",{useMerchantSettings:!0});e&&!l.fields.phone.value&&(l.fields.phone.value=be)},[be,le,l.fields.phone]);const Ae=n(r,{children:[I?n(A,{id:`${i??`${o}AddressForm`}_default_address`,name:"default_address",checked:"default"===F.setAsDefault||"enabled"===F.setAsDefault,disabled:"default"===F.setAsDefault,onCh
1ange:e=>{O.addressModalState.value={...F,setAsDefault:e?"enabled":"disabled"}},label:"default"===F.setAsDefault?n(v,{color:"subdued",children:x.translate("address_management.address_form.default_address")}):x.translate("address_management.address_form.default_address")}):null,n(S,{submitText:u??x.translate("address_management.address_form.save"),cancelText:p??x.translate("address_management.address_form.cancel"),loading:T,handleCancel:C})]});return n(_,{onSubmit:async()=>{if(T)return;E(!0);const e=oe(ne,o);if(e.size)return t(()=>{for(const[s,d]of e)pe[s].value=d}),void E(!1);await(m?.(ne))&&f?.(),E(!1)},children:[ee?n(r,{children:[n(v,{children:te}),n(y,{blockSize:"base"})]}):null,n(_e,{id:i??`${o}AddressForm`,address:l,addressType:o,addressErrors:pe,showSavedAddressSelector:w,addressSettings:le,onAddressAutoComplete:N,countries:se,children:Ae})]})}function Me({explicitlyPreferred:e,onSetDefault:s,showBadge:d=!0,badgeSize:a="base"}){const{i18n:t}=q(),i=!e&&s;return n(r,{children:[e&&d&&n(r,{children:[n(y,{blockSize:"small-400"}),"small"===a?n("span",{className:"CctLS",children:n(C,{size:"small",children:t.translate("payment.default")})}):n(C,{size:a,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 Pe({address:e,actions:d,nameLinePosition:a,addressDisplayName:t,explicitlyPreferred:c,onSetDefault:u,isImmutableAddress:p,isSelected:m,showsMoreOptionsWhenSelected:f,showPhone:h}){const{i18n:g}=q(),{nameLine:b,primary:A,secondary:S}=D({address:e,nameLinePosition:a,addressDisplayName:t,showPhone:h}),_=i(me),w=_&&Boolean(c)&&!p,{nameRef:E,probeRef:x,showProbe:B,inlineBadgeFits:k}=function({enabled:e,primary:d,isSelected:a,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,d=r.current;if(!e||!s||!d)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=d.getBoundingClientRect().width,m=t&&!a?function(e){const s=parseFloat(getComputedStyle(document.documentElement).fontSize),d=Ne(e.getPropertyValue(Te(K.fontSize.base)),s)*T+Ne(e.getPropertyValue(Te(K.spacing.small100)),s);return Number.isFinite(d)?d:Ie}(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,d,a,t,i]),{nameRef:n,probeRef:r,showProbe:c,inlineBadgeFits:i}}({enabled:w,primary:A,isSelected:m,showsMoreOptionsWhenSelected:f}),O=n(r,{children:[n(y,{display:"inline",inlineSize:"small-200"}),n("span",{className:"_2x9LQ",children:n(C,{size:"small",children:g.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"===a&&n(P,{children:b}),w?n(I,{children:[n("span",{ref:E,children:n(v,{type:"strong",children:A})}),B.value&&n("span",{"aria-hidden":!0,className:"Oic4c",ref:x,children:O}),k.value&&O]}):n(P,{children:n(v,{type:"strong",children:A})}),n(P,{children:S}),!p&&n(Me,{explicitlyPreferred:c,onSetDefault:m?u:void 0,showBadge:!_||!k.value,badgeSize:_?"small":"base"})]})}),d]})}const Ie=24;function Ne(e,s){const d=e.trim();return d.endsWith("rem")?X(d,s):d.endsWith("px")?parseFloat(d):NaN}function Te(e){return e.replace(/^var\(|\)$/g,"")}function Ee({state:e,description:s,error:d,onConfirm:a,onCancel:t}){const{i18n:i}=q();return n(r,{children:[d?n(M,{gap:"base",children:n(E,{tone:"critical",errorType:x.PaymentError,children:d})}):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:a,handleCancel:t,submitButtonAppearance:"critical"})]})}function xe({state:e,title:s,description:d,error:a,onConfirm:t,onCancel:r}){return n(he,{open:"active"===e||"deleting"===e,heading:s,onHide:r,children:n(Ee,{state:e,description:d,error:a,onConfirm:t,onCancel:r})})}const Be="addressSelector--",ke=F("AddressSelector");
1function Oe({id:s,selectedId:a="",addressType:t="shipping",onChange:i,onEdit:l,onDelete:o,onSetDefault:u,addresses:p,addressesTitle:m,immutableAddresses:f=[],immutableAddressSections:h=[],getAddressDisplayName:g,selectedAddressDetails:b}){const A=B(s,ke),{i18n:S}=q(),[_,C]=e("idle"),w=k(),D=d(()=>p.filter(e=>!e.disabled),[p]),M=d(()=>p.filter(e=>e.disabled),[p]),P="shipping"===t,I=O(t),N=c(e=>(l||o)&&e===a,[l,o,a]),[T,E]=e(I),x=d(()=>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]),F=c(()=>(E(I),C("active")),[I]),V=d(()=>o?{accessibilityLabel:P?S.translate("shipping.address_delete"):S.translate("billing.address_delete"),onClick:F,label:P?S.translate("shipping.delete"):S.translate("billing.delete"),destructive:!0}:void 0,[o,P,S,F]),L=a?Fe(a,A):void 0,z=c(([e=""])=>{const s=function(e,s=""){return e.replace(`${s}${Be}`,"")}(e,A);s&&i(s)},[i,A]),{ungroupedImmutableAddresses:$,groupedImmutableAddresses:j}=function(e,s){return d(()=>{const d=new Map(e.map(e=>[e.id,e])),a=new Set(s.flatMap(({addressIds:e})=>[...e]));return{ungroupedImmutableAddresses:e.filter(({id:e})=>!a.has(e)),groupedImmutableAddresses:s.map(({title:e,addressIds:s})=>({title:e,addresses:Array.from(s).flatMap(e=>{const s=d.get(e);return s?[s]:[]})}))}},[e,s])}(f,h),R=p.length+f.length===1,U=P?S.translate("shipping.address_more"):S.translate("billing.address_more"),W=d(()=>[...x?[x]:[],...V?[V]:[]],[x,V]),H=$.length>0&&p.length>0&&m,J=d(()=>L?[L]:[],[L]);return n(r,{children:[n(fe,{name:`${t}Address`,values:J,onChange:z,hideRadioControl:R,selectedContentBackground:b?"selected":void 0,children:[n(Ve,{addresses:$,formId:A,selectedId:a,isImmutable:!0,getAddressDisplayName:g,onSetDefault:u}),H&&n(r,{children:[n(y,{blockSize:"base"}),n(v,{color:"subdued",children:m}),n(y,{blockSize:"base"})]}),n(Ve,{addresses:D,formId:A,selectedId:a,shouldShowMoreOptionsButton:N,moreOptionsAccessibilityLabel:U,moreOptionsActions:W,getAddressDisplayName:g,onSetDefault:u,selectedAddressDetails:b}),n(Ve,{addresses:M,formId:A,selectedId:a,shouldShowMoreOptionsButton:N,moreOptionsAccessibilityLabel:U,moreOptionsActions:W,getAddressDisplayName:g,onSetDefault:u}),j.map(({title:e,addresses:s})=>n(Ve,{title:e,addresses:s,formId:A,selectedId:a,isImmutable:!0,selectedAddressDetails:b},e))]}),o&&n(xe,{state:_,title:P?S.translate("shipping.address_delete"):S.translate("billing.address_delete"),description:S.translate("address_management.confirm_address_deletion",{address:T}),onConfirm:async()=>{C("deleting"),await o(),w.current&&C("idle")},onCancel:()=>C("idle")})]})}function Fe(e,s=""){return`${s}${Be}${e}`}function Ve({title:e,addresses:s,formId:d,selectedId:a,isImmutable:t=!1,shouldShowMoreOptionsButton:i,moreOptionsAccessibilityLabel:l,moreOptionsActions:o,getAddressDisplayName:c,onSetDefault:u,selectedAddressDetails:p}){const m=s.map(e=>n(Le,{addressId:e.id,address:e.address,choiceValue:Fe(e.id,d),disabled:e.disabled,isImmutableAddress:t,showMoreOptionsButton:Boolean(i?.(e.id)),moreOptionsAccessibilityLabel:l,moreOptionsActions:o,addressDisplayName:c?.(e.id),explicitlyPreferred:e.default,onSetDefault:u,isSelected:a===e.id,details:a===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 Le=u(function({addressId:e,address:s,choiceValue:d,disabled:a=!1,isImmutableAddress:t=!1,showMoreOptionsButton:r=!1,moreOptionsAccessibilityLabel:l="",moreOptionsActions:o=[],addressDisplayName:c,explicitlyPreferred:u,onSetDefault:p,isSelected:m,details:f}){const h=i(me),g=n(R,{value:d,disabled:a,selectedContent:f,selectedContentPadding:f?"none":void 0,secondaryContent:r&&!t&&n(be,{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(Pe,{nameLinePosition:"inline",address:s,addressDisplayName:c,explicitlyPreferred:u,isImmutableAddress:t,onSetDefault:p,isSelected:m,showsMoreOptionsWhenSelected:!t&&o.length>0,showPhone:!0})})})},e);return h?g:n(N,{gridAutoFlow:"column",gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",alignItems:"start",alignContent:"start",children:g},e)});function ze({onClick:e,textLabel:s}){const{rollup:{action:{tone:d}={}}={}}=V();
1return n(w,{tone:"custom"===d?"custom":void 0,variant:"plain",textDecoration:"none",onClick:e,children:n(M,{direction:"inline",gap:"small-100",alignItems:"center",children:[n(L,{type:"plus",size:"base"}),n(v,{children:s})]})})}function $e({open:e,isEditing:s,address:d,addressType:a,onSave:t,onClose:i,id:l,saveText:o,cancelText:c,showSavedAddressSelector:u,combineViolationAndValidationErrors:f,addressErrorsSignal:h,addressSettings:g,modalSubtitle:b,showDefaultAddressCheckbox:A,errorBannerMessage:v}){const{i18n:S}=q(),_="shipping"===a,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"),T=void 0===f?s:f,B=p(()=>v?.value??void 0);return n(he,{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:B,children:e=>n(E,{tone:"critical",errorType:"shipping"===a?x.DeliveryError:x.PaymentError,children:n(P,{children:e})})}),d&&n(De,{id:l,editableAddress:d,addressType:a,saveText:o??I,cancelText:c??N,onSave:t,onSuccess:i,onCancel:i,showSavedAddressSelector:u,addressErrorsSignal:h,combineViolationAndValidationErrors:T,addressSettings:g,showDefaultAddressCheckbox:A})]})]})}function je({id:e,addressType:s="shipping",onSave:d,onAddAction:a,showSavedAddressSelector:t=!0,addressErrorsSignal:i,errorBannerMessage:l,showNewAddressButton:o=!0,combineViolationAndValidationErrors:c,addressSettings:u,modalSubtitle:p,showDefaultAddressCheckbox:m=!1,hideAddressModal:f=!1}){const{i18n:h}=q(),{createAddressParts:g}=U(),b=g.addressModalState.value,A="shipping"===s,v="editing"===b.status,S=b.addressType===s&&("editing"===b.status||"adding"===b.status),y=!f&&S,_=A?h.translate("shipping.add_address"):h.translate("billing.add_address");return n(r,{children:[o&&n(ze,{onClick:a,textLabel:_}),n($e,{open:y,isEditing:v,address:b.address,addressType:s,onSave:d,onClose:()=>{l&&(l.value=void 0),g.addressModalState.value={status:"idle",addressType:s,address:b.address,setAsDefault:"default"}},id:e,showSavedAddressSelector:t,addressErrorsSignal:i,errorBannerMessage:l,combineViolationAndValidationErrors:c,addressSettings:u,modalSubtitle:p,showDefaultAddressCheckbox:m})]})}class Re extends Error{constructor(e,s){super(e),this.name="InvalidSelectedAddressError",this.groupingHash="AddressEdit::InvalidSelectedAddressError",this.name="InvalidSelectedAddressError",this.groupingHash=s}}function qe({addressType:s,addresses:a,immutableAddresses:t=[],immutableAddressSections:r=[],addressesTitle:i,selectedAddress:l,onSelectAddress:o,onCreateAddress:u=async()=>{},onUpdateAddress:p=async()=>{},onDeleteAddress:m=async()=>!1,onSetDefault:f=async()=>!1,addressErrorsSignal:h,canCreateAddress:g=!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:T=!0,onBeforeSelectAddress:E,onBeforeCreateAddress:x,onBeforeUpdateAddress:B,onBeforeDeleteAddress:k,hideAddressModal:O=!1}){const{createAddressParts:F}=U(),{checkout:V,i18n:L,observability:j}=q(),{extendedAddressMode:R}=V.address,W="shipping"===s&&V.proposal.negotiated.fields.mustSelectProvidedAddress.value,{defaultShippingDetails:H}=V.configuration.addressSettings.nonBillingAddressSettings.value,J=H.country.code,Q=d(()=>a.map(Ue),[a]),G=d(()=>t.map(Ue),[t]),Z=d(()=>Q.filter(e=>!e.disabled),[Q]),[K,X]=e(0),ee=c(e=>{const s=[...Z,...G],d=s.find(({id:s})=>s===e);if(!d){const d=s.map(({id:e})=>e).join(",");return void j.error(new Re(`Unexpected address id: '${e}' not found in choices ${d}`,"AddressEdit::handleChange::InvalidSelectedAddressError"))}if(E){let e=!1;E(d,()=>{e=!0,o(d)}),e||X(e=>e+1)}else o(d)},[Z,G,o,E,j]),se=c(()=>
1{if(!l)throw new Re("Attempted to edit an address without a selected address","AddressEdit::handleEditAction::InvalidSelectedAddressError");F.addressModalState.value={status:"editing",address:Y(l.address,{extendedAddressMode:R}),addressType:s,addressId:l.id,setAsDefault:l.default?"default":"disabled"}},[l,s,F.addressModalState,R]),de=c(()=>{const e=Z?.[0],d=Y({firstName:e?.address.firstName,lastName:e?.address.lastName,countryCode:J??e?.address.countryCode},{extendedAddressMode:R});F.addressModalState.value={status:"adding",address:d,addressType:s,setAsDefault:"disabled"}},[s,Z,F.addressModalState,J,R]),ae=c(async()=>{if(!l)throw new Re("Attempted to delete an address without a selected address","AddressEdit::handleDelete::InvalidSelectedAddressError");const e=l.id;return k?k(e,()=>m(e)):m(e)},[m,k,l]),te=c(async e=>{const s=F.addressModalState.value,d="enabled"===s.setAsDefault;if("adding"===s.status){const s={address:e,setDefault:d};return x?x(s,()=>u(s)):u(s)}if("editing"===s.status){const a={id:s.addressId,address:e,setDefault:d};return B?B(a,()=>p(a)):p(a)}},[F.addressModalState,u,p,x,B]),ne=c(async()=>{if(!l)throw new Re("Attempted to set a default address without a selected address","AddressEdit::handleSetDefault::InvalidSelectedAddressError");l.default||await f(l.id)},[f,l]),re=A&&Z.length>1,ie=g||b,le=F.addressModalState.value,oe="editing"===le.status&&Q.some(({id:e})=>e===le.addressId),ce=v&&("editing"!==le.status||oe);return n(M,{gap:"base",children:[T&&n(z,{section:P}),W?n($,{tone:"info",children:L.translate("address_management.must_use_address_banner")}):null,n(Oe,{id:"shipping"===s?"shippingAddressSelector":void 0,addressType:s,selectedId:l?.id,onChange:ee,onEdit:b?se:void 0,getAddressDisplayName:S,addresses:Q,addressesTitle:i,immutableAddresses:G,immutableAddressSections:r,onDelete:re?ae:void 0,onSetDefault:v?ne:void 0,selectedAddressDetails:N},K),C&&n(I,{padding:"none small-100",children:n(Se,{showIcon:!0})}),ie&&n(I,{padding:"none small-100",children:n(je,{id:w,addressType:s,onSave:te,onAddAction:de,showNewAddressButton:g,showSavedAddressSelector:!1,addressErrorsSignal:h,errorBannerMessage:D,modalSubtitle:_,addressSettings:y,showDefaultAddressCheckbox:ce,hideAddressModal:O})})]})}function Ue(e){return{...e,id:e.id?e.id:ee(e.address)}}const We=e=>!e.firstName?.trim();function He(e,s,d,a){!function(e,s,d){const a=e.selectedPaymentMethod.value;if(!a||!de(a))return;const t=a.paymentAttributes.billingAddress.address;We(t)&&ae(t,s)&&e.selectPaymentMethod({...a,paymentAttributes:{...a.paymentAttributes,billingAddressValid:d,billingAddress:{...a.paymentAttributes.billingAddress,address:{...t,firstName:s.firstName}}}})}(e,d,a),function(e,s,d){t(()=>{for(const a of e.paymentMethods.value){if(!de(a))continue;const{billingAddress:t}=a.paymentAttributes;We(t.address)&&ae(t.address,s)&&e.updateCreditCard(a.id,{billingAddressValid:d,billingAddress:{...t,address:{...t.address,firstName:s.firstName}}})}})}(s,d,a)}function Je({addressType:e="shipping",onPersistSuccess:s}={}){const{i18n:d,checkout:{validation:a},shopPay:t}=q(),{isMissingFirstName:r}=Ae({addressType:e}),i=te(),l=p(()=>{const s="billing"===e?t.session.selectedBillingAddress.value:t.session.selectedShippingAddress.value;return s?.id===ne?s:s?.id??("billing"===e?i.billingAddress.value:i.shippingAddress.value)}),o=a.missingFields.firstName.input,u=a.missingFields.firstName.error;(function({enabled:e,addressType:s,onPersistSuccess:d}){const{i18n:a,shopPay:t,observability:n,checkout:r}=q(),i=te(),l=ce(),o=r.validation.missingFields.firstName.input,c=r.validation.missingFields.firstName.error,u="billing"===s?ue:pe;function p(){c.value="",("billing"===s?r.addressManager.billing.value:r.addressManager.shipping.value).errors.fields.firstName.value=void 0,l.removeViolations(u)}function m(e){const s=t.session.selectedBillingAddress.value;s&&s.id===e.id&&ae(s.address,e.address)&&(t.session.unstable_updateSelectedBillingAddress(e),i.billingAddress.value=e.address)}ge("firstName",async()=>{if(!e)return{success:!0};const l=o.value.trim();if(!l)return c.value=a.translate("field_errors.address_first_name_blank"),{success:!1,location:"first_name_blank"};const u=function(e,s,d,a){return"billing"===e?d?s.find(e=>se(e.address,d,["phone","firstName"]))??null:null:a??null}(s,t.user.addresses.value,i.billingAddress.value,t.session.selectedShippingAddress.value);return u?t.user.addresses.value.some(e=>e.id===u.id)?async function(e,s,l){const o="billing"===l,u=o?r.addressManager.billing.value:r.addressManager.shipping.value,f={...e,address:{...e.address,firstName:s}},h=await u.updateAddress({id:e.id,address:f.address}),g=t.user.addresses.value.find(s=>
1s.id===e.id)??f;return h?(o?(i.billingAddress.value=h.address,He(t.session,t.user,g.address,g.valid)):(m(g),He(t.session,t.user,g.address,g.valid)),p(),d?.(),{success:!0}):(n.leaveErrorBreadcrumb("Shop Pay update address first name failed"),c.value=a.translate("field_errors.address_generic_error"),{success:!1,location:"first_name_update_failed"})}(u,l,s):function(e,a){const n={...e,address:{...e.address,firstName:a}};return"billing"===s?(t.session.unstable_updateSelectedBillingAddress(n),i.billingAddress.value=n.address):(t.session.unstable_updateSelectedShippingAddress(n),i.shippingAddress.value=n.address,m(n)),p(),d?.(),{success:!0}}(u,l):"billing"===s?function(e){const s=i.billingAddress.value;if(!s)return{success:!1,location:"first_name_no_address"};const a={...s,firstName:e};return i.billingAddress.value=a,p(),d?.(),{success:!0}}(l):{success:!1,location:"first_name_no_address"}})})({enabled:r,addressType:e,onPersistSuccess:s}),f(()=>{if(l.value)return()=>{o.value="",u.value=""}});const m=c(e=>{if(!re(e))return d.translate("field_errors.address_first_name_blank")},[d]),h=ie(o,u,m);le(o,u,m);const g=u.value,b=oe(g)?g.message:g;return n(j,{name:"firstName",label:d.translate("contact.first_name_label"),required:!0,autocomplete:"given-name",...h,error:h.error||b})}function Qe(e,s,d){return re(e)?d(e,s)?{isValid:!0}:{isValid:!1,reason:"phone_invalid"}:{isValid:!1,reason:"phone_blank"}}const Ge={id:"fb48dec1806e3e11b7375d723d9e47d5006dda9d3285b2f42dc9138fade9163b",type:"mutation",name:"AddPhone",source:"mutation AddPhone($phone:String!,$payAddressUuid:String){addPhone(phone:$phone,payAddressUuid:$payAddressUuid){userErrors{field message __typename}__typename}}"};function Ze({addressType:e="shipping"}={}){const{i18n:s,checkout:{validation:t}}=q(),r=te(),{validatePhoneNumber:i}=we(),{isMissingPhone:l}=ve({addressType:e}),o="billing"===e?r.billingAddress.value:r.shippingAddress.value,u=o?.countryCode,p=t.missingFields.phone.input,m=t.missingFields.phone.error,h=t.missingFields.phone.isValid;(function(e,s,{enabled:a,addressType:t="shipping"}){const{i18n:n,graphql:{shopPayGraphql:r},shopPay:i,observability:l}=q(),o=te(),{formatPhoneNumber:c,validatePhoneNumber:u}=we(),p="billing"===t?o.billingAddress.value:o.shippingAddress.value,m=p?.countryCode,f=d(()=>function({graphql:e,observability:s}){return async(d,a)=>{const{data:t,error:n}=await e.mutate(Ge,{variables:{phone:d,payAddressUuid:a}});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]);ge("phone",async()=>{if(!a)return{success:!0};const d=Qe(s.value,m,u);if(!d.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")}(d.reason,n),{success:!1,location:d.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 f(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}),f(()=>{const e=Qe(p.value,u,i);h.value=e.isValid}),a(()=>()=>{h.value=!0,m.value=""},[h,m]);const g=c(e=>re(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}=ie(p,m,g);le(p,m,g);const v=m.value,S=oe(v)?v.message:v;return n(Ce,{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:d}=ve({addressType:e}),{isMissingFirstName:a}=Ae({addressType:e});return d||a?n(I,{paddingInline:"base",paddingBlockStart:"small-200",paddingBlockEnd:"base",children:n(M,{direction:"block",gap:"base",children:[a&&n(Je,{addressType:e,onPersistSuccess:s}),d&&n(Ze,{addressType:e})]})}):null}export{qe as A,De as C,Ke as M,ze as a,xe as b,Oe as c,Pe as d};

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.