(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[626],{980:function(e,t,r){Promise.resolve().then(r.bind(r,8991))},9376:function(e,t,r){"use strict";var n=r(5475);r.o(n,"useRouter")&&r.d(t,{useRouter:function(){return n.useRouter}})},257:function(e,t,r){"use strict";var n,s;e.exports=(null==(n=r.g.process)?void 0:n.env)&&"object"==typeof(null==(s=r.g.process)?void 0:s.env)?r.g.process:r(4227)},4227:function(e){!function(){var t={229:function(e){var t,r,n,s=e.exports={};function o(){throw Error("setTimeout has not been defined")}function i(){throw Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===o||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:o}catch(e){t=o}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var l=[],c=!1,u=-1;function d(){c&&n&&(c=!1,n.length?l=n.concat(l):u=-1,l.length&&f())}function f(){if(!c){var e=a(d);c=!0;for(var t=l.length;t;){for(n=l,l=[];++u1)for(var r=1;r{t.preventDefault(),h(!0),d("");try{let t=l.env.NEXT_PUBLIC_API_URL||"",n=await fetch("".concat(t,"/api/auth/login"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:r})}),s=await n.json();if(!n.ok)throw Error(s.detail||"Credenciais inv\xe1lidas");p(s.access_token,s.user),m.push("/scan")}catch(e){d(e.message||"Credenciais inv\xe1lidas")}finally{h(!1)}};return(0,n.jsxs)("div",{className:"min-h-screen bg-dark flex items-center justify-center px-4 relative overflow-hidden",children:[(0,n.jsx)("div",{className:"orb orb-primary w-[400px] h-[400px] -top-[150px] -right-[100px]"}),(0,n.jsx)("div",{className:"orb orb-accent w-[300px] h-[300px] bottom-[10%] -left-[100px]"}),(0,n.jsxs)("div",{className:"relative z-10 w-full max-w-md animate-fade-up",children:[(0,n.jsxs)("div",{className:"text-center mb-10",children:[(0,n.jsx)("div",{className:"w-16 h-16 rounded-2xl bg-gradient-to-br from-primary to-accent flex items-center justify-center mx-auto mb-4",children:(0,n.jsxs)("svg",{width:"30",height:"30",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2.5",strokeLinecap:"round",children:[(0,n.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,n.jsx)("circle",{cx:"12",cy:"12",r:"4"})]})}),(0,n.jsx)("h1",{className:"text-3xl font-black gradient-text",children:"ALETHEIA"}),(0,n.jsx)("p",{className:"text-gray-500 text-sm mt-1",children:"A verdade sobre o que voc\xea come"})]}),(0,n.jsxs)("form",{onSubmit:x,className:"glass rounded-3xl p-10 space-y-5",children:[(0,n.jsx)("h2",{className:"text-xl font-bold",children:"Entrar"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block text-sm text-gray-400 mb-2",children:"Email"}),(0,n.jsx)("input",{type:"email",value:e,onChange:e=>t(e.target.value),required:!0,className:"w-full px-4 py-3.5 rounded-xl bg-dark border border-dark-border text-white placeholder-gray-600 focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary/30 transition",placeholder:"seu@email.com"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block text-sm text-gray-400 mb-2",children:"Senha"}),(0,n.jsx)("input",{type:"password",value:r,onChange:e=>c(e.target.value),required:!0,className:"w-full px-4 py-3.5 rounded-xl bg-dark border border-dark-border text-white placeholder-gray-600 focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary/30 transition",placeholder:"••••••••"})]}),u&&(0,n.jsx)("p",{className:"text-danger text-sm",children:u}),(0,n.jsx)("button",{type:"submit",disabled:f,className:"btn-glow w-full !text-center disabled:opacity-50",children:f?"Entrando...":"Entrar →"}),(0,n.jsxs)("p",{className:"text-center text-gray-500 text-sm",children:["N\xe3o tem conta? ",(0,n.jsx)(i.default,{href:"/register",className:"text-primary hover:underline",children:"Criar conta gr\xe1tis"})]})]})]})]})}},1768:function(e,t,r){"use strict";let n;r.d(t,{t:function(){return c}});var s=r(2265);let o=e=>{let t;let r=new Set,n=(e,n)=>{let s="function"==typeof e?e(t):e;if(!Object.is(s,t)){let e=t;t=(null!=n?n:"object"!=typeof s||null===s)?s:Object.assign({},t,s),r.forEach(r=>r(t,e))}},s=()=>t,o={setState:n,getState:s,getInitialState:()=>i,subscribe:e=>(r.add(e),()=>r.delete(e))},i=t=e(n,s,o);return o},i=e=>e?o(e):o,a=e=>e,l=e=>{let t=i(e),r=e=>(function(e,t=a){let r=s.useSyncExternalStore(e.subscribe,s.useCallback(()=>t(e.getState()),[e,t]),s.useCallback(()=>t(e.getInitialState()),[e,t]));return s.useDebugValue(r),r})(t,e);return Object.assign(r,t),r},c=(n=e=>({user:null,token:null,setAuth:(t,r)=>{localStorage.setItem("token",t),localStorage.setItem("user",JSON.stringify(r)),e({token:t,user:r})},logout:()=>{localStorage.removeItem("token"),localStorage.removeItem("user"),e({token:null,user:null})},hydrate:()=>{let t=localStorage.getItem("token"),r=localStorage.getItem("user");t&&r&&e({token:t,user:JSON.parse(r)})}}))?l(n):l}},function(e){e.O(0,[648,971,117,744],function(){return e(e.s=980)}),_N_E=e.O()}]);