1import{r,j as e}from"./vendor-react-BGSoyBC3.js";import{u as N,L as k}from"./vendor-router-Bky5zxn0.js";import{m as y,a as P,W as S,c as o}from"./index-CY3lR3NC.js";import{aF as C,as as L,at as E,ar as R,L as h,aE as A}from"./vendor-icons-0KQIW_PB.js";import"./vendor-trpc-C-BLj2ba.js";import"./vendor-react-dom-CzqU2IQt.js";import"./vendor-ui-BKDt2K1P.js";import"./vendor-charts-BBE7Gg4G.js";function W(){const[,f]=N(),{isRTL:s}=y(),i=new URLSearchParams(window.location.search).get("token")??"",[t,b]=r.useState(""),[c,p]=r.useState(""),[n,g]=r.useState(!1),[m,l]=r.useState(""),[x,w]=r.useState(!1),[u,j]=r.useState(null),d=P.emailAuth.resetPassword.useMutation({onSuccess:()=>{w(!0),setTimeout(()=>{window.location.href="/dashboard"},2500)},onError:a=>{l(a.message)}});r.useEffect(()=>{j(!!i)},[i]);const v=a=>{if(a.preventDefault(),l(""),t.length<8){l(s?"ÙÙÙ
Ø© اÙÙ
Ø±ÙØ± ÙØ¬Ø¨ أ٠تÙÙÙ 8 Ø£ØØ±Ù عÙÙ Ø§ÙØ£ÙÙ":"Password must be at least 8 characters");return}if(t!==c){l(s?"ÙÙÙ
تا اÙÙ
Ø±ÙØ± ØºÙØ± Ù
ØªØ·Ø§Ø¨ÙØªÙÙ":"Passwords do not match");return}d.mutate({token:i,password:t})};return e.jsxs(S,{mode:"signin",centered:!0,children:[u===!1&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-4 flex justify-center",children:e.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-red-50",children:e.jsx(C,{className:"h-9 w-9 text-red-500"})})}),e.jsx("h1",{className:"brand-wordmark mb-2 text-center text-xl font-bold text-[var(--brand-ink-soft)]",children:s?"رابط ØºÙØ± ØµØ§ÙØ":"Invalid Link"}),e.jsx("p",{className:"mb-5 text-center text-sm text-red-600",children:s?"رابط إعادة Ø§ÙØªØ¹ÙÙÙ ØºÙØ± ØµØ§ÙØ Ø£Ù Ù
ÙØªÙÙ Ø§ÙØµÙاØÙØ©.":"This reset link is invalid or has expired."}),e.jsx("button",{type:"button",className:"gulf-btn-primary h-11 w-full",onClick:()=>f("/forgot-password"),children:s?"Ø·ÙØ¨ رابط Ø¬Ø¯ÙØ¯":"Request new link"})]}),u===!0&&!x&&e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"brand-wordmark mb-2 text-[22px] font-bold text-[var(--brand-ink-soft)]",children:s?"تعÙÙÙ ÙÙÙ
Ø© Ù
Ø±ÙØ± Ø¬Ø¯ÙØ¯Ø©":"Set New Password"}),e.jsx("p",{className:"mb-5 text-sm text-[var(--brand-ink-muted)]",children:s?"Ø£ÙØ´Ø¦ ÙÙÙ
Ø© Ù
Ø±ÙØ± ÙÙÙØ© ÙØØ³Ø§Ø¨Ù":"Create a strong password for your account"}),e.jsxs("form",{onSubmit:v,className:"space-y-3.5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"gulf-field-label",children:s?"ÙÙÙ
Ø© اÙÙ
Ø±ÙØ± Ø§ÙØ¬Ø¯Ùدة":"New Password"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:n?"text":"password",value:t,onChange:a=>b(a.target.value),placeholder:s?"8 Ø£ØØ±Ù عÙÙ Ø§ÙØ£ÙÙ":"At least 8 characters",className:o("gulf-field-input",s?"pl-10":"pr-10"),required:!0,dir:"ltr"}),e.jsx("button",{type:"button",onClick:()=>g(!n),className:o("absolute top-1/2 -translate-y-1/2 text-[var(--brand-ink-faint)]",s?"left-3":"right-3"),children:n?e.jsx(L,{className:"h-4 w-4"}):e.jsx(E,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"gulf-field-label",children:s?"تأÙÙØ¯ ÙÙÙ
Ø© اÙÙ
Ø±ÙØ±":"Confirm Password"}),e.jsx("input",{type:n?"text":"password",value:c,onChange:a=>p(a.target.value),placeholder:s?"أعد إدخا٠ÙÙÙ
Ø© اÙÙ
Ø±ÙØ±":"Re-enter password",className:"gulf-field-input",required:!0,dir:"ltr"})]}),t.length>0&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex gap-1",children:[1,2,3,4].map(a=>e.jsx("div",{className:o("h-1 flex-1 rounded-full transition-colors",t.length>=a*3?t.length>=12?"bg-[var(--brand-teal)]":t.length>=8?"bg-amber-400":"bg-red-400":"bg-[var(--brand-line)]")},a))}),e.jsx("p",{className:"text-xs text-[var(--brand-ink-faint)]",children:t.length<8?s?"ضعÙÙØ©":"Weak":t.length<12?s?"Ù
ØªÙØ³Ø·Ø©":"Medium":s?"ÙÙÙØ©":"Strong"})]}),m&&e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-700",children:[e.jsx(R,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsx("p",{children:m})]}),e.jsx("button",{type:"submit",className:"gulf-btn-primary h-11 w-full",disabled:d.isPending,children:d.isPending?e.jsx(h,{className:"mx-auto h-4 w-4 animate-spin"}):s?"تعÙÙÙ ÙÙÙ
Ø© اÙÙ
Ø±ÙØ±":"Set Password"})]})]}),x&&e.jsxs("div",{className:"py-4 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-[var(--accent-teal)]",children:e.jsx(A,{className:"h-9 w-9 text-[var(--brand-teal)]"})}),e.jsx("h1",{className:"brand-wordmark mb-2 text-xl font-bold text-[var(--brand-ink-soft)]",children:s?"تÙ
تعÙÙÙ ÙÙÙ
Ø© اÙÙ
Ø±ÙØ±!":"Password Updated!"}),e.jsx("p",{className:"mb-4 text-sm text-[var(--brand-ink-muted)]",children:s?"Ø¬Ø§Ø±Ù ØªÙØ¬ÙÙÙ ÙÙ
Ø³Ø§ØØ© Ø§ÙØ¹Ù
Ù...":"Redirecting to workspace..."}),e.jsx(h,{className:"mx-auto h-6 w-6 animate-spin text-[var(--brand-navy)]"})]}),e.jsx(k,{href:"/login",className:"mt-4 block text-center text-[13px] font-medium text-[var(--brand-ink-muted)] hover:text-[var(--brand-navy)]",children:s?"â Ø§ÙØ¹ÙØ¯Ø© ÙØªØ³Ø¬ÙÙ Ø§ÙØ¯Ø®ÙÙ":"â Back to Sign In"})]})}
1export{W 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.