mirror of
https://github.com/nextapps-de/flexsearch.git
synced 2025-09-01 18:03:56 +02:00
v0.6.24 Separate Exports
This commit is contained in:
42
README.md
42
README.md
@@ -2560,6 +2560,48 @@ feeds_2018.import(localStorage.getItem("feeds_2018"));
|
|||||||
feeds_2019.import(localStorage.getItem("feeds_2019"));
|
feeds_2019.import(localStorage.getItem("feeds_2019"));
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Disable Serialization
|
||||||
|
|
||||||
|
Pass a config flag to control serialization:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var data = index.export({serialize: false});
|
||||||
|
```
|
||||||
|
|
||||||
|
Use the same config accordingly when importing data:
|
||||||
|
|
||||||
|
```js
|
||||||
|
index.import(data, {serialize: false});
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Separate Exports (Documents)
|
||||||
|
|
||||||
|
Pass a config flag to separate index and documents from the export:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var idx = index.export({index: true, doc: false});
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
var docs = index.export({index: false, doc: true});
|
||||||
|
```
|
||||||
|
|
||||||
|
Use the same config accordingly when importing data:
|
||||||
|
|
||||||
|
```js
|
||||||
|
index.import(idx, {index: true, doc: false});
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
index.import(docs, {index: false, doc: true});
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also pass documents as external data, assume `data` is an array of documents:
|
||||||
|
|
||||||
|
```js
|
||||||
|
index.import(idx, {index: true, doc: data});
|
||||||
|
```
|
||||||
|
|
||||||
<a name="debug"></a>
|
<a name="debug"></a>
|
||||||
## Debug
|
## Debug
|
||||||
|
|
||||||
|
@@ -80,8 +80,9 @@ var parameter = (function(opt){
|
|||||||
|
|
||||||
compilation_level: compilation_level || "ADVANCED_OPTIMIZATIONS", //"WHITESPACE"
|
compilation_level: compilation_level || "ADVANCED_OPTIMIZATIONS", //"WHITESPACE"
|
||||||
use_types_for_optimization: true,
|
use_types_for_optimization: true,
|
||||||
new_type_inf: true,
|
//new_type_inf: true,
|
||||||
jscomp_warning: "newCheckTypes",
|
jscomp_warning: "newCheckTypes",
|
||||||
|
jscomp_error: "newCheckTypesExtraChecks",
|
||||||
//jscomp_error: "strictCheckTypes",
|
//jscomp_error: "strictCheckTypes",
|
||||||
generate_exports: true,
|
generate_exports: true,
|
||||||
export_local_property_definitions: true,
|
export_local_property_definitions: true,
|
||||||
@@ -94,7 +95,9 @@ var parameter = (function(opt){
|
|||||||
emit_use_strict: options["RELEASE"] !== "lang",
|
emit_use_strict: options["RELEASE"] !== "lang",
|
||||||
output_manifest: "log/manifest.log",
|
output_manifest: "log/manifest.log",
|
||||||
output_module_dependencies: "log/module_dependencies.log",
|
output_module_dependencies: "log/module_dependencies.log",
|
||||||
property_renaming_report: "log/renaming_report.log"
|
property_renaming_report: "log/renaming_report.log",
|
||||||
|
strict_mode_input: true,
|
||||||
|
assume_function_wrapper: true
|
||||||
//formatting: formatting || "DEFAULT" //"PRETTY_PRINT"
|
//formatting: formatting || "DEFAULT" //"PRETTY_PRINT"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -80,7 +80,8 @@
|
|||||||
|
|
||||||
encode: "advanced",
|
encode: "advanced",
|
||||||
tokenize: "reverse",
|
tokenize: "reverse",
|
||||||
suggest: true
|
suggest: true,
|
||||||
|
cache: true
|
||||||
});
|
});
|
||||||
|
|
||||||
for(var i = 0; i < data.length; i++){
|
for(var i = 0; i < data.length; i++){
|
||||||
|
44
dist/flexsearch.compact.js
vendored
44
dist/flexsearch.compact.js
vendored
@@ -1,31 +1,31 @@
|
|||||||
/*
|
/*
|
||||||
FlexSearch v0.6.22
|
FlexSearch v0.6.24
|
||||||
Copyright 2019 Nextapps GmbH
|
Copyright 2019 Nextapps GmbH
|
||||||
Author: Thomas Wilkerling
|
Author: Thomas Wilkerling
|
||||||
Released under the Apache 2.0 Licence
|
Released under the Apache 2.0 Licence
|
||||||
https://github.com/nextapps-de/flexsearch
|
https://github.com/nextapps-de/flexsearch
|
||||||
*/
|
*/
|
||||||
'use strict';(function(v,L,N){let H;(H=N.define)&&H.amd?H([],function(){return L}):(H=N.modules)?H[v.toLowerCase()]=L:"object"===typeof exports?module.exports=L:N[v]=L})("FlexSearch",function(){function v(a,b){const c=b?b.id:a&&a.id;this.id=c||0===c?c:ja++;this.init(a,b);ca(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].f):Object.keys(this.f)});ca(this,"length",function(){return this.index.length})}function L(a){const b=D();for(const c in a)if(a.hasOwnProperty(c)){const d=
|
'use strict';(function(x,L,N){let H;(H=N.define)&&H.amd?H([],function(){return L}):(H=N.modules)?H[x.toLowerCase()]=L:"object"===typeof exports?module.exports=L:N[x]=L})("FlexSearch",function(){function x(a,b){const c=b?b.id:a&&a.id;this.id=c||0===c?c:ja++;this.init(a,b);ca(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].f):Object.keys(this.f)});ca(this,"length",function(){return this.index.length})}function L(a){const b=D();for(const c in a)if(a.hasOwnProperty(c)){const d=
|
||||||
a[c];b[c]=F(d)?d.slice(0):J(d)?L(d):d}return b}function N(a,b){const c=a.length,d=O(b),e=[];for(let k=0,f=0;k<c;k++){const g=a[k];if(d&&b(g)||!d&&!b[g])e[f++]=g}return e}function H(a,b,c,d,e,k,f,g,m,l){c=da(c,f?0:e,!1,!1,b,m,l);let q;g&&(g=c.page,q=c.next,c=c.result);if(f)a=this.where(f,null,e,c);else{a=c;b=this.g;c=a.length;e=Array(c);for(k=0;k<c;k++)e[k]=b[a[k]];a=e}c=a;d&&(O(d)||(I=d.split(":"),1<I.length?d=ka:(I=I[0],d=la)),c.sort(d));return c=P(g,q,c)}function ca(a,b,c){Object.defineProperty(a,
|
a[c];F(d)?b[c]=d.slice(0):J(d)?b[c]=L(d):b[c]=d}return b}function N(a,b){const c=a.length,d=O(b),e=[];for(let k=0,f=0;k<c;k++){const h=a[k];if(d&&b(h)||!d&&!b[h])e[f++]=h}return e}function H(a,b,c,d,e,k,f,h,g,m){c=da(c,f?0:e,!1,!1,b,g,m);let n;h&&(h=c.page,n=c.next,c=c.result);if(f)a=this.where(f,null,e,c);else{a=c;b=this.g;c=a.length;e=Array(c);for(k=0;k<c;k++)e[k]=b[a[k]];a=e}c=a;d&&(O(d)||(I=d.split(":"),1<I.length?d=ka:(I=I[0],d=la)),c.sort(d));return c=P(h,n,c)}function ca(a,b,c){Object.defineProperty(a,
|
||||||
b,{get:c})}function p(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 S(a,b,c,d,e,k,f,g){if(b[c])return b[c];e=e?(g-(f||g/1.5))*k+(f||g/1.5)*e:k;b[c]=e;e>=f&&(a=a[g-(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 k=c[d],f=a[k];if(f)for(let g=0,m=f.length;g<m;g++)if(f[g]===b){1===m?delete a[k]:f.splice(g,1);break}else J(f[g])&&W(f[g],b)}}}function X(a){let b=
|
b,{get:c})}function r(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 S(a,b,c,d,e,k,f,h){if(b[c])return b[c];e=e?(h-(f||h/1.5))*k+(f||h/1.5)*e:k;b[c]=e;e>=f&&(a=a[h-(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 k=c[d],f=a[k];if(f)for(let h=0,g=f.length;h<g;h++)if(f[h]===b){1===g?delete a[k]:f.splice(h,1);break}else J(f[h])&&W(f[h],b)}}}function X(a){let b=
|
||||||
"",c="";var d="";for(let e=0;e<a.length;e++){const k=a[e];if(k!==c)if(e&&"h"===k){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+=k}else b+=k;d=e===a.length-1?"":a[e+1];c=k}return b}function ma(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function la(a,b){a=a[I];b=b[I];return a<b?-1:a>b?1:0}function ka(a,b){const c=I.length;for(let d=0;d<c;d++)a=a[I[d]],b=b[I[d]];return a<b?-1:a>b?1:0}function P(a,b,c){return a?{page:a,
|
"",c="";var d="";for(let e=0;e<a.length;e++){const k=a[e];if(k!==c)if(e&&"h"===k){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+=k}else b+=k;d=e===a.length-1?"":a[e+1];c=k}return b}function ma(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function la(a,b){a=a[I];b=b[I];return a<b?-1:a>b?1:0}function ka(a,b){const c=I.length;for(let d=0;d<c;d++)a=a[I[d]],b=b[I[d]];return a<b?-1:a>b?1:0}function P(a,b,c){return a?{page:a,
|
||||||
next:b?""+b:null,result:c}:c}function da(a,b,c,d,e,k,f){let g,m=[];if(!0===c){c="0";var l=""}else l=c&&c.split(":");const q=a.length;if(1<q){const w=D(),r=[];let x,z;var n=0,h;let E;var u=!0;let B,C=0,Y,Z,T,aa;l&&(2===l.length?(T=l,l=!1):l=aa=parseInt(l[0],10));if(f){for(x=D();n<q;n++)if("not"===e[n])for(z=a[n],E=z.length,h=0;h<E;h++)x["@"+z[h]]=1;else Z=n+1;if(Q(Z))return P(c,g,m);n=0}else Y=K(e)&&e;let U;for(;n<q;n++){const na=n===(Z||q)-1;if(!Y||!n)if((h=Y||e&&e[n])&&"and"!==h)if("or"===h)U=!1;
|
next:b?""+b:null,result:c}:c}function da(a,b,c,d,e,k,f){let h,g=[];if(!0===c){c="0";var m=""}else m=c&&c.split(":");const n=a.length;if(1<n){const w=D(),t=[];let u,z;var p=0,l;let E;var v=!0;let B,C=0,Y,Z,T,aa;m&&(2===m.length?(T=m,m=!1):m=aa=parseInt(m[0],10));if(f){for(u=D();p<n;p++)if("not"===e[p])for(z=a[p],E=z.length,l=0;l<E;l++)u["@"+z[l]]=1;else Z=p+1;if(Q(Z))return P(c,h,g);p=0}else Y=K(e)&&e;let U;for(;p<n;p++){const na=p===(Z||n)-1;if(!Y||!p)if((l=Y||e&&e[p])&&"and"!==l)if("or"===l)U=!1;
|
||||||
else continue;else U=k=!0;z=a[n];if(E=z.length){if(u)if(B){var t=B.length;for(h=0;h<t;h++){u=B[h];var y="@"+u;f&&x[y]||(w[y]=1,k||(m[C++]=u))}B=null;u=!1}else{B=z;continue}y=!1;for(h=0;h<E;h++){t=z[h];var A="@"+t;const V=k?w[A]||0:n;if(!(!V&&!d||f&&x[A]||!k&&w[A]))if(V===n){if(na){if(!aa||--aa<C)if(m[C++]=t,b&&C===b)return P(c,C+(l||0),m)}else w[A]=n+1;y=!0}else d&&(A=r[V]||(r[V]=[]),A[A.length]=t)}if(U&&!y&&!d)break}else if(U&&!d)return P(c,g,z)}if(B)if(n=B.length,f)for(h=l?parseInt(l,10):0;h<n;h++)a=
|
else continue;else U=k=!0;z=a[p];if(E=z.length){if(v)if(B){var q=B.length;for(l=0;l<q;l++){v=B[l];var y="@"+v;f&&u[y]||(w[y]=1,k||(g[C++]=v))}B=null;v=!1}else{B=z;continue}y=!1;for(l=0;l<E;l++){q=z[l];var A="@"+q;const V=k?w[A]||0:p;if(!(!V&&!d||f&&u[A]||!k&&w[A]))if(V===p){if(na){if(!aa||--aa<C)if(g[C++]=q,b&&C===b)return P(c,C+(m||0),g)}else w[A]=p+1;y=!0}else d&&(A=t[V]||(t[V]=[]),A[A.length]=q)}if(U&&!y&&!d)break}else if(U&&!d)return P(c,h,z)}if(B)if(p=B.length,f)for(l=m?parseInt(m,10):0;l<p;l++)a=
|
||||||
B[h],x["@"+a]||(m[C++]=a);else m=B;if(d)for(C=m.length,T?(n=parseInt(T[0],10)+1,h=parseInt(T[1],10)+1):(n=r.length,h=0);n--;)if(t=r[n]){for(E=t.length;h<E;h++)if(d=t[h],!f||!x["@"+d])if(m[C++]=d,b&&C===b)return P(c,n+":"+h,m);h=0}}else!q||e&&"not"===e[0]||(m=a[0],l&&(l=parseInt(l[0],10)));b&&(f=m.length,l&&l>f&&(l=0),l=l||0,g=l+b,g<f?m=m.slice(l,g):(g=0,l&&(m=m.slice(l))));return P(c,g,m)}function K(a){return"string"===typeof a}function F(a){return a.constructor===Array}function O(a){return"function"===
|
B[l],u["@"+a]||(g[C++]=a);else g=B;if(d)for(C=g.length,T?(p=parseInt(T[0],10)+1,l=parseInt(T[1],10)+1):(p=t.length,l=0);p--;)if(q=t[p]){for(E=q.length;l<E;l++)if(d=q[l],!f||!u["@"+d])if(g[C++]=d,b&&C===b)return P(c,p+":"+l,g);l=0}}else!n||e&&"not"===e[0]||(g=a[0],m&&(m=parseInt(m[0],10)));b&&(f=g.length,m&&m>f&&(m=0),m=m||0,h=m+b,h<f?g=g.slice(m,h):(h=0,m&&(g=g.slice(m))));return P(c,h,g)}function K(a){return"string"===typeof a}function F(a){return a.constructor===Array}function O(a){return"function"===
|
||||||
typeof a}function J(a){return"object"===typeof a}function Q(a){return"undefined"===typeof a}function ea(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=D();return b}function D(){return Object.create(null)}const G={encode:"icase",c:"forward",split:/\W+/,cache:!1,async:!1,u:!1,m:!1,a:!1,b:9,threshold:0,depth:0},fa={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",
|
typeof a}function J(a){return"object"===typeof a}function Q(a){return"undefined"===typeof a}function ea(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=D();return b}function D(){return Object.create(null)}const G={encode:"icase",c:"forward",split:/\W+/,cache:!1,async:!1,u:!1,m:!1,a:!1,b:9,threshold:0,depth:0},fa={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}},ba=[];let ja=0;const ha={},ia={};v.create=function(a,b){return new v(a,b)};v.registerMatcher=function(a){for(const b in a)a.hasOwnProperty(b)&&ba.push(p(b),a[b]);return this};v.registerEncoder=function(a,b){R[a]=b.bind(R);return this};v.registerLanguage=function(a,b){ha[a]=b.filter;ia[a]=b.stemmer;return this};v.encode=function(a,b){return R[a](b)};v.prototype.init=
|
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}},ba=[];let ja=0;const ha={},ia={};x.create=function(a,b){return new x(a,b)};x.registerMatcher=function(a){for(const b in a)a.hasOwnProperty(b)&&ba.push(r(b),a[b]);return this};x.registerEncoder=function(a,b){R[a]=b.bind(R);return this};x.registerLanguage=function(a,b){ha[a]=b.filter;ia[a]=b.stemmer;return this};x.encode=function(a,b){return R[a](b)};x.prototype.init=
|
||||||
function(a,b){this.o=[];if(b){var c=b.preset;a=b}else a||(a=G),c=a.preset;b={};K(a)?(b=fa[a],a={}):c&&(b=fa[c]);this.c=a.tokenize||b.c||this.c||G.c;this.split=a.split||this.split||G.split;this.m=a.rtl||this.m||G.m;this.async="undefined"===typeof Promise||Q(c=a.async)?this.async||G.async:c;this.threshold=Q(c=a.threshold)?b.threshold||this.threshold||G.threshold:c;this.b=Q(c=a.resolution)?c=b.b||this.b||G.b:c;c<=this.threshold&&(this.b=this.threshold+1);this.depth="strict"!==this.c||Q(c=a.depth)?b.depth||
|
function(a,b){this.o=[];if(b){var c=b.preset;a=b}else a||(a=G),c=a.preset;b={};K(a)?(b=fa[a],a={}):c&&(b=fa[c]);this.c=a.tokenize||b.c||this.c||G.c;this.split=a.split||this.split||G.split;this.m=a.rtl||this.m||G.m;this.async="undefined"===typeof Promise||Q(c=a.async)?this.async||G.async:c;this.threshold=Q(c=a.threshold)?b.threshold||this.threshold||G.threshold:c;this.b=Q(c=a.resolution)?c=b.b||this.b||G.b:c;c<=this.threshold&&(this.b=this.threshold+1);this.depth="strict"!==this.c||Q(c=a.depth)?b.depth||
|
||||||
this.depth||G.depth:c;this.i=(c=Q(c=a.encode)?b.encode||G.encode:c)&&R[c]&&R[c].bind(R)||(O(c)?c:this.i||!1);(c=a.matcher)&&this.addMatcher(c);if(c=(b=a.lang)||a.filter){K(c)&&(c=ha[c]);if(F(c)){var d=this.i,e=D();for(var k=0;k<c.length;k++){const g=d?d(c[k]):c[k];e[g]=1}c=e}this.filter=c}if(c=b||a.stemmer){var f;b=K(c)?ia[c]:c;d=this.i;e=[];for(f in b)b.hasOwnProperty(f)&&(k=d?d(f):f,e.push(p(k+"($|\\W)"),d?d(b[f]):b[f]));this.stemmer=f=e}this.a=d=(c=a.doc)?L(c):this.a||G.a;this.l=ea(this.b-(this.threshold||
|
this.depth||G.depth:c;this.i=(c=Q(c=a.encode)?b.encode||G.encode:c)&&R[c]&&R[c].bind(R)||(O(c)?c:this.i||!1);(c=a.matcher)&&this.addMatcher(c);if(c=(b=a.lang)||a.filter){K(c)&&(c=ha[c]);if(F(c)){var d=this.i,e=D();for(var k=0;k<c.length;k++){const h=d?d(c[k]):c[k];e[h]=1}c=e}this.filter=c}if(c=b||a.stemmer){var f;b=K(c)?ia[c]:c;d=this.i;e=[];for(f in b)b.hasOwnProperty(f)&&(k=d?d(f):f,e.push(r(k+"($|\\W)"),d?d(b[f]):b[f]));this.stemmer=f=e}this.a=d=(c=a.doc)?L(c):this.a||G.a;this.l=ea(this.b-(this.threshold||
|
||||||
0));this.h=D();this.f=D();if(d&&(this.g=D(),a.doc=null,f=d.index={},c=d.keys=[],b=d.field,F(d.id)||(d.id=d.id.split(":")),b)){let g;F(b)||(J(b)?(g=b,d.field=b=Object.keys(b)):d.field=b=[b]);for(d=0;d<b.length;d++)e=b[d],F(e)||(g&&(a=g[e]),c[d]=e,b[d]=e.split(":")),f[e]=new v(a),f[e].g=this.g}return this};v.prototype.encode=function(a){a&&ba.length&&(a=M(a,ba));a&&this.o.length&&(a=M(a,this.o));a&&this.i&&(a=this.i(a));a&&this.stemmer&&(a=M(a,this.stemmer));return a};v.prototype.addMatcher=function(a){const b=
|
0));this.h=D();this.f=D();if(d&&(this.g=D(),a.doc=null,f=d.index={},c=d.keys=[],b=d.field,F(d.id)||(d.id=d.id.split(":")),b)){let h;F(b)||(J(b)?(h=b,d.field=b=Object.keys(b)):d.field=b=[b]);for(d=0;d<b.length;d++)e=b[d],F(e)||(h&&(a=h[e]),c[d]=e,b[d]=e.split(":")),f[e]=new x(a),f[e].g=this.g}return this};x.prototype.encode=function(a){a&&ba.length&&(a=M(a,ba));a&&this.o.length&&(a=M(a,this.o));a&&this.i&&(a=this.i(a));a&&this.stemmer&&(a=M(a,this.stemmer));return a};x.prototype.addMatcher=function(a){const b=
|
||||||
this.o;for(const c in a)a.hasOwnProperty(c)&&b.push(p(c),a[c]);return this};v.prototype.add=function(a,b,c,d,e){if(this.a&&J(a))return this.j("add",a,b);if(b&&K(b)&&(a||0===a)){var k="@"+a;if(this.f[k]&&!d)return this.update(a,b);if(!e){if(this.async){let r=this;k=new Promise(function(x){setTimeout(function(){r.add(a,b,null,d,!0);r=null;x()})});if(c)k.then(c);else return k;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.c;e=O(c)?c(b):b.split(this.split);
|
this.o;for(const c in a)a.hasOwnProperty(c)&&b.push(r(c),a[c]);return this};x.prototype.add=function(a,b,c,d,e){if(this.a&&J(a))return this.j("add",a,b);if(b&&K(b)&&(a||0===a)){var k="@"+a;if(this.f[k]&&!d)return this.update(a,b);if(!e){if(this.async){let t=this;k=new Promise(function(u){setTimeout(function(){t.add(a,b,null,d,!0);t=null;u()})});if(c)k.then(c);else return k;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.c;e=O(c)?c(b):b.split(this.split);
|
||||||
this.filter&&(e=N(e,this.filter));const n=D();n._ctx=D();const h=e.length,u=this.threshold,t=this.depth,y=this.b,A=this.l,w=this.m;for(let r=0;r<h;r++){var f=e[r];if(f){var g=f.length,m=(w?r+1:h-r)/h,l="";switch(c){case "reverse":case "both":for(var q=g;--q;)l=f[q]+l,S(A,n,l,a,w?1:(g-q)/g,m,u,y-1);l="";case "forward":for(q=0;q<g;q++)l+=f[q],S(A,n,l,a,w?(q+1)/g:1,m,u,y-1);break;case "full":for(q=0;q<g;q++){const x=(w?q+1:g-q)/g;for(let z=g;z>q;z--)l=f.substring(q,z),S(A,n,l,a,x,m,u,y-1)}break;default:if(g=
|
this.filter&&(e=N(e,this.filter));const p=D();p._ctx=D();const l=e.length,v=this.threshold,q=this.depth,y=this.b,A=this.l,w=this.m;for(let t=0;t<l;t++){var f=e[t];if(f){var h=f.length,g=(w?t+1:l-t)/l,m="";switch(c){case "reverse":case "both":for(var n=h;--n;)m=f[n]+m,S(A,p,m,a,w?1:(h-n)/h,g,v,y-1);m="";case "forward":for(n=0;n<h;n++)m+=f[n],S(A,p,m,a,w?(n+1)/h:1,g,v,y-1);break;case "full":for(n=0;n<h;n++){const u=(w?n+1:h-n)/h;for(let z=h;z>n;z--)m=f.substring(n,z),S(A,p,m,a,u,g,v,y-1)}break;default:if(h=
|
||||||
S(A,n,f,a,1,m,u,y-1),t&&1<h&&g>=u)for(g=n._ctx[f]||(n._ctx[f]=D()),f=this.h[f]||(this.h[f]=ea(y-(u||0))),m=r-t,l=r+t+1,0>m&&(m=0),l>h&&(l=h);m<l;m++)m!==r&&S(f,g,e[m],a,0,y-(m<r?r-m:m-r),u,y-1)}}}this.f[k]=1}return this};v.prototype.j=function(a,b,c){if(F(b))for(let m=0,l=b.length;m<l;m++){if(m===l-1)return this.j(a,b[m],c);this.j(a,b[m])}else{const m=this.a.index,l=this.a.keys;var d=this.a.tag,e=this.a.id;let q;let n;for(var k=0;k<e.length;k++)q=(q||b)[e[k]];if(d){for(e=0;e<d.length;e++){var f=d[e];
|
S(A,p,f,a,1,g,v,y-1),q&&1<l&&h>=v)for(h=p._ctx[f]||(p._ctx[f]=D()),f=this.h[f]||(this.h[f]=ea(y-(v||0))),g=t-q,m=t+q+1,0>g&&(g=0),m>l&&(m=l);g<m;g++)g!==t&&S(f,h,e[g],a,0,y-(g<t?t-g:g-t),v,y-1)}}}this.f[k]=1}return this};x.prototype.j=function(a,b,c){if(F(b))for(let g=0,m=b.length;g<m;g++){if(g===m-1)return this.j(a,b[g],c);this.j(a,b[g])}else{const g=this.a.index,m=this.a.keys;var d=this.a.tag,e=this.a.id;let n;let p;for(var k=0;k<e.length;k++)n=(n||b)[e[k]];if(d){for(e=0;e<d.length;e++){var f=d[e];
|
||||||
var g=f.split(":");for(k=0;k<g.length;k++)n=(n||b)[g[k]];n="@"+n}g=this.s[f];g=g[n]||(g[n]=[])}if("remove"===a){delete this.g[q];for(let h=0,u=l.length;h<u;h++){if(h===u-1)return m[l[h]].remove(q,c),this;m[l[h]].remove(q)}}e=this.a.field;g&&(g[g.length]=b);this.g[q]=b;for(let h=0,u=e.length;h<u;h++){d=e[h];let t;for(f=0;f<d.length;f++)t=(t||b)[d[f]];d=m[l[h]];f="add"===a?d.add:d.update;h===u-1?f.call(d,q,t,c):f.call(d,q,t)}}return this};v.prototype.update=function(a,b,c){if(this.a&&J(a))return this.j("update",
|
var h=f.split(":");for(k=0;k<h.length;k++)p=(p||b)[h[k]];p="@"+p}h=this.s[f];h=h[p]||(h[p]=[])}if("remove"===a){delete this.g[n];for(let l=0,v=m.length;l<v;l++){if(l===v-1)return g[m[l]].remove(n,c),this;g[m[l]].remove(n)}}e=this.a.field;h&&(h[h.length]=b);this.g[n]=b;for(let l=0,v=e.length;l<v;l++){d=e[l];let q;for(f=0;f<d.length;f++)q=(q||b)[d[f]];d=g[m[l]];f="add"===a?d.add:d.update;l===v-1?f.call(d,n,q,c):f.call(d,n,q)}}return this};x.prototype.update=function(a,b,c){if(this.a&&J(a))return this.j("update",
|
||||||
a,b);this.f["@"+a]&&K(b)&&(this.remove(a),this.add(a,b,c,!0));return this};v.prototype.remove=function(a,b,c){if(this.a&&J(a))return this.j("remove",a,b);var d="@"+a;if(this.f[d]){if(!c){if(this.async&&"function"!==typeof importScripts){let e=this;d=new Promise(function(k){setTimeout(function(){e.remove(a,null,!0);e=null;k()})});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.l[b],a);this.depth&&W(this.h,a);delete this.f[d]}return this};
|
a,b);this.f["@"+a]&&K(b)&&(this.remove(a),this.add(a,b,c,!0));return this};x.prototype.remove=function(a,b,c){if(this.a&&J(a))return this.j("remove",a,b);var d="@"+a;if(this.f[d]){if(!c){if(this.async&&"function"!==typeof importScripts){let e=this;d=new Promise(function(k){setTimeout(function(){e.remove(a,null,!0);e=null;k()})});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.l[b],a);this.depth&&W(this.h,a);delete this.f[d]}return this};
|
||||||
let I;v.prototype.search=function(a,b,c,d){if(J(b)){if(F(b))for(var e=0;e<b.length;e++)b[e].query=a;else b.query=a;a=b;b=1E3}else b&&O(b)?(c=b,b=1E3):b||0===b||(b=1E3);let k=[],f=a;let g,m,l;if(J(a)&&!F(a)){c||(c=a.callback)&&(f.callback=null);m=a.sort;g=!1;b=a.limit;var q=a.threshold;l=!1;a=a.query}if(this.a){q=this.a.index;var n=f.bool||"or",h=f.field;let w=n;let r,x;if(h)F(h)||(h=[h]);else if(F(f)){var u=f;h=[];w=[];for(var t=0;t<f.length;t++)d=f[t],e=d.bool||n,h[t]=d.field,w[t]=e,"not"===e?r=
|
let I;x.prototype.search=function(a,b,c,d){if(J(b)){if(F(b))for(var e=0;e<b.length;e++)b[e].query=a;else b.query=a;a=b;b=1E3}else b&&O(b)?(c=b,b=1E3):b||0===b||(b=1E3);let k=[],f=a;let h,g,m;if(J(a)&&!F(a)){c||(c=a.callback)&&(f.callback=null);g=a.sort;h=!1;b=a.limit;var n=a.threshold;m=!1;a=a.query}if(this.a){n=this.a.index;var p=f.bool||"or",l=f.field;let w=p;let t,u;if(l)F(l)||(l=[l]);else if(F(f)){var v=f;l=[];w=[];for(var q=0;q<f.length;q++)d=f[q],e=d.bool||p,l[q]=d.field,w[q]=e,"not"===e?t=
|
||||||
!0:"and"===e&&(x=!0)}else h=this.a.keys;n=h.length;for(t=0;t<n;t++)u&&(f=u[t]),g&&!K(f)&&(f.page=null,f.limit=0),k[t]=q[h[t]].search(f,0);if(c)return c(H.call(this,a,w,k,m,b,l,!1,g,x,r));if(this.async){const z=this;return new Promise(function(E){Promise.all(k).then(function(B){E(H.call(z,a,w,B,m,b,l,!1,g,x,r))})})}return H.call(this,a,w,k,m,b,l,!1,g,x,r)}q||(q=this.threshold||0);if(!d){if(this.async&&"function"!==typeof importScripts){let w=this;q=new Promise(function(r){setTimeout(function(){r(w.search(f,
|
!0:"and"===e&&(u=!0)}else l=this.a.keys;p=l.length;for(q=0;q<p;q++)v&&(f=v[q]),h&&!K(f)&&(f.page=null,f.limit=0),k[q]=n[l[q]].search(f,0);if(c)return c(H.call(this,a,w,k,g,b,m,!1,h,u,t));if(this.async){const z=this;return new Promise(function(E){Promise.all(k).then(function(B){E(H.call(z,a,w,B,g,b,m,!1,h,u,t))})})}return H.call(this,a,w,k,g,b,m,!1,h,u,t)}n||(n=this.threshold||0);if(!d){if(this.async&&"function"!==typeof importScripts){let w=this;n=new Promise(function(t){setTimeout(function(){t(w.search(f,
|
||||||
b,null,!0));w=null})});if(c)q.then(c);else return q;return this}if(c)return c(this.search(f,b,null,!0)),this}if(!a||!K(a))return k;f=a;f=this.encode(f);if(!f.length)return k;c=this.c;c=O(c)?c(f):f.split(this.split);this.filter&&(c=N(c,this.filter));u=c.length;d=!0;e=[];const y=D();let A=0;1<u&&(this.depth&&"strict"===this.c?h=!0:c.sort(ma));if(!h||(n=this.h)){const w=this.b;for(;A<u;A++){let r=c[A];if(r){if(h){if(!t)if(n[r])t=r,y[r]=1;else if(!l)return k;if(l&&A===u-1&&!e.length)h=!1,r=t||r,y[r]=
|
b,null,!0));w=null})});if(c)n.then(c);else return n;return this}if(c)return c(this.search(f,b,null,!0)),this}if(!a||!K(a))return k;f=a;f=this.encode(f);if(!f.length)return k;c=this.c;c=O(c)?c(f):f.split(this.split);this.filter&&(c=N(c,this.filter));v=c.length;d=!0;e=[];const y=D();let A=0;1<v&&(this.depth&&"strict"===this.c?l=!0:c.sort(ma));if(!l||(p=this.h)){const w=this.b;for(;A<v;A++){let t=c[A];if(t){if(l){if(!q)if(p[t])q=t,y[t]=1;else if(!m)return k;if(m&&A===v-1&&!e.length)l=!1,t=q||t,y[t]=
|
||||||
0;else if(!t)continue}if(!y[r]){const x=[];let z=!1,E=0;if(t=h?n[t]:this.l){let B;for(let C=0;C<w-q;C++)if(B=t[C]&&t[C][r])x[E++]=B,z=!0}if(z)t=r,e[e.length]=1<E?x.concat.apply([],x):x[0];else{d=!1;break}y[r]=1}}}}else d=!1;d&&(k=da(e,b,g,!1));return k};v.prototype.clear=function(){return this.destroy().init()};v.prototype.destroy=function(){this.l=this.h=this.f=null;if(this.a){const a=this.a.keys;for(let b=0;b<a.length;b++)this.a.index[a[b]].destroy();this.a=this.g=null}return this};const R={icase:function(a){return a.toLowerCase()},
|
0;else if(!q)continue}if(!y[t]){const u=[];let z=!1,E=0;if(q=l?p[q]:this.l){let B;for(let C=0;C<w-n;C++)if(B=q[C]&&q[C][t])u[E++]=B,z=!0}if(z)q=t,e[e.length]=1<E?u.concat.apply([],u):u[0];else{d=!1;break}y[t]=1}}}}else d=!1;d&&(k=da(e,b,h,!1));return k};x.prototype.clear=function(){return this.destroy().init()};x.prototype.destroy=function(){this.l=this.h=this.f=null;if(this.a){const a=this.a.keys;for(let b=0;b<a.length;b++)this.a.index[a[b]].destroy();this.a=this.g=null}return this};const oa=function(){const a=
|
||||||
simple:function(){const a=[p("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",p("[\u00e8\u00e9\u00ea\u00eb]"),"e",p("[\u00ec\u00ed\u00ee\u00ef]"),"i",p("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",p("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",p("[\u00fd\u0177\u00ff]"),"y",p("\u00f1"),"n",p("[\u00e7c]"),"k",p("\u00df"),"s",p(" & ")," and ",p("[-/]")," ",p("[^a-z0-9 ]"),"",p("\\s+")," "];return function(b){b=M(b.toLowerCase(),a);return" "===b?"":b}}(),advanced:function(){const a=[p("ae"),"a",p("ai"),"ei",
|
r("\\s+"),b=r("[^a-z0-9 ]"),c=[r("[-/]")," ",b,"",a," "];return function(d){return X(M(d.toLowerCase(),c))}}(),R={icase:function(a){return a.toLowerCase()},simple:function(){const a=r("\\s+"),b=r("[^a-z0-9 ]"),c=r("[-/]"),d=r("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),e=r("[\u00e8\u00e9\u00ea\u00eb]"),k=r("[\u00ec\u00ed\u00ee\u00ef]"),f=r("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),h=r("[\u00f9\u00fa\u00fb\u00fc\u0171]"),g=r("[\u00fd\u0177\u00ff]"),m=r("\u00f1"),n=r("[\u00e7c]"),p=r("\u00df"),l=r(" & "),
|
||||||
p("ay"),"ei",p("ey"),"ei",p("oe"),"o",p("ue"),"u",p("ie"),"i",p("sz"),"s",p("zs"),"s",p("sh"),"s",p("ck"),"k",p("cc"),"k",p("th"),"t",p("dt"),"t",p("ph"),"f",p("pf"),"f",p("ou"),"o",p("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=[p("p"),"b",p("z"),"s",p("[cgq]"),"k",p("n"),"m",p("d"),"t",p("[vw]"),"f",p("[aeiouy]"),""];return function(b){if(!b)return b;b=this.advanced(b,!0);if(1<b.length){b=b.split(" ");
|
v=[d,"a",e,"e",k,"i",f,"o",h,"u",g,"y",m,"n",n,"k",p,"s",l," and ",c," ",b,"",a," "];return function(q){q=M(q.toLowerCase(),v);return" "===q?"":q}}(),advanced:function(){const a=r("ae"),b=r("ai"),c=r("ay"),d=r("ey"),e=r("oe"),k=r("ue"),f=r("ie"),h=r("sz"),g=r("zs"),m=r("ck"),n=r("cc"),p=r("sh"),l=r("th"),v=r("dt"),q=r("ph"),y=r("pf"),A=r("ou"),w=r("uo"),t=[a,"a",b,"ei",c,"ei",d,"ei",e,"o",k,"u",f,"i",h,"s",g,"s",p,"s",m,"k",n,"k",l,"t",v,"t",q,"f",y,"f",A,"o",w,"u"];return function(u,z){if(!u)return u;
|
||||||
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=[p("[-/]")," ",p("[^a-z0-9 ]"),"",p("\\s+")," "];return function(b){return X(M(b.toLowerCase(),a))}}()};return v}(!1),this);
|
u=this.simple(u);2<u.length&&(u=M(u,t));z||1<u.length&&(u=X(u));return u}}(),extra:function(){const a=r("p"),b=r("z"),c=r("[cgq]"),d=r("n"),e=r("d"),k=r("[vw]"),f=r("[aeiouy]"),h=[a,"b",b,"s",c,"k",d,"m",e,"t",k,"f",f,""];return function(g){if(!g)return g;g=this.advanced(g,!0);if(1<g.length){g=g.split(" ");for(let m=0;m<g.length;m++){const n=g[m];1<n.length&&(g[m]=n[0]+M(n.substring(1),h))}g=g.join(" ");g=X(g)}return g}}(),balance:oa};return x}(!1),this);
|
||||||
|
87
dist/flexsearch.es5.js
vendored
87
dist/flexsearch.es5.js
vendored
@@ -1,50 +1,51 @@
|
|||||||
/*
|
/*
|
||||||
FlexSearch v0.6.22
|
FlexSearch v0.6.24
|
||||||
Copyright 2019 Nextapps GmbH
|
Copyright 2019 Nextapps GmbH
|
||||||
Author: Thomas Wilkerling
|
Author: Thomas Wilkerling
|
||||||
Released under the Apache 2.0 Licence
|
Released under the Apache 2.0 Licence
|
||||||
https://github.com/nextapps-de/flexsearch
|
https://github.com/nextapps-de/flexsearch
|
||||||
*/
|
*/
|
||||||
'use strict';function ma(n){var q=0;return function(){return q<n.length?{done:!1,value:n[q++]}:{done:!0}}}var na="function"==typeof Object.defineProperties?Object.defineProperty:function(n,q,p){n!=Array.prototype&&n!=Object.prototype&&(n[q]=p.value)},Z="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this;function pa(){pa=function(){};Z.Symbol||(Z.Symbol=qa)}function ra(n,q){this.b=n;na(this,"description",{configurable:!0,writable:!0,value:q})}
|
'use strict';function ma(n){var t=0;return function(){return t<n.length?{done:!1,value:n[t++]}:{done:!0}}}var na="function"==typeof Object.defineProperties?Object.defineProperty:function(n,t,p){n!=Array.prototype&&n!=Object.prototype&&(n[t]=p.value)},Z="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this;function pa(){pa=function(){};Z.Symbol||(Z.Symbol=qa)}function ra(n,t){this.b=n;na(this,"description",{configurable:!0,writable:!0,value:t})}
|
||||||
ra.prototype.toString=function(){return this.b};var qa=function(){function n(p){if(this instanceof n)throw new TypeError("Symbol is not a constructor");return new ra("jscomp_symbol_"+(p||"")+"_"+q++,p)}var q=0;return n}();function sa(){pa();var n=Z.Symbol.iterator;n||(n=Z.Symbol.iterator=Z.Symbol("Symbol.iterator"));"function"!=typeof Array.prototype[n]&&na(Array.prototype,n,{configurable:!0,writable:!0,value:function(){return ta(ma(this))}});sa=function(){}}
|
ra.prototype.toString=function(){return this.b};var qa=function(){function n(p){if(this instanceof n)throw new TypeError("Symbol is not a constructor");return new ra("jscomp_symbol_"+(p||"")+"_"+t++,p)}var t=0;return n}();function sa(){pa();var n=Z.Symbol.iterator;n||(n=Z.Symbol.iterator=Z.Symbol("Symbol.iterator"));"function"!=typeof Array.prototype[n]&&na(Array.prototype,n,{configurable:!0,writable:!0,value:function(){return ta(ma(this))}});sa=function(){}}
|
||||||
function ta(n){sa();n={next:n};n[Z.Symbol.iterator]=function(){return this};return n}function za(n,q){sa();n instanceof String&&(n+="");var p=0,D={next:function(){if(p<n.length){var I=p++;return{value:q(I,n[I]),done:!1}}D.next=function(){return{done:!0,value:void 0}};return D.next()}};D[Symbol.iterator]=function(){return D};return D}
|
function ta(n){sa();n={next:n};n[Z.Symbol.iterator]=function(){return this};return n}function za(n,t){sa();n instanceof String&&(n+="");var p=0,E={next:function(){if(p<n.length){var K=p++;return{value:t(K,n[K]),done:!1}}E.next=function(){return{done:!0,value:void 0}};return E.next()}};E[Symbol.iterator]=function(){return E};return E}
|
||||||
function Aa(n,q){if(q){var p=Z;n=n.split(".");for(var D=0;D<n.length-1;D++){var I=n[D];I in p||(p[I]={});p=p[I]}n=n[n.length-1];D=p[n];q=q(D);q!=D&&null!=q&&na(p,n,{configurable:!0,writable:!0,value:q})}}Aa("Array.prototype.keys",function(n){return n?n:function(){return za(this,function(q){return q})}});function Ba(n){var q="undefined"!=typeof Symbol&&Symbol.iterator&&n[Symbol.iterator];return q?q.call(n):{next:ma(n)}}
|
function Aa(n,t){if(t){var p=Z;n=n.split(".");for(var E=0;E<n.length-1;E++){var K=n[E];K in p||(p[K]={});p=p[K]}n=n[n.length-1];E=p[n];t=t(E);t!=E&&null!=t&&na(p,n,{configurable:!0,writable:!0,value:t})}}Aa("Array.prototype.keys",function(n){return n?n:function(){return za(this,function(t){return t})}});function Ba(n){var t="undefined"!=typeof Symbol&&Symbol.iterator&&n[Symbol.iterator];return t?t.call(n):{next:ma(n)}}
|
||||||
Aa("Promise",function(n){function q(m){this.h=0;this.o=void 0;this.b=[];var v=this.j();try{m(v.resolve,v.reject)}catch(l){v.reject(l)}}function p(){this.b=null}function D(m){return m instanceof q?m:new q(function(v){v(m)})}if(n)return n;p.prototype.h=function(m){if(null==this.b){this.b=[];var v=this;this.j(function(){v.o()})}this.b.push(m)};var I=Z.setTimeout;p.prototype.j=function(m){I(m,0)};p.prototype.o=function(){for(;this.b&&this.b.length;){var m=this.b;this.b=[];for(var v=0;v<m.length;++v){var l=
|
Aa("Promise",function(n){function t(m){this.h=0;this.m=void 0;this.b=[];var w=this.j();try{m(w.resolve,w.reject)}catch(l){w.reject(l)}}function p(){this.b=null}function E(m){return m instanceof t?m:new t(function(w){w(m)})}if(n)return n;p.prototype.h=function(m){if(null==this.b){this.b=[];var w=this;this.j(function(){w.m()})}this.b.push(m)};var K=Z.setTimeout;p.prototype.j=function(m){K(m,0)};p.prototype.m=function(){for(;this.b&&this.b.length;){var m=this.b;this.b=[];for(var w=0;w<m.length;++w){var l=
|
||||||
m[v];m[v]=null;try{l()}catch(E){this.l(E)}}}this.b=null};p.prototype.l=function(m){this.j(function(){throw m;})};q.prototype.j=function(){function m(E){return function(H){l||(l=!0,E.call(v,H))}}var v=this,l=!1;return{resolve:m(this.L),reject:m(this.l)}};q.prototype.L=function(m){if(m===this)this.l(new TypeError("A Promise cannot resolve to itself"));else if(m instanceof q)this.M(m);else{a:switch(typeof m){case "object":var v=null!=m;break a;case "function":v=!0;break a;default:v=!1}v?this.K(m):this.w(m)}};
|
m[w];m[w]=null;try{l()}catch(F){this.l(F)}}}this.b=null};p.prototype.l=function(m){this.j(function(){throw m;})};t.prototype.j=function(){function m(F){return function(H){l||(l=!0,F.call(w,H))}}var w=this,l=!1;return{resolve:m(this.L),reject:m(this.l)}};t.prototype.L=function(m){if(m===this)this.l(new TypeError("A Promise cannot resolve to itself"));else if(m instanceof t)this.M(m);else{a:switch(typeof m){case "object":var w=null!=m;break a;case "function":w=!0;break a;default:w=!1}w?this.K(m):this.w(m)}};
|
||||||
q.prototype.K=function(m){var v=void 0;try{v=m.then}catch(l){this.l(l);return}"function"==typeof v?this.N(v,m):this.w(m)};q.prototype.l=function(m){this.B(2,m)};q.prototype.w=function(m){this.B(1,m)};q.prototype.B=function(m,v){if(0!=this.h)throw Error("Cannot settle("+m+", "+v+"): Promise already settled in state"+this.h);this.h=m;this.o=v;this.I()};q.prototype.I=function(){if(null!=this.b){for(var m=0;m<this.b.length;++m)ba.h(this.b[m]);this.b=null}};var ba=new p;q.prototype.M=function(m){var v=
|
t.prototype.K=function(m){var w=void 0;try{w=m.then}catch(l){this.l(l);return}"function"==typeof w?this.N(w,m):this.w(m)};t.prototype.l=function(m){this.B(2,m)};t.prototype.w=function(m){this.B(1,m)};t.prototype.B=function(m,w){if(0!=this.h)throw Error("Cannot settle("+m+", "+w+"): Promise already settled in state"+this.h);this.h=m;this.m=w;this.I()};t.prototype.I=function(){if(null!=this.b){for(var m=0;m<this.b.length;++m)ba.h(this.b[m]);this.b=null}};var ba=new p;t.prototype.M=function(m){var w=
|
||||||
this.j();m.F(v.resolve,v.reject)};q.prototype.N=function(m,v){var l=this.j();try{m.call(v,l.resolve,l.reject)}catch(E){l.reject(E)}};q.prototype.then=function(m,v){function l(K,V){return"function"==typeof K?function(ja){try{E(K(ja))}catch(ka){H(ka)}}:V}var E,H,ca=new q(function(K,V){E=K;H=V});this.F(l(m,E),l(v,H));return ca};q.prototype.catch=function(m){return this.then(void 0,m)};q.prototype.F=function(m,v){function l(){switch(E.h){case 1:m(E.o);break;case 2:v(E.o);break;default:throw Error("Unexpected state: "+
|
this.j();m.F(w.resolve,w.reject)};t.prototype.N=function(m,w){var l=this.j();try{m.call(w,l.resolve,l.reject)}catch(F){l.reject(F)}};t.prototype.then=function(m,w){function l(L,V){return"function"==typeof L?function(ja){try{F(L(ja))}catch(ka){H(ka)}}:V}var F,H,ca=new t(function(L,V){F=L;H=V});this.F(l(m,F),l(w,H));return ca};t.prototype.catch=function(m){return this.then(void 0,m)};t.prototype.F=function(m,w){function l(){switch(F.h){case 1:m(F.m);break;case 2:w(F.m);break;default:throw Error("Unexpected state: "+
|
||||||
E.h);}}var E=this;null==this.b?ba.h(l):this.b.push(l)};q.resolve=D;q.reject=function(m){return new q(function(v,l){l(m)})};q.race=function(m){return new q(function(v,l){for(var E=Ba(m),H=E.next();!H.done;H=E.next())D(H.value).F(v,l)})};q.all=function(m){var v=Ba(m),l=v.next();return l.done?D([]):new q(function(E,H){function ca(ja){return function(ka){K[ja]=ka;V--;0==V&&E(K)}}var K=[],V=0;do K.push(void 0),V++,D(l.value).F(ca(K.length-1),H),l=v.next();while(!l.done)})};return q});
|
F.h);}}var F=this;null==this.b?ba.h(l):this.b.push(l)};t.resolve=E;t.reject=function(m){return new t(function(w,l){l(m)})};t.race=function(m){return new t(function(w,l){for(var F=Ba(m),H=F.next();!H.done;H=F.next())E(H.value).F(w,l)})};t.all=function(m){var w=Ba(m),l=w.next();return l.done?E([]):new t(function(F,H){function ca(ja){return function(ka){L[ja]=ka;V--;0==V&&F(L)}}var L=[],V=0;do L.push(void 0),V++,E(l.value).F(ca(L.length-1),H),l=w.next();while(!l.done)})};return t});
|
||||||
(function(n,q,p){var D;(D=p.define)&&D.amd?D([],function(){return q}):(D=p.modules)?D[n.toLowerCase()]=q:"object"===typeof exports?module.exports=q:p[n]=q})("FlexSearch",function Ca(n){function p(a,b){var c=b?b.id:a&&a.id;this.id=c||0===c?c:Da++;this.init(a,b);v(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].f):Object.keys(this.f)});v(this,"length",function(){return this.index.length})}function D(a,b,c,d){this.D!==this.i&&(this.A=this.A.concat(c),this.D++,d&&this.A.length>=
|
(function(n,t,p){var E;(E=p.define)&&E.amd?E([],function(){return t}):(E=p.modules)?E[n.toLowerCase()]=t:"object"===typeof exports?module.exports=t:p[n]=t})("FlexSearch",function Ca(n){function p(a,c){var b=c?c.id:a&&a.id;this.id=b||0===b?b:Da++;this.init(a,c);w(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].f):Object.keys(this.f)});w(this,"length",function(){return this.index.length})}function E(a,c,b,d){this.D!==this.i&&(this.A=this.A.concat(b),this.D++,d&&this.A.length>=
|
||||||
d&&(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 I(a){var b=G(),c;for(c in a)if(a.hasOwnProperty(c)){var d=a[c];b[c]=N(d)?d.slice(0):U(d)?I(d):d}return b}function ba(a,b){for(var c=a.length,d=da(b),e=[],f=0,g=0;f<c;f++){var h=a[f];if(d&&b(h)||!d&&!b[h])e[g++]=h}return e}function m(a,b,c,d,e,f,g,h,k,t){c=ua(c,g?0:e,h,f,b,k,t);if(h){h=c.page;var y=c.next;c=c.result}if(g)b=this.where(g,null,e,c);else{b=c;c=this.m;e=b.length;f=Array(e);
|
d&&(this.D=this.i),this.D===this.i&&(this.cache&&this.v.set(c,this.A),this.H&&this.H(this.A)));return this}function K(a){var c=G(),b;for(b in a)if(a.hasOwnProperty(b)){var d=a[b];O(d)?c[b]=d.slice(0):Q(d)?c[b]=K(d):c[b]=d}return c}function ba(a,c){for(var b=a.length,d=da(c),e=[],f=0,g=0;f<b;f++){var k=a[f];if(d&&c(k)||!d&&!c[k])e[g++]=k}return e}function m(a,c,b,d,e,f,g,k,h,q){b=ua(b,g?0:e,k,f,c,h,q);if(k){k=b.page;var y=b.next;b=b.result}if(g)c=this.where(g,null,e,b);else{c=b;b=this.s;e=c.length;
|
||||||
for(g=0;g<e;g++)f[g]=c[b[g]];b=f}c=b;d&&(da(d)||(W=d.split(":"),1<W.length?d=ka:(W=W[0],d=ja)),c.sort(d));c=fa(h,y,c);this.cache&&this.v.set(a,c);return c}function v(a,b,c){Object.defineProperty(a,b,{get:c})}function l(a){return new RegExp(a,"g")}function E(a,b){for(var c=0;c<b.length;c+=2)a=a.replace(b[c],b[c+1]);return a}function H(a,b,c,d,e,f,g,h){if(b[c])return b[c];e=e?(h-(g||h/1.5))*f+(g||h/1.5)*e:f;b[c]=e;e>=g&&(a=a[h-(e+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=d);return e}function ca(a,b){if(a)for(var c=
|
f=Array(e);for(g=0;g<e;g++)f[g]=b[c[g]];c=f}b=c;d&&(da(d)||(W=d.split(":"),1<W.length?d=ka:(W=W[0],d=ja)),b.sort(d));b=fa(k,y,b);this.cache&&this.v.set(a,b);return b}function w(a,c,b){Object.defineProperty(a,c,{get:b})}function l(a){return new RegExp(a,"g")}function F(a,c){for(var b=0;b<c.length;b+=2)a=a.replace(c[b],c[b+1]);return a}function H(a,c,b,d,e,f,g,k){if(c[b])return c[b];e=e?(k-(g||k/1.5))*f+(g||k/1.5)*e:f;c[b]=e;e>=g&&(a=a[k-(e+.5>>0)],a=a[b]||(a[b]=[]),a[a.length]=d);return e}function ca(a,
|
||||||
Object.keys(a),d=0,e=c.length;d<e;d++){var f=c[d],g=a[f];if(g)for(var h=0,k=g.length;h<k;h++)if(g[h]===b){1===k?delete a[f]:g.splice(h,1);break}else U(g[h])&&ca(g[h],b)}}function K(a){for(var b="",c="",d="",e=0;e<a.length;e++){var 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 V(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function ja(a,
|
c){if(a)for(var b=Object.keys(a),d=0,e=b.length;d<e;d++){var f=b[d],g=a[f];if(g)for(var k=0,h=g.length;k<h;k++)if(g[k]===c){1===h?delete a[f]:g.splice(k,1);break}else Q(g[k])&&ca(g[k],c)}}function L(a){for(var c="",b="",d="",e=0;e<a.length;e++){var f=a[e];if(f!==b)if(e&&"h"===f){if(d="a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d,("a"===b||"e"===b||"i"===b||"o"===b||"u"===b||"y"===b)&&d||" "===b)c+=f}else c+=f;d=e===a.length-1?"":a[e+1];b=f}return c}function V(a,c){a=a.length-c.length;return 0>
|
||||||
b){a=a[W];b=b[W];return a<b?-1:a>b?1:0}function ka(a,b){for(var c=W.length,d=0;d<c;d++)a=a[W[d]],b=b[W[d]];return a<b?-1:a>b?1:0}function fa(a,b,c){return a?{page:a,next:b?""+b:null,result:c}:c}function ua(a,b,c,d,e,f,g){var h=[];if(!0===c){c="0";var k=""}else k=c&&c.split(":");var t=a.length;if(1<t){var y=G(),w=[],A,r=0,u,F=!0,z=0,C;if(k)if(2===k.length){var x=k;k=!1}else k=C=parseInt(k[0],10);if(g){for(A=G();r<t;r++)if("not"===e[r]){var B=a[r];var J=B.length;for(u=0;u<J;u++)A["@"+B[u]]=1}else var P=
|
a?1:a?-1:0}function ja(a,c){a=a[W];c=c[W];return a<c?-1:a>c?1:0}function ka(a,c){for(var b=W.length,d=0;d<b;d++)a=a[W[d]],c=c[W[d]];return a<c?-1:a>c?1:0}function fa(a,c,b){return a?{page:a,next:c?""+c:null,result:b}:b}function ua(a,c,b,d,e,f,g){var k=[];if(!0===b){b="0";var h=""}else h=b&&b.split(":");var q=a.length;if(1<q){var y=G(),v=[],A,u=0,r,D=!0,B=0,C;if(h)if(2===h.length){var z=h;h=!1}else h=C=parseInt(h[0],10);if(g){for(A=G();u<q;u++)if("not"===e[u]){var x=a[u];var J=x.length;for(r=0;r<J;r++)A["@"+
|
||||||
r+1;if(Q(P))return fa(c,R,h);r=0}else var Y=X(e)&&e;for(var ha;r<t;r++){var L=r===(P||t)-1;if(!Y||!r)if((u=Y||e&&e[r])&&"and"!==u)if("or"===u)ha=!1;else continue;else ha=f=!0;B=a[r];if(J=B.length){if(F)if(S){var M=S.length;for(u=0;u<M;u++){F=S[u];var aa="@"+F;g&&A[aa]||(y[aa]=1,f||(h[z++]=F))}var S=null;F=!1}else{S=B;continue}aa=!1;for(u=0;u<J;u++){M=B[u];var T="@"+M,ea=f?y[T]||0:r;if(!(!ea&&!d||g&&A[T]||!f&&y[T]))if(ea===r){if(L){if(!C||--C<z)if(h[z++]=M,b&&z===b)return fa(c,z+(k||0),h)}else y[T]=
|
x[r]]=1}else var R=u+1;if(I(R))return fa(b,S,k);u=0}else var Y=X(e)&&e;for(var ha;u<q;u++){var M=u===(R||q)-1;if(!Y||!u)if((r=Y||e&&e[u])&&"and"!==r)if("or"===r)ha=!1;else continue;else ha=f=!0;x=a[u];if(J=x.length){if(D)if(T){var N=T.length;for(r=0;r<N;r++){D=T[r];var aa="@"+D;g&&A[aa]||(y[aa]=1,f||(k[B++]=D))}var T=null;D=!1}else{T=x;continue}aa=!1;for(r=0;r<J;r++){N=x[r];var U="@"+N,ea=f?y[U]||0:u;if(!(!ea&&!d||g&&A[U]||!f&&y[U]))if(ea===u){if(M){if(!C||--C<B)if(k[B++]=N,c&&B===c)return fa(b,B+
|
||||||
r+1;aa=!0}else d&&(T=w[ea]||(w[ea]=[]),T[T.length]=M)}if(ha&&!aa&&!d)break}else if(ha&&!d)return fa(c,R,B)}if(S)if(r=S.length,g)for(u=k?parseInt(k,10):0;u<r;u++)a=S[u],A["@"+a]||(h[z++]=a);else h=S;if(d)for(z=h.length,x?(r=parseInt(x[0],10)+1,u=parseInt(x[1],10)+1):(r=w.length,u=0);r--;)if(M=w[r]){for(J=M.length;u<J;u++)if(d=M[u],!g||!A["@"+d])if(h[z++]=d,b&&z===b)return fa(c,r+":"+u,h);u=0}}else!t||e&&"not"===e[0]||(h=a[0],k&&(k=parseInt(k[0],10)));if(b){g=h.length;k&&k>g&&(k=0);k=k||0;var R=k+b;
|
(h||0),k)}else y[U]=u+1;aa=!0}else d&&(U=v[ea]||(v[ea]=[]),U[U.length]=N)}if(ha&&!aa&&!d)break}else if(ha&&!d)return fa(b,S,x)}if(T)if(u=T.length,g)for(r=h?parseInt(h,10):0;r<u;r++)a=T[r],A["@"+a]||(k[B++]=a);else k=T;if(d)for(B=k.length,z?(u=parseInt(z[0],10)+1,r=parseInt(z[1],10)+1):(u=v.length,r=0);u--;)if(N=v[u]){for(J=N.length;r<J;r++)if(d=N[r],!g||!A["@"+d])if(k[B++]=d,c&&B===c)return fa(b,u+":"+r,k);r=0}}else!q||e&&"not"===e[0]||(k=a[0],h&&(h=parseInt(h[0],10)));if(c){g=k.length;h&&h>g&&(h=
|
||||||
R<g?h=h.slice(k,R):(R=0,k&&(h=h.slice(k)))}return fa(c,R,h)}function X(a){return"string"===typeof a}function N(a){return a.constructor===Array}function da(a){return"function"===typeof a}function U(a){return"object"===typeof a}function Q(a){return"undefined"===typeof a}function va(a){for(var b=Array(a),c=0;c<a;c++)b[c]=G();return b}function G(){return Object.create(null)}function Ea(){var a,b;self.onmessage=function(c){if(c=c.data)if(c.search){var d=b.search(c.content,c.threshold?{limit:c.limit,threshold:c.threshold,
|
0);h=h||0;var S=h+c;S<g?k=k.slice(h,S):(S=0,h&&(k=k.slice(h)))}return fa(b,S,k)}function X(a){return"string"===typeof a}function O(a){return a.constructor===Array}function da(a){return"function"===typeof a}function Q(a){return"object"===typeof a}function I(a){return"undefined"===typeof a}function va(a){for(var c=Array(a),b=0;b<a;b++)c[b]=G();return c}function G(){return Object.create(null)}function Ea(){var a,c;self.onmessage=function(b){if(b=b.data)if(b.search){var d=c.search(b.content,b.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 Fa(a,b,c,d){a=n("flexsearch","id"+a,Ea,function(f){(f=
|
{limit:b.limit,threshold:b.threshold,where:b.where}:b.limit);self.postMessage({id:a,content:b.content,limit:b.limit,result:d})}else b.add?c.add(b.id,b.content):b.update?c.update(b.id,b.content):b.remove?c.remove(b.id):b.clear?c.clear():b.info?(b=c.info(),b.worker=a,console.log(b)):b.register&&(a=b.id,b.options.cache=!1,b.options.async=!1,b.options.worker=!1,c=(new Function(b.register.substring(b.register.indexOf("{")+1,b.register.lastIndexOf("}"))))(),c=new c(b.options))}}function Fa(a,c,b,d){a=n("flexsearch",
|
||||||
f.data)&&f.result&&d(f.id,f.content,f.result,f.limit,f.where,f.cursor,f.suggest)},b);var e=Ca.toString();c.id=b;a.postMessage({register:e,options:c,id:b});return a}var O={encode:"icase",g:"forward",split:/\W+/,cache:!1,async:!1,i:!1,G:!1,a:!1,c:9,threshold:0,depth:0},wa={memory:{encode:"extra",g:"strict",threshold:0,c:1},speed:{encode:"icase",g:"strict",threshold:1,c:3,depth:2},match:{encode:"extra",g:"full",threshold:1,c:3},score:{encode:"extra",g:"strict",threshold:1,c:9,depth:4},balance:{encode:"balance",
|
"id"+a,Ea,function(f){(f=f.data)&&f.result&&d(f.id,f.content,f.result,f.limit,f.where,f.cursor,f.suggest)},c);var e=Ca.toString();b.id=c;a.postMessage({register:e,options:b,id:c});return a}var P={encode:"icase",g:"forward",split:/\W+/,cache:!1,async:!1,i:!1,G:!1,a:!1,c:9,threshold:0,depth:0},wa={memory:{encode:"extra",g:"strict",threshold:0,c:1},speed:{encode:"icase",g:"strict",threshold:1,c:3,depth:2},match:{encode:"extra",g:"full",threshold:1,c:3},score:{encode:"extra",g:"strict",threshold:1,c:9,
|
||||||
g:"strict",threshold:0,c:3,depth:3},fast:{encode:"icase",g:"strict",threshold:8,c:9,depth:1}},la=[],Da=0,xa={},ya={};p.create=function(a,b){return new p(a,b)};p.registerMatcher=function(a){for(var b in a)a.hasOwnProperty(b)&&la.push(l(b),a[b]);return this};p.registerEncoder=function(a,b){ia[a]=b.bind(ia);return this};p.registerLanguage=function(a,b){xa[a]=b.filter;ya[a]=b.stemmer;return this};p.encode=function(a,b){return ia[a](b)};p.prototype.init=function(a,b){this.h=[];if(b){var c=b.preset;a=b}else a||
|
depth:4},balance:{encode:"balance",g:"strict",threshold:0,c:3,depth:3},fast:{encode:"icase",g:"strict",threshold:8,c:9,depth:1}},la=[],Da=0,xa={},ya={};p.create=function(a,c){return new p(a,c)};p.registerMatcher=function(a){for(var c in a)a.hasOwnProperty(c)&&la.push(l(c),a[c]);return this};p.registerEncoder=function(a,c){ia[a]=c.bind(ia);return this};p.registerLanguage=function(a,c){xa[a]=c.filter;ya[a]=c.stemmer;return this};p.encode=function(a,c){return ia[a](c)};p.prototype.init=function(a,c){this.h=
|
||||||
(a=O),c=a.preset;b={};X(a)?((b=wa[a])||console.warn("Preset not found: "+a),a={}):c&&((b=wa[c])||console.warn("Preset not found: "+c));if(c=a.worker)if("undefined"===typeof Worker)a.worker=!1,this.b=null;else{var d=parseInt(c,10)||4;this.w=-1;this.D=0;this.A=[];this.H=null;this.b=Array(d);for(var e=0;e<d;e++)this.b[e]=Fa(this.id,e,a,D.bind(this))}this.g=a.tokenize||b.g||this.g||O.g;this.split=a.split||this.split||O.split;this.G=a.rtl||this.G||O.G;this.async="undefined"===typeof Promise||Q(c=a.async)?
|
[];if(c){var b=c.preset;a=c}else a||(a=P),b=a.preset;c={};X(a)?((c=wa[a])||console.warn("Preset not found: "+a),a={}):b&&((c=wa[b])||console.warn("Preset not found: "+b));if(b=a.worker)if("undefined"===typeof Worker)a.worker=!1,this.b=null;else{var d=parseInt(b,10)||4;this.w=-1;this.D=0;this.A=[];this.H=null;this.b=Array(d);for(var e=0;e<d;e++)this.b[e]=Fa(this.id,e,a,E.bind(this))}this.g=a.tokenize||c.g||this.g||P.g;this.split=a.split||this.split||P.split;this.G=a.rtl||this.G||P.G;this.async="undefined"===
|
||||||
this.async||O.async:c;this.i=Q(c=a.worker)?this.i||O.i:c;this.threshold=Q(c=a.threshold)?b.threshold||this.threshold||O.threshold:c;this.c=Q(c=a.resolution)?c=b.c||this.c||O.c:c;c<=this.threshold&&(this.c=this.threshold+1);this.depth="strict"!==this.g||Q(c=a.depth)?b.depth||this.depth||O.depth:c;this.j=(c=Q(c=a.encode)?b.encode||O.encode:c)&&ia[c]&&ia[c].bind(ia)||(da(c)?c:this.j||!1);(c=a.matcher)&&this.addMatcher(c);if(c=(b=a.lang)||a.filter){X(c)&&(c=xa[c]);if(N(c)){d=this.j;e=G();for(var f=0;f<
|
typeof Promise||I(b=a.async)?this.async||P.async:b;this.i=I(b=a.worker)?this.i||P.i:b;this.threshold=I(b=a.threshold)?c.threshold||this.threshold||P.threshold:b;this.c=I(b=a.resolution)?b=c.c||this.c||P.c:b;b<=this.threshold&&(this.c=this.threshold+1);this.depth="strict"!==this.g||I(b=a.depth)?c.depth||this.depth||P.depth:b;this.j=(b=I(b=a.encode)?c.encode||P.encode:b)&&ia[b]&&ia[b].bind(ia)||(da(b)?b:this.j||!1);(b=a.matcher)&&this.addMatcher(b);if(b=(c=a.lang)||a.filter){X(b)&&(b=xa[b]);if(O(b)){d=
|
||||||
c.length;f++){var g=d?d(c[f]):c[f];e[g]=1}c=e}this.filter=c}if(c=b||a.stemmer){b=X(c)?ya[c]:c;d=this.j;e=[];for(var h in b)b.hasOwnProperty(h)&&(f=d?d(h):h,e.push(l(f+"($|\\W)"),d?d(b[h]):b[h]));this.stemmer=e}this.a=e=(c=a.doc)?I(c):this.a||O.a;this.u=va(this.c-(this.threshold||0));this.s=G();this.f=G();if(e){this.m=G();a.doc=null;h=e.index={};b=e.keys=[];d=e.field;f=e.tag;N(e.id)||(e.id=e.id.split(":"));if(f){this.B=G();g=G();if(d)if(X(d))g[d]=a;else if(N(d))for(var k=0;k<d.length;k++)g[d[k]]=a;
|
this.j;e=G();for(var f=0;f<b.length;f++){var g=d?d(b[f]):b[f];e[g]=1}b=e}this.filter=b}if(b=c||a.stemmer){c=X(b)?ya[b]:b;d=this.j;e=[];for(var k in c)c.hasOwnProperty(k)&&(f=d?d(k):k,e.push(l(f+"($|\\W)"),d?d(c[k]):c[k]));this.stemmer=e}this.a=e=(b=a.doc)?K(b):this.a||P.a;this.u=va(this.c-(this.threshold||0));this.o=G();this.f=G();if(e){this.s=G();a.doc=null;k=e.index={};c=e.keys=[];d=e.field;f=e.tag;O(e.id)||(e.id=e.id.split(":"));if(f){this.B=G();g=G();if(d)if(X(d))g[d]=a;else if(O(d))for(var h=
|
||||||
else U(d)&&(g=d);N(f)||(e.tag=f=[f]);for(d=0;d<f.length;d++)this.B[f[d]]=G();this.I=f;d=g}if(d){if(!N(d))if(U(d)){var t=d;e.field=d=Object.keys(d)}else e.field=d=[d];for(e=0;e<d.length;e++)f=d[e],N(f)||(t&&(a=t[f]),b[e]=f,d[e]=f.split(":")),h[f]=new p(a),h[f].m=this.m}}this.o=!0;this.v=(this.cache=c=Q(c=a.cache)?this.cache||O.cache:c)?new Ga(c):!1;return this};p.prototype.encode=function(a){a&&la.length&&(a=E(a,la));a&&this.h.length&&(a=E(a,this.h));a&&this.j&&(a=this.j(a));a&&this.stemmer&&(a=E(a,
|
0;h<d.length;h++)g[d[h]]=a;else Q(d)&&(g=d);O(f)||(e.tag=f=[f]);for(d=0;d<f.length;d++)this.B[f[d]]=G();this.I=f;d=g}if(d){if(!O(d))if(Q(d)){var q=d;e.field=d=Object.keys(d)}else e.field=d=[d];for(e=0;e<d.length;e++)f=d[e],O(f)||(q&&(a=q[f]),c[e]=f,d[e]=f.split(":")),k[f]=new p(a),k[f].s=this.s}}this.m=!0;this.v=(this.cache=b=I(b=a.cache)?this.cache||P.cache:b)?new Ga(b):!1;return this};p.prototype.encode=function(a){a&&la.length&&(a=F(a,la));a&&this.h.length&&(a=F(a,this.h));a&&this.j&&(a=this.j(a));
|
||||||
this.stemmer));return a};p.prototype.addMatcher=function(a){var b=this.h,c;for(c in a)a.hasOwnProperty(c)&&b.push(l(c),a[c]);return this};p.prototype.add=function(a,b,c,d,e){if(this.a&&U(a))return this.l("add",a,b);if(b&&X(b)&&(a||0===a)){var f="@"+a;if(this.f[f]&&!d)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[f]=""+this.w,c&&c(),this;if(!e){if(this.async&&"function"!==typeof importScripts){var g=this;f=new Promise(function(Y){setTimeout(function(){g.add(a,
|
a&&this.stemmer&&(a=F(a,this.stemmer));return a};p.prototype.addMatcher=function(a){var c=this.h,b;for(b in a)a.hasOwnProperty(b)&&c.push(l(b),a[b]);return this};p.prototype.add=function(a,c,b,d,e){if(this.a&&Q(a))return this.l("add",a,c);if(c&&X(c)&&(a||0===a)){var f="@"+a;if(this.f[f]&&!d)return this.update(a,c);if(this.i)return++this.w>=this.b.length&&(this.w=0),this.b[this.w].postMessage({add:!0,id:a,content:c}),this.f[f]=""+this.w,b&&b(),this;if(!e){if(this.async&&"function"!==typeof importScripts){var g=
|
||||||
b,null,d,!0);g=null;Y()})});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.g;e=da(c)?c(b):b.split(this.split);this.filter&&(e=ba(e,this.filter));var h=G();h._ctx=G();for(var k=e.length,t=this.threshold,y=this.depth,w=this.c,A=this.u,r=this.G,u=0;u<k;u++){var F=e[u];if(F){var z=F.length,C=(r?u+1:k-u)/k,x="";switch(c){case "reverse":case "both":for(var B=z;--B;)x=F[B]+x,H(A,h,x,a,r?1:(z-B)/z,C,t,w-1);x="";case "forward":for(B=
|
this;f=new Promise(function(Y){setTimeout(function(){g.add(a,c,null,d,!0);g=null;Y()})});if(b)f.then(b);else return f;return this}if(b)return this.add(a,c,null,d,!0),b(),this}c=this.encode(c);if(!c.length)return this;b=this.g;e=da(b)?b(c):c.split(this.split);this.filter&&(e=ba(e,this.filter));var k=G();k._ctx=G();for(var h=e.length,q=this.threshold,y=this.depth,v=this.c,A=this.u,u=this.G,r=0;r<h;r++){var D=e[r];if(D){var B=D.length,C=(u?r+1:h-r)/h,z="";switch(b){case "reverse":case "both":for(var x=
|
||||||
0;B<z;B++)x+=F[B],H(A,h,x,a,r?(B+1)/z:1,C,t,w-1);break;case "full":for(B=0;B<z;B++)for(var J=(r?B+1:z-B)/z,P=z;P>B;P--)x=F.substring(B,P),H(A,h,x,a,J,C,t,w-1);break;default:if(z=H(A,h,F,a,1,C,t,w-1),y&&1<k&&z>=t)for(z=h._ctx[F]||(h._ctx[F]=G()),F=this.s[F]||(this.s[F]=va(w-(t||0))),C=u-y,x=u+y+1,0>C&&(C=0),x>k&&(x=k);C<x;C++)C!==u&&H(F,z,e[C],a,0,w-(C<u?u-C:C-u),t,w-1)}}}this.f[f]=1;this.o=!1}return this};p.prototype.l=function(a,b,c){if(N(b))for(var d=0,e=b.length;d<e;d++){if(d===e-1)return this.l(a,
|
B;--x;)z=D[x]+z,H(A,k,z,a,u?1:(B-x)/B,C,q,v-1);z="";case "forward":for(x=0;x<B;x++)z+=D[x],H(A,k,z,a,u?(x+1)/B:1,C,q,v-1);break;case "full":for(x=0;x<B;x++)for(var J=(u?x+1:B-x)/B,R=B;R>x;R--)z=D.substring(x,R),H(A,k,z,a,J,C,q,v-1);break;default:if(B=H(A,k,D,a,1,C,q,v-1),y&&1<h&&B>=q)for(B=k._ctx[D]||(k._ctx[D]=G()),D=this.o[D]||(this.o[D]=va(v-(q||0))),C=r-y,z=r+y+1,0>C&&(C=0),z>h&&(z=h);C<z;C++)C!==r&&H(D,B,e[C],a,0,v-(C<r?r-C:C-r),q,v-1)}}}this.f[f]=1;this.m=!1}return this};p.prototype.l=function(a,
|
||||||
b[d],c);this.l(a,b[d])}else{d=this.a.index;e=this.a.keys;for(var f=this.a.tag,g=this.a.id,h,k,t,y,w=0;w<g.length;w++)h=(h||b)[g[w]];if(f){for(g=0;g<f.length;g++){t=f[g];k=t.split(":");for(w=0;w<k.length;w++)y=(y||b)[k[w]];y="@"+y}k=this.B[t];k=k[y]||(k[y]=[])}if("remove"===a)for(delete this.m[h],g=0,f=e.length;g<f;g++){if(g===f-1)return d[e[g]].remove(h,c),this;d[e[g]].remove(h)}g=this.a.field;k&&(k[k.length]=b);this.m[h]=b;f=0;for(t=g.length;f<t;f++){k=g[f];y=void 0;for(w=0;w<k.length;w++)y=(y||
|
c,b){if(O(c))for(var d=0,e=c.length;d<e;d++){if(d===e-1)return this.l(a,c[d],b);this.l(a,c[d])}else{d=this.a.index;e=this.a.keys;for(var f=this.a.tag,g=this.a.id,k,h,q,y,v=0;v<g.length;v++)k=(k||c)[g[v]];if(f){for(g=0;g<f.length;g++){q=f[g];h=q.split(":");for(v=0;v<h.length;v++)y=(y||c)[h[v]];y="@"+y}h=this.B[q];h=h[y]||(h[y]=[])}if("remove"===a)for(delete this.s[k],g=0,f=e.length;g<f;g++){if(g===f-1)return d[e[g]].remove(k,b),this;d[e[g]].remove(k)}g=this.a.field;h&&(h[h.length]=c);this.s[k]=c;f=
|
||||||
b)[k[w]];k=d[e[f]];w="add"===a?k.add:k.update;f===t-1?w.call(k,h,y,c):w.call(k,h,y)}}return this};p.prototype.update=function(a,b,c){if(this.a&&U(a))return this.l("update",a,b);this.f["@"+a]&&X(b)&&(this.remove(a),this.add(a,b,c,!0));return this};p.prototype.remove=function(a,b,c){if(this.a&&U(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=
|
0;for(q=g.length;f<q;f++){h=g[f];y=void 0;for(v=0;v<h.length;v++)y=(y||c)[h[v]];h=d[e[f]];v="add"===a?h.add:h.update;f===q-1?v.call(h,k,y,b):v.call(h,k,y)}}return this};p.prototype.update=function(a,c,b){if(this.a&&Q(a))return this.l("update",a,c);this.f["@"+a]&&X(c)&&(this.remove(a),this.add(a,c,b,!0));return this};p.prototype.remove=function(a,c,b){if(this.a&&Q(a))return this.l("remove",a,c);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],
|
||||||
this;d=new Promise(function(f){setTimeout(function(){e.remove(a,null,!0);e=null;f()})});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++)ca(this.u[b],a);this.depth&&ca(this.s,a);delete this.f[d];this.o=!1}return this};var W;p.prototype.search=function(a,b,c,d){if(U(b)){if(N(b))for(var e=0;e<b.length;e++)b[e].query=a;else b.query=a;a=b;b=1E3}else b&&da(b)?(c=b,b=1E3):b||0===b||(b=1E3);var f=[],g=a;if(U(a)&&!N(a)){c||(c=a.callback)&&
|
c&&c(),this;if(!b){if(this.async&&"function"!==typeof importScripts){var e=this;d=new Promise(function(f){setTimeout(function(){e.remove(a,null,!0);e=null;f()})});if(c)d.then(c);else return d;return this}if(c)return this.remove(a,null,!0),c(),this}for(c=0;c<this.c-(this.threshold||0);c++)ca(this.u[c],a);this.depth&&ca(this.o,a);delete this.f[d];this.m=!1}return this};var W;p.prototype.search=function(a,c,b,d){if(Q(c)){if(O(c))for(var e=0;e<c.length;e++)c[e].query=a;else c.query=a;a=c;c=1E3}else c&&
|
||||||
(g.callback=null);var h=a.sort;var k=a.page;b=a.limit;var t=a.threshold;var y=a.suggest;a=a.query}if(this.a){t=this.a.index;var w=g.where,A=g.bool||"or",r=g.field,u=A,F,z;if(r)N(r)||(r=[r]);else if(N(g)){var C=g;r=[];u=[];for(var x=0;x<g.length;x++)d=g[x],e=d.bool||A,r[x]=d.field,u[x]=e,"not"===e?F=!0:"and"===e&&(z=!0)}else r=this.a.keys;A=r.length;for(x=0;x<A;x++)C&&(g=C[x]),k&&!X(g)&&(g.page=null,g.limit=0),f[x]=t[r[x]].search(g,0);if(this.i){this.H=c;this.D=0;this.A=[];for(t=0;t<this.i;t++)this.b[t].postMessage({search:!0,
|
da(c)?(b=c,c=1E3):c||0===c||(c=1E3);var f=[],g=a;if(Q(a)&&!O(a)){b||(b=a.callback)&&(g.callback=null);var k=a.sort;var h=a.page;c=a.limit;var q=a.threshold;var y=a.suggest;a=a.query}if(this.a){q=this.a.index;var v=g.where,A=g.bool||"or",u=g.field,r=A,D,B;if(u)O(u)||(u=[u]);else if(O(g)){var C=g;u=[];r=[];for(var z=0;z<g.length;z++)d=g[z],e=d.bool||A,u[z]=d.field,r[z]=e,"not"===e?D=!0:"and"===e&&(B=!0)}else u=this.a.keys;A=u.length;for(z=0;z<A;z++)C&&(g=C[z]),h&&!X(g)&&(g.page=null,g.limit=0),f[z]=
|
||||||
limit:b,content:g});return}if(c)return c(m.call(this,a,u,f,h,b,y,w,k,z,F));if(this.async){var B=this;return new Promise(function(oa){Promise.all(f).then(function(Ha){oa(m.call(B,a,u,Ha,h,b,y,w,k,z,F))})})}return m.call(this,a,u,f,h,b,y,w,k,z,F)}t||(t=this.threshold||0);if(!d){if(this.async&&"function"!==typeof importScripts){var J=this;t=new Promise(function(oa){setTimeout(function(){oa(J.search(g,b,null,!0));J=null})});if(c)t.then(c);else return t;return this}if(c)return c(this.search(g,b,null,!0)),
|
q[u[z]].search(g,0);if(b)return b(m.call(this,a,r,f,k,c,y,v,h,B,D));if(this.async){var x=this;return new Promise(function(oa){Promise.all(f).then(function(Ha){oa(m.call(x,a,r,Ha,k,c,y,v,h,B,D))})})}return m.call(this,a,r,f,k,c,y,v,h,B,D)}q||(q=this.threshold||0);if(this.i)for(this.H=b,this.D=0,this.A=[],q=0;q<this.i;q++)this.b[q].postMessage({search:!0,limit:c,content:g});else{if(!d){if(this.async&&"function"!==typeof importScripts){var J=this;q=new Promise(function(oa){setTimeout(function(){oa(J.search(g,
|
||||||
this}if(!a||!X(a))return f;g=a;if(this.cache)if(this.o){if(c=this.v.get(a))return c}else this.v.clear(),this.o=!0;g=this.encode(g);if(!g.length)return f;c=this.g;c=da(c)?c(g):g.split(this.split);this.filter&&(c=ba(c,this.filter));C=c.length;d=!0;e=[];var P=G(),Y=0;1<C&&(this.depth&&"strict"===this.g?A=!0:c.sort(V));if(!A||(x=this.s))for(var ha=this.c;Y<C;Y++){var L=c[Y];if(L){if(A){if(!r)if(x[L])r=L,P[L]=1;else if(!y)return f;if(y&&Y===C-1&&!e.length)A=!1,L=r||L,P[L]=0;else if(!r)continue}if(!P[L]){var M=
|
c,null,!0));J=null})});if(b)q.then(b);else return q;return this}if(b)return b(this.search(g,c,null,!0)),this}if(!a||!X(a))return f;g=a;if(this.cache)if(this.m){if(b=this.v.get(a))return b}else this.v.clear(),this.m=!0;g=this.encode(g);if(!g.length)return f;b=this.g;b=da(b)?b(g):g.split(this.split);this.filter&&(b=ba(b,this.filter));C=b.length;d=!0;e=[];var R=G(),Y=0;1<C&&(this.depth&&"strict"===this.g?A=!0:b.sort(V));if(!A||(z=this.o))for(var ha=this.c;Y<C;Y++){var M=b[Y];if(M){if(A){if(!u)if(z[M])u=
|
||||||
[],aa=!1,S=0,T=A?x[r]:this.u;if(T)for(var ea=void 0,R=0;R<ha-t;R++)if(ea=T[R]&&T[R][L])M[S++]=ea,aa=!0;if(aa)r=L,e[e.length]=1<S?M.concat.apply([],M):M[0];else if(!y){d=!1;break}P[L]=1}}}else d=!1;d&&(f=ua(e,b,k,y));this.cache&&this.v.set(a,f);return f};p.prototype.find=function(a,b){return this.where(a,b,1)[0]||null};p.prototype.where=function(a,b,c,d){var e=this.m,f=[],g=0,h;if(U(a)){c||(c=b);var k=Object.keys(a);var t=k.length;var y=!1;if(1===t&&"id"===k[0])return[e[a.id]];if((h=this.I)&&!d)for(var w=
|
M,R[M]=1;else if(!y)return f;if(y&&Y===C-1&&!e.length)A=!1,M=u||M,R[M]=0;else if(!u)continue}if(!R[M]){var N=[],aa=!1,T=0,U=A?z[u]:this.u;if(U)for(var ea=void 0,S=0;S<ha-q;S++)if(ea=U[S]&&U[S][M])N[T++]=ea,aa=!0;if(aa)u=M,e[e.length]=1<T?N.concat.apply([],N):N[0];else if(!y){d=!1;break}R[M]=1}}}else d=!1;d&&(f=ua(e,c,h,y));this.cache&&this.v.set(a,f);return f}};p.prototype.find=function(a,c){return this.where(a,c,1)[0]||null};p.prototype.where=function(a,c,b,d){var e=this.s,f=[],g=0,k;if(Q(a)){b||
|
||||||
0;w<h.length;w++){var A=h[w],r=a[A];if(!Q(r)){var u=this.B[A]["@"+r];if(0===--t)return u;k.splice(k.indexOf(A),1);delete a[A];break}}h=Array(t);for(w=0;w<t;w++)h[w]=k[w].split(":")}else{if(da(a)){b=d||Object.keys(e);c=b.length;for(k=0;k<c;k++)t=e[b[k]],a(t)&&(f[g++]=t);return f}if(Q(b))return[e[a]];if("id"===a)return[e[b]];k=[a];t=1;h=[a.split(":")];y=!0}d=u||d||Object.keys(e);w=d.length;for(A=0;A<w;A++){r=u?d[A]:e[d[A]];for(var F=!0,z=0;z<t;z++){y||(b=a[k[z]]);var C=h[z],x=C.length,B=r;if(1<x)for(var J=
|
(b=c);var h=Object.keys(a);var q=h.length;var y=!1;if(1===q&&"id"===h[0])return[e[a.id]];if((k=this.I)&&!d)for(var v=0;v<k.length;v++){var A=k[v],u=a[A];if(!I(u)){var r=this.B[A]["@"+u];if(0===--q)return r;h.splice(h.indexOf(A),1);delete a[A];break}}k=Array(q);for(v=0;v<q;v++)k[v]=h[v].split(":")}else{if(da(a)){c=d||Object.keys(e);b=c.length;for(h=0;h<b;h++)q=e[c[h]],a(q)&&(f[g++]=q);return f}if(I(c))return[e[a]];if("id"===a)return[e[c]];h=[a];q=1;k=[a.split(":")];y=!0}d=r||d||Object.keys(e);v=d.length;
|
||||||
0;J<x;J++)B=B[C[J]];else B=B[C[0]];if(B!==b){F=!1;break}}if(F&&(f[g++]=r,c&&g===c))break}return f};p.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:la.length+(this.h?this.h.length:0),worker:this.i,threshold:this.threshold,depth:this.depth,resolution:this.c,contextual:this.depth&&"strict"===this.g}};p.prototype.clear=function(){return this.destroy().init()};
|
for(A=0;A<v;A++){u=r?d[A]:e[d[A]];for(var D=!0,B=0;B<q;B++){y||(c=a[h[B]]);var C=k[B],z=C.length,x=u;if(1<z)for(var J=0;J<z;J++)x=x[C[J]];else x=x[C[0]];if(x!==c){D=!1;break}}if(D&&(f[g++]=u,b&&g===b))break}return f};p.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:la.length+(this.h?this.h.length:0),worker:this.i,threshold:this.threshold,
|
||||||
p.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};p.prototype.export=function(){if(this.a){var a=this.a.keys;var b=Array(a.length+1);for(var 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}else b=[this.u,this.s,Object.keys(this.f)];return JSON.stringify(b)};p.prototype.import=function(a){a=JSON.parse(a);
|
depth:this.depth,resolution:this.c,contextual:this.depth&&"strict"===this.g}};p.prototype.clear=function(){return this.destroy().init()};p.prototype.destroy=function(){this.cache&&(this.v.clear(),this.v=null);this.u=this.o=this.f=null;if(this.a){for(var a=this.a.keys,c=0;c<a.length;c++)this.a.index[a[c]].destroy();this.a=this.s=null}return this};p.prototype.export=function(a){var c=!a||I(a.serialize)||a.serialize;if(this.a){var b=!a||I(a.doc)||a.doc,d=!a||I(a.index)||a.index;a=[];var e=0;if(d)for(d=
|
||||||
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 ia={icase:function(a){return a.toLowerCase()},simple:function(){var a=[l("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",l("[\u00e8\u00e9\u00ea\u00eb]"),"e",l("[\u00ec\u00ed\u00ee\u00ef]"),"i",l("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",
|
this.a.keys;e<d.length;e++){var f=this.a.index[d[e]];a[e]=[f.u,f.o,Object.keys(f.f)]}b&&(a[e]=this.s)}else a=[this.u,this.o,Object.keys(this.f)];c&&(a=JSON.stringify(a));return a};p.prototype.import=function(a,c){if(!c||I(c.serialize)||c.serialize)a=JSON.parse(a);var b=G();if(this.a){var d=!c||I(c.doc)||c.doc,e=0;if(!c||I(c.index)||c.index){c=this.a.keys;for(var f=c.length,g=a[0][2];e<g.length;e++)b[g[e]]=1;for(e=0;e<f;e++)g=this.a.index[c[e]],g.u=a[e][0],g.o=a[e][1],g.f=b}d&&(this.s=Q(d)?d:a[e])}else{d=
|
||||||
l("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",l("[\u00fd\u0177\u00ff]"),"y",l("\u00f1"),"n",l("[\u00e7c]"),"k",l("\u00df"),"s",l(" & ")," and ",l("[-/]")," ",l("[^a-z0-9 ]"),"",l("\\s+")," "];return function(b){b=E(b.toLowerCase(),a);return" "===b?"":b}}(),advanced:function(){var a=[l("ae"),"a",l("ai"),"ei",l("ay"),"ei",l("ey"),"ei",l("oe"),"o",l("ue"),"u",l("ie"),"i",l("sz"),"s",l("zs"),"s",l("sh"),"s",l("ck"),"k",l("cc"),"k",l("th"),"t",l("dt"),"t",l("ph"),"f",l("pf"),"f",l("ou"),"o",l("uo"),"u"];return function(b,
|
a[2];for(e=0;e<d.length;e++)b[d[e]]=1;this.u=a[0];this.o=a[1];this.f=b}};var Ia=function(){var a=l("\\s+"),c=l("[^a-z0-9 ]"),b=[l("[-/]")," ",c,"",a," "];return function(d){return L(F(d.toLowerCase(),b))}}(),ia={icase:function(a){return a.toLowerCase()},simple:function(){var a=l("\\s+"),c=l("[^a-z0-9 ]"),b=l("[-/]"),d=l("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),e=l("[\u00e8\u00e9\u00ea\u00eb]"),f=l("[\u00ec\u00ed\u00ee\u00ef]"),g=l("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),k=l("[\u00f9\u00fa\u00fb\u00fc\u0171]"),
|
||||||
c){if(!b)return b;b=this.simple(b);2<b.length&&(b=E(b,a));c||1<b.length&&(b=K(b));return b}}(),extra:function(){var a=[l("p"),"b",l("z"),"s",l("[cgq]"),"k",l("n"),"m",l("d"),"t",l("[vw]"),"f",l("[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]+E(d.substring(1),a))}b=b.join(" ");b=K(b)}return b}}(),balance:function(){var a=[l("[-/]")," ",l("[^a-z0-9 ]"),"",l("\\s+")," "];return function(b){return K(E(b.toLowerCase(),
|
h=l("[\u00fd\u0177\u00ff]"),q=l("\u00f1"),y=l("[\u00e7c]"),v=l("\u00df"),A=l(" & "),u=[d,"a",e,"e",f,"i",g,"o",k,"u",h,"y",q,"n",y,"k",v,"s",A," and ",b," ",c,"",a," "];return function(r){r=F(r.toLowerCase(),u);return" "===r?"":r}}(),advanced:function(){var a=l("ae"),c=l("ai"),b=l("ay"),d=l("ey"),e=l("oe"),f=l("ue"),g=l("ie"),k=l("sz"),h=l("zs"),q=l("ck"),y=l("cc"),v=l("sh"),A=l("th"),u=l("dt"),r=l("ph"),D=l("pf"),B=l("ou"),C=l("uo"),z=[a,"a",c,"ei",b,"ei",d,"ei",e,"o",f,"u",g,"i",k,"s",h,"s",v,"s",
|
||||||
a))}}()},Ga=function(){function a(b){this.clear();this.J=!0!==b&&b}a.prototype.clear=function(){this.cache=G();this.count=G();this.index=G();this.C=[]};a.prototype.set=function(b,c){if(this.J&&Q(this.cache[b])){var d=this.C.length;if(d===this.J){d--;var e=this.C[d];delete this.cache[e];delete this.count[e];delete this.index[e]}this.index[b]=d;this.C[d]=b;this.count[b]=-1;this.cache[b]=c;this.get(b)}else this.cache[b]=c};a.prototype.get=function(b){var c=this.cache[b];if(this.J&&c){var d=++this.count[b],
|
q,"k",y,"k",A,"t",u,"t",r,"f",D,"f",B,"o",C,"u"];return function(x,J){if(!x)return x;x=this.simple(x);2<x.length&&(x=F(x,z));J||1<x.length&&(x=L(x));return x}}(),extra:function(){var a=l("p"),c=l("z"),b=l("[cgq]"),d=l("n"),e=l("d"),f=l("[vw]"),g=l("[aeiouy]"),k=[a,"b",c,"s",b,"k",d,"m",e,"t",f,"f",g,""];return function(h){if(!h)return h;h=this.advanced(h,!0);if(1<h.length){h=h.split(" ");for(var q=0;q<h.length;q++){var y=h[q];1<y.length&&(h[q]=y[0]+F(y.substring(1),k))}h=h.join(" ");h=L(h)}return h}}(),
|
||||||
e=this.index,f=e[b];if(0<f){for(var g=this.C,h=f;this.count[g[--f]]<=d&&-1!==f;);f++;if(f!==h){for(d=h;d>f;d--)h=g[d-1],g[d]=h,e[h]=d;g[f]=b;e[b]=f}}}return c};return a}();return p}(function(){var n={},q="undefined"!==typeof Blob&&"undefined"!==typeof URL&&URL.createObjectURL;return function(p,D,I,ba,m){I=q?URL.createObjectURL(new Blob(["("+I.toString()+")()"],{type:"text/javascript"})):p+".es5.js";p+="-"+D;n[p]||(n[p]=[]);n[p][m]=new Worker(I);n[p][m].onmessage=ba;console.log("Register Worker: "+
|
balance:Ia},Ga=function(){function a(c){this.clear();this.J=!0!==c&&c}a.prototype.clear=function(){this.cache=G();this.count=G();this.index=G();this.C=[]};a.prototype.set=function(c,b){if(this.J&&I(this.cache[c])){var d=this.C.length;if(d===this.J){d--;var e=this.C[d];delete this.cache[e];delete this.count[e];delete this.index[e]}this.index[c]=d;this.C[d]=c;this.count[c]=-1;this.cache[c]=b;this.get(c)}else this.cache[c]=b};a.prototype.get=function(c){var b=this.cache[c];if(this.J&&b){var d=++this.count[c],
|
||||||
|
e=this.index,f=e[c];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]=c;e[c]=f}}}return b};return a}();return p}(function(){var n={},t="undefined"!==typeof Blob&&"undefined"!==typeof URL&&URL.createObjectURL;return function(p,E,K,ba,m){K=t?URL.createObjectURL(new Blob(["("+K.toString()+")()"],{type:"text/javascript"})):p+".es5.js";p+="-"+E;n[p]||(n[p]=[]);n[p][m]=new Worker(K);n[p][m].onmessage=ba;console.log("Register Worker: "+
|
||||||
p+"@"+m);return n[p][m]}}()),this);
|
p+"@"+m);return n[p][m]}}()),this);
|
||||||
|
27
dist/flexsearch.light.js
vendored
27
dist/flexsearch.light.js
vendored
@@ -1,19 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
FlexSearch v0.6.22
|
FlexSearch v0.6.24
|
||||||
Copyright 2019 Nextapps GmbH
|
Copyright 2019 Nextapps GmbH
|
||||||
Author: Thomas Wilkerling
|
Author: Thomas Wilkerling
|
||||||
Released under the Apache 2.0 Licence
|
Released under the Apache 2.0 Licence
|
||||||
https://github.com/nextapps-de/flexsearch
|
https://github.com/nextapps-de/flexsearch
|
||||||
*/
|
*/
|
||||||
'use strict';(function(n,C,D){let x;(x=D.define)&&x.amd?x([],function(){return C}):(x=D.modules)?x[n.toLowerCase()]=C:"object"===typeof exports?module.exports=C:D[n]=C})("FlexSearch",function(){function n(a,b){const c=b?b.id:a&&a.id;this.id=c||0===c?c:S++;this.init(a,b);D(this,"index",function(){return Object.keys(this.c)});D(this,"length",function(){return this.index.length})}function C(a,b){const c=a.length,g=G(b),e=[];for(let h=0,f=0;h<c;h++){const d=a[h];if(g&&b(d)||!g&&!b[d])e[f++]=d}return e}
|
'use strict';(function(n,C,D){let t;(t=D.define)&&t.amd?t([],function(){return C}):(t=D.modules)?t[n.toLowerCase()]=C:"object"===typeof exports?module.exports=C:D[n]=C})("FlexSearch",function(){function n(a,b){const c=b?b.id:a&&a.id;this.id=c||0===c?c:T++;this.init(a,b);D(this,"index",function(){return Object.keys(this.c)});D(this,"length",function(){return this.index.length})}function C(a,b){const c=a.length,g=G(b),d=[];for(let h=0,f=0;h<c;h++){const e=a[h];if(g&&b(e)||!g&&!b[e])d[f++]=e}return d}
|
||||||
function D(a,b,c){Object.defineProperty(a,b,{get:c})}function x(a,b){for(let c=0;c<b.length;c+=2)a=a.replace(b[c],b[c+1]);return a}function H(a,b,c,g,e,h,f,d){if(b[c])return b[c];e=e?(d-(f||d/1.5))*h+(f||d/1.5)*e:h;b[c]=e;e>=f&&(a=a[d-(e+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=g);return e}function L(a,b){if(a){const c=Object.keys(a);for(let g=0,e=c.length;g<e;g++){const h=c[g],f=a[h];if(f)for(let d=0,k=f.length;d<k;d++)if(f[d]===b){1===k?delete a[h]:f.splice(d,1);break}else"object"===typeof f[d]&&L(f[d],
|
function D(a,b,c){Object.defineProperty(a,b,{get:c})}function t(a){return new RegExp(a,"g")}function J(a,b){for(let c=0;c<b.length;c+=2)a=a.replace(b[c],b[c+1]);return a}function H(a,b,c,g,d,h,f,e){if(b[c])return b[c];d=d?(e-(f||e/1.5))*h+(f||e/1.5)*d:h;b[c]=d;d>=f&&(a=a[e-(d+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=g);return d}function M(a,b){if(a){const c=Object.keys(a);for(let g=0,d=c.length;g<d;g++){const h=c[g],f=a[h];if(f)for(let e=0,k=f.length;e<k;e++)if(f[e]===b){1===k?delete a[h]:f.splice(e,
|
||||||
b)}}}function T(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function M(a,b,c){return a?{page:a,next:b?""+b:null,result:c}:c}function I(a){return"string"===typeof a}function G(a){return"function"===typeof a}function J(a){return"undefined"===typeof a}function O(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=y();return b}function y(){return Object.create(null)}const B={encode:"icase",b:"forward",split:/\W+/,cache:!1,async:!1,m:!1,i:!1,l:!1,a:9,threshold:0,depth:0},N=[];let S=0;const P={},Q={};n.create=
|
1);break}else"object"===typeof f[e]&&M(f[e],b)}}}function U(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function N(a,b,c){return a?{page:a,next:b?""+b:null,result:c}:c}function I(a){return"string"===typeof a}function G(a){return"function"===typeof a}function K(a){return"undefined"===typeof a}function P(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=y();return b}function y(){return Object.create(null)}const B={encode:"icase",b:"forward",split:/\W+/,cache:!1,async:!1,m:!1,i:!1,l:!1,a:9,threshold:0,depth:0},
|
||||||
function(a,b){return new n(a,b)};n.registerMatcher=function(a){for(const b in a)a.hasOwnProperty(b)&&N.push(new RegExp(b,"g"),a[b]);return this};n.registerEncoder=function(a,b){E[a]=b.bind(E);return this};n.registerLanguage=function(a,b){P[a]=b.filter;Q[a]=b.stemmer;return this};n.encode=function(a,b){return E[a](b)};n.prototype.init=function(a,b){this.j=[];if(b){var c=b.preset;a=b}else a||(a=B),c=a.preset;b={};this.b=a.tokenize||b.b||this.b||B.b;this.split=a.split||this.split||B.split;this.i=a.rtl||
|
O=[];let T=0;const Q={},R={};n.create=function(a,b){return new n(a,b)};n.registerMatcher=function(a){for(const b in a)a.hasOwnProperty(b)&&O.push(t(b),a[b]);return this};n.registerEncoder=function(a,b){E[a]=b.bind(E);return this};n.registerLanguage=function(a,b){Q[a]=b.filter;R[a]=b.stemmer;return this};n.encode=function(a,b){return E[a](b)};n.prototype.init=function(a,b){this.j=[];if(b){var c=b.preset;a=b}else a||(a=B),c=a.preset;b={};this.b=a.tokenize||b.b||this.b||B.b;this.split=a.split||this.split||
|
||||||
this.i||B.i;this.threshold=J(c=a.threshold)?b.threshold||this.threshold||B.threshold:c;this.a=J(c=a.resolution)?c=b.a||this.a||B.a:c;c<=this.threshold&&(this.a=this.threshold+1);this.depth="strict"!==this.b||J(c=a.depth)?b.depth||this.depth||B.depth:c;this.g=(c=J(c=a.encode)?b.encode||B.encode:c)&&E[c]&&E[c].bind(E)||(G(c)?c:this.g||!1);(c=a.matcher)&&this.addMatcher(c);if(c=(b=a.lang)||a.filter){I(c)&&(c=P[c]);if(c.constructor===Array){{var g=this.g;const h=y();for(let f=0;f<c.length;f++){const d=
|
B.split;this.i=a.rtl||this.i||B.i;this.threshold=K(c=a.threshold)?b.threshold||this.threshold||B.threshold:c;this.a=K(c=a.resolution)?c=b.a||this.a||B.a:c;c<=this.threshold&&(this.a=this.threshold+1);this.depth="strict"!==this.b||K(c=a.depth)?b.depth||this.depth||B.depth:c;this.g=(c=K(c=a.encode)?b.encode||B.encode:c)&&E[c]&&E[c].bind(E)||(G(c)?c:this.g||!1);(c=a.matcher)&&this.addMatcher(c);if(c=(b=a.lang)||a.filter){I(c)&&(c=Q[c]);if(c.constructor===Array){{var g=this.g;const h=y();for(let f=0;f<
|
||||||
g?g(c[f]):c[f];h[d]=1}c=h}}this.filter=c}if(c=b||a.stemmer){var e;a=I(c)?Q[c]:c;b=this.g;c=[];for(e in a)a.hasOwnProperty(e)&&(g=b?b(e):e,c.push(new RegExp(g+"($|\\W)","g"),b?b(a[e]):a[e]));this.stemmer=e=c}this.h=O(this.a-(this.threshold||0));this.f=y();this.c=y();return this};n.prototype.encode=function(a){a&&N.length&&(a=x(a,N));a&&this.j.length&&(a=x(a,this.j));a&&this.g&&(a=this.g(a));a&&this.stemmer&&(a=x(a,this.stemmer));return a};n.prototype.addMatcher=function(a){const b=this.j;for(const c in a)a.hasOwnProperty(c)&&
|
c.length;f++){const e=g?g(c[f]):c[f];h[e]=1}c=h}}this.filter=c}if(c=b||a.stemmer){var d;a=I(c)?R[c]:c;b=this.g;c=[];for(d in a)a.hasOwnProperty(d)&&(g=b?b(d):d,c.push(t(g+"($|\\W)"),b?b(a[d]):a[d]));this.stemmer=d=c}this.h=P(this.a-(this.threshold||0));this.f=y();this.c=y();return this};n.prototype.encode=function(a){a&&O.length&&(a=J(a,O));a&&this.j.length&&(a=J(a,this.j));a&&this.g&&(a=this.g(a));a&&this.stemmer&&(a=J(a,this.stemmer));return a};n.prototype.addMatcher=function(a){const b=this.j;
|
||||||
b.push(new RegExp(c,"g"),a[c]);return this};n.prototype.add=function(a,b,c,g,e){if(b&&I(b)&&(a||0===a)){const t="@"+a;if(this.c[t]&&!g)return this.update(a,b);if(!e&&c)return this.add(a,b,null,g,!0),c(),this;b=this.encode(b);if(!b.length)return this;c=this.b;b=G(c)?c(b):b.split(this.split);this.filter&&(b=C(b,this.filter));g=y();g._ctx=y();e=b.length;const r=this.threshold,u=this.depth,v=this.a,p=this.h,m=this.i;for(let q=0;q<e;q++){var h=b[q];if(h){var f=h.length,d=(m?q+1:e-q)/e,k="";switch(c){case "reverse":case "both":for(var l=
|
for(const c in a)a.hasOwnProperty(c)&&b.push(t(c),a[c]);return this};n.prototype.add=function(a,b,c,g,d){if(b&&I(b)&&(a||0===a)){const u="@"+a;if(this.c[u]&&!g)return this.update(a,b);if(!d&&c)return this.add(a,b,null,g,!0),c(),this;b=this.encode(b);if(!b.length)return this;c=this.b;b=G(c)?c(b):b.split(this.split);this.filter&&(b=C(b,this.filter));g=y();g._ctx=y();d=b.length;const r=this.threshold,v=this.depth,w=this.a,p=this.h,m=this.i;for(let q=0;q<d;q++){var h=b[q];if(h){var f=h.length,e=(m?q+
|
||||||
f;--l;)k=h[l]+k,H(p,g,k,a,m?1:(f-l)/f,d,r,v-1);k="";case "forward":for(l=0;l<f;l++)k+=h[l],H(p,g,k,a,m?(l+1)/f:1,d,r,v-1);break;case "full":for(l=0;l<f;l++){const F=(m?l+1:f-l)/f;for(let w=f;w>l;w--)k=h.substring(l,w),H(p,g,k,a,F,d,r,v-1)}break;default:if(f=H(p,g,h,a,1,d,r,v-1),u&&1<e&&f>=r)for(f=g._ctx[h]||(g._ctx[h]=y()),h=this.f[h]||(this.f[h]=O(v-(r||0))),d=q-u,k=q+u+1,0>d&&(d=0),k>e&&(k=e);d<k;d++)d!==q&&H(h,f,b[d],a,0,v-(d<q?q-d:d-q),r,v-1)}}}this.c[t]=1}return this};n.prototype.update=function(a,
|
1:d-q)/d,k="";switch(c){case "reverse":case "both":for(var l=f;--l;)k=h[l]+k,H(p,g,k,a,m?1:(f-l)/f,e,r,w-1);k="";case "forward":for(l=0;l<f;l++)k+=h[l],H(p,g,k,a,m?(l+1)/f:1,e,r,w-1);break;case "full":for(l=0;l<f;l++){const F=(m?l+1:f-l)/f;for(let x=f;x>l;x--)k=h.substring(l,x),H(p,g,k,a,F,e,r,w-1)}break;default:if(f=H(p,g,h,a,1,e,r,w-1),v&&1<d&&f>=r)for(f=g._ctx[h]||(g._ctx[h]=y()),h=this.f[h]||(this.f[h]=P(w-(r||0))),e=q-v,k=q+v+1,0>e&&(e=0),k>d&&(k=d);e<k;e++)e!==q&&H(h,f,b[e],a,0,w-(e<q?q-e:e-
|
||||||
b,c){this.c["@"+a]&&I(b)&&(this.remove(a),this.add(a,b,c,!0));return this};n.prototype.remove=function(a,b,c){const g="@"+a;if(this.c[g]){if(!c&&b)return this.remove(a,null,!0),b(),this;for(b=0;b<this.a-(this.threshold||0);b++)L(this.h[b],a);this.depth&&L(this.f,a);delete this.c[g]}return this};n.prototype.search=function(a,b,c,g){b&&G(b)?(c=b,b=1E3):b||0===b||(b=1E3);var e=[],h=a;if("object"===typeof a){var f=!1;b=a.limit;var d=a.threshold;var k=!1;a=a.query}d||(d=this.threshold||0);if(!g&&c)return c(this.search(h,
|
q),r,w-1)}}}this.c[u]=1}return this};n.prototype.update=function(a,b,c){this.c["@"+a]&&I(b)&&(this.remove(a),this.add(a,b,c,!0));return this};n.prototype.remove=function(a,b,c){const g="@"+a;if(this.c[g]){if(!c&&b)return this.remove(a,null,!0),b(),this;for(b=0;b<this.a-(this.threshold||0);b++)M(this.h[b],a);this.depth&&M(this.f,a);delete this.c[g]}return this};n.prototype.search=function(a,b,c,g){b&&G(b)?(c=b,b=1E3):b||0===b||(b=1E3);var d=[],h=a;if("object"===typeof a){var f=!1;b=a.limit;var e=a.threshold;
|
||||||
b,null,!0)),this;if(!a||!I(a))return e;h=this.encode(a);if(!h.length)return e;a=this.b;a=G(a)?a(h):h.split(this.split);this.filter&&(a=C(a,this.filter));c=a.length;g=!0;h=[];var l=y(),t,r=0;1<c&&(this.depth&&"strict"===this.b?t=!0:a.sort(T));var u;if(!t||(u=this.f))for(var v=this.a;r<c;r++){var p=a[r];if(p){if(t){if(!m)if(u[p]){var m=p;l[p]=1}else if(!k)return e;if(k&&r===c-1&&!h.length)t=!1,p=m||p,l[p]=0;else if(!m)continue}if(!l[p]){var q=[],F=!1;let z=0;if(m=t?u[m]:this.h){let R;for(let K=0;K<
|
var k=!1;a=a.query}e||(e=this.threshold||0);if(!g&&c)return c(this.search(h,b,null,!0)),this;if(!a||!I(a))return d;h=this.encode(a);if(!h.length)return d;a=this.b;a=G(a)?a(h):h.split(this.split);this.filter&&(a=C(a,this.filter));c=a.length;g=!0;h=[];var l=y(),u,r=0;1<c&&(this.depth&&"strict"===this.b?u=!0:a.sort(U));var v;if(!u||(v=this.f))for(var w=this.a;r<c;r++){var p=a[r];if(p){if(u){if(!m)if(v[p]){var m=p;l[p]=1}else if(!k)return d;if(k&&r===c-1&&!h.length)u=!1,p=m||p,l[p]=0;else if(!m)continue}if(!l[p]){var q=
|
||||||
v-d;K++)if(R=m[K]&&m[K][p])q[z++]=R,F=!0}if(F)m=p,h[h.length]=1<z?q.concat.apply([],q):q[0];else{g=!1;break}l[p]=1}}}else g=!1;if(g)a:{let z;e=[];!0===f?(f="0",d=""):d=f&&f.split(":");k=h.length;if(1<k){t=y();m=0;v=!0;g=0;var w;for(d&&(2===d.length?d=!1:d=w=parseInt(d[0],10));m<k;m++){l=m===k-1;u=h[m];c=u.length;if(!c){e=M(f,z,u);break a}if(v)if(A){r=A.length;for(a=0;a<r;a++)t["@"+A[a]]=1;var A=null;v=!1}else{A=u;continue}p=!1;for(a=0;a<c;a++)if(r=u[a],q="@"+r,(F=t[q]||0)&&F===m){if(l){if(!w||--w<
|
[],F=!1;let z=0;if(m=u?v[m]:this.h){let S;for(let L=0;L<w-e;L++)if(S=m[L]&&m[L][p])q[z++]=S,F=!0}if(F)m=p,h[h.length]=1<z?q.concat.apply([],q):q[0];else{g=!1;break}l[p]=1}}}else g=!1;if(g)a:{let z;d=[];!0===f?(f="0",e=""):e=f&&f.split(":");k=h.length;if(1<k){u=y();m=0;w=!0;g=0;var x;for(e&&(2===e.length?e=!1:e=x=parseInt(e[0],10));m<k;m++){l=m===k-1;v=h[m];c=v.length;if(!c){d=N(f,z,v);break a}if(w)if(A){r=A.length;for(a=0;a<r;a++)u["@"+A[a]]=1;var A=null;w=!1}else{A=v;continue}p=!1;for(a=0;a<c;a++)if(r=
|
||||||
g)if(e[g++]=r,b&&g===b){e=M(f,g+(d||0),e);break a}}else t[q]=m+1;p=!0}if(!p)break}A&&(e=A)}else k&&(e=h[0],d&&(d=parseInt(d[0],10)));b&&(A=e.length,d&&d>A&&(d=0),w=d||0,z=w+b,z<A?e=e.slice(w,z):(z=0,w&&(e=e.slice(w))));e=M(f,z,e)}return e};n.prototype.clear=function(){return this.destroy().init()};n.prototype.destroy=function(){this.h=this.f=this.c=null;return this};const E={icase:function(a){return a.toLowerCase()}};return n}(!1),this);
|
v[a],q="@"+r,(F=u[q]||0)&&F===m){if(l){if(!x||--x<g)if(d[g++]=r,b&&g===b){d=N(f,g+(e||0),d);break a}}else u[q]=m+1;p=!0}if(!p)break}A&&(d=A)}else k&&(d=h[0],e&&(e=parseInt(e[0],10)));b&&(A=d.length,e&&e>A&&(e=0),x=e||0,z=x+b,z<A?d=d.slice(x,z):(z=0,x&&(d=d.slice(x))));d=N(f,z,d)}return d};n.prototype.clear=function(){return this.destroy().init()};n.prototype.destroy=function(){this.h=this.f=this.c=null;return this};(function(){const a=t("\\s+"),b=t("[^a-z0-9 ]"),c=[t("[-/]")," ",b,"",a," "];return function(g){{g=
|
||||||
|
J(g.toLowerCase(),c);let h="",f="";var d="";for(let e=0;e<g.length;e++){const k=g[e];if(k!==f)if(e&&"h"===k){if(d="a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d,("a"===f||"e"===f||"i"===f||"o"===f||"u"===f||"y"===f)&&d||" "===f)h+=k}else h+=k;d=e===g.length-1?"":g[e+1];f=k}g=h}return g}})();const E={icase:function(a){return a.toLowerCase()}};return n}(!1),this);
|
||||||
|
71
dist/flexsearch.min.js
vendored
71
dist/flexsearch.min.js
vendored
@@ -1,41 +1,42 @@
|
|||||||
/*
|
/*
|
||||||
FlexSearch v0.6.22
|
FlexSearch v0.6.24
|
||||||
Copyright 2019 Nextapps GmbH
|
Copyright 2019 Nextapps GmbH
|
||||||
Author: Thomas Wilkerling
|
Author: Thomas Wilkerling
|
||||||
Released under the Apache 2.0 Licence
|
Released under the Apache 2.0 Licence
|
||||||
https://github.com/nextapps-de/flexsearch
|
https://github.com/nextapps-de/flexsearch
|
||||||
*/
|
*/
|
||||||
'use strict';(function(I,R,v){let K;(K=v.define)&&K.amd?K([],function(){return R}):(K=v.modules)?K[I.toLowerCase()]=R:"object"===typeof exports?module.exports=R:v[I]=R})("FlexSearch",function ma(I){function v(a,b){const c=b?b.id:a&&a.id;this.id=c||0===c?c:na++;this.init(a,b);fa(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].c):Object.keys(this.c)});fa(this,"length",function(){return this.index.length})}function K(a,b,c,d){this.u!==this.g&&(this.o=this.o.concat(c),this.u++,
|
'use strict';(function(J,R,w){let K;(K=w.define)&&K.amd?K([],function(){return R}):(K=w.modules)?K[J.toLowerCase()]=R:"object"===typeof exports?module.exports=R:w[J]=R})("FlexSearch",function ma(J){function w(a,c){const b=c?c.id:a&&a.id;this.id=b||0===b?b:na++;this.init(a,c);fa(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].c):Object.keys(this.c)});fa(this,"length",function(){return this.index.length})}function K(a,c,b,d){this.u!==this.g&&(this.o=this.o.concat(b),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 S(a){const b=B();for(const c in a)if(a.hasOwnProperty(c)){const d=a[c];b[c]=E(d)?d.slice(0):J(d)?S(d):d}return b}function W(a,b){const c=a.length,d=O(b),e=[];for(let f=0,g=0;f<c;f++){const h=a[f];if(d&&b(h)||!d&&!b[h])e[g++]=h}return e}function P(a,b,c,d,e,f,g,h,l,m){c=ha(c,g?0:e,h,f,b,l,m);let n;h&&(h=c.page,n=c.next,c=c.result);if(g)b=this.where(g,null,e,c);else{b=
|
d&&this.o.length>=d&&(this.u=this.g),this.u===this.g&&(this.cache&&this.l.set(c,this.o),this.F&&this.F(this.o)));return this}function S(a){const c=B();for(const b in a)if(a.hasOwnProperty(b)){const d=a[b];F(d)?c[b]=d.slice(0):H(d)?c[b]=S(d):c[b]=d}return c}function W(a,c){const b=a.length,d=O(c),e=[];for(let f=0,g=0;f<b;f++){const k=a[f];if(d&&c(k)||!d&&!c[k])e[g++]=k}return e}function P(a,c,b,d,e,f,g,k,h,m){b=ha(b,g?0:e,k,f,c,h,m);let n;k&&(k=b.page,n=b.next,b=b.result);if(g)c=this.where(g,null,
|
||||||
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&&(O(d)||(L=d.split(":"),1<L.length?d=oa:(L=L[0],d=pa)),c.sort(d));c=T(h,n,c);this.cache&&this.l.set(a,c);return c}function fa(a,b,c){Object.defineProperty(a,b,{get:c})}function q(a){return new RegExp(a,"g")}function Q(a,b){for(let c=0;c<b.length;c+=2)a=a.replace(b[c],b[c+1]);return a}function V(a,b,c,d,e,f,g,h){if(b[c])return b[c];e=e?(h-(g||h/1.5))*f+(g||h/1.5)*e:f;b[c]=e;e>=g&&(a=a[h-(e+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=
|
e,b);else{c=b;b=this.i;e=c.length;f=Array(e);for(g=0;g<e;g++)f[g]=b[c[g]];c=f}b=c;d&&(O(d)||(L=d.split(":"),1<L.length?d=oa:(L=L[0],d=pa)),b.sort(d));b=T(k,n,b);this.cache&&this.l.set(a,b);return b}function fa(a,c,b){Object.defineProperty(a,c,{get:b})}function r(a){return new RegExp(a,"g")}function Q(a,c){for(let b=0;b<c.length;b+=2)a=a.replace(c[b],c[b+1]);return a}function V(a,c,b,d,e,f,g,k){if(c[b])return c[b];e=e?(k-(g||k/1.5))*f+(g||k/1.5)*e:f;c[b]=e;e>=g&&(a=a[k-(e+.5>>0)],a=a[b]||(a[b]=[]),
|
||||||
d);return e}function ba(a,b){if(a){const c=Object.keys(a);for(let d=0,e=c.length;d<e;d++){const f=c[d],g=a[f];if(g)for(let h=0,l=g.length;h<l;h++)if(g[h]===b){1===l?delete a[f]:g.splice(h,1);break}else J(g[h])&&ba(g[h],b)}}}function ca(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}
|
a[a.length]=d);return e}function ba(a,c){if(a){const b=Object.keys(a);for(let d=0,e=b.length;d<e;d++){const f=b[d],g=a[f];if(g)for(let k=0,h=g.length;k<h;k++)if(g[k]===c){1===h?delete a[f]:g.splice(k,1);break}else H(g[k])&&ba(g[k],c)}}}function ca(a){let c="",b="";var d="";for(let e=0;e<a.length;e++){const f=a[e];if(f!==b)if(e&&"h"===f){if(d="a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d,("a"===b||"e"===b||"i"===b||"o"===b||"u"===b||"y"===b)&&d||" "===b)c+=f}else c+=f;d=e===a.length-1?"":a[e+
|
||||||
function qa(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function pa(a,b){a=a[L];b=b[L];return a<b?-1:a>b?1:0}function oa(a,b){const c=L.length;for(let d=0;d<c;d++)a=a[L[d]],b=b[L[d]];return a<b?-1:a>b?1:0}function T(a,b,c){return a?{page:a,next:b?""+b:null,result:c}:c}function ha(a,b,c,d,e,f,g){let h,l=[];if(!0===c){c="0";var m=""}else m=c&&c.split(":");const n=a.length;if(1<n){const y=B(),r=[];let w,x;var p=0,k;let G;var u=!0;let C,D=0,N,da,X,ea;m&&(2===m.length?(X=m,m=!1):m=ea=parseInt(m[0],10));
|
1];b=f}return c}function qa(a,c){a=a.length-c.length;return 0>a?1:a?-1:0}function pa(a,c){a=a[L];c=c[L];return a<c?-1:a>c?1:0}function oa(a,c){const b=L.length;for(let d=0;d<b;d++)a=a[L[d]],c=c[L[d]];return a<c?-1:a>c?1:0}function T(a,c,b){return a?{page:a,next:c?""+c:null,result:b}:b}function ha(a,c,b,d,e,f,g){let k,h=[];if(!0===b){b="0";var m=""}else m=b&&b.split(":");const n=a.length;if(1<n){const y=B(),t=[];let v,x;var p=0,l;let I;var u=!0;let D,E=0,N,da,X,ea;m&&(2===m.length?(X=m,m=!1):m=ea=
|
||||||
if(g){for(w=B();p<n;p++)if("not"===e[p])for(x=a[p],G=x.length,k=0;k<G;k++)w["@"+x[k]]=1;else da=p+1;if(H(da))return T(c,h,l);p=0}else N=M(e)&&e;let Y;for(;p<n;p++){const ra=p===(da||n)-1;if(!N||!p)if((k=N||e&&e[p])&&"and"!==k)if("or"===k)Y=!1;else continue;else Y=f=!0;x=a[p];if(G=x.length){if(u)if(C){var t=C.length;for(k=0;k<t;k++){u=C[k];var A="@"+u;g&&w[A]||(y[A]=1,f||(l[D++]=u))}C=null;u=!1}else{C=x;continue}A=!1;for(k=0;k<G;k++){t=x[k];var z="@"+t;const Z=f?y[z]||0:p;if(!(!Z&&!d||g&&w[z]||!f&&
|
parseInt(m[0],10));if(g){for(v=B();p<n;p++)if("not"===e[p])for(x=a[p],I=x.length,l=0;l<I;l++)v["@"+x[l]]=1;else da=p+1;if(C(da))return T(b,k,h);p=0}else N=M(e)&&e;let Y;for(;p<n;p++){const ra=p===(da||n)-1;if(!N||!p)if((l=N||e&&e[p])&&"and"!==l)if("or"===l)Y=!1;else continue;else Y=f=!0;x=a[p];if(I=x.length){if(u)if(D){var q=D.length;for(l=0;l<q;l++){u=D[l];var A="@"+u;g&&v[A]||(y[A]=1,f||(h[E++]=u))}D=null;u=!1}else{D=x;continue}A=!1;for(l=0;l<I;l++){q=x[l];var z="@"+q;const Z=f?y[z]||0:p;if(!(!Z&&
|
||||||
y[z]))if(Z===p){if(ra){if(!ea||--ea<D)if(l[D++]=t,b&&D===b)return T(c,D+(m||0),l)}else y[z]=p+1;A=!0}else d&&(z=r[Z]||(r[Z]=[]),z[z.length]=t)}if(Y&&!A&&!d)break}else if(Y&&!d)return T(c,h,x)}if(C)if(p=C.length,g)for(k=m?parseInt(m,10):0;k<p;k++)a=C[k],w["@"+a]||(l[D++]=a);else l=C;if(d)for(D=l.length,X?(p=parseInt(X[0],10)+1,k=parseInt(X[1],10)+1):(p=r.length,k=0);p--;)if(t=r[p]){for(G=t.length;k<G;k++)if(d=t[k],!g||!w["@"+d])if(l[D++]=d,b&&D===b)return T(c,p+":"+k,l);k=0}}else!n||e&&"not"===e[0]||
|
!d||g&&v[z]||!f&&y[z]))if(Z===p){if(ra){if(!ea||--ea<E)if(h[E++]=q,c&&E===c)return T(b,E+(m||0),h)}else y[z]=p+1;A=!0}else d&&(z=t[Z]||(t[Z]=[]),z[z.length]=q)}if(Y&&!A&&!d)break}else if(Y&&!d)return T(b,k,x)}if(D)if(p=D.length,g)for(l=m?parseInt(m,10):0;l<p;l++)a=D[l],v["@"+a]||(h[E++]=a);else h=D;if(d)for(E=h.length,X?(p=parseInt(X[0],10)+1,l=parseInt(X[1],10)+1):(p=t.length,l=0);p--;)if(q=t[p]){for(I=q.length;l<I;l++)if(d=q[l],!g||!v["@"+d])if(h[E++]=d,c&&E===c)return T(b,p+":"+l,h);l=0}}else!n||
|
||||||
(l=a[0],m&&(m=parseInt(m[0],10)));b&&(g=l.length,m&&m>g&&(m=0),m=m||0,h=m+b,h<g?l=l.slice(m,h):(h=0,m&&(l=l.slice(m))));return T(c,h,l)}function M(a){return"string"===typeof a}function E(a){return a.constructor===Array}function O(a){return"function"===typeof a}function J(a){return"object"===typeof a}function H(a){return"undefined"===typeof a}function ia(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=B();return b}function B(){return Object.create(null)}function sa(){let a,b;self.onmessage=function(c){if(c=
|
e&&"not"===e[0]||(h=a[0],m&&(m=parseInt(m[0],10)));c&&(g=h.length,m&&m>g&&(m=0),m=m||0,k=m+c,k<g?h=h.slice(m,k):(k=0,m&&(h=h.slice(m))));return T(b,k,h)}function M(a){return"string"===typeof a}function F(a){return a.constructor===Array}function O(a){return"function"===typeof a}function H(a){return"object"===typeof a}function C(a){return"undefined"===typeof a}function ia(a){const c=Array(a);for(let b=0;b<a;b++)c[b]=B();return c}function B(){return Object.create(null)}function sa(){let a,c;self.onmessage=
|
||||||
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("}"))))(),
|
function(b){if(b=b.data)if(b.search){const d=c.search(b.content,b.threshold?{limit:b.limit,threshold:b.threshold,where:b.where}:b.limit);self.postMessage({id:a,content:b.content,limit:b.limit,result:d})}else b.add?c.add(b.id,b.content):b.update?c.update(b.id,b.content):b.remove?c.remove(b.id):b.clear?c.clear():b.info?(b=c.info(),b.worker=a,console.log(b)):b.register&&(a=b.id,b.options.cache=!1,b.options.async=!1,b.options.worker=!1,c=(new Function(b.register.substring(b.register.indexOf("{")+1,b.register.lastIndexOf("}"))))(),
|
||||||
b=new b(c.options))}}function ta(a,b,c,d){a=I("flexsearch","id"+a,sa,function(f){(f=f.data)&&f.result&&d(f.id,f.content,f.result,f.limit,f.where,f.cursor,f.suggest)},b);const e=ma.toString();c.id=b;a.postMessage({register:e,options:c,id:b});return a}const F={encode:"icase",f:"forward",split:/\W+/,cache:!1,async:!1,g:!1,D:!1,a:!1,b:9,threshold:0,depth:0},ja={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,
|
c=new c(b.options))}}function ta(a,c,b,d){a=J("flexsearch","id"+a,sa,function(f){(f=f.data)&&f.result&&d(f.id,f.content,f.result,f.limit,f.where,f.cursor,f.suggest)},c);const e=ma.toString();b.id=c;a.postMessage({register:e,options:b,id:c});return a}const G={encode:"icase",f:"forward",split:/\W+/,cache:!1,async:!1,g:!1,D:!1,a:!1,b:9,threshold:0,depth:0},ja={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}},aa=[];let na=0;const ka={},la={};v.create=function(a,b){return new v(a,b)};v.registerMatcher=function(a){for(const b in a)a.hasOwnProperty(b)&&aa.push(q(b),a[b]);return this};v.registerEncoder=function(a,b){U[a]=b.bind(U);return this};v.registerLanguage=function(a,b){ka[a]=b.filter;la[a]=b.stemmer;return this};v.encode=
|
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}},aa=[];let na=0;const ka={},la={};w.create=function(a,c){return new w(a,c)};w.registerMatcher=function(a){for(const c in a)a.hasOwnProperty(c)&&aa.push(r(c),a[c]);return this};w.registerEncoder=function(a,c){U[a]=c.bind(U);return this};w.registerLanguage=function(a,c){ka[a]=c.filter;la[a]=c.stemmer;return this};w.encode=
|
||||||
function(a,b){return U[a](b)};v.prototype.init=function(a,b){this.v=[];if(b){var c=b.preset;a=b}else a||(a=F),c=a.preset;b={};M(a)?(b=ja[a],a={}):c&&(b=ja[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]=ta(this.id,e,a,K.bind(this))}this.f=a.tokenize||b.f||this.f||F.f;this.split=a.split||this.split||F.split;this.D=a.rtl||this.D||F.D;this.async="undefined"===typeof Promise||
|
function(a,c){return U[a](c)};w.prototype.init=function(a,c){this.v=[];if(c){var b=c.preset;a=c}else a||(a=G),b=a.preset;c={};M(a)?(c=ja[a],a={}):b&&(c=ja[b]);if(b=a.worker)if("undefined"===typeof Worker)a.worker=!1,this.m=null;else{var d=parseInt(b,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]=ta(this.id,e,a,K.bind(this))}this.f=a.tokenize||c.f||this.f||G.f;this.split=a.split||this.split||G.split;this.D=a.rtl||this.D||G.D;this.async="undefined"===typeof Promise||
|
||||||
H(c=a.async)?this.async||F.async:c;this.g=H(c=a.worker)?this.g||F.g:c;this.threshold=H(c=a.threshold)?b.threshold||this.threshold||F.threshold:c;this.b=H(c=a.resolution)?c=b.b||this.b||F.b:c;c<=this.threshold&&(this.b=this.threshold+1);this.depth="strict"!==this.f||H(c=a.depth)?b.depth||this.depth||F.depth:c;this.w=(c=H(c=a.encode)?b.encode||F.encode:c)&&U[c]&&U[c].bind(U)||(O(c)?c:this.w||!1);(c=a.matcher)&&this.addMatcher(c);if(c=(b=a.lang)||a.filter){M(c)&&(c=ka[c]);if(E(c)){d=this.w;e=B();for(var f=
|
C(b=a.async)?this.async||G.async:b;this.g=C(b=a.worker)?this.g||G.g:b;this.threshold=C(b=a.threshold)?c.threshold||this.threshold||G.threshold:b;this.b=C(b=a.resolution)?b=c.b||this.b||G.b:b;b<=this.threshold&&(this.b=this.threshold+1);this.depth="strict"!==this.f||C(b=a.depth)?c.depth||this.depth||G.depth:b;this.w=(b=C(b=a.encode)?c.encode||G.encode:b)&&U[b]&&U[b].bind(U)||(O(b)?b:this.w||!1);(b=a.matcher)&&this.addMatcher(b);if(b=(c=a.lang)||a.filter){M(b)&&(b=ka[b]);if(F(b)){d=this.w;e=B();for(var f=
|
||||||
0;f<c.length;f++){var g=d?d(c[f]):c[f];e[g]=1}c=e}this.filter=c}if(c=b||a.stemmer){var h;b=M(c)?la[c]:c;d=this.w;e=[];for(h in b)b.hasOwnProperty(h)&&(f=d?d(h):h,e.push(q(f+"($|\\W)"),d?d(b[h]):b[h]));this.stemmer=h=e}this.a=e=(c=a.doc)?S(c):this.a||F.a;this.j=ia(this.b-(this.threshold||0));this.i=B();this.c=B();if(e){this.h=B();a.doc=null;h=e.index={};b=e.keys=[];d=e.field;f=e.tag;E(e.id)||(e.id=e.id.split(":"));if(f){this.G=B();g=B();if(d)if(M(d))g[d]=a;else if(E(d))for(let l=0;l<d.length;l++)g[d[l]]=
|
0;f<b.length;f++){var g=d?d(b[f]):b[f];e[g]=1}b=e}this.filter=b}if(b=c||a.stemmer){var k;c=M(b)?la[b]:b;d=this.w;e=[];for(k in c)c.hasOwnProperty(k)&&(f=d?d(k):k,e.push(r(f+"($|\\W)"),d?d(c[k]):c[k]));this.stemmer=k=e}this.a=e=(b=a.doc)?S(b):this.a||G.a;this.j=ia(this.b-(this.threshold||0));this.h=B();this.c=B();if(e){this.i=B();a.doc=null;k=e.index={};c=e.keys=[];d=e.field;f=e.tag;F(e.id)||(e.id=e.id.split(":"));if(f){this.G=B();g=B();if(d)if(M(d))g[d]=a;else if(F(d))for(let h=0;h<d.length;h++)g[d[h]]=
|
||||||
a;else J(d)&&(g=d);E(f)||(e.tag=f=[f]);for(d=0;d<f.length;d++)this.G[f[d]]=B();this.I=f;d=g}if(d){let l;E(d)||(J(d)?(l=d,e.field=d=Object.keys(d)):e.field=d=[d]);for(e=0;e<d.length;e++)f=d[e],E(f)||(l&&(a=l[f]),b[e]=f,d[e]=f.split(":")),h[f]=new v(a),h[f].h=this.h}}this.B=!0;this.l=(this.cache=c=H(c=a.cache)?this.cache||F.cache:c)?new ua(c):!1;return this};v.prototype.encode=function(a){a&&aa.length&&(a=Q(a,aa));a&&this.v.length&&(a=Q(a,this.v));a&&this.w&&(a=this.w(a));a&&this.stemmer&&(a=Q(a,this.stemmer));
|
a;else H(d)&&(g=d);F(f)||(e.tag=f=[f]);for(d=0;d<f.length;d++)this.G[f[d]]=B();this.I=f;d=g}if(d){let h;F(d)||(H(d)?(h=d,e.field=d=Object.keys(d)):e.field=d=[d]);for(e=0;e<d.length;e++)f=d[e],F(f)||(h&&(a=h[f]),c[e]=f,d[e]=f.split(":")),k[f]=new w(a),k[f].i=this.i}}this.B=!0;this.l=(this.cache=b=C(b=a.cache)?this.cache||G.cache:b)?new ua(b):!1;return this};w.prototype.encode=function(a){a&&aa.length&&(a=Q(a,aa));a&&this.v.length&&(a=Q(a,this.v));a&&this.w&&(a=this.w(a));a&&this.stemmer&&(a=Q(a,this.stemmer));
|
||||||
return a};v.prototype.addMatcher=function(a){const b=this.v;for(const c in a)a.hasOwnProperty(c)&&b.push(q(c),a[c]);return this};v.prototype.add=function(a,b,c,d,e){if(this.a&&J(a))return this.A("add",a,b);if(b&&M(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 r=this;f=new Promise(function(w){setTimeout(function(){r.add(a,
|
return a};w.prototype.addMatcher=function(a){const c=this.v;for(const b in a)a.hasOwnProperty(b)&&c.push(r(b),a[b]);return this};w.prototype.add=function(a,c,b,d,e){if(this.a&&H(a))return this.A("add",a,c);if(c&&M(c)&&(a||0===a)){var f="@"+a;if(this.c[f]&&!d)return this.update(a,c);if(this.g)return++this.C>=this.m.length&&(this.C=0),this.m[this.C].postMessage({add:!0,id:a,content:c}),this.c[f]=""+this.C,b&&b(),this;if(!e){if(this.async&&"function"!==typeof importScripts){let t=this;f=new Promise(function(v){setTimeout(function(){t.add(a,
|
||||||
b,null,d,!0);r=null;w()})});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=O(c)?c(b):b.split(this.split);this.filter&&(e=W(e,this.filter));const p=B();p._ctx=B();const k=e.length,u=this.threshold,t=this.depth,A=this.b,z=this.j,y=this.D;for(let r=0;r<k;r++){var g=e[r];if(g){var h=g.length,l=(y?r+1:k-r)/k,m="";switch(c){case "reverse":case "both":for(var n=h;--n;)m=g[n]+m,V(z,p,m,a,y?1:(h-n)/h,l,u,A-1);m="";
|
c,null,d,!0);t=null;v()})});if(b)f.then(b);else return f;return this}if(b)return this.add(a,c,null,d,!0),b(),this}c=this.encode(c);if(!c.length)return this;b=this.f;e=O(b)?b(c):c.split(this.split);this.filter&&(e=W(e,this.filter));const p=B();p._ctx=B();const l=e.length,u=this.threshold,q=this.depth,A=this.b,z=this.j,y=this.D;for(let t=0;t<l;t++){var g=e[t];if(g){var k=g.length,h=(y?t+1:l-t)/l,m="";switch(b){case "reverse":case "both":for(var n=k;--n;)m=g[n]+m,V(z,p,m,a,y?1:(k-n)/k,h,u,A-1);m="";
|
||||||
case "forward":for(n=0;n<h;n++)m+=g[n],V(z,p,m,a,y?(n+1)/h:1,l,u,A-1);break;case "full":for(n=0;n<h;n++){const w=(y?n+1:h-n)/h;for(let x=h;x>n;x--)m=g.substring(n,x),V(z,p,m,a,w,l,u,A-1)}break;default:if(h=V(z,p,g,a,1,l,u,A-1),t&&1<k&&h>=u)for(h=p._ctx[g]||(p._ctx[g]=B()),g=this.i[g]||(this.i[g]=ia(A-(u||0))),l=r-t,m=r+t+1,0>l&&(l=0),m>k&&(m=k);l<m;l++)l!==r&&V(g,h,e[l],a,0,A-(l<r?r-l:l-r),u,A-1)}}}this.c[f]=1;this.B=!1}return this};v.prototype.A=function(a,b,c){if(E(b))for(let l=0,m=b.length;l<m;l++){if(l===
|
case "forward":for(n=0;n<k;n++)m+=g[n],V(z,p,m,a,y?(n+1)/k:1,h,u,A-1);break;case "full":for(n=0;n<k;n++){const v=(y?n+1:k-n)/k;for(let x=k;x>n;x--)m=g.substring(n,x),V(z,p,m,a,v,h,u,A-1)}break;default:if(k=V(z,p,g,a,1,h,u,A-1),q&&1<l&&k>=u)for(k=p._ctx[g]||(p._ctx[g]=B()),g=this.h[g]||(this.h[g]=ia(A-(u||0))),h=t-q,m=t+q+1,0>h&&(h=0),m>l&&(m=l);h<m;h++)h!==t&&V(g,k,e[h],a,0,A-(h<t?t-h:h-t),u,A-1)}}}this.c[f]=1;this.B=!1}return this};w.prototype.A=function(a,c,b){if(F(c))for(let h=0,m=c.length;h<m;h++){if(h===
|
||||||
m-1)return this.A(a,b[l],c);this.A(a,b[l])}else{const l=this.a.index,m=this.a.keys;var d=this.a.tag,e=this.a.id;let n;let p;for(var f=0;f<e.length;f++)n=(n||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++)p=(p||b)[h[f]];p="@"+p}h=this.G[g];h=h[p]||(h[p]=[])}if("remove"===a){delete this.h[n];for(let k=0,u=m.length;k<u;k++){if(k===u-1)return l[m[k]].remove(n,c),this;l[m[k]].remove(n)}}e=this.a.field;h&&(h[h.length]=b);this.h[n]=b;for(let k=0,u=e.length;k<
|
m-1)return this.A(a,c[h],b);this.A(a,c[h])}else{const h=this.a.index,m=this.a.keys;var d=this.a.tag,e=this.a.id;let n;let p;for(var f=0;f<e.length;f++)n=(n||c)[e[f]];if(d){for(e=0;e<d.length;e++){var g=d[e];var k=g.split(":");for(f=0;f<k.length;f++)p=(p||c)[k[f]];p="@"+p}k=this.G[g];k=k[p]||(k[p]=[])}if("remove"===a){delete this.i[n];for(let l=0,u=m.length;l<u;l++){if(l===u-1)return h[m[l]].remove(n,b),this;h[m[l]].remove(n)}}e=this.a.field;k&&(k[k.length]=c);this.i[n]=c;for(let l=0,u=e.length;l<
|
||||||
u;k++){d=e[k];let t;for(g=0;g<d.length;g++)t=(t||b)[d[g]];d=l[m[k]];g="add"===a?d.add:d.update;k===u-1?g.call(d,n,t,c):g.call(d,n,t)}}return this};v.prototype.update=function(a,b,c){if(this.a&&J(a))return this.A("update",a,b);this.c["@"+a]&&M(b)&&(this.remove(a),this.add(a,b,c,!0));return this};v.prototype.remove=function(a,b,c){if(this.a&&J(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&&
|
u;l++){d=e[l];let q;for(g=0;g<d.length;g++)q=(q||c)[d[g]];d=h[m[l]];g="add"===a?d.add:d.update;l===u-1?g.call(d,n,q,b):g.call(d,n,q)}}return this};w.prototype.update=function(a,c,b){if(this.a&&H(a))return this.A("update",a,c);this.c["@"+a]&&M(c)&&(this.remove(a),this.add(a,c,b,!0));return this};w.prototype.remove=function(a,c,b){if(this.a&&H(a))return this.A("remove",a,c);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],c&&c(),this;if(!b){if(this.async&&
|
||||||
"function"!==typeof importScripts){let e=this;d=new Promise(function(f){setTimeout(function(){e.remove(a,null,!0);e=null;f()})});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++)ba(this.j[b],a);this.depth&&ba(this.i,a);delete this.c[d];this.B=!1}return this};let L;v.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=1E3}else b&&O(b)?(c=b,b=1E3):b||0===b||(b=1E3);
|
"function"!==typeof importScripts){let e=this;d=new Promise(function(f){setTimeout(function(){e.remove(a,null,!0);e=null;f()})});if(c)d.then(c);else return d;return this}if(c)return this.remove(a,null,!0),c(),this}for(c=0;c<this.b-(this.threshold||0);c++)ba(this.j[c],a);this.depth&&ba(this.h,a);delete this.c[d];this.B=!1}return this};let L;w.prototype.search=function(a,c,b,d){if(H(c)){if(F(c))for(var e=0;e<c.length;e++)c[e].query=a;else c.query=a;a=c;c=1E3}else c&&O(c)?(b=c,c=1E3):c||0===c||(c=1E3);
|
||||||
let f=[],g=a;let h,l,m;if(J(a)&&!E(a)){c||(c=a.callback)&&(g.callback=null);l=a.sort;h=a.page;b=a.limit;var n=a.threshold;m=a.suggest;a=a.query}if(this.a){n=this.a.index;const y=g.where;var p=g.bool||"or",k=g.field;let r=p;let w,x;if(k)E(k)||(k=[k]);else if(E(g)){var u=g;k=[];r=[];for(var t=0;t<g.length;t++)d=g[t],e=d.bool||p,k[t]=d.field,r[t]=e,"not"===e?w=!0:"and"===e&&(x=!0)}else k=this.a.keys;p=k.length;for(t=0;t<p;t++)u&&(g=u[t]),h&&!M(g)&&(g.page=null,g.limit=0),f[t]=n[k[t]].search(g,0);if(this.g){this.F=
|
let f=[],g=a;let k,h,m;if(H(a)&&!F(a)){b||(b=a.callback)&&(g.callback=null);h=a.sort;k=a.page;c=a.limit;var n=a.threshold;m=a.suggest;a=a.query}if(this.a){n=this.a.index;const y=g.where;var p=g.bool||"or",l=g.field;let t=p;let v,x;if(l)F(l)||(l=[l]);else if(F(g)){var u=g;l=[];t=[];for(var q=0;q<g.length;q++)d=g[q],e=d.bool||p,l[q]=d.field,t[q]=e,"not"===e?v=!0:"and"===e&&(x=!0)}else l=this.a.keys;p=l.length;for(q=0;q<p;q++)u&&(g=u[q]),k&&!M(g)&&(g.page=null,g.limit=0),f[q]=n[l[q]].search(g,0);if(b)return b(P.call(this,
|
||||||
c;this.u=0;this.o=[];for(n=0;n<this.g;n++)this.m[n].postMessage({search:!0,limit:b,content:g});return}if(c)return c(P.call(this,a,r,f,l,b,m,y,h,x,w));if(this.async){const G=this;return new Promise(function(C){Promise.all(f).then(function(D){C(P.call(G,a,r,D,l,b,m,y,h,x,w))})})}return P.call(this,a,r,f,l,b,m,y,h,x,w)}n||(n=this.threshold||0);if(!d){if(this.async&&"function"!==typeof importScripts){let y=this;n=new Promise(function(r){setTimeout(function(){r(y.search(g,b,null,!0));y=null})});if(c)n.then(c);
|
a,t,f,h,c,m,y,k,x,v));if(this.async){const I=this;return new Promise(function(D){Promise.all(f).then(function(E){D(P.call(I,a,t,E,h,c,m,y,k,x,v))})})}return P.call(this,a,t,f,h,c,m,y,k,x,v)}n||(n=this.threshold||0);if(this.g)for(this.F=b,this.u=0,this.o=[],n=0;n<this.g;n++)this.m[n].postMessage({search:!0,limit:c,content:g});else{if(!d){if(this.async&&"function"!==typeof importScripts){let y=this;n=new Promise(function(t){setTimeout(function(){t(y.search(g,c,null,!0));y=null})});if(b)n.then(b);else return n;
|
||||||
else return n;return this}if(c)return c(this.search(g,b,null,!0)),this}if(!a||!M(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=O(c)?c(g):g.split(this.split);this.filter&&(c=W(c,this.filter));u=c.length;d=!0;e=[];const A=B();let z=0;1<u&&(this.depth&&"strict"===this.f?p=!0:c.sort(qa));if(!p||(t=this.i)){const y=this.b;for(;z<u;z++){let r=c[z];if(r){if(p){if(!k)if(t[r])k=r,A[r]=1;else if(!m)return f;
|
return this}if(b)return b(this.search(g,c,null,!0)),this}if(!a||!M(a))return f;g=a;if(this.cache)if(this.B){if(b=this.l.get(a))return b}else this.l.clear(),this.B=!0;g=this.encode(g);if(!g.length)return f;b=this.f;b=O(b)?b(g):g.split(this.split);this.filter&&(b=W(b,this.filter));u=b.length;d=!0;e=[];var A=B(),z=0;1<u&&(this.depth&&"strict"===this.f?p=!0:b.sort(qa));if(!p||(q=this.h)){const y=this.b;for(;z<u;z++){let t=b[z];if(t){if(p){if(!l)if(q[t])l=t,A[t]=1;else if(!m)return f;if(m&&z===u-1&&!e.length)p=
|
||||||
if(m&&z===u-1&&!e.length)p=!1,r=k||r,A[r]=0;else if(!k)continue}if(!A[r]){const w=[];let x=!1,G=0;const C=p?t[k]:this.j;if(C){let D;for(let N=0;N<y-n;N++)if(D=C[N]&&C[N][r])w[G++]=D,x=!0}if(x)k=r,e[e.length]=1<G?w.concat.apply([],w):w[0];else if(!m){d=!1;break}A[r]=1}}}}else d=!1;d&&(f=ha(e,b,h,m));this.cache&&this.l.set(a,f);return f};v.prototype.find=function(a,b){return this.where(a,b,1)[0]||null};v.prototype.where=function(a,b,c,d){const e=this.h,f=[];let g=0;let h;var l;let m;if(J(a)){c||(c=
|
!1,t=l||t,A[t]=0;else if(!l)continue}if(!A[t]){const v=[];let x=!1,I=0;const D=p?q[l]:this.j;if(D){let E;for(let N=0;N<y-n;N++)if(E=D[N]&&D[N][t])v[I++]=E,x=!0}if(x)l=t,e[e.length]=1<I?v.concat.apply([],v):v[0];else if(!m){d=!1;break}A[t]=1}}}}else d=!1;d&&(f=ha(e,c,k,m));this.cache&&this.l.set(a,f);return f}};w.prototype.find=function(a,c){return this.where(a,c,1)[0]||null};w.prototype.where=function(a,c,b,d){const e=this.i,f=[];let g=0;let k;var h;let m;if(H(a)){b||(b=c);var n=Object.keys(a);var p=
|
||||||
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 k=0;k<l.length;k++){var u=l[k],t=a[u];if(!H(t)){m=this.G[u]["@"+t];if(0===--p)return m;n.splice(n.indexOf(u),1);delete a[u];break}}l=Array(p);for(k=0;k<p;k++)l[k]=n[k].split(":")}else{if(O(a)){b=d||Object.keys(e);c=b.length;for(n=0;n<c;n++)p=e[b[n]],a(p)&&(f[g++]=p);return f}if(H(b))return[e[a]];if("id"===a)return[e[b]];n=[a];p=1;l=[a.split(":")];h=!0}d=m||d||Object.keys(e);k=d.length;for(u=
|
n.length;k=!1;if(1===p&&"id"===n[0])return[e[a.id]];if((h=this.I)&&!d)for(var l=0;l<h.length;l++){var u=h[l],q=a[u];if(!C(q)){m=this.G[u]["@"+q];if(0===--p)return m;n.splice(n.indexOf(u),1);delete a[u];break}}h=Array(p);for(l=0;l<p;l++)h[l]=n[l].split(":")}else{if(O(a)){c=d||Object.keys(e);b=c.length;for(n=0;n<b;n++)p=e[c[n]],a(p)&&(f[g++]=p);return f}if(C(c))return[e[a]];if("id"===a)return[e[c]];n=[a];p=1;h=[a.split(":")];k=!0}d=m||d||Object.keys(e);l=d.length;for(u=0;u<l;u++){q=m?d[u]:e[d[u]];let A=
|
||||||
0;u<k;u++){t=m?d[u]:e[d[u]];let A=!0;for(let z=0;z<p;z++){h||(b=a[n[z]]);const y=l[z],r=y.length;let w=t;if(1<r)for(let x=0;x<r;x++)w=w[y[x]];else w=w[y[0]];if(w!==b){A=!1;break}}if(A&&(f[g++]=t,c&&g===c))break}return f};v.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:aa.length+(this.v?this.v.length:0),worker:this.g,threshold:this.threshold,
|
!0;for(let z=0;z<p;z++){k||(c=a[n[z]]);const y=h[z],t=y.length;let v=q;if(1<t)for(let x=0;x<t;x++)v=v[y[x]];else v=v[y[0]];if(v!==c){A=!1;break}}if(A&&(f[g++]=q,b&&g===b))break}return f};w.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:aa.length+(this.v?this.v.length:0),worker:this.g,threshold:this.threshold,depth:this.depth,resolution:this.b,
|
||||||
depth:this.depth,resolution:this.b,contextual:this.depth&&"strict"===this.f}};v.prototype.clear=function(){return this.destroy().init()};v.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};v.prototype.export=function(){let a;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]=
|
contextual:this.depth&&"strict"===this.f}};w.prototype.clear=function(){return this.destroy().init()};w.prototype.destroy=function(){this.cache&&(this.l.clear(),this.l=null);this.j=this.h=this.c=null;if(this.a){const a=this.a.keys;for(let c=0;c<a.length;c++)this.a.index[a[c]].destroy();this.a=this.i=null}return this};w.prototype.export=function(a){const c=!a||C(a.serialize)||a.serialize;if(this.a){const d=!a||C(a.doc)||a.doc;var b=!a||C(a.index)||a.index;a=[];let e=0;if(b)for(b=this.a.keys;e<b.length;e++){const f=
|
||||||
[d.j,d.i,Object.keys(d.c)]}a[c]=this.h}else a=[this.j,this.i,Object.keys(this.c)];return JSON.stringify(a)};v.prototype.import=function(a){a=JSON.parse(a);const b=B();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 U={icase:function(a){return a.toLowerCase()},simple:function(){const a=[q("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),
|
this.a.index[b[e]];a[e]=[f.j,f.h,Object.keys(f.c)]}d&&(a[e]=this.i)}else a=[this.j,this.h,Object.keys(this.c)];c&&(a=JSON.stringify(a));return a};w.prototype.import=function(a,c){if(!c||C(c.serialize)||c.serialize)a=JSON.parse(a);const b=B();if(this.a){var d=!c||C(c.doc)||c.doc,e=0;if(!c||C(c.index)||c.index){c=this.a.keys;const g=c.length;for(var f=a[0][2];e<f.length;e++)b[f[e]]=1;for(e=0;e<g;e++)f=this.a.index[c[e]],f.j=a[e][0],f.h=a[e][1],f.c=b}d&&(this.i=H(d)?d:a[e])}else{d=a[2];for(e=0;e<d.length;e++)b[d[e]]=
|
||||||
"a",q("[\u00e8\u00e9\u00ea\u00eb]"),"e",q("[\u00ec\u00ed\u00ee\u00ef]"),"i",q("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",q("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",q("[\u00fd\u0177\u00ff]"),"y",q("\u00f1"),"n",q("[\u00e7c]"),"k",q("\u00df"),"s",q(" & ")," and ",q("[-/]")," ",q("[^a-z0-9 ]"),"",q("\\s+")," "];return function(b){b=Q(b.toLowerCase(),a);return" "===b?"":b}}(),advanced:function(){const a=[q("ae"),"a",q("ai"),"ei",q("ay"),"ei",q("ey"),"ei",q("oe"),"o",q("ue"),"u",q("ie"),"i",q("sz"),
|
1;this.j=a[0];this.h=a[1];this.c=b}};const va=function(){const a=r("\\s+"),c=r("[^a-z0-9 ]"),b=[r("[-/]")," ",c,"",a," "];return function(d){return ca(Q(d.toLowerCase(),b))}}(),U={icase:function(a){return a.toLowerCase()},simple:function(){const a=r("\\s+"),c=r("[^a-z0-9 ]"),b=r("[-/]"),d=r("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),e=r("[\u00e8\u00e9\u00ea\u00eb]"),f=r("[\u00ec\u00ed\u00ee\u00ef]"),g=r("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),k=r("[\u00f9\u00fa\u00fb\u00fc\u0171]"),h=r("[\u00fd\u0177\u00ff]"),
|
||||||
"s",q("zs"),"s",q("sh"),"s",q("ck"),"k",q("cc"),"k",q("th"),"t",q("dt"),"t",q("ph"),"f",q("pf"),"f",q("ou"),"o",q("uo"),"u"];return function(b,c){if(!b)return b;b=this.simple(b);2<b.length&&(b=Q(b,a));c||1<b.length&&(b=ca(b));return b}}(),extra:function(){const a=[q("p"),"b",q("z"),"s",q("[cgq]"),"k",q("n"),"m",q("d"),"t",q("[vw]"),"f",q("[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]=
|
m=r("\u00f1"),n=r("[\u00e7c]"),p=r("\u00df"),l=r(" & "),u=[d,"a",e,"e",f,"i",g,"o",k,"u",h,"y",m,"n",n,"k",p,"s",l," and ",b," ",c,"",a," "];return function(q){q=Q(q.toLowerCase(),u);return" "===q?"":q}}(),advanced:function(){const a=r("ae"),c=r("ai"),b=r("ay"),d=r("ey"),e=r("oe"),f=r("ue"),g=r("ie"),k=r("sz"),h=r("zs"),m=r("ck"),n=r("cc"),p=r("sh"),l=r("th"),u=r("dt"),q=r("ph"),A=r("pf"),z=r("ou"),y=r("uo"),t=[a,"a",c,"ei",b,"ei",d,"ei",e,"o",f,"u",g,"i",k,"s",h,"s",p,"s",m,"k",n,"k",l,"t",u,"t",
|
||||||
d[0]+Q(d.substring(1),a))}b=b.join(" ");b=ca(b)}return b}}(),balance:function(){const a=[q("[-/]")," ",q("[^a-z0-9 ]"),"",q("\\s+")," "];return function(b){return ca(Q(b.toLowerCase(),a))}}()},ua=function(){function a(b){this.clear();this.H=!0!==b&&b}a.prototype.clear=function(){this.cache=B();this.count=B();this.index=B();this.s=[]};a.prototype.set=function(b,c){if(this.H&&H(this.cache[b])){let d=this.s.length;if(d===this.H){d--;const e=this.s[d];delete this.cache[e];delete this.count[e];delete this.index[e]}this.index[b]=
|
q,"f",A,"f",z,"o",y,"u"];return function(v,x){if(!v)return v;v=this.simple(v);2<v.length&&(v=Q(v,t));x||1<v.length&&(v=ca(v));return v}}(),extra:function(){const a=r("p"),c=r("z"),b=r("[cgq]"),d=r("n"),e=r("d"),f=r("[vw]"),g=r("[aeiouy]"),k=[a,"b",c,"s",b,"k",d,"m",e,"t",f,"f",g,""];return function(h){if(!h)return h;h=this.advanced(h,!0);if(1<h.length){h=h.split(" ");for(let m=0;m<h.length;m++){const n=h[m];1<n.length&&(h[m]=n[0]+Q(n.substring(1),k))}h=h.join(" ");h=ca(h)}return h}}(),balance:va},
|
||||||
d;this.s[d]=b;this.count[b]=-1;this.cache[b]=c;this.get(b)}else this.cache[b]=c};a.prototype.get=function(b){const c=this.cache[b];if(this.H&&c){var d=++this.count[b];const f=this.index;let g=f[b];if(0<g){const h=this.s;for(var e=g;this.count[h[--g]]<=d&&-1!==g;);g++;if(g!==e){for(d=e;d>g;d--)e=h[d-1],h[d]=e,f[e]=d;h[g]=b;f[b]=g}}}return c};return a}();return v}(function(){const I={},R="undefined"!==typeof Blob&&"undefined"!==typeof URL&&URL.createObjectURL;return function(v,K,S,W,P){S=R?URL.createObjectURL(new Blob(["("+
|
ua=function(){function a(c){this.clear();this.H=!0!==c&&c}a.prototype.clear=function(){this.cache=B();this.count=B();this.index=B();this.s=[]};a.prototype.set=function(c,b){if(this.H&&C(this.cache[c])){let d=this.s.length;if(d===this.H){d--;const e=this.s[d];delete this.cache[e];delete this.count[e];delete this.index[e]}this.index[c]=d;this.s[d]=c;this.count[c]=-1;this.cache[c]=b;this.get(c)}else this.cache[c]=b};a.prototype.get=function(c){const b=this.cache[c];if(this.H&&b){var d=++this.count[c];
|
||||||
S.toString()+")()"],{type:"text/javascript"})):v+".min.js";v+="-"+K;I[v]||(I[v]=[]);I[v][P]=new Worker(S);I[v][P].onmessage=W;return I[v][P]}}()),this);
|
const f=this.index;let g=f[c];if(0<g){const k=this.s;for(var e=g;this.count[k[--g]]<=d&&-1!==g;);g++;if(g!==e){for(d=e;d>g;d--)e=k[d-1],k[d]=e,f[e]=d;k[g]=c;f[c]=g}}}return b};return a}();return w}(function(){const J={},R="undefined"!==typeof Blob&&"undefined"!==typeof URL&&URL.createObjectURL;return function(w,K,S,W,P){S=R?URL.createObjectURL(new Blob(["("+S.toString()+")()"],{type:"text/javascript"})):w+".min.js";w+="-"+K;J[w]||(J[w]=[]);J[w][P]=new Worker(S);J[w][P].onmessage=W;return J[w][P]}}()),
|
||||||
|
this);
|
||||||
|
63
dist/flexsearch.node.js
vendored
63
dist/flexsearch.node.js
vendored
@@ -1,37 +1,38 @@
|
|||||||
/*
|
/*
|
||||||
FlexSearch v0.6.22
|
FlexSearch v0.6.24
|
||||||
Copyright 2019 Nextapps GmbH
|
Copyright 2019 Nextapps GmbH
|
||||||
Author: Thomas Wilkerling
|
Author: Thomas Wilkerling
|
||||||
Released under the Apache 2.0 Licence
|
Released under the Apache 2.0 Licence
|
||||||
https://github.com/nextapps-de/flexsearch
|
https://github.com/nextapps-de/flexsearch
|
||||||
*/
|
*/
|
||||||
'use strict';(function(v,N,Q){let J;(J=Q.define)&&J.amd?J([],function(){return N}):(J=Q.modules)?J[v.toLowerCase()]=N:"object"===typeof exports?module.exports=N:Q[v]=N})("FlexSearch",function(){function v(a,b){const c=b?b.id:a&&a.id;this.id=c||0===c?c:ja++;this.init(a,b);ca(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].f):Object.keys(this.f)});ca(this,"length",function(){return this.index.length})}function N(a){const b=B();for(const c in a)if(a.hasOwnProperty(c)){const d=
|
'use strict';(function(w,N,Q){let J;(J=Q.define)&&J.amd?J([],function(){return N}):(J=Q.modules)?J[w.toLowerCase()]=N:"object"===typeof exports?module.exports=N:Q[w]=N})("FlexSearch",function(){function w(a,b){const c=b?b.id:a&&a.id;this.id=c||0===c?c:ja++;this.init(a,b);ca(this,"index",function(){return this.a?Object.keys(this.a.index[this.a.keys[0]].f):Object.keys(this.f)});ca(this,"length",function(){return this.index.length})}function N(a){const b=B();for(const c in a)if(a.hasOwnProperty(c)){const d=
|
||||||
a[c];b[c]=E(d)?d.slice(0):H(d)?N(d):d}return b}function Q(a,b){const c=a.length,d=O(b),e=[];for(let g=0,f=0;g<c;g++){const h=a[g];if(d&&b(h)||!d&&!b[h])e[f++]=h}return e}function J(a,b,c,d,e,g,f,h,l,m){c=da(c,f?0:e,h,g,b,l,m);let p;h&&(h=c.page,p=c.next,c=c.result);if(f)b=this.where(f,null,e,c);else{b=c;c=this.g;e=b.length;g=Array(e);for(f=0;f<e;f++)g[f]=c[b[f]];b=g}c=b;d&&(O(d)||(K=d.split(":"),1<K.length?d=ka:(K=K[0],d=la)),c.sort(d));c=R(h,p,c);this.cache&&this.j.set(a,c);return c}function ca(a,
|
a[c];F(d)?b[c]=d.slice(0):G(d)?b[c]=N(d):b[c]=d}return b}function Q(a,b){const c=a.length,d=O(b),e=[];for(let g=0,f=0;g<c;g++){const k=a[g];if(d&&b(k)||!d&&!b[k])e[f++]=k}return e}function J(a,b,c,d,e,g,f,k,h,m){c=da(c,f?0:e,k,g,b,h,m);let n;k&&(k=c.page,n=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&&(O(d)||(K=d.split(":"),1<K.length?d=ka:(K=K[0],d=la)),c.sort(d));c=R(k,n,c);this.cache&&this.j.set(a,c);return c}function ca(a,
|
||||||
b,c){Object.defineProperty(a,b,{get:c})}function q(a){return new RegExp(a,"g")}function P(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,h){if(b[c])return b[c];e=e?(h-(f||h/1.5))*g+(f||h/1.5)*e:g;b[c]=e;e>=f&&(a=a[h-(e+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=d);return e}function Y(a,b){if(a){const c=Object.keys(a);for(let d=0,e=c.length;d<e;d++){const g=c[d],f=a[g];if(f)for(let h=0,l=f.length;h<l;h++)if(f[h]===b){1===l?delete a[g]:f.splice(h,1);break}else H(f[h])&&
|
b,c){Object.defineProperty(a,b,{get:c})}function r(a){return new RegExp(a,"g")}function P(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,k){if(b[c])return b[c];e=e?(k-(f||k/1.5))*g+(f||k/1.5)*e:g;b[c]=e;e>=f&&(a=a[k-(e+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=d);return e}function Y(a,b){if(a){const c=Object.keys(a);for(let d=0,e=c.length;d<e;d++){const g=c[d],f=a[g];if(f)for(let k=0,h=f.length;k<h;k++)if(f[k]===b){1===h?delete a[g]:f.splice(k,1);break}else G(f[k])&&
|
||||||
Y(f[h],b)}}}function Z(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 ma(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function la(a,b){a=a[K];b=b[K];return a<b?-1:a>b?1:0}function ka(a,b){const c=K.length;for(let d=0;d<c;d++)a=a[K[d]],b=b[K[d]];return a<b?-1:a>b?1:0}function R(a,
|
Y(f[k],b)}}}function Z(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 ma(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function la(a,b){a=a[K];b=b[K];return a<b?-1:a>b?1:0}function ka(a,b){const c=K.length;for(let d=0;d<c;d++)a=a[K[d]],b=b[K[d]];return a<b?-1:a>b?1:0}function R(a,
|
||||||
b,c){return a?{page:a,next:b?""+b:null,result:c}:c}function da(a,b,c,d,e,g,f){let h,l=[];if(!0===c){c="0";var m=""}else m=c&&c.split(":");const p=a.length;if(1<p){const y=B(),r=[];let w,x;var n=0,k;let F;var u=!0;let C,D=0,M,aa,U,ba;m&&(2===m.length?(U=m,m=!1):m=ba=parseInt(m[0],10));if(f){for(w=B();n<p;n++)if("not"===e[n])for(x=a[n],F=x.length,k=0;k<F;k++)w["@"+x[k]]=1;else aa=n+1;if(I(aa))return R(c,h,l);n=0}else M=L(e)&&e;let V;for(;n<p;n++){const na=n===(aa||p)-1;if(!M||!n)if((k=M||e&&e[n])&&
|
b,c){return a?{page:a,next:b?""+b:null,result:c}:c}function da(a,b,c,d,e,g,f){let k,h=[];if(!0===c){c="0";var m=""}else m=c&&c.split(":");const n=a.length;if(1<n){const y=B(),t=[];let v,x;var p=0,l;let H;var u=!0;let D,E=0,M,aa,U,ba;m&&(2===m.length?(U=m,m=!1):m=ba=parseInt(m[0],10));if(f){for(v=B();p<n;p++)if("not"===e[p])for(x=a[p],H=x.length,l=0;l<H;l++)v["@"+x[l]]=1;else aa=p+1;if(C(aa))return R(c,k,h);p=0}else M=L(e)&&e;let V;for(;p<n;p++){const na=p===(aa||n)-1;if(!M||!p)if((l=M||e&&e[p])&&
|
||||||
"and"!==k)if("or"===k)V=!1;else continue;else V=g=!0;x=a[n];if(F=x.length){if(u)if(C){var t=C.length;for(k=0;k<t;k++){u=C[k];var A="@"+u;f&&w[A]||(y[A]=1,g||(l[D++]=u))}C=null;u=!1}else{C=x;continue}A=!1;for(k=0;k<F;k++){t=x[k];var z="@"+t;const W=g?y[z]||0:n;if(!(!W&&!d||f&&w[z]||!g&&y[z]))if(W===n){if(na){if(!ba||--ba<D)if(l[D++]=t,b&&D===b)return R(c,D+(m||0),l)}else y[z]=n+1;A=!0}else d&&(z=r[W]||(r[W]=[]),z[z.length]=t)}if(V&&!A&&!d)break}else if(V&&!d)return R(c,h,x)}if(C)if(n=C.length,f)for(k=
|
"and"!==l)if("or"===l)V=!1;else continue;else V=g=!0;x=a[p];if(H=x.length){if(u)if(D){var q=D.length;for(l=0;l<q;l++){u=D[l];var A="@"+u;f&&v[A]||(y[A]=1,g||(h[E++]=u))}D=null;u=!1}else{D=x;continue}A=!1;for(l=0;l<H;l++){q=x[l];var z="@"+q;const W=g?y[z]||0:p;if(!(!W&&!d||f&&v[z]||!g&&y[z]))if(W===p){if(na){if(!ba||--ba<E)if(h[E++]=q,b&&E===b)return R(c,E+(m||0),h)}else y[z]=p+1;A=!0}else d&&(z=t[W]||(t[W]=[]),z[z.length]=q)}if(V&&!A&&!d)break}else if(V&&!d)return R(c,k,x)}if(D)if(p=D.length,f)for(l=
|
||||||
m?parseInt(m,10):0;k<n;k++)a=C[k],w["@"+a]||(l[D++]=a);else l=C;if(d)for(D=l.length,U?(n=parseInt(U[0],10)+1,k=parseInt(U[1],10)+1):(n=r.length,k=0);n--;)if(t=r[n]){for(F=t.length;k<F;k++)if(d=t[k],!f||!w["@"+d])if(l[D++]=d,b&&D===b)return R(c,n+":"+k,l);k=0}}else!p||e&&"not"===e[0]||(l=a[0],m&&(m=parseInt(m[0],10)));b&&(f=l.length,m&&m>f&&(m=0),m=m||0,h=m+b,h<f?l=l.slice(m,h):(h=0,m&&(l=l.slice(m))));return R(c,h,l)}function L(a){return"string"===typeof a}function E(a){return a.constructor===Array}
|
m?parseInt(m,10):0;l<p;l++)a=D[l],v["@"+a]||(h[E++]=a);else h=D;if(d)for(E=h.length,U?(p=parseInt(U[0],10)+1,l=parseInt(U[1],10)+1):(p=t.length,l=0);p--;)if(q=t[p]){for(H=q.length;l<H;l++)if(d=q[l],!f||!v["@"+d])if(h[E++]=d,b&&E===b)return R(c,p+":"+l,h);l=0}}else!n||e&&"not"===e[0]||(h=a[0],m&&(m=parseInt(m[0],10)));b&&(f=h.length,m&&m>f&&(m=0),m=m||0,k=m+b,k<f?h=h.slice(m,k):(k=0,m&&(h=h.slice(m))));return R(c,k,h)}function L(a){return"string"===typeof a}function F(a){return a.constructor===Array}
|
||||||
function O(a){return"function"===typeof a}function H(a){return"object"===typeof a}function I(a){return"undefined"===typeof a}function ea(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=B();return b}function B(){return Object.create(null)}const G={encode:"icase",c:"forward",split:/\W+/,cache:!1,async:!1,C:!1,v:!1,a:!1,b:9,threshold:0,depth:0},fa={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},
|
function O(a){return"function"===typeof a}function G(a){return"object"===typeof a}function C(a){return"undefined"===typeof a}function ea(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=B();return b}function B(){return Object.create(null)}const I={encode:"icase",c:"forward",split:/\W+/,cache:!1,async:!1,C:!1,v:!1,a:!1,b:9,threshold:0,depth:0},fa={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}},X=[];let ja=0;const ha={},ia={};v.create=function(a,b){return new v(a,b)};v.registerMatcher=function(a){for(const b in a)a.hasOwnProperty(b)&&X.push(q(b),a[b]);return this};v.registerEncoder=function(a,b){S[a]=b.bind(S);return this};v.registerLanguage=function(a,b){ha[a]=b.filter;ia[a]=b.stemmer;return this};v.encode=function(a,
|
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}},X=[];let ja=0;const ha={},ia={};w.create=function(a,b){return new w(a,b)};w.registerMatcher=function(a){for(const b in a)a.hasOwnProperty(b)&&X.push(r(b),a[b]);return this};w.registerEncoder=function(a,b){S[a]=b.bind(S);return this};w.registerLanguage=function(a,b){ha[a]=b.filter;ia[a]=b.stemmer;return this};w.encode=function(a,
|
||||||
b){return S[a](b)};v.prototype.init=function(a,b){this.m=[];if(b){var c=b.preset;a=b}else a||(a=G),c=a.preset;b={};L(a)?(b=fa[a],a={}):c&&(b=fa[c]);this.c=a.tokenize||b.c||this.c||G.c;this.split=a.split||this.split||G.split;this.v=a.rtl||this.v||G.v;this.async="undefined"===typeof Promise||I(c=a.async)?this.async||G.async:c;this.threshold=I(c=a.threshold)?b.threshold||this.threshold||G.threshold:c;this.b=I(c=a.resolution)?c=b.b||this.b||G.b:c;c<=this.threshold&&(this.b=this.threshold+1);this.depth=
|
b){return S[a](b)};w.prototype.init=function(a,b){this.m=[];if(b){var c=b.preset;a=b}else a||(a=I),c=a.preset;b={};L(a)?(b=fa[a],a={}):c&&(b=fa[c]);this.c=a.tokenize||b.c||this.c||I.c;this.split=a.split||this.split||I.split;this.v=a.rtl||this.v||I.v;this.async="undefined"===typeof Promise||C(c=a.async)?this.async||I.async:c;this.threshold=C(c=a.threshold)?b.threshold||this.threshold||I.threshold:c;this.b=C(c=a.resolution)?c=b.b||this.b||I.b:c;c<=this.threshold&&(this.b=this.threshold+1);this.depth=
|
||||||
"strict"!==this.c||I(c=a.depth)?b.depth||this.depth||G.depth:c;this.o=(c=I(c=a.encode)?b.encode||G.encode:c)&&S[c]&&S[c].bind(S)||(O(c)?c:this.o||!1);(c=a.matcher)&&this.addMatcher(c);if(c=(b=a.lang)||a.filter){L(c)&&(c=ha[c]);if(E(c)){var d=this.o,e=B();for(var g=0;g<c.length;g++){var f=d?d(c[g]):c[g];e[f]=1}c=e}this.filter=c}if(c=b||a.stemmer){var h;b=L(c)?ia[c]:c;d=this.o;e=[];for(h in b)b.hasOwnProperty(h)&&(g=d?d(h):h,e.push(q(g+"($|\\W)"),d?d(b[h]):b[h]));this.stemmer=h=e}this.a=e=(c=a.doc)?
|
"strict"!==this.c||C(c=a.depth)?b.depth||this.depth||I.depth:c;this.o=(c=C(c=a.encode)?b.encode||I.encode:c)&&S[c]&&S[c].bind(S)||(O(c)?c:this.o||!1);(c=a.matcher)&&this.addMatcher(c);if(c=(b=a.lang)||a.filter){L(c)&&(c=ha[c]);if(F(c)){var d=this.o,e=B();for(var g=0;g<c.length;g++){var f=d?d(c[g]):c[g];e[f]=1}c=e}this.filter=c}if(c=b||a.stemmer){var k;b=L(c)?ia[c]:c;d=this.o;e=[];for(k in b)b.hasOwnProperty(k)&&(g=d?d(k):k,e.push(r(g+"($|\\W)"),d?d(b[k]):b[k]));this.stemmer=k=e}this.a=e=(c=a.doc)?
|
||||||
N(c):this.a||G.a;this.i=ea(this.b-(this.threshold||0));this.h=B();this.f=B();if(e){this.g=B();a.doc=null;h=e.index={};b=e.keys=[];d=e.field;g=e.tag;E(e.id)||(e.id=e.id.split(":"));if(g){this.w=B();f=B();if(d)if(L(d))f[d]=a;else if(E(d))for(let l=0;l<d.length;l++)f[d[l]]=a;else H(d)&&(f=d);E(g)||(e.tag=g=[g]);for(d=0;d<g.length;d++)this.w[g[d]]=B();this.B=g;d=f}if(d){let l;E(d)||(H(d)?(l=d,e.field=d=Object.keys(d)):e.field=d=[d]);for(e=0;e<d.length;e++)g=d[e],E(g)||(l&&(a=l[g]),b[e]=g,d[e]=g.split(":")),
|
N(c):this.a||I.a;this.i=ea(this.b-(this.threshold||0));this.g=B();this.f=B();if(e){this.h=B();a.doc=null;k=e.index={};b=e.keys=[];d=e.field;g=e.tag;F(e.id)||(e.id=e.id.split(":"));if(g){this.w=B();f=B();if(d)if(L(d))f[d]=a;else if(F(d))for(let h=0;h<d.length;h++)f[d[h]]=a;else G(d)&&(f=d);F(g)||(e.tag=g=[g]);for(d=0;d<g.length;d++)this.w[g[d]]=B();this.B=g;d=f}if(d){let h;F(d)||(G(d)?(h=d,e.field=d=Object.keys(d)):e.field=d=[d]);for(e=0;e<d.length;e++)g=d[e],F(g)||(h&&(a=h[g]),b[e]=g,d[e]=g.split(":")),
|
||||||
h[g]=new v(a),h[g].g=this.g}}this.u=!0;this.j=(this.cache=c=I(c=a.cache)?this.cache||G.cache:c)?new oa(c):!1;return this};v.prototype.encode=function(a){a&&X.length&&(a=P(a,X));a&&this.m.length&&(a=P(a,this.m));a&&this.o&&(a=this.o(a));a&&this.stemmer&&(a=P(a,this.stemmer));return a};v.prototype.addMatcher=function(a){const b=this.m;for(const c in a)a.hasOwnProperty(c)&&b.push(q(c),a[c]);return this};v.prototype.add=function(a,b,c,d,e){if(this.a&&H(a))return this.s("add",a,b);if(b&&L(b)&&(a||0===
|
k[g]=new w(a),k[g].h=this.h}}this.u=!0;this.j=(this.cache=c=C(c=a.cache)?this.cache||I.cache:c)?new oa(c):!1;return this};w.prototype.encode=function(a){a&&X.length&&(a=P(a,X));a&&this.m.length&&(a=P(a,this.m));a&&this.o&&(a=this.o(a));a&&this.stemmer&&(a=P(a,this.stemmer));return a};w.prototype.addMatcher=function(a){const b=this.m;for(const c in a)a.hasOwnProperty(c)&&b.push(r(c),a[c]);return this};w.prototype.add=function(a,b,c,d,e){if(this.a&&G(a))return this.s("add",a,b);if(b&&L(b)&&(a||0===
|
||||||
a)){var g="@"+a;if(this.f[g]&&!d)return this.update(a,b);if(!e){if(this.async){let r=this;g=new Promise(function(w){setTimeout(function(){r.add(a,b,null,d,!0);r=null;w()})});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.c;e=O(c)?c(b):b.split(this.split);this.filter&&(e=Q(e,this.filter));const n=B();n._ctx=B();const k=e.length,u=this.threshold,t=this.depth,A=this.b,z=this.i,y=this.v;for(let r=0;r<k;r++){var f=
|
a)){var g="@"+a;if(this.f[g]&&!d)return this.update(a,b);if(!e){if(this.async){let t=this;g=new Promise(function(v){setTimeout(function(){t.add(a,b,null,d,!0);t=null;v()})});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.c;e=O(c)?c(b):b.split(this.split);this.filter&&(e=Q(e,this.filter));const p=B();p._ctx=B();const l=e.length,u=this.threshold,q=this.depth,A=this.b,z=this.i,y=this.v;for(let t=0;t<l;t++){var f=
|
||||||
e[r];if(f){var h=f.length,l=(y?r+1:k-r)/k,m="";switch(c){case "reverse":case "both":for(var p=h;--p;)m=f[p]+m,T(z,n,m,a,y?1:(h-p)/h,l,u,A-1);m="";case "forward":for(p=0;p<h;p++)m+=f[p],T(z,n,m,a,y?(p+1)/h:1,l,u,A-1);break;case "full":for(p=0;p<h;p++){const w=(y?p+1:h-p)/h;for(let x=h;x>p;x--)m=f.substring(p,x),T(z,n,m,a,w,l,u,A-1)}break;default:if(h=T(z,n,f,a,1,l,u,A-1),t&&1<k&&h>=u)for(h=n._ctx[f]||(n._ctx[f]=B()),f=this.h[f]||(this.h[f]=ea(A-(u||0))),l=r-t,m=r+t+1,0>l&&(l=0),m>k&&(m=k);l<m;l++)l!==
|
e[t];if(f){var k=f.length,h=(y?t+1:l-t)/l,m="";switch(c){case "reverse":case "both":for(var n=k;--n;)m=f[n]+m,T(z,p,m,a,y?1:(k-n)/k,h,u,A-1);m="";case "forward":for(n=0;n<k;n++)m+=f[n],T(z,p,m,a,y?(n+1)/k:1,h,u,A-1);break;case "full":for(n=0;n<k;n++){const v=(y?n+1:k-n)/k;for(let x=k;x>n;x--)m=f.substring(n,x),T(z,p,m,a,v,h,u,A-1)}break;default:if(k=T(z,p,f,a,1,h,u,A-1),q&&1<l&&k>=u)for(k=p._ctx[f]||(p._ctx[f]=B()),f=this.g[f]||(this.g[f]=ea(A-(u||0))),h=t-q,m=t+q+1,0>h&&(h=0),m>l&&(m=l);h<m;h++)h!==
|
||||||
r&&T(f,h,e[l],a,0,A-(l<r?r-l:l-r),u,A-1)}}}this.f[g]=1;this.u=!1}return this};v.prototype.s=function(a,b,c){if(E(b))for(let l=0,m=b.length;l<m;l++){if(l===m-1)return this.s(a,b[l],c);this.s(a,b[l])}else{const l=this.a.index,m=this.a.keys;var d=this.a.tag,e=this.a.id;let p;let n;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++)n=(n||b)[h[g]];n="@"+n}h=this.w[f];h=h[n]||(h[n]=[])}if("remove"===a){delete this.g[p];for(let k=
|
t&&T(f,k,e[h],a,0,A-(h<t?t-h:h-t),u,A-1)}}}this.f[g]=1;this.u=!1}return this};w.prototype.s=function(a,b,c){if(F(b))for(let h=0,m=b.length;h<m;h++){if(h===m-1)return this.s(a,b[h],c);this.s(a,b[h])}else{const h=this.a.index,m=this.a.keys;var d=this.a.tag,e=this.a.id;let n;let p;for(var g=0;g<e.length;g++)n=(n||b)[e[g]];if(d){for(e=0;e<d.length;e++){var f=d[e];var k=f.split(":");for(g=0;g<k.length;g++)p=(p||b)[k[g]];p="@"+p}k=this.w[f];k=k[p]||(k[p]=[])}if("remove"===a){delete this.h[n];for(let l=
|
||||||
0,u=m.length;k<u;k++){if(k===u-1)return l[m[k]].remove(p,c),this;l[m[k]].remove(p)}}e=this.a.field;h&&(h[h.length]=b);this.g[p]=b;for(let k=0,u=e.length;k<u;k++){d=e[k];let t;for(f=0;f<d.length;f++)t=(t||b)[d[f]];d=l[m[k]];f="add"===a?d.add:d.update;k===u-1?f.call(d,p,t,c):f.call(d,p,t)}}return this};v.prototype.update=function(a,b,c){if(this.a&&H(a))return this.s("update",a,b);this.f["@"+a]&&L(b)&&(this.remove(a),this.add(a,b,c,!0));return this};v.prototype.remove=function(a,b,c){if(this.a&&H(a))return this.s("remove",
|
0,u=m.length;l<u;l++){if(l===u-1)return h[m[l]].remove(n,c),this;h[m[l]].remove(n)}}e=this.a.field;k&&(k[k.length]=b);this.h[n]=b;for(let l=0,u=e.length;l<u;l++){d=e[l];let q;for(f=0;f<d.length;f++)q=(q||b)[d[f]];d=h[m[l]];f="add"===a?d.add:d.update;l===u-1?f.call(d,n,q,c):f.call(d,n,q)}}return this};w.prototype.update=function(a,b,c){if(this.a&&G(a))return this.s("update",a,b);this.f["@"+a]&&L(b)&&(this.remove(a),this.add(a,b,c,!0));return this};w.prototype.remove=function(a,b,c){if(this.a&&G(a))return this.s("remove",
|
||||||
a,b);var d="@"+a;if(this.f[d]){if(!c){if(this.async&&"function"!==typeof importScripts){let e=this;d=new Promise(function(g){setTimeout(function(){e.remove(a,null,!0);e=null;g()})});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++)Y(this.i[b],a);this.depth&&Y(this.h,a);delete this.f[d];this.u=!1}return this};let K;v.prototype.search=function(a,b,c,d){if(H(b)){if(E(b))for(var e=0;e<b.length;e++)b[e].query=a;else b.query=a;
|
a,b);var d="@"+a;if(this.f[d]){if(!c){if(this.async&&"function"!==typeof importScripts){let e=this;d=new Promise(function(g){setTimeout(function(){e.remove(a,null,!0);e=null;g()})});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++)Y(this.i[b],a);this.depth&&Y(this.g,a);delete this.f[d];this.u=!1}return this};let K;w.prototype.search=function(a,b,c,d){if(G(b)){if(F(b))for(var e=0;e<b.length;e++)b[e].query=a;else b.query=a;
|
||||||
a=b;b=1E3}else b&&O(b)?(c=b,b=1E3):b||0===b||(b=1E3);let g=[],f=a;let h,l,m;if(H(a)&&!E(a)){c||(c=a.callback)&&(f.callback=null);l=a.sort;h=a.page;b=a.limit;var p=a.threshold;m=a.suggest;a=a.query}if(this.a){p=this.a.index;const y=f.where;var n=f.bool||"or",k=f.field;let r=n;let w,x;if(k)E(k)||(k=[k]);else if(E(f)){var u=f;k=[];r=[];for(var t=0;t<f.length;t++)d=f[t],e=d.bool||n,k[t]=d.field,r[t]=e,"not"===e?w=!0:"and"===e&&(x=!0)}else k=this.a.keys;n=k.length;for(t=0;t<n;t++)u&&(f=u[t]),h&&!L(f)&&
|
a=b;b=1E3}else b&&O(b)?(c=b,b=1E3):b||0===b||(b=1E3);let g=[],f=a;let k,h,m;if(G(a)&&!F(a)){c||(c=a.callback)&&(f.callback=null);h=a.sort;k=a.page;b=a.limit;var n=a.threshold;m=a.suggest;a=a.query}if(this.a){n=this.a.index;const y=f.where;var p=f.bool||"or",l=f.field;let t=p;let v,x;if(l)F(l)||(l=[l]);else if(F(f)){var u=f;l=[];t=[];for(var q=0;q<f.length;q++)d=f[q],e=d.bool||p,l[q]=d.field,t[q]=e,"not"===e?v=!0:"and"===e&&(x=!0)}else l=this.a.keys;p=l.length;for(q=0;q<p;q++)u&&(f=u[q]),k&&!L(f)&&
|
||||||
(f.page=null,f.limit=0),g[t]=p[k[t]].search(f,0);if(c)return c(J.call(this,a,r,g,l,b,m,y,h,x,w));if(this.async){const F=this;return new Promise(function(C){Promise.all(g).then(function(D){C(J.call(F,a,r,D,l,b,m,y,h,x,w))})})}return J.call(this,a,r,g,l,b,m,y,h,x,w)}p||(p=this.threshold||0);if(!d){if(this.async&&"function"!==typeof importScripts){let y=this;p=new Promise(function(r){setTimeout(function(){r(y.search(f,b,null,!0));y=null})});if(c)p.then(c);else return p;return this}if(c)return c(this.search(f,
|
(f.page=null,f.limit=0),g[q]=n[l[q]].search(f,0);if(c)return c(J.call(this,a,t,g,h,b,m,y,k,x,v));if(this.async){const H=this;return new Promise(function(D){Promise.all(g).then(function(E){D(J.call(H,a,t,E,h,b,m,y,k,x,v))})})}return J.call(this,a,t,g,h,b,m,y,k,x,v)}n||(n=this.threshold||0);if(!d){if(this.async&&"function"!==typeof importScripts){let y=this;n=new Promise(function(t){setTimeout(function(){t(y.search(f,b,null,!0));y=null})});if(c)n.then(c);else return n;return this}if(c)return c(this.search(f,
|
||||||
b,null,!0)),this}if(!a||!L(a))return g;f=a;if(this.cache)if(this.u){if(c=this.j.get(a))return c}else this.j.clear(),this.u=!0;f=this.encode(f);if(!f.length)return g;c=this.c;c=O(c)?c(f):f.split(this.split);this.filter&&(c=Q(c,this.filter));u=c.length;d=!0;e=[];const A=B();let z=0;1<u&&(this.depth&&"strict"===this.c?n=!0:c.sort(ma));if(!n||(t=this.h)){const y=this.b;for(;z<u;z++){let r=c[z];if(r){if(n){if(!k)if(t[r])k=r,A[r]=1;else if(!m)return g;if(m&&z===u-1&&!e.length)n=!1,r=k||r,A[r]=0;else if(!k)continue}if(!A[r]){const w=
|
b,null,!0)),this}if(!a||!L(a))return g;f=a;if(this.cache)if(this.u){if(c=this.j.get(a))return c}else this.j.clear(),this.u=!0;f=this.encode(f);if(!f.length)return g;c=this.c;c=O(c)?c(f):f.split(this.split);this.filter&&(c=Q(c,this.filter));u=c.length;d=!0;e=[];const A=B();let z=0;1<u&&(this.depth&&"strict"===this.c?p=!0:c.sort(ma));if(!p||(q=this.g)){const y=this.b;for(;z<u;z++){let t=c[z];if(t){if(p){if(!l)if(q[t])l=t,A[t]=1;else if(!m)return g;if(m&&z===u-1&&!e.length)p=!1,t=l||t,A[t]=0;else if(!l)continue}if(!A[t]){const v=
|
||||||
[];let x=!1,F=0;const C=n?t[k]:this.i;if(C){let D;for(let M=0;M<y-p;M++)if(D=C[M]&&C[M][r])w[F++]=D,x=!0}if(x)k=r,e[e.length]=1<F?w.concat.apply([],w):w[0];else if(!m){d=!1;break}A[r]=1}}}}else d=!1;d&&(g=da(e,b,h,m));this.cache&&this.j.set(a,g);return g};v.prototype.find=function(a,b){return this.where(a,b,1)[0]||null};v.prototype.where=function(a,b,c,d){const e=this.g,g=[];let f=0;let h;var l;let m;if(H(a)){c||(c=b);var p=Object.keys(a);var n=p.length;h=!1;if(1===n&&"id"===p[0])return[e[a.id]];
|
[];let x=!1,H=0;const D=p?q[l]:this.i;if(D){let E;for(let M=0;M<y-n;M++)if(E=D[M]&&D[M][t])v[H++]=E,x=!0}if(x)l=t,e[e.length]=1<H?v.concat.apply([],v):v[0];else if(!m){d=!1;break}A[t]=1}}}}else d=!1;d&&(g=da(e,b,k,m));this.cache&&this.j.set(a,g);return g};w.prototype.find=function(a,b){return this.where(a,b,1)[0]||null};w.prototype.where=function(a,b,c,d){const e=this.h,g=[];let f=0;let k;var h;let m;if(G(a)){c||(c=b);var n=Object.keys(a);var p=n.length;k=!1;if(1===p&&"id"===n[0])return[e[a.id]];
|
||||||
if((l=this.B)&&!d)for(var k=0;k<l.length;k++){var u=l[k],t=a[u];if(!I(t)){m=this.w[u]["@"+t];if(0===--n)return m;p.splice(p.indexOf(u),1);delete a[u];break}}l=Array(n);for(k=0;k<n;k++)l[k]=p[k].split(":")}else{if(O(a)){b=d||Object.keys(e);c=b.length;for(p=0;p<c;p++)n=e[b[p]],a(n)&&(g[f++]=n);return g}if(I(b))return[e[a]];if("id"===a)return[e[b]];p=[a];n=1;l=[a.split(":")];h=!0}d=m||d||Object.keys(e);k=d.length;for(u=0;u<k;u++){t=m?d[u]:e[d[u]];let A=!0;for(let z=0;z<n;z++){h||(b=a[p[z]]);const y=
|
if((h=this.B)&&!d)for(var l=0;l<h.length;l++){var u=h[l],q=a[u];if(!C(q)){m=this.w[u]["@"+q];if(0===--p)return m;n.splice(n.indexOf(u),1);delete a[u];break}}h=Array(p);for(l=0;l<p;l++)h[l]=n[l].split(":")}else{if(O(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(C(b))return[e[a]];if("id"===a)return[e[b]];n=[a];p=1;h=[a.split(":")];k=!0}d=m||d||Object.keys(e);l=d.length;for(u=0;u<l;u++){q=m?d[u]:e[d[u]];let A=!0;for(let z=0;z<p;z++){k||(b=a[n[z]]);const y=
|
||||||
l[z],r=y.length;let w=t;if(1<r)for(let x=0;x<r;x++)w=w[y[x]];else w=w[y[0]];if(w!==b){A=!1;break}}if(A&&(g[f++]=t,c&&f===c))break}return g};v.prototype.info=function(){return{id:this.id,items:this.length,cache:this.cache&&this.cache.l?this.cache.l.length:!1,matcher:X.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}};v.prototype.clear=function(){return this.destroy().init()};v.prototype.destroy=function(){this.cache&&
|
h[z],t=y.length;let v=q;if(1<t)for(let x=0;x<t;x++)v=v[y[x]];else v=v[y[0]];if(v!==b){A=!1;break}}if(A&&(g[f++]=q,c&&f===c))break}return g};w.prototype.info=function(){return{id:this.id,items:this.length,cache:this.cache&&this.cache.l?this.cache.l.length:!1,matcher:X.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}};w.prototype.clear=function(){return this.destroy().init()};w.prototype.destroy=function(){this.cache&&
|
||||||
(this.j.clear(),this.j=null);this.i=this.h=this.f=null;if(this.a){const a=this.a.keys;for(let b=0;b<a.length;b++)this.a.index[a[b]].destroy();this.a=this.g=null}return this};v.prototype.export=function(){let a;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}else a=[this.i,this.h,Object.keys(this.f)];return JSON.stringify(a)};v.prototype.import=function(a){a=JSON.parse(a);const b=B();if(this.a){var c=
|
(this.j.clear(),this.j=null);this.i=this.g=this.f=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};w.prototype.export=function(a){const b=!a||C(a.serialize)||a.serialize;if(this.a){const d=!a||C(a.doc)||a.doc;var c=!a||C(a.index)||a.index;a=[];let e=0;if(c)for(c=this.a.keys;e<c.length;e++){const g=this.a.index[c[e]];a[e]=[g.i,g.g,Object.keys(g.f)]}d&&(a[e]=this.h)}else a=[this.i,this.g,Object.keys(this.f)];b&&(a=JSON.stringify(a));
|
||||||
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.i=a[e][0],g.h=a[e][1],g.f=b,g.g=a[d];this.g=a[d]}else{c=a[2];for(d=0;d<c.length;d++)b[c[d]]=1;this.i=a[0];this.h=a[1];this.f=b}};const S={icase:function(a){return a.toLowerCase()},simple:function(){const a=[q("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",q("[\u00e8\u00e9\u00ea\u00eb]"),"e",q("[\u00ec\u00ed\u00ee\u00ef]"),"i",q("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",q("[\u00f9\u00fa\u00fb\u00fc\u0171]"),
|
return a};w.prototype.import=function(a,b){if(!b||C(b.serialize)||b.serialize)a=JSON.parse(a);const c=B();if(this.a){var d=!b||C(b.doc)||b.doc,e=0;if(!b||C(b.index)||b.index){b=this.a.keys;const f=b.length;for(var g=a[0][2];e<g.length;e++)c[g[e]]=1;for(e=0;e<f;e++)g=this.a.index[b[e]],g.i=a[e][0],g.g=a[e][1],g.f=c}d&&(this.h=G(d)?d:a[e])}else{d=a[2];for(e=0;e<d.length;e++)c[d[e]]=1;this.i=a[0];this.g=a[1];this.f=c}};const pa=function(){const a=r("\\s+"),b=r("[^a-z0-9 ]"),c=[r("[-/]")," ",b,"",a," "];
|
||||||
"u",q("[\u00fd\u0177\u00ff]"),"y",q("\u00f1"),"n",q("[\u00e7c]"),"k",q("\u00df"),"s",q(" & ")," and ",q("[-/]")," ",q("[^a-z0-9 ]"),"",q("\\s+")," "];return function(b){b=P(b.toLowerCase(),a);return" "===b?"":b}}(),advanced:function(){const a=[q("ae"),"a",q("ai"),"ei",q("ay"),"ei",q("ey"),"ei",q("oe"),"o",q("ue"),"u",q("ie"),"i",q("sz"),"s",q("zs"),"s",q("sh"),"s",q("ck"),"k",q("cc"),"k",q("th"),"t",q("dt"),"t",q("ph"),"f",q("pf"),"f",q("ou"),"o",q("uo"),"u"];return function(b,c){if(!b)return b;b=
|
return function(d){return Z(P(d.toLowerCase(),c))}}(),S={icase:function(a){return a.toLowerCase()},simple:function(){const a=r("\\s+"),b=r("[^a-z0-9 ]"),c=r("[-/]"),d=r("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),e=r("[\u00e8\u00e9\u00ea\u00eb]"),g=r("[\u00ec\u00ed\u00ee\u00ef]"),f=r("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),k=r("[\u00f9\u00fa\u00fb\u00fc\u0171]"),h=r("[\u00fd\u0177\u00ff]"),m=r("\u00f1"),n=r("[\u00e7c]"),p=r("\u00df"),l=r(" & "),u=[d,"a",e,"e",g,"i",f,"o",k,"u",h,"y",m,"n",n,"k",p,
|
||||||
this.simple(b);2<b.length&&(b=P(b,a));c||1<b.length&&(b=Z(b));return b}}(),extra:function(){const a=[q("p"),"b",q("z"),"s",q("[cgq]"),"k",q("n"),"m",q("d"),"t",q("[vw]"),"f",q("[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]+P(d.substring(1),a))}b=b.join(" ");b=Z(b)}return b}}(),balance:function(){const a=[q("[-/]")," ",q("[^a-z0-9 ]"),"",q("\\s+")," "];return function(b){return Z(P(b.toLowerCase(),
|
"s",l," and ",c," ",b,"",a," "];return function(q){q=P(q.toLowerCase(),u);return" "===q?"":q}}(),advanced:function(){const a=r("ae"),b=r("ai"),c=r("ay"),d=r("ey"),e=r("oe"),g=r("ue"),f=r("ie"),k=r("sz"),h=r("zs"),m=r("ck"),n=r("cc"),p=r("sh"),l=r("th"),u=r("dt"),q=r("ph"),A=r("pf"),z=r("ou"),y=r("uo"),t=[a,"a",b,"ei",c,"ei",d,"ei",e,"o",g,"u",f,"i",k,"s",h,"s",p,"s",m,"k",n,"k",l,"t",u,"t",q,"f",A,"f",z,"o",y,"u"];return function(v,x){if(!v)return v;v=this.simple(v);2<v.length&&(v=P(v,t));x||1<v.length&&
|
||||||
a))}}()},oa=function(){function a(b){this.clear();this.A=!0!==b&&b}a.prototype.clear=function(){this.cache=B();this.count=B();this.index=B();this.l=[]};a.prototype.set=function(b,c){if(this.A&&I(this.cache[b])){let d=this.l.length;if(d===this.A){d--;const e=this.l[d];delete this.cache[e];delete this.count[e];delete this.index[e]}this.index[b]=d;this.l[d]=b;this.count[b]=-1;this.cache[b]=c;this.get(b)}else this.cache[b]=c};a.prototype.get=function(b){const c=this.cache[b];if(this.A&&c){var d=++this.count[b];
|
(v=Z(v));return v}}(),extra:function(){const a=r("p"),b=r("z"),c=r("[cgq]"),d=r("n"),e=r("d"),g=r("[vw]"),f=r("[aeiouy]"),k=[a,"b",b,"s",c,"k",d,"m",e,"t",g,"f",f,""];return function(h){if(!h)return h;h=this.advanced(h,!0);if(1<h.length){h=h.split(" ");for(let m=0;m<h.length;m++){const n=h[m];1<n.length&&(h[m]=n[0]+P(n.substring(1),k))}h=h.join(" ");h=Z(h)}return h}}(),balance:pa},oa=function(){function a(b){this.clear();this.A=!0!==b&&b}a.prototype.clear=function(){this.cache=B();this.count=B();
|
||||||
const g=this.index;let f=g[b];if(0<f){const h=this.l;for(var e=f;this.count[h[--f]]<=d&&-1!==f;);f++;if(f!==e){for(d=e;d>f;d--)e=h[d-1],h[d]=e,g[e]=d;h[f]=b;g[b]=f}}}return c};return a}();return v}(!1),this);
|
this.index=B();this.l=[]};a.prototype.set=function(b,c){if(this.A&&C(this.cache[b])){let d=this.l.length;if(d===this.A){d--;const e=this.l[d];delete this.cache[e];delete this.count[e];delete this.index[e]}this.index[b]=d;this.l[d]=b;this.count[b]=-1;this.cache[b]=c;this.get(b)}else this.cache[b]=c};a.prototype.get=function(b){const c=this.cache[b];if(this.A&&c){var d=++this.count[b];const g=this.index;let f=g[b];if(0<f){const k=this.l;for(var e=f;this.count[k[--f]]<=d&&-1!==f;);f++;if(f!==e){for(d=
|
||||||
|
e;d>f;d--)e=k[d-1],k[d]=e,g[e]=d;k[f]=b;g[b]=f}}}return c};return a}();return w}(!1),this);
|
||||||
|
698
dist/flexsearch.pre.js
vendored
698
dist/flexsearch.pre.js
vendored
File diff suppressed because it is too large
Load Diff
143
flexsearch.js
143
flexsearch.js
@@ -1,5 +1,5 @@
|
|||||||
/**!
|
/**!
|
||||||
* @preserve FlexSearch v0.6.22
|
* @preserve FlexSearch v0.6.24
|
||||||
* Copyright 2019 Nextapps GmbH
|
* Copyright 2019 Nextapps GmbH
|
||||||
* Author: Thomas Wilkerling
|
* Author: Thomas Wilkerling
|
||||||
* Released under the Apache 2.0 Licence
|
* Released under the Apache 2.0 Licence
|
||||||
@@ -1674,10 +1674,7 @@
|
|||||||
|
|
||||||
"search": true,
|
"search": true,
|
||||||
"limit": limit,
|
"limit": limit,
|
||||||
"cursor": cursor,
|
"content": _query
|
||||||
"threshold": threshold,
|
|
||||||
//"where": where,
|
|
||||||
"content": query
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2252,33 +2249,44 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: also export settings?
|
* TODO: also export settings?
|
||||||
|
* @param {Object<string, boolean>=} config
|
||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FlexSearch.prototype.export = function(serialize = true){
|
FlexSearch.prototype.export = function(config){
|
||||||
|
|
||||||
|
const serialize = !config || is_undefined(config["serialize"]) || config["serialize"];
|
||||||
|
|
||||||
let payload;
|
let payload;
|
||||||
|
|
||||||
if(SUPPORT_DOCUMENT && this.doc){
|
if(SUPPORT_DOCUMENT && this.doc){
|
||||||
|
|
||||||
const keys = this.doc.keys;
|
const export_doc = !config || is_undefined(config["doc"]) || config["doc"];
|
||||||
const length = keys.length;
|
const export_index = !config || is_undefined(config["index"]) || config["index"];
|
||||||
|
|
||||||
payload = new Array(length + 1);
|
payload = [];
|
||||||
|
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
for(; i < keys.length; i++){
|
if(export_index){
|
||||||
|
|
||||||
const idx = this.doc.index[keys[i]];
|
const keys = this.doc.keys;
|
||||||
|
|
||||||
payload[i] = [
|
for(; i < keys.length; i++){
|
||||||
|
|
||||||
idx._map, idx._ctx, get_keys(idx._ids)
|
const idx = this.doc.index[keys[i]];
|
||||||
];
|
|
||||||
|
payload[i] = [
|
||||||
|
|
||||||
|
idx._map, idx._ctx, get_keys(idx._ids)
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
payload[i] = this._doc;
|
if(export_doc){
|
||||||
|
|
||||||
|
payload[i] = this._doc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
@@ -2290,7 +2298,8 @@
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(serialize) {
|
if(serialize){
|
||||||
|
|
||||||
payload = JSON.stringify(payload);
|
payload = JSON.stringify(payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2301,9 +2310,12 @@
|
|||||||
* @export
|
* @export
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FlexSearch.prototype.import = function(payload, serialized = true){
|
FlexSearch.prototype.import = function(payload, config){
|
||||||
|
|
||||||
|
const serialize = !config || is_undefined(config["serialize"]) || config["serialize"];
|
||||||
|
|
||||||
|
if(serialize){
|
||||||
|
|
||||||
if(serialized) {
|
|
||||||
payload = JSON.parse(payload);
|
payload = JSON.parse(payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2311,26 +2323,41 @@
|
|||||||
|
|
||||||
if(SUPPORT_DOCUMENT && this.doc){
|
if(SUPPORT_DOCUMENT && this.doc){
|
||||||
|
|
||||||
const keys = this.doc.keys;
|
const import_doc = !config || is_undefined(config["doc"]) || config["doc"];
|
||||||
const length = keys.length;
|
const import_index = !config || is_undefined(config["index"]) || config["index"];
|
||||||
const current = payload[0][2];
|
|
||||||
|
|
||||||
for(let i = 0; i < current.length; i++){
|
let i = 0;
|
||||||
|
|
||||||
ids[current[i]] = 1;
|
if(import_index){
|
||||||
|
|
||||||
|
const keys = this.doc.keys;
|
||||||
|
const length = keys.length;
|
||||||
|
const current = payload[0][2];
|
||||||
|
|
||||||
|
for(; i < current.length; i++){
|
||||||
|
|
||||||
|
ids[current[i]] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i = 0; i < length; i++){
|
||||||
|
|
||||||
|
const idx = this.doc.index[keys[i]];
|
||||||
|
|
||||||
|
idx._map = payload[i][0];
|
||||||
|
idx._ctx = payload[i][1];
|
||||||
|
idx._ids = ids;
|
||||||
|
|
||||||
|
// if(import_doc){
|
||||||
|
//
|
||||||
|
// idx._doc = payload[length];
|
||||||
|
// }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(let i = 0; i < length; i++){
|
if(import_doc){
|
||||||
|
|
||||||
const idx = this.doc.index[keys[i]];
|
this._doc = is_object(import_doc) ? import_doc : payload[i];
|
||||||
|
|
||||||
idx._map = payload[i][0];
|
|
||||||
idx._ctx = payload[i][1];
|
|
||||||
idx._ids = ids;
|
|
||||||
idx._doc = payload[length];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this._doc = payload[length];
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
@@ -2348,6 +2375,56 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function serialize(payload){
|
||||||
|
|
||||||
|
if(is_array(payload)){
|
||||||
|
|
||||||
|
const length = payload.length;
|
||||||
|
|
||||||
|
if(length){
|
||||||
|
|
||||||
|
if(is_array(payload[0]) || is_object(payload[0])){
|
||||||
|
|
||||||
|
let result = "[";
|
||||||
|
|
||||||
|
for(let i = 0; i < length; i++){
|
||||||
|
|
||||||
|
const value = payload[i];
|
||||||
|
|
||||||
|
result += serialize(value) + (i < length - 1 ? "," : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
return result + "]";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(is_object(payload)){
|
||||||
|
|
||||||
|
const keys = get_keys(payload);
|
||||||
|
const length = keys.length;
|
||||||
|
|
||||||
|
if(length){
|
||||||
|
|
||||||
|
let result = "{";
|
||||||
|
|
||||||
|
for(let i = 0; i < length; i++){
|
||||||
|
|
||||||
|
const key = keys[i];
|
||||||
|
const value = payload[key];
|
||||||
|
|
||||||
|
result += "\"" + key + "\":" + serialize(value) + (i < length - 1 ? "," : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
return result + "}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return JSON.stringify(payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
function unserialize(){}
|
||||||
|
|
||||||
/** @const */
|
/** @const */
|
||||||
|
|
||||||
const global_encoder_balance = (function(){
|
const global_encoder_balance = (function(){
|
||||||
@@ -3587,7 +3664,7 @@
|
|||||||
pointer = 0;
|
pointer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const start = pointer || 0;
|
const start = /** @type number */ (pointer) || 0;
|
||||||
page = start + limit;
|
page = start + limit;
|
||||||
|
|
||||||
if(page < length){
|
if(page < length){
|
||||||
|
16
package.json
16
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "flexsearch",
|
"name": "flexsearch",
|
||||||
"version": "0.6.22",
|
"version": "0.6.24",
|
||||||
"description": "Next-Generation full text search library with zero dependencies.",
|
"description": "Next-Generation full text search library with zero dependencies.",
|
||||||
"homepage": "https://github.com/nextapps-de/flexsearch/",
|
"homepage": "https://github.com/nextapps-de/flexsearch/",
|
||||||
"author": "Thomas Wilkerling",
|
"author": "Thomas Wilkerling",
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
"test-coverage": "nyc --reporter=html --reporter=text mocha --timeout=3000 mocha test/test.js",
|
"test-coverage": "nyc --reporter=html --reporter=text mocha --timeout=3000 mocha test/test.js",
|
||||||
"test": "npm run test-develop && npm run test-production && npm run test-light && npm run test-browser && npm run test-coverage",
|
"test": "npm run test-develop && npm run test-production && npm run test-light && npm run test-browser && npm run test-coverage",
|
||||||
"coverage": "nyc report --reporter=text-lcov | coveralls",
|
"coverage": "nyc report --reporter=text-lcov | coveralls",
|
||||||
"update": "node_modules/.bin/updtr --to non-breaking"
|
"update": "npm install chai@latest && npm install codacy-coverage@latest && npm install coveralls@latest && npm install nyc@latest && npm install google-closure-compiler@nightly && npm install mocha@latest && npm install mocha-lcov-reporter@latest && npm install mocha-phantomjs@latest && npm install phantomjs-prebuilt@latest"
|
||||||
},
|
},
|
||||||
"nyc": {
|
"nyc": {
|
||||||
"per-file": true,
|
"per-file": true,
|
||||||
@@ -56,6 +56,7 @@
|
|||||||
"dist/",
|
"dist/",
|
||||||
"lang/",
|
"lang/",
|
||||||
"test/",
|
"test/",
|
||||||
|
"index.d.ts",
|
||||||
"compile.js",
|
"compile.js",
|
||||||
"README.md",
|
"README.md",
|
||||||
"CHANGELOG.md",
|
"CHANGELOG.md",
|
||||||
@@ -66,13 +67,12 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"chai": "^4.2.0",
|
"chai": "^4.2.0",
|
||||||
"codacy-coverage": "^3.4.0",
|
"codacy-coverage": "^3.4.0",
|
||||||
"coveralls": "^3.0.3",
|
"coveralls": "^3.0.5",
|
||||||
"google-closure-compiler": "^20190709.0.0",
|
"google-closure-compiler": "^20190723.0.0-nightly",
|
||||||
"mocha": "^6.0.1",
|
"mocha": "^6.2.0",
|
||||||
"mocha-lcov-reporter": "^1.3.0",
|
"mocha-lcov-reporter": "^1.3.0",
|
||||||
"mocha-phantomjs": "^4.1.0",
|
"mocha-phantomjs": "^4.1.0",
|
||||||
"nyc": "^14.0.0",
|
"nyc": "^14.1.1",
|
||||||
"phantomjs-prebuilt": "^2.1.16",
|
"phantomjs-prebuilt": "^2.1.16"
|
||||||
"updtr": "^3.0.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
45
test/test.js
45
test/test.js
@@ -2678,17 +2678,32 @@ if(env !== "light") describe("Export / Import", function(){
|
|||||||
it("Should have been exported properly (documents)", function(){
|
it("Should have been exported properly (documents)", function(){
|
||||||
|
|
||||||
var index = new FlexSearch({
|
var index = new FlexSearch({
|
||||||
tokenize: "reverse",
|
encode: "icase",
|
||||||
|
tokenize: "strict",
|
||||||
|
threshold: 1,
|
||||||
|
resolution: 3,
|
||||||
|
depth: 1,
|
||||||
doc: {
|
doc: {
|
||||||
id: "id",
|
id: "id",
|
||||||
field: "title"
|
field: ["title", "content"]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
index.add({id: 0, title: "foo"});
|
var docs = [{
|
||||||
index.add({id: 1, title: "bar"});
|
id: 1,
|
||||||
index.add({id: 2, title: "foobar"});
|
title: "Title 2",
|
||||||
|
content: "foobar"
|
||||||
|
},{
|
||||||
|
id: 0,
|
||||||
|
title: "Title 1",
|
||||||
|
content: "foo"
|
||||||
|
},{
|
||||||
|
id: 2,
|
||||||
|
title: "Title 3",
|
||||||
|
content: "bar"
|
||||||
|
}];
|
||||||
|
|
||||||
|
index.add(docs);
|
||||||
data = index.export();
|
data = index.export();
|
||||||
|
|
||||||
if(env === ""){
|
if(env === ""){
|
||||||
@@ -2700,6 +2715,11 @@ if(env !== "light") describe("Export / Import", function(){
|
|||||||
index.doc.index["title"]._ctx,
|
index.doc.index["title"]._ctx,
|
||||||
Object.keys(index.doc.index["title"]._ids)
|
Object.keys(index.doc.index["title"]._ids)
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
index.doc.index["content"]._map,
|
||||||
|
index.doc.index["content"]._ctx,
|
||||||
|
Object.keys(index.doc.index["content"]._ids)
|
||||||
|
],
|
||||||
index._doc
|
index._doc
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
@@ -2708,10 +2728,14 @@ if(env !== "light") describe("Export / Import", function(){
|
|||||||
it("Should have been imported properly (documents)", function(){
|
it("Should have been imported properly (documents)", function(){
|
||||||
|
|
||||||
var index = new FlexSearch({
|
var index = new FlexSearch({
|
||||||
tokenize: "reverse",
|
encode: "icase",
|
||||||
|
tokenize: "strict",
|
||||||
|
threshold: 1,
|
||||||
|
resolution: 3,
|
||||||
|
depth: 1,
|
||||||
doc: {
|
doc: {
|
||||||
id: "id",
|
id: "id",
|
||||||
field: "title"
|
field: ["title", "content"]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2720,12 +2744,13 @@ if(env !== "light") describe("Export / Import", function(){
|
|||||||
if(env === ""){
|
if(env === ""){
|
||||||
|
|
||||||
expect(index.doc.index["title"].length).to.equal(3);
|
expect(index.doc.index["title"].length).to.equal(3);
|
||||||
|
expect(index.doc.index["content"].length).to.equal(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(index.search("foo")).to.have.lengthOf(2);
|
expect(index.search("foo")).to.have.lengthOf(1);
|
||||||
expect(index.search("bar")).to.have.lengthOf(2);
|
expect(index.search("bar")).to.have.lengthOf(1);
|
||||||
expect(index.search("foobar")).to.have.lengthOf(1);
|
expect(index.search("foobar")).to.have.lengthOf(1);
|
||||||
expect(index.search("foobar")[0].id).to.equal(2);
|
expect(index.search("foobar")[0].id).to.equal(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user