1import{d as ze,b as Fe,h as Be,x as Je,o as c,c as d,t as w,D as y,F as re,i as a,e as t,y as Le,k as De,j as ce,l as We,n as J,R as Ze,m as E,z as h,M as qe,$ as Ye,aN as Xe,bF as Qe,w as Ue,G as et,H as tt,u as at,a as Q,aP as lt,J as K,bg as nt,bh as st,be as ot,Y as it,bf as rt,bi as ct,B as ut}from"./D7P3cwJT.js";import{r as dt}from"./BwCY_19y.js";import{_ as ft}from"./BphP9C6K.js";import{_ as pt}from"./CJc5_MTU.js";import{a as mt,b as gt}from"./CprriFlA.js";import{u as vt}from"./B-pzUgj4.js";import{n as ht}from"./BU_lXJuU.js";import{u as xt}from"./D8K2K9Sw.js";import"./Bfd5Thr0.js";import"./C_YC4gad.js";var bt=dt.isFinite;function _t(p){return typeof p=="number"&&bt(p)}function Oe(p){let k=p.trim();return k=k.replace(/^```(?:html)?\s*\n?/i,""),k=k.replace(/\n?```\s*$/i,""),k.trim()}const wt={class:"flex flex-col gap-6 rounded-[24px] bg-white p-6 shadow-lg"},yt={key:0,class:"flex flex-col gap-4"},kt={key:0,class:"font-national2Narrow text-lg leading-[1.5] tracking-[-0.18px] text-black"},Ct={class:"flex flex-col gap-4"},$t={class:"font-national2Condensed text-[24px] font-medium leading-[0.9] text-black"},Tt={class:"flex flex-wrap gap-3"},St={class:"whitespace-pre font-national2 text-lg font-medium leading-[1.5] tracking-[-0.18px] text-black transition-colors group-hover:text-white"},It={key:1,class:"h-px w-full bg-black/10"},Lt={class:"flex items-center gap-2 text-black/70"},Et={class:"font-national2 text-base tracking-[-0.16px]"},At={class:"flex flex-col gap-3"},Rt={class:"font-national2Condensed text-sm font-medium uppercase tracking-wide text-black/50"},Ht={class:"flex flex-wrap gap-2"},Nt=["onClick"],Mt={key:0,class:"flex items-center gap-2 text-sm text-black/50"},Pt={key:1,class:"text-sm text-red-600"},Vt={key:0,class:"flex gap-2 rounded-xl bg-amber-50 p-3 text-sm leading-snug text-amber-800"},Ut={class:"flex flex-col gap-3"},Ot={class:"font-national2Condensed text-sm font-medium uppercase tracking-wide text-black/50"},jt=["src"],zt={class:"flex items-center gap-3"},Ft=["disabled"],Bt={key:0,class:"loading loading-spinner loading-sm"},Dt={key:1,class:"h-5 w-5",fill:"currentColor",viewBox:"0 0 24 24"},Wt={key:2,class:"ml-0.5 h-5 w-5",fill:"currentColor",viewBox:"0 0 24 24"},Zt={class:"flex min-w-0 flex-1 flex-col gap-1"},Gt=["max","value","disabled"],Kt={class:"flex justify-between text-xs text-black/40"},Jt=["disabled"],qt={key:1,class:"text-sm text-red-600"},Yt=ze({__name:"ArticleToolsCard",props:{contentHtml:{},locale:{},formattedDate:{},relatedTopics:{},aiFeaturesEnabled:{type:Boolean,default:!0}},emits:["content-changed","streaming","style-changed"],setup(p,{emit:k}){const C=p,M=k;function P(r){M("style-changed",r)}const{t:O}=Fe(),he=Be();function ue(r){return r.replace(/<[^>]*>/g," ").replace(/&\w+;/g," ").replace(/\s+/g," ").trim()}const de=E(()=>{const r=ue(C.contentHtml).split(/\s+/).filter(Boolean);return Math.max(1,Math.round(r.length/200))}),T=h("original"),n=h(!1),A=h(null),U=h({});let z=null,B=0;async function xe(r){if(r===T.value)return;if(A.value=null,z&&(z.abort(),z=null),r==="original"){n.value=!1,M("streaming",!1),T.value="original",P("original"),M("content-changed",null),te();return}const u=`${r}_${C.locale}`;if(U.value[u]){T.value=r,P(r),M("content-changed",U.value[u]),te();return}const H=++B;n.value=!0,M("streaming",!0),T.value=r,P(r),M("content-changed",""),z=new AbortController;try{const b=await fetch("/api/v1/news/rewrite/stream",{method:"POST",signal:z.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify({contentHtml:C.contentHtml,style:r,locale:C.locale})});if(!b.ok){const _=await b.json().catch(()=>({}));throw new Error(_?.message||`HTTP ${b.status}`)}const X=b.body?.getReader();if(!X)throw new Error("No stream");const Ce=new TextDecoder;let e="",l=0;const s=60;for(;;){const{done:_,value:S}=await X.read();if(_)break;e+=Ce.decode(S,{stream:!0});const $=Date.now();$-l>=s&&(M("content-changed",Oe(e)),l=$)}if(H!==B)return;const f=Oe(e.trim());U.value[u]=f,M("content-changed",f),te()}catch(b){if(b?.name==="AbortError"||H!==B)return;A.value=b?.message||b?.data?.message||"Error al reescribir",T.value="original",P("original"),M("content-changed",null)}finally{H===B&&(n.value=!1,M("streaming",!1),z=null)}}const be=E(()=>T.value!=="original"),_e=[{key:"original",label:"Original"},{key:"summary",label:"Resumen"},{key:"simple",label:"Lectura Fácil"}],m=h(null),I=h(null),R=h(!1),x=h(!1),D=h(0),F=h(0),q=h(null),W=h(1),ee=[.75,1,1.25,1.5];let Z="";function we(){const r=T.value,u=`${r}_${C.locale}`,H=r==="original"?C.contentHtml:U.value[u]||C.contentHtml;return ue(H)}function te(){const r=`${T.value}_${C.locale}`;Z&&Z!==r&&(ye(),I.value?.startsWith("blob:")&&URL.revokeObjectURL(I.value),I.value=null,D.value=0,F.value=0,Z="")}async function fe(){q.value=null;const r=`${T.value}_${C.locale}`;if(I.value&&Z===r){pe();return}R.value=!0;try{const u=we(),{streamUrl:H}=await $fetch("/api/v1/news/tts",{method:"POST",body:{text:u,voice:"nova"}});I.value?.startsWith("blob:")&&URL.revokeObjectURL(I.value),I.value=H,Z=r,await qe(),m.value&&(m.value.src=H,m.value.playbackRate=W.value,await m.value.play(),x.value=!0)}catch(u){q.value=u?.data?.message||u?.message||"Error al generar audio"}finally{R.value=!1}}function pe(){m.value&&(m.value.paused?(m.value.play(),x.value=!0):(m.value.pause(),x.value=!1))}function ye(){m.value&&(m.value.pause(),m.value.currentTime=0,x.value=!1)}function Y(){m.value&&(F.value=m.value.currentTime)}function ae(){m.value&&(D.value=m.value.duration)}function me(){x.value=!1,F.value=0}function le(r){const u=r.target;m.value&&(m.value.currentTime=parseFloat(u.value),F.value=m.value.currentTime)}function ke(){const r=ee.indexOf(W.value);W.value=ee[(r+1)%ee.length],m.value&&(m.value.playbackRate=W.value)}function ne(r){if(!_t(r)||r<0)return"0:00";const u=Math.floor(r/60),H=Math.floor(r%60);return`${u}:${H.toString().padStart(2,"0")}`}return Je(()=>{I.value?.startsWith("blob:")&&URL.revokeObjectURL(I.value)}),(r,u)=>{const H=We;return c(),d("div",wt,[p.formattedDate||p.relatedTopics&&p.relatedTopics.length>0?(c(),d("div",yt,[p.formattedDate?(c(),d("p",kt,w(p.formattedDate),1)):y("",!0),p.relatedTopics&&p.relatedTopics.length>0?(c(),d(re,{key:1},[u[0]||(u[0]=a("div",{class:"h-px w-full bg-black/20"},null,-1)),a("div",Ct,[a("p",$t,w(t(O)("noticias_related_topics","Temas relacionados")),1),a("div",Tt,[(c(!0),d(re,null,Le(p.relatedTopics,b=>(c(),De(H,{key:b.id,to:t(he)(`/noticias?categories=${b.id}`),class:"group rounded-[48px] border-2 border-black bg-white px-4 py-2 transition-all hover:bg-black hover:text-white"},{default:ce(()=>[a("p",St,w(b.name),1)]),_:2},1032,["to"]))),128))])])],64)):y("",!0)])):y("",!0),p.formattedDate||p.relatedTopics&&p.relatedTopics.length>0?(c(),d("div",It)):y("",!0),a("div",Lt,[u[1]||(u[1]=a("svg",{class:"h-5 w-5 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"1.5"},[a("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})],-1)),a("span",Et,w(t(de))+" min "+w(t(O)("article_tools_read","de lectura")),1
1)]),p.aiFeaturesEnabled?(c(),d(re,{key:2},[u[6]||(u[6]=a("div",{class:"h-px w-full bg-black/10"},null,-1)),a("div",At,[a("p",Rt,w(t(O)("article_tools_style_label","Estilo de lectura")),1),a("div",Ht,[(c(),d(re,null,Le(_e,b=>a("button",{key:b.key,class:J(["rounded-full border-2 px-4 py-1.5 font-national2 text-sm font-medium tracking-[-0.14px] transition-all",t(T)===b.key?"border-black bg-black text-white":"border-black/20 bg-white text-black hover:border-black/50"]),onClick:X=>xe(b.key)},w(b.label),11,Nt)),64))]),t(n)?(c(),d("div",Mt,[u[2]||(u[2]=a("span",{class:"loading loading-spinner loading-xs"},null,-1)),Ze(" "+w(t(O)("article_tools_rewriting","Adaptando contenido...")),1)])):y("",!0),t(A)?(c(),d("p",Pt,w(t(A)),1)):y("",!0)]),t(be)?(c(),d("div",Vt,[u[3]||(u[3]=a("svg",{class:"mt-0.5 h-4 w-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[a("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 0 0-2.455 2.456Z"})],-1)),a("span",null,w(t(O)("article_tools_ai_disclaimer","Contenido adaptado con inteligencia artificial. El artÃculo original fue redactado por Para la Naturaleza.")),1)])):y("",!0),u[7]||(u[7]=a("div",{class:"h-px w-full bg-black/10"},null,-1)),a("div",Ut,[a("p",Ot,w(t(O)("article_tools_listen_label","Escuchar artÃculo")),1),t(I)?(c(),d("audio",{key:0,ref_key:"audioElement",ref:m,src:t(I),preload:"metadata",onTimeupdate:Y,onLoadedmetadata:ae,onEnded:me},null,40,jt)):y("",!0),a("div",zt,[a("button",{disabled:t(R),class:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-black text-white transition-colors hover:bg-black/80 disabled:opacity-50",onClick:fe},[t(R)?(c(),d("span",Bt)):t(x)?(c(),d("svg",Dt,[...u[4]||(u[4]=[a("path",{d:"M6 4h4v16H6V4Zm8 0h4v16h-4V4Z"},null,-1)])])):(c(),d("svg",Wt,[...u[5]||(u[5]=[a("path",{d:"M8 5v14l11-7z"},null,-1)])]))],8,Ft),a("div",Zt,[a("input",{type:"range",min:"0",max:t(D)||0,value:t(F),step:"0.1",disabled:!t(I),class:"h-1.5 w-full cursor-pointer appearance-none rounded-full bg-black/10 accent-black disabled:cursor-default disabled:opacity-40",onInput:le},null,40,Gt),a("div",Kt,[a("span",null,w(ne(t(F))),1),a("span",null,w(t(D)?ne(t(D)):`~${t(de)} min`),1)])]),a("button",{disabled:!t(I),class:"shrink-0 rounded-md border border-black/15 px-2 py-1 font-national2 text-xs font-medium text-black/60 transition-colors hover:border-black/30 hover:text-black disabled:opacity-40",onClick:ke},w(t(W))+"x ",9,Jt)]),t(q)?(c(),d("p",qt,w(t(q)),1)):y("",!0)])],64)):y("",!0)])}}});function Xt(p){const k=p.match(/<a\s+[^>]*href=["']([^"']+)["']/i);if(!k)return!1;const C=k[1].trim();return!!(C&&C!=="#"&&!C.toLowerCase().startsWith("javascript:"))}
1function Qt(p){if(p.length<=1)return[];const k=p.filter(C=>!Xt(C.originalHtml||""));return k.length>1?k:[]}const ea={key:0,class:"flex min-h-screen w-full items-center justify-center bg-black p-content"},ta={key:1,class:"flex min-h-screen w-full items-center justify-center bg-black"},aa={key:2,class:"min-h-screen w-full bg-[#f1f1f1]"},la={class:"relative flex flex-col"},na={key:0,class:"absolute inset-0"},sa=["src","alt"],oa={key:1,class:"pointer-events-none absolute inset-x-0 bottom-0 h-[45%] rounded-b-[32px]",style:{background:`linear-gradient( 2 to top, 3 rgba(0, 0, 0, 0.85) 0%, 4 rgba(0, 0, 0, 0.5) 50%, 5 rgba(0, 0, 0, 0) 100% 6 )`}},ia={key:0,class:"min-h-[150px] flex-1 tablet:min-h-[200px] desktop:min-h-[296px]"},ra={class:"flex flex-col gap-6 overflow-hidden py-0 laptop:flex-row laptop:gap-12 laptop:overflow-visible"},ca={class:"order-1 w-full shrink-0 laptop:order-2 laptop:w-[364px]"},ua={class:"flex flex-col gap-4 laptop:sticky laptop:top-24"},da={class:"order-2 min-w-[348px] flex-1 laptop:order-1"},fa={class:"flex flex-col gap-6 laptop:gap-12"},pa={key:0,class:"prose w-full min-w-[312px] max-w-none"},ma=["innerHTML"],ga={key:0,class:"mt-4 flex items-center","aria-hidden":"true"},va={key:1,class:"mt-8 w-full"},ha={class:"relative aspect-[4/3] w-full overflow-hidden rounded-[24px] bg-black/20"},xa=["src","alt"],ba={key:1,class:"relative w-full",style:{"padding-bottom":"56.25%"}},_a=["src"],wa=["src"],ya={class:"font-national2 text-lg font-medium leading-[1.5] tracking-[-0.18px] text-black transition-colors group-hover:text-white"},ka={key:3,class:"flex min-h-screen w-full items-center justify-center bg-black"},Ca={class:"flex flex-col items-center gap-4"},$a={class:"font-sans text-xl text-white"},je=!1,Ta="/images/centros-visitantes-card.png",Sa=ze({__name:"[slug]",async setup(p){let k,C;const M=Ye(),{t:P}=Fe(),O=E(()=>M.value.getLanguage()||"es"),he=Xe();Be();const{preferOfflineCatalog:ue}=Qe(),de=vt("slug"),T=E(()=>{const e=de.value,l=Array.isArray(e)?e[0]||"":e||"";return st(l)}),n=h(null),A=h("pending"),U=h(null);async function z(){if(!T.value){n.value=null,A.value="error",U.value={statusCode:400};return}if(ue.value){n.value=null,A.value="success";return}n.value=null,A.value="pending",U.value=null;try{const e=await $fetch(`/api/v1/news/${encodeURIComponent(T.value)}`).catch(()=>null);if(e?.item){n.value=ht(e.item),A.value="success";return}const l=await ot(T.value,{_embed:"author,wp:featuredmedia"});if(!l){A.value="error",U.value={statusCode:404};return}if(l.type==="page"){await it(rt({slug:T.value,link:l.data.link}),{external:!0,replace:!0});return}n.value=l.data,A.value="success"}catch(e){A.value="error",U.value=e}}Ue(T,()=>{z()},{immediate:!0});const{data:B}=([k,C]=et(()=>tt({per_page:100,hide_empty:!1})),k=await k,C(),k),xe=E(()=>!n.value||!B.value?[]:B.value.categories.filter(e=>n.value?.categories?.includes(e.id))),be=["uncategorized","sin-categoria","sin-categorÃa","sin_categoria"],_e=["uncategorized","sin categorÃa","sin categoria"];function m(e){const l=e.slug?.toLowerCase().trim()||"",s=e.name?.toLowerCase().trim()||"";return be.includes(l)||_e.includes(s)}const I=E(()=>xe.value.filter(e=>!m(e))),R=h(null),x=h(!1),D=e=>new Promise(l=>{if(typeof window>"u"){l(!0);return}try{const s=new Image;s.onload=()=>l(!0),s.onerror=()=>l(!1),s.src=e}catch{l(!1)}});Ue(n,async e=>{if(!e?._embedded?.["wp:featuredmedia"]?.[0]?.source_url){R.value=null,x.value=!1;return}const l=e._embedded["wp:featuredmedia"][0].source_url.trim();if(!l){R.value=null,x.value=!1;return}R.value=l,x.value=!1;const s=await D(l);R.value===l&&(x.value=s)},{immediate:!0});const F=E(()=>x.value&&R.value?R.value:Ta),q=E(()=>{const e=n.value?._embedded?.["wp:featuredmedia"]?.[0]?.alt_text,l=n.value?._supabase?.source==="supabase";return e!=null&&(e!==""||l)?e:n.value?K(n.value.title.rendered):""}),W=E(()=>n.value?{id:String(n.value.id),slug:n.value.slug,source:n.value._supabase?.source==="supabase"?"supabase":"wordpress",title:K(n.value.title?.rendered||""),excerpt:K(n.value.excerpt?.rendered||""),contentHtml:String(n.value.content?.rendered||""),publishedAt:n.value.date||n.value.modified||new Date().toISOString(),imageUrl:R.value,authorName:n.value._embedded?.author?.[0]?.name||"Para la Naturaleza",categories:[]}:null);xt({item:W,locale:O}),at({title:()=>n.value?`${K(n.value.title.rendered)}
6 - Para la Naturaleza`:"Noticia - Para la Naturaleza",description:()=>n.value?K(n.value.excerpt?.rendered||n.value.content.rendered).substring(0,160):"",ogTitle:()=>n.value?`${K(n.value.title.rendered)} - Para la Naturaleza`:"Noticia - Para la Naturaleza",ogImage:()=>F.value});function ee(e){return new Date(e).toLocaleDateString("es-ES",{year:"numeric",month:"long",day:"numeric"})}function Z(e){const l=e.split(" "),s=[];let f="";for(const _ of l)(f+_).length>50&&f?(s.push(f.trim()),f=_+" "):f+=_+" ";return f.trim()&&s.push(f.trim()),s.length>0?s:[e]}function we(e){const l=[/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/,/youtube\.com\/v\/([a-zA-Z0-9_-]{11})/];for(const s of l){const f=e.match(s);if(f)return f[1]}return null}function te(e){const l=e.match(/vimeo\.com\/(?:video\/)?(\d+)/);return l?l[1]:null}function fe(e,l){let s=e;const f=new Set(l.map(S=>S.originalHtml));return Array.from(f).sort((S,$)=>{const v=e.indexOf(S);return e.indexOf($)-v}).forEach(S=>{const $=S.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s*"),v=new RegExp($,"gis");s=s.replace(v,"")}),s=s.replace(/<p>\s*<\/p>/gi,""),s=s.replace(/<p><\/p>/gi,""),s=s.replace(/<p[^>]*>\s*<\/p>/gi,""),s=s.replace(/<div[^>]*>\s*<\/div>/gi,""),s=s.replace(/<figure[^>]*>\s*<\/figure>/gi,""),s}function pe(e,l){if(!e)return{processedContent:"",visuals:[]};const s=[];let f=e;const _=[],S=/<img[^>]+src=["']([^"']+)["'][^>]*>/gi;let $;const v=[];for(S.lastIndex=0;($=S.exec(e))!==null;)v.push({tag:$[0],src:$[1],position:$.index});v.forEach(({tag:o,src:i,position:L})=>{const j=e.substring(0,L),$e=/<div[^>]*class=["'][^"']*elementor-widget-image[^"']*["'][^>]*>/gi;$e.lastIndex=0;let Ne,Te=-1;for(;(Ne=$e.exec(j))!==null;)Te=Ne.index;if(Te!==-1){const oe=Te,Me=e.substring(oe);let Se=0,Ie=-1,G=0;for(;G<Me.length;){const ie=Me.substring(G);if(ie.match(/^<div[^>]*>/)){Se++;const Ve=ie.indexOf(">");Ve!==-1?G+=Ve+1:G++}else if(ie.startsWith("</div>")){if(Se--,Se===0){Ie=oe+G+6;break}G+=6}else G++}const Ke=Ie!==-1?e.substring(oe,Ie):e.substring(oe,Math.min(oe+5e3,e.length)),Pe=o.match(/alt=["']([^"']*)["']/i);_.some(ie=>ie.src===i)||_.push({match:o,container:Ke,src:i,alt:Pe?Pe[1]:""})}});const V=/<img[^>]+src=["']([^"']+)["'][^>]*>/gi;V.lastIndex=0;let g;for(;(g=V.exec(e))!==null;){const o=g[0],i=g[1];if(!_.some(j=>j.src===i)){const j=o.match(/alt=["']([^"']*)["']/i);_.push({match:o,container:o,src:i,alt:j?j[1]:""})}}const N=[],Ee=/<video[^>]*>[\s\S]*?<source[^>]+src=["']([^"']+)["'][^>]*>[\s\S]*?<\/video>/gi;for(Ee.lastIndex=0,g=null;(g=Ee.exec(e))!==null;){const o=g[0],i=g[1];i&&N.push({match:o,src:i})}const Ae=/<video[^>]+src=["']([^"']+)["'][^>]*>/gi;for(Ae.lastIndex=0,g=null;(g=Ae.exec(e))!==null;){const o=g[0],i=g[1];i&&!N.some(L=>L.match.includes(o))&&N.push({match:o,src:i})}const Re=/<video[^>]+src=["']([^"']+)["'][^>]*\/>/gi;for(Re.lastIndex=0,g=null;(g=Re.exec(e))!==null;){const o=g[0],i=g[1];i&&!N.some(L=>L.match.includes(o))&&N.push({match:o,src:i})}const He=/<iframe[^>]+src=["']([^"']*(?:youtube|youtu\.be|vimeo)[^"']*)["'][^>]*>/gi;for(He.lastIndex=0,g=null;(g=He.exec(e))!==null;){const o=g[0],i=g[1];i&&N.push({match:o,src:i})}const se=[];if(_.forEach(o=>{const i=o.container||o.match,L=e.indexOf(i);L!==-1&&se.push({type:"image",src:o.src,alt:o.alt,originalHtml:i,position:L})}),N.forEach(o=>{const i=e.indexOf(o.match);i!==-1&&se.push({type:"video",src:o.src,alt:"",originalHtml:o.match,position:i})}),se.sort((o,i)=>o.position-i.position),l?.extractAllVisuals){const o=se.map(i=>({type:i.type,src:i.src,alt:i.alt,originalHtml:i.originalHtml}));return f=fe(f,o),{processedContent:f,visuals:o}}const ge=[],Ge=500;se.forEach(o=>{const i={type:o.type,src:o.src,alt:o.alt,originalHtml:o.originalHtml},L=ge[ge.length-1];if(L&&L.length>0){const j=L[L.length-1];if(o.position-(j.position+(j.visual.originalHtml?.length||0))<=Ge){L.push({visual:i,position:o.position});return}}ge.push([{visual:i,position:o.position}])});const ve=[];return ge.forEach(o=>{ve.push(...Qt(o.map(i=>i.visual)))}),s.push(...ve),ve.length>0&&(f=fe(f,ve)),{processedContent:f,visuals:s}}function ye(e){const l=/<div[^>]*elementor-widget-video[^>]*data-settings=["']([^"']+)["'][^>]*>[\s\S]*?<div[^>]*elementor-video[^>]*>\s*<\/div>[\s\S]*?<\/div>\s*<\/div>\s*<\/div>/gi;return e.replace(l,(s,f)=>{try{const _=JSON.parse(f.replace(/"/g,'"')),S=_?.youtube_url,$=_?.vimeo_url;if(!(S||$))return s;let V,g;if(S){const N=we(S);if(!N)return s;V=`https://www.youtube.com/embed/${N}`,g="YouTube video"}else if($){const N=te($);if(!N)return s;V=`https://player.vimeo.com/video/${N}`,g="Vimeo video"}else return s;return`<div class="elementor-widget-video elementor-fit-aspect-ratio"><div class="elementor-widget-container"><div class="elementor-wrapper elementor-open-inline"><div class="elementor-video"><div class="aspect-video w-full overflow-hidden rounded-lg"><iframe class="w-full aspect-video" src="${V}" title="${g}" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div></div></div></div></div>`}catch{return s}})}const Y=E(()=>
6{if(!n.value?.content?.rendered)return"";const e=ye(n.value.content.rendered);return ct(e)}),ae=E(()=>{if(!Y.value)return{processedContent:"",visuals:[]};const e=pe(Y.value);return e.visuals.length>0&&console.log("Imágenes detectadas:",e.visuals.length,e.visuals.map(l=>({type:l.type,src:l.src.substring(0,50)+"..."}))),e}),me=E(()=>Y.value?pe(Y.value,{extractAllVisuals:!0}):{processedContent:"",visuals:[]}),le=h("original");function ke(e){le.value=e}const ne=E(()=>le.value==="original"?ae.value.visuals:me.value.visuals),r=E(()=>le.value==="original"?ae.value.visuals.length>1:ne.value.length>=1),u=h(null),H=E(()=>ae.value.processedContent);function b(e){u.value=e}const X=h(!1);function Ce(e){X.value=e}return(e,l)=>{const s=lt,f=Yt,_=nt,S=ft,$=We;return!t(he)&&!t(n)?(c(),d("div",ea,[Q(s,{class:"max-w-xl",title:t(P)("offline_lite_requires_connection","Esta sección requiere conexión."),description:t(P)("offline_lite_online_only_detail","Conéctate para cargar datos actualizados.")},null,8,["title","description"])])):t(A)==="pending"?(c(),d("div",ta,[...l[0]||(l[0]=[a("span",{class:"loading loading-ring loading-lg"},null,-1)])])):t(n)?(c(),d("div",aa,[a("div",{class:J([t(gt),"p-1 pt-1"])},[a("div",la,[a("div",{class:J(["relative min-h-[300px] overflow-hidden rounded-[36px] tablet:min-h-[400px] desktop:min-h-[592px]",!t(x)&&"bg-white"])},[t(x)&&t(R)?(c(),d("div",na,[a("img",{src:t(R),alt:t(q),class:"absolute inset-0 h-full w-full object-cover object-[center_30%]"},null,8,sa)])):y("",!0),t(x)?(c(),d("div",oa)):y("",!0),a("div",{class:J(["relative z-10 flex min-h-[300px] flex-col tablet:min-h-[400px] desktop:min-h-[592px]",t(x)?"":"justify-center"])},[t(x)?(c(),d("div",ia)):y("",!0),a("div",{class:J(["w-full",t(mt)])},[a("div",{class:J(["flex w-full flex-col gap-6 tablet:w-[80%]",t(x)?"text-white":"text-black"])},[a("h1",{class:J(["text-[24px] font-medium leading-none tracking-[-1.2px] tablet:text-[48px] desktop:text-[80px]",t(x)&&"[text-shadow:rgba(0,0,0,0.1)_0px_4px_6px,rgba(0,0,0,0.5)_0px_2px_4px]"])},[(c(!0),d(re,null,Le(Z(t(K)(t(n).title.rendered)),(v,V)=>(c(),d("p",{key:V,class:"mb-0 font-national2Narrow text-[24px] tablet:text-[48px] desktop:text-[80px]"},w(v),1))),128))],2)],2)],2)],2)],2)])],2),Q(pt,{tag:"div","with-top-padding":"",class:"bg-[#f1f1f1] !pb-16"},{default:ce(()=>[a("div",ra,[a("div",ca,[a("div",ua,[t(n)?(c(),De(f,{key:0,"content-html":t(me).processedContent??"",locale:t(O),"formatted-date":t(n)?ee(t(n).date):void 0,"related-topics":t(I),"ai-features-enabled":je,onContentChanged:b,onStreaming:Ce,onStyleChanged:ke},null,8,["content-html","locale","formatted-date","related-topics"])):y("",!0)])]),a("div",da,[a("div",fa,[t(n).content?.rendered?(c(),d("div",pa,[a("div",{innerHTML:t(H)},null,8,ma),je&&t(X)?(c(),d("div",ga,[...l[1]||(l[1]=[a("span",{class:"loading loading-dots loading-sm text-black"},null,-1)])])):y("",!0)])):y("",!0),t(r)?(c(),d("div",va,[Q(_,{items:t(ne).map((v,V)=>({name:`imagen-${V}`,title:`${t(P)("noticias_gallery_image_label","Imagen")} ${V+1}`,link:"#",...v})),showIndicators:"",darkIndicators:""},{default:ce(({item:v})=>[a("div",ha,[v.type==="image"?(c(),d("img",{key:0,src:v.src,alt:v.alt||t(P)("noticias_gallery_image","Imagen de la galerÃa"),class:"absolute inset-0 h-full w-full object-cover"},null,8,xa)):v.type==="video"?(c(),d("div",ba,[!v.src.includes("youtube")&&!v.src.includes("youtu.be")&&!v.src.includes("vimeo")?(c(),d("video",{key:0,src:v.src,controls:"",class:"absolute inset-0 h-full w-full rounded-[24px] object-cover"},null,8,_a)):(c(),d("iframe",{key:1,src:v.src,frameborder:"0",allow:` 7 accelerometer; 8 autoplay; 9 clipboard-write; 10 encrypted-media; 11 gyroscope; 12 picture-in-picture; 13 `,allowfullscreen:"",class:"absolute inset-0 h-full w-full rounded-[24px]"},null,8,wa))])):y("",!0)])]),_:1},8,["items"])])):y("",!0),Q($,{to:"/noticias",class:"group mt-8 flex w-fit items-center justify-center gap-2 rounded-lg border-2 border-black bg-white px-6 py-3 transition-all hover:bg-black hover:text-white"},{default:ce(()=>[Q(S,{class:"h-4 w-4 text-black transition-colors group-hover:text-white"}),a("p",ya,w(t(P)("noticias_view_more_stories","Ver más historias")),1)]),_:1})])])])]),_:1})])):t(A)==="error"||t(U)?(c(),d("div",ka,[a("div",Ca,[a("p",$a,w(t(P)("noticias_not_found","Noticia no encontrada")),1),Q($,{to:"/noticias",class:"btn btn-secondary"},{default:ce(()=>[Ze(w(t(P)("noticias_back","Volver a noticias")),1)]),_:1})])])):y("",!0)}}}),Ua=ut(Sa,[["__scopeId","data-v-fd6be99b"]]);export{Ua 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.