1import{q as e,T as t,k as o,_ as n,u as r,A as a,h as i,g as s,W as c,S as u,a7 as l,o as d}from"./2c1ab0fe.D_oO1jU7.js";import{O as p,P as m,eN as f,e9 as h,eO as v,eP as g,a6 as y,aT as k,eQ as w,be as S,eR as E,eS as P,eT as b,eU as _,b9 as M,ef as C,aW as L,eV as I,bp as T}from"./4c290a1e.D9lE9kmU.js";import{b3 as A,C as x,fb as N,J as V,aR as O,aS as D,fd as R,fe as U,bf as j,ff as H,e4 as B,a1 as F,fg as W}from"./164ad2e3.DgUUtBtV.js";import{L as z}from"./74835653.9kmD7491.js";import{u as $}from"./a25deb9a.XIOr6b3K.js";import{u as G}from"./2fdb3dd3.Dk6unqUy.js";import{a as q}from"./29034f35.BY8rOPhQ.js";import{p as Q,S as J,u as K,a as Y,M as X,A as Z,b as ee}from"./cb8fcd45.gqoNFKgG.js";import{u as te}from"./0c0ad074.C7YXa-mF.js";import{i as oe,a as ne,u as re,b as ae,c as ie,d as se,A as ce,e as ue,r as le,S as de,M as pe,I as me,f as fe,R as he,P as ve,g as ge,h as ye,j as ke,k as we}from"./c57e39e6.CFJyqk5V.js";import"./app.bDJ3v-8C.js";import"./65f3d4da.8ZfwXSRH.js";import"./60a453ce.BIyixFcg.js";import"./0a7dffce.BMM606kb.js";import"./bb728e1c.BObJOhlA.js";import"./3ca8ef7e.DT3qvctx.js";import"./ac5a19ff.CrIDx928.js";import"./47b970b2.Bspt4mBz.js";import"./064f6ac1.CT1iFQsV.js";import"./53bbdad9.Bipg1_Lt.js";import"./efa0389a.-R9eik6_.js";import"./5587f402.B4N8qnlk.js";import"./945a08d6.DUn1GrN-.js";import"./2210eadb.DF0gIp_2.js";function Se({element:t}){return e((()=>{t?.current&&t.current?.focus&&t.current.focus()}),[t])}function Ee({children:a,offset:i,arrowOffset:s,contentWidth:c,contentHeight:u,placement:l="inlineEnd",activator:d,open:p}){const m=function(t){const[r,a]=o(null),i=e((()=>{null!==t&&a(t.getBoundingClientRect())}),[t]);return n((()=>(i(),window.addEventListener("resize",i),window.addEventListener("scroll",i),()=>{window.removeEventListener("resize",i),window.removeEventListener("scroll",i)})),[i]),r}(d??null),[f,h]=function(){const[t,n]=o(null);return[t,e((e=>{null!==e&&n(e.getBoundingClientRect())}),[])]}(),{offsets:v,spacing:g}=t((()=>p?function(e,t,o,n,{offset:r=0,arrowOffset:a=0}={}){let i={x:0,y:0},s={left:0,right:0},c=0;if(!t&&!o)return{offsets:i,spacing:c};if(!n){const{clientWidth:e,clientHeight:n}=document.documentElement;return i={x:e/2-t/2,y:n/2-o/2},{offsets:i,spacing:c}}switch(e){case"blockEnd":i={x:"rtl"===(document?.dir??"ltr")?n.left:n.right-t,y:n.bottom+r};break;case"inlineEnd":i={x:"rtl"===(document?.dir??"ltr")?n.left-t-r:n.right+r,y:n.top+n.height/2-a}}return s=function(e,t){const o=document.documentElement.clientWidth,n=e.x+t;let r={left:0,right:0};return n>o&&(r={...r,right:o-n}),e.x<0&&(r={...r,left:-e.x}),r}(i,t),s.right&&!s.left?(i.x+=s.right,c=-10):!s.right&&s.left&&(i.x=0,c=10),{offsets:i,spacing:c}}(l,(c||f?.width)??0,(u||f?.height)??0,m,{offset:i,arrowOffset:s}):{offsets:{x:0,y:0},spacing:0}),[i,s,l,f,m,p,c,u]),{x:y,y:k}=t((()=>p?function({x:e,y:t}){const o=window.devicePixelRatio||1;return{x:Math.round(e*o)/o||0,y:Math.round(t*o)/o||0}}({x:v.x+g+(window.scrollX||window.pageXOffset),y:v.y+(window.scrollY||window.pageYOffset)}):{x:0,y:0}),[v,g,p]),w=t((()=>p?(window.devicePixelRatio||1)<2?`translate(${y}px, ${k}px)`:`translate3d(${y}px, ${k}px, 0)`:"none"),[p,y,k]);return r(A,{children:r("div",{className:"qdHCv",style:{...f&&{transform:w,MozTransform:w,WebkitTransform:w}},ref:h,"aria-hidden":!p,children:a})})}const Pe={Backdrop:"hgqpU","Backdrop-visible":"LTbS5",BackdropLinearGradient:"axmya",Popover:"JHj7j",Content:"hQvGd",PopoverArrow:"PMbsk",PopoverOpen:"wA8HY","Popover-placementInlineEnd":"trTaz","Popover-placementBlockEnd":"KMvI7",Bumper:"xnzQ4"},be=V("Popover");function _e({children:t,activator:o,open:l,placement:d="inlineEnd",contentWidth:p,contentHeight:m,onClose:f}){const h=a(null),v=a(null),g=a(null),y=x(void 0,be),k=N(),w=e((()=>{"BUTTON"===o?.tagName&&(o?.setAttribute("aria-controls",y),o?.setAttribute("aria-expanded",String(l)))}),[o,l,y]),S=e((e=>{f?.(e)}),[f]),E=e((e=>{e.target instanceof Node&&!o?.contains(e.target)&&document.contains(e.target)&&!g.current?.contains(e.target)&&l&&S(e)}),[S,o,l,g]),P=e((e=>{if(l)switch(e.key){case"Escape":case"Esc":S(),o?.focus()}}),[S,o,l]);i((()=>(document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}
1)),[E]),i((()=>(l&&document.addEventListener("keydown",P,!1),()=>{document.removeEventListener("keydown",P,!1)})),[l,P]),i((()=>{w()})),n((()=>{l&&g.current?.focus({preventScroll:!0})}),[l]);const b=e=>{const t=g.current;if(t){const o=e?O(t):D(t);o?o.focus():t.focus()}},_=s(Pe.Popover,Pe[c("Popover-placement",d)],l&&Pe.PopoverOpen,o&&Pe.PopoverArrow);return r(u,{children:[r(Ee,{activator:o,placement:d,offset:15,arrowOffset:30,open:l,contentWidth:p,contentHeight:m,children:[l&&r("button",{className:Pe.Bumper,ref:h,"aria-hidden":"true",onFocus:()=>b(!1),type:"button"}),r("div",{className:_,id:y,ref:g,children:r("div",{className:Pe.Content,children:t})}),l&&r("button",{className:Pe.Bumper,ref:v,"aria-hidden":"true",onFocus:()=>b(!0),type:"button"})]}),r("div",{className:s(Pe.Backdrop,l&&Pe["Backdrop-visible"],l&&k&&Pe.BackdropLinearGradient)})]})}var Me=(e=>(e.Normal="normal",e.CustomerAccount="customer_account",e.AccountsSameStore="accounts_same_store",e.AccountsCrossStore="accounts_cross_store",e))(Me||{});function Ce({email:e,skipVerifyOnLoad:t,iframeReady:o,iframeRef:n,dismissedModalKey:r,readyToDismiss:s,onReadyToDismiss:c,showPopover:u,showToggle:l,popoverActivator:d,open:h,automaticVerificationEnabled:v}){const g=m().buyerIdentity.value?.customerProfile,{inMemoryPayPalParts:{accountStatus:M}}=y(),{isDismissedGuestModal:C}=R(),{client:L,shopPay:I,source:T}=p(),{checkoutProtocolModalEventSignal:A}=k(),x=U(S.ShopPayVerification,{scope:w(T)}),N=j().current.token,V=a();return i((()=>{if(!o)return void(V.current=void 0);if(t.current)return void(t.current=!1);const a=g&&L.cookies.get(r),i=e&&E(e),s="connected"===M.value.status,c=g&&function(){const e=sessionStorage.getItem(_);if(!e)return!1;const t=Number.parseInt(e,10);return!isNaN(t)&&Date.now()<t}();i?a||s||c||(x.value!==H.Verified?(v||h)&&V.current!==e&&(V.current=e,Q(n?.current,{action:J.Create,email:e,flow:Me.Normal,disableAutoFocus:C()})):x.value=void 0):V.current=void 0}),[e,o,v,h]),{onShow:function(){if(!T.checkoutSessionIdentifier)throw new f({groupingHash:"ShopPayCheckoutIdentifierMissingError::GuestCheckout"});if((!g||!L.cookies.get(r))&&e&&E(e)){s||c(),N&&Q(n?.current,{action:J.CheckoutQueueToken,queueToken:N}),I.setUserIdentified(escape(T.checkoutSessionIdentifier));const t=new URL(window.location.href);t.searchParams.delete(P),history.replaceState(null,"",t.href),window.dispatchEvent(new Event("shop_pay_user_identified_cookie_set")),x.value=H.Pending,C()?l?.(!0):(u(!0,e),l?.(!1))}},onHidden:function(){s&&(x.value=H.Dismissed,g&&L.cookies.set(r,"true"),d?.current?.focus(),u(!1),l?.(!0))},onLoggedIn:function(){b(),x.value=H.Verified,A.value="none"}}}const Le=[Z.FraudGuard,Z.InvalidPhone,Z.LimitExceeded,Z.PhoneBlocked];function Ie({email:t,onSetEmail:o,skipVerifyOnLoad:n,iframeReady:r,iframeRef:s,readyToDismiss:c,onReadyToDismiss:u,showPopover:l,popoverActivator:d,origin:m,open:v,automaticVerificationEnabled:g}){const{shopPay:y,source:{checkoutSessionIdentifier:w}}=p(),{openModal:S}=te(),{exchangeSessionTokenForCookie:P}=K(),{extendBuyerIdentity:_}=Y(),M=a(null),C=a(!1),L=a(),{checkoutProtocolModalEventSignal:I}=k(),T=e((()=>{s.current&&Q(s.current,{action:J.Create,email:"",flow:Me.Normal})}),[s]);return i((()=>{s.current&&r&&m===h.C1ModalShopPaySignIn&&(Q(s.current,{action:J.AllowNoInitialEmail}),T(),Q(s.current,{action:J.Ready}))}),[r,s,m,T]),i((()=>{v&&(M.current=null)}),[v]),i((()=>{C.current&&s.current&&r&&(C.current=!1,T())})),i((()=>{function e(){o&&(y.updateUserVerification({status:"none"}),o(""),d?.current?.focus()),C.current=!0}return window.addEventListener("shop_pay_verification_reset",e),()=>{window.removeEventListener("shop_pay_verification_reset",e)}}),[d,l,o,s,y]),i((()=>{if(!r)return void(L.current=void 0);if(n.current)return void(n.current=!1);const e=t&&E(t),o=g||v;if(!e||m===h.C1ModalShopPaySignIn||o)if(e&&m!==h.C1ModalShopPaySignIn){if(L.current===t)return;L.current=t,y.updateUserVerification({email:t,status:"loading"}),Q(s?.current,{action:J.Create,email:t,flow:Me.Normal})}else m!==h.C1ModalShopPaySignIn&&(L.current=void 0,T(),y.updateUserVerification({status:"none"}))}),[t,r,n,s,m,g,v,y,T,l]),{onShow:function(){if(!w)throw new f({groupingHash:"ShopPayCheckoutIdentifierMissingError::S
1hopPayCheckout"});m===h.C1ModalShopPay&&t&&E(t)&&(c||u(),y.updateUserVerification({email:t,status:"found"}),l(!0,t))},onHidden:function(){if(m===h.C1ModalShopPay&&!c)return;const e=M.current;null!=o&&null!=e&&("found"!==e.status||m===h.C1ModalShopPay||!t)&&(o(e.email??""),y.updateUserVerification(e),d?.current?.focus()),"found"===y.userVerification.value.status?S({type:B.ContinueWithShopPay,email:y.userVerification.value.email}):d?.current?.focus(),l(!1),M.current=null},onEmailChange:function(e,t){e?(M.current||y.userVerification.value.email!==e)&&(M.current={email:e,status:t?"found":"new"}):M.current={status:"none"}},onError:function(e,t,o){if((!o||o===y.userVerification.value.email)&&(e===X.ShopifyPayUserNotFound&&Le.includes(t)&&(l(!1),S({type:B.Generic})),o)){const e=t===Z.InvalidEmail;y.updateUserVerification({email:o,status:e?"invalid":"new"})}},onLoggedIn:async function(e){b(),I.value="none",e&&(await P({token:e,origin:m}),_(),window.location.reload())}}}function Te({email:e,onSetEmail:n,open:s,popoverActivator:c,showPopover:u,showToggle:l,urlOrigin:d=h.C1Modal,updatedOrigin:y=d,onIframeLoaded:w,automaticVerificationEnabled:S=!0}){const E=F({base:"blockEnd",medium:"inlineEnd"}),[b,_]=o(!1),[T,A]=o(300),[x,N]=o(!1),{i18n:V,shopPay:O,shop:D,source:{checkoutSessionIdentifier:R}}=p(),U=a(null),[j,H]=o(!1),{checkoutProtocolModalEventSignal:B}=k(),W=C(e,I),K=`${R}-${e.replace(/[^a-zA-Z0-9]/g,"")}`,Y=q().value,te=a(Y),{onShow:oe,onHidden:ne,onError:re,onEmailChange:ae,onLoggedIn:ie}=function(e){const{observability:t}=p(),o=a(e),n=o.current,r=e===o.current?void 0:`Callback hook changed from ${o.current.name} to ${e.name} between renders.`;return i((()=>{r&&t.error(new M(`${r} Only the original hook is called.`,{groupingHash:"ShopPayError::OnlyOriginalHookCalled"}),{severity:"warning",errorClass:"ShopPay::ShopPayVerification::useStableHook"})}),[r,t]),n}(O.user.isUnauthenticatedUser.value?Ie:Ce)({email:W,onSetEmail:n,skipVerifyOnLoad:te,iframeReady:b,iframeRef:U,dismissedModalKey:K,readyToDismiss:x,onReadyToDismiss:()=>{setTimeout((()=>N(!0)),1e3)},showPopover:u,showToggle:l,popoverActivator:c,origin:y,open:s,automaticVerificationEnabled:S});ee({targetId:d,onReady:oe,onClosed:function(){H(!0)},onLoggedIn:ie,onHidden:ne,onError:function(e,t,o){re?.(e,t,o),e===X.ShopifyPayUserNotFound&&O.setUserIdentified(null);const n=new URL(window.location.href);t===Z.LimitExceeded?n.searchParams.set(P,"true"):n.searchParams.delete(P),history.replaceState(null,"",n.href),window.dispatchEvent(new Event("shop_pay_user_identified_cookie_set"))},onResized:function(e){!isNaN(e)&&e&&A(e)},onLoaded:()=>{_(!0),w()},onEmailChange:ae}),i((()=>{Q(U?.current,{action:J.OriginChanged,origin:y})}),[y]),i((()=>{const e=s?J.Ready:J.Hidden;if(Q(U?.current,{action:e}),B.value=s?"shopPayVerification":"none",U.current&&s&&U.current.focus(),s&&D.hasFlagEnabled(L))return()=>{B.value="none"}}),[B,s,D]);const se=(e=>{const{environment:o,i18n:{locale:n},shop:{myshopifyDomain:r},source:{checkoutSessionIdentifier:a},shopPay:i}=p(),s=G(),c=m().buyerIdentity.value?.customerProfile,{redirectUrl:u,transactionParams:l,tokens:d}=i.config,y=d.iframe,k=$();return t((()=>{if(!a)throw new f({groupingHash:"ShopPayCheckoutIdentifierMissingError::ULCFrame"});if(!k)return;if(!y||!u)return;const t=new URLSearchParams({shopify_domain:r,checkout_token:a,origin:e,locale:n,iframe_token:y,redirect_url:u,transaction_params:l??"",shop_pay_new_signup_login_variant:k});for(const[e,o]of s.entries())t.set(e,o);
1e===h.C1InlineModal&&t.set(v,g.ShopPayAsPaymentMethod),c?.email&&t.set("fast_login","true");const i=t.toString(),d=new URL("/pay/transactions/new/email",o.services.payShopifyCom.url);return d.search=i,d.href}),[e,r,a,n,y,u,l,k,s,c,o])})(d);return i((()=>()=>{_(!1)}),[se]),se?r(_e,{activator:s?c?.current:void 0,open:s,onClose:ne,placement:E,contentWidth:320,contentHeight:T,children:r(z,{active:j||!b,size:"large",children:r("iframe",{id:"shop-pay-verification-iframe",title:V.translate("verification.title"),ref:U,src:se,height:T,width:320,className:"B1y2m",allow:"publickey-credentials-get *",referrerPolicy:"origin"},se)})}):null}function Ae(e){const{checkoutToken:t,checkoutVersion:o,shopPermanentDomain:n}=e;return{checkoutVersion:o,checkoutToken:t,flow:"checkout_modal",shopPermanentDomain:n}}const xe=({anchorTo:n,email:s,experiments:c,preventOverlayDismissOnClick:u,queueToken:l,totalDue:d,...p})=>{const{modalVisible:m}=re(),f=a(null);!function({email:n,emailInputSelector:r,onGetEmailInput:s,hideChange:c,iframeRef:u,shouldListen:l=!0,shouldOpenOnMatch:d=!0}){const{loaded:p,modalVisible:m}=re(),{leaveBreadcrumb:f,notify:h}=ae(),{trackUserAction:v}=ie(),{isFilledWithPasswordManager:g}=function({emailInputSelector:e}){const[n,r]=o(),[a,s]=o();return i((()=>{function t(e){"password"===this.type?s(e.timeStamp):r(e.timeStamp)}if(e){const o=ne.querySelector(e);if(o){o.addEventListener("input",t);const e=o.form?.querySelector('input[type="password"]');return e&&e instanceof HTMLInputElement&&e.addEventListener("input",t),()=>{o.removeEventListener("input",t),e&&e.removeEventListener("input",t)}}}}),[e]),{isFilledWithPasswordManager:t((()=>void 0!==n&&void 0!==a&&Math.abs(n-a)<100),[n,a])}}({emailInputSelector:r}),y=a(null),[k,w]=o(),[S,E]=o(),[P,b]=o(),_=a(null),M=a(""),C=t((()=>new Set),[]),L=e((async(e,t="",o="")=>{const n=se(e);if(g&&!C.has("PASSWORD_MANAGER_AUTOFILL_DETECTED")&&(C.add("PASSWORD_MANAGER_AUTOFILL_DETECTED"),v({userAction:"PASSWORD_MANAGER_AUTOFILL_DETECTED"})),n&&!C.has("EMAIL_ENTERED")&&(C.add("EMAIL_ENTERED"),v({userAction:"EMAIL_ENTERED"})),f("email entered",{},"state"),!u.current||m)return;if(!p)return;const r=n?e:"";y.current&&!y.current?.signal.aborted&&y.current.abort(),y.current=new AbortController;try{const{open:e,postMessage:n,waitForMessage:a}=u.current;M.current=r,n({firstName:t,lastName:o,type:"namesubmitted"}),n({email:r,hideChange:void 0===c?r.length>0:c,type:"emailsubmitted"}),f("email submitted",{email:r?"redacted":""},"state");const i=a("shop_user_matched",y.current.signal),s=new Promise(((e,t)=>{const o=async()=>{try{const t=await a("error",y.current.signal);"error"===t.type&&"captcha_challenge"===t.code?e(void 0):await o()}catch(n){t(n)}};o()}));await Promise.race([i,s]),d&&(e("event_shop_user_matched"),_?.current?.blur(),function(){if(!oe())return;const e="shop-pay-safari-unzoom",t=ne.getElementById(e);if(t)return t.focus();const o=ne.createElement("input");o.id=e,o.style.fontSize="16px",o.style.width="1px",o.style.height="1px",o.style.position="fixed",o.style.bottom="-1000px",o.style.right="-1000px",o.style.transform="translate(1000px, 1000px)",o.setAttribute("aria-hidden","true"),ne.body.appendChild(o),o.focus({preventScroll:!0})}()),y.current.abort(),w(void 0)}catch(a){if(a instanceof ce&&"AbortSignalReceivedError"===a.name)return;a instanceof Error&&h(new Error(`Error updating user info: ${a.name} - ${a.message}`))}}),[c,u,g,f,p,m,h,d,v,C]),I=ue(((e,t,o)=>{L(e,t,o)}),200);i((()=>{void 0!==k&&p&&I(k,S,P)}),[I,k,p,S,P]),i((()=>{if(!r&&!s)return;const e=r?ne.querySelector(r):s?.();if(!e)return;_.current=e;const t=()=>{e&&w(e.value)};if(e?.value&&t(),l)return e?.addEventListener("input",t),()=>{e?.removeEventListener("input",t)};e?.removeEventListener("input",t)}),[r,s,l]),i((()=>{void 0!==n&&w(n)}),[n])}({email:s,iframeRef:f});const{postMessageAfterLoad:h}=function({iframeRef:e}){const{loaded:t}=re();return{postMessageAfterLoad:async function(o){if(!e.current)return;const{postMessage:n,waitForMessage:r}=e.current;t||await r("loaded"),n(o)}}}({iframeRef:f}),{trackUserAction:v}=ie(),{leaveBreadcrumb:g}=ae();i((()=>{const e=new URL(ve).origin,t=t=>{if(t.origin===e&&"completed"===t.data?.type&&(g("oauth completed from popup",{},"state"),void 0!==ge&&"parent"in ge&&ge.parent&&ge.parent!==ge)){g("forwarding completion to parent window",{},"state");const e="ancestorOrigins"in ge.location?ge.location.ancestorOrigins:void 0,t=e?.[0];t&&ge.parent.postMessage({type:"completed",origin:ve},t)}};return ge.addEventListener("message",t),()=>{ge.removeEventListener("message",t)}}),[g]);const y=t((()=>({open:async()=>{m||(f.current?.open("user_button_clicked"),v({userAction:"OPEN_CALLED"}),g("open called",{},"state"))}})),[m,v,g]);ye(y);const{trackShopPayModalStateChange:k}=function(){const{analyticsData:t,produceMonorailEvent:o}=ie();return{trackShopPayModalStateChange:e((({currentState:e,zoom:n})=>{const{analyticsTraceId:r,checkoutToken:a,checkoutVersion:i,shopPermanentDomain:s}=t,c={previousState:"",currentState:e,clientTimestampMs:(new Date).getTime(),analyticsTraceId:r,checkoutToken:a||"",checkoutVersion:i||"",shopifyDomain:s||"",zoom:n};o({event:{payload:c,schemaId:"shopify_pay_modal_state_change/1.3"}})}),[t,o])}}(),w=e((()=>
1{k({currentState:"loaded",zoom:`${ge.visualViewport?.scale}`})}),[k]),S=e((e=>{k({currentState:e?"shown":"hidden",zoom:`${ge.visualViewport?.scale}`})}),[k]);i((()=>{if(l||d){const e={totalDue:Number(d)||0,checkoutQueueToken:l||""};h({type:"checkoutcontextsubmitted",checkoutContext:e}),l&&h({type:"checkoutqueuetokensubmitted",checkoutQueueToken:l})}}),[h,l,d]);const{authorizeUrl:E}=ke({analyticsContext:"loginWithShopCheckoutModal",avoidSdkSession:!0,clientId:"",disableSignUp:!0,flow:"checkout_modal",proxy:!0,redirectType:"iframe",responseType:"code",uxMode:"iframe",...p}),P=t((()=>{if(u)return!1;try{if(!c)return!0;return"treatment"!==JSON.parse(c).e_7585671bd434a1fca2d05deff50a41ee}catch{return!0}}),[c,u]);return r(we,{anchorTo:n,dismissable:P,keepModalOpen:!0,onLoaded:w,onModalVisibleChange:S,proxy:!0,ref:f,src:E,sandbox:!0,variant:"checkoutModal",scrolling:"no"})},Ne=({shopCheckoutModal:e,eventName:t,eventListener:o})=>{i((()=>(e?.addEventListener(t,o),()=>e?.removeEventListener(t,o))),[o,t,e])};function Ve({email:n,open:s,popoverActivator:c,popoverAnchorSelector:u,showPopover:d,showToggle:h,onIframeLoaded:v,automaticVerificationEnabled:g=!0}){const E=c?.current,P=l(null),[_,M]=o(!1),C=a(!1),{client:L,shop:{myshopifyDomain:I,storefrontUrl:A},shopPay:x,source:N,checkout:{wallets:V}}=p(),{redirectUrl:O,transactionParams:D}=x.config,B=m().buyerIdentity.value?.customerProfile,{inMemoryPayPalParts:{accountStatus:F}}=y(),{isDismissedGuestModal:W}=R(),z=j(),$=Se({element:c}),G=t((()=>z.current.token),[z]),{value:Q}=T(),{checkoutProtocolModalEventSignal:J}=k(),K=U(S.ShopPayVerification,{scope:w(N)}),Y=`${N.checkoutSessionIdentifier}-${n.replace(/[^a-zA-Z0-9]/g,"")}`,X=q().value,Z=a(X);i((()=>{if(Z.current)return Z.current=!1,void M(!1);const e=W(),t=B&&L.cookies.get(Y),o="connected"===F.value.status;if(!(e||t||o))return K.value===H.Verified?(K.value=void 0,void M(!1)):void M(!0);M(!1)}),[n]);const ee=e((()=>{b(),K.value=H.Verified,J.value="none"}),[J,K]);Ne({shopCheckoutModal:P.value,eventName:"completed",eventListener:ee});const te=e((()=>{if(!N.checkoutSessionIdentifier)throw new f({groupingHash:"ShopPayCheckoutIdentifierMissingError::ShopJSVerification"});x.setUserIdentified(escape(N.checkoutSessionIdentifier)),window.dispatchEvent(new Event("shop_pay_user_identified_cookie_set")),K.value=H.Pending,d?.(!0,n),h?.(!1)}),[N.checkoutSessionIdentifier,n,x,K,d,h]);Ne({shopCheckoutModal:P.value,eventName:"modalopened",eventListener:te});const oe=e((()=>{K.value=H.Dismissed,B&&L.cookies.set(Y,"true"),d?.(!1),h?.(C.current),M(!1),$()}),[B,Y,K,d,h,$,L.cookies]);Ne({shopCheckoutModal:P.value,eventName:"modalclosed",eventListener:oe});const ne=e((()=>{C.current=!0}),[]);Ne({shopCheckoutModal:P.value,eventName:"shopusermatched",eventListener:ne});const re=e((e=>{C.current=!1,x.setUserIdentified(null),window.dispatchEvent(new Event("shop_pay_user_identified_cookie_set"))}),[x]);Ne({shopCheckoutModal:P.value,eventName:"shopusernotmatched",eventListener:re}),Ne({shopCheckoutModal:P.value,eventName:"loaded",eventListener:v}),i((()=>{E&&s&&(P.peek()?.open(),E.blur())}),[E,n,s,P]),i((()=>{if(s)return J.value="shopPayVerification",()=>{J.value="none"}}),[J,s]);const ae=s||g&&_?n:"";if(!O||V.activeSession.value)return null;const ie=E?.id?`input#${se=E.id,"undefined"!=typeof CSS&&CSS.escape?CSS.escape(se):se}`:"";var se;return r("shop-checkout-modal",{"anchor-to":u??ie,"checkout-redirect-url":O,"checkout-token":N.checkoutSessionIdentifier,"checkout-version":"checkout_one",email:ae,"prevent-overlay-dismiss-on-click":!0,"queue-token":G||"","total-due":Q?.amount?.toString()||"0",ref:P,"shop-permanent-domain":I,"transaction-params":D,"storefront-domain":A})}"undefined"==typeof window||"undefined"==typeof customElements||customElements.get("shop-checkout-modal")||le((({element:e,...t})=>r(he,{element:e,featureName:"ShopCheckoutModal",children:r(de,{children:r(pe,{monorailProps:Ae(t),children:r(me,{children:r(fe,{children:r(xe,{...t})})})})})})),{methods:["open"],name:"shop-checkout-modal",props:{anchorTo:"string",checkoutRedirectUrl:"string",checkoutToken:"string",checkoutVersion:"string",email:"string",embed:"string",experiments:"string",preventOverlayDismissOnClick:"boolean",queueToken:"string",shopId:"number",shopPermanentDomain:"string",shopifyEsse
1ntial:"string",totalDue:"string",transactionParams:"string",storefrontDomain:"string"},shadow:"open"});const Oe=e=>r(u,{children:r(Ve,{...e})}),De=({email:o,onSetEmail:n,open:s,popoverActivator:c,popoverAnchorSelector:u,showPopover:l,showToggle:m,urlOrigin:f=h.C1Modal,updatedOrigin:v=h.C1Modal})=>{const{shopPay:{user:{hasFlow:g}},embed:y,webMcp:k,checkout:{identity:w},observability:S}=p(),P="shopPay"===w.current.value,b=k?.hasToolCallStarted.value??!1,_=!y&&(P||!b),M=Se({element:c});d((()=>{const e=k?.hasToolCallStarted.value;e&&s&&!P&&(l(!1),M())}));const C=t((()=>W()),[]),L=t((()=>W()),[]),I=a(!0),T=t((()=>({isC1:!0,shopJsVerification:!P})),[P]);i((()=>{E(o)&&(C.mark("start"),I.current=!0)}),[C,o]),i((()=>{if(s&&I.current&&C.marks.start&&T){C.mark("open"),I.current=!1;const e=Math.round(C.marks.open-C.marks.start);S.histogram({name:"shop_pay_verification_time_to_interactive",value:e,attributes:T});const t=Math.round(C.marks.open-Math.max(C.marks.start,C.marks.loaded||0));S.histogram({name:"shop_pay_verification_time_to_interactive_after_load",value:t,attributes:T})}}),[s,S,C,T]),i((()=>{L.mark("start")}),[L]);const A=e((()=>{if(L.marks.start){L.mark("loaded"),C.mark("loaded");const e=Math.round(L.marks.loaded-L.marks.start);S.histogram({name:"shop_pay_verification_iframe_ready_duration",value:e,attributes:T})}}),[L,C,S,T]);return P&&!g.value?null:P?r(Te,{popoverActivator:c,email:o,onSetEmail:n,open:s,showPopover:l,showToggle:m,urlOrigin:f,updatedOrigin:v,onIframeLoaded:A,automaticVerificationEnabled:_}):b&&!s?null:r(Oe,{popoverActivator:c,popoverAnchorSelector:u,email:o,open:s,showPopover:l,showToggle:m,onIframeLoaded:A,automaticVerificationEnabled:_})};export{De as default};
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.