document.addEventListener("DOMContentLoaded",function(){const e=document.querySelectorAll(".ablocks-toc-item-link");if(e.forEach(t=>{t.addEventListener("click",function(t){t.preventDefault();const o=this.getAttribute("href").substring(1),c=document.getElementById(o);c&&(c.scrollIntoView({behavior:"smooth",block:"start"}),e.forEach(e=>e.classList.remove("active")),this.classList.add("active"))})}),e.length){const t=Array.from(e).map(e=>{const t=e.getAttribute("href")?.substring(1);return document.getElementById(t)}).filter(Boolean),o=new IntersectionObserver(t=>{t.forEach(t=>{if(t.isIntersecting){const o=t.target.id;e.forEach(e=>{e.classList.toggle("active",e.getAttribute("href")===`#${o}`)})}})},{rootMargin:"0px 0px -70% 0px",threshold:.1});t.forEach(e=>o.observe(e))}document.querySelectorAll(".ablocks-toc__header-toggle-icon").forEach(e=>{e.addEventListener("click",function(t){t.preventDefault(),t.stopPropagation();const o=e.closest(".ablocks-block").querySelector(".ablocks-toc-body");o&&(o.classList.contains("ablocks-toc__collapse")?(o.classList.remove("ablocks-toc__collapse"),e.querySelector(".ablocks-toc__show").style.display="flex",e.querySelector(".ablocks-toc__hide").style.display="none"):(o.classList.add("ablocks-toc__collapse"),e.querySelector(".ablocks-toc__show").style.display="none",e.querySelector(".ablocks-toc__hide").style.display="flex"))})})});