PageSourceSearch

https://www.kancanusa.com/cdn/shopifycloud/checkout-web/assets/c1/f2ade998.BZuQa7en.js

js kancanusa.com collected 2026-10-08 11:27:32 UTC 23,445 bytes, 1 lines download raw bytes

1import{q as e,T as t,z as o,_ as n,u as r,g as a,h as i,m as s,a6 as c,S as u,ae as l,p as d}from"./2c1ab0fe.Bf8FS-kA.js";import{c as p,ey as m,ez as f,eA as h,a6 as v,eB as g,b2 as y,eC as k,B as w,eD as S,eE as E,a_ as b,e1 as P,aL as _,eF as M,aO as C}from"./4b4bc88f.C6QXxWcp.js";import{M as L}from"./c6c0cbda.BXj5YQC9.js";import{c as I}from"./5ef0d995.CZZPB7PS.js";import{bi as T,r as A,fg as x,s as N,b9 as V,ba as D,fi as O,fj as R,p as j}from"./164ad2e3.BPEX42uv.js";import{L as U}from"./74835653.CoZYi26f.js";import{u as B}from"./a25deb9a.CoEu-Jrd.js";import{u as H}from"./2fdb3dd3.XqxrAL2n.js";import{a as F}from"./29034f35.MDEcwMxv.js";import{p as z,S as $,u as W,a as G,M as q,A as Q,b as J}from"./91319467.ziNtHRYe.js";import{a as K}from"./71b60e0a.DfPLdYsH.js";import{b as Y,U as X}from"./24773686.Dfu7aqGb.js";import{i as Z,a as ee,u as te,b as oe,c as ne,d as re,A as ae,e as ie,r as se,S as ce,M as ue,I as le,f as de,R as pe,P as me,g as fe,h as he,j as ve,k as ge}from"./c57e39e6.2Y-Dcuz1.js";import"./app.YmvH25zM.js";import"./d0bb51ec.3dWJ276v.js";import"./f67abd2c.DVYhtaBv.js";import"./60a453ce.Boic_DNC.js";import"./e12db40c.2vh-yzuN.js";import"./9dba8418.bYtorePf.js";import"./3ca8ef7e.BS-l2zDp.js";import"./2495faa4.1SnUZiCo.js";import"./a9fa9fda.BdhYcFOq.js";import"./ca3e798e.Dc6mNaNz.js";import"./47b970b2.BE-srlol.js";import"./22345fd4.BoFvu5gm.js";import"./064f6ac1.CjuMIPLF.js";import"./efa0389a.BZyYBSt1.js";import"./4b1c22b7.BRxY0LFs.js";import"./81e109b1.DOkM2TK2.js";import"./2210eadb.DF0gIp_2.js";function ye({element:t}){return e(()=>{t?.current&&t.current?.focus&&t.current.focus()},[t])}function ke({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(T,{children:r("div",{className:"qdHCv",style:{...f&&{transform:w,MozTransform:w,WebkitTransform:w}},ref:h,"aria-hidden":!p,children:a})})}const we={Backdrop:"hgqpU","Backdrop-visible":"LTbS5",BackdropLinearGradient:"axmya",Popover:"JHj7j",Content:"hQvGd",PopoverArrow:"PMbsk",PopoverOpen:"wA8HY","Popover-placementInlineEnd":"trTaz","Popover-placementBlockEnd":"KMvI7",Bumper:"xnzQ4"},Se=N("Popover");function Ee({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=A(void 0,Se),k=x(),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]),b=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)}),[E]),i(()=>(l&&document.addEventListener("keydown",b,!1),()=>{document.removeEventListener("keydown",b,!1)}),[l,b]),i(()=>{w()}),n(()=>{l&&g.current?.focus({preventScroll:!0})},[l]);const P=e=>{const t=g.current;if(t){const o=e?V(t):D(t);o?o.focus():t.focus()}},_=s(we.Popover,we[c("Popover-placement",d)],l&&we.PopoverOpen,o&&we.PopoverArrow);return r(u,{children:[r(ke,{activator:o,placement:d,offset:15,arrowOffset:30,open:l,contentWidth:p,contentHeight:m,children:[l&&r("button",{className:we.Bumper,ref:h,"aria-hidden":"true",onFocus:()=>P(!1),type:"button"}),r("div",{className:_,id:y,ref:g,children:r("div",{className:we.Content,children:t})}),l&&r("button",{className:we.Bumper,ref:v,"aria-hidden":"true",onFocus:()=>P(!0),type:"button"})]}),r("div",{className:s(we.Backdrop,l&&we["Backdrop-visible"],l&&k&&we.BackdropLinearGradient)})]})}var be=(e=>(e.Normal="normal",e.CustomerAccount="customer_account",e.AccountsSameStore="accounts_same_store",e.AccountsCrossStore="accounts_cross_store",e))(be||{});function Pe({email:e,skipVerifyOnLoad:t,iframeReady:o,iframeRef:n,dismissedModalKey:r,readyToDismiss:s,onReadyToDismiss:c,showPopover:u,showToggle:l,popoverActivator:d,open:f,automaticVerificationEnabled:h}){const{inMemoryPayPalParts:{accountStatus:b}}=v(),{isDismissedGuestModal:P}=O(),{checkout:{negotiator:_},client:M,shopPay:C,source:L}=p(),I=_.current.fields.buyerIdentity.value?.customerProfile,{checkoutProtocolModalEventSignal:T}=_.context,A=R(y.ShopPayVerification,{scope:g(L)}),x=_.throttleState.peek().token,N=a();return i(()=>
1{if(!o)return void(N.current=void 0);if(t.current)return void(t.current=!1);const a=I&&M.cookies.get(r),i=e&&k(e),s="connected"===b.value.status,c=I&&function(){const e=sessionStorage.getItem(E);if(!e)return!1;const t=Number.parseInt(e,10);return!isNaN(t)&&Date.now()<t}();i?a||s||c||(A.value!==K.Verified?(h||f)&&N.current!==e&&(N.current=e,z(n?.current,{action:$.Create,email:e,flow:be.Normal,disableAutoFocus:P()})):A.value=void 0):N.current=void 0},[e,o,h,f]),{onShow:function(){if(!L.checkoutSessionIdentifier)throw new m({groupingHash:"ShopPayCheckoutIdentifierMissingError::GuestCheckout"});if((!I||!M.cookies.get(r))&&e&&k(e)){s||c(),x&&z(n?.current,{action:$.CheckoutQueueToken,queueToken:x}),C.setUserIdentified(escape(L.checkoutSessionIdentifier));const t=new URL(window.location.href);t.searchParams.delete(w),history.replaceState(null,"",t.href),window.dispatchEvent(new Event("shop_pay_user_identified_cookie_set")),A.value=K.Pending,P()?l?.(!0):(u(!0,e),l?.(!1))}},onHidden:function(){s&&(A.value=K.Dismissed,I&&M.cookies.set(r,"true"),d?.current?.focus(),u(!1),l?.(!0))},onLoggedIn:function(){S(),A.value=K.Verified,T.value="none"}}}const _e=[Q.FraudGuard,Q.InvalidPhone,Q.LimitExceeded,Q.PhoneBlocked];function Me({email:t,onSetEmail:o,skipVerifyOnLoad:n,iframeReady:r,iframeRef:s,readyToDismiss:c,onReadyToDismiss:u,showPopover:l,popoverActivator:d,origin:f,open:h,automaticVerificationEnabled:v}){const{shopPay:g,source:{checkoutSessionIdentifier:y},checkout:{negotiator:w}}=p(),{openModal:E}=Y(),{exchangeSessionTokenForCookie:b}=W(),{extendBuyerIdentity:P}=G(),_=a(null),M=a(!1),C=a(),{checkoutProtocolModalEventSignal:I}=w.context,T=e(()=>{s.current&&z(s.current,{action:$.Create,email:"",flow:be.Normal})},[s]);return i(()=>{s.current&&r&&f===L.C1ModalShopPaySignIn&&(z(s.current,{action:$.AllowNoInitialEmail}),T(),z(s.current,{action:$.Ready}))},[r,s,f,T]),i(()=>{h&&(_.current=null)},[h]),i(()=>{M.current&&s.current&&r&&(M.current=!1,T())}),i(()=>{function e(){o&&(g.updateUserVerification({status:"none"}),o(""),d?.current?.focus()),M.current=!0}return window.addEventListener("shop_pay_verification_reset",e),()=>{window.removeEventListener("shop_pay_verification_reset",e)}},[d,l,o,s,g]),i(()=>{if(!r)return void(C.current=void 0);if(n.current)return void(n.current=!1);const e=t&&k(t),o=v||h;if(!e||f===L.C1ModalShopPaySignIn||o)if(e&&f!==L.C1ModalShopPaySignIn){if(C.current===t)return;C.current=t,g.updateUserVerification({email:t,status:"loading"}),z(s?.current,{action:$.Create,email:t,flow:be.Normal})}else f!==L.C1ModalShopPaySignIn&&(C.current=void 0,T(),g.updateUserVerification({status:"none"}))},[t,r,n,s,f,v,h,g,T,l]),{onShow:function(){if(!y)throw new m({groupingHash:"ShopPayCheckoutIdentifierMissingError::ShopPayCheckout"});f===L.C1ModalShopPay&&t&&k(t)&&(c||u(),g.updateUserVerification({email:t,status:"found"}),l(!0,t))},onHidden:function(){if(f===L.C1ModalShopPay&&!c)return;const e=_.current;null!=o&&null!=e&&("found"!==e.status||f===L.C1ModalShopPay||!t)&&(o(e.email??""),g.updateUserVerification(e),d?.current?.focus()),"found"===g.userVerification.value.status?E({type:X.ContinueWithShopPay,email:g.userVerification.value.email}):d?.current?.focus(),l(!1),_.current=null},onEmailChange:function(e,t){e?(_.current||g.userVerification.value.email!==e)&&(_.current={email:e,status:t?"found":"new"}):_.current={status:"none"}},onError:function(e,t,o){if((!o||o===g.userVerification.value.email)&&(e===q.ShopifyPayUserNotFound&&_e.includes(t)&&(l(!1),E({type:X.Generic})),o)){const e=t===Q.InvalidEmail;g.updateUserVerification({email:o,status:e?"invalid":"new"})}},onLoggedIn:async function(e){S(),I.value="none",e&&(await b({token:e,origin:f}),P(),window.location.reload())}}}function Ce({email:e,onSetEmail:n,open:s,popoverActivator:c,showPopover:u,showToggle:l,urlOrigin:d=L.C1Modal,updatedOrigin:v=d,onIframeLoaded:g,automaticVerificationEnabled:y=!0}){const k=j({base:"blockEnd",medium:"inlineEnd"}),[S,E]=o(!1),[C,I]=o(300),[T,A]=o(!1),{i18n:x,shopPay:N,shop:V,source:{checkoutSessionIdentifier:D},checkout:{negotiator:O}}=p(),R=a(null),[W,G]=o(!1),{checkoutProtocolModalEventSignal:K}=O.context,Y=P(e,M),X=`${D}-${e.replace(/[^a-zA-Z0-9]/g,"")}`,Z=F().value,ee=a(Z),{onShow:te,onHidden:oe,onError:ne,onEmailChange:re,onLoggedIn:ae}=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 b(`${r} Only the original hook is called.`,{groupingHash:"ShopPayError::OnlyOriginalHookCalled"}),{severity:"warning",errorClass:"ShopPay::ShopPayVerification::useStableHook"})},[r,t]),n}(N.user.isUnauthenticatedUser.value?Me:Pe)({email:Y,onSetEmail:n,skipVerifyOnLoad:ee,iframeReady:S,iframeRef:R,dismissedModalKey:X,readyToDismiss:T,onReadyToDismiss:()=>{setTimeout(()=>A(!0),1e3)},showPopover:u,showToggle:l,popoverActivator:c,origin:v,open:s,automaticVerificationEnabled:y});J({targetId:d,onReady:te,onClosed:function(){G(!0)},onLoggedIn:ae,onHidden:oe,onError:function(e,t,o){ne?.(e,t,o),e===q.ShopifyPayUserNotFound&&N.setUserIdentified(null);const n=new URL(window.location.href);t===Q.LimitExceeded?n.searchParams.set(w,"true"):n.searchParams.delete(w),history.replaceState(null,"",n.href),window.dispatchEvent(new Event("shop_pay_user_identified_cookie_set"))},onResized:function(e){!isNaN(e)&&e&&I(e)},onLoaded:()=>{E(!0),g()},onEmailChange:re}),i(()=>{z(R?.current,{action:$.OriginChanged,origin:v})},[v]),i(()=>{const e=s?$.Ready:$.Hidden;if(z(R?.current,{action:e}
1),K.value=s?"shopPayVerification":"none",R.current&&s&&R.current.focus(),s&&V.hasFlagEnabled(_))return()=>{K.value="none"}},[K,s,V]);const ie=(e=>{const{environment:o,i18n:{locale:n},shop:{myshopifyDomain:r},source:{checkoutSessionIdentifier:a},shopPay:i,checkout:{negotiator:s}}=p(),c=H(),u=s.current.fields.buyerIdentity.value?.customerProfile,{redirectUrl:l,transactionParams:d,tokens:v}=i.config,g=v.iframe,y=B();return t(()=>{if(!a)throw new m({groupingHash:"ShopPayCheckoutIdentifierMissingError::ULCFrame"});if(!y)return;if(!g||!l)return;const t=new URLSearchParams({shopify_domain:r,checkout_token:a,origin:e,locale:n,iframe_token:g,redirect_url:l,transaction_params:d??"",shop_pay_new_signup_login_variant:y});for(const[e,o]of c.entries())t.set(e,o);e===L.C1InlineModal&&t.set(f,h.ShopPayAsPaymentMethod),u?.email&&t.set("fast_login","true");const i=t.toString(),s=new URL("/pay/transactions/new/email",o.services.payShopifyCom.url);return s.search=i,s.href},[e,r,a,n,g,l,d,y,c,u,o])})(d);return i(()=>()=>{E(!1)},[ie]),ie?r(Ee,{activator:s?c?.current:void 0,open:s,onClose:oe,placement:k,contentWidth:320,contentHeight:C,children:r(U,{active:W||!S,size:"large",children:r("iframe",{id:"shop-pay-verification-iframe",title:x.translate("verification.title"),ref:R,src:ie,height:C,width:320,className:"B1y2m",allow:"publickey-credentials-get *",referrerPolicy:"origin"},ie)})}):null}function Le(e){const{checkoutToken:t,checkoutVersion:o,shopPermanentDomain:n}=e;return{checkoutVersion:o,checkoutToken:t,flow:"checkout_modal",shopPermanentDomain:n}}const Ie=({anchorTo:n,email:s,experiments:c,preventOverlayDismissOnClick:u,queueToken:l,totalDue:d,...p})=>{const{modalVisible:m}=te(),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}=te(),{leaveBreadcrumb:f,notify:h}=oe(),{trackUserAction:v}=ne(),{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=ee.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(),[b,P]=o(),_=a(null),M=a(""),C=t(()=>new Set,[]),L=e(async(e,t="",o="")=>{const n=re(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(!Z())return;const e="shop-pay-safari-unzoom",t=ee.getElementById(e);if(t)return t.focus();const o=ee.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"),ee.body.appendChild(o),o.focus({preventScroll:!0})}()),y.current.abort(),w(void 0)}catch(a){if(a instanceof ae&&"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=ie((e,t,o)=>{L(e,t,o)},200);i(()=>{void 0!==k&&p&&I(k,S,b)},[I,k,p,S,b]),i(()=>
1{if(!r&&!s)return;const e=r?ee.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}=te();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}=ne(),{leaveBreadcrumb:g}=oe();i(()=>{const e=new URL(me).origin,t=t=>{if(t.origin===e&&"completed"===t.data?.type&&(g("oauth completed from popup",{},"state"),void 0!==fe&&"parent"in fe&&fe.parent&&fe.parent!==fe)){g("forwarding completion to parent window",{},"state");const e="ancestorOrigins"in fe.location?fe.location.ancestorOrigins:void 0,t=e?.[0];t&&fe.parent.postMessage({type:"completed",origin:me},t)}};return fe.addEventListener("message",t),()=>{fe.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]);he(y);const{trackShopPayModalStateChange:k}=function(){const{analyticsData:t,produceMonorailEvent:o}=ne();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(()=>{k({currentState:"loaded",zoom:`${fe.visualViewport?.scale}`})},[k]),S=e(e=>{k({currentState:e?"shown":"hidden",zoom:`${fe.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}=ve({analyticsContext:"loginWithShopCheckoutModal",avoidSdkSession:!0,clientId:"",disableSignUp:!0,flow:"checkout_modal",proxy:!0,redirectType:"iframe",responseType:"code",uxMode:"iframe",...p}),b=t(()=>{if(u)return!1;try{if(!c)return!0;return"treatment"!==JSON.parse(c).e_7585671bd434a1fca2d05deff50a41ee}catch{return!0}},[c,u]);return r(ge,{anchorTo:n,dismissable:b,keepModalOpen:!0,onLoaded:w,onModalVisibleChange:S,proxy:!0,ref:f,src:E,sandbox:!0,variant:"checkoutModal",scrolling:"no"})},Te=({shopCheckoutModal:e,eventName:t,eventListener:o})=>{i(()=>(e?.addEventListener(t,o),()=>e?.removeEventListener(t,o)),[o,t,e])};function Ae({email:n,open:s,popoverActivator:c,popoverAnchorSelector:u,showPopover:d,showToggle:f,onIframeLoaded:h,automaticVerificationEnabled:k=!0}){const w=c?.current,E=l(null),[b,P]=o(!1),_=a(!1),{client:M,shop:{myshopifyDomain:L,storefrontUrl:I},shopPay:T,source:A,checkout:{wallets:x,negotiator:N}}=p(),{throttleState:V,current:D}=N,{redirectUrl:j,transactionParams:U}=T.config,B=D.fields.buyerIdentity.value?.customerProfile,{inMemoryPayPalParts:{accountStatus:H}}=v(),{isDismissedGuestModal:z}=O(),$=ye({element:c}),W=t(()=>V.peek().token,[V]),{value:G}=C(),{checkoutProtocolModalEventSignal:q}=N.context,Q=R(y.ShopPayVerification,{scope:g(A)}),J=`${A.checkoutSessionIdentifier}-${n.replace(/[^a-zA-Z0-9]/g,"")}`,Y=F().value,X=a(Y);i(()=>{if(X.current)return X.current=!1,void P(!1);const e=z(),t=B&&M.cookies.get(J),o="connected"===H.value.status;if(!(e||t||o))return Q.value===K.Verified?(Q.value=void 0,void P(!1)):void P(!0);P(!1)},[n]);const Z=e(()=>{S(),Q.value=K.Verified,q.value="none"},[q,Q]);Te({shopCheckoutModal:E.value,eventName:"completed",eventListener:Z});const ee=e(()=>{if(!A.checkoutSessionIdentifier)throw new m({groupingHash:"ShopPayCheckoutIdentifierMissingError::ShopJSVerification"});T.setUserIdentified(escape(A.checkoutSessionIdentifier)),window.dispatchEvent(new Event("shop_pay_user_identified_cookie_set")),Q.value=K.Pending,d?.(!0,n),f?.(!1)},[A.checkoutSessionIdentifier,n,T,Q,d,f]);Te({shopCheckoutModal:E.value,eventName:"modalopened",eventListener:ee});const te=e(()=>
1{Q.value=K.Dismissed,B&&M.cookies.set(J,"true"),d?.(!1),f?.(_.current),P(!1),$()},[B,J,Q,d,f,$,M.cookies]);Te({shopCheckoutModal:E.value,eventName:"modalclosed",eventListener:te});const oe=e(()=>{_.current=!0},[]);Te({shopCheckoutModal:E.value,eventName:"shopusermatched",eventListener:oe});const ne=e(e=>{_.current=!1,T.setUserIdentified(null),window.dispatchEvent(new Event("shop_pay_user_identified_cookie_set"))},[T]);Te({shopCheckoutModal:E.value,eventName:"shopusernotmatched",eventListener:ne}),Te({shopCheckoutModal:E.value,eventName:"loaded",eventListener:h}),i(()=>{w&&s&&(E.peek()?.open(),w.blur())},[w,n,s,E]),i(()=>{if(s)return q.value="shopPayVerification",()=>{q.value="none"}},[q,s]);const re=s||k&&b?n:"";if(!j||x.activeSession.value)return null;const ae=w?.id?`input#${ie=w.id,"undefined"!=typeof CSS&&CSS.escape?CSS.escape(ie):ie}`:"";var ie;return r("shop-checkout-modal",{"anchor-to":u??ae,"checkout-redirect-url":j,"checkout-token":A.checkoutSessionIdentifier,"checkout-version":"checkout_one",email:re,"prevent-overlay-dismiss-on-click":!0,"queue-token":W||"","total-due":G?.amount?.toString()||"0",ref:E,"shop-permanent-domain":L,"transaction-params":U,"storefront-domain":I})}"undefined"==typeof window||"undefined"==typeof customElements||customElements.get("shop-checkout-modal")||se(({element:e,...t})=>r(pe,{element:e,featureName:"ShopCheckoutModal",children:r(ce,{children:r(ue,{monorailProps:Le(t),children:r(le,{children:r(de,{children:r(Ie,{...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",shopifyEssential:"string",totalDue:"string",transactionParams:"string",storefrontDomain:"string"},shadow:"open"});const xe=e=>r(u,{children:r(Ae,{...e})}),Ne=({email:o,onSetEmail:n,open:s,popoverActivator:c,popoverAnchorSelector:u,showPopover:l,showToggle:m,urlOrigin:f=L.C1Modal,updatedOrigin:h=L.C1Modal})=>{const{shopPay:{user:{hasFlow:v}},embed:g,webMcp:y,checkout:{identity:w},observability:S}=p(),E="shopPay"===w.current.value,b=y?.hasToolCallStarted.value??!1,P=!g&&(E||!b),_=ye({element:c});d(()=>{const e=y?.hasToolCallStarted.value;e&&s&&!E&&(l(!1),_())});const M=t(()=>I(),[]),C=t(()=>I(),[]),T=a(!0),A=t(()=>({isC1:!0,shopJsVerification:!E}),[E]);i(()=>{k(o)&&(M.mark("start"),T.current=!0)},[M,o]),i(()=>{if(s&&T.current&&M.marks.start&&A){M.mark("open"),T.current=!1;const e=Math.round(M.marks.open-M.marks.start);S.histogram({name:"shop_pay_verification_time_to_interactive",value:e,attributes:A});const t=Math.round(M.marks.open-Math.max(M.marks.start,M.marks.loaded||0));S.histogram({name:"shop_pay_verification_time_to_interactive_after_load",value:t,attributes:A})}},[s,S,M,A]),i(()=>{C.mark("start")},[C]);const x=e(()=>{if(C.marks.start){C.mark("loaded"),M.mark("loaded");const e=Math.round(C.marks.loaded-C.marks.start);S.histogram({name:"shop_pay_verification_iframe_ready_duration",value:e,attributes:A})}},[C,M,S,A]);return E&&!v.value?null:E?r(Ce,{popoverActivator:c,email:o,onSetEmail:n,open:s,showPopover:l,showToggle:m,urlOrigin:f,updatedOrigin:h,onIframeLoaded:x,automaticVerificationEnabled:P}):b&&!s?null:r(xe,{popoverActivator:c,popoverAnchorSelector:u,email:o,open:s,showPopover:l,showToggle:m,onIframeLoaded:x,automaticVerificationEnabled:P})};export{Ne 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.