PageSourceSearch

https://shop.catholicsprouts.com/cdn/shopifycloud/checkout-web/assets/c1/context-browser.Eq5uMdYA.js

js catholicsprouts.com collected 2026-09-24 19:18:38 UTC 295,710 bytes, 66 lines download raw bytes

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