PageSourceSearch

https://www.sarandi690.com.uy/_next/static/chunks/app/admin/page-2fd57872dd1f7e7c.js

js sarandi690.com.uy collected 2026-09-24 09:58:49 UTC 44,171 bytes, 3 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[698],{1172:(e,a,t)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"useMergedRef",{enumerable:!0,get:function(){return l}});let r=t(2115);function l(e,a){let t=(0,r.useRef)(null),l=(0,r.useRef)(null);return(0,r.useCallback)(r=>{if(null===r){let e=t.current;e&&(t.current=null,e());let a=l.current;a&&(l.current=null,a())}else e&&(t.current=o(e,r)),a&&(l.current=o(a,r))},[e,a])}function o(e,a){if("function"!=typeof e)return e.current=a,()=>{e.current=null};{let t=e(a);return"function"==typeof t?t:()=>e(null)}}("function"==typeof a.default||"object"==typeof a.default&&null!==a.default)&&void 0===a.default.__esModule&&(Object.defineProperty(a.default,"__esModule",{value:!0}),Object.assign(a.default,a),e.exports=a.default)},4667:(e,a,t)=>{"use strict";t.d(a,{A:()=>r});let r={station:{name:"Sarand\xed",dial:"690 AM",prefix:"Radio"},theme:{primaryBg:"#f57c00",buttonText:"#f57c00"},streaming:{primaryUrl:"https://radiolatina.live:10977/sarandi"},contact:{phone:"22082612",whatsapp:"092 690 690",email:"[email protected]",address:"Enriqueta Compte y Riqu\xe9 1250, Montevideo",mapsUrl:"https://maps.app.goo.gl/..."},social:{facebook:"https://www.facebook.com/Sarandi690/?locale=es_LA",twitter:"https://x.com/RadioSarandi690",instagram:"https://www.instagram.com/sarandi690/?hl=es",tiktok:"https://www.tiktok.com/@sarandi690"},appLinks:{ios:"https://apps.apple.com/kr/app/radio-sarandi-690/id6793588077?l=en-GB",android:"https://play.google.com/store/apps/details?id=com.goodbarber.radiosarandi691&hl=es_UY"}}},5103:(e,a,t)=>{Promise.resolve().then(t.bind(t,9798))},9229:(e,a,t)=>{"use strict";t.d(a,{I:()=>d,db:()=>n,j:()=>c});var r=t(7873),l=t(1531),o=t(9058),i=t(9997);let s=0===(0,r.Dk)().length?(0,r.Wp)({apiKey:"AIzaSyDW5ksLVTTCuRSHtJpp_Ohvcv7ZQLMHf0Y",authDomain:"sarandi-web-90ff4.firebaseapp.com",projectId:"sarandi-web-90ff4",storageBucket:"sarandi-web-90ff4.firebasestorage.app",messagingSenderId:"678996821088",appId:"1:678996821088:web:b816f08e0cbbfc6a942f05",measurementId:"G-KS0QTKPT8C"}):(0,r.Sx)(),n=(0,l.aU)(s),d=(0,o.c7)(s),c=(0,i.xI)(s)},9798:(e,a,t)=>{"use strict";t.r(a),t.d(a,{default:()=>u});var r=t(5155),l=t(2115),o=t(1531),i=t(9058),s=t(9997),n=t(9229),d=t(4667),c=t(5772);function m(){let[e,a]=(0,l.useState)([]),[t,s]=(0,l.useState)(!0),[d,m]=(0,l.useState)({tipo:"",texto:""}),[u,x]=(0,l.useState)(null),[b,p]=(0,l.useState)({nombre:"",sector:1,enlaceUrl:"",fechaInicio:"",fechaFin:"",limiteImpresiones:0,activa:!0,radiosPublicacion:["sarandi"]}),[h,g]=(0,l.useState)(null),[f,y]=(0,l.useState)(null);(0,l.useEffect)(()=>{j()},[]);let j=async()=>{s(!0);try{let e=(await (0,o.GG)((0,o.rJ)(n.db,"Campanas"))).docs.map(e=>({id:e.id,...e.data()}));a(e)}catch(e){console.error("Error al cargar campa\xf1as",e)}s(!1)},v=e=>{let{name:a,value:t,type:r,checked:l}=e.target;p({...b,[a]:"checkbox"===r?l:t})},N=e=>{let a=new Date(e),t=6e4*a.getTimezoneOffset();return new Date(a.getTime()-t).toISOString().slice(0,16)},w=()=>{x(null),p({nombre:"",sector:1,enlaceUrl:"",fechaInicio:"",fechaFin:"",limiteImpresiones:0,activa:!0,radiosPublicacion:["sarandi"]}),g(null),y(null)},C=async e=>{e.preventDefault(),s(!0),m({tipo:"",texto:""});try{let e=new Date(b.fechaInicio).getTime(),a=new Date(b.fechaFin).getTime();if(e>=a)throw Error("La fecha de fin debe ser posterior a la de inicio.");let t="",r="";if(!u&&!h&&!f)throw Error("Debes subir al menos una imagen para la campa\xf1a.");if(!b.radiosPublicacion||0===b.radiosPublicacion.length)throw Error("Debes seleccionar al menos una radio para publicar la campa\xf1a.");let l=Number(b.sector),s=(e,a)=>new Promise(t=>{let r=new window.Image,l=URL.createObjectURL(e);r.onload=()=>{URL.revokeObjectURL(l);let e=a.some(e=>e.w===r.width&&e.h===r.height);t(e)},r.onerror=()=>t(!1),r.src=l});if(l>=1&&l<=7){let e={1:{desktop:[{w:970,h:250},{w:728,h:90}],mobile:[{w:320,h:100}]},2:{desktop:[{w:728,h:90}],mobile:[{w:320,h:100}]},3:{desktop:[{w:728,h:90}],mobile:[{w:320,h:100}]},4:{desktop:[{w:300,h:250}]},6:{desktop:[{w:728,h:90}],mobile:[{w:320,h:100}]},7:{desktop:[{w:728,h:90}],mobile:[{w:320,h:50},{w:320,h:100}]}}[l];if(h&&!await s(h,e.desktop)){let a=e.desktop.map(e=>
1`${e.w}x${e.h}`).join(" o ");throw Error(`Error: La Imagen Desktop para el sector ${l} debe medir EXACTAMENTE ${a} p\xedxeles.`)}if(f&&e.mobile&&!await s(f,e.mobile)){let a=e.mobile.map(e=>`${e.w}x${e.h}`).join(" o ");throw Error(`Error: La Imagen Mobile para el sector ${l} debe medir EXACTAMENTE ${a} p\xedxeles.`)}}if(h){let e=(0,i.KR)(n.I,`banners/${Date.now()}_h_${h.name}`);await (0,i.D)(e,h),t=await (0,i.qk)(e)}if(f){let e=(0,i.KR)(n.I,`banners/${Date.now()}_c_${f.name}`);await (0,i.D)(e,f),r=await (0,i.qk)(e)}let d={nombre:b.nombre,sector:Number(b.sector),enlaceUrl:b.enlaceUrl,fechaInicio:e,fechaFin:a,limiteImpresiones:Number(b.limiteImpresiones)||0,activa:b.activa,radiosPublicacion:b.radiosPublicacion};if(u){let e={...d};t&&(e.imagenHorizontalUrl=t),r&&(e.imagenCuadradaUrl=r),await (0,o.mZ)((0,o.H9)(n.db,"Campanas",u),e),m({tipo:"exito",texto:"Campa\xf1a actualizada exitosamente."})}else await (0,o.gS)((0,o.rJ)(n.db,"Campanas"),{...d,imagenHorizontalUrl:t,imagenCuadradaUrl:r,impresiones:0,clics:0,creado:(0,o.O5)()}),m({tipo:"exito",texto:"Campa\xf1a creada exitosamente."});w(),j()}catch(e){console.error(e),m({tipo:"error",texto:e.message||"Ocurri\xf3 un error al guardar la campa\xf1a."})}s(!1)},k=async e=>{confirm("\xbfEst\xe1s seguro de eliminar esta campa\xf1a de forma permanente?")&&(await (0,o.kd)((0,o.H9)(n.db,"Campanas",e)),j())};return(0,r.jsxs)("div",{className:"animate-fade-in space-y-8",children:[(0,r.jsxs)("div",{className:"bg-white border border-gray-200 p-6 rounded-lg shadow-sm",children:[(0,r.jsx)("h2",{className:"text-xl font-bold text-gray-900 dark:text-gray-100 mb-4",children:u?"Editar Campa\xf1a":"Crear Nueva Campa\xf1a"}),d.texto&&(0,r.jsx)("div",{className:`p-4 mb-4 rounded-md font-bold ${"exito"===d.tipo?"bg-green-100 text-green-700":"bg-red-100 text-red-700"}`,children:d.texto}),(0,r.jsxs)("form",{onSubmit:C,className:"space-y-4",children:[(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-bold text-gray-700 mb-1",children:"Nombre de la Campa\xf1a *"}),(0,r.jsx)("input",{type:"text",name:"nombre",required:!0,value:b.nombre,onChange:v,className:"w-full border border-gray-300 rounded-md p-3",placeholder:"Ej: Antel Verano"})]}),(0,r.jsxs)("div",{className:"md:col-span-2",children:[(0,r.jsx)("label",{className:"block text-sm font-bold text-gray-700 mb-1",children:"Sector de Publicaci\xf3n *"}),(0,r.jsxs)("select",{name:"sector",value:b.sector,onChange:v,className:"w-full border border-indigo-500 rounded-md p-3 font-bold bg-indigo-50 text-indigo-900",children:[(0,r.jsx)("option",{value:0,children:"0. General / Antiguo (Sin sector espec\xedfico)"}),(0,r.jsx)("option",{value:1,children:"1. TOP_BILLBOARD (Desktop: 970x250 / Mobile: 320x100)"}),(0,r.jsx)("option",{value:2,children:"2. HOME_BANNER_1 (Desktop: 728x90 / Mobile: 320x100)"}),(0,r.jsx)("option",{value:3,children:"3. HOME_BANNER_2 (Desktop: 728x90 / Mobile: 320x100)"}),(0,r.jsx)("option",{value:4,children:"4. SIDEBAR (Desktop: 300x250) - Sin versi\xf3n m\xf3vil"}),(0,r.jsx)("option",{value:6,children:"6. ARTICLE_END (Desktop: 728x90 / Mobile: 320x100)"}),(0,r.jsx)("option",{value:7,children:"7. STICKY (Desktop: 728x90 / Mobile: 320x50 o 100)"})]})]}),(0,r.jsxs)("div",{className:"md:col-span-2",children:[(0,r.jsx)("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:"Radios Destino *"}),(0,r.jsx)("div",{className:"flex flex-wrap gap-4 bg-gray-50 border border-gray-200 p-4 rounded-lg",children:[{id:"sarandi",label:"Sarand\xed 690"},{id:"like",label:"Like 95.1"},{id:"futura",label:"Futura 91.1"},{id:"890",label:"Sport 890"},{id:"delplata",label:"Del Plata"}].map(e=>(0,r.jsxs)("label",{className:"flex items-center space-x-2 cursor-pointer font-semibold text-gray-700 bg-white px-3 py-2 border rounded-md hover:bg-gray-100 transition-colors",children:[(0,r.jsx)("input",{type:"checkbox",checked:b.radiosPublicacion.includes(e.id),onChange:()=>{var a;return a=e.id,void p(e=>{let t=e.radiosPublicacion||[];return t.includes(a)?{...e,radiosPublicacion:t.filter(e=>e!==a)}:{...e,radiosPublicacion:[...t,a]}})},className:"w-4 h-4 text-indigo-600 rounded"}),(0,r.jsx)("span",{children:e.label})]},e.id))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-bold text-gray-700 mb-1",children:"Fecha de Inicio *"}),(0,r.jsx)("input",{type:"datetime-local",name:"fechaInicio",required:!0,value:b.fechaInicio,onChange:v,className:"w-full border border-gray-300 rounded-md p-3"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-bold text-gray-700 mb-1",children:"Fecha de Finalizaci\xf3n *"}),(0,r.jsx)("input",{type:"datetime-local",name:"fechaFin",required:!0,value:b.fechaFin,onChange:v,className:"w-full border border-gray-300 rounded-md p-3"})]}),(0,r.jsxs)("div",{className:"md:col-span-2",children:[(0,r.jsx)("label",{className:"block text-sm font-bold text-gray-700 mb-1",children:"Enlace de Destino (URL) *"}),(0,r.jsx)("input",{type:"url",name:"enlaceUrl",required:!0,value:b.enlaceUrl,onChange:v,className:"w-full border border-gray-300 rounded-md p-3",placeholder:"https://..."})]}),(0,r.jsxs)("div",{className:"md:col-span-2",children:[(0,r.jsx)("label",{className:"block text-sm font-bold text-gray-700 mb-1",children:"L\xedmite de Impresiones (0 = Ilimitado)"}),(0,r.jsx)("input",{type:"number",name:"limiteImpresiones",value:b.limiteImpresiones,onChange:v,className:"w-full border border-gray-300 rounded-md p-3",placeholder:"Ej: 10000"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-bold text-gray-700 mb-1",children:"Imagen Desktop (Web)"}),(0,r.jsx)("p",{className:"text-xs text-gray-500 mb-1",children:"Ser\xe1 mostrada en computadoras o pantallas grandes."}),u&&(0,r.jsx)("p",{className:"text-xs text-blue-600 font-bold mb-1",children:"Dejar vac\xedo si no deseas cambiar la imagen actual."}),(0,r.jsx)("input",{type:"file",accept:"image/*",onChange:e=>{e.target.files&&e.target.files[0]&&g(e.target.files[0])},className:"w-full text-sm file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-indigo-50 file:text-indigo-700 border border-gray-300 rounded-md bg-white cursor-pointer"})]}),4!==Number(b.sector)&&(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-bold text-gray-700 mb-1",children:"Imagen Mobile (Celulares)"}),(0,r.jsx)("p",{className:"text-xs text-gray-500 mb-1",children:"Ser\xe1 mostrada en tel\xe9fonos m\xf3viles."}),u&&(0,r.jsx)("p",{className:"text-xs text-blue-600 font-bold mb-1",children:"Dejar vac\xedo si no deseas cambiar la imagen actual."}),(0,r.jsx)("input",{type:"file",accept:"image/*",onChange:e=>{e.target.files&&e.target.files[0]&&y(e.target.files[0])},className:"w-full text-sm file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-pink-50 file:text-pink-700 border border-gray-300 rounded-md bg-white cursor-pointer"})]}),(0,r.jsxs)("div",{className:"md:col-span-2 bg-gray-50 border border-gray-200 p-4 rounded-lg flex items-center space-x-3 mt-2",children:[(0,r.jsx)("input",{type:"checkbox",id:"activa",name:"activa",checked:b.activa,onChange:v,className:"w-5 h-5 text-indigo-600 rounded"}),(0,r.jsx)("label",{htmlFor:"activa",className:"font-bold text-gray-800 cursor-pointer",children:"\uD83D\uDFE2 Campa\xf1a Activa (Si se desmarca, se pausa inmediatamente)"})]})]}),(0,r.jsxs)("div",{className:"pt-4 flex gap-4",children:[(0,r.jsx)("button",{type:"submit",disabled:t,className:"flex-1 bg-[#f57c00] hover:bg-[#e65100] text-white font-bold py-3 rounded-md shadow-md transition-colors",children:t?"Guardando...":u?"Actualizar Campa\xf1a":"Crear Campa\xf1a"}),u&&(0,r.jsx)("button",{type:"button",onClick:w,className:"bg-gray-200 hover:bg-gray-300 text-gray-800 font-bold py-3 px-6 rounded-md transition-colors",children:"Cancelar"})]})]})]}),(0,r.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg shadow-sm overflow-hidden",children:[(0,r.jsx)("h2",{className:"text-xl font-bold text-gray-900 dark:text-gray-100 p-6 border-b bg-gray-50",children:"Campa\xf1as Existentes"}),t&&0===e.length?(0,r.jsx)("div",{className:"p-10 text-center text-gray-500",children:"Cargando campa\xf1as..."}):0===e.length?(0,r.jsx)("div",{className:"p-10 text-center text-gray-500 font-bold",children:"No hay ninguna campa\xf1a creada todav\xeda."}):(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("table",{className:"w-full text-left border-collapse text-sm",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"bg-gray-100 text-gray-700",children:[(0,r.jsx)("th",{className:"p-4 font-bold border-b",children:"Campa\xf1a / Banner"}),(0,r.jsx)("th",{className:"p-4 font-bold border-b",children:"Zona"}),(0,r.jsx)("th",{className:"p-4 font-bold border-b",children:"Fechas"}),(0,r.jsx)("th",{className:"p-4 font-bold border-b",children:"Estad\xedsticas"}),(0,r.jsx)("th",{className:"p-4 font-bold border-b text-center",children:"Estado"}),(0,r.jsx)("th",{className:"p-4 font-bold border-b text-center",children:"Acciones"})]})}),(0,r.jsx)("tbody",{children:e.map(e=>{let a=e.activa?"bg-green-100 text-green-800":"bg-red-100 text-red-800",t=e.activa?"Activa":"Pausada",l=e.limiteImpresiones>0&&e.impresiones>=e.limiteImpresiones,o=Date.now()>e.fechaFin;return(0,r.jsxs)("tr",{className:"border-b hover:bg-gray-50",children:[(0,r.jsxs)("td",{className:"p-4",children:[(0,r.jsx)("div",{className:"font-bold text-gray-900 dark:text-gray-100",children:e.nombre}),(0,r.jsx)("a",{href:e.enlaceUrl,target:"_blank",rel:"noreferrer",className:"text-blue-500 hover:underline text-xs truncate max-w-[200px] block mt-1",children:"Ver enlace"}),(0,r.jsxs)("div",{className:"flex gap-2 mt-2",children:[(e.imagenHorizontalUrl||e.imagenUrl)&&(0,r.jsx)("div",{className:"w-24 h-12 relative bg-gray-200 rounded overflow-hidden",title:"Imagen Desktop",children:(0,r.jsx)(c.default,{src:e.imagenHorizontalUrl||e.imagenUrl||"",alt:"Desktop",fill:!0,className:"object-contain"})}),e.imagenCuadradaUrl&&(0,r.jsx)("div",{className:"w-12 h-12 relative bg-gray-200 rounded overflow-hidden",title:"Imagen Mobile",children:(0,r.jsx)(c.default,{src:e.imagenCuadradaUrl,alt:"Mobile",fill:!0,className:"object-contain"})})]})]}),(0,r.jsxs)("td",{className:"p-4 uppercase text-xs font-bold text-gray-500 tracking-wider",children:[(0,r.jsxs)("span",{className:"block mt-1 text-[#f57c00]",children:["SECTOR ",e.sector||0]}),(0,r.jsx)("div",{className:"mt-2 flex flex-wrap gap-1",children:(e.radiosPublicacion||["sarandi"]).map(e=>(0,r.jsx)("span",{className:"bg-gray-200 text-gray-700 px-2 py-0.5 rounded text-[10px]",children:e},e))})]}),(0,r.jsxs)("td",{className:"p-4 text-xs text-gray-600",children:[(0,r.jsxs)("div",{className:"font-semibold",children:["Desde: ",(0,r.jsxs)("span",{className:"font-normal",children:[new Date(e.fechaInicio).toLocaleDateString()," ",new Date(e.fechaInicio).toLocaleTimeString()]})]}),(0,r.jsxs)("div",{className:"font-semibold mt-1",children:["Hasta: ",(0,r.jsxs)("span",{className:"font-normal",children:[new Date(e.fechaFin).toLocaleDateString()," ",new Date(e.fechaFin).toLocaleTimeString()]})]}),o&&(0,r.jsx)("div",{className:"text-red-500 font-bold mt-1",children:"⚠️ Vencida"})]}),(0,r.jsx)("td",{className:"p-4 text-xs",children:(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsxs)("span",{className:"bg-blue-100 text-blue-800 px-2 py-1 rounded font-bold",children:["\uD83D\uDC41️ ",e.impresiones," Impresiones"]}),(0,r.jsxs)("span",{className:"bg-purple-100 text-purple-800 px-2 py-1 rounded font-bold",children:["\uD83D\uDC46 ",e.clics," Clics"]}),e.limiteImpresiones>0&&(0,r.jsxs)("span",{className:"text-gray-500 font-bold mt-1",children:["L\xedmite: ",e.limiteImpresiones]}),l&&(0,r.jsx)("span",{className:"text-red-500 font-bold",children:"⚠️ L\xedmite Alcanzado"})]})}),(0,r.jsx)("td",{className:"p-4 text-center",children:(0,r.jsx)("span",{className:`px-3 py-1 rounded-full text-xs font-bold uppercase tracking-wider ${a}`,children:t})}),(0,r.jsx)("td",{className:"p-4 text-center",children:(0,r.jsxs)("div",{className:"flex gap-2 justify-center flex-wrap",children:[(0,r.jsx)("button",{onClick:()=>{let a,t,r,l,o,i,s,n,d,c,m,u,x,b,p,h;return a=new Date(e.fechaInicio).toLocaleDateString(),t=new Date(e.fechaFin).toLocaleDateString(),r=e.impresiones>0?(e.clics/e.impresiones*100).toFixed(2)+"%":"0%",l=e.impresiones_sarandi||0,o=e.clics_sarandi||0,i=e.impresiones_890||0,s=e.clics_890||0,n=e.impresiones_delplata||0,d=e.clics_delplata||0,c=e.impresiones_futura||0,m=e.clics_futura||0,u=e.impresiones_like||0,x=e.clics_like||0,b=new Blob([`\uFEFFCampa\xf1a;Sector;Fecha Inicio;Fecha Fin;Impresiones Totales;Clics Totales;CTR Total;Imp Sarandi;Clics Sarandi;Imp 890;Clics 890;Imp Del Plata;Clics Del Plata;Imp Futura;Clics Futura;Imp Like;Clics Like
2"${e.nombre}";${e.sector};"${a}";"${t}";${e.impresiones};${e.clics};"${r}";${l};${o};${i};${s};${n};${d};${c};${m};${u};${x}
3`],{type:"text/csv;charset=utf-8;"}),p=URL.createObjectURL(b),void((h=document.createElement("a")).href=p,h.setAttribute("download",`Reporte_Campana_${e.nombre.replace(/\s+/g,"_")}.csv`),document.body.appendChild(h),h.click(),document.body.removeChild(h))},className:"bg-green-100 hover:bg-green-200 text-green-800 px-3 py-1 rounded text-xs font-bold",title:"Descargar Excel/CSV",children:"\uD83D\uDCCA Reporte"}),(0,r.jsx)("button",{onClick:()=>{x(e.id),p({nombre:e.nombre,sector:e.sector||1,enlaceUrl:e.enlaceUrl,fechaInicio:N(e.fechaInicio),fechaFin:N(e.fechaFin),limiteImpresiones:e.limiteImpresiones,activa:e.activa,radiosPublicacion:e.radiosPublicacion||["sarandi"]}),g(null),y(null),window.scrollTo({top:0,behavior:"smooth"})},className:"bg-gray-200 hover:bg-gray-300 text-gray-800 px-3 py-1 rounded text-xs font-bold",children:"Editar"}),(0,r.jsx)("button",{onClick:()=>k(e.id),className:"bg-red-100 hover:bg-red-200 text-red-700 px-3 py-1 rounded text-xs font-bold",children:"Eliminar"})]})})]},e.id)})})]})})]})]})}function u(){let[e,a]=(0,l.useState)(null),[t,c]=(0,l.useState)(""),[u,x]=(0,l.useState)(""),[b,p]=(0,l.useState)(""),[h,g]=(0,l.useState)(!0),[f,y]=(0,l.useState)(!1),[j,v]=(0,l.useState)("admin");(0,l.useEffect)(()=>{let e=(0,s.hg)(n.j,async e=>{if(e){a(e);let t="redaccion",r=e.email?.toLowerCase()||"";if("[email protected]"===r||"[email protected]"===r||r.includes("angeles.gil")||r.includes("nicojuanicols9"))t="admin",y(!0);else if(r.includes("jorge.acuna")||r.includes("giselle.coca"))t="publicidad";else try{let a=await (0,o.x7)((0,o.H9)(n.db,"Usuarios",e.uid));if(a.exists()){let e=a.data();("admin"===e.rol||"redaccion"===e.rol||"publicidad"===e.rol)&&(t=e.rol)}else{let a=(0,o.P)((0,o.rJ)(n.db,"Usuarios"),(0,o._M)("email","==",e.email)),r=await (0,o.GG)(a);if(!r.empty){let e=r.docs[0].data();("admin"===e.rol||"redaccion"===e.rol||"publicidad"===e.rol)&&(t=e.rol)}}}catch(e){console.error("Error obteniendo rol",e)}v(t),"publicidad"===t?O("campanas"):O("noticias")}else a(null),v("admin");g(!1)});return()=>e()},[]);let N=async e=>{e.preventDefault(),p("");try{await (0,s.x9)(n.j,t,u)}catch(e){console.error(e),p("Credenciales incorrectas o no tienes permisos.")}},w=async()=>{try{await (0,s.CI)(n.j)}catch(e){console.error("Error al cerrar sesi\xf3n",e)}},[C,k]=(0,l.useState)(!1),[S,A]=(0,l.useState)(""),[E,I]=(0,l.useState)({tipo:"",texto:""}),[D,U]=(0,l.useState)(null),[P,L]=(0,l.useState)([{texto:"",archivoAudio:null,audioUrl:""}]),[$,R]=(0,l.useState)([]),[T,_]=(0,l.useState)(null),[F,M]=(0,l.useState)(""),[q,O]=(0,l.useState)("noticias"),[B,G]=(0,l.useState)("sarandi"),[H,z]=(0,l.useState)({activo:!0,clientId:"",adeqmediaCodeGlobal:""}),[V,Y]=(0,l.useState)(!1),[K,J]=(0,l.useState)({tipo:"",texto:""}),W=async(e=B)=>{try{let a="sarandi"===e?"Publicidad":`Publicidad_${e}`,t=(0,o.H9)(n.db,"Configuracion",a),r=await (0,o.x7)(t);r.exists()?z({activo:!1!==r.data().activo,clientId:r.data().clientId||"",adeqmediaCodeGlobal:r.data().adeqmediaCodeGlobal||""}):z({activo:!0,clientId:"",adeqmediaCodeGlobal:""})}catch(e){console.error("Error al cargar configuraci\xf3n de anuncios:",e)}};(0,l.useEffect)(()=>{e&&W(B)},[B]);let Z=async e=>{e.preventDefault(),Y(!0),J({tipo:"",texto:""});try{let e="sarandi"===B?"Publicidad":`Publicidad_${B}`,a=(0,o.H9)(n.db,"Configur
3acion",e);await (0,o.BN)(a,H,{merge:!0}),J({tipo:"exito",texto:"\xa1Configuraci\xf3n de publicidad guardada con \xe9xito!"})}catch(e){console.error("Error al guardar ads:",e),J({tipo:"error",texto:e.message||"Error al guardar."})}finally{Y(!1)}},[Q,X]=(0,l.useState)({titulo:"",subtitulo:"",programa:"Redacci\xf3n Central",prioridad:"2",esColumna:!1,imagenUrl:"",youtubeUrl:"",timestamp:0,fechaProgramada:""}),ee=async()=>{try{let e=(0,o.P)((0,o.rJ)(n.db,"Noticias"),(0,o.My)("timestamp","desc")),a=(await (0,o.GG)(e)).docs.map(e=>({id:e.id,...e.data()}));R(a)}catch(e){console.error("Error al cargar la tabla:",e)}};(0,l.useEffect)(()=>{e&&(ee(),W(B))},[e]);let ea=e=>{let a="checkbox"===e.target.type?e.target.checked:e.target.value;X({...Q,[e.target.name]:a})},et=async a=>{a.preventDefault(),k(!0),I({tipo:"",texto:""}),A("Iniciando publicaci\xf3n...");try{let a=Q.imagenUrl,t=Q.youtubeUrl;if(t){let e,r=(e=t.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/))&&11===e[2].length?e[2]:null;if(r)a=`https://img.youtube.com/vi/${r}/maxresdefault.jpg`,t=`https://www.youtube.com/embed/${r}`;else throw Error("El link de YouTube no es v\xe1lido.")}else if(D){A("Subiendo foto de portada... Por favor, no cierres esta ventana.");let e=`${Date.now()}_${D.name}`,t=(0,i.KR)(n.I,`imagenes_noticias/${e}`);await (0,i.D)(t,D),a=await (0,i.qk)(t)}else if(!T)throw Error("Debes subir una imagen O pegar un link de YouTube.");let r=[];for(let e=0;e<P.length;e++){let a=P[e].audioUrl;if(P[e].archivoAudio){A(`Subiendo audio del bloque ${e+1}... Por favor, no cierres esta ventana.`);let t=`${Date.now()}_${P[e].archivoAudio.name}`,r=(0,i.KR)(n.I,`audios_noticias/${t}`);await (0,i.D)(r,P[e].archivoAudio),a=await (0,i.qk)(r)}r.push({texto:P[e].texto,audioUrl:a})}let l=Q.fechaProgramada?new Date(Q.fechaProgramada).getTime():null,s={titulo:Q.titulo,subtitulo:Q.subtitulo,imagenUrl:a,youtubeUrl:t,programa:Q.programa,prioridad:Q.prioridad,esColumna:Q.esColumna,cuerpo:r[0]?.texto||"",audioUrl:r[0]?.audioUrl||"",bloques:r,autorEmail:e?.email||"Desconocido",fecha:l?new Date(l).toLocaleDateString("es-UY"):new Date().toLocaleDateString("es-UY"),timestamp:T?l||Q.timestamp:l||Date.now()};A("Guardando noticia en la base de datos...");let d="https://www.sarandi690.com.uy";if(T)await (0,o.mZ)((0,o.H9)(n.db,"Noticias",T),s),I({tipo:"exito",texto:`\xa1Actualizado con \xe9xito! Link: ${d}/noticias/${T}`});else{let e=(0,o.H9)((0,o.rJ)(n.db,"Noticias"));await (0,o.BN)(e,s),I({tipo:"exito",texto:`\xa1Publicado con \xe9xito! Link: ${d}/noticias/${e.id}`})}X({titulo:"",subtitulo:"",programa:"Redacci\xf3n Central",prioridad:"2",esColumna:!1,imagenUrl:"",youtubeUrl:"",timestamp:0,fechaProgramada:""}),L([{texto:"",archivoAudio:null,audioUrl:""}]),U(null),_(null);let c=document.getElementById("file-upload");c&&(c.value=""),ee()}catch(e){console.error("Error:",e),I({tipo:"error",texto:e.message||"Error en la operaci\xf3n."})}finally{k(!1),A("")}},er=async e=>{if(window.confirm("\xbfEliminar para siempre?"))try{await (0,o.kd)((0,o.H9)(n.db,"Noticias",e)),ee()}catch(e){console.error("Error",e)}};return h?(0,r.jsxs)("div",{className:"min-h-screen bg-gray-100 flex flex-col justify-center items-center",children:[(0,r.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-t-4 border-b-4 border-[#f57c00]"}),(0,r.jsx)("p",{className:"mt-4 font-bold text-gray-500",children:"Verificando sesi\xf3n..."})]}):e?(0,r.jsx)("div",{className:"min-h-screen bg-gray-50 py-12 font-sans px-4",children:(0,r.jsxs)("div",{className:"max-w-4xl mx-auto space-y-8",children:[(0,r.jsxs)("div",{className:"bg-white p-8 rounded-xl shadow-md border border-gray-200",children:[(0,r.jsxs)("div",{className:"mb-8 border-b pb-4 flex justify-between items-center",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-3xl font-extrabold text-gray-900 dark:text-gray-100",children:T?"Modificar Publicaci\xf3n":"Panel de Administraci\xf3n"}),(0,r.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:["Conectado como: ",(0,r.jsx)("span",{className:"font-bold text-[#f57c00]",children:e.email})," (Rol: ",(0,r.jsx)("span",{className:"uppercase text-gray-800",children:j}),")"]})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[T&&(0,r.jsx)("button",{onClick:()=>
3{X({titulo:"",subtitulo:"",programa:"Redacci\xf3n Central",prioridad:"2",esColumna:!1,imagenUrl:"",youtubeUrl:"",timestamp:0}),L([{texto:"",archivoAudio:null,audioUrl:""}]),_(null),U(null)},className:"text-sm bg-gray-200 hover:bg-gray-300 px-4 py-2 rounded-md font-bold transition-colors",children:"Cancelar"}),(0,r.jsx)("button",{onClick:w,className:"text-sm bg-red-100 hover:bg-red-200 text-red-700 px-4 py-2 rounded-md font-bold transition-colors",children:"Cerrar Sesi\xf3n"})]})]}),(0,r.jsxs)("div",{className:"flex border-b border-gray-200 mb-8",children:[("admin"===j||"redaccion"===j)&&(0,r.jsx)("button",{onClick:()=>O("noticias"),className:`py-3 px-6 font-bold text-sm border-b-2 transition-colors ${"noticias"===q?"border-[#f57c00] text-[#f57c00]":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:"\uD83D\uDCF0 Gesti\xf3n de Noticias"}),("admin"===j||"publicidad"===j)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{onClick:()=>O("publicidad"),className:`py-3 px-6 font-bold text-sm border-b-2 transition-colors ${"publicidad"===q?"border-[#f57c00] text-[#f57c00]":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:"\uD83D\uDCB0 Ajustes Zonas (AdSense)"}),(0,r.jsx)("button",{onClick:()=>O("campanas"),className:`py-3 px-6 font-bold text-sm border-b-2 transition-colors ${"campanas"===q?"border-[#f57c00] text-[#f57c00]":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:"\uD83C\uDFAF Campa\xf1as Propias"})]})]}),("admin"===j||"publicidad"===j)&&"campanas"===q&&(0,r.jsx)(m,{}),("admin"===j||"redaccion"===j)&&"noticias"===q&&(0,r.jsxs)(r.Fragment,{children:[E.texto&&(0,r.jsx)("div",{className:`p-4 mb-6 rounded-md font-bold ${"exito"===E.tipo?"bg-green-100 text-green-700":"bg-red-100 text-red-700"}`,children:E.texto}),(0,r.jsxs)("form",{onSubmit:et,className:"space-y-6",children:[(0,r.jsxs)("div",{className:"bg-indigo-50 border border-indigo-100 p-4 rounded-lg flex items-center space-x-3",children:[(0,r.jsx)("input",{type:"checkbox",id:"esColumna",name:"esColumna",checked:Q.esColumna,onChange:ea,className:"w-5 h-5 text-indigo-600 rounded focus:ring-indigo-500"}),(0,r.jsx)("label",{htmlFor:"esColumna",className:"font-bold text-indigo-900 cursor-pointer",children:"\uD83D\uDCCC Esta publicaci\xf3n es una COLUMNA DE OPINI\xd3N"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-bold text-gray-700 mb-1",children:"T\xedtulo *"}),(0,r.jsx)("input",{type:"text",name:"titulo",required:!0,value:Q.titulo,onChange:ea,className:"w-full border border-gray-300 rounded-md p-3"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-bold text-gray-700 mb-1",children:"Subt\xedtulo (Copete) *"}),(0,r.jsx)("input",{type:"text",name:"subtitulo",required:!0,value:Q.subtitulo,onChange:ea,className:"w-full border border-gray-300 rounded-md p-3"})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-bold text-gray-700 mb-1",children:"Programa / Secci\xf3n *"}),(0,r.jsxs)("select",{name:"programa",value:Q.programa,onChange:ea,className:"w-full border border-gray-300 rounded-md p-3 bg-white",children:[(0,r.jsx)("option",{value:"Redacci\xf3n Central",children:"Redacci\xf3n Central"}),(0,r.jsx)("option",{value:"Educaci\xf3n",children:"Educaci\xf3n"}),(0,r.jsx)("option",{value:"Empresariales",children:"Empresariales"}),(0,r.jsx)("option",{value:"Agenda Abierta",children:"Agenda Abierta"}),(0,r.jsx)("option",{value:"Agronegocios Sarand\xed",children:"Agronegocios Sarand\xed"}),(0,r.jsx)("option",{value:"Agronegocios Sarand\xed (L.M.)",children:"Agronegocios Sarand\xed (L.M.)"}),(0,r.jsx)("option",{value:"Al Pan Pan",children:"Al Pan Pan"}),(0,r.jsx)("option",{value:"Al Pan Pan (L.M.)",children:"Al Pan Pan (L.M.)"}),(0,r.jsx)("option",{value:"Ciencia Cierta",children:"Ciencia Cierta"}),(0,r.jsx)("option",{value:"100% Deporte",children:"100% Deporte"}),(0,r.jsx)("option",{value:"Diario Sarand\xed",children:"Diario Sarand\xed"}),(0,r.jsx)("option",{value:"Din\xe1mica Rural",children:"Din\xe1mica Rural"}),(0,r.jsx)("option",{value:"Enigmas",children:"Enigmas"}),(0,r.jsx)("option",{value:"En la Mira",children:"En la Mira"}),(0,r.jsx)("option",{value:"Entretiempos",children:"Entretiempos"}),(0,r.jsx)("option",{value:"Es Noticia",children:"Es Noticia"}),(0,r.jsx)("option",{value:"Haciendo Historia",children:"Haciendo Historia"}),(0,r.jsx)("option",{value:"Hora de Cierre",children:"Hora de Cierre"}),(0,r.jsx)("option",{value:"Informativo Sarand\xed",children:"Informativo Sarand\xed"}),(0,r.jsx)("option",{value:"Las Cosas en su Sitio",children:"Las Cosas en su Sitio"}),(0,r.jsx)("option",{value:"Palabras Cruzadas",children:"Palabras Cruzadas"}),(0,r.jsx)("option",{value:"Ra\xedces",children:"Ra\xedces"}),(0,r.jsx)("option",{value:"S\xe1bado Sarand\xed",children:"S\xe1bado Sarand\xed"}),(0,r.jsx)("option",{value:"Sin Filtro",children:"Sin Filtro"}),(0,r.jsx)("option",{value:"Spazio Italia",children:"Spazio Italia"}),(0,r.jsx)("option",{value:"Transformaciones",children:"Transformaciones"}),(0,r.jsx)("option",{value:"Transformaciones (S. y D.)",children:"Transformaciones (S. y D.)"}),(0,r.jsx)("option",{value:"Viva la Tarde",children:"Viva la Tarde"}),(0,r.jsx)("option",{value:"Viva la Tarde (L.M.)",children:"Viva la Tarde (L.M.)"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-bold text-gray-700 mb-1",children:"Prioridad (Portada) *"}),(0,r.jsxs)("select",{name:"prioridad",value:Q.prioridad,onChange:ea,className:"w-full border border-gray-300 rounded-md p-3 bg-white font-semibold",children:[(0,r.jsx)("option",{value:"1",children:"⭐ ALTA (Fijar)"}),(0,r.jsx)("option",{value:"2",children:"\uD83D\uDCCC MEDIA (Normal)"}),(0,r.jsx)("option",{value:"3",children:"\uD83D\uDCC9 BAJA (Secundaria)"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-bold text-gray-700 mb-1",children:"Fecha y Hora Programada (Opcional)"}),(0,r.jsx)("input",{type:"datetime-local",name:"fechaProgramada",value:Q.fechaProgramada||"",onChange:ea,className:"w-full border border-gray-300 rounded-md p-3 bg-white"}),(0,r.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Si seleccion\xe1s una fecha futura, la noticia permanecer\xe1 oculta hasta entonces."})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-bold text-gray-700 mb-1",children:"Foto"}),(0,r.jsx)("input",{id:"file-upload",type:"file",accept:"image/*",onChange:e=>{e.target.files&&e.target.files[0]&&(U(e.target.files[0]),X({...Q,youtubeUrl:""}))},disabled:Q.youtubeUrl.length>0,className:"w-full text-sm text-gray-500 file:mr-2 file:py-3 file:px-2 file:rounded-md file:border-0 file:text-xs file:font-semibold file:bg-gray-100 file:text-gray-700 hover:file:bg-gray-200 cursor-pointer border border-gray-300 rounded-md bg-white disabled:opacity-50"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-bold text-gray-700 mb-1",children:"O YouTube"}),(0,r.jsx)("input",{type:"url",name:"youtubeUrl",value:Q.youtubeUrl,onChange:ea,disabled:null!==D,className:"w-full border border-gray-300 rounded-md p-3 disabled:bg-gray-100 text-sm",placeholder:"Link video"})]})]}),(0,r.jsxs)("div",{className:"space-y-4 border-t pt-4 mt-2",children:[(0,r.jsx)("h3",{className:"font-bold text-gray-800",children:"Contenido de la Noticia"}),P.map((e,a)=>(0,r.jsxs)("div",{className:"bg-gray-50 border border-gray-200 p-4 rounded-lg relative",children:[(0,r.jsxs)("div",{className:"absolute top-2 right-2 text-gray-400 font-bold text-sm",children:["Bloque ",a+1]}),P.length>1&&(0,r.jsx)("button",{type:"button",onClick:()=>L(P.filter((e,t)=>
3t!==a)),className:"absolute bottom-2 right-2 text-red-500 text-sm font-bold hover:underline",children:"Quitar Bloque"}),(0,r.jsx)("label",{className:"block text-sm font-bold text-gray-700 mb-1 mt-4",children:"Texto del Bloque"}),(0,r.jsx)("textarea",{rows:4,value:e.texto,onChange:e=>{let t=[...P];t[a].texto=e.target.value,L(t)},className:"w-full border border-gray-300 rounded-md p-3 mb-4"}),(0,r.jsx)("label",{className:"block text-sm font-bold text-gray-700 mb-1",children:"Subir Audio .mp3 para este bloque"}),e.audioUrl&&(0,r.jsx)("p",{className:"text-xs text-blue-600 font-bold mb-2",children:"✅ Ya tiene audio cargado. Si subes uno nuevo, se reemplazar\xe1."}),(0,r.jsx)("input",{type:"file",accept:"audio/*",onChange:e=>{if(e.target.files&&e.target.files[0]){let t=[...P];t[a].archivoAudio=e.target.files[0],L(t)}},className:"w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-gray-200 file:text-gray-700 hover:file:bg-gray-300 cursor-pointer border border-gray-300 rounded-md bg-white"})]},a)),(0,r.jsx)("button",{type:"button",onClick:()=>L([...P,{texto:"",archivoAudio:null,audioUrl:""}]),className:"w-full py-4 border-2 border-dashed border-gray-300 rounded-md text-gray-600 font-bold hover:bg-gray-100 transition-colors",children:"+ AGREGAR OTRO BLOQUE DE TEXTO/AUDIO"})]}),(0,r.jsxs)("div",{className:"pt-4",children:[C&&S&&(0,r.jsxs)("div",{className:"mb-4 p-4 border border-blue-200 bg-blue-50 text-blue-800 rounded-md font-bold text-center animate-pulse flex items-center justify-center gap-3 shadow-sm",children:[(0,r.jsxs)("svg",{className:"animate-spin h-5 w-5 text-blue-600",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),(0,r.jsx)("span",{children:S})]}),(0,r.jsx)("button",{type:"submit",disabled:C,className:`w-full text-white font-bold py-4 rounded-md shadow-md ${C?"opacity-70":"hover:opacity-90"} transition-all`,style:{backgroundColor:d.A.theme.primaryBg},children:C?"Procesando...":T?"GUARDAR CAMBIOS":"PUBLICAR"})]})]})]}),("admin"===j||"publicidad"===j)&&"publicidad"===q&&(0,r.jsxs)("div",{className:"animate-fade-in",children:[(0,r.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center justify-between mb-6 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-xl font-bold text-gray-900 dark:text-gray-100",children:"Configuraci\xf3n de Google AdSense / Program\xe1tica"}),(0,r.jsx)("p",{className:"text-sm text-gray-500",children:"Ingresa los c\xf3digos de tu cuenta. Si dejas el Client ID vac\xedo, la publicidad se desactivar\xe1 autom\xe1ticamente."})]}),(0,r.jsxs)("div",{className:"bg-gray-100 p-3 rounded-lg border border-gray-200",children:[(0,r.jsx)("label",{className:"block text-xs font-bold text-gray-600 mb-1 uppercase tracking-wider",children:"Configurando para:"}),(0,r.jsxs)("select",{value:B,onChange:e=>G(e.target.value),className:"w-full bg-white border border-gray-300 font-bold text-[#f57c00] rounded-md p-2 focus:outline-none focus:ring-2 focus:ring-[#f57c00]",children:[(0,r.jsx)("option",{value:"sarandi",children:"\uD83D\uDCFB Sarand\xed 690"}),(0,r.jsx)("option",{value:"like",children:"\uD83C\uDFB5 Like 95.1"}),(0,r.jsx)("option",{value:"futura",children:"\uD83D\uDD2E Futura 91.1"}),(0,r.jsx)("option",{value:"890",children:"⚽ Sport 890"}),(0,r.jsx)("option",{value:"delplata",children:"\uD83D\uDCFB Del Plata"})]})]})]}),K.texto&&(0,r.jsx)("div",{className:`p-4 mb-6 rounded-md font-bold ${"exito"===K.tipo?"bg-green-100 text-green-700":"bg-red-100 text-red-700"}`,children:K.texto}),(0,r.jsxs)("form",{onSubmit:Z,className:"space-y-6",children:[(0,r.jsxs)("div",{className:"bg-yellow-50 border border-yellow-200 p-4 rounded-lg flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-bold text-yellow-900",children:"Estado Global de Publicidad"}),(0,r.jsx)("p",{className:"text-xs text-yellow-700 mt-1",children:"Si apagas esto, ninguna publicidad se mostrar\xe1, aunque tengas los c\xf3digos cargados."})]}),(0,r.jsxs)("label",{className:"relative inline-flex items-center cursor-pointer",children:[(0,r.jsx)("input",{type:"checkbox",className:"sr-only peer",checked:H.activo,onChange:e=>z({...H,activo:e.target.checked})}),(0,r.jsx)("div",{className:"w-11 h-6 bg-gray-300 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-yellow-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-yellow-500"})]})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-bold text-gray-700 mb-1",children:"Client ID (AdSense) *"}),(0,r.jsx)("p",{className:"text-xs text-gray-500 mb-2",children:"Ejemplo: ca-pub-1234567890123456"}),(0,r.jsx)("input",{type:"text",value:H.clientId,onChange:e=>z({...H,clientId:e.target.value}),placeholder:"ca-pub-...",className:"w-full border border-gray-300 rounded-md p-3 font-mono"})]})}),(0,r.jsx)("div",{className:"space-y-8 border-t border-gray-100 pt-6",children:(0,r.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-5 shadow-sm",children:[(0,r.jsx)("h4",{className:"font-bold text-gray-800 mb
3-4 text-lg",children:"C\xf3digo Global de Adeqmedia"}),(0,r.jsx)("p",{className:"text-xs text-gray-500 mb-4",children:"Pega aqu\xed el c\xf3digo que te brind\xf3 Adeqmedia. Este se inyectar\xe1 en todos los recuadros disponibles del sitio si no hay un banner propio activo para ese recuadro."}),(0,r.jsx)("textarea",{value:H.adeqmediaCodeGlobal,onChange:e=>z({...H,adeqmediaCodeGlobal:e.target.value}),placeholder:"<div id='adeq...'></div><script>...<\/script>",className:"w-full border border-gray-300 rounded-md p-3 font-mono text-sm h-32"})]})}),(0,r.jsx)("div",{className:"pt-6",children:(0,r.jsx)("button",{type:"submit",disabled:V,className:`w-full text-white font-bold py-4 rounded-md shadow-md ${V?"opacity-70":"hover:opacity-90"}`,style:{backgroundColor:d.A.theme.primaryBg},children:V?"Guardando...":"GUARDAR CONFIGURACI\xd3N DE PUBLICIDAD"})})]})]})]}),("admin"===j||"redaccion"===j)&&"noticias"===q&&(0,r.jsxs)("div",{className:"bg-white p-8 rounded-xl shadow-md border border-gray-200",children:[(0,r.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center justify-between mb-6 gap-4",children:[(0,r.jsx)("h2",{className:"text-2xl font-extrabold text-gray-900 dark:text-gray-100",children:"\xdaltimas Publicaciones"}),(0,r.jsx)("input",{type:"text",placeholder:"Buscar noticia por t\xedtulo o autor...",value:F,onChange:e=>M(e.target.value),className:"border border-gray-300 rounded-md p-2 w-full md:w-1/3"})]}),(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)("table",{className:"w-full text-left border-collapse",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{className:"bg-gray-100 text-gray-700 text-sm",children:[(0,r.jsx)("th",{className:"p-3 font-bold rounded-tl-md",children:"Fecha"}),(0,r.jsx)("th",{className:"p-3 font-bold",children:"T\xedtulo"}),(0,r.jsx)("th",{className:"p-3 font-bold",children:"Autor"}),(0,r.jsx)("th",{className:"p-3 font-bold",children:"Tipo"}),(0,r.jsx)("th",{className:"p-3 font-bold text-right rounded-tr-md",children:"Acciones"})]})}),(0,r.jsx)("tbody",{children:$.filter(e=>e.titulo?.toLowerCase().includes(F.toLowerCase())||e.autorEmail?.toLowerCase().includes(F.toLowerCase())).map(e=>(0,r.jsxs)("tr",{className:"border-b border-gray-100 hover:bg-gray-50 transition-colors",children:[(0,r.jsx)("td",{className:"p-3 text-sm text-gray-500 whitespace-nowrap",children:e.fecha}),(0,r.jsx)("td",{className:"p-3 font-medium text-gray-900 dark:text-gray-100",children:e.titulo}),(0,r.jsx)("td",{className:"p-3 text-sm text-gray-600",children:e.autorEmail||"-"}),(0,r.jsx)("td",{className:"p-3",children:e.esColumna?(0,r.jsx)("span",{className:"px-2 py-1 rounded text-xs font-bold bg-indigo-100 text-indigo-700",children:"COLUMNA"}):(0,r.jsx)("span",{className:"px-2 py-1 rounded text-xs font-bold bg-gray-100 text-gray-600",children:"NOTICIA"})}),(0,r.jsxs)("td",{className:"p-3 text-right whitespace-nowrap",children:[(0,r.jsx)("button",{onClick:()=>{X({titulo:e.titulo,subtitulo:e.subtitulo,programa:e.programa,prioridad:e.prioridad||"2",esColumna:e.esColumna||!1,imagenUrl:e.imagenUrl,youtubeUrl:e.youtubeUrl||"",timestamp:e.timestamp}),e.bloques&&Array.isArray(e.bloques)&&e.bloques.length>0?L(e.bloques.map(e=>({texto:e.texto||"",audioUrl:e.audioUrl||"",archivoAudio:null}))):L([{texto:e.cuerpo||"",audioUrl:e.audioUrl||"",archivoAudio:null}]),_(e.id),window.scrollTo({top:0,behavior:"smooth"})},className:"text-blue-600 hover:text-blue-800 font-bold text-sm mr-4",children:"Editar"}),(0,r.jsx)("button",{onClick:()=>er(e.id),className:"text-red-600 hover:text-red-800 font-bold text-sm",children:"Borrar"})]})]},e.id))})]})})]})]})}):(0,r.jsx)("div",{className:"min-h-screen bg-gray-100 flex flex-col justify-center items-center font-sans px-4",children:(0,r.jsxs)("div",{className:"bg-white p-10 rounded-2xl shadow-xl border border-gray-200 max-w-md w-full text-center",children:[(0,r.jsx)("div",{className:"w-20 h-20 bg-gray-50 rounded-full flex items-center justify-center mx-auto mb-6 border border-gray-100",children:(0,r.jsx)("svg",{className:"w-10 h-10 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})})}),(0,r.jsx)("h1",{className:"text-2xl font-extrabold text-gray-900 dark:text-gray-100 mb-2",children:"Acceso Restringido"}),(0,r.jsxs)("p",{className:"text-gray-500 mb-8 text-sm",children:["Ingres\xe1 tu correo y contrase\xf1a para acceder al panel de redacci\xf3n de ",d.A.station.name,"."]}),(0,r.jsxs)("form",{onSubmit:N,className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("input",{type:"email",value:t,onChange:e=>c(e.target.value),placeholder:"Correo electr\xf3nico...",className:"w-full border-2 border-gray-200 rounded-lg p-4 text-center focus:outline-none transition-colors mb-4",style:{outlineColor:d.A.theme.primaryBg,borderColor:t?d.A.theme.primaryBg:void 0},autoFocus:!0,required:!0}),(0,r.jsx)("input",{type:"password",value:u,onChange:e=>x(e.target.value),placeholder:"Contrase\xf1a...",className:"w-full border-2 border-gray-200 rounded-lg p-4 text-center focus:outline-none transition-colors",style:{outlineColor:d.A.theme.primaryBg,borderColor:u?d.A.theme.primaryBg:void 0},required:!0})]}),b&&(0,r.jsx)("p",{className:"text-red-500 text-sm font-bold animate-pulse",children:b}),(0,r.jsx)("button",{type:"submit",className:"w-full text-white font-bold py-4 rounded-lg shadow-md hover:shadow-lg transition-all",style:{backgroundColor:d.A.theme.primaryBg},children:"ENTRAR AL PANEL"})]})]})})}}},e=>{e.O(0,[858,187,526,772,441,838,358],()=>e(e.s=5103)),_N_E=e.O()}]);

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.