"use strict";(()=>{vare={};e.id=7537,e.ids=[3220,7537],e.modules={30671:(e,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){returnfunctione(t,r){returnrint?t[r]:"then"int&&"function"==typeoft.then?t.then(t=>e(t,r)):"function"==typeoft&&"default"===r?t:void0}}})},75370:(e,t,r)=>{r.r(t),r.d(t,{config:()=>O,default:()=>A,getServerSideProps:()=>L,getStaticPaths:()=>N,getStaticProps:()=>R,reportWebVitals:()=>I,routeModule:()=>C,unstable_getServerProps:()=>T,unstable_getServerSideProps:()=>k,unstable_getStaticParams:()=>M,unstable_getStaticPaths:()=>q,unstable_getStaticProps:()=>$});vars={};r.r(s),r.d(s,{ResetPasswordContext:()=>E,default:()=>b,getServerSideProps:()=>D});varn=r(63865),a=r(9455),o=r(30671),i=r(49407),l=r(89600),c=r(8732),u=r(82015),p=r.n(u),d=r(71457),m=r(87472),g=r(32415),f=r(20048),h=r.n(f),S=r(63715),x=r(13002),_=r(77463),P=r.n(_),y=r(22373),w=r.n(y),v=r(27825),j=r.n(v);letE=p().createContext({});functionb(e){let{email:t}=e,r="Reset Password | Datasquirel",s="Set a new password",n=(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("title",{children:r}),(0,c.jsx)("meta",{name:"description",content:s}),(0,c.jsx)(m.A,{pageTitle:r,pageDescription:s,pagePathname:"/"})]}),[a,o]=p().useState(!1),[i,l]=p().useState(!1);return(0,c.jsx)(d.A,{head:n,user:e.user,children:(0,c.jsx)(E.Provider,{value:{user:e.user},children:(0,c.jsx)("main",{children:(0,c.jsxs)("section",{children:[a&&(0,c.jsx)(g.A,{}),(0,c.jsx)("div",{className:"main-container flex-col items-start",children:i?(0,c.jsx)(x.A,{message:"Password Updated Sucessfully. Redirecting you ..."}):(0,c.jsxs)(p().Fragment,{children:[(0,c.jsx)("h1",{className:"m-0 text-4xl",children:"Reset Password"}),(0,c.jsx)("span",{children:"Please enter new passord and confirm it"}),(0,c.jsxs)("form",{className:"max-w-xl w-full flex flex-col items-stretch gap-4",onSubmit:e=>{o(!0),e.preventDefault();letr=e.target,s=r.password.value,n=r["confirm-password"].classList.contains("warning");if(s?.length<8){window.alert("Password must be at least 8 characters"),setTimeout(()=>{o(!1)},500);return}if(n){window.alert("Passwords don't match"),setTimeout(()=>{o(!1)},500);return}(0,S.A)(`/api/resetPassword?email=${t}&password=${s}`).then(e=>{setTimeout(()=>{o(!1)},500),setTimeout(()=>{window.location.href="/logout?login=true"},1e3),e.success&&l(!0)})},children:[(0,c.jsx)("input",{type:"password",name:"password",id:"password",className:"w-full",placeholder:"New Password",required:!0}),(0,c.jsx)("input",{type:"password",name:"confirm-password",id:"confirm-password",className:"w-full",placeholder:"Confirm New Password",required:!0,onInput:e=>{lett=e.target,r=t.closest("form");try{r.password.value.match(RegExp(`^${j().escapeRegExp(t.value)}$`))?t.classList.remove("warning"):t.classList.add("warning")}catch(t){(0,S.A)("/api/admin/clientError",{method:"post",body:{component:"reset-password-page-component/lines-170-177",message:t.message,user:{}}}),e.target.classList.add("warning")}}}),(0,c.jsx)("button",{children:"Reset Password"})]})]})})]})})})})}asyncfunctionD({req:e,res:t,query:r}){lets=awaith()(e,t);if(!r?.token?.toString()?.match(/./))return{redirect:{destination:"/",permanent:!1}};letn=null;try{lete=P()({encryptedString:r.token.toString()}),t=JSON.parse(e||"");if(Date.now()-t.dateCode>36e5)return{redirect:{destination:"/",permanent:!1}};n=t.email}catch(e){returnw()({component:"reset-password-page-component/getServersideProps/lines-251-260",message:e.message,user:s}),{redirect:{destination:"/",permanent:!1}}}returnn?.match(/./)?{props:{user:s,email:n}}:{redirect:{destination:"/",permanent:!1}}}letA=(0,o.M)(s,"default"),R=(0,o.M)(s,"getStaticProps"),N=(0,o.M)(s,"getStaticPaths"),L=(0,o.M)(s,"getServerSideProps"),O=(0,o.M)(s,"config"),I=(0,o.M)(s,"reportWebVitals"),$=(0,o.M)(s,"unstable_getStaticProps"),q=(0,o.M)(s,"unstable_getStaticPaths"),M=(0,o.M)(s,"unstable_getStaticParams"),T=(0,o.M)(s,"unstable_getServerProps"),k=(0,o.M)(s,"unstable_getServerSideProps"),C=newn.PagesRouteModule({definition:{kind:a.A.PAGES,page:"/reset-password",pathname:"/reset-password",bu