(function(){const t="system",e=document.querySelectorAll(".theme-toggle");localStorage.getItem("color-theme")==="dark"||!("color-theme"in localStorage)&&(window.matchMedia("(prefers-color-scheme: dark)").matches&&t==="system"||t==="dark")?e.forEach(e=>e.dataset.theme="dark"):e.forEach(e=>e.dataset.theme="light"),e.forEach(e=>{e.addEventListener("click",function(){localStorage.getItem("color-theme")?localStorage.getItem("color-theme")==="light"?(setDarkTheme(),localStorage.setItem("color-theme","dark")):(setLightTheme(),localStorage.setItem("color-theme","light")):document.documentElement.classList.contains("dark")?(setLightTheme(),localStorage.setItem("color-theme","light")):(setDarkTheme(),localStorage.setItem("color-theme","dark")),e.dataset.theme=document.documentElement.classList.contains("dark")?"dark":"light"})}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",n=>{t==="system"&&!("color-theme"in localStorage)&&(n.matches?setDarkTheme():setLightTheme(),e.forEach(e=>e.dataset.theme=document.documentElement.classList.contains("dark")?"dark":"light"))})})(),document.addEventListener("DOMContentLoaded",function(){const i=document.querySelector(".hamburger-menu"),e=document.querySelector(".mobile-menu-overlay"),t=document.querySelector(".sidebar-container"),n=["hx-fixed","hx-inset-0","hx-z-10","hx-bg-black/80","dark:hx-bg-black/60"];e.classList.add("hx-bg-transparent"),e.classList.remove("hx-hidden",...n);function s(){i.querySelector("svg").classList.toggle("open"),t.classList.toggle("max-md:[transform:translate3d(0,-100%,0)]"),t.classList.toggle("max-md:[transform:translate3d(0,0,0)]"),document.body.classList.toggle("hx-overflow-hidden"),document.body.classList.toggle("md:hx-overflow-auto")}function o(){e.classList.remove(...n),e.classList.add("hx-bg-transparent")}i.addEventListener("click",t=>{t.preventDefault(),s(),e.classList.contains("hx-bg-transparent")?(e.classList.add(...n),e.classList.remove("hx-bg-transparent")):o()}),e.addEventListener("click",e=>{e.preventDefault(),s(),o()});const a=t.querySelectorAll("a");a.forEach(e=>{e.addEventListener("click",t=>{e.getAttribute("href")&&e.getAttribute("href").startsWith("#")&&window.innerWidth<768&&(s(),o())})})}),document.addEventListener("DOMContentLoaded",function(){const e=()=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.innerHTML=`
      <path stroke-linecap="round" stroke-linejoin="round" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" />
    `,e.setAttribute("fill","none"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","2"),e},t=()=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");return e.innerHTML=`
      <path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7" />
    `,e.setAttribute("fill","none"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("stroke","currentColor"),e.setAttribute("stroke-width","2"),e};document.querySelectorAll(".hextra-code-copy-btn").forEach(function(n){n.querySelector(".copy-icon")?.appendChild(e()),n.querySelector(".success-icon")?.appendChild(t()),n.addEventListener("click",function(e){e.preventDefault();const s=n.parentElement.previousElementSibling;let t;if(s.tagName==="CODE")t=s;else{const e=s.querySelectorAll("code");t=e[e.length-1]}if(t){let e=t.innerText;"lang"in t.dataset&&(e=e.replace(/\n\n/g,`
`)),navigator.clipboard.writeText(e).then(function(){n.classList.add("copied"),setTimeout(function(){n.classList.remove("copied")},1e3)}).catch(function(e){console.error("Failed to copy text: ",e)})}else console.error("Target element not found")})})}),document.querySelectorAll(".hextra-tabs-toggle").forEach(function(e){e.addEventListener("click",function(e){const n=Array.from(e.target.parentElement.querySelectorAll(".hextra-tabs-toggle"));n.map(e=>e.dataset.state=""),e.target.dataset.state="selected";const t=e.target.parentElement.parentElement.nextElementSibling;Array.from(t.children).forEach(function(e){e.dataset.state=""});const s=e.target.getAttribute("aria-controls"),o=t.querySelector(`#${s}`);o.dataset.state="selected"})}),function(){const e=document.querySelectorAll(".language-switcher");e.forEach(e=>{e.addEventListener("click",t=>{t.preventDefault(),e.dataset.state=e.dataset.state==="open"?"closed":"open";const n=e.nextElementSibling;n.classList.toggle("hx-hidden");const s=e.getBoundingClientRect(),o=s.top-window.innerHeight-15;n.style.transform=`translate3d(${s.left}px, ${o}px, 0)`,n.style.minWidth=`${Math.max(s.width,50)}px`})}),document.addEventListener("click",t=>{t.target.closest(".language-switcher")===null&&e.forEach(e=>{e.dataset.state="closed";const t=e.nextElementSibling;t.classList.add("hx-hidden")})})}(),document.addEventListener("DOMContentLoaded",function(){const e=document.querySelectorAll(".hextra-filetree-folder");e.forEach(function(e){e.addEventListener("click",function(){Array.from(e.children).forEach(function(e){e.dataset.state=e.dataset.state==="open"?"closed":"open"}),e.nextElementSibling.dataset.state=e.nextElementSibling.dataset.state==="open"?"closed":"open"})})}),document.addEventListener("DOMContentLoaded",function(){scrollToActiveItem(),enableCollapsibles()});function enableCollapsibles(){const e=document.querySelectorAll(".hextra-sidebar-collapsible-button");e.forEach(function(e){e.addEventListener("click",function(t){t.preventDefault();const n=e.parentElement.parentElement;n&&n.classList.toggle("open")})})}function scrollToActiveItem(){const t=document.querySelector("aside.sidebar-container > .hextra-scrollbar"),n=document.querySelectorAll(".sidebar-active-item"),e=Array.from(n).find(function(e){return e.getBoundingClientRect().height>0});if(!e)return;const s=e.clientHeight,o=e.getBoundingClientRect().top-t.getBoundingClientRect().top;t.scrollTo({behavior:"instant",top:o-s})}document.addEventListener("DOMContentLoaded",function(){const e=document.querySelector("#backToTop");e&&document.addEventListener("scroll",t=>{window.scrollY>300?e.classList.remove("hx-opacity-0"):e.classList.add("hx-opacity-0")})});function scrollUp(){window.scroll({top:0,left:0,behavior:"smooth"})}