mirror of
https://github.com/nextapps-de/flexsearch.git
synced 2025-09-01 18:03:56 +02:00
v0.6.1, Fix: #54
This commit is contained in:
42
README.md
42
README.md
@@ -230,7 +230,7 @@ Comparison: <a href="https://raw.githack.com/nextapps-de/flexsearch/master/test/
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>FlexSearch <a href="#notes">***</a></td>
|
||||
<td>FlexSearch <a href="#notes">*</a></td>
|
||||
<td>0.3.6</td>
|
||||
<td><b>363757</b></td>
|
||||
<td><b>182603</b></td>
|
||||
@@ -310,6 +310,7 @@ Comparison: <a href="https://raw.githack.com/nextapps-de/flexsearch/master/test/
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!--
|
||||
##### Memory Test: "Gulliver's Travels"
|
||||
|
||||
<table>
|
||||
@@ -393,14 +394,18 @@ Comparison: <a href="https://raw.githack.com/nextapps-de/flexsearch/master/test/
|
||||
<td>53.0 kb</td>
|
||||
</tr>
|
||||
</table>
|
||||
-->
|
||||
|
||||
<a name="notes" id="notes"></a>
|
||||
_* The preset "fast" was used for this test_ <br>
|
||||
<!--
|
||||
_* Index Size: The size of memory the index requires_<br>
|
||||
_** Memory Allocation: The amount of memory which was additionally allocated during a row of 10 queries_<br>
|
||||
_*** The preset "fast" was used for this test_ <br>
|
||||
_**** The preset "memory" was used for this test_
|
||||
-->
|
||||
|
||||
Library Comparison: <a href="https://raw.githack.com/nextapps-de/flexsearch/master/test/benchmark.html" target="_blank">Benchmark "Gulliver's Travels"</a>
|
||||
Run Comparison: <a href="https://raw.githack.com/nextapps-de/flexsearch/master/test/benchmark.html" target="_blank">Benchmark "Gulliver's Travels"</a>
|
||||
|
||||
<a name="contextual"></a>
|
||||
## Contextual Search
|
||||
@@ -1762,6 +1767,17 @@ FlexSearch ist highly customizable. Make use of the the <a href="#presets">right
|
||||
</td>
|
||||
</tr>
|
||||
<tr></tr>
|
||||
<tr>
|
||||
<td align="top">split<br><br></td>
|
||||
<td vertical="top" vertical-align="top">
|
||||
RegExp<br>
|
||||
string
|
||||
</td>
|
||||
<td vertical-align="top">
|
||||
The rule to split words when using non-custom tokenizer (<a href="#tokenizer">built-ins</a> e.g. "forward"). Use a string/char or use a regular expression (default: <code>/\W+/</code>).<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr></tr>
|
||||
<tr>
|
||||
<td align="top">encode<br><br><br><br><br><br><br></td>
|
||||
<td>
|
||||
@@ -1775,26 +1791,6 @@ FlexSearch ist highly customizable. Make use of the the <a href="#presets">right
|
||||
</td>
|
||||
<td>The encoding type.<br><br>Choose one of the <a href="#phonetic">built-ins</a> or pass a <a href="#flexsearch.encoder">custom encoding function</a>.</td>
|
||||
</tr>
|
||||
<!--
|
||||
<tr></tr>
|
||||
<tr>
|
||||
<td align="top">boolean<br><br></td>
|
||||
<td>
|
||||
"and"<br>
|
||||
"or"
|
||||
</td>
|
||||
<td>The applied boolean model when comparing multiple words. <b>Note:</b> When using "or" the first word is also compared with "and". Example: a query with 3 words, results has either: matched word 1 & 2 and matched word 1 & 3.</td>
|
||||
</tr>
|
||||
<tr></tr>
|
||||
<tr>
|
||||
<td align="top">multi<br><br></td>
|
||||
<td>
|
||||
true<br>
|
||||
false
|
||||
</td>
|
||||
<td>Enable multi word processing.</td>
|
||||
</tr>
|
||||
-->
|
||||
<tr></tr>
|
||||
<tr>
|
||||
<td align="top">cache<br><br><br></td>
|
||||
@@ -1882,7 +1878,7 @@ FlexSearch ist highly customizable. Make use of the the <a href="#presets">right
|
||||
|
||||
## Depth, Threshold, Resolution?
|
||||
|
||||
Whereas __depth is the minimum relevance for the context-based index__, __threshold is the minimum relevance for the lexical index__. Threshold is an enhanced variation of a conventional scoring calculation, it uses document distance and partial distance instead of TF-IDF. The final scoring value is based on <a href="#contextual">3 kinds of distance</a>.
|
||||
Whereas __depth is the minimum relevance for the context-based index__, __threshold is the minimum relevance for the lexical index__. The threshold score is an enhanced variation of a conventional scoring calculation, it uses on document distance and partial distance instead of TF-IDF. The final scoring value is based on <a href="#contextual">3 kinds of distance</a>.
|
||||
|
||||
Resolution on the other hand specify the max scoring value. The final score value is an integer value, so resolution affect how many segments the score may have. When the resolution is 1, then there exist just one scoring level for all matched terms. To get more differentiated results you need to raise the resolution.
|
||||
|
||||
|
49
dist/flexsearch.compact.js
vendored
49
dist/flexsearch.compact.js
vendored
@@ -1,30 +1,31 @@
|
||||
/*
|
||||
FlexSearch v0.6.0
|
||||
FlexSearch v0.6.1
|
||||
Copyright 2019 Nextapps GmbH
|
||||
Author: Thomas Wilkerling
|
||||
Released under the Apache 2.0 Licence
|
||||
https://github.com/nextapps-de/flexsearch
|
||||
*/
|
||||
'use strict';(function(l,F,G){let A;(A=G.define)&&A.amd?A([],function(){return F}):(A=G.modules)?A[l.toLowerCase()]=F:"object"===typeof exports?module.exports=F:G[l]=F})("FlexSearch",function(){function l(b,a){const c=a?a.id:b&&b.id;this.id=c||0===c?c:Z++;this.init(b,a);A(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].f):Object.keys(this.f)});A(this,"length",function(){return this.index.length})}function F(b,a){const c=b.length,d=H(a),e=[];for(let h=0,g=0;h<c;h++){const c=
|
||||
b[h];if(d&&a(c)||!d&&!a[c])e[g++]=c}return e}function G(b,a,c,d,e,h,g,m,n,f){c=R(c,g?0:e,!1,!1,a,n,f);let k;m&&(m=c.page,k=c.next,c=c.result);if(g)b=this.where(g,null,e,c);else{b=c;a=this.g;c=b.length;e=Array(c);for(h=0;h<c;h++)e[h]=a[b[h]];b=e}c=b;d&&(H(d)||(u=d.split(":"),1<u.length?d=aa:(u=u[0],d=ba)),c.sort(d));return c=I(m,k,c)}function A(b,a,c){Object.defineProperty(b,a,{get:c})}function f(b){return new RegExp(b,"g")}function J(b,a){for(let c=0;c<a.length;c+=2)b=b.replace(a[c],a[c+1]);return b}
|
||||
function M(b,a,c,d,e,h,g,m){if(a[c])return a[c];e=e?(m-(g||m/1.5))*h+(g||m/1.5)*e:h;a[c]=e;e>=g&&(b=b[m-(e+.5>>0)],b=b[c]||(b[c]=[]),b[b.length]=d);return e}function O(b,a){if(b){const c=Object.keys(b);for(let d=0,e=c.length;d<e;d++){const e=c[d],g=b[e];if(g)for(let c=0,d=g.length;c<d;c++)if(g[c]===a){1===d?delete b[e]:g.splice(c,1);break}else K(g[c])&&O(g[c],a)}}}function P(b){let a="",c="";var d="";for(let e=0;e<b.length;e++){const h=b[e];if(h!==c)if(e&&"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=e===b.length-1?"":b[e+1];c=h}return a}function ca(b,a){b=b.length-a.length;return 0>b?1:b?-1:0}function ba(b,a){b=b[u];a=a[u];return b<a?-1:b>a?1:0}function aa(b,a){const c=u.length;for(let d=0;d<c;d++)b=b[u[d]],a=a[u[d]];return b<a?-1:b>a?1:0}function I(b,a,c){return b?{page:b,next:a?""+a:null,result:c}:c}function R(b,a,c,d,e,h,g){let m;h=[];let n;const f=b.length;!0===c?(c="0",n=""):n=c&&
|
||||
c.split(":");if(1<f){const v=x();let q=[],l,y,t=-1;var k;let B;let T=!0,D,C=0,u,z,p;n&&(2===n.length?(p=n,n=!1):n=parseInt(n[0],10));if(g){for(l=x();++t<f;)if("not"===e[t])for(y=b[t],B=y.length,k=0;k<B;)l["@"+y[k++]]=1;else z=t+1;if(!z)return I(c,m,h);t=-1}else u=E(e)&&e;for(;++t<f;){const da=t===(z||f)-1;let p,x;if(!u||!t)if((k=u||e&&e[t])&&"and"!==k)if("or"===k)x=!0;else continue;else p=!0;y=b[t];B=y.length;if(!B){if(p&&!d)return I(c,m,y);continue}if(T)if(D){var w=D.length;for(k=0;k<w;)v["@"+D[k++]]=
|
||||
1;D=null;T=!1}else{D=y;continue}let S=!1;for(k=0;k<B;){w=y[k++];var r="@"+w;const b=x?t:v[r];if(b&&(!g||!l[r]))if(b===t){if(da){if(!n||--n<C)if(h[C++]=w,a&&C===a)return I(c,C,h)}else v[r]=t+1;S=!0}else d&&(r=q[b]||(q[b]=[]),r[r.length]=w)}if(p&&!S&&!d)break}if(D)if(b=D.length,g)for(k=n?parseInt(n,10):0;k<b;){if(e=D[k++],!l["@"+e]&&(!n||--n<C)&&(h[C++]=e,a&&C===a))return I(c,k,h)}else h=D;if(d)for(C=h.length,p?(t=parseInt(p[0],10)+1,k=parseInt(p[1],10)):(t=q.length,k=0);t--;)if(w=q[t])for(B=w.length;k<
|
||||
B;k++)if(d=w[k],!g||!l["@"+d])if(h[C++]=d,a&&C===a)return I(c,t+":"+k,h)}else f&&(e&&"not"===e[0]||(h=b[0]));a&&(g=c?parseInt(c,10):0,m=g+a,m<h.length?h=h.slice(g,m):g&&(h=h.slice(g)));return I(c,m,h)}function E(b){return"string"===typeof b}function z(b){return b.constructor===Array}function H(b){return"function"===typeof b}function K(b){return"object"===typeof b}function N(b){return"undefined"===typeof b}function U(b){const a=Array(b);for(let c=0;c<b;c++)a[c]=x();return a}function x(){return Object.create(null)}
|
||||
const p={encode:"icase",c:"forward",cache:!1,async:!1,u:!1,m:!1,a:!1,b:9,threshold:0,depth:0},V={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}},Q=[];let Z=0;const W=/\W+/,X={},Y={};l.create=function(b){return new l(b)};
|
||||
l.registerMatcher=function(b){for(const a in b)b.hasOwnProperty(a)&&Q.push(f(a),b[a]);return this};l.registerEncoder=function(b,a){L[b]=a.bind(L);return this};l.registerLanguage=function(b,a){X[b]=a.filter;Y[b]=a.stemmer;return this};l.encode=function(b,a){return L[b](a)};l.prototype.init=function(b,a){this.o=[];if(a){var c=a.preset;b=a}else b||(b=p),c=b.preset;a={};E(b)?(a=V[b],b={}):c&&(a=V[c]);this.c=b.tokenize||a.c||this.c||p.c;this.m=b.rtl||this.m||p.m;this.async="undefined"===typeof Promise||
|
||||
N(c=b.async)?this.async||p.async:c;this.threshold=N(c=b.threshold)?a.threshold||this.threshold||p.threshold:c;this.b=N(c=b.resolution)?c=a.b||this.b||p.b:c;c<=this.threshold&&(this.b=this.threshold+1);this.depth="strict"!==this.c||N(c=b.depth)?a.depth||this.depth||p.depth:c;this.i=(c=N(c=b.encode)?a.encode||p.encode:c)&&L[c]&&L[c].bind(L)||(H(c)?c:this.i||!1);(c=b.matcher)&&this.addMatcher(c);if(c=b.filter){E(c)&&(c=X[c]);if(z(c)){a=this.i;var d=x();for(var e=0;e<c.length;e++){var h=a?a(c[e]):c[e];
|
||||
d[h]=1}c=d}this.filter=c}if(c=b.stemmer){var g;a=E(c)?Y[c]:c;d=this.i;e=[];for(g in a)a.hasOwnProperty(g)&&(h=d?d(g):g,e.push(f(h+"($|\\W)"),d?d(a[g]):a[g]));this.stemmer=g=e}this.a=d=(c=b.doc)?c:this.a||p.a;this.l=U(this.b-(this.threshold||0));this.h=x();this.f=x();if(d&&(this.g=x(),b.doc=null,g=d.index={},c=d.keys=[],a=d.field,z(d.id)||(d.id=d.id.split(":")),a)){let h;z(a)||(K(a)?(h=a,d.field=a=Object.keys(a)):d.field=a=[a]);for(d=0;d<a.length;d++)e=a[d],z(e)||(h&&(b=h[e]),c[d]=e,a[d]=e.split(":")),
|
||||
g[e]=new l(b),g[e].g=this.g}return this};l.prototype.encode=function(b){b&&Q.length&&(b=J(b,Q));b&&this.o.length&&(b=J(b,this.o));b&&this.i&&(b=this.i(b));b&&this.stemmer&&(b=J(b,this.stemmer));return b};l.prototype.addMatcher=function(b){const a=this.o;for(const c in b)b.hasOwnProperty(c)&&a.push(f(c),b[c]);return this};l.prototype.add=function(b,a,c,d,e){if(this.a&&K(b))return this.j("add",b,a);if(a&&E(a)&&(b||0===b)){var h="@"+b;if(this.f[h]&&!d)return this.update(b,a);if(!e){if(this.async&&"function"!==
|
||||
typeof importScripts){let e=this;h=new Promise(function(c){setTimeout(function(){e.add(b,a,null,d,!0);e=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;e=H(c)?c(a):a.split(W);this.filter&&(e=F(e,this.filter));const m=x();m._ctx=x();const r=e.length,l=this.threshold,q=this.depth,p=this.b,y=this.l,t=this.m;for(let a=0;a<r;a++){var g=e[a];if(g){var f=g.length,n=(t?a+1:r-a)/r,v="";switch(c){case "reverse":case "both":for(var k=
|
||||
f;--k;)v=g[k]+v,M(y,m,v,b,t?1:(f-k)/f,n,l,p-1);v="";case "forward":for(k=0;k<f;k++)v+=g[k],M(y,m,v,b,t?(k+1)/f:1,n,l,p-1);break;case "full":for(k=0;k<f;k++){const a=(t?k+1:f-k)/f;for(let c=f;c>k;c--)v=g.substring(k,c),M(y,m,v,b,a,n,l,p-1)}break;default:if(f=M(y,m,g,b,1,n,l,p-1),q&&1<r&&f>=l)for(f=m._ctx[g]||(m._ctx[g]=x()),g=this.h[g]||(this.h[g]=U(p-(l||0))),n=a-q,v=a+q+1,0>n&&(n=0),v>r&&(v=r);n<v;n++)n!==a&&M(g,f,e[n],b,0,p-(n<a?a-n:n-a),l,p-1)}}}this.f[h]=1}return this};l.prototype.j=function(b,
|
||||
a,c){if(z(a))for(let d=0,e=a.length;d<e;d++){if(d===e-1)return this.j(b,a[d],c);this.j(b,a[d])}else{const n=this.a.index,l=this.a.keys;var d=this.a.tag,e=this.a.id;let k;let m;for(var h=0;h<e.length;h++)k=(k||a)[e[h]];if(d){for(e=0;e<d.length;e++){var g=d[e];var f=g.split(":");for(h=0;h<f.length;h++)m=(m||a)[f[h]];m="@"+m}f=this.s[g];f=f[m]||(f[m]=[])}if("remove"===b){delete this.g[k];for(let a=0,b=l.length;a<b;a++){if(a===b-1)return n[l[a]].remove(k,c);n[l[a]].remove(k)}}e=this.a.field;f&&(f[f.length]=
|
||||
a);for(let f=0,h=e.length;f<h;f++){d=e[f];let m;for(g=0;g<d.length;g++)m=(m||a)[d[g]];this.g[k]=a;d=n[l[f]];g="add"===b?d.add:d.update;if(f===h-1)return g.call(d,k,m,c);g.call(d,k,m)}}};l.prototype.update=function(b,a,c){if(this.a&&K(b))return this.j("update",b,a);this.f["@"+b]&&E(a)&&(this.remove(b),this.add(b,a,c,!0));return this};l.prototype.remove=function(b,a,c){if(this.a&&K(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++)O(this.l[a],b);this.depth&&O(this.h,b);delete this.f[d]}return this};let u;l.prototype.search=function(b,a,c,d){if(K(a)){if(z(a))for(var e=0;e<a.length;e++)a[e].query=b;else a.query=b;b=a;a=0}let f=[],g=b;let m,l,p;if(K(b)&&!z(b)){(c=b.callback||H(a)&&a)&&(g.callback=null);l=b.sort;m=!1;
|
||||
a=b.limit;var k=b.threshold;p=!1;b=b.query}if(this.a){k=this.a.index;var w=g.bool||"or",r=g.field;let h=w;let n,B;if(r)z(r)||(r=[r]);else if(z(g)){var u=g;r=[];h=[];for(var q=0;q<g.length;q++)d=g[q],e=d.bool||w,r[q]=d.field,h[q]=e,"not"===e?n=!0:"and"===e&&(B=!0)}else r=this.a.keys;w=r.length;for(q=0;q<w;q++)u&&(g=u[q]),m&&!E(g)&&(g.page=null,g.limit=0),f[q]=k[r[q]].search(g,0);if(c)return c(G.call(this,b,h,f,l,a,p,!1,m,B,n));if(this.async){const c=this;return new Promise(function(d){Promise.all(f).then(function(e){d(G.call(c,
|
||||
b,h,e,l,a,p,!1,m,B,n))})})}return G.call(this,b,h,f,l,a,p,!1,m,B,n)}k||(k=this.threshold||0);H(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||!E(b))return f;g=b;g=this.encode(g);if(!g.length)return f;c=this.c;c=H(c)?c(g):g.split(W);this.filter&&(c=F(c,this.filter));u=c.length;
|
||||
d=!0;e=[];const A=x();1<u&&(this.depth?(r=!0,q=c[0],A[q]=1):c.sort(ca));if(!r||(w=this.h)[q]){const a=this.b;for(let b=r?1:0;b<u;b++){const f=c[b];if(f){if(!A[f]){const b=[];let c=!1,g=0;if(q=r?w[q]:this.l){let d;for(let e=0;e<a-k;e++)if(d=q[e][f])b[g++]=d,c=!0}if(c)e[e.length]=1<g?b.concat.apply([],b):b[0];else{d=!1;break}A[f]=1}q=f}}}else d=!1;d&&(f=R(e,a,m,!1));return f};l.prototype.clear=function(){return this.destroy().init()};l.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 L={icase:function(b){return b.toLowerCase()},simple:function(){const b=[f("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",f("[\u00e8\u00e9\u00ea\u00eb]"),"e",f("[\u00ec\u00ed\u00ee\u00ef]"),"i",f("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",f("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",f("[\u00fd\u0177\u00ff]"),"y",f("\u00f1"),"n",f("\u00e7"),"c",f("\u00df"),"s",f(" & ")," and ",f("[-/]")," ",f("[^a-z0-9 ]"),
|
||||
"",f("\\s+")," "];return function(a){a=J(a.toLowerCase(),b);return" "===a?"":a}}(),advanced:function(){const b=[f("ae"),"a",f("ai"),"ei",f("ay"),"ei",f("ey"),"ei",f("oe"),"o",f("ue"),"u",f("ie"),"i",f("sz"),"s",f("zs"),"s",f("sh"),"s",f("ck"),"k",f("cc"),"k",f("dt"),"t",f("ph"),"f",f("pf"),"f",f("ou"),"o",f("uo"),"u"];return function(a,c){if(!a)return a;a=this.simple(a);2<a.length&&(a=J(a,b));c||1<a.length&&(a=P(a));return a}}(),extra:function(){const b=[f("p"),"b",f("z"),"s",f("[cgq]"),"k",f("n"),
|
||||
"m",f("d"),"t",f("[vw]"),"f",f("[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]+J(d.substring(1),b))}a=a.join(" ");a=P(a)}return a}}(),balance:function(){const b=[f("[-/]")," ",f("[^a-z0-9 ]"),"",f("\\s+")," "];return function(a){return P(J(a.toLowerCase(),b))}}()};return l}(!1),this);
|
||||
'use strict';(function(l,F,G){let x;(x=G.define)&&x.amd?x([],function(){return F}):(x=G.modules)?x[l.toLowerCase()]=F:"object"===typeof exports?module.exports=F:G[l]=F})("FlexSearch",function(){function l(b,a){const c=a?a.id:b&&b.id;this.id=c||0===c?c:aa++;this.init(b,a);x(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].f):Object.keys(this.f)});x(this,"length",function(){return this.index.length})}function F(b,a){const c=b.length,d=H(a),f=[];for(let m=0,g=0;m<c;m++){const c=
|
||||
b[m];if(d&&a(c)||!d&&!a[c])f[g++]=c}return f}function G(b,a,c,d,f,m,g,h,p,e){c=V(c,g?0:f,!1,!1,a,p,e);let n;h&&(h=c.page,n=c.next,c=c.result);if(g)b=this.where(g,null,f,c);else{b=c;a=this.g;c=b.length;f=Array(c);for(m=0;m<c;m++)f[m]=a[b[m]];b=f}c=b;d&&(H(d)||(y=d.split(":"),1<y.length?d=ba:(y=y[0],d=ca)),c.sort(d));return c=I(h,n,c)}function x(b,a,c){Object.defineProperty(b,a,{get:c})}function e(b){return new RegExp(b,"g")}function J(b,a){for(let c=0;c<a.length;c+=2)b=b.replace(a[c],a[c+1]);return b}
|
||||
function P(b,a,c,d,f,m,g,h){if(a[c])return a[c];f=f?(h-(g||h/1.5))*m+(g||h/1.5)*f:m;a[c]=f;f>=g&&(b=b[h-(f+.5>>0)],b=b[c]||(b[c]=[]),b[b.length]=d);return f}function S(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 K(g[c])&&S(g[c],a)}}}function T(b){let a="",c="";var d="";for(let f=0;f<b.length;f++){const m=b[f];if(m!==c)if(f&&"h"===m){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+=m}else a+=m;d=f===b.length-1?"":b[f+1];c=m}return a}function da(b,a){b=b.length-a.length;return 0>b?1:b?-1:0}function ca(b,a){b=b[y];a=a[y];return b<a?-1:b>a?1:0}function ba(b,a){const c=y.length;for(let d=0;d<c;d++)b=b[y[d]],a=a[y[d]];return b<a?-1:b>a?1:0}function I(b,a,c){return b?{page:b,next:a?""+a:null,result:c}:c}function V(b,a,c,d,f,m,g){let h,p=[],e;const n=b.length;!0===c?(c="0",e=""):e=c&&c.split(":");
|
||||
if(1<n){const u=A();let R=[],M,D;var q=-1,k;let t;var Q=!0;let C,B=0,v,y,w;e&&(2===e.length?(w=e,e=!1):e=parseInt(e[0],10));if(g){for(M=A();++q<n;)if("not"===f[q])for(D=b[q],t=D.length,k=0;k<t;)M["@"+D[k++]]=1;else y=q+1;if(N(y))return I(c,h,p);q=-1}else v=E(f)&&f;let x;for(;++q<n;){const L=q===(y||n)-1;if(!v||!q)if((k=v||f&&f[q])&&"and"!==k)if("or"===k)x=!1;else continue;else x=m=!0;D=b[q];if(t=D.length){if(Q)if(C){var r=C.length;for(k=0;k<r;){Q=C[k++];var l="@"+Q;g&&M[l]||(u[l]=1,m||(p[B++]=Q))}C=
|
||||
null;Q=!1}else{C=D;continue}l=!1;for(k=0;k<t;){r=D[k++];var z="@"+r;const b=m?u[z]:q;if(!(!b||g&&M[z]||!m&&u[z]))if(b===q){if(L){if(!e||--e<B)if(p[B++]=r,a&&B===a)return I(c,B,p)}else u[z]=q+1;l=!0}else d&&(z=R[b]||(R[b]=[]),z[z.length]=r)}if(x&&!l&&!d)break}else if(x&&!d)return I(c,h,D)}if(C)if(q=C.length,g)for(k=e?parseInt(e,10):0;k<q;){if(b=C[k++],!M["@"+b]&&(!e||--e<B)&&(p[B++]=b,a&&B===a))return I(c,k,p)}else p=C;if(d)for(B=p.length,w?(q=parseInt(w[0],10)+1,k=parseInt(w[1],10)):(q=R.length,k=
|
||||
0);q--;)if(r=R[q])for(t=r.length;k<t;k++)if(d=r[k],!g||!M["@"+d])if(p[B++]=d,a&&B===a)return I(c,q+":"+k,p)}else n&&(f&&"not"===f[0]||(p=b[0]));a&&(g=c?parseInt(c,10):0,h=g+a,h<p.length?p=p.slice(g,h):g&&(p=p.slice(g)));return I(c,h,p)}function E(b){return"string"===typeof b}function w(b){return b.constructor===Array}function H(b){return"function"===typeof b}function K(b){return"object"===typeof b}function N(b){return"undefined"===typeof b}function W(b){const a=Array(b);for(let c=0;c<b;c++)a[c]=A();
|
||||
return a}function A(){return Object.create(null)}const v={encode:"icase",c:"forward",split:/\W+/,cache:!1,async:!1,u:!1,m:!1,a:!1,b:9,threshold:0,depth:0},X={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}},U=[];let aa=
|
||||
0;const Y={},Z={};l.create=function(b){return new l(b)};l.registerMatcher=function(b){for(const a in b)b.hasOwnProperty(a)&&U.push(e(a),b[a]);return this};l.registerEncoder=function(b,a){O[b]=a.bind(O);return this};l.registerLanguage=function(b,a){Y[b]=a.filter;Z[b]=a.stemmer;return this};l.encode=function(b,a){return O[b](a)};l.prototype.init=function(b,a){this.o=[];if(a){var c=a.preset;b=a}else b||(b=v),c=b.preset;a={};E(b)?(a=X[b],b={}):c&&(a=X[c]);this.c=b.tokenize||a.c||this.c||v.c;this.split=
|
||||
b.split||this.split||v.split;this.m=b.rtl||this.m||v.m;this.async="undefined"===typeof Promise||N(c=b.async)?this.async||v.async:c;this.threshold=N(c=b.threshold)?a.threshold||this.threshold||v.threshold:c;this.b=N(c=b.resolution)?c=a.b||this.b||v.b:c;c<=this.threshold&&(this.b=this.threshold+1);this.depth="strict"!==this.c||N(c=b.depth)?a.depth||this.depth||v.depth:c;this.i=(c=N(c=b.encode)?a.encode||v.encode:c)&&O[c]&&O[c].bind(O)||(H(c)?c:this.i||!1);(c=b.matcher)&&this.addMatcher(c);if(c=b.filter){E(c)&&
|
||||
(c=Y[c]);if(w(c)){a=this.i;var d=A();for(var f=0;f<c.length;f++){var m=a?a(c[f]):c[f];d[m]=1}c=d}this.filter=c}if(c=b.stemmer){var g;a=E(c)?Z[c]:c;d=this.i;f=[];for(g in a)a.hasOwnProperty(g)&&(m=d?d(g):g,f.push(e(m+"($|\\W)"),d?d(a[g]):a[g]));this.stemmer=g=f}this.a=d=(c=b.doc)?c:this.a||v.a;this.l=W(this.b-(this.threshold||0));this.h=A();this.f=A();if(d&&(this.g=A(),b.doc=null,g=d.index={},c=d.keys=[],a=d.field,w(d.id)||(d.id=d.id.split(":")),a)){let e;w(a)||(K(a)?(e=a,d.field=a=Object.keys(a)):
|
||||
d.field=a=[a]);for(d=0;d<a.length;d++)f=a[d],w(f)||(e&&(b=e[f]),c[d]=f,a[d]=f.split(":")),g[f]=new l(b),g[f].g=this.g}return this};l.prototype.encode=function(b){b&&U.length&&(b=J(b,U));b&&this.o.length&&(b=J(b,this.o));b&&this.i&&(b=this.i(b));b&&this.stemmer&&(b=J(b,this.stemmer));return b};l.prototype.addMatcher=function(b){const a=this.o;for(const c in b)b.hasOwnProperty(c)&&a.push(e(c),b[c]);return this};l.prototype.add=function(b,a,c,d,f){if(this.a&&K(b))return this.j("add",b,a);if(a&&E(a)&&
|
||||
(b||0===b)){var e="@"+b;if(this.f[e]&&!d)return this.update(b,a);if(!f){if(this.async&&"function"!==typeof importScripts){let f=this;e=new Promise(function(c){setTimeout(function(){f.add(b,a,null,d,!0);f=null;c()})});if(c)e.then(c);else return e;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=H(c)?c(a):a.split(this.split);this.filter&&(f=F(f,this.filter));const m=A();m._ctx=A();const k=f.length,l=this.threshold,r=this.depth,t=this.b,z=
|
||||
this.l,L=this.m;for(let a=0;a<k;a++){var g=f[a];if(g){var h=g.length,p=(L?a+1:k-a)/k,u="";switch(c){case "reverse":case "both":for(var n=h;--n;)u=g[n]+u,P(z,m,u,b,L?1:(h-n)/h,p,l,t-1);u="";case "forward":for(n=0;n<h;n++)u+=g[n],P(z,m,u,b,L?(n+1)/h:1,p,l,t-1);break;case "full":for(n=0;n<h;n++){const a=(L?n+1:h-n)/h;for(let c=h;c>n;c--)u=g.substring(n,c),P(z,m,u,b,a,p,l,t-1)}break;default:if(h=P(z,m,g,b,1,p,l,t-1),r&&1<k&&h>=l)for(h=m._ctx[g]||(m._ctx[g]=A()),g=this.h[g]||(this.h[g]=W(t-(l||0))),p=
|
||||
a-r,u=a+r+1,0>p&&(p=0),u>k&&(u=k);p<u;p++)p!==a&&P(g,h,f[p],b,0,t-(p<a?a-p:p-a),l,t-1)}}}this.f[e]=1}return this};l.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 m=this.a.index,l=this.a.keys;var d=this.a.tag,f=this.a.id;let n;let q;for(var e=0;e<f.length;e++)n=(n||a)[f[e]];if(d){for(f=0;f<d.length;f++){var g=d[f];var h=g.split(":");for(e=0;e<h.length;e++)q=(q||a)[h[e]];q="@"+q}h=this.s[g];h=h[q]||(h[q]=[])}if("remove"===
|
||||
b){delete this.g[n];for(let a=0,b=l.length;a<b;a++){if(a===b-1)return m[l[a]].remove(n,c);m[l[a]].remove(n)}}f=this.a.field;h&&(h[h.length]=a);this.g[n]=a;for(let e=0,h=f.length;e<h;e++){d=f[e];let k;for(g=0;g<d.length;g++)k=(k||a)[d[g]];d=m[l[e]];g="add"===b?d.add:d.update;if(e===h-1)return g.call(d,n,k,c);g.call(d,n,k)}}};l.prototype.update=function(b,a,c){if(this.a&&K(b))return this.j("update",b,a);this.f["@"+b]&&E(a)&&(this.remove(b),this.add(b,a,c,!0));return this};l.prototype.remove=function(b,
|
||||
a,c){if(this.a&&K(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++)S(this.l[a],b);this.depth&&S(this.h,b);delete this.f[d]}return this};let y;l.prototype.search=function(b,a,c,d){if(K(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=[],g=b;let h,l,u;if(K(b)&&!w(b)){(c=b.callback||H(a)&&a)&&(g.callback=null);l=b.sort;h=!1;a=b.limit;var n=b.threshold;u=!1;b=b.query}if(this.a){n=this.a.index;var q=g.bool||"or",k=g.field;let m=q;let p,t;if(k)w(k)||(k=[k]);else if(w(g)){var v=g;k=[];m=[];for(var r=0;r<g.length;r++)d=g[r],f=d.bool||q,k[r]=d.field,m[r]=f,"not"===f?p=!0:"and"===f&&(t=!0)}else k=this.a.keys;q=k.length;for(r=0;r<q;r++)v&&(g=v[r]),h&&!E(g)&&(g.page=null,g.limit=0),e[r]=n[k[r]].search(g,0);
|
||||
if(c)return c(G.call(this,b,m,e,l,a,u,!1,h,t,p));if(this.async){const c=this;return new Promise(function(d){Promise.all(e).then(function(e){d(G.call(c,b,m,e,l,a,u,!1,h,t,p))})})}return G.call(this,b,m,e,l,a,u,!1,h,t,p)}n||(n=this.threshold||0);H(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(g,a,null,!0));b=null})});if(c)n.then(c);else return n;return this}if(c)return c(this.search(g,a,
|
||||
null,!0)),this}if(!b||!E(b))return e;g=b;g=this.encode(g);if(!g.length)return e;c=this.c;c=H(c)?c(g):g.split(this.split);this.filter&&(c=F(c,this.filter));v=c.length;d=!0;f=[];const t=A();1<v&&(this.depth?(k=!0,r=c[0],t[r]=1):c.sort(da));if(!k||(q=this.h)[r]){const a=this.b;for(let b=k?1:0;b<v;b++){const e=c[b];if(e){if(!t[e]){const b=[];let c=!1,g=0;if(r=k?q[r]:this.l){let d;for(let f=0;f<a-n;f++)if(d=r[f][e])b[g++]=d,c=!0}if(c)f[f.length]=1<g?b.concat.apply([],b):b[0];else{d=!1;break}t[e]=1}r=e}}}else d=
|
||||
!1;d&&(e=V(f,a,h,!1));return e};l.prototype.clear=function(){return this.destroy().init()};l.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 O={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=J(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=J(a,b));c||1<a.length&&(a=T(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]+J(d.substring(1),b))}a=a.join(" ");a=T(a)}return a}}(),balance:function(){const b=[e("[-/]")," ",e("[^a-z0-9 ]"),"",e("\\s+")," "];return function(a){return T(J(a.toLowerCase(),
|
||||
b))}}()};return l}(!1),this);
|
||||
|
86
dist/flexsearch.es5.js
vendored
86
dist/flexsearch.es5.js
vendored
@@ -1,49 +1,49 @@
|
||||
/*
|
||||
FlexSearch v0.6.0
|
||||
FlexSearch v0.6.1
|
||||
Copyright 2019 Nextapps GmbH
|
||||
Author: Thomas Wilkerling
|
||||
Released under the Apache 2.0 Licence
|
||||
https://github.com/nextapps-de/flexsearch
|
||||
*/
|
||||
'use strict';function P(d){var m=0;return function(){return m<d.length?{done:!1,value:d[m++]}:{done:!0}}}var W="function"==typeof Object.defineProperties?Object.defineProperty:function(d,m,f){d!=Array.prototype&&d!=Object.prototype&&(d[m]=f.value)},Y="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this;function aa(){aa=function(){};Y.Symbol||(Y.Symbol=ba)}var ba=function(){var d=0;return function(m){return"jscomp_symbol_"+(m||"")+d++}}();
|
||||
function Z(){aa();var d=Y.Symbol.iterator;d||(d=Y.Symbol.iterator=Y.Symbol("iterator"));"function"!=typeof Array.prototype[d]&&W(Array.prototype,d,{configurable:!0,writable:!0,value:function(){return ca(P(this))}});Z=function(){}}function ca(d){Z();d={next:d};d[Y.Symbol.iterator]=function(){return this};return d}
|
||||
function ka(d,m){Z();d instanceof String&&(d+="");var f=0,l={next:function(){if(f<d.length){var p=f++;return{value:m(p,d[p]),done:!1}}l.next=function(){return{done:!0,value:void 0}};return l.next()}};l[Symbol.iterator]=function(){return l};return l}function la(d,m){if(m){var f=Y;d=d.split(".");for(var l=0;l<d.length-1;l++){var p=d[l];p in f||(f[p]={});f=f[p]}d=d[d.length-1];l=f[d];m=m(l);m!=l&&null!=m&&W(f,d,{configurable:!0,writable:!0,value:m})}}
|
||||
la("Array.prototype.keys",function(d){return d?d:function(){return ka(this,function(d){return d})}});function ma(d){var m="undefined"!=typeof Symbol&&Symbol.iterator&&d[Symbol.iterator];return m?m.call(d):{next:P(d)}}
|
||||
la("Promise",function(d){function m(h){this.g=0;this.o=void 0;this.b=[];var e=this.j();try{h(e.resolve,e.reject)}catch(x){e.reject(x)}}function f(){this.b=null}function l(h){return h instanceof m?h:new m(function(e){e(h)})}if(d)return d;f.prototype.g=function(h){if(null==this.b){this.b=[];var e=this;this.j(function(){e.o()})}this.b.push(h)};var p=Y.setTimeout;f.prototype.j=function(h){p(h,0)};f.prototype.o=function(){for(;this.b&&this.b.length;){var h=this.b;this.b=[];for(var e=0;e<h.length;++e){var d=
|
||||
h[e];h[e]=null;try{d()}catch(D){this.l(D)}}}this.b=null};f.prototype.l=function(h){this.j(function(){throw h;})};m.prototype.j=function(){function h(h){return function(f){d||(d=!0,h.call(e,f))}}var e=this,d=!1;return{resolve:h(this.L),reject:h(this.l)}};m.prototype.L=function(h){if(h===this)this.l(new TypeError("A Promise cannot resolve to itself"));else if(h instanceof m)this.M(h);else{a:switch(typeof h){case "object":var e=null!=h;break a;case "function":e=!0;break a;default:e=!1}e?this.K(h):this.w(h)}};
|
||||
m.prototype.K=function(h){var e=void 0;try{e=h.then}catch(x){this.l(x);return}"function"==typeof e?this.N(e,h):this.w(h)};m.prototype.l=function(h){this.B(2,h)};m.prototype.w=function(h){this.B(1,h)};m.prototype.B=function(h,e){if(0!=this.g)throw Error("Cannot settle("+h+", "+e+"): Promise already settled in state"+this.g);this.g=h;this.o=e;this.I()};m.prototype.I=function(){if(null!=this.b){for(var h=0;h<this.b.length;++h)Q.g(this.b[h]);this.b=null}};var Q=new f;m.prototype.M=function(h){var e=this.j();
|
||||
h.F(e.resolve,e.reject)};m.prototype.N=function(h,e){var d=this.j();try{h.call(e,d.resolve,d.reject)}catch(D){d.reject(D)}};m.prototype.then=function(h,e){function d(e,d){return"function"==typeof e?function(d){try{f(e(d))}catch(M){l(M)}}:d}var f,l,p=new m(function(e,d){f=e;l=d});this.F(d(h,f),d(e,l));return p};m.prototype.catch=function(d){return this.then(void 0,d)};m.prototype.F=function(d,e){function h(){switch(f.g){case 1:d(f.o);break;case 2:e(f.o);break;default:throw Error("Unexpected state: "+
|
||||
f.g);}}var f=this;null==this.b?Q.g(h):this.b.push(h)};m.resolve=l;m.reject=function(d){return new m(function(e,f){f(d)})};m.race=function(d){return new m(function(e,f){for(var h=ma(d),m=h.next();!m.done;m=h.next())l(m.value).F(e,f)})};m.all=function(d){var e=ma(d),f=e.next();return f.done?l([]):new m(function(d,h){function m(e){return function(f){p[e]=f;x--;0==x&&d(p)}}var p=[],x=0;do p.push(void 0),x++,l(f.value).F(m(p.length-1),h),f=e.next();while(!f.done)})};return m});
|
||||
(function(d,m,f){var l;(l=f.define)&&l.amd?l([],function(){return m}):(l=f.modules)?l[d.toLowerCase()]=m:"object"===typeof exports?module.exports=m:f[d]=m})("FlexSearch",function qa(d){function f(a,b){var c=b?b.id:a&&a.id;this.id=c||0===c?c:ra++;this.init(a,b);h(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].f):Object.keys(this.f)});h(this,"length",function(){return this.index.length})}function l(a,b,c,g){this.D!==this.i&&(this.A=this.A.concat(c),this.D++,g&&this.A.length>=
|
||||
g&&(this.D=this.i),this.D===this.i&&(this.cache&&this.v.set(b,this.A),this.H&&this.H(this.A)));return this}function p(a,b){for(var c=a.length,g=R(b),k=[],u=0,e=0;u<c;u++){var d=a[u];if(g&&b(d)||!g&&!b[d])k[e++]=d}return k}function Q(a,b,c,g,k,u,e,d,f,h){c=da(c,e?0:k,d,u,b,f,h);if(d){d=c.page;var U=c.next;c=c.result}if(e)b=this.where(e,null,k,c);else{b=c;c=this.m;k=b.length;u=Array(k);for(e=0;e<k;e++)u[e]=c[b[e]];b=u}c=b;g&&(R(g)||(F=g.split(":"),1<F.length?g=pa:(F=F[0],g=oa)),c.sort(g));c=M(d,U,c);
|
||||
this.cache&&this.v.set(a,c);return c}function h(a,b,c){Object.defineProperty(a,b,{get:c})}function e(a){return new RegExp(a,"g")}function x(a,b){for(var c=0;c<b.length;c+=2)a=a.replace(b[c],b[c+1]);return a}function D(a,b,c,g,k,u,e,d){if(b[c])return b[c];k=k?(d-(e||d/1.5))*u+(e||d/1.5)*k:u;b[c]=k;k>=e&&(a=a[d-(k+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=g);return k}function S(a,b){if(a)for(var c=Object.keys(a),g=0,k=c.length;g<k;g++){var u=c[g],e=a[u];if(e)for(var d=0,f=e.length;d<f;d++)if(e[d]===b){1===
|
||||
f?delete a[u]:e.splice(d,1);break}else J(e[d])&&S(e[d],b)}}function X(a){for(var b="",c="",g="",k=0;k<a.length;k++){var u=a[k];if(u!==c)if(k&&"h"===u){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+=u}else b+=u;g=k===a.length-1?"":a[k+1];c=u}return b}function na(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function oa(a,b){a=a[F];b=b[F];return a<b?-1:a>b?1:0}function pa(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 M(a,b,c){return a?{page:a,next:b?""+b:null,result:c}:c}function da(a,b,c,g,k,u,e){u=[];var d=a.length;if(!0===c){c="0";var f=""}else f=c&&c.split(":");if(1<d){var h=G(),U=[],q,t=-1,n,l=!0,v=0;if(f)if(2===f.length){var y=f;f=!1}else f=parseInt(f[0],10);if(e){for(q=G();++t<d;)if("not"===k[t]){var w=a[t];var r=w.length;for(n=0;n<r;)q["@"+w[n++]]=1}else var z=t+1;if(!z)return M(c,J,u);t=-1}else var p=N(k)&&k;for(;++t<d;){var x=t===(z||d)-1,E=void 0,I=void 0;if(!p||
|
||||
!t)if((n=p||k&&k[t])&&"and"!==n)if("or"===n)I=!0;else continue;else E=!0;w=a[t];if(r=w.length){if(l)if(L){var K=L.length;for(n=0;n<K;)h["@"+L[n++]]=1;var L=null;l=!1}else{L=w;continue}var H=!1;for(n=0;n<r;){K=w[n++];var D="@"+K,F=I?t:h[D];if(F&&(!e||!q[D]))if(F===t){if(x){if(!f||--f<v)if(u[v++]=K,b&&v===b)return M(c,v,u)}else h[D]=t+1;H=!0}else g&&(D=U[F]||(U[F]=[]),D[D.length]=K)}if(E&&!H&&!g)break}else if(E&&!g)return M(c,J,w)}if(L)if(a=L.length,e)for(n=f?parseInt(f,10):0;n<a;){if(k=L[n++],!q["@"+
|
||||
k]&&(!f||--f<v)&&(u[v++]=k,b&&v===b))return M(c,n,u)}else u=L;if(g)for(v=u.length,y?(t=parseInt(y[0],10)+1,n=parseInt(y[1],10)):(t=U.length,n=0);t--;)if(K=U[t])for(r=K.length;n<r;n++)if(g=K[n],!e||!q["@"+g])if(u[v++]=g,b&&v===b)return M(c,t+":"+n,u)}else d&&(k&&"not"===k[0]||(u=a[0]));if(b){e=c?parseInt(c,10):0;var J=e+b;J<u.length?u=u.slice(e,J):e&&(u=u.slice(e))}return M(c,J,u)}function N(a){return"string"===typeof a}function E(a){return a.constructor===Array}function R(a){return"function"===typeof a}
|
||||
function J(a){return"object"===typeof a}function H(a){return"undefined"===typeof a}function ea(a){for(var b=Array(a),c=0;c<a;c++)b[c]=G();return b}function G(){return Object.create(null)}function sa(){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 ta(a,b,c,g){a=d("flexsearch","id"+a,sa,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=qa.toString();c.id=b;a.postMessage({register:k,options:c,id:b});return a}
|
||||
var I={encode:"icase",h:"forward",cache:!1,async:!1,i:!1,G:!1,a:!1,c:9,threshold:0,depth:0},fa={memory:{encode:"extra",h:"strict",threshold:0,c:1},speed:{encode:"icase",h:"strict",threshold:1,c:3,depth:2},match:{encode:"extra",h:"full",threshold:1,c:3},score:{encode:"extra",h:"strict",threshold:1,c:9,depth:4},balance:{encode:"balance",h:"strict",threshold:0,c:3,depth:3},fast:{encode:"icase",h:"strict",threshold:8,c:9,depth:1}},T=[],ra=0,ha=/\W+/,ia={},ja={};f.create=function(a){return new f(a)};f.registerMatcher=
|
||||
function(a){for(var b in a)a.hasOwnProperty(b)&&T.push(e(b),a[b]);return this};f.registerEncoder=function(a,b){O[a]=b.bind(O);return this};f.registerLanguage=function(a,b){ia[a]=b.filter;ja[a]=b.stemmer;return this};f.encode=function(a,b){return O[a](b)};f.prototype.init=function(a,b){this.g=[];if(b){var c=b.preset;a=b}else a||(a=I),c=a.preset;b={};N(a)?((b=fa[a])||console.warn("Preset not found: "+a),a={}):c&&((b=fa[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.D=0;this.A=[];this.H=null;this.b=Array(g);for(var k=0;k<g;k++)this.b[k]=ta(this.id,k,a,l.bind(this))}this.h=a.tokenize||b.h||this.h||I.h;this.G=a.rtl||this.G||I.G;this.async="undefined"===typeof Promise||H(c=a.async)?this.async||I.async:c;this.i=H(c=a.worker)?this.i||I.i:c;this.threshold=H(c=a.threshold)?b.threshold||this.threshold||I.threshold:c;this.c=H(c=a.resolution)?c=b.c||this.c||I.c:c;c<=this.threshold&&(this.c=this.threshold+1);this.depth=
|
||||
"strict"!==this.h||H(c=a.depth)?b.depth||this.depth||I.depth:c;this.j=(c=H(c=a.encode)?b.encode||I.encode:c)&&O[c]&&O[c].bind(O)||(R(c)?c:this.j||!1);(c=a.matcher)&&this.addMatcher(c);if(c=a.filter){N(c)&&(c=ia[c]);if(E(c)){b=this.j;g=G();for(k=0;k<c.length;k++){var d=b?b(c[k]):c[k];g[d]=1}c=g}this.filter=c}if(c=a.stemmer){b=N(c)?ja[c]:c;g=this.j;k=[];for(var h in b)b.hasOwnProperty(h)&&(d=g?g(h):h,k.push(e(d+"($|\\W)"),g?g(b[h]):b[h]));this.stemmer=k}this.a=k=(c=a.doc)?c:this.a||I.a;this.u=ea(this.c-
|
||||
(this.threshold||0));this.s=G();this.f=G();if(k){this.m=G();a.doc=null;h=k.index={};b=k.keys=[];g=k.field;d=k.tag;E(k.id)||(k.id=k.id.split(":"));if(d){this.B=G();var V=G();if(g)if(N(g))V[g]=a;else if(E(g))for(var A=0;A<g.length;A++)V[g[A]]=a;else J(g)&&(V=g);E(d)||(k.tag=d=[d]);for(g=0;g<d.length;g++)this.B[d[g]]=G();this.I=d;g=V}if(g){if(!E(g))if(J(g)){var B=g;k.field=g=Object.keys(g)}else k.field=g=[g];for(k=0;k<g.length;k++)d=g[k],E(d)||(B&&(a=B[d]),b[k]=d,g[k]=d.split(":")),h[d]=new f(a),h[d].m=
|
||||
this.m}}this.o=!0;this.v=(this.cache=c=H(c=a.cache)?this.cache||I.cache:c)?new ua(c):!1;return this};f.prototype.encode=function(a){a&&T.length&&(a=x(a,T));a&&this.g.length&&(a=x(a,this.g));a&&this.j&&(a=this.j(a));a&&this.stemmer&&(a=x(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,d){if(this.a&&J(a))return this.l("add",a,b);if(b&&N(b)&&(a||0===a)){var e="@"+a;if(this.f[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.f[e]=""+this.w,c&&c(),this;if(!d){if(this.async&&"function"!==typeof importScripts){var k=this;e=new Promise(function(c){setTimeout(function(){k.add(a,b,null,g,!0);k=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;d=R(c)?c(b):b.split(ha);this.filter&&(d=p(d,this.filter));
|
||||
var f=G();f._ctx=G();for(var h=d.length,B=this.threshold,l=this.depth,q=this.c,t=this.u,n=this.G,C=0;C<h;C++){var v=d[C];if(v){var y=v.length,w=(n?C+1:h-C)/h,r="";switch(c){case "reverse":case "both":for(var z=y;--z;)r=v[z]+r,D(t,f,r,a,n?1:(y-z)/y,w,B,q-1);r="";case "forward":for(z=0;z<y;z++)r+=v[z],D(t,f,r,a,n?(z+1)/y:1,w,B,q-1);break;case "full":for(z=0;z<y;z++)for(var x=(n?z+1:y-z)/y,E=y;E>z;E--)r=v.substring(z,E),D(t,f,r,a,x,w,B,q-1);break;default:if(y=D(t,f,v,a,1,w,B,q-1),l&&1<h&&y>=B)for(y=
|
||||
f._ctx[v]||(f._ctx[v]=G()),v=this.s[v]||(this.s[v]=ea(q-(B||0))),w=C-l,r=C+l+1,0>w&&(w=0),r>h&&(r=h);w<r;w++)w!==C&&D(v,y,d[w],a,0,q-(w<C?C-w:w-C),B,q-1)}}}this.f[e]=1;this.o=!1}return this};f.prototype.l=function(a,b,c){if(E(b))for(var g=0,d=b.length;g<d;g++){if(g===d-1)return this.l(a,b[g],c);this.l(a,b[g])}else{g=this.a.index;d=this.a.keys;for(var e=this.a.tag,f=this.a.id,h,A,l,p,q=0;q<f.length;q++)h=(h||b)[f[q]];if(e){for(f=0;f<e.length;f++){l=e[f];A=l.split(":");for(q=0;q<A.length;q++)p=(p||
|
||||
b)[A[q]];p="@"+p}A=this.B[l];A=A[p]||(A[p]=[])}if("remove"===a)for(delete this.m[h],f=0,e=d.length;f<e;f++){if(f===e-1)return g[d[f]].remove(h,c);g[d[f]].remove(h)}f=this.a.field;A&&(A[A.length]=b);e=0;for(l=f.length;e<l;e++){A=f[e];p=void 0;for(q=0;q<A.length;q++)p=(p||b)[A[q]];this.m[h]=b;A=g[d[e]];q="add"===a?A.add:A.update;if(e===l-1)return q.call(A,h,p,c);q.call(A,h,p)}}};f.prototype.update=function(a,b,c){if(this.a&&J(a))return this.l("update",a,b);this.f["@"+a]&&N(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.f[g]){if(this.i)return this.b[this.f[g]].postMessage({remove:!0,id:a}),delete this.f[g],b&&b(),this;if(!c){if(this.async&&"function"!==typeof importScripts){var d=this;g=new Promise(function(b){setTimeout(function(){d.remove(a,null,!0);d=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.c-(this.threshold||0);b++)S(this.u[b],
|
||||
a);this.depth&&S(this.s,a);delete this.f[g];this.o=!1}return this};var F;f.prototype.search=function(a,b,c,d){if(J(b)){if(E(b))for(var e=0;e<b.length;e++)b[e].query=a;else b.query=a;a=b;b=0}var g=[],f=a;if(J(a)&&!E(a)){(c=a.callback||R(b)&&b)&&(f.callback=null);var h=a.sort;var l=a.page;b=a.limit;var B=a.threshold;var x=a.suggest;a=a.query}if(this.a){B=this.a.index;var q=f.where,t=f.bool||"or",n=f.field,C=t,v,y;if(n)E(n)||(n=[n]);else if(E(f)){var w=f;n=[];C=[];for(var r=0;r<f.length;r++)d=f[r],e=
|
||||
d.bool||t,n[r]=d.field,C[r]=e,"not"===e?v=!0:"and"===e&&(y=!0)}else n=this.a.keys;t=n.length;for(r=0;r<t;r++)w&&(f=w[r]),l&&!N(f)&&(f.page=null,f.limit=0),g[r]=B[n[r]].search(f,0);if(c)return c(Q.call(this,a,C,g,h,b,x,q,l,y,v));if(this.async){var z=this;return new Promise(function(c){Promise.all(g).then(function(d){c(Q.call(z,a,C,d,h,b,x,q,l,y,v))})})}return Q.call(this,a,C,g,h,b,x,q,l,y,v)}B||(B=this.threshold||0);R(b)?(c=b,b=1E3):b||0===b||(b=1E3);if(this.i)for(this.H=c,this.D=0,this.A=[],n=0;n<
|
||||
this.i;n++)this.b[n].postMessage({search:!0,limit:b,cursor:l,threshold:B,content:a});else{if(!d){if(this.async&&"function"!==typeof importScripts){var D=this;B=new Promise(function(a){setTimeout(function(){a(D.search(f,b,null,!0));D=null})});if(c)B.then(c);else return B;return this}if(c)return c(this.search(f,b,null,!0)),this}if(!a||!N(a))return g;f=a;if(this.cache)if(this.o){if(c=this.v.get(a))return c}else this.v.clear(),this.o=!0;f=this.encode(f);if(!f.length)return g;c=this.h;c=R(c)?c(f):f.split(ha);
|
||||
this.filter&&(c=p(c,this.filter));w=c.length;d=!0;e=[];var F=G();1<w&&(this.depth?(n=!0,r=c[0],F[r]=1):c.sort(na));if(!n||(t=this.s)[r])for(var I=this.c,H=n?1:0;H<w;H++){var K=c[H];if(K){if(!F[K]){var L=[],M=!1,O=0;if(r=n?t[r]:this.u)for(var T=void 0,S=0;S<I-B;S++)if(T=r[S][K])L[O++]=T,M=!0;if(M)e[e.length]=1<O?L.concat.apply([],L):L[0];else if(!x){d=!1;break}F[K]=1}r=K}}else d=!1;d&&(g=da(e,b,l,x));this.cache&&this.v.set(a,g);return g}};f.prototype.find=function(a,b){return this.where(a,b,1)[0]||
|
||||
null};f.prototype.where=function(a,b,c,d){var e=this.m,g=[],f=0,h;if(J(a)){c||(c=b);var l=Object.keys(a);var p=l.length;var x=!1;if(1===p&&"id"===l[0])return[e[a.id]];if((h=this.I)&&!d)for(var q=0;q<h.length;q++){var t=h[q],n=a[t];if(!H(n)){d=this.B[t]["@"+n];if(0===--p)return d;l.splice(l.indexOf(t),1);delete a[t];break}}h=Array(p);for(q=0;q<p;q++)h[q]=l[q].split(":")}else{if(R(a)){b=d||Object.keys(e);c=b.length;for(l=0;l<c;l++)p=e[b[l]],a(p)&&(g[f++]=p);return g}if(H(b))return[e[a]];if("id"===a)return[e[b]];
|
||||
l=[a];p=1;h=[a.split(":")];x=!0}d=d||Object.keys(e);q=d.length;for(t=0;t<q;t++){n=e[d[t]];for(var C=!0,v=0;v<p;v++){x||(b=a[l[v]]);var y=h[v],w=y.length,r=n;if(1<w)for(var z=0;z<w;z++)r=r[y[z]];else r=r[y[0]];if(r!==b){C=!1;break}}if(C&&(g[f++]=n,c&&f===c))break}return g};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 return{id:this.id,items:this.length,cache:this.cache&&this.cache.C?this.cache.C.length:!1,matcher:T.length+(this.g?this.g.length:
|
||||
0),worker:this.i,threshold:this.threshold,depth:this.depth,resolution:this.c,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.u=this.s=this.f=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.u,d.s,Object.keys(d.f)]}b[c]=this.m;return JSON.stringify(b)}return JSON.stringify([this.u,this.s,Object.keys(this.f)])};f.prototype.import=function(a){a=JSON.parse(a);var b=G();if(this.a){for(var c=this.a.keys,d=c.length,e=a[0][2],f=0;f<e.length;f++)b[e[f]]=1;for(e=0;e<d;e++)f=this.a.index[c[e]],f.u=a[e][0],f.s=a[e][1],f.f=b,f.m=a[d];this.m=a[d]}else{c=a[2];for(d=0;d<c.length;d++)b[c[d]]=1;this.u=a[0];this.s=a[1];this.f=b}};var O={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=x(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=x(b,a));c||1<b.length&&(b=X(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]+x(d.substring(1),a))}b=b.join(" ");b=X(b)}return b}}(),balance:function(){var a=[e("[-/]")," ",e("[^a-z0-9 ]"),"",e("\\s+")," "];return function(b){return X(x(b.toLowerCase(),a))}}()},ua=function(){function a(a){this.clear();this.J=!0!==a&&a}a.prototype.clear=function(){this.cache=G();this.count=G();this.index=G();this.C=[]};a.prototype.set=function(a,c){if(this.J&&H(this.cache[a])){var b=this.C.length;if(b===this.J){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.J&&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 d={},m="undefined"!==typeof Blob&&"undefined"!==typeof URL&&URL.createObjectURL;return function(f,l,p,Q,
|
||||
h){p=m?URL.createObjectURL(new Blob(["("+p.toString()+")()"],{type:"text/javascript"})):f+".es5.js";f+="-"+l;d[f]||(d[f]=[]);d[f][h]=new Worker(p);d[f][h].onmessage=Q;console.log("Register Worker: "+f+"@"+h);return d[f][h]}}()),this);
|
||||
'use strict';function ba(d){var m=0;return function(){return m<d.length?{done:!1,value:d[m++]}:{done:!0}}}var ca="function"==typeof Object.defineProperties?Object.defineProperty:function(d,m,g){d!=Array.prototype&&d!=Object.prototype&&(d[m]=g.value)},P="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this;function da(){da=function(){};P.Symbol||(P.Symbol=ea)}var ea=function(){var d=0;return function(m){return"jscomp_symbol_"+(m||"")+d++}}();
|
||||
function W(){da();var d=P.Symbol.iterator;d||(d=P.Symbol.iterator=P.Symbol("iterator"));"function"!=typeof Array.prototype[d]&&ca(Array.prototype,d,{configurable:!0,writable:!0,value:function(){return fa(ba(this))}});W=function(){}}function fa(d){W();d={next:d};d[P.Symbol.iterator]=function(){return this};return d}
|
||||
function ma(d,m){W();d instanceof String&&(d+="");var g=0,k={next:function(){if(g<d.length){var p=g++;return{value:m(p,d[p]),done:!1}}k.next=function(){return{done:!0,value:void 0}};return k.next()}};k[Symbol.iterator]=function(){return k};return k}function na(d,m){if(m){var g=P;d=d.split(".");for(var k=0;k<d.length-1;k++){var p=d[k];p in g||(g[p]={});g=g[p]}d=d[d.length-1];k=g[d];m=m(k);m!=k&&null!=m&&ca(g,d,{configurable:!0,writable:!0,value:m})}}
|
||||
na("Array.prototype.keys",function(d){return d?d:function(){return ma(this,function(d){return d})}});function oa(d){var m="undefined"!=typeof Symbol&&Symbol.iterator&&d[Symbol.iterator];return m?m.call(d):{next:ba(d)}}
|
||||
na("Promise",function(d){function m(f){this.g=0;this.o=void 0;this.b=[];var e=this.j();try{f(e.resolve,e.reject)}catch(x){e.reject(x)}}function g(){this.b=null}function k(f){return f instanceof m?f:new m(function(e){e(f)})}if(d)return d;g.prototype.g=function(f){if(null==this.b){this.b=[];var e=this;this.j(function(){e.o()})}this.b.push(f)};var p=P.setTimeout;g.prototype.j=function(f){p(f,0)};g.prototype.o=function(){for(;this.b&&this.b.length;){var f=this.b;this.b=[];for(var e=0;e<f.length;++e){var d=
|
||||
f[e];f[e]=null;try{d()}catch(C){this.l(C)}}}this.b=null};g.prototype.l=function(f){this.j(function(){throw f;})};m.prototype.j=function(){function f(f){return function(g){d||(d=!0,f.call(e,g))}}var e=this,d=!1;return{resolve:f(this.L),reject:f(this.l)}};m.prototype.L=function(f){if(f===this)this.l(new TypeError("A Promise cannot resolve to itself"));else if(f instanceof m)this.M(f);else{a:switch(typeof f){case "object":var e=null!=f;break a;case "function":e=!0;break a;default:e=!1}e?this.K(f):this.w(f)}};
|
||||
m.prototype.K=function(f){var e=void 0;try{e=f.then}catch(x){this.l(x);return}"function"==typeof e?this.N(e,f):this.w(f)};m.prototype.l=function(f){this.B(2,f)};m.prototype.w=function(f){this.B(1,f)};m.prototype.B=function(f,e){if(0!=this.g)throw Error("Cannot settle("+f+", "+e+"): Promise already settled in state"+this.g);this.g=f;this.o=e;this.I()};m.prototype.I=function(){if(null!=this.b){for(var f=0;f<this.b.length;++f)Q.g(this.b[f]);this.b=null}};var Q=new g;m.prototype.M=function(f){var e=this.j();
|
||||
f.F(e.resolve,e.reject)};m.prototype.N=function(f,e){var d=this.j();try{f.call(e,d.resolve,d.reject)}catch(C){d.reject(C)}};m.prototype.then=function(f,e){function d(e,d){return"function"==typeof e?function(d){try{g(e(d))}catch(G){k(G)}}:d}var g,k,p=new m(function(e,d){g=e;k=d});this.F(d(f,g),d(e,k));return p};m.prototype.catch=function(d){return this.then(void 0,d)};m.prototype.F=function(d,e){function f(){switch(g.g){case 1:d(g.o);break;case 2:e(g.o);break;default:throw Error("Unexpected state: "+
|
||||
g.g);}}var g=this;null==this.b?Q.g(f):this.b.push(f)};m.resolve=k;m.reject=function(d){return new m(function(e,g){g(d)})};m.race=function(d){return new m(function(e,g){for(var f=oa(d),m=f.next();!m.done;m=f.next())k(m.value).F(e,g)})};m.all=function(d){var e=oa(d),g=e.next();return g.done?k([]):new m(function(d,f){function m(e){return function(g){p[e]=g;x--;0==x&&d(p)}}var p=[],x=0;do p.push(void 0),x++,k(g.value).F(m(p.length-1),f),g=e.next();while(!g.done)})};return m});
|
||||
(function(d,m,g){var k;(k=g.define)&&k.amd?k([],function(){return m}):(k=g.modules)?k[d.toLowerCase()]=m:"object"===typeof exports?module.exports=m:g[d]=m})("FlexSearch",function sa(d){function g(a,b){var c=b?b.id:a&&a.id;this.id=c||0===c?c:ta++;this.init(a,b);f(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].f):Object.keys(this.f)});f(this,"length",function(){return this.index.length})}function k(a,b,c,h){this.D!==this.i&&(this.A=this.A.concat(c),this.D++,h&&this.A.length>=
|
||||
h&&(this.D=this.i),this.D===this.i&&(this.cache&&this.v.set(b,this.A),this.H&&this.H(this.A)));return this}function p(a,b){for(var c=a.length,h=R(b),l=[],w=0,e=0;w<c;w++){var d=a[w];if(h&&b(d)||!h&&!b[d])l[e++]=d}return l}function Q(a,b,c,h,l,w,e,d,g,f){c=ha(c,e?0:l,d,w,b,g,f);if(d){d=c.page;var T=c.next;c=c.result}if(e)b=this.where(e,null,l,c);else{b=c;c=this.m;l=b.length;w=Array(l);for(e=0;e<l;e++)w[e]=c[b[e]];b=w}c=b;h&&(R(h)||(D=h.split(":"),1<D.length?h=ra:(D=D[0],h=qa)),c.sort(h));c=G(d,T,c);
|
||||
this.cache&&this.v.set(a,c);return c}function f(a,b,c){Object.defineProperty(a,b,{get:c})}function e(a){return new RegExp(a,"g")}function x(a,b){for(var c=0;c<b.length;c+=2)a=a.replace(b[c],b[c+1]);return a}function C(a,b,c,h,l,w,e,d){if(b[c])return b[c];l=l?(d-(e||d/1.5))*w+(e||d/1.5)*l:w;b[c]=l;l>=e&&(a=a[d-(l+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=h);return l}function X(a,b){if(a)for(var c=Object.keys(a),h=0,l=c.length;h<l;h++){var w=c[h],e=a[w];if(e)for(var d=0,g=e.length;d<g;d++)if(e[d]===b){1===
|
||||
g?delete a[w]:e.splice(d,1);break}else M(e[d])&&X(e[d],b)}}function Y(a){for(var b="",c="",h="",l=0;l<a.length;l++){var e=a[l];if(e!==c)if(l&&"h"===e){if(h="a"===h||"e"===h||"i"===h||"o"===h||"u"===h||"y"===h,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&h||" "===c)b+=e}else b+=e;h=l===a.length-1?"":a[l+1];c=e}return b}function pa(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function qa(a,b){a=a[D];b=b[D];return a<b?-1:a>b?1:0}function ra(a,b){for(var c=D.length,h=0;h<c;h++)a=a[D[h]],b=
|
||||
b[D[h]];return a<b?-1:a>b?1:0}function G(a,b,c){return a?{page:a,next:b?""+b:null,result:c}:c}function ha(a,b,c,h,l,e,d){var w=[],g=a.length;if(!0===c){c="0";var f=""}else f=c&&c.split(":");if(1<g){var T=E(),t=[],k,n=-1,r,y=!0,v=0;if(f)if(2===f.length){var z=f;f=!1}else f=parseInt(f[0],10);if(d){for(k=E();++n<g;)if("not"===l[n]){var q=a[n];var A=q.length;for(r=0;r<A;)k["@"+q[r++]]=1}else var p=n+1;if(H(p))return G(c,D,w);n=-1}else var x=N(l)&&l;for(var u;++n<g;){var I=n===(p||g)-1;if(!x||!n)if((r=
|
||||
x||l&&l[n])&&"and"!==r)if("or"===r)u=!1;else continue;else u=e=!0;q=a[n];if(A=q.length){if(y)if(J){var F=J.length;for(r=0;r<F;){y=J[r++];var K="@"+y;d&&k[K]||(T[K]=1,e||(w[v++]=y))}var J=null;y=!1}else{J=q;continue}K=!1;for(r=0;r<A;){F=q[r++];var L="@"+F,C=e?T[L]:n;if(!(!C||d&&k[L]||!e&&T[L]))if(C===n){if(I){if(!f||--f<v)if(w[v++]=F,b&&v===b)return G(c,v,w)}else T[L]=n+1;K=!0}else h&&(L=t[C]||(t[C]=[]),L[L.length]=F)}if(u&&!K&&!h)break}else if(u&&!h)return G(c,D,q)}if(J)if(n=J.length,d)for(r=f?parseInt(f,
|
||||
10):0;r<n;){if(a=J[r++],!k["@"+a]&&(!f||--f<v)&&(w[v++]=a,b&&v===b))return G(c,r,w)}else w=J;if(h)for(v=w.length,z?(n=parseInt(z[0],10)+1,r=parseInt(z[1],10)):(n=t.length,r=0);n--;)if(F=t[n])for(A=F.length;r<A;r++)if(h=F[r],!d||!k["@"+h])if(w[v++]=h,b&&v===b)return G(c,n+":"+r,w)}else g&&(l&&"not"===l[0]||(w=a[0]));if(b){d=c?parseInt(c,10):0;var D=d+b;D<w.length?w=w.slice(d,D):d&&(w=w.slice(d))}return G(c,D,w)}function N(a){return"string"===typeof a}function I(a){return a.constructor===Array}function R(a){return"function"===
|
||||
typeof a}function M(a){return"object"===typeof a}function H(a){return"undefined"===typeof a}function ia(a){for(var b=Array(a),c=0;c<a;c++)b[c]=E();return b}function E(){return Object.create(null)}function ua(){var a,b;self.onmessage=function(c){if(c=c.data)if(c.search){var h=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:h})}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 va(a,b,c,h){a=d("flexsearch","id"+a,ua,function(a){(a=a.data)&&a.result&&h(a.id,a.content,a.result,a.limit,a.where,a.cursor,a.suggest)},b);var e=sa.toString();c.id=b;a.postMessage({register:e,options:c,id:b});
|
||||
return a}var u={encode:"icase",h:"forward",split:/\W+/,cache:!1,async:!1,i:!1,G:!1,a:!1,c:9,threshold:0,depth:0},ja={memory:{encode:"extra",h:"strict",threshold:0,c:1},speed:{encode:"icase",h:"strict",threshold:1,c:3,depth:2},match:{encode:"extra",h:"full",threshold:1,c:3},score:{encode:"extra",h:"strict",threshold:1,c:9,depth:4},balance:{encode:"balance",h:"strict",threshold:0,c:3,depth:3},fast:{encode:"icase",h:"strict",threshold:8,c:9,depth:1}},S=[],ta=0,ka={},la={};g.create=function(a){return new g(a)};
|
||||
g.registerMatcher=function(a){for(var b in a)a.hasOwnProperty(b)&&S.push(e(b),a[b]);return this};g.registerEncoder=function(a,b){O[a]=b.bind(O);return this};g.registerLanguage=function(a,b){ka[a]=b.filter;la[a]=b.stemmer;return this};g.encode=function(a,b){return O[a](b)};g.prototype.init=function(a,b){this.g=[];if(b){var c=b.preset;a=b}else a||(a=u),c=a.preset;b={};N(a)?((b=ja[a])||console.warn("Preset not found: "+a),a={}):c&&((b=ja[c])||console.warn("Preset not found: "+c));if(c=a.worker)if("undefined"===
|
||||
typeof Worker)a.worker=!1,this.b=null;else{var h=parseInt(c,10)||4;this.w=-1;this.D=0;this.A=[];this.H=null;this.b=Array(h);for(var l=0;l<h;l++)this.b[l]=va(this.id,l,a,k.bind(this))}this.h=a.tokenize||b.h||this.h||u.h;this.split=a.split||this.split||u.split;this.G=a.rtl||this.G||u.G;this.async="undefined"===typeof Promise||H(c=a.async)?this.async||u.async:c;this.i=H(c=a.worker)?this.i||u.i:c;this.threshold=H(c=a.threshold)?b.threshold||this.threshold||u.threshold:c;this.c=H(c=a.resolution)?c=b.c||
|
||||
this.c||u.c:c;c<=this.threshold&&(this.c=this.threshold+1);this.depth="strict"!==this.h||H(c=a.depth)?b.depth||this.depth||u.depth:c;this.j=(c=H(c=a.encode)?b.encode||u.encode:c)&&O[c]&&O[c].bind(O)||(R(c)?c:this.j||!1);(c=a.matcher)&&this.addMatcher(c);if(c=a.filter){N(c)&&(c=ka[c]);if(I(c)){b=this.j;h=E();for(l=0;l<c.length;l++){var d=b?b(c[l]):c[l];h[d]=1}c=h}this.filter=c}if(c=a.stemmer){b=N(c)?la[c]:c;h=this.j;l=[];for(var f in b)b.hasOwnProperty(f)&&(d=h?h(f):f,l.push(e(d+"($|\\W)"),h?h(b[f]):
|
||||
b[f]));this.stemmer=l}this.a=l=(c=a.doc)?c:this.a||u.a;this.u=ia(this.c-(this.threshold||0));this.s=E();this.f=E();if(l){this.m=E();a.doc=null;f=l.index={};b=l.keys=[];h=l.field;d=l.tag;I(l.id)||(l.id=l.id.split(":"));if(d){this.B=E();var U=E();if(h)if(N(h))U[h]=a;else if(I(h))for(var Z=0;Z<h.length;Z++)U[h[Z]]=a;else M(h)&&(U=h);I(d)||(l.tag=d=[d]);for(h=0;h<d.length;h++)this.B[d[h]]=E();this.I=d;h=U}if(h){if(!I(h))if(M(h)){var B=h;l.field=h=Object.keys(h)}else l.field=h=[h];for(l=0;l<h.length;l++)d=
|
||||
h[l],I(d)||(B&&(a=B[d]),b[l]=d,h[l]=d.split(":")),f[d]=new g(a),f[d].m=this.m}}this.o=!0;this.v=(this.cache=c=H(c=a.cache)?this.cache||u.cache:c)?new wa(c):!1;return this};g.prototype.encode=function(a){a&&S.length&&(a=x(a,S));a&&this.g.length&&(a=x(a,this.g));a&&this.j&&(a=this.j(a));a&&this.stemmer&&(a=x(a,this.stemmer));return a};g.prototype.addMatcher=function(a){var b=this.g,c;for(c in a)a.hasOwnProperty(c)&&b.push(e(c),a[c]);return this};g.prototype.add=function(a,b,c,h,d){if(this.a&&M(a))return this.l("add",
|
||||
a,b);if(b&&N(b)&&(a||0===a)){var e="@"+a;if(this.f[e]&&!h)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.f[e]=""+this.w,c&&c(),this;if(!d){if(this.async&&"function"!==typeof importScripts){var l=this;e=new Promise(function(c){setTimeout(function(){l.add(a,b,null,h,!0);l=null;c()})});if(c)e.then(c);else return e;return this}if(c)return this.add(a,b,null,h,!0),c(),this}b=this.encode(b);if(!b.length)return this;c=this.h;
|
||||
d=R(c)?c(b):b.split(this.split);this.filter&&(d=p(d,this.filter));var f=E();f._ctx=E();for(var g=d.length,k=this.threshold,aa=this.depth,t=this.c,V=this.u,n=this.G,r=0;r<g;r++){var y=d[r];if(y){var v=y.length,z=(n?r+1:g-r)/g,q="";switch(c){case "reverse":case "both":for(var A=v;--A;)q=y[A]+q,C(V,f,q,a,n?1:(v-A)/v,z,k,t-1);q="";case "forward":for(A=0;A<v;A++)q+=y[A],C(V,f,q,a,n?(A+1)/v:1,z,k,t-1);break;case "full":for(A=0;A<v;A++)for(var x=(n?A+1:v-A)/v,u=v;u>A;u--)q=y.substring(A,u),C(V,f,q,a,x,z,
|
||||
k,t-1);break;default:if(v=C(V,f,y,a,1,z,k,t-1),aa&&1<g&&v>=k)for(v=f._ctx[y]||(f._ctx[y]=E()),y=this.s[y]||(this.s[y]=ia(t-(k||0))),z=r-aa,q=r+aa+1,0>z&&(z=0),q>g&&(q=g);z<q;z++)z!==r&&C(y,v,d[z],a,0,t-(z<r?r-z:z-r),k,t-1)}}}this.f[e]=1;this.o=!1}return this};g.prototype.l=function(a,b,c){if(I(b))for(var h=0,d=b.length;h<d;h++){if(h===d-1)return this.l(a,b[h],c);this.l(a,b[h])}else{h=this.a.index;d=this.a.keys;for(var e=this.a.tag,f=this.a.id,g,k,B,p,t=0;t<f.length;t++)g=(g||b)[f[t]];if(e){for(f=
|
||||
0;f<e.length;f++){B=e[f];k=B.split(":");for(t=0;t<k.length;t++)p=(p||b)[k[t]];p="@"+p}k=this.B[B];k=k[p]||(k[p]=[])}if("remove"===a)for(delete this.m[g],f=0,e=d.length;f<e;f++){if(f===e-1)return h[d[f]].remove(g,c);h[d[f]].remove(g)}f=this.a.field;k&&(k[k.length]=b);this.m[g]=b;e=0;for(B=f.length;e<B;e++){k=f[e];p=void 0;for(t=0;t<k.length;t++)p=(p||b)[k[t]];k=h[d[e]];t="add"===a?k.add:k.update;if(e===B-1)return t.call(k,g,p,c);t.call(k,g,p)}}};g.prototype.update=function(a,b,c){if(this.a&&M(a))return this.l("update",
|
||||
a,b);this.f["@"+a]&&N(b)&&(this.remove(a),this.add(a,b,c,!0));return this};g.prototype.remove=function(a,b,c){if(this.a&&M(a))return this.l("remove",a,b);var d="@"+a;if(this.f[d]){if(this.i)return this.b[this.f[d]].postMessage({remove:!0,id:a}),delete this.f[d],b&&b(),this;if(!c){if(this.async&&"function"!==typeof importScripts){var e=this;d=new Promise(function(b){setTimeout(function(){e.remove(a,null,!0);e=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++)X(this.u[b],a);this.depth&&X(this.s,a);delete this.f[d];this.o=!1}return this};var D;g.prototype.search=function(a,b,c,d){if(M(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 h=[],f=a;if(M(a)&&!I(a)){(c=a.callback||R(b)&&b)&&(f.callback=null);var g=a.sort;var k=a.page;b=a.limit;var B=a.threshold;var u=a.suggest;a=a.query}if(this.a){B=this.a.index;var t=f.where,x=f.bool||"or",n=f.field,r=x,y,v;if(n)I(n)||(n=[n]);else if(I(f)){var z=
|
||||
f;n=[];r=[];for(var q=0;q<f.length;q++)d=f[q],e=d.bool||x,n[q]=d.field,r[q]=e,"not"===e?y=!0:"and"===e&&(v=!0)}else n=this.a.keys;x=n.length;for(q=0;q<x;q++)z&&(f=z[q]),k&&!N(f)&&(f.page=null,f.limit=0),h[q]=B[n[q]].search(f,0);if(c)return c(Q.call(this,a,r,h,g,b,u,t,k,v,y));if(this.async){var A=this;return new Promise(function(c){Promise.all(h).then(function(d){c(Q.call(A,a,r,d,g,b,u,t,k,v,y))})})}return Q.call(this,a,r,h,g,b,u,t,k,v,y)}B||(B=this.threshold||0);R(b)?(c=b,b=1E3):b||0===b||(b=1E3);
|
||||
if(this.i)for(this.H=c,this.D=0,this.A=[],n=0;n<this.i;n++)this.b[n].postMessage({search:!0,limit:b,cursor:k,threshold:B,content:a});else{if(!d){if(this.async&&"function"!==typeof importScripts){var D=this;B=new Promise(function(a){setTimeout(function(){a(D.search(f,b,null,!0));D=null})});if(c)B.then(c);else return B;return this}if(c)return c(this.search(f,b,null,!0)),this}if(!a||!N(a))return h;f=a;if(this.cache)if(this.o){if(c=this.v.get(a))return c}else this.v.clear(),this.o=!0;f=this.encode(f);
|
||||
if(!f.length)return h;c=this.h;c=R(c)?c(f):f.split(this.split);this.filter&&(c=p(c,this.filter));z=c.length;d=!0;e=[];var C=E();1<z&&(this.depth?(n=!0,q=c[0],C[q]=1):c.sort(pa));if(!n||(x=this.s)[q])for(var H=this.c,G=n?1:0;G<z;G++){var F=c[G];if(F){if(!C[F]){var K=[],J=!1,L=0;if(q=n?x[q]:this.u)for(var O=void 0,S=0;S<H-B;S++)if(O=q[S][F])K[L++]=O,J=!0;if(J)e[e.length]=1<L?K.concat.apply([],K):K[0];else if(!u){d=!1;break}C[F]=1}q=F}}else d=!1;d&&(h=ha(e,b,k,u));this.cache&&this.v.set(a,h);return h}};
|
||||
g.prototype.find=function(a,b){return this.where(a,b,1)[0]||null};g.prototype.where=function(a,b,c,d){var e=this.m,f=[],h=0,g;if(M(a)){c||(c=b);var k=Object.keys(a);var p=k.length;var x=!1;if(1===p&&"id"===k[0])return[e[a.id]];if((g=this.I)&&!d)for(var t=0;t<g.length;t++){var u=g[t],n=a[u];if(!H(n)){d=this.B[u]["@"+n];if(0===--p)return d;k.splice(k.indexOf(u),1);delete a[u];break}}g=Array(p);for(t=0;t<p;t++)g[t]=k[t].split(":")}else{if(R(a)){b=d||Object.keys(e);c=b.length;for(k=0;k<c;k++)p=e[b[k]],
|
||||
a(p)&&(f[h++]=p);return f}if(H(b))return[e[a]];if("id"===a)return[e[b]];k=[a];p=1;g=[a.split(":")];x=!0}d=d||Object.keys(e);t=d.length;for(u=0;u<t;u++){n=e[d[u]];for(var r=!0,y=0;y<p;y++){x||(b=a[k[y]]);var v=g[y],z=v.length,q=n;if(1<z)for(var A=0;A<z;A++)q=q[v[A]];else q=q[v[0]];if(q!==b){r=!1;break}}if(r&&(f[h++]=n,c&&h===c))break}return f};g.prototype.info=function(){if(this.i)for(var a=0;a<this.i;a++)this.b[a].postMessage({info:!0,id:this.id});else return{id:this.id,items:this.length,cache:this.cache&&
|
||||
this.cache.C?this.cache.C.length:!1,matcher:S.length+(this.g?this.g.length:0),worker:this.i,threshold:this.threshold,depth:this.depth,resolution:this.c,contextual:this.depth&&"strict"===this.h}};g.prototype.clear=function(){return this.destroy().init()};g.prototype.destroy=function(){this.cache&&(this.v.clear(),this.v=null);this.u=this.s=this.f=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};g.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.u,d.s,Object.keys(d.f)]}b[c]=this.m;return JSON.stringify(b)}return JSON.stringify([this.u,this.s,Object.keys(this.f)])};g.prototype.import=function(a){a=JSON.parse(a);var b=E();if(this.a){for(var c=this.a.keys,d=c.length,e=a[0][2],f=0;f<e.length;f++)b[e[f]]=1;for(e=0;e<d;e++)f=this.a.index[c[e]],f.u=a[e][0],f.s=a[e][1],f.f=b,f.m=a[d];this.m=a[d]}else{c=a[2];for(d=0;d<c.length;d++)b[c[d]]=1;this.u=a[0];this.s=a[1];
|
||||
this.f=b}};var O={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=x(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=x(b,a));c||1<b.length&&(b=Y(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]+x(d.substring(1),a))}b=b.join(" ");b=Y(b)}return b}}(),balance:function(){var a=[e("[-/]")," ",e("[^a-z0-9 ]"),"",e("\\s+")," "];return function(b){return Y(x(b.toLowerCase(),a))}}()},wa=function(){function a(a){this.clear();this.J=!0!==a&&a}a.prototype.clear=function(){this.cache=E();this.count=E();this.index=E();this.C=[]};a.prototype.set=function(a,c){if(this.J&&H(this.cache[a])){var b=this.C.length;
|
||||
if(b===this.J){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.J&&b){var d=++this.count[a],e=this.index,f=e[a];if(0<f){for(var g=this.C,k=f;this.count[g[--f]]<=d&&-1!==f;);f++;if(f!==k){for(d=k;d>f;d--)k=g[d-1],g[d]=k,e[k]=d;g[f]=a;e[a]=f}}}return b};return a}();return g}(function(){var d={},m="undefined"!==typeof Blob&&
|
||||
"undefined"!==typeof URL&&URL.createObjectURL;return function(g,k,p,Q,f){p=m?URL.createObjectURL(new Blob(["("+p.toString()+")()"],{type:"text/javascript"})):g+".es5.js";g+="-"+k;d[g]||(d[g]=[]);d[g][f]=new Worker(p);d[g][f].onmessage=Q;console.log("Register Worker: "+g+"@"+f);return d[g][f]}}()),this);
|
||||
|
24
dist/flexsearch.light.js
vendored
24
dist/flexsearch.light.js
vendored
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
FlexSearch v0.6.0
|
||||
FlexSearch v0.6.1
|
||||
Copyright 2019 Nextapps GmbH
|
||||
Author: Thomas Wilkerling
|
||||
Released under the Apache 2.0 Licence
|
||||
https://github.com/nextapps-de/flexsearch
|
||||
*/
|
||||
'use strict';(function(e,z,t){let k;(k=t.define)&&k.amd?k([],function(){return z}):(k=t.modules)?k[e.toLowerCase()]=z:"object"===typeof exports?module.exports=z:t[e]=z})("FlexSearch",function(){function e(a,c){const b=c?c.id:a&&a.id;this.id=b||0===b?b:L++;this.init(a,c);t(this,"index",function(){return Object.keys(this.b)});t(this,"length",function(){return this.index.length})}function z(a,c){const b=a.length,f=A(c),d=[];for(let l=0,g=0;l<b;l++){const b=a[l];if(f&&c(b)||!f&&!c[b])d[g++]=b}return d}
|
||||
'use strict';(function(e,z,t){let k;(k=t.define)&&k.amd?k([],function(){return z}):(k=t.modules)?k[e.toLowerCase()]=z:"object"===typeof exports?module.exports=z:t[e]=z})("FlexSearch",function(){function e(a,c){const b=c?c.id:a&&a.id;this.id=b||0===b?b:K++;this.init(a,c);t(this,"index",function(){return Object.keys(this.b)});t(this,"length",function(){return this.index.length})}function z(a,c){const b=a.length,f=A(c),d=[];for(let l=0,g=0;l<b;l++){const b=a[l];if(f&&c(b)||!f&&!c[b])d[g++]=b}return d}
|
||||
function t(a,c,b){Object.defineProperty(a,c,{get:b})}function k(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,f,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]=f);return d}function E(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]&&E(g[b],
|
||||
c)}}}function M(a,c){a=a.length-c.length;return 0>a?1:a?-1:0}function F(a,c,b){return a?{page:a,next:c?""+c:null,result:b}:b}function C(a){return"string"===typeof a}function A(a){return"function"===typeof a}function D(a){return"undefined"===typeof a}function H(a){const c=Array(a);for(let b=0;b<a;b++)c[b]=y();return c}function y(){return Object.create(null)}const v={encode:"icase",c:"forward",cache:!1,async:!1,m:!1,i:!1,l:!1,a:9,threshold:0,depth:0},G=[];let L=0;const I=/\W+/,J={},K={};e.create=function(a){return new e(a)};
|
||||
e.registerMatcher=function(a){for(const c in a)a.hasOwnProperty(c)&&G.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){J[a]=c.filter;K[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=v),b=a.preset;c={};this.c=a.tokenize||c.c||this.c||v.c;this.i=a.rtl||this.i||v.i;this.threshold=D(b=a.threshold)?c.threshold||this.threshold||
|
||||
v.threshold:b;this.a=D(b=a.resolution)?b=c.a||this.a||v.a:b;b<=this.threshold&&(this.a=this.threshold+1);this.depth="strict"!==this.c||D(b=a.depth)?c.depth||this.depth||v.depth:b;this.g=(b=D(b=a.encode)?c.encode||v.encode:b)&&w[b]&&w[b].bind(w)||(A(b)?b:this.g||!1);(b=a.matcher)&&this.addMatcher(b);if(b=a.filter){C(b)&&(b=J[b]);if(b.constructor===Array){c=this.g;var f=y();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=C(b)?K[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=H(this.a-(this.threshold||0));this.f=y();this.b=y();return this};e.prototype.encode=function(a){a&&G.length&&(a=k(a,G));a&&this.j.length&&(a=k(a,this.j));a&&this.g&&(a=this.g(a));a&&this.stemmer&&(a=k(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&&C(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=A(b)?b(c):c.split(I);this.filter&&(c=z(c,this.filter));f=y();f._ctx=y();d=c.length;const q=this.threshold,k=this.depth,p=this.a,r=this.h,u=this.i;for(let e=0;e<d;e++){var l=c[e];if(l){var g=l.length,h=(u?e+1:d-e)/d,n="";switch(b){case "reverse":case "both":for(var m=g;--m;)n=l[m]+n,B(r,f,n,a,u?1:(g-m)/g,h,q,p-
|
||||
1);n="";case "forward":for(m=0;m<g;m++)n+=l[m],B(r,f,n,a,u?(m+1)/g:1,h,q,p-1);break;case "full":for(m=0;m<g;m++){const b=(u?m+1:g-m)/g;for(let c=g;c>m;c--)n=l.substring(m,c),B(r,f,n,a,b,h,q,p-1)}break;default:if(g=B(r,f,l,a,1,h,q,p-1),k&&1<d&&g>=q)for(g=f._ctx[l]||(f._ctx[l]=y()),l=this.f[l]||(this.f[l]=H(p-(q||0))),h=e-k,n=e+k+1,0>h&&(h=0),n>d&&(n=d);h<n;h++)h!==e&&B(l,g,c[h],a,0,p-(h<e?e-h:h-e),q,p-1)}}}this.b[e]=1}return this};e.prototype.update=function(a,c,b){this.b["@"+a]&&C(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++)E(this.h[c],a);this.depth&&E(this.f,a);delete this.b[f]}return this};e.prototype.search=function(a,c,b,f){var d=[],e=a;if("object"===typeof a){var g=!1;c=a.limit;var h=a.threshold;a=a.query}h||(h=this.threshold||0);A(c)?(b=c,c=1E3):c||0===c||(c=1E3);if(!f&&b)return b(this.search(e,c,null,!0)),this;if(!a||!C(a))return d;
|
||||
e=this.encode(a);if(!e.length)return d;a=this.c;a=A(a)?a(e):e.split(I);this.filter&&(a=z(a,this.filter));b=a.length;f=!0;e=[];var n=y();if(1<b)if(this.depth){var m=!0;var k=a[0];n[k]=1}else a.sort(M);var q;if(!m||(q=this.f)[k]){var v=this.a;for(var p=m?1:0;p<b;p++){var r=a[p];if(r){if(!n[r]){var u=[],t=!1,w=0;if(k=m?q[k]:this.h){let a;for(let b=0;b<v-h;b++)if(a=k[b][r])u[w++]=a,t=!0}if(t)e[e.length]=1<w?u.concat.apply([],u):u[0];else{f=!1;break}n[r]=1}k=r}}}else f=!1;if(f)a:{let l;d=[];m=e.length;
|
||||
!0===g?(g="0",h=""):h=g&&g.split(":");if(1<m){q=y();a=-1;r=!0;n=0;for(h&&(2===h.length?h=!1:h=parseInt(h[0],10));++a<m;){v=a===m-1;k=e[a];f=k.length;if(!f){d=F(g,l,k);break a}if(r)if(x){p=x.length;for(b=0;b<p;)q["@"+x[b++]]=1;var x=null;r=!1}else{x=k;continue}u=!1;for(b=0;b<f;)if(p=k[b++],t="@"+p,(w=q[t])&&w===a){if(v){if(!h||--h<n)if(d[n++]=p,c&&n===c){d=F(g,n,d);break a}}else q[t]=a+1;u=!0}if(!u)break}x&&(d=x)}else m&&(d=e[0]);c&&(x=g?parseInt(g,10):0,l=x+c,l<d.length?d=d.slice(x,l):x&&(d=d.slice(x)));
|
||||
d=F(g,l,d)}return d};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);
|
||||
c)}}}function L(a,c){a=a.length-c.length;return 0>a?1:a?-1:0}function F(a,c,b){return a?{page:a,next:c?""+c:null,result:b}:b}function C(a){return"string"===typeof a}function A(a){return"function"===typeof a}function D(a){return"undefined"===typeof a}function H(a){const c=Array(a);for(let b=0;b<a;b++)c[b]=y();return c}function y(){return Object.create(null)}const u={encode:"icase",c:"forward",split:/\W+/,cache:!1,async:!1,m:!1,i:!1,l:!1,a:9,threshold:0,depth:0},G=[];let K=0;const I={},J={};e.create=
|
||||
function(a){return new e(a)};e.registerMatcher=function(a){for(const c in a)a.hasOwnProperty(c)&&G.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){I[a]=c.filter;J[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=u),b=a.preset;c={};this.c=a.tokenize||c.c||this.c||u.c;this.split=a.split||this.split||u.split;this.i=a.rtl||
|
||||
this.i||u.i;this.threshold=D(b=a.threshold)?c.threshold||this.threshold||u.threshold:b;this.a=D(b=a.resolution)?b=c.a||this.a||u.a:b;b<=this.threshold&&(this.a=this.threshold+1);this.depth="strict"!==this.c||D(b=a.depth)?c.depth||this.depth||u.depth:b;this.g=(b=D(b=a.encode)?c.encode||u.encode:b)&&w[b]&&w[b].bind(w)||(A(b)?b:this.g||!1);(b=a.matcher)&&this.addMatcher(b);if(b=a.filter){C(b)&&(b=I[b]);if(b.constructor===Array){c=this.g;var f=y();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=C(b)?J[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=H(this.a-(this.threshold||0));this.f=y();this.b=y();return this};e.prototype.encode=function(a){a&&G.length&&(a=k(a,G));a&&this.j.length&&(a=k(a,this.j));a&&this.g&&(a=this.g(a));a&&this.stemmer&&(a=k(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&&C(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=A(b)?b(c):c.split(this.split);this.filter&&(c=z(c,this.filter));f=y();f._ctx=y();d=c.length;const r=this.threshold,k=this.depth,p=this.a,q=this.h,v=this.i;for(let e=0;e<d;e++){var l=c[e];if(l){var g=l.length,h=(v?e+1:d-e)/d,n="";switch(b){case "reverse":case "both":for(var m=
|
||||
g;--m;)n=l[m]+n,B(q,f,n,a,v?1:(g-m)/g,h,r,p-1);n="";case "forward":for(m=0;m<g;m++)n+=l[m],B(q,f,n,a,v?(m+1)/g:1,h,r,p-1);break;case "full":for(m=0;m<g;m++){const b=(v?m+1:g-m)/g;for(let c=g;c>m;c--)n=l.substring(m,c),B(q,f,n,a,b,h,r,p-1)}break;default:if(g=B(q,f,l,a,1,h,r,p-1),k&&1<d&&g>=r)for(g=f._ctx[l]||(f._ctx[l]=y()),l=this.f[l]||(this.f[l]=H(p-(r||0))),h=e-k,n=e+k+1,0>h&&(h=0),n>d&&(n=d);h<n;h++)h!==e&&B(l,g,c[h],a,0,p-(h<e?e-h:h-e),r,p-1)}}}this.b[e]=1}return this};e.prototype.update=function(a,
|
||||
c,b){this.b["@"+a]&&C(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++)E(this.h[c],a);this.depth&&E(this.f,a);delete this.b[f]}return this};e.prototype.search=function(a,c,b,f){var d=[],e=a;if("object"===typeof a){var g=!1;c=a.limit;var h=a.threshold;a=a.query}h||(h=this.threshold||0);A(c)?(b=c,c=1E3):c||0===c||(c=1E3);if(!f&&b)return b(this.search(e,
|
||||
c,null,!0)),this;if(!a||!C(a))return d;e=this.encode(a);if(!e.length)return d;a=this.c;a=A(a)?a(e):e.split(this.split);this.filter&&(a=z(a,this.filter));b=a.length;f=!0;e=[];var n=y();if(1<b)if(this.depth){var m=!0;var k=a[0];n[k]=1}else a.sort(L);var r;if(!m||(r=this.f)[k]){var u=this.a;for(var p=m?1:0;p<b;p++){var q=a[p];if(q){if(!n[q]){var v=[],t=!1,w=0;if(k=m?r[k]:this.h){let a;for(let b=0;b<u-h;b++)if(a=k[b][q])v[w++]=a,t=!0}if(t)e[e.length]=1<w?v.concat.apply([],v):v[0];else{f=!1;break}n[q]=
|
||||
1}k=q}}}else f=!1;if(f)a:{let l;d=[];m=e.length;!0===g?(g="0",h=""):h=g&&g.split(":");if(1<m){r=y();a=-1;q=!0;n=0;for(h&&(2===h.length?h=!1:h=parseInt(h[0],10));++a<m;){u=a===m-1;k=e[a];f=k.length;if(!f){d=F(g,l,k);break a}if(q)if(x){p=x.length;for(b=0;b<p;)q=x[b++],r["@"+q]=1;var x=null;q=!1}else{x=k;continue}v=!1;for(b=0;b<f;)if(p=k[b++],t="@"+p,(w=r[t])&&w===a){if(u){if(!h||--h<n)if(d[n++]=p,c&&n===c){d=F(g,n,d);break a}}else r[t]=a+1;v=!0}if(!v)break}x&&(d=x)}else m&&(d=e[0]);c&&(x=g?parseInt(g,
|
||||
10):0,l=x+c,l<d.length?d=d.slice(x,l):x&&(d=d.slice(x)));d=F(g,l,d)}return d};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);
|
||||
|
68
dist/flexsearch.min.js
vendored
68
dist/flexsearch.min.js
vendored
@@ -1,40 +1,40 @@
|
||||
/*
|
||||
FlexSearch v0.6.0
|
||||
FlexSearch v0.6.1
|
||||
Copyright 2019 Nextapps GmbH
|
||||
Author: Thomas Wilkerling
|
||||
Released under the Apache 2.0 Licence
|
||||
https://github.com/nextapps-de/flexsearch
|
||||
*/
|
||||
'use strict';(function(t,M,l){let E;(E=l.define)&&E.amd?E([],function(){return M}):(E=l.modules)?E[t.toLowerCase()]=M:"object"===typeof exports?module.exports=M:l[t]=M})("FlexSearch",function ca(t){function l(a,b){const c=b?b.id:a&&a.id;this.id=c||0===c?c:da++;this.init(a,b);N(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].c):Object.keys(this.c)});N(this,"length",function(){return this.index.length})}function E(a,b,c,d){this.u!==this.g&&(this.o=this.o.concat(c),this.u++,
|
||||
d&&this.o.length>=d&&(this.u=this.g),this.u===this.g&&(this.cache&&this.l.set(b,this.o),this.F&&this.F(this.o)));return this}function O(a,b){const c=a.length,d=J(b),e=[];for(let f=0,g=0;f<c;f++){const c=a[f];if(d&&b(c)||!d&&!b[c])e[g++]=c}return e}function Q(a,b,c,d,e,f,g,m,n,r){c=V(c,g?0:e,m,f,b,n,r);let k;m&&(m=c.page,k=c.next,c=c.result);if(g)b=this.where(g,null,e,c);else{b=c;c=this.h;e=b.length;f=Array(e);for(g=0;g<e;g++)f[g]=c[b[g]];b=f}c=b;d&&(J(d)||(F=d.split(":"),1<F.length?d=ea:(F=F[0],d=
|
||||
fa)),c.sort(d));c=K(m,k,c);this.cache&&this.l.set(a,c);return c}function N(a,b,c){Object.defineProperty(a,b,{get:c})}function h(a){return new RegExp(a,"g")}function L(a,b){for(let c=0;c<b.length;c+=2)a=a.replace(b[c],b[c+1]);return a}function R(a,b,c,d,e,f,g,m){if(b[c])return b[c];e=e?(m-(g||m/1.5))*f+(g||m/1.5)*e:f;b[c]=e;e>=g&&(a=a[m-(e+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=d);return e}function T(a,b){if(a){const c=Object.keys(a);for(let d=0,e=c.length;d<e;d++){const e=c[d],g=a[e];if(g)for(let c=
|
||||
0,d=g.length;c<d;c++)if(g[c]===b){1===d?delete a[e]:g.splice(c,1);break}else G(g[c])&&T(g[c],b)}}}function U(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 ha(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function fa(a,b){a=a[F];b=b[F];return a<b?-1:a>b?1:0}function ea(a,
|
||||
b){const c=F.length;for(let d=0;d<c;d++)a=a[F[d]],b=b[F[d]];return a<b?-1:a>b?1:0}function K(a,b,c){return a?{page:a,next:b?""+b:null,result:c}:c}function V(a,b,c,d,e,f,g){let m;f=[];let n;const r=a.length;!0===c?(c="0",n=""):n=c&&c.split(":");if(1<r){const l=q();let u=[],B,z,v=-1;var k;let A;let W=!0,H,C=0,w,x,t;n&&(2===n.length?(t=n,n=!1):n=parseInt(n[0],10));if(g){for(B=q();++v<r;)if("not"===e[v])for(z=a[v],A=z.length,k=0;k<A;)B["@"+z[k++]]=1;else x=v+1;if(!x)return K(c,m,f);v=-1}else w=I(e)&&
|
||||
e;for(;++v<r;){const ia=v===(x||r)-1;let q,y;if(!w||!v)if((k=w||e&&e[v])&&"and"!==k)if("or"===k)y=!0;else continue;else q=!0;z=a[v];A=z.length;if(!A){if(q&&!d)return K(c,m,z);continue}if(W)if(H){var h=H.length;for(k=0;k<h;)l["@"+H[k++]]=1;H=null;W=!1}else{H=z;continue}let t=!1;for(k=0;k<A;){h=z[k++];var p="@"+h;const a=y?v:l[p];if(a&&(!g||!B[p]))if(a===v){if(ia){if(!n||--n<C)if(f[C++]=h,b&&C===b)return K(c,C,f)}else l[p]=v+1;t=!0}else d&&(p=u[a]||(u[a]=[]),p[p.length]=h)}if(q&&!t&&!d)break}if(H)if(a=
|
||||
H.length,g)for(k=n?parseInt(n,10):0;k<a;){if(e=H[k++],!B["@"+e]&&(!n||--n<C)&&(f[C++]=e,b&&C===b))return K(c,k,f)}else f=H;if(d)for(C=f.length,t?(v=parseInt(t[0],10)+1,k=parseInt(t[1],10)):(v=u.length,k=0);v--;)if(h=u[v])for(A=h.length;k<A;k++)if(d=h[k],!g||!B["@"+d])if(f[C++]=d,b&&C===b)return K(c,v+":"+k,f)}else r&&(e&&"not"===e[0]||(f=a[0]));b&&(g=c?parseInt(c,10):0,m=g+b,m<f.length?f=f.slice(g,m):g&&(f=f.slice(g)));return K(c,m,f)}function I(a){return"string"===typeof a}function w(a){return a.constructor===
|
||||
Array}function J(a){return"function"===typeof a}function G(a){return"object"===typeof a}function D(a){return"undefined"===typeof a}function X(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=q();return b}function q(){return Object.create(null)}function ja(){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 ka(a,b,c,d){a=t("flexsearch","id"+a,ja,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=ca.toString();c.id=
|
||||
b;a.postMessage({register:e,options:c,id:b});return a}const x={encode:"icase",f:"forward",cache:!1,async:!1,g:!1,D:!1,a:!1,b:9,threshold:0,depth:0},Y={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}},S=[];let da=0;const Z=
|
||||
/\W+/,aa={},ba={};l.create=function(a){return new l(a)};l.registerMatcher=function(a){for(const b in a)a.hasOwnProperty(b)&&S.push(h(b),a[b]);return this};l.registerEncoder=function(a,b){P[a]=b.bind(P);return this};l.registerLanguage=function(a,b){aa[a]=b.filter;ba[a]=b.stemmer;return this};l.encode=function(a,b){return P[a](b)};l.prototype.init=function(a,b){this.v=[];if(b){var c=b.preset;a=b}else a||(a=x),c=a.preset;b={};I(a)?(b=Y[a],a={}):c&&(b=Y[c]);if(c=a.worker)if("undefined"===typeof Worker)a.worker=
|
||||
!1,this.m=null;else{var d=parseInt(c,10)||4;this.C=-1;this.u=0;this.o=[];this.F=null;this.m=Array(d);for(var e=0;e<d;e++)this.m[e]=ka(this.id,e,a,E.bind(this))}this.f=a.tokenize||b.f||this.f||x.f;this.D=a.rtl||this.D||x.D;this.async="undefined"===typeof Promise||D(c=a.async)?this.async||x.async:c;this.g=D(c=a.worker)?this.g||x.g:c;this.threshold=D(c=a.threshold)?b.threshold||this.threshold||x.threshold:c;this.b=D(c=a.resolution)?c=b.b||this.b||x.b:c;c<=this.threshold&&(this.b=this.threshold+1);this.depth=
|
||||
"strict"!==this.f||D(c=a.depth)?b.depth||this.depth||x.depth:c;this.w=(c=D(c=a.encode)?b.encode||x.encode:c)&&P[c]&&P[c].bind(P)||(J(c)?c:this.w||!1);(c=a.matcher)&&this.addMatcher(c);if(c=a.filter){I(c)&&(c=aa[c]);if(w(c)){b=this.w;d=q();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 g;b=I(c)?ba[c]:c;d=this.w;e=[];for(g in b)b.hasOwnProperty(g)&&(f=d?d(g):g,e.push(h(f+"($|\\W)"),d?d(b[g]):b[g]));this.stemmer=g=e}this.a=e=(c=a.doc)?c:this.a||x.a;this.j=X(this.b-
|
||||
(this.threshold||0));this.i=q();this.c=q();if(e){this.h=q();a.doc=null;g=e.index={};b=e.keys=[];d=e.field;f=e.tag;w(e.id)||(e.id=e.id.split(":"));if(f){this.G=q();let b=q();if(d)if(I(d))b[d]=a;else if(w(d))for(let c=0;c<d.length;c++)b[d[c]]=a;else G(d)&&(b=d);w(f)||(e.tag=f=[f]);for(d=0;d<f.length;d++)this.G[f[d]]=q();this.I=f;d=b}if(d){let c;w(d)||(G(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(":")),g[f]=new l(a),g[f].h=this.h}}this.B=
|
||||
!0;this.l=(this.cache=c=D(c=a.cache)?this.cache||x.cache:c)?new la(c):!1;return this};l.prototype.encode=function(a){a&&S.length&&(a=L(a,S));a&&this.v.length&&(a=L(a,this.v));a&&this.w&&(a=this.w(a));a&&this.stemmer&&(a=L(a,this.stemmer));return a};l.prototype.addMatcher=function(a){const b=this.v;for(const c in a)a.hasOwnProperty(c)&&b.push(h(c),a[c]);return this};l.prototype.add=function(a,b,c,d,e){if(this.a&&G(a))return this.A("add",a,b);if(b&&I(b)&&(a||0===a)){var f="@"+a;if(this.c[f]&&!d)return this.update(a,
|
||||
b);if(this.g)return++this.C>=this.m.length&&(this.C=0),this.m[this.C].postMessage({add:!0,id:a,content:b}),this.c[f]=""+this.C,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=J(c)?c(b):b.split(Z);this.filter&&(e=O(e,this.filter));const l=q();l._ctx=
|
||||
q();const p=e.length,r=this.threshold,u=this.depth,y=this.b,z=this.j,v=this.D;for(let b=0;b<p;b++){var g=e[b];if(g){var m=g.length,n=(v?b+1:p-b)/p,h="";switch(c){case "reverse":case "both":for(var k=m;--k;)h=g[k]+h,R(z,l,h,a,v?1:(m-k)/m,n,r,y-1);h="";case "forward":for(k=0;k<m;k++)h+=g[k],R(z,l,h,a,v?(k+1)/m:1,n,r,y-1);break;case "full":for(k=0;k<m;k++){const b=(v?k+1:m-k)/m;for(let c=m;c>k;c--)h=g.substring(k,c),R(z,l,h,a,b,n,r,y-1)}break;default:if(m=R(z,l,g,a,1,n,r,y-1),u&&1<p&&m>=r)for(m=l._ctx[g]||
|
||||
(l._ctx[g]=q()),g=this.i[g]||(this.i[g]=X(y-(r||0))),n=b-u,h=b+u+1,0>n&&(n=0),h>p&&(h=p);n<h;n++)n!==b&&R(g,m,e[n],a,0,y-(n<b?b-n:n-b),r,y-1)}}}this.c[f]=1;this.B=!1}return this};l.prototype.A=function(a,b,c){if(w(b))for(let d=0,e=b.length;d<e;d++){if(d===e-1)return this.A(a,b[d],c);this.A(a,b[d])}else{const n=this.a.index,l=this.a.keys;var d=this.a.tag,e=this.a.id;let k;let m;for(var f=0;f<e.length;f++)k=(k||b)[e[f]];if(d){for(e=0;e<d.length;e++){var g=d[e];var h=g.split(":");for(f=0;f<h.length;f++)m=
|
||||
(m||b)[h[f]];m="@"+m}h=this.G[g];h=h[m]||(h[m]=[])}if("remove"===a){delete this.h[k];for(let a=0,b=l.length;a<b;a++){if(a===b-1)return n[l[a]].remove(k,c);n[l[a]].remove(k)}}e=this.a.field;h&&(h[h.length]=b);for(let f=0,h=e.length;f<h;f++){d=e[f];let m;for(g=0;g<d.length;g++)m=(m||b)[d[g]];this.h[k]=b;d=n[l[f]];g="add"===a?d.add:d.update;if(f===h-1)return g.call(d,k,m,c);g.call(d,k,m)}}};l.prototype.update=function(a,b,c){if(this.a&&G(a))return this.A("update",a,b);this.c["@"+a]&&I(b)&&(this.remove(a),
|
||||
this.add(a,b,c,!0));return this};l.prototype.remove=function(a,b,c){if(this.a&&G(a))return this.A("remove",a,b);var d="@"+a;if(this.c[d]){if(this.g)return this.m[this.c[d]].postMessage({remove:!0,id:a}),delete this.c[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.b-(this.threshold||
|
||||
0);b++)T(this.j[b],a);this.depth&&T(this.i,a);delete this.c[d];this.B=!1}return this};let F;l.prototype.search=function(a,b,c,d){if(G(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=[],g=a;let h,l,r;if(G(a)&&!w(a)){(c=a.callback||J(b)&&b)&&(g.callback=null);l=a.sort;h=a.page;b=a.limit;var k=a.threshold;r=a.suggest;a=a.query}if(this.a){k=this.a.index;const m=g.where;var B=g.bool||"or",p=g.field;let n=B;let A,q;if(p)w(p)||(p=[p]);else if(w(g)){var t=g;p=[];n=[];for(var u=
|
||||
0;u<g.length;u++)d=g[u],e=d.bool||B,p[u]=d.field,n[u]=e,"not"===e?A=!0:"and"===e&&(q=!0)}else p=this.a.keys;B=p.length;for(u=0;u<B;u++)t&&(g=t[u]),h&&!I(g)&&(g.page=null,g.limit=0),f[u]=k[p[u]].search(g,0);if(c)return c(Q.call(this,a,n,f,l,b,r,m,h,q,A));if(this.async){const c=this;return new Promise(function(d){Promise.all(f).then(function(e){d(Q.call(c,a,n,e,l,b,r,m,h,q,A))})})}return Q.call(this,a,n,f,l,b,r,m,h,q,A)}k||(k=this.threshold||0);J(b)?(c=b,b=1E3):b||0===b||(b=1E3);if(this.g)for(this.F=
|
||||
c,this.u=0,this.o=[],p=0;p<this.g;p++)this.m[p].postMessage({search:!0,limit:b,cursor:h,threshold:k,content:a});else{if(!d){if(this.async&&"function"!==typeof importScripts){let a=this;k=new Promise(function(c){setTimeout(function(){c(a.search(g,b,null,!0));a=null})});if(c)k.then(c);else return k;return this}if(c)return c(this.search(g,b,null,!0)),this}if(!a||!I(a))return f;g=a;if(this.cache)if(this.B){if(c=this.l.get(a))return c}else this.l.clear(),this.B=!0;g=this.encode(g);if(!g.length)return f;
|
||||
c=this.f;c=J(c)?c(g):g.split(Z);this.filter&&(c=O(c,this.filter));t=c.length;d=!0;e=[];var y=q();1<t&&(this.depth?(p=!0,u=c[0],y[u]=1):c.sort(ha));if(!p||(B=this.i)[u]){const a=this.b;for(let b=p?1:0;b<t;b++){const f=c[b];if(f){if(!y[f]){const b=[];let c=!1,g=0;if(u=p?B[u]:this.j){let d;for(let e=0;e<a-k;e++)if(d=u[e][f])b[g++]=d,c=!0}if(c)e[e.length]=1<g?b.concat.apply([],b):b[0];else if(!r){d=!1;break}y[f]=1}u=f}}}else d=!1;d&&(f=V(e,b,h,r));this.cache&&this.l.set(a,f);return f}};l.prototype.find=
|
||||
function(a,b){return this.where(a,b,1)[0]||null};l.prototype.where=function(a,b,c,d){const e=this.h,f=[];let g=0;let h;var l;if(G(a)){c||(c=b);var r=Object.keys(a);var k=r.length;h=!1;if(1===k&&"id"===r[0])return[e[a.id]];if((l=this.I)&&!d)for(var q=0;q<l.length;q++){var p=l[q],t=a[p];if(!D(t)){d=this.G[p]["@"+t];if(0===--k)return d;r.splice(r.indexOf(p),1);delete a[p];break}}l=Array(k);for(q=0;q<k;q++)l[q]=r[q].split(":")}else{if(J(a)){b=d||Object.keys(e);c=b.length;for(r=0;r<c;r++)k=e[b[r]],a(k)&&
|
||||
(f[g++]=k);return f}if(D(b))return[e[a]];if("id"===a)return[e[b]];r=[a];k=1;l=[a.split(":")];h=!0}d=d||Object.keys(e);q=d.length;for(p=0;p<q;p++){t=e[d[p]];let m=!0;for(let c=0;c<k;c++){h||(b=a[r[c]]);const d=l[c],e=d.length;let f=t;if(1<e)for(let b=0;b<e;b++)f=f[d[b]];else f=f[d[0]];if(f!==b){m=!1;break}}if(m&&(f[g++]=t,c&&g===c))break}return f};l.prototype.info=function(){if(this.g)for(let a=0;a<this.g;a++)this.m[a].postMessage({info:!0,id:this.id});else return{id:this.id,items:this.length,cache:this.cache&&
|
||||
this.cache.s?this.cache.s.length:!1,matcher:S.length+(this.v?this.v.length:0),worker:this.g,threshold:this.threshold,depth:this.depth,resolution:this.b,contextual:this.depth&&"strict"===this.f}};l.prototype.clear=function(){return this.destroy().init()};l.prototype.destroy=function(){this.cache&&(this.l.clear(),this.l=null);this.j=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.h=null}return this};l.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.j,d.i,Object.keys(d.c)]}b[c]=this.h;return JSON.stringify(b)}return JSON.stringify([this.j,this.i,Object.keys(this.c)])};l.prototype.import=function(a){a=JSON.parse(a);const b=q();if(this.a){var c=this.a.keys,d=c.length,e=a[0][2];for(var f=0;f<e.length;f++)b[e[f]]=1;for(e=0;e<d;e++)f=this.a.index[c[e]],f.j=a[e][0],f.i=a[e][1],f.c=b,f.h=a[d];this.h=a[d]}else{c=a[2];for(d=0;d<c.length;d++)b[c[d]]=1;this.j=
|
||||
a[0];this.i=a[1];this.c=b}};const P={icase:function(a){return a.toLowerCase()},simple:function(){const a=[h("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",h("[\u00e8\u00e9\u00ea\u00eb]"),"e",h("[\u00ec\u00ed\u00ee\u00ef]"),"i",h("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",h("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",h("[\u00fd\u0177\u00ff]"),"y",h("\u00f1"),"n",h("\u00e7"),"c",h("\u00df"),"s",h(" & ")," and ",h("[-/]")," ",h("[^a-z0-9 ]"),"",h("\\s+")," "];return function(b){b=L(b.toLowerCase(),a);
|
||||
return" "===b?"":b}}(),advanced:function(){const a=[h("ae"),"a",h("ai"),"ei",h("ay"),"ei",h("ey"),"ei",h("oe"),"o",h("ue"),"u",h("ie"),"i",h("sz"),"s",h("zs"),"s",h("sh"),"s",h("ck"),"k",h("cc"),"k",h("dt"),"t",h("ph"),"f",h("pf"),"f",h("ou"),"o",h("uo"),"u"];return function(b,c){if(!b)return b;b=this.simple(b);2<b.length&&(b=L(b,a));c||1<b.length&&(b=U(b));return b}}(),extra:function(){const a=[h("p"),"b",h("z"),"s",h("[cgq]"),"k",h("n"),"m",h("d"),"t",h("[vw]"),"f",h("[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]+L(d.substring(1),a))}b=b.join(" ");b=U(b)}return b}}(),balance:function(){const a=[h("[-/]")," ",h("[^a-z0-9 ]"),"",h("\\s+")," "];return function(b){return U(L(b.toLowerCase(),a))}}()},la=function(){function a(b){this.clear();this.H=!0!==b&&b}a.prototype.clear=function(){this.cache=q();this.count=q();this.index=q();this.s=[]};a.prototype.set=function(b,a){if(this.H&&D(this.cache[b])){let c=
|
||||
this.s.length;if(c===this.H){c--;const b=this.s[c];delete this.cache[b];delete this.count[b];delete this.index[b]}this.index[b]=c;this.s[c]=b;this.count[b]=-1;this.cache[b]=a;this.get(b)}else this.cache[b]=a};a.prototype.get=function(b){const a=this.cache[b];if(this.H&&a){var d=++this.count[b];const a=this.index;let c=a[b];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,a[e]=d;f[c]=b;a[b]=c}}}return a};return a}();return l}(function(){const t=
|
||||
{},M="undefined"!==typeof Blob&&"undefined"!==typeof URL&&URL.createObjectURL;return function(l,E,O,Q,N){O=M?URL.createObjectURL(new Blob(["("+O.toString()+")()"],{type:"text/javascript"})):l+".min.js";l+="-"+E;t[l]||(t[l]=[]);t[l][N]=new Worker(O);t[l][N].onmessage=Q;return t[l][N]}}()),this);
|
||||
'use strict';(function(x,N,l){let z;(z=l.define)&&z.amd?z([],function(){return N}):(z=l.modules)?z[x.toLowerCase()]=N:"object"===typeof exports?module.exports=N:l[x]=N})("FlexSearch",function da(x){function l(a,b){const c=b?b.id:a&&a.id;this.id=c||0===c?c:ea++;this.init(a,b);O(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].c):Object.keys(this.c)});O(this,"length",function(){return this.index.length})}function z(a,b,c,d){this.u!==this.g&&(this.o=this.o.concat(c),this.u++,
|
||||
d&&this.o.length>=d&&(this.u=this.g),this.u===this.g&&(this.cache&&this.l.set(b,this.o),this.F&&this.F(this.o)));return this}function P(a,b){const c=a.length,d=J(b),e=[];for(let g=0,f=0;g<c;g++){const c=a[g];if(d&&b(c)||!d&&!b[c])e[f++]=c}return e}function S(a,b,c,d,e,g,f,r,q,n){c=Y(c,f?0:e,r,g,b,q,n);let p;r&&(r=c.page,p=c.next,c=c.result);if(f)b=this.where(f,null,e,c);else{b=c;c=this.h;e=b.length;g=Array(e);for(f=0;f<e;f++)g[f]=c[b[f]];b=g}c=b;d&&(J(d)||(E=d.split(":"),1<E.length?d=fa:(E=E[0],d=
|
||||
ha)),c.sort(d));c=L(r,p,c);this.cache&&this.l.set(a,c);return c}function O(a,b,c){Object.defineProperty(a,b,{get:c})}function h(a){return new RegExp(a,"g")}function M(a,b){for(let c=0;c<b.length;c+=2)a=a.replace(b[c],b[c+1]);return a}function T(a,b,c,d,e,g,f,r){if(b[c])return b[c];e=e?(r-(f||r/1.5))*g+(f||r/1.5)*e:g;b[c]=e;e>=f&&(a=a[r-(e+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=d);return e}function W(a,b){if(a){const c=Object.keys(a);for(let d=0,e=c.length;d<e;d++){const e=c[d],f=a[e];if(f)for(let c=
|
||||
0,d=f.length;c<d;c++)if(f[c]===b){1===d?delete a[e]:f.splice(c,1);break}else F(f[c])&&W(f[c],b)}}}function X(a){let b="",c="";var d="";for(let e=0;e<a.length;e++){const g=a[e];if(g!==c)if(e&&"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)b+=g}else b+=g;d=e===a.length-1?"":a[e+1];c=g}return b}function ia(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function ha(a,b){a=a[E];b=b[E];return a<b?-1:a>b?1:0}function fa(a,
|
||||
b){const c=E.length;for(let d=0;d<c;d++)a=a[E[d]],b=b[E[d]];return a<b?-1:a>b?1:0}function L(a,b,c){return a?{page:a,next:b?""+b:null,result:c}:c}function Y(a,b,c,d,e,g,f){let r,q=[],n;const p=a.length;!0===c?(c="0",n=""):n=c&&c.split(":");if(1<p){const U=u();let G=[],B,K;var m=-1,k;let v;var h=!0;let H,C=0,w,y,x;n&&(2===n.length?(x=n,n=!1):n=parseInt(n[0],10));if(f){for(B=u();++m<p;)if("not"===e[m])for(K=a[m],v=K.length,k=0;k<v;)B["@"+K[k++]]=1;else y=m+1;if(D(y))return L(c,r,q);m=-1}else w=I(e)&&
|
||||
e;let z;for(;++m<p;){const Q=m===(y||p)-1;if(!w||!m)if((k=w||e&&e[m])&&"and"!==k)if("or"===k)z=!1;else continue;else z=g=!0;K=a[m];if(v=K.length){if(h)if(H){var t=H.length;for(k=0;k<t;){h=H[k++];var l="@"+h;f&&B[l]||(U[l]=1,g||(q[C++]=h))}H=null;h=!1}else{H=K;continue}l=!1;for(k=0;k<v;){t=K[k++];var A="@"+t;const a=g?U[A]:m;if(!(!a||f&&B[A]||!g&&U[A]))if(a===m){if(Q){if(!n||--n<C)if(q[C++]=t,b&&C===b)return L(c,C,q)}else U[A]=m+1;l=!0}else d&&(A=G[a]||(G[a]=[]),A[A.length]=t)}if(z&&!l&&!d)break}else if(z&&
|
||||
!d)return L(c,r,K)}if(H)if(m=H.length,f)for(k=n?parseInt(n,10):0;k<m;){if(a=H[k++],!B["@"+a]&&(!n||--n<C)&&(q[C++]=a,b&&C===b))return L(c,k,q)}else q=H;if(d)for(C=q.length,x?(m=parseInt(x[0],10)+1,k=parseInt(x[1],10)):(m=G.length,k=0);m--;)if(t=G[m])for(v=t.length;k<v;k++)if(d=t[k],!f||!B["@"+d])if(q[C++]=d,b&&C===b)return L(c,m+":"+k,q)}else p&&(e&&"not"===e[0]||(q=a[0]));b&&(f=c?parseInt(c,10):0,r=f+b,r<q.length?q=q.slice(f,r):f&&(q=q.slice(f)));return L(c,r,q)}function I(a){return"string"===typeof a}
|
||||
function y(a){return a.constructor===Array}function J(a){return"function"===typeof a}function F(a){return"object"===typeof a}function D(a){return"undefined"===typeof a}function Z(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=u();return b}function u(){return Object.create(null)}function ja(){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 ka(a,b,c,d){a=x("flexsearch","id"+a,ja,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=da.toString();c.id=b;a.postMessage({register:e,options:c,id:b});return a}const w={encode:"icase",f:"forward",split:/\W+/,cache:!1,async:!1,g:!1,D:!1,a:!1,b:9,threshold:0,depth:0},aa={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}},V=[];let ea=0;const ba={},ca={};l.create=function(a){return new l(a)};l.registerMatcher=function(a){for(const b in a)a.hasOwnProperty(b)&&V.push(h(b),a[b]);return this};l.registerEncoder=function(a,b){R[a]=b.bind(R);return this};l.registerLanguage=function(a,b){ba[a]=b.filter;ca[a]=b.stemmer;return this};l.encode=function(a,b){return R[a](b)};l.prototype.init=function(a,b){this.v=[];if(b){var c=b.preset;a=b}else a||(a=w),c=a.preset;b={};I(a)?(b=aa[a],a={}):c&&(b=aa[c]);if(c=
|
||||
a.worker)if("undefined"===typeof Worker)a.worker=!1,this.m=null;else{var d=parseInt(c,10)||4;this.C=-1;this.u=0;this.o=[];this.F=null;this.m=Array(d);for(var e=0;e<d;e++)this.m[e]=ka(this.id,e,a,z.bind(this))}this.f=a.tokenize||b.f||this.f||w.f;this.split=a.split||this.split||w.split;this.D=a.rtl||this.D||w.D;this.async="undefined"===typeof Promise||D(c=a.async)?this.async||w.async:c;this.g=D(c=a.worker)?this.g||w.g:c;this.threshold=D(c=a.threshold)?b.threshold||this.threshold||w.threshold:c;this.b=
|
||||
D(c=a.resolution)?c=b.b||this.b||w.b:c;c<=this.threshold&&(this.b=this.threshold+1);this.depth="strict"!==this.f||D(c=a.depth)?b.depth||this.depth||w.depth:c;this.w=(c=D(c=a.encode)?b.encode||w.encode:c)&&R[c]&&R[c].bind(R)||(J(c)?c:this.w||!1);(c=a.matcher)&&this.addMatcher(c);if(c=a.filter){I(c)&&(c=ba[c]);if(y(c)){b=this.w;d=u();for(e=0;e<c.length;e++){var g=b?b(c[e]):c[e];d[g]=1}c=d}this.filter=c}if(c=a.stemmer){var f;b=I(c)?ca[c]:c;d=this.w;e=[];for(f in b)b.hasOwnProperty(f)&&(g=d?d(f):f,e.push(h(g+
|
||||
"($|\\W)"),d?d(b[f]):b[f]));this.stemmer=f=e}this.a=e=(c=a.doc)?c:this.a||w.a;this.j=Z(this.b-(this.threshold||0));this.i=u();this.c=u();if(e){this.h=u();a.doc=null;f=e.index={};b=e.keys=[];d=e.field;g=e.tag;y(e.id)||(e.id=e.id.split(":"));if(g){this.G=u();let b=u();if(d)if(I(d))b[d]=a;else if(y(d))for(let c=0;c<d.length;c++)b[d[c]]=a;else F(d)&&(b=d);y(g)||(e.tag=g=[g]);for(d=0;d<g.length;d++)this.G[g[d]]=u();this.I=g;d=b}if(d){let c;y(d)||(F(d)?(c=d,e.field=d=Object.keys(d)):e.field=d=[d]);for(e=
|
||||
0;e<d.length;e++)g=d[e],y(g)||(c&&(a=c[g]),b[e]=g,d[e]=g.split(":")),f[g]=new l(a),f[g].h=this.h}}this.B=!0;this.l=(this.cache=c=D(c=a.cache)?this.cache||w.cache:c)?new la(c):!1;return this};l.prototype.encode=function(a){a&&V.length&&(a=M(a,V));a&&this.v.length&&(a=M(a,this.v));a&&this.w&&(a=this.w(a));a&&this.stemmer&&(a=M(a,this.stemmer));return a};l.prototype.addMatcher=function(a){const b=this.v;for(const c in a)a.hasOwnProperty(c)&&b.push(h(c),a[c]);return this};l.prototype.add=function(a,b,
|
||||
c,d,e){if(this.a&&F(a))return this.A("add",a,b);if(b&&I(b)&&(a||0===a)){var g="@"+a;if(this.c[g]&&!d)return this.update(a,b);if(this.g)return++this.C>=this.m.length&&(this.C=0),this.m[this.C].postMessage({add:!0,id:a,content:b}),this.c[g]=""+this.C,c&&c(),this;if(!e){if(this.async&&"function"!==typeof importScripts){let e=this;g=new Promise(function(c){setTimeout(function(){e.add(a,b,null,d,!0);e=null;c()})});if(c)g.then(c);else return g;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=J(c)?c(b):b.split(this.split);this.filter&&(e=P(e,this.filter));const m=u();m._ctx=u();const k=e.length,h=this.threshold,l=this.depth,v=this.b,A=this.j,Q=this.D;for(let b=0;b<k;b++){var f=e[b];if(f){var r=f.length,q=(Q?b+1:k-b)/k,n="";switch(c){case "reverse":case "both":for(var p=r;--p;)n=f[p]+n,T(A,m,n,a,Q?1:(r-p)/r,q,h,v-1);n="";case "forward":for(p=0;p<r;p++)n+=f[p],T(A,m,n,a,Q?(p+1)/r:1,q,h,v-1);break;case "full":for(p=0;p<r;p++){const b=(Q?
|
||||
p+1:r-p)/r;for(let c=r;c>p;c--)n=f.substring(p,c),T(A,m,n,a,b,q,h,v-1)}break;default:if(r=T(A,m,f,a,1,q,h,v-1),l&&1<k&&r>=h)for(r=m._ctx[f]||(m._ctx[f]=u()),f=this.i[f]||(this.i[f]=Z(v-(h||0))),q=b-l,n=b+l+1,0>q&&(q=0),n>k&&(n=k);q<n;q++)q!==b&&T(f,r,e[q],a,0,v-(q<b?b-q:q-b),h,v-1)}}}this.c[g]=1;this.B=!1}return this};l.prototype.A=function(a,b,c){if(y(b))for(let d=0,e=b.length;d<e;d++){if(d===e-1)return this.A(a,b[d],c);this.A(a,b[d])}else{const q=this.a.index,n=this.a.keys;var d=this.a.tag,e=this.a.id;
|
||||
let p;let m;for(var g=0;g<e.length;g++)p=(p||b)[e[g]];if(d){for(e=0;e<d.length;e++){var f=d[e];var h=f.split(":");for(g=0;g<h.length;g++)m=(m||b)[h[g]];m="@"+m}h=this.G[f];h=h[m]||(h[m]=[])}if("remove"===a){delete this.h[p];for(let a=0,b=n.length;a<b;a++){if(a===b-1)return q[n[a]].remove(p,c);q[n[a]].remove(p)}}e=this.a.field;h&&(h[h.length]=b);this.h[p]=b;for(let g=0,h=e.length;g<h;g++){d=e[g];let k;for(f=0;f<d.length;f++)k=(k||b)[d[f]];d=q[n[g]];f="add"===a?d.add:d.update;if(g===h-1)return f.call(d,
|
||||
p,k,c);f.call(d,p,k)}}};l.prototype.update=function(a,b,c){if(this.a&&F(a))return this.A("update",a,b);this.c["@"+a]&&I(b)&&(this.remove(a),this.add(a,b,c,!0));return this};l.prototype.remove=function(a,b,c){if(this.a&&F(a))return this.A("remove",a,b);var d="@"+a;if(this.c[d]){if(this.g)return this.m[this.c[d]].postMessage({remove:!0,id:a}),delete this.c[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.b-(this.threshold||0);b++)W(this.j[b],a);this.depth&&W(this.i,a);delete this.c[d];this.B=!1}return this};let E;l.prototype.search=function(a,b,c,d){if(F(b)){if(y(b))for(var e=0;e<b.length;e++)b[e].query=a;else b.query=a;a=b;b=0}let g=[],f=a;let h,q,n;if(F(a)&&!y(a)){(c=a.callback||J(b)&&b)&&(f.callback=null);q=a.sort;h=a.page;b=a.limit;var p=a.threshold;n=a.suggest;a=a.query}if(this.a){p=
|
||||
this.a.index;const r=f.where;var m=f.bool||"or",k=f.field;let v=m;let G,B;if(k)y(k)||(k=[k]);else if(y(f)){var l=f;k=[];v=[];for(var t=0;t<f.length;t++)d=f[t],e=d.bool||m,k[t]=d.field,v[t]=e,"not"===e?G=!0:"and"===e&&(B=!0)}else k=this.a.keys;m=k.length;for(t=0;t<m;t++)l&&(f=l[t]),h&&!I(f)&&(f.page=null,f.limit=0),g[t]=p[k[t]].search(f,0);if(c)return c(S.call(this,a,v,g,q,b,n,r,h,B,G));if(this.async){const c=this;return new Promise(function(d){Promise.all(g).then(function(e){d(S.call(c,a,v,e,q,b,
|
||||
n,r,h,B,G))})})}return S.call(this,a,v,g,q,b,n,r,h,B,G)}p||(p=this.threshold||0);J(b)?(c=b,b=1E3):b||0===b||(b=1E3);if(this.g)for(this.F=c,this.u=0,this.o=[],k=0;k<this.g;k++)this.m[k].postMessage({search:!0,limit:b,cursor:h,threshold:p,content:a});else{if(!d){if(this.async&&"function"!==typeof importScripts){let a=this;p=new Promise(function(c){setTimeout(function(){c(a.search(f,b,null,!0));a=null})});if(c)p.then(c);else return p;return this}if(c)return c(this.search(f,b,null,!0)),this}if(!a||!I(a))return g;
|
||||
f=a;if(this.cache)if(this.B){if(c=this.l.get(a))return c}else this.l.clear(),this.B=!0;f=this.encode(f);if(!f.length)return g;c=this.f;c=J(c)?c(f):f.split(this.split);this.filter&&(c=P(c,this.filter));l=c.length;d=!0;e=[];var v=u();1<l&&(this.depth?(k=!0,t=c[0],v[t]=1):c.sort(ia));if(!k||(m=this.i)[t]){const a=this.b;for(let b=k?1:0;b<l;b++){const f=c[b];if(f){if(!v[f]){const b=[];let c=!1,g=0;if(t=k?m[t]:this.j){let d;for(let e=0;e<a-p;e++)if(d=t[e][f])b[g++]=d,c=!0}if(c)e[e.length]=1<g?b.concat.apply([],
|
||||
b):b[0];else if(!n){d=!1;break}v[f]=1}t=f}}}else d=!1;d&&(g=Y(e,b,h,n));this.cache&&this.l.set(a,g);return g}};l.prototype.find=function(a,b){return this.where(a,b,1)[0]||null};l.prototype.where=function(a,b,c,d){const e=this.h,g=[];let f=0;let h;var l;if(F(a)){c||(c=b);var n=Object.keys(a);var p=n.length;h=!1;if(1===p&&"id"===n[0])return[e[a.id]];if((l=this.I)&&!d)for(var m=0;m<l.length;m++){var k=l[m],u=a[k];if(!D(u)){d=this.G[k]["@"+u];if(0===--p)return d;n.splice(n.indexOf(k),1);delete a[k];break}}l=
|
||||
Array(p);for(m=0;m<p;m++)l[m]=n[m].split(":")}else{if(J(a)){b=d||Object.keys(e);c=b.length;for(n=0;n<c;n++)p=e[b[n]],a(p)&&(g[f++]=p);return g}if(D(b))return[e[a]];if("id"===a)return[e[b]];n=[a];p=1;l=[a.split(":")];h=!0}d=d||Object.keys(e);m=d.length;for(k=0;k<m;k++){u=e[d[k]];let m=!0;for(let c=0;c<p;c++){h||(b=a[n[c]]);const d=l[c],e=d.length;let f=u;if(1<e)for(let a=0;a<e;a++)f=f[d[a]];else f=f[d[0]];if(f!==b){m=!1;break}}if(m&&(g[f++]=u,c&&f===c))break}return g};l.prototype.info=function(){if(this.g)for(let a=
|
||||
0;a<this.g;a++)this.m[a].postMessage({info:!0,id:this.id});else return{id:this.id,items:this.length,cache:this.cache&&this.cache.s?this.cache.s.length:!1,matcher:V.length+(this.v?this.v.length:0),worker:this.g,threshold:this.threshold,depth:this.depth,resolution:this.b,contextual:this.depth&&"strict"===this.f}};l.prototype.clear=function(){return this.destroy().init()};l.prototype.destroy=function(){this.cache&&(this.l.clear(),this.l=null);this.j=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.h=null}return this};l.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.j,d.i,Object.keys(d.c)]}b[c]=this.h;return JSON.stringify(b)}return JSON.stringify([this.j,this.i,Object.keys(this.c)])};l.prototype.import=function(a){a=JSON.parse(a);const b=u();if(this.a){var c=this.a.keys,d=c.length,e=a[0][2];for(var g=0;g<e.length;g++)b[e[g]]=1;for(e=
|
||||
0;e<d;e++)g=this.a.index[c[e]],g.j=a[e][0],g.i=a[e][1],g.c=b,g.h=a[d];this.h=a[d]}else{c=a[2];for(d=0;d<c.length;d++)b[c[d]]=1;this.j=a[0];this.i=a[1];this.c=b}};const R={icase:function(a){return a.toLowerCase()},simple:function(){const a=[h("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",h("[\u00e8\u00e9\u00ea\u00eb]"),"e",h("[\u00ec\u00ed\u00ee\u00ef]"),"i",h("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",h("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",h("[\u00fd\u0177\u00ff]"),"y",h("\u00f1"),"n",h("\u00e7"),
|
||||
"c",h("\u00df"),"s",h(" & ")," and ",h("[-/]")," ",h("[^a-z0-9 ]"),"",h("\\s+")," "];return function(b){b=M(b.toLowerCase(),a);return" "===b?"":b}}(),advanced:function(){const a=[h("ae"),"a",h("ai"),"ei",h("ay"),"ei",h("ey"),"ei",h("oe"),"o",h("ue"),"u",h("ie"),"i",h("sz"),"s",h("zs"),"s",h("sh"),"s",h("ck"),"k",h("cc"),"k",h("dt"),"t",h("ph"),"f",h("pf"),"f",h("ou"),"o",h("uo"),"u"];return function(b,c){if(!b)return b;b=this.simple(b);2<b.length&&(b=M(b,a));c||1<b.length&&(b=X(b));return b}}(),extra:function(){const a=
|
||||
[h("p"),"b",h("z"),"s",h("[cgq]"),"k",h("n"),"m",h("d"),"t",h("[vw]"),"f",h("[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]+M(d.substring(1),a))}b=b.join(" ");b=X(b)}return b}}(),balance:function(){const a=[h("[-/]")," ",h("[^a-z0-9 ]"),"",h("\\s+")," "];return function(b){return X(M(b.toLowerCase(),a))}}()},la=function(){function a(a){this.clear();this.H=!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.H&&D(this.cache[a])){let b=this.s.length;if(b===this.H){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 c=this.cache[a];if(this.H&&c){var b=++this.count[a];const c=this.index;let d=c[a];if(0<d){const f=this.s;for(var e=d;this.count[f[--d]]<=
|
||||
b&&-1!==d;);d++;if(d!==e){for(b=e;b>d;b--)e=f[b-1],f[b]=e,c[e]=b;f[d]=a;c[a]=d}}}return c};return a}();return l}(function(){const x={},N="undefined"!==typeof Blob&&"undefined"!==typeof URL&&URL.createObjectURL;return function(l,z,P,S,O){P=N?URL.createObjectURL(new Blob(["("+P.toString()+")()"],{type:"text/javascript"})):l+".min.js";l+="-"+z;x[l]||(x[l]=[]);x[l][O]=new Worker(P);x[l][O].onmessage=S;return x[l][O]}}()),this);
|
||||
|
60
dist/flexsearch.node.js
vendored
60
dist/flexsearch.node.js
vendored
@@ -1,36 +1,36 @@
|
||||
/*
|
||||
FlexSearch v0.6.0
|
||||
FlexSearch v0.6.1
|
||||
Copyright 2019 Nextapps GmbH
|
||||
Author: Thomas Wilkerling
|
||||
Released under the Apache 2.0 Licence
|
||||
https://github.com/nextapps-de/flexsearch
|
||||
*/
|
||||
'use strict';(function(l,I,J){let G;(G=J.define)&&G.amd?G([],function(){return I}):(G=J.modules)?G[l.toLowerCase()]=I:"object"===typeof exports?module.exports=I:J[l]=I})("FlexSearch",function(){function l(b,a){const c=a?a.id:b&&b.id;this.id=c||0===c?c:Z++;this.init(b,a);G(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].f):Object.keys(this.f)});G(this,"length",function(){return this.index.length})}function I(b,a){const c=b.length,d=H(a),e=[];for(let f=0,g=0;f<c;f++){const c=
|
||||
b[f];if(d&&a(c)||!d&&!a[c])e[g++]=c}return e}function J(b,a,c,d,e,f,g,m,n,q){c=R(c,g?0:e,m,f,a,n,q);let k;m&&(m=c.page,k=c.next,c=c.result);if(g)a=this.where(g,null,e,c);else{a=c;c=this.g;e=a.length;f=Array(e);for(g=0;g<e;g++)f[g]=c[a[g]];a=f}c=a;d&&(H(d)||(v=d.split(":"),1<v.length?d=aa:(v=v[0],d=ba)),c.sort(d));c=K(m,k,c);this.cache&&this.j.set(b,c);return c}function G(b,a,c){Object.defineProperty(b,a,{get:c})}function h(b){return new RegExp(b,"g")}function L(b,a){for(let c=0;c<a.length;c+=2)b=
|
||||
b.replace(a[c],a[c+1]);return b}function N(b,a,c,d,e,f,g,m){if(a[c])return a[c];e=e?(m-(g||m/1.5))*f+(g||m/1.5)*e:f;a[c]=e;e>=g&&(b=b[m-(e+.5>>0)],b=b[c]||(b[c]=[]),b[b.length]=d);return e}function P(b,a){if(b){const c=Object.keys(b);for(let d=0,e=c.length;d<e;d++){const e=c[d],g=b[e];if(g)for(let c=0,d=g.length;c<d;c++)if(g[c]===a){1===d?delete b[e]:g.splice(c,1);break}else C(g[c])&&P(g[c],a)}}}function Q(b){let a="",c="";var d="";for(let e=0;e<b.length;e++){const f=b[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)a+=f}else a+=f;d=e===b.length-1?"":b[e+1];c=f}return a}function ca(b,a){b=b.length-a.length;return 0>b?1:b?-1:0}function ba(b,a){b=b[v];a=a[v];return b<a?-1:b>a?1:0}function aa(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 K(b,a,c){return b?{page:b,next:a?""+a:null,result:c}:c}function R(b,a,c,d,e,f,g){let m;f=[];let n;const q=b.length;
|
||||
!0===c?(c="0",n=""):n=c&&c.split(":");if(1<q){const t=r();let u=[],l,z,w=-1;var k;let A;let T=!0,D,B=0,y,x,v;n&&(2===n.length?(v=n,n=!1):n=parseInt(n[0],10));if(g){for(l=r();++w<q;)if("not"===e[w])for(z=b[w],A=z.length,k=0;k<A;)l["@"+z[k++]]=1;else x=w+1;if(!x)return K(c,m,f);w=-1}else y=E(e)&&e;for(;++w<q;){const da=w===(x||q)-1;let r,S;if(!y||!w)if((k=y||e&&e[w])&&"and"!==k)if("or"===k)S=!0;else continue;else r=!0;z=b[w];A=z.length;if(!A){if(r&&!d)return K(c,m,z);continue}if(T)if(D){var h=D.length;
|
||||
for(k=0;k<h;)t["@"+D[k++]]=1;D=null;T=!1}else{D=z;continue}let v=!1;for(k=0;k<A;){h=z[k++];var p="@"+h;const b=S?w:t[p];if(b&&(!g||!l[p]))if(b===w){if(da){if(!n||--n<B)if(f[B++]=h,a&&B===a)return K(c,B,f)}else t[p]=w+1;v=!0}else d&&(p=u[b]||(u[b]=[]),p[p.length]=h)}if(r&&!v&&!d)break}if(D)if(b=D.length,g)for(k=n?parseInt(n,10):0;k<b;){if(e=D[k++],!l["@"+e]&&(!n||--n<B)&&(f[B++]=e,a&&B===a))return K(c,k,f)}else f=D;if(d)for(B=f.length,v?(w=parseInt(v[0],10)+1,k=parseInt(v[1],10)):(w=u.length,k=0);w--;)if(h=
|
||||
u[w])for(A=h.length;k<A;k++)if(d=h[k],!g||!l["@"+d])if(f[B++]=d,a&&B===a)return K(c,w+":"+k,f)}else q&&(e&&"not"===e[0]||(f=b[0]));a&&(g=c?parseInt(c,10):0,m=g+a,m<f.length?f=f.slice(g,m):g&&(f=f.slice(g)));return K(c,m,f)}function E(b){return"string"===typeof b}function y(b){return b.constructor===Array}function H(b){return"function"===typeof b}function C(b){return"object"===typeof b}function F(b){return"undefined"===typeof b}function U(b){const a=Array(b);for(let c=0;c<b;c++)a[c]=r();return a}function r(){return Object.create(null)}
|
||||
const x={encode:"icase",c:"forward",cache:!1,async:!1,C:!1,v:!1,a:!1,b:9,threshold:0,depth:0},V={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}},O=[];let Z=0;const W=/\W+/,X={},Y={};l.create=function(b){return new l(b)};
|
||||
l.registerMatcher=function(b){for(const a in b)b.hasOwnProperty(a)&&O.push(h(a),b[a]);return this};l.registerEncoder=function(b,a){M[b]=a.bind(M);return this};l.registerLanguage=function(b,a){X[b]=a.filter;Y[b]=a.stemmer;return this};l.encode=function(b,a){return M[b](a)};l.prototype.init=function(b,a){this.m=[];if(a){var c=a.preset;b=a}else b||(b=x),c=b.preset;a={};E(b)?(a=V[b],b={}):c&&(a=V[c]);this.c=b.tokenize||a.c||this.c||x.c;this.v=b.rtl||this.v||x.v;this.async="undefined"===typeof Promise||
|
||||
F(c=b.async)?this.async||x.async:c;this.threshold=F(c=b.threshold)?a.threshold||this.threshold||x.threshold:c;this.b=F(c=b.resolution)?c=a.b||this.b||x.b:c;c<=this.threshold&&(this.b=this.threshold+1);this.depth="strict"!==this.c||F(c=b.depth)?a.depth||this.depth||x.depth:c;this.o=(c=F(c=b.encode)?a.encode||x.encode:c)&&M[c]&&M[c].bind(M)||(H(c)?c:this.o||!1);(c=b.matcher)&&this.addMatcher(c);if(c=b.filter){E(c)&&(c=X[c]);if(y(c)){a=this.o;var d=r();for(var e=0;e<c.length;e++){var f=a?a(c[e]):c[e];
|
||||
d[f]=1}c=d}this.filter=c}if(c=b.stemmer){var g;a=E(c)?Y[c]:c;d=this.o;e=[];for(g in a)a.hasOwnProperty(g)&&(f=d?d(g):g,e.push(h(f+"($|\\W)"),d?d(a[g]):a[g]));this.stemmer=g=e}this.a=e=(c=b.doc)?c:this.a||x.a;this.i=U(this.b-(this.threshold||0));this.h=r();this.f=r();if(e){this.g=r();b.doc=null;g=e.index={};a=e.keys=[];d=e.field;f=e.tag;y(e.id)||(e.id=e.id.split(":"));if(f){this.w=r();let a=r();if(d)if(E(d))a[d]=b;else if(y(d))for(let c=0;c<d.length;c++)a[d[c]]=b;else C(d)&&(a=d);y(f)||(e.tag=f=[f]);
|
||||
for(d=0;d<f.length;d++)this.w[f[d]]=r();this.B=f;d=a}if(d){let c;y(d)||(C(d)?(c=d,e.field=d=Object.keys(d)):e.field=d=[d]);for(e=0;e<d.length;e++)f=d[e],y(f)||(c&&(b=c[f]),a[e]=f,d[e]=f.split(":")),g[f]=new l(b),g[f].g=this.g}}this.u=!0;this.j=(this.cache=c=F(c=b.cache)?this.cache||x.cache:c)?new ea(c):!1;return this};l.prototype.encode=function(b){b&&O.length&&(b=L(b,O));b&&this.m.length&&(b=L(b,this.m));b&&this.o&&(b=this.o(b));b&&this.stemmer&&(b=L(b,this.stemmer));return b};l.prototype.addMatcher=
|
||||
function(b){const a=this.m;for(const c in b)b.hasOwnProperty(c)&&a.push(h(c),b[c]);return this};l.prototype.add=function(b,a,c,d,e){if(this.a&&C(b))return this.s("add",b,a);if(a&&E(a)&&(b||0===b)){var f="@"+b;if(this.f[f]&&!d)return this.update(b,a);if(!e){if(this.async&&"function"!==typeof importScripts){let e=this;f=new Promise(function(c){setTimeout(function(){e.add(b,a,null,d,!0);e=null;c()})});if(c)f.then(c);else return f;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;e=H(c)?c(a):a.split(W);this.filter&&(e=I(e,this.filter));const t=r();t._ctx=r();const p=e.length,q=this.threshold,u=this.depth,l=this.b,z=this.i,w=this.v;for(let a=0;a<p;a++){var g=e[a];if(g){var m=g.length,n=(w?a+1:p-a)/p,h="";switch(c){case "reverse":case "both":for(var k=m;--k;)h=g[k]+h,N(z,t,h,b,w?1:(m-k)/m,n,q,l-1);h="";case "forward":for(k=0;k<m;k++)h+=g[k],N(z,t,h,b,w?(k+1)/m:1,n,q,l-1);break;case "full":for(k=0;k<m;k++){const a=(w?k+1:m-k)/m;for(let c=m;c>
|
||||
k;c--)h=g.substring(k,c),N(z,t,h,b,a,n,q,l-1)}break;default:if(m=N(z,t,g,b,1,n,q,l-1),u&&1<p&&m>=q)for(m=t._ctx[g]||(t._ctx[g]=r()),g=this.h[g]||(this.h[g]=U(l-(q||0))),n=a-u,h=a+u+1,0>n&&(n=0),h>p&&(h=p);n<h;n++)n!==a&&N(g,m,e[n],b,0,l-(n<a?a-n:n-a),q,l-1)}}}this.f[f]=1;this.u=!1}return this};l.prototype.s=function(b,a,c){if(y(a))for(let d=0,e=a.length;d<e;d++){if(d===e-1)return this.s(b,a[d],c);this.s(b,a[d])}else{const n=this.a.index,m=this.a.keys;var d=this.a.tag,e=this.a.id;let k;let l;for(var f=
|
||||
0;f<e.length;f++)k=(k||a)[e[f]];if(d){for(e=0;e<d.length;e++){var g=d[e];var h=g.split(":");for(f=0;f<h.length;f++)l=(l||a)[h[f]];l="@"+l}h=this.w[g];h=h[l]||(h[l]=[])}if("remove"===b){delete this.g[k];for(let a=0,b=m.length;a<b;a++){if(a===b-1)return n[m[a]].remove(k,c);n[m[a]].remove(k)}}e=this.a.field;h&&(h[h.length]=a);for(let f=0,h=e.length;f<h;f++){d=e[f];let l;for(g=0;g<d.length;g++)l=(l||a)[d[g]];this.g[k]=a;d=n[m[f]];g="add"===b?d.add:d.update;if(f===h-1)return g.call(d,k,l,c);g.call(d,k,
|
||||
l)}}};l.prototype.update=function(b,a,c){if(this.a&&C(b))return this.s("update",b,a);this.f["@"+b]&&E(a)&&(this.remove(b),this.add(b,a,c,!0));return this};l.prototype.remove=function(b,a,c){if(this.a&&C(b))return this.s("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++)P(this.i[a],b);this.depth&&P(this.h,b);delete this.f[d];this.u=!1}return this};let v;l.prototype.search=function(b,a,c,d){if(C(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 f=[],g=b;let h,l,q;if(C(b)&&!y(b)){(c=b.callback||H(a)&&a)&&(g.callback=null);l=b.sort;h=b.page;a=b.limit;var k=b.threshold;q=b.suggest;b=b.query}if(this.a){k=this.a.index;const m=g.where;var t=g.bool||"or",p=g.field;let n=t;let A,r;if(p)y(p)||(p=[p]);else if(y(g)){var v=
|
||||
g;p=[];n=[];for(var u=0;u<g.length;u++)d=g[u],e=d.bool||t,p[u]=d.field,n[u]=e,"not"===e?A=!0:"and"===e&&(r=!0)}else p=this.a.keys;t=p.length;for(u=0;u<t;u++)v&&(g=v[u]),h&&!E(g)&&(g.page=null,g.limit=0),f[u]=k[p[u]].search(g,0);if(c)return c(J.call(this,b,n,f,l,a,q,m,h,r,A));if(this.async){const c=this;return new Promise(function(d){Promise.all(f).then(function(e){d(J.call(c,b,n,e,l,a,q,m,h,r,A))})})}return J.call(this,b,n,f,l,a,q,m,h,r,A)}k||(k=this.threshold||0);H(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||!E(b))return f;g=b;if(this.cache)if(this.u){if(c=this.j.get(b))return c}else this.j.clear(),this.u=!0;g=this.encode(g);if(!g.length)return f;c=this.c;c=H(c)?c(g):g.split(W);this.filter&&(c=I(c,this.filter));v=c.length;d=!0;e=[];const x=r();1<v&&(this.depth?
|
||||
(p=!0,u=c[0],x[u]=1):c.sort(ca));if(!p||(t=this.h)[u]){const a=this.b;for(let b=p?1:0;b<v;b++){const f=c[b];if(f){if(!x[f]){const b=[];let c=!1,g=0;if(u=p?t[u]:this.i){let d;for(let e=0;e<a-k;e++)if(d=u[e][f])b[g++]=d,c=!0}if(c)e[e.length]=1<g?b.concat.apply([],b):b[0];else if(!q){d=!1;break}x[f]=1}u=f}}}else d=!1;d&&(f=R(e,a,h,q));this.cache&&this.j.set(b,f);return f};l.prototype.find=function(b,a){return this.where(b,a,1)[0]||null};l.prototype.where=function(b,a,c,d){const e=this.g,f=[];let g=0;
|
||||
let h;var l;if(C(b)){c||(c=a);var q=Object.keys(b);var k=q.length;h=!1;if(1===k&&"id"===q[0])return[e[b.id]];if((l=this.B)&&!d)for(var t=0;t<l.length;t++){var p=l[t],r=b[p];if(!F(r)){d=this.w[p]["@"+r];if(0===--k)return d;q.splice(q.indexOf(p),1);delete b[p];break}}l=Array(k);for(t=0;t<k;t++)l[t]=q[t].split(":")}else{if(H(b)){a=d||Object.keys(e);c=a.length;for(q=0;q<c;q++)k=e[a[q]],b(k)&&(f[g++]=k);return f}if(F(a))return[e[b]];if("id"===b)return[e[a]];q=[b];k=1;l=[b.split(":")];h=!0}d=d||Object.keys(e);
|
||||
t=d.length;for(p=0;p<t;p++){r=e[d[p]];let m=!0;for(let c=0;c<k;c++){h||(a=b[q[c]]);const d=l[c],e=d.length;let f=r;if(1<e)for(let a=0;a<e;a++)f=f[d[a]];else f=f[d[0]];if(f!==a){m=!1;break}}if(m&&(f[g++]=r,c&&g===c))break}return f};l.prototype.info=function(){return{id:this.id,items:this.length,cache:this.cache&&this.cache.l?this.cache.l.length:!1,matcher:O.length+(this.m?this.m.length:0),worker:this.C,threshold:this.threshold,depth:this.depth,resolution:this.b,contextual:this.depth&&"strict"===this.c}};
|
||||
l.prototype.clear=function(){return this.destroy().init()};l.prototype.destroy=function(){this.cache&&(this.j.clear(),this.j=null);this.i=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};l.prototype.export=function(){if(this.a){const b=this.a.keys,a=Array(b.length+1);let c=0;for(;c<b.length;c++){const d=this.a.index[b[c]];a[c]=[d.i,d.h,Object.keys(d.f)]}a[c]=this.g;return JSON.stringify(a)}return JSON.stringify([this.i,
|
||||
this.h,Object.keys(this.f)])};l.prototype.import=function(b){b=JSON.parse(b);const a=r();if(this.a){var c=this.a.keys,d=c.length,e=b[0][2];for(var f=0;f<e.length;f++)a[e[f]]=1;for(e=0;e<d;e++)f=this.a.index[c[e]],f.i=b[e][0],f.h=b[e][1],f.f=a,f.g=b[d];this.g=b[d]}else{c=b[2];for(d=0;d<c.length;d++)a[c[d]]=1;this.i=b[0];this.h=b[1];this.f=a}};const M={icase:function(b){return b.toLowerCase()},simple:function(){const b=[h("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",h("[\u00e8\u00e9\u00ea\u00eb]"),
|
||||
"e",h("[\u00ec\u00ed\u00ee\u00ef]"),"i",h("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",h("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",h("[\u00fd\u0177\u00ff]"),"y",h("\u00f1"),"n",h("\u00e7"),"c",h("\u00df"),"s",h(" & ")," and ",h("[-/]")," ",h("[^a-z0-9 ]"),"",h("\\s+")," "];return function(a){a=L(a.toLowerCase(),b);return" "===a?"":a}}(),advanced:function(){const b=[h("ae"),"a",h("ai"),"ei",h("ay"),"ei",h("ey"),"ei",h("oe"),"o",h("ue"),"u",h("ie"),"i",h("sz"),"s",h("zs"),"s",h("sh"),"s",h("ck"),"k",
|
||||
h("cc"),"k",h("dt"),"t",h("ph"),"f",h("pf"),"f",h("ou"),"o",h("uo"),"u"];return function(a,c){if(!a)return a;a=this.simple(a);2<a.length&&(a=L(a,b));c||1<a.length&&(a=Q(a));return a}}(),extra:function(){const b=[h("p"),"b",h("z"),"s",h("[cgq]"),"k",h("n"),"m",h("d"),"t",h("[vw]"),"f",h("[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]+L(d.substring(1),b))}a=a.join(" ");a=Q(a)}return a}}(),
|
||||
balance:function(){const b=[h("[-/]")," ",h("[^a-z0-9 ]"),"",h("\\s+")," "];return function(a){return Q(L(a.toLowerCase(),b))}}()},ea=function(){function b(a){this.clear();this.A=!0!==a&&a}b.prototype.clear=function(){this.cache=r();this.count=r();this.index=r();this.l=[]};b.prototype.set=function(a,b){if(this.A&&F(this.cache[a])){let c=this.l.length;if(c===this.A){c--;const a=this.l[c];delete this.cache[a];delete this.count[a];delete this.index[a]}this.index[a]=c;this.l[c]=a;this.count[a]=-1;this.cache[a]=
|
||||
b;this.get(a)}else this.cache[a]=b};b.prototype.get=function(a){const b=this.cache[a];if(this.A&&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 b}();return l}(!1),this);
|
||||
'use strict';(function(m,K,L){let H;(H=L.define)&&H.amd?H([],function(){return K}):(H=L.modules)?H[m.toLowerCase()]=K:"object"===typeof exports?module.exports=K:L[m]=K})("FlexSearch",function(){function m(b,a){const c=a?a.id:b&&b.id;this.id=c||0===c?c:aa++;this.init(b,a);H(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].f):Object.keys(this.f)});H(this,"length",function(){return this.index.length})}function K(b,a){const c=b.length,d=I(a),e=[];for(let g=0,f=0;g<c;g++){const c=
|
||||
b[g];if(d&&a(c)||!d&&!a[c])e[f++]=c}return e}function L(b,a,c,d,e,g,f,r,q,l){c=V(c,f?0:e,r,g,a,q,l);let n;r&&(r=c.page,n=c.next,c=c.result);if(f)a=this.where(f,null,e,c);else{a=c;c=this.g;e=a.length;g=Array(e);for(f=0;f<e;f++)g[f]=c[a[f]];a=g}c=a;d&&(I(d)||(x=d.split(":"),1<x.length?d=ba:(x=x[0],d=ca)),c.sort(d));c=M(r,n,c);this.cache&&this.j.set(b,c);return c}function H(b,a,c){Object.defineProperty(b,a,{get:c})}function h(b){return new RegExp(b,"g")}function N(b,a){for(let c=0;c<a.length;c+=2)b=
|
||||
b.replace(a[c],a[c+1]);return b}function Q(b,a,c,d,e,g,f,r){if(a[c])return a[c];e=e?(r-(f||r/1.5))*g+(f||r/1.5)*e:g;a[c]=e;e>=f&&(b=b[r-(e+.5>>0)],b=b[c]||(b[c]=[]),b[b.length]=d);return e}function T(b,a){if(b){const c=Object.keys(b);for(let d=0,e=c.length;d<e;d++){const e=c[d],f=b[e];if(f)for(let c=0,d=f.length;c<d;c++)if(f[c]===a){1===d?delete b[e]:f.splice(c,1);break}else y(f[c])&&T(f[c],a)}}}function U(b){let a="",c="";var d="";for(let e=0;e<b.length;e++){const g=b[e];if(g!==c)if(e&&"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=e===b.length-1?"":b[e+1];c=g}return a}function da(b,a){b=b.length-a.length;return 0>b?1:b?-1:0}function ca(b,a){b=b[x];a=a[x];return b<a?-1:b>a?1:0}function ba(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){return b?{page:b,next:a?""+a:null,result:c}:c}function V(b,a,c,d,e,g,f){let r,q=[],l;const n=b.length;
|
||||
!0===c?(c="0",l=""):l=c&&c.split(":");if(1<n){const R=v();let E=[],B,J;var k=-1,p;let O;var h=!0;let F,C=0,w,u,x;l&&(2===l.length?(x=l,l=!1):l=parseInt(l[0],10));if(f){for(B=v();++k<n;)if("not"===e[k])for(J=b[k],O=J.length,p=0;p<O;)B["@"+J[p++]]=1;else u=k+1;if(D(u))return M(c,r,q);k=-1}else w=G(e)&&e;let y;for(;++k<n;){const z=k===(u||n)-1;if(!w||!k)if((p=w||e&&e[k])&&"and"!==p)if("or"===p)y=!1;else continue;else y=g=!0;J=b[k];if(O=J.length){if(h)if(F){var t=F.length;for(p=0;p<t;){h=F[p++];var m=
|
||||
"@"+h;f&&B[m]||(R[m]=1,g||(q[C++]=h))}F=null;h=!1}else{F=J;continue}m=!1;for(p=0;p<O;){t=J[p++];var A="@"+t;const b=g?R[A]:k;if(!(!b||f&&B[A]||!g&&R[A]))if(b===k){if(z){if(!l||--l<C)if(q[C++]=t,a&&C===a)return M(c,C,q)}else R[A]=k+1;m=!0}else d&&(A=E[b]||(E[b]=[]),A[A.length]=t)}if(y&&!m&&!d)break}else if(y&&!d)return M(c,r,J)}if(F)if(k=F.length,f)for(p=l?parseInt(l,10):0;p<k;){if(b=F[p++],!B["@"+b]&&(!l||--l<C)&&(q[C++]=b,a&&C===a))return M(c,p,q)}else q=F;if(d)for(C=q.length,x?(k=parseInt(x[0],
|
||||
10)+1,p=parseInt(x[1],10)):(k=E.length,p=0);k--;)if(t=E[k])for(O=t.length;p<O;p++)if(d=t[p],!f||!B["@"+d])if(q[C++]=d,a&&C===a)return M(c,k+":"+p,q)}else n&&(e&&"not"===e[0]||(q=b[0]));a&&(f=c?parseInt(c,10):0,r=f+a,r<q.length?q=q.slice(f,r):f&&(q=q.slice(f)));return M(c,r,q)}function G(b){return"string"===typeof b}function w(b){return b.constructor===Array}function I(b){return"function"===typeof b}function y(b){return"object"===typeof b}function D(b){return"undefined"===typeof b}function W(b){const a=
|
||||
Array(b);for(let c=0;c<b;c++)a[c]=v();return a}function v(){return Object.create(null)}const u={encode:"icase",c:"forward",split:/\W+/,cache:!1,async:!1,C:!1,v:!1,a:!1,b:9,threshold:0,depth:0},X={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}},S=[];let aa=0;const Y={},Z={};m.create=function(b){return new m(b)};m.registerMatcher=function(b){for(const a in b)b.hasOwnProperty(a)&&S.push(h(a),b[a]);return this};m.registerEncoder=function(b,a){P[b]=a.bind(P);return this};m.registerLanguage=function(b,a){Y[b]=a.filter;Z[b]=a.stemmer;return this};m.encode=function(b,a){return P[b](a)};m.prototype.init=function(b,a){this.m=[];if(a){var c=a.preset;b=a}else b||(b=u),c=b.preset;a={};G(b)?(a=X[b],b={}):c&&(a=X[c]);this.c=
|
||||
b.tokenize||a.c||this.c||u.c;this.split=b.split||this.split||u.split;this.v=b.rtl||this.v||u.v;this.async="undefined"===typeof Promise||D(c=b.async)?this.async||u.async:c;this.threshold=D(c=b.threshold)?a.threshold||this.threshold||u.threshold:c;this.b=D(c=b.resolution)?c=a.b||this.b||u.b:c;c<=this.threshold&&(this.b=this.threshold+1);this.depth="strict"!==this.c||D(c=b.depth)?a.depth||this.depth||u.depth:c;this.o=(c=D(c=b.encode)?a.encode||u.encode:c)&&P[c]&&P[c].bind(P)||(I(c)?c:this.o||!1);(c=
|
||||
b.matcher)&&this.addMatcher(c);if(c=b.filter){G(c)&&(c=Y[c]);if(w(c)){a=this.o;var d=v();for(var e=0;e<c.length;e++){var g=a?a(c[e]):c[e];d[g]=1}c=d}this.filter=c}if(c=b.stemmer){var f;a=G(c)?Z[c]:c;d=this.o;e=[];for(f in a)a.hasOwnProperty(f)&&(g=d?d(f):f,e.push(h(g+"($|\\W)"),d?d(a[f]):a[f]));this.stemmer=f=e}this.a=e=(c=b.doc)?c:this.a||u.a;this.i=W(this.b-(this.threshold||0));this.h=v();this.f=v();if(e){this.g=v();b.doc=null;f=e.index={};a=e.keys=[];d=e.field;g=e.tag;w(e.id)||(e.id=e.id.split(":"));
|
||||
if(g){this.w=v();let a=v();if(d)if(G(d))a[d]=b;else if(w(d))for(let c=0;c<d.length;c++)a[d[c]]=b;else y(d)&&(a=d);w(g)||(e.tag=g=[g]);for(d=0;d<g.length;d++)this.w[g[d]]=v();this.B=g;d=a}if(d){let c;w(d)||(y(d)?(c=d,e.field=d=Object.keys(d)):e.field=d=[d]);for(e=0;e<d.length;e++)g=d[e],w(g)||(c&&(b=c[g]),a[e]=g,d[e]=g.split(":")),f[g]=new m(b),f[g].g=this.g}}this.u=!0;this.j=(this.cache=c=D(c=b.cache)?this.cache||u.cache:c)?new ea(c):!1;return this};m.prototype.encode=function(b){b&&S.length&&(b=
|
||||
N(b,S));b&&this.m.length&&(b=N(b,this.m));b&&this.o&&(b=this.o(b));b&&this.stemmer&&(b=N(b,this.stemmer));return b};m.prototype.addMatcher=function(b){const a=this.m;for(const c in b)b.hasOwnProperty(c)&&a.push(h(c),b[c]);return this};m.prototype.add=function(b,a,c,d,e){if(this.a&&y(b))return this.s("add",b,a);if(a&&G(a)&&(b||0===b)){var g="@"+b;if(this.f[g]&&!d)return this.update(b,a);if(!e){if(this.async&&"function"!==typeof importScripts){let e=this;g=new Promise(function(c){setTimeout(function(){e.add(b,
|
||||
a,null,d,!0);e=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;e=I(c)?c(a):a.split(this.split);this.filter&&(e=K(e,this.filter));const k=v();k._ctx=v();const p=e.length,h=this.threshold,t=this.depth,m=this.b,A=this.i,z=this.v;for(let a=0;a<p;a++){var f=e[a];if(f){var r=f.length,q=(z?a+1:p-a)/p,l="";switch(c){case "reverse":case "both":for(var n=r;--n;)l=f[n]+l,Q(A,k,l,b,z?1:(r-n)/r,q,h,m-1);l="";
|
||||
case "forward":for(n=0;n<r;n++)l+=f[n],Q(A,k,l,b,z?(n+1)/r:1,q,h,m-1);break;case "full":for(n=0;n<r;n++){const a=(z?n+1:r-n)/r;for(let c=r;c>n;c--)l=f.substring(n,c),Q(A,k,l,b,a,q,h,m-1)}break;default:if(r=Q(A,k,f,b,1,q,h,m-1),t&&1<p&&r>=h)for(r=k._ctx[f]||(k._ctx[f]=v()),f=this.h[f]||(this.h[f]=W(m-(h||0))),q=a-t,l=a+t+1,0>q&&(q=0),l>p&&(l=p);q<l;q++)q!==a&&Q(f,r,e[q],b,0,m-(q<a?a-q:q-a),h,m-1)}}}this.f[g]=1;this.u=!1}return this};m.prototype.s=function(b,a,c){if(w(a))for(let d=0,e=a.length;d<e;d++){if(d===
|
||||
e-1)return this.s(b,a[d],c);this.s(b,a[d])}else{const q=this.a.index,l=this.a.keys;var d=this.a.tag,e=this.a.id;let n;let k;for(var g=0;g<e.length;g++)n=(n||a)[e[g]];if(d){for(e=0;e<d.length;e++){var f=d[e];var h=f.split(":");for(g=0;g<h.length;g++)k=(k||a)[h[g]];k="@"+k}h=this.w[f];h=h[k]||(h[k]=[])}if("remove"===b){delete this.g[n];for(let a=0,b=l.length;a<b;a++){if(a===b-1)return q[l[a]].remove(n,c);q[l[a]].remove(n)}}e=this.a.field;h&&(h[h.length]=a);this.g[n]=a;for(let g=0,h=e.length;g<h;g++){d=
|
||||
e[g];let k;for(f=0;f<d.length;f++)k=(k||a)[d[f]];d=q[l[g]];f="add"===b?d.add:d.update;if(g===h-1)return f.call(d,n,k,c);f.call(d,n,k)}}};m.prototype.update=function(b,a,c){if(this.a&&y(b))return this.s("update",b,a);this.f["@"+b]&&G(a)&&(this.remove(b),this.add(b,a,c,!0));return this};m.prototype.remove=function(b,a,c){if(this.a&&y(b))return this.s("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++)T(this.i[a],b);this.depth&&T(this.h,b);delete this.f[d];this.u=!1}return this};let x;m.prototype.search=function(b,a,c,d){if(y(a)){if(w(a))for(var e=0;e<a.length;e++)a[e].query=b;else a.query=b;b=a;a=0}let g=[],f=b;let h,q,l;if(y(b)&&!w(b)){(c=b.callback||I(a)&&a)&&(f.callback=null);q=b.sort;h=b.page;a=b.limit;var n=b.threshold;l=b.suggest;b=b.query}if(this.a){n=
|
||||
this.a.index;const r=f.where;var k=f.bool||"or",p=f.field;let z=k;let E,B;if(p)w(p)||(p=[p]);else if(w(f)){var m=f;p=[];z=[];for(var t=0;t<f.length;t++)d=f[t],e=d.bool||k,p[t]=d.field,z[t]=e,"not"===e?E=!0:"and"===e&&(B=!0)}else p=this.a.keys;k=p.length;for(t=0;t<k;t++)m&&(f=m[t]),h&&!G(f)&&(f.page=null,f.limit=0),g[t]=n[p[t]].search(f,0);if(c)return c(L.call(this,b,z,g,q,a,l,r,h,B,E));if(this.async){const c=this;return new Promise(function(d){Promise.all(g).then(function(e){d(L.call(c,b,z,e,q,a,
|
||||
l,r,h,B,E))})})}return L.call(this,b,z,g,q,a,l,r,h,B,E)}n||(n=this.threshold||0);I(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(f,a,null,!0));b=null})});if(c)n.then(c);else return n;return this}if(c)return c(this.search(f,a,null,!0)),this}if(!b||!G(b))return g;f=b;if(this.cache)if(this.u){if(c=this.j.get(b))return c}else this.j.clear(),this.u=!0;f=this.encode(f);if(!f.length)return g;
|
||||
c=this.c;c=I(c)?c(f):f.split(this.split);this.filter&&(c=K(c,this.filter));m=c.length;d=!0;e=[];const u=v();1<m&&(this.depth?(p=!0,t=c[0],u[t]=1):c.sort(da));if(!p||(k=this.h)[t]){const a=this.b;for(let b=p?1:0;b<m;b++){const f=c[b];if(f){if(!u[f]){const b=[];let c=!1,g=0;if(t=p?k[t]:this.i){let d;for(let e=0;e<a-n;e++)if(d=t[e][f])b[g++]=d,c=!0}if(c)e[e.length]=1<g?b.concat.apply([],b):b[0];else if(!l){d=!1;break}u[f]=1}t=f}}}else d=!1;d&&(g=V(e,a,h,l));this.cache&&this.j.set(b,g);return g};m.prototype.find=
|
||||
function(b,a){return this.where(b,a,1)[0]||null};m.prototype.where=function(b,a,c,d){const e=this.g,g=[];let f=0;let h;var q;if(y(b)){c||(c=a);var l=Object.keys(b);var n=l.length;h=!1;if(1===n&&"id"===l[0])return[e[b.id]];if((q=this.B)&&!d)for(var k=0;k<q.length;k++){var p=q[k],m=b[p];if(!D(m)){d=this.w[p]["@"+m];if(0===--n)return d;l.splice(l.indexOf(p),1);delete b[p];break}}q=Array(n);for(k=0;k<n;k++)q[k]=l[k].split(":")}else{if(I(b)){a=d||Object.keys(e);c=a.length;for(l=0;l<c;l++)n=e[a[l]],b(n)&&
|
||||
(g[f++]=n);return g}if(D(a))return[e[b]];if("id"===b)return[e[a]];l=[b];n=1;q=[b.split(":")];h=!0}d=d||Object.keys(e);k=d.length;for(p=0;p<k;p++){m=e[d[p]];let k=!0;for(let c=0;c<n;c++){h||(a=b[l[c]]);const d=q[c],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!==a){k=!1;break}}if(k&&(g[f++]=m,c&&f===c))break}return g};m.prototype.info=function(){return{id:this.id,items:this.length,cache:this.cache&&this.cache.l?this.cache.l.length:!1,matcher:S.length+(this.m?this.m.length:
|
||||
0),worker:this.C,threshold:this.threshold,depth:this.depth,resolution:this.b,contextual:this.depth&&"strict"===this.c}};m.prototype.clear=function(){return this.destroy().init()};m.prototype.destroy=function(){this.cache&&(this.j.clear(),this.j=null);this.i=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};m.prototype.export=function(){if(this.a){const b=this.a.keys,a=Array(b.length+1);let c=0;for(;c<b.length;c++){const d=
|
||||
this.a.index[b[c]];a[c]=[d.i,d.h,Object.keys(d.f)]}a[c]=this.g;return JSON.stringify(a)}return JSON.stringify([this.i,this.h,Object.keys(this.f)])};m.prototype.import=function(b){b=JSON.parse(b);const a=v();if(this.a){var c=this.a.keys,d=c.length,e=b[0][2];for(var g=0;g<e.length;g++)a[e[g]]=1;for(e=0;e<d;e++)g=this.a.index[c[e]],g.i=b[e][0],g.h=b[e][1],g.f=a,g.g=b[d];this.g=b[d]}else{c=b[2];for(d=0;d<c.length;d++)a[c[d]]=1;this.i=b[0];this.h=b[1];this.f=a}};const P={icase:function(b){return b.toLowerCase()},
|
||||
simple:function(){const b=[h("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",h("[\u00e8\u00e9\u00ea\u00eb]"),"e",h("[\u00ec\u00ed\u00ee\u00ef]"),"i",h("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",h("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",h("[\u00fd\u0177\u00ff]"),"y",h("\u00f1"),"n",h("\u00e7"),"c",h("\u00df"),"s",h(" & ")," and ",h("[-/]")," ",h("[^a-z0-9 ]"),"",h("\\s+")," "];return function(a){a=N(a.toLowerCase(),b);return" "===a?"":a}}(),advanced:function(){const b=[h("ae"),"a",h("ai"),"ei",h("ay"),
|
||||
"ei",h("ey"),"ei",h("oe"),"o",h("ue"),"u",h("ie"),"i",h("sz"),"s",h("zs"),"s",h("sh"),"s",h("ck"),"k",h("cc"),"k",h("dt"),"t",h("ph"),"f",h("pf"),"f",h("ou"),"o",h("uo"),"u"];return function(a,c){if(!a)return a;a=this.simple(a);2<a.length&&(a=N(a,b));c||1<a.length&&(a=U(a));return a}}(),extra:function(){const b=[h("p"),"b",h("z"),"s",h("[cgq]"),"k",h("n"),"m",h("d"),"t",h("[vw]"),"f",h("[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]+N(d.substring(1),b))}a=a.join(" ");a=U(a)}return a}}(),balance:function(){const b=[h("[-/]")," ",h("[^a-z0-9 ]"),"",h("\\s+")," "];return function(a){return U(N(a.toLowerCase(),b))}}()},ea=function(){function b(a){this.clear();this.A=!0!==a&&a}b.prototype.clear=function(){this.cache=v();this.count=v();this.index=v();this.l=[]};b.prototype.set=function(a,b){if(this.A&&D(this.cache[a])){let c=this.l.length;if(c===this.A){c--;const a=this.l[c];delete this.cache[a];
|
||||
delete this.count[a];delete this.index[a]}this.index[a]=c;this.l[c]=a;this.count[a]=-1;this.cache[a]=b;this.get(a)}else this.cache[a]=b};b.prototype.get=function(a){const b=this.cache[a];if(this.A&&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 b}();return m}(!1),this);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/**!
|
||||
* @preserve FlexSearch v0.6.0
|
||||
* @preserve FlexSearch v0.6.1
|
||||
* Copyright 2019 Nextapps GmbH
|
||||
* Author: Thomas Wilkerling
|
||||
* Released under the Apache 2.0 Licence
|
||||
@@ -32,13 +32,14 @@
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @enum {boolean|string|number}
|
||||
* @enum {boolean|string|number|RegExp}
|
||||
*/
|
||||
|
||||
const defaults = {
|
||||
|
||||
encode: "icase",
|
||||
tokenize: "forward",
|
||||
split: /\W+/,
|
||||
// enrich: true,
|
||||
// clone: false,
|
||||
// suggest: false,
|
||||
@@ -127,18 +128,11 @@
|
||||
|
||||
let id_counter = 0;
|
||||
|
||||
/**
|
||||
* NOTE: This could make issues on some languages (chinese, korean, thai)
|
||||
* TODO: extract all language-specific stuff from the core
|
||||
* @const {RegExp}
|
||||
*/
|
||||
|
||||
const regex_split = /\W+/; //regex("\\W+"); // regex("[\\s/-_]");
|
||||
const filter = {};
|
||||
const stemmer = {};
|
||||
|
||||
/**
|
||||
* NOTE: Actually not really required when using bare objects: Object.create(null)
|
||||
* NOTE: Actually not really required when using bare objects via: Object.create(null)
|
||||
* @const {Object<string|number, number>}
|
||||
*/
|
||||
|
||||
@@ -414,6 +408,14 @@
|
||||
defaults.tokenize
|
||||
);
|
||||
|
||||
/** @private */
|
||||
this.split = (
|
||||
|
||||
options["split"] ||
|
||||
this.split ||
|
||||
defaults.split
|
||||
);
|
||||
|
||||
/** @private */
|
||||
this.rtl = (
|
||||
|
||||
@@ -924,7 +926,7 @@
|
||||
//(ngram(/** @type {!string} */(content)))
|
||||
//:
|
||||
/** @type {string} */
|
||||
(content).split(regex_split)
|
||||
(content).split(this.split)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -1185,6 +1187,8 @@
|
||||
tag[tag.length] = doc; // tag[tag.length] = id;
|
||||
}
|
||||
|
||||
this._doc[id] = doc;
|
||||
|
||||
for(let i = 0, len = tree.length; i < len; i++){
|
||||
|
||||
const branch = tree[i];
|
||||
@@ -1195,8 +1199,6 @@
|
||||
content = (content || doc)[branch[x]];
|
||||
}
|
||||
|
||||
this._doc[id] = doc;
|
||||
|
||||
const self = index[keys[i]];
|
||||
|
||||
let fn;
|
||||
@@ -1763,7 +1765,7 @@
|
||||
//(ngram(_query))
|
||||
//:
|
||||
/** @type {string} */
|
||||
(_query).split(regex_split)
|
||||
(_query).split(this.split)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -3220,9 +3222,7 @@
|
||||
|
||||
while(++z < length_z){
|
||||
|
||||
const current_bool = bool[z];
|
||||
|
||||
if(current_bool === "not"){
|
||||
if(bool[z] === "not"){
|
||||
|
||||
arr = arrays[z];
|
||||
length = arr.length;
|
||||
@@ -3245,7 +3245,7 @@
|
||||
// there was no field with "and" / "or"
|
||||
// TODO: this could also checked before intersection
|
||||
|
||||
if(!last_index){
|
||||
if(is_undefined(last_index)){
|
||||
|
||||
return create_page(cursor, page, result);
|
||||
}
|
||||
@@ -3258,6 +3258,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
let bool_and;
|
||||
let bool_or;
|
||||
|
||||
// loop through arrays
|
||||
|
||||
while(++z < length_z){
|
||||
@@ -3267,23 +3270,21 @@
|
||||
z === (last_index || length_z) - 1
|
||||
);
|
||||
|
||||
let bool_current;
|
||||
let bool_and;
|
||||
let bool_or;
|
||||
|
||||
if(SUPPORT_DOCUMENT && SUPPORT_OPERATOR){
|
||||
|
||||
if(!bool_main || !z){
|
||||
|
||||
bool_current = bool_main || (bool && bool[z]);
|
||||
const bool_current = bool_main || (bool && bool[z]);
|
||||
|
||||
if(!bool_current || (bool_current === "and")){
|
||||
|
||||
bool_and = true;
|
||||
bool_and = has_and = true;
|
||||
bool_or = false;
|
||||
}
|
||||
else if(bool_current === "or"){
|
||||
|
||||
bool_or = true;
|
||||
bool_and = false;
|
||||
}
|
||||
else{
|
||||
|
||||
@@ -3295,7 +3296,7 @@
|
||||
}
|
||||
else{
|
||||
|
||||
bool_and = true;
|
||||
bool_and = has_and = true;
|
||||
}
|
||||
|
||||
arr = arrays[z];
|
||||
@@ -3327,7 +3328,20 @@
|
||||
|
||||
while(i < result_length){
|
||||
|
||||
check["@" + first_result[i++]] = 1;
|
||||
const id = first_result[i++];
|
||||
const index = "@" + id;
|
||||
|
||||
// there is no and, add items
|
||||
|
||||
if(!has_not || !check_not[index]){
|
||||
|
||||
check[index] = 1;
|
||||
|
||||
if(!has_and){
|
||||
|
||||
result[count++] = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
first_result = null;
|
||||
@@ -3353,7 +3367,7 @@
|
||||
tmp = arr[i++];
|
||||
|
||||
const index = "@" + tmp;
|
||||
const check_val = bool_or ? z : check[index];
|
||||
const check_val = has_and ? check[index] : z;
|
||||
|
||||
if(check_val){
|
||||
|
||||
@@ -3362,6 +3376,11 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!has_and && check[index]){
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if(check_val === z){
|
||||
|
||||
// fill in during last round
|
||||
@@ -3370,7 +3389,7 @@
|
||||
|
||||
// sadly the pointer could just applied here at the earliest
|
||||
// that's why pagination cannot reduce complexity actually
|
||||
// should only happened when at least one "and" bool was set
|
||||
// should only happened when at least one bool "and" was set
|
||||
// TODO: check bool and provide complexity reduction
|
||||
|
||||
if(!pointer || (--pointer < count)){
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "flexsearch",
|
||||
"version": "0.6.0",
|
||||
"version": "0.6.1",
|
||||
"description": "Next-Generation full text search library with zero dependencies.",
|
||||
"homepage": "https://github.com/nextapps-de/flexsearch/",
|
||||
"author": "Thomas Wilkerling",
|
||||
|
58
test/test.js
58
test/test.js
@@ -1906,6 +1906,24 @@ if(env !== "light") describe("Pagination", function(){
|
||||
});
|
||||
});
|
||||
|
||||
describe("Custom Split", function(){
|
||||
|
||||
it("Should have been split properly", function(){
|
||||
|
||||
var index = FlexSearch.create({
|
||||
encode: false,
|
||||
split: /\s+/,
|
||||
tokenize: "reverse"
|
||||
});
|
||||
|
||||
index.add(0, "Фообар");
|
||||
|
||||
expect(index.search("Фообар")).to.include(0);
|
||||
expect(index.search("бар")).to.include(0);
|
||||
expect(index.search("Фоо")).to.include(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Github Issues", function(){
|
||||
|
||||
if(env !== "light") it("#48", function(){
|
||||
@@ -1941,6 +1959,30 @@ describe("Github Issues", function(){
|
||||
expect(fs.search("howdy", { bool: "or" })).to.have.members([doc[1]]);
|
||||
expect(fs.search("howdy -", { bool: "or" })).to.have.members([doc[1]]);
|
||||
});
|
||||
|
||||
if(env !== "light") it("#54", function(){
|
||||
|
||||
var docs = [{
|
||||
id: 1,
|
||||
title: "Roaming Inquiry",
|
||||
content: "Some content"
|
||||
}, {
|
||||
id: 2,
|
||||
title: "New Service",
|
||||
content: "This is not roaming-inquiry"
|
||||
}];
|
||||
|
||||
var index = new FlexSearch({
|
||||
doc: {
|
||||
id: "id",
|
||||
field: ["title", "content"]
|
||||
}
|
||||
});
|
||||
|
||||
index.add(docs);
|
||||
|
||||
expect(index.search("roaming")).to.have.members([docs[0], docs[1]]);
|
||||
});
|
||||
});
|
||||
|
||||
if(env !== "light") describe("Operators", function(){
|
||||
@@ -1985,7 +2027,7 @@ if(env !== "light") describe("Operators", function(){
|
||||
field: "blacklist",
|
||||
query: "xxx",
|
||||
bool: "not"
|
||||
}])).to.have.length(3);
|
||||
}])).to.have.members(data);
|
||||
|
||||
expect(index.search([{
|
||||
field: "title",
|
||||
@@ -2013,7 +2055,7 @@ if(env !== "light") describe("Operators", function(){
|
||||
field: "blacklist",
|
||||
query: "xxx",
|
||||
bool: "not"
|
||||
}])).to.have.length(3);
|
||||
}])).to.have.members(data);
|
||||
|
||||
expect(index.search([{
|
||||
field: "title",
|
||||
@@ -2023,7 +2065,7 @@ if(env !== "light") describe("Operators", function(){
|
||||
field: "body",
|
||||
query: "title",
|
||||
bool: "or"
|
||||
}])).to.have.length(3);
|
||||
}])).to.have.members(data);
|
||||
|
||||
expect(index.search([{
|
||||
field: "title",
|
||||
@@ -2037,7 +2079,7 @@ if(env !== "light") describe("Operators", function(){
|
||||
field: "blacklist",
|
||||
query: "x1",
|
||||
bool: "not"
|
||||
}])).to.have.length(2);
|
||||
}])).to.have.members([data[1], data[2]]);
|
||||
|
||||
expect(index.search([{
|
||||
field: "title",
|
||||
@@ -2065,7 +2107,7 @@ if(env !== "light") describe("Operators", function(){
|
||||
field: "body",
|
||||
query: "body",
|
||||
bool: "or"
|
||||
}])).to.have.length(2);
|
||||
}])).to.have.members([data[1], data[2]]);
|
||||
|
||||
expect(index.search([{
|
||||
field: "title",
|
||||
@@ -2079,7 +2121,7 @@ if(env !== "light") describe("Operators", function(){
|
||||
field: "blacklist",
|
||||
query: "x2",
|
||||
bool: "not"
|
||||
}])).to.have.length(2);
|
||||
}])).to.have.members([data[0], data[2]]);
|
||||
|
||||
expect(index.search([{
|
||||
field: "blacklist",
|
||||
@@ -2093,7 +2135,7 @@ if(env !== "light") describe("Operators", function(){
|
||||
field: "body",
|
||||
query: "body",
|
||||
bool: "and"
|
||||
}])).to.have.length(2);
|
||||
}])).to.have.members([data[0], data[2]]);
|
||||
|
||||
expect(index.search([{
|
||||
field: "title",
|
||||
@@ -2107,7 +2149,7 @@ if(env !== "light") describe("Operators", function(){
|
||||
field: "body",
|
||||
query: "body",
|
||||
bool: "and"
|
||||
}])).to.have.length(2);
|
||||
}])).to.have.members([data[0], data[2]]);
|
||||
|
||||
expect(index.search([{
|
||||
field: "title",
|
||||
|
Reference in New Issue
Block a user