1import{c as k,n as E,r as d,t as h,a as l,j as e,B as A}from"./index-CZE7ptUD.js";import{I as D}from"./input-Vep9kJkm.js";import{M as v}from"./mail-Bq9Wxw8b.js";import{L as b}from"./loader-circle-wSCocstw.js";import{S as F}from"./shield-check-BfF-hc5g.js";import{A as M}from"./arrow-left-3lcFBsx3.js";import"./x-B64YwYlD.js";/** 2 * @license lucide-react v0.453.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const P=k("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);function T(){const[,u]=E(),[j,p]=d.useState("email"),[a,y]=d.useState(""),[o,r]=d.useState(["","","","","",""]),c=d.useRef([]),x=h.auth.requestCode.useMutation({onSuccess:t=>{p("code"),l.success("Code sent! Check your email."),t.devCode&&l.info(`Dev mode: your code is ${t.devCode}`,{duration:3e4}),setTimeout(()=>c.current[0]?.focus(),100)},onError:t=>{l.error(t.message||"Failed to send code. Please try again.")}}),L=h.useUtils(),g=h.auth.verifyCode.useMutation({onSuccess:async t=>{l.success("Signed in successfully!"),await L.auth.agentMe.invalidate(),t.isAdmin||t.isStaff?u("/admin"):u("/crm")},onError:t=>{l.error(t.message||"Invalid code. Please try again."),r(["","","","","",""]),setTimeout(()=>c.current[0]?.focus(),100)}}),C=t=>{t.preventDefault(),a.trim()&&x.mutate({email:a.trim().toLowerCase()})},N=(t,s)=>{const n=s.replace(/\D/g,"").slice(-1),m=[...o];if(m[t]=n,r(m),n&&t<5&&c.current[t+1]?.focus(),n&&t===5){const f=[...m].join("");f.length===6&&g.mutate({email:a,code:f})}},w=(t,s)=>{s.key==="Backspace"&&!o[t]&&t>0&&c.current[t-1]?.focus(),s.key==="ArrowLeft"&&t>0&&c.current[t-1]?.focus(),s.key==="ArrowRight"&&t<5&&c.current[t+1]?.focus()},B=t=>{t.preventDefault();const s=t.clipboardData.getData("text").replace(/\D/g,"").slice(0,6);s.length===6&&(r(s.split("")),g.mutate({email:a,code:s}))},S=t=>{t.preventDefault();const s=o.join("");if(s.length!==6){l.error("Please enter all 6 digits.");return}g.mutate({email:a,code:s})},i=x.isPending||g.isPending;return e.jsxs("div",{"data-loc":"client/src/pages/AgentLogin.tsx:118",className:"min-h-screen bg-gradient-to-br from-[#1B3A6B] via-[#1e4080] to-[#0f2347] flex items-center justify-center p-4",children:[e.jsx("div",{"data-loc":"client/src/pages/AgentLogin.tsx:120",className:"absolute inset-0 opacity-5",style:{backgroundImage:`url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E")`}}),e.jsxs("div",{"data-loc":"client/src/pages/AgentLogin.tsx:127",className:"relative w-full max-w-md",children:[e.jsxs("div",{"data-loc":"client/src/pages/AgentLogin.tsx:129",className:"bg-white rounded-2xl shadow-2xl overflow-hidden",children:[e.jsxs("div",{"data-loc":"client/src/pages/AgentLogin.tsx:131",className:"bg-[#1B3A6B] px-5 sm:px-8 py-5 sm:py-7 text-center",children:[e.jsx("img",{"data-loc":"client/src/pages/AgentLogin.tsx:132",src:"/manus-storage/fastpicras-logo_97716f2b.png",alt:"Fast PICRAs",className:"h-12 mx-auto mb-3 object-contain"}),e.jsx("h1",{"data-loc":"client/src/pages/AgentLogin.tsx:137",className:"text-white font-bold text-xl",children:"Agent Portal"}),e.jsx("p",{"data-loc":"client/src/pages/AgentLogin.tsx:138",className:"text-[#C8A84B] text-sm mt-1",children:"Fast PICRAs CRM Dashboard"})]}),e.jsx("div",{"data-loc":"client/src/pages/AgentLogin.tsx:142",className:"px-5 sm:px-8 py-6 sm:py-8",children:j==="email"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-loc":"client/src/pages/AgentLogin.tsx:145",className:"flex items-center gap-3 mb-6",children:[e.jsx("div",{"data-loc":"client/src/pages/AgentLogin.tsx:146",className:"w-10 h-10 rounded-full bg-[#1B3A6B]/10 flex items-center justify-center flex-shrink-0",children:e.jsx(v,{"data-loc":"client/src/pages/AgentLogin.tsx:147",className:"w-5 h-5 text-[#1B3A6B]"})}),e.jsxs("div",{"data-loc":"client/src/pages/AgentLogin.tsx:149",children:[e.jsx("h2",{"data-loc":"client/src/pages/AgentLogin.tsx:150",className:"font-bold text-gray-900 text-lg leading-tight",children:"Sign In"}),e.jsx("p",{"data-loc":"client/src/pages/AgentLogin.tsx:151",className:"text-gray-500 text-sm",children:"Enter your agent email to receive a login code"})]})]}),e.jsxs("form",{"data-loc":"client/src/pages/AgentLogin.tsx:155",onSubmit:C,className:"space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/AgentLogin.tsx:156",children:[e.jsx("label",{"data-loc":"client/src/pages/AgentLogin.tsx:157",className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Agent Email Address"}),e.jsx(D,{"data-loc":"client/src/pages/AgentLogin.tsx:160",type:"email",placeholder:"[email protected]",value:a,onChange:t=>y(t.target.value),autoFocus:!0,required:!0,disabled:i,className:"h-11 text-base border-gray-300 focus:border-[#1B3A6B] focus:ring-[#1B3A6B]"})]}),e.jsx(A,{"data-loc":"client/src/pages/AgentLogin.tsx:172",type:"submit",disabled:i||!a.trim(),className:"w-full h-11 bg-[#C8A84B] hover:bg-[#b8963d] text-white font-semibold text-base transition-all",children:i?e.jsxs(e.Fragment,{children:[e.jsx(b,{"data-loc":"client/src/pages/AgentLogin.tsx:179",className:"w-4 h-4 mr-2 animate-spin"}),"Sending Codeâ¦"]}):e.jsxs(e.Fragment,{children:[e.jsx(v,{"data-loc":"client/src/pages/AgentLogin.tsx:184",className:"w-4 h-4 mr-2"}),"Send Login Code"]})})]}),e.jsx("p",{"data-loc":"client/src/pages/AgentLogin.tsx:191",className:"text-center text-xs text-gray-400 mt-5",children:"A 6-digit code will be emailed to you. No password required."})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-loc":"client/src/pages/AgentLogin.tsx:197",className:"flex items-center gap-3 mb-6",children:[e.jsx("div",{"data-loc":"client/src/pages/AgentLogin.tsx:198",className:"w-10 h-10 rounded-full bg-[#C8A84B]/10 flex items-center justify-center flex-shrink-0",children:e.jsx(P,{"data-loc":"client/src/pages/AgentLogin.tsx:199",className:"w-5 h-5 text-[#C8A84B]"})}),e.jsxs("div",{"data-loc":"client/src/pages/AgentLogin.tsx:201",children:[e.jsx("h2",{"data-loc":"client/src/pages/AgentLogin.tsx:202",className:"font-bold text-gray-900 text-lg leading-tight",children:"Enter Your Code"}),e.jsxs("p",{"data-loc":"client/src/pages/AgentLogin.tsx:203",className:"text-gray-500 text-sm",children:["Code sent to ",e.jsx("span",{"data-loc":"client/src/pages/AgentLogin.tsx:204",className:"font-medium text-[#1B3A6B]",children:a})]})]})]}),e.jsxs("form",{"data-loc":"client/src/pages/AgentLogin.tsx:209",onSubmit:S,className:"space-y-6",children:[e.jsxs("div",{"data-loc":"client/src/pages/AgentLogin.tsx:211",children:[e.jsx("label",{"data-loc":"client/src/pages/AgentLogin.tsx:212",className:"block text-sm font-medium text-gray-700 mb-3 text-center",children:"6-Digit Login Code"}),e.jsx("div",{"data-loc":"client/src/pages/AgentLogin.tsx:215",className:"flex gap-1.5 sm:gap-2 justify-center",onPaste:B,children:o.map((t,s)=>e.jsx("input",{"data-loc":"client/src/pages/AgentLogin.tsx:217",ref:n=>{c.current[s]=n},type:"text",inputMode:"numeric",maxLength:1,value:t,onChange:n=>N(s,n.target.value),onKeyDown:n=>w(s,n),disabled:i,className:` 7 w-10 h-12 sm:w-11 sm:h-14 text-center text-xl sm:text-2xl font-bold rounded-lg border-2 outline-none 8 transition-all duration-150 9 ${t?"border-[#C8A84B] bg-[#C8A84B]/5 text-[#1B3A6B]":"border-gray-300 text-gray-900"} 10 focus:border-[#1B3A6B] focus:ring-2 focus:ring-[#1B3A6B]/20 11 disabled:opacity-50 12 `},s))})]}),e.jsx(A,{"data-loc":"client/src/pages/AgentLogin.tsx:242",type:"submit",disabled:i||o.join("").length!==6,className:"w-full h-11 bg-[#1B3A6B] hover:bg-[#152d55] text-white font-semibold text-base",children:i?e.jsxs(e.Fragment,{children:[e.jsx(b,{"data-loc":"client/src/pages/AgentLogin.tsx:249",className:"w-4 h-4 mr-2 animate-spin"}),"Verifyingâ¦"]}):e.jsxs(e.Fragment,{children:[e.jsx(F,{"data-loc":"client/src/pages/AgentLogin.tsx:254",className:"w-4 h-4 mr-2"}),"Verify & Sign In"]})})]}),e.jsxs("div",{"data-loc":"client/src/pages/AgentLogin.tsx:261",className:"mt-5 space-y-3",children:[e.jsxs("p",{"data-loc":"client/src/pages/AgentLogin.tsx:262",className:"text-center text-xs text-gray-400",children:["Code expires in 15 minutes. Didn't receive it?"," ",e.jsx("button",{"data-loc":"client/src/pages/AgentLogin.tsx:264",type:"button",onClick:()=>x.mutate({email:a}),disabled:i,className:"text-[#1B3A6B] font-medium underline hover:no-underline disabled:opacity-50",children:"Resend"})]}),e.jsxs("button",{"data-loc":"client/src/pages/AgentLogin.tsx:273",type:"button",onClick:()=>{p("email"),r(["","","","","",""])},className:"flex items-center gap-1.5 text-sm text-gray-500 hover:text-gray-700 mx-auto transition-colors",children:[e.jsx(M,{"data-loc":"client/src/pages/AgentLogin.tsx:281",className:"w-3.5 h-3.5"}),"Use a different email"]})]})]})}),e.jsx("div",{"data-loc":"client/src/pages/AgentLogin.tsx:290",className:"px-5 sm:px-8 py-4 bg-gray-50 border-t border-gray-100 text-center",children:e.jsx("a",{"data-loc":"client/src/pages/AgentLogin.tsx:291",href:"/",className:"text-xs text-gray-400 hover:text-[#1B3A6B] transition-colors",children:"â Back to Fast PICRAs website"})})]}),e.jsx("p",{"data-loc":"client/src/pages/AgentLogin.tsx:301",className:"text-center text-white/50 text-xs mt-4",children:"ð Secure email-code authentication â no passwords stored"})]})]})}export{T 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.