import{r as w,W as _,j as s}from"./app-BAHAOwU3.js";import{L as n}from"./label-DP7sGf18.js";import{I as d}from"./input-CeK7CEQL.js";import{I as c}from"./input-error-Be2KxtIS.js";import{B as g}from"./button-T-Jxhehc.js";import{q as N}from"./transition-BTktE0mm.js";function F({className:f=""}){const p=w.useRef(null),i=w.useRef(null),{data:e,setData:a,errors:o,put:x,reset:t,processing:j,recentlySuccessful:h}=_({current_password:"",password:"",password_confirmation:""}),v=r=>{r.preventDefault(),x(route("password.update"),{preserveScroll:!0,onSuccess:()=>t(),onError:l=>{var m,u;l.password&&(t("password","password_confirmation"),(m=p.current)==null||m.focus()),l.current_password&&(t("current_password"),(u=i.current)==null||u.focus())}})};return s.jsx("section",{className:f,children:s.jsxs("form",{onSubmit:v,className:"mt-6 space-y-6",children:[s.jsxs("div",{children:[s.jsx(n,{htmlFor:"current_password",children:"Current Password"}),s.jsx(d,{id:"current_password",ref:i,value:e.current_password,onChange:r=>a("current_password",r.target.value),type:"password",className:"mt-1 block w-full",autoComplete:"current-password"}),s.jsx(c,{message:o.current_password,className:"mt-2"})]}),s.jsxs("div",{children:[s.jsx(n,{htmlFor:"password",children:"New Password"}),s.jsx(d,{id:"password",ref:p,value:e.password,onChange:r=>a("password",r.target.value),type:"password",className:"mt-1 block w-full",autoComplete:"new-password"}),s.jsx(c,{message:o.password,className:"mt-2"})]}),s.jsxs("div",{children:[s.jsx(n,{htmlFor:"password_confirmation",children:"Confirm Password"}),s.jsx(d,{id:"password_confirmation",value:e.password_confirmation,onChange:r=>a("password_confirmation",r.target.value),type:"password",className:"mt-1 block w-full",autoComplete:"new-password"}),s.jsx(c,{message:o.password_confirmation,className:"mt-2"})]}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(g,{disabled:j,children:"Save"}),s.jsx(N,{show:h,enter:"transition ease-in-out",enterFrom:"opacity-0",leave:"transition ease-in-out",leaveTo:"opacity-0",children:s.jsx("p",{className:"text-sm text-gray-600",children:"Saved."})})]})]})})}export{F as default};
