15 lines
27 KiB
JavaScript
15 lines
27 KiB
JavaScript
|
e=this,t=function(){"use strict";function R(e,t){var n,s=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,n)),s}function h(e){for(var t,n=1;n<arguments.length;n++)t=null!=arguments[n]?arguments[n]:{},n%2?R(Object(t),!0).forEach(function(n){C(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):R(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))});return e}function k(e){return k="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},k(e)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function F(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(n.key),n)}function n(e,t,n){return t&&F(e.prototype,t),n&&F(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function C(e,t,n){return(t=N(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&x(e,t)}function m(e){return m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},m(e)}function x(e,t){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},x(e,t)}function le(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function r(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var n,o,s=m(e);return t?(o=m(this).constructor,n=Reflect.construct(s,arguments,o)):n=s.apply(this,arguments),le(this,n)}}function d(e){return function(e){if(Array.isArray(e))return y(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 y(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)?y(e,t):void 0}}(e)||function(){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 y(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 N(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n,s=e[Symbol.toPrimitive];if(void 0!==s){if(n=s.call(e,t||"default"),"object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function i(e){return Array.isArray?Array.isArray(e):"[object Array]"===P(e)}A=1/0;function se(e){return e==null?"":function(e){if("string"==typeof e)return e;var t=e+"";return"0"==t&&1/e==-A?"-0":t}(e)}function o(e){return"string"==typeof e}function V(e){return"number"==typeof e}function Z(e){return!0===e||!1===e||function(e){return B(e)&&null!==e}(e)&&"[object Boolean]"==P(e)}function B(e){return"object"===k(e)}function s(e){return e!=null}function O(e){return!e.trim().length}function P(e){return e==null?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var oe=function(e){return"Missing ".concat(e," property in key")},ie=function(e){return"Property 'weight' in key '".concat(e,"' must be a positive integer")},z=Object.prototype.hasOwnProperty,fe=function(){function e(n){var s,o=this;t(this,e),this._keys=[],this._keyMap={},s=0,n.forEach(function(e){var t=H(e);o._keys.push(t),o._keyMap[t.id]=t,s+=t.weight}),this._keys.forEach(function(e){e.weight/=s})}return n(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 H(e){var t,n=null,s=null,a=null,r=1,c=null;if(o(e)||i(e))a=e,n=M(e),s=b(e);else{if(!z.call(e,"name"))throw new Error(oe("name"));if(t=e.name,a=t,z.call(e,"weight")&&(r=e.weight)<=0)throw new Error(ie(t));n=M(t),s=b(t),c=e.getFn}return{path:n,id:s,weight:r,src:a,getFn:c}}function M(e){return i(e)?e:e.split(".")}function b(e){return i(e)?e.join("."):e}var de={useExtendedSearch:!1,getFn:function(e,t){var n=[],a=!1;return function e(t,r,c){if(s(t))if(r[c]){if(l=t[r[c]],!s(l))return;if(c===r.length-1&&(o(l)||V(l)||Z(l)))n.push(se(l));else if(i(l)){a=!0;for(var l,d=0,u=l.length;d<u;d+=1)e(l[d],r,c+1)}else r.length&&e(l,r,c+1)}else n.push(t)}(e,o(t)?t.split("."):t,0),a?n:n[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},e=h(h(h(h({},{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:function(e,t){return e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1}}),{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1}),{location:0,threshold:.6,distance:100}),de),re=/[^ ]+/g,E=function(){function a(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=n.getFn,i=void 0===s?e.getFn:s,o=n.fieldNormWeight,r=void 0===o?e.fieldNormWeight:o;t(this,a),this.norm=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,e=new Map,t=Math.pow(10,s);return{get:function(s){if(o=s.match(re).length,e.has(o))return e.get(o);var o,a=1/Math.pow(o,.5*n),i=parseFloat(Math.round(a*t)/t);return e.set(o,i),i},clear:function(){e.clear()}}}(r,3),this.getFn=i,this.isCreated=!1,this.setIndexRecords()}return n(a,[{key:"setSources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.docs=e}},{key:"setIndexRecords",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.records=e}},{key:"setKeys",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.keys=e,this._keysMap={},e.forEach(function(e,n){t._keysMap[e.id]=n})}},{key:"create",value:function(){var e=this;!this.isCreated&&this.docs.length&&(this.isCreated=!0,o(this.docs[0])?this.docs.forEach(function(t,n){e._addString(t,n)}):this.docs.forEach(function(t,n){e._addObject(t,n)}),this.norm.clear())}},{key:"add",value:function(e){var t=this.size();o(e)?this._addString(e,t):this._addObject(e,t)}},{key:"remov
|
||
|
<a class="flex items-center px-3 py-2 rounded-md appearance-none bg-neutral-100 dark:bg-neutral-700 focus:bg-primary-100 hover:bg-primary-100 dark:hover:bg-primary-900 dark:focus:bg-primary-900 focus:outline-dotted focus:outline-transparent focus:outline-2"
|
||
|
${o} tabindex="0">
|
||
|
<div class="grow">
|
||
|
<div class="-mb-1 text-lg font-bold">
|
||
|
${s}
|
||
|
</div>
|
||
|
<div class="text-sm text-neutral-500 dark:text-neutral-400">${e.item.section}<span class="px-2 text-primary-500">·</span>${e.item.date}</span></div>
|
||
|
<div class="text-sm italic">${e.item.summary}</div>
|
||
|
</div>
|
||
|
<div class="ml-2 ltr:block rtl:hidden text-neutral-500">→</div>
|
||
|
<div class="mr-2 ltr:hidden rtl:block text-neutral-500">←</div>
|
||
|
</a>
|
||
|
</li>`}),hasResults=!0):(t="",hasResults=!1),output.innerHTML=t,n.length>0&&(first=output.firstChild.firstElementChild,last=output.lastChild.firstElementChild)}
|