import"./toggle.B-POo0Q0.js";import"./Footer.astro_astro_type_script_index_0_lang.DO7gLDc_.js";import"./CookieConsent.astro_astro_type_script_index_0_lang.COgjaRPo.js";import"./fileDownload.Cy2UeYDr.js";import"./ShareCopy.astro_astro_type_script_index_0_lang.uWavvGQz.js";import"./ContentListItem.astro_astro_type_script_index_0_lang.Ba7ePqTh.js";import"./Embed.astro_astro_type_script_index_0_lang.C2NqO7-a.js";import{c as m,u as l,r as u}from"./userState.CVqiCswE.js";import"./TextList.astro_astro_type_script_index_0_lang.DKcwlQ1S.js";import"./SwiperList.astro_astro_type_script_index_0_lang._lMD9bU1.js";import"./video.BZCAfH6-.js";import"./index.DhvORWAp.js";let d=!1;const f=e=>{e.forEach(o=>{if(o.isIntersecting&&!d){const r=document.getElementById("article-hero").dataset.articleId;gtag("event","article_complete",{article_id:r}),d=!0}})},I={root:null,rootMargin:"1px",threshold:[1,.01,1]},w=new IntersectionObserver(f,I),k=document.querySelector("footer");w.observe(k);const h=Array.from(document.querySelectorAll(".like-wrapper"));for(const e of h){const o=e.dataset.articleId,i=e.querySelector(".like-icon"),r=e.querySelector(".liked-icon");let s=!1;const c=async()=>{const t=localStorage.getItem("user-state");JSON.parse(t)?.user?.articles?.find(p=>p.id.toString()===o)?(i.classList.add("d-none"),r.classList.remove("d-none")):(i.classList.remove("d-none"),r.classList.add("d-none"))};m(t=>{t&&(c(),s=!0)});const n=async()=>{if(s){const t=e.dataset.articleId;await l(t),c()}else u({redirectUrl:window.location.href,articleId:o})};(async()=>{i.addEventListener("click",n),r.addEventListener("click",n);const a=new URL(window.location.href).searchParams.get("articleId");a&&(await l(a),window.history.replaceState(null,"",window.location.pathname))})()}
