UNPKG

@mhg/blog

Version:
3 lines (2 loc) 25.1 kB
"use strict";function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(e,t){var o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var n,i,a,r,l=[],s=!0,c=!1;try{if(a=(o=o.call(e)).next,0===t){if(Object(o)!==o)return;s=!1}else for(;!(s=(n=a.call(o)).done)&&(l.push(n.value),l.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=o["return"]&&(r=o["return"](),Object(r)!==r))return}finally{if(c)throw i}}return l}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _createForOfIteratorHelper(e,t){var o="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!o){if(Array.isArray(e)||(o=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){o&&(e=o);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 a,r=!0,l=!1;return{s:function(){o=o.call(e)},n:function(){var e=o.next();return r=e.done,e},e:function(e){l=!0,a=e},f:function(){try{r||null==o["return"]||o["return"]()}finally{if(l)throw a}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var o={}.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=Array(t);o<t;o++)n[o]=e[o];return n}function _defineProperty(e,t,o){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==_typeof(t)?t:t+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var n=o.call(e,t||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}document.addEventListener("DOMContentLoaded",(function(){volantis.requestAnimationFrame((function(){VolantisApp.init(),VolantisApp.subscribe(),VolantisFancyBox.init(),highlightKeyWords.startFromURL(),locationHash(),volantis.pjax.push((function(){VolantisApp.pjaxReload(),VolantisFancyBox.init(),sessionStorage.setItem("domTitle",document.title),highlightKeyWords.startFromURL()}),"app.js"),volantis.pjax.send((function(){volantis.dom.switcher.removeClass("active"),volantis.dom.header.removeClass("z_search-open"),volantis.dom.wrapper.removeClass("sub"),volantis.EventListener.remove()}),"app.js")}))}));var locationHash=function(){if(window.location.hash){var e=decodeURI(window.location.hash.split("#")[1]).replace(/\ /g,"-"),t=document.getElementById(e);e&&!t&&(e=decodeURIComponent(window.location.hash.split("#")[1]).replace(/\ /g,"-"),t=document.getElementById(e)),t&&setTimeout((function(){window.location.hash.startsWith("#fn")?volantis.scroll.to(t,{addTop:-volantis.dom.header.offsetHeight-5,behavior:"instant",observer:!0}):window.location.hash.startsWith("#mjx")?volantis.scroll.to(t,{addTop:-volantis.dom.header.offsetHeight-25,behavior:"instant",observer:!0}):volantis.scroll.to(t,{addTop:5,behavior:"instant",observer:!0})}),1e3)}};Object.freeze(locationHash);var VolantisApp=function(){var e={},t=80;e.init=function(){volantis.dom.header&&(t=volantis.dom.header.clientHeight+16),window.onresize=function(){document.documentElement.clientWidth<500?volantis.isMobile=1:volantis.isMobile=0,volantis.isMobile!=volantis.isMobileOld&&(e.setGlobalHeaderMenuEvent(),e.setHeader(),e.setHeaderSearch())},volantis.scroll.push(volantis.debounce(e.scrollEventCallBack),"scrollEventCallBack")},e.event=function(){var t;null===(t=volantis.dom.$(document.getElementById("scroll-down")))||void 0===t||t.on("click",(function(){e.scrolltoElement(volantis.dom.bodyAnchor)}));var o=document.querySelector("#l_side");o&&(o.querySelectorAll("section").length||document.querySelector("#l_main").classList.add("no_sidebar"));if(volantis.GLOBAL_CONFIG.sidebar.for_page.includes("webinfo")||volantis.GLOBAL_CONFIG.sidebar.for_post.includes("webinfo")){var n=volantis.GLOBAL_CONFIG.sidebar.webinfo.lastupd;document.getElementById("last-update-show")&&n.enable&&n.friendlyShow&&(document.getElementById("last-update-show").innerHTML=e.utilTimeAgo(volantis.GLOBAL_CONFIG.lastupdate))}if(document.getElementById("webinfo-runtime-count")){var i=new Date(volantis.GLOBAL_CONFIG.sidebar.webinfo.runtime.data),a=(new Date).getTime()-i.getTime(),r=Math.floor(a/864e5);document.getElementById("webinfo-runtime-count").innerHTML="".concat(r," ").concat(volantis.GLOBAL_CONFIG.sidebar.webinfo.runtime.unit)}document.body.oncopy=function(){e.messageCopyright()}},e.restData=function(){t=volantis.dom.header?volantis.dom.header.clientHeight+16:80},e.setIsMobile=function(){document.documentElement.clientWidth<500?(volantis.isMobile=1,volantis.isMobileOld=1):(volantis.isMobile=0,volantis.isMobileOld=0)},e.scrolltoElement=function(e){var o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;volantis.scroll.to(e,{top:e.getBoundingClientRect().top+document.documentElement.scrollTop-o})},e.scrollEventCallBack=function(){var e=volantis.dom.bodyAnchor.offsetTop-t,o=volantis.scroll.getScrollTop();volantis.dom.topBtn&&(o>volantis.dom.bodyAnchor.offsetTop?(volantis.dom.topBtn.addClass("show"),volantis.scroll.del>0?volantis.dom.topBtn.removeClass("hl"):volantis.dom.topBtn.addClass("hl")):volantis.dom.topBtn.removeClass("show").removeClass("hl")),volantis.dom.header&&(o-e>-1?volantis.dom.header.addClass("show"):volantis.dom.header.removeClass("show")),pdata.ispage&&volantis.dom.wrapper&&(volantis.scroll.del>0&&o>100?volantis.dom.wrapper.addClass("sub"):volantis.scroll.del<0&&volantis.dom.wrapper.removeClass("sub")),volantis.isMobile&&(pdata.ispage&&volantis.dom.tocTarget&&volantis.dom.toc&&(volantis.dom.tocTarget.removeClass("active"),volantis.dom.toc.removeClass("active")),volantis.dom.mPhoneList&&volantis.dom.mPhoneList.forEach((function(e){volantis.dom.$(e).hide()})))},e.setScrollAnchor=function(){volantis.dom.topBtn&&volantis.dom.bodyAnchor&&volantis.dom.topBtn.click((function(t){t.preventDefault(),t.stopPropagation(),e.scrolltoElement(volantis.dom.bodyAnchor),t.stopImmediatePropagation()}))},e.setHeader=function(){pdata.ispage&&(volantis.dom.wrapper.find(".nav-sub .title").html(document.title.split(" - ")[0]),volantis.dom.comment=volantis.dom.$(document.getElementById("s-comment")),volantis.dom.commentTarget=volantis.dom.$(document.querySelector("#l_main article#comments")),volantis.dom.commentTarget?volantis.dom.comment.click((function(t){t.preventDefault(),t.stopPropagation(),volantis.cleanContentVisibility(),e.scrolltoElement(volantis.dom.commentTarget),t.stopImmediatePropagation()})):volantis.dom.comment.style.display="none",volantis.isMobile&&(volantis.dom.toc=volantis.dom.$(document.getElementById("s-toc")),volantis.dom.tocTarget=volantis.dom.$(document.querySelector("#l_side .toc-wrapper")),volantis.dom.tocTarget?(volantis.dom.toc.click((function(e){e.stopPropagation(),volantis.dom.tocTarget.toggleClass("active"),volantis.dom.toc.toggleClass("active")})),volantis.dom.$(document).click((function(e){e.stopPropagation(),volantis.dom.tocTarget&&volantis.dom.tocTarget.removeClass("active"),volantis.dom.toc.removeClass("active")}))):volantis.dom.toc&&(volantis.dom.toc.style.display="none")))},e.setHeaderMenuSelection=function(){volantis.dom.headerMenu=volantis.dom.$(document.querySelectorAll("#l_header .navigation,#l_cover .navigation,#l_side .navigation")),volantis.dom.headerMenu.forEach((function(e){var t=volantis.dom.$(e).find("li a.active");t&&t.removeClass("active");var o=volantis.dom.$(e).find("div a.active");o&&o.removeClass("active")}));var e=location.pathname.replace(/\/|%|\./g,"");0==e.length&&(e="home");var t=e.match(/page\d{0,}$/g);t&&(t=t[0],e=e.split(t)[0]);var o=e.match(/index.html/);o&&(o=o[0],e=e.split(o)[0]),(e=e.replace(/(\[|\]|~|#|@)/g,"\\$1"))&&volantis.dom.headerMenu&&volantis.dom.headerMenu.forEach((function(t){var o=t.querySelector("[active-action=action-"+e+"]");o&&volantis.dom.$(o).addClass("active")}))},e.setGlobalHeaderMenuEvent=function(){volantis.isMobile?document.querySelectorAll("#l_header .m-phone li").forEach((function(e){e.querySelector(".list-v")&&volantis.dom.$(e).click((function(e){e.stopPropagation(),e.currentTarget.parentElement.childNodes.forEach((function(e){"[object HTMLLIElement]"==Object.prototype.toString.call(e)&&e.childNodes.forEach((function(e){"[object HTMLUListElement]"==Object.prototype.toString.call(e)&&volantis.dom.$(e).hide()}))}));for(var t=e.currentTarget.children,o=0;o<t.length;o++){var n=t[o];"menu"===volantis.dom.$(n).title?volantis.dom.$(n).display="flex":volantis.dom.$(n).show()}}),0)})):document.querySelectorAll("#wrapper .m-pc li > a[href]").forEach((function(e){volantis.dom.$(e.parentElement).click((function(e){e.stopPropagation(),e.target.origin==e.target.baseURI&&document.querySelectorAll("#wrapper .m-pc .list-v").forEach((function(e){volantis.dom.$(e).hide()}))}),0)})),e.setPageHeaderMenuEvent()},e.setPageHeaderMenuEvent=function(){volantis.isMobile&&volantis.dom.$(document).click((function(e){volantis.dom.mPhoneList.forEach((function(e){volantis.dom.$(e).hide()}))}))},e.setHeaderSearch=function(){volantis.isMobile&&volantis.dom.switcher&&(volantis.dom.switcher.click((function(e){e.stopPropagation(),volantis.dom.header.toggleClass("z_search-open"),volantis.dom.switcher.toggleClass("active")}),!1),volantis.dom.$(document).click((function(e){volantis.dom.header.removeClass("z_search-open"),volantis.dom.switcher.removeClass("active")}),!1),volantis.dom.search.click((function(e){e.stopPropagation()}),!1))},e.setTabs=function(){var e=document.querySelectorAll("#l_main .tabs .nav-tabs");e&&e.forEach((function(e){e.querySelectorAll("a").forEach((function(e){volantis.dom.$(e).on("click",(function(e){e.preventDefault(),e.stopPropagation();var t=volantis.dom.$(e.target.parentElement.parentElement.parentElement);return t.find(".nav-tabs .active").removeClass("active"),volantis.dom.$(e.target.parentElement).addClass("active"),t.find(".tab-content .active").removeClass("active"),t.find(e.target.className).addClass("active"),!1}))}))}))},e.mathjaxRef=function(){var e=document.querySelectorAll("mjx-container a[href]");e.forEach((function(t,o){e[o].click=function(){};var n=decodeURIComponent(e[o].getAttribute("href").split("#")[1]).replace(/\ /g,"-");volantis.dom.$(t).on("click",(function(e){e.stopPropagation(),e.preventDefault();var t=document.getElementById(n);t&&volantis.scroll.to(t,{addTop:-volantis.dom.header.offsetHeight-25,behavior:"instant"})}))}))},e.footnotes=function(){var e=document.querySelectorAll("#l_main .footnote-backref, #l_main .footnote-ref > a");e.forEach((function(t,o){e[o].click=function(){},volantis.dom.$(t).on("click",(function(e){e.stopPropagation(),e.preventDefault();var t=decodeURI(e.target.hash.split("#")[1]).replace(/\ /g,"-"),o=document.getElementById(t);o&&volantis.scroll.to(o,{addTop:-volantis.dom.header.offsetHeight-5,behavior:"instant"})}))}))},e.utilCopyCode=function(t){document.querySelectorAll(t).forEach((function(t){t.insertAdjacentHTML("beforebegin",'<button class="btn-copy" data-clipboard-snippet=""><i class="fa-solid fa-copy"></i><span>COPY</span></button>');var o=t.previousSibling;o.onclick=function(n){n.stopPropagation();var i=o.querySelector("i"),a=o.querySelector("span");t.focus();var r=new Range;r.selectNodeContents(t),document.getSelection().removeAllRanges(),document.getSelection().addRange(r);var l=document.getSelection().toString();e.utilWriteClipText(l).then((function(){e.messageCopyright(),o.classList.add("copied"),i.classList.remove("fa-copy"),i.classList.add("fa-check-circle"),a.innerText="COPIED",setTimeout((function(){i.classList.remove("fa-check-circle"),i.classList.add("fa-copy"),a.innerText="COPY"}),2e3)}))["catch"]((function(e){VolantisApp.message("系统提示",e,{icon:"fa fa-exclamation-circle red"}),o.classList.add("copied-failed"),i.classList.remove("fa-copy"),i.classList.add("fa-exclamation-circle"),a.innerText="COPY FAILED",setTimeout((function(){i.classList.remove("fa-exclamation-circle"),i.classList.add("fa-copy"),a.innerText="COPY"}))}))}}))},e.utilWriteClipText=function(e){return navigator.clipboard.writeText(e).then((function(){return Promise.resolve()}))["catch"]((function(t){var o=document.createElement("textarea");o.setAttribute("readonly","readonly"),document.body.appendChild(o),o.innerHTML=e,o.select();try{var n=document.execCommand("copy");return document.body.removeChild(o),n&&"unsuccessful"!==n?Promise.resolve():Promise.reject("复制文本失败!")}catch(t){return document.body.removeChild(o),Promise.reject("当前浏览器不支持复制功能,请检查更新或更换其他浏览器操作!")}}))},e.utilTimeAgo=function(e){var t=6e4,o=36e5,n=24*o,i=(new Date).getTime()-e,a=i/t,r=i/o,l=i/n,s=i/6048e5,c=i/2592e6;if(i<0)result="";else if(c>=1&&c<7)result=" "+parseInt(c)+" 月前";else if(s>=1&&s<4)result=" "+parseInt(s)+" 周前";else if(l>=1&&l<7)result=" "+parseInt(l)+" 天前";else if(r>=1&&r<24)result=" "+parseInt(r)+" 小时前";else if(a>=1&&a<60)result=" "+parseInt(a)+" 分钟前";else if(i>=0&&i<=t)result="刚刚";else{var d=new Date;d.setTime(e);var u=d.getFullYear(),m=d.getMonth()+1<10?"0"+(d.getMonth()+1):d.getMonth()+1,f=d.getDate()<10?"0"+d.getDate():d.getDate();d.getHours()<10?d.getHours():d.getHours(),d.getMinutes()<10?d.getMinutes():d.getMinutes(),d.getSeconds()<10?d.getSeconds():d.getSeconds();result=u+"-"+m+"-"+f}return result},e.message=function(e,t){var o=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{},n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null;function i(e,t,o,n){var i=o.icon,a=o.time,r=o.position,l=o.transitionIn,s=o.transitionOut,c=o.messageColor,d=o.titleColor,u=o.backgroundColor,m=o.zindex,f=o.displayMode;iziToast.show(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({layout:"2",icon:"Fontawesome",closeOnEscape:"true",displayMode:f||"replace",transitionIn:l||volantis.GLOBAL_CONFIG.plugins.message.transitionIn,transitionOut:s||volantis.GLOBAL_CONFIG.plugins.message.transitionOut,messageColor:c||volantis.GLOBAL_CONFIG.plugins.message.messageColor,titleColor:d||volantis.GLOBAL_CONFIG.plugins.message.titleColor,backgroundColor:u||volantis.GLOBAL_CONFIG.plugins.message.backgroundColor,zindex:m||volantis.GLOBAL_CONFIG.plugins.message.zindex},"icon",i||volantis.GLOBAL_CONFIG.plugins.message.icon["default"]),"timeout",a||volantis.GLOBAL_CONFIG.plugins.message.time["default"]),"position",r||volantis.GLOBAL_CONFIG.plugins.message.position),"title",e),"message",t),"onClosed",(function(){n&&n()})))}"undefined"==typeof iziToast?(volantis.css(volantis.GLOBAL_CONFIG.cdn.izitoast_css),volantis.js(volantis.GLOBAL_CONFIG.cdn.izitoast_js,(function(){i(e,t,o,n)}))):i(e,t,o,n)},e.question=function(e,t){var o=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{},n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:null,i=arguments.length>4&&arguments[4]!==undefined?arguments[4]:null,a=arguments.length>5&&arguments[5]!==undefined?arguments[5]:null;function r(e,t,o,n,i,a){var r=o.icon,l=o.time,s=(o.position,o.transitionIn,o.transitionOut),c=o.messageColor,d=o.titleColor,u=o.backgroundColor,m=o.zindex;iziToast.question(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({id:"question",icon:"Fontawesome",close:!1,overlay:!0,displayMode:"once",position:"center",messageColor:c||volantis.GLOBAL_CONFIG.plugins.message.messageColor,titleColor:d||volantis.GLOBAL_CONFIG.plugins.message.titleColor,backgroundColor:u||volantis.GLOBAL_CONFIG.plugins.message.backgroundColor,zindex:m||volantis.GLOBAL_CONFIG.plugins.message.zindex},"icon",r||volantis.GLOBAL_CONFIG.plugins.message.icon.quection),"timeout",l||volantis.GLOBAL_CONFIG.plugins.message.time.quection),"title",e),"message",t),"buttons",[["<button><b>是</b></button>",function(e,t){e.hide({transitionOut:s||"fadeOut"},t,"button"),n&&n(e,t)}],["<button><b>否</b></button>",function(e,t){e.hide({transitionOut:s||"fadeOut"},t,"button"),i&&i(e,t)}]]),"onClosed",(function(e,t,o){a&&a(e,t,o)})))}"undefined"==typeof iziToast?(volantis.css(volantis.GLOBAL_CONFIG.cdn.izitoast_css),volantis.js(volantis.GLOBAL_CONFIG.cdn.izitoast_js,(function(){r(e,t,o,n,i,a)}))):r(e,t,o,n,i,a)},e.hideMessage=function(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null,t=document.querySelector(".iziToast");function o(e){iziToast.hide({},t),e&&e()}t?"undefined"==typeof iziToast?(volantis.css(volantis.GLOBAL_CONFIG.cdn.izitoast_css),volantis.js(volantis.GLOBAL_CONFIG.cdn.izitoast_js,(function(){o(e)}))):o(e):e&&e()};var o=0;return e.messageCopyright=function(){volantis.GLOBAL_CONFIG.plugins.message.enable&&volantis.GLOBAL_CONFIG.plugins.message.copyright.enable&&o<1&&(o++,VolantisApp.message(volantis.GLOBAL_CONFIG.plugins.message.copyright.title,volantis.GLOBAL_CONFIG.plugins.message.copyright.message,{icon:volantis.GLOBAL_CONFIG.plugins.message.copyright.icon,transitionIn:"flipInX",transitionOut:"flipOutX",displayMode:1}))},{init:function(){e.init(),e.event()},subscribe:function(){e.setIsMobile(),e.setHeader(),e.setHeaderMenuSelection(),e.setGlobalHeaderMenuEvent(),e.setHeaderSearch(),e.setScrollAnchor(),e.setTabs(),e.footnotes(),e.mathjaxRef()},pjaxReload:function(){e.event(),e.restData(),e.setHeader(),e.setHeaderMenuSelection(),e.setPageHeaderMenuEvent(),e.setScrollAnchor(),e.setTabs(),e.footnotes(),e.mathjaxRef(),document.querySelector("#l_header .nav-main").querySelectorAll(".list-v:not(.menu-phone)").forEach((function(e){e.removeAttribute("style")})),document.querySelector("#l_header .menu-phone.list-v").removeAttribute("style"),o=0},utilCopyCode:e.utilCopyCode,utilWriteClipText:e.utilWriteClipText,utilTimeAgo:e.utilTimeAgo,message:e.message,question:e.question,hideMessage:e.hideMessage,messageCopyright:e.messageCopyright,scrolltoElement:e.scrolltoElement}}();Object.freeze(VolantisApp);var VolantisFancyBox=function(){var e={loadFancyBox:function(e){volantis.css(volantis.GLOBAL_CONFIG.cdn.fancybox_css),volantis.js(volantis.GLOBAL_CONFIG.cdn.fancybox_js).then((function(){e&&e()}))},init:function(){var t=!(arguments.length>0&&arguments[0]!==undefined)||arguments[0],o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:e.groupBind;!document.querySelector(".md .gallery img, .fancybox")&&t||("undefined"==typeof Fancybox?e.loadFancyBox(o):o())},elementHandling:function(e,t){document.querySelectorAll(e).forEach((function(e){if(!e.hasAttribute("fancybox")){e.setAttribute("fancybox","");var o=document.createElement("a");o.setAttribute("href",e.src),o.setAttribute("data-caption",e.alt),o.setAttribute("data-fancybox",t),o.classList.add("fancybox"),o.append(e.cloneNode()),e.replaceWith(o)}}))},bind:function(t){e.init(!1,(function(){Fancybox.bind(t,{groupAll:!0,Hash:!1,hideScrollbar:!1,Thumbs:{autoStart:!1},caption:function(e,t,o){return o.$trigger.alt||null}})}))},groupBind:function(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null,t=new Set;document.querySelectorAll(".gallery").forEach((function(e){e.querySelector("img")&&t.add(e.getAttribute("data-group")||"default")})),e&&t.add(e);var o,n=_createForOfIteratorHelper(t);try{for(n.s();!(o=n.n()).done;){var i=o.value;Fancybox.unbind('[data-fancybox="'+i+'"]'),Fancybox.bind('[data-fancybox="'+i+'"]',{Hash:!1,hideScrollbar:!1,Thumbs:{autoStart:!1}})}}catch(a){n.e(a)}finally{n.f()}}};return{init:e.init,bind:e.bind,groupBind:function(t){var o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"default";try{e.elementHandling(t,o),e.init(!1,(function(){e.groupBind(o)}))}catch(n){console.error(n)}}}}();Object.freeze(VolantisFancyBox);var highlightKeyWords=function(){var e={markNum:0,markNextId:-1,startFromURL:function(){var t=decodeURI(new URL(location.href).searchParams.get("keyword")),o=t?t.split(" "):[],n=document.querySelector("#l_main");1==o.length&&"null"==o[0]||(e.start(o,n),e.scrollToFirstHighlightKeywordMark())},scrollToFirstHighlightKeywordMark:function(){volantis.cleanContentVisibility(),e.scrollToNextHighlightKeywordMark("0")||volantis.requestAnimationFrame(e.scrollToFirstHighlightKeywordMark)},scrollToNextHighlightKeywordMark:function(t){var o=t||(e.markNextId+1)%e.markNum;e.markNextId=parseInt(o);var n=document.getElementById("keyword-mark-"+e.markNextId);return n||(e.markNextId=(e.markNextId+1)%e.markNum,n=document.getElementById("keyword-mark-"+e.markNextId)),n&&volantis.scroll.to(n,{addTop:-volantis.dom.header.offsetHeight-5,behavior:"instant"}),n},start:function(t,o){if(e.markNum=0,t.length&&o&&(1!=t.length||"null"!=t[0])){console.log(t);for(var n=document.createTreeWalker(o,NodeFilter.SHOW_TEXT,null),i=[];n.nextNode();)n.currentNode.parentNode.matches("button, select, textarea")||i.push(n.currentNode);i.forEach((function(o){var n=_slicedToArray(e.getIndexByWord(t,o.nodeValue),1)[0];if(n.length){var i=e.mergeIntoSlice(0,o.nodeValue.length,n);e.highlightText(o,i,"keyword"),e.highlightStyle()}}))}},getIndexByWord:function(e,t){var o=arguments.length>2&&arguments[2]!==undefined&&arguments[2],n=[],i=new Set;return e.forEach((function(e){var a=document.createElement("div");a.innerText=e;var r=(e=a.innerHTML).length;if(0!==r){var l=0,s=-1;for(o||(t=t.toLowerCase(),e=e.toLowerCase());(s=t.indexOf(e,l))>-1;)n.push({position:s,word:e}),i.add(e),l=s+r}})),n.sort((function(e,t){return e.position!==t.position?e.position-t.position:t.word.length-e.word.length})),[n,i]},mergeIntoSlice:function(e,t,o){for(var n=o[0],i=n,a=i.position,r=i.word,l=[],s=new Set;a+r.length<=t&&0!==o.length;){s.add(r),l.push({position:a,length:r.length});var c=a+r.length;for(o.shift();0!==o.length&&(a=(n=o[0]).position,r=n.word,c>a);)o.shift()}return{hits:l,start:e,end:t,count:s.size}},highlightText:function(t,o,n){var i,a=t.nodeValue,r=o.start,l=[],s=_createForOfIteratorHelper(o.hits);try{for(s.s();!(i=s.n()).done;){var c=i.value,d=c.position,u=c.length,m=document.createTextNode(a.substring(r,d));r=d+u;var f=document.createElement("mark");f.className=n,(f=e.highlightStyle(f)).appendChild(document.createTextNode(a.substr(d,u))),l.push(m,f)}}catch(v){s.e(v)}finally{s.f()}t.nodeValue=a.substring(r,o.end),l.forEach((function(e){t.parentNode.insertBefore(e,t)}))},highlightStyle:function(t){if(t)return t.id="keyword-mark-"+e.markNum,e.markNum++,t.style.background="transparent",t.style["border-bottom"]="1px dashed #ff2a2a",t.style.color="#ff2a2a",t.style["font-weight"]="bold",t}};return{startFromURL:function(){e.startFromURL()}}}();Object.freeze(highlightKeyWords);var DOMController={visible:function(e){var t=!(arguments.length>1&&arguments[1]!==undefined)||arguments[1];e&&(e.style.display=!0===t?"block":"none")},remove:function(e){document.querySelectorAll(e).forEach((function(e){e.remove()}))},removeList:function(e){e.forEach((function(e){DOMController.remove(e)}))},setAttribute:function(e,t,o){document.querySelectorAll(e).forEach((function(e){e.setAttribute(t,o)}))},setAttributeList:function(e){e.forEach((function(e){DOMController.setAttribute(e[0],e[1],e[2])}))},setStyle:function(e,t,o){document.querySelectorAll(e).forEach((function(e){e.style[t]=o}))},setStyleList:function(e){e.forEach((function(e){DOMController.setStyle(e[0],e[1],e[2])}))},fadeIn:function(e){if(e)return e.style.visibility="visible",e.style.opacity=1,e.style.display="block",e.style.transition="all 0.5s linear",e},fadeOut:function(e){if(e)return e.style.visibility="hidden",e.style.opacity=0,e.style.display="none",e.style.transition="all 0.5s linear",e},fadeToggle:function(e){if(e)return e="hidden"==e.style.visibility?DOMController.fadeIn(e):DOMController.fadeOut(e)},fadeToggleList:function(e){e.forEach((function(e){DOMController.fadeToggle(e)}))},hasClass:function(e,t){if(e)return e.className.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))},addClass:function(e,t){if(e)return e.classList.add(t),e},removeClass:function(e,t){if(e)return e.classList.remove(t),e},toggleClass:function(e,t){if(e)return DOMController.hasClass(e,t)?DOMController.removeClass(e,t):DOMController.addClass(e,t),e},toggleClassList:function(e){e.forEach((function(e){DOMController.toggleClass(e[0],e[1])}))}};Object.freeze(DOMController); //# sourceMappingURL=../maps/js/app.js.map