import{u as A,r as o,j as e,a as F}from"./app-BwDemWQz.js";import{I as w}from"./Input-BJaxI6jp.js";import{B as b}from"./Button-B-KWyoQR.js";import{A as T}from"./AuthLayout--k4aA7aD.js";import{u as _}from"./LanguageContext-zkEAKPTE.js";import{A as B}from"./arrow-left-B11txR0s.js";import{E as y}from"./eye-off-CLMyxla3.js";import{E as j}from"./eye-C30qcgue.js";/* empty css            */import"./createLucideIcon-BASx8f0E.js";function O(){const{errors:d}=A().props,[m,N]=o.useState(""),[g,k]=o.useState(""),[c,v]=o.useState(!1),[x,S]=o.useState(!1),[h,u]=o.useState(""),[a,n]=o.useState(!1),r=_(),C=()=>{window.history.back()},P=t=>{let s=0;t.length>=8&&s++,/[a-z]/.test(t)&&/[A-Z]/.test(t)&&s++,/\d/.test(t)&&s++,/[^a-zA-Z0-9]/.test(t)&&s++;let i="Weak",l="bg-red-500";return s===1?(i="Fair",l="bg-orange-500"):s===2?(i="Good",l="bg-yellow-500"):s>=3&&(i="Strong",l="bg-green-500"),t.length===0&&(i="",l="bg-gray-300"),{strength:s,strengthText:i,strengthColor:l}},{strength:p,strengthText:f,strengthColor:E}=P(m),z=t=>{if(t.preventDefault(),n(!0),m!==g){u(r("Passwords do not match.")),n(!1);return}if(p<3){u(r("Password is not strong enough.")),n(!1);return}const s=route("auth.password.update");F.post(s,{password:m,password_confirmation:g},{onFinish:()=>n(!1),onError:()=>n(!1)})};return e.jsx(T,{children:e.jsxs("div",{className:"relative",children:[" ",e.jsx(b,{variant:"ghost",size:"icon",onClick:C,className:"absolute -top-2 -left-2 text-gray-600 dark:text-gray-200 hover:bg-gray-100","aria-label":"Go back",children:e.jsx(B,{className:"h-6 w-6"})}),e.jsx("h1",{className:"text-2xl font-bold mb-4 text-center text-gray-700 dark:text-gray-200 dark:text-gray-200",children:r("Create New Password")}),e.jsx("p",{className:"text-center text-gray-600 dark:text-gray-200 mb-8",children:r("Send your email account to reset password & make new password")}),e.jsxs("form",{onSubmit:z,children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{htmlFor:"new-password",className:"block mb-2 text-sm font-semibold text-gray-700 dark:text-gray-200",children:r("New Password")}),e.jsxs("div",{className:"relative",children:[e.jsx(w,{type:c?"text":"password",id:"new-password",name:"new-password",value:m,onChange:t=>N(t.target.value),placeholder:r("Enter your new password"),required:!0,className:"w-full px-4 py-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary dark:bg-zinc-800 dark:border-zinc-600 dark:text-white pr-10",disabled:a}),e.jsx("button",{type:"button",onClick:()=>v(!c),className:"absolute inset-y-0 right-0 pr-3 flex items-center text-gray-500 dark:text-gray-300 hover:text-primary dark:hover:text-primary transition-colors","aria-label":c?"Hide password":"Show password",disabled:a,children:c?e.jsx(y,{className:"h-5 w-5"}):e.jsx(j,{className:"h-5 w-5"})}),d.password&&e.jsx("p",{className:"mt-2 text-red-600 text-sm",children:d.password})]}),e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-300 mt-2",children:r("Min 8 Characters with a combination of letters and numbers")}),e.jsxs("div",{className:"flex items-center gap-1 mt-2",children:[Array.from({length:4}).map((t,s)=>e.jsx("div",{className:`h-2 flex-1 rounded-full ${s<p?E:"bg-gray-200"} transition-colors duration-300`},s)),e.jsx("span",{className:`text-xs font-semibold ml-2 ${f==="Strong"?"text-green-500":"text-gray-500 dark:text-gray-300"}`,children:f})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{htmlFor:"confirm-password",className:"block mb-2 text-sm font-semibold text-gray-700 dark:text-gray-200",children:r("Repeat Password")}),e.jsxs("div",{className:"relative",children:[e.jsx(w,{type:x?"text":"password",id:"confirm-password",name:"confirm-password",value:g,onChange:t=>k(t.target.value),placeholder:r("Confirm your new password"),required:!0,className:"w-full px-4 py-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-primary dark:bg-zinc-800 dark:border-zinc-600 dark:text-white pr-10",disabled:a}),e.jsx("button",{type:"button",onClick:()=>S(!x),className:"absolute inset-y-0 right-0 pr-3 flex items-center text-gray-500 dark:text-gray-300 hover:text-primary dark:hover:text-primary transition-colors","aria-label":x?"Hide password":"Show password",disabled:a,children:x?e.jsx(y,{className:"h-5 w-5"}):e.jsx(j,{className:"h-5 w-5"})}),d.password_confirmation&&e.jsx("p",{className:"mt-2 text-red-600 text-sm",children:d.password_confirmation})]})]}),e.jsx(b,{type:"submit",isLoading:a,className:"w-full bg-gradient-to-r from-primary to-secondary text-white hover:from-secondary hover:to-primary shadow-md hover:shadow-lg transition-all duration-200",children:r(a?"Setting password...":"Continue")})]}),h&&e.jsx("p",{className:`mt-4 text-center text-sm ${h.includes("match")||h.includes("strong")?"text-red-600":"text-green-600"}`,children:h})]})})}export{O as default};
