PageSourceSearch

https://www.eco-worthy.com/cdn/shopifycloud/checkout-web/assets/c1/context-browser.DZZzP-lc.js

js eco-worthy.com collected 2026-09-25 20:21:23 UTC 297,409 bytes, 66 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["extensibility-browser-engine.DyY02SX8.js","hooks-useReplaceShopPayInHistory.DPpLejwu.js","addresses-is-address-empty.Bn2lNY_L.js","esnext-vendor.B9Da21W6.js","app.DbSrjjlA.js","assets/app.Sxsz5knT.css","assets/is-address-empty.DJksNKpk.css","utilities-extension-execution-errors.Bov3aYbn.js","performance-index.mu6MOGR9.js","extensions-rpc.BMPl-VrM.js","amazon-pay-useAmazonPayPaymentLine.Ju006AId.js","shared-buyer-consent.B_gDyRCR.js","proposal-delegated-payment-instrument.Gc2rhfd3.js","shared-shop-theme.DIHIQUEd.js","consent-manager-shared.DROIEFP2.js","shared-receipt-mapper-load-recovery.Ci5IIc7r.js","shared-receipt-eager-mappers.BEm77m4Q.js","shared-report-graphql-error.0sJ2-gTk.js","shop-pay-normalizeBuyerDetails.CCnGCeBZ.js","helpers-derivations.Dug6X2_v.js","redemption-promotions.DicFJEgz.js","cvv-cvvBridge.B-VIACTq.js","graphql-PaymentSessionMutation.CAXCwUvV.js","human-signals-index.DyM3MF1G.js","client.DRetCTka.js","dist-v4.EwEgHOG0.js","web-mcp-runtime.CGES2-3O.js","embed-browser.CEXD5vfZ.js","hooks-useShopPayExternalAppContext.DWwMuRnz.js","embed-deferred.B7xD-_a4.js"])))=>i.map(i=>d[i]);
2import{S as ve,s as Bi,l as eo,d as nt,_ as D,t as Ke,T as to,m as so,a as Fi,n as io,o as ro,q as no}from"./app.DbSrjjlA.js";import{o as v,y as u,j as se,a as Ze,G as Qs,n as Xe,ag as Us,r as es,aC as Ui,aD as me,aE as rn,aF as nn,aG as an,aH as on,aI as ao,aJ as oo,aK as lo,aL as dn,aM as co,aN as uo,aO as mt,L as $t,M as rt,aP as Zs,aQ as Js,az as ho,aR as po,ak as mo,aS as go,aT as fo,aU as yo,aV as vo,aW as _o,aX as bo,aY as So,aZ as Ao,a_ as Eo,a$ as Po,ab as Co,m as To,aa as ko,b0 as wo,b1 as Io,ar as xi,ap as Vi,an as Ro,b2 as Mo}from"./esnext-vendor.B9Da21W6.js";import{kv as xs,ga as J,kw as $e,e as ue,dB as _e,dS as Do,x as bt,ai as we,b4 as Qe,kx as Lo,ky as Oo,kz as No,kA as Bo,kB as ln,kC as Fo,jJ as Uo,aX as Ue,h0 as cn,ad as un,jD as Vs,kD as gt,aB as ke,g4 as ei,kE as ti,H as Je,b5 as hn,fp as si,f4 as Hs,iK as pn,iv as mn,hD as ii,kF as gn,kG as Gs,kH as xo,kI as Vo,E as Hi,ar as Ho,kJ as st,kK as Go,kL as qs,O as Et,cm as ri,fY as Ws,kM as qo,gG as Wo,ah as zo,kN as $o,by as Be,j9 as Yo,bp as Gi,gT as jo,kO as Ko,b6 as Xo,fs as Qo,aR as fn,kP as yn,kQ as Zo,kR as qi,gE as vn,kS as Jo,gH as ed,kT as td,kU as sd,kV as _n,kW as id,kX as rd,gC as Wi,kY as nd,bg as fe,kZ as ad,k_ as zi,k$ as od,l0 as dd,l1 as ld,l2 as cd,l3 as Yt,cY as ud,gZ as hd,f as pd,l4 as md,k as ts,l5 as gd,g1 as fd,n as yd,m as it,bH as Oe,eD as ni,l6 as vd,l7 as bn,l8 as $i,l9 as _d,aF as bd,aC as ce,la as Sd,eQ as Ad,lb as Ed,bU as Yi,iZ as ji,lc as Pd,ld as Cd,le as Td,eW as kd,iq as wd,lf as Id,lg as Rd,iw as Ki,lh as Md,iG as Dd,ip as Ld,eC as Od,iC as Nd,iD as Bd,iE as Fd,eY as Ud,iF as xd,iH as Vd,iI as Hd,w as Gd,ib as qd,iJ as Wd,iL as zd,iM as $d,iz as Yd,iO as jd,iP as Kd,iQ as Xd,li as Qd,iR as Zd,lj as Jd,lk as el,eZ as tl,eX as sl,iB as il,iA as rl,iS as Xi,iT as nl,iN as al,ix as ol,ll as dl,lm as ll,J as Ss,ln as cl,lo as ul,fH as hl,es as pl,lp as ml,lq as gl,lr as fl,ls as yl,lt as vl,fJ as Qi,dN as As,lu as _l,lv as bl,de as Sl,a6 as St,kf as Al,kg as El,kj as Pl,ki as Cl,kh as Tl,V as jt,jF as kl,dQ as Zi,jE as Ji,b3 as wl,g8 as zs,lw as Il,lx as Rl,hM as Ml,ly as Dl,hG as Ll,hF as Ol,fC as er,fD as tr,lz as Nl,lA as Bl,lB as Fl,fB as Ul,lC as xl,au as Vl,lD as Hl,lE as Gl,jI as sr,kd as ql,lF as Wl,lG as zl,lH as $l,lI as Yl,iX as jl,lJ as Kl,bf as Xl,cl as Ql,bi as Zl,aY as Ot,lK as Sn,lL as Jl,ff as An,lM as ec,lN as En,fg as Pn,lO as Cn,lP as ir,lQ as tc,fh as sc,lR as ic,f0 as Tn,lS as ai,el as rc,lT as nc,aU as ac,gB as oc,dx as oi,lU as dc,lV as ss,av as lc,lW as $s,ax as cc,aw as uc,lX as hc,lY as Kt,lZ as pc,j8 as mc,d$ as rr,fb as gc,g as fc,l_ as yc,l$ as vc,m0 as _c,m1 as bc,m2 as Sc,f7 as Ac,jU as Ec,jV as Pc,m3 as Cc,m4 as kn,aS as Tc,W as kc,gc as wc,ge as Ic,bY as Rc,m5 as Mc,f1 as Dc,et as Es,m6 as Lc,du as nr,fu as Oc,g5 as Nc,g6 as Bc,g7 as Fc,m7 as Uc,m8 as wn,m9 as In,ma as xc,mb as Vc,mc as Hc,ev as ar,md as Gc,me as or,mf as dr,gd as lr,az as qc,mg as cr,cJ as Wc,mh as Rn,eP as zc,cA as $c,mi as Yc,mj as jc,mk as Kc,ml as Xc,mm as Qc,mn as Zc,mo as Jc,mp as eu,mq as tu,mr as su,fk as ur,ms as iu,mt as ru,mu as nu,mv as au,mw as ou}from"./addresses-is-address-empty.Bn2lNY_L.js";import{d as du,i as lu,t as is,w as Mn,b as Ps,F as cu,r as uu}from"./shared-buyer-consent.B_gDyRCR.js";import{S as ft,O as Nt,C as yt,e as Ne,f as hu,s as Dn,c as pu,b as mu,a as gu}from"./proposal-delegated-payment-instrument.Gc2rhfd3.js";import{g as Ht}from"./shared-shop-theme.DIHIQUEd.js";import{g as fu,q as yu,a as vu,b as _u,s as bu,t as Su,v as Au}from"./consent-manager-shared.DROIEFP2.js";import{a as Eu,s as Pu,m as Cu,l as Tu,k as ku,f as wu,e as Iu,c as Ru,d as Mu,j as Du,i as Lu,h as Ou,g as Nu,b as Bu,p as Fu,n as Uu,r as xu,q as Vu}from"./shared-receipt-mapper-load-recovery.Ci5IIc7r.js";import{b as Hu,j as Gu,a as hr,o as qu,k as Wu,i as zu,s as $u,l as Yu,f as ju,g as Ku,t as Xu,d as Qu,r as Zu,h as Ju,e as eh}from"./shared-receipt-eager-mappers.BEm77m4Q.js";import{r as at}from"./shared-report-graphql-error.0sJ2-gTk.js";import{n as th,s as sh}from"./shop-pay-normalizeBuyerDetails.CCnGCeBZ.js";import{s as ih,b as rh}from"./helpers-derivations.Dug6X2_v.js";import{S as nh}from"./cvv-cvvBridge.B-VIACTq.js";import{g as ah,p as oh}from"./graphql-PaymentSessionMutation.CAXCwUvV.js";const dh=(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.":""))))})},lh={id:"88b4bd2244b44e19631a21dac37cdd0a986c369d55d8a88292bd79c62e3a3485",type:"query",name:"CheckoutContext",source:""},ch={id:"d86c24ba847c0583a6cdd93ad932edcc9f527c9360b5a596103ab32aa1aef57e",type:"query",name:"FinancingPlans",source:""},uh={id:"3cd8163c889b25bc744486a9660d0301ebc80659eabdf66690c58dd37bbdb115",type:"query",name:"RequestInfo",source:""},hh={id:"6c8a3a5bcd1d2cbb245c334c21cef3b09ad7ce514c0eed061ceb713227f49b43",type:"query",name:"Theme",source:""},ph={id:"5638616fb05cb50fa18d4cba4335a74898a1bfebfdc79a784e07dacd23898e17",type:"query",name:"ShippingCountries",source:""};class mh extends ve{constructor(){super(...arguments),this.name="BrandingMissingShopError"}}function gh(s){return{isConcatenatedEnabled:()=>!1,isDedicatedEnabled:()=>s.hasFlag(du),getDedicatedFormat:e=>e.extendedFormattingV2ShopPay?.edit}}class Ie{constructor({observability:e,errors:t}){this.selectedAddress=v(()=>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 $e}_updateAddress(e){throw new $e}_updateEphemeralAddress(e){throw new $e}_createAddress(e){throw new $e}_deleteAddress(e){throw new $e}async _setDefaultAddress(e){throw new $e}async _applyAddressChange(e){throw new $e}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 Cs extends Ie{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 Ln(s,e,t){if(s===e&&t)return Do(t)?t.location.name:t.company.name}function fh({buyerIdentity:s,billingAddressFact:e,isValidBillingAddress:t,isLoadingBilling:i,isValidShippingAddress:r,isLoadingShipping:n}){return v(()=>{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&&bt(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 yh extends Ie{constructor({observability:e,buyerIdentity:t,billingAddressFact:i,address:r,billingCountries:n,billingAddressSettings:a,deliveryNext:o,additionalFieldsEnabled:d,i18n:l,isLoadingBilling:c,isValidShippingAddress:h,isLoadingShipping:y}){super({observability:e,errors:{banner:u(void 0),fields:_e()}}),this.selectedAddressId=u(ft),this.#t=u([]),this.getAddressDisplayName=f=>Ln(f,ft,this.buyerIdentity.value?.purchasingCompany),this.buyerIdentity=t;const{countryDetails:b,extendedAddressMode:m}=r,A=v(()=>{const f=t.value?.purchasingCompany,p=f?.location.billingAddress,_=p?we(p)?.countryCode:void 0;return lu({purchasingCompany:f,billingCountries:n,addressSettings:a,countryDetails:_?b.get(_):void 0,editFormat:m.getFormat(_,null),deliveryNextValue:o.value,additionalFieldsEnabled:d,i18n:l})});this.suggestedAddressResult=fh({buyerIdentity:t,billingAddressFact:i,isValidBillingAddress:A,isLoadingBilling:c,isValidShippingAddress:h,isLoadingShipping:y}),this.#e=v(()=>{const{isValid:f,isLoading:p}=this.suggestedAddressResult.value;return!f&&!p}),this.addresses=this.#t,this.immutableAddresses=v(()=>{const f=this.suggestedAddressResult.value;return!f.isValid||!f.address?[]:[{id:ft,address:f.address}]})}#e;#t;get suggestedAddress(){return this.suggestedAddressResult}get isMissingValidSuggestedAddress(){return this.#e}}const vh=2;class _h extends yh{#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:y,additionalFieldsEnabled:b,isThrottled:m,i18n:A}){const{countryDetails:f}=l,p=v(()=>{const M=i.value?.purchasingCompany;return we(M?.location.billingAddress)?.countryCode}),_=v(()=>{const M=p.value;return M?m.value&&f.get(M)===void 0?!0:f.isLoading(M):!1});super({observability:o,buyerIdentity:i,billingAddressFact:r,address:l,billingCountries:c,billingAddressSettings:h,deliveryNext:y,additionalFieldsEnabled:b,i18n:A,isLoadingBilling:_,isValidShippingAddress:n,isLoadingShipping:a});const g=se(()=>{const M=p.value;M&&!m.value&&f.fetch(M)}),E=u(void 0);t.value==="custom"&&e.value&&!E.value&&(E.value=e.value);const R=v(()=>{const M=E.value;return M?[{id:Nt,address:M}]:[]});this.#e=R,this.addresses=this.#e,this.#r=v(()=>this.addresses.value.length+this.immutableAddresses.value.length<vh),this.selectedAddressId=v(()=>t.value==="custom"?Nt:ft),this.#t=e,this.#s=E,this.#i=t;let P=!1;const C=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,I=d!=null&&Qe(d)&&M.type==="billing-fact";(M.type===t.value||O||I)&&((!e.value||!ue(M.address,e.value))&&(e.value=M.address),P=!0)}),w=se(()=>{const M=this.suggestedAddressResult.value;if(!i.value?.purchasingCompany)return;const O=t.value!=="custom"&&!M.type&&!M.isLoading,I=t.value==="billing"&&M.type==="shipping";O?t.value="custom":I&&(t.value="shipping")});this.#a=[g,C,w]}dispose(){for(const e of this.#a)e();super.dispose()}_selectAddress(e){if(this.#t.value=e.address,e.id===ft){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:Nt,address:e};return this.#s.value=e,t&&(this.#i.value="custom",this.#t.value=e),i}_updateAddress({id:e,address:t}){if(e!==Nt)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 bh extends Ie{constructor({observability:e,buyerIdentity:t,proposalAddress:i}){super({observability:e,errors:{banner:u(void 0),fields:_e()}}),this.getAddressDisplayName=r=>Ln(r,yt,this.buyerIdentity.value?.purchasingCompany),this.buyerIdentity=t,this.companyLocationAddress=v(()=>t.value?.purchasingCompany?.location.shippingAddress??void 0),this.hasEditableShippingAddress=v(()=>{const r=t.value?.customerProfile;return!!(r?.__typename==="BusinessCustomerProfile"&&r?.checkoutExperienceConfiguration?.editableShippingAddress)}),this.immutableAddresses=v(()=>{const r=this.companyLocationAddress.value;return r?[{id:yt,address:r}]:[]}),this.#e=v(()=>
2{const r=this.companyLocationAddress.value,n=i.value;return!r||!n||ue(r,n)?[]:[{id:Ne,address:n}]}),this.addresses=this.#e,this.#t=v(()=>this.hasEditableShippingAddress.value&&this.addresses.value.length+this.immutableAddresses.value.length<Lo),this.selectedAddressId=v(()=>this.addresses.value.length>0?Ne:yt)}#e;#t;get canCreateAddress(){return this.#t}get canUpdateAddress(){return this.hasEditableShippingAddress}}class Sh extends bh{#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:y}){super({observability:n,buyerIdentity:t,proposalAddress:e});const{countryDetails:b,extendedAddressMode:m}=a,A=u(void 0);this.#e=v(()=>{const P=A.value;return P?[{id:Ne,address:P}]:[]}),this.addresses=this.#e;const f=v(()=>{const P=t.value?.purchasingCompany;return we(P?.location.shippingAddress)?.countryCode}),p=se(()=>{const P=f.value;P&&!h.value&&b.fetch(P)});this.isValidShippingAddress=v(()=>{const P=t.value?.purchasingCompany,C=f.value;return Oo({purchasingCompany:P,shippingCountries:o,addressSettings:d,countryDetails:C?b.get(C):void 0,editFormat:m.getFormat(C,null),deliveryNextValue:l.value,additionalFieldsEnabled:c,i18n:y})}),this.isLoadingShippingAddress=v(()=>{const P=f.value;return P?h.value&&b.get(P)===void 0?!0:b.isLoading(P):!1}),this.#i=v(()=>{if(r.value===!1)return"DELIVERY_ADDRESS_NOT_EDITABLE";if(!this.hasEditableShippingAddress.value||i.value)return"MUST_SELECT_PROVIDED_ADDRESS"});const _=t.value?.purchasingCompany?.location.shippingAddress;_&&e.value&&!ue(_,e.value)&&(A.value=e.value),this.selectedAddressId=u(A.value?Ne:yt),this.#t=e,this.#s=A;let g=!1,E=this.companyLocationAddress.peek();const R=se(()=>{const P=this.companyLocationAddress.value;if(!g){g=!0;return}P&&(E&&ue(P,E)||(E=P,this.selectedAddressId.peek()===yt&&(e.value=P)))});this.#r=[p,R]}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:Ne,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!==Ne)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:[Ne]});if(t)return await this._selectAddress(t),this.#s.value=void 0,{type:"success",address:t};const i={id:Ne,address:e};return this.#s.value=e,await this._selectAddress(i),{type:"success",address:i}}}function On(s){let e=s.value.map(t=>t.id);return v(()=>{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 Ah={id:"07f9d37cebb26f74594ea5b6dc354ea01d222d8897f503e823e91a9aa33fef98",type:"mutation",name:"CreateCustomerAddress",source:""},Eh={id:"4a72f72ab7d4a46e063c4caeafc6826b16e2521dfcbcf9a5d73bbd8c37f8d791",type:"mutation",name:"DeleteCustomerAddress",source:""},Ph={id:"61d3f70f7da3acacb12e8eab2c66260c3a97d79f6a9593fd21f23c464de341c7",type:"mutation",name:"ModifyCustomerAddress",source:""};function Nn(s,e){return{createAddressMutation:Th(s,e),updateAddressMutation:kh(s,e),deleteAddressMutation:wh(s)}}const Ch=new Set(["BUYER_IDENTITY_CUSTOMER_ACCOUNT_REQUIRED","BUYER_IDENTITY_CONTACT_INFO_DOES_NOT_MATCH_CUSTOMER_PROFILE","DESTINATION_ADDRESS_REQUIRED"]);function Bn(s,e){return s||e.errors.some(t=>Ch.has(t.code))}function Th(s,e){return async t=>{const{data:i,error:r}=await s.mutate(Ah,{variables:{address:Fn(t.address,e),setDefault:t.setDefault}});if(!i?.createCustomerAddress||Bn(r,i.createCustomerAddress))return{status:"failed_unknown"};const{result:n,errors:a}=i.createCustomerAddress;return!n||a.length>0?{status:"failed",errors:li(a)}:{status:"success",address:di(n)}}}function kh(s,e){return async t=>{const{data:i,error:r}=await s.mutate(Ph,{variables:{address:Fn(t.address,e),id:t.id,setDefault:t.setDefault}});if(!i?.modifyCustomerAddress||Bn(r,i.modifyCustomerAddress))return{status:"failed_unknown"};const{result:n,errors:a}=i.modifyCustomerAddress;return!n||a.length>0?{status:"failed",errors:li(a)}:{status:"success",address:di(n)}}}function wh(s){return async e=>{const{data:t,error:i}=await s.mutate(Eh,{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:li(n)}:{status:"success",address:di(r)}}}function Fn(s,e){const{extendedFields:t,...i}=No({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 di(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 li(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 Un({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 xn({addressType:s,violations:e,countryCode:t,addressErrorsOverride:i,errors:r,address:n,addressSettings:a}){const o=t?n.countryDetails.get(t):void 0,d=Bo({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 Ih extends Ie{#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]=ln(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 Nn(this.#s,this.#i.extendedAddressMode)}handleMutation(e){return Un({...e,addresses:this.#e,errors:this.errors,i18n:this.#t})}setFieldErrors(e,t,i,r){xn({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 Rh extends Ih{constructor({billingAddress:e,billingAddressOption:t,buyerIdentity:i,observability:r,addressSettings:n,address:a,i18n:o,graphql:d}){const l=On(v(()=>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=v(()=>this.#e.value?this.#e.value:this.addresses.value[0]?.id),this.#r=v(()=>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 Mh extends Ie{#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=v(()=>!r.value&&t.value?.customerProfile?.__typename==="CustomerProfile"?t.value.customerProfile.shippingAddresses:[]),this.#e=v(()=>i.value??[]),this.#t=v(()=>!r.value),this.#s=d.translate("address_management.saved_addresses"),this.selectedAddressId=v(()=>{const l=[...this.addresses.value,...this.immutableAddresses.value],c=n.value,h=c.countryCode?o.countryDetails.get(c.countryCode):void 0;return Fo(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 Dh extends Mh{#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[y,b]=ln(On(this.negotiatedShippingAddresses));this.#e=y,this.#s=b,this.#t=v(()=>{const m=t.value??[],A=this.#c.value;return A?[...m,{id:J,address:A}]:m}),this.#l=v(()=>{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.#h({mutate:()=>this.#u.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.#h({mutate:()=>this.#u.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.#h({mutate:()=>this.#u.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#u(){return Nn(this.#a,this.#o.extendedAddressMode)}#h(e){return Un({...e,addresses:this.#e,errors:this.errors,i18n:this.#n})}#m(e,t,i){xn({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 Ce="guest_address";class pr extends Ie{#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=Ce),super({observability:n,errors:{banner:u(void 0),fields:_e()}}),this.selectedAddressId=u(c),this.#n=e,this.#e=u(l),this.#t=v(()=>!i.value&&!this.#e.value),this.#r=i,this.#i=v(()=>{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=v(()=>t.value??[]),this.addresses=v(()=>{const h=this.#e.value;return h?[{id:Ce,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:Ce,address:e};return t&&(this.selectedAddressId.value=Ce,this.#n.value=e),i}_updateAddress({address:e}){return this.#e.value=e,this.selectedAddressId.value=Ce,this.#n.value=e,Promise.resolve({id:Ce,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:[Ce]});if(t)return this.selectedAddressId.value=t.id,this.#n.value=t.address,{type:"success",address:t};const i={id:Ce,address:e};return this.#e.value=e,this.selectedAddressId.value=Ce,this.#n.value=e,{type:"success",address:i}}}function mr(s){return`${hu}_${Uo(s)}`}class Lh extends Ie{#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=mr(o),l=[{id:d,address:o}],c=d,h=new Set([d]);t?.forEach(y=>{if(bt(y,o))return;const b=mr(y);h.has(b)||(h.add(b),l.push({id:b,address:y}))}),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=v(()=>{if(r.value===!1)return"DELIVERY_ADDRESS_NOT_EDITABLE";if(i.value)return"MUST_SELECT_PROVIDED_ADDRESS"}),this.#s=v(()=>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 Oh extends Lh{#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=v(()=>{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 Nh={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 Vn({observability:s,shopPayGraphql:e,source:t,extendedAddressMode:i}){const r=Ue({source:t});return async(n,a,o=r,d=!1)=>{const{data:l,error:c}=await e.mutate(Nh,{variables:{address:cn(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?un(h.userAddress):void 0,userPhone:h.userPhone}}}const Bh={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 Hn({shopPayGraphql:s,source:e}){const t=Ue({source:e});return async(i,r,n)=>{const{data:a,error:o}=await s.mutate(Bh,{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 Fh={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 Gn({observability:s,shopPayGraphql:e,source:t,extendedAddressMode:i}){const r=Ue({source:t});return async(n,a,o,d,l=!1)=>{const{data:c,error:h}=await e.mutate(Fh,{variables:{id:a,uuid:o,address:cn(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:y}=c;return y.userErrors.length>0?(s.leaveErrorBreadcrumb("Shop Pay update address mutation had a user error"),{status:"failed",errors:y.userErrors}):{status:"success",address:y.userAddress?un(y.userAddress):void 0,userPhone:y.userPhone}}}class Uh extends Ie{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=v(()=>e.user.addresses.value.map(r=>is({address:r,addressSettings:i,shopUserPhone:e.user.phoneNumber.value}))),this.#e=v(()=>this.addresses.value.length<Vs),this.selectedAddressId=v(()=>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 xh extends Uh{#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.#u(e.id)??gt(e.address,e.id);return this.#m(t),this.#c.value=this.withCoordinates(e.address),this.#E(),!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:{...ke(this.#r,{configuration:this.#o},this.#n),action:"billing_address_add_new"}}),n.status!=="success"){this.#_({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.#h(a);return i&&(this.#m(a),this.#c.value=this.withCoordinates(d.address),this.#p(d.address,a),this.#E()),d}async _updateAddress({id:e,address:t,setDefault:i,addressErrorsOverride:r}){if(this.#r.type==="simulated")return;const n=this.#u(e);if(!n)return;const a=await this.#v(t,e,n.uuid,i);if(a.status!=="success"){this.#_({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.#h(o);return this.selectedAddressId.value===e&&(this.#m(o),this.#c.value=this.withCoordinates(l.address)),this.#g(e,l.address,o),this.#E(),l}async _deleteAddress(e){if(this.#r.type==="simulated")return!1;const t=this.#u(e),i=this.selectedAddressId.value;if(!t)return!1;const r=await this.#b(e,t.uuid);if(this.#t.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...ke(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=ei(n)??void 0,o=a?this.#h(a).address:this.#P();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:{...ke(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.#E(),!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:{...ke(this.#r,{configuration:this.#o},this.#n),action:"set_default_address"}}),!!await this._updateAddress({id:e,address:t,setDefault:!0}))}#u(e){return this.#s.user.addresses.value.find(t=>t.id===e)}#h(e){return is({address:e,addressSettings:this.#l.nonBillingAddressSettings.value,shopUserPhone:this.#s.user.phoneNumber.value})}#m(e){this.#s.session.unstable_updateSelectedBillingAddress(e)}#p(e,t){ti(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 Vn({observability:this.observability,shopPayGraphql:this.#i,source:this.#r,extendedAddressMode:this.#d.extendedAddressMode})(e,this.#S(),Ue({source:this.#r}),t)}#v(e,t,i,r){return Gn({observability:this.observability,shopPayGraphql:this.#i,source:this.#r,extendedAddressMode:this.#d.extendedAddressMode})(e,t,i,this.#S(),r)}#b(e,t){return Hn({shopPayGraphql:this.#i,source:this.#r})(e,t,this.#S())}#_({shopPayErrors:e,addressErrorsOverride:t,submittedAddress:i}){Dn({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"})}#S(){return{checkoutIdentifier:this.#r.checkoutSessionIdentifier??"",checkoutVersion:Ue({source:this.#r}),shopId:Je(this.#n.id),shopifyDomain:this.#n.myshopifyDomain}}#P(){return hn({phone:this.#s.user.phoneNumber.value,countryCode:this.#l.nonBillingAddressSettings.value.defaultShippingDetails.country?.code})}#E(){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=si(e)?e.allowedShippingCountriesOverride.value:null;if(!t||t.length===0)return!0;const i=s.address.countryCode;return i?t.includes(i):!0}function Vh({availableDeliveryAddresses:s,mustSelectProvidedAddress:e,initialNegotiationData:t,addresses:i,shopPay:r,addressSettings:n}){if(e.value)return s.value||[];const a=[],o=c=>{c&&(gr(i.value,c.address)||gr(a,c.address)||a.push({...c,address:Mn({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=Hh(t,r.config.redirectSource);return l&&o(d?{...l,disabled:!ot(l,r)}:l),a}function gr(s,e){return s.some(t=>ue(t.address,e,["phone"]))}function Hh(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=pn({delivery:r.delivery,buyerDelivery:n.delivery,remoteDelivery:mn(r.remote).remoteDelivery});if(a&&!ii(a,gn))return{id:Gs,address:a}}class Gh extends Ie{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=qh({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 qh({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=v(()=>a.value?[]:e.user.addresses.value.map(C=>is({address:C,isDisabled:w=>!ot(w,e),addressSettings:i,shopUserPhone:e.user.phoneNumber.value}))),c=v(()=>{if(a.value)return[];const C=s.negotiated.fields.buyerIdentity.value?.customerProfile;return C?.__typename!=="CustomerProfile"||!C.shippingAddresses.length?[]:C.shippingAddresses.map(w=>({...w,disabled:!ot(w,e)}))}),h=v(()=>Vh({availableDeliveryAddresses:d,mustSelectProvidedAddress:a,initialNegotiationData:t,addresses:l,shopPay:e,addressSettings:i})),y=v(()=>{if(l.value.length>=Vs)return[];const C=[...l.value,...h.value];return c.value.filter(w=>{const M=w.address.countryCode,k=M?r.countryDetails.get(M):void 0,O=xo(i,k,k?r.extendedAddressMode.getFormatFromCountry(k):void 0);return!C.some(I=>{const L=!w.address.firstName?.trim()||!I.address.firstName?.trim();return ue(w.address,I.address,["phone",...L?["firstName"]:[],...O?[]:["zoneCode"]])})})}),b=v(()=>y.value.length?[{title:n.translate("address_management.saved_with_store"),addressIds:new Set(y.value.map(({id:C})=>C))}]:[]),m=v(()=>[...h.value,...y.value]),A=v(()=>!a.value),f=v(()=>l.value.length<Vs&&A.value),p=A,_=A,g=A,E=v(()=>{if(o.value===!1)return"DELIVERY_ADDRESS_NOT_EDITABLE";if(a.value)return"MUST_SELECT_PROVIDED_ADDRESS"}),R=v(()=>e.session.selectedShippingAddress.value?.id),P=n.translate("address_management.saved_addresses");return{addresses:l,immutableAddresses:m,immutableAddressSections:b,selectedAddressId:R,canCreateAddress:f,canUpdateAddress:p,canDeleteAddress:_,canSetDefaultAddress:g,canApplyExternalAddress:E,addressesTitle:P}}class Wh extends Gh{#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:Mn({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=v(()=>{const y=this.signals.immutableAddresses.value,b=this.#a.value;return b?[...y.filter(({id:m})=>m!==Gs),this.#l(b)]:y}),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.#S(e.id)??gt(e.address,e.id);return this.#y(t),this.#d.value=this.withCoordinates(e.address),this.#A(),!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.#P({address:e,preferred:t});if(this.#t.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...ke(this.#s,{configuration:this.#r},this.#i),action:"shipping_address_add_new"}}),n.status!=="success"){this.#C({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.#A()),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.#S(e);if(!n)return this.#u({id:e,address:t,setDefault:i,addressErrorsOverride:r});const a=await this.#E(t,e,n.uuid,i);if(a.status!=="success"){this.#C({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.#b(e,l.address,o),this.#A(),l}async#u({id:e,address:t,setDefault:i,addressErrorsOverride:r}){if(e===Gs&&!i)return this._updateEphemeralAddress({address:t});if(!this.#h(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}#h(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.#S(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:{...ke(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=ei(n)??void 0,o=a?this.#f(a).address:this.#w();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:{...ke(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.#_(e,o,a),this.#A(),!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:{...ke(this.#s,{configuration:this.#r},this.#i),action:"set_default_address"}}),!!await this._updateAddress({id:e,address:t,setDefault:!0}))}#f(e){return is({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))}#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,t,i){this.shopPay.session.selectedBillingAddress.value?.id===e&&(this.shopPay.session.unstable_updateSelectedBillingAddress(i),this.proposal.proposed.billingAddress.value=this.withCoordinates(t))}#S(e){return this.shopPay.user.addresses.value.find(t=>t.id===e)}#P({address:e,preferred:t}){return Vn({observability:this.observability,shopPayGraphql:this.#e,source:this.#s,extendedAddressMode:this.address.extendedAddressMode})(e,this.#T(),Ue({source:this.#s}),t)}#E(e,t,i,r){return Gn({observability:this.observability,shopPayGraphql:this.#e,source:this.#s,extendedAddressMode:this.address.extendedAddressMode})(e,t,i,this.#T(),r)}#k(e,t){return Hn({shopPayGraphql:this.#e,source:this.#s})(e,t,this.#T())}#C({shopPayErrors:e,addressErrorsOverride:t,submittedAddress:i}){Dn({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"})}#T(){return{checkoutIdentifier:this.#s.checkoutSessionIdentifier??"",checkoutVersion:Ue({source:this.#s}),shopId:Je(this.#i.id),shopifyDomain:this.#i.myshopifyDomain}}#w(){return hn({phone:this.shopPay.user.phoneNumber.value,countryCode:this.#o.nonBillingAddressSettings.value.defaultShippingDetails.country?.code})}#A(){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 zh{#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:y},source:b,router:m,initialNegotiationData:A}){const f=v(()=>m.currentUrl.value.pathname.endsWith("/throttle")),p=new pr({proposalAddress:r.proposed.shippingAddress,mustSelectProvidedAddress:r.negotiated.fields.mustSelectProvidedAddress,canUpdateDeliveryAddress:r.negotiated.fields.canUpdateDeliveryAddress,immutableAddresses:r.negotiated.fields.availableDeliveryAddresses,observability:t,wallets:n}),_=new Cs(t);this.#e=u(p),this.#t=u(_),this.shipping=this.#e,this.billing=this.#t,this.#s=se(()=>{const g=e.current.value;this.#e.peek().dispose(),this.#t.peek().dispose(),Qs(()=>{if(g==="customerAccount")this.#e.value=new Dh({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 Rh({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(g==="shopPay")this.#e.value=new Wh({proposal:r,shopPay:c,observability:t,userEvents:i,initialNegotiationData:A,shopPayGraphql:y,source:b,shop:l,i18n:a,checkoutConfiguration:d,address:o}),this.#t.value=new xh({proposal:r,shopPay:c,observability:t,userEvents:i,shopPayGraphql:y,source:b,shop:l,i18n:a,checkoutConfiguration:d,address:o});else if(g==="sdkCartHints")this.#e.value=new Oh({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 Cs(t);else if(g==="businessCustomer"){const E=l.additionalAddressFieldsEnabled,R=new Sh({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:E,isThrottled:f,i18n:a});this.#e.value=R,this.#t.value=new _h({proposalAddress:r.proposed.billingAddress,billingAddressOption:r.proposed.billingAddressOption,buyerIdentity:r.negotiated.fields.buyerIdentity,billingAddressFact:r.facts.billingAddress,isValidShippingAddress:R.isValidShippingAddress,isLoadingShipping:R.isLoadingShippingAddress,observability:t,sourceType:b.type,address:o,billingCountries:l.billingCountries,billingAddressSettings:d.addressSettings.billingAddressSettings.value,deliveryNext:r.negotiated.fields.deliveryNext,additionalFieldsEnabled:E,isThrottled:f,i18n:a})}else this.#e.value=new pr({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 Cs(t)})})}dispose(){this.#s()}}const $h={id:"e80d5f5c1e60593716690e3575add0ef2588b89c7ea211e423658d746ee06ffa",type:"query",name:"CountryDetails",source:""};class Yh{#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.autofill=new Vo,this.countryDetails=new Kh({graphql:e,i18n:t,initialCountryDetails:i}
2),this.extendedAddressMode=new Yh({countryDetails:this.countryDetails,policy:r})}}class Kh{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($h,{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={...Hi(void 0,this.#t),code:e,isFallback:!0};return this.#i.set(e,t),t}#d(e){if(!e)return;const t=Hi(e,this.#t);return this.#s.value=new Map([...this.#s.value,[e.code,t]]),t}}class Xh{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=v(()=>this.selectedSavedCreditCardBrand.value?[]:this.#e.value),this.activeBrand=v(()=>{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 Qh{#e=new Map;constructor(){this.forMethod=this.forMethod.bind(this)}forMethod(e){let t=this.#e.get(e);return t||(t=new Xh,this.#e.set(e,t)),t}}class Zh{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 Jh(s){return{analytics:s.analyticsProcessingAllowed.value,marketing:s.marketingAllowed.value,preferences:s.preferencesProcessingAllowed.value,saleOfData:s.saleOfDataAllowed.value}}function ep(s){switch(s){case"STANDARD":case"STANDARD_RECOVERY":return"MERCHANT";case"PARTNER":return"PARTNER";default:return null}}function tp({config:s,isOnePageCheckout:e}){return e&&(!!(s?.schema&&s.version)||s?.variant==="STANDARD_RECOVERY")}function sp(s){return s?.variant==="STANDARD"||s?.variant==="STANDARD_RECOVERY"}class ip{#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 rp({variant:r.variant??void 0})}get enabled(){return tp({config:this.config,isOnePageCheckout:this.#e})}}class rp{constructor({variant:e}){this.isStandard=()=>sp({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 np({serializations:s,observability:e,checkoutSdkConfig:t,checkoutSheetProtocolConfig:i}){const r=s.get("checkoutLayout")==="one-page";if(!ap(r,i))return;const n=Ho.has(i?.schema)?"CheckoutSheetProtocol":"MobileCheckoutSdk",a=n==="CheckoutSheetProtocol"?i?.type:op(t),o={protocolType:n,configType:a,schemaVersion:i?.schema||t.schema,indexValue:`${n}-${a}`};e.addErrorMetadata("checkoutProtocol",o)}function ap(s,e){return s&&!!e}function op(s){return ep(s.variant)}const qn=["countryCode","address1","city","zoneCode","postalCode"],dp=["countryCode","firstName","lastName","company","address1","address2","city","zoneCode","postalCode","phone","streetName","streetNumber","neighborhood","line2","district","subdistrict"],lp=["countryCode","firstName","lastName","company","address1","address2","city","zoneCode","postalCode","streetName","streetNumber","neighborhood","line2","district","subdistrict"];function cp(s){return{...s,isRequired:e=>qn.includes(e),isVisible:e=>dp.includes(e)}}function up(s){return{...s,isRequired:e=>qn.includes(e),isVisible:e=>lp.includes(e)}}const Wn=["firstName","lastName","address1","city","countryCode"],zn=["phone"];function hp({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()||Bi(t,e)?!0:Wn.includes(t),isVisible:(t,i)=>i?.useMerchantSettings?s.isVisible(t,i):Bi(t,e)?!1:zn.includes(t)||s.isVisible(t)}}function pp(s){return{...s,isRequired:(e,t)=>t?.useMerchantSettings?s.isRequired(e,t):Wn.includes(e),isVisible:e=>zn.includes(e)||s.isVisible(e)}}function mp({baseSettings:s,identity:e,shopPay:t}){return e.current.value==="businessCustomer"?cp(s):e.current.value==="shopPay"?hp({baseSettings:s,shopPay:t}):s}function gp({baseSettings:s,identity:e}){return e.current.value==="businessCustomer"?up(s):e.current.value==="shopPay"?pp(s):s}class fp{#e;#t;constructor({shop:e,requestInfoData:t,identity:i,shopPay:r}){if(t==null)throw new st("Request info data is missing",{groupingHash:"SettingsCreateError::RequestInfoDataMissing"});if(t.shop==null)throw new st("Request info data shop details are missing",{groupingHash:"SettingsCreateError::RequestInfoDataShopDetailsMissing"});const n=Go({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=mp({baseSettings:n,identity:i,shopPay:r}),d=gp({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 yp("Shop data is missing",{groupingHash:"AddressSettingsUpdateError::S
2hopConfigMissing"});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 yp extends ve{constructor(){super(...arguments),this.name="AddressSettingsCreateError"}}function vp(s){const e=s?.find(({clientHandle:t})=>t===eo)?.variant;return Object.values(qs).find(t=>t===e)??qs.Control}function _p(s){return vp(s)===qs.Treatment}const bp={typographyScale:{base:14},link:{typographyDecoration:"none"},cornerRadius:{small:4,base:6,large:12},optionList:{border:"full"}},Sp={header:{banner:void 0}},Ap={typographyScale:{base:14}},ye=new Et(0,0,100),Ep=ye,Le=new Et(265.9,2.4,10.84),ne=new Et(247.3,99.1,60.1,1),Bt=new Et(265.9,1.26,28.9),Pp=new Et(12.177050630061808,91.27499736580106,55.14831050892033),Ts={theme:{colors:{global:{},schemes:{scheme1:{base:{background:Ep}}}}},shell:{}},ks={theme:{colors:{global:{info:ye,brand:ne,accent:ne,critical:Pp},schemes:{scheme1:{base:{accent:ne,background:Le,border:Bt,custom:Le,text:ye},control:{accent:ne,background:Le,border:Bt,custom:Le,text:ye,selected:{background:Le,border:ne,accent:ne}},primaryButton:{background:ne,text:ye}},scheme2:{base:{accent:ne,background:Le,border:Bt,custom:ne,icon:ye,text:ye},control:{accent:ne,background:Le,border:Bt,custom:ne,icon:ye,text:ye,selected:{background:Le,border:ne,accent:ne}},primaryButton:{background:ne,text:ye}}}}},shell:{}},fr={FIXED:"inline",INLINE:"inline",INLINE_SECONDARY:"inlineSecondary",START:"start"},Cp={INLINE:"inline",END:"end"},ws={START:"start",CENTER:"center",END:"end"},Tp={ICON:"icon",IMAGE:"image",TEXT:"text"},Xt={FULL:"full",NONE:"none"},ht={...Xt,BLOCK_END:"blockEnd"},vt={BASE:"base",DASHED:"dashed",DOTTED:"dotted"},_t={NONE:"none",BASE:"base",LARGE:"large100",LARGE_100:"large100",LARGE_200:"large200"},kp={NONE:"none",SMALL_200:"extraSmall",SMALL_100:"small",BASE:"base",LARGE_100:"large",LARGE_200:"extraLarge"},Gt={TRANSPARENT:"transparent",BASE:"base",SUBDUED:"subdued"},Te={BASE:"base",NONE:"none",SMALL:"small",LARGE:"large",ROUNDED:"fullyRounded"},$n={BASE:"base",LOOSE:"loose",EXTRA_LOOSE:"xloose"},Yn={NONE:"none",TITLE:"title",UPPER:"upper",LOWER:"lower"},wp={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"},Ft={NONE:"none",EXTRA_TIGHT:"small400",TIGHT:"small200",BASE:"base",LOOSE:"large200",EXTRA_LOOSE:"large500"},qt={EXTRA_SMALL:"extraSmall",SMALL:"small",BASE:"base",MEDIUM:"medium",LARGE:"large",EXTRA_LARGE:"extraLarge",EXTRA_EXTRA_LARGE:"extraExtraLarge"},Ip={PRIMARY:"primary",SECONDARY:"secondary"},Wt={BASE:"base",BOLD:"bold"},yr={BASE:"base",SUBDUED:"subdued"},vr={BASE:"base",LARGE:void 0,SMALL:"small"},Rp={INSIDE:"inside",OUTSIDE:"outside"},Ye={VISIBLE:"visible",HIDDEN:"hidden"},Mp={VISIBLE:"visible",HIDDEN:"hidden",DYNAMIC:"dynamic"},Dp={BASE:"base",SUBDUED:"subdued"},Lp={BASE:"base",CUSTOM:"custom"},Op={START:"start",CENTER:"center",BASELINE:"baseline"},Np={ACCENT:"accent",BASE:"base"},Bp={COVER:"cover",CONTAIN:"contain"},Fp={BASE:"base",HIGH:"high"},Up={INLINE:"inline",BLOCK:"block"},xp={BASE:"base",SUBDUED:"subdued"},Vp={BLOCK:"block",INLINE:"inline"},Hp={HIDDEN:"hidden",VISIBLE:"visible",VISIBLE_WHEN_MULTIPLE:"visibleWhenMultiple"},Gp={FIXED:"fixed",COLLAPSIBLE:"collapsible"},qp={INLINE:"inline",INLINE_DESCRIPTION_LIST:"inlineDescriptionList",DESCRIPTION_LIST:"descriptionList"},Wp={COMMA:"comma",MIDDOT:"middot"},zp={MONOCHROME:"monochrome",ACCENT:"accent",SUBDUED:"subdued"},_r={BASE:"base",LARGE_100:"large-100"},$p={AUTO:"auto",CUSTOM:"custom"},br={SMALL:"small",BASE:"base",LARGE:"large",LARGE_100:"large100",LARGE_200:"large200",LARGE_300:"large300"},Yp="e_53fd82dc1f9722eff524544be73e81c5",jp="e_6d279941f0e9abf0f258b7dc3849503a",Kp="extracted_reductions_exp",Xp="floating_summary_exp";function Qp(s,e){return s.initialRequest.url.searchParams.get(Kp)||e.get("experiments")?.find(({clientHandle:i})=>i===Yp)?.variant||""}var je=(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))(je||{});function Zp(s,e){return(s.initialRequest.url.searchParams.get(Xp)||e.get("experiments")?.find(({clientHandle:i})=>i===jp)?.variant)??""}const Jp=(s,e)=>({reductions:Qp(s,e),floatingSummary:Zp(s,e)});function em({serializedIsCheckoutEditor:s,sourceType:e}){return typeof s=="boolean"?s:e==="simulated"&&typeof window<"u"&&window!==window.parent&&!ri()}function tm({serializations:s,source:e}){return{isCheckoutEditor:em({serializedIsCheckoutEditor:s.get("isCheckoutEditor"),sourceType:e.type}),isOnePageCheckout:s.get("checkoutLayout")==="one-page"}}class sm{constructor(e){this.#e=u({}),this.configurationSignal=this.#e,this.#e.value={...e},this.#t={...e}}#e;#t;get configuration(){return Qs(()=>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 jn="https://cdn.shopify.com/static/fonts/gt-standard/v1",im=`${jn}/GT-Standard-M-Standard-Regular-1790124696281.woff2`,rm=`${jn}/GT-Standard-M-Standard-Semibold-1790124696281.woff2`,pt={name:"GT Standard",base:{weight:400,sources:`url(${im}) format('woff2')`},bold:{weight:600,sources:`url(${rm}) format('woff2')`}},Sr={fonts:pt.name,weightBase:`${pt.base.weight}`,sourceBase:pt.base.sources,weightBold:`${pt.bold.weight}`,sourceBold:pt.bold.sources};function nm({defaultShellConfig:s,orderSummaryPlacement:e="afterDetails",isThankYouPage:t=!1,...i}){const r=e==="beforeDetails",n=Ht(i),a={...n,typographyPrimary:Sr,typographySecondary:Sr,vaulted:{...n.vaulted,shadow:"none",padding:"none",cornerRadius:"none"},rollup:{...n.rollup,inlinePadding:"large200"},moneySummary:{...n.moneySummary,labelTypography:{size:"base",weight:"bold"}}},o=Kn(t),d=nt(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 Kn(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(qt)(s?.size),letterCase:S(Yn)(s?.letterCase),fonts:S(Ip)(s?.fonts),weight:S(Wt)(s?.weight),kerning:S($n)(s?.kerning)}}function am(s,e,t){return!e||t.colorScheme==="WEB_DEFAULT"?s:{customizations:{},designSystem:{}}}function Is(s){const{divider:e}=s??{};return{divider:{visibility:S(Ye)(e?.visibility),borderStyle:S(vt)(e?.borderStyle),borderWidth:S(_t)(e?.borderWidth)}}}function Ar(s){const{divided:e}=s??{};return{...zt(s),divided:e??void 0}}function zt(s){const{background:e,border:t,borderStyle:i,borderWidth:r,cornerRadius:n,padding:a,shadow:o}=s??{};return{background:S(Gt)(e),border:S(Xt)(t),borderStyle:S(vt)(i),borderWidth:S(_t)(r),cornerRadius:S(Te)(n),padding:S(le)(a),shadow:S(kp)(o)}}function Rs(s,e){const t=nt(s,e);return t.rules=om(s.rules??[],(e.rules??[]).filter(i=>i!=null)),t}function om(s,e){const t=e.filter(n=>n!=null&&n.condition!=null),i=s.map(n=>{const a=t.find(o=>Ws(o?.condition,n.condition));return a?nt(n,a):n}),r=t.filter(n=>!s.some(a=>Ws(a.condition,n?.condition)));return[...i,...r]}function Er(s,{prefersDarkMode:e}){let t=s;for(const i of s.rules??[])if(i.condition?.prefersColorScheme==="dark"&&e){const{condition:r,...n}=i;t=nt(t,n)}return t}class dm{#e;#t;#s;#i;#r;#n;#a;#o;#d;#l;#c;#u;#h;#m;#p;#g;#f;#y;#v;#b;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:y,orderSummaryPlacement:b="afterDetails",isUniversalCheckoutFinalizer:m=!1}){this.#t=b,this.#g=m,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=Jp(r,h),this.#y=c,this.#b=e,this.#l=t.hasFlagEnabled(qo),this.#c=t.hasFlagEnabled(Wo),this.#u=!!h.get("embed")?.interstitialBrandingEnabled,this.#h=t.hasFlagEnabled(zo),this.#m=_p(h.get("experiments")),this.#p=l?.isCheckoutKit({includeLegacyCsk:!1})??!1;const{themeConfig:A,shellConfig:f}=this.#I();if(this.shell=new sm(f),this.theme=new $o(A),this.#g&&Be(l?.embedder)){let _=n.currentUrl.peek().normalizedPath==="/thank-you";se(()=>{const g=n.currentUrl.value.normalizedPath==="/thank-you";g!==_&&(_=g,Qs(()=>{const E=Kn(g),{main:R,footer:P}=this.shell.configuration;Xe(()=>{this.shell.set("main",{...R,...E.main,section:{...R.section,...E.main.section}}),this.shell.set("footer",{...P,...E.footer})})}))})}if(l?.embedder){const _=this.#v,g=!!_&&!this.#A();y.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.#A(),interstitialBrandingEnabled:this.#u,partnerHasFrontendBranding:!!_,partnerOverlayApplied:g,initialUrlOrigin:r.initialRequest.url.origin,prefersDarkMode:this.prefersDarkMode})}let p=this.prefersDarkMode;se(()=>{if(p!==this.prefersDarkMode){const{themeConfig:_,shellConfig:g}=this.#I();this.theme.replace(_),this.#A()&&this.shell.replace(g),p=this.prefersDarkMode}})}#_=(e,t)=>t.includes(this.#s[e]);#S(){const e=this.#_("floatingSummary",[je.Treatment0B]),t=this.#_("floatingSummary",[je.Treatment1,je.Treatment2,je.Treatment3]),i=this.#_("floatingSummary",[je.Treatment1,je.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"}}}#P(e,t){const{shared:i,divider:r,control:n,headingLevel1:a,headingLevel2:o,headingLevel3:d,headingLevel4:l,main:c,orderSummary:h,header:y,footer:b,textField:m,select:A,choiceList:f,checkbox:p,primaryButton:_,secondaryButton:g,rollup:E,lineItems:R,merchandiseThumbnail:P,vaulted:C,vaultedItem:w,icons:M}=e??{},k=R,O=E?.chevronCustomizations,{typography:I,cornerRadius:L}=t??{},H=zt(c?.section),B=Yo(H,["border","borderStyle","borderWidth","cornerRadius","background","shadow"]);return{icons:Object.fromEntries((M??[]).map(T=>[Xo(T.name.toLowerCase()),T.url])),global:{cornerRadius:S(Te)(i?.cornerRadius),typographyLetterCase:S(Yn)(i?.typography?.letterCase),typographyKerning:S($n)(i?.typography?.kerning)},cornerRadius:{small:L?.small??void 0,base:L?.base??void 0,large:L?.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:jo.reduce((T,Y)=>({...T,[Y]:Ko(Y,{scheme1:c?.colors,scheme2:h?.colors,scheme3:y?.colors,scheme4:b?.colors,scheme5:c?.section?.colors,scheme7:h?.section?.colors})}),{})}
2,typographyScale:{base:I?.size?.base??void 0,ratio:I?.size?.ratio??void 0},typographyPrimary:Gi(I?.primary??{}),typographySecondary:Gi(I?.secondary??{}),headingLevel1:{typography:ge(a?.typography)},headingLevel2:{typography:ge(o?.typography)},headingLevel3:{typography:ge(d?.typography)},headingLevel4:{typography:ge(l?.typography)},divider:{borderStyle:S(vt)(r?.borderStyle),borderWidth:S(_t)(r?.borderWidth)},link:{},control:{border:S(Xt)(n?.border),cornerRadius:S(Te)(n?.cornerRadius),labelPosition:S(Rp)(n?.labelPosition)},textField:{typography:ge(m?.typography),border:S(ht)(m?.border)},select:{typography:ge(A?.typography),border:S(ht)(A?.border)},choiceList:{group:{spacing:S(le)(f?.group?.spacing)}},optionList:{},checkbox:{cornerRadius:S(Te)(p?.cornerRadius)},lineItems:{quantityVisibility:S(Hp)(k?.quantityVisibility),priority:S(Fp)(k?.priority),sectionLayout:S(Gp)(k?.sectionLayout),priceLayout:S(Up)(k?.priceLayout),blockPadding:S(le)(k?.blockPadding),inlinePadding:S(le)(k?.inlinePadding),optionsColor:S(xp)(k?.optionsColor),optionsFormat:S(qp)(k?.optionsFormat),optionsSeparator:S(Wp)(k?.optionsSeparator),titleTypography:ge(k?.titleTypography),priceTypography:ge(k?.priceTypography),optionsTypography:ge(k?.optionsTypography)},moneyLines:{},moneySummary:{},rollup:{chevronCustomizations:{color:S(zp)(O?.color),direction:S(Vp)(O?.direction),size:S(_r)(O?.size)},background:S(Gt)(w?.background),blockPadding:S(le)(w?.blockPadding),blockAlignment:S(Op)(w?.blockAlignment),inlinePadding:S(le)(w?.inlinePadding),border:S(ht)(w?.border),borderStyle:S(vt)(w?.borderStyle),borderWidth:S(_t)(w?.borderWidth),cornerRadius:S(Te)(w?.cornerRadius),icon:{visibility:S(Ye)(w?.icon?.visibility),sizeClosed:S(br)(w?.icon?.sizeClosed),sizeOpen:S(br)(w?.icon?.sizeOpen)},label:{visibility:S(Mp)(w?.label?.visibility),size:S(qt)(w?.label?.size),color:S(yr)(E?.label?.color),weight:S(Wt)(E?.label?.weight)},children:{blockPaddingEnd:S(le)(E?.children?.blockPaddingEnd),blockPaddingStart:S(le)(E?.children?.blockPaddingStart)},primaryContent:{typography:{size:S(qt)(w?.primaryContent?.typography?.size),weight:S(Wt)(w?.primaryContent?.typography?.weight),lineHeight:S(vr)(w?.primaryContent?.typography?.lineSize)}},secondaryContent:{typography:{size:S(qt)(w?.secondaryContent?.typography?.size),color:S(yr)(w?.secondaryContent?.typography?.color),weight:S(Wt)(w?.secondaryContent?.typography?.weight),lineHeight:S(vr)(w?.secondaryContent?.typography?.lineSize)}},action:{tone:S($p)(w?.action?.tone)}},modal:{},primaryButton:{border:S(ht)(_?.border),blockPadding:S(Ft)(_?.blockPadding2),inlinePadding:S(Ft)(_?.inlinePadding2),cornerRadius:S(Te)(_?.cornerRadius),typography:ge(_?.typography)},secondaryButton:{border:S(ht)(_?.border),blockPadding:S(Ft)(g?.blockPadding2),inlinePadding:S(Ft)(g?.inlinePadding2),cornerRadius:S(Te)(g?.cornerRadius),typography:ge(g?.typography)},formLayout:{},popover:{},merchandiseThumbnail:{background:S(Dp)(P?.background),border:S(Xt)(P?.border),cornerRadius:S(Te)(P?.cornerRadius),fit:S(Bp)(P?.fit),borderColor:S(Lp)(P?.borderColor),badge:{background:S(Np)(P?.badge?.background)}},vaulted:{spacing:S(le)(C?.spacing),background:S(Gt)(C?.background),padding:S(le)(C?.padding),...!this.#h&&!B&&{border:"full",borderStyle:"base",borderWidth:"base",cornerRadius:"large"},divider:{visibility:S(Ye)(C?.divider?.visibility),borderStyle:S(vt)(C?.divider?.borderStyle),borderWidth:S(_t)(C?.divider?.borderWidth)}}}}#E(e,t){const{header:i,main:r,expressCheckout:n,orderSummary:a,rollup:o,cartLink:d,buyerJourney:l,footer:c,content:h}=e??{},y=o?.chevronCustomizations?.size;return{announcement:t.announcement,environment:this.#y,canvas:{...t.canvas,scrollbarGutter:S(wp)(r?.scrollbarGutter)},header:{...Ar(i),colorScheme:"scheme3",position:i?.position?fr[i.position]:t.header.position,alignment:S(ws)(i?.alignment),banner:{image:i?.banner?.image?.main??void 0},logo:{visibility:S(Ye)(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(Tp)(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(Ye)(l?.visibility)??t.buyerJourney.visibility,alignment:i?.position&&fr[i.position]==="inline"||t.header.position==="inline"?S(ws)(i?.alignment):void 0},content:{...Is(h)},cartLink:{visibility:S(Ye)(d?.visibility)},expressCheckout:{padding:S(le)(n?.padding),background:S(Gt)(n?.background),button:{cornerRadius:S(Te)(n?.button?.cornerRadius)}},main:{...Is(r),backgroundImage:r?.backgroundImage?.main??void 0,spacing:S(le)(r?.spacing),colorScheme:"scheme1",section:{...zt(r?.section),colorScheme:"scheme5"}},orderSummary:{...Is(a),backgroundImage:a?.backgroundImage?.main??void 0,colorScheme:"scheme2",section:{...zt(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(_r)(y),mobile:t.orderSummary.mobile,collapsedSavingsDisplay:t.orderSummary.collapsedSavingsDisplay,priceReductionAnimation:t.orderSummary.priceReductionAnimation,thumbnailStyle:t.orderSummary.thumbnailStyle,floatingSummary:t.orderSummary.floatingSummary},footer:{...Ar(c),colorScheme:"scheme4",position:S(Cp)(c?.position)??t.footer.position,alignment:S(ws)(c?.alignment)??t.footer.alignment,content:{visibility:S(Ye)(c?.content?.visibility)}},payButton:t.payButton}}#k(e,t){let i;const r=this.#T();switch(r){case"LIGHT":i=Ts;break;case"DARK":i=ks;break;case"AUTOMATIC":i=Ts;break;case"WEB_DEFAULT":i={theme:{},shell:{}};break;default:i=Ts;break}const n=r==="WEB_DEFAULT",a=n?Ap:bp,o=n?{}:Sp,d=r==="AUTOMATIC"&&this.prefersDarkMode?ks.shell:i.shell,l=nt(e,a,i.theme),c=nt(t,o,d);return r!=="AUTOMATIC"?{theme:l,shell:c}:{theme:Rs(l,{rules:[{condition:{prefersColorScheme:"dark"},...ks.theme}]}),shell:c}}#C(){return this.#p&&this.#f?.ui?.branding==="APP"}#T(){return this.#C()?this.#f?.ui?.colorScheme??"AUTOMATIC":this.#i.config.colorScheme??void 0}#w(){return Qo(this.#o)}#A(){return this.#a.current.value!=="shopPay"||Be(this.#f?.embedder)?!1:this.#w()||!!this.#f}#R(){return this.#u||this.#A()}#M(){return this.#a.current.value!=="shopPay"||Be(this.#f?.embedder)?!1:!this.#o.visibility.showCartLink}get prefersDarkMode(){if(this.#R())return!1;if(Be(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.#C())&&(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.#A()}#I(){const e=this.#T(),t=this.#i.variant.isStandard()||this.#C(),{customizations:i,designSystem:r}=am(this.#b,t,{...this.#i.config,colorScheme:e}),n=this.#S(),a=this.#E(i,n);let o=this.#P(i,r);const d=i?.main;!o.rollup?.inlinePadding&&(d?.section?.padding==null||d?.section?.padding==="NONE")&&(o={...o,rollup:{...o.rollup,inlinePadding:"base"}});const l=!t||e==="WEB_DEFAULT";for(const m of l?this.#b?.rules??[]:[]){const A=m.customizations?this.#E(m.customizations,a):a;if(m.customizations&&(a.rules=[...a.rules??[],{condition:{prefersColorScheme:m.condition.prefersColorScheme==="DARK"?"dark":void 0},...A,reductions:void 0}]),m.designSystem||m.customizations){const f=this.#P(m.customizations,m.designSystem);o.rules=[...o.rules??[],{condition:{prefersColorScheme:m.condition.prefersColorScheme==="DARK"?"dark":void 0},...f}]}}let c=o,h=a,y;if(t){const m={theme:o,shell:e==="WEB_DEFAULT"?a:n},A=this.#k(m.theme,m.shell);c=A.theme,h=A.shell}else if(this.#d)c=o;else if(Be(this.#f?.embedder)){const{themeConfig:m,shellConfig:A}=nm({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});c=m,h=A}else if(this.#o.app.usingShopLayout.value)c=Ht({darkMode:this.prefersDarkMode,fontScale:this.#o.app.config.fontScale}),h={...n,environment:a.environment,...fn(this.#o.app.config)?{header:{...n.header,logo:{...n.header.logo,visibility:"hidden"}},cartLink:{...n.cartLink,visibility:"hidden"}}:{}};else if(si(this.#o)){const{visibility:m}=this.#o;m.isOrderSummaryCollapsible||(h={...h,orderSummary:{...h.orderSummary,isCollapsible:!1,defaultState:"EXPANDED"}}),m.showDefaultShopTheme&&(c=Ht({darkMode:!1,fontScale:this.#o.app.config.fontScale}))}else this.isEmbeddedShopPayTheme?(c=Ht({darkMode:this.prefersDarkMode,fontScale:1,isEmbedded:!0}),y={cornerRadius:c.cornerRadius,primaryButton:c.primaryButton,secondaryButton:c.secondaryButton,merchandiseThumbnail:c.merchandiseThumbnail},h={...n,environment:a.environment}):c=o;if(this.#f?.embedder&&!this.#A()){const m=this.#v;m&&(c=Rs(c,m.theme),h=Rs(h,m.shell))}if(y&&(c={...c,cornerRadius:y.cornerRadius,primaryButton:{...c.primaryButton,cornerRadius:y.primaryButton?.cornerRadius},secondaryButton:{...c.secondaryButton,cornerRadius:y.secondaryButton?.cornerRadius},merchandiseThumbnail:{...c.merchandiseThumbnail,cornerRadius:y.merchandiseThumbnail?.cornerRadius??"small"}}),c=Er(c,{prefersDarkMode:this.prefersDarkMode}),h=Er(h,{prefersDarkMode:this.prefersDarkMode}),this.#R()){const m=A=>A?.filter(f=>f.condition?.prefersColorScheme!=="dark")??[];c={...c,rules:m(c.rules)},h={...h,rules:m(h.rules)}}return this.#M()&&(h={...h,cartLink:{...h.cartLink,visibility:"hidden"}}),this.#m&&(c={...c,formLayout:{...c.formLayout,spacing:"none"}}),{themeConfig:c,shellConfig:h}}update(e){this.#b=e;const{themeConfig:t,shellConfig:i}=this.#I();this.theme.replace(t),this.shell.replace(i)}}const Fe={ADDRESS:"fulfillment.address_change",PAYMENT_INSTRUMENTS:"payment.instruments_change",PAYMENT_CREDENTIAL:"payment.credential",WINDOW_OPEN:"window.open"};function At(s,e){return s.includes(e)||s.includes(`ec.${e}`)}function lm(s){return At(s,Fe.PAYMENT_INSTRUMENTS)||At(s,Fe.PAYMENT_CREDENTIAL)}function cm({allowedDelegations:s,requestedDelegations:e,isUcpFlavoured:t}){if(t){const n=(a,o)=>At(s,a)&&!!e?.includes(o);return{isAddressDelegationEnabled:n(Fe.ADDRESS,"fulfillment.address_change"),isPaymentInstrumentsDelegationEnabled:n(Fe.PAYMENT_INSTRUMENTS,"payment.instruments_change"),isPaymentCredentialDelegationEnabled:n(Fe.PAYMENT_CREDENTIAL,"payment.credential"),isWindowOpenDelegationEnabled:n(Fe.WINDOW_OPEN,"window.open")}}const i=At(s,Fe.ADDRESS),r=lm(s);return{isAddressDelegationEnabled:i,isPaymentInstrumentsDelegationEnabled:r,isPaymentCredentialDelegationEnabled:r,isWindowOpenDelegationEnabled:!1}}class um{constructor({serializations:e,layout:t,proposal:i,source:r,themeData:n,shop:a,profile:o,appConfiguration:d,mobileCheckoutSdk:l,client:c,router:h,shopPay:y,checkoutSheetProtocolConfig:b,requestInfoData:m,renderContextToken:A,identity:f,embed:p,observability:_}){this.#e=new Map,this.#t=u(void 0),this.profileKey=v(()=>this.#t.value?.key),this.profile=v(()=>this.#t.value?.profile),this.profileId=v(()=>this.#t.value?.key.id),this.allowEmptyCart=!1,this.layout=t,this.visibility=new pm({proposal:i,source:r,appConfiguration:d,shop:a,shopPay:y,identity:f,layout:this.layout});const g=cm({allowedDelegations:d?.allowedDelegations??[],requestedDelegations:p?.delegations.requested?Array.from(p.delegations.requested):void 0,isUcpFlavoured:p?.protocol?.isUcpEcp??!1});this.isAddressDelegationEnabled=g.isAddressDelegationEnabled,this.isPaymentInstrumentsDelegationEnabled=g.isPaymentInstrumentsDelegationEnabled,this.isPaymentCredentialDelegationEnabled=g.isPaymentCredentialDelegationEnabled,this.isWindowOpenDelegationEnabled=g.isWindowOpenDelegationEnabled,this.isCvvBypassEnabled=!!d?.isCvvBypassEnabled;const E=Be(p?.embedder);this.payButton={stickyPayButtonEnabledInWeb:!!d?.payButton?.stickyPayButtonEnabledInWeb,stickyPayButtonEnabledInMobile:!!d?.payButton?.stickyPayButtonEnabledInMobile,visibility:E?"HIDDEN":"VISIBLE"}
2,this.showPayButton=!E,this.showContactInformation=!E,this.showFooter=!E,this.#r(o,!1),this.#s=void 0;const R=tm({serializations:e,source:r});this.isUniversalCheckoutFinalizer=Be(p?.embedder)&&c.initialRequest.url.searchParams.get(yn)===Zo,this.deliveryMethodSelectorPlacement=this.isUniversalCheckoutFinalizer?"vaulted":"adjacent";const P=this.isUniversalCheckoutFinalizer?"beforeDetails":"afterDetails";this.branding=new dm({orderSummaryPlacement:P,isUniversalCheckoutFinalizer:this.isUniversalCheckoutFinalizer,serializations:e,themeData:n,shop:a,mobileCheckoutSdk:l,client:c,router:h,identity:f,shopPay:y,checkoutSheetProtocolConfig:b,embed:p,environment:R,observability:_}),this.addressSettings=new fp({shop:a,requestInfoData:m,identity:f,shopPay:y}),this.renderContextToken=A,this.orderSummary=d?.orderSummary||P==="beforeDetails"?{layoutStyle:d?.orderSummary?.layoutStyle??"COMPACT",placement:P}:void 0,this.headerText={visibility:d?.headerText?.visibility??"HIDDEN"},this.#i=v(()=>f.current.value==="shopPay"?y.user.phoneNumber.value:void 0),this.defaultPhoneNumber=this.#i,this.trackAddressAutoComplete=f.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(qi,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(qi,i),e),this.#t.value={key:i,profile:e}}}function hm(s){return!s.hideReductionsField}class pm{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=hm(r);const d=i?.features?.isExpressCheckoutEnabled??!0;this.showExpressCheckout=v(()=>["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=v(()=>a.current.value==="shopPay"&&i?.shopCash?.visibility!=="HIDDEN"),this.showDataSharingOptOut=v(()=>a.current.value==="shopPay"),this.showDeliveryHeading=v(()=>a.current.value==="guest"),this.showPurchaseOrderNumberField=v(()=>a.current.value==="businessCustomer"),this.showStandalonePhoneField=v(()=>a.current.value==="shopPay"&&!n.user.isAuthenticatedUser.value),this.showShippingLines=v(()=>{const c=(e.facts.delivery?.some(({deliveryAddress:b,pickupAddress:m})=>m!==null||b!==null)??!0)||e.negotiated.fields.isShippingRequired.value,h=e.negotiated.fields.deliveryNext.value,y=!!(h&&h.status==="filled"&&h.lines.some(({status:b})=>b!=="not_required"));return!!(c||y)}),this.showSubtotal=v(()=>{const{discountLines:l,paymentLines:c,taxes:h,tipLines:y,dutiesIncluded:b,legacyRepresentProductsAsFees:m,legacyMerchandiseLinesAsFees:A}=e.negotiated.fields,f=!!l.value?.lines.length,p=!!c.value?.lines.some(O=>O.method.type==="giftCard"),_=!!c.value?.lines.some(O=>O.method.type==="redeemable"&&O.method.redemptionSource==="CUSTOM"&&O.cost&&O.cost.amount>0&&O.method.redemptionContent),g=e.facts.tax?e.facts.tax:h.value?.status==="available_total_included"?h.value.totalIncludedInTarget:h.value?.status==="available_total"?h.value.totalTax:null,E=(()=>{const O=h.value?.status;if(O==="pending"||O==="unavailable"){const I=!!e.negotiated.fields.merchandiseLines.value?.taxesIncluded,L=e.facts.taxesIncluded??!1;return I||L}return O==="available_total_included"})(),R=!b.value&&!E&&!!(g&&g.amount!==0),P=Qe(t),C=P?e.facts.tip:y.value?.[0]?.amount,w=C&&C.amount>0,M=!!(m.value&&A.value&&A.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||f||p||_||R||k||w||P||M)}),this.showStoreCreditRedemption=v(()=>a.current.value==="shopPay"||a.current.value==="customerAccount"||a.current.value==="businessCustomer"),this.showShopCashRewardsBanner=v(()=>a.current.value==="shopPay"&&i?.shopCash?.visibility!=="HIDDEN"),this.showInvalidDeliveryAddressBanner=v(()=>a.current.value==="shopPay"||a.current.value==="customerAccount")}}function Xn({extensionPoint:s,placementReference:e}){return vn(s)?e:void 0}function Qn(s){return s?{desktop:s.desktop?{height:s.desktop.height}:null,mobile:s.mobile?{height:s.mobile.height}:null}:void 0}function Pr({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:y,extensionSkeletons:b,position:m,publicIdentifier:A})=>
2{if(!Jo(h))return[];const f=r.preloads;t&&e&&Zn({extension:r,extensionPoint:h,placementReference:y,observability:t,source:e,type:"persisted"});const p={target:h,metafields:r.metafieldRequests??[]};if(f.length)try{const _=ed({extension:r,extensionPoint:h});_&&(p.preloads=_)}catch{t&&e&&fm({extension:r,extensionPoint:h,observability:t,source:e,type:"persisted"})}return{id:A,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(m),targetPublicIdentifier:A,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:Xn({extensionPoint:h,placementReference:y}),approvalScopes:new Set(r.approvalScopes.map(({handle:_})=>_)),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:Qn(b)}});return[...i,...c]},[])}function mm({globalExtension:{extension:s,publicIdentifier:e,extensionSkeletons:t},extensionPoint:i,placementReference:r,observability:n,source:a}){return n&&a&&Zn({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:Xn({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:Qn(t)}}function gm({globalExtensions:s,observability:e,source:t}){return s.map(i=>{const{target:r,placementReference:n}=i;return{...mm({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 fm({extension:s,extensionPoint:e,observability:t,source:i,type:r}){t.error(new sd(`${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 Zn({extension:s,extensionPoint:e,placementReference:t,observability:i,source:r,type:n}){vn(e)&&!t&&i.error(new td(`${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}}})}class ym{constructor({proposal:e}){this.search=_n({items:v(()=>rd(e.negotiated.fields.customFields.value??[])),getTarget:id})}}function vm(s){return s.some(({target:e,placementReference:t})=>!!(e&&Wi(e)===Wi("purchase.checkout.block.render")&&t&&nd.includes(t)))}function Jn({proposal:s,serializedReceipt:e,source:t}){const i=s.negotiated.fields.buyerIdentity.value,r=i?.purchasingCompany?.location.id,n=i?.customerProfile?.id??bm(e?.purchaseOrder?.buyerIdentity),a=i?.countryCode??Sm(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 _m({persistence:s,proposal:e,serializedReceipt:t,source:i}){const r=s?.get(fe.Metafields,{scope:Jn({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 X_({metafields:s,persistence:e,proposal:t,serializedReceipt:i,source:r}){e&&s.subscribe(n=>{e.createUpdate(fe.Metafields,{scope:Jn({proposal:t,serializedReceipt:i,source:r})})(n)})}function bm(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:ea(e)}}function Sm(s){const e=s?.customer;if(e==null)return null;switch(e.__typename){case"GuestProfile":case"BusinessCustomerProfile":case"DecodedCustomerProfile":return e.countryCode??null;default:ea(e)}}
2class Am extends Error{constructor(){super(...arguments),this.name="TypescriptAssertionError"}}function ea(s){throw new Am(`Received unexpected value ${JSON.stringify(s)} in an exhaustive switch/conditional block`)}const Em=new Set;class Ms extends ve{constructor(){super(...arguments),this.name="ExtensibilityEngineNotLoadedError"}}class Pm extends ve{constructor(){super(...arguments),this.name="ExtensibilityEngineLoadError"}}class Cm{constructor(e){this.ui=new Tm(e),this.customFields=new ym({proposal:e.proposal})}}class Tm{constructor(e){this.#a=u(!1),this.#o=ad(),this.#u=!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=[...gm({globalExtensions:a.globalUIExtensions,source:r,observability:n}),...Pr({activatedExtensions:i,source:r,observability:n})];this.#r=u(c),this.#n=v(()=>dd(this.#r.value,{identity:this.#e})),this.hasAtRiskPlacement=v(()=>vm(this.#n.value.map(h=>({target:h.extensionPoint.target,placementReference:h.placementReference})))),this.search=_n({items:this.#n,getTarget:zi}),this.#d=u(_m({persistence:e.persistence,proposal:d,serializedReceipt:e.serializedReceipt,source:e.source})),this.metafields=this.#d,this.required=v(()=>ld({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;#u;#h;#m;#p;#g;unstable_isTargetMatch(e,t){return this.#o(zi(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.#u)return;const o=fu(n.negotiated);o.length===0||!this.#n.value.some(l=>a.has(l.id))||(this.#u=!0,Promise.resolve(yu({coreGraphql:r,resourceIds:o,checkoutProfileId:t.profileId.value})).catch(()=>{}))})}#y(){if(this.#m)return this.#m;const e=(async()=>{try{const{UIExtensibilityBrowserEngine:t}=await es(()=>D(()=>import("./extensibility-browser-engine.DyY02SX8.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])));this.#h=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 Pm(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.#h)throw new Ms("extensions manager registered before the engine loaded");this.#h.registerExtensionsManager(e)}hasBlockingExtensionForFeatures({features:e,deactivatedExtensionIds:t=Em,placementReferences:i,excludedExtensionTargets:r}){return od({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.#h?.syncPermissions([e]),this.#r.value=[...this.#r.value,e])}remove(e,t){const i=this.#r.value.filter(r=>e.includes(r.id));this.#h?.removePermissions(i),this.#r.value=this.#r.value.filter(r=>!i.includes(r)),t?.keepAlive||this.#h?.destroyExtensions(i,t.reason)}replace({activatedExtensions:e},t){const i=[],r=new Map(Pr({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.#h?.removePermissions(i),this.#h?.syncPermissions(a),this.#c=e,this.#r.value=a,t?.keepAlive||this.#h?.destroyExtensions(i,t.reason),this.#h?.refreshStorefrontTokens(e)}get sandboxCache(){if(!this.#h)throw new Ms("sandboxCache read before the engine loaded");return this.#h.sandboxCache}get storefrontTokens(){if(!this.#h)throw new Ms("storefrontTokens read before the engine loaded");return this.#h.storefrontTokens}updateMetafields(e){this.#d.value=e}}class km{#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=v(()=>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 cd(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":Yt}}
2function wm({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 Im(s,e){return s.cbtEnabled?!e||!s.supportedCountries.includes(e)||!s.creditCardEnabledCountries.includes(e):s.supportedCountries.every(t=>!s.creditCardEnabledCountries.includes(t))}const Rm=4,Cr=3;function Mm({config:s,paymentDue:e,financingPlans:t,isInstallmentsSelected:i,buyerCountryCode:r}){const n=s.cbtEnabled?s.financingPlans.filter(f=>f.minPrice.currencyCode===e.currencyCode&&f.maxPrice.currencyCode===e.currencyCode):t,a=n.reduce((f,p)=>{const{minPrice:_,terms:g}=p;return g.some(({loanType:R})=>R==="SPLIT_PAY")||e.currencyCode==="GBP"?Math.min(f,parseFloat(_.amount)):f},Number.MAX_SAFE_INTEGER),o=n.reduce((f,p)=>{const{minPrice:_,maxPrice:g,terms:E}=p,R=parseFloat(_.amount),P=parseFloat(g.amount),C=Math.max(e.amount,a);return C>=R&&C<=P?f.concat(e.currencyCode==="GBP"?E:E.filter(({loanType:w})=>w==="SPLIT_PAY")):f},[]),d=e.currencyCode==="GBP"?Cr:Rm,l=o.length?o.reduce((f,p)=>p.installmentsCount>f.installmentsCount?p:f,o[0]):void 0,c=l?.installmentsCount??d,h=i&&ud(s.availableLoanTypes),y=i&&Im(s,r),b=h||y,m=l?hd(l,{buyerCountryCode:r,currencyCode:e.currencyCode}):c;return{config:s,chargeAmount:(()=>{switch(e.currencyCode){case"GBP":{if(r&&r!=="GB")return Number(e.amount/m);const f=o.some(({loanType:_,apr:g})=>_==="INTEREST"&&g===0),p=s.availableLoanTypes.length===3;return Number(f&&!p?e.amount/c:e.amount/Cr)}default:return Number(e.amount/m)}})(),numberOfPaymentTerms:m,paymentMethodMustSupportInterestBearingLoans:h,paymentMethodMustSupportDebitCardOnly:b,sellerCountryRequiresDebitCardOnly:y}}function Qt(s){return s.negotiated.fields.paymentMethods.value?.find(t=>t.type==="wallet"&&t.name==="SHOPIFY_INSTALLMENTS")}function Dm(s,e){const t=md(e.popularBillingCountries,e.billingCountries)??[];return s.supportedCountries.flatMap(i=>t.find(({value:n})=>n===i)||[])}function Lm({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:y,credentialCountryMismatch:b,billingAddressUnsupported:m,billingShippingCountryMismatch:A}){const f=[],p=l&&c,_=l&&!a&&!c,g=p&&(!n||Ps(n,t)),E=pd(d)&&y,R=!!d.countryCode&&Ps(d,t),P=_&&d&&!h&&(E||R),C=_&&h&&(y||Ps(h.address,t));return(g||P||C)&&f.push("shipping_address"),(i<t.minPrice.amount||i>t.maxPrice.amount||t.cbtEnabled&&t.availableLoanTypes.length===0)&&f.push("amount"),(!t.supportedCurrencies.includes(r)||t.cbtEnabled&&(t.minPrice.currencyCode!==r||t.maxPrice.currencyCode!==r))&&f.push("currency"),t.giftCardsNotAllowed&&e&&f.push("gift_cards"),t.subscriptionItemsNotAllowed&&o&&f.push("subscriptions"),Qe(s)&&f.push("order_edit"),t.ineligibleTestModeCheckout&&f.push("test_mode"),t.ineligibleLineItem&&f.push("ineligible_line_item"),b&&f.push("credential_country_mismatch"),m&&f.push("billing_address"),A&&f.push("billing_shipping_country_mismatch"),f}function Om({isSupported:s,proposal:e,financingPlans:t,isInstallmentsSelected:i}){const r=v(()=>{if(!s.value||!e||!t||!i)return;const n=Qt(e),a=e.negotiated.fields.paymentDue.value;if(!(!n||!a))return Mm({config:n,paymentDue:a,financingPlans:t.value,isInstallmentsSelected:i.value,buyerCountryCode:e.negotiated.fields.buyerIdentity.value?.countryCode})});return{config:v(()=>r.value?.config),chargeAmount:v(()=>r.value?.chargeAmount),numberOfPaymentTerms:v(()=>r.value?.numberOfPaymentTerms),paymentMethodMustSupportInterestBearingLoans:v(()=>r.value?.paymentMethodMustSupportInterestBearingLoans??!1),paymentMethodMustSupportDebitCardOnly:v(()=>r.value?.paymentMethodMustSupportDebitCardOnly??!1),sellerCountryRequiresDebitCardOnly:v(()=>r.value?.sellerCountryRequiresDebitCardOnly??!1)}}function Nm({isSupported:s,hasInvalidShippingAddress:e,proposal:t,source:i,shopPay:r}){return v(()=>{if(!s.value)return[];const n=Qt(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=ts(d?.lines),c=l.some(I=>"giftCard"in I&&I.giftCard),h=l.some(I=>
2!!("sellingPlan"in I&&I.sellingPlan?.subscriptionDetails)),y=ti(t),b=o.customAttributes.value,m=gd(b),A=o.deliveryNext.value,f=fd(A,"ONE_TIME_PURCHASE",!0),p=yd(f),_=p?["PICK_UP","PICKUP_POINT","RETAIL"].includes(p.methodType):!1,g=p?.pickupLocation?.address,E=t.proposed.shippingAddress.value,R=r.session.selectedShippingAddress.value,P=y&&!m&&!_;let C;P&&(C=R?R.address.countryCode:E?.countryCode);const w=ta(r),M=_?g?.countryCode:C,k=!!(n.cbtEnabled&&w&&!n.supportedCountries.includes(w)),O=!!(n.cbtEnabled&&y&&!m&&w&&(!M||w!==M));return Lm({sourceType:i.type,hasGiftCard:c,config:n,totalAmount:Number(a.amount),currencyCode:a.currencyCode,pickupAddress:g,isPointOfSale:m,hasSubscription:h,shippingAddress:E,shippingRequired:y,isPickupDeliveryMethod:_,selectedShippingAddress:R,hasInvalidShippingAddress:e.value,credentialCountryMismatch:Bm({shopPay:r,shippingCountry:C}),billingAddressUnsupported:k,billingShippingCountryMismatch:O})})}function Bm({shopPay:s,shippingCountry:e}){const t=s.user.installments.credential.value?.countryCode;if(!t)return!1;const i=ta(s);return!!(e&&t!==e)||!!(i&&t!==i)}function ta(s){const e=s.session.selectedPaymentMethod.value;if(e)return it(e)?e.paymentAttributes.billingAddress.address.countryCode:s.session.selectedBillingAddress.value?.address.countryCode}class Fm{#e=u(!1);constructor({proposal:e,source:t,shop:i,shopPay:r,identity:n}){this.isSupportedDetails=v(()=>{if(n.current.value!=="shopPay")return{supported:!1,failedGate:"identity"};const o=Qt(e);if(!o)return{supported:!1,failedGate:"config"};if(!this.#t(e))return{supported:!1,failedGate:"paymentDue"};const d=o.supportedCountries??[],l=wm({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,y=!r.user.hasCreditCards.value,b=c||h||y||l;return{supported:b,failedGate:b?null:"buyerCountry"}}),this.isSupported=v(()=>this.isSupportedDetails.value.supported),this.supportedCountryOptions=v(()=>{if(n.current.value!=="shopPay")return[];const o=Qt(e);return o?Dm(o,i):[]}),this.ineligibilityReasons=Nm({isSupported:this.isSupported,hasInvalidShippingAddress:this.#e,proposal:e,source:t,shopPay:r}),this.isCheckoutEligible=v(()=>this.isSupported.value&&this.ineligibilityReasons.value.length===0),this.isUnavailable=v(()=>!this.isCheckoutEligible.value||r.user.installments.isRejected.value);const a=Om({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 Um{#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=v(()=>t.value||this.#e==="one-page")}}class Ut extends Error{constructor(){super(...arguments),this.name="OffsitePopupError"}}function xm(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?Vm(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 Vm(s){return`hsl(${s.h}, ${s.s}%, ${s.l}%)`}class Hm{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 Ut("Popup already open");return this.#i=t,this.#r=e,this.#a=n,this.#t=window.open("about:blank","_blank",Gm(window,r)),!this.#t||this.#t.closed?(Tr({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:Oe()}}),this.#n.counter({name:"offsite_payment_redirect_flow",value:1,attributes:{payment_method_name:"Crypto: USDC",redirect_reason:"popup_blocked",is_mobile:Oe()}})),!1):(this.#e.value=!0,this.#t.document.write(xm(i,a)),Tr({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:Oe()}}),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 Ut("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:Oe()}}),this.#a=!1}redirect(e){if(!this.isOpen.value||!this.#t)throw new Ut("Popup not opened yet");this.#t.location.assign(e)}focus(){if(!this.isOpen.value||!this.#t)throw new Ut("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:Oe()}}):this.#n.counter({name:"offsite_payment_popup_flow_cancelled",value:1,attributes:{payment_method_name:"Crypto: USDC",reason:"incomplete_flow",is_mobile:Oe()}})),this.close({runCancelCallback:!t}),t&&this.#r?.()}}}function Gm(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 Tr({success:s,observability:e}){e.counter({name:"buyer_experience_offsite_popup_open_count",value:1,attributes:{success:s}})}function qm({runningTotal:s,merchandiseLines:e,deferredTotal:t}){if(!(s&&s.amount<=0))return!0;const r=ts(e?.lines).some(a=>!!a.sellingPlan?.subscriptionDetails),n=t?.amount.amount;return!!(r||n)}function Wm({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=ts(i?.lines).some(m=>m.sellingPlan);return zm({paymentDue:e,paymentLines:t,hasSellingPlan:h})?"giftCard":$m({paymentDue:e,paymentLines:t,hasSellingPlan:h,redemptionSource:"STORE_CREDIT"})?"storeCredit":Ym({paymentDue:e,paymentLines:t,runningTotal:r,hasSellingPlan:h,redemptionSources:["CUSTOM","STORE_CREDIT"]})?"redeemables":jm({paymentFlexibilityPaymentTermsTemplate:o,deferredTotal:n,checkoutTotal:a,checkoutCompletionTarget:d,buyerIdentity:l,captureAtFulfillmentEnabled:c})&&!n?.amount.amount?"deferred":null}function zm({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 $m({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 Ym({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 jm({paymentFlexibilityPaymentTermsTemplate:s,deferredTotal:e,checkoutTotal:t,checkoutCompletionTarget:i,buyerIdentity:r,captureAtFulfillmentEnabled:n}){const a=i==="DRAFT_ORDER",o=ni({deferredTotal:e,checkoutTotal:t,paymentFlexibilityPaymentTermsTemplate:s,isCheckoutToDraft:a}),d=s?.type==="FULFILLMENT"&&n===!0&&!r?.purchasingCompany;return o||d?!1:!!s||a}function Km(s,e){return v(()=>{const t=!!e.remoteMerchandiseDetails?.value?.stableIdToShopId.size,i=e.remoteConsolidatedTotals?.value;return t&&i?i[s]??e[s].value:e[s].value})}function Xm(s){return v(()=>!!s.remoteMerchandiseDetails?.value?.stableIdToShopId.size&&s.remotePaymentDue?.value?s.remotePaymentDue.value:s.paymentDue.value)}function Qm({negotiatedFields:s,captureAtFulfillmentEnabled:e}){const t=Km("runningTotal",s),i=Xm(s),r=v(()=>qm({runningTotal:t.value,merchandiseLines:s.merchandiseLines.value,deferredTotal:s.deferredTotal.value})),n=v(()=>Wm({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 kr(s){return`${s.paymentMethod}:${s.id}`}class Zm{constructor(){this.#e=u([]),this.promoted=this.#e}#e;promote(e){const t=kr(e);this.#e.value.some(i=>kr(i)===t)||(this.#e.value=[...this.#e.value,e])}}function Jm(s){const e=s.map(t=>vd(t));return u(e)}function eg({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":bn(t)&&!(i&&bt(i,t))||a?"custom":r?"shipping":"custom"}function tg({isDraftOrderCheckout:s,proposedBillingAddress:e,billingAddressFact:t,companyLocationBillingAddress:i,companyLocationShippingAddress:r}){return t&&!!!(i&&bt(t,i))?"billing-fact":s&&e&&bn(e)&&!!!(i&&bt(e,i))?"custom":i?.address1?"billing":r?.address1?"shipping":"custom"}function sg({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 ig(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 rg(s){return s?{email:s?.email??void 0,phone:s?.phone??void 0}:{email:void 0,phone:void 0}}function wr(s,e){if(!e)return s;const t=we(e);return{...$i(s),...$i(t)}}function ng(s,e,t,i){const r=wr(e,i?.shippingAddress),n=wr(s,i?.billingAddress),a=t?.customerProfile?{}:rg(i);return{shippingAddress:r,billingAddress:n,email:a.email,phone:a.email?void 0:a.phone}}function ag({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 og(s){if(s?.__typename==="FilledPaymentTerms"&&s.billingAddress?.__typename==="StreetAddress")return we(s.billingAddress)}function dg(s){return s?.customerProfile?.__typename==="CustomerProfile"?s?.customerProfile?.billingAddresses[0]?.address:void 0}function lg(s){const e=s?.__typename==="FilledDeliveryTerms"?_d(s):void 0;return e?.destinationAddress?.__typename==="PartialStreetAddress"||e?.destinationAddress?.__typename==="StreetAddress"?we(e.destinationAddress):void 0}function cg({negotiationResultBuyerDelivery:s,negotiatedShippingAddress:e,customerVaultedShippingAddresses:t}){const i=lg(s)??e;if((i===void 0||ii(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 ug={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 hg(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:y})=>({stableId:y,appliedDiscounts:e.map(({label:b,amountDiscounted:m})=>({title:b,amountDiscounted:ce(m),presentationLevel:"LINE"})),price:ce(t),priceAfterDiscounts:ce(i),properties:bd(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 pg(s,{includeDeliveryGroups:e=!1}={}){if(!s?.session?.context.policies)return ug;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?we(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:hg(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(_=>({title:_.title,amount:ce(_.amount)})):void 0}),p.__typename==="PreviousTaxRecalculationFact"&&(h={...h,taxRecalculation:{beforeLines:p.beforeLines.map(_=>({title:_.title,rate:_.rate})),afterLines:p.afterLines.map(_=>({title:_.title,rate:_.rate}))}})});let y={};r.duty.forEach(p=>{p.__typename==="PreviousDutyFact"&&(y={duty:ce(p.total)})});let b={};r.landedCostDetails.forEach(p=>{p.__typename==="PreviousLandedCostDetailsFact"&&(p.incotermInformation?b={landedCostDetails:{incoterm:p.incotermInformation.incoterm,reason:p.incotermInformation.reason}}:b={landedCostDetails:void 0})});const m={delivery:r.delivery.flatMap(p=>p.__typename==="PreviousDeliveryFact"?[Sd(p,{includeDeliveryGroups:i==="ORDER_EDIT"&&e})]:[])};let A={};r.discount.forEach(p=>{p.__typename==="PreviousDiscountFact"&&(A={orderDiscounts:p.orderLevelDiscounts.map(_=>({label:_.label,amount:ce(_.amount)}))})});let f={};return n.forEach(p=>{p.__typename==="PreviousNegotiationFact"&&(f={orderNumber:p.orderNumber,requiresShipping:p.requiresShipping,taxesIncluded:p.taxesIncluded,dutiesIncluded:p.dutiesIncluded})}),{...a,...o,...d,...l,...c,...h,...y,...b,...m,...A,...f}}function mg(s,e){const t=s??[],i=e??[];return t.length!==i.length||t.some((r,n)=>Yi(r)!==Yi(i[n]))}function gg(s,e){const t=Ad(s);t.discountLines=Ke(s.discountLines,(n,a)=>n?.lines.length!==a?.lines.length,["money-lines"]),t.paymentLines=Ke(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=Ke(s.tipLines,(n,a)=>n?.length!==a?.length,["money-lines"]),t.legacyMerchandiseLinesAsFees=Ke(s.legacyMerchandiseLinesAsFees,(n,a)=>n?.lines.length!==a?.lines.length,["money-lines"]),t.paymentMethods=Ke(s.paymentMethods,mg,["payment-selector-change"]);const i=v(()=>Object.entries(t).reduce((n,[a,o])=>(n[a]=o.value,n),{}));return new Ed(i,n=>{Xe(()=>{for(const[a,o]of Object.entries(n)){const d=t[a];d&&(d.value=o)}})},t)}function Ir(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 Rr(s){if(!(!s.message||s.__typename!=="Note"))return s.message}function Mr(s){return s.__typename!=="Note"?[]:s.customAttributes?.map(({__typename:e,...t})=>t)}const fg={CheckpointDenied:"NegotiateFromSession.CheckpointDenied",NegotiationResultAvailable:"NegotiateFromSession.Unknown",NegotiationResultFailed:"NegotiateFromSession.NegotiationResultFailed",SubmittedForCompletion:"NegotiateFromSession.SubmittedForCompletion",Throttled:"NegotiateFromSession.Throttled",TooManyRequests:"NegotiateFromSession.Unknown"};function yg(s){return s==null?"NegotiateFromSession.Unknown":fg[s]}class vg{constructor({negotiateFromSessionData:e,router:t,shop:i,observability:r,source:n,persistence:a,isOnePageCheckout:o,isShopPayActive:d,checkoutContextData:l,requestInfoData:c,extendedAddressMode:h,receipt:y}){const b=At(l?.appConfiguration?.allowedDelegations??[],Fe.PAYMENT_INSTRUMENTS),m=Qe(n),A=n?.type==="draftOrder",p=(n?.type??void 0)==="abandonedCart",_=c.shop?.defaultShippingDetails?.country?{country:c.shop.defaultShippingDetails.country,zone:{code:c.shop.defaultShippingDetails.zone?.code}}:{country:i.country,zone:{code:void 0}},g=e?.session?.negotiate?.result,E=ji(Pd(e??void 0),g?.__typename==="NegotiationResultAvailable"?g.sellerProposal:void 0,g?.__typename==="NegotiationResultAvailable"?g.buyerProposal:void 0),R=Cd(e??void 0),P=ji(R,g?.__typename==="NegotiationResultAvailable"?g.sellerProposal:void 0,g?.__typename==="NegotiationResultAvailable"?g.buyerProposal:void 0),C=g?.__typename==="NegotiationResultAvailable",w=g?.__typename==="Throttled",M=C||w?Rr(g?.buyerProposal?.note):void 0,k=g?.__typename==="NegotiationResultAvailable"?g.sellerProposal:void 0,{availableDeliveryAddresses:O,availableRedeemables:I,buyerIdentity:L,canUpdateDeliveryAddress:H,canUpdateDiscountCodes:B,canU
66pdateMerchandise:T,captcha:Y,checkoutTotal:xe,checkoutTotalBeforeTaxesAndShipping:be,checkoutTotalTaxes:Ve,deferredTotal:Re,delivery:he,deliveryExpectations:G,deliveryMethods:W,dutiesIncluded:x,duty:V,hasOnlyDeferredShipping:z,landedCostDetails:X,legacyAggregatedMerchandiseTermsAsFees:$,legacyRepresentProductsAsFees:Q,legacySubtotalBeforeTaxesShippingAndFees:ee,managedByMarketsPro:ae,managedMarketsPaymentProcessor:oe,merchandise:Se,mustSelectProvidedAddress:j,mustSelectProvidedShippingRate:He,note:te,payment:K,poNumber:Ae,recurringTotals:Ee,remote:de,runningTotal:Ge,shopCashBalance:rs,shopDiscountOffer:dt,shopPayEnabled:kt,shopPromotion:lt,subtotalAfterMerchandiseDiscounts:Pe,subtotalBeforeReductions:qe,subtotalBeforeTaxesAndShipping:We,tax:Me,taxExemptions:ui,tip:F,total:ie,totalSavings:ze}=k??{},re=Hu(L),{remoteMerchandise:{remoteBuyerMerchandiseLines:ns,remoteSellerMerchandiseLines:va,stableIdToShopId:_a},remoteDelivery:as,remotePayment:os}=mn(g?.__typename==="NegotiationResultAvailable"?g.sellerProposal.remote:void 0),ct=pg(e,{includeDeliveryGroups:n.type==="orderEdit"&&i.hasFlagEnabled(Td)}),Z=g?.__typename==="NegotiationResultAvailable"||g?.__typename==="Throttled"?g.buyerProposal:void 0,ds=kd(te),ba=wd(te),hi=Id(te),[pe,wt]=Rd(g)?[Ki(Se,va),Ki(Z?.merchandise,ns)]:[Se,Z?.merchandise],ls=as?.isShippingRequired??k?.isShippingRequired??Z?.isShippingRequired,{merchandiseDiscount:pi,deliveryDiscount:Sa}=Md(g),mi=Z?.delivery,gi=(he&&pn({delivery:he,buyerDelivery:Z?.delivery,remoteDelivery:as}))??Gu({buyerIdentity:re,type:"shipping",isShopPayActive:d})??{},Aa=ds&&!!gi&&ba,cs=Dd(pe,wt,E),fi=Ld(cs.lines),yi=Od(cs.lines),us=Nd(Ge,Z?.runningTotal,E??[],pe),Ea=ze&&ze.__typename==="MoneyValueConstraint"?ce(ze):void 0,Pa=qe&&qe.__typename==="MoneyValueConstraint"?ce(qe):void 0,Ca=Pe&&Pe.__typename==="MoneyValueConstraint"?ce(Pe):void 0,vi=hr(K,us),et=Bd(K),Ta=Fd(K),It=Ud(Re??void 0,et?.dueDate??void 0),hs=xd(xe,Z?.checkoutTotal,E??[],pe),ps=!!ni({deferredTotal:It,checkoutTotal:hs,paymentFlexibilityPaymentTermsTemplate:et})?.amount,ka=Vd(K,os.availablePaymentLines),_i=Hd({availablePayments:ka,hasPayableDeposit:ps}),wa=Gd(i)&&qd({hasSellingPlan:fi,hasFixedSellingPlan:yi,paymentTermsTemplateType:et?.type}),bi=Wd({payment:K,sortedPaymentMethods:_i,runningTotal:us,paymentDue:vi,deferredTotal:It,checkoutTotal:hs,paymentMethodAutoSelectionDisabled:i.paymentMethodAutoSelectionDisabled,requiresVaulting:fi,hasPayableDeposit:ps,hasFixedSellingPlan:yi,paymentTermsTemplateType:et?.type,preserveAllocatedImmediatePaymentLineAmount:wa,observability:r}),Rt=zd({delivery:he,deliveryMethods:i.shipPickupInOneOrderEnabled?W:void 0,negotiatedMerchandise:pe,buyerDelivery:Z?.delivery,violations:E??[],isPointOfSale:ds,isPointOfSaleShipToHome:Aa,observability:r,isAbandonedCartSession:p,remoteDelivery:as}),Ia=og(K)??dg(re);let ms;C&&g.sellerProposal.nonNegotiableTerms?ms=Ir(g.sellerProposal.nonNegotiableTerms):g?.__typename==="Throttled"&&g.buyerProposal.nonNegotiableTerms&&(ms=Ir(g.buyerProposal.nonNegotiableTerms));const Ra=g?.__typename==="NegotiationResultAvailable"&&g.sellerProposal.optionalDuties?qu(g.sellerProposal.optionalDuties):void 0,Si=g?.__typename==="NegotiationResultAvailable"?$d(g.sellerProposal.attribution):void 0,Ai=g?.__typename==="NegotiationResultAvailable"?Eu(g.sellerProposal.attribution):void 0,Ma=Si===void 0&&Ai===void 0?void 0:{...Si,...Ai},Da=g?.__typename==="NegotiationResultAvailable"?Pu(g.sellerProposal.saleAttributions):void 0,La=ds&&hi?{code:hi}:void 0,gs=!m&&i.emailMarketing==="CHECKED",Ei=l?.appConfiguration?.features?.isEmailMarketingEnabled??!0,Oa=L?.__typename==="FilledBuyerIdentityTerms"&&L.customer?.__typename==="BusinessCustomerProfile",Pi=Wu(L),Ci=zu(L),Na=Ei?Oa?Pi??Ci??gs:Ci??Pi??gs:!1,Ti=C?Cu(g.sellerProposal.memberships):void 0,ki=Yd({sellerProposal:k,buyerProposal:Z,negotiationViolations:E,sellerMerchandise:pe}),N={remoteTaxDetails:Zu(de),remoteMerchandiseDetails:{stableIdToShopId:_a,mergedBuyerProposalMerchandise:wt},remoteSessionDetails:ol(g?.__typename==="NegotiationResultAvailable"?g.sellerProposal.remote:void 0),remoteConsolidatedTotals:ki,checkoutCardsinkCallerIdentificationSignature:e?.session?.checkoutCardsinkCallerIdentificationSignature??void 0,remotePaymentDue:hr(K,ki?.runningTotal),remoteTotalDetails:al({remote:k?.remote,negotiationViolations:E,sellerMerchandise:pe}),additionalMoneyLines:void 0,lpmDisclosure:k?.lpmDisclosure??void 0,billingAddress:Ia,shippingAddress:gi,merchandiseLines:cs,deliveryNext:Rt,sellability:nl({shop:i,sellerProposal:k,missingSellerProposalReason:yg(g?.__typename),isShippingRequired:ls,observability:r}),deliveryExpectations:Bu({deliveryExpectations:G}),availableDeliveryAddresses:O?O.map(q=>({address:we(q),id:q.handle??void 0})):[],mustSelectProvidedAddress:j??!1,mustSelectProvidedShippingRate:He??!1,canUpdateDiscountCodes:B??!0,canUpdateDeliveryAddress:H??!0,canUpdateMerchandise:T??!0,note:te?Rr(te):void 0,customAttributes:te?Mr(te):void 0,nonNegotiableTerms:ms,paymentMethodHistory:K?.__typename==="FilledPaymentTerms"?K.paymentMethodHistory:[],paymentLines:bi,paymentMethods:_i,availableRedeemables:Nu(I),shopCashBalance:Ou(rs),shopPromotion:Lu(lt),shop
66DiscountOffer:Du(dt),contactInfo:Qu(L),buyerIdentity:re,checkoutCompletionTarget:C?g.sellerProposal.checkoutCompletionTarget:void 0,duties:Mu(V),optionalDuties:Ra,dutiesIncluded:x,landedCostDetails:X?.incotermInformation??void 0,taxes:Xu(Me),taxExemptions:Xi(ui),subtotal:rl(We,Z?.subtotalBeforeTaxesAndShipping,E??[],pe),subtotalBeforeReductions:Pa,subtotalAfterMerchandiseDiscounts:Ca,legacySubtotalBeforeTaxesShippingAndFees:il(ee,Z?.legacySubtotalBeforeTaxesShippingAndFees,E??[],pe),legacyMerchandiseLinesAsFees:sl($),legacyRepresentProductsAsFees:Q,totalSavings:Ea,runningTotal:us,purchaseOrderNumber:C?Ae??void 0:void 0,total:ie?.__typename==="MoneyValueConstraint"?ce(ie):void 0,recurringTotals:tl(Ee),deferredTotal:It,hasOnlyDeferredShipping:z,checkoutTotal:hs,checkoutTotalBeforeTaxesAndShipping:el(be,Z?.checkoutTotalBeforeTaxesAndShipping,E??[],pe),checkoutTotalTaxes:Jd(Ve,Z?.checkoutTotalTaxes,E??[],pe),acceptEmailMarketing:Na,emailMarketingConsentGrantReached:Ku(L),acceptSmsMarketing:Yu(L)??ju(L)??!1,smsMarketingPhone:$u(C?g.sellerProposal.buyerIdentity:void 0),allViolations:P,paymentDue:vi,discountLines:Zd({merchandiseDiscount:pi,deliveryDiscount:Sa}),acceptUnexpectedDiscounts:Qd(pi),tipOptions:Ru(F),tipLines:Iu(F),localizationExtensions:k?.localizationExtension?.fields,scriptFingerprint:k?.scriptFingerprint?wu(k?.scriptFingerprint):void 0,transformerFingerprintV2:k?.transformerFingerprintV2||void 0,attribution:Ma,captcha:Xd(Y,R),cartMetafields:Kd(k?.cartMetafields),customFields:i.hasFlagEnabled(jd)?ku(k?.customFields):void 0,shopPayArtifact:void 0,paymentFlexibilityPaymentTermsTemplate:et,depositConfiguration:Ta,isImmediateAmountReducedForRedeemables:K?.__typename==="FilledPaymentTerms"&&K.isImmediateAmountReducedForRedeemables,reduction:La,managedByMarketsPro:ae,managedMarketsPaymentProcessor:oe,saleAttributions:Da,alternativePaymentCurrency:Tu(k?.alternativePaymentCurrency,bi),metafields:[],isShippingRequired:ls,remotePaymentDetails:os.paymentDetails,memberships:Ti,shopPayEnabledForSellerOfRecord:kt,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)}},wi=N.shippingAddress?.countryCode,Ii=N.shippingAddress?.zoneCode,Ri=ct.billingAddress?.countryCode??N.billingAddress?.countryCode??re?.countryCode??wi??_.country.code??i.popularBillingCountries?.[0]?.value,Ba=ct.billingAddress?.zoneCode??N.billingAddress?.zoneCode??Ii??_.zone.code,fs=dl({negotiatedMerchandise:pe??wt,negotiatedDeliveryNext:N?.deliveryNext,enabledDeliveryMethods:N.sellability.enabledDeliveryMethods,buyerProposalDelivery:mi,mustSelectProvidedShippingRate:He??!1}),Fa=Rt?.status==="filled"&&Rt.deliveryMacros?.length?Rt.deliveryMacros:[],Mi=A?N.shippingAddress:re.customerProfile?.__typename!=="BusinessCustomerProfile"?cg({negotiationResultBuyerDelivery:g?.__typename==="NegotiationResultAvailable"||g?.__typename==="Throttled"?g?.buyerProposal?.delivery:void 0,negotiatedShippingAddress:N.shippingAddress,customerVaultedShippingAddresses:re.customerProfile?.__typename==="CustomerProfile"?re.customerProfile.shippingAddresses:void 0}):(re.customerProfile.checkoutExperienceConfiguration?.editableShippingAddress&&N.deliveryNext?.status==="filled",N.shippingAddress),Di=ag({shippingAddress:Mi,defaultShippingDetails:_,shop:i,buyerIdentity:N.buyerIdentity}),Mt=ll(e?.session?.checkoutPaymentMethods),Ua=Mt?pu(mu(Mt)):void 0,Dt=(()=>{const q=ct.billingAddress??Ua??(g?.__typename==="NegotiationResultAvailable"&&g.sellerProposal.payment?.__typename==="FilledPaymentTerms"&&g.sellerProposal.payment.billingAddress&&g.sellerProposal.payment.paymentLines.length>0?we(g.sellerProposal.payment.billingAddress,r):void 0)??N.billingAddress;return q?.countryCode==null?Ss(q,Ri,Ba):Ss(q,q?.countryCode??Ri,q?.zoneCode??void 0)})();function xa(q){return!Sl(t.currentUrl.value.searchParams)||q.method.type!=="wallet"&&q.method.type!=="walletsPlatformPaymentMethod"}const ys=cl({paymentLines:N.paymentLines?.lines??[],availablePaymentMethods:N.paymentMethods,url:t.currentUrl.value,deferredTotal:It,shouldNotSetInitialState:i.paymentMethodAutoSelectionDisabled,hasPayableDeposit:ps,paymentTermsTemplateType:et?.type,observability:r}).filter(xa),Va=(()=>{const{purchasingCompany:q}=re;if(q)return tg({proposedBillingAddress:Dt,isDraftOrderCheckout:A,billingAddressFact:ct.billingAddress,companyLocationBillingAddress:q.location.billingAddress,companyLocationShippingAddress:q.location.shippingAddress});const De=ul({shopRequireMatchingShippingAndBilling:!!i.requireMatchingShippingAndBilling,selectedPaymentMethodType:ys?.[0]?.method.type,isShippingRequired:!!ls,isOrderSession:m,isB2B:!!q,isPickupPointDeliveryMethod:fs.every(({deliveryMethodTypes:ut})=>ut.includes("PICKUP_POINT"))});return eg({proposedBillingAddress:Dt,proposedShippingAddress:Mi,requireMatchingShippingAndBilling:De,sameBillingAndShippingAddress:i.sameBillingAndShippingAddress,deliveryMethodTypes:fs.flatMap(({deliveryMethodTypes:ut})=>ut),isDigitalGood:N.merchandiseLines?.lines&&N.isShippingRequired===!1,isPaymentInstrumentsDelegationEnabled:b,isDelegatedCardInstrument:Mt!=null&&gu(Mt)})})(),Ha=Ei?N.acceptEmailMarketing??gs??!1:!1,Ga=new URLSearchParams(t.currentUrl.value.search),qa=t.currentUrl.value.normalizedPath==="/processing"&&Ga.get("post_purchase")==="true"?"success":void 0,vs=hl(ys,[St.BuyWithPrime]).length>0,Li=t.currentUrl.value.normalizedPath==="/shoppay_login";let Lt;d?Lt="SHOP_PAY":vs?Lt="BUY_WITH_PRIME":!Li&&!m&&!o&&(Lt="SHOPIFY");const Wa=!Li&&!m&&!o,za=ig(e?.session?.context.session),tt=ng(Dt,Di,re,za),{locationCountryCode:$a,locationZoneCode:Ya}
66=sg({shippingAddressCountryCode:wi,shippingAddressZoneCode:Ii,buyerIdentityCountryCode:re?.countryCode,defaultCountryCode:_.country.code,defaultZoneCode:_.zone.code}),ja=tt.email===void 0?"":void 0,Ka=tt.phone===void 0?"":void 0,Oi=Z?.buyerIdentity?{email:Uu(Z.buyerIdentity,{emptyContactFallback:ja}),phone:Fu(Z.buyerIdentity,{emptyContactFallback:Ka})}:void 0,Xa=re.customerProfile?.email||void 0,Qa=g?.__typename==="Throttled"?xu(Z):void 0,_s=pl(n),U={attributes:N.customAttributes,attribution:N.attribution,discountLines:N.discountLines?.lines??[],memberships:Ti,legacyRepresentProductsAsFees:N.legacyRepresentProductsAsFees,taxExemptions:vl({negotiated:Xi(k?.taxExemptions)}),email:Xa??Oi?.email??tt.email??re.customerProfile?.email??N.contactInfo?.email??(L&&"email"in L?L.email:void 0)??"",phone:Oi?.phone??tt.phone??N.contactInfo?.phone??(L&&"phone"in L?L.phone:void 0)??"",merchandiseLines:fl({proposedMerchandise:yl(wt,[]),negotiatedMerchandiseLines:N.merchandiseLines}),tipLines:N?.tipLines,paymentLines:ys,useStoreCreditForSubscriptionRenewals:!1,availableRedeemables:N.availableRedeemables,remotePaymentDetails:os.paymentDetails,acceptEmailMarketing:Ha,acceptSmsMarketing:N.acceptSmsMarketing??!1,smsMarketingPhone:N.smsMarketingPhone??"",acceptPaymentVaulting:!1,localizationExtensions:N.localizationExtensions??[],shippingAddress:tt.shippingAddress??Di,billingAddress:tt.billingAddress??Dt,locationAddress:gl(mi)??Ss({},$a,Ya),billingAddressOption:Va,note:M,cartMetafields:ml(C?g?.buyerProposal?.cartMetafields:null),postPurchaseInquiryStatus:a?.get(fe.PostPurchaseInquiryStatus,{scope:_s})??qa??"disabled",shopPayArtifact:a?.get(fe.ShopPayArtifact,{scope:_s}),deliveryLines:fs,deliveryMacros:Fa,externalDeliveryIds:a?.get(fe.ExternalDeliveryIds,{scope:_s}),purchaseOrderNumber:N.purchaseOrderNumber??"",optionalDuties:N.optionalDuties,captcha:N.captcha,reduction:N.reduction,saleAttributions:N.saleAttributions,rememberMe:Qa??!!N.buyerIdentity?.rememberMe,shopPayRememberMeVisible:!1,setShippingAddressAsDefault:void 0};vs&&(N.customAttributes=Qi(N.customAttributes??[]));const Ni=C||w?Mr(g?.buyerProposal?.note):void 0,Za=vs?Qi(Ni??[]):Ni;this.proposed={email:u(U.email??""),phone:u(U.phone??""),acceptEmailMarketing:u(U.acceptEmailMarketing),acceptSmsMarketing:u(U.acceptSmsMarketing),smsMarketingPhone:u(U.smsMarketingPhone),acceptPaymentVaulting:u(U.acceptPaymentVaulting),deliveryLines:_l(U.deliveryLines),deliveryMacros:u(U.deliveryMacros),externalDeliveryIds:u(U.externalDeliveryIds),purchaseOrderNumber:u(U.purchaseOrderNumber),useProgressiveRates:u(Wa),interfaceFlow:u(Lt),billingAddress:As(U.billingAddress,{extendedAddressMode:h}),locationAddress:As(U.locationAddress,{extendedAddressMode:h}),shippingAddress:As(U.shippingAddress,{extendedAddressMode:h}),billingAddressOption:u(U.billingAddressOption),discountLines:Ke(U.discountLines,(q,De)=>q.length!==De.length,["money-lines"]),legacyRepresentProductsAsFees:u(U.legacyRepresentProductsAsFees),remotePaymentDetails:u(U.remotePaymentDetails),paymentLines:Ke(U.paymentLines,(q,De)=>{const ut=q.some(({method:bs})=>bs.type==="giftCard"),Ja=De.some(({method:bs})=>bs.type==="giftCard");return ut!==Ja},["money-lines"]),useStoreCreditForSubscriptionRenewals:u(U.useStoreCreditForSubscriptionRenewals),availableRedeemables:u(U.availableRedeemables),merchandiseLines:u(U.merchandiseLines),note:u(U.note),attributes:u(Za),cartMetafields:u(U.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(U.postPurchaseInquiryStatus),tipLines:u(U.tipLines),localizationExtensions:Jm(U.localizationExtensions),shopPayArtifact:u(U.shopPayArtifact),shopPayRememberMeVisible:u(U.shopPayRememberMeVisible),memberships:u(U.memberships),optionalDuties:u(U.optionalDuties),attribution:u(U.attribution),captcha:u(U.captcha),reduction:u(U.reduction),saleAttributions:u(U.saleAttributions),rememberMe:u(U.rememberMe),setShippingAddressAsDefault:u(U.setShippingAddressAsDefault),taxExemptions:u(U.taxExemptions)},this.negotiated=gg(bl(N,y)),this.facts=ct}}function _g(s){return s?.status==="processed"}class bg{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=v(()=>!!(!r&&n&&_g(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 Sg{#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 Ag{#e;#t;constructor(e){this.#t=e,this.#e=u(void 0),this.availableToRender=v(()=>{const t=this.#e.value;if(!t)return[];const i=t.isSplitShipAndPickup?Al:El;return(i[this.#t.identity.current.value]??i.default).filter(n=>Pl[n].shouldRender({preactContext:t,concepts:this.#t}))}),this.availableToRenderGrouped=v(()=>{const t=this.#e.value;if(!t)return[];const i=Cl(this.availableToRender.value,{preactContext:t,concepts:this.#t});return Tl(i)})}unstable_providePreactContext(e){const t=this.#e.peek();Ws(t,e)||(this.#e.value=e)}}const Ys="wallet_deceleration";function Eg(s){return s.searchParams.get(Ys)!=="true"}function Pg(s){const e=Eg(s);if(!e){s.searchParams.delete(Ys);const t=new URL(window.location.href);t.searchParams.delete(Ys),window.history.replaceState(null,document.title,t.href)}return e}class Cg{constructor(){this.billingAddressErrors=_e(),this.poNumberError=u(void 0),this.contactErrors={phoneInputError:u(void 0),emailInputError:u(void 0)}
66,this.missingFields={phone:{isValid:u(!0),error:u(""),input:u("")},firstName:{input:u(""),error:u("")}}}}function js(s){return s?.__typename==="CustomerProfile"}function Tg(s){const t=s.negotiated.fields.buyerIdentity.value?.customerProfile;return js(t)&&!t.email?!1:s.proposed.email.value.length>0?!0:!!(js(t)&&t.email)}function kg(s){return s.shippingAddresses.length===0}function wg(s,e){const[t]=s.shippingAddresses;return s.shippingAddresses.length===1&&t!==void 0&&e(t.address,"shipping").size>0}function Ig(s,e){return e!=null&&s(e,"shipping").size===0}function Rg(s,e,t){return!e&&t!=null&&s.shippingAddresses.length>0}function Mg(s,e,t,i){return Rg(s,t,i)||!t&&!i?!1:!e.selectedAddress.value}function Dg(s){return v(()=>{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 Lg(s,e){return v(()=>{const t=s.negotiated.fields.paymentMethods.value;return{vaultedCardsAvailable:t!=null&&t.some(i=>i.type===jt.CreditCard),isCheckoutToDraft:e.type==="draftOrder"}})}function Og(s){return v(()=>{const e=s.negotiated.fields.paymentMethods.value;return e!=null&&e.some(t=>t.type===jt.CreditCard||t.type===jt.PayPal)})}function Ng(s){return v(()=>{const e=s.negotiated.fields.paymentMethods.value;return e?e.some(t=>t.type===jt.CreditCard):!1})}function Bg(s){return v(()=>kl({availablePaymentMethods:s.negotiated.fields.paymentMethods.value??[],paymentMethodHistory:s.negotiated.fields.paymentMethodHistory?.value??[]}))}function Fg(s){return v(()=>{const e=s.negotiated.fields.paymentDue.value;return e!=null&&(e.amount??0)>0})}function Ug(s){return v(()=>s.negotiated.fields.availableDeliveryAddresses.value?.map(t=>t.address)??[])}function xg({identity:s,proposal:e,shopPay:t,isEmbeddedPartner:i=!1}){switch(s.current.value){case Yt: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 Tg(e);default:return e.proposed.email.value.length>0}}class Vg extends Error{constructor(){super("NoopVaultedSections is not implemented"),this.name="NoopVaultedSectionsError"}}class Hg{#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&&!Zi(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&&!Zi(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 Gg(){return v(()=>{throw new Vg})}class qg{constructor(){this.signal=Gg()}dispose(){}}class Wg{#e;#t;#s;#i;#r;#n;#a;#o;#d;#l;#c;#u;#h;#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=Dg(this.#t),this.#d=Lg(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 Hg({violationsSubscription:t,walletsViolationsSubscription:i,walletsLastNegotiationViolationsSubscription:r}),this.#l=Og(this.#t),this.#c=Ng(this.#t),this.#u=Bg(this.#t),this.#h=Fg(this.#t),this.#g=Qe(this.#r),this.#m=Ug(this.#t),this.signal=v(()=>({contact:this.#v(),delivery:this.#b(),payment:this.#_(),billing:this.#S()}))}dispose(){this.#f.dispose()}initializeViolationTracker(){this.#f.initialize()}#v(){return xg({identity:this.#e,proposal:this.#t,shopPay:this.#i,isEmbeddedPartner:this.#p})}#b(){switch(this.#e.current.value){case Yt: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(!js(i))return!1;
66const r=this.#t.negotiated.fields.shippingAddress.value,n=this.#t.proposed.shippingAddress.value,a=this.#n.addressSettings?.nonBillingAddressSettings.value;return!kg(i)&&!wg(i,this.#y)&&(!a||!Mg(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()&&Ig(this.#y,e)}case"businessCustomer":{const e=this.#o.value;return!(e.hasEditableShippingAddress&&!e.isValidShippingAddress)}default:return!0}}#_(){switch(this.#e.current.value){case Yt:return!1;case"shopPay":{const e=this.#i.user.paymentMethods.value,t=this.#h.value,i=this.#t.negotiated.fields.isShippingRequired.value??!1;return!t&&!i?this.#i.user.addresses.value.length>0:this.#i.enableCardVaulting?e.some(zs):!0}case"sdkCartHints":return this.#n.isPaymentInstrumentsDelegationEnabled;case"businessCustomer":{const t=this.#t.negotiated.fields.buyerIdentity.value?.customerProfile;if(this.#g||!wl(t))return!1;const r=!!this.#t.negotiated.fields.paymentFlexibilityPaymentTermsTemplate.value,n=this.#c.value,a=this.#d.value,o=r||a.isCheckoutToDraft;return Ji({identitySource:"businessCustomer",isOrderSession:this.#g,storeVaultEnabled:this.#s.storeVaultEnabled,customerProfile:t,hasCustomerStoredPaymentMethod:this.#u.value})?!0:n||o&&!a.vaultedCardsAvailable}case"customerAccount":{if(Ji({identitySource:"customerAccount",isOrderSession:this.#g,storeVaultEnabled:this.#s.storeVaultEnabled,customerProfile:void 0,hasCustomerStoredPaymentMethod:this.#u.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}}#S(){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.#h.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 zg extends Wg{constructor(e){super(e),this.initializeViolationTracker()}}function $g({proposal:s,layout:e,shop:t,client:i}){return Il({isApplePaySubscriptionsDecelerationActive:Ol(t),isApplePaySubscriptionReviewLayoutSupported:e.isOnePage.peek()||t.hasFlagEnabled(Ll),hasSubscriptionReviewQueryParam:i.initialRequest.url.searchParams.has(Dl),isABTestActive:t.hasFlagEnabled(Ml),experiments:i.unstable_getSerialization("experiments"),isCaliforniaBillingOrShippingAddress:Rl(s.proposed.billingAddress.peek(),s.proposed.shippingAddress.peek())})}function Yg({paymentLines:s,isOnePage:e}){return xl({paymentLines:s,isOnePage:e})?Vl(s,"PAYPAL_EXPRESS")?.method.walletContent?.isVenmo?"VENMO":"PAYPAL_EXPRESS":null}function jg({paymentLines:s,paymentMethods:e,url:t,isOnePage:i,isShopPayActive:r,isApplePaySubscriptionReviewRequired:n=!1}){const a={[tr]:t.searchParams.get(tr),[er]:t.searchParams.get(er)},o=t.pathname.includes("/thank-you");if(n)return"APPLE_PAY";const d=Yg({paymentLines:s,isOnePage:i});return d||(Nl({paymentLines:s})?"GOOGLE_PAY":Bl({paymentLines:s,isOnePage:i,isShopPayActive:r})?"APPLE_PAY":Fl({paymentLines:s,paymentMethods:e,urlParams:a,isThankYouPage:o})?St.BuyWithPrime:Ul({paymentLines:s,paymentMethods:e,urlParams:a})?St.AmazonPay:null)}function Kg(s){return s==="APPLE_PAY"||s==="GOOGLE_PAY"}class Xg{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=v(()=>Kg(this.#s.value)),this.lastClicked=this.#t,this.hasConsumedApplePaySubscriptionReviewParam=this.#r,this.hasActiveApplePaySubscriptionReview=this.#n;const d=a.initialRequest.url,l=$g({proposal:i,layout:n,shop:o,client:a}),c=jg({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 Hl:new Gl)}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 sr(`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 sr(`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 Qg{constructor({serializations:e,receipt:t,profile:i,source:r,checkoutContextData:n,themeData:a,shop:o,mobileCheckoutSdk:d,client:l,persistence:c,shopPay:h,shopPayIsActive:y,requestInfoData:b,isEmbedded:m,isEmbeddedPartner:A,observability:f,userEvents:p,embed:_,events:g,graphql:{coreGraphql:E,shopPayGraphql:R,throttleGraphql:P},i18n:C,router:w,initialNegotiationData:M,url:k,eagerlyLoadAppMetafields:O}){this.#n=u(null),this.crossBorderConfirmState=this.#n;const I=o.hasFlagEnabled(ql);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 L=new Um({serializations:e,isCheckoutLayoutForcedToOnePage:this.#i}),{initialRequest:{url:H}}=l;this.validation=new Cg,this.address=new jh({extendedAddressModePolicy:y?gh(h.user):Wl(o),graphql:E,i18n:C,initialCountryDetails:[b?.httpRequestInfo?.geolocation?.country,b?.shop?.defaultShippingDetails?.country,o.country]});const B=new vg({negotiateFromSessionData:M,router:w,url:k,source:r,shop:o,isOnePageCheckout:L.isOnePage.value,observability:f,persistence:c,isShopPayActive:y,checkoutContextData:n,requestInfoData:b??{},extendedAddressMode:this.address.extendedAddressMode,receipt:this.#e.peek()});this.proposal=B;const T=Qm({negotiatedFields:B.negotiated.fields,captureAtFulfillmentEnabled:o.captureAtFulfillmentEnabled});this.isPaymentRequired=T.isPaymentRequired,this.paymentExemptionReason=T.paymentExemptionReason,this.#s=u(!1),this.isRedirectingExter
66nally=this.#s,this.wallets=new Xg({observability:f,events:g,proposal:B,isShopPayActive:y,layout:L,shop:o,client:l}),this.identity=new km({observability:f,wallets:{shopPayIsActive:y,escalatedWalletSignal:this.wallets.escalatedWallet},protocols:{isEmbedded:m,isEmbeddedPartner:!!A,mobileCheckoutSdk:d},shop:o,proposal:B}),this.identity.initialize();const Y=new Fm({proposal:B,source:r,shop:o,shopPay:h,identity:this.identity});this.installments=Y,this.cardNetworkSelection=new Qh,this.offsitePopupController=new Hm({observability:f}),this.configuration=new um({serializations:e,layout:L,proposal:B,source:r,appConfiguration:n.appConfiguration,themeData:a,shop:o,profile:i,mobileCheckoutSdk:d,client:l,shopPay:h,requestInfoData:b,router:w,renderContextToken:new Sg({token:H.searchParams.get("rctx")??void 0}),identity:this.identity,embed:_,observability:f}),this.extensibility=new Cm({activatedExtensions:i?.activatedExtensions??[],client:l,configuration:this.configuration,eagerlyLoadAppMetafields:O,events:g,graphql:E,identity:this.identity,isCheckoutEditor:this.configuration.branding.shell.configuration.environment.isCheckoutEditor??!1,observability:f,persistence:c,proposal:B,serializedReceipt:e.get("receipt"),shop:o,source:r}),this.addressManager=new zh({identity:this.identity,observability:f,userEvents:p,proposal:B,wallets:this.wallets,graphql:{coreGraphql:E,shopPayGraphql:R,throttleGraphql:P},i18n:C,address:this.address,configuration:this.configuration,shop:o,shopPay:h,source:r,router:w,initialNegotiationData:M}),this.isShippingRequired=v(()=>ti(B)),this.#r=u(!0),this.supportsSplitShipping=this.#r,this.unstable_evaluateSupportsSplitShipping(H),this.unstable_graphqlDataRequestInfo=b??void 0,this.paymentMethodPromotions=new Zm,this.thankYouEntrance=new to({initialInterstitialOwner:so({serializedOwner:e.get("thankYouInterstitialOwner")})}),this.checkoutExit=new Zh,this.vaultedSections=I?new zg({configuration:this.configuration,addressManager:this.addressManager,identity:this.identity,proposal:B,shop:o,shopPay:h,source:r,isEmbeddedPartner:A}):new qg,this.sections=I?new Ag({configuration:this.configuration,installments:Y,isShippingRequired:this.isShippingRequired,vaultedSections:this.vaultedSections,source:r,proposal:B,identity:this.identity,shop:o,embed:_}):new zl,this.rememberMe=new bg({url:k,shop:o,source:r,shopPayIsActive:y,receipt:this.latestReceipt.value,observability:f})}#e;#t;#s;#i;#r;#n;unstable_setRedirectingExternally(e){this.#s.value=e}unstable_evaluateSupportsSplitShipping(e){const t=Pg(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 sa(s){return{status:"abandoned",id:`gid://shopify/ProcessedReceipt/${s.id}`}}function Zg({serializedReceipt:s,receiptForUI:e}){if(s?.status==="abandoned")return u(sa(s));const t=s?.latestReceipt;return!t||t.__typename==="ReceiptNotFound"?u(void 0):u(e(t))}function Jg({serializedReceipt:s,sessionFinished:e}){if(e===!1||$l(s))return Yl()}async function ef({serializedReceipt:s,observability:e}){if(s?.status==="abandoned")return u(sa(s));const t=s?.latestReceipt;if(!t||t.__typename==="ReceiptNotFound")return u(void 0);if(Ju(t))return u(eh(t));let i;try{i=await jl()}catch(r){const n=t.__typename==="ProcessedReceipt"?s?.orderStatusPageUrl??t.orderStatusPageUrl:void 0,a=t.__typename==="ProcessedReceipt"&&!n?Vu(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 Zg({serializedReceipt:s,receiptForUI:i})}class tf{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??sf(),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:Kl,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 sf(){return typeof performance>"u"?0:performance.timeOrigin||Date.now()-performance.now()}class rf{constructor({rootElement:e,serializations:t}){this.prefersDarkMode=nf("(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 af(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 tf}#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=Xl(fe.SourceToken);e&&t!==e&&(Ql(fe.ExtensionStorage),Zl(fe.SourceToken,e))}}function nf(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 af{#e;
66constructor(e){this.#e=e}get(e){const t=of(document.cookie).get(e);if(t!==void 0)return t;if(e==="_shopify_y")return Ui(this.#e?.get("shopifyY"),this.#e?.get("shopifyYExpiration"));if(e==="_shopify_s")return Ui(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 of(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 df{#e;constructor(e=lf()){this.#e=e}get(e){return this.#e[e]}}function lf(){const s={},e=document.querySelectorAll('meta[name^="serialized-"]');for(const t of e){const i=t.getAttribute("name")?.replace("serialized-","");s[i]=cf(t)}return s}function cf(s){const e=s.getAttribute("content");try{return e?JSON.parse(e):void 0}catch{return}}class uf{#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}merchantMetafields(){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 hf=[408,429,430,500,502,503,504],pf={analytics:Ot.NO_VALUE,marketing:Ot.NO_VALUE,preferences:Ot.NO_VALUE,saleOfData:Ot.NO_VALUE},mf=[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 ia{#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=v(()=>this.#e.value.analytics),this.marketingAllowed=v(()=>this.#e.value.marketing),this.preferencesProcessingAllowed=v(()=>this.#e.value.preferences),this.saleOfDataAllowed=v(()=>this.#e.value.saleOfData),this.saleOfDataRegion=v(()=>this.#s.value.saleOfDataRegion),this.getRegion=v(()=>this.#s.value.region),this.shouldShowBanner=e.shouldShowBanner??v(()=>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 mf)document.addEventListener(t,e),this.#i.push({event:t,handler:e})}#a(){return{analytics:on(),marketing:an(),preferences:nn(),saleOfData:rn()}}#o(){return{shouldShowBanner:lo(),saleOfDataRegion:oo(),region:ao()}}#d(){const e=dn();return"analytics"in e?{analytics:e.analytics,marketing:e.marketing,preferences:e.preferences,saleOfData:e.sale_of_data}:pf}}class gf extends ia{constructor(e){super({observability:e.observability}),this.consentProvider="consent-tracking-api"}get trackingConsentHeader(){}merchantAllowedProcessing(){return{analytics:on(),marketing:an(),preferences:nn(),saleOfData:rn()}}merchantVisitorConsent(){const e=dn();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 co()}async setTrackingConsent(e,t){try{return await new Promise(i=>{uo({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 ff={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 Dr extends Error{constructor(){super(...arguments),this.name="ShopConsentManagerError"}}class Lr extends Error{constructor(){super(...arguments),this.name="ShopConsentManagerUserChangedError"}}const Ds="Shop Pay user changed while setting consent",Or="shop_consent_manager_error",yf=3,vf=1,Nr="3.amps",_f="3.Amps",bf="3.AMpS",Sf=new Set(["AU"]),xt=!0;class Af extends ia{constructor(e){e.prefetchedConsent?.trackingConsentHeader&&mt(e.prefetchedConsent.trackingConsentHeader);const t=u(xt);super({observability:e.observability,shouldShowBanner:t}),this.#a=xt,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=vu(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 es(async()=>{if(!this.#u(i))throw new Lr(Ds);const{data:l,error:c}=await this.#e.mutate(ff,{variables:{input:r}});if(c)throw c;if(!l)throw new Dr("No data returned from mutation");return l},{shouldRetry:l=>this.#u(i)&&this.#y(l),maxAttempts:yf,initialRetryDelay:vf});if(!this.#u(i))return this.#h(t);const a=n.userPrivacySettingsSet.userErrors;if(a&&a.length>0){const l=a.map(c=>c.message).join("; ");return this.#_("set",new Dr(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,mt(this.#d)),t?.(null,!0),{success:!0}}catch(r){if(r instanceof Lr||!this.#u(i))return this.#h(t);const n=r,a=n.message??"Failed to set consent";return this.#_("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.#u(t))return;this.#c(e);const i=e?.trackingConsentHeader;this.#d=i??this.#p(),mt(this.#d)}onDispose(){this.#s()}#c(e){const t=_u(e);this.#a=t?.displayBanner??xt,this.#r.value=t?bu(t):xt,this.#n.value=t?Su(t):void 0}#u(e){return this.#t.user.shopAccountUuid.value===e}#h(e){return e?.({error:Ds},!1),{success:!1,error:Ds}}#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(),mt(this.#d))})}#p(){return this.#f()??(this.#a?Nr:bf)}#g(){return this.#f()??Nr}#f(){return this.#l&&Sf.has(this.#l)?_f:void 0}#y(e){return e instanceof $t?!0:e instanceof rt?hf.includes(e.response.status):!1}#v(e){if(e instanceof $t)return"network";if(e instanceof rt){const t=e.response.status;if(t>=400&&t<500)return"4xx";if(t>=500&&t<600)return"5xx"}return"other"}#b(e){if(e instanceof rt)return e.response.status}#_(e,t){const i=this.#v(t);this.observability.counter({name:Or,value:1,attributes:{operation:e,errorCategory:i}}),this.observability.log(Or,`Failed to ${e} shop user consent`,{error:t,errorCategory:i,statusCode:this.#b(t),isRetryable:this.#y(t)})}}class Ef extends uf{constructor(e){const t=e.shopPayIsActive&&e.useShopConsent?new Af({shopPayGraphql:e.shopPayGraphql,observability:e.observability,shopPay:e.shopPay,merchantTrackingConsent:e.merchantTrackingConsent,prefetchedConsent:e.prefetchedTrackingConsentHeader?{trackingConsentHeader:e.prefetchedTrackingConsentHeader}:void 0,countryCode:e.countryCode}):new gf({observability:e.observability});super(t)}}const Pf={logging:1,metrics:2,monorail:4,preact:8,graphqlTiming:16};function Cf(s){return Object.entries(Pf).reduce((e,[t,i])=>
66(e[t]=!!(s&i),e),{})}class Tf{constructor({serializations:e}){const{commitSha:t,debug:i,deployStage:r,previewBranch:n,services:a}=e.get("environment");this.commitSha=t??"unknown",this.debug=Cf(i??0),this.deployStage=r??"production",this.previewBranch=n,this.services={...Sn,...a}}}class kf{#e=new EventTarget;dispatchEvent(e){return this.#e.dispatchEvent(e)}addEventListener(e,t,i){this.#e.addEventListener(e,t,i)}}function wf(s){const e=s==="sim",t=typeof window<"u"&&window!==window.parent;return e&&t&&!ri()}const If=["_cmp_a","_tracking_consent","cart","discount_code","dynamic_checkout_shown_on_cart","remember_me","_shop_app_essential"],Rf=["channel","profile_preview_token","simulated_preview_token","previewCustomerType","embed_express_checkout",Jl];function Mf({searchParams:s,userAgent:e}){const t=s.get("embed");if(t)return t;const i=s.get(An);if(i){const r=[`version=${i}`],n=s.get(ec),a=s.get(En),o=s.get(Pn),d=s.get(Cn),l=ir(e)||tc(i)&&sc(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&&!ir(e)&&(r.push(`library=CheckoutKit/${o}`),r.push("platform=web"));let c="web";return e&&(c=ic.test(e)?"mobile":"web"),r.push(`platformcategory=${c}`),r.join(",")}}class Df 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 Lf(s){return s==null?!1:JSON.stringify(s)!=="{}"}function ra(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 Ls="FoundationGraphQL";class Of extends Zs{constructor(e){const{fetch:t,cache:i}=Nf(e);super(t,i)}}function Nf({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"),y=t.get("sourceToken")??"unknown",b=t.get("sourceType")??"unknown",m=t.get("universalCheckoutSessionId"),A=t.get("shopPayConfig"),f=t.get("serverHandling")??"",p=t.get("serverRender")??"no",_=new Map(l?Object.entries(l):[]),g={"Accept-Language":d,"X-Checkout-Web-Deploy-Stage":s.deployStage,"X-Checkout-Web-Build-Id":s.commitSha,"X-Checkout-Web-Source-Id":y,"X-Checkout-One-Session-Token":c,"X-Checkout-Web-Server-Handling":f,"X-Checkout-Web-Server-Rendering":p,"Shopify-Checkout-Source":`id="${y}", type="${b}"`};m&&(g["Shopify-Universal-Checkout-Source"]=`id="${m}", type="uc"`),h&&(g["Shopify-Session-Essential"]=`payload=${h}`);const E=new URLSearchParams(location.search),R=Mf({searchParams:E,userAgent:r});R&&(g["Shopify-Checkout-Embed"]=R),i&&(A?.callback_token&&(g["X-Shop-Pay-Token"]=A.callback_token),A?.tracking_visit&&A?.tracking_unique&&(g["X-Shopify-VisitToken"]=A.tracking_visit,g["X-Shopify-UniqueToken"]=A.tracking_unique),A?.tracking_consent&&!o?.enabledFlags?.includes(Tn)&&(g["X-Shopify-Tracking-Consent"]=A.tracking_consent));const P=new URLSearchParams(location.search),C=P.get("preview"),w=P.get("duration"),M=Object.fromEntries(Rf.map(I=>[I,P.get(I)]).filter(I=>I[1]!==null));C&&(g["Shopify-Checkout-Queue-Preview"]=C,w&&(g["Shopify-Checkout-Queue-Duration"]=w));const k=P.get("simulated_preview_token");return k&&wf(t.get("sourceType"))&&(g["X-Shopify-Editor-Access-Token"]=k),{fetch:Js({url:I=>new Df({shop:o,persisted:I.query.source==="",shopPay:i},location.href),method:I=>I.query.source!==""||I.query.type==="mutation"||Lf(I.variables)?"POST":"GET",source:I=>I.query.source!=="",headers(){const I={...g},L=n();L&&(I["X-Shopify-Tracking-Consent"]=L);const H=a?.();return H&&(I["Shopify-Checkout-Webmcp-Tool"]=H),I},credentials:"same-origin",explicitSearchParams:M,onResult({query:I,result:L,response:H,duration:B}){const{name:T}=I;L.error&&at(L.error,{observability:e,fileContext:Ls,queryName:T,documentId:I.id||void 0,requestId:H.headers.get("x-request-id")??void 0}),Br({observability:e,name:T,duration:B,response:H})},onError({query:I,error:L,response:H,duration:B}){const{name:T}=I;H?.status===400&&typeof document<"u"&&(e.leaveErrorBreadcrumb(`Clearing non-essential cookies due to GraphQLFetchHttpBadRequestError on ${Ls}:Query::${T}`,{totalCookies:document.cookie.split(";").length,totalSize:`${encodeURI(document.cookie).split(/%..|./).length-1} bytes`}),Bf()),at(L,{observability:e,fileContext:Ls,queryName:T,documentId:I.id||void 0}),Br({observability:e,name:T,duration:B,response:H}),H?.redirected&&location.replace(H.url)}}),cache:_}}function Br({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",...ra(i),pageLoadId:ai})}function Bf(){document.cookie.split(";
66").forEach(e=>{const t=e.split("=",2)[0].trim();If.includes(t)||(document.cookie=`${t} =; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`)})}const Os="ShopPayGraphQL";class Ff extends Zs{constructor(e){const{fetch:t,cache:i}=Uf(e);super(t,i)}}function Uf({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",y=new Map(d?Object.entries(d):[]),b={"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){b["X-ShopPay-Embedded-Request"]="true";const f=s.get("shop").id;if(f){const p=rc(f);p!=null&&!Number.isNaN(p)&&(b["X-ShopPay-Embedded-Request-Shop-Id"]=String(p))}}i.isExternal&&(b["X-Checkout-Web-Checkout-Version"]=nc.ShopPayExternal);const m=Js({url:o,headers(){const f={...b},p=n();if(p&&(f["X-Shopify-Tracking-Consent"]=p),i.shouldUseAccessToken){const _=i.accessToken.value;_&&(f.Authorization=`Bearer ${_}`)}return f},onResult({query:f,result:p,response:_,duration:g}){const{name:E}=f,{error:R}=p;A({name:E,duration:g,response:_});const P=_.headers.get("x-request-id");R&&!ac(R)?at(R,{observability:t,fileContext:Os,queryName:E}):t.leaveErrorBreadcrumb(`${Os}:Query::${E}`,{name:E,requestId:P,entrypoint:"shop-pay"})},onError({query:f,error:p,response:_,duration:g}){const{name:E}=f;at(p,{observability:t,fileContext:Os,queryName:E}),A({name:E,duration:g,response:_})}});function A({name:f,duration:p,response:_}){t.histogram({name:"shop_pay_response_timing_and_status",value:p,attributes:{queryName:f,status:_?.status??"noResponse"}}),t.log("shop_pay_checkout_graphql_fetch_finished",`[GraphQL][shoppay] ${f} request finished`,{queryName:f,duration:p,"attrs.http.response.status_code":_?.status??"noResponse",...ra(_)})}return{fetch:m,cache:y}}class xf extends Error{constructor(){super(...arguments),this.name="MissingGraphQLEndpointError"}}const Ns="ThrottleContextGraphQL";class Vf extends Zs{#e;constructor(e){const t={current:void 0};super(Hf(e,t)),this.#e=t}setPollUrl(e){this.#e.current=e}}function Hf({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 Js({url(){if(!i.current)throw new xf("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:y}=l,b=c.headers.get("x-request-id");y?at(y,{observability:e,fileContext:Ns,queryName:h}):e.leaveErrorBreadcrumb(`${Ns}:Query::${h}`,{name:h,requestId:b,entrypoint:"throttled"})},onError({query:d,error:l}){at(l,{observability:e,fileContext:Ns,queryName:d.name})}})}class Gf extends ho{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},po(r,e.translations))}}function qf(s=document.documentElement){const e=s.dir.toLowerCase();return e==="ltr"||e==="rtl"?e:void 0}class Wf extends Gf{constructor(e){super({...e,direction:e.direction??qf()})}}class zf 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 $f(){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 zf,s.ShopifyAnalytics=s.ShopifyAnalytics||{},s.ShopifyAnalytics.lib=s.ShopifyAnalytics.lib||s.trekkie}const Yf="d194d16e5af0f76897128b2df7483be8";function na(s){return s==="production"||s==="canary"||s==="tophat"}const jf="Unable to preload CSS for",Kf="Permission denied to access property",Xf=["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"],Qf=["The node to be removed is not a child of this node"],Zf=["Skipped ViewTransition due to another transition starting","Skipped ViewTransition due to document being hidden"],Jf=["before initialization","Cannot access uninitialized variable"],ey="is not supported in the CustomerPrivacyEventBus",ty="Failed to load web worker for pixel",sy=/\/(\w+(-\w+)*)$/;class iy extends Error{constructor(){super(...arguments),this.name="ParseGidError"}}function ry(s){const e=`/${s}`.match(sy);if(e?.[1]!==void 0)return e[1];throw new iy(`Invalid gid: ${s}`)}function ny({appType:s,locale:e,environment:t,serializations:i,onUnactionableError:r}){const n=t.deployStage;if(!na(n))return;const a=i.get("shop"),o=ry(a.id),d=i.get("requestId"),l=document.documentElement.lang??"zz",c=i.get("receipt"),h=i.get("serverHandling")??"unknown",y=i.get("serverRender")??"no",b=i.get("clientBundleInfo").browsers??"unknown",A=(i.get("experiments")??[]).reduce((g,{clientHandle:E,variant:R})=>(g[E]={clientHandle:E,variant:R??void 0},g),{}),_={global:{shop:{id:o,name:a.name,domain:a.myshopifyDomain,locale:l,enabledFlags:a.enabledFlags},experiments:A,request:{serializedRequestId:d},receipt:{status:c?.status??"unavailable"},custom:{serverHandling:h,serverRendering:y,browserGroup:b}},...{error_source:{shop_id:o},cgi_data:{REQUEST_ID:d},device:{deploy_phase:n}}};return ay({appType:s,appVersion:t.commitSha,locale:e,releaseStage:n,onError:oy({onUnactionableError:r,serverHandling:h,serverRendering:y,browserGroup:b}),metadata:_})}function ay({appType:s,appVersion:e,locale:t,releaseStage:i,metadata:r,onError:n}){const a=new mo({apiKey:Yf,appId:"checkout-web",appType:s,appVersion:e,userAgent:navigator.userAgent,locale:t,releaseStage:i,onError:n,plugins:[go,fo,yo,vo,_o],metadata:r});return bo(a),So(a),a}function oy({onUnactionableError:s,serverHandling:e,serverRendering:t,browserGroup:i}){return(r,n)=>{const a=cy(r,n);return a?(uy(r,n),hy(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 dy(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 ly(s){if(!(s instanceof Error))return;const e=s.cause;return e instanceof Error?e:void 0}function aa(s,e,t=new Set){return!(s instanceof Error)||t.has(s)?!1:(t.add(s),e(s)||aa(ly(s),e,t))}function cy(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()||aa(e,o=>o.name==="UnactionableNegotiationFailedError"&&o instanceof ve&&o.isUnactionable())||i==="BugsnagInvalidError"&&s.unhandled||oc(i))return!1;const n=t.stacktrace[0];if(n===void 0||Fi.includes(i))return!1;if(i==="ViewTransitionRenderError"&&e instanceof Error){const o=e.cause;if(o instanceof Error&&(Fi.includes(o.name)||o.name==="TypeError"&&o.message==="Cannot read properties of undefined (reading '__H')"))return!1}if(r&&Zf.some(o=>r.includes(o))||r&&r.includes(Kf)||r&&oi(r)||i==="TypeError"&&r&&io.some(o=>r.includes(o))||i==="TypeError"&&r==="Cannot read properties of undefined (reading '__H')"||r?.startsWith(jf)||r&&ro.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(ey)||r?.includes(ty)||i==="ReferenceError"&&r&&Jf.some(o=>r.includes(o))&&dc(navigator.userAgent)||ss(navigator.userAgent)||i==="SyntaxError"&&r&&Xf.includes(r)||i==="NotFoundError"&&r&&Qf.some(o=>r.includes(o)))return!1;if(i==="ExtensionSandboxUncaughtError")return!0;const a=n.file;return dy(a)}function uy(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 hy(s,e){e instanceof ve&&e.metadata&&Object.keys(e.metadata).length>0&&(s.metaData={...s.metaData,error:e.metadata})}async function py({shopId:s,isShopServerOrigin:e}){const{initSHS:t}=await D(async()=>{const{initSHS:r}=await import("./human-signals-index.DyM3MF1G.js");return{initSHS:r}},__vite__mapDeps([23,3])),i=Je(s);return t({exportWithFetch:!0,shopId:Number(i),...e?{beaconEndpoint:`${Sn.shopServer.url}/api/collect/${i}`}:{}})}const my=18e4;async function gy(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("checkoutLayout")==="one-page",{userAgent:h,initialRequest:y}=e,b=y.isServerRendered,m=y.isServerRendered,A={browserGroup:n?.browsers??"unknown",buildId:t.commitSha,checkoutExperience:c?"ONE_STEP":"THREE_STEP",renderer:o,targetPlatform:d,gcpRegion:l,serverHandling:a,serverRendered:b,clientHydrated:m,mobile:Oe(),browser:uc(h).name,os:cc(),checkoutProtocolVersion:$s(),...si(i)&&{entrypoint:lc}};(async()=>{try{await fy(s,A)}catch(f){r.error(f)}})()}async function fy({client:s,checkout:e,i18n:t,router:i,shop:r,shopPay:n,source:a,observability:o,userEvents:d},l){const c=await _y();if(!c)return;const{redirectDuration:h,timeToFirstByte:y,timeToLastByte:b,domContentLoaded:m,load:A,htmlDocumentSize:f,headerSize:p,encodedBodySize:_,dnsLookupTime:g,connectionDuration:E,tlsDuration:R,requestDuration:P,nextHopProtocol:C,navigationType:w}=c,M=Sy(),k={...l,step:hc(i.currentUrl.value,{isShopPayActive:e.identity.current.value==="shopPay",shopPay:n}),sourceType:a.type,browserConnectionType:navigator.connection?.effectiveType??"unknown",navigationType:w},O=e.identity.current.value==="shopPay"?"shop_pay":l.checkoutExperience
66==="ONE_STEP"?"c1_redesign":"c1_legacy",I=s.unstable_getSerialization("shopPayConfig"),L={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:ai,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:I?.tracking_unique??Kt({serialized:s.unstable_getSerialization("shopifyY"),expiration:s.unstable_getSerialization("shopifyYExpiration"),cookie:s.cookies.get("_shopify_y")})??void 0};function H({name:G,value:W,attributes:x}){o.histogram({name:G,value:W,attributes:x?{...k,...x}:k})}function B({eventName:G,eventValue:W,eventUnit:x="ms"}){d.monorailEvent({schemaId:"checkout_next_performance_metrics/1.3",payload:{...L,eventName:G,eventValue:W,eventUnit:x,frontendEventTimestampEpochMs:Date.now()}})}function T({name:G,value:W,unit:x,attributes:V}){const z=Math.round(W),X=ss(navigator.userAgent),$=!!s.cookies.get("cf_clearance");X||(H({name:G,value:z,attributes:{cf_challenge:$,...V}}),B({eventName:G.replace("new_performance_",""),eventValue:z.toString(),eventUnit:x}))}h&&T({name:"new_performance_redirect_duration",value:h}),g&&T({name:"new_performance_html_dns_lookup_duration",value:g}),E!==void 0&&T({name:"new_performance_html_connection_duration",value:E,attributes:{nextHopProtocol:C}}),R!==void 0&&T({name:"new_performance_html_tls_duration",value:R,attributes:{nextHopProtocol:C}}),P!==void 0&&T({name:"new_performance_html_request_duration",value:P,attributes:{nextHopProtocol:C}}),p&&T({name:"new_performance_html_headers_size",value:p,unit:"bytes"}),f&&T({name:"new_performance_html_body_size",value:f,unit:"bytes"}),_&&T({name:"new_performance_html_encoded_body_size",value:_,unit:"bytes"}),T({name:"new_performance_time_to_first_byte",value:y}),T({name:"new_performance_time_to_last_byte",value:b}),m>0&&T({name:"new_performance_dom_content_loaded",value:m}),A>0&&T({name:"new_performance_dom_load",value:A}),Re(),await Promise.all([xe(),Ve(),Y(),he()]);function Y(){return vy(k.step).then(G=>{G!==null&&T({name:"new_performance_checkout_wallet_time_to_interactive",value:G})})}async function xe(){if(typeof PerformanceObserver>"u"){setTimeout(()=>o.enableKeepAlive(),1e3);return}const G=await oa({name:"checkout:visible"});if(!G)return;T({name:"new_performance_checkout_visible",value:G.startTime}),T({name:"new_performance_ttlb_visible_delta",value:Math.max(0,G.startTime-b)});const[W,x]=await Promise.all([Fr({name:"checkout:before-hydrate"}),Fr({name:"checkout:hydrate"})]),V=x.startTime+x.duration,z=V-y,X=V-G.startTime;if(T({name:"new_performance_checkout_hydrated",value:V}),T({name:"new_performance_checkout_hydrate_duration",value:x.duration}),T({name:"new_performance_checkout_before_hydrate_duration",value:W.duration}),T({name:"new_performance_checkout_boot_duration",value:z}),X>=0&&T({name:"new_performance_checkout_inert_duration",value:X}),e.identity.current.value==="shopPay"){const $=G.startTime-V;$>0&&H({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 G=performance.getEntriesByType("resource"),W=[],x=[];for(const j of G)M.has(j.name)&&(j.name.includes(".css")?W.push(j):x.push(j));const V=Cy(x,b);V&&(k.checkoutLoadBottleneck=V.label);const z=[...W,...x],X=Ay(z);X&&T({name:"new_performance_critical_assets_estimated_bandwidth",value:X,unit:"mbps"});const $=xr(W);T({name:"new_performance_critical_css_count",value:$.count,unit:"count"}),T({name:"new_performance_critical_css_cached_count",value:$.cachedCount,unit:"count"}),T({name:"new_performance_critical_css_download_time",value:$.downloadTime}),$.size&&(T({name:"new_performance_critical_css_size",value:$.size,unit:"bytes"}),T({name:"new_performance_critical_css_size_uncompressed",value:$.uncompressedSize,unit:"bytes"}),T({name:"new_performance_critical_css_download_size",value:$.downloadSize,unit:"bytes"}));const Q=xr(x);T({name:"new_performance_critical_javascript_count",value:Q.count,unit:"count"}),T({name:"new_performance_critical_javascript_cached_count",value:Q.cachedCount,unit:"count"}),T({name:"new_performance_critical_javascript_download_time",value:Q.downloadTime}),Q.size&&(T({name:"new_performance_critical_javascript_size",value:Q.size,unit:"bytes"}),T({name:"new_performance_critical_javascript_size_uncompressed",value:Q.uncompressedSize,unit:"bytes"}),T({name:"new_performance_critical_javascript_download_size",value:Q.downloadSize,unit:"bytes"}));const ee=Hr(W),ae=Hr(x);T({name:"new_performance_critical_css_estimated_dcb_savings",value:ee.ms}),T({name:"new_performance_critical_css_dcb_bytes_saved",value:ee.dcbBytesSaved,unit:"bytes"}),T({name:"new_performance_critical_css_cached_dcb_bytes_saved",value:ee.cachedBytesSaved,unit:"bytes"}),T({name:"new_performance_critical_javascript_estimated_dcb_savings",value:ae.ms}),T({name:"new_performance_critical_javascript_dcb_bytes_saved",value:ae.dcbBytesSaved,unit:"bytes"}),T({name:"new_performance_critical_javascript_cached_dcb_bytes_saved",value:ae.cachedBytesSaved,unit:"bytes"});const oe=Gr(W),Se=Gr(x);oe>0&&T({name:"new_performance_critical_css_download_overlap",value:oe}),Se>0&&T({name:"new_performance_critical_javascript_download_overlap",value:Se}),V&&H({name:"new_performance_checkout_load_bottleneck_delta",value:Math.round(Math.abs(V.delta)),attributes:{checkoutLoadBottleneck:V.label}})}
66async function Ve(){if(typeof PerformancePaintTiming>"u"||typeof PerformanceObserver>"u")return;const{firstPaint:G,firstContentfulPaint:W}=await yy();T({name:"new_performance_time_to_first_paint",value:G.startTime}),T({name:"new_performance_time_to_first_contentful_paint",value:W.startTime})}function Re(){if(typeof PerformanceObserver>"u")return;const G=new PerformanceObserver(W=>{const x=Tt(W).filter(Pt("long-animation-frame"));for(const V of x)T({name:"new_performance_long_animation_frame_duration",value:V.duration,unit:"ms"})});Ct(G,{type:"long-animation-frame",buffered:!0})}async function he(){const G=new Promise(V=>{Ao(({value:z})=>{T({name:"new_performance_interaction_to_next_paint",value:z}),V()})}),W=new Promise(V=>{Eo(({entries:z})=>{const X=z[0];if(X===void 0)return;const $=z.reduce((ee,ae)=>ae.size>ee.size?ae:ee,X),{startTime:Q}=$;T({name:"new_performance_time_to_largest_contentful_paint",value:Q}),V()})}),x=new Promise(V=>{Po(({value:z})=>{T({name:"new_performance_cumulative_layout_shift",value:z,unit:"score"}),V()})});await Promise.all([G,W,x])}}function Pt(s){return e=>e?.entryType===s}async function yy(){return await new Promise(e=>{let t,i;const r=new PerformanceObserver(n=>{const a=Tt(n).filter(Pt("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}))});Ct(r,{type:"paint",buffered:!0})})}async function oa({name:s,timeoutMs:e}){return await new Promise(i=>{let r;const n=new PerformanceObserver(a=>{const o=Tt(a).filter(Pt("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)),Ct(n,{type:"mark",buffered:!0})})}async function vy(s){if(typeof PerformanceObserver>"u"||s!=="information")return null;const e=await oa({name:mc,timeoutMs:my});if(!e)return null;const[t]=performance.getEntriesByName(pc,"mark");if(!t)return null;const[i]=performance.getEntriesByName("checkout:visible","mark");return i?Math.max(0,e.startTime-i.startTime):null}async function Fr({name:s}){return await new Promise(t=>{const i=new PerformanceObserver(r=>{const n=Tt(r).filter(Pt("measure"));for(const a of n)a.name===s&&(t(a),i.disconnect())});Ct(i,{type:"measure",buffered:!0})})}function Ur(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 _y(){if(typeof PerformanceNavigationTiming>"u"||typeof PerformanceObserver>"u"){const s=performance.timeOrigin||Date.now()-performance.now(),e=await Ty();return{redirectDuration:e.redirectEnd-e.redirectStart,timeToFirstByte:e.responseStart-s,timeToLastByte:e.responseEnd-s,domContentLoaded:e.domContentLoadedEventStart-s,load:e.loadEventStart-s,...Ur(e)}}else{const s=await by();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,...Ur(s)}:void 0}}async function by(){return await new Promise(e=>{const t=new PerformanceObserver(i=>{const r=Tt(i).find(Pt("navigation"));t.disconnect(),e(r)});Ct(t,{type:"navigation",buffered:!0})})}function Ct(s,e){try{s.observe(e)}catch{}}function Tt(s){try{return s.getEntries()}catch{return[]}}function Sy(){const s=new Set;for(const e of document.querySelectorAll("link[data-checkout-critical]"))s.add(e.href);return s}function Ay(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 xr(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+=da(c)?1:0;return{count:i,size:r,uncompressedSize:n,downloadSize:a,downloadTime:Math.max(0,d-o),cachedCount:l}}const Ey="dcb-original-size",Py="dcb-size";function Vr(s){const e=s.match(/^(\d+)\s+bytes$/);return e?Number(e[1]):void 0}function Hr(s){let e=0,t=0,i=0;for(const r of s){const n=r,a=n.serverTiming?.find(c=>c.name===Ey);if(!a)continue;const o=da(r),d=Vr(a.description);if(d===void 0||d<=0)continue;let l;if(o){const c=n.serverTiming?.find(y=>y.name===Py);if(!c)continue;const h=Vr(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,y=d*h;e+=Math.max(0,y-c)}}return{ms:e,dcbBytesSaved:t,cachedBytesSaved:i}}function Gr(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 da(s){const{deliveryType:e}=s;return e!==void 0?e==="cache":s.nextHopProtocol===""&&window.safari?!0:s.transferSize===0}function Cy(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 Ty(){return document.readyState==="complete"?performance.timing:await new Promise(e=>{window.addEventListener("load",()=>e(performance.timing))})}const qr="{redacted}";function Zt(s){if(s===void 0)return;let e;try{e=new URL(s)}catch{return qr}const t=e.pathname.split("/").map(i=>i===""||/^[A-Za-z]+([-_][A-Za-z]+)*$/.test(i)?i:qr);return`${e.origin}${t.join("/")}`}const la="00000000-0000-0000-5000-000000000000",ky=["mismatch_cookie","mismatch_meta","all_mismatch"];function wy(s,e,t,i){const r=Ny(s,`_shopify_${e}`),n=r.delete(la),{value:a,disallowed:o}=Wr(t),{value:d,disallowed:l}=Wr(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:y(c.length)};function y(b){if(b<2)return"insufficient";const m=_=>_&&r.size?r.has(_):void 0,A=m(a),f=m(d),p=a&&d?a===d:void 0;return A!==!1&&f!==!1&&p!==!1?"all_match":!A&&f?"mismatch_meta":A&&!f?"mismatch_server_timing":p?"mismatch_cookie":"all_mismatch"}}const Iy=10;function Ry(s){try{if(typeof s!="number"||!Number.isFinite(s))return null;const e=(Date.now()-s)/1e3;return e<0?null:e>Iy}catch{return null}}function My(){try{const s=ci();if(s?.type!=="back_forward"||!("notRestoredReasons"in s))return null;const{notRestoredReasons:e}=s;return!!e}catch{return null}}function Dy(s,e,{isNewCookieStorageEnabled:t=!1,navigationType:i,isShopApp:r=!1,servedAt:n,shopifyYIsNewlyMinted:a,shopifySIsNewlyMinted:o}={}){try{const d=i??Uy(),l=Ry(n),c=My(),h=Vy(),y=r||xy(),b=e.serverTimingTokens??Fy(),m=e.cookieString??document.cookie,A=b.supported,f=A?b:void 0,p=Ly();for(const[_,g,E,R]of[["y",e.metaY,f?._y,a],["s",e.metaS,f?._s,o]])try{const P=y?Hy(_)??m:m,C=wy(P,_,g,E);s.counter({name:"tracking_token_parity",value:1,attributes:{...C,serverTimingSupported:A,isNewCookieStorageEnabled:t,navigationType:d,isShopApp:y,htmlStale:l,hasUrlTokens:h,isTrekkieCookie:Oy(P,_),bfCacheNotUsed:c,tokenMinted:R??null,...p}}),ky.includes(C.verdict)&&s.log("tracking_token_parity_mismatch","tracking token parity mismatch",{token:_,verdict:C.verdict,cookieValue:By(P,_),metaValue:g??"",href:Zt(window.location.href),...p})}catch{}}catch{}}function Ly(){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 ca(s){return s?.trim().toLowerCase()||void 0}function Wr(s){const e=ca(s);return e===la?{disallowed:!0}:{value:e,disallowed:!1}}function Oy(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 Ny(s,e){const t=new Set;for(const i of s.split(";")){const[r,...n]=i.split("=");if(r?.trim()===e){const a=ca(n.join("="));a&&t.add(a)}}return t}function By(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 ci(){return performance.getEntriesByType("navigation")[0]}function Fy(){const s=ci()?.serverTiming,e=t=>s?.find(i=>i.name===t)?.description;return{supported:s!==void 0,_y:e("_y"),_s:e("_s")}}function Uy(){return ci()?.type??"unknown"}function xy(){try{return document.URL.includes("://shop.app")}catch{return!1}}function Vy(){try{const{searchParams:s}=new URL(document.URL);return s.has("_y")||s.has("_s")}catch{return!1}}function Hy(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 Gy{#e;#t;#s;#i=rr(this.exportMetrics,500);#r=rr(this.exportLogs,500);#n;#a={};#o=new Set;#d=!1;constructor(e){this.#t=e.attributesForMetrics??{},this.#s=e.attributesForLogs??{},this.#e=new Co(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.#u("debug",e,t,i,r)}log(e,t,i,r){return this.#u("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:ri()}},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){Yr(()=>{const i=this.#l(t);this.#e[e]({...i,name:`CheckoutWeb_${i.name}`,attributes:{...this.#t,...i.attributes}}),i.exportImmediately?this.exportMetrics():this.#i()})}#u(e,t,i,r={},n={}){Yr(()=>{const a=this.#l(n),o={...this.#s,...r,...e==="debug"&&{level:e}};this.#e.log({attributes:{...Ks(o),message:i,name:t},requiresKeepalive:a.requiresKeepalive}),a.exportImmediately?this.exportLogs():this.#r()})}}const zr="[CYCLICAL]",qy=10;function $r(s){return s!==null&&typeof s=="object"&&s instanceof To}function Ks(s,e="",t=new WeakSet,i=0){return Object.entries(s).reduce((r,[n,a])=>{const o=e?`${e}.${n}`:n,d=$r(a)?a.value:a;if(d&&typeof d=="object"){if(i>=qy)return r[o]="[max depth exceeded]",r;if(t.has(d))return r[o]=zr,r;t.add(d),Array.isArray(d)?d.forEach((l,c)=>{const h=$r(l)?l.value:l;h&&typeof h=="object"?t.has(h)?r[`${o}.${c}`]=zr:(t.add(h),Object.assign(r,Ks(h,`${o}.${c}`,t,i+1))):r[`${o}.${c}`]=h}):Object.assign(r,Ks(d,o,t,i+1))}else r[o]=Number.isNaN(d)?"NaN":d;return r},{})}function Yr(s){setTimeout(()=>{s()},0)}const Wy="https://otlp-http-production.shopifysvc.com/v1/metrics",ua="checkout:cf-challenge";function zy(s){return s.type===ua&&"detail"in s}class $y extends Gy{#e;#t;#s=e=>{zy(e)&&this.counter({name:"cf_challenge_reload",value:1,attributes:{...e.detail},exportImmediately:!0,requiresKeepalive:!0})};
66constructor({client:e,environment:t,events:i,serializations:r,appType:n,locale:a,exporter:o,source:d}){const l=navigator.connection?.effectiveType??"unknown",c={appType:n,browserConnectionType:l,deployStage:t.deployStage},h={...c,...Yy({getCookie:m=>e.cookies.get(m),serializations:r,locale:a,source:d})},y={...c},b=o??new jy({publishToObserve:na(t.deployStage),environment:t,attributesForLogs:h,onExportError:m=>{m.errorType!=="logs"&&this.log("telemetry_export_error",`Failed to export ${m.errorType} to Observe`,{errorType:m.errorType,error:m.error instanceof Error?m.error.message:String(m.error),cause:m.cause,errorStack:m.error instanceof Error?m.error.stack:void 0,attributesSize:m.attributesSize,metrics:m.metrics},{exportImmediately:!0})}});super({bugsnag:ny({appType:n,locale:a,environment:t,serializations:r,onUnactionableError:m=>{this.counter({name:"unactionable_error",value:1,attributes:m})}}),exporter:b,attributesForMetrics:y,attributesForLogs:h}),this.#e=n,this.#t=r,window.addEventListener(ua,this.#s),i.addEventListener("bootloader:hydrate-start",m=>{m.waitUntil(this.#i(m))}),i.addEventListener("bootloader:hydrate-start-resolve",m=>{this.#r(m)}),i.addEventListener("bootloader:hydrate-end",m=>{m.waitUntil(this.#n(m))}),i.addEventListener("bootloader:hydrate-end-resolve",m=>{this.#a(m)})}attachEmbedContext(e){const t=e.getEmbedCheckoutType();if(t===gc.None)return;const i=ss(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;py({shopId:t.id,isShopServerOrigin:i.isShopServerOrigin}).catch(()=>{}),$f(),this.#e!=="shop-pay-external"&&Dy(this,{metaY:this.#t.get("shopifyY"),metaS:this.#t.get("shopifyS")},{isNewCookieStorageEnabled:this.#t.get("isNewCookieStorageEnabled"),isS
66hopApp:i.isShopServerOrigin,servedAt:this.#t.get("servedAt"),shopifyYIsNewlyMinted:this.#t.get("shopifyYIsNewlyMinted"),shopifySIsNewlyMinted:this.#t.get("shopifySIsNewlyMinted")})}#r(e){performance.measure("checkout:before-hydrate",{start:e.cause.bootStartTime,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 gy(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 Yy({getCookie:s,serializations:e,locale:t,source:i}){const r=e.get("apiClientId")??0,n=e.get("checkoutSessionIdentifier"),a=Oe(),o=e.get("requestId"),d=e.get("sessionToken"),l=e.get("shop"),c=fc(l?.id),h=l.myshopifyDomain,y=e.get("sourceToken"),b=navigator.userAgent,m=e.get("shopPayConfig").tracking_unique??Kt({serialized:e.get("shopifyY"),expiration:e.get("shopifyYExpiration"),cookie:s("_shopify_y")}),A=i?.type??"unknown";return{apiClientId:r,checkoutSessionIdentifier:n,locale:t,mobile:a,requestId:o,sessionToken:d,shopDomain:h,shopId:c,sourceToken:y,sourceType:A,userAgent:b,userToken:m}}class jy extends ko{#e;#t;#s;#i;#r;#n;constructor({publishToObserve:e,environment:t,attributesForLogs:i,onExportError:r}){super(Wy,"checkout-web",{retry:n=>es(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&&Ky(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=ha(a.attributes),d=Object.entries(o).filter(([h,y])=>!(h==="level"||h in this.#s&&this.#s[h]===y)),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 Ky(s){try{console.groupCollapsed(`Observe metrics to be emitted (${s.length}):`),s.forEach(e=>{const t=Xy(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(ha(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 Xy(s){return"exponentialHistogram"in s?s.exponentialHistogram.dataPoints.map(e=>({type:"Histogram",attributes:e.attributes,value:Bs(e.sum,3)})):"gauge"in s?s.gauge.dataPoints.map(e=>({type:"Gauge",attributes:e.attributes,value:Bs(e.asDouble,3)})):"sum"in s?s.sum.dataPoints.map(e=>({type:"Counter",attributes:e.attributes,value:Bs(e.asDouble,3)})):[{type:"Unknown",attributes:[],value:"N/A"}]}function ha(s){return s.reduce((e,t)=>
66{const i=Object.keys(t.value)[0];return e[t.key]=i===void 0?void 0:t.value[i],e},{})}function Bs(s,e){return s?`${parseFloat(s.toFixed(e))}`:"N/A"}class Qy extends Error{constructor(){super(...arguments),this.name="LocalStorageNotAvailableError"}}const Xs="__ui",Zy=100,Jy=["__pp","__edi","__sp"];function jr(s,e=Xs){try{return new Map(JSON.parse(s.getItem(e)??"[]"))}catch{return new Map}}class ev{#e=null;#t;constructor({storage:e}){if(typeof window>"u")throw new Qy("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:jr(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=jr(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(Xs))}removeLegacyIsolatedKeys(){if(this.#t!=null)for(const e of Jy)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(Xs,e)}catch(t){(t instanceof Error||t instanceof DOMException)&&yc(t)&&this.#t===localStorage&&(this.#t=sessionStorage,this.scheduleWrite())}},Zy))}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=>vc(Object.entries(i),Object.entries(e),{strict:!0}))}isStorageUsable(e){return _c(e).result===bc.Usable}}const tv=["_r","rctx","profile_preview_token",Ac,Ec,Pc,Cc,An,En,Pn,Cn,yn];class sv extends wo{#e;constructor({client:e,isShopPayActive:t,serverRenderedRoute:i,isSessionFinished:r=!1}){super(iv(e,i,r),{prefix:Sc(t)}),this.#e=rv(i),r||nv(this.currentUrl.value),this.beforeNavigate(av)}shouldHydrateServerRenderedRoute(){const{pathname:e,prefix:t}=this.currentUrl.value,i=this.#e;return i==null||t==null?!1:i===t||i===Jt(e)}}function iv(s,e,t){const i=new URL(s.initialRequest.url),r=e?.requestedPathname,n=e?.renderedPathname;return r?.startsWith("/")&&n?.startsWith("/")&&r!==n&&(t||Jt(i.pathname)===Jt(r))&&(i.pathname=n),i}function rv(s){const{requestedPathname:e,renderedPathname:t}=s??{};if(e?.startsWith("/")&&t?.startsWith("/"))return Jt(t)}function Jt(s){return s.replace(/\/$/,"")}function nv(s){window.location.href!==s.href&&window.history.replaceState(null,"",s.href)}function av(s,e){const t=new URL(window.location.href).searchParams;for(const i of tv){const r=t.get(i);r&&!e.searchParams.has(i)&&e.searchParams.set(i,r)}}function ov({route:s,isEmbedded:e,source:t,shop:i,checkout:r,shopPay:n,queryData:a,observability:o,userEvents:d,reconcileBuyerConsent:l}){if(!kn({route:s,isEmbedded:e,source:t,checkout:r,shopPay:n}))return{status:"skipped"};if(!dv(a))return{status:"skipped"};let c;try{c=th(a)}catch{return{status:"skipped"}}const h=r.proposal.negotiated.fields,y=Tc({managedByMarketsPro:h.managedByMarketsPro.value}),b=h.paymentMethods.value??[],m=ih({identity:r.identity,shopPay:n,negotiatedFields:h},{isApplePayAvailable:!1}).value,A=r.isPaymentRequired.value?kc(r.proposal.proposed.paymentLines.value):void 0,f=wc({proposedPaymentLines:r.proposal.proposed.paymentLines.value}),p=n.applyBuyerDetailsToCheckout(c,{checkout:r,observability:o,userEvents:d,shop:i,hydration:{negotiatedPaymentMethods:m,isApplePayAvailable:!1,immutableAddresses:r.addressManager.shipping.value.immutableAddresses.value.filter(({id:_})=>_!==J),proposedShippingAddress:r.proposal.proposed.shippingAddress.value,canUpdateDeliveryAddress:h.canUpdateDeliveryAddress.value??!0,mustSelectProvidedAddress:h.mustSelectProvidedAddress.value??!1,paymentRequiredMethod:A,negotiatedCardUuid:f},customerProfile:h.buyerIdentity.value?.customerProfile,paymentExemptionReason:r.paymentExemptionReason.value,idealEnabledForShopPay:y});return p.status==="card_vaulting_disabled"?{status:"failed",reason:"card_vaulting_disabled"}:(lv({hydrationResult:p.hydrationResult,negotiatedPaymentMethods:b,observability:o,checkout:r}),l?.(c),{status:"hydrated"})}function dv(s){return!!s?.checkoutSession?.user}function lv({hydrationResult:s,negotiatedPaymentMethods:e,observability:t,checkout:i}){const{selectedPaymentMethod:r}=s;if(!r)return;const n=Ic({paymentMethod:r,negotiatedPaymentMethods:e,observability:t});n!==void 0&&(i.proposal.proposed.paymentLines.value=Rc([n],i.proposal.proposed.paymentLines.value,e??[],{negotiatedPaymentLines:i.proposal.negotiated.fields.paymentLines.value?.lines,deferredTotal:i.proposal.negotiated.fields.deferredTotal.value,hasPayableDeposit:!!ni({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:ts(i.proposal.negotiated.fields.merchandiseLines.value?.lines).some(a=>a.sellingPlan?.isFixed),paymentTermsTemplateType:i.proposal.negotiated.fields.paymentFlexibilityPaymentTermsTemplate.value?.type}))}class cv{#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=Mc(r?.shopAppFontScale);this.config={version:n,darkMode:d,surface:o,fontScale:l},this.usingShopLayout=v(()=>this.#s())}#s(){return this.#t.enabled||Dc(this.#e.currentUrl.value.search)?!0:fn(this.config)}}class uv{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 hv{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=Hc(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(Gc),i},this.updateCreditCard=(t,i)=>{const r=this.#s.value;let n=!1;const a=r.map(o=>o.id!==t||!it(o)?o:(n=!0,ar({...o.paymentAttributes,...i})));n&&(this.#s.value=a)},this.removeCreditCard=t=>{const i=this.paymentMethods.value.filter(it).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.#u.value=t},this.unstable_setPhoneCountryCode=t=>{this.#h.value=t},this.hasFlag=t=>this.#m.value.has(t),this.getExperimentAssignment=t=>or(t,this.#p.value,this.hasFlag)??t.variants.control,this.isAssignedToExperiment=t=>or(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 uv,this.#e=u(void 0),this.flow=this.#e,this.hasFlow=v(()=>this.#e.value!=null),this.isAuthenticatedUser=v(()=>this.#e.value==="authenticated_user"),this.isUnauthenticatedUser=v(()=>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=v(()=>wn({vaultedPaymentMethods:this.#g(this.#s.value),paymentMethodHistory:this.#a.value,isApplePayAvailable:this.#r.value})),this.creditCards=v(()=>this.paymentMethods.value.filter(it).map(t=>t.paymentAttributes)),this.hasCreditCards=v(()=>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=v(()=>!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.#u=u(""),this.phoneNumber=this.#u,this.#h=u(void 0),this.phoneCountryCode=this.#h,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;#u;#h;#m;#p;#g(e){return this.#i.value.size===0?e:e.filter(t=>!it(t)||!this.#i.value.has(t.paymentAttributes.uuid))}}class pv{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 mv{constructor({paymentMethods:e}){this.unstable_promotePaymentMethod=t=>{const i=this.#c.value;i.some(r=>r.id===t.id)||(this.#c.value=[...i,t])},this.unstable_updateSelectedShippingAddress=t=>{this.#e.value=t},this.unstable_setServerSelectedPaymentMethodId=t=>{this.#t.value=t},this.unstable_setNegotiatedCardUuid=t=>{this.#s.value=t},this.selectPaymentMethod=t=>{this.#i.value={status:"selected",method:t}},this.clearPaymentMethod=()=>{this.#i.value={status:"cleared",derivedWhenCleared:this.derivedPaymentMethod.peek()}},this.unstable_updateSelectedBillingAddress=t=>{this.#r.value=t},this.unstable_updatePaymentMethodOption=t=>{this.#n.value=t},this.unstable_updateSecureData=t=>{this.#a.value=t},this.unstable_updateVerificationTrigger=t=>{this.#o.value=t},this.unstable_setInternalProgressing=t=>{this.#d.value=t},this.unstable_setHsaRequested=t=>{this.#l.value=t}
66,this.unstable_setLoading=t=>{this.#u.value=t},this.unstable_setIsUnverifiedEnrollment=t=>{this.#h.value=t},this.unstable_setButtonProgressing=t=>{this.#m.value=t},this.unstable_setShowSessionRevalidator=t=>{this.#p.value=t,t||(this.#g.value=void 0)},this.unstable_claimSessionRevalidator=t=>{const i=this.#g.peek();return i&&i!==t?!1:(this.#g.value=t,!0)},this.unstable_releaseSessionRevalidator=t=>{this.#g.peek()===t&&(this.#g.value=void 0)},this.unstable_setUnauthenticatedErrorModal=t=>{this.#f.value=t},this.unstable_setInitialization=t=>{this.#y.value=t},this.unstable_receiveBuyerDetailsResult=t=>{const i=this.#y.peek();if(i.status==="failed"&&i.reason==="cardVaultingDisabled")return{status:"handled"};const r=t?.status==="failed"?t:void 0,n=!t&&i.status!=="initialized";if(r||n){const a=r?.errors;return i.status==="failed"&&i.reason==="fetch"&&i.errors===a?{status:"handled"}:(this.unstable_setInitialization({status:"failed",reason:"fetch",errors:a}),{status:"handled"})}return t?.status!=="success"||i.status==="initialized"?{status:"handled"}:{status:"initialize",buyerDetails:t}},this.#e=u(void 0),this.#i=u({status:"unknown"}),this.#t=u(void 0),this.#s=u(void 0),this.derivedPaymentMethod=v(()=>In({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.#u=u(!1),this.#h=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.#u,this.isUnverifiedEnrollment=this.#h,this.showSessionRevalidator=this.#p,this.unauthenticatedErrorModal=this.#f,this.promotedPaymentMethods=this.#c,this.paymentMethodOption=this.#n,this.isInstallmentsSelected=v(()=>{const t=this.paymentMethodOption.value;return!!(t&&t.type==="wallet"&&t.name==="SHOPIFY_INSTALLMENTS")}),this.selectedBillingAddress=this.#r,this.selectedShippingAddress=this.#e,this.selectedPaymentMethod=v(()=>{const t=this.#i.value;if(t.status==="cleared"){const i=this.derivedPaymentMethod.value,r=t.derivedWhenCleared;return r&&i&&dr(i)===dr(r)?void 0:i}return t.status==="selected"&&(lr(t.method,e.value)||lr(t.method,this.#c.value))?t.method:this.derivedPaymentMethod.value}),this.serverSelectedPaymentMethodId=this.#t}#e;#t;#s;#i;#r;#n;#a;#o;#d;#l;#c;#u;#h;#m;#p;#g;#f;#y}class gv{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 fv{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:y=!0,cookies:b}){this.isExternal=!1,this.logoBrand="shop",this.shopCashExpectedEarnings=u(void 0),this.#n=u(void 0),this.updateUserVerification=p=>{this.#t.value=p},this.setUserIdentified=p=>{p===null?(this.#s.value=!1,this.#o.delete(Es)):(this.#s.value=!0,this.#o.set(Es,p))},this.setDeviceFingerprint=p=>{this.#i.value=p},this.setShopOfferReconciliationPending=p=>{this.#e.value=p},this.initializeFromBuyerDetails=(p,_)=>{const{flow:g,email:E,phone:R,phoneCountryCode:P,wallet:C,addresses:w,installmentsRejected:M,installmentsRetryable:k,preselectSpi:O,newUser:I,publicId:L,shopAccountUuid:H,enabledFlags:B,secureData:T,installmentsPrequalifiedAmount:Y,installmentCredential:xe,experiments:be,spiServiceAvailable:Ve}=p,{negotiatedPaymentMethods:Re,isApplePayAvailable:he,immutableAddresses:G,proposedShippingAddress:W,canUpdateDeliveryAddress:x,mustSelectProvidedAddress:V,paymentRequiredMethod:z,negotiatedCardUuid:X}=_,{userStoredPaymentMethods:$,paymentMethodHistory:Q,selectedPaymentMethod:ee,expiredCardPreselectPrevented:ae}=Kr({buyerDetails:p,negotiatedPaymentMethods:Re,isApplePayAvailable:he,negotiatedCardUuid:X,currentSelectedPaymentMethod:this.session.selectedPaymentMethod.value}),oe=B.includes(cu),Se=he&&Q.some(Ae=>Lc(Ae)&&!!Ae.lastUsedAt),j=$.some(zs)||Se;if(oe&&!j)return this.session.unstable_setInitialization({status:"failed",reason:"cardVaultingDisabled"}),{status:"card_vaulting_disabled"};const{selectedShippingAddress:He,selectedBillingAddress:te}=yv({shopPay:this,addressesForUI:w,immutableAddresses:G,proposedShippingAddress:W,canUpdateDeliveryAddress:x,mustSelectProvidedAddress:V,selectedPaymentMethod:ee}),K=vv(p.selectedPaymentMethodOption);return Xe(()=>{this.user.unstable_updateFlow(g),this.user.unstable_setPhoneNumber(R),this.user.unstable_setPhoneCountryCode(P),this.user.unstable_setPaymentMethodsFromBuyerDetails($),this.user.unstable_setPaymentMethodHistory(Q),this.user.unstable_setApplePayAvailable(he),this.session.unstable_setServerSelectedPaymentMethodId(p.selectedPaymentMethodId??void 0),this.session.unstable_setIsUnverifiedEnrollment(!!p.isUnverifiedEnrollment),this.session.unstable_setNegotiatedCardUuid(X),this.user.unstable_setWallet(C),this.user.unstable_setAddresses(w),this.user.unstable_setEnabledFlags(B),this.user.unstable_setExperiments(be);const Ae=this.user.getExperimentAssignment(nr)===nr.variants.treatment,Ee=this.session.paymentMethodOption.value,de=Ae&&Ee?.type==="wallet"&&Ee.name==="SHOPIFY_INSTALLMENTS"?void 0:Ee,Ge=Ae&&K?.type==="wallet"&&K.name==="SHOPIFY_INSTALLMENTS"?void 0:K;this.session.unstable_updatePaymentMethodOption(Ge||de||{type:"wallet",name:"SHOP_PAY"}),this.user.installments.unstable_setRejected(M),this.user.installments.unstable_setRetryable(k),this.user.installments.unstable_setPreselectReason(O),this.user.unstable_updateIsNew(I),this.user.unstable_updatePublicId(L),this.user.unstable_setEmail(E),this.user.unstable_setShopAccountUuid(H),this.session.unstable_updateSecureData(T),this.user.installments.unstable_updatePrequalifiedAmount(Y),this.user.installments.unstable_updateCredential(xe),this.installments.unstable_setServiceAvailable(Ve),g!=="authenticated_user"&&this.signup.unstable_setPhoneNumber(""),this.session.unstable_updateSelectedShippingAddress(He),this.session.unstable_updateSelectedBillingAddress(te),ee&&!zs(ee)&&this.session.unstable_promotePaymentMethod(ee),this.session.unstable_setLoading(!1),this.session.unstable_setInitialization({status:"initialized"})}),{status:"hydrated",userStoredPaymentMethods:$,selectedShippingAddress:He,selectedBillingAddress:te,selectedPaymentMethod:ee,expiredCardPreselectPrevented:ae}},this.updatePaymentMethodsFromBuyerDetails=(p,_)=>{const{userStoredPaymentMethods:g,paymentMethodHistory:E}=Kr({buyerDetails:p,..._,isApplePayAvailable:this.user.isApplePayAvailable.value,currentSelectedPaymentMethod:this.session.selectedPaymentMethod.value});return Xe(()=>{this.user.unstable_setPaymentMethodsFromBuyerDetails(g),this.user.unstable_setPaymentMethodHistory(E),this.session.unstable_setServerSelectedPaymentMethodId(p.selectedPaymentMethodId??void 0)}),{userStoredPaymentMethods:g}},this.deriveInitialProposalPatch=p=>{const{buyerDetails:_,customerProfile:g,hydrationResult:E,paymentRequiredMethod:R,paymentExemptionReason:P,idealEnabledForShopPay:C}=p,{email:w,phone:M}=_,{selectedShippingAddress:k,selectedBillingAddress:O,selectedPaymentMethod:I}=E,L=Nc({paymentRequiredMethod:R,isIdealEnabledForShopPay:C}),H={email:void 0,phone:void 0};g?.email&&w!==g.email?H.email=g.email:!g?.email&&g?.phone?(H.email="",H.phone=g.phone):w&&(H.email=w);const B={};if(k&&(B.shippingAddress=k.address),O&&(L&&(B.billingAddress=O.address),P&&(B.billingAddress=O.address)),I)if(it(I)){const T=I.paymentAttributes.billingAddress?.address;!L&&T&&(B.billingAddress=T)}else O&&(B.billingAddress=O.address);return B.fallbackPhoneNumber=M,{contact:H,updateAddressOptions:B}},this.applyBuyerDetailsToCheckout=(p,{checkout:_,observability:g,userEvents:E,shop:R,hydration:P,customerProfile:C,paymentExemptionReason:w,idealEnabledForShopPay:M})=>{const k=this.initializeFromBuyerDetails(p,P);
66if(k.status==="card_vaulting_disabled")return{status:"card_vaulting_disabled"};const O=this.deriveInitialProposalPatch({buyerDetails:p,customerProfile:C,hydrationResult:k,paymentRequiredMethod:P.paymentRequiredMethod,paymentExemptionReason:w,idealEnabledForShopPay:M});O.contact.email!==void 0&&(_.proposal.proposed.email.value=O.contact.email),O.contact.phone!==void 0&&(_.proposal.proposed.phone.value=O.contact.phone),k.selectedPaymentMethod&&k.expiredCardPreselectPrevented&&E.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.1",payload:{...ke(this.#a,_,R),action:"expired_card_preselect_prevented"}});const I=rh({checkout:_,shopPay:this,observability:g,buyerAddresses:p.addresses,...O.updateAddressOptions});return{status:"applied",hydrationResult:k,appliedAddresses:I}},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=b,this.#d=h,this.#l=y;const m=this.#o.get(Es),A=!!(i.checkoutSessionIdentifier&&m===escape(i.checkoutSessionIdentifier));this.#s=u(A),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 cv({serializations:n,router:a,mobileCheckoutSdk:o}),this.user=new hv,this.installments=new pv,this.session=new mv({paymentMethods:this.user.paymentMethods}),this.signup=new gv,this.progressInterceptor=new nh;const f=n.get("shopPayConfig");Oc(e.initialRequest.url)&&this.signup.unstable_setSkipAutomaticLoginAttempt(!0),this.config={webUrl:f.web_url??void 0,isFromClassic:!!f.from_classic,redirectSource:f.redirect_source,isReferral:f.is_referral,shouldPreSelectInstallments:f.pre_select_installments,checkoutAsGuestUrl:f.checkout_as_guest_url??void 0,redirectUrl:f.redirect_url,transactionParams:f.transaction_params,checkoutProfileContext:f.checkout_profile_context,profilePreviewToken:f.profile_preview_token,universalRedirect:{isEnabled:f.universal_redirect_enabled,isIndicator:f.universal_redirect_indicator},tokens:{authorization:f.authorization,callback:f.callback_token,iframe:f.iframe_token},tracking:{visit:f.tracking_visit,unique:f.tracking_unique,consent:f.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_sdk",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 Kr({buyerDetails:s,negotiatedPaymentMethods:e,isApplePayAvailable:t,currentSelectedPaymentMethod:i,negotiatedCardUuid:r}){const{creditCards:n,paymentMethods:a}=s,o=Bc(a,e),d=Fc(o,n),l=Uc(a),c=wn({vaultedPaymentMethods:d,paymentMethodHistory:l,isApplePayAvailable:t}),{selectedPaymentMethod:h,expiredCardPreselectPrevented:y}=In({userStoredPaymentMethods:c,serverSelectedPaymentMethodId:s.selectedPaymentMethodId,currentSelectedPaymentMethod:i,negotiatedCardUuid:r});return{userStoredPaymentMethods:d,paymentMethodHistory:l,selectedPaymentMethod:h,expiredCardPreselectPrevented:y}}function yv({shopPay:s,addressesForUI:e,immutableAddresses:t,proposedShippingAddress:i,canUpdateDeliveryAddress:r,mustSelectProvidedAddress:n,selectedPaymentMethod:a}){const o=ii(i,gn),d=o?null:t?.find(({address:P})=>ue(P,i))?.id,l=!o&&d?gt(i,d):void 0,h=xc({proposedAddress:i,buyerAddresses:e})?ei(e):null,y=t?[...e,...t.map(({address:P,id:C})=>gt(P,C))]:e,b=P=>y.find(C=>C.id===P),m=n?t.map(({address:P,id:C})=>gt(P,C)):y,A=o?void 0:m.find(P=>ue(P.address,i,["phone"]))?.id,f=A?b(A)||b(J):null,p=Vc({selectedPaymentMethod:a,addressesForUI:e,proposedShippingAddressId:A}),g=(n?[f,l]:[f,l,h]).find(P=>ot(P,s));return{selectedShippingAddress:(r||n)&&g?g:void 0,selectedBillingAddress:p||h||void 0}}function vv(s){if(s==="SHOPIFY_INSTALLMENTS")return{type:"wallet",name:"SHOPIFY_INSTALLMENTS"};if(s==="SHOP_PAY")return{type:"wallet",name:"SHOP_PAY"}}const _v="stored-session-token";class bv extends fv{#e;#t;#s;constructor({persistence:e,...t}){super(t),this.#e=e,this.#t={scope:{shopPaySessionTokenKey:qc(t.client.initialRequest.url)}};const i=t.serializations.get("paySessionToken"),r=i===_v?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);
66n!==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 Sv({shopPayGraphql:s,...e}){if(!kn(e))return{status:"skipped"};const t={checkoutContextInput:{checkoutVersion:Ue({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(sh,t));return ov({...e,queryData:i})}function Av({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 Ev{#e;constructor(e,t,i,r,n,a,o=[]){if(t==null)throw new st("Checkout context data is missing",{groupingHash:"SettingsCreateError::CheckoutContextDataMissing"});const{shop:d,cardsinkUrl:l,configurationPreviewContext:c,globalCheckoutUiExtensions:h}=t;if(d==null)throw new st("Shop details are missing",{groupingHash:"SettingsCreateError::ShopDetailsMissing"});if(i==null)throw new st("Request info data is missing",{groupingHash:"SettingsCreateError::RequestInfoDataMissing"});if(i.shop==null)throw new st("Request info data shop details are missing",{groupingHash:"SettingsCreateError::RequestInfoDataShopDetailsMissing"});const{shopConfigurations:y}=d,{defaultConfiguration:b,countrySpecificConfigurations:m}=y,A={};for(const{countries:f,configuration:p}of m){const _={contactInfoOptions:p.contactInfoOptions,addressFormSettings:p.addressFormSettings,phoneMarketingDisclosure:p.phoneMarketingDisclosure??null};for(const g of f)A[g]=_}this.id=d.id,this.allowExtensionDevelopment=d.allowExtensionDevelopment,this.extendedExtensionTimeout=d.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(f=>f.targetType==="EXTERNAL"&&f.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=b.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=Pv(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=b.contactInfoOptions,this.translations=JSON.parse(d.translations),this.addressFormSettings=b.addressFormSettings,this.billingAddressFormSettings=d.billingAddressFormSettings,this.countrySpecific=A,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 Pv(s){const e=new Map;for(const[t,i]of Object.entries(s)){if(typeof i=="number"&&i in cr){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 cr)&&e.set(t,{type:"regional",regions:new Map(r)})}return e}class Cv{constructor(e){const t=e.session?wv(e.session):kv(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 Tv(s){return s==="SHARED"||s==="CART"}function kv({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 wv({checkoutSessionIdentifier:s,sessionType:e,sourceId:t,sourceVersion:i,previewScript:r,cartReturnUrl:n,headerLogoUrl:a,isAbandonedCheckoutSupported:o}){const d=o??!1;if(Tv(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 Iv(s){s instanceof Error&&(s._handledByErrorBoundary=!0)}function Rv(s){return s instanceof rt&&s.response.status===415}function Mv(s){return s==null||typeof s!="object"||!(s instanceof rt)?!1:s.response.redirected}function Xr(s){return pa(s,new Set)}function pa(s,e){return s==null||typeof s!="object"&&typeof s!="function"||e.has(s)?!1:(e.add(s),s instanceof rt&&(s.response.status===429||s.response.status===430)||s instanceof Error&&pa(s.cause,e))}function Dv(){const s=navigator.userAgent.toLowerCase();return s.includes("firefox")&&!s.includes("seamonkey")}function Lv(s){return Dv()&&s instanceof $t?s.message.includes("NetworkError when attempting to fetch resource"):!1}function Ov(s){return!(s instanceof Wc)&&!(s instanceof $t)&&!Rv(s)&&!(s instanceof Rn)&&!oi(s.message)}class Nv extends Error{constructor(){super(...arguments),this.name="TerminalErrorPageRenderError"}}class Bv{#e;#t;#s;#i=ss(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=ah(),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=Mv(e);if(Ov(e)){const n=no(e);this.#e.error(e,{severity:"error",metadata:{userImpact:{terminalErrorPageDisplayed:!i},...n?{primitiveValueRender:n}:{}}}),t&&Iv(e),console.error(e)}if(i||Lv(e))return;try{await this.#t(e)}catch(n){const a=n instanceof Error?n:void 0;this.#e.error(new Nv(a?.message??String(n),{cause:a}),{severity:"warning"})}!!$s()?e instanceof zc?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:Xr(t)}})}#d({reason:e,error:t}){const i=$s();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:Xr(t)}}),this.#l({reason:e})}#l({reason:e}){const t={handlerId:"error",body:[{flowType:"undefined",group:"unrecoverable",code:"sdk_not_enabled",reason:e}]};$c(this.#e,t),oh(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 Fv extends Error{constructor(e){super(e),this.name="UrlError"}}class Uv{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 Fv("Invalid URL options provided");this.locale=e,this.servicesBaseUrl=Qr(r),this.shop=t,this.environment=i,this.storefrontBaseUrl=Qr(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 St.AmazonPay:t=this.shop.sandboxUrl.wallets.amazonPay??"";break;case St.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}${Zr(e)}`}sandboxUrl(e){return`${this.servicesBaseUrl}sandbox/${Zr(e)}`}}function Qr(s){return s.endsWith("/")?s:`${s}/`}function Zr(s){return s.startsWith("/")?s.slice(1):s}const ma="shopify.advertising.incentives.IncentivePresentedEvent";class Jr extends Error{constructor(){super(...arguments),this.name="UnknownEventSeverityError"}}function xv({proto:s,event:e,context:t,consentManager:i,surface:r,uniqueToken:n,visitToken:a,apiClientId:o,timestamp:d,messageId:l,browser:c}){const h=Hv(i),{source:y,dataOriginator:b}=Wv(r);return s.createEnvelope({source:y,severity:qv(e),eventClass:"EVENT_CLASS_EVENT",dataOriginator:b,client:{message:{id:l,createdAt:d},...c&&{browser:{...c,referrer:Zt(c.referrer),href:Zt(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:zv(r),...a&&{session:{clientSessionToken:a}},...o&&{apiClient:{id:{lowid:String(o)}}}},Vv(s,e,t,r))}function Vv(s,e,t,i){switch(e.eventTypeName){case"shopify.apps.app_runtime.AppRuntimeClientEvent":{const r=Gv(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:Zt(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 ma: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 Hv(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 Gv(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 qv(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 Jr("Unknown app runtime event type")}case"shopify.event.BuyerEvent":case ma:return"EVENT_SEVERITY_EVENT";default:throw new Jr(`Unknown eventTypeName: ${s.eventTypeName}`)}}function Wv(s){return s==="shop_pay"?{source:"EVENT_APP_SHOP_PAY",dataOriginator:"DATA_ORIGINATOR_SHOPIFY"}:{source:"EVENT_APP_STOREFRONT",dataOriginator:"DATA_ORIGINATOR_MERCHANT"}}function zv(s){return[{key:"client_surface",value:{string:"checkout-web"}},{key:"client_surface_variant",value:{string:s==="shop_pay"?"shop-pay":"storefront"}}]}function $v(){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 Yv=2e3,Fs=100;class en extends ve{constructor(){super(...arguments),this.name="EventRefineryImportError"}}class jv extends ve{constructor(){super(...arguments),this.name="EventRefineryError"}}const Kv=new Set(["Failed to fetch","Load failed","NetworkError when attempting to fetch resource.","Network request failed"]),Xv=new Set(["BreadcrumbsPluginFetchError","AbortError","TimeoutError"]),Qv=["Importing a module script failed","Failed to fetch dynamically imported module","error loading dynamically imported module","Cannot load script due to integrity mismatch"];function Zv(s){return typeof s!="string"?!1:Kv.has(s)||Qv.some(e=>s.includes(e))}const Jv=5;function ga(s,e=0){if(s==null||typeof s!="object")return!1;const{name:t,message:i,cause:r}=s;return typeof t=="string"&&Xv.has(t)||Zv(i)?!0:e<Jv&&ga(r,e+1)}function e_(s){const e=s?.name;return typeof e=="string"?e:"unknown"}function t_(){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 s_(s){return s instanceof Error&&s.name==="ProtoTransportError"&&typeof s.phase=="string"&&typeof s.details=="object"&&s.details!==null}class i_{#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=v(()=>t.analyticsProcessingAllowed.value||t.marketingAllowed.value||t.preferencesProcessingAllowed.value),this.#a=i,this.#o=r,this.#d=n,this.#l=a,this.#m(),this.#h()}flush(){try{this.#t&&(this.#g(),this.#t.flush())}catch(e){this.#u(e)}}emit(e){try{if(e.error)throw e.error;const t=new Date().toISOString(),i=$v();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.#u(t)}}#u(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:t_(),...s_(e)&&{protoTransport:{phase:e.phase,...e.details}}},n=e instanceof en;if(ga(e)){this.#s.log("event_refinery_transient_failure",t,{...r,errorName:e_(e)});return}this.#s.error(n?e:new jv(t,{cause:e}),{severity:"warning",metadata:r})}#h(){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:Yv}):setTimeout(()=>t(),0)});const{createProtoHub:e}=await D(async()=>{const{createProtoHub:t}=await import("./client.DRetCTka.js");return{createProtoHub:t}},__vite__mapDeps([24,25]));this.#t=e(),this.#g()}catch(e){this.#u(new en(String(e),{cause:e})),this.#n=void 0}}
66#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=xv({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.#u(o)})}catch(r){this.#u(r)}}}class r_{constructor(e){this.do=async(t,i)=>{const r=await i(t);if(this.#e.monorail&&r.status!==0)try{n_(t)}catch{}return r},this.#e=e}#e}function n_(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 a_ extends Io{#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 tn(this.version||"unknown")}getRequiredConsentForEmission(){if(this.version==="v1")return["anal
66ytics","marketing"];throw new tn(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 tn extends Error{constructor(e){super(`Unsupported consent version: ${e}`),this.name="CheckoutConsentProviderVersionError"}}function o_(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:d_(i.userAgent)?"mobile":"desktop",frontendEventTimestampEpochMs:Date.now(),frontendEventTimeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,locale:r.locale,pageLoadId:ai,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 d_(s){return/iPhone|iPad|iPod|Android/i.test(s)}const l_="wallet_prefilled_guest_checkout_impression",c_="wallet-prefilled-guest-arrival:",u_=new Set(["/","/information","/shipping","/payment","/review"]);class h_{#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=`${c_}${e}`;if(i.getItem(r)!==null)return!1;i.setItem(r,"1")}catch{}return!0}}const p_=new h_;function m_(s,e=p_){const t=s.client.initialRequest.url;if(!t.searchParams.has(Yc))return;const i=jc(t);s.events.addEventListener("bootloader:hydrate-end",()=>{__();const r=s.source.checkoutSessionIdentifier;if(!r||!g_(f_(s,i)))return;const n=s.consentManager.analyticsProcessingAllowed.value||s.consentManager.marketingAllowed.value;e.claim(r,n)&&s.userEvents.monorailEvent(v_(s,r))},{once:!0})}function g_({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&&u_.has(a)&&r==="guest"&&!t&&s&&e&&h}function f_(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:y_(t.proposal.negotiated.fields.deliveryNext.value),shippingRequired:t.isShippingRequired.value,sourceIsMerchantGuestReturn:Qc(n.type),trackingEnabled:r.hasFlagEnabled(Xc)}}function y_(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 v_(s,e){return{schemaId:"checkout_c1_interaction_and_impression_events/2.25",payload:{...o_(s,e),eventName:l_,eventType:"impression",eventValue:"shop_pay",impressionFeatures:["client_marker_approximate"]}}}function __(){try{const s=new URL(window.location.href);Kc(s),window.history.replaceState(window.history.state,"",s)}catch{}}const b_=m_,S_=10;class A_{#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=E_(e,t);a&&n.push(a),n.push(new r_(i.debug)),this.#t=xi.createHttpProducer({production:!0,middleware:n}),this.#s=xi.createHttpProducer({production:!0,options:{keepalive:!0},middleware:n}),this.#i=new i_(e,t,r),window.addEventListener("pagehide",this.#o,{capture:!0})}monorailEvent(e,t){if(t?.exportImmediately){this.#d(e);return}const i=sn(e);this.#r.push(i),this.#l()}async#d(e){const t=sn(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 Vi?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 Vi&&this.#n<S_?(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)}}
66function E_(s,e){try{const t=new a_({version:"v1",consentManager:e});return new Ro({provider:t})}catch{return s.error(new P_("Could not build consent tracking middleware")),null}}function sn(s){return{...s,metadata:{eventCreatedAtMs:Date.now()}}}class P_ extends Error{constructor(){super(...arguments),this.name="FailedToBuildMonorailMiddlewareError"}}const C_={checkout:!0,cartNext:!0,buyItNow:!0,abandonedCart:!0,draftOrder:!1,orderEdit:!1,paymentCollection:!1,simulated:!1,shopPayExternal:!1,other:!1};function T_({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,y=s.proposal.negotiated.fields.remoteMerchandiseDetails.value,b=t!=null&&(C_[t.type]===!0||o&&t.type==="other"&&["co","cn","bin","ac"].includes(n.get("sourceType")??""));if(!e.hasFlagEnabled(Zc))return"flag_disabled";if(!d)return"boot_data_unresolved";if(!b)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&&y==null)return"merchandise_unresolved";if(y?.stableIdToShopId.size)return"multi_shop_merchandise"}function Q_({identity:s}){return s.current.value!=="shopPay"}function k_(s,{unregisterInitializingTool:e,...t}){const i=w_();if(!i){e?.();return}const r=I_(i)?T_(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 D_(i,s,e)}function w_(){try{return typeof document>"u"?void 0:document.modelContext??void 0}catch{return}}function I_(s){try{return typeof s.registerTool=="function"}catch{return!1}}function fa(){const s=Symbol.for("shopify.checkout.webMcp.initializingTool");return s in window?window[s]:void 0}function Vt(){try{const s=fa();s&&typeof s=="object"&&"unregister"in s&&typeof s.unregister=="function"&&Promise.resolve(s.unregister()).catch(()=>{})}catch{}}class R_ extends Error{constructor(){super(...arguments),this.name="WebMcpInitializationError"}}function M_({observability:s}){try{const e=fa();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 R_(String(t.error)),{severity:"warning"})}).catch(()=>{})}catch{}}class D_{#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(Jc)?t.addEventListener("bootloader:hydrate-start",()=>this.#g(),{once:!0,signal:this.signal}):t.addEventListener("bootloader:hydrate-end",()=>this.#m(),{once:!0,signal:this.signal})}#u;unstable_provideFulfillmentController(e){return this.signal.aborted?()=>{}:(this.#u=e,()=>{this.#u===e&&(this.#u=void 0)})}#h;unstable_provideStoreCreditController(e){return this.signal.aborted?()=>{}:(this.#h=e,()=>{this.#h===e&&(this.#h=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.#u=void 0,this.#h=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||es(()=>D(()=>import("./web-mcp-runtime.CGES2-3O.js").then(e=>e.w),__vite__mapDeps([26,3,2,4,5,6,22,21,19,20,11]))).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.#u,markToolCallStarted:()=>{this.#t.value=!0},getStoreCreditProvider:()=>this.#h})}).catch(e=>{this.#s.observability.error(e,{severity:"warning"})})}}function L_(s,e){return s.unstable_getSerialization("experiments")?.some(t=>t.clientHandle===e&&t.variant==="treatment")??!1}
66class O_ extends Error{constructor(){super(...arguments),this.name="EmbedModuleLoadError"}}async function N_({rootElement:s,onTerminalError:e,eagerAppMetafieldsExperiment:t}){let i,r;try{const n=new kf,a=document.documentElement.lang,o=new df,d=o.get("trackingConsent");d&&mt(d);const l=new rf({rootElement:s,serializations:o});l.prepare();const{initialRequest:{url:c}}=l,h=new Tf({serializations:o}),y=Av({client:l,environment:h}),b=Mo(c,{isShopPayActive:y,isShopPayExternal:!1}),m=new $y({client:l,events:n,appType:o.get("checkoutLayout"),environment:h,serializations:o,locale:a,source:b?.source});M_({observability:m});const A=F=>{const ie=new O_(F instanceof Error?F.message:String(F));F instanceof Error&&(ie.cause=F),m.error(ie,{severity:"warning"})},f=eu(c)?D(()=>import("./embed-browser.CEXD5vfZ.js").then(F=>F.d),__vite__mapDeps([27,3,28,2,4,5,6,29])).catch(F=>(A(F),null)):null;f&&f.then(F=>F?.preloadEmbedClient(tu(c))).catch(A);const p=new Bv({events:n,serializations:o,observability:m,onError:F=>(Vt(),r?.(),e(F))});i={client:l,observability:m,terminalErrorHandler:p};const _=new sv({client:l,isShopPayActive:y,serverRenderedRoute:o.get("serverRenderedRoute"),isSessionFinished:o.get("sessionFinished")});let g;const E=o.get("shop")?.enabledFlags?.includes(Tn)??!1,R=E?o.get("userPrivacySettings")?.trackingConsentHeader??void 0:void 0,P=()=>{if(E)return g?g.trackingConsentHeader:R};let C;const w=()=>C?.activeTool?.current,M=new Of({environment:h,serializations:o,observability:m,isShopPayActive:y,userAgent:l.userAgent,getTrackingConsentHeader:P,getWebMcpToolName:w}),k=o.get("receipt"),O=o.get("sessionFinished");Jg({serializedReceipt:k,sessionFinished:O});const I=(O??!0)||!!(k?.exists&&k?.inProgress&&k?.status!=="action_required"),[{data:L,error:H},{data:B,error:T},{data:Y,error:xe},{data:be,error:Ve},{data:Re,error:he},{data:G,error:W}]=await Promise.all([M.staticQuery(uh,{variables:{queryString:c.searchParams.toString()}}),M.staticQuery(su,{skip:I,variables:{checkpointData:o.get("checkpointData")??null,queueToken:o.get("queueToken")??null}}),M.staticQuery(lh),M.staticQuery(hh),M.staticQuery(ph),(async()=>{try{const{default:F}=await dh(Object.assign({
66"../../generated/translations/ar.json":()=>D(()=>import("./locale-ar.B50TMd9p.js"),[]),
66"../../generated/translations/bg.json":()=>D(()=>import("./locale-bg.Du3sDypR.js"),[]),
66"../../generated/translations/bn.json":()=>D(()=>import("./locale-bn.BjE1ta15.js"),[]),
66"../../generated/translations/ca.json":()=>D(()=>import("./locale-ca.Cia1_jIf.js"),[]),
66"../../generated/translations/cs.json":()=>D(()=>import("./locale-cs.DxMxGrzO.js"),[]),
66"../../generated/translations/da.json":()=>D(()=>import("./locale-da.B8veDoTM.js"),[]),
66"../../generated/translations/de.json":()=>D(()=>import("./locale-de.CQsK-oVd.js"),[]),
66"../../generated/translations/el.json":()=>D(()=>import("./locale-el._mC3QUCB.js"),[]),
66"../../generated/translations/en.json":()=>D(()=>import("./locale-en.CuHoACj7.js"),[]),
66"../../generated/translations/es.json":()=>D(()=>import("./locale-es.CvIr_lWg.js"),[]),
66"../../generated/translations/et.json":()=>D(()=>import("./locale-et.B2znao-I.js"),[]),
66"../../generated/translations/eu.json":()=>D(()=>import("./locale-eu.zZJmEO9p.js"),[]),
66"../../generated/translations/fi.json":()=>D(()=>import("./locale-fi.79dzr5YM.js"),[]),
66"../../generated/translations/fr.json":()=>D(()=>import("./locale-fr.DKb926Eh.js"),[]),
66"../../generated/translations/gl.json":()=>D(()=>import("./locale-gl.CwiEamRF.js"),[]),
66"../../generated/translations/gu.json":()=>D(()=>import("./locale-gu.uE74n08v.js"),[]),
66"../../generated/translations/he.json":()=>D(()=>import("./locale-he.Drm4pqPb.js"),[]),
66"../../generated/translations/hi.json":()=>D(()=>import("./locale-hi.CKknOOYu.js"),[]),
66"../../generated/translations/hr.json":()=>D(()=>import("./locale-hr.CdggArjx.js"),[]),
66"../../generated/translations/hu.json":()=>D(()=>import("./locale-hu.DOywTQB2.js"),[]),
66"../../generated/translations/id.json":()=>D(()=>import("./locale-id.BwElm0BT.js"),[]),
66"../../generated/translations/it.json":()=>D(()=>import("./locale-it.Cm60BTTN.js"),[]),
66"../../generated/translations/ja.json":()=>D(()=>import("./locale-ja.Dfoc13Wg.js"),[]),
66"../../generated/translations/ka.json":()=>D(()=>import("./locale-ka.LaTSnRHn.js"),[]),
66"../../generated/translations/ko.json":()=>D(()=>import("./locale-ko.CvZhHNwg.js"),[]),
66"../../generated/translations/lt.json":()=>D(()=>import("./locale-lt.DiDf50vx.js"),[]),
66"../../generated/translations/lv.json":()=>D(()=>import("./locale-lv.BRpOrtII.js"),[]),
66"../../generated/translations/mr.json":()=>D(()=>import("./locale-mr.BgPLSFqs.js"),[]),
66"../../generated/translations/ms.json":()=>D(()=>import("./locale-ms.Ddua0U_x.js"),[]),
66"../../generated/translations/nb.json":()=>D(()=>import("./locale-nb.D2DKe0yD.js"),[]),
66"../../generated/translations/nl.json":()=>D(()=>import("./locale-nl.BqozJ0pY.js"),[]),
66"../../generated/translations/no.json":()=>D(()=>import("./locale-no.D2DKe0yD.js"),[]),
66"../../generated/translations/pl.json":()=>D(()=>import("./locale-pl.BZTPZWLk.js"),[]),
66"../../generated/translations/pt-BR.json":()=>D(()=>import("./locale-pt-BR.4pgjiY7G.js"),[]),
66"../../generated/translations/pt-PT.json":()=>D(()=>import("./locale-pt-PT.D3_Nd86X.js"),[]),
66"../../generated/translations/ro.json":()=>D(()=>import("./locale-ro.Cty7HKqc.js"),[]),
66"../../generated/translations/ru.json":()=>D(()=>import("./locale-ru.3uctTvqM.js"),[]),
66"../../generated/translations/sk.json":()=>D(()=>import("./locale-sk.C0lZqIQe.js"),[]),
66"../../generated/translations/sl.json":()=>D(()=>import("./locale-sl.BzE5hn9T.js"),[]),
66"../../generated/translations/sr.json":()=>D(()=>import("./locale-sr.B1mMoRUP.js"),[]),
66"../../generated/translations/sv.json":()=>D(()=>import("./locale-sv.DuNTAQAx.js"),[]),
66"../../generated/translations/ta.json":()=>D(()=>import("./locale-ta.DShjMmc5.js"),[]),
66"../../generated/translations/te.json":()=>D(()=>import("./locale-te.C92tWrrK.js"),[]),
66"../../generated/translations/th.json":()=>D(()=>import("./locale-th.D74pAA3K.js"),[]),
66"../../generated/translations/tr.json":()=>D(()=>import("./locale-tr.CumBlylR.js"),[]),
66"../../generated/translations/uk.json":()=>D(()=>import("./locale-uk.BX-Bm7HC.js"),[]),
66"../../generated/translations/ur.json":()=>D(()=>import("./locale-ur.BlgiuNe9.js"),[]),
66"../../generated/translations/vi.json":()=>D(()=>import("./locale-vi.-eIBAejY.js"),[]),
66"../../generated/translations/zh-CN.json":()=>D(()=>import("./locale-zh-CN.BSauo3qw.js"),[]),
66"../../generated/translations/zh-TW.json":()=>D(()=>import("./locale-zh-TW.Dibu6f48.js"),[])
66}),`../../generated/translations/${o.get("clientBundleInfo").locale}.json`,5);return{data:F,error:null}}catch(F){return{data:null,error:F}}})()]);if(L==null)throw H;const x=ur(L);if(x&&Vt(),T)throw oi(T.message)?new Rn:T;if(Re==null)throw he;if(Y==null)throw xe;if(be==null)throw Ve;if(!be.shop)throw new mh("Shop details are missing",{groupingHash:"BrandingMissingShopError::ShopDetailsMissing"});if(G==null)throw W;const V=new Cv({session:B?.session,initialUrl:c,sourceId:o.get("sourceToken"),checkoutSessionIdentifier:o.get("checkoutSessionIdentifier"),temporarySourceLog:(F,ie)=>{ie.negotiate_from_session_skipped=I,ie.initial_url=c.toString(),m.log("CreateSource",F,ie)}}),z=new ip({config:L.mobileCheckoutSdkConfig,serializations:o});np({serializations:o,observability:m,checkoutSdkConfig:L.mobileCheckoutSdkConfig,checkoutSheetProtocolConfig:L.checkoutSheetProtocolConfig});const X=(async()=>{try{const F=B?.session.negotiate.result,ie=F?.__typename==="NegotiationResultAvailable"?F.sellerProposal.payment:void 0,ze=ie?.__typename==="FilledPaymentTerms"&&ie.availablePaymentLines.some(ns=>ns.paymentMethod.__typename==="ShopifyInstallmentsWalletConfig");return await M.staticQuery(ch,{skip:!ze})}catch(F){return{data:null,error:F}}})(),{data:$,error:Q}=await X;if(Q)throw Q;const ee=await ef({serializedReceipt:k,observability:m}),ae=b?.shopPaySimulated??!1,oe=ae||y,Se=iu(c,o.get("embed")?.embedder)?[ru]:[],j=new Ev(oe,Y,L,B,k,Re,Se),He=Y?.checkoutProfile??void 0,te=nu(L,{client:l,userAgent:l.userAgent}),K=!!te?.isFlagshipPartner,Ae=K&&!Be(te?.embedder)&&!au(te?.embedder),Ee=V.type==="simulated"?void 0:new ev({storage:oe&&!x?"sessionStorage":"localStorage"}),de=new bv({client:l,environment:h,persistence:Ee,source:V,financingPlans:$?.spiFinancingPlans??[],serializations:o,router:_,mobileCheckoutSdk:z,cookies:l.cookies,shouldUseAccessToken:x,enableCardVaulting:!Ae,isSimulated:ae,showSwitchAccount:!K,showCheckoutAsGuest:Y.appConfiguration?.checkoutAsGuest?.visibility!=="HIDDEN"}),Ge=new Ff({environment:h,observability:m,serializations:o,shopPay:de,isEmbedded:x,getTrackingConsentHeader:P}),rs=new Vf({environment:h,observability:m,serializations:o}),dt={coreGraphql:M,shopPayGraphql:Ge,throttleGraphql:rs};if(g=new Ef({shopPayIsActive:oe,useShopConsent:E,shopPayGraphql:Ge,observability:m,shopPay:de,merchantTrackingConsent:Au(c.searchParams.get("_mcs")),prefetchedTrackingConsentHeader:R,countryCode:L.httpRequestInfo.geolocation?.country?.code}),E){const F=o.get("userPrivacySettings");F&&g.setPrefetchedConsent(F)}const kt=o.get("shopPayConfig"),lt=new A_({observability:m,environment:h,consentManager:g,refinery:{surface:oe?"shop_pay":"storefront",apiClientId:l.unstable_getSerialization("apiClientId"),getUniqueToken:()=>kt.tracking_unique??Kt({serialized:o.get("shopifyY"),expiration:o.get("shopifyYExpiration"),cookie:l.cookies.get("_shopify_y")})??void 0,getVisitToken:()=>kt.tracking_visit??Kt({serialized:o.get("shopifyS"),expiration:o.get("shopifySExpiration"),cookie:l.cookies.get("_shopify_s")})??void 0}}),Pe=new Wf({locale:a,shop:j,translations:G,onError:F=>m.error(F,{severity:"info"})}),qe=new Uv({locale:Pe.locale,shop:j,environment:h,initialUrl:c}),We=new Qg({receipt:ee,profile:He,source:V,checkoutContextData:Y,themeData:be.shop,shop:j,mobileCheckoutSdk:z,client:l,persistence:Ee,shopPay:de,shopPayIsActive:oe,requestInfoData:L,isEmbedded:x,isEmbeddedPartner:!!te?.isFlagshipPartner,observability:m,userEvents:lt,embed:te,serializations:o,events:n,graphql:dt,i18n:Pe,router:_,initialNegotiationData:B,url:qe,eagerlyLoadAppMetafields:!!(t&&L_(l,t))});Sv({route:b?.route,isEmbedded:x,source:V,shop:j,checkout:We,shopPay:de,shopPayGraphql:Ge,observability:m,userEvents:lt,reconcileBuyerConsent:F=>uu({consentManager:g,shop:j},F)});let Me;if(ur(L)){const{EmbedForBrowser:F}=await f??await D(()=>import("./embed-browser.CEXD5vfZ.js").then(ze=>ze.d),__vite__mapDeps([27,3,28,2,4,5,6,29])),ie=await F.loadClient(L.embed,m);Me=F.from(L,{...ie,events:n,shop:j,observability:m,client:l,i18n:Pe,checkout:We,source:V,graphql:dt,shopPay:de,router:_,wallets:{activeSessionSignal:We.wallets.activeSession},mobileCheckoutSdk:z,userAgent:l.userAgent,visitorConsent:Jh(g),environment:h})}return Me&&m.attachEmbedContext(Me),p.setEmbedClient(Me?.client),ou({shop:j,seri
66alizations:o,observability:m,isShopApp:de.isShopServerOrigin}),C=k_({checkout:We,i18n:Pe,shop:j,shopPay:de,source:V,url:qe,events:n,observability:m,router:_,mobileCheckoutSdk:z,embed:Me},{serializations:o,initialNegotiation:B?.session.negotiate.result,unregisterInitializingTool:Vt}),C&&(r=()=>C.teardown()),ya({events:n,shop:j,client:l,terminalErrorHandler:p,graphql:dt,observability:m,userEvents:lt,router:_,url:qe,i18n:Pe,source:V,persistence:Ee,shopPay:de,checkout:We,consentManager:g,environment:h,embed:Me,mobileCheckoutSdk:z,webMcp:C})}catch(n){return Vt(),r?.(),{status:"error",error:n,errorHandlingContext:i}}}function ya(s){return b_(s),{status:"success",appContext:s}}const Z_=Object.freeze(Object.defineProperty({__proto__:null,buildAppContextForBrowser:N_,finalizeAppContextForBrowser:ya},Symbol.toStringTag,{value:"Module"}));export{Q_ as a,Z_ as b,xg as i,X_ 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.