(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4665],{62673:function(e,t,l){Promise.resolve().then(l.bind(l,26446))},26446:function(e,t,l){"use strict";l.r(t),l.d(t,{default:function(){return C}});var n=l(3827),s=l(8792),a=l(64090),r=l(42239),o=l(15920),c=l(71126),i=l(10054),u=l(47907),d=l(56288),x=l(22020),h=l(65249);let f=(0,x.Ue)()((0,h.tJ)(e=>({email:"",setEmail:t=>{e({email:t})}}),{name:"login-email",storage:(0,h.FL)(()=>sessionStorage)}));function m(e){return(0,n.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 48 48",...e,children:[(0,n.jsx)("path",{fill:"#ffc107",d:"M43.611 20.083H42V20H24v8h11.303c-1.649 4.657-6.08 8-11.303 8c-6.627 0-12-5.373-12-12s5.373-12 12-12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4C12.955 4 4 12.955 4 24s8.955 20 20 20s20-8.955 20-20c0-1.341-.138-2.65-.389-3.917"}),(0,n.jsx)("path",{fill:"#ff3d00",d:"m6.306 14.691l6.571 4.819C14.655 15.108 18.961 12 24 12c3.059 0 5.842 1.154 7.961 3.039l5.657-5.657C34.046 6.053 29.268 4 24 4C16.318 4 9.656 8.337 6.306 14.691"}),(0,n.jsx)("path",{fill:"#4caf50",d:"M24 44c5.166 0 9.86-1.977 13.409-5.192l-6.19-5.238A11.9 11.9 0 0 1 24 36c-5.202 0-9.619-3.317-11.283-7.946l-6.522 5.025C9.505 39.556 16.227 44 24 44"}),(0,n.jsx)("path",{fill:"#1976d2",d:"M43.611 20.083H42V20H24v8h11.303a12.04 12.04 0 0 1-4.087 5.571l.003-.002l6.19 5.238C36.971 39.205 44 34 44 24c0-1.341-.138-2.65-.389-3.917"})]})}function C(){let e=(0,u.useRouter)(),{email:t,setEmail:l}=f(),[x,h]=(0,a.useState)(""),[C,p]=(0,a.useState)(!1),[g,w]=(0,a.useState)(!1),b=(0,u.useSearchParams)(),v=e=>d.toast.warning(e,{cancel:{label:"close"}});(0,a.useEffect)(()=>{let e;let t=null==b?void 0:b.get("error");return t&&("OAuthAccountNotLinked"===t&&(t="Email already registered"),e=setTimeout(()=>{v(t)},1e3)),()=>e&&clearTimeout(e)},[b]);let j=async()=>{if(w(!0),x.length<6){d.toast.warning("Invalid credentials",{cancel:{label:"Close"}}),w(!1);return}if((null==t?void 0:t.length)&&x.length){let l=await (0,c.signIn)("credentials",{email:t,password:x,redirect:!0,callbackUrl:"".concat(new URLSearchParams(window.location.search).get("callbackUrl")||"/")});(null==l?void 0:l.error)&&("Invalid credentials"==l.error?d.toast.warning("Invalid credentials",{cancel:{label:"Close"}}):"This account is blocked please contact support"==l.error?d.toast.warning("This account is blocked please contact support",{cancel:{label:"Close"}}):d.toast.warning("Something went wrong",{cancel:{label:"Close"}}),w(!1)),(null==l?void 0:l.ok)&&e.push("/")}w(!1)},N=async e=>{let t=await (0,c.signIn)(e);(null==t?void 0:t.error)&&d.toast.warning(null==t?void 0:t.error,{cancel:{label:"Close"}})};return(0,n.jsxs)("div",{className:"flex flex-col justify-between h-full ",children:[(0,n.jsx)(r.Z,{}),(0,n.jsx)("h1",{className:"text-3xl font-semibold text-center",children:"Welcome back"}),(0,n.jsx)(o.Z,{}),(0,n.jsxs)("div",{className:"flex flex-row gap-2 items-center justify-center",children:[(0,n.jsx)("p",{className:"text-sm text-gray-600",children:"New to Rhazes?"}),(0,n.jsx)(s.default,{href:"/signup",children:(0,n.jsx)("p",{className:"underline text-darkTeal font-semibold underline-offset-4 text-base",children:"Sign up"})})]}),(0,n.jsx)(r.Z,{}),(0,n.jsxs)("form",{className:"flex flex-col gap-5 items-center px-[16px] mx-auto w-full max-w-[526px] sm:mx-auto",onSubmit:e=>{e.preventDefault(),t.length&&x.length&&j()},children:[(0,n.jsxs)("div",{className:"relative w-full mx-auto",children:[(0,n.jsx)("label",{className:"text-sm text-gray-600",children:"First, enter your email address"}),(0,n.jsx)("input",{onChange:e=>{l(e.target.value)},required:!0,value:t,type:"email",placeholder:"Email",className:"w-full px-4 py-2 text-base border border-gray-300 rounded outline-none focus:ring-blue-500 focus:border-blue-500 focus:ring-1"})]}),(0,n.jsxs)("div",{className:" relative w-full mx-auto",children:[(0,n.jsx)("label",{className:"text-sm text-gray-600",children:"Your password"}),(0,n.jsx)("input",{onChange:e=>{h(e.target.value)},required:!0,type:C?"text":"password",placeholder:"Password",className:"w-full px-4 py-2 text-base border border-gray-300 rounded outline-none focus:ring-blue-500 focus:border-blue-500 focus:ring-1"}),(0,n.jsx)("div",{className:"cursor-pointer absolute bottom-1/4 right-2 flex items-center ",onClick:function(){p(e=>!e)},children:C?(0,n.jsx)("svg",{width:"19",height:"10",viewBox:"0 0 19 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,n.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.7023 0.598319C18.7728 0.643338 18.834 0.702103 18.8823 0.771259C18.9306 0.840415 18.9651 0.918608 18.9838 1.00137C19.0025 1.08414 19.005 1.16986 18.9913 1.25363C18.9776 1.33741 18.9478 1.4176 18.9037 1.48963C18.354 2.39134 17.6923 3.21662 16.9352 3.94493L18.4566 5.49857C18.5719 5.62056 18.6358 5.78395 18.6343 5.95354C18.6329 6.12313 18.5663 6.28536 18.4488 6.40529C18.3314 6.52521 18.1726 6.59324 18.0065 6.59471C17.8404 6.59618 17.6804 6.53099 17.561 6.41317L15.9611 4.77932C14.9445 5.55813 13.8006 6.14638 12.5826 6.51665L13.1514 8.68606C13.1916 8.8507 13.1668 9.02487 13.0824 9.17102C12.998 9.31717 12.8608 9.42361 12.7003 9.46739C12.5397 9.51118 12.3688 9.48879 12.2243 9.40507C12.0798 9.32135 11.9733 9.18299 11.9277 9.01982L11.3476 6.80901C10.1243 7.02238 8.87445 7.02238 7.65118 6.80901L7.07101 9.02111C7.04938 9.10317 7.01214 9.18007 6.96141 9.24742C6.91068 9.31478 6.84746 9.37127 6.77536 9.41367C6.70325 9.45608 6.62367 9.48356 6.54116 9.49456C6.45866 9.50556 6.37483 9.49985 6.29449 9.47776C6.21414 9.45568 6.13884 9.41765 6.07288 9.36585C6.00692 9.31404 5.95161 9.24948 5.91008 9.17584C5.86856 9.10221 5.84165 9.02094 5.83088 8.93668C5.82011 8.85242 5.8257 8.76682 5.84732 8.68477L6.41736 6.51665C5.19894 6.1465 4.0546 5.55824 3.03767 4.77932L1.43776 6.41317C1.31831 6.53099 1.15832 6.59618 0.992247 6.59471C0.826177 6.59324 0.667319 6.52521 0.549886 6.40529C0.432453 6.28536 0.365842 6.12313 0.364399 5.95354C0.362956 5.78395 0.426796 5.62056 0.542171 5.49857L2.06227 3.94493C1.30606 3.21644 0.645248 2.39117 0.0962743 1.48963C0.052191 1.4176 0.022432 1.33741 0.00869621 1.25363C-0.00503953 1.16986 -0.00248294 1.08414 0.01622 1.00137C0.0539924 0.834221 0.155239 0.689238 0.297688 0.598319C0.440136 0.5074 0.612117 0.477993 0.775798 0.516566C0.939478 0.55514 1.08145 0.658535 1.17048 0.804006C1.77469 1.79832 2.53177 2.68677 3.41263 3.43524C5.12064 4.8891 7.27585 5.68153 9.49937 5.67321C13.0564 5.67321 16.0307 3.74183 17.8295 0.804006C17.8736 0.731976 17.9311 0.669518 17.9989 0.620199C18.0666 0.57088 18.1432 0.535666 18.2242 0.516566C18.3052 0.497466 18.3892 0.494855 18.4712 0.508882C18.5533 0.52291 18.6318 0.5533 18.7023 0.598319Z",fill:"black"})}):(0,n.jsxs)("svg",{width:"19",height:"12",viewBox:"0 0 19 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,n.jsx)("path",{d:"M9.50085 0.77877C14.0074 0.77877 17.8985 3.86149 18.978 8.18121C19.0253 8.37003 18.9957 8.56994 18.8959 8.73695C18.796 8.90396 18.634 9.0244 18.4456 9.07177C18.2571 9.11914 18.0575 9.08956 17.8908 8.98953C17.7241 8.88951 17.6038 8.72724 17.5566 8.53841C17.1042 6.74111 16.0659 5.1465 14.6063 4.00743C13.1466 2.86837 11.3491 2.25004 9.49884 2.25049C7.64855 2.25094 5.85137 2.87014 4.39226 4.00992C2.93314 5.14969 1.89561 6.7448 1.44417 8.54233C1.42088 8.63589 1.37943 8.72394 1.32218 8.80145C1.26492 8.87896 1.19299 8.94442 1.11049 8.99408C1.02798 9.04374 0.936517 9.07664 0.841319 9.0909C0.746122 9.10515 0.649054 9.10048 0.555658 9.07715C0.462262 9.05383 0.374367 9.0123 0.296991 8.95495C0.219615 8.89759 0.154273 8.82553 0.104697 8.74288C0.0551213 8.66023 0.0222813 8.56861 0.00805262 8.47324C-0.0061761 8.37788 -0.00151511 8.28064 0.0217698 8.18708C0.55157 6.07057 1.77207 4.19204 3.48946 2.84983C5.20684 1.50763 7.32264 0.778684 9.50085 0.77877Z",fill:"black"}),(0,n.jsx)("path",{d:"M9.5 4.20892C10.4283 4.20892 11.3185 4.57831 11.9749 5.23584C12.6313 5.89338 13 6.78518 13 7.71507C13 8.64496 12.6313 9.53677 11.9749 10.1943C11.3185 10.8518 10.4283 11.2212 9.5 11.2212C8.57174 11.2212 7.6815 10.8518 7.02513 10.1943C6.36875 9.53677 6 8.64496 6 7.71507C6 6.78518 6.36875 5.89338 7.02513 5.23584C7.6815 4.57831 8.57174 4.20892 9.5 4.20892Z",fill:"black"})]})})]}),(0,n.jsx)(i.Z,{controlled:!0,disabled:!t.length||!x.length||g,type:"submit",fullWidth:!0,height:"h-12",rounded:!0,text:"Next"}),(0,n.jsxs)("div",{className:"flex flex-row gap-2 items-center justify-center mb-5",children:[(0,n.jsx)("p",{className:"text-sm text-gray-600",children:"Forgot password?"}),(0,n.jsx)(s.default,{href:"/forgot_password",children:(0,n.jsx)("p",{className:"underline text-darkTeal font-semibold underline-offset-4 text-sm",children:"Reset password"})})]})]}),(0,n.jsx)("p",{className:"text-center text-sm text-inputFieldBorder font-bold",children:"Or"}),(0,n.jsx)("section",{id:"oAuth",className:"flex flex-col items-center px-[16px] mx-auto w-full max-w-[526px] sm:mx-auto",children:(0,n.jsx)("div",{className:"w-full flex flex-row items-center justify-center my-2",children:(0,n.jsx)(i.Z,{onClick:async()=>await N("google"),StartIcon:(0,n.jsx)(m,{fontSize:30}),outlined:!0,controlled:!0,disabled:g,type:"button",height:"h-[50px]",width:"w-[110px]",rounded:!0})})})]})}},10054:function(e,t,l){"use strict";var n=l(3827),s=l(64090);t.Z=e=>{let{onClick:t,children:l,rounded:a,fullWidth:r,StartIcon:o,width:c,height:i,fontWeight:u,outlined:d,text:x,fontSize:h,controlled:f,disabled:m,endIcon:C,tailwindStyles:p,type:g}=e,w=(0,s.useRef)(null),b=e=>{t&&t(e)},v="".concat((o||C)&&"flex flex-row items-center justify-center gap-2"," px-3 focus:outline-none ").concat(a&&"rounded-[4px]"," ").concat(r?"w-full":c||""," ").concat(i&&i," ").concat(d?"border-[1px] border-darkTeal text-darkTeal hover:text-white hover:border-accentTeal hover:border-[1px]":"bg-accentTeal text-white border-[1px] border-accentTeal","    \n    font-").concat(u,"\n    ").concat("small"==h?"text-sm":"large"===h?"text-lg":"text-base","\n    ").concat(f&&m&&"opacity-50 cursor-not-allowed","\n    ").concat(p&&p,"\n  ");return(0,n.jsxs)("button",{type:g,ref:w,disabled:!!f&&!!m,className:"".concat(v,"  relative overflow-hidden ").concat(d?"hover:bg-accentTeal":"hover:bg-accentTealHover"," transition-all duration-300 "),onClick:b?e=>b(e):void 0,children:[o&&(0,n.jsx)("span",{className:"icon-container",children:o}),(null==x?void 0:x.length)&&(0,n.jsx)("p",{children:x}),l,C&&(0,n.jsx)("span",{className:"icon-container",children:C})]})}},15920:function(e,t,l){"use strict";l.d(t,{Z:function(){return s}});var n=l(3827);function s(){return(0,n.jsx)("div",{className:"h-5"})}l(64090)},42239:function(e,t,l){"use strict";l.d(t,{Z:function(){return s}});var n=l(3827);function s(){return(0,n.jsx)("div",{className:"h-9"})}l(64090)},8792:function(e,t,l){"use strict";l.d(t,{default:function(){return s.a}});var n=l(25250),s=l.n(n)},47907:function(e,t,l){"use strict";var n=l(15313);l.o(n,"usePathname")&&l.d(t,{usePathname:function(){return n.usePathname}}),l.o(n,"useRouter")&&l.d(t,{useRouter:function(){return n.useRouter}}),l.o(n,"useSearchParams")&&l.d(t,{useSearchParams:function(){return n.useSearchParams}})}},function(e){e.O(0,[5250,6288,8381,1126,2971,364,1744],function(){return e(e.s=62673)}),_N_E=e.O()}]);