This repository has been archived on 2024-11-25. You can view files and clone it, but cannot push or open issues or pull requests.
2023-10-12 14:01:05 +02:00

3 lines
48 KiB
JavaScript

"use strict";function _objectDestructuringEmpty(obj){if(obj==null)throw new TypeError("Cannot destructure "+obj)}function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]}},e:function e(_e){throw _e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o)},n:function n(){var step=it.next();normalCompletion=step.done;return step},e:function e(_e2){didErr=true;err=_e2},f:function f(){try{if(!normalCompletion&&it.return!=null)it.return()}finally{if(didErr)throw err}}}}function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return _typeof(key)==="symbol"?key:String(key)}function _toPrimitive(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(_typeof(res)!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return(hint==="string"?String:Number)(input)}var Util=function(){function Util(){_classCallCheck(this,Util)}_createClass(Util,[{key:"forEach",value:function forEach(elements,handler){elements=elements||[];for(var i=0;i<elements.length;i++){handler(elements[i])}}},{key:"getScrollTop",value:function getScrollTop(){var _document$documentEle;return((_document$documentEle=document.documentElement)!==null&&_document$documentEle!==void 0?_document$documentEle:document.body).scrollTop}},{key:"isMobile",value:function isMobile(){return window.matchMedia("only screen and (max-width: 680px)").matches}},{key:"isTocStatic",value:function isTocStatic(){return window.matchMedia("only screen and (max-width: 960px)").matches}},{key:"animateCSS",value:function animateCSS(element,animation,reserved,callback){var _element$classList;!Array.isArray(animation)&&(animation=[animation]);(_element$classList=element.classList).add.apply(_element$classList,["animate__animated"].concat(_toConsumableArray(animation)));element.addEventListener("animationend",function(){var _element$classList2;!reserved&&(_element$classList2=element.classList).remove.apply(_element$classList2,["animate__animated"].concat(_toConsumableArray(animation)));typeof callback==="function"&&callback()},{once:true})}},{key:"isValidDate",value:function isValidDate(date){return date instanceof Date&&!isNaN(date.getTime())}},{key:"scrollIntoView",value:function scrollIntoView(selector){var element=selector.startsWith("#")?document.getElementById(selector.slice(1)):document.querySelector(selector);element===null||element===void 0?void 0:element.scrollIntoView({behavior:"smooth"})}}]);return Util}();var FixIt=function(){function FixIt(){var _this=this;_classCallCheck(this,FixIt);_defineProperty(this,"getSiteTime",function(){var _document$querySelect;var now=new Date;var run=new Date(_this.config.siteTime);var $runTimes=document.querySelector(".run-times");if(!_this.util.isValidDate(run)||!$runTimes){clearInterval(_this.siteTime);$runTimes&&$runTimes.parentNode.remove();return}var runTime=(now-run)/1000,days=Math.floor(runTime/60/60/24),hours=Math.floor(runTime/60/60-24*days),minutes=Math.floor(runTime/60-24*60*days-60*hours),seconds=Math.floor((now-run)/1000-24*60*60*days-60*60*hours-60*minutes);$runTimes.innerHTML="".concat(days,", ").concat(String(hours).padStart(2,0),":").concat(String(minutes).padStart(2,0),":").concat(String(seconds).padStart(2,0));(_document$querySelect=document.querySelector(".site-time .d-none"))===null||_document$querySelect===void 0?void 0:_document$querySelect.classList.remove("d-none")});this.config=window.config;this.data=this.config.data||[];this.isDark=document.body.dataset.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;this.beforeprintEventSet=new Set;this.disableScrollEvent=false;window.objectFitImages&&objectFitImages()}_createClass(FixIt,[{key:"initThemeColor",value:function initThemeColor(){var _this2=this;var $meta=document.querySelector("[name=\"theme-color\"]");if(!$meta){return}this._themeColorOnSwitchTheme=this._themeColorOnSwitchTheme||function(){$meta.content=_this2.isDark?$meta.dataset.dark:$meta.dataset.light};this.switchThemeEventSet.add(this._themeColorOnSwitchTheme);this._themeColorOnSwitchTheme()}},{key:"initSVGIcon",value:function initSVGIcon(){this.util.forEach(document.querySelectorAll("[data-svg-src]"),function($icon){fetch($icon.dataset.svgSrc).then(function(response){return response.text()}).then(function(svg){var $temp=document.createElement("div");$temp.insertAdjacentHTML("afterbegin",svg);var $svg=$temp.firstChild;$svg.dataset.svgSrc=$icon.dataset.svgSrc;$svg.classList.add("icon");var $titleElements=$svg.getElementsByTagName("title");$titleElements.length&&$svg.removeChild($titleElements[0]);$icon.parentElement.replaceChild($svg,$icon)}).catch(function(err){console.error(err)})})}},{key:"initTwemoji",value:function initTwemoji(){this.config.twemoji&&twemoji.parse(document.body)}},{key:"initMenu",value:function initMenu(){this.initMenuDesktop();this.initMenuMobile()}},{key:"initMenuDesktop",value:function initMenuDesktop(){this.util.forEach(document.querySelectorAll(".has-children"),function($item){$item.querySelector(".sub-menu").style.minWidth="".concat($item.offsetWidth-8,"px")})}},{key:"initMenuMobile",value:function initMenuMobile(){var _this3=this;var $menuToggleMobile=document.getElementById("menu-toggle-mobile");var $menuMobile=document.getElementById("menu-mobile");$menuToggleMobile.addEventListener("click",function(event){document.body.classList.toggle("blur");$menuToggleMobile.classList.toggle("active");$menuMobile.classList.toggle("active");_this3.disableScrollEvent=document.body.classList.contains("blur")},false);this._menuMobileOnClickMask=this._menuMobileOnClickMask||function(){$menuToggleMobile.classList.remove("active");$menuMobile.classList.remove("active")};this.clickMaskEventSet.add(this._menuMobileOnClickMask);this.util.forEach(document.querySelectorAll(".menu-item>.nested-item"),function($nestedItem){$nestedItem.addEventListener("click",function(){this.parentNode.querySelector(".sub-menu").classList.toggle("open");this.querySelector(".dropdown-icon").classList.toggle("open")})})}},{key:"initSwitchTheme",value:function initSwitchTheme(){var _this4=this;this.util.forEach(document.getElementsByClassName("theme-switch"),function($themeSwitch){$themeSwitch.addEventListener("click",function(){var _window$localStorage;document.body.dataset.theme=document.body.dataset.theme==="dark"?"light":"dark";_this4.isDark=!_this4.isDark;(_window$localStorage=window.localStorage)===null||_window$localStorage===void 0?void 0:_window$localStorage.setItem("theme",_this4.isDark?"dark":"light");var _iterator=_createForOfIteratorHelper(_this4.switchThemeEventSet),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var event=_step.value;event()}}catch(err){_iterator.e(err)}finally{_iterator.f()}},false)})}},{key:"initSearch",value:function initSearch(){var _searchConfig$maxResu,_searchConfig$snippet,_searchConfig$highlig,_searchConfig$isCaseS,_searchConfig$minMatc,_searchConfig$findAll,_searchConfig$locatio,_searchConfig$thresho,_searchConfig$distanc,_searchConfig$ignoreL,_searchConfig$useExte,_searchConfig$ignoreF,_this5=this;var searchConfig=this.config.search;var isMobile=this.util.isMobile();if(!searchConfig||isMobile&&this._searchMobileOnce||!isMobile&&this._searchDesktopOnce){return}var maxResultLength=(_searchConfig$maxResu=searchConfig.maxResultLength)!==null&&_searchConfig$maxResu!==void 0?_searchConfig$maxResu:10;var snippetLength=(_searchConfig$snippet=searchConfig.snippetLength)!==null&&_searchConfig$snippet!==void 0?_searchConfig$snippet:50;var highlightTag=(_searchConfig$highlig=searchConfig.highlightTag)!==null&&_searchConfig$highlig!==void 0?_searchConfig$highlig:"em";var isCaseSensitive=(_searchConfig$isCaseS=searchConfig.isCaseSensitive)!==null&&_searchConfig$isCaseS!==void 0?_searchConfig$isCaseS:false;var minMatchCharLength=(_searchConfig$minMatc=searchConfig.minMatchCharLength)!==null&&_searchConfig$minMatc!==void 0?_searchConfig$minMatc:1;var findAllMatches=(_searchConfig$findAll=searchConfig.findAllMatches)!==null&&_searchConfig$findAll!==void 0?_searchConfig$findAll:false;var location=(_searchConfig$locatio=searchConfig.location)!==null&&_searchConfig$locatio!==void 0?_searchConfig$locatio:0;var threshold=(_searchConfig$thresho=searchConfig.threshold)!==null&&_searchConfig$thresho!==void 0?_searchConfig$thresho:0.3;var distance=(_searchConfig$distanc=searchConfig.distance)!==null&&_searchConfig$distanc!==void 0?_searchConfig$distanc:100;var ignoreLocation=(_searchConfig$ignoreL=searchConfig.ignoreLocation)!==null&&_searchConfig$ignoreL!==void 0?_searchConfig$ignoreL:false;var useExtendedSearch=(_searchConfig$useExte=searchConfig.useExtendedSearch)!==null&&_searchConfig$useExte!==void 0?_searchConfig$useExte:false;var ignoreFieldNorm=(_searchConfig$ignoreF=searchConfig.ignoreFieldNorm)!==null&&_searchConfig$ignoreF!==void 0?_searchConfig$ignoreF:false;var suffix=isMobile?"mobile":"desktop";var $header=document.getElementById("header-".concat(suffix));var $searchInput=document.getElementById("search-input-".concat(suffix));var $searchToggle=document.getElementById("search-toggle-".concat(suffix));var $searchLoading=document.getElementById("search-loading-".concat(suffix));var $searchClear=document.getElementById("search-clear-".concat(suffix));if(isMobile){this._searchMobileOnce=true;$searchInput.addEventListener("focus",function(){_this5.disableScrollEvent=true;document.body.classList.add("blur");$header.classList.add("open")},false);document.getElementById("search-cancel-mobile").addEventListener("click",function(){_this5.disableScrollEvent=false;$header.classList.remove("open");document.body.classList.remove("blur");document.getElementById("menu-toggle-mobile").classList.remove("active");document.getElementById("menu-mobile").classList.remove("active");$searchLoading.style.display="none";$searchClear.style.display="none";_this5._searchMobile&&_this5._searchMobile.autocomplete.setVal("")},false);$searchClear.addEventListener("click",function(){$searchClear.style.display="none";_this5._searchMobile&&_this5._searchMobile.autocomplete.setVal("")},false);this._searchMobileOnClickMask=this._searchMobileOnClickMask||function(){$header.classList.remove("open");$searchLoading.style.display="none";$searchClear.style.display="none";_this5._searchMobile&&_this5._searchMobile.autocomplete.setVal("")};this.clickMaskEventSet.add(this._searchMobileOnClickMask)}else{this._searchDesktopOnce=true;$searchToggle.addEventListener("click",function(){document.body.classList.add("blur");$header.classList.add("open");$searchInput.focus()},false);$searchClear.addEventListener("click",function(){$searchClear.style.display="none";_this5._searchDesktop&&_this5._searchDesktop.autocomplete.setVal("")},false);this._searchDesktopOnClickMask=this._searchDesktopOnClickMask||function(){$header.classList.remove("open");$searchLoading.style.display="none";$searchClear.style.display="none";_this5._searchDesktop&&_this5._searchDesktop.autocomplete.setVal("")};this.clickMaskEventSet.add(this._searchDesktopOnClickMask)}$searchInput.addEventListener("input",function(){if($searchInput.value==="")$searchClear.style.display="none";else $searchClear.style.display="inline"},false);var initAutosearch=function initAutosearch(){var autosearch=autocomplete("#search-input-".concat(suffix),{hint:false,autoselect:true,dropdownMenuContainer:"#search-dropdown-".concat(suffix),clearOnSelected:true,cssClasses:{noPrefix:true},debug:true},{name:"search",source:function source(query,callback){$searchLoading.style.display="inline";$searchClear.style.display="none";var finish=function finish(results){$searchLoading.style.display="none";$searchClear.style.display="inline";callback(results)};if(searchConfig.type==="lunr"){var search=function search(){if(lunr.queryHandler){query=lunr.queryHandler(query)}var results={};_this5._index.search(query).forEach(function(_ref){var ref=_ref.ref,metadata=_ref.matchData.metadata;var matchData=_this5._indexData[ref];var uri=matchData.uri,title=matchData.title,context=matchData.content;if(results[uri]){return}var position=0;Object.values(metadata).forEach(function(_ref2){var content=_ref2.content;if(content){var matchPosition=content.position[0][0];if(matchPosition<position||position===0){position=matchPosition}}});position-=snippetLength/5;if(position>0){position+=context.substr(position,20).lastIndexOf(" ")+1;context="..."+context.substr(position,snippetLength)}else{context=context.substr(0,snippetLength)}Object.keys(metadata).forEach(function(key){title=title.replace(new RegExp("(".concat(key,")"),"gi"),"<".concat(highlightTag,">$1</").concat(highlightTag,">"));context=context.replace(new RegExp("(".concat(key,")"),"gi"),"<".concat(highlightTag,">$1</").concat(highlightTag,">"))});results[uri]={uri:uri,title:title,date:matchData.date,context:context}});return Object.values(results).slice(0,maxResultLength)};if(!_this5._index){fetch(searchConfig.lunrIndexURL).then(function(response){return response.json()}).then(function(data){var indexData={};_this5._index=lunr(function(){var _this6=this;if(searchConfig.lunrLanguageCode)this.use(lunr[searchConfig.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"];data.forEach(function(record){indexData[record.objectID]=record;_this6.add(record)})});_this5._indexData=indexData;finish(search())}).catch(function(err){console.error(err);finish([])})}else finish(search())}else if(searchConfig.type==="algolia"){_this5._algoliaIndex=_this5._algoliaIndex||algoliasearch(searchConfig.algoliaAppID,searchConfig.algoliaSearchKey).initIndex(searchConfig.algoliaIndex);_this5._algoliaIndex.search(query,{offset:0,length:maxResultLength*8,attributesToHighlight:["title"],attributesToSnippet:["content:".concat(snippetLength)],highlightPreTag:"<".concat(highlightTag,">"),highlightPostTag:"</".concat(highlightTag,">")}).then(function(_ref3){var hits=_ref3.hits;var results={};hits.forEach(function(_ref4){var uri=_ref4.uri,date=_ref4.date,title=_ref4._highlightResult.title,content=_ref4._snippetResult.content;if(results[uri]&&results[uri].context.length>content.value){return}results[uri]={uri:uri,title:title.value,date:date,context:content.value}});finish(Object.values(results).slice(0,maxResultLength))}).catch(function(err){console.error(err);finish([])})}else if(searchConfig.type==="fuse"){var _search=function _search(){var results={};window._index.search(query).forEach(function(_ref5){var item=_ref5.item,refIndex=_ref5.refIndex,matches=_ref5.matches;var title=item.title;var content=item.content;matches.forEach(function(_ref6){var indices=_ref6.indices,value=_ref6.value,key=_ref6.key;if(key==="content"){var offset=0;for(var i=0;i<indices.length;i++){var substr=content.substring(indices[i][0]+offset,indices[i][1]+1+offset);var tag="<".concat(highlightTag,">")+substr+"</".concat(highlightTag,">");content=content.substring(0,indices[i][0]+offset)+tag+content.substring(indices[i][1]+1+offset,content.length);offset+=highlightTag.length*2+5}}else if(key==="title"){var _offset=0;for(var _i=0;_i<indices.length;_i++){var _substr=title.substring(indices[_i][0]+_offset,indices[_i][1]+1+_offset);var _tag="<".concat(highlightTag,">")+_substr+"</".concat(highlightTag,">");title=title.substring(0,indices[_i][0]+_offset)+_tag+title.substring(indices[_i][1]+1+_offset,content.length);_offset+=highlightTag.length*2+5}}});results[item.uri]={uri:item.uri,title:title,date:item.date,context:content}});return Object.values(results).slice(0,maxResultLength)};if(!window._index){fetch(searchConfig.fuseIndexURL).then(function(response){return response.json()}).then(function(data){var options={isCaseSensitive:isCaseSensitive,findAllMatches:findAllMatches,minMatchCharLength:minMatchCharLength,location:location,threshold:threshold,distance:distance,ignoreLocation:ignoreLocation,useExtendedSearch:useExtendedSearch,ignoreFieldNorm:ignoreFieldNorm,includeScore:false,shouldSort:true,includeMatches:true,keys:["content","title"]};window._index=new Fuse(data,options);finish(_search())}).catch(function(err){console.error(err);finish([])})}else finish(_search())}},templates:{suggestion:function suggestion(_ref7){var title=_ref7.title,date=_ref7.date,context=_ref7.context;return"<div><span class=\"suggestion-title\">".concat(title,"</span><span class=\"suggestion-date\">").concat(date,"</span></div><div class=\"suggestion-context\">").concat(context,"</div>")},empty:function empty(_ref8){var query=_ref8.query;return"<div class=\"search-empty\">".concat(searchConfig.noResultsFound,": <span class=\"search-query\">\"").concat(query,"\"</span></div>")},footer:function footer(_ref9){_objectDestructuringEmpty(_ref9);var _ref10=searchConfig.type==="algolia"?{searchType:"algolia",icon:"<i class=\"fa-brands fa-algolia fa-fw\" aria-hidden=\"true\"></i>",href:"https://www.algolia.com/"}:searchConfig.type==="lunr"?{searchType:"Lunr.js",icon:"",href:"https://lunrjs.com/"}:{searchType:"Fuse.js",icon:"",href:"https://fusejs.io/"},searchType=_ref10.searchType,icon=_ref10.icon,href=_ref10.href;return"<div class=\"search-footer\">Search by <a href=\"".concat(href,"\" rel=\"noopener noreferrer\" target=\"_blank\">").concat(icon," ").concat(searchType,"</a></div>")}}});autosearch.on("autocomplete:selected",function(_event,suggestion,_dataset,_context){window.location.assign(suggestion.uri)});if(isMobile){_this5._searchMobile=autosearch}else{_this5._searchDesktop=autosearch}};if(searchConfig.lunrSegmentitURL&&!document.getElementById("lunr-segmentit")){var script=document.createElement("script");script.id="lunr-segmentit";script.src=searchConfig.lunrSegmentitURL;script.async=true;if(script.readyState){script.onreadystatechange=function(){if(script.readyState=="loaded"||script.readyState=="complete"){script.onreadystatechange=null;initAutosearch()}}}else{script.onload=function(){initAutosearch()}}document.body.appendChild(script)}else{initAutosearch()}}},{key:"initDetails",value:function initDetails(){this.util.forEach(document.getElementsByClassName("details"),function($details){var $summary=$details.querySelector(".details-summary");$summary.addEventListener("click",function(){$details.classList.toggle("open")},false)})}},{key:"initLightGallery",value:function initLightGallery(){if(this.config.lightgallery){lightGallery(document.getElementById("content"),{plugins:[lgThumbnail,lgZoom],selector:".lightgallery",speed:400,hideBarsDelay:2000,allowMediaOverlap:true,exThumbImage:"data-thumbnail",toggleThumb:true,thumbWidth:80,thumbHeight:"60px",actualSize:false,showZoomInOutIcons:true,licenseKey:"none"})}}},{key:"initHighlight",value:function initHighlight(){var _this7=this;this.util.forEach(document.querySelectorAll(".highlight > pre.chroma"),function($preChroma){var $chroma=document.createElement("div");$chroma.className=$preChroma.className;var $table=document.createElement("table");$chroma.appendChild($table);var $tbody=document.createElement("tbody");$table.appendChild($tbody);var $tr=document.createElement("tr");$tbody.appendChild($tr);var $td=document.createElement("td");$tr.appendChild($td);$preChroma.parentElement.replaceChild($chroma,$preChroma);$td.appendChild($preChroma)});this.util.forEach(document.querySelectorAll(".highlight > .chroma"),function($chroma){var $codeElements=$chroma.querySelectorAll("pre.chroma > code");if($codeElements.length){var _hlAttrs$title;var $code=$codeElements[$codeElements.length-1];var $header=document.createElement("div");$header.className="code-header "+$code.className.toLowerCase();var $title=document.createElement("span");$title.classList.add("code-title");var hlAttrs=_this7.data[$chroma.parentNode.id];$title.insertAdjacentHTML("afterbegin","<i class=\"arrow fa-solid fa-chevron-right fa-fw\" aria-hidden=\"true\"></i><span class=\"title-inner\">".concat((_hlAttrs$title=hlAttrs===null||hlAttrs===void 0?void 0:hlAttrs.title)!==null&&_hlAttrs$title!==void 0?_hlAttrs$title:"","</span>"));$title.addEventListener("click",function(){$chroma.classList.toggle("open")},false);$header.appendChild($title);var $ellipses=document.createElement("span");$ellipses.insertAdjacentHTML("afterbegin","<i class=\"fa-solid fa-ellipsis-h fa-fw\" aria-hidden=\"true\"></i>");$ellipses.classList.add("ellipses");$ellipses.addEventListener("click",function(){$chroma.classList.add("open")},false);$header.appendChild($ellipses);if(_this7.config.code.editable){var $edit=document.createElement("span");$edit.classList.add("edit");$edit.insertAdjacentHTML("afterbegin","<i class=\"fa-solid fa-key fa-fw\" title=\"".concat(_this7.config.code.editUnLockTitle,"\" aria-hidden=\"true\"></i>"));$edit.addEventListener("click",function(){var $iconKey=$edit.querySelector(".fa-key");var $iconLock=$edit.querySelector(".fa-lock");var $preChromas=$edit.parentElement.parentElement.querySelectorAll("pre.chroma");var $preChroma=$preChromas.length===2?$preChromas[1]:$preChromas[0];if($iconKey){$iconKey.classList.add("fa-lock");$iconKey.classList.remove("fa-key");$iconKey.title=_this7.config.code.editLockTitle;$preChroma.setAttribute("contenteditable",true);$preChroma.focus()}else{$iconLock.classList.add("fa-key");$iconLock.classList.remove("fa-lock");$iconLock.title=_this7.config.code.editUnLockTitle;$preChroma.setAttribute("contenteditable",false);$preChroma.blur()}},false);$header.appendChild($edit)}if(_this7.config.code.copyTitle){var $copy=document.createElement("span");$copy.insertAdjacentHTML("afterbegin","<i class=\"fa-regular fa-copy fa-fw\" aria-hidden=\"true\"></i>");$copy.classList.add("copy");var code=$code.innerText.trim();if(_this7.config.code.maxShownLines<0||code.split("\n").length<_this7.config.code.maxShownLines+2){$chroma.classList.add("open")}$copy.title=_this7.config.code.copyTitle;$copy.addEventListener("click",function(){navigator.clipboard.writeText(code).then(function(){_this7.util.animateCSS($code,"animate__flash")},function(){console.error("Clipboard write failed!","Your browser does not support clipboard API!")})},false);$header.appendChild($copy)}$chroma.insertBefore($header,$chroma.firstChild)}})}},{key:"initTable",value:function initTable(){this.util.forEach(document.querySelectorAll(".content table"),function($table){var $wrapper=document.createElement("div");$wrapper.className="table-wrapper";$table.parentElement.replaceChild($wrapper,$table);$wrapper.appendChild($table)})}},{key:"initHeaderLink",value:function initHeaderLink(){for(var num=1;num<=6;num++){this.util.forEach(document.querySelectorAll(".single .content > h"+num),function($header){$header.classList.add("header-link");$header.insertAdjacentHTML("afterbegin","<a href=\"#".concat($header.id,"\" class=\"header-mark\"></a>"))})}}},{key:"initToc",value:function initToc(){var _this8=this;var $tocCore=document.getElementById("TableOfContents");if($tocCore===null){return}if(typeof APlayer==="function"){var $newTocCore=$tocCore.cloneNode(true);$tocCore.parentElement.replaceChild($newTocCore,$tocCore);$tocCore=$newTocCore}if(document.getElementById("toc-static").dataset.kept===true||this.util.isTocStatic()){var $tocContentStatic=document.getElementById("toc-content-static");if($tocCore.parentElement!==$tocContentStatic){$tocCore.parentElement.removeChild($tocCore);$tocContentStatic.appendChild($tocCore)}this._tocOnScroll&&this.scrollEventSet.delete(this._tocOnScroll)}else{var $tocContentAuto=document.getElementById("toc-content-auto");if($tocCore.parentElement!==$tocContentAuto){$tocCore.parentElement.removeChild($tocCore);$tocContentAuto.appendChild($tocCore)}var $toc=document.getElementById("toc-auto");$toc.style.visibility="visible";this.util.animateCSS($toc,["animate__fadeIn","animate__faster"],true);var $postMeta=document.querySelector(".post-meta");$toc.style.marginTop="".concat($postMeta.offsetTop+$postMeta.clientHeight,"px");var $tocLinkElements=$tocCore.querySelectorAll("a:first-child");var $tocLiElements=$tocCore.getElementsByTagName("li");var $headerLinkElements=document.getElementsByClassName("header-link");var headerIsFixed=document.body.dataset.headerDesktop!=="normal";var headerHeight=document.getElementById("header-desktop").offsetHeight;document.querySelector(".container").addEventListener("resize",function(){$toc.style.marginBottom="".concat(document.querySelector(".container").clientHeight-document.querySelector(".post-footer").offsetTop,"px")});this._tocOnScroll=this._tocOnScroll||function(){$toc.style.marginBottom="".concat(document.querySelector(".container").clientHeight-document.querySelector(".post-footer").offsetTop,"px");_this8.util.forEach($tocLinkElements,function($tocLink){$tocLink.classList.remove("active")});_this8.util.forEach($tocLiElements,function($tocLi){$tocLi.classList.remove("has-active")});var INDEX_SPACING=20+(headerIsFixed?headerHeight:0);var activeTocIndex=$headerLinkElements.length-1;for(var i=0;i<$headerLinkElements.length-1;i++){var thisTop=$headerLinkElements[i].getBoundingClientRect().top;var nextTop=$headerLinkElements[i+1].getBoundingClientRect().top;if(i==0&&thisTop>INDEX_SPACING||thisTop<=INDEX_SPACING&&nextTop>INDEX_SPACING){activeTocIndex=i;break}}if(activeTocIndex!==-1){$tocLinkElements[activeTocIndex].classList.add("active");var $parent=$tocLinkElements[activeTocIndex].parentElement;while($parent!==$tocCore){$parent.classList.add("has-active");$parent=$parent.parentElement.parentElement}}};this._tocOnScroll();this.scrollEventSet.add(this._tocOnScroll)}}},{key:"initTocListener",value:function initTocListener(){var _document$querySelect2,_this9=this;var $toc=document.getElementById("toc-auto");var $tocContentAuto=document.getElementById("toc-content-auto");(_document$querySelect2=document.querySelector("#toc-auto>.toc-title"))===null||_document$querySelect2===void 0?void 0:_document$querySelect2.addEventListener("click",function(){var animation=["animate__faster"];var tocHidden=$toc.classList.contains("toc-hidden");animation.push(tocHidden?"animate__fadeIn":"animate__fadeOut");$tocContentAuto.classList.remove(tocHidden?"animate__fadeOut":"animate__fadeIn");_this9.util.animateCSS($tocContentAuto,animation,true);$toc.classList.toggle("toc-hidden")},false)}},{key:"initMath",value:function initMath(){if(this.config.math){renderMathInElement(document.body,this.config.math)}}},{key:"switchMermaidTheme",value:function switchMermaidTheme(theme){var _this10=this;var $mermaidElements=document.getElementsByClassName("mermaid");if($mermaidElements.length){var _this$config$mermaid$;var themes=(_this$config$mermaid$=this.config.mermaid.themes)!==null&&_this$config$mermaid$!==void 0?_this$config$mermaid$:["default","dark","neutral"];mermaid.initialize({startOnLoad:false,theme:theme!==null&&theme!==void 0?theme:this.isDark?themes[1]:themes[0],securityLevel:"loose"});this.util.forEach($mermaidElements,function($mermaid){mermaid.render("svg-"+$mermaid.id,_this10.data[$mermaid.id],function(svgCode){$mermaid.innerHTML=svgCode},$mermaid)})}}},{key:"initMermaid",value:function initMermaid(){var _this11=this;this.switchMermaidTheme();this.switchThemeEventSet.add(function(){_this11.switchMermaidTheme()});this.beforeprintEventSet.add(function(){_this11.switchMermaidTheme("neutral")})}},{key:"initEcharts",value:function initEcharts(){var _this12=this;if(!this.config.echarts){return}echarts.registerTheme("light",this.config.echarts.lightTheme);echarts.registerTheme("dark",this.config.echarts.darkTheme);this._echartsOnSwitchTheme=this._echartsOnSwitchTheme||function(){_this12._echartsArr=_this12._echartsArr||[];for(var i=0;i<_this12._echartsArr.length;i++){_this12._echartsArr[i].dispose()}_this12._echartsArr=[];_this12.util.forEach(document.getElementsByClassName("echarts"),function($echarts){var chart=echarts.init($echarts,_this12.isDark?"dark":"light",{renderer:"svg"});chart.setOption(JSON.parse(_this12.data[$echarts.id]));_this12._echartsArr.push(chart)})};this.switchThemeEventSet.add(this._echartsOnSwitchTheme);this._echartsOnSwitchTheme();this._echartsOnResize=this._echartsOnResize||function(){for(var i=0;i<_this12._echartsArr.length;i++){_this12._echartsArr[i].resize()}};this.resizeEventSet.add(this._echartsOnResize)}},{key:"initMapbox",value:function initMapbox(){var _this13=this;if(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($mapbox){var _this13$data$$mapbox$=_this13.data[$mapbox.id],lng=_this13$data$$mapbox$.lng,lat=_this13$data$$mapbox$.lat,zoom=_this13$data$$mapbox$.zoom,lightStyle=_this13$data$$mapbox$.lightStyle,darkStyle=_this13$data$$mapbox$.darkStyle,marked=_this13$data$$mapbox$.marked,navigation=_this13$data$$mapbox$.navigation,geolocate=_this13$data$$mapbox$.geolocate,scale=_this13$data$$mapbox$.scale,fullscreen=_this13$data$$mapbox$.fullscreen;var mapbox=new mapboxgl.Map({container:$mapbox,center:[lng,lat],zoom:zoom,minZoom:0.2,style:_this13.isDark?darkStyle:lightStyle,attributionControl:false});if(marked){new mapboxgl.Marker().setLngLat([lng,lat]).addTo(mapbox)}if(navigation){mapbox.addControl(new mapboxgl.NavigationControl,"bottom-right")}if(geolocate){mapbox.addControl(new mapboxgl.GeolocateControl({positionOptions:{enableHighAccuracy:true},showUserLocation:true,trackUserLocation:true}),"bottom-right")}if(scale){mapbox.addControl(new mapboxgl.ScaleControl)}if(fullscreen){mapbox.addControl(new mapboxgl.FullscreenControl)}mapbox.addControl(new MapboxLanguage);_this13._mapboxArr.push(mapbox)});this._mapboxOnSwitchTheme=this._mapboxOnSwitchTheme||function(){_this13.util.forEach(_this13._mapboxArr,function(mapbox){var $mapbox=mapbox.getContainer();var _this13$data$$mapbox$2=_this13.data[$mapbox.id],lightStyle=_this13$data$$mapbox$2.lightStyle,darkStyle=_this13$data$$mapbox$2.darkStyle;mapbox.setStyle(_this13.isDark?darkStyle:lightStyle);mapbox.addControl(new MapboxLanguage)})};this.switchThemeEventSet.add(this._mapboxOnSwitchTheme)}}},{key:"initTypeit",value:function initTypeit(){var _this14=this;if(this.config.typeit){var _typeitConfig$loop;var typeitConfig=this.config.typeit;var speed=typeitConfig.speed||100;var cursorSpeed=typeitConfig.cursorSpeed||1000;var cursorChar=typeitConfig.cursorChar||"|";var loop=(_typeitConfig$loop=typeitConfig.loop)!==null&&_typeitConfig$loop!==void 0?_typeitConfig$loop:false;Object.values(typeitConfig.data).forEach(function(group){var typeone=function typeone(i){var id=group[i];var shortcodeLoop=document.querySelector("#".concat(id)).parentElement.dataset.loop;var instance=new TypeIt("#".concat(id),{strings:_this14.data[id],speed:speed,lifeLike:true,cursorSpeed:cursorSpeed,cursorChar:cursorChar,waitUntilVisible:true,loop:shortcodeLoop?JSON.parse(shortcodeLoop):loop,afterComplete:function afterComplete(){if(i===group.length-1){if(typeitConfig.duration>=0){window.setTimeout(function(){instance.destroy()},typeitConfig.duration)}return}instance.destroy();typeone(i+1)}}).go()};typeone(0)})}}},{key:"initCommentLightGallery",value:function initCommentLightGallery(comments,images){document.querySelectorAll(comments).forEach(function($content){var $imgs=$content.querySelectorAll(images+":not([lightgallery-loaded])");$imgs.forEach(function($img){$img.setAttribute("lightgallery-loaded","");var $link=document.createElement("a");$link.setAttribute("class","comment-lightgallery");$link.setAttribute("href",$img.src);$link.append($img.cloneNode());$img.replaceWith($link)});if($imgs.length){lightGallery($content,{selector:".comment-lightgallery",actualSize:false,hideBarsDelay:2000,speed:400})}})}},{key:"initComment",value:function initComment(){var _this$config$comment,_this15=this;if(!((_this$config$comment=this.config.comment)!==null&&_this$config$comment!==void 0&&_this$config$comment.enable)){return}if(document.querySelector("#comments")){var $viewCommentsBtn=document.querySelector(".view-comments");$viewCommentsBtn.classList.remove("d-none");$viewCommentsBtn.addEventListener("click",function(){_this15.util.scrollIntoView("#comments")},false)}this.config.comment.expired&&document.querySelector("#comments").remove();if(this.config.comment.artalk){if(this.config.comment.expired){return Artalk.LoadCountWidget({server:this.config.comment.artalk.server,site:this.config.comment.artalk.site,pvEl:this.config.comment.artalk.pvEl,countEl:this.config.comment.artalk.countEl})}var artalk=Artalk.init(this.config.comment.artalk);artalk.setDarkMode(this.isDark);this.switchThemeEventSet.add(function(){artalk.setDarkMode(_this15.isDark)});artalk.on("comments-loaded",function(){_this15.config.comment.artalk.lightgallery&&_this15.initCommentLightGallery(".atk-comment .atk-content","img:not([atk-emoticon])")});return artalk}if(this.config.comment.gitalk){this.config.comment.gitalk.body=decodeURI(window.location.href);var gitalk=new Gitalk(this.config.comment.gitalk);gitalk.render("gitalk");return gitalk}if(this.config.comment.valine){return new Valine(this.config.comment.valine)}if(this.config.comment.waline){if(this.config.comment.expired){this.config.comment.waline.pageview&&Waline.pageviewCount({serverURL:this.config.comment.waline.serverURL,path:window.location.pathname});return}return Waline.init(this.config.comment.waline)}if(this.config.comment.utterances){var utterancesConfig=this.config.comment.utterances;var script=document.createElement("script");script.src="https://utteranc.es/client.js";script.setAttribute("repo",utterancesConfig.repo);script.setAttribute("issue-term",utterancesConfig.issueTerm);if(utterancesConfig.label)script.setAttribute("label",utterancesConfig.label);script.setAttribute("theme",this.isDark?utterancesConfig.darkTheme:utterancesConfig.lightTheme);script.crossOrigin="anonymous";script.async=true;document.getElementById("utterances").appendChild(script);this._utterancesOnSwitchTheme=this._utterancesOnSwitchTheme||function(){var _document$querySelect3;var message={type:"set-theme",theme:_this15.isDark?utterancesConfig.darkTheme:utterancesConfig.lightTheme};(_document$querySelect3=document.querySelector(".utterances-frame"))===null||_document$querySelect3===void 0?void 0:_document$querySelect3.contentWindow.postMessage(message,"https://utteranc.es")};this.switchThemeEventSet.add(this._utterancesOnSwitchTheme);return}if(this.config.comment.twikoo){var twikooConfig=this.config.comment.twikoo;if(twikooConfig.lightgallery){twikooConfig.onCommentLoaded=function(){_this15.initCommentLightGallery(".tk-comments .tk-content","img:not(.tk-owo-emotion)")}}twikoo.init(twikooConfig);if(twikooConfig.commentCount){twikoo.getCommentsCount({envId:twikooConfig.envId,region:twikooConfig.region,urls:[window.location.pathname],includeReply:false}).then(function(response){var twikooCommentCount=document.getElementById("twikoo-comment-count");if(twikooCommentCount)twikooCommentCount.innerHTML=response[0].count})}return}if(this.config.comment.giscus){var giscusConfig=this.config.comment.giscus;this._giscusOnSwitchTheme=this._giscusOnSwitchTheme||function(){var _document$querySelect4;var message={setConfig:{theme:_this15.isDark?giscusConfig.darkTheme:giscusConfig.lightTheme}};(_document$querySelect4=document.querySelector(".giscus-frame"))===null||_document$querySelect4===void 0?void 0:_document$querySelect4.contentWindow.postMessage({giscus:message},"https://giscus.app")};this.switchThemeEventSet.add(this._giscusOnSwitchTheme);this.giscus2parentMsg=window.addEventListener("message",function(event){var $script=document.querySelector("#giscus>script");if($script){_this15._giscusOnSwitchTheme();$script.parentElement.removeChild($script)}},{once:true});return}}},{key:"initCookieconsent",value:function initCookieconsent(){this.config.cookieconsent&&cookieconsent.initialise(this.config.cookieconsent)}},{key:"initSiteTime",value:function initSiteTime(){var _this16=this;if(this.config.siteTime){this.siteTime=setInterval(this.getSiteTime,500);document.addEventListener("visibilitychange",function(){if(document.hidden){return clearInterval(_this16.siteTime)}_this16.siteTime=setInterval(_this16.getSiteTime,500)},false)}}},{key:"initServiceWorker",value:function initServiceWorker(){if(this.config.enablePWA&&"serviceWorker"in navigator){navigator.serviceWorker.register("/service-worker.min.js",{scope:"/"}).then(function(registration){}).catch(function(error){console.error("error: ",error)});navigator.serviceWorker.ready.then(function(registration){})}}},{key:"initWatermark",value:function initWatermark(){var _this$config$watermar,_document$querySelect5,_document$querySelect6;((_this$config$watermar=this.config.watermark)===null||_this$config$watermar===void 0?void 0:_this$config$watermar.enable)&&new Watermark({content:this.config.watermark.content||"".concat((_document$querySelect5=(_document$querySelect6=document.querySelector("footer .fixit-icon"))===null||_document$querySelect6===void 0?void 0:_document$querySelect6.outerHTML)!==null&&_document$querySelect5!==void 0?_document$querySelect5:""," FixIt Theme"),appendTo:this.config.watermark.appendto||".wrapper>main",opacity:this.config.watermark.opacity,width:this.config.watermark.width,height:this.config.watermark.height,rowSpacing:this.config.watermark.rowspacing,colSpacing:this.config.watermark.colspacing,rotate:this.config.watermark.rotate,fontSize:this.config.watermark.fontsize,fontFamily:this.config.watermark.fontfamily})}},{key:"initPangu",value:function initPangu(){var _this$config$pangu;if(!((_this$config$pangu=this.config.pangu)!==null&&_this$config$pangu!==void 0&&_this$config$pangu.enable)){return}var selector=this.config.pangu.selector;if(selector){if(selector.startsWith("#")){pangu.spacingElementById(selector.slice(1))}else if(selector.startsWith(".")){pangu.spacingElementByClassName(selector.slice(1))}else{pangu.spacingElementByTagName(selector)}return}pangu.autoSpacingPage()}},{key:"initFixItDecryptor",value:function initFixItDecryptor(){var _this17=this,_this$config$encrypti,_this$config$encrypti2;var $tocNodes=document.querySelectorAll("#toc-auto>.d-none, #toc-static.d-none");this.decryptor=new FixItDecryptor({decrypted:function decrypted(){_this17.initTwemoji();_this17.initDetails();_this17.initLightGallery();_this17.initHighlight();_this17.initTable();_this17.initHeaderLink();_this17.initMath();_this17.initMermaid();_this17.initEcharts();_this17.initTypeit();_this17.initMapbox();_this17.util.forEach($tocNodes,function($element){$element.classList.remove("d-none")});_this17.initToc();_this17.initTocListener();_this17.initPangu()},reset:function reset(){_this17.util.forEach($tocNodes,function($element){$element.classList.add("d-none")})}});if((_this$config$encrypti=this.config.encryption)!==null&&_this$config$encrypti!==void 0&&_this$config$encrypti.shortcode){this.decryptor.addEventListener("decrypted",function(){_this17.decryptor.initShortcodes()});this.decryptor.initShortcodes()}((_this$config$encrypti2=this.config.encryption)===null||_this$config$encrypti2===void 0?void 0:_this$config$encrypti2.all)&&this.decryptor.init()}},{key:"initMDevtools",value:function initMDevtools(){var _this$config,_this18=this;var type=(_this$config=this.config)===null||_this$config===void 0?void 0:_this$config.mDevtools;if(typeof window.orientation==="undefined"){return}if(type==="vConsole"){var vConsole=new VConsole({target:".widgets",theme:this.isDark?"dark":"light"});this._vConsoleOnSwitchTheme=this._vConsoleOnSwitchTheme||function(){vConsole.setOption("theme",_this18.isDark?"dark":"light")};this.switchThemeEventSet.add(this._vConsoleOnSwitchTheme)}if(type==="eruda"){eruda.init({defaults:{theme:this.isDark?"Dark":"Light"}});this._erudaOnSwitchTheme=this._erudaOnSwitchTheme||function(){eruda.util.evalCss.setTheme(_this18.isDark?"Dark":"Light")};this.switchThemeEventSet.add(this._erudaOnSwitchTheme)}}},{key:"initAutoMark",value:function initAutoMark(){var _this19=this,_window$localStorage3;if(!this.config.autoBookmark){return}window.addEventListener("beforeunload",function(){var _window$localStorage2;(_window$localStorage2=window.localStorage)===null||_window$localStorage2===void 0?void 0:_window$localStorage2.setItem("fixit-bookmark/#".concat(location.pathname),_this19.util.getScrollTop())});var scrollTop=Number((_window$localStorage3=window.localStorage)===null||_window$localStorage3===void 0?void 0:_window$localStorage3.getItem("fixit-bookmark/#".concat(location.pathname)));if(scrollTop&&location.hash===""){window.scrollTo({top:scrollTop,behavior:"smooth"})}}},{key:"initReward",value:function initReward(){var _this20=this;var $rewards=document.querySelectorAll(".post-reward [data-mode=\"fixed\"]");if(!$rewards.length){return}if(this.util.isMobile()){this.util.forEach($rewards,function($reward){$reward.removeAttribute("data-mode")});return}var _closeRewardExclude=function _closeRewardExclude(id){_this20.util.forEach($rewards,function($reward){var $rewardInput=$reward.parentElement.querySelector(".reward-input");if($rewardInput.id!==id){$rewardInput.checked=false}})};this.util.forEach($rewards,function($reward){$reward.previousElementSibling.addEventListener("click",function(){_closeRewardExclude(this.getAttribute("for"))},false)});this.scrollEventSet.add(_closeRewardExclude)}},{key:"onScroll",value:function onScroll(){var _this21=this;var $headers=[];var ACCURACY=20;var $fixedButtons=document.querySelector(".fixed-buttons");var $backToTop=document.querySelector(".back-to-top");var $readingProgressBar=document.querySelector(".reading-progress-bar");var scrollTimer=void 0;if(document.body.dataset.headerDesktop==="auto"){$headers.push(document.getElementById("header-desktop"))}if(document.body.dataset.headerMobile==="auto"){$headers.push(document.getElementById("header-mobile"))}$backToTop===null||$backToTop===void 0?void 0:$backToTop.addEventListener("click",function(){_this21.util.scrollIntoView("body")});window.addEventListener("scroll",function(event){if(_this21.disableScrollEvent){event.preventDefault();return}var $mask=document.getElementById("mask");_this21.newScrollTop=_this21.util.getScrollTop();var scroll=_this21.newScrollTop-_this21.oldScrollTop;document.body.toggleAttribute("data-scroll",true);scrollTimer&&window.clearTimeout(scrollTimer);scrollTimer=window.setTimeout(function(){document.body.toggleAttribute("data-scroll")},500);_this21.util.forEach($headers,function($header){if(scroll>ACCURACY){$header.classList.remove("animate__fadeInDown");_this21.util.animateCSS($header,["animate__fadeOutUp"],true);$mask.click()}else if(scroll<-ACCURACY){$header.classList.remove("animate__fadeOutUp");_this21.util.animateCSS($header,["animate__fadeInDown"],true);$mask.click()}});var contentHeight=document.body.scrollHeight-window.innerHeight;var scrollPercent=Math.max(Math.min(100*Math.max(_this21.newScrollTop,0)/contentHeight,100),0);if($readingProgressBar){$readingProgressBar.style.setProperty("--progress","".concat(scrollPercent.toFixed(2),"%"))}if($fixedButtons){if(scrollPercent>1){$fixedButtons.classList.remove("d-none","animate__fadeOut");_this21.util.animateCSS($fixedButtons,["animate__fadeIn"],true)}else{$fixedButtons.classList.remove("animate__fadeIn");_this21.util.animateCSS($fixedButtons,["animate__fadeOut"],true,function(){$fixedButtons.classList.contains("animate__fadeOut")&&$fixedButtons.classList.add("d-none")})}if($backToTop){$backToTop.querySelector("span").innerText="".concat(Math.round(scrollPercent),"%")}}var _iterator2=_createForOfIteratorHelper(_this21.scrollEventSet),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var _event2=_step2.value;_event2()}}catch(err){_iterator2.e(err)}finally{_iterator2.f()}_this21.oldScrollTop=_this21.newScrollTop},false)}},{key:"onResize",value:function onResize(){var _this22=this;var resizeBefore=this.util.isMobile();window.addEventListener("resize",function(){if(!_this22._resizeTimeout){_this22._resizeTimeout=window.setTimeout(function(){_this22._resizeTimeout=null;var _iterator3=_createForOfIteratorHelper(_this22.resizeEventSet),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var event=_step3.value;event()}}catch(err){_iterator3.e(err)}finally{_iterator3.f()}_this22.initToc();_this22.switchMermaidTheme();_this22.initSearch();var isMobile=_this22.util.isMobile();if(isMobile!==resizeBefore){document.getElementById("mask").click();resizeBefore=isMobile}},100)}},false)}},{key:"onClickMask",value:function onClickMask(){var _this23=this;document.getElementById("mask").addEventListener("click",function(){if(!document.body.classList.contains("blur")){return}var _iterator4=_createForOfIteratorHelper(_this23.clickMaskEventSet),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var event=_step4.value;event()}}catch(err){_iterator4.e(err)}finally{_iterator4.f()}_this23.disableScrollEvent=false;document.body.classList.remove("blur")},false)}},{key:"beforeprint",value:function beforeprint(){var _this24=this;window.addEventListener("beforeprint",function(){_this24.util.forEach(document.querySelectorAll(".chroma"),function($el){$el.classList.toggle("open",true)});var _iterator5=_createForOfIteratorHelper(_this24.beforeprintEventSet),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var event=_step5.value;event()}}catch(err){_iterator5.e(err)}finally{_iterator5.f()}},false)}},{key:"init",value:function init(){var _this25=this;try{var _this$config$encrypti3;if(this.config.encryption){this.initFixItDecryptor()}else if(!((_this$config$encrypti3=this.config.encryption)!==null&&_this$config$encrypti3!==void 0&&_this$config$encrypti3.all)){this.initTwemoji();this.initDetails();this.initLightGallery();this.initHighlight();this.initTable();this.initHeaderLink();this.initMath();this.initMermaid();this.initEcharts();this.initTypeit();this.initMapbox();this.initPangu()}this.initThemeColor();this.initSVGIcon();this.initMenu();this.initSwitchTheme();this.initSearch();this.initCookieconsent();this.initSiteTime();this.initServiceWorker();this.initWatermark();this.initMDevtools();this.initAutoMark();this.initReward();window.setTimeout(function(){var _this25$config$encryp;_this25.initComment();if(!((_this25$config$encryp=_this25.config.encryption)!==null&&_this25$config$encryp!==void 0&&_this25$config$encryp.all)){_this25.initToc();_this25.initTocListener()}_this25.onScroll();_this25.onResize();_this25.onClickMask();_this25.beforeprint()},100)}catch(err){console.error(err)}}}]);return FixIt}();var themeInit=function themeInit(){window.fixit=new FixIt;window.fixit.init()};if(document.readyState!=="loading"){themeInit()}else{document.addEventListener("DOMContentLoaded",themeInit,false)}
//# sourceMappingURL=theme.min.js.map