import{Pt as e,Wt as t}from"./630ba094.L_X-5TXi.js";import{Tb as a,gh as c,xO as n}from"./6ec9a0fa.rdcQt2v8.js";var _=function(e){return e.ApplePay="ApplePay",e.Checkout="Checkout",e.PayPalV6="PayPalV6",e.Venmo="Venmo",e.GooglePay="GooglePay",e.ShopifyPay="ShopifyPay",e.ShopPayApplePay="ShopPayApplePay",e}({}),r=function(e){return e.Attempt="attempt",e.Success="success",e.Cancelled="cancelled",e.Failure="failure",e.Clicked="clicked",e.Initialized="initialized",e.QrCodeShown="qr_code_shown",e.NascarDrawerOpen="open",e.NascarDrawerClose="close",e}({}),s=function(e){return e.Express="express",e.PaymentMethod="payment_method",e}({}),l=function(e){return e.InitCalled="spb_init_called",e.ClickAcceleratedClicked="spb_instrument_click__accelerated__clicked",e.ClickSheetClicked="spb_instrument_click__sheet__clicked",e.ClickAcceleratedInitialized="spb_instrument_click__accelerated__initialized",e.ClickSheetInitialized="spb_instrument_click__sheet__initialized",e.ClickAcceleratedQrCodeShown="spb_instrument_click__accelerated__qr_code_shown",e.ClickSheetQrCodeShown="spb_instrument_click__sheet__qr_code_shown",e.ClickAcceleratedSuccess="spb_instrument_click__accelerated__success",e.ClickSheetSuccess="spb_instrument_click__sheet__success",e.ClickAcceleratedCancelled="spb_instrument_click__accelerated__cancelled",e.ClickSheetCancelled="spb_instrument_click__sheet__cancelled",e.ClickAcceleratedFailed="spb_instrument_click__accelerated__failure",e.ClickSheetFailed="spb_instrument_click__sheet__failure",e.SheetLoaded="spb_instrument_sheet_loaded",e.AuthAcceleratedAttempt="spb_instrument_auth__accelerated__attempt",e.AuthSheetAttempt="spb_instrument_auth__sheet__attempt",e.AuthAcceleratedSuccess="spb_instrument_auth__accelerated__success",e.AuthSheetSuccess="spb_instrument_auth__sheet__success",e.AuthAcceleratedFailure="spb_instrument_auth__accelerated__failure",e.AuthSheetFailure="spb_instrument_auth__sheet__failure",e.AuthorizationAttempt="wallets_authorization_attempt",e.AuthorizationComplete="wallets_authorization_complete",e.CryptoModalCancelled="checkout_crypto_payment_modal__cancelled",e.CryptoModalCompleted="checkout_crypto_payment_modal__completed",e.CryptoModalRendered="checkout_crypto_payment_modal__rendered",e.CryptoModalWalletAction="checkout_crypto_payment_modal__wallet_action",e.CryptoModalError="checkout_crypto_payment_modal__error",e.RecoveryFlowInitiated="spb_instrument_recovery_flow__initiated",e}({});function i(){const t=a();return e(()=>({screenWidth:"undefined"==typeof window?0:window.innerWidth,cartValue:t.value?.amount,currencyCode:t.value?.currencyCode}))}function o(e,a){const{userEvents:c}=n(),{value:_}=c.trekkie.defaultAttributes,r=i();t(()=>{if(!_)return;const t=k(e),n=d({walletName:void 0,shopId:_.shopId,eventName:"spb_init_called",nascarData:{...r.value,walletsRenderedCount:a,walletsRenderedNames:t},walletType:"payment_method"});n&&c.monorailEvent(n)},[c,r.value,e,a,_])}function u({state:e,shopId:t,paymentMethods:a,nascarData:c}){return d({walletName:"NascarDrawer",shopId:t,eventName:e,nascarData:{...c,walletsRenderedNames:k(a)}})}function d({walletName:e,shopId:t,eventName:a,nascarData:n,walletType:_,ttl:r,eventSubtype:s,errorReason:l}){const i=c();return i?p({eventName:a,shopId:t,defaultAttributes:i,nascarData:n,walletType:_,walletName:e,ttl:r,eventSubtype:s,errorReason:l}):null}function p({eventName:e,shopId:t,defaultAttributes:a,nascarData:c,walletName:n,walletType:_,ttl:r,eventSubtype:s,errorReason:l}){const{uniqToken:i,visitToken:o,microSessionId:u,microSessionCount:d=0,themeId:p,themeCityHash:h,contentLanguage:m,referer:k,checkoutToken:y}=a??{};return{schemaId:"shopify_wallet_checkout_track/6.3",payload:{event:e,eventSubtype:s??_??"express",appName:"checkout",pageType:"checkout",checkoutToken:y,instrumentId:n,checkoutOne:!0,uniqToken:i,visitToken:o,microSessionId:u,microSessionCount:d,shopId:t,themeId:p,themeCityHash:h||"",contentLanguage:m,referer:k,...r&&{ttl:r},...l&&{errorReason:l},...c&&{...c}}}}function h(e,t){return`${e?"spb_instrument_click__accelerated_":"spb_instrument_click__sheet_"}_${t}`}function m(e,t){return`spb_instrument_auth__${e?"accelerated":"sheet"}__${t}`}function k(e){return e.map(e=>e.name).join(",")}export{m as a,p as c,o as d,s as i,d as l,_ as n,h as o,r,u as s,l as t,i as u};