1import{r as s,u as e,p as a,j as t,a6 as r,a7 as i,W as l}from"./vendor-DKpN-gn6.js";import{u as n,e as d,B as c}from"./index-CjqWG2Gu.js";import{C as m,b as o,c as u,d as x,a as j,e as h}from"./card-C0twyzQf.js";import{I as p}from"./input-BczSeZo5.js";import{L as f}from"./label-D75N5ztj.js";import{A as g,a as v}from"./alert-CTiCasZu.js";import"./auth-D0Oxv0aP.js";import"./ui-DbiJ6HOd.js";const b=()=>{const[b,y]=s.useState(""),[N,w]=s.useState(""),[S,L]=s.useState(!1),[A,C]=s.useState(null),[I,B]=s.useState(!1),{toast:P}=n(),q=e(),D=a(),{user:E,isAdmin:F,signIn:J,isLoading:W}=d(),k=D.state?.message;s.useEffect((()=>{E&&F&&!W&&q("/admin")}),[E,F,W,q]);return W?t.jsx("div",{className:"flex items-center justify-center min-h-screen bg-gray-100",children:t.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-brand-purple"})}):t.jsx("div",{className:"flex items-center justify-center min-h-screen bg-gray-100",children:t.jsx("div",{className:"w-full max-w-md p-4",children:t.jsxs(m,{children:[t.jsxs(o,{className:"text-center",children:[t.jsx(u,{className:"text-2xl",children:"BrandJitsu⢠Admin"}),t.jsx(x,{children:"Login to access the admin dashboard"})]}),(A||k)&&t.jsx("div",{className:"px-6",children:t.jsxs(g,{variant:"destructive",children:[t.jsx(r,{className:"h-4 w-4"}),t.jsx(v,{children:A||k})]})}),t.jsxs("form",{onSubmit:async s=>{s.preventDefault(),L(!0),C(null);try{await J(b,N),P({title:"Login Successful",description:"Welcome to BrandJitsu Admin Panel"})}catch(e){C("Invalid credentials. Please try again.")}finally{L(!1)}},children:[t.jsxs(j,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx(f,{htmlFor:"email",children:"Email"}),t.jsx(p,{id:"email",type:"email",placeholder:"[email protected]",value:b,onChange:s=>y(s.target.value),required:!0})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(f,{htmlFor:"password",children:"Password"}),t.jsxs("div",{className:"relative",children:[t.jsx(p,{id:"password",type:I?"text":"password",value:N,onChange:s=>w(s.target.value),required:!0}),t.jsx("button",{type:"button",className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500 focus:outline-none",onClick:()=>{B(!I)},tabIndex:-1,children:I?t.jsx(i,{className:"h-5 w-5"}):t.jsx(l,{className:"h-5 w-5"})})]})]})]}),t.jsx(h,{children:t.jsx(c,{type:"submit",className:"w-full",disabled:S,children:S?"Logging in...":"Login"})})]})]})})})};export{b 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.