(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[626],{5386:function(e,t,r){Promise.resolve().then(r.bind(r,4338))},4338:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return f}});var n=r(3827),a=r(4090),l=r(8792),s=r(7907),o=r(5754),i=r(7815),c=r(438),u=r(8998),d=r(8994);function f(){let e=(0,s.useRouter)(),[t,r]=(0,a.useState)(!1),[f,m]=(0,a.useState)(""),[p,h]=(0,a.useState)({email:"",password:""}),x=e=>{h({...p,[e.target.id]:e.target.value}),m("")},v=async t=>{t.preventDefault(),m(""),r(!0);try{var n,a;let t=await fetch("".concat("https://api.maxwhats.maxsystec.com.br","/v1/auth/login"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:p.email,password:p.password})}),r=await t.json();if(!t.ok)throw Error((null===(a=r.error)||void 0===a?void 0:a.message)||"Credenciais inv\xe1lidas");(null===(n=r.data)||void 0===n?void 0:n.accessToken)&&(localStorage.setItem("accessToken",r.data.accessToken),localStorage.setItem("refreshToken",r.data.refreshToken),localStorage.setItem("user",JSON.stringify(r.data.user))),e.push("/dashboard")}catch(e){m(e.message||"Erro ao conectar com o servidor")}finally{r(!1)}};return(0,n.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 dark:bg-gray-900 px-4",children:(0,n.jsxs)(i.Zb,{className:"w-full max-w-md",children:[(0,n.jsxs)(i.Ol,{className:"text-center",children:[(0,n.jsx)("div",{className:"flex justify-center mb-4",children:(0,n.jsx)(c.Z,{className:"h-12 w-12 text-green-600"})}),(0,n.jsx)(i.ll,{className:"text-2xl",children:"Entrar no MaxWhats"}),(0,n.jsx)(i.SZ,{children:"Acesse sua conta para gerenciar suas inst\xe2ncias"})]}),(0,n.jsxs)(i.aY,{children:[f&&(0,n.jsxs)("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-md flex items-center gap-2 text-red-700 text-sm",children:[(0,n.jsx)(u.Z,{className:"h-4 w-4 flex-shrink-0"}),f]}),(0,n.jsxs)("form",{onSubmit:v,className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-sm font-medium",htmlFor:"email",children:"E-mail"}),(0,n.jsx)("input",{id:"email",type:"email",placeholder:"seu@email.com",required:!0,value:p.email,onChange:x,className:"w-full mt-1 px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-green-600"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-sm font-medium",htmlFor:"password",children:"Senha"}),(0,n.jsx)("input",{id:"password",type:"password",placeholder:"••••••••",required:!0,value:p.password,onChange:x,className:"w-full mt-1 px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-green-600"})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("label",{className:"flex items-center gap-2",children:[(0,n.jsx)("input",{type:"checkbox",className:"rounded"}),(0,n.jsx)("span",{className:"text-sm",children:"Lembrar de mim"})]}),(0,n.jsx)(l.default,{href:"/forgot-password",className:"text-sm text-green-600 hover:underline",children:"Esqueceu a senha?"})]}),(0,n.jsx)(o.z,{type:"submit",className:"w-full",disabled:t,children:t?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(d.Z,{className:"h-4 w-4 mr-2 animate-spin"}),"Entrando..."]}):"Entrar"})]}),(0,n.jsxs)("div",{className:"mt-6 text-center text-sm",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"N\xe3o tem uma conta? "}),(0,n.jsx)(l.default,{href:"/register",className:"text-green-600 hover:underline",children:"Criar conta gr\xe1tis"})]})]})]})})}},5754:function(e,t,r){"use strict";r.d(t,{z:function(){return c}});var n=r(3827),a=r(4090),l=r(6371),s=r(9769),o=r(1657);let i=(0,s.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=a.forwardRef((e,t)=>{let{className:r,variant:a,size:s,asChild:c=!1,...u}=e,d=c?l.g7:"button";return(0,n.jsx)(d,{className:(0,o.cn)(i({variant:a,size:s,className:r})),ref:t,...u})});c.displayName="Button"},7815:function(e,t,r){"use strict";r.d(t,{Ol:function(){return o},SZ:function(){return c},Zb:function(){return s},aY:function(){return u},ll:function(){return i}});var n=r(3827),a=r(4090),l=r(1657);let s=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("div",{ref:t,className:(0,l.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",r),...a})});s.displayName="Card";let o=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("div",{ref:t,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",r),...a})});o.displayName="CardHeader";let i=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("h3",{ref:t,className:(0,l.cn)("text-2xl font-semibold leading-none tracking-tight",r),...a})});i.displayName="CardTitle";let c=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("p",{ref:t,className:(0,l.cn)("text-sm text-muted-foreground",r),...a})});c.displayName="CardDescription";let u=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("div",{ref:t,className:(0,l.cn)("p-6 pt-0",r),...a})});u.displayName="CardContent",a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)("div",{ref:t,className:(0,l.cn)("flex items-center p-6 pt-0",r),...a})}).displayName="CardFooter"},1657:function(e,t,r){"use strict";r.d(t,{cn:function(){return l}});var n=r(3167),a=r(1367);function l(){for(var e=arguments.length,t=Array(e),r=0;rl(e,"name",{value:t,configurable:!0});function o(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function i(){for(var e=arguments.length,t=Array(e),r=0;r{let r=!1,n=t.map(t=>{let n=o(t,e);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let e=0;eu(e,"name",{value:t,configurable:!0});function f(e){let t=n.forwardRef((t,r)=>{var a;let{children:l,...s}=t,o=null,i=!1,u=[];b(l)&&"function"==typeof S&&(l=S(l._payload)),n.Children.forEach(l,e=>{if(g(e)){var t;i=!0;let r="child"in e.props?e.props.child:e.props.children;b(r)&&"function"==typeof S&&(r=S(r._payload)),o=h(e,r),u.push(null==o?void 0:null===(t=o.props)||void 0===t?void 0:t.children)}else u.push(e)}),o?o=n.cloneElement(o,void 0,u):!i&&1===n.Children.count(l)&&n.isValidElement(l)&&(o=l);let d=o?v(o):void 0,f=c(r,d);if(!o){if(l||0===l)throw Error(i?w(e):N(e));return l}let m=x(s,null!==(a=o.props)&&void 0!==a?a:{});return o.type!==n.Fragment&&(m.ref=r?f:d),n.cloneElement(o,m)});return t.displayName="".concat(e,".Slot"),t}d(f,"createSlot");var m=f("Slot"),p=Symbol.for("radix.slottable");d(function(e){let t=d(e=>"child"in e?e.children(e.child):e.children,"Slottable");return t.displayName="".concat(e,".Slottable"),t.__radixId=p,t},"createSlottable");var h=d((e,t)=>{if("child"in e.props){let t=e.props.child;return n.isValidElement(t)?n.cloneElement(t,void 0,e.props.children(t.props.children)):null}return n.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function x(e,t){let r={...t};for(let n in t){let a=e[n],l=t[n];/^on[A-Z]/.test(n)?a&&l?r[n]=function(){for(var e=arguments.length,t=Array(e),r=0;r"".concat(e," failed to slot onto its children. Expected a single React element child or `Slottable`."),"createSlotError"),w=d(e=>"".concat(e," failed to slot onto its `Slottable`. Expected `Slottable` to receive a single React element child."),"createSlottableError"),S=a[" use ".trim().toString()]},9769:function(e,t,r){"use strict";r.d(t,{j:function(){return s}});var n=r(3167);let a=e=>"boolean"==typeof e?"".concat(e):0===e?"0":e,l=n.W,s=(e,t)=>r=>{var n;if((null==t?void 0:t.variants)==null)return l(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:s,defaultVariants:o}=t,i=Object.keys(s).map(e=>{let t=null==r?void 0:r[e],n=null==o?void 0:o[e];if(null===t)return null;let l=a(t)||a(n);return s[e][l]}),c=r&&Object.entries(r).reduce((e,t)=>{let[r,n]=t;return void 0===n||(e[r]=n),e},{});return l(e,i,null==t?void 0:null===(n=t.compoundVariants)||void 0===n?void 0:n.reduce((e,t)=>{let{class:r,className:n,...a}=t;return Object.entries(a).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...o,...c}[t]):({...o,...c})[t]===r})?[...e,r,n]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}}},function(e){e.O(0,[700,250,971,69,744],function(){return e(e.s=5386)}),_N_E=e.O()}]);