import{aJ as s}from"./@ui-core-DKdciH1Z.js";import{I as a,B as x}from"./index-D7KLAbvI.js";import{u as w,t as p}from"./@zod-DKyD3xVW.js";import{P as u}from"./PasswordChecker-B1pCmlB2.js";import{g as h}from"./form-schemas-CtQXlH0G.js";function S({displayUsername:r=!1,submitHandler:l,headline:t="Create your password",subHeadine:o="Select a password for your account"}){const{register:e,watch:c,handleSubmit:m,formState:{isValid:d,errors:n}}=w({resolver:p(h(r)),mode:"onChange",criteriaMode:"all",defaultValues:{username:""}}),i=n.newPassword?.types;return s.jsxs("div",{className:"space-y-5",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-display-xs font-semibold",children:t}),s.jsx("p",{className:"text-theme-text-secondary",children:o})]}),s.jsxs("form",{onSubmit:m(l),className:"space-y-5",children:[s.jsx("div",{className:"space-y-2",children:r&&s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("label",{className:"text-text-sm",children:"Username"}),s.jsx(a,{...e("username"),className:"w-full"})]})}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("label",{className:"text-text-sm",children:"New Password"}),s.jsx(a,{...e("newPassword"),type:"password",className:"w-full"})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("label",{className:"text-text-sm",children:"Confirm Password"}),s.jsx(a,{...e("confirmPassword"),type:"password",className:"w-full"})]}),s.jsx(u,{val:c("newPassword"),errors:i||[]}),s.jsx(x,{disabled:!d,className:"w-full text-center",size:"md",children:s.jsx("span",{className:"w-full",children:"Continue"})})]})]})}export{S};
