3 Zeilen
32 KiB
JavaScript
3 Zeilen
32 KiB
JavaScript
function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function n(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,e){return(o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function l(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}var h,c,u,a,f,p={},d=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i;function g(t,e){for(var n in e)t[n]=e[n];return t}function y(t){var e=t.parentNode;e&&e.removeChild(t)}function v(t,e,n){var i,r,s,o,l=arguments;if(e=g({},e),arguments.length>3)for(n=[n],i=3;i<arguments.length;i++)n.push(l[i]);if(null!=n&&(e.children=n),null!=t&&null!=t.defaultProps)for(r in t.defaultProps)void 0===e[r]&&(e[r]=t.defaultProps[r]);return o=e.key,null!=(s=e.ref)&&delete e.ref,null!=o&&delete e.key,m(t,e,o,s)}function m(t,e,n,i){var r={type:t,props:e,key:n,ref:i,__k:null,__p:null,__b:0,__e:null,l:null,__c:null,constructor:void 0};return h.vnode&&h.vnode(r),r}function b(t){return t.children}function w(t,e){this.props=t,this.context=e}function k(t,e){if(null==e)return t.__p?k(t.__p,t.__p.__k.indexOf(t)+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?k(t):null}function x(t){(!t.__d&&(t.__d=!0)&&1===c.push(t)||a!==h.debounceRendering)&&(a=h.debounceRendering,(h.debounceRendering||u)(S))}function S(){var t;for(c.sort((function(t,e){return e.__v.__b-t.__v.__b}));t=c.pop();)t.__d&&t.forceUpdate(!1)}function O(t,e,n,i,r,s,o,l,h){var c,u,a,f,_,g,v,m=n&&n.__k||d,b=m.length;if(l==p&&(l=null!=s?s[0]:b?k(n,0):null),c=0,e.__k=C(e.__k,(function(n){if(null!=n){if(n.__p=e,n.__b=e.__b+1,null===(a=m[c])||a&&n.key==a.key&&n.type===a.type)m[c]=void 0;else for(u=0;u<b;u++){if((a=m[u])&&n.key==a.key&&n.type===a.type){m[u]=void 0;break}a=null}if(f=R(t,n,a=a||p,i,r,s,o,null,l,h),(u=n.ref)&&a.ref!=u&&(v||(v=[])).push(u,n.__c||f,n),null!=f){if(null==g&&(g=f),null!=n.l)f=n.l,n.l=null;else if(s==a||f!=l||null==f.parentNode){t:if(null==l||l.parentNode!==t)t.appendChild(f);else{for(_=l,u=0;(_=_.nextSibling)&&u<b;u+=2)if(_==f)break t;t.insertBefore(f,l)}"option"==e.type&&(t.value="")}l=f.nextSibling,"function"==typeof e.type&&(e.l=f)}}return c++,n})),e.__e=g,null!=s&&"function"!=typeof e.type)for(c=s.length;c--;)null!=s[c]&&y(s[c]);for(c=b;c--;)null!=m[c]&&E(m[c],m[c]);if(v)for(c=0;c<v.length;c++)D(v[c],v[++c],v[++c])}function C(t,e,n){if(null==n&&(n=[]),null==t||"boolean"==typeof t)e&&n.push(e(null));else if(Array.isArray(t))for(var i=0;i<t.length;i++)C(t[i],e,n);else n.push(e?e(function(t){if(null==t||"boolean"==typeof t)return null;if("string"==typeof t||"number"==typeof t)return m(null,t,null,null);if(null!=t.__e||null!=t.__c){var e=m(t.type,t.props,t.key,null);return e.__e=t.__e,e}return t}(t)):t);return n}function P(t,e,n){"-"===e[0]?t.setProperty(e,n):t[e]="number"==typeof n&&!1===_.test(e)?n+"px":n||""}function j(t,e,n,i,r){var s,o,l,h,c;if("key"===(e=r?"className"===e?"class":e:"class"===e?"className":e)||"children"===e);else if("style"===e)if(s=t.style,"string"==typeof n)s.cssText=n;else{if("string"==typeof i&&(s.cssText="",i=null),i)for(o in i)n&&o in n||P(s,o,"");if(n)for(l in n)i&&n[l]===i[l]||P(s,l,n[l])}else"o"===e[0]&&"n"===e[1]?(h=e!==(e=e.replace(/Capture$/,"")),c=e.toLowerCase(),e=(c in t?c:e).slice(2),n?(i||t.addEventListener(e,L,h),(t.u||(t.u={}))[e]=n):t.removeEventListener(e,L,h)):"list"!==e&&"tagName"!==e&&"form"!==e&&!r&&e in t?t[e]=null==n?"":n:"function"!=typeof n&&"dangerouslySetInnerHTML"!==e&&(e!==(e=e.replace(/^xlink:?/,""))?null==n||!1===n?t.removeAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase()):t.setAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase(),n):null==n||!1===n?t.removeAttribute(e):t.setAttribute(e,n))}function L(t){return this.u[t.type](h.event?h.event(t):t)}function R(t,e,n,i,r,s,o,l,c,u){var a,f,p,d,_,y,v,m,k,x,S=e.type;if(void 0!==e.constructor)return null;(a=h.__b)&&a(e);try{t:if("function"==typeof S){if(m=e.props,k=(a=S.contextType)&&i[a.__c],x=a?k?k.props.value:a.__p:i,n.__c?v=(f=e.__c=n.__c).__p=f.__E:("prototype"in S&&S.prototype.render?e.__c=f=new S(m,x):(e.__c=f=new w(m,x),f.constructor=S,f.render=U),k&&k.sub(f),f.props=m,f.state||(f.state={}),f.context=x,f.__n=i,p=f.__d=!0,f.__h=[]),null==f.__s&&(f.__s=f.state),null!=S.getDerivedStateFromProps&&g(f.__s==f.state?f.__s=g({},f.__s):f.__s,S.getDerivedStateFromProps(m,f.__s)),p)null==S.getDerivedStateFromProps&&null!=f.componentWillMount&&f.componentWillMount(),null!=f.componentDidMount&&o.push(f);else{if(null==S.getDerivedStateFromProps&&null==l&&null!=f.componentWillReceiveProps&&f.componentWillReceiveProps(m,x),!l&&null!=f.shouldComponentUpdate&&!1===f.shouldComponentUpdate(m,f.__s,x)){for(f.props=m,f.state=f.__s,f.__d=!1,f.__v=e,e.__e=null!=c?c!==n.__e?c:n.__e:null,e.__k=n.__k,a=0;a<e.__k.length;a++)e.__k[a]&&(e.__k[a].__p=e);break t}null!=f.componentWillUpdate&&f.componentWillUpdate(m,f.__s,x)}for(d=f.props,_=f.state,f.context=x,f.props=m,f.state=f.__s,(a=h.__r)&&a(e),f.__d=!1,f.__v=e,f.__P=t,a=f.render(f.props,f.state,f.context),e.__k=null!=a&&a.type==b&&null==a.key?a.props.children:a,null!=f.getChildContext&&(i=g(g({},i),f.getChildContext())),p||null==f.getSnapshotBeforeUpdate||(y=f.getSnapshotBeforeUpdate(d,_)),O(t,e,n,i,r,s,o,c,u),f.base=e.__e;a=f.__h.pop();)f.__s&&(f.state=f.__s),a.call(f);p||null==d||null==f.componentDidUpdate||f.componentDidUpdate(d,_,y),v&&(f.__E=f.__p=null)}else e.__e=T(n.__e,e,n,i,r,s,o,u);(a=h.diffed)&&a(e)}catch(t){h.__e(t,e,n)}return e.__e}function N(t,e){for(var n;n=t.pop();)try{n.componentDidMount()}catch(t){h.__e(t,n.__v)}h.__c&&h.__c(e)}function T(t,e,n,i,r,s,o,l){var h,c,u,a,f=n.props,_=e.props;if(r="svg"===e.type||r,null==t&&null!=s)for(h=0;h<s.length;h++)if(null!=(c=s[h])&&(null===e.type?3===c.nodeType:c.localName===e.type)){t=c,s[h]=null;break}if(null==t){if(null===e.type)return document.createTextNode(_);t=r?document.createElementNS("http://www.w3.org/2000/svg",e.type):document.createElement(e.type),s=null}return null===e.type?f!==_&&(null!=s&&(s[s.indexOf(t)]=null),t.data=_):e!==n&&(null!=s&&(s=d.slice.call(t.childNodes)),u=(f=n.props||p).dangerouslySetInnerHTML,a=_.dangerouslySetInnerHTML,l||(a||u)&&(a&&u&&a.__html==u.__html||(t.innerHTML=a&&a.__html||"")),function(t,e,n,i,r){var s;for(s in n)s in e||j(t,s,null,n[s],i);for(s in e)r&&"function"!=typeof e[s]||"value"===s||"checked"===s||n[s]===e[s]||j(t,s,e[s],n[s],i)}(t,_,f,r,l),e.__k=e.props.children,a||O(t,e,n,i,"foreignObject"!==e.type&&r,s,o,p,l),l||("value"in _&&void 0!==_.value&&_.value!==t.value&&(t.value=null==_.value?"":_.value),"checked"in _&&void 0!==_.checked&&_.checked!==t.checked&&(t.checked=_.checked))),t}function D(t,e,n){try{"function"==typeof t?t(e):t.current=e}catch(t){h.__e(t,n)}}function E(t,e,n){var i,r,s;if(h.unmount&&h.unmount(t),(i=t.ref)&&D(i,null,e),n||"function"==typeof t.type||(n=null!=(r=t.__e)),t.__e=t.l=null,null!=(i=t.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(t){h.__e(t,e)}i.base=i.__P=null}if(i=t.__k)for(s=0;s<i.length;s++)i[s]&&E(i[s],e,n);null!=r&&y(r)}function U(t,e,n){return this.constructor(t,n)}function I(t,e,n){var i,r,s;h.__p&&h.__p(t,e),r=(i=n===f)?null:n&&n.__k||e.__k,t=v(b,null,[t]),s=[],R(e,i?e.__k=t:(n||e).__k=t,r||p,p,void 0!==e.ownerSVGElement,n&&!i?[n]:r?null:d.slice.call(e.childNodes),s,!1,n||p,i),N(s,t)}h={},w.prototype.setState=function(t,e){var n=this.__s!==this.state&&this.__s||(this.__s=g({},this.state));("function"!=typeof t||(t=t(n,this.props)))&&g(n,t),null!=t&&this.__v&&(e&&this.__h.push(e),x(this))},w.prototype.forceUpdate=function(t){var e,n,i,r=this.__v,s=this.__v.__e,o=this.__P;o&&(e=!1!==t,n=[],i=R(o,r,g({},r),this.__n,void 0!==o.ownerSVGElement,null,n,e,null==s?k(r):s),N(n,r),i!=s&&function t(e){var n,i;if(null!=(e=e.__p)&&null!=e.__c){for(e.__e=e.__c.base=null,n=0;n<e.__k.length;n++)if(null!=(i=e.__k[n])&&null!=i.__e){e.__e=e.__c.base=i.__e;break}return t(e)}}(r)),t&&t()},w.prototype.render=b,c=[],u="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,a=h.debounceRendering,h.__e=function(t,e,n){for(var i;e=e.__p;)if((i=e.__c)&&!i.__p)try{if(i.constructor&&null!=i.constructor.getDerivedStateFromError)i.setState(i.constructor.getDerivedStateFromError(t));else{if(null==i.componentDidCatch)continue;i.componentDidCatch(t)}return x(i.__E=i)}catch(e){t=e}throw t},f=p;var M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var A=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t,e){!function(e,n,i){let r;(r=i.define)&&r.amd?r([],(function(){return n})):(r=i.modules)?r["FlexSearch".toLowerCase()]=n:t.exports=n}(0,function t(e){function n(t,e){const n=e?e.id:t&&t.id;this.id=n||0===n?n:L++,this.init(t,e),o(this,"index",(function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].c):Object.keys(this.c)})),o(this,"length",(function(){return this.index.length}))}function i(t,e,n,i){return this.u!==this.g&&(this.o=this.o.concat(n),this.u++,i&&this.o.length>=i&&(this.u=this.g),this.u===this.g&&(this.cache&&this.j.set(e,this.o),this.F&&this.F(this.o))),this}function r(t,e){const n=t.length,i=m(e),r=[];for(let s=0,o=0;s<n;s++){const n=t[s];(i&&e(n)||!i&&!e[n])&&(r[o++]=n)}return r}function s(t,e,n,i,r,s,o,l,h,c){let u;if(n=g(n,o?0:r,l,s,e,h,c),l&&(l=n.page,u=n.next,n=n.result),o)e=this.where(o,null,r,n);else{for(e=n,n=this.l,r=e.length,s=Array(r),o=0;o<r;o++)s[o]=n[e[o]];e=s}return n=e,i&&(m(i)||(1<(T=i.split(":")).length?i=d:(T=T[0],i=p)),n.sort(i)),n=_(l,u,n),this.cache&&this.j.set(t,n),n}function o(t,e,n){Object.defineProperty(t,e,{get:n})}function l(t){return new RegExp(t,"g")}function h(t,e){for(let n=0;n<e.length;n+=2)t=t.replace(e[n],e[n+1]);return t}function c(t,e,n,i,r,s,o,l){return e[n]?e[n]:(r=r?(l-(o||l/1.5))*s+(o||l/1.5)*r:s,e[n]=r,r>=o&&((t=(t=t[l-(r+.5>>0)])[n]||(t[n]=[]))[t.length]=i),r)}function u(t,e){if(t){const n=Object.keys(t);for(let i=0,r=n.length;i<r;i++){const r=n[i],s=t[r];if(s)for(let n=0,i=s.length;n<i;n++){if(s[n]===e){1===i?delete t[r]:s.splice(n,1);break}b(s[n])&&u(s[n],e)}}}}function a(t){let e="",n="";var i="";for(let r=0;r<t.length;r++){const s=t[r];s!==n&&(r&&"h"===s?(i="a"===i||"e"===i||"i"===i||"o"===i||"u"===i||"y"===i,(("a"===n||"e"===n||"i"===n||"o"===n||"u"===n||"y"===n)&&i||" "===n)&&(e+=s)):e+=s),i=r===t.length-1?"":t[r+1],n=s}return e}function f(t,e){return 0>(t=t.length-e.length)?1:t?-1:0}function p(t,e){return(t=t[T])<(e=e[T])?-1:t>e?1:0}function d(t,e){const n=T.length;for(let i=0;i<n;i++)t=t[T[i]],e=e[T[i]];return t<e?-1:t>e?1:0}function _(t,e,n){return t?{page:t,next:e?""+e:null,result:n}:n}function g(t,e,n,i,r,s,o){let l,h=[];if(!0===n){n="0";var c=""}else c=n&&n.split(":");const u=t.length;if(1<u){const m=x(),b=[];let k,S;var a,f=0;let O;var p=!0;let C,P,j,L,R,N,T=0;if(c&&(2===c.length?(L=c,c=!1):c=R=parseInt(c[0],10)),o){for(k=x();f<u;f++)if("not"===r[f])for(O=(S=t[f]).length,a=0;a<O;a++)k["@"+S[a]]=1;else j=f+1;if(w(j))return _(n,l,h);f=0}else P=y(r)&&r;for(;f<u;f++){const y=f===(j||u)-1;if(!P||!f)if((a=P||r&&r[f])&&"and"!==a){if("or"!==a)continue;N=!1}else N=s=!0;if(O=(S=t[f]).length){if(p){if(!C){C=S;continue}var d=C.length;for(a=0;a<d;a++){var g="@"+(p=C[a]);o&&k[g]||(m[g]=1,s||(h[T++]=p))}C=null,p=!1}for(g=!1,a=0;a<O;a++){var v="@"+(d=S[a]);const t=s?m[v]||0:f;if(!(!t&&!i||o&&k[v]||!s&&m[v]))if(t===f){if(y){if((!R||--R<T)&&(h[T++]=d,e&&T===e))return _(n,T+(c||0),h)}else m[v]=f+1;g=!0}else i&&((v=b[t]||(b[t]=[]))[v.length]=d)}if(N&&!g&&!i)break}else if(N&&!i)return _(n,l,S)}if(C)if(f=C.length,o)for(a=c?parseInt(c,10):0;a<f;a++)k["@"+(t=C[a])]||(h[T++]=t);else h=C;if(i)for(T=h.length,L?(f=parseInt(L[0],10)+1,a=parseInt(L[1],10)+1):(f=b.length,a=0);f--;)if(d=b[f]){for(O=d.length;a<O;a++)if(i=d[a],(!o||!k["@"+i])&&(h[T++]=i,e&&T===e))return _(n,f+":"+a,h);a=0}}else!u||r&&"not"===r[0]||(h=t[0],c&&(c=parseInt(c[0],10)));return e&&(o=h.length,c&&c>o&&(c=0),(l=(c=c||0)+e)<o?h=h.slice(c,l):(l=0,c&&(h=h.slice(c)))),_(n,l,h)}function y(t){return"string"==typeof t}function v(t){return t.constructor===Array}function m(t){return"function"==typeof t}function b(t){return"object"==typeof t}function w(t){return void 0===t}function k(t){const e=Array(t);for(let n=0;n<t;n++)e[n]=x();return e}function x(){return Object.create(null)}function S(){let t,e;self.onmessage=function(n){if(n=n.data)if(n.search){const i=e.search(n.content,n.threshold?{limit:n.limit,threshold:n.threshold,where:n.where}:n.limit);self.postMessage({id:t,content:n.content,limit:n.limit,result:i})}else n.add?e.add(n.id,n.content):n.update?e.update(n.id,n.content):n.remove?e.remove(n.id):n.clear?e.clear():n.info?((n=e.info()).worker=t,console.log(n)):n.register&&(t=n.id,n.options.cache=!1,n.options.async=!1,n.options.worker=!1,e=new(e=new Function(n.register.substring(n.register.indexOf("{")+1,n.register.lastIndexOf("}")))())(n.options))}}function O(n,i,r,s){n=e("flexsearch","id"+n,S,(function(t){(t=t.data)&&t.result&&s(t.id,t.content,t.result,t.limit,t.where,t.cursor,t.suggest)}),i);const o=t.toString();return r.id=i,n.postMessage({register:o,options:r,id:i}),n}const C={encode:"icase",f:"forward",split:/\W+/,cache:!1,async:!1,g:!1,D:!1,a:!1,b:9,threshold:0,depth:0},P={memory:{encode:"extra",f:"strict",threshold:0,b:1},speed:{encode:"icase",f:"strict",threshold:1,b:3,depth:2},match:{encode:"extra",f:"full",threshold:1,b:3},score:{encode:"extra",f:"strict",threshold:1,b:9,depth:4},balance:{encode:"balance",f:"strict",threshold:0,b:3,depth:3},fast:{encode:"icase",f:"strict",threshold:8,b:9,depth:1}},j=[];let L=0;const R={},N={};let T;n.create=function(t,e){return new n(t,e)},n.registerMatcher=function(t){for(const e in t)t.hasOwnProperty(e)&&j.push(l(e),t[e]);return this},n.registerEncoder=function(t,e){return E[t]=e.bind(E),this},n.registerLanguage=function(t,e){return R[t]=e.filter,N[t]=e.stemmer,this},n.encode=function(t,e){return E[t](e)},n.prototype.init=function(t,e){if(this.v=[],e){var r=e.preset;t=e}else t||(t=C),r=t.preset;if(e={},y(t)?(e=P[t],t={}):r&&(e=P[r]),r=t.worker)if("undefined"==typeof Worker)t.worker=!1,this.m=null;else{var s=parseInt(r,10)||4;this.C=-1,this.u=0,this.o=[],this.F=null,this.m=Array(s);for(var o=0;o<s;o++)this.m[o]=O(this.id,o,t,i.bind(this))}if(this.f=t.tokenize||e.f||this.f||C.f,this.split=w(r=t.split)?this.split||C.split:y(r)?l(r):r,this.D=t.rtl||this.D||C.D,this.async="undefined"==typeof Promise||w(r=t.async)?this.async||C.async:r,this.g=w(r=t.worker)?this.g||C.g:r,this.threshold=w(r=t.threshold)?e.threshold||this.threshold||C.threshold:r,this.b=w(r=t.resolution)?r=e.b||this.b||C.b:r,r<=this.threshold&&(this.b=this.threshold+1),this.depth="strict"!==this.f||w(r=t.depth)?e.depth||this.depth||C.depth:r,this.w=(r=w(r=t.encode)?e.encode||C.encode:r)&&E[r]&&E[r].bind(E)||(m(r)?r:this.w||!1),(r=t.matcher)&&this.addMatcher(r),r=(e=t.lang)||t.filter){if(y(r)&&(r=R[r]),v(r)){s=this.w,o=x();for(var h=0;h<r.length;h++){var c=s?s(r[h]):r[h];o[c]=1}r=o}this.filter=r}if(r=e||t.stemmer){var u;for(u in e=y(r)?N[r]:r,s=this.w,o=[],e)e.hasOwnProperty(u)&&(h=s?s(u):u,o.push(l(h+"($|\\W)"),s?s(e[u]):e[u]));this.stemmer=u=o}if(this.a=o=(r=t.doc)?function t(e){const n=x();for(const i in e)if(e.hasOwnProperty(i)){const r=e[i];v(r)?n[i]=r.slice(0):b(r)?n[i]=t(r):n[i]=r}return n}(r):this.a||C.a,this.i=k(this.b-(this.threshold||0)),this.h=x(),this.c=x(),o){if(this.l=x(),t.doc=null,u=o.index={},e=o.keys=[],s=o.field,h=o.tag,c=o.store,v(o.id)||(o.id=o.id.split(":")),c){var a=x();if(y(c))a[c]=1;else if(v(c))for(let t=0;t<c.length;t++)a[c[t]]=1;else b(c)&&(a=c);o.store=a}if(h){if(this.G=x(),c=x(),s)if(y(s))c[s]=t;else if(v(s))for(a=0;a<s.length;a++)c[s[a]]=t;else b(s)&&(c=s);for(v(h)||(o.tag=h=[h]),s=0;s<h.length;s++)this.G[h[s]]=x();this.I=h,s=c}if(s){let i;for(v(s)||(b(s)?(i=s,o.field=s=Object.keys(s)):o.field=s=[s]),o=0;o<s.length;o++)v(h=s[o])||(i&&(t=i[h]),e[o]=h,s[o]=h.split(":")),u[h]=new n(t)}t.doc=r}return this.B=!0,this.j=!!(this.cache=r=w(r=t.cache)?this.cache||C.cache:r)&&new U(r),this},n.prototype.encode=function(t){return t&&(j.length&&(t=h(t,j)),this.v.length&&(t=h(t,this.v)),this.w&&(t=this.w(t)),this.stemmer&&(t=h(t,this.stemmer))),t},n.prototype.addMatcher=function(t){const e=this.v;for(const n in t)t.hasOwnProperty(n)&&e.push(l(n),t[n]);return this},n.prototype.add=function(t,e,n,i,s){if(this.a&&b(t))return this.A("add",t,e);if(e&&y(e)&&(t||0===t)){var o="@"+t;if(this.c[o]&&!i)return this.update(t,e);if(this.g)return++this.C>=this.m.length&&(this.C=0),this.m[this.C].postMessage({add:!0,id:t,content:e}),this.c[o]=""+this.C,n&&n(),this;if(!s){if(this.async&&"function"!=typeof importScripts){let r=this;return o=new Promise((function(n){setTimeout((function(){r.add(t,e,null,i,!0),r=null,n()}))})),n?(o.then(n),this):o}if(n)return this.add(t,e,null,i,!0),n(),this}if(!(e=this.encode(e)).length)return this;s=m(n=this.f)?n(e):e.split(this.split),this.filter&&(s=r(s,this.filter));const p=x();p._ctx=x();const d=s.length,_=this.threshold,g=this.depth,y=this.b,v=this.i,b=this.D;for(let e=0;e<d;e++){var l=s[e];if(l){var h=l.length,u=(b?e+1:d-e)/d,a="";switch(n){case"reverse":case"both":for(var f=h;--f;)c(v,p,a=l[f]+a,t,b?1:(h-f)/h,u,_,y-1);a="";case"forward":for(f=0;f<h;f++)c(v,p,a+=l[f],t,b?(f+1)/h:1,u,_,y-1);break;case"full":for(f=0;f<h;f++){const e=(b?f+1:h-f)/h;for(let n=h;n>f;n--)c(v,p,a=l.substring(f,n),t,e,u,_,y-1)}break;default:if(h=c(v,p,l,t,1,u,_,y-1),g&&1<d&&h>=_)for(h=p._ctx[l]||(p._ctx[l]=x()),l=this.h[l]||(this.h[l]=k(y-(_||0))),0>(u=e-g)&&(u=0),(a=e+g+1)>d&&(a=d);u<a;u++)u!==e&&c(l,h,s[u],t,0,y-(u<e?e-u:u-e),_,y-1)}}}this.c[o]=1,this.B=!1}return this},n.prototype.A=function(t,e,n){if(v(e)){var i=e.length;if(i--){for(var r=0;r<i;r++)this.A(t,e[r]);return this.A(t,e[i],n)}}else{var s,o=this.a.index,l=this.a.keys,h=this.a.tag;r=this.a.store;var c=this.a.id;i=e;for(var u=0;u<c.length;u++)i=i[c[u]];if("remove"===t&&(delete this.l[i],c=l.length,c--)){for(e=0;e<c;e++)o[l[e]].remove(i);return o[l[c]].remove(i,n)}if(h){for(s=0;s<h.length;s++){var a=h[s],f=e;for(c=a.split(":"),u=0;u<c.length;u++)f=f[c[u]];f="@"+f}s=(s=this.G[a])[f]||(s[f]=[])}for(let r=0,s=(c=this.a.field).length;r<s;r++){for(a=c[r],h=e,f=0;f<a.length;f++)h=h[a[f]];a=o[l[r]],f="add"===t?a.add:a.update,r===s-1?f.call(a,i,h,n):f.call(a,i,h)}if(r){for(n=Object.keys(r),t=x(),o=0;o<n.length;o++)if(r[l=n[o]]){let n,i;for(l=l.split(":"),c=0;c<l.length;c++)i=(i||e)[h=l[c]],n=(n||t)[h]=i}e=t}s&&(s[s.length]=e),this.l[i]=e}return this},n.prototype.update=function(t,e,n){return this.a&&b(t)?this.A("update",t,e):(this.c["@"+t]&&y(e)&&(this.remove(t),this.add(t,e,n,!0)),this)},n.prototype.remove=function(t,e,n){if(this.a&&b(t))return this.A("remove",t,e);var i="@"+t;if(this.c[i]){if(this.g)return this.m[this.c[i]].postMessage({remove:!0,id:t}),delete this.c[i],e&&e(),this;if(!n){if(this.async&&"function"!=typeof importScripts){let n=this;return i=new Promise((function(e){setTimeout((function(){n.remove(t,null,!0),n=null,e()}))})),e?(i.then(e),this):i}if(e)return this.remove(t,null,!0),e(),this}for(e=0;e<this.b-(this.threshold||0);e++)u(this.i[e],t);this.depth&&u(this.h,t),delete this.c[i],this.B=!1}return this},n.prototype.search=function(t,e,n,i){if(b(e)){if(v(e))for(var o=0;o<e.length;o++)e[o].query=t;else e.query=t;t=e,e=1e3}else e&&m(e)?(n=e,e=1e3):e||0===e||(e=1e3);let l,h,c,u=[],a=t;if(b(t)&&!v(t)){n||(n=t.callback)&&(a.callback=null),h=t.sort,l=t.page,e=t.limit;var p=t.threshold;c=t.suggest,t=t.query}if(this.a){p=this.a.index;const r=a.where;var d=a.bool||"or",_=a.field;let f,g,m=d;if(_)v(_)||(_=[_]);else if(v(a)){var w=a;_=[],m=[];for(var k=0;k<a.length;k++)o=(i=a[k]).bool||d,_[k]=i.field,m[k]=o,"not"===o?f=!0:"and"===o&&(g=!0)}else _=this.a.keys;for(d=_.length,k=0;k<d;k++)w&&(a=w[k]),l&&!y(a)&&(a.page=null,a.limit=0),u[k]=p[_[k]].search(a,0);if(n)return n(s.call(this,t,m,u,h,e,c,r,l,g,f));if(this.async){const n=this;return new Promise((function(i){Promise.all(u).then((function(o){i(s.call(n,t,m,o,h,e,c,r,l,g,f))}))}))}return s.call(this,t,m,u,h,e,c,r,l,g,f)}if(p||(p=this.threshold||0),!this.g){if(!i){if(this.async&&"function"!=typeof importScripts){let t=this;return p=new Promise((function(n){setTimeout((function(){n(t.search(a,e,null,!0)),t=null}))})),n?(p.then(n),this):p}if(n)return n(this.search(a,e,null,!0)),this}if(!t||!y(t))return u;if(a=t,this.cache)if(this.B){if(n=this.j.get(t))return n}else this.j.clear(),this.B=!0;if(!(a=this.encode(a)).length)return u;n=m(n=this.f)?n(a):a.split(this.split),this.filter&&(n=r(n,this.filter)),w=n.length,i=!0,o=[];var S=x(),O=0;if(1<w&&(this.depth&&"strict"===this.f?d=!0:n.sort(f)),!d||(k=this.h)){const t=this.b;for(;O<w;O++){let e=n[O];if(e){if(d){if(!_)if(k[e])_=e,S[e]=1;else if(!c)return u;if(c&&O===w-1&&!o.length)d=!1,S[e=_||e]=0;else if(!_)continue}if(!S[e]){const n=[];let r=!1,s=0;const l=d?k[_]:this.i;if(l){let i;for(let o=0;o<t-p;o++)(i=l[o]&&l[o][e])&&(n[s++]=i,r=!0)}if(r)_=e,o[o.length]=1<s?n.concat.apply([],n):n[0];else if(!c){i=!1;break}S[e]=1}}}}else i=!1;return i&&(u=g(o,e,l,c)),this.cache&&this.j.set(t,u),u}for(this.F=n,this.u=0,this.o=[],p=0;p<this.g;p++)this.m[p].postMessage({search:!0,limit:e,content:a})},n.prototype.find=function(t,e){return this.where(t,e,1)[0]||null},n.prototype.where=function(t,e,n,i){const r=this.l,s=[];let o,l=0;var h;let c;if(b(t)){n||(n=e);var u=Object.keys(t),a=u.length;if(o=!1,1===a&&"id"===u[0])return[r[t.id]];if((h=this.I)&&!i)for(var f=0;f<h.length;f++){var p=h[f],d=t[p];if(!w(d)){if(c=this.G[p]["@"+d],0==--a)return c;u.splice(u.indexOf(p),1),delete t[p];break}}for(h=Array(a),f=0;f<a;f++)h[f]=u[f].split(":")}else{if(m(t)){for(n=(e=i||Object.keys(r)).length,u=0;u<n;u++)t(a=r[e[u]])&&(s[l++]=a);return s}if(w(e))return[r[t]];if("id"===t)return[r[e]];u=[t],a=1,h=[t.split(":")],o=!0}for(f=(i=c||i||Object.keys(r)).length,p=0;p<f;p++){d=c?i[p]:r[i[p]];let f=!0;for(let n=0;n<a;n++){o||(e=t[u[n]]);const i=h[n],r=i.length;let s=d;if(1<r)for(let t=0;t<r;t++)s=s[i[t]];else s=s[i[0]];if(s!==e){f=!1;break}}if(f&&(s[l++]=d,n&&l===n))break}return s},n.prototype.info=function(){if(!this.g)return{id:this.id,items:this.length,cache:!(!this.cache||!this.cache.s)&&this.cache.s.length,matcher:j.length+(this.v?this.v.length:0),worker:this.g,threshold:this.threshold,depth:this.depth,resolution:this.b,contextual:this.depth&&"strict"===this.f};for(let t=0;t<this.g;t++)this.m[t].postMessage({info:!0,id:this.id})},n.prototype.clear=function(){return this.destroy().init()},n.prototype.destroy=function(){if(this.cache&&(this.j.clear(),this.j=null),this.i=this.h=this.c=null,this.a){const t=this.a.keys;for(let e=0;e<t.length;e++)this.a.index[t[e]].destroy();this.a=this.l=null}return this},n.prototype.export=function(t){const e=!t||w(t.serialize)||t.serialize;if(this.a){const e=!t||w(t.doc)||t.doc;var n=!t||w(t.index)||t.index;t=[];let i=0;if(n)for(n=this.a.keys;i<n.length;i++){const e=this.a.index[n[i]];t[i]=[e.i,e.h,Object.keys(e.c)]}e&&(t[i]=this.l)}else t=[this.i,this.h,Object.keys(this.c)];return e&&(t=JSON.stringify(t)),t},n.prototype.import=function(t,e){(!e||w(e.serialize)||e.serialize)&&(t=JSON.parse(t));const n=x();if(this.a){var i=!e||w(e.doc)||e.doc,r=0;if(!e||w(e.index)||e.index){const i=(e=this.a.keys).length;for(var s=t[0][2];r<s.length;r++)n[s[r]]=1;for(r=0;r<i;r++){s=this.a.index[e[r]];const i=t[r];i&&(s.i=i[0],s.h=i[1],s.c=n)}}i&&(this.l=b(i)?i:t[r])}else{for(i=t[2],r=0;r<i.length;r++)n[i[r]]=1;this.i=t[0],this.h=t[1],this.c=n}};const D=function(){const t=l("\\s+"),e=l("[^a-z0-9 ]"),n=[l("[-/]")," ",e,"",t," "];return function(t){return a(h(t.toLowerCase(),n))}}(),E={icase:function(t){return t.toLowerCase()},simple:function(){const t=l("\\s+"),e=l("[^a-z0-9 ]"),n=l("[-/]"),i=[l("[àáâãäå]"),"a",l("[èéêë]"),"e",l("[ìíîï]"),"i",l("[òóôõöő]"),"o",l("[ùúûüű]"),"u",l("[ýŷÿ]"),"y",l("ñ"),"n",l("[çc]"),"k",l("ß"),"s",l(" & ")," and ",n," ",e,"",t," "];return function(t){return" "===(t=h(t.toLowerCase(),i))?"":t}}(),advanced:function(){const t=l("ae"),e=l("ai"),n=l("ay"),i=l("ey"),r=l("oe"),s=l("ue"),o=l("ie"),c=l("sz"),u=l("zs"),f=l("ck"),p=l("cc"),d=[t,"a",e,"ei",n,"ei",i,"ei",r,"o",s,"u",o,"i",c,"s",u,"s",l("sh"),"s",f,"k",p,"k",l("th"),"t",l("dt"),"t",l("ph"),"f",l("pf"),"f",l("ou"),"o",l("uo"),"u"];return function(t,e){return t?(2<(t=this.simple(t)).length&&(t=h(t,d)),e||1<t.length&&(t=a(t)),t):t}}(),extra:function(){const t=[l("p"),"b",l("z"),"s",l("[cgq]"),"k",l("n"),"m",l("d"),"t",l("[vw]"),"f",l("[aeiouy]"),""];return function(e){if(!e)return e;if(1<(e=this.advanced(e,!0)).length){e=e.split(" ");for(let n=0;n<e.length;n++){const i=e[n];1<i.length&&(e[n]=i[0]+h(i.substring(1),t))}e=a(e=e.join(" "))}return e}}(),balance:D},U=function(){function t(t){this.clear(),this.H=!0!==t&&t}return t.prototype.clear=function(){this.cache=x(),this.count=x(),this.index=x(),this.s=[]},t.prototype.set=function(t,e){if(this.H&&w(this.cache[t])){let n=this.s.length;if(n===this.H){n--;const t=this.s[n];delete this.cache[t],delete this.count[t],delete this.index[t]}this.index[t]=n,this.s[n]=t,this.count[t]=-1,this.cache[t]=e,this.get(t)}else this.cache[t]=e},t.prototype.get=function(t){const e=this.cache[t];if(this.H&&e){var n=++this.count[t];const e=this.index;let r=e[t];if(0<r){const s=this.s;for(var i=r;this.count[s[--r]]<=n&&-1!==r;);if(++r!==i){for(n=i;n>r;n--)i=s[n-1],s[n]=i,e[i]=n;s[r]=t,e[t]=r}}}return e},t}();return n}(function(){const t={},e="undefined"!=typeof Blob&&"undefined"!=typeof URL&&URL.createObjectURL;return function(n,i,r,s,o){return r=e?URL.createObjectURL(new Blob(["("+r.toString()+")()"],{type:"text/javascript"})):n+".min.js",t[n+="-"+i]||(t[n]=[]),t[n][o]=new Worker(r),t[n][o].onmessage=s,t[n][o]}}()),M)})),W=window.searchTranslation,B=W.Link_previous,F=W.Link_next,z=W.Search_no_results,H=W.Search_one_character_or_more,q=W.Search_one_result,G=W.Search_results,$=W.Search_should_be_x_or_more,J=W.Search_too_short,V=B,K=F,Q=z,X=H,Y=q,Z=G,tt=$,et=J;function nt(t){var e,n=t.counter,i=t.start,r=t.settings,s=t.onPageSelect,o=Math.ceil(n/r.show),l=i/r.show;e=l<=2?Math.min(o,3):Math.min(o,l+2);for(var h=[],c=function(t){t===l?h.push(v("li",{className:"current"},t+1)):h.push(v("li",null,v("a",{className:"SearchResults__footer__link",onClick:function(){return s(t*r.show)}},t+1)))},u=0;u<e;u++)c(u);return v("div",{className:"SearchResults__footer"},v("ul",{className:"SearchResults__footer__links Pager"},i>0&&v("li",{className:"Pager--prev"},v("a",{className:"SearchResults__footer__link",onClick:function(){return s(i-r.show)}},V)),h,l+1!==o&&v("li",{className:"Pager--next"},v("a",{className:"SearchResults__footer__link",onClick:function(){return s(i+r.show)}},K))))}function it(t){var e,n=t.settings,i=t.item;return i.text&&(e=i.text.split(" ").slice(0,n.descriptiveWords).join(" "),i.text.length<e.length&&"."!==e.charAt(e.length-1)&&(e+=" ...")),v("div",{className:"SearchResult"},v("div",{className:"SearchResults__title"},v("a",{href:n.base_url+i.url},i.title)),n.showURL&&v("div",{className:"SearchResults__url"},v("a",{href:n.base_url+i.url},i.url.toLowerCase().replace(/https?:\/\//g,""))),e&&v("div",{className:"SearchResults__text"},e))}var rt=function(e){function i(e){var n;return t(this,i),(n=l(this,s(i).call(this,e))).handleClose=function(){n.props.onClose()},n.scrollTop=function(){n.resultRef&&(n.resultRef.scrollTop=0)},n.handlePaginate=function(t){n.setState({start:t},n.scrollTop)},n.handleChange=function(t){n.setState({search:t.target.value,start:0},n.scrollTop),n.props.settings.field.value=t.target.value},n.state={search:n.props.settings.field.value||"",start:0},n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&o(t,e)}(i,w),n(i,[{key:"getResults",value:function(){var t=this.props.settings,e=this.state.start,n=[],i=0,r=[];if(this.state.search.length<t.minimumLength)return n.push(et),n.push(1===t.minimumLength?X:tt.replace("!min",t.minimumLength)),{warnings:n,counter:i,results:r,start:e};var s=this.props.onSearch(this.state.search);return 0===(i=s.length)?(n.push(Q),{warnings:n,counter:i,results:r,start:e}):(t.showTitleCount&&this.props.onTitleChange("(".concat(i,")")),{warnings:n,counter:i,results:r=s.filter((function(n,i){return i>=e&&i<t.show+e})),start:e})}},{key:"render",value:function(){var t=this,e=this.props.settings,n=this.getResults(),i=n.warnings,r=n.counter,s=n.results,o=n.start;return v("div",null,v("div",{className:"SearchResultsBackdrop"}),v("div",{className:"SearchResults",ref:function(e){return t.resultRef=e}},v("input",{className:"Search__field",placeholder:"Search...",autoComplete:"on",autoSave:"text_search",type:"search",value:this.state.search,onInput:this.handleChange}),v("button",{className:"SearchResults__close",onClick:this.handleClose},"×"),v("div",{className:"SearchResults__count"},1===r?Y:Z.replace("!count",r)),i.map((function(t){return v("div",{key:t,className:"SearchResults__warning"},t)})),s.map((function(t){return v(it,{key:t.title,item:t,settings:e})})),r>e.show&&v(nt,{counter:r,start:o,settings:e,onPageSelect:this.handlePaginate})))}}]),i}(),st=document.title;function ot(t){var e=new RegExp("[?|&]".concat(t,"=([^&;]+?)(&|#|;|$)")).exec(window.location.search);return decodeURIComponent((e&&e[1]||"").replace(/\+/g,"%20"))||null}var lt=function(){function e(n){var s=this;t(this,e),this.keyUpHandler=function(t){27===t.which&&s.handleClose()},this.handleClose=function(){document.title=st,document.removeEventListener("keyup",s.keyUpHandler),document.body.classList.remove("with-search"),I(null,s.resultContainer),s.resultContainer=null},this.settings=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(n,!0).forEach((function(e){i(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(n).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({field:document.getElementById("search_input"),show:10,showURL:!0,showTitleCount:!0,minimumLength:3,descriptiveWords:25,highlightTerms:!0,highlightEveryTerm:!1,contentLocation:"daux_search_index.json"},n),this.searchIndex={pages:[]}}return n(e,[{key:"loadData",value:function(){var t=this;return this.loadingPromise||(this.loadingPromise=fetch(this.settings.base_url+this.settings.contentLocation).then((function(t){return t.json()})).then((function(e){t.searchIndex=new A({doc:{id:"url",field:["title","text","tags"]}});var n=e.pages;if(window.searchLanguage){var i="".concat(window.searchLanguage,"/");n=n.filter((function(t){return 0===t.url.indexOf(i)}))}t.searchIndex.add(n)}))),this.loadingPromise}},{key:"run",value:function(){var t=this;ot("q")&&(this.settings.field.value=ot("q"),this.loadData().then((function(){t.displaySearch()}))),this.settings.field.addEventListener("keyup",(function(e){t.loadData(),13===parseInt(e.keyCode,10)&&t.loadData().then((function(){t.displaySearch()}))}))}},{key:"displaySearch",value:function(){var t=this;this.resultContainer||(this.resultContainer=document.createElement("div"),document.body.appendChild(this.resultContainer)),document.addEventListener("keyup",this.keyUpHandler),I(v(rt,{onSearch:function(e){return t.searchIndex.search(e)},onClose:this.handleClose,onTitleChange:function(t){document.title="".concat(t," ").concat(st)},settings:this.settings}),this.resultContainer),document.body.classList.add("with-search"),document.body.scrollTop=0}}]),e}();window.search=function(t){new lt(t).run()};
|
|
//# sourceMappingURL=search.min.js.map
|