hugo-theme-wondermod/assets/js/search.c26e18ac841c5cfdecf0d5203113c4607dcaca99d920caba652e323c4e4219d5.js

19 lines
17 KiB
JavaScript
Raw Normal View History

/**
* Fuse.js v6.6.2 - Lightweight fuzzy-search (http://fusejs.io)
*
* Copyright (c) 2022 Kiro Risk (http://kiro.me)
* All Rights Reserved. Apache Software License 2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
var e,t;e=this,t=function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?e(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):e(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function n(e){return n="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},n(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(e)||function(){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 s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function h(e){return Array.isArray?Array.isArray(e):"[object Array]"===g(e)}function u(e){return"string"==typeof e}function l(e){return"number"==typeof e}function d(e){return!0===e||!1===e||function(e){return function(e){return"object"===n(e)}(e)&&null!==e}(e)&&"[object Boolean]"==g(e)}function f(e){return null!=e}function v(e){return!e.trim().length}function g(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var y="Extended search is not available",p=function(e){return"Pattern length exceeds max of ".concat(e,".")},m=Object.prototype.hasOwnProperty,b=function(){function e(t){var n=this;r(this,e),this._keys=[],this._keyMap={};var i=0;t.forEach((function(e){var t=k(e);i+=t.weight,n._keys.push(t),n._keyMap[t.id]=t,i+=t.weight})),this._keys.forEach((function(e){e.weight/=i}))}return o(e,[{key:"get",value:function(e){return this._keyMap[e]}},{key:"keys",value:function(){return this._keys}},{key:"toJSON",value:function(){return JSON.stringify(this._keys)}}]),e}();function k(e){var t=null,n=null,r=null,i=1,o=null;if(u(e)||h(e))r=e,t=M(e),n=w(e);else{if(!m.call(e,"name"))throw new Error(function(e){return"Missing ".concat(e," property in key")}("name"));var a=e.name;if(r=a,m.call(e,"weight")&&(i=e.weight)<=0)throw new Error(function(e){return"Property 'weight' in key '".concat(e,"' must be a positive integer")}(a));t=M(a),n=w(a),o=e.getFn}return{path:t,id:n,weight:i,src:r,getFn:o}}function M(e){return h(e)?e:e.split(".")}function w(e){return h(e)?e.join("."):e}var x={useExtendedSearch:!1,getFn:function(e,t){var n=[],r=!1;return function e(t,i,o){if(f(t))if(i[o]){var a=t[i[o]];if(!f(a))return;if(o===i.length-1&&(u(a)||l(a)||d(a)))n.push(function(e){return null==e?"":function(e){if("string"==typeof e)return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(a));else if(h(a)){r=!0;for(var c=0,s=a.length;c<s;c+=1)e(a[c],i,o+1)}else i.length&&e(a,i,o+1)}else n.push(t)}(e,u(t)?t.split("."):t,0),r?n:n[0]},ignoreLocation:!1,ignoreFieldNorm:!
;
/*
PaperMod v6
License: MIT https://github.com/adityatelange/hugo-PaperMod/blob/master/LICENSE
Copyright (c) 2020 nanxiaobei and adityatelange
Copyright (c) 2021-2022 adityatelange
*/
;
(()=>{var a,r,c,e=null,n=document.getElementById("searchResults"),t=document.getElementById("searchInput"),i=null,s=!1;window.onload=function(){var t=new XMLHttpRequest;t.onreadystatechange=function(){if(t.readyState===4)if(t.status===200){var n,s=JSON.parse(t.responseText);s&&(n={distance:100,threshold:.4,ignoreLocation:!0,keys:["title","permalink","summary","content"]},e&&(n={isCaseSensitive:!!e.iscasesensitive&&e.iscasesensitive,includeScore:!!e.includescore&&e.includescore,includeMatches:!!e.includematches&&e.includematches,minMatchCharLength:e.minmatchcharlength?e.minmatchcharlength:1,shouldSort:!e.shouldsort||e.shouldsort,findAllMatches:!!e.findallmatches&&e.findallmatches,keys:e.keys?e.keys:["title","permalink","summary","content"],location:e.location?e.location:0,threshold:e.threshold?e.threshold:.4,distance:e.distance?e.distance:100,ignoreLocation:!e.ignorelocation||e.ignorelocation}),a=new Fuse(s,n))}else console.log(t.responseText)},t.open("GET","../index.json"),t.send()};function o(e){document.querySelectorAll(".focus").forEach(function(e){e.classList.remove("focus")}),e?(e.focus(),document.activeElement=i=e,e.parentElement.classList.add("focus")):document.activeElement.parentElement.classList.add("focus")}function l(){s=!1,n.innerHTML=t.value="",t.focus()}t.onkeyup=function(){if(a){const e=a.search(this.value.trim());if(e.length!==0){let t="";for(let n in e)t+=`<li class="post-entry"><header class="entry-header">${e[n].item.title}&nbsp;\xBB</header><a href="${e[n].item.permalink}" aria-label="${e[n].item.title}"></a></li>`;n.innerHTML=t,s=!0,r=n.firstChild,c=n.lastChild}else s=!1,n.innerHTML=""}},t.addEventListener("search",function(){this.value||l()}),document.onkeydown=function(d){let a=d.key;var u,e=document.activeElement;let h=document.getElementById("searchbox").contains(e);if(e===t)for(u=document.getElementsByClassName("focus");u.length>0;)u[0].classList.remove("focus");else i&&(e=i);if(a==="Escape")l();else if(!s||!h)return;else a==="ArrowDown"?(d.preventDefault(),e==t?o(n.firstChild.lastChild):e.parentElement!=c&&o(e.parentElement.nextSibling.lastChild)):a==="ArrowUp"?(d.preventDefault(),e.parentElement==r?o(t):e!=t&&o(e.parentElement.previousSibling.lastChild)):a==="ArrowRight"&&e.click()}})()