Your IP : 216.73.216.93


Current Path : /home/users/unlimited/www/admin.medimeet.codeskitter.site/assets/
Upload File :
Current File : /home/users/unlimited/www/admin.medimeet.codeskitter.site/assets/ForgetPassword-DNtz98E5.js

import{f as u,g as j,h as p,j as s,c as F,a as E,l as h,I as f,y as M,x as d,P as S}from"./index-C50MwByD.js";import{u as w,h as v,f as C,M as I,b as _,a as b,c as P,g as A,d as N,F as z,e as Z}from"./index.esm-BgKkBPdO.js";import{u as k}from"./useMutation-DiBhxv_U.js";import{e as x,d as B,I as R}from"./input-BS5AKlHW.js";const[T,q]=F({name:"FormErrorStylesContext",errorMessage:`useFormErrorStyles returned is 'undefined'. Seems you forgot to wrap the components in "<FormError />" `}),y=u((e,r)=>{const o=j("FormError",e),t=p(e),a=x();return a!=null&&a.isInvalid?s.jsx(T,{value:o,children:s.jsx(E.div,{...a==null?void 0:a.getErrorMessageProps(t,r),className:h("chakra-form__error-message",e.className),__css:{display:"flex",alignItems:"center",...o.text}})}):null});y.displayName="FormErrorMessage";const D=u((e,r)=>{const o=q(),t=x();if(!(t!=null&&t.isInvalid))return null;const a=h("chakra-form__error-icon",e.className);return s.jsx(f,{ref:r,"aria-hidden":!0,...e,__css:o.icon,className:a,children:s.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})});D.displayName="FormErrorIcon";const L=async e=>{const r=await S("","forget_password",e);if(r.response!==200)throw new Error(r.message);return r},$=({isOpen:e,onClose:r})=>{var c;const o=w(),{register:t,handleSubmit:a,formState:{errors:i},reset:l}=v(),m=k({mutationFn:async n=>{await L(n)},onError:n=>{C(o,"error",n.message)},onSuccess:()=>{o({title:"Email Sent",description:"Your password has been sent to your email address. Please check your email.",status:"success",duration:3e3,isClosable:!0,position:"top"}),l(),r()}}),g=async n=>{m.mutate(n)};return s.jsxs(I,{isOpen:e,onClose:r,isCentered:!0,children:[s.jsx(_,{}),s.jsxs(b,{children:[s.jsx(P,{children:"Forgot Password"}),s.jsx(A,{}),s.jsx(N,{children:s.jsxs("form",{onSubmit:a(g),children:[s.jsxs(B,{isInvalid:i.email,children:[s.jsx(z,{children:"Email your email address"}),s.jsx(R,{defaultValue:((c=M)==null?void 0:c.email)||"",type:"email",placeholder:"Enter your email",...t("email",{required:"Email is required",pattern:{value:/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/,message:"Invalid email address"}}),size:"sm",borderRadius:2}),s.jsx(y,{children:i.email&&i.email.message})]}),s.jsxs(Z,{children:[s.jsx(d,{colorScheme:"teal",type:"submit",isLoading:m.isPending,size:"sm",children:"Submit"}),s.jsx(d,{ml:3,onClick:()=>{l(),r()},size:"sm",children:"Cancel"})]})]})})]})]})};export{$ as F};