document.addEventListener("DOMContentLoaded",function(){document.querySelectorAll(".nav-section-toggle").forEach(function(e){e.addEventListener("click",function(){const t=e.closest(".nav-section");t.classList.toggle("open")})});const n=document.querySelector("#sidebar-nav a.active");if(n){let e=n.parentElement;for(;e&&e.id!=="sidebar-nav";)e.classList.contains("nav-section")&&e.classList.add("open"),e=e.parentElement}const t=document.getElementById("hamburger"),e=document.getElementById("sidebar");t&&e&&(t.addEventListener("click",function(){e.classList.toggle("open")}),document.addEventListener("click",function(n){e.classList.contains("open")&&!e.contains(n.target)&&!t.contains(n.target)&&e.classList.remove("open")}));const s=document.documentElement.lang==="de",o=s?"Kopieren":"Copy",r=s?"Kopiert!":"Copied!";document.querySelectorAll("pre").forEach(function(e){const n=document.createElement("div");n.className="code-copy-container",e.parentNode.insertBefore(n,e),n.appendChild(e);const t=document.createElement("button");t.className="code-copy-btn",t.textContent=o,n.appendChild(t),t.addEventListener("click",function(){const n=e.querySelector("code")||e;navigator.clipboard.writeText(n.innerText).then(function(){t.textContent=r,t.classList.add("copied"),setTimeout(function(){t.textContent=o,t.classList.remove("copied")},2e3)})})});const i=document.querySelectorAll("#toc-container a");if(i.length>0){const e=Array.from(document.querySelectorAll("#content h2 span[id], #content h3 span[id], #content h4 span[id]"));function a(){const n=window.scrollY+100;let t=null;e.forEach(function(e){e.parentElement.offsetTop<=n&&(t=e.id)}),i.forEach(function(e){e.classList.remove("active"),t&&e.getAttribute("href")==="#"+t&&e.classList.add("active")})}window.addEventListener("scroll",a,{passive:!0}),a()}})