1import{o as T,a6 as I,s as p,j as e,ap as v,w as N}from"./index-M5i7n0tf.js";import{u as A,f as E,b as i,L as y}from"./vendor-react-CMHnv8wr.js";import{c as U,r as $}from"./facturacionPersonalizadoService-BBjyBMFO.js";import{u as D}from"./index-CWjD9390.js";import{L as z}from"./loader-circle-CDjxxYqm.js";import{C as G}from"./circle-check-DXt9MfH5.js";import{R as C}from"./refresh-cw-CJO8EDhq.js";import"./vendor-supabase-B9q_TACa.js";import"./es-yVa5ZHJ0.js";import"./en-Dal21Gob.js";/** 2 * @license lucide-react v0.577.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const M=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],q=T("log-in",M);function ee(){const t=D("activarPlan"),c=A(),[S]=E(),n=S.get("session_id")??"",{setAgenteUser:g,logout:k}=I(),[r,a]=i.useState("cargando"),[h,_]=i.useState(null),[R,F]=i.useState(null),[L,m]=i.useState(""),b=`/agente/activar-plan?session_id=${encodeURIComponent(n)}`,f=i.useCallback(async()=>{const{data:l}=await p.rpc("get_agente_id_for_current_user");if(!l)return;const{data:x}=await p.from("agentes").select("*").eq("id",l).maybeSingle();x&&g(x)},[g]),u=i.useCallback(async()=>{var l,x;a("cargando"),m("");try{const s=await U(n);_(s.email),F(s.plan);const o=s.estado,{data:{session:d}}=await p.auth.getSession(),j=((x=(l=d==null?void 0:d.user)==null?void 0:l.email)==null?void 0:x.toLowerCase())??null,w=!!(j&&s.email&&j===s.email.toLowerCase());if(o==="pendiente_cuenta"){if(s.cuenta==="sin_verificar"){if(!w){a(d?"otraCuenta":"iniciar");return}if((await $(n)).estado==="revision"){a("revision");return}await f(),c("/agente/facturacion",{replace:!0});return}c(`/registro?pago=${encodeURIComponent(n)}`,{replace:!0});return}if(o==="activa"||o==="pago_fallido"||o==="cancelada"){if(w){await f(),c("/agente/facturacion",{replace:!0});return}a("activa");return}if(o==="revision"){a("revision");return}if(o==="no_pagada"){a("procesando");return}m(t.noReconocido),a("error")}catch(s){m(s instanceof Error?s.message:t.errGenerico),a("error")}},[n,c,f,t.noReconocido,t.errGenerico]);i.useEffect(()=>{if(!n){m(t.sinSesion),a("error");return}u()},[n,u,t.sinSesion]);async function P(){await k(),c(`/agente/login?volver=${encodeURIComponent(b)}`)}return e.jsx("div",{className:"min-h-screen bg-darker admin-aurora fx-noise flex items-center justify-center px-4 py-10",children:e.jsxs("div",{className:"w-full max-w-md admin-reveal",children:[e.jsx("div",{className:"text-center mb-6",children:e.jsx("div",{className:"inline-flex p-[2.5px] rounded-2xl bg-gradient-to-br from-cyan/15 to-blue/10",children:e.jsx("div",{className:"g-chip flex items-center justify-center w-14 h-14 rounded-2xl",children:e.jsx("img",{src:"/fixielogo.webp",alt:"Fixie",className:"w-11 h-11 rounded-[10px] object-contain"})})})}),e.jsxs("div",{className:"fx-glass p-7 text-center space-y-4",children:[r==="cargando"&&e.jsxs(e.Fragment,{children:[e.jsx(z,{className:"w-8 h-8 mx-auto text-cyan animate-spin"}),e.jsx("p",{className:"text-white/70 text-sm",children:t.confirmando})]}),r==="activa"&&e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-10 h-10 mx-auto text-green-400"}),e.jsx("h1",{className:"text-xl font-bold text-white",children:t.activaTitulo(R)}),e.jsx("p",{className:"text-sm text-white/55",children:t.activaSub(h)}),e.jsx(y,{to:"/agente/login",className:"inline-flex justify-center w-full py-3 rounded-xl bg-blue hover:bg-blue-600 text-white text-sm font-semibold transition-colors",children:t.iniciarSesion})]}),r==="iniciar"&&e.jsxs(e.Fragment,{children:[e.jsx(q,{className:"w-10 h-10 mx-auto text-cyan"}),e.jsx("h1",{className:"text-xl font-bold text-white",children:t.iniciarTitulo}),e.jsx("p",{className:"text-sm text-white/55",children:t.iniciarSub(h)}),e.jsx(y,{to:`/agente/login?volver=${encodeURIComponent(b)}`,className:"inline-flex justify-center w-full py-3 rounded-xl bg-blue hover:bg-blue-600 text-white text-sm font-semibold transition-colors",children:t.iniciarSesion})]}),r==="otraCuenta"&&e.jsxs(e.Fragment,{children:[e.jsx(v,{className:"w-10 h-10 mx-auto text-amber-400"}),e.jsx("h1",{className:"text-xl font-bold text-white",children:t.otraCuentaTitulo}),e.jsx("p",{className:"text-sm text-white/55",children:t.otraCuentaSub(h)}),e.jsx("button",{type:"button",onClick:P,className:"inline-flex justify-center w-full py-3 rounded-xl bg-blue hover:bg-blue-600 text-white text-sm font-semibold transition-colors",children:t.cambiarCuenta})]}),r==="revision"&&e.jsxs(e.Fragment,{children:[e.jsx(N,{className:"w-10 h-10 mx-auto text-amber-400"}),e.jsx("h1",{className:"text-xl font-bold text-white",children:t.revisionTitulo}),e.jsx("p",{className:"text-sm text-white/55",children:t.revisionSub})]}),r==="procesando"&&e.jsxs(e.Fragment,{children:[e.jsx(N,{className:"w-10 h-10 mx-auto text-cyan"}),e.jsx("h1",{className:"text-xl font-bold text-white",children:t.procesandoTitulo}),e.jsx("p",{className:"text-sm text-white/55",children:t.procesandoSub}),e.jsxs("button",{type:"button",onClick:u,className:"inline-flex items-center gap-1.5 text-sm font-semibold text-cyan hover:text-cyan/80",children:[e.jsx(C,{className:"w-4 h-4"})," ",t.revisarDeNuevo]})]}),r==="error"&&e.jsxs(e.Fragment,{children:[e.jsx(v,{className:"w-10 h-10 mx-auto text-red-400"}),e.jsx("h1",{className:"text-xl font-bold text-white",children:t.errorTitulo}),e.jsx("p",{className:"text-sm text-white/45",children:L}),n&&e.jsxs("button",{type:"button",onClick:u,className:"inline-flex items-center gap-1.5 text-sm font-semibold text-cyan hover:text-cyan/80",children:[e.jsx(C,{className:"w-4 h-4"})," ",t.revisarDeNuevo]})]})]})]})})}export{ee 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.