1import{i as L,e as _,P,r as t,j as e,f as x,d as v,B as N,Q as T,m as F,n as O,b,I as k}from"./index-Ct8eLu1I.js";import{P as D}from"./password-input-DW2M4R6A.js";import{E as z}from"./ExistingAccountResetHelper-DlBMMj0u.js";import{T as H}from"./triangle-alert-DJpcx1Nd.js";import{S as R}from"./shield-DH9kevRQ.js";import{o as q,s as w}from"./types-3c7sL9OC.js";import"./eye-off-D8k5J7Ic.js";import"./eye-BX6Kc3UM.js";import"./circle-check-big-B2qMybdU.js";import"./key-round-CQA2_xI6.js";import"./mail-BgXQiqCk.js";const B=q({email:w().email("Invalid email address"),password:w().min(6,"Password must be at least 6 characters")}),$=()=>{const g=L(),{user:s,signIn:y,signOut:S,isAdmin:r,isSuperAdmin:l,loading:o,isAdminLoading:c}=_(),{toast:d}=P(),[h,p]=t.useState(!1),[i,E]=t.useState(""),[m,A]=t.useState(""),[u,f]=t.useState(null);t.useEffect(()=>{s&&!o&&!c&&(r||l)&&g("/admin")},[s,o,c,r,l,g]);const I=async()=>{await S(),d({title:"Signed Out",description:"You have been signed out."})},C=async a=>{a.preventDefault();const j=B.safeParse({email:i,password:m});if(!j.success){d({title:"Validation Error",description:j.error.errors[0].message,variant:"destructive"});return}p(!0);const{error:n}=await y(i,m);p(!1),n?(n.message==="Invalid login credentials"&&f({email:i,reason:"login"}),d({title:"Login Failed",description:n.message==="Invalid login credentials"?"That email and password combination didn't work.":n.message,variant:"destructive"})):f(null)};return o||s&&c?e.jsx(x,{showFooter:!1,children:e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsx(v,{className:"h-8 w-8 animate-spin text-primary"})})}):s&&!r&&!l?e.jsx(x,{showFooter:!1,children:e.jsxs("section",{className:"min-h-screen flex items-center justify-center py-12 bg-background",children:[e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,hsl(24_100%_50%/0.1),transparent_70%)]"}),e.jsx("div",{className:"container mx-auto px-4 relative z-10",children:e.jsxs("div",{className:"max-w-md mx-auto text-center",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 bg-muted rounded-xl mb-4",children:e.jsx(H,{className:"h-8 w-8 text-destructive"})}),e.jsx("h1",{className:"font-display text-3xl text-foreground mb-2",children:"ACCESS DENIED"}),e.jsxs("p",{className:"text-muted-foreground mb-2",children:["You are signed in as ",e.jsx("span",{className:"font-medium text-foreground",children:s.email})]}),e.jsx("p",{className:"text-muted-foreground mb-8",children:"This account does not have admin access. If you believe this is an error, please contact your organization administrator."}),e.jsxs(N,{onClick:I,variant:"outline",className:"gap-2",children:[e.jsx(T,{className:"h-4 w-4"}),"Sign Out & Try Another Account"]})]})})]})}):e.jsx(x,{children:e.jsxs("section",{className:"relative min-h-[calc(100vh-5rem)] flex items-center justify-center py-12 bg-background",children:[e.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(ellipse_at_center,hsl(24_100%_50%/0.1),transparent_70%)]"}),e.jsx("div",{className:"container mx-auto px-4 relative z-10",children:e.jsxs("div",{className:"max-w-md mx-auto",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 bg-gradient-fire rounded-xl mb-4",children:e.jsx(R,{className:"h-8 w-8 text-primary-foreground"})}),e.jsx("h1",{className:"font-display text-3xl text-foreground",children:"ADMIN ACCESS"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"Sign in to manage events and registrations"})]}),e.jsx(F,{className:"bg-card border-border",children:e.jsxs(O,{className:"pt-6",children:[e.jsxs("form",{onSubmit:C,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"login-email",children:"Email"}),e.jsx(k,{id:"login-email",type:"email",placeholder:"[email protected]",value:i,onChange:a=>E(a.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"login-password",children:"Password"}),e.jsx(D,{id:"login-password",value:m,onChange:a=>A(a.target.value),required:!0})]}),e.jsx(N,{type:"submit",className:"w-full bg-gradient-fire hover:opacity-90",disabled:h,children:h?e.jsxs(e.Fragment,{children:[e.jsx(v,{className:"mr-2 h-4 w-4 animate-spin"}),"Signing In..."]}):"Sign In"})]}),u&&e.jsx(z,{email:u.email,reason:u.reason})]})})]})})]})})};export{$ 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.