"use strict";(()=>{function i(){let e=document.body.getAttribute("data-theme");return e==="auto"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e==="dark"?"dark":"light"}document.querySelector("span.post-comment-notloaded")&&document.querySelector("span.post-comment-notloaded").addEventListener("click",loadComment);document.querySelector(".btn .btn-scroll-top").addEventListener("click",()=>{document.documentElement.scrollTop=0});document.addEventListener("DOMContentLoaded",()=>{typeof mediumZoom=="function"&&mediumZoom(".img-zoomable",{margin:32,background:"#00000054",scrollOffset:128})});function m(e){let t=i();e&&(t==="dark"?e.contentWindow.postMessage({type:"set-theme",theme:"photon-dark"},"https://utteranc.es"):e.contentWindow.postMessage({type:"set-theme",theme:"github-light"},"https://utteranc.es"))}document.querySelector(".btn .btn-toggle-mode").addEventListener("click",()=>{let e=i(),t=document.body.getAttribute("data-theme"),n=document.body.getAttribute("data-theme-auto")==="true",o=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";if(t==="auto")document.body.setAttribute("data-theme",e==="light"?"dark":"light"),localStorage.setItem("fuji_data-theme",e==="light"?"dark":"light");else if(t==="light"){let a=o==="dark"&&n?"auto":"dark";document.body.setAttribute("data-theme",a),localStorage.setItem("fuji_data-theme",a)}else{let a=o==="light"&&n?"auto":"light";document.body.setAttribute("data-theme",a),localStorage.setItem("fuji_data-theme",a)}let r=document.querySelector(".post-comment");r&&document.querySelector("span.post-comment-notloaded").getAttribute("style")&&(r.getAttribute("data-comment")==="utterances"&&m(document.querySelector(".post-comment iframe")),r.getAttribute("data-comment")==="disqus"&&DISQUS.reset({reload:!0}))});function d(e,t,n){let r=new Fuse(t,{shouldSort:!0,distance:1e4,keys:[{name:"title",weight:2},{name:"tags",weight:1.5},{name:"content",weight:1}]}).search(e);return r.length>0?(document.getElementById("search-result").innerHTML=template("search-result-template",r),[new Date().getTime()-n,r.length]):"notFound"}var s=new URLSearchParams(window.location.search);if(s.has("s")){let e=new Date().getTime(),t=document.querySelectorAll(".search-result-info"),n=s.get("s");document.querySelector(".search-input input").setAttribute("value",n);let o=new XMLHttpRequest;o.open("GET","index.json",!0),o.responseType="json",o.onerror=()=>{t[2].removeAttribute("style")},o.ontimeout=()=>{t[2].removeAttribute("style")},o.onreadystatechange=()=>{o.readyState===4&&(o.status===200?(e=d(n,o.response,e),e==="notFound"?t[1].removeAttribute("style"):(t[0].innerHTML=t[0].innerHTML.replace("[TIME]",e[0]),t[0].innerHTML=t[0].innerHTML.replace("[NUM]",e[1]),t[0].removeAttribute("style"))):t[2].removeAttribute("style"))},o.send(null)}var l=document.getElementById("btn-menu");l&&l.addEventListener("click",()=>{let e=document.querySelector(".sidebar-mobile");e&&(e.style.display==="none"?e.setAttribute("style","display: flex;"):e.setAttribute("style","display: none;"))});})();