1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-09-08 05:00:39 +02:00

v0.5.3 Logical Operator

This commit is contained in:
Thomas Wilkerling
2019-02-13 13:14:26 +01:00
parent f1a162137e
commit 89125f62a3
11 changed files with 396 additions and 285 deletions

View File

@@ -1,5 +1,9 @@
# Changelog
#### v0.5.3
- Logical Operator
#### v0.5.2
- Intersect Partial Results

View File

@@ -398,7 +398,7 @@ Library Comparison: <a href="https://raw.githack.com/nextapps-de/flexsearch/mast
> __Note:__ This feature is actually not enabled by default. Read <a href="#contextual_enable">here</a> how to enable.
FlexSearch introduce a new scoring mechanism called __Contextual Search__ which was invented by Thomas Wilkerling, the author of this library. A Contextual Search <a href="https://raw.githack.com/nextapps-de/flexsearch/master/test/benchmark.html" target="_blank">incredibly boost up queries to a complete new level</a> but also requires some additionally memory (depending on ___depth___).
FlexSearch introduce a new scoring mechanism called __Contextual Search__ which was invented by <a href="https://github.com/ts-thomas" target="_blank">Thomas Wilkerling</a>, the author of this library. A Contextual Search <a href="https://raw.githack.com/nextapps-de/flexsearch/master/test/benchmark.html" target="_blank">incredibly boost up queries to a complete new level</a> but also requires some additionally memory (depending on ___depth___).
The basic idea of this concept is to limit relevance by its context instead of calculating relevance through the whole (unlimited) distance.<!--Imagine you add a text block of some sentences to an index ID. Assuming the query includes a combination of first and last word from this text block, are they really relevant to each other?-->
In this way contextual search also <a href="https://raw.githack.com/nextapps-de/flexsearch/master/test/matching.html" target="_blank">improves the results of relevance-based queries</a> on a large amount of text data.
@@ -1275,10 +1275,13 @@ var results = index.search("foobar", {
Search the same query on multiple fields:
> Using ___bool___ as a logical operator when searching through multiple fields. The default operator when not set is ___"and"___. It is planned to extend the concept of logical operators to make combinations of ___and___ / ___or___ / ___not___.
```js
var results = index.search({
query: "foobar",
field: ["title", "body"]
field: ["title", "body"],
bool: "or"
});
```
@@ -1286,7 +1289,8 @@ Could also be written as:
```js
var results = index.search("title", {
field: ["title", "body"]
field: ["title", "body"],
bool: "or"
});
```
@@ -1295,13 +1299,16 @@ Search different queries on multiple fields:
```js
var results = index.search([{
field: "title",
query: "foo"
query: "foo",
bool: "and"
},{
field: "body",
query: "bar"
query: "bar",
bool: "and"
}]);
```
<!--
Boost scoring on specific fields:
```js
@@ -1315,6 +1322,7 @@ var results = index.search([{
boost: 0.5
}]);
```
-->
<a name="where"></a>
## Find / Where
@@ -2513,6 +2521,10 @@ node compile SUPPORT_WORKER=true
</tr>
</table>
## Contribution
I would be glad about any kind of help. Feel free to contribute to this project and also feel free to contact me (https://github.com/ts-thomas) when you have any questions. There are just one simple (and maybe unusual) coding convention: all public accessible identifiers should be singular.
<a href="CHANGELOG.md">Changelog</a>
---

View File

@@ -1,28 +1,29 @@
/*
FlexSearch v0.5.2
FlexSearch v0.5.3
Copyright 2019 Nextapps GmbH
Author: Thomas Wilkerling
Released under the Apache 2.0 Licence
https://github.com/nextapps-de/flexsearch
*/
'use strict';(function(n,z,A){let x;(x=A.define)&&x.amd?x([],function(){return z}):(x=A.modules)?x[n.toLowerCase()]=z:"object"===typeof exports?module.exports=z:A[n]=z})("FlexSearch",function(){function n(b,a){const c=a?a.id:b&&b.id;this.id=c||0===c?c:T++;this.init(b,a);x(this,"index",function(){return this.f});x(this,"length",function(){return Object.keys(this.f).length})}function z(b,a){const c=b.length,d=E(a),f=[];for(let h=0,g=0;h<c;h++){const c=b[h];if(d&&a(c)||!d&&!a[c])f[g++]=c}return f}function A(b,
a,c,d,f,h){b=this.g;a=N(a,f?0:d,h,!1);{h=a.length;const c=Array(h);for(let d=0;d<h;d++)c[d]=b[a[d]];a=c}f&&(a=this.where(f,null,d,a));c&&(E(c)||(v=c.split(":"),1<v.length?c=U:(v=v[0],c=V)),a.sort(c));return a}function x(b,a,c){Object.defineProperty(b,a,{get:c})}function e(b){return new RegExp(b,"g")}function B(b,a){for(let c=0;c<a.length;c+=2)b=b.replace(a[c],a[c+1]);return b}function I(b,a,c,d,f,h,g,l){if(a[c])return a[c];f=f?(l-(g||l/1.5))*h+(g||l/1.5)*f:h;a[c]=f;f>=g&&(b=b[l-(f+.5>>0)],b=b[c]||
(b[c]=[]),b[b.length]=d);return f}function K(b,a){if(b){const c=Object.keys(b);for(let d=0,f=c.length;d<f;d++){const f=c[d],g=b[f];if(g)for(let c=0,d=g.length;c<d;c++)if(g[c]===a){1===d?delete b[f]:g.splice(c,1);break}else C(g[c])&&K(g[c],a)}}}function L(b){let a="",c="";var d="";for(let f=0;f<b.length;f++){const h=b[f];if(h!==c)if(f&&"h"===h){if(d="a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&d||" "===c)a+=h}else a+=h;d=f===b.length-
1?"":b[f+1];c=h}return a}function W(b,a){b=b.length-a.length;return 0>b?1:b?-1:0}function V(b,a){b=b[v];a=a[v];return b<a?-1:b>a?1:0}function U(b,a){const c=v.length;for(let d=0;d<c;d++)b=b[v[d]],a=a[v[d]];return b<a?-1:b>a?1:0}function N(b,a,c,d){c=[];let f;const h=b.length;if(1<h){const l=u();let e=b[0],m=e.length,k=0;for(;k<m;)l["@"+e[k++]]=1;let p,q=0,y=0;for(;++y<h;){let t=!1;const n=y===h-1;f=[];e=b[y];m=e.length;for(k=0;k<m;){p=e[k++];var g="@"+p;if(l[g]){const b=l[g];if(b===y){if(n){if(c[q++]=
p,a&&q===a)return c}else l[g]=y+1;t=!0}else d&&(g=f[b]||(f[b]=[]),g[g.length]=p)}}if(!t&&!d)break}if(d&&(q=c.length,(y=f.length)&&(!a||q<a)))for(;y--;)if(p=f[y])for(k=0,m=p.length;k<m;k++)if(c[q++]=p[k],a&&q===a)return c}else h&&(c=b[0],a&&c.length>a&&(c=c.slice(0,a)));return c}function F(b){return"string"===typeof b}function w(b){return b.constructor===Array}function E(b){return"function"===typeof b}function C(b){return"object"===typeof b}function G(b){return"undefined"===typeof b}function O(b){const a=
Array(b);for(let c=0;c<b;c++)a[c]=u();return a}function u(){return Object.create(null)}const r={encode:"icase",c:"forward",v:!1,cache:!1,async:!1,w:!1,m:!1,a:!1,s:!1,b:9,threshold:0,depth:0},P={memory:{encode:"extra",c:"strict",threshold:0,b:1},speed:{encode:"icase",c:"strict",threshold:1,b:3,depth:2},match:{encode:"extra",c:"full",threshold:1,b:3},score:{encode:"extra",c:"strict",threshold:1,b:9,depth:4},balance:{encode:"balance",c:"strict",threshold:0,b:3,depth:3},fast:{encode:"icase",c:"strict",
threshold:8,b:9,depth:1}},M=[];let T=0;const Q=/\W+/,R={},S={};n.create=function(b){return new n(b)};n.registerMatcher=function(b){for(const a in b)b.hasOwnProperty(a)&&M.push(e(a),b[a]);return this};n.registerEncoder=function(b,a){H[b]=a.bind(H);return this};n.registerLanguage=function(b,a){R[b]=a.filter;S[b]=a.stemmer;return this};n.encode=function(b,a){return H[b](a)};n.prototype.init=function(b,a){this.o=[];if(a){var c=a.preset;b=a}else b||(b=r),c=b.preset;a={};F(b)?(a=P[b],b={}):c&&(a=P[c]);
this.c=b.tokenize||a.c||this.c||r.c;this.m=b.rtl||this.m||r.m;this.async="undefined"===typeof Promise||G(c=b.async)?this.async||r.async:c;this.threshold=G(c=b.threshold)?a.threshold||this.threshold||r.threshold:c;this.b=G(c=b.resolution)?c=a.b||this.b||r.b:c;c<=this.threshold&&(this.b=this.threshold+1);this.depth=G(c=b.depth)?a.depth||this.depth||r.depth:c;this.s=G(c=b.paging)?this.s||r.s:c;this.i=(c=G(c=b.encode)?a.encode||r.encode:c)&&H[c]&&H[c].bind(H)||(E(c)?c:this.i||!1);(c=b.matcher)&&this.addMatcher(c);
if(c=b.filter){F(c)&&(c=R[c]);if(w(c)){a=this.i;var d=u();for(var f=0;f<c.length;f++){var h=a?a(c[f]):c[f];d[h]=1}c=d}this.filter=c}if(c=b.stemmer){var g;a=F(c)?S[c]:c;d=this.i;f=[];for(g in a)a.hasOwnProperty(g)&&(h=d?d(g):g,f.push(e(h+"($|\\W)"),d?d(a[g]):a[g]));this.stemmer=g=f}this.a=d=(c=b.doc)?c:this.a||r.a;this.l=O(this.b-(this.threshold||0));this.h=u();this.f=u();if(d&&(this.g=u(),b.doc=null,g=d.index={},c=d.keys=[],a=d.field,w(d.id)||(d.id=d.id.split(":")),a)){let h;w(a)||(C(a)?(h=a,d.field=
a=Object.keys(a)):d.field=a=[a]);for(d=0;d<a.length;d++)f=a[d],w(f)||(h&&(b=h[f]),c[d]=f,a[d]=f.split(":")),g[f]=new n(b),g[f].g=this.g}return this};n.prototype.encode=function(b){b&&M.length&&(b=B(b,M));b&&this.o.length&&(b=B(b,this.o));b&&this.i&&(b=this.i(b));b&&this.stemmer&&(b=B(b,this.stemmer));return b};n.prototype.addMatcher=function(b){const a=this.o;for(const c in b)b.hasOwnProperty(c)&&a.push(e(c),b[c]);return this};n.prototype.add=function(b,a,c,d,f){if(this.a&&C(b))return this.j("add",
b,a);if(a&&F(a)&&(b||0===b)){var h="@"+b;if(this.f[h]&&!d)return this.update(b,a);if(!f){if(this.async&&"function"!==typeof importScripts){let f=this;h=new Promise(function(c){setTimeout(function(){f.add(b,a,null,d,!0);f=null;c()})});if(c)h.then(c);else return h;return this}if(c)return this.add(b,a,null,d,!0),c(),this}a=this.encode(a);if(!a.length)return this;c=this.c;f=E(c)?c(a):a.split(Q);this.filter&&(f=z(f,this.filter));const p=u();p._ctx=u();const q=f.length,l=this.threshold,n=this.depth,D=this.b,
J=this.l,r=this.m;for(let a=0;a<q;a++){var g=f[a];if(g){var e=g.length,t=(r?a+1:q-a)/q,m="";switch(c){case "reverse":case "both":for(var k=e;--k;)m=g[k]+m,I(J,p,m,b,r?1:(e-k)/e,t,l,D-1);m="";case "forward":for(k=0;k<e;k++)m+=g[k],I(J,p,m,b,r?(k+1)/e:1,t,l,D-1);break;case "full":for(k=0;k<e;k++){const a=(r?k+1:e-k)/e;for(let c=e;c>k;c--)m=g.substring(k,c),I(J,p,m,b,a,t,l,D-1)}break;default:if(e=I(J,p,g,b,1,t,l,D-1),n&&1<q&&e>=l)for(e=p._ctx[g]||(p._ctx[g]=u()),g=this.h[g]||(this.h[g]=O(D-(l||0))),
t=a-n,m=a+n+1,0>t&&(t=0),m>q&&(m=q);t<m;t++)t!==a&&I(g,e,f[t],b,0,D-(t<a?a-t:t-a),l,D-1)}}}this.f[h]=1}return this};n.prototype.j=function(b,a,c){if(w(a))for(let d=0,f=a.length;d<f;d++){if(d===f-1)return this.j(b,a[d],c);this.j(b,a[d])}else{const g=this.a.index,m=this.a.keys;var d=this.a.tag,f=this.a.id;let k;let p;for(var h=0;h<f.length;h++)k=(k||a)[f[h]];if(d){for(f=0;f<d.length;f++){var e=d[f];var l=e.split(":");for(h=0;h<l.length;h++)p=(p||a)[l[h]];p="@"+p}l=this.u[e];l=l[p]||(l[p]=[])}if("remove"===
b){delete this.g[k];for(let a=0,b=m.length;a<b;a++){if(a===b-1)return g[m[a]].remove(k,c);g[m[a]].remove(k)}}f=this.a.field;l&&(l[l.length]=a);for(let h=0,l=f.length;h<l;h++){d=f[h];let p;for(e=0;e<d.length;e++)p=(p||a)[d[e]];this.g[k]=a;d=g[m[h]];e="add"===b?d.add:d.update;if(h===l-1)return e.call(d,k,p,c);e.call(d,k,p)}}};n.prototype.update=function(b,a,c){if(this.a&&C(b))return this.j("update",b,a);this.f["@"+b]&&F(a)&&(this.remove(b),this.add(b,a,c,!0));return this};n.prototype.remove=function(b,
a,c){if(this.a&&C(b))return this.j("remove",b,a);var d="@"+b;if(this.f[d]){if(!c){if(this.async&&"function"!==typeof importScripts){let c=this;d=new Promise(function(a){setTimeout(function(){c.remove(b,null,!0);c=null;a()})});if(a)d.then(a);else return d;return this}if(a)return this.remove(b,null,!0),a(),this}for(a=0;a<this.b-(this.threshold||0);a++)K(this.l[a],b);this.depth&&K(this.h,b);delete this.f[d]}return this};let v;n.prototype.search=function(b,a,c,d){if(C(a)){if(w(a))for(var f=0;f<a.length;f++)a[f].query=
b;else a.query=b;b=a;a=0}let e=b;let g,l=[];if(C(b)&&!w(b)){(c=b.callback||a)&&(e.callback=null);g=b.sort;a=b.limit;var n=b.threshold;b=b.query}if(this.a){n=this.a.index;var m=e.field;if(m)e.field=null,w(m)||(m=[m]);else if(w(e)){var k=e;m=[];for(var p=0;p<e.length;p++)m[p]=e[p].field}else m=this.a.keys;g&&(e.sort=null);p=m.length;for(var q=0;q<p;q++)k&&(e=k[q]),l[q]=n[m[q]].search(e);if(c)return c(A.call(this,b,l,g,a,void 0,void 0));if(this.async){const c=this;return new Promise(function(d){Promise.all(l).then(function(e){d(A.call(c,
b,e,g,a,void 0,void 0))})})}return A.call(this,b,l,g,a,void 0,void 0)}n||(n=this.threshold||0);E(a)?(c=a,a=1E3):a||0===a||(a=1E3);if(!d){if(this.async&&"function"!==typeof importScripts){let b=this;n=new Promise(function(c){setTimeout(function(){c(b.search(e,a,null,!0));b=null})});if(c)n.then(c);else return n;return this}if(c)return c(this.search(e,a,null,!0)),this}if(!b||!F(b))return l;e=b;e=this.encode(e);if(!e.length)return l;c=this.c;c=E(c)?c(e):e.split(Q);this.filter&&(c=z(c,this.filter));k=
c.length;d=!0;f=[];const r=u();1<k&&(this.depth?(m=!0,q=c[0],r[q]=1):c.sort(W));if(!m||(p=this.h)[q]){let a=this.b;for(let b=m?1:0;b<k;b++){const e=c[b];if(e){if(!r[e]){const b=[];let c=!1,g=0;if(q=m?p[q]:this.l){let d;for(let f=0;f<a-n;f++)if(d=q[f][e])b[g++]=d,c=!0}if(c)f[f.length]=1<g?b.concat.apply([],b):b[0];else{d=!1;break}r[e]=1}q=e}}}else d=!1;d&&(l=N(f,a,void 0,!1));return l};n.prototype.clear=function(){return this.destroy().init()};n.prototype.destroy=function(){this.l=this.h=this.f=null;
if(this.a){const b=this.a.keys;for(let a=0;a<b.length;a++)this.a.index[b[a]].destroy();this.a=this.g=null}return this};const H={icase:function(b){return b.toLowerCase()},simple:function(){const b=[e("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",e("[\u00e8\u00e9\u00ea\u00eb]"),"e",e("[\u00ec\u00ed\u00ee\u00ef]"),"i",e("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",e("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",e("[\u00fd\u0177\u00ff]"),"y",e("\u00f1"),"n",e("\u00e7"),"c",e("\u00df"),"s",e(" & ")," and ",
e("[-/]")," ",e("[^a-z0-9 ]"),"",e("\\s+")," "];return function(a){a=B(a.toLowerCase(),b);return" "===a?"":a}}(),advanced:function(){const b=[e("ae"),"a",e("ai"),"ei",e("ay"),"ei",e("ey"),"ei",e("oe"),"o",e("ue"),"u",e("ie"),"i",e("sz"),"s",e("zs"),"s",e("sh"),"s",e("ck"),"k",e("cc"),"k",e("dt"),"t",e("ph"),"f",e("pf"),"f",e("ou"),"o",e("uo"),"u"];return function(a,c){if(!a)return a;a=this.simple(a);2<a.length&&(a=B(a,b));c||1<a.length&&(a=L(a));return a}}(),extra:function(){const b=[e("p"),"b",e("z"),
"s",e("[cgq]"),"k",e("n"),"m",e("d"),"t",e("[vw]"),"f",e("[aeiouy]"),""];return function(a){if(!a)return a;a=this.advanced(a,!0);if(1<a.length){a=a.split(" ");for(let c=0;c<a.length;c++){const d=a[c];1<d.length&&(a[c]=d[0]+B(d.substring(1),b))}a=a.join(" ");a=L(a)}return a}}(),balance:function(){const b=[e("[-/]")," ",e("[^a-z0-9 ]"),"",e("\\s+")," "];return function(a){return L(B(a.toLowerCase(),b))}}()};return n}(!1),this);
'use strict';(function(k,A,B){let z;(z=B.define)&&z.amd?z([],function(){return A}):(z=B.modules)?z[k.toLowerCase()]=A:"object"===typeof exports?module.exports=A:B[k]=A})("FlexSearch",function(){function k(b,a){const c=a?a.id:b&&b.id;this.id=c||0===c?c:U++;this.init(b,a);z(this,"index",function(){return this.f});z(this,"length",function(){return Object.keys(this.f).length})}function A(b,a){const c=b.length,d=E(a),f=[];for(let g=0,h=0;g<c;g++){const c=b[g];if(d&&a(c)||!d&&!a[c])f[h++]=c}return f}function B(b,
a,c,d,f,g,h){b=this.g;a=c=M(c,a,g?0:f,h,!1);c=a.length;h=Array(c);for(let d=0;d<c;d++)h[d]=b[a[d]];c=h;g&&(c=this.where(g,null,f,c));d&&(E(d)||(x=d.split(":"),1<x.length?d=V:(x=x[0],d=W)),c.sort(d));return c}function z(b,a,c){Object.defineProperty(b,a,{get:c})}function e(b){return new RegExp(b,"g")}function C(b,a){for(let c=0;c<a.length;c+=2)b=b.replace(a[c],a[c+1]);return b}function I(b,a,c,d,f,g,h,r){if(a[c])return a[c];f=f?(r-(h||r/1.5))*g+(h||r/1.5)*f:g;a[c]=f;f>=h&&(b=b[r-(f+.5>>0)],b=b[c]||
(b[c]=[]),b[b.length]=d);return f}function J(b,a){if(b){const c=Object.keys(b);for(let d=0,f=c.length;d<f;d++){const f=c[d],h=b[f];if(h)for(let c=0,d=h.length;c<d;c++)if(h[c]===a){1===d?delete b[f]:h.splice(c,1);break}else D(h[c])&&J(h[c],a)}}}function K(b){let a="",c="";var d="";for(let f=0;f<b.length;f++){const g=b[f];if(g!==c)if(f&&"h"===g){if(d="a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&d||" "===c)a+=g}else a+=g;d=f===b.length-
1?"":b[f+1];c=g}return a}function X(b,a){b=b.length-a.length;return 0>b?1:b?-1:0}function W(b,a){b=b[x];a=a[x];return b<a?-1:b>a?1:0}function V(b,a){const c=x.length;for(let d=0;d<c;d++)b=b[x[d]],a=a[x[d]];return b<a?-1:b>a?1:0}function M(b,a,c,d,f){d=[];let g;const h=b.length;if(1<h){a="or"===a;const e=w();let p,m=-1,l,q=0,N,v,k=!0,u=0;for(;++m<h;){const n=m===h-1;p=b[m];l=p.length;if(!l){if(!a&&!f)return d;if(n&&!u)return N||d;continue}if(k){if(n)return p;for(;q<l;)e["@"+p[q++]]=1;N=p;k=!1;continue}let O=
!1;g=[];for(q=0;q<l;){v=p[q++];var r="@"+v;if(e[r]){const b=e[r];if(a||b===m){if(n){if(d[u++]=v,c&&u===c)return d}else e[r]=m+1;O=!0}else f&&(r=g[b]||(g[b]=[]),r[r.length]=v)}}if(!O&&!f)break}if(f&&(u=d.length,(m=g.length)&&(!c||u<c)))for(;m--;)if(v=g[m])for(q=0,l=v.length;q<l;q++)if(d[u++]=v[q],c&&u===c)return d}else h&&(d=b[0],c&&d.length>c&&(d=d.slice(0,c)));return d}function F(b){return"string"===typeof b}function y(b){return b.constructor===Array}function E(b){return"function"===typeof b}function D(b){return"object"===
typeof b}function G(b){return"undefined"===typeof b}function P(b){const a=Array(b);for(let c=0;c<b;c++)a[c]=w();return a}function w(){return Object.create(null)}const t={encode:"icase",c:"forward",v:!1,cache:!1,async:!1,w:!1,m:!1,a:!1,s:!1,b:9,threshold:0,depth:0},Q={memory:{encode:"extra",c:"strict",threshold:0,b:1},speed:{encode:"icase",c:"strict",threshold:1,b:3,depth:2},match:{encode:"extra",c:"full",threshold:1,b:3},score:{encode:"extra",c:"strict",threshold:1,b:9,depth:4},balance:{encode:"balance",
c:"strict",threshold:0,b:3,depth:3},fast:{encode:"icase",c:"strict",threshold:8,b:9,depth:1}},L=[];let U=0;const R=/\W+/,S={},T={};k.create=function(b){return new k(b)};k.registerMatcher=function(b){for(const a in b)b.hasOwnProperty(a)&&L.push(e(a),b[a]);return this};k.registerEncoder=function(b,a){H[b]=a.bind(H);return this};k.registerLanguage=function(b,a){S[b]=a.filter;T[b]=a.stemmer;return this};k.encode=function(b,a){return H[b](a)};k.prototype.init=function(b,a){this.o=[];if(a){var c=a.preset;
b=a}else b||(b=t),c=b.preset;a={};F(b)?(a=Q[b],b={}):c&&(a=Q[c]);this.c=b.tokenize||a.c||this.c||t.c;this.m=b.rtl||this.m||t.m;this.async="undefined"===typeof Promise||G(c=b.async)?this.async||t.async:c;this.threshold=G(c=b.threshold)?a.threshold||this.threshold||t.threshold:c;this.b=G(c=b.resolution)?c=a.b||this.b||t.b:c;c<=this.threshold&&(this.b=this.threshold+1);this.depth=G(c=b.depth)?a.depth||this.depth||t.depth:c;this.s=G(c=b.paging)?this.s||t.s:c;this.i=(c=G(c=b.encode)?a.encode||t.encode:
c)&&H[c]&&H[c].bind(H)||(E(c)?c:this.i||!1);(c=b.matcher)&&this.addMatcher(c);if(c=b.filter){F(c)&&(c=S[c]);if(y(c)){a=this.i;var d=w();for(var f=0;f<c.length;f++){var g=a?a(c[f]):c[f];d[g]=1}c=d}this.filter=c}if(c=b.stemmer){var h;a=F(c)?T[c]:c;d=this.i;f=[];for(h in a)a.hasOwnProperty(h)&&(g=d?d(h):h,f.push(e(g+"($|\\W)"),d?d(a[h]):a[h]));this.stemmer=h=f}this.a=d=(c=b.doc)?c:this.a||t.a;this.l=P(this.b-(this.threshold||0));this.h=w();this.f=w();if(d&&(this.g=w(),b.doc=null,h=d.index={},c=d.keys=
[],a=d.field,y(d.id)||(d.id=d.id.split(":")),a)){let g;y(a)||(D(a)?(g=a,d.field=a=Object.keys(a)):d.field=a=[a]);for(d=0;d<a.length;d++)f=a[d],y(f)||(g&&(b=g[f]),c[d]=f,a[d]=f.split(":")),h[f]=new k(b),h[f].g=this.g}return this};k.prototype.encode=function(b){b&&L.length&&(b=C(b,L));b&&this.o.length&&(b=C(b,this.o));b&&this.i&&(b=this.i(b));b&&this.stemmer&&(b=C(b,this.stemmer));return b};k.prototype.addMatcher=function(b){const a=this.o;for(const c in b)b.hasOwnProperty(c)&&a.push(e(c),b[c]);return this};
k.prototype.add=function(b,a,c,d,f){if(this.a&&D(b))return this.j("add",b,a);if(a&&F(a)&&(b||0===b)){var g="@"+b;if(this.f[g]&&!d)return this.update(b,a);if(!f){if(this.async&&"function"!==typeof importScripts){let f=this;g=new Promise(function(c){setTimeout(function(){f.add(b,a,null,d,!0);f=null;c()})});if(c)g.then(c);else return g;return this}if(c)return this.add(b,a,null,d,!0),c(),this}a=this.encode(a);if(!a.length)return this;c=this.c;f=E(c)?c(a):a.split(R);this.filter&&(f=A(f,this.filter));const l=
w();l._ctx=w();const q=f.length,r=this.threshold,v=this.depth,k=this.b,u=this.l,t=this.m;for(let a=0;a<q;a++){var h=f[a];if(h){var e=h.length,n=(t?a+1:q-a)/q,p="";switch(c){case "reverse":case "both":for(var m=e;--m;)p=h[m]+p,I(u,l,p,b,t?1:(e-m)/e,n,r,k-1);p="";case "forward":for(m=0;m<e;m++)p+=h[m],I(u,l,p,b,t?(m+1)/e:1,n,r,k-1);break;case "full":for(m=0;m<e;m++){const a=(t?m+1:e-m)/e;for(let c=e;c>m;c--)p=h.substring(m,c),I(u,l,p,b,a,n,r,k-1)}break;default:if(e=I(u,l,h,b,1,n,r,k-1),v&&1<q&&e>=r)for(e=
l._ctx[h]||(l._ctx[h]=w()),h=this.h[h]||(this.h[h]=P(k-(r||0))),n=a-v,p=a+v+1,0>n&&(n=0),p>q&&(p=q);n<p;n++)n!==a&&I(h,e,f[n],b,0,k-(n<a?a-n:n-a),r,k-1)}}}this.f[g]=1}return this};k.prototype.j=function(b,a,c){if(y(a))for(let d=0,f=a.length;d<f;d++){if(d===f-1)return this.j(b,a[d],c);this.j(b,a[d])}else{const n=this.a.index,k=this.a.keys;var d=this.a.tag,f=this.a.id;let m;let l;for(var g=0;g<f.length;g++)m=(m||a)[f[g]];if(d){for(f=0;f<d.length;f++){var h=d[f];var e=h.split(":");for(g=0;g<e.length;g++)l=
(l||a)[e[g]];l="@"+l}e=this.u[h];e=e[l]||(e[l]=[])}if("remove"===b){delete this.g[m];for(let a=0,b=k.length;a<b;a++){if(a===b-1)return n[k[a]].remove(m,c);n[k[a]].remove(m)}}f=this.a.field;e&&(e[e.length]=a);for(let e=0,g=f.length;e<g;e++){d=f[e];let l;for(h=0;h<d.length;h++)l=(l||a)[d[h]];this.g[m]=a;d=n[k[e]];h="add"===b?d.add:d.update;if(e===g-1)return h.call(d,m,l,c);h.call(d,m,l)}}};k.prototype.update=function(b,a,c){if(this.a&&D(b))return this.j("update",b,a);this.f["@"+b]&&F(a)&&(this.remove(b),
this.add(b,a,c,!0));return this};k.prototype.remove=function(b,a,c){if(this.a&&D(b))return this.j("remove",b,a);var d="@"+b;if(this.f[d]){if(!c){if(this.async&&"function"!==typeof importScripts){let c=this;d=new Promise(function(a){setTimeout(function(){c.remove(b,null,!0);c=null;a()})});if(a)d.then(a);else return d;return this}if(a)return this.remove(b,null,!0),a(),this}for(a=0;a<this.b-(this.threshold||0);a++)J(this.l[a],b);this.depth&&J(this.h,b);delete this.f[d]}return this};let x;k.prototype.search=
function(b,a,c,d){if(D(a)){if(y(a))for(var e=0;e<a.length;e++)a[e].query=b;else a.query=b;b=a;a=0}let g=b;let h=[];if(D(b)&&!y(b)){(c=b.callback||a)&&(g.callback=null);a=b.limit;var k=b.threshold;b=b.query}if(this.a){let d=!1,e=g.bool,f=g.sort;k=this.a.index;var n=g.field;if(n)g.field=null,y(n)||(n=[n]);else if(y(g)){var p=g;n=[];for(var m=0;m<g.length;m++){var l=g[m];n[m]=l.field;e=l.bool;f=l.sort;d=!1}}else n=this.a.keys;m=n.length;for(l=0;l<m;l++)p&&(g=p[l]),h[l]=k[n[l]].search(g);if(c)return c(B.call(this,
b,e,h,f,a,d,void 0));if(this.async){const c=this;return new Promise(function(g){Promise.all(h).then(function(h){g(B.call(c,b,e,h,f,a,d,void 0))})})}return B.call(this,b,e,h,f,a,d,void 0)}k||(k=this.threshold||0);E(a)?(c=a,a=1E3):a||0===a||(a=1E3);if(!d){if(this.async&&"function"!==typeof importScripts){let b=this;k=new Promise(function(c){setTimeout(function(){c(b.search(g,a,null,!0));b=null})});if(c)k.then(c);else return k;return this}if(c)return c(this.search(g,a,null,!0)),this}if(!b||!F(b))return h;
g=b;g=this.encode(g);if(!g.length)return h;c=this.c;c=E(c)?c(g):g.split(R);this.filter&&(c=A(c,this.filter));p=c.length;d=!0;e=[];const q=w();1<p&&(this.depth?(n=!0,l=c[0],q[l]=1):c.sort(X));if(!n||(m=this.h)[l]){let a=this.b;for(let b=n?1:0;b<p;b++){const f=c[b];if(f){if(!q[f]){const b=[];let c=!1,g=0;if(l=n?m[l]:this.l){let d;for(let e=0;e<a-k;e++)if(d=l[e][f])b[g++]=d,c=!0}if(c)e[e.length]=1<g?b.concat.apply([],b):b[0];else{d=!1;break}q[f]=1}l=f}}}else d=!1;this.a||d&&(h=M(e,!1,a,void 0,!1));return h};
k.prototype.clear=function(){return this.destroy().init()};k.prototype.destroy=function(){this.l=this.h=this.f=null;if(this.a){const b=this.a.keys;for(let a=0;a<b.length;a++)this.a.index[b[a]].destroy();this.a=this.g=null}return this};const H={icase:function(b){return b.toLowerCase()},simple:function(){const b=[e("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",e("[\u00e8\u00e9\u00ea\u00eb]"),"e",e("[\u00ec\u00ed\u00ee\u00ef]"),"i",e("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",e("[\u00f9\u00fa\u00fb\u00fc\u0171]"),
"u",e("[\u00fd\u0177\u00ff]"),"y",e("\u00f1"),"n",e("\u00e7"),"c",e("\u00df"),"s",e(" & ")," and ",e("[-/]")," ",e("[^a-z0-9 ]"),"",e("\\s+")," "];return function(a){a=C(a.toLowerCase(),b);return" "===a?"":a}}(),advanced:function(){const b=[e("ae"),"a",e("ai"),"ei",e("ay"),"ei",e("ey"),"ei",e("oe"),"o",e("ue"),"u",e("ie"),"i",e("sz"),"s",e("zs"),"s",e("sh"),"s",e("ck"),"k",e("cc"),"k",e("dt"),"t",e("ph"),"f",e("pf"),"f",e("ou"),"o",e("uo"),"u"];return function(a,c){if(!a)return a;a=this.simple(a);
2<a.length&&(a=C(a,b));c||1<a.length&&(a=K(a));return a}}(),extra:function(){const b=[e("p"),"b",e("z"),"s",e("[cgq]"),"k",e("n"),"m",e("d"),"t",e("[vw]"),"f",e("[aeiouy]"),""];return function(a){if(!a)return a;a=this.advanced(a,!0);if(1<a.length){a=a.split(" ");for(let c=0;c<a.length;c++){const d=a[c];1<d.length&&(a[c]=d[0]+C(d.substring(1),b))}a=a.join(" ");a=K(a)}return a}}(),balance:function(){const b=[e("[-/]")," ",e("[^a-z0-9 ]"),"",e("\\s+")," "];return function(a){return K(C(a.toLowerCase(),
b))}}()};return k}(!1),this);

View File

@@ -1,45 +1,46 @@
/*
FlexSearch v0.5.2
FlexSearch v0.5.3
Copyright 2019 Nextapps GmbH
Author: Thomas Wilkerling
Released under the Apache 2.0 Licence
https://github.com/nextapps-de/flexsearch
*/
'use strict';function S(h){var l=0;return function(){return l<h.length?{done:!1,value:h[l++]}:{done:!0}}}function T(h){var l="undefined"!=typeof Symbol&&Symbol.iterator&&h[Symbol.iterator];return l?l.call(h):{next:S(h)}}var Z="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(h,l,f){h!=Array.prototype&&h!=Object.prototype&&(h[l]=f.value)};
function ba(h,l){if(l){var f=Z;h=h.split(".");for(var m=0;m<h.length-1;m++){var A=h[m];A in f||(f[A]={});f=f[A]}h=h[h.length-1];m=f[h];l=l(m);l!=m&&null!=l&&aa(f,h,{configurable:!0,writable:!0,value:l})}}
ba("Promise",function(h){function l(d){this.g=0;this.s=void 0;this.b=[];var e=this.j();try{d(e.resolve,e.reject)}catch(t){e.reject(t)}}function f(){this.b=null}function m(d){return d instanceof l?d:new l(function(e){e(d)})}if(h)return h;f.prototype.g=function(d){if(null==this.b){this.b=[];var e=this;this.j(function(){e.s()})}this.b.push(d)};var A=Z.setTimeout;f.prototype.j=function(d){A(d,0)};f.prototype.s=function(){for(;this.b&&this.b.length;){var d=this.b;this.b=[];for(var e=0;e<d.length;++e){var f=
d[e];d[e]=null;try{f()}catch(H){this.l(H)}}}this.b=null};f.prototype.l=function(d){this.j(function(){throw d;})};l.prototype.j=function(){function d(d){return function(l){f||(f=!0,d.call(e,l))}}var e=this,f=!1;return{resolve:d(this.N),reject:d(this.l)}};l.prototype.N=function(d){if(d===this)this.l(new TypeError("A Promise cannot resolve to itself"));else if(d instanceof l)this.O(d);else{a:switch(typeof d){case "object":var e=null!=d;break a;case "function":e=!0;break a;default:e=!1}e?this.M(d):this.w(d)}};
l.prototype.M=function(d){var e=void 0;try{e=d.then}catch(t){this.l(t);return}"function"==typeof e?this.P(e,d):this.w(d)};l.prototype.l=function(d){this.B(2,d)};l.prototype.w=function(d){this.B(1,d)};l.prototype.B=function(d,e){if(0!=this.g)throw Error("Cannot settle("+d+", "+e+"): Promise already settled in state"+this.g);this.g=d;this.s=e;this.J()};l.prototype.J=function(){if(null!=this.b){for(var d=0;d<this.b.length;++d)J.g(this.b[d]);this.b=null}};var J=new f;l.prototype.O=function(d){var e=this.j();
d.G(e.resolve,e.reject)};l.prototype.P=function(d,e){var f=this.j();try{d.call(e,f.resolve,f.reject)}catch(H){f.reject(H)}};l.prototype.then=function(d,e){function f(e,d){return"function"==typeof e?function(d){try{h(e(d))}catch(O){m(O)}}:d}var h,m,A=new l(function(e,d){h=e;m=d});this.G(f(d,h),f(e,m));return A};l.prototype.catch=function(d){return this.then(void 0,d)};l.prototype.G=function(d,e){function f(){switch(l.g){case 1:d(l.s);break;case 2:e(l.s);break;default:throw Error("Unexpected state: "+
l.g);}}var l=this;null==this.b?J.g(f):this.b.push(f)};l.resolve=m;l.reject=function(d){return new l(function(e,f){f(d)})};l.race=function(d){return new l(function(e,f){for(var l=T(d),h=l.next();!h.done;h=l.next())m(h.value).G(e,f)})};l.all=function(d){var e=T(d),f=e.next();return f.done?m([]):new l(function(d,l){function h(e){return function(f){A[e]=f;t--;0==t&&d(A)}}var A=[],t=0;do A.push(void 0),t++,m(f.value).G(h(A.length-1),l),f=e.next();while(!f.done)})};return l});
(function(h,l,f){var m;(m=f.define)&&m.amd?m([],function(){return l}):(m=f.modules)?m[h.toLowerCase()]=l:"object"===typeof exports?module.exports=l:f[h]=l})("FlexSearch",function fa(h){function f(a,b){var c=b?b.id:a&&a.id;this.id=c||0===c?c:ha++;this.init(a,b);d(this,"index",function(){return this.c});d(this,"length",function(){return Object.keys(this.c).length})}function m(a,b,c,g){this.F!==this.i&&(this.A=this.A.concat(c),this.F++,g&&this.A.length>=g&&(this.F=this.i),this.F===this.i&&(this.cache&&
this.v.set(b,this.A),this.I&&this.I(this.A)));return this}function A(a,b){for(var c=a.length,g=M(b),k=[],p=0,e=0;p<c;p++){var f=a[p];if(g&&b(f)||!g&&!b[f])k[e++]=f}return k}function J(a,b,c,g,k,p){var e=this.m;b=O(b,k?0:g,p,this.D);p=b.length;for(var f=Array(p),d=0;d<p;d++)f[d]=e[b[d]];b=f;k&&(b=this.where(k,null,g,b));c&&(M(c)||(G=c.split(":"),1<G.length?c=ea:(G=G[0],c=da)),b.sort(c));this.cache&&this.v.set(a,b);return b}function d(a,b,c){Object.defineProperty(a,b,{get:c})}function e(a){return new RegExp(a,
"g")}function t(a,b){for(var c=0;c<b.length;c+=2)a=a.replace(b[c],b[c+1]);return a}function H(a,b,c,g,k,p,e,f){if(b[c])return b[c];k=k?(f-(e||f/1.5))*p+(e||f/1.5)*k:p;b[c]=k;k>=e&&(a=a[f-(k+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=g);return k}function Q(a,b){if(a)for(var c=Object.keys(a),g=0,k=c.length;g<k;g++){var p=c[g],e=a[p];if(e)for(var f=0,d=e.length;f<d;f++)if(e[f]===b){1===d?delete a[p]:e.splice(f,1);break}else K(e[f])&&Q(e[f],b)}}function R(a){for(var b="",c="",g="",k=0;k<a.length;k++){var p=
a[k];if(p!==c)if(k&&"h"===p){if(g="a"===g||"e"===g||"i"===g||"o"===g||"u"===g||"y"===g,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&g||" "===c)b+=p}else b+=p;g=k===a.length-1?"":a[k+1];c=p}return b}function ca(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function da(a,b){a=a[G];b=b[G];return a<b?-1:a>b?1:0}function ea(a,b){for(var c=G.length,g=0;g<c;g++)a=a[G[g]],b=b[G[g]];return a<b?-1:a>b?1:0}function O(a,b,c,g){c=[];var k=a.length;if(1<k){for(var p=C(),e=a[0],f=e.length,d=0;d<f;)p["@"+
e[d++]]=1;for(var h,q=0,n=0;++n<k;){var m=!1,v=n===k-1;var B=[];e=a[n];f=e.length;for(d=0;d<f;){h=e[d++];var y="@"+h;if(p[y]){var x=p[y];if(x===n){if(v){if(c[q++]=h,b&&q===b)return c}else p[y]=n+1;m=!0}else g&&(y=B[x]||(B[x]=[]),y[y.length]=h)}}if(!m&&!g)break}if(g&&(q=c.length,(n=B.length)&&(!b||q<b)))for(;n--;)if(h=B[n])for(d=0,f=h.length;d<f;d++)if(c[q++]=h[d],b&&q===b)return c}else k&&(c=a[0],b&&c.length>b&&(c=c.slice(0,b)));return c}function L(a){return"string"===typeof a}function I(a){return a.constructor===
Array}function M(a){return"function"===typeof a}function K(a){return"object"===typeof a}function F(a){return"undefined"===typeof a}function U(a){for(var b=Array(a),c=0;c<a;c++)b[c]=C();return b}function C(){return Object.create(null)}function ia(){var a,b;self.onmessage=function(c){if(c=c.data)if(c.search){var g=b.search(c.content,c.threshold?{limit:c.limit,threshold:c.threshold,where:c.where}:c.limit);self.postMessage({id:a,content:c.content,limit:c.limit,result:g})}else c.add?b.add(c.id,c.content):
c.update?b.update(c.id,c.content):c.remove?b.remove(c.id):c.clear?b.clear():c.info?(c=b.info(),c.worker=a,console.log(c)):c.register&&(a=c.id,c.options.cache=!1,c.options.async=!1,c.options.worker=!1,b=(new Function(c.register.substring(c.register.indexOf("{")+1,c.register.lastIndexOf("}"))))(),b=new b(c.options))}}function ja(a,b,c,g){a=h("flexsearch","id"+a,ia,function(a){(a=a.data)&&a.result&&g(a.id,a.content,a.result,a.limit,a.where,a.cursor,a.suggest)},b);var k=fa.toString();c.id=b;a.postMessage({register:k,
options:c,id:b});return a}var z={encode:"icase",h:"forward",D:!1,cache:!1,async:!1,i:!1,H:!1,a:!1,L:!1,f:9,threshold:0,depth:0},V={memory:{encode:"extra",h:"strict",threshold:0,f:1},speed:{encode:"icase",h:"strict",threshold:1,f:3,depth:2},match:{encode:"extra",h:"full",threshold:1,f:3},score:{encode:"extra",h:"strict",threshold:1,f:9,depth:4},balance:{encode:"balance",h:"strict",threshold:0,f:3,depth:3},fast:{encode:"icase",h:"strict",threshold:8,f:9,depth:1}},P=[],ha=0,W=/\W+/,X={},Y={};f.create=
function(a){return new f(a)};f.registerMatcher=function(a){for(var b in a)a.hasOwnProperty(b)&&P.push(e(b),a[b]);return this};f.registerEncoder=function(a,b){N[a]=b.bind(N);return this};f.registerLanguage=function(a,b){X[a]=b.filter;Y[a]=b.stemmer;return this};f.encode=function(a,b){return N[a](b)};f.prototype.init=function(a,b){this.g=[];if(b){var c=b.preset;a=b}else a||(a=z),c=a.preset;b={};L(a)?((b=V[a])||console.warn("Preset not found: "+a),a={}):c&&((b=V[c])||console.warn("Preset not found: "+
c));if(c=a.worker)if("undefined"===typeof Worker)a.worker=!1,this.b=null;else{var g=parseInt(c,10)||4;this.w=-1;this.F=0;this.A=[];this.I=null;this.b=Array(g);for(var k=0;k<g;k++)this.b[k]=ja(this.id,k,a,m.bind(this))}this.h=a.tokenize||b.h||this.h||z.h;this.H=a.rtl||this.H||z.H;this.async="undefined"===typeof Promise||F(c=a.async)?this.async||z.async:c;this.i=F(c=a.worker)?this.i||z.i:c;this.threshold=F(c=a.threshold)?b.threshold||this.threshold||z.threshold:c;this.f=F(c=a.resolution)?c=b.f||this.f||
z.f:c;c<=this.threshold&&(this.f=this.threshold+1);this.depth=F(c=a.depth)?b.depth||this.depth||z.depth:c;this.L=F(c=a.paging)?this.L||z.L:c;this.D=F(c=a.suggest)?this.D||z.D:c;this.j=(c=F(c=a.encode)?b.encode||z.encode:c)&&N[c]&&N[c].bind(N)||(M(c)?c:this.j||!1);(c=a.matcher)&&this.addMatcher(c);if(c=a.filter){L(c)&&(c=X[c]);if(I(c)){b=this.j;g=C();for(k=0;k<c.length;k++){var p=b?b(c[k]):c[k];g[p]=1}c=g}this.filter=c}if(c=a.stemmer){b=L(c)?Y[c]:c;g=this.j;k=[];for(var d in b)b.hasOwnProperty(d)&&
(p=g?g(d):d,k.push(e(p+"($|\\W)"),g?g(b[d]):b[d]));this.stemmer=k}this.a=k=(c=a.doc)?c:this.a||z.a;this.o=U(this.f-(this.threshold||0));this.u=C();this.c=C();if(k){this.m=C();a.doc=null;d=k.index={};b=k.keys=[];g=k.field;p=k.tag;I(k.id)||(k.id=k.id.split(":"));if(p){this.B=C();var h=C();if(g)if(L(g))h[g]=a;else if(I(g))for(var u=0;u<g.length;u++)h[g[u]]=a;else K(g)&&(h=g);I(p)||(k.tag=p=[p]);for(g=0;g<p.length;g++)this.B[p[g]]=C();this.J=p;g=h}if(g){if(!I(g))if(K(g)){var r=g;k.field=g=Object.keys(g)}else k.field=
g=[g];for(k=0;k<g.length;k++)p=g[k],I(p)||(r&&(a=r[p]),b[k]=p,g[k]=p.split(":")),d[p]=new f(a),d[p].m=this.m}}this.s=!0;this.v=(this.cache=c=F(c=a.cache)?this.cache||z.cache:c)?new ka(c):!1;return this};f.prototype.encode=function(a){a&&P.length&&(a=t(a,P));a&&this.g.length&&(a=t(a,this.g));a&&this.j&&(a=this.j(a));a&&this.stemmer&&(a=t(a,this.stemmer));return a};f.prototype.addMatcher=function(a){var b=this.g,c;for(c in a)a.hasOwnProperty(c)&&b.push(e(c),a[c]);return this};f.prototype.add=function(a,
b,c,g,k){if(this.a&&K(a))return this.l("add",a,b);if(b&&L(b)&&(a||0===a)){var e="@"+a;if(this.c[e]&&!g)return this.update(a,b);if(this.i)return++this.w>=this.b.length&&(this.w=0),this.b[this.w].postMessage({add:!0,id:a,content:b}),this.c[e]=""+this.w,c&&c(),this;if(!k){if(this.async&&"function"!==typeof importScripts){var f=this;e=new Promise(function(c){setTimeout(function(){f.add(a,b,null,g,!0);f=null;c()})});if(c)e.then(c);else return e;return this}if(c)return this.add(a,b,null,g,!0),c(),this}b=
this.encode(b);if(!b.length)return this;c=this.h;k=M(c)?c(b):b.split(W);this.filter&&(k=A(k,this.filter));var d=C();d._ctx=C();for(var h=k.length,r=this.threshold,q=this.depth,n=this.f,m=this.o,v=this.H,B=0;B<h;B++){var y=k[B];if(y){var x=y.length,D=(v?B+1:h-B)/h,E="";switch(c){case "reverse":case "both":for(var w=x;--w;)E=y[w]+E,H(m,d,E,a,v?1:(x-w)/x,D,r,n-1);E="";case "forward":for(w=0;w<x;w++)E+=y[w],H(m,d,E,a,v?(w+1)/x:1,D,r,n-1);break;case "full":for(w=0;w<x;w++)for(var t=(v?w+1:x-w)/x,z=x;z>
w;z--)E=y.substring(w,z),H(m,d,E,a,t,D,r,n-1);break;default:if(x=H(m,d,y,a,1,D,r,n-1),q&&1<h&&x>=r)for(x=d._ctx[y]||(d._ctx[y]=C()),y=this.u[y]||(this.u[y]=U(n-(r||0))),D=B-q,E=B+q+1,0>D&&(D=0),E>h&&(E=h);D<E;D++)D!==B&&H(y,x,k[D],a,0,n-(D<B?B-D:D-B),r,n-1)}}}this.c[e]=1;this.s=!1}return this};f.prototype.l=function(a,b,c){if(I(b))for(var g=0,e=b.length;g<e;g++){if(g===e-1)return this.l(a,b[g],c);this.l(a,b[g])}else{g=this.a.index;e=this.a.keys;for(var d=this.a.tag,f=this.a.id,h,u,r,q,n=0;n<f.length;n++)h=
(h||b)[f[n]];if(d){for(f=0;f<d.length;f++){r=d[f];u=r.split(":");for(n=0;n<u.length;n++)q=(q||b)[u[n]];q="@"+q}u=this.B[r];u=u[q]||(u[q]=[])}if("remove"===a)for(delete this.m[h],f=0,d=e.length;f<d;f++){if(f===d-1)return g[e[f]].remove(h,c);g[e[f]].remove(h)}f=this.a.field;u&&(u[u.length]=b);d=0;for(r=f.length;d<r;d++){u=f[d];q=void 0;for(n=0;n<u.length;n++)q=(q||b)[u[n]];this.m[h]=b;u=g[e[d]];n="add"===a?u.add:u.update;if(d===r-1)return n.call(u,h,q,c);n.call(u,h,q)}}};f.prototype.update=function(a,
b,c){if(this.a&&K(a))return this.l("update",a,b);this.c["@"+a]&&L(b)&&(this.remove(a),this.add(a,b,c,!0));return this};f.prototype.remove=function(a,b,c){if(this.a&&K(a))return this.l("remove",a,b);var g="@"+a;if(this.c[g]){if(this.i)return this.b[this.c[g]].postMessage({remove:!0,id:a}),delete this.c[g],b&&b(),this;if(!c){if(this.async&&"function"!==typeof importScripts){var e=this;g=new Promise(function(b){setTimeout(function(){e.remove(a,null,!0);e=null;b()})});if(b)g.then(b);else return g;return this}if(b)return this.remove(a,
null,!0),b(),this}for(b=0;b<this.f-(this.threshold||0);b++)Q(this.o[b],a);this.depth&&Q(this.u,a);delete this.c[g];this.s=!1}return this};var G;f.prototype.search=function(a,b,c,g){if(K(b)){if(I(b))for(var e=0;e<b.length;e++)b[e].query=a;else b.query=a;a=b;b=0}var d=a,f=[];if(K(a)&&!I(a)){(c=a.callback||b)&&(d.callback=null);var h=a.sort;var u=a.where;b=a.limit;var r=a.threshold;a=a.query}if(this.a){r=this.a.index;var q=d.field;if(q)d.field=null,I(q)||(q=[q]);else if(I(d)){var n=d;q=[];for(var m=
0;m<d.length;m++)q[m]=d[m].field}else q=this.a.keys;h&&(d.sort=null);m=q.length;for(var v=0;v<m;v++)n&&(d=n[v]),f[v]=r[q[v]].search(d);if(c)return c(J.call(this,a,f,h,b,u,void 0));if(this.async){var B=this;return new Promise(function(c){Promise.all(f).then(function(g){c(J.call(B,a,g,h,b,u,void 0))})})}return J.call(this,a,f,h,b,u,void 0)}r||(r=this.threshold||0);M(b)?(c=b,b=1E3):b||0===b||(b=1E3);if(this.i)for(this.I=c,this.F=0,this.A=[],q=0;q<this.i;q++)this.b[q].postMessage({search:!0,limit:b,cursor:void 0,
threshold:r,where:u,content:a});else{if(!g){if(this.async&&"function"!==typeof importScripts){var y=this;r=new Promise(function(a){setTimeout(function(){a(y.search(d,b,null,!0));y=null})});if(c)r.then(c);else return r;return this}if(c)return c(this.search(d,b,null,!0)),this}if(!a||!L(a))return f;d=a;if(this.cache)if(this.s){if(c=this.v.get(a))return c}else this.v.clear(),this.s=!0;d=this.encode(d);if(!d.length)return f;c=this.h;c=M(c)?c(d):d.split(W);this.filter&&(c=A(c,this.filter));n=c.length;g=
!0;e=[];var x=C();1<n&&(this.depth?(q=!0,v=c[0],x[v]=1):c.sort(ca));if(!q||(m=this.u)[v])for(var D=this.f,E=q?1:0;E<n;E++){var w=c[E];if(w){if(!x[w]){var t=[],z=!1,F=0;if(v=q?m[v]:this.o)for(var H=void 0,G=0;G<D-r;G++)if(H=v[G][w])t[F++]=H,z=!0;if(z)e[e.length]=1<F?t.concat.apply([],t):t[0];else if(!this.D){g=!1;break}x[w]=1}v=w}}else g=!1;g&&(f=O(e,b,void 0,this.D));this.cache&&!this.a&&this.v.set(a,f);return f}};f.prototype.find=function(a,b){return this.where(a,b,1)[0]||null};f.prototype.where=
function(a,b,c,g){var d=g||this.m,e=[],f=0,h;if("number"===typeof a)return[d[a]];if(L(a)){if(F(b))return[d[a]];if("id"===a)return[d[b]];var m=1;var r=[a.split(":")];var q=!0}else{if(M(a)){b=g||Object.keys(d);c=b.length;for(h=0;h<c;h++)m=g?g[h]:d[b[h]],a(m)&&(e[f++]=m);return e}c||(c=b);h=Object.keys(a);m=h.length;q=!1;if(1===m&&"id"===h[0])return[d[a.id]];if((r=this.J)&&!g)for(var n=0;n<r.length;n++){var t=r[n],v=a[t];if(!F(v)){g=this.B[t]["@"+v];if(0===--m)return g;h.splice(h.indexOf(t),1);delete a[t];
break}}r=Array(m);for(n=0;n<m;n++)r[n]=h[n].split(":")}n=g||Object.keys(d);t=n.length;for(v=0;v<t;v++){for(var B=g?g[v]:d[n[v]],y=!0,x=0;x<m;x++){q||(b=a[h[x]]);var z=r[x],A=z.length,w=B;if(1<A)for(var C=0;C<A;C++)w=w[z[C]];else w=w[z[0]];if(w!==b){y=!1;break}}if(y&&(e[f++]=B,c&&f===c))break}return e};f.prototype.info=function(){if(this.i)for(var a=0;a<this.i;a++)this.b[a].postMessage({info:!0,id:this.id});else{for(var b,c=0,d=0,e=0,f=0;f<this.f-(this.threshold||0);f++){a=Object.keys(this.o[f]);for(var h=
0;h<a.length;h++)b=this.o[f][a[h]].length,c+=1*b+2*a[h].length+4,d+=b,e+=2*a[h].length}a=Object.keys(this.c);b=a.length;for(f=0;f<b;f++)c+=2*a[f].length+2;return{id:this.id,memory:c,items:b,sequences:d,chars:e,cache:this.cache&&this.cache.C?this.cache.C.length:!1,matcher:P.length+(this.g?this.g.length:0),worker:this.i,threshold:this.threshold,depth:this.depth,contextual:this.depth&&"strict"===this.h}}};f.prototype.clear=function(){return this.destroy().init()};f.prototype.destroy=function(){this.cache&&
(this.v.clear(),this.v=null);this.o=this.u=this.c=null;if(this.a){for(var a=this.a.keys,b=0;b<a.length;b++)this.a.index[a[b]].destroy();this.a=this.m=null}return this};f.prototype.export=function(){if(this.a){for(var a=this.a.keys,b=Array(a.length+1),c=0;c<a.length;c++){var d=this.a.index[a[c]];b[c]=[d.o,d.u,d.c]}b[c]=this.m;return JSON.stringify(b)}return JSON.stringify([this.o,this.u,this.c])};f.prototype.import=function(a){a=JSON.parse(a);if(this.a){for(var b=this.a.keys,c=b.length,d=0;d<c;d++){var e=
this.a.index[b[d]];e.o=a[d][0];e.u=a[d][1];e.c=a[d][2];e.m=a[c]}this.m=a[c]}else this.o=a[0],this.u=a[1],this.c=a[2]};var N={icase:function(a){return a.toLowerCase()},simple:function(){var a=[e("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",e("[\u00e8\u00e9\u00ea\u00eb]"),"e",e("[\u00ec\u00ed\u00ee\u00ef]"),"i",e("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",e("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",e("[\u00fd\u0177\u00ff]"),"y",e("\u00f1"),"n",e("\u00e7"),"c",e("\u00df"),"s",e(" & ")," and ",e("[-/]"),
" ",e("[^a-z0-9 ]"),"",e("\\s+")," "];return function(b){b=t(b.toLowerCase(),a);return" "===b?"":b}}(),advanced:function(){var a=[e("ae"),"a",e("ai"),"ei",e("ay"),"ei",e("ey"),"ei",e("oe"),"o",e("ue"),"u",e("ie"),"i",e("sz"),"s",e("zs"),"s",e("sh"),"s",e("ck"),"k",e("cc"),"k",e("dt"),"t",e("ph"),"f",e("pf"),"f",e("ou"),"o",e("uo"),"u"];return function(b,c){if(!b)return b;b=this.simple(b);2<b.length&&(b=t(b,a));c||1<b.length&&(b=R(b));return b}}(),extra:function(){var a=[e("p"),"b",e("z"),"s",e("[cgq]"),
"k",e("n"),"m",e("d"),"t",e("[vw]"),"f",e("[aeiouy]"),""];return function(b){if(!b)return b;b=this.advanced(b,!0);if(1<b.length){b=b.split(" ");for(var c=0;c<b.length;c++){var d=b[c];1<d.length&&(b[c]=d[0]+t(d.substring(1),a))}b=b.join(" ");b=R(b)}return b}}(),balance:function(){var a=[e("[-/]")," ",e("[^a-z0-9 ]"),"",e("\\s+")," "];return function(b){return R(t(b.toLowerCase(),a))}}()},ka=function(){function a(a){this.clear();this.K=!0!==a&&a}a.prototype.clear=function(){this.cache=C();this.count=
C();this.index=C();this.C=[]};a.prototype.set=function(a,c){if(this.K&&F(this.cache[a])){var b=this.C.length;if(b===this.K){b--;var d=this.C[b];delete this.cache[d];delete this.count[d];delete this.index[d]}this.index[a]=b;this.C[b]=a;this.count[a]=-1;this.cache[a]=c;this.get(a)}else this.cache[a]=c};a.prototype.get=function(a){var b=this.cache[a];if(this.K&&b){var d=++this.count[a],e=this.index,f=e[a];if(0<f){for(var h=this.C,m=f;this.count[h[--f]]<=d&&-1!==f;);f++;if(f!==m){for(d=m;d>f;d--)m=h[d-
1],h[d]=m,e[m]=d;h[f]=a;e[a]=f}}}return b};return a}();return f}(function(){var h={},l="undefined"!==typeof Blob&&"undefined"!==typeof URL&&URL.createObjectURL;return function(f,m,A,J,d){A=l?URL.createObjectURL(new Blob(["("+A.toString()+")()"],{type:"text/javascript"})):f+".es5.js";f+="-"+m;h[f]||(h[f]=[]);h[f][d]=new Worker(A);h[f][d].onmessage=J;console.log("Register Worker: "+f+"@"+d);return h[f][d]}}()),this);
'use strict';function aa(h){var n=0;return function(){return n<h.length?{done:!1,value:h[n++]}:{done:!0}}}function S(h){var n="undefined"!=typeof Symbol&&Symbol.iterator&&h[Symbol.iterator];return n?n.call(h):{next:aa(h)}}var T="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this,ba="function"==typeof Object.defineProperties?Object.defineProperty:function(h,n,f){h!=Array.prototype&&h!=Object.prototype&&(h[n]=f.value)};
function ca(h,n){if(n){var f=T;h=h.split(".");for(var l=0;l<h.length-1;l++){var A=h[l];A in f||(f[A]={});f=f[A]}h=h[h.length-1];l=f[h];n=n(l);n!=l&&null!=n&&ba(f,h,{configurable:!0,writable:!0,value:n})}}
ca("Promise",function(h){function n(d){this.g=0;this.s=void 0;this.b=[];var e=this.j();try{d(e.resolve,e.reject)}catch(t){e.reject(t)}}function f(){this.b=null}function l(d){return d instanceof n?d:new n(function(e){e(d)})}if(h)return h;f.prototype.g=function(d){if(null==this.b){this.b=[];var e=this;this.j(function(){e.s()})}this.b.push(d)};var A=T.setTimeout;f.prototype.j=function(d){A(d,0)};f.prototype.s=function(){for(;this.b&&this.b.length;){var d=this.b;this.b=[];for(var e=0;e<d.length;++e){var f=
d[e];d[e]=null;try{f()}catch(E){this.l(E)}}}this.b=null};f.prototype.l=function(d){this.j(function(){throw d;})};n.prototype.j=function(){function d(d){return function(n){f||(f=!0,d.call(e,n))}}var e=this,f=!1;return{resolve:d(this.N),reject:d(this.l)}};n.prototype.N=function(d){if(d===this)this.l(new TypeError("A Promise cannot resolve to itself"));else if(d instanceof n)this.O(d);else{a:switch(typeof d){case "object":var e=null!=d;break a;case "function":e=!0;break a;default:e=!1}e?this.M(d):this.w(d)}};
n.prototype.M=function(d){var e=void 0;try{e=d.then}catch(t){this.l(t);return}"function"==typeof e?this.P(e,d):this.w(d)};n.prototype.l=function(d){this.B(2,d)};n.prototype.w=function(d){this.B(1,d)};n.prototype.B=function(d,e){if(0!=this.g)throw Error("Cannot settle("+d+", "+e+"): Promise already settled in state"+this.g);this.g=d;this.s=e;this.J()};n.prototype.J=function(){if(null!=this.b){for(var d=0;d<this.b.length;++d)I.g(this.b[d]);this.b=null}};var I=new f;n.prototype.O=function(d){var e=this.j();
d.G(e.resolve,e.reject)};n.prototype.P=function(d,e){var f=this.j();try{d.call(e,f.resolve,f.reject)}catch(E){f.reject(E)}};n.prototype.then=function(d,e){function f(e,d){return"function"==typeof e?function(d){try{h(e(d))}catch(O){l(O)}}:d}var h,l,A=new n(function(e,d){h=e;l=d});this.G(f(d,h),f(e,l));return A};n.prototype.catch=function(d){return this.then(void 0,d)};n.prototype.G=function(d,e){function f(){switch(n.g){case 1:d(n.s);break;case 2:e(n.s);break;default:throw Error("Unexpected state: "+
n.g);}}var n=this;null==this.b?I.g(f):this.b.push(f)};n.resolve=l;n.reject=function(d){return new n(function(e,f){f(d)})};n.race=function(d){return new n(function(e,f){for(var n=S(d),h=n.next();!h.done;h=n.next())l(h.value).G(e,f)})};n.all=function(d){var e=S(d),f=e.next();return f.done?l([]):new n(function(d,n){function h(e){return function(f){A[e]=f;t--;0==t&&d(A)}}var A=[],t=0;do A.push(void 0),t++,l(f.value).G(h(A.length-1),n),f=e.next();while(!f.done)})};return n});
(function(h,n,f){var l;(l=f.define)&&l.amd?l([],function(){return n}):(l=f.modules)?l[h.toLowerCase()]=n:"object"===typeof exports?module.exports=n:f[h]=n})("FlexSearch",function ha(h){function f(a,b){var c=b?b.id:a&&a.id;this.id=c||0===c?c:ia++;this.init(a,b);d(this,"index",function(){return this.c});d(this,"length",function(){return Object.keys(this.c).length})}function l(a,b,c,g){this.F!==this.i&&(this.A=this.A.concat(c),this.F++,g&&this.A.length>=g&&(this.F=this.i),this.F===this.i&&(this.cache&&
this.v.set(b,this.A),this.I&&this.I(this.A)));return this}function A(a,b){for(var c=a.length,g=M(b),k=[],m=0,e=0;m<c;m++){var f=a[m];if(g&&b(f)||!g&&!b[f])k[e++]=f}return k}function I(a,b,c,g,k,m,e){var f=this.m;b=c=O(c,b,m?0:k,e,this.D);c=b.length;e=Array(c);for(var d=0;d<c;d++)e[d]=f[b[d]];c=e;m&&(c=this.where(m,null,k,c));g&&(M(g)||(F=g.split(":"),1<F.length?g=fa:(F=F[0],g=ea)),c.sort(g));this.cache&&this.v.set(a,c);return c}function d(a,b,c){Object.defineProperty(a,b,{get:c})}function e(a){return new RegExp(a,
"g")}function t(a,b){for(var c=0;c<b.length;c+=2)a=a.replace(b[c],b[c+1]);return a}function E(a,b,c,g,k,m,e,f){if(b[c])return b[c];k=k?(f-(e||f/1.5))*m+(e||f/1.5)*k:m;b[c]=k;k>=e&&(a=a[f-(k+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=g);return k}function L(a,b){if(a)for(var c=Object.keys(a),g=0,k=c.length;g<k;g++){var m=c[g],e=a[m];if(e)for(var f=0,d=e.length;f<d;f++)if(e[f]===b){1===d?delete a[m]:e.splice(f,1);break}else J(e[f])&&L(e[f],b)}}function Q(a){for(var b="",c="",g="",k=0;k<a.length;k++){var m=
a[k];if(m!==c)if(k&&"h"===m){if(g="a"===g||"e"===g||"i"===g||"o"===g||"u"===g||"y"===g,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&g||" "===c)b+=m}else b+=m;g=k===a.length-1?"":a[k+1];c=m}return b}function da(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function ea(a,b){a=a[F];b=b[F];return a<b?-1:a>b?1:0}function fa(a,b){for(var c=F.length,g=0;g<c;g++)a=a[F[g]],b=b[F[g]];return a<b?-1:a>b?1:0}function O(a,b,c,g,k){g=[];var m=a.length;if(1<m){b="or"===b;for(var e=D(),f,d=-1,h,u=0,p,l,
x=!0,q=0;++d<m;){var B=d===m-1;f=a[d];if(h=f.length)if(x){if(B)return f;for(;u<h;)e["@"+f[u++]]=1;p=f;x=!1}else{var y=!1;var w=[];for(u=0;u<h;){l=f[u++];var z="@"+l;if(e[z]){var v=e[z];if(b||v===d){if(B){if(g[q++]=l,c&&q===c)return g}else e[z]=d+1;y=!0}else k&&(z=w[v]||(w[v]=[]),z[z.length]=l)}}if(!y&&!k)break}else{if(!b&&!k)return g;if(B&&!q)return p||g}}if(k&&(q=g.length,(d=w.length)&&(!c||q<c)))for(;d--;)if(l=w[d])for(u=0,h=l.length;u<h;u++)if(g[q++]=l[u],c&&q===c)return g}else m&&(g=a[0],c&&g.length>
c&&(g=g.slice(0,c)));return g}function K(a){return"string"===typeof a}function G(a){return a.constructor===Array}function M(a){return"function"===typeof a}function J(a){return"object"===typeof a}function C(a){return"undefined"===typeof a}function V(a){for(var b=Array(a),c=0;c<a;c++)b[c]=D();return b}function D(){return Object.create(null)}function ja(){var a,b;self.onmessage=function(c){if(c=c.data)if(c.search){var g=b.search(c.content,c.threshold?{limit:c.limit,threshold:c.threshold,where:c.where}:
c.limit);self.postMessage({id:a,content:c.content,limit:c.limit,result:g})}else c.add?b.add(c.id,c.content):c.update?b.update(c.id,c.content):c.remove?b.remove(c.id):c.clear?b.clear():c.info?(c=b.info(),c.worker=a,console.log(c)):c.register&&(a=c.id,c.options.cache=!1,c.options.async=!1,c.options.worker=!1,b=(new Function(c.register.substring(c.register.indexOf("{")+1,c.register.lastIndexOf("}"))))(),b=new b(c.options))}}function ka(a,b,c,g){a=h("flexsearch","id"+a,ja,function(a){(a=a.data)&&a.result&&
g(a.id,a.content,a.result,a.limit,a.where,a.cursor,a.suggest)},b);var e=ha.toString();c.id=b;a.postMessage({register:e,options:c,id:b});return a}var r={encode:"icase",h:"forward",D:!1,cache:!1,async:!1,i:!1,H:!1,a:!1,L:!1,f:9,threshold:0,depth:0},W={memory:{encode:"extra",h:"strict",threshold:0,f:1},speed:{encode:"icase",h:"strict",threshold:1,f:3,depth:2},match:{encode:"extra",h:"full",threshold:1,f:3},score:{encode:"extra",h:"strict",threshold:1,f:9,depth:4},balance:{encode:"balance",h:"strict",
threshold:0,f:3,depth:3},fast:{encode:"icase",h:"strict",threshold:8,f:9,depth:1}},N=[],ia=0,X=/\W+/,Y={},Z={};f.create=function(a){return new f(a)};f.registerMatcher=function(a){for(var b in a)a.hasOwnProperty(b)&&N.push(e(b),a[b]);return this};f.registerEncoder=function(a,b){H[a]=b.bind(H);return this};f.registerLanguage=function(a,b){Y[a]=b.filter;Z[a]=b.stemmer;return this};f.encode=function(a,b){return H[a](b)};f.prototype.init=function(a,b){this.g=[];if(b){var c=b.preset;a=b}else a||(a=r),c=
a.preset;b={};K(a)?((b=W[a])||console.warn("Preset not found: "+a),a={}):c&&((b=W[c])||console.warn("Preset not found: "+c));if(c=a.worker)if("undefined"===typeof Worker)a.worker=!1,this.b=null;else{var g=parseInt(c,10)||4;this.w=-1;this.F=0;this.A=[];this.I=null;this.b=Array(g);for(var k=0;k<g;k++)this.b[k]=ka(this.id,k,a,l.bind(this))}this.h=a.tokenize||b.h||this.h||r.h;this.H=a.rtl||this.H||r.H;this.async="undefined"===typeof Promise||C(c=a.async)?this.async||r.async:c;this.i=C(c=a.worker)?this.i||
r.i:c;this.threshold=C(c=a.threshold)?b.threshold||this.threshold||r.threshold:c;this.f=C(c=a.resolution)?c=b.f||this.f||r.f:c;c<=this.threshold&&(this.f=this.threshold+1);this.depth=C(c=a.depth)?b.depth||this.depth||r.depth:c;this.L=C(c=a.paging)?this.L||r.L:c;this.D=C(c=a.suggest)?this.D||r.D:c;this.j=(c=C(c=a.encode)?b.encode||r.encode:c)&&H[c]&&H[c].bind(H)||(M(c)?c:this.j||!1);(c=a.matcher)&&this.addMatcher(c);if(c=a.filter){K(c)&&(c=Y[c]);if(G(c)){b=this.j;g=D();for(k=0;k<c.length;k++){var m=
b?b(c[k]):c[k];g[m]=1}c=g}this.filter=c}if(c=a.stemmer){b=K(c)?Z[c]:c;g=this.j;k=[];for(var d in b)b.hasOwnProperty(d)&&(m=g?g(d):d,k.push(e(m+"($|\\W)"),g?g(b[d]):b[d]));this.stemmer=k}this.a=k=(c=a.doc)?c:this.a||r.a;this.o=V(this.f-(this.threshold||0));this.u=D();this.c=D();if(k){this.m=D();a.doc=null;d=k.index={};b=k.keys=[];g=k.field;m=k.tag;G(k.id)||(k.id=k.id.split(":"));if(m){this.B=D();var h=D();if(g)if(K(g))h[g]=a;else if(G(g))for(var R=0;R<g.length;R++)h[g[R]]=a;else J(g)&&(h=g);G(m)||
(k.tag=m=[m]);for(g=0;g<m.length;g++)this.B[m[g]]=D();this.J=m;g=h}if(g){if(!G(g))if(J(g)){var U=g;k.field=g=Object.keys(g)}else k.field=g=[g];for(k=0;k<g.length;k++)m=g[k],G(m)||(U&&(a=U[m]),b[k]=m,g[k]=m.split(":")),d[m]=new f(a),d[m].m=this.m}}this.s=!0;this.v=(this.cache=c=C(c=a.cache)?this.cache||r.cache:c)?new la(c):!1;return this};f.prototype.encode=function(a){a&&N.length&&(a=t(a,N));a&&this.g.length&&(a=t(a,this.g));a&&this.j&&(a=this.j(a));a&&this.stemmer&&(a=t(a,this.stemmer));return a};
f.prototype.addMatcher=function(a){var b=this.g,c;for(c in a)a.hasOwnProperty(c)&&b.push(e(c),a[c]);return this};f.prototype.add=function(a,b,c,g,e){if(this.a&&J(a))return this.l("add",a,b);if(b&&K(b)&&(a||0===a)){var m="@"+a;if(this.c[m]&&!g)return this.update(a,b);if(this.i)return++this.w>=this.b.length&&(this.w=0),this.b[this.w].postMessage({add:!0,id:a,content:b}),this.c[m]=""+this.w,c&&c(),this;if(!e){if(this.async&&"function"!==typeof importScripts){var f=this;m=new Promise(function(c){setTimeout(function(){f.add(a,
b,null,g,!0);f=null;c()})});if(c)m.then(c);else return m;return this}if(c)return this.add(a,b,null,g,!0),c(),this}b=this.encode(b);if(!b.length)return this;c=this.h;e=M(c)?c(b):b.split(X);this.filter&&(e=A(e,this.filter));var k=D();k._ctx=D();for(var d=e.length,h=this.threshold,l=this.depth,p=this.f,P=this.o,x=this.H,q=0;q<d;q++){var B=e[q];if(B){var y=B.length,w=(x?q+1:d-q)/d,z="";switch(c){case "reverse":case "both":for(var v=y;--v;)z=B[v]+z,E(P,k,z,a,x?1:(y-v)/y,w,h,p-1);z="";case "forward":for(v=
0;v<y;v++)z+=B[v],E(P,k,z,a,x?(v+1)/y:1,w,h,p-1);break;case "full":for(v=0;v<y;v++)for(var t=(x?v+1:y-v)/y,r=y;r>v;r--)z=B.substring(v,r),E(P,k,z,a,t,w,h,p-1);break;default:if(y=E(P,k,B,a,1,w,h,p-1),l&&1<d&&y>=h)for(y=k._ctx[B]||(k._ctx[B]=D()),B=this.u[B]||(this.u[B]=V(p-(h||0))),w=q-l,z=q+l+1,0>w&&(w=0),z>d&&(z=d);w<z;w++)w!==q&&E(B,y,e[w],a,0,p-(w<q?q-w:w-q),h,p-1)}}}this.c[m]=1;this.s=!1}return this};f.prototype.l=function(a,b,c){if(G(b))for(var g=0,e=b.length;g<e;g++){if(g===e-1)return this.l(a,
b[g],c);this.l(a,b[g])}else{g=this.a.index;e=this.a.keys;for(var m=this.a.tag,d=this.a.id,f,h,l,u,p=0;p<d.length;p++)f=(f||b)[d[p]];if(m){for(d=0;d<m.length;d++){l=m[d];h=l.split(":");for(p=0;p<h.length;p++)u=(u||b)[h[p]];u="@"+u}h=this.B[l];h=h[u]||(h[u]=[])}if("remove"===a)for(delete this.m[f],d=0,m=e.length;d<m;d++){if(d===m-1)return g[e[d]].remove(f,c);g[e[d]].remove(f)}d=this.a.field;h&&(h[h.length]=b);m=0;for(l=d.length;m<l;m++){h=d[m];u=void 0;for(p=0;p<h.length;p++)u=(u||b)[h[p]];this.m[f]=
b;h=g[e[m]];p="add"===a?h.add:h.update;if(m===l-1)return p.call(h,f,u,c);p.call(h,f,u)}}};f.prototype.update=function(a,b,c){if(this.a&&J(a))return this.l("update",a,b);this.c["@"+a]&&K(b)&&(this.remove(a),this.add(a,b,c,!0));return this};f.prototype.remove=function(a,b,c){if(this.a&&J(a))return this.l("remove",a,b);var g="@"+a;if(this.c[g]){if(this.i)return this.b[this.c[g]].postMessage({remove:!0,id:a}),delete this.c[g],b&&b(),this;if(!c){if(this.async&&"function"!==typeof importScripts){var e=
this;g=new Promise(function(b){setTimeout(function(){e.remove(a,null,!0);e=null;b()})});if(b)g.then(b);else return g;return this}if(b)return this.remove(a,null,!0),b(),this}for(b=0;b<this.f-(this.threshold||0);b++)L(this.o[b],a);this.depth&&L(this.u,a);delete this.c[g];this.s=!1}return this};var F;f.prototype.search=function(a,b,c,g){if(J(b)){if(G(b))for(var e=0;e<b.length;e++)b[e].query=a;else b.query=a;a=b;b=0}var d=a,f=[];if(J(a)&&!G(a)){(c=a.callback||b)&&(d.callback=null);b=a.limit;var h=a.threshold;
a=a.query}if(this.a){var l=d.where,t=d.bool,u=d.sort;h=this.a.index;var p=d.field;if(p)d.field=null,G(p)||(p=[p]);else if(G(d)){var r=d;p=[];for(var x=0;x<d.length;x++){var q=d[x];p[x]=q.field;t=q.bool;u=q.sort;l=q.where}}else p=this.a.keys;x=p.length;for(q=0;q<x;q++)r&&(d=r[q]),f[q]=h[p[q]].search(d);if(c)return c(I.call(this,a,t,f,u,b,l,void 0));if(this.async){var B=this;return new Promise(function(c){Promise.all(f).then(function(g){c(I.call(B,a,t,g,u,b,l,void 0))})})}return I.call(this,a,t,f,u,
b,l,void 0)}h||(h=this.threshold||0);M(b)?(c=b,b=1E3):b||0===b||(b=1E3);if(this.i)for(this.I=c,this.F=0,this.A=[],p=0;p<this.i;p++)this.b[p].postMessage({search:!0,limit:b,cursor:void 0,threshold:h,content:a});else{if(!g){if(this.async&&"function"!==typeof importScripts){var y=this;h=new Promise(function(a){setTimeout(function(){a(y.search(d,b,null,!0));y=null})});if(c)h.then(c);else return h;return this}if(c)return c(this.search(d,b,null,!0)),this}if(!a||!K(a))return f;d=a;if(this.cache)if(this.s){if(c=
this.v.get(a))return c}else this.v.clear(),this.s=!0;d=this.encode(d);if(!d.length)return f;c=this.h;c=M(c)?c(d):d.split(X);this.filter&&(c=A(c,this.filter));r=c.length;g=!0;e=[];var w=D();1<r&&(this.depth?(p=!0,q=c[0],w[q]=1):c.sort(da));if(!p||(x=this.u)[q])for(var z=this.f,v=p?1:0;v<r;v++){var C=c[v];if(C){if(!w[C]){var E=[],F=!1,H=0;if(q=p?x[q]:this.o)for(var N=void 0,L=0;L<z-h;L++)if(N=q[L][C])E[H++]=N,F=!0;if(F)e[e.length]=1<H?E.concat.apply([],E):E[0];else if(!this.D){g=!1;break}w[C]=1}q=C}}else g=
!1;this.a||(g&&(f=O(e,!1,b,void 0,this.D)),this.cache&&this.v.set(a,f));return f}};f.prototype.find=function(a,b){return this.where(a,b,1)[0]||null};f.prototype.where=function(a,b,c,g){var d=g||this.m,e=[],f=0,h;if("number"===typeof a)return[d[a]];if(K(a)){if(C(b))return[d[a]];if("id"===a)return[d[b]];var l=1;var r=[a.split(":")];var u=!0}else{if(M(a)){b=g||Object.keys(d);c=b.length;for(h=0;h<c;h++)l=g?g[h]:d[b[h]],a(l)&&(e[f++]=l);return e}c||(c=b);h=Object.keys(a);l=h.length;u=!1;if(1===l&&"id"===
h[0])return[d[a.id]];if((r=this.J)&&!g)for(var p=0;p<r.length;p++){var t=r[p],x=a[t];if(!C(x)){g=this.B[t]["@"+x];if(0===--l)return g;h.splice(h.indexOf(t),1);delete a[t];break}}r=Array(l);for(p=0;p<l;p++)r[p]=h[p].split(":")}p=g||Object.keys(d);t=p.length;for(x=0;x<t;x++){for(var q=g?g[x]:d[p[x]],B=!0,y=0;y<l;y++){u||(b=a[h[y]]);var w=r[y],z=w.length,v=q;if(1<z)for(var A=0;A<z;A++)v=v[w[A]];else v=v[w[0]];if(v!==b){B=!1;break}}if(B&&(e[f++]=q,c&&f===c))break}return e};f.prototype.info=function(){if(this.i)for(var a=
0;a<this.i;a++)this.b[a].postMessage({info:!0,id:this.id});else{for(var b,c=0,g=0,d=0,e=0;e<this.f-(this.threshold||0);e++){a=Object.keys(this.o[e]);for(var f=0;f<a.length;f++)b=this.o[e][a[f]].length,c+=1*b+2*a[f].length+4,g+=b,d+=2*a[f].length}a=Object.keys(this.c);b=a.length;for(e=0;e<b;e++)c+=2*a[e].length+2;return{id:this.id,memory:c,items:b,sequences:g,chars:d,cache:this.cache&&this.cache.C?this.cache.C.length:!1,matcher:N.length+(this.g?this.g.length:0),worker:this.i,threshold:this.threshold,
depth:this.depth,contextual:this.depth&&"strict"===this.h}}};f.prototype.clear=function(){return this.destroy().init()};f.prototype.destroy=function(){this.cache&&(this.v.clear(),this.v=null);this.o=this.u=this.c=null;if(this.a){for(var a=this.a.keys,b=0;b<a.length;b++)this.a.index[a[b]].destroy();this.a=this.m=null}return this};f.prototype.export=function(){if(this.a){for(var a=this.a.keys,b=Array(a.length+1),c=0;c<a.length;c++){var g=this.a.index[a[c]];b[c]=[g.o,g.u,g.c]}b[c]=this.m;return JSON.stringify(b)}return JSON.stringify([this.o,
this.u,this.c])};f.prototype.import=function(a){a=JSON.parse(a);if(this.a){for(var b=this.a.keys,c=b.length,g=0;g<c;g++){var d=this.a.index[b[g]];d.o=a[g][0];d.u=a[g][1];d.c=a[g][2];d.m=a[c]}this.m=a[c]}else this.o=a[0],this.u=a[1],this.c=a[2]};var H={icase:function(a){return a.toLowerCase()},simple:function(){var a=[e("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",e("[\u00e8\u00e9\u00ea\u00eb]"),"e",e("[\u00ec\u00ed\u00ee\u00ef]"),"i",e("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",e("[\u00f9\u00fa\u00fb\u00fc\u0171]"),
"u",e("[\u00fd\u0177\u00ff]"),"y",e("\u00f1"),"n",e("\u00e7"),"c",e("\u00df"),"s",e(" & ")," and ",e("[-/]")," ",e("[^a-z0-9 ]"),"",e("\\s+")," "];return function(b){b=t(b.toLowerCase(),a);return" "===b?"":b}}(),advanced:function(){var a=[e("ae"),"a",e("ai"),"ei",e("ay"),"ei",e("ey"),"ei",e("oe"),"o",e("ue"),"u",e("ie"),"i",e("sz"),"s",e("zs"),"s",e("sh"),"s",e("ck"),"k",e("cc"),"k",e("dt"),"t",e("ph"),"f",e("pf"),"f",e("ou"),"o",e("uo"),"u"];return function(b,c){if(!b)return b;b=this.simple(b);2<
b.length&&(b=t(b,a));c||1<b.length&&(b=Q(b));return b}}(),extra:function(){var a=[e("p"),"b",e("z"),"s",e("[cgq]"),"k",e("n"),"m",e("d"),"t",e("[vw]"),"f",e("[aeiouy]"),""];return function(b){if(!b)return b;b=this.advanced(b,!0);if(1<b.length){b=b.split(" ");for(var c=0;c<b.length;c++){var d=b[c];1<d.length&&(b[c]=d[0]+t(d.substring(1),a))}b=b.join(" ");b=Q(b)}return b}}(),balance:function(){var a=[e("[-/]")," ",e("[^a-z0-9 ]"),"",e("\\s+")," "];return function(b){return Q(t(b.toLowerCase(),a))}}()},
la=function(){function a(a){this.clear();this.K=!0!==a&&a}a.prototype.clear=function(){this.cache=D();this.count=D();this.index=D();this.C=[]};a.prototype.set=function(a,c){if(this.K&&C(this.cache[a])){var b=this.C.length;if(b===this.K){b--;var d=this.C[b];delete this.cache[d];delete this.count[d];delete this.index[d]}this.index[a]=b;this.C[b]=a;this.count[a]=-1;this.cache[a]=c;this.get(a)}else this.cache[a]=c};a.prototype.get=function(a){var b=this.cache[a];if(this.K&&b){var d=++this.count[a],e=
this.index,f=e[a];if(0<f){for(var h=this.C,l=f;this.count[h[--f]]<=d&&-1!==f;);f++;if(f!==l){for(d=l;d>f;d--)l=h[d-1],h[d]=l,e[l]=d;h[f]=a;e[a]=f}}}return b};return a}();return f}(function(){var h={},n="undefined"!==typeof Blob&&"undefined"!==typeof URL&&URL.createObjectURL;return function(f,l,A,I,d){A=n?URL.createObjectURL(new Blob(["("+A.toString()+")()"],{type:"text/javascript"})):f+".es5.js";f+="-"+l;h[f]||(h[f]=[]);h[f][d]=new Worker(A);h[f][d].onmessage=I;console.log("Register Worker: "+f+"@"+
d);return h[f][d]}}()),this);

View File

@@ -1,18 +1,19 @@
/*
FlexSearch v0.5.2
FlexSearch v0.5.3
Copyright 2019 Nextapps GmbH
Author: Thomas Wilkerling
Released under the Apache 2.0 Licence
https://github.com/nextapps-de/flexsearch
*/
'use strict';(function(e,u,r){let l;(l=r.define)&&l.amd?l([],function(){return u}):(l=r.modules)?l[e.toLowerCase()]=u:"object"===typeof exports?module.exports=u:r[e]=u})("FlexSearch",function(){function e(a,c){const b=c?c.id:a&&a.id;this.id=b||0===b?b:I++;this.init(a,c);r(this,"index",function(){return this.b});r(this,"length",function(){return Object.keys(this.b).length})}function u(a,c){const b=a.length,f=x(c),d=[];for(let n=0,g=0;n<b;n++){const b=a[n];if(f&&c(b)||!f&&!c[b])d[g++]=b}return d}function r(a,
c,b){Object.defineProperty(a,c,{get:b})}function l(a,c){for(let b=0;b<c.length;b+=2)a=a.replace(c[b],c[b+1]);return a}function y(a,c,b,f,d,n,g,h){if(c[b])return c[b];d=d?(h-(g||h/1.5))*n+(g||h/1.5)*d:n;c[b]=d;d>=g&&(a=a[h-(d+.5>>0)],a=a[b]||(a[b]=[]),a[a.length]=f);return d}function C(a,c){if(a){const b=Object.keys(a);for(let f=0,d=b.length;f<d;f++){const d=b[f],g=a[d];if(g)for(let b=0,f=g.length;b<f;b++)if(g[b]===c){1===f?delete a[d]:g.splice(b,1);break}else"object"===typeof g[b]&&C(g[b],c)}}}function J(a,
c){a=a.length-c.length;return 0>a?1:a?-1:0}function z(a){return"string"===typeof a}function x(a){return"function"===typeof a}function A(a){return"undefined"===typeof a}function E(a){const c=Array(a);for(let b=0;b<a;b++)c[b]=t();return c}function t(){return Object.create(null)}const p={encode:"icase",c:"forward",o:!1,cache:!1,async:!1,s:!1,i:!1,m:!1,l:!1,a:9,threshold:0,depth:0},D=[];let I=0;const F=/\W+/,G={},H={};e.create=function(a){return new e(a)};e.registerMatcher=function(a){for(const c in a)a.hasOwnProperty(c)&&
D.push(new RegExp(c,"g"),a[c]);return this};e.registerEncoder=function(a,c){w[a]=c.bind(w);return this};e.registerLanguage=function(a,c){G[a]=c.filter;H[a]=c.stemmer;return this};e.encode=function(a,c){return w[a](c)};e.prototype.init=function(a,c){this.j=[];if(c){var b=c.preset;a=c}else a||(a=p),b=a.preset;c={};this.c=a.tokenize||c.c||this.c||p.c;this.i=a.rtl||this.i||p.i;this.threshold=A(b=a.threshold)?c.threshold||this.threshold||p.threshold:b;this.a=A(b=a.resolution)?b=c.a||this.a||p.a:b;b<=this.threshold&&
(this.a=this.threshold+1);this.depth=A(b=a.depth)?c.depth||this.depth||p.depth:b;this.l=A(b=a.paging)?this.l||p.l:b;this.g=(b=A(b=a.encode)?c.encode||p.encode:b)&&w[b]&&w[b].bind(w)||(x(b)?b:this.g||!1);(b=a.matcher)&&this.addMatcher(b);if(b=a.filter){z(b)&&(b=G[b]);if(b.constructor===Array){c=this.g;var f=t();for(let a=0;a<b.length;a++){const d=c?c(b[a]):b[a];f[d]=1}b=f}this.filter=b}if(b=a.stemmer){var d;a=z(b)?H[b]:b;b=this.g;c=[];for(d in a)a.hasOwnProperty(d)&&(f=b?b(d):d,c.push(new RegExp(f+
"($|\\W)","g"),b?b(a[d]):a[d]));this.stemmer=d=c}this.h=E(this.a-(this.threshold||0));this.f=t();this.b=t();return this};e.prototype.encode=function(a){a&&D.length&&(a=l(a,D));a&&this.j.length&&(a=l(a,this.j));a&&this.g&&(a=this.g(a));a&&this.stemmer&&(a=l(a,this.stemmer));return a};e.prototype.addMatcher=function(a){const c=this.j;for(const b in a)a.hasOwnProperty(b)&&c.push(new RegExp(b,"g"),a[b]);return this};e.prototype.add=function(a,c,b,f,d){if(c&&z(c)&&(a||0===a)){const e="@"+a;if(this.b[e]&&
!f)return this.update(a,c);if(!d&&b)return this.add(a,c,null,f,!0),b(),this;c=this.encode(c);if(!c.length)return this;b=this.c;c=x(b)?b(c):c.split(F);this.filter&&(c=u(c,this.filter));f=t();f._ctx=t();d=c.length;const v=this.threshold,l=this.depth,q=this.a,B=this.h,p=this.i;for(let e=0;e<d;e++){var n=c[e];if(n){var g=n.length,h=(p?e+1:d-e)/d,m="";switch(b){case "reverse":case "both":for(var k=g;--k;)m=n[k]+m,y(B,f,m,a,p?1:(g-k)/g,h,v,q-1);m="";case "forward":for(k=0;k<g;k++)m+=n[k],y(B,f,m,a,p?(k+
1)/g:1,h,v,q-1);break;case "full":for(k=0;k<g;k++){const b=(p?k+1:g-k)/g;for(let c=g;c>k;c--)m=n.substring(k,c),y(B,f,m,a,b,h,v,q-1)}break;default:if(g=y(B,f,n,a,1,h,v,q-1),l&&1<d&&g>=v)for(g=f._ctx[n]||(f._ctx[n]=t()),n=this.f[n]||(this.f[n]=E(q-(v||0))),h=e-l,m=e+l+1,0>h&&(h=0),m>d&&(m=d);h<m;h++)h!==e&&y(n,g,c[h],a,0,q-(h<e?e-h:h-e),v,q-1)}}}this.b[e]=1}return this};e.prototype.update=function(a,c,b){this.b["@"+a]&&z(c)&&(this.remove(a),this.add(a,c,b,!0));return this};e.prototype.remove=function(a,
c,b){const f="@"+a;if(this.b[f]){if(!b&&c)return this.remove(a,null,!0),c(),this;for(c=0;c<this.a-(this.threshold||0);c++)C(this.h[c],a);this.depth&&C(this.f,a);delete this.b[f]}return this};e.prototype.search=function(a,c,b,f){var d=a,e=[];if("object"===typeof a){c=a.limit;var g=a.threshold;a=a.query}g||(g=this.threshold||0);x(c)?(b=c,c=1E3):c||0===c||(c=1E3);if(!f&&b)return b(this.search(d,c,null,!0)),this;if(!a||!z(a))return e;d=this.encode(a);if(!d.length)return e;a=this.c;a=x(a)?a(d):d.split(F);
this.filter&&(a=u(a,this.filter));b=a.length;f=!0;d=[];var h=t();if(1<b)if(this.depth){var m=!0;var k=a[0];h[k]=1}else a.sort(J);var l;if(!m||(l=this.f)[k]){var p=this.a;for(var r=m?1:0;r<b;r++){var q=a[r];if(q){if(!h[q]){const a=[];let b=!1,c=0;if(k=m?l[k]:this.h){let d;for(let e=0;e<p-g;e++)if(d=k[e][q])a[c++]=d,b=!0}if(b)d[d.length]=1<c?a.concat.apply([],a):a[0];else{f=!1;break}h[q]=1}k=q}}}else f=!1;if(f)a:{g=[];e=d.length;if(1<e){m=t();l=d[0];k=l.length;for(a=0;a<k;)m["@"+l[a++]]=1;for(h=f=0;++h<
e;){p=!1;r=h===e-1;l=d[h];k=l.length;for(a=0;a<k;)if(b=l[a++],q="@"+b,m[q]&&m[q]===h){if(r){if(g[f++]=b,c&&f===c){e=g;break a}}else m[q]=h+1;p=!0}if(!p)break}}else e&&(g=d[0],c&&g.length>c&&(g=g.slice(0,c)));e=g}return e};e.prototype.clear=function(){return this.destroy().init()};e.prototype.destroy=function(){this.h=this.f=this.b=null;return this};const w={icase:function(a){return a.toLowerCase()}};return e}(!1),this);
'use strict';(function(f,w,y){let m;(m=y.define)&&m.amd?m([],function(){return w}):(m=y.modules)?m[f.toLowerCase()]=w:"object"===typeof exports?module.exports=w:y[f]=w})("FlexSearch",function(){function f(a,c){const b=c?c.id:a&&a.id;this.id=b||0===b?b:M++;this.init(a,c);y(this,"index",function(){return this.b});y(this,"length",function(){return Object.keys(this.b).length})}function w(a,c){const b=a.length,e=A(c),d=[];for(let l=0,g=0;l<b;l++){const b=a[l];if(e&&c(b)||!e&&!c[b])d[g++]=b}return d}function y(a,
c,b){Object.defineProperty(a,c,{get:b})}function m(a,c){for(let b=0;b<c.length;b+=2)a=a.replace(c[b],c[b+1]);return a}function B(a,c,b,e,d,l,g,h){if(c[b])return c[b];d=d?(h-(g||h/1.5))*l+(g||h/1.5)*d:l;c[b]=d;d>=g&&(a=a[h-(d+.5>>0)],a=a[b]||(a[b]=[]),a[a.length]=e);return d}function F(a,c){if(a){const b=Object.keys(a);for(let e=0,d=b.length;e<d;e++){const d=b[e],g=a[d];if(g)for(let b=0,e=g.length;b<e;b++)if(g[b]===c){1===e?delete a[d]:g.splice(b,1);break}else"object"===typeof g[b]&&F(g[b],c)}}}function N(a,
c){a=a.length-c.length;return 0>a?1:a?-1:0}function O(a,c,b,e,d){e=[];let l;const g=a.length;if(1<g){c="or"===c;const E=v();let k,f=-1,p,q=0,u,r,x=!0,n=0;for(;++f<g;){const m=f===g-1;k=a[f];p=k.length;if(!p){if(!c&&!d)return e;if(m&&!n)return u||e;continue}if(x){if(m)return k;for(;q<p;)E["@"+k[q++]]=1;u=k;x=!1;continue}let H=!1;l=[];for(q=0;q<p;){r=k[q++];var h="@"+r;if(E[h]){const a=E[h];if(c||a===f){if(m){if(e[n++]=r,b&&n===b)return e}else E[h]=f+1;H=!0}else d&&(h=l[a]||(l[a]=[]),h[h.length]=r)}}if(!H&&
!d)break}if(d&&(n=e.length,(f=l.length)&&(!b||n<b)))for(;f--;)if(r=l[f])for(q=0,p=r.length;q<p;q++)if(e[n++]=r[q],b&&n===b)return e}else g&&(e=a[0],b&&e.length>b&&(e=e.slice(0,b)));return e}function C(a){return"string"===typeof a}function A(a){return"function"===typeof a}function D(a){return"undefined"===typeof a}function I(a){const c=Array(a);for(let b=0;b<a;b++)c[b]=v();return c}function v(){return Object.create(null)}const t={encode:"icase",c:"forward",o:!1,cache:!1,async:!1,s:!1,i:!1,m:!1,l:!1,
a:9,threshold:0,depth:0},G=[];let M=0;const J=/\W+/,K={},L={};f.create=function(a){return new f(a)};f.registerMatcher=function(a){for(const c in a)a.hasOwnProperty(c)&&G.push(new RegExp(c,"g"),a[c]);return this};f.registerEncoder=function(a,c){z[a]=c.bind(z);return this};f.registerLanguage=function(a,c){K[a]=c.filter;L[a]=c.stemmer;return this};f.encode=function(a,c){return z[a](c)};f.prototype.init=function(a,c){this.j=[];if(c){var b=c.preset;a=c}else a||(a=t),b=a.preset;c={};this.c=a.tokenize||
c.c||this.c||t.c;this.i=a.rtl||this.i||t.i;this.threshold=D(b=a.threshold)?c.threshold||this.threshold||t.threshold:b;this.a=D(b=a.resolution)?b=c.a||this.a||t.a:b;b<=this.threshold&&(this.a=this.threshold+1);this.depth=D(b=a.depth)?c.depth||this.depth||t.depth:b;this.l=D(b=a.paging)?this.l||t.l:b;this.g=(b=D(b=a.encode)?c.encode||t.encode:b)&&z[b]&&z[b].bind(z)||(A(b)?b:this.g||!1);(b=a.matcher)&&this.addMatcher(b);if(b=a.filter){C(b)&&(b=K[b]);if(b.constructor===Array){c=this.g;var e=v();for(let a=
0;a<b.length;a++){const d=c?c(b[a]):b[a];e[d]=1}b=e}this.filter=b}if(b=a.stemmer){var d;a=C(b)?L[b]:b;b=this.g;c=[];for(d in a)a.hasOwnProperty(d)&&(e=b?b(d):d,c.push(new RegExp(e+"($|\\W)","g"),b?b(a[d]):a[d]));this.stemmer=d=c}this.h=I(this.a-(this.threshold||0));this.f=v();this.b=v();return this};f.prototype.encode=function(a){a&&G.length&&(a=m(a,G));a&&this.j.length&&(a=m(a,this.j));a&&this.g&&(a=this.g(a));a&&this.stemmer&&(a=m(a,this.stemmer));return a};f.prototype.addMatcher=function(a){const c=
this.j;for(const b in a)a.hasOwnProperty(b)&&c.push(new RegExp(b,"g"),a[b]);return this};f.prototype.add=function(a,c,b,e,d){if(c&&C(c)&&(a||0===a)){const m="@"+a;if(this.b[m]&&!e)return this.update(a,c);if(!d&&b)return this.add(a,c,null,e,!0),b(),this;c=this.encode(c);if(!c.length)return this;b=this.c;c=A(b)?b(c):c.split(J);this.filter&&(c=w(c,this.filter));e=v();e._ctx=v();d=c.length;const p=this.threshold,q=this.depth,u=this.a,r=this.h,x=this.i;for(let n=0;n<d;n++){var l=c[n];if(l){var g=l.length,
h=(x?n+1:d-n)/d,f="";switch(b){case "reverse":case "both":for(var k=g;--k;)f=l[k]+f,B(r,e,f,a,x?1:(g-k)/g,h,p,u-1);f="";case "forward":for(k=0;k<g;k++)f+=l[k],B(r,e,f,a,x?(k+1)/g:1,h,p,u-1);break;case "full":for(k=0;k<g;k++){const b=(x?k+1:g-k)/g;for(let c=g;c>k;c--)f=l.substring(k,c),B(r,e,f,a,b,h,p,u-1)}break;default:if(g=B(r,e,l,a,1,h,p,u-1),q&&1<d&&g>=p)for(g=e._ctx[l]||(e._ctx[l]=v()),l=this.f[l]||(this.f[l]=I(u-(p||0))),h=n-q,f=n+q+1,0>h&&(h=0),f>d&&(f=d);h<f;h++)h!==n&&B(l,g,c[h],a,0,u-(h<
n?n-h:h-n),p,u-1)}}}this.b[m]=1}return this};f.prototype.update=function(a,c,b){this.b["@"+a]&&C(c)&&(this.remove(a),this.add(a,c,b,!0));return this};f.prototype.remove=function(a,c,b){const e="@"+a;if(this.b[e]){if(!b&&c)return this.remove(a,null,!0),c(),this;for(c=0;c<this.a-(this.threshold||0);c++)F(this.h[c],a);this.depth&&F(this.f,a);delete this.b[e]}return this};f.prototype.search=function(a,c,b,e){var d=a;let f,g=[];"object"===typeof a&&(c=a.limit,f=a.threshold,a=a.query);f||(f=this.threshold||
0);A(c)?(b=c,c=1E3):c||0===c||(c=1E3);if(!e&&b)return b(this.search(d,c,null,!0)),this;if(!a||!C(a))return g;d=this.encode(a);if(!d.length)return g;a=this.c;d=A(a)?a(d):d.split(J);this.filter&&(d=w(d,this.filter));a=d.length;b=!0;e=[];const h=v();let m;if(1<a)if(this.depth){m=!0;var k=d[0];h[k]=1}else d.sort(N);let t;if(!m||(t=this.f)[k]){let c=this.a;for(let g=m?1:0;g<a;g++){const a=d[g];if(a){if(!h[a]){const d=[];let g=!1,l=0;if(k=m?t[k]:this.h){let b;for(let e=0;e<c-f;e++)if(b=k[e][a])d[l++]=b,
g=!0}if(g)e[e.length]=1<l?d.concat.apply([],d):d[0];else{b=!1;break}h[a]=1}k=a}}}else b=!1;b&&(g=O(e,!1,c,void 0,!1));return g};f.prototype.clear=function(){return this.destroy().init()};f.prototype.destroy=function(){this.h=this.f=this.b=null;return this};const z={icase:function(a){return a.toLowerCase()}};return f}(!1),this);

View File

@@ -1,39 +1,39 @@
/*
FlexSearch v0.5.2
FlexSearch v0.5.3
Copyright 2019 Nextapps GmbH
Author: Thomas Wilkerling
Released under the Apache 2.0 Licence
https://github.com/nextapps-de/flexsearch
*/
'use strict';(function(x,G,h){let y;(y=h.define)&&y.amd?y([],function(){return G}):(y=h.modules)?y[x.toLowerCase()]=G:"object"===typeof exports?module.exports=G:h[x]=G})("FlexSearch",function X(x){function h(a,b){const c=b?b.id:a&&a.id;this.id=c||0===c?c:Y++;this.init(a,b);H(this,"index",function(){return this.b});H(this,"length",function(){return Object.keys(this.b).length})}function y(a,b,c,d){this.v!==this.g&&(this.o=this.o.concat(c),this.v++,d&&this.o.length>=d&&(this.v=this.g),this.v===this.g&&
(this.cache&&this.l.set(b,this.o),this.G&&this.G(this.o)));return this}function I(a,b){const c=a.length,d=D(b),e=[];for(let f=0,k=0;f<c;f++){const c=a[f];if(d&&b(c)||!d&&!b[c])e[k++]=c}return e}function K(a,b,c,d,e,f){const k=this.h;b=R(b,e?0:d,f,this.u);{f=b.length;const a=Array(f);for(let c=0;c<f;c++)a[c]=k[b[c]];b=a}e&&(b=this.where(e,null,d,b));c&&(D(c)||(A=c.split(":"),1<A.length?c=Z:(A=A[0],c=aa)),b.sort(c));this.cache&&this.l.set(a,b);return b}function H(a,b,c){Object.defineProperty(a,b,{get:c})}
function g(a){return new RegExp(a,"g")}function E(a,b){for(let c=0;c<b.length;c+=2)a=a.replace(b[c],b[c+1]);return a}function L(a,b,c,d,e,f,k,p){if(b[c])return b[c];e=e?(p-(k||p/1.5))*f+(k||p/1.5)*e:f;b[c]=e;e>=k&&(a=a[p-(e+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=d);return e}function P(a,b){if(a){const c=Object.keys(a);for(let d=0,e=c.length;d<e;d++){const e=c[d],k=a[e];if(k)for(let c=0,d=k.length;c<d;c++)if(k[c]===b){1===d?delete a[e]:k.splice(c,1);break}else B(k[c])&&P(k[c],b)}}}function Q(a){let b=
"",c="";var d="";for(let e=0;e<a.length;e++){const f=a[e];if(f!==c)if(e&&"h"===f){if(d="a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&d||" "===c)b+=f}else b+=f;d=e===a.length-1?"":a[e+1];c=f}return b}function ba(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function aa(a,b){a=a[A];b=b[A];return a<b?-1:a>b?1:0}function Z(a,b){const c=A.length;for(let d=0;d<c;d++)a=a[A[d]],b=b[A[d]];return a<b?-1:a>b?1:0}function R(a,b,c,d){c=[];let e;const f=
a.length;if(1<f){const p=u();let z=a[0],m=z.length,l=0;for(;l<m;)p["@"+z[l++]]=1;let g,q=0,n=0;for(;++n<f;){let h=!1;const r=n===f-1;e=[];z=a[n];m=z.length;for(l=0;l<m;){g=z[l++];var k="@"+g;if(p[k]){const a=p[k];if(a===n){if(r){if(c[q++]=g,b&&q===b)return c}else p[k]=n+1;h=!0}else d&&(k=e[a]||(e[a]=[]),k[k.length]=g)}}if(!h&&!d)break}if(d&&(q=c.length,(n=e.length)&&(!b||q<b)))for(;n--;)if(g=e[n])for(l=0,m=g.length;l<m;l++)if(c[q++]=g[l],b&&q===b)return c}else f&&(c=a[0],b&&c.length>b&&(c=c.slice(0,
b)));return c}function C(a){return"string"===typeof a}function w(a){return a.constructor===Array}function D(a){return"function"===typeof a}function B(a){return"object"===typeof a}function v(a){return"undefined"===typeof a}function S(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=u();return b}function u(){return Object.create(null)}function ca(){let a,b;self.onmessage=function(c){if(c=c.data)if(c.search){const d=b.search(c.content,c.threshold?{limit:c.limit,threshold:c.threshold,where:c.where}:c.limit);
self.postMessage({id:a,content:c.content,limit:c.limit,result:d})}else c.add?b.add(c.id,c.content):c.update?b.update(c.id,c.content):c.remove?b.remove(c.id):c.clear?b.clear():c.info?(c=b.info(),c.worker=a,console.log(c)):c.register&&(a=c.id,c.options.cache=!1,c.options.async=!1,c.options.worker=!1,b=(new Function(c.register.substring(c.register.indexOf("{")+1,c.register.lastIndexOf("}"))))(),b=new b(c.options))}}function da(a,b,c,d){a=x("flexsearch","id"+a,ca,function(a){(a=a.data)&&a.result&&d(a.id,
a.content,a.result,a.limit,a.where,a.cursor,a.suggest)},b);const e=X.toString();c.id=b;a.postMessage({register:e,options:c,id:b});return a}const t={encode:"icase",f:"forward",u:!1,cache:!1,async:!1,g:!1,F:!1,a:!1,J:!1,c:9,threshold:0,depth:0},T={memory:{encode:"extra",f:"strict",threshold:0,c:1},speed:{encode:"icase",f:"strict",threshold:1,c:3,depth:2},match:{encode:"extra",f:"full",threshold:1,c:3},score:{encode:"extra",f:"strict",threshold:1,c:9,depth:4},balance:{encode:"balance",f:"strict",threshold:0,
c:3,depth:3},fast:{encode:"icase",f:"strict",threshold:8,c:9,depth:1}},N=[];let Y=0;const U=/\W+/,V={},W={};h.create=function(a){return new h(a)};h.registerMatcher=function(a){for(const b in a)a.hasOwnProperty(b)&&N.push(g(b),a[b]);return this};h.registerEncoder=function(a,b){J[a]=b.bind(J);return this};h.registerLanguage=function(a,b){V[a]=b.filter;W[a]=b.stemmer;return this};h.encode=function(a,b){return J[a](b)};h.prototype.init=function(a,b){this.w=[];if(b){var c=b.preset;a=b}else a||(a=t),c=
a.preset;b={};C(a)?(b=T[a],a={}):c&&(b=T[c]);if(c=a.worker)if("undefined"===typeof Worker)a.worker=!1,this.m=null;else{var d=parseInt(c,10)||4;this.D=-1;this.v=0;this.o=[];this.G=null;this.m=Array(d);for(var e=0;e<d;e++)this.m[e]=da(this.id,e,a,y.bind(this))}this.f=a.tokenize||b.f||this.f||t.f;this.F=a.rtl||this.F||t.F;this.async="undefined"===typeof Promise||v(c=a.async)?this.async||t.async:c;this.g=v(c=a.worker)?this.g||t.g:c;this.threshold=v(c=a.threshold)?b.threshold||this.threshold||t.threshold:
c;this.c=v(c=a.resolution)?c=b.c||this.c||t.c:c;c<=this.threshold&&(this.c=this.threshold+1);this.depth=v(c=a.depth)?b.depth||this.depth||t.depth:c;this.J=v(c=a.paging)?this.J||t.J:c;this.u=v(c=a.suggest)?this.u||t.u:c;this.A=(c=v(c=a.encode)?b.encode||t.encode:c)&&J[c]&&J[c].bind(J)||(D(c)?c:this.A||!1);(c=a.matcher)&&this.addMatcher(c);if(c=a.filter){C(c)&&(c=V[c]);if(w(c)){b=this.A;d=u();for(e=0;e<c.length;e++){var f=b?b(c[e]):c[e];d[f]=1}c=d}this.filter=c}if(c=a.stemmer){var k;b=C(c)?W[c]:c;d=
this.A;e=[];for(k in b)b.hasOwnProperty(k)&&(f=d?d(k):k,e.push(g(f+"($|\\W)"),d?d(b[k]):b[k]));this.stemmer=k=e}this.a=e=(c=a.doc)?c:this.a||t.a;this.i=S(this.c-(this.threshold||0));this.j=u();this.b=u();if(e){this.h=u();a.doc=null;k=e.index={};b=e.keys=[];d=e.field;f=e.tag;w(e.id)||(e.id=e.id.split(":"));if(f){this.H=u();let b=u();if(d)if(C(d))b[d]=a;else if(w(d))for(let c=0;c<d.length;c++)b[d[c]]=a;else B(d)&&(b=d);w(f)||(e.tag=f=[f]);for(d=0;d<f.length;d++)this.H[f[d]]=u();this.K=f;d=b}if(d){let c;
w(d)||(B(d)?(c=d,e.field=d=Object.keys(d)):e.field=d=[d]);for(e=0;e<d.length;e++)f=d[e],w(f)||(c&&(a=c[f]),b[e]=f,d[e]=f.split(":")),k[f]=new h(a),k[f].h=this.h}}this.C=!0;this.l=(this.cache=c=v(c=a.cache)?this.cache||t.cache:c)?new ea(c):!1;return this};h.prototype.encode=function(a){a&&N.length&&(a=E(a,N));a&&this.w.length&&(a=E(a,this.w));a&&this.A&&(a=this.A(a));a&&this.stemmer&&(a=E(a,this.stemmer));return a};h.prototype.addMatcher=function(a){const b=this.w;for(const c in a)a.hasOwnProperty(c)&&
b.push(g(c),a[c]);return this};h.prototype.add=function(a,b,c,d,e){if(this.a&&B(a))return this.B("add",a,b);if(b&&C(b)&&(a||0===a)){var f="@"+a;if(this.b[f]&&!d)return this.update(a,b);if(this.g)return++this.D>=this.m.length&&(this.D=0),this.m[this.D].postMessage({add:!0,id:a,content:b}),this.b[f]=""+this.D,c&&c(),this;if(!e){if(this.async&&"function"!==typeof importScripts){let e=this;f=new Promise(function(c){setTimeout(function(){e.add(a,b,null,d,!0);e=null;c()})});if(c)f.then(c);else return f;
return this}if(c)return this.add(a,b,null,d,!0),c(),this}b=this.encode(b);if(!b.length)return this;c=this.f;e=D(c)?c(b):b.split(U);this.filter&&(e=I(e,this.filter));const h=u();h._ctx=u();const q=e.length,n=this.threshold,z=this.depth,F=this.c,M=this.i,O=this.F;for(let b=0;b<q;b++){var k=e[b];if(k){var p=k.length,g=(O?b+1:q-b)/q,m="";switch(c){case "reverse":case "both":for(var l=p;--l;)m=k[l]+m,L(M,h,m,a,O?1:(p-l)/p,g,n,F-1);m="";case "forward":for(l=0;l<p;l++)m+=k[l],L(M,h,m,a,O?(l+1)/p:1,g,n,F-
1);break;case "full":for(l=0;l<p;l++){const b=(O?l+1:p-l)/p;for(let c=p;c>l;c--)m=k.substring(l,c),L(M,h,m,a,b,g,n,F-1)}break;default:if(p=L(M,h,k,a,1,g,n,F-1),z&&1<q&&p>=n)for(p=h._ctx[k]||(h._ctx[k]=u()),k=this.j[k]||(this.j[k]=S(F-(n||0))),g=b-z,m=b+z+1,0>g&&(g=0),m>q&&(m=q);g<m;g++)g!==b&&L(k,p,e[g],a,0,F-(g<b?b-g:g-b),n,F-1)}}}this.b[f]=1;this.C=!1}return this};h.prototype.B=function(a,b,c){if(w(b))for(let d=0,e=b.length;d<e;d++){if(d===e-1)return this.B(a,b[d],c);this.B(a,b[d])}else{const p=
this.a.index,h=this.a.keys;var d=this.a.tag,e=this.a.id;let l;let r;for(var f=0;f<e.length;f++)l=(l||b)[e[f]];if(d){for(e=0;e<d.length;e++){var k=d[e];var g=k.split(":");for(f=0;f<g.length;f++)r=(r||b)[g[f]];r="@"+r}g=this.H[k];g=g[r]||(g[r]=[])}if("remove"===a){delete this.h[l];for(let a=0,b=h.length;a<b;a++){if(a===b-1)return p[h[a]].remove(l,c);p[h[a]].remove(l)}}e=this.a.field;g&&(g[g.length]=b);for(let f=0,g=e.length;f<g;f++){d=e[f];let m;for(k=0;k<d.length;k++)m=(m||b)[d[k]];this.h[l]=b;d=p[h[f]];
k="add"===a?d.add:d.update;if(f===g-1)return k.call(d,l,m,c);k.call(d,l,m)}}};h.prototype.update=function(a,b,c){if(this.a&&B(a))return this.B("update",a,b);this.b["@"+a]&&C(b)&&(this.remove(a),this.add(a,b,c,!0));return this};h.prototype.remove=function(a,b,c){if(this.a&&B(a))return this.B("remove",a,b);var d="@"+a;if(this.b[d]){if(this.g)return this.m[this.b[d]].postMessage({remove:!0,id:a}),delete this.b[d],b&&b(),this;if(!c){if(this.async&&"function"!==typeof importScripts){let c=this;d=new Promise(function(b){setTimeout(function(){c.remove(a,
null,!0);c=null;b()})});if(b)d.then(b);else return d;return this}if(b)return this.remove(a,null,!0),b(),this}for(b=0;b<this.c-(this.threshold||0);b++)P(this.i[b],a);this.depth&&P(this.j,a);delete this.b[d];this.C=!1}return this};let A;h.prototype.search=function(a,b,c,d){if(B(b)){if(w(b))for(var e=0;e<b.length;e++)b[e].query=a;else b.query=a;a=b;b=0}let f=a;let k,g,h=[];if(B(a)&&!w(a)){(c=a.callback||b)&&(f.callback=null);g=a.sort;k=a.where;b=a.limit;var m=a.threshold;a=a.query}if(this.a){m=this.a.index;
var l=f.field;if(l)f.field=null,w(l)||(l=[l]);else if(w(f)){var r=f;l=[];for(var q=0;q<f.length;q++)l[q]=f[q].field}else l=this.a.keys;g&&(f.sort=null);q=l.length;for(var n=0;n<q;n++)r&&(f=r[n]),h[n]=m[l[n]].search(f);if(c)return c(K.call(this,a,h,g,b,k,void 0));if(this.async){const c=this;return new Promise(function(d){Promise.all(h).then(function(e){d(K.call(c,a,e,g,b,k,void 0))})})}return K.call(this,a,h,g,b,k,void 0)}m||(m=this.threshold||0);D(b)?(c=b,b=1E3):b||0===b||(b=1E3);if(this.g)for(this.G=
c,this.v=0,this.o=[],l=0;l<this.g;l++)this.m[l].postMessage({search:!0,limit:b,cursor:void 0,threshold:m,where:k,content:a});else{if(!d){if(this.async&&"function"!==typeof importScripts){let a=this;m=new Promise(function(c){setTimeout(function(){c(a.search(f,b,null,!0));a=null})});if(c)m.then(c);else return m;return this}if(c)return c(this.search(f,b,null,!0)),this}if(!a||!C(a))return h;f=a;if(this.cache)if(this.C){if(c=this.l.get(a))return c}else this.l.clear(),this.C=!0;f=this.encode(f);if(!f.length)return h;
c=this.f;c=D(c)?c(f):f.split(U);this.filter&&(c=I(c,this.filter));r=c.length;d=!0;e=[];var t=u();1<r&&(this.depth?(l=!0,n=c[0],t[n]=1):c.sort(ba));if(!l||(q=this.j)[n]){let a=this.c;for(let b=l?1:0;b<r;b++){const f=c[b];if(f){if(!t[f]){const b=[];let c=!1,g=0;if(n=l?q[n]:this.i){let d;for(let e=0;e<a-m;e++)if(d=n[e][f])b[g++]=d,c=!0}if(c)e[e.length]=1<g?b.concat.apply([],b):b[0];else if(!this.u){d=!1;break}t[f]=1}n=f}}}else d=!1;d&&(h=R(e,b,void 0,this.u));this.cache&&!this.a&&this.l.set(a,h);return h}};
h.prototype.find=function(a,b){return this.where(a,b,1)[0]||null};h.prototype.where=function(a,b,c,d){const e=d||this.h,f=[];let g=0;var h;let t;if("number"===typeof a)return[e[a]];if(C(a)){if(v(b))return[e[a]];if("id"===a)return[e[b]];var m=1;var l=[a.split(":")];t=!0}else{if(D(a)){b=d||Object.keys(e);c=b.length;for(h=0;h<c;h++)m=d?d[h]:e[b[h]],a(m)&&(f[g++]=m);return f}c||(c=b);h=Object.keys(a);m=h.length;t=!1;if(1===m&&"id"===h[0])return[e[a.id]];if((l=this.K)&&!d)for(var r=0;r<l.length;r++){var q=
l[r],n=a[q];if(!v(n)){d=this.H[q]["@"+n];if(0===--m)return d;h.splice(h.indexOf(q),1);delete a[q];break}}l=Array(m);for(r=0;r<m;r++)l[r]=h[r].split(":")}r=d||Object.keys(e);q=r.length;for(n=0;n<q;n++){const k=d?d[n]:e[r[n]];let p=!0;for(let c=0;c<m;c++){t||(b=a[h[c]]);const d=l[c],e=d.length;let f=k;if(1<e)for(let a=0;a<e;a++)f=f[d[a]];else f=f[d[0]];if(f!==b){p=!1;break}}if(p&&(f[g++]=k,c&&g===c))break}return f};h.prototype.info=function(){if(this.g)for(var a=0;a<this.g;a++)this.m[a].postMessage({info:!0,
id:this.id});else{var b=0,c=0,d=0;for(var e=0;e<this.c-(this.threshold||0);e++){a=Object.keys(this.i[e]);for(let g=0;g<a.length;g++){var f=this.i[e][a[g]].length;b+=1*f+2*a[g].length+4;c+=f;d+=2*a[g].length}}a=Object.keys(this.b);f=a.length;for(e=0;e<f;e++)b+=2*a[e].length+2;return{id:this.id,memory:b,items:f,sequences:c,chars:d,cache:this.cache&&this.cache.s?this.cache.s.length:!1,matcher:N.length+(this.w?this.w.length:0),worker:this.g,threshold:this.threshold,depth:this.depth,contextual:this.depth&&
"strict"===this.f}}};h.prototype.clear=function(){return this.destroy().init()};h.prototype.destroy=function(){this.cache&&(this.l.clear(),this.l=null);this.i=this.j=this.b=null;if(this.a){const a=this.a.keys;for(let b=0;b<a.length;b++)this.a.index[a[b]].destroy();this.a=this.h=null}return this};h.prototype.export=function(){if(this.a){const a=this.a.keys,b=Array(a.length+1);let c=0;for(;c<a.length;c++){const d=this.a.index[a[c]];b[c]=[d.i,d.j,d.b]}b[c]=this.h;return JSON.stringify(b)}return JSON.stringify([this.i,
this.j,this.b])};h.prototype.import=function(a){a=JSON.parse(a);if(this.a){const b=this.a.keys,c=b.length;for(let d=0;d<c;d++){const e=this.a.index[b[d]];e.i=a[d][0];e.j=a[d][1];e.b=a[d][2];e.h=a[c]}this.h=a[c]}else this.i=a[0],this.j=a[1],this.b=a[2]};const J={icase:function(a){return a.toLowerCase()},simple:function(){const a=[g("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",g("[\u00e8\u00e9\u00ea\u00eb]"),"e",g("[\u00ec\u00ed\u00ee\u00ef]"),"i",g("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",g("[\u00f9\u00fa\u00fb\u00fc\u0171]"),
"u",g("[\u00fd\u0177\u00ff]"),"y",g("\u00f1"),"n",g("\u00e7"),"c",g("\u00df"),"s",g(" & ")," and ",g("[-/]")," ",g("[^a-z0-9 ]"),"",g("\\s+")," "];return function(b){b=E(b.toLowerCase(),a);return" "===b?"":b}}(),advanced:function(){const a=[g("ae"),"a",g("ai"),"ei",g("ay"),"ei",g("ey"),"ei",g("oe"),"o",g("ue"),"u",g("ie"),"i",g("sz"),"s",g("zs"),"s",g("sh"),"s",g("ck"),"k",g("cc"),"k",g("dt"),"t",g("ph"),"f",g("pf"),"f",g("ou"),"o",g("uo"),"u"];return function(b,c){if(!b)return b;b=this.simple(b);
2<b.length&&(b=E(b,a));c||1<b.length&&(b=Q(b));return b}}(),extra:function(){const a=[g("p"),"b",g("z"),"s",g("[cgq]"),"k",g("n"),"m",g("d"),"t",g("[vw]"),"f",g("[aeiouy]"),""];return function(b){if(!b)return b;b=this.advanced(b,!0);if(1<b.length){b=b.split(" ");for(let c=0;c<b.length;c++){const d=b[c];1<d.length&&(b[c]=d[0]+E(d.substring(1),a))}b=b.join(" ");b=Q(b)}return b}}(),balance:function(){const a=[g("[-/]")," ",g("[^a-z0-9 ]"),"",g("\\s+")," "];return function(b){return Q(E(b.toLowerCase(),
a))}}()},ea=function(){function a(a){this.clear();this.I=!0!==a&&a}a.prototype.clear=function(){this.cache=u();this.count=u();this.index=u();this.s=[]};a.prototype.set=function(a,c){if(this.I&&v(this.cache[a])){let b=this.s.length;if(b===this.I){b--;const a=this.s[b];delete this.cache[a];delete this.count[a];delete this.index[a]}this.index[a]=b;this.s[b]=a;this.count[a]=-1;this.cache[a]=c;this.get(a)}else this.cache[a]=c};a.prototype.get=function(a){const b=this.cache[a];if(this.I&&b){var d=++this.count[a];
const b=this.index;let c=b[a];if(0<c){const f=this.s;for(var e=c;this.count[f[--c]]<=d&&-1!==c;);c++;if(c!==e){for(d=e;d>c;d--)e=f[d-1],f[d]=e,b[e]=d;f[c]=a;b[a]=c}}}return b};return a}();return h}(function(){const x={},G="undefined"!==typeof Blob&&"undefined"!==typeof URL&&URL.createObjectURL;return function(h,y,I,K,H){I=G?URL.createObjectURL(new Blob(["("+I.toString()+")()"],{type:"text/javascript"})):h+".min.js";h+="-"+y;x[h]||(x[h]=[]);x[h][H]=new Worker(I);x[h][H].onmessage=K;return x[h][H]}}()),
this);
'use strict';(function(z,G,k){let A;(A=k.define)&&A.amd?A([],function(){return G}):(A=k.modules)?A[z.toLowerCase()]=G:"object"===typeof exports?module.exports=G:k[z]=G})("FlexSearch",function X(z){function k(a,c){const b=c?c.id:a&&a.id;this.id=b||0===b?b:Y++;this.init(a,c);H(this,"index",function(){return this.b});H(this,"length",function(){return Object.keys(this.b).length})}function A(a,c,b,d){this.v!==this.g&&(this.o=this.o.concat(b),this.v++,d&&this.o.length>=d&&(this.v=this.g),this.v===this.g&&
(this.cache&&this.l.set(c,this.o),this.G&&this.G(this.o)));return this}function I(a,c){const b=a.length,d=E(c),e=[];for(let f=0,h=0;f<b;f++){const b=a[f];if(d&&c(b)||!d&&!c[b])e[h++]=b}return e}function K(a,c,b,d,e,f,h){const m=this.h;c=b=P(b,c,f?0:e,h,this.u);b=c.length;h=Array(b);for(let a=0;a<b;a++)h[a]=m[c[a]];b=h;f&&(b=this.where(f,null,e,b));d&&(E(d)||(B=d.split(":"),1<B.length?d=Z:(B=B[0],d=aa)),b.sort(d));this.cache&&this.l.set(a,b);return b}function H(a,c,b){Object.defineProperty(a,c,{get:b})}
function g(a){return new RegExp(a,"g")}function F(a,c){for(let b=0;b<c.length;b+=2)a=a.replace(c[b],c[b+1]);return a}function L(a,c,b,d,e,f,h,m){if(c[b])return c[b];e=e?(m-(h||m/1.5))*f+(h||m/1.5)*e:f;c[b]=e;e>=h&&(a=a[m-(e+.5>>0)],a=a[b]||(a[b]=[]),a[a.length]=d);return e}function N(a,c){if(a){const b=Object.keys(a);for(let d=0,e=b.length;d<e;d++){const e=b[d],h=a[e];if(h)for(let b=0,d=h.length;b<d;b++)if(h[b]===c){1===d?delete a[e]:h.splice(b,1);break}else C(h[b])&&N(h[b],c)}}}function O(a){let c=
"",b="";var d="";for(let e=0;e<a.length;e++){const f=a[e];if(f!==b)if(e&&"h"===f){if(d="a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d,("a"===b||"e"===b||"i"===b||"o"===b||"u"===b||"y"===b)&&d||" "===b)c+=f}else c+=f;d=e===a.length-1?"":a[e+1];b=f}return c}function ba(a,c){a=a.length-c.length;return 0>a?1:a?-1:0}function aa(a,c){a=a[B];c=c[B];return a<c?-1:a>c?1:0}function Z(a,c){const b=B.length;for(let d=0;d<b;d++)a=a[B[d]],c=c[B[d]];return a<c?-1:a>c?1:0}function P(a,c,b,d,e){d=[];let f;const h=
a.length;if(1<h){c="or"===c;const t=u();let g,n=-1,l,p=0,k,x,R=!0,v=0;for(;++n<h;){const r=n===h-1;g=a[n];l=g.length;if(!l){if(!c&&!e)return d;if(r&&!v)return k||d;continue}if(R){if(r)return g;for(;p<l;)t["@"+g[p++]]=1;k=g;R=!1;continue}let Q=!1;f=[];for(p=0;p<l;){x=g[p++];var m="@"+x;if(t[m]){const a=t[m];if(c||a===n){if(r){if(d[v++]=x,b&&v===b)return d}else t[m]=n+1;Q=!0}else e&&(m=f[a]||(f[a]=[]),m[m.length]=x)}}if(!Q&&!e)break}if(e&&(v=d.length,(n=f.length)&&(!b||v<b)))for(;n--;)if(x=f[n])for(p=
0,l=x.length;p<l;p++)if(d[v++]=x[p],b&&v===b)return d}else h&&(d=a[0],b&&d.length>b&&(d=d.slice(0,b)));return d}function D(a){return"string"===typeof a}function y(a){return a.constructor===Array}function E(a){return"function"===typeof a}function C(a){return"object"===typeof a}function w(a){return"undefined"===typeof a}function S(a){const c=Array(a);for(let b=0;b<a;b++)c[b]=u();return c}function u(){return Object.create(null)}function ca(){let a,c;self.onmessage=function(b){if(b=b.data)if(b.search){const d=
c.search(b.content,b.threshold?{limit:b.limit,threshold:b.threshold,where:b.where}:b.limit);self.postMessage({id:a,content:b.content,limit:b.limit,result:d})}else b.add?c.add(b.id,b.content):b.update?c.update(b.id,b.content):b.remove?c.remove(b.id):b.clear?c.clear():b.info?(b=c.info(),b.worker=a,console.log(b)):b.register&&(a=b.id,b.options.cache=!1,b.options.async=!1,b.options.worker=!1,c=(new Function(b.register.substring(b.register.indexOf("{")+1,b.register.lastIndexOf("}"))))(),c=new c(b.options))}}
function da(a,c,b,d){a=z("flexsearch","id"+a,ca,function(a){(a=a.data)&&a.result&&d(a.id,a.content,a.result,a.limit,a.where,a.cursor,a.suggest)},c);const e=X.toString();b.id=c;a.postMessage({register:e,options:b,id:c});return a}const q={encode:"icase",f:"forward",u:!1,cache:!1,async:!1,g:!1,F:!1,a:!1,J:!1,c:9,threshold:0,depth:0},T={memory:{encode:"extra",f:"strict",threshold:0,c:1},speed:{encode:"icase",f:"strict",threshold:1,c:3,depth:2},match:{encode:"extra",f:"full",threshold:1,c:3},score:{encode:"extra",
f:"strict",threshold:1,c:9,depth:4},balance:{encode:"balance",f:"strict",threshold:0,c:3,depth:3},fast:{encode:"icase",f:"strict",threshold:8,c:9,depth:1}},M=[];let Y=0;const U=/\W+/,V={},W={};k.create=function(a){return new k(a)};k.registerMatcher=function(a){for(const c in a)a.hasOwnProperty(c)&&M.push(g(c),a[c]);return this};k.registerEncoder=function(a,c){J[a]=c.bind(J);return this};k.registerLanguage=function(a,c){V[a]=c.filter;W[a]=c.stemmer;return this};k.encode=function(a,c){return J[a](c)};
k.prototype.init=function(a,c){this.w=[];if(c){var b=c.preset;a=c}else a||(a=q),b=a.preset;c={};D(a)?(c=T[a],a={}):b&&(c=T[b]);if(b=a.worker)if("undefined"===typeof Worker)a.worker=!1,this.m=null;else{var d=parseInt(b,10)||4;this.D=-1;this.v=0;this.o=[];this.G=null;this.m=Array(d);for(var e=0;e<d;e++)this.m[e]=da(this.id,e,a,A.bind(this))}this.f=a.tokenize||c.f||this.f||q.f;this.F=a.rtl||this.F||q.F;this.async="undefined"===typeof Promise||w(b=a.async)?this.async||q.async:b;this.g=w(b=a.worker)?this.g||
q.g:b;this.threshold=w(b=a.threshold)?c.threshold||this.threshold||q.threshold:b;this.c=w(b=a.resolution)?b=c.c||this.c||q.c:b;b<=this.threshold&&(this.c=this.threshold+1);this.depth=w(b=a.depth)?c.depth||this.depth||q.depth:b;this.J=w(b=a.paging)?this.J||q.J:b;this.u=w(b=a.suggest)?this.u||q.u:b;this.A=(b=w(b=a.encode)?c.encode||q.encode:b)&&J[b]&&J[b].bind(J)||(E(b)?b:this.A||!1);(b=a.matcher)&&this.addMatcher(b);if(b=a.filter){D(b)&&(b=V[b]);if(y(b)){c=this.A;d=u();for(e=0;e<b.length;e++){var f=
c?c(b[e]):b[e];d[f]=1}b=d}this.filter=b}if(b=a.stemmer){var h;c=D(b)?W[b]:b;d=this.A;e=[];for(h in c)c.hasOwnProperty(h)&&(f=d?d(h):h,e.push(g(f+"($|\\W)"),d?d(c[h]):c[h]));this.stemmer=h=e}this.a=e=(b=a.doc)?b:this.a||q.a;this.i=S(this.c-(this.threshold||0));this.j=u();this.b=u();if(e){this.h=u();a.doc=null;h=e.index={};c=e.keys=[];d=e.field;f=e.tag;y(e.id)||(e.id=e.id.split(":"));if(f){this.H=u();let c=u();if(d)if(D(d))c[d]=a;else if(y(d))for(let b=0;b<d.length;b++)c[d[b]]=a;else C(d)&&(c=d);y(f)||
(e.tag=f=[f]);for(d=0;d<f.length;d++)this.H[f[d]]=u();this.K=f;d=c}if(d){let b;y(d)||(C(d)?(b=d,e.field=d=Object.keys(d)):e.field=d=[d]);for(e=0;e<d.length;e++)f=d[e],y(f)||(b&&(a=b[f]),c[e]=f,d[e]=f.split(":")),h[f]=new k(a),h[f].h=this.h}}this.C=!0;this.l=(this.cache=b=w(b=a.cache)?this.cache||q.cache:b)?new ea(b):!1;return this};k.prototype.encode=function(a){a&&M.length&&(a=F(a,M));a&&this.w.length&&(a=F(a,this.w));a&&this.A&&(a=this.A(a));a&&this.stemmer&&(a=F(a,this.stemmer));return a};k.prototype.addMatcher=
function(a){const c=this.w;for(const b in a)a.hasOwnProperty(b)&&c.push(g(b),a[b]);return this};k.prototype.add=function(a,c,b,d,e){if(this.a&&C(a))return this.B("add",a,c);if(c&&D(c)&&(a||0===a)){var f="@"+a;if(this.b[f]&&!d)return this.update(a,c);if(this.g)return++this.D>=this.m.length&&(this.D=0),this.m[this.D].postMessage({add:!0,id:a,content:c}),this.b[f]=""+this.D,b&&b(),this;if(!e){if(this.async&&"function"!==typeof importScripts){let e=this;f=new Promise(function(b){setTimeout(function(){e.add(a,
c,null,d,!0);e=null;b()})});if(b)f.then(b);else return f;return this}if(b)return this.add(a,c,null,d,!0),b(),this}c=this.encode(c);if(!c.length)return this;b=this.f;e=E(b)?b(c):c.split(U);this.filter&&(e=I(e,this.filter));const l=u();l._ctx=u();const p=e.length,k=this.threshold,x=this.depth,r=this.c,v=this.i,q=this.F;for(let c=0;c<p;c++){var h=e[c];if(h){var m=h.length,t=(q?c+1:p-c)/p,g="";switch(b){case "reverse":case "both":for(var n=m;--n;)g=h[n]+g,L(v,l,g,a,q?1:(m-n)/m,t,k,r-1);g="";case "forward":for(n=
0;n<m;n++)g+=h[n],L(v,l,g,a,q?(n+1)/m:1,t,k,r-1);break;case "full":for(n=0;n<m;n++){const c=(q?n+1:m-n)/m;for(let b=m;b>n;b--)g=h.substring(n,b),L(v,l,g,a,c,t,k,r-1)}break;default:if(m=L(v,l,h,a,1,t,k,r-1),x&&1<p&&m>=k)for(m=l._ctx[h]||(l._ctx[h]=u()),h=this.j[h]||(this.j[h]=S(r-(k||0))),t=c-x,g=c+x+1,0>t&&(t=0),g>p&&(g=p);t<g;t++)t!==c&&L(h,m,e[t],a,0,r-(t<c?c-t:t-c),k,r-1)}}}this.b[f]=1;this.C=!1}return this};k.prototype.B=function(a,c,b){if(y(c))for(let d=0,e=c.length;d<e;d++){if(d===e-1)return this.B(a,
c[d],b);this.B(a,c[d])}else{const g=this.a.index,k=this.a.keys;var d=this.a.tag,e=this.a.id;let n;let l;for(var f=0;f<e.length;f++)n=(n||c)[e[f]];if(d){for(e=0;e<d.length;e++){var h=d[e];var m=h.split(":");for(f=0;f<m.length;f++)l=(l||c)[m[f]];l="@"+l}m=this.H[h];m=m[l]||(m[l]=[])}if("remove"===a){delete this.h[n];for(let a=0,c=k.length;a<c;a++){if(a===c-1)return g[k[a]].remove(n,b);g[k[a]].remove(n)}}e=this.a.field;m&&(m[m.length]=c);for(let f=0,m=e.length;f<m;f++){d=e[f];let l;for(h=0;h<d.length;h++)l=
(l||c)[d[h]];this.h[n]=c;d=g[k[f]];h="add"===a?d.add:d.update;if(f===m-1)return h.call(d,n,l,b);h.call(d,n,l)}}};k.prototype.update=function(a,c,b){if(this.a&&C(a))return this.B("update",a,c);this.b["@"+a]&&D(c)&&(this.remove(a),this.add(a,c,b,!0));return this};k.prototype.remove=function(a,c,b){if(this.a&&C(a))return this.B("remove",a,c);var d="@"+a;if(this.b[d]){if(this.g)return this.m[this.b[d]].postMessage({remove:!0,id:a}),delete this.b[d],c&&c(),this;if(!b){if(this.async&&"function"!==typeof importScripts){let b=
this;d=new Promise(function(c){setTimeout(function(){b.remove(a,null,!0);b=null;c()})});if(c)d.then(c);else return d;return this}if(c)return this.remove(a,null,!0),c(),this}for(c=0;c<this.c-(this.threshold||0);c++)N(this.i[c],a);this.depth&&N(this.j,a);delete this.b[d];this.C=!1}return this};let B;k.prototype.search=function(a,c,b,d){if(C(c)){if(y(c))for(var e=0;e<c.length;e++)c[e].query=a;else c.query=a;a=c;c=0}let f=a;let h=[];if(C(a)&&!y(a)){(b=a.callback||c)&&(f.callback=null);c=a.limit;var m=
a.threshold;a=a.query}if(this.a){let d=f.where,e=f.bool,p=f.sort;m=this.a.index;var g=f.field;if(g)f.field=null,y(g)||(g=[g]);else if(y(f)){var k=f;g=[];for(var n=0;n<f.length;n++){var l=f[n];g[n]=l.field;e=l.bool;p=l.sort;d=l.where}}else g=this.a.keys;n=g.length;for(l=0;l<n;l++)k&&(f=k[l]),h[l]=m[g[l]].search(f);if(b)return b(K.call(this,a,e,h,p,c,d,void 0));if(this.async){const b=this;return new Promise(function(f){Promise.all(h).then(function(h){f(K.call(b,a,e,h,p,c,d,void 0))})})}return K.call(this,
a,e,h,p,c,d,void 0)}m||(m=this.threshold||0);E(c)?(b=c,c=1E3):c||0===c||(c=1E3);if(this.g)for(this.G=b,this.v=0,this.o=[],g=0;g<this.g;g++)this.m[g].postMessage({search:!0,limit:c,cursor:void 0,threshold:m,content:a});else{if(!d){if(this.async&&"function"!==typeof importScripts){let a=this;m=new Promise(function(b){setTimeout(function(){b(a.search(f,c,null,!0));a=null})});if(b)m.then(b);else return m;return this}if(b)return b(this.search(f,c,null,!0)),this}if(!a||!D(a))return h;f=a;if(this.cache)if(this.C){if(b=
this.l.get(a))return b}else this.l.clear(),this.C=!0;f=this.encode(f);if(!f.length)return h;b=this.f;b=E(b)?b(f):f.split(U);this.filter&&(b=I(b,this.filter));k=b.length;d=!0;e=[];var p=u();1<k&&(this.depth?(g=!0,l=b[0],p[l]=1):b.sort(ba));if(!g||(n=this.j)[l]){let a=this.c;for(let c=g?1:0;c<k;c++){const f=b[c];if(f){if(!p[f]){const c=[];let b=!1,h=0;if(l=g?n[l]:this.i){let d;for(let e=0;e<a-m;e++)if(d=l[e][f])c[h++]=d,b=!0}if(b)e[e.length]=1<h?c.concat.apply([],c):c[0];else if(!this.u){d=!1;break}p[f]=
1}l=f}}}else d=!1;this.a||(d&&(h=P(e,!1,c,void 0,this.u)),this.cache&&this.l.set(a,h));return h}};k.prototype.find=function(a,c){return this.where(a,c,1)[0]||null};k.prototype.where=function(a,c,b,d){const e=d||this.h,f=[];let h=0;var g;let k;if("number"===typeof a)return[e[a]];if(D(a)){if(w(c))return[e[a]];if("id"===a)return[e[c]];var r=1;var n=[a.split(":")];k=!0}else{if(E(a)){c=d||Object.keys(e);b=c.length;for(g=0;g<b;g++)r=d?d[g]:e[c[g]],a(r)&&(f[h++]=r);return f}b||(b=c);g=Object.keys(a);r=g.length;
k=!1;if(1===r&&"id"===g[0])return[e[a.id]];if((n=this.K)&&!d)for(var l=0;l<n.length;l++){var p=n[l],q=a[p];if(!w(q)){d=this.H[p]["@"+q];if(0===--r)return d;g.splice(g.indexOf(p),1);delete a[p];break}}n=Array(r);for(l=0;l<r;l++)n[l]=g[l].split(":")}l=d||Object.keys(e);p=l.length;for(q=0;q<p;q++){const m=d?d[q]:e[l[q]];let p=!0;for(let b=0;b<r;b++){k||(c=a[g[b]]);const d=n[b],e=d.length;let f=m;if(1<e)for(let a=0;a<e;a++)f=f[d[a]];else f=f[d[0]];if(f!==c){p=!1;break}}if(p&&(f[h++]=m,b&&h===b))break}return f};
k.prototype.info=function(){if(this.g)for(var a=0;a<this.g;a++)this.m[a].postMessage({info:!0,id:this.id});else{var c=0,b=0,d=0;for(var e=0;e<this.c-(this.threshold||0);e++){a=Object.keys(this.i[e]);for(let g=0;g<a.length;g++){var f=this.i[e][a[g]].length;c+=1*f+2*a[g].length+4;b+=f;d+=2*a[g].length}}a=Object.keys(this.b);f=a.length;for(e=0;e<f;e++)c+=2*a[e].length+2;return{id:this.id,memory:c,items:f,sequences:b,chars:d,cache:this.cache&&this.cache.s?this.cache.s.length:!1,matcher:M.length+(this.w?
this.w.length:0),worker:this.g,threshold:this.threshold,depth:this.depth,contextual:this.depth&&"strict"===this.f}}};k.prototype.clear=function(){return this.destroy().init()};k.prototype.destroy=function(){this.cache&&(this.l.clear(),this.l=null);this.i=this.j=this.b=null;if(this.a){const a=this.a.keys;for(let c=0;c<a.length;c++)this.a.index[a[c]].destroy();this.a=this.h=null}return this};k.prototype.export=function(){if(this.a){const a=this.a.keys,c=Array(a.length+1);let b=0;for(;b<a.length;b++){const d=
this.a.index[a[b]];c[b]=[d.i,d.j,d.b]}c[b]=this.h;return JSON.stringify(c)}return JSON.stringify([this.i,this.j,this.b])};k.prototype.import=function(a){a=JSON.parse(a);if(this.a){const c=this.a.keys,b=c.length;for(let d=0;d<b;d++){const e=this.a.index[c[d]];e.i=a[d][0];e.j=a[d][1];e.b=a[d][2];e.h=a[b]}this.h=a[b]}else this.i=a[0],this.j=a[1],this.b=a[2]};const J={icase:function(a){return a.toLowerCase()},simple:function(){const a=[g("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",g("[\u00e8\u00e9\u00ea\u00eb]"),
"e",g("[\u00ec\u00ed\u00ee\u00ef]"),"i",g("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",g("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",g("[\u00fd\u0177\u00ff]"),"y",g("\u00f1"),"n",g("\u00e7"),"c",g("\u00df"),"s",g(" & ")," and ",g("[-/]")," ",g("[^a-z0-9 ]"),"",g("\\s+")," "];return function(c){c=F(c.toLowerCase(),a);return" "===c?"":c}}(),advanced:function(){const a=[g("ae"),"a",g("ai"),"ei",g("ay"),"ei",g("ey"),"ei",g("oe"),"o",g("ue"),"u",g("ie"),"i",g("sz"),"s",g("zs"),"s",g("sh"),"s",g("ck"),"k",
g("cc"),"k",g("dt"),"t",g("ph"),"f",g("pf"),"f",g("ou"),"o",g("uo"),"u"];return function(c,b){if(!c)return c;c=this.simple(c);2<c.length&&(c=F(c,a));b||1<c.length&&(c=O(c));return c}}(),extra:function(){const a=[g("p"),"b",g("z"),"s",g("[cgq]"),"k",g("n"),"m",g("d"),"t",g("[vw]"),"f",g("[aeiouy]"),""];return function(c){if(!c)return c;c=this.advanced(c,!0);if(1<c.length){c=c.split(" ");for(let b=0;b<c.length;b++){const d=c[b];1<d.length&&(c[b]=d[0]+F(d.substring(1),a))}c=c.join(" ");c=O(c)}return c}}(),
balance:function(){const a=[g("[-/]")," ",g("[^a-z0-9 ]"),"",g("\\s+")," "];return function(c){return O(F(c.toLowerCase(),a))}}()},ea=function(){function a(a){this.clear();this.I=!0!==a&&a}a.prototype.clear=function(){this.cache=u();this.count=u();this.index=u();this.s=[]};a.prototype.set=function(a,b){if(this.I&&w(this.cache[a])){let c=this.s.length;if(c===this.I){c--;const a=this.s[c];delete this.cache[a];delete this.count[a];delete this.index[a]}this.index[a]=c;this.s[c]=a;this.count[a]=-1;this.cache[a]=
b;this.get(a)}else this.cache[a]=b};a.prototype.get=function(a){const b=this.cache[a];if(this.I&&b){var c=++this.count[a];const b=this.index;let d=b[a];if(0<d){const f=this.s;for(var e=d;this.count[f[--d]]<=c&&-1!==d;);d++;if(d!==e){for(c=e;c>d;c--)e=f[c-1],f[c]=e,b[e]=c;f[d]=a;b[a]=d}}}return b};return a}();return k}(function(){const z={},G="undefined"!==typeof Blob&&"undefined"!==typeof URL&&URL.createObjectURL;return function(k,A,I,K,H){I=G?URL.createObjectURL(new Blob(["("+I.toString()+")()"],
{type:"text/javascript"})):k+".min.js";k+="-"+A;z[k]||(z[k]=[]);z[k][H]=new Worker(I);z[k][H].onmessage=K;return z[k][H]}}()),this);

View File

@@ -1,35 +1,35 @@
/*
FlexSearch v0.5.2
FlexSearch v0.5.3
Copyright 2019 Nextapps GmbH
Author: Thomas Wilkerling
Released under the Apache 2.0 Licence
https://github.com/nextapps-de/flexsearch
*/
'use strict';(function(h,C,D){let z;(z=D.define)&&z.amd?z([],function(){return C}):(z=D.modules)?z[h.toLowerCase()]=C:"object"===typeof exports?module.exports=C:D[h]=C})("FlexSearch",function(){function h(a,b){const c=b?b.id:a&&a.id;this.id=c||0===c?c:T++;this.init(a,b);z(this,"index",function(){return this.c});z(this,"length",function(){return Object.keys(this.c).length})}function C(a,b){const c=a.length,d=E(b),e=[];for(let f=0,k=0;f<c;f++){const c=a[f];if(d&&b(c)||!d&&!b[c])e[k++]=c}return e}function D(a,
b,c,d,e,f){const k=this.g;b=N(b,e?0:d,f,this.m);{f=b.length;const a=Array(f);for(let c=0;c<f;c++)a[c]=k[b[c]];b=a}e&&(b=this.where(e,null,d,b));c&&(E(c)||(y=c.split(":"),1<y.length?c=U:(y=y[0],c=V)),b.sort(c));this.cache&&this.j.set(a,b);return b}function z(a,b,c){Object.defineProperty(a,b,{get:c})}function g(a){return new RegExp(a,"g")}function F(a,b){for(let c=0;c<b.length;c+=2)a=a.replace(b[c],b[c+1]);return a}function H(a,b,c,d,e,f,k,p){if(b[c])return b[c];e=e?(p-(k||p/1.5))*f+(k||p/1.5)*e:f;
b[c]=e;e>=k&&(a=a[p-(e+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=d);return e}function L(a,b){if(a){const c=Object.keys(a);for(let d=0,e=c.length;d<e;d++){const e=c[d],k=a[e];if(k)for(let c=0,d=k.length;c<d;c++)if(k[c]===b){1===d?delete a[e]:k.splice(c,1);break}else A(k[c])&&L(k[c],b)}}}function M(a){let b="",c="";var d="";for(let e=0;e<a.length;e++){const f=a[e];if(f!==c)if(e&&"h"===f){if(d="a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&d||
" "===c)b+=f}else b+=f;d=e===a.length-1?"":a[e+1];c=f}return b}function W(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function V(a,b){a=a[y];b=b[y];return a<b?-1:a>b?1:0}function U(a,b){const c=y.length;for(let d=0;d<c;d++)a=a[y[d]],b=b[y[d]];return a<b?-1:a>b?1:0}function N(a,b,c,d){c=[];let e;const f=a.length;if(1<f){const p=t();let x=a[0],m=x.length,l=0;for(;l<m;)p["@"+x[l++]]=1;let g,q=0,n=0;for(;++n<f;){let r=!1;const h=n===f-1;e=[];x=a[n];m=x.length;for(l=0;l<m;){g=x[l++];var k="@"+g;if(p[k]){const a=
p[k];if(a===n){if(h){if(c[q++]=g,b&&q===b)return c}else p[k]=n+1;r=!0}else d&&(k=e[a]||(e[a]=[]),k[k.length]=g)}}if(!r&&!d)break}if(d&&(q=c.length,(n=e.length)&&(!b||q<b)))for(;n--;)if(g=e[n])for(l=0,m=g.length;l<m;l++)if(c[q++]=g[l],b&&q===b)return c}else f&&(c=a[0],b&&c.length>b&&(c=c.slice(0,b)));return c}function B(a){return"string"===typeof a}function v(a){return a.constructor===Array}function E(a){return"function"===typeof a}function A(a){return"object"===typeof a}function w(a){return"undefined"===
typeof a}function O(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=t();return b}function t(){return Object.create(null)}const u={encode:"icase",f:"forward",m:!1,cache:!1,async:!1,F:!1,w:!1,a:!1,C:!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 T=0;const Q=/\W+/,R={},S={};h.create=function(a){return new h(a)};h.registerMatcher=function(a){for(const b in a)a.hasOwnProperty(b)&&J.push(g(b),a[b]);return this};h.registerEncoder=function(a,b){G[a]=b.bind(G);return this};h.registerLanguage=function(a,b){R[a]=b.filter;S[a]=b.stemmer;return this};h.encode=function(a,b){return G[a](b)};h.prototype.init=function(a,b){this.o=[];if(b){var c=b.preset;a=b}else a||(a=u),c=a.preset;b={};
B(a)?(b=P[a],a={}):c&&(b=P[c]);this.f=a.tokenize||b.f||this.f||u.f;this.w=a.rtl||this.w||u.w;this.async="undefined"===typeof Promise||w(c=a.async)?this.async||u.async:c;this.threshold=w(c=a.threshold)?b.threshold||this.threshold||u.threshold:c;this.b=w(c=a.resolution)?c=b.b||this.b||u.b:c;c<=this.threshold&&(this.b=this.threshold+1);this.depth=w(c=a.depth)?b.depth||this.depth||u.depth:c;this.C=w(c=a.paging)?this.C||u.C:c;this.m=w(c=a.suggest)?this.m||u.m:c;this.s=(c=w(c=a.encode)?b.encode||u.encode:
c)&&G[c]&&G[c].bind(G)||(E(c)?c:this.s||!1);(c=a.matcher)&&this.addMatcher(c);if(c=a.filter){B(c)&&(c=R[c]);if(v(c)){b=this.s;var d=t();for(var e=0;e<c.length;e++){var f=b?b(c[e]):c[e];d[f]=1}c=d}this.filter=c}if(c=a.stemmer){var k;b=B(c)?S[c]:c;d=this.s;e=[];for(k in b)b.hasOwnProperty(k)&&(f=d?d(k):k,e.push(g(f+"($|\\W)"),d?d(b[k]):b[k]));this.stemmer=k=e}this.a=e=(c=a.doc)?c:this.a||u.a;this.h=O(this.b-(this.threshold||0));this.i=t();this.c=t();if(e){this.g=t();a.doc=null;k=e.index={};b=e.keys=
[];d=e.field;f=e.tag;v(e.id)||(e.id=e.id.split(":"));if(f){this.A=t();let b=t();if(d)if(B(d))b[d]=a;else if(v(d))for(let c=0;c<d.length;c++)b[d[c]]=a;else A(d)&&(b=d);v(f)||(e.tag=f=[f]);for(d=0;d<f.length;d++)this.A[f[d]]=t();this.D=f;d=b}if(d){let c;v(d)||(A(d)?(c=d,e.field=d=Object.keys(d)):e.field=d=[d]);for(e=0;e<d.length;e++)f=d[e],v(f)||(c&&(a=c[f]),b[e]=f,d[e]=f.split(":")),k[f]=new h(a),k[f].g=this.g}}this.v=!0;this.j=(this.cache=c=w(c=a.cache)?this.cache||u.cache:c)?new X(c):!1;return this};
h.prototype.encode=function(a){a&&J.length&&(a=F(a,J));a&&this.o.length&&(a=F(a,this.o));a&&this.s&&(a=this.s(a));a&&this.stemmer&&(a=F(a,this.stemmer));return a};h.prototype.addMatcher=function(a){const b=this.o;for(const c in a)a.hasOwnProperty(c)&&b.push(g(c),a[c]);return this};h.prototype.add=function(a,b,c,d,e){if(this.a&&A(a))return this.u("add",a,b);if(b&&B(b)&&(a||0===a)){var f="@"+a;if(this.c[f]&&!d)return this.update(a,b);if(!e){if(this.async&&"function"!==typeof importScripts){let e=this;
f=new Promise(function(c){setTimeout(function(){e.add(a,b,null,d,!0);e=null;c()})});if(c)f.then(c);else return f;return this}if(c)return this.add(a,b,null,d,!0),c(),this}b=this.encode(b);if(!b.length)return this;c=this.f;e=E(c)?c(b):b.split(Q);this.filter&&(e=C(e,this.filter));const r=t();r._ctx=t();const q=e.length,n=this.threshold,x=this.depth,h=this.b,I=this.h,K=this.w;for(let b=0;b<q;b++){var k=e[b];if(k){var p=k.length,g=(K?b+1:q-b)/q,m="";switch(c){case "reverse":case "both":for(var l=p;--l;)m=
k[l]+m,H(I,r,m,a,K?1:(p-l)/p,g,n,h-1);m="";case "forward":for(l=0;l<p;l++)m+=k[l],H(I,r,m,a,K?(l+1)/p:1,g,n,h-1);break;case "full":for(l=0;l<p;l++){const b=(K?l+1:p-l)/p;for(let c=p;c>l;c--)m=k.substring(l,c),H(I,r,m,a,b,g,n,h-1)}break;default:if(p=H(I,r,k,a,1,g,n,h-1),x&&1<q&&p>=n)for(p=r._ctx[k]||(r._ctx[k]=t()),k=this.i[k]||(this.i[k]=O(h-(n||0))),g=b-x,m=b+x+1,0>g&&(g=0),m>q&&(m=q);g<m;g++)g!==b&&H(k,p,e[g],a,0,h-(g<b?b-g:g-b),n,h-1)}}}this.c[f]=1;this.v=!1}return this};h.prototype.u=function(a,
b,c){if(v(b))for(let d=0,e=b.length;d<e;d++){if(d===e-1)return this.u(a,b[d],c);this.u(a,b[d])}else{const p=this.a.index,m=this.a.keys;var d=this.a.tag,e=this.a.id;let l;let h;for(var f=0;f<e.length;f++)l=(l||b)[e[f]];if(d){for(e=0;e<d.length;e++){var k=d[e];var g=k.split(":");for(f=0;f<g.length;f++)h=(h||b)[g[f]];h="@"+h}g=this.A[k];g=g[h]||(g[h]=[])}if("remove"===a){delete this.g[l];for(let b=0,a=m.length;b<a;b++){if(b===a-1)return p[m[b]].remove(l,c);p[m[b]].remove(l)}}e=this.a.field;g&&(g[g.length]=
b);for(let f=0,g=e.length;f<g;f++){d=e[f];let h;for(k=0;k<d.length;k++)h=(h||b)[d[k]];this.g[l]=b;d=p[m[f]];k="add"===a?d.add:d.update;if(f===g-1)return k.call(d,l,h,c);k.call(d,l,h)}}};h.prototype.update=function(a,b,c){if(this.a&&A(a))return this.u("update",a,b);this.c["@"+a]&&B(b)&&(this.remove(a),this.add(a,b,c,!0));return this};h.prototype.remove=function(a,b,c){if(this.a&&A(a))return this.u("remove",a,b);var d="@"+a;if(this.c[d]){if(!c){if(this.async&&"function"!==typeof importScripts){let c=
this;d=new Promise(function(b){setTimeout(function(){c.remove(a,null,!0);c=null;b()})});if(b)d.then(b);else return d;return this}if(b)return this.remove(a,null,!0),b(),this}for(b=0;b<this.b-(this.threshold||0);b++)L(this.h[b],a);this.depth&&L(this.i,a);delete this.c[d];this.v=!1}return this};let y;h.prototype.search=function(a,b,c,d){if(A(b)){if(v(b))for(var e=0;e<b.length;e++)b[e].query=a;else b.query=a;a=b;b=0}let f=a;let k,g,h=[];if(A(a)&&!v(a)){(c=a.callback||b)&&(f.callback=null);g=a.sort;k=
a.where;b=a.limit;var m=a.threshold;a=a.query}if(this.a){m=this.a.index;var l=f.field;if(l)f.field=null,v(l)||(l=[l]);else if(v(f)){var r=f;l=[];for(var q=0;q<f.length;q++)l[q]=f[q].field}else l=this.a.keys;g&&(f.sort=null);q=l.length;for(var n=0;n<q;n++)r&&(f=r[n]),h[n]=m[l[n]].search(f);if(c)return c(D.call(this,a,h,g,b,k,void 0));if(this.async){const c=this;return new Promise(function(d){Promise.all(h).then(function(e){d(D.call(c,a,e,g,b,k,void 0))})})}return D.call(this,a,h,g,b,k,void 0)}m||(m=
this.threshold||0);E(b)?(c=b,b=1E3):b||0===b||(b=1E3);if(!d){if(this.async&&"function"!==typeof importScripts){let a=this;m=new Promise(function(c){setTimeout(function(){c(a.search(f,b,null,!0));a=null})});if(c)m.then(c);else return m;return this}if(c)return c(this.search(f,b,null,!0)),this}if(!a||!B(a))return h;f=a;if(this.cache)if(this.v){if(c=this.j.get(a))return c}else this.j.clear(),this.v=!0;f=this.encode(f);if(!f.length)return h;c=this.f;c=E(c)?c(f):f.split(Q);this.filter&&(c=C(c,this.filter));
r=c.length;d=!0;e=[];const u=t();1<r&&(this.depth?(l=!0,n=c[0],u[n]=1):c.sort(W));if(!l||(q=this.i)[n]){let b=this.b;for(let a=l?1:0;a<r;a++){const f=c[a];if(f){if(!u[f]){const a=[];let c=!1,g=0;if(n=l?q[n]:this.h){let d;for(let e=0;e<b-m;e++)if(d=n[e][f])a[g++]=d,c=!0}if(c)e[e.length]=1<g?a.concat.apply([],a):a[0];else if(!this.m){d=!1;break}u[f]=1}n=f}}}else d=!1;d&&(h=N(e,b,void 0,this.m));this.cache&&!this.a&&this.j.set(a,h);return h};h.prototype.find=function(a,b){return this.where(a,b,1)[0]||
null};h.prototype.where=function(a,b,c,d){const e=d||this.g,f=[];let g=0;var h;let t;if("number"===typeof a)return[e[a]];if(B(a)){if(w(b))return[e[a]];if("id"===a)return[e[b]];var m=1;var l=[a.split(":")];t=!0}else{if(E(a)){b=d||Object.keys(e);c=b.length;for(h=0;h<c;h++)m=d?d[h]:e[b[h]],a(m)&&(f[g++]=m);return f}c||(c=b);h=Object.keys(a);m=h.length;t=!1;if(1===m&&"id"===h[0])return[e[a.id]];if((l=this.D)&&!d)for(var r=0;r<l.length;r++){var q=l[r],n=a[q];if(!w(n)){d=this.A[q]["@"+n];if(0===--m)return d;
h.splice(h.indexOf(q),1);delete a[q];break}}l=Array(m);for(r=0;r<m;r++)l[r]=h[r].split(":")}r=d||Object.keys(e);q=r.length;for(n=0;n<q;n++){const k=d?d[n]:e[r[n]];let p=!0;for(let c=0;c<m;c++){t||(b=a[h[c]]);const d=l[c],e=d.length;let f=k;if(1<e)for(let a=0;a<e;a++)f=f[d[a]];else f=f[d[0]];if(f!==b){p=!1;break}}if(p&&(f[g++]=k,c&&g===c))break}return f};h.prototype.info=function(){let a;let b=0,c=0,d=0;for(var e=0;e<this.b-(this.threshold||0);e++){a=Object.keys(this.h[e]);for(let g=0;g<a.length;g++){var f=
this.h[e][a[g]].length;b+=1*f+2*a[g].length+4;c+=f;d+=2*a[g].length}}a=Object.keys(this.c);f=a.length;for(e=0;e<f;e++)b+=2*a[e].length+2;return{id:this.id,memory:b,items:f,sequences:c,chars:d,cache:this.cache&&this.cache.l?this.cache.l.length:!1,matcher:J.length+(this.o?this.o.length:0),worker:this.F,threshold:this.threshold,depth:this.depth,contextual:this.depth&&"strict"===this.f}};h.prototype.clear=function(){return this.destroy().init()};h.prototype.destroy=function(){this.cache&&(this.j.clear(),
this.j=null);this.h=this.i=this.c=null;if(this.a){const a=this.a.keys;for(let b=0;b<a.length;b++)this.a.index[a[b]].destroy();this.a=this.g=null}return this};h.prototype.export=function(){if(this.a){const a=this.a.keys,b=Array(a.length+1);let c=0;for(;c<a.length;c++){const d=this.a.index[a[c]];b[c]=[d.h,d.i,d.c]}b[c]=this.g;return JSON.stringify(b)}return JSON.stringify([this.h,this.i,this.c])};h.prototype.import=function(a){a=JSON.parse(a);if(this.a){const b=this.a.keys,c=b.length;for(let d=0;d<
c;d++){const e=this.a.index[b[d]];e.h=a[d][0];e.i=a[d][1];e.c=a[d][2];e.g=a[c]}this.g=a[c]}else this.h=a[0],this.i=a[1],this.c=a[2]};const G={icase:function(a){return a.toLowerCase()},simple:function(){const a=[g("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",g("[\u00e8\u00e9\u00ea\u00eb]"),"e",g("[\u00ec\u00ed\u00ee\u00ef]"),"i",g("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",g("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",g("[\u00fd\u0177\u00ff]"),"y",g("\u00f1"),"n",g("\u00e7"),"c",g("\u00df"),"s",g(" & "),
" and ",g("[-/]")," ",g("[^a-z0-9 ]"),"",g("\\s+")," "];return function(b){b=F(b.toLowerCase(),a);return" "===b?"":b}}(),advanced:function(){const a=[g("ae"),"a",g("ai"),"ei",g("ay"),"ei",g("ey"),"ei",g("oe"),"o",g("ue"),"u",g("ie"),"i",g("sz"),"s",g("zs"),"s",g("sh"),"s",g("ck"),"k",g("cc"),"k",g("dt"),"t",g("ph"),"f",g("pf"),"f",g("ou"),"o",g("uo"),"u"];return function(b,c){if(!b)return b;b=this.simple(b);2<b.length&&(b=F(b,a));c||1<b.length&&(b=M(b));return b}}(),extra:function(){const a=[g("p"),
"b",g("z"),"s",g("[cgq]"),"k",g("n"),"m",g("d"),"t",g("[vw]"),"f",g("[aeiouy]"),""];return function(b){if(!b)return b;b=this.advanced(b,!0);if(1<b.length){b=b.split(" ");for(let c=0;c<b.length;c++){const d=b[c];1<d.length&&(b[c]=d[0]+F(d.substring(1),a))}b=b.join(" ");b=M(b)}return b}}(),balance:function(){const a=[g("[-/]")," ",g("[^a-z0-9 ]"),"",g("\\s+")," "];return function(b){return M(F(b.toLowerCase(),a))}}()},X=function(){function a(a){this.clear();this.B=!0!==a&&a}a.prototype.clear=function(){this.cache=
t();this.count=t();this.index=t();this.l=[]};a.prototype.set=function(a,c){if(this.B&&w(this.cache[a])){let b=this.l.length;if(b===this.B){b--;const a=this.l[b];delete this.cache[a];delete this.count[a];delete this.index[a]}this.index[a]=b;this.l[b]=a;this.count[a]=-1;this.cache[a]=c;this.get(a)}else this.cache[a]=c};a.prototype.get=function(a){const b=this.cache[a];if(this.B&&b){var d=++this.count[a];const b=this.index;let c=b[a];if(0<c){const f=this.l;for(var e=c;this.count[f[--c]]<=d&&-1!==c;);
c++;if(c!==e){for(d=e;d>c;d--)e=f[d-1],f[d]=e,b[e]=d;f[c]=a;b[a]=c}}}return b};return a}();return h}(!1),this);
'use strict';(function(k,D,E){let z;(z=E.define)&&z.amd?z([],function(){return D}):(z=E.modules)?z[k.toLowerCase()]=D:"object"===typeof exports?module.exports=D:E[k]=D})("FlexSearch",function(){function k(a,b){const c=b?b.id:a&&a.id;this.id=c||0===c?c:V++;this.init(a,b);z(this,"index",function(){return this.c});z(this,"length",function(){return Object.keys(this.c).length})}function D(a,b){const c=a.length,d=F(b),e=[];for(let f=0,h=0;f<c;f++){const c=a[f];if(d&&b(c)||!d&&!b[c])e[h++]=c}return e}function E(a,
b,c,d,e,f,h){const n=this.g;b=c=O(c,b,f?0:e,h,this.m);c=b.length;h=Array(c);for(let a=0;a<c;a++)h[a]=n[b[a]];c=h;f&&(c=this.where(f,null,e,c));d&&(F(d)||(y=d.split(":"),1<y.length?d=W:(y=y[0],d=X)),c.sort(d));this.cache&&this.j.set(a,c);return c}function z(a,b,c){Object.defineProperty(a,b,{get:c})}function g(a){return new RegExp(a,"g")}function G(a,b){for(let c=0;c<b.length;c+=2)a=a.replace(b[c],b[c+1]);return a}function J(a,b,c,d,e,f,h,n){if(b[c])return b[c];e=e?(n-(h||n/1.5))*f+(h||n/1.5)*e:f;b[c]=
e;e>=h&&(a=a[n-(e+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=d);return e}function M(a,b){if(a){const c=Object.keys(a);for(let d=0,e=c.length;d<e;d++){const e=c[d],h=a[e];if(h)for(let c=0,d=h.length;c<d;c++)if(h[c]===b){1===d?delete a[e]:h.splice(c,1);break}else B(h[c])&&M(h[c],b)}}}function N(a){let b="",c="";var d="";for(let e=0;e<a.length;e++){const f=a[e];if(f!==c)if(e&&"h"===f){if(d="a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&d||" "===
c)b+=f}else b+=f;d=e===a.length-1?"":a[e+1];c=f}return b}function Y(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function X(a,b){a=a[y];b=b[y];return a<b?-1:a>b?1:0}function W(a,b){const c=y.length;for(let d=0;d<c;d++)a=a[y[d]],b=b[y[d]];return a<b?-1:a>b?1:0}function O(a,b,c,d,e){d=[];let f;const h=a.length;if(1<h){b="or"===b;const A=r();let g,m=-1,l,q=0,t,H,k=!0,u=0;for(;++m<h;){const p=m===h-1;g=a[m];l=g.length;if(!l){if(!b&&!e)return d;if(p&&!u)return t||d;continue}if(k){if(p)return g;for(;q<
l;)A["@"+g[q++]]=1;t=g;k=!1;continue}let P=!1;f=[];for(q=0;q<l;){H=g[q++];var n="@"+H;if(A[n]){const a=A[n];if(b||a===m){if(p){if(d[u++]=H,c&&u===c)return d}else A[n]=m+1;P=!0}else e&&(n=f[a]||(f[a]=[]),n[n.length]=H)}}if(!P&&!e)break}if(e&&(u=d.length,(m=f.length)&&(!c||u<c)))for(;m--;)if(H=f[m])for(q=0,l=H.length;q<l;q++)if(d[u++]=H[q],c&&u===c)return d}else h&&(d=a[0],c&&d.length>c&&(d=d.slice(0,c)));return d}function C(a){return"string"===typeof a}function w(a){return a.constructor===Array}function F(a){return"function"===
typeof a}function B(a){return"object"===typeof a}function x(a){return"undefined"===typeof a}function Q(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=r();return b}function r(){return Object.create(null)}const v={encode:"icase",f:"forward",m:!1,cache:!1,async:!1,F:!1,w:!1,a:!1,C:!1,b:9,threshold:0,depth:0},R={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}},L=[];let V=0;const S=/\W+/,T={},U={};k.create=function(a){return new k(a)};k.registerMatcher=function(a){for(const b in a)a.hasOwnProperty(b)&&L.push(g(b),a[b]);return this};k.registerEncoder=function(a,b){I[a]=b.bind(I);return this};k.registerLanguage=function(a,b){T[a]=b.filter;U[a]=b.stemmer;return this};k.encode=function(a,b){return I[a](b)};k.prototype.init=function(a,
b){this.o=[];if(b){var c=b.preset;a=b}else a||(a=v),c=a.preset;b={};C(a)?(b=R[a],a={}):c&&(b=R[c]);this.f=a.tokenize||b.f||this.f||v.f;this.w=a.rtl||this.w||v.w;this.async="undefined"===typeof Promise||x(c=a.async)?this.async||v.async:c;this.threshold=x(c=a.threshold)?b.threshold||this.threshold||v.threshold:c;this.b=x(c=a.resolution)?c=b.b||this.b||v.b:c;c<=this.threshold&&(this.b=this.threshold+1);this.depth=x(c=a.depth)?b.depth||this.depth||v.depth:c;this.C=x(c=a.paging)?this.C||v.C:c;this.m=x(c=
a.suggest)?this.m||v.m:c;this.s=(c=x(c=a.encode)?b.encode||v.encode:c)&&I[c]&&I[c].bind(I)||(F(c)?c:this.s||!1);(c=a.matcher)&&this.addMatcher(c);if(c=a.filter){C(c)&&(c=T[c]);if(w(c)){b=this.s;var d=r();for(var e=0;e<c.length;e++){var f=b?b(c[e]):c[e];d[f]=1}c=d}this.filter=c}if(c=a.stemmer){var h;b=C(c)?U[c]:c;d=this.s;e=[];for(h in b)b.hasOwnProperty(h)&&(f=d?d(h):h,e.push(g(f+"($|\\W)"),d?d(b[h]):b[h]));this.stemmer=h=e}this.a=e=(c=a.doc)?c:this.a||v.a;this.h=Q(this.b-(this.threshold||0));this.i=
r();this.c=r();if(e){this.g=r();a.doc=null;h=e.index={};b=e.keys=[];d=e.field;f=e.tag;w(e.id)||(e.id=e.id.split(":"));if(f){this.A=r();let b=r();if(d)if(C(d))b[d]=a;else if(w(d))for(let c=0;c<d.length;c++)b[d[c]]=a;else B(d)&&(b=d);w(f)||(e.tag=f=[f]);for(d=0;d<f.length;d++)this.A[f[d]]=r();this.D=f;d=b}if(d){let c;w(d)||(B(d)?(c=d,e.field=d=Object.keys(d)):e.field=d=[d]);for(e=0;e<d.length;e++)f=d[e],w(f)||(c&&(a=c[f]),b[e]=f,d[e]=f.split(":")),h[f]=new k(a),h[f].g=this.g}}this.v=!0;this.j=(this.cache=
c=x(c=a.cache)?this.cache||v.cache:c)?new Z(c):!1;return this};k.prototype.encode=function(a){a&&L.length&&(a=G(a,L));a&&this.o.length&&(a=G(a,this.o));a&&this.s&&(a=this.s(a));a&&this.stemmer&&(a=G(a,this.stemmer));return a};k.prototype.addMatcher=function(a){const b=this.o;for(const c in a)a.hasOwnProperty(c)&&b.push(g(c),a[c]);return this};k.prototype.add=function(a,b,c,d,e){if(this.a&&B(a))return this.u("add",a,b);if(b&&C(b)&&(a||0===a)){var f="@"+a;if(this.c[f]&&!d)return this.update(a,b);if(!e){if(this.async&&
"function"!==typeof importScripts){let e=this;f=new Promise(function(c){setTimeout(function(){e.add(a,b,null,d,!0);e=null;c()})});if(c)f.then(c);else return f;return this}if(c)return this.add(a,b,null,d,!0),c(),this}b=this.encode(b);if(!b.length)return this;c=this.f;e=F(c)?c(b):b.split(S);this.filter&&(e=D(e,this.filter));const l=r();l._ctx=r();const q=e.length,t=this.threshold,A=this.depth,k=this.b,u=this.h,K=this.w;for(let b=0;b<q;b++){var h=e[b];if(h){var n=h.length,g=(K?b+1:q-b)/q,p="";switch(c){case "reverse":case "both":for(var m=
n;--m;)p=h[m]+p,J(u,l,p,a,K?1:(n-m)/n,g,t,k-1);p="";case "forward":for(m=0;m<n;m++)p+=h[m],J(u,l,p,a,K?(m+1)/n:1,g,t,k-1);break;case "full":for(m=0;m<n;m++){const b=(K?m+1:n-m)/n;for(let c=n;c>m;c--)p=h.substring(m,c),J(u,l,p,a,b,g,t,k-1)}break;default:if(n=J(u,l,h,a,1,g,t,k-1),A&&1<q&&n>=t)for(n=l._ctx[h]||(l._ctx[h]=r()),h=this.i[h]||(this.i[h]=Q(k-(t||0))),g=b-A,p=b+A+1,0>g&&(g=0),p>q&&(p=q);g<p;g++)g!==b&&J(h,n,e[g],a,0,k-(g<b?b-g:g-b),t,k-1)}}}this.c[f]=1;this.v=!1}return this};k.prototype.u=
function(a,b,c){if(w(b))for(let d=0,e=b.length;d<e;d++){if(d===e-1)return this.u(a,b[d],c);this.u(a,b[d])}else{const n=this.a.index,k=this.a.keys;var d=this.a.tag,e=this.a.id;let m;let l;for(var f=0;f<e.length;f++)m=(m||b)[e[f]];if(d){for(e=0;e<d.length;e++){var h=d[e];var g=h.split(":");for(f=0;f<g.length;f++)l=(l||b)[g[f]];l="@"+l}g=this.A[h];g=g[l]||(g[l]=[])}if("remove"===a){delete this.g[m];for(let a=0,b=k.length;a<b;a++){if(a===b-1)return n[k[a]].remove(m,c);n[k[a]].remove(m)}}e=this.a.field;
g&&(g[g.length]=b);for(let f=0,g=e.length;f<g;f++){d=e[f];let l;for(h=0;h<d.length;h++)l=(l||b)[d[h]];this.g[m]=b;d=n[k[f]];h="add"===a?d.add:d.update;if(f===g-1)return h.call(d,m,l,c);h.call(d,m,l)}}};k.prototype.update=function(a,b,c){if(this.a&&B(a))return this.u("update",a,b);this.c["@"+a]&&C(b)&&(this.remove(a),this.add(a,b,c,!0));return this};k.prototype.remove=function(a,b,c){if(this.a&&B(a))return this.u("remove",a,b);var d="@"+a;if(this.c[d]){if(!c){if(this.async&&"function"!==typeof importScripts){let c=
this;d=new Promise(function(b){setTimeout(function(){c.remove(a,null,!0);c=null;b()})});if(b)d.then(b);else return d;return this}if(b)return this.remove(a,null,!0),b(),this}for(b=0;b<this.b-(this.threshold||0);b++)M(this.h[b],a);this.depth&&M(this.i,a);delete this.c[d];this.v=!1}return this};let y;k.prototype.search=function(a,b,c,d){if(B(b)){if(w(b))for(var e=0;e<b.length;e++)b[e].query=a;else b.query=a;a=b;b=0}let f=a;let h=[];if(B(a)&&!w(a)){(c=a.callback||b)&&(f.callback=null);b=a.limit;var g=
a.threshold;a=a.query}if(this.a){let d=f.where,e=f.bool,n=f.sort;g=this.a.index;var k=f.field;if(k)f.field=null,w(k)||(k=[k]);else if(w(f)){var p=f;k=[];for(var m=0;m<f.length;m++){var l=f[m];k[m]=l.field;e=l.bool;n=l.sort;d=l.where}}else k=this.a.keys;m=k.length;for(l=0;l<m;l++)p&&(f=p[l]),h[l]=g[k[l]].search(f);if(c)return c(E.call(this,a,e,h,n,b,d,void 0));if(this.async){const c=this;return new Promise(function(f){Promise.all(h).then(function(g){f(E.call(c,a,e,g,n,b,d,void 0))})})}return E.call(this,
a,e,h,n,b,d,void 0)}g||(g=this.threshold||0);F(b)?(c=b,b=1E3):b||0===b||(b=1E3);if(!d){if(this.async&&"function"!==typeof importScripts){let a=this;g=new Promise(function(c){setTimeout(function(){c(a.search(f,b,null,!0));a=null})});if(c)g.then(c);else return g;return this}if(c)return c(this.search(f,b,null,!0)),this}if(!a||!C(a))return h;f=a;if(this.cache)if(this.v){if(c=this.j.get(a))return c}else this.j.clear(),this.v=!0;f=this.encode(f);if(!f.length)return h;c=this.f;c=F(c)?c(f):f.split(S);this.filter&&
(c=D(c,this.filter));p=c.length;d=!0;e=[];const q=r();1<p&&(this.depth?(k=!0,l=c[0],q[l]=1):c.sort(Y));if(!k||(m=this.i)[l]){let a=this.b;for(let b=k?1:0;b<p;b++){const f=c[b];if(f){if(!q[f]){const b=[];let c=!1,h=0;if(l=k?m[l]:this.h){let d;for(let e=0;e<a-g;e++)if(d=l[e][f])b[h++]=d,c=!0}if(c)e[e.length]=1<h?b.concat.apply([],b):b[0];else if(!this.m){d=!1;break}q[f]=1}l=f}}}else d=!1;this.a||(d&&(h=O(e,!1,b,void 0,this.m)),this.cache&&this.j.set(a,h));return h};k.prototype.find=function(a,b){return this.where(a,
b,1)[0]||null};k.prototype.where=function(a,b,c,d){const e=d||this.g,f=[];let g=0;var k;let r;if("number"===typeof a)return[e[a]];if(C(a)){if(x(b))return[e[a]];if("id"===a)return[e[b]];var p=1;var m=[a.split(":")];r=!0}else{if(F(a)){b=d||Object.keys(e);c=b.length;for(k=0;k<c;k++)p=d?d[k]:e[b[k]],a(p)&&(f[g++]=p);return f}c||(c=b);k=Object.keys(a);p=k.length;r=!1;if(1===p&&"id"===k[0])return[e[a.id]];if((m=this.D)&&!d)for(var l=0;l<m.length;l++){var q=m[l],t=a[q];if(!x(t)){d=this.A[q]["@"+t];if(0===
--p)return d;k.splice(k.indexOf(q),1);delete a[q];break}}m=Array(p);for(l=0;l<p;l++)m[l]=k[l].split(":")}l=d||Object.keys(e);q=l.length;for(t=0;t<q;t++){const h=d?d[t]:e[l[t]];let n=!0;for(let c=0;c<p;c++){r||(b=a[k[c]]);const d=m[c],e=d.length;let f=h;if(1<e)for(let a=0;a<e;a++)f=f[d[a]];else f=f[d[0]];if(f!==b){n=!1;break}}if(n&&(f[g++]=h,c&&g===c))break}return f};k.prototype.info=function(){let a;let b=0,c=0,d=0;for(var e=0;e<this.b-(this.threshold||0);e++){a=Object.keys(this.h[e]);for(let g=0;g<
a.length;g++){var f=this.h[e][a[g]].length;b+=1*f+2*a[g].length+4;c+=f;d+=2*a[g].length}}a=Object.keys(this.c);f=a.length;for(e=0;e<f;e++)b+=2*a[e].length+2;return{id:this.id,memory:b,items:f,sequences:c,chars:d,cache:this.cache&&this.cache.l?this.cache.l.length:!1,matcher:L.length+(this.o?this.o.length:0),worker:this.F,threshold:this.threshold,depth:this.depth,contextual:this.depth&&"strict"===this.f}};k.prototype.clear=function(){return this.destroy().init()};k.prototype.destroy=function(){this.cache&&
(this.j.clear(),this.j=null);this.h=this.i=this.c=null;if(this.a){const a=this.a.keys;for(let b=0;b<a.length;b++)this.a.index[a[b]].destroy();this.a=this.g=null}return this};k.prototype.export=function(){if(this.a){const a=this.a.keys,b=Array(a.length+1);let c=0;for(;c<a.length;c++){const d=this.a.index[a[c]];b[c]=[d.h,d.i,d.c]}b[c]=this.g;return JSON.stringify(b)}return JSON.stringify([this.h,this.i,this.c])};k.prototype.import=function(a){a=JSON.parse(a);if(this.a){const b=this.a.keys,c=b.length;
for(let d=0;d<c;d++){const e=this.a.index[b[d]];e.h=a[d][0];e.i=a[d][1];e.c=a[d][2];e.g=a[c]}this.g=a[c]}else this.h=a[0],this.i=a[1],this.c=a[2]};const I={icase:function(a){return a.toLowerCase()},simple:function(){const a=[g("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",g("[\u00e8\u00e9\u00ea\u00eb]"),"e",g("[\u00ec\u00ed\u00ee\u00ef]"),"i",g("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",g("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",g("[\u00fd\u0177\u00ff]"),"y",g("\u00f1"),"n",g("\u00e7"),"c",g("\u00df"),
"s",g(" & ")," and ",g("[-/]")," ",g("[^a-z0-9 ]"),"",g("\\s+")," "];return function(b){b=G(b.toLowerCase(),a);return" "===b?"":b}}(),advanced:function(){const a=[g("ae"),"a",g("ai"),"ei",g("ay"),"ei",g("ey"),"ei",g("oe"),"o",g("ue"),"u",g("ie"),"i",g("sz"),"s",g("zs"),"s",g("sh"),"s",g("ck"),"k",g("cc"),"k",g("dt"),"t",g("ph"),"f",g("pf"),"f",g("ou"),"o",g("uo"),"u"];return function(b,c){if(!b)return b;b=this.simple(b);2<b.length&&(b=G(b,a));c||1<b.length&&(b=N(b));return b}}(),extra:function(){const a=
[g("p"),"b",g("z"),"s",g("[cgq]"),"k",g("n"),"m",g("d"),"t",g("[vw]"),"f",g("[aeiouy]"),""];return function(b){if(!b)return b;b=this.advanced(b,!0);if(1<b.length){b=b.split(" ");for(let c=0;c<b.length;c++){const d=b[c];1<d.length&&(b[c]=d[0]+G(d.substring(1),a))}b=b.join(" ");b=N(b)}return b}}(),balance:function(){const a=[g("[-/]")," ",g("[^a-z0-9 ]"),"",g("\\s+")," "];return function(b){return N(G(b.toLowerCase(),a))}}()},Z=function(){function a(a){this.clear();this.B=!0!==a&&a}a.prototype.clear=
function(){this.cache=r();this.count=r();this.index=r();this.l=[]};a.prototype.set=function(a,c){if(this.B&&x(this.cache[a])){let b=this.l.length;if(b===this.B){b--;const a=this.l[b];delete this.cache[a];delete this.count[a];delete this.index[a]}this.index[a]=b;this.l[b]=a;this.count[a]=-1;this.cache[a]=c;this.get(a)}else this.cache[a]=c};a.prototype.get=function(a){const b=this.cache[a];if(this.B&&b){var d=++this.count[a];const b=this.index;let c=b[a];if(0<c){const f=this.l;for(var e=c;this.count[f[--c]]<=
d&&-1!==c;);c++;if(c!==e){for(d=e;d>c;d--)e=f[d-1],f[d]=e,b[e]=d;f[c]=a;b[a]=c}}}return b};return a}();return k}(!1),this);

View File

@@ -1,5 +1,5 @@
/**!
* @preserve FlexSearch v0.5.2
* @preserve FlexSearch v0.5.3
* Copyright 2019 Nextapps GmbH
* Author: Thomas Wilkerling
* Released under the Apache 2.0 Licence
@@ -1381,12 +1381,12 @@
return result;
}
function merge_and_sort(query, result, sort, limit, where, cursor){
function merge_and_sort(query, bool, result, sort, limit, where, cursor){
const doc = this._doc;
const suggest = SUPPORT_SUGGESTIONS && this.suggest;
result = intersect(result, where ? 0 : limit, cursor, suggest);
result = intersect(result, bool, where ? 0 : limit, cursor, suggest);
result = enrich_documents(result, doc);
if(where){
@@ -1455,9 +1455,6 @@
let _query = query;
let threshold;
//let boost;
let where;
let sort;
let cursor;
let result = [];
@@ -1475,17 +1472,6 @@
}
}
if(SUPPORT_DOCUMENTS){
//boost = query["boost"];
sort = query["sort"];
if(SUPPORT_WHERE){
where = query["where"];
}
}
//cursor = this.paging && query["cursor"];
limit = query["limit"];
threshold = query["threshold"];
@@ -1494,6 +1480,10 @@
if(SUPPORT_DOCUMENTS && this.doc){
//let boost = query["boost"];
let where = SUPPORT_WHERE && _query["where"];
let bool = _query["bool"];
let sort = _query["sort"];
const doc_idx = this.doc["index"];
let queries;
@@ -1515,7 +1505,14 @@
for(let i = 0; i < _query.length; i++){
field[i] = _query[i]["field"];
const current = _query[i];
field[i] = current["field"];
// TODO: improve array notation (redundancy)
bool = current["bool"];
sort = current["sort"];
where = SUPPORT_WHERE && current["where"];
}
}
else{
@@ -1523,10 +1520,10 @@
field = this.doc["keys"];
}
if(sort){
_query["sort"] = null;
}
// if(sort){
//
// _query["sort"] = null;
// }
const len = field.length;
@@ -1542,7 +1539,7 @@
if(callback){
return callback(merge_and_sort.call(this, query, result, sort, limit, where, cursor));
return callback(merge_and_sort.call(this, query, bool, result, sort, limit, where, cursor));
}
else if(SUPPORT_ASYNC && this.async){
@@ -1552,13 +1549,13 @@
Promise.all(/** @type {!Iterable<Promise>} */ (result)).then(function(values){
resolve(merge_and_sort.call(self, query, values, sort, limit, where, cursor));
resolve(merge_and_sort.call(self, query, bool, values, sort, limit, where, cursor));
});
});
}
else{
return merge_and_sort.call(this, query, result, sort, limit, where, cursor);
return merge_and_sort.call(this, query, bool, result, sort, limit, where, cursor);
}
}
@@ -1588,7 +1585,7 @@
"limit": limit,
"cursor": cursor,
"threshold": threshold,
"where": where,
//"where": where,
"content": query
});
}
@@ -1833,11 +1830,13 @@
found = false;
}
if(!SUPPORT_DOCUMENTS || !this.doc){
if(found){
// Not handled by intersection:
result = intersect(check, limit, cursor, /*SUPPORT_DOCUMENTS && this._doc,*/ SUPPORT_SUGGESTIONS && this.suggest);
result = intersect(check, false, limit, cursor, /*SUPPORT_DOCUMENTS && this._doc,*/ SUPPORT_SUGGESTIONS && this.suggest);
// Handled by intersection:
@@ -1846,10 +1845,11 @@
// store result to cache
if(SUPPORT_CACHE && this.cache && (!SUPPORT_DOCUMENTS || !this.doc)){
if(SUPPORT_CACHE && this.cache){
this._cache.set(query, result);
}
}
if(PROFILER){
@@ -3047,13 +3047,14 @@
/**
* @param {!Array<Array<number|string>>} arrays
* @param {string|boolean=} bool
* @param {number=} limit
* @param {number=} cursor
* @param {boolean=} suggest
* @returns {Array}
*/
function intersect(arrays, limit, cursor, /*docs,*/ suggest) {
function intersect(arrays, bool, limit, cursor, /*docs,*/ suggest) {
let result = [];
let suggestions;
@@ -3061,36 +3062,73 @@
if(length_z > 1){
bool = (bool === "or");
// const bool_or = (bool === "or");
// const bool_and = (bool === "and") || !bool;
// const bool_not = (bool === "not");
// pre-sort arrays
//TODO: test strategy
//arrays.sort(sort_by_length_down);
const check = create_object();
let arr /*= arrays[0]*/;
let z = -1; // start from 0
let length /*= arr.length*/;
// fill initial map
const check = create_object();
let arr = arrays[0];
let length = arr.length;
let i = 0;
let first_result;
// loop through arrays
let tmp, init = true, count = 0;
while(++z < length_z){
const is_final_loop = (z === (length_z - 1));
arr = arrays[z];
length = arr.length;
if(!length){
if(!bool && !suggest){
return result;
}
if(is_final_loop && !count){
return first_result || result;
}
continue;
}
if(init){
if(is_final_loop){
return arr;
}
while(i < length) {
check["@" + arr[i++]] = 1;
}
// loop through arrays
first_result = arr;
init = false;
let tmp, count = 0;
let z = 0; // start from 1
while(++z < length_z){
continue;
}
let found = false;
const is_final_loop = (z === (length_z - 1));
suggestions = [];
arr = arrays[z];
length = arr.length;
i = 0;
while(i < length){
@@ -3103,7 +3141,7 @@
const check_val = check[index];
if(check_val === z){
if(bool || (check_val === z) /*|| (bool_not && !check_val)*/){
// fill in during last round
@@ -3681,8 +3719,6 @@
)), this);
/* istanbul ignore next */
/** --------------------------------------------------------------------------------------
* UMD Wrapper for Browser and Node.js
* @param {!string} name
@@ -3694,6 +3730,8 @@
function provide(name, factory, root){
/* istanbul ignore next */
let prop;
// AMD (RequireJS)

View File

@@ -1,6 +1,6 @@
{
"name": "flexsearch",
"version": "0.5.2",
"version": "0.5.3",
"description": "Next-Generation full text search library with zero dependencies.",
"homepage": "https://github.com/nextapps-de/flexsearch/",
"author": "Thomas Wilkerling",

View File

@@ -80,25 +80,25 @@ describe("Index Multi-Field Documents (ES6)", function(){
expect(await index.search({field: "data:body", query: "title"})).to.have.lengthOf(0);
expect(await index.search({field: "data:title", query: "body"})).to.have.lengthOf(0);
//TODO: provide logical operator "OR"
// expect(await index.search({field: ["data:title", "data:body"], query: "body"})).to.have.members(data);
// expect(await index.search({field: ["data:body", "data:title"], query: "title"})).to.have.members(data);
expect(await index.search({field: ["data:title", "data:body"], query: "body", bool: "or"})).to.have.members(data);
expect(await index.search({field: ["data:body", "data:title"], query: "title", bool: "or"})).to.have.members(data);
expect(await index.search({field: ["data:body"], query: "body"})).to.have.members(data);
expect(await index.search({field: "data:title", query: "title"})).to.have.members(data);
//TODO: provide logical operator "OR"
// expect(await index.search({query: "body"})).to.have.members(data);
// expect(await index.search("title")).to.have.members(data);
expect(await index.search({query: "body", bool: "or"})).to.have.members(data);
expect(await index.search("title", {bool: "or"})).to.have.members(data);
expect(await index.search({field: ["data:body"], query: "body"})).to.have.members(data);
expect(await index.search({field: "data:title", query: "title"})).to.have.members(data);
await index.update(update);
//TODO: provide logical operator "OR"
// expect(await index.search("foo")).not.to.have.members(data);
// expect(await index.search("bar")).not.to.have.members(data);
// expect(await index.search("foo")).to.have.members(update);
// expect(await index.search("bar")).to.have.members(update);
expect(await index.search("foo", {bool: "or"})).not.to.have.members(data);
expect(await index.search("bar", {bool: "or"})).not.to.have.members(data);
expect(await index.search("foo", {bool: "or"})).to.have.members(update);
expect(await index.search("bar", {bool: "or"})).to.have.members(update);
expect(await index.search("foo", {field: "data:title"})).not.to.have.members(data);
expect(await index.search("bar", {field: "data:body"})).not.to.have.members(data);
expect(await index.search("foo", {field: "data:title"})).to.have.members(update);
@@ -137,25 +137,25 @@ describe("Index Multi-Field Documents (ES6)", function(){
expect(await index.search({field: "data:body", query: "title"})).to.have.lengthOf(0);
expect(await index.search({field: "data:title", query: "body"})).to.have.lengthOf(0);
//TODO: provide logical operator "OR"
// expect(await index.search({field: ["data:title", "data:body"], query: "body"})).to.have.members(data);
// expect(await index.search({field: ["data:body", "data:title"], query: "title"})).to.have.members(data);
expect(await index.search({field: ["data:title", "data:body"], query: "body", bool: "or"})).to.have.members(data);
expect(await index.search({field: ["data:body", "data:title"], query: "title", bool: "or"})).to.have.members(data);
expect(await index.search({field: ["data:body"], query: "body"})).to.have.members(data);
expect(await index.search({field: "data:title", query: "title"})).to.have.members(data);
//TODO: provide logical operator "OR"
// expect(await index.search({query: "body"})).to.have.members(data);
// expect(await index.search("title")).to.have.members(data);
expect(await index.search({query: "body", bool: "or"})).to.have.members(data);
expect(await index.search("title", {bool: "or"})).to.have.members(data);
expect(await index.search({query: "body", field: "data:body"})).to.have.members(data);
expect(await index.search("title", {field: "data:title"})).to.have.members(data);
await index.update(update);
//TODO: provide logical operator "OR"
// expect(await index.search("foo")).not.to.have.members(data);
// expect(await index.search("bar")).not.to.have.members(data);
// expect(await index.search("foo")).to.have.members(update);
// expect(await index.search("bar")).to.have.members(update);
expect(await index.search("foo", {bool: "or"})).not.to.have.members(data);
expect(await index.search("bar", {bool: "or"})).not.to.have.members(data);
expect(await index.search("foo", {bool: "or"})).to.have.members(update);
expect(await index.search("bar", {bool: "or"})).to.have.members(update);
expect(await index.search("foo", {field: "data:title"})).not.to.have.members(data);
expect(await index.search("bar", {field: "data:body"})).not.to.have.members(data);
expect(await index.search("foo", {field: "data:title"})).to.have.members(update);

View File

@@ -132,9 +132,12 @@ describe("Initialize", function(){
cache: true
});
it("Should have correct constructors", function(){
expect(flexsearch_default).to.be.an.instanceOf(FlexSearch);
expect(flexsearch_sync).to.be.an.instanceOf(FlexSearch);
expect(flexsearch_async).to.be.an.instanceOf(FlexSearch);
});
it("Should have correct uuids", function(){
@@ -156,6 +159,16 @@ describe("Initialize", function(){
expect(flexsearch_default).to.respondTo("remove");
expect(flexsearch_default).to.respondTo("clear");
expect(flexsearch_default).to.respondTo("init");
expect(flexsearch_default).to.respondTo("destroy");
expect(flexsearch_default).to.hasOwnProperty("length");
expect(flexsearch_default).to.hasOwnProperty("index");
if(env !== "light"){
expect(flexsearch_default).to.respondTo("where");
expect(flexsearch_default).to.respondTo("find");
}
if(env !== "light" && env !== "min"){
@@ -1327,18 +1340,22 @@ if(env !== "light") describe("Index Multi-Field Documents", function(){
expect(index.search({field: "data:body", query: "title"})).to.have.lengthOf(0);
expect(index.search({field: "data:title", query: "body"})).to.have.lengthOf(0);
//TODO: provide logical operator "OR"
//expect(index.search({field: ["data:title", "data:body"], query: "body"})).to.have.members(data);
//expect(index.search({field: ["data:body", "data:title"], query: "title"})).to.have.members(data);
expect(index.search({field: "data:body", query: "body"})).to.have.members(data);
expect(index.search({field: ["data:title"], query: "title"})).to.have.members(data);
//TODO: provide logical operator "OR"
//expect(index.search({query: "body"})).to.have.members(data);
//expect(index.search("title")).to.have.members(data);
expect(index.search({field: ["data:title", "data:body"], query: "body"})).to.have.lengthOf(0);
expect(index.search({field: ["data:body", "data:title"], query: "title"})).to.have.lengthOf(0);
expect(index.search({field: ["data:title", "data:body"], query: "body", bool: "and"})).to.have.lengthOf(0);
expect(index.search({field: ["data:body", "data:title"], query: "title", bool: "and"})).to.have.lengthOf(0);
expect(index.search({field: ["data:title", "data:body"], query: "body", bool: "or"})).to.have.members(data);
expect(index.search({field: ["data:body", "data:title"], query: "title", bool: "or"})).to.have.members(data);
expect(index.search("body", {field: "data:body"})).to.have.members(data);
expect(index.search("title", {field: ["data:title"]})).to.have.members(data);
expect(index.search({query: "body", bool: "or"})).to.have.members(data);
//expect(index.search("title", {bool: "or"})).to.have.members(data);
expect(index.search({
field: "data:title",
@@ -1347,51 +1364,47 @@ if(env !== "light") describe("Index Multi-Field Documents", function(){
})).to.have.members(data);
//TODO: provide logical operator "OR"
// expect(index.search([{
//
// field: "data:title",
// query: "body",
// boost: 2
// },{
// field: "data:body",
// query: "body",
// boost: 2
//
// }])).to.have.members(data);
expect(index.search([{
field: "data:title",
query: "body",
bool: "or"
},{
field: "data:body",
query: "body",
bool: "or"
}])).to.have.members(data);
expect(index.search("title", {
field: "data:title",
boost: 2
field: "data:title"
})).to.have.members(data);
expect(index.search("title", {
field: "data:body",
boost: 2
field: "data:body"
})).to.have.lengthOf(0);
//TODO: provide logical operator "OR"
// expect(index.search("body", [{
//
// field: "data:title",
// boost: 2
// },{
// field: "data:body",
// boost: 2
//
// }])).to.have.members(data);
expect(index.search("body", [{
field: "data:title",
bool: "or"
},{
field: "data:body",
bool: "or"
}])).to.have.members(data);
index.update(update);
//TODO: provide logical operator "OR"
// expect(index.search("foo")).not.to.have.members(data);
// expect(index.search("bar")).not.to.have.members(data);
// expect(index.search("foo")).to.have.members(update);
// expect(index.search("bar")).to.have.members(update);
expect(index.search("foo", {bool: "or"})).not.to.have.members(data);
expect(index.search("bar", {bool: "or"})).not.to.have.members(data);
expect(index.search("foo", {bool: "or"})).to.have.members(update);
expect(index.search("bar", {bool: "or"})).to.have.members(update);
expect(index.search("foo", {field: "data:title"})).not.to.have.members(data);
expect(index.search("bar", {field: "data:body"})).not.to.have.members(data);
expect(index.search("foo", {field: "data:title"})).to.have.members(update);
@@ -1440,15 +1453,15 @@ if(env !== "light") describe("Index Multi-Field Documents", function(){
expect(index.search({field: "data:body", query: "title"})).to.have.lengthOf(0);
expect(index.search({field: "data:title", query: "body"})).to.have.lengthOf(0);
//TODO: provide logical operator "OR"
//expect(index.search({field: ["data:title", "data:body"], query: "body"})).to.have.members(data);
//expect(index.search({field: ["data:body", "data:title"], query: "tle"})).to.have.members(data);
expect(index.search({field: ["data:body"], query: "body"})).to.have.members(data);
expect(index.search({field: "data:title", query: "tle"})).to.have.members(data);
expect(index.search({field: ["data:title", "data:body"], query: "body", bool: "or"})).to.have.members(data);
expect(index.search({field: ["data:body", "data:title"], query: "tle", bool: "or"})).to.have.members(data);
expect(index.search({field: ["data:body"], query: "body", bool: "or"})).to.have.members(data);
expect(index.search({field: "data:title", query: "tle", bool: "or"})).to.have.members(data);
expect(index.search({query: "body", bool: "or"})).to.have.members(data);
expect(index.search("tle", {bool: "or"})).to.have.members(data);
//TODO: provide logical operator "OR"
//expect(index.search({query: "body"})).to.have.members(data);
//expect(index.search("tle")).to.have.members(data);
expect(index.search({query: "body", field: "data:body"})).to.have.members(data);
expect(index.search("tle", {field: "data:title"})).to.have.members(data);
@@ -1459,16 +1472,17 @@ if(env !== "light") describe("Index Multi-Field Documents", function(){
})).to.have.members(data);
//TODO: provide logical operator "OR"
// expect(index.search([{
//
// field: "data:title",
// query: "body"
// },{
// field: "data:body",
// query: "body"
//
// }])).to.have.members(data);
expect(index.search([{
field: "data:title",
query: "body",
bool: "or"
},{
field: "data:body",
query: "body",
bool: "or"
}])).to.have.members(data);
expect(index.search("tle", {
@@ -1482,22 +1496,23 @@ if(env !== "light") describe("Index Multi-Field Documents", function(){
})).to.have.lengthOf(0);
//TODO: provide logical operator "OR"
// expect(index.search("body", [{
//
// field: "data:title"
// },{
// field: "data:body"
//
// }])).to.have.members(data);
expect(index.search("body", [{
field: "data:title",
bool: "or"
},{
field: "data:body",
bool: "or"
}])).to.have.members(data);
index.update(update);
//TODO: provide logical operator "OR"
// expect(index.search("foo")).not.to.have.members(data);
// expect(index.search("bar")).not.to.have.members(data);
// expect(index.search("foo")).to.have.members(update);
// expect(index.search("bar")).to.have.members(update);
expect(index.search("foo", {bool: "or"})).not.to.have.members(data);
expect(index.search("bar", {bool: "or"})).not.to.have.members(data);
expect(index.search("foo", {bool: "or"})).to.have.members(update);
expect(index.search("bar", {bool: "or"})).to.have.members(update);
expect(index.search("foo", {field: "data:title"})).not.to.have.members(data);
expect(index.search("bar", {field: "data:body"})).not.to.have.members(data);
expect(index.search("foo", {field: "data:title"})).to.have.members(update);
@@ -1803,6 +1818,23 @@ if(env !== "light") describe("Export / Import", function(){
});
});
// ------------------------------------------------------------------------
// Presets
// ------------------------------------------------------------------------
describe("Presets", function(){
it("Should have been properly initialized", function(){
expect(FlexSearch.create("memory").length).to.equal(0);
expect(FlexSearch.create("speed").length).to.equal(0);
expect(FlexSearch.create("match").length).to.equal(0);
expect(FlexSearch.create("score").length).to.equal(0);
expect(FlexSearch.create("balance").length).to.equal(0);
expect(FlexSearch.create("fast").length).to.equal(0);
});
});
// ------------------------------------------------------------------------
// Feature Tests
// ------------------------------------------------------------------------
@@ -1912,6 +1944,28 @@ if(env !== "light" && env !== "min"){
});
}
// ------------------------------------------------------------------------
// Destroy
// ------------------------------------------------------------------------
describe("Destroy", function(){
it("Should have been destroyed properly", function(){
var index = FlexSearch.create()
.add(0, "foo")
.add(1, "bar");
expect(index.search("foo")).to.include(0);
expect(index.search("bar")).to.include(1);
index.destroy();
expect(index.search("foo")).to.have.lengthOf(0);
expect(index.search("bar")).to.have.lengthOf(0);
});
});
// ------------------------------------------------------------------------
// Chaining
// ------------------------------------------------------------------------