var Site=Site||{};Site.Header=function(){const s=document.querySelectorAll(".header-approach-list-item");let t,n;const u=n=>n.toLowerCase().replace(/^\/|\/$/g,""),h=()=>{const n=u(location.pathname),t=n.includes("/demos/")&&n.includes("/templates/");if(!t){const i=document.querySelectorAll(".header-menu-items a");i.forEach(t=>{const i=u(t.getAttribute("href"));n.startsWith(i)&&t.classList.add("selected")})}},f=function(n){n.target!==t&&e(!1)},i=function(){if(n.classList.contains("active")){const i=t.getBoundingClientRect();n.style.top=i.top+i.height+"px";n.style.left=i.left+"px"}},e=r=>{t.classList.toggle("active",r),n.classList.toggle("active",r),i(),r?(document.addEventListener("click",f),window.addEventListener("resize",i)):(document.removeEventListener("click",f),window.removeEventListener("resize",i))},c=()=>{(t=document.getElementById("select-approach"),n=document.getElementById("approach-list"),t&&n)&&t.addEventListener("click",t=>{t.stopPropagation();const i=n.classList.contains("active");e(!i)})},l=()=>{const n=document.getElementById("header-drawer-toggle"),t=document.getElementById("header-drawer");n&&t&&(n.onclick=()=>{const i=n.classList.toggle("active"),r="dx-icon "+(i?"dx-icon-close":"dx-icon-menu");n.querySelector("i").className=r;t.classList.toggle("active")})},o=n=>{const t=n.split("/");t.shift();const i=t.shift(),r=t.join("/");return{framework:i,pathname:r}},r=(n,t)=>{const r=n||o(window.location.pathname).pathname,i=t||window.location.hash.substring(1);s.forEach(n=>{const u=o(new URL(n.href).pathname);let t=`/${u.framework}/${r}`;i&&(t+=`#${i}`);n.href=t})};this.updateState=()=>{r()};this.init=()=>{c(),l(),r(),setTimeout(()=>{h()},300),window.addEventListener("hashchange",()=>r())}};document.addEventListener("DOMContentLoaded",()=>{Site.header=Site.header||new Site.Header,Site.header.init()})