1import{r as i,m as w,n as S,j as e,B as b,s as y,a as L,b as T,i as P,k as E,o as F,d as k}from"./index-W0KA7IcG.js";import{T as I,a as q,b as v,c as j}from"./tabs-BKowU14Q.js";import{I as m}from"./input-DlY2gDjb.js";import{L as u}from"./label-DWvXudXq.js";import{o as C,s as p,Z as N}from"./types-BizLx0hG.js";import{N as D}from"./NoIndex-hbVhOfcj.js";import W from"./Footer-JUIJCKid.js";import"./index-DRjHTK5m.js";import"./index-CEhl5HCv.js";import"./linkedin-CCoSYAV8.js";const A=C({email:p().trim().email("Invalid email address").max(255,"Email must be less than 255 characters"),password:p().min(8,"Password must be at least 8 characters").max(100,"Password must be less than 100 characters")}),U=()=>{const[n,h]=i.useState(""),[l,g]=i.useState(""),[o,d]=i.useState(!1),{toast:r}=w(),x=S(),c=async t=>{t.preventDefault(),d(!0);try{const s=A.parse({email:n,password:l}),{error:a}=await y.auth.signInWithPassword({email:s.email,password:s.password});a?r({variant:"destructive",title:"Login failed",description:a.message}):(r({title:"Welcome back!",description:"You've successfully logged in."}),x("/admin"))}catch(s){s instanceof N&&r({variant:"destructive",title:"Validation failed",description:s.errors[0].message})}finally{d(!1)}};return e.jsxs("form",{onSubmit:c,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{htmlFor:"email",children:"Email"}),e.jsx(m,{id:"email",type:"email",value:n,onChange:t=>h(t.target.value),required:!0})]}),e.jsxs("div",{children:[e.jsx(u,{htmlFor:"password",children:"Password"}),e.jsx(m,{id:"password",type:"password",value:l,onChange:t=>g(t.target.value),required:!0})]}),e.jsx(b,{type:"submit",disabled:o,className:"w-full",children:o?"Logging in...":"Log In"})]})},V=C({name:p().trim().min(1,"Name is required").max(100,"Name must be less than 100 characters"),email:p().trim().email("Invalid email address").max(255,"Email must be less than 255 characters"),password:p().min(8,"Password must be at least 8 characters").max(100,"Password must be less than 100 characters").regex(/[A-Z]/,"Password must contain at least one uppercase letter").regex(/[0-9]/,"Password must contain at least one number")}),Z=()=>{const[n,h]=i.useState(""),[l,g]=i.useState(""),[o,d]=i.useState(""),[r,x]=i.useState(!1),{toast:c}=w(),t=async s=>{s.preventDefault(),x(!0);try{const a=V.parse({name:n,email:l,password:o}),{error:f}=await y.auth.signUp({email:a.email,password:a.password,options:{emailRedirectTo:`${window.location.origin}/`,data:{display_name:a.name}}});f?c({variant:"destructive",title:"Signup failed",description:f.message}):(c({title:"Check your email!",description:"We've sent you a confirmation link. Please verify your email before logging in."}),h(""),g(""),d(""))}catch(a){a instanceof N&&c({variant:"destructive",title:"Validation failed",description:a.errors[0].message})}finally{x(!1)}};return e.jsxs("form",{onSubmit:t,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{htmlFor:"signup-name",children:"Full Name"}),e.jsx(m,{id:"signup-name",type:"text",value:n,onChange:s=>h(s.target.value),required:!0,placeholder:"Your full name"})]}),e.jsxs("div",{children:[e.jsx(u,{htmlFor:"signup-email",children:"Email"}),e.jsx(m,{id:"signup-email",type:"email",value:l,onChange:s=>g(s.target.value),required:!0})]}),e.jsxs("div",{children:[e.jsx(u,{htmlFor:"signup-password",children:"Password"}),e.jsx(m,{id:"signup-password",type:"password",value:o,onChange:s=>d(s.target.value),required:!0,minLength:6})]}),e.jsx(b,{type:"submit",disabled:r,className:"w-full",children:r?"Creating account...":"Sign Up"})]})},M=()=>e.jsxs("div",{className:"min-h-screen flex flex-col bg-gradient-to-br from-background to-muted",children:[e.jsx(D,{title:"Admin Login â Cleveland Tech Week"}),e.jsx(L,{}),e.jsx("main",{className:"flex-1 flex items-center justify-center p-4 pt-28 pb-16",children:e.jsxs(T,{className:"w-full max-w-md",children:[e.jsxs(P,{children:[e.jsx(E,{children:"Cleveland Tech Week Admin"}),e.jsx(F,{children:"Login or create an account to manage event photos"})]}),e.jsx(k,{children:e.jsxs(I,{defaultValue:"login",className:"w-full",children:[e.jsxs(q,{className:"grid w-full grid-cols-2",children:[e.jsx(v,{value:"login",children:"Login"}),e.jsx(v,{value:"signup",children:"Sign Up"})]}),e.jsx(j,{value:"login",children:e.jsx(U,{})}),e.jsx(j,{value:"signup",children:e.jsx(Z,{})})]})})]})}),e.jsx(W,{})]});
1export{M 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.