Files
joshuafhiggins.github.io/js/theme.min.js
2023-04-08 12:40:09 -04:00

4 lines
23 KiB
JavaScript

"use strict";function _objectDestructuringEmpty(e){if(e==null)throw new TypeError("Cannot destructure undefined")}function _createForOfIteratorHelper(e,t){if(n=typeof Symbol!="undefined"&&e[Symbol.iterator]||e["@@iterator"],!n){if(Array.isArray(e)||(n=_unsupportedIterableToArray(e))||t&&e&&typeof e.length=="number")return n&&(e=n),s=0,o=function(){},{s:o,n:function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(t){throw t},f:o};throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n,s,o,r,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,r=t},f:function(){try{!i&&n.return!=null&&n.return()}finally{if(a)throw r}}}}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray(e,t){if(!e)return;if(typeof e=="string")return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(e,t)}function _iterableToArray(e){if(typeof Symbol!="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n,s=0;s<t.length;s++)n=t[s],n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var Util=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"forEach",value:function(t,n){t=t||[];for(var s=0;s<t.length;s++)n(t[s])}},{key:"getScrollTop",value:function(){return document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop}},{key:"isMobile",value:function(){return window.matchMedia("only screen and (max-width: 680px)").matches}},{key:"isTocStatic",value:function(){return window.matchMedia("only screen and (max-width: 960px)").matches}},{key:"animateCSS",value:function(t,n,s,o){Array.isArray(n)||(n=[n]),(i=t.classList).add.apply(i,["animate__animated"].concat(_toConsumableArray(n)));var i,a=function e(){var s;(s=t.classList).remove.apply(s,["animate__animated"].concat(_toConsumableArray(n))),t.removeEventListener("animationend",e),typeof o=="function"&&o()};s||t.addEventListener("animationend",a,!1)}}]),e}(),Theme=function(){function e(){_classCallCheck(this,e),this.config=window.config,this.data=this.config.data,this.isDark=document.body.getAttribute("theme")==="dark",this.util=new Util,this.newScrollTop=this.util.getScrollTop(),this.oldScrollTop=this.newScrollTop,this.scrollEventSet=new Set,this.resizeEventSet=new Set,this.switchThemeEventSet=new Set,this.clickMaskEventSet=new Set,window.objectFitImages&&objectFitImages()}return _createClass(e,[{key:"initRaw",value:function(){var t=this;this.util.forEach(document.querySelectorAll("[data-raw]"),function(e){e.innerHTML=t.data[e.id]})}},{key:"initSVGIcon",value:function(){this.util.forEach(document.querySelectorAll("[data-svg-src]"),function(e){fetch(e.getAttribute("data-svg-src")).then(function(e){return e.text()}).then(function(t){var n,s,o=document.createElement("div");o.insertAdjacentHTML("afterbegin",t),n=o.firstChild,n.setAttribute("data-svg-src",e.getAttribute("data-svg-src")),n.classList.add("icon"),s=n.getElementsByTagName("title"),s.length&&n.removeChild(s[0]),e.parentElement.replaceChild(n,e)}).catch(function(e){console.error(e)})})}},{key:"initTwemoji",value:function(){this.config.twemoji&&twemoji.parse(document.body)}},{key:"initMenuMobile",value:function(){var t=document.getElementById("menu-toggle-mobile"),n=document.getElementById("menu-mobile");t.addEventListener("click",function(){document.body.classList.toggle("blur"),t.classList.toggle("active"),n.classList.toggle("active")},!1),this._menuMobileOnClickMask=this._menuMobileOnClickMask||function(){t.classList.remove("active"),n.classList.remove("active")},this.clickMaskEventSet.add(this._menuMobileOnClickMask)}},{key:"initSwitchTheme",value:function(){var t=this;this.util.forEach(document.getElementsByClassName("theme-switch"),function(e){e.addEventListener("click",function(){document.body.getAttribute("theme")==="dark"?document.body.setAttribute("theme","light"):document.body.setAttribute("theme","dark"),t.isDark=!t.isDark,window.localStorage&&localStorage.setItem("theme",t.isDark?"dark":"light");var n,s,e=_createForOfIteratorHelper(t.switchThemeEventSet);try{for(e.s();!(n=e.n()).done;)s=n.value,s()}catch(t){e.e(t)}finally{e.f()}},!1)})}},{key:"initSearch",value:function(){var s,o,i,a,r,c,d,u,h,m,f,t=this,n=this.config.search,l=this.util.isMobile();if(!n||l&&this._searchMobileOnce||!l&&this._searchDesktopOnce)return;h=n.maxResultLength?n.maxResultLength:10,d=n.snippetLength?n.snippetLength:50,a=n.highlightTag?n.highlightTag:"em",i=l?"mobile":"desktop",r=document.getElementById("header-".concat(i)),u=document.getElementById("search-input-".concat(i)),f=document.getElementById("search-toggle-".concat(i)),c=document.getElementById("search-loading-".concat(i)),s=document.getElementById("search-clear-".concat(i)),l?(this._searchMobileOnce=!0,u.addEventListener("focus",function(){document.body.classList.add("blur"),r.classList.add("open")},!1),document.getElementById("search-cancel-mobile").addEventListener("click",function(){r.classList.remove("open"),document.body.classList.remove("blur"),document.getElementById("menu-toggle-mobile").classList.remove("active"),document.getElementById("menu-mobile").classList.remove("active"),c.style.display="none",s.style.display="none",t._searchMobile&&t._searchMobile.autocomplete.setVal("")},!1),s.addEventListener("click",function(){s.style.display="none",t._searchMobile&&t._searchMobile.autocomplete.setVal("")},!1),this._searchMobileOnClickMask=this._searchMobileOnClickMask||function(){r.classList.remove("open"),c.style.display="none",s.style.display="none",t._searchMobile&&t._searchMobile.autocomplete.setVal("")},this.clickMaskEventSet.add(this._searchMobileOnClickMask)):(this._searchDesktopOnce=!0,f.addEventListener("click",function(){document.body.classList.add("blur"),r.classList.add("open"),u.focus()},!1),s.addEventListener("click",function(){s.style.display="none",t._searchDesktop&&t._searchDesktop.autocomplete.setVal("")},!1),this._searchDesktopOnClickMask=this._searchDesktopOnClickMask||function(){r.classList.remove("open"),c.style.display="none",s.style.display="none",t._searchDesktop&&t._searchDesktop.autocomplete.setVal("")},this.clickMaskEventSet.add(this._searchDesktopOnClickMask)),u.addEventListener("input",function(){u.value===""?s.style.display="none":s.style.display="inline"},!1),m=function(){var o=autocomplete("#search-input-".concat(i),{hint:!1,autoselect:!0,dropdownMenuContainer:"#search-dropdown-".concat(i),clearOnSelected:!0,cssClasses:{noPrefix:!0},debug:!0},{name:"search",source:function(o,i){c.style.display="inline",s.style.display="none";var l,r=function(t){c.style.display="none",s.style.display="inline",i(t)};n.type==="lunr"?(l=function(){lunr.queryHandler&&(o=lunr.queryHandler(o));var n={};return t._index.search(o).forEach(function(e){var s,u=e.ref,l=e.matchData.metadata,i=t._indexData[u],r=i.uri,c=i.title,o=i.content;if(n[r])return;s=0,Object.values(l).forEach(function(e){var t,n=e.content;n&&(t=n.position[0][0],(t<s||s===0)&&(s=t))}),s-=d/5,s>0?(s+=o.substr(s,20).lastIndexOf(" ")+1,o="..."+o.substr(s,d)):o=o.substr(0,d),Object.keys(l).forEach(function(e){c=c.replace(new RegExp("(".concat(e,")"),"gi"),"<".concat(a,">$1</").concat(a,">")),o=o.replace(new RegExp("(".concat(e,")"),"gi"),"<".concat(a,">$1</").concat(a,">"))}),n[r]={uri:r,title:c,date:i.date,context:o}}),Object.values(n).slice(0,h)},t._index?r(l()):fetch(n.lunrIndexURL).then(function(e){return e.json()}).then(function(e){var s={};t._index=lunr(function(){var t=this;n.lunrLanguageCode&&this.use(lunr[n.lunrLanguageCode]),this.ref("objectID"),this.field("title",{boost:50}),this.field("tags",{boost:20}),this.field("categories",{boost:20}),this.field("content",{boost:10}),this.metadataWhitelist=["position"],e.forEach(function(e){s[e.objectID]=e,t.add(e)})}),t._indexData=s,r(l())}).catch(function(e){console.error(e),r([])})):n.type==="algolia"&&(t._algoliaIndex=t._algoliaIndex||algoliasearch(n.algoliaAppID,n.algoliaSearchKey).initIndex(n.algoliaIndex),t._algoliaIndex.search(o,{offset:0,length:h*8,attributesToHighlight:["title"],attributesToSnippet:["content:".concat(d)],highlightPreTag:"<".concat(a,">"),highlightPostTag:"</".concat(a,">")}).then(function(e){var n=e.hits,t={};n.forEach(function(e){var n=e.uri,o=e.date,i=e._highlightResult.title,s=e._snippetResult.content;if(t[n]&&t[n].context.length>s.value)return;t[n]={uri:n,title:i.value,date:o,context:s.value}}),r(Object.values(t).slice(0,h))}).catch(function(e){console.error(e),r([])}))},templates:{suggestion:function(t){var n=t.title,s=t.date,o=t.context;return'<div><span class="suggestion-title">'.concat(n,'</span><span class="suggestion-date">').concat(s,'</span></div><div class="suggestion-context">').concat(o,"</div>")},empty:function(t){var s=t.query;return'<div class="search-empty">'.concat(n.noResultsFound,': <span class="search-query">"').concat(s,'"</span></div>')},footer:function(t){_objectDestructuringEmpty(t);var s=n.type==="algolia"?{searchType:"algolia",icon:'<i class="fab fa-algolia fa-fw" aria-hidden="true"></i>',href:"https://www.algolia.com/"}:{searchType:"Lunr.js",icon:"",href:"https://lunrjs.com/"},o=s.searchType,i=s.icon,a=s.href;return'<div class="search-footer">Search by <a href="'.concat(a,'" rel="noopener noreffer" target="_blank">').concat(i," ").concat(o,"</a></div>")}}});o.on("autocomplete:selected",function(e,t){window.location.assign(t.uri)}),l?t._searchMobile=o:t._searchDesktop=o},n.lunrSegmentitURL&&!document.getElementById("lunr-segmentit")?(o=document.createElement("script"),o.id="lunr-segmentit",o.type="text/javascript",o.src=n.lunrSegmentitURL,o.async=!0,o.readyState?o.onreadystatechange=function(){(o.readyState=="loaded"||o.readyState=="complete")&&(o.onreadystatechange=null,m())}:o.onload=function(){m()},document.body.appendChild(o)):m()}},{key:"initDetails",value:function(){this.util.forEach(document.getElementsByClassName("details"),function(e){var t=e.getElementsByClassName("details-summary")[0];t.addEventListener("click",function(){e.classList.toggle("open")},!1)})}},{key:"initLightGallery",value:function(){this.config.lightgallery&&lightGallery(document.getElementById("content"),{plugins:[lgThumbnail,lgZoom],selector:".lightgallery",speed:400,hideBarsDelay:2e3,allowMediaOverlap:!0,exThumbImage:"data-thumbnail",toggleThumb:!0,thumbWidth:80,thumbHeight:"60px",actualSize:!1,showZoomInOutIcons:!0})}},{key:"initHighlight",value:function(){var t=this;this.util.forEach(document.querySelectorAll(".highlight > pre.chroma"),function(e){var n,s,o,i,t=document.createElement("div");t.className=e.className,n=document.createElement("table"),t.appendChild(n),s=document.createElement("tbody"),n.appendChild(s),o=document.createElement("tr"),s.appendChild(o),i=document.createElement("td"),o.appendChild(i),e.parentElement.replaceChild(t,e),i.appendChild(e)}),this.util.forEach(document.querySelectorAll(".highlight > .chroma"),function(e){var n,s,o,i,a,c,l,r=e.querySelectorAll("pre.chroma > code");r.length&&(a=r[r.length-1],s=document.createElement("div"),s.className="code-header "+a.className.toLowerCase(),o=document.createElement("span"),o.classList.add("code-title"),o.insertAdjacentHTML("afterbegin",'<i class="arrow fas fa-chevron-right fa-fw" aria-hidden="true"></i>'),o.addEventListener("click",function(){e.classList.toggle("open")},!1),s.appendChild(o),i=document.createElement("span"),i.insertAdjacentHTML("afterbegin",'<i class="fas fa-ellipsis-h fa-fw" aria-hidden="true"></i>'),i.classList.add("ellipses"),i.addEventListener("click",function(){e.classList.add("open")},!1),s.appendChild(i),n=document.createElement("span"),n.insertAdjacentHTML("afterbegin",'<i class="far fa-copy fa-fw" aria-hidden="true"></i>'),n.classList.add("copy"),c=a.innerText,(t.config.code.maxShownLines<0||c.split(`
`).length<t.config.code.maxShownLines+2)&&e.classList.add("open"),t.config.code.copyTitle&&(n.setAttribute("data-clipboard-text",c),n.title=t.config.code.copyTitle,l=new ClipboardJS(n),l.on("success",function(){t.util.animateCSS(a,"animate__flash")}),s.appendChild(n)),e.insertBefore(s,e.firstChild))})}},{key:"initTable",value:function(){this.util.forEach(document.querySelectorAll(".content table"),function(e){var t=document.createElement("div");t.className="table-wrapper",e.parentElement.replaceChild(t,e),t.appendChild(e)})}},{key:"initHeaderLink",value:function(){for(var t=1;t<=6;t++)this.util.forEach(document.querySelectorAll(".single .content > h"+t),function(e){e.classList.add("headerLink"),e.insertAdjacentHTML("afterbegin",'<a href="#'.concat(e.id,'" class="header-mark"></a>'))})}},{key:"initToc",value:function(){var n,s,o,i,a,c,l,d,u,h,m,f,p,r=this,t=document.getElementById("TableOfContents");if(t===null)return;document.getElementById("toc-static").getAttribute("data-kept")||this.util.isTocStatic()?(h=document.getElementById("toc-content-static"),t.parentElement!==h&&(t.parentElement.removeChild(t),h.appendChild(t)),this._tocOnScroll&&this.scrollEventSet.delete(this._tocOnScroll)):(l=document.getElementById("toc-content-auto"),t.parentElement!==l&&(t.parentElement.removeChild(t),l.appendChild(t)),n=document.getElementById("toc-auto"),u=document.getElementsByClassName("page")[0],d=u.getBoundingClientRect(),n.style.left="".concat(d.left+d.width+20,"px"),n.style.maxWidth="".concat(u.getBoundingClientRect().left-20,"px"),n.style.visibility="visible",c=t.querySelectorAll("a:first-child"),f=t.getElementsByTagName("li"),s=document.getElementsByClassName("headerLink"),i=document.body.getAttribute("data-header-desktop")!=="normal",o=document.getElementById("header-desktop").offsetHeight,a=20+(i?o:0),m=n.offsetTop,p=m-a+(i?0:o),this._tocOnScroll=this._tocOnScroll||function(){var e,l,d,u,h,v,b=document.getElementById("post-footer").offsetTop,g=b-n.getBoundingClientRect().height,j=g-a+(i?0:o);r.newScrollTop<p?(n.style.position="absolute",n.style.top="".concat(m,"px")):r.newScrollTop>j?(n.style.position="absolute",n.style.top="".concat(g,"px")):(n.style.position="fixed",n.style.top="".concat(a,"px")),r.util.forEach(c,function(e){e.classList.remove("active")}),r.util.forEach(f,function(e){e.classList.remove("has-active")}),u=20+(i?o:0),l=s.length-1;for(e=0;e<s.length-1;e++)if(h=s[e].getBoundingClientRect().top,v=s[e+1].getBoundingClientRect().top,e==0&&h>u||h<=u&&v>u){l=e;break}if(l!==-1)for(c[l].classList.add("active"),d=c[l].parentElement;d!==t;)d.classList.add("has-active"),d=d.parentElement.parentElement},this._tocOnScroll(),this.scrollEventSet.add(this._tocOnScroll))}},{key:"initMath",value:function(){this.config.math&&renderMathInElement(document.body,this.config.math)}},{key:"initMermaid",value:function(){var t=this;this._mermaidOnSwitchTheme=this._mermaidOnSwitchTheme||function(){var e=document.getElementsByClassName("mermaid");e.length&&(mermaid.initialize({startOnLoad:!1,theme:t.isDark?"dark":"neutral",securityLevel:"loose"}),t.util.forEach(e,function(e){mermaid.render("svg-"+e.id,t.data[e.id],function(t){e.innerHTML=t},e)}))},this.switchThemeEventSet.add(this._mermaidOnSwitchTheme),this._mermaidOnSwitchTheme()}},{key:"initEcharts",value:function(){var t=this;this.config.echarts&&(echarts.registerTheme("light",this.config.echarts.lightTheme),echarts.registerTheme("dark",this.config.echarts.darkTheme),this._echartsOnSwitchTheme=this._echartsOnSwitchTheme||function(){t._echartsArr=t._echartsArr||[];for(var e=0;e<t._echartsArr.length;e++)t._echartsArr[e].dispose();t._echartsArr=[],t.util.forEach(document.getElementsByClassName("echarts"),function(e){var n=echarts.init(e,t.isDark?"dark":"light",{renderer:"svg"});n.setOption(JSON.parse(t.data[e.id])),t._echartsArr.push(n)})},this.switchThemeEventSet.add(this._echartsOnSwitchTheme),this._echartsOnSwitchTheme(),this._echartsOnResize=this._echartsOnResize||function(){for(var e=0;e<t._echartsArr.length;e++)t._echartsArr[e].resize()},this.resizeEventSet.add(this._echartsOnResize))}},{key:"initMapbox",value:function(){var t=this;this.config.mapbox&&(mapboxgl.accessToken=this.config.mapbox.accessToken,mapboxgl.setRTLTextPlugin(this.config.mapbox.RTLTextPlugin),this._mapboxArr=this._mapboxArr||[],this.util.forEach(document.getElementsByClassName("mapbox"),function(e){var n=t.data[e.id],o=n.lng,i=n.lat,a=n.zoom,r=n.lightStyle,c=n.darkStyle,l=n.marked,d=n.navigation,u=n.geolocate,h=n.scale,m=n.fullscreen,s=new mapboxgl.Map({container:e,center:[o,i],zoom:a,minZoom:.2,style:t.isDark?c:r,attributionControl:!1});l&&(new mapboxgl.Marker).setLngLat([o,i]).addTo(s),d&&s.addControl(new mapboxgl.NavigationControl,"bottom-right"),u&&s.addControl(new mapboxgl.GeolocateControl({positionOptions:{enableHighAccuracy:!0},showUserLocation:!0,trackUserLocation:!0}),"bottom-right"),h&&s.addControl(new mapboxgl.ScaleControl),m&&s.addControl(new mapboxgl.FullscreenControl),s.addControl(new MapboxLanguage),t._mapboxArr.push(s)}),this._mapboxOnSwitchTheme=this._mapboxOnSwitchTheme||function(){t.util.forEach(t._mapboxArr,function(e){var s=e.getContainer(),n=t.data[s.id],o=n.lightStyle,i=n.darkStyle;e.setStyle(t.isDark?i:o),e.addControl(new MapboxLanguage)})},this.switchThemeEventSet.add(this._mapboxOnSwitchTheme))}},{key:"initTypeit",value:function(){var t,n,s,o,i=this;this.config.typeit&&(t=this.config.typeit,n=t.speed?t.speed:100,s=t.cursorSpeed?t.cursorSpeed:1e3,o=t.cursorChar?t.cursorChar:"|",Object.values(t.data).forEach(function(e){var a=function a(r){var c=e[r],l=new TypeIt("#".concat(c),{strings:i.data[c],speed:n,lifeLike:!0,cursorSpeed:s,cursorChar:o,waitUntilVisible:!0,afterComplete:function(){if(r===e.length-1){t.duration>=0&&window.setTimeout(function(){l.destroy()},t.duration);return}l.destroy(),a(r+1)}}).go()};a(0)}))}},{key:"initComment",value:function(){var t,n,s,o,a,i=this;this.config.comment&&(this.config.comment.gitalk&&(this.config.comment.gitalk.body=decodeURI(window.location.href),a=new Gitalk(this.config.comment.gitalk),a.render("gitalk")),this.config.comment.valine&&new Valine(this.config.comment.valine),this.config.comment.utterances&&(o=this.config.comment.utterances,s=document.createElement("script"),s.src="https://utteranc.es/client.js",s.type="text/javascript",s.setAttribute("repo",o.repo),s.setAttribute("issue-term",o.issueTerm),o.label&&s.setAttribute("label",o.label),s.setAttribute("theme",this.isDark?o.darkTheme:o.lightTheme),s.crossOrigin="anonymous",s.async=!0,document.getElementById("utterances").appendChild(s),this._utterancesOnSwitchTheme=this._utterancesOnSwitchTheme||function(){var e={type:"set-theme",theme:i.isDark?o.darkTheme:o.lightTheme},t=document.querySelector(".utterances-frame");t.contentWindow.postMessage(e,"https://utteranc.es")},this.switchThemeEventSet.add(this._utterancesOnSwitchTheme)),this.config.comment.giscus&&(n=this.config.comment.giscus,t=document.createElement("script"),t.src="https://giscus.app/client.js",t.type="text/javascript",t.setAttribute("data-repo",n.repo),t.setAttribute("data-repo-id",n.repoId),t.setAttribute("data-category",n.category),t.setAttribute("data-category-id",n.categoryId),t.setAttribute("data-lang",n.lang),t.setAttribute("data-mapping",n.mapping),t.setAttribute("data-reactions-enabled",n.reactionsEnabled),t.setAttribute("data-emit-metadata",n.emitMetadata),t.setAttribute("data-input-position",n.inputPosition),n.lazyLoading&&t.setAttribute("data-loading","lazy"),t.setAttribute("data-theme",this.isDark?n.darkTheme:n.lightTheme),t.crossOrigin="anonymous",t.async=!0,document.getElementById("giscus").appendChild(t),this._giscusOnSwitchTheme=this._giscusOnSwitchTheme||function(){var t={setConfig:{theme:i.isDark?n.darkTheme:n.lightTheme,reactionsEnabled:!1}},e=document.querySelector("iframe.giscus-frame");if(!e)return;e.contentWindow.postMessage({giscus:t},"https://giscus.app")},this.switchThemeEventSet.add(this._giscusOnSwitchTheme)))}},{key:"initCookieconsent",value:function(){this.config.cookieconsent&&cookieconsent.initialise(this.config.cookieconsent)}},{key:"onScroll",value:function(){t=this,s=[],document.body.getAttribute("data-header-desktop")==="auto"&&s.push(document.getElementById("header-desktop")),document.body.getAttribute("data-header-mobile")==="auto"&&s.push(document.getElementById("header-mobile")),document.getElementById("comments")&&(i=document.getElementById("view-comments"),i.href="#comments",i.style.display="block");var t,s,i,n=document.getElementById("fixed-buttons"),o=20,a=100;window.addEventListener("scroll",function(){t.newScrollTop=t.util.getScrollTop();var e,c,l,i=t.newScrollTop-t.oldScrollTop,r=t.util.isMobile();t.util.forEach(s,function(e){i>o?(e.classList.remove("animate__fadeInDown"),t.util.animateCSS(e,["animate__fadeOutUp","animate__faster"],!0)):i<-o&&(e.classList.remove("animate__fadeOutUp"),t.util.animateCSS(e,["animate__fadeInDown","animate__faster"],!0))}),t.newScrollTop>a?r&&i>o?(n.classList.remove("animate__fadeIn"),t.util.animateCSS(n,["animate__fadeOut","animate__faster"],!0)):(!r||i<-o)&&(n.style.display="block",n.classList.remove("animate__fadeOut"),t.util.animateCSS(n,["animate__fadeIn","animate__faster"],!0)):(r||(n.classList.remove("animate__fadeIn"),t.util.animateCSS(n,["animate__fadeOut","animate__faster"],!0)),n.style.display="none"),e=_createForOfIteratorHelper(t.scrollEventSet);try{for(e.s();!(c=e.n()).done;)l=c.value,l()}catch(t){e.e(t)}finally{e.f()}t.oldScrollTop=t.newScrollTop},!1)}},{key:"onResize",value:function(){var t=this;window.addEventListener("resize",function(){t._resizeTimeout||(t._resizeTimeout=window.setTimeout(function(){t._resizeTimeout=null;var n,s,e=_createForOfIteratorHelper(t.resizeEventSet);try{for(e.s();!(n=e.n()).done;)s=n.value,s()}catch(t){e.e(t)}finally{e.f()}t.initToc(),t.initMermaid(),t.initSearch()},100))},!1)}},{key:"onClickMask",value:function(){var t=this;document.getElementById("mask").addEventListener("click",function(){var n,s,e=_createForOfIteratorHelper(t.clickMaskEventSet);try{for(e.s();!(n=e.n()).done;)s=n.value,s()}catch(t){e.e(t)}finally{e.f()}document.body.classList.remove("blur")},!1)}},{key:"init",value:function(){var t=this;try{this.initRaw(),this.initSVGIcon(),this.initTwemoji(),this.initMenuMobile(),this.initSwitchTheme(),this.initSearch(),this.initDetails(),this.initLightGallery(),this.initHighlight(),this.initTable(),this.initHeaderLink(),this.initMath(),this.initMermaid(),this.initEcharts(),this.initTypeit(),this.initMapbox(),this.initCookieconsent()}catch(e){console.error(e)}window.setTimeout(function(){t.initToc(),t.initComment(),t.onScroll(),t.onResize(),t.onClickMask()},100)}}]),e}(),themeInit=function(){var t=new Theme;t.init()};document.readyState!=="loading"?themeInit():document.addEventListener("DOMContentLoaded",themeInit,!1)