1import{u as V,a as $,x as B,n as _,f as P,B as F,A as q,y as K,C as J,E as Y,F as Q,G as X,H as Z,J as ee,K as ae,z as y,i as se,L as te,b as re,c as oe,o as le}from"../chunks/chunk-BFgw_KlF.js";import{b as r,j as e}from"../chunks/chunk-ngaCJxcV.js";import{e as p}from"../chunks/chunk-KO1ABRC5.js";import{S as ie,A as ne}from"../chunks/chunk-CdfW1Bad.js";import{C as de,a as ce}from"../chunks/chunk-Bjr1aYt7.js";import{S as ue}from"../chunks/chunk-CDmlRsgc.js";import{R as pe}from"../chunks/chunk-B0wPSEG_.js";import{K as me,E as T,p as b}from"../chunks/chunk-YE5B4yIH.js";import{i as A}from"../chunks/chunk-B24eoqi3.js";import"../chunks/chunk-C-IMmuvR.js";/* empty css *//* empty css */import"../chunks/chunk-Cl85btZu.js";import"../chunks/chunk-CCVQhKvN.js";import"../chunks/chunk-DAgG4ogk.js";function he(){const m=V()?.urlPathname??"",{t:a}=$(),[i,N]=r.useState(!1),[h,E]=r.useState(""),[n,D]=r.useState(""),[d,O]=r.useState(""),[f,R]=r.useState(!1),[w,G]=r.useState(!1),[x,z]=r.useState(!1),[j,k]=r.useState(!1),[o,c]=r.useState({}),[l,v]=r.useState(!1),[C,S]=r.useState(!1),g=r.useRef(!1),H=r.useCallback(s=>{S(t=>t===s?t:s)},[]),U=r.useMemo(()=>({minLength:a("REGISTER_PasswordRule_minLength"),specialChar:a("REGISTER_PasswordRule_specialChar"),number:a("REGISTER_PasswordRule_number"),capital:a("REGISTER_PasswordRule_capital"),match:a("REGISTER_PasswordRule_match")}),[a]),M=r.useCallback(s=>{k(s),s&&c(t=>({...t,newPassword:""}))},[]);r.useEffect(()=>{if(!B()){_("/");return}N(!0)},[]);function W(){const s={};return h.trim()||(s.oldPassword=a("COMMON_Required")),n.trim()?j||(s.newPassword=a("REGISTER_PasswordTooWeak")):s.newPassword=a("COMMON_Required"),d.trim()||(s.confirmPassword=a("COMMON_Required")),n.trim()&&d.trim()&&n!==d&&(s.confirmPassword=a("CHANGE_PASSWORD_Mismatch")||"Passwords do not match."),c(s),Object.keys(s).length>0?(y.error(a("CHANGE_PASSWORD_Validation")||"Please complete all fields correctly."),!1):!0}async function L(s){if(s?.preventDefault(),!g.current&&W()){g.current=!0,v(!0);try{const t=await ae({oldPassword:h.trim(),newPassword:n.trim(),confirmPassword:d.trim()});if(t?.isSuccess&&t?.data){S(!0);return}y.error(t?.message||a("CHANGE_PASSWORD_Error")||"Failed to change password.")}catch(t){const I=t instanceof Error?t.message:a("COMMON_Error");y.error(I||a("COMMON_Error"))}finally{v(!1),g.current=!1}}}return i?e.jsxs("div",{className:"min-h-screen bg-gray-50 pt-24 pb-12",children:[e.jsx("div",{className:"max-w-7xl mx-auto px-6 py-4 flex items-center justify-between",children:e.jsxs("div",{className:"flex flex-col lg:flex-row gap-8 w-full",children:[e.jsx("main",{className:"flex-1 min-w-0",children:!C&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-6",children:[e.jsxs("h1",{className:"text-2xl md:text-3xl font-dinb text-gray-900 flex items-center gap-2",children:[e.jsx(me,{className:"h-8 w-8 text-[#22c55e]"}),a("AUTH_ChangePassword")]}),e.jsx("p",{className:"text-gray-600 mt-1",children:a("CHANGE_PASSWORD_Subtitle")||"Update your password to keep your account secure."})]}),e.jsx(de,{children:e.jsx(ce,{className:"pt-6",children:e.jsxs("form",{onSubmit:L,className:"grid grid-cols-1 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-dinm text-gray-700",children:a("CHANGE_PASSWORD_Old")||"Old password"}),e.jsxs("div",{className:"relative mt-1",children:[e.jsx("input",{type:f?"text":"password",value:h,onChange:s=>{E(s.target.value),o.oldPassword&&c(t=>({...t,oldPassword:""}))},placeholder:a("CHANGE_PASSWORD_OldPlaceholder")||"Enter your current password",disabled:l,className:P("w-full rounded-md border border-gray-300 px-3 py-2 pr-10 text-sm",o.oldPassword&&"border-red-500")}),e.jsx("button",{type:"button",onClick:()=>R(s=>!s),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-gray-500 hover:text-gray-700 focus:outline-none disabled:opacity-50",tabIndex:-1,disabled:l,"aria-label":f?"Hide password":"Show password",children:f?e.jsx(T,{className:"h-4 w-4"}):e.jsx(b,{className:"h-4 w-4"})})]}),o.oldPassword&&e.jsx("p",{className:"mt-1 text-xs text-red-600",children:o.oldPassword})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-dinm text-gray-700",children:a("CHANGE_PASSWORD_New")||"New password"}),e.jsxs("div",{className:"relative mt-1",children:[e.jsx("input",{type:w?"text":"password",value:n,onChange:s=>{D(s.target.value),o.newPassword&&c(t=>({...t,newPassword:""}))},placeholder:a("CHANGE_PASSWORD_NewPlaceholder")||"Create a new password",disabled:l,className:P("w-full rounded-md border border-gray-300 px-3 py-2 pr-10 text-sm",o.newPassword&&"border-red-500")}),e.jsx("button",{type:"button",onClick:()=>G(s=>!s),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-gray-500 hover:text-gray-700 focus:outline-none disabled:opacity-50",tabIndex:-1,disabled:l,"aria-label":w?"Hide password":"Show password",children:w?e.jsx(T,{className:"h-4 w-4"}):e.jsx(b,{className:"h-4 w-4"})})]}),o.newPassword&&e.jsx("p",{className:"mt-1 text-xs text-red-600",children:o.newPassword})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-dinm text-gray-700",children:a("CHANGE_PASSWORD_Confirm")||"Confirm password"}),e.jsxs("div",{className:"relative mt-1",children:[e.jsx("input",{type:x?"text":"password",value:d,onChange:s=>{O(s.target.value),o.confirmPassword&&c(t=>({...t,confirmPassword:""}))},placeholder:a("CHANGE_PASSWORD_ConfirmPlaceholder")||"Repeat your new password",disabled:l,className:P("w-full rounded-md border border-gray-300 px-3 py-2 pr-10 text-sm",o.confirmPassword&&"border-red-500")}),e.jsx("button",{type:"button",onClick:()=>z(s=>!s),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-gray-500 hover:text-gray-700 focus:outline-none disabled:opacity-50",tabIndex:-1,disabled:l,"aria-label":x?"Hide password":"Show password",children:x?e.jsx(T,{className:"h-4 w-4"}):e.jsx(b,{className:"h-4 w-4"})})]}),o.confirmPassword&&e.jsx("p",{className:"mt-1 text-xs text-red-600",children:o.confirmPassword})]}),e.jsx("div",{children:e.jsx(pe,{rules:["minLength","specialChar","number","capital","match"],minLength:8,value:n,valueAgain:d,onChange:M,messages:U,className:"text-sm text-gray-600"})}),e.jsx("div",{className:"flex justify-end",children:e.jsx(F,{type:"submit",disabled:l||n.length>0&&!j,className:"bg-[#22c55e] hover:bg-[#16a34a] text-white",children:l?e.jsxs(e.Fragment,{children:[e.jsx(ue,{className:"size-4"}),a("COMMON_Loading")]}):a("CHANGE_PASSWORD_Submit")||"Change password"})})]})})})]})}),e.jsx(ne,{currentPath:m,className:"lg:shrink-0 order-first lg:order-last"})]})}),C&&e.jsx(q,{open:!0,onOpenChange:H,children:e.jsxs(K,{children:[e.jsxs(J,{children:[e.jsx(Y,{children:a("CHANGE_PASSWORD_SuccessTitle")||"Password changed"}),e.jsx(Q,{children:a("CHANGE_PASSWORD_SuccessDesc")||"Your password has been updated successfully."})]}),e.jsxs(X,{children:[e.jsx(Z,{children:a("COMMON_Close")}),e.jsx(ee,{onClick:()=>{S(!1),_("/profile")},className:"bg-[#22c55e] hover:bg-[#16a34a] text-white",children:a("CHANGE_PASSWORD_GoToProfile")||"Go to Profile"})]})]})})]}):e.jsx("div",{className:"min-h-screen bg-gray-50 pt-24 pb-12",children:e.jsx("div",{className:"max-w-7xl mx-auto px-6 py-4 flex items-center justify-between flex justify-center items-center",children:e.jsx(ie,{className:"h-12 w-64 roun
1ded-xl"})})})}const fe=Object.freeze(Object.defineProperty({__proto__:null,default:he},Symbol.toStringTag,{value:"Module"}));function we(u){const i=u.data?.resolver?.relationTypeData?.[0]?.mainData?.name;return i?`${i} | ${p.PAGE_TITLE}`:`${A.t("CHANGE_PASSWORD_PAGE_Title")} | ${p.PAGE_TITLE}`}const xe=Object.freeze(Object.defineProperty({__proto__:null,default:we},Symbol.toStringTag,{value:"Module"}));function Se(u){const i=u.data?.resolver?.relationTypeData?.[0]?.mainData?.name;return i?`${i} - ${p.PAGE_TITLE}`:`${A.t("CHANGE_PASSWORD_PAGE_Description")} - ${p.PAGE_TITLE}`}const ge=Object.freeze(Object.defineProperty({__proto__:null,default:Se},Symbol.toStringTag,{value:"Module"})),ze={hasServerOnlyHook:{type:"computed",definedAtData:null,valueSerialized:{type:"js-serialized",value:!0}},isClientRuntimeLoaded:{type:"computed",definedAtData:null,valueSerialized:{type:"js-serialized",value:!0}},onBeforeRenderEnv:{type:"computed",definedAtData:null,valueSerialized:{type:"js-serialized",value:{server:!0}}},dataEnv:{type:"computed",definedAtData:null,valueSerialized:{type:"js-serialized",value:null}},guardEnv:{type:"computed",definedAtData:null,valueSerialized:{type:"js-serialized",value:null}},onRenderClient:{type:"standard",definedAtData:{filePathToShowToUser:"vike-react/__internal/integration/onRenderClient",fileExportPathToShowToUser:[]},valueSerialized:{type:"pointer-import",value:le}},onPageTransitionStart:{type:"standard",definedAtData:{filePathToShowToUser:"/pages/+onPageTransitionStart.ts",fileExportPathToShowToUser:[]},valueSerialized:{type:"plus-file",exportValues:oe}},onPageTransitionEnd:{type:"standard",definedAtData:{filePathToShowToUser:"/pages/+onPageTransitionEnd.ts",fileExportPathToShowToUser:[]},valueSerialized:{type:"plus-file",exportValues:re}},Page:{type:"standard",definedAtData:{filePathToShowToUser:"/pages/change-password/+Page.tsx",fileExportPathToShowToUser:[]},valueSerialized:{type:"plus-file",exportValues:fe}},hydrationCanBeAborted:{type:"standard",definedAtData:{filePathToShowToUser:"vike-react/config",fileExportPathToShowToUser:["default","hydrationCanBeAborted"]},valueSerialized:{type:"js-serialized",value:!0}},hooksTimeout:{type:"standard",definedAtData:{filePathToShowToUser:"/pages/+config.ts",fileExportPathToShowToUser:["default","hooksTimeout"]},valueSerialized:{type:"js-serialized",value:{data:{warning:!1,error:18e4},onBeforeRender:{warning:!1,error:18e4}}}},Layout:{type:"cumulative",definedAtData:[{filePathToShowToUser:"/layouts/LayoutDefault.tsx",fileExportPathToShowToUser:[]}],valueSerialized:[{type:"pointer-import",value:te}]},title:{type:"standard",definedAtData:{filePathToShowToUser:"/pages/change-password/+title.ts",fileExportPathToShowToUser:[]},valueSerialized:{type:"plus-file",exportValues:xe}},description:{type:"standard",definedAtData:{filePathToShowToUser:"/pages/change-password/+description.ts",fileExportPathToShowToUser:[]},valueSerialized:{type:"plus-file",exportValues:ge}},Loading:{type:"standard",definedAtData:{filePathToShowToUser:"vike-react/__internal/integration/Loading",fileExportPathToShowToUser:[]},valueSerialized:{type:"pointer-import",value:se}}};export{ze as configValuesSerialized};
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.