1import{w as b,a as o,q as k}from"./chunk-OE4NN4TA-BenRlXdM.js";import{j as e}from"./jsx-runtime-D_zvdyIk.js";import{u as S,g as f,c as C}from"./use-auth-bJU5yq9E.js";import{B as m}from"./button-CTa4yazt.js";import{I as j}from"./input-DpncSzF1.js";import"./auth-0DWDKJ4Q.js";import"./tslib.es6-De9GV7Vy.js";import"./posthog-CmwHPb0E.js";import"./utils-DUm1yI1Y.js";const P=b(function(){const{user:d,loading:u,signInWithGoogle:v,sendEmailLink:y,completeEmailLinkSignIn:x,isEmailLink:g}=S(),[a,p]=o.useState(""),[h,i]=o.useState(null),[c,l]=o.useState("sign-in"),[r,n]=o.useState(!1);if(o.useEffect(()=>{if(u||d||!g(window.location.href))return;const s=f();s?(l("completing"),x(s,window.location.href).catch(t=>{i(t instanceof Error?t.message:"Email link sign-in failed"),l("sign-in"),C()})):l("completing")},[u,d,g,x]),u)return e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx("div",{className:"text-muted-foreground",children:"Loading..."})});if(d)return e.jsx(k,{to:"/dashboard",replace:!0});async function N(){i(null),n(!0);try{await v()}catch(s){i(s instanceof Error?s.message:"Google sign-in failed")}finally{n(!1)}}async function w(s){s.preventDefault(),i(null),n(!0);try{await y(a),l("email-sent")}catch(t){i(t instanceof Error?t.message:"Failed to send sign-in link")}finally{n(!1)}}async function E(s){s.preventDefault(),i(null),n(!0);try{await x(a,window.location.href)}catch(t){i(t instanceof Error?t.message:"Email link sign-in failed")}finally{n(!1)}}return e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsxs("div",{className:"w-full max-w-sm space-y-6 px-4 py-12",children:[e.jsxs("div",{className:"space-y-2 text-center",children:[e.jsx("h1",{className:"font-bold text-2xl",children:"Sign in to Bubble Goods"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Continue with Google or get a sign-in link by email."})]}),c==="sign-in"&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(m,{variant:"outline",className:"w-full",onClick:N,disabled:r,children:[e.jsx(B,{}),"Continue with Google"]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"or"})})]}),e.jsxs("form",{onSubmit:w,className:"space-y-3",children:[e.jsx(j,{type:"email",value:a,onChange:s=>p(s.target.value),required:!0,placeholder:"[email protected]"}),e.jsx(m,{type:"submit",variant:"secondary",className:"w-full",disabled:r,children:r?"Sending...":"Send sign-in link"})]})]}),c==="email-sent"&&e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsxs("p",{className:"text-sm",children:["We sent a sign-in link to ",e.jsx("strong",{children:a}),". Check your email and click the link to sign in."]}),e.jsx(m,{variant:"ghost",className:"w-full",onClick:()=>{l("sign-in"),i(null)},children:"Back to sign in"})]}),c==="completing"&&!f()&&e.jsxs("form",{onSubmit:E,className:"space-y-4",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Enter your email to complete sign-in."}),e.jsx(j,{type:"email",value:a,onChange:s=>p(s.target.value),required:!0,placeholder:"[email protected]",autoFocus:!0}),e.jsx(m,{type:"submit",className:"w-full",disabled:r,children:r?"Signing in...":"Complete sign-in"})]}),c==="completing"&&f()&&e.jsx("div",{className:"text-center text-muted-foreground text-sm",children:"Completing sign-in..."}),h&&e.jsx("p",{className:"text-center text-destructive text-sm",children:h})]})})});function B(){return e.jsxs("svg",{className:"mr-2 size-4",viewBox:"0 0 24 24","aria-hidden":"true",children:[e.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z",fill:"#4285F4"}),e.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),e.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),e.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]})}
vendor: 22 bytes, line 1
1export{P 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.