(()=>{function s(t,e){this.tocList=t,this.elementList=function t(e,n){if(null==e)return null;var i=e.children;if(0===i.length)return null;for(var s=[],o=0;o${l}`,this.eIndex++,this.eIndex>=this.elementList.length){n+="";break}(s=this.tocList.indexOf(this.elementList[this.eIndex].tagName))>e&&(n+=this.analysis(e,s)),n+=""}else if(s<=t)break}return n+""}}const r=[];function t(t){const i=new Set,s=new Map,o=Array.from(t.querySelectorAll(".menu-list > li > a"));for(const t of o){const r=t.getAttribute("data-id").trim().slice(1),i=document.getElementById(r);i&&s.set(i,t)}const l=Array.from(s.keys()),e=new IntersectionObserver(e=>{for(const n of e)n.isIntersecting?i.add(n.target):i.delete(n.target);let n;if(i.size?n=[...i].sort((t,e)=>t.offsetTop-e.offsetTop)[0]:l.length&&(n=l.filter(t=>t.offsetTope.offsetTop-t.offsetTop)[0]),n&&s.has(n)){o.forEach(t=>t.classList.remove("is-active"));const e=s.get(n);e.classList.add("is-active");let t=e.parentElement.parentElement;for(;t.classList.contains("menu-list")&&"li"===t.parentElement.tagName.toLowerCase();)t.parentElement.children[0].classList.add("is-active"),t=t.parentElement.parentElement}},{threshold:0});for(const t of l){if(e.observe(t),s.has(t)){const r=s.get(t);r.addEventListener("click",()=>{let n,t=document.getElementById(r.getAttribute("data-id").substring(1)).getBoundingClientRect(),i=window.pageYOffset,s=i+t.top-50,o=(s-i)/20,l=i>s?-1:1;window.requestAnimationFrame(function t(e){(i+=o)*l{t.disconnect()}),r.splice(0),s.init({tocList:["h1","h2","h3","h4","h5"],contentElement:$(".main-content:not(.not-toc)")[0],tocElement:".toc-content"}),void 0!==window.IntersectionObserver&&document.querySelectorAll(".toc-content").forEach(t)}})();