1import{l as m,i as A,r as L,bc as h,j as r,Y as b,x as c,a5 as d}from"./index-bdaLj-2r.js";const x=()=>{const a=m(),{t:o}=A();return L.useEffect(()=>{if(h())return;(async()=>{var n,s;try{console.log("ð [CALLBACK] AuthCallback iniciado"),console.log("ð [CALLBACK] URL completa:",window.location.href);const t=new URLSearchParams(window.location.hash.substring(1)).get("type");console.log("ð [CALLBACK] Type:",t),await new Promise(l=>setTimeout(l,500));const{data:{session:e},error:u}=await c.auth.getSession();if(console.log("ð¤ [CALLBACK] Sesión:",(n=e==null?void 0:e.user)==null?void 0:n.id,"Email:",(s=e==null?void 0:e.user)==null?void 0:s.email,"Error:",u),e!=null&&e.user){console.log("â
[CALLBACK] Usuario autenticado:",e.user.email),await new Promise(C=>setTimeout(C,1e3)),console.log("ð [CALLBACK] Consultando perfil...");const{data:l,error:g}=await c.from("profiles").select("id, role, name").eq("id",e.user.id).maybeSingle();if(console.log("ð [CALLBACK] Profile encontrado:",l,"Error:",g),!l){console.log("ð [CALLBACK] NO HAY PERFIL - redirigiendo a onboarding"),a("/onboarding");return}console.log("â
[CALLBACK] PERFIL EXISTE - redirigiendo a dashboard"),
1console.log('â¡ï¸ [CALLBACK] navigate("/dashboard")'),d.success(o("authCallback.loginSuccess")),a("/dashboard");return}console.log("â ï¸ [CALLBACK] NO HAY SESIÃN ACTIVA"),t==="signup"||t==="email_confirmation"?(console.log("ð§ [CALLBACK] Email confirmado sin sesión, redirigiendo a onboarding"),console.log('â¡ï¸ [CALLBACK] navigate("/onboarding") en 1 segundo'),d.success(o("authCallback.emailConfirmed"),{description:o("authCallback.completingRegistration")}),setTimeout(()=>{a("/onboarding")},1e3)):(console.log('â¡ï¸ [CALLBACK] navigate("/login")'),a("/login"))}catch(i){console.error("â Error en callback:",i),a("/login")}})()},[a,o]),r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-muted/50",children:r.jsxs("div",{className:"text-center",children:[r.jsx(b,{className:"h-12 w-12 animate-spin text-futbal-blue dark:text-futbal-teal mx-auto mb-4"}),r.jsx("h2",{className:"text-xl font-semibold text-foreground mb-2",children:o("authCallback.confirmingEmail")}),r.jsx("p",{className:"text-muted-foreground",children:o("authCallback.pleaseWait")})]})})};export{x as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.