`)?t=t.replace(``,`${r}`):t.includes(``)?t=t.replace(``,`${r}`):t+=r;let i=new Blob([t],{type:`text/html;charset=utf-8;`}),a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.setAttribute(`download`,`index.html`),document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a)}catch{window.open(`/acsilink-standalone.html`,`_blank`)}finally{me(!1)}},disabled:pe,className:`flex items-center gap-1.5 px-3 py-1.5 bg-emerald-600 hover:bg-emerald-700 text-white rounded-xl text-xs font-bold transition-all shadow-xs cursor-pointer active:scale-95`,title:`Descargar toda la app en un único archivo index.html para subir directamente a Netlify Drop sin compilar`,children:[(0,$.jsx)(fe,{className:`w-3.5 h-3.5`}),(0,$.jsx)(`span`,{className:`hidden lg:inline`,children:`Descargar index.html (Netlify)`}),(0,$.jsx)(`span`,{className:`lg:hidden`,children:`Netlify HTML`})]}),n.length>0&&(0,$.jsxs)(`button`,{onClick:()=>t(n[0].slug),className:`hidden sm:flex items-center gap-1.5 px-3 py-1.5 bg-slate-100 hover:bg-slate-200 text-slate-700 rounded-xl text-xs font-semibold transition-colors`,title:`Abrir micro-página pública de cliente`,children:[(0,$.jsx)(Be,{className:`w-3.5 h-3.5 text-slate-600`}),(0,$.jsx)(`span`,{children:`Ver Micro-página`})]}),(0,$.jsx)(`button`,{onClick:()=>{AC(!1),e()},className:`p-2 text-slate-500 hover:text-red-600 hover:bg-red-50 rounded-xl transition-colors`,title:`Cerrar sesión`,children:(0,$.jsx)(Se,{className:`w-4 h-4`})})]})]})}),(0,$.jsxs)(`main`,{className:`flex-1 max-w-7xl w-full mx-auto p-4 sm:p-6 lg:p-8 space-y-6`,children:[S&&(0,$.jsxs)(`section`,{"aria-labelledby":`logo-uploader-title`,className:`bg-white rounded-2xl border border-slate-200/90 shadow-sm p-4 sm:p-5 transition-all`,children:[(0,$.jsx)(`input`,{ref:ee,type:`file`,accept:`.jpg,.jpeg,.png,.svg,image/jpeg,image/png,image/svg+xml`,onChange:e=>ne(e,i),className:`hidden`}),(0,$.jsxs)(`div`,{className:`flex flex-col md:flex-row items-start md:items-center justify-between gap-3 pb-3 border-b border-slate-100`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,$.jsx)(`div`,{className:`w-9 h-9 rounded-xl bg-blue-50 text-blue-600 flex items-center justify-center shrink-0`,children:(0,$.jsx)(ae,{className:`w-5 h-5`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{id:`logo-uploader-title`,className:`text-sm font-bold text-slate-900 flex items-center gap-2`,children:[(0,$.jsx)(`span`,{children:`Subida de Logo del Perfil`}),(0,$.jsx)(`span`,{className:`text-[10px] px-2 py-0.5 bg-blue-100 text-blue-700 rounded-full font-semibold`,children:`JPG, PNG, SVG • Máx. 2MB`})]}),(0,$.jsx)(`p`,{className:`text-xs text-slate-500`,children:`Carga el logo personalizado del negocio seleccionado para su tarjeta NFC y biolink.`})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 w-full md:w-auto`,children:[(0,$.jsx)(`label`,{htmlFor:`biz-logo-selector`,className:`text-xs text-slate-500 font-medium whitespace-nowrap`,children:`Negocio:`}),(0,$.jsxs)(`select`,{id:`biz-logo-selector`,value:i?.id||``,onChange:e=>{let t=n.find(t=>t.id===e.target.value);a(t||null),_(null)},className:`w-full md:w-64 px-3 py-1.5 bg-slate-50 border border-slate-200 rounded-xl text-xs font-semibold text-slate-800 focus:outline-none focus:ring-2 focus:ring-blue-500`,children:[(0,$.jsx)(`option`,{value:``,children:`-- Seleccionar Negocio Afiliado --`}),n.map((e,t)=>(0,$.jsxs)(`option`,{value:e.id,children:[e.name,` (`,e.slug,`)`]},`logo-biz-${e.id}-${t}`))]})]})]}),g&&(0,$.jsxs)(`div`,{role:`alert`,className:`mt-3 p-3 bg-red-50 border border-red-200 rounded-xl text-xs text-red-700 flex items-start justify-between gap-2 animate-shake`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,$.jsx)(ce,{className:`w-4 h-4 text-red-600 shrink-0 mt-0.5`}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{className:`font-bold block`,children:`No se pudo subir la imagen:`}),(0,$.jsx)(`span`,{children:g})]})]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>_(null),className:`text-red-500 hover:text-red-800 p-0.5 rounded`,title:`Cerrar advertencia`,children:(0,$.jsx)(Ze,{className:`w-3.5 h-3.5`})})]}),v&&(0,$.jsxs)(`div`,{role:`status`,className:`mt-3 p-3 bg-emerald-50 border border-emerald-200 rounded-xl text-xs text-emerald-800 flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(le,{className:`w-4 h-4 text-emerald-600 shrink-0`}),(0,$.jsx)(`span`,{className:`font-semibold`,children:v})]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>y(null),className:`text-emerald-600 hover:text-emerald-900 p-0.5 rounded`,title:`Cerrar confirmación`,children:(0,$.jsx)(Ze,{className:`w-3.5 h-3.5`})})]}),i?(0,$.jsxs)(`div`,{className:`mt-4 grid grid-cols-1 md:grid-cols-12 gap-4 items-center`,children:[(0,$.jsxs)(`div`,{className:`md:col-span-4 flex items-center gap-3.5 p-3 bg-slate-50 rounded-xl border border-slate-100`,children:[(0,$.jsx)(`div`,{className:`w-14 h-14 rounded-xl ${i.avatarBgColor||`bg-blue-600`} text-white font-bold text-lg flex items-center justify-center shrink-0 shadow-xs overflow-hidden border border-slate-200 bg-white`,children:i.avatarUrl?(0,$.jsx)(`img`,{src:i.avatarUrl,alt:`Logo de ${i.name}`,className:`w-full h-full object-cover`}):(0,$.jsx)(`span`,{className:`text-slate-800`,children:i.name.slice(0,2).toUpperCase()})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`text-[11px] font-bold text-slate-800 block truncate`,children:i.name}),(0,$.jsxs)(`span`,{className:`text-[10px] text-slate-500 font-mono block truncate`,children:[`/`,i.slug]}),(0,$.jsx)(`span`,{className:`inline-block mt-1 text-[10px] font-semibold px-1.5 py-0.2 rounded ${i.avatarUrl?`bg-emerald-100 text-emerald-700`:`bg-amber-100 text-amber-700`}`,children:i.avatarUrl?`✓ Logo Cargado`:`Sin logo personalizado`})]})]}),(0,$.jsxs)(`div`,{onDragOver:e=>{e.preventDefault(),x(!0)},onDragLeave:()=>x(!1),onDrop:e=>{e.preventDefault(),x(!1);let t=e.dataTransfer.files?.[0];t&&te(t,i)},onClick:()=>ee.current?.click(),className:`md:col-span-8 border-2 border-dashed rounded-xl p-3.5 flex flex-col sm:flex-row items-center justify-between gap-3 cursor-pointer transition-all ${b?`border-blue-500 bg-blue-50/70 scale-[1.01]`:`border-slate-200 hover:border-blue-400 bg-slate-50/50 hover:bg-slate-50`}`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3 text-center sm:text-left`,children:[(0,$.jsx)(`div`,{className:`w-10 h-10 rounded-full bg-blue-100 text-blue-700 flex items-center justify-center shrink-0`,children:(0,$.jsx)(Ke,{className:`w-4 h-4`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-xs font-bold text-slate-800 block`,children:`Haz clic para seleccionar o arrastra el logo aquí`}),(0,$.jsx)(`span`,{className:`text-[11px] text-slate-500`,children:`Solo archivos JPG, PNG o SVG • Tamaño máximo: 2MB`})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),ee.current?.click()},className:`px-3 py-1.5 bg-blue-600 hover:bg-blue-700 text-white rounded-lg text-xs font-semibold shadow-xs transition-colors flex items-center gap-1.5`,children:[(0,$.jsx)(Ke,{className:`w-3.5 h-3.5`}),(0,$.jsx)(`span`,{children:i.avatarUrl?`Cambiar Logo`:`Cargar Logo`})]}),i.avatarUrl&&(0,$.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),re(i)},className:`p-1.5 text-slate-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-colors`,title:`Quitar logo de perfil y usar iniciales`,children:(0,$.jsx)(We,{className:`w-4 h-4`})})]})]})]}):(0,$.jsxs)(`div`,{className:`mt-3 p-3 bg-slate-50 rounded-xl border border-slate-100 text-center text-xs text-slate-500 flex items-center justify-center gap-2`,children:[(0,$.jsx)(Be,{className:`w-4 h-4 text-slate-400`}),(0,$.jsxs)(`span`,{children:[`Selecciona un negocio en el menú desplegable superior o pulsa el botón `,(0,$.jsx)(`strong`,{children:`"Logo"`}),` en cualquier tarjeta del directorio para cargar su imagen.`]})]})]}),i?(0,$.jsx)(TF,{business:i,onSave:se,onCancel:()=>a(null),onViewPublic:t}):o===`palettes`?(0,$.jsxs)(`div`,{className:`space-y-6`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3 pb-4 border-b border-slate-200`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`text-xl font-bold text-slate-900 flex items-center gap-2`,children:[(0,$.jsx)(Oe,{className:`w-5 h-5 text-blue-600`}),(0,$.jsx)(`span`,{children:`Gestor de Paletas de Colores Predefinidas`})]}),(0,$.jsx)(`p`,{className:`text-xs text-slate-500`,children:`Selecciona la combinación cromática de alto impacto visual para el perfil público del negocio.`})]}),(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,$.jsx)(`button`,{onClick:()=>s(`businesses`),className:`px-3.5 py-2 bg-white border border-slate-200 text-slate-700 rounded-xl text-xs font-semibold hover:bg-slate-50 shadow-xs`,children:`Volver a Negocios`})})]}),m&&(0,$.jsxs)(`div`,{role:`status`,className:`p-3 bg-emerald-50 border border-emerald-200 rounded-xl text-xs text-emerald-800 flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(le,{className:`w-4 h-4 text-emerald-600 shrink-0`}),(0,$.jsx)(`span`,{className:`font-semibold`,children:m})]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>h(null),className:`text-emerald-600 hover:text-emerald-900 p-0.5 rounded`,children:(0,$.jsx)(Ze,{className:`w-3.5 h-3.5`})})]}),(0,$.jsxs)(`div`,{className:`p-4 bg-white rounded-2xl border border-slate-200 shadow-xs flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-blue-600 text-white flex items-center justify-center font-bold shadow-xs`,children:(i||n[0])?.name.slice(0,2).toUpperCase()||`AC`}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`text-xs text-slate-500 block`,children:`Negocio seleccionado para aplicar paleta:`}),(0,$.jsx)(`span`,{className:`text-sm font-bold text-slate-900`,children:(i||n[0])?.name||`Ningún negocio`})]})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`label`,{htmlFor:`palette-biz-select`,className:`text-xs font-semibold text-slate-600 whitespace-nowrap`,children:`Cambiar Negocio:`}),(0,$.jsx)(`select`,{id:`palette-biz-select`,value:(i||n[0])?.id||``,onChange:e=>{let t=n.find(t=>t.id===e.target.value);t&&a(t)},className:`px-3 py-1.5 bg-slate-50 border border-slate-200 rounded-xl text-xs font-semibold text-slate-800 focus:outline-none focus:ring-2 focus:ring-blue-500`,children:n.map((e,t)=>(0,$.jsxs)(`option`,{value:e.id,children:[e.name,` (`,e.slug,`)`]},`palette-biz-${e.id}-${t}`))})]})]}),(0,$.jsx)(`div`,{className:`bg-white p-5 sm:p-6 rounded-2xl border border-slate-200 shadow-xs`,children:(0,$.jsx)(vF,{business:i||n[0],onSelectPalette:e=>w(e,i||n[0])})})]}):o===`analytics`?(0,$.jsxs)(`div`,{className:`space-y-6`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-3 pb-4 border-b border-slate-200`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`text-xl font-bold text-slate-900 flex items-center gap-2`,children:[(0,$.jsx)(oe,{className:`w-5 h-5 text-blue-600`}),(0,$.jsx)(`span`,{children:`Rendimiento de Enlaces y Métricas`})]}),(0,$.jsx)(`p`,{className:`text-xs text-slate-500`,children:`Visualiza qué enlaces, redes sociales y servicios comerciales reciben más clics y conversiones.`})]}),(0,$.jsx)(`button`,{onClick:()=>s(`businesses`),className:`px-3.5 py-2 bg-white border border-slate-200 text-slate-700 rounded-xl text-xs font-semibold hover:bg-slate-50 shadow-xs self-start sm:self-auto cursor-pointer`,children:`Volver a Negocios`})]}),(0,$.jsx)(bF,{businesses:n,selectedBusiness:i,onSelectBusiness:e=>a(e)}),(0,$.jsxs)(`div`,{className:`bg-white rounded-2xl border border-slate-200/90 shadow-xs overflow-hidden`,children:[(0,$.jsx)(`div`,{className:`p-5 border-b border-slate-100`,children:(0,$.jsx)(`h3`,{className:`font-bold text-sm text-slate-900`,children:`Resumen Global de Negocios Afiliados`})}),(0,$.jsx)(`div`,{className:`overflow-x-auto`,children:(0,$.jsxs)(`table`,{className:`w-full text-left text-xs`,children:[(0,$.jsx)(`thead`,{className:`bg-slate-50 text-slate-500 font-semibold border-b border-slate-200`,children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{className:`py-3 px-4`,children:`Negocio Afiliado`}),(0,$.jsx)(`th`,{className:`py-3 px-4`,children:`Rubro`}),(0,$.jsx)(`th`,{className:`py-3 px-4 font-mono`,children:`Visitas`}),(0,$.jsx)(`th`,{className:`py-3 px-4 font-mono`,children:`WhatsApp Leads`}),(0,$.jsx)(`th`,{className:`py-3 px-4 font-mono`,children:`Google Reseñas`}),(0,$.jsx)(`th`,{className:`py-3 px-4 font-mono`,children:`vCard Guardados`}),(0,$.jsx)(`th`,{className:`py-3 px-4`,children:`Acción`})]})}),(0,$.jsx)(`tbody`,{className:`divide-y divide-slate-100 font-medium`,children:n.map((e,t)=>(0,$.jsxs)(`tr`,{className:`hover:bg-slate-50/80 transition-colors`,children:[(0,$.jsxs)(`td`,{className:`py-3 px-4`,children:[(0,$.jsx)(`div`,{className:`font-bold text-slate-900`,children:e.name}),(0,$.jsx)(`div`,{className:`text-[11px] text-slate-400 font-mono`,children:e.slug})]}),(0,$.jsx)(`td`,{className:`py-3 px-4 capitalize text-slate-600`,children:e.category}),(0,$.jsx)(`td`,{className:`py-3 px-4 font-mono font-bold text-slate-900`,children:e.stats.totalViews}),(0,$.jsx)(`td`,{className:`py-3 px-4 font-mono font-bold text-emerald-600`,children:e.stats.whatsappClicks}),(0,$.jsx)(`td`,{className:`py-3 px-4 font-mono font-bold text-amber-600`,children:e.stats.googleReviewClicks}),(0,$.jsx)(`td`,{className:`py-3 px-4 font-mono text-purple-600 font-bold`,children:e.stats.vCardDownloads}),(0,$.jsx)(`td`,{className:`py-3 px-4`,children:(0,$.jsx)(`button`,{onClick:()=>a(e),className:`text-blue-600 hover:underline font-semibold cursor-pointer`,children:`Ver detalle`})})]},`summary-biz-${e.id}-${t}`))})]})})]})]}):(0,$.jsx)(hF,{businesses:n,onSelectBusiness:e=>a(e),onCreateNew:ie,onToggleStatus:de,onDeleteBusiness:ue,onRestoreBusiness:e=>vC(e),onViewPublic:t,onUploadLogo:e=>{a(e),setTimeout(()=>{ee.current?.click()},80)}})]}),(0,$.jsx)(`footer`,{className:`bg-white border-t border-slate-200 py-4 px-6 text-center text-xs text-slate-500`,children:(0,$.jsxs)(`div`,{className:`max-w-7xl mx-auto flex flex-col sm:flex-row items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(fF,{size:`sm`,variant:`badge`,className:`bg-blue-50 text-blue-900`}),(0,$.jsx)(`span`,{children:`Herramienta gratuita para negocios afiliados a ACSI`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-4 text-[11px]`,children:[(0,$.jsx)(`button`,{onClick:()=>l(!0),className:`text-blue-600 hover:underline font-semibold`,children:`Cómo integrar a acsiperu.com`}),(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,$.jsx)(`span`,{children:`Lima, Perú © 2026`})]})]})}),(0,$.jsx)(EF,{isOpen:c,onClose:()=>l(!1)}),(0,$.jsx)(OF,{isOpen:u,onClose:()=>d(!1)}),f&&(0,$.jsx)(mF,{business:f,isOpen:!0,onClose:()=>p(null),onOpenPublic:t})]})},AF=({onLoginSuccess:e})=>{let[t,n]=(0,T.useState)(``),[r,i]=(0,T.useState)(``),[a,o]=(0,T.useState)(``);return(0,$.jsxs)(`div`,{className:`min-h-screen bg-gradient-to-b from-slate-900 via-[#0A192F] to-slate-950 flex flex-col justify-center items-center px-4 py-12 text-white`,children:[(0,$.jsx)(`div`,{className:`absolute top-1/4 left-1/2 -translate-x-1/2 -translate-y-1/2 w-96 h-96 bg-blue-600/15 rounded-full blur-3xl pointer-events-none`}),(0,$.jsxs)(`div`,{className:`relative w-full max-w-md bg-white/10 backdrop-blur-xl border border-white/15 rounded-3xl p-8 shadow-2xl space-y-6`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[(0,$.jsx)(fF,{size:`lg`,theme:`light`,showUploadPlaceholder:!1}),(0,$.jsx)(`h1`,{className:`text-xl font-bold mt-4`,children:`Acceso de Administración`}),(0,$.jsx)(`p`,{className:`text-xs text-sky-200 mt-1`,children:`Gestión de enlaces inteligentes, códigos QR y tarjetas NFC para negocios`})]}),a&&(0,$.jsx)(`div`,{className:`p-3 bg-red-500/20 border border-red-500/40 rounded-xl text-xs text-red-200 text-center animate-shake`,children:a}),(0,$.jsxs)(`form`,{onSubmit:n=>{n.preventDefault();let i=t.trim().toLowerCase(),a=r.trim();if(!i||!a){o(`Por favor ingresa tu correo y contraseña.`);return}i===`admin@acsiperu.com`&&a===`acsi2026`||i.endsWith(`@acsiperu.com`)&&a===`acsi2026`?(o(``),e()):o(`Credenciales inválidas. Verifica tu correo corporativo y contraseña.`)},className:`space-y-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{className:`block text-xs font-semibold text-slate-300 mb-1.5`,children:`Correo Electrónico ACSI`}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(O,{className:`w-4 h-4 text-slate-400 absolute left-3 top-1/2 -translate-y-1/2`}),(0,$.jsx)(`input`,{type:`email`,value:t,onChange:e=>{n(e.target.value),o(``)},placeholder:`admin@acsiperu.com`,required:!0,className:`w-full pl-9 pr-3 py-2.5 bg-black/30 border border-white/10 rounded-xl text-xs text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-blue-500`})]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{className:`block text-xs font-semibold text-slate-300 mb-1.5`,children:`Contraseña de Acceso`}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(xe,{className:`w-4 h-4 text-slate-400 absolute left-3 top-1/2 -translate-y-1/2`}),(0,$.jsx)(`input`,{type:`password`,value:r,onChange:e=>{i(e.target.value),o(``)},placeholder:`••••••••`,required:!0,className:`w-full pl-9 pr-3 py-2.5 bg-black/30 border border-white/10 rounded-xl text-xs text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-blue-500`})]})]}),(0,$.jsxs)(`button`,{type:`submit`,className:`w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-sky-500 hover:from-blue-700 hover:to-sky-600 text-white rounded-xl text-xs font-bold flex items-center justify-center gap-2 shadow-lg shadow-blue-900/40 transition-all active:scale-98 cursor-pointer`,children:[(0,$.jsx)(`span`,{children:`Ingresar al Panel`}),(0,$.jsx)(ne,{className:`w-4 h-4`})]})]}),(0,$.jsxs)(`div`,{className:`pt-4 border-t border-white/10 flex flex-col items-center text-center space-y-1 text-slate-400`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] text-slate-300`,children:[(0,$.jsx)(Re,{className:`w-3.5 h-3.5 text-blue-400`}),(0,$.jsx)(`span`,{children:`Panel exclusivo para administradores y asesores comerciales`})]}),(0,$.jsx)(`p`,{className:`text-[10px]`,children:`Aparcana & Cueto Soluciones Inteligentes • acsiperu.com`})]})]})]})},jF=[`admin`,`login`,`panel`,`dashboard`];function MF(){let[e,t]=(0,T.useState)(mC()),[n,r]=(0,T.useState)(``),[i,a]=(0,T.useState)(kC()),o=()=>{let e=new URLSearchParams(window.location.search);if(e.has(`admin`)||e.has(`login`)||e.has(`panel`))return`admin`;let t=e.get(`b`)||e.get(`link`)||e.get(`slug`)||e.get(`p`);if(t){let e=t.replace(/^link\//i,``).replace(/^\//,``).trim();return jF.includes(e.toLowerCase())?`admin`:e}let n=window.location.hash.replace(/^#\/?/,``).trim();if(n){try{n=decodeURIComponent(n)}catch{}let e=n.toLowerCase();if(e.startsWith(`link/`)){let e=n.slice(5).replace(/^\//,``).trim();return jF.includes(e.toLowerCase())?`admin`:e}return jF.includes(e)?`admin`:n}let r=window.location.pathname.replace(/^\//,``).replace(/\/$/,``).trim();if(r){try{r=decodeURIComponent(r)}catch{}let e=r.toLowerCase();if(e.startsWith(`link/`)){let e=r.slice(5).trim();return jF.includes(e.toLowerCase())?`admin`:e}if(jF.includes(e))return`admin`;if(r!==`index.html`)return r}return``};(0,T.useEffect)(()=>{let e=()=>{let e=o();r(e)};return e(),window.addEventListener(`hashchange`,e),window.addEventListener(`popstate`,e),()=>{window.removeEventListener(`hashchange`,e),window.removeEventListener(`popstate`,e)}},[]),(0,T.useEffect)(()=>gC(e=>{t(e)}),[]);let s=!n||jF.includes(n.toLowerCase()),c=s?null:e.find(e=>NC(e.slug)===NC(n)||NC(e.slug)===NC(n.replace(/^link\//i,``))),l=e=>{let t=e.trim().toLowerCase();jF.includes(t)||!t?(window.location.hash=`#/admin`,r(`admin`)):(window.location.hash=`#/link/${NC(e)}`,r(e))};return(0,$.jsx)(`div`,{className:`min-h-screen flex flex-col font-sans bg-slate-50`,children:s?i?(0,$.jsx)(kF,{onLogout:()=>{AC(!1),a(!1),l(`admin`)},onViewPublic:e=>l(e)}):(0,$.jsx)(AF,{onLoginSuccess:()=>{AC(!0),a(!0)}}):c?(0,$.jsx)(pF,{business:c,isSimulator:!1,onOpenAdmin:()=>l(`admin`)}):(0,$.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center p-6 text-center`,children:[(0,$.jsx)(`div`,{className:`w-16 h-16 rounded-full bg-slate-100 flex items-center justify-center text-slate-400 mb-4`,children:(0,$.jsx)(Ue,{className:`w-8 h-8`})}),(0,$.jsx)(`h2`,{className:`text-xl font-bold text-slate-900`,children:`Micro-página no encontrada`}),(0,$.jsxs)(`p`,{className:`text-xs text-slate-500 mt-1 max-w-sm`,children:[`La dirección `,(0,$.jsxs)(`code`,{className:`font-mono text-blue-600`,children:[`link.acsiperu.com/#/link/`,n]}),` no existe o fue dada de baja.`]}),(0,$.jsx)(`div`,{className:`mt-5 flex gap-2`,children:(0,$.jsx)(`button`,{onClick:()=>l(`admin`),className:`px-4 py-2 bg-blue-600 text-white rounded-xl text-xs font-semibold hover:bg-blue-700 transition-colors shadow-sm`,children:`Ir al Panel de Administración`})})]})})}(0,$e.createRoot)(document.getElementById(`root`)).render((0,$.jsx)(MF,{}));