hugo-theme-wondermod/assets/js/search.f3aabd4ff4ee88b2c8dbba68f8075e5efd974df3343957187e070bd6b0c9c3d3.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=null,c=document.getElementById("searchResults"),b=document.getElementById("searchInput"),f=null,d=!1,i,g,h;window.onload=function(){var b=new XMLHttpRequest;b.onreadystatechange=function(){var c,d;b.readyState===4&&(b.status===200?(c=JSON.parse(b.responseText),c&&(d={distance:100,threshold:.4,ignoreLocation:!0,keys:["title","permalink","summary","content"]},a&&(d={isCaseSensitive:!!a.iscasesensitive&&a.iscasesensitive,includeScore:!!a.includescore&&a.includescore,includeMatches:!!a.includematches&&a.includematches,minMatchCharLength:a.minmatchcharlength?a.minmatchcharlength:1,shouldSort:!a.shouldsort||a.shouldsort,findAllMatches:!!a.findallmatches&&a.findallmatches,keys:a.keys?a.keys:["title","permalink","summary","content"],location:a.location?a.location:0,threshold:a.threshold?a.threshold:.4,distance:a.distance?a.distance:100,ignoreLocation:!a.ignorelocation||a.ignorelocation}),g=new Fuse(c,d))):console.log(b.responseText))},b.open("GET","../index.json"),b.send()};function e(a){document.querySelectorAll(".focus").forEach(function(a){a.classList.remove("focus")}),a?(a.focus(),document.activeElement=f=a,a.parentElement.classList.add("focus")):document.activeElement.parentElement.classList.add("focus")}function j(){d=!1,c.innerHTML=b.value="",b.focus()}b.onkeyup=function(a){if(g){const a=g.search(this.value.trim());if(a.length!==0){let b="";for(let c in a)b+=`<li class="post-entry"><header class="entry-header">${a[c].item.title}&nbsp;\xBB</header><a href="${a[c].item.permalink}" aria-label="${a[c].item.title}"></a></li>`;c.innerHTML=b,d=!0,h=c.firstChild,i=c.lastChild}else d=!1,c.innerHTML=""}},b.addEventListener("search",function(a){this.value||j()}),document.onkeydown=function(k){var a,l;let g=k.key;a=document.activeElement;let m=document.getElementById("searchbox").contains(a);if(a===b)for(l=document.getElementsByClassName("focus");l.length>0;)l[0].classList.remove("focus");else f&&(a=f);if(g==="Escape")j();else if(!d||!m)return;else g==="ArrowDown"?(k.preventDefault(),a==b?e(c.firstChild.lastChild):a.parentElement!=i&&e(a.parentElement.nextSibling.lastChild)):g==="ArrowUp"?(k.preventDefault(),a.parentElement==h?e(b):a!=b&&e(a.parentElement.previousSibling.lastChild)):g==="ArrowRight"&&a.click()}})()