import{j as e}from"./vendor-mui-69397583.js";import{F as N,a as i}from"./FormContainer-91c2b0e4.js";import{u as b,I as l,B as v}from"./index-c62ac197.js";import{A as y}from"./Alert-7dfbd254.js";import{P as d}from"./PasswordInput-8619a9df.js";import{A as S}from"./ActionLink-33e476e1.js";import{u as U}from"./useTimeOutMessage-e4eaa9f2.js";import{c as A,a as p,f as C,F,b as I,d as n}from"./index.esm-70ab539c.js";import{p as c}from"./strongPassword-bbec776a.js";import"./vendor-react-ece1c85f.js";import"./vendor-redux-a1f00e6b.js";import"./vendor-pdf-b2a5d8b1.js";import"./vendor-devex-33a39e11.js";import"./vendor-i18n-2fcb1983.js";import"./vendor-msal-9caa1ed1.js";import"./vendor-charts-eccea5d1.js";import"./index-42e65911.js";const M=A().shape({userName:p().required("Please enter your user name"),email:p().matches(/^[^\s@]+@[^\s@]+\.[a-zA-Z]{2,}$/,"Invalid email").required("Please enter your email"),password:c.required("Please enter your password"),confirmPassword:c.required("Confirm password").oneOf([C("password"),null],"Your Passwords do not match")}),$=u=>{const{disableSubmit:f=!1,className:w,signInUrl:h="/sign-in"}=u,{signUp:x}=b(),[t,j]=U(),g=async(a,s)=>{let{userName:r,password:m,email:P}=a;s(!0),m=btoa(m);const o=await x({userName:r,password:m,email:P});(o==null?void 0:o.status)==="failed"&&j(o.message),s(!1)};return e.jsxs("div",{className:w,children:[t&&e.jsx(y,{showIcon:!0,className:"mb-4",type:"danger",children:t}),e.jsx(F,{initialValues:{userName:"",password:"",confirmPassword:"",email:""},validationSchema:M,onSubmit:(a,{setSubmitting:s})=>{f?s(!1):g(a,s)},children:({touched:a,errors:s,isSubmitting:r})=>e.jsx(I,{children:e.jsxs(N,{children:[e.jsx(i,{label:"User Name",invalid:s.userName&&a.userName,errorMessage:s.userName,children:e.jsx(n,{type:"text",autoComplete:"off",name:"userName",placeholder:"User Name",component:l})}),e.jsx(i,{label:"Email",invalid:s.email&&a.email,errorMessage:s.email,children:e.jsx(n,{type:"email",autoComplete:"off",name:"email",placeholder:"Email",component:l})}),e.jsx(i,{label:"Password",invalid:s.password&&a.password,errorMessage:s.password,children:e.jsx(n,{autoComplete:"off",name:"password",placeholder:"Password",component:d,showPasswordStrength:!0,touched:a,errors:s})}),e.jsx(i,{label:"Confirm Password",invalid:s.confirmPassword&&a.confirmPassword,errorMessage:s.confirmPassword,children:e.jsx(n,{autoComplete:"off",name:"confirmPassword",placeholder:"Confirm Password",component:d,showPasswordStrength:!0,touched:a,errors:s})}),e.jsx(v,{block:!0,loading:r,variant:"solid",type:"submit",children:r?"Creating Account...":"Sign Up"}),e.jsxs("div",{className:"mt-4 text-center",children:[e.jsx("span",{children:"Already have an account? "}),e.jsx(S,{to:h,children:"Sign in"})]})]})})})]})},q=()=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h3",{className:"mb-1",children:"Sign Up"}),e.jsx("p",{children:"And lets get started with your free trial"})]}),e.jsx($,{disableSubmit:!1})]}),W=q;export{W as default};
