import{T as _,c as b,n as E}from"./dist-vendor.a3kfnPsb.js";import{a as d,ah as k,u as O,c6 as A,f$ as T,S as N,cr as R,h as C,kE as I,fX as B,b as U,at as v,cs as f}from"./shop-pay-FullScreenBackground.wUQlmEwa.js";import{L,bI as u}from"./shop-pay-ButtonWithRegisterWebPixel.DNiJgoKP.js";const j="theme",z="context";function W(){const{mobileCheckoutSdk:o}=d();if(!o.enabled)return!1;const t=o.config?.colorScheme,n=!!(typeof window<"u"&&window.matchMedia?.("(prefers-color-scheme: dark)")?.matches);return t==="DARK"||o.variant.isStandard()&&t==="AUTOMATIC"&&n}const D=o=>({backgroundColor:t,foregroundColor:n})=>{const s=P(t),e=P(n),r=Math.max(s,e),a=Math.min(s,e),i=(r+.05)/(a+.05);return{isValidContrast:i>=o,ratio:Math.round(i*100)/100}},F=D(3.06);function P(o){const n=o.toRgbTuple().map(s=>{const e=s/255;return e<=.04045?e/12.92:((e+.055)/1.055)**2.4});return .2126*n[0]+.7152*n[1]+.0722*n[2]}const Q=(o,t,n)=>o*.299+t*.587+n*.114,h=new A(0,0,100);function V({foregroundColor:o,backgroundColor:t,section:n="main"}){const s=k(),{colors:e}=O(),r=s[n];let a=h;if(t!==void 0)a=t;else if(r.colorScheme==="inherit"){const{background:c,colorScheme:l}=s.canvas;l&&c!=="transparent"&&(a=e.schemes?.[l]?.base?.background??h)}else{const c=r.colorScheme;a=c?e.schemes?.[c]?.base?.background??h:h}const{isValidContrast:i}=_(()=>F({backgroundColor:a,foregroundColor:o}),[a,o]);return i}const M="_0mzUL",p={Button:M,"Button--dark":"_6W0f3","Button--contrast":"aFsKX","Button--progressing":"XVUQD"};function w({progressing:o=!1}={}){const t=V({foregroundColor:N}),n=W(),s=d().shopPay.app.config,e=T(s,n);return _(()=>b(p.Button,{[p["Button--contrast"]]:!t&&!e,[p["Button--dark"]]:e,[p["Button--progressing"]]:o}),[e,t,o])}function Y(){const{shopPay:o}=d(),t=o.session.isInternalProgressing;return w({progressing:t})}const m=u.Control,H=u.UnauthenticatedCheckout,x=u.UnauthenticatedCheckout,$=[u.UnauthenticatedCheckout];function q(){const{currentUrl:o}=E(),{shopPay:{isActive:t},source:{type:n}}=d(),s=o.searchParams.get(R),e=C(I),r=C(B),a=U().buyerIdentity.value?.customerProfile!=null,i=["draftOrder","simulated"],c=v(o.search),l=c&&e||r,y=![f.ShopPayAsPaymentMethod,f.ShopPayInstallmentsAsPaymentMethod].includes(s),g=t&&y&&!i.includes(n)&&(!a||l),S=L({disabled:!g,key:"shop_pay_new_signup_login_variant",variants:Object.values(u)});return g?S||(c?e?x:m:r?H:m):m}export{$ as U,W as a,j as b,Q as c,Y as d,V as e,w as f,z as s,q as u};
