(()=>{"use strict";var e={837:()=>{document.addEventListener("DOMContentLoaded",(function(){!function(e,t){const n=document.querySelector(e);n&&document.addEventListener("selectionchange",(()=>{const e=window.getSelection();if(e&&e.rangeCount>0&&!e.isCollapsed){const o=e.getRangeAt(0);if(n.contains(o.startContainer)&&n.contains(o.endContainer)){const r=e.toString(),s=[],c=document.createNodeIterator(o.commonAncestorContainer,NodeFilter.SHOW_ELEMENT);let i;for(;i=c.nextNode();)o.intersectsNode(i)&&s.push(i);const l=s.filter((e=>n!==e));t({selectedElements:l,selectedText:r})}}}))}(".article-container article",(e=>{}))}))}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var s=t[o]={exports:{}};return e[o](s,s.exports,n),s.exports}(()=>{const e="__theme__",t=()=>{const t=localStorage.getItem(e);return null!=t?t:"light"};new class{constructor(){this.listeners={}}on(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}off(e,t){const n=this.listeners[e];n&&(this.listeners[e]=n.filter((e=>e!==t)))}emit(e,...t){const n=this.listeners[e];n&&n.length&&n.forEach((e=>{e(...t)}))}};const o=e=>Promise.all(e.map((e=>new Promise(((t,n)=>{if("css"===e.type){const o=document.createElement("link");o.href=e.url,o.rel="stylesheet",o.onload=()=>t(),o.onerror=()=>n(new Error(`Failed to load CSS from ${e.url}`)),document.head.appendChild(o)}else if("js"===e.type){const o=document.createElement("script");o.src=e.url,e.id&&(o.id=e.id),o.onload=()=>t(),o.onerror=()=>n(new Error(`Failed to load JS from ${e.url}`)),document.body.appendChild(o)}else n(new Error("Invalid resource type specified."))}))))),r=e=>{const{enable:t,jsCdn:n,cssCdn:r}=e;t&&o([{type:"css",url:r},{type:"js",url:n}]).then((e=>{e&&(e=>{const t=/\$\$(.+?)\$\$/g,n=/\\\[(.+?)\\\]/g;function o(e,t,n){let o;const r=[];for(;null!==(o=t.exec(e.nodeValue));){const t=document.createRange();t.setStart(e,o.index),t.setEnd(e,o.index+o[0].length),r.push(t)}for(const e of r){const t=e.toString().replace(/^\$\$|\$\$$|\\\[|\\\]$/g,""),o=document.createElement("span");o.innerHTML=window.katex.renderToString(t,{throwOnError:!1,displayMode:n}),e.deleteContents(),e.insertNode(o)}}document.querySelectorAll(e).forEach((e=>{const r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null);let s;for(;s=r.nextNode();)o(s,t,!1),o(s,n,!0)}))})(".article-container")}))};var s=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r{const{enable:t,cdn:n}=e,r=s(e,["enable","cdn"]);t&&o([{type:"js",url:n}]).then((e=>{e&&(((e="vcomments",t=".article-container")=>{const n=document.querySelector(t);if(!n)return;const o=document.createElement("div");o.id=e,n.appendChild(o)})(),new window.Valine(Object.assign({el:"#vcomments"},r)))}))};n(837);const i='',l=e=>{document.querySelectorAll(".toc a").forEach((e=>e.classList.remove("active")));const t=document.querySelector('.toc a[href="'+e+'"]');t&&t.classList.add("active")};document.addEventListener("click",(function(e){const t=e.target.closest(".toc-link");if(t){const e=t.getAttribute("href");e&&l(e)}})),document.addEventListener("DOMContentLoaded",(function(){(e=>{const t=document.querySelector(e);if(t){const e=localStorage.getItem("scrolledHeight");e&&(t.scrollTop=Number(e))}})("main.scrollbar-obtrusive"),window.location.hash&&l(window.location.hash);const{mermaid:e,katex:n,valine:s}=window;r(Object.assign(Object.assign({},n),{enable:window.page.use.indexOf("katex")>-1})),(e=>{var t;const{enable:n,cdn:r,theme:s}=e;if(n){const e=document.getElementById("src-mermaid");e&&(null===(t=e.parentNode)||void 0===t||t.removeChild(e)),o([{type:"js",url:r,id:"src-mermaid"}]).then((e=>{e&&window.mermaid.initialize({startOnLoad:!0,theme:s||"neutral"})}))}})(Object.assign(Object.assign({},e),{enable:window.page.use.indexOf("mermaid")>-1})),c(Object.assign(Object.assign({},s),{enable:window.page.use.indexOf("valine")>-1})),document.querySelectorAll(".article-container article pre > code").forEach((e=>{const t=e.parentNode;if(!t)return;const n=document.createElement("div");n.classList.add("code-wrapper"),t.parentNode.insertBefore(n,t),n.appendChild(t);const o=document.createElement("div");o.classList.add("btn-wrapper");const r=t.getAttribute("data-language"),s=document.createElement("span");s.classList.add("lang"),s.textContent=r,o.appendChild(s);const c=document.createElement("span");c.className="copy-button",c.innerHTML=i,c.addEventListener("click",(function(){const t=e.textContent;navigator.clipboard.writeText(t).then((()=>{c.innerHTML='',setTimeout((()=>{c.innerHTML=i}),2e3)}))})),o.appendChild(c),n.appendChild(o)})),a();const d=document.getElementById("toggle-theme");null==d||d.addEventListener("click",(()=>{const e=document.querySelector("#prism-theme");e?e.setAttribute("href",`/lib/prism/one-${t()}.css`):a()}))})),document.addEventListener("DOMContentLoaded",(function(){const e=document.querySelector("main.scrollbar-obtrusive");e&&e.addEventListener("scroll",(()=>(e=>{const t=document.querySelector(e);if(t){const e=t.scrollTop;localStorage.setItem("scrolledHeight",String(e))}})("main.scrollbar-obtrusive")))}));const a=()=>{const e=document.createElement("link");e.setAttribute("id","prism-theme"),e.rel="stylesheet",e.type="text/css",e.href=`/lib/prism/one-${t()}.css`,document.head.append(e)}})()})();