1import{u as b,r as o,j as e}from"./index-C8T3vEcn.js";const l="[email protected]";function v(){const[,x]=b(),[g,h]=o.useState("request"),[d,f]=o.useState(""),[c,t]=o.useState(""),[m,u]=o.useState(""),[s,n]=o.useState(!1),p=async a=>{a.preventDefault(),t(""),u(""),n(!0);try{const r=await fetch("/api/auth/manager/request-otp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:l})}),i=await r.json();if(!r.ok){t(i.message||"Could not send the code. Please try again.");return}h("verify"),u(`A 6-digit code was sent to ${l}.`)}catch{t("Something went wrong. Please try again.")}finally{n(!1)}},y=async a=>{if(a.preventDefault(),t(""),d.trim().length!==6){t("Enter the 6-digit code from the email.");return}n(!0);try{const r=await fetch("/api/auth/manager/verify-otp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:l,otp:d.trim()})}),i=await r.json();if(!r.ok){t(i.message||"Invalid code.");return}localStorage.setItem("em_token",i.token),x("/_event_mgr_dashboard")}catch{t("Something went wrong. Please try again.")}finally{n(!1)}};return e.jsx("div",{className:"min-h-screen bg-gray-950 flex items-center justify-center px-4",children:e.jsx("div",{className:"w-full max-w-sm",children:e.jsxs("div",{className:"bg-gray-900 border border-gray-800 rounded-xl shadow-2xl p-8",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-6",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-gradient-to-br from-purple-500 to-fuchsia-600 flex items-center justify-center",children:e.jsx("svg",{className:"w-5 h-5 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),e.jsx("h1",{className:"text-xl font-semibold text-white",children:"Event Manager"})]}),c&&e.jsx("div",{className:"mb-4 px-3 py-2 bg-red-500/10 border border-red-500/30 text-red-400 text-sm rounded-lg","data-testid":"em-login-error",children:c}),m&&!c&&e.jsx("div",{className:"mb-4 px-3 py-2 bg-purple-500/10 border border-purple-500/30 text-purple-300 text-sm rounded-lg","data-testid":"em-login-info",children:m}),g==="request"?e.jsxs("form",{onSubmit:p,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-300 mb-1",children:"Manager Email"}),e.jsx("input",{type:"email",value:l,readOnly:!0,className:"w-full px-3 py-2.5 bg-gray-800/60 border border-gray-700 rounded-lg text-sm text-gray-300 cursor-not-allowed","data-testid":"em-login-email"}),e.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"A sign-in code will be sent to this inbox."})]}),e.jsx("button",{type:"submit",disabled:s,className:"w-full py-2.5 px-4 bg-gradient-to-r from-purple-500 to-fuchsia-600 hover:from-purple-600 hover:to-fuchsia-700 text-white text-sm font-medium rounded-lg transition-all disabled:opacity-50","data-testid":"em-login-submit",children:s?"Sending code...":"Send Code"})]}):e.jsxs("form",{onSubmit:y,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"em-otp",className:"block text-sm font-medium text-gray-300 mb-1",children:"Verification Code"}),e.jsx("input",{id:"em-otp",type:"text",inputMode:"numeric",autoComplete:"one-time-code",maxLength:6,value:d,onChange:a=>f(a.target.value.replace(/\D/g,"")),disabled:s,placeholder:"000000",className:"w-full px-3 py-2.5 bg-gray-800 border border-gray-700 rounded-lg text-sm text-white tracking-[0.5em] text-center placeholder-gray-600 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent disabled:opacity-50","data-testid":"em-login-otp"})]}),e.jsx("button",{type:"submit",disabled:s,className:"w-full py-2.5 px-4 bg-gradient-to-r from-purple-500 to-fuchsia-600 hover:from-purple-600 hover:to-fuchsia-700 text-white text-sm font-medium rounded-lg transition-all disabled:opacity-50","data-testid":"em-login-submit",children:s?"Verifying...":"Verify & Sign In"}),e.jsx("button",{type:"button",onClick:p,disabled:s,className:"w-full text-xs text-purple-400 hover:text-purple-300 disabled:opacity-50","data-testid":"em-login-resend",children:"Resend code"})]}),e.jsx("p",{className:"mt-6 text-center text-xs text-gray-600",children:"Authorized personnel only"})]})})})}export{v 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.