1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-08-20 12:52:20 +02:00

export/import document worker

This commit is contained in:
Thomas Wilkerling
2025-03-20 21:57:25 +01:00
parent e55c2d1efc
commit f2302f0dee
64 changed files with 2483 additions and 1243 deletions

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.111 (Bundle/Debug)
* FlexSearch.js v0.8.113 (Bundle/Debug)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -272,12 +272,13 @@ function L(a) {
;let M, N;
async function ka(a) {
a = a.data;
const b = a.task, c = a.id;
var b = a.task;
const c = a.id;
let e = a.args;
switch(b) {
case "init":
N = a.options || {};
(a = a.factory) ? (Function("return " + a)()(self), M = new self.FlexSearch.Index(N), delete self.FlexSearch) : M = new O(N);
(b = a.factory) ? (Function("return " + b)()(self), M = new self.FlexSearch.Index(N), delete self.FlexSearch) : M = new O(N);
postMessage({id:c});
break;
default:
@@ -286,15 +287,15 @@ async function ka(a) {
if (!N.export || "function" !== typeof N.export) {
throw Error('Either no extern configuration provided for the Worker-Index or no method was defined on the config property "export".');
}
e = [N.export];
e[1] ? (e[0] = N.export, e[2] = 0, e[3] = 1) : e = null;
}
if ("import" === b) {
if (!N.import || "function" !== typeof N.import) {
throw Error('Either no extern configuration provided for the Worker-Index or no method was defined on the config property "import".');
}
await N.import.call(M, M);
e[0] && (a = await N.import.call(M, e[0]), M.import(e[0], a));
} else {
d = M[b].apply(M, e), d.then && (d = await d);
(d = e && M[b].apply(M, e)) && d.then && (d = await d);
}
postMessage("search" === b ? {id:c, msg:d} : {id:c});
}
@@ -378,13 +379,15 @@ R("remove");
R("clear");
R("export");
R("import");
la(Q.prototype);
function R(a) {
Q.prototype[a] = Q.prototype[a + "Async"] = async function() {
Q.prototype[a] = function() {
const b = this, c = [].slice.call(arguments);
var e = c[c.length - 1];
let d;
"function" === typeof e && (d = e, c.splice(c.length - 1, 1));
"function" === typeof e && (d = e, c.pop());
e = new Promise(function(f) {
"export" === a && "function" === typeof c[0] && (c[0] = null);
b.h[++ra] = f;
b.worker.postMessage({task:a, id:ra, args:c});
});
@@ -392,7 +395,7 @@ function R(a) {
};
}
function sa(a, b, c) {
return b ? "undefined" !== typeof module ? new (require("worker_threads")["Worker"])(__dirname + "/node/node.js") : import("worker_threads").then(function(worker){ return new worker["Worker"]((1,eval)("import.meta.dirname") + "/node/node.mjs"); }) : a ? new window.Worker(URL.createObjectURL(new Blob(["onmessage=" + ka.toString()], {type:"text/javascript"}))) : new window.Worker(E(c) ? c : (0,eval)("import.meta.url").replace("/worker.js", "/worker/worker.js").replace("flexsearch.bundle.module.min.js",
return b ? "undefined" !== typeof module ? new (require("worker_threads")["Worker"])(__dirname + "/node/node.js") : import("worker_threads").then(function(worker){ return new worker["Worker"]((1,eval)("import.meta.dirname") + "/node/node.mjs"); }) : a ? new window.Worker(URL.createObjectURL(new Blob(["onmessage=" + ka.toString()], {type:"text/javascript"}))) : new window.Worker("string" === typeof c ? c : (0,eval)("import.meta.url").replace("/worker.js", "/worker/worker.js").replace("flexsearch.bundle.module.min.js",
"module/worker/worker.js"), {type:"module"});
}
;function ta(a, b = 0) {
@@ -726,6 +729,7 @@ function Ba(a) {
}
this.store.set(a, k || b);
}
this.worker && (this.fastupdate || this.reg.add(a));
}
return this;
};
@@ -1708,21 +1712,31 @@ t.export = function(a, b, c = 0, e = 0) {
return za.call(this, a, b, d, f, c, e);
};
t.import = function(a, b) {
var c = a.split(".");
"json" === c[c.length - 1] && c.pop();
const e = 2 < c.length ? c[0] : "";
c = 2 < c.length ? c[2] : c[1];
if (this.worker && e) {
return this.index.get(e).import(a);
}
if (b) {
"string" === typeof b && (b = JSON.parse(b));
a = a.split(".");
"json" === a[a.length - 1] && a.pop();
var c = 2 < a.length ? a[0] : "";
a = 2 < a.length ? a[2] : a[1];
if (c) {
return this.index.get(c).import(a, b);
if (e) {
return this.index.get(e).import(c, b);
}
switch(a) {
switch(c) {
case "reg":
this.fastupdate = !1;
this.reg = ya(b, this.reg);
for (let e = 0, d; e < this.field.length; e++) {
d = this.index.get(this.field[e]), d.fastupdate = !1, d.reg = this.reg;
for (let d = 0, f; d < this.field.length; d++) {
f = this.index.get(this.field[d]), f.fastupdate = !1, f.reg = this.reg;
}
if (this.worker) {
b = [];
for (const d of this.index.values()) {
b.push(d.import(a));
}
return Promise.all(b);
}
break;
case "tag":
@@ -2143,7 +2157,7 @@ t.export = function(a, b, c = 0, e = 0) {
};
t.import = function(a, b) {
if (b) {
switch("string" === typeof b && (b = JSON.parse(b)), a = a.split("."), "json" === a[a.length - 1] && a.pop(), a = 1 < a.length ? a[1] : a[0], a) {
switch("string" === typeof b && (b = JSON.parse(b)), a = a.split("."), "json" === a[a.length - 1] && a.pop(), 3 === a.length && a.shift(), a = 1 < a.length ? a[1] : a[0], a) {
case "reg":
this.fastupdate = !1;
this.reg = ya(b, this.reg);

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.111 (Bundle)
* FlexSearch.js v0.8.113 (Bundle)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -21,12 +21,12 @@ t.addMatcher=function(a,b){if("object"===typeof a)return this.addReplacer(a,b);i
t.encode=function(a){if(this.cache&&a.length<=this.K)if(this.H){if(this.B.has(a))return this.B.get(a)}else this.H=setTimeout(L,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=ja?a.normalize("NFKD").replace(ja,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3<a.length&&(a=a.replace(ha,"$1 $2").replace(ia,"$1 $2").replace(fa,"$1 "));const b=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let c=
[],e=this.split||""===this.split?a.split(this.split):a;for(let f=0,g,k;f<e.length;f++)if((g=k=e[f])&&!(g.length<this.minlength))if(b)c.push(g);else if(!this.filter||!this.filter.has(g)){if(this.cache&&g.length<=this.L)if(this.H){var d=this.G.get(g);if(d||""===d){d&&c.push(d);continue}}else this.H=setTimeout(L,50,this);this.stemmer&&2<g.length&&(this.N||(this.N=new RegExp("(?!^)("+this.A+")$")),g=g.replace(this.N,h=>this.stemmer.get(h)),g.length<this.minlength||this.filter&&this.filter.has(g))&&(g=
"");if(g&&(this.mapper||this.dedupe&&1<g.length)){d="";for(let h=0,l="",m,n;h<g.length;h++)m=g.charAt(h),m===l&&this.dedupe||((n=this.mapper&&this.mapper.get(m))||""===n?n===l&&this.dedupe||!(l=n)||(d+=n):d+=l=m);g=d}this.matcher&&1<g.length&&(this.M||(this.M=new RegExp("("+this.h+")","g")),g=g.replace(this.M,h=>this.matcher.get(h)));if(g&&this.replacer)for(d=0;g&&d<this.replacer.length;d+=2)g=g.replace(this.replacer[d],this.replacer[d+1]);this.cache&&k.length<=this.L&&(this.G.set(k,g),this.G.size>
this.S&&(this.G.clear(),this.L=this.L/1.1|0));g&&c.push(g)}this.finalize&&(c=this.finalize(c)||c);this.cache&&a.length<=this.K&&(this.B.set(a,c),this.B.size>this.S&&(this.B.clear(),this.K=this.K/1.1|0));return c};function L(a){a.H=null;a.B.clear();a.G.clear()};let M,N;async function ka(a){a=a.data;const b=a.task,c=a.id;let e=a.args;switch(b){case "init":N=a.options||{};(a=a.factory)?(Function("return "+a)()(self),M=new self.FlexSearch.Index(N),delete self.FlexSearch):M=new O(N);postMessage({id:c});break;default:let d;"export"===b&&(e=[N.export]);"import"===b?await N.import.call(M,M):(d=M[b].apply(M,e),d.then&&(d=await d));postMessage("search"===b?{id:c,msg:d}:{id:c})}};function la(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}let ma,na;const oa={},pa={};function qa(a){ma=0;oa[a]=pa[a]}
this.S&&(this.G.clear(),this.L=this.L/1.1|0));g&&c.push(g)}this.finalize&&(c=this.finalize(c)||c);this.cache&&a.length<=this.K&&(this.B.set(a,c),this.B.size>this.S&&(this.B.clear(),this.K=this.K/1.1|0));return c};function L(a){a.H=null;a.B.clear();a.G.clear()};let M,N;async function ka(a){a=a.data;var b=a.task;const c=a.id;let e=a.args;switch(b){case "init":N=a.options||{};(b=a.factory)?(Function("return "+b)()(self),M=new self.FlexSearch.Index(N),delete self.FlexSearch):M=new O(N);postMessage({id:c});break;default:let d;"export"===b&&(e[1]?(e[0]=N.export,e[2]=0,e[3]=1):e=null);"import"===b?e[0]&&(a=await N.import.call(M,e[0]),M.import(e[0],a)):(d=e&&M[b].apply(M,e))&&d.then&&(d=await d);postMessage("search"===b?{id:c,msg:d}:{id:c})}};function la(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}let ma,na;const oa={},pa={};function qa(a){ma=0;oa[a]=pa[a]}
function P(a){this[a+"Async"]=function(){const b=arguments;var c=b[b.length-1];let e;"function"===typeof c&&(e=c,delete b[b.length-1]);ma||(ma=setTimeout(qa,0,a),na=Date.now());pa[a]||(pa[a]=oa[a]=1E3);if(!--oa[a]){oa[a]=pa[a]=pa[a]*this.priority*this.priority*3/(Date.now()-na)|0||1;ma=clearTimeout(ma);const f=this;return new Promise(g=>{setTimeout(function(){g(f[a+"Async"].apply(f,b))},0)})}const d=this[a].apply(this,b);c=d.then?d:new Promise(f=>f(d));e&&c.then(e);return c}};let ra=0;
function Q(a={}){function b(g){function k(h){h=h.data||h;const l=h.id,m=l&&d.h[l];m&&(m(h.msg),delete d.h[l])}this.worker=g;this.h=B();if(this.worker){e?this.worker.on("message",k):this.worker.onmessage=k;if(a.config)return new Promise(function(h){d.h[++ra]=function(){h(d)};d.worker.postMessage({id:ra,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",factory:c,options:a});return this}}if(!this||this.constructor!==Q)return new Q(a);let c="undefined"!==typeof self?self._factory:"undefined"!==
typeof window?window._factory:null;c&&(c=c.toString());const e="undefined"===typeof window,d=this,f=sa(c,e,a.worker);return f.then?f.then(function(g){return b.call(d,g)}):b.call(this,f)}R("add");R("append");R("search");R("update");R("remove");R("clear");R("export");R("import");
function R(a){Q.prototype[a]=Q.prototype[a+"Async"]=async function(){const b=this,c=[].slice.call(arguments);var e=c[c.length-1];let d;"function"===typeof e&&(d=e,c.splice(c.length-1,1));e=new Promise(function(f){b.h[++ra]=f;b.worker.postMessage({task:a,id:ra,args:c})});return d?(e.then(d),this):e}}
function sa(a,b,c){return b?"undefined"!==typeof module?new (require("worker_threads")["Worker"])(__dirname + "/node/node.js"):import("worker_threads").then(function(worker){ return new worker["Worker"]((1,eval)("import.meta.dirname") + "/node/node.mjs"); }):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+ka.toString()],{type:"text/javascript"}))):new window.Worker(E(c)?c:(0,eval)("import.meta.url").replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js",
typeof window?window._factory:null;c&&(c=c.toString());const e="undefined"===typeof window,d=this,f=sa(c,e,a.worker);return f.then?f.then(function(g){return b.call(d,g)}):b.call(this,f)}R("add");R("append");R("search");R("update");R("remove");R("clear");R("export");R("import");la(Q.prototype);
function R(a){Q.prototype[a]=function(){const b=this,c=[].slice.call(arguments);var e=c[c.length-1];let d;"function"===typeof e&&(d=e,c.pop());e=new Promise(function(f){"export"===a&&"function"===typeof c[0]&&(c[0]=null);b.h[++ra]=f;b.worker.postMessage({task:a,id:ra,args:c})});return d?(e.then(d),this):e}}
function sa(a,b,c){return b?"undefined"!==typeof module?new (require("worker_threads")["Worker"])(__dirname + "/node/node.js"):import("worker_threads").then(function(worker){ return new worker["Worker"]((1,eval)("import.meta.dirname") + "/node/node.mjs"); }):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+ka.toString()],{type:"text/javascript"}))):new window.Worker("string"===typeof c?c:(0,eval)("import.meta.url").replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js",
"module/worker/worker.js"),{type:"module"})};function ta(a,b=0){let c=[],e=[];b&&(b=25E4/b*5E3|0);for(const d of a.entries())e.push(d),e.length===b&&(c.push(e),e=[]);e.length&&c.push(e);return c}function ua(a,b){b||(b=new Map);for(let c=0,e;c<a.length;c++)e=a[c],b.set(e[0],e[1]);return b}function va(a,b=0){let c=[],e=[];b&&(b=25E4/b*1E3|0);for(const d of a.entries())e.push([d[0],ta(d[1])[0]]),e.length===b&&(c.push(e),e=[]);e.length&&c.push(e);return c}
function wa(a,b){b||(b=new Map);for(let c=0,e,d;c<a.length;c++)e=a[c],d=b.get(e[0]),b.set(e[0],ua(e[1],d));return b}function xa(a){let b=[],c=[];for(const e of a.keys())c.push(e),25E4===c.length&&(b.push(c),c=[]);c.length&&b.push(c);return b}function ya(a,b){b||(b=new Set);for(let c=0;c<a.length;c++)b.add(a[c]);return b}
function za(a,b,c,e,d,f,g=0){const k=e&&e.constructor===Array;var h=k?e.shift():e;if(!h)return this.export(a,b,d,f+1);if((h=a((b?b+".":"")+(g+1)+"."+c,JSON.stringify(h)))&&h.then){const l=this;return h.then(function(){return za.call(l,a,b,c,k?e:null,d,f,g+1)})}return za.call(this,a,b,c,k?e:null,d,f,g+1)};function Aa(a,b,c,e){let d=[];for(let f=0,g;f<a.index.length;f++)if(g=a.index[f],b>=g.length)b-=g.length;else{b=g[e?"splice":"slice"](b,c);const k=b.length;if(k&&(d=d.length?d.concat(b):b,c-=k,e&&(a.length-=k),!c))break;b=0}return d}
@@ -37,7 +37,7 @@ function U(a=8){if(!this)return new U(a);this.index=B();this.h=[];32<a?(this.B=B
t.clear=U.prototype.clear=function(){this.index=B();this.h=[];this.size=0};t.values=U.prototype.values=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].values())yield b};t.keys=U.prototype.keys=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].keys())yield b};t.entries=U.prototype.entries=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].entries())yield b};
function Ca(a){let b=2**this.A-1;if("number"==typeof a)return a&b;let c=0,e=this.A+1;for(let d=0;d<a.length;d++)c=(c*e^a.charCodeAt(d))&b;return 32===this.A?c+2**31:c}function Ba(a){let b=BigInt(2)**this.A-BigInt(1);var c=typeof a;if("bigint"===c)return a&b;if("number"===c)return BigInt(a)&b;c=BigInt(0);let e=this.A+BigInt(1);for(let d=0;d<a.length;d++)c=(c*e^BigInt(a.charCodeAt(d)))&b;return c};V.prototype.add=function(a,b,c){I(a)&&(b=a,a=ba(b,this.key));if(b&&(a||0===a)){if(!c&&this.reg.has(a))return this.update(a,b);for(let k=0,h;k<this.field.length;k++){h=this.D[k];var e=this.index.get(this.field[k]);if("function"===typeof h){var d=h(b);d&&e.add(a,d,!1,!0)}else if(d=h.I,!d||d(b))h.constructor===String?h=[""+h]:E(h)&&(h=[h]),Da(b,h,this.J,0,e,a,h[0],c)}if(this.tag)for(e=0;e<this.F.length;e++){var f=this.F[e];d=this.tag.get(this.R[e]);let k=B();if("function"===typeof f){if(f=f(b),!f)continue}else{var g=
f.I;if(g&&!g(b))continue;f.constructor===String&&(f=""+f);f=ba(b,f)}if(d&&f){E(f)&&(f=[f]);for(let h=0,l,m;h<f.length;h++)if(l=f[h],!k[l]&&(k[l]=1,(g=d.get(l))?m=g:d.set(l,m=[]),!c||!m.includes(a))){if(m.length===2**31-1){g=new S(m);if(this.fastupdate)for(let n of this.reg.values())n.includes(m)&&(n[n.indexOf(m)]=g);d.set(l,m=g)}m.push(a);this.fastupdate&&((g=this.reg.get(a))?g.push(m):this.reg.set(a,[m]))}}}if(this.store&&(!c||!this.store.has(a))){let k;if(this.C){k=B();for(let h=0,l;h<this.C.length;h++){l=
this.C[h];if((c=l.I)&&!c(b))continue;let m;if("function"===typeof l){m=l(b);if(!m)continue;l=[l.V]}else if(E(l)||l.constructor===String){k[l]=b[l];continue}Ea(b,k,l,0,l[0],m)}}this.store.set(a,k||b)}}return this};function Ea(a,b,c,e,d,f){a=a[d];if(e===c.length-1)b[d]=f||a;else if(a)if(a.constructor===Array)for(b=b[d]=Array(a.length),d=0;d<a.length;d++)Ea(a,b,c,e,d);else b=b[d]||(b[d]=B()),d=c[++e],Ea(a,b,c,e,d)}
this.C[h];if((c=l.I)&&!c(b))continue;let m;if("function"===typeof l){m=l(b);if(!m)continue;l=[l.V]}else if(E(l)||l.constructor===String){k[l]=b[l];continue}Ea(b,k,l,0,l[0],m)}}this.store.set(a,k||b)}this.worker&&(this.fastupdate||this.reg.add(a))}return this};function Ea(a,b,c,e,d,f){a=a[d];if(e===c.length-1)b[d]=f||a;else if(a)if(a.constructor===Array)for(b=b[d]=Array(a.length),d=0;d<a.length;d++)Ea(a,b,c,e,d);else b=b[d]||(b[d]=B()),d=c[++e],Ea(a,b,c,e,d)}
function Da(a,b,c,e,d,f,g,k){if(a=a[g])if(e===b.length-1){if(a.constructor===Array){if(c[e]){for(b=0;b<a.length;b++)d.add(f,a[b],!0,!0);return}a=a.join(" ")}d.add(f,a,k,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)Da(a,b,c,e,d,f,g,k);else g=b[++e],Da(a,b,c,e,d,f,g,k);else d.db&&d.remove(f)};function Fa(a,b,c,e,d,f,g){const k=a.length;let h=[],l;var m;l=B();for(let n=0,p,q,r,u;n<b;n++)for(let v=0;v<k;v++)if(r=a[v],n<r.length&&(p=r[n]))for(let x=0;x<p.length;x++)q=p[x],(m=l[q])?l[q]++:(m=0,l[q]=1),u=h[m]||(h[m]=[]),g||(m=n+(v||!d?0:f||0),u=u[m]||(u[m]=[])),u.push(q);if(a=h.length)if(d)h=1<h.length?Ga(h,c,e,g,f):(h=h[0]).length>c||e?h.slice(e,c+e):h;else{if(a<k)return[];h=h[a-1];if(c||e)if(g){if(h.length>c||e)h=h.slice(e,c+e)}else{d=[];for(let n=0,p;n<h.length;n++)if(p=h[n],p.length>e)e-=
p.length;else{if(p.length>c||e)p=p.slice(e,c+e),c-=p.length,e&&(e-=p.length);d.push(p);if(!c)break}h=1<d.length?[].concat.apply([],d):d[0]}}return h}
function Ga(a,b,c,e,d){const f=[],g=B();let k;var h=a.length;let l;if(e)for(d=h-1;0<=d;d--){if(l=(e=a[d])&&e.length)for(h=0;h<l;h++)if(k=e[h],!g[k])if(g[k]=1,c)c--;else if(f.push(k),f.length===b)return f}else for(let m=h-1,n,p=0;0<=m;m--){n=a[m];for(let q=0;q<n.length;q++)if(l=(e=n[q])&&e.length)for(let r=0;r<l;r++)if(k=e[r],!g[k])if(g[k]=1,c)c--;else{let u=(q+(m<h-1?d||0:0))/(m+1)|0;(f[u]||(f[u]=[])).push(k);if(++p===b)return f}}return f}
@@ -66,7 +66,8 @@ t.remove=function(a){I(a)&&(a=ba(a,this.key));for(var b of this.index.values())b
t.clear=function(){for(const a of this.index.values())a.clear();if(this.tag)for(const a of this.tag.values())a.clear();this.store&&this.store.clear();return this};t.contain=function(a){return this.db?this.index.get(this.field[0]).db.has(a):this.reg.has(a)};t.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};t.get=function(a){return this.db?this.index.get(this.field[0]).db.enrich(a).then(function(b){return b[0]&&b[0].doc}):this.store.get(a)};
t.set=function(a,b){this.store.set(a,b);return this};t.searchCache=Va;
t.export=function(a,b,c=0,e=0){if(c<this.field.length){const g=this.field[c];if((b=this.index.get(g).export(a,g,c,e=1))&&b.then){const k=this;return b.then(function(){return k.export(a,g,c+1)})}return this.export(a,g,c+1)}let d,f;switch(e){case 0:d="reg";f=xa(this.reg);b=null;break;case 1:d="tag";f=va(this.tag,this.reg.size);b=null;break;case 2:d="doc";f=ta(this.store);b=null;break;case 3:d="cfg";b=f=null;break;default:return}return za.call(this,a,b,d,f,c,e)};
t.import=function(a,b){if(b){"string"===typeof b&&(b=JSON.parse(b));a=a.split(".");"json"===a[a.length-1]&&a.pop();var c=2<a.length?a[0]:"";a=2<a.length?a[2]:a[1];if(c)return this.index.get(c).import(a,b);switch(a){case "reg":this.fastupdate=!1;this.reg=ya(b,this.reg);for(let e=0,d;e<this.field.length;e++)d=this.index.get(this.field[e]),d.fastupdate=!1,d.reg=this.reg;break;case "tag":this.tag=wa(b,this.tag);break;case "doc":this.store=ua(b,this.store)}}};la(V.prototype);function Va(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new Y);let e=this.cache.get(a);if(!e){e=this.search(a,b,c);if(e.then){const d=this;e.then(function(f){d.cache.set(a,f);return f})}this.cache.set(a,e)}return e}function Y(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}Y.prototype.set=function(a,b){this.cache.set(this.h=a,b);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};
t.import=function(a,b){var c=a.split(".");"json"===c[c.length-1]&&c.pop();const e=2<c.length?c[0]:"";c=2<c.length?c[2]:c[1];if(this.worker&&e)return this.index.get(e).import(a);if(b){"string"===typeof b&&(b=JSON.parse(b));if(e)return this.index.get(e).import(c,b);switch(c){case "reg":this.fastupdate=!1;this.reg=ya(b,this.reg);for(let d=0,f;d<this.field.length;d++)f=this.index.get(this.field[d]),f.fastupdate=!1,f.reg=this.reg;if(this.worker){b=[];for(const d of this.index.values())b.push(d.import(a));
return Promise.all(b)}break;case "tag":this.tag=wa(b,this.tag);break;case "doc":this.store=ua(b,this.store)}}};la(V.prototype);function Va(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new Y);let e=this.cache.get(a);if(!e){e=this.search(a,b,c);if(e.then){const d=this;e.then(function(f){d.cache.set(a,f);return f})}this.cache.set(a,e)}return e}function Y(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}Y.prototype.set=function(a,b){this.cache.set(this.h=a,b);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};
Y.prototype.get=function(a){const b=this.cache.get(a);b&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,b));return b};Y.prototype.remove=function(a){for(const b of this.cache){const c=b[0];b[1].includes(a)&&this.cache.delete(c)}};Y.prototype.clear=function(){this.cache.clear();this.h=""};const Wa={normalize:function(a){return a.toLowerCase()}};const Xa=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]);const Ya=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["pf","f"]]),Za=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\1+/g,"$1"];const $a={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,"\u00df":2,d:3,t:3,l:4,m:5,n:5,r:6};const ab=/[\x00-\x7F]+/g;const bb=/[\x00-\x7F]+/g;const cb=/[\x00-\x7F]+/g;var db={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:Wa,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Xa},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Xa,matcher:Ya,replacer:Za},LatinExtra:{normalize:!0,dedupe:!0,mapper:Xa,replacer:Za.concat([/(?!^)[aeo]/g,""]),matcher:Ya},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let c=0;c<a.length;c++){var b=a[c];let e=b.charAt(0),d=$a[e];for(let f=1,g;f<b.length&&(g=b.charAt(f),"h"===
g||"w"===g||!(g=$a[g])||g===d||(e+=g,d=g,4!==e.length));f++);a[c]=e}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(ab," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(bb,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(cb," ")}}};const eb={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};O.prototype.add=function(a,b,c,e){if(b&&(a||0===a)){if(!e&&!c&&this.reg.has(a))return this.update(a,b);b=this.encoder.encode(b);if(e=b.length){const l=B(),m=B(),n=this.depth,p=this.resolution;for(let q=0;q<e;q++){let r=b[this.rtl?e-1-q:q];var d=r.length;if(d&&(n||!m[r])){var f=this.score?this.score(b,r,q,null,0):fb(p,e,q),g="";switch(this.tokenize){case "full":if(2<d){for(f=0;f<d;f++)for(var k=d;k>f;k--){g=r.substring(f,k);var h=this.score?this.score(b,r,q,g,f):fb(p,e,q,d,f);gb(this,m,g,h,a,c)}break}case "reverse":if(1<
d){for(k=d-1;0<k;k--)g=r[k]+g,h=this.score?this.score(b,r,q,g,k):fb(p,e,q,d,k),gb(this,m,g,h,a,c);g=""}case "forward":if(1<d){for(k=0;k<d;k++)g+=r[k],gb(this,m,g,f,a,c);break}default:if(gb(this,m,r,f,a,c),n&&1<e&&q<e-1)for(d=B(),g=this.U,f=r,k=Math.min(n+1,e-q),d[f]=1,h=1;h<k;h++)if((r=b[this.rtl?e-1-q-h:q+h])&&!d[r]){d[r]=1;const u=this.score?this.score(b,f,q,r,h):fb(g+(e/2>g?0:1),e,q,k-1,h-1),v=this.bidirectional&&r>f;gb(this,l,v?f:r,u,a,c,v?r:f)}}}}this.fastupdate||this.reg.add(a)}else b=""}this.db&&
@@ -81,7 +82,7 @@ t.mount=function(a){this.commit_timer&&(clearTimeout(this.commit_timer),this.com
t.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();this.db&&(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[{clear:!0}]);return this};t.append=function(a,b){return this.add(a,b,!0)};t.contain=function(a){return this.db?this.db.has(a):this.reg.has(a)};t.update=function(a,b){const c=this,e=this.remove(a);return e&&e.then?e.then(()=>c.add(a,b)):this.add(a,b)};
function nb(a){let b=0;if(a.constructor===Array)for(let c=0,e;c<a.length;c++)(e=a[c])&&(b+=e.length);else for(const c of a){const e=c[0],d=nb(c[1]);d?b+=d:a.delete(e)}return b}t.cleanup=function(){if(!this.fastupdate)return this;nb(this.map);this.depth&&nb(this.ctx);return this};t.searchCache=Va;
t.export=function(a,b,c=0,e=0){let d,f;switch(e){case 0:d="reg";f=xa(this.reg);break;case 1:d="cfg";f=null;break;case 2:d="map";f=ta(this.map,this.reg.size);break;case 3:d="ctx";f=va(this.ctx,this.reg.size);break;default:return}return za.call(this,a,b,d,f,c,e)};
t.import=function(a,b){if(b)switch("string"===typeof b&&(b=JSON.parse(b)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=ya(b,this.reg);break;case "map":this.map=ua(b,this.map);break;case "ctx":this.ctx=wa(b,this.ctx)}};
t.import=function(a,b){if(b)switch("string"===typeof b&&(b=JSON.parse(b)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),3===a.length&&a.shift(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=ya(b,this.reg);break;case "map":this.map=ua(b,this.map);break;case "ctx":this.ctx=wa(b,this.ctx)}};
t.serialize=function(a=!0){if(!this.reg.size)return"";let b="",c="";for(var e of this.reg.keys())c||(c=typeof e),b+=(b?",":"")+("string"===c?'"'+e+'"':e);b="index.reg=new Set(["+b+"]);";e="";for(var d of this.map.entries()){var f=d[0],g=d[1],k="";for(let m=0,n;m<g.length;m++){n=g[m]||[""];var h="";for(var l=0;l<n.length;l++)h+=(h?",":"")+("string"===c?'"'+n[l]+'"':n[l]);h="["+h+"]";k+=(k?",":"")+h}k='["'+f+'",['+k+"]]";e+=(e?",":"")+k}e="index.map=new Map(["+e+"]);";d="";for(const m of this.ctx.entries()){f=
m[0];g=m[1];for(const n of g.entries()){g=n[0];k=n[1];h="";for(let p=0,q;p<k.length;p++){q=k[p]||[""];l="";for(let r=0;r<q.length;r++)l+=(l?",":"")+("string"===c?'"'+q[r]+'"':q[r]);l="["+l+"]";h+=(h?",":"")+l}h='new Map([["'+g+'",['+h+"]]])";h='["'+f+'",'+h+"]";d+=(d?",":"")+h}}d="index.ctx=new Map(["+d+"]);";return a?"function inject(index){"+b+e+d+"}":b+e+d};la(O.prototype);const ob="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),pb=["map","ctx","tag","reg","cfg"];
function rb(a,b={}){if(!this)return new rb(a,b);"object"===typeof a&&(b=a,a=a.name);a||console.info("Default storage space was used, because a name was not passed.");this.id="flexsearch"+(a?":"+a.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"");this.field=b.field?b.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"";this.type=b.type;this.fastupdate=this.support_tag_search=!1;this.db=null;this.h={}}t=rb.prototype;t.mount=function(a){if(!a.encoder)return a.mount(this);a.db=this;return this.open()};

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.111 (Bundle/Module/Debug)
* FlexSearch.js v0.8.113 (Bundle/Module/Debug)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -271,12 +271,13 @@ function L(a) {
;let M, N;
async function ka(a) {
a = a.data;
const b = a.task, c = a.id;
var b = a.task;
const c = a.id;
let e = a.args;
switch(b) {
case "init":
N = a.options || {};
(a = a.factory) ? (Function("return " + a)()(self), M = new self.FlexSearch.Index(N), delete self.FlexSearch) : M = new O(N);
(b = a.factory) ? (Function("return " + b)()(self), M = new self.FlexSearch.Index(N), delete self.FlexSearch) : M = new O(N);
postMessage({id:c});
break;
default:
@@ -285,15 +286,15 @@ async function ka(a) {
if (!N.export || "function" !== typeof N.export) {
throw Error('Either no extern configuration provided for the Worker-Index or no method was defined on the config property "export".');
}
e = [N.export];
e[1] ? (e[0] = N.export, e[2] = 0, e[3] = 1) : e = null;
}
if ("import" === b) {
if (!N.import || "function" !== typeof N.import) {
throw Error('Either no extern configuration provided for the Worker-Index or no method was defined on the config property "import".');
}
await N.import.call(M, M);
e[0] && (a = await N.import.call(M, e[0]), M.import(e[0], a));
} else {
d = M[b].apply(M, e), d.then && (d = await d);
(d = e && M[b].apply(M, e)) && d.then && (d = await d);
}
postMessage("search" === b ? {id:c, msg:d} : {id:c});
}
@@ -377,13 +378,15 @@ R("remove");
R("clear");
R("export");
R("import");
la(Q.prototype);
function R(a) {
Q.prototype[a] = Q.prototype[a + "Async"] = async function() {
Q.prototype[a] = function() {
const b = this, c = [].slice.call(arguments);
var e = c[c.length - 1];
let d;
"function" === typeof e && (d = e, c.splice(c.length - 1, 1));
"function" === typeof e && (d = e, c.pop());
e = new Promise(function(f) {
"export" === a && "function" === typeof c[0] && (c[0] = null);
b.h[++ra] = f;
b.worker.postMessage({task:a, id:ra, args:c});
});
@@ -391,7 +394,7 @@ function R(a) {
};
}
function sa(a, b, c) {
return b ? "undefined" !== typeof module ? new (require("worker_threads")["Worker"])(__dirname + "/node/node.js") : import("worker_threads").then(function(worker){ return new worker["Worker"](import.meta.dirname + "/node/node.mjs"); }) : a ? new window.Worker(URL.createObjectURL(new Blob(["onmessage=" + ka.toString()], {type:"text/javascript"}))) : new window.Worker(E(c) ? c : import.meta.url.replace("/worker.js", "/worker/worker.js").replace("flexsearch.bundle.module.min.js",
return b ? "undefined" !== typeof module ? new (require("worker_threads")["Worker"])(__dirname + "/node/node.js") : import("worker_threads").then(function(worker){ return new worker["Worker"](import.meta.dirname + "/node/node.mjs"); }) : a ? new window.Worker(URL.createObjectURL(new Blob(["onmessage=" + ka.toString()], {type:"text/javascript"}))) : new window.Worker("string" === typeof c ? c : import.meta.url.replace("/worker.js", "/worker/worker.js").replace("flexsearch.bundle.module.min.js",
"module/worker/worker.js"), {type:"module"});
}
;function ta(a, b = 0) {
@@ -725,6 +728,7 @@ function Ba(a) {
}
this.store.set(a, k || b);
}
this.worker && (this.fastupdate || this.reg.add(a));
}
return this;
};
@@ -1707,21 +1711,31 @@ t.export = function(a, b, c = 0, e = 0) {
return za.call(this, a, b, d, f, c, e);
};
t.import = function(a, b) {
var c = a.split(".");
"json" === c[c.length - 1] && c.pop();
const e = 2 < c.length ? c[0] : "";
c = 2 < c.length ? c[2] : c[1];
if (this.worker && e) {
return this.index.get(e).import(a);
}
if (b) {
"string" === typeof b && (b = JSON.parse(b));
a = a.split(".");
"json" === a[a.length - 1] && a.pop();
var c = 2 < a.length ? a[0] : "";
a = 2 < a.length ? a[2] : a[1];
if (c) {
return this.index.get(c).import(a, b);
if (e) {
return this.index.get(e).import(c, b);
}
switch(a) {
switch(c) {
case "reg":
this.fastupdate = !1;
this.reg = ya(b, this.reg);
for (let e = 0, d; e < this.field.length; e++) {
d = this.index.get(this.field[e]), d.fastupdate = !1, d.reg = this.reg;
for (let d = 0, f; d < this.field.length; d++) {
f = this.index.get(this.field[d]), f.fastupdate = !1, f.reg = this.reg;
}
if (this.worker) {
b = [];
for (const d of this.index.values()) {
b.push(d.import(a));
}
return Promise.all(b);
}
break;
case "tag":
@@ -2142,7 +2156,7 @@ t.export = function(a, b, c = 0, e = 0) {
};
t.import = function(a, b) {
if (b) {
switch("string" === typeof b && (b = JSON.parse(b)), a = a.split("."), "json" === a[a.length - 1] && a.pop(), a = 1 < a.length ? a[1] : a[0], a) {
switch("string" === typeof b && (b = JSON.parse(b)), a = a.split("."), "json" === a[a.length - 1] && a.pop(), 3 === a.length && a.shift(), a = 1 < a.length ? a[1] : a[0], a) {
case "reg":
this.fastupdate = !1;
this.reg = ya(b, this.reg);

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.111 (Bundle/Module)
* FlexSearch.js v0.8.113 (Bundle/Module)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -21,12 +21,12 @@ t.addMatcher=function(a,b){if("object"===typeof a)return this.addReplacer(a,b);i
t.encode=function(a){if(this.cache&&a.length<=this.K)if(this.H){if(this.B.has(a))return this.B.get(a)}else this.H=setTimeout(L,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=ja?a.normalize("NFKD").replace(ja,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3<a.length&&(a=a.replace(ha,"$1 $2").replace(ia,"$1 $2").replace(fa,"$1 "));const b=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let c=
[],e=this.split||""===this.split?a.split(this.split):a;for(let f=0,g,k;f<e.length;f++)if((g=k=e[f])&&!(g.length<this.minlength))if(b)c.push(g);else if(!this.filter||!this.filter.has(g)){if(this.cache&&g.length<=this.L)if(this.H){var d=this.G.get(g);if(d||""===d){d&&c.push(d);continue}}else this.H=setTimeout(L,50,this);this.stemmer&&2<g.length&&(this.N||(this.N=new RegExp("(?!^)("+this.A+")$")),g=g.replace(this.N,h=>this.stemmer.get(h)),g.length<this.minlength||this.filter&&this.filter.has(g))&&(g=
"");if(g&&(this.mapper||this.dedupe&&1<g.length)){d="";for(let h=0,l="",m,n;h<g.length;h++)m=g.charAt(h),m===l&&this.dedupe||((n=this.mapper&&this.mapper.get(m))||""===n?n===l&&this.dedupe||!(l=n)||(d+=n):d+=l=m);g=d}this.matcher&&1<g.length&&(this.M||(this.M=new RegExp("("+this.h+")","g")),g=g.replace(this.M,h=>this.matcher.get(h)));if(g&&this.replacer)for(d=0;g&&d<this.replacer.length;d+=2)g=g.replace(this.replacer[d],this.replacer[d+1]);this.cache&&k.length<=this.L&&(this.G.set(k,g),this.G.size>
this.S&&(this.G.clear(),this.L=this.L/1.1|0));g&&c.push(g)}this.finalize&&(c=this.finalize(c)||c);this.cache&&a.length<=this.K&&(this.B.set(a,c),this.B.size>this.S&&(this.B.clear(),this.K=this.K/1.1|0));return c};function L(a){a.H=null;a.B.clear();a.G.clear()};let M,N;async function ka(a){a=a.data;const b=a.task,c=a.id;let e=a.args;switch(b){case "init":N=a.options||{};(a=a.factory)?(Function("return "+a)()(self),M=new self.FlexSearch.Index(N),delete self.FlexSearch):M=new O(N);postMessage({id:c});break;default:let d;"export"===b&&(e=[N.export]);"import"===b?await N.import.call(M,M):(d=M[b].apply(M,e),d.then&&(d=await d));postMessage("search"===b?{id:c,msg:d}:{id:c})}};function la(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}let ma,na;const oa={},pa={};function qa(a){ma=0;oa[a]=pa[a]}
this.S&&(this.G.clear(),this.L=this.L/1.1|0));g&&c.push(g)}this.finalize&&(c=this.finalize(c)||c);this.cache&&a.length<=this.K&&(this.B.set(a,c),this.B.size>this.S&&(this.B.clear(),this.K=this.K/1.1|0));return c};function L(a){a.H=null;a.B.clear();a.G.clear()};let M,N;async function ka(a){a=a.data;var b=a.task;const c=a.id;let e=a.args;switch(b){case "init":N=a.options||{};(b=a.factory)?(Function("return "+b)()(self),M=new self.FlexSearch.Index(N),delete self.FlexSearch):M=new O(N);postMessage({id:c});break;default:let d;"export"===b&&(e[1]?(e[0]=N.export,e[2]=0,e[3]=1):e=null);"import"===b?e[0]&&(a=await N.import.call(M,e[0]),M.import(e[0],a)):(d=e&&M[b].apply(M,e))&&d.then&&(d=await d);postMessage("search"===b?{id:c,msg:d}:{id:c})}};function la(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}let ma,na;const oa={},pa={};function qa(a){ma=0;oa[a]=pa[a]}
function P(a){this[a+"Async"]=function(){const b=arguments;var c=b[b.length-1];let e;"function"===typeof c&&(e=c,delete b[b.length-1]);ma||(ma=setTimeout(qa,0,a),na=Date.now());pa[a]||(pa[a]=oa[a]=1E3);if(!--oa[a]){oa[a]=pa[a]=pa[a]*this.priority*this.priority*3/(Date.now()-na)|0||1;ma=clearTimeout(ma);const f=this;return new Promise(g=>{setTimeout(function(){g(f[a+"Async"].apply(f,b))},0)})}const d=this[a].apply(this,b);c=d.then?d:new Promise(f=>f(d));e&&c.then(e);return c}};let ra=0;
function Q(a={}){function b(g){function k(h){h=h.data||h;const l=h.id,m=l&&d.h[l];m&&(m(h.msg),delete d.h[l])}this.worker=g;this.h=B();if(this.worker){e?this.worker.on("message",k):this.worker.onmessage=k;if(a.config)return new Promise(function(h){d.h[++ra]=function(){h(d)};d.worker.postMessage({id:ra,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",factory:c,options:a});return this}}if(!this||this.constructor!==Q)return new Q(a);let c="undefined"!==typeof self?self._factory:"undefined"!==
typeof window?window._factory:null;c&&(c=c.toString());const e="undefined"===typeof window,d=this,f=sa(c,e,a.worker);return f.then?f.then(function(g){return b.call(d,g)}):b.call(this,f)}R("add");R("append");R("search");R("update");R("remove");R("clear");R("export");R("import");
function R(a){Q.prototype[a]=Q.prototype[a+"Async"]=async function(){const b=this,c=[].slice.call(arguments);var e=c[c.length-1];let d;"function"===typeof e&&(d=e,c.splice(c.length-1,1));e=new Promise(function(f){b.h[++ra]=f;b.worker.postMessage({task:a,id:ra,args:c})});return d?(e.then(d),this):e}}
function sa(a,b,c){return b?"undefined"!==typeof module?new (require("worker_threads")["Worker"])(__dirname + "/node/node.js"):import("worker_threads").then(function(worker){ return new worker["Worker"](import.meta.dirname + "/node/node.mjs"); }):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+ka.toString()],{type:"text/javascript"}))):new window.Worker(E(c)?c:import.meta.url.replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js",
typeof window?window._factory:null;c&&(c=c.toString());const e="undefined"===typeof window,d=this,f=sa(c,e,a.worker);return f.then?f.then(function(g){return b.call(d,g)}):b.call(this,f)}R("add");R("append");R("search");R("update");R("remove");R("clear");R("export");R("import");la(Q.prototype);
function R(a){Q.prototype[a]=function(){const b=this,c=[].slice.call(arguments);var e=c[c.length-1];let d;"function"===typeof e&&(d=e,c.pop());e=new Promise(function(f){"export"===a&&"function"===typeof c[0]&&(c[0]=null);b.h[++ra]=f;b.worker.postMessage({task:a,id:ra,args:c})});return d?(e.then(d),this):e}}
function sa(a,b,c){return b?"undefined"!==typeof module?new (require("worker_threads")["Worker"])(__dirname + "/node/node.js"):import("worker_threads").then(function(worker){ return new worker["Worker"](import.meta.dirname + "/node/node.mjs"); }):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+ka.toString()],{type:"text/javascript"}))):new window.Worker("string"===typeof c?c:import.meta.url.replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js",
"module/worker/worker.js"),{type:"module"})};function ta(a,b=0){let c=[],e=[];b&&(b=25E4/b*5E3|0);for(const d of a.entries())e.push(d),e.length===b&&(c.push(e),e=[]);e.length&&c.push(e);return c}function ua(a,b){b||(b=new Map);for(let c=0,e;c<a.length;c++)e=a[c],b.set(e[0],e[1]);return b}function va(a,b=0){let c=[],e=[];b&&(b=25E4/b*1E3|0);for(const d of a.entries())e.push([d[0],ta(d[1])[0]]),e.length===b&&(c.push(e),e=[]);e.length&&c.push(e);return c}
function wa(a,b){b||(b=new Map);for(let c=0,e,d;c<a.length;c++)e=a[c],d=b.get(e[0]),b.set(e[0],ua(e[1],d));return b}function xa(a){let b=[],c=[];for(const e of a.keys())c.push(e),25E4===c.length&&(b.push(c),c=[]);c.length&&b.push(c);return b}function ya(a,b){b||(b=new Set);for(let c=0;c<a.length;c++)b.add(a[c]);return b}
function za(a,b,c,e,d,f,g=0){const k=e&&e.constructor===Array;var h=k?e.shift():e;if(!h)return this.export(a,b,d,f+1);if((h=a((b?b+".":"")+(g+1)+"."+c,JSON.stringify(h)))&&h.then){const l=this;return h.then(function(){return za.call(l,a,b,c,k?e:null,d,f,g+1)})}return za.call(this,a,b,c,k?e:null,d,f,g+1)};function Aa(a,b,c,e){let d=[];for(let f=0,g;f<a.index.length;f++)if(g=a.index[f],b>=g.length)b-=g.length;else{b=g[e?"splice":"slice"](b,c);const k=b.length;if(k&&(d=d.length?d.concat(b):b,c-=k,e&&(a.length-=k),!c))break;b=0}return d}
@@ -37,7 +37,7 @@ function U(a=8){if(!this)return new U(a);this.index=B();this.h=[];32<a?(this.B=B
t.clear=U.prototype.clear=function(){this.index=B();this.h=[];this.size=0};t.values=U.prototype.values=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].values())yield b};t.keys=U.prototype.keys=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].keys())yield b};t.entries=U.prototype.entries=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].entries())yield b};
function Ca(a){let b=2**this.A-1;if("number"==typeof a)return a&b;let c=0,e=this.A+1;for(let d=0;d<a.length;d++)c=(c*e^a.charCodeAt(d))&b;return 32===this.A?c+2**31:c}function Ba(a){let b=BigInt(2)**this.A-BigInt(1);var c=typeof a;if("bigint"===c)return a&b;if("number"===c)return BigInt(a)&b;c=BigInt(0);let e=this.A+BigInt(1);for(let d=0;d<a.length;d++)c=(c*e^BigInt(a.charCodeAt(d)))&b;return c};V.prototype.add=function(a,b,c){I(a)&&(b=a,a=ba(b,this.key));if(b&&(a||0===a)){if(!c&&this.reg.has(a))return this.update(a,b);for(let k=0,h;k<this.field.length;k++){h=this.D[k];var e=this.index.get(this.field[k]);if("function"===typeof h){var d=h(b);d&&e.add(a,d,!1,!0)}else if(d=h.I,!d||d(b))h.constructor===String?h=[""+h]:E(h)&&(h=[h]),Da(b,h,this.J,0,e,a,h[0],c)}if(this.tag)for(e=0;e<this.F.length;e++){var f=this.F[e];d=this.tag.get(this.R[e]);let k=B();if("function"===typeof f){if(f=f(b),!f)continue}else{var g=
f.I;if(g&&!g(b))continue;f.constructor===String&&(f=""+f);f=ba(b,f)}if(d&&f){E(f)&&(f=[f]);for(let h=0,l,m;h<f.length;h++)if(l=f[h],!k[l]&&(k[l]=1,(g=d.get(l))?m=g:d.set(l,m=[]),!c||!m.includes(a))){if(m.length===2**31-1){g=new S(m);if(this.fastupdate)for(let n of this.reg.values())n.includes(m)&&(n[n.indexOf(m)]=g);d.set(l,m=g)}m.push(a);this.fastupdate&&((g=this.reg.get(a))?g.push(m):this.reg.set(a,[m]))}}}if(this.store&&(!c||!this.store.has(a))){let k;if(this.C){k=B();for(let h=0,l;h<this.C.length;h++){l=
this.C[h];if((c=l.I)&&!c(b))continue;let m;if("function"===typeof l){m=l(b);if(!m)continue;l=[l.V]}else if(E(l)||l.constructor===String){k[l]=b[l];continue}Ea(b,k,l,0,l[0],m)}}this.store.set(a,k||b)}}return this};function Ea(a,b,c,e,d,f){a=a[d];if(e===c.length-1)b[d]=f||a;else if(a)if(a.constructor===Array)for(b=b[d]=Array(a.length),d=0;d<a.length;d++)Ea(a,b,c,e,d);else b=b[d]||(b[d]=B()),d=c[++e],Ea(a,b,c,e,d)}
this.C[h];if((c=l.I)&&!c(b))continue;let m;if("function"===typeof l){m=l(b);if(!m)continue;l=[l.V]}else if(E(l)||l.constructor===String){k[l]=b[l];continue}Ea(b,k,l,0,l[0],m)}}this.store.set(a,k||b)}this.worker&&(this.fastupdate||this.reg.add(a))}return this};function Ea(a,b,c,e,d,f){a=a[d];if(e===c.length-1)b[d]=f||a;else if(a)if(a.constructor===Array)for(b=b[d]=Array(a.length),d=0;d<a.length;d++)Ea(a,b,c,e,d);else b=b[d]||(b[d]=B()),d=c[++e],Ea(a,b,c,e,d)}
function Da(a,b,c,e,d,f,g,k){if(a=a[g])if(e===b.length-1){if(a.constructor===Array){if(c[e]){for(b=0;b<a.length;b++)d.add(f,a[b],!0,!0);return}a=a.join(" ")}d.add(f,a,k,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)Da(a,b,c,e,d,f,g,k);else g=b[++e],Da(a,b,c,e,d,f,g,k);else d.db&&d.remove(f)};function Fa(a,b,c,e,d,f,g){const k=a.length;let h=[],l;var m;l=B();for(let n=0,p,q,r,u;n<b;n++)for(let v=0;v<k;v++)if(r=a[v],n<r.length&&(p=r[n]))for(let x=0;x<p.length;x++)q=p[x],(m=l[q])?l[q]++:(m=0,l[q]=1),u=h[m]||(h[m]=[]),g||(m=n+(v||!d?0:f||0),u=u[m]||(u[m]=[])),u.push(q);if(a=h.length)if(d)h=1<h.length?Ga(h,c,e,g,f):(h=h[0]).length>c||e?h.slice(e,c+e):h;else{if(a<k)return[];h=h[a-1];if(c||e)if(g){if(h.length>c||e)h=h.slice(e,c+e)}else{d=[];for(let n=0,p;n<h.length;n++)if(p=h[n],p.length>e)e-=
p.length;else{if(p.length>c||e)p=p.slice(e,c+e),c-=p.length,e&&(e-=p.length);d.push(p);if(!c)break}h=1<d.length?[].concat.apply([],d):d[0]}}return h}
function Ga(a,b,c,e,d){const f=[],g=B();let k;var h=a.length;let l;if(e)for(d=h-1;0<=d;d--){if(l=(e=a[d])&&e.length)for(h=0;h<l;h++)if(k=e[h],!g[k])if(g[k]=1,c)c--;else if(f.push(k),f.length===b)return f}else for(let m=h-1,n,p=0;0<=m;m--){n=a[m];for(let q=0;q<n.length;q++)if(l=(e=n[q])&&e.length)for(let r=0;r<l;r++)if(k=e[r],!g[k])if(g[k]=1,c)c--;else{let u=(q+(m<h-1?d||0:0))/(m+1)|0;(f[u]||(f[u]=[])).push(k);if(++p===b)return f}}return f}
@@ -66,7 +66,8 @@ t.remove=function(a){I(a)&&(a=ba(a,this.key));for(var b of this.index.values())b
t.clear=function(){for(const a of this.index.values())a.clear();if(this.tag)for(const a of this.tag.values())a.clear();this.store&&this.store.clear();return this};t.contain=function(a){return this.db?this.index.get(this.field[0]).db.has(a):this.reg.has(a)};t.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};t.get=function(a){return this.db?this.index.get(this.field[0]).db.enrich(a).then(function(b){return b[0]&&b[0].doc}):this.store.get(a)};
t.set=function(a,b){this.store.set(a,b);return this};t.searchCache=Va;
t.export=function(a,b,c=0,e=0){if(c<this.field.length){const g=this.field[c];if((b=this.index.get(g).export(a,g,c,e=1))&&b.then){const k=this;return b.then(function(){return k.export(a,g,c+1)})}return this.export(a,g,c+1)}let d,f;switch(e){case 0:d="reg";f=xa(this.reg);b=null;break;case 1:d="tag";f=va(this.tag,this.reg.size);b=null;break;case 2:d="doc";f=ta(this.store);b=null;break;case 3:d="cfg";b=f=null;break;default:return}return za.call(this,a,b,d,f,c,e)};
t.import=function(a,b){if(b){"string"===typeof b&&(b=JSON.parse(b));a=a.split(".");"json"===a[a.length-1]&&a.pop();var c=2<a.length?a[0]:"";a=2<a.length?a[2]:a[1];if(c)return this.index.get(c).import(a,b);switch(a){case "reg":this.fastupdate=!1;this.reg=ya(b,this.reg);for(let e=0,d;e<this.field.length;e++)d=this.index.get(this.field[e]),d.fastupdate=!1,d.reg=this.reg;break;case "tag":this.tag=wa(b,this.tag);break;case "doc":this.store=ua(b,this.store)}}};la(V.prototype);function Va(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new Y);let e=this.cache.get(a);if(!e){e=this.search(a,b,c);if(e.then){const d=this;e.then(function(f){d.cache.set(a,f);return f})}this.cache.set(a,e)}return e}function Y(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}Y.prototype.set=function(a,b){this.cache.set(this.h=a,b);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};
t.import=function(a,b){var c=a.split(".");"json"===c[c.length-1]&&c.pop();const e=2<c.length?c[0]:"";c=2<c.length?c[2]:c[1];if(this.worker&&e)return this.index.get(e).import(a);if(b){"string"===typeof b&&(b=JSON.parse(b));if(e)return this.index.get(e).import(c,b);switch(c){case "reg":this.fastupdate=!1;this.reg=ya(b,this.reg);for(let d=0,f;d<this.field.length;d++)f=this.index.get(this.field[d]),f.fastupdate=!1,f.reg=this.reg;if(this.worker){b=[];for(const d of this.index.values())b.push(d.import(a));
return Promise.all(b)}break;case "tag":this.tag=wa(b,this.tag);break;case "doc":this.store=ua(b,this.store)}}};la(V.prototype);function Va(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new Y);let e=this.cache.get(a);if(!e){e=this.search(a,b,c);if(e.then){const d=this;e.then(function(f){d.cache.set(a,f);return f})}this.cache.set(a,e)}return e}function Y(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}Y.prototype.set=function(a,b){this.cache.set(this.h=a,b);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};
Y.prototype.get=function(a){const b=this.cache.get(a);b&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,b));return b};Y.prototype.remove=function(a){for(const b of this.cache){const c=b[0];b[1].includes(a)&&this.cache.delete(c)}};Y.prototype.clear=function(){this.cache.clear();this.h=""};const Wa={normalize:function(a){return a.toLowerCase()}};const Xa=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]);const Ya=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["pf","f"]]),Za=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\1+/g,"$1"];const $a={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,"\u00df":2,d:3,t:3,l:4,m:5,n:5,r:6};const ab=/[\x00-\x7F]+/g;const bb=/[\x00-\x7F]+/g;const cb=/[\x00-\x7F]+/g;var db={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:Wa,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Xa},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Xa,matcher:Ya,replacer:Za},LatinExtra:{normalize:!0,dedupe:!0,mapper:Xa,replacer:Za.concat([/(?!^)[aeo]/g,""]),matcher:Ya},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let c=0;c<a.length;c++){var b=a[c];let e=b.charAt(0),d=$a[e];for(let f=1,g;f<b.length&&(g=b.charAt(f),"h"===
g||"w"===g||!(g=$a[g])||g===d||(e+=g,d=g,4!==e.length));f++);a[c]=e}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(ab," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(bb,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(cb," ")}}};const eb={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};O.prototype.add=function(a,b,c,e){if(b&&(a||0===a)){if(!e&&!c&&this.reg.has(a))return this.update(a,b);b=this.encoder.encode(b);if(e=b.length){const l=B(),m=B(),n=this.depth,p=this.resolution;for(let q=0;q<e;q++){let r=b[this.rtl?e-1-q:q];var d=r.length;if(d&&(n||!m[r])){var f=this.score?this.score(b,r,q,null,0):fb(p,e,q),g="";switch(this.tokenize){case "full":if(2<d){for(f=0;f<d;f++)for(var k=d;k>f;k--){g=r.substring(f,k);var h=this.score?this.score(b,r,q,g,f):fb(p,e,q,d,f);gb(this,m,g,h,a,c)}break}case "reverse":if(1<
d){for(k=d-1;0<k;k--)g=r[k]+g,h=this.score?this.score(b,r,q,g,k):fb(p,e,q,d,k),gb(this,m,g,h,a,c);g=""}case "forward":if(1<d){for(k=0;k<d;k++)g+=r[k],gb(this,m,g,f,a,c);break}default:if(gb(this,m,r,f,a,c),n&&1<e&&q<e-1)for(d=B(),g=this.U,f=r,k=Math.min(n+1,e-q),d[f]=1,h=1;h<k;h++)if((r=b[this.rtl?e-1-q-h:q+h])&&!d[r]){d[r]=1;const u=this.score?this.score(b,f,q,r,h):fb(g+(e/2>g?0:1),e,q,k-1,h-1),v=this.bidirectional&&r>f;gb(this,l,v?f:r,u,a,c,v?r:f)}}}}this.fastupdate||this.reg.add(a)}else b=""}this.db&&
@@ -81,7 +82,7 @@ t.mount=function(a){this.commit_timer&&(clearTimeout(this.commit_timer),this.com
t.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();this.db&&(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[{clear:!0}]);return this};t.append=function(a,b){return this.add(a,b,!0)};t.contain=function(a){return this.db?this.db.has(a):this.reg.has(a)};t.update=function(a,b){const c=this,e=this.remove(a);return e&&e.then?e.then(()=>c.add(a,b)):this.add(a,b)};
function ob(a){let b=0;if(a.constructor===Array)for(let c=0,e;c<a.length;c++)(e=a[c])&&(b+=e.length);else for(const c of a){const e=c[0],d=ob(c[1]);d?b+=d:a.delete(e)}return b}t.cleanup=function(){if(!this.fastupdate)return this;ob(this.map);this.depth&&ob(this.ctx);return this};t.searchCache=Va;
t.export=function(a,b,c=0,e=0){let d,f;switch(e){case 0:d="reg";f=xa(this.reg);break;case 1:d="cfg";f=null;break;case 2:d="map";f=ta(this.map,this.reg.size);break;case 3:d="ctx";f=va(this.ctx,this.reg.size);break;default:return}return za.call(this,a,b,d,f,c,e)};
t.import=function(a,b){if(b)switch("string"===typeof b&&(b=JSON.parse(b)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=ya(b,this.reg);break;case "map":this.map=ua(b,this.map);break;case "ctx":this.ctx=wa(b,this.ctx)}};
t.import=function(a,b){if(b)switch("string"===typeof b&&(b=JSON.parse(b)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),3===a.length&&a.shift(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=ya(b,this.reg);break;case "map":this.map=ua(b,this.map);break;case "ctx":this.ctx=wa(b,this.ctx)}};
t.serialize=function(a=!0){if(!this.reg.size)return"";let b="",c="";for(var e of this.reg.keys())c||(c=typeof e),b+=(b?",":"")+("string"===c?'"'+e+'"':e);b="index.reg=new Set(["+b+"]);";e="";for(var d of this.map.entries()){var f=d[0],g=d[1],k="";for(let m=0,n;m<g.length;m++){n=g[m]||[""];var h="";for(var l=0;l<n.length;l++)h+=(h?",":"")+("string"===c?'"'+n[l]+'"':n[l]);h="["+h+"]";k+=(k?",":"")+h}k='["'+f+'",['+k+"]]";e+=(e?",":"")+k}e="index.map=new Map(["+e+"]);";d="";for(const m of this.ctx.entries()){f=
m[0];g=m[1];for(const n of g.entries()){g=n[0];k=n[1];h="";for(let p=0,q;p<k.length;p++){q=k[p]||[""];l="";for(let r=0;r<q.length;r++)l+=(l?",":"")+("string"===c?'"'+q[r]+'"':q[r]);l="["+l+"]";h+=(h?",":"")+l}h='new Map([["'+g+'",['+h+"]]])";h='["'+f+'",'+h+"]";d+=(d?",":"")+h}}d="index.ctx=new Map(["+d+"]);";return a?"function inject(index){"+b+e+d+"}":b+e+d};la(O.prototype);const pb="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),qb=["map","ctx","tag","reg","cfg"];
function rb(a,b={}){if(!this)return new rb(a,b);"object"===typeof a&&(b=a,a=a.name);a||console.info("Default storage space was used, because a name was not passed.");this.id="flexsearch"+(a?":"+a.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"");this.field=b.field?b.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"";this.type=b.type;this.fastupdate=this.support_tag_search=!1;this.db=null;this.h={}}t=rb.prototype;t.mount=function(a){if(!a.encoder)return a.mount(this);a.db=this;return this.open()};

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,12 @@
/**!
* FlexSearch.js v0.8.111 (Bundle)
* FlexSearch.js v0.8.113 (Bundle)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
(function(self){'use strict';var v;function B(a,c,b){const e=typeof b,d=typeof a;if("undefined"!==e){if("undefined"!==d){if(b){if("function"===d&&e===d)return function(k){return a(b(k))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var f=new Map(b);for(var g of a)f.set(g[0],g[1]);return f}if(c===Set){g=new Set(b);for(f of a.values())g.add(f);return g}}}return a}return b}return"undefined"===d?c:a}function C(){return Object.create(null)}function E(a){return"string"===typeof a}
function H(a){return"object"===typeof a}function J(a,c){if(E(c))a=a[c];else for(let b=0;a&&b<c.length;b++)a=a[c[b]];return a}function aa(a){let c=0;for(let b=0,e;b<a.length;b++)(e=a[b])&&c<e.length&&(c=e.length);return c};var ba=[["\u00aa","a"],["\u00b2","2"],["\u00b3","3"],["\u00b9","1"],["\u00ba","o"],["\u00bc","1\u20444"],["\u00bd","1\u20442"],["\u00be","3\u20444"],["\u00e0","a"],["\u00e1","a"],["\u00e2","a"],["\u00e3","a"],["\u00e4","a"],["\u00e5","a"],["\u00e7","c"],["\u00e8","e"],["\u00e9","e"],["\u00ea","e"],["\u00eb","e"],["\u00ec","i"],["\u00ed","i"],["\u00ee","i"],["\u00ef","i"],["\u00f1","n"],["\u00f2","o"],["\u00f3","o"],["\u00f4","o"],["\u00f5","o"],["\u00f6","o"],["\u00f9","u"],["\u00fa","u"],["\u00fb",
(function(self){'use strict';var v;function B(a,c,b){const e=typeof b,d=typeof a;if("undefined"!==e){if("undefined"!==d){if(b){if("function"===d&&e===d)return function(k){return a(b(k))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var f=new Map(b);for(var g of a)f.set(g[0],g[1]);return f}if(c===Set){g=new Set(b);for(f of a.values())g.add(f);return g}}}return a}return b}return"undefined"===d?c:a}function C(){return Object.create(null)}function D(a){return"string"===typeof a}
function H(a){return"object"===typeof a}function I(a,c){if(D(c))a=a[c];else for(let b=0;a&&b<c.length;b++)a=a[c[b]];return a}function aa(a){let c=0;for(let b=0,e;b<a.length;b++)(e=a[b])&&c<e.length&&(c=e.length);return c};var ba=[["\u00aa","a"],["\u00b2","2"],["\u00b3","3"],["\u00b9","1"],["\u00ba","o"],["\u00bc","1\u20444"],["\u00bd","1\u20442"],["\u00be","3\u20444"],["\u00e0","a"],["\u00e1","a"],["\u00e2","a"],["\u00e3","a"],["\u00e4","a"],["\u00e5","a"],["\u00e7","c"],["\u00e8","e"],["\u00e9","e"],["\u00ea","e"],["\u00eb","e"],["\u00ec","i"],["\u00ed","i"],["\u00ee","i"],["\u00ef","i"],["\u00f1","n"],["\u00f2","o"],["\u00f3","o"],["\u00f4","o"],["\u00f5","o"],["\u00f6","o"],["\u00f9","u"],["\u00fa","u"],["\u00fb",
"u"],["\u00fc","u"],["\u00fd","y"],["\u00ff","y"],["\u0101","a"],["\u0103","a"],["\u0105","a"],["\u0107","c"],["\u0109","c"],["\u010b","c"],["\u010d","c"],["\u010f","d"],["\u0113","e"],["\u0115","e"],["\u0117","e"],["\u0119","e"],["\u011b","e"],["\u011d","g"],["\u011f","g"],["\u0121","g"],["\u0123","g"],["\u0125","h"],["\u0129","i"],["\u012b","i"],["\u012d","i"],["\u012f","i"],["\u0133","ij"],["\u0135","j"],["\u0137","k"],["\u013a","l"],["\u013c","l"],["\u013e","l"],["\u0140","l"],["\u0144","n"],
["\u0146","n"],["\u0148","n"],["\u0149","n"],["\u014d","o"],["\u014f","o"],["\u0151","o"],["\u0155","r"],["\u0157","r"],["\u0159","r"],["\u015b","s"],["\u015d","s"],["\u015f","s"],["\u0161","s"],["\u0163","t"],["\u0165","t"],["\u0169","u"],["\u016b","u"],["\u016d","u"],["\u016f","u"],["\u0171","u"],["\u0173","u"],["\u0175","w"],["\u0177","y"],["\u017a","z"],["\u017c","z"],["\u017e","z"],["\u017f","s"],["\u01a1","o"],["\u01b0","u"],["\u01c6","dz"],["\u01c9","lj"],["\u01cc","nj"],["\u01ce","a"],["\u01d0",
"i"],["\u01d2","o"],["\u01d4","u"],["\u01d6","u"],["\u01d8","u"],["\u01da","u"],["\u01dc","u"],["\u01df","a"],["\u01e1","a"],["\u01e3","ae"],["\u00e6","ae"],["\u01fd","ae"],["\u01e7","g"],["\u01e9","k"],["\u01eb","o"],["\u01ed","o"],["\u01ef","\u0292"],["\u01f0","j"],["\u01f3","dz"],["\u01f5","g"],["\u01f9","n"],["\u01fb","a"],["\u01ff","\u00f8"],["\u0201","a"],["\u0203","a"],["\u0205","e"],["\u0207","e"],["\u0209","i"],["\u020b","i"],["\u020d","o"],["\u020f","o"],["\u0211","r"],["\u0213","r"],["\u0215",
@@ -21,44 +21,49 @@ v.addMatcher=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);i
v.encode=function(a){if(this.cache&&a.length<=this.K)if(this.H){if(this.F.has(a))return this.F.get(a)}else this.H=setTimeout(L,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=ha?a.normalize("NFKD").replace(ha,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3<a.length&&(a=a.replace(ea,"$1 $2").replace(fa,"$1 $2").replace(da,"$1 "));const c=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let b=
[],e=this.split||""===this.split?a.split(this.split):a;for(let f=0,g,k;f<e.length;f++)if((g=k=e[f])&&!(g.length<this.minlength))if(c)b.push(g);else if(!this.filter||!this.filter.has(g)){if(this.cache&&g.length<=this.L)if(this.H){var d=this.G.get(g);if(d||""===d){d&&b.push(d);continue}}else this.H=setTimeout(L,50,this);this.stemmer&&2<g.length&&(this.N||(this.N=new RegExp("(?!^)("+this.D+")$")),g=g.replace(this.N,h=>this.stemmer.get(h)),g.length<this.minlength||this.filter&&this.filter.has(g))&&(g=
"");if(g&&(this.mapper||this.dedupe&&1<g.length)){d="";for(let h=0,l="",m,n;h<g.length;h++)m=g.charAt(h),m===l&&this.dedupe||((n=this.mapper&&this.mapper.get(m))||""===n?n===l&&this.dedupe||!(l=n)||(d+=n):d+=l=m);g=d}this.matcher&&1<g.length&&(this.M||(this.M=new RegExp("("+this.h+")","g")),g=g.replace(this.M,h=>this.matcher.get(h)));if(g&&this.replacer)for(d=0;g&&d<this.replacer.length;d+=2)g=g.replace(this.replacer[d],this.replacer[d+1]);this.cache&&k.length<=this.L&&(this.G.set(k,g),this.G.size>
this.R&&(this.G.clear(),this.L=this.L/1.1|0));g&&b.push(g)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.K&&(this.F.set(a,b),this.F.size>this.R&&(this.F.clear(),this.K=this.K/1.1|0));return b};function L(a){a.H=null;a.F.clear();a.G.clear()};function ia(a){M.call(a,"add");M.call(a,"append");M.call(a,"search");M.call(a,"update");M.call(a,"remove")}let N,ja;const O={},P={};function ka(a){N=0;O[a]=P[a]}
function M(a){this[a+"Async"]=function(){const c=arguments;var b=c[c.length-1];let e;"function"===typeof b&&(e=b,delete c[c.length-1]);N||(N=setTimeout(ka,0,a),ja=Date.now());P[a]||(P[a]=O[a]=1E3);if(!--O[a]){O[a]=P[a]=P[a]*this.priority*this.priority*3/(Date.now()-ja)|0||1;N=clearTimeout(N);const f=this;return new Promise(g=>{setTimeout(function(){g(f[a+"Async"].apply(f,c))},0)})}const d=this[a].apply(this,c);b=d.then?d:new Promise(f=>f(d));e&&b.then(e);return b}};function la(a,c=0){let b=[],e=[];c&&(c=25E4/c*5E3|0);for(const d of a.entries())e.push(d),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}function ma(a,c){c||(c=new Map);for(let b=0,e;b<a.length;b++)e=a[b],c.set(e[0],e[1]);return c}function na(a,c=0){let b=[],e=[];c&&(c=25E4/c*1E3|0);for(const d of a.entries())e.push([d[0],la(d[1])[0]]),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}
function oa(a,c){c||(c=new Map);for(let b=0,e,d;b<a.length;b++)e=a[b],d=c.get(e[0]),c.set(e[0],ma(e[1],d));return c}function pa(a){let c=[],b=[];for(const e of a.keys())b.push(e),25E4===b.length&&(c.push(b),b=[]);b.length&&c.push(b);return c}function qa(a,c){c||(c=new Set);for(let b=0;b<a.length;b++)c.add(a[b]);return c}
function Q(a,c,b,e,d,f,g=0){const k=e&&e.constructor===Array;var h=k?e.shift():e;if(!h)return this.export(a,c,d,f+1);if((h=a((c?c+".":"")+(g+1)+"."+b,JSON.stringify(h)))&&h.then){const l=this;return h.then(function(){return Q.call(l,a,c,b,k?e:null,d,f,g+1)})}return Q.call(this,a,c,b,k?e:null,d,f,g+1)};R.prototype.add=function(a,c,b){H(a)&&(c=a,a=J(c,this.key));if(c&&(a||0===a)){if(!b&&this.reg.has(a))return this.update(a,c);for(let k=0,h;k<this.field.length;k++){h=this.C[k];var e=this.index.get(this.field[k]);if("function"===typeof h){var d=h(c);d&&e.add(a,d,!1,!0)}else if(d=h.I,!d||d(c))h.constructor===String?h=[""+h]:E(h)&&(h=[h]),ra(c,h,this.J,0,e,a,h[0],b)}if(this.tag)for(e=0;e<this.B.length;e++){var f=this.B[e];d=this.tag.get(this.T[e]);let k=C();if("function"===typeof f){if(f=f(c),!f)continue}else{var g=
f.I;if(g&&!g(c))continue;f.constructor===String&&(f=""+f);f=J(c,f)}if(d&&f){E(f)&&(f=[f]);for(let h=0,l,m;h<f.length;h++)l=f[h],k[l]||(k[l]=1,(g=d.get(l))?m=g:d.set(l,m=[]),b&&m.includes(a)||(m.push(a),this.fastupdate&&((g=this.reg.get(a))?g.push(m):this.reg.set(a,[m]))))}}if(this.store&&(!b||!this.store.has(a))){let k;if(this.A){k=C();for(let h=0,l;h<this.A.length;h++){l=this.A[h];if((b=l.I)&&!b(c))continue;let m;if("function"===typeof l){m=l(c);if(!m)continue;l=[l.U]}else if(E(l)||l.constructor===
String){k[l]=c[l];continue}sa(c,k,l,0,l[0],m)}}this.store.set(a,k||c)}}return this};function sa(a,c,b,e,d,f){a=a[d];if(e===b.length-1)c[d]=f||a;else if(a)if(a.constructor===Array)for(c=c[d]=Array(a.length),d=0;d<a.length;d++)sa(a,c,b,e,d);else c=c[d]||(c[d]=C()),d=b[++e],sa(a,c,b,e,d)}
function ra(a,c,b,e,d,f,g,k){if(a=a[g])if(e===c.length-1){if(a.constructor===Array){if(b[e]){for(c=0;c<a.length;c++)d.add(f,a[c],!0,!0);return}a=a.join(" ")}d.add(f,a,k,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)ra(a,c,b,e,d,f,g,k);else g=c[++e],ra(a,c,b,e,d,f,g,k)};function ta(a,c,b,e,d){const f=a.length;let g=[],k,h;k=C();for(let l=0,m,n,t,p;l<c;l++)for(let q=0;q<f;q++)if(t=a[q],l<t.length&&(m=t[l]))for(let y=0;y<m.length;y++)n=m[y],(h=k[n])?k[n]++:(h=0,k[n]=1),p=g[h]||(g[h]=[]),p.push(n);if(a=g.length)if(d)g=1<g.length?ua(g,b,e):(g=g[0]).length>b||e?g.slice(e,b+e):g;else{if(a<f)return[];g=g[a-1];if(b||e)if(g.length>b||e)g=g.slice(e,b+e)}return g}
function ua(a,c,b){const e=[],d=C();let f;var g=a.length;let k;for(let h=g-1;0<=h;h--)if(k=(g=a[h])&&g.length)for(let l=0;l<k;l++)if(f=g[l],!d[f])if(d[f]=1,b)b--;else if(e.push(f),e.length===c)return e;return e}function va(a,c){const b=C(),e=[];for(let d=0,f;d<c.length;d++){f=c[d];for(let g=0;g<f.length;g++)b[f[g]]=1}for(let d=0,f;d<a.length;d++)f=a[d],b[f]&&(e.push(f),b[f]=0);return e};function S(a,c,b,e){if(!a.length)return a;if(1===a.length)return a=a[0],a=b||a.length>c?c?a.slice(b,b+c):a.slice(b):a,e?T.call(this,a):a;let d=[];for(let f=0,g,k;f<a.length;f++)if((g=a[f])&&(k=g.length)){if(b){if(b>=k){b-=k;continue}b<k&&(g=c?g.slice(b,b+c):g.slice(b),k=g.length,b=0)}k>c&&(g=g.slice(0,c),k=c);if(!d.length&&k>=c)return e?T.call(this,g):g;d.push(g);c-=k;if(!c)break}d=1<d.length?[].concat.apply([],d):d[0];return e?T.call(this,d):d};function U(a,c,b){var e=b[0];if(e.then)return Promise.all(b).then(function(m){return a[c].apply(a,m)});if(e[0]&&e[0].index)return a[c].apply(a,e);e=[];let d=[],f=0,g=0,k,h,l;for(let m=0,n;m<b.length;m++)if(n=b[m]){let t;if(n.constructor===V)t=n.result;else if(n.constructor===Array)t=n;else if(f=n.limit||0,g=n.offset||0,l=n.suggest,h=n.resolve,k=n.enrich&&h,n.index)n.resolve=!1,t=n.index.search(n).result,n.resolve=h;else if(n.and)t=a.and(n.and);else if(n.or)t=a.or(n.or);else if(n.xor)t=a.xor(n.xor);
else if(n.not)t=a.not(n.not);else continue;if(t.then)d.push(t);else if(t.length)e[m]=t;else if(!l&&("and"===c||"xor"===c)){e=[];break}}return{O:e,P:d,limit:f,offset:g,enrich:k,resolve:h,suggest:l}};V.prototype.or=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f}=U(this,"or",arguments);return wa.call(this,a,c,b,e,d,f)};function wa(a,c,b,e,d,f){if(c.length){const g=this;return Promise.all(c).then(function(k){a=[];for(let h=0,l;h<k.length;h++)(l=k[h]).length&&(a[h]=l);return wa.call(g,a,[],b,e,d,f)})}a.length&&(this.result.length&&a.push(this.result),2>a.length?this.result=a[0]:(this.result=ua(a,b,e),e=0));return f?this.resolve(b,e,d):this};V.prototype.and=function(){let a=this.result.length,c,b,e,d;if(!a){const f=arguments[0];f&&(a=!!f.suggest,d=f.resolve,c=f.limit,b=f.offset,e=f.enrich&&d)}if(a){const {O:f,P:g,limit:k,offset:h,enrich:l,resolve:m,suggest:n}=U(this,"and",arguments);return xa.call(this,f,g,k,h,l,m,n)}return d?this.resolve(c,b,e):this};
function xa(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return xa.call(k,a,[],b,e,d,f,g)})}if(a.length)if(this.result.length&&a.unshift(this.result),2>a.length)this.result=a[0];else{if(c=aa(a))return this.result=ta(a,c,b,e,g),f?d?T.call(this.index,this.result):this.result:this;this.result=[]}else g||(this.result=a);return f?this.resolve(b,e,d):this};V.prototype.xor=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=U(this,"xor",arguments);return ya.call(this,a,c,b,e,d,f,g)};
function ya(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return ya.call(k,a,[],b,e,d,f,g)})}if(a.length)if(this.result.length&&a.unshift(this.result),2>a.length)this.result=a[0];else return this.result=za.call(this,a,b,e,f,this.h),f?d?T.call(this.index,this.result):this.result:this;else g||(this.result=a);return f?this.resolve(b,e,d):this}
function za(a,c,b,e,d){const f=[],g=C();let k=0;for(let h=0,l;h<a.length;h++)if(l=a[h]){k<l.length&&(k=l.length);for(let m=0,n;m<l.length;m++)if(n=l[m])for(let t=0,p;t<n.length;t++)p=n[t],g[p]=g[p]?2:1}for(let h=0,l,m=0;h<k;h++)for(let n=0,t;n<a.length;n++)if(t=a[n])if(l=t[h])for(let p=0,q;p<l.length;p++)if(q=l[p],1===g[q])if(b)b--;else if(e){if(f.push(q),f.length===c)return f}else{const y=h+(n?d:0);f[y]||(f[y]=[]);f[y].push(q);if(++m===c)return f}return f};V.prototype.not=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=U(this,"not",arguments);return Aa.call(this,a,c,b,e,d,f,g)};function Aa(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Aa.call(k,a,[],b,e,d,f,g)})}if(a.length&&this.result.length)this.result=Ba.call(this,a,b,e,f);else if(f)return this.resolve(b,e,d);return f?d?T.call(this.index,this.result):this.result:this}
function Ba(a,c,b,e){const d=[];a=new Set(a.flat().flat());for(let f=0,g,k=0;f<this.result.length;f++)if(g=this.result[f])for(let h=0,l;h<g.length;h++)if(l=g[h],!a.has(l))if(b)b--;else if(e){if(d.push(l),d.length===c)return d}else if(d[f]||(d[f]=[]),d[f].push(l),++k===c)return d;return d};function V(a){if(!this||this.constructor!==V)return new V(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.h=a.boost||0,this.result=a.index.search(a).result,this;this.index=null;this.result=a||[];this.h=0}V.prototype.limit=function(a){if(this.result.length){const c=[];for(let b=0,e;b<this.result.length;b++)if(e=this.result[b])if(e.length<=a){if(c[b]=e,a-=e.length,!a)break}else{c[b]=e.slice(0,a);break}this.result=c}return this};
V.prototype.offset=function(a){if(this.result.length){const c=[];for(let b=0,e;b<this.result.length;b++)if(e=this.result[b])e.length<=a?a-=e.length:(c[b]=e.slice(a),a=0);this.result=c}return this};V.prototype.boost=function(a){this.h+=a;return this};V.prototype.resolve=function(a,c,b){const e=this.result,d=this.index;this.result=this.index=null;return e.length?("object"===typeof a&&(b=a.enrich,c=a.offset,a=a.limit),S.call(d,e,a||100,c,b)):e};C();R.prototype.search=function(a,c,b,e){b||(!c&&H(a)?(b=a,a=""):H(c)&&(b=c,c=0));let d=[];var f=[];let g,k,h,l,m,n,t=0,p,q;if(b){b.constructor===Array&&(b={index:b});a=b.query||a;var y=b.pluck;k=b.merge;l=y||b.field||(l=b.index)&&(l.index?null:l);m=this.tag&&b.tag;h=b.suggest;p=!0;g=this.store&&b.enrich&&p;q=b.highlight&&g;c=b.limit||c;n=b.offset||0;c||(c=100);if(m){m.constructor!==Array&&(m=[m]);var w=[];for(let x=0,r;x<m.length;x++)if(r=m[x],r.field&&r.tag){var u=r.tag;if(u.constructor===Array)for(var z=
0;z<u.length;z++)w.push(r.field,u[z]);else w.push(r.field,u)}else{u=Object.keys(r);for(let D=0,F,A;D<u.length;D++)if(F=u[D],A=r[F],A.constructor===Array)for(z=0;z<A.length;z++)w.push(F,A[z]);else w.push(F,A)}m=w;if(!a){e=[];if(w.length)for(f=0;f<w.length;f+=2)y=Ca.call(this,w[f],w[f+1],c,n,g),d.push({field:w[f],tag:w[f+1],result:y});return e.length?Promise.all(e).then(function(x){for(let r=0;r<x.length;r++)d[r].result=x[r];return d}):d}}l&&l.constructor!==Array&&(l=[l])}l||(l=this.field);w=!e&&(this.worker||
this.db)&&[];for(let x=0,r,D,F;x<l.length;x++){D=l[x];let A;E(D)||(A=D,D=A.field,a=A.query||a,c=A.limit||c,n=A.offset||n,h=A.suggest||h,g=this.store&&(A.enrich||g));if(e)r=e[x];else if(u=A||b,z=this.index.get(D),m&&(u.enrich=!1),w){w[x]=z.search(a,c,u);u&&g&&(u.enrich=g);continue}else r=z.search(a,c,u),u&&g&&(u.enrich=g);F=r&&(p?r.length:r.result.length);if(m&&F){u=[];z=0;for(let I=0,G,Ra;I<m.length;I+=2){G=this.tag.get(m[I]);if(!G)if(h)continue;else return p?d:new V(d);if(Ra=(G=G&&G.get(m[I+1]))&&
G.length)z++,u.push(G);else if(!h)return p?d:new V(d)}if(z){r=va(r,u);F=r.length;if(!F&&!h)return p?r:new V(r);z--}}if(F)f[t]=D,d.push(r),t++;else if(1===l.length)return p?d:new V(d)}if(w){const x=this;return Promise.all(w).then(function(r){return r.length?x.search(a,c,b,r):r})}if(!t)return p?d:new V(d);if(y&&(!g||!this.store))return d[0];w=[];for(let x=0,r;x<f.length;x++){r=d[x];g&&r.length&&!r[0].doc&&(r=T.call(this,r));if(y)return p?r:new V(r);d[x]={field:f[x],result:r}}return k?Da(d,c):q?Ea(d,
this.R&&(this.G.clear(),this.L=this.L/1.1|0));g&&b.push(g)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.K&&(this.F.set(a,b),this.F.size>this.R&&(this.F.clear(),this.K=this.K/1.1|0));return b};function L(a){a.H=null;a.F.clear();a.G.clear()};let M,N;async function ia(a){a=a.data;var c=a.task;const b=a.id;let e=a.args;switch(c){case "init":N=a.options||{};(c=a.factory)?(Function("return "+c)()(self),M=new self.FlexSearch.Index(N),delete self.FlexSearch):M=new O(N);postMessage({id:b});break;default:let d;"export"===c&&(e[1]?(e[0]=N.export,e[2]=0,e[3]=1):e=null);"import"===c?e[0]&&(a=await N.import.call(M,e[0]),M.import(e[0],a)):(d=e&&M[c].apply(M,e))&&d.then&&(d=await d);postMessage("search"===c?{id:b,msg:d}:{id:b})}};function ja(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}let Q,ka;const R={},S={};function la(a){Q=0;R[a]=S[a]}
function P(a){this[a+"Async"]=function(){const c=arguments;var b=c[c.length-1];let e;"function"===typeof b&&(e=b,delete c[c.length-1]);Q||(Q=setTimeout(la,0,a),ka=Date.now());S[a]||(S[a]=R[a]=1E3);if(!--R[a]){R[a]=S[a]=S[a]*this.priority*this.priority*3/(Date.now()-ka)|0||1;Q=clearTimeout(Q);const f=this;return new Promise(g=>{setTimeout(function(){g(f[a+"Async"].apply(f,c))},0)})}const d=this[a].apply(this,c);b=d.then?d:new Promise(f=>f(d));e&&b.then(e);return b}};let T=0;
function ma(a={}){function c(g){function k(h){h=h.data||h;const l=h.id,m=l&&d.h[l];m&&(m(h.msg),delete d.h[l])}this.worker=g;this.h=C();if(this.worker){e?this.worker.on("message",k):this.worker.onmessage=k;if(a.config)return new Promise(function(h){d.h[++T]=function(){h(d)};d.worker.postMessage({id:T,task:"init",factory:b,options:a})});this.worker.postMessage({task:"init",factory:b,options:a});return this}}if(!this||this.constructor!==ma)return new ma(a);let b="undefined"!==typeof self?self._factory:"undefined"!==
typeof window?window._factory:null;b&&(b=b.toString());const e="undefined"===typeof window,d=this,f=na(b,e,a.worker);return f.then?f.then(function(g){return c.call(d,g)}):c.call(this,f)}U("add");U("append");U("search");U("update");U("remove");U("clear");U("export");U("import");ja(ma.prototype);
function U(a){ma.prototype[a]=function(){const c=this,b=[].slice.call(arguments);var e=b[b.length-1];let d;"function"===typeof e&&(d=e,b.pop());e=new Promise(function(f){"export"===a&&"function"===typeof b[0]&&(b[0]=null);c.h[++T]=f;c.worker.postMessage({task:a,id:T,args:b})});return d?(e.then(d),this):e}}
function na(a,c,b){return c?"undefined"!==typeof module?new (require("worker_threads")["Worker"])(__dirname + "/node/node.js"):import("worker_threads").then(function(worker){ return new worker["Worker"]((1,eval)("import.meta.dirname") + "/node/node.mjs"); }):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+ia.toString()],{type:"text/javascript"}))):new window.Worker("string"===typeof b?b:(0,eval)("import.meta.url").replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js",
"module/worker/worker.js"),{type:"module"})};function oa(a,c=0){let b=[],e=[];c&&(c=25E4/c*5E3|0);for(const d of a.entries())e.push(d),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}function pa(a,c){c||(c=new Map);for(let b=0,e;b<a.length;b++)e=a[b],c.set(e[0],e[1]);return c}function qa(a,c=0){let b=[],e=[];c&&(c=25E4/c*1E3|0);for(const d of a.entries())e.push([d[0],oa(d[1])[0]]),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}
function ra(a,c){c||(c=new Map);for(let b=0,e,d;b<a.length;b++)e=a[b],d=c.get(e[0]),c.set(e[0],pa(e[1],d));return c}function sa(a){let c=[],b=[];for(const e of a.keys())b.push(e),25E4===b.length&&(c.push(b),b=[]);b.length&&c.push(b);return c}function ta(a,c){c||(c=new Set);for(let b=0;b<a.length;b++)c.add(a[b]);return c}
function ua(a,c,b,e,d,f,g=0){const k=e&&e.constructor===Array;var h=k?e.shift():e;if(!h)return this.export(a,c,d,f+1);if((h=a((c?c+".":"")+(g+1)+"."+b,JSON.stringify(h)))&&h.then){const l=this;return h.then(function(){return ua.call(l,a,c,b,k?e:null,d,f,g+1)})}return ua.call(this,a,c,b,k?e:null,d,f,g+1)};V.prototype.add=function(a,c,b){H(a)&&(c=a,a=I(c,this.key));if(c&&(a||0===a)){if(!b&&this.reg.has(a))return this.update(a,c);for(let k=0,h;k<this.field.length;k++){h=this.C[k];var e=this.index.get(this.field[k]);if("function"===typeof h){var d=h(c);d&&e.add(a,d,!1,!0)}else if(d=h.I,!d||d(c))h.constructor===String?h=[""+h]:D(h)&&(h=[h]),va(c,h,this.J,0,e,a,h[0],b)}if(this.tag)for(e=0;e<this.B.length;e++){var f=this.B[e];d=this.tag.get(this.T[e]);let k=C();if("function"===typeof f){if(f=f(c),!f)continue}else{var g=
f.I;if(g&&!g(c))continue;f.constructor===String&&(f=""+f);f=I(c,f)}if(d&&f){D(f)&&(f=[f]);for(let h=0,l,m;h<f.length;h++)l=f[h],k[l]||(k[l]=1,(g=d.get(l))?m=g:d.set(l,m=[]),b&&m.includes(a)||(m.push(a),this.fastupdate&&((g=this.reg.get(a))?g.push(m):this.reg.set(a,[m]))))}}if(this.store&&(!b||!this.store.has(a))){let k;if(this.A){k=C();for(let h=0,l;h<this.A.length;h++){l=this.A[h];if((b=l.I)&&!b(c))continue;let m;if("function"===typeof l){m=l(c);if(!m)continue;l=[l.U]}else if(D(l)||l.constructor===
String){k[l]=c[l];continue}wa(c,k,l,0,l[0],m)}}this.store.set(a,k||c)}}return this};function wa(a,c,b,e,d,f){a=a[d];if(e===b.length-1)c[d]=f||a;else if(a)if(a.constructor===Array)for(c=c[d]=Array(a.length),d=0;d<a.length;d++)wa(a,c,b,e,d);else c=c[d]||(c[d]=C()),d=b[++e],wa(a,c,b,e,d)}
function va(a,c,b,e,d,f,g,k){if(a=a[g])if(e===c.length-1){if(a.constructor===Array){if(b[e]){for(c=0;c<a.length;c++)d.add(f,a[c],!0,!0);return}a=a.join(" ")}d.add(f,a,k,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)va(a,c,b,e,d,f,g,k);else g=c[++e],va(a,c,b,e,d,f,g,k)};function xa(a,c,b,e,d){const f=a.length;let g=[],k,h;k=C();for(let l=0,m,n,t,p;l<c;l++)for(let q=0;q<f;q++)if(t=a[q],l<t.length&&(m=t[l]))for(let y=0;y<m.length;y++)n=m[y],(h=k[n])?k[n]++:(h=0,k[n]=1),p=g[h]||(g[h]=[]),p.push(n);if(a=g.length)if(d)g=1<g.length?ya(g,b,e):(g=g[0]).length>b||e?g.slice(e,b+e):g;else{if(a<f)return[];g=g[a-1];if(b||e)if(g.length>b||e)g=g.slice(e,b+e)}return g}
function ya(a,c,b){const e=[],d=C();let f;var g=a.length;let k;for(let h=g-1;0<=h;h--)if(k=(g=a[h])&&g.length)for(let l=0;l<k;l++)if(f=g[l],!d[f])if(d[f]=1,b)b--;else if(e.push(f),e.length===c)return e;return e}function za(a,c){const b=C(),e=[];for(let d=0,f;d<c.length;d++){f=c[d];for(let g=0;g<f.length;g++)b[f[g]]=1}for(let d=0,f;d<a.length;d++)f=a[d],b[f]&&(e.push(f),b[f]=0);return e};function Aa(a,c,b,e){if(!a.length)return a;if(1===a.length)return a=a[0],a=b||a.length>c?c?a.slice(b,b+c):a.slice(b):a,e?W.call(this,a):a;let d=[];for(let f=0,g,k;f<a.length;f++)if((g=a[f])&&(k=g.length)){if(b){if(b>=k){b-=k;continue}b<k&&(g=c?g.slice(b,b+c):g.slice(b),k=g.length,b=0)}k>c&&(g=g.slice(0,c),k=c);if(!d.length&&k>=c)return e?W.call(this,g):g;d.push(g);c-=k;if(!c)break}d=1<d.length?[].concat.apply([],d):d[0];return e?W.call(this,d):d};function Ba(a,c,b){var e=b[0];if(e.then)return Promise.all(b).then(function(m){return a[c].apply(a,m)});if(e[0]&&e[0].index)return a[c].apply(a,e);e=[];let d=[],f=0,g=0,k,h,l;for(let m=0,n;m<b.length;m++)if(n=b[m]){let t;if(n.constructor===X)t=n.result;else if(n.constructor===Array)t=n;else if(f=n.limit||0,g=n.offset||0,l=n.suggest,h=n.resolve,k=n.enrich&&h,n.index)n.resolve=!1,t=n.index.search(n).result,n.resolve=h;else if(n.and)t=a.and(n.and);else if(n.or)t=a.or(n.or);else if(n.xor)t=a.xor(n.xor);
else if(n.not)t=a.not(n.not);else continue;if(t.then)d.push(t);else if(t.length)e[m]=t;else if(!l&&("and"===c||"xor"===c)){e=[];break}}return{O:e,P:d,limit:f,offset:g,enrich:k,resolve:h,suggest:l}};X.prototype.or=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f}=Ba(this,"or",arguments);return Ca.call(this,a,c,b,e,d,f)};function Ca(a,c,b,e,d,f){if(c.length){const g=this;return Promise.all(c).then(function(k){a=[];for(let h=0,l;h<k.length;h++)(l=k[h]).length&&(a[h]=l);return Ca.call(g,a,[],b,e,d,f)})}a.length&&(this.result.length&&a.push(this.result),2>a.length?this.result=a[0]:(this.result=ya(a,b,e),e=0));return f?this.resolve(b,e,d):this};X.prototype.and=function(){let a=this.result.length,c,b,e,d;if(!a){const f=arguments[0];f&&(a=!!f.suggest,d=f.resolve,c=f.limit,b=f.offset,e=f.enrich&&d)}if(a){const {O:f,P:g,limit:k,offset:h,enrich:l,resolve:m,suggest:n}=Ba(this,"and",arguments);return Da.call(this,f,g,k,h,l,m,n)}return d?this.resolve(c,b,e):this};
function Da(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Da.call(k,a,[],b,e,d,f,g)})}if(a.length)if(this.result.length&&a.unshift(this.result),2>a.length)this.result=a[0];else{if(c=aa(a))return this.result=xa(a,c,b,e,g),f?d?W.call(this.index,this.result):this.result:this;this.result=[]}else g||(this.result=a);return f?this.resolve(b,e,d):this};X.prototype.xor=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=Ba(this,"xor",arguments);return Ea.call(this,a,c,b,e,d,f,g)};
function Ea(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Ea.call(k,a,[],b,e,d,f,g)})}if(a.length)if(this.result.length&&a.unshift(this.result),2>a.length)this.result=a[0];else return this.result=Fa.call(this,a,b,e,f,this.h),f?d?W.call(this.index,this.result):this.result:this;else g||(this.result=a);return f?this.resolve(b,e,d):this}
function Fa(a,c,b,e,d){const f=[],g=C();let k=0;for(let h=0,l;h<a.length;h++)if(l=a[h]){k<l.length&&(k=l.length);for(let m=0,n;m<l.length;m++)if(n=l[m])for(let t=0,p;t<n.length;t++)p=n[t],g[p]=g[p]?2:1}for(let h=0,l,m=0;h<k;h++)for(let n=0,t;n<a.length;n++)if(t=a[n])if(l=t[h])for(let p=0,q;p<l.length;p++)if(q=l[p],1===g[q])if(b)b--;else if(e){if(f.push(q),f.length===c)return f}else{const y=h+(n?d:0);f[y]||(f[y]=[]);f[y].push(q);if(++m===c)return f}return f};X.prototype.not=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=Ba(this,"not",arguments);return Ga.call(this,a,c,b,e,d,f,g)};function Ga(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Ga.call(k,a,[],b,e,d,f,g)})}if(a.length&&this.result.length)this.result=Ha.call(this,a,b,e,f);else if(f)return this.resolve(b,e,d);return f?d?W.call(this.index,this.result):this.result:this}
function Ha(a,c,b,e){const d=[];a=new Set(a.flat().flat());for(let f=0,g,k=0;f<this.result.length;f++)if(g=this.result[f])for(let h=0,l;h<g.length;h++)if(l=g[h],!a.has(l))if(b)b--;else if(e){if(d.push(l),d.length===c)return d}else if(d[f]||(d[f]=[]),d[f].push(l),++k===c)return d;return d};function X(a){if(!this||this.constructor!==X)return new X(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.h=a.boost||0,this.result=a.index.search(a).result,this;this.index=null;this.result=a||[];this.h=0}X.prototype.limit=function(a){if(this.result.length){const c=[];for(let b=0,e;b<this.result.length;b++)if(e=this.result[b])if(e.length<=a){if(c[b]=e,a-=e.length,!a)break}else{c[b]=e.slice(0,a);break}this.result=c}return this};
X.prototype.offset=function(a){if(this.result.length){const c=[];for(let b=0,e;b<this.result.length;b++)if(e=this.result[b])e.length<=a?a-=e.length:(c[b]=e.slice(a),a=0);this.result=c}return this};X.prototype.boost=function(a){this.h+=a;return this};X.prototype.resolve=function(a,c,b){const e=this.result,d=this.index;this.result=this.index=null;return e.length?("object"===typeof a&&(b=a.enrich,c=a.offset,a=a.limit),Aa.call(d,e,a||100,c,b)):e};C();V.prototype.search=function(a,c,b,e){b||(!c&&H(a)?(b=a,a=""):H(c)&&(b=c,c=0));let d=[];var f=[];let g,k,h,l,m,n,t=0,p,q;if(b){b.constructor===Array&&(b={index:b});a=b.query||a;var y=b.pluck;k=b.merge;l=y||b.field||(l=b.index)&&(l.index?null:l);m=this.tag&&b.tag;h=b.suggest;p=!0;g=this.store&&b.enrich&&p;q=b.highlight&&g;c=b.limit||c;n=b.offset||0;c||(c=100);if(m){m.constructor!==Array&&(m=[m]);var w=[];for(let x=0,r;x<m.length;x++)if(r=m[x],r.field&&r.tag){var u=r.tag;if(u.constructor===Array)for(var z=
0;z<u.length;z++)w.push(r.field,u[z]);else w.push(r.field,u)}else{u=Object.keys(r);for(let E=0,F,A;E<u.length;E++)if(F=u[E],A=r[F],A.constructor===Array)for(z=0;z<A.length;z++)w.push(F,A[z]);else w.push(F,A)}m=w;if(!a){e=[];if(w.length)for(f=0;f<w.length;f+=2)y=Ia.call(this,w[f],w[f+1],c,n,g),d.push({field:w[f],tag:w[f+1],result:y});return e.length?Promise.all(e).then(function(x){for(let r=0;r<x.length;r++)d[r].result=x[r];return d}):d}}l&&l.constructor!==Array&&(l=[l])}l||(l=this.field);w=!e&&(this.worker||
this.db)&&[];for(let x=0,r,E,F;x<l.length;x++){E=l[x];let A;D(E)||(A=E,E=A.field,a=A.query||a,c=A.limit||c,n=A.offset||n,h=A.suggest||h,g=this.store&&(A.enrich||g));if(e)r=e[x];else if(u=A||b,z=this.index.get(E),m&&(u.enrich=!1),w){w[x]=z.search(a,c,u);u&&g&&(u.enrich=g);continue}else r=z.search(a,c,u),u&&g&&(u.enrich=g);F=r&&(p?r.length:r.result.length);if(m&&F){u=[];z=0;for(let J=0,G,Ya;J<m.length;J+=2){G=this.tag.get(m[J]);if(!G)if(h)continue;else return p?d:new X(d);if(Ya=(G=G&&G.get(m[J+1]))&&
G.length)z++,u.push(G);else if(!h)return p?d:new X(d)}if(z){r=za(r,u);F=r.length;if(!F&&!h)return p?r:new X(r);z--}}if(F)f[t]=E,d.push(r),t++;else if(1===l.length)return p?d:new X(d)}if(w){const x=this;return Promise.all(w).then(function(r){return r.length?x.search(a,c,b,r):r})}if(!t)return p?d:new X(d);if(y&&(!g||!this.store))return d[0];w=[];for(let x=0,r;x<f.length;x++){r=d[x];g&&r.length&&!r[0].doc&&(r=W.call(this,r));if(y)return p?r:new X(r);d[x]={field:f[x],result:r}}return k?Ja(d,c):q?Ka(d,
a,this.index,this.field,this.C,q):d};
function Ea(a,c,b,e,d,f){let g,k,h;for(let m=0,n,t,p,q,y;m<a.length;m++){n=a[m].result;t=a[m].field;q=b.get(t);p=q.encoder;h=q.tokenize;y=d[e.indexOf(t)];p!==g&&(g=p,k=g.encode(c));for(let w=0;w<n.length;w++){let u="";var l=J(n[w].doc,y);let z=g.encode(l);l=l.split(g.split);for(let x=0,r,D;x<z.length;x++){r=z[x];D=l[x];let F;for(let A=0,I;A<k.length;A++)if(I=k[A],"strict"===h){if(r===I){u+=(u?" ":"")+f.replace("$1",D);F=!0;break}}else{const G=r.indexOf(I);if(-1<G){u+=(u?" ":"")+D.substring(0,G)+f.replace("$1",
D.substring(G,I.length))+D.substring(G+I.length);F=!0;break}}F||(u+=(u?" ":"")+l[x])}n[w].highlight=u}}return a}function Da(a,c){const b=[],e=C();for(let d=0,f,g;d<a.length;d++){f=a[d];g=f.result;for(let k=0,h,l,m;k<g.length;k++)if(l=g[k],h=l.id,m=e[h])m.push(f.field);else{if(b.length===c)return b;l.field=e[h]=[f.field];b.push(l)}}return b}function Ca(a,c,b,e,d){a=this.tag.get(a);if(!a)return[];if((c=(a=a&&a.get(c))&&a.length-e)&&0<c){if(c>b||e)a=a.slice(e,e+b);d&&(a=T.call(this,a));return a}}
function T(a){if(!this||!this.store)return a;const c=Array(a.length);for(let b=0,e;b<a.length;b++)e=a[b],c[b]={id:e,doc:this.store.get(e)};return c};function R(a){if(!this||this.constructor!==R)return new R(a);const c=a.document||a.doc||a;var b;this.C=[];this.field=[];this.J=[];this.key=(b=c.key||c.id)&&W(b,this.J)||"id";this.reg=(this.fastupdate=!!a.fastupdate)?new Map:new Set;this.A=(b=c.store||null)&&b&&!0!==b&&[];this.store=b&&new Map;this.cache=(b=a.cache||null)&&new X(b);a.cache=!1;b=new Map;let e=c.index||c.field||c;E(e)&&(e=[e]);for(let d=0,f,g;d<e.length;d++)f=e[d],E(f)||(g=f,f=f.field),g=H(g)?Object.assign({},a,g):a,b.set(f,new Y(g,
this.reg)),g.custom?this.C[d]=g.custom:(this.C[d]=W(f,this.J),g.filter&&("string"===typeof this.C[d]&&(this.C[d]=new String(this.C[d])),this.C[d].I=g.filter)),this.field[d]=f;if(this.A){a=c.store;E(a)&&(a=[a]);for(let d=0,f,g;d<a.length;d++)f=a[d],g=f.field||f,f.custom?(this.A[d]=f.custom,f.custom.U=g):(this.A[d]=W(g,this.J),f.filter&&("string"===typeof this.A[d]&&(this.A[d]=new String(this.A[d])),this.A[d].I=f.filter))}this.index=b;this.tag=null;if(b=c.tag)if("string"===typeof b&&(b=[b]),b.length){this.tag=
new Map;this.B=[];this.T=[];for(let d=0,f,g;d<b.length;d++){f=b[d];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");f.custom?this.B[d]=f.custom:(this.B[d]=W(g,this.J),f.filter&&("string"===typeof this.B[d]&&(this.B[d]=new String(this.B[d])),this.B[d].I=f.filter));this.T[d]=g;this.tag.set(g,new Map)}}}
function W(a,c){const b=a.split(":");let e=0;for(let d=0;d<b.length;d++)a=b[d],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(c[e]=!0),a&&(b[e++]=a);e<b.length&&(b.length=e);return 1<e?b:b[0]}v=R.prototype;v.append=function(a,c){return this.add(a,c,!0)};v.update=function(a,c){return this.remove(a).add(a,c)};
v.remove=function(a){H(a)&&(a=J(a,this.key));for(var c of this.index.values())c.remove(a,!0);if(this.reg.has(a)){if(this.tag&&!this.fastupdate)for(let b of this.tag.values())for(let e of b){c=e[0];const d=e[1],f=d.indexOf(a);-1<f&&(1<d.length?d.splice(f,1):b.delete(c))}this.store&&this.store.delete(a);this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
v.clear=function(){for(const a of this.index.values())a.clear();if(this.tag)for(const a of this.tag.values())a.clear();this.store&&this.store.clear();return this};v.contain=function(a){return this.reg.has(a)};v.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};v.get=function(a){return this.store.get(a)};v.set=function(a,c){this.store.set(a,c);return this};v.searchCache=Fa;
v.export=function(a,c,b=0,e=0){if(b<this.field.length){const g=this.field[b];if((c=this.index.get(g).export(a,g,b,e=1))&&c.then){const k=this;return c.then(function(){return k.export(a,g,b+1)})}return this.export(a,g,b+1)}let d,f;switch(e){case 0:d="reg";f=pa(this.reg);c=null;break;case 1:d="tag";f=na(this.tag,this.reg.size);c=null;break;case 2:d="doc";f=la(this.store);c=null;break;case 3:d="cfg";c=f=null;break;default:return}return Q.call(this,a,c,d,f,b,e)};
v.import=function(a,c){if(c){"string"===typeof c&&(c=JSON.parse(c));a=a.split(".");"json"===a[a.length-1]&&a.pop();var b=2<a.length?a[0]:"";a=2<a.length?a[2]:a[1];if(b)return this.index.get(b).import(a,c);switch(a){case "reg":this.fastupdate=!1;this.reg=qa(c,this.reg);for(let e=0,d;e<this.field.length;e++)d=this.index.get(this.field[e]),d.fastupdate=!1,d.reg=this.reg;break;case "tag":this.tag=oa(c,this.tag);break;case "doc":this.store=ma(c,this.store)}}};ia(R.prototype);function Fa(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new X);let e=this.cache.get(a);if(!e){e=this.search(a,c,b);if(e.then){const d=this;e.then(function(f){d.cache.set(a,f);return f})}this.cache.set(a,e)}return e}function X(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}X.prototype.set=function(a,c){this.cache.set(this.h=a,c);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};
X.prototype.get=function(a){const c=this.cache.get(a);c&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,c));return c};X.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};X.prototype.clear=function(){this.cache.clear();this.h=""};const Ga={normalize:function(a){return a.toLowerCase()}};const Ha=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]);const Ia=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["pf","f"]]),Ja=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\1+/g,"$1"];const Ka={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,"\u00df":2,d:3,t:3,l:4,m:5,n:5,r:6};const La=/[\x00-\x7F]+/g;const Ma=/[\x00-\x7F]+/g;const Na=/[\x00-\x7F]+/g;var Oa={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:Ga,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Ha},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Ha,matcher:Ia,replacer:Ja},LatinExtra:{normalize:!0,dedupe:!0,mapper:Ha,replacer:Ja.concat([/(?!^)[aeo]/g,""]),matcher:Ia},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let b=0;b<a.length;b++){var c=a[b];let e=c.charAt(0),d=Ka[e];for(let f=1,g;f<c.length&&(g=c.charAt(f),"h"===
g||"w"===g||!(g=Ka[g])||g===d||(e+=g,d=g,4!==e.length));f++);a[b]=e}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(La," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(Ma,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Na," ")}}};const Pa={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};Y.prototype.add=function(a,c,b,e){if(c&&(a||0===a)){if(!e&&!b&&this.reg.has(a))return this.update(a,c);c=this.encoder.encode(c);if(e=c.length){const l=C(),m=C(),n=this.depth,t=this.resolution;for(let p=0;p<e;p++){let q=c[this.rtl?e-1-p:p];var d=q.length;if(d&&(n||!m[q])){var f=this.score?this.score(c,q,p,null,0):Qa(t,e,p),g="";switch(this.tokenize){case "full":if(2<d){for(f=0;f<d;f++)for(var k=d;k>f;k--){g=q.substring(f,k);var h=this.score?this.score(c,q,p,g,f):Qa(t,e,p,d,f);Z(this,m,g,h,a,b)}break}case "reverse":if(1<
d){for(k=d-1;0<k;k--)g=q[k]+g,h=this.score?this.score(c,q,p,g,k):Qa(t,e,p,d,k),Z(this,m,g,h,a,b);g=""}case "forward":if(1<d){for(k=0;k<d;k++)g+=q[k],Z(this,m,g,f,a,b);break}default:if(Z(this,m,q,f,a,b),n&&1<e&&p<e-1)for(d=C(),g=this.S,f=q,k=Math.min(n+1,e-p),d[f]=1,h=1;h<k;h++)if((q=c[this.rtl?e-1-p-h:p+h])&&!d[q]){d[q]=1;const y=this.score?this.score(c,f,p,q,h):Qa(g+(e/2>g?0:1),e,p,k-1,h-1),w=this.bidirectional&&q>f;Z(this,l,w?f:q,y,a,b,w?q:f)}}}}this.fastupdate||this.reg.add(a)}}return this};
function Z(a,c,b,e,d,f,g){let k=g?a.ctx:a.map,h;if(!c[b]||g&&!(h=c[b])[g])g?(c=h||(c[b]=C()),c[g]=1,(h=k.get(g))?k=h:k.set(g,k=new Map)):c[b]=1,(h=k.get(b))?k=h:k.set(b,k=[]),k=k[e]||(k[e]=[]),f&&k.includes(d)||(k.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(k):a.reg.set(d,[k])))}function Qa(a,c,b,e,d){return b&&1<a?c+(e||0)<=a?b+(d||0):(a-1)/(c+(e||0))*(b+(d||0))+1|0:0};Y.prototype.search=function(a,c,b){b||(!c&&H(a)?(b=a,a=""):H(c)&&(b=c,c=0));var e=[],d=0;if(b){a=b.query||a;c=b.limit||c;d=b.offset||0;var f=b.context;var g=b.suggest;var k=!0;var h=b.resolution}else k=!0;a=this.encoder.encode(a);b=a.length;c=c||(k?100:0);if(1===b)return g=c,(c=Sa(this,a[0],""))&&c.length?S.call(this,c,g,d):[];f=this.depth&&!1!==f;if(2===b&&f&&!g)return g=c,(c=Sa(this,a[0],a[1]))&&c.length?S.call(this,c,g,d):[];k=C();let l=0;if(1<b&&f){var m=a[0];l=1}h||0===h||(h=m?this.S:this.resolution);
for(let q,y;l<b;l++){if((y=a[l])&&!k[y]){k[y]=1;q=Sa(this,y,m);a:{f=q;var n=e,t=g,p=h;let w=[];if(f&&f.length){if(f.length<=p){n.push(f);q=void 0;break a}for(let u=0,z;u<p;u++)if(z=f[u])w[u]=z;if(w.length){n.push(w);q=void 0;break a}}q=t?void 0:w}if(q){e=q;break}m&&(g&&q&&e.length||(m=y))}g&&m&&l===b-1&&!e.length&&(m="",l=-1,k=C())}a:{a=e;e=a.length;m=a;if(1<e)m=ta(a,h,c,d,g);else if(1===e){g=S.call(null,a[0],c,d);break a}g=m}return g};
function Sa(a,c,b){let e;b&&(e=a.bidirectional&&c>b)&&(e=b,b=c,c=e);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};Y.prototype.remove=function(a,c){const b=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(b){if(this.fastupdate)for(let e=0,d;e<b.length;e++){if(d=b[e])if(2>d.length)d.pop();else{const f=d.indexOf(a);f===b.length-1?d.pop():d.splice(f,1)}}else Ta(this.map,a),this.depth&&Ta(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function Ta(a,c){let b=0;if(a.constructor===Array)for(let e=0,d,f;e<a.length;e++){if((d=a[e])&&d.length)if(f=d.indexOf(c),0<=f){1<d.length?(d.splice(f,1),b++):delete a[e];break}else b++}else for(let e of a.entries()){const d=e[0],f=Ta(e[1],c);f?b+=f:a.delete(d)}return b};function Y(a,c){if(!this||this.constructor!==Y)return new Y(a);if(a){var b=E(a)?a:a.preset;b&&(a=Object.assign({},Pa[b],a))}else a={};b=a.context;const e=!0===b?{depth:1}:b||{},d=E(a.encoder)?Oa[a.encoder]:a.encode||a.encoder||Ga;this.encoder=d.encode?d:"object"===typeof d?new K(d):{encode:d};this.resolution=a.resolution||9;this.tokenize=(b=a.tokenize)&&"default"!==b&&b||"strict";this.depth="strict"===b&&e.depth||0;this.bidirectional=!1!==e.bidirectional;this.fastupdate=!!a.fastupdate;this.score=
a.score||null;b=!1;this.map=new Map;this.ctx=new Map;this.reg=c||(this.fastupdate?new Map:new Set);this.S=e.resolution||3;this.rtl=d.rtl||a.rtl||!1;this.cache=(b=a.cache||null)&&new X(b);this.priority=a.priority||4}v=Y.prototype;v.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};v.append=function(a,c){return this.add(a,c,!0)};v.contain=function(a){return this.reg.has(a)};
v.update=function(a,c){const b=this,e=this.remove(a);return e&&e.then?e.then(()=>b.add(a,c)):this.add(a,c)};function Ua(a){let c=0;if(a.constructor===Array)for(let b=0,e;b<a.length;b++)(e=a[b])&&(c+=e.length);else for(const b of a){const e=b[0],d=Ua(b[1]);d?c+=d:a.delete(e)}return c}v.cleanup=function(){if(!this.fastupdate)return this;Ua(this.map);this.depth&&Ua(this.ctx);return this};v.searchCache=Fa;
v.export=function(a,c,b=0,e=0){let d,f;switch(e){case 0:d="reg";f=pa(this.reg);break;case 1:d="cfg";f=null;break;case 2:d="map";f=la(this.map,this.reg.size);break;case 3:d="ctx";f=na(this.ctx,this.reg.size);break;default:return}return Q.call(this,a,c,d,f,b,e)};
v.import=function(a,c){if(c)switch("string"===typeof c&&(c=JSON.parse(c)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=qa(c,this.reg);break;case "map":this.map=ma(c,this.map);break;case "ctx":this.ctx=oa(c,this.ctx)}};
function Ka(a,c,b,e,d,f){let g,k,h;for(let m=0,n,t,p,q,y;m<a.length;m++){n=a[m].result;t=a[m].field;q=b.get(t);p=q.encoder;h=q.tokenize;y=d[e.indexOf(t)];p!==g&&(g=p,k=g.encode(c));for(let w=0;w<n.length;w++){let u="";var l=I(n[w].doc,y);let z=g.encode(l);l=l.split(g.split);for(let x=0,r,E;x<z.length;x++){r=z[x];E=l[x];let F;for(let A=0,J;A<k.length;A++)if(J=k[A],"strict"===h){if(r===J){u+=(u?" ":"")+f.replace("$1",E);F=!0;break}}else{const G=r.indexOf(J);if(-1<G){u+=(u?" ":"")+E.substring(0,G)+f.replace("$1",
E.substring(G,J.length))+E.substring(G+J.length);F=!0;break}}F||(u+=(u?" ":"")+l[x])}n[w].highlight=u}}return a}function Ja(a,c){const b=[],e=C();for(let d=0,f,g;d<a.length;d++){f=a[d];g=f.result;for(let k=0,h,l,m;k<g.length;k++)if(l=g[k],h=l.id,m=e[h])m.push(f.field);else{if(b.length===c)return b;l.field=e[h]=[f.field];b.push(l)}}return b}function Ia(a,c,b,e,d){a=this.tag.get(a);if(!a)return[];if((c=(a=a&&a.get(c))&&a.length-e)&&0<c){if(c>b||e)a=a.slice(e,e+b);d&&(a=W.call(this,a));return a}}
function W(a){if(!this||!this.store)return a;const c=Array(a.length);for(let b=0,e;b<a.length;b++)e=a[b],c[b]={id:e,doc:this.store.get(e)};return c};function V(a){if(!this||this.constructor!==V)return new V(a);const c=a.document||a.doc||a;var b;this.C=[];this.field=[];this.J=[];this.key=(b=c.key||c.id)&&La(b,this.J)||"id";this.reg=(this.fastupdate=!!a.fastupdate)?new Map:new Set;this.A=(b=c.store||null)&&b&&!0!==b&&[];this.store=b&&new Map;this.cache=(b=a.cache||null)&&new Y(b);a.cache=!1;b=new Map;let e=c.index||c.field||c;D(e)&&(e=[e]);for(let d=0,f,g;d<e.length;d++)f=e[d],D(f)||(g=f,f=f.field),g=H(g)?Object.assign({},a,g):a,b.set(f,new O(g,
this.reg)),g.custom?this.C[d]=g.custom:(this.C[d]=La(f,this.J),g.filter&&("string"===typeof this.C[d]&&(this.C[d]=new String(this.C[d])),this.C[d].I=g.filter)),this.field[d]=f;if(this.A){a=c.store;D(a)&&(a=[a]);for(let d=0,f,g;d<a.length;d++)f=a[d],g=f.field||f,f.custom?(this.A[d]=f.custom,f.custom.U=g):(this.A[d]=La(g,this.J),f.filter&&("string"===typeof this.A[d]&&(this.A[d]=new String(this.A[d])),this.A[d].I=f.filter))}this.index=b;this.tag=null;if(b=c.tag)if("string"===typeof b&&(b=[b]),b.length){this.tag=
new Map;this.B=[];this.T=[];for(let d=0,f,g;d<b.length;d++){f=b[d];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");f.custom?this.B[d]=f.custom:(this.B[d]=La(g,this.J),f.filter&&("string"===typeof this.B[d]&&(this.B[d]=new String(this.B[d])),this.B[d].I=f.filter));this.T[d]=g;this.tag.set(g,new Map)}}}
function La(a,c){const b=a.split(":");let e=0;for(let d=0;d<b.length;d++)a=b[d],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(c[e]=!0),a&&(b[e++]=a);e<b.length&&(b.length=e);return 1<e?b:b[0]}v=V.prototype;v.append=function(a,c){return this.add(a,c,!0)};v.update=function(a,c){return this.remove(a).add(a,c)};
v.remove=function(a){H(a)&&(a=I(a,this.key));for(var c of this.index.values())c.remove(a,!0);if(this.reg.has(a)){if(this.tag&&!this.fastupdate)for(let b of this.tag.values())for(let e of b){c=e[0];const d=e[1],f=d.indexOf(a);-1<f&&(1<d.length?d.splice(f,1):b.delete(c))}this.store&&this.store.delete(a);this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
v.clear=function(){for(const a of this.index.values())a.clear();if(this.tag)for(const a of this.tag.values())a.clear();this.store&&this.store.clear();return this};v.contain=function(a){return this.reg.has(a)};v.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};v.get=function(a){return this.store.get(a)};v.set=function(a,c){this.store.set(a,c);return this};v.searchCache=Ma;
v.export=function(a,c,b=0,e=0){if(b<this.field.length){const g=this.field[b];if((c=this.index.get(g).export(a,g,b,e=1))&&c.then){const k=this;return c.then(function(){return k.export(a,g,b+1)})}return this.export(a,g,b+1)}let d,f;switch(e){case 0:d="reg";f=sa(this.reg);c=null;break;case 1:d="tag";f=qa(this.tag,this.reg.size);c=null;break;case 2:d="doc";f=oa(this.store);c=null;break;case 3:d="cfg";c=f=null;break;default:return}return ua.call(this,a,c,d,f,b,e)};
v.import=function(a,c){var b=a.split(".");"json"===b[b.length-1]&&b.pop();a=2<b.length?b[0]:"";b=2<b.length?b[2]:b[1];if(c){"string"===typeof c&&(c=JSON.parse(c));if(a)return this.index.get(a).import(b,c);switch(b){case "reg":this.fastupdate=!1;this.reg=ta(c,this.reg);for(let e=0,d;e<this.field.length;e++)d=this.index.get(this.field[e]),d.fastupdate=!1,d.reg=this.reg;break;case "tag":this.tag=ra(c,this.tag);break;case "doc":this.store=pa(c,this.store)}}};ja(V.prototype);function Ma(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new Y);let e=this.cache.get(a);if(!e){e=this.search(a,c,b);if(e.then){const d=this;e.then(function(f){d.cache.set(a,f);return f})}this.cache.set(a,e)}return e}function Y(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}Y.prototype.set=function(a,c){this.cache.set(this.h=a,c);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};
Y.prototype.get=function(a){const c=this.cache.get(a);c&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,c));return c};Y.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};Y.prototype.clear=function(){this.cache.clear();this.h=""};const Na={normalize:function(a){return a.toLowerCase()}};const Oa=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]);const Pa=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["pf","f"]]),Qa=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\1+/g,"$1"];const Ra={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,"\u00df":2,d:3,t:3,l:4,m:5,n:5,r:6};const Sa=/[\x00-\x7F]+/g;const Ta=/[\x00-\x7F]+/g;const Ua=/[\x00-\x7F]+/g;var Va={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:Na,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Oa},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Oa,matcher:Pa,replacer:Qa},LatinExtra:{normalize:!0,dedupe:!0,mapper:Oa,replacer:Qa.concat([/(?!^)[aeo]/g,""]),matcher:Pa},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let b=0;b<a.length;b++){var c=a[b];let e=c.charAt(0),d=Ra[e];for(let f=1,g;f<c.length&&(g=c.charAt(f),"h"===
g||"w"===g||!(g=Ra[g])||g===d||(e+=g,d=g,4!==e.length));f++);a[b]=e}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Sa," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(Ta,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Ua," ")}}};const Wa={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};O.prototype.add=function(a,c,b,e){if(c&&(a||0===a)){if(!e&&!b&&this.reg.has(a))return this.update(a,c);c=this.encoder.encode(c);if(e=c.length){const l=C(),m=C(),n=this.depth,t=this.resolution;for(let p=0;p<e;p++){let q=c[this.rtl?e-1-p:p];var d=q.length;if(d&&(n||!m[q])){var f=this.score?this.score(c,q,p,null,0):Xa(t,e,p),g="";switch(this.tokenize){case "full":if(2<d){for(f=0;f<d;f++)for(var k=d;k>f;k--){g=q.substring(f,k);var h=this.score?this.score(c,q,p,g,f):Xa(t,e,p,d,f);Z(this,m,g,h,a,b)}break}case "reverse":if(1<
d){for(k=d-1;0<k;k--)g=q[k]+g,h=this.score?this.score(c,q,p,g,k):Xa(t,e,p,d,k),Z(this,m,g,h,a,b);g=""}case "forward":if(1<d){for(k=0;k<d;k++)g+=q[k],Z(this,m,g,f,a,b);break}default:if(Z(this,m,q,f,a,b),n&&1<e&&p<e-1)for(d=C(),g=this.S,f=q,k=Math.min(n+1,e-p),d[f]=1,h=1;h<k;h++)if((q=c[this.rtl?e-1-p-h:p+h])&&!d[q]){d[q]=1;const y=this.score?this.score(c,f,p,q,h):Xa(g+(e/2>g?0:1),e,p,k-1,h-1),w=this.bidirectional&&q>f;Z(this,l,w?f:q,y,a,b,w?q:f)}}}}this.fastupdate||this.reg.add(a)}}return this};
function Z(a,c,b,e,d,f,g){let k=g?a.ctx:a.map,h;if(!c[b]||g&&!(h=c[b])[g])g?(c=h||(c[b]=C()),c[g]=1,(h=k.get(g))?k=h:k.set(g,k=new Map)):c[b]=1,(h=k.get(b))?k=h:k.set(b,k=[]),k=k[e]||(k[e]=[]),f&&k.includes(d)||(k.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(k):a.reg.set(d,[k])))}function Xa(a,c,b,e,d){return b&&1<a?c+(e||0)<=a?b+(d||0):(a-1)/(c+(e||0))*(b+(d||0))+1|0:0};O.prototype.search=function(a,c,b){b||(!c&&H(a)?(b=a,a=""):H(c)&&(b=c,c=0));var e=[],d=0;if(b){a=b.query||a;c=b.limit||c;d=b.offset||0;var f=b.context;var g=b.suggest;var k=!0;var h=b.resolution}else k=!0;a=this.encoder.encode(a);b=a.length;c=c||(k?100:0);if(1===b)return g=c,(c=Za(this,a[0],""))&&c.length?Aa.call(this,c,g,d):[];f=this.depth&&!1!==f;if(2===b&&f&&!g)return g=c,(c=Za(this,a[0],a[1]))&&c.length?Aa.call(this,c,g,d):[];k=C();let l=0;if(1<b&&f){var m=a[0];l=1}h||0===h||(h=m?this.S:this.resolution);
for(let q,y;l<b;l++){if((y=a[l])&&!k[y]){k[y]=1;q=Za(this,y,m);a:{f=q;var n=e,t=g,p=h;let w=[];if(f&&f.length){if(f.length<=p){n.push(f);q=void 0;break a}for(let u=0,z;u<p;u++)if(z=f[u])w[u]=z;if(w.length){n.push(w);q=void 0;break a}}q=t?void 0:w}if(q){e=q;break}m&&(g&&q&&e.length||(m=y))}g&&m&&l===b-1&&!e.length&&(m="",l=-1,k=C())}a:{a=e;e=a.length;m=a;if(1<e)m=xa(a,h,c,d,g);else if(1===e){g=Aa.call(null,a[0],c,d);break a}g=m}return g};
function Za(a,c,b){let e;b&&(e=a.bidirectional&&c>b)&&(e=b,b=c,c=e);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};O.prototype.remove=function(a,c){const b=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(b){if(this.fastupdate)for(let e=0,d;e<b.length;e++){if(d=b[e])if(2>d.length)d.pop();else{const f=d.indexOf(a);f===b.length-1?d.pop():d.splice(f,1)}}else $a(this.map,a),this.depth&&$a(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function $a(a,c){let b=0;if(a.constructor===Array)for(let e=0,d,f;e<a.length;e++){if((d=a[e])&&d.length)if(f=d.indexOf(c),0<=f){1<d.length?(d.splice(f,1),b++):delete a[e];break}else b++}else for(let e of a.entries()){const d=e[0],f=$a(e[1],c);f?b+=f:a.delete(d)}return b};function O(a,c){if(!this||this.constructor!==O)return new O(a);if(a){var b=D(a)?a:a.preset;b&&(a=Object.assign({},Wa[b],a))}else a={};b=a.context;const e=!0===b?{depth:1}:b||{},d=D(a.encoder)?Va[a.encoder]:a.encode||a.encoder||Na;this.encoder=d.encode?d:"object"===typeof d?new K(d):{encode:d};this.resolution=a.resolution||9;this.tokenize=(b=a.tokenize)&&"default"!==b&&b||"strict";this.depth="strict"===b&&e.depth||0;this.bidirectional=!1!==e.bidirectional;this.fastupdate=!!a.fastupdate;this.score=
a.score||null;b=!1;this.map=new Map;this.ctx=new Map;this.reg=c||(this.fastupdate?new Map:new Set);this.S=e.resolution||3;this.rtl=d.rtl||a.rtl||!1;this.cache=(b=a.cache||null)&&new Y(b);this.priority=a.priority||4}v=O.prototype;v.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};v.append=function(a,c){return this.add(a,c,!0)};v.contain=function(a){return this.reg.has(a)};
v.update=function(a,c){const b=this,e=this.remove(a);return e&&e.then?e.then(()=>b.add(a,c)):this.add(a,c)};function ab(a){let c=0;if(a.constructor===Array)for(let b=0,e;b<a.length;b++)(e=a[b])&&(c+=e.length);else for(const b of a){const e=b[0],d=ab(b[1]);d?c+=d:a.delete(e)}return c}v.cleanup=function(){if(!this.fastupdate)return this;ab(this.map);this.depth&&ab(this.ctx);return this};v.searchCache=Ma;
v.export=function(a,c,b=0,e=0){let d,f;switch(e){case 0:d="reg";f=sa(this.reg);break;case 1:d="cfg";f=null;break;case 2:d="map";f=oa(this.map,this.reg.size);break;case 3:d="ctx";f=qa(this.ctx,this.reg.size);break;default:return}return ua.call(this,a,c,d,f,b,e)};
v.import=function(a,c){if(c)switch("string"===typeof c&&(c=JSON.parse(c)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),3===a.length&&a.shift(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=ta(c,this.reg);break;case "map":this.map=pa(c,this.map);break;case "ctx":this.ctx=ra(c,this.ctx)}};
v.serialize=function(a=!0){if(!this.reg.size)return"";let c="",b="";for(var e of this.reg.keys())b||(b=typeof e),c+=(c?",":"")+("string"===b?'"'+e+'"':e);c="index.reg=new Set(["+c+"]);";e="";for(var d of this.map.entries()){var f=d[0],g=d[1],k="";for(let m=0,n;m<g.length;m++){n=g[m]||[""];var h="";for(var l=0;l<n.length;l++)h+=(h?",":"")+("string"===b?'"'+n[l]+'"':n[l]);h="["+h+"]";k+=(k?",":"")+h}k='["'+f+'",['+k+"]]";e+=(e?",":"")+k}e="index.map=new Map(["+e+"]);";d="";for(const m of this.ctx.entries()){f=
m[0];g=m[1];for(const n of g.entries()){g=n[0];k=n[1];h="";for(let t=0,p;t<k.length;t++){p=k[t]||[""];l="";for(let q=0;q<p.length;q++)l+=(l?",":"")+("string"===b?'"'+p[q]+'"':p[q]);l="["+l+"]";h+=(h?",":"")+l}h='new Map([["'+g+'",['+h+"]]])";h='["'+f+'",'+h+"]";d+=(d?",":"")+h}}d="index.ctx=new Map(["+d+"]);";return a?"function inject(index){"+c+e+d+"}":c+e+d};ia(Y.prototype);const Va={Index:Y,Charset:Oa,Encoder:K,Document:R,Worker:null,Resolver:null,IndexedDB:null,Language:{}},Wa="undefined"!==typeof self?self:"undefined"!==typeof global?global:"undefined"!==typeof window?window:{};let Xa;(Xa=Wa.define)&&Xa.amd?Xa([],function(){return Va}):"object"===typeof Wa.exports?Wa.exports=Va:Wa.FlexSearch=Va;}(this||self));
m[0];g=m[1];for(const n of g.entries()){g=n[0];k=n[1];h="";for(let t=0,p;t<k.length;t++){p=k[t]||[""];l="";for(let q=0;q<p.length;q++)l+=(l?",":"")+("string"===b?'"'+p[q]+'"':p[q]);l="["+l+"]";h+=(h?",":"")+l}h='new Map([["'+g+'",['+h+"]]])";h='["'+f+'",'+h+"]";d+=(d?",":"")+h}}d="index.ctx=new Map(["+d+"]);";return a?"function inject(index){"+c+e+d+"}":c+e+d};ja(O.prototype);const bb={Index:O,Charset:Va,Encoder:K,Document:V,Worker:null,Resolver:null,IndexedDB:null,Language:{}},cb="undefined"!==typeof self?self:"undefined"!==typeof global?global:"undefined"!==typeof window?window:{};let db;(db=cb.define)&&db.amd?db([],function(){return bb}):"object"===typeof cb.exports?cb.exports=bb:cb.FlexSearch=bb;}(this||self));

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,12 @@
/**!
* FlexSearch.js v0.8.111 (Bundle)
* FlexSearch.js v0.8.113 (Bundle)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
var v;function B(a,c,b){const e=typeof b,d=typeof a;if("undefined"!==e){if("undefined"!==d){if(b){if("function"===d&&e===d)return function(k){return a(b(k))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var f=new Map(b);for(var g of a)f.set(g[0],g[1]);return f}if(c===Set){g=new Set(b);for(f of a.values())g.add(f);return g}}}return a}return b}return"undefined"===d?c:a}function C(){return Object.create(null)}function E(a){return"string"===typeof a}
function H(a){return"object"===typeof a}function J(a,c){if(E(c))a=a[c];else for(let b=0;a&&b<c.length;b++)a=a[c[b]];return a}function aa(a){let c=0;for(let b=0,e;b<a.length;b++)(e=a[b])&&c<e.length&&(c=e.length);return c};var ba=[["\u00aa","a"],["\u00b2","2"],["\u00b3","3"],["\u00b9","1"],["\u00ba","o"],["\u00bc","1\u20444"],["\u00bd","1\u20442"],["\u00be","3\u20444"],["\u00e0","a"],["\u00e1","a"],["\u00e2","a"],["\u00e3","a"],["\u00e4","a"],["\u00e5","a"],["\u00e7","c"],["\u00e8","e"],["\u00e9","e"],["\u00ea","e"],["\u00eb","e"],["\u00ec","i"],["\u00ed","i"],["\u00ee","i"],["\u00ef","i"],["\u00f1","n"],["\u00f2","o"],["\u00f3","o"],["\u00f4","o"],["\u00f5","o"],["\u00f6","o"],["\u00f9","u"],["\u00fa","u"],["\u00fb",
var v;function B(a,c,b){const e=typeof b,d=typeof a;if("undefined"!==e){if("undefined"!==d){if(b){if("function"===d&&e===d)return function(k){return a(b(k))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var f=new Map(b);for(var g of a)f.set(g[0],g[1]);return f}if(c===Set){g=new Set(b);for(f of a.values())g.add(f);return g}}}return a}return b}return"undefined"===d?c:a}function C(){return Object.create(null)}function D(a){return"string"===typeof a}
function H(a){return"object"===typeof a}function I(a,c){if(D(c))a=a[c];else for(let b=0;a&&b<c.length;b++)a=a[c[b]];return a}function aa(a){let c=0;for(let b=0,e;b<a.length;b++)(e=a[b])&&c<e.length&&(c=e.length);return c};var ba=[["\u00aa","a"],["\u00b2","2"],["\u00b3","3"],["\u00b9","1"],["\u00ba","o"],["\u00bc","1\u20444"],["\u00bd","1\u20442"],["\u00be","3\u20444"],["\u00e0","a"],["\u00e1","a"],["\u00e2","a"],["\u00e3","a"],["\u00e4","a"],["\u00e5","a"],["\u00e7","c"],["\u00e8","e"],["\u00e9","e"],["\u00ea","e"],["\u00eb","e"],["\u00ec","i"],["\u00ed","i"],["\u00ee","i"],["\u00ef","i"],["\u00f1","n"],["\u00f2","o"],["\u00f3","o"],["\u00f4","o"],["\u00f5","o"],["\u00f6","o"],["\u00f9","u"],["\u00fa","u"],["\u00fb",
"u"],["\u00fc","u"],["\u00fd","y"],["\u00ff","y"],["\u0101","a"],["\u0103","a"],["\u0105","a"],["\u0107","c"],["\u0109","c"],["\u010b","c"],["\u010d","c"],["\u010f","d"],["\u0113","e"],["\u0115","e"],["\u0117","e"],["\u0119","e"],["\u011b","e"],["\u011d","g"],["\u011f","g"],["\u0121","g"],["\u0123","g"],["\u0125","h"],["\u0129","i"],["\u012b","i"],["\u012d","i"],["\u012f","i"],["\u0133","ij"],["\u0135","j"],["\u0137","k"],["\u013a","l"],["\u013c","l"],["\u013e","l"],["\u0140","l"],["\u0144","n"],
["\u0146","n"],["\u0148","n"],["\u0149","n"],["\u014d","o"],["\u014f","o"],["\u0151","o"],["\u0155","r"],["\u0157","r"],["\u0159","r"],["\u015b","s"],["\u015d","s"],["\u015f","s"],["\u0161","s"],["\u0163","t"],["\u0165","t"],["\u0169","u"],["\u016b","u"],["\u016d","u"],["\u016f","u"],["\u0171","u"],["\u0173","u"],["\u0175","w"],["\u0177","y"],["\u017a","z"],["\u017c","z"],["\u017e","z"],["\u017f","s"],["\u01a1","o"],["\u01b0","u"],["\u01c6","dz"],["\u01c9","lj"],["\u01cc","nj"],["\u01ce","a"],["\u01d0",
"i"],["\u01d2","o"],["\u01d4","u"],["\u01d6","u"],["\u01d8","u"],["\u01da","u"],["\u01dc","u"],["\u01df","a"],["\u01e1","a"],["\u01e3","ae"],["\u00e6","ae"],["\u01fd","ae"],["\u01e7","g"],["\u01e9","k"],["\u01eb","o"],["\u01ed","o"],["\u01ef","\u0292"],["\u01f0","j"],["\u01f3","dz"],["\u01f5","g"],["\u01f9","n"],["\u01fb","a"],["\u01ff","\u00f8"],["\u0201","a"],["\u0203","a"],["\u0205","e"],["\u0207","e"],["\u0209","i"],["\u020b","i"],["\u020d","o"],["\u020f","o"],["\u0211","r"],["\u0213","r"],["\u0215",
@@ -21,45 +21,50 @@ v.addMatcher=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);i
v.encode=function(a){if(this.cache&&a.length<=this.K)if(this.H){if(this.F.has(a))return this.F.get(a)}else this.H=setTimeout(L,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=ha?a.normalize("NFKD").replace(ha,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3<a.length&&(a=a.replace(ea,"$1 $2").replace(fa,"$1 $2").replace(da,"$1 "));const c=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let b=
[],e=this.split||""===this.split?a.split(this.split):a;for(let f=0,g,k;f<e.length;f++)if((g=k=e[f])&&!(g.length<this.minlength))if(c)b.push(g);else if(!this.filter||!this.filter.has(g)){if(this.cache&&g.length<=this.L)if(this.H){var d=this.G.get(g);if(d||""===d){d&&b.push(d);continue}}else this.H=setTimeout(L,50,this);this.stemmer&&2<g.length&&(this.N||(this.N=new RegExp("(?!^)("+this.D+")$")),g=g.replace(this.N,h=>this.stemmer.get(h)),g.length<this.minlength||this.filter&&this.filter.has(g))&&(g=
"");if(g&&(this.mapper||this.dedupe&&1<g.length)){d="";for(let h=0,l="",m,n;h<g.length;h++)m=g.charAt(h),m===l&&this.dedupe||((n=this.mapper&&this.mapper.get(m))||""===n?n===l&&this.dedupe||!(l=n)||(d+=n):d+=l=m);g=d}this.matcher&&1<g.length&&(this.M||(this.M=new RegExp("("+this.h+")","g")),g=g.replace(this.M,h=>this.matcher.get(h)));if(g&&this.replacer)for(d=0;g&&d<this.replacer.length;d+=2)g=g.replace(this.replacer[d],this.replacer[d+1]);this.cache&&k.length<=this.L&&(this.G.set(k,g),this.G.size>
this.R&&(this.G.clear(),this.L=this.L/1.1|0));g&&b.push(g)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.K&&(this.F.set(a,b),this.F.size>this.R&&(this.F.clear(),this.K=this.K/1.1|0));return b};function L(a){a.H=null;a.F.clear();a.G.clear()};function ia(a){M.call(a,"add");M.call(a,"append");M.call(a,"search");M.call(a,"update");M.call(a,"remove")}let N,ja;const O={},P={};function ka(a){N=0;O[a]=P[a]}
function M(a){this[a+"Async"]=function(){const c=arguments;var b=c[c.length-1];let e;"function"===typeof b&&(e=b,delete c[c.length-1]);N||(N=setTimeout(ka,0,a),ja=Date.now());P[a]||(P[a]=O[a]=1E3);if(!--O[a]){O[a]=P[a]=P[a]*this.priority*this.priority*3/(Date.now()-ja)|0||1;N=clearTimeout(N);const f=this;return new Promise(g=>{setTimeout(function(){g(f[a+"Async"].apply(f,c))},0)})}const d=this[a].apply(this,c);b=d.then?d:new Promise(f=>f(d));e&&b.then(e);return b}};function la(a,c=0){let b=[],e=[];c&&(c=25E4/c*5E3|0);for(const d of a.entries())e.push(d),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}function ma(a,c){c||(c=new Map);for(let b=0,e;b<a.length;b++)e=a[b],c.set(e[0],e[1]);return c}function na(a,c=0){let b=[],e=[];c&&(c=25E4/c*1E3|0);for(const d of a.entries())e.push([d[0],la(d[1])[0]]),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}
function oa(a,c){c||(c=new Map);for(let b=0,e,d;b<a.length;b++)e=a[b],d=c.get(e[0]),c.set(e[0],ma(e[1],d));return c}function pa(a){let c=[],b=[];for(const e of a.keys())b.push(e),25E4===b.length&&(c.push(b),b=[]);b.length&&c.push(b);return c}function qa(a,c){c||(c=new Set);for(let b=0;b<a.length;b++)c.add(a[b]);return c}
function Q(a,c,b,e,d,f,g=0){const k=e&&e.constructor===Array;var h=k?e.shift():e;if(!h)return this.export(a,c,d,f+1);if((h=a((c?c+".":"")+(g+1)+"."+b,JSON.stringify(h)))&&h.then){const l=this;return h.then(function(){return Q.call(l,a,c,b,k?e:null,d,f,g+1)})}return Q.call(this,a,c,b,k?e:null,d,f,g+1)};R.prototype.add=function(a,c,b){H(a)&&(c=a,a=J(c,this.key));if(c&&(a||0===a)){if(!b&&this.reg.has(a))return this.update(a,c);for(let k=0,h;k<this.field.length;k++){h=this.C[k];var e=this.index.get(this.field[k]);if("function"===typeof h){var d=h(c);d&&e.add(a,d,!1,!0)}else if(d=h.I,!d||d(c))h.constructor===String?h=[""+h]:E(h)&&(h=[h]),ra(c,h,this.J,0,e,a,h[0],b)}if(this.tag)for(e=0;e<this.B.length;e++){var f=this.B[e];d=this.tag.get(this.T[e]);let k=C();if("function"===typeof f){if(f=f(c),!f)continue}else{var g=
f.I;if(g&&!g(c))continue;f.constructor===String&&(f=""+f);f=J(c,f)}if(d&&f){E(f)&&(f=[f]);for(let h=0,l,m;h<f.length;h++)l=f[h],k[l]||(k[l]=1,(g=d.get(l))?m=g:d.set(l,m=[]),b&&m.includes(a)||(m.push(a),this.fastupdate&&((g=this.reg.get(a))?g.push(m):this.reg.set(a,[m]))))}}if(this.store&&(!b||!this.store.has(a))){let k;if(this.A){k=C();for(let h=0,l;h<this.A.length;h++){l=this.A[h];if((b=l.I)&&!b(c))continue;let m;if("function"===typeof l){m=l(c);if(!m)continue;l=[l.U]}else if(E(l)||l.constructor===
String){k[l]=c[l];continue}sa(c,k,l,0,l[0],m)}}this.store.set(a,k||c)}}return this};function sa(a,c,b,e,d,f){a=a[d];if(e===b.length-1)c[d]=f||a;else if(a)if(a.constructor===Array)for(c=c[d]=Array(a.length),d=0;d<a.length;d++)sa(a,c,b,e,d);else c=c[d]||(c[d]=C()),d=b[++e],sa(a,c,b,e,d)}
function ra(a,c,b,e,d,f,g,k){if(a=a[g])if(e===c.length-1){if(a.constructor===Array){if(b[e]){for(c=0;c<a.length;c++)d.add(f,a[c],!0,!0);return}a=a.join(" ")}d.add(f,a,k,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)ra(a,c,b,e,d,f,g,k);else g=c[++e],ra(a,c,b,e,d,f,g,k)};function ta(a,c,b,e,d){const f=a.length;let g=[],k,h;k=C();for(let l=0,m,n,t,p;l<c;l++)for(let q=0;q<f;q++)if(t=a[q],l<t.length&&(m=t[l]))for(let y=0;y<m.length;y++)n=m[y],(h=k[n])?k[n]++:(h=0,k[n]=1),p=g[h]||(g[h]=[]),p.push(n);if(a=g.length)if(d)g=1<g.length?ua(g,b,e):(g=g[0]).length>b||e?g.slice(e,b+e):g;else{if(a<f)return[];g=g[a-1];if(b||e)if(g.length>b||e)g=g.slice(e,b+e)}return g}
function ua(a,c,b){const e=[],d=C();let f;var g=a.length;let k;for(let h=g-1;0<=h;h--)if(k=(g=a[h])&&g.length)for(let l=0;l<k;l++)if(f=g[l],!d[f])if(d[f]=1,b)b--;else if(e.push(f),e.length===c)return e;return e}function va(a,c){const b=C(),e=[];for(let d=0,f;d<c.length;d++){f=c[d];for(let g=0;g<f.length;g++)b[f[g]]=1}for(let d=0,f;d<a.length;d++)f=a[d],b[f]&&(e.push(f),b[f]=0);return e};function S(a,c,b,e){if(!a.length)return a;if(1===a.length)return a=a[0],a=b||a.length>c?c?a.slice(b,b+c):a.slice(b):a,e?T.call(this,a):a;let d=[];for(let f=0,g,k;f<a.length;f++)if((g=a[f])&&(k=g.length)){if(b){if(b>=k){b-=k;continue}b<k&&(g=c?g.slice(b,b+c):g.slice(b),k=g.length,b=0)}k>c&&(g=g.slice(0,c),k=c);if(!d.length&&k>=c)return e?T.call(this,g):g;d.push(g);c-=k;if(!c)break}d=1<d.length?[].concat.apply([],d):d[0];return e?T.call(this,d):d};function U(a,c,b){var e=b[0];if(e.then)return Promise.all(b).then(function(m){return a[c].apply(a,m)});if(e[0]&&e[0].index)return a[c].apply(a,e);e=[];let d=[],f=0,g=0,k,h,l;for(let m=0,n;m<b.length;m++)if(n=b[m]){let t;if(n.constructor===V)t=n.result;else if(n.constructor===Array)t=n;else if(f=n.limit||0,g=n.offset||0,l=n.suggest,h=n.resolve,k=n.enrich&&h,n.index)n.resolve=!1,t=n.index.search(n).result,n.resolve=h;else if(n.and)t=a.and(n.and);else if(n.or)t=a.or(n.or);else if(n.xor)t=a.xor(n.xor);
else if(n.not)t=a.not(n.not);else continue;if(t.then)d.push(t);else if(t.length)e[m]=t;else if(!l&&("and"===c||"xor"===c)){e=[];break}}return{O:e,P:d,limit:f,offset:g,enrich:k,resolve:h,suggest:l}};V.prototype.or=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f}=U(this,"or",arguments);return wa.call(this,a,c,b,e,d,f)};function wa(a,c,b,e,d,f){if(c.length){const g=this;return Promise.all(c).then(function(k){a=[];for(let h=0,l;h<k.length;h++)(l=k[h]).length&&(a[h]=l);return wa.call(g,a,[],b,e,d,f)})}a.length&&(this.result.length&&a.push(this.result),2>a.length?this.result=a[0]:(this.result=ua(a,b,e),e=0));return f?this.resolve(b,e,d):this};V.prototype.and=function(){let a=this.result.length,c,b,e,d;if(!a){const f=arguments[0];f&&(a=!!f.suggest,d=f.resolve,c=f.limit,b=f.offset,e=f.enrich&&d)}if(a){const {O:f,P:g,limit:k,offset:h,enrich:l,resolve:m,suggest:n}=U(this,"and",arguments);return xa.call(this,f,g,k,h,l,m,n)}return d?this.resolve(c,b,e):this};
function xa(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return xa.call(k,a,[],b,e,d,f,g)})}if(a.length)if(this.result.length&&a.unshift(this.result),2>a.length)this.result=a[0];else{if(c=aa(a))return this.result=ta(a,c,b,e,g),f?d?T.call(this.index,this.result):this.result:this;this.result=[]}else g||(this.result=a);return f?this.resolve(b,e,d):this};V.prototype.xor=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=U(this,"xor",arguments);return ya.call(this,a,c,b,e,d,f,g)};
function ya(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return ya.call(k,a,[],b,e,d,f,g)})}if(a.length)if(this.result.length&&a.unshift(this.result),2>a.length)this.result=a[0];else return this.result=za.call(this,a,b,e,f,this.h),f?d?T.call(this.index,this.result):this.result:this;else g||(this.result=a);return f?this.resolve(b,e,d):this}
function za(a,c,b,e,d){const f=[],g=C();let k=0;for(let h=0,l;h<a.length;h++)if(l=a[h]){k<l.length&&(k=l.length);for(let m=0,n;m<l.length;m++)if(n=l[m])for(let t=0,p;t<n.length;t++)p=n[t],g[p]=g[p]?2:1}for(let h=0,l,m=0;h<k;h++)for(let n=0,t;n<a.length;n++)if(t=a[n])if(l=t[h])for(let p=0,q;p<l.length;p++)if(q=l[p],1===g[q])if(b)b--;else if(e){if(f.push(q),f.length===c)return f}else{const y=h+(n?d:0);f[y]||(f[y]=[]);f[y].push(q);if(++m===c)return f}return f};V.prototype.not=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=U(this,"not",arguments);return Aa.call(this,a,c,b,e,d,f,g)};function Aa(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Aa.call(k,a,[],b,e,d,f,g)})}if(a.length&&this.result.length)this.result=Ba.call(this,a,b,e,f);else if(f)return this.resolve(b,e,d);return f?d?T.call(this.index,this.result):this.result:this}
function Ba(a,c,b,e){const d=[];a=new Set(a.flat().flat());for(let f=0,g,k=0;f<this.result.length;f++)if(g=this.result[f])for(let h=0,l;h<g.length;h++)if(l=g[h],!a.has(l))if(b)b--;else if(e){if(d.push(l),d.length===c)return d}else if(d[f]||(d[f]=[]),d[f].push(l),++k===c)return d;return d};function V(a){if(!this||this.constructor!==V)return new V(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.h=a.boost||0,this.result=a.index.search(a).result,this;this.index=null;this.result=a||[];this.h=0}V.prototype.limit=function(a){if(this.result.length){const c=[];for(let b=0,e;b<this.result.length;b++)if(e=this.result[b])if(e.length<=a){if(c[b]=e,a-=e.length,!a)break}else{c[b]=e.slice(0,a);break}this.result=c}return this};
V.prototype.offset=function(a){if(this.result.length){const c=[];for(let b=0,e;b<this.result.length;b++)if(e=this.result[b])e.length<=a?a-=e.length:(c[b]=e.slice(a),a=0);this.result=c}return this};V.prototype.boost=function(a){this.h+=a;return this};V.prototype.resolve=function(a,c,b){const e=this.result,d=this.index;this.result=this.index=null;return e.length?("object"===typeof a&&(b=a.enrich,c=a.offset,a=a.limit),S.call(d,e,a||100,c,b)):e};C();R.prototype.search=function(a,c,b,e){b||(!c&&H(a)?(b=a,a=""):H(c)&&(b=c,c=0));let d=[];var f=[];let g,k,h,l,m,n,t=0,p,q;if(b){b.constructor===Array&&(b={index:b});a=b.query||a;var y=b.pluck;k=b.merge;l=y||b.field||(l=b.index)&&(l.index?null:l);m=this.tag&&b.tag;h=b.suggest;p=!0;g=this.store&&b.enrich&&p;q=b.highlight&&g;c=b.limit||c;n=b.offset||0;c||(c=100);if(m){m.constructor!==Array&&(m=[m]);var w=[];for(let x=0,r;x<m.length;x++)if(r=m[x],r.field&&r.tag){var u=r.tag;if(u.constructor===Array)for(var z=
0;z<u.length;z++)w.push(r.field,u[z]);else w.push(r.field,u)}else{u=Object.keys(r);for(let D=0,F,A;D<u.length;D++)if(F=u[D],A=r[F],A.constructor===Array)for(z=0;z<A.length;z++)w.push(F,A[z]);else w.push(F,A)}m=w;if(!a){e=[];if(w.length)for(f=0;f<w.length;f+=2)y=Ca.call(this,w[f],w[f+1],c,n,g),d.push({field:w[f],tag:w[f+1],result:y});return e.length?Promise.all(e).then(function(x){for(let r=0;r<x.length;r++)d[r].result=x[r];return d}):d}}l&&l.constructor!==Array&&(l=[l])}l||(l=this.field);w=!e&&(this.worker||
this.db)&&[];for(let x=0,r,D,F;x<l.length;x++){D=l[x];let A;E(D)||(A=D,D=A.field,a=A.query||a,c=A.limit||c,n=A.offset||n,h=A.suggest||h,g=this.store&&(A.enrich||g));if(e)r=e[x];else if(u=A||b,z=this.index.get(D),m&&(u.enrich=!1),w){w[x]=z.search(a,c,u);u&&g&&(u.enrich=g);continue}else r=z.search(a,c,u),u&&g&&(u.enrich=g);F=r&&(p?r.length:r.result.length);if(m&&F){u=[];z=0;for(let I=0,G,Oa;I<m.length;I+=2){G=this.tag.get(m[I]);if(!G)if(h)continue;else return p?d:new V(d);if(Oa=(G=G&&G.get(m[I+1]))&&
G.length)z++,u.push(G);else if(!h)return p?d:new V(d)}if(z){r=va(r,u);F=r.length;if(!F&&!h)return p?r:new V(r);z--}}if(F)f[t]=D,d.push(r),t++;else if(1===l.length)return p?d:new V(d)}if(w){const x=this;return Promise.all(w).then(function(r){return r.length?x.search(a,c,b,r):r})}if(!t)return p?d:new V(d);if(y&&(!g||!this.store))return d[0];w=[];for(let x=0,r;x<f.length;x++){r=d[x];g&&r.length&&!r[0].doc&&(r=T.call(this,r));if(y)return p?r:new V(r);d[x]={field:f[x],result:r}}return k?Da(d,c):q?Ea(d,
this.R&&(this.G.clear(),this.L=this.L/1.1|0));g&&b.push(g)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.K&&(this.F.set(a,b),this.F.size>this.R&&(this.F.clear(),this.K=this.K/1.1|0));return b};function L(a){a.H=null;a.F.clear();a.G.clear()};let M,N;async function ia(a){a=a.data;var c=a.task;const b=a.id;let e=a.args;switch(c){case "init":N=a.options||{};(c=a.factory)?(Function("return "+c)()(self),M=new self.FlexSearch.Index(N),delete self.FlexSearch):M=new O(N);postMessage({id:b});break;default:let d;"export"===c&&(e[1]?(e[0]=N.export,e[2]=0,e[3]=1):e=null);"import"===c?e[0]&&(a=await N.import.call(M,e[0]),M.import(e[0],a)):(d=e&&M[c].apply(M,e))&&d.then&&(d=await d);postMessage("search"===c?{id:b,msg:d}:{id:b})}};function ja(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}let Q,ka;const R={},S={};function la(a){Q=0;R[a]=S[a]}
function P(a){this[a+"Async"]=function(){const c=arguments;var b=c[c.length-1];let e;"function"===typeof b&&(e=b,delete c[c.length-1]);Q||(Q=setTimeout(la,0,a),ka=Date.now());S[a]||(S[a]=R[a]=1E3);if(!--R[a]){R[a]=S[a]=S[a]*this.priority*this.priority*3/(Date.now()-ka)|0||1;Q=clearTimeout(Q);const f=this;return new Promise(g=>{setTimeout(function(){g(f[a+"Async"].apply(f,c))},0)})}const d=this[a].apply(this,c);b=d.then?d:new Promise(f=>f(d));e&&b.then(e);return b}};let T=0;
function ma(a={}){function c(g){function k(h){h=h.data||h;const l=h.id,m=l&&d.h[l];m&&(m(h.msg),delete d.h[l])}this.worker=g;this.h=C();if(this.worker){e?this.worker.on("message",k):this.worker.onmessage=k;if(a.config)return new Promise(function(h){d.h[++T]=function(){h(d)};d.worker.postMessage({id:T,task:"init",factory:b,options:a})});this.worker.postMessage({task:"init",factory:b,options:a});return this}}if(!this||this.constructor!==ma)return new ma(a);let b="undefined"!==typeof self?self._factory:"undefined"!==
typeof window?window._factory:null;b&&(b=b.toString());const e="undefined"===typeof window,d=this,f=na(b,e,a.worker);return f.then?f.then(function(g){return c.call(d,g)}):c.call(this,f)}U("add");U("append");U("search");U("update");U("remove");U("clear");U("export");U("import");ja(ma.prototype);
function U(a){ma.prototype[a]=function(){const c=this,b=[].slice.call(arguments);var e=b[b.length-1];let d;"function"===typeof e&&(d=e,b.pop());e=new Promise(function(f){"export"===a&&"function"===typeof b[0]&&(b[0]=null);c.h[++T]=f;c.worker.postMessage({task:a,id:T,args:b})});return d?(e.then(d),this):e}}
function na(a,c,b){return c?"undefined"!==typeof module?new (require("worker_threads")["Worker"])(__dirname + "/node/node.js"):import("worker_threads").then(function(worker){ return new worker["Worker"](import.meta.dirname + "/node/node.mjs"); }):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+ia.toString()],{type:"text/javascript"}))):new window.Worker("string"===typeof b?b:import.meta.url.replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js",
"module/worker/worker.js"),{type:"module"})};function oa(a,c=0){let b=[],e=[];c&&(c=25E4/c*5E3|0);for(const d of a.entries())e.push(d),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}function pa(a,c){c||(c=new Map);for(let b=0,e;b<a.length;b++)e=a[b],c.set(e[0],e[1]);return c}function qa(a,c=0){let b=[],e=[];c&&(c=25E4/c*1E3|0);for(const d of a.entries())e.push([d[0],oa(d[1])[0]]),e.length===c&&(b.push(e),e=[]);e.length&&b.push(e);return b}
function ra(a,c){c||(c=new Map);for(let b=0,e,d;b<a.length;b++)e=a[b],d=c.get(e[0]),c.set(e[0],pa(e[1],d));return c}function sa(a){let c=[],b=[];for(const e of a.keys())b.push(e),25E4===b.length&&(c.push(b),b=[]);b.length&&c.push(b);return c}function ta(a,c){c||(c=new Set);for(let b=0;b<a.length;b++)c.add(a[b]);return c}
function ua(a,c,b,e,d,f,g=0){const k=e&&e.constructor===Array;var h=k?e.shift():e;if(!h)return this.export(a,c,d,f+1);if((h=a((c?c+".":"")+(g+1)+"."+b,JSON.stringify(h)))&&h.then){const l=this;return h.then(function(){return ua.call(l,a,c,b,k?e:null,d,f,g+1)})}return ua.call(this,a,c,b,k?e:null,d,f,g+1)};V.prototype.add=function(a,c,b){H(a)&&(c=a,a=I(c,this.key));if(c&&(a||0===a)){if(!b&&this.reg.has(a))return this.update(a,c);for(let k=0,h;k<this.field.length;k++){h=this.C[k];var e=this.index.get(this.field[k]);if("function"===typeof h){var d=h(c);d&&e.add(a,d,!1,!0)}else if(d=h.I,!d||d(c))h.constructor===String?h=[""+h]:D(h)&&(h=[h]),va(c,h,this.J,0,e,a,h[0],b)}if(this.tag)for(e=0;e<this.B.length;e++){var f=this.B[e];d=this.tag.get(this.T[e]);let k=C();if("function"===typeof f){if(f=f(c),!f)continue}else{var g=
f.I;if(g&&!g(c))continue;f.constructor===String&&(f=""+f);f=I(c,f)}if(d&&f){D(f)&&(f=[f]);for(let h=0,l,m;h<f.length;h++)l=f[h],k[l]||(k[l]=1,(g=d.get(l))?m=g:d.set(l,m=[]),b&&m.includes(a)||(m.push(a),this.fastupdate&&((g=this.reg.get(a))?g.push(m):this.reg.set(a,[m]))))}}if(this.store&&(!b||!this.store.has(a))){let k;if(this.A){k=C();for(let h=0,l;h<this.A.length;h++){l=this.A[h];if((b=l.I)&&!b(c))continue;let m;if("function"===typeof l){m=l(c);if(!m)continue;l=[l.U]}else if(D(l)||l.constructor===
String){k[l]=c[l];continue}wa(c,k,l,0,l[0],m)}}this.store.set(a,k||c)}}return this};function wa(a,c,b,e,d,f){a=a[d];if(e===b.length-1)c[d]=f||a;else if(a)if(a.constructor===Array)for(c=c[d]=Array(a.length),d=0;d<a.length;d++)wa(a,c,b,e,d);else c=c[d]||(c[d]=C()),d=b[++e],wa(a,c,b,e,d)}
function va(a,c,b,e,d,f,g,k){if(a=a[g])if(e===c.length-1){if(a.constructor===Array){if(b[e]){for(c=0;c<a.length;c++)d.add(f,a[c],!0,!0);return}a=a.join(" ")}d.add(f,a,k,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)va(a,c,b,e,d,f,g,k);else g=c[++e],va(a,c,b,e,d,f,g,k)};function xa(a,c,b,e,d){const f=a.length;let g=[],k,h;k=C();for(let l=0,m,n,t,p;l<c;l++)for(let q=0;q<f;q++)if(t=a[q],l<t.length&&(m=t[l]))for(let y=0;y<m.length;y++)n=m[y],(h=k[n])?k[n]++:(h=0,k[n]=1),p=g[h]||(g[h]=[]),p.push(n);if(a=g.length)if(d)g=1<g.length?ya(g,b,e):(g=g[0]).length>b||e?g.slice(e,b+e):g;else{if(a<f)return[];g=g[a-1];if(b||e)if(g.length>b||e)g=g.slice(e,b+e)}return g}
function ya(a,c,b){const e=[],d=C();let f;var g=a.length;let k;for(let h=g-1;0<=h;h--)if(k=(g=a[h])&&g.length)for(let l=0;l<k;l++)if(f=g[l],!d[f])if(d[f]=1,b)b--;else if(e.push(f),e.length===c)return e;return e}function za(a,c){const b=C(),e=[];for(let d=0,f;d<c.length;d++){f=c[d];for(let g=0;g<f.length;g++)b[f[g]]=1}for(let d=0,f;d<a.length;d++)f=a[d],b[f]&&(e.push(f),b[f]=0);return e};function Aa(a,c,b,e){if(!a.length)return a;if(1===a.length)return a=a[0],a=b||a.length>c?c?a.slice(b,b+c):a.slice(b):a,e?W.call(this,a):a;let d=[];for(let f=0,g,k;f<a.length;f++)if((g=a[f])&&(k=g.length)){if(b){if(b>=k){b-=k;continue}b<k&&(g=c?g.slice(b,b+c):g.slice(b),k=g.length,b=0)}k>c&&(g=g.slice(0,c),k=c);if(!d.length&&k>=c)return e?W.call(this,g):g;d.push(g);c-=k;if(!c)break}d=1<d.length?[].concat.apply([],d):d[0];return e?W.call(this,d):d};function Ba(a,c,b){var e=b[0];if(e.then)return Promise.all(b).then(function(m){return a[c].apply(a,m)});if(e[0]&&e[0].index)return a[c].apply(a,e);e=[];let d=[],f=0,g=0,k,h,l;for(let m=0,n;m<b.length;m++)if(n=b[m]){let t;if(n.constructor===X)t=n.result;else if(n.constructor===Array)t=n;else if(f=n.limit||0,g=n.offset||0,l=n.suggest,h=n.resolve,k=n.enrich&&h,n.index)n.resolve=!1,t=n.index.search(n).result,n.resolve=h;else if(n.and)t=a.and(n.and);else if(n.or)t=a.or(n.or);else if(n.xor)t=a.xor(n.xor);
else if(n.not)t=a.not(n.not);else continue;if(t.then)d.push(t);else if(t.length)e[m]=t;else if(!l&&("and"===c||"xor"===c)){e=[];break}}return{O:e,P:d,limit:f,offset:g,enrich:k,resolve:h,suggest:l}};X.prototype.or=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f}=Ba(this,"or",arguments);return Ca.call(this,a,c,b,e,d,f)};function Ca(a,c,b,e,d,f){if(c.length){const g=this;return Promise.all(c).then(function(k){a=[];for(let h=0,l;h<k.length;h++)(l=k[h]).length&&(a[h]=l);return Ca.call(g,a,[],b,e,d,f)})}a.length&&(this.result.length&&a.push(this.result),2>a.length?this.result=a[0]:(this.result=ya(a,b,e),e=0));return f?this.resolve(b,e,d):this};X.prototype.and=function(){let a=this.result.length,c,b,e,d;if(!a){const f=arguments[0];f&&(a=!!f.suggest,d=f.resolve,c=f.limit,b=f.offset,e=f.enrich&&d)}if(a){const {O:f,P:g,limit:k,offset:h,enrich:l,resolve:m,suggest:n}=Ba(this,"and",arguments);return Da.call(this,f,g,k,h,l,m,n)}return d?this.resolve(c,b,e):this};
function Da(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Da.call(k,a,[],b,e,d,f,g)})}if(a.length)if(this.result.length&&a.unshift(this.result),2>a.length)this.result=a[0];else{if(c=aa(a))return this.result=xa(a,c,b,e,g),f?d?W.call(this.index,this.result):this.result:this;this.result=[]}else g||(this.result=a);return f?this.resolve(b,e,d):this};X.prototype.xor=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=Ba(this,"xor",arguments);return Ea.call(this,a,c,b,e,d,f,g)};
function Ea(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Ea.call(k,a,[],b,e,d,f,g)})}if(a.length)if(this.result.length&&a.unshift(this.result),2>a.length)this.result=a[0];else return this.result=Fa.call(this,a,b,e,f,this.h),f?d?W.call(this.index,this.result):this.result:this;else g||(this.result=a);return f?this.resolve(b,e,d):this}
function Fa(a,c,b,e,d){const f=[],g=C();let k=0;for(let h=0,l;h<a.length;h++)if(l=a[h]){k<l.length&&(k=l.length);for(let m=0,n;m<l.length;m++)if(n=l[m])for(let t=0,p;t<n.length;t++)p=n[t],g[p]=g[p]?2:1}for(let h=0,l,m=0;h<k;h++)for(let n=0,t;n<a.length;n++)if(t=a[n])if(l=t[h])for(let p=0,q;p<l.length;p++)if(q=l[p],1===g[q])if(b)b--;else if(e){if(f.push(q),f.length===c)return f}else{const y=h+(n?d:0);f[y]||(f[y]=[]);f[y].push(q);if(++m===c)return f}return f};X.prototype.not=function(){const {O:a,P:c,limit:b,offset:e,enrich:d,resolve:f,suggest:g}=Ba(this,"not",arguments);return Ga.call(this,a,c,b,e,d,f,g)};function Ga(a,c,b,e,d,f,g){if(c.length){const k=this;return Promise.all(c).then(function(h){a=[];for(let l=0,m;l<h.length;l++)(m=h[l]).length&&(a[l]=m);return Ga.call(k,a,[],b,e,d,f,g)})}if(a.length&&this.result.length)this.result=Ha.call(this,a,b,e,f);else if(f)return this.resolve(b,e,d);return f?d?W.call(this.index,this.result):this.result:this}
function Ha(a,c,b,e){const d=[];a=new Set(a.flat().flat());for(let f=0,g,k=0;f<this.result.length;f++)if(g=this.result[f])for(let h=0,l;h<g.length;h++)if(l=g[h],!a.has(l))if(b)b--;else if(e){if(d.push(l),d.length===c)return d}else if(d[f]||(d[f]=[]),d[f].push(l),++k===c)return d;return d};function X(a){if(!this||this.constructor!==X)return new X(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.h=a.boost||0,this.result=a.index.search(a).result,this;this.index=null;this.result=a||[];this.h=0}X.prototype.limit=function(a){if(this.result.length){const c=[];for(let b=0,e;b<this.result.length;b++)if(e=this.result[b])if(e.length<=a){if(c[b]=e,a-=e.length,!a)break}else{c[b]=e.slice(0,a);break}this.result=c}return this};
X.prototype.offset=function(a){if(this.result.length){const c=[];for(let b=0,e;b<this.result.length;b++)if(e=this.result[b])e.length<=a?a-=e.length:(c[b]=e.slice(a),a=0);this.result=c}return this};X.prototype.boost=function(a){this.h+=a;return this};X.prototype.resolve=function(a,c,b){const e=this.result,d=this.index;this.result=this.index=null;return e.length?("object"===typeof a&&(b=a.enrich,c=a.offset,a=a.limit),Aa.call(d,e,a||100,c,b)):e};C();V.prototype.search=function(a,c,b,e){b||(!c&&H(a)?(b=a,a=""):H(c)&&(b=c,c=0));let d=[];var f=[];let g,k,h,l,m,n,t=0,p,q;if(b){b.constructor===Array&&(b={index:b});a=b.query||a;var y=b.pluck;k=b.merge;l=y||b.field||(l=b.index)&&(l.index?null:l);m=this.tag&&b.tag;h=b.suggest;p=!0;g=this.store&&b.enrich&&p;q=b.highlight&&g;c=b.limit||c;n=b.offset||0;c||(c=100);if(m){m.constructor!==Array&&(m=[m]);var w=[];for(let x=0,r;x<m.length;x++)if(r=m[x],r.field&&r.tag){var u=r.tag;if(u.constructor===Array)for(var z=
0;z<u.length;z++)w.push(r.field,u[z]);else w.push(r.field,u)}else{u=Object.keys(r);for(let E=0,F,A;E<u.length;E++)if(F=u[E],A=r[F],A.constructor===Array)for(z=0;z<A.length;z++)w.push(F,A[z]);else w.push(F,A)}m=w;if(!a){e=[];if(w.length)for(f=0;f<w.length;f+=2)y=Ia.call(this,w[f],w[f+1],c,n,g),d.push({field:w[f],tag:w[f+1],result:y});return e.length?Promise.all(e).then(function(x){for(let r=0;r<x.length;r++)d[r].result=x[r];return d}):d}}l&&l.constructor!==Array&&(l=[l])}l||(l=this.field);w=!e&&(this.worker||
this.db)&&[];for(let x=0,r,E,F;x<l.length;x++){E=l[x];let A;D(E)||(A=E,E=A.field,a=A.query||a,c=A.limit||c,n=A.offset||n,h=A.suggest||h,g=this.store&&(A.enrich||g));if(e)r=e[x];else if(u=A||b,z=this.index.get(E),m&&(u.enrich=!1),w){w[x]=z.search(a,c,u);u&&g&&(u.enrich=g);continue}else r=z.search(a,c,u),u&&g&&(u.enrich=g);F=r&&(p?r.length:r.result.length);if(m&&F){u=[];z=0;for(let J=0,G,Va;J<m.length;J+=2){G=this.tag.get(m[J]);if(!G)if(h)continue;else return p?d:new X(d);if(Va=(G=G&&G.get(m[J+1]))&&
G.length)z++,u.push(G);else if(!h)return p?d:new X(d)}if(z){r=za(r,u);F=r.length;if(!F&&!h)return p?r:new X(r);z--}}if(F)f[t]=E,d.push(r),t++;else if(1===l.length)return p?d:new X(d)}if(w){const x=this;return Promise.all(w).then(function(r){return r.length?x.search(a,c,b,r):r})}if(!t)return p?d:new X(d);if(y&&(!g||!this.store))return d[0];w=[];for(let x=0,r;x<f.length;x++){r=d[x];g&&r.length&&!r[0].doc&&(r=W.call(this,r));if(y)return p?r:new X(r);d[x]={field:f[x],result:r}}return k?Ja(d,c):q?Ka(d,
a,this.index,this.field,this.C,q):d};
function Ea(a,c,b,e,d,f){let g,k,h;for(let m=0,n,t,p,q,y;m<a.length;m++){n=a[m].result;t=a[m].field;q=b.get(t);p=q.encoder;h=q.tokenize;y=d[e.indexOf(t)];p!==g&&(g=p,k=g.encode(c));for(let w=0;w<n.length;w++){let u="";var l=J(n[w].doc,y);let z=g.encode(l);l=l.split(g.split);for(let x=0,r,D;x<z.length;x++){r=z[x];D=l[x];let F;for(let A=0,I;A<k.length;A++)if(I=k[A],"strict"===h){if(r===I){u+=(u?" ":"")+f.replace("$1",D);F=!0;break}}else{const G=r.indexOf(I);if(-1<G){u+=(u?" ":"")+D.substring(0,G)+f.replace("$1",
D.substring(G,I.length))+D.substring(G+I.length);F=!0;break}}F||(u+=(u?" ":"")+l[x])}n[w].highlight=u}}return a}function Da(a,c){const b=[],e=C();for(let d=0,f,g;d<a.length;d++){f=a[d];g=f.result;for(let k=0,h,l,m;k<g.length;k++)if(l=g[k],h=l.id,m=e[h])m.push(f.field);else{if(b.length===c)return b;l.field=e[h]=[f.field];b.push(l)}}return b}function Ca(a,c,b,e,d){a=this.tag.get(a);if(!a)return[];if((c=(a=a&&a.get(c))&&a.length-e)&&0<c){if(c>b||e)a=a.slice(e,e+b);d&&(a=T.call(this,a));return a}}
function T(a){if(!this||!this.store)return a;const c=Array(a.length);for(let b=0,e;b<a.length;b++)e=a[b],c[b]={id:e,doc:this.store.get(e)};return c};function R(a){if(!this||this.constructor!==R)return new R(a);const c=a.document||a.doc||a;var b;this.C=[];this.field=[];this.J=[];this.key=(b=c.key||c.id)&&W(b,this.J)||"id";this.reg=(this.fastupdate=!!a.fastupdate)?new Map:new Set;this.A=(b=c.store||null)&&b&&!0!==b&&[];this.store=b&&new Map;this.cache=(b=a.cache||null)&&new X(b);a.cache=!1;b=new Map;let e=c.index||c.field||c;E(e)&&(e=[e]);for(let d=0,f,g;d<e.length;d++)f=e[d],E(f)||(g=f,f=f.field),g=H(g)?Object.assign({},a,g):a,b.set(f,new Y(g,
this.reg)),g.custom?this.C[d]=g.custom:(this.C[d]=W(f,this.J),g.filter&&("string"===typeof this.C[d]&&(this.C[d]=new String(this.C[d])),this.C[d].I=g.filter)),this.field[d]=f;if(this.A){a=c.store;E(a)&&(a=[a]);for(let d=0,f,g;d<a.length;d++)f=a[d],g=f.field||f,f.custom?(this.A[d]=f.custom,f.custom.U=g):(this.A[d]=W(g,this.J),f.filter&&("string"===typeof this.A[d]&&(this.A[d]=new String(this.A[d])),this.A[d].I=f.filter))}this.index=b;this.tag=null;if(b=c.tag)if("string"===typeof b&&(b=[b]),b.length){this.tag=
new Map;this.B=[];this.T=[];for(let d=0,f,g;d<b.length;d++){f=b[d];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");f.custom?this.B[d]=f.custom:(this.B[d]=W(g,this.J),f.filter&&("string"===typeof this.B[d]&&(this.B[d]=new String(this.B[d])),this.B[d].I=f.filter));this.T[d]=g;this.tag.set(g,new Map)}}}
function W(a,c){const b=a.split(":");let e=0;for(let d=0;d<b.length;d++)a=b[d],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(c[e]=!0),a&&(b[e++]=a);e<b.length&&(b.length=e);return 1<e?b:b[0]}v=R.prototype;v.append=function(a,c){return this.add(a,c,!0)};v.update=function(a,c){return this.remove(a).add(a,c)};
v.remove=function(a){H(a)&&(a=J(a,this.key));for(var c of this.index.values())c.remove(a,!0);if(this.reg.has(a)){if(this.tag&&!this.fastupdate)for(let b of this.tag.values())for(let e of b){c=e[0];const d=e[1],f=d.indexOf(a);-1<f&&(1<d.length?d.splice(f,1):b.delete(c))}this.store&&this.store.delete(a);this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
v.clear=function(){for(const a of this.index.values())a.clear();if(this.tag)for(const a of this.tag.values())a.clear();this.store&&this.store.clear();return this};v.contain=function(a){return this.reg.has(a)};v.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};v.get=function(a){return this.store.get(a)};v.set=function(a,c){this.store.set(a,c);return this};v.searchCache=Fa;
v.export=function(a,c,b=0,e=0){if(b<this.field.length){const g=this.field[b];if((c=this.index.get(g).export(a,g,b,e=1))&&c.then){const k=this;return c.then(function(){return k.export(a,g,b+1)})}return this.export(a,g,b+1)}let d,f;switch(e){case 0:d="reg";f=pa(this.reg);c=null;break;case 1:d="tag";f=na(this.tag,this.reg.size);c=null;break;case 2:d="doc";f=la(this.store);c=null;break;case 3:d="cfg";c=f=null;break;default:return}return Q.call(this,a,c,d,f,b,e)};
v.import=function(a,c){if(c){"string"===typeof c&&(c=JSON.parse(c));a=a.split(".");"json"===a[a.length-1]&&a.pop();var b=2<a.length?a[0]:"";a=2<a.length?a[2]:a[1];if(b)return this.index.get(b).import(a,c);switch(a){case "reg":this.fastupdate=!1;this.reg=qa(c,this.reg);for(let e=0,d;e<this.field.length;e++)d=this.index.get(this.field[e]),d.fastupdate=!1,d.reg=this.reg;break;case "tag":this.tag=oa(c,this.tag);break;case "doc":this.store=ma(c,this.store)}}};ia(R.prototype);function Fa(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new X);let e=this.cache.get(a);if(!e){e=this.search(a,c,b);if(e.then){const d=this;e.then(function(f){d.cache.set(a,f);return f})}this.cache.set(a,e)}return e}function X(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}X.prototype.set=function(a,c){this.cache.set(this.h=a,c);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};
X.prototype.get=function(a){const c=this.cache.get(a);c&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,c));return c};X.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};X.prototype.clear=function(){this.cache.clear();this.h=""};const Ga={normalize:function(a){return a.toLowerCase()}};const Ha=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]);const Ia=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["pf","f"]]),Ja=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\1+/g,"$1"];const Ka={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,"\u00df":2,d:3,t:3,l:4,m:5,n:5,r:6};const La=/[\x00-\x7F]+/g;const Ma=/[\x00-\x7F]+/g;const Na=/[\x00-\x7F]+/g;var Pa={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:Ga,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Ha},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Ha,matcher:Ia,replacer:Ja},LatinExtra:{normalize:!0,dedupe:!0,mapper:Ha,replacer:Ja.concat([/(?!^)[aeo]/g,""]),matcher:Ia},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let b=0;b<a.length;b++){var c=a[b];let e=c.charAt(0),d=Ka[e];for(let f=1,g;f<c.length&&(g=c.charAt(f),"h"===
g||"w"===g||!(g=Ka[g])||g===d||(e+=g,d=g,4!==e.length));f++);a[b]=e}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(La," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(Ma,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Na," ")}}};const Qa={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};Y.prototype.add=function(a,c,b,e){if(c&&(a||0===a)){if(!e&&!b&&this.reg.has(a))return this.update(a,c);c=this.encoder.encode(c);if(e=c.length){const l=C(),m=C(),n=this.depth,t=this.resolution;for(let p=0;p<e;p++){let q=c[this.rtl?e-1-p:p];var d=q.length;if(d&&(n||!m[q])){var f=this.score?this.score(c,q,p,null,0):Ra(t,e,p),g="";switch(this.tokenize){case "full":if(2<d){for(f=0;f<d;f++)for(var k=d;k>f;k--){g=q.substring(f,k);var h=this.score?this.score(c,q,p,g,f):Ra(t,e,p,d,f);Z(this,m,g,h,a,b)}break}case "reverse":if(1<
d){for(k=d-1;0<k;k--)g=q[k]+g,h=this.score?this.score(c,q,p,g,k):Ra(t,e,p,d,k),Z(this,m,g,h,a,b);g=""}case "forward":if(1<d){for(k=0;k<d;k++)g+=q[k],Z(this,m,g,f,a,b);break}default:if(Z(this,m,q,f,a,b),n&&1<e&&p<e-1)for(d=C(),g=this.S,f=q,k=Math.min(n+1,e-p),d[f]=1,h=1;h<k;h++)if((q=c[this.rtl?e-1-p-h:p+h])&&!d[q]){d[q]=1;const y=this.score?this.score(c,f,p,q,h):Ra(g+(e/2>g?0:1),e,p,k-1,h-1),w=this.bidirectional&&q>f;Z(this,l,w?f:q,y,a,b,w?q:f)}}}}this.fastupdate||this.reg.add(a)}}return this};
function Z(a,c,b,e,d,f,g){let k=g?a.ctx:a.map,h;if(!c[b]||g&&!(h=c[b])[g])g?(c=h||(c[b]=C()),c[g]=1,(h=k.get(g))?k=h:k.set(g,k=new Map)):c[b]=1,(h=k.get(b))?k=h:k.set(b,k=[]),k=k[e]||(k[e]=[]),f&&k.includes(d)||(k.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(k):a.reg.set(d,[k])))}function Ra(a,c,b,e,d){return b&&1<a?c+(e||0)<=a?b+(d||0):(a-1)/(c+(e||0))*(b+(d||0))+1|0:0};Y.prototype.search=function(a,c,b){b||(!c&&H(a)?(b=a,a=""):H(c)&&(b=c,c=0));var e=[],d=0;if(b){a=b.query||a;c=b.limit||c;d=b.offset||0;var f=b.context;var g=b.suggest;var k=!0;var h=b.resolution}else k=!0;a=this.encoder.encode(a);b=a.length;c=c||(k?100:0);if(1===b)return g=c,(c=Sa(this,a[0],""))&&c.length?S.call(this,c,g,d):[];f=this.depth&&!1!==f;if(2===b&&f&&!g)return g=c,(c=Sa(this,a[0],a[1]))&&c.length?S.call(this,c,g,d):[];k=C();let l=0;if(1<b&&f){var m=a[0];l=1}h||0===h||(h=m?this.S:this.resolution);
for(let q,y;l<b;l++){if((y=a[l])&&!k[y]){k[y]=1;q=Sa(this,y,m);a:{f=q;var n=e,t=g,p=h;let w=[];if(f&&f.length){if(f.length<=p){n.push(f);q=void 0;break a}for(let u=0,z;u<p;u++)if(z=f[u])w[u]=z;if(w.length){n.push(w);q=void 0;break a}}q=t?void 0:w}if(q){e=q;break}m&&(g&&q&&e.length||(m=y))}g&&m&&l===b-1&&!e.length&&(m="",l=-1,k=C())}a:{a=e;e=a.length;m=a;if(1<e)m=ta(a,h,c,d,g);else if(1===e){g=S.call(null,a[0],c,d);break a}g=m}return g};
function Sa(a,c,b){let e;b&&(e=a.bidirectional&&c>b)&&(e=b,b=c,c=e);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};Y.prototype.remove=function(a,c){const b=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(b){if(this.fastupdate)for(let e=0,d;e<b.length;e++){if(d=b[e])if(2>d.length)d.pop();else{const f=d.indexOf(a);f===b.length-1?d.pop():d.splice(f,1)}}else Ta(this.map,a),this.depth&&Ta(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function Ta(a,c){let b=0;if(a.constructor===Array)for(let e=0,d,f;e<a.length;e++){if((d=a[e])&&d.length)if(f=d.indexOf(c),0<=f){1<d.length?(d.splice(f,1),b++):delete a[e];break}else b++}else for(let e of a.entries()){const d=e[0],f=Ta(e[1],c);f?b+=f:a.delete(d)}return b};function Y(a,c){if(!this||this.constructor!==Y)return new Y(a);if(a){var b=E(a)?a:a.preset;b&&(a=Object.assign({},Qa[b],a))}else a={};b=a.context;const e=!0===b?{depth:1}:b||{},d=E(a.encoder)?Pa[a.encoder]:a.encode||a.encoder||Ga;this.encoder=d.encode?d:"object"===typeof d?new K(d):{encode:d};this.resolution=a.resolution||9;this.tokenize=(b=a.tokenize)&&"default"!==b&&b||"strict";this.depth="strict"===b&&e.depth||0;this.bidirectional=!1!==e.bidirectional;this.fastupdate=!!a.fastupdate;this.score=
a.score||null;b=!1;this.map=new Map;this.ctx=new Map;this.reg=c||(this.fastupdate?new Map:new Set);this.S=e.resolution||3;this.rtl=d.rtl||a.rtl||!1;this.cache=(b=a.cache||null)&&new X(b);this.priority=a.priority||4}v=Y.prototype;v.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};v.append=function(a,c){return this.add(a,c,!0)};v.contain=function(a){return this.reg.has(a)};
v.update=function(a,c){const b=this,e=this.remove(a);return e&&e.then?e.then(()=>b.add(a,c)):this.add(a,c)};function Ua(a){let c=0;if(a.constructor===Array)for(let b=0,e;b<a.length;b++)(e=a[b])&&(c+=e.length);else for(const b of a){const e=b[0],d=Ua(b[1]);d?c+=d:a.delete(e)}return c}v.cleanup=function(){if(!this.fastupdate)return this;Ua(this.map);this.depth&&Ua(this.ctx);return this};v.searchCache=Fa;
v.export=function(a,c,b=0,e=0){let d,f;switch(e){case 0:d="reg";f=pa(this.reg);break;case 1:d="cfg";f=null;break;case 2:d="map";f=la(this.map,this.reg.size);break;case 3:d="ctx";f=na(this.ctx,this.reg.size);break;default:return}return Q.call(this,a,c,d,f,b,e)};
v.import=function(a,c){if(c)switch("string"===typeof c&&(c=JSON.parse(c)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=qa(c,this.reg);break;case "map":this.map=ma(c,this.map);break;case "ctx":this.ctx=oa(c,this.ctx)}};
function Ka(a,c,b,e,d,f){let g,k,h;for(let m=0,n,t,p,q,y;m<a.length;m++){n=a[m].result;t=a[m].field;q=b.get(t);p=q.encoder;h=q.tokenize;y=d[e.indexOf(t)];p!==g&&(g=p,k=g.encode(c));for(let w=0;w<n.length;w++){let u="";var l=I(n[w].doc,y);let z=g.encode(l);l=l.split(g.split);for(let x=0,r,E;x<z.length;x++){r=z[x];E=l[x];let F;for(let A=0,J;A<k.length;A++)if(J=k[A],"strict"===h){if(r===J){u+=(u?" ":"")+f.replace("$1",E);F=!0;break}}else{const G=r.indexOf(J);if(-1<G){u+=(u?" ":"")+E.substring(0,G)+f.replace("$1",
E.substring(G,J.length))+E.substring(G+J.length);F=!0;break}}F||(u+=(u?" ":"")+l[x])}n[w].highlight=u}}return a}function Ja(a,c){const b=[],e=C();for(let d=0,f,g;d<a.length;d++){f=a[d];g=f.result;for(let k=0,h,l,m;k<g.length;k++)if(l=g[k],h=l.id,m=e[h])m.push(f.field);else{if(b.length===c)return b;l.field=e[h]=[f.field];b.push(l)}}return b}function Ia(a,c,b,e,d){a=this.tag.get(a);if(!a)return[];if((c=(a=a&&a.get(c))&&a.length-e)&&0<c){if(c>b||e)a=a.slice(e,e+b);d&&(a=W.call(this,a));return a}}
function W(a){if(!this||!this.store)return a;const c=Array(a.length);for(let b=0,e;b<a.length;b++)e=a[b],c[b]={id:e,doc:this.store.get(e)};return c};function V(a){if(!this||this.constructor!==V)return new V(a);const c=a.document||a.doc||a;var b;this.C=[];this.field=[];this.J=[];this.key=(b=c.key||c.id)&&La(b,this.J)||"id";this.reg=(this.fastupdate=!!a.fastupdate)?new Map:new Set;this.A=(b=c.store||null)&&b&&!0!==b&&[];this.store=b&&new Map;this.cache=(b=a.cache||null)&&new Y(b);a.cache=!1;b=new Map;let e=c.index||c.field||c;D(e)&&(e=[e]);for(let d=0,f,g;d<e.length;d++)f=e[d],D(f)||(g=f,f=f.field),g=H(g)?Object.assign({},a,g):a,b.set(f,new O(g,
this.reg)),g.custom?this.C[d]=g.custom:(this.C[d]=La(f,this.J),g.filter&&("string"===typeof this.C[d]&&(this.C[d]=new String(this.C[d])),this.C[d].I=g.filter)),this.field[d]=f;if(this.A){a=c.store;D(a)&&(a=[a]);for(let d=0,f,g;d<a.length;d++)f=a[d],g=f.field||f,f.custom?(this.A[d]=f.custom,f.custom.U=g):(this.A[d]=La(g,this.J),f.filter&&("string"===typeof this.A[d]&&(this.A[d]=new String(this.A[d])),this.A[d].I=f.filter))}this.index=b;this.tag=null;if(b=c.tag)if("string"===typeof b&&(b=[b]),b.length){this.tag=
new Map;this.B=[];this.T=[];for(let d=0,f,g;d<b.length;d++){f=b[d];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");f.custom?this.B[d]=f.custom:(this.B[d]=La(g,this.J),f.filter&&("string"===typeof this.B[d]&&(this.B[d]=new String(this.B[d])),this.B[d].I=f.filter));this.T[d]=g;this.tag.set(g,new Map)}}}
function La(a,c){const b=a.split(":");let e=0;for(let d=0;d<b.length;d++)a=b[d],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(c[e]=!0),a&&(b[e++]=a);e<b.length&&(b.length=e);return 1<e?b:b[0]}v=V.prototype;v.append=function(a,c){return this.add(a,c,!0)};v.update=function(a,c){return this.remove(a).add(a,c)};
v.remove=function(a){H(a)&&(a=I(a,this.key));for(var c of this.index.values())c.remove(a,!0);if(this.reg.has(a)){if(this.tag&&!this.fastupdate)for(let b of this.tag.values())for(let e of b){c=e[0];const d=e[1],f=d.indexOf(a);-1<f&&(1<d.length?d.splice(f,1):b.delete(c))}this.store&&this.store.delete(a);this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
v.clear=function(){for(const a of this.index.values())a.clear();if(this.tag)for(const a of this.tag.values())a.clear();this.store&&this.store.clear();return this};v.contain=function(a){return this.reg.has(a)};v.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};v.get=function(a){return this.store.get(a)};v.set=function(a,c){this.store.set(a,c);return this};v.searchCache=Ma;
v.export=function(a,c,b=0,e=0){if(b<this.field.length){const g=this.field[b];if((c=this.index.get(g).export(a,g,b,e=1))&&c.then){const k=this;return c.then(function(){return k.export(a,g,b+1)})}return this.export(a,g,b+1)}let d,f;switch(e){case 0:d="reg";f=sa(this.reg);c=null;break;case 1:d="tag";f=qa(this.tag,this.reg.size);c=null;break;case 2:d="doc";f=oa(this.store);c=null;break;case 3:d="cfg";c=f=null;break;default:return}return ua.call(this,a,c,d,f,b,e)};
v.import=function(a,c){var b=a.split(".");"json"===b[b.length-1]&&b.pop();a=2<b.length?b[0]:"";b=2<b.length?b[2]:b[1];if(c){"string"===typeof c&&(c=JSON.parse(c));if(a)return this.index.get(a).import(b,c);switch(b){case "reg":this.fastupdate=!1;this.reg=ta(c,this.reg);for(let e=0,d;e<this.field.length;e++)d=this.index.get(this.field[e]),d.fastupdate=!1,d.reg=this.reg;break;case "tag":this.tag=ra(c,this.tag);break;case "doc":this.store=pa(c,this.store)}}};ja(V.prototype);function Ma(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new Y);let e=this.cache.get(a);if(!e){e=this.search(a,c,b);if(e.then){const d=this;e.then(function(f){d.cache.set(a,f);return f})}this.cache.set(a,e)}return e}function Y(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}Y.prototype.set=function(a,c){this.cache.set(this.h=a,c);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};
Y.prototype.get=function(a){const c=this.cache.get(a);c&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,c));return c};Y.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};Y.prototype.clear=function(){this.cache.clear();this.h=""};const Na={normalize:function(a){return a.toLowerCase()}};const Oa=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]);const Pa=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["pf","f"]]),Qa=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\1+/g,"$1"];const Ra={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,"\u00df":2,d:3,t:3,l:4,m:5,n:5,r:6};const Sa=/[\x00-\x7F]+/g;const Ta=/[\x00-\x7F]+/g;const Ua=/[\x00-\x7F]+/g;var Wa={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:Na,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Oa},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Oa,matcher:Pa,replacer:Qa},LatinExtra:{normalize:!0,dedupe:!0,mapper:Oa,replacer:Qa.concat([/(?!^)[aeo]/g,""]),matcher:Pa},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let b=0;b<a.length;b++){var c=a[b];let e=c.charAt(0),d=Ra[e];for(let f=1,g;f<c.length&&(g=c.charAt(f),"h"===
g||"w"===g||!(g=Ra[g])||g===d||(e+=g,d=g,4!==e.length));f++);a[b]=e}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Sa," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(Ta,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Ua," ")}}};const Xa={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};O.prototype.add=function(a,c,b,e){if(c&&(a||0===a)){if(!e&&!b&&this.reg.has(a))return this.update(a,c);c=this.encoder.encode(c);if(e=c.length){const l=C(),m=C(),n=this.depth,t=this.resolution;for(let p=0;p<e;p++){let q=c[this.rtl?e-1-p:p];var d=q.length;if(d&&(n||!m[q])){var f=this.score?this.score(c,q,p,null,0):Ya(t,e,p),g="";switch(this.tokenize){case "full":if(2<d){for(f=0;f<d;f++)for(var k=d;k>f;k--){g=q.substring(f,k);var h=this.score?this.score(c,q,p,g,f):Ya(t,e,p,d,f);Z(this,m,g,h,a,b)}break}case "reverse":if(1<
d){for(k=d-1;0<k;k--)g=q[k]+g,h=this.score?this.score(c,q,p,g,k):Ya(t,e,p,d,k),Z(this,m,g,h,a,b);g=""}case "forward":if(1<d){for(k=0;k<d;k++)g+=q[k],Z(this,m,g,f,a,b);break}default:if(Z(this,m,q,f,a,b),n&&1<e&&p<e-1)for(d=C(),g=this.S,f=q,k=Math.min(n+1,e-p),d[f]=1,h=1;h<k;h++)if((q=c[this.rtl?e-1-p-h:p+h])&&!d[q]){d[q]=1;const y=this.score?this.score(c,f,p,q,h):Ya(g+(e/2>g?0:1),e,p,k-1,h-1),w=this.bidirectional&&q>f;Z(this,l,w?f:q,y,a,b,w?q:f)}}}}this.fastupdate||this.reg.add(a)}}return this};
function Z(a,c,b,e,d,f,g){let k=g?a.ctx:a.map,h;if(!c[b]||g&&!(h=c[b])[g])g?(c=h||(c[b]=C()),c[g]=1,(h=k.get(g))?k=h:k.set(g,k=new Map)):c[b]=1,(h=k.get(b))?k=h:k.set(b,k=[]),k=k[e]||(k[e]=[]),f&&k.includes(d)||(k.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(k):a.reg.set(d,[k])))}function Ya(a,c,b,e,d){return b&&1<a?c+(e||0)<=a?b+(d||0):(a-1)/(c+(e||0))*(b+(d||0))+1|0:0};O.prototype.search=function(a,c,b){b||(!c&&H(a)?(b=a,a=""):H(c)&&(b=c,c=0));var e=[],d=0;if(b){a=b.query||a;c=b.limit||c;d=b.offset||0;var f=b.context;var g=b.suggest;var k=!0;var h=b.resolution}else k=!0;a=this.encoder.encode(a);b=a.length;c=c||(k?100:0);if(1===b)return g=c,(c=Za(this,a[0],""))&&c.length?Aa.call(this,c,g,d):[];f=this.depth&&!1!==f;if(2===b&&f&&!g)return g=c,(c=Za(this,a[0],a[1]))&&c.length?Aa.call(this,c,g,d):[];k=C();let l=0;if(1<b&&f){var m=a[0];l=1}h||0===h||(h=m?this.S:this.resolution);
for(let q,y;l<b;l++){if((y=a[l])&&!k[y]){k[y]=1;q=Za(this,y,m);a:{f=q;var n=e,t=g,p=h;let w=[];if(f&&f.length){if(f.length<=p){n.push(f);q=void 0;break a}for(let u=0,z;u<p;u++)if(z=f[u])w[u]=z;if(w.length){n.push(w);q=void 0;break a}}q=t?void 0:w}if(q){e=q;break}m&&(g&&q&&e.length||(m=y))}g&&m&&l===b-1&&!e.length&&(m="",l=-1,k=C())}a:{a=e;e=a.length;m=a;if(1<e)m=xa(a,h,c,d,g);else if(1===e){g=Aa.call(null,a[0],c,d);break a}g=m}return g};
function Za(a,c,b){let e;b&&(e=a.bidirectional&&c>b)&&(e=b,b=c,c=e);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};O.prototype.remove=function(a,c){const b=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(b){if(this.fastupdate)for(let e=0,d;e<b.length;e++){if(d=b[e])if(2>d.length)d.pop();else{const f=d.indexOf(a);f===b.length-1?d.pop():d.splice(f,1)}}else $a(this.map,a),this.depth&&$a(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function $a(a,c){let b=0;if(a.constructor===Array)for(let e=0,d,f;e<a.length;e++){if((d=a[e])&&d.length)if(f=d.indexOf(c),0<=f){1<d.length?(d.splice(f,1),b++):delete a[e];break}else b++}else for(let e of a.entries()){const d=e[0],f=$a(e[1],c);f?b+=f:a.delete(d)}return b};function O(a,c){if(!this||this.constructor!==O)return new O(a);if(a){var b=D(a)?a:a.preset;b&&(a=Object.assign({},Xa[b],a))}else a={};b=a.context;const e=!0===b?{depth:1}:b||{},d=D(a.encoder)?Wa[a.encoder]:a.encode||a.encoder||Na;this.encoder=d.encode?d:"object"===typeof d?new K(d):{encode:d};this.resolution=a.resolution||9;this.tokenize=(b=a.tokenize)&&"default"!==b&&b||"strict";this.depth="strict"===b&&e.depth||0;this.bidirectional=!1!==e.bidirectional;this.fastupdate=!!a.fastupdate;this.score=
a.score||null;b=!1;this.map=new Map;this.ctx=new Map;this.reg=c||(this.fastupdate?new Map:new Set);this.S=e.resolution||3;this.rtl=d.rtl||a.rtl||!1;this.cache=(b=a.cache||null)&&new Y(b);this.priority=a.priority||4}v=O.prototype;v.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};v.append=function(a,c){return this.add(a,c,!0)};v.contain=function(a){return this.reg.has(a)};
v.update=function(a,c){const b=this,e=this.remove(a);return e&&e.then?e.then(()=>b.add(a,c)):this.add(a,c)};function ab(a){let c=0;if(a.constructor===Array)for(let b=0,e;b<a.length;b++)(e=a[b])&&(c+=e.length);else for(const b of a){const e=b[0],d=ab(b[1]);d?c+=d:a.delete(e)}return c}v.cleanup=function(){if(!this.fastupdate)return this;ab(this.map);this.depth&&ab(this.ctx);return this};v.searchCache=Ma;
v.export=function(a,c,b=0,e=0){let d,f;switch(e){case 0:d="reg";f=sa(this.reg);break;case 1:d="cfg";f=null;break;case 2:d="map";f=oa(this.map,this.reg.size);break;case 3:d="ctx";f=qa(this.ctx,this.reg.size);break;default:return}return ua.call(this,a,c,d,f,b,e)};
v.import=function(a,c){if(c)switch("string"===typeof c&&(c=JSON.parse(c)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),3===a.length&&a.shift(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=ta(c,this.reg);break;case "map":this.map=pa(c,this.map);break;case "ctx":this.ctx=ra(c,this.ctx)}};
v.serialize=function(a=!0){if(!this.reg.size)return"";let c="",b="";for(var e of this.reg.keys())b||(b=typeof e),c+=(c?",":"")+("string"===b?'"'+e+'"':e);c="index.reg=new Set(["+c+"]);";e="";for(var d of this.map.entries()){var f=d[0],g=d[1],k="";for(let m=0,n;m<g.length;m++){n=g[m]||[""];var h="";for(var l=0;l<n.length;l++)h+=(h?",":"")+("string"===b?'"'+n[l]+'"':n[l]);h="["+h+"]";k+=(k?",":"")+h}k='["'+f+'",['+k+"]]";e+=(e?",":"")+k}e="index.map=new Map(["+e+"]);";d="";for(const m of this.ctx.entries()){f=
m[0];g=m[1];for(const n of g.entries()){g=n[0];k=n[1];h="";for(let t=0,p;t<k.length;t++){p=k[t]||[""];l="";for(let q=0;q<p.length;q++)l+=(l?",":"")+("string"===b?'"'+p[q]+'"':p[q]);l="["+l+"]";h+=(h?",":"")+l}h='new Map([["'+g+'",['+h+"]]])";h='["'+f+'",'+h+"]";d+=(d?",":"")+h}}d="index.ctx=new Map(["+d+"]);";return a?"function inject(index){"+c+e+d+"}":c+e+d};ia(Y.prototype);export default {Index:Y,Charset:Pa,Encoder:K,Document:R,Worker:null,Resolver:null,IndexedDB:null,Language:{}};
export const Index=Y;export const Charset=Pa;export const Encoder=K;export const Document=R;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};
m[0];g=m[1];for(const n of g.entries()){g=n[0];k=n[1];h="";for(let t=0,p;t<k.length;t++){p=k[t]||[""];l="";for(let q=0;q<p.length;q++)l+=(l?",":"")+("string"===b?'"'+p[q]+'"':p[q]);l="["+l+"]";h+=(h?",":"")+l}h='new Map([["'+g+'",['+h+"]]])";h='["'+f+'",'+h+"]";d+=(d?",":"")+h}}d="index.ctx=new Map(["+d+"]);";return a?"function inject(index){"+c+e+d+"}":c+e+d};ja(O.prototype);export default {Index:O,Charset:Wa,Encoder:K,Document:V,Worker:null,Resolver:null,IndexedDB:null,Language:{}};
export const Index=O;export const Charset=Wa;export const Encoder=K;export const Document=V;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.111 (ES5)
* FlexSearch.js v0.8.113 (ES5)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -35,7 +35,7 @@ b.prototype.values;b.prototype.forEach=function(c,d){var e=this;this.h.forEach(f
C("Array.prototype.includes",function(a){return a?a:function(b,c){var d=this;d instanceof String&&(d=String(d));var e=d.length;c=c||0;for(0>c&&(c=Math.max(c+e,0));c<e;c++){var g=d[c];if(g===b||Object.is(g,b))return!0}return!1}});
C("String.prototype.includes",function(a){return a?a:function(b,c){if(null==this)throw new TypeError("The 'this' value for String.prototype.includes must not be null or undefined");if(b instanceof RegExp)throw new TypeError("First argument to String.prototype.includes must not be a regular expression");return-1!==this.indexOf(b,c||0)}});
C("Array.prototype.flat",function(a){return a?a:function(b){b=void 0===b?1:b;var c=[];Array.prototype.forEach.call(this,function(d){Array.isArray(d)&&0<b?(d=Array.prototype.flat.call(d,b-1),c.push.apply(c,d)):c.push(d)});return c}});var wa="function"==typeof Object.assign?Object.assign:function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(d)for(var e in d)F(d,e)&&(a[e]=d[e])}return a};C("Object.assign",function(a){return a||wa});function H(a,b,c){var d=typeof c,e=typeof a;if("undefined"!==d){if("undefined"!==e){if(c){if("function"===e&&d===e)return function(g){return a(c(g))};b=a.constructor;if(b===c.constructor){if(b===Array)return c.concat(a);if(b===Map){b=new Map(c);d=w(a);for(e=d.next();!e.done;e=d.next())e=e.value,b.set(e[0],e[1]);return b}if(b===Set){b=new Set(c);d=w(a.values());for(e=d.next();!e.done;e=d.next())b.add(e.value);return b}}}return a}return c}return"undefined"===e?b:a}
function I(){return Object.create(null)}function K(a){return"string"===typeof a}function M(a){return"object"===typeof a}function xa(a){var b=[];a=w(a.keys());for(var c=a.next();!c.done;c=a.next())b.push(c.value);return b}function ya(a,b){if(K(b))a=a[b];else for(var c=0;a&&c<b.length;c++)a=a[b[c]];return a}function za(a){for(var b=0,c=0,d=void 0;c<a.length;c++)(d=a[c])&&b<d.length&&(b=d.length);return b};var Aa=[["\u00aa","a"],["\u00b2","2"],["\u00b3","3"],["\u00b9","1"],["\u00ba","o"],["\u00bc","1\u20444"],["\u00bd","1\u20442"],["\u00be","3\u20444"],["\u00e0","a"],["\u00e1","a"],["\u00e2","a"],["\u00e3","a"],["\u00e4","a"],["\u00e5","a"],["\u00e7","c"],["\u00e8","e"],["\u00e9","e"],["\u00ea","e"],["\u00eb","e"],["\u00ec","i"],["\u00ed","i"],["\u00ee","i"],["\u00ef","i"],["\u00f1","n"],["\u00f2","o"],["\u00f3","o"],["\u00f4","o"],["\u00f5","o"],["\u00f6","o"],["\u00f9","u"],["\u00fa","u"],["\u00fb",
function J(){return Object.create(null)}function K(a){return"string"===typeof a}function M(a){return"object"===typeof a}function xa(a){var b=[];a=w(a.keys());for(var c=a.next();!c.done;c=a.next())b.push(c.value);return b}function ya(a,b){if(K(b))a=a[b];else for(var c=0;a&&c<b.length;c++)a=a[b[c]];return a}function za(a){for(var b=0,c=0,d=void 0;c<a.length;c++)(d=a[c])&&b<d.length&&(b=d.length);return b};var Aa=[["\u00aa","a"],["\u00b2","2"],["\u00b3","3"],["\u00b9","1"],["\u00ba","o"],["\u00bc","1\u20444"],["\u00bd","1\u20442"],["\u00be","3\u20444"],["\u00e0","a"],["\u00e1","a"],["\u00e2","a"],["\u00e3","a"],["\u00e4","a"],["\u00e5","a"],["\u00e7","c"],["\u00e8","e"],["\u00e9","e"],["\u00ea","e"],["\u00eb","e"],["\u00ec","i"],["\u00ed","i"],["\u00ee","i"],["\u00ef","i"],["\u00f1","n"],["\u00f2","o"],["\u00f3","o"],["\u00f4","o"],["\u00f5","o"],["\u00f6","o"],["\u00f9","u"],["\u00fa","u"],["\u00fb",
"u"],["\u00fc","u"],["\u00fd","y"],["\u00ff","y"],["\u0101","a"],["\u0103","a"],["\u0105","a"],["\u0107","c"],["\u0109","c"],["\u010b","c"],["\u010d","c"],["\u010f","d"],["\u0113","e"],["\u0115","e"],["\u0117","e"],["\u0119","e"],["\u011b","e"],["\u011d","g"],["\u011f","g"],["\u0121","g"],["\u0123","g"],["\u0125","h"],["\u0129","i"],["\u012b","i"],["\u012d","i"],["\u012f","i"],["\u0133","ij"],["\u0135","j"],["\u0137","k"],["\u013a","l"],["\u013c","l"],["\u013e","l"],["\u0140","l"],["\u0144","n"],
["\u0146","n"],["\u0148","n"],["\u0149","n"],["\u014d","o"],["\u014f","o"],["\u0151","o"],["\u0155","r"],["\u0157","r"],["\u0159","r"],["\u015b","s"],["\u015d","s"],["\u015f","s"],["\u0161","s"],["\u0163","t"],["\u0165","t"],["\u0169","u"],["\u016b","u"],["\u016d","u"],["\u016f","u"],["\u0171","u"],["\u0173","u"],["\u0175","w"],["\u0177","y"],["\u017a","z"],["\u017c","z"],["\u017e","z"],["\u017f","s"],["\u01a1","o"],["\u01b0","u"],["\u01c6","dz"],["\u01c9","lj"],["\u01cc","nj"],["\u01ce","a"],["\u01d0",
"i"],["\u01d2","o"],["\u01d4","u"],["\u01d6","u"],["\u01d8","u"],["\u01da","u"],["\u01dc","u"],["\u01df","a"],["\u01e1","a"],["\u01e3","ae"],["\u00e6","ae"],["\u01fd","ae"],["\u01e7","g"],["\u01e9","k"],["\u01eb","o"],["\u01ed","o"],["\u01ef","\u0292"],["\u01f0","j"],["\u01f3","dz"],["\u01f5","g"],["\u01f9","n"],["\u01fb","a"],["\u01ff","\u00f8"],["\u0201","a"],["\u0203","a"],["\u0205","e"],["\u0207","e"],["\u0209","i"],["\u020b","i"],["\u020d","o"],["\u020f","o"],["\u0211","r"],["\u0213","r"],["\u0215",
@@ -52,43 +52,43 @@ u.encode=function(a){var b=this;if(this.cache&&a.length<=this.G)if(this.D){if(th
d=[],e=this.split||""===this.split?a.split(this.split):a,g=0,f=void 0,h=void 0;g<e.length;g++)if((f=h=e[g])&&!(f.length<this.minlength))if(c)d.push(f);else if(!this.filter||!this.filter.has(f)){if(this.cache&&f.length<=this.H)if(this.D){var k=this.C.get(f);if(k||""===k){k&&d.push(k);continue}}else this.D=setTimeout(N,50,this);this.stemmer&&2<f.length&&(this.N||(this.N=new RegExp("(?!^)("+this.A+")$")),f=f.replace(this.N,function(q){return b.stemmer.get(q)}),f.length<this.minlength||this.filter&&this.filter.has(f))&&
(f="");if(f&&(this.mapper||this.dedupe&&1<f.length)){k="";for(var l=0,m="",n=void 0,p=void 0;l<f.length;l++)n=f.charAt(l),n===m&&this.dedupe||((p=this.mapper&&this.mapper.get(n))||""===p?p===m&&this.dedupe||!(m=p)||(k+=p):k+=m=n);f=k}this.matcher&&1<f.length&&(this.M||(this.M=new RegExp("("+this.h+")","g")),f=f.replace(this.M,function(q){return b.matcher.get(q)}));if(f&&this.replacer)for(k=0;f&&k<this.replacer.length;k+=2)f=f.replace(this.replacer[k],this.replacer[k+1]);this.cache&&h.length<=this.H&&
(this.C.set(h,f),this.C.size>this.T&&(this.C.clear(),this.H=this.H/1.1|0));f&&d.push(f)}this.finalize&&(d=this.finalize(d)||d);this.cache&&a.length<=this.G&&(this.B.set(a,d),this.B.size>this.T&&(this.B.clear(),this.G=this.G/1.1|0));return d};function N(a){a.D=null;a.B.clear();a.C.clear()};var O,Ha;
function Ia(a){var b,c,d,e,g;return ta(function(f){switch(f.h){case 1:a=a.data;b=a.task;c=a.id;d=a.args;switch(b){case "init":Ha=a.options||{};(e=a.factory)?(Function("return "+e)()(self),O=new self.FlexSearch.Index(Ha),delete self.FlexSearch):O=new R(Ha);postMessage({id:c});break;default:f.h=2;return}f.h=0;break;case 2:"export"===b&&(d=[Ha.export]);if("import"===b)return E(f,Ha.import.call(O,O),5);g=O[b].apply(O,d);if(!g.then){f.h=5;break}return E(f,g,7);case 7:g=f.D;f.h=5;break;case 5:postMessage("search"===b?
{id:c,msg:g}:{id:c}),f.h=0}})};function La(a){Ma.call(a,"add");Ma.call(a,"append");Ma.call(a,"search");Ma.call(a,"update");Ma.call(a,"remove")}var Na,Oa,Pa={},Qa={};function Ra(a){Na=0;Pa[a]=Qa[a]}
function Ia(a){var b,c,d,e,g,f;return ta(function(h){switch(h.h){case 1:a=a.data;b=a.task;c=a.id;d=a.args;switch(b){case "init":Ha=a.options||{};(e=a.factory)?(Function("return "+e)()(self),O=new self.FlexSearch.Index(Ha),delete self.FlexSearch):O=new R(Ha);postMessage({id:c});break;default:h.h=2;return}h.h=0;break;case 2:"export"===b&&(d[1]?(d[0]=Ha.export,d[2]=0,d[3]=1):d=null);if("import"===b){if(!d[0]){h.h=5;break}return E(h,Ha.import.call(O,d[0]),9)}g=d&&O[b].apply(O,d);if(!g||!g.then){h.h=5;
break}return E(h,g,7);case 7:g=h.D;h.h=5;break;case 9:f=h.D,O.import(d[0],f);case 5:postMessage("search"===b?{id:c,msg:g}:{id:c}),h.h=0}})};function Ja(a){Ma.call(a,"add");Ma.call(a,"append");Ma.call(a,"search");Ma.call(a,"update");Ma.call(a,"remove")}var Na,Oa,Pa={},Qa={};function Ra(a){Na=0;Pa[a]=Qa[a]}
function Ma(a){this[a+"Async"]=function(){var b=arguments,c=b[b.length-1];if("function"===typeof c){var d=c;delete b[b.length-1]}Na||(Na=setTimeout(Ra,0,a),Oa=Date.now());Qa[a]||(Qa[a]=Pa[a]=1E3);if(!--Pa[a]){Pa[a]=Qa[a]=Qa[a]*this.priority*this.priority*3/(Date.now()-Oa)|0||1;Na=clearTimeout(Na);var e=this;return new Promise(function(f){setTimeout(function(){f(e[a+"Async"].apply(e,b))},0)})}var g=this[a].apply(this,b);c=g.then?g:new Promise(function(f){return f(g)});d&&c.then(d);return c}};var Sa=0;
function S(a){function b(f){function h(k){k=k.data||k;var l=k.id,m=l&&e.h[l];m&&(m(k.msg),delete e.h[l])}this.worker=f;this.h=I();if(this.worker){d?this.worker.on("message",h):this.worker.onmessage=h;if(a.config)return new Promise(function(k){e.h[++Sa]=function(){k(e)};e.worker.postMessage({id:Sa,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",factory:c,options:a});return this}}a=void 0===a?{}:a;if(!this||this.constructor!==S)return new S(a);var c="undefined"!==typeof self?self._factory:
"undefined"!==typeof window?window._factory:null;c&&(c=c.toString());var d="undefined"===typeof window,e=this,g=Ta(c,d,a.worker);return g.then?g.then(function(f){return b.call(e,f)}):b.call(this,g)}T("add");T("append");T("search");T("update");T("remove");T("clear");T("export");T("import");
function T(a){S.prototype[a]=S.prototype[a+"Async"]=function(){var b=this,c=arguments,d,e,g,f,h;return ta(function(k){d=b;e=[].slice.call(c);g=e[e.length-1];"function"===typeof g&&(f=g,e.splice(e.length-1,1));h=new Promise(function(l){d.h[++Sa]=l;d.worker.postMessage({task:a,id:Sa,args:e})});return f?(h.then(f),k.return(b)):k.return(h)})}}
function Ta(a,b,c){return b?"undefined"!==typeof module?new (require("worker_threads")["Worker"])(__dirname + "/node/node.js"):import("worker_threads").then(function(worker){ return new worker["Worker"]((1,eval)("import.meta.dirname") + "/node/node.mjs"); }):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+Ia.toString()],{type:"text/javascript"}))):new window.Worker(K(c)?c:(0,eval)("import.meta.url").replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js",
function S(a){function b(f){function h(k){k=k.data||k;var l=k.id,m=l&&e.h[l];m&&(m(k.msg),delete e.h[l])}this.worker=f;this.h=J();if(this.worker){d?this.worker.on("message",h):this.worker.onmessage=h;if(a.config)return new Promise(function(k){e.h[++Sa]=function(){k(e)};e.worker.postMessage({id:Sa,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",factory:c,options:a});return this}}a=void 0===a?{}:a;if(!this||this.constructor!==S)return new S(a);var c="undefined"!==typeof self?self._factory:
"undefined"!==typeof window?window._factory:null;c&&(c=c.toString());var d="undefined"===typeof window,e=this,g=Ta(c,d,a.worker);return g.then?g.then(function(f){return b.call(e,f)}):b.call(this,g)}T("add");T("append");T("search");T("update");T("remove");T("clear");T("export");T("import");Ja(S.prototype);
function T(a){S.prototype[a]=function(){var b=this,c=[].slice.call(arguments),d=c[c.length-1];if("function"===typeof d){var e=d;c.pop()}d=new Promise(function(g){"export"===a&&"function"===typeof c[0]&&(c[0]=null);b.h[++Sa]=g;b.worker.postMessage({task:a,id:Sa,args:c})});return e?(d.then(e),this):d}}
function Ta(a,b,c){return b?"undefined"!==typeof module?new (require("worker_threads")["Worker"])(__dirname + "/node/node.js"):import("worker_threads").then(function(worker){ return new worker["Worker"]((1,eval)("import.meta.dirname") + "/node/node.mjs"); }):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+Ia.toString()],{type:"text/javascript"}))):new window.Worker("string"===typeof c?c:(0,eval)("import.meta.url").replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js",
"module/worker/worker.js"),{type:"module"})};function Ua(a,b){b=void 0===b?0:b;var c=[],d=[];b&&(b=25E4/b*5E3|0);a=w(a.entries());for(var e=a.next();!e.done;e=a.next())d.push(e.value),d.length===b&&(c.push(d),d=[]);d.length&&c.push(d);return c}function Va(a,b){b||(b=new Map);for(var c=0,d;c<a.length;c++)d=a[c],b.set(d[0],d[1]);return b}
function Wa(a,b){b=void 0===b?0:b;var c=[],d=[];b&&(b=25E4/b*1E3|0);a=w(a.entries());for(var e=a.next();!e.done;e=a.next())e=e.value,d.push([e[0],Ua(e[1])[0]]),d.length===b&&(c.push(d),d=[]);d.length&&c.push(d);return c}function Xa(a,b){b||(b=new Map);for(var c=0,d,e;c<a.length;c++)d=a[c],e=b.get(d[0]),b.set(d[0],Va(d[1],e));return b}function Ya(a){var b=[],c=[];a=w(a.keys());for(var d=a.next();!d.done;d=a.next())c.push(d.value),25E4===c.length&&(b.push(c),c=[]);c.length&&b.push(c);return b}
function Za(a,b){b||(b=new Set);for(var c=0;c<a.length;c++)b.add(a[c]);return b}function $a(a,b,c,d,e,g,f){f=void 0===f?0:f;var h=d&&d.constructor===Array,k=h?d.shift():d;if(!k)return this.export(a,b,e,g+1);if((k=a((b?b+".":"")+(f+1)+"."+c,JSON.stringify(k)))&&k.then){var l=this;return k.then(function(){return $a.call(l,a,b,c,h?d:null,e,g,f+1)})}return $a.call(this,a,b,c,h?d:null,e,g,f+1)};function ab(a,b,c,d){for(var e=[],g=0,f;g<a.index.length;g++)if(f=a.index[g],b>=f.length)b-=f.length;else{b=f[d?"splice":"slice"](b,c);if(f=b.length)if(e=e.length?e.concat(b):b,c-=f,d&&(a.length-=f),!c)break;b=0}return e}
function bb(a){if(!this)return new bb(a);this.index=a?[a]:[];this.length=a?a.length:0;var b=this;return new Proxy([],{get:function(c,d){if("length"===d)return b.length;if("push"===d)return function(e){b.index[b.index.length-1].push(e);b.length++};if("pop"===d)return function(){if(b.length)return b.length--,b.index[b.index.length-1].pop()};if("indexOf"===d)return function(e){for(var g=0,f=0,h,k;f<b.index.length;f++){h=b.index[f];k=h.indexOf(e);if(0<=k)return g+k;g+=h.length}return-1};if("includes"===
d)return function(e){for(var g=0;g<b.index.length;g++)if(b.index[g].includes(e))return!0;return!1};if("slice"===d)return function(e,g){return ab(b,e||0,g||b.length,!1)};if("splice"===d)return function(e,g){return ab(b,e||0,g||b.length,!0)};if("constructor"===d)return Array;if("symbol"!==typeof d)return(c=b.index[d/Math.pow(2,31)|0])&&c[d]},set:function(c,d,e){c=d/Math.pow(2,31)|0;(b.index[c]||(b.index[c]=[]))[d]=e;b.length++;return!0}})}bb.prototype.clear=function(){this.index.length=0};
bb.prototype.destroy=function(){this.proxy=this.index=null};bb.prototype.push=function(){};function U(a){a=void 0===a?8:a;if(!this)return new U(a);this.index=I();this.B=[];this.size=0;32<a?(this.h=cb,this.A=BigInt(a)):(this.h=db,this.A=a)}U.prototype.get=function(a){var b=this.h(a);return(b=this.index[b])&&b.get(a)};U.prototype.set=function(a,b){var c=this.h(a),d=this.index[c];d?(c=d.size,d.set(a,b),(c-=d.size)&&this.size++):(this.index[c]=d=new Map([[a,b]]),this.B.push(d))};
function V(a){a=void 0===a?8:a;if(!this)return new V(a);this.index=I();this.h=[];32<a?(this.B=cb,this.A=BigInt(a)):(this.B=db,this.A=a)}V.prototype.add=function(a){var b=this.B(a),c=this.index[b];c?(b=c.size,c.add(a),(b-=c.size)&&this.size++):(this.index[b]=c=new Set([a]),this.h.push(c))};u=U.prototype;u.has=V.prototype.has=function(a){var b=this.B(a);return(b=this.index[b])&&b.has(a)};u.delete=V.prototype.delete=function(a){var b=this.B(a);(b=this.index[b])&&b.delete(a)&&this.size--};
u.clear=V.prototype.clear=function(){this.index=I();this.h=[];this.size=0};u.values=V.prototype.values=function eb(){var b,c=this,d,e,g;return ra(eb,function(f){switch(f.h){case 1:b=0;case 2:if(!(b<c.h.length)){f.h=0;break}d=w(c.h[b].values());e=d.next();case 5:if(e.done){b++;f.h=2;break}g=e.value;return E(f,g,6);case 6:e=d.next(),f.h=5}})};
bb.prototype.destroy=function(){this.proxy=this.index=null};bb.prototype.push=function(){};function U(a){a=void 0===a?8:a;if(!this)return new U(a);this.index=J();this.B=[];this.size=0;32<a?(this.h=cb,this.A=BigInt(a)):(this.h=db,this.A=a)}U.prototype.get=function(a){var b=this.h(a);return(b=this.index[b])&&b.get(a)};U.prototype.set=function(a,b){var c=this.h(a),d=this.index[c];d?(c=d.size,d.set(a,b),(c-=d.size)&&this.size++):(this.index[c]=d=new Map([[a,b]]),this.B.push(d))};
function V(a){a=void 0===a?8:a;if(!this)return new V(a);this.index=J();this.h=[];32<a?(this.B=cb,this.A=BigInt(a)):(this.B=db,this.A=a)}V.prototype.add=function(a){var b=this.B(a),c=this.index[b];c?(b=c.size,c.add(a),(b-=c.size)&&this.size++):(this.index[b]=c=new Set([a]),this.h.push(c))};u=U.prototype;u.has=V.prototype.has=function(a){var b=this.B(a);return(b=this.index[b])&&b.has(a)};u.delete=V.prototype.delete=function(a){var b=this.B(a);(b=this.index[b])&&b.delete(a)&&this.size--};
u.clear=V.prototype.clear=function(){this.index=J();this.h=[];this.size=0};u.values=V.prototype.values=function eb(){var b,c=this,d,e,g;return ra(eb,function(f){switch(f.h){case 1:b=0;case 2:if(!(b<c.h.length)){f.h=0;break}d=w(c.h[b].values());e=d.next();case 5:if(e.done){b++;f.h=2;break}g=e.value;return E(f,g,6);case 6:e=d.next(),f.h=5}})};
u.keys=V.prototype.keys=function fb(){var b,c=this,d,e,g;return ra(fb,function(f){switch(f.h){case 1:b=0;case 2:if(!(b<c.h.length)){f.h=0;break}d=w(c.h[b].keys());e=d.next();case 5:if(e.done){b++;f.h=2;break}g=e.value;return E(f,g,6);case 6:e=d.next(),f.h=5}})};
u.entries=V.prototype.entries=function gb(){var b,c=this,d,e,g;return ra(gb,function(f){switch(f.h){case 1:b=0;case 2:if(!(b<c.h.length)){f.h=0;break}d=w(c.h[b].entries());e=d.next();case 5:if(e.done){b++;f.h=2;break}g=e.value;return E(f,g,6);case 6:e=d.next(),f.h=5}})};function db(a){var b=Math.pow(2,this.A)-1;if("number"==typeof a)return a&b;for(var c=0,d=this.A+1,e=0;e<a.length;e++)c=(c*d^a.charCodeAt(e))&b;return 32===this.A?c+Math.pow(2,31):c}
function cb(){throw Error("The keystore is limited to 32 for EcmaScript5");};W.prototype.add=function(a,b,c){M(a)&&(b=a,a=ya(b,this.key));if(b&&(a||0===a)){if(!c&&this.reg.has(a))return this.update(a,b);for(var d=0,e;d<this.field.length;d++){e=this.J[d];var g=this.index.get(this.field[d]);if("function"===typeof e)(e=e(b))&&g.add(a,e,!1,!0);else{var f=e.R;if(!f||f(b))e.constructor===String?e=[""+e]:K(e)&&(e=[e]),hb(b,e,this.S,0,g,a,e[0],c)}}if(this.tag)for(d=0;d<this.L.length;d++){f=this.L[d];g=this.tag.get(this.aa[d]);e=I();if("function"===typeof f){if(f=f(b),!f)continue}else{var h=
function cb(){throw Error("The keystore is limited to 32 for EcmaScript5");};W.prototype.add=function(a,b,c){M(a)&&(b=a,a=ya(b,this.key));if(b&&(a||0===a)){if(!c&&this.reg.has(a))return this.update(a,b);for(var d=0,e;d<this.field.length;d++){e=this.J[d];var g=this.index.get(this.field[d]);if("function"===typeof e)(e=e(b))&&g.add(a,e,!1,!0);else{var f=e.R;if(!f||f(b))e.constructor===String?e=[""+e]:K(e)&&(e=[e]),hb(b,e,this.S,0,g,a,e[0],c)}}if(this.tag)for(d=0;d<this.L.length;d++){f=this.L[d];g=this.tag.get(this.aa[d]);e=J();if("function"===typeof f){if(f=f(b),!f)continue}else{var h=
f.R;if(h&&!h(b))continue;f.constructor===String&&(f=""+f);f=ya(b,f)}if(g&&f){K(f)&&(f=[f]);h=0;for(var k,l=void 0;h<f.length;h++)if(k=f[h],!e[k]){e[k]=1;var m;(m=g.get(k))?l=m:g.set(k,l=[]);if(!c||!l.includes(a)){if(l.length===Math.pow(2,31)-1){m=new bb(l);if(this.fastupdate)for(var n=w(this.reg.values()),p=n.next();!p.done;p=n.next())p=p.value,p.includes(l)&&(p[p.indexOf(l)]=m);g.set(k,l=m)}l.push(a);this.fastupdate&&((k=this.reg.get(a))?k.push(l):this.reg.set(a,[l]))}}}}if(this.store&&(!c||!this.store.has(a))){if(this.I){var q=
I();for(c=0;c<this.I.length;c++)if(d=this.I[c],g=d.R,!g||g(b)){g=void 0;if("function"===typeof d){g=d(b);if(!g)continue;d=[d.ja]}else if(K(d)||d.constructor===String){q[d]=b[d];continue}ib(b,q,d,0,d[0],g)}}this.store.set(a,q||b)}}return this};function ib(a,b,c,d,e,g){a=a[e];if(d===c.length-1)b[e]=g||a;else if(a)if(a.constructor===Array)for(b=b[e]=Array(a.length),e=0;e<a.length;e++)ib(a,b,c,d,e);else b=b[e]||(b[e]=I()),e=c[++d],ib(a,b,c,d,e)}
function hb(a,b,c,d,e,g,f,h){if(a=a[f])if(d===b.length-1){if(a.constructor===Array){if(c[d]){for(b=0;b<a.length;b++)e.add(g,a[b],!0,!0);return}a=a.join(" ")}e.add(g,a,h,!0)}else if(a.constructor===Array)for(f=0;f<a.length;f++)hb(a,b,c,d,e,g,f,h);else f=b[++d],hb(a,b,c,d,e,g,f,h);else e.db&&e.remove(g)};function jb(a,b,c,d,e,g,f){var h=a.length,k=[],l;var m=I();for(var n=0,p=void 0,q;n<b;n++)for(var r=0;r<h;r++)if(q=a[r],n<q.length&&(p=q[n]))for(var x=0;x<p.length;x++){q=p[x];(l=m[q])?m[q]++:(l=0,m[q]=1);l=k[l]||(k[l]=[]);if(!f){var t=n+(r||!e?0:g||0);l=l[t]||(l[t]=[])}l.push(q)}if(a=k.length)if(e)k=1<k.length?kb(k,c,d,f,g):(k=k[0]).length>c||d?k.slice(d,c+d):k;else{if(a<h)return[];k=k[a-1];if(c||d)if(f){if(k.length>c||d)k=k.slice(d,c+d)}else{e=[];for(g=0;g<k.length;g++)if(f=k[g],f.length>d)d-=f.length;
J();for(c=0;c<this.I.length;c++)if(d=this.I[c],g=d.R,!g||g(b)){g=void 0;if("function"===typeof d){g=d(b);if(!g)continue;d=[d.ja]}else if(K(d)||d.constructor===String){q[d]=b[d];continue}ib(b,q,d,0,d[0],g)}}this.store.set(a,q||b)}this.worker&&(this.fastupdate||this.reg.add(a))}return this};function ib(a,b,c,d,e,g){a=a[e];if(d===c.length-1)b[e]=g||a;else if(a)if(a.constructor===Array)for(b=b[e]=Array(a.length),e=0;e<a.length;e++)ib(a,b,c,d,e);else b=b[e]||(b[e]=J()),e=c[++d],ib(a,b,c,d,e)}
function hb(a,b,c,d,e,g,f,h){if(a=a[f])if(d===b.length-1){if(a.constructor===Array){if(c[d]){for(b=0;b<a.length;b++)e.add(g,a[b],!0,!0);return}a=a.join(" ")}e.add(g,a,h,!0)}else if(a.constructor===Array)for(f=0;f<a.length;f++)hb(a,b,c,d,e,g,f,h);else f=b[++d],hb(a,b,c,d,e,g,f,h);else e.db&&e.remove(g)};function jb(a,b,c,d,e,g,f){var h=a.length,k=[],l;var m=J();for(var n=0,p=void 0,q;n<b;n++)for(var r=0;r<h;r++)if(q=a[r],n<q.length&&(p=q[n]))for(var x=0;x<p.length;x++){q=p[x];(l=m[q])?m[q]++:(l=0,m[q]=1);l=k[l]||(k[l]=[]);if(!f){var t=n+(r||!e?0:g||0);l=l[t]||(l[t]=[])}l.push(q)}if(a=k.length)if(e)k=1<k.length?kb(k,c,d,f,g):(k=k[0]).length>c||d?k.slice(d,c+d):k;else{if(a<h)return[];k=k[a-1];if(c||d)if(f){if(k.length>c||d)k=k.slice(d,c+d)}else{e=[];for(g=0;g<k.length;g++)if(f=k[g],f.length>d)d-=f.length;
else{if(f.length>c||d)f=f.slice(d,c+d),c-=f.length,d&&(d-=f.length);e.push(f);if(!c)break}k=1<e.length?[].concat.apply([],e):e[0]}}return k}
function kb(a,b,c,d,e){var g=[],f=I(),h=a.length,k;if(d)for(e=h-1;0<=e;e--){if(k=(d=a[e])&&d.length)for(h=0;h<k;h++){var l=d[h];if(!f[l])if(f[l]=1,c)c--;else if(g.push(l),g.length===b)return g}}else for(var m=h-1,n,p=0;0<=m;m--){n=a[m];for(var q=0;q<n.length;q++)if(k=(d=n[q])&&d.length)for(var r=0;r<k;r++)if(l=d[r],!f[l])if(f[l]=1,c)c--;else{var x=(q+(m<h-1?e||0:0))/(m+1)|0;(g[x]||(g[x]=[])).push(l);if(++p===b)return g}}return g}
function lb(a,b,c){for(var d=I(),e=[],g=0,f;g<b.length;g++){f=b[g];for(var h=0;h<f.length;h++)d[f[h]]=1}if(c)for(b=0;b<a.length;b++)c=a[b],d[c]&&(e.push(c),d[c]=0);else for(b=0;b<a.result.length;b++)for(c=a.result[b],f=0;f<c.length;f++)g=c[f],d[g]&&((e[b]||(e[b]=[])).push(g),d[g]=0);return e};function mb(a,b,c,d){if(!a.length)return a;if(1===a.length)return a=a[0],a=c||a.length>b?b?a.slice(c,c+b):a.slice(c):a,d?X.call(this,a):a;for(var e=[],g=0,f=void 0,h=void 0;g<a.length;g++)if((f=a[g])&&(h=f.length)){if(c){if(c>=h){c-=h;continue}c<h&&(f=b?f.slice(c,c+b):f.slice(c),h=f.length,c=0)}h>b&&(f=f.slice(0,b),h=b);if(!e.length&&h>=b)return d?X.call(this,f):f;e.push(f);b-=h;if(!b)break}e=1<e.length?[].concat.apply([],e):e[0];return d?X.call(this,e):e};function nb(a,b,c){var d=c[0];if(d.then)return Promise.all(c).then(function(q){return a[b].apply(a,q)});if(d[0]&&d[0].index)return a[b].apply(a,d);d=[];for(var e=[],g=0,f=0,h,k,l,m=0,n=void 0;m<c.length;m++)if(n=c[m]){var p=void 0;if(n.constructor===Y)p=n.result;else if(n.constructor===Array)p=n;else if(g=n.limit||0,f=n.offset||0,l=n.suggest,k=n.resolve,h=n.enrich&&k,n.index)n.resolve=!1,p=n.index.search(n).result,n.resolve=k;else if(n.and)p=a.and(n.and);else if(n.or)p=a.or(n.or);else if(n.xor)p=
function kb(a,b,c,d,e){var g=[],f=J(),h=a.length,k;if(d)for(e=h-1;0<=e;e--){if(k=(d=a[e])&&d.length)for(h=0;h<k;h++){var l=d[h];if(!f[l])if(f[l]=1,c)c--;else if(g.push(l),g.length===b)return g}}else for(var m=h-1,n,p=0;0<=m;m--){n=a[m];for(var q=0;q<n.length;q++)if(k=(d=n[q])&&d.length)for(var r=0;r<k;r++)if(l=d[r],!f[l])if(f[l]=1,c)c--;else{var x=(q+(m<h-1?e||0:0))/(m+1)|0;(g[x]||(g[x]=[])).push(l);if(++p===b)return g}}return g}
function lb(a,b,c){for(var d=J(),e=[],g=0,f;g<b.length;g++){f=b[g];for(var h=0;h<f.length;h++)d[f[h]]=1}if(c)for(b=0;b<a.length;b++)c=a[b],d[c]&&(e.push(c),d[c]=0);else for(b=0;b<a.result.length;b++)for(c=a.result[b],f=0;f<c.length;f++)g=c[f],d[g]&&((e[b]||(e[b]=[])).push(g),d[g]=0);return e};function mb(a,b,c,d){if(!a.length)return a;if(1===a.length)return a=a[0],a=c||a.length>b?b?a.slice(c,c+b):a.slice(c):a,d?X.call(this,a):a;for(var e=[],g=0,f=void 0,h=void 0;g<a.length;g++)if((f=a[g])&&(h=f.length)){if(c){if(c>=h){c-=h;continue}c<h&&(f=b?f.slice(c,c+b):f.slice(c),h=f.length,c=0)}h>b&&(f=f.slice(0,b),h=b);if(!e.length&&h>=b)return d?X.call(this,f):f;e.push(f);b-=h;if(!b)break}e=1<e.length?[].concat.apply([],e):e[0];return d?X.call(this,e):e};function nb(a,b,c){var d=c[0];if(d.then)return Promise.all(c).then(function(q){return a[b].apply(a,q)});if(d[0]&&d[0].index)return a[b].apply(a,d);d=[];for(var e=[],g=0,f=0,h,k,l,m=0,n=void 0;m<c.length;m++)if(n=c[m]){var p=void 0;if(n.constructor===Y)p=n.result;else if(n.constructor===Array)p=n;else if(g=n.limit||0,f=n.offset||0,l=n.suggest,k=n.resolve,h=n.enrich&&k,n.index)n.resolve=!1,p=n.index.search(n).result,n.resolve=k;else if(n.and)p=a.and(n.and);else if(n.or)p=a.or(n.or);else if(n.xor)p=
a.xor(n.xor);else if(n.not)p=a.not(n.not);else continue;if(p.then)e.push(p);else if(p.length)d[m]=p;else if(!l&&("and"===b||"xor"===b)){d=[];break}}return{W:d,$:e,limit:g,offset:f,enrich:h,resolve:k,suggest:l}};Y.prototype.or=function(){var a=nb(this,"or",arguments);return ob.call(this,a.W,a.$,a.limit,a.offset,a.enrich,a.resolve)};function ob(a,b,c,d,e,g){if(b.length){var f=this;return Promise.all(b).then(function(h){a=[];for(var k=0,l=void 0;k<h.length;k++)(l=h[k]).length&&(a[k]=l);return ob.call(f,a,[],c,d,e,g)})}a.length&&(this.result.length&&a.push(this.result),2>a.length?this.result=a[0]:(this.result=kb(a,c,d,!1,this.h),d=0));return g?this.resolve(c,d,e):this};Y.prototype.and=function(){var a=this.result.length;if(!a){var b=arguments[0];if(b){a=!!b.suggest;var c=b.resolve;var d=b.limit;var e=b.offset;var g=b.enrich&&c}}return a?(a=nb(this,"and",arguments),pb.call(this,a.W,a.$,a.limit,a.offset,a.enrich,a.resolve,a.suggest)):c?this.resolve(d,e,g):this};
function pb(a,b,c,d,e,g,f){if(b.length){var h=this;return Promise.all(b).then(function(k){a=[];for(var l=0,m=void 0;l<k.length;l++)(m=k[l]).length&&(a[l]=m);return pb.call(h,a,[],c,d,e,g,f)})}if(a.length)if(this.result.length&&a.unshift(this.result),2>a.length)this.result=a[0];else{if(b=za(a))return this.result=jb(a,b,c,d,f,this.h,g),g?e?X.call(this.index,this.result):this.result:this;this.result=[]}else f||(this.result=a);return g?this.resolve(c,d,e):this};Y.prototype.xor=function(){var a=nb(this,"xor",arguments);return qb.call(this,a.W,a.$,a.limit,a.offset,a.enrich,a.resolve,a.suggest)};
function qb(a,b,c,d,e,g,f){if(b.length){var h=this;return Promise.all(b).then(function(k){a=[];for(var l=0,m=void 0;l<k.length;l++)(m=k[l]).length&&(a[l]=m);return qb.call(h,a,[],c,d,e,g,f)})}if(a.length)if(this.result.length&&a.unshift(this.result),2>a.length)this.result=a[0];else return this.result=rb.call(this,a,c,d,g,this.h),g?e?X.call(this.index,this.result):this.result:this;else f||(this.result=a);return g?this.resolve(c,d,e):this}
function rb(a,b,c,d,e){for(var g=[],f=I(),h=0,k=0,l;k<a.length;k++)if(l=a[k]){h<l.length&&(h=l.length);for(var m=0,n;m<l.length;m++)if(n=l[m])for(var p=0,q;p<n.length;p++)q=n[p],f[q]=f[q]?2:1}for(l=k=0;k<h;k++)for(m=0;m<a.length;m++)if(n=a[m])if(n=n[k])for(p=0;p<n.length;p++)if(q=n[p],1===f[q])if(c)c--;else if(d){if(g.push(q),g.length===b)return g}else{var r=k+(m?e:0);g[r]||(g[r]=[]);g[r].push(q);if(++l===b)return g}return g};Y.prototype.not=function(){var a=nb(this,"not",arguments);return sb.call(this,a.W,a.$,a.limit,a.offset,a.enrich,a.resolve,a.suggest)};function sb(a,b,c,d,e,g,f){if(b.length){var h=this;return Promise.all(b).then(function(k){a=[];for(var l=0,m=void 0;l<k.length;l++)(m=k[l]).length&&(a[l]=m);return sb.call(h,a,[],c,d,e,g,f)})}if(a.length&&this.result.length)this.result=tb.call(this,a,c,d,g);else if(g)return this.resolve(c,d,e);return g?e?X.call(this.index,this.result):this.result:this}
function rb(a,b,c,d,e){for(var g=[],f=J(),h=0,k=0,l;k<a.length;k++)if(l=a[k]){h<l.length&&(h=l.length);for(var m=0,n;m<l.length;m++)if(n=l[m])for(var p=0,q;p<n.length;p++)q=n[p],f[q]=f[q]?2:1}for(l=k=0;k<h;k++)for(m=0;m<a.length;m++)if(n=a[m])if(n=n[k])for(p=0;p<n.length;p++)if(q=n[p],1===f[q])if(c)c--;else if(d){if(g.push(q),g.length===b)return g}else{var r=k+(m?e:0);g[r]||(g[r]=[]);g[r].push(q);if(++l===b)return g}return g};Y.prototype.not=function(){var a=nb(this,"not",arguments);return sb.call(this,a.W,a.$,a.limit,a.offset,a.enrich,a.resolve,a.suggest)};function sb(a,b,c,d,e,g,f){if(b.length){var h=this;return Promise.all(b).then(function(k){a=[];for(var l=0,m=void 0;l<k.length;l++)(m=k[l]).length&&(a[l]=m);return sb.call(h,a,[],c,d,e,g,f)})}if(a.length&&this.result.length)this.result=tb.call(this,a,c,d,g);else if(g)return this.resolve(c,d,e);return g?e?X.call(this.index,this.result):this.result:this}
function tb(a,b,c,d){var e=[];a=new Set(a.flat().flat());for(var g=0,f,h=0;g<this.result.length;g++)if(f=this.result[g])for(var k=0,l;k<f.length;k++)if(l=f[k],!a.has(l))if(c)c--;else if(d){if(e.push(l),e.length===b)return e}else if(e[g]||(e[g]=[]),e[g].push(l),++h===b)return e;return e};function Y(a){if(!this||this.constructor!==Y)return new Y(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.h=a.boost||0,this.result=a.index.search(a).result,this;this.index=null;this.result=a||[];this.h=0}Y.prototype.limit=function(a){if(this.result.length){for(var b=[],c=0,d;c<this.result.length;c++)if(d=this.result[c])if(d.length<=a){if(b[c]=d,a-=d.length,!a)break}else{b[c]=d.slice(0,a);break}this.result=b}return this};
Y.prototype.offset=function(a){if(this.result.length){for(var b=[],c=0,d;c<this.result.length;c++)if(d=this.result[c])d.length<=a?a-=d.length:(b[c]=d.slice(a),a=0);this.result=b}return this};Y.prototype.boost=function(a){this.h+=a;return this};Y.prototype.resolve=function(a,b,c){var d=this.result,e=this.index;this.result=this.index=null;return d.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),mb.call(e,d,a||100,b,c)):d};I();W.prototype.search=function(a,b,c,d){c||(!b&&M(a)?(c=a,a=""):M(b)&&(c=b,b=0));var e=[],g=[],f=0;if(c){c.constructor===Array&&(c={index:c});a=c.query||a;var h=c.pluck;var k=c.merge;var l=h||c.field||(l=c.index)&&(l.index?null:l);var m=this.tag&&c.tag;var n=c.suggest;var p=!1!==c.resolve;p||h||!(l=l||this.field)||(K(l)?h=l:(l.constructor===Array&&1===l.length&&(l=l[0]),h=l.field||l.index));var q=this.store&&c.enrich&&p;var r=c.highlight&&q;b=c.limit||b;var x=c.offset||0;b||(b=100);if(m&&(!this.db||
!d)){m.constructor!==Array&&(m=[m]);for(var t=[],A=0,z=void 0;A<m.length;A++)if(z=m[A],z.field&&z.tag){var v=z.tag;if(v.constructor===Array)for(var y=0;y<v.length;y++)t.push(z.field,v[y]);else t.push(z.field,v)}else{v=Object.keys(z);y=0;for(var D=void 0,G=void 0;y<v.length;y++)if(D=v[y],G=z[D],G.constructor===Array)for(var J=0;J<G.length;J++)t.push(D,G[J]);else t.push(D,G)}m=t;if(!a){p=[];if(t.length)for(g=0;g<t.length;g+=2){h=void 0;if(this.db){h=this.index.get(t[g]);if(!h)continue;p.push(h=h.db.tag(t[g+
Y.prototype.offset=function(a){if(this.result.length){for(var b=[],c=0,d;c<this.result.length;c++)if(d=this.result[c])d.length<=a?a-=d.length:(b[c]=d.slice(a),a=0);this.result=b}return this};Y.prototype.boost=function(a){this.h+=a;return this};Y.prototype.resolve=function(a,b,c){var d=this.result,e=this.index;this.result=this.index=null;return d.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),mb.call(e,d,a||100,b,c)):d};J();W.prototype.search=function(a,b,c,d){c||(!b&&M(a)?(c=a,a=""):M(b)&&(c=b,b=0));var e=[],g=[],f=0;if(c){c.constructor===Array&&(c={index:c});a=c.query||a;var h=c.pluck;var k=c.merge;var l=h||c.field||(l=c.index)&&(l.index?null:l);var m=this.tag&&c.tag;var n=c.suggest;var p=!1!==c.resolve;p||h||!(l=l||this.field)||(K(l)?h=l:(l.constructor===Array&&1===l.length&&(l=l[0]),h=l.field||l.index));var q=this.store&&c.enrich&&p;var r=c.highlight&&q;b=c.limit||b;var x=c.offset||0;b||(b=100);if(m&&(!this.db||
!d)){m.constructor!==Array&&(m=[m]);for(var t=[],A=0,z=void 0;A<m.length;A++)if(z=m[A],z.field&&z.tag){var v=z.tag;if(v.constructor===Array)for(var y=0;y<v.length;y++)t.push(z.field,v[y]);else t.push(z.field,v)}else{v=Object.keys(z);y=0;for(var D=void 0,G=void 0;y<v.length;y++)if(D=v[y],G=z[D],G.constructor===Array)for(var I=0;I<G.length;I++)t.push(D,G[I]);else t.push(D,G)}m=t;if(!a){p=[];if(t.length)for(g=0;g<t.length;g+=2){h=void 0;if(this.db){h=this.index.get(t[g]);if(!h)continue;p.push(h=h.db.tag(t[g+
1],b,x,q))}else h=ub.call(this,t[g],t[g+1],b,x,q);e.push({field:t[g],tag:t[g+1],result:h})}return p.length?Promise.all(p).then(function(P){for(var Q=0;Q<P.length;Q++)e[Q].result=P[Q];return e}):e}}l&&l.constructor!==Array&&(l=[l])}l||(l=this.field);t=!d&&(this.worker||this.db)&&[];A=0;for(y=z=v=void 0;A<l.length;A++)if(z=l[A],!this.db||!this.tag||this.J[A]){v=void 0;K(z)||(v=z,z=v.field,a=v.query||a,b=v.limit||b,x=v.offset||x,n=v.suggest||n,q=this.store&&(v.enrich||q));if(d)v=d[A];else{y=v||c;v=this.index.get(z);
if(m){if(this.db){y.tag=m;var Ja=v.db.support_tag_search;y.field=l}Ja||(y.enrich=!1)}if(t){t[A]=v.search(a,b,y);y&&q&&(y.enrich=q);continue}else v=v.search(a,b,y),y&&q&&(y.enrich=q)}y=v&&(p?v.length:v.result.length);if(m&&y){D=[];G=0;if(this.db&&d){if(!Ja)for(J=l.length;J<d.length;J++){var L=d[J];if(L&&L.length)G++,D.push(L);else if(!n)return p?e:new Y(e)}}else{J=0;for(var Wb=L=void 0;J<m.length;J+=2){L=this.tag.get(m[J]);if(!L)if(n)continue;else return p?e:new Y(e);if(Wb=(L=L&&L.get(m[J+1]))&&L.length)G++,
D.push(L);else if(!n)return p?e:new Y(e)}}if(G){v=lb(v,D,p);y=v.length;if(!y&&!n)return p?v:new Y(v);G--}}if(y)g[f]=z,e.push(v),f++;else if(1===l.length)return p?e:new Y(e)}if(t){if(this.db&&m&&m.length&&!Ja)for(q=0;q<m.length;q+=2){g=this.index.get(m[q]);if(!g)if(n)continue;else return p?e:new Y(e);t.push(g.db.tag(m[q+1],b,x,!1))}var Xb=this;return Promise.all(t).then(function(P){return P.length?Xb.search(a,b,c,P):P})}if(!f)return p?e:new Y(e);if(h&&(!q||!this.store))return e[0];t=[];x=0;for(n=void 0;x<
g.length;x++){n=e[x];q&&n.length&&!n[0].doc&&(this.db?t.push(n=this.index.get(this.field[0]).db.enrich(n)):n=X.call(this,n));if(h)return p?n:new Y(n);e[x]={field:g[x],result:n}}if(q&&this.db&&t.length){var Ka=this;return Promise.all(t).then(function(P){for(var Q=0;Q<P.length;Q++)e[Q].result=P[Q];return k?vb(e,b):r?wb(e,a,Ka.index,Ka.field,Ka.J,r):e})}return k?vb(e,b):r?wb(e,a,this.index,this.field,this.J,r):e};
if(m){if(this.db){y.tag=m;var Ka=v.db.support_tag_search;y.field=l}Ka||(y.enrich=!1)}if(t){t[A]=v.search(a,b,y);y&&q&&(y.enrich=q);continue}else v=v.search(a,b,y),y&&q&&(y.enrich=q)}y=v&&(p?v.length:v.result.length);if(m&&y){D=[];G=0;if(this.db&&d){if(!Ka)for(I=l.length;I<d.length;I++){var L=d[I];if(L&&L.length)G++,D.push(L);else if(!n)return p?e:new Y(e)}}else{I=0;for(var Wb=L=void 0;I<m.length;I+=2){L=this.tag.get(m[I]);if(!L)if(n)continue;else return p?e:new Y(e);if(Wb=(L=L&&L.get(m[I+1]))&&L.length)G++,
D.push(L);else if(!n)return p?e:new Y(e)}}if(G){v=lb(v,D,p);y=v.length;if(!y&&!n)return p?v:new Y(v);G--}}if(y)g[f]=z,e.push(v),f++;else if(1===l.length)return p?e:new Y(e)}if(t){if(this.db&&m&&m.length&&!Ka)for(q=0;q<m.length;q+=2){g=this.index.get(m[q]);if(!g)if(n)continue;else return p?e:new Y(e);t.push(g.db.tag(m[q+1],b,x,!1))}var Xb=this;return Promise.all(t).then(function(P){return P.length?Xb.search(a,b,c,P):P})}if(!f)return p?e:new Y(e);if(h&&(!q||!this.store))return e[0];t=[];x=0;for(n=void 0;x<
g.length;x++){n=e[x];q&&n.length&&!n[0].doc&&(this.db?t.push(n=this.index.get(this.field[0]).db.enrich(n)):n=X.call(this,n));if(h)return p?n:new Y(n);e[x]={field:g[x],result:n}}if(q&&this.db&&t.length){var La=this;return Promise.all(t).then(function(P){for(var Q=0;Q<P.length;Q++)e[Q].result=P[Q];return k?vb(e,b):r?wb(e,a,La.index,La.field,La.J,r):e})}return k?vb(e,b):r?wb(e,a,this.index,this.field,this.J,r):e};
function wb(a,b,c,d,e,g){for(var f,h,k,l=0,m,n,p;l<a.length;l++)for(m=a[l].result,n=a[l].field,k=c.get(n),p=k.encoder,k=k.tokenize,n=e[d.indexOf(n)],p!==f&&(f=p,h=f.encode(b)),p=0;p<m.length;p++){var q="",r=ya(m[p].doc,n),x=f.encode(r);r=r.split(f.split);for(var t=0,A,z;t<x.length;t++){A=x[t];z=r[t];for(var v=void 0,y=0,D;y<h.length;y++)if(D=h[y],"strict"===k){if(A===D){q+=(q?" ":"")+g.replace("$1",z);v=!0;break}}else{var G=A.indexOf(D);if(-1<G){q+=(q?" ":"")+z.substring(0,G)+g.replace("$1",z.substring(G,
D.length))+z.substring(G+D.length);v=!0;break}}v||(q+=(q?" ":"")+r[t])}m[p].highlight=q}return a}function vb(a,b){for(var c=[],d=I(),e=0,g,f;e<a.length;e++){g=a[e];f=g.result;for(var h=0,k,l,m;h<f.length;h++)if(l=f[h],k=l.id,m=d[k])m.push(g.field);else{if(c.length===b)return c;l.field=d[k]=[g.field];c.push(l)}}return c}function ub(a,b,c,d,e){a=this.tag.get(a);if(!a)return[];if((b=(a=a&&a.get(b))&&a.length-d)&&0<b){if(b>c||d)a=a.slice(d,d+c);e&&(a=X.call(this,a));return a}}
D.length))+z.substring(G+D.length);v=!0;break}}v||(q+=(q?" ":"")+r[t])}m[p].highlight=q}return a}function vb(a,b){for(var c=[],d=J(),e=0,g,f;e<a.length;e++){g=a[e];f=g.result;for(var h=0,k,l,m;h<f.length;h++)if(l=f[h],k=l.id,m=d[k])m.push(g.field);else{if(c.length===b)return c;l.field=d[k]=[g.field];c.push(l)}}return c}function ub(a,b,c,d,e){a=this.tag.get(a);if(!a)return[];if((b=(a=a&&a.get(b))&&a.length-d)&&0<b){if(b>c||d)a=a.slice(d,d+c);e&&(a=X.call(this,a));return a}}
function X(a){if(!this||!this.store)return a;for(var b=Array(a.length),c=0,d;c<a.length;c++)d=a[c],b[c]={id:d,doc:this.store.get(d)};return b};function W(a){if(!this||this.constructor!==W)return new W(a);var b=a.document||a.doc||a,c,d;this.J=[];this.field=[];this.S=[];this.key=(c=b.key||b.id)&&xb(c,this.S)||"id";(d=a.keystore||0)&&(this.keystore=d);this.fastupdate=!!a.fastupdate;this.reg=!this.fastupdate||a.worker||a.db?d?new V(d):new Set:d?new U(d):new Map;this.I=(c=b.store||null)&&c&&!0!==c&&[];this.store=c&&(d?new U(d):new Map);this.cache=(c=a.cache||null)&&new Z(c);a.cache=!1;this.worker=a.worker;this.index=yb.call(this,a,b);this.tag=
null;if(c=b.tag)if("string"===typeof c&&(c=[c]),c.length){this.tag=new Map;this.L=[];this.aa=[];b=0;for(var e=d=void 0;b<c.length;b++){d=c[b];e=d.field||d;if(!e)throw Error("The tag field from the document descriptor is undefined.");d.custom?this.L[b]=d.custom:(this.L[b]=xb(e,this.S),d.filter&&("string"===typeof this.L[b]&&(this.L[b]=new String(this.L[b])),this.L[b].R=d.filter));this.aa[b]=e;this.tag.set(e,new Map)}}if(this.worker){this.fastupdate=!1;a=[];c=w(this.index.values());for(b=c.next();!b.done;b=
c.next())b=b.value,b.then&&a.push(b);if(a.length){var g=this;return Promise.all(a).then(function(f){for(var h=0,k=w(g.index.entries()),l=k.next();!l.done;l=k.next()){l=l.value;var m=l[0];l[1].then&&g.index.set(m,f[h++])}return g})}}else a.db&&(this.fastupdate=!1,this.mount(a.db))}u=W.prototype;
@@ -100,15 +100,16 @@ u.remove=function(a){M(a)&&(a=ya(a,this.key));for(var b=w(this.index.values()),c
u.clear=function(){for(var a=w(this.index.values()),b=a.next();!b.done;b=a.next())b.value.clear();if(this.tag)for(a=w(this.tag.values()),b=a.next();!b.done;b=a.next())b.value.clear();this.store&&this.store.clear();return this};u.contain=function(a){return this.db?this.index.get(this.field[0]).db.has(a):this.reg.has(a)};u.cleanup=function(){for(var a=w(this.index.values()),b=a.next();!b.done;b=a.next())b.value.cleanup();return this};
u.get=function(a){return this.db?this.index.get(this.field[0]).db.enrich(a).then(function(b){return b[0]&&b[0].doc}):this.store.get(a)};u.set=function(a,b){this.store.set(a,b);return this};u.searchCache=zb;
u.export=function(a,b,c,d){c=void 0===c?0:c;d=void 0===d?0:d;if(c<this.field.length){var e=this.field[c];if((b=this.index.get(e).export(a,e,c,d=1))&&b.then){var g=this;return b.then(function(){return g.export(a,e,c+1)})}return this.export(a,e,c+1)}switch(d){case 0:var f="reg";var h=Ya(this.reg);b=null;break;case 1:f="tag";h=Wa(this.tag,this.reg.size);b=null;break;case 2:f="doc";h=Ua(this.store);b=null;break;case 3:f="cfg";b=h=null;break;default:return}return $a.call(this,a,b,f,h,c,d)};
u.import=function(a,b){if(b){"string"===typeof b&&(b=JSON.parse(b));a=a.split(".");"json"===a[a.length-1]&&a.pop();var c=2<a.length?a[0]:"";a=2<a.length?a[2]:a[1];if(c)return this.index.get(c).import(a,b);switch(a){case "reg":this.fastupdate=!1;this.reg=Za(b,this.reg);for(b=0;b<this.field.length;b++)c=this.index.get(this.field[b]),c.fastupdate=!1,c.reg=this.reg;break;case "tag":this.tag=Xa(b,this.tag);break;case "doc":this.store=Va(b,this.store)}}};La(W.prototype);function zb(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new Z);var d=this.cache.get(a);if(!d){d=this.search(a,b,c);if(d.then){var e=this;d.then(function(g){e.cache.set(a,g);return g})}this.cache.set(a,d)}return d}function Z(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}Z.prototype.set=function(a,b){this.cache.set(this.h=a,b);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};
u.import=function(a,b){var c=a.split(".");"json"===c[c.length-1]&&c.pop();var d=2<c.length?c[0]:"";c=2<c.length?c[2]:c[1];if(this.worker&&d)return this.index.get(d).import(a);if(b){"string"===typeof b&&(b=JSON.parse(b));if(d)return this.index.get(d).import(c,b);switch(c){case "reg":this.fastupdate=!1;this.reg=Za(b,this.reg);for(b=0;b<this.field.length;b++)d=this.index.get(this.field[b]),d.fastupdate=!1,d.reg=this.reg;if(this.worker){b=[];d=w(this.index.values());for(c=d.next();!c.done;c=d.next())b.push(c.value.import(a));
return Promise.all(b)}break;case "tag":this.tag=Xa(b,this.tag);break;case "doc":this.store=Va(b,this.store)}}};Ja(W.prototype);function zb(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new Z);var d=this.cache.get(a);if(!d){d=this.search(a,b,c);if(d.then){var e=this;d.then(function(g){e.cache.set(a,g);return g})}this.cache.set(a,d)}return d}function Z(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}Z.prototype.set=function(a,b){this.cache.set(this.h=a,b);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};
Z.prototype.get=function(a){var b=this.cache.get(a);b&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,b));return b};Z.prototype.remove=function(a){for(var b=w(this.cache),c=b.next();!c.done;c=b.next()){c=c.value;var d=c[0];c[1].includes(a)&&this.cache.delete(d)}};Z.prototype.clear=function(){this.cache.clear();this.h=""};var Ab={normalize:function(a){return a.toLowerCase()}};var Bb=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]);var Cb=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["pf","f"]]),Db=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\1+/g,"$1"];var Eb={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,"\u00df":2,d:3,t:3,l:4,m:5,n:5,r:6};var Fb=/[\x00-\x7F]+/g;var Gb=/[\x00-\x7F]+/g;var Hb=/[\x00-\x7F]+/g;var Ib={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:Ab,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Bb},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Bb,matcher:Cb,replacer:Db},LatinExtra:{normalize:!0,dedupe:!0,mapper:Bb,replacer:Db.concat([/(?!^)[aeo]/g,""]),matcher:Cb},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(var b=0;b<a.length;b++){for(var c=a[b],d=c.charAt(0),e=Eb[d],g=1,f;g<c.length&&(f=c.charAt(g),"h"===f||"w"===
f||!(f=Eb[f])||f===e||(d+=f,e=f,4!==d.length));g++);a[b]=d}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Fb," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(Gb,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Hb," ")}}};var Jb={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};R.prototype.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.reg.has(a))return this.update(a,b);b=this.encoder.encode(b);if(d=b.length){for(var e=I(),g=I(),f=this.depth,h=this.resolution,k=0;k<d;k++){var l=b[this.rtl?d-1-k:k],m=l.length;if(m&&(f||!g[l])){var n=this.score?this.score(b,l,k,null,0):Kb(h,d,k),p="";switch(this.tokenize){case "full":if(2<m){for(n=0;n<m;n++)for(var q=m;q>n;q--){p=l.substring(n,q);var r=this.score?this.score(b,l,k,p,n):Kb(h,d,k,m,n);Lb(this,g,p,r,a,c)}break}case "reverse":if(1<
m){for(q=m-1;0<q;q--)p=l[q]+p,r=this.score?this.score(b,l,k,p,q):Kb(h,d,k,m,q),Lb(this,g,p,r,a,c);p=""}case "forward":if(1<m){for(q=0;q<m;q++)p+=l[q],Lb(this,g,p,n,a,c);break}default:if(Lb(this,g,l,n,a,c),f&&1<d&&k<d-1)for(m=I(),p=this.da,n=l,q=Math.min(f+1,d-k),r=m[n]=1;r<q;r++)if((l=b[this.rtl?d-1-k-r:k+r])&&!m[l]){m[l]=1;var x=this.score?this.score(b,n,k,l,r):Kb(p+(d/2>p?0:1),d,k,q-1,r-1),t=this.bidirectional&&l>n;Lb(this,e,t?n:l,x,a,c,t?l:n)}}}}this.fastupdate||this.reg.add(a)}else b=""}this.db&&
f||!(f=Eb[f])||f===e||(d+=f,e=f,4!==d.length));g++);a[b]=d}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Fb," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(Gb,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Hb," ")}}};var Jb={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};R.prototype.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.reg.has(a))return this.update(a,b);b=this.encoder.encode(b);if(d=b.length){for(var e=J(),g=J(),f=this.depth,h=this.resolution,k=0;k<d;k++){var l=b[this.rtl?d-1-k:k],m=l.length;if(m&&(f||!g[l])){var n=this.score?this.score(b,l,k,null,0):Kb(h,d,k),p="";switch(this.tokenize){case "full":if(2<m){for(n=0;n<m;n++)for(var q=m;q>n;q--){p=l.substring(n,q);var r=this.score?this.score(b,l,k,p,n):Kb(h,d,k,m,n);Lb(this,g,p,r,a,c)}break}case "reverse":if(1<
m){for(q=m-1;0<q;q--)p=l[q]+p,r=this.score?this.score(b,l,k,p,q):Kb(h,d,k,m,q),Lb(this,g,p,r,a,c);p=""}case "forward":if(1<m){for(q=0;q<m;q++)p+=l[q],Lb(this,g,p,n,a,c);break}default:if(Lb(this,g,l,n,a,c),f&&1<d&&k<d-1)for(m=J(),p=this.da,n=l,q=Math.min(f+1,d-k),r=m[n]=1;r<q;r++)if((l=b[this.rtl?d-1-k-r:k+r])&&!m[l]){m[l]=1;var x=this.score?this.score(b,n,k,l,r):Kb(p+(d/2>p?0:1),d,k,q-1,r-1),t=this.bidirectional&&l>n;Lb(this,e,t?n:l,x,a,c,t?l:n)}}}}this.fastupdate||this.reg.add(a)}else b=""}this.db&&
(b||this.commit_task.push({del:a}),this.ca&&Mb(this));return this};
function Lb(a,b,c,d,e,g,f){var h=f?a.ctx:a.map,k;if(!b[c]||f&&!(k=b[c])[f])if(f?(b=k||(b[c]=I()),b[f]=1,(k=h.get(f))?h=k:h.set(f,h=new Map)):b[c]=1,(k=h.get(c))?h=k:h.set(c,h=k=[]),h=h[d]||(h[d]=[]),!g||!h.includes(e)){if(h.length===Math.pow(2,31)-1){b=new bb(h);if(a.fastupdate)for(c=w(a.reg.values()),g=c.next();!g.done;g=c.next())g=g.value,g.includes(h)&&(g[g.indexOf(h)]=b);k[d]=h=b}h.push(e);a.fastupdate&&((d=a.reg.get(e))?d.push(h):a.reg.set(e,[h]))}}
function Kb(a,b,c,d,e){return c&&1<a?b+(d||0)<=a?c+(e||0):(a-1)/(b+(d||0))*(c+(e||0))+1|0:0};R.prototype.search=function(a,b,c){c||(!b&&M(a)?(c=a,a=""):M(b)&&(c=b,b=0));var d=[],e=0,g;if(c){a=c.query||a;b=c.limit||b;e=c.offset||0;var f=c.context;var h=c.suggest;var k=(g=!1!==c.resolve)&&c.enrich;var l=c.boost;var m=c.resolution;var n=this.db&&c.tag}else g=this.resolve;var p=this.encoder.encode(a);var q=p.length;b=b||(g?100:0);if(1===q)return Nb.call(this,p[0],"",b,e,g,k,n);f=this.depth&&!1!==f;if(2===q&&f&&!h)return Nb.call(this,p[0],p[1],b,e,g,k,n);var r=I(),x=0;if(1<q&&f){var t=p[0];x=
1}m||0===m||(m=t?this.da:this.resolution);if(this.db){if(this.db.search&&(a=this.db.search(this,p,b,e,h,g,k,n),!1!==a))return a;var A=this;return function(){var z,v;return ta(function(y){switch(y.h){case 1:v=z=void 0;case 2:if(!(x<q)){y.h=4;break}v=p[x];if(!v||r[v]){y.h=5;break}r[v]=1;return E(y,Ob(A,v,t,0,0,!1,!1),6);case 6:z=y.D;if(z=Pb(z,d,h,m)){d=z;y.h=4;break}t&&(h&&z&&d.length||(t=v));case 5:h&&t&&x===q-1&&!d.length&&(t="",x=-1,r=I());x++;y.h=2;break;case 4:return y.return(Qb(d,m,b,e,h,l,g))}})}()}for(c=
a=void 0;x<q;x++){if((c=p[x])&&!r[c]){r[c]=1;a=Ob(this,c,t,0,0,!1,!1);if(a=Pb(a,d,h,m)){d=a;break}t&&(h&&a&&d.length||(t=c))}h&&t&&x===q-1&&!d.length&&(t="",x=-1,r=I())}return Qb(d,m,b,e,h,l,g)};function Qb(a,b,c,d,e,g,f){var h=a.length,k=a;if(1<h)k=jb(a,b,c,d,e,g,f);else if(1===h)return f?mb.call(null,a[0],c,d):new Y(a[0]);return f?k:new Y(k)}
function Lb(a,b,c,d,e,g,f){var h=f?a.ctx:a.map,k;if(!b[c]||f&&!(k=b[c])[f])if(f?(b=k||(b[c]=J()),b[f]=1,(k=h.get(f))?h=k:h.set(f,h=new Map)):b[c]=1,(k=h.get(c))?h=k:h.set(c,h=k=[]),h=h[d]||(h[d]=[]),!g||!h.includes(e)){if(h.length===Math.pow(2,31)-1){b=new bb(h);if(a.fastupdate)for(c=w(a.reg.values()),g=c.next();!g.done;g=c.next())g=g.value,g.includes(h)&&(g[g.indexOf(h)]=b);k[d]=h=b}h.push(e);a.fastupdate&&((d=a.reg.get(e))?d.push(h):a.reg.set(e,[h]))}}
function Kb(a,b,c,d,e){return c&&1<a?b+(d||0)<=a?c+(e||0):(a-1)/(b+(d||0))*(c+(e||0))+1|0:0};R.prototype.search=function(a,b,c){c||(!b&&M(a)?(c=a,a=""):M(b)&&(c=b,b=0));var d=[],e=0,g;if(c){a=c.query||a;b=c.limit||b;e=c.offset||0;var f=c.context;var h=c.suggest;var k=(g=!1!==c.resolve)&&c.enrich;var l=c.boost;var m=c.resolution;var n=this.db&&c.tag}else g=this.resolve;var p=this.encoder.encode(a);var q=p.length;b=b||(g?100:0);if(1===q)return Nb.call(this,p[0],"",b,e,g,k,n);f=this.depth&&!1!==f;if(2===q&&f&&!h)return Nb.call(this,p[0],p[1],b,e,g,k,n);var r=J(),x=0;if(1<q&&f){var t=p[0];x=
1}m||0===m||(m=t?this.da:this.resolution);if(this.db){if(this.db.search&&(a=this.db.search(this,p,b,e,h,g,k,n),!1!==a))return a;var A=this;return function(){var z,v;return ta(function(y){switch(y.h){case 1:v=z=void 0;case 2:if(!(x<q)){y.h=4;break}v=p[x];if(!v||r[v]){y.h=5;break}r[v]=1;return E(y,Ob(A,v,t,0,0,!1,!1),6);case 6:z=y.D;if(z=Pb(z,d,h,m)){d=z;y.h=4;break}t&&(h&&z&&d.length||(t=v));case 5:h&&t&&x===q-1&&!d.length&&(t="",x=-1,r=J());x++;y.h=2;break;case 4:return y.return(Qb(d,m,b,e,h,l,g))}})}()}for(c=
a=void 0;x<q;x++){if((c=p[x])&&!r[c]){r[c]=1;a=Ob(this,c,t,0,0,!1,!1);if(a=Pb(a,d,h,m)){d=a;break}t&&(h&&a&&d.length||(t=c))}h&&t&&x===q-1&&!d.length&&(t="",x=-1,r=J())}return Qb(d,m,b,e,h,l,g)};function Qb(a,b,c,d,e,g,f){var h=a.length,k=a;if(1<h)k=jb(a,b,c,d,e,g,f);else if(1===h)return f?mb.call(null,a[0],c,d):new Y(a[0]);return f?k:new Y(k)}
function Nb(a,b,c,d,e,g,f){a=Ob(this,a,b,c,d,e,g,f);return this.db?a.then(function(h){return e?h||[]:new Y(h)}):a&&a.length?e?mb.call(this,a,c,d):new Y(a):e?[]:new Y}function Pb(a,b,c,d){var e=[];if(a&&a.length){if(a.length<=d){b.push(a);return}for(var g=0,f;g<d;g++)if(f=a[g])e[g]=f;if(e.length){b.push(e);return}}if(!c)return e}function Ob(a,b,c,d,e,g,f,h){var k;c&&(k=a.bidirectional&&b>c)&&(k=c,c=b,b=k);if(a.db)return a.db.get(b,c,d,e,g,f,h);a=c?(a=a.ctx.get(c))&&a.get(b):a.map.get(b);return a};R.prototype.remove=function(a,b){var c=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(c){if(this.fastupdate)for(var d=0,e;d<c.length;d++){if(e=c[d])if(2>e.length)e.pop();else{var g=e.indexOf(a);g===c.length-1?e.pop():e.splice(g,1)}}else Rb(this.map,a),this.depth&&Rb(this.ctx,a);b||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.ca&&Mb(this));this.cache&&this.cache.remove(a);return this};
function Rb(a,b){var c=0;if(a.constructor===Array)for(var d=0,e=void 0,g;d<a.length;d++){if((e=a[d])&&e.length)if(g=e.indexOf(b),0<=g){1<e.length?(e.splice(g,1),c++):delete a[d];break}else c++}else for(d=w(a.entries()),e=d.next();!e.done;e=d.next())g=e.value,e=g[0],(g=Rb(g[1],b))?c+=g:a.delete(e);return c};function R(a,b){if(!this||this.constructor!==R)return new R(a);if(a){var c=K(a)?a:a.preset;c&&(a=Object.assign({},Jb[c],a))}else a={};c=a.context;var d=!0===c?{depth:1}:c||{},e=K(a.encoder)?Ib[a.encoder]:a.encode||a.encoder||Ab;this.encoder=e.encode?e:"object"===typeof e?new Ga(e):{encode:e};this.resolution=a.resolution||9;this.tokenize=(c=a.tokenize)&&"default"!==c&&c||"strict";this.depth="strict"===c&&d.depth||0;this.bidirectional=!1!==d.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||
null;(c=a.keystore||0)&&(this.keystore=c);this.map=c?new U(c):new Map;this.ctx=c?new U(c):new Map;this.reg=b||(this.fastupdate?c?new U(c):new Map:c?new V(c):new Set);this.da=d.resolution||3;this.rtl=e.rtl||a.rtl||!1;this.cache=(c=a.cache||null)&&new Z(c);this.resolve=!1!==a.resolve;if(c=a.db)this.db=this.mount(c);this.ca=!1!==a.commit;this.commit_task=[];this.commit_timer=null;this.priority=a.priority||4}u=R.prototype;
@@ -116,10 +117,10 @@ u.mount=function(a){this.commit_timer&&(clearTimeout(this.commit_timer),this.com
u.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();this.db&&(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[{clear:!0}]);return this};u.append=function(a,b){return this.add(a,b,!0)};u.contain=function(a){return this.db?this.db.has(a):this.reg.has(a)};u.update=function(a,b){var c=this,d=this.remove(a);return d&&d.then?d.then(function(){return c.add(a,b)}):this.add(a,b)};
function Sb(a){var b=0;if(a.constructor===Array)for(var c=0,d=void 0;c<a.length;c++)(d=a[c])&&(b+=d.length);else for(c=w(a),d=c.next();!d.done;d=c.next()){var e=d.value;d=e[0];(e=Sb(e[1]))?b+=e:a.delete(d)}return b}u.cleanup=function(){if(!this.fastupdate)return this;Sb(this.map);this.depth&&Sb(this.ctx);return this};u.searchCache=zb;
u.export=function(a,b,c,d){c=void 0===c?0:c;d=void 0===d?0:d;switch(d){case 0:var e="reg";var g=Ya(this.reg);break;case 1:e="cfg";g=null;break;case 2:e="map";g=Ua(this.map,this.reg.size);break;case 3:e="ctx";g=Wa(this.ctx,this.reg.size);break;default:return}return $a.call(this,a,b,e,g,c,d)};
u.import=function(a,b){if(b)switch("string"===typeof b&&(b=JSON.parse(b)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=Za(b,this.reg);break;case "map":this.map=Va(b,this.map);break;case "ctx":this.ctx=Xa(b,this.ctx)}};
u.import=function(a,b){if(b)switch("string"===typeof b&&(b=JSON.parse(b)),a=a.split("."),"json"===a[a.length-1]&&a.pop(),3===a.length&&a.shift(),a=1<a.length?a[1]:a[0],a){case "reg":this.fastupdate=!1;this.reg=Za(b,this.reg);break;case "map":this.map=Va(b,this.map);break;case "ctx":this.ctx=Xa(b,this.ctx)}};
u.serialize=function(a){a=void 0===a?!0:a;if(!this.reg.size)return"";for(var b="",c="",d=w(this.reg.keys()),e=d.next();!e.done;e=d.next())e=e.value,c||(c=typeof e),b+=(b?",":"")+("string"===c?'"'+e+'"':e);b="index.reg=new Set(["+b+"]);";d="";e=w(this.map.entries());for(var g=e.next();!g.done;g=e.next()){var f=g.value;g=f[0];f=f[1];for(var h="",k=0,l;k<f.length;k++){l=f[k]||[""];for(var m="",n=0;n<l.length;n++)m+=(m?",":"")+("string"===c?'"'+l[n]+'"':l[n]);m="["+m+"]";h+=(h?",":"")+m}h='["'+g+'",['+
h+"]]";d+=(d?",":"")+h}d="index.map=new Map(["+d+"]);";e="";g=w(this.ctx.entries());for(f=g.next();!f.done;f=g.next())for(h=f.value,f=h[0],h=w(h[1].entries()),k=h.next();!k.done;k=h.next()){l=k.value;k=l[0];l=l[1];m="";n=0;for(var p;n<l.length;n++){p=l[n]||[""];for(var q="",r=0;r<p.length;r++)q+=(q?",":"")+("string"===c?'"'+p[r]+'"':p[r]);q="["+q+"]";m+=(m?",":"")+q}m='new Map([["'+k+'",['+m+"]]])";m='["'+f+'",'+m+"]";e+=(e?",":"")+m}e="index.ctx=new Map(["+e+"]);";return a?"function inject(index){"+
b+d+e+"}":b+d+e};La(R.prototype);var Tb="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),Ub=["map","ctx","tag","reg","cfg"];
b+d+e+"}":b+d+e};Ja(R.prototype);var Tb="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),Ub=["map","ctx","tag","reg","cfg"];
function Vb(a,b){b=void 0===b?{}:b;if(!this)return new Vb(a,b);"object"===typeof a&&(b=a,a=a.name);a||console.info("Default storage space was used, because a name was not passed.");this.id="flexsearch"+(a?":"+a.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"");this.field=b.field?b.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"";this.type=b.type;this.fastupdate=this.support_tag_search=!1;this.db=null;this.h={}}u=Vb.prototype;u.mount=function(a){if(!a.encoder)return a.mount(this);a.db=this;return this.open()};
u.open=function(){var a=this;navigator.storage&&navigator.storage.persist();return this.db||new Promise(function(b,c){var d=Tb.open(a.id+(a.field?":"+a.field:""),1);d.onupgradeneeded=function(){var e=a.db=this.result;Ub.forEach(function(g){e.objectStoreNames.contains(g)||e.createObjectStore(g)})};d.onblocked=function(e){console.error("blocked",e);c()};d.onerror=function(e){console.error(this.error,e);c()};d.onsuccess=function(){a.db=this.result;a.db.onversionchange=function(){a.close()};b(a)}})};
u.close=function(){this.db.close();this.db=null};u.destroy=function(){var a=Tb.deleteDatabase(this.id+(this.field?":"+this.field:""));return Yb(a)};u.clear=function(){for(var a=this.db.transaction(Ub,"readwrite"),b=0;b<Ub.length;b++)a.objectStore(Ub[b]).clear();return Yb(a)};

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.111 (Light/Debug)
* FlexSearch.js v0.8.113 (Light/Debug)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.111 (Light)
* FlexSearch.js v0.8.113 (Light)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.111 (Bundle/Debug)
* FlexSearch.js v0.8.113 (Bundle/Debug)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.111 (Bundle)
* FlexSearch.js v0.8.113 (Bundle)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH

View File

@@ -157,6 +157,10 @@ Document.prototype.add = function (id, content, _append) {
this.store.set(id, payload || content);
}
if (this.worker) {
this.fastupdate || this.reg.add(id);
}
}
return this;

View File

@@ -87,9 +87,7 @@ Encoder.prototype.assign = function (options) {
* pre-processing string input
* @type {Function|boolean}
*/
this.normalize = /** @type {Function|boolean} */merge_option(options.normalize, /* tag? */ /* stringify */ /* stringify */ /* single param */ /* skip update: */ /* append: */ /* skip update: */
/* skip_update: */
/* skip deletion */!0 /*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/, this.normalize);
this.normalize = /** @type {Function|boolean} */merge_option(options.normalize, /* tag? */ /* stringify */ /* stringify */ /* single param */ /* skip update: */ /* append: */ /* skip update: */ /* skip_update: */ /* skip deletion */!0 /*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/, this.normalize);
// {
// letter: true,
@@ -199,7 +197,8 @@ Encoder.prototype.assign = function (options) {
// auto-balanced cache
this.cache = tmp = merge_option(options.cache, !0, this.cache);
if (tmp) {
this.timer = null;this.cache_size = "number" == typeof tmp ? tmp : 2e5;
this.timer = null;
this.cache_size = "number" == typeof tmp ? tmp : 2e5;
this.cache_enc = new Map();
this.cache_term = new Map();
this.cache_enc_length = 128;

View File

@@ -1,3 +1,4 @@
import Index from "./index.js";
import Document from "./document.js";
import { is_string } from "./common.js";
@@ -88,7 +89,7 @@ function json_to_ctx(json, ctx) {
}
/**
* @param {Set<string|number>} reg
* @param {Set<string|number>|Map<Array<string|number>>} reg
* @return {Array<Array<string|number>>}
*/
function reg_to_json(reg) {
@@ -217,6 +218,9 @@ export function importIndex(key, data) {
if ("json" === split[split.length - 1]) {
split.pop();
}
if (3 === split.length) {
split.shift();
}
key = 1 < split.length ? split[1] : split[0];
switch (key) {
@@ -319,6 +323,19 @@ export function exportDocument(callback, _field, _index_doc = 0, _index_obj = 0)
export function importDocument(key, data) {
const split = key.split(".");
if ("json" === split[split.length - 1]) {
split.pop();
}
const field = 2 < split.length ? split[0] : "",
ref = 2 < split.length ? split[2] : split[1];
// trigger the import for worker field indexes
if (this.worker && field) {
return this.index.get(field).import(key);
}
if (!data) {
return;
}
@@ -326,16 +343,9 @@ export function importDocument(key, data) {
data = /** @type {Array<Object>} */JSON.parse( /** @type {string} */data);
}
const split = key.split(".");
if ("json" === split[split.length - 1]) {
split.pop();
}
const field = 2 < split.length ? split[0] : "";
key = 2 < split.length ? split[2] : split[1];
if (!field) {
switch (key) {
switch (ref) {
case "reg":
@@ -349,6 +359,22 @@ export function importDocument(key, data) {
idx.reg = this.reg;
}
// trigger the import for worker field indexes
if (this.worker) {
const promises = [],
self = this;
for (const index of this.index.values()) {
// const ref = item[0];
// const index = item[1];
promises.push(index.import(key));
//this.index.get(field).import(key);
}
return Promise.all(promises);
}
break;
case "tag":
@@ -368,7 +394,7 @@ export function importDocument(key, data) {
}
} else {
return this.index.get(field).import(key, data);
return this.index.get(field).import(ref, data);
}
}

View File

@@ -1,6 +1,6 @@
import { IndexOptions } from "./type.js";
import { create_object, is_function, is_object, is_string } from "./common.js";
import { create_object } from "./common.js";
import handler from "./worker/handler.js";
import apply_async from "./async.js";
@@ -81,7 +81,6 @@ export default function WorkerIndex(options = /** @type IndexOptions */{}) {
}
const worker = create(factory, is_node_js, options.worker);
//worker.worker = true;
return worker.then ? worker.then(function (worker) {
return init.call(_self, worker);
}) : init.call(this, worker);
@@ -96,36 +95,40 @@ register("clear");
register("export");
register("import");
apply_async(WorkerIndex.prototype);
function register(key) {
WorkerIndex.prototype[key] = WorkerIndex.prototype[key + "Async"] = async function () {
WorkerIndex.prototype[key] = function () {
const self = this,
args = [].slice.call(arguments),
arg = args[args.length - 1];
let callback;
if (is_function(arg)) {
if ("function" == typeof arg) {
callback = arg;
args.splice(args.length - 1, 1);
args.pop();
}
const promise = new Promise(function (resolve) {
//setTimeout(function(){
if ("export" === key && "function" == typeof args[0]) {
// remove function handler
args[0] = null;
}
self.resolver[++pid] = resolve;
self.worker.postMessage({
task: key,
id: pid,
args: args
});
//});
});
if (callback) {
promise.then(callback);
return this;
} else {
return promise;
}
};
@@ -134,8 +137,7 @@ function register(key) {
function create(factory, is_node_js, worker_path) {
let worker = is_node_js ?
// This eval will be removed when compiling, it isn't there in final build
// This eval will be removed when compiling
"undefined" != typeof module ? (0, eval)('new (require("worker_threads")["Worker"])(__dirname + "/node/node.js")')
//: (0,eval)('new ((await import("worker_threads"))["Worker"])(import.meta.dirname + "/worker/node.mjs")')
//: (0,eval)('new ((await import("worker_threads"))["Worker"])((1,eval)(\"import.meta.dirname\") + "/node/node.mjs")')
@@ -143,7 +145,8 @@ function create(factory, is_node_js, worker_path) {
//: import("worker_threads").then(function(worker){ return new worker["Worker"](import.meta.dirname + "/worker/node.mjs"); })
//eval('new (require("worker_threads")["Worker"])(__dirname + "/node/node.js")')
: factory ? new window.Worker(URL.createObjectURL(new Blob(["onmessage=" + handler.toString()], { type: "text/javascript" }))) : new window.Worker(is_string(worker_path) ? worker_path : import.meta.url.replace("/worker.js", "/worker/worker.js").replace("flexsearch.bundle.module.min.js", "module/worker/worker.js") /*"worker/worker.js"*/, { type: "module" });
: factory ? new window.Worker(URL.createObjectURL(new Blob(["onmessage=" + handler.toString()], { type: "text/javascript" }))) : new window.Worker("string" == typeof worker_path ? worker_path : import.meta.url.replace("/worker.js", "/worker/worker.js").replace("flexsearch.bundle.module.min.js", "module/worker/worker.js") /*"worker/worker.js"*/
, { type: "module" });
return worker;
}

View File

@@ -54,18 +54,25 @@ export default (async function (data) {
if (!options.export || "function" != typeof options.export) {
throw new Error("Either no extern configuration provided for the Worker-Index or no method was defined on the config property \"export\".");
}
args = [options.export];
// skip non-field indexes
if (!args[1]) args = null;else {
args[0] = options.export;
args[2] = 0;
args[3] = 1; // skip reg
}
}
if ("import" === task) {
if (!options.import || "function" != typeof options.import) {
throw new Error("Either no extern configuration provided for the Worker-Index or no method was defined on the config property \"import\".");
}
await options.import.call(index, index);
if (args[0]) {
const data = await options.import.call(index, args[0]);
index.import(args[0], data);
}
} else {
message = index[task].apply(index, args);
if (message.then) {
message = args && index[task].apply(index, args);
if (message && message.then) {
message = await message;
}
}

View File

@@ -1,3 +1,7 @@
/*
* Node.js Worker (CommonJS)
* This file is a standalone file and isn't being a part of the build/bundle
*/
const { parentPort } = require("worker_threads"),
{ Index } = require("flexsearch");
//const { join } = require("path");
@@ -41,16 +45,24 @@ parentPort.on("message", async function (data) {
if (!options.export || "function" != typeof options.export) {
throw new Error("Either no extern configuration provided for the Worker-Index or no method was defined on the config property \"export\".");
}
args = [options.export];
// skip non-field indexes
if (!args[1]) args = null;else {
args[0] = options.export;
args[2] = 0;
args[3] = 1; // skip reg
}
}
if ("import" === task) {
if (!options.import || "function" != typeof options.import) {
throw new Error("Either no extern configuration provided for the Worker-Index or no method was defined on the config property \"import\".");
}
await options.import.call(index, index);
if (args[0]) {
const data = await options.import.call(index, args[0]);
index.import(args[0], data);
}
} else {
message = index[task].apply(index, args);
if (message.then) {
message = args && index[task].apply(index, args);
if (message && message.then) {
message = await message;
}
}

View File

@@ -1 +1 @@
import{create_object,is_array,is_object,is_string,parse_simple}from"../common.js";import{KeystoreArray}from"../keystore.js";import Document from"../document.js";Document.prototype.add=function(a,b,c){if(is_object(a)&&(b=a,a=parse_simple(b,this.key)),b&&(a||0===a)){if(!c&&this.reg.has(a))return this.update(a,b);for(let d,e=0;e<this.field.length;e++){d=this.tree[e];const f=this.index.get(this.field[e]);if("function"==typeof d){const c=d(b);c&&f.add(a,c,!1,!0)}else{const e=d._filter;if(e&&!e(b))continue;d.constructor===String?d=[""+d]:is_string(d)&&(d=[d]),add_index(b,d,this.marker,0,f,a,d[0],c)}}if(this.tag)for(let d=0;d<this.tagtree.length;d++){let e,f=this.tagtree[d],g=this.tagfield[d],h=this.tag.get(g),j=create_object();if("function"!=typeof f){const a=f._filter;if(a&&!a(b))continue;f.constructor===String&&(f=""+f),e=parse_simple(b,f)}else if(e=f(b),!e)continue;if(!h||!e){continue}is_string(e)&&(e=[e]);for(let b,d,f=0;f<e.length;f++)if(b=e[f],!j[b]){j[b]=1;let e;if(e=h.get(b),e?d=e:h.set(b,d=[]),!c||!d.includes(a)){if(2147483647===d.length){const a=new KeystoreArray(d);if(this.fastupdate)for(let b of this.reg.values())b.includes(d)&&(b[b.indexOf(d)]=a);h.set(b,d=a)}if(d.push(a),this.fastupdate){const b=this.reg.get(a);b?b.push(d):this.reg.set(a,[d])}}}}if(this.store&&(!c||!this.store.has(a))){let c;if(this.storetree){c=create_object();for(let a,d=0;d<this.storetree.length;d++){a=this.storetree[d];const e=a._filter;if(e&&!e(b))continue;let f;if("function"==typeof a){if(f=a(b),!f)continue;a=[a._field]}else if(is_string(a)||a.constructor===String){c[a]=b[a];continue}store_value(b,c,a,0,a[0],f)}}this.store.set(a,c||b)}}return this};function store_value(a,b,c,d,e,f){if(a=a[e],d===c.length-1)b[e]=f||a;else if(a)if(is_array(a)){b=b[e]=Array(a.length);for(let e=0;e<a.length;e++)store_value(a,b,c,d,e)}else b=b[e]||(b[e]=create_object()),e=c[++d],store_value(a,b,c,d,e)}function add_index(a,b,c,d,e,f,g,h){if(!(a=a[g]))e.db&&e.remove(f);else if(d===b.length-1){if(is_array(a)){if(c[d]){for(let b=0;b<a.length;b++)e.add(f,a[b],!0,!0);return}a=a.join(" ")}e.add(f,a,h,!0)}else if(is_array(a))for(let g=0;g<a.length;g++)add_index(a,b,c,d,e,f,g,h);else g=b[++d],add_index(a,b,c,d,e,f,g,h)}
import{create_object,is_array,is_object,is_string,parse_simple}from"../common.js";import{KeystoreArray}from"../keystore.js";import Document from"../document.js";Document.prototype.add=function(a,b,c){if(is_object(a)&&(b=a,a=parse_simple(b,this.key)),b&&(a||0===a)){if(!c&&this.reg.has(a))return this.update(a,b);for(let d,e=0;e<this.field.length;e++){d=this.tree[e];const f=this.index.get(this.field[e]);if("function"==typeof d){const c=d(b);c&&f.add(a,c,!1,!0)}else{const e=d._filter;if(e&&!e(b))continue;d.constructor===String?d=[""+d]:is_string(d)&&(d=[d]),add_index(b,d,this.marker,0,f,a,d[0],c)}}if(this.tag)for(let d=0;d<this.tagtree.length;d++){let e,f=this.tagtree[d],g=this.tagfield[d],h=this.tag.get(g),j=create_object();if("function"!=typeof f){const a=f._filter;if(a&&!a(b))continue;f.constructor===String&&(f=""+f),e=parse_simple(b,f)}else if(e=f(b),!e)continue;if(!h||!e){continue}is_string(e)&&(e=[e]);for(let b,d,f=0;f<e.length;f++)if(b=e[f],!j[b]){j[b]=1;let e;if(e=h.get(b),e?d=e:h.set(b,d=[]),!c||!d.includes(a)){if(2147483647===d.length){const a=new KeystoreArray(d);if(this.fastupdate)for(let b of this.reg.values())b.includes(d)&&(b[b.indexOf(d)]=a);h.set(b,d=a)}if(d.push(a),this.fastupdate){const b=this.reg.get(a);b?b.push(d):this.reg.set(a,[d])}}}}if(this.store&&(!c||!this.store.has(a))){let c;if(this.storetree){c=create_object();for(let a,d=0;d<this.storetree.length;d++){a=this.storetree[d];const e=a._filter;if(e&&!e(b))continue;let f;if("function"==typeof a){if(f=a(b),!f)continue;a=[a._field]}else if(is_string(a)||a.constructor===String){c[a]=b[a];continue}store_value(b,c,a,0,a[0],f)}}this.store.set(a,c||b)}this.worker&&(this.fastupdate||this.reg.add(a))}return this};function store_value(a,b,c,d,e,f){if(a=a[e],d===c.length-1)b[e]=f||a;else if(a)if(is_array(a)){b=b[e]=Array(a.length);for(let e=0;e<a.length;e++)store_value(a,b,c,d,e)}else b=b[e]||(b[e]=create_object()),e=c[++d],store_value(a,b,c,d,e)}function add_index(a,b,c,d,e,f,g,h){if(!(a=a[g]))e.db&&e.remove(f);else if(d===b.length-1){if(is_array(a)){if(c[d]){for(let b=0;b<a.length;b++)e.add(f,a[b],!0,!0);return}a=a.join(" ")}e.add(f,a,h,!0)}else if(is_array(a))for(let g=0;g<a.length;g++)add_index(a,b,c,d,e,f,g,h);else g=b[++d],add_index(a,b,c,d,e,f,g,h)}

View File

@@ -1 +1 @@
import Index from"./index.js";import Document from"./document.js";import{is_string}from"./common.js";import{IntermediateSearchResults}from"./type.js";const chunk_size_reg=250000,chunk_size_map=5000,chunk_size_ctx=1000;function map_to_json(a,b=0){let c=[],d=[];b&&(b=0|chunk_size_map*(chunk_size_reg/b));for(const e of a.entries())d.push(e),d.length===b&&(c.push(d),d=[]);return d.length&&c.push(d),c}function json_to_map(a,b){b||(b=new Map);for(let c,d=0;d<a.length;d++)c=a[d],b.set(c[0],c[1]);return b}function ctx_to_json(a,b=0){let c=[],d=[];b&&(b=0|chunk_size_ctx*(chunk_size_reg/b));for(const e of a.entries()){const a=e[0],f=e[1];d.push([a,map_to_json(f)[0]]),d.length===b&&(c.push(d),d=[])}return d.length&&c.push(d),c}function json_to_ctx(a,b){b||(b=new Map);for(let c,d,e=0;e<a.length;e++)c=a[e],d=b.get(c[0]),b.set(c[0],json_to_map(c[1],d));return b}function reg_to_json(a){let b=[],c=[];for(const d of a.keys())c.push(d),c.length===chunk_size_reg&&(b.push(c),c=[]);return c.length&&b.push(c),b}function json_to_reg(a,b){b||(b=new Set);for(let c=0;c<a.length;c++)b.add(a[c]);return b}function save(a,b,c,d,e,f,g=0){const h=d&&d.constructor===Array,i=h?d.shift():d;if(!i)return this.export(a,b,e,f+1);const j=a((b?b+".":"")+(g+1)+"."+c,JSON.stringify(i));if(j&&j.then){const i=this;return j.then(function(){return save.call(i,a,b,c,h?d:null,e,f,g+1)})}return save.call(this,a,b,c,h?d:null,e,f,g+1)}export function exportIndex(a,b,c=0,d=0){let e,f;switch(d){case 0:e="reg",f=reg_to_json(this.reg);break;case 1:e="cfg",f=null;break;case 2:e="map",f=map_to_json(this.map,this.reg.size);break;case 3:e="ctx",f=ctx_to_json(this.ctx,this.reg.size);break;default:return;}return save.call(this,a,b,e,f,c,d)}export function importIndex(a,b){if(b){"string"==typeof b&&(b=JSON.parse(b));const c=a.split(".");switch("json"===c[c.length-1]&&c.pop(),a=1<c.length?c[1]:c[0],a){case"cfg":break;case"reg":this.fastupdate=!1,this.reg=json_to_reg(b,this.reg);break;case"map":this.map=json_to_map(b,this.map);break;case"ctx":this.ctx=json_to_ctx(b,this.ctx);}}}export function exportDocument(a,b,c=0,d=0){if(c<this.field.length){const b=this.field[c],e=this.index.get(b),f=e.export(a,b,c,d=1);if(f&&f.then){const d=this;return f.then(function(){return d.export(a,b,c+1)})}return this.export(a,b,c+1)}else{let e,f;switch(d){case 0:e="reg",f=reg_to_json(this.reg),b=null;break;case 1:e="tag",f=ctx_to_json(this.tag,this.reg.size),b=null;break;case 2:e="doc",f=map_to_json(this.store),b=null;break;case 3:e="cfg",f=null,b=null;break;default:return;}return save.call(this,a,b,e,f,c,d)}}export function importDocument(a,b){if(b){"string"==typeof b&&(b=JSON.parse(b));const c=a.split(".");"json"===c[c.length-1]&&c.pop();const d=2<c.length?c[0]:"";if(a=2<c.length?c[2]:c[1],!d)switch(a){case"reg":this.fastupdate=!1,this.reg=json_to_reg(b,this.reg);for(let a,b=0;b<this.field.length;b++)a=this.index.get(this.field[b]),a.fastupdate=!1,a.reg=this.reg;break;case"tag":this.tag=json_to_ctx(b,this.tag);break;case"doc":this.store=json_to_map(b,this.store);break;case"cfg":}else return this.index.get(d).import(a,b)}}export function serialize(a=!0){if(!this.reg.size)return"";let b="",c="";for(const d of this.reg.keys())c||(c=typeof d),b+=(b?",":"")+("string"==c?"\""+d+"\"":d);b="index.reg=new Set(["+b+"]);";let d="";for(const b of this.map.entries()){const a=b[0],e=b[1];let f="";for(let a,b=0;b<e.length;b++){a=e[b]||[""];let d="";for(let b=0;b<a.length;b++)d+=(d?",":"")+("string"==c?"\""+a[b]+"\"":a[b]);d="["+d+"]",f+=(f?",":"")+d}f="[\""+a+"\",["+f+"]]",d+=(d?",":"")+f}d="index.map=new Map(["+d+"]);";let e="";for(const b of this.ctx.entries()){const a=b[0],d=b[1];for(const b of d.entries()){const d=b[0],f=b[1];let g="";for(let a,b=0;b<f.length;b++){a=f[b]||[""];let d="";for(let b=0;b<a.length;b++)d+=(d?",":"")+("string"==c?"\""+a[b]+"\"":a[b]);d="["+d+"]",g+=(g?",":"")+d}g="new Map([[\""+d+"\",["+g+"]]])",g="[\""+a+"\","+g+"]",e+=(e?",":"")+g}}return e="index.ctx=new Map(["+e+"]);",a?"function inject(index){"+b+d+e+"}":b+d+e}
import Index from"./index.js";import Document from"./document.js";import{is_string}from"./common.js";import{IntermediateSearchResults}from"./type.js";const chunk_size_reg=250000,chunk_size_map=5000,chunk_size_ctx=1000;function map_to_json(a,b=0){let c=[],d=[];b&&(b=0|chunk_size_map*(chunk_size_reg/b));for(const e of a.entries())d.push(e),d.length===b&&(c.push(d),d=[]);return d.length&&c.push(d),c}function json_to_map(a,b){b||(b=new Map);for(let c,d=0;d<a.length;d++)c=a[d],b.set(c[0],c[1]);return b}function ctx_to_json(a,b=0){let c=[],d=[];b&&(b=0|chunk_size_ctx*(chunk_size_reg/b));for(const e of a.entries()){const a=e[0],f=e[1];d.push([a,map_to_json(f)[0]]),d.length===b&&(c.push(d),d=[])}return d.length&&c.push(d),c}function json_to_ctx(a,b){b||(b=new Map);for(let c,d,e=0;e<a.length;e++)c=a[e],d=b.get(c[0]),b.set(c[0],json_to_map(c[1],d));return b}function reg_to_json(a){let b=[],c=[];for(const d of a.keys())c.push(d),c.length===chunk_size_reg&&(b.push(c),c=[]);return c.length&&b.push(c),b}function json_to_reg(a,b){b||(b=new Set);for(let c=0;c<a.length;c++)b.add(a[c]);return b}function save(a,b,c,d,e,f,g=0){const h=d&&d.constructor===Array,i=h?d.shift():d;if(!i)return this.export(a,b,e,f+1);const j=a((b?b+".":"")+(g+1)+"."+c,JSON.stringify(i));if(j&&j.then){const i=this;return j.then(function(){return save.call(i,a,b,c,h?d:null,e,f,g+1)})}return save.call(this,a,b,c,h?d:null,e,f,g+1)}export function exportIndex(a,b,c=0,d=0){let e,f;switch(d){case 0:e="reg",f=reg_to_json(this.reg);break;case 1:e="cfg",f=null;break;case 2:e="map",f=map_to_json(this.map,this.reg.size);break;case 3:e="ctx",f=ctx_to_json(this.ctx,this.reg.size);break;default:return;}return save.call(this,a,b,e,f,c,d)}export function importIndex(a,b){if(b){"string"==typeof b&&(b=JSON.parse(b));const c=a.split(".");switch("json"===c[c.length-1]&&c.pop(),3===c.length&&c.shift(),a=1<c.length?c[1]:c[0],a){case"cfg":break;case"reg":this.fastupdate=!1,this.reg=json_to_reg(b,this.reg);break;case"map":this.map=json_to_map(b,this.map);break;case"ctx":this.ctx=json_to_ctx(b,this.ctx);}}}export function exportDocument(a,b,c=0,d=0){if(c<this.field.length){const b=this.field[c],e=this.index.get(b),f=e.export(a,b,c,d=1);if(f&&f.then){const d=this;return f.then(function(){return d.export(a,b,c+1)})}return this.export(a,b,c+1)}else{let e,f;switch(d){case 0:e="reg",f=reg_to_json(this.reg),b=null;break;case 1:e="tag",f=ctx_to_json(this.tag,this.reg.size),b=null;break;case 2:e="doc",f=map_to_json(this.store),b=null;break;case 3:e="cfg",f=null,b=null;break;default:return;}return save.call(this,a,b,e,f,c,d)}}export function importDocument(a,b){const c=a.split(".");"json"===c[c.length-1]&&c.pop();const d=2<c.length?c[0]:"",e=2<c.length?c[2]:c[1];if(this.worker&&d)return this.index.get(d).import(a);if(b)if("string"==typeof b&&(b=JSON.parse(b)),!d)switch(e){case"reg":this.fastupdate=!1,this.reg=json_to_reg(b,this.reg);for(let a,b=0;b<this.field.length;b++)a=this.index.get(this.field[b]),a.fastupdate=!1,a.reg=this.reg;if(this.worker){const b=[],c=this;for(const c of this.index.values())b.push(c.import(a));return Promise.all(b)}break;case"tag":this.tag=json_to_ctx(b,this.tag);break;case"doc":this.store=json_to_map(b,this.store);break;case"cfg":}else return this.index.get(d).import(e,b)}export function serialize(a=!0){if(!this.reg.size)return"";let b="",c="";for(const d of this.reg.keys())c||(c=typeof d),b+=(b?",":"")+("string"==c?"\""+d+"\"":d);b="index.reg=new Set(["+b+"]);";let d="";for(const b of this.map.entries()){const a=b[0],e=b[1];let f="";for(let a,b=0;b<e.length;b++){a=e[b]||[""];let d="";for(let b=0;b<a.length;b++)d+=(d?",":"")+("string"==c?"\""+a[b]+"\"":a[b]);d="["+d+"]",f+=(f?",":"")+d}f="[\""+a+"\",["+f+"]]",d+=(d?",":"")+f}d="index.map=new Map(["+d+"]);";let e="";for(const b of this.ctx.entries()){const a=b[0],d=b[1];for(const b of d.entries()){const d=b[0],f=b[1];let g="";for(let a,b=0;b<f.length;b++){a=f[b]||[""];let d="";for(let b=0;b<a.length;b++)d+=(d?",":"")+("string"==c?"\""+a[b]+"\"":a[b]);d="["+d+"]",g+=(g?",":"")+d}g="new Map([[\""+d+"\",["+g+"]]])",g="[\""+a+"\","+g+"]",e+=(e?",":"")+g}}return e="index.ctx=new Map(["+e+"]);",a?"function inject(index){"+b+d+e+"}":b+d+e}

View File

@@ -1 +1 @@
import{IndexOptions}from"./type.js";import{create_object,is_function,is_object,is_string}from"./common.js";import handler from"./worker/handler.js";import apply_async from"./async.js";let pid=0;export default function WorkerIndex(a={}){function b(b){function f(a){a=a.data||a;const b=a.id,c=b&&e.resolver[b];c&&(c(a.msg),delete e.resolver[b])}if(this.worker=b,this.resolver=create_object(),!!this.worker)return(d?this.worker.on("message",f):this.worker.onmessage=f,a.config)?new Promise(function(b){e.resolver[++pid]=function(){b(e)},e.worker.postMessage({id:pid,task:"init",factory:c,options:a})}):(this.worker.postMessage({task:"init",factory:c,options:a}),this)}if(!this||this.constructor!==WorkerIndex)return new WorkerIndex(a);let c="undefined"==typeof self?"undefined"==typeof window?null:window._factory:self._factory;c&&(c=c.toString());const d="undefined"==typeof window,e=this,f=create(c,d,a.worker);return f.then?f.then(function(a){return b.call(e,a)}):b.call(this,f)}register("add"),register("append"),register("search"),register("update"),register("remove"),register("clear"),register("export"),register("import"),!0;function register(a){WorkerIndex.prototype[a]=WorkerIndex.prototype[a+"Async"]=async function(){const b=this,c=[].slice.call(arguments),d=c[c.length-1];let e;is_function(d)&&(e=d,c.splice(c.length-1,1));const f=new Promise(function(d){b.resolver[++pid]=d,b.worker.postMessage({task:a,id:pid,args:c})});return e?(f.then(e),this):f}}function create(a,b,c){let d;return d=b?"undefined"==typeof module?(0,eval)("import(\"worker_threads\").then(function(worker){ return new worker[\"Worker\"]((1,eval)(\"import.meta.dirname\") + \"/node/node.mjs\"); })"):(0,eval)("new (require(\"worker_threads\")[\"Worker\"])(__dirname + \"/node/node.js\")"):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+handler.toString()],{type:"text/javascript"}))):new window.Worker(is_string(c)?c:(1,eval)("import.meta.url").replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js","module/worker/worker.js"),{type:"module"}),d}
import{IndexOptions}from"./type.js";import{create_object}from"./common.js";import handler from"./worker/handler.js";import apply_async from"./async.js";let pid=0;export default function WorkerIndex(a={}){function b(b){function f(a){a=a.data||a;const b=a.id,c=b&&e.resolver[b];c&&(c(a.msg),delete e.resolver[b])}if(this.worker=b,this.resolver=create_object(),!!this.worker)return(d?this.worker.on("message",f):this.worker.onmessage=f,a.config)?new Promise(function(b){e.resolver[++pid]=function(){b(e)},e.worker.postMessage({id:pid,task:"init",factory:c,options:a})}):(this.worker.postMessage({task:"init",factory:c,options:a}),this)}if(!this||this.constructor!==WorkerIndex)return new WorkerIndex(a);let c="undefined"==typeof self?"undefined"==typeof window?null:window._factory:self._factory;c&&(c=c.toString());const d="undefined"==typeof window,e=this,f=create(c,d,a.worker);return f.then?f.then(function(a){return b.call(e,a)}):b.call(this,f)}register("add"),register("append"),register("search"),register("update"),register("remove"),register("clear"),register("export"),register("import"),apply_async(WorkerIndex.prototype);function register(a){WorkerIndex.prototype[a]=function(){const b=this,c=[].slice.call(arguments),d=c[c.length-1];let e;"function"==typeof d&&(e=d,c.pop());const f=new Promise(function(d){"export"===a&&"function"==typeof c[0]&&(c[0]=null),b.resolver[++pid]=d,b.worker.postMessage({task:a,id:pid,args:c})});return e?(f.then(e),this):f}}function create(a,b,c){let d;return d=b?"undefined"==typeof module?(0,eval)("import(\"worker_threads\").then(function(worker){ return new worker[\"Worker\"]((1,eval)(\"import.meta.dirname\") + \"/node/node.mjs\"); })"):(0,eval)("new (require(\"worker_threads\")[\"Worker\"])(__dirname + \"/node/node.js\")"):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+handler.toString()],{type:"text/javascript"}))):new window.Worker("string"==typeof c?c:(1,eval)("import.meta.url").replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js","module/worker/worker.js"),{type:"module"}),d}

View File

@@ -1 +1 @@
import Index from"../index.js";import{IndexOptions}from"../type.js";let index,options;export default(async function(a){a=a.data;const b=a.task,c=a.id;let d=a.args;switch(b){case"init":options=a.options||{};let e=options.config;e&&(options=options);const f=a.factory;f?(Function("return "+f)()(self),index=new self.FlexSearch.Index(options),delete self.FlexSearch):index=new Index(options),postMessage({id:c});break;default:let g;"export"===b&&(d=[options.export]);"import"===b?await options.import.call(index,index):(g=index[b].apply(index,d),g.then&&(g=await g));postMessage("search"===b?{id:c,msg:g}:{id:c});}});
import Index from"../index.js";import{IndexOptions}from"../type.js";let index,options;export default(async function(a){a=a.data;const b=a.task,c=a.id;let d=a.args;switch(b){case"init":options=a.options||{};let e=options.config;e&&(options=options);const f=a.factory;f?(Function("return "+f)()(self),index=new self.FlexSearch.Index(options),delete self.FlexSearch):index=new Index(options),postMessage({id:c});break;default:let g;if("export"===b&&(d[1]?(d[0]=options.export,d[2]=0,d[3]=1):d=null),"import"!==b)g=d&&index[b].apply(index,d),g&&g.then&&(g=await g);else if(d[0]){const a=await options.import.call(index,d[0]);index.import(d[0],a)}postMessage("search"===b?{id:c,msg:g}:{id:c});}});

View File

@@ -1 +1 @@
const{parentPort}=require("worker_threads"),{Index}=require("flexsearch");let index,options;parentPort.on("message",async function(a){const b=a.task,c=a.id;let d=a.args;switch(b){case"init":options=a.options||{};let e=options.config;e&&(options=Object.assign({},options,require(e)),delete options.worker),index=new Index(options),parentPort.postMessage({id:c});break;default:let f;if("export"===b){if(!options.export||"function"!=typeof options.export)throw new Error("Either no extern configuration provided for the Worker-Index or no method was defined on the config property \"export\".");d=[options.export]}if("import"===b){if(!options.import||"function"!=typeof options.import)throw new Error("Either no extern configuration provided for the Worker-Index or no method was defined on the config property \"import\".");await options.import.call(index,index)}else f=index[b].apply(index,d),f.then&&(f=await f);parentPort.postMessage("search"===b?{id:c,msg:f}:{id:c});}});
const{parentPort}=require("worker_threads"),{Index}=require("flexsearch");let index,options;parentPort.on("message",async function(a){const b=a.task,c=a.id;let d=a.args;switch(b){case"init":options=a.options||{};let e=options.config;e&&(options=Object.assign({},options,require(e)),delete options.worker),index=new Index(options),parentPort.postMessage({id:c});break;default:let f;if("export"===b){if(!options.export||"function"!=typeof options.export)throw new Error("Either no extern configuration provided for the Worker-Index or no method was defined on the config property \"export\".");d[1]?(d[0]=options.export,d[2]=0,d[3]=1):d=null}if("import"===b){if(!options.import||"function"!=typeof options.import)throw new Error("Either no extern configuration provided for the Worker-Index or no method was defined on the config property \"import\".");if(d[0]){const a=await options.import.call(index,d[0]);index.import(d[0],a)}}else f=d&&index[b].apply(index,d),f&&f.then&&(f=await f);parentPort.postMessage("search"===b?{id:c,msg:f}:{id:c});}});

View File

@@ -156,6 +156,10 @@ Document.prototype.add = function (id, content, _append) {
this.store.set(id, payload || content);
}
if (this.worker) {
this.fastupdate || this.reg.add(id);
}
}
return this;

View File

@@ -87,9 +87,7 @@ Encoder.prototype.assign = function (options) {
* pre-processing string input
* @type {Function|boolean}
*/
this.normalize = /** @type {Function|boolean} */merge_option(options.normalize, /* tag? */ /* stringify */ /* stringify */ /* single param */ /* skip update: */ /* append: */ /* skip update: */
/* skip_update: */
/* skip deletion */!0 /*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/, this.normalize);
this.normalize = /** @type {Function|boolean} */merge_option(options.normalize, /* tag? */ /* stringify */ /* stringify */ /* single param */ /* skip update: */ /* append: */ /* skip update: */ /* skip_update: */ /* skip deletion */!0 /*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/, this.normalize);
// {
// letter: true,
@@ -197,7 +195,8 @@ Encoder.prototype.assign = function (options) {
// auto-balanced cache
this.cache = tmp = merge_option(options.cache, !0, this.cache);
if (tmp) {
this.timer = null;this.cache_size = "number" == typeof tmp ? tmp : 2e5;
this.timer = null;
this.cache_size = "number" == typeof tmp ? tmp : 2e5;
this.cache_enc = new Map();
this.cache_term = new Map();
this.cache_enc_length = 128;

View File

@@ -43,8 +43,7 @@ export default function Index(options, _register) {
/** @type Encoder */
this.encoder = encoder.encode ? encoder : "object" == typeof encoder ? new Encoder( /** @type {EncoderOptions} */encoder) : { encode: encoder };
this.compress = options.compress || options.compression ||
/* suggest */ /* append: */ /* enrich */!1;
this.compress = options.compress || options.compression || /* suggest */ /* append: */ /* enrich */!1;
this.resolution = options.resolution || 9;

View File

@@ -1,3 +1,4 @@
import Index from "./index.js";
import Document from "./document.js";
import { is_string } from "./common.js";
@@ -88,7 +89,7 @@ function json_to_ctx(json, ctx) {
}
/**
* @param {Set<string|number>} reg
* @param {Set<string|number>|Map<Array<string|number>>} reg
* @return {Array<Array<string|number>>}
*/
function reg_to_json(reg) {
@@ -217,6 +218,9 @@ export function importIndex(key, data) {
if ("json" === split[split.length - 1]) {
split.pop();
}
if (3 === split.length) {
split.shift();
}
key = 1 < split.length ? split[1] : split[0];
switch (key) {
@@ -319,6 +323,19 @@ export function exportDocument(callback, _field, _index_doc = 0, _index_obj = 0)
export function importDocument(key, data) {
const split = key.split(".");
if ("json" === split[split.length - 1]) {
split.pop();
}
const field = 2 < split.length ? split[0] : "",
ref = 2 < split.length ? split[2] : split[1];
// trigger the import for worker field indexes
if (this.worker && field) {
return this.index.get(field).import(key);
}
if (!data) {
return;
}
@@ -326,16 +343,9 @@ export function importDocument(key, data) {
data = /** @type {Array<Object>} */JSON.parse( /** @type {string} */data);
}
const split = key.split(".");
if ("json" === split[split.length - 1]) {
split.pop();
}
const field = 2 < split.length ? split[0] : "";
key = 2 < split.length ? split[2] : split[1];
if (!field) {
switch (key) {
switch (ref) {
case "reg":
@@ -349,6 +359,22 @@ export function importDocument(key, data) {
idx.reg = this.reg;
}
// trigger the import for worker field indexes
if (this.worker) {
const promises = [],
self = this;
for (const index of this.index.values()) {
// const ref = item[0];
// const index = item[1];
promises.push(index.import(key));
//this.index.get(field).import(key);
}
return Promise.all(promises);
}
break;
case "tag":
@@ -368,7 +394,7 @@ export function importDocument(key, data) {
}
} else {
return this.index.get(field).import(key, data);
return this.index.get(field).import(ref, data);
}
}

25
dist/module/worker.js vendored
View File

@@ -1,6 +1,6 @@
import { IndexOptions } from "./type.js";
import { create_object, is_function, is_object, is_string } from "./common.js";
import { create_object } from "./common.js";
import handler from "./worker/handler.js";
import apply_async from "./async.js";
@@ -81,7 +81,6 @@ export default function WorkerIndex(options = /** @type IndexOptions */{}) {
}
const worker = create(factory, is_node_js, options.worker);
//worker.worker = true;
return worker.then ? worker.then(function (worker) {
return init.call(_self, worker);
}) : init.call(this, worker);
@@ -96,36 +95,40 @@ register("clear");
register("export");
register("import");
apply_async(WorkerIndex.prototype);
function register(key) {
WorkerIndex.prototype[key] = WorkerIndex.prototype[key + "Async"] = async function () {
WorkerIndex.prototype[key] = function () {
const self = this,
args = [].slice.call(arguments),
arg = args[args.length - 1];
let callback;
if (is_function(arg)) {
if ("function" == typeof arg) {
callback = arg;
args.splice(args.length - 1, 1);
args.pop();
}
const promise = new Promise(function (resolve) {
//setTimeout(function(){
if ("export" === key && "function" == typeof args[0]) {
// remove function handler
args[0] = null;
}
self.resolver[++pid] = resolve;
self.worker.postMessage({
task: key,
id: pid,
args: args
});
//});
});
if (callback) {
promise.then(callback);
return this;
} else {
return promise;
}
};
@@ -134,8 +137,7 @@ function register(key) {
function create(factory, is_node_js, worker_path) {
let worker = is_node_js ?
// This eval will be removed when compiling, it isn't there in final build
// This eval will be removed when compiling
"undefined" != typeof module ? (0, eval)('new (require("worker_threads")["Worker"])(__dirname + "/node/node.js")')
//: (0,eval)('new ((await import("worker_threads"))["Worker"])(import.meta.dirname + "/worker/node.mjs")')
//: (0,eval)('new ((await import("worker_threads"))["Worker"])((1,eval)(\"import.meta.dirname\") + "/node/node.mjs")')
@@ -143,7 +145,8 @@ function create(factory, is_node_js, worker_path) {
//: import("worker_threads").then(function(worker){ return new worker["Worker"](import.meta.dirname + "/worker/node.mjs"); })
//eval('new (require("worker_threads")["Worker"])(__dirname + "/node/node.js")')
: factory ? new window.Worker(URL.createObjectURL(new Blob(["onmessage=" + handler.toString()], { type: "text/javascript" }))) : new window.Worker(is_string(worker_path) ? worker_path : import.meta.url.replace("/worker.js", "/worker/worker.js").replace("flexsearch.bundle.module.min.js", "module/worker/worker.js") /*"worker/worker.js"*/, { type: "module" });
: factory ? new window.Worker(URL.createObjectURL(new Blob(["onmessage=" + handler.toString()], { type: "text/javascript" }))) : new window.Worker("string" == typeof worker_path ? worker_path : import.meta.url.replace("/worker.js", "/worker/worker.js").replace("flexsearch.bundle.module.min.js", "module/worker/worker.js") /*"worker/worker.js"*/
, { type: "module" });
return worker;
}

View File

@@ -51,13 +51,21 @@ export default (async function (data) {
let message;
if ("export" === task) {
args = [options.export];
// skip non-field indexes
if (!args[1]) args = null;else {
args[0] = options.export;
args[2] = 0;
args[3] = 1; // skip reg
}
}
if ("import" === task) {
await options.import.call(index, index);
if (args[0]) {
const data = await options.import.call(index, args[0]);
index.import(args[0], data);
}
} else {
message = index[task].apply(index, args);
if (message.then) {
message = args && index[task].apply(index, args);
if (message && message.then) {
message = await message;
}
}

View File

@@ -1,3 +1,7 @@
/*
* Node.js Worker (CommonJS)
* This file is a standalone file and isn't being a part of the build/bundle
*/
const { parentPort } = require("worker_threads"),
{ Index } = require("flexsearch");
//const { join } = require("path");
@@ -41,16 +45,24 @@ parentPort.on("message", async function (data) {
if (!options.export || "function" != typeof options.export) {
throw new Error("Either no extern configuration provided for the Worker-Index or no method was defined on the config property \"export\".");
}
args = [options.export];
// skip non-field indexes
if (!args[1]) args = null;else {
args[0] = options.export;
args[2] = 0;
args[3] = 1; // skip reg
}
}
if ("import" === task) {
if (!options.import || "function" != typeof options.import) {
throw new Error("Either no extern configuration provided for the Worker-Index or no method was defined on the config property \"import\".");
}
await options.import.call(index, index);
if (args[0]) {
const data = await options.import.call(index, args[0]);
index.import(args[0], data);
}
} else {
message = index[task].apply(index, args);
if (message.then) {
message = args && index[task].apply(index, args);
if (message && message.then) {
message = await message;
}
}

21
dist/node/node.js vendored
View File

@@ -1,3 +1,7 @@
/*
* Node.js Worker (CommonJS)
* This file is a standalone file and isn't being a part of the build/bundle
*/
const { parentPort } = require("worker_threads");
//const { join } = require("path");
// Test Path
@@ -41,17 +45,26 @@ parentPort.on("message", async function(data){
if(!options.export || typeof options.export !== "function"){
throw new Error("Either no extern configuration provided for the Worker-Index or no method was defined on the config property \"export\".");
}
args = [options.export];
// skip non-field indexes
if(!args[1]) args = null;
else{
args[0] = options.export;
args[2] = 0;
args[3] = 1; // skip reg
}
}
if(task === "import"){
if(!options.import || typeof options.import !== "function"){
throw new Error("Either no extern configuration provided for the Worker-Index or no method was defined on the config property \"import\".");
}
await options.import.call(index, index);
if(args[0]){
const data = await options.import.call(index, args[0]);
index.import(args[0], data);
}
}
else{
message = index[task].apply(index, args);
if(message.then){
message = args && index[task].apply(index, args);
if(message && message.then){
message = await message;
}
}

21
dist/node/node.mjs vendored
View File

@@ -1,3 +1,7 @@
/*
* Node.js Worker (Standalone, ESM)
* This file is a standalone file and isn't being a part of the build/bundle
*/
import { parentPort } from "worker_threads";
import { join } from "path";
// Test Path
@@ -43,17 +47,26 @@ parentPort.on("message", async function(data){
if(!options.export || typeof options.export !== "function"){
throw new Error("Either no extern configuration provided for the Worker-Index or no method was defined on the config property \"export\".");
}
args = [options.export];
// skip non-field indexes
if(!args[1]) args = null;
else{
args[0] = options.export;
args[2] = 0;
args[3] = 1; // skip reg
}
}
if(task === "import"){
if(!options.import || typeof options.import !== "function"){
throw new Error("Either no extern configuration provided for the Worker-Index or no method was defined on the config property \"import\".");
}
await options.import.call(index, index);
if(args[0]){
const data = await options.import.call(index, args[0]);
index.import(args[0], data);
}
}
else{
message = index[task].apply(index, args);
if(message.then){
message = args && index[task].apply(index, args);
if(message && message.then){
message = await message;
}
}

View File

@@ -127,7 +127,169 @@ The used index configuration has 2 fields (using bidirectional context of `depth
A non-Worker Document index requires 181 seconds to index all contents.<br>
The Worker index just takes 32 seconds to index them all, by processing every field and tag in parallel. For such large content it is a quite impressive result.
### CSP-friendly Worker (Browser)
## Export / Import Worker Indexes (Node.js)
Worker will save/load their data dedicated and does not need the message channel for the data transfer.
### Basic Worker Index
> This feature follows the strategy of using [Extern Worker Configuration](#extern-worker-configuration) in combination with [Basic Export Import](../example/nodejs-commonjs/basic-export-import).
Example (CommonJS): [basic-worker-export-import](../example/nodejs-commonjs/basic-worker-export-import)<br>
Example (ESM): [basic-worker-export-import](../example/nodejs-esm/basic-worker-export-import)
Provide the index configuration and keep it, because it isn't stored. Provide a parameter `config` which is including the filepath to the extern configuration file:
```js
const dirname = import.meta.dirname;
const config = {
tokenize: "forward",
config: dirname + "/config.js"
};
```
> Any changes you made to the configuration will almost require a full re-index.
Provide the extern configuration file e.g. `/config.js` as a default export including the methods `export` and `import`:
```js
import { promises as fs } from "fs";
export default {
tokenize: "forward",
export: async function(key, data){
// like the usual export write files by key + data
await fs.writeFile("./export/" + key, data, "utf8");
},
import: async function(index){
// get the file contents of the export directory
let files = await fs.readdir("./export/");
files = await Promise.all(files);
// loop through the files and push their contents to the index
// by also passing the filename as the first parameter
for(let i = 0; i < files.length; i++){
const data = await fs.readFile("./export/" + files[i], "utf8");
index.import(files[i], data);
}
}
};
```
Create your index by assigning the configuration file from above:
```js
import { Worker as WorkerIndex } from "flexsearch/esm";
const index = await new WorkerIndex(config);
// add data to the index
// ...
```
Export the index:
```js
await index.export();
```
Import the index:
```js
// create the same type of index you have used by .export()
// along with the same configuration
const index = await new WorkerIndex(config);
await index.import();
```
### Document Worker Index
> This feature follows the strategy of using [Extern Worker Configuration](#extern-worker-configuration) in combination with [Document Export Import](../example/nodejs-esm/document-export-import).
Document Worker exports all their feature including:
- Multi-Tag Indexes
- Context-Search Indexes
- Document-Store
Example (CommonJS): [document-worker-export-import](../example/nodejs-commonjs/document-worker-export-import)<br>
Example (ESM): [document-worker-export-import](../example/nodejs-esm/document-worker-export-import)
Provide the index configuration and keep it, because it isn't stored. Provide a parameter `config` which is including the filepath to the extern configuration file:
```js
const dirname = import.meta.dirname;
const config = {
worker: true,
document: {
id: "tconst",
store: true,
index: [{
field: "primaryTitle",
config: dirname + "/config.primaryTitle.js"
},{
field: "originalTitle",
config: dirname + "/config.originalTitle.js"
}],
tag: [{
field: "startYear"
},{
field: "genres"
}]
}
};
```
> Any changes you made to the configuration will almost require a full re-index.
Provide the extern configuration file as a default export including the methods `export` and `import`:
```js
import { promises as fs } from "fs";
export default {
tokenize: "forward",
export: async function(key, data){
// like the usual export write files by key + data
await fs.writeFile("./export/" + key, data, "utf8");
},
import: async function(file){
// instead of looping you will get the filename as 2nd paramter
// just return the loaded contents as a string
return await fs.readFile("./export/" + file, "utf8");
}
};
```
Create your index by assigning the configuration file from above:
```js
import { Document } from "flexsearch/esm";
const document = await new Document(config);
// add data to the index
// ...
```
Export the index by providing a key-data handler:
```js
await document.export(async function(key, data){
await fs.writeFile("./export/" + key, data, "utf8");
});
```
Import the index:
```js
const files = await fs.readdir("./export/");
// create the same type of index you have used by .export()
// along with the same configuration
const document = await new Document(config);
await Promise.all(files.map(async file => {
const data = await fs.readFile("./export/" + file, "utf8");
// call import (async)
await document.import(file, data);
}));
```
## CSP-friendly Worker (Browser)
When just using worker by passing the option `worker: true`, the worker will be created by code generation under the hood. This might have issues when using strict CSP settings.

View File

@@ -24,7 +24,7 @@ const data = require(__dirname + "/data.json");
config: __dirname + "/config.primaryTitle.js"
},{
field: "originalTitle",
config: __dirname + "/config.primaryTitle.js"
config: __dirname + "/config.originalTitle.js"
}],
tag: [{
field: "startYear"

View File

@@ -26,9 +26,9 @@ const config = {
];
// add test data
data.forEach((item, id) => {
index.add(id, item);
});
for(let i = 0; i < data.length; i++){
await index.addAsync(i, data[i]);
}
// perform query
let result = await index.search({

View File

@@ -1,6 +1,6 @@
{
"name": "nodejs-commonjs-basic-worker-extern-config",
"dependencies": {
"flexsearch": "^0.8.105"
"flexsearch": "github:nextapps-de/flexsearch"
}
}

View File

@@ -60,6 +60,7 @@ const fs = require("fs").promises;
// -----------------------
await fs.mkdir("./export/").catch(e => {});
// call export
await document.export(async function(key, data){
await fs.writeFile("./export/" + key, data, "utf8");
});
@@ -75,7 +76,8 @@ const fs = require("fs").promises;
const files = await fs.readdir("./export/");
await Promise.all(files.map(async file => {
const data = await fs.readFile("./export/" + file, "utf8");
await document.import(file, data);
// call import
document.import(file, data);
}))
// perform query

View File

@@ -0,0 +1,7 @@
```bash
npm install
```
```bash
node index.js
```

View File

@@ -0,0 +1,30 @@
const { Encoder, Charset } = require("flexsearch");
const EnglishPreset = require("flexsearch/lang/en");
const fs = require("fs").promises;
(async function(){
await fs.mkdir("./export/").catch(e => {});
}());
module.exports = {
tokenize: "forward",
encoder: new Encoder(
Charset.LatinBalance,
EnglishPreset,
{
normalize: function(str){
return str.toLowerCase();
},
filter: false,
minlength: 3
}
),
export: async function(key, data){
await fs.writeFile("./export/" + key, data, "utf8");
},
import: async function(file){
return await fs.readFile("./export/" + file, "utf8");
}
};

View File

@@ -0,0 +1,30 @@
const { Encoder, Charset } = require("flexsearch");
const EnglishPreset = require("flexsearch/lang/en");
const fs = require("fs").promises;
(async function(){
await fs.mkdir("./export/").catch(e => {});
}());
module.exports = {
tokenize: "forward",
encoder: new Encoder(
Charset.LatinBalance,
EnglishPreset,
{
normalize: function(str){
return str.toLowerCase();
},
filter: false,
minlength: 3
}
),
export: async function(key, data){
await fs.writeFile("./export/" + key, data, "utf8");
},
import: async function(file){
return await fs.readFile("./export/" + file, "utf8");
}
};

View File

@@ -0,0 +1,141 @@
[
{
"tconst": "tt0000001",
"titleType": "short",
"primaryTitle": "Carmencita",
"originalTitle": "Carmencita",
"isAdult": 0,
"startYear": "1894",
"endYear": "",
"runtimeMinutes": "1",
"genres": [
"Documentary",
"Short"
]
},
{
"tconst": "tt0000002",
"titleType": "short",
"primaryTitle": "Le clown et ses chiens",
"originalTitle": "Le clown et ses chiens",
"isAdult": 0,
"startYear": "1892",
"endYear": "",
"runtimeMinutes": "5",
"genres": [
"Animation",
"Short"
]
},
{
"tconst": "tt0000003",
"titleType": "short",
"primaryTitle": "Pauvre Pierrot",
"originalTitle": "Pauvre Pierrot",
"isAdult": 0,
"startYear": "1892",
"endYear": "",
"runtimeMinutes": "4",
"genres": [
"Animation",
"Comedy",
"Romance"
]
},
{
"tconst": "tt0000004",
"titleType": "short",
"primaryTitle": "Un bon bock",
"originalTitle": "Un bon bock",
"isAdult": 0,
"startYear": "1892",
"endYear": "",
"runtimeMinutes": "12",
"genres": [
"Animation",
"Short"
]
},
{
"tconst": "tt0000005",
"titleType": "short",
"primaryTitle": "Blacksmith Scene",
"originalTitle": "Blacksmith Scene",
"isAdult": 0,
"startYear": "1893",
"endYear": "",
"runtimeMinutes": "1",
"genres": [
"Comedy",
"Short"
]
},
{
"tconst": "tt0000006",
"titleType": "short",
"primaryTitle": "Chinese Opium Den",
"originalTitle": "Chinese Opium Den",
"isAdult": 0,
"startYear": "1894",
"endYear": "",
"runtimeMinutes": "1",
"genres": [
"Short"
]
},
{
"tconst": "tt0000007",
"titleType": "short",
"primaryTitle": "Corbett and Courtney Before the Kinetograph",
"originalTitle": "Corbett and Courtney Before the Kinetograph",
"isAdult": 0,
"startYear": "1894",
"endYear": "",
"runtimeMinutes": "1",
"genres": [
"Short",
"Sport"
]
},
{
"tconst": "tt0000008",
"titleType": "short",
"primaryTitle": "Edison Kinetoscopic Record of a Sneeze",
"originalTitle": "Edison Kinetoscopic Record of a Sneeze",
"isAdult": 0,
"startYear": "1894",
"endYear": "",
"runtimeMinutes": "1",
"genres": [
"Documentary",
"Short"
]
},
{
"tconst": "tt0000009",
"titleType": "movie",
"primaryTitle": "Miss Jerry",
"originalTitle": "Miss Jerry",
"isAdult": 0,
"startYear": "1894",
"endYear": "",
"runtimeMinutes": "45",
"genres": [
"Romance"
]
},
{
"tconst": "tt0000010",
"titleType": "short",
"primaryTitle": "Leaving the Factory",
"originalTitle": "La sortie de l'usine Lumière à Lyon",
"isAdult": 0,
"startYear": "1895",
"endYear": "",
"runtimeMinutes": "1",
"genres": [
"Documentary",
"Short"
]
}
]

View File

@@ -0,0 +1,102 @@
const { Document } = require("flexsearch");
const { promises: fs } = require("fs");
// loading test data
const data = require(__dirname + "/data.json");
// you will need to keep the index configuration
// they will not export, also every change to the
// configuration requires a full re-index
const config = {
worker: true,
document: {
id: "tconst",
store: true,
index: [{
field: "primaryTitle",
config: __dirname + "/config.primaryTitle.js"
},{
field: "originalTitle",
config: __dirname + "/config.originalTitle.js"
}],
tag: [{
field: "startYear"
},{
field: "genres"
}]
}
};
(async function(){
// create the document and await (!) for the instance response
let document = await new Document(config);
// add test data
for(let i = 0; i < data.length; i++){
await document.add(data[i]);
}
// perform a query
let result = await document.search({
query: "karmen",
tag: {
"startYear": "1894",
"genres": [
"Documentary",
"Short"
]
},
suggest: true,
enrich: true,
merge: true
});
console.log(result);
// -----------------------
// EXPORT
// -----------------------
// create folders for the export
// it should be empty before export
await fs.mkdir("./export/").catch(e => {});
await document.export(async function(key, data){
await fs.writeFile("./export/" + key, data, "utf8");
});
// -----------------------
// IMPORT
// -----------------------
// create the same type of index you have used by .export()
// along with the same configuration
document = await new Document(config);
// load them in parallel
const files = await fs.readdir("./export/");
await Promise.all(files.map(async file => {
const data = await fs.readFile("./export/" + file, "utf8");
await document.import(file, data);
}));
// perform a query
result = await document.search({
query: "karmen",
tag: {
"startYear": "1894",
"genres": [
"Documentary",
"Short"
]
},
suggest: true,
enrich: true,
merge: true
});
console.log("-------------------------------------");
console.log(result);
}());

View File

@@ -0,0 +1,6 @@
{
"name": "nodejs-commonjs-document-worker-export-import",
"dependencies": {
"flexsearch": "github:nextapps-de/flexsearch"
}
}

View File

@@ -16,7 +16,7 @@ const data = require(__dirname + "/data.json");
config: __dirname + "/config.primaryTitle.js"
},{
field: "originalTitle",
config: __dirname + "/config.primaryTitle.js"
config: __dirname + "/config.originalTitle.js"
}],
tag: [{
field: "startYear"

View File

@@ -27,9 +27,9 @@ const config = {
];
// add test data
data.forEach((item, id) => {
index.add(id, item);
});
for(let i = 0; i < data.length; i++){
await index.addAsync(i, data[i]);
}
// perform query
let result = await index.search({
@@ -45,9 +45,7 @@ const config = {
// EXPORT
// -----------------------
await index.export(function(){
// do nothing here
});
await index.export();
// -----------------------
// IMPORT

View File

@@ -1,7 +1,7 @@
{
"name": "nodejs-esm-basic-worker-extern-config",
"name": "nodejs-esm-basic-worker-export-import",
"type": "module",
"dependencies": {
"flexsearch": "^0.8.105"
"flexsearch": "github:nextapps-de/flexsearch"
}
}

View File

@@ -59,6 +59,7 @@ console.log(result);
// -----------------------
await fs.mkdir("./export/").catch(e => {});
// call export
await document.export(async function(key, data){
await fs.writeFile("./export/" + key, data, "utf8");
});
@@ -74,8 +75,9 @@ document = new Document(config);
const files = await fs.readdir("./export/");
await Promise.all(files.map(async file => {
const data = await fs.readFile("./export/" + file, "utf8");
await document.import(file, data);
}))
// call import
document.import(file, data);
}));
// perform query
result = document.search({

View File

@@ -0,0 +1,7 @@
```bash
npm install
```
```bash
node index.js
```

View File

@@ -0,0 +1,30 @@
import { Encoder, Charset } from "flexsearch/esm";
import EnglishPreset from "flexsearch/esm/lang/en";
import { promises as fs } from "fs";
(async function(){
await fs.mkdir("./export/").catch(e => {});
}());
export default {
tokenize: "forward",
encoder: new Encoder(
Charset.LatinBalance,
EnglishPreset,
{
normalize: function(str){
return str.toLowerCase();
},
filter: false,
minlength: 3
}
),
export: async function(key, data){
await fs.writeFile("./export/" + key, data, "utf8");
},
import: async function(file){
return await fs.readFile("./export/" + file, "utf8");
}
};

View File

@@ -0,0 +1,30 @@
import { Encoder, Charset } from "flexsearch/esm";
import EnglishPreset from "flexsearch/esm/lang/en";
import { promises as fs } from "fs";
(async function(){
await fs.mkdir("./export/").catch(e => {});
}());
export default {
tokenize: "forward",
encoder: new Encoder(
Charset.LatinBalance,
EnglishPreset,
{
normalize: function(str){
return str.toLowerCase();
},
filter: false,
minlength: 3
}
),
export: async function(key, data){
await fs.writeFile("./export/" + key, data, "utf8");
},
import: async function(file){
return await fs.readFile("./export/" + file, "utf8");
}
};

View File

@@ -0,0 +1,141 @@
[
{
"tconst": "tt0000001",
"titleType": "short",
"primaryTitle": "Carmencita",
"originalTitle": "Carmencita",
"isAdult": 0,
"startYear": "1894",
"endYear": "",
"runtimeMinutes": "1",
"genres": [
"Documentary",
"Short"
]
},
{
"tconst": "tt0000002",
"titleType": "short",
"primaryTitle": "Le clown et ses chiens",
"originalTitle": "Le clown et ses chiens",
"isAdult": 0,
"startYear": "1892",
"endYear": "",
"runtimeMinutes": "5",
"genres": [
"Animation",
"Short"
]
},
{
"tconst": "tt0000003",
"titleType": "short",
"primaryTitle": "Pauvre Pierrot",
"originalTitle": "Pauvre Pierrot",
"isAdult": 0,
"startYear": "1892",
"endYear": "",
"runtimeMinutes": "4",
"genres": [
"Animation",
"Comedy",
"Romance"
]
},
{
"tconst": "tt0000004",
"titleType": "short",
"primaryTitle": "Un bon bock",
"originalTitle": "Un bon bock",
"isAdult": 0,
"startYear": "1892",
"endYear": "",
"runtimeMinutes": "12",
"genres": [
"Animation",
"Short"
]
},
{
"tconst": "tt0000005",
"titleType": "short",
"primaryTitle": "Blacksmith Scene",
"originalTitle": "Blacksmith Scene",
"isAdult": 0,
"startYear": "1893",
"endYear": "",
"runtimeMinutes": "1",
"genres": [
"Comedy",
"Short"
]
},
{
"tconst": "tt0000006",
"titleType": "short",
"primaryTitle": "Chinese Opium Den",
"originalTitle": "Chinese Opium Den",
"isAdult": 0,
"startYear": "1894",
"endYear": "",
"runtimeMinutes": "1",
"genres": [
"Short"
]
},
{
"tconst": "tt0000007",
"titleType": "short",
"primaryTitle": "Corbett and Courtney Before the Kinetograph",
"originalTitle": "Corbett and Courtney Before the Kinetograph",
"isAdult": 0,
"startYear": "1894",
"endYear": "",
"runtimeMinutes": "1",
"genres": [
"Short",
"Sport"
]
},
{
"tconst": "tt0000008",
"titleType": "short",
"primaryTitle": "Edison Kinetoscopic Record of a Sneeze",
"originalTitle": "Edison Kinetoscopic Record of a Sneeze",
"isAdult": 0,
"startYear": "1894",
"endYear": "",
"runtimeMinutes": "1",
"genres": [
"Documentary",
"Short"
]
},
{
"tconst": "tt0000009",
"titleType": "movie",
"primaryTitle": "Miss Jerry",
"originalTitle": "Miss Jerry",
"isAdult": 0,
"startYear": "1894",
"endYear": "",
"runtimeMinutes": "45",
"genres": [
"Romance"
]
},
{
"tconst": "tt0000010",
"titleType": "short",
"primaryTitle": "Leaving the Factory",
"originalTitle": "La sortie de l'usine Lumière à Lyon",
"isAdult": 0,
"startYear": "1895",
"endYear": "",
"runtimeMinutes": "1",
"genres": [
"Documentary",
"Short"
]
}
]

View File

@@ -0,0 +1,104 @@
import { Document } from "flexsearch/esm";
import { promises as fs } from "fs";
const dirname = import.meta.dirname;
// you will need to keep the index configuration
// they will not export, also every change to the
// configuration requires a full re-index
const config = {
worker: true,
document: {
id: "tconst",
store: true,
index: [{
field: "primaryTitle",
config: dirname + "/config.primaryTitle.js"
},{
field: "originalTitle",
config: dirname + "/config.originalTitle.js"
}],
tag: [{
field: "startYear"
},{
field: "genres"
}]
}
};
(async function(){
// loading test data
const data = JSON.parse(await fs.readFile(dirname + "/data.json"));
// create the document and await (!) for the instance response
let document = await new Document(config);
// add test data
for(let i = 0; i < data.length; i++){
await document.add(data[i]);
}
// perform a query
let result = await document.search({
query: "karmen",
tag: {
"startYear": "1894",
"genres": [
"Documentary",
"Short"
]
},
suggest: true,
enrich: true,
merge: true
});
console.log(result);
// -----------------------
// EXPORT
// -----------------------
// create folders for the export
// it should be empty before export
await fs.mkdir("./export/").catch(e => {});
// call export
await document.export(async function(key, data){
await fs.writeFile("./export/" + key, data, "utf8");
});
// -----------------------
// IMPORT
// -----------------------
// create the same type of index you have used by .export()
// along with the same configuration
document = await new Document(config);
// load them in parallel
const files = await fs.readdir("./export/");
await Promise.all(files.map(async file => {
const data = await fs.readFile("./export/" + file, "utf8");
// call import
await document.import(file, data);
}));
// perform a query
result = await document.search({
query: "karmen",
tag: {
"startYear": "1894",
"genres": [
"Documentary",
"Short"
]
},
suggest: true,
enrich: true,
merge: true
});
console.log("-------------------------------------");
console.log(result);
}());

View File

@@ -0,0 +1,7 @@
{
"name": "nodejs-esm-document-worker-export-import",
"type": "module",
"dependencies": {
"flexsearch": "github:nextapps-de/flexsearch"
}
}

View File

@@ -2,6 +2,6 @@
"name": "nodejs-esm-document-worker",
"type": "module",
"dependencies": {
"flexsearch": "^0.8.105"
"flexsearch": "github:nextapps-de/flexsearch"
}
}

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "flexsearch",
"version": "0.8.111",
"version": "0.8.113",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "flexsearch",
"version": "0.8.111",
"version": "0.8.113",
"funding": [
{
"type": "github",

View File

@@ -2,7 +2,7 @@
"public": true,
"preferGlobal": false,
"name": "flexsearch",
"version": "0.8.111",
"version": "0.8.113",
"description": "Next-Generation full-text search library for Browser and Node.js",
"homepage": "https://github.com/nextapps-de/flexsearch/",
"author": "Thomas Wilkerling",

View File

@@ -4,7 +4,7 @@ import {
SUPPORT_KEYSTORE,
SUPPORT_PERSISTENT,
SUPPORT_STORE,
SUPPORT_TAGS
SUPPORT_TAGS, SUPPORT_WORKER
} from "../config.js";
// <-- COMPILER BLOCK
import { create_object, is_array, is_object, is_string, parse_simple } from "../common.js";
@@ -171,6 +171,10 @@ Document.prototype.add = function(id, content, _append){
this.store.set(id, payload || content);
}
if(SUPPORT_WORKER && this.worker){
this.fastupdate || this.reg.add(id);
}
}
return this;

View File

@@ -1,3 +1,6 @@
// COMPILER BLOCK -->
import { SUPPORT_WORKER } from "./config.js";
// <-- COMPILER BLOCK
import Index from "./index.js";
import Document from "./document.js";
import { is_string } from "./common.js";
@@ -83,7 +86,7 @@ function json_to_ctx(json, ctx){
}
/**
* @param {Set<string|number>} reg
* @param {Set<string|number>|Map<Array<string|number>>} reg
* @return {Array<Array<string|number>>}
*/
function reg_to_json(reg){
@@ -244,6 +247,9 @@ export function importIndex(key, data){
if(split[split.length - 1] === "json"){
split.pop();
}
if(split.length === 3){
split.shift();
}
key = split.length > 1 ? split[1] : split[0];
switch(key){
@@ -355,6 +361,18 @@ export function exportDocument(callback, _field, _index_doc = 0, _index_obj = 0)
export function importDocument(key, data){
const split = key.split(".");
if(split[split.length - 1] === "json"){
split.pop();
}
const field = split.length > 2 ? split[0] : "";
const ref = split.length > 2 ? split[2] : split[1];
// trigger the import for worker field indexes
if(SUPPORT_WORKER && this.worker && field){
return this.index.get(field).import(key);
}
if(!data){
return;
}
@@ -364,16 +382,9 @@ export function importDocument(key, data){
);
}
const split = key.split(".");
if(split[split.length - 1] === "json"){
split.pop();
}
const field = split.length > 2 ? split[0] : "";
key = split.length > 2 ? split[2] : split[1];
if(!field){
switch(key){
switch(ref){
case "reg":
@@ -387,6 +398,22 @@ export function importDocument(key, data){
idx.reg = this.reg;
}
// trigger the import for worker field indexes
if(SUPPORT_WORKER && this.worker){
const promises = [];
const self = this;
for(const index of this.index.values()){
// const ref = item[0];
// const index = item[1];
promises.push(index.import(key));
//this.index.get(field).import(key);
}
return Promise.all(promises);
}
break;
case "tag":
@@ -407,7 +434,7 @@ export function importDocument(key, data){
}
else{
return this.index.get(field).import(key, data);
return this.index.get(field).import(ref, data);
}
}

View File

@@ -2,7 +2,7 @@
import { SUPPORT_ASYNC } from "./config.js";
// <-- COMPILER BLOCK
import { IndexOptions } from "./type.js";
import { create_object, is_function, is_object, is_string } from "./common.js";
import { create_object } from "./common.js";
import handler from "./worker/handler.js";
import apply_async from "./async.js";
@@ -88,7 +88,6 @@ export default function WorkerIndex(options = /** @type IndexOptions */ ({})){
}
const worker = create(factory, is_node_js, options.worker);
//worker.worker = true;
return worker.then
? worker.then(function(worker){
return init.call(_self, worker);
@@ -111,28 +110,29 @@ if(SUPPORT_ASYNC){
function register(key){
WorkerIndex.prototype[key] =
/*WorkerIndex.prototype[key + "Async"] =*/ async function(){
WorkerIndex.prototype[key] = function(){
const self = this;
const args = [].slice.call(arguments);
const arg = args[args.length - 1];
let callback;
if(is_function(arg)){
if(typeof arg === "function"){
callback = arg;
args.splice(args.length - 1, 1);
args.pop();
}
const promise = new Promise(function(resolve){
//setTimeout(function(){
self.resolver[++pid] = resolve;
self.worker.postMessage({
"task": key,
"id": pid,
"args": args
});
//});
if(key === "export" && typeof args[0] === "function"){
// remove function handler
args[0] = null;
}
self.resolver[++pid] = resolve;
self.worker.postMessage({
"task": key,
"id": pid,
"args": args
});
});
if(callback){
@@ -140,7 +140,6 @@ function register(key){
return this;
}
else{
return promise;
}
};
@@ -151,8 +150,7 @@ function create(factory, is_node_js, worker_path){
let worker
worker = is_node_js ?
// This eval will be removed when compiling, it isn't there in final build
// This eval will be removed when compiling
typeof module !== "undefined"
? (0,eval)('new (require("worker_threads")["Worker"])(__dirname + "/node/node.js")')
//: (0,eval)('new ((await import("worker_threads"))["Worker"])(import.meta.dirname + "/worker/node.mjs")')
@@ -170,7 +168,13 @@ function create(factory, is_node_js, worker_path){
)
))
:
new window.Worker(is_string(worker_path) ? worker_path : import.meta.url.replace("/worker.js", "/worker/worker.js").replace("flexsearch.bundle.module.min.js", "module/worker/worker.js") /*"worker/worker.js"*/, { type: "module" })
new window.Worker(
typeof worker_path === "string"
? worker_path
: import.meta.url.replace("/worker.js", "/worker/worker.js")
.replace("flexsearch.bundle.module.min.js", "module/worker/worker.js") /*"worker/worker.js"*/
, { type: "module" }
)
);
return worker;

View File

@@ -59,7 +59,13 @@ export default async function(data) {
throw new Error("Either no extern configuration provided for the Worker-Index or no method was defined on the config property \"export\".");
}
}
args = [options.export];
// skip non-field indexes
if(!args[1]) args = null;
else{
args[0] = options.export;
args[2] = 0;
args[3] = 1; // skip reg
}
}
if(task === "import"){
if(DEBUG){
@@ -67,11 +73,14 @@ export default async function(data) {
throw new Error("Either no extern configuration provided for the Worker-Index or no method was defined on the config property \"import\".");
}
}
await options.import.call(index, index);
if(args[0]){
const data = await options.import.call(index, args[0]);
index.import(args[0], data);
}
}
else{
message = index[task].apply(index, args);
if(message.then){
message = args && index[task].apply(index, args);
if(message && message.then){
message = await message;
}
}

View File

@@ -1,3 +1,7 @@
/*
* Node.js Worker (CommonJS)
* This file is a standalone file and isn't being a part of the build/bundle
*/
const { parentPort } = require("worker_threads");
//const { join } = require("path");
// Test Path
@@ -41,17 +45,26 @@ parentPort.on("message", async function(data){
if(!options.export || typeof options.export !== "function"){
throw new Error("Either no extern configuration provided for the Worker-Index or no method was defined on the config property \"export\".");
}
args = [options.export];
// skip non-field indexes
if(!args[1]) args = null;
else{
args[0] = options.export;
args[2] = 0;
args[3] = 1; // skip reg
}
}
if(task === "import"){
if(!options.import || typeof options.import !== "function"){
throw new Error("Either no extern configuration provided for the Worker-Index or no method was defined on the config property \"import\".");
}
await options.import.call(index, index);
if(args[0]){
const data = await options.import.call(index, args[0]);
index.import(args[0], data);
}
}
else{
message = index[task].apply(index, args);
if(message.then){
message = args && index[task].apply(index, args);
if(message && message.then){
message = await message;
}
}

View File

@@ -1,3 +1,7 @@
/*
* Node.js Worker (Standalone, ESM)
* This file is a standalone file and isn't being a part of the build/bundle
*/
import { parentPort } from "worker_threads";
import { join } from "path";
// Test Path
@@ -43,17 +47,26 @@ parentPort.on("message", async function(data){
if(!options.export || typeof options.export !== "function"){
throw new Error("Either no extern configuration provided for the Worker-Index or no method was defined on the config property \"export\".");
}
args = [options.export];
// skip non-field indexes
if(!args[1]) args = null;
else{
args[0] = options.export;
args[2] = 0;
args[3] = 1; // skip reg
}
}
if(task === "import"){
if(!options.import || typeof options.import !== "function"){
throw new Error("Either no extern configuration provided for the Worker-Index or no method was defined on the config property \"import\".");
}
await options.import.call(index, index);
if(args[0]){
const data = await options.import.call(index, args[0]);
index.import(args[0], data);
}
}
else{
message = index[task].apply(index, args);
if(message.then){
message = args && index[task].apply(index, args);
if(message && message.then){
message = await message;
}
}