(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9344],{62505:function(e,n,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/auth/login",function(){return s(37435)}])},12783:function(e,n,s){"use strict";s.d(n,{T:function(){return t}});var r=s(85893);let t=()=>(0,r.jsx)("img",{src:"/assets/logos/logo-600x300.png",style:{height:"90px"}})},94057:function(e,n,s){"use strict";s.d(n,{a:function(){return i}});var r=s(67294),t=s(34140);let i=()=>(0,r.useContext)(t.Vo)},88295:function(e,n,s){"use strict";s.d(n,{A:function(){return c}});var r=s(85893),t=s(45697),i=s.n(t),a=s(41664),o=s.n(a),l=s(72146),d=s(4889);let c=e=>{let{children:n}=e;return(0,r.jsx)(l.Z,{component:"main",sx:{display:"flex",flex:"1 1 auto"},children:(0,r.jsxs)(d.Z,{container:!0,sx:{flex:"1 1 auto"},children:[(0,r.jsxs)(d.Z,{xs:12,lg:6,sx:{backgroundColor:"background.paper",display:"flex",flexDirection:"column",position:"relative"},children:[(0,r.jsx)(l.Z,{component:"header",sx:{left:0,p:3,position:"fixed",top:0,width:"100%"},children:(0,r.jsx)(l.Z,{component:o(),href:"/",sx:{display:"inline-flex",height:64,width:64}})}),n]}),(0,r.jsx)(d.Z,{xs:12,lg:6,sx:{display:{xs:"none",md:"block"},alignItems:"center",backgroundImage:'url("/assets/logos/fundo-onda.png")',backgroundRepeat:"no-repeat",backgroundSize:"cover",backgroundPosition:"center",display:"flex",justifyContent:"center",height:"100%","& img":{maxWidth:"100%"},display:{xs:"none",md:"block"}},children:(0,r.jsx)(l.Z,{sx:{p:3}})})]})})};c.prototypes={children:i().node}},37435:function(e,n,s){"use strict";s.r(n);var r=s(85893),t=s(67294),i=s(9008),a=s.n(i),o=s(41664),l=s.n(o),d=s(39332),c=s(77264),u=s(74231),x=s(12783),h=s(94057),p=s(88295),m=s(72146),g=s(24726),f=s(62178),j=s(58046),b=s(39980),y=s(51642),Z=s(99657),v=s(80594),w=s(6714),k=s(58811),C=s(19607),_=s(31812);let S=()=>{let e=(0,d.useRouter)(),n=(0,h.a)(),[s,i]=(0,t.useState)(!1),[o,p]=(0,t.useState)(!1),[S,F]=(0,t.useState)(!1),I=(0,c.TA)({initialValues:{email:"",password:"",submit:null},validationSchema:u.Ry({email:u.Z_().email("O e-mail precisa ser valido").max(255).required("Insira o e-mail"),password:u.Z_().max(255).min(6,"Deve conter no minimo 6 caracteres").required("insira a senha")}),onSubmit:async(s,r)=>{try{i(!0),await n.signIn(s.email,s.password),e.push("/")}catch(e){r.setStatus({success:!1}),r.setErrors({submit:e.message}),r.setSubmitting(!1),i(!1)}}});return(0,t.useCallback)((e,n)=>{setMethod(n)},[]),(0,t.useCallback)(()=>{n.skip(),e.push("/")},[n,e]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a(),{children:(0,r.jsx)("title",{children:"Entrar | Onda Segura"})}),(0,r.jsx)(m.Z,{sx:{backgroundColor:"#F5F5F5",flex:"1 1 auto",alignItems:"center",display:"flex",justifyContent:"center"},children:(0,r.jsx)(m.Z,{sx:{maxWidth:550,px:3,py:"100px",width:"100%"},children:(0,r.jsxs)(g.Z,{sx:{backgroundColor:"#FFF",padding:"30px"},children:[(0,r.jsx)(m.Z,{sx:{display:"flex",justifyContent:"center",marginBottom:"50px"},children:(0,r.jsx)(x.T,{})}),(0,r.jsxs)(f.Z,{spacing:1,sx:{mb:4},children:[(0,r.jsx)(j.Z,{variant:"h4",color:"#00386B",children:"Entrar"}),(0,r.jsxs)(j.Z,{color:"text.secondary",variant:"body2",children:["N\xe3o possui uma conta?",(0,r.jsx)(b.Z,{sx:{marginLeft:"10px"},component:l(),href:"/auth/register",underline:"hover",variant:"subtitle2",color:"#00386B",children:"Registrar"})]})]}),(0,r.jsxs)("form",{noValidate:!0,onSubmit:I.handleSubmit,children:[(0,r.jsxs)(f.Z,{spacing:3,children:[(0,r.jsx)(y.Z,{error:!!(I.touched.email&&I.errors.email),fullWidth:!0,helperText:I.touched.email&&I.errors.email,label:"Email",name:"email",onBlur:I.handleBlur,onChange:I.handleChange,type:"email",value:I.values.email,InputLabelProps:{shrink:!0}}),(0,r.jsx)(y.Z,{error:!!(I.touched.password&&I.errors.password),fullWidth:!0,helperText:I.touched.password&&I.errors.password,label:"Senha",name:"password",onBlur:I.handleBlur,onChange:I.handleChange,type:S?"text":"password",value:I.values.password,InputLabelProps:{shrink:!0},InputProps:{endAdornment:(0,r.jsx)(Z.Z,{position:"end",children:(0,r.jsx)(v.Z,{"aria-label":"toggle password visibility",onClick:()=>{F(!S)},onMouseDown:e=>{e.preventDefault()},edge:"end",children:S?(0,r.jsx)(k.Z,{}):(0,r.jsx)(C.Z,{})})})}})]}),I.errors.submit&&(0,r.jsx)(j.Z,{color:"error",sx:{mt:3},variant:"body2",children:I.errors.submit}),(0,r.jsx)(_.Z,{loading:s,disable:!0,fullWidth:!0,style:{backgroundColor:s?"#0078F4":"#00386B"},size:"medium",sx:{mt:3,borderRadius:.5,"&:hover":{bgcolor:"#0078F4"},".MuiLoadingButton-loadingIndicator":{color:"#FFF"}},type:"submit",variant:"contained",children:s?"Carregando...":"Entrar"}),(0,r.jsx)(m.Z,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center"},children:(0,r.jsx)(b.Z,{color:"#00386B",component:l(),href:"/auth/password",sx:{textDecoration:"none",display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",fontSize:14,marginTop:1},variant:"subtitle1",children:"Esqueci minha senha"})}),(0,r.jsx)(w.Z,{color:"primary",severity:"info",sx:{mt:3},children:(0,r.jsxs)("div",{children:["Aqui na Onda a vistoria \xe9 ",(0,r.jsx)("b",{children:"GRATUITA"})," na entrada e na sa\xedda do ",(0,r.jsx)("b",{children:"im\xf3vel!"})]})})]})]})})})]})};S.getLayout=e=>(0,r.jsx)(p.A,{children:e}),n.default=S}},function(e){e.O(0,[3248,1664,8045,6716,8679,2888,9774,179],function(){return e(e.s=62505)}),_N_E=e.O()}]);