1import{u as k,r as m,a as N,b as w,j as e,c as _,s as u,L as g,O as b}from"./index-DAfRUlyo.js";import{T as M}from"./utils-CJFNhXgn.js";import{L as S,B as f}from"./button-D3JlJq3y.js";import{c as o}from"./createLucideIcon-DB48v0XP.js";import{M as A,C,H as L,A as $}from"./mic-6NY3XY35.js";function j(t){const s=k({warn:t?.router===void 0}),r=t?.router||s,i=m.useRef(void 0);return N(r.stores.__store,n=>{if(t?.select){if(t.structuralSharing??r.options.defaultStructuralSharing){const c=w(i.current,t.select(n));return i.current=c,c}return t.select(n)}return n})}const E=({...t})=>e.jsx(M,{className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...t});const O=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],q=o("columns-3",O);const R=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],H=o("flag",R);const I=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],z=o("globe",I);const D=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],T=o("layout-dashboard",D);const V=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],y=o("log-out",V);const B=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],P=o("search",B);const F=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],G=o("settings",F);const U=[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]],W=o("ticket",U);const Z=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],J=o("users",Z),v=[{to:"/admin",label:"Dashboard",icon:T,exact:!0},{to:"/admin/config",label:"Configuración",icon:G},{to:"/admin/audiences",label:"Pases y precios",icon:W},{to:"/admin/destination",label:"Formato online",icon:z},{to:"/admin/final",label:"Cierre (Hagámoslo)",icon:H},{to:"/admin/seo",label:"SEO y compartir",icon:P,superOnly:!0},{to:"/admin/speakers",label:"Speakers",icon:A},{to:"/admin/agenda",label:"Agenda",icon:C},{to:"/admin/pillars",label:"Pilares",icon:q},{to:"/admin/organizers",label:"Organizadores",icon:J},{to:"/admin/allies",label:"Aliados",icon:L},{to:"/admin/sponsors",label:"Patrocinadores",icon:$}],K="[email protected]";function Q(){const t=_(),s=j({select:a=>a.location.pathname}),[r,i]=m.useState("checking"),[n,c]=m.useState("");m.useEffect(()=>{let a=!0;async function h(){const{data:{session:l}}=await u.auth.getSession();if(!l){t({to:"/admin/login"});return}a&&c(l.user.email||"");const{data:d}=await u.from("user_roles").select("role").eq("user_id",l.user.id).eq("role","admin");a&&(d&&d.length>0?i("ok"):i("no-role"))}h();const{data:{subscription:x}}=u.auth.onAuthStateChange((l,d)=>{d||t({to:"/admin/login"})});return()=>{a=!1,x.unsubscribe()}},[t]);async function p(){await u.auth.signOut(),t({to:"/admin/login"})}return r==="checking"?e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-slate-50",children:e.jsx(S,{className:"h-6 w-6 animate-spin text-slate-400"})}):r==="no-role"?e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-slate-50 p-6",children:e.jsxs("div",{className:"max-w-md text-center bg-white p-8 rounded-lg border border-slate-200 shadow-sm",children:[e.jsx("h1",{className:"text-xl font-semibold text-slate-900",children:"Sin permisos"}),e.jsxs("p",{className:"mt-2 text-sm text-slate-600",children:["Tu cuenta (",n,") no tiene el rol ",e.jsx("code",{children:"admin"}),". Contacta al administrador."]}),e.jsxs(f,{onClick:p,variant:"outline",className:"mt-6",children:[e.jsx(y,{className:"h-4 w-4 mr-2"})," Cerrar sesión"]})]})}):e.jsxs("div",{className:"min-h-screen flex bg-slate-50 font-sans",style:{fontFamily:"Inter, system-ui, sans-serif"},children:[e.jsxs("aside",{className:"w-60 bg-white border-r border-slate-200 flex flex-col",children:[e.jsxs("div",{className:"px-5 py-5 border-b border-slate-200",children:[e.jsx("div",{className:"text-[11px] font-semibold tracking-widest text-slate-400",children:"ADMIN"}),e.jsx("div",{className:"mt-1 text-sm font-semibold text-slate-900",children:"Generación MICE 202
16"})]}),e.jsx("nav",{className:"flex-1 px-2 py-4 space-y-0.5 overflow-y-auto",children:v.filter(a=>!a.superOnly||n.toLowerCase()===K).map(a=>{const h=a.exact?s===a.to:s===a.to||s.startsWith(a.to+"/"),x=a.icon;return e.jsxs(g,{to:a.to,className:`flex items-center gap-2.5 px-3 py-2 rounded-md text-sm transition-colors [&_svg]:transition-colors ${h?"bg-slate-900 !text-white [&_svg]:!text-white":"!text-slate-700 hover:bg-slate-100 [&_svg]:!text-slate-500"}`,children:[e.jsx(x,{className:"h-4 w-4"}),a.label]},a.to)})}),e.jsx("div",{className:"px-3 py-3 border-t border-slate-200",children:e.jsx(g,{to:"/",className:"text-xs text-slate-500 hover:text-slate-900",children:"â Ver landing pública"})})]}),e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[e.jsxs("header",{className:"h-14 bg-white border-b border-slate-200 flex items-center justify-between px-6",children:[e.jsx("div",{className:"text-sm text-slate-500",children:X(s)}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm text-slate-600",children:n}),e.jsxs(f,{onClick:p,variant:"outline",size:"sm",children:[e.jsx(y,{className:"h-4 w-4 mr-1.5"})," Salir"]})]})]}),e.jsx("main",{className:"flex-1 overflow-y-auto p-6",children:e.jsx(b,{})})]}),e.jsx(E,{richColors:!0,position:"top-right"})]})}function X(t){return[...v].reverse().find(r=>t===r.to||t.startsWith(r.to+"/"))?.label||"Admin"}function oe(){return j({select:s=>s.location.pathname})==="/admin/login"?e.jsx(b,{}):e.jsx(Q,{})}export{oe as component};
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.