/*! Source: /themes/default/assets/js/article.js */ ; function secondsToTime(n){var t=Math.floor(n/3600).toString().padStart(2,"0"),i=Math.floor(n%3600/60).toString().padStart(2,"0"),r=Math.floor(n%60).toString().padStart(2,"0");return t>1?t+":"+i+":"+r:i+":"+r}function shareFunction(){navigator.share!==undefined&&navigator.share(shareArticleInfo).then(()=>console.log("Successful share")).catch(n=>console.log("Error sharing",n))}function timer_data(n){const r=n instanceof Date?n:new Date(n),u=new Intl.RelativeTimeFormat("pt-br"),t={years:31536e3,months:2592e3,weeks:604800,days:86400,hours:3600,minutes:60,seconds:1},i=(r.getTime()-Date.now())/1e3;for(let n in t)if(t[n]{const t=n.getAttribute("data-id");n.innerHTML=`- ${timer_data(t)}`;n.classList.add("fade-in")})}if(document.querySelector(".ib-galeria")){const t=document.querySelectorAll(".ib-galeria > img"),u=document.querySelector(".lightboxGaleria"),i=document.getElementById("lightboxGaleriaImg"),r=document.getElementById("lightBoxGaleriaInfo"),f=document.getElementById("prev-button"),e=document.getElementById("next-button"),o=document.getElementById("close-button");let n=0;t.forEach((f,e)=>{f.addEventListener("click",f=>{f.preventDefault(),n=e,i.src=t[n].src,r.innerHTML=`${t[n].getAttribute("data-description")} | Autor: ${t[n].getAttribute("data-author")}`,u.classList.remove("hidden"),document.querySelector("body").classList.add("stopScroll")})});f.addEventListener("click",()=>{n=(n-1+t.length)%t.length,i.src=t[n].src,r.innerHTML=`${t[n].getAttribute("data-description")} | Autor: ${t[n].getAttribute("data-author")}`});e.addEventListener("click",()=>{n=(n+1)%t.length,i.src=t[n].src,r.innerHTML=`${t[n].getAttribute("data-description")} | Autor: ${t[n].getAttribute("data-author")}`});o.addEventListener("click",()=>{u.classList.add("hidden"),document.querySelector("body").classList.remove("stopScroll")})}const ttsAudio=document.querySelector("#tts"),ttsBtn=document.querySelector("#ttsOuvir"),ttsImg=document.querySelector("#ttsImg");let audioLoaded=!1,playing=!1;if(ttsBtn.addEventListener("click",()=>{audioLoaded||(ttsAudio.src=ttsAudio.getAttribute("data-src"),ttsAudio.load(),audioLoaded=!0),playing?(ttsAudio.pause(),ttsImg.setAttribute("src",`${window.location.origin}/themes/default/assets/img/iconesColoridos/play_ibahia.svg`),playing=!1):(ttsAudio.play(),ttsImg.setAttribute("src",`${window.location.origin}/themes/default/assets/img/iconesColoridos/pause.svg`),playing=!0),ttsAudio.addEventListener("ended",function(){ttsAudio.currentTime=0;ttsImg.setAttribute("src",`${window.location.origin}/themes/default/assets/img/iconesColoridos/play_ibahia.svg`);playing=!1})}),document.querySelector(".ib-audio")){const n=document.querySelectorAll(".audioInline"),t=document.querySelectorAll(".audioImg"),i=document.querySelectorAll(".audioDuration");n.forEach((n,r)=>{const u=t[r],o=i[r];let e=!1,f=!1;u.addEventListener("click",()=>{e||(n.src=n.getAttribute("data-src"),n.load(),n.onloadedmetadata=()=>{o.innerHTML=secondsToTime(n.duration)},e=!0),f?(n.pause(),u.setAttribute("src",`${window.location.origin}/themes/default/assets/img/iconesColoridos/play_ibahia.svg`),f=!1):(n.play(),u.setAttribute("src",`${window.location.origin}/themes/default/assets/img/iconesColoridos/pause.svg`),f=!0),n.onended=function(){n.currentTime=0;u.setAttribute("src",`${window.location.origin}/themes/default/assets/img/iconesColoridos/play_ibahia.svg`);f=!1}})})}const downArrow=document.querySelector(".downArrow");downArrow&&downArrow.addEventListener("click",()=>{document.querySelector("#article").children[0].scrollIntoView()});searchIcon?.addEventListener("click",()=>{searchBox.classList.toggle("active")});window.toggleAsideMenu??=()=>{const n=document.getElementsByTagName("body")[0],t=menuAsideContainer?.classList?.contains("active");menuAsideContainer?.classList?.toggle("active");n.style.overflow=t?"auto":"hidden"};const openHideImage=n=>{if(lightbox){const t=n.querySelector("img");lightboxHolder.src=t.src;lightbox.classList.remove("hidden");document.querySelector("body").style.overflowY="hidden"}},closeLightbox=()=>{lightbox&&(()=>{lightboxHolder.src="",lightbox.classList.add("hidden"),document.querySelector("body").style.overflowY="scroll"})()},openLightboxInline=n=>{lightbox&&(()=>{const t=n.querySelector('source[media="(min-width: 768px)"]'),i=t?t.getAttribute("srcset"):null,r=document.getElementById("lightbox"),u=document.getElementById("lightbox-image");i&&(u.src=i);r.classList.remove("hidden");document.querySelector("body").style.overflowY="hidden"})()},closeAllModals=()=>document.querySelectorAll(".ib-modal").forEach(n=>{n&&(()=>{n.classList.add("hidden"),document.querySelector("body").classList.remove("stopScroll")})()});document.querySelectorAll(".ib-modal").forEach(n=>()=>{n.addEventListener("click",t=>{t.target!==n.querySelector(".content")||n.classList.toggle("hidden")})});searchImgs.forEach(n=>n.addEventListener("click",t=>{t.preventDefault(),location.href=window.location.origin+`?q=${n.previousElementSibling.value}`}));searchInputs.forEach(n=>{n.addEventListener("keyup",function(n){n.keyCode===13&&(n.preventDefault(),location.href=window.location.origin+`?q=${n.target.value}`)})});document.querySelectorAll(".wp-block-embed-youtube").forEach(n=>{const i=n.innerText.trim().match(/(?:(?:https?:)?\/\/)?(?:[\w\-]+\.)*?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\/?\?(?:.+&(?:amp;)?)?v=|shorts\/))(?[\w\-]{11})/),t=i.groups.externalId;t?n.outerHTML=`
`:console.error("YouTube url is not valid",n.innerText)});document.querySelectorAll(".mw-video .controls[data-type='youtube']").forEach(async n=>{var t,i,r;if(!n.style.backgroundImage||n.style.backgroundImage==='url("")'||n.style.backgroundImage==="url('')"||n.style.backgroundImage==="url()"){try{i=await fetch("https://www.youtube.com/oembed?format=json&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D"+n.dataset.videoId);r=await i.json();t=r.thumbnail_url}catch{}t??="https://i.ytimg.com/vi_webp/"+n.dataset.videoId+"/maxresdefault.webp";n.style.backgroundImage="url("+t+")"}});document.querySelectorAll(".mw-video .controls button").forEach(n=>{n.onclick=()=>{let t=n.closest(".mw-article-video").querySelector("iframe");if(n.closest(".mw-article-video").querySelector(".fb-video")){if(!t.dataset.source)return;hideMask(t);t.src=document.querySelector(".fb-video-container").dataset.source;t.onload=()=>{document.querySelector(".fb-video-container").style.display="block"};delete document.querySelector(".fb-video-container").dataset.source}else if(n.closest(".mw-article-video").querySelector("video"))t=n.closest(".mw-article-video").querySelector("video"),hideMask(t),n.closest(".mw-article-video").querySelector(".media.interno").style.display="block",t.play();else{if(!t.dataset.source)return;t.onload=()=>{hideMask(t)};t.src=t.dataset.source;delete t.dataset.source}}});for(x of document.querySelectorAll(".splide.inline-galery-splide"))splide=new Splide(x,{perPage:1,autoplay:!0,interval:6e3,pagination:!1,arrows:!0}),splide.mount(),x.style.display="inherit"