PageSourceSearch

https://sockwell.jp/cdn/shopifycloud/checkout-web/assets/c1/context-browser.Dp9ku7jw.js

js sockwell.jp collected 2026-09-30 17:55:42 UTC 301,567 bytes, 66 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["extensibility-browser-engine.adf3by2U.js","shared-permissions.BaDWlj5_.js","hooks-useReplaceShopPayInHistory.C8UL-mAH.js","esnext-vendor.BDPAaZdq.js","app.D1P6yWfp.js","assets/app.BuSMBobh.css","assets/useReplaceShopPayInHistory.BpuyvRSB.css","utilities-extension-execution-errors.DALAv5qR.js","performance-index.mu6MOGR9.js","extensions-rpc.Sg1wfpr_.js","amazon-pay-useAmazonPayPaymentLine.BXwZMsYY.js","PayButton-helpers.Dg5kgVMm.js","graphql-PaymentSessionMutation.BhOnX3QJ.js","helpers-setAddressErrors.BA8OjimY.js","utilities-stable-ref.Dvd2X3ul.js","addresses-is-address-empty.Ch6V3XcM.js","checkout-updaters-helpers.BAeH3ddd.js","shared-receipt-mapper-load-recovery.C9sfUBl4.js","shared-receipt-eager-mappers.CpLC5HH7.js","shared-report-graphql-error.d-L7q9TK.js","shop-pay-normalizeBuyerDetails.ThnUnxcv.js","helpers-derivations.DLW2fhKL.js","redemption-promotions.CgqGtCd-.js","helpers-credit-card-disabled.BnSr1GsQ.js","human-signals-index.CoxmTYk-.js","client.DRetCTka.js","dist-v4.EwEgHOG0.js","web-mcp-runtime.IXKgLCgF.js","helpers-getNormalizedPaymentMethodName.B-mE5wnL.js","embed-browser.790EZfnB.js","hooks-useShopPayExternalAppContext.DyGXtar4.js","embed-deferred.BpEUhGVz.js"])))=>i.map(i=>d[i]);
2import{S as ve,s as Fi,k as oo,_ as L,t as je,T as lo,F as co,C as Nt,a as Ui,l as uo,m as ho,n as po,b as mo,p as go}from"./app.D1P6yWfp.js";import{E as _,y as u,j as se,a as Ze,G as Zs,n as Xe,ag as Us,r as ts,aC as xi,aD as me,aE as an,aF as on,aG as dn,aH as ln,aI as fo,aJ as yo,aK as vo,aL as cn,aM as _o,aN as bo,aO as gt,L as Yt,M as nt,aP as Js,aQ as ei,az as So,aR as Ao,ak as Eo,aS as Po,aT as Co,aU as To,aV as ko,aW as wo,aX as Io,aY as Ro,aZ as Mo,a_ as Do,a$ as Lo,ab as Oo,m as No,aa as Bo,b0 as Fo,b1 as Uo,ar as Vi,ap as Hi,an as xo,b2 as Vo}from"./esnext-vendor.BDPAaZdq.js";import{k4 as xs,eW as J,k5 as ze,d as ue,cC as _e,dz as Ho,w as St,a9 as ke,a$ as Qe,k6 as Go,k7 as qo,k8 as Wo,k9 as zo,ka as un,kb as $o,eU as Yo,aQ as Fe,gT as hn,a4 as pn,j6 as Vs,kc as ft,aq as Te,fS as ti,kd as si,G as Je,b0 as mn,e$ as ii,eL as Hs,ik as gn,i4 as fn,gN as ri,ke as yn,kf as Gs,kg as jo,D as Gi,al as vn,e as qs,ah as Ko,kh as it,ki as Xo,kj as Ws,M as Pt,ca as ni,fz as zs,kk as Qo,gi as Zo,a8 as Jo,kl as ed,bv as Ne,iN as td,bm as qi,gv as sd,km as id,b3 as rd,f2 as nd,aJ as _n,kn as bn,ko as ad,kp as Wi,kq as Sn,kr as od,ks as dd,ge as zi,kt as ld,gg as An,ku as cd,gj as ud,kv as hd,kw as pd,bd as fe,kx as md,ky as $i,kz as gd,kA as fd,kB as yd,kC as vd,kD as jt,cU as _d,gQ as bd,kE as Sd,j as ss,kF as Ad,fP as Ed,n as Pd,k as rt,bA as Le,ei as ai,kG as Cd,kH as En,kI as Yi,kJ as Td,au as kd,ar as ce,kK as wd,eu as Id,kL as Rd,b$ as ji,iA as Ki,kM as Md,kN as Dd,kO as Ld,eA as Od,h$ as Nd,kP as Bd,kQ as Fd,i5 as Xi,kR as Ud,ig as xd,h_ as Vd,eh as Hd,ib as Gd,ic as qd,id as Wd,eC as zd,ie as $d,ih as Yd,ii as jd,v as Kd,hN as Xd,ij as Qd,il as Zd,im as Jd,i8 as el,ip as tl,iq as sl,ir as il,kS as rl,is as nl,kT as al,kU as ol,eD as dl,eB as ll,ia as cl,i9 as ul,it as Qi,iu as hl,io as pl,i6 as ml,kV as gl,kW as fl,H as Ss,kX as yl,kY as vl,fg as _l,ed as bl,kZ as Sl,k_ as Al,k$ as El,l0 as Pl,l1 as Cl,fi as Zi,du as As,l2 as Tl,l3 as kl,W as wl,_ as At,jQ as Il,jR as Rl,jU as Ml,jT as Dl,jS as Ll,V as Kt,j8 as Ol,dx as Ji,j7 as er,a_ as Nl,fW as $s,l4 as Bl,l5 as Fl,hk as Ul,l6 as xl,he as Vl,hd as Hl,fb as tr,fc as sr,l7 as Gl,l8 as ql,l9 as Wl,fa as zl,la as $l,X as Yl,lb as jl,lc as Kl,jb as ir,jO as Xl,ld as Ql,le as Zl,lf as Jl,lg as ec,iy as tc,lh as sc,bc as ic,c9 as rc,bf as nc,li as Pn,lj as ac,fC as Cn,lk as oc,ll as Tn,fD as kn,lm as wn,ln as rr,lo as dc,fE as lc,lp as cc,eH as In,lq as oi,d_ as uc,lr as hc,aN as pc,gd as mc,dr as di,ls as gc,lt as is,ak as fc,lu as Ys,am as yc,lv as vc,lw as Xt,lx as _c,iM as bc,dH as nr,fA as Sc,f as Ac,ly as Ec,lz as Pc,lA as Cc,lB as Tc,lC as kc,eO as wc,jj as Ic,jk as Rc,lD as Mc,lE as Rn,aK as Dc,fZ as Lc,f$ as Oc,c3 as Nc,lF as Bc,eI as Fc,lG as Uc,fT as xc,fU as Vc,fV as Hc,lH as Gc,lI as Mn,lJ as Dn,lK as qc,lL as Wc,lM as zc,e5 as ar,lN as $c,lO as or,f_ as dr,ao as Yc,lP as lr,b1 as jc,lQ as Ln,lR as Kc,lS as Xc,lT as Qc,lU as Zc,lV as Jc,lW as eu,lX as tu,lY as su,lZ as iu,l_ as ru,fH as cr,l$ as nu,m0 as au,m1 as ou,m2 as du,hH as lu,m3 as cu}from"./hooks-useReplaceShopPayInHistory.C8UL-mAH.js";import{j as uu,i as hu,t as rs,w as On,e as Es,F as pu}from"./PayButton-helpers.Dg5kgVMm.js";import{S as yt,O as Bt,C as vt,a as Oe,b as mu,s as Nn}from"./helpers-setAddressErrors.BA8OjimY.js";import{d as Ke,f as gu,e as fu,a as yu}from"./utilities-stable-ref.Dvd2X3ul.js";import{g as Gt,E as ur,r as hr}from"./addresses-is-address-empty.Ch6V3XcM.js";import{g as vu,q as _u,e as bu,f as Su,s as Au,t as Eu,i as Pu,v as Cu,r as Tu}from"./checkout-updaters-helpers.BAeH3ddd.js";import{a as ku,s as wu,m as Iu,l as Ru,k as Mu,f as Du,e as Lu,c as Ou,d as Nu,j as Bu,i as Fu,h as Uu,g as xu,b as Vu,p as Hu,n as Gu,r as qu,q as Wu}from"./shared-receipt-mapper-load-recovery.C9sfUBl4.js";import{b as zu,j as $u,a as pr,o as Yu,k as ju,i as Ku,s as Xu,l as Qu,f as Zu,g as Ju,t as eh,d as th,r as sh,h as ih,e as rh}from"./shared-receipt-eager-mappers.CpLC5HH7.js";import{r as at}from"./shared-report-graphql-error.d-L7q9TK.js";import{n as nh,s as ah}from"./shop-pay-normalizeBuyerDetails.ThnUnxcv.js";import{s as oh,b as dh}from"./helpers-derivations.DLW2fhKL.js";import{j as lh,k as ch,p as uh}from"./redemption-promotions.CgqGtCd-.js";import{S as hh}from"./helpers-credit-card-disabled.BnSr1GsQ.js";const ph=(s,e,t)=>{const i=s[e];return i?typeof i=="function"?i():Promise.resolve(i):new Promise((r,n)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(n.bind(null,new Error("Unknown variable dynamic import: "+e+(e.split("/").length!==t?". Note that variables only represent file names one level deep.":""))))})},mh={id:"88b4bd2244b44e19631a21dac37cdd0a986c369d55d8a88292bd79c62e3a3485",type:"query",name:"CheckoutContext",source:""},gh={id:"d86c24ba847c0583a6cdd93ad932edcc9f527c9360b5a596103ab32aa1aef57e",type:"query",name:"FinancingPlans",source:""},fh={id:"3cd8163c889b25bc744486a9660d0301ebc80659eabdf66690c58dd37bbdb115",type:"query",name:"RequestInfo",source:""},yh={id:"6c8a3a5bcd1d2cbb245c334c21cef3b09ad7ce514c0eed061ceb713227f49b43",type:"query",name:"Theme",source:""},vh={id:"5638616fb05cb50fa18d4cba4335a74898a1bfebfdc79a784e07dacd23898e17",type:"query",name:"ShippingCountries",source:""};class _h extends ve{constructor(){super(...arguments),this.name="BrandingMissingShopError"}}function bh(s){return{isConcatenatedEnabled:()=>!1,isDedicatedEnabled:()=>s.hasFlag(uu),getDedicatedFormat:e=>e.extendedFormattingV2ShopPay?.edit}}class we{constructor({observability:e,errors:t}){this.selectedAddress=_(()=>this.findAddressById(this.selectedAddressId.value)),this.#e=u(!1),this.#t=u("ADDRESS_CHANGES_UNAVAILABLE"),this.#s=u([]),this.#i=u({type:null,isValid:!1,isLoading:!1}),this.#r=u(!1),this.getAddressDisplayName=i=>{},this.selectAddress=async i=>{const r=this.findAddressById(i);return r?this._selectAddress(r):(this.observability.error(new xs(`Address with id "${i}" not found`,{groupingHash:"AddressManager::selectAddress::InvalidSelectedAddressError"})),!1)},this.createAddress=async({address:i,setDefault:r=!1,selectAddress:n=!0,addressErrorsOverride:a})=>{if(this.canCreateAddress.value&&!(r&&!this.canSetDefaultAddress.value))return this._createAddress({address:i,setDefault:r,selectAddress:n,addressErrorsOverride:a})},this.updateAddress=async({id:i,address:r,setDefault:n=!1,addressErrorsOverride:a})=>{if(this.canUpdateAddress.value&&!(n&&!this.canSetDefaultAddress.value))return i===J?this._updateEphemeralAddress({address:r}):this._updateAddress({id:i,address:r,setDefault:n,addressErrorsOverride:a})},this.deleteAddress=async i=>this.canDeleteAddress.value?this._deleteAddress(i):!1,this.setDefaultAddress=async i=>{if(!this.canSetDefaultAddress.value)return!1;const r=this.addresses.value.find(n=>n.id===i);return r?this._setDefaultAddress({id:i,address:r.address}):(this.observability.error(new xs(`Address with id "${i}" not found in mutable addresses`,{groupingHash:"AddressManager::setDefaultAddress::InvalidSelectedAddressError"})),!1)},this.applyAddressChange=async({source:i,address:r})=>{const n=this.applyAddressChangeBlockReason(i).value;return n?{type:"failure",reason:n}:this._applyAddressChange({source:i,address:r})},this.observability=e,this.errors=t}#e;#t;#s;#i;#r;get canCreateAddress(){return this.#e}
2get canUpdateAddress(){return this.#e}get canDeleteAddress(){return this.#e}get canSetDefaultAddress(){return this.#e}applyAddressChangeBlockReason(e){return this.#t}get suggestedAddress(){return this.#i}get isMissingValidSuggestedAddress(){return this.#r}dispose(){}get immutableAddressSections(){return this.#s}get addressesTitle(){}_selectAddress(e){throw new ze}_updateAddress(e){throw new ze}_updateEphemeralAddress(e){throw new ze}_createAddress(e){throw new ze}_deleteAddress(e){throw new ze}async _setDefaultAddress(e){throw new ze}async _applyAddressChange(e){throw new ze}findMatchingAddress(e,{ignoreFields:t=[],ignoreIds:i=[]}={}){return[...this.addresses.value,...this.immutableAddresses.value].find(r=>!i.includes(r.id)&&ue(r.address,e,t))}withCoordinates(e){return{...e,coordinates:e.coordinates}}findAddressById(e){if(!e)return;const t=this.addresses.value.find(i=>i.id===e);return t||this.immutableAddresses.value.find(i=>i.id===e)}}class Ps extends we{constructor(e){super({observability:e,errors:{banner:u(void 0),fields:_e()}}),this.#e=u([]),this.selectedAddressId=u(void 0),this.addresses=this.#e,this.immutableAddresses=this.#e}#e}function Bn(s,e,t){if(s===e&&t)return Ho(t)?t.location.name:t.company.name}function Sh({buyerIdentity:s,billingAddressFact:e,isValidBillingAddress:t,isLoadingBilling:i,isValidShippingAddress:r,isLoadingShipping:n}){return _(()=>{const a=s.value?.purchasingCompany;if(!a)return{address:void 0,type:null,isValid:!1,isLoading:!1};const o=a.location.billingAddress,d=a.location.shippingAddress;return e&&!(o&&St(e,o))?{address:e,type:"billing-fact",isValid:!0,isLoading:!1}:n.value||i.value?{address:void 0,type:null,isValid:!1,isLoading:!0}:o&&t.value?{address:o,type:"billing",isValid:!0,isLoading:!1}:d&&r.value?{address:d,type:"shipping",isValid:!0,isLoading:!1}:o&&!t.value?{address:o,type:null,isValid:!1,isLoading:!1}:d&&!r.value?{address:d,type:null,isValid:!1,isLoading:!1}:{address:void 0,type:null,isValid:!1,isLoading:!1}})}class Ah extends we{constructor({observability:e,buyerIdentity:t,billingAddressFact:i,address:r,billingCountries:n,billingAddressSettings:a,deliveryNext:o,additionalFieldsEnabled:d,i18n:l,isLoadingBilling:c,isValidShippingAddress:h,isLoadingShipping:b}){super({observability:e,errors:{banner:u(void 0),fields:_e()}}),this.selectedAddressId=u(yt),this.#t=u([]),this.getAddressDisplayName=y=>Bn(y,yt,this.buyerIdentity.value?.purchasingCompany),this.buyerIdentity=t;const{countryDetails:g,extendedAddressMode:v}=r,E=_(()=>{const y=t.value?.purchasingCompany,p=y?.location.billingAddress,f=p?ke(p)?.countryCode:void 0;return hu({purchasingCompany:y,billingCountries:n,addressSettings:a,countryDetails:f?g.get(f):void 0,editFormat:v.getFormat(f,null),deliveryNextValue:o.value,additionalFieldsEnabled:d,i18n:l})});this.suggestedAddressResult=Sh({buyerIdentity:t,billingAddressFact:i,isValidBillingAddress:E,isLoadingBilling:c,isValidShippingAddress:h,isLoadingShipping:b}),this.#e=_(()=>{const{isValid:y,isLoading:p}=this.suggestedAddressResult.value;return!y&&!p}),this.addresses=this.#t,this.immutableAddresses=_(()=>{const y=this.suggestedAddressResult.value;return!y.isValid||!y.address?[]:[{id:yt,address:y.address}]})}#e;#t;get suggestedAddress(){return this.suggestedAddressResult}get isMissingValidSuggestedAddress(){return this.#e}}const Eh=2;class Ph extends Ah{#e;#t;#s;#i;#r;#n=u(!0);#a;get canCreateAddress(){return this.#r}get canUpdateAddress(){return this.#n}constructor({proposalAddress:e,billingAddressOption:t,buyerIdentity:i,billingAddressFact:r,isValidShippingAddress:n,isLoadingShipping:a,observability:o,sourceType:d,address:l,billingCountries:c,billingAddressSettings:h,deliveryNext:b,additionalFieldsEnabled:g,isThrottled:v,i18n:E}){const{countryDetails:y}=l,p=_(()=>{const M=i.value?.purchasingCompany;return ke(M?.location.billingAddress)?.countryCode}),f=_(()=>{const M=p.value;return M?v.value&&y.get(M)===void 0?!0:y.isLoading(M):!1});super({observability:o,buyerIdentity:i,billingAddressFact:r,address:l,billingCountries:c,billingAddressSettings:h,deliveryNext:b,additionalFieldsEnabled:g,i18n:E,isLoadingBilling:f,isValidShippingAddress:n,isLoadingShipping:a});const m=se(()=>{const M=p.value;M&&!v.value&&y.fetch(M)}),A=u(void 0);t.value==="custom"&&e.value&&!A.value&&(A.value=e.value);const I=_(()=>{const M=A.value;return M?[{id:Bt,address:M}]:[]});this.#e=I,this.addresses=this.#e,this.#r=_(()=>this.addresses.value.length+this.immutableAddresses.value.length<Eh),this.selectedAddressId=_(()=>t.value==="custom"?Bt:yt),this.#t=e,this.#s=A,this.#i=t;let P=!1;const T=se(()=>{const M=this.suggestedAddressResult.value;if(P||M.isLoading)return;if(!i.value?.purchasingCompany||!M.address){P=!0;return}const O=M.address&&M.type===null,w=d!=null&&Qe(d)&&M.type==="billing-fact";(M.type===t.value||O||w)&&((!e.value||!ue(M.address,e.value))&&(e.value=M.address),P=!0)}),R=se(()=>{const M=this.suggestedAddressResult.value;if(!i.value?.purchasingCompany)return;const O=t.value!=="custom"&&!M.type&&!M.isLoading,w=t.value==="billing"&&M.type==="shipping";O?t.value="custom":w&&(t.value="shipping")});this.#a=[m,T,R]}dispose(){for(const e of this.#a)e();super.dispose()}_selectAddress(e){if(this.#t.value=e.address,e.id===yt){const t=this.suggestedAddressResult.value.type;t&&(this.#i.value=t)}else this.#i.value="custom";return Promise.resolve(!0)}async _createAddress({address:e,selectAddress:t}){const i={id:Bt,address:e};return this.#s.value=e,t&&(this.#i.value="custom",this.#t.value=e),i}_updateAddress({id:e,address:t}){if(e!==Bt)return Promise.resolve(void 0);const i={id:e,address:t};return this.#s.value=t,this.#i.value="custom",this.#t.value=t,Promise.resolve(i)}}class Ch extends we{constructor({observability:e,buyerIdentity:t,proposalAddress:i}){super({observability:e,errors:{banner:u(void 0),fields:_e()}}),this.getAddressDisplayName=r=>Bn(r,vt,this.buyerIdentity.value?.purchasingCompany),this.buyerIdentity=t,this.companyLocationAddress=_(()=>t.value?.purchasingCompany?.location.shippingAddress??void 0),this.hasEditableShippingAddress=_(()=>{const r=t.value?.customerProfile;return!!(r?.__typename==="BusinessCustomerProfile"&&r?.checkoutExperienceConfiguration?.editableShippingAddress)}),this.immutableAddresses=_(()=>{const r=this.companyLocationAddress.value;return r?[{id:vt,address:r}]:[]}),this.#e=_(()=>
2{const r=this.companyLocationAddress.value,n=i.value;return!r||!n||ue(r,n)?[]:[{id:Oe,address:n}]}),this.addresses=this.#e,this.#t=_(()=>this.hasEditableShippingAddress.value&&this.addresses.value.length+this.immutableAddresses.value.length<Go),this.selectedAddressId=_(()=>this.addresses.value.length>0?Oe:vt)}#e;#t;get canCreateAddress(){return this.#t}get canUpdateAddress(){return this.hasEditableShippingAddress}}class Th extends Ch{#e;#t;#s;#i;#r;constructor({proposalAddress:e,buyerIdentity:t,mustSelectProvidedAddress:i,canUpdateDeliveryAddress:r,observability:n,address:a,shippingCountries:o,shippingAddressSettings:d,deliveryNext:l,additionalFieldsEnabled:c,isThrottled:h,i18n:b}){super({observability:n,buyerIdentity:t,proposalAddress:e});const{countryDetails:g,extendedAddressMode:v}=a,E=u(void 0);this.#e=_(()=>{const P=E.value;return P?[{id:Oe,address:P}]:[]}),this.addresses=this.#e;const y=_(()=>{const P=t.value?.purchasingCompany;return ke(P?.location.shippingAddress)?.countryCode}),p=se(()=>{const P=y.value;P&&!h.value&&g.fetch(P)});this.isValidShippingAddress=_(()=>{const P=t.value?.purchasingCompany,T=y.value;return qo({purchasingCompany:P,shippingCountries:o,addressSettings:d,countryDetails:T?g.get(T):void 0,editFormat:v.getFormat(T,null),deliveryNextValue:l.value,additionalFieldsEnabled:c,i18n:b})}),this.isLoadingShippingAddress=_(()=>{const P=y.value;return P?h.value&&g.get(P)===void 0?!0:g.isLoading(P):!1}),this.#i=_(()=>{if(r.value===!1)return"DELIVERY_ADDRESS_NOT_EDITABLE";if(!this.hasEditableShippingAddress.value||i.value)return"MUST_SELECT_PROVIDED_ADDRESS"});const f=t.value?.purchasingCompany?.location.shippingAddress;f&&e.value&&!ue(f,e.value)&&(E.value=e.value),this.selectedAddressId=u(E.value?Oe:vt),this.#t=e,this.#s=E;let m=!1,A=this.companyLocationAddress.peek();const I=se(()=>{const P=this.companyLocationAddress.value;if(!m){m=!0;return}P&&(A&&ue(P,A)||(A=P,this.selectedAddressId.peek()===vt&&(e.value=P)))});this.#r=[p,I]}applyAddressChangeBlockReason(e){switch(e){case"ui-extension":case"ucp":return this.#i;default:return Ze(e)}}dispose(){for(const e of this.#r)e();super.dispose()}_selectAddress(e){return this.selectedAddressId.value=e.id,this.#t.value=e.address,Promise.resolve(!0)}async _createAddress({address:e,selectAddress:t}){const i={id:Oe,address:e};return this.#s.value=e,t&&(this.selectedAddressId.value=i.id,this.#t.value=e),i}async _updateAddress({id:e,address:t}){if(e!==Oe)return Promise.resolve(void 0);const i={id:e,address:t};return this.#s.value=t,this.selectedAddressId.value=e,this.#t.value=t,Promise.resolve(i)}async _applyAddressChange({address:e}){const t=this.findMatchingAddress(e,{ignoreIds:[Oe]});if(t)return await this._selectAddress(t),this.#s.value=void 0,{type:"success",address:t};const i={id:Oe,address:e};return this.#s.value=e,await this._selectAddress(i),{type:"success",address:i}}}function Fn(s){let e=s.value.map(t=>t.id);return _(()=>{const t=s.value,i=t.map(o=>o.id),r=e,n=i.filter(o=>!r.includes(o)),a=r.filter(o=>i.includes(o));return(n.length>0||a.length!==r.length)&&(e=[...a,...n]),[...t].sort((o,d)=>{const l=e.indexOf(o.id),c=e.indexOf(d.id);return l===-1?1:c===-1?-1:l-c})})}const kh={id:"07f9d37cebb26f74594ea5b6dc354ea01d222d8897f503e823e91a9aa33fef98",type:"mutation",name:"CreateCustomerAddress",source:""},wh={id:"4a72f72ab7d4a46e063c4caeafc6826b16e2521dfcbcf9a5d73bbd8c37f8d791",type:"mutation",name:"DeleteCustomerAddress",source:""},Ih={id:"61d3f70f7da3acacb12e8eab2c66260c3a97d79f6a9593fd21f23c464de341c7",type:"mutation",name:"ModifyCustomerAddress",source:""};function Un(s,e){return{createAddressMutation:Mh(s,e),updateAddressMutation:Dh(s,e),deleteAddressMutation:Lh(s)}}const Rh=new Set(["BUYER_IDENTITY_CUSTOMER_ACCOUNT_REQUIRED","BUYER_IDENTITY_CONTACT_INFO_DOES_NOT_MATCH_CUSTOMER_PROFILE","DESTINATION_ADDRESS_REQUIRED"]);function xn(s,e){return s||e.errors.some(t=>Rh.has(t.code))}function Mh(s,e){return async t=>{const{data:i,error:r}=await s.mutate(kh,{variables:{address:Vn(t.address,e),setDefault:t.setDefault}});if(!i?.createCustomerAddress||xn(r,i.createCustomerAddress))return{status:"failed_unknown"};const{result:n,errors:a}=i.createCustomerAddress;return!n||a.length>0?{status:"failed",errors:ci(a)}:{status:"success",address:li(n)}}}function Dh(s,e){return async t=>{const{data:i,error:r}=await s.mutate(Ih,{variables:{address:Vn(t.address,e),id:t.id,setDefault:t.setDefault}});if(!i?.modifyCustomerAddress||xn(r,i.modifyCustomerAddress))return{status:"failed_unknown"};const{result:n,errors:a}=i.modifyCustomerAddress;return!n||a.length>0?{status:"failed",errors:ci(a)}:{status:"success",address:li(n)}}}function Lh(s){return async e=>{const{data:t,error:i}=await s.mutate(wh,{variables:{id:e.id}});if(i||t?.deleteCustomerAddress==null)return{status:"failed_unknown"};const{result:r,errors:n}=t.deleteCustomerAddress;return!r||n.length>0?{status:"failed",errors:ci(n)}:{status:"success",address:li(r)}}}function Vn(s,e){const{extendedFields:t,...i}=Wo({address1:s.address1,address2:s.address2,countryCode:s.countryCode,fields:{district:s.district,line2:s.line2,streetName:s.streetName,streetNumber:s.streetNumber,subdistrict:s.subdistrict},extendedAddressMode:e});return{firstName:s.firstName,lastName:s.lastName,company:s.company,...i,city:s.city,countryCode:s.countryCode,zoneCode:s.zoneCode,zip:s.postalCode,phone:s.phone,extendedFields:t}}function li(s){const{address:e}=s;return{id:s.id,address:{address1:e.address1??void 0,address2:e.address2??void 0,firstName:e.firstName??void 0,lastName:e.lastName??void 0,postalCode:e.postalCode??void 0,zoneCode:e.zoneCode??void 0,countryCode:e.countryCode??void 0,city:e.city??void 0,company:e.company??void 0,phone:e.phone??void 0,district:e.extendedFields?.district??void 0,line2:e.extendedFields?.line2??void 0,streetName:e.extendedFields?.streetName??void 0,streetNumber:e.extendedFields?.streetNumber??void 0,subdistrict:e.extendedFields?.subdistrict??void 0},default:s.default}}function ci(s){return s.map(({__typename:e,code:t,target:i,nonLocalizedMessage:r,localizedMessage:n})=>({__typename:e,code:t,target:i??void 0,nonLocalizedMessage:r,localizedMessage:n??void 0}))}async function Hn({mutate:s,getNewAddresses:e,getNewSelectedAddress:t,setAddressValidationErrors:i,onSuccess:r,addresses:n,errors:a,i18n:o}){const d=await s();if(d.status==="success"){const l=e(d.address),c=t(d.address,l);return n.value=l,a.banner.value=void 0,r(c),c}else d.status==="failed"?(i(d.errors),a.banner.value=void 0):d.status==="failed_unknown"&&(a.banner.value=o.translate("shipping.address_form.generic_error"))}function Gn({addressType:s,violations:e,countryCode:t,addressErrorsOverride:i,errors:r,address:n,addressSettings:a}){const o=t?n.countryDetails.get(t):void 0,d=zo({addressType:s,violations:e,countryDetails:o,format:o?n.extendedAddressMode.getFormatFromCountry(o):void 0,addressSettings:a}),l=i??r.fields;d.forEach((c,h)=>{l[h].value=c})}class Oh extends we{#e;#t;#s;#i;#r;#n=u(!0);#a;get canSetDefaultAddress(){return this.#n}constructor({negotiatedAddresses:e,observability:t,i18n:i,graphql:r,address:n,addressSettings:a}){const[o,d]=un(e);super({observability:t,errors:{banner:u(void 0),fields:_e()}}),this.#e=o,this.addresses=this.#e,this.#a=d,this.#t=i,this.#s=r,this.#i=n,this.#r=a}dispose(){super.dispose(),this.#a()}get customerAddressMutations(){return Un(this.#s,this.#i.extendedAddressMode)}handleMutation(e){return Hn({...e,addresses:this.#e,errors:this.errors,i18n:this.#t})}setFieldErrors(e,t,i,r){Gn({addressType:e,violations:t,countryCode:i,addressErrorsOverride:r,errors:this.errors,address:this.#i,addressSettings:this.#r})}async _setDefaultAddress({id:e,address:t}){return!!await this._updateAddress({id:e,address:t,setDefault:!0})}}class Nh extends Oh{constructor({billingAddress:e,billingAddressOption:t,buyerIdentity:i,observability:r,addressSettings:n,address:a,i18n:o,graphql:d}){const l=Fn(_(()=>i.value?.customerProfile?.__typename==="CustomerProfile"?i.value.customerProfile.billingAddresses:[]));super({negotiatedAddresses:l,observability:r,i18n:o,graphql:d,address:a,addressSettings:n}),this.immutableAddresses=u([]),this.#e=u(void 0),this.#i=u(!0),this.#t=e,this.#s=t,this.selectedAddressId=_(()=>this.#e.value?this.#e.value:this.addresses.value[0]?.id),this.#r=_(()=>this.selectedAddress.value!=null)}#e;#t;#s;#i;#r;get canCreateAddress(){return this.#i}setValidationErrors(e){const t=this.selectedAddress.value?.address.countryCode;this.setFieldErrors("billing_address",e,t)}get canUpdateAddress(){return this.#r}_updateAddress({id:e,address:t}){return this.handleMutation({mutate:()=>this.customerAddressMutations.updateAddressMutation({address:t,id:e,setDefault:!1}),getNewAddresses:i=>this.addresses.value.map(r=>r.id===i.id?i:r),getNewSelectedAddress:i=>i,setAddressValidationErrors:i=>this.setFieldErrors("billing_address",i,t.countryCode),onSuccess:i=>{i&&(this.#e.value=i.id,this.#n(i.address))}})}async _selectAddress(e){return this.#e.value=e.id,this.#n(e.address),this.errors.banner.value=void 0,!0}_createAddress({address:e,setDefault:t,selectAddress:i,addressErrorsOverride:r}){const n=!!t;return this.handleMutation({mutate:()=>this.customerAddressMutations.createAddressMutation({address:e,setDefault:n}),getNewAddresses:a=>n?[...this.addresses.value.map(o=>({...o,default:!1})),{...a,default:!0}]:[...this.addresses.value,a],getNewSelectedAddress:a=>a,setAddressValidationErrors:a=>this.setFieldErrors("shipping",a,e.countryCode,r),onSuccess:a=>
2{i&&(a?(this.#e.value=a.id,this.#n(a.address)):this.#e.value=void 0)}})}#n(e){this.#t.value=e,this.#s.value="custom"}}class Bh extends we{#e;#t;#s;constructor({observability:e,buyerIdentity:t,availableDeliveryAddresses:i,mustSelectProvidedAddress:r,proposalAddress:n,addressSettings:a,address:o,i18n:d}){super({observability:e,errors:{banner:u(void 0),fields:_e()}}),this.negotiatedShippingAddresses=_(()=>!r.value&&t.value?.customerProfile?.__typename==="CustomerProfile"?t.value.customerProfile.shippingAddresses:[]),this.#e=_(()=>i.value??[]),this.#t=_(()=>!r.value),this.#s=d.translate("address_management.saved_addresses"),this.selectedAddressId=_(()=>{const l=[...this.addresses.value,...this.immutableAddresses.value],c=n.value,h=c.countryCode?o.countryDetails.get(c.countryCode):void 0;return $o(c,l,a,h,h?o.extendedAddressMode.getFormatFromCountry(h):void 0)?.id})}get addresses(){return this.negotiatedShippingAddresses}get immutableAddresses(){return this.#e}get canCreateAddress(){return this.#t}get canUpdateAddress(){return this.#t}get canDeleteAddress(){return this.#t}get canSetDefaultAddress(){return this.#t}get addressesTitle(){return this.#s}}class Fh extends Bh{#e;#t;#s;#i;#r;#n;#a;#o;#d;#l;#c=u(void 0);constructor({proposalAddress:e,availableDeliveryAddresses:t,mustSelectProvidedAddress:i,canUpdateDeliveryAddress:r,buyerIdentity:n,observability:a,addressSettings:o,address:d,wallets:l,i18n:c,graphql:h}){super({observability:a,buyerIdentity:n,availableDeliveryAddresses:t,mustSelectProvidedAddress:i,proposalAddress:e,addressSettings:o,address:d,i18n:c});const[b,g]=un(Fn(this.negotiatedShippingAddresses));this.#e=b,this.#s=g,this.#t=_(()=>{const v=t.value??[],E=this.#c.value;return E?[...v,{id:J,address:E}]:v}),this.#l=_(()=>{if(r.value===!1)return"DELIVERY_ADDRESS_NOT_EDITABLE";if(i.value)return"MUST_SELECT_PROVIDED_ADDRESS";if(l.activeSession.value)return"ADDRESS_CHANGES_UNAVAILABLE"}),this.#i=l,this.#r=e,this.#n=c,this.#a=h,this.#o=d,this.#d=o}get addresses(){return this.#e}get immutableAddresses(){return this.#t}dispose(){super.dispose(),this.#s()}applyAddressChangeBlockReason(e){switch(e){case"ui-extension":case"ucp":return this.#l;default:return Ze(e)}}async _applyAddressChange({address:e}){const t=this.findMatchingAddress(e,{ignoreIds:[J]});if(t)return this.#p(t.address),this.#c.value=void 0,{type:"success",address:t};const i={id:J,address:e};return this.#c.value=e,this.#p(e),{type:"success",address:i}}async _selectAddress(e){return this.#i.activeSession.value?!1:(this.#p(e.address),!0)}_createAddress({address:e,setDefault:t,selectAddress:i,addressErrorsOverride:r}){const n=!!t;return this.#u({mutate:()=>this.#h.createAddressMutation({address:e,setDefault:n}),getNewAddresses:a=>n?[...this.addresses.value.map(o=>({...o,default:!1})),{...a,default:!0}]:[...this.addresses.value,a],getNewSelectedAddress:a=>a,setAddressValidationErrors:a=>this.#m(a,e.countryCode,r),onSuccess:a=>{a&&i&&this.#p(a.address)}})}_updateEphemeralAddress({address:e}){const t=this.findMatchingAddress(e,{ignoreIds:[J]});return t?(this.#c.value=void 0,this.#p(t.address),Promise.resolve(t)):(this.#c.value=e,this.#p(e),Promise.resolve({id:J,address:e}))}_updateAddress({id:e,address:t,setDefault:i,addressErrorsOverride:r}){return this.#u({mutate:()=>this.#h.updateAddressMutation({address:t,id:e,setDefault:!!i}),getNewAddresses:n=>{const a=!!i;return this.addresses.value.map(o=>o.id===n.id?n:a?{...o,default:!1}:o)},getNewSelectedAddress:n=>n,setAddressValidationErrors:n=>this.#m(n,t.countryCode,r),onSuccess:n=>{n&&this.#p(n.address)}})}async _deleteAddress(e){return!!await this.#u({mutate:()=>this.#h.deleteAddressMutation({id:e}),getNewAddresses:i=>this.addresses.value.filter(r=>r.id!==i.id),getNewSelectedAddress:(i,r)=>this.selectedAddress.value&&this.selectedAddress.value.id!==i.id?this.selectedAddress.value:r[0],setAddressValidationErrors:()=>{},onSuccess:i=>{i&&this.#p(i.address)}})}async _setDefaultAddress({id:e,address:t}){return!!await this._updateAddress({id:e,address:t,setDefault:!0})}get#h(){return Un(this.#a,this.#o.extendedAddressMode)}#u(e){return Hn({...e,addresses:this.#e,errors:this.errors,i18n:this.#n})}#m(e,t,i){Gn({addressType:"shipping",violations:e,countryCode:t,addressErrorsOverride:i,errors:this.errors,address:this.#o,addressSettings:this.#d})}#p(e){this.#r.value=this.withCoordinates(e)}}const Pe="guest_address";class mr extends we{#e;#t;#s=u(!0);#i;#r;#n;constructor({proposalAddress:e,immutableAddresses:t,mustSelectProvidedAddress:i,canUpdateDeliveryAddress:r,observability:n,wallets:a}){const o=e.value,d=t.value?.find(({address:h})=>ue(h,o,["phone"]));let l,c;d?c=d.id:(l={...o,oneTimeUse:!1},c=Pe),super({observability:n,errors:{banner:u(void 0),fields:_e()}}),this.selectedAddressId=u(c),this.#n=e,this.#e=u(l),this.#t=_(()=>!i.value&&!this.#e.value),this.#r=i,this.#i=_(()=>{if(r.value===!1)return"DELIVERY_ADDRESS_NOT_EDITABLE";if(this.#r.value)return"MUST_SELECT_PROVIDED_ADDRESS";if(this.wallets.activeSession.value)return"ADDRESS_CHANGES_UNAVAILABLE"}),this.immutableAddresses=_(()=>t.value??[]),this.addresses=_(()=>{const h=this.#e.value;return h?[{id:Pe,address:h}]:[]}),this.wallets=a}get canCreateAddress(){return this.#t}get canUpdateAddress(){return this.#s}applyAddressChangeBlockReason(e){switch(e){case"ui-extension":case"ucp":return this.#i;default:return Ze(e)}}async _createAddress({address:e,selectAddress:t}){this.#e.value=e;const i={id:Pe,address:e};return t&&(this.selectedAddressId.value=Pe,this.#n.value=e),i}_updateAddress({address:e}){return this.#e.value=e,this.selectedAddressId.value=Pe,this.#n.value=e,Promise.resolve({id:Pe,address:e})}_selectAddress(e){return this.wallets.activeSession.value?Promise.resolve(!1):(this.selectedAddressId.value=e.id,this.#n.value=e.address,Promise.resolve(!0))}async _applyAddressChange({address:e}){const t=this.findMatchingAddress(e,{ignoreIds:[Pe]});if(t)return this.selectedAddressId.value=t.id,this.#n.value=t.address,{type:"success",address:t};const i={id:Pe,address:e};return this.#e.value=e,this.selectedAddressId.value=Pe,this.#n.value=e,{type:"success",address:i}}}function gr(s){return`${mu}_${Yo(s)}`}class Uh extends we{#e=u(!0);#t;#s;#i=u([]);#r;constructor({proposalAddress:e,buyerIdentityAddresses:t,mustSelectProvidedAddress:i,canUpdateDeliveryAddress:r,observability:n,i18n:a}){const o=e.value,d=gr(o),l=[{id:d,address:o}],c=d,h=new Set([d]);t?.forEach(b=>{if(St(b,o))return;const g=gr(b);h.has(g)||(h.add(g),l.push({id:g,address:b}))}),super({observability:n,errors:{banner:u(void 0),fields:_e()}}),this.selectedAddressId=u(c),this.addressesSignal=u(l),this.#r=a.translate("address_management.saved_addresses"),this.#t=_(()=>{if(r.value===!1)return"DELIVERY_ADDRESS_NOT_EDITABLE";if(i.value)return"MUST_SELECT_PROVIDED_ADDRESS"}),this.#s=_(()=>this.addressesSignal.value),this.addresses=this.#s,this.immutableAddresses=this.#i}get canUpdateAddress(){return this.#e}get addressesTitle(){return this.#r}applyAddressChangeBlockReason(e){switch(e){case"ui-extension":case"ucp":return this.#t;default:return Ze(e)}}}class xh extends Uh{#e;#t=u(void 0);#s;constructor({proposalAddress:e,buyerIdentityAddresses:t,mustSelectProvidedAddress:i,canUpdateDeliveryAddress:r,observability:n,i18n:a}){super({proposalAddress:e,buyerIdentityAddresses:t,mustSelectProvidedAddress:i,canUpdateDeliveryAddress:r,observability:n,i18n:a}),this.#e=e,this.#s=_(()=>{const o=this.#t.value;return o?[{id:J,address:o}]:[]}),this.immutableAddresses=this.#s}_selectAddress(e){return this.selectedAddressId.value=e.id,this.#e.value=e.address,Promise.resolve(!0)}_updateEphemeralAddress({address:e}){const t=this.findMatchingAddress(e,{ignoreIds:[J]});return t?(this.#t.value=void 0,this.selectedAddressId.value=t.id,this.#e.value=t.address,Promise.resolve(t)):(this.#t.value=e,this.#e.value=e,this.selectedAddressId.value=J,Promise.resolve({id:J,address:e}))}_updateAddress({id:e,address:t}){const i={id:e,address:t};return this.addressesSignal.value=this.addressesSignal.value.map(r=>r.id===e?i:r),this.#e.value=t,this.selectedAddressId.value=e,Promise.resolve(i)}async _applyAddressChange({address:e}){const t=this.findMatchingAddress(e,{ignoreIds:[J]});if(t)return this.selectedAddressId.value=t.id,this.#e.value=t.address,this.#t.value=void 0,{type:"success",address:t};const i={id:J,address:e};return this.#t.value=e,this.selectedAddressId.value=i.id,this.#e.value=i.address,{type:"success",address:i}}}const Vh={id:"317ce3b91da3e88dc3d5a3759a9a905c8b9573b207786e7e70db2736d25224ef",type:"mutation",name:"AddressCreate",source:"mutation AddressCreate($address:AddressInput!,$checkoutContext:CheckoutContextInput!,$origin:String!,$preferred:Boolean){addressCreate(address:$address origin:$origin checkoutContext:$checkoutContext preferred:$preferred){userErrors{message field __typename}userAddress{...ShippingAddressFragment __typename}userPhone __typename}}fragment ShippingAddressFragment on Address{addressLineComponents{additionalInformation district streetName streetNumber subdistrict __typename}fields{key value __typename}id uuid lastUsedAt requiresVerification valid userPreferred explicitlyPreferred __typename}"};function qn({observability:s,shopPayGraphql:e,source:t,extendedAddressMode:i}){const r=Fe({source:t});return async(n,a,o=r,d=!1)=>{const{data:l,error:c}=await e.mutate(Vh,{variables:{address:hn(n,i),origin:o,checkoutContext:a,preferred:d}});if(c||l==null||l.addressCreate==null)return s.leaveErrorBreadcrumb("Shop Pay add address mutation had an error"),{status:"failed"};const{addressCreate:h}=l;return h.userErrors.length>0?(s.leaveErrorBreadcrumb("Shop Pay add address mutation had a user error"),{status:"failed",errors:h.userErrors}):{status:"success",address:h.userAddress?pn(h.userAddress):void 0,userPhone:h.userPhone}}}const Hh={id:"2025d9ea2f58381d478a6e61b0965f09d04deb9e44673115964b4fc848d099a4",type:"mutation",name:"AddressDelete",source:"mutation AddressDelete($id:ID!,$uuid:String!,$origin:String!,$checkoutContext:CheckoutContextInput!){addressDelete(id:$id uuid:$uuid origin:$origin checkoutContext:$checkoutContext){userErrors{field message __typename}__typename}}"};function Wn({shopPayGraphql:s,source:e}){const t=Fe({source:e});return async(i,r,n)=>{const{data:a,error:o}=await s.mutate(Hh,{variables:{id:i,uuid:r,origin:t,checkoutContext:n}});if(o||a==null||a.addressDelete==null)return{status:"failed"};const{addressDelete:d}=a;return d.userErrors.length>0?{status:"failed",errors:d.userErrors}:{status:"success"}}}const Gh={id:"6958b43951d423672be00893206c0c8e8eda285380aca5281627b0ac645ddeac",type:"mutation",name:"AddressUpdate",source:"mutation AddressUpdate($address:AddressInput!,$id:ID!,$uuid:String!,$origin:String!,$preferred:Boolean,$checkoutContext:CheckoutContextInput!){addressUpdate(address:$address id:$id uuid:$uuid origin:$origin preferred:$preferred checkoutContext:$checkoutContext){userErrors{field message __typename}userAddress{...ShippingAddressFragment __typename}userPhone __typename}}fragment ShippingAddressFragment on Address{addressLineComponents{additionalInformation district streetName streetNumber subdistrict __typename}fields{key value __typename}id uuid lastUsedAt requiresVerification valid userPreferred explicitlyPreferred __typename}"};function zn({observability:s,shopPayGraphql:e,source:t,extendedAddressMode:i}){const r=Fe({source:t});return async(n,a,o,d,l=!1)=>{const{data:c,error:h}=await e.mutate(Gh,{variables:{id:a,uuid:o,address:hn(n,i),origin:r,preferred:l,checkoutContext:d}});if(h||c==null||c.addressUpdate==null)return s.leaveErrorBreadcrumb("Shop Pay update address mutation had an error"),{status:"failed"};const{addressUpdate:b}=c;return b.userErrors.length>0?(s.leaveErrorBreadcrumb("Shop Pay update address mutation had a user error"),{status:"failed",errors:b.userErrors}):{status:"success",address:b.userAddress?pn(b.userAddress):void 0,userPhone:b.userPhone}}}class qh extends we{constructor({shopPay:e,observability:t,addressSettings:i}){super({observability:t,errors:{banner:u(void 0),fields:_e()}}),this.immutableAddresses=u([]),this.#t=u(!0),this.#s=u(!0),this.#i=u(!0),this.addresses=_(()=>e.user.addresses.value.map(r=>rs({address:r,addressSettings:i,shopUserPhone:e.user.phoneNumber.value}))),this.#e=_(()=>this.addresses.value.length<Vs),this.selectedAddressId=_(()=>e.session.selectedBillingAddress.value?.id)}#e;#t;#s;#i;get canCreateAddress(){return this.#e}
2get canUpdateAddress(){return this.#t}get canDeleteAddress(){return this.#s}get canSetDefaultAddress(){return this.#i}}class Wh extends qh{#e;#t;#s;#i;#r;#n;#a;#o;#d;get#l(){return this.#o.addressSettings}get#c(){return this.#e.proposed.billingAddress}constructor({proposal:e,shopPay:t,observability:i,userEvents:r,shopPayGraphql:n,source:a,shop:o,i18n:d,checkoutConfiguration:l,address:c}){super({shopPay:t,observability:i,addressSettings:l.addressSettings.nonBillingAddressSettings.value}),this.#e=e,this.#t=r,this.#s=t,this.#i=n,this.#r=a,this.#n=o,this.#a=d,this.#o=l,this.#d=c}async _selectAddress(e){const t=this.#h(e.id)??ft(e.address,e.id);return this.#m(t),this.#c.value=this.withCoordinates(e.address),this.#A(),!0}async _createAddress({address:e,setDefault:t,selectAddress:i,addressErrorsOverride:r}){if(this.#r.type==="simulated")return;const n=await this.#y({address:e,preferred:t});if(this.#t.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...Te(this.#r,{configuration:this.#o},this.#n),action:"billing_address_add_new"}}),n.status!=="success"){this.#b({shopPayErrors:n.errors,addressErrorsOverride:r,submittedAddress:e});return}const a=n.address;if(!a)return;const o=t?this.#s.user.addresses.value.map(l=>({...l,userPreferred:!1})):this.#s.user.addresses.value;this.#s.user.unstable_setAddresses([...o,a]),n.userPhone&&!this.#s.user.phoneNumber.value&&this.#s.user.unstable_setPhoneNumber(n.userPhone);const d=this.#u(a);return i&&(this.#m(a),this.#c.value=this.withCoordinates(d.address),this.#p(d.address,a),this.#A()),d}async _updateAddress({id:e,address:t,setDefault:i,addressErrorsOverride:r}){if(this.#r.type==="simulated")return;const n=this.#h(e);if(!n)return;const a=await this.#v(t,e,n.uuid,i);if(a.status!=="success"){this.#b({shopPayErrors:a.errors,addressErrorsOverride:r,submittedAddress:t});return}const o=a.address;if(!o)return;const d=this.#s.user.addresses.value.map(c=>c.uuid===n.uuid?o:i?{...c,userPreferred:!1}:c);this.#s.user.unstable_setAddresses(d),a.userPhone&&!this.#s.user.phoneNumber.value&&this.#s.user.unstable_setPhoneNumber(a.userPhone);const l=this.#u(o);return this.selectedAddressId.value===e&&(this.#m(o),this.#c.value=this.withCoordinates(l.address)),this.#g(e,l.address,o),this.#A(),l}async _deleteAddress(e){if(this.#r.type==="simulated")return!1;const t=this.#h(e),i=this.selectedAddressId.value;if(!t)return!1;const r=await this.#S(e,t.uuid);if(this.#t.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...Te(this.#r,{configuration:this.#o},this.#n),action:"billing_address_remove"}}),r.status!=="success")return!1;const n=this.#s.user.addresses.value.filter(d=>d.uuid!==t.uuid),a=ti(n)??void 0,o=a?this.#u(a).address:this.#T();if(t.userPreferred&&a){const d=n.findIndex(l=>l.id===a.id);n[d]={...a,userPreferred:!0}
2,this.#t.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...Te(this.#r,{configuration:this.#o},this.#n),action:"set_default_address_auto"}})}return this.#s.user.unstable_setAddresses(n),i===e&&(this.#m(a),this.#c.value=this.withCoordinates(o)),this.#f(e,o,a),this.#A(),!0}async _setDefaultAddress({id:e,address:t}){return this.#r.type==="simulated"?!1:(this.#t.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...Te(this.#r,{configuration:this.#o},this.#n),action:"set_default_address"}}),!!await this._updateAddress({id:e,address:t,setDefault:!0}))}#h(e){return this.#s.user.addresses.value.find(t=>t.id===e)}#u(e){return rs({address:e,addressSettings:this.#l.nonBillingAddressSettings.value,shopUserPhone:this.#s.user.phoneNumber.value})}#m(e){this.#s.session.unstable_updateSelectedBillingAddress(e)}#p(e,t){si(this.#e)&&!this.#s.session.selectedShippingAddress.value&&(this.#s.session.unstable_updateSelectedShippingAddress(t),this.#e.proposed.shippingAddress.value=this.withCoordinates(e))}#g(e,t,i){this.#s.session.selectedShippingAddress.value?.id===e&&(this.#s.session.unstable_updateSelectedShippingAddress(i),this.#e.proposed.shippingAddress.value=this.withCoordinates(t))}#f(e,t,i){this.#s.session.selectedShippingAddress.value?.id===e&&(this.#s.session.unstable_updateSelectedShippingAddress(i),this.#e.proposed.shippingAddress.value=this.withCoordinates(t))}#y({address:e,preferred:t}){return qn({observability:this.observability,shopPayGraphql:this.#i,source:this.#r,extendedAddressMode:this.#d.extendedAddressMode})(e,this.#_(),Fe({source:this.#r}),t)}#v(e,t,i,r){return zn({observability:this.observability,shopPayGraphql:this.#i,source:this.#r,extendedAddressMode:this.#d.extendedAddressMode})(e,t,i,this.#_(),r)}#S(e,t){return Wn({shopPayGraphql:this.#i,source:this.#r})(e,t,this.#_())}#b({shopPayErrors:e,addressErrorsOverride:t,submittedAddress:i}){Nn({addressErrors:t??this.errors.fields,shopPayErrors:e,i18n:this.#a,observability:this.observability,userEvents:this.#t,source:this.#r,configuration:this.#o,shop:this.#n,submittedAddress:i,addressContext:"billing"})}#_(){return{checkoutIdentifier:this.#r.checkoutSessionIdentifier??"",checkoutVersion:Fe({source:this.#r}),shopId:Je(this.#n.id),shopifyDomain:this.#n.myshopifyDomain}}#T(){return mn({phone:this.#s.user.phoneNumber.value,countryCode:this.#l.nonBillingAddressSettings.value.defaultShippingDetails.country?.code})}#A(){const e=this.#e.proposed.billingAddress.value,t=this.#e.proposed.shippingAddress.value,i=ue(t,e);this.#s.user.hasCreditCards.value&&(i?this.#e.proposed.billingAddressOption.value="shipping":this.#e.proposed.billingAddressOption.value="custom")}}function ot(s,e){if(!s)return!1;const t=ii(e)?e.allowedShippingCountriesOverride.value:null;if(!t||t.length===0)return!0;const i=s.address.countryCode;return i?t.includes(i):!0}function zh({availableDeliveryAddresses:s,mustSelectProvidedAddress:e,initialNegotiationData:t,addresses:i,shopPay:r,addressSettings:n}){if(e.value)return s.value||[];const a=[],o=c=>{c&&(fr(i.value,c.address)||fr(a,c.address)||a.push({...c,address:On({address:c.address,addressSettings:n,fallbackPhone:r.user.phoneNumber.value})}))};for(const c of s.value||[])o(c);const d=r.config.redirectSource===Hs.ShopPaySdk,l=$h(t,r.config.redirectSource);return l&&o(d?{...l,disabled:!ot(l,r)}:l),a}function fr(s,e){return s.some(t=>ue(t.address,e,["phone"]))}function $h(s,e){const t=e===Hs.ShopPayInstallmentsAsPaymentMethod,i=e===Hs.ShopPaySdk;if(!t&&!i||s?.session?.negotiate.result.__typename!=="NegotiationResultAvailable")return;const{sellerProposal:r,buyerProposal:n}=s.session.negotiate.result,a=gn({delivery:r.delivery,buyerDelivery:n.delivery,remoteDelivery:fn(r.remote).remoteDelivery});if(a&&!ri(a,yn))return{id:Gs,address:a}}class Yh extends we{constructor({proposal:e,shopPay:t,observability:i,initialNegotiationData:r,addressSettings:n,address:a,i18n:o}){super({observability:i,errors:{banner:u(void 0),fields:_e()}}),this.proposal=e,this.shopPay=t,this.i18n=o,this.address=a,this.signals=jh({proposal:e,shopPay:t,initialNegotiationData:r,addressSettings:n,address:a,i18n:o}),this.addresses=this.signals.addresses,this.immutableAddresses=this.signals.immutableAddresses,this.selectedAddressId=this.signals.selectedAddressId}get canCreateAddress(){return this.signals.canCreateAddress}
2get canUpdateAddress(){return this.signals.canUpdateAddress}get canDeleteAddress(){return this.signals.canDeleteAddress}get canSetDefaultAddress(){return this.signals.canSetDefaultAddress}get immutableAddressSections(){return this.signals.immutableAddressSections}get addressesTitle(){return this.signals.addressesTitle}}function jh({proposal:s,shopPay:e,initialNegotiationData:t,addressSettings:i,address:r,i18n:n}){const a=s.negotiated.fields.mustSelectProvidedAddress,o=s.negotiated.fields.canUpdateDeliveryAddress,d=s.negotiated.fields.availableDeliveryAddresses,l=_(()=>a.value?[]:e.user.addresses.value.map(T=>rs({address:T,isDisabled:R=>!ot(R,e),addressSettings:i,shopUserPhone:e.user.phoneNumber.value}))),c=_(()=>{if(a.value)return[];const T=s.negotiated.fields.buyerIdentity.value?.customerProfile;return T?.__typename!=="CustomerProfile"||!T.shippingAddresses.length?[]:T.shippingAddresses.map(R=>({...R,disabled:!ot(R,e)}))}),h=_(()=>zh({availableDeliveryAddresses:d,mustSelectProvidedAddress:a,initialNegotiationData:t,addresses:l,shopPay:e,addressSettings:i})),b=_(()=>{if(l.value.length>=Vs)return[];const T=[...l.value,...h.value];return c.value.filter(R=>{const M=R.address.countryCode,k=M?r.countryDetails.get(M):void 0,O=jo(i,k,k?r.extendedAddressMode.getFormatFromCountry(k):void 0);return!T.some(w=>{const D=!R.address.firstName?.trim()||!w.address.firstName?.trim();return ue(R.address,w.address,["phone",...D?["firstName"]:[],...O?[]:["zoneCode"]])})})}),g=_(()=>b.value.length?[{title:n.translate("address_management.saved_with_store"),addressIds:new Set(b.value.map(({id:T})=>T))}]:[]),v=_(()=>[...h.value,...b.value]),E=_(()=>!a.value),y=_(()=>l.value.length<Vs&&E.value),p=E,f=E,m=E,A=_(()=>{if(o.value===!1)return"DELIVERY_ADDRESS_NOT_EDITABLE";if(a.value)return"MUST_SELECT_PROVIDED_ADDRESS"}),I=_(()=>e.session.selectedShippingAddress.value?.id),P=n.translate("address_management.saved_addresses");return{addresses:l,immutableAddresses:v,immutableAddressSections:g,selectedAddressId:I,canCreateAddress:y,canUpdateAddress:p,canDeleteAddress:f,canSetDefaultAddress:m,canApplyExternalAddress:A,addressesTitle:P}}class Kh extends Yh{#e;#t;#s;#i;#r;#n;#a=u(void 0);get#o(){return this.#r.addressSettings}get#d(){return this.proposal.proposed.shippingAddress}#l(e){return{id:J,address:On({address:e,addressSettings:this.#o.nonBillingAddressSettings.value,fallbackPhone:this.shopPay.user.phoneNumber.value})}}constructor({proposal:e,shopPay:t,observability:i,userEvents:r,initialNegotiationData:n,shopPayGraphql:a,source:o,shop:d,i18n:l,checkoutConfiguration:c,address:h}){super({proposal:e,shopPay:t,observability:i,initialNegotiationData:n,addressSettings:c.addressSettings.nonBillingAddressSettings.value,address:h,i18n:l}),this.#e=a,this.#t=r,this.#s=o,this.#i=d,this.#r=c,this.#n=_(()=>{const b=this.signals.immutableAddresses.value,g=this.#a.value;return g?[...b.filter(({id:v})=>v!==Gs),this.#l(g)]:b}),this.immutableAddresses=this.#n}applyAddressChangeBlockReason(e){switch(e){case"ui-extension":case"ucp":return this.signals.canApplyExternalAddress;default:return Ze(e)}}#c({source:e,address:t}){return e==="ucp"&&t.phone?.trim()?[]:["phone"]}async _applyAddressChange({source:e,address:t}){if(e==="ucp"&&!ot({address:t},this.shopPay))return this.#a.value=void 0,this.#y(void 0),{type:"failure",reason:"ADDRESS_COUNTRY_NOT_SUPPORTED"};const i=this.findMatchingAddress(t,{ignoreFields:this.#c({source:e,address:t}),ignoreIds:[J]});if(i){await this._selectAddress(i),this.#a.value=void 0;const n=this.selectedAddress.value;return n?{type:"success",address:n}:{type:"failure",reason:"ADDRESS_CHANGES_UNAVAILABLE"}}const r=this.#l(t);return this.#a.value=t,await this._selectAddress(r),{type:"success",address:r}}async _selectAddress(e){const t=this.#_(e.id)??ft(e.address,e.id);return this.#y(t),this.#d.value=this.withCoordinates(e.address),this.#P(),!0}async _createAddress({address:e,setDefault:t,selectAddress:i,addressErrorsOverride:r}){if(this.#s.type==="simulated")return;this.errors.banner.value=void 0;const n=await this.#T({address:e,preferred:t});if(this.#t.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...Te(this.#s,{configuration:this.#r},this.#i),action:"shipping_address_add_new"}}),n.status!=="success"){this.#w({shopPayErrors:n.errors,addressErrorsOverride:r,
2submittedAddress:e});return}const a=n.address;if(!a)return;const o=t?this.shopPay.user.addresses.value.map(l=>({...l,userPreferred:!1})):this.shopPay.user.addresses.value;this.shopPay.user.unstable_setAddresses([...o,a]),n.userPhone&&!this.shopPay.user.phoneNumber.value&&this.shopPay.user.unstable_setPhoneNumber(n.userPhone);const d=this.#f(a);return i&&(this.#y(a),this.#d.value=this.withCoordinates(d.address),this.#v(d.address,a),this.#P()),d}async _updateEphemeralAddress({address:e}){const t=this.findMatchingAddress(e,{ignoreIds:[J]});if(t)return this.#a.value=void 0,await this._selectAddress(t),this.selectedAddress.value??t;this.#a.value=e;const i=this.#l(e);return await this._selectAddress(i),i}async _updateAddress({id:e,address:t,setDefault:i,addressErrorsOverride:r}){if(this.#s.type==="simulated")return;this.errors.banner.value=void 0;const n=this.#_(e);if(!n)return this.#h({id:e,address:t,setDefault:i,addressErrorsOverride:r});const a=await this.#A(t,e,n.uuid,i);if(a.status!=="success"){this.#w({shopPayErrors:a.errors,addressErrorsOverride:r,submittedAddress:t});return}const o=a.address;if(!o)return;const d=this.shopPay.user.addresses.value.map(c=>c.uuid===n.uuid?o:i?{...c,userPreferred:!1}:c);this.shopPay.user.unstable_setAddresses(d),a.userPhone&&!this.shopPay.user.phoneNumber.value&&this.shopPay.user.unstable_setPhoneNumber(a.userPhone);const l=this.#f(o);return this.selectedAddressId.value===e&&(this.#y(o),this.#d.value=this.withCoordinates(l.address)),this.#S(e,l.address,o),this.#P(),l}async#h({id:e,address:t,setDefault:i,addressErrorsOverride:r}){if(e===Gs&&!i)return this._updateEphemeralAddress({address:t});if(!this.#u(e))return this.#p(e,"not a customer-account address");if(!i){const a=this.findMatchingAddress(t);if(a)return await this._selectAddress(a),this.#g(e,"selected_matching_address"),this.selectedAddress.value??a}if(!this.canCreateAddress.value)return this.#p(e,"address list full");const n=await this._createAddress({address:t,setDefault:i,selectAddress:!0,addressErrorsOverride:r});return!n&&!this.#m(r)&&(this.errors.banner.value=this.i18n.translate("shipping.address_form.generic_error")),this.#g(e,n?"vaulted_edit":"vault_rejected"),n}#u(e){const t=this.proposal.negotiated.fields.buyerIdentity.value?.customerProfile;return t?.__typename==="CustomerProfile"&&t.shippingAddresses.some(i=>i.id===e)}#m(e){const t=e??this.errors.fields;return Object.values(t).some(i=>!!i.value)}#p(e,t){this.observability.error(new xs(`Cannot update address "${e}": no Shop Pay vault record for it (${t})`,{groupingHash:"ShopPayShippingAddressManager::_updateAddress::MissingVaultRecord"})),this.errors.banner.value=this.i18n.translate("shipping.address_form.generic_error")}#g(e,t){this.observability.log("shop_pay_address_edit_without_vault_record","Buyer saved an edit to an address with no Shop Pay vault record",{addressId:e,outcome:t})}async _deleteAddress(e){if(this.#s.type==="simulated")return!1;const t=this.#_(e),i=this.selectedAddressId.value;if(!t)return!1;const r=await this.#k(e,t.uuid);if(this.#t.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...Te(this.#s,{configuration:this.#r},this.#i),action:"shipping_address_remove"}}),r.status!=="success")return!1;const n=this.shopPay.user.addresses.value.filter(d=>d.uuid!==t.uuid),a=ti(n)??void 0,o=a?this.#f(a).address:this.#I();if(t.userPreferred&&a){const d=n.findIndex(l=>l.id===a.id);n[d]={...a,userPreferred:!0}
2,this.#t.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...Te(this.#s,{configuration:this.#r},this.#i),action:"set_default_address_auto"}})}return this.shopPay.user.unstable_setAddresses(n),i===e&&(this.#y(a),this.#d.value=this.withCoordinates(o)),this.#b(e,o,a),this.#P(),!0}async _setDefaultAddress({id:e,address:t}){return this.#s.type==="simulated"?!1:(this.#t.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...Te(this.#s,{configuration:this.#r},this.#i),action:"set_default_address"}}),!!await this._updateAddress({id:e,address:t,setDefault:!0}))}#f(e){return rs({address:e,isDisabled:t=>!ot(t,this.shopPay),addressSettings:this.#o.nonBillingAddressSettings.value,shopUserPhone:this.shopPay.user.phoneNumber.value})}#y(e){this.shopPay.session.unstable_updateSelectedShippingAddress(e)}#v(e,t){this.shopPay.session.selectedBillingAddress.value||(this.shopPay.session.unstable_updateSelectedBillingAddress(t),this.proposal.proposed.billingAddress.value=this.withCoordinates(e))}#S(e,t,i){this.shopPay.session.selectedBillingAddress.value?.id===e&&(this.shopPay.session.unstable_updateSelectedBillingAddress(i),this.proposal.proposed.billingAddress.value=this.withCoordinates(t))}#b(e,t,i){this.shopPay.session.selectedBillingAddress.value?.id===e&&(this.shopPay.session.unstable_updateSelectedBillingAddress(i),this.proposal.proposed.billingAddress.value=this.withCoordinates(t))}#_(e){return this.shopPay.user.addresses.value.find(t=>t.id===e)}#T({address:e,preferred:t}){return qn({observability:this.observability,shopPayGraphql:this.#e,source:this.#s,extendedAddressMode:this.address.extendedAddressMode})(e,this.#E(),Fe({source:this.#s}),t)}#A(e,t,i,r){return zn({observability:this.observability,shopPayGraphql:this.#e,source:this.#s,extendedAddressMode:this.address.extendedAddressMode})(e,t,i,this.#E(),r)}#k(e,t){return Wn({shopPayGraphql:this.#e,source:this.#s})(e,t,this.#E())}#w({shopPayErrors:e,addressErrorsOverride:t,submittedAddress:i}){Nn({addressErrors:t??this.errors.fields,shopPayErrors:e,i18n:this.i18n,observability:this.observability,userEvents:this.#t,source:this.#s,configuration:this.#r,shop:this.#i,submittedAddress:i,addressContext:"shipping"})}#E(){return{checkoutIdentifier:this.#s.checkoutSessionIdentifier??"",checkoutVersion:Fe({source:this.#s}),shopId:Je(this.#i.id),shopifyDomain:this.#i.myshopifyDomain}}#I(){return mn({phone:this.shopPay.user.phoneNumber.value,countryCode:this.#o.nonBillingAddressSettings.value.defaultShippingDetails.country?.code})}#P(){const e=this.proposal.proposed.billingAddress.value,t=this.proposal.proposed.shippingAddress.value,i=ue(t,e);this.shopPay.user.hasCreditCards.value&&(i?this.proposal.proposed.billingAddressOption.value="shipping":this.proposal.proposed.billingAddressOption.value="custom")}}class Xh{#e;#t;#s;constructor({identity:e,observability:t,userEvents:i,proposal:r,wallets:n,i18n:a,address:o,configuration:d,shop:l,shopPay:c,graphql:{coreGraphql:h,shopPayGraphql:b},source:g,router:v,initialNegotiationData:E}){const y=_(()=>v.currentUrl.value.pathname.endsWith("/throttle")),p=new mr({proposalAddress:r.proposed.shippingAddress,mustSelectProvidedAddress:r.negotiated.fields.mustSelectProvidedAddress,canUpdateDeliveryAddress:r.negotiated.fields.canUpdateDeliveryAddress,immutableAddresses:r.negotiated.fields.availableDeliveryAddresses,observability:t,wallets:n}),f=new Ps(t);this.#e=u(p),this.#t=u(f),this.shipping=this.#e,this.billing=this.#t,this.#s=se(()=>{const m=e.current.value;this.#e.peek().dispose(),this.#t.peek().dispose(),Zs(()=>
2{if(m==="customerAccount")this.#e.value=new Fh({proposalAddress:r.proposed.shippingAddress,availableDeliveryAddresses:r.negotiated.fields.availableDeliveryAddresses,mustSelectProvidedAddress:r.negotiated.fields.mustSelectProvidedAddress,canUpdateDeliveryAddress:r.negotiated.fields.canUpdateDeliveryAddress,buyerIdentity:r.negotiated.fields.buyerIdentity,observability:t,addressSettings:d.addressSettings.nonBillingAddressSettings.value,address:o,wallets:n,i18n:a,graphql:h}),this.#t.value=new Nh({billingAddress:r.proposed.billingAddress,billingAddressOption:r.proposed.billingAddressOption,buyerIdentity:r.negotiated.fields.buyerIdentity,observability:t,addressSettings:d.addressSettings.nonBillingAddressSettings.value,address:o,i18n:a,graphql:h});else if(m==="shopPay")this.#e.value=new Kh({proposal:r,shopPay:c,observability:t,userEvents:i,initialNegotiationData:E,shopPayGraphql:b,source:g,shop:l,i18n:a,checkoutConfiguration:d,address:o}),this.#t.value=new Wh({proposal:r,shopPay:c,observability:t,userEvents:i,shopPayGraphql:b,source:g,shop:l,i18n:a,checkoutConfiguration:d,address:o});else if(m==="sdkCartHints")this.#e.value=new xh({proposalAddress:r.proposed.shippingAddress,buyerIdentityAddresses:r.negotiated.fields.buyerIdentity.value?.shippingAddresses,mustSelectProvidedAddress:r.negotiated.fields.mustSelectProvidedAddress,canUpdateDeliveryAddress:r.negotiated.fields.canUpdateDeliveryAddress,observability:t,i18n:a}),this.#t.value=new Ps(t);else if(m==="businessCustomer"){const A=l.additionalAddressFieldsEnabled,I=new Th({proposalAddress:r.proposed.shippingAddress,buyerIdentity:r.negotiated.fields.buyerIdentity,mustSelectProvidedAddress:r.negotiated.fields.mustSelectProvidedAddress,canUpdateDeliveryAddress:r.negotiated.fields.canUpdateDeliveryAddress,observability:t,address:o,shippingCountries:l.shippingCountries,shippingAddressSettings:d.addressSettings.nonBillingAddressSettings.value,deliveryNext:r.negotiated.fields.deliveryNext,additionalFieldsEnabled:A,isThrottled:y,i18n:a});this.#e.value=I,this.#t.value=new Ph({proposalAddress:r.proposed.billingAddress,billingAddressOption:r.proposed.billingAddressOption,buyerIdentity:r.negotiated.fields.buyerIdentity,billingAddressFact:r.facts.billingAddress,isValidShippingAddress:I.isValidShippingAddress,isLoadingShipping:I.isLoadingShippingAddress,observability:t,sourceType:g.type,address:o,billingCountries:l.billingCountries,billingAddressSettings:d.addressSettings.billingAddressSettings.value,deliveryNext:r.negotiated.fields.deliveryNext,additionalFieldsEnabled:A,isThrottled:y,i18n:a})}else this.#e.value=new mr({proposalAddress:r.proposed.shippingAddress,mustSelectProvidedAddress:r.negotiated.fields.mustSelectProvidedAddress,canUpdateDeliveryAddress:r.negotiated.fields.canUpdateDeliveryAddress,immutableAddresses:r.negotiated.fields.availableDeliveryAddresses,observability:t,wallets:n}),this.#t.value=new Ps(t)})})}dispose(){this.#s()}}const Qh={id:"e80d5f5c1e60593716690e3575add0ef2588b89c7ea211e423658d746ee06ffa",type:"query",name:"CountryDetails",source:""};class Zh{#e;#t;constructor({countryDetails:e,policy:t}){this.#e=e,this.#t=t}get(e){if(!e)return null;const t=this.#e.get(e);return t?this.getFromCountry(t):null}getFormat(e,t){if(!e)return;const i=this.#e.get(e);return i?this.getFormatFromCountry(i,t):void 0}getFromCountry(e){return this.#t.isConcatenatedEnabled(e)&&e.extendedFormatting?.edit?"concatenated":this.#t.isDedicatedEnabled(e)&&this.#t.getDedicatedFormat(e)?"dedicated":null}getFormatFromCountry(e,t=this.getFromCountry(e)){return t==="concatenated"?e.extendedFormatting?.edit||e.formatting.edit:t==="dedicated"&&this.#t.getDedicatedFormat(e)||e.formatting.edit}}class Jh{constructor({graphql:e,i18n:t,initialCountryDetails:i,extendedAddressModePolicy:r}){this.countryDetails=new ep({graphql:e,i18n:t,initialCountryDetails:i}),this.extendedAddressMode=new Zh({countryDetails:this.countryDetails,policy:r})}}class ep{constructor({graphql:e,i18n:t,initialCountryDetails:i}){this.#s=u(new Map),this.#i=new Map,this.#r=u(new Set),this.#n=new Map,this.fetch=async r=>{if(!r)return;const n=this.#s.value.get(r);if(n)return n;const a=this.#n.get(r);if(a)return a;const o=this.#a(r);this.#n.set(r,o);try{return await o}finally{this.#n.delete(r)}},this.#e=e,this.#t=t;for(const r of i)this.#d(r)}#e;#t;#s;#i;#r;#n;get(e){return this.#s.value.get(e)??this.#i.get(e)}isLoading(e){return this.#r.value.has(e)}async#a(e){this.#r.value=new Set([...this.#r.value,e]);const{data:t,error:i}=await this.#e.staticQuery(Qh,{variables:{country:e},cache:!0}),r=i?this.#o(e):this.#d(t?.country),n=new Set(this.#r.value);return n.delete(e),this.#r.value=n,r}#o(e){const t={...Gi(void 0,this.#t),code:e,isFallback:!0};return this.#i.set(e,t),t}#d(e){if(!e)return;const t=Gi(e,this.#t);return this.#s.value=new Map([...this.#s.value,[e.code,t]]),t}}function tp({proposal:s,observability:e,shop:t,isOnePageCheckout:i}){const{billingAddressOption:r,paymentLines:n,billingAddress:a,shippingAddress:o,deliveryLines:d}=s.proposed;let l;return r.subscribe(c=>{const h=l===void 0&&c==="custom"&&t.sameBillingAndShippingAddress,b=l==="shipping"&&c==="custom";if(l=c,!h&&!b)return;const g={browser:vn().name,is_mobile:sp(),is_webview:ip(),is_one_page:i,defaults_to_shipping:t.sameBillingAndShippingAddress,payment_method_type:n.peek()[0]?.method.type??"none"};if(h){e.log("billing_address_initial_custom","Checkout initialized with custom billing despite shipping default",{...g,has_billing_address:qs(a.peek()),has_shipping_address:qs(o.peek()),delivery_methods:[...new Set(d.peek().flatMap(v=>v.peek().deliveryMethodTypes))].join(",")});return}e.counter({name:"billing_address_shipping_to_custom",value:1,attributes:g}),e.log("billing_address_shipping_to_custom","Billing address option switched from shipping to custom",g)})}function sp(s=navigator.userAgent){return/iPhone|iPad|iPod|Android/i.test(s)}function ip(s=navigator.userAgent){return typeof window<"u"&&"ReactNativeWebView"in window&&!!window.ReactNativeWebView||s.includes("wv")||/iPhone|iPod|iPad/i.test(s)&&s.includes("AppleWebKit")&&!s.includes("Safari")}class rp{constructor(){this.networkSelectionEnabled=u(!1),this.selectedNetwork=u(void 0),this.selectedSavedCreditCardBrand=u(void 0),this.bankIdNumberLength=u(0),this.#e=u([]),this.#t=u(void 0),this.selectableBrands=_(()=>this.selectedSavedCreditCardBrand.value?[]:this.#e.value),this.activeBrand=_(()=>{if(this.networkSelectionEnabled.value){const e=this.#e.value,t=e.length===1?e[0]:void 0;return this.selectedSavedCreditCardBrand.value??this.selectedNetwork.value??t}return this.selectedSavedCreditCardBrand.value??this.#t.value}),this.setSelectedNetwork=this.setSelectedNetwork.bind(this),this.setSelectedSavedCreditCardBrand=this.setSelectedSavedCreditCardBrand.bind(this),this.setDetectedState=this.setDetectedState.bind(this)}#e;#t;setSelectedNetwork(e){this.selectedNetwork.value=e||void 0}setSelectedSavedCreditCardBrand(e){this.selectedSavedCreditCardBrand.value=e}setDetectedState({networkSelectionEnabled:e,availableNetworks:t,cardBrand:i,numberFilled:r,bankIdNumberLength:n}){Xe(()=>{this.networkSelectionEnabled.value=e,this.#e.value=t,this.#t.value=i,this.bankIdNumberLength.value=n;const a=this.selectedNetwork.value;a&&(!e||!r||!t.includes(a))&&(this.selectedNetwork.value=void 0)})}}class np{#e=new Map;constructor(){this.forMethod=this.forMethod.bind(this)}forMethod(e){let t=this.#e.get(e);return t||(t=new rp,this.#e.set(e,t)),t}}class ap{constructor(){this.#e=u(!1),this.#t=u("idle"),this.isExiting=this.#e,this.progressPhase=this.#t}#e;#t;exit(){this.#e.value=!0}startRedirectProgress(){this.#t.peek()==="idle"&&(this.#t.value="visible")}cancelRedirectProgress(){this.#t.value="idle"}}function op(s){return{analytics:s.analyticsProcessingAllowed.value,marketing:s.marketingAllowed.value,preferences:s.preferencesProcessingAllowed.value,saleOfData:s.saleOfDataAllowed.value}}function dp(s){switch(s){case"STANDARD":case"STANDARD_RECOVERY":return"MERCHANT";case"PARTNER":return"PARTNER";default:return null}}function lp({config:s,isOnePageCheckout:e}){return e&&(!!(s?.schema&&s.version)||s?.variant==="STANDARD_RECOVERY")}function cp(s){return s?.variant==="STANDARD"||s?.variant==="STANDARD_RECOVERY"}class up{#e;constructor({serializations:e,config:t}){this.#e=e.get("checkoutLayout")==="one-page";const r=(!!(t&&t.schema)||t?.variant==="STANDARD_RECOVERY")&&t?t:{};this.config=r,this.variant=new hp({variant:r.variant??void 0})}get enabled(){return lp({config:this.config,isOnePageCheckout:this.#e})}}class hp{constructor({variant:e}){this.isStandard=()=>cp({variant:this.#e}),this.isPartner=()=>this.#e==="PARTNER",this.#e=e}#e;get value(){return this.#e}get recovery(){return this.#e==="STANDARD_RECOVERY"}}async function pp({serializations:s,observability:e,checkoutSdkConfig:t,checkoutSheetProtocolConfig:i}){const r=s.get("checkoutLayout")==="one-page";if(!mp(r,i))return;const n=Ko.has(i?.schema)?"CheckoutSheetProtocol":"MobileCheckoutSdk",a=n==="CheckoutSheetProtocol"?i?.type:gp(t),o={protocolType:n,configType:a,schemaVersion:i?.schema||t.schema,indexValue:`${n}-${a}
2`};e.addErrorMetadata("checkoutProtocol",o)}function mp(s,e){return s&&!!e}function gp(s){return dp(s.variant)}const $n=["countryCode","address1","city","zoneCode","postalCode"],fp=["countryCode","firstName","lastName","company","address1","address2","city","zoneCode","postalCode","phone","streetName","streetNumber","neighborhood","line2","district","subdistrict"],yp=["countryCode","firstName","lastName","company","address1","address2","city","zoneCode","postalCode","streetName","streetNumber","neighborhood","line2","district","subdistrict"];function vp(s){return{...s,isRequired:e=>$n.includes(e),isVisible:e=>fp.includes(e)}}function _p(s){return{...s,isRequired:e=>$n.includes(e),isVisible:e=>yp.includes(e)}}const Yn=["firstName","lastName","address1","city","countryCode"],jn=["phone"];function bp({baseSettings:s,shopPay:e}){return{...s,isRequired:(t,i)=>i?.useMerchantSettings?s.isRequired(t,i):t==="phone"&&e.session.isUnverifiedEnrollment.value&&!e.user.phoneNumber.value.trim()||Fi(t,e)?!0:Yn.includes(t),isVisible:(t,i)=>i?.useMerchantSettings?s.isVisible(t,i):Fi(t,e)?!1:jn.includes(t)||s.isVisible(t)}}function Sp(s){return{...s,isRequired:(e,t)=>t?.useMerchantSettings?s.isRequired(e,t):Yn.includes(e),isVisible:e=>jn.includes(e)||s.isVisible(e)}}function Ap({baseSettings:s,identity:e,shopPay:t}){return e.current.value==="businessCustomer"?vp(s):e.current.value==="shopPay"?bp({baseSettings:s,shopPay:t}):s}function Ep({baseSettings:s,identity:e}){return e.current.value==="businessCustomer"?_p(s):e.current.value==="shopPay"?Sp(s):s}class Pp{#e;#t;constructor({shop:e,requestInfoData:t,identity:i,shopPay:r}){if(t==null)throw new it("Request info data is missing",{groupingHash:"SettingsCreateError::RequestInfoDataMissing"});if(t.shop==null)throw new it("Request info data shop details are missing",{groupingHash:"SettingsCreateError::RequestInfoDataShopDetailsMissing"});const n=Xo({country:e.country,countrySpecific:e.countrySpecific,addressFormSettings:e.addressFormSettings,requestInfoData:t}),a={autocompleteEnabled:e.billingAddressFormSettings.addressAutocompletion,validationEnabled:!1,defaultShippingDetails:n.defaultShippingDetails,isVisible:l=>{const c=e.billingAddressFormSettings[l]?.mode;return c==null||c!=="IGNORED"},isRequired:l=>{const c=e.billingAddressFormSettings[l]?.mode;return c==null||c==="REQUIRED"}},o=Ap({baseSettings:n,identity:i,shopPay:r}),d=Ep({baseSettings:a,identity:i});this.#e=u(o),this.#t=u(d),this.nonBillingAddressSettings=this.#e,this.billingAddressSettings=this.#t}update(e){if("shopConfig"in e){if(e.shopConfig==null)throw new Cp("Shop data is missing",{groupingHash:"AddressSettingsUpdateError::ShopConfigMissing"});const t=e.shopConfig.shopConfigurations.defaultConfiguration.addressFormSettings.addressAutocompletion,i=e.shopConfig.billingAddressFormSettings.addressAutocompletion;t!=null&&this.#e.peek().autocompleteEnabled!==t&&(this.#e.value={...this.#e.value,autocompleteEnabled:t}),i!=null&&this.#t.peek().autocompleteEnabled!==i&&(this.#t.value={...this.#t.value,autocompleteEnabled:i})}else"autocompleteEnabled"in e&&this.#e.peek().autocompleteEnabled!==e.autocompleteEnabled&&(this.#e.value={...this.#e.value,autocompleteEnabled:e.autocompleteEnabled},this.#t.value={...this.#t.value,autocompleteEnabled:e.autocompleteEnabled})}}class Cp extends ve{constructor(){super(...arguments),this.name="AddressSettingsCreateError"}}function Tp(s){const e=s?.find(({clientHandle:t})=>t===oo)?.variant;return Object.values(Ws).find(t=>t===e)??Ws.Control}function kp(s){return Tp(s)===Ws.Treatment}const wp={typographyScale:{base:14},link:{typographyDecoration:"none"},cornerRadius:{small:4,base:6,large:12},optionList:{border:"full"}},Ip={header:{banner:void 0}},Rp={typographyScale:{base:14}},ye=new Pt(0,0,100),Mp=ye,De=new Pt(265.9,2.4,10.84),ae=new Pt(247.3,99.1,60.1,1),Ft=new Pt(265.9,1.26,28.9),Dp=new Pt(12.177050630061808,91.27499736580106,55.14831050892033),Cs={theme:{colors:{global:{},schemes:{scheme1:{base:{background:Mp}}}}},shell:{}},Ts={theme:{colors:{global:{info:ye,brand:ae,accent:ae,critical:Dp},schemes:{scheme1:{base:{accent:ae,background:De,border:Ft,custom:De,text:ye},control:{accent:ae,background:De,border:Ft,custom:De,text:ye,selected:{background:De,border:ae,accent:ae}},primaryButton:{background:ae,text:ye}},scheme2:{base:{accent:ae,background:De,border:Ft,custom:ae,icon:ye,text:ye},control:{accent:ae,background:De,border:Ft,custom:ae,icon:ye,text:ye,selected:{background:De,border:ae,accent:ae}},primaryButton:{background:ae,text:ye}}}}},shell:{}},yr={FIXED:"inline",INLINE:"inline",INLINE_SECONDARY:"inlineSecondary",START:"start"},Lp={INLINE:"inline",END:"end"}
2,ks={START:"start",CENTER:"center",END:"end"},Op={ICON:"icon",IMAGE:"image",TEXT:"text"},Qt={FULL:"full",NONE:"none"},pt={...Qt,BLOCK_END:"blockEnd"},_t={BASE:"base",DASHED:"dashed",DOTTED:"dotted"},bt={NONE:"none",BASE:"base",LARGE:"large100",LARGE_100:"large100",LARGE_200:"large200"},Np={NONE:"none",SMALL_200:"extraSmall",SMALL_100:"small",BASE:"base",LARGE_100:"large",LARGE_200:"extraLarge"},qt={TRANSPARENT:"transparent",BASE:"base",SUBDUED:"subdued"},Ce={BASE:"base",NONE:"none",SMALL:"small",LARGE:"large",ROUNDED:"fullyRounded"},Kn={BASE:"base",LOOSE:"loose",EXTRA_LOOSE:"xloose"},Xn={NONE:"none",TITLE:"title",UPPER:"upper",LOWER:"lower"},Bp={AUTO:"auto",STABLE:"stable"},le={NONE:"none",SMALL_500:"small500",SMALL_400:"small400",SMALL_300:"small300",SMALL_200:"small200",SMALL_100:"small100",SMALL:"small100",BASE:"base",LARGE:"large100",LARGE_100:"large100",LARGE_200:"large200",LARGE_300:"large300",LARGE_400:"large400",LARGE_500:"large500"},Ut={NONE:"none",EXTRA_TIGHT:"small400",TIGHT:"small200",BASE:"base",LOOSE:"large200",EXTRA_LOOSE:"large500"},Wt={EXTRA_SMALL:"extraSmall",SMALL:"small",BASE:"base",MEDIUM:"medium",LARGE:"large",EXTRA_LARGE:"extraLarge",EXTRA_EXTRA_LARGE:"extraExtraLarge"},Fp={PRIMARY:"primary",SECONDARY:"secondary"},zt={BASE:"base",BOLD:"bold"},vr={BASE:"base",SUBDUED:"subdued"},_r={BASE:"base",LARGE:void 0,SMALL:"small"},Up={INSIDE:"inside",OUTSIDE:"outside"},$e={VISIBLE:"visible",HIDDEN:"hidden"},xp={VISIBLE:"visible",HIDDEN:"hidden",DYNAMIC:"dynamic"},Vp={BASE:"base",SUBDUED:"subdued"},Hp={BASE:"base",CUSTOM:"custom"},Gp={START:"start",CENTER:"center",BASELINE:"baseline"},qp={ACCENT:"accent",BASE:"base"},Wp={COVER:"cover",CONTAIN:"contain"},zp={BASE:"base",HIGH:"high"},$p={INLINE:"inline",BLOCK:"block"},Yp={BASE:"base",SUBDUED:"subdued"},jp={BLOCK:"block",INLINE:"inline"},Kp={HIDDEN:"hidden",VISIBLE:"visible",VISIBLE_WHEN_MULTIPLE:"visibleWhenMultiple"},Xp={FIXED:"fixed",COLLAPSIBLE:"collapsible"},Qp={INLINE:"inline",INLINE_DESCRIPTION_LIST:"inlineDescriptionList",DESCRIPTION_LIST:"descriptionList"},Zp={COMMA:"comma",MIDDOT:"middot"},Jp={MONOCHROME:"monochrome",ACCENT:"accent",SUBDUED:"subdued"},br={BASE:"base",LARGE_100:"large-100"},em={AUTO:"auto",CUSTOM:"custom"},Sr={SMALL:"small",BASE:"base",LARGE:"large",LARGE_100:"large100",LARGE_200:"large200",LARGE_300:"large300"},tm="e_53fd82dc1f9722eff524544be73e81c5",sm="e_6d279941f0e9abf0f258b7dc3849503a",im="extracted_reductions_exp",rm="floating_summary_exp";function nm(s,e){return s.initialRequest.url.searchParams.get(im)||e.get("experiments")?.find(({clientHandle:i})=>i===tm)?.variant||""}var Ye=(s=>(s.Control="control",s.Treatment0A="treatment_0a",s.Treatment0B="treatment_0b",s.Treatment1="treatment_1",s.Treatment2="treatment_2",s.Treatment3="treatment_3",s))(Ye||{});function am(s,e){return(s.initialRequest.url.searchParams.get(rm)||e.get("experiments")?.find(({clientHandle:i})=>i===sm)?.variant)??""}const om=(s,e)=>({reductions:nm(s,e),floatingSummary:am(s,e)});function dm({serializedIsCheckoutEditor:s,sourceType:e}){return typeof s=="boolean"?s:e==="simulated"&&typeof window<"u"&&window!==window.parent&&!ni()}function lm({serializations:s,source:e}){return{isCheckoutEditor:dm({serializedIsCheckoutEditor:s.get("isCheckoutEditor"),sourceType:e.type}),isOnePageCheckout:s.get("checkoutLayout")==="one-page"}}class cm{constructor(e){this.#e=u({}),this.configurationSignal=this.#e,this.#e.value={...e},this.#t={...e}}#e;#t;get configuration(){return Zs(()=>this.#e.value)}get initialConfiguration(){return this.#t}set(e,t){this.#e.value={...this.#e.value,[e]:t}}reset(){this.#e.value={...this.#t}}replace(e){this.#e.value={...e}}}const Qn="https://cdn.shopify.com/static/fonts/gt-standard/v1",um=`${Qn}/GT-Standard-M-Standard-Regular-1790124696281.woff2`,hm=`${Qn}/GT-Standard-M-Standard-Semibold-1790124696281.woff2`,mt={name:"GT Standard",base:{weight:400,sources:`url(${um}) format('woff2')`},bold:{weight:600,sources:`url(${hm}) format('woff2')`}},Ar={fonts:mt.name,weightBase:`${mt.base.weight}`,sourceBase:mt.base.sources,weightBold:`${mt.bold.weight}`,sourceBold:mt.bold.sources};function pm({defaultShellConfig:s,orderSummaryPlacement:e="afterDetails",isThankYouPage:t=!1,...i}){const r=e==="beforeDetails",n=Gt(i),a={...n,typographyPrimary:Ar,typographySecondary:Ar,vaulted:{...n.vaulted,shadow:"none",padding:"none",cornerRadius:"none"},rollup:{...n.rollup,inlinePadding:"large200"},moneySummary:{...n.moneySummary,labelTypography:{size:"base",weight:"bold"}}},o=Zn(t),d=Ke(s,{main:{...o.main,spacing:"base"},orderSummary:{...r?{headerPosition:"TOP",defaultState:"COLLAPSED",thumbnailStyle:"fan",totalLabel:"TOTAL"}:{},totalDueTypography:{size:"base",weight:"bold"}},...r?{reductions:{position:"inside_order_summary",disclosureVisibility:"hidden"}}:{},footer:{...o.footer}});return{themeConfig:a,shellConfig:d}}function Zn(s){return{main:{padding:s?["none","large200"]:"none",section:{padding:s?void 0:["none","large200"]}},footer:{padding:s?"none":["none","large200"]}}}function S(s){return e=>e?s[e]:void 0}function ge(s){return{size:S(Wt)(s?.size),letterCase:S(Xn)(s?.letterCase),fonts:S(Fp)(s?.fonts),weight:S(zt)(s?.weight),kerning:S(Kn)(s?.kerning)}}function mm(s,e,t){return!e||t.colorScheme==="WEB_DEFAULT"?s:{customizations:{},designSystem:{}}}function ws(s){const{divider:e}=s??{};return{divider:{visibility:S($e)(e?.visibility),borderStyle:S(_t)(e?.borderStyle),borderWidth:S(bt)(e?.borderWidth)}}}function Er(s){const{divided:e}=s??{};return{...$t(s),divided:e??void 0}}function $t(s){const{background:e,border:t,borderStyle:i,borderWidth:r,cornerRadius:n,padding:a,shadow:o}=s??{};return{background:S(qt)(e),border:S(Qt)(t),borderStyle:S(_t)(i),borderWidth:S(bt)(r),cornerRadius:S(Ce)(n),padding:S(le)(a),shadow:S(Np)(o)}}function Is(s,e){const t=Ke(s,e);return t.rules=gm(s.rules??[],(e.rules??[]).filter(i=>i!=null)),t}function gm(s,e){const t=e.filter(n=>n!=null&&n.condition!=null),i=s.map(n=>{const a=t.find(o=>zs(o?.condition,n.condition));return a?Ke(n,a):n}),r=t.filter(n=>!s.some(a=>zs(a.condition,n?.condition)));return[...i,...r]}function Pr(s,{prefersDarkMode:e}){let t=s;for(const i of s.rules??[])if(i.condition?.prefersColorScheme==="dark"&&e){const{condition:r,...n}=i;t=Ke(t,n)}return t}function Cr(s,e,t,i=!1){const{blockPadding:r,inlinePadding:n}=s.rollup??{},a=o=>{const d=fm(o);return{blockPadding:r??d.blockPadding,inlinePadding:n??d.inlinePadding}};return{...s,rollup:{...s.rollup,inlinePadding:n??(t?void 0:"base"),cardPadding:a(e),...i&&{capPaddingOnMobile:i}},...s.vaulted?.padding!=null&&{vaulted:{...s.vaulted,rowPadding:a(s.vaulted.padding)}}}}function fm(s){let e,t;Array.isArray(s)?s.length===4?[e,,,t]=s:[e,t]=s:(e=s,t=s);const i=r=>r==null||r==="none"?"base":r;return{blockPadding:i(e),inlinePadding:i(t)}}class ym{constructor({themeData:e,shop:t,mobileCheckoutSdk:i,client:r,router:n,identity:a,shopPay:o,checkoutSheetProtocolConfig:d,embed:l,environment:c,seri
2alizations:h,observability:b,orderSummaryPlacement:g="afterDetails",isUniversalCheckoutFinalizer:v=!1}){this.#b={rollup:{},vaulted:{}},this.#_=(f,m)=>m.includes(this.#s[f]),this.previewRowPadding=(f,m=!1)=>{const A=this.shell.configuration.main.section?.padding,{rollup:I,vaulted:P}=Cr(Ke(m?{rollup:{},vaulted:{}}:this.#b,f),A,A!=null&&A!=="none");this.theme.set("rollup",{...this.theme.configuration.rollup,blockPadding:I.blockPadding,inlinePadding:I.inlinePadding,cardPadding:I.cardPadding}),this.theme.set("vaulted",{...this.theme.configuration.vaulted,rowPadding:P.rowPadding})},this.#t=g,this.#g=v,this.#e=h.get("checkoutLayout")==="one-page",this.#v=h.get("partnerBranding"),this.#i=i,this.#r=r,this.#n=n,this.#a=a,this.#o=o,this.#d=d??void 0,this.#f=l,this.#s=om(r,h),this.#y=c,this.#S=e,this.#l=t.hasFlagEnabled(Qo),this.#c=t.hasFlagEnabled(Zo),this.#h=!!h.get("embed")?.interstitialBrandingEnabled,this.#u=t.hasFlagEnabled(Jo),this.#m=kp(h.get("experiments")),this.#p=l?.isCheckoutKit({includeLegacyCsk:!1})??!1;const{themeConfig:E,shellConfig:y}=this.#R();if(this.shell=new cm(y),this.theme=new ed(E),this.#g&&Ne(l?.embedder)){let f=n.currentUrl.peek().normalizedPath==="/thank-you";se(()=>{const m=n.currentUrl.value.normalizedPath==="/thank-you";m!==f&&(f=m,Zs(()=>{const A=Zn(m),{main:I,footer:P}=this.shell.configuration;Xe(()=>{this.shell.set("main",{...I,...A.main,section:{...I.section,...A.main.section}}),this.shell.set("footer",{...P,...A.footer})})}))})}if(l?.embedder){const f=this.#v,m=!!f&&!this.#C();b.log("branding_decision","[Branding] embedded partner session branding inputs",{embedder:l.embedder,embedPlatformCategory:l.platformCategory??"none",embedColorScheme:l.ui?.colorScheme??"none",shopPayIsActive:a.current.value==="shopPay",shopPayIsShopServerOrigin:o.isShopServerOrigin,shopPayIsExternal:o.isExternal,shopPayUsingShopLayout:o.app.usingShopLayout.value,shouldForceEcpLightMode:this.#C(),interstitialBrandingEnabled:this.#h,partnerHasFrontendBranding:!!f,partnerOverlayApplied:m,initialUrlOrigin:r.initialRequest.url.origin,prefersDarkMode:this.prefersDarkMode})}let p=this.prefersDarkMode;se(()=>{if(p!==this.prefersDarkMode){const{themeConfig:f,shellConfig:m}=this.#R();this.theme.replace(f),this.#C()&&this.shell.replace(m),p=this.prefersDarkMode}})}#e;#t;#s;#i;#r;#n;#a;#o;#d;#l;#c;#h;#u;#m;#p;#g;#f;#y;#v;#S;#b;#_;#T(){const e=this.#_("floatingSummary",[Ye.Treatment0B]),t=this.#_("floatingSummary",[Ye.Treatment1,Ye.Treatment2,Ye.Treatment3]),i=this.#_("floatingSummary",[Ye.Treatment1,Ye.Treatment3]);return{announcement:{colorScheme:"scheme6",visibility:"hidden"},canvas:{},header:{position:this.#e?"start":"inline"},cartLink:{},disclosure:{style:t?"base":"legacy",visibility:i&&this.#e?"hidden-only-checkout":void 0},reductions:{position:"inside_order_summary",applyButtonPosition:this.#l?"base":"outside_field",discountTagsDisplay:"always_visible",automaticTagsDisplay:e?"visible":"hidden",spacing:"small100"},buyerJourney:{visibility:"visible",position:"inline"},content:{},expressCheckout:{},main:{},orderSummary:{colorScheme:"scheme2",mobile:{},collapsedSavingsDisplay:this.#l?"base":"total_savings",priceReductionAnimation:this.#l?"base":"none",floatingSummary:{visibility:i?"visible":"hidden"},thumbnailStyle:t?"base":"fan"},footer:{position:"inline",alignment:"start",content:{typography:this.#e?void 0:{size:"small"}}},environment:this.#y,payButton:{position:this.#l&&this.#e?"sticky":"inline",embeddedTotal:this.#l?"visible":"hidden"}}}#A(e,t){const{shared:i,divider:r,control:n,headingLevel1:a,headingLevel2:o,headingLevel3:d,headingLevel4:l,main:c,orderSummary:h,header:b,footer:g,textField:v,select:E,choiceList:y,checkbox:p,primaryButton:f,secondaryButton:m,rollup:A,lineItems:I,merchandiseThumbnail:P,vaulted:T,vaultedItem:R,icons:M}=e??{},k=I,O=A?.chevronCustomizations,{typography:w,cornerRadius:D}=t??{},G=$t(c?.section),U=td(G,["border","borderStyle","borderWidth","cornerRadius","background","shadow"]);return{icons:Object.fromEntries((M??[]).map(C=>[rd(C.name.toLowerCase()),C.url])),global:{cornerRadius:S(Ce)(i?.cornerRadius),typographyLetterCase:S(Xn)(i?.typography?.letterCase),typographyKerning:S(Kn)(i?.typography?.kerning)},cornerRadius:{small:D?.small??void 0,base:D?.base??void 0,large:D?.large??void 0},spacing:{},typographySize:{},typographyLineHeight:{},colors:{global:{success:i?.colors?.success??void 0,warning:i?.colors?.warning??void 0,critical:i?.colors?.critical??void 0,info:i?.colors?.info??void 0,brand:i?.colors?.button??void 0,accent:i?.colors?.accent??void 0,custom:i?.colors?.decorative??void 0,control:i?.colors?.control??void 0},schemes:sd.reduce((C,Y)=>({...C,[Y]:id(Y,{scheme1:c?.colors,scheme2:h?.colors,scheme3:b?.colors,scheme4:g?.colors,scheme5:c?.section?.colors,scheme7:h?.section?.colors})}),{})}
2,typographyScale:{base:w?.size?.base??void 0,ratio:w?.size?.ratio??void 0},typographyPrimary:qi(w?.primary??{}),typographySecondary:qi(w?.secondary??{}),headingLevel1:{typography:ge(a?.typography)},headingLevel2:{typography:ge(o?.typography)},headingLevel3:{typography:ge(d?.typography)},headingLevel4:{typography:ge(l?.typography)},divider:{borderStyle:S(_t)(r?.borderStyle),borderWidth:S(bt)(r?.borderWidth)},link:{},control:{border:S(Qt)(n?.border),cornerRadius:S(Ce)(n?.cornerRadius),labelPosition:S(Up)(n?.labelPosition)},textField:{typography:ge(v?.typography),border:S(pt)(v?.border)},select:{typography:ge(E?.typography),border:S(pt)(E?.border)},choiceList:{group:{spacing:S(le)(y?.group?.spacing)}},optionList:{},checkbox:{cornerRadius:S(Ce)(p?.cornerRadius)},lineItems:{quantityVisibility:S(Kp)(k?.quantityVisibility),priority:S(zp)(k?.priority),sectionLayout:S(Xp)(k?.sectionLayout),priceLayout:S($p)(k?.priceLayout),blockPadding:S(le)(k?.blockPadding),inlinePadding:S(le)(k?.inlinePadding),optionsColor:S(Yp)(k?.optionsColor),optionsFormat:S(Qp)(k?.optionsFormat),optionsSeparator:S(Zp)(k?.optionsSeparator),titleTypography:ge(k?.titleTypography),priceTypography:ge(k?.priceTypography),optionsTypography:ge(k?.optionsTypography)},moneyLines:{},moneySummary:{},rollup:{chevronCustomizations:{color:S(Jp)(O?.color),direction:S(jp)(O?.direction),size:S(br)(O?.size)},background:S(qt)(R?.background),blockPadding:S(le)(R?.blockPadding),blockAlignment:S(Gp)(R?.blockAlignment),inlinePadding:S(le)(R?.inlinePadding),border:S(pt)(R?.border),borderStyle:S(_t)(R?.borderStyle),borderWidth:S(bt)(R?.borderWidth),cornerRadius:S(Ce)(R?.cornerRadius),icon:{visibility:S($e)(R?.icon?.visibility),sizeClosed:S(Sr)(R?.icon?.sizeClosed),sizeOpen:S(Sr)(R?.icon?.sizeOpen)},label:{visibility:S(xp)(R?.label?.visibility),size:S(Wt)(R?.label?.size),color:S(vr)(A?.label?.color),weight:S(zt)(A?.label?.
2weight)},children:{blockPaddingEnd:S(le)(A?.children?.blockPaddingEnd),blockPaddingStart:S(le)(A?.children?.blockPaddingStart)},primaryContent:{typography:{size:S(Wt)(R?.primaryContent?.typography?.size),weight:S(zt)(R?.primaryContent?.typography?.weight),lineHeight:S(_r)(R?.primaryContent?.typography?.lineSize)}},secondaryContent:{typography:{size:S(Wt)(R?.secondaryContent?.typography?.size),color:S(vr)(R?.secondaryContent?.typography?.color),weight:S(zt)(R?.secondaryContent?.typography?.weight),lineHeight:S(_r)(R?.secondaryContent?.typography?.lineSize)}},action:{tone:S(em)(R?.action?.tone)}},modal:{},primaryButton:{border:S(pt)(f?.border),blockPadding:S(Ut)(f?.blockPadding2),inlinePadding:S(Ut)(f?.inlinePadding2),cornerRadius:S(Ce)(f?.cornerRadius),typography:ge(f?.typography)},secondaryButton:{border:S(pt)(f?.border),blockPadding:S(Ut)(m?.blockPadding2),inlinePadding:S(Ut)(m?.inlinePadding2),cornerRadius:S(Ce)(m?.cornerRadius),typography:ge(m?.typography)},formLayout:{},popover:{},merchandiseThumbnail:{background:S(Vp)(P?.background),border:S(Qt)(P?.border),cornerRadius:S(Ce)(P?.cornerRadius),fit:S(Wp)(P?.fit),borderColor:S(Hp)(P?.borderColor),badge:{background:S(qp)(P?.badge?.background)}},vaulted:{spacing:S(le)(T?.spacing),background:S(qt)(T?.background),padding:S(le)(T?.padding),...!this.#u&&!U&&{border:"full",borderStyle:"base",borderWidth:"base",cornerRadius:"large"},divider:{visibility:S($e)(T?.divider?.visibility),borderStyle:S(_t)(T?.divider?.borderStyle),borderWidth:S(bt)(T?.divider?.borderWidth)}}}}#k(e,t){const{header:i,main:r,expressCheckout:n,orderSummary:a,rollup:o,cartLink:d,buyerJourney:l,footer:c,content:h}=e??{},b=o?.chevronCustomizations?.size;return{announcement:t.announcement,environment:this.#y,canvas:{...t.canvas,scrollbarGutter:S(Bp)(r?.scrollbarGutter)},header:{...Er(i),colorScheme:"scheme3",position:i?.position?yr[i.position]:t.header.position,alignment:S(ks)(i?.alignment),banner:{image:i?.banner?.image?.main??void 0},logo:{visibility:S($e)(i?.logo?.visibility),image:i?.logo?.image?.main??void 0,maxWidth:i?.logo?.maxWidth??void 0,aspectRatio:i?.logo?.image?.width&&i?.logo?.image?.height?i.logo.image.width/i.logo.image.height:void 0,altText:i?.logo?.image?.altText},cartLink:{contentType:S(Op)(i?.cartLink?.contentType),image:{src:i?.cartLink?.image?.main??void 0}}},disclosure:t.disclosure,reductions:{position:this.#c&&this.#e&&a?.defaultState==="EXPANDED"?"base":t.reductions.position,applyButtonPosition:t.reductions.applyButtonPosition,discountTagsDisplay:t.reductions.discountTagsDisplay,automaticTagsDisplay:t.reductions.automaticTagsDisplay,spacing:t.reductions.spacing},buyerJourney:{position:t.buyerJourney.position,visibility:S($e)(l?.visibility)??t.buyerJourney.visibility,alignment:i?.position&&yr[i.position]==="inline"||t.header.position==="inline"?S(ks)(i?.alignment):void 0},content:{...ws(h)},cartLink:{visibility:S($e)(d?.visibility)},expressCheckout:{padding:S(le)(n?.padding),background:S(qt)(n?.background),button:{cornerRadius:S(Ce)(n?.button?.cornerRadius)}},main:{...ws(r),backgroundImage:r?.backgroundImage?.main??void 0,spacing:S(le)(r?.spacing),colorScheme:"scheme1",section:{...$t(r?.section),colorScheme:"scheme5"}},orderSummary:{...ws(a),backgroundImage:a?.backgroundImage?.main??void 0,colorScheme:"scheme2",section:{...$t(a?.section),colorScheme:"scheme7"},defaultState:this.#e?void 0:a?.defaultState,headerPosition:a?.headerPosition??void 0,currencyBadgeVisibility:a?.currencyBadgeVisibility??void 0,totalDueTypography:a?.totalDueTypography,chevronSize:S(br)(b),mobile:t.orderSummary.mobile,collapsedSavingsDisplay:t.orderSummary.collapsedSavingsDisplay,priceReductionAnimation:t.orderSummary.priceReductionAnimation,thumbnailStyle:t.orderSummary.thumbnailStyle,floatingSummary:t.orderSummary.floatingSummary},footer:{...Er(c),colorScheme:"scheme4",position:S(Lp)(c?.position)??t.footer.position,alignment:S(ks)(c?.alignment)??t.footer.alignment,content:{visibility:S($e)(c?.content?.visibility)}},payButton:t.payButton}}#w(e,t){let i;const r=this.#I();switch(r){case"LIGHT":i=Cs;break;case"DARK":i=Ts;break;case"AUTOMATIC":i=Cs;break;case"WEB_DEFAULT":i={theme:{},shell:{}};break;default:i=Cs;break}const n=r==="WEB_DEFAULT",a=n?Rp:wp,o=n?{}:Ip,d=r==="AUTOMATIC"&&this.prefersDarkMode?Ts.shell:i.shell,l=Ke(e,a,i.theme),c=Ke(t,o,d);return r!=="AUTOMATIC"?{theme:l,shell:c}:{theme:Is(l,{rules:[{condition:{prefersColorScheme:"dark"},...Ts.theme}]}),shell:c}}#E(){return this.#p&&this.#f?.ui?.branding==="APP"}#I(){return this.#E()?this.#f?.ui?.colorScheme??"AUTOMATIC":this.#i.config.colorScheme??void 0}#P(){return nd(this.#o)}#C(){return this.#a.current.value!=="shopPay"||Ne(this.#f?.embedder)?!1:this.#P()||!!this.#f}#M(){return this.#h||this.#C()}#D(){return this.#a.current.value!=="shopPay"||Ne(this.#f?.embedder)?!1:!this.#o.visibility.showCartLink}get prefersDarkMode(){if(this.#M())return!1;if(Ne(this.#f?.embedder))return this.#o.app.usingShopLayout.value?!!this.#o.app.config.darkMode:!1;let e;if(this.#i.config.colorScheme&&this.#i.variant.isStandard()&&this.#i.enabled&&(e=this.#i.config.colorScheme),this.#f?.ui?.colorScheme&&(!this.#p||this.#E())&&(e=this.#f.ui.c
2olorScheme),e){if(e==="DARK")return!0;if(e==="LIGHT")return!1;if(e==="AUTOMATIC"||e==="WEB_DEFAULT")return this.#r.prefersDarkMode.value}return this.#o.app.usingShopLayout.value?!!this.#o.app.config.darkMode:this.#r.prefersDarkMode.value}get isEmbeddedShopPayTheme(){return this.#C()}#R(){const e=this.#I(),t=this.#i.variant.isStandard()||this.#E(),{customizations:i,designSystem:r}=mm(this.#S,t,{...this.#i.config,colorScheme:e}),n=this.#T(),a=this.#k(i,n),o=this.#A(i,r),d=!t||e==="WEB_DEFAULT";for(const v of d?this.#S?.rules??[]:[]){const E=v.customizations?this.#k(v.customizations,a):a;if(v.customizations&&(a.rules=[...a.rules??[],{condition:{prefersColorScheme:v.condition.prefersColorScheme==="DARK"?"dark":void 0},...E,reductions:void 0}]),v.designSystem||v.customizations){const y=this.#A(v.customizations,v.designSystem);o.rules=[...o.rules??[],{condition:{prefersColorScheme:v.condition.prefersColorScheme==="DARK"?"dark":void 0},...y}]}}let l=o,c=a,h;if(t){const v={theme:o,shell:e==="WEB_DEFAULT"?a:n},E=this.#w(v.theme,v.shell);l=E.theme,c=E.shell}else if(this.#d)l=o;else if(Ne(this.#f?.embedder)){const{themeConfig:v,shellConfig:E}=pm({orderSummaryPlacement:this.#t,isThankYouPage:this.#g&&this.#n.currentUrl.value.normalizedPath==="/thank-you",darkMode:this.prefersDarkMode,fontScale:this.#o.app.usingShopLayout.value?this.#o.app.config.fontScale:1,defaultShellConfig:n});l=v,c=E}else if(this.#o.app.usingShopLayout.value)l=Gt({darkMode:this.prefersDarkMode,fontScale:this.#o.app.config.fontScale}),c={...n,environment:a.environment,..._n(this.#o.app.config)?{header:{...n.header,logo:{...n.header.logo,visibility:"hidden"}},cartLink:{...n.cartLink,visibility:"hidden"}}:{}};else if(ii(this.#o)){const{visibility:v}=this.#o;v.isOrderSummaryCollapsible||(c={...c,orderSummary:{...c.orderSummary,isCollapsible:!1,defaultState:"EXPANDED"}}),v.showDefaultShopTheme&&(l=Gt({darkMode:!1,fontScale:this.#o.app.config.fontScale}))}else this.isEmbeddedShopPayTheme?(l=Gt({darkMode:this.prefersDarkMode,fontScale:1,isEmbedded:!0}),h={cornerRadius:l.cornerRadius,primaryButton:l.primaryButton,secondaryButton:l.secondaryButton,merchandiseThumbnail:l.merchandiseThumbnail},c={...n,environment:a.environment}):l=o;if(this.#f?.embedder&&!this.#C()){const v=this.#v;v&&(l=Is(l,v.theme),c=Is(c,v.shell))}if(h&&(l={...l,cornerRadius:h.cornerRadius,primaryButton:{...l.primaryButton,cornerRadius:h.primaryButton?.cornerRadius},secondaryButton:{...l.secondaryButton,cornerRadius:h.secondaryButton?.cornerRadius},merchandiseThumbnail:{...l.merchandiseThumbnail,cornerRadius:h.merchandiseThumbnail?.cornerRadius??"small"}}),l=Pr(l,{prefersDarkMode:this.prefersDarkMode}),c=Pr(c,{prefersDarkMode:this.prefersDarkMode}),this.#M()){const v=E=>E?.filter(y=>y.condition?.prefersColorScheme!=="dark")??[];l={...l,rules:v(l.rules)},c={...c,rules:v(c.rules)}}this.#D()&&(c={...c,cartLink:{...c.cartLink,visibility:"hidden"}}),this.#m&&(l={...l,formLayout:{...l.formLayout,spacing:"none"}}),this.#b={rollup:l.rollup,vaulted:l.vaulted};const g=i?.main?.section?.padding;return{themeConfig:Cr(l,c.main.section?.padding,g!=null&&g!=="NONE",this.#u),shellConfig:c}}update(e){this.#S=e;const{themeConfig:t,shellConfig:i}=this.#R();this.theme.replace(t),this.shell.replace(i)}}const Be={ADDRESS:"fulfillment.address_change",PAYMENT_INSTRUMENTS:"payment.instruments_change",PAYMENT_CREDENTIAL:"payment.credential",WINDOW_OPEN:"window.open"};function Et(s,e){return s.includes(e)||s.includes(`ec.${e}`)}function vm(s){return Et(s,Be.PAYMENT_INSTRUMENTS)||Et(s,Be.PAYMENT_CREDENTIAL)}function _m({allowedDelegations:s,requestedDelegations:e,isUcpFlavoured:t}){if(t){const n=(a,o)=>Et(s,a)&&!!e?.includes(o);return{isAddressDelegationEnabled:n(Be.ADDRESS,"fulfillment.address_change"),isPaymentInstrumentsDelegationEnabled:n(Be.PAYMENT_INSTRUMENTS,"payment.instruments_change"),isPaymentCredentialDelegationEnabled:n(Be.PAYMENT_CREDENTIAL,"payment.credential"),isWindowOpenDelegationEnabled:n(Be.WINDOW_OPEN,"window.open")}}const i=Et(s,Be.ADDRESS),r=vm(s);return{isAddressDelegationEnabled:i,isPaymentInstrumentsDelegationEnabled:r,isPaymentCredentialDelegationEnabled:r,isWindowOpenDelegationEnabled:!1}}class bm{constructor({serializations:e,layout:t,proposal:i,source:r,themeData:n,shop:a,profile:o,appConfiguration:d,mobileCheckoutSdk:l,client:c,router:h,shopPay:b,checkoutSheetProtocolConfig:g,requestInfoData:v,renderContextToken:E,identity:y,embed:p,observability:f}){this.#e=new Map,this.#t=u(void 0),this.profileKey=_(()=>this.#t.value?.key),this.profile=_(()=>this.#t.value?.profile),this.profileId=_(()=>this.#t.value?.key.id),this.allowEmptyCart=!1,this.layout=t,this.visibility=new Am({proposal:i,source:r,appConfiguration:d,shop:a,shopPay:b,identity:y,layout:this.layout});const m=_m({allowedDelegations:d?.allowedDelegations??[],requestedDelegations:p?.delegations.requested?Array.from(p.delegations.requested):void 0,isUcpFlavoured:p?.protocol?.isUcpEcp??!1});this.isAddressDelegationEnabled=m.isAddressDelegationEnabled,this.isPaymentInstrumentsDelegationEnabled=m.isPaymentInstrumentsDelegationEnabled,this.isPaymentCredentialDelegationEnabled=m.isPaymentCredentialDelegationEnabled,this.isWindowOpenDelegationEnabled=m.isWindowOpenDelegationEnabled,this.isCvvBypassEnabled=!!d?.isCvvBypassEnabled;const A=Ne(p?.embedder);this.payButton={stickyPayButtonEnabledInWeb:!!d?.payButton?.stickyPayButtonEnabledInWeb,stickyPayButtonEnabledInMobile:!!d?.payButton?.stickyPayButtonEnabledInMobile,visibility:A?"HIDDEN":"VISIBLE"}
2,this.showPayButton=!A,this.showContactInformation=!A,this.showFooter=!A,this.#r(o,!1),this.#s=void 0;const I=lm({serializations:e,source:r});this.isUniversalCheckoutFinalizer=Ne(p?.embedder)&&c.initialRequest.url.searchParams.get(bn)===ad,this.deliveryMethodSelectorPlacement=this.isUniversalCheckoutFinalizer?"vaulted":"adjacent";const P=this.isUniversalCheckoutFinalizer?"beforeDetails":"afterDetails";this.branding=new ym({orderSummaryPlacement:P,isUniversalCheckoutFinalizer:this.isUniversalCheckoutFinalizer,serializations:e,themeData:n,shop:a,mobileCheckoutSdk:l,client:c,router:h,identity:y,shopPay:b,checkoutSheetProtocolConfig:g,embed:p,environment:I,observability:f}),this.addressSettings=new Pp({shop:a,requestInfoData:v,identity:y,shopPay:b}),this.renderContextToken=E,this.orderSummary=d?.orderSummary||P==="beforeDetails"?{layoutStyle:d?.orderSummary?.layoutStyle??"COMPACT",placement:P}:void 0,this.headerText={visibility:d?.headerText?.visibility??"HIDDEN"},this.#i=_(()=>y.current.value==="shopPay"?b.user.phoneNumber.value:void 0),this.defaultPhoneNumber=this.#i,this.trackAddressAutoComplete=y.current.value==="shopPay",this.allowRedirectToStorefront=p||l.enabled?!1:a.hasStorefront||!!a.externalDomain,this.hasExternalReceiptHandling=r.type==="shopPayExternal",this.hasExternalOrderNotifications=r.type==="shopPayExternal"}#e;#t;#s;#i;get deferredProfileChangeId(){return this.#s}getProfile(e){return this.#e.get(Us(Wi,e))}update(e){const{profile:t,requireBusinessCriticalOnly:i=!1,deferredProfileChangeId:r,themeData:n,addressSettings:a}=e;"profile"in e&&this.#r(t,i),"deferredProfileChangeId"in e&&(this.#s=r),n&&this.branding.update(n),a&&this.addressSettings.update(a)}#r(e,t){if(!e){this.#t.value=void 0;return}const i={id:e.id,requireBusinessCriticalOnly:t};this.#e.set(Us(Wi,i),e),this.#t.value={key:i,profile:e}}}function Sm(s){return!s.hideReductionsField}class Am{constructor({proposal:e,source:t,appConfiguration:i,shop:r,shopPay:n,identity:a,layout:o}){this.showAside=!0,this.showOrderSummaryMerchandiseLines=!0,this.showHeader=i?.shopHeader?.visibility!=="HIDDEN",this.showReductions=Sm(r);const d=i?.features?.isExpressCheckoutEnabled??!0;this.showExpressCheckout=_(()=>["shopPay","businessCustomer"].includes(a.current.value)||o?.isOnePage.value&&!["guest","customerAccount","sdkCartHints"].includes(a.current.value)?!1:d&&!e.negotiated.fields.buyerIdentity.value?.purchasingCompany&&!Qe(t)),this.showEmailMarketing=i?.features?.isEmailMarketingEnabled??!0,this.showSmsMarketing=i?.features?.isSmsMarketingEnabled??!0,this.showTips=i?.features?.isTipsEnabled??!0,this.showCashRedemption=_(()=>a.current.value==="shopPay"&&i?.shopCash?.visibility!=="HIDDEN"),this.showDataSharingOptOut=_(()=>a.current.value==="shopPay"),this.showDeliveryHeading=_(()=>a.current.value==="guest"),this.showPurchaseOrderNumberField=_(()=>a.current.value==="businessCustomer"),this.showStandalonePhoneField=_(()=>a.current.value==="shopPay"&&!n.user.isAuthenticatedUser.value),this.showShippingLines=_(()=>{const c=(e.facts.delivery?.some(({deliveryAddress:g,pickupAddress:v})=>v!==null||g!==null)??!0)||e.negotiated.fields.isShippingRequired.value,h=e.negotiated.fields.deliveryNext.value,b=!!(h&&h.status==="filled"&&h.lines.some(({status:g})=>g!=="not_required"));return!!(c||b)}),this.showSubtotal=_(()=>{const{discountLines:l,paymentLines:c,taxes:h,tipLines:b,dutiesIncluded:g,legacyRepresentProductsAsFees:v,legacyMerchandiseLinesAsFees:E}=e.negotiated.fields,y=!!l.value?.lines.length,p=!!c.value?.lines.some(O=>O.method.type==="giftCard"),f=!!c.value?.lines.some(O=>O.method.type==="redeemable"&&O.method.redemptionSource==="CUSTOM"&&O.cost&&O.cost.amount>0&&O.method.redemptionContent),m=e.facts.tax?e.facts.tax:h.value?.status==="available_total_included"?h.value.totalIncludedInTarget:h.value?.status==="available_total"?h.value.totalTax:null,A=(()=>{const O=h.value?.status;if(O==="pending"||O==="unavailable"){const w=!!e.negotiated.fields.merchandiseLines.value?.taxesIncluded,D=e.facts.taxesIncluded??!1;return w||D}return O==="available_total_included"})(),I=!g.value&&!A&&!!(m&&m.amount!==0),P=Qe(t),T=P?e.facts.tip:b.value?.[0]?.amount,R=T&&T.amount>0,M=!!(v.value&&E.value&&E.value.lines.length>
20),k=!!c.value?.lines.some(O=>O.method.type==="redeemable"&&(O.method.redemptionSource==="STORE_CREDIT"||O.method.redemptionSource==="SHOP_CASH"));return!!(this.showShippingLines.value||y||p||f||I||k||R||P||M)}),this.showStoreCreditRedemption=_(()=>a.current.value==="shopPay"||a.current.value==="customerAccount"||a.current.value==="businessCustomer"),this.showOwnedGiftCards=_(()=>a.current.value==="shopPay"||a.current.value==="customerAccount"),this.showShopCashRewardsBanner=_(()=>a.current.value==="shopPay"&&i?.shopCash?.visibility!=="HIDDEN"),this.showInvalidDeliveryAddressBanner=_(()=>a.current.value==="shopPay"||a.current.value==="customerAccount")}}class Em{constructor({proposal:e}){this.search=Sn({items:_(()=>dd(e.negotiated.fields.customFields.value??[])),getTarget:od})}}function Pm(s){return s.some(({target:e,placementReference:t})=>!!(e&&zi(e)===zi("purchase.checkout.block.render")&&t&&ld.includes(t)))}function Jn({extensionPoint:s,placementReference:e}){return An(s)?e:void 0}function ea(s){return s?{desktop:s.desktop?{height:s.desktop.height}:null,mobile:s.mobile?{height:s.mobile.height}:null}:void 0}function Tr({activatedExtensions:s,source:e,observability:t}){return e?.type==="simulated"?[]:s.reduce((i,{extension:r,targets:n,id:a,settings:o,behaviors:d,publicIdentifier:l})=>{const c=n.flatMap(({target:h,placementReference:b,extensionSkeletons:g,position:v,publicIdentifier:E})=>{if(!cd(h))return[];const y=r.preloads;t&&e&&ta({extension:r,extensionPoint:h,placementReference:b,observability:t,source:e,type:"persisted"});const p={target:h,metafields:r.metafieldRequests??[]};if(y.length)try{const f=ud({extension:r,extensionPoint:h});f&&(p.preloads=f)}catch{t&&e&&km({extension:r,extensionPoint:h,observability:t,source:e,type:"persisted"})}return{id:E,activatedExtensionId:Je(a),configuration:u(JSON.parse(o??"{}")),behaviors:u({alwaysReveal:d.alwaysReveal,showInExpressCheckout:d.showInExpressCheckout,blockProgress:d.blockProgress}),type:"persisted",publicIdentifier:l,position:u(v),targetPublicIdentifier:E,extensionId:r.uuid,registrationId:r.registrationUuid,apiVersion:r.apiVersion,version:r.version??"unstable",scriptUrl:r.scriptUrl,translations:JSON.parse(r.translations),extensionPoint:p,name:r.name,extensionLocale:r.extensionLocale,appId:r.appId,appApiKey:r.apiKey??null,appName:r.appName,placementReference:Jn({extensionPoint:h,placementReference:b}),approvalScopes:new Set(r.approvalScopes.map(({handle:f})=>f)),capabilities:{apiAccess:r.capabilities.apiAccess,networkAccess:r.capabilities.networkAccess,blockProgress:r.capabilities.blockProgress,collectBuyerConsent:{smsMarketing:!!r.capabilities.collectBuyerConsent?.smsMarketing,customerPrivacy:!!r.capabilities.collectBuyerConsent?.customerPrivacy}},extensionSkeletons:ea(g)}});return[...i,...c]},[])}function Cm({globalExtension:{extension:s,publicIdentifier:e,extensionSkeletons:t},extensionPoint:i,placementReference:r,observability:n,source:a}){return n&&a&&ta({extension:s,extensionPoint:i,placementReference:r,observability:n,source:a,type:"global"}),{apiVersion:s.apiVersion,appId:s.appId,appApiKey:s.apiKey??null,appName:s.appName,approvalScopes:new Set(s.approvalScopes.map(({handle:o})=>o)),extensionId:s.uuid,extensionLocale:s.extensionLocale,extensionPoint:{target:i,metafields:s.metafieldRequests??[]},id:e,publicIdentifier:e,registrationId:s.registrationUuid,scriptUrl:s.scriptUrl,translations:JSON.parse(s.translations),placementReference:Jn({extensionPoint:i,placementReference:r}),name:s.name,version:s.version,capabilities:{apiAccess:s.capabilities.apiAccess,networkAccess:s.capabilities.networkAccess,blockProgress:s.capabilities.blockProgress,collectBuyerConsent:{smsMarketing:!!s.capabilities.collectBuyerConsent?.smsMarketing,customerPrivacy:!!s.capabilities.collectBuyerConsent?.customerPrivacy}},extensionSkeletons:ea(t)}}function Tm({globalExtensions:s,observability:e,source:t}){return s.map(i=>{const{target:r,placementReference:n}=i;return{...Cm({globalExtension:i,extensionPoint:r,placementReference:n??void 0,observability:e,source:t}),type:"global",configuration:u({}),behaviors:u({alwaysReveal:i.behaviors.alwaysReveal,showInExpressCheckout:i.behaviors.showInExpressCheckout,blockProgress:i.behaviors.blockProgress})}})}function km({extension:s,extensionPoint:e,observability:t,source:i,type:r}){t.error(new pd(`${r.charAt(0).toUpperCase()}${r.slice(1)} extension ${s.uuid} could not parse preload url`),{severity:"error",metadata:{extension:{apiVersion:s.apiVersion,appId:s.appId,appApiKey:s.apiKey??null,appName:s.appName,id:s.uuid,extensionPoint:e,name:s.name,placementReference:void 0,type:r,version:s.version},source:{type:i.type}}})}function ta({extension:s,extensionPoint:e,placementReference:t,observability:i,source:r,type:n}){An(e)&&!t&&i.error(new hd(`${n.charAt(0).toUpperCase()}${n.slice(1)} extension ${s.uuid} have no placement reference defined, this extension will not be rendered`),{severity:"error",metadata:{extension:{apiVersion:s.apiVersion,appId:s.appId,appApiKey:s.apiKey??null,appName:s.appName,id:s.uuid,extensionPoint:e,name:s.name,placementReference:void 0,type:n,version:s.version},source:{type:r.type}}})}function sa({proposal:s,serializedReceipt:e,source:t}){const i=s.negotiated.fields.buyerIdentity.value,r=i?.purchasingCompany?.location.id,n=i?.customerProfile?.id??Im(e?.purchaseOrder?.buyerIdentity),a=i?.countryCode??Rm(e?.purchaseOrder?.buyerIdentity)??void 0,o=r&&(t.type==="draftOrder"||t.type==="orderEdit"||t.type==="paymentCollection")?t.sourceVersion:void 0;return{id:t.sourceId,...r&&{companyLocationId:r},...n!==void 0&&{customerProfileId:n},...!r&&a&&{countryCode:a},...o&&{version:o}}}function wm({persistence:s,proposal:e,serializedReceipt:t,source:i}){const r=s?.get(fe.Metafields,{scope:sa({proposal:e,serializedReceipt:t,source:i})});return r?r.map(({key:n,namespace:a,value:o,valueType:d,appId:l})=>({key:n,namespace:a,value:o,valueType:d,appId:l})):[]}function ob({metafields:s,persistence:e,proposal:t,serializedReceipt:i,source:r}){e&&s.subscribe(n=>{e.createUpdate(fe.Metafields,{scope:sa({proposal:t,serializedReceipt:i,source:r})})(n)})}function Im(s){const e=s?.customer;if(e==null)return null;switch(e.__typename){case"GuestProfile":return null;case"BusinessCustomerProfile":case"DecodedCustomerProfile":return e.id??null;default:ia(e)}}function Rm(s){const e=s?.customer;if(e==null)return null;switch(e.__typename){case"GuestProfile":case"BusinessCustomerProfile":case"DecodedCustomerProfile":return e.countryCode??null;default:ia(e)}}
2class Mm extends Error{constructor(){super(...arguments),this.name="TypescriptAssertionError"}}function ia(s){throw new Mm(`Received unexpected value ${JSON.stringify(s)} in an exhaustive switch/conditional block`)}const Dm=new Set;class Rs extends ve{constructor(){super(...arguments),this.name="ExtensibilityEngineNotLoadedError"}}class Lm extends ve{constructor(){super(...arguments),this.name="ExtensibilityEngineLoadError"}}class Om{constructor(e){this.ui=new Nm(e),this.customFields=new Em({proposal:e.proposal})}}class Nm{constructor(e){this.#a=u(!1),this.#o=md(),this.#h=!1,this.#g=new Promise(h=>{this.#p=h}),this.ensureEngineLoaded=()=>this.required.value?this.#y():Promise.resolve();const{events:t,activatedExtensions:i,source:r,observability:n,shop:a,identity:o,proposal:d,isCheckoutEditor:l}=e;this.#l=e,this.#c=i,this.#e=o,this.#t=r,this.#s=n,this.#i=l;const c=[...Tm({globalExtensions:a.globalUIExtensions,source:r,observability:n}),...Tr({activatedExtensions:i,source:r,observability:n})];this.#r=u(c),this.#n=_(()=>fd(this.#r.value,{identity:this.#e})),this.hasAtRiskPlacement=_(()=>Pm(this.#n.value.map(h=>({target:h.extensionPoint.target,placementReference:h.placementReference})))),this.search=Sn({items:this.#n,getTarget:$i}),this.#d=u(wm({persistence:e.persistence,proposal:d,serializedReceipt:e.serializedReceipt,source:e.source})),this.metafields=this.#d,this.required=_(()=>yd({isCheckoutEditor:l,filteredExtensions:this.#n.value,shop:a,proposal:d})),this.enabled=this.#a,t.addEventListener("bootloader:hydrate-start",()=>{const h=se(()=>{this.required.value&&this.#y().then(()=>{this.#a.value&&h()}).catch(()=>{})})}),t.addEventListener("bootloader:hydrate-end",()=>{this.#p()}),this.#f(c)}#e;#t;#s;#i;#r;#n;#a;#o;#d;#l;#c;#h;#u;#m;#p;#g;unstable_isTargetMatch(e,t){return this.#o($i(e),t)}#f(e){const{configuration:t,eagerlyLoadAppMetafields:i,graphql:r,proposal:n}=this.#l;if(!i)return;const a=new Set(e.filter(o=>o.extensionPoint.metafields?.length).map(o=>o.id));a.size!==0&&se(()=>{if(this.#h)return;const o=vu(n.negotiated);o.length===0||!this.#n.value.some(l=>a.has(l.id))||(this.#h=!0,Promise.resolve(_u({coreGraphql:r,resourceIds:o,checkoutProfileId:t.profileId.value})).catch(()=>{}))})}#y(){if(this.#m)return this.#m;const e=(async()=>{try{const{UIExtensibilityBrowserEngine:t}=await ts(()=>L(()=>import("./extensibility-browser-engine.adf3by2U.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])));this.#u=new t({options:this.#l,activatedExtensions:this.#c,isCheckoutEditor:this.#i,extensions:this.#r,metafields:this.#d,afterHydrate:this.#g}),this.#a.value=!0}catch(t){this.#m=void 0,this.#v(t)}})();return this.#m=e,e}#v(e){const t=e instanceof Error?e:new Lm(String(e));this.#s.error(t,{severity:"error",metadata:{extensibility:{extensionCount:this.#n.value.length,isCheckoutEditor:this.#i}}}),this.#s.log("extensibility_engine_load_failed","The UI-extensibility engine chunk failed to load; no extension will render for this checkout",{extensionCount:this.#n.value.length,isCheckoutEditor:this.#i})}unstable_registerExtensionsManager(e){if(!this.#u)throw new Rs("extensions manager registered before the engine loaded");this.#u.registerExtensionsManager(e)}hasBlockingExtensionForFeatures({features:e,deactivatedExtensionIds:t=Dm,placementReferences:i,excludedExtensionTargets:r}){return gd({features:e,extensions:this.search().value,deactivatedExtensionIds:t,placementReferences:i,sourceType:this.#t.type,excludedExtensionTargets:r})}add(e){this.#r.value.some(i=>i.id===e.id)||(this.#u?.syncPermissions([e]),this.#r.value=[...this.#r.value,e])}remove(e,t){const i=this.#r.value.filter(r=>e.includes(r.id));this.#u?.removePermissions(i),this.#r.value=this.#r.value.filter(r=>!i.includes(r)),t?.keepAlive||this.#u?.destroyExtensions(i,t.reason)}replace({activatedExtensions:e},t){const i=[],r=new Map(Tr({activatedExtensions:e,source:this.#t,observability:this.#s}).map(o=>[o.targetPublicIdentifier,o])),a=[...this.#r.value.map(o=>{if(o.type!=="persisted")return o;const d=r.get(o.targetPublicIdentifier);return d?(o.configuration.value=d.configuration.peek(),d.configuration=o.configuration,o.behaviors.value=d.behaviors.peek(),d.behaviors=o.behaviors,o.position.value=d.position.peek(),d.position=o.position,r.delete(d.targetPublicIdentifier),d):(i.push(o),null)}).filter(o=>o!==null),...Array.from(r.values())];this.#u?.removePermissions(i),this.#u?.syncPermissions(a),this.#c=e,this.#r.value=a,t?.keepAlive||this.#u?.destroyExtensions(i,t.reason),this.#u?.refreshStorefrontTokens(e)}get sandboxCache(){if(!this.#u)throw new Rs("sandboxCache read before the engine loaded");return this.#u.sandboxCache}get storefrontTokens(){if(!this.#u)throw new Rs("storefrontTokens read before the engine loaded");return this.#u.storefrontTokens}updateMetafields(e){this.#d.value=e}}class Bm{#e;#t;#s;#i;#r;#n;#a;#o;#d;constructor({observability:e,wallets:t,protocols:i,shop:r,proposal:n}){this.#t=e,this.#s=n.negotiated.fields.buyerIdentity,this.#i=t.shopPayIsActive,this.#o=t.escalatedWalletSignal,this.#r=i.isEmbedded,this.#n=i.isEmbeddedPartner,this.#a=i.mobileCheckoutSdk.enabled&&i.mobileCheckoutSdk.variant.isStandard();const a=r.contactInfoOptions.includes("PHONE");this.customerContactMethodPrefilled=!!(n.proposed.email.peek()||a&&n.proposed.phone.peek()),this.#e=_(()=>this.#l()),this.current=this.#e}initialize(){this.#d?.(),this.#d=se(()=>{this.#t.addAttributesForLogs({identity:this.#e.value}),this.#t.addErrorMetadata("identity",{value:this.#e.value})})}dispose(){this.#d?.(),this.#d=void 0}#l(){if(this.#i)return"shopPay";const e=this.#o.value;if(e)return vd(e);if(this.#n)return"sdkCartHints";const t=this.#s.value?.customerProfile?.__typename;return t==="CustomerProfile"?"customerAccount":t==="BusinessCustomerProfile"?"businessCustomer":(this.#r||this.#a)&&this.customerContactMethodPrefilled?"sdkCartHints":jt}}
2function Fm({creditCards:s,phoneCountryCode:e,vaultedAddresses:t,supportedCountries:i}){return[e,...t.map(n=>n.address.countryCode),...s.map(n=>n.billingAddress.address.countryCode)].filter(n=>!!n).some(n=>i.includes(n))}function Um(s,e){return s.cbtEnabled?!e||!s.supportedCountries.includes(e)||!s.creditCardEnabledCountries.includes(e):s.supportedCountries.every(t=>!s.creditCardEnabledCountries.includes(t))}const xm=4,kr=3;function Vm({config:s,paymentDue:e,financingPlans:t,isInstallmentsSelected:i,buyerCountryCode:r}){const n=s.cbtEnabled?s.financingPlans.filter(y=>y.minPrice.currencyCode===e.currencyCode&&y.maxPrice.currencyCode===e.currencyCode):t,a=n.reduce((y,p)=>{const{minPrice:f,terms:m}=p;return m.some(({loanType:I})=>I==="SPLIT_PAY")||e.currencyCode==="GBP"?Math.min(y,parseFloat(f.amount)):y},Number.MAX_SAFE_INTEGER),o=n.reduce((y,p)=>{const{minPrice:f,maxPrice:m,terms:A}=p,I=parseFloat(f.amount),P=parseFloat(m.amount),T=Math.max(e.amount,a);return T>=I&&T<=P?y.concat(e.currencyCode==="GBP"?A:A.filter(({loanType:R})=>R==="SPLIT_PAY")):y},[]),d=e.currencyCode==="GBP"?kr:xm,l=o.length?o.reduce((y,p)=>p.installmentsCount>y.installmentsCount?p:y,o[0]):void 0,c=l?.installmentsCount??d,h=i&&_d(s.availableLoanTypes),b=i&&Um(s,r),g=h||b,v=l?bd(l,{buyerCountryCode:r,currencyCode:e.currencyCode}):c;return{config:s,chargeAmount:(()=>{switch(e.currencyCode){case"GBP":{if(r&&r!=="GB")return Number(e.amount/v);const y=o.some(({loanType:f,apr:m})=>f==="INTEREST"&&m===0),p=s.availableLoanTypes.length===3;return Number(y&&!p?e.amount/c:e.amount/kr)}default:return Number(e.amount/v)}})(),numberOfPaymentTerms:v,paymentMethodMustSupportInterestBearingLoans:h,paymentMethodMustSupportDebitCardOnly:g,sellerCountryRequiresDebitCardOnly:b}}function Zt(s){return s.negotiated.fields.paymentMethods.value?.find(t=>t.type==="wallet"&&t.name==="SHOPIFY_INSTALLMENTS")}function Hm(s,e){const t=Sd(e.popularBillingCountries,e.billingCountries)??[];return s.supportedCountries.flatMap(i=>t.find(({value:n})=>n===i)||[])}function Gm({sourceType:s,hasGiftCard:e,config:t,totalAmount:i,currencyCode:r,pickupAddress:n,isPointOfSale:a,hasSubscription:o,shippingAddress:d,shippingRequired:l,isPickupDeliveryMethod:c,selectedShippingAddress:h,hasInvalidShippingAddress:b,credentialCountryMismatch:g,billingAddressUnsupported:v,billingShippingCountryMismatch:E}){const y=[],p=l&&c,f=l&&!a&&!c,m=p&&(!n||Es(n,t)),A=qs(d)&&b,I=!!d.countryCode&&Es(d,t),P=f&&d&&!h&&(A||I),T=f&&h&&(b||Es(h.address,t));return(m||P||T)&&y.push("shipping_address"),(i<t.minPrice.amount||i>t.maxPrice.amount||t.cbtEnabled&&t.availableLoanTypes.length===0)&&y.push("amount"),(!t.supportedCurrencies.includes(r)||t.cbtEnabled&&(t.minPrice.currencyCode!==r||t.maxPrice.currencyCode!==r))&&y.push("currency"),t.giftCardsNotAllowed&&e&&y.push("gift_cards"),t.subscriptionItemsNotAllowed&&o&&y.push("subscriptions"),Qe(s)&&y.push("order_edit"),t.ineligibleTestModeCheckout&&y.push("test_mode"),t.ineligibleLineItem&&y.push("ineligible_line_item"),g&&y.push("credential_country_mismatch"),v&&y.push("billing_address"),E&&y.push("billing_shipping_country_mismatch"),y}function qm({isSupported:s,proposal:e,financingPlans:t,isInstallmentsSelected:i}){const r=_(()=>{if(!s.value||!e||!t||!i)return;const n=Zt(e),a=e.negotiated.fields.paymentDue.value;if(!(!n||!a))return Vm({config:n,paymentDue:a,financingPlans:t.value,isInstallmentsSelected:i.value,buyerCountryCode:e.negotiated.fields.buyerIdentity.value?.countryCode})});return{config:_(()=>r.value?.config),chargeAmount:_(()=>r.value?.chargeAmount),numberOfPaymentTerms:_(()=>r.value?.numberOfPaymentTerms),paymentMethodMustSupportInterestBearingLoans:_(()=>r.value?.paymentMethodMustSupportInterestBearingLoans??!1),paymentMethodMustSupportDebitCardOnly:_(()=>r.value?.paymentMethodMustSupportDebitCardOnly??!1),sellerCountryRequiresDebitCardOnly:_(()=>r.value?.sellerCountryRequiresDebitCardOnly??!1)}}function Wm({isSupported:s,hasInvalidShippingAddress:e,proposal:t,source:i,shopPay:r}){return _(()=>{if(!s.value)return[];const n=Zt(t);if(!n)return[];const a=t.negotiated.fields.paymentDue.value;if(!a||a.amount===0)return[];const o=t.negotiated.fields,d=o.merchandiseLines.value,l=ss(d?.lines),c=l.some(w=>
2"giftCard"in w&&w.giftCard),h=l.some(w=>!!("sellingPlan"in w&&w.sellingPlan?.subscriptionDetails)),b=si(t),g=o.customAttributes.value,v=Ad(g),E=o.deliveryNext.value,y=Ed(E,"ONE_TIME_PURCHASE",!0),p=Pd(y),f=p?["PICK_UP","PICKUP_POINT","RETAIL"].includes(p.methodType):!1,m=p?.pickupLocation?.address,A=t.proposed.shippingAddress.value,I=r.session.selectedShippingAddress.value,P=b&&!v&&!f;let T;P&&(T=I?I.address.countryCode:A?.countryCode);const R=ra(r),M=f?m?.countryCode:T,k=!!(n.cbtEnabled&&R&&!n.supportedCountries.includes(R)),O=!!(n.cbtEnabled&&b&&!v&&R&&(!M||R!==M));return Gm({sourceType:i.type,hasGiftCard:c,config:n,totalAmount:Number(a.amount),currencyCode:a.currencyCode,pickupAddress:m,isPointOfSale:v,hasSubscription:h,shippingAddress:A,shippingRequired:b,isPickupDeliveryMethod:f,selectedShippingAddress:I,hasInvalidShippingAddress:e.value,credentialCountryMismatch:zm({shopPay:r,shippingCountry:T}),billingAddressUnsupported:k,billingShippingCountryMismatch:O})})}function zm({shopPay:s,shippingCountry:e}){const t=s.user.installments.credential.value?.countryCode;if(!t)return!1;const i=ra(s);return!!(e&&t!==e)||!!(i&&t!==i)}function ra(s){const e=s.session.selectedPaymentMethod.value;if(e)return rt(e)?e.paymentAttributes.billingAddress.address.countryCode:s.session.selectedBillingAddress.value?.address.countryCode}class $m{#e=u(!1);constructor({proposal:e,source:t,shop:i,shopPay:r,identity:n}){this.isSupportedDetails=_(()=>{if(n.current.value!=="shopPay")return{supported:!1,failedGate:"identity"};const o=Zt(e);if(!o)return{supported:!1,failedGate:"config"};if(!this.#t(e))return{supported:!1,failedGate:"paymentDue"};const d=o.supportedCountries??[],l=Fm({creditCards:r.user.creditCards.value,phoneCountryCode:r.user.phoneCountryCode.value,vaultedAddresses:r.user.addresses.value,supportedCountries:d}),c=r.user.isNew.value,h=r.user.addresses.value.length===0,b=!r.user.hasCreditCards.value,g=c||h||b||l;return{supported:g,failedGate:g?null:"buyerCountry"}}),this.isSupported=_(()=>this.isSupportedDetails.value.supported),this.supportedCountryOptions=_(()=>{if(n.current.value!=="shopPay")return[];const o=Zt(e);return o?Hm(o,i):[]}),this.ineligibilityReasons=Wm({isSupported:this.isSupported,hasInvalidShippingAddress:this.#e,proposal:e,source:t,shopPay:r}),this.isCheckoutEligible=_(()=>this.isSupported.value&&this.ineligibilityReasons.value.length===0),this.isUnavailable=_(()=>!this.isCheckoutEligible.value||r.user.installments.isRejected.value);const a=qm({isSupported:this.isSupported,proposal:e,financingPlans:r.installmentsFinancingPlans,isInstallmentsSelected:r.session.isInstallmentsSelected});this.config=a.config,this.chargeAmount=a.chargeAmount,this.numberOfPaymentTerms=a.numberOfPaymentTerms,this.paymentMethodMustSupportInterestBearingLoans=a.paymentMethodMustSupportInterestBearingLoans,this.paymentMethodMustSupportDebitCardOnly=a.paymentMethodMustSupportDebitCardOnly,this.sellerCountryRequiresDebitCardOnly=a.sellerCountryRequiresDebitCardOnly}unstable_setHasInvalidShippingAddress(e){this.#e.value=e}#t(e){const t=e.negotiated.fields.paymentDue.value;return!!(t&&t.amount!==0)}}class Ym{#e;get baseName(){return this.#e}constructor({serializations:e,isCheckoutLayoutForcedToOnePage:t=u(!!e.get("forcedRedesignWallet"))}){this.#e=e.get("forcedRedesignWallet")?"three-page":e.get("checkoutLayout"),this.isOnePage=_(()=>t.value||this.#e==="one-page")}}class xt extends Error{constructor(){super(...arguments),this.name="OffsitePopupError"}}function jm(s,e){return`
3<html>
4  <head>
5    <title>${e}</title>
6    <style>
7      @keyframes rotate {
8        0% { transform: rotate(0); }
9        100% { transform: rotate(360deg); }
10      }
11
12      @keyframes fadeIn {
13        0% { opacity: 0; }
14        100% { opacity: 1; }
15      }
16
17      body {
18        margin: 0;
19        padding: 0;
20        background-color: hsl(0, 0%, 100%);
21        display: flex;
22        flex-direction: column;
23        justify-content: center;
24        align-items: center;
25        height: 100vh;
26        height: 100dvh;
27      }
28
29      .spinner-container {
30        display: flex;
31        justify-content: center;
32        align-items: center;
33        max-width: 64px;
34        max-height: 64px;
35        width: 100%;
36        height: 100%;
37      }
38
39      .spinner {
40        display: block;
41        inline-size: 100%;
42        max-inline-size: 100%;
43        max-block-size: 100%;
44        animation: fadeIn 500ms ease-in-out, rotate 500ms linear infinite;
45        fill: ${s.configuration.colors.global?.accent?Km(s.configuration.colors.global.accent):"hsl(214, 100%, 41%)"};
46        transform: scale(1);
47      }
48
49      .content-stack {
50        display: flex;
51        flex-direction: column;
52        align-items: center;
53        gap: 20px;
54      }
55    </style>
56  </head>
57  <body>
58    <div class="content-stack">
59      <div class="spinner-container">
60        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" class="spinner" focusable="false" aria-hidden="true">
61          <path class="spinnerPath" d="M32 16c0 8.837-7.163 16-16 16S0 24.837 0 16 7.163 0 16 0v2C8.268 2 2 8.268 2 16s6.268 14 14 14 14-6.268 14-14z" role="img"/>
62        </svg>
63      </div>
64    </div>
65  </body>
66</html>`}function Km(s){return`hsl(${s.h}, ${s.s}%, ${s.l}%)`}class Xm{constructor({observability:e}){this.#e=u(!1),this.isOpen=this.#e,this.#t=null,this.#s=null,this.#i=null,this.#r=null,this.#a=!1,this.#n=e,this.open=this.open.bind(this),this.close=this.close.bind(this),this.redirect=this.redirect.bind(this),this.focus=this.focus.bind(this),this.messageHandler=this.messageHandler.bind(this),this.unloadHandler=this.unloadHandler.bind(this)}#e;#t;#s;#i;#r;#n;#a;open({onComplete:e,onCancel:t,theme:i,popupDimensions:r,isCryptoPayment:n=!1,title:a}){if(this.isOpen.value)throw new xt("Popup already open");return this.#i=t,this.#r=e,this.#a=n,this.#t=window.open("about:blank","_blank",Qm(window,r)),!this.#t||this.#t.closed?(wr({success:!1,observability:this.#n}),n&&(this.#n.counter({name:"offsite_payment_popup_flow_open_failed",value:1,attributes:{payment_method_name:"Crypto: USDC",is_mobile:Le()}}),this.#n.counter({name:"offsite_payment_redirect_flow",value:1,attributes:{payment_method_name:"Crypto: USDC",redirect_reason:"popup_blocked",is_mobile:Le()}})),!1):(this.#e.value=!0,this.#t.document.write(jm(i,a)),wr({success:!0,observability:this.#n}),n&&this.#n.counter({name:"offsite_payment_popup_flow_appeared",value:1,attributes:{payment_method_name:"Crypto: USDC",is_mobile:Le()}}),this.#s=setInterval(()=>{this.#t?.closed&&this.close({runCancelCallback:!0})},500),window.addEventListener("message",this.messageHandler),window.addEventListener("unload",this.unloadHandler),!0)}close({runCancelCallback:e=!1}){if(!this.isOpen.value||!this.#t)throw new xt("Popup not opened yet");this.#s&&clearInterval(this.#s),this.#t.close(),this.#e.value=!1,e&&this.#i&&this.#i(),this.#a&&e&&this.#t&&this.#n.counter({name:"offsite_payment_popup_flow_cancelled",value:1,attributes:{payment_method_name:"Crypto: USDC",reason:"cancelled",is_mobile:Le()}}),this.#a=!1}redirect(e){if(!this.isOpen.value||!this.#t)throw new xt("Popup not opened yet");this.#t.location.assign(e)}focus(){if(!this.isOpen.value||!this.#t)throw new xt("Popup not opened yet");this.#t.focus()}unloadHandler(){window.removeEventListener("unload",this.unloadHandler),this.isOpen.value&&this.close({runCancelCallback:!0})}messageHandler(e){if(e.origin===window.location.origin&&e.data.type==="OFFSITE_RETURN"&&e.data.redirectUrl){window.removeEventListener("message",this.messageHandler);const t=new URL(e.data.redirectUrl).searchParams.get("completed")==="true";this.#a&&this.isOpen.value&&this.#t&&(t?this.#n.counter({name:"offsite_payment_popup_flow_closed_
66successfully",value:1,attributes:{payment_method_name:"Crypto: USDC",is_mobile:Le()}}):this.#n.counter({name:"offsite_payment_popup_flow_cancelled",value:1,attributes:{payment_method_name:"Crypto: USDC",reason:"incomplete_flow",is_mobile:Le()}})),this.close({runCancelCallback:!t}),t&&this.#r?.()}}}function Qm(s,e){const{outerHeight:t,outerWidth:i,screenY:r,screenX:n}=s,a=Math.floor(t/2+r-e.height/2),o=Math.floor(i/2+n-e.width/2);return`popup, width=${e.width}, height=${e.height}, top=${a}, left=${o}`}function wr({success:s,observability:e}){e.counter({name:"buyer_experience_offsite_popup_open_count",value:1,attributes:{success:s}})}function Zm({runningTotal:s,merchandiseLines:e,deferredTotal:t}){if(!(s&&s.amount<=0))return!0;const r=ss(e?.lines).some(a=>!!a.sellingPlan?.subscriptionDetails),n=t?.amount.amount;return!!(r||n)}function Jm({isPaymentRequired:s,paymentDue:e,paymentLines:t,merchandiseLines:i,runningTotal:r,deferredTotal:n,checkoutTotal:a,paymentFlexibilityPaymentTermsTemplate:o,checkoutCompletionTarget:d,buyerIdentity:l,captureAtFulfillmentEnabled:c}){if(!s)return"freeOrder";const h=ss(i?.lines).some(v=>v.sellingPlan);return eg({paymentDue:e,paymentLines:t,hasSellingPlan:h})?"giftCard":tg({paymentDue:e,paymentLines:t,hasSellingPlan:h,redemptionSource:"STORE_CREDIT"})?"storeCredit":sg({paymentDue:e,paymentLines:t,runningTotal:r,hasSellingPlan:h,redemptionSources:["CUSTOM","STORE_CREDIT"]})?"redeemables":ig({paymentFlexibilityPaymentTermsTemplate:o,deferredTotal:n,checkoutTotal:a,checkoutCompletionTarget:d,buyerIdentity:l,captureAtFulfillmentEnabled:c})&&!n?.amount.amount?"deferred":null}function eg({paymentDue:s,paymentLines:e,hasSellingPlan:t}){return!s||s.amount>0||t?!1:!!e?.lines.filter(r=>r.cost?.amount&&r.cost.amount>0)?.every(r=>r.method.type==="giftCard")}function tg({paymentDue:s,paymentLines:e,hasSellingPlan:t,redemptionSource:i}){return!s||s.amount>0||t?!1:!!e?.lines.filter(n=>n.cost?.amount&&n.cost.amount>0)?.every(n=>n.method.type==="redeemable"&&n.method.redemptionSource===i)}function sg({paymentDue:s,paymentLines:e,runningTotal:t,hasSellingPlan:i,redemptionSources:r}){const n=e?.lines.filter(a=>a.method.type==="redeemable"&&r.includes(a.method.redemptionSource)||a.method.type==="giftCard").reduce((a,o)=>a+(o.cost?.amount||0),0);return!!(s&&s.amount<=0&&!i&&t&&n===t.amount)}function ig({paymentFlexibilityPaymentTermsTemplate:s,deferredTotal:e,checkoutTotal:t,checkoutCompletionTarget:i,buyerIdentity:r,captureAtFulfillmentEnabled:n}){const a=i==="DRAFT_ORDER",o=ai({deferredTotal:e,checkoutTotal:t,paymentFlexibilityPaymentTermsTemplate:s,isCheckoutToDraft:a}),d=s?.type==="FULFILLMENT"&&n===!0&&!r?.purchasingCompany;return o||d?!1:!!s||a}function rg(s,e){return _(()=>{const t=!!e.remoteMerchandiseDetails?.value?.stableIdToShopId.size,i=e.remoteConsolidatedTotals?.value;return t&&i?i[s]??e[s].value:e[s].value})}function ng(s){return _(()=>!!s.remoteMerchandiseDetails?.value?.stableIdToShopId.size&&s.remotePaymentDue?.value?s.remotePaymentDue.value:s.paymentDue.value)}function ag({negotiatedFields:s,captureAtFulfillmentEnabled:e}){const t=rg("runningTotal",s),i=ng(s),r=_(()=>Zm({runningTotal:t.value,merchandiseLines:s.merchandiseLines.value,deferredTotal:s.deferredTotal.value})),n=_(()=>Jm({isPaymentRequired:r.value,paymentDue:i.value,paymentLines:s.paymentLines.value,merchandiseLines:s.merchandiseLines.value,runningTotal:t.value,deferredTotal:s.deferredTotal.value,checkoutTotal:s.checkoutTotal.value,paymentFlexibilityPaymentTermsTemplate:s.paymentFlexibilityPaymentTermsTemplate.value,checkoutCompletionTarget:s.checkoutCompletionTarget.value,buyerIdentity:s.buyerIdentity.value,captureAtFulfillmentEnabled:e}));return{isPaymentRequired:r,paymentExemptionReason:n}}function Ir(s){return`${s.paymentMethod}:${s.id}`}class og{constructor(){this.#e=u([]),this.promoted=this.#e}#e;promote(e){const t=Ir(e);this.#e.value.some(i=>Ir(i)===t)||(this.#e.value=[...this.#e.value,e])}}function dg(s){const e=s.map(t=>Cd(t));return u(e)}function lg({isDigitalGood:s,deliveryMethodTypes:e,proposedBillingAddress:t,proposedShippingAddress:i,sameBillingAndShippingAddress:r,requireMatchingShippingAndBilling:n,isPaymentInstrumentsDelegationEnabled:a,isDelegatedCardInstrument:o=!1}){const d=e.length>0&&(e.every(c=>c==="PICK_UP")||e.every(c=>c==="PICKUP_POINT"));
66return s||d||a&&o?"custom":n?"shipping":En(t)&&!(i&&St(i,t))||a?"custom":r?"shipping":"custom"}function cg({isDraftOrderCheckout:s,proposedBillingAddress:e,billingAddressFact:t,companyLocationBillingAddress:i,companyLocationShippingAddress:r}){return t&&!!!(i&&St(t,i))?"billing-fact":s&&e&&En(e)&&!!!(i&&St(e,i))?"custom":i?.address1?"billing":r?.address1?"shipping":"custom"}function ug({shippingAddressCountryCode:s,shippingAddressZoneCode:e,buyerIdentityCountryCode:t,defaultCountryCode:i,defaultZoneCode:r}){return s?{locationCountryCode:s,locationZoneCode:e}:t?{locationCountryCode:t,locationZoneCode:void 0}:{locationCountryCode:i,locationZoneCode:r}}function hg(s){if(s===void 0)return{};const e=s.find(t=>t.__typename==="UnvalidatedParametersFact");return{email:e?.email??void 0,phone:e?.phone??void 0,shippingAddress:e?.shippingAddress??void 0,billingAddress:e?.billingAddress??void 0}}function pg(s){return s?{email:s?.email??void 0,phone:s?.phone??void 0}:{email:void 0,phone:void 0}}function Rr(s,e){if(!e)return s;const t=ke(e);return{...Yi(s),...Yi(t)}}function mg(s,e,t,i){const r=Rr(e,i?.shippingAddress),n=Rr(s,i?.billingAddress),a=t?.customerProfile?{}:pg(i);return{shippingAddress:r,billingAddress:n,email:a.email,phone:a.email?void 0:a.phone}}function gg({shippingAddress:s,defaultShippingDetails:e,shop:t,buyerIdentity:i}){const r=t.popularShippingCountries?.[0]?.value,n={city:void 0,address1:void 0,address2:void 0,company:void 0,firstName:void 0,lastName:void 0,name:void 0,phone:void 0,postalCode:void 0,coordinates:void 0,countryCode:e?.country?.code,zoneCode:e?.zone?.code};return s&&Object.keys(s).length>0?{...n,...s}:i?.countryCode?{...n,countryCode:i.countryCode,zoneCode:e.country.code===i.countryCode?e.zone.code:void 0}:r?{...n,countryCode:r,zoneCode:r===e.country.code?e.zone.code:void 0}:{...n}}function fg(s){if(s?.__typename==="FilledPaymentTerms"&&s.billingAddress?.__typename==="StreetAddress")return ke(s.billingAddress)}function yg(s){return s?.customerProfile?.__typename==="CustomerProfile"?s?.customerProfile?.billingAddresses[0]?.address:void 0}function vg(s){const e=s?.__typename==="FilledDeliveryTerms"?Td(s):void 0;return e?.destinationAddress?.__typename==="PartialStreetAddress"||e?.destinationAddress?.__typename==="StreetAddress"?ke(e.destinationAddress):void 0}function _g({negotiationResultBuyerDelivery:s,negotiatedShippingAddress:e,customerVaultedShippingAddresses:t}){const i=vg(s)??e;if((i===void 0||ri(i,["address1","address2","city"]))&&t&&t.length>0){const n=t.filter(o=>o.address.countryCode===i?.countryCode),a=n.find(o=>o.default)??n[0];if(a)return a.address}return i}const bg={returnFees:{aggregatedReturnShippingFees:void 0,aggregatedRestockingFees:void 0},billingAddress:void 0,contactMethod:void 0,delivery:void 0,merchandiseLines:void 0,orderDiscounts:void 0,orderNumber:void 0,previouslyPaidTotal:void 0,requiresShipping:void 0,taxesIncluded:void 0,dutiesIncluded:void 0,tax:void 0,taxBreakdown:void 0,taxRecalculation:void 0,duty:void 0,landedCostDetails:void 0,tip:void 0,updatedTotal:void 0};function Sg(s){return s.map(({appliedDiscounts:e,price:t,priceAfterDiscounts:i,properties:r,quantity:n,title:a,image:o,quantityChange:d,variantTitle:l,sku:c,parent:h,stableId:b})=>({stableId:b,appliedDiscounts:e.map(({label:g,amountDiscounted:v})=>({title:g,amountDiscounted:ce(v),presentationLevel:"LINE"})),price:ce(t),priceAfterDiscounts:ce(i),properties:kd(r),quantity:n,title:a,image:o&&{url:o.url,one:o.one,two:o.two,four:o.four,altText:o.altText},quantityChange:d,variantTitle:l,sku:c,parentTitle:h?.title}))}function Ag(s,{includeDeliveryGroups:e=!1}={}){if(!s?.session?.context.policies)return bg;const{context:t,sessionType:i}=s.session,{policies:r,session:n}=t;let a={};r.payment.forEach(p=>{p.__typename==="PreviousPaymentsFact"&&(a={previouslyPaidTotal:p.previouslyPaidTotal,updatedTotal:p.updatedTotal,billingAddress:p.billingAddress?ke(p.billingAddress):void 0})});let o={};r.fees.forEach(p=>{p.__typename==="PreviousFeesFact"&&(o={returnFees:p.returnFees})});let d={};r.buyerIdentity.forEach(p=>{p.__typename==="PreviousBuyerIdentityFact"&&(d={contactMethod:p.contactMethod})});let l={};r.merchandise.forEach(p=>{p.__typename==="PreviousMerchandiseFact"&&(l={merchandiseLines:Sg(p.lines)})});let c={};
66r.tip.forEach(p=>{p.__typename==="PreviousTipFact"&&(c={tip:ce(p.total)})});let h={};r.tax.forEach(p=>{p.__typename==="PreviousTaxFact"&&(h={...h,tax:ce(p.total),taxBreakdown:p.taxBreakdown?.length?p.taxBreakdown.map(f=>({title:f.title,amount:ce(f.amount)})):void 0}),p.__typename==="PreviousTaxRecalculationFact"&&(h={...h,taxRecalculation:{beforeLines:p.beforeLines.map(f=>({title:f.title,rate:f.rate})),afterLines:p.afterLines.map(f=>({title:f.title,rate:f.rate}))}})});let b={};r.duty.forEach(p=>{p.__typename==="PreviousDutyFact"&&(b={duty:ce(p.total)})});let g={};r.landedCostDetails.forEach(p=>{p.__typename==="PreviousLandedCostDetailsFact"&&(p.incotermInformation?g={landedCostDetails:{incoterm:p.incotermInformation.incoterm,reason:p.incotermInformation.reason}}:g={landedCostDetails:void 0})});const v={delivery:r.delivery.flatMap(p=>p.__typename==="PreviousDeliveryFact"?[wd(p,{includeDeliveryGroups:i==="ORDER_EDIT"&&e})]:[])};let E={};r.discount.forEach(p=>{p.__typename==="PreviousDiscountFact"&&(E={orderDiscounts:p.orderLevelDiscounts.map(f=>({label:f.label,amount:ce(f.amount)}))})});let y={};return n.forEach(p=>{p.__typename==="PreviousNegotiationFact"&&(y={orderNumber:p.orderNumber,requiresShipping:p.requiresShipping,taxesIncluded:p.taxesIncluded,dutiesIncluded:p.dutiesIncluded})}),{...a,...o,...d,...l,...c,...h,...b,...g,...v,...E,...y}}function Eg(s,e){const t=s??[],i=e??[];return t.length!==i.length||t.some((r,n)=>ji(r)!==ji(i[n]))}function Pg(s,e){const t=Id(s);t.discountLines=je(s.discountLines,(n,a)=>n?.lines.length!==a?.lines.length,["money-lines"]),t.paymentLines=je(s.paymentLines,(n,a)=>{const o=n?.lines.some(({method:l})=>l.type==="giftCard")??!1,d=a?.lines.some(({method:l})=>l.type==="giftCard")??!1;return o!==d},["money-lines"]),t.tipLines=je(s.tipLines,(n,a)=>n?.length!==a?.length,["money-lines"]),t.legacyMerchandiseLinesAsFees=je(s.legacyMerchandiseLinesAsFees,(n,a)=>n?.lines.length!==a?.lines.length,["money-lines"]),t.paymentMethods=je(s.paymentMethods,Eg,["payment-selector-change"]);const i=_(()=>Object.entries(t).reduce((n,[a,o])=>(n[a]=o.value,n),{}));return new Rd(i,n=>{Xe(()=>{for(const[a,o]of Object.entries(n)){const d=t[a];d&&(d.value=o)}})},t)}function Mr(s){return{signature:s.signature,contents:s.contents.map(e=>({signature:e.signature,targetTerms:e.targetTerms,targetLine:e.targetLine===void 0||e.targetLine===null?void 0:{allLines:e.targetLine.allLines,index:e.targetLine.index},attributes:e.attributes}))}}function Dr(s){if(!(!s.message||s.__typename!=="Note"))return s.message}function Lr(s){return s.__typename!=="Note"?[]:s.customAttributes?.map(({__typename:e,...t})=>t)}const Cg={CheckpointDenied:"NegotiateFromSession.CheckpointDenied",NegotiationResultAvailable:"NegotiateFromSession.Unknown",NegotiationResultFailed:"NegotiateFromSession.NegotiationResultFailed",SubmittedForCompletion:"NegotiateFromSession.SubmittedForCompletion",Throttled:"NegotiateFromSession.Throttled",TooManyRequests:"NegotiateFromSession.Unknown"};function Tg(s){return s==null?"NegotiateFromSession.Unknown":Cg[s]}class kg{constructor({negotiateFromSessionData:e,router:t,shop:i,observability:r,source:n,persistence:a,isOnePageCheckout:o,isShopPayActive:d,checkoutContextData:l,requestInfoData:c,extendedAddressMode:h,receipt:b}){const g=Et(l?.appConfiguration?.allowedDelegations??[],Be.PAYMENT_INSTRUMENTS),v=Qe(n),E=n?.type==="draftOrder",p=(n?.type??void 0)==="abandonedCart",f=c.shop?.defaultShippingDetails?.country?{country:c.shop.defaultShippingDetails.country,zone:{code:c.shop.defaultShippingDetails.zone?.code}}:{country:i.country,zone:{code:void 0}},m=e?.session?.negotiate?.result,A=Ki(Md(e??void 0),m?.__typename==="NegotiationResultAvailable"?m.sellerProposal:void 0,m?.__typename==="NegotiationResultAvailable"?m.buyerProposal:void 0),I=Dd(e??void 0),P=Ki(I,m?.__typename==="NegotiationResultAvailable"?m.sellerProposal:void 0,m?.__typename==="NegotiationResultAvailable"?m.buyerProposal:void 0),T=m?.__typename==="NegotiationResultAvailable",R=m?.__typename==="Throttled",M=T||R?Dr(m?.buyerProposal?.note):void 0,k=m?.__typename==="NegotiationResultAvailable"?m.sellerProposal:void 0,{availableDeliveryAddresses:O,availableRedeemables:w,buyerIdentity:D,canU
66pdateDeliveryAddress:G,canUpdateDiscountCodes:U,canUpdateMerchandise:C,captcha:Y,checkoutTotal:Ue,checkoutTotalBeforeTaxesAndShipping:be,checkoutTotalTaxes:xe,deferredTotal:Ie,delivery:Se,deliveryExpectations:x,deliveryMethods:W,dutiesIncluded:V,duty:H,hasOnlyDeferredShipping:z,landedCostDetails:te,legacyAggregatedMerchandiseTermsAsFees:$,legacyRepresentProductsAsFees:K,legacySubtotalBeforeTaxesShippingAndFees:oe,managedByMarketsPro:X,managedMarketsPaymentProcessor:de,merchandise:Ae,mustSelectProvidedAddress:j,mustSelectProvidedShippingRate:et,note:ee,payment:Q,poNumber:Ve,recurringTotals:he,remote:ie,runningTotal:He,shopCashBalance:dt,shopDiscountOffer:lt,shopPayEnabled:wt,shopPromotion:ct,subtotalAfterMerchandiseDiscounts:Ee,subtotalBeforeReductions:Ge,subtotalBeforeTaxesAndShipping:qe,tax:Re,taxExemptions:hi,tip:B,total:re,totalSavings:We}=k??{},ne=zu(D),{remoteMerchandise:{remoteBuyerMerchandiseLines:ns,remoteSellerMerchandiseLines:Ca,stableIdToShopId:Ta},remoteDelivery:as,remotePayment:os}=fn(m?.__typename==="NegotiationResultAvailable"?m.sellerProposal.remote:void 0),ut=Ag(e,{includeDeliveryGroups:n.type==="orderEdit"&&i.hasFlagEnabled(Ld)}),Z=m?.__typename==="NegotiationResultAvailable"||m?.__typename==="Throttled"?m.buyerProposal:void 0,ds=Od(ee),ka=Nd(ee),pi=Bd(ee),[pe,It]=Fd(m)?[Xi(Ae,Ca),Xi(Z?.merchandise,ns)]:[Ae,Z?.merchandise],ls=as?.isShippingRequired??k?.isShippingRequired??Z?.isShippingRequired,{merchandiseDiscount:mi,deliveryDiscount:wa}=Ud(m),gi=Z?.delivery,fi=(Se&&gn({delivery:Se,buyerDelivery:Z?.delivery,remoteDelivery:as}))??$u({buyerIdentity:ne,type:"shipping",isShopPayActive:d})??{},Ia=ds&&!!fi&&ka,cs=xd(pe,It,A),yi=Vd(cs.lines),vi=Hd(cs.lines),us=Gd(He,Z?.runningTotal,A??[],pe),Ra=We&&We.__typename==="MoneyValueConstraint"?ce(We):void 0,Ma=Ge&&Ge.__typename==="MoneyValueConstraint"?ce(Ge):void 0,Da=Ee&&Ee.__typename==="MoneyValueConstraint"?ce(Ee):void 0,_i=pr(Q,us),tt=qd(Q),La=Wd(Q),Rt=zd(Ie??void 0,tt?.dueDate??void 0),hs=$d(Ue,Z?.checkoutTotal,A??[],pe),ps=!!ai({deferredTotal:Rt,checkoutTotal:hs,paymentFlexibilityPaymentTermsTemplate:tt})?.amount,Oa=Yd(Q,os.availablePaymentLines),bi=jd({availablePayments:Oa,hasPayableDeposit:ps}),Na=Kd(i)&&Xd({hasSellingPlan:yi,hasFixedSellingPlan:vi,paymentTermsTemplateType:tt?.type}),Si=Qd({payment:Q,sortedPaymentMethods:bi,runningTotal:us,paymentDue:_i,deferredTotal:Rt,checkoutTotal:hs,paymentMethodAutoSelectionDisabled:i.paymentMethodAutoSelectionDisabled,requiresVaulting:yi,hasPayableDeposit:ps,hasFixedSellingPlan:vi,paymentTermsTemplateType:tt?.type,preserveAllocatedImmediatePaymentLineAmount:Na,observability:r}),Mt=Zd({delivery:Se,deliveryMethods:i.shipPickupInOneOrderEnabled?W:void 0,negotiatedMerchandise:pe,buyerDelivery:Z?.delivery,violations:A??[],isPointOfSale:ds,isPointOfSaleShipToHome:Ia,observability:r,isAbandonedCartSession:p,remoteDelivery:as}),Ba=fg(Q)??yg(ne);let ms;T&&m.sellerProposal.nonNegotiableTerms?ms=Mr(m.sellerProposal.nonNegotiableTerms):m?.__typename==="Throttled"&&m.buyerProposal.nonNegotiableTerms&&(ms=Mr(m.buyerProposal.nonNegotiableTerms));const Fa=m?.__typename==="NegotiationResultAvailable"&&m.sellerProposal.optionalDuties?Yu(m.sellerProposal.optionalDuties):void 0,Ai=m?.__typename==="NegotiationResultAvailable"?Jd(m.sellerProposal.attribution):void 0,Ei=m?.__typename==="NegotiationResultAvailable"?ku(m.sellerProposal.attribution):void 0,Ua=Ai===void 0&&Ei===void 0?void 0:{...Ai,...Ei},xa=m?.__typename==="NegotiationResultAvailable"?wu(m.sellerProposal.saleAttributions):void 0,Va=ds&&pi?{code:pi}:void 0,gs=!v&&i.emailMarketing==="CHECKED",Pi=l?.appConfiguration?.features?.isEmailMarketingEnabled??!0,Ha=D?.__typename==="FilledBuyerIdentityTerms"&&D.customer?.__typename==="BusinessCustomerProfile",Ci=ju(D),Ti=Ku(D),Ga=Pi?Ha?Ci??Ti??gs:Ti??Ci??gs:!1,ki=T?Iu(m.sellerProposal.memberships):void 0,wi=el({sellerProposal:k,buyerProposal:Z,negotiationViolations:A,sellerMerchandise:pe}),N={remoteTaxDetails:sh(ie),remoteMerchandiseDetails:{stableIdToShopId:Ta,mergedBuyerProposalMerchandise:It},remoteSessionDetails:ml(m?.__typename==="NegotiationResultAvailable"?m.sellerProposal.remote:void 0),remoteConsolidatedTotals:wi,checkoutCardsinkCallerIdentificationSignature:e?.session?.checkoutCardsinkCallerIdentificationSignature??void 0,remotePaymentDue:pr(Q,wi?.runningTotal),remoteTotalDetails:pl({remote:k?.remote,negotiationViolations:A,sellerMerchandise:pe}),additionalMoneyLines:void 0,lpmDisclosure:k?.lpmDisclosure??void 0,billingAddress:Ba,shippingAddress:fi,merchandiseLines:cs,deliveryNext:Mt,sellability:hl({shop:i,sellerProposal:k,missingSellerProposalReason:Tg(m?.__typename),isShippingRequired:ls,observability:r}),deliveryExpectations:Vu({deliveryExpectations:x}),availableDeliveryAddresses:O?O.map(q=>({address:ke(q),id:q.handle??void 0})):[],mustSelectProvidedAddress:j??!1,mustSelectProvidedShippingRate:et??!1,canUpdateDiscountCodes:U??!0,canUpdateDeliveryAddress:G??!0,canUpdateMerchandise:C??!0,note:ee?Dr(ee):void 0,customAttributes:ee?Lr(ee):void 0,nonNegotiableTerms:ms,paymentMethodHistory:Q?.__typename==="FilledPaymentTerms"?Q.paymentMethodHistory:[],paymentLines:Si,paymentMethods:bi,availableRedeemables:xu(w),shopCashBalance:Uu(dt),shopPromotion:Fu(ct),shopDiscountOffer:Bu(lt),contactInfo:th(D),buyerIdentity:ne,checkoutCompletionTarget:T?m.sellerProposal.checkoutCompletionTarget:void 0,duties:Nu(H),optionalDuties:Fa,dutiesIncluded:V,landedCostDetails:te?.incotermInformation??void 0,taxes:eh(Re),taxExemptions:Qi(hi),subtotal:ul(qe,Z?.subtotalBeforeTaxesAndShipping,A??[],pe),subtotalBeforeReductions:Ma,subtotalAfterMerchandiseDiscounts:Da,legacySubtotalBeforeTaxesShippingAndFees:cl(oe,Z?.legacySubtotalBeforeTaxesShippingAndFees,A??[],pe),legacyMerchandiseLinesAsFees:ll($),legacyRepresentProductsAsFees:K,totalSavings:Ra,runningTotal:us,purchaseOrderNumber:T?Ve??void 0:void 0,total:re?.__typename==="MoneyValueConstraint"?ce(re):void 0,recurringTotals:dl(he),deferredTotal:Rt,hasOnlyDeferredShipping:z,checkoutTotal:hs,checkoutTotalBeforeTaxesAndShipping:ol(be,Z?.checkoutTotalBeforeTaxesAndShipping,A??[],pe),checkoutTotalTaxes:al(xe,Z?.checkoutTotalTaxes,A??[],pe),acceptEmailMarketing:Ga,emailMarketingConsentGrantReached:Ju(D),acceptSmsMarketing:Qu(D)??Zu(D)??!1,smsMarketingPhone:Xu(T?m.sellerProposal.buyerIdentity:void 0),allViolations:P,paymentDue:_i,discountLines:nl({merchandiseDiscount:mi,deliveryDiscount:wa}),acceptUnexpectedDiscounts:rl(mi),tipOptions:Ou(B),tipLines:Lu(B),localizationExtensions:k?.localizationExtension?.fields,scriptFingerprint:k?.scriptFingerprint?Du(k?.scriptFingerprint):void 0,transformerFingerprintV2:k?.transformerFingerprintV2||void 0,attribution:Ua,captcha:il(Y,I),cartMetafields:sl(k?.cartMetafields),customFields:i.hasFlagEnabled(tl)?Mu(k?.customFields):void 0,shopPayArtifact:void 0,paymentFlexibilityPaymentTermsTemplate:tt,depositConfiguration:La,isImmediateAmountReducedForRedeemables:Q?.__typename==="FilledPaymentTerms"&&Q.isImmediateAmountReducedForRedeemables,reduction:Va,managedByMarketsPro:X,managedMarketsPaymentProcessor:de,saleAttributions:xa,alternativePaymentCurrency:Ru(k?.alternativePaymentCurrency,Si),metafields:[],isShippingRequired:ls,remotePaymentDetails:os.paymentDetails,memberships:ki,shopPayEnabledForSellerOfRecord:wt,ucp:{continueUrl:k?.ucp?.continueUrl??void 0,paymentHandlers:k?.ucp?.paymentHandlers.map(q=>({id:q.id,name:q.name,version:q.version,spec:q.spec,schema:q.schema,config:typeof q.config=="object"?q.config:void 0})),id:e?.session?.ucp?.checkout?.id??(n.type==="cartNext"?`gid://shopify/Checkout/${n.sourceId}`:void 0)}},Ii=N.shippingAddress?.countryCode,Ri=N.shippingAddress?.zoneCode,Mi=ut.billingAddress?.countryCode??N.billingAddress?.countryCode??ne?.countryCode??Ii??f.country.code??i.popularBilling
66Countries?.[0]?.value,qa=ut.billingAddress?.zoneCode??N.billingAddress?.zoneCode??Ri??f.zone.code,fs=gl({negotiatedMerchandise:pe??It,negotiatedDeliveryNext:N?.deliveryNext,enabledDeliveryMethods:N.sellability.enabledDeliveryMethods,buyerProposalDelivery:gi,mustSelectProvidedShippingRate:et??!1}),Wa=Mt?.status==="filled"&&Mt.deliveryMacros?.length?Mt.deliveryMacros:[],Di=E?N.shippingAddress:ne.customerProfile?.__typename!=="BusinessCustomerProfile"?_g({negotiationResultBuyerDelivery:m?.__typename==="NegotiationResultAvailable"||m?.__typename==="Throttled"?m?.buyerProposal?.delivery:void 0,negotiatedShippingAddress:N.shippingAddress,customerVaultedShippingAddresses:ne.customerProfile?.__typename==="CustomerProfile"?ne.customerProfile.shippingAddresses:void 0}):(ne.customerProfile.checkoutExperienceConfiguration?.editableShippingAddress&&N.deliveryNext?.status==="filled",N.shippingAddress),Li=gg({shippingAddress:Di,defaultShippingDetails:f,shop:i,buyerIdentity:N.buyerIdentity}),Dt=fl(e?.session?.checkoutPaymentMethods),za=Dt?gu(fu(Dt)):void 0,Lt=(()=>{const q=ut.billingAddress??za??(m?.__typename==="NegotiationResultAvailable"&&m.sellerProposal.payment?.__typename==="FilledPaymentTerms"&&m.sellerProposal.payment.billingAddress&&m.sellerProposal.payment.paymentLines.length>0?ke(m.sellerProposal.payment.billingAddress,r):void 0)??N.billingAddress;return q?.countryCode==null?Ss(q,Mi,qa):Ss(q,q?.countryCode??Mi,q?.zoneCode??void 0)})();function $a(q){return!wl(t.currentUrl.value.searchParams)||q.method.type!=="wallet"&&q.method.type!=="walletsPlatformPaymentMethod"}const ys=yl({paymentLines:N.paymentLines?.lines??[],availablePaymentMethods:N.paymentMethods,url:t.currentUrl.value,deferredTotal:Rt,shouldNotSetInitialState:i.paymentMethodAutoSelectionDisabled,hasPayableDeposit:ps,paymentTermsTemplateType:tt?.type,observability:r}).filter($a),Ya=(()=>{const{purchasingCompany:q}=ne;if(q)return cg({proposedBillingAddress:Lt,isDraftOrderCheckout:E,billingAddressFact:ut.billingAddress,companyLocationBillingAddress:q.location.billingAddress,companyLocationShippingAddress:q.location.shippingAddress});const Me=vl({shopRequireMatchingShippingAndBilling:!!i.requireMatchingShippingAndBilling,selectedPaymentMethodType:ys?.[0]?.method.type,isShippingRequired:!!ls,isOrderSession:v,isB2B:!!q,isPickupPointDeliveryMethod:fs.every(({deliveryMethodTypes:ht})=>ht.includes("PICKUP_POINT"))});return lg({proposedBillingAddress:Lt,proposedShippingAddress:Di,requireMatchingShippingAndBilling:Me,sameBillingAndShippingAddress:i.sameBillingAndShippingAddress,deliveryMethodTypes:fs.flatMap(({deliveryMethodTypes:ht})=>ht),isDigitalGood:N.merchandiseLines?.lines&&N.isShippingRequired===!1,isPaymentInstrumentsDelegationEnabled:g,isDelegatedCardInstrument:Dt!=null&&yu(Dt)})})(),ja=Pi?N.acceptEmailMarketing??gs??!1:!1,Ka=new URLSearchParams(t.currentUrl.value.search),Xa=t.currentUrl.value.normalizedPath==="/processing"&&Ka.get("post_purchase")==="true"?"success":void 0,vs=_l(ys,[At.BuyWithPrime]).length>0,Oi=t.currentUrl.value.normalizedPath==="/shoppay_login";let Ot;d?Ot="SHOP_PAY":vs?Ot="BUY_WITH_PRIME":!Oi&&!v&&!o&&(Ot="SHOPIFY");const Qa=!Oi&&!v&&!o,Za=hg(e?.session?.context.session),st=mg(Lt,Li,ne,Za),{locationCountryCode:Ja,locationZoneCode:eo}=ug({shippingAddressCountryCode:Ii,shippingAddressZoneCode:Ri,buyerIdentityCountryCode:ne?.countryCode,defaultCountryCode:f.country.code,defaultZoneCode:f.zone.code}),to=st.email===void 0?"":void 0,so=st.phone===void 0?"":void 0,Ni=Z?.buyerIdentity?{email:Gu(Z.buyerIdentity,{emptyContactFallback:to}),phone:Hu(Z.buyerIdentity,{emptyContactFallback:so})}:void 0,io=ne.customerProfile?.email||void 0,ro=m?.__typename==="Throttled"?qu(Z):void 0,_s=bl(n),F={attributes:N.customAttributes,attribution:N.attribution,discountLines:N.discountLines?.lines??[],memberships:ki,legacyRepresentProductsAsFees:N.legacyRepresentProductsAsFees,taxExemptions:Cl({negotiated:Qi(k?.taxExemptions)}),email:io??Ni?.email??st.email??ne.customerProfile?.email??N.contactInfo?.email??(D&&"email"in D?D.email:void 0)??"",phone:Ni?.phone??st.phone??N.contactInfo?.phone??(D&&"phone"in D?D.phone:void 0)??"",merchandiseLines:El({proposedMerchandise:Pl(It,[]),negotiatedMerchandiseLines:N.merchandiseLines}),tipLines:N?.tipLines,paymentLines:ys,useStoreCreditForSubscriptionRenewals:!1,availableRedeemables:N.availableRedeemables,remotePaymentDetails:os.paymentDetails,acceptEmailMarketing:ja,acceptSmsMarketing:N.acceptSmsMarketing??!1,smsMarketingPhone:N.smsMarketingPhone??"",acceptPaymentVaulting:!1,localizationExtensions:N.localizationExtensions??[],shippingAddress:st.shippingAddress??Li,billingAddress:st.billingAddress??Lt,locationAddress:Al(gi)??Ss({},Ja,eo),billingAddressOption:Ya,note:M,cartMetafields:Sl(T?m?.buyerProposal?.cartMetafields:null),postPurchaseInquiryStatus:a?.get(fe.PostPurchaseInquiryStatus,{scope:_s})??Xa??"disabled",shopPayArtifact:a?.get(fe.ShopPayArtifact,{scope:_s}),deliveryLines:fs,deliveryMacros:Wa,externalDeliveryIds:a?.get(fe.ExternalDeliveryIds,{scope:_s}),purchaseOrderNumber:N.purchaseOrderNumber??"",optionalDuties:N.optionalDuties,captcha:N.captcha,reduction:N.reduction,saleAttributions:N.saleAttributions,rememberMe:ro??!!N.buyerIdentity?.rememberMe,shopPayRememberMeVisible:!1,setShippingAddressAsDefault:void 0};vs&&(N.customAttributes=Zi(N.customAttributes??[]));const Bi=T||R?Lr(m?.buyerProposal?.note):void 0,no=vs?Zi(Bi??[]):Bi;this.proposed={email:u(F.email??""),phone:u(F.phone??""),acceptEmailMarketing:u(F.acceptEmailMarketing),acceptSmsMarketing:u(F.acceptSmsMarketing),smsMarketingPhone:u(F.smsMarketingPhone),acceptPaymentVaulting:u(F.acceptPaymentVaulting),deliveryLines:Tl(F.deliveryLines),deliveryMacros:u(F.deliveryMacros),externalDeliveryIds:u(F.externalDeliveryIds),purchaseOrderNumber:u(F.purchaseOrderNumber),useProgressiveRates:u(Qa),interfaceFlow:u(Ot),billingAddress:As(F.billingAddress,{extendedAddressMode:h}),locationAddress:As(F.locationAddress,{extendedAddressMode:h}),shippingAddress:As(F.shippingAddress,{extendedAddressMode:h}),billingAddressOption:u(F.billingAddressOption),discountLines:je(F.discountLines,(q,Me)=>q.length!==Me.length,["money-lines"]),legacyRepresentProductsAsFees:u(F.legacyRepresentProductsAsFees),remotePaymentDetails:u(F.remotePaymentDetails),paymentLines:je(F.paymentLines,(q,Me)=>{const ht=q.some(({method:bs})=>bs.type==="giftCard"),ao=Me.some(({method:bs})=>bs.type==="giftCard");return ht!==ao}
66,["money-lines"]),useStoreCreditForSubscriptionRenewals:u(F.useStoreCreditForSubscriptionRenewals),availableRedeemables:u(F.availableRedeemables),merchandiseLines:u(F.merchandiseLines),note:u(F.note),attributes:u(no),cartMetafields:u(F.cartMetafields),generalPaymentError:u(void 0),generalPaymentErrorCode:u(void 0),directPaymentErrors:{paymentMethodIdentifier:u(void 0),general:u(void 0),name:u(void 0),number:u(void 0),expiry:u(void 0),issueDate:u(void 0),issueNumber:u(void 0),verificationValue:u(void 0)},postPurchaseInquiryStatus:u(F.postPurchaseInquiryStatus),tipLines:u(F.tipLines),localizationExtensions:dg(F.localizationExtensions),shopPayArtifact:u(F.shopPayArtifact),shopPayRememberMeVisible:u(F.shopPayRememberMeVisible),memberships:u(F.memberships),optionalDuties:u(F.optionalDuties),attribution:u(F.attribution),captcha:u(F.captcha),reduction:u(F.reduction),saleAttributions:u(F.saleAttributions),rememberMe:u(F.rememberMe),setShippingAddressAsDefault:u(F.setShippingAddressAsDefault),taxExemptions:u(F.taxExemptions)},this.negotiated=Pg(kl(N,b)),this.facts=ut}}function wg(s){return s?.status==="processed"}class Ig{constructor({url:e,shop:t,source:i,shopPayIsActive:r,receipt:n,observability:a}){this.setRememberMeCookies=async()=>{const{checkoutSessionIdentifier:o}=this.#a;if(o){this.#e.value="loading";try{const d=await fetch(this.#r.shopPayRememberMeUrl(o),{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json",authorization:`Basic ${this.#n.checkoutPublicAccessToken}`,"X-Shopify-Checkout-Version":"2025-03-18"}});if(!d.ok){this.#o.log("remember_me_shop_pay_cookies_failed","Failed to set Shop Pay remember me cookies",{status:d.status,statusText:d.statusText}),this.#t.value={data:null,error:{message:d.statusText}};return}const l=d.headers.get("content-type");if(l&&l.includes("application/json")){const{message:c}=await d.json();this.#t.value={data:c,error:null};return}this.#o.log("remember_me_unexpected_content_type_received","Unexpected content type for Shop Pay remember me cookies response",{contentType:l}),this.#t.value={data:null,error:null}}catch(d){const l=d instanceof Error?d.message:String(d);this.#o.log("remember_me_error_occurred","An error occurred while setting Shop Pay remember me cookies",{errorMessage:l}),this.#t.value={data:null,error:{message:l}}}finally{this.#e.value="complete"}}},this.#e=u(null),this.status=this.#e,this.#t=u(null),this.response=this.#t,this.#i=u(!1),this.createAccountOptIn=this.#i,this.#s=_(()=>!!(!r&&n&&wg(n)&&!n.redirectUrl&&n.shopAppLinksAndResources?.shopPayOrder)),this.shouldSetRememberMeCookies=this.#s,this.#r=e,this.#n=t,this.#a=i,this.#o=a}#e;#t;#s;#i;#r;#n;#a;#o;unstable_setCreateAccountOptIn(e){this.#i.value=e}}class Rg{#e;constructor({token:e}){this.#e=u(e),this.token=this.#e}update(e){if(e===this.#e.value||(this.#e.value=e,typeof window>"u"))return;const t=new URL(window.location.href);e?t.searchParams.set("rctx",e):t.searchParams.delete("rctx"),history.replaceState(null,"",t.href)}}class Mg{#e;#t;constructor(e){this.#t=e,this.#e=u(void 0),this.availableToRender=_(()=>{const t=this.#e.value;if(!t)return[];const i=t.isSplitShipAndPickup?Il:Rl;return(i[this.#t.identity.current.value]??i.default).filter(n=>Ml[n].shouldRender({preactContext:t,concepts:this.#t}))}),this.availableToRenderGrouped=_(()=>{const t=this.#e.value;if(!t)return[];const i=Dl(this.availableToRender.value,{preactContext:t,concepts:this.#t});return Ll(i)})}unstable_providePreactContext(e){const t=this.#e.peek();zs(t,e)||(this.#e.value=e)}}const js="wallet_deceleration";function Dg(s){return s.searchParams.get(js)!=="true"}function Lg(s){const e=Dg(s);if(!e){s.searchParams.delete(js);const t=new URL(window.location.href);t.searchParams.delete(js),window.history.replaceState(null,document.title,t.href)}return e}class Og{constructor(){this.billingAddressErrors=_e(),this.poNumberError=u(void 0),this.contactErrors={phoneInputError:u(void 0),emailInputError:u(void 0)},this.missingFields={phone:{isValid:u(!0),error:u(""),input:u("")},firstName:{input:u(""),error:u("")}}}}function Ks(s){return s?.__typename==="CustomerProfile"}function Ng(s){const t=s.negotiated.fields.buyerIdentity.value?.customerProfile;return Ks(t)&&!t.email?!1:s.proposed.email.value.length>0?!0:!!(Ks(t)&&t.email)}function Bg(s){return s.shippingAddresses.length===0}function Fg(s,e){const[t]=s.shippingAddresses;return s.shippingAddresses.length===1&&t!==void 0&&e(t.address,"shipping").size>0}function Ug(s,e){return e!=null&&s(e,"shipping").size===0}function xg(s,e,t){return!e&&t!=null&&s.shippingAddresses.length>0}function Vg(s,e,t,i){return xg(s,t,i)||!t&&!i?!1:!e.selectedAddress.value}function Hg(s){return _(()=>{const e=s.negotiated.fields.buyerIdentity.value,t=s.proposed.shippingAddress.value;return{hasEditableShippingAddress:e?.customerProfile?.__typename==="BusinessCustomerProfile"&&e.customerProfile.checkoutExperienceConfiguration?.editableShippingAddress===!0,isValidShippingAddress:t!=null}})}function Gg(s,e){return _(()=>{const t=s.negotiated.fields.paymentMethods.value;return{vaultedCardsAvailable:t!=null&&t.some(i=>i.type===Kt.CreditCard),isCheckoutToDraft:e.type==="draftOrder"}})}function qg(s){return _(()=>{const e=s.negotiated.fields.paymentMethods.value;return e!=null&&e.some(t=>t.type===Kt.CreditCard||t.type===Kt.PayPal)})}function Wg(s){return _(()=>{const e=s.negotiated.fields.paymentMethods.value;return e?e.some(t=>t.type===Kt.CreditCard):!1})}function zg(s){return _(()=>Ol({availablePaymentMethods:s.negotiated.fields.paymentMethods.value??[],paymentMethodHistory:s.negotiated.fields.paymentMethodHistory?.value??[]}))}function $g(s){return _(()=>{const e=s.negotiated.fields.paymentDue.value;return e!=null&&(e.amount??0)>0})}function Yg(s){return _(()=>s.negotiated.fields.availableDeliveryAddresses.value?.map(t=>t.address)??[])}function jg({identity:s,proposal:e,shopPay:t,isEmbeddedPartner:i=!1}){switch(s.current.value){case jt:return!1;case"amazonPay":case"businessCustomer":case"buyWithPrime":return!0;case"shopPay":return t.user.isAuthenticatedUser.value;case"sdkCartHints":return i||e.proposed.email.value.length>0||e.proposed.phone.value.length>0;case"customerAccount":return Ng(e);default:return e.proposed.email.value.length>0}}
66class Kg extends Error{constructor(){super("NoopVaultedSections is not implemented"),this.name="NoopVaultedSectionsError"}}class Xg{#e;#t;#s=[];#i;#r;#n;constructor(e){this.#i=e.violationsSubscription,this.#r=e.walletsViolationsSubscription,this.#n=e.walletsLastNegotiationViolationsSubscription,this.#e=u(!1),this.#t=u(!1),this.hadWalletsBillingViolations=this.#e,this.hadAmazonBillingViolations=this.#t}initialize(){this.dispose(),this.#i.hasViolations&&!Ji(this.#i.violations)&&(this.#t.value=!0),(this.#r.hasViolations||this.#n.hasViolations)&&(this.#e.value=!0),this.#s.push(se(()=>{!this.#t.value&&this.#i.hasViolations&&!Ji(this.#i.violations)&&(this.#t.value=!0)})),this.#s.push(se(()=>{!this.#e.value&&(this.#r.hasViolations||this.#n.hasViolations)&&(this.#e.value=!0)}))}dispose(){for(const e of this.#s)e();this.#s=[]}}function Qg(){return _(()=>{throw new Kg})}class Zg{constructor(){this.signal=Qg()}dispose(){}}class Jg{#e;#t;#s;#i;#r;#n;#a;#o;#d;#l;#c;#h;#u;#m;#p;#g;#f;#y;constructor(e){this.#e=e.identity,this.#t=e.proposal,this.#s=e.shop,this.#p=e.isEmbeddedPartner??!1,this.#i=e.shopPay,this.#r=e.source,this.#n=e.configuration,this.#a=e.addressManager,this.#o=Hg(this.#t),this.#d=Gg(this.#t,this.#r),this.#y=()=>new Map;const t=e.violationsSubscription??{hasViolations:!1,violations:new Set},i=e.walletsViolationsSubscription??{hasViolations:!1},r=e.walletsLastNegotiationViolationsSubscription??{hasViolations:!1};this.#f=new Xg({violationsSubscription:t,walletsViolationsSubscription:i,walletsLastNegotiationViolationsSubscription:r}),this.#l=qg(this.#t),this.#c=Wg(this.#t),this.#h=zg(this.#t),this.#u=$g(this.#t),this.#g=Qe(this.#r),this.#m=Yg(this.#t),this.signal=_(()=>({contact:this.#v(),delivery:this.#S(),payment:this.#b(),billing:this.#_()}))}dispose(){this.#f.dispose()}initializeViolationTracker(){this.#f.initialize()}#v(){return jg({identity:this.#e,proposal:this.#t,shopPay:this.#i,isEmbeddedPartner:this.#p})}#S(){switch(this.#e.current.value){case jt:return this.#m.value.length>0;case"customerAccount":{if(this.#m.value.length>0)return!0;const i=this.#t.negotiated.fields.buyerIdentity.value?.customerProfile;if(!Ks(i))return!1;const r=this.#t.negotiated.fields.shippingAddress.value,n=this.#t.proposed.shippingAddress.value,a=this.#n.addressSettings?.nonBillingAddressSettings.value;return!Bg(i)&&!Fg(i,this.#y)&&(!a||!Vg(i,this.#a.shipping.value,r,n))}case"shopPay":{const e=this.#i.user.addresses.value,t=this.#m.value;return e.length>0||t.length>0}case"sdkCartHints":{if(this.#n.isAddressDelegationEnabled)return!0;const e=this.#t.negotiated.fields.shippingAddress.value;return this.#v()&&Ug(this.#y,e)}case"businessCustomer":{const e=this.#o.value;return!(e.hasEditableShippingAddress&&!e.isValidShippingAddress)}default:return!0}}#b(){switch(this.#e.current.value){case jt:return!1;case"shopPay":{const e=this.#i.user.paymentMethods.value,t=this.#u.value,i=this.#t.negotiated.fields.isShippingRequired.value??!1;return!t&&!i?this.#i.user.addresses.value.length>0:this.#i.enableCardVaulting?e.some($s):!0}case"sdkCartHints":return this.#n.isPaymentInstrumentsDelegationEnabled;case"businessCustomer":{const t=this.#t.negotiated.fields.buyerIdentity.value?.customerProfile;if(this.#g||!Nl(t))return!1;const r=!!this.#t.negotiated.fields.paymentFlexibilityPaymentTermsTemplate.value,n=this.#c.value,a=this.#d.value,o=r||a.isCheckoutToDraft;return er({identitySource:"businessCustomer",isOrderSession:this.#g,storeVaultEnabled:this.#s.storeVaultEnabled,customerProfile:t,hasCustomerStoredPaymentMethod:this.#h.value})?!0:n||o&&!a.vaultedCardsAvailable}case"customerAccount":{if(er({identitySource:"customerAccount",isOrderSession:this.#g,storeVaultEnabled:this.#s.storeVaultEnabled,customerProfile:void 0,hasCustomerStoredPaymentMethod:this.#h.value}))return!0;const t=!!this.#t.negotiated.fields.paymentFlexibilityPaymentTermsTemplate.value,i=this.#t.negotiated.fields.paymentMethods.value,r=i?.length===1&&i[0]?.type==="deferred";return!!(t&&r)}default:return this.#l.value?!0:this.#t.proposed.paymentLines.value.length>0}}#_(){switch(this.#e.current.value){case"shopPay":{const e=this.#i.session.selectedPaymentMethod.value,t=!this.#t.negotiated.fields.managedByMarketsPro.value&&e?.paymentMethod==="IDEAL",i=e?.paymentMethod==="CUSTOM_ONSITE";return!this.#u.value||t||i}case"amazonPay":case"buyWithPrime":return this.#f.hadAmazonBillingViolations.value;case"applePay":case"googlePay":return this.#f.hadWalletsBillingViolations.value;case"payPal":return!0;default:return!1}}}class ef extends Jg{constructor(e){super(e),this.initializeViolationTracker()}}function tf({proposal:s,layout:e,shop:t,client:i}){return Bl({isApplePaySubscriptionsDecelerationActive:Hl(t),isApplePaySubscriptionReviewLayoutSupported:e.isOnePage.peek()||t.hasFlagEnabled(Vl),hasSubscriptionReviewQueryParam:i.initialRequest.url.searchParams.has(xl),isABTestActive:t.hasFlagEnabled(Ul),experiments:i.unstable_getSerialization("experiments"),isCaliforniaBillingOrShippingAddress:Fl(s.proposed.billingAddress.peek(),s.proposed.shippingAddress.peek())})}function sf({paymentLines:s,isOnePage:e}
66){return $l({paymentLines:s,isOnePage:e})?Yl(s,"PAYPAL_EXPRESS")?.method.walletContent?.isVenmo?"VENMO":"PAYPAL_EXPRESS":null}function rf({paymentLines:s,paymentMethods:e,url:t,isOnePage:i,isShopPayActive:r,isApplePaySubscriptionReviewRequired:n=!1}){const a={[sr]:t.searchParams.get(sr),[tr]:t.searchParams.get(tr)},o=t.pathname.includes("/thank-you");if(n)return"APPLE_PAY";const d=sf({paymentLines:s,isOnePage:i});return d||(Gl({paymentLines:s})?"GOOGLE_PAY":ql({paymentLines:s,isOnePage:i,isShopPayActive:r})?"APPLE_PAY":Wl({paymentLines:s,paymentMethods:e,urlParams:a,isThankYouPage:o})?At.BuyWithPrime:zl({paymentLines:s,paymentMethods:e,urlParams:a})?At.AmazonPay:null)}function nf(s){return s==="APPLE_PAY"||s==="GOOGLE_PAY"}class af{constructor({observability:e,events:t,proposal:i,isShopPayActive:r,layout:n,client:a,shop:o}){this.#e=u(null),this.#t=u(null),this.#s=u(null),this.#i=u(!1),this.#r=u(!1),this.#n=u(!1),this.isDeceleratingSignal=this.#i,this.#a=e,this.#o=t,this.activeSession=this.#e,this.escalatedWallet=this.#s,this.isAcceleratedWalletEscalation=_(()=>nf(this.#s.value)),this.lastClicked=this.#t,this.hasConsumedApplePaySubscriptionReviewParam=this.#r,this.hasActiveApplePaySubscriptionReview=this.#n;const d=a.initialRequest.url,l=tf({proposal:i,layout:n,shop:o,client:a}),c=rf({paymentLines:i.proposed.paymentLines.peek(),paymentMethods:i.negotiated.fields.paymentMethods.peek(),url:d,isOnePage:n.isOnePage.peek(),isShopPayActive:r,isApplePaySubscriptionReviewRequired:l});c&&(this.#s.value=c,this.#a.leaveErrorBreadcrumb(`escalatedWallet initialized to "${c}"`,{escalatedWallet:c})),l&&(this.#i.value=!0)}#e;#t;#s;#i;#r;#n;#a;#o;#d(){return this.#e.peek()!=null||this.#s.peek()!=null}#l(e){const t=this.#d();e!==t&&this.#o.dispatchEvent(t?new jl:new Kl)}setIsDecelerating(e){this.#i.value=e}consumeApplePaySubscriptionReviewParam(){this.#r.value=!0}setHasActiveApplePaySubscriptionReview(e){this.#n.value=e}setEscalatedWallet(e){const t=this.#d();this.#s.value=e,this.#a.leaveErrorBreadcrumb(`escalatedWallet set to "${e}"`,{escalatedWallet:e}),this.#l(t)}setActiveSession({newValue:e,asPaymentMethod:t}){const i=this.#e.value;i!==null&&e!==i.wallet&&this.#a.error(new ir(`Wallet "${e}" started session while another wallet "${i.wallet}" was already active`,{metadata:{conflictType:"StartConflict",wallet:{invoking:e,active:i}}})),this.#a.leaveErrorBreadcrumb(`activeSession set to "${e}"`,{activeSession:e,asPaymentMethod:t});const r=this.#d();this.#e.value={wallet:e,asPaymentMethod:t},e!==null&&(this.#t.value=e),this.#l(r)}clearActiveSession({invokingWallet:e}){const t=this.#e.value,i=this.#d();this.#e.value=null,this.#n.value=!1,t!==null&&e!==t.wallet&&this.#a.error(new ir(`Wallet "${e}" cleared session set by another wallet "${t.wallet}"`,{metadata:{conflictType:"ClearConflict",wallet:{invoking:e,active:t}}})),this.#a.leaveErrorBreadcrumb(`activeSession cleared by "${e}"`),this.#l(i)}}class of{constructor({serializations:e,receipt:t,profile:i,source:r,checkoutContextData:n,themeData:a,shop:o,mobileCheckoutSdk:d,client:l,persistence:c,shopPay:h,shopPayIsActive:b,requestInfoData:g,isEmbedded:v,isEmbeddedPartner:E,observability:y,userEvents:p,embed:f,events:m,graphql:{coreGraphql:A,shopPayGraphql:I,throttleGraphql:P},i18n:T,router:R,initialNegotiationData:M,url:k,eagerlyLoadAppMetafields:O}){this.#n=u(null),this.crossBorderConfirmState=this.#n;const w=o.hasFlagEnabled(Xl);this.#e=t??u(void 0),this.latestReceipt=this.#e,this.#t=u(e.get("checkpointData")),this.checkpointToken=this.#t,this.#i=u(!!e.get("forcedRedesignWallet")),this.isCheckoutLayoutForcedToOnePage=this.#i;const D=new Ym({serializations:e,isCheckoutLayoutForcedToOnePage:this.#i}),{initialRequest:{url:G}}=l;this.validation=new Og,this.address=new Jh({extendedAddressModePolicy:b?bh(h.user):Ql(o),graphql:A,i18n:T,initialCountryDetails:[g?.httpRequestInfo?.geolocation?.country,g?.shop?.defaultShippingDetails?.country,o.country]});const U=new kg({negotiateFromSessionData:M,router:R,url:k,source:r,shop:o,isOnePageCheckout:D.isOnePage.value,observability:y,persistence:c,isShopPayActive:b,checkoutContextData:n,requestInfoData:g??{},extendedAddressMode:this.address.extendedAddressMode,receipt:this.#e.peek()});this.proposal=U,tp({proposal:U,observability:y,shop:o,isOnePageCheckout:D.isOnePage.peek()});const C=ag({negotiatedFields:U.negotiated.fields,captureAtFulfillmentEnabled:o.captureAtFulfillmentEnabled});this.isPaymentRequired=C.isPaymentRequired,this.paymentExemptionReason=C.paymentExemptionReason,this.#s=u(!1),this.isRedirectingExter
66nally=this.#s,this.wallets=new af({observability:y,events:m,proposal:U,isShopPayActive:b,layout:D,shop:o,client:l}),this.identity=new Bm({observability:y,wallets:{shopPayIsActive:b,escalatedWalletSignal:this.wallets.escalatedWallet},protocols:{isEmbedded:v,isEmbeddedPartner:!!E,mobileCheckoutSdk:d},shop:o,proposal:U}),this.identity.initialize();const Y=new $m({proposal:U,source:r,shop:o,shopPay:h,identity:this.identity});this.installments=Y,this.cardNetworkSelection=new np,this.offsitePopupController=new Xm({observability:y}),this.configuration=new bm({serializations:e,layout:D,proposal:U,source:r,appConfiguration:n.appConfiguration,themeData:a,shop:o,profile:i,mobileCheckoutSdk:d,client:l,shopPay:h,requestInfoData:g,router:R,renderContextToken:new Rg({token:G.searchParams.get("rctx")??void 0}),identity:this.identity,embed:f,observability:y}),this.extensibility=new Om({activatedExtensions:i?.activatedExtensions??[],client:l,configuration:this.configuration,eagerlyLoadAppMetafields:O,events:m,graphql:A,identity:this.identity,isCheckoutEditor:this.configuration.branding.shell.configuration.environment.isCheckoutEditor??!1,observability:y,persistence:c,proposal:U,serializedReceipt:e.get("receipt"),shop:o,source:r}),this.addressManager=new Xh({identity:this.identity,observability:y,userEvents:p,proposal:U,wallets:this.wallets,graphql:{coreGraphql:A,shopPayGraphql:I,throttleGraphql:P},i18n:T,address:this.address,configuration:this.configuration,shop:o,shopPay:h,source:r,router:R,initialNegotiationData:M}),this.isShippingRequired=_(()=>si(U)),this.#r=u(!0),this.supportsSplitShipping=this.#r,this.unstable_evaluateSupportsSplitShipping(G),this.unstable_graphqlDataRequestInfo=g??void 0,this.paymentMethodPromotions=new og,this.thankYouEntrance=new lo({progress:e.get("fastThankYouProgress")===!0?new co:void 0}),this.checkoutExit=new ap,this.vaultedSections=w?new ef({configuration:this.configuration,addressManager:this.addressManager,identity:this.identity,proposal:U,shop:o,shopPay:h,source:r,isEmbeddedPartner:E}):new Zg,this.sections=w?new Mg({configuration:this.configuration,installments:Y,isShippingRequired:this.isShippingRequired,vaultedSections:this.vaultedSections,source:r,proposal:U,identity:this.identity,shop:o,embed:f}):new Zl,this.rememberMe=new Ig({url:k,shop:o,source:r,shopPayIsActive:b,receipt:this.latestReceipt.value,observability:y})}#e;#t;#s;#i;#r;#n;unstable_setRedirectingExternally(e){this.#s.value=e}unstable_evaluateSupportsSplitShipping(e){const t=Lg(e);this.#r.value=t}setCrossBorderConfirmState(e){this.#n.value=e}unstable_overwriteLatestReceipt(e){this.#e.value=e}unstable_overwriteCheckpointToken(e){this.#t.value=e}unstable_forceCheckoutLayoutToOnePage(){this.#i.value=!0}unstable_clearForcedCheckoutLayout(){this.#i.value=!1}}function na(s){return{status:"abandoned",id:`gid://shopify/ProcessedReceipt/${s.id}`}}function df({serializedReceipt:s,receiptForUI:e}){if(s?.status==="abandoned")return u(na(s));const t=s?.latestReceipt;return!t||t.__typename==="ReceiptNotFound"?u(void 0):u(e(t))}function lf({serializedReceipt:s,sessionFinished:e}){if(e===!1||Jl(s))return ec()}async function cf({serializedReceipt:s,observability:e}){if(s?.status==="abandoned")return u(na(s));const t=s?.latestReceipt;if(!t||t.__typename==="ReceiptNotFound")return u(void 0);if(ih(t))return u(rh(t));let i;try{i=await tc()}catch(r){const n=t.__typename==="ProcessedReceipt"?s?.orderStatusPageUrl??t.orderStatusPageUrl:void 0,a=t.__typename==="ProcessedReceipt"&&!n?Wu(t):void 0;if(e.leaveErrorBreadcrumb("[Receipt] Receipt mapper failed to load during browser boot",{error:String(r),fallbackReceiptStatus:a?.status,receiptType:t.__typename}),a)return u(a);if(t.__typename==="ProcessedReceipt"&&n)return window.location.replace(n),u(void 0);throw r}return df({serializedReceipt:s,receiptForUI:i})}class uf{constructor(e={}){this.markedAsComplete=!1,this.markedAsUsable=!1,this.loaderPreviouslyRegistered=!1,this.loaders=new Set,this.loaderFinishedCallbacks=new Set,this.eventHandlers=new Set,this.navigationHandlers=new Set,this.initialNavigationFinished=!1,this.navigationInFlight=!0,this.navigationStart=0,this.#e=u(!1),this.timeOrigin=e.timeOrigin??hf(),this.initialLoading=this.#e}#e;get loaderCount(){return this.loaders.size}get navigationStartTime(){return this.navigationStart}start({timeStamp:e=performance.now()}={}){this.navigationStart=e,this.navigationInFlight=!0}usable(e=performance.now()){this.initialLoading.value?this.markedAsUsable=!0:this.emitUsable(e)}finish(e=performance.now()){this.initialLoading.value?this.markedAsComplete=!0:this.emitNavigation()}cancelNavigation(e=performance.now()){this.emitNavigation()}mark(e,t){}on(...[e,t]){return e==="initialLoadingFinish"?(this.loaders.size===0?t():this.loaderFinis
66hedCallbacks.add(t),()=>this.loaderFinishedCallbacks.delete(t)):e==="event"?(this.eventHandlers.add(t),()=>this.eventHandlers.delete(t)):(this.navigationHandlers.add(t),this.initialNavigationFinished&&t(),()=>this.navigationHandlers.delete(t))}addLoader(e){return this.loaders.size===0&&(this.#e.value=!0,this.loaderPreviouslyRegistered=!0),this.loaders.add(e),()=>{this.loaders.delete(e),this.loaders.size===0&&this.finishInitialLoading()}}finishInitialLoading(){if(this.initialLoading.value){this.#e.value=!1,this.markedAsUsable&&this.emitUsable(performance.now()),this.markedAsComplete&&this.emitNavigation();for(const e of this.loaderFinishedCallbacks)e()}}emitUsable(e){const t={type:sc,start:e,duration:0};for(const i of this.eventHandlers)i(t)}emitNavigation(){if(this.navigationInFlight){this.navigationInFlight=!1,this.initialNavigationFinished=!0;for(const e of this.navigationHandlers)e()}}}function hf(){return typeof performance>"u"?0:performance.timeOrigin||Date.now()-performance.now()}class pf{constructor({rootElement:e,serializations:t}){this.prefersDarkMode=mf("(prefers-color-scheme: dark)"),this.#e=u(!1),this.apiClientId=t.get("apiClientId")??0,this.enableAgenticCardEntry=u(t.get("enableAgenticCardEntry")===!0),this.rootElement=e,this.#t=t,this.isFirstMeaningfulInteractionMarked=this.#e,this.cookies=new gf(this.#t),this.userAgent=window.navigator.userAgent;const i=t.get("clientBundleInfo");this.assets={assetsBase:i.assetsBase,extensionsBase:i.extensionsBase,postPurchaseExtensionsBase:i.postPurchaseExtensionsBase,isBaselineBrowser:i.format==="system"};const r=new URL(window.location.href),n=t.get("serverRender")==="yes"&&e.hasChildNodes();this.initialRequest={url:r,isServerRendered:n,isCheckoutEditor:t.get("isCheckoutEditor")},this.unstable_legacyNavigationPerformance=new uf}#e;#t;markFirstMeaningfulInteraction(){this.#e.value=!0}prepare(){this.#s()}unstable_getSerialization(e){return this.#t.get(e)}#s(){const e=this.#t.get("sourceToken"),t=ic(fe.SourceToken);e&&t!==e&&(rc(fe.ExtensionStorage),nc(fe.SourceToken,e))}}function mf(s){const e=window.matchMedia(s),t=e.matches,i=u(t),r=a=>{i.value=a.matches};return typeof e?.addEventListener=="function"?e.addEventListener("change",r):e?.addListener?.(r),i}class gf{#e;constructor(e){this.#e=e}get(e){const t=ff(document.cookie).get(e);if(t!==void 0)return t;if(e==="_shopify_y")return xi(this.#e?.get("shopifyY"),this.#e?.get("shopifyYExpiration"));if(e==="_shopify_s")return xi(this.#e?.get("shopifyS"),this.#e?.get("shopifySExpiration"))}set(e,t,{expiry:i,maxAge:r,path:n="/",sameSite:a=null}={}){let o=`${e}=${t}; secure`;if(r==null){let d=i;d||(d=new Date,d.setFullYear(d.getFullYear()+1)),o+=`; expires=${d.toUTCString()}`}else o+=`; max-age=${r}`;o+=`; path=${n}`,a&&(o+=`; samesite=${a}`),document.cookie=o}delete(e,t="/"){this.set(e,"",{maxAge:0,path:t})}}function ff(s){const e=new Map;for(const t of s.split(";")){const i=t.trim(),r=i.indexOf("=");if(r<=0)continue;const n=i.slice(0,r).trim();!n||e.has(n)||e.set(n,i.slice(r+1).trim())}return e}class yf{#e;constructor(e=vf()){this.#e=e}get(e){return this.#e[e]}}function vf(){const s={},e=document.querySelectorAll('meta[name^="serialized-"]');for(const t of e){const i=t.getAttribute("name")?.replace("serialized-","");s[i]=_f(t)}return s}function _f(s){const e=s.getAttribute("content");try{return e?JSON.parse(e):void 0}catch{return}}class bf{#e;constructor(e){this.#e=e}get consentProvider(){return this.#e.consentProvider}get trackingConsentHeader(){return this.#e.trackingConsentHeader}get currentVisitorConsent(){return this.#e.currentVisitorConsent}get trackingConsentSelection(){return this.#e.trackingConsentSelection}get analyticsProcessingAllowed(){return this.#e.analyticsProcessingAllowed}get preferencesProcessingAllowed(){return this.#e.preferencesProcessingAllowed}get marketingAllowed(){return this.#e.marketingAllowed}get saleOfDataAllowed(){return this.#e.saleOfDataAllowed}get shouldShowBanner(){return this.#e.shouldShowBanner}merchantAllowedProcessing(){return this.#e.merchantAllowedProcessing()}merchantVisitorConsent(){return this.#e.merchantVisitorConsent()}get saleOfDataRegion(){return this.#e.saleOfDataRegion}get getRegion(){return this.#e.getRegion}
66merchantMetafields(){return this.#e.merchantMetafields()}setTrackingConsent(e,t){return this.#e.setTrackingConsent(e,t)}acceptAll(){return this.#e.acceptAll()}rejectAll(){return this.#e.rejectAll()}setPrefetchedConsent(e,t){this.#e.setPrefetchedConsent(e,t)}dispose(){this.#e.dispose()}}const Sf=[408,429,430,500,502,503,504],Af={analytics:Nt.NO_VALUE,marketing:Nt.NO_VALUE,preferences:Nt.NO_VALUE,saleOfData:Nt.NO_VALUE},Ef=[me.CONSENT_COLLECTED,me.TRACKING_ACCEPTED,me.TRACKING_DECLINED,me.ANALYTICS_ACCEPTED,me.ANALYTICS_DECLINED,me.PREFERENCES_ACCEPTED,me.PREFERENCES_DECLINED,me.MARKETING_ACCEPTED,me.MARKETING_DECLINED,me.SALE_OF_DATA_ACCEPTED,me.SALE_OF_DATA_DECLINED];class aa{#e;#t;#s;#i=[];constructor(e){this.observability=e.observability,this.#e=u(this.#a()),this.#t=u(this.#d()),this.#s=u(this.#o()),this.currentVisitorConsent=this.#t,this.analyticsProcessingAllowed=_(()=>this.#e.value.analytics),this.marketingAllowed=_(()=>this.#e.value.marketing),this.preferencesProcessingAllowed=_(()=>this.#e.value.preferences),this.saleOfDataAllowed=_(()=>this.#e.value.saleOfData),this.saleOfDataRegion=_(()=>this.#s.value.saleOfDataRegion),this.getRegion=_(()=>this.#s.value.region),this.shouldShowBanner=e.shouldShowBanner??_(()=>this.#s.value.shouldShowBanner),this.#n()}dispose(){this.onDispose();for(const{event:e,handler:t}of this.#i)document.removeEventListener(e,t);this.#i=[]}onDispose(){}#r(){Xe(()=>{this.#e.value=this.#a(),this.#t.value=this.#d(),this.#s.value=this.#o()})}#n(){const e=()=>{this.#r()};for(const t of Ef)document.addEventListener(t,e),this.#i.push({event:t,handler:e})}#a(){return{analytics:ln(),marketing:dn(),preferences:on(),saleOfData:an()}}#o(){return{shouldShowBanner:vo(),saleOfDataRegion:yo(),region:fo()}}#d(){const e=cn();return"analytics"in e?{analytics:e.analytics,marketing:e.marketing,preferences:e.preferences,saleOfData:e.sale_of_data}:Af}}class Pf extends aa{constructor(e){super({observability:e.observability}),this.consentProvider="consent-tracking-api"}get trackingConsentHeader(){}merchantAllowedProcessing(){return{analytics:ln(),marketing:dn(),preferences:on(),saleOfData:an()}}merchantVisitorConsent(){const e=cn();return"analytics"in e?{analytics:e.analytics,marketing:e.marketing,preferences:e.preferences,sale_of_data:e.sale_of_data}:{analytics:"",marketing:"",preferences:"",sale_of_data:""}}merchantMetafields(){return _o()}async setTrackingConsent(e,t){try{return await new Promise(i=>{bo({analytics:e.analytics,marketing:e.marketing,preferences:e.preferences,sale_of_data:e.saleOfData,storefrontAccessToken:e.storefrontAccessToken,isExtensionToken:e.isExtensionToken,...e.metafields?.length&&{metafields:e.metafields}},(r,n)=>{if(n)t?.(null,n),i({success:!0});else{const a=this.#e(r),o=this.#t(r);this.#s(a),t?.({error:a,statusCode:o},!1),i({success:!1,error:a,statusCode:o})}})})}catch(i){const r=i instanceof Error?i.message:"Failed to set consent";return this.#s(r),t?.({error:r},!1),{success:!1,error:r}}}async acceptAll(){return this.setTrackingConsent({analytics:!0,marketing:!0,preferences:!0})}async rejectAll(){return this.setTrackingConsent({analytics:!1,marketing:!1,preferences:!1})}setPrefetchedConsent(e){this.observability.counter({name:"merchant_consent_manager_unsupported_method",value:1,attributes:{method:"setPrefetchedConsent"}}),this.observability.log("merchant_consent_manager_unsupported_method","setPrefetchedConsent() called on MerchantConsentManager - this is a no-op. This method is only supported by ShopConsentManager.")}#e(e){return e instanceof Error?e.message:typeof e=="object"&&e&&"error"in e?String(e.error):"Failed to set consent"}#t(e){if(typeof e=="object"&&e&&"statusCode"in e&&typeof e.statusCode=="number")return e.statusCode}#s(e){this.observability.counter({name:"merchant_consent_manager_error",value:1,attributes:{operation:"setTrackingConsent"}}),this.observability.log("merchant_consent_manager_error",`Failed to call setTrackingConsent() from the consent-tracking-api package in MerchantConsentManager: ${e}`)}}const Cf={id:"210f9c0e85a293621a1ecbb93c76ec9d4f12e6348d8144935c00bdf25bcb6f81",type:"mutation",name:"UserPrivacySettingsSet",source:"mutation UserPrivacySettingsSet($input:UserPrivacySettingsSetInput!){userPrivacySettingsSet(userPrivacySettingsSetInput:$input){userPrivacySettings{...UserPrivacySettingsFragment __typename}userErrors{field message __typename}__typename}}fragment UserPrivacySettingsFragment on UserPrivacySettings{dataSharingOptOut trackingConsentHeader consent{analytics{consented providedAt isExpired defaultConsented __typename}marketing{consented providedAt isExpired defaultConsented __typename}displayBanner __typename}__typename}"};
66class Or extends Error{constructor(){super(...arguments),this.name="ShopConsentManagerError"}}class Nr extends Error{constructor(){super(...arguments),this.name="ShopConsentManagerUserChangedError"}}const Ms="Shop Pay user changed while setting consent",Br="shop_consent_manager_error",Tf=3,kf=1,Fr="3.amps",wf="3.Amps",If="3.AMpS",Rf=new Set(["AU"]),Vt=!0;class Mf extends aa{constructor(e){e.prefetchedConsent?.trackingConsentHeader&&gt(e.prefetchedConsent.trackingConsentHeader);const t=u(Vt);super({observability:e.observability,shouldShowBanner:t}),this.#a=Vt,this.consentProvider="shop-pay-consent-provider",this.#r=t,this.#n=u(void 0),this.trackingConsentSelection=this.#n,this.#d=e.prefetchedConsent?.trackingConsentHeader,this.#i=bu(e.merchantTrackingConsent),this.#e=e.shopPayGraphql,this.#t=e.shopPay,this.#l=e.countryCode?.toUpperCase(),this.#s=this.#m()}#e;#t;#s;#i;#r;#n;#a;#o;#d;#l;get trackingConsentHeader(){return this.#d}merchantAllowedProcessing(){return this.#i.allowedProcessing}merchantVisitorConsent(){return this.#i.visitorConsent}merchantMetafields(){return[]}async setTrackingConsent(e,t){if(e.preferences!==void 0){const r="setTrackingConsent() does not support preferences in ShopConsentManager. Preferences consent is only available in MerchantConsentManager.";return t?.({error:r},!1),{success:!1,error:r}}if(e.saleOfData!==void 0){const r="setTrackingConsent() does not support saleOfData in ShopConsentManager, only in MerchantConsentManager. Sale of data follows an opt-out flow with separate UI in Shop Pay.";return t?.({error:r},!1),{success:!1,error:r}}if(e.metafields!==void 0&&e.metafields.length>0){const r="setTrackingConsent() does not support metafields in ShopConsentManager. Metafields are only available in MerchantConsentManager.";return t?.({error:r},!1),{success:!1,error:r}}const i=this.#t.user.shopAccountUuid.value;try{const r={consent:{analyticsEnabled:e.analytics,marketingEnabled:e.marketing}},n=await ts(async()=>{if(!this.#h(i))throw new Nr(Ms);const{data:l,error:c}=await this.#e.mutate(Cf,{variables:{input:r}});if(c)throw c;if(!l)throw new Or("No data returned from mutation");return l},{shouldRetry:l=>this.#h(i)&&this.#y(l),maxAttempts:Tf,initialRetryDelay:kf});if(!this.#h(i))return this.#u(t);const a=n.userPrivacySettingsSet.userErrors;if(a&&a.length>0){const l=a.map(c=>c.message).join("; ");return this.#b("set",new Or(l)),t?.({error:l},!1),{success:!1,error:l}}const o=n.userPrivacySettingsSet.userPrivacySettings??void 0;o&&this.#c(o);const d=o?.trackingConsentHeader;return d&&(this.#d=d,gt(this.#d)),t?.(null,!0),{success:!0}}catch(r){if(r instanceof Nr||!this.#h(i))return this.#u(t);const n=r,a=n.message??"Failed to set consent";return this.#b("set",n),t?.({error:a},!1),{success:!1,error:a}}}async acceptAll(){return this.setTrackingConsent({analytics:!0,marketing:!0})}async rejectAll(){return this.setTrackingConsent({analytics:!1,marketing:!1})}setPrefetchedConsent(e,t){if(t!==void 0&&!this.#h(t))return;this.#c(e);const i=e?.trackingConsentHeader;this.#d=i??this.#p(),gt(this.#d)}onDispose(){this.#s()}#c(e){const t=Su(e);this.#a=t?.displayBanner??Vt,this.#r.value=t?Au(t):Vt,this.#n.value=t?Eu(t):void 0}#h(e){return this.#t.user.shopAccountUuid.value===e}#u(e){return e?.({error:Ms},!1),{success:!1,error:Ms}}#m(){return se(()=>{const e=this.#t.user.shopAccountUuid.value;if(this.#o===void 0){this.#o=e;return}this.#o!==e&&(this.#o=e,this.#r.value=this.#a,this.#n.value=void 0,this.#d=e===""?this.#g():this.#p(),gt(this.#d))})}#p(){return this.#f()??(this.#a?Fr:If)}#g(){return this.#f()??Fr}#f(){return this.#l&&Rf.has(this.#l)?wf:void 0}#y(e){return e instanceof Yt?!0:e instanceof nt?Sf.includes(e.response.status):!1}#v(e){if(e instanceof Yt)return"network";if(e instanceof nt){const t=e.response.status;if(t>=400&&t<500)return"4xx";if(t>=500&&t<600)return"5xx"}return"other"}#S(e){if(e instanceof nt)return e.response.status}#b(e,t){const i=this.#v(t);this.observability.counter({name:Br,value:1,attributes:{operation:e,errorCategory:i}}),this.observability.log(Br,`Failed to ${e} shop user consent`,{error:t,errorCategory:i,statusCode:this.#S(t),isRetryable:this.#y(t)})}}class Df extends bf{constructor(e){const t=e.shopPayIsActive&&e.useShopConsent?new Mf({shopPayGraphql:e.shopPayGraphql,observability:e.observability,shopPay:e.shopPay,merchantTrackingConsent:e.merchantTrackingConsent,prefetchedConsent:e.prefetchedTrackingConsentHeader?{trackingConsentHeader:e.prefetchedTrackingConsentHeader}:void 0,countryCode:e.countryCode}):new Pf({observability:e.observability});super(t)}}const Lf={logging:1,metrics:2,monorail:4,preact:8,graphqlTiming:16};function Of(s){return Object.entries(Lf).reduce((e,[t,i])=>
66(e[t]=!!(s&i),e),{})}class Nf{constructor({serializations:e}){const{commitSha:t,debug:i,deployStage:r,previewBranch:n,services:a}=e.get("environment");this.commitSha=t??"unknown",this.debug=Of(i??0),this.deployStage=r??"production",this.previewBranch=n,this.services={...Pn,...a}}}class Bf{#e=new EventTarget;dispatchEvent(e){return this.#e.dispatchEvent(e)}addEventListener(e,t,i){this.#e.addEventListener(e,t,i)}}function Ff(s){const e=s==="sim",t=typeof window<"u"&&window!==window.parent;return e&&t&&!ni()}const Uf=["_cmp_a","_tracking_consent","cart","discount_code","dynamic_checkout_shown_on_cart","remember_me","_shop_app_essential"],xf=["channel","profile_preview_token","simulated_preview_token","previewCustomerType","embed_express_checkout",ac];function Vf({searchParams:s,userAgent:e}){const t=s.get("embed");if(t)return t;const i=s.get(Cn);if(i){const r=[`version=${i}`],n=s.get(oc),a=s.get(Tn),o=s.get(kn),d=s.get(wn),l=rr(e)||dc(i)&&lc(o);if(n&&r.push(`authentication=${n}`),a&&r.push(`colorscheme=${a}`),l){const h=d?.toLowerCase()==="app"?"app":"shop";r.push(`branding=${h}`)}l&&o&&!rr(e)&&(r.push(`library=CheckoutKit/${o}`),r.push("platform=web"));let c="web";return e&&(c=cc.test(e)?"mobile":"web"),r.push(`platformcategory=${c}`),r.join(",")}}class Hf extends URL{constructor({shop:e,persisted:t,shopPay:i},r){let n;e&&i?n=`/checkout/${Je(e.id)}`:n="/checkouts",super(t?`${n}/internal/graphql/persisted`:`${n}/unstable/graphql`,r)}}function Gf(s){return s==null?!1:JSON.stringify(s)!=="{}"}function oa(s){const e=s?.headers.get("x-request-id"),t=s?.headers.get("cf-ray");return{...e?{"x-request-id":e}:{},...t?{"cf-ray":t}:{}}}const Ds="FoundationGraphQL";class qf extends Js{constructor(e){const{fetch:t,cache:i}=Wf(e);super(t,i)}}function Wf({environment:s,observability:e,serializations:t,isShopPayActive:i,userAgent:r,getTrackingConsentHeader:n,getWebMcpToolName:a}){const o=t.get("shop"),d=document.documentElement.lang,l=t.get("graphql"),c=t.get("sessionToken"),h=t.get("encodedBuyerSessionForHeaderTransport"),b=t.get("sourceToken")??"unknown",g=t.get("sourceType")??"unknown",v=t.get("universalCheckoutSessionId"),E=t.get("shopPayConfig"),y=t.get("serverHandling")??"",p=t.get("serverRender")??"no",f=new Map(l?Object.entries(l):[]),m={"Accept-Language":d,"X-Checkout-Web-Deploy-Stage":s.deployStage,"X-Checkout-Web-Build-Id":s.commitSha,"X-Checkout-Web-Source-Id":b,"X-Checkout-One-Session-Token":c,"X-Checkout-Web-Server-Handling":y,"X-Checkout-Web-Server-Rendering":p,"Shopify-Checkout-Source":`id="${b}", type="${g}"`};v&&(m["Shopify-Universal-Checkout-Source"]=`id="${v}", type="uc"`),h&&(m["Shopify-Session-Essential"]=`payload=${h}`);const A=new URLSearchParams(location.search),I=Vf({searchParams:A,userAgent:r});I&&(m["Shopify-Checkout-Embed"]=I),i&&(E?.callback_token&&(m["X-Shop-Pay-Token"]=E.callback_token),E?.tracking_visit&&E?.tracking_unique&&(m["X-Shopify-VisitToken"]=E.tracking_visit,m["X-Shopify-UniqueToken"]=E.tracking_unique),E?.tracking_consent&&!o?.enabledFlags?.includes(In)&&(m["X-Shopify-Tracking-Consent"]=E.tracking_consent));const P=new URLSearchParams(location.search),T=P.get("preview"),R=P.get("duration"),M=Object.fromEntries(xf.map(w=>[w,P.get(w)]).filter(w=>w[1]!==null));T&&(m["Shopify-Checkout-Queue-Preview"]=T,R&&(m["Shopify-Checkout-Queue-Duration"]=R));const k=P.get("simulated_preview_token");return k&&Ff(t.get("sourceType"))&&(m["X-Shopify-Editor-Access-Token"]=k),{fetch:ei({url:w=>new Hf({shop:o,persisted:w.query.source==="",shopPay:i},location.href),method:w=>w.query.source!==""||w.query.type==="mutation"||Gf(w.variables)?"POST":"GET",source:w=>w.query.source!=="",headers(){const w={...m},D=n();D&&(w["X-Shopify-Tracking-Consent"]=D);const G=a?.();return G&&(w["Shopify-Checkout-Webmcp-Tool"]=G),w},credentials:"same-origin",explicitSearchParams:M,onResult({query:w,result:D,response:G,duration:U}){const{name:C}=w;D.error&&at(D.error,{observability:e,fileContext:Ds,queryName:C,documentId:w.id||void 0,requestId:G.headers.get("x-request-id")??void 0}),Ur({observability:e,name:C,duration:U,response:G})},onError({query:w,error:D,response:G,duration:U}){const{name:C}=w;G?.status===400&&typeof document<"u"&&(e.leaveErrorBreadcrumb(`Clearing non-essential cookies due to GraphQLFetchHttpBadRequestError on ${Ds}:Query::${C}`,{totalCookies:document.cookie.split(";").length,totalSize:`${encodeURI(document.cookie).split(/%..|./).length-1} bytes`}),zf()),at(D,{observability:e,fileContext:Ds,queryName:C,documentId:w.id||void 0}),Ur({observability:e,name:C,duration:U,response:G}),G?.redirected&&location.replace(G.url)}}),cache:f}}function Ur({observability:s,name:e,duration:t,response:i}){s.histogram({name:"response_timing_and_status",value:t,attributes:{queryName:e,status:i?.status??"noResponse"}}),s.log("checkout_graphql_fetch_finished",`[GraphQL][core] ${e} request finished`,{queryName:e,duration:t,"attrs.http.response.status_code":i?.status??"noResponse",...oa(i),pageLoadId:oi})}function zf(){document.cookie.split(";
66").forEach(e=>{const t=e.split("=",2)[0].trim();Uf.includes(t)||(document.cookie=`${t} =; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`)})}const Ls="ShopPayGraphQL";class $f extends Js{constructor(e){const{fetch:t,cache:i}=Yf(e);super(t,i)}}function Yf({serializations:s,environment:e,observability:t,shopPay:i,isEmbedded:r,getTrackingConsentHeader:n}){const a=document.documentElement.lang,o=new URL("/pay/users/graphql",e.services.shopServer.url),d=s.get("shopPayGraphql"),l=s.get("serverHandling")??"",c=s.get("serverRender")??"no",h=s.get("sourceToken")??"unknown",b=new Map(d?Object.entries(d):[]),g={"Accept-Language":a,"X-Checkout-Web-Deploy-Stage":e.deployStage,"X-Checkout-Web-Build-Id":e.commitSha,"X-Checkout-Web-Source-Id":h,"X-Checkout-Web-Server-Handling":l,"X-Checkout-Web-Server-Rendering":c};if(r){g["X-ShopPay-Embedded-Request"]="true";const y=s.get("shop").id;if(y){const p=uc(y);p!=null&&!Number.isNaN(p)&&(g["X-ShopPay-Embedded-Request-Shop-Id"]=String(p))}}i.isExternal&&(g["X-Checkout-Web-Checkout-Version"]=hc.ShopPayExternal);const v=ei({url:o,headers(){const y={...g},p=n();if(p&&(y["X-Shopify-Tracking-Consent"]=p),i.shouldUseAccessToken){const f=i.accessToken.value;f&&(y.Authorization=`Bearer ${f}`)}return y},onResult({query:y,result:p,response:f,duration:m}){const{name:A}=y,{error:I}=p;E({name:A,duration:m,response:f});const P=f.headers.get("x-request-id");I&&!pc(I)?at(I,{observability:t,fileContext:Ls,queryName:A}):t.leaveErrorBreadcrumb(`${Ls}:Query::${A}`,{name:A,requestId:P,entrypoint:"shop-pay"})},onError({query:y,error:p,response:f,duration:m}){const{name:A}=y;at(p,{observability:t,fileContext:Ls,queryName:A}),E({name:A,duration:m,response:f})}});function E({name:y,duration:p,response:f}){t.histogram({name:"shop_pay_response_timing_and_status",value:p,attributes:{queryName:y,status:f?.status??"noResponse"}}),t.log("shop_pay_checkout_graphql_fetch_finished",`[GraphQL][shoppay] ${y} request finished`,{queryName:y,duration:p,"attrs.http.response.status_code":f?.status??"noResponse",...oa(f)})}return{fetch:v,cache:b}}class jf extends Error{constructor(){super(...arguments),this.name="MissingGraphQLEndpointError"}}const Os="ThrottleContextGraphQL";class Kf extends Js{#e;constructor(e){const t={current:void 0};super(Xf(e,t)),this.#e=t}setPollUrl(e){this.#e.current=e}}function Xf({environment:s,observability:e,serializations:t},i){const r=document.documentElement.lang,n=t.get("sourceToken")??"unknown",a=t.get("serverHandling")??"",o={"Accept-Language":r,"X-Checkout-Web-Deploy-Stage":s.deployStage,"X-Checkout-Web-Build-Id":s.commitSha,"X-Checkout-Web-Source-Id":n,"X-Checkout-Web-Server-Handling":a,"X-Queue-Session-Fallback":"true"};return ei({url(){if(!i.current)throw new jf("A GraphQL endpoint must be provided");return i.current},method:"POST",credentials:"same-origin",headers:o,onResult({query:d,result:l,response:c}){const{name:h}=d,{error:b}=l,g=c.headers.get("x-request-id");b?at(b,{observability:e,fileContext:Os,queryName:h}):e.leaveErrorBreadcrumb(`${Os}:Query::${h}`,{name:h,requestId:g,entrypoint:"throttled"})},onError({query:d,error:l}){at(l,{observability:e,fileContext:Os,queryName:d.name})}})}class Qf extends So{constructor({shop:e,locale:t,direction:i,translations:r,onError:n}){super({locale:t,direction:i,currency:e.currencyCode,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,fallbackTimeZone:e.timeZone,onError:n},Ao(r,e.translations))}}function Zf(s=document.documentElement){const e=s.dir.toLowerCase();return e==="ltr"||e==="rtl"?e:void 0}class Jf extends Qf{constructor(e){super({...e,direction:e.direction??Zf()})}}class ey extends Array{constructor(){super(),this.identify=this.factory("identify"),this.page=this.factory("page"),this.ready=this.factory("ready"),this.track=this.factory("track"),this.trackForm=this.factory("trackForm"),this.trackLink=this.factory("trackLink")}factory(e){return(...t)=>{if(t.unshift(e),this.push(t),window.__TREKKIE_SHIM_QUEUE&&(e==="track"||e==="page"))try{window.__TREKKIE_SHIM_QUEUE.push({from:"trekkie-stub",method:e,args:t.slice(1)})}catch{}return this}}}function ty(){const s=globalThis;window.__TREKKIE_SHIM_QUEUE||Object.defineProperty(window,"__TREKKIE_SHIM_QUEUE",{value:[],enumerable:!1,writable:!1,
66configurable:!0}),s.trekkie=s.trekkie||new ey,s.ShopifyAnalytics=s.ShopifyAnalytics||{},s.ShopifyAnalytics.lib=s.ShopifyAnalytics.lib||s.trekkie}const sy="d194d16e5af0f76897128b2df7483be8";function da(s){return s==="production"||s==="canary"||s==="tophat"}const iy="Unable to preload CSS for",ry="Permission denied to access property",ny=["Failed to execute 'appendChild' on 'Node': Identifier 'CURRENCY_LIST' has already been declared","Identifier 'CURRENCY_LIST' has already been declared","Failed to execute 'appendChild' on 'Node': Identifier 'change_ua' has already been declared","Identifier 'change_ua' has already been declared"],ay=["The node to be removed is not a child of this node"],oy=["Skipped ViewTransition due to another transition starting","Skipped ViewTransition due to document being hidden"],dy=["before initialization","Cannot access uninitialized variable"],ly="is not supported in the CustomerPrivacyEventBus",cy="Failed to load web worker for pixel",uy=/\/(\w+(-\w+)*)$/;class hy extends Error{constructor(){super(...arguments),this.name="ParseGidError"}}function py(s){const e=`/${s}`.match(uy);if(e?.[1]!==void 0)return e[1];throw new hy(`Invalid gid: ${s}`)}function my({appType:s,locale:e,environment:t,serializations:i,onUnactionableError:r}){const n=t.deployStage;if(!da(n))return;const a=i.get("shop"),o=py(a.id),d=i.get("requestId"),l=document.documentElement.lang??"zz",c=i.get("receipt"),h=i.get("serverHandling")??"unknown",b=i.get("serverRender")??"no",g=i.get("clientBundleInfo").browsers??"unknown",E=(i.get("experiments")??[]).reduce((m,{clientHandle:A,variant:I})=>(m[A]={clientHandle:A,variant:I??void 0},m),{}),f={global:{shop:{id:o,name:a.name,domain:a.myshopifyDomain,locale:l,enabledFlags:a.enabledFlags},experiments:E,request:{serializedRequestId:d},receipt:{status:c?.status??"unavailable"},custom:{serverHandling:h,serverRendering:b,browserGroup:g}},...{error_source:{shop_id:o},cgi_data:{REQUEST_ID:d},device:{deploy_phase:n}}};return gy({appType:s,appVersion:t.commitSha,locale:e,releaseStage:n,onError:fy({onUnactionableError:r,serverHandling:h,serverRendering:b,browserGroup:g}),metadata:f})}function gy({appType:s,appVersion:e,locale:t,releaseStage:i,metadata:r,onError:n}){const a=new Eo({apiKey:sy,appId:"checkout-web",appType:s,appVersion:e,userAgent:navigator.userAgent,locale:t,releaseStage:i,onError:n,plugins:[Po,Co,To,ko,wo],metadata:r});return Io(a),Ro(a),a}function fy({onUnactionableError:s,serverHandling:e,serverRendering:t,browserGroup:i}){return(r,n)=>{const a=_y(r,n);return a?(by(r,n),Sy(r,n)):s({errorClass:r.exceptions[0]?.errorClass,severity:r.severity,severityReasonType:r.severityReason?.type,terminalError:!!r.metaData?.userImpact?.terminalErrorPageDisplayed,serverHandling:e,serverRendering:t,browserGroup:i}),a}}function yy(s){return[`${window.location.origin}/cdn`,"https://cdn.shopify.com","https://checkout.pci.shopifyinc.com","https://checkout.shopify.com/cdn"].some(t=>s.startsWith(t))}function vy(s){if(!(s instanceof Error))return;const e=s.cause;return e instanceof Error?e:void 0}function la(s,e,t=new Set){return!(s instanceof Error)||t.has(s)?!1:(t.add(s),e(s)||la(vy(s),e,t))}function _y(s,e){const t=s.exceptions?.[0];if(t===void 0||e instanceof Error&&"_handledByErrorBoundary"in e&&e._handledByErrorBoundary)return!1;const i=t.errorClass,r=t.message;if(e instanceof ve&&e.isUnactionable()||la(e,o=>o.name==="UnactionableNegotiationFailedError"&&o instanceof ve&&o.isUnactionable())||i==="BugsnagInvalidError"&&s.unhandled||mc(i))return!1;const n=t.stacktrace[0];if(n===void 0||Ui.includes(i))return!1;if(i==="ViewTransitionRenderError"&&e instanceof Error){const o=e.cause;if(o instanceof Error&&(Ui.includes(o.name)||o.name==="TypeError"&&o.message==="Cannot read properties of undefined (reading '__H')"))return!1}if(r&&oy.some(o=>r.includes(o))||r&&r.includes(ry)||r&&di(r)||i==="TypeError"&&r&&uo.some(o=>r.includes(o))||i==="TypeError"&&r==="Cannot read properties of undefined (reading '__H')"||r?.startsWith(iy)||r&&ho.some(o=>r.includes(o))||r?.includes("Unexpected end of JSON input")&&t.stacktrace.some(o=>["https://connect.facebook.net/","https://www.facebook.com/signals/"].some(d=>o.file?.includes(d)))||r?.includes(ly)||r?.includes(cy)||i==="ReferenceError"&&r&&dy.some(o=>r.includes(o))&&gc(navigator.userAgent)||is(navigator.userAgent)||i==="SyntaxError"&&r&&ny.includes(r)||i==="NotFoundError"&&r&&ay.some(o=>r.includes(o)))return!1;if(i==="ExtensionSandboxUncaughtError")return!0;const a=n.file;return yy(a)}function by(s,e){const t=s.exceptions?.[0];if(t===void 0)return;if(typeof e=="function"){const a=t.stacktrace?.[0];if(a===void 0)s.groupingHash=`FunctionError::[${t.message}]`;else{const{file:o}=a,d=o?.replace(/^(?:https?:\/\/)?(?:[^/]+\/|\/)?/,"");s.groupingHash=`FunctionError::${d}`}return}if(t.errorClass==="TypeError"&&t.message?.startsWith("Failed to fetch dynamically imported module")){s.groupingHash="DynamicImportError";return}if(t.errorClass==="SecurityError"&&t.message?.includes("Failed to execute 'sendBeacon' on 'Navigator'")&&t.message?.includes("crbug.com/490015")){s.groupingHash="send_beacon_cors_disabled";return}if(/You attempted to call a function[\s\S]*that was already released\./s.test(t.message??"")){s.groupingHash="function_already_released";return}if(/You attempted to call a function[\s\S]*that was already revoked\./s.test(t.message??"")){s.groupingHash="function_already_revoked";return}const n=t.message?.match(/No '([A-Za-z0-9_-]+)'\s+method is exposed on this endpoint/);if(n){const a=n[1];s.groupingHash=`missing_endpoint_method_${a}`;return}if(t.message?.includes("You attempted to call a function on a terminated web worker")){s.groupingHash="terminated_
66web_worker_function_call";return}if(t.errorClass==="DataCloneError"){s.groupingHash="DataCloneError";return}if(e instanceof ve){s.groupingHash=e.groupingHash;return}e&&typeof e=="object"&&"groupingHash"in e&&typeof e.groupingHash=="string"&&(s.groupingHash=e.groupingHash)}function Sy(s,e){e instanceof ve&&e.metadata&&Object.keys(e.metadata).length>0&&(s.metaData={...s.metaData,error:e.metadata})}async function Ay({shopId:s,isShopServerOrigin:e}){const{initSHS:t}=await L(async()=>{const{initSHS:r}=await import("./human-signals-index.CoxmTYk-.js");return{initSHS:r}},__vite__mapDeps([24,3])),i=Je(s);return t({exportWithFetch:!0,shopId:Number(i),...e?{beaconEndpoint:`${Pn.shopServer.url}/api/collect/${i}`}:{}})}const ca="checkout:pre-context",ua="checkout:app-context",ha="checkout:hydrate-blocked",pa="checkout:boot-imports",Ey=18e4;async function Py(s){const{client:e,environment:t,shopPay:i,observability:r}=s,n=e.unstable_getSerialization("clientBundleInfo"),a=e.unstable_getSerialization("serverHandling"),o=e.unstable_getSerialization("renderer"),d=e.unstable_getSerialization("targetPlatform"),l=e.unstable_getSerialization("gcpRegion"),c=e.unstable_getSerialization("isMetaAsn")===!0,h=e.unstable_getSerialization("checkoutLayout")==="one-page",{userAgent:b,initialRequest:g}=e,v=g.isServerRendered,E=g.isServerRendered,y={browserGroup:n?.browsers??"unknown",buildId:t.commitSha,checkoutExperience:h?"ONE_STEP":"THREE_STEP",renderer:o,targetPlatform:d,gcpRegion:l,...c&&{isMetaAsn:!0},serverHandling:a,serverRendered:v,clientHydrated:E,mobile:Le(),browser:vn(b).name,os:yc(),checkoutProtocolVersion:Ys(),...ii(i)&&{entrypoint:fc}};(async()=>{try{await Cy(s,y)}catch(p){r.error(p)}})()}async function Cy({client:s,checkout:e,i18n:t,router:i,shop:r,shopPay:n,source:a,observability:o,userEvents:d},l){const c=await wy();if(!c)return;const{redirectDuration:h,timeToFirstByte:b,timeToLastByte:g,domContentLoaded:v,load:E,htmlDocumentSize:y,headerSize:p,encodedBodySize:f,dnsLookupTime:m,connectionDuration:A,tlsDuration:I,requestDuration:P,nextHopProtocol:T,navigationType:R}=c,M=My(),k={...l,step:vc(i.currentUrl.value,{isShopPayActive:e.identity.current.value==="shopPay",shopPay:n}),sourceType:a.type,browserConnectionType:navigator.connection?.effectiveType??"unknown",navigationType:R},O=e.identity.current.value==="shopPay"?"shop_pay":l.checkoutExperience
66==="ONE_STEP"?"c1_redesign":"c1_legacy",w=s.unstable_getSerialization("shopPayConfig"),D={apiClientId:s.unstable_getSerialization("apiClientId")??0,browser:s.userAgent,browserConnectionType:k.browserConnectionType,browserGroup:l.browserGroup,buildId:l.buildId,checkoutToken:a.checkoutSessionIdentifier||"",clientHydrated:l.clientHydrated,customerId:e.proposal.negotiated.value.buyerIdentity?.customerProfile?.id,deviceType:l.mobile?"mobile":"desktop",gcpRegion:l.gcpRegion,locale:t.locale,pageLoadId:oi,serverRendered:l.serverRendered,sessionToken:s.unstable_getSerialization("sessionToken"),shopId:r.id,sourceDesign:O,sourceId:a.sourceId,sourceType:k.sourceType,step:k.step,targetPlatform:l.targetPlatform,userToken:w?.tracking_unique??Xt({serialized:s.unstable_getSerialization("shopifyY"),expiration:s.unstable_getSerialization("shopifyYExpiration")})??void 0};function G({name:x,value:W,attributes:V}){o.histogram({name:x,value:W,attributes:V?{...k,...V}:k})}function U({eventName:x,eventValue:W,eventUnit:V="ms"}){d.monorailEvent({schemaId:"checkout_next_performance_metrics/1.3",payload:{...D,eventName:x,eventValue:W,eventUnit:V,frontendEventTimestampEpochMs:Date.now()}})}function C({name:x,value:W,unit:V,attributes:H}){const z=Math.round(W),te=is(navigator.userAgent),$=!!s.cookies.get("cf_clearance");te||(G({name:x,value:z,attributes:{cf_challenge:$,...H}}),U({eventName:x.replace("new_performance_",""),eventValue:z.toString(),eventUnit:V}))}h&&C({name:"new_performance_redirect_duration",value:h}),m&&C({name:"new_performance_html_dns_lookup_duration",value:m}),A!==void 0&&C({name:"new_performance_html_connection_duration",value:A,attributes:{nextHopProtocol:T}}),I!==void 0&&C({name:"new_performance_html_tls_duration",value:I,attributes:{nextHopProtocol:T}}),P!==void 0&&C({name:"new_performance_html_request_duration",value:P,attributes:{nextHopProtocol:T}}),p&&C({name:"new_performance_html_headers_size",value:p,unit:"bytes"}),y&&C({name:"new_performance_html_body_size",value:y,unit:"bytes"}),f&&C({name:"new_performance_html_encoded_body_size",value:f,unit:"bytes"}),C({name:"new_performance_time_to_first_byte",value:b}),C({name:"new_performance_time_to_last_byte",value:g}),v>0&&C({name:"new_performance_dom_content_loaded",value:v}),E>0&&C({name:"new_performance_dom_load",value:E}),Ie(),await Promise.all([Ue(),xe(),Y(),Se()]);function Y(){return ky(k.step).then(x=>{x!==null&&C({name:"new_performance_checkout_wallet_time_to_interactive",value:x})})}async function Ue(){if(typeof PerformanceObserver>"u"){setTimeout(()=>o.enableKeepAlive(),1e3);return}const x=await ma({name:"checkout:visible"});if(!x)return;C({name:"new_performance_checkout_visible",value:x.startTime}),C({name:"new_performance_ttlb_visible_delta",value:Math.max(0,x.startTime-g)});const[W,V]=await Promise.all([xr({name:"checkout:before-hydrate"}),xr({name:"checkout:hydrate"})]),H=V.startTime+V.duration,z=H-b,te=H-x.startTime;C({name:"new_performance_checkout_hydrated",value:H}),C({name:"new_performance_checkout_hydrate_duration",value:V.duration}),C({name:"new_performance_checkout_before_hydrate_duration",value:W.duration});for(const $ of Ry())C($);if(C({name:"new_performance_checkout_boot_duration",value:z}),te>=0&&C({name:"new_performance_checkout_inert_duration",value:te}),e.identity.current.value==="shopPay"){const $=x.startTime-H;$>0&&G({name:"shop_pay_skeleton_deferral_duration",value:Math.round($),attributes:{flow:n.user.flow.value??"unknown",hasCards:n.user.paymentMethods.value.length>0,hasAddresses:n.user.addresses.value.length>0}})}await be(),setTimeout(()=>o.enableKeepAlive(),100)}async function be(){const x=performance.getEntriesByType("resource"),W=[],V=[];for(const j of x)M.has(j.name)&&(j.name.includes(".css")?W.push(j):V.push(j));const H=Ny(V,g);H&&(k.checkoutLoadBottleneck=H.label);const z=[...W,...V],te=Dy(z);te&&C({name:"new_performance_critical_assets_estimated_bandwidth",value:te,unit:"mbps"});const $=Hr(W);C({name:"new_performance_critical_css_count",value:$.count,unit:"count"}),C({name:"new_performance_critical_css_cached_count",value:$.cachedCount,unit:"count"}),C({name:"new_performance_critical_css_download_time",value:$.downloadTime}
66),$.size&&(C({name:"new_performance_critical_css_size",value:$.size,unit:"bytes"}),C({name:"new_performance_critical_css_size_uncompressed",value:$.uncompressedSize,unit:"bytes"}),C({name:"new_performance_critical_css_download_size",value:$.downloadSize,unit:"bytes"}));const K=Hr(V);C({name:"new_performance_critical_javascript_count",value:K.count,unit:"count"}),C({name:"new_performance_critical_javascript_cached_count",value:K.cachedCount,unit:"count"}),C({name:"new_performance_critical_javascript_download_time",value:K.downloadTime}),K.size&&(C({name:"new_performance_critical_javascript_size",value:K.size,unit:"bytes"}),C({name:"new_performance_critical_javascript_size_uncompressed",value:K.uncompressedSize,unit:"bytes"}),C({name:"new_performance_critical_javascript_download_size",value:K.downloadSize,unit:"bytes"}));const oe=qr(W),X=qr(V);C({name:"new_performance_critical_css_estimated_dcb_savings",value:oe.ms}),C({name:"new_performance_critical_css_dcb_bytes_saved",value:oe.dcbBytesSaved,unit:"bytes"}),C({name:"new_performance_critical_css_cached_dcb_bytes_saved",value:oe.cachedBytesSaved,unit:"bytes"}),C({name:"new_performance_critical_javascript_estimated_dcb_savings",value:X.ms}),C({name:"new_performance_critical_javascript_dcb_bytes_saved",value:X.dcbBytesSaved,unit:"bytes"}),C({name:"new_performance_critical_javascript_cached_dcb_bytes_saved",value:X.cachedBytesSaved,unit:"bytes"});const de=Wr(W),Ae=Wr(V);de>0&&C({name:"new_performance_critical_css_download_overlap",value:de}),Ae>0&&C({name:"new_performance_critical_javascript_download_overlap",value:Ae}),H&&G({name:"new_performance_checkout_load_bottleneck_delta",value:Math.round(Math.abs(H.delta)),attributes:{checkoutLoadBottleneck:H.label}})}async function xe(){if(typeof PerformancePaintTiming>"u"||typeof PerformanceObserver>"u")return;const{firstPaint:x,firstContentfulPaint:W}=await Ty();C({name:"new_performance_time_to_first_paint",value:x.startTime}),C({name:"new_performance_time_to_first_contentful_paint",value:W.startTime})}function Ie(){if(typeof PerformanceObserver>"u")return;const x=new PerformanceObserver(W=>{const V=kt(W).filter(Ct("long-animation-frame"));for(const H of V)C({name:"new_performance_long_animation_frame_duration",value:H.duration,unit:"ms"})});Tt(x,{type:"long-animation-frame",buffered:!0})}async function Se(){const x=new Promise(H=>{Mo(({value:z})=>{C({name:"new_performance_interaction_to_next_paint",value:z}),H()})}),W=new Promise(H=>{Do(({entries:z})=>{const te=z[0];if(te===void 0)return;const $=z.reduce((oe,X)=>X.size>oe.size?X:oe,te),{startTime:K}=$;C({name:"new_performance_time_to_largest_contentful_paint",value:K}),H()})}),V=new Promise(H=>{Lo(({value:z})=>{C({name:"new_performance_cumulative_layout_shift",value:z,unit:"score"}),H()})});await Promise.all([x,W,V])}}function Ct(s){return e=>e?.entryType===s}async function Ty(){return await new Promise(e=>{let t,i;const r=new PerformanceObserver(n=>{const a=kt(n).filter(Ct("paint"));for(const o of a)o.name==="first-paint"?t=o:o.name==="first-contentful-paint"&&(i=o);t&&i&&(r.disconnect(),e({firstPaint:t,firstContentfulPaint:i}))});Tt(r,{type:"paint",buffered:!0})})}async function ma({name:s,timeoutMs:e}){return await new Promise(i=>{let r;const n=new PerformanceObserver(a=>{const o=kt(a).filter(Ct("mark"));for(const d of o)d.name===s&&(clearTimeout(r),i(d),n.disconnect())});e!==void 0&&(r=setTimeout(()=>{n.disconnect(),i(null)},e)),Tt(n,{type:"mark",buffered:!0})})}async function ky(s){if(typeof PerformanceObserver>"u"||s!=="information")return null;const e=await ma({name:bc,timeoutMs:Ey});if(!e)return null;const[t]=performance.getEntriesByName(_c,"mark");if(!t)return null;const[i]=performance.getEntriesByName("checkout:visible","mark");return i?Math.max(0,e.startTime-i.startTime):null}async function xr({name:s}){return await new Promise(t=>{const i=new PerformanceObserver(r=>{const n=kt(r).filter(Ct("measure"));for(const a of n)a.name===s&&(t(a),i.disconnect())});Tt(i,{type:"measure",buffered:!0})})}function Vr(s){const e=t=>Number.isFinite(t)&&t>0?t:0;return{connectionDuration:e(s.connectEnd-s.connectStart),tlsDuration:s.secureConnectionStart>0?e(s.connectEnd-s.secureConnectionStart):0,requestDuration:e(s.responseStart-s.requestStart)}}async function wy(){if(typeof PerformanceNavigationTiming>"u"||typeof PerformanceObserver>"u"){const s=performance.timeOrigin||Date.now()-performance.now(),e=await By();return{redirectDuration:e.redirectEnd-e.redirectStart,timeToFirstByte:e.responseStart-s,timeToLastByte:e.responseEnd-s,domContentLoaded:e.domContentLoadedEventStart-s,load:e.loadEventStart-s,...Vr(e)}}else{const s=await Iy();return s?{redirectDuration:s.redirectEnd-s.redirectStart,timeToFirstByte:s.responseStart,timeToLastByte:s.responseEnd,domContentLoaded:s.domContentLoadedEventStart,load:s.loadEventStart,htmlDocumentSize:s.decodedBodySize,headerSize:s.transferSize-s.encodedBodySize,encodedBodySize:s.encodedBodySize,dnsLookupTime:s.domainLookupEnd-s.domainLookupStart,nextHopProtocol:s.nextHopProtocol,navigationType:s.type,...Vr(s)}:void 0}}async function Iy(){return await new Promise(e=>{const t=new PerformanceObserver(i=>{const r=kt(i).find(Ct("navigation"));t.disconnect(),e(r)});Tt(t,{type:"navigation",buffered:!0})})}function Tt(s,e){try{s.observe(e)}catch{}}function Ry(){const s=n=>performance.getEntriesByName(n,"measure")[0],e=s(ca),t=s(ua),i=s(ha),r=s(pa);return!e||!t||!i||!r?[]:[{name:"new_performance_checkout_pre_context_duration",value:e.duration},{name:"new_performance_checkout_app_context_duration",value:t.duration},{name:"new_performance_checkout_hydrate_blocked_duration",value:i.duration},{name:"new_performance_checkout_boot_imports_duration",value:r.duration}]}function kt(s){try{return s.getEntries()}catch{return[]}}function My(){const s=new Set;for(const e of document.querySelectorAll("link[data-checkout-critical]"))s.add(e.href);return s}function Dy(s){const e=s.filter(i=>i.transferSize!=null&&i.transferSize>0&&i.responseEnd>i.responseStart);if(e.length===0)return;const t=e.map(i=>{const r=i.transferSize*8/1e6,n=(i.responseEnd-i.responseStart)/1e3;return r/n});return t.reduce((i,r)=>i+r,0)/t.length}function Hr(s){const e=new Map;for(const c of s){const h=e.get(c.name);(!h||c.transferSize>h.transferSize)&&e.set(c.name,c)}const t=e.values();let i=0,r=0,n=0,a=0,o=Date.now(),d=0,l=0;for(const c of t)i++,r+=c.encodedBodySize,n+=c.decodedBodySize,a+=c.transferSize,o=Math.min(o,c.requestStart),d=Math.max(d,c.responseEnd),l+=ga(c)?1:0;return{count:i,size:r,uncompressedSize:n,downloadSize:a,downloadTime:Math.max(0,d-o),cachedCount:l}}const Ly="dcb-original-size",Oy="dcb-size";function Gr(s){const e=s.match(/^(\d+)\s+bytes$/);return e?Number(e[1]):void 0}function qr(s){let e=0,t=0,i=0;for(const r of s){const n=r,a=n.serverTiming?.find(c=>c.name===Ly);if(!a)continue;const o=ga(r),d=Gr(a.description);if(d===void 0||d<=0)continue;let l;if(o){const c=n.serverTiming?.find(b=>b.name===Oy);if(!c)continue;const h=Gr(c.description);if(h===void 0||h<=0)continue;l=h,i+=Math.max(0,d-l)}else{if(l=n.encodedBodySize,!l||l<=0)continue;t+=Math.max(0,d-l);const c=n.responseEnd-n.responseStart;if(c<=0)continue;const h=c/l,b=d*h;e+=Math.max(0,b-c)}}return{ms:e,dcbBytesSaved:t,cachedBytesSaved:i}}function Wr(s){const e=s.filter(r=>r.responseEnd>r.responseStart).sort((r,n)=>r.responseStart-n.responseStart);let t=0,i=0;for(const{responseStart:r,responseEnd:n}of e)r<i&&(t+=Math.min(i,n)-r),i=Math.max(i,n);return t}function ga(s){const{deliveryType:e}=s;return e!==void 0?e==="cache":s.nextHopProtocol===""&&window.safari?!0:s.transferSize===0}function Ny(s,e){const t=s.reduce((r,n)=>Math.max(r,n.responseEnd),0);if(t<=0)return null;const i=t-e;return{label:i>0?"js":"html",delta:i}}async function By(){return document.readyState==="complete"?performance.timing:await new Promise(e=>{window.addEventListener("load",()=>e(performance.timing))})}const zr="{redacted}";function Jt(s){if(s===void 0)return;let e;try{e=new URL(s)}catch{return zr}const t=e.pathname.split("/").map(i=>i===""||/^[A-Za-z]+([-_][A-Za-z]+)*$/.test(i)?i:zr);return`${e.origin}${t.join("/")}`}const fa="00000000-0000-0000-5000-000000000000",Fy=["mismatch_cookie","mismatch_meta","all_mismatch"];function Uy(s,e,t,i){const r=zy(s,`_shopify_${e}`),n=r.delete(fa),{value:a,disallowed:o}=$r(t),{value:d,disallowed:l}=$r(i),c=[r.size&&"cookie",a&&"meta",d&&"server_timing"].filter(
66Boolean),h=[n&&"cookie",o&&"meta",l&&"server_timing"].filter(Boolean);return{token:e,sources:c.join(",")||"none",disallowedSources:h.join(",")||"none",verdict:b(c.length)};function b(g){if(g<2)return"insufficient";const v=f=>f&&r.size?r.has(f):void 0,E=v(a),y=v(d),p=a&&d?a===d:void 0;return E!==!1&&y!==!1&&p!==!1?"all_match":!E&&y?"mismatch_meta":E&&!y?"mismatch_server_timing":p?"mismatch_cookie":"all_mismatch"}}const xy=10;function Vy(s){try{if(typeof s!="number"||!Number.isFinite(s))return null;const e=(Date.now()-s)/1e3;return e<0?null:e>xy}catch{return null}}function Hy(){try{const s=ui();if(s?.type!=="back_forward"||!("notRestoredReasons"in s))return null;const{notRestoredReasons:e}=s;return!!e}catch{return null}}function Gy(s,e,{isNewCookieStorageEnabled:t=!1,navigationType:i,isShopApp:r=!1,servedAt:n,shopifyYIsNewlyMinted:a,shopifySIsNewlyMinted:o}={}){try{const d=i??jy(),l=Vy(n),c=Hy(),h=Xy(),b=r||Ky(),g=e.serverTimingTokens??Yy(),v=e.cookieString??document.cookie,E=g.supported,y=E?g:void 0,p=qy();for(const[f,m,A,I]of[["y",e.metaY,y?._y,a],["s",e.metaS,y?._s,o]])try{const P=b?Qy(f)??v:v,T=Uy(P,f,m,A);s.counter({name:"tracking_token_parity",value:1,attributes:{...T,serverTimingSupported:E,isNewCookieStorageEnabled:t,navigationType:d,isShopApp:b,htmlStale:l,hasUrlTokens:h,isTrekkieCookie:Wy(P,f),bfCacheNotUsed:c,tokenMinted:I??null,...p}}),Fy.includes(T.verdict)&&s.log("tracking_token_parity_mismatch","tracking token parity mismatch",{token:f,verdict:T.verdict,cookieValue:$y(P,f),metaValue:m??"",href:Jt(window.location.href),...p})}catch{}}catch{}}function qy(){try{const s=navigator.userAgent;return{botUserAgent:!s||s.trim()===""||/bot|crawl|curl|email|feed|fetch|googleother|headless|index|link|monitoring|robot|rss|scan|search|spider/i.test(s),webdriver:navigator.webdriver===!0}}catch{return{}}}function ya(s){return s?.trim().toLowerCase()||void 0}function $r(s){const e=ya(s);return e===fa?{disallowed:!0}:{value:e,disallowed:!1}}function Wy(s,e){try{for(const t of s.split(";")){const[i,r=""]=t.split("=",2);if(i?.trim()===`_shopify_${e}`&&/[A-Z]/.test(r))return!0}return!1}catch{return!1}}function zy(s,e){const t=new Set;for(const i of s.split(";")){const[r,...n]=i.split("=");if(r?.trim()===e){const a=ya(n.join("="));a&&t.add(a)}}return t}function $y(s,e){const t=[];for(const i of s.split(";")){const[r,...n]=i.split("=");r.trim()===`_shopify_${e}`&&t.push(n.join("=").trim())}return t.join(",")}function ui(){return performance.getEntriesByType("navigation")[0]}function Yy(){const s=ui()?.serverTiming,e=t=>s?.find(i=>i.name===t)?.description;return{supported:s!==void 0,_y:e("_y"),_s:e("_s")}}function jy(){return ui()?.type??"unknown"}function Ky(){try{return document.URL.includes("://shop.app")}catch{return!1}}function Xy(){try{const{searchParams:s}=new URL(document.URL);return s.has("_y")||s.has("_s")}catch{return!1}}function Qy(s){try{const e=window.ShopPay;if(!e)return;const t=s==="y"?e.trackingUnique:e.trackingVisit;return t?`_shopify_${s}=${t}`:void 0}catch{return}}class Zy{#e;#t;#s;#i=nr(this.exportMetrics,500);#r=nr(this.exportLogs,500);#n;#a={};#o=new Set;#d=!1;constructor(e){this.#t=e.attributesForMetrics??{},this.#s=e.attributesForLogs??{},this.#e=new Oo(e),this.#n=e.bugsnag,typeof window<"u"&&window.addEventListener("pagehide",()=>{this.exportLogs(),this.exportMetrics()},{capture:!0})}counter(e){this.#c("counter",e)}gauge(e){this.#c("gauge",e)}histogram(e){this.#c("histogram",e)}async measureAsync({name:e,attributes:t={},functionToMeasure:i}){const r=performance.now();try{return await i()}finally{const n=performance.now()-r;this.histogram({name:e,value:n,unit:"ms",attributes:t})}}measureSync({name:e,attributes:t={},functionToMeasure:i}){const r=performance.now();try{return i()}finally{const n=performance.now()-r;this.histogram({name:e,value:n,unit:"ms",attributes:t})}}debug(e,t,i,r){return this.#h("debug",e,t,i,r)}log(e,t,i,r){return this.#h("log",e,t,i,r)}error(e,t={}){console.log(e),this.#o.forEach(i=>i(e,t.metadata,this.#a)),this.#n?.notify(e,{metadata:{...this.#a,...t.metadata,request:{...t.metadata?.request,url:window.location.href,isFromThemeEditor:ni()}},severity:t.severity??"error",errorClass:t.errorClass,context:window.location.pathname})}addErrorMetadata(e,t){this.#a[e]=t}leaveErrorBreadcrumb(e,t,i){this.#n?.leaveBreadcrumb(e,t,i),this.log("error_logger_breadcrumb_fired",e,{metadata:t},{requiresKeepalive:!1})}addOnError(e){this.#o.add(e)}removeOnError(e){this.#o.delete(e)}async exportMetrics(){await this.#e.exportMetrics()}async exportLogs(){await this.#e.exportLogs()}addAttributesForLogs(e){Object.assign(this.#s,e)}addAttributesForMetrics(e){Object.assign(this.#t,e)}enableKeepAlive(){this.#d=!0}#l(e){return{...e,requiresKeepalive:e.requiresKeepalive??this.#d}}#c(e,t){Kr(()=>{const i=this.#l(t);this.#e[e]({...i,name:`CheckoutWeb_${i.name}`,attributes:{...this.#t,...i.attributes}}),i.exportImmediately?this.exportMetrics():this.#i()})}#h(e,t,i,r={},n={}){Kr(()=>{const a=this.#l(n),o={...this.#s,...r,...e==="debug"&&{level:e}};this.#e.log({attributes:{...Xs(o),message:i,name:t},requiresKeepalive:a.requiresKeepalive}),a.exportImmediately?this.exportLogs():this.#r()})}}const Yr="[CYCLICAL]",Jy=10;function jr(s){return s!==null&&typeof s=="object"&&s instanceof No}function Xs(s,e="",t=new WeakSet,i=0){return Object.entries(s).reduce((r,[n,a])=>{const o=e?`${e}.${n}`:n,d=jr(a)?a.value:a;if(d&&typeof d=="object"){if(i>=Jy)return r[o]="[max depth exceeded]",r;if(t.has(d))return r[o]=Yr,r;t.add(d),Array.isArray(d)?d.forEach((l,c)=>{const h=jr(l)?l.value:l;h&&typeof h=="object"?t.has(h)?r[`${o}.${c}`]=Yr:(t.add(h),Object.assign(r,Xs(h,`${o}.${c}`,t,i+1))):r[`${o}.${c}`]=h}):Object.assign(r,Xs(d,o,t,i+1))}else r[o]=Number.isNaN(d)?"NaN":d;return r},{})}function Kr(s){setTimeout(()=>{s()},0)}const ev="https://otlp-http-production.shopifysvc.com/v1/metrics",va="checkout:cf-challenge";function tv(s){return s.type===va&&"detail"in s}class sv extends Zy{#e;#t;#s=e=>{tv(e)&&this.counter({name:"cf_challenge_reload",value:1,attributes:{...e.detail},exportImmediately:!0,requiresKeepalive:!0})};constructor({environment:e,events:t,serializations:i,appType:r,locale:n,exporter:a,source:o}){const d=navigator.connection?.effectiveType??"unknown",l={appType:r,browserConnectionType:d,deployStage:e.deployStage},c={...l,...iv({serializations:i,locale:n,source:o})},h={...l},b=a??new rv({publishToObserve:da(e.deployStage),environment:e,attributesForLogs:c,onExportError:g=>{g.errorType!=="logs"&&this.log("telemetry_export_error",`Failed to export ${g.errorType} to Observe`,{errorType:g.errorType,error:g.error instanceof Error?g.error.message:String(g.error),cause:g.cause,errorStack:g.error instanceof Error?g.error.stack:void 0,attributesSize:g.attributesSize,metrics:g.metrics},{exportImmediately:!0})}});super({bugsnag:my({appType:r,locale:n,environment:e,serializations:i,onUnactionableError:g=>{this.counter({name:"unactionable_error",value:1,attributes:g})}}),exporter:b,attributesForMetrics:h,attributesForLogs:c}),this.#e=r,this.#t=i,window.addEventListener(va,this.#s),t.addEventListener("bootloader:hydrate-start",g=>{g.waitUntil(this.#i(g))}),t.addEventListener("bootloader:hydrate-start-resolve",g=>{this.#r(g)}),t.addEventListener("bootloader:hydrate-end",g=>{g.waitUntil(this.#n(g))}),t.addEventListener("bootloader:hydrate-end-resolve",g=>{this.#a(g)})}attachEmbedContext(e){const t=e.getEmbedCheckoutType();if(t===Sc.None)return;
66const i=is(navigator.userAgent),r=e.isFlagshipPartner?e.apiClientId:void 0,n={embedCheckoutType:t,embedEmbedder:e.embedder,embedEntry:e.entry,embedPlatform:e.platform,embedProtocol:e.protocol.type??void 0,embedProtocolVersion:e.protocol.version,isBot:i,flagshipPartnerApiClientId:r},a=Object.fromEntries(Object.entries(n).filter(([,o])=>o!==void 0));this.addAttributesForLogs(a),this.addAttributesForMetrics(a),this.addErrorMetadata("embed",{checkoutType:t,embedder:e.embedder,entry:e.entry,flagshipPartnerApiClientId:r,isBot:i,platform:e.platform,protocol:e.protocol.type??void 0,protocolVersion:e.protocol.version})}async#i(e){const{shop:t,shopPay:i}=e.context;Ay({shopId:t.id,isShopServerOrigin:i.isShopServerOrigin}).catch(()=>{}),ty(),this.#e!=="shop-pay-external"&&Gy(this,{metaY:this.#t.get("shopifyY"),metaS:this.#t.get("shopifyS")},{isNewCookieStorageEnabled:this.#t.get("isNewCookieStorageEnabled"),isShopApp:i.isShopServerOrigin,servedAt:this.#t.get("servedAt"),shopifyYIsNewlyMinted:this.#t.get("shopifyYIsNewlyMinted"),shopifySIsNewlyMinted:this.#t.get("shopifySIsNewlyMinted")})}#r(e){const{bootStartTime:t,bootPhaseTimings:i}=e.cause,r=performance.now();if(i){const{importsCompleteTime:n,bootUnblockedTime:a,appContextBuiltTime:o}=i;performance.measure(pa,{start:t,end:n,detail:{devtools:{dataType:"track-entry",track:"Checkout boot",tooltipText:"Time importing the boot JavaScript chunks, which overlaps the HTML stream"}}}),performance.measure(ca,{start:t,end:a,detail:{devtools:{dataType:"track-entry",track:"Checkout boot",tooltipText:"Waiting for the HTML stream and the boot JavaScript chunks, whichever finished last"}}}),performance.measure(ua,{start:a,end:o,detail:{devtools:{dataType:"track-entry",track:"Checkout boot",tooltipText:"Time spent building App Context"}}}),performance.measure(ha,{start:o,end:r,detail:{devtools:{dataType:"track-entry",track:"Checkout boot",tooltipText:"Waiting for the work that hydrate-start listeners registered via waitUntil"}}})}performance.measure("checkout:before-hydrate",{start:t,end:r,detail:{devtools:{dataType:"track-entry",track:"Checkout boot",tooltipText:"Time spent setting up before hydration"}}})}async#n(e){const{client:t}=e.context,i=t.initialRequest.isServerRendered;performance.mark("checkout:hydrated",{detail:{devtools:{dataType:"marker",color:"secondary-dark",properties:[["Hydrate",String(i)]],tooltipText:`Checkout has completed its initial ${i?"hydration":"render"} of the client-side app.`}}}),performance.measure("checkout:hydrate",{start:e.hydrateStartTime,end:"checkout:hydrated",detail:{devtools:{dataType:"track-entry",track:"Checkout boot",properties:[["Hydrate",String(i)]],tooltipText:`Time to perform the initial Preact ${i?"hydration":"render"}`}}});try{await Py(e.context)}catch{}}#a(e){performance.measure("checkout:after-hydrate",{start:e.cause.timeStamp,detail:{devtools:{dataType:"track-entry",track:"Checkout boot",tooltipText:"Time spent executing scripts that run immediately after the app has hydrated"}}})}}function iv({serializations:s,locale:e,source:t}){const i=s.get("apiClientId")??0,r=s.get("checkoutSessionIdentifier"),n=Le(),a=s.get("requestId"),o=s.get("sessionToken"),d=s.get("shop"),l=Ac(d?.id),c=d.myshopifyDomain,h=s.get("sourceToken"),b=navigator.userAgent,g=s.get("shopPayConfig").tracking_unique??Xt({serialized:s.get("shopifyY"),expiration:s.get("shopifyYExpiration")}),v=t?.type??"unknown";return{apiClientId:i,checkoutSessionIdentifier:r,locale:e,mobile:n,requestId:a,sessionToken:o,shopDomain:c,shopId:l,sourceToken:h,sourceType:v,userAgent:b,userToken:g}}class rv extends Bo{#e;#t;#s;#i;#r;#n;constructor({publishToObserve:e,environment:t,attributesForLogs:i,onExportError:r}){super(ev,"checkout-web",{retry:n=>ts(n,{maxAttempts:2})}),this.#e=e,this.#t=t,this.#s=i,this.#i=!1,this.#r=r,this.#n=!1}async exportMetrics(e,t){this.#t.debug.metrics&&nv(e);const i=t?.keepalive??this.#i;this.#t.deployStage==="tophat"&&window.dispatchEvent(new CustomEvent("telemetry-export",{detail:{type:"metrics",names:e.map(r=>r.name),keepalive:i}}));try{this.#e&&await super.exportMetrics(e,{keepalive:i})}catch(r){const n=r instanceof Error?r.cause:"No cause provided";if(this.#r&&!this.#n){this.#n=!0;try{this.#r({errorType:"metrics",error:r,cause:n,attributesForLogs:this.#s,attributesSize:this.calculateAttributesSize(),metrics:e.map(a=>a.name)})}finally{this.#n=!1}}}}async exportLogs(e,t){const i=t?.keepalive??this.#i,r=this.#t.deployStage,n=navigator.userAgent.includes("Playwright-checkout-e2e-tests");if(r==="tophat"||r==="development"&&n){const a=e.map(o=>{const d=o.attributes.find(l=>l.key==="message");return d&&"stringValue"in d.value?d.value.stringValue:"unknown"});window.dispatchEvent(new CustomEvent("telemetry-export",{detail:{type:"logs",names:a,keepalive:i}}))}try{if(this.#e){const a=e.filter(o=>!o.attributes.some(d=>d.key==="level"&&"stringValue"in d.value&&d.value.stringValue==="debug"));a.length&&await super.exportLogs(a,{keepalive:i})}if(this.#t.debug.logging)for(const a of e){const o=_a(a.attributes),d=Object.entries(o).filter(([h,b])=>!(h==="level"||h in this.#s&&this.#s[h]===b)),l=a.attributes.find(h=>h.key==="message"),c=l&&"stringValue"in l.value?l.value.stringValue:"";console.groupCollapsed(`Observe log: ${c}`),o.level&&console.log(`\x1B[1mLevel: \x1B[2m${o.level}`),d.length&&console.table(Object.fromEntries(d)),console.groupEnd()}}catch(a){const o=a instanceof Error?a.cause:"No cause provided";if(this.#r&&!this.#n){this.#n=!0;try{this.#r({errorType:"logs",error:a,cause:o,attributesForLogs:this.#s,attributesSize:this.calculateAttributesSize()})}finally{this.#n=!1}}}}enableKeepAlive(){this.#i=!0}calculateAttributesSize(){try{return JSON.stringify(this.#s).length}catch{return-1}}}function nv(s){try{console.groupCollapsed(`Observe metrics to be emitted (${s.length}
66):`),s.forEach(e=>{const t=av(e),i=new TextEncoder().encode(JSON.stringify(e)).length;console.groupCollapsed(`${e.name} (${i} bytes)`),t.forEach(r=>{console.log(`\x1B[1mValue: \x1B[2m${r.value}  \x1B[1mType: \x1B[2m${r.type}`),console.table(_a(r.attributes))}),console.groupEnd()}),console.groupEnd()}catch(e){const t=e instanceof Error?e.cause:"No cause provided";console.error("Suppressed Error logging metrics to console:",e,t)}}function av(s){return"exponentialHistogram"in s?s.exponentialHistogram.dataPoints.map(e=>({type:"Histogram",attributes:e.attributes,value:Ns(e.sum,3)})):"gauge"in s?s.gauge.dataPoints.map(e=>({type:"Gauge",attributes:e.attributes,value:Ns(e.asDouble,3)})):"sum"in s?s.sum.dataPoints.map(e=>({type:"Counter",attributes:e.attributes,value:Ns(e.asDouble,3)})):[{type:"Unknown",attributes:[],value:"N/A"}]}function _a(s){return s.reduce((e,t)=>{const i=Object.keys(t.value)[0];return e[t.key]=i===void 0?void 0:t.value[i],e},{})}function Ns(s,e){return s?`${parseFloat(s.toFixed(e))}`:"N/A"}class ov extends Error{constructor(){super(...arguments),this.name="LocalStorageNotAvailableError"}}const Qs="__ui",dv=100,lv=["__pp","__edi","__sp"];function Xr(s,e=Qs){try{return new Map(JSON.parse(s.getItem(e)??"[]"))}catch{return new Map}}class cv{#e=null;#t;constructor({storage:e}){if(typeof window>"u")throw new ov("localstorage is not avialable on the server");e==="localStorage"&&this.isStorageUsable("localStorage")?this.#t=localStorage:this.isStorageUsable("sessionStorage")&&(this.#t=sessionStorage),this.state=this.#t==null?new Map:Xr(this.#t),this.removeLegacyIsolatedKeys()}get(e,{scope:t}){const i=this.getMatchingScope(t);if(i)return this.state.get(i)[e];this.prune(t)}syncWithStorage(e,{scope:t}){if(this.#t==null)return;const i=Xr(this.#t),r=this.getMatchingScope(t,i),n=this.getMatchingScope(t);if(r){const a=i.get(r)?.[e],o=n??t;this.state.set(o,{...n?this.state.get(n):void 0,[e]:a})}}createUpdate(e,{scope:t}){return i=>{const r=this.getMatchingScope(t),n=r??t;this.state.set(n,{...r?this.state.get(r):void 0,[e]:i}),this.scheduleWrite()}}remove(e,{scope:t}){const r=this.getMatchingScope(t)??t;if(!this.state.has(r))return;const n={...this.state.get(r)};delete n[e],this.state.set(r,n),this.scheduleWrite()}clearAll(){this.#t!=null&&(this.#e&&clearTimeout(this.#e),this.state=new Map,this.#t.removeItem(Qs))}removeLegacyIsolatedKeys(){if(this.#t!=null)for(const e of lv)try{this.#t.removeItem(e)}catch{}}scheduleWrite(){this.#t!=null&&(this.#e&&clearTimeout(this.#e),this.#e=setTimeout(()=>{const e=JSON.stringify(Array.from(this.state));try{this.#t.setItem(Qs,e)}catch(t){(t instanceof Error||t instanceof DOMException)&&Ec(t)&&this.#t===localStorage&&(this.#t=sessionStorage,this.scheduleWrite())}},dv))}prune(e){const t=[...this.state.keys()].filter(i=>{const r=Object.keys(i),n=Object.keys(e);return r.length!==n.length||!r.every(o=>n.includes(o))?!1:Object.entries(i).some(([o,d])=>e[o]!==d)});if(t.length!==0){for(const i of t)this.state.delete(i);this.scheduleWrite()}}getMatchingScope(e,t=this.state){return[...t.keys()].find(i=>Pc(Object.entries(i),Object.entries(e),{strict:!0}))}isStorageUsable(e){return Cc(e).result===Tc.Usable}}const uv=["_r","rctx","profile_preview_token",wc,Ic,Rc,Mc,Cn,Tn,kn,wn,bn];class hv extends Fo{#e;constructor({client:e,isShopPayActive:t,serverRenderedRoute:i,isSessionFinished:r=!1}){super(pv(e,i,r),{prefix:kc(t)}),this.#e=mv(i),r||gv(this.currentUrl.value),this.beforeNavigate(fv)}shouldHydrateServerRenderedRoute(){const{pathname:e,prefix:t}=this.currentUrl.value,i=this.#e;return i==null||t==null?!1:i===t||i===es(e)}}function pv(s,e,t){const i=new URL(s.initialRequest.url),r=e?.requestedPathname,n=e?.renderedPathname;return r?.startsWith("/")&&n?.startsWith("/")&&r!==n&&(t||es(i.pathname)===es(r))&&(i.pathname=n),i}function mv(s){const{requestedPathname:e,renderedPathname:t}=s??{};if(e?.startsWith("/")&&t?.startsWith("/"))return es(t)}function es(s){return s.replace(/\/$/,"")}function gv(s){window.location.href!==s.href&&window.history.replaceState(null,"",s.href)}function fv(s,e){const t=new URL(window.location.href).searchParams;for(const i of uv){const r=t.get(i);r&&!e.searchParams.has(i)&&e.searchParams.set(i,r)}}function yv({route:s,isEmbedded:e,source:t,shop:i,checkout:r,shopPay:n,queryData:a,observability:o,userEvents:d,reconcileBuyerConsent:l}){if(!Rn({route:s,isEmbedded:e,source:t,checkout:r,shopPay:n}))return{status:"skipped"};if(!vv(a))return{status:"skipped"};let c;try{c=nh(a)}catch{return{status:"skipped"}}const h=r.proposal.negotiated.fields,b=Dc({managedByMarketsPro:h.managedByMarketsPro.value}),g=h.paymentMethods.value??[],v=oh({identity:r.identity,shopPay:n,negotiatedFields:h},{isApplePayAvailable:!1}).value,E=r.isPaymentRequired.value?lh(r.proposal.proposed.paymentLines.value):void 0,y=Lc({proposedPaymentLines:r.proposal.proposed.paymentLines.value}),p=n.applyBuyerDetailsToCheckout(c,{checkout:r,observability:o,userEvents:d,shop:i,hydration:{negotiatedPaymentMethods:v,isApplePayAvailable:!1,immutableAddresses:r.addressManager.shipping.value.immutableAddresses.value.filter(({id:f})=>f!==J),proposedShippingAddress:r.proposal.proposed.shippingAddress.value,canUpdateDeliveryAddress:h.canUpdateDeliveryAddress.value??!0,mustSelectProvidedAddress:h.mustSelectProvidedAddress.value??!1,paymentRequiredMethod:E,negotiatedCardUuid:y},customerProfile:h.buyerIdentity.value?.customerProfile,paymentExemptionReason:r.paymentExemptionReason.value,idealEnabledForShopPay:b});return p.status==="card_vaulting_disabled"?{status:"failed",reason:"card_vaulting_disabled"}:(_v({hydrationResult:p.hydrationResult,negotiatedPaymentMethods:g,observability:o,checkout:r}),l?.(c),{status:"hydrated"})}function vv(s){return!!s?.checkoutSession?.user}function _v({hydrationResult:s,negotiatedPaymentMethods:e,observability:t,checkout:i}){const{selectedPaymentMethod:r}=s;if(!r)return;const n=Oc({paymentMethod:r,negotiatedPaymentMethods:e,observability:t});n!==void 0&&(i.proposal.proposed.paymentLines.value=Nc([n],i.proposal.proposed.paymentLines.value,e??[],{negotiatedPaymentLines:i.proposal.negotiated.fields.paymentLines.value?.lines,deferredTotal:i.proposal.negotiated.fields.deferredTotal.value,hasPayableDeposit:!!ai({deferredTotal:i.proposal.negotiated.fields.deferredTotal.value,checkoutTotal:i.proposal.negotiated.fields.checkoutTotal.value,paymentFlexibilityPaymentTermsTemplate:i.proposal.negotiated.fields.paymentFlexibilityPaymentTermsTemplate.value,isCheckoutToDraft:i.proposal.negotiated.fields.checkoutCompletionTarget.value==="DRAFT_ORDER"})?.amount,hasFixedSellingPlan:ss(i.proposal.negotiated.fields.merchandiseLines.value?.lines).some(a=>a.sellingPlan?.isFixed),paymentTermsTemplateType:i.proposal.negotiated.fields.paymentFlexibilityPaymentTermsTemplate.value?.type}))}const Bs="identified_shop_pay_user";class bv{#e;#t;constructor({serializations:e,router:t,mobileCheckoutSdk:i}){const r=e.get("shopPayConfig"),n=r.shopAppVersion;this.#e=t,this.#t=i;const a=!!n,o=r?.shopAppSurface??(a?"shop_app":"web"),d=r?.shopAppDarkMode,l=Bc(r?.shopAppFontScale);this.config={version:n,darkMode:d,surface:o,fontScale:l},this.usingShopLayout=_(()=>this.#s())}#s(){return this.#t.enabled||Fc(this.#e.currentUrl.value.search)?!0:_n(this.config)}}class Sv{constructor(){this.unstable_updateCredential=e=>{this.#e.value=e}
66,this.unstable_updatePrequalifiedAmount=e=>{this.#t.value=e},this.unstable_setPreselectReason=e=>{this.#s.value=e},this.unstable_setRejected=e=>{this.#i.value=e},this.unstable_setRetryable=e=>{this.#r.value=e},this.#e=u(null),this.credential=this.#e,this.#t=u(null),this.prequalifiedAmount=this.#t,this.#s=u(void 0),this.preselectReason=this.#s,this.#i=u(!1),this.isRejected=this.#i,this.#r=u(!1),this.isRetryable=this.#r}#e;#t;#s;#i;#r}class Av{constructor({initialEnabledFlags:e}={}){this.#i=u(new Set),this.unstable_updateFlow=t=>{this.#e.value=t},this.unstable_setAddresses=t=>{this.#t.value=t},this.unstable_setPaymentMethodsFromBuyerDetails=t=>{this.#s.value=zc(t)},this.addCreditCard=t=>{const i=ar(t),r=this.#s.value.filter(({id:n})=>n!==i.id);return this.#s.value=[...r,i].sort($c),i},this.updateCreditCard=(t,i)=>{const r=this.#s.value;let n=!1;const a=r.map(o=>o.id!==t||!rt(o)?o:(n=!0,ar({...o.paymentAttributes,...i})));n&&(this.#s.value=a)},this.removeCreditCard=t=>{const i=this.paymentMethods.value.filter(rt).find(r=>r.id===t);i&&(this.#i.value=new Set(this.#i.value).add(i.paymentAttributes.uuid))},this.unstable_setApplePayAvailable=t=>{this.#r.value=t},this.unstable_setWallet=t=>{this.#n.value=t},this.unstable_setPaymentMethodHistory=t=>{this.#a.value=t},this.unstable_updatePublicId=t=>{this.#o.value=t},this.unstable_updateIsNew=t=>{this.#d.value=t},this.unstable_setShopAccountUuid=t=>{this.#l.value=t},this.unstable_setEmail=t=>{this.#c.value=t},this.unstable_setPhoneNumber=t=>{this.#h.value=t},this.unstable_setPhoneCountryCode=t=>{this.#u.value=t},this.hasFlag=t=>this.#m.value.has(t),this.getExperimentAssignment=t=>hr(t,this.#p.value,this.hasFlag)??t.variants.control,this.isAssignedToExperiment=t=>hr(t,this.#p.value,this.hasFlag)!==void 0,this.unstable_setEnabledFlags=t=>{this.#m.value=new Set(t)},this.unstable_setExperiments=t=>{this.#p.value=new Set(t)},this.installments=new Sv,this.#e=u(void 0),this.flow=this.#e,this.hasFlow=_(()=>this.#e.value!=null),this.isAuthenticatedUser=_(()=>this.#e.value==="authenticated_user"),this.isUnauthenticatedUser=_(()=>this.#e.value==="unauthenticated_user"),this.#t=u([]),this.addresses=this.#t,this.#s=u([]),this.#r=u(!1),this.isApplePayAvailable=this.#r,this.paymentMethods=_(()=>Mn({vaultedPaymentMethods:this.#g(this.#s.value),paymentMethodHistory:this.#a.value,isApplePayAvailable:this.#r.value})),this.creditCards=_(()=>this.paymentMethods.value.filter(rt).map(t=>t.paymentAttributes)),this.hasCreditCards=_(()=>this.creditCards.value.length>0),this.#n=u({latestDiscount:void 0}),this.wallet=this.#n,this.#a=u([]),this.paymentMethodHistory=this.#a,this.#o=u(""),this.publicId=this.#o,this.isUnauthenticatedSession=_(()=>!this.#o.value&&this.hasFlow.value),this.#d=u(!1),this.isNew=this.#d,this.#l=u(""),this.shopAccountUuid=this.#l,this.#c=u(""),this.email=this.#c,this.#h=u(""),this.phoneNumber=this.#h,this.#u=u(void 0),this.phoneCountryCode=this.#u,this.#m=u(e?new Set(e):new Set),this.#p=u(new Set)}#e;#t;#s;#i;#r;#n;#a;#o;#d;#l;#c;#h;#u;#m;#p;#g(e){return this.#i.value.size===0?e:e.filter(t=>!rt(t)||!this.#i.value.has(t.paymentAttributes.uuid))}}class Ev{constructor(){this.unstable_setServiceAvailable=e=>{this.#e.value=e},this.unstable_updatePayment=e=>{this.#t.value=e},this.unstable_setAgreementError=e=>{this.#s.value=e},this.unstable_setModalCloseForRetry=e=>{this.#i.value=e},this.unstable_setModalOpen=(e,t)=>{Xe(()=>{e&&(this.#n.value=t),this.#r.value=e})},this.#e=u(!0),this.#t=u(void 0),this.#s=u(null),this.#i=u(!1),this.#r=u(!1),this.#n=u(void 0),this.isServiceAvailable=this.#e,this.payment=this.#t,this.agreementError=this.#s,this.isModalClosedForRetry=this.#i,this.isModalOpen=this.#r,this.triggerSource=this.#n}#e;#t;#s;#i;#r;#n}class Pv{constructor({paymentMethods:e,preserveUnavailableSelection:t=!1}){this.unstable_promotePaymentMethod=i=>{const r=this.#c.value;r.some(n=>n.id===i.id)||(this.#c.value=[...r,i])},this.unstable_updateSelectedShippingAddress=i=>{this.#e.value=i},this.unstable_setServerSelectedPaymentMethodId=i=>{this.#t.value=i},this.unstable_setNegotiatedCardUuid=i=>{this.#s.value=i},this.selectPaymentMethod=i=>{this.#i.value={status:"selected",method:i}},this.clearPaymentMethod=(i="explicit")=>{const r=this.#i.peek();return i==="unavailable"&&r.status==="cleared"&&r.reason==="explicit"?!1:(this.#i.value={status:"cleared",reason:i,derivedWhenCleared:this.derivedPaymentMethod.peek()},!0)},this.unstable_updateSelectedBillingAddress=i=>{this.#r.value=i},this.unstable_updatePaymentMethodOption=i=>{this.#n.value=i},this.unstable_updateSecureData=i=>{this.#a.value=i},this.unstable_updateVerificationTrigger=i=>{this.#o.value=i},this.unstable_setInternalProgressing=i=>{this.#d.value=i},this.unstable_setHsaRequested=i=>{this.#l.value=i}
66,this.unstable_setLoading=i=>{this.#h.value=i},this.unstable_setIsUnverifiedEnrollment=i=>{this.#u.value=i},this.unstable_setButtonProgressing=i=>{this.#m.value=i},this.unstable_setShowSessionRevalidator=i=>{this.#p.value=i,i||(this.#g.value=void 0)},this.unstable_claimSessionRevalidator=i=>{const r=this.#g.peek();return r&&r!==i?!1:(this.#g.value=i,!0)},this.unstable_releaseSessionRevalidator=i=>{this.#g.peek()===i&&(this.#g.value=void 0)},this.unstable_setUnauthenticatedErrorModal=i=>{this.#f.value=i},this.unstable_setInitialization=i=>{this.#y.value=i},this.unstable_receiveBuyerDetailsResult=i=>{const r=this.#y.peek();if(r.status==="failed"&&r.reason==="cardVaultingDisabled")return{status:"handled"};const n=i?.status==="failed"?i:void 0,a=!i&&r.status!=="initialized";if(n||a){const o=n?.errors;return r.status==="failed"&&r.reason==="fetch"&&r.errors===o?{status:"handled"}:(this.unstable_setInitialization({status:"failed",reason:"fetch",errors:o}),{status:"handled"})}return i?.status!=="success"||r.status==="initialized"?{status:"handled"}:{status:"initialize",buyerDetails:i}},this.#v=t,this.#e=u(void 0),this.#i=u({status:"unknown"}),this.#t=u(void 0),this.#s=u(void 0),this.derivedPaymentMethod=_(()=>Dn({userStoredPaymentMethods:e.value,serverSelectedPaymentMethodId:this.#t.value,currentSelectedPaymentMethod:void 0,negotiatedCardUuid:this.#s.value}).selectedPaymentMethod),this.#r=u(void 0),this.#n=u(void 0),this.#a=u(void 0),this.#o=u(null),this.#d=u(!1),this.#l=u(!1),this.#c=u([]),this.#h=u(!1),this.#u=u(!1),this.#m=u(!1),this.#p=u(!1),this.#g=u(void 0),this.#f=u(void 0),this.#y=u({status:"pending"}),this.initialization=this.#y,this.isButtonProgressing=this.#m,this.isInternalProgressing=this.#d,this.hsaRequested=this.#l,this.verificationTrigger=this.#o,this.secureData=this.#a,this.isLoading=this.#h,this.isUnverifiedEnrollment=this.#u,this.showSessionRevalidator=this.#p,this.unauthenticatedErrorModal=this.#f,this.promotedPaymentMethods=this.#c,this.paymentMethodOption=this.#n,this.isInstallmentsSelected=_(()=>{const i=this.paymentMethodOption.value;return!!(i&&i.type==="wallet"&&i.name==="SHOPIFY_INSTALLMENTS")}),this.selectedBillingAddress=this.#r,this.selectedShippingAddress=this.#e,this.selectedPaymentMethod=_(()=>{const i=this.#i.value;if(i.status==="cleared"){const r=this.derivedPaymentMethod.value,n=i.derivedWhenCleared;return this.#v&&i.reason==="unavailable"?r:n&&r&&or(r)===or(n)?void 0:r}return i.status==="selected"&&(dr(i.method,e.value)||dr(i.method,this.#c.value))?i.method:this.derivedPaymentMethod.value}),this.serverSelectedPaymentMethodId=this.#t}#e;#t;#s;#i;#r;#n;#a;#o;#d;#l;#c;#h;#u;#m;#p;#g;#f;#y;#v}class Cv{constructor(){this.unstable_setPhoneNumber=e=>{this.#e.value=e},this.unstable_setPhoneCountryCode=e=>{this.#t.value=e},this.unstable_setPhoneError=e=>{this.#s.value=e},this.unstable_setHcaptchaToken=e=>{this.#i.value=e},this.unstable_setCaptchaRef=e=>{this.#r.value=e},this.unstable_setErrors=e=>{this.#n.value=e},this.unstable_setSkipAutomaticLoginAttempt=e=>{this.#a.value=e},this.#e=u(void 0),this.phoneNumber=this.#e,this.#t=u(void 0),this.phoneCountryCode=this.#t,this.#s=u(void 0),this.phoneError=this.#s,this.#i=u(void 0),this.hcaptchaToken=this.#i,this.#r=u(void 0),this.captchaRef=this.#r,this.#n=u([]),this.errors=this.#n,this.#a=u(!1),this.skipAutomaticLoginAttempt=this.#a,this.phoneNumberRawSignal=this.#e,this.phoneErrorRawSignal=this.#s}#e;#t;#s;#i;#r;#n;#a}class Tv{constructor({client:e,environment:t,source:i,financingPlans:r=[],seri
66alizations:n,router:a,mobileCheckoutSdk:o,shouldUseAccessToken:d=!1,enableCardVaulting:l=!0,isSimulated:c,showSwitchAccount:h=!0,showCheckoutAsGuest:b=!0,preserveUnavailableSelection:g=!1,cookies:v}){this.isExternal=!1,this.logoBrand="shop",this.shopCashExpectedEarnings=u(void 0),this.#n=u(void 0),this.updateUserVerification=f=>{this.#t.value=f},this.setUserIdentified=f=>{f===null?(this.#s.value=!1,this.#o.delete(Bs)):(this.#s.value=!0,this.#o.set(Bs,f))},this.setDeviceFingerprint=f=>{this.#i.value=f},this.setShopOfferReconciliationPending=f=>{this.#e.value=f},this.initializeFromBuyerDetails=(f,m)=>{const{flow:A,email:I,phone:P,phoneCountryCode:T,wallet:R,addresses:M,installmentsRejected:k,installmentsRetryable:O,preselectSpi:w,newUser:D,publicId:G,shopAccountUuid:U,enabledFlags:C,secureData:Y,installmentsPrequalifiedAmount:Ue,installmentCredential:be,experiments:xe,spiServiceAvailable:Ie}=f,{negotiatedPaymentMethods:Se,isApplePayAvailable:x,immutableAddresses:W,proposedShippingAddress:V,canUpdateDeliveryAddress:H,mustSelectProvidedAddress:z,paymentRequiredMethod:te,negotiatedCardUuid:$}=m,{userStoredPaymentMethods:K,paymentMethodHistory:oe,selectedPaymentMethod:X,expiredCardPreselectPrevented:de}=Qr({buyerDetails:f,negotiatedPaymentMethods:Se,isApplePayAvailable:x,negotiatedCardUuid:$,currentSelectedPaymentMethod:this.session.selectedPaymentMethod.value}),Ae=C.includes(pu),j=x&&oe.some(he=>Uc(he)&&!!he.lastUsedAt),et=K.some($s)||j;if(Ae&&!et)return this.session.unstable_setInitialization({status:"failed",reason:"cardVaultingDisabled"}),{status:"card_vaulting_disabled"};const{selectedShippingAddress:ee,selectedBillingAddress:Q}=kv({shopPay:this,addressesForUI:M,immutableAddresses:W,proposedShippingAddress:V,canUpdateDeliveryAddress:H,mustSelectProvidedAddress:z,selectedPaymentMethod:X}),Ve=wv(f.selectedPaymentMethodOption);return Xe(()=>{this.user.unstable_updateFlow(A),this.user.unstable_setPhoneNumber(P),this.user.unstable_setPhoneCountryCode(T),this.user.unstable_setPaymentMethodsFromBuyerDetails(K),this.user.unstable_setPaymentMethodHistory(oe),this.user.unstable_setApplePayAvailable(x),this.session.unstable_setServerSelectedPaymentMethodId(f.selectedPaymentMethodId??void 0),this.session.unstable_setIsUnverifiedEnrollment(!!f.isUnverifiedEnrollment),this.session.unstable_setNegotiatedCardUuid($),this.user.unstable_setWallet(R),this.user.unstable_setAddresses(M),this.user.unstable_setEnabledFlags(C),this.user.unstable_setExperiments(xe);const he=this.user.getExperimentAssignment(ur)===ur.variants.treatment,ie=this.session.paymentMethodOption.value,He=he&&ie?.type==="wallet"&&ie.name==="SHOPIFY_INSTALLMENTS"?void 0:ie,dt=he&&Ve?.type==="wallet"&&Ve.name==="SHOPIFY_INSTALLMENTS"?void 0:Ve;this.session.unstable_updatePaymentMethodOption(dt||He||{type:"wallet",name:"SHOP_PAY"}),this.user.installments.unstable_setRejected(k),this.user.installments.unstable_setRetryable(O),this.user.installments.unstable_setPreselectReason(w),this.user.unstable_updateIsNew(D),this.user.unstable_updatePublicId(G),this.user.unstable_setEmail(I),this.user.unstable_setShopAccountUuid(U),this.session.unstable_updateSecureData(Y),this.user.installments.unstable_updatePrequalifiedAmount(Ue),this.user.installments.unstable_updateCredential(be),this.installments.unstable_setServiceAvailable(Ie),A!=="authenticated_user"&&this.signup.unstable_setPhoneNumber(""),this.session.unstable_updateSelectedShippingAddress(ee),this.session.unstable_updateSelectedBillingAddress(Q),X&&!$s(X)&&this.session.unstable_promotePaymentMethod(X),this.session.unstable_setLoading(!1),this.session.unstable_setInitialization({status:"initialized"})}),{status:"hydrated",userStoredPaymentMethods:K,selectedShippingAddress:ee,selectedBillingAddress:Q,selectedPaymentMethod:X,expiredCardPreselectPrevented:de}},this.updatePaymentMethodsFromBuyerDetails=(f,m)=>{const{userStoredPaymentMethods:A,paymentMethodHistory:I}=Qr({buyerDetails:f,...m,isApplePayAvailable:this.user.isApplePayAvailable.value,currentSelectedPaymentMethod:this.session.selectedPaymentMethod.value});return Xe(()=>{this.user.unstable_setPaymentMethodsFromBuyerDetails(A),this.user.unstable_setPaymentMethodHistory(I),this.session.unstable_setServerSelectedPaymentMethodId(f.selectedPaymentMethodId??void 0)}),{userStoredPaymentMethods:A}},this.deriveInitialProposalPatch=f=>{const{buyerDetails:m,customerProfile:A,hydrationResult:I,paymentRequiredMethod:P,paymentExemptionReason:T,idealEnabledForShopPay:R}=f,{email:M,phone:k}=m,{selectedShippingAddress:O,selectedBillingAddress:w,selectedPaymentMethod:D}=I,G=xc({paymentRequiredMethod:P,isIdealEnabledForShopPay:R}),U={email:void 0,phone:void 0};A?.email&&M!==A.email?U.email=A.email:!A?.email&&A?.phone?(U.email="",U.phone=A.phone):M&&(U.email=M);const C={};if(O&&(C.shippingAddress=O.address),w&&(G&&(C.billingAddress=w.address),T&&(C.billingAddress=w.address)),D)if(rt(D)){const Y=D.paymentAttributes.billingAddress?.address;!G&&Y&&(C.billingAddress=Y)}else w&&(C.billingAddress=w.address);return C.fallbackPhoneNumber=k,{contact:U,updateAddressOptions:C}},this.applyBuyerDetailsToCheckout=(f,{checkout:m,observability:A,userEvents:I,shop:P,hydration:T,customerProfile:R,paymentExemptionReason:M,idealEnabledForShopPay:k})=>{const O=this.initializeFromBuyerDetails(f,T);if(O.status==="card_vaulting_disabled")return{status:"card_vaulting_disabled"};const w=this.deriveInitialProposalPatch({buyerDetails:f,customerProfile:R,hydrationResult:O,paymentRequiredMethod:T.paymentRequiredMethod,paymentExemptionReason:M,idealEnabledForShopPay:k});w.contact.email!==void 0&&(m.proposal.proposed.email.value=w.contact.email),w.contact.phone!==void 0&&(m.proposal.proposed.phone.value=w.contact.phone),O.selectedPaymentMethod&&O.expiredCardPreselectPrevented&&I.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.1",payload:{...Te(this.#a,m,P),action:"expired_card_preselect_prevented"}});const D=dh({checkout:m,shopPay:this,observability:A,buyerAddresses:f.addresses,...w.updateAddressOptions});return{status:"applied",hydrationResult:O,appliedAddresses:D}},this.#r=u(r),this.installmentsFinancingPlans=this.#r,this.#e=u(!1),this.shopOfferReconciliationPending=this.#e,this.#t=u({status:"none"}),this.userVerification=this.#t,this.#a=i,this.#o=v,this.#d=h,this.#l=b;const E=this.#o.get(Bs),y=!!(i.checkoutSessionIdentifier&&E===escape(i.checkoutSessionIdentifier));this.#s=u(y),this.userIdentified=this.#s,this.#i=u(null),this.deviceFingerprint=this.#i,this.isShopServerOrigin=e.initialRequest.url.origin===t.services.shopServer.url,this.isSimulated=c,this.shouldUseAccessToken=d,this.enableCardVaulting=l,this.app=new bv({serializations:n,router:a,mobileCheckoutSdk:o}),this.user=new Av,this.installments=new Ev,this.session=new Pv({paymentMethods:this.user.paymentMethods,preserveUnavailableSelection:g}),this.signup=new Cv,this.progressInterceptor=new hh;const p=n.get("shopPayConfig");Pu(e.initialRequest.url)&&this.signup.unstable_setSkipAutomaticLoginAttempt(!0),this.config={webUrl:p.web_url??void 0,isFromClassic:!!p.from_classic,redirectSource:p.redirect_source,isReferral:p.is_referral,shouldPreSelectInstallments:p.pre_select_installments,checkoutAsGuestUrl:p.checkout_as_guest_url??void 0,redirectUrl:p.redirect_url,transactionParams:p.transaction_params,checkoutProfileContext:p.checkout_profile_context,profilePreviewToken:p.profile_preview_token,universalRedirect:{isEnabled:p.universal_redirect_enabled,isIndicator:p.universal_redirect_indicator},tokens:{authorization:p.authorization,callback:p.callback_token,iframe:p.iframe_token},tracking:{visit:p.tracking_visit,unique:p.tracking_unique,consent:p.tracking_consent}},this.updateAccessToken=this.updateAccessToken.bind(this),this.clearAccessToken=this.clearAccessToken.bind(this)}#e;#t;#s;#i;#r;#n;#a;#o;#d;#l;get accessToken(){return this.#n}updateAccessToken(e){this.#n.value=e}clearAccessToken(){this.#n.value=void 0}get visibility(){const e=!!this.config.checkoutAsGuestUrl,t=!Qe(this.#a)&&this.#l&&e,i=this.config.redirectSource==="shop_pay_s
66dk",r=this.app.config.surface!=="shop_app"&&!i;return{showReturnToStore:!0,showSwitchVaultedContactMenu:r,showSwitchAccountAction:this.#d,showUnauthedOrderSummary:!0,showVaultedContact:!0,showVaultedContactHeader:!0,showVaultedContactInlineLogo:!0,showAutoExpandedPaymentMethods:!0,showGuestCheckoutPaymentMethods:r,shouldRenderFloatingShopPayButton:!1,showCheckoutAsGuestFeature:t,showCheckoutAsGuestKebabLink:t,shouldForceOnePageShellContentAsAppLayout:!1,showOnePageShellHeader:!1,showShopPayExternalShellHeader:!1,showShopPayBrandedLogo:!1,showOrderSummaryTitle:!0,showCartLink:r,showDefaultShopTheme:!1,isOrderSummaryCollapsible:!0}}}function Qr({buyerDetails:s,negotiatedPaymentMethods:e,isApplePayAvailable:t,currentSelectedPaymentMethod:i,negotiatedCardUuid:r}){const{creditCards:n,paymentMethods:a}=s,o=Vc(a,e),d=Hc(o,n),l=Gc(a),c=Mn({vaultedPaymentMethods:d,paymentMethodHistory:l,isApplePayAvailable:t}),{selectedPaymentMethod:h,expiredCardPreselectPrevented:b}=Dn({userStoredPaymentMethods:c,serverSelectedPaymentMethodId:s.selectedPaymentMethodId,currentSelectedPaymentMethod:i,negotiatedCardUuid:r});return{userStoredPaymentMethods:d,paymentMethodHistory:l,selectedPaymentMethod:h,expiredCardPreselectPrevented:b}}function kv({shopPay:s,addressesForUI:e,immutableAddresses:t,proposedShippingAddress:i,canUpdateDeliveryAddress:r,mustSelectProvidedAddress:n,selectedPaymentMethod:a}){const o=ri(i,yn),d=o?null:t?.find(({address:P})=>ue(P,i))?.id,l=!o&&d?ft(i,d):void 0,h=qc({proposedAddress:i,buyerAddresses:e})?ti(e):null,b=t?[...e,...t.map(({address:P,id:T})=>ft(P,T))]:e,g=P=>b.find(T=>T.id===P),v=n?t.map(({address:P,id:T})=>ft(P,T)):b,E=o?void 0:v.find(P=>ue(P.address,i,["phone"]))?.id,y=E?g(E)||g(J):null,p=Wc({selectedPaymentMethod:a,addressesForUI:e,proposedShippingAddressId:E}),m=(n?[y,l]:[y,l,h]).find(P=>ot(P,s));return{selectedShippingAddress:(r||n)&&m?m:void 0,selectedBillingAddress:p||h||void 0}}function wv(s){if(s==="SHOPIFY_INSTALLMENTS")return{type:"wallet",name:"SHOPIFY_INSTALLMENTS"};if(s==="SHOP_PAY")return{type:"wallet",name:"SHOP_PAY"}}const Iv="stored-session-token";class Rv extends Tv{#e;#t;#s;constructor({persistence:e,...t}){super(t),this.#e=e,this.#t={scope:{shopPaySessionTokenKey:Yc(t.client.initialRequest.url)}};const i=t.serializations.get("paySessionToken"),r=i===Iv?void 0:i;if(!this.shouldUseAccessToken){r!==void 0&&super.updateAccessToken(r);return}if(r)this.updateAccessToken(r);else{const n=e?.get(fe.ShopPaySessionToken,this.#t);n!==void 0&&super.updateAccessToken(n)}}updateAccessToken(e){this.shouldUseAccessToken&&(this.#s??=this.#e?.createUpdate(fe.ShopPaySessionToken,this.#t),this.#s?.(e)),super.updateAccessToken(e)}clearAccessToken(){this.#e?.remove(fe.ShopPaySessionToken,this.#t),super.clearAccessToken()}}function Mv({shopPayGraphql:s,...e}){if(!Rn(e))return{status:"skipped"};const t={checkoutContextInput:{checkoutVersion:Fe({source:e.source}),checkoutIdentifier:e.source.checkoutSessionIdentifier??"unknown",shopifyDomain:e.shop.myshopifyDomain,shopId:Je(e.shop.id)},shopifyDomain:e.shop.myshopifyDomain,redirectSource:e.shopPay.config.redirectSource},i=s.read(Us(ah,t));return yv({...e,queryData:i})}function Dv({client:s,environment:e}){const{origin:t,pathname:i}=s.initialRequest.url,r=e.services.shopServer.url,n=t.endsWith(".my.shop.dev")||t.endsWith(".my.shop.test");return t===r||n&&i.startsWith("/shoppay")}class Lv{#e;constructor(e,t,i,r,n,a,o=[]){if(t==null)throw new it("Checkout context data is missing",{groupingHash:"SettingsCreateError::CheckoutContextDataMissing"});const{shop:d,cardsinkUrl:l,configurationPreviewContext:c,globalCheckoutUiExtensions:h}=t;if(d==null)throw new it("Shop details are missing",{groupingHash:"SettingsCreateError::ShopDetailsMissing"});if(i==null)throw new it("Request info data is missing",{groupingHash:"SettingsCreateError::RequestInfoDataMissing"});if(i.shop==null)throw new it("Request info data shop details are missing",{groupingHash:"SettingsCreateError::RequestInfoDataShopDetailsMissing"});const{shopConfigurations:b}=d,{defaultConfiguration:g,countrySpecificConfigurations:v}=b,E={};for(const{countries:y,configuration:p}of v){const f={contactInfoOptions:p.contactInfoOptions,addressFormSettings:p.addressFormSettings,phoneMarketingDisclosure:p.phoneMarketingDisclosure??null};for(const m of y)E[m]=f}this.id=d.id,this.allowExtensionDevelopment=d.allowExtensionDevelopment,this.extendedExtensionTimeout=
66d.extendedExtensionTimeout,this.lpmWithUiExtensionEnabled=d.lpmWithUiExtensionEnabled,this.name=d.name,this.hasStorefront=d.storefront?.hasStorefront||!1,this.storefrontUrl=d.storefront?.url,this.previewReturnUrl=d.storefront?.previewReturnUrl,this.storefrontDomains=d.storefrontDomains??[],this.domain=d.domain,this.externalDomain=d.detailedDomains?.find(y=>y.targetType==="EXTERNAL"&&y.behaviour==="PRIMARY")?.host,this.myshopifyDomain=d.myshopifyDomain,this.customerAccountRequirement=d.customerAccountRequirement,this.customerAccounts={domain:d.customerAccountDomain??void 0},this.customerAccountLocationsUrl=d.customerAccountLocationsUrl,this.customerAccountProfileUrl=d.customerAccountProfileUrl,this.loginLinkVisible=d.loginLinkVisible,this.#e=new Set([...d.enabledFlags??[],...o]),this.enabledDeliveryMethods=d.enabledDeliveryMethods,this.facebookCapiEnabled=d.facebookCapiEnabled,this.giftCardsEnabled=d.giftCardsEnabled,this.additionalAddressFieldsEnabled=d.additionalAddressFieldsEnabled,this.hideReductionsField=d.hideReductionsField??!1,this.discountCodesEnabled=d.discountCodesEnabled,this.confirmationPageEnabled=d.confirmationPageEnabled,this.contactEmail=d.contactEmail,this.acceptTipPayments=d.acceptTipPayments,this.showTipPayments=d.showTipPayments,this.emailMarketing=i.shop.emailMarketing,this.smsMarketing=d.smsMarketing,this.currencyCode=d.currencyCode,this.merchantPolicies=d.merchantPolicies,this.trackingPixels=d.trackingPixels,this.theme=d.theme,this.postPurchase={additionalTrackingScript:d.postPurchaseAdditionalTrackingScript,developmentModeAvailable:d.postPurchaseDevelopmentModeAvailable,extensionAvailable:d.postPurchaseExtensionAvailable},this.popularBillingCountries=d.popularBillingCountries,this.popularShippingCountries=d.popularShippingCountries,this.phoneMarketingDisclosure=g.phoneMarketingDisclosure??null,this.onlineStoreChat=d.onlineStoreChat,this.shopPayEnabledForPrimarySellerOfRecord=d.shopPayEnabled,this.shopPayRememberMeDualButtonExcluded=d.shopPayRememberMeDualButtonExcluded,this.hasMultipleLegalEntities=d.hasMultipleLegalEntities,this.storeVaultEnabled=d.storeV
66aultEnabled,this.storeVaultGuestCvvVerificationEnabled=d.storeVaultCvvVerificationAtGuestCheckoutEnabled,this.forceStablecoinSandboxPayments=d.forceStablecoinSandboxPayments,this.vaultForPaymentLater=d.vaultForPaymentLater,this.webPixelConfigurations=d.webPixelConfigurations,this.webPixelManagerVersion=d.webPixelManagerVersion,this.webPixelsManagerSriMap=d.webPixelsManagerSriMap,this.trekkieLoadConfiguration=d.trekkieLoadConfiguration,this.linkToArriveApp=d.linkToArriveApp,this.shopPayRememberMeAutoOptinEnabled=d.shopPayRememberMeAutoOptinEnabled,this.shipPickupInOneOrderEnabled=d.shipPickupInOneOrderEnabled,this.marketDrivenShippingEnabled=d.marketDrivenShippingEnabled,this.sameBillingAndShippingAddress=d.sameBillingAndShippingAddress,this.requireMatchingShippingAndBilling=d.requireMatchingShippingAndBilling,this.prefetchShippingRatesEnabled=d.prefetchShippingRatesEnabled,this.shippingRatesReloadStrategy=Ov(d.shippingRatesReloadStrategy),this.developmentShop=d.developmentShop,this.captureAtFulfillmentEnabled=d.captureAtFulfillmentEnabled,this.checkoutHideZeroValueDiscountLines=d.checkoutHideZeroValueDiscountLines??void 0,this.hostedFieldsUrl=d.hostedFieldsUrl??void 0,this.checkoutPublicAccessToken=d.checkoutPublicAccessToken??void 0,this.asyncDeliveryPromiseExperienceEnabled=d.asyncDeliveryPromiseExperienceEnabled??void 0,this.countryCode=d.country.code,this.paymentMethodAutoSelectionDisabled=e?!1:i?.shop?.paymentMethodAutoSelectionDisabled,this.country=d.country,this.timeZone=d.timeZone,this.cardsinkUrl=l,this.contactInfoOptions=g.contactInfoOptions,this.translations=JSON.parse(d.translations),this.addressFormSettings=g.addressFormSettings,this.billingAddressFormSettings=d.billingAddressFormSettings,this.countrySpecific=E,this.globalUIExtensions=h,this.billingCountries=d.billingCountries,this.shippingCountries=a?.shop?.shippingCountries??[],this.paymentGateways=d.paymentGateways,this.adsPublisherSettingsTypEnabled=d.adsPublisherSettingsTypEnabled,this.draftAdsPublisherSettingsTypEnabled=d.draftAdsPublisherSettingsTypEnabled,this.sandboxUrl={autocomplete:d.sandboxUrlAutocomplete,analytics:d.sandboxUrlAnalytics,appBridgeCheckoutCore:d.sandboxAppBridgeCheckoutCore,crypto:d.sandboxCrypto,wallets:{applePay:d.sandboxApplePay,paypal:d.sandboxPaypal,payWithPaypal:d.sandboxPayWithPaypal,venmo:d.sandboxVenmo,googlePay:d.sandboxGooglePay,amazonPay:d.sandboxAmazonPay,buyWithPrime:d.sandboxBuyWithPrime,stripeBank:d.sandboxStripeBank}},this.brandSettings=d.brandSettings,this.configurationPreviewContext=this.#s(c),this.remoteShopsConfigMap=this.#t(i.shop.remoteShopConfigurations,r,n)}hasFlagEnabled(e){return this.#e.has(e)}#t(e,t,i){if(!e.length)return;const r=t?.session.negotiate.result.__typename==="NegotiationResultAvailable"?t.session.negotiate.result.sellerProposal.remote?.remoteNegotiations:null,n=i?.latestReceipt?.__typename==="ProcessedReceipt"?i.latestReceipt.completedRemoteCheckouts:null,a=new Map;return r?.length&&r?.forEach(({shopId:o,sessionToken:d})=>{a.set(o,d)}),n?.length&&n?.forEach(({shopId:o,checkoutSessionToken:d})=>{a.set(o,d)}),new Map(e.map(o=>[o.id,{...o,sessionToken:a.get(o.id)}]))}#s(e){return e??"no-preview"}}function Ov(s){const e=new Map;for(const[t,i]of Object.entries(s)){if(typeof i=="number"&&i in lr){const n=t==="*"?"ZZ":t;e.set(n,{type:"national",strategy:i});continue}const r=Object.entries(i);r.length>0&&r.every(([,n])=>typeof n=="number"&&n in lr)&&e.set(t,{type:"regional",regions:new Map(r)})}return e}class Nv{constructor(e){const t=e.session?Uv(e.session):Fv(e);this.type=t.type,this.sourceId=t.sourceId,this.sourceVersion=t.sourceVersion,this.checkoutSessionIdentifier=t.checkoutSessionIdentifier,this.cartReturnUrl=t.cartReturnUrl,this.headerLogoUrl=t.headerLogoUrl,this.previewScript=t.previewScript,this.isAbandonedCheckoutSupported=t.isAbandonedCheckoutSupported}}function Bv(s){return s==="SHARED"||s==="CART"}function Fv({initialUrl:s,sourceId:e,checkoutSessionIdentifier:t,temporarySourceLog:i}){const r=s.pathname.includes("/sim/");return i(`Source Provider resolving type "${r?"simulated":"other"}" because session is undefined`,{sourceId:e,checkoutSessionIdentifier:t}),{type:r?"simulated":"other",sourceId:e,checkoutSessionIdentifier:t}}function Uv({checkoutSessionIdentifier:s,sessionType:e,sourceId:t,sourceVersion:i,previewScript:r,cartReturnUrl:n,headerLogoUrl:a,isAbandonedCheckoutSupported:o}){const d=o??!1;if(Bv(e))return{type:"other",sourceId:t,checkoutSessionIdentifier:s,isAbandonedCheckoutSupported:!1};switch(e){case"ORDER_EDIT":return{type:"orderEdit",sourceId:t,checkoutSessionIdentifier:s,sourceVersion:i??void 0,isAbandonedCheckoutSupported:d};case"CHECKOUT":return{type:"checkout",sourceId:t,checkoutSessionIdentifier:s,isAbandonedCheckoutSupported:d};case"ABANDONED_CART":return{type:"abandonedCart",sourceId:t,checkoutSessionIdentifier:s,isAbandonedCheckoutSupported:d};
66case"BUY_IT_NOW":return{type:"buyItNow",sourceId:t,checkoutSessionIdentifier:s,isAbandonedCheckoutSupported:d};case"SIMULATED":return{type:"simulated",sourceId:t,checkoutSessionIdentifier:s,isAbandonedCheckoutSupported:d};case"DRAFT_ORDER":return{type:"draftOrder",sourceId:t,checkoutSessionIdentifier:s,sourceVersion:i??void 0,isAbandonedCheckoutSupported:d};case"CART_API":return{type:"cartNext",sourceId:t,checkoutSessionIdentifier:s,cartReturnUrl:n??void 0,headerLogoUrl:a??void 0,previewScript:r??void 0,isAbandonedCheckoutSupported:d};case"PAYMENT_COLLECTION":return{type:"paymentCollection",sourceId:t,checkoutSessionIdentifier:s,isAbandonedCheckoutSupported:d};case"EXCHANGE":case"MERCHANT_DRIVEN":case"AD_HOC":case"BILLING_ATTEMPT":return{type:"other",sourceId:t,checkoutSessionIdentifier:s,isAbandonedCheckoutSupported:d};default:Ze(e)}}function xv(s){s instanceof Error&&(s._handledByErrorBoundary=!0)}function Vv(s){return s instanceof nt&&s.response.status===415}function Hv(s){return s==null||typeof s!="object"||!(s instanceof nt)?!1:s.response.redirected}function Zr(s){return ba(s,new Set)}function ba(s,e){return s==null||typeof s!="object"&&typeof s!="function"||e.has(s)?!1:(e.add(s),s instanceof nt&&(s.response.status===429||s.response.status===430)||s instanceof Error&&ba(s.cause,e))}function Gv(){const s=navigator.userAgent.toLowerCase();return s.includes("firefox")&&!s.includes("seamonkey")}function qv(s){return Gv()&&s instanceof Yt?s.message.includes("NetworkError when attempting to fetch resource"):!1}function Wv(s){return!(s instanceof jc)&&!(s instanceof Yt)&&!Vv(s)&&!(s instanceof Ln)&&!di(s.message)}class zv extends Error{constructor(){super(...arguments),this.name="TerminalErrorPageRenderError"}}class $v{#e;#t;#s;#i=is(navigator.userAgent);#r;#n=void 0;#a=!1;constructor({events:e,serializations:t,observability:i,onError:r}){this.#e=i,this.#t=r;const n=t.get("shop");this.#s={"serialized_shop.id":n.id,"serialized_shop.name":n.name,"serialized_shop.myshopify_domain":n.myshopifyDomain,"serialized_shop.origins":n.origins.join(",")},this.#r=ch(),e.addEventListener("bootloader:hydrate-end",()=>{this.#a=!0})}setEmbedClient(e){this.#n=e}async notify(e,{inErrorBoundary:t=!1}={}){if(e==null||!(e instanceof Error))return;const i=Hv(e);if(Wv(e)){const n=po(e);this.#e.error(e,{severity:"error",metadata:{userImpact:{terminalErrorPageDisplayed:!i},...n?{primitiveValueRender:n}:{}}}),t&&xv(e),console.error(e)}if(i||qv(e))return;try{await this.#t(e)}catch(n){const a=n instanceof Error?n:void 0;this.#e.error(new zv(a?.message??String(n),{cause:a}),{severity:"warning"})}!!Ys()?e instanceof mo?this.#d({reason:e.reason,error:e}):this.#a&&this.#d({reason:"checkout crashed",error:e}):this.#o({reason:"checkout crashed",error:e})}#o({reason:e,error:t}){const i=this.#c({reason:e,error:t});this.#e.log("error_logger_terminal_error_checkout_reported","Checkout crashed with terminal error",{...i,"event.code":"terminal_error"},{exportImmediately:!0}),this.#e.counter({name:"terminal_error",value:1,attributes:{checkoutType:"checkout",isBot:this.#i,rateLimited:Zr(t)}})}#d({reason:e,error:t}){const i=Ys();if(!i)return;const r=this.#c({error:t,reason:e});this.#e.log("error_logger_terminal_error_csk_reported","Emitting terminal checkout sheet protocol error event",{...r,checkoutSheetProtocolVersion:i,"event.code":"terminal_error_csk"},{exportImmediately:!0}),this.#e.counter({name:"terminal_error",value:1,attributes:{checkoutType:"checkout_sheet",checkoutSheetProtocolVersion:i,isBot:this.#i,rateLimited:Zr(t)}}),this.#l({reason:e})}#l({reason:e}){const t={handlerId:"error",body:[{flowType:"undefined",group:"unrecoverable",code:"sdk_not_enabled",reason:e}]};go(this.#e,t),uh(this.#e,t,this.#r),this.#n&&(this.#e.log("embed_protocol_error_posted","Posting error message to embed parent",{reason:e}),this.#n.error({code:"UNRECOVERABLE_FAILURE",message:e,severity:"unrecoverable",timestamp:Date.now()}))}#c({reason:e,error:t}){return{...this.#s,"error.message":t?.message,"error.stack":t?.stack,"error.cause":t?.cause,isBot:this.#i,redirect:!1,"event.group":"unrecoverable","event.reason":e}}}
66class Yv extends Error{constructor(e){super(e),this.name="UrlError"}}class jv{constructor({locale:e,shop:t,environment:i}){const r=new URL(`/${Je(t.id)}`,i.services.checkout.url).href,n=t.storefrontUrl;if(!n)throw new Yv("Invalid URL options provided");this.locale=e,this.servicesBaseUrl=Jr(r),this.shop=t,this.environment=i,this.storefrontBaseUrl=Jr(n)}sandboxGoogleMaps(e){const t=e?`&mapID=${e}`:"";return this.sandboxUrl(`google_maps?locale=${this.locale}${t}`)}sandboxAutocomplete(){return this.shop.sandboxUrl.autocomplete}sandboxAnalytics(){return this.shop.sandboxUrl.analytics}sandboxCrypto(){return this.shop.sandboxUrl.crypto}sandboxWallets(e){let t;switch(e){case"APPLE_PAY":t=this.shop.sandboxUrl.wallets.applePay??"";break;case"PAYPAL_EXPRESS":t=this.shop.sandboxUrl.wallets.paypal??"";break;case"PAY_WITH_PAYPAL":t=this.shop.sandboxUrl.wallets.payWithPaypal??"";break;case"VENMO":t=this.shop.sandboxUrl.wallets.venmo??"";break;case"GOOGLE_PAY":t=this.shop.sandboxUrl.wallets.googlePay??"";break;case At.AmazonPay:t=this.shop.sandboxUrl.wallets.amazonPay??"";break;case At.BuyWithPrime:t=this.shop.sandboxUrl.wallets.buyWithPrime??"";break;case"STRIPE_BANK":t=this.shop.sandboxUrl.wallets.stripeBank??"";break;default:Ze(e)}return t}sandboxAppBridge(){return this.shop.sandboxUrl.appBridgeCheckoutCore}privateAccessToken(e,t){const i=window.location.origin;return new URL(`${i}/${e?`checkout/${t}/`:""}private_access_tokens`)}cart(){return this.storefrontUrl("cart")}account(){return this.storefrontUrl("account")}profile(){return this.shop.customerAccountProfileUrl??this.account()}login(e){let t="account/login";return e&&(t+=`?checkout_url=${e}`),this.storefrontUrl(t)}logout(e){let t="account/logout";return e&&(t+=`?return_url=${encodeURIComponent(e)}`),this.storefrontUrl(t)}shopPayOptin(e){const t=this.storefrontBaseUrl;return new URL(`/shopify_pay/${e}/optin`,t).href}shopPayRememberMeUrl(e){const t=this.storefrontBaseUrl;return new URL(`/shopify_pay/${e}/remember_me`,t).href}shopPayRememberMe(){return new URL("/pay/remember-me",this.environment.services.shopServer.url).href}shopPaySession(){return"/pay/session"}shopPayCreateUnverifiedUser(){return"/pay/authentication/sign_up/create_unverified_user"}shopPayRedirect(){return new URL("/pay/session/create_and_redirect",this.environment.services.shopServer.url).href}storefront(e){return this.storefrontUrl(e)}developmentStoreOrderTestingDocs(){return"https://help.shopify.com/partners/dashboard/managing-stores/test-orders-in-dev-stores"}storefrontUrl(e=""){return`${this.storefrontBaseUrl}${en(e)}`}sandboxUrl(e){return`${this.servicesBaseUrl}sandbox/${en(e)}`}}function Jr(s){return s.endsWith("/")?s:`${s}/`}function en(s){return s.startsWith("/")?s.slice(1):s}const Sa="shopify.advertising.incentives.IncentivePresentedEvent";class tn extends Error{constructor(){super(...arguments),this.name="UnknownEventSeverityError"}}function Kv({proto:s,event:e,context:t,consentManager:i,surface:r,uniqueToken:n,visitToken:a,apiClientId:o,timestamp:d,messageId:l,browser:c}){const h=Qv(i),{source:b,dataOriginator:g}=e_(r);return s.createEnvelope({source:b,severity:Jv(e),eventClass:"EVENT_CLASS_EVENT",dataOriginator:g,client:{message:{id:l,createdAt:d},...c&&{browser:{...c,referrer:Jt(c.referrer),href:Jt(c.href),screenOrientation:c.screenWidth>c.screenHeight?"SCREEN_ORIENTATION_LANDSCAPE":"SCREEN_ORIENTATION_PORTRAIT"}}},shop:{id:{lowid:t.shopId}},user:{type:"USER_TYPE_BUYER",...n&&{domainScopedBrowserId:{value:n}},...t.customerId&&{customer:{id:{lowid:t.customerId}}}},userConsents:h,tags:t_(r),...a&&{session:{clientSessionToken:a}},...o&&{apiClient:{id:{lowid:String(o)}}}},Xv(s,e,t,r))}function Xv(s,e,t,i){switch(e.eventTypeName){case"shopify.apps.app_runtime.AppRuntimeClientEvent":{const r=Zv(e,t,i);if(e.type==="UI_EXTENSION_ERROR")return{...{type:e.type,target:e.extensionTarget,resultStatus:"RESULT_STATUS_FAILURE",resultDetails:e.code,...e.appApiKey&&{app:{appKey:e.appApiKey}},attributes:{...r,error_message:{string:e.message},...e.errorName&&{error_name:{string:e.errorName}},error_type:{string:e.code}}},[s.EventTypeIdentifier]:e.eventTypeName};if(e.type==="UI_EXTENSION_MOUNT_START"||e.type==="UI_EXTENSION_MOUNT_END"){const n={target:e.extensionTarget,...e.appApiKey&&{app:{appKey:e.appApiKey}},attributes:{...r,...e.mountId&&{mount_id:{string:e.mountId}},...e.registrationId&&{extension_registration_id:{string:e.registrationId}},...e.extensionId&&{extension_version_id:{string:e.extensionId}},...e.schemaVersion!=null&&{schema_version:{int:String(e.schemaVersion)}}}};return{...e.type==="UI_EXTENSION_MOUNT_START"?{...n,type:e.type,resultDetails:"MOUNT_START"}:{...n,type:e.type,resultStatus:e.mountOutcome==="SUCCESS"?"RESULT_STATUS_SUCCESS":"RESULT_STATUS_FAILURE",resultDetails:e.mountOutcome,executionDurationMs:Math.max(0,e.durationMs),attributes:{...n.attributes,...e.failureErrorName&&{failure_error_name:{string:e.failureErrorName}}
66,mount_outcome:{string:e.mountOutcome}}},[s.EventTypeIdentifier]:e.eventTypeName}}return e.type==="UI_EXTENSION_FETCH"?{...{type:e.type,target:e.extensionTarget,...e.appApiKey&&{app:{appKey:e.appApiKey}},attributes:{...r,response_duration_ms:{int:String(Math.round(e.durationMs))},...e.httpStatus!=null&&{response_status:{int:String(e.httpStatus)}},request_http_method:{string:e.httpMethod},request_url:{string:Jt(e.requestUrl)}}},[s.EventTypeIdentifier]:e.eventTypeName}:e}case"shopify.event.BuyerEvent":return{...{eventType:e.type,...e.checkoutToken&&{cartSession:{sourceId:e.checkoutToken}}},[s.EventTypeIdentifier]:e.eventTypeName};case Sa:return{...{surface:"INCENTIVE_SURFACE_SHOP_PAY_CHECKOUT",resolutionId:e.resolutionId,incentives:e.incentives.map(n=>n.rendered?{type:n.type,rendered:!0,component:n.component,displayLabel:n.displayLabel}:{type:n.type,rendered:!1}),checkout:{checkoutToken:e.checkoutToken}},[s.EventTypeIdentifier]:e.eventTypeName};default:return e}}function Qv(s){return[...s.analyticsProcessingAllowed.value?[{consentType:"USER_CONSENT_TYPE_ANALYTICS"}]:[],...s.marketingAllowed.value?[{consentType:"USER_CONSENT_TYPE_MARKETING"}]:[],...s.preferencesProcessingAllowed.value?[{consentType:"USER_CONSENT_TYPE_PREFERENCES"}]:[],...s.saleOfDataAllowed.value?[{consentType:"USER_CONSENT_TYPE_SALE_OF_DATA"}]:[]]}function Zv(s,e,t){return{app_version:{string:s.appVersion},api_version:{string:s.apiVersion},api_client_id:{string:s.appId},...s.registrationId&&{extension_registration_id:{string:s.registrationId}},...s.extensionId&&{extension_version_id:{string:s.extensionId}},...s.placementReference&&{extension_placement_reference:{string:s.placementReference}},...e.checkoutToken&&{checkout_token:{string:e.checkoutToken}},...s.context?.browser&&{user_agent:{string:s.context.browser}},...s.context?.deviceType&&{device_type:{string:s.context.deviceType}},...s.context?.browserConnectionType&&{browser_connection_type:{string:s.context.browserConnectionType}},...s.schemaVersion!=null&&{schema_version:{int:String(s.schemaVersion)}},...(s.type==="UI_EXTENSION_ERROR"||s.type==="UI_EXTENSION_MOUNT_START"||s.type==="UI_EXTENSION_MOUNT_END")&&{surface:{string:t==="shop_pay"?"SHOP_PAY":"CHECKOUT"}}}}function Jv(s){switch(s.eventTypeName){case"shopify.apps.app_runtime.AppRuntimeClientEvent":switch(s.type){case"UI_EXTENSION_ERROR":return"EVENT_SEVERITY_ERROR";case"UI_EXTENSION_MOUNT_START":case"UI_EXTENSION_MOUNT_END":case"UI_EXTENSION_FETCH":return"EVENT_SEVERITY_EVENT";default:throw new tn("Unknown app runtime event type")}case"shopify.event.BuyerEvent":case Sa:return"EVENT_SEVERITY_EVENT";default:throw new tn(`Unknown eventTypeName: ${s.eventTypeName}`)}}function e_(s){return s==="shop_pay"?{source:"EVENT_APP_SHOP_PAY",dataOriginator:"DATA_ORIGINATOR_SHOPIFY"}:{source:"EVENT_APP_STOREFRONT",dataOriginator:"DATA_ORIGINATOR_MERCHANT"}}function t_(s){return[{key:"client_surface",value:{string:"checkout-web"}},{key:"client_surface_variant",value:{string:s==="shop_pay"?"shop-pay":"storefront"}}]}function s_(){if(!(typeof window>"u"))return{referrer:document.referrer||void 0,href:window.location.href,screenWidth:window.screen.width,screenHeight:window.screen.height,windowInnerWidth:window.innerWidth,windowInnerHeight:window.innerHeight}}const i_=2e3,Fs=100;class sn extends ve{constructor(){super(...arguments),this.name="EventRefineryImportError"}}class r_ extends ve{constructor(){super(...arguments),this.name="EventRefineryError"}}const n_=new Set(["Failed to fetch","Load failed","NetworkError when attempting to fetch resource.","Network request failed"]),a_=new Set(["BreadcrumbsPluginFetchError","AbortError","TimeoutError"]),o_=["Importing a module script failed","Failed to fetch dynamically imported module","error loading dynamically imported module","Cannot load script due to integrity mismatch"];function d_(s){return typeof s!="string"?!1:n_.has(s)||o_.some(e=>s.includes(e))}const l_=5;function Aa(s,e=0){if(s==null||typeof s!="object")return!1;const{name:t,message:i,cause:r}=s;return typeof t=="string"&&a_.has(t)||d_(i)?!0:e<l_&&Aa(r,e+1)}function c_(s){const e=s?.name;return typeof e=="string"?e:"unknown"}
66function u_(){const s={};if(typeof document<"u"&&(s.visibilityState=document.visibilityState),typeof navigator<"u"){s.onLine=navigator.onLine;const e=navigator.connection;e?.effectiveType&&(s.effectiveType=e.effectiveType)}return s}function h_(s){return s instanceof Error&&s.name==="ProtoTransportError"&&typeof s.phase=="string"&&typeof s.details=="object"&&s.details!==null}class p_{#e=[];#t;#s;#i;#r;#n;#a;#o;#d;#l;#c=new WeakSet;constructor(e,t,{surface:i,apiClientId:r,getUniqueToken:n,getVisitToken:a}){this.#s=e,this.#i=t,this.#r=_(()=>t.analyticsProcessingAllowed.value||t.marketingAllowed.value||t.preferencesProcessingAllowed.value),this.#a=i,this.#o=r,this.#d=n,this.#l=a,this.#m(),this.#u()}flush(){try{this.#t&&(this.#g(),this.#t.flush())}catch(e){this.#h(e)}}emit(e){try{if(e.error)throw e.error;const t=new Date().toISOString(),i=s_();this.#e.length>=Fs&&(this.#e.shift(),this.#s.log("event_refinery_queue_overflow",`Event Refinery queue is full; dropped the oldest buffered event (queue limit: ${Fs})`,{queueLimit:Fs})),this.#e.push({payload:e,timestamp:t,browser:i}),this.#t?this.#g():this.#n===void 0&&(this.#n=this.#p())}catch(t){this.#h(t)}}#h(e){if(e!=null&&typeof e=="object"){if(this.#c.has(e))return;this.#c.add(e)}const t=e instanceof Error?e.message:String(e),r={eventRefinery:u_(),...h_(e)&&{protoTransport:{phase:e.phase,...e.details}}},n=e instanceof sn;if(Aa(e)){this.#s.log("event_refinery_transient_failure",t,{...r,errorName:c_(e)});return}this.#s.error(n?e:new r_(t,{cause:e}),{severity:"warning",metadata:r})}#u(){if(typeof window>"u")return;const e=()=>this.flush();window.addEventListener("pagehide",e),window.addEventListener("beforeunload",e),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&this.flush()})}#m(){se(()=>{this.#r.value&&this.#t&&this.#e.length>0&&this.#g()})}async#p(){try{await new Promise(t=>{typeof globalThis.requestIdleCallback=="function"?globalThis.requestIdleCallback(()=>t(),{timeout:i_}):setTimeout(()=>t(),0)});const{createProtoHub:e}=await L(async()=>{const{createProtoHub:t}=await import("./client.DRetCTka.js");return{createProtoHub:t}},__vite__mapDeps([25,26]));this.#t=e(),this.#g()}catch(e){this.#h(new sn(String(e),{cause:e})),this.#n=void 0}}#g(){if(!this.#r.peek()){this.#s.debug("EventRefineryEmitter","Event not emitted: no consent granted");return}const e=this.#e;this.#e=[];for(const{payload:t,timestamp:i,browser:r}of e)this.#f(t,i,r)}#f(e,t,i){if(!this.#t){this.#s.debug("EventRefineryEmitter","Proto hub is not available");return}try{const{event:r,context:n}=e,a=Kv({proto:this.#t.proto,event:r,context:n,consentManager:this.#i,surface:this.#a,uniqueToken:this.#d(),visitToken:this.#l(),apiClientId:this.#o,timestamp:t,messageId:this.#t.createMessageId(),browser:i});this.#t.client.produceEvent(a).catch(o=>{this.#h(o)})}catch(r){this.#h(r)}}}class m_{constructor(e){this.do=async(t,i)=>{const r=await i(t);if(this.#e.monorail&&r.status!==0)try{g_(t)}catch{}return r},this.#e=e}#e}function g_(s){const e="events"in s?s.events:[s],t="events"in s?s.metadata:void 0;console.groupCollapsed(`Monorail events produced (${e.length}):`),t&&(console.log("Metadata:"),console.table(t));for(const i of e)console.groupCollapsed(`${i.schemaId}`),console.table(i.payload),i.metadata&&(console.log("Event metadata:"),console.table(i.metadata)),console.groupEnd();console.groupEnd()}class f_ extends Uo{#e;constructor(e){super(e),this.#e=e.consentManager}async annotateEvent(e){if(this.version==="v1"){const t=this.getConsentV1Data(),i=this.#e.consentProvider,r=this.version;return{...e,payload:{...e.payload,...this.#t(e.payload)},metadata:{...e.metadata,consent:t,consent_provider:i,consent_version:r}}}else throw new rn(this.version||"unknown")}getRequiredConsentForEmission(){if(this.version==="v1")return["anal
66ytics","marketing"];throw new rn(this.version||"unknown")}#t(e){const t={};return"buyerConsentAnalyticsAllowed"in e&&(t.buyerConsentAnalyticsAllowed=this.#e.analyticsProcessingAllowed.value),"buyerConsentMarketingAllowed"in e&&(t.buyerConsentMarketingAllowed=this.#e.marketingAllowed.value),"buyerConsentSaleOfDataAllowed"in e&&(t.buyerConsentSaleOfDataAllowed=this.#e.saleOfDataAllowed.value),t}getConsentV1Data(){return[["analytics",this.#e.analyticsProcessingAllowed.value],["marketing",this.#e.marketingAllowed.value],["sale_of_data",this.#e.saleOfDataAllowed.value],["preferences",this.#e.preferencesProcessingAllowed.value]].filter(([,t])=>t).map(([t])=>t)}}class rn extends Error{constructor(e){super(`Unsupported consent version: ${e}`),this.name="CheckoutConsentProviderVersionError"}}function y_(s,e){const{checkout:t,client:i,i18n:r,shop:n,source:a}=s,o=t.proposal.negotiated.fields.checkoutCompletionTarget.value==="DRAFT_ORDER";return{apiClientId:i.apiClientId,browser:i.userAgent,checkoutToDraft:o,checkoutToken:e,clientHydrated:i.initialRequest.isServerRendered,clientIp:"0.0.0.0",currency:r.currency,deviceType:v_(i.userAgent)?"mobile":"desktop",frontendEventTimestampEpochMs:Date.now(),frontendEventTimeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,locale:r.locale,pageLoadId:oi,payNowOnly:!t.proposal.negotiated.fields.paymentFlexibilityPaymentTermsTemplate.value&&!o,serverRendered:i.initialRequest.isServerRendered,shopId:n.id,sourceDesign:t.configuration.layout.isOnePage.value?"c1_redesign":"c1_legacy",sourceId:a.sourceId,sourceType:a.type}}function v_(s){return/iPhone|iPad|iPod|Android/i.test(s)}const __="wallet_prefilled_guest_checkout_impression",b_="wallet-prefilled-guest-arrival:",S_=new Set(["/","/information","/shipping","/payment","/review"]);class A_{#e=new Set;#t;constructor(e=()=>window.sessionStorage){this.#t=e}claim(e,t){if(this.#e.has(e)||(this.#e.add(e),!t))return!1;try{const i=this.#t(),r=`${b_}${e}`;if(i.getItem(r)!==null)return!1;i.setItem(r,"1")}catch{}return!0}}const E_=new A_;function P_(s,e=E_){const t=s.client.initialRequest.url;if(!t.searchParams.has(Kc))return;const i=Xc(t);s.events.addEventListener("bootloader:hydrate-end",()=>{I_();const r=s.source.checkoutSessionIdentifier;if(!r||!C_(T_(s,i)))return;const n=s.consentManager.analyticsProcessingAllowed.value||s.consentManager.marketingAllowed.value;e.claim(r,n)&&s.userEvents.monorailEvent(w_(s,r))},{once:!0})}function C_({contactMethodPrefilled:s,hasContact:e,hasReceipt:t,hasShippingAddress:i,identity:r,markerSource:n,normalizedPath:a,deliverySkipsShippingAddress:o,shippingRequired:d,sourceIsMerchantGuestReturn:l,trackingEnabled:c}){const h=!d||o||i;return n==="shop_pay"&&c&&l&&S_.has(a)&&r==="guest"&&!t&&s&&e&&h}function T_(s,e){const{checkout:t,router:i,shop:r,source:n}=s,a=t.proposal.proposed,o=a.shippingAddress.value;return{contactMethodPrefilled:t.identity.customerContactMethodPrefilled,hasContact:!!(a.email.value||a.phone.value),hasReceipt:t.latestReceipt.value!==void 0,hasShippingAddress:!!(o.address1&&o.countryCode),identity:t.identity.current.value,markerSource:e,normalizedPath:i.currentUrl.value.normalizedPath,deliverySkipsShippingAddress:k_(t.proposal.negotiated.fields.deliveryNext.value),shippingRequired:t.isShippingRequired.value,sourceIsMerchantGuestReturn:Jc(n.type),trackingEnabled:r.hasFlagEnabled(Zc)}}function k_(s){if(!s||s.status!=="filled")return!1;const e=s.lines.filter(t=>t.status==="available");return e.length>0&&e.every(t=>{const i=t.methods.find(r=>r.handle===t.selectedDeliveryMethodHandle);return i!==void 0&&i.methodType!=="SHIPPING"&&i.methodType!=="LOCAL"})}function w_(s,e){return{schemaId:"checkout_c1_interaction_and_impression_events/2.25",payload:{...y_(s,e),eventName:__,eventType:"impression",eventValue:"shop_pay",impressionFeatures:["client_marker_approximate"]}}}function I_(){try{const s=new URL(window.location.href);Qc(s),window.history.replaceState(window.history.state,"",s)}catch{}}const R_=P_,M_=10;class D_{#e;#t;#s;#i;#r=[];#n=0;#a;#o=()=>{this.#c({keepalive:!0})};constructor({observability:e,consentManager:t,environment:i,refinery:r}){this.#e=e;const n=[],a=L_(e,t);a&&n.push(a),n.push(new m_(i.debug)),this.#t=Vi.createHttpProducer({production:!0,middleware:n}),this.#s=Vi.createHttpProducer({production:!0,options:{keepalive:!0},middleware:n}),this.#i=new p_(e,t,r),window.addEventListener("pagehide",this.#o,{capture:!0})}monorailEvent(e,t){if(t?.exportImmediately){this.#d(e);return}const i=nn(e);this.#r.push(i),this.#l()}async#d(e){const t=nn(e);try{await this.#s.produce(t),this.#e.counter({name:"monorail_error",value:1,attributes:{success:"true",retries:this.#n.toString()}})}catch(i){i instanceof Hi?this.monorailEvent(e):this.#e.counter({name:"monorail_error",value:1,attributes:{success:"false",retries:this.#n.toString()}})}}async emitMonorailEvents(){await this.#c()}#l(){clearTimeout(this.#a),this.#a=setTimeout(()=>this.emitMonorailEvents(),500)}async#c(e){const t=this.#r;if(this.#r=[],!(t.length<=0))try{await this.#t.produceBatch({events:t,options:e}),this.#e.counter({name:"monorail_error",value:1,attributes:{success:"true",retries:this.#n.toString()}}),this.#n=0}catch(i){i instanceof Hi&&this.#n<M_?(this.#n++,this.#r=t.concat(this.#r),this.#l()):this.#e.counter({name:"monorail_error",value:1,attributes:{success:"false",retries:this.#n.toString()}})}}refineryEvent(e){this.#i.emit(e)}}function L_(s,e){try{const t=new f_({version:"v1",consentManager:e});return new xo({provider:t})}catch{return s.error(new O_("Could not build consent tracking middleware")),null}}function nn(s){return{...s,metadata:{eventCreatedAtMs:Date.now()}}}
66class O_ extends Error{constructor(){super(...arguments),this.name="FailedToBuildMonorailMiddlewareError"}}const N_={checkout:!0,cartNext:!0,buyItNow:!0,abandonedCart:!0,draftOrder:!1,orderEdit:!1,paymentCollection:!1,simulated:!1,shopPayExternal:!1,other:!1};function B_({checkout:s,shop:e,source:t,mobileCheckoutSdk:i,embed:r},{serializations:n,initialNegotiation:a}){const o=s.latestReceipt.value?.status==="processed",d=o||a?.__typename==="NegotiationResultAvailable"&&a.sellerProposal.buyerIdentity.__typename==="FilledBuyerIdentityTerms",l=n.get("forcedRedesignWallet")?"three-page":n.get("checkoutLayout"),c=s.identity.current.value,h=s.proposal.negotiated.fields.buyerIdentity.value,b=s.proposal.negotiated.fields.remoteMerchandiseDetails.value,g=t!=null&&(N_[t.type]===!0||o&&t.type==="other"&&["co","cn","bin","ac"].includes(n.get("sourceType")??""));if(!e.hasFlagEnabled(eu))return"flag_disabled";if(!d)return"boot_data_unresolved";if(!g)return"unsupported_source";if(c==null||c==="businessCustomer")return"unsupported_identity";if(h==null)return"buyer_identity_unresolved";if(h.purchasingCompany||h.customerProfile?.__typename==="BusinessCustomerProfile")return"business_buyer";if(c!=="shopPay"&&l!=="one-page"&&!(o&&n.get("receipt")?.shopPay===!0))return"unsupported_layout";if(i.enabled)return"mobile_checkout_sdk";if(r!=null)return"embedded";if(!o&&b==null)return"merchandise_unresolved";if(b?.stableIdToShopId.size)return"multi_shop_merchandise"}function db({identity:s}){return s.current.value!=="shopPay"}function F_(s,{unregisterInitializingTool:e,...t}){const i=U_();if(!i){e?.();return}const r=x_(i)?B_(s,t):"model_context_unusable";if(r){s.observability.log("web_mcp_ineligible","[WebMcp] checkout is not eligible for tools",{reason:r}),e?.();return}return new G_(i,s,e)}function U_(){try{return typeof document>"u"?void 0:document.modelContext??void 0}catch{return}}function x_(s){try{return typeof s.registerTool=="function"}catch{return!1}}function Ea(){const s=Symbol.for("shopify.checkout.webMcp.initializingTool");return s in window?window[s]:void 0}function Ht(){try{const s=Ea();s&&typeof s=="object"&&"unregister"in s&&typeof s.unregister=="function"&&Promise.resolve(s.unregister()).catch(()=>{})}catch{}}class V_ extends Error{constructor(){super(...arguments),this.name="WebMcpInitializationError"}}function H_({observability:s}){try{const e=Ea();if(!e||typeof e!="object"||!("result"in e))return;Promise.resolve(e.result).then(t=>{if(!(!t||typeof t!="object"||!("error"in t)))return s.error(t.error instanceof Error?t.error:new V_(String(t.error)),{severity:"warning"})}).catch(()=>{})}catch{}}class G_{#e=new AbortController;#t=u(!1);#s;#i;#r;#n=u(!1);#a=u(void 0);#o;#d;#l;#c=new Map;constructor(e,{events:t,...i},r){this.modelContext=e,this.hasToolCallStarted=this.#t,this.#s=i,this.#i=r,i.shop.hasFlagEnabled(tu)?t.addEventListener("bootloader:hydrate-start",()=>this.#g(),{once:!0,signal:this.signal}):t.addEventListener("bootloader:hydrate-end",()=>this.#m(),{once:!0,signal:this.signal})}#h;unstable_provideFulfillmentController(e){return this.signal.aborted?()=>{}:(this.#h=e,()=>{this.#h===e&&(this.#h=void 0)})}#u;unstable_provideStoreCreditController(e){return this.signal.aborted?()=>{}:(this.#u=e,()=>{this.#u===e&&(this.#u=void 0)})}get activeTool(){return this.#r}get signal(){return this.#e.signal}getSubmittingAgenticToken(){return this.#n.value?this.#a.value?.credential?.token:void 0}unstable_providePreactContext(e){this.signal.aborted||(this.#o=e)}unstable_provideSavedCardSelector(e){return this.signal.aborted?()=>{}:(this.#l=e,()=>{this.#l===e&&(this.#l=void 0)})}unstable_registerDeclaredField(e){return this.signal.aborted?()=>{}:(this.#c.set(e.key,e),()=>{this.#c.get(e.key)===e&&this.#c.delete(e.key)})}teardown(){this.#e.abort(),this.#l=void 0,this.#h=void 0,this.#u=void 0,this.#a.value=void 0,this.#n.value=!1,this.#o=void 0,this.#d?.(),this.#d=void 0,this.#c.clear(),this.#i?.()}#m(){const e=document.body;if(this.signal.aborted||!e)return;if(!e.classList.contains("Loading")){this.#p();return}const t=new MutationObserver(()=>{e.classList.contains("Loading")||(t.disconnect(),this.#d=void 0,this.#p())});t.observe(e,{attributes:!0,attributeFilter:["class"]}),this.#d=()=>t.disconnect()}#p(){if(this.signal.aborted)return;const e=()=>{this.#d=void 0,this.#g()};if(typeof window.requestIdleCallback=="function"&&typeof window.cancelIdleCallback=="function"){const t=window.requestIdleCallback(e,{timeout:1e3});this.#d=()=>window.cancelIdleCallback(t)}else{const t=window.setTimeout(e,0);this.#d=()=>window.clearTimeout(t)}}#g(){this.signal.aborted||ts(()=>L(()=>import("./web-mcp-runtime.IXKgLCgF.js").then(e=>e.w),__vite__mapDeps([27,3,2,4,5,6,28,16,23,21,12]))).then(({registerWebMcpTools:e})=>{this.signal.aborted||e({...this.#s,unregisterInitializingTool:this.#i,modelContext:this.modelContext,signal:this.signal,onActiveToolCreated:t=>{this.#r=t},isSubmitting:this.#n,paymentInstrument:this.#a,getPreactContext:()=>this.#o,getSavedCardSelector:()=>this.#l,declaredFields:this.#c,getFulfillmentProvider:()=>this.#h,markToolCallStarted:()=>{this.#t.value=!0},getStoreCreditProvider:()=>this.#u})}).catch(e=>{this.#s.observability.error(e,{severity:"warning"})})}}function q_(s,e){return s.unstable_getSerialization("experiments")?.some(t=>t.clientHandle===e&&t.variant==="treatment")??!1}
66class W_ extends Error{constructor(){super(...arguments),this.name="EmbedModuleLoadError"}}async function z_({rootElement:s,onTerminalError:e,eagerAppMetafieldsExperiment:t}){let i,r;try{const n=new Bf,a=document.documentElement.lang,o=new yf,d=o.get("trackingConsent");d&&gt(d);const l=new pf({rootElement:s,serializations:o});l.prepare();const{initialRequest:{url:c}}=l,h=new Nf({serializations:o}),b=Dv({client:l,environment:h}),g=Vo(c,{isShopPayActive:b,isShopPayExternal:!1}),v=new sv({events:n,appType:o.get("checkoutLayout"),environment:h,serializations:o,locale:a,source:g?.source});H_({observability:v});const E=B=>{const re=new W_(B instanceof Error?B.message:String(B));B instanceof Error&&(re.cause=B),v.error(re,{severity:"warning"})},y=su(c)?L(()=>import("./embed-browser.790EZfnB.js").then(B=>B.d),__vite__mapDeps([29,3,30,2,4,5,6,31])).catch(B=>(E(B),null)):null;y&&y.then(B=>B?.preloadEmbedClient(iu(c))).catch(E);const p=new $v({events:n,serializations:o,observability:v,onError:B=>(Ht(),r?.(),e(B))});i={client:l,observability:v,terminalErrorHandler:p};const f=new hv({client:l,isShopPayActive:b,serverRenderedRoute:o.get("serverRenderedRoute"),isSessionFinished:o.get("sessionFinished")});let m;const A=o.get("shop")?.enabledFlags?.includes(In)??!1,I=A?o.get("userPrivacySettings")?.trackingConsentHeader??void 0:void 0,P=()=>{if(A)return m?m.trackingConsentHeader:I};let T;const R=()=>T?.activeTool?.current,M=new qf({environment:h,serializations:o,observability:v,isShopPayActive:b,userAgent:l.userAgent,getTrackingConsentHeader:P,getWebMcpToolName:R}),k=o.get("receipt"),O=o.get("sessionFinished");lf({serializedReceipt:k,sessionFinished:O});const w=(O??!0)||!!(k?.exists&&k?.inProgress&&k?.status!=="action_required"),[{data:D,error:G},{data:U,error:C},{data:Y,error:Ue},{data:be,error:xe},{data:Ie,error:Se},{data:x,error:W}]=await Promise.all([M.staticQuery(fh,{variables:{queryString:c.searchParams.toString()}}),M.staticQuery(ru,{skip:w,variables:{checkpointData:o.get("checkpointData")??null,queueToken:o.get("queueToken")??null}}),M.staticQuery(mh),M.staticQuery(yh),M.staticQuery(vh),(async()=>{try{const{default:B}=await ph(Object.assign({
66"../../generated/translations/ar.json":()=>L(()=>import("./locale-ar.BIwTE2Z9.js"),[]),
66"../../generated/translations/bg.json":()=>L(()=>import("./locale-bg.CPxIOgZz.js"),[]),
66"../../generated/translations/bn.json":()=>L(()=>import("./locale-bn.j4OdYWyC.js"),[]),
66"../../generated/translations/ca.json":()=>L(()=>import("./locale-ca.DZDEDgDL.js"),[]),
66"../../generated/translations/cs.json":()=>L(()=>import("./locale-cs.Bww1RE3l.js"),[]),
66"../../generated/translations/da.json":()=>L(()=>import("./locale-da.Dhx29WNR.js"),[]),
66"../../generated/translations/de.json":()=>L(()=>import("./locale-de.BxvAiM8t.js"),[]),
66"../../generated/translations/el.json":()=>L(()=>import("./locale-el.DVx2mTDf.js"),[]),
66"../../generated/translations/en.json":()=>L(()=>import("./locale-en.C0o8inDU.js"),[]),
66"../../generated/translations/es.json":()=>L(()=>import("./locale-es.zCflzoNt.js"),[]),
66"../../generated/translations/et.json":()=>L(()=>import("./locale-et.Dl6E5mzY.js"),[]),
66"../../generated/translations/eu.json":()=>L(()=>import("./locale-eu._-aLmZZf.js"),[]),
66"../../generated/translations/fi.json":()=>L(()=>import("./locale-fi.DoRwj18N.js"),[]),
66"../../generated/translations/fr.json":()=>L(()=>import("./locale-fr.DJAVhpW7.js"),[]),
66"../../generated/translations/gl.json":()=>L(()=>import("./locale-gl.Clelb2ei.js"),[]),
66"../../generated/translations/gu.json":()=>L(()=>import("./locale-gu.CkR6hYAI.js"),[]),
66"../../generated/translations/he.json":()=>L(()=>import("./locale-he.BBq8oN2R.js"),[]),
66"../../generated/translations/hi.json":()=>L(()=>import("./locale-hi.DM12Dd6R.js"),[]),
66"../../generated/translations/hr.json":()=>L(()=>import("./locale-hr.w3Voq1bj.js"),[]),
66"../../generated/translations/hu.json":()=>L(()=>import("./locale-hu.C1q3zRKa.js"),[]),
66"../../generated/translations/id.json":()=>L(()=>import("./locale-id.DAQpkg6M.js"),[]),
66"../../generated/translations/it.json":()=>L(()=>import("./locale-it.CT5z38kJ.js"),[]),
66"../../generated/translations/ja.json":()=>L(()=>import("./locale-ja.DRzlEjJF.js"),[]),
66"../../generated/translations/ka.json":()=>L(()=>import("./locale-ka.CF2hX24M.js"),[]),
66"../../generated/translations/ko.json":()=>L(()=>import("./locale-ko.CViuHAiW.js"),[]),
66"../../generated/translations/lt.json":()=>L(()=>import("./locale-lt.Dmba7pT5.js"),[]),
66"../../generated/translations/lv.json":()=>L(()=>import("./locale-lv.Km6Xj8dX.js"),[]),
66"../../generated/translations/mr.json":()=>L(()=>import("./locale-mr.B8EdFOWD.js"),[]),
66"../../generated/translations/ms.json":()=>L(()=>import("./locale-ms.Dm0uEe-K.js"),[]),
66"../../generated/translations/nb.json":()=>L(()=>import("./locale-nb.BoudgUz7.js"),[]),
66"../../generated/translations/nl.json":()=>L(()=>import("./locale-nl.BMJSsfph.js"),[]),
66"../../generated/translations/no.json":()=>L(()=>import("./locale-no.BoudgUz7.js"),[]),
66"../../generated/translations/pl.json":()=>L(()=>import("./locale-pl.u6hOBAfK.js"),[]),
66"../../generated/translations/pt-BR.json":()=>L(()=>import("./locale-pt-BR.8nagGrtz.js"),[]),
66"../../generated/translations/pt-PT.json":()=>L(()=>import("./locale-pt-PT.Dm4ow3H-.js"),[]),
66"../../generated/translations/ro.json":()=>L(()=>import("./locale-ro.B9v8jK_Z.js"),[]),
66"../../generated/translations/ru.json":()=>L(()=>import("./locale-ru.CMUojch7.js"),[]),
66"../../generated/translations/sk.json":()=>L(()=>import("./locale-sk.DNT4yK80.js"),[]),
66"../../generated/translations/sl.json":()=>L(()=>import("./locale-sl.BHINF42L.js"),[]),
66"../../generated/translations/sr.json":()=>L(()=>import("./locale-sr.DpD8Irh2.js"),[]),
66"../../generated/translations/sv.json":()=>L(()=>import("./locale-sv.BbSxlXPS.js"),[]),
66"../../generated/translations/ta.json":()=>L(()=>import("./locale-ta.DgE7RxhH.js"),[]),
66"../../generated/translations/te.json":()=>L(()=>import("./locale-te.BQBd8X4S.js"),[]),
66"../../generated/translations/th.json":()=>L(()=>import("./locale-th.BVP_WXr7.js"),[]),
66"../../generated/translations/tr.json":()=>L(()=>import("./locale-tr.CZPQ64jl.js"),[]),
66"../../generated/translations/uk.json":()=>L(()=>import("./locale-uk.Di7Ku5Yp.js"),[]),
66"../../generated/translations/ur.json":()=>L(()=>import("./locale-ur.BbfN8pTw.js"),[]),
66"../../generated/translations/vi.json":()=>L(()=>import("./locale-vi.DKKVrJDK.js"),[]),
66"../../generated/translations/zh-CN.json":()=>L(()=>import("./locale-zh-CN.DqSgplbY.js"),[]),
66"../../generated/translations/zh-TW.json":()=>L(()=>import("./locale-zh-TW.DHjGJnhd.js"),[])
66}),`../../generated/translations/${o.get("clientBundleInfo").locale}.json`,5);return{data:B,error:null}}catch(B){return{data:null,error:B}}})()]);if(D==null)throw G;const V=cr(D);if(V&&Ht(),C)throw di(C.message)?new Ln:C;if(Ie==null)throw Se;if(Y==null)throw Ue;if(be==null)throw xe;if(!be.shop)throw new _h("Shop details are missing",{groupingHash:"BrandingMissingShopError::ShopDetailsMissing"});if(x==null)throw W;const H=new Nv({session:U?.session,initialUrl:c,sourceId:o.get("sourceToken"),checkoutSessionIdentifier:o.get("checkoutSessionIdentifier"),temporarySourceLog:(B,re)=>{re.negotiate_from_session_skipped=w,re.initial_url=c.toString(),v.log("CreateSource",B,re)}}),z=new up({config:D.mobileCheckoutSdkConfig,serializations:o});pp({serializations:o,observability:v,checkoutSdkConfig:D.mobileCheckoutSdkConfig,checkoutSheetProtocolConfig:D.checkoutSheetProtocolConfig});const te=(async()=>{try{const B=U?.session.negotiate.result,re=B?.__typename==="NegotiationResultAvailable"?B.sellerProposal.payment:void 0,We=re?.__typename==="FilledPaymentTerms"&&re.availablePaymentLines.some(ns=>ns.paymentMethod.__typename==="ShopifyInstallmentsWalletConfig");return await M.staticQuery(gh,{skip:!We})}catch(B){return{data:null,error:B}}})(),{data:$,error:K}=await te;if(K)throw K;const oe=await cf({serializedReceipt:k,observability:v}),X=g?.shopPaySimulated??!1,de=X||b,Ae=nu(c,o.get("embed")?.embedder)?[au]:[],j=new Lv(de,Y,D,U,k,Ie,Ae),et=Y?.checkoutProfile??void 0,ee=ou(D,{client:l,userAgent:l.userAgent}),Q=!!ee?.isFlagshipPartner,Ve=Q&&!Ne(ee?.embedder)&&!du(ee?.embedder),he=H.type==="simulated"?void 0:new cv({storage:de&&!V?"sessionStorage":"localStorage"}),ie=new Rv({client:l,environment:h,persistence:he,source:H,financingPlans:$?.spiFinancingPlans??[],serializations:o,router:f,mobileCheckoutSdk:z,cookies:l.cookies,shouldUseAccessToken:V,enableCardVaulting:!Ve,isSimulated:X,showSwitchAccount:!Q,showCheckoutAsGuest:Y.appConfiguration?.checkoutAsGuest?.visibility!=="HIDDEN",preserveUnavailableSelection:j.hasFlagEnabled(lu)}),He=new $f({environment:h,observability:v,serializations:o,shopPay:ie,isEmbedded:V,getTrackingConsentHeader:P}),dt=new Kf({environment:h,observability:v,serializations:o}),lt={coreGraphql:M,shopPayGraphql:He,throttleGraphql:dt};if(m=new Df({shopPayIsActive:de,useShopConsent:A,shopPayGraphql:He,observability:v,shopPay:ie,merchantTrackingConsent:Cu(c.searchParams.get("_mcs")),prefetchedTrackingConsentHeader:I,countryCode:D.httpRequestInfo.geolocation?.country?.code}),A){const B=o.get("userPrivacySettings");B&&m.setPrefetchedConsent(B)}const wt=o.get("shopPayConfig"),ct=new D_({observability:v,environment:h,consentManager:m,refinery:{surface:de?"shop_pay":"storefront",apiClientId:l.unstable_getSerialization("apiClientId"),getUniqueToken:()=>wt.tracking_unique??Xt({serialized:o.get("shopifyY"),expiration:o.get("shopifyYExpiration")})??void 0,getVisitToken:()=>wt.tracking_visit??Xt({serialized:o.get("shopifyS"),expiration:o.get("shopifySExpiration")})??void 0}}),Ee=new Jf({locale:a,shop:j,translations:x,onError:B=>v.error(B,{severity:"info"})}),Ge=new jv({locale:Ee.locale,shop:j,environment:h,initialUrl:c}),qe=new of({receipt:oe,profile:et,source:H,checkoutContextData:Y,themeData:be.shop,shop:j,mobileCheckoutSdk:z,client:l,persistence:he,shopPay:ie,shopPayIsActive:de,requestInfoData:D,isEmbedded:V,isEmbeddedPartner:!!ee?.isFlagshipPartner,observability:v,userEvents:ct,embed:ee,serializations:o,events:n,graphql:lt,i18n:Ee,router:f,initialNegotiationData:U,url:Ge,eagerlyLoadAppMetafields:!!(t&&q_(l,t))});Mv({route:g?.route,isEmbedded:V,source:H,shop:j,checkout:qe,shopPay:ie,shopPayGraphql:He,observability:v,userEvents:ct,reconcileBuyerConsent:B=>Tu({consentManager:m,shop:j},B)});let Re;if(cr(D)){const{EmbedForBrowser:B}=await y??await L(()=>import("./embed-browser.790EZfnB.js").then(We=>We.d),__vite__mapDeps([29,3,30,2,4,5,6,31])),re=await B.loadClient(D.embed,v);Re=B.from(D,{...re,events:n,shop:j,observability:v,client:l,i18n:Ee,checkout:qe,source:H,graphql:lt,shopPay:ie,router:f,wallets:{activeSessionSignal:qe.wallets.activeSession},mobileCheckoutSdk:z,userAgent:l.userAgent,visitorConsent:op(m),environment:h})}return Re&&v.attachEmbedContext(Re),p.setEmbedClient(Re?.client),cu({shop:j,seri
66alizations:o,observability:v,isShopApp:ie.isShopServerOrigin}),T=F_({checkout:qe,i18n:Ee,shop:j,shopPay:ie,source:H,url:Ge,events:n,observability:v,router:f,mobileCheckoutSdk:z,embed:Re},{serializations:o,initialNegotiation:U?.session.negotiate.result,unregisterInitializingTool:Ht}),T&&(r=()=>T.teardown()),Pa({events:n,shop:j,client:l,terminalErrorHandler:p,graphql:lt,observability:v,userEvents:ct,router:f,url:Ge,i18n:Ee,source:H,persistence:he,shopPay:ie,checkout:qe,consentManager:m,environment:h,embed:Re,mobileCheckoutSdk:z,webMcp:T})}catch(n){return Ht(),r?.(),{status:"error",error:n,errorHandlingContext:i}}}function Pa(s){return R_(s),{status:"success",appContext:s}}const lb=Object.freeze(Object.defineProperty({__proto__:null,buildAppContextForBrowser:z_,finalizeAppContextForBrowser:Pa},Symbol.toStringTag,{value:"Module"}));export{db as a,lb as b,jg as i,ob 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.