1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-09-25 12:58:59 +02:00

v0.8 compatible export/import

This commit is contained in:
Thomas Wilkerling
2025-03-15 12:06:31 +01:00
parent a975b063c7
commit 76d089b27c
55 changed files with 1995 additions and 2032 deletions

View File

@@ -2269,6 +2269,56 @@ The custom build will be saved to `dist/flexsearch.custom.xxxx.min.js` or when f
A formula to determine a well-balanced value for the `resolution` is: $2*floor(\sqrt{content.length})$ where content is the value pushed by `index.add()`. Here the maximum length of all contents should be used.
## Import / Export (In-Memory)
> Persistent-Indexes and Worker-Indexes don't support Import/Export.
Export a simple `Index` to the folder `/export/`:
```js
import { promises as fs } from "fs";
await index.export(async function(key, data){
await fs.writeFile("./export/" + key, data, "utf8");
});
```
Import from folder `/export/` into a simple `Index`:
```js
const index = new Index({/* keep old config and place it here */});
const files = await fs.readdir("./export/");
for(let i = 0; i < files.length; i++){
const data = await fs.readFile("./export/" + files[i], "utf8");
await index.import(files[i], data);
}
```
This is very similar for document indexes.
Export a `Document-Index` to the folder `/export/`:
```js
import { promises as fs } from "fs";
await index.export(async function(key, data){
await fs.writeFile("./export/" + key, data, "utf8");
});
```
Import from folder `/export/` into a `Document-Index`:
```js
const index = new Document({/* keep old config and place it here */});
const files = await fs.readdir("./export/");
for(let i = 0; i < files.length; i++){
const data = await fs.readFile("./export/" + files[i], "utf8");
await index.import(files[i], data);
}
```
## Migration
- The index option property "minlength" has moved to the Encoder Class

View File

@@ -430,7 +430,7 @@ const normalize = "".normalize && /[\u0300-\u036f]/g; // '´`ʼ.,
function Encoder(options){
if(!this){
if(this.constructor !== Encoder){
return new Encoder(...arguments);
}
@@ -1009,7 +1009,7 @@ let pid = 0;
function WorkerIndex(options = {}){
if(!this) {
if(this.constructor !== WorkerIndex) {
return new WorkerIndex(options);
}
@@ -1245,111 +1245,88 @@ function register(key){
};
}
// TODO return promises instead of inner await
function map_to_json(map){
const json = [];
for(const item of map.entries()){
json.push(item);
}
return json;
}
function ctx_to_json(ctx){
const json = [];
for(const item of ctx.entries()){
json.push(map_to_json(item));
}
return json;
}
function async(callback, self, field, key, index_doc, index, data, on_done){
function reg_to_json(reg){
const json = [];
for(const key of reg.keys()){
json.push(key);
}
return json;
}
//setTimeout(function(){
function save(callback, field, key, index_doc, index, data){
const res = callback(field ? field + "." + key : key, JSON.stringify(data));
// await isn't supported by ES5
if(res && res["then"]){
res["then"](function(){
self.export(callback, self, field, index_doc, index + 1, on_done);
const self = this;
return res["then"](function(){
return self.export(callback, field, index_doc, index + 1);
});
}
else {
self.export(callback, self, field, index_doc, index + 1, on_done);
}
//});
return this.export(callback, field, index_doc, index + 1);
}
/**
* @param callback
* @param self
* @param field
* @param index_doc
* @param index
* @param on_done
* @this {Index|Document}
*/
function exportIndex(callback, self, field, index_doc, index, on_done){
let return_value = true;
if (typeof on_done === 'undefined') {
return_value = new Promise((resolve) => {
on_done = resolve;
});
}
function exportIndex(callback, field, index_doc, index = 0){
let key, data;
switch(index || (index = 0)){
switch(index){
case 0:
key = "reg";
// fastupdate isn't supported by export
if(this.fastupdate){
data = create_object();
for(let key of this.reg.keys()){
data[key] = 1;
}
}
else {
data = this.reg;
}
data = reg_to_json(this.reg);
break;
case 1:
key = "cfg";
data = {
"doc": 0,
"opt": this.optimize ? 1 : 0
};
data = {};
break;
case 2:
key = "map";
data = this.map;
data = map_to_json(this.map);
break;
case 3:
key = "ctx";
data = this.ctx;
data = ctx_to_json(this.ctx);
break;
default:
if (typeof field === 'undefined' && on_done) {
on_done();
}
return;
}
async(callback, self || this, field, key, index_doc, index, data, on_done);
return return_value;
return save.call(this, callback, field, key, index_doc, index, data);
}
/**
@@ -1359,38 +1336,32 @@ function exportIndex(callback, self, field, index_doc, index, on_done){
function importIndex(key, data){
if(!data){
return;
}
if(is_string(data)){
data = JSON.parse(data);
}
switch(key){
case "cfg":
this.optimize = !!data["opt"];
break;
case "reg":
// fastupdate isn't supported by import
// fast update isn't supported by export/import
this.fastupdate = false;
this.reg = data;
this.reg = new Set(data);
break;
case "map":
this.map = data;
this.map = new Map(data);
break;
case "ctx":
this.ctx = data;
this.ctx = new Map(data);
break;
}
}
@@ -1399,35 +1370,23 @@ function importIndex(key, data){
* @this Document
*/
function exportDocument(callback, self, field, index_doc, index, on_done){
let return_value;
if (typeof on_done === 'undefined') {
return_value = new Promise((resolve) => {
on_done = resolve;
});
}
index || (index = 0);
index_doc || (index_doc = 0);
function exportDocument(callback, field, index_doc = 0, index = 0){
if(index_doc < this.field.length){
const field = this.field[index_doc];
const idx = this.index[field];
const idx = this.index.get(field);
// start from index 1, because document indexes does not additionally store register
const res = idx.export(callback, field, index_doc, index = 1);
self = this;
//setTimeout(function(){
if(!idx.export(callback, self, index ? field/*.replace(":", "-")*/ : "", index_doc, index++, on_done)){
index_doc++;
index = 1;
self.export(callback, self, field, index_doc, index, on_done);
if(res && res["then"]){
const self = this;
return res["then"](function(){
return self.export(callback, field, index_doc + 1, index = 0);
});
}
//});
return this.export(callback, field, index_doc + 1, index = 0);
}
else {
@@ -1435,36 +1394,41 @@ function exportDocument(callback, self, field, index_doc, index, on_done){
switch(index){
case 0:
key = "reg";
data = reg_to_json(this.reg);
field = null;
break;
case 1:
key = "tag";
data = this.tagindex;
data = ctx_to_json(this.tag);
field = null;
break;
case 2:
key = "store";
data = this.store;
key = "doc";
data = map_to_json(this.store);
field = null;
break;
// case 3:
//
// key = "reg";
// data = this.register;
// break;
case 3:
key = "cfg";
data = {};
field = null;
break;
default:
on_done();
return;
}
async(callback, this, field, key, index_doc, index, data, on_done);
return save.call(this, callback, field, key, index_doc, index, data);
}
return return_value
}
/**
@@ -1474,12 +1438,9 @@ function exportDocument(callback, self, field, index_doc, index, on_done){
function importDocument(key, data){
if(!data){
return;
}
if(is_string(data)){
data = JSON.parse(data);
}
@@ -1487,28 +1448,26 @@ function importDocument(key, data){
case "tag":
this.tagindex = data;
this.tagindex = new Map(data);
break;
case "reg":
// fastupdate isn't supported by import
// fast update isn't supported by export/import
this.fastupdate = false;
this.reg = data;
this.reg = new Set(data);
for(let i = 0, index; i < this.field.length; i++){
index = this.index[this.field[i]];
index.reg = data;
index.fastupdate = false;
for(let i = 0, idx; i < this.field.length; i++){
idx = this.index.get(this.field[i]);
idx.fastupdate = false;
idx.reg = this.reg;
}
break;
case "store":
case "doc":
this.store = data;
this.store = new Map(data);
break;
default:
@@ -1518,8 +1477,7 @@ function importDocument(key, data){
key = key[1];
if(field && key){
this.index[field].import(key, data);
this.index.get(field).import(key, data);
}
}
}
@@ -3492,7 +3450,7 @@ function apply_enrich(res){
function Document(options){
if(!this) {
if(this.constructor !== Document) {
return new Document(options);
}
@@ -5472,7 +5430,7 @@ function exclusion(result, limit, offset, resolve){
*/
function Resolver(result){
if(!this){
if(this.constructor !== Resolver){
return new Resolver(result);
}
if(result && result.index){
@@ -6232,7 +6190,7 @@ function remove_index(map, id){
function Index(options, _register){
if(!this){
if(this.constructor !== Index){
return new Index(options);
}

View File

@@ -90,7 +90,7 @@ function ca(a) {
"\u04d9"], ["\u04dd", "\u0436"], ["\u04df", "\u0437"], ["\u04e3", "\u0438"], ["\u04e5", "\u0438"], ["\u04e7", "\u043e"], ["\u04eb", "\u04e9"], ["\u04ed", "\u044d"], ["\u04ef", "\u0443"], ["\u04f1", "\u0443"], ["\u04f3", "\u0443"], ["\u04f5", "\u0447"]];
const ea = /[^\p{L}\p{N}]+/u, fa = /(\d{3})/g, ha = /(\D)(\d{3})/g, ia = /(\d{3})(\D)/g, ja = "".normalize && /[\u0300-\u036f]/g;
function K(a) {
if (!this) {
if (this.constructor !== K) {
return new K(...arguments);
}
for (let b = 0; b < arguments.length; b++) {
@@ -264,7 +264,7 @@ function N(a = {}) {
return this;
}
}
if (!this) {
if (this.constructor !== N) {
return new N(a);
}
let c = "undefined" !== typeof self ? self._factory : "undefined" !== typeof window ? window._factory : null;
@@ -314,12 +314,37 @@ function P(a) {
return b;
};
}
;function oa(a, b, c, d, e, f, g, h) {
(d = a(c ? c + "." + d : d, JSON.stringify(g))) && d.then ? d.then(function() {
b.export(a, b, c, e, f + 1, h);
}) : b.export(a, b, c, e, f + 1, h);
;function oa(a) {
const b = [];
for (const c of a.entries()) {
b.push(c);
}
;function pa(a, b, c, d) {
return b;
}
function pa(a) {
const b = [];
for (const c of a.entries()) {
b.push(oa(c));
}
return b;
}
function qa(a) {
const b = [];
for (const c of a.keys()) {
b.push(c);
}
return b;
}
function ra(a, b, c, d, e, f) {
if ((c = a(b ? b + "." + c : c, JSON.stringify(f))) && c.then) {
const g = this;
return c.then(function() {
return g.export(a, b, d, e + 1);
});
}
return this.export(a, b, d, e + 1);
}
;function sa(a, b, c, d) {
let e = [];
for (let f = 0, g; f < a.index.length; f++) {
if (g = a.index[f], b >= g.length) {
@@ -385,12 +410,12 @@ function Q(a) {
}
if ("slice" === d) {
return function(e, f) {
return pa(b, e || 0, f || b.length, !1);
return sa(b, e || 0, f || b.length, !1);
};
}
if ("splice" === d) {
return function(e, f) {
return pa(b, e || 0, f || b.length, !0);
return sa(b, e || 0, f || b.length, !0);
};
}
if ("constructor" === d) {
@@ -421,7 +446,7 @@ function R(a = 8) {
this.index = B();
this.B = [];
this.size = 0;
32 < a ? (this.h = qa, this.A = BigInt(a)) : (this.h = ra, this.A = a);
32 < a ? (this.h = ta, this.A = BigInt(a)) : (this.h = ua, this.A = a);
}
R.prototype.get = function(a) {
const b = this.index[this.h(a)];
@@ -438,7 +463,7 @@ function S(a = 8) {
}
this.index = B();
this.h = [];
32 < a ? (this.B = qa, this.A = BigInt(a)) : (this.B = ra, this.A = a);
32 < a ? (this.B = ta, this.A = BigInt(a)) : (this.B = ua, this.A = a);
}
S.prototype.add = function(a) {
var b = this.B(a);
@@ -480,7 +505,7 @@ v.entries = S.prototype.entries = function*() {
}
}
};
function ra(a) {
function ua(a) {
let b = 2 ** this.A - 1;
if ("number" == typeof a) {
return a & b;
@@ -491,7 +516,7 @@ function ra(a) {
}
return 32 === this.A ? c + 2 ** 31 : c;
}
function qa(a) {
function ta(a) {
let b = BigInt(2) ** this.A - BigInt(1);
var c = typeof a;
if ("bigint" === c) {
@@ -521,7 +546,7 @@ function qa(a) {
e && d.add(a, e, !1, !0);
} else {
if (e = k.I, !e || e(b)) {
k.constructor === String ? k = ["" + k] : G(k) && (k = [k]), sa(b, k, this.K, 0, d, a, k[0], c);
k.constructor === String ? k = ["" + k] : G(k) && (k = [k]), va(b, k, this.K, 0, d, a, k[0], c);
}
}
}
@@ -584,7 +609,7 @@ function qa(a) {
h[l] = b[l];
continue;
}
ta(b, h, l, 0, l[0], m);
wa(b, h, l, 0, l[0], m);
}
}
this.store.set(a, h || b);
@@ -592,21 +617,21 @@ function qa(a) {
}
return this;
};
function ta(a, b, c, d, e, f) {
function wa(a, b, c, d, e, f) {
a = a[e];
if (d === c.length - 1) {
b[e] = f || a;
} else if (a) {
if (a.constructor === Array) {
for (b = b[e] = Array(a.length), e = 0; e < a.length; e++) {
ta(a, b, c, d, e);
wa(a, b, c, d, e);
}
} else {
b = b[e] || (b[e] = B()), e = c[++d], ta(a, b, c, d, e);
b = b[e] || (b[e] = B()), e = c[++d], wa(a, b, c, d, e);
}
}
}
function sa(a, b, c, d, e, f, g, h) {
function va(a, b, c, d, e, f, g, h) {
if (a = a[g]) {
if (d === b.length - 1) {
if (a.constructor === Array) {
@@ -622,17 +647,17 @@ function sa(a, b, c, d, e, f, g, h) {
} else {
if (a.constructor === Array) {
for (g = 0; g < a.length; g++) {
sa(a, b, c, d, e, f, g, h);
va(a, b, c, d, e, f, g, h);
}
} else {
g = b[++d], sa(a, b, c, d, e, f, g, h);
g = b[++d], va(a, b, c, d, e, f, g, h);
}
}
} else {
e.db && e.remove(f);
}
}
;function ua(a, b, c, d, e, f, g) {
;function xa(a, b, c, d, e, f, g) {
const h = a.length;
let k = [], l;
var m;
@@ -648,7 +673,7 @@ function sa(a, b, c, d, e, f, g, h) {
}
if (a = k.length) {
if (e) {
k = 1 < k.length ? va(k, d, c, g, 0) : (k = k[0]).length > c || d ? k.slice(d, c + d) : k;
k = 1 < k.length ? ya(k, d, c, g, 0) : (k = k[0]).length > c || d ? k.slice(d, c + d) : k;
} else {
if (a < h) {
return [];
@@ -681,7 +706,7 @@ function sa(a, b, c, d, e, f, g, h) {
}
return k;
}
function va(a, b, c, d, e) {
function ya(a, b, c, d, e) {
const f = [], g = B();
let h;
var k = a.length;
@@ -724,7 +749,7 @@ function va(a, b, c, d, e) {
}
return f;
}
function wa(a, b) {
function za(a, b) {
const c = B(), d = [];
for (let e = 0, f; e < b.length; e++) {
f = b[e];
@@ -802,7 +827,7 @@ function wa(a, b) {
}
t.push(d = d.db.tag(r[n + 1], b, l, q));
} else {
d = xa.call(this, r[n], r[n + 1], b, l, q);
d = Aa.call(this, r[n], r[n + 1], b, l, q);
}
e.push({field:r[n], tag:r[n + 1], result:d});
}
@@ -854,7 +879,7 @@ function wa(a, b) {
}
}
} else {
for (let E = 0, F, cb; E < n.length; E += 2) {
for (let E = 0, F, fb; E < n.length; E += 2) {
F = this.tag.get(n[E]);
if (!F) {
if (console.warn("Tag '" + n[E] + ":" + n[E + 1] + "' will be skipped because there is no field '" + n[E] + "'."), t) {
@@ -863,7 +888,7 @@ function wa(a, b) {
return e;
}
}
if (cb = (F = F && F.get(n[E + 1])) && F.length) {
if (fb = (F = F && F.get(n[E + 1])) && F.length) {
x++, u.push(F);
} else if (!t) {
return e;
@@ -871,7 +896,7 @@ function wa(a, b) {
}
}
if (x) {
w = wa(w, u);
w = za(w, u);
I = w.length;
if (!I && !t) {
return e;
@@ -913,7 +938,7 @@ function wa(a, b) {
r = [];
for (let y = 0, w; y < f.length; y++) {
w = e[y];
q && w.length && !w[0].doc && (this.db ? r.push(w = this.index.get(this.field[0]).db.enrich(w)) : w.length && (w = ya.call(this, w)));
q && w.length && !w[0].doc && (this.db ? r.push(w = this.index.get(this.field[0]).db.enrich(w)) : w.length && (w = Ba.call(this, w)));
if (g) {
return w;
}
@@ -925,12 +950,12 @@ function wa(a, b) {
for (let A = 0; A < w.length; A++) {
e[A].result = w[A];
}
return h ? za(e, b) : p ? Aa(e, a, y.index, y.field, y.D, p) : e;
return h ? Ca(e, b) : p ? Da(e, a, y.index, y.field, y.D, p) : e;
});
}
return h ? za(e, b) : p ? Aa(e, a, this.index, this.field, this.D, p) : e;
return h ? Ca(e, b) : p ? Da(e, a, this.index, this.field, this.D, p) : e;
};
function Aa(a, b, c, d, e, f) {
function Da(a, b, c, d, e, f) {
let g, h, k;
for (let m = 0, p, n, q, t, r; m < a.length; m++) {
p = a[m].result;
@@ -972,7 +997,7 @@ function Aa(a, b, c, d, e, f) {
}
return a;
}
function za(a, b) {
function Ca(a, b) {
const c = [], d = B();
for (let e = 0, f, g; e < a.length; e++) {
f = a[e];
@@ -991,7 +1016,7 @@ function za(a, b) {
}
return c;
}
function xa(a, b, c, d, e) {
function Aa(a, b, c, d, e) {
let f = this.tag.get(a);
if (!f) {
return console.warn("Tag '" + a + "' was not found"), [];
@@ -1000,11 +1025,11 @@ function xa(a, b, c, d, e) {
if (a > c || d) {
f = f.slice(d, d + c);
}
e && (f = ya.call(this, f));
e && (f = Ba.call(this, f));
return f;
}
}
function ya(a) {
function Ba(a) {
const b = Array(a.length);
for (let c = 0, d; c < a.length; c++) {
d = a[c], b[c] = {id:d, doc:this.store.get(d)};
@@ -1012,7 +1037,7 @@ function ya(a) {
return b;
}
;function T(a) {
if (!this) {
if (this.constructor !== T) {
return new T(a);
}
const b = a.document || a.doc || a;
@@ -1020,7 +1045,7 @@ function ya(a) {
this.D = [];
this.field = [];
this.K = [];
this.key = (c = b.key || b.id) && Ba(c, this.K) || "id";
this.key = (c = b.key || b.id) && Ea(c, this.K) || "id";
(d = a.keystore || 0) && (this.keystore = d);
this.reg = (this.fastupdate = !!a.fastupdate) ? d ? new R(d) : new Map() : d ? new S(d) : new Set();
this.C = (c = b.store || null) && !0 !== c && [];
@@ -1028,7 +1053,7 @@ function ya(a) {
this.cache = (c = a.cache || null) && new U(c);
a.cache = !1;
this.worker = a.worker;
this.index = Ca.call(this, a, b);
this.index = Fa.call(this, a, b);
this.tag = null;
if (c = b.tag) {
if ("string" === typeof c && (c = [c]), c.length) {
@@ -1041,7 +1066,7 @@ function ya(a) {
if (!g) {
throw Error("The tag field from the document descriptor is undefined.");
}
f.custom ? this.G[e] = f.custom : (this.G[e] = Ba(g, this.K), f.filter && ("string" === typeof this.G[e] && (this.G[e] = new String(this.G[e])), this.G[e].I = f.filter));
f.custom ? this.G[e] = f.custom : (this.G[e] = Ea(g, this.K), f.filter && ("string" === typeof this.G[e] && (this.G[e] = new String(this.G[e])), this.G[e].I = f.filter));
this.N[e] = g;
this.tag.set(g, new Map());
}
@@ -1109,7 +1134,7 @@ v.destroy = function() {
}
return Promise.all(a);
};
function Ca(a, b) {
function Fa(a, b) {
const c = new Map();
let d = b.index || b.field || b;
G(d) && (d = [d]);
@@ -1122,19 +1147,19 @@ function Ca(a, b) {
c.set(f, h);
}
this.worker || c.set(f, new L(g, this.reg));
g.custom ? this.D[e] = g.custom : (this.D[e] = Ba(f, this.K), g.filter && ("string" === typeof this.D[e] && (this.D[e] = new String(this.D[e])), this.D[e].I = g.filter));
g.custom ? this.D[e] = g.custom : (this.D[e] = Ea(f, this.K), g.filter && ("string" === typeof this.D[e] && (this.D[e] = new String(this.D[e])), this.D[e].I = g.filter));
this.field[e] = f;
}
if (this.C) {
a = b.store;
G(a) && (a = [a]);
for (let e = 0, f, g; e < a.length; e++) {
f = a[e], g = f.field || f, f.custom ? (this.C[e] = f.custom, f.custom.U = g) : (this.C[e] = Ba(g, this.K), f.filter && ("string" === typeof this.C[e] && (this.C[e] = new String(this.C[e])), this.C[e].I = f.filter));
f = a[e], g = f.field || f, f.custom ? (this.C[e] = f.custom, f.custom.U = g) : (this.C[e] = Ea(g, this.K), f.filter && ("string" === typeof this.C[e] && (this.C[e] = new String(this.C[e])), this.C[e].I = f.filter));
}
}
return c;
}
function Ba(a, b) {
function Ea(a, b) {
const c = a.split(":");
let d = 0;
for (let e = 0; e < c.length; e++) {
@@ -1200,65 +1225,70 @@ v.set = function(a, b) {
this.store.set(a, b);
return this;
};
v.searchCache = Da;
v.export = function(a, b, c, d, e, f) {
let g;
"undefined" === typeof f && (g = new Promise(k => {
f = k;
}));
e || (e = 0);
d || (d = 0);
if (d < this.field.length) {
c = this.field[d];
var h = this.index[c];
b = this;
h.export(a, b, e ? c : "", d, e++, f) || (d++, b.export(a, b, c, d, 1, f));
} else {
switch(e) {
v.searchCache = Ga;
v.export = function(a, b, c = 0, d = 0) {
if (c < this.field.length) {
const g = this.field[c];
if ((b = this.index.get(g).export(a, g, c, d = 1)) && b.then) {
const h = this;
return b.then(function() {
return h.export(a, g, c + 1, d = 0);
});
}
return this.export(a, g, c + 1, d = 0);
}
let e, f;
switch(d) {
case 0:
e = "reg";
f = qa(this.reg);
b = null;
break;
case 1:
b = "tag";
h = this.A;
c = null;
e = "tag";
f = pa(this.tag);
b = null;
break;
case 2:
b = "store";
h = this.store;
c = null;
e = "doc";
f = oa(this.store);
b = null;
break;
case 3:
e = "cfg";
f = {};
b = null;
break;
default:
f();
return;
}
oa(a, this, c, b, d, e, h, f);
}
return g;
return ra.call(this, a, b, e, c, d, f);
};
v.import = function(a, b) {
if (b) {
switch(G(b) && (b = JSON.parse(b)), a) {
case "tag":
this.A = b;
break;
case "reg":
this.fastupdate = !1;
this.reg = b;
this.reg = new Set(b);
for (let d = 0, e; d < this.field.length; d++) {
e = this.index[this.field[d]], e.reg = b, e.fastupdate = !1;
e = this.index.get(this.field[d]), e.fastupdate = !1, e.reg = this.reg;
}
break;
case "store":
this.store = b;
case "doc":
this.store = new Map(b);
break;
default:
a = a.split(".");
const c = a[0];
a = a[1];
c && a && this.index[c].import(a, b);
c && a && this.index.get(c).import(a, b);
}
}
};
na(T.prototype);
function Da(a, b, c) {
function Ga(a, b, c) {
a = ("object" === typeof a ? "" + a.query : a).toLowerCase();
let d = this.cache.get(a);
if (!d) {
@@ -1298,31 +1328,31 @@ U.prototype.clear = function() {
this.cache.clear();
this.h = "";
};
const Ea = {normalize:function(a) {
const Ha = {normalize:function(a) {
return a.toLowerCase();
}, dedupe:!1};
const Fa = 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 Ga = new Map([["ae", "a"], ["oe", "o"], ["sh", "s"], ["kh", "k"], ["th", "t"], ["pf", "f"]]), Ha = [/([^aeo])h(.)/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2", /([^0-9])\1+/g, "$1"];
const Ia = {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 Ja = /[\x00-\x7F]+/g;
const Ka = /[\x00-\x7F]+/g;
const La = /[\x00-\x7F]+/g;
var Ma = {LatinExact:{normalize:!1, dedupe:!1}, LatinDefault:Ea, LatinSimple:{normalize:!0, dedupe:!0}, LatinBalance:{normalize:!0, dedupe:!0, mapper:Fa}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:Fa, matcher:Ga, replacer:Ha}, LatinExtra:{normalize:!0, dedupe:!0, mapper:Fa, replacer:Ha.concat([/(?!^)[aeo]/g, ""]), matcher:Ga}, LatinSoundex:{normalize:!0, dedupe:!1, include:{letter:!0}, finalize:function(a) {
const Ia = 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 Ja = new Map([["ae", "a"], ["oe", "o"], ["sh", "s"], ["kh", "k"], ["th", "t"], ["pf", "f"]]), Ka = [/([^aeo])h(.)/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2", /([^0-9])\1+/g, "$1"];
const La = {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 Ma = /[\x00-\x7F]+/g;
const Na = /[\x00-\x7F]+/g;
const Oa = /[\x00-\x7F]+/g;
var Pa = {LatinExact:{normalize:!1, dedupe:!1}, LatinDefault:Ha, LatinSimple:{normalize:!0, dedupe:!0}, LatinBalance:{normalize:!0, dedupe:!0, mapper:Ia}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:Ia, matcher:Ja, replacer:Ka}, LatinExtra:{normalize:!0, dedupe:!0, mapper:Ia, replacer:Ka.concat([/(?!^)[aeo]/g, ""]), matcher:Ja}, LatinSoundex:{normalize:!0, dedupe:!1, include:{letter:!0}, finalize:function(a) {
for (let c = 0; c < a.length; c++) {
var b = a[c];
let d = b.charAt(0), e = Ia[d];
for (let f = 1, g; f < b.length && (g = b.charAt(f), "h" === g || "w" === g || !(g = Ia[g]) || g === e || (d += g, e = g, 4 !== d.length)); f++) {
let d = b.charAt(0), e = La[d];
for (let f = 1, g; f < b.length && (g = b.charAt(f), "h" === g || "w" === g || !(g = La[g]) || g === e || (d += g, e = g, 4 !== d.length)); f++) {
}
a[c] = d;
}
}}, ArabicDefault:{rtl:!0, normalize:!1, dedupe:!0, prepare:function(a) {
return ("" + a).replace(Ja, " ");
return ("" + a).replace(Ma, " ");
}}, CjkDefault:{normalize:!1, dedupe:!0, split:"", prepare:function(a) {
return ("" + a).replace(Ka, "");
return ("" + a).replace(Na, "");
}}, CyrillicDefault:{normalize:!1, dedupe:!0, prepare:function(a) {
return ("" + a).replace(La, " ");
return ("" + a).replace(Oa, " ");
}}};
const Na = {memory:{resolution:1}, performance:{resolution:6, fastupdate:!0, context:{depth:1, resolution:3}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:9}}};
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}}};
B();
L.prototype.add = function(a, b, c, d) {
if (b && (a || 0 === a)) {
@@ -1336,14 +1366,14 @@ L.prototype.add = function(a, b, c, d) {
let t = b[this.rtl ? d - 1 - q : q];
var e = t.length;
if (e && (p || !m[t])) {
var f = this.score ? this.score(b, t, q, null, 0) : Oa(n, d, q), g = "";
var f = this.score ? this.score(b, t, q, null, 0) : Ra(n, d, q), g = "";
switch(this.tokenize) {
case "full":
if (2 < e) {
for (f = 0; f < e; f++) {
for (var h = e; h > f; h--) {
g = t.substring(f, h);
var k = this.score ? this.score(b, t, q, g, f) : Oa(n, d, q, e, f);
var k = this.score ? this.score(b, t, q, g, f) : Ra(n, d, q, e, f);
V(this, m, g, k, a, c);
}
}
@@ -1352,7 +1382,7 @@ L.prototype.add = function(a, b, c, d) {
case "reverse":
if (1 < e) {
for (h = e - 1; 0 < h; h--) {
g = t[h] + g, k = this.score ? this.score(b, t, q, g, h) : Oa(n, d, q, e, h), V(this, m, g, k, a, c);
g = t[h] + g, k = this.score ? this.score(b, t, q, g, h) : Ra(n, d, q, e, h), V(this, m, g, k, a, c);
}
g = "";
}
@@ -1368,7 +1398,7 @@ L.prototype.add = function(a, b, c, d) {
for (e = B(), g = this.R, f = t, h = Math.min(p + 1, d - q), e[f] = 1, k = 1; k < h; k++) {
if ((t = b[this.rtl ? d - 1 - q - k : q + k]) && !e[t]) {
e[t] = 1;
const r = this.score ? this.score(b, f, q, t, k) : Oa(g + (d / 2 > g ? 0 : 1), d, q, h - 1, k - 1), u = this.bidirectional && t > f;
const r = this.score ? this.score(b, f, q, t, k) : Ra(g + (d / 2 > g ? 0 : 1), d, q, h - 1, k - 1), u = this.bidirectional && t > f;
V(this, l, u ? f : t, r, a, c, u ? t : f);
}
}
@@ -1381,7 +1411,7 @@ L.prototype.add = function(a, b, c, d) {
b = "";
}
}
this.db && (b || this.commit_task.push({del:a}), this.T && Pa(this));
this.db && (b || this.commit_task.push({del:a}), this.T && Sa(this));
return this;
};
function V(a, b, c, d, e, f, g) {
@@ -1402,12 +1432,12 @@ function V(a, b, c, d, e, f, g) {
}
}
}
function Oa(a, b, c, d, e) {
function Ra(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;
}
;function W(a, b, c, d) {
if (1 === a.length) {
return a = a[0], a = c || a.length > b ? b ? a.slice(c, c + b) : a.slice(c) : a, d ? Qa(a) : a;
return a = a[0], a = c || a.length > b ? b ? a.slice(c, c + b) : a.slice(c) : a, d ? Ta(a) : a;
}
let e = [];
for (let f = 0, g, h; f < a.length; f++) {
@@ -1423,7 +1453,7 @@ function Oa(a, b, c, d, e) {
h > b && (g = g.slice(0, b), h = g.length), e.push(g);
} else {
if (h >= b) {
return h > b && (g = g.slice(0, b)), d ? Qa(g) : g;
return h > b && (g = g.slice(0, b)), d ? Ta(g) : g;
}
e = [g];
}
@@ -1437,9 +1467,9 @@ function Oa(a, b, c, d, e) {
return e;
}
e = 1 < e.length ? [].concat.apply([], e) : e[0];
return d ? Qa(e) : e;
return d ? Ta(e) : e;
}
function Qa(a) {
function Ta(a) {
for (let b = 0; b < a.length; b++) {
a[b] = {score:b, id:a[b]};
}
@@ -1489,19 +1519,19 @@ function Qa(a) {
if (c.length) {
return Promise.all(c).then(function() {
a.result.length && (d = d.concat([a.result]));
a.result = Ra(d, e, f, g, h, a.F);
a.result = Ua(d, e, f, g, h, a.F);
return h ? a.result : a;
});
}
d.length && (this.result.length && (d = d.concat([this.result])), this.result = Ra(d, e, f, g, h, this.F));
d.length && (this.result.length && (d = d.concat([this.result])), this.result = Ua(d, e, f, g, h, this.F));
return h ? this.result : this;
};
function Ra(a, b, c, d, e, f) {
function Ua(a, b, c, d, e, f) {
if (!a.length) {
return a;
}
"object" === typeof b && (c = b.offset || 0, d = b.enrich || !1, b = b.limit || 0);
return 2 > a.length ? e ? W(a[0], b, c, d) : a[0] : va(a, c, b, e, f);
return 2 > a.length ? e ? W(a[0], b, c, d) : a[0] : ya(a, c, b, e, f);
}
;X.prototype.and = function() {
if (this.result.length) {
@@ -1551,24 +1581,24 @@ function Ra(a, b, c, d, e, f) {
if (a.length) {
return Promise.all(a).then(function() {
d = [b.result].concat(d);
b.result = Sa(d, e, f, g, b.F, h);
b.result = Va(d, e, f, g, b.F, h);
return g ? b.result : b;
});
}
d = [this.result].concat(d);
this.result = Sa(d, e, f, g, this.F, h);
this.result = Va(d, e, f, g, this.F, h);
return g ? this.result : this;
}
return this;
};
function Sa(a, b, c, d, e, f) {
function Va(a, b, c, d, e, f) {
if (2 > a.length) {
return [];
}
let g = [];
B();
let h = ca(a);
return h ? ua(a, h, b, c, f, e, d) : g;
return h ? xa(a, h, b, c, f, e, d) : g;
}
;X.prototype.xor = function() {
const a = this;
@@ -1614,14 +1644,14 @@ function Sa(a, b, c, d, e, f) {
if (c.length) {
return Promise.all(c).then(function() {
a.result.length && (d = [a.result].concat(d));
a.result = Ta(d, e, f, g, !h, a.F);
a.result = Wa(d, e, f, g, !h, a.F);
return h ? a.result : a;
});
}
d.length && (this.result.length && (d = [this.result].concat(d)), this.result = Ta(d, e, f, g, !h, a.F));
d.length && (this.result.length && (d = [this.result].concat(d)), this.result = Wa(d, e, f, g, !h, a.F));
return h ? this.result : this;
};
function Ta(a, b, c, d, e, f) {
function Wa(a, b, c, d, e, f) {
if (!a.length) {
return a;
}
@@ -1715,14 +1745,14 @@ function Ta(a, b, c, d, e, f) {
}
if (c.length) {
return Promise.all(c).then(function() {
a.result = Ua.call(a, d, e, f, g);
a.result = Xa.call(a, d, e, f, g);
return g ? a.result : a;
});
}
d.length && (this.result = Ua.call(this, d, e, f, g));
d.length && (this.result = Xa.call(this, d, e, f, g));
return g ? this.result : this;
};
function Ua(a, b, c, d) {
function Xa(a, b, c, d) {
if (!a.length) {
return this.result;
}
@@ -1752,7 +1782,7 @@ function Ua(a, b, c, d) {
return e;
}
;function X(a) {
if (!this) {
if (this.constructor !== X) {
return new X(a);
}
if (a && a.index) {
@@ -1797,12 +1827,12 @@ X.prototype.boost = function(a) {
return this;
};
X.prototype.resolve = function(a, b, c) {
Va = 1;
Ya = 1;
const d = this.result;
this.result = this.index = null;
return d.length ? ("object" === typeof a && (c = a.enrich, b = a.offset, a = a.limit), W(d, a || 100, b, c)) : d;
};
let Va = 1;
let Ya = 1;
L.prototype.search = function(a, b, c) {
c || (!b && H(a) ? (c = a, a = "") : H(b) && (c = b, b = 0));
let d = [], e;
@@ -1813,22 +1843,22 @@ L.prototype.search = function(a, b, c) {
g = c.offset || 0;
var p = c.context;
f = c.suggest;
(h = Va && !1 !== c.resolve) || (Va = 0);
(h = Ya && !1 !== c.resolve) || (Ya = 0);
k = h && c.enrich;
m = c.boost;
l = this.db && c.tag;
} else {
h = this.resolve || Va;
h = this.resolve || Ya;
}
a = this.encoder.encode(a);
e = a.length;
b || !h || (b = 100);
if (1 === e) {
return Wa.call(this, a[0], "", b, g, h, k, l);
return Za.call(this, a[0], "", b, g, h, k, l);
}
p = this.depth && !1 !== p;
if (2 === e && p && !f) {
return Wa.call(this, a[0], a[1], b, g, h, k, l);
return Za.call(this, a[0], a[1], b, g, h, k, l);
}
let n = c = 0;
if (1 < e) {
@@ -1853,10 +1883,10 @@ L.prototype.search = function(a, b, c) {
}
let q = 0, t;
if (1 === e) {
return Wa.call(this, a[0], "", b, g, h, k, l);
return Za.call(this, a[0], "", b, g, h, k, l);
}
if (2 === e && p && !f) {
return Wa.call(this, a[0], a[1], b, g, h, k, l);
return Za.call(this, a[0], a[1], b, g, h, k, l);
}
1 < e && (p ? (t = a[0], q = 1) : 9 < c && 3 < c / n && a.sort(aa));
if (this.db) {
@@ -1867,7 +1897,7 @@ L.prototype.search = function(a, b, c) {
return async function() {
for (let u, x; q < e; q++) {
x = a[q];
t ? (u = await Y(r, x, t, 0, 0, !1, !1), u = Xa(u, d, f, r.R), f && !1 === u && d.length || (t = x)) : (u = await Y(r, x, "", 0, 0, !1, !1), u = Xa(u, d, f, r.resolution));
t ? (u = await Y(r, x, t, 0, 0, !1, !1), u = $a(u, d, f, r.R), f && !1 === u && d.length || (t = x)) : (u = await Y(r, x, "", 0, 0, !1, !1), u = $a(u, d, f, r.resolution));
if (u) {
return u;
}
@@ -1886,12 +1916,12 @@ L.prototype.search = function(a, b, c) {
}
}
}
return h ? ua(d, r.resolution, b, g, f, m, h) : new X(d[0]);
return h ? xa(d, r.resolution, b, g, f, m, h) : new X(d[0]);
}();
}
for (let r, u; q < e; q++) {
u = a[q];
t ? (r = Y(this, u, t, 0, 0, !1, !1), r = Xa(r, d, f, this.R), f && !1 === r && d.length || (t = u)) : (r = Y(this, u, "", 0, 0, !1, !1), r = Xa(r, d, f, this.resolution));
t ? (r = Y(this, u, t, 0, 0, !1, !1), r = $a(r, d, f, this.R), f && !1 === r && d.length || (t = u)) : (r = Y(this, u, "", 0, 0, !1, !1), r = $a(r, d, f, this.resolution));
if (r) {
return r;
}
@@ -1910,16 +1940,16 @@ L.prototype.search = function(a, b, c) {
}
}
}
d = ua(d, this.resolution, b, g, f, m, h);
d = xa(d, this.resolution, b, g, f, m, h);
return h ? d : new X(d);
};
function Wa(a, b, c, d, e, f, g) {
function Za(a, b, c, d, e, f, g) {
a = Y(this, a, b, c, d, e, f, g);
return this.db ? a.then(function(h) {
return e ? h : h && h.length ? e ? W(h, c, d) : new X(h) : e ? [] : new X([]);
}) : a && a.length ? e ? W(a, c, d) : new X(a) : e ? [] : new X([]);
}
function Xa(a, b, c, d) {
function $a(a, b, c, d) {
let e = [];
if (a) {
d = Math.min(a.length, d);
@@ -1957,15 +1987,15 @@ function Y(a, b, c, d, e, f, g, h) {
}
}
} else {
Ya(this.map, a), this.depth && Ya(this.ctx, a);
ab(this.map, a), this.depth && ab(this.ctx, a);
}
b || this.reg.delete(a);
}
this.db && (this.commit_task.push({del:a}), this.T && Pa(this));
this.db && (this.commit_task.push({del:a}), this.T && Sa(this));
this.cache && this.cache.remove(a);
return this;
};
function Ya(a, b) {
function ab(a, b) {
let c = 0;
if (a.constructor === Array) {
for (let d = 0, e, f; d < a.length; d++) {
@@ -1980,24 +2010,24 @@ function Ya(a, b) {
}
} else {
for (let d of a) {
const e = d[0], f = Ya(d[1], b);
const e = d[0], f = ab(d[1], b);
f ? c += f : a.delete(e);
}
}
return c;
}
;function L(a, b) {
if (!this) {
if (this.constructor !== L) {
return new L(a);
}
if (a) {
var c = G(a) ? a : a.preset;
c && (Na[c] || console.warn("Preset not found: " + c), a = Object.assign({}, Na[c], a));
c && (Qa[c] || console.warn("Preset not found: " + c), a = Object.assign({}, Qa[c], a));
} else {
a = {};
}
c = a.context || {};
const d = G(a.encoder) ? Ma[a.encoder] : a.encode || a.encoder || Ea;
const d = G(a.encoder) ? Pa[a.encoder] : a.encode || a.encoder || Ha;
this.encoder = d.encode ? d : "object" === typeof d ? new K(d) : {encode:d};
let e;
this.resolution = a.resolution || 9;
@@ -2034,7 +2064,7 @@ v.destroy = function() {
this.commit_timer && (clearTimeout(this.commit_timer), this.commit_timer = null);
return this.db.destroy();
};
function Pa(a) {
function Sa(a) {
a.commit_timer || (a.commit_timer = setTimeout(function() {
a.commit_timer = null;
a.db.commit(a, void 0, void 0);
@@ -2058,7 +2088,7 @@ v.update = function(a, b) {
const c = this, d = this.remove(a);
return d && d.then ? d.then(() => c.add(a, b)) : this.add(a, b);
};
function Za(a) {
function bb(a) {
let b = 0;
if (a.constructor === Array) {
for (let c = 0, d; c < a.length; c++) {
@@ -2066,7 +2096,7 @@ function Za(a) {
}
} else {
for (const c of a) {
const d = c[0], e = Za(c[1]);
const d = c[0], e = bb(c[1]);
e ? b += e : a.delete(d);
}
}
@@ -2076,63 +2106,47 @@ v.cleanup = function() {
if (!this.fastupdate) {
return console.info('Cleanup the index isn\'t required when not using "fastupdate".'), this;
}
Za(this.map);
this.depth && Za(this.ctx);
bb(this.map);
this.depth && bb(this.ctx);
return this;
};
v.searchCache = Da;
v.export = function(a, b, c, d, e, f) {
let g = !0;
"undefined" === typeof f && (g = new Promise(l => {
f = l;
}));
let h, k;
switch(e || (e = 0)) {
v.searchCache = Ga;
v.export = function(a, b, c, d = 0) {
let e, f;
switch(d) {
case 0:
h = "reg";
if (this.fastupdate) {
k = B();
for (let l of this.reg.keys()) {
k[l] = 1;
}
} else {
k = this.reg;
}
e = "reg";
f = qa(this.reg);
break;
case 1:
h = "cfg";
k = {doc:0, opt:this.h ? 1 : 0};
e = "cfg";
f = {};
break;
case 2:
h = "map";
k = this.map;
e = "map";
f = oa(this.map);
break;
case 3:
h = "ctx";
k = this.ctx;
e = "ctx";
f = pa(this.ctx);
break;
default:
"undefined" === typeof c && f && f();
return;
}
oa(a, b || this, c, h, d, e, k, f);
return g;
return ra.call(this, a, b, e, c, d, f);
};
v.import = function(a, b) {
if (b) {
switch(G(b) && (b = JSON.parse(b)), a) {
case "cfg":
this.h = !!b.opt;
break;
case "reg":
this.fastupdate = !1;
this.reg = b;
this.reg = new Set(b);
break;
case "map":
this.map = b;
this.map = new Map(b);
break;
case "ctx":
this.ctx = b;
this.ctx = new Map(b);
}
}
};
@@ -2187,10 +2201,10 @@ v.serialize = function(a = !0) {
return a ? "function inject(index){" + b + d + e + "}" : b + d + e;
};
na(L.prototype);
const $a = "undefined" !== typeof window && (window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB), ab = ["map", "ctx", "tag", "reg", "cfg"];
function bb(a, b = {}) {
const cb = "undefined" !== typeof window && (window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB), db = ["map", "ctx", "tag", "reg", "cfg"];
function eb(a, b = {}) {
if (!this) {
return new bb(a, b);
return new eb(a, b);
}
"object" === typeof a && (b = a = a.name);
a || console.info("Default storage space was used, because a name was not passed.");
@@ -2200,7 +2214,7 @@ function bb(a, b = {}) {
this.db = null;
this.h = {};
}
v = bb.prototype;
v = eb.prototype;
v.mount = function(a) {
if (!a.encoder) {
return a.mount(this);
@@ -2212,10 +2226,10 @@ v.open = function() {
let a = this;
navigator.storage && navigator.storage.persist();
return this.db || new Promise(function(b, c) {
const d = $a.open(a.id + (a.field ? ":" + a.field : ""), 1);
const d = cb.open(a.id + (a.field ? ":" + a.field : ""), 1);
d.onupgradeneeded = function() {
const e = a.db = this.result;
ab.forEach(f => {
db.forEach(f => {
e.objectStoreNames.contains(f) || e.createObjectStore(f);
});
};
@@ -2241,12 +2255,12 @@ v.close = function() {
this.db = null;
};
v.destroy = function() {
return $a.deleteDatabase(this.id + (this.field ? ":" + this.field : ""));
return cb.deleteDatabase(this.id + (this.field ? ":" + this.field : ""));
};
v.clear = function() {
const a = this.db.transaction(ab, "readwrite");
for (let b = 0; b < ab.length; b++) {
a.objectStore(ab[b]).clear();
const a = this.db.transaction(db, "readwrite");
for (let b = 0; b < db.length; b++) {
a.objectStore(db[b]).clear();
}
return Z(a);
};
@@ -2430,7 +2444,7 @@ v.commit = async function(a, b, c) {
}
}), a.map.clear(), a.ctx.clear(), a.tag && a.tag.clear(), a.store && a.store.clear(), a.document || a.reg.clear());
};
function db(a, b, c) {
function gb(a, b, c) {
const d = a.value;
let e, f, g = 0;
for (let h = 0, k; h < d.length; h++) {
@@ -2459,17 +2473,17 @@ v.remove = function(a) {
return Promise.all([this.transaction("map", "readwrite", function(b) {
b.openCursor().onsuccess = function() {
const c = this.result;
c && db(c, a);
c && gb(c, a);
};
}), this.transaction("ctx", "readwrite", function(b) {
b.openCursor().onsuccess = function() {
const c = this.result;
c && db(c, a);
c && gb(c, a);
};
}), this.transaction("tag", "readwrite", function(b) {
b.openCursor().onsuccess = function() {
const c = this.result;
c && db(c, a, !0);
c && gb(c, a, !0);
};
}), this.transaction("reg", "readwrite", function(b) {
for (let c = 0; c < a.length; c++) {
@@ -2489,9 +2503,9 @@ function Z(a) {
a = null;
});
}
;const eb = {Index:L, Charset:Ma, Encoder:K, Document:T, Worker:N, Resolver:X, IndexedDB:bb, Language:{}}, fb = self;
let gb;
(gb = fb.define) && gb.amd ? gb([], function() {
return eb;
}) : "object" === typeof fb.exports ? fb.exports = eb : fb.FlexSearch = eb;
;const hb = {Index:L, Charset:Pa, Encoder:K, Document:T, Worker:N, Resolver:X, IndexedDB:eb, Language:{}}, ib = self;
let jb;
(jb = ib.define) && jb.amd ? jb([], function() {
return hb;
}) : "object" === typeof ib.exports ? ib.exports = hb : ib.FlexSearch = hb;
}(this||self));

View File

@@ -12,7 +12,7 @@ function F(a){return"string"===typeof a}function G(a){return"object"===typeof a}
"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",
"u"],["\u0217","u"],["\u0219","s"],["\u021b","t"],["\u021f","h"],["\u0227","a"],["\u0229","e"],["\u022b","o"],["\u022d","o"],["\u022f","o"],["\u0231","o"],["\u0233","y"],["\u02b0","h"],["\u02b1","h"],["\u0266","h"],["\u02b2","j"],["\u02b3","r"],["\u02b4","\u0279"],["\u02b5","\u027b"],["\u02b6","\u0281"],["\u02b7","w"],["\u02b8","y"],["\u02e0","\u0263"],["\u02e1","l"],["\u02e2","s"],["\u02e3","x"],["\u02e4","\u0295"],["\u0390","\u03b9"],["\u03ac","\u03b1"],["\u03ad","\u03b5"],["\u03ae","\u03b7"],["\u03af",
"\u03b9"],["\u03b0","\u03c5"],["\u03ca","\u03b9"],["\u03cb","\u03c5"],["\u03cc","\u03bf"],["\u03cd","\u03c5"],["\u03ce","\u03c9"],["\u03d0","\u03b2"],["\u03d1","\u03b8"],["\u03d2","\u03a5"],["\u03d3","\u03a5"],["\u03d4","\u03a5"],["\u03d5","\u03c6"],["\u03d6","\u03c0"],["\u03f0","\u03ba"],["\u03f1","\u03c1"],["\u03f2","\u03c2"],["\u03f5","\u03b5"],["\u0439","\u0438"],["\u0450","\u0435"],["\u0451","\u0435"],["\u0453","\u0433"],["\u0457","\u0456"],["\u045c","\u043a"],["\u045d","\u0438"],["\u045e","\u0443"],
["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]];const ea=/[^\p{L}\p{N}]+/u,fa=/(\d{3})/g,ha=/(\D)(\d{3})/g,ia=/(\d{3})(\D)/g,ja="".normalize&&/[\u0300-\u036f]/g;function K(a){if(!this)return new K(...arguments);for(let b=0;b<arguments.length;b++)this.assign(arguments[b])}
["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]];const ea=/[^\p{L}\p{N}]+/u,fa=/(\d{3})/g,ha=/(\D)(\d{3})/g,ia=/(\d{3})(\D)/g,ja="".normalize&&/[\u0300-\u036f]/g;function K(a){if(this.constructor!==K)return new K(...arguments);for(let b=0;b<arguments.length;b++)this.assign(arguments[b])}
K.prototype.assign=function(a){this.normalize=z(a.normalize,!0,this.normalize);let b=a.include,c=b||a.exclude||a.split;if("object"===typeof c){let d=!b,e="";a.include||(e+="\\p{Z}");c.letter&&(e+="\\p{L}");c.number&&(e+="\\p{N}",d=!!b);c.symbol&&(e+="\\p{S}");c.punctuation&&(e+="\\p{P}");c.control&&(e+="\\p{C}");if(c=c.char)e+="object"===typeof c?c.join(""):c;try{this.split=new RegExp("["+(b?"^":"")+e+"]+","u")}catch(f){this.split=/\s+/}this.numeric=d}else{try{this.split=z(c,ea,this.split)}catch(d){this.split=
/\s+/}this.numeric=z(this.numeric,!0)}this.prepare=z(a.prepare,null,this.prepare);this.finalize=z(a.finalize,null,this.finalize);ja||(this.mapper=new Map(da));this.rtl=a.rtl||!1;this.dedupe=z(a.dedupe,!0,this.dedupe);this.filter=z((c=a.filter)&&new Set(c),null,this.filter);this.matcher=z((c=a.matcher)&&new Map(c),null,this.matcher);this.mapper=z((c=a.mapper)&&new Map(c),null,this.mapper);this.stemmer=z((c=a.stemmer)&&new Map(c),null,this.stemmer);this.replacer=z(a.replacer,null,this.replacer);this.minlength=
z(a.minlength,1,this.minlength);this.maxlength=z(a.maxlength,0,this.maxlength);if(this.cache=c=z(a.cache,!0,this.cache))this.L=null,this.S="number"===typeof c?c:2E5,this.H=new Map,this.J=new Map,this.A=this.h=128;this.B="";this.O=null;this.M="";this.P=null;if(this.matcher)for(const d of this.matcher.keys())this.B+=(this.B?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.M+=(this.M?"|":"")+d;return this};
@@ -20,72 +20,72 @@ K.prototype.encode=function(a){if(this.cache&&a.length<=this.h)if(this.L){if(thi
let c=[],d=this.split||""===this.split?a.split(this.split):a;for(let f=0,g,h;f<d.length;f++){if(!(g=h=d[f]))continue;if(g.length<this.minlength)continue;if(b){c.push(g);continue}if(this.filter&&this.filter.has(g))continue;if(this.cache&&g.length<=this.A)if(this.L){var e=this.J.get(g);if(e||""===e){e&&c.push(e);continue}}else this.L=setTimeout(ka,50,this);let k;this.stemmer&&2<g.length&&(this.P||(this.P=new RegExp("(?!^)("+this.M+")$")),g=g.replace(this.P,l=>this.stemmer.get(l)),k=1);g&&k&&(g.length<
this.minlength||this.filter&&this.filter.has(g))&&(g="");if(g&&(this.mapper||this.dedupe&&1<g.length)){e="";for(let l=0,m="",p,n;l<g.length;l++)p=g.charAt(l),p===m&&this.dedupe||((n=this.mapper&&this.mapper.get(p))||""===n?n===m&&this.dedupe||!(m=n)||(e+=n):e+=m=p);g=e}this.matcher&&1<g.length&&(this.O||(this.O=new RegExp("("+this.B+")","g")),g=g.replace(this.O,l=>this.matcher.get(l)));if(g&&this.replacer)for(e=0;g&&e<this.replacer.length;e+=2)g=g.replace(this.replacer[e],this.replacer[e+1]);this.cache&&
h.length<=this.A&&(this.J.set(h,g),this.J.size>this.S&&(this.J.clear(),this.A=this.A/1.1|0));g&&c.push(g)}this.finalize&&(c=this.finalize(c)||c);this.cache&&a.length<=this.h&&(this.H.set(a,c),this.H.size>this.S&&(this.H.clear(),this.h=this.h/1.1|0));return c};function ka(a){a.L=null;a.H.clear();a.J.clear()};async function la(a){a=a.data;var b=self._index;const c=a.args;var d=a.task;switch(d){case "init":d=a.options||{};(b=d.config)&&(d=(await import(b))["default"]);(b=a.factory)?(Function("return "+b)()(self),self._index=new self.FlexSearch.Index(d),delete self.FlexSearch):self._index=new L(d);postMessage({id:a.id});break;default:a=a.id,b=b[d].apply(b,c),postMessage("search"===d?{id:a,msg:b}:{id:a})}};let M=0;
function N(a={}){function b(g){function h(k){k=k.data||k;const l=k.id,m=l&&e.h[l];m&&(m(k.msg),delete e.h[l])}this.worker=g;this.h=B();if(this.worker){d?this.worker.on("message",h):this.worker.onmessage=h;if(a.config)return new Promise(function(k){e.h[++M]=function(){k(e)};e.worker.postMessage({id:M,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",factory:c,options:a});return this}}if(!this)return new N(a);let c="undefined"!==typeof self?self._factory:"undefined"!==typeof window?
window._factory:null;c&&(c=c.toString());const d="undefined"===typeof window,e=this,f=ma(c,d,a.worker);return f.then?f.then(function(g){return b.call(e,g)}):b.call(this,f)}O("add");O("append");O("search");O("update");O("remove");
function N(a={}){function b(g){function h(k){k=k.data||k;const l=k.id,m=l&&e.h[l];m&&(m(k.msg),delete e.h[l])}this.worker=g;this.h=B();if(this.worker){d?this.worker.on("message",h):this.worker.onmessage=h;if(a.config)return new Promise(function(k){e.h[++M]=function(){k(e)};e.worker.postMessage({id:M,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",factory:c,options:a});return this}}if(this.constructor!==N)return new N(a);let c="undefined"!==typeof self?self._factory:"undefined"!==
typeof window?window._factory:null;c&&(c=c.toString());const d="undefined"===typeof window,e=this,f=ma(c,d,a.worker);return f.then?f.then(function(g){return b.call(e,g)}):b.call(this,f)}O("add");O("append");O("search");O("update");O("remove");
function O(a){N.prototype[a]=N.prototype[a+"Async"]=async function(){const b=this,c=[].slice.call(arguments);var d=c[c.length-1];let e;"function"===typeof d&&(e=d,c.splice(c.length-1,1));d=new Promise(function(f){b.h[++M]=f;b.worker.postMessage({task:a,id:M,args:c})});return e?(d.then(e),this):d}}
function ma(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="+la.toString()],{type:"text/javascript"}))):new window.Worker(F(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 na(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}function P(a){this[a+"Async"]=function(){var b=arguments;const c=b[b.length-1];let d;"function"===typeof c&&(d=c,delete b[b.length-1]);b=this[a].apply(this,b);d&&(b.then?b.then(d):d(b));return b}};function oa(a,b,c,d,e,f,g,h){(d=a(c?c+"."+d:d,JSON.stringify(g)))&&d.then?d.then(function(){b.export(a,b,c,e,f+1,h)}):b.export(a,b,c,e,f+1,h)};function pa(a,b,c,d){let e=[];for(let f=0,g;f<a.index.length;f++)if(g=a.index[f],b>=g.length)b-=g.length;else{b=g[d?"splice":"slice"](b,c);const h=b.length;if(h&&(e=e.length?e.concat(b):b,c-=h,d&&(a.length-=h),!c))break;b=0}return e}
"module/worker/worker.js"),{type:"module"})};function na(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}function P(a){this[a+"Async"]=function(){var b=arguments;const c=b[b.length-1];let d;"function"===typeof c&&(d=c,delete b[b.length-1]);b=this[a].apply(this,b);d&&(b.then?b.then(d):d(b));return b}};function oa(a){const b=[];for(const c of a.entries())b.push(c);return b}function pa(a){const b=[];for(const c of a.entries())b.push(oa(c));return b}function qa(a){const b=[];for(const c of a.keys())b.push(c);return b}function ra(a,b,c,d,e,f){if((c=a(b?b+"."+c:c,JSON.stringify(f)))&&c.then){const g=this;return c.then(function(){return g.export(a,b,d,e+1)})}return this.export(a,b,d,e+1)};function sa(a,b,c,d){let e=[];for(let f=0,g;f<a.index.length;f++)if(g=a.index[f],b>=g.length)b-=g.length;else{b=g[d?"splice":"slice"](b,c);const h=b.length;if(h&&(e=e.length?e.concat(b):b,c-=h,d&&(a.length-=h),!c))break;b=0}return e}
function Q(a){if(!this)return new Q(a);this.index=a?[a]:[];this.length=a?a.length:0;const b=this;return new Proxy([],{get(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){let f=0;for(let g=0,h,k;g<b.index.length;g++){h=b.index[g];k=h.indexOf(e);if(0<=k)return f+k;f+=h.length}return-1};if("includes"===d)return function(e){for(let f=
0;f<b.index.length;f++)if(b.index[f].includes(e))return!0;return!1};if("slice"===d)return function(e,f){return pa(b,e||0,f||b.length,!1)};if("splice"===d)return function(e,f){return pa(b,e||0,f||b.length,!0)};if("constructor"===d)return Array;if("symbol"!==typeof d)return(c=b.index[d/2**31|0])&&c[d]},set(c,d,e){c=d/2**31|0;(b.index[c]||(b.index[c]=[]))[d]=e;b.length++;return!0}})}Q.prototype.clear=function(){this.index.length=0};Q.prototype.destroy=function(){this.proxy=this.index=null};
Q.prototype.push=function(){};function R(a=8){if(!this)return new R(a);this.index=B();this.B=[];this.size=0;32<a?(this.h=qa,this.A=BigInt(a)):(this.h=ra,this.A=a)}R.prototype.get=function(a){const b=this.index[this.h(a)];return b&&b.get(a)};R.prototype.set=function(a,b){var c=this.h(a);let 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 S(a=8){if(!this)return new S(a);this.index=B();this.h=[];32<a?(this.B=qa,this.A=BigInt(a)):(this.B=ra,this.A=a)}S.prototype.add=function(a){var b=this.B(a);let 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))};v=R.prototype;v.has=S.prototype.has=function(a){const b=this.index[this.B(a)];return b&&b.has(a)};v.delete=S.prototype.delete=function(a){const b=this.index[this.B(a)];b&&b.delete(a)&&this.size--};
0;f<b.index.length;f++)if(b.index[f].includes(e))return!0;return!1};if("slice"===d)return function(e,f){return sa(b,e||0,f||b.length,!1)};if("splice"===d)return function(e,f){return sa(b,e||0,f||b.length,!0)};if("constructor"===d)return Array;if("symbol"!==typeof d)return(c=b.index[d/2**31|0])&&c[d]},set(c,d,e){c=d/2**31|0;(b.index[c]||(b.index[c]=[]))[d]=e;b.length++;return!0}})}Q.prototype.clear=function(){this.index.length=0};Q.prototype.destroy=function(){this.proxy=this.index=null};
Q.prototype.push=function(){};function R(a=8){if(!this)return new R(a);this.index=B();this.B=[];this.size=0;32<a?(this.h=ta,this.A=BigInt(a)):(this.h=ua,this.A=a)}R.prototype.get=function(a){const b=this.index[this.h(a)];return b&&b.get(a)};R.prototype.set=function(a,b){var c=this.h(a);let 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 S(a=8){if(!this)return new S(a);this.index=B();this.h=[];32<a?(this.B=ta,this.A=BigInt(a)):(this.B=ua,this.A=a)}S.prototype.add=function(a){var b=this.B(a);let 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))};v=R.prototype;v.has=S.prototype.has=function(a){const b=this.index[this.B(a)];return b&&b.has(a)};v.delete=S.prototype.delete=function(a){const b=this.index[this.B(a)];b&&b.delete(a)&&this.size--};
v.clear=S.prototype.clear=function(){this.index=B();this.h=[];this.size=0};v.values=S.prototype.values=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].values())yield b};v.keys=S.prototype.keys=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].keys())yield b};v.entries=S.prototype.entries=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].entries())yield b};
function ra(a){let b=2**this.A-1;if("number"==typeof a)return a&b;let c=0,d=this.A+1;for(let e=0;e<a.length;e++)c=(c*d^a.charCodeAt(e))&b;return 32===this.A?c+2**31:c}function qa(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 d=this.A+BigInt(1);for(let e=0;e<a.length;e++)c=(c*d^BigInt(a.charCodeAt(e)))&b;return c};T.prototype.add=function(a,b,c){G(a)&&(b=a,a=J(b,this.key));if(b&&(a||0===a)){if(!c&&this.reg.has(a))return this.update(a,b);for(let h=0,k;h<this.field.length;h++){k=this.D[h];var d=this.index.get(this.field[h]);if("function"===typeof k){var e=k(b);e&&d.add(a,e,!1,!0)}else if(e=k.I,!e||e(b))k.constructor===String?k=[""+k]:F(k)&&(k=[k]),sa(b,k,this.K,0,d,a,k[0],c)}if(this.tag)for(d=0;d<this.G.length;d++){var f=this.G[d];e=this.tag.get(this.N[d]);let h=B();if("function"===typeof f){if(f=f(b),!f)continue}else{var g=
function ua(a){let b=2**this.A-1;if("number"==typeof a)return a&b;let c=0,d=this.A+1;for(let e=0;e<a.length;e++)c=(c*d^a.charCodeAt(e))&b;return 32===this.A?c+2**31:c}function ta(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 d=this.A+BigInt(1);for(let e=0;e<a.length;e++)c=(c*d^BigInt(a.charCodeAt(e)))&b;return c};T.prototype.add=function(a,b,c){G(a)&&(b=a,a=J(b,this.key));if(b&&(a||0===a)){if(!c&&this.reg.has(a))return this.update(a,b);for(let h=0,k;h<this.field.length;h++){k=this.D[h];var d=this.index.get(this.field[h]);if("function"===typeof k){var e=k(b);e&&d.add(a,e,!1,!0)}else if(e=k.I,!e||e(b))k.constructor===String?k=[""+k]:F(k)&&(k=[k]),va(b,k,this.K,0,d,a,k[0],c)}if(this.tag)for(d=0;d<this.G.length;d++){var f=this.G[d];e=this.tag.get(this.N[d]);let h=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=J(b,f)}if(e&&f){F(f)&&(f=[f]);for(let k=0,l,m;k<f.length;k++)if(l=f[k],!h[l]&&(h[l]=1,(g=e.get(l))?m=g:e.set(l,m=[]),!c||!m.includes(a))){if(m.length===2**31-1){g=new Q(m);if(this.fastupdate)for(let p of this.reg.values())p.includes(m)&&(p[p.indexOf(m)]=g);e.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 h;if(this.C){h=B();for(let k=0,l;k<this.C.length;k++){l=
this.C[k];if((c=l.I)&&!c(b))continue;let m;if("function"===typeof l){m=l(b);if(!m)continue;l=[l.U]}else if(F(l)||l.constructor===String){h[l]=b[l];continue}ta(b,h,l,0,l[0],m)}}this.store.set(a,h||b)}}return this};function ta(a,b,c,d,e,f){a=a[e];if(d===c.length-1)b[e]=f||a;else if(a)if(a.constructor===Array)for(b=b[e]=Array(a.length),e=0;e<a.length;e++)ta(a,b,c,d,e);else b=b[e]||(b[e]=B()),e=c[++d],ta(a,b,c,d,e)}
function sa(a,b,c,d,e,f,g,h){if(a=a[g])if(d===b.length-1){if(a.constructor===Array){if(c[d]){for(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(a.constructor===Array)for(g=0;g<a.length;g++)sa(a,b,c,d,e,f,g,h);else g=b[++d],sa(a,b,c,d,e,f,g,h);else e.db&&e.remove(f)};function ua(a,b,c,d,e,f,g){const h=a.length;let k=[],l;var m;l=B();for(let p=0,n,q,r,t;p<b;p++)for(let u=0;u<h;u++)if(r=a[u],p<r.length&&(n=r[p]))for(let x=0;x<n.length;x++)q=n[x],(m=l[q])?l[q]++:(m=0,l[q]=1),t=k[m]||(k[m]=[]),g||(m=p+(u?0:f||0),t=t[m]||(t[m]=[])),t.push(q);if(a=k.length)if(e)k=1<k.length?va(k,d,c,g,0):(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(g){if(k.length>c||d)k=k.slice(d,c+d)}else{e=[];for(let p=0,n;p<k.length;p++)if(n=k[p],n.length>d)d-=n.length;
this.C[k];if((c=l.I)&&!c(b))continue;let m;if("function"===typeof l){m=l(b);if(!m)continue;l=[l.U]}else if(F(l)||l.constructor===String){h[l]=b[l];continue}wa(b,h,l,0,l[0],m)}}this.store.set(a,h||b)}}return this};function wa(a,b,c,d,e,f){a=a[e];if(d===c.length-1)b[e]=f||a;else if(a)if(a.constructor===Array)for(b=b[e]=Array(a.length),e=0;e<a.length;e++)wa(a,b,c,d,e);else b=b[e]||(b[e]=B()),e=c[++d],wa(a,b,c,d,e)}
function va(a,b,c,d,e,f,g,h){if(a=a[g])if(d===b.length-1){if(a.constructor===Array){if(c[d]){for(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(a.constructor===Array)for(g=0;g<a.length;g++)va(a,b,c,d,e,f,g,h);else g=b[++d],va(a,b,c,d,e,f,g,h);else e.db&&e.remove(f)};function xa(a,b,c,d,e,f,g){const h=a.length;let k=[],l;var m;l=B();for(let p=0,n,q,r,t;p<b;p++)for(let u=0;u<h;u++)if(r=a[u],p<r.length&&(n=r[p]))for(let x=0;x<n.length;x++)q=n[x],(m=l[q])?l[q]++:(m=0,l[q]=1),t=k[m]||(k[m]=[]),g||(m=p+(u?0:f||0),t=t[m]||(t[m]=[])),t.push(q);if(a=k.length)if(e)k=1<k.length?ya(k,d,c,g,0):(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(g){if(k.length>c||d)k=k.slice(d,c+d)}else{e=[];for(let p=0,n;p<k.length;p++)if(n=k[p],n.length>d)d-=n.length;
else{if(n.length>c||d)n=n.slice(d,c+d),c-=n.length,d&&(d-=n.length);e.push(n);if(!c)break}k=1<e.length?[].concat.apply([],e):e[0]}}return k}
function va(a,b,c,d,e){const f=[],g=B();let h;var k=a.length;let l,m=0;if(d)for(e=k-1;0<=e;e--)for(d=a[e],l=d.length,k=0;k<l;k++){if(h=d[k],!g[h])if(g[h]=1,b)b--;else if(f.push(h),f.length===c)return f}else{let p=ca(a);for(let n=0;n<p;n++)for(let q=k-1;0<=q;q--)if(l=(d=a[q][n])&&d.length)for(let r=0;r<l;r++)if(h=d[r],!g[h])if(g[h]=1,b)b--;else{let t=n+(q<k-1?e||0:0);(f[t]||(f[t]=[])).push(h);if(++m===c)return f}}return f}
function wa(a,b){const c=B(),d=[];for(let e=0,f;e<b.length;e++){f=b[e];for(let g=0;g<f.length;g++)c[f[g]]=1}for(let e=0,f;e<a.length;e++)f=a[e],1===c[f]&&(d.push(f),c[f]=2);return d};T.prototype.search=function(a,b,c,d){c||(!b&&G(a)?(c=a,a=""):G(b)&&(c=b,b=0));let e=[],f=[],g;let h;let k;let l,m=0,p;if(c){c.constructor===Array&&(c={index:c});a=c.query||a;g=c.pluck;h=c.merge;k=g||c.field||c.index;var n=this.tag&&c.tag;var q=this.store&&c.enrich;var r=c.suggest;p=c.V;b=c.limit||b;l=c.offset||0;b||(b=100);if(n&&(!this.db||!d)){n.constructor!==Array&&(n=[n]);var t=[];for(let y=0,w;y<n.length;y++)if(w=n[y],w.field&&w.tag){var u=w.tag;if(u.constructor===Array)for(var x=0;x<u.length;x++)t.push(w.field,
u[x]);else t.push(w.field,u)}else{u=Object.keys(w);for(let A=0,H,C;A<u.length;A++)if(H=u[A],C=w[H],C.constructor===Array)for(x=0;x<C.length;x++)t.push(H,C[x]);else t.push(H,C)}n=t;if(!a){r=[];if(t.length)for(n=0;n<t.length;n+=2){if(this.db){d=this.index.get(t[n]);if(!d)continue;r.push(d=d.db.tag(t[n+1],b,l,q))}else d=xa.call(this,t[n],t[n+1],b,l,q);e.push({field:t[n],tag:t[n+1],result:d})}return r.length?Promise.all(r).then(function(y){for(let w=0;w<y.length;w++)e[w].result=y[w];return e}):e}}F(k)&&
function ya(a,b,c,d,e){const f=[],g=B();let h;var k=a.length;let l,m=0;if(d)for(e=k-1;0<=e;e--)for(d=a[e],l=d.length,k=0;k<l;k++){if(h=d[k],!g[h])if(g[h]=1,b)b--;else if(f.push(h),f.length===c)return f}else{let p=ca(a);for(let n=0;n<p;n++)for(let q=k-1;0<=q;q--)if(l=(d=a[q][n])&&d.length)for(let r=0;r<l;r++)if(h=d[r],!g[h])if(g[h]=1,b)b--;else{let t=n+(q<k-1?e||0:0);(f[t]||(f[t]=[])).push(h);if(++m===c)return f}}return f}
function za(a,b){const c=B(),d=[];for(let e=0,f;e<b.length;e++){f=b[e];for(let g=0;g<f.length;g++)c[f[g]]=1}for(let e=0,f;e<a.length;e++)f=a[e],1===c[f]&&(d.push(f),c[f]=2);return d};T.prototype.search=function(a,b,c,d){c||(!b&&G(a)?(c=a,a=""):G(b)&&(c=b,b=0));let e=[],f=[],g;let h;let k;let l,m=0,p;if(c){c.constructor===Array&&(c={index:c});a=c.query||a;g=c.pluck;h=c.merge;k=g||c.field||c.index;var n=this.tag&&c.tag;var q=this.store&&c.enrich;var r=c.suggest;p=c.V;b=c.limit||b;l=c.offset||0;b||(b=100);if(n&&(!this.db||!d)){n.constructor!==Array&&(n=[n]);var t=[];for(let y=0,w;y<n.length;y++)if(w=n[y],w.field&&w.tag){var u=w.tag;if(u.constructor===Array)for(var x=0;x<u.length;x++)t.push(w.field,
u[x]);else t.push(w.field,u)}else{u=Object.keys(w);for(let A=0,H,C;A<u.length;A++)if(H=u[A],C=w[H],C.constructor===Array)for(x=0;x<C.length;x++)t.push(H,C[x]);else t.push(H,C)}n=t;if(!a){r=[];if(t.length)for(n=0;n<t.length;n+=2){if(this.db){d=this.index.get(t[n]);if(!d)continue;r.push(d=d.db.tag(t[n+1],b,l,q))}else d=Aa.call(this,t[n],t[n+1],b,l,q);e.push({field:t[n],tag:t[n+1],result:d})}return r.length?Promise.all(r).then(function(y){for(let w=0;w<y.length;w++)e[w].result=y[w];return e}):e}}F(k)&&
(k=[k])}k||(k=this.field);t=!d&&(this.worker||this.db)&&[];let D;for(let y=0,w,A,H;y<k.length;y++){A=k[y];if(this.db&&this.tag&&!this.D[y])continue;let C;F(A)||(C=A,A=C.field,a=C.query||a,b=C.limit||b,l=C.offset||l,r=C.suggest||r,q=this.store&&(C.enrich||q));if(d)w=d[y];else if(u=C||c,x=this.index.get(A),n&&(this.db&&(u.tag=n,D=x.db.support_tag_search,u.field=k),D||(u.enrich=!1)),t){t[y]=x.search(a,b,u);u&&q&&(u.enrich=q);continue}else w=x.search(a,b,u),u&&q&&(u.enrich=q);H=w&&w.length;if(n&&H){u=
[];x=0;if(this.db&&d){if(!D)for(let I=k.length;I<d.length;I++){let E=d[I];if(E&&E.length)x++,u.push(E);else if(!r)return e}}else for(let I=0,E,bb;I<n.length;I+=2){E=this.tag.get(n[I]);if(!E)if(r)continue;else return e;if(bb=(E=E&&E.get(n[I+1]))&&E.length)x++,u.push(E);else if(!r)return e}if(x){w=wa(w,u);H=w.length;if(!H&&!r)return e;x--}}if(H)f[m]=A,e.push(w),m++;else if(1===k.length)return e}if(t){if(this.db&&n&&n.length&&!D)for(q=0;q<n.length;q+=2){d=this.index.get(n[q]);if(!d)if(r)continue;else return e;
t.push(d.db.tag(n[q+1],b,l,!1))}const y=this;return Promise.all(t).then(function(w){return w.length?y.search(a,b,c,w):w})}if(!m)return e;if(g&&(!q||!this.store))return e[0];t=[];for(let y=0,w;y<f.length;y++){w=e[y];q&&w.length&&!w[0].doc&&(this.db?t.push(w=this.index.get(this.field[0]).db.enrich(w)):w.length&&(w=ya.call(this,w)));if(g)return w;e[y]={field:f[y],result:w}}if(q&&this.db&&t.length){const y=this;return Promise.all(t).then(function(w){for(let A=0;A<w.length;A++)e[A].result=w[A];return h?
za(e,b):p?Aa(e,a,y.index,y.field,y.D,p):e})}return h?za(e,b):p?Aa(e,a,this.index,this.field,this.D,p):e};
function Aa(a,b,c,d,e,f){let g,h,k;for(let m=0,p,n,q,r,t;m<a.length;m++){p=a[m].result;n=a[m].field;r=c.get(n);q=r.encoder;k=r.tokenize;t=e[d.indexOf(n)];q!==g&&(g=q,h=g.encode(b));for(let u=0;u<p.length;u++){let x="";var l=J(p[u].doc,t);let D=g.encode(l);l=l.split(g.split);for(let y=0,w,A;y<D.length;y++){w=D[y];A=l[y];let H;for(let C=0,I;C<h.length;C++)if(I=h[C],"strict"===k){if(w===I){x+=(x?" ":"")+f.replace("$1",A);H=!0;break}}else{const E=w.indexOf(I);if(-1<E){x+=(x?" ":"")+A.substring(0,E)+f.replace("$1",
A.substring(E,I.length))+A.substring(E+I.length);H=!0;break}}H||(x+=(x?" ":"")+l[y])}p[u].V=x}}return a}function za(a,b){const c=[],d=B();for(let e=0,f,g;e<a.length;e++){f=a[e];g=f.result;for(let h=0,k,l,m;h<g.length;h++)if(l=g[h],k=l.id,m=d[k])m.push(f.field);else{if(c.length===b)return c;l.field=d[k]=[f.field];c.push(l)}}return c}function xa(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=ya.call(this,a));return a}}
function ya(a){const b=Array(a.length);for(let c=0,d;c<a.length;c++)d=a[c],b[c]={id:d,doc:this.store.get(d)};return b};function T(a){if(!this)return new T(a);const b=a.document||a.doc||a;let c,d;this.D=[];this.field=[];this.K=[];this.key=(c=b.key||b.id)&&Ba(c,this.K)||"id";(d=a.keystore||0)&&(this.keystore=d);this.reg=(this.fastupdate=!!a.fastupdate)?d?new R(d):new Map:d?new S(d):new Set;this.C=(c=b.store||null)&&!0!==c&&[];this.store=c&&(d?new R(d):new Map);this.cache=(c=a.cache||null)&&new U(c);a.cache=!1;this.worker=a.worker;this.index=Ca.call(this,a,b);this.tag=null;if(c=b.tag)if("string"===typeof c&&(c=[c]),
c.length){this.tag=new Map;this.G=[];this.N=[];for(let e=0,f,g;e<c.length;e++){f=c[e];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");f.custom?this.G[e]=f.custom:(this.G[e]=Ba(g,this.K),f.filter&&("string"===typeof this.G[e]&&(this.G[e]=new String(this.G[e])),this.G[e].I=f.filter));this.N[e]=g;this.tag.set(g,new Map)}}if(this.worker){a=[];for(const e of this.index.values())e.then&&a.push(e);if(a.length){const e=this;return Promise.all(a).then(function(f){let g=
[];x=0;if(this.db&&d){if(!D)for(let I=k.length;I<d.length;I++){let E=d[I];if(E&&E.length)x++,u.push(E);else if(!r)return e}}else for(let I=0,E,eb;I<n.length;I+=2){E=this.tag.get(n[I]);if(!E)if(r)continue;else return e;if(eb=(E=E&&E.get(n[I+1]))&&E.length)x++,u.push(E);else if(!r)return e}if(x){w=za(w,u);H=w.length;if(!H&&!r)return e;x--}}if(H)f[m]=A,e.push(w),m++;else if(1===k.length)return e}if(t){if(this.db&&n&&n.length&&!D)for(q=0;q<n.length;q+=2){d=this.index.get(n[q]);if(!d)if(r)continue;else return e;
t.push(d.db.tag(n[q+1],b,l,!1))}const y=this;return Promise.all(t).then(function(w){return w.length?y.search(a,b,c,w):w})}if(!m)return e;if(g&&(!q||!this.store))return e[0];t=[];for(let y=0,w;y<f.length;y++){w=e[y];q&&w.length&&!w[0].doc&&(this.db?t.push(w=this.index.get(this.field[0]).db.enrich(w)):w.length&&(w=Ba.call(this,w)));if(g)return w;e[y]={field:f[y],result:w}}if(q&&this.db&&t.length){const y=this;return Promise.all(t).then(function(w){for(let A=0;A<w.length;A++)e[A].result=w[A];return h?
Ca(e,b):p?Da(e,a,y.index,y.field,y.D,p):e})}return h?Ca(e,b):p?Da(e,a,this.index,this.field,this.D,p):e};
function Da(a,b,c,d,e,f){let g,h,k;for(let m=0,p,n,q,r,t;m<a.length;m++){p=a[m].result;n=a[m].field;r=c.get(n);q=r.encoder;k=r.tokenize;t=e[d.indexOf(n)];q!==g&&(g=q,h=g.encode(b));for(let u=0;u<p.length;u++){let x="";var l=J(p[u].doc,t);let D=g.encode(l);l=l.split(g.split);for(let y=0,w,A;y<D.length;y++){w=D[y];A=l[y];let H;for(let C=0,I;C<h.length;C++)if(I=h[C],"strict"===k){if(w===I){x+=(x?" ":"")+f.replace("$1",A);H=!0;break}}else{const E=w.indexOf(I);if(-1<E){x+=(x?" ":"")+A.substring(0,E)+f.replace("$1",
A.substring(E,I.length))+A.substring(E+I.length);H=!0;break}}H||(x+=(x?" ":"")+l[y])}p[u].V=x}}return a}function Ca(a,b){const c=[],d=B();for(let e=0,f,g;e<a.length;e++){f=a[e];g=f.result;for(let h=0,k,l,m;h<g.length;h++)if(l=g[h],k=l.id,m=d[k])m.push(f.field);else{if(c.length===b)return c;l.field=d[k]=[f.field];c.push(l)}}return c}function Aa(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=Ba.call(this,a));return a}}
function Ba(a){const b=Array(a.length);for(let c=0,d;c<a.length;c++)d=a[c],b[c]={id:d,doc:this.store.get(d)};return b};function T(a){if(this.constructor!==T)return new T(a);const b=a.document||a.doc||a;let c,d;this.D=[];this.field=[];this.K=[];this.key=(c=b.key||b.id)&&Ea(c,this.K)||"id";(d=a.keystore||0)&&(this.keystore=d);this.reg=(this.fastupdate=!!a.fastupdate)?d?new R(d):new Map:d?new S(d):new Set;this.C=(c=b.store||null)&&!0!==c&&[];this.store=c&&(d?new R(d):new Map);this.cache=(c=a.cache||null)&&new U(c);a.cache=!1;this.worker=a.worker;this.index=Fa.call(this,a,b);this.tag=null;if(c=b.tag)if("string"===typeof c&&
(c=[c]),c.length){this.tag=new Map;this.G=[];this.N=[];for(let e=0,f,g;e<c.length;e++){f=c[e];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");f.custom?this.G[e]=f.custom:(this.G[e]=Ea(g,this.K),f.filter&&("string"===typeof this.G[e]&&(this.G[e]=new String(this.G[e])),this.G[e].I=f.filter));this.N[e]=g;this.tag.set(g,new Map)}}if(this.worker){a=[];for(const e of this.index.values())e.then&&a.push(e);if(a.length){const e=this;return Promise.all(a).then(function(f){let g=
0;for(const h of e.index.entries()){const k=h[0];h[1].then&&e.index.set(k,f[g++])}return e})}}else a.db&&this.mount(a.db)}v=T.prototype;
v.mount=function(a){let b=this.field;if(this.tag)for(let e=0,f;e<this.N.length;e++){f=this.N[e];var c=void 0;this.index.set(f,c=new L({},this.reg));b===this.field&&(b=b.slice(0));b.push(f);c.tag=this.tag.get(f)}c=[];const d={db:a.db,type:a.type,fastupdate:a.fastupdate};for(let e=0,f,g;e<b.length;e++){d.field=g=b[e];f=this.index.get(g);const h=new a.constructor(a.id,d);h.id=a.id;c[e]=h.mount(f);f.document=!0;e?f.bypass=!0:f.store=this.store}this.db=!0;return Promise.all(c)};
v.commit=async function(a,b){const c=[];for(const d of this.index.values())c.push(d.db.commit(d,a,b));await Promise.all(c);this.reg.clear()};v.destroy=function(){const a=[];for(const b of this.index.values())a.push(b.destroy());return Promise.all(a)};
function Ca(a,b){const c=new Map;let d=b.index||b.field||b;F(d)&&(d=[d]);for(let e=0,f,g;e<d.length;e++){f=d[e];F(f)||(g=f,f=f.field);g=G(g)?Object.assign({},a,g):a;if(this.worker){const h=new N(g);c.set(f,h)}this.worker||c.set(f,new L(g,this.reg));g.custom?this.D[e]=g.custom:(this.D[e]=Ba(f,this.K),g.filter&&("string"===typeof this.D[e]&&(this.D[e]=new String(this.D[e])),this.D[e].I=g.filter));this.field[e]=f}if(this.C){a=b.store;F(a)&&(a=[a]);for(let e=0,f,g;e<a.length;e++)f=a[e],g=f.field||f,f.custom?
(this.C[e]=f.custom,f.custom.U=g):(this.C[e]=Ba(g,this.K),f.filter&&("string"===typeof this.C[e]&&(this.C[e]=new String(this.C[e])),this.C[e].I=f.filter))}return c}function Ba(a,b){const c=a.split(":");let d=0;for(let e=0;e<c.length;e++)a=c[e],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(b[d]=!0),a&&(c[d++]=a);d<c.length&&(c.length=d);return 1<d?c:c[0]}v.append=function(a,b){return this.add(a,b,!0)};v.update=function(a,b){return this.remove(a).add(a,b)};
function Fa(a,b){const c=new Map;let d=b.index||b.field||b;F(d)&&(d=[d]);for(let e=0,f,g;e<d.length;e++){f=d[e];F(f)||(g=f,f=f.field);g=G(g)?Object.assign({},a,g):a;if(this.worker){const h=new N(g);c.set(f,h)}this.worker||c.set(f,new L(g,this.reg));g.custom?this.D[e]=g.custom:(this.D[e]=Ea(f,this.K),g.filter&&("string"===typeof this.D[e]&&(this.D[e]=new String(this.D[e])),this.D[e].I=g.filter));this.field[e]=f}if(this.C){a=b.store;F(a)&&(a=[a]);for(let e=0,f,g;e<a.length;e++)f=a[e],g=f.field||f,f.custom?
(this.C[e]=f.custom,f.custom.U=g):(this.C[e]=Ea(g,this.K),f.filter&&("string"===typeof this.C[e]&&(this.C[e]=new String(this.C[e])),this.C[e].I=f.filter))}return c}function Ea(a,b){const c=a.split(":");let d=0;for(let e=0;e<c.length;e++)a=c[e],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(b[d]=!0),a&&(c[d++]=a);d<c.length&&(c.length=d);return 1<d?c:c[0]}v.append=function(a,b){return this.add(a,b,!0)};v.update=function(a,b){return this.remove(a).add(a,b)};
v.remove=function(a){G(a)&&(a=J(a,this.key));for(var b of this.index.values())b.remove(a,!0);if(this.reg.has(a)){if(this.tag&&!this.fastupdate)for(let c of this.tag.values())for(let d of c){b=d[0];const e=d[1],f=e.indexOf(a);-1<f&&(1<e.length?e.splice(f,1):c.delete(b))}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.db?this.index.get(this.field[0]).db.has(a):this.reg.has(a)};v.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};v.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)};
v.set=function(a,b){this.store.set(a,b);return this};v.searchCache=Da;v.export=function(a,b,c,d,e,f){let g;"undefined"===typeof f&&(g=new Promise(k=>{f=k}));e||(e=0);d||(d=0);if(d<this.field.length){c=this.field[d];var h=this.index[c];b=this;h.export(a,b,e?c:"",d,e++,f)||(d++,b.export(a,b,c,d,1,f))}else{switch(e){case 1:b="tag";h=this.A;c=null;break;case 2:b="store";h=this.store;c=null;break;default:f();return}oa(a,this,c,b,d,e,h,f)}return g};
v.import=function(a,b){if(b)switch(F(b)&&(b=JSON.parse(b)),a){case "tag":this.A=b;break;case "reg":this.fastupdate=!1;this.reg=b;for(let d=0,e;d<this.field.length;d++)e=this.index[this.field[d]],e.reg=b,e.fastupdate=!1;break;case "store":this.store=b;break;default:a=a.split(".");const c=a[0];a=a[1];c&&a&&this.index[c].import(a,b)}};na(T.prototype);function Da(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();let d=this.cache.get(a);if(!d){d=this.search(a,b,c);if(d.then){const e=this;d.then(function(f){e.cache.set(a,f);return f})}this.cache.set(a,d)}return d}function U(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}U.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.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};U.prototype.remove=function(a){for(const b of this.cache){const c=b[0];b[1].includes(a)&&this.cache.delete(c)}};U.prototype.clear=function(){this.cache.clear();this.h=""};const Ea={normalize:function(a){return a.toLowerCase()},dedupe:!1};const Fa=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 Ga=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["pf","f"]]),Ha=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\1+/g,"$1"];const Ia={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 Ja=/[\x00-\x7F]+/g;const Ka=/[\x00-\x7F]+/g;const La=/[\x00-\x7F]+/g;var Ma={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:Ea,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Fa},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Fa,matcher:Ga,replacer:Ha},LatinExtra:{normalize:!0,dedupe:!0,mapper:Fa,replacer:Ha.concat([/(?!^)[aeo]/g,""]),matcher:Ga},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let c=0;c<a.length;c++){var b=a[c];let d=b.charAt(0),e=Ia[d];for(let f=1,g;f<b.length&&(g=b.charAt(f),"h"===
g||"w"===g||!(g=Ia[g])||g===e||(d+=g,e=g,4!==d.length));f++);a[c]=d}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Ja," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(Ka,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(La," ")}}};const Na={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};B();L.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){const l=B(),m=B(),p=this.depth,n=this.resolution;for(let q=0;q<d;q++){let r=b[this.rtl?d-1-q:q];var e=r.length;if(e&&(p||!m[r])){var f=this.score?this.score(b,r,q,null,0):Oa(n,d,q),g="";switch(this.tokenize){case "full":if(2<e){for(f=0;f<e;f++)for(var h=e;h>f;h--){g=r.substring(f,h);var k=this.score?this.score(b,r,q,g,f):Oa(n,d,q,e,f);V(this,m,g,k,a,c)}break}case "reverse":if(1<
e){for(h=e-1;0<h;h--)g=r[h]+g,k=this.score?this.score(b,r,q,g,h):Oa(n,d,q,e,h),V(this,m,g,k,a,c);g=""}case "forward":if(1<e){for(h=0;h<e;h++)g+=r[h],V(this,m,g,f,a,c);break}default:if(V(this,m,r,f,a,c),p&&1<d&&q<d-1)for(e=B(),g=this.R,f=r,h=Math.min(p+1,d-q),e[f]=1,k=1;k<h;k++)if((r=b[this.rtl?d-1-q-k:q+k])&&!e[r]){e[r]=1;const t=this.score?this.score(b,f,q,r,k):Oa(g+(d/2>g?0:1),d,q,h-1,k-1),u=this.bidirectional&&r>f;V(this,l,u?f:r,t,a,c,u?r:f)}}}}this.fastupdate||this.reg.add(a)}else b=""}this.db&&
(b||this.commit_task.push({del:a}),this.T&&Pa(this));return this};function V(a,b,c,d,e,f,g){let h=g?a.ctx:a.map,k;if(!b[c]||g&&!(k=b[c])[g])if(g?(b=k||(b[c]=B()),b[g]=1,(k=h.get(g))?h=k:h.set(g,h=new Map)):b[c]=1,(k=h.get(c))?h=k:h.set(c,h=k=[]),h=h[d]||(h[d]=[]),!f||!h.includes(e)){if(h.length===2**31-1){b=new Q(h);if(a.fastupdate)for(let l of a.reg.values())l.includes(h)&&(l[l.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 Oa(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};function W(a,b,c,d){if(1===a.length)return a=a[0],a=c||a.length>b?b?a.slice(c,c+b):a.slice(c):a,d?Qa(a):a;let e=[];for(let f=0,g,h;f<a.length;f++)if((g=a[f])&&(h=g.length)){if(c){if(c>=h){c-=h;continue}c<h&&(g=b?g.slice(c,c+b):g.slice(c),h=g.length,c=0)}if(e.length)h>b&&(g=g.slice(0,b),h=g.length),e.push(g);else{if(h>=b)return h>b&&(g=g.slice(0,b)),d?Qa(g):g;e=[g]}b-=h;if(!b)break}if(!e.length)return e;e=1<e.length?[].concat.apply([],e):e[0];return d?Qa(e):e}
function Qa(a){for(let b=0;b<a.length;b++)a[b]={score:b,id:a[b]};return a};X.prototype.or=function(){const a=this;let b=arguments;var c=b[0];if(c.then)return c.then(function(){return a.or.apply(a,b)});if(c[0]&&c[0].index)return this.or.apply(this,c);let d=[];c=[];let e=0,f=0,g,h;for(let k=0,l;k<b.length;k++)if(l=b[k]){e=l.limit||0;f=l.offset||0;g=l.enrich;h=l.resolve;let m;if(l.constructor===X)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.and)m=this.and(l.and);else if(l.xor)m=this.xor(l.xor);else if(l.not)m=
this.not(l.not);else continue;d[k]=m;m.then&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=d.concat([a.result]));a.result=Ra(d,e,f,g,h,a.F);return h?a.result:a});d.length&&(this.result.length&&(d=d.concat([this.result])),this.result=Ra(d,e,f,g,h,this.F));return h?this.result:this};function Ra(a,b,c,d,e,f){if(!a.length)return a;"object"===typeof b&&(c=b.offset||0,d=b.enrich||!1,b=b.limit||0);return 2>a.length?e?W(a[0],b,c,d):a[0]:va(a,c,b,e,f)};X.prototype.and=function(){if(this.result.length){const b=this;let c=arguments;var a=c[0];if(a.then)return a.then(function(){return b.and.apply(b,c)});if(a[0]&&a[0].index)return this.and.apply(this,a);let d=[];a=[];let e=0,f=0,g,h;for(let k=0,l;k<c.length;k++)if(l=c[k]){e=l.limit||0;f=l.offset||0;g=l.resolve;h=l.suggest;let m;if(l.constructor===X)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.or)m=this.or(l.or);else if(l.xor)m=this.xor(l.xor);
else if(l.not)m=this.not(l.not);else continue;d[k]=m;m.then&&a.push(m)}if(!d.length)return this.result=d,g?this.result:this;if(a.length)return Promise.all(a).then(function(){d=[b.result].concat(d);b.result=Sa(d,e,f,g,b.F,h);return g?b.result:b});d=[this.result].concat(d);this.result=Sa(d,e,f,g,this.F,h);return g?this.result:this}return this};function Sa(a,b,c,d,e,f){if(2>a.length)return[];let g=[];B();let h=ca(a);return h?ua(a,h,b,c,f,e,d):g};X.prototype.xor=function(){const a=this;let b=arguments;var c=b[0];if(c.then)return c.then(function(){return a.xor.apply(a,b)});if(c[0]&&c[0].index)return this.xor.apply(this,c);let d=[];c=[];let e=0,f=0,g,h;for(let k=0,l;k<b.length;k++)if(l=b[k]){e=l.limit||0;f=l.offset||0;g=l.enrich;h=l.resolve;let m;if(l.constructor===X)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.or)m=this.or(l.or);else if(l.and)m=this.and(l.and);else if(l.not)m=
this.not(l.not);else continue;d[k]=m;m.then&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=[a.result].concat(d));a.result=Ta(d,e,f,g,!h,a.F);return h?a.result:a});d.length&&(this.result.length&&(d=[this.result].concat(d)),this.result=Ta(d,e,f,g,!h,a.F));return h?this.result:this};
function Ta(a,b,c,d,e,f){if(!a.length)return a;if(2>a.length)return e?W(a[0],b,c,d):a[0];d=[];const g=B();let h=0;for(let k=0,l;k<a.length;k++)if(l=a[k])for(let m=0,p;m<l.length;m++)if(p=l[m]){h<p.length&&(h=p.length);for(let n=0,q;n<p.length;n++)q=p[n],g[q]?g[q]++:g[q]=1}for(let k=0,l,m=0;k<h;k++)for(let p=0,n;p<a.length;p++)if(n=a[p])if(l=n[k])for(let q=0,r;q<l.length;q++)if(r=l[q],1===g[r])if(c)c--;else if(e){if(d.push(r),d.length===b)return d}else{const t=k+(p?f:0);d[t]||(d[t]=[]);d[t].push(r);
v.set=function(a,b){this.store.set(a,b);return this};v.searchCache=Ga;
v.export=function(a,b,c=0,d=0){if(c<this.field.length){const g=this.field[c];if((b=this.index.get(g).export(a,g,c,d=1))&&b.then){const h=this;return b.then(function(){return h.export(a,g,c+1,d=0)})}return this.export(a,g,c+1,d=0)}let e,f;switch(d){case 0:e="reg";f=qa(this.reg);b=null;break;case 1:e="tag";f=pa(this.tag);b=null;break;case 2:e="doc";f=oa(this.store);b=null;break;case 3:e="cfg";f={};b=null;break;default:return}return ra.call(this,a,b,e,c,d,f)};
v.import=function(a,b){if(b)switch(F(b)&&(b=JSON.parse(b)),a){case "tag":break;case "reg":this.fastupdate=!1;this.reg=new Set(b);for(let d=0,e;d<this.field.length;d++)e=this.index.get(this.field[d]),e.fastupdate=!1,e.reg=this.reg;break;case "doc":this.store=new Map(b);break;default:a=a.split(".");const c=a[0];a=a[1];c&&a&&this.index.get(c).import(a,b)}};na(T.prototype);function Ga(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();let d=this.cache.get(a);if(!d){d=this.search(a,b,c);if(d.then){const e=this;d.then(function(f){e.cache.set(a,f);return f})}this.cache.set(a,d)}return d}function U(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}U.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.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};U.prototype.remove=function(a){for(const b of this.cache){const c=b[0];b[1].includes(a)&&this.cache.delete(c)}};U.prototype.clear=function(){this.cache.clear();this.h=""};const Ha={normalize:function(a){return a.toLowerCase()},dedupe:!1};const Ia=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 Ja=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["pf","f"]]),Ka=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\1+/g,"$1"];const La={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 Ma=/[\x00-\x7F]+/g;const Na=/[\x00-\x7F]+/g;const Oa=/[\x00-\x7F]+/g;var Pa={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:Ha,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Ia},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Ia,matcher:Ja,replacer:Ka},LatinExtra:{normalize:!0,dedupe:!0,mapper:Ia,replacer:Ka.concat([/(?!^)[aeo]/g,""]),matcher:Ja},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let c=0;c<a.length;c++){var b=a[c];let d=b.charAt(0),e=La[d];for(let f=1,g;f<b.length&&(g=b.charAt(f),"h"===
g||"w"===g||!(g=La[g])||g===e||(d+=g,e=g,4!==d.length));f++);a[c]=d}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Ma," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(Na,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Oa," ")}}};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}}};B();L.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){const l=B(),m=B(),p=this.depth,n=this.resolution;for(let q=0;q<d;q++){let r=b[this.rtl?d-1-q:q];var e=r.length;if(e&&(p||!m[r])){var f=this.score?this.score(b,r,q,null,0):Ra(n,d,q),g="";switch(this.tokenize){case "full":if(2<e){for(f=0;f<e;f++)for(var h=e;h>f;h--){g=r.substring(f,h);var k=this.score?this.score(b,r,q,g,f):Ra(n,d,q,e,f);V(this,m,g,k,a,c)}break}case "reverse":if(1<
e){for(h=e-1;0<h;h--)g=r[h]+g,k=this.score?this.score(b,r,q,g,h):Ra(n,d,q,e,h),V(this,m,g,k,a,c);g=""}case "forward":if(1<e){for(h=0;h<e;h++)g+=r[h],V(this,m,g,f,a,c);break}default:if(V(this,m,r,f,a,c),p&&1<d&&q<d-1)for(e=B(),g=this.R,f=r,h=Math.min(p+1,d-q),e[f]=1,k=1;k<h;k++)if((r=b[this.rtl?d-1-q-k:q+k])&&!e[r]){e[r]=1;const t=this.score?this.score(b,f,q,r,k):Ra(g+(d/2>g?0:1),d,q,h-1,k-1),u=this.bidirectional&&r>f;V(this,l,u?f:r,t,a,c,u?r:f)}}}}this.fastupdate||this.reg.add(a)}else b=""}this.db&&
(b||this.commit_task.push({del:a}),this.T&&Sa(this));return this};function V(a,b,c,d,e,f,g){let h=g?a.ctx:a.map,k;if(!b[c]||g&&!(k=b[c])[g])if(g?(b=k||(b[c]=B()),b[g]=1,(k=h.get(g))?h=k:h.set(g,h=new Map)):b[c]=1,(k=h.get(c))?h=k:h.set(c,h=k=[]),h=h[d]||(h[d]=[]),!f||!h.includes(e)){if(h.length===2**31-1){b=new Q(h);if(a.fastupdate)for(let l of a.reg.values())l.includes(h)&&(l[l.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 Ra(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};function W(a,b,c,d){if(1===a.length)return a=a[0],a=c||a.length>b?b?a.slice(c,c+b):a.slice(c):a,d?Ta(a):a;let e=[];for(let f=0,g,h;f<a.length;f++)if((g=a[f])&&(h=g.length)){if(c){if(c>=h){c-=h;continue}c<h&&(g=b?g.slice(c,c+b):g.slice(c),h=g.length,c=0)}if(e.length)h>b&&(g=g.slice(0,b),h=g.length),e.push(g);else{if(h>=b)return h>b&&(g=g.slice(0,b)),d?Ta(g):g;e=[g]}b-=h;if(!b)break}if(!e.length)return e;e=1<e.length?[].concat.apply([],e):e[0];return d?Ta(e):e}
function Ta(a){for(let b=0;b<a.length;b++)a[b]={score:b,id:a[b]};return a};X.prototype.or=function(){const a=this;let b=arguments;var c=b[0];if(c.then)return c.then(function(){return a.or.apply(a,b)});if(c[0]&&c[0].index)return this.or.apply(this,c);let d=[];c=[];let e=0,f=0,g,h;for(let k=0,l;k<b.length;k++)if(l=b[k]){e=l.limit||0;f=l.offset||0;g=l.enrich;h=l.resolve;let m;if(l.constructor===X)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.and)m=this.and(l.and);else if(l.xor)m=this.xor(l.xor);else if(l.not)m=
this.not(l.not);else continue;d[k]=m;m.then&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=d.concat([a.result]));a.result=Ua(d,e,f,g,h,a.F);return h?a.result:a});d.length&&(this.result.length&&(d=d.concat([this.result])),this.result=Ua(d,e,f,g,h,this.F));return h?this.result:this};function Ua(a,b,c,d,e,f){if(!a.length)return a;"object"===typeof b&&(c=b.offset||0,d=b.enrich||!1,b=b.limit||0);return 2>a.length?e?W(a[0],b,c,d):a[0]:ya(a,c,b,e,f)};X.prototype.and=function(){if(this.result.length){const b=this;let c=arguments;var a=c[0];if(a.then)return a.then(function(){return b.and.apply(b,c)});if(a[0]&&a[0].index)return this.and.apply(this,a);let d=[];a=[];let e=0,f=0,g,h;for(let k=0,l;k<c.length;k++)if(l=c[k]){e=l.limit||0;f=l.offset||0;g=l.resolve;h=l.suggest;let m;if(l.constructor===X)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.or)m=this.or(l.or);else if(l.xor)m=this.xor(l.xor);
else if(l.not)m=this.not(l.not);else continue;d[k]=m;m.then&&a.push(m)}if(!d.length)return this.result=d,g?this.result:this;if(a.length)return Promise.all(a).then(function(){d=[b.result].concat(d);b.result=Va(d,e,f,g,b.F,h);return g?b.result:b});d=[this.result].concat(d);this.result=Va(d,e,f,g,this.F,h);return g?this.result:this}return this};function Va(a,b,c,d,e,f){if(2>a.length)return[];let g=[];B();let h=ca(a);return h?xa(a,h,b,c,f,e,d):g};X.prototype.xor=function(){const a=this;let b=arguments;var c=b[0];if(c.then)return c.then(function(){return a.xor.apply(a,b)});if(c[0]&&c[0].index)return this.xor.apply(this,c);let d=[];c=[];let e=0,f=0,g,h;for(let k=0,l;k<b.length;k++)if(l=b[k]){e=l.limit||0;f=l.offset||0;g=l.enrich;h=l.resolve;let m;if(l.constructor===X)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.or)m=this.or(l.or);else if(l.and)m=this.and(l.and);else if(l.not)m=
this.not(l.not);else continue;d[k]=m;m.then&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=[a.result].concat(d));a.result=Wa(d,e,f,g,!h,a.F);return h?a.result:a});d.length&&(this.result.length&&(d=[this.result].concat(d)),this.result=Wa(d,e,f,g,!h,a.F));return h?this.result:this};
function Wa(a,b,c,d,e,f){if(!a.length)return a;if(2>a.length)return e?W(a[0],b,c,d):a[0];d=[];const g=B();let h=0;for(let k=0,l;k<a.length;k++)if(l=a[k])for(let m=0,p;m<l.length;m++)if(p=l[m]){h<p.length&&(h=p.length);for(let n=0,q;n<p.length;n++)q=p[n],g[q]?g[q]++:g[q]=1}for(let k=0,l,m=0;k<h;k++)for(let p=0,n;p<a.length;p++)if(n=a[p])if(l=n[k])for(let q=0,r;q<l.length;q++)if(r=l[q],1===g[r])if(c)c--;else if(e){if(d.push(r),d.length===b)return d}else{const t=k+(p?f:0);d[t]||(d[t]=[]);d[t].push(r);
if(++m===b)return d}return d};X.prototype.not=function(){const a=this;let b=arguments;var c=b[0];if(c.then)return c.then(function(){return a.not.apply(a,b)});if(c[0]&&c[0].index)return this.not.apply(this,c);let d=[];c=[];let e=0,f=0,g;for(let h=0,k;h<b.length;h++)if(k=b[h]){e=k.limit||0;f=k.offset||0;g=k.resolve;let l;if(k.constructor===X)l=k.result;else if(k.constructor===Array)l=k;else if(k.index)k.resolve=!1,l=k.index.search(k).result;else if(k.or)l=this.or(k.or);else if(k.and)l=this.and(k.and);else if(k.xor)l=this.xor(k.xor);
else continue;d[h]=l;l.then&&c.push(l)}if(c.length)return Promise.all(c).then(function(){a.result=Ua.call(a,d,e,f,g);return g?a.result:a});d.length&&(this.result=Ua.call(this,d,e,f,g));return g?this.result:this};
function Ua(a,b,c,d){if(!a.length)return this.result;const e=[];a=new Set(a.flat().flat());for(let f=0,g,h=0;f<this.result.length;f++)if(g=this.result[f])for(let k=0,l;k<g.length;k++)if(l=g[k],!a.has(l))if(c)c--;else if(d){if(e.push(l),e.length===b)return e}else if(e[f]||(e[f]=[]),e[f].push(l),++h===b)return e;return e};function X(a){if(!this)return new X(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.F=a.boost||0,this.result=a.index.search(a).result,this;if(a.constructor===X)return a;this.index=null;this.result=a||[];this.F=0}X.prototype.limit=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)if(e=this.result[d],e.length+c<a)b[d]=e,c+=e.length;else{b[d]=e.slice(0,a-c);this.result=b;break}}return this};
X.prototype.offset=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)e=this.result[d],e.length+c<a?c+=e.length:(b[d]=e.slice(a-c),c=a);this.result=b}return this};X.prototype.boost=function(a){this.F+=a;return this};X.prototype.resolve=function(a,b,c){Va=1;const d=this.result;this.result=this.index=null;return d.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),W(d,a||100,b,c)):d};let Va=1;
L.prototype.search=function(a,b,c){c||(!b&&G(a)?(c=a,a=""):G(b)&&(c=b,b=0));let d=[],e;let f,g=0,h,k,l,m;if(c){a=c.query||a;b=c.limit||b;g=c.offset||0;var p=c.context;f=c.suggest;(h=Va&&!1!==c.resolve)||(Va=0);k=h&&c.enrich;m=c.boost;l=this.db&&c.tag}else h=this.resolve||Va;a=this.encoder.encode(a);e=a.length;b||!h||(b=100);if(1===e)return Wa.call(this,a[0],"",b,g,h,k,l);p=this.depth&&!1!==p;if(2===e&&p&&!f)return Wa.call(this,a[0],a[1],b,g,h,k,l);let n=c=0;if(1<e){const t=B(),u=[];for(let x=0,D;x<
e;x++)if((D=a[x])&&!t[D]){if(f||this.db||Y(this,D))u.push(D),t[D]=1;else return h?d:new X(d);const y=D.length;c=Math.max(c,y);n=n?Math.min(n,y):y}a=u;e=a.length}if(!e)return h?d:new X(d);let q=0,r;if(1===e)return Wa.call(this,a[0],"",b,g,h,k,l);if(2===e&&p&&!f)return Wa.call(this,a[0],a[1],b,g,h,k,l);1<e&&(p?(r=a[0],q=1):9<c&&3<c/n&&a.sort(aa));if(this.db){if(this.db.search&&(p=this.db.search(this,a,b,g,f,h,k,l),!1!==p))return p;const t=this;return async function(){for(let u,x;q<e;q++){x=a[q];r?(u=
await Y(t,x,r,0,0,!1,!1),u=Xa(u,d,f,t.R),f&&!1===u&&d.length||(r=x)):(u=await Y(t,x,"",0,0,!1,!1),u=Xa(u,d,f,t.resolution));if(u)return u;if(f&&q===e-1){let D=d.length;if(!D){if(r){r="";q=-1;continue}return d}if(1===D)return h?W(d[0],b,g):new X(d[0])}}return h?ua(d,t.resolution,b,g,f,m,h):new X(d[0])}()}for(let t,u;q<e;q++){u=a[q];r?(t=Y(this,u,r,0,0,!1,!1),t=Xa(t,d,f,this.R),f&&!1===t&&d.length||(r=u)):(t=Y(this,u,"",0,0,!1,!1),t=Xa(t,d,f,this.resolution));if(t)return t;if(f&&q===e-1){p=d.length;
if(!p){if(r){r="";q=-1;continue}return d}if(1===p)return h?W(d[0],b,g):new X(d[0])}}d=ua(d,this.resolution,b,g,f,m,h);return h?d:new X(d)};function Wa(a,b,c,d,e,f,g){a=Y(this,a,b,c,d,e,f,g);return this.db?a.then(function(h){return e?h:h&&h.length?e?W(h,c,d):new X(h):e?[]:new X([])}):a&&a.length?e?W(a,c,d):new X(a):e?[]:new X([])}function Xa(a,b,c,d){let e=[];if(a){d=Math.min(a.length,d);for(let f=0,g;f<d;f++)(g=a[f])&&g&&(e[f]=g);if(e.length){b.push(e);return}}return!c&&e}
function Y(a,b,c,d,e,f,g,h){let k;c&&(k=a.bidirectional&&b>c);if(a.db)return c?a.db.get(k?c:b,k?b:c,d,e,f,g,h):a.db.get(b,"",d,e,f,g,h);a=c?(a=a.ctx.get(k?b:c))&&a.get(k?c:b):a.map.get(b);return a};L.prototype.remove=function(a,b){const c=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(c){if(this.fastupdate)for(let d=0,e;d<c.length;d++){if(e=c[d])if(2>e.length)e.pop();else{const f=e.indexOf(a);f===c.length-1?e.pop():e.splice(f,1)}}else Ya(this.map,a),this.depth&&Ya(this.ctx,a);b||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.T&&Pa(this));this.cache&&this.cache.remove(a);return this};
function Ya(a,b){let c=0;if(a.constructor===Array)for(let d=0,e,f;d<a.length;d++){if((e=a[d])&&e.length)if(f=e.indexOf(b),0<=f){1<e.length?(e.splice(f,1),c++):delete a[d];break}else c++}else for(let d of a){const e=d[0],f=Ya(d[1],b);f?c+=f:a.delete(e)}return c};function L(a,b){if(!this)return new L(a);if(a){var c=F(a)?a:a.preset;c&&(a=Object.assign({},Na[c],a))}else a={};c=a.context||{};const d=F(a.encoder)?Ma[a.encoder]:a.encode||a.encoder||Ea;this.encoder=d.encode?d:"object"===typeof d?new K(d):{encode:d};let e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&c.depth||0;this.bidirectional=!1!==c.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;(e=a.keystore||0)&&(this.keystore=e);this.map=
e?new R(e):new Map;this.ctx=e?new R(e):new Map;this.reg=b||(this.fastupdate?e?new R(e):new Map:e?new S(e):new Set);this.R=c.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new U(e);this.resolve=!1!==a.resolve;if(e=a.db)this.db=this.mount(e);this.T=!1!==a.commit;this.commit_task=[];this.commit_timer=null}v=L.prototype;v.mount=function(a){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return a.mount(this)};
v.commit=function(a,b){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.commit(this,a,b)};v.destroy=function(){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.destroy()};function Pa(a){a.commit_timer||(a.commit_timer=setTimeout(function(){a.commit_timer=null;a.db.commit(a,void 0,void 0)},0))}
else continue;d[h]=l;l.then&&c.push(l)}if(c.length)return Promise.all(c).then(function(){a.result=Xa.call(a,d,e,f,g);return g?a.result:a});d.length&&(this.result=Xa.call(this,d,e,f,g));return g?this.result:this};
function Xa(a,b,c,d){if(!a.length)return this.result;const e=[];a=new Set(a.flat().flat());for(let f=0,g,h=0;f<this.result.length;f++)if(g=this.result[f])for(let k=0,l;k<g.length;k++)if(l=g[k],!a.has(l))if(c)c--;else if(d){if(e.push(l),e.length===b)return e}else if(e[f]||(e[f]=[]),e[f].push(l),++h===b)return e;return e};function X(a){if(this.constructor!==X)return new X(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.F=a.boost||0,this.result=a.index.search(a).result,this;if(a.constructor===X)return a;this.index=null;this.result=a||[];this.F=0}X.prototype.limit=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)if(e=this.result[d],e.length+c<a)b[d]=e,c+=e.length;else{b[d]=e.slice(0,a-c);this.result=b;break}}return this};
X.prototype.offset=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)e=this.result[d],e.length+c<a?c+=e.length:(b[d]=e.slice(a-c),c=a);this.result=b}return this};X.prototype.boost=function(a){this.F+=a;return this};X.prototype.resolve=function(a,b,c){Ya=1;const d=this.result;this.result=this.index=null;return d.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),W(d,a||100,b,c)):d};let Ya=1;
L.prototype.search=function(a,b,c){c||(!b&&G(a)?(c=a,a=""):G(b)&&(c=b,b=0));let d=[],e;let f,g=0,h,k,l,m;if(c){a=c.query||a;b=c.limit||b;g=c.offset||0;var p=c.context;f=c.suggest;(h=Ya&&!1!==c.resolve)||(Ya=0);k=h&&c.enrich;m=c.boost;l=this.db&&c.tag}else h=this.resolve||Ya;a=this.encoder.encode(a);e=a.length;b||!h||(b=100);if(1===e)return Za.call(this,a[0],"",b,g,h,k,l);p=this.depth&&!1!==p;if(2===e&&p&&!f)return Za.call(this,a[0],a[1],b,g,h,k,l);let n=c=0;if(1<e){const t=B(),u=[];for(let x=0,D;x<
e;x++)if((D=a[x])&&!t[D]){if(f||this.db||Y(this,D))u.push(D),t[D]=1;else return h?d:new X(d);const y=D.length;c=Math.max(c,y);n=n?Math.min(n,y):y}a=u;e=a.length}if(!e)return h?d:new X(d);let q=0,r;if(1===e)return Za.call(this,a[0],"",b,g,h,k,l);if(2===e&&p&&!f)return Za.call(this,a[0],a[1],b,g,h,k,l);1<e&&(p?(r=a[0],q=1):9<c&&3<c/n&&a.sort(aa));if(this.db){if(this.db.search&&(p=this.db.search(this,a,b,g,f,h,k,l),!1!==p))return p;const t=this;return async function(){for(let u,x;q<e;q++){x=a[q];r?(u=
await Y(t,x,r,0,0,!1,!1),u=$a(u,d,f,t.R),f&&!1===u&&d.length||(r=x)):(u=await Y(t,x,"",0,0,!1,!1),u=$a(u,d,f,t.resolution));if(u)return u;if(f&&q===e-1){let D=d.length;if(!D){if(r){r="";q=-1;continue}return d}if(1===D)return h?W(d[0],b,g):new X(d[0])}}return h?xa(d,t.resolution,b,g,f,m,h):new X(d[0])}()}for(let t,u;q<e;q++){u=a[q];r?(t=Y(this,u,r,0,0,!1,!1),t=$a(t,d,f,this.R),f&&!1===t&&d.length||(r=u)):(t=Y(this,u,"",0,0,!1,!1),t=$a(t,d,f,this.resolution));if(t)return t;if(f&&q===e-1){p=d.length;
if(!p){if(r){r="";q=-1;continue}return d}if(1===p)return h?W(d[0],b,g):new X(d[0])}}d=xa(d,this.resolution,b,g,f,m,h);return h?d:new X(d)};function Za(a,b,c,d,e,f,g){a=Y(this,a,b,c,d,e,f,g);return this.db?a.then(function(h){return e?h:h&&h.length?e?W(h,c,d):new X(h):e?[]:new X([])}):a&&a.length?e?W(a,c,d):new X(a):e?[]:new X([])}function $a(a,b,c,d){let e=[];if(a){d=Math.min(a.length,d);for(let f=0,g;f<d;f++)(g=a[f])&&g&&(e[f]=g);if(e.length){b.push(e);return}}return!c&&e}
function Y(a,b,c,d,e,f,g,h){let k;c&&(k=a.bidirectional&&b>c);if(a.db)return c?a.db.get(k?c:b,k?b:c,d,e,f,g,h):a.db.get(b,"",d,e,f,g,h);a=c?(a=a.ctx.get(k?b:c))&&a.get(k?c:b):a.map.get(b);return a};L.prototype.remove=function(a,b){const c=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(c){if(this.fastupdate)for(let d=0,e;d<c.length;d++){if(e=c[d])if(2>e.length)e.pop();else{const f=e.indexOf(a);f===c.length-1?e.pop():e.splice(f,1)}}else ab(this.map,a),this.depth&&ab(this.ctx,a);b||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.T&&Sa(this));this.cache&&this.cache.remove(a);return this};
function ab(a,b){let c=0;if(a.constructor===Array)for(let d=0,e,f;d<a.length;d++){if((e=a[d])&&e.length)if(f=e.indexOf(b),0<=f){1<e.length?(e.splice(f,1),c++):delete a[d];break}else c++}else for(let d of a){const e=d[0],f=ab(d[1],b);f?c+=f:a.delete(e)}return c};function L(a,b){if(this.constructor!==L)return new L(a);if(a){var c=F(a)?a:a.preset;c&&(a=Object.assign({},Qa[c],a))}else a={};c=a.context||{};const d=F(a.encoder)?Pa[a.encoder]:a.encode||a.encoder||Ha;this.encoder=d.encode?d:"object"===typeof d?new K(d):{encode:d};let e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&c.depth||0;this.bidirectional=!1!==c.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;(e=a.keystore||0)&&(this.keystore=
e);this.map=e?new R(e):new Map;this.ctx=e?new R(e):new Map;this.reg=b||(this.fastupdate?e?new R(e):new Map:e?new S(e):new Set);this.R=c.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new U(e);this.resolve=!1!==a.resolve;if(e=a.db)this.db=this.mount(e);this.T=!1!==a.commit;this.commit_task=[];this.commit_timer=null}v=L.prototype;v.mount=function(a){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return a.mount(this)};
v.commit=function(a,b){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.commit(this,a,b)};v.destroy=function(){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.destroy()};function Sa(a){a.commit_timer||(a.commit_timer=setTimeout(function(){a.commit_timer=null;a.db.commit(a,void 0,void 0)},0))}
v.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};v.append=function(a,b){return this.add(a,b,!0)};v.contain=function(a){return this.db?this.db.has(a):this.reg.has(a)};v.update=function(a,b){const c=this,d=this.remove(a);return d&&d.then?d.then(()=>c.add(a,b)):this.add(a,b)};
function Za(a){let b=0;if(a.constructor===Array)for(let c=0,d;c<a.length;c++)(d=a[c])&&(b+=d.length);else for(const c of a){const d=c[0],e=Za(c[1]);e?b+=e:a.delete(d)}return b}v.cleanup=function(){if(!this.fastupdate)return this;Za(this.map);this.depth&&Za(this.ctx);return this};v.searchCache=Da;
v.export=function(a,b,c,d,e,f){let g=!0;"undefined"===typeof f&&(g=new Promise(l=>{f=l}));let h,k;switch(e||(e=0)){case 0:h="reg";if(this.fastupdate){k=B();for(let l of this.reg.keys())k[l]=1}else k=this.reg;break;case 1:h="cfg";k={doc:0,opt:this.h?1:0};break;case 2:h="map";k=this.map;break;case 3:h="ctx";k=this.ctx;break;default:"undefined"===typeof c&&f&&f();return}oa(a,b||this,c,h,d,e,k,f);return g};
v.import=function(a,b){if(b)switch(F(b)&&(b=JSON.parse(b)),a){case "cfg":this.h=!!b.opt;break;case "reg":this.fastupdate=!1;this.reg=b;break;case "map":this.map=b;break;case "ctx":this.ctx=b}};
function bb(a){let b=0;if(a.constructor===Array)for(let c=0,d;c<a.length;c++)(d=a[c])&&(b+=d.length);else for(const c of a){const d=c[0],e=bb(c[1]);e?b+=e:a.delete(d)}return b}v.cleanup=function(){if(!this.fastupdate)return this;bb(this.map);this.depth&&bb(this.ctx);return this};v.searchCache=Ga;
v.export=function(a,b,c,d=0){let e,f;switch(d){case 0:e="reg";f=qa(this.reg);break;case 1:e="cfg";f={};break;case 2:e="map";f=oa(this.map);break;case 3:e="ctx";f=pa(this.ctx);break;default:return}return ra.call(this,a,b,e,c,d,f)};v.import=function(a,b){if(b)switch(F(b)&&(b=JSON.parse(b)),a){case "reg":this.fastupdate=!1;this.reg=new Set(b);break;case "map":this.map=new Map(b);break;case "ctx":this.ctx=new Map(b)}};
v.serialize=function(a=!0){if(!this.reg.size)return"";let b="",c="";for(var d of this.reg.keys())c||(c=typeof d),b+=(b?",":"")+("string"===c?'"'+d+'"':d);b="index.reg=new Set(["+b+"]);";d="";for(var e of this.map.entries()){var f=e[0],g=e[1],h="";for(let m=0,p;m<g.length;m++){p=g[m]||[""];var k="";for(var l=0;l<p.length;l++)k+=(k?",":"")+("string"===c?'"'+p[l]+'"':p[l]);k="["+k+"]";h+=(h?",":"")+k}h='["'+f+'",['+h+"]]";d+=(d?",":"")+h}d="index.map=new Map(["+d+"]);";e="";for(const m of this.ctx.entries()){f=
m[0];g=m[1];for(const p of g.entries()){g=p[0];h=p[1];k="";for(let n=0,q;n<h.length;n++){q=h[n]||[""];l="";for(let r=0;r<q.length;r++)l+=(l?",":"")+("string"===c?'"'+q[r]+'"':q[r]);l="["+l+"]";k+=(k?",":"")+l}k='new Map([["'+g+'",['+k+"]]])";k='["'+f+'",'+k+"]";e+=(e?",":"")+k}}e="index.ctx=new Map(["+e+"]);";return a?"function inject(index){"+b+d+e+"}":b+d+e};na(L.prototype);const $a="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),ab=["map","ctx","tag","reg","cfg"];
function cb(a,b={}){if(!this)return new cb(a,b);"object"===typeof a&&(b=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.support_tag_search=!1;this.db=null;this.h={}}v=cb.prototype;v.mount=function(a){if(!a.encoder)return a.mount(this);a.db=this;return this.open()};
v.open=function(){let a=this;navigator.storage&&navigator.storage.persist();return this.db||new Promise(function(b,c){const d=$a.open(a.id+(a.field?":"+a.field:""),1);d.onupgradeneeded=function(){const e=a.db=this.result;ab.forEach(f=>{e.objectStoreNames.contains(f)||e.createObjectStore(f)})};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)}})};
v.close=function(){this.db.close();this.db=null};v.destroy=function(){return $a.deleteDatabase(this.id+(this.field?":"+this.field:""))};v.clear=function(){const a=this.db.transaction(ab,"readwrite");for(let b=0;b<ab.length;b++)a.objectStore(ab[b]).clear();return Z(a)};
m[0];g=m[1];for(const p of g.entries()){g=p[0];h=p[1];k="";for(let n=0,q;n<h.length;n++){q=h[n]||[""];l="";for(let r=0;r<q.length;r++)l+=(l?",":"")+("string"===c?'"'+q[r]+'"':q[r]);l="["+l+"]";k+=(k?",":"")+l}k='new Map([["'+g+'",['+k+"]]])";k='["'+f+'",'+k+"]";e+=(e?",":"")+k}}e="index.ctx=new Map(["+e+"]);";return a?"function inject(index){"+b+d+e+"}":b+d+e};na(L.prototype);const cb="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),db=["map","ctx","tag","reg","cfg"];
function fb(a,b={}){if(!this)return new fb(a,b);"object"===typeof a&&(b=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.support_tag_search=!1;this.db=null;this.h={}}v=fb.prototype;v.mount=function(a){if(!a.encoder)return a.mount(this);a.db=this;return this.open()};
v.open=function(){let a=this;navigator.storage&&navigator.storage.persist();return this.db||new Promise(function(b,c){const d=cb.open(a.id+(a.field?":"+a.field:""),1);d.onupgradeneeded=function(){const e=a.db=this.result;db.forEach(f=>{e.objectStoreNames.contains(f)||e.createObjectStore(f)})};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)}})};
v.close=function(){this.db.close();this.db=null};v.destroy=function(){return cb.deleteDatabase(this.id+(this.field?":"+this.field:""))};v.clear=function(){const a=this.db.transaction(db,"readwrite");for(let b=0;b<db.length;b++)a.objectStore(db[b]).clear();return Z(a)};
v.get=function(a,b,c=0,d=0,e=!0,f=!1){a=this.db.transaction(b?"ctx":"map","readonly").objectStore(b?"ctx":"map").get(b?b+":"+a:a);const g=this;return Z(a).then(function(h){let k=[];if(!h||!h.length)return k;if(e){if(!c&&!d&&1===h.length)return h[0];for(let l=0,m;l<h.length;l++)if((m=h[l])&&m.length){if(d>=m.length){d-=m.length;continue}const p=c?d+Math.min(m.length-d,c):m.length;for(let n=d;n<p;n++)k.push(m[n]);d=0;if(k.length===c)break}return f?g.enrich(k):k}return h})};
v.tag=function(a,b=0,c=0,d=!1){a=this.db.transaction("tag","readonly").objectStore("tag").get(a);const e=this;return Z(a).then(function(f){if(!f||!f.length||c>=f.length)return[];if(!b&&!c)return f;f=f.slice(c,c+b);return d?e.enrich(f):f})};
v.enrich=function(a){"object"!==typeof a&&(a=[a]);const b=this.db.transaction("reg","readonly").objectStore("reg"),c=[];for(let d=0;d<a.length;d++)c[d]=Z(b.get(a[d]));return Promise.all(c).then(function(d){for(let e=0;e<d.length;e++)d[e]={id:a[e],doc:d[e]?JSON.parse(d[e]):null};return d})};v.has=function(a){a=this.db.transaction("reg","readonly").objectStore("reg").getKey(a);return Z(a)};v.search=null;v.info=function(){};
@@ -94,6 +94,6 @@ v.commit=async function(a,b,c){if(b)await this.clear(),a.commit_task=[];else{let
for(let m=0,p,n;m<l;m++)if((n=g[m])&&n.length){if((p=h[m])&&p.length)for(k=0;k<n.length;k++)p.push(n[k]);else h[m]=n;k=1}}else h=g,k=1;k&&d.put(h,f)})}}),await this.transaction("ctx","readwrite",function(d){for(const e of a.ctx){const f=e[0],g=e[1];for(const h of g){const k=h[0],l=h[1];l.length&&(b?d.put(l,f+":"+k):d.get(f+":"+k).onsuccess=function(){let m=this.result;var p;if(m&&m.length){const n=Math.max(m.length,l.length);for(let q=0,r,t;q<n;q++)if((t=l[q])&&t.length){if((r=m[q])&&r.length)for(p=
0;p<t.length;p++)r.push(t[p]);else m[q]=t;p=1}}else m=l,p=1;p&&d.put(m,f+":"+k)})}}}),a.store?await this.transaction("reg","readwrite",function(d){for(const e of a.store){const f=e[0],g=e[1];d.put("object"===typeof g?JSON.stringify(g):1,f)}}):a.bypass||await this.transaction("reg","readwrite",function(d){for(const e of a.reg.keys())d.put(1,e)}),a.tag&&await this.transaction("tag","readwrite",function(d){for(const e of a.tag){const f=e[0],g=e[1];g.length&&(d.get(f).onsuccess=function(){let h=this.result;
h=h&&h.length?h.concat(g):g;d.put(h,f)})}}),a.map.clear(),a.ctx.clear(),a.tag&&a.tag.clear(),a.store&&a.store.clear(),a.document||a.reg.clear())};
function db(a,b,c){const d=a.value;let e,f,g=0;for(let h=0,k;h<d.length;h++){if(k=c?d:d[h]){for(let l=0,m,p;l<b.length;l++)if(p=b[l],m=k.indexOf(f?parseInt(p,10):p),0>m&&!f&&"string"===typeof p&&!isNaN(p)&&(m=k.indexOf(parseInt(p,10)))&&(f=1),0<=m)if(e=1,1<k.length)k.splice(m,1);else{d[h]=[];break}g+=k.length}if(c)break}g?e&&a.update(d):a.delete();a.continue()}
v.remove=function(a){"object"!==typeof a&&(a=[a]);return Promise.all([this.transaction("map","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&db(c,a)}}),this.transaction("ctx","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&db(c,a)}}),this.transaction("tag","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&db(c,a,!0)}}),this.transaction("reg","readwrite",function(b){for(let c=0;c<a.length;c++)b.delete(a[c])})])};
function Z(a){return new Promise((b,c)=>{a.onsuccess=function(){b(this.result)};a.oncomplete=function(){b(this.result)};a.onerror=c;a=null})};const eb={Index:L,Charset:Ma,Encoder:K,Document:T,Worker:N,Resolver:X,IndexedDB:cb,Language:{}},fb=self;let gb;(gb=fb.define)&&gb.amd?gb([],function(){return eb}):"object"===typeof fb.exports?fb.exports=eb:fb.FlexSearch=eb;}(this||self));
function gb(a,b,c){const d=a.value;let e,f,g=0;for(let h=0,k;h<d.length;h++){if(k=c?d:d[h]){for(let l=0,m,p;l<b.length;l++)if(p=b[l],m=k.indexOf(f?parseInt(p,10):p),0>m&&!f&&"string"===typeof p&&!isNaN(p)&&(m=k.indexOf(parseInt(p,10)))&&(f=1),0<=m)if(e=1,1<k.length)k.splice(m,1);else{d[h]=[];break}g+=k.length}if(c)break}g?e&&a.update(d):a.delete();a.continue()}
v.remove=function(a){"object"!==typeof a&&(a=[a]);return Promise.all([this.transaction("map","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&gb(c,a)}}),this.transaction("ctx","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&gb(c,a)}}),this.transaction("tag","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&gb(c,a,!0)}}),this.transaction("reg","readwrite",function(b){for(let c=0;c<a.length;c++)b.delete(a[c])})])};
function Z(a){return new Promise((b,c)=>{a.onsuccess=function(){b(this.result)};a.oncomplete=function(){b(this.result)};a.onerror=c;a=null})};const hb={Index:L,Charset:Pa,Encoder:K,Document:T,Worker:N,Resolver:X,IndexedDB:fb,Language:{}},ib=self;let jb;(jb=ib.define)&&jb.amd?jb([],function(){return hb}):"object"===typeof ib.exports?ib.exports=hb:ib.FlexSearch=hb;}(this||self));

View File

@@ -89,7 +89,7 @@ function ca(a) {
"\u04d9"], ["\u04dd", "\u0436"], ["\u04df", "\u0437"], ["\u04e3", "\u0438"], ["\u04e5", "\u0438"], ["\u04e7", "\u043e"], ["\u04eb", "\u04e9"], ["\u04ed", "\u044d"], ["\u04ef", "\u0443"], ["\u04f1", "\u0443"], ["\u04f3", "\u0443"], ["\u04f5", "\u0447"]];
const ea = /[^\p{L}\p{N}]+/u, fa = /(\d{3})/g, ha = /(\D)(\d{3})/g, ia = /(\d{3})(\D)/g, ja = "".normalize && /[\u0300-\u036f]/g;
function K(a) {
if (!this) {
if (this.constructor !== K) {
return new K(...arguments);
}
for (let b = 0; b < arguments.length; b++) {
@@ -263,7 +263,7 @@ function N(a = {}) {
return this;
}
}
if (!this) {
if (this.constructor !== N) {
return new N(a);
}
let c = "undefined" !== typeof self ? self._factory : "undefined" !== typeof window ? window._factory : null;
@@ -313,12 +313,37 @@ function P(a) {
return b;
};
}
;function oa(a, b, c, d, e, f, g, h) {
(d = a(c ? c + "." + d : d, JSON.stringify(g))) && d.then ? d.then(function() {
b.export(a, b, c, e, f + 1, h);
}) : b.export(a, b, c, e, f + 1, h);
;function oa(a) {
const b = [];
for (const c of a.entries()) {
b.push(c);
}
;function pa(a, b, c, d) {
return b;
}
function pa(a) {
const b = [];
for (const c of a.entries()) {
b.push(oa(c));
}
return b;
}
function qa(a) {
const b = [];
for (const c of a.keys()) {
b.push(c);
}
return b;
}
function ra(a, b, c, d, e, f) {
if ((c = a(b ? b + "." + c : c, JSON.stringify(f))) && c.then) {
const g = this;
return c.then(function() {
return g.export(a, b, d, e + 1);
});
}
return this.export(a, b, d, e + 1);
}
;function sa(a, b, c, d) {
let e = [];
for (let f = 0, g; f < a.index.length; f++) {
if (g = a.index[f], b >= g.length) {
@@ -384,12 +409,12 @@ function Q(a) {
}
if ("slice" === d) {
return function(e, f) {
return pa(b, e || 0, f || b.length, !1);
return sa(b, e || 0, f || b.length, !1);
};
}
if ("splice" === d) {
return function(e, f) {
return pa(b, e || 0, f || b.length, !0);
return sa(b, e || 0, f || b.length, !0);
};
}
if ("constructor" === d) {
@@ -420,7 +445,7 @@ function R(a = 8) {
this.index = B();
this.B = [];
this.size = 0;
32 < a ? (this.h = qa, this.A = BigInt(a)) : (this.h = ra, this.A = a);
32 < a ? (this.h = ta, this.A = BigInt(a)) : (this.h = ua, this.A = a);
}
R.prototype.get = function(a) {
const b = this.index[this.h(a)];
@@ -437,7 +462,7 @@ function S(a = 8) {
}
this.index = B();
this.h = [];
32 < a ? (this.B = qa, this.A = BigInt(a)) : (this.B = ra, this.A = a);
32 < a ? (this.B = ta, this.A = BigInt(a)) : (this.B = ua, this.A = a);
}
S.prototype.add = function(a) {
var b = this.B(a);
@@ -479,7 +504,7 @@ v.entries = S.prototype.entries = function*() {
}
}
};
function ra(a) {
function ua(a) {
let b = 2 ** this.A - 1;
if ("number" == typeof a) {
return a & b;
@@ -490,7 +515,7 @@ function ra(a) {
}
return 32 === this.A ? c + 2 ** 31 : c;
}
function qa(a) {
function ta(a) {
let b = BigInt(2) ** this.A - BigInt(1);
var c = typeof a;
if ("bigint" === c) {
@@ -520,7 +545,7 @@ function qa(a) {
e && d.add(a, e, !1, !0);
} else {
if (e = k.I, !e || e(b)) {
k.constructor === String ? k = ["" + k] : G(k) && (k = [k]), sa(b, k, this.K, 0, d, a, k[0], c);
k.constructor === String ? k = ["" + k] : G(k) && (k = [k]), va(b, k, this.K, 0, d, a, k[0], c);
}
}
}
@@ -583,7 +608,7 @@ function qa(a) {
h[l] = b[l];
continue;
}
ta(b, h, l, 0, l[0], m);
wa(b, h, l, 0, l[0], m);
}
}
this.store.set(a, h || b);
@@ -591,21 +616,21 @@ function qa(a) {
}
return this;
};
function ta(a, b, c, d, e, f) {
function wa(a, b, c, d, e, f) {
a = a[e];
if (d === c.length - 1) {
b[e] = f || a;
} else if (a) {
if (a.constructor === Array) {
for (b = b[e] = Array(a.length), e = 0; e < a.length; e++) {
ta(a, b, c, d, e);
wa(a, b, c, d, e);
}
} else {
b = b[e] || (b[e] = B()), e = c[++d], ta(a, b, c, d, e);
b = b[e] || (b[e] = B()), e = c[++d], wa(a, b, c, d, e);
}
}
}
function sa(a, b, c, d, e, f, g, h) {
function va(a, b, c, d, e, f, g, h) {
if (a = a[g]) {
if (d === b.length - 1) {
if (a.constructor === Array) {
@@ -621,17 +646,17 @@ function sa(a, b, c, d, e, f, g, h) {
} else {
if (a.constructor === Array) {
for (g = 0; g < a.length; g++) {
sa(a, b, c, d, e, f, g, h);
va(a, b, c, d, e, f, g, h);
}
} else {
g = b[++d], sa(a, b, c, d, e, f, g, h);
g = b[++d], va(a, b, c, d, e, f, g, h);
}
}
} else {
e.db && e.remove(f);
}
}
;function ua(a, b, c, d, e, f, g) {
;function xa(a, b, c, d, e, f, g) {
const h = a.length;
let k = [], l;
var m;
@@ -647,7 +672,7 @@ function sa(a, b, c, d, e, f, g, h) {
}
if (a = k.length) {
if (e) {
k = 1 < k.length ? va(k, d, c, g, 0) : (k = k[0]).length > c || d ? k.slice(d, c + d) : k;
k = 1 < k.length ? ya(k, d, c, g, 0) : (k = k[0]).length > c || d ? k.slice(d, c + d) : k;
} else {
if (a < h) {
return [];
@@ -680,7 +705,7 @@ function sa(a, b, c, d, e, f, g, h) {
}
return k;
}
function va(a, b, c, d, e) {
function ya(a, b, c, d, e) {
const f = [], g = B();
let h;
var k = a.length;
@@ -723,7 +748,7 @@ function va(a, b, c, d, e) {
}
return f;
}
function wa(a, b) {
function za(a, b) {
const c = B(), d = [];
for (let e = 0, f; e < b.length; e++) {
f = b[e];
@@ -801,7 +826,7 @@ function wa(a, b) {
}
t.push(d = d.db.tag(r[n + 1], b, l, q));
} else {
d = xa.call(this, r[n], r[n + 1], b, l, q);
d = Aa.call(this, r[n], r[n + 1], b, l, q);
}
e.push({field:r[n], tag:r[n + 1], result:d});
}
@@ -853,7 +878,7 @@ function wa(a, b) {
}
}
} else {
for (let E = 0, F, $a; E < n.length; E += 2) {
for (let E = 0, F, cb; E < n.length; E += 2) {
F = this.tag.get(n[E]);
if (!F) {
if (console.warn("Tag '" + n[E] + ":" + n[E + 1] + "' will be skipped because there is no field '" + n[E] + "'."), t) {
@@ -862,7 +887,7 @@ function wa(a, b) {
return e;
}
}
if ($a = (F = F && F.get(n[E + 1])) && F.length) {
if (cb = (F = F && F.get(n[E + 1])) && F.length) {
x++, u.push(F);
} else if (!t) {
return e;
@@ -870,7 +895,7 @@ function wa(a, b) {
}
}
if (x) {
w = wa(w, u);
w = za(w, u);
I = w.length;
if (!I && !t) {
return e;
@@ -912,7 +937,7 @@ function wa(a, b) {
r = [];
for (let y = 0, w; y < f.length; y++) {
w = e[y];
q && w.length && !w[0].doc && (this.db ? r.push(w = this.index.get(this.field[0]).db.enrich(w)) : w.length && (w = ya.call(this, w)));
q && w.length && !w[0].doc && (this.db ? r.push(w = this.index.get(this.field[0]).db.enrich(w)) : w.length && (w = Ba.call(this, w)));
if (g) {
return w;
}
@@ -924,12 +949,12 @@ function wa(a, b) {
for (let A = 0; A < w.length; A++) {
e[A].result = w[A];
}
return h ? za(e, b) : p ? Aa(e, a, y.index, y.field, y.D, p) : e;
return h ? Ca(e, b) : p ? Da(e, a, y.index, y.field, y.D, p) : e;
});
}
return h ? za(e, b) : p ? Aa(e, a, this.index, this.field, this.D, p) : e;
return h ? Ca(e, b) : p ? Da(e, a, this.index, this.field, this.D, p) : e;
};
function Aa(a, b, c, d, e, f) {
function Da(a, b, c, d, e, f) {
let g, h, k;
for (let m = 0, p, n, q, t, r; m < a.length; m++) {
p = a[m].result;
@@ -971,7 +996,7 @@ function Aa(a, b, c, d, e, f) {
}
return a;
}
function za(a, b) {
function Ca(a, b) {
const c = [], d = B();
for (let e = 0, f, g; e < a.length; e++) {
f = a[e];
@@ -990,7 +1015,7 @@ function za(a, b) {
}
return c;
}
function xa(a, b, c, d, e) {
function Aa(a, b, c, d, e) {
let f = this.tag.get(a);
if (!f) {
return console.warn("Tag '" + a + "' was not found"), [];
@@ -999,11 +1024,11 @@ function xa(a, b, c, d, e) {
if (a > c || d) {
f = f.slice(d, d + c);
}
e && (f = ya.call(this, f));
e && (f = Ba.call(this, f));
return f;
}
}
function ya(a) {
function Ba(a) {
const b = Array(a.length);
for (let c = 0, d; c < a.length; c++) {
d = a[c], b[c] = {id:d, doc:this.store.get(d)};
@@ -1011,7 +1036,7 @@ function ya(a) {
return b;
}
;function T(a) {
if (!this) {
if (this.constructor !== T) {
return new T(a);
}
const b = a.document || a.doc || a;
@@ -1019,7 +1044,7 @@ function ya(a) {
this.D = [];
this.field = [];
this.K = [];
this.key = (c = b.key || b.id) && Ba(c, this.K) || "id";
this.key = (c = b.key || b.id) && Ea(c, this.K) || "id";
(d = a.keystore || 0) && (this.keystore = d);
this.reg = (this.fastupdate = !!a.fastupdate) ? d ? new R(d) : new Map() : d ? new S(d) : new Set();
this.C = (c = b.store || null) && !0 !== c && [];
@@ -1027,7 +1052,7 @@ function ya(a) {
this.cache = (c = a.cache || null) && new U(c);
a.cache = !1;
this.worker = a.worker;
this.index = Ca.call(this, a, b);
this.index = Fa.call(this, a, b);
this.tag = null;
if (c = b.tag) {
if ("string" === typeof c && (c = [c]), c.length) {
@@ -1040,7 +1065,7 @@ function ya(a) {
if (!g) {
throw Error("The tag field from the document descriptor is undefined.");
}
f.custom ? this.G[e] = f.custom : (this.G[e] = Ba(g, this.K), f.filter && ("string" === typeof this.G[e] && (this.G[e] = new String(this.G[e])), this.G[e].I = f.filter));
f.custom ? this.G[e] = f.custom : (this.G[e] = Ea(g, this.K), f.filter && ("string" === typeof this.G[e] && (this.G[e] = new String(this.G[e])), this.G[e].I = f.filter));
this.N[e] = g;
this.tag.set(g, new Map());
}
@@ -1108,7 +1133,7 @@ v.destroy = function() {
}
return Promise.all(a);
};
function Ca(a, b) {
function Fa(a, b) {
const c = new Map();
let d = b.index || b.field || b;
G(d) && (d = [d]);
@@ -1121,19 +1146,19 @@ function Ca(a, b) {
c.set(f, h);
}
this.worker || c.set(f, new L(g, this.reg));
g.custom ? this.D[e] = g.custom : (this.D[e] = Ba(f, this.K), g.filter && ("string" === typeof this.D[e] && (this.D[e] = new String(this.D[e])), this.D[e].I = g.filter));
g.custom ? this.D[e] = g.custom : (this.D[e] = Ea(f, this.K), g.filter && ("string" === typeof this.D[e] && (this.D[e] = new String(this.D[e])), this.D[e].I = g.filter));
this.field[e] = f;
}
if (this.C) {
a = b.store;
G(a) && (a = [a]);
for (let e = 0, f, g; e < a.length; e++) {
f = a[e], g = f.field || f, f.custom ? (this.C[e] = f.custom, f.custom.U = g) : (this.C[e] = Ba(g, this.K), f.filter && ("string" === typeof this.C[e] && (this.C[e] = new String(this.C[e])), this.C[e].I = f.filter));
f = a[e], g = f.field || f, f.custom ? (this.C[e] = f.custom, f.custom.U = g) : (this.C[e] = Ea(g, this.K), f.filter && ("string" === typeof this.C[e] && (this.C[e] = new String(this.C[e])), this.C[e].I = f.filter));
}
}
return c;
}
function Ba(a, b) {
function Ea(a, b) {
const c = a.split(":");
let d = 0;
for (let e = 0; e < c.length; e++) {
@@ -1199,65 +1224,70 @@ v.set = function(a, b) {
this.store.set(a, b);
return this;
};
v.searchCache = Da;
v.export = function(a, b, c, d, e, f) {
let g;
"undefined" === typeof f && (g = new Promise(k => {
f = k;
}));
e || (e = 0);
d || (d = 0);
if (d < this.field.length) {
c = this.field[d];
var h = this.index[c];
b = this;
h.export(a, b, e ? c : "", d, e++, f) || (d++, b.export(a, b, c, d, 1, f));
} else {
switch(e) {
v.searchCache = Ga;
v.export = function(a, b, c = 0, d = 0) {
if (c < this.field.length) {
const g = this.field[c];
if ((b = this.index.get(g).export(a, g, c, d = 1)) && b.then) {
const h = this;
return b.then(function() {
return h.export(a, g, c + 1, d = 0);
});
}
return this.export(a, g, c + 1, d = 0);
}
let e, f;
switch(d) {
case 0:
e = "reg";
f = qa(this.reg);
b = null;
break;
case 1:
b = "tag";
h = this.A;
c = null;
e = "tag";
f = pa(this.tag);
b = null;
break;
case 2:
b = "store";
h = this.store;
c = null;
e = "doc";
f = oa(this.store);
b = null;
break;
case 3:
e = "cfg";
f = {};
b = null;
break;
default:
f();
return;
}
oa(a, this, c, b, d, e, h, f);
}
return g;
return ra.call(this, a, b, e, c, d, f);
};
v.import = function(a, b) {
if (b) {
switch(G(b) && (b = JSON.parse(b)), a) {
case "tag":
this.A = b;
break;
case "reg":
this.fastupdate = !1;
this.reg = b;
this.reg = new Set(b);
for (let d = 0, e; d < this.field.length; d++) {
e = this.index[this.field[d]], e.reg = b, e.fastupdate = !1;
e = this.index.get(this.field[d]), e.fastupdate = !1, e.reg = this.reg;
}
break;
case "store":
this.store = b;
case "doc":
this.store = new Map(b);
break;
default:
a = a.split(".");
const c = a[0];
a = a[1];
c && a && this.index[c].import(a, b);
c && a && this.index.get(c).import(a, b);
}
}
};
na(T.prototype);
function Da(a, b, c) {
function Ga(a, b, c) {
a = ("object" === typeof a ? "" + a.query : a).toLowerCase();
let d = this.cache.get(a);
if (!d) {
@@ -1297,31 +1327,31 @@ U.prototype.clear = function() {
this.cache.clear();
this.h = "";
};
const Ea = {normalize:function(a) {
const Ha = {normalize:function(a) {
return a.toLowerCase();
}, dedupe:!1};
const Fa = 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 Ga = new Map([["ae", "a"], ["oe", "o"], ["sh", "s"], ["kh", "k"], ["th", "t"], ["pf", "f"]]), Ha = [/([^aeo])h(.)/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2", /([^0-9])\1+/g, "$1"];
const Ia = {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 Ja = /[\x00-\x7F]+/g;
const Ka = /[\x00-\x7F]+/g;
const La = /[\x00-\x7F]+/g;
var Ma = {LatinExact:{normalize:!1, dedupe:!1}, LatinDefault:Ea, LatinSimple:{normalize:!0, dedupe:!0}, LatinBalance:{normalize:!0, dedupe:!0, mapper:Fa}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:Fa, matcher:Ga, replacer:Ha}, LatinExtra:{normalize:!0, dedupe:!0, mapper:Fa, replacer:Ha.concat([/(?!^)[aeo]/g, ""]), matcher:Ga}, LatinSoundex:{normalize:!0, dedupe:!1, include:{letter:!0}, finalize:function(a) {
const Ia = 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 Ja = new Map([["ae", "a"], ["oe", "o"], ["sh", "s"], ["kh", "k"], ["th", "t"], ["pf", "f"]]), Ka = [/([^aeo])h(.)/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2", /([^0-9])\1+/g, "$1"];
const La = {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 Ma = /[\x00-\x7F]+/g;
const Na = /[\x00-\x7F]+/g;
const Oa = /[\x00-\x7F]+/g;
var Pa = {LatinExact:{normalize:!1, dedupe:!1}, LatinDefault:Ha, LatinSimple:{normalize:!0, dedupe:!0}, LatinBalance:{normalize:!0, dedupe:!0, mapper:Ia}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:Ia, matcher:Ja, replacer:Ka}, LatinExtra:{normalize:!0, dedupe:!0, mapper:Ia, replacer:Ka.concat([/(?!^)[aeo]/g, ""]), matcher:Ja}, LatinSoundex:{normalize:!0, dedupe:!1, include:{letter:!0}, finalize:function(a) {
for (let c = 0; c < a.length; c++) {
var b = a[c];
let d = b.charAt(0), e = Ia[d];
for (let f = 1, g; f < b.length && (g = b.charAt(f), "h" === g || "w" === g || !(g = Ia[g]) || g === e || (d += g, e = g, 4 !== d.length)); f++) {
let d = b.charAt(0), e = La[d];
for (let f = 1, g; f < b.length && (g = b.charAt(f), "h" === g || "w" === g || !(g = La[g]) || g === e || (d += g, e = g, 4 !== d.length)); f++) {
}
a[c] = d;
}
}}, ArabicDefault:{rtl:!0, normalize:!1, dedupe:!0, prepare:function(a) {
return ("" + a).replace(Ja, " ");
return ("" + a).replace(Ma, " ");
}}, CjkDefault:{normalize:!1, dedupe:!0, split:"", prepare:function(a) {
return ("" + a).replace(Ka, "");
return ("" + a).replace(Na, "");
}}, CyrillicDefault:{normalize:!1, dedupe:!0, prepare:function(a) {
return ("" + a).replace(La, " ");
return ("" + a).replace(Oa, " ");
}}};
const Na = {memory:{resolution:1}, performance:{resolution:6, fastupdate:!0, context:{depth:1, resolution:3}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:9}}};
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}}};
B();
L.prototype.add = function(a, b, c, d) {
if (b && (a || 0 === a)) {
@@ -1335,14 +1365,14 @@ L.prototype.add = function(a, b, c, d) {
let t = b[this.rtl ? d - 1 - q : q];
var e = t.length;
if (e && (p || !m[t])) {
var f = this.score ? this.score(b, t, q, null, 0) : Oa(n, d, q), g = "";
var f = this.score ? this.score(b, t, q, null, 0) : Ra(n, d, q), g = "";
switch(this.tokenize) {
case "full":
if (2 < e) {
for (f = 0; f < e; f++) {
for (var h = e; h > f; h--) {
g = t.substring(f, h);
var k = this.score ? this.score(b, t, q, g, f) : Oa(n, d, q, e, f);
var k = this.score ? this.score(b, t, q, g, f) : Ra(n, d, q, e, f);
V(this, m, g, k, a, c);
}
}
@@ -1351,7 +1381,7 @@ L.prototype.add = function(a, b, c, d) {
case "reverse":
if (1 < e) {
for (h = e - 1; 0 < h; h--) {
g = t[h] + g, k = this.score ? this.score(b, t, q, g, h) : Oa(n, d, q, e, h), V(this, m, g, k, a, c);
g = t[h] + g, k = this.score ? this.score(b, t, q, g, h) : Ra(n, d, q, e, h), V(this, m, g, k, a, c);
}
g = "";
}
@@ -1367,7 +1397,7 @@ L.prototype.add = function(a, b, c, d) {
for (e = B(), g = this.R, f = t, h = Math.min(p + 1, d - q), e[f] = 1, k = 1; k < h; k++) {
if ((t = b[this.rtl ? d - 1 - q - k : q + k]) && !e[t]) {
e[t] = 1;
const r = this.score ? this.score(b, f, q, t, k) : Oa(g + (d / 2 > g ? 0 : 1), d, q, h - 1, k - 1), u = this.bidirectional && t > f;
const r = this.score ? this.score(b, f, q, t, k) : Ra(g + (d / 2 > g ? 0 : 1), d, q, h - 1, k - 1), u = this.bidirectional && t > f;
V(this, l, u ? f : t, r, a, c, u ? t : f);
}
}
@@ -1380,7 +1410,7 @@ L.prototype.add = function(a, b, c, d) {
b = "";
}
}
this.db && (b || this.commit_task.push({del:a}), this.T && Pa(this));
this.db && (b || this.commit_task.push({del:a}), this.T && Sa(this));
return this;
};
function V(a, b, c, d, e, f, g) {
@@ -1401,12 +1431,12 @@ function V(a, b, c, d, e, f, g) {
}
}
}
function Oa(a, b, c, d, e) {
function Ra(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;
}
;function W(a, b, c, d) {
if (1 === a.length) {
return a = a[0], a = c || a.length > b ? b ? a.slice(c, c + b) : a.slice(c) : a, d ? Qa(a) : a;
return a = a[0], a = c || a.length > b ? b ? a.slice(c, c + b) : a.slice(c) : a, d ? Ta(a) : a;
}
let e = [];
for (let f = 0, g, h; f < a.length; f++) {
@@ -1422,7 +1452,7 @@ function Oa(a, b, c, d, e) {
h > b && (g = g.slice(0, b), h = g.length), e.push(g);
} else {
if (h >= b) {
return h > b && (g = g.slice(0, b)), d ? Qa(g) : g;
return h > b && (g = g.slice(0, b)), d ? Ta(g) : g;
}
e = [g];
}
@@ -1436,9 +1466,9 @@ function Oa(a, b, c, d, e) {
return e;
}
e = 1 < e.length ? [].concat.apply([], e) : e[0];
return d ? Qa(e) : e;
return d ? Ta(e) : e;
}
function Qa(a) {
function Ta(a) {
for (let b = 0; b < a.length; b++) {
a[b] = {score:b, id:a[b]};
}
@@ -1488,19 +1518,19 @@ function Qa(a) {
if (c.length) {
return Promise.all(c).then(function() {
a.result.length && (d = d.concat([a.result]));
a.result = Ra(d, e, f, g, h, a.F);
a.result = Ua(d, e, f, g, h, a.F);
return h ? a.result : a;
});
}
d.length && (this.result.length && (d = d.concat([this.result])), this.result = Ra(d, e, f, g, h, this.F));
d.length && (this.result.length && (d = d.concat([this.result])), this.result = Ua(d, e, f, g, h, this.F));
return h ? this.result : this;
};
function Ra(a, b, c, d, e, f) {
function Ua(a, b, c, d, e, f) {
if (!a.length) {
return a;
}
"object" === typeof b && (c = b.offset || 0, d = b.enrich || !1, b = b.limit || 0);
return 2 > a.length ? e ? W(a[0], b, c, d) : a[0] : va(a, c, b, e, f);
return 2 > a.length ? e ? W(a[0], b, c, d) : a[0] : ya(a, c, b, e, f);
}
;X.prototype.and = function() {
if (this.result.length) {
@@ -1550,24 +1580,24 @@ function Ra(a, b, c, d, e, f) {
if (a.length) {
return Promise.all(a).then(function() {
d = [b.result].concat(d);
b.result = Sa(d, e, f, g, b.F, h);
b.result = Va(d, e, f, g, b.F, h);
return g ? b.result : b;
});
}
d = [this.result].concat(d);
this.result = Sa(d, e, f, g, this.F, h);
this.result = Va(d, e, f, g, this.F, h);
return g ? this.result : this;
}
return this;
};
function Sa(a, b, c, d, e, f) {
function Va(a, b, c, d, e, f) {
if (2 > a.length) {
return [];
}
let g = [];
B();
let h = ca(a);
return h ? ua(a, h, b, c, f, e, d) : g;
return h ? xa(a, h, b, c, f, e, d) : g;
}
;X.prototype.xor = function() {
const a = this;
@@ -1613,14 +1643,14 @@ function Sa(a, b, c, d, e, f) {
if (c.length) {
return Promise.all(c).then(function() {
a.result.length && (d = [a.result].concat(d));
a.result = Ta(d, e, f, g, !h, a.F);
a.result = Wa(d, e, f, g, !h, a.F);
return h ? a.result : a;
});
}
d.length && (this.result.length && (d = [this.result].concat(d)), this.result = Ta(d, e, f, g, !h, a.F));
d.length && (this.result.length && (d = [this.result].concat(d)), this.result = Wa(d, e, f, g, !h, a.F));
return h ? this.result : this;
};
function Ta(a, b, c, d, e, f) {
function Wa(a, b, c, d, e, f) {
if (!a.length) {
return a;
}
@@ -1714,14 +1744,14 @@ function Ta(a, b, c, d, e, f) {
}
if (c.length) {
return Promise.all(c).then(function() {
a.result = Ua.call(a, d, e, f, g);
a.result = Xa.call(a, d, e, f, g);
return g ? a.result : a;
});
}
d.length && (this.result = Ua.call(this, d, e, f, g));
d.length && (this.result = Xa.call(this, d, e, f, g));
return g ? this.result : this;
};
function Ua(a, b, c, d) {
function Xa(a, b, c, d) {
if (!a.length) {
return this.result;
}
@@ -1751,7 +1781,7 @@ function Ua(a, b, c, d) {
return e;
}
;function X(a) {
if (!this) {
if (this.constructor !== X) {
return new X(a);
}
if (a && a.index) {
@@ -1796,12 +1826,12 @@ X.prototype.boost = function(a) {
return this;
};
X.prototype.resolve = function(a, b, c) {
Va = 1;
Ya = 1;
const d = this.result;
this.result = this.index = null;
return d.length ? ("object" === typeof a && (c = a.enrich, b = a.offset, a = a.limit), W(d, a || 100, b, c)) : d;
};
let Va = 1;
let Ya = 1;
L.prototype.search = function(a, b, c) {
c || (!b && H(a) ? (c = a, a = "") : H(b) && (c = b, b = 0));
let d = [], e;
@@ -1812,22 +1842,22 @@ L.prototype.search = function(a, b, c) {
g = c.offset || 0;
var p = c.context;
f = c.suggest;
(h = Va && !1 !== c.resolve) || (Va = 0);
(h = Ya && !1 !== c.resolve) || (Ya = 0);
k = h && c.enrich;
m = c.boost;
l = this.db && c.tag;
} else {
h = this.resolve || Va;
h = this.resolve || Ya;
}
a = this.encoder.encode(a);
e = a.length;
b || !h || (b = 100);
if (1 === e) {
return Wa.call(this, a[0], "", b, g, h, k, l);
return Za.call(this, a[0], "", b, g, h, k, l);
}
p = this.depth && !1 !== p;
if (2 === e && p && !f) {
return Wa.call(this, a[0], a[1], b, g, h, k, l);
return Za.call(this, a[0], a[1], b, g, h, k, l);
}
let n = c = 0;
if (1 < e) {
@@ -1852,10 +1882,10 @@ L.prototype.search = function(a, b, c) {
}
let q = 0, t;
if (1 === e) {
return Wa.call(this, a[0], "", b, g, h, k, l);
return Za.call(this, a[0], "", b, g, h, k, l);
}
if (2 === e && p && !f) {
return Wa.call(this, a[0], a[1], b, g, h, k, l);
return Za.call(this, a[0], a[1], b, g, h, k, l);
}
1 < e && (p ? (t = a[0], q = 1) : 9 < c && 3 < c / n && a.sort(aa));
if (this.db) {
@@ -1866,7 +1896,7 @@ L.prototype.search = function(a, b, c) {
return async function() {
for (let u, x; q < e; q++) {
x = a[q];
t ? (u = await Y(r, x, t, 0, 0, !1, !1), u = Xa(u, d, f, r.R), f && !1 === u && d.length || (t = x)) : (u = await Y(r, x, "", 0, 0, !1, !1), u = Xa(u, d, f, r.resolution));
t ? (u = await Y(r, x, t, 0, 0, !1, !1), u = $a(u, d, f, r.R), f && !1 === u && d.length || (t = x)) : (u = await Y(r, x, "", 0, 0, !1, !1), u = $a(u, d, f, r.resolution));
if (u) {
return u;
}
@@ -1885,12 +1915,12 @@ L.prototype.search = function(a, b, c) {
}
}
}
return h ? ua(d, r.resolution, b, g, f, m, h) : new X(d[0]);
return h ? xa(d, r.resolution, b, g, f, m, h) : new X(d[0]);
}();
}
for (let r, u; q < e; q++) {
u = a[q];
t ? (r = Y(this, u, t, 0, 0, !1, !1), r = Xa(r, d, f, this.R), f && !1 === r && d.length || (t = u)) : (r = Y(this, u, "", 0, 0, !1, !1), r = Xa(r, d, f, this.resolution));
t ? (r = Y(this, u, t, 0, 0, !1, !1), r = $a(r, d, f, this.R), f && !1 === r && d.length || (t = u)) : (r = Y(this, u, "", 0, 0, !1, !1), r = $a(r, d, f, this.resolution));
if (r) {
return r;
}
@@ -1909,16 +1939,16 @@ L.prototype.search = function(a, b, c) {
}
}
}
d = ua(d, this.resolution, b, g, f, m, h);
d = xa(d, this.resolution, b, g, f, m, h);
return h ? d : new X(d);
};
function Wa(a, b, c, d, e, f, g) {
function Za(a, b, c, d, e, f, g) {
a = Y(this, a, b, c, d, e, f, g);
return this.db ? a.then(function(h) {
return e ? h : h && h.length ? e ? W(h, c, d) : new X(h) : e ? [] : new X([]);
}) : a && a.length ? e ? W(a, c, d) : new X(a) : e ? [] : new X([]);
}
function Xa(a, b, c, d) {
function $a(a, b, c, d) {
let e = [];
if (a) {
d = Math.min(a.length, d);
@@ -1956,15 +1986,15 @@ function Y(a, b, c, d, e, f, g, h) {
}
}
} else {
Ya(this.map, a), this.depth && Ya(this.ctx, a);
ab(this.map, a), this.depth && ab(this.ctx, a);
}
b || this.reg.delete(a);
}
this.db && (this.commit_task.push({del:a}), this.T && Pa(this));
this.db && (this.commit_task.push({del:a}), this.T && Sa(this));
this.cache && this.cache.remove(a);
return this;
};
function Ya(a, b) {
function ab(a, b) {
let c = 0;
if (a.constructor === Array) {
for (let d = 0, e, f; d < a.length; d++) {
@@ -1979,24 +2009,24 @@ function Ya(a, b) {
}
} else {
for (let d of a) {
const e = d[0], f = Ya(d[1], b);
const e = d[0], f = ab(d[1], b);
f ? c += f : a.delete(e);
}
}
return c;
}
;function L(a, b) {
if (!this) {
if (this.constructor !== L) {
return new L(a);
}
if (a) {
var c = G(a) ? a : a.preset;
c && (Na[c] || console.warn("Preset not found: " + c), a = Object.assign({}, Na[c], a));
c && (Qa[c] || console.warn("Preset not found: " + c), a = Object.assign({}, Qa[c], a));
} else {
a = {};
}
c = a.context || {};
const d = G(a.encoder) ? Ma[a.encoder] : a.encode || a.encoder || Ea;
const d = G(a.encoder) ? Pa[a.encoder] : a.encode || a.encoder || Ha;
this.encoder = d.encode ? d : "object" === typeof d ? new K(d) : {encode:d};
let e;
this.resolution = a.resolution || 9;
@@ -2033,7 +2063,7 @@ v.destroy = function() {
this.commit_timer && (clearTimeout(this.commit_timer), this.commit_timer = null);
return this.db.destroy();
};
function Pa(a) {
function Sa(a) {
a.commit_timer || (a.commit_timer = setTimeout(function() {
a.commit_timer = null;
a.db.commit(a, void 0, void 0);
@@ -2057,7 +2087,7 @@ v.update = function(a, b) {
const c = this, d = this.remove(a);
return d && d.then ? d.then(() => c.add(a, b)) : this.add(a, b);
};
function Za(a) {
function bb(a) {
let b = 0;
if (a.constructor === Array) {
for (let c = 0, d; c < a.length; c++) {
@@ -2065,7 +2095,7 @@ function Za(a) {
}
} else {
for (const c of a) {
const d = c[0], e = Za(c[1]);
const d = c[0], e = bb(c[1]);
e ? b += e : a.delete(d);
}
}
@@ -2075,63 +2105,47 @@ v.cleanup = function() {
if (!this.fastupdate) {
return console.info('Cleanup the index isn\'t required when not using "fastupdate".'), this;
}
Za(this.map);
this.depth && Za(this.ctx);
bb(this.map);
this.depth && bb(this.ctx);
return this;
};
v.searchCache = Da;
v.export = function(a, b, c, d, e, f) {
let g = !0;
"undefined" === typeof f && (g = new Promise(l => {
f = l;
}));
let h, k;
switch(e || (e = 0)) {
v.searchCache = Ga;
v.export = function(a, b, c, d = 0) {
let e, f;
switch(d) {
case 0:
h = "reg";
if (this.fastupdate) {
k = B();
for (let l of this.reg.keys()) {
k[l] = 1;
}
} else {
k = this.reg;
}
e = "reg";
f = qa(this.reg);
break;
case 1:
h = "cfg";
k = {doc:0, opt:this.h ? 1 : 0};
e = "cfg";
f = {};
break;
case 2:
h = "map";
k = this.map;
e = "map";
f = oa(this.map);
break;
case 3:
h = "ctx";
k = this.ctx;
e = "ctx";
f = pa(this.ctx);
break;
default:
"undefined" === typeof c && f && f();
return;
}
oa(a, b || this, c, h, d, e, k, f);
return g;
return ra.call(this, a, b, e, c, d, f);
};
v.import = function(a, b) {
if (b) {
switch(G(b) && (b = JSON.parse(b)), a) {
case "cfg":
this.h = !!b.opt;
break;
case "reg":
this.fastupdate = !1;
this.reg = b;
this.reg = new Set(b);
break;
case "map":
this.map = b;
this.map = new Map(b);
break;
case "ctx":
this.ctx = b;
this.ctx = new Map(b);
}
}
};
@@ -2186,10 +2200,10 @@ v.serialize = function(a = !0) {
return a ? "function inject(index){" + b + d + e + "}" : b + d + e;
};
na(L.prototype);
const ab = "undefined" !== typeof window && (window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB), bb = ["map", "ctx", "tag", "reg", "cfg"];
function cb(a, b = {}) {
const db = "undefined" !== typeof window && (window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB), eb = ["map", "ctx", "tag", "reg", "cfg"];
function fb(a, b = {}) {
if (!this) {
return new cb(a, b);
return new fb(a, b);
}
"object" === typeof a && (b = a = a.name);
a || console.info("Default storage space was used, because a name was not passed.");
@@ -2199,7 +2213,7 @@ function cb(a, b = {}) {
this.db = null;
this.h = {};
}
v = cb.prototype;
v = fb.prototype;
v.mount = function(a) {
if (!a.encoder) {
return a.mount(this);
@@ -2211,10 +2225,10 @@ v.open = function() {
let a = this;
navigator.storage && navigator.storage.persist();
return this.db || new Promise(function(b, c) {
const d = ab.open(a.id + (a.field ? ":" + a.field : ""), 1);
const d = db.open(a.id + (a.field ? ":" + a.field : ""), 1);
d.onupgradeneeded = function() {
const e = a.db = this.result;
bb.forEach(f => {
eb.forEach(f => {
e.objectStoreNames.contains(f) || e.createObjectStore(f);
});
};
@@ -2240,12 +2254,12 @@ v.close = function() {
this.db = null;
};
v.destroy = function() {
return ab.deleteDatabase(this.id + (this.field ? ":" + this.field : ""));
return db.deleteDatabase(this.id + (this.field ? ":" + this.field : ""));
};
v.clear = function() {
const a = this.db.transaction(bb, "readwrite");
for (let b = 0; b < bb.length; b++) {
a.objectStore(bb[b]).clear();
const a = this.db.transaction(eb, "readwrite");
for (let b = 0; b < eb.length; b++) {
a.objectStore(eb[b]).clear();
}
return Z(a);
};
@@ -2429,7 +2443,7 @@ v.commit = async function(a, b, c) {
}
}), a.map.clear(), a.ctx.clear(), a.tag && a.tag.clear(), a.store && a.store.clear(), a.document || a.reg.clear());
};
function db(a, b, c) {
function gb(a, b, c) {
const d = a.value;
let e, f, g = 0;
for (let h = 0, k; h < d.length; h++) {
@@ -2458,17 +2472,17 @@ v.remove = function(a) {
return Promise.all([this.transaction("map", "readwrite", function(b) {
b.openCursor().onsuccess = function() {
const c = this.result;
c && db(c, a);
c && gb(c, a);
};
}), this.transaction("ctx", "readwrite", function(b) {
b.openCursor().onsuccess = function() {
const c = this.result;
c && db(c, a);
c && gb(c, a);
};
}), this.transaction("tag", "readwrite", function(b) {
b.openCursor().onsuccess = function() {
const c = this.result;
c && db(c, a, !0);
c && gb(c, a, !0);
};
}), this.transaction("reg", "readwrite", function(b) {
for (let c = 0; c < a.length; c++) {
@@ -2488,6 +2502,6 @@ function Z(a) {
a = null;
});
}
;export default {Index:L, Charset:Ma, Encoder:K, Document:T, Worker:N, Resolver:X, IndexedDB:cb, Language:{}};
;export default {Index:L, Charset:Pa, Encoder:K, Document:T, Worker:N, Resolver:X, IndexedDB:fb, Language:{}};
export const Index=L;export const Charset=Ma;export const Encoder=K;export const Document=T;export const Worker=N;export const Resolver=X;export const IndexedDB=cb;export const Language={};
export const Index=L;export const Charset=Pa;export const Encoder=K;export const Document=T;export const Worker=N;export const Resolver=X;export const IndexedDB=fb;export const Language={};

View File

@@ -12,7 +12,7 @@ function F(a){return"string"===typeof a}function G(a){return"object"===typeof a}
"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",
"u"],["\u0217","u"],["\u0219","s"],["\u021b","t"],["\u021f","h"],["\u0227","a"],["\u0229","e"],["\u022b","o"],["\u022d","o"],["\u022f","o"],["\u0231","o"],["\u0233","y"],["\u02b0","h"],["\u02b1","h"],["\u0266","h"],["\u02b2","j"],["\u02b3","r"],["\u02b4","\u0279"],["\u02b5","\u027b"],["\u02b6","\u0281"],["\u02b7","w"],["\u02b8","y"],["\u02e0","\u0263"],["\u02e1","l"],["\u02e2","s"],["\u02e3","x"],["\u02e4","\u0295"],["\u0390","\u03b9"],["\u03ac","\u03b1"],["\u03ad","\u03b5"],["\u03ae","\u03b7"],["\u03af",
"\u03b9"],["\u03b0","\u03c5"],["\u03ca","\u03b9"],["\u03cb","\u03c5"],["\u03cc","\u03bf"],["\u03cd","\u03c5"],["\u03ce","\u03c9"],["\u03d0","\u03b2"],["\u03d1","\u03b8"],["\u03d2","\u03a5"],["\u03d3","\u03a5"],["\u03d4","\u03a5"],["\u03d5","\u03c6"],["\u03d6","\u03c0"],["\u03f0","\u03ba"],["\u03f1","\u03c1"],["\u03f2","\u03c2"],["\u03f5","\u03b5"],["\u0439","\u0438"],["\u0450","\u0435"],["\u0451","\u0435"],["\u0453","\u0433"],["\u0457","\u0456"],["\u045c","\u043a"],["\u045d","\u0438"],["\u045e","\u0443"],
["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]];const ea=/[^\p{L}\p{N}]+/u,fa=/(\d{3})/g,ha=/(\D)(\d{3})/g,ia=/(\d{3})(\D)/g,ja="".normalize&&/[\u0300-\u036f]/g;function K(a){if(!this)return new K(...arguments);for(let b=0;b<arguments.length;b++)this.assign(arguments[b])}
["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]];const ea=/[^\p{L}\p{N}]+/u,fa=/(\d{3})/g,ha=/(\D)(\d{3})/g,ia=/(\d{3})(\D)/g,ja="".normalize&&/[\u0300-\u036f]/g;function K(a){if(this.constructor!==K)return new K(...arguments);for(let b=0;b<arguments.length;b++)this.assign(arguments[b])}
K.prototype.assign=function(a){this.normalize=z(a.normalize,!0,this.normalize);let b=a.include,c=b||a.exclude||a.split;if("object"===typeof c){let d=!b,e="";a.include||(e+="\\p{Z}");c.letter&&(e+="\\p{L}");c.number&&(e+="\\p{N}",d=!!b);c.symbol&&(e+="\\p{S}");c.punctuation&&(e+="\\p{P}");c.control&&(e+="\\p{C}");if(c=c.char)e+="object"===typeof c?c.join(""):c;try{this.split=new RegExp("["+(b?"^":"")+e+"]+","u")}catch(f){this.split=/\s+/}this.numeric=d}else{try{this.split=z(c,ea,this.split)}catch(d){this.split=
/\s+/}this.numeric=z(this.numeric,!0)}this.prepare=z(a.prepare,null,this.prepare);this.finalize=z(a.finalize,null,this.finalize);ja||(this.mapper=new Map(da));this.rtl=a.rtl||!1;this.dedupe=z(a.dedupe,!0,this.dedupe);this.filter=z((c=a.filter)&&new Set(c),null,this.filter);this.matcher=z((c=a.matcher)&&new Map(c),null,this.matcher);this.mapper=z((c=a.mapper)&&new Map(c),null,this.mapper);this.stemmer=z((c=a.stemmer)&&new Map(c),null,this.stemmer);this.replacer=z(a.replacer,null,this.replacer);this.minlength=
z(a.minlength,1,this.minlength);this.maxlength=z(a.maxlength,0,this.maxlength);if(this.cache=c=z(a.cache,!0,this.cache))this.L=null,this.S="number"===typeof c?c:2E5,this.H=new Map,this.J=new Map,this.A=this.h=128;this.B="";this.O=null;this.M="";this.P=null;if(this.matcher)for(const d of this.matcher.keys())this.B+=(this.B?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.M+=(this.M?"|":"")+d;return this};
@@ -20,72 +20,72 @@ K.prototype.encode=function(a){if(this.cache&&a.length<=this.h)if(this.L){if(thi
let c=[],d=this.split||""===this.split?a.split(this.split):a;for(let f=0,g,h;f<d.length;f++){if(!(g=h=d[f]))continue;if(g.length<this.minlength)continue;if(b){c.push(g);continue}if(this.filter&&this.filter.has(g))continue;if(this.cache&&g.length<=this.A)if(this.L){var e=this.J.get(g);if(e||""===e){e&&c.push(e);continue}}else this.L=setTimeout(ka,50,this);let k;this.stemmer&&2<g.length&&(this.P||(this.P=new RegExp("(?!^)("+this.M+")$")),g=g.replace(this.P,l=>this.stemmer.get(l)),k=1);g&&k&&(g.length<
this.minlength||this.filter&&this.filter.has(g))&&(g="");if(g&&(this.mapper||this.dedupe&&1<g.length)){e="";for(let l=0,m="",p,n;l<g.length;l++)p=g.charAt(l),p===m&&this.dedupe||((n=this.mapper&&this.mapper.get(p))||""===n?n===m&&this.dedupe||!(m=n)||(e+=n):e+=m=p);g=e}this.matcher&&1<g.length&&(this.O||(this.O=new RegExp("("+this.B+")","g")),g=g.replace(this.O,l=>this.matcher.get(l)));if(g&&this.replacer)for(e=0;g&&e<this.replacer.length;e+=2)g=g.replace(this.replacer[e],this.replacer[e+1]);this.cache&&
h.length<=this.A&&(this.J.set(h,g),this.J.size>this.S&&(this.J.clear(),this.A=this.A/1.1|0));g&&c.push(g)}this.finalize&&(c=this.finalize(c)||c);this.cache&&a.length<=this.h&&(this.H.set(a,c),this.H.size>this.S&&(this.H.clear(),this.h=this.h/1.1|0));return c};function ka(a){a.L=null;a.H.clear();a.J.clear()};async function la(a){a=a.data;var b=self._index;const c=a.args;var d=a.task;switch(d){case "init":d=a.options||{};(b=d.config)&&(d=(await import(b))["default"]);(b=a.factory)?(Function("return "+b)()(self),self._index=new self.FlexSearch.Index(d),delete self.FlexSearch):self._index=new L(d);postMessage({id:a.id});break;default:a=a.id,b=b[d].apply(b,c),postMessage("search"===d?{id:a,msg:b}:{id:a})}};let M=0;
function N(a={}){function b(g){function h(k){k=k.data||k;const l=k.id,m=l&&e.h[l];m&&(m(k.msg),delete e.h[l])}this.worker=g;this.h=B();if(this.worker){d?this.worker.on("message",h):this.worker.onmessage=h;if(a.config)return new Promise(function(k){e.h[++M]=function(){k(e)};e.worker.postMessage({id:M,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",factory:c,options:a});return this}}if(!this)return new N(a);let c="undefined"!==typeof self?self._factory:"undefined"!==typeof window?
window._factory:null;c&&(c=c.toString());const d="undefined"===typeof window,e=this,f=ma(c,d,a.worker);return f.then?f.then(function(g){return b.call(e,g)}):b.call(this,f)}O("add");O("append");O("search");O("update");O("remove");
function N(a={}){function b(g){function h(k){k=k.data||k;const l=k.id,m=l&&e.h[l];m&&(m(k.msg),delete e.h[l])}this.worker=g;this.h=B();if(this.worker){d?this.worker.on("message",h):this.worker.onmessage=h;if(a.config)return new Promise(function(k){e.h[++M]=function(){k(e)};e.worker.postMessage({id:M,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",factory:c,options:a});return this}}if(this.constructor!==N)return new N(a);let c="undefined"!==typeof self?self._factory:"undefined"!==
typeof window?window._factory:null;c&&(c=c.toString());const d="undefined"===typeof window,e=this,f=ma(c,d,a.worker);return f.then?f.then(function(g){return b.call(e,g)}):b.call(this,f)}O("add");O("append");O("search");O("update");O("remove");
function O(a){N.prototype[a]=N.prototype[a+"Async"]=async function(){const b=this,c=[].slice.call(arguments);var d=c[c.length-1];let e;"function"===typeof d&&(e=d,c.splice(c.length-1,1));d=new Promise(function(f){b.h[++M]=f;b.worker.postMessage({task:a,id:M,args:c})});return e?(d.then(e),this):d}}
function ma(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="+la.toString()],{type:"text/javascript"}))):new window.Worker(F(c)?c:import.meta.url.replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js",
"module/worker/worker.js"),{type:"module"})};function na(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}function P(a){this[a+"Async"]=function(){var b=arguments;const c=b[b.length-1];let d;"function"===typeof c&&(d=c,delete b[b.length-1]);b=this[a].apply(this,b);d&&(b.then?b.then(d):d(b));return b}};function oa(a,b,c,d,e,f,g,h){(d=a(c?c+"."+d:d,JSON.stringify(g)))&&d.then?d.then(function(){b.export(a,b,c,e,f+1,h)}):b.export(a,b,c,e,f+1,h)};function pa(a,b,c,d){let e=[];for(let f=0,g;f<a.index.length;f++)if(g=a.index[f],b>=g.length)b-=g.length;else{b=g[d?"splice":"slice"](b,c);const h=b.length;if(h&&(e=e.length?e.concat(b):b,c-=h,d&&(a.length-=h),!c))break;b=0}return e}
"module/worker/worker.js"),{type:"module"})};function na(a){P.call(a,"add");P.call(a,"append");P.call(a,"search");P.call(a,"update");P.call(a,"remove")}function P(a){this[a+"Async"]=function(){var b=arguments;const c=b[b.length-1];let d;"function"===typeof c&&(d=c,delete b[b.length-1]);b=this[a].apply(this,b);d&&(b.then?b.then(d):d(b));return b}};function oa(a){const b=[];for(const c of a.entries())b.push(c);return b}function pa(a){const b=[];for(const c of a.entries())b.push(oa(c));return b}function qa(a){const b=[];for(const c of a.keys())b.push(c);return b}function ra(a,b,c,d,e,f){if((c=a(b?b+"."+c:c,JSON.stringify(f)))&&c.then){const g=this;return c.then(function(){return g.export(a,b,d,e+1)})}return this.export(a,b,d,e+1)};function sa(a,b,c,d){let e=[];for(let f=0,g;f<a.index.length;f++)if(g=a.index[f],b>=g.length)b-=g.length;else{b=g[d?"splice":"slice"](b,c);const h=b.length;if(h&&(e=e.length?e.concat(b):b,c-=h,d&&(a.length-=h),!c))break;b=0}return e}
function Q(a){if(!this)return new Q(a);this.index=a?[a]:[];this.length=a?a.length:0;const b=this;return new Proxy([],{get(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){let f=0;for(let g=0,h,k;g<b.index.length;g++){h=b.index[g];k=h.indexOf(e);if(0<=k)return f+k;f+=h.length}return-1};if("includes"===d)return function(e){for(let f=
0;f<b.index.length;f++)if(b.index[f].includes(e))return!0;return!1};if("slice"===d)return function(e,f){return pa(b,e||0,f||b.length,!1)};if("splice"===d)return function(e,f){return pa(b,e||0,f||b.length,!0)};if("constructor"===d)return Array;if("symbol"!==typeof d)return(c=b.index[d/2**31|0])&&c[d]},set(c,d,e){c=d/2**31|0;(b.index[c]||(b.index[c]=[]))[d]=e;b.length++;return!0}})}Q.prototype.clear=function(){this.index.length=0};Q.prototype.destroy=function(){this.proxy=this.index=null};
Q.prototype.push=function(){};function R(a=8){if(!this)return new R(a);this.index=B();this.B=[];this.size=0;32<a?(this.h=qa,this.A=BigInt(a)):(this.h=ra,this.A=a)}R.prototype.get=function(a){const b=this.index[this.h(a)];return b&&b.get(a)};R.prototype.set=function(a,b){var c=this.h(a);let 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 S(a=8){if(!this)return new S(a);this.index=B();this.h=[];32<a?(this.B=qa,this.A=BigInt(a)):(this.B=ra,this.A=a)}S.prototype.add=function(a){var b=this.B(a);let 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))};v=R.prototype;v.has=S.prototype.has=function(a){const b=this.index[this.B(a)];return b&&b.has(a)};v.delete=S.prototype.delete=function(a){const b=this.index[this.B(a)];b&&b.delete(a)&&this.size--};
0;f<b.index.length;f++)if(b.index[f].includes(e))return!0;return!1};if("slice"===d)return function(e,f){return sa(b,e||0,f||b.length,!1)};if("splice"===d)return function(e,f){return sa(b,e||0,f||b.length,!0)};if("constructor"===d)return Array;if("symbol"!==typeof d)return(c=b.index[d/2**31|0])&&c[d]},set(c,d,e){c=d/2**31|0;(b.index[c]||(b.index[c]=[]))[d]=e;b.length++;return!0}})}Q.prototype.clear=function(){this.index.length=0};Q.prototype.destroy=function(){this.proxy=this.index=null};
Q.prototype.push=function(){};function R(a=8){if(!this)return new R(a);this.index=B();this.B=[];this.size=0;32<a?(this.h=ta,this.A=BigInt(a)):(this.h=ua,this.A=a)}R.prototype.get=function(a){const b=this.index[this.h(a)];return b&&b.get(a)};R.prototype.set=function(a,b){var c=this.h(a);let 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 S(a=8){if(!this)return new S(a);this.index=B();this.h=[];32<a?(this.B=ta,this.A=BigInt(a)):(this.B=ua,this.A=a)}S.prototype.add=function(a){var b=this.B(a);let 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))};v=R.prototype;v.has=S.prototype.has=function(a){const b=this.index[this.B(a)];return b&&b.has(a)};v.delete=S.prototype.delete=function(a){const b=this.index[this.B(a)];b&&b.delete(a)&&this.size--};
v.clear=S.prototype.clear=function(){this.index=B();this.h=[];this.size=0};v.values=S.prototype.values=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].values())yield b};v.keys=S.prototype.keys=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].keys())yield b};v.entries=S.prototype.entries=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].entries())yield b};
function ra(a){let b=2**this.A-1;if("number"==typeof a)return a&b;let c=0,d=this.A+1;for(let e=0;e<a.length;e++)c=(c*d^a.charCodeAt(e))&b;return 32===this.A?c+2**31:c}function qa(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 d=this.A+BigInt(1);for(let e=0;e<a.length;e++)c=(c*d^BigInt(a.charCodeAt(e)))&b;return c};T.prototype.add=function(a,b,c){G(a)&&(b=a,a=J(b,this.key));if(b&&(a||0===a)){if(!c&&this.reg.has(a))return this.update(a,b);for(let h=0,k;h<this.field.length;h++){k=this.D[h];var d=this.index.get(this.field[h]);if("function"===typeof k){var e=k(b);e&&d.add(a,e,!1,!0)}else if(e=k.I,!e||e(b))k.constructor===String?k=[""+k]:F(k)&&(k=[k]),sa(b,k,this.K,0,d,a,k[0],c)}if(this.tag)for(d=0;d<this.G.length;d++){var f=this.G[d];e=this.tag.get(this.N[d]);let h=B();if("function"===typeof f){if(f=f(b),!f)continue}else{var g=
function ua(a){let b=2**this.A-1;if("number"==typeof a)return a&b;let c=0,d=this.A+1;for(let e=0;e<a.length;e++)c=(c*d^a.charCodeAt(e))&b;return 32===this.A?c+2**31:c}function ta(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 d=this.A+BigInt(1);for(let e=0;e<a.length;e++)c=(c*d^BigInt(a.charCodeAt(e)))&b;return c};T.prototype.add=function(a,b,c){G(a)&&(b=a,a=J(b,this.key));if(b&&(a||0===a)){if(!c&&this.reg.has(a))return this.update(a,b);for(let h=0,k;h<this.field.length;h++){k=this.D[h];var d=this.index.get(this.field[h]);if("function"===typeof k){var e=k(b);e&&d.add(a,e,!1,!0)}else if(e=k.I,!e||e(b))k.constructor===String?k=[""+k]:F(k)&&(k=[k]),va(b,k,this.K,0,d,a,k[0],c)}if(this.tag)for(d=0;d<this.G.length;d++){var f=this.G[d];e=this.tag.get(this.N[d]);let h=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=J(b,f)}if(e&&f){F(f)&&(f=[f]);for(let k=0,l,m;k<f.length;k++)if(l=f[k],!h[l]&&(h[l]=1,(g=e.get(l))?m=g:e.set(l,m=[]),!c||!m.includes(a))){if(m.length===2**31-1){g=new Q(m);if(this.fastupdate)for(let p of this.reg.values())p.includes(m)&&(p[p.indexOf(m)]=g);e.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 h;if(this.C){h=B();for(let k=0,l;k<this.C.length;k++){l=
this.C[k];if((c=l.I)&&!c(b))continue;let m;if("function"===typeof l){m=l(b);if(!m)continue;l=[l.U]}else if(F(l)||l.constructor===String){h[l]=b[l];continue}ta(b,h,l,0,l[0],m)}}this.store.set(a,h||b)}}return this};function ta(a,b,c,d,e,f){a=a[e];if(d===c.length-1)b[e]=f||a;else if(a)if(a.constructor===Array)for(b=b[e]=Array(a.length),e=0;e<a.length;e++)ta(a,b,c,d,e);else b=b[e]||(b[e]=B()),e=c[++d],ta(a,b,c,d,e)}
function sa(a,b,c,d,e,f,g,h){if(a=a[g])if(d===b.length-1){if(a.constructor===Array){if(c[d]){for(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(a.constructor===Array)for(g=0;g<a.length;g++)sa(a,b,c,d,e,f,g,h);else g=b[++d],sa(a,b,c,d,e,f,g,h);else e.db&&e.remove(f)};function ua(a,b,c,d,e,f,g){const h=a.length;let k=[],l;var m;l=B();for(let p=0,n,q,r,t;p<b;p++)for(let u=0;u<h;u++)if(r=a[u],p<r.length&&(n=r[p]))for(let x=0;x<n.length;x++)q=n[x],(m=l[q])?l[q]++:(m=0,l[q]=1),t=k[m]||(k[m]=[]),g||(m=p+(u?0:f||0),t=t[m]||(t[m]=[])),t.push(q);if(a=k.length)if(e)k=1<k.length?va(k,d,c,g,0):(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(g){if(k.length>c||d)k=k.slice(d,c+d)}else{e=[];for(let p=0,n;p<k.length;p++)if(n=k[p],n.length>d)d-=n.length;
this.C[k];if((c=l.I)&&!c(b))continue;let m;if("function"===typeof l){m=l(b);if(!m)continue;l=[l.U]}else if(F(l)||l.constructor===String){h[l]=b[l];continue}wa(b,h,l,0,l[0],m)}}this.store.set(a,h||b)}}return this};function wa(a,b,c,d,e,f){a=a[e];if(d===c.length-1)b[e]=f||a;else if(a)if(a.constructor===Array)for(b=b[e]=Array(a.length),e=0;e<a.length;e++)wa(a,b,c,d,e);else b=b[e]||(b[e]=B()),e=c[++d],wa(a,b,c,d,e)}
function va(a,b,c,d,e,f,g,h){if(a=a[g])if(d===b.length-1){if(a.constructor===Array){if(c[d]){for(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(a.constructor===Array)for(g=0;g<a.length;g++)va(a,b,c,d,e,f,g,h);else g=b[++d],va(a,b,c,d,e,f,g,h);else e.db&&e.remove(f)};function xa(a,b,c,d,e,f,g){const h=a.length;let k=[],l;var m;l=B();for(let p=0,n,q,r,t;p<b;p++)for(let u=0;u<h;u++)if(r=a[u],p<r.length&&(n=r[p]))for(let x=0;x<n.length;x++)q=n[x],(m=l[q])?l[q]++:(m=0,l[q]=1),t=k[m]||(k[m]=[]),g||(m=p+(u?0:f||0),t=t[m]||(t[m]=[])),t.push(q);if(a=k.length)if(e)k=1<k.length?ya(k,d,c,g,0):(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(g){if(k.length>c||d)k=k.slice(d,c+d)}else{e=[];for(let p=0,n;p<k.length;p++)if(n=k[p],n.length>d)d-=n.length;
else{if(n.length>c||d)n=n.slice(d,c+d),c-=n.length,d&&(d-=n.length);e.push(n);if(!c)break}k=1<e.length?[].concat.apply([],e):e[0]}}return k}
function va(a,b,c,d,e){const f=[],g=B();let h;var k=a.length;let l,m=0;if(d)for(e=k-1;0<=e;e--)for(d=a[e],l=d.length,k=0;k<l;k++){if(h=d[k],!g[h])if(g[h]=1,b)b--;else if(f.push(h),f.length===c)return f}else{let p=ca(a);for(let n=0;n<p;n++)for(let q=k-1;0<=q;q--)if(l=(d=a[q][n])&&d.length)for(let r=0;r<l;r++)if(h=d[r],!g[h])if(g[h]=1,b)b--;else{let t=n+(q<k-1?e||0:0);(f[t]||(f[t]=[])).push(h);if(++m===c)return f}}return f}
function wa(a,b){const c=B(),d=[];for(let e=0,f;e<b.length;e++){f=b[e];for(let g=0;g<f.length;g++)c[f[g]]=1}for(let e=0,f;e<a.length;e++)f=a[e],1===c[f]&&(d.push(f),c[f]=2);return d};T.prototype.search=function(a,b,c,d){c||(!b&&G(a)?(c=a,a=""):G(b)&&(c=b,b=0));let e=[],f=[],g;let h;let k;let l,m=0,p;if(c){c.constructor===Array&&(c={index:c});a=c.query||a;g=c.pluck;h=c.merge;k=g||c.field||c.index;var n=this.tag&&c.tag;var q=this.store&&c.enrich;var r=c.suggest;p=c.V;b=c.limit||b;l=c.offset||0;b||(b=100);if(n&&(!this.db||!d)){n.constructor!==Array&&(n=[n]);var t=[];for(let y=0,w;y<n.length;y++)if(w=n[y],w.field&&w.tag){var u=w.tag;if(u.constructor===Array)for(var x=0;x<u.length;x++)t.push(w.field,
u[x]);else t.push(w.field,u)}else{u=Object.keys(w);for(let A=0,H,C;A<u.length;A++)if(H=u[A],C=w[H],C.constructor===Array)for(x=0;x<C.length;x++)t.push(H,C[x]);else t.push(H,C)}n=t;if(!a){r=[];if(t.length)for(n=0;n<t.length;n+=2){if(this.db){d=this.index.get(t[n]);if(!d)continue;r.push(d=d.db.tag(t[n+1],b,l,q))}else d=xa.call(this,t[n],t[n+1],b,l,q);e.push({field:t[n],tag:t[n+1],result:d})}return r.length?Promise.all(r).then(function(y){for(let w=0;w<y.length;w++)e[w].result=y[w];return e}):e}}F(k)&&
function ya(a,b,c,d,e){const f=[],g=B();let h;var k=a.length;let l,m=0;if(d)for(e=k-1;0<=e;e--)for(d=a[e],l=d.length,k=0;k<l;k++){if(h=d[k],!g[h])if(g[h]=1,b)b--;else if(f.push(h),f.length===c)return f}else{let p=ca(a);for(let n=0;n<p;n++)for(let q=k-1;0<=q;q--)if(l=(d=a[q][n])&&d.length)for(let r=0;r<l;r++)if(h=d[r],!g[h])if(g[h]=1,b)b--;else{let t=n+(q<k-1?e||0:0);(f[t]||(f[t]=[])).push(h);if(++m===c)return f}}return f}
function za(a,b){const c=B(),d=[];for(let e=0,f;e<b.length;e++){f=b[e];for(let g=0;g<f.length;g++)c[f[g]]=1}for(let e=0,f;e<a.length;e++)f=a[e],1===c[f]&&(d.push(f),c[f]=2);return d};T.prototype.search=function(a,b,c,d){c||(!b&&G(a)?(c=a,a=""):G(b)&&(c=b,b=0));let e=[],f=[],g;let h;let k;let l,m=0,p;if(c){c.constructor===Array&&(c={index:c});a=c.query||a;g=c.pluck;h=c.merge;k=g||c.field||c.index;var n=this.tag&&c.tag;var q=this.store&&c.enrich;var r=c.suggest;p=c.V;b=c.limit||b;l=c.offset||0;b||(b=100);if(n&&(!this.db||!d)){n.constructor!==Array&&(n=[n]);var t=[];for(let y=0,w;y<n.length;y++)if(w=n[y],w.field&&w.tag){var u=w.tag;if(u.constructor===Array)for(var x=0;x<u.length;x++)t.push(w.field,
u[x]);else t.push(w.field,u)}else{u=Object.keys(w);for(let A=0,H,C;A<u.length;A++)if(H=u[A],C=w[H],C.constructor===Array)for(x=0;x<C.length;x++)t.push(H,C[x]);else t.push(H,C)}n=t;if(!a){r=[];if(t.length)for(n=0;n<t.length;n+=2){if(this.db){d=this.index.get(t[n]);if(!d)continue;r.push(d=d.db.tag(t[n+1],b,l,q))}else d=Aa.call(this,t[n],t[n+1],b,l,q);e.push({field:t[n],tag:t[n+1],result:d})}return r.length?Promise.all(r).then(function(y){for(let w=0;w<y.length;w++)e[w].result=y[w];return e}):e}}F(k)&&
(k=[k])}k||(k=this.field);t=!d&&(this.worker||this.db)&&[];let D;for(let y=0,w,A,H;y<k.length;y++){A=k[y];if(this.db&&this.tag&&!this.D[y])continue;let C;F(A)||(C=A,A=C.field,a=C.query||a,b=C.limit||b,l=C.offset||l,r=C.suggest||r,q=this.store&&(C.enrich||q));if(d)w=d[y];else if(u=C||c,x=this.index.get(A),n&&(this.db&&(u.tag=n,D=x.db.support_tag_search,u.field=k),D||(u.enrich=!1)),t){t[y]=x.search(a,b,u);u&&q&&(u.enrich=q);continue}else w=x.search(a,b,u),u&&q&&(u.enrich=q);H=w&&w.length;if(n&&H){u=
[];x=0;if(this.db&&d){if(!D)for(let I=k.length;I<d.length;I++){let E=d[I];if(E&&E.length)x++,u.push(E);else if(!r)return e}}else for(let I=0,E,Za;I<n.length;I+=2){E=this.tag.get(n[I]);if(!E)if(r)continue;else return e;if(Za=(E=E&&E.get(n[I+1]))&&E.length)x++,u.push(E);else if(!r)return e}if(x){w=wa(w,u);H=w.length;if(!H&&!r)return e;x--}}if(H)f[m]=A,e.push(w),m++;else if(1===k.length)return e}if(t){if(this.db&&n&&n.length&&!D)for(q=0;q<n.length;q+=2){d=this.index.get(n[q]);if(!d)if(r)continue;else return e;
t.push(d.db.tag(n[q+1],b,l,!1))}const y=this;return Promise.all(t).then(function(w){return w.length?y.search(a,b,c,w):w})}if(!m)return e;if(g&&(!q||!this.store))return e[0];t=[];for(let y=0,w;y<f.length;y++){w=e[y];q&&w.length&&!w[0].doc&&(this.db?t.push(w=this.index.get(this.field[0]).db.enrich(w)):w.length&&(w=ya.call(this,w)));if(g)return w;e[y]={field:f[y],result:w}}if(q&&this.db&&t.length){const y=this;return Promise.all(t).then(function(w){for(let A=0;A<w.length;A++)e[A].result=w[A];return h?
za(e,b):p?Aa(e,a,y.index,y.field,y.D,p):e})}return h?za(e,b):p?Aa(e,a,this.index,this.field,this.D,p):e};
function Aa(a,b,c,d,e,f){let g,h,k;for(let m=0,p,n,q,r,t;m<a.length;m++){p=a[m].result;n=a[m].field;r=c.get(n);q=r.encoder;k=r.tokenize;t=e[d.indexOf(n)];q!==g&&(g=q,h=g.encode(b));for(let u=0;u<p.length;u++){let x="";var l=J(p[u].doc,t);let D=g.encode(l);l=l.split(g.split);for(let y=0,w,A;y<D.length;y++){w=D[y];A=l[y];let H;for(let C=0,I;C<h.length;C++)if(I=h[C],"strict"===k){if(w===I){x+=(x?" ":"")+f.replace("$1",A);H=!0;break}}else{const E=w.indexOf(I);if(-1<E){x+=(x?" ":"")+A.substring(0,E)+f.replace("$1",
A.substring(E,I.length))+A.substring(E+I.length);H=!0;break}}H||(x+=(x?" ":"")+l[y])}p[u].V=x}}return a}function za(a,b){const c=[],d=B();for(let e=0,f,g;e<a.length;e++){f=a[e];g=f.result;for(let h=0,k,l,m;h<g.length;h++)if(l=g[h],k=l.id,m=d[k])m.push(f.field);else{if(c.length===b)return c;l.field=d[k]=[f.field];c.push(l)}}return c}function xa(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=ya.call(this,a));return a}}
function ya(a){const b=Array(a.length);for(let c=0,d;c<a.length;c++)d=a[c],b[c]={id:d,doc:this.store.get(d)};return b};function T(a){if(!this)return new T(a);const b=a.document||a.doc||a;let c,d;this.D=[];this.field=[];this.K=[];this.key=(c=b.key||b.id)&&Ba(c,this.K)||"id";(d=a.keystore||0)&&(this.keystore=d);this.reg=(this.fastupdate=!!a.fastupdate)?d?new R(d):new Map:d?new S(d):new Set;this.C=(c=b.store||null)&&!0!==c&&[];this.store=c&&(d?new R(d):new Map);this.cache=(c=a.cache||null)&&new U(c);a.cache=!1;this.worker=a.worker;this.index=Ca.call(this,a,b);this.tag=null;if(c=b.tag)if("string"===typeof c&&(c=[c]),
c.length){this.tag=new Map;this.G=[];this.N=[];for(let e=0,f,g;e<c.length;e++){f=c[e];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");f.custom?this.G[e]=f.custom:(this.G[e]=Ba(g,this.K),f.filter&&("string"===typeof this.G[e]&&(this.G[e]=new String(this.G[e])),this.G[e].I=f.filter));this.N[e]=g;this.tag.set(g,new Map)}}if(this.worker){a=[];for(const e of this.index.values())e.then&&a.push(e);if(a.length){const e=this;return Promise.all(a).then(function(f){let g=
[];x=0;if(this.db&&d){if(!D)for(let I=k.length;I<d.length;I++){let E=d[I];if(E&&E.length)x++,u.push(E);else if(!r)return e}}else for(let I=0,E,bb;I<n.length;I+=2){E=this.tag.get(n[I]);if(!E)if(r)continue;else return e;if(bb=(E=E&&E.get(n[I+1]))&&E.length)x++,u.push(E);else if(!r)return e}if(x){w=za(w,u);H=w.length;if(!H&&!r)return e;x--}}if(H)f[m]=A,e.push(w),m++;else if(1===k.length)return e}if(t){if(this.db&&n&&n.length&&!D)for(q=0;q<n.length;q+=2){d=this.index.get(n[q]);if(!d)if(r)continue;else return e;
t.push(d.db.tag(n[q+1],b,l,!1))}const y=this;return Promise.all(t).then(function(w){return w.length?y.search(a,b,c,w):w})}if(!m)return e;if(g&&(!q||!this.store))return e[0];t=[];for(let y=0,w;y<f.length;y++){w=e[y];q&&w.length&&!w[0].doc&&(this.db?t.push(w=this.index.get(this.field[0]).db.enrich(w)):w.length&&(w=Ba.call(this,w)));if(g)return w;e[y]={field:f[y],result:w}}if(q&&this.db&&t.length){const y=this;return Promise.all(t).then(function(w){for(let A=0;A<w.length;A++)e[A].result=w[A];return h?
Ca(e,b):p?Da(e,a,y.index,y.field,y.D,p):e})}return h?Ca(e,b):p?Da(e,a,this.index,this.field,this.D,p):e};
function Da(a,b,c,d,e,f){let g,h,k;for(let m=0,p,n,q,r,t;m<a.length;m++){p=a[m].result;n=a[m].field;r=c.get(n);q=r.encoder;k=r.tokenize;t=e[d.indexOf(n)];q!==g&&(g=q,h=g.encode(b));for(let u=0;u<p.length;u++){let x="";var l=J(p[u].doc,t);let D=g.encode(l);l=l.split(g.split);for(let y=0,w,A;y<D.length;y++){w=D[y];A=l[y];let H;for(let C=0,I;C<h.length;C++)if(I=h[C],"strict"===k){if(w===I){x+=(x?" ":"")+f.replace("$1",A);H=!0;break}}else{const E=w.indexOf(I);if(-1<E){x+=(x?" ":"")+A.substring(0,E)+f.replace("$1",
A.substring(E,I.length))+A.substring(E+I.length);H=!0;break}}H||(x+=(x?" ":"")+l[y])}p[u].V=x}}return a}function Ca(a,b){const c=[],d=B();for(let e=0,f,g;e<a.length;e++){f=a[e];g=f.result;for(let h=0,k,l,m;h<g.length;h++)if(l=g[h],k=l.id,m=d[k])m.push(f.field);else{if(c.length===b)return c;l.field=d[k]=[f.field];c.push(l)}}return c}function Aa(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=Ba.call(this,a));return a}}
function Ba(a){const b=Array(a.length);for(let c=0,d;c<a.length;c++)d=a[c],b[c]={id:d,doc:this.store.get(d)};return b};function T(a){if(this.constructor!==T)return new T(a);const b=a.document||a.doc||a;let c,d;this.D=[];this.field=[];this.K=[];this.key=(c=b.key||b.id)&&Ea(c,this.K)||"id";(d=a.keystore||0)&&(this.keystore=d);this.reg=(this.fastupdate=!!a.fastupdate)?d?new R(d):new Map:d?new S(d):new Set;this.C=(c=b.store||null)&&!0!==c&&[];this.store=c&&(d?new R(d):new Map);this.cache=(c=a.cache||null)&&new U(c);a.cache=!1;this.worker=a.worker;this.index=Fa.call(this,a,b);this.tag=null;if(c=b.tag)if("string"===typeof c&&
(c=[c]),c.length){this.tag=new Map;this.G=[];this.N=[];for(let e=0,f,g;e<c.length;e++){f=c[e];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");f.custom?this.G[e]=f.custom:(this.G[e]=Ea(g,this.K),f.filter&&("string"===typeof this.G[e]&&(this.G[e]=new String(this.G[e])),this.G[e].I=f.filter));this.N[e]=g;this.tag.set(g,new Map)}}if(this.worker){a=[];for(const e of this.index.values())e.then&&a.push(e);if(a.length){const e=this;return Promise.all(a).then(function(f){let g=
0;for(const h of e.index.entries()){const k=h[0];h[1].then&&e.index.set(k,f[g++])}return e})}}else a.db&&this.mount(a.db)}v=T.prototype;
v.mount=function(a){let b=this.field;if(this.tag)for(let e=0,f;e<this.N.length;e++){f=this.N[e];var c=void 0;this.index.set(f,c=new L({},this.reg));b===this.field&&(b=b.slice(0));b.push(f);c.tag=this.tag.get(f)}c=[];const d={db:a.db,type:a.type,fastupdate:a.fastupdate};for(let e=0,f,g;e<b.length;e++){d.field=g=b[e];f=this.index.get(g);const h=new a.constructor(a.id,d);h.id=a.id;c[e]=h.mount(f);f.document=!0;e?f.bypass=!0:f.store=this.store}this.db=!0;return Promise.all(c)};
v.commit=async function(a,b){const c=[];for(const d of this.index.values())c.push(d.db.commit(d,a,b));await Promise.all(c);this.reg.clear()};v.destroy=function(){const a=[];for(const b of this.index.values())a.push(b.destroy());return Promise.all(a)};
function Ca(a,b){const c=new Map;let d=b.index||b.field||b;F(d)&&(d=[d]);for(let e=0,f,g;e<d.length;e++){f=d[e];F(f)||(g=f,f=f.field);g=G(g)?Object.assign({},a,g):a;if(this.worker){const h=new N(g);c.set(f,h)}this.worker||c.set(f,new L(g,this.reg));g.custom?this.D[e]=g.custom:(this.D[e]=Ba(f,this.K),g.filter&&("string"===typeof this.D[e]&&(this.D[e]=new String(this.D[e])),this.D[e].I=g.filter));this.field[e]=f}if(this.C){a=b.store;F(a)&&(a=[a]);for(let e=0,f,g;e<a.length;e++)f=a[e],g=f.field||f,f.custom?
(this.C[e]=f.custom,f.custom.U=g):(this.C[e]=Ba(g,this.K),f.filter&&("string"===typeof this.C[e]&&(this.C[e]=new String(this.C[e])),this.C[e].I=f.filter))}return c}function Ba(a,b){const c=a.split(":");let d=0;for(let e=0;e<c.length;e++)a=c[e],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(b[d]=!0),a&&(c[d++]=a);d<c.length&&(c.length=d);return 1<d?c:c[0]}v.append=function(a,b){return this.add(a,b,!0)};v.update=function(a,b){return this.remove(a).add(a,b)};
function Fa(a,b){const c=new Map;let d=b.index||b.field||b;F(d)&&(d=[d]);for(let e=0,f,g;e<d.length;e++){f=d[e];F(f)||(g=f,f=f.field);g=G(g)?Object.assign({},a,g):a;if(this.worker){const h=new N(g);c.set(f,h)}this.worker||c.set(f,new L(g,this.reg));g.custom?this.D[e]=g.custom:(this.D[e]=Ea(f,this.K),g.filter&&("string"===typeof this.D[e]&&(this.D[e]=new String(this.D[e])),this.D[e].I=g.filter));this.field[e]=f}if(this.C){a=b.store;F(a)&&(a=[a]);for(let e=0,f,g;e<a.length;e++)f=a[e],g=f.field||f,f.custom?
(this.C[e]=f.custom,f.custom.U=g):(this.C[e]=Ea(g,this.K),f.filter&&("string"===typeof this.C[e]&&(this.C[e]=new String(this.C[e])),this.C[e].I=f.filter))}return c}function Ea(a,b){const c=a.split(":");let d=0;for(let e=0;e<c.length;e++)a=c[e],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(b[d]=!0),a&&(c[d++]=a);d<c.length&&(c.length=d);return 1<d?c:c[0]}v.append=function(a,b){return this.add(a,b,!0)};v.update=function(a,b){return this.remove(a).add(a,b)};
v.remove=function(a){G(a)&&(a=J(a,this.key));for(var b of this.index.values())b.remove(a,!0);if(this.reg.has(a)){if(this.tag&&!this.fastupdate)for(let c of this.tag.values())for(let d of c){b=d[0];const e=d[1],f=e.indexOf(a);-1<f&&(1<e.length?e.splice(f,1):c.delete(b))}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.db?this.index.get(this.field[0]).db.has(a):this.reg.has(a)};v.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};v.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)};
v.set=function(a,b){this.store.set(a,b);return this};v.searchCache=Da;v.export=function(a,b,c,d,e,f){let g;"undefined"===typeof f&&(g=new Promise(k=>{f=k}));e||(e=0);d||(d=0);if(d<this.field.length){c=this.field[d];var h=this.index[c];b=this;h.export(a,b,e?c:"",d,e++,f)||(d++,b.export(a,b,c,d,1,f))}else{switch(e){case 1:b="tag";h=this.A;c=null;break;case 2:b="store";h=this.store;c=null;break;default:f();return}oa(a,this,c,b,d,e,h,f)}return g};
v.import=function(a,b){if(b)switch(F(b)&&(b=JSON.parse(b)),a){case "tag":this.A=b;break;case "reg":this.fastupdate=!1;this.reg=b;for(let d=0,e;d<this.field.length;d++)e=this.index[this.field[d]],e.reg=b,e.fastupdate=!1;break;case "store":this.store=b;break;default:a=a.split(".");const c=a[0];a=a[1];c&&a&&this.index[c].import(a,b)}};na(T.prototype);function Da(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();let d=this.cache.get(a);if(!d){d=this.search(a,b,c);if(d.then){const e=this;d.then(function(f){e.cache.set(a,f);return f})}this.cache.set(a,d)}return d}function U(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}U.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.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};U.prototype.remove=function(a){for(const b of this.cache){const c=b[0];b[1].includes(a)&&this.cache.delete(c)}};U.prototype.clear=function(){this.cache.clear();this.h=""};const Ea={normalize:function(a){return a.toLowerCase()},dedupe:!1};const Fa=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 Ga=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["pf","f"]]),Ha=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\1+/g,"$1"];const Ia={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 Ja=/[\x00-\x7F]+/g;const Ka=/[\x00-\x7F]+/g;const La=/[\x00-\x7F]+/g;var Ma={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:Ea,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Fa},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Fa,matcher:Ga,replacer:Ha},LatinExtra:{normalize:!0,dedupe:!0,mapper:Fa,replacer:Ha.concat([/(?!^)[aeo]/g,""]),matcher:Ga},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let c=0;c<a.length;c++){var b=a[c];let d=b.charAt(0),e=Ia[d];for(let f=1,g;f<b.length&&(g=b.charAt(f),"h"===
g||"w"===g||!(g=Ia[g])||g===e||(d+=g,e=g,4!==d.length));f++);a[c]=d}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Ja," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(Ka,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(La," ")}}};const Na={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};B();L.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){const l=B(),m=B(),p=this.depth,n=this.resolution;for(let q=0;q<d;q++){let r=b[this.rtl?d-1-q:q];var e=r.length;if(e&&(p||!m[r])){var f=this.score?this.score(b,r,q,null,0):Oa(n,d,q),g="";switch(this.tokenize){case "full":if(2<e){for(f=0;f<e;f++)for(var h=e;h>f;h--){g=r.substring(f,h);var k=this.score?this.score(b,r,q,g,f):Oa(n,d,q,e,f);V(this,m,g,k,a,c)}break}case "reverse":if(1<
e){for(h=e-1;0<h;h--)g=r[h]+g,k=this.score?this.score(b,r,q,g,h):Oa(n,d,q,e,h),V(this,m,g,k,a,c);g=""}case "forward":if(1<e){for(h=0;h<e;h++)g+=r[h],V(this,m,g,f,a,c);break}default:if(V(this,m,r,f,a,c),p&&1<d&&q<d-1)for(e=B(),g=this.R,f=r,h=Math.min(p+1,d-q),e[f]=1,k=1;k<h;k++)if((r=b[this.rtl?d-1-q-k:q+k])&&!e[r]){e[r]=1;const t=this.score?this.score(b,f,q,r,k):Oa(g+(d/2>g?0:1),d,q,h-1,k-1),u=this.bidirectional&&r>f;V(this,l,u?f:r,t,a,c,u?r:f)}}}}this.fastupdate||this.reg.add(a)}else b=""}this.db&&
(b||this.commit_task.push({del:a}),this.T&&Pa(this));return this};function V(a,b,c,d,e,f,g){let h=g?a.ctx:a.map,k;if(!b[c]||g&&!(k=b[c])[g])if(g?(b=k||(b[c]=B()),b[g]=1,(k=h.get(g))?h=k:h.set(g,h=new Map)):b[c]=1,(k=h.get(c))?h=k:h.set(c,h=k=[]),h=h[d]||(h[d]=[]),!f||!h.includes(e)){if(h.length===2**31-1){b=new Q(h);if(a.fastupdate)for(let l of a.reg.values())l.includes(h)&&(l[l.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 Oa(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};function W(a,b,c,d){if(1===a.length)return a=a[0],a=c||a.length>b?b?a.slice(c,c+b):a.slice(c):a,d?Qa(a):a;let e=[];for(let f=0,g,h;f<a.length;f++)if((g=a[f])&&(h=g.length)){if(c){if(c>=h){c-=h;continue}c<h&&(g=b?g.slice(c,c+b):g.slice(c),h=g.length,c=0)}if(e.length)h>b&&(g=g.slice(0,b),h=g.length),e.push(g);else{if(h>=b)return h>b&&(g=g.slice(0,b)),d?Qa(g):g;e=[g]}b-=h;if(!b)break}if(!e.length)return e;e=1<e.length?[].concat.apply([],e):e[0];return d?Qa(e):e}
function Qa(a){for(let b=0;b<a.length;b++)a[b]={score:b,id:a[b]};return a};X.prototype.or=function(){const a=this;let b=arguments;var c=b[0];if(c.then)return c.then(function(){return a.or.apply(a,b)});if(c[0]&&c[0].index)return this.or.apply(this,c);let d=[];c=[];let e=0,f=0,g,h;for(let k=0,l;k<b.length;k++)if(l=b[k]){e=l.limit||0;f=l.offset||0;g=l.enrich;h=l.resolve;let m;if(l.constructor===X)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.and)m=this.and(l.and);else if(l.xor)m=this.xor(l.xor);else if(l.not)m=
this.not(l.not);else continue;d[k]=m;m.then&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=d.concat([a.result]));a.result=Ra(d,e,f,g,h,a.F);return h?a.result:a});d.length&&(this.result.length&&(d=d.concat([this.result])),this.result=Ra(d,e,f,g,h,this.F));return h?this.result:this};function Ra(a,b,c,d,e,f){if(!a.length)return a;"object"===typeof b&&(c=b.offset||0,d=b.enrich||!1,b=b.limit||0);return 2>a.length?e?W(a[0],b,c,d):a[0]:va(a,c,b,e,f)};X.prototype.and=function(){if(this.result.length){const b=this;let c=arguments;var a=c[0];if(a.then)return a.then(function(){return b.and.apply(b,c)});if(a[0]&&a[0].index)return this.and.apply(this,a);let d=[];a=[];let e=0,f=0,g,h;for(let k=0,l;k<c.length;k++)if(l=c[k]){e=l.limit||0;f=l.offset||0;g=l.resolve;h=l.suggest;let m;if(l.constructor===X)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.or)m=this.or(l.or);else if(l.xor)m=this.xor(l.xor);
else if(l.not)m=this.not(l.not);else continue;d[k]=m;m.then&&a.push(m)}if(!d.length)return this.result=d,g?this.result:this;if(a.length)return Promise.all(a).then(function(){d=[b.result].concat(d);b.result=Sa(d,e,f,g,b.F,h);return g?b.result:b});d=[this.result].concat(d);this.result=Sa(d,e,f,g,this.F,h);return g?this.result:this}return this};function Sa(a,b,c,d,e,f){if(2>a.length)return[];let g=[];B();let h=ca(a);return h?ua(a,h,b,c,f,e,d):g};X.prototype.xor=function(){const a=this;let b=arguments;var c=b[0];if(c.then)return c.then(function(){return a.xor.apply(a,b)});if(c[0]&&c[0].index)return this.xor.apply(this,c);let d=[];c=[];let e=0,f=0,g,h;for(let k=0,l;k<b.length;k++)if(l=b[k]){e=l.limit||0;f=l.offset||0;g=l.enrich;h=l.resolve;let m;if(l.constructor===X)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.or)m=this.or(l.or);else if(l.and)m=this.and(l.and);else if(l.not)m=
this.not(l.not);else continue;d[k]=m;m.then&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=[a.result].concat(d));a.result=Ta(d,e,f,g,!h,a.F);return h?a.result:a});d.length&&(this.result.length&&(d=[this.result].concat(d)),this.result=Ta(d,e,f,g,!h,a.F));return h?this.result:this};
function Ta(a,b,c,d,e,f){if(!a.length)return a;if(2>a.length)return e?W(a[0],b,c,d):a[0];d=[];const g=B();let h=0;for(let k=0,l;k<a.length;k++)if(l=a[k])for(let m=0,p;m<l.length;m++)if(p=l[m]){h<p.length&&(h=p.length);for(let n=0,q;n<p.length;n++)q=p[n],g[q]?g[q]++:g[q]=1}for(let k=0,l,m=0;k<h;k++)for(let p=0,n;p<a.length;p++)if(n=a[p])if(l=n[k])for(let q=0,r;q<l.length;q++)if(r=l[q],1===g[r])if(c)c--;else if(e){if(d.push(r),d.length===b)return d}else{const t=k+(p?f:0);d[t]||(d[t]=[]);d[t].push(r);
v.set=function(a,b){this.store.set(a,b);return this};v.searchCache=Ga;
v.export=function(a,b,c=0,d=0){if(c<this.field.length){const g=this.field[c];if((b=this.index.get(g).export(a,g,c,d=1))&&b.then){const h=this;return b.then(function(){return h.export(a,g,c+1,d=0)})}return this.export(a,g,c+1,d=0)}let e,f;switch(d){case 0:e="reg";f=qa(this.reg);b=null;break;case 1:e="tag";f=pa(this.tag);b=null;break;case 2:e="doc";f=oa(this.store);b=null;break;case 3:e="cfg";f={};b=null;break;default:return}return ra.call(this,a,b,e,c,d,f)};
v.import=function(a,b){if(b)switch(F(b)&&(b=JSON.parse(b)),a){case "tag":break;case "reg":this.fastupdate=!1;this.reg=new Set(b);for(let d=0,e;d<this.field.length;d++)e=this.index.get(this.field[d]),e.fastupdate=!1,e.reg=this.reg;break;case "doc":this.store=new Map(b);break;default:a=a.split(".");const c=a[0];a=a[1];c&&a&&this.index.get(c).import(a,b)}};na(T.prototype);function Ga(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();let d=this.cache.get(a);if(!d){d=this.search(a,b,c);if(d.then){const e=this;d.then(function(f){e.cache.set(a,f);return f})}this.cache.set(a,d)}return d}function U(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}U.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.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};U.prototype.remove=function(a){for(const b of this.cache){const c=b[0];b[1].includes(a)&&this.cache.delete(c)}};U.prototype.clear=function(){this.cache.clear();this.h=""};const Ha={normalize:function(a){return a.toLowerCase()},dedupe:!1};const Ia=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 Ja=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["pf","f"]]),Ka=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\1+/g,"$1"];const La={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 Ma=/[\x00-\x7F]+/g;const Na=/[\x00-\x7F]+/g;const Oa=/[\x00-\x7F]+/g;var Pa={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:Ha,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:Ia},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:Ia,matcher:Ja,replacer:Ka},LatinExtra:{normalize:!0,dedupe:!0,mapper:Ia,replacer:Ka.concat([/(?!^)[aeo]/g,""]),matcher:Ja},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let c=0;c<a.length;c++){var b=a[c];let d=b.charAt(0),e=La[d];for(let f=1,g;f<b.length&&(g=b.charAt(f),"h"===
g||"w"===g||!(g=La[g])||g===e||(d+=g,e=g,4!==d.length));f++);a[c]=d}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Ma," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(Na,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(Oa," ")}}};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}}};B();L.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){const l=B(),m=B(),p=this.depth,n=this.resolution;for(let q=0;q<d;q++){let r=b[this.rtl?d-1-q:q];var e=r.length;if(e&&(p||!m[r])){var f=this.score?this.score(b,r,q,null,0):Ra(n,d,q),g="";switch(this.tokenize){case "full":if(2<e){for(f=0;f<e;f++)for(var h=e;h>f;h--){g=r.substring(f,h);var k=this.score?this.score(b,r,q,g,f):Ra(n,d,q,e,f);V(this,m,g,k,a,c)}break}case "reverse":if(1<
e){for(h=e-1;0<h;h--)g=r[h]+g,k=this.score?this.score(b,r,q,g,h):Ra(n,d,q,e,h),V(this,m,g,k,a,c);g=""}case "forward":if(1<e){for(h=0;h<e;h++)g+=r[h],V(this,m,g,f,a,c);break}default:if(V(this,m,r,f,a,c),p&&1<d&&q<d-1)for(e=B(),g=this.R,f=r,h=Math.min(p+1,d-q),e[f]=1,k=1;k<h;k++)if((r=b[this.rtl?d-1-q-k:q+k])&&!e[r]){e[r]=1;const t=this.score?this.score(b,f,q,r,k):Ra(g+(d/2>g?0:1),d,q,h-1,k-1),u=this.bidirectional&&r>f;V(this,l,u?f:r,t,a,c,u?r:f)}}}}this.fastupdate||this.reg.add(a)}else b=""}this.db&&
(b||this.commit_task.push({del:a}),this.T&&Sa(this));return this};function V(a,b,c,d,e,f,g){let h=g?a.ctx:a.map,k;if(!b[c]||g&&!(k=b[c])[g])if(g?(b=k||(b[c]=B()),b[g]=1,(k=h.get(g))?h=k:h.set(g,h=new Map)):b[c]=1,(k=h.get(c))?h=k:h.set(c,h=k=[]),h=h[d]||(h[d]=[]),!f||!h.includes(e)){if(h.length===2**31-1){b=new Q(h);if(a.fastupdate)for(let l of a.reg.values())l.includes(h)&&(l[l.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 Ra(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};function W(a,b,c,d){if(1===a.length)return a=a[0],a=c||a.length>b?b?a.slice(c,c+b):a.slice(c):a,d?Ta(a):a;let e=[];for(let f=0,g,h;f<a.length;f++)if((g=a[f])&&(h=g.length)){if(c){if(c>=h){c-=h;continue}c<h&&(g=b?g.slice(c,c+b):g.slice(c),h=g.length,c=0)}if(e.length)h>b&&(g=g.slice(0,b),h=g.length),e.push(g);else{if(h>=b)return h>b&&(g=g.slice(0,b)),d?Ta(g):g;e=[g]}b-=h;if(!b)break}if(!e.length)return e;e=1<e.length?[].concat.apply([],e):e[0];return d?Ta(e):e}
function Ta(a){for(let b=0;b<a.length;b++)a[b]={score:b,id:a[b]};return a};X.prototype.or=function(){const a=this;let b=arguments;var c=b[0];if(c.then)return c.then(function(){return a.or.apply(a,b)});if(c[0]&&c[0].index)return this.or.apply(this,c);let d=[];c=[];let e=0,f=0,g,h;for(let k=0,l;k<b.length;k++)if(l=b[k]){e=l.limit||0;f=l.offset||0;g=l.enrich;h=l.resolve;let m;if(l.constructor===X)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.and)m=this.and(l.and);else if(l.xor)m=this.xor(l.xor);else if(l.not)m=
this.not(l.not);else continue;d[k]=m;m.then&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=d.concat([a.result]));a.result=Ua(d,e,f,g,h,a.F);return h?a.result:a});d.length&&(this.result.length&&(d=d.concat([this.result])),this.result=Ua(d,e,f,g,h,this.F));return h?this.result:this};function Ua(a,b,c,d,e,f){if(!a.length)return a;"object"===typeof b&&(c=b.offset||0,d=b.enrich||!1,b=b.limit||0);return 2>a.length?e?W(a[0],b,c,d):a[0]:ya(a,c,b,e,f)};X.prototype.and=function(){if(this.result.length){const b=this;let c=arguments;var a=c[0];if(a.then)return a.then(function(){return b.and.apply(b,c)});if(a[0]&&a[0].index)return this.and.apply(this,a);let d=[];a=[];let e=0,f=0,g,h;for(let k=0,l;k<c.length;k++)if(l=c[k]){e=l.limit||0;f=l.offset||0;g=l.resolve;h=l.suggest;let m;if(l.constructor===X)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.or)m=this.or(l.or);else if(l.xor)m=this.xor(l.xor);
else if(l.not)m=this.not(l.not);else continue;d[k]=m;m.then&&a.push(m)}if(!d.length)return this.result=d,g?this.result:this;if(a.length)return Promise.all(a).then(function(){d=[b.result].concat(d);b.result=Va(d,e,f,g,b.F,h);return g?b.result:b});d=[this.result].concat(d);this.result=Va(d,e,f,g,this.F,h);return g?this.result:this}return this};function Va(a,b,c,d,e,f){if(2>a.length)return[];let g=[];B();let h=ca(a);return h?xa(a,h,b,c,f,e,d):g};X.prototype.xor=function(){const a=this;let b=arguments;var c=b[0];if(c.then)return c.then(function(){return a.xor.apply(a,b)});if(c[0]&&c[0].index)return this.xor.apply(this,c);let d=[];c=[];let e=0,f=0,g,h;for(let k=0,l;k<b.length;k++)if(l=b[k]){e=l.limit||0;f=l.offset||0;g=l.enrich;h=l.resolve;let m;if(l.constructor===X)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.or)m=this.or(l.or);else if(l.and)m=this.and(l.and);else if(l.not)m=
this.not(l.not);else continue;d[k]=m;m.then&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=[a.result].concat(d));a.result=Wa(d,e,f,g,!h,a.F);return h?a.result:a});d.length&&(this.result.length&&(d=[this.result].concat(d)),this.result=Wa(d,e,f,g,!h,a.F));return h?this.result:this};
function Wa(a,b,c,d,e,f){if(!a.length)return a;if(2>a.length)return e?W(a[0],b,c,d):a[0];d=[];const g=B();let h=0;for(let k=0,l;k<a.length;k++)if(l=a[k])for(let m=0,p;m<l.length;m++)if(p=l[m]){h<p.length&&(h=p.length);for(let n=0,q;n<p.length;n++)q=p[n],g[q]?g[q]++:g[q]=1}for(let k=0,l,m=0;k<h;k++)for(let p=0,n;p<a.length;p++)if(n=a[p])if(l=n[k])for(let q=0,r;q<l.length;q++)if(r=l[q],1===g[r])if(c)c--;else if(e){if(d.push(r),d.length===b)return d}else{const t=k+(p?f:0);d[t]||(d[t]=[]);d[t].push(r);
if(++m===b)return d}return d};X.prototype.not=function(){const a=this;let b=arguments;var c=b[0];if(c.then)return c.then(function(){return a.not.apply(a,b)});if(c[0]&&c[0].index)return this.not.apply(this,c);let d=[];c=[];let e=0,f=0,g;for(let h=0,k;h<b.length;h++)if(k=b[h]){e=k.limit||0;f=k.offset||0;g=k.resolve;let l;if(k.constructor===X)l=k.result;else if(k.constructor===Array)l=k;else if(k.index)k.resolve=!1,l=k.index.search(k).result;else if(k.or)l=this.or(k.or);else if(k.and)l=this.and(k.and);else if(k.xor)l=this.xor(k.xor);
else continue;d[h]=l;l.then&&c.push(l)}if(c.length)return Promise.all(c).then(function(){a.result=Ua.call(a,d,e,f,g);return g?a.result:a});d.length&&(this.result=Ua.call(this,d,e,f,g));return g?this.result:this};
function Ua(a,b,c,d){if(!a.length)return this.result;const e=[];a=new Set(a.flat().flat());for(let f=0,g,h=0;f<this.result.length;f++)if(g=this.result[f])for(let k=0,l;k<g.length;k++)if(l=g[k],!a.has(l))if(c)c--;else if(d){if(e.push(l),e.length===b)return e}else if(e[f]||(e[f]=[]),e[f].push(l),++h===b)return e;return e};function X(a){if(!this)return new X(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.F=a.boost||0,this.result=a.index.search(a).result,this;if(a.constructor===X)return a;this.index=null;this.result=a||[];this.F=0}X.prototype.limit=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)if(e=this.result[d],e.length+c<a)b[d]=e,c+=e.length;else{b[d]=e.slice(0,a-c);this.result=b;break}}return this};
X.prototype.offset=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)e=this.result[d],e.length+c<a?c+=e.length:(b[d]=e.slice(a-c),c=a);this.result=b}return this};X.prototype.boost=function(a){this.F+=a;return this};X.prototype.resolve=function(a,b,c){Va=1;const d=this.result;this.result=this.index=null;return d.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),W(d,a||100,b,c)):d};let Va=1;
L.prototype.search=function(a,b,c){c||(!b&&G(a)?(c=a,a=""):G(b)&&(c=b,b=0));let d=[],e;let f,g=0,h,k,l,m;if(c){a=c.query||a;b=c.limit||b;g=c.offset||0;var p=c.context;f=c.suggest;(h=Va&&!1!==c.resolve)||(Va=0);k=h&&c.enrich;m=c.boost;l=this.db&&c.tag}else h=this.resolve||Va;a=this.encoder.encode(a);e=a.length;b||!h||(b=100);if(1===e)return Wa.call(this,a[0],"",b,g,h,k,l);p=this.depth&&!1!==p;if(2===e&&p&&!f)return Wa.call(this,a[0],a[1],b,g,h,k,l);let n=c=0;if(1<e){const t=B(),u=[];for(let x=0,D;x<
e;x++)if((D=a[x])&&!t[D]){if(f||this.db||Y(this,D))u.push(D),t[D]=1;else return h?d:new X(d);const y=D.length;c=Math.max(c,y);n=n?Math.min(n,y):y}a=u;e=a.length}if(!e)return h?d:new X(d);let q=0,r;if(1===e)return Wa.call(this,a[0],"",b,g,h,k,l);if(2===e&&p&&!f)return Wa.call(this,a[0],a[1],b,g,h,k,l);1<e&&(p?(r=a[0],q=1):9<c&&3<c/n&&a.sort(aa));if(this.db){if(this.db.search&&(p=this.db.search(this,a,b,g,f,h,k,l),!1!==p))return p;const t=this;return async function(){for(let u,x;q<e;q++){x=a[q];r?(u=
await Y(t,x,r,0,0,!1,!1),u=Xa(u,d,f,t.R),f&&!1===u&&d.length||(r=x)):(u=await Y(t,x,"",0,0,!1,!1),u=Xa(u,d,f,t.resolution));if(u)return u;if(f&&q===e-1){let D=d.length;if(!D){if(r){r="";q=-1;continue}return d}if(1===D)return h?W(d[0],b,g):new X(d[0])}}return h?ua(d,t.resolution,b,g,f,m,h):new X(d[0])}()}for(let t,u;q<e;q++){u=a[q];r?(t=Y(this,u,r,0,0,!1,!1),t=Xa(t,d,f,this.R),f&&!1===t&&d.length||(r=u)):(t=Y(this,u,"",0,0,!1,!1),t=Xa(t,d,f,this.resolution));if(t)return t;if(f&&q===e-1){p=d.length;
if(!p){if(r){r="";q=-1;continue}return d}if(1===p)return h?W(d[0],b,g):new X(d[0])}}d=ua(d,this.resolution,b,g,f,m,h);return h?d:new X(d)};function Wa(a,b,c,d,e,f,g){a=Y(this,a,b,c,d,e,f,g);return this.db?a.then(function(h){return e?h:h&&h.length?e?W(h,c,d):new X(h):e?[]:new X([])}):a&&a.length?e?W(a,c,d):new X(a):e?[]:new X([])}function Xa(a,b,c,d){let e=[];if(a){d=Math.min(a.length,d);for(let f=0,g;f<d;f++)(g=a[f])&&g&&(e[f]=g);if(e.length){b.push(e);return}}return!c&&e}
function Y(a,b,c,d,e,f,g,h){let k;c&&(k=a.bidirectional&&b>c);if(a.db)return c?a.db.get(k?c:b,k?b:c,d,e,f,g,h):a.db.get(b,"",d,e,f,g,h);a=c?(a=a.ctx.get(k?b:c))&&a.get(k?c:b):a.map.get(b);return a};L.prototype.remove=function(a,b){const c=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(c){if(this.fastupdate)for(let d=0,e;d<c.length;d++){if(e=c[d])if(2>e.length)e.pop();else{const f=e.indexOf(a);f===c.length-1?e.pop():e.splice(f,1)}}else Ya(this.map,a),this.depth&&Ya(this.ctx,a);b||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.T&&Pa(this));this.cache&&this.cache.remove(a);return this};
function Ya(a,b){let c=0;if(a.constructor===Array)for(let d=0,e,f;d<a.length;d++){if((e=a[d])&&e.length)if(f=e.indexOf(b),0<=f){1<e.length?(e.splice(f,1),c++):delete a[d];break}else c++}else for(let d of a){const e=d[0],f=Ya(d[1],b);f?c+=f:a.delete(e)}return c};function L(a,b){if(!this)return new L(a);if(a){var c=F(a)?a:a.preset;c&&(a=Object.assign({},Na[c],a))}else a={};c=a.context||{};const d=F(a.encoder)?Ma[a.encoder]:a.encode||a.encoder||Ea;this.encoder=d.encode?d:"object"===typeof d?new K(d):{encode:d};let e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&c.depth||0;this.bidirectional=!1!==c.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;(e=a.keystore||0)&&(this.keystore=e);this.map=
e?new R(e):new Map;this.ctx=e?new R(e):new Map;this.reg=b||(this.fastupdate?e?new R(e):new Map:e?new S(e):new Set);this.R=c.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new U(e);this.resolve=!1!==a.resolve;if(e=a.db)this.db=this.mount(e);this.T=!1!==a.commit;this.commit_task=[];this.commit_timer=null}v=L.prototype;v.mount=function(a){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return a.mount(this)};
v.commit=function(a,b){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.commit(this,a,b)};v.destroy=function(){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.destroy()};function Pa(a){a.commit_timer||(a.commit_timer=setTimeout(function(){a.commit_timer=null;a.db.commit(a,void 0,void 0)},0))}
else continue;d[h]=l;l.then&&c.push(l)}if(c.length)return Promise.all(c).then(function(){a.result=Xa.call(a,d,e,f,g);return g?a.result:a});d.length&&(this.result=Xa.call(this,d,e,f,g));return g?this.result:this};
function Xa(a,b,c,d){if(!a.length)return this.result;const e=[];a=new Set(a.flat().flat());for(let f=0,g,h=0;f<this.result.length;f++)if(g=this.result[f])for(let k=0,l;k<g.length;k++)if(l=g[k],!a.has(l))if(c)c--;else if(d){if(e.push(l),e.length===b)return e}else if(e[f]||(e[f]=[]),e[f].push(l),++h===b)return e;return e};function X(a){if(this.constructor!==X)return new X(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.F=a.boost||0,this.result=a.index.search(a).result,this;if(a.constructor===X)return a;this.index=null;this.result=a||[];this.F=0}X.prototype.limit=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)if(e=this.result[d],e.length+c<a)b[d]=e,c+=e.length;else{b[d]=e.slice(0,a-c);this.result=b;break}}return this};
X.prototype.offset=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)e=this.result[d],e.length+c<a?c+=e.length:(b[d]=e.slice(a-c),c=a);this.result=b}return this};X.prototype.boost=function(a){this.F+=a;return this};X.prototype.resolve=function(a,b,c){Ya=1;const d=this.result;this.result=this.index=null;return d.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),W(d,a||100,b,c)):d};let Ya=1;
L.prototype.search=function(a,b,c){c||(!b&&G(a)?(c=a,a=""):G(b)&&(c=b,b=0));let d=[],e;let f,g=0,h,k,l,m;if(c){a=c.query||a;b=c.limit||b;g=c.offset||0;var p=c.context;f=c.suggest;(h=Ya&&!1!==c.resolve)||(Ya=0);k=h&&c.enrich;m=c.boost;l=this.db&&c.tag}else h=this.resolve||Ya;a=this.encoder.encode(a);e=a.length;b||!h||(b=100);if(1===e)return Za.call(this,a[0],"",b,g,h,k,l);p=this.depth&&!1!==p;if(2===e&&p&&!f)return Za.call(this,a[0],a[1],b,g,h,k,l);let n=c=0;if(1<e){const t=B(),u=[];for(let x=0,D;x<
e;x++)if((D=a[x])&&!t[D]){if(f||this.db||Y(this,D))u.push(D),t[D]=1;else return h?d:new X(d);const y=D.length;c=Math.max(c,y);n=n?Math.min(n,y):y}a=u;e=a.length}if(!e)return h?d:new X(d);let q=0,r;if(1===e)return Za.call(this,a[0],"",b,g,h,k,l);if(2===e&&p&&!f)return Za.call(this,a[0],a[1],b,g,h,k,l);1<e&&(p?(r=a[0],q=1):9<c&&3<c/n&&a.sort(aa));if(this.db){if(this.db.search&&(p=this.db.search(this,a,b,g,f,h,k,l),!1!==p))return p;const t=this;return async function(){for(let u,x;q<e;q++){x=a[q];r?(u=
await Y(t,x,r,0,0,!1,!1),u=$a(u,d,f,t.R),f&&!1===u&&d.length||(r=x)):(u=await Y(t,x,"",0,0,!1,!1),u=$a(u,d,f,t.resolution));if(u)return u;if(f&&q===e-1){let D=d.length;if(!D){if(r){r="";q=-1;continue}return d}if(1===D)return h?W(d[0],b,g):new X(d[0])}}return h?xa(d,t.resolution,b,g,f,m,h):new X(d[0])}()}for(let t,u;q<e;q++){u=a[q];r?(t=Y(this,u,r,0,0,!1,!1),t=$a(t,d,f,this.R),f&&!1===t&&d.length||(r=u)):(t=Y(this,u,"",0,0,!1,!1),t=$a(t,d,f,this.resolution));if(t)return t;if(f&&q===e-1){p=d.length;
if(!p){if(r){r="";q=-1;continue}return d}if(1===p)return h?W(d[0],b,g):new X(d[0])}}d=xa(d,this.resolution,b,g,f,m,h);return h?d:new X(d)};function Za(a,b,c,d,e,f,g){a=Y(this,a,b,c,d,e,f,g);return this.db?a.then(function(h){return e?h:h&&h.length?e?W(h,c,d):new X(h):e?[]:new X([])}):a&&a.length?e?W(a,c,d):new X(a):e?[]:new X([])}function $a(a,b,c,d){let e=[];if(a){d=Math.min(a.length,d);for(let f=0,g;f<d;f++)(g=a[f])&&g&&(e[f]=g);if(e.length){b.push(e);return}}return!c&&e}
function Y(a,b,c,d,e,f,g,h){let k;c&&(k=a.bidirectional&&b>c);if(a.db)return c?a.db.get(k?c:b,k?b:c,d,e,f,g,h):a.db.get(b,"",d,e,f,g,h);a=c?(a=a.ctx.get(k?b:c))&&a.get(k?c:b):a.map.get(b);return a};L.prototype.remove=function(a,b){const c=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(c){if(this.fastupdate)for(let d=0,e;d<c.length;d++){if(e=c[d])if(2>e.length)e.pop();else{const f=e.indexOf(a);f===c.length-1?e.pop():e.splice(f,1)}}else ab(this.map,a),this.depth&&ab(this.ctx,a);b||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.T&&Sa(this));this.cache&&this.cache.remove(a);return this};
function ab(a,b){let c=0;if(a.constructor===Array)for(let d=0,e,f;d<a.length;d++){if((e=a[d])&&e.length)if(f=e.indexOf(b),0<=f){1<e.length?(e.splice(f,1),c++):delete a[d];break}else c++}else for(let d of a){const e=d[0],f=ab(d[1],b);f?c+=f:a.delete(e)}return c};function L(a,b){if(this.constructor!==L)return new L(a);if(a){var c=F(a)?a:a.preset;c&&(a=Object.assign({},Qa[c],a))}else a={};c=a.context||{};const d=F(a.encoder)?Pa[a.encoder]:a.encode||a.encoder||Ha;this.encoder=d.encode?d:"object"===typeof d?new K(d):{encode:d};let e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&c.depth||0;this.bidirectional=!1!==c.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;(e=a.keystore||0)&&(this.keystore=
e);this.map=e?new R(e):new Map;this.ctx=e?new R(e):new Map;this.reg=b||(this.fastupdate?e?new R(e):new Map:e?new S(e):new Set);this.R=c.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new U(e);this.resolve=!1!==a.resolve;if(e=a.db)this.db=this.mount(e);this.T=!1!==a.commit;this.commit_task=[];this.commit_timer=null}v=L.prototype;v.mount=function(a){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return a.mount(this)};
v.commit=function(a,b){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.commit(this,a,b)};v.destroy=function(){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.destroy()};function Sa(a){a.commit_timer||(a.commit_timer=setTimeout(function(){a.commit_timer=null;a.db.commit(a,void 0,void 0)},0))}
v.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};v.append=function(a,b){return this.add(a,b,!0)};v.contain=function(a){return this.db?this.db.has(a):this.reg.has(a)};v.update=function(a,b){const c=this,d=this.remove(a);return d&&d.then?d.then(()=>c.add(a,b)):this.add(a,b)};
function $a(a){let b=0;if(a.constructor===Array)for(let c=0,d;c<a.length;c++)(d=a[c])&&(b+=d.length);else for(const c of a){const d=c[0],e=$a(c[1]);e?b+=e:a.delete(d)}return b}v.cleanup=function(){if(!this.fastupdate)return this;$a(this.map);this.depth&&$a(this.ctx);return this};v.searchCache=Da;
v.export=function(a,b,c,d,e,f){let g=!0;"undefined"===typeof f&&(g=new Promise(l=>{f=l}));let h,k;switch(e||(e=0)){case 0:h="reg";if(this.fastupdate){k=B();for(let l of this.reg.keys())k[l]=1}else k=this.reg;break;case 1:h="cfg";k={doc:0,opt:this.h?1:0};break;case 2:h="map";k=this.map;break;case 3:h="ctx";k=this.ctx;break;default:"undefined"===typeof c&&f&&f();return}oa(a,b||this,c,h,d,e,k,f);return g};
v.import=function(a,b){if(b)switch(F(b)&&(b=JSON.parse(b)),a){case "cfg":this.h=!!b.opt;break;case "reg":this.fastupdate=!1;this.reg=b;break;case "map":this.map=b;break;case "ctx":this.ctx=b}};
function cb(a){let b=0;if(a.constructor===Array)for(let c=0,d;c<a.length;c++)(d=a[c])&&(b+=d.length);else for(const c of a){const d=c[0],e=cb(c[1]);e?b+=e:a.delete(d)}return b}v.cleanup=function(){if(!this.fastupdate)return this;cb(this.map);this.depth&&cb(this.ctx);return this};v.searchCache=Ga;
v.export=function(a,b,c,d=0){let e,f;switch(d){case 0:e="reg";f=qa(this.reg);break;case 1:e="cfg";f={};break;case 2:e="map";f=oa(this.map);break;case 3:e="ctx";f=pa(this.ctx);break;default:return}return ra.call(this,a,b,e,c,d,f)};v.import=function(a,b){if(b)switch(F(b)&&(b=JSON.parse(b)),a){case "reg":this.fastupdate=!1;this.reg=new Set(b);break;case "map":this.map=new Map(b);break;case "ctx":this.ctx=new Map(b)}};
v.serialize=function(a=!0){if(!this.reg.size)return"";let b="",c="";for(var d of this.reg.keys())c||(c=typeof d),b+=(b?",":"")+("string"===c?'"'+d+'"':d);b="index.reg=new Set(["+b+"]);";d="";for(var e of this.map.entries()){var f=e[0],g=e[1],h="";for(let m=0,p;m<g.length;m++){p=g[m]||[""];var k="";for(var l=0;l<p.length;l++)k+=(k?",":"")+("string"===c?'"'+p[l]+'"':p[l]);k="["+k+"]";h+=(h?",":"")+k}h='["'+f+'",['+h+"]]";d+=(d?",":"")+h}d="index.map=new Map(["+d+"]);";e="";for(const m of this.ctx.entries()){f=
m[0];g=m[1];for(const p of g.entries()){g=p[0];h=p[1];k="";for(let n=0,q;n<h.length;n++){q=h[n]||[""];l="";for(let r=0;r<q.length;r++)l+=(l?",":"")+("string"===c?'"'+q[r]+'"':q[r]);l="["+l+"]";k+=(k?",":"")+l}k='new Map([["'+g+'",['+k+"]]])";k='["'+f+'",'+k+"]";e+=(e?",":"")+k}}e="index.ctx=new Map(["+e+"]);";return a?"function inject(index){"+b+d+e+"}":b+d+e};na(L.prototype);const ab="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),bb=["map","ctx","tag","reg","cfg"];
function cb(a,b={}){if(!this)return new cb(a,b);"object"===typeof a&&(b=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.support_tag_search=!1;this.db=null;this.h={}}v=cb.prototype;v.mount=function(a){if(!a.encoder)return a.mount(this);a.db=this;return this.open()};
v.open=function(){let a=this;navigator.storage&&navigator.storage.persist();return this.db||new Promise(function(b,c){const d=ab.open(a.id+(a.field?":"+a.field:""),1);d.onupgradeneeded=function(){const e=a.db=this.result;bb.forEach(f=>{e.objectStoreNames.contains(f)||e.createObjectStore(f)})};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)}})};
v.close=function(){this.db.close();this.db=null};v.destroy=function(){return ab.deleteDatabase(this.id+(this.field?":"+this.field:""))};v.clear=function(){const a=this.db.transaction(bb,"readwrite");for(let b=0;b<bb.length;b++)a.objectStore(bb[b]).clear();return Z(a)};
m[0];g=m[1];for(const p of g.entries()){g=p[0];h=p[1];k="";for(let n=0,q;n<h.length;n++){q=h[n]||[""];l="";for(let r=0;r<q.length;r++)l+=(l?",":"")+("string"===c?'"'+q[r]+'"':q[r]);l="["+l+"]";k+=(k?",":"")+l}k='new Map([["'+g+'",['+k+"]]])";k='["'+f+'",'+k+"]";e+=(e?",":"")+k}}e="index.ctx=new Map(["+e+"]);";return a?"function inject(index){"+b+d+e+"}":b+d+e};na(L.prototype);const db="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),eb=["map","ctx","tag","reg","cfg"];
function fb(a,b={}){if(!this)return new fb(a,b);"object"===typeof a&&(b=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.support_tag_search=!1;this.db=null;this.h={}}v=fb.prototype;v.mount=function(a){if(!a.encoder)return a.mount(this);a.db=this;return this.open()};
v.open=function(){let a=this;navigator.storage&&navigator.storage.persist();return this.db||new Promise(function(b,c){const d=db.open(a.id+(a.field?":"+a.field:""),1);d.onupgradeneeded=function(){const e=a.db=this.result;eb.forEach(f=>{e.objectStoreNames.contains(f)||e.createObjectStore(f)})};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)}})};
v.close=function(){this.db.close();this.db=null};v.destroy=function(){return db.deleteDatabase(this.id+(this.field?":"+this.field:""))};v.clear=function(){const a=this.db.transaction(eb,"readwrite");for(let b=0;b<eb.length;b++)a.objectStore(eb[b]).clear();return Z(a)};
v.get=function(a,b,c=0,d=0,e=!0,f=!1){a=this.db.transaction(b?"ctx":"map","readonly").objectStore(b?"ctx":"map").get(b?b+":"+a:a);const g=this;return Z(a).then(function(h){let k=[];if(!h||!h.length)return k;if(e){if(!c&&!d&&1===h.length)return h[0];for(let l=0,m;l<h.length;l++)if((m=h[l])&&m.length){if(d>=m.length){d-=m.length;continue}const p=c?d+Math.min(m.length-d,c):m.length;for(let n=d;n<p;n++)k.push(m[n]);d=0;if(k.length===c)break}return f?g.enrich(k):k}return h})};
v.tag=function(a,b=0,c=0,d=!1){a=this.db.transaction("tag","readonly").objectStore("tag").get(a);const e=this;return Z(a).then(function(f){if(!f||!f.length||c>=f.length)return[];if(!b&&!c)return f;f=f.slice(c,c+b);return d?e.enrich(f):f})};
v.enrich=function(a){"object"!==typeof a&&(a=[a]);const b=this.db.transaction("reg","readonly").objectStore("reg"),c=[];for(let d=0;d<a.length;d++)c[d]=Z(b.get(a[d]));return Promise.all(c).then(function(d){for(let e=0;e<d.length;e++)d[e]={id:a[e],doc:d[e]?JSON.parse(d[e]):null};return d})};v.has=function(a){a=this.db.transaction("reg","readonly").objectStore("reg").getKey(a);return Z(a)};v.search=null;v.info=function(){};
@@ -94,7 +94,7 @@ v.commit=async function(a,b,c){if(b)await this.clear(),a.commit_task=[];else{let
for(let m=0,p,n;m<l;m++)if((n=g[m])&&n.length){if((p=h[m])&&p.length)for(k=0;k<n.length;k++)p.push(n[k]);else h[m]=n;k=1}}else h=g,k=1;k&&d.put(h,f)})}}),await this.transaction("ctx","readwrite",function(d){for(const e of a.ctx){const f=e[0],g=e[1];for(const h of g){const k=h[0],l=h[1];l.length&&(b?d.put(l,f+":"+k):d.get(f+":"+k).onsuccess=function(){let m=this.result;var p;if(m&&m.length){const n=Math.max(m.length,l.length);for(let q=0,r,t;q<n;q++)if((t=l[q])&&t.length){if((r=m[q])&&r.length)for(p=
0;p<t.length;p++)r.push(t[p]);else m[q]=t;p=1}}else m=l,p=1;p&&d.put(m,f+":"+k)})}}}),a.store?await this.transaction("reg","readwrite",function(d){for(const e of a.store){const f=e[0],g=e[1];d.put("object"===typeof g?JSON.stringify(g):1,f)}}):a.bypass||await this.transaction("reg","readwrite",function(d){for(const e of a.reg.keys())d.put(1,e)}),a.tag&&await this.transaction("tag","readwrite",function(d){for(const e of a.tag){const f=e[0],g=e[1];g.length&&(d.get(f).onsuccess=function(){let h=this.result;
h=h&&h.length?h.concat(g):g;d.put(h,f)})}}),a.map.clear(),a.ctx.clear(),a.tag&&a.tag.clear(),a.store&&a.store.clear(),a.document||a.reg.clear())};
function db(a,b,c){const d=a.value;let e,f,g=0;for(let h=0,k;h<d.length;h++){if(k=c?d:d[h]){for(let l=0,m,p;l<b.length;l++)if(p=b[l],m=k.indexOf(f?parseInt(p,10):p),0>m&&!f&&"string"===typeof p&&!isNaN(p)&&(m=k.indexOf(parseInt(p,10)))&&(f=1),0<=m)if(e=1,1<k.length)k.splice(m,1);else{d[h]=[];break}g+=k.length}if(c)break}g?e&&a.update(d):a.delete();a.continue()}
v.remove=function(a){"object"!==typeof a&&(a=[a]);return Promise.all([this.transaction("map","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&db(c,a)}}),this.transaction("ctx","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&db(c,a)}}),this.transaction("tag","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&db(c,a,!0)}}),this.transaction("reg","readwrite",function(b){for(let c=0;c<a.length;c++)b.delete(a[c])})])};
function Z(a){return new Promise((b,c)=>{a.onsuccess=function(){b(this.result)};a.oncomplete=function(){b(this.result)};a.onerror=c;a=null})};export default {Index:L,Charset:Ma,Encoder:K,Document:T,Worker:N,Resolver:X,IndexedDB:cb,Language:{}};
export const Index=L;export const Charset=Ma;export const Encoder=K;export const Document=T;export const Worker=N;export const Resolver=X;export const IndexedDB=cb;export const Language={};
function gb(a,b,c){const d=a.value;let e,f,g=0;for(let h=0,k;h<d.length;h++){if(k=c?d:d[h]){for(let l=0,m,p;l<b.length;l++)if(p=b[l],m=k.indexOf(f?parseInt(p,10):p),0>m&&!f&&"string"===typeof p&&!isNaN(p)&&(m=k.indexOf(parseInt(p,10)))&&(f=1),0<=m)if(e=1,1<k.length)k.splice(m,1);else{d[h]=[];break}g+=k.length}if(c)break}g?e&&a.update(d):a.delete();a.continue()}
v.remove=function(a){"object"!==typeof a&&(a=[a]);return Promise.all([this.transaction("map","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&gb(c,a)}}),this.transaction("ctx","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&gb(c,a)}}),this.transaction("tag","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&gb(c,a,!0)}}),this.transaction("reg","readwrite",function(b){for(let c=0;c<a.length;c++)b.delete(a[c])})])};
function Z(a){return new Promise((b,c)=>{a.onsuccess=function(){b(this.result)};a.oncomplete=function(){b(this.result)};a.onerror=c;a=null})};export default {Index:L,Charset:Pa,Encoder:K,Document:T,Worker:N,Resolver:X,IndexedDB:fb,Language:{}};
export const Index=L;export const Charset=Pa;export const Encoder=K;export const Document=T;export const Worker=N;export const Resolver=X;export const IndexedDB=fb;export const Language={};

View File

@@ -50,14 +50,14 @@ function C() {
function aa(a, c) {
return c.length - a.length;
}
function D(a) {
function E(a) {
return "string" === typeof a;
}
function H(a) {
return "object" === typeof a;
}
function I(a, c) {
if (D(c)) {
if (E(c)) {
a = a[c];
} else {
for (let b = 0; a && b < c.length; b++) {
@@ -75,15 +75,15 @@ function I(a, c) {
"\u03b8"], ["\u03d2", "\u03a5"], ["\u03d3", "\u03a5"], ["\u03d4", "\u03a5"], ["\u03d5", "\u03c6"], ["\u03d6", "\u03c0"], ["\u03f0", "\u03ba"], ["\u03f1", "\u03c1"], ["\u03f2", "\u03c2"], ["\u03f5", "\u03b5"], ["\u0439", "\u0438"], ["\u0450", "\u0435"], ["\u0451", "\u0435"], ["\u0453", "\u0433"], ["\u0457", "\u0456"], ["\u045c", "\u043a"], ["\u045d", "\u0438"], ["\u045e", "\u0443"], ["\u0477", "\u0475"], ["\u04c2", "\u0436"], ["\u04d1", "\u0430"], ["\u04d3", "\u0430"], ["\u04d7", "\u0435"], ["\u04db",
"\u04d9"], ["\u04dd", "\u0436"], ["\u04df", "\u0437"], ["\u04e3", "\u0438"], ["\u04e5", "\u0438"], ["\u04e7", "\u043e"], ["\u04eb", "\u04e9"], ["\u04ed", "\u044d"], ["\u04ef", "\u0443"], ["\u04f1", "\u0443"], ["\u04f3", "\u0443"], ["\u04f5", "\u0447"]];
const ca = /[^\p{L}\p{N}]+/u, da = /(\d{3})/g, ea = /(\D)(\d{3})/g, fa = /(\d{3})(\D)/g, J = "".normalize && /[\u0300-\u036f]/g;
function L(a) {
if (!this) {
return new L(...arguments);
function K(a) {
if (this.constructor !== K) {
return new K(...arguments);
}
for (let c = 0; c < arguments.length; c++) {
this.assign(arguments[c]);
}
}
L.prototype.assign = function(a) {
K.prototype.assign = function(a) {
this.normalize = B(a.normalize, !0, this.normalize);
let c = a.include, b = c || a.exclude || a.split;
if ("object" === typeof b) {
@@ -124,7 +124,7 @@ L.prototype.assign = function(a) {
this.minlength = B(a.minlength, 1, this.minlength);
this.maxlength = B(a.maxlength, 0, this.maxlength);
if (this.cache = b = B(a.cache, !0, this.cache)) {
this.J = null, this.O = "number" === typeof b ? b : 2e5, this.F = new Map(), this.H = new Map(), this.D = this.h = 128;
this.I = null, this.O = "number" === typeof b ? b : 2e5, this.D = new Map(), this.G = new Map(), this.J = this.A = 128;
}
this.K = "";
this.M = null;
@@ -142,14 +142,14 @@ L.prototype.assign = function(a) {
}
return this;
};
L.prototype.encode = function(a) {
if (this.cache && a.length <= this.h) {
if (this.J) {
if (this.F.has(a)) {
return this.F.get(a);
K.prototype.encode = function(a) {
if (this.cache && a.length <= this.A) {
if (this.I) {
if (this.D.has(a)) {
return this.D.get(a);
}
} else {
this.J = setTimeout(ha, 50, this);
this.I = setTimeout(ha, 50, this);
}
}
this.normalize && (a = "function" === typeof this.normalize ? this.normalize(a) : J ? a.normalize("NFKD").replace(J, "").toLowerCase() : a.toLowerCase());
@@ -171,15 +171,15 @@ L.prototype.encode = function(a) {
if (this.filter && this.filter.has(g)) {
continue;
}
if (this.cache && g.length <= this.D) {
if (this.J) {
var d = this.H.get(g);
if (this.cache && g.length <= this.J) {
if (this.I) {
var d = this.G.get(g);
if (d || "" === d) {
d && b.push(d);
continue;
}
} else {
this.J = setTimeout(ha, 50, this);
this.I = setTimeout(ha, 50, this);
}
}
let k;
@@ -198,17 +198,17 @@ L.prototype.encode = function(a) {
g = g.replace(this.replacer[d], this.replacer[d + 1]);
}
}
this.cache && h.length <= this.D && (this.H.set(h, g), this.H.size > this.O && (this.H.clear(), this.D = this.D / 1.1 | 0));
this.cache && h.length <= this.J && (this.G.set(h, g), this.G.size > this.O && (this.G.clear(), this.J = this.J / 1.1 | 0));
g && b.push(g);
}
this.finalize && (b = this.finalize(b) || b);
this.cache && a.length <= this.h && (this.F.set(a, b), this.F.size > this.O && (this.F.clear(), this.h = this.h / 1.1 | 0));
this.cache && a.length <= this.A && (this.D.set(a, b), this.D.size > this.O && (this.D.clear(), this.A = this.A / 1.1 | 0));
return b;
};
function ha(a) {
a.J = null;
a.F.clear();
a.H.clear();
a.I = null;
a.D.clear();
a.G.clear();
}
;function ia(a) {
M.call(a, "add");
@@ -228,12 +228,37 @@ function M(a) {
return c;
};
}
;function ja(a, c, b, e, d, f, g, h) {
(e = a(b ? b + "." + e : e, JSON.stringify(g))) && e.then ? e.then(function() {
c.export(a, c, b, d, f + 1, h);
}) : c.export(a, c, b, d, f + 1, h);
;function N(a) {
const c = [];
for (const b of a.entries()) {
c.push(b);
}
;N.prototype.add = function(a, c, b) {
return c;
}
function ja(a) {
const c = [];
for (const b of a.entries()) {
c.push(N(b));
}
return c;
}
function ka(a) {
const c = [];
for (const b of a.keys()) {
c.push(b);
}
return c;
}
function la(a, c, b, e, d, f) {
if ((b = a(c ? c + "." + b : b, JSON.stringify(f))) && b.then) {
const g = this;
return b.then(function() {
return g.export(a, c, e, d + 1);
});
}
return this.export(a, c, e, d + 1);
}
;O.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)) {
@@ -246,8 +271,8 @@ function M(a) {
var d = k(c);
d && e.add(a, d, !1, !0);
} else {
if (d = k.G, !d || d(c)) {
k.constructor === String ? k = ["" + k] : D(k) && (k = [k]), O(c, k, this.I, 0, e, a, k[0], b);
if (d = k.F, !d || d(c)) {
k.constructor === String ? k = ["" + k] : E(k) && (k = [k]), P(c, k, this.H, 0, e, a, k[0], b);
}
}
}
@@ -261,7 +286,7 @@ function M(a) {
continue;
}
} else {
const k = f.G;
const k = f.F;
if (k && !k(c)) {
continue;
}
@@ -269,7 +294,7 @@ function M(a) {
f = I(c, f);
}
if (d && f) {
D(f) && (f = [f]);
E(f) && (f = [f]);
for (let k = 0, l, m; k < f.length; k++) {
l = f[k], h[l] || (h[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]))));
}
@@ -280,11 +305,11 @@ function M(a) {
}
if (this.store && (!b || !this.store.has(a))) {
let h;
if (this.A) {
if (this.h) {
h = C();
for (let k = 0, l; k < this.A.length; k++) {
l = this.A[k];
if ((b = l.G) && !b(c)) {
for (let k = 0, l; k < this.h.length; k++) {
l = this.h[k];
if ((b = l.F) && !b(c)) {
continue;
}
let m;
@@ -294,11 +319,11 @@ function M(a) {
continue;
}
l = [l.S];
} else if (D(l) || l.constructor === String) {
} else if (E(l) || l.constructor === String) {
h[l] = c[l];
continue;
}
P(c, h, l, 0, l[0], m);
Q(c, h, l, 0, l[0], m);
}
}
this.store.set(a, h || c);
@@ -306,21 +331,21 @@ function M(a) {
}
return this;
};
function P(a, c, b, e, d, f) {
function Q(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++) {
P(a, c, b, e, d);
Q(a, c, b, e, d);
}
} else {
c = c[d] || (c[d] = C()), d = b[++e], P(a, c, b, e, d);
c = c[d] || (c[d] = C()), d = b[++e], Q(a, c, b, e, d);
}
}
}
function O(a, c, b, e, d, f, g, h) {
function P(a, c, b, e, d, f, g, h) {
if (a = a[g]) {
if (e === c.length - 1) {
if (a.constructor === Array) {
@@ -336,15 +361,15 @@ function O(a, c, b, e, d, f, g, h) {
} else {
if (a.constructor === Array) {
for (g = 0; g < a.length; g++) {
O(a, c, b, e, d, f, g, h);
P(a, c, b, e, d, f, g, h);
}
} else {
g = c[++e], O(a, c, b, e, d, f, g, h);
g = c[++e], P(a, c, b, e, d, f, g, h);
}
}
}
}
;function ka(a, c) {
;function ma(a, c) {
const b = C(), e = [];
for (let d = 0, f; d < c.length; d++) {
f = c[d];
@@ -357,7 +382,7 @@ function O(a, c, b, e, d, f, g, h) {
}
return e;
}
;N.prototype.search = function(a, c, b, e) {
;O.prototype.search = function(a, c, b, e) {
b || (!c && H(a) ? (b = a, a = "") : H(c) && (b = c, c = 0));
let d = [];
var f = [];
@@ -380,7 +405,7 @@ function O(a, c, b, e, d, f, g, h) {
var u = [];
for (let w = 0, q; w < m.length; w++) {
q = m[w];
if (D(q)) {
if (E(q)) {
throw Error("A tag option can't be a string, instead it needs a { field: tag } format.");
}
if (q.field && q.tag) {
@@ -394,8 +419,8 @@ function O(a, c, b, e, d, f, g, h) {
}
} else {
v = Object.keys(q);
for (let E = 0, A, z; E < v.length; E++) {
if (A = v[E], z = q[A], z.constructor === Array) {
for (let D = 0, A, z; D < v.length; D++) {
if (A = v[D], z = q[A], z.constructor === Array) {
for (y = 0; y < z.length; y++) {
u.push(A, z[y]);
}
@@ -413,7 +438,7 @@ function O(a, c, b, e, d, f, g, h) {
e = [];
if (u.length) {
for (f = 0; f < u.length; f += 2) {
r = la.call(this, u[f], u[f + 1], c, n, g), d.push({field:u[f], tag:u[f + 1], result:r});
r = na.call(this, u[f], u[f + 1], c, n, g), d.push({field:u[f], tag:u[f + 1], result:r});
}
}
return e.length ? Promise.all(e).then(function(w) {
@@ -424,18 +449,18 @@ function O(a, c, b, e, d, f, g, h) {
}) : d;
}
}
D(l) && (l = [l]);
E(l) && (l = [l]);
}
l || (l = this.field);
u = !e && (this.worker || this.db) && [];
for (let w = 0, q, E, A; w < l.length; w++) {
E = l[w];
for (let w = 0, q, D, A; w < l.length; w++) {
D = l[w];
let z;
D(E) || (z = E, E = z.field, a = z.query || a, c = z.limit || c, n = z.offset || n, k = z.suggest || k, g = this.store && (z.enrich || g));
E(D) || (z = D, D = z.field, a = z.query || a, c = z.limit || c, n = z.offset || n, k = z.suggest || k, g = this.store && (z.enrich || g));
if (e) {
q = e[w];
} else {
if (v = z || b, y = this.index.get(E), m && (v.enrich = !1), u) {
if (v = z || b, y = this.index.get(D), m && (v.enrich = !1), u) {
u[w] = y.search(a, c, v);
v && g && (v.enrich = g);
continue;
@@ -447,7 +472,7 @@ function O(a, c, b, e, d, f, g, h) {
if (m && A) {
v = [];
y = 0;
for (let G = 0, F, K; G < m.length; G += 2) {
for (let G = 0, F, L; G < m.length; G += 2) {
F = this.tag.get(m[G]);
if (!F) {
if (console.warn("Tag '" + m[G] + ":" + m[G + 1] + "' will be skipped because there is no field '" + m[G] + "'."), k) {
@@ -456,14 +481,14 @@ function O(a, c, b, e, d, f, g, h) {
return d;
}
}
if (K = (F = F && F.get(m[G + 1])) && F.length) {
if (L = (F = F && F.get(m[G + 1])) && F.length) {
y++, v.push(F);
} else if (!k) {
return d;
}
}
if (y) {
q = ka(q, v);
q = ma(q, v);
A = q.length;
if (!A && !k) {
return d;
@@ -472,7 +497,7 @@ function O(a, c, b, e, d, f, g, h) {
}
}
if (A) {
f[t] = E, d.push(q), t++;
f[t] = D, d.push(q), t++;
} else if (1 === l.length) {
return d;
}
@@ -492,15 +517,15 @@ function O(a, c, b, e, d, f, g, h) {
u = [];
for (let w = 0, q; w < f.length; w++) {
q = d[w];
g && q.length && !q[0].doc && q.length && (q = ma.call(this, q));
g && q.length && !q[0].doc && q.length && (q = oa.call(this, q));
if (r) {
return q;
}
d[w] = {field:f[w], result:q};
}
return h ? na(d, c) : p ? oa(d, a, this.index, this.field, this.C, p) : d;
return h ? pa(d, c) : p ? qa(d, a, this.index, this.field, this.C, p) : d;
};
function oa(a, c, b, e, d, f) {
function qa(a, c, b, e, d, f) {
let g, h, k;
for (let m = 0, n, t, p, r, u; m < a.length; m++) {
n = a[m].result;
@@ -515,21 +540,21 @@ function oa(a, c, b, e, d, f) {
var l = I(n[v].doc, u);
let w = g.encode(l);
l = l.split(g.split);
for (let q = 0, E, A; q < w.length; q++) {
E = w[q];
for (let q = 0, D, A; q < w.length; q++) {
D = w[q];
A = l[q];
let z;
for (let G = 0, F; G < h.length; G++) {
if (F = h[G], "strict" === k) {
if (E === F) {
if (D === F) {
y += (y ? " " : "") + f.replace("$1", A);
z = !0;
break;
}
} else {
const K = E.indexOf(F);
if (-1 < K) {
y += (y ? " " : "") + A.substring(0, K) + f.replace("$1", A.substring(K, F.length)) + A.substring(K + F.length);
const L = D.indexOf(F);
if (-1 < L) {
y += (y ? " " : "") + A.substring(0, L) + f.replace("$1", A.substring(L, F.length)) + A.substring(L + F.length);
z = !0;
break;
}
@@ -542,7 +567,7 @@ function oa(a, c, b, e, d, f) {
}
return a;
}
function na(a, c) {
function pa(a, c) {
const b = [], e = C();
for (let d = 0, f, g; d < a.length; d++) {
f = a[d];
@@ -561,7 +586,7 @@ function na(a, c) {
}
return b;
}
function la(a, c, b, e, d) {
function na(a, c, b, e, d) {
let f = this.tag.get(a);
if (!f) {
return console.warn("Tag '" + a + "' was not found"), [];
@@ -570,43 +595,43 @@ function la(a, c, b, e, d) {
if (a > b || e) {
f = f.slice(e, e + b);
}
d && (f = ma.call(this, f));
d && (f = oa.call(this, f));
return f;
}
}
function ma(a) {
function oa(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 N(a) {
if (!this) {
return new N(a);
;function O(a) {
if (this.constructor !== O) {
return new O(a);
}
const c = a.document || a.doc || a;
var b;
this.C = [];
this.field = [];
this.I = [];
this.key = (b = c.key || c.id) && Q(b, this.I) || "id";
this.H = [];
this.key = (b = c.key || c.id) && R(b, this.H) || "id";
this.reg = (this.fastupdate = !!a.fastupdate) ? new Map() : new Set();
this.A = (b = c.store || null) && !0 !== b && [];
this.h = (b = c.store || null) && !0 !== b && [];
this.store = b && new Map();
this.cache = (b = a.cache || null) && new R(b);
this.cache = (b = a.cache || null) && new S(b);
a.cache = !1;
b = new Map();
let e = c.index || c.field || c;
D(e) && (e = [e]);
E(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 S(g, this.reg)), g.custom ? this.C[d] = g.custom : (this.C[d] = Q(f, this.I), g.filter && ("string" === typeof this.C[d] && (this.C[d] = new String(this.C[d])), this.C[d].G = g.filter)), this.field[d] = f;
f = e[d], E(f) || (g = f, f = f.field), g = H(g) ? Object.assign({}, a, g) : a, b.set(f, new T(g, this.reg)), g.custom ? this.C[d] = g.custom : (this.C[d] = R(f, this.H), g.filter && ("string" === typeof this.C[d] && (this.C[d] = new String(this.C[d])), this.C[d].F = g.filter)), this.field[d] = f;
}
if (this.A) {
if (this.h) {
a = c.store;
D(a) && (a = [a]);
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.S = g) : (this.A[d] = Q(g, this.I), f.filter && ("string" === typeof this.A[d] && (this.A[d] = new String(this.A[d])), this.A[d].G = f.filter));
f = a[d], g = f.field || f, f.custom ? (this.h[d] = f.custom, f.custom.S = g) : (this.h[d] = R(g, this.H), f.filter && ("string" === typeof this.h[d] && (this.h[d] = new String(this.h[d])), this.h[d].F = f.filter));
}
}
this.index = b;
@@ -622,14 +647,14 @@ function ma(a) {
if (!g) {
throw Error("The tag field from the document descriptor is undefined.");
}
f.custom ? this.B[d] = f.custom : (this.B[d] = Q(g, this.I), f.filter && ("string" === typeof this.B[d] && (this.B[d] = new String(this.B[d])), this.B[d].G = f.filter));
f.custom ? this.B[d] = f.custom : (this.B[d] = R(g, this.H), f.filter && ("string" === typeof this.B[d] && (this.B[d] = new String(this.B[d])), this.B[d].F = f.filter));
this.R[d] = g;
this.tag.set(g, new Map());
}
}
}
}
function Q(a, c) {
function R(a, c) {
const b = a.split(":");
let e = 0;
for (let d = 0; d < b.length; d++) {
@@ -638,7 +663,7 @@ function Q(a, c) {
e < b.length && (b.length = e);
return 1 < e ? b : b[0];
}
x = N.prototype;
x = O.prototype;
x.append = function(a, c) {
return this.add(a, c, !0);
};
@@ -694,65 +719,70 @@ x.set = function(a, c) {
this.store.set(a, c);
return this;
};
x.searchCache = pa;
x.export = function(a, c, b, e, d, f) {
let g;
"undefined" === typeof f && (g = new Promise(k => {
f = k;
}));
d || (d = 0);
e || (e = 0);
if (e < this.field.length) {
b = this.field[e];
var h = this.index[b];
c = this;
h.export(a, c, d ? b : "", e, d++, f) || (e++, c.export(a, c, b, e, 1, f));
} else {
switch(d) {
x.searchCache = ra;
x.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 h = this;
return c.then(function() {
return h.export(a, g, b + 1, e = 0);
});
}
return this.export(a, g, b + 1, e = 0);
}
let d, f;
switch(e) {
case 0:
d = "reg";
f = ka(this.reg);
c = null;
break;
case 1:
c = "tag";
h = this.D;
b = null;
d = "tag";
f = ja(this.tag);
c = null;
break;
case 2:
c = "store";
h = this.store;
b = null;
d = "doc";
f = N(this.store);
c = null;
break;
case 3:
d = "cfg";
f = {};
c = null;
break;
default:
f();
return;
}
ja(a, this, b, c, e, d, h, f);
}
return g;
return la.call(this, a, c, d, b, e, f);
};
x.import = function(a, c) {
if (c) {
switch(D(c) && (c = JSON.parse(c)), a) {
switch(E(c) && (c = JSON.parse(c)), a) {
case "tag":
this.D = c;
break;
case "reg":
this.fastupdate = !1;
this.reg = c;
this.reg = new Set(c);
for (let e = 0, d; e < this.field.length; e++) {
d = this.index[this.field[e]], d.reg = c, d.fastupdate = !1;
d = this.index.get(this.field[e]), d.fastupdate = !1, d.reg = this.reg;
}
break;
case "store":
this.store = c;
case "doc":
this.store = new Map(c);
break;
default:
a = a.split(".");
const b = a[0];
a = a[1];
b && a && this.index[b].import(a, c);
b && a && this.index.get(b).import(a, c);
}
}
};
ia(N.prototype);
function pa(a, c, b) {
ia(O.prototype);
function ra(a, c, b) {
a = ("object" === typeof a ? "" + a.query : a).toLowerCase();
let e = this.cache.get(a);
if (!e) {
@@ -768,57 +798,57 @@ function pa(a, c, b) {
}
return e;
}
function R(a) {
function S(a) {
this.limit = a && !0 !== a ? a : 1000;
this.cache = new Map();
this.h = "";
this.A = "";
}
R.prototype.set = function(a, c) {
this.cache.set(this.h = a, c);
S.prototype.set = function(a, c) {
this.cache.set(this.A = a, c);
this.cache.size > this.limit && this.cache.delete(this.cache.keys().next().value);
};
R.prototype.get = function(a) {
S.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));
c && this.A !== a && (this.cache.delete(a), this.cache.set(this.A = a, c));
return c;
};
R.prototype.remove = function(a) {
S.prototype.remove = function(a) {
for (const c of this.cache) {
const b = c[0];
c[1].includes(a) && this.cache.delete(b);
}
};
R.prototype.clear = function() {
S.prototype.clear = function() {
this.cache.clear();
this.h = "";
this.A = "";
};
const qa = {normalize:function(a) {
const sa = {normalize:function(a) {
return a.toLowerCase();
}, dedupe:!1};
const T = 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 ra = new Map([["ae", "a"], ["oe", "o"], ["sh", "s"], ["kh", "k"], ["th", "t"], ["pf", "f"]]), sa = [/([^aeo])h(.)/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2", /([^0-9])\1+/g, "$1"];
const ta = {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 ua = /[\x00-\x7F]+/g;
const va = /[\x00-\x7F]+/g;
const U = 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 ta = new Map([["ae", "a"], ["oe", "o"], ["sh", "s"], ["kh", "k"], ["th", "t"], ["pf", "f"]]), ua = [/([^aeo])h(.)/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2", /([^0-9])\1+/g, "$1"];
const va = {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 wa = /[\x00-\x7F]+/g;
var xa = {LatinExact:{normalize:!1, dedupe:!1}, LatinDefault:qa, LatinSimple:{normalize:!0, dedupe:!0}, LatinBalance:{normalize:!0, dedupe:!0, mapper:T}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:T, matcher:ra, replacer:sa}, LatinExtra:{normalize:!0, dedupe:!0, mapper:T, replacer:sa.concat([/(?!^)[aeo]/g, ""]), matcher:ra}, LatinSoundex:{normalize:!0, dedupe:!1, include:{letter:!0}, finalize:function(a) {
const xa = /[\x00-\x7F]+/g;
const ya = /[\x00-\x7F]+/g;
var za = {LatinExact:{normalize:!1, dedupe:!1}, LatinDefault:sa, LatinSimple:{normalize:!0, dedupe:!0}, LatinBalance:{normalize:!0, dedupe:!0, mapper:U}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:U, matcher:ta, replacer:ua}, LatinExtra:{normalize:!0, dedupe:!0, mapper:U, replacer:ua.concat([/(?!^)[aeo]/g, ""]), matcher:ta}, 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 = ta[e];
for (let f = 1, g; f < c.length && (g = c.charAt(f), "h" === g || "w" === g || !(g = ta[g]) || g === d || (e += g, d = g, 4 !== e.length)); f++) {
let e = c.charAt(0), d = va[e];
for (let f = 1, g; f < c.length && (g = c.charAt(f), "h" === g || "w" === g || !(g = va[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(ua, " ");
}}, CjkDefault:{normalize:!1, dedupe:!0, split:"", prepare:function(a) {
return ("" + a).replace(va, "");
}}, CyrillicDefault:{normalize:!1, dedupe:!0, prepare:function(a) {
return ("" + a).replace(wa, " ");
}}, CjkDefault:{normalize:!1, dedupe:!0, split:"", prepare:function(a) {
return ("" + a).replace(xa, "");
}}, CyrillicDefault:{normalize:!1, dedupe:!0, prepare:function(a) {
return ("" + a).replace(ya, " ");
}}};
const ya = {memory:{resolution:1}, performance:{resolution:6, fastupdate:!0, context:{depth:1, resolution:3}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:9}}};
const Aa = {memory:{resolution:1}, performance:{resolution:6, fastupdate:!0, context:{depth:1, resolution:3}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:9}}};
C();
S.prototype.add = function(a, c, b, e) {
T.prototype.add = function(a, c, b, e) {
if (c && (a || 0 === a)) {
if (!e && !b && this.reg.has(a)) {
return this.update(a, c);
@@ -830,15 +860,15 @@ S.prototype.add = function(a, c, b, e) {
let r = c[this.rtl ? e - 1 - p : p];
var d = r.length;
if (d && (n || !m[r])) {
var f = this.score ? this.score(c, r, p, null, 0) : U(t, e, p), g = "";
var f = this.score ? this.score(c, r, p, null, 0) : V(t, e, p), g = "";
switch(this.tokenize) {
case "full":
if (2 < d) {
for (f = 0; f < d; f++) {
for (var h = d; h > f; h--) {
g = r.substring(f, h);
var k = this.score ? this.score(c, r, p, g, f) : U(t, e, p, d, f);
V(this, m, g, k, a, b);
var k = this.score ? this.score(c, r, p, g, f) : V(t, e, p, d, f);
W(this, m, g, k, a, b);
}
}
break;
@@ -846,24 +876,24 @@ S.prototype.add = function(a, c, b, e) {
case "reverse":
if (1 < d) {
for (h = d - 1; 0 < h; h--) {
g = r[h] + g, k = this.score ? this.score(c, r, p, g, h) : U(t, e, p, d, h), V(this, m, g, k, a, b);
g = r[h] + g, k = this.score ? this.score(c, r, p, g, h) : V(t, e, p, d, h), W(this, m, g, k, a, b);
}
g = "";
}
case "forward":
if (1 < d) {
for (h = 0; h < d; h++) {
g += r[h], V(this, m, g, f, a, b);
g += r[h], W(this, m, g, f, a, b);
}
break;
}
default:
if (V(this, m, r, f, a, b), n && 1 < e && p < e - 1) {
if (W(this, m, r, f, a, b), n && 1 < e && p < e - 1) {
for (d = C(), g = this.P, f = r, h = Math.min(n + 1, e - p), d[f] = 1, k = 1; k < h; k++) {
if ((r = c[this.rtl ? e - 1 - p - k : p + k]) && !d[r]) {
d[r] = 1;
const u = this.score ? this.score(c, f, p, r, k) : U(g + (e / 2 > g ? 0 : 1), e, p, h - 1, k - 1), v = this.bidirectional && r > f;
V(this, l, v ? f : r, u, a, b, v ? r : f);
const u = this.score ? this.score(c, f, p, r, k) : V(g + (e / 2 > g ? 0 : 1), e, p, h - 1, k - 1), v = this.bidirectional && r > f;
W(this, l, v ? f : r, u, a, b, v ? r : f);
}
}
}
@@ -875,16 +905,16 @@ S.prototype.add = function(a, c, b, e) {
}
return this;
};
function V(a, c, b, e, d, f, g) {
function W(a, c, b, e, d, f, g) {
let h = g ? a.ctx : a.map, k;
if (!c[b] || g && !(k = c[b])[g]) {
g ? (c = k || (c[b] = C()), c[g] = 1, (k = h.get(g)) ? h = k : h.set(g, h = new Map())) : c[b] = 1, (k = h.get(b)) ? h = k : h.set(b, h = []), h = h[e] || (h[e] = []), f && h.includes(d) || (h.push(d), a.fastupdate && ((c = a.reg.get(d)) ? c.push(h) : a.reg.set(d, [h])));
}
}
function U(a, c, b, e, d) {
function V(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;
}
;function za(a, c, b) {
;function Ba(a, c, b) {
if (1 === a.length) {
return a = a[0], a = b || a.length > c ? c ? a.slice(b, b + c) : a.slice(b) : a;
}
@@ -914,7 +944,7 @@ function U(a, c, b, e, d) {
}
return e.length ? e = 1 < e.length ? [].concat.apply([], e) : e[0] : e;
}
;S.prototype.search = function(a, c, b) {
;T.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) {
@@ -928,11 +958,11 @@ function U(a, c, b, e, d) {
b = a.length;
c || (c = 100);
if (1 === b) {
return W.call(this, a[0], "", c, d);
return X.call(this, a[0], "", c, d);
}
f = this.depth && !1 !== f;
if (2 === b && f && !g) {
return W.call(this, a[0], a[1], c, d);
return X.call(this, a[0], a[1], c, d);
}
var h = 0, k = 0;
if (1 < b) {
@@ -940,7 +970,7 @@ function U(a, c, b, e, d) {
const n = [];
for (let t = 0, p; t < b; t++) {
if ((p = a[t]) && !l[p]) {
if (g || X(this, p)) {
if (g || Y(this, p)) {
n.push(p), l[p] = 1;
} else {
return e;
@@ -958,10 +988,10 @@ function U(a, c, b, e, d) {
}
l = 0;
if (1 === b) {
return W.call(this, a[0], "", c, d);
return X.call(this, a[0], "", c, d);
}
if (2 === b && f && !g) {
return W.call(this, a[0], a[1], c, d);
return X.call(this, a[0], a[1], c, d);
}
if (1 < b) {
if (f) {
@@ -973,7 +1003,7 @@ function U(a, c, b, e, d) {
}
for (let n, t; l < b; l++) {
t = a[l];
m ? (n = X(this, t, m), n = Aa(n, e, g, this.P), g && !1 === n && e.length || (m = t)) : (n = X(this, t, ""), n = Aa(n, e, g, this.resolution));
m ? (n = Y(this, t, m), n = Ca(n, e, g, this.P), g && !1 === n && e.length || (m = t)) : (n = Y(this, t, ""), n = Ca(n, e, g, this.resolution));
if (n) {
return n;
}
@@ -988,7 +1018,7 @@ function U(a, c, b, e, d) {
return e;
}
if (1 === f) {
return za(e[0], c, d);
return Ba(e[0], c, d);
}
}
}
@@ -1047,10 +1077,10 @@ function U(a, c, b, e, d) {
}
return e;
};
function W(a, c, b, e) {
return (a = X(this, a, c)) && a.length ? za(a, b, e) : [];
function X(a, c, b, e) {
return (a = Y(this, a, c)) && a.length ? Ba(a, b, e) : [];
}
function Aa(a, c, b, e) {
function Ca(a, c, b, e) {
let d = [];
if (a) {
e = Math.min(a.length, e);
@@ -1064,13 +1094,13 @@ function Aa(a, c, b, e) {
}
return !b && d;
}
function X(a, c, b) {
function Y(a, c, b) {
let e;
b && (e = a.bidirectional && c > b);
a = b ? (a = a.ctx.get(e ? c : b)) && a.get(e ? b : c) : a.map.get(c);
return a;
}
;S.prototype.remove = function(a, c) {
;T.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) {
@@ -1085,14 +1115,14 @@ function X(a, c, b) {
}
}
} else {
Y(this.map, a), this.depth && Y(this.ctx, a);
Da(this.map, a), this.depth && Da(this.ctx, a);
}
c || this.reg.delete(a);
}
this.cache && this.cache.remove(a);
return this;
};
function Y(a, c) {
function Da(a, c) {
let b = 0;
if (a.constructor === Array) {
for (let e = 0, d, f; e < a.length; e++) {
@@ -1107,25 +1137,25 @@ function Y(a, c) {
}
} else {
for (let e of a) {
const d = e[0], f = Y(e[1], c);
const d = e[0], f = Da(e[1], c);
f ? b += f : a.delete(d);
}
}
return b;
}
;function S(a, c) {
if (!this) {
return new S(a);
;function T(a, c) {
if (this.constructor !== T) {
return new T(a);
}
if (a) {
var b = D(a) ? a : a.preset;
b && (ya[b] || console.warn("Preset not found: " + b), a = Object.assign({}, ya[b], a));
var b = E(a) ? a : a.preset;
b && (Aa[b] || console.warn("Preset not found: " + b), a = Object.assign({}, Aa[b], a));
} else {
a = {};
}
b = a.context || {};
const e = D(a.encoder) ? xa[a.encoder] : a.encode || a.encoder || qa;
this.encoder = e.encode ? e : "object" === typeof e ? new L(e) : {encode:e};
const e = E(a.encoder) ? za[a.encoder] : a.encode || a.encoder || sa;
this.encoder = e.encode ? e : "object" === typeof e ? new K(e) : {encode:e};
let d;
this.resolution = a.resolution || 9;
this.tokenize = d = a.tokenize || "strict";
@@ -1139,9 +1169,9 @@ function Y(a, c) {
this.reg = c || (this.fastupdate ? new Map() : new Set());
this.P = b.resolution || 1;
this.rtl = e.rtl || a.rtl || !1;
this.cache = (d = a.cache || null) && new R(d);
this.cache = (d = a.cache || null) && new S(d);
}
x = S.prototype;
x = T.prototype;
x.clear = function() {
this.map.clear();
this.ctx.clear();
@@ -1159,7 +1189,7 @@ x.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 Ba(a) {
function Ea(a) {
let c = 0;
if (a.constructor === Array) {
for (let b = 0, e; b < a.length; b++) {
@@ -1167,7 +1197,7 @@ function Ba(a) {
}
} else {
for (const b of a) {
const e = b[0], d = Ba(b[1]);
const e = b[0], d = Ea(b[1]);
d ? c += d : a.delete(e);
}
}
@@ -1177,63 +1207,47 @@ x.cleanup = function() {
if (!this.fastupdate) {
return console.info('Cleanup the index isn\'t required when not using "fastupdate".'), this;
}
Ba(this.map);
this.depth && Ba(this.ctx);
Ea(this.map);
this.depth && Ea(this.ctx);
return this;
};
x.searchCache = pa;
x.export = function(a, c, b, e, d, f) {
let g = !0;
"undefined" === typeof f && (g = new Promise(l => {
f = l;
}));
let h, k;
switch(d || (d = 0)) {
x.searchCache = ra;
x.export = function(a, c, b, e = 0) {
let d, f;
switch(e) {
case 0:
h = "reg";
if (this.fastupdate) {
k = C();
for (let l of this.reg.keys()) {
k[l] = 1;
}
} else {
k = this.reg;
}
d = "reg";
f = ka(this.reg);
break;
case 1:
h = "cfg";
k = {doc:0, opt:this.h ? 1 : 0};
d = "cfg";
f = {};
break;
case 2:
h = "map";
k = this.map;
d = "map";
f = N(this.map);
break;
case 3:
h = "ctx";
k = this.ctx;
d = "ctx";
f = ja(this.ctx);
break;
default:
"undefined" === typeof b && f && f();
return;
}
ja(a, c || this, b, h, e, d, k, f);
return g;
return la.call(this, a, c, d, b, e, f);
};
x.import = function(a, c) {
if (c) {
switch(D(c) && (c = JSON.parse(c)), a) {
case "cfg":
this.h = !!c.opt;
break;
switch(E(c) && (c = JSON.parse(c)), a) {
case "reg":
this.fastupdate = !1;
this.reg = c;
this.reg = new Set(c);
break;
case "map":
this.map = c;
this.map = new Map(c);
break;
case "ctx":
this.ctx = c;
this.ctx = new Map(c);
}
}
};
@@ -1287,10 +1301,10 @@ x.serialize = function(a = !0) {
d = "index.ctx=new Map([" + d + "]);";
return a ? "function inject(index){" + c + e + d + "}" : c + e + d;
};
ia(S.prototype);
const Ca = {Index:S, Charset:xa, Encoder:L, Document:N, Worker:null, Resolver:null, IndexedDB:null, Language:{}}, Z = self;
let Da;
(Da = Z.define) && Da.amd ? Da([], function() {
return Ca;
}) : "object" === typeof Z.exports ? Z.exports = Ca : Z.FlexSearch = Ca;
ia(T.prototype);
const Fa = {Index:T, Charset:za, Encoder:K, Document:O, Worker:null, Resolver:null, IndexedDB:null, Language:{}}, Z = self;
let Ga;
(Ga = Z.define) && Ga.amd ? Ga([], function() {
return Fa;
}) : "object" === typeof Z.exports ? Z.exports = Fa : Z.FlexSearch = Fa;
}(this||self));

View File

@@ -5,48 +5,47 @@
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
(function _f(self){'use strict';if(typeof module!=='undefined')self=module;else if(typeof process !== 'undefined')self=process;self._factory=_f;var x;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(h){return a(b(h))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var g=new Map(b);for(var f of a)g.set(f[0],f[1]);return g}if(c===Set){f=new Set(b);for(g of a.values())f.add(g);return f}}}return a}return b}return"undefined"===d?c:a}function C(){return Object.create(null)}function aa(a,c){return c.length-a.length}
function E(a){return"string"===typeof a}function H(a){return"object"===typeof a}function I(a,c){if(E(c))a=a[c];else for(let b=0;a&&b<c.length;b++)a=a[c[b]];return a};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 _f(self){'use strict';if(typeof module!=='undefined')self=module;else if(typeof process !== 'undefined')self=process;self._factory=_f;var x;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(h){return a(b(h))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var g=new Map(b);for(var f of a)g.set(f[0],f[1]);return g}if(c===Set){f=new Set(b);for(g of a.values())f.add(g);return f}}}return a}return b}return"undefined"===d?c:a}function D(){return Object.create(null)}function aa(a,c){return c.length-a.length}
function E(a){return"string"===typeof a}function G(a){return"object"===typeof a}function I(a,c){if(E(c))a=a[c];else for(let b=0;a&&b<c.length;b++)a=a[c[b]];return a};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",
"u"],["\u0217","u"],["\u0219","s"],["\u021b","t"],["\u021f","h"],["\u0227","a"],["\u0229","e"],["\u022b","o"],["\u022d","o"],["\u022f","o"],["\u0231","o"],["\u0233","y"],["\u02b0","h"],["\u02b1","h"],["\u0266","h"],["\u02b2","j"],["\u02b3","r"],["\u02b4","\u0279"],["\u02b5","\u027b"],["\u02b6","\u0281"],["\u02b7","w"],["\u02b8","y"],["\u02e0","\u0263"],["\u02e1","l"],["\u02e2","s"],["\u02e3","x"],["\u02e4","\u0295"],["\u0390","\u03b9"],["\u03ac","\u03b1"],["\u03ad","\u03b5"],["\u03ae","\u03b7"],["\u03af",
"\u03b9"],["\u03b0","\u03c5"],["\u03ca","\u03b9"],["\u03cb","\u03c5"],["\u03cc","\u03bf"],["\u03cd","\u03c5"],["\u03ce","\u03c9"],["\u03d0","\u03b2"],["\u03d1","\u03b8"],["\u03d2","\u03a5"],["\u03d3","\u03a5"],["\u03d4","\u03a5"],["\u03d5","\u03c6"],["\u03d6","\u03c0"],["\u03f0","\u03ba"],["\u03f1","\u03c1"],["\u03f2","\u03c2"],["\u03f5","\u03b5"],["\u0439","\u0438"],["\u0450","\u0435"],["\u0451","\u0435"],["\u0453","\u0433"],["\u0457","\u0456"],["\u045c","\u043a"],["\u045d","\u0438"],["\u045e","\u0443"],
["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]];const ca=/[^\p{L}\p{N}]+/u,da=/(\d{3})/g,ea=/(\D)(\d{3})/g,fa=/(\d{3})(\D)/g,J="".normalize&&/[\u0300-\u036f]/g;function L(a){if(!this)return new L(...arguments);for(let c=0;c<arguments.length;c++)this.assign(arguments[c])}
L.prototype.assign=function(a){this.normalize=B(a.normalize,!0,this.normalize);let c=a.include,b=c||a.exclude||a.split;if("object"===typeof b){let e=!c,d="";a.include||(d+="\\p{Z}");b.letter&&(d+="\\p{L}");b.number&&(d+="\\p{N}",e=!!c);b.symbol&&(d+="\\p{S}");b.punctuation&&(d+="\\p{P}");b.control&&(d+="\\p{C}");if(b=b.char)d+="object"===typeof b?b.join(""):b;try{this.split=new RegExp("["+(c?"^":"")+d+"]+","u")}catch(g){this.split=/\s+/}this.numeric=e}else{try{this.split=B(b,ca,this.split)}catch(e){this.split=
["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]];const ca=/[^\p{L}\p{N}]+/u,da=/(\d{3})/g,ea=/(\D)(\d{3})/g,fa=/(\d{3})(\D)/g,J="".normalize&&/[\u0300-\u036f]/g;function K(a){if(this.constructor!==K)return new K(...arguments);for(let c=0;c<arguments.length;c++)this.assign(arguments[c])}
K.prototype.assign=function(a){this.normalize=B(a.normalize,!0,this.normalize);let c=a.include,b=c||a.exclude||a.split;if("object"===typeof b){let e=!c,d="";a.include||(d+="\\p{Z}");b.letter&&(d+="\\p{L}");b.number&&(d+="\\p{N}",e=!!c);b.symbol&&(d+="\\p{S}");b.punctuation&&(d+="\\p{P}");b.control&&(d+="\\p{C}");if(b=b.char)d+="object"===typeof b?b.join(""):b;try{this.split=new RegExp("["+(c?"^":"")+d+"]+","u")}catch(g){this.split=/\s+/}this.numeric=e}else{try{this.split=B(b,ca,this.split)}catch(e){this.split=
/\s+/}this.numeric=B(this.numeric,!0)}this.prepare=B(a.prepare,null,this.prepare);this.finalize=B(a.finalize,null,this.finalize);J||(this.mapper=new Map(ba));this.rtl=a.rtl||!1;this.dedupe=B(a.dedupe,!0,this.dedupe);this.filter=B((b=a.filter)&&new Set(b),null,this.filter);this.matcher=B((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=B((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=B((b=a.stemmer)&&new Map(b),null,this.stemmer);this.replacer=B(a.replacer,null,this.replacer);this.minlength=
B(a.minlength,1,this.minlength);this.maxlength=B(a.maxlength,0,this.maxlength);if(this.cache=b=B(a.cache,!0,this.cache))this.J=null,this.O="number"===typeof b?b:2E5,this.F=new Map,this.H=new Map,this.D=this.h=128;this.K="";this.M=null;this.L="";this.N=null;if(this.matcher)for(const e of this.matcher.keys())this.K+=(this.K?"|":"")+e;if(this.stemmer)for(const e of this.stemmer.keys())this.L+=(this.L?"|":"")+e;return this};
L.prototype.encode=function(a){if(this.cache&&a.length<=this.h)if(this.J){if(this.F.has(a))return this.F.get(a)}else this.J=setTimeout(ha,50,this);this.normalize&&(a="function"===typeof this.normalize?this.normalize(a):J?a.normalize("NFKD").replace(J,"").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 g=0,f,h;g<e.length;g++){if(!(f=h=e[g]))continue;if(f.length<this.minlength)continue;if(c){b.push(f);continue}if(this.filter&&this.filter.has(f))continue;if(this.cache&&f.length<=this.D)if(this.J){var d=this.H.get(f);if(d||""===d){d&&b.push(d);continue}}else this.J=setTimeout(ha,50,this);let k;this.stemmer&&2<f.length&&(this.N||(this.N=new RegExp("(?!^)("+this.L+")$")),f=f.replace(this.N,l=>this.stemmer.get(l)),k=1);f&&k&&(f.length<
B(a.minlength,1,this.minlength);this.maxlength=B(a.maxlength,0,this.maxlength);if(this.cache=b=B(a.cache,!0,this.cache))this.I=null,this.O="number"===typeof b?b:2E5,this.D=new Map,this.G=new Map,this.J=this.A=128;this.K="";this.M=null;this.L="";this.N=null;if(this.matcher)for(const e of this.matcher.keys())this.K+=(this.K?"|":"")+e;if(this.stemmer)for(const e of this.stemmer.keys())this.L+=(this.L?"|":"")+e;return this};
K.prototype.encode=function(a){if(this.cache&&a.length<=this.A)if(this.I){if(this.D.has(a))return this.D.get(a)}else this.I=setTimeout(ha,50,this);this.normalize&&(a="function"===typeof this.normalize?this.normalize(a):J?a.normalize("NFKD").replace(J,"").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 g=0,f,h;g<e.length;g++){if(!(f=h=e[g]))continue;if(f.length<this.minlength)continue;if(c){b.push(f);continue}if(this.filter&&this.filter.has(f))continue;if(this.cache&&f.length<=this.J)if(this.I){var d=this.G.get(f);if(d||""===d){d&&b.push(d);continue}}else this.I=setTimeout(ha,50,this);let k;this.stemmer&&2<f.length&&(this.N||(this.N=new RegExp("(?!^)("+this.L+")$")),f=f.replace(this.N,l=>this.stemmer.get(l)),k=1);f&&k&&(f.length<
this.minlength||this.filter&&this.filter.has(f))&&(f="");if(f&&(this.mapper||this.dedupe&&1<f.length)){d="";for(let l=0,m="",n,t;l<f.length;l++)n=f.charAt(l),n===m&&this.dedupe||((t=this.mapper&&this.mapper.get(n))||""===t?t===m&&this.dedupe||!(m=t)||(d+=t):d+=m=n);f=d}this.matcher&&1<f.length&&(this.M||(this.M=new RegExp("("+this.K+")","g")),f=f.replace(this.M,l=>this.matcher.get(l)));if(f&&this.replacer)for(d=0;f&&d<this.replacer.length;d+=2)f=f.replace(this.replacer[d],this.replacer[d+1]);this.cache&&
h.length<=this.D&&(this.H.set(h,f),this.H.size>this.O&&(this.H.clear(),this.D=this.D/1.1|0));f&&b.push(f)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.h&&(this.F.set(a,b),this.F.size>this.O&&(this.F.clear(),this.h=this.h/1.1|0));return b};function ha(a){a.J=null;a.F.clear();a.H.clear()};function ia(a){M.call(a,"add");M.call(a,"append");M.call(a,"search");M.call(a,"update");M.call(a,"remove")}function M(a){this[a+"Async"]=function(){var c=arguments;const b=c[c.length-1];let e;"function"===typeof b&&(e=b,delete c[c.length-1]);c=this[a].apply(this,c);e&&(c.then?c.then(e):e(c));return c}};function ja(a,c,b,e,d,g,f,h){(e=a(b?b+"."+e:e,JSON.stringify(f)))&&e.then?e.then(function(){c.export(a,c,b,d,g+1,h)}):c.export(a,c,b,d,g+1,h)};N.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 h=0,k;h<this.field.length;h++){k=this.C[h];var e=this.index.get(this.field[h]);if("function"===typeof k){var d=k(c);d&&e.add(a,d,!1,!0)}else if(d=k.G,!d||d(c))k.constructor===String?k=[""+k]:E(k)&&(k=[k]),O(c,k,this.I,0,e,a,k[0],b)}if(this.tag)for(e=0;e<this.B.length;e++){var g=this.B[e];d=this.tag.get(this.R[e]);let h=C();if("function"===typeof g){if(g=g(c),!g)continue}else{var f=
g.G;if(f&&!f(c))continue;g.constructor===String&&(g=""+g);g=I(c,g)}if(d&&g){E(g)&&(g=[g]);for(let k=0,l,m;k<g.length;k++)l=g[k],h[l]||(h[l]=1,(f=d.get(l))?m=f:d.set(l,m=[]),b&&m.includes(a)||(m.push(a),this.fastupdate&&((f=this.reg.get(a))?f.push(m):this.reg.set(a,[m]))))}}if(this.store&&(!b||!this.store.has(a))){let h;if(this.A){h=C();for(let k=0,l;k<this.A.length;k++){l=this.A[k];if((b=l.G)&&!b(c))continue;let m;if("function"===typeof l){m=l(c);if(!m)continue;l=[l.S]}else if(E(l)||l.constructor===
String){h[l]=c[l];continue}P(c,h,l,0,l[0],m)}}this.store.set(a,h||c)}}return this};function P(a,c,b,e,d,g){a=a[d];if(e===b.length-1)c[d]=g||a;else if(a)if(a.constructor===Array)for(c=c[d]=Array(a.length),d=0;d<a.length;d++)P(a,c,b,e,d);else c=c[d]||(c[d]=C()),d=b[++e],P(a,c,b,e,d)}
function O(a,c,b,e,d,g,f,h){if(a=a[f])if(e===c.length-1){if(a.constructor===Array){if(b[e]){for(c=0;c<a.length;c++)d.add(g,a[c],!0,!0);return}a=a.join(" ")}d.add(g,a,h,!0)}else if(a.constructor===Array)for(f=0;f<a.length;f++)O(a,c,b,e,d,g,f,h);else f=c[++e],O(a,c,b,e,d,g,f,h)};function ka(a,c){const b=C(),e=[];for(let d=0,g;d<c.length;d++){g=c[d];for(let f=0;f<g.length;f++)b[g[f]]=1}for(let d=0,g;d<a.length;d++)g=a[d],1===b[g]&&(e.push(g),b[g]=2);return e};N.prototype.search=function(a,c,b,e){b||(!c&&H(a)?(b=a,a=""):H(c)&&(b=c,c=0));let d=[];var g=[];let f,h,k,l,m,n,t=0,p;if(b){b.constructor===Array&&(b={index:b});a=b.query||a;var r=b.pluck;h=b.merge;l=r||b.field||b.index;m=this.tag&&b.tag;f=this.store&&b.enrich;k=b.suggest;p=b.T;c=b.limit||c;n=b.offset||0;c||(c=100);if(m){m.constructor!==Array&&(m=[m]);var v=[];for(let w=0,q;w<m.length;w++)if(q=m[w],q.field&&q.tag){var u=q.tag;if(u.constructor===Array)for(var y=0;y<u.length;y++)v.push(q.field,u[y]);
else v.push(q.field,u)}else{u=Object.keys(q);for(let D=0,A,z;D<u.length;D++)if(A=u[D],z=q[A],z.constructor===Array)for(y=0;y<z.length;y++)v.push(A,z[y]);else v.push(A,z)}m=v;if(!a){e=[];if(v.length)for(g=0;g<v.length;g+=2)r=la.call(this,v[g],v[g+1],c,n,f),d.push({field:v[g],tag:v[g+1],result:r});return e.length?Promise.all(e).then(function(w){for(let q=0;q<w.length;q++)d[q].result=w[q];return d}):d}}E(l)&&(l=[l])}l||(l=this.field);v=!e&&(this.worker||this.db)&&[];for(let w=0,q,D,A;w<l.length;w++){D=
l[w];let z;E(D)||(z=D,D=z.field,a=z.query||a,c=z.limit||c,n=z.offset||n,k=z.suggest||k,f=this.store&&(z.enrich||f));if(e)q=e[w];else if(u=z||b,y=this.index.get(D),m&&(u.enrich=!1),v){v[w]=y.search(a,c,u);u&&f&&(u.enrich=f);continue}else q=y.search(a,c,u),u&&f&&(u.enrich=f);A=q&&q.length;if(m&&A){u=[];y=0;for(let G=0,F,K;G<m.length;G+=2){F=this.tag.get(m[G]);if(!F)if(k)continue;else return d;if(K=(F=F&&F.get(m[G+1]))&&F.length)y++,u.push(F);else if(!k)return d}if(y){q=ka(q,u);A=q.length;if(!A&&!k)return d;
y--}}if(A)g[t]=D,d.push(q),t++;else if(1===l.length)return d}if(v){const w=this;return Promise.all(v).then(function(q){return q.length?w.search(a,c,b,q):q})}if(!t)return d;if(r&&(!f||!this.store))return d[0];v=[];for(let w=0,q;w<g.length;w++){q=d[w];f&&q.length&&!q[0].doc&&q.length&&(q=ma.call(this,q));if(r)return q;d[w]={field:g[w],result:q}}return h?na(d,c):p?oa(d,a,this.index,this.field,this.C,p):d};
function oa(a,c,b,e,d,g){let f,h,k;for(let m=0,n,t,p,r,v;m<a.length;m++){n=a[m].result;t=a[m].field;r=b.get(t);p=r.encoder;k=r.tokenize;v=d[e.indexOf(t)];p!==f&&(f=p,h=f.encode(c));for(let u=0;u<n.length;u++){let y="";var l=I(n[u].doc,v);let w=f.encode(l);l=l.split(f.split);for(let q=0,D,A;q<w.length;q++){D=w[q];A=l[q];let z;for(let G=0,F;G<h.length;G++)if(F=h[G],"strict"===k){if(D===F){y+=(y?" ":"")+g.replace("$1",A);z=!0;break}}else{const K=D.indexOf(F);if(-1<K){y+=(y?" ":"")+A.substring(0,K)+g.replace("$1",
A.substring(K,F.length))+A.substring(K+F.length);z=!0;break}}z||(y+=(y?" ":"")+l[q])}n[u].T=y}}return a}function na(a,c){const b=[],e=C();for(let d=0,g,f;d<a.length;d++){g=a[d];f=g.result;for(let h=0,k,l,m;h<f.length;h++)if(l=f[h],k=l.id,m=e[k])m.push(g.field);else{if(b.length===c)return b;l.field=e[k]=[g.field];b.push(l)}}return b}function la(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=ma.call(this,a));return a}}
function ma(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 N(a){if(!this)return new N(a);const c=a.document||a.doc||a;var b;this.C=[];this.field=[];this.I=[];this.key=(b=c.key||c.id)&&Q(b,this.I)||"id";this.reg=(this.fastupdate=!!a.fastupdate)?new Map:new Set;this.A=(b=c.store||null)&&!0!==b&&[];this.store=b&&new Map;this.cache=(b=a.cache||null)&&new R(b);a.cache=!1;b=new Map;let e=c.index||c.field||c;E(e)&&(e=[e]);for(let d=0,g,f;d<e.length;d++)g=e[d],E(g)||(f=g,g=g.field),f=H(f)?Object.assign({},a,f):a,b.set(g,new S(f,this.reg)),f.custom?this.C[d]=
f.custom:(this.C[d]=Q(g,this.I),f.filter&&("string"===typeof this.C[d]&&(this.C[d]=new String(this.C[d])),this.C[d].G=f.filter)),this.field[d]=g;if(this.A){a=c.store;E(a)&&(a=[a]);for(let d=0,g,f;d<a.length;d++)g=a[d],f=g.field||g,g.custom?(this.A[d]=g.custom,g.custom.S=f):(this.A[d]=Q(f,this.I),g.filter&&("string"===typeof this.A[d]&&(this.A[d]=new String(this.A[d])),this.A[d].G=g.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.R=[];for(let d=0,g,f;d<b.length;d++){g=b[d];f=g.field||g;if(!f)throw Error("The tag field from the document descriptor is undefined.");g.custom?this.B[d]=g.custom:(this.B[d]=Q(f,this.I),g.filter&&("string"===typeof this.B[d]&&(this.B[d]=new String(this.B[d])),this.B[d].G=g.filter));this.R[d]=f;this.tag.set(f,new Map)}}}
function Q(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]}x=N.prototype;x.append=function(a,c){return this.add(a,c,!0)};x.update=function(a,c){return this.remove(a).add(a,c)};
x.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],g=d.indexOf(a);-1<g&&(1<d.length?d.splice(g,1):b.delete(c))}this.store&&this.store.delete(a);this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
x.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};x.contain=function(a){return this.reg.has(a)};x.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};x.get=function(a){return this.store.get(a)};x.set=function(a,c){this.store.set(a,c);return this};x.searchCache=pa;
x.export=function(a,c,b,e,d,g){let f;"undefined"===typeof g&&(f=new Promise(k=>{g=k}));d||(d=0);e||(e=0);if(e<this.field.length){b=this.field[e];var h=this.index[b];c=this;h.export(a,c,d?b:"",e,d++,g)||(e++,c.export(a,c,b,e,1,g))}else{switch(d){case 1:c="tag";h=this.D;b=null;break;case 2:c="store";h=this.store;b=null;break;default:g();return}ja(a,this,b,c,e,d,h,g)}return f};
x.import=function(a,c){if(c)switch(E(c)&&(c=JSON.parse(c)),a){case "tag":this.D=c;break;case "reg":this.fastupdate=!1;this.reg=c;for(let e=0,d;e<this.field.length;e++)d=this.index[this.field[e]],d.reg=c,d.fastupdate=!1;break;case "store":this.store=c;break;default:a=a.split(".");const b=a[0];a=a[1];b&&a&&this.index[b].import(a,c)}};ia(N.prototype);function pa(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();let e=this.cache.get(a);if(!e){e=this.search(a,c,b);if(e.then){const d=this;e.then(function(g){d.cache.set(a,g);return g})}this.cache.set(a,e)}return e}function R(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}R.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)};
R.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};R.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};R.prototype.clear=function(){this.cache.clear();this.h=""};const qa={normalize:function(a){return a.toLowerCase()},dedupe:!1};const T=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 ra=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["pf","f"]]),sa=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\1+/g,"$1"];const ta={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 ua=/[\x00-\x7F]+/g;const va=/[\x00-\x7F]+/g;const wa=/[\x00-\x7F]+/g;var xa={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:qa,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:T},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:T,matcher:ra,replacer:sa},LatinExtra:{normalize:!0,dedupe:!0,mapper:T,replacer:sa.concat([/(?!^)[aeo]/g,""]),matcher:ra},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=ta[e];for(let g=1,f;g<c.length&&(f=c.charAt(g),"h"===f||
"w"===f||!(f=ta[f])||f===d||(e+=f,d=f,4!==e.length));g++);a[b]=e}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(ua," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(va,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(wa," ")}}};const ya={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};C();S.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 r=c[this.rtl?e-1-p:p];var d=r.length;if(d&&(n||!m[r])){var g=this.score?this.score(c,r,p,null,0):U(t,e,p),f="";switch(this.tokenize){case "full":if(2<d){for(g=0;g<d;g++)for(var h=d;h>g;h--){f=r.substring(g,h);var k=this.score?this.score(c,r,p,f,g):U(t,e,p,d,g);V(this,m,f,k,a,b)}break}case "reverse":if(1<
d){for(h=d-1;0<h;h--)f=r[h]+f,k=this.score?this.score(c,r,p,f,h):U(t,e,p,d,h),V(this,m,f,k,a,b);f=""}case "forward":if(1<d){for(h=0;h<d;h++)f+=r[h],V(this,m,f,g,a,b);break}default:if(V(this,m,r,g,a,b),n&&1<e&&p<e-1)for(d=C(),f=this.P,g=r,h=Math.min(n+1,e-p),d[g]=1,k=1;k<h;k++)if((r=c[this.rtl?e-1-p-k:p+k])&&!d[r]){d[r]=1;const v=this.score?this.score(c,g,p,r,k):U(f+(e/2>f?0:1),e,p,h-1,k-1),u=this.bidirectional&&r>g;V(this,l,u?g:r,v,a,b,u?r:g)}}}}this.fastupdate||this.reg.add(a)}}return this};
function V(a,c,b,e,d,g,f){let h=f?a.ctx:a.map,k;if(!c[b]||f&&!(k=c[b])[f])f?(c=k||(c[b]=C()),c[f]=1,(k=h.get(f))?h=k:h.set(f,h=new Map)):c[b]=1,(k=h.get(b))?h=k:h.set(b,h=[]),h=h[e]||(h[e]=[]),g&&h.includes(d)||(h.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(h):a.reg.set(d,[h])))}function U(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};function za(a,c,b){if(1===a.length)return a=a[0],a=b||a.length>c?c?a.slice(b,b+c):a.slice(b):a;let e=[];for(let d=0,g,f;d<a.length;d++)if((g=a[d])&&(f=g.length)){if(b){if(b>=f){b-=f;continue}b<f&&(g=c?g.slice(b,b+c):g.slice(b),f=g.length,b=0)}if(e.length)f>c&&(g=g.slice(0,c),f=g.length),e.push(g);else{if(f>=c)return f>c&&(g=g.slice(0,c)),g;e=[g]}c-=f;if(!c)break}return e.length?e=1<e.length?[].concat.apply([],e):e[0]:e};S.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 g=b.context;var f=b.suggest}a=this.encoder.encode(a);b=a.length;c||(c=100);if(1===b)return W.call(this,a[0],"",c,d);g=this.depth&&!1!==g;if(2===b&&g&&!f)return W.call(this,a[0],a[1],c,d);var h=0,k=0;if(1<b){var l=C();const n=[];for(let t=0,p;t<b;t++)if((p=a[t])&&!l[p]){if(f||X(this,p))n.push(p),l[p]=1;else return e;const r=p.length;h=Math.max(h,r);k=k?Math.min(k,
r):r}a=n;b=a.length}if(!b)return e;l=0;if(1===b)return W.call(this,a[0],"",c,d);if(2===b&&g&&!f)return W.call(this,a[0],a[1],c,d);if(1<b)if(g){var m=a[0];l=1}else 9<h&&3<h/k&&a.sort(aa);for(let n,t;l<b;l++){t=a[l];m?(n=X(this,t,m),n=Aa(n,e,f,this.P),f&&!1===n&&e.length||(m=t)):(n=X(this,t,""),n=Aa(n,e,f,this.resolution));if(n)return n;if(f&&l===b-1){g=e.length;if(!g){if(m){m="";l=-1;continue}return e}if(1===g)return za(e[0],c,d)}}a:{a=e;e=this.resolution;m=f;b=a.length;f=[];g=C();for(let n=0,t,p,
r,v;n<e;n++)for(k=0;k<b;k++)if(r=a[k],n<r.length&&(t=r[n]))for(l=0;l<t.length;l++)p=t[l],(h=g[p])?g[p]++:(h=0,g[p]=1),v=f[h]||(f[h]=[]),v.push(p);if(a=f.length)if(m){if(1<f.length)b:for(a=[],e=C(),m=f.length,h=m-1;0<=h;h--)for(m=f[h],g=m.length,k=0;k<g;k++){if(b=m[k],!e[b])if(e[b]=1,d)d--;else if(a.push(b),a.length===c)break b}else a=(f=f[0]).length>c||d?f.slice(d,c+d):f;f=a}else{if(a<b){e=[];break a}f=f[a-1];if(c||d)if(f.length>c||d)f=f.slice(d,c+d)}e=f}return e};
function W(a,c,b,e){return(a=X(this,a,c))&&a.length?za(a,b,e):[]}function Aa(a,c,b,e){let d=[];if(a){e=Math.min(a.length,e);for(let g=0,f;g<e;g++)(f=a[g])&&f&&(d[g]=f);if(d.length){c.push(d);return}}return!b&&d}function X(a,c,b){let e;b&&(e=a.bidirectional&&c>b);a=b?(a=a.ctx.get(e?c:b))&&a.get(e?b:c):a.map.get(c);return a};S.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 g=d.indexOf(a);g===b.length-1?d.pop():d.splice(g,1)}}else Y(this.map,a),this.depth&&Y(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function Y(a,c){let b=0;if(a.constructor===Array)for(let e=0,d,g;e<a.length;e++){if((d=a[e])&&d.length)if(g=d.indexOf(c),0<=g){1<d.length?(d.splice(g,1),b++):delete a[e];break}else b++}else for(let e of a){const d=e[0],g=Y(e[1],c);g?b+=g:a.delete(d)}return b};function S(a,c){if(!this)return new S(a);if(a){var b=E(a)?a:a.preset;b&&(a=Object.assign({},ya[b],a))}else a={};b=a.context||{};const e=E(a.encoder)?xa[a.encoder]:a.encode||a.encoder||qa;this.encoder=e.encode?e:"object"===typeof e?new L(e):{encode:e};let d;this.resolution=a.resolution||9;this.tokenize=d=a.tokenize||"strict";this.depth="strict"===d&&b.depth||0;this.bidirectional=!1!==b.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;d=!1;this.map=new Map;this.ctx=new Map;this.reg=
c||(this.fastupdate?new Map:new Set);this.P=b.resolution||1;this.rtl=e.rtl||a.rtl||!1;this.cache=(d=a.cache||null)&&new R(d)}x=S.prototype;x.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};x.append=function(a,c){return this.add(a,c,!0)};x.contain=function(a){return this.reg.has(a)};x.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 Ba(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=Ba(b[1]);d?c+=d:a.delete(e)}return c}x.cleanup=function(){if(!this.fastupdate)return this;Ba(this.map);this.depth&&Ba(this.ctx);return this};x.searchCache=pa;
x.export=function(a,c,b,e,d,g){let f=!0;"undefined"===typeof g&&(f=new Promise(l=>{g=l}));let h,k;switch(d||(d=0)){case 0:h="reg";if(this.fastupdate){k=C();for(let l of this.reg.keys())k[l]=1}else k=this.reg;break;case 1:h="cfg";k={doc:0,opt:this.h?1:0};break;case 2:h="map";k=this.map;break;case 3:h="ctx";k=this.ctx;break;default:"undefined"===typeof b&&g&&g();return}ja(a,c||this,b,h,e,d,k,g);return f};
x.import=function(a,c){if(c)switch(E(c)&&(c=JSON.parse(c)),a){case "cfg":this.h=!!c.opt;break;case "reg":this.fastupdate=!1;this.reg=c;break;case "map":this.map=c;break;case "ctx":this.ctx=c}};
h.length<=this.J&&(this.G.set(h,f),this.G.size>this.O&&(this.G.clear(),this.J=this.J/1.1|0));f&&b.push(f)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.A&&(this.D.set(a,b),this.D.size>this.O&&(this.D.clear(),this.A=this.A/1.1|0));return b};function ha(a){a.I=null;a.D.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")}function M(a){this[a+"Async"]=function(){var c=arguments;const b=c[c.length-1];let e;"function"===typeof b&&(e=b,delete c[c.length-1]);c=this[a].apply(this,c);e&&(c.then?c.then(e):e(c));return c}};function N(a){const c=[];for(const b of a.entries())c.push(b);return c}function ja(a){const c=[];for(const b of a.entries())c.push(N(b));return c}function ka(a){const c=[];for(const b of a.keys())c.push(b);return c}function la(a,c,b,e,d,g){if((b=a(c?c+"."+b:b,JSON.stringify(g)))&&b.then){const f=this;return b.then(function(){return f.export(a,c,e,d+1)})}return this.export(a,c,e,d+1)};O.prototype.add=function(a,c,b){G(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 h=0,k;h<this.field.length;h++){k=this.C[h];var e=this.index.get(this.field[h]);if("function"===typeof k){var d=k(c);d&&e.add(a,d,!1,!0)}else if(d=k.F,!d||d(c))k.constructor===String?k=[""+k]:E(k)&&(k=[k]),P(c,k,this.H,0,e,a,k[0],b)}if(this.tag)for(e=0;e<this.B.length;e++){var g=this.B[e];d=this.tag.get(this.R[e]);let h=D();if("function"===typeof g){if(g=g(c),!g)continue}else{var f=
g.F;if(f&&!f(c))continue;g.constructor===String&&(g=""+g);g=I(c,g)}if(d&&g){E(g)&&(g=[g]);for(let k=0,l,m;k<g.length;k++)l=g[k],h[l]||(h[l]=1,(f=d.get(l))?m=f:d.set(l,m=[]),b&&m.includes(a)||(m.push(a),this.fastupdate&&((f=this.reg.get(a))?f.push(m):this.reg.set(a,[m]))))}}if(this.store&&(!b||!this.store.has(a))){let h;if(this.h){h=D();for(let k=0,l;k<this.h.length;k++){l=this.h[k];if((b=l.F)&&!b(c))continue;let m;if("function"===typeof l){m=l(c);if(!m)continue;l=[l.S]}else if(E(l)||l.constructor===
String){h[l]=c[l];continue}Q(c,h,l,0,l[0],m)}}this.store.set(a,h||c)}}return this};function Q(a,c,b,e,d,g){a=a[d];if(e===b.length-1)c[d]=g||a;else if(a)if(a.constructor===Array)for(c=c[d]=Array(a.length),d=0;d<a.length;d++)Q(a,c,b,e,d);else c=c[d]||(c[d]=D()),d=b[++e],Q(a,c,b,e,d)}
function P(a,c,b,e,d,g,f,h){if(a=a[f])if(e===c.length-1){if(a.constructor===Array){if(b[e]){for(c=0;c<a.length;c++)d.add(g,a[c],!0,!0);return}a=a.join(" ")}d.add(g,a,h,!0)}else if(a.constructor===Array)for(f=0;f<a.length;f++)P(a,c,b,e,d,g,f,h);else f=c[++e],P(a,c,b,e,d,g,f,h)};function ma(a,c){const b=D(),e=[];for(let d=0,g;d<c.length;d++){g=c[d];for(let f=0;f<g.length;f++)b[g[f]]=1}for(let d=0,g;d<a.length;d++)g=a[d],1===b[g]&&(e.push(g),b[g]=2);return e};O.prototype.search=function(a,c,b,e){b||(!c&&G(a)?(b=a,a=""):G(c)&&(b=c,c=0));let d=[];var g=[];let f,h,k,l,m,n,t=0,p;if(b){b.constructor===Array&&(b={index:b});a=b.query||a;var r=b.pluck;h=b.merge;l=r||b.field||b.index;m=this.tag&&b.tag;f=this.store&&b.enrich;k=b.suggest;p=b.T;c=b.limit||c;n=b.offset||0;c||(c=100);if(m){m.constructor!==Array&&(m=[m]);var v=[];for(let w=0,q;w<m.length;w++)if(q=m[w],q.field&&q.tag){var u=q.tag;if(u.constructor===Array)for(var y=0;y<u.length;y++)v.push(q.field,u[y]);
else v.push(q.field,u)}else{u=Object.keys(q);for(let C=0,A,z;C<u.length;C++)if(A=u[C],z=q[A],z.constructor===Array)for(y=0;y<z.length;y++)v.push(A,z[y]);else v.push(A,z)}m=v;if(!a){e=[];if(v.length)for(g=0;g<v.length;g+=2)r=na.call(this,v[g],v[g+1],c,n,f),d.push({field:v[g],tag:v[g+1],result:r});return e.length?Promise.all(e).then(function(w){for(let q=0;q<w.length;q++)d[q].result=w[q];return d}):d}}E(l)&&(l=[l])}l||(l=this.field);v=!e&&(this.worker||this.db)&&[];for(let w=0,q,C,A;w<l.length;w++){C=
l[w];let z;E(C)||(z=C,C=z.field,a=z.query||a,c=z.limit||c,n=z.offset||n,k=z.suggest||k,f=this.store&&(z.enrich||f));if(e)q=e[w];else if(u=z||b,y=this.index.get(C),m&&(u.enrich=!1),v){v[w]=y.search(a,c,u);u&&f&&(u.enrich=f);continue}else q=y.search(a,c,u),u&&f&&(u.enrich=f);A=q&&q.length;if(m&&A){u=[];y=0;for(let H=0,F,L;H<m.length;H+=2){F=this.tag.get(m[H]);if(!F)if(k)continue;else return d;if(L=(F=F&&F.get(m[H+1]))&&F.length)y++,u.push(F);else if(!k)return d}if(y){q=ma(q,u);A=q.length;if(!A&&!k)return d;
y--}}if(A)g[t]=C,d.push(q),t++;else if(1===l.length)return d}if(v){const w=this;return Promise.all(v).then(function(q){return q.length?w.search(a,c,b,q):q})}if(!t)return d;if(r&&(!f||!this.store))return d[0];v=[];for(let w=0,q;w<g.length;w++){q=d[w];f&&q.length&&!q[0].doc&&q.length&&(q=oa.call(this,q));if(r)return q;d[w]={field:g[w],result:q}}return h?pa(d,c):p?qa(d,a,this.index,this.field,this.C,p):d};
function qa(a,c,b,e,d,g){let f,h,k;for(let m=0,n,t,p,r,v;m<a.length;m++){n=a[m].result;t=a[m].field;r=b.get(t);p=r.encoder;k=r.tokenize;v=d[e.indexOf(t)];p!==f&&(f=p,h=f.encode(c));for(let u=0;u<n.length;u++){let y="";var l=I(n[u].doc,v);let w=f.encode(l);l=l.split(f.split);for(let q=0,C,A;q<w.length;q++){C=w[q];A=l[q];let z;for(let H=0,F;H<h.length;H++)if(F=h[H],"strict"===k){if(C===F){y+=(y?" ":"")+g.replace("$1",A);z=!0;break}}else{const L=C.indexOf(F);if(-1<L){y+=(y?" ":"")+A.substring(0,L)+g.replace("$1",
A.substring(L,F.length))+A.substring(L+F.length);z=!0;break}}z||(y+=(y?" ":"")+l[q])}n[u].T=y}}return a}function pa(a,c){const b=[],e=D();for(let d=0,g,f;d<a.length;d++){g=a[d];f=g.result;for(let h=0,k,l,m;h<f.length;h++)if(l=f[h],k=l.id,m=e[k])m.push(g.field);else{if(b.length===c)return b;l.field=e[k]=[g.field];b.push(l)}}return b}function na(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=oa.call(this,a));return a}}
function oa(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 O(a){if(this.constructor!==O)return new O(a);const c=a.document||a.doc||a;var b;this.C=[];this.field=[];this.H=[];this.key=(b=c.key||c.id)&&R(b,this.H)||"id";this.reg=(this.fastupdate=!!a.fastupdate)?new Map:new Set;this.h=(b=c.store||null)&&!0!==b&&[];this.store=b&&new Map;this.cache=(b=a.cache||null)&&new S(b);a.cache=!1;b=new Map;let e=c.index||c.field||c;E(e)&&(e=[e]);for(let d=0,g,f;d<e.length;d++)g=e[d],E(g)||(f=g,g=g.field),f=G(f)?Object.assign({},a,f):a,b.set(g,new T(f,this.reg)),
f.custom?this.C[d]=f.custom:(this.C[d]=R(g,this.H),f.filter&&("string"===typeof this.C[d]&&(this.C[d]=new String(this.C[d])),this.C[d].F=f.filter)),this.field[d]=g;if(this.h){a=c.store;E(a)&&(a=[a]);for(let d=0,g,f;d<a.length;d++)g=a[d],f=g.field||g,g.custom?(this.h[d]=g.custom,g.custom.S=f):(this.h[d]=R(f,this.H),g.filter&&("string"===typeof this.h[d]&&(this.h[d]=new String(this.h[d])),this.h[d].F=g.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.R=[];for(let d=0,g,f;d<b.length;d++){g=b[d];f=g.field||g;if(!f)throw Error("The tag field from the document descriptor is undefined.");g.custom?this.B[d]=g.custom:(this.B[d]=R(f,this.H),g.filter&&("string"===typeof this.B[d]&&(this.B[d]=new String(this.B[d])),this.B[d].F=g.filter));this.R[d]=f;this.tag.set(f,new Map)}}}
function R(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]}x=O.prototype;x.append=function(a,c){return this.add(a,c,!0)};x.update=function(a,c){return this.remove(a).add(a,c)};
x.remove=function(a){G(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],g=d.indexOf(a);-1<g&&(1<d.length?d.splice(g,1):b.delete(c))}this.store&&this.store.delete(a);this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
x.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};x.contain=function(a){return this.reg.has(a)};x.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};x.get=function(a){return this.store.get(a)};x.set=function(a,c){this.store.set(a,c);return this};x.searchCache=ra;
x.export=function(a,c,b=0,e=0){if(b<this.field.length){const f=this.field[b];if((c=this.index.get(f).export(a,f,b,e=1))&&c.then){const h=this;return c.then(function(){return h.export(a,f,b+1,e=0)})}return this.export(a,f,b+1,e=0)}let d,g;switch(e){case 0:d="reg";g=ka(this.reg);c=null;break;case 1:d="tag";g=ja(this.tag);c=null;break;case 2:d="doc";g=N(this.store);c=null;break;case 3:d="cfg";g={};c=null;break;default:return}return la.call(this,a,c,d,b,e,g)};
x.import=function(a,c){if(c)switch(E(c)&&(c=JSON.parse(c)),a){case "tag":break;case "reg":this.fastupdate=!1;this.reg=new Set(c);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 "doc":this.store=new Map(c);break;default:a=a.split(".");const b=a[0];a=a[1];b&&a&&this.index.get(b).import(a,c)}};ia(O.prototype);function ra(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();let e=this.cache.get(a);if(!e){e=this.search(a,c,b);if(e.then){const d=this;e.then(function(g){d.cache.set(a,g);return g})}this.cache.set(a,e)}return e}function S(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.A=""}S.prototype.set=function(a,c){this.cache.set(this.A=a,c);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};
S.prototype.get=function(a){const c=this.cache.get(a);c&&this.A!==a&&(this.cache.delete(a),this.cache.set(this.A=a,c));return c};S.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};S.prototype.clear=function(){this.cache.clear();this.A=""};const sa={normalize:function(a){return a.toLowerCase()},dedupe:!1};const U=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 ta=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["pf","f"]]),ua=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\1+/g,"$1"];const va={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 wa=/[\x00-\x7F]+/g;const xa=/[\x00-\x7F]+/g;const ya=/[\x00-\x7F]+/g;var za={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:sa,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:U},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:U,matcher:ta,replacer:ua},LatinExtra:{normalize:!0,dedupe:!0,mapper:U,replacer:ua.concat([/(?!^)[aeo]/g,""]),matcher:ta},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=va[e];for(let g=1,f;g<c.length&&(f=c.charAt(g),"h"===f||
"w"===f||!(f=va[f])||f===d||(e+=f,d=f,4!==e.length));g++);a[b]=e}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(wa," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(xa,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(ya," ")}}};const Aa={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};D();T.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=D(),m=D(),n=this.depth,t=this.resolution;for(let p=0;p<e;p++){let r=c[this.rtl?e-1-p:p];var d=r.length;if(d&&(n||!m[r])){var g=this.score?this.score(c,r,p,null,0):V(t,e,p),f="";switch(this.tokenize){case "full":if(2<d){for(g=0;g<d;g++)for(var h=d;h>g;h--){f=r.substring(g,h);var k=this.score?this.score(c,r,p,f,g):V(t,e,p,d,g);W(this,m,f,k,a,b)}break}case "reverse":if(1<
d){for(h=d-1;0<h;h--)f=r[h]+f,k=this.score?this.score(c,r,p,f,h):V(t,e,p,d,h),W(this,m,f,k,a,b);f=""}case "forward":if(1<d){for(h=0;h<d;h++)f+=r[h],W(this,m,f,g,a,b);break}default:if(W(this,m,r,g,a,b),n&&1<e&&p<e-1)for(d=D(),f=this.P,g=r,h=Math.min(n+1,e-p),d[g]=1,k=1;k<h;k++)if((r=c[this.rtl?e-1-p-k:p+k])&&!d[r]){d[r]=1;const v=this.score?this.score(c,g,p,r,k):V(f+(e/2>f?0:1),e,p,h-1,k-1),u=this.bidirectional&&r>g;W(this,l,u?g:r,v,a,b,u?r:g)}}}}this.fastupdate||this.reg.add(a)}}return this};
function W(a,c,b,e,d,g,f){let h=f?a.ctx:a.map,k;if(!c[b]||f&&!(k=c[b])[f])f?(c=k||(c[b]=D()),c[f]=1,(k=h.get(f))?h=k:h.set(f,h=new Map)):c[b]=1,(k=h.get(b))?h=k:h.set(b,h=[]),h=h[e]||(h[e]=[]),g&&h.includes(d)||(h.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(h):a.reg.set(d,[h])))}function V(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};function Ba(a,c,b){if(1===a.length)return a=a[0],a=b||a.length>c?c?a.slice(b,b+c):a.slice(b):a;let e=[];for(let d=0,g,f;d<a.length;d++)if((g=a[d])&&(f=g.length)){if(b){if(b>=f){b-=f;continue}b<f&&(g=c?g.slice(b,b+c):g.slice(b),f=g.length,b=0)}if(e.length)f>c&&(g=g.slice(0,c),f=g.length),e.push(g);else{if(f>=c)return f>c&&(g=g.slice(0,c)),g;e=[g]}c-=f;if(!c)break}return e.length?e=1<e.length?[].concat.apply([],e):e[0]:e};T.prototype.search=function(a,c,b){b||(!c&&G(a)?(b=a,a=""):G(c)&&(b=c,c=0));var e=[],d=0;if(b){a=b.query||a;c=b.limit||c;d=b.offset||0;var g=b.context;var f=b.suggest}a=this.encoder.encode(a);b=a.length;c||(c=100);if(1===b)return X.call(this,a[0],"",c,d);g=this.depth&&!1!==g;if(2===b&&g&&!f)return X.call(this,a[0],a[1],c,d);var h=0,k=0;if(1<b){var l=D();const n=[];for(let t=0,p;t<b;t++)if((p=a[t])&&!l[p]){if(f||Y(this,p))n.push(p),l[p]=1;else return e;const r=p.length;h=Math.max(h,r);k=k?Math.min(k,
r):r}a=n;b=a.length}if(!b)return e;l=0;if(1===b)return X.call(this,a[0],"",c,d);if(2===b&&g&&!f)return X.call(this,a[0],a[1],c,d);if(1<b)if(g){var m=a[0];l=1}else 9<h&&3<h/k&&a.sort(aa);for(let n,t;l<b;l++){t=a[l];m?(n=Y(this,t,m),n=Ca(n,e,f,this.P),f&&!1===n&&e.length||(m=t)):(n=Y(this,t,""),n=Ca(n,e,f,this.resolution));if(n)return n;if(f&&l===b-1){g=e.length;if(!g){if(m){m="";l=-1;continue}return e}if(1===g)return Ba(e[0],c,d)}}a:{a=e;e=this.resolution;m=f;b=a.length;f=[];g=D();for(let n=0,t,p,
r,v;n<e;n++)for(k=0;k<b;k++)if(r=a[k],n<r.length&&(t=r[n]))for(l=0;l<t.length;l++)p=t[l],(h=g[p])?g[p]++:(h=0,g[p]=1),v=f[h]||(f[h]=[]),v.push(p);if(a=f.length)if(m){if(1<f.length)b:for(a=[],e=D(),m=f.length,h=m-1;0<=h;h--)for(m=f[h],g=m.length,k=0;k<g;k++){if(b=m[k],!e[b])if(e[b]=1,d)d--;else if(a.push(b),a.length===c)break b}else a=(f=f[0]).length>c||d?f.slice(d,c+d):f;f=a}else{if(a<b){e=[];break a}f=f[a-1];if(c||d)if(f.length>c||d)f=f.slice(d,c+d)}e=f}return e};
function X(a,c,b,e){return(a=Y(this,a,c))&&a.length?Ba(a,b,e):[]}function Ca(a,c,b,e){let d=[];if(a){e=Math.min(a.length,e);for(let g=0,f;g<e;g++)(f=a[g])&&f&&(d[g]=f);if(d.length){c.push(d);return}}return!b&&d}function Y(a,c,b){let e;b&&(e=a.bidirectional&&c>b);a=b?(a=a.ctx.get(e?c:b))&&a.get(e?b:c):a.map.get(c);return a};T.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 g=d.indexOf(a);g===b.length-1?d.pop():d.splice(g,1)}}else Da(this.map,a),this.depth&&Da(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function Da(a,c){let b=0;if(a.constructor===Array)for(let e=0,d,g;e<a.length;e++){if((d=a[e])&&d.length)if(g=d.indexOf(c),0<=g){1<d.length?(d.splice(g,1),b++):delete a[e];break}else b++}else for(let e of a){const d=e[0],g=Da(e[1],c);g?b+=g:a.delete(d)}return b};function T(a,c){if(this.constructor!==T)return new T(a);if(a){var b=E(a)?a:a.preset;b&&(a=Object.assign({},Aa[b],a))}else a={};b=a.context||{};const e=E(a.encoder)?za[a.encoder]:a.encode||a.encoder||sa;this.encoder=e.encode?e:"object"===typeof e?new K(e):{encode:e};let d;this.resolution=a.resolution||9;this.tokenize=d=a.tokenize||"strict";this.depth="strict"===d&&b.depth||0;this.bidirectional=!1!==b.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;d=!1;this.map=new Map;this.ctx=
new Map;this.reg=c||(this.fastupdate?new Map:new Set);this.P=b.resolution||1;this.rtl=e.rtl||a.rtl||!1;this.cache=(d=a.cache||null)&&new S(d)}x=T.prototype;x.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};x.append=function(a,c){return this.add(a,c,!0)};x.contain=function(a){return this.reg.has(a)};x.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 Ea(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=Ea(b[1]);d?c+=d:a.delete(e)}return c}x.cleanup=function(){if(!this.fastupdate)return this;Ea(this.map);this.depth&&Ea(this.ctx);return this};x.searchCache=ra;
x.export=function(a,c,b,e=0){let d,g;switch(e){case 0:d="reg";g=ka(this.reg);break;case 1:d="cfg";g={};break;case 2:d="map";g=N(this.map);break;case 3:d="ctx";g=ja(this.ctx);break;default:return}return la.call(this,a,c,d,b,e,g)};x.import=function(a,c){if(c)switch(E(c)&&(c=JSON.parse(c)),a){case "reg":this.fastupdate=!1;this.reg=new Set(c);break;case "map":this.map=new Map(c);break;case "ctx":this.ctx=new Map(c)}};
x.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 g=d[0],f=d[1],h="";for(let m=0,n;m<f.length;m++){n=f[m]||[""];var k="";for(var l=0;l<n.length;l++)k+=(k?",":"")+("string"===b?'"'+n[l]+'"':n[l]);k="["+k+"]";h+=(h?",":"")+k}h='["'+g+'",['+h+"]]";e+=(e?",":"")+h}e="index.map=new Map(["+e+"]);";d="";for(const m of this.ctx.entries()){g=
m[0];f=m[1];for(const n of f.entries()){f=n[0];h=n[1];k="";for(let t=0,p;t<h.length;t++){p=h[t]||[""];l="";for(let r=0;r<p.length;r++)l+=(l?",":"")+("string"===b?'"'+p[r]+'"':p[r]);l="["+l+"]";k+=(k?",":"")+l}k='new Map([["'+f+'",['+k+"]]])";k='["'+g+'",'+k+"]";d+=(d?",":"")+k}}d="index.ctx=new Map(["+d+"]);";return a?"function inject(index){"+c+e+d+"}":c+e+d};ia(S.prototype);const Ca={Index:S,Charset:xa,Encoder:L,Document:N,Worker:null,Resolver:null,IndexedDB:null,Language:{}},Z=self;let Da;(Da=Z.define)&&Da.amd?Da([],function(){return Ca}):"object"===typeof Z.exports?Z.exports=Ca:Z.FlexSearch=Ca;}(this||self));
m[0];f=m[1];for(const n of f.entries()){f=n[0];h=n[1];k="";for(let t=0,p;t<h.length;t++){p=h[t]||[""];l="";for(let r=0;r<p.length;r++)l+=(l?",":"")+("string"===b?'"'+p[r]+'"':p[r]);l="["+l+"]";k+=(k?",":"")+l}k='new Map([["'+f+'",['+k+"]]])";k='["'+g+'",'+k+"]";d+=(d?",":"")+k}}d="index.ctx=new Map(["+d+"]);";return a?"function inject(index){"+c+e+d+"}":c+e+d};ia(T.prototype);const Fa={Index:T,Charset:za,Encoder:K,Document:O,Worker:null,Resolver:null,IndexedDB:null,Language:{}},Z=self;let Ga;(Ga=Z.define)&&Ga.amd?Ga([],function(){return Fa}):"object"===typeof Z.exports?Z.exports=Fa:Z.FlexSearch=Fa;}(this||self));

View File

@@ -49,14 +49,14 @@ function C() {
function aa(a, c) {
return c.length - a.length;
}
function D(a) {
function E(a) {
return "string" === typeof a;
}
function H(a) {
return "object" === typeof a;
}
function I(a, c) {
if (D(c)) {
if (E(c)) {
a = a[c];
} else {
for (let b = 0; a && b < c.length; b++) {
@@ -74,15 +74,15 @@ function I(a, c) {
"\u03b8"], ["\u03d2", "\u03a5"], ["\u03d3", "\u03a5"], ["\u03d4", "\u03a5"], ["\u03d5", "\u03c6"], ["\u03d6", "\u03c0"], ["\u03f0", "\u03ba"], ["\u03f1", "\u03c1"], ["\u03f2", "\u03c2"], ["\u03f5", "\u03b5"], ["\u0439", "\u0438"], ["\u0450", "\u0435"], ["\u0451", "\u0435"], ["\u0453", "\u0433"], ["\u0457", "\u0456"], ["\u045c", "\u043a"], ["\u045d", "\u0438"], ["\u045e", "\u0443"], ["\u0477", "\u0475"], ["\u04c2", "\u0436"], ["\u04d1", "\u0430"], ["\u04d3", "\u0430"], ["\u04d7", "\u0435"], ["\u04db",
"\u04d9"], ["\u04dd", "\u0436"], ["\u04df", "\u0437"], ["\u04e3", "\u0438"], ["\u04e5", "\u0438"], ["\u04e7", "\u043e"], ["\u04eb", "\u04e9"], ["\u04ed", "\u044d"], ["\u04ef", "\u0443"], ["\u04f1", "\u0443"], ["\u04f3", "\u0443"], ["\u04f5", "\u0447"]];
const ca = /[^\p{L}\p{N}]+/u, da = /(\d{3})/g, ea = /(\D)(\d{3})/g, fa = /(\d{3})(\D)/g, J = "".normalize && /[\u0300-\u036f]/g;
function L(a) {
if (!this) {
return new L(...arguments);
function K(a) {
if (this.constructor !== K) {
return new K(...arguments);
}
for (let c = 0; c < arguments.length; c++) {
this.assign(arguments[c]);
}
}
L.prototype.assign = function(a) {
K.prototype.assign = function(a) {
this.normalize = B(a.normalize, !0, this.normalize);
let c = a.include, b = c || a.exclude || a.split;
if ("object" === typeof b) {
@@ -123,7 +123,7 @@ L.prototype.assign = function(a) {
this.minlength = B(a.minlength, 1, this.minlength);
this.maxlength = B(a.maxlength, 0, this.maxlength);
if (this.cache = b = B(a.cache, !0, this.cache)) {
this.J = null, this.O = "number" === typeof b ? b : 2e5, this.F = new Map(), this.H = new Map(), this.D = this.h = 128;
this.I = null, this.O = "number" === typeof b ? b : 2e5, this.D = new Map(), this.G = new Map(), this.J = this.A = 128;
}
this.K = "";
this.M = null;
@@ -141,14 +141,14 @@ L.prototype.assign = function(a) {
}
return this;
};
L.prototype.encode = function(a) {
if (this.cache && a.length <= this.h) {
if (this.J) {
if (this.F.has(a)) {
return this.F.get(a);
K.prototype.encode = function(a) {
if (this.cache && a.length <= this.A) {
if (this.I) {
if (this.D.has(a)) {
return this.D.get(a);
}
} else {
this.J = setTimeout(ha, 50, this);
this.I = setTimeout(ha, 50, this);
}
}
this.normalize && (a = "function" === typeof this.normalize ? this.normalize(a) : J ? a.normalize("NFKD").replace(J, "").toLowerCase() : a.toLowerCase());
@@ -170,15 +170,15 @@ L.prototype.encode = function(a) {
if (this.filter && this.filter.has(g)) {
continue;
}
if (this.cache && g.length <= this.D) {
if (this.J) {
var d = this.H.get(g);
if (this.cache && g.length <= this.J) {
if (this.I) {
var d = this.G.get(g);
if (d || "" === d) {
d && b.push(d);
continue;
}
} else {
this.J = setTimeout(ha, 50, this);
this.I = setTimeout(ha, 50, this);
}
}
let k;
@@ -197,17 +197,17 @@ L.prototype.encode = function(a) {
g = g.replace(this.replacer[d], this.replacer[d + 1]);
}
}
this.cache && h.length <= this.D && (this.H.set(h, g), this.H.size > this.O && (this.H.clear(), this.D = this.D / 1.1 | 0));
this.cache && h.length <= this.J && (this.G.set(h, g), this.G.size > this.O && (this.G.clear(), this.J = this.J / 1.1 | 0));
g && b.push(g);
}
this.finalize && (b = this.finalize(b) || b);
this.cache && a.length <= this.h && (this.F.set(a, b), this.F.size > this.O && (this.F.clear(), this.h = this.h / 1.1 | 0));
this.cache && a.length <= this.A && (this.D.set(a, b), this.D.size > this.O && (this.D.clear(), this.A = this.A / 1.1 | 0));
return b;
};
function ha(a) {
a.J = null;
a.F.clear();
a.H.clear();
a.I = null;
a.D.clear();
a.G.clear();
}
;function ia(a) {
M.call(a, "add");
@@ -227,12 +227,37 @@ function M(a) {
return c;
};
}
;function ja(a, c, b, e, d, f, g, h) {
(e = a(b ? b + "." + e : e, JSON.stringify(g))) && e.then ? e.then(function() {
c.export(a, c, b, d, f + 1, h);
}) : c.export(a, c, b, d, f + 1, h);
;function N(a) {
const c = [];
for (const b of a.entries()) {
c.push(b);
}
;N.prototype.add = function(a, c, b) {
return c;
}
function ja(a) {
const c = [];
for (const b of a.entries()) {
c.push(N(b));
}
return c;
}
function ka(a) {
const c = [];
for (const b of a.keys()) {
c.push(b);
}
return c;
}
function la(a, c, b, e, d, f) {
if ((b = a(c ? c + "." + b : b, JSON.stringify(f))) && b.then) {
const g = this;
return b.then(function() {
return g.export(a, c, e, d + 1);
});
}
return this.export(a, c, e, d + 1);
}
;O.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)) {
@@ -245,8 +270,8 @@ function M(a) {
var d = k(c);
d && e.add(a, d, !1, !0);
} else {
if (d = k.G, !d || d(c)) {
k.constructor === String ? k = ["" + k] : D(k) && (k = [k]), O(c, k, this.I, 0, e, a, k[0], b);
if (d = k.F, !d || d(c)) {
k.constructor === String ? k = ["" + k] : E(k) && (k = [k]), P(c, k, this.H, 0, e, a, k[0], b);
}
}
}
@@ -260,7 +285,7 @@ function M(a) {
continue;
}
} else {
const k = f.G;
const k = f.F;
if (k && !k(c)) {
continue;
}
@@ -268,7 +293,7 @@ function M(a) {
f = I(c, f);
}
if (d && f) {
D(f) && (f = [f]);
E(f) && (f = [f]);
for (let k = 0, l, m; k < f.length; k++) {
l = f[k], h[l] || (h[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]))));
}
@@ -279,11 +304,11 @@ function M(a) {
}
if (this.store && (!b || !this.store.has(a))) {
let h;
if (this.A) {
if (this.h) {
h = C();
for (let k = 0, l; k < this.A.length; k++) {
l = this.A[k];
if ((b = l.G) && !b(c)) {
for (let k = 0, l; k < this.h.length; k++) {
l = this.h[k];
if ((b = l.F) && !b(c)) {
continue;
}
let m;
@@ -293,11 +318,11 @@ function M(a) {
continue;
}
l = [l.S];
} else if (D(l) || l.constructor === String) {
} else if (E(l) || l.constructor === String) {
h[l] = c[l];
continue;
}
P(c, h, l, 0, l[0], m);
Q(c, h, l, 0, l[0], m);
}
}
this.store.set(a, h || c);
@@ -305,21 +330,21 @@ function M(a) {
}
return this;
};
function P(a, c, b, e, d, f) {
function Q(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++) {
P(a, c, b, e, d);
Q(a, c, b, e, d);
}
} else {
c = c[d] || (c[d] = C()), d = b[++e], P(a, c, b, e, d);
c = c[d] || (c[d] = C()), d = b[++e], Q(a, c, b, e, d);
}
}
}
function O(a, c, b, e, d, f, g, h) {
function P(a, c, b, e, d, f, g, h) {
if (a = a[g]) {
if (e === c.length - 1) {
if (a.constructor === Array) {
@@ -335,15 +360,15 @@ function O(a, c, b, e, d, f, g, h) {
} else {
if (a.constructor === Array) {
for (g = 0; g < a.length; g++) {
O(a, c, b, e, d, f, g, h);
P(a, c, b, e, d, f, g, h);
}
} else {
g = c[++e], O(a, c, b, e, d, f, g, h);
g = c[++e], P(a, c, b, e, d, f, g, h);
}
}
}
}
;function ka(a, c) {
;function ma(a, c) {
const b = C(), e = [];
for (let d = 0, f; d < c.length; d++) {
f = c[d];
@@ -356,7 +381,7 @@ function O(a, c, b, e, d, f, g, h) {
}
return e;
}
;N.prototype.search = function(a, c, b, e) {
;O.prototype.search = function(a, c, b, e) {
b || (!c && H(a) ? (b = a, a = "") : H(c) && (b = c, c = 0));
let d = [];
var f = [];
@@ -379,7 +404,7 @@ function O(a, c, b, e, d, f, g, h) {
var u = [];
for (let w = 0, q; w < m.length; w++) {
q = m[w];
if (D(q)) {
if (E(q)) {
throw Error("A tag option can't be a string, instead it needs a { field: tag } format.");
}
if (q.field && q.tag) {
@@ -393,8 +418,8 @@ function O(a, c, b, e, d, f, g, h) {
}
} else {
v = Object.keys(q);
for (let E = 0, A, z; E < v.length; E++) {
if (A = v[E], z = q[A], z.constructor === Array) {
for (let D = 0, A, z; D < v.length; D++) {
if (A = v[D], z = q[A], z.constructor === Array) {
for (y = 0; y < z.length; y++) {
u.push(A, z[y]);
}
@@ -412,7 +437,7 @@ function O(a, c, b, e, d, f, g, h) {
e = [];
if (u.length) {
for (f = 0; f < u.length; f += 2) {
r = la.call(this, u[f], u[f + 1], c, n, g), d.push({field:u[f], tag:u[f + 1], result:r});
r = na.call(this, u[f], u[f + 1], c, n, g), d.push({field:u[f], tag:u[f + 1], result:r});
}
}
return e.length ? Promise.all(e).then(function(w) {
@@ -423,18 +448,18 @@ function O(a, c, b, e, d, f, g, h) {
}) : d;
}
}
D(l) && (l = [l]);
E(l) && (l = [l]);
}
l || (l = this.field);
u = !e && (this.worker || this.db) && [];
for (let w = 0, q, E, A; w < l.length; w++) {
E = l[w];
for (let w = 0, q, D, A; w < l.length; w++) {
D = l[w];
let z;
D(E) || (z = E, E = z.field, a = z.query || a, c = z.limit || c, n = z.offset || n, k = z.suggest || k, g = this.store && (z.enrich || g));
E(D) || (z = D, D = z.field, a = z.query || a, c = z.limit || c, n = z.offset || n, k = z.suggest || k, g = this.store && (z.enrich || g));
if (e) {
q = e[w];
} else {
if (v = z || b, y = this.index.get(E), m && (v.enrich = !1), u) {
if (v = z || b, y = this.index.get(D), m && (v.enrich = !1), u) {
u[w] = y.search(a, c, v);
v && g && (v.enrich = g);
continue;
@@ -446,7 +471,7 @@ function O(a, c, b, e, d, f, g, h) {
if (m && A) {
v = [];
y = 0;
for (let G = 0, F, K; G < m.length; G += 2) {
for (let G = 0, F, L; G < m.length; G += 2) {
F = this.tag.get(m[G]);
if (!F) {
if (console.warn("Tag '" + m[G] + ":" + m[G + 1] + "' will be skipped because there is no field '" + m[G] + "'."), k) {
@@ -455,14 +480,14 @@ function O(a, c, b, e, d, f, g, h) {
return d;
}
}
if (K = (F = F && F.get(m[G + 1])) && F.length) {
if (L = (F = F && F.get(m[G + 1])) && F.length) {
y++, v.push(F);
} else if (!k) {
return d;
}
}
if (y) {
q = ka(q, v);
q = ma(q, v);
A = q.length;
if (!A && !k) {
return d;
@@ -471,7 +496,7 @@ function O(a, c, b, e, d, f, g, h) {
}
}
if (A) {
f[t] = E, d.push(q), t++;
f[t] = D, d.push(q), t++;
} else if (1 === l.length) {
return d;
}
@@ -491,15 +516,15 @@ function O(a, c, b, e, d, f, g, h) {
u = [];
for (let w = 0, q; w < f.length; w++) {
q = d[w];
g && q.length && !q[0].doc && q.length && (q = ma.call(this, q));
g && q.length && !q[0].doc && q.length && (q = oa.call(this, q));
if (r) {
return q;
}
d[w] = {field:f[w], result:q};
}
return h ? na(d, c) : p ? oa(d, a, this.index, this.field, this.C, p) : d;
return h ? pa(d, c) : p ? qa(d, a, this.index, this.field, this.C, p) : d;
};
function oa(a, c, b, e, d, f) {
function qa(a, c, b, e, d, f) {
let g, h, k;
for (let m = 0, n, t, p, r, u; m < a.length; m++) {
n = a[m].result;
@@ -514,21 +539,21 @@ function oa(a, c, b, e, d, f) {
var l = I(n[v].doc, u);
let w = g.encode(l);
l = l.split(g.split);
for (let q = 0, E, A; q < w.length; q++) {
E = w[q];
for (let q = 0, D, A; q < w.length; q++) {
D = w[q];
A = l[q];
let z;
for (let G = 0, F; G < h.length; G++) {
if (F = h[G], "strict" === k) {
if (E === F) {
if (D === F) {
y += (y ? " " : "") + f.replace("$1", A);
z = !0;
break;
}
} else {
const K = E.indexOf(F);
if (-1 < K) {
y += (y ? " " : "") + A.substring(0, K) + f.replace("$1", A.substring(K, F.length)) + A.substring(K + F.length);
const L = D.indexOf(F);
if (-1 < L) {
y += (y ? " " : "") + A.substring(0, L) + f.replace("$1", A.substring(L, F.length)) + A.substring(L + F.length);
z = !0;
break;
}
@@ -541,7 +566,7 @@ function oa(a, c, b, e, d, f) {
}
return a;
}
function na(a, c) {
function pa(a, c) {
const b = [], e = C();
for (let d = 0, f, g; d < a.length; d++) {
f = a[d];
@@ -560,7 +585,7 @@ function na(a, c) {
}
return b;
}
function la(a, c, b, e, d) {
function na(a, c, b, e, d) {
let f = this.tag.get(a);
if (!f) {
return console.warn("Tag '" + a + "' was not found"), [];
@@ -569,43 +594,43 @@ function la(a, c, b, e, d) {
if (a > b || e) {
f = f.slice(e, e + b);
}
d && (f = ma.call(this, f));
d && (f = oa.call(this, f));
return f;
}
}
function ma(a) {
function oa(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 N(a) {
if (!this) {
return new N(a);
;function O(a) {
if (this.constructor !== O) {
return new O(a);
}
const c = a.document || a.doc || a;
var b;
this.C = [];
this.field = [];
this.I = [];
this.key = (b = c.key || c.id) && Q(b, this.I) || "id";
this.H = [];
this.key = (b = c.key || c.id) && R(b, this.H) || "id";
this.reg = (this.fastupdate = !!a.fastupdate) ? new Map() : new Set();
this.A = (b = c.store || null) && !0 !== b && [];
this.h = (b = c.store || null) && !0 !== b && [];
this.store = b && new Map();
this.cache = (b = a.cache || null) && new R(b);
this.cache = (b = a.cache || null) && new S(b);
a.cache = !1;
b = new Map();
let e = c.index || c.field || c;
D(e) && (e = [e]);
E(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 S(g, this.reg)), g.custom ? this.C[d] = g.custom : (this.C[d] = Q(f, this.I), g.filter && ("string" === typeof this.C[d] && (this.C[d] = new String(this.C[d])), this.C[d].G = g.filter)), this.field[d] = f;
f = e[d], E(f) || (g = f, f = f.field), g = H(g) ? Object.assign({}, a, g) : a, b.set(f, new T(g, this.reg)), g.custom ? this.C[d] = g.custom : (this.C[d] = R(f, this.H), g.filter && ("string" === typeof this.C[d] && (this.C[d] = new String(this.C[d])), this.C[d].F = g.filter)), this.field[d] = f;
}
if (this.A) {
if (this.h) {
a = c.store;
D(a) && (a = [a]);
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.S = g) : (this.A[d] = Q(g, this.I), f.filter && ("string" === typeof this.A[d] && (this.A[d] = new String(this.A[d])), this.A[d].G = f.filter));
f = a[d], g = f.field || f, f.custom ? (this.h[d] = f.custom, f.custom.S = g) : (this.h[d] = R(g, this.H), f.filter && ("string" === typeof this.h[d] && (this.h[d] = new String(this.h[d])), this.h[d].F = f.filter));
}
}
this.index = b;
@@ -621,14 +646,14 @@ function ma(a) {
if (!g) {
throw Error("The tag field from the document descriptor is undefined.");
}
f.custom ? this.B[d] = f.custom : (this.B[d] = Q(g, this.I), f.filter && ("string" === typeof this.B[d] && (this.B[d] = new String(this.B[d])), this.B[d].G = f.filter));
f.custom ? this.B[d] = f.custom : (this.B[d] = R(g, this.H), f.filter && ("string" === typeof this.B[d] && (this.B[d] = new String(this.B[d])), this.B[d].F = f.filter));
this.R[d] = g;
this.tag.set(g, new Map());
}
}
}
}
function Q(a, c) {
function R(a, c) {
const b = a.split(":");
let e = 0;
for (let d = 0; d < b.length; d++) {
@@ -637,7 +662,7 @@ function Q(a, c) {
e < b.length && (b.length = e);
return 1 < e ? b : b[0];
}
x = N.prototype;
x = O.prototype;
x.append = function(a, c) {
return this.add(a, c, !0);
};
@@ -693,65 +718,70 @@ x.set = function(a, c) {
this.store.set(a, c);
return this;
};
x.searchCache = pa;
x.export = function(a, c, b, e, d, f) {
let g;
"undefined" === typeof f && (g = new Promise(k => {
f = k;
}));
d || (d = 0);
e || (e = 0);
if (e < this.field.length) {
b = this.field[e];
var h = this.index[b];
c = this;
h.export(a, c, d ? b : "", e, d++, f) || (e++, c.export(a, c, b, e, 1, f));
} else {
switch(d) {
x.searchCache = ra;
x.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 h = this;
return c.then(function() {
return h.export(a, g, b + 1, e = 0);
});
}
return this.export(a, g, b + 1, e = 0);
}
let d, f;
switch(e) {
case 0:
d = "reg";
f = ka(this.reg);
c = null;
break;
case 1:
c = "tag";
h = this.D;
b = null;
d = "tag";
f = ja(this.tag);
c = null;
break;
case 2:
c = "store";
h = this.store;
b = null;
d = "doc";
f = N(this.store);
c = null;
break;
case 3:
d = "cfg";
f = {};
c = null;
break;
default:
f();
return;
}
ja(a, this, b, c, e, d, h, f);
}
return g;
return la.call(this, a, c, d, b, e, f);
};
x.import = function(a, c) {
if (c) {
switch(D(c) && (c = JSON.parse(c)), a) {
switch(E(c) && (c = JSON.parse(c)), a) {
case "tag":
this.D = c;
break;
case "reg":
this.fastupdate = !1;
this.reg = c;
this.reg = new Set(c);
for (let e = 0, d; e < this.field.length; e++) {
d = this.index[this.field[e]], d.reg = c, d.fastupdate = !1;
d = this.index.get(this.field[e]), d.fastupdate = !1, d.reg = this.reg;
}
break;
case "store":
this.store = c;
case "doc":
this.store = new Map(c);
break;
default:
a = a.split(".");
const b = a[0];
a = a[1];
b && a && this.index[b].import(a, c);
b && a && this.index.get(b).import(a, c);
}
}
};
ia(N.prototype);
function pa(a, c, b) {
ia(O.prototype);
function ra(a, c, b) {
a = ("object" === typeof a ? "" + a.query : a).toLowerCase();
let e = this.cache.get(a);
if (!e) {
@@ -767,57 +797,57 @@ function pa(a, c, b) {
}
return e;
}
function R(a) {
function S(a) {
this.limit = a && !0 !== a ? a : 1000;
this.cache = new Map();
this.h = "";
this.A = "";
}
R.prototype.set = function(a, c) {
this.cache.set(this.h = a, c);
S.prototype.set = function(a, c) {
this.cache.set(this.A = a, c);
this.cache.size > this.limit && this.cache.delete(this.cache.keys().next().value);
};
R.prototype.get = function(a) {
S.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));
c && this.A !== a && (this.cache.delete(a), this.cache.set(this.A = a, c));
return c;
};
R.prototype.remove = function(a) {
S.prototype.remove = function(a) {
for (const c of this.cache) {
const b = c[0];
c[1].includes(a) && this.cache.delete(b);
}
};
R.prototype.clear = function() {
S.prototype.clear = function() {
this.cache.clear();
this.h = "";
this.A = "";
};
const qa = {normalize:function(a) {
const sa = {normalize:function(a) {
return a.toLowerCase();
}, dedupe:!1};
const T = 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 ra = new Map([["ae", "a"], ["oe", "o"], ["sh", "s"], ["kh", "k"], ["th", "t"], ["pf", "f"]]), sa = [/([^aeo])h(.)/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2", /([^0-9])\1+/g, "$1"];
const ta = {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 ua = /[\x00-\x7F]+/g;
const va = /[\x00-\x7F]+/g;
const U = 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 ta = new Map([["ae", "a"], ["oe", "o"], ["sh", "s"], ["kh", "k"], ["th", "t"], ["pf", "f"]]), ua = [/([^aeo])h(.)/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2", /([^0-9])\1+/g, "$1"];
const va = {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 wa = /[\x00-\x7F]+/g;
var xa = {LatinExact:{normalize:!1, dedupe:!1}, LatinDefault:qa, LatinSimple:{normalize:!0, dedupe:!0}, LatinBalance:{normalize:!0, dedupe:!0, mapper:T}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:T, matcher:ra, replacer:sa}, LatinExtra:{normalize:!0, dedupe:!0, mapper:T, replacer:sa.concat([/(?!^)[aeo]/g, ""]), matcher:ra}, LatinSoundex:{normalize:!0, dedupe:!1, include:{letter:!0}, finalize:function(a) {
const xa = /[\x00-\x7F]+/g;
const ya = /[\x00-\x7F]+/g;
var za = {LatinExact:{normalize:!1, dedupe:!1}, LatinDefault:sa, LatinSimple:{normalize:!0, dedupe:!0}, LatinBalance:{normalize:!0, dedupe:!0, mapper:U}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:U, matcher:ta, replacer:ua}, LatinExtra:{normalize:!0, dedupe:!0, mapper:U, replacer:ua.concat([/(?!^)[aeo]/g, ""]), matcher:ta}, 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 = ta[e];
for (let f = 1, g; f < c.length && (g = c.charAt(f), "h" === g || "w" === g || !(g = ta[g]) || g === d || (e += g, d = g, 4 !== e.length)); f++) {
let e = c.charAt(0), d = va[e];
for (let f = 1, g; f < c.length && (g = c.charAt(f), "h" === g || "w" === g || !(g = va[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(ua, " ");
}}, CjkDefault:{normalize:!1, dedupe:!0, split:"", prepare:function(a) {
return ("" + a).replace(va, "");
}}, CyrillicDefault:{normalize:!1, dedupe:!0, prepare:function(a) {
return ("" + a).replace(wa, " ");
}}, CjkDefault:{normalize:!1, dedupe:!0, split:"", prepare:function(a) {
return ("" + a).replace(xa, "");
}}, CyrillicDefault:{normalize:!1, dedupe:!0, prepare:function(a) {
return ("" + a).replace(ya, " ");
}}};
const ya = {memory:{resolution:1}, performance:{resolution:6, fastupdate:!0, context:{depth:1, resolution:3}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:9}}};
const Aa = {memory:{resolution:1}, performance:{resolution:6, fastupdate:!0, context:{depth:1, resolution:3}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:9}}};
C();
S.prototype.add = function(a, c, b, e) {
T.prototype.add = function(a, c, b, e) {
if (c && (a || 0 === a)) {
if (!e && !b && this.reg.has(a)) {
return this.update(a, c);
@@ -829,15 +859,15 @@ S.prototype.add = function(a, c, b, e) {
let r = c[this.rtl ? e - 1 - p : p];
var d = r.length;
if (d && (n || !m[r])) {
var f = this.score ? this.score(c, r, p, null, 0) : U(t, e, p), g = "";
var f = this.score ? this.score(c, r, p, null, 0) : V(t, e, p), g = "";
switch(this.tokenize) {
case "full":
if (2 < d) {
for (f = 0; f < d; f++) {
for (var h = d; h > f; h--) {
g = r.substring(f, h);
var k = this.score ? this.score(c, r, p, g, f) : U(t, e, p, d, f);
V(this, m, g, k, a, b);
var k = this.score ? this.score(c, r, p, g, f) : V(t, e, p, d, f);
W(this, m, g, k, a, b);
}
}
break;
@@ -845,24 +875,24 @@ S.prototype.add = function(a, c, b, e) {
case "reverse":
if (1 < d) {
for (h = d - 1; 0 < h; h--) {
g = r[h] + g, k = this.score ? this.score(c, r, p, g, h) : U(t, e, p, d, h), V(this, m, g, k, a, b);
g = r[h] + g, k = this.score ? this.score(c, r, p, g, h) : V(t, e, p, d, h), W(this, m, g, k, a, b);
}
g = "";
}
case "forward":
if (1 < d) {
for (h = 0; h < d; h++) {
g += r[h], V(this, m, g, f, a, b);
g += r[h], W(this, m, g, f, a, b);
}
break;
}
default:
if (V(this, m, r, f, a, b), n && 1 < e && p < e - 1) {
if (W(this, m, r, f, a, b), n && 1 < e && p < e - 1) {
for (d = C(), g = this.P, f = r, h = Math.min(n + 1, e - p), d[f] = 1, k = 1; k < h; k++) {
if ((r = c[this.rtl ? e - 1 - p - k : p + k]) && !d[r]) {
d[r] = 1;
const u = this.score ? this.score(c, f, p, r, k) : U(g + (e / 2 > g ? 0 : 1), e, p, h - 1, k - 1), v = this.bidirectional && r > f;
V(this, l, v ? f : r, u, a, b, v ? r : f);
const u = this.score ? this.score(c, f, p, r, k) : V(g + (e / 2 > g ? 0 : 1), e, p, h - 1, k - 1), v = this.bidirectional && r > f;
W(this, l, v ? f : r, u, a, b, v ? r : f);
}
}
}
@@ -874,16 +904,16 @@ S.prototype.add = function(a, c, b, e) {
}
return this;
};
function V(a, c, b, e, d, f, g) {
function W(a, c, b, e, d, f, g) {
let h = g ? a.ctx : a.map, k;
if (!c[b] || g && !(k = c[b])[g]) {
g ? (c = k || (c[b] = C()), c[g] = 1, (k = h.get(g)) ? h = k : h.set(g, h = new Map())) : c[b] = 1, (k = h.get(b)) ? h = k : h.set(b, h = []), h = h[e] || (h[e] = []), f && h.includes(d) || (h.push(d), a.fastupdate && ((c = a.reg.get(d)) ? c.push(h) : a.reg.set(d, [h])));
}
}
function U(a, c, b, e, d) {
function V(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;
}
;function za(a, c, b) {
;function Ba(a, c, b) {
if (1 === a.length) {
return a = a[0], a = b || a.length > c ? c ? a.slice(b, b + c) : a.slice(b) : a;
}
@@ -913,7 +943,7 @@ function U(a, c, b, e, d) {
}
return e.length ? e = 1 < e.length ? [].concat.apply([], e) : e[0] : e;
}
;S.prototype.search = function(a, c, b) {
;T.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) {
@@ -927,11 +957,11 @@ function U(a, c, b, e, d) {
b = a.length;
c || (c = 100);
if (1 === b) {
return W.call(this, a[0], "", c, d);
return X.call(this, a[0], "", c, d);
}
f = this.depth && !1 !== f;
if (2 === b && f && !g) {
return W.call(this, a[0], a[1], c, d);
return X.call(this, a[0], a[1], c, d);
}
var h = 0, k = 0;
if (1 < b) {
@@ -939,7 +969,7 @@ function U(a, c, b, e, d) {
const n = [];
for (let t = 0, p; t < b; t++) {
if ((p = a[t]) && !l[p]) {
if (g || X(this, p)) {
if (g || Y(this, p)) {
n.push(p), l[p] = 1;
} else {
return e;
@@ -957,10 +987,10 @@ function U(a, c, b, e, d) {
}
l = 0;
if (1 === b) {
return W.call(this, a[0], "", c, d);
return X.call(this, a[0], "", c, d);
}
if (2 === b && f && !g) {
return W.call(this, a[0], a[1], c, d);
return X.call(this, a[0], a[1], c, d);
}
if (1 < b) {
if (f) {
@@ -972,7 +1002,7 @@ function U(a, c, b, e, d) {
}
for (let n, t; l < b; l++) {
t = a[l];
m ? (n = X(this, t, m), n = Aa(n, e, g, this.P), g && !1 === n && e.length || (m = t)) : (n = X(this, t, ""), n = Aa(n, e, g, this.resolution));
m ? (n = Y(this, t, m), n = Ca(n, e, g, this.P), g && !1 === n && e.length || (m = t)) : (n = Y(this, t, ""), n = Ca(n, e, g, this.resolution));
if (n) {
return n;
}
@@ -987,7 +1017,7 @@ function U(a, c, b, e, d) {
return e;
}
if (1 === f) {
return za(e[0], c, d);
return Ba(e[0], c, d);
}
}
}
@@ -1046,10 +1076,10 @@ function U(a, c, b, e, d) {
}
return e;
};
function W(a, c, b, e) {
return (a = X(this, a, c)) && a.length ? za(a, b, e) : [];
function X(a, c, b, e) {
return (a = Y(this, a, c)) && a.length ? Ba(a, b, e) : [];
}
function Aa(a, c, b, e) {
function Ca(a, c, b, e) {
let d = [];
if (a) {
e = Math.min(a.length, e);
@@ -1063,13 +1093,13 @@ function Aa(a, c, b, e) {
}
return !b && d;
}
function X(a, c, b) {
function Y(a, c, b) {
let e;
b && (e = a.bidirectional && c > b);
a = b ? (a = a.ctx.get(e ? c : b)) && a.get(e ? b : c) : a.map.get(c);
return a;
}
;S.prototype.remove = function(a, c) {
;T.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) {
@@ -1084,14 +1114,14 @@ function X(a, c, b) {
}
}
} else {
Y(this.map, a), this.depth && Y(this.ctx, a);
Z(this.map, a), this.depth && Z(this.ctx, a);
}
c || this.reg.delete(a);
}
this.cache && this.cache.remove(a);
return this;
};
function Y(a, c) {
function Z(a, c) {
let b = 0;
if (a.constructor === Array) {
for (let e = 0, d, f; e < a.length; e++) {
@@ -1106,25 +1136,25 @@ function Y(a, c) {
}
} else {
for (let e of a) {
const d = e[0], f = Y(e[1], c);
const d = e[0], f = Z(e[1], c);
f ? b += f : a.delete(d);
}
}
return b;
}
;function S(a, c) {
if (!this) {
return new S(a);
;function T(a, c) {
if (this.constructor !== T) {
return new T(a);
}
if (a) {
var b = D(a) ? a : a.preset;
b && (ya[b] || console.warn("Preset not found: " + b), a = Object.assign({}, ya[b], a));
var b = E(a) ? a : a.preset;
b && (Aa[b] || console.warn("Preset not found: " + b), a = Object.assign({}, Aa[b], a));
} else {
a = {};
}
b = a.context || {};
const e = D(a.encoder) ? xa[a.encoder] : a.encode || a.encoder || qa;
this.encoder = e.encode ? e : "object" === typeof e ? new L(e) : {encode:e};
const e = E(a.encoder) ? za[a.encoder] : a.encode || a.encoder || sa;
this.encoder = e.encode ? e : "object" === typeof e ? new K(e) : {encode:e};
let d;
this.resolution = a.resolution || 9;
this.tokenize = d = a.tokenize || "strict";
@@ -1138,9 +1168,9 @@ function Y(a, c) {
this.reg = c || (this.fastupdate ? new Map() : new Set());
this.P = b.resolution || 1;
this.rtl = e.rtl || a.rtl || !1;
this.cache = (d = a.cache || null) && new R(d);
this.cache = (d = a.cache || null) && new S(d);
}
x = S.prototype;
x = T.prototype;
x.clear = function() {
this.map.clear();
this.ctx.clear();
@@ -1158,7 +1188,7 @@ x.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 Z(a) {
function Da(a) {
let c = 0;
if (a.constructor === Array) {
for (let b = 0, e; b < a.length; b++) {
@@ -1166,7 +1196,7 @@ function Z(a) {
}
} else {
for (const b of a) {
const e = b[0], d = Z(b[1]);
const e = b[0], d = Da(b[1]);
d ? c += d : a.delete(e);
}
}
@@ -1176,63 +1206,47 @@ x.cleanup = function() {
if (!this.fastupdate) {
return console.info('Cleanup the index isn\'t required when not using "fastupdate".'), this;
}
Z(this.map);
this.depth && Z(this.ctx);
Da(this.map);
this.depth && Da(this.ctx);
return this;
};
x.searchCache = pa;
x.export = function(a, c, b, e, d, f) {
let g = !0;
"undefined" === typeof f && (g = new Promise(l => {
f = l;
}));
let h, k;
switch(d || (d = 0)) {
x.searchCache = ra;
x.export = function(a, c, b, e = 0) {
let d, f;
switch(e) {
case 0:
h = "reg";
if (this.fastupdate) {
k = C();
for (let l of this.reg.keys()) {
k[l] = 1;
}
} else {
k = this.reg;
}
d = "reg";
f = ka(this.reg);
break;
case 1:
h = "cfg";
k = {doc:0, opt:this.h ? 1 : 0};
d = "cfg";
f = {};
break;
case 2:
h = "map";
k = this.map;
d = "map";
f = N(this.map);
break;
case 3:
h = "ctx";
k = this.ctx;
d = "ctx";
f = ja(this.ctx);
break;
default:
"undefined" === typeof b && f && f();
return;
}
ja(a, c || this, b, h, e, d, k, f);
return g;
return la.call(this, a, c, d, b, e, f);
};
x.import = function(a, c) {
if (c) {
switch(D(c) && (c = JSON.parse(c)), a) {
case "cfg":
this.h = !!c.opt;
break;
switch(E(c) && (c = JSON.parse(c)), a) {
case "reg":
this.fastupdate = !1;
this.reg = c;
this.reg = new Set(c);
break;
case "map":
this.map = c;
this.map = new Map(c);
break;
case "ctx":
this.ctx = c;
this.ctx = new Map(c);
}
}
};
@@ -1286,7 +1300,7 @@ x.serialize = function(a = !0) {
d = "index.ctx=new Map([" + d + "]);";
return a ? "function inject(index){" + c + e + d + "}" : c + e + d;
};
ia(S.prototype);
export default {Index:S, Charset:xa, Encoder:L, Document:N, Worker:null, Resolver:null, IndexedDB:null, Language:{}};
ia(T.prototype);
export default {Index:T, Charset:za, Encoder:K, Document:O, Worker:null, Resolver:null, IndexedDB:null, Language:{}};
export const Index=S;export const Charset=xa;export const Encoder=L;export const Document=N;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};
export const Index=T;export const Charset=za;export const Encoder=K;export const Document=O;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};

View File

@@ -5,49 +5,48 @@
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
var x;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(h){return a(b(h))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var g=new Map(b);for(var f of a)g.set(f[0],f[1]);return g}if(c===Set){f=new Set(b);for(g of a.values())f.add(g);return f}}}return a}return b}return"undefined"===d?c:a}function C(){return Object.create(null)}function aa(a,c){return c.length-a.length}
function E(a){return"string"===typeof a}function H(a){return"object"===typeof a}function I(a,c){if(E(c))a=a[c];else for(let b=0;a&&b<c.length;b++)a=a[c[b]];return a};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 x;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(h){return a(b(h))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var g=new Map(b);for(var f of a)g.set(f[0],f[1]);return g}if(c===Set){f=new Set(b);for(g of a.values())f.add(g);return f}}}return a}return b}return"undefined"===d?c:a}function D(){return Object.create(null)}function aa(a,c){return c.length-a.length}
function E(a){return"string"===typeof a}function G(a){return"object"===typeof a}function I(a,c){if(E(c))a=a[c];else for(let b=0;a&&b<c.length;b++)a=a[c[b]];return a};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",
"u"],["\u0217","u"],["\u0219","s"],["\u021b","t"],["\u021f","h"],["\u0227","a"],["\u0229","e"],["\u022b","o"],["\u022d","o"],["\u022f","o"],["\u0231","o"],["\u0233","y"],["\u02b0","h"],["\u02b1","h"],["\u0266","h"],["\u02b2","j"],["\u02b3","r"],["\u02b4","\u0279"],["\u02b5","\u027b"],["\u02b6","\u0281"],["\u02b7","w"],["\u02b8","y"],["\u02e0","\u0263"],["\u02e1","l"],["\u02e2","s"],["\u02e3","x"],["\u02e4","\u0295"],["\u0390","\u03b9"],["\u03ac","\u03b1"],["\u03ad","\u03b5"],["\u03ae","\u03b7"],["\u03af",
"\u03b9"],["\u03b0","\u03c5"],["\u03ca","\u03b9"],["\u03cb","\u03c5"],["\u03cc","\u03bf"],["\u03cd","\u03c5"],["\u03ce","\u03c9"],["\u03d0","\u03b2"],["\u03d1","\u03b8"],["\u03d2","\u03a5"],["\u03d3","\u03a5"],["\u03d4","\u03a5"],["\u03d5","\u03c6"],["\u03d6","\u03c0"],["\u03f0","\u03ba"],["\u03f1","\u03c1"],["\u03f2","\u03c2"],["\u03f5","\u03b5"],["\u0439","\u0438"],["\u0450","\u0435"],["\u0451","\u0435"],["\u0453","\u0433"],["\u0457","\u0456"],["\u045c","\u043a"],["\u045d","\u0438"],["\u045e","\u0443"],
["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]];const ca=/[^\p{L}\p{N}]+/u,da=/(\d{3})/g,ea=/(\D)(\d{3})/g,fa=/(\d{3})(\D)/g,J="".normalize&&/[\u0300-\u036f]/g;function L(a){if(!this)return new L(...arguments);for(let c=0;c<arguments.length;c++)this.assign(arguments[c])}
L.prototype.assign=function(a){this.normalize=B(a.normalize,!0,this.normalize);let c=a.include,b=c||a.exclude||a.split;if("object"===typeof b){let e=!c,d="";a.include||(d+="\\p{Z}");b.letter&&(d+="\\p{L}");b.number&&(d+="\\p{N}",e=!!c);b.symbol&&(d+="\\p{S}");b.punctuation&&(d+="\\p{P}");b.control&&(d+="\\p{C}");if(b=b.char)d+="object"===typeof b?b.join(""):b;try{this.split=new RegExp("["+(c?"^":"")+d+"]+","u")}catch(g){this.split=/\s+/}this.numeric=e}else{try{this.split=B(b,ca,this.split)}catch(e){this.split=
["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]];const ca=/[^\p{L}\p{N}]+/u,da=/(\d{3})/g,ea=/(\D)(\d{3})/g,fa=/(\d{3})(\D)/g,J="".normalize&&/[\u0300-\u036f]/g;function K(a){if(this.constructor!==K)return new K(...arguments);for(let c=0;c<arguments.length;c++)this.assign(arguments[c])}
K.prototype.assign=function(a){this.normalize=B(a.normalize,!0,this.normalize);let c=a.include,b=c||a.exclude||a.split;if("object"===typeof b){let e=!c,d="";a.include||(d+="\\p{Z}");b.letter&&(d+="\\p{L}");b.number&&(d+="\\p{N}",e=!!c);b.symbol&&(d+="\\p{S}");b.punctuation&&(d+="\\p{P}");b.control&&(d+="\\p{C}");if(b=b.char)d+="object"===typeof b?b.join(""):b;try{this.split=new RegExp("["+(c?"^":"")+d+"]+","u")}catch(g){this.split=/\s+/}this.numeric=e}else{try{this.split=B(b,ca,this.split)}catch(e){this.split=
/\s+/}this.numeric=B(this.numeric,!0)}this.prepare=B(a.prepare,null,this.prepare);this.finalize=B(a.finalize,null,this.finalize);J||(this.mapper=new Map(ba));this.rtl=a.rtl||!1;this.dedupe=B(a.dedupe,!0,this.dedupe);this.filter=B((b=a.filter)&&new Set(b),null,this.filter);this.matcher=B((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=B((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=B((b=a.stemmer)&&new Map(b),null,this.stemmer);this.replacer=B(a.replacer,null,this.replacer);this.minlength=
B(a.minlength,1,this.minlength);this.maxlength=B(a.maxlength,0,this.maxlength);if(this.cache=b=B(a.cache,!0,this.cache))this.J=null,this.O="number"===typeof b?b:2E5,this.F=new Map,this.H=new Map,this.D=this.h=128;this.K="";this.M=null;this.L="";this.N=null;if(this.matcher)for(const e of this.matcher.keys())this.K+=(this.K?"|":"")+e;if(this.stemmer)for(const e of this.stemmer.keys())this.L+=(this.L?"|":"")+e;return this};
L.prototype.encode=function(a){if(this.cache&&a.length<=this.h)if(this.J){if(this.F.has(a))return this.F.get(a)}else this.J=setTimeout(ha,50,this);this.normalize&&(a="function"===typeof this.normalize?this.normalize(a):J?a.normalize("NFKD").replace(J,"").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 g=0,f,h;g<e.length;g++){if(!(f=h=e[g]))continue;if(f.length<this.minlength)continue;if(c){b.push(f);continue}if(this.filter&&this.filter.has(f))continue;if(this.cache&&f.length<=this.D)if(this.J){var d=this.H.get(f);if(d||""===d){d&&b.push(d);continue}}else this.J=setTimeout(ha,50,this);let k;this.stemmer&&2<f.length&&(this.N||(this.N=new RegExp("(?!^)("+this.L+")$")),f=f.replace(this.N,l=>this.stemmer.get(l)),k=1);f&&k&&(f.length<
B(a.minlength,1,this.minlength);this.maxlength=B(a.maxlength,0,this.maxlength);if(this.cache=b=B(a.cache,!0,this.cache))this.I=null,this.O="number"===typeof b?b:2E5,this.D=new Map,this.G=new Map,this.J=this.A=128;this.K="";this.M=null;this.L="";this.N=null;if(this.matcher)for(const e of this.matcher.keys())this.K+=(this.K?"|":"")+e;if(this.stemmer)for(const e of this.stemmer.keys())this.L+=(this.L?"|":"")+e;return this};
K.prototype.encode=function(a){if(this.cache&&a.length<=this.A)if(this.I){if(this.D.has(a))return this.D.get(a)}else this.I=setTimeout(ha,50,this);this.normalize&&(a="function"===typeof this.normalize?this.normalize(a):J?a.normalize("NFKD").replace(J,"").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 g=0,f,h;g<e.length;g++){if(!(f=h=e[g]))continue;if(f.length<this.minlength)continue;if(c){b.push(f);continue}if(this.filter&&this.filter.has(f))continue;if(this.cache&&f.length<=this.J)if(this.I){var d=this.G.get(f);if(d||""===d){d&&b.push(d);continue}}else this.I=setTimeout(ha,50,this);let k;this.stemmer&&2<f.length&&(this.N||(this.N=new RegExp("(?!^)("+this.L+")$")),f=f.replace(this.N,l=>this.stemmer.get(l)),k=1);f&&k&&(f.length<
this.minlength||this.filter&&this.filter.has(f))&&(f="");if(f&&(this.mapper||this.dedupe&&1<f.length)){d="";for(let l=0,m="",n,t;l<f.length;l++)n=f.charAt(l),n===m&&this.dedupe||((t=this.mapper&&this.mapper.get(n))||""===t?t===m&&this.dedupe||!(m=t)||(d+=t):d+=m=n);f=d}this.matcher&&1<f.length&&(this.M||(this.M=new RegExp("("+this.K+")","g")),f=f.replace(this.M,l=>this.matcher.get(l)));if(f&&this.replacer)for(d=0;f&&d<this.replacer.length;d+=2)f=f.replace(this.replacer[d],this.replacer[d+1]);this.cache&&
h.length<=this.D&&(this.H.set(h,f),this.H.size>this.O&&(this.H.clear(),this.D=this.D/1.1|0));f&&b.push(f)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.h&&(this.F.set(a,b),this.F.size>this.O&&(this.F.clear(),this.h=this.h/1.1|0));return b};function ha(a){a.J=null;a.F.clear();a.H.clear()};function ia(a){M.call(a,"add");M.call(a,"append");M.call(a,"search");M.call(a,"update");M.call(a,"remove")}function M(a){this[a+"Async"]=function(){var c=arguments;const b=c[c.length-1];let e;"function"===typeof b&&(e=b,delete c[c.length-1]);c=this[a].apply(this,c);e&&(c.then?c.then(e):e(c));return c}};function ja(a,c,b,e,d,g,f,h){(e=a(b?b+"."+e:e,JSON.stringify(f)))&&e.then?e.then(function(){c.export(a,c,b,d,g+1,h)}):c.export(a,c,b,d,g+1,h)};N.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 h=0,k;h<this.field.length;h++){k=this.C[h];var e=this.index.get(this.field[h]);if("function"===typeof k){var d=k(c);d&&e.add(a,d,!1,!0)}else if(d=k.G,!d||d(c))k.constructor===String?k=[""+k]:E(k)&&(k=[k]),O(c,k,this.I,0,e,a,k[0],b)}if(this.tag)for(e=0;e<this.B.length;e++){var g=this.B[e];d=this.tag.get(this.R[e]);let h=C();if("function"===typeof g){if(g=g(c),!g)continue}else{var f=
g.G;if(f&&!f(c))continue;g.constructor===String&&(g=""+g);g=I(c,g)}if(d&&g){E(g)&&(g=[g]);for(let k=0,l,m;k<g.length;k++)l=g[k],h[l]||(h[l]=1,(f=d.get(l))?m=f:d.set(l,m=[]),b&&m.includes(a)||(m.push(a),this.fastupdate&&((f=this.reg.get(a))?f.push(m):this.reg.set(a,[m]))))}}if(this.store&&(!b||!this.store.has(a))){let h;if(this.A){h=C();for(let k=0,l;k<this.A.length;k++){l=this.A[k];if((b=l.G)&&!b(c))continue;let m;if("function"===typeof l){m=l(c);if(!m)continue;l=[l.S]}else if(E(l)||l.constructor===
String){h[l]=c[l];continue}P(c,h,l,0,l[0],m)}}this.store.set(a,h||c)}}return this};function P(a,c,b,e,d,g){a=a[d];if(e===b.length-1)c[d]=g||a;else if(a)if(a.constructor===Array)for(c=c[d]=Array(a.length),d=0;d<a.length;d++)P(a,c,b,e,d);else c=c[d]||(c[d]=C()),d=b[++e],P(a,c,b,e,d)}
function O(a,c,b,e,d,g,f,h){if(a=a[f])if(e===c.length-1){if(a.constructor===Array){if(b[e]){for(c=0;c<a.length;c++)d.add(g,a[c],!0,!0);return}a=a.join(" ")}d.add(g,a,h,!0)}else if(a.constructor===Array)for(f=0;f<a.length;f++)O(a,c,b,e,d,g,f,h);else f=c[++e],O(a,c,b,e,d,g,f,h)};function ka(a,c){const b=C(),e=[];for(let d=0,g;d<c.length;d++){g=c[d];for(let f=0;f<g.length;f++)b[g[f]]=1}for(let d=0,g;d<a.length;d++)g=a[d],1===b[g]&&(e.push(g),b[g]=2);return e};N.prototype.search=function(a,c,b,e){b||(!c&&H(a)?(b=a,a=""):H(c)&&(b=c,c=0));let d=[];var g=[];let f,h,k,l,m,n,t=0,p;if(b){b.constructor===Array&&(b={index:b});a=b.query||a;var r=b.pluck;h=b.merge;l=r||b.field||b.index;m=this.tag&&b.tag;f=this.store&&b.enrich;k=b.suggest;p=b.T;c=b.limit||c;n=b.offset||0;c||(c=100);if(m){m.constructor!==Array&&(m=[m]);var v=[];for(let w=0,q;w<m.length;w++)if(q=m[w],q.field&&q.tag){var u=q.tag;if(u.constructor===Array)for(var y=0;y<u.length;y++)v.push(q.field,u[y]);
else v.push(q.field,u)}else{u=Object.keys(q);for(let D=0,A,z;D<u.length;D++)if(A=u[D],z=q[A],z.constructor===Array)for(y=0;y<z.length;y++)v.push(A,z[y]);else v.push(A,z)}m=v;if(!a){e=[];if(v.length)for(g=0;g<v.length;g+=2)r=la.call(this,v[g],v[g+1],c,n,f),d.push({field:v[g],tag:v[g+1],result:r});return e.length?Promise.all(e).then(function(w){for(let q=0;q<w.length;q++)d[q].result=w[q];return d}):d}}E(l)&&(l=[l])}l||(l=this.field);v=!e&&(this.worker||this.db)&&[];for(let w=0,q,D,A;w<l.length;w++){D=
l[w];let z;E(D)||(z=D,D=z.field,a=z.query||a,c=z.limit||c,n=z.offset||n,k=z.suggest||k,f=this.store&&(z.enrich||f));if(e)q=e[w];else if(u=z||b,y=this.index.get(D),m&&(u.enrich=!1),v){v[w]=y.search(a,c,u);u&&f&&(u.enrich=f);continue}else q=y.search(a,c,u),u&&f&&(u.enrich=f);A=q&&q.length;if(m&&A){u=[];y=0;for(let G=0,F,K;G<m.length;G+=2){F=this.tag.get(m[G]);if(!F)if(k)continue;else return d;if(K=(F=F&&F.get(m[G+1]))&&F.length)y++,u.push(F);else if(!k)return d}if(y){q=ka(q,u);A=q.length;if(!A&&!k)return d;
y--}}if(A)g[t]=D,d.push(q),t++;else if(1===l.length)return d}if(v){const w=this;return Promise.all(v).then(function(q){return q.length?w.search(a,c,b,q):q})}if(!t)return d;if(r&&(!f||!this.store))return d[0];v=[];for(let w=0,q;w<g.length;w++){q=d[w];f&&q.length&&!q[0].doc&&q.length&&(q=ma.call(this,q));if(r)return q;d[w]={field:g[w],result:q}}return h?na(d,c):p?oa(d,a,this.index,this.field,this.C,p):d};
function oa(a,c,b,e,d,g){let f,h,k;for(let m=0,n,t,p,r,v;m<a.length;m++){n=a[m].result;t=a[m].field;r=b.get(t);p=r.encoder;k=r.tokenize;v=d[e.indexOf(t)];p!==f&&(f=p,h=f.encode(c));for(let u=0;u<n.length;u++){let y="";var l=I(n[u].doc,v);let w=f.encode(l);l=l.split(f.split);for(let q=0,D,A;q<w.length;q++){D=w[q];A=l[q];let z;for(let G=0,F;G<h.length;G++)if(F=h[G],"strict"===k){if(D===F){y+=(y?" ":"")+g.replace("$1",A);z=!0;break}}else{const K=D.indexOf(F);if(-1<K){y+=(y?" ":"")+A.substring(0,K)+g.replace("$1",
A.substring(K,F.length))+A.substring(K+F.length);z=!0;break}}z||(y+=(y?" ":"")+l[q])}n[u].T=y}}return a}function na(a,c){const b=[],e=C();for(let d=0,g,f;d<a.length;d++){g=a[d];f=g.result;for(let h=0,k,l,m;h<f.length;h++)if(l=f[h],k=l.id,m=e[k])m.push(g.field);else{if(b.length===c)return b;l.field=e[k]=[g.field];b.push(l)}}return b}function la(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=ma.call(this,a));return a}}
function ma(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 N(a){if(!this)return new N(a);const c=a.document||a.doc||a;var b;this.C=[];this.field=[];this.I=[];this.key=(b=c.key||c.id)&&Q(b,this.I)||"id";this.reg=(this.fastupdate=!!a.fastupdate)?new Map:new Set;this.A=(b=c.store||null)&&!0!==b&&[];this.store=b&&new Map;this.cache=(b=a.cache||null)&&new R(b);a.cache=!1;b=new Map;let e=c.index||c.field||c;E(e)&&(e=[e]);for(let d=0,g,f;d<e.length;d++)g=e[d],E(g)||(f=g,g=g.field),f=H(f)?Object.assign({},a,f):a,b.set(g,new S(f,this.reg)),f.custom?this.C[d]=
f.custom:(this.C[d]=Q(g,this.I),f.filter&&("string"===typeof this.C[d]&&(this.C[d]=new String(this.C[d])),this.C[d].G=f.filter)),this.field[d]=g;if(this.A){a=c.store;E(a)&&(a=[a]);for(let d=0,g,f;d<a.length;d++)g=a[d],f=g.field||g,g.custom?(this.A[d]=g.custom,g.custom.S=f):(this.A[d]=Q(f,this.I),g.filter&&("string"===typeof this.A[d]&&(this.A[d]=new String(this.A[d])),this.A[d].G=g.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.R=[];for(let d=0,g,f;d<b.length;d++){g=b[d];f=g.field||g;if(!f)throw Error("The tag field from the document descriptor is undefined.");g.custom?this.B[d]=g.custom:(this.B[d]=Q(f,this.I),g.filter&&("string"===typeof this.B[d]&&(this.B[d]=new String(this.B[d])),this.B[d].G=g.filter));this.R[d]=f;this.tag.set(f,new Map)}}}
function Q(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]}x=N.prototype;x.append=function(a,c){return this.add(a,c,!0)};x.update=function(a,c){return this.remove(a).add(a,c)};
x.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],g=d.indexOf(a);-1<g&&(1<d.length?d.splice(g,1):b.delete(c))}this.store&&this.store.delete(a);this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
x.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};x.contain=function(a){return this.reg.has(a)};x.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};x.get=function(a){return this.store.get(a)};x.set=function(a,c){this.store.set(a,c);return this};x.searchCache=pa;
x.export=function(a,c,b,e,d,g){let f;"undefined"===typeof g&&(f=new Promise(k=>{g=k}));d||(d=0);e||(e=0);if(e<this.field.length){b=this.field[e];var h=this.index[b];c=this;h.export(a,c,d?b:"",e,d++,g)||(e++,c.export(a,c,b,e,1,g))}else{switch(d){case 1:c="tag";h=this.D;b=null;break;case 2:c="store";h=this.store;b=null;break;default:g();return}ja(a,this,b,c,e,d,h,g)}return f};
x.import=function(a,c){if(c)switch(E(c)&&(c=JSON.parse(c)),a){case "tag":this.D=c;break;case "reg":this.fastupdate=!1;this.reg=c;for(let e=0,d;e<this.field.length;e++)d=this.index[this.field[e]],d.reg=c,d.fastupdate=!1;break;case "store":this.store=c;break;default:a=a.split(".");const b=a[0];a=a[1];b&&a&&this.index[b].import(a,c)}};ia(N.prototype);function pa(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();let e=this.cache.get(a);if(!e){e=this.search(a,c,b);if(e.then){const d=this;e.then(function(g){d.cache.set(a,g);return g})}this.cache.set(a,e)}return e}function R(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}R.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)};
R.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};R.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};R.prototype.clear=function(){this.cache.clear();this.h=""};const qa={normalize:function(a){return a.toLowerCase()},dedupe:!1};const T=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 ra=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["pf","f"]]),sa=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\1+/g,"$1"];const ta={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 ua=/[\x00-\x7F]+/g;const va=/[\x00-\x7F]+/g;const wa=/[\x00-\x7F]+/g;var xa={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:qa,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:T},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:T,matcher:ra,replacer:sa},LatinExtra:{normalize:!0,dedupe:!0,mapper:T,replacer:sa.concat([/(?!^)[aeo]/g,""]),matcher:ra},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=ta[e];for(let g=1,f;g<c.length&&(f=c.charAt(g),"h"===f||
"w"===f||!(f=ta[f])||f===d||(e+=f,d=f,4!==e.length));g++);a[b]=e}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(ua," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(va,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(wa," ")}}};const ya={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};C();S.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 r=c[this.rtl?e-1-p:p];var d=r.length;if(d&&(n||!m[r])){var g=this.score?this.score(c,r,p,null,0):U(t,e,p),f="";switch(this.tokenize){case "full":if(2<d){for(g=0;g<d;g++)for(var h=d;h>g;h--){f=r.substring(g,h);var k=this.score?this.score(c,r,p,f,g):U(t,e,p,d,g);V(this,m,f,k,a,b)}break}case "reverse":if(1<
d){for(h=d-1;0<h;h--)f=r[h]+f,k=this.score?this.score(c,r,p,f,h):U(t,e,p,d,h),V(this,m,f,k,a,b);f=""}case "forward":if(1<d){for(h=0;h<d;h++)f+=r[h],V(this,m,f,g,a,b);break}default:if(V(this,m,r,g,a,b),n&&1<e&&p<e-1)for(d=C(),f=this.P,g=r,h=Math.min(n+1,e-p),d[g]=1,k=1;k<h;k++)if((r=c[this.rtl?e-1-p-k:p+k])&&!d[r]){d[r]=1;const v=this.score?this.score(c,g,p,r,k):U(f+(e/2>f?0:1),e,p,h-1,k-1),u=this.bidirectional&&r>g;V(this,l,u?g:r,v,a,b,u?r:g)}}}}this.fastupdate||this.reg.add(a)}}return this};
function V(a,c,b,e,d,g,f){let h=f?a.ctx:a.map,k;if(!c[b]||f&&!(k=c[b])[f])f?(c=k||(c[b]=C()),c[f]=1,(k=h.get(f))?h=k:h.set(f,h=new Map)):c[b]=1,(k=h.get(b))?h=k:h.set(b,h=[]),h=h[e]||(h[e]=[]),g&&h.includes(d)||(h.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(h):a.reg.set(d,[h])))}function U(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};function za(a,c,b){if(1===a.length)return a=a[0],a=b||a.length>c?c?a.slice(b,b+c):a.slice(b):a;let e=[];for(let d=0,g,f;d<a.length;d++)if((g=a[d])&&(f=g.length)){if(b){if(b>=f){b-=f;continue}b<f&&(g=c?g.slice(b,b+c):g.slice(b),f=g.length,b=0)}if(e.length)f>c&&(g=g.slice(0,c),f=g.length),e.push(g);else{if(f>=c)return f>c&&(g=g.slice(0,c)),g;e=[g]}c-=f;if(!c)break}return e.length?e=1<e.length?[].concat.apply([],e):e[0]:e};S.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 g=b.context;var f=b.suggest}a=this.encoder.encode(a);b=a.length;c||(c=100);if(1===b)return W.call(this,a[0],"",c,d);g=this.depth&&!1!==g;if(2===b&&g&&!f)return W.call(this,a[0],a[1],c,d);var h=0,k=0;if(1<b){var l=C();const n=[];for(let t=0,p;t<b;t++)if((p=a[t])&&!l[p]){if(f||X(this,p))n.push(p),l[p]=1;else return e;const r=p.length;h=Math.max(h,r);k=k?Math.min(k,
r):r}a=n;b=a.length}if(!b)return e;l=0;if(1===b)return W.call(this,a[0],"",c,d);if(2===b&&g&&!f)return W.call(this,a[0],a[1],c,d);if(1<b)if(g){var m=a[0];l=1}else 9<h&&3<h/k&&a.sort(aa);for(let n,t;l<b;l++){t=a[l];m?(n=X(this,t,m),n=Aa(n,e,f,this.P),f&&!1===n&&e.length||(m=t)):(n=X(this,t,""),n=Aa(n,e,f,this.resolution));if(n)return n;if(f&&l===b-1){g=e.length;if(!g){if(m){m="";l=-1;continue}return e}if(1===g)return za(e[0],c,d)}}a:{a=e;e=this.resolution;m=f;b=a.length;f=[];g=C();for(let n=0,t,p,
r,v;n<e;n++)for(k=0;k<b;k++)if(r=a[k],n<r.length&&(t=r[n]))for(l=0;l<t.length;l++)p=t[l],(h=g[p])?g[p]++:(h=0,g[p]=1),v=f[h]||(f[h]=[]),v.push(p);if(a=f.length)if(m){if(1<f.length)b:for(a=[],e=C(),m=f.length,h=m-1;0<=h;h--)for(m=f[h],g=m.length,k=0;k<g;k++){if(b=m[k],!e[b])if(e[b]=1,d)d--;else if(a.push(b),a.length===c)break b}else a=(f=f[0]).length>c||d?f.slice(d,c+d):f;f=a}else{if(a<b){e=[];break a}f=f[a-1];if(c||d)if(f.length>c||d)f=f.slice(d,c+d)}e=f}return e};
function W(a,c,b,e){return(a=X(this,a,c))&&a.length?za(a,b,e):[]}function Aa(a,c,b,e){let d=[];if(a){e=Math.min(a.length,e);for(let g=0,f;g<e;g++)(f=a[g])&&f&&(d[g]=f);if(d.length){c.push(d);return}}return!b&&d}function X(a,c,b){let e;b&&(e=a.bidirectional&&c>b);a=b?(a=a.ctx.get(e?c:b))&&a.get(e?b:c):a.map.get(c);return a};S.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 g=d.indexOf(a);g===b.length-1?d.pop():d.splice(g,1)}}else Y(this.map,a),this.depth&&Y(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function Y(a,c){let b=0;if(a.constructor===Array)for(let e=0,d,g;e<a.length;e++){if((d=a[e])&&d.length)if(g=d.indexOf(c),0<=g){1<d.length?(d.splice(g,1),b++):delete a[e];break}else b++}else for(let e of a){const d=e[0],g=Y(e[1],c);g?b+=g:a.delete(d)}return b};function S(a,c){if(!this)return new S(a);if(a){var b=E(a)?a:a.preset;b&&(a=Object.assign({},ya[b],a))}else a={};b=a.context||{};const e=E(a.encoder)?xa[a.encoder]:a.encode||a.encoder||qa;this.encoder=e.encode?e:"object"===typeof e?new L(e):{encode:e};let d;this.resolution=a.resolution||9;this.tokenize=d=a.tokenize||"strict";this.depth="strict"===d&&b.depth||0;this.bidirectional=!1!==b.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;d=!1;this.map=new Map;this.ctx=new Map;this.reg=
c||(this.fastupdate?new Map:new Set);this.P=b.resolution||1;this.rtl=e.rtl||a.rtl||!1;this.cache=(d=a.cache||null)&&new R(d)}x=S.prototype;x.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};x.append=function(a,c){return this.add(a,c,!0)};x.contain=function(a){return this.reg.has(a)};x.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 Z(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=Z(b[1]);d?c+=d:a.delete(e)}return c}x.cleanup=function(){if(!this.fastupdate)return this;Z(this.map);this.depth&&Z(this.ctx);return this};x.searchCache=pa;
x.export=function(a,c,b,e,d,g){let f=!0;"undefined"===typeof g&&(f=new Promise(l=>{g=l}));let h,k;switch(d||(d=0)){case 0:h="reg";if(this.fastupdate){k=C();for(let l of this.reg.keys())k[l]=1}else k=this.reg;break;case 1:h="cfg";k={doc:0,opt:this.h?1:0};break;case 2:h="map";k=this.map;break;case 3:h="ctx";k=this.ctx;break;default:"undefined"===typeof b&&g&&g();return}ja(a,c||this,b,h,e,d,k,g);return f};
x.import=function(a,c){if(c)switch(E(c)&&(c=JSON.parse(c)),a){case "cfg":this.h=!!c.opt;break;case "reg":this.fastupdate=!1;this.reg=c;break;case "map":this.map=c;break;case "ctx":this.ctx=c}};
h.length<=this.J&&(this.G.set(h,f),this.G.size>this.O&&(this.G.clear(),this.J=this.J/1.1|0));f&&b.push(f)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.A&&(this.D.set(a,b),this.D.size>this.O&&(this.D.clear(),this.A=this.A/1.1|0));return b};function ha(a){a.I=null;a.D.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")}function M(a){this[a+"Async"]=function(){var c=arguments;const b=c[c.length-1];let e;"function"===typeof b&&(e=b,delete c[c.length-1]);c=this[a].apply(this,c);e&&(c.then?c.then(e):e(c));return c}};function N(a){const c=[];for(const b of a.entries())c.push(b);return c}function ja(a){const c=[];for(const b of a.entries())c.push(N(b));return c}function ka(a){const c=[];for(const b of a.keys())c.push(b);return c}function la(a,c,b,e,d,g){if((b=a(c?c+"."+b:b,JSON.stringify(g)))&&b.then){const f=this;return b.then(function(){return f.export(a,c,e,d+1)})}return this.export(a,c,e,d+1)};O.prototype.add=function(a,c,b){G(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 h=0,k;h<this.field.length;h++){k=this.C[h];var e=this.index.get(this.field[h]);if("function"===typeof k){var d=k(c);d&&e.add(a,d,!1,!0)}else if(d=k.F,!d||d(c))k.constructor===String?k=[""+k]:E(k)&&(k=[k]),P(c,k,this.H,0,e,a,k[0],b)}if(this.tag)for(e=0;e<this.B.length;e++){var g=this.B[e];d=this.tag.get(this.R[e]);let h=D();if("function"===typeof g){if(g=g(c),!g)continue}else{var f=
g.F;if(f&&!f(c))continue;g.constructor===String&&(g=""+g);g=I(c,g)}if(d&&g){E(g)&&(g=[g]);for(let k=0,l,m;k<g.length;k++)l=g[k],h[l]||(h[l]=1,(f=d.get(l))?m=f:d.set(l,m=[]),b&&m.includes(a)||(m.push(a),this.fastupdate&&((f=this.reg.get(a))?f.push(m):this.reg.set(a,[m]))))}}if(this.store&&(!b||!this.store.has(a))){let h;if(this.h){h=D();for(let k=0,l;k<this.h.length;k++){l=this.h[k];if((b=l.F)&&!b(c))continue;let m;if("function"===typeof l){m=l(c);if(!m)continue;l=[l.S]}else if(E(l)||l.constructor===
String){h[l]=c[l];continue}Q(c,h,l,0,l[0],m)}}this.store.set(a,h||c)}}return this};function Q(a,c,b,e,d,g){a=a[d];if(e===b.length-1)c[d]=g||a;else if(a)if(a.constructor===Array)for(c=c[d]=Array(a.length),d=0;d<a.length;d++)Q(a,c,b,e,d);else c=c[d]||(c[d]=D()),d=b[++e],Q(a,c,b,e,d)}
function P(a,c,b,e,d,g,f,h){if(a=a[f])if(e===c.length-1){if(a.constructor===Array){if(b[e]){for(c=0;c<a.length;c++)d.add(g,a[c],!0,!0);return}a=a.join(" ")}d.add(g,a,h,!0)}else if(a.constructor===Array)for(f=0;f<a.length;f++)P(a,c,b,e,d,g,f,h);else f=c[++e],P(a,c,b,e,d,g,f,h)};function ma(a,c){const b=D(),e=[];for(let d=0,g;d<c.length;d++){g=c[d];for(let f=0;f<g.length;f++)b[g[f]]=1}for(let d=0,g;d<a.length;d++)g=a[d],1===b[g]&&(e.push(g),b[g]=2);return e};O.prototype.search=function(a,c,b,e){b||(!c&&G(a)?(b=a,a=""):G(c)&&(b=c,c=0));let d=[];var g=[];let f,h,k,l,m,n,t=0,p;if(b){b.constructor===Array&&(b={index:b});a=b.query||a;var r=b.pluck;h=b.merge;l=r||b.field||b.index;m=this.tag&&b.tag;f=this.store&&b.enrich;k=b.suggest;p=b.T;c=b.limit||c;n=b.offset||0;c||(c=100);if(m){m.constructor!==Array&&(m=[m]);var v=[];for(let w=0,q;w<m.length;w++)if(q=m[w],q.field&&q.tag){var u=q.tag;if(u.constructor===Array)for(var y=0;y<u.length;y++)v.push(q.field,u[y]);
else v.push(q.field,u)}else{u=Object.keys(q);for(let C=0,A,z;C<u.length;C++)if(A=u[C],z=q[A],z.constructor===Array)for(y=0;y<z.length;y++)v.push(A,z[y]);else v.push(A,z)}m=v;if(!a){e=[];if(v.length)for(g=0;g<v.length;g+=2)r=na.call(this,v[g],v[g+1],c,n,f),d.push({field:v[g],tag:v[g+1],result:r});return e.length?Promise.all(e).then(function(w){for(let q=0;q<w.length;q++)d[q].result=w[q];return d}):d}}E(l)&&(l=[l])}l||(l=this.field);v=!e&&(this.worker||this.db)&&[];for(let w=0,q,C,A;w<l.length;w++){C=
l[w];let z;E(C)||(z=C,C=z.field,a=z.query||a,c=z.limit||c,n=z.offset||n,k=z.suggest||k,f=this.store&&(z.enrich||f));if(e)q=e[w];else if(u=z||b,y=this.index.get(C),m&&(u.enrich=!1),v){v[w]=y.search(a,c,u);u&&f&&(u.enrich=f);continue}else q=y.search(a,c,u),u&&f&&(u.enrich=f);A=q&&q.length;if(m&&A){u=[];y=0;for(let H=0,F,L;H<m.length;H+=2){F=this.tag.get(m[H]);if(!F)if(k)continue;else return d;if(L=(F=F&&F.get(m[H+1]))&&F.length)y++,u.push(F);else if(!k)return d}if(y){q=ma(q,u);A=q.length;if(!A&&!k)return d;
y--}}if(A)g[t]=C,d.push(q),t++;else if(1===l.length)return d}if(v){const w=this;return Promise.all(v).then(function(q){return q.length?w.search(a,c,b,q):q})}if(!t)return d;if(r&&(!f||!this.store))return d[0];v=[];for(let w=0,q;w<g.length;w++){q=d[w];f&&q.length&&!q[0].doc&&q.length&&(q=oa.call(this,q));if(r)return q;d[w]={field:g[w],result:q}}return h?pa(d,c):p?qa(d,a,this.index,this.field,this.C,p):d};
function qa(a,c,b,e,d,g){let f,h,k;for(let m=0,n,t,p,r,v;m<a.length;m++){n=a[m].result;t=a[m].field;r=b.get(t);p=r.encoder;k=r.tokenize;v=d[e.indexOf(t)];p!==f&&(f=p,h=f.encode(c));for(let u=0;u<n.length;u++){let y="";var l=I(n[u].doc,v);let w=f.encode(l);l=l.split(f.split);for(let q=0,C,A;q<w.length;q++){C=w[q];A=l[q];let z;for(let H=0,F;H<h.length;H++)if(F=h[H],"strict"===k){if(C===F){y+=(y?" ":"")+g.replace("$1",A);z=!0;break}}else{const L=C.indexOf(F);if(-1<L){y+=(y?" ":"")+A.substring(0,L)+g.replace("$1",
A.substring(L,F.length))+A.substring(L+F.length);z=!0;break}}z||(y+=(y?" ":"")+l[q])}n[u].T=y}}return a}function pa(a,c){const b=[],e=D();for(let d=0,g,f;d<a.length;d++){g=a[d];f=g.result;for(let h=0,k,l,m;h<f.length;h++)if(l=f[h],k=l.id,m=e[k])m.push(g.field);else{if(b.length===c)return b;l.field=e[k]=[g.field];b.push(l)}}return b}function na(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=oa.call(this,a));return a}}
function oa(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 O(a){if(this.constructor!==O)return new O(a);const c=a.document||a.doc||a;var b;this.C=[];this.field=[];this.H=[];this.key=(b=c.key||c.id)&&R(b,this.H)||"id";this.reg=(this.fastupdate=!!a.fastupdate)?new Map:new Set;this.h=(b=c.store||null)&&!0!==b&&[];this.store=b&&new Map;this.cache=(b=a.cache||null)&&new S(b);a.cache=!1;b=new Map;let e=c.index||c.field||c;E(e)&&(e=[e]);for(let d=0,g,f;d<e.length;d++)g=e[d],E(g)||(f=g,g=g.field),f=G(f)?Object.assign({},a,f):a,b.set(g,new T(f,this.reg)),
f.custom?this.C[d]=f.custom:(this.C[d]=R(g,this.H),f.filter&&("string"===typeof this.C[d]&&(this.C[d]=new String(this.C[d])),this.C[d].F=f.filter)),this.field[d]=g;if(this.h){a=c.store;E(a)&&(a=[a]);for(let d=0,g,f;d<a.length;d++)g=a[d],f=g.field||g,g.custom?(this.h[d]=g.custom,g.custom.S=f):(this.h[d]=R(f,this.H),g.filter&&("string"===typeof this.h[d]&&(this.h[d]=new String(this.h[d])),this.h[d].F=g.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.R=[];for(let d=0,g,f;d<b.length;d++){g=b[d];f=g.field||g;if(!f)throw Error("The tag field from the document descriptor is undefined.");g.custom?this.B[d]=g.custom:(this.B[d]=R(f,this.H),g.filter&&("string"===typeof this.B[d]&&(this.B[d]=new String(this.B[d])),this.B[d].F=g.filter));this.R[d]=f;this.tag.set(f,new Map)}}}
function R(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]}x=O.prototype;x.append=function(a,c){return this.add(a,c,!0)};x.update=function(a,c){return this.remove(a).add(a,c)};
x.remove=function(a){G(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],g=d.indexOf(a);-1<g&&(1<d.length?d.splice(g,1):b.delete(c))}this.store&&this.store.delete(a);this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
x.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};x.contain=function(a){return this.reg.has(a)};x.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};x.get=function(a){return this.store.get(a)};x.set=function(a,c){this.store.set(a,c);return this};x.searchCache=ra;
x.export=function(a,c,b=0,e=0){if(b<this.field.length){const f=this.field[b];if((c=this.index.get(f).export(a,f,b,e=1))&&c.then){const h=this;return c.then(function(){return h.export(a,f,b+1,e=0)})}return this.export(a,f,b+1,e=0)}let d,g;switch(e){case 0:d="reg";g=ka(this.reg);c=null;break;case 1:d="tag";g=ja(this.tag);c=null;break;case 2:d="doc";g=N(this.store);c=null;break;case 3:d="cfg";g={};c=null;break;default:return}return la.call(this,a,c,d,b,e,g)};
x.import=function(a,c){if(c)switch(E(c)&&(c=JSON.parse(c)),a){case "tag":break;case "reg":this.fastupdate=!1;this.reg=new Set(c);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 "doc":this.store=new Map(c);break;default:a=a.split(".");const b=a[0];a=a[1];b&&a&&this.index.get(b).import(a,c)}};ia(O.prototype);function ra(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();let e=this.cache.get(a);if(!e){e=this.search(a,c,b);if(e.then){const d=this;e.then(function(g){d.cache.set(a,g);return g})}this.cache.set(a,e)}return e}function S(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.A=""}S.prototype.set=function(a,c){this.cache.set(this.A=a,c);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};
S.prototype.get=function(a){const c=this.cache.get(a);c&&this.A!==a&&(this.cache.delete(a),this.cache.set(this.A=a,c));return c};S.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};S.prototype.clear=function(){this.cache.clear();this.A=""};const sa={normalize:function(a){return a.toLowerCase()},dedupe:!1};const U=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 ta=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["pf","f"]]),ua=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\1+/g,"$1"];const va={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 wa=/[\x00-\x7F]+/g;const xa=/[\x00-\x7F]+/g;const ya=/[\x00-\x7F]+/g;var za={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:sa,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:U},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:U,matcher:ta,replacer:ua},LatinExtra:{normalize:!0,dedupe:!0,mapper:U,replacer:ua.concat([/(?!^)[aeo]/g,""]),matcher:ta},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=va[e];for(let g=1,f;g<c.length&&(f=c.charAt(g),"h"===f||
"w"===f||!(f=va[f])||f===d||(e+=f,d=f,4!==e.length));g++);a[b]=e}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(wa," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(xa,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(ya," ")}}};const Aa={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};D();T.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=D(),m=D(),n=this.depth,t=this.resolution;for(let p=0;p<e;p++){let r=c[this.rtl?e-1-p:p];var d=r.length;if(d&&(n||!m[r])){var g=this.score?this.score(c,r,p,null,0):V(t,e,p),f="";switch(this.tokenize){case "full":if(2<d){for(g=0;g<d;g++)for(var h=d;h>g;h--){f=r.substring(g,h);var k=this.score?this.score(c,r,p,f,g):V(t,e,p,d,g);W(this,m,f,k,a,b)}break}case "reverse":if(1<
d){for(h=d-1;0<h;h--)f=r[h]+f,k=this.score?this.score(c,r,p,f,h):V(t,e,p,d,h),W(this,m,f,k,a,b);f=""}case "forward":if(1<d){for(h=0;h<d;h++)f+=r[h],W(this,m,f,g,a,b);break}default:if(W(this,m,r,g,a,b),n&&1<e&&p<e-1)for(d=D(),f=this.P,g=r,h=Math.min(n+1,e-p),d[g]=1,k=1;k<h;k++)if((r=c[this.rtl?e-1-p-k:p+k])&&!d[r]){d[r]=1;const v=this.score?this.score(c,g,p,r,k):V(f+(e/2>f?0:1),e,p,h-1,k-1),u=this.bidirectional&&r>g;W(this,l,u?g:r,v,a,b,u?r:g)}}}}this.fastupdate||this.reg.add(a)}}return this};
function W(a,c,b,e,d,g,f){let h=f?a.ctx:a.map,k;if(!c[b]||f&&!(k=c[b])[f])f?(c=k||(c[b]=D()),c[f]=1,(k=h.get(f))?h=k:h.set(f,h=new Map)):c[b]=1,(k=h.get(b))?h=k:h.set(b,h=[]),h=h[e]||(h[e]=[]),g&&h.includes(d)||(h.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(h):a.reg.set(d,[h])))}function V(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};function Ba(a,c,b){if(1===a.length)return a=a[0],a=b||a.length>c?c?a.slice(b,b+c):a.slice(b):a;let e=[];for(let d=0,g,f;d<a.length;d++)if((g=a[d])&&(f=g.length)){if(b){if(b>=f){b-=f;continue}b<f&&(g=c?g.slice(b,b+c):g.slice(b),f=g.length,b=0)}if(e.length)f>c&&(g=g.slice(0,c),f=g.length),e.push(g);else{if(f>=c)return f>c&&(g=g.slice(0,c)),g;e=[g]}c-=f;if(!c)break}return e.length?e=1<e.length?[].concat.apply([],e):e[0]:e};T.prototype.search=function(a,c,b){b||(!c&&G(a)?(b=a,a=""):G(c)&&(b=c,c=0));var e=[],d=0;if(b){a=b.query||a;c=b.limit||c;d=b.offset||0;var g=b.context;var f=b.suggest}a=this.encoder.encode(a);b=a.length;c||(c=100);if(1===b)return X.call(this,a[0],"",c,d);g=this.depth&&!1!==g;if(2===b&&g&&!f)return X.call(this,a[0],a[1],c,d);var h=0,k=0;if(1<b){var l=D();const n=[];for(let t=0,p;t<b;t++)if((p=a[t])&&!l[p]){if(f||Y(this,p))n.push(p),l[p]=1;else return e;const r=p.length;h=Math.max(h,r);k=k?Math.min(k,
r):r}a=n;b=a.length}if(!b)return e;l=0;if(1===b)return X.call(this,a[0],"",c,d);if(2===b&&g&&!f)return X.call(this,a[0],a[1],c,d);if(1<b)if(g){var m=a[0];l=1}else 9<h&&3<h/k&&a.sort(aa);for(let n,t;l<b;l++){t=a[l];m?(n=Y(this,t,m),n=Ca(n,e,f,this.P),f&&!1===n&&e.length||(m=t)):(n=Y(this,t,""),n=Ca(n,e,f,this.resolution));if(n)return n;if(f&&l===b-1){g=e.length;if(!g){if(m){m="";l=-1;continue}return e}if(1===g)return Ba(e[0],c,d)}}a:{a=e;e=this.resolution;m=f;b=a.length;f=[];g=D();for(let n=0,t,p,
r,v;n<e;n++)for(k=0;k<b;k++)if(r=a[k],n<r.length&&(t=r[n]))for(l=0;l<t.length;l++)p=t[l],(h=g[p])?g[p]++:(h=0,g[p]=1),v=f[h]||(f[h]=[]),v.push(p);if(a=f.length)if(m){if(1<f.length)b:for(a=[],e=D(),m=f.length,h=m-1;0<=h;h--)for(m=f[h],g=m.length,k=0;k<g;k++){if(b=m[k],!e[b])if(e[b]=1,d)d--;else if(a.push(b),a.length===c)break b}else a=(f=f[0]).length>c||d?f.slice(d,c+d):f;f=a}else{if(a<b){e=[];break a}f=f[a-1];if(c||d)if(f.length>c||d)f=f.slice(d,c+d)}e=f}return e};
function X(a,c,b,e){return(a=Y(this,a,c))&&a.length?Ba(a,b,e):[]}function Ca(a,c,b,e){let d=[];if(a){e=Math.min(a.length,e);for(let g=0,f;g<e;g++)(f=a[g])&&f&&(d[g]=f);if(d.length){c.push(d);return}}return!b&&d}function Y(a,c,b){let e;b&&(e=a.bidirectional&&c>b);a=b?(a=a.ctx.get(e?c:b))&&a.get(e?b:c):a.map.get(c);return a};T.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 g=d.indexOf(a);g===b.length-1?d.pop():d.splice(g,1)}}else Z(this.map,a),this.depth&&Z(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function Z(a,c){let b=0;if(a.constructor===Array)for(let e=0,d,g;e<a.length;e++){if((d=a[e])&&d.length)if(g=d.indexOf(c),0<=g){1<d.length?(d.splice(g,1),b++):delete a[e];break}else b++}else for(let e of a){const d=e[0],g=Z(e[1],c);g?b+=g:a.delete(d)}return b};function T(a,c){if(this.constructor!==T)return new T(a);if(a){var b=E(a)?a:a.preset;b&&(a=Object.assign({},Aa[b],a))}else a={};b=a.context||{};const e=E(a.encoder)?za[a.encoder]:a.encode||a.encoder||sa;this.encoder=e.encode?e:"object"===typeof e?new K(e):{encode:e};let d;this.resolution=a.resolution||9;this.tokenize=d=a.tokenize||"strict";this.depth="strict"===d&&b.depth||0;this.bidirectional=!1!==b.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;d=!1;this.map=new Map;this.ctx=
new Map;this.reg=c||(this.fastupdate?new Map:new Set);this.P=b.resolution||1;this.rtl=e.rtl||a.rtl||!1;this.cache=(d=a.cache||null)&&new S(d)}x=T.prototype;x.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};x.append=function(a,c){return this.add(a,c,!0)};x.contain=function(a){return this.reg.has(a)};x.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 Da(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=Da(b[1]);d?c+=d:a.delete(e)}return c}x.cleanup=function(){if(!this.fastupdate)return this;Da(this.map);this.depth&&Da(this.ctx);return this};x.searchCache=ra;
x.export=function(a,c,b,e=0){let d,g;switch(e){case 0:d="reg";g=ka(this.reg);break;case 1:d="cfg";g={};break;case 2:d="map";g=N(this.map);break;case 3:d="ctx";g=ja(this.ctx);break;default:return}return la.call(this,a,c,d,b,e,g)};x.import=function(a,c){if(c)switch(E(c)&&(c=JSON.parse(c)),a){case "reg":this.fastupdate=!1;this.reg=new Set(c);break;case "map":this.map=new Map(c);break;case "ctx":this.ctx=new Map(c)}};
x.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 g=d[0],f=d[1],h="";for(let m=0,n;m<f.length;m++){n=f[m]||[""];var k="";for(var l=0;l<n.length;l++)k+=(k?",":"")+("string"===b?'"'+n[l]+'"':n[l]);k="["+k+"]";h+=(h?",":"")+k}h='["'+g+'",['+h+"]]";e+=(e?",":"")+h}e="index.map=new Map(["+e+"]);";d="";for(const m of this.ctx.entries()){g=
m[0];f=m[1];for(const n of f.entries()){f=n[0];h=n[1];k="";for(let t=0,p;t<h.length;t++){p=h[t]||[""];l="";for(let r=0;r<p.length;r++)l+=(l?",":"")+("string"===b?'"'+p[r]+'"':p[r]);l="["+l+"]";k+=(k?",":"")+l}k='new Map([["'+f+'",['+k+"]]])";k='["'+g+'",'+k+"]";d+=(d?",":"")+k}}d="index.ctx=new Map(["+d+"]);";return a?"function inject(index){"+c+e+d+"}":c+e+d};ia(S.prototype);export default {Index:S,Charset:xa,Encoder:L,Document:N,Worker:null,Resolver:null,IndexedDB:null,Language:{}};
export const Index=S;export const Charset=xa;export const Encoder=L;export const Document=N;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};
m[0];f=m[1];for(const n of f.entries()){f=n[0];h=n[1];k="";for(let t=0,p;t<h.length;t++){p=h[t]||[""];l="";for(let r=0;r<p.length;r++)l+=(l?",":"")+("string"===b?'"'+p[r]+'"':p[r]);l="["+l+"]";k+=(k?",":"")+l}k='new Map([["'+f+'",['+k+"]]])";k='["'+g+'",'+k+"]";d+=(d?",":"")+k}}d="index.ctx=new Map(["+d+"]);";return a?"function inject(index){"+c+e+d+"}":c+e+d};ia(T.prototype);export default {Index:T,Charset:za,Encoder:K,Document:O,Worker:null,Resolver:null,IndexedDB:null,Language:{}};
export const Index=T;export const Charset=za;export const Encoder=K;export const Document=O;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

@@ -5,130 +5,129 @@
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
(function _f(self){'use strict';if(typeof module!=='undefined')self=module;else if(typeof process !== 'undefined')self=process;self._factory=_f;var u;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}function y(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];if(b)return b.call(a);if("number"==typeof a.length)return{next:aa(a)};throw Error(String(a)+" is not an iterable or ArrayLike");}var ba="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};
(function _f(self){'use strict';if(typeof module!=='undefined')self=module;else if(typeof process !== 'undefined')self=process;self._factory=_f;var u;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}function x(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];if(b)return b.call(a);if("number"==typeof a.length)return{next:aa(a)};throw Error(String(a)+" is not an iterable or ArrayLike");}var ba="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};
function ca(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");}var C=ca(this);function E(a,b){if(b)a:{var c=C;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];if(!(e in c))break a;c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&ba(c,a,{configurable:!0,writable:!0,value:b})}}var da;
if("function"==typeof Object.setPrototypeOf)da=Object.setPrototypeOf;else{var ea;a:{var fa={a:!0},ha={};try{ha.__proto__=fa;ea=ha.a;break a}catch(a){}ea=!1}da=ea?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var ia=da;function ja(){this.C=!1;this.A=null;this.F=void 0;this.h=1;this.L=0;this.B=null}function ka(a){if(a.C)throw new TypeError("Generator is already running");a.C=!0}ja.prototype.G=function(a){this.F=a};
function la(a,b){a.B={ma:b,oa:!0};a.h=a.L}ja.prototype.return=function(a){this.B={return:a};this.h=this.L};function G(a,b,c){a.h=c;return{value:b}}function ma(a){this.h=new ja;this.A=a}function na(a,b){ka(a.h);var c=a.h.A;if(c)return oa(a,"return"in c?c["return"]:function(d){return{value:d,done:!0}},b,a.h.return);a.h.return(b);return H(a)}
function oa(a,b,c,d){try{var e=b.call(a.h.A,c);if(!(e instanceof Object))throw new TypeError("Iterator result "+e+" is not an object");if(!e.done)return a.h.C=!1,e;var h=e.value}catch(f){return a.h.A=null,la(a.h,f),H(a)}a.h.A=null;d.call(a.h,h);return H(a)}function H(a){for(;a.h.h;)try{var b=a.A(a.h);if(b)return a.h.C=!1,{value:b.value,done:!1}}catch(c){a.h.F=void 0,la(a.h,c)}a.h.C=!1;if(a.h.B){b=a.h.B;a.h.B=null;if(b.oa)throw b.ma;return{value:b.return,done:!0}}return{value:void 0,done:!0}}
function pa(a){this.next=function(b){ka(a.h);a.h.A?b=oa(a,a.h.A.next,b,a.h.G):(a.h.G(b),b=H(a));return b};this.throw=function(b){ka(a.h);a.h.A?b=oa(a,a.h.A["throw"],b,a.h.G):(la(a.h,b),b=H(a));return b};this.return=function(b){return na(a,b)};this[Symbol.iterator]=function(){return this}}function qa(a,b){b=new pa(new ma(b));ia&&a.prototype&&ia(b,a.prototype);return b}
function ra(a){function b(d){return a.next(d)}function c(d){return a.throw(d)}return new Promise(function(d,e){function h(f){f.done?d(f.value):Promise.resolve(f.value).then(b,c).then(h,e)}h(a.next())})}function I(a){return ra(new pa(new ma(a)))}
function la(a,b){a.B={ma:b,oa:!0};a.h=a.L}ja.prototype.return=function(a){this.B={return:a};this.h=this.L};function G(a,b,c){a.h=c;return{value:b}}function ma(a){this.h=new ja;this.A=a}function na(a,b){ka(a.h);var c=a.h.A;if(c)return oa(a,"return"in c?c["return"]:function(d){return{value:d,done:!0}},b,a.h.return);a.h.return(b);return pa(a)}
function oa(a,b,c,d){try{var e=b.call(a.h.A,c);if(!(e instanceof Object))throw new TypeError("Iterator result "+e+" is not an object");if(!e.done)return a.h.C=!1,e;var h=e.value}catch(f){return a.h.A=null,la(a.h,f),pa(a)}a.h.A=null;d.call(a.h,h);return pa(a)}function pa(a){for(;a.h.h;)try{var b=a.A(a.h);if(b)return a.h.C=!1,{value:b.value,done:!1}}catch(c){a.h.F=void 0,la(a.h,c)}a.h.C=!1;if(a.h.B){b=a.h.B;a.h.B=null;if(b.oa)throw b.ma;return{value:b.return,done:!0}}return{value:void 0,done:!0}}
function qa(a){this.next=function(b){ka(a.h);a.h.A?b=oa(a,a.h.A.next,b,a.h.G):(a.h.G(b),b=pa(a));return b};this.throw=function(b){ka(a.h);a.h.A?b=oa(a,a.h.A["throw"],b,a.h.G):(la(a.h,b),b=pa(a));return b};this.return=function(b){return na(a,b)};this[Symbol.iterator]=function(){return this}}function ra(a,b){b=new qa(new ma(b));ia&&a.prototype&&ia(b,a.prototype);return b}
function sa(a){function b(d){return a.next(d)}function c(d){return a.throw(d)}return new Promise(function(d,e){function h(f){f.done?d(f.value):Promise.resolve(f.value).then(b,c).then(h,e)}h(a.next())})}function ta(a){return sa(new qa(new ma(a)))}
E("Symbol",function(a){function b(h){if(this instanceof b)throw new TypeError("Symbol is not a constructor");return new c(d+(h||"")+"_"+e++,h)}function c(h,f){this.h=h;ba(this,"description",{configurable:!0,writable:!0,value:f})}if(a)return a;c.prototype.toString=function(){return this.h};var d="jscomp_symbol_"+(1E9*Math.random()>>>0)+"_",e=0;return b});
E("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),c=0;c<b.length;c++){var d=C[b[c]];"function"===typeof d&&"function"!=typeof d.prototype[a]&&ba(d.prototype,a,{configurable:!0,writable:!0,value:function(){return sa(aa(this))}})}return a});function sa(a){a={next:a};a[Symbol.iterator]=function(){return this};return a}
E("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),c=0;c<b.length;c++){var d=C[b[c]];"function"===typeof d&&"function"!=typeof d.prototype[a]&&ba(d.prototype,a,{configurable:!0,writable:!0,value:function(){return ua(aa(this))}})}return a});function ua(a){a={next:a};a[Symbol.iterator]=function(){return this};return a}
E("Promise",function(a){function b(f){this.A=0;this.B=void 0;this.h=[];this.L=!1;var g=this.C();try{f(g.resolve,g.reject)}catch(k){g.reject(k)}}function c(){this.h=null}function d(f){return f instanceof b?f:new b(function(g){g(f)})}if(a)return a;c.prototype.A=function(f){if(null==this.h){this.h=[];var g=this;this.B(function(){g.F()})}this.h.push(f)};var e=C.setTimeout;c.prototype.B=function(f){e(f,0)};c.prototype.F=function(){for(;this.h&&this.h.length;){var f=this.h;this.h=[];for(var g=0;g<f.length;++g){var k=
f[g];f[g]=null;try{k()}catch(l){this.C(l)}}}this.h=null};c.prototype.C=function(f){this.B(function(){throw f;})};b.prototype.C=function(){function f(l){return function(m){k||(k=!0,l.call(g,m))}}var g=this,k=!1;return{resolve:f(this.ha),reject:f(this.F)}};b.prototype.ha=function(f){if(f===this)this.F(new TypeError("A Promise cannot resolve to itself"));else if(f instanceof b)this.ja(f);else{a:switch(typeof f){case "object":var g=null!=f;break a;case "function":g=!0;break a;default:g=!1}g?this.ga(f):
this.G(f)}};b.prototype.ga=function(f){var g=void 0;try{g=f.then}catch(k){this.F(k);return}"function"==typeof g?this.ka(g,f):this.G(f)};b.prototype.F=function(f){this.ca(2,f)};b.prototype.G=function(f){this.ca(1,f)};b.prototype.ca=function(f,g){if(0!=this.A)throw Error("Cannot settle("+f+", "+g+"): Promise already settled in state"+this.A);this.A=f;this.B=g;2===this.A&&this.ia();this.ea()};b.prototype.ia=function(){var f=this;e(function(){if(f.fa()){var g=C.console;"undefined"!==typeof g&&g.error(f.B)}},
1)};b.prototype.fa=function(){if(this.L)return!1;var f=C.CustomEvent,g=C.Event,k=C.dispatchEvent;if("undefined"===typeof k)return!0;"function"===typeof f?f=new f("unhandledrejection",{cancelable:!0}):"function"===typeof g?f=new g("unhandledrejection",{cancelable:!0}):(f=C.document.createEvent("CustomEvent"),f.initCustomEvent("unhandledrejection",!1,!0,f));f.promise=this;f.reason=this.B;return k(f)};b.prototype.ea=function(){if(null!=this.h){for(var f=0;f<this.h.length;++f)h.A(this.h[f]);this.h=null}};
var h=new c;b.prototype.ja=function(f){var g=this.C();f.V(g.resolve,g.reject)};b.prototype.ka=function(f,g){var k=this.C();try{f.call(g,k.resolve,k.reject)}catch(l){k.reject(l)}};b.prototype.then=function(f,g){function k(p,q){return"function"==typeof p?function(r){try{l(p(r))}catch(v){m(v)}}:q}var l,m,n=new b(function(p,q){l=p;m=q});this.V(k(f,l),k(g,m));return n};b.prototype.catch=function(f){return this.then(void 0,f)};b.prototype.V=function(f,g){function k(){switch(l.A){case 1:f(l.B);break;case 2:g(l.B);
break;default:throw Error("Unexpected state: "+l.A);}}var l=this;null==this.h?h.A(k):this.h.push(k);this.L=!0};b.resolve=d;b.reject=function(f){return new b(function(g,k){k(f)})};b.race=function(f){return new b(function(g,k){for(var l=y(f),m=l.next();!m.done;m=l.next())d(m.value).V(g,k)})};b.all=function(f){var g=y(f),k=g.next();return k.done?d([]):new b(function(l,m){function n(r){return function(v){p[r]=v;q--;0==q&&l(p)}}var p=[],q=0;do p.push(void 0),q++,d(k.value).V(n(p.length-1),m),k=g.next();
while(!k.done)})};return b});function ta(a,b){a instanceof String&&(a+="");var c=0,d=!1,e={next:function(){if(!d&&c<a.length){var h=c++;return{value:b(h,a[h]),done:!1}}d=!0;return{done:!0,value:void 0}}};e[Symbol.iterator]=function(){return e};return e}E("Array.prototype.values",function(a){return a?a:function(){return ta(this,function(b,c){return c})}});function J(a,b){return Object.prototype.hasOwnProperty.call(a,b)}
E("WeakMap",function(a){function b(k){this.h=(g+=Math.random()+1).toString();if(k){k=y(k);for(var l;!(l=k.next()).done;)l=l.value,this.set(l[0],l[1])}}function c(){}function d(k){var l=typeof k;return"object"===l&&null!==k||"function"===l}function e(k){if(!J(k,f)){var l=new c;ba(k,f,{value:l})}}function h(k){var l=Object[k];l&&(Object[k]=function(m){if(m instanceof c)return m;Object.isExtensible(m)&&e(m);return l(m)})}if(function(){if(!a||!Object.seal)return!1;try{var k=Object.seal({}),l=Object.seal({}),
m=new a([[k,2],[l,3]]);if(2!=m.get(k)||3!=m.get(l))return!1;m.delete(k);m.set(l,4);return!m.has(k)&&4==m.get(l)}catch(n){return!1}}())return a;var f="$jscomp_hidden_"+Math.random();h("freeze");h("preventExtensions");h("seal");var g=0;b.prototype.set=function(k,l){if(!d(k))throw Error("Invalid WeakMap key");e(k);if(!J(k,f))throw Error("WeakMap key fail: "+k);k[f][this.h]=l;return this};b.prototype.get=function(k){return d(k)&&J(k,f)?k[f][this.h]:void 0};b.prototype.has=function(k){return d(k)&&J(k,
f)&&J(k[f],this.h)};b.prototype.delete=function(k){return d(k)&&J(k,f)&&J(k[f],this.h)?delete k[f][this.h]:!1};return b});
E("Map",function(a){function b(){var g={};return g.K=g.next=g.head=g}function c(g,k){var l=g[1];return sa(function(){if(l){for(;l.head!=g[1];)l=l.K;for(;l.next!=l.head;)return l=l.next,{done:!1,value:k(l)};l=null}return{done:!0,value:void 0}})}function d(g,k){var l=k&&typeof k;"object"==l||"function"==l?h.has(k)?l=h.get(k):(l=""+ ++f,h.set(k,l)):l="p_"+k;var m=g[0][l];if(m&&J(g[0],l))for(g=0;g<m.length;g++){var n=m[g];if(k!==k&&n.key!==n.key||k===n.key)return{id:l,list:m,index:g,D:n}}return{id:l,
list:m,index:-1,D:void 0}}function e(g){this[0]={};this[1]=b();this.size=0;if(g){g=y(g);for(var k;!(k=g.next()).done;)k=k.value,this.set(k[0],k[1])}}if(function(){if(!a||"function"!=typeof a||!a.prototype.entries||"function"!=typeof Object.seal)return!1;try{var g=Object.seal({x:4}),k=new a(y([[g,"s"]]));if("s"!=k.get(g)||1!=k.size||k.get({x:4})||k.set({x:4},"t")!=k||2!=k.size)return!1;var l=k.entries(),m=l.next();if(m.done||m.value[0]!=g||"s"!=m.value[1])return!1;m=l.next();return m.done||4!=m.value[0].x||
break;default:throw Error("Unexpected state: "+l.A);}}var l=this;null==this.h?h.A(k):this.h.push(k);this.L=!0};b.resolve=d;b.reject=function(f){return new b(function(g,k){k(f)})};b.race=function(f){return new b(function(g,k){for(var l=x(f),m=l.next();!m.done;m=l.next())d(m.value).V(g,k)})};b.all=function(f){var g=x(f),k=g.next();return k.done?d([]):new b(function(l,m){function n(r){return function(v){p[r]=v;q--;0==q&&l(p)}}var p=[],q=0;do p.push(void 0),q++,d(k.value).V(n(p.length-1),m),k=g.next();
while(!k.done)})};return b});function va(a,b){a instanceof String&&(a+="");var c=0,d=!1,e={next:function(){if(!d&&c<a.length){var h=c++;return{value:b(h,a[h]),done:!1}}d=!0;return{done:!0,value:void 0}}};e[Symbol.iterator]=function(){return e};return e}E("Array.prototype.values",function(a){return a?a:function(){return va(this,function(b,c){return c})}});function H(a,b){return Object.prototype.hasOwnProperty.call(a,b)}
E("WeakMap",function(a){function b(k){this.h=(g+=Math.random()+1).toString();if(k){k=x(k);for(var l;!(l=k.next()).done;)l=l.value,this.set(l[0],l[1])}}function c(){}function d(k){var l=typeof k;return"object"===l&&null!==k||"function"===l}function e(k){if(!H(k,f)){var l=new c;ba(k,f,{value:l})}}function h(k){var l=Object[k];l&&(Object[k]=function(m){if(m instanceof c)return m;Object.isExtensible(m)&&e(m);return l(m)})}if(function(){if(!a||!Object.seal)return!1;try{var k=Object.seal({}),l=Object.seal({}),
m=new a([[k,2],[l,3]]);if(2!=m.get(k)||3!=m.get(l))return!1;m.delete(k);m.set(l,4);return!m.has(k)&&4==m.get(l)}catch(n){return!1}}())return a;var f="$jscomp_hidden_"+Math.random();h("freeze");h("preventExtensions");h("seal");var g=0;b.prototype.set=function(k,l){if(!d(k))throw Error("Invalid WeakMap key");e(k);if(!H(k,f))throw Error("WeakMap key fail: "+k);k[f][this.h]=l;return this};b.prototype.get=function(k){return d(k)&&H(k,f)?k[f][this.h]:void 0};b.prototype.has=function(k){return d(k)&&H(k,
f)&&H(k[f],this.h)};b.prototype.delete=function(k){return d(k)&&H(k,f)&&H(k[f],this.h)?delete k[f][this.h]:!1};return b});
E("Map",function(a){function b(){var g={};return g.K=g.next=g.head=g}function c(g,k){var l=g[1];return ua(function(){if(l){for(;l.head!=g[1];)l=l.K;for(;l.next!=l.head;)return l=l.next,{done:!1,value:k(l)};l=null}return{done:!0,value:void 0}})}function d(g,k){var l=k&&typeof k;"object"==l||"function"==l?h.has(k)?l=h.get(k):(l=""+ ++f,h.set(k,l)):l="p_"+k;var m=g[0][l];if(m&&H(g[0],l))for(g=0;g<m.length;g++){var n=m[g];if(k!==k&&n.key!==n.key||k===n.key)return{id:l,list:m,index:g,D:n}}return{id:l,
list:m,index:-1,D:void 0}}function e(g){this[0]={};this[1]=b();this.size=0;if(g){g=x(g);for(var k;!(k=g.next()).done;)k=k.value,this.set(k[0],k[1])}}if(function(){if(!a||"function"!=typeof a||!a.prototype.entries||"function"!=typeof Object.seal)return!1;try{var g=Object.seal({x:4}),k=new a(x([[g,"s"]]));if("s"!=k.get(g)||1!=k.size||k.get({x:4})||k.set({x:4},"t")!=k||2!=k.size)return!1;var l=k.entries(),m=l.next();if(m.done||m.value[0]!=g||"s"!=m.value[1])return!1;m=l.next();return m.done||4!=m.value[0].x||
"t"!=m.value[1]||!l.next().done?!1:!0}catch(n){return!1}}())return a;var h=new WeakMap;e.prototype.set=function(g,k){g=0===g?0:g;var l=d(this,g);l.list||(l.list=this[0][l.id]=[]);l.D?l.D.value=k:(l.D={next:this[1],K:this[1].K,head:this[1],key:g,value:k},l.list.push(l.D),this[1].K.next=l.D,this[1].K=l.D,this.size++);return this};e.prototype.delete=function(g){g=d(this,g);return g.D&&g.list?(g.list.splice(g.index,1),g.list.length||delete this[0][g.id],g.D.K.next=g.D.next,g.D.next.K=g.D.K,g.D.head=null,
this.size--,!0):!1};e.prototype.clear=function(){this[0]={};this[1]=this[1].K=b();this.size=0};e.prototype.has=function(g){return!!d(this,g).D};e.prototype.get=function(g){return(g=d(this,g).D)&&g.value};e.prototype.entries=function(){return c(this,function(g){return[g.key,g.value]})};e.prototype.keys=function(){return c(this,function(g){return g.key})};e.prototype.values=function(){return c(this,function(g){return g.value})};e.prototype.forEach=function(g,k){for(var l=this.entries(),m;!(m=l.next()).done;)m=
m.value,g.call(k,m[1],m[0],this)};e.prototype[Symbol.iterator]=e.prototype.entries;var f=0;return e});E("Array.prototype.keys",function(a){return a?a:function(){return ta(this,function(b){return b})}});
E("Set",function(a){function b(c){this.h=new Map;if(c){c=y(c);for(var d;!(d=c.next()).done;)this.add(d.value)}this.size=this.h.size}if(function(){if(!a||"function"!=typeof a||!a.prototype.entries||"function"!=typeof Object.seal)return!1;try{var c=Object.seal({x:4}),d=new a(y([c]));if(!d.has(c)||1!=d.size||d.add(c)!=d||1!=d.size||d.add({x:4})!=d||2!=d.size)return!1;var e=d.entries(),h=e.next();if(h.done||h.value[0]!=c||h.value[1]!=c)return!1;h=e.next();return h.done||h.value[0]==c||4!=h.value[0].x||
m.value,g.call(k,m[1],m[0],this)};e.prototype[Symbol.iterator]=e.prototype.entries;var f=0;return e});E("Array.prototype.keys",function(a){return a?a:function(){return va(this,function(b){return b})}});
E("Set",function(a){function b(c){this.h=new Map;if(c){c=x(c);for(var d;!(d=c.next()).done;)this.add(d.value)}this.size=this.h.size}if(function(){if(!a||"function"!=typeof a||!a.prototype.entries||"function"!=typeof Object.seal)return!1;try{var c=Object.seal({x:4}),d=new a(x([c]));if(!d.has(c)||1!=d.size||d.add(c)!=d||1!=d.size||d.add({x:4})!=d||2!=d.size)return!1;var e=d.entries(),h=e.next();if(h.done||h.value[0]!=c||h.value[1]!=c)return!1;h=e.next();return h.done||h.value[0]==c||4!=h.value[0].x||
h.value[1]!=h.value[0]?!1:e.next().done}catch(f){return!1}}())return a;b.prototype.add=function(c){c=0===c?0:c;this.h.set(c,c);this.size=this.h.size;return this};b.prototype.delete=function(c){c=this.h.delete(c);this.size=this.h.size;return c};b.prototype.clear=function(){this.h.clear();this.size=0};b.prototype.has=function(c){return this.h.has(c)};b.prototype.entries=function(){return this.h.entries()};b.prototype.values=function(){return this.h.values()};b.prototype.keys=b.prototype.values;b.prototype[Symbol.iterator]=
b.prototype.values;b.prototype.forEach=function(c,d){var e=this;this.h.forEach(function(h){return c.call(d,h,h,e)})};return b});E("Array.prototype.entries",function(a){return a?a:function(){return ta(this,function(b,c){return[b,c]})}});E("Object.is",function(a){return a?a:function(b,c){return b===c?0!==b||1/b===1/c:b!==b&&c!==c}});
b.prototype.values;b.prototype.forEach=function(c,d){var e=this;this.h.forEach(function(h){return c.call(d,h,h,e)})};return b});E("Array.prototype.entries",function(a){return a?a:function(){return va(this,function(b,c){return[b,c]})}});E("Object.is",function(a){return a?a:function(b,c){return b===c?0!==b||1/b===1/c:b!==b&&c!==c}});
E("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 h=d[c];if(h===b||Object.is(h,b))return!0}return!1}});
E("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)}});var ua="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)J(d,e)&&(a[e]=d[e])}return a};
E("Object.assign",function(a){return a||ua});E("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}});function L(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(h){return a(c(h))};b=a.constructor;if(b===c.constructor){if(b===Array)return c.concat(a);if(b===Map){b=new Map(c);d=y(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=y(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 M(){return Object.create(null)}function va(a,b){return b.length-a.length}function N(a){return"string"===typeof a}function O(a){return"object"===typeof a}function wa(a){var b=[];a=y(a.keys());for(var c=a.next();!c.done;c=a.next())b.push(c.value);return b}function xa(a,b){if(N(b))a=a[b];else for(var c=0;a&&c<b.length;c++)a=a[b[c]];return a}function ya(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 za=[["\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",
E("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)}});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)H(d,e)&&(a[e]=d[e])}return a};
E("Object.assign",function(a){return a||wa});E("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}});function I(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(h){return a(c(h))};b=a.constructor;if(b===c.constructor){if(b===Array)return c.concat(a);if(b===Map){b=new Map(c);d=x(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=x(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 J(){return Object.create(null)}function xa(a,b){return b.length-a.length}function K(a){return"string"===typeof a}function M(a){return"object"===typeof a}function ya(a){var b=[];a=x(a.keys());for(var c=a.next();!c.done;c=a.next())b.push(c.value);return b}function za(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 Aa(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 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",
"u"],["\u0217","u"],["\u0219","s"],["\u021b","t"],["\u021f","h"],["\u0227","a"],["\u0229","e"],["\u022b","o"],["\u022d","o"],["\u022f","o"],["\u0231","o"],["\u0233","y"],["\u02b0","h"],["\u02b1","h"],["\u0266","h"],["\u02b2","j"],["\u02b3","r"],["\u02b4","\u0279"],["\u02b5","\u027b"],["\u02b6","\u0281"],["\u02b7","w"],["\u02b8","y"],["\u02e0","\u0263"],["\u02e1","l"],["\u02e2","s"],["\u02e3","x"],["\u02e4","\u0295"],["\u0390","\u03b9"],["\u03ac","\u03b1"],["\u03ad","\u03b5"],["\u03ae","\u03b7"],["\u03af",
"\u03b9"],["\u03b0","\u03c5"],["\u03ca","\u03b9"],["\u03cb","\u03c5"],["\u03cc","\u03bf"],["\u03cd","\u03c5"],["\u03ce","\u03c9"],["\u03d0","\u03b2"],["\u03d1","\u03b8"],["\u03d2","\u03a5"],["\u03d3","\u03a5"],["\u03d4","\u03a5"],["\u03d5","\u03c6"],["\u03d6","\u03c0"],["\u03f0","\u03ba"],["\u03f1","\u03c1"],["\u03f2","\u03c2"],["\u03f5","\u03b5"],["\u0439","\u0438"],["\u0450","\u0435"],["\u0451","\u0435"],["\u0453","\u0433"],["\u0457","\u0456"],["\u045c","\u043a"],["\u045d","\u0438"],["\u045e","\u0443"],
["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]];var Aa=/[^\p{L}\p{N}]+/u,Ba=/(\d{3})/g,Ca=/(\D)(\d{3})/g,Ea=/(\d{3})(\D)/g,Fa="".normalize&&/[\u0300-\u036f]/g;function Ga(a){if(!this){var b=Function.prototype.bind,c=b.apply,d=[null],e=d.concat;if(arguments instanceof Array)var h=arguments;else{h=y(arguments);for(var f,g=[];!(f=h.next()).done;)g.push(f.value);h=g}return new (c.call(b,Ga,e.call(d,h)))}for(b=0;b<arguments.length;b++)this.assign(arguments[b])}
Ga.prototype.assign=function(a){this.normalize=L(a.normalize,!0,this.normalize);var b=a.include,c=b||a.exclude||a.split;if("object"===typeof c){var d=!b,e="";a.include||(e+="\\p{Z}");c.letter&&(e+="\\p{L}");c.number&&(e+="\\p{N}",d=!!b);c.symbol&&(e+="\\p{S}");c.punctuation&&(e+="\\p{P}");c.control&&(e+="\\p{C}");if(c=c.char)e+="object"===typeof c?c.join(""):c;try{this.split=new RegExp("["+(b?"^":"")+e+"]+","u")}catch(h){this.split=/\s+/}this.numeric=d}else{try{this.split=L(c,Aa,this.split)}catch(h){this.split=
/\s+/}this.numeric=L(this.numeric,!0)}this.prepare=L(a.prepare,null,this.prepare);this.finalize=L(a.finalize,null,this.finalize);Fa||(this.mapper=new Map(za));this.rtl=a.rtl||!1;this.dedupe=L(a.dedupe,!0,this.dedupe);this.filter=L((c=a.filter)&&new Set(c),null,this.filter);this.matcher=L((c=a.matcher)&&new Map(c),null,this.matcher);this.mapper=L((c=a.mapper)&&new Map(c),null,this.mapper);this.stemmer=L((c=a.stemmer)&&new Map(c),null,this.stemmer);this.replacer=L(a.replacer,null,this.replacer);this.minlength=
L(a.minlength,1,this.minlength);this.maxlength=L(a.maxlength,0,this.maxlength);if(this.cache=c=L(a.cache,!0,this.cache))this.U=null,this.L="number"===typeof c?c:2E5,this.N=new Map,this.S=new Map,this.A=this.h=128;this.B="";this.F=null;this.C="";this.G=null;if(this.matcher)for(a=y(this.matcher.keys()),b=a.next();!b.done;b=a.next())this.B+=(this.B?"|":"")+b.value;if(this.stemmer)for(a=y(this.stemmer.keys()),b=a.next();!b.done;b=a.next())this.C+=(this.C?"|":"")+b.value;return this};
Ga.prototype.encode=function(a){var b=this;if(this.cache&&a.length<=this.h)if(this.U){if(this.N.has(a))return this.N.get(a)}else this.U=setTimeout(Ha,50,this);this.normalize&&(a="function"===typeof this.normalize?this.normalize(a):Fa?a.normalize("NFKD").replace(Fa,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3<a.length&&(a=a.replace(Ca,"$1 $2").replace(Ea,"$1 $2").replace(Ba,"$1 "));for(var c=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||
this.replacer),d=[],e=this.split||""===this.split?a.split(this.split):a,h=0,f=void 0,g=void 0;h<e.length;h++)if((f=g=e[h])&&!(f.length<this.minlength))if(c)d.push(f);else if(!this.filter||!this.filter.has(f)){if(this.cache&&f.length<=this.A)if(this.U){var k=this.S.get(f);if(k||""===k){k&&d.push(k);continue}}else this.U=setTimeout(Ha,50,this);k=void 0;this.stemmer&&2<f.length&&(this.G||(this.G=new RegExp("(?!^)("+this.C+")$")),f=f.replace(this.G,function(q){return b.stemmer.get(q)}),k=1);f&&k&&(f.length<
["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]];var Ca=/[^\p{L}\p{N}]+/u,Da=/(\d{3})/g,Fa=/(\D)(\d{3})/g,Ga=/(\d{3})(\D)/g,Ha="".normalize&&/[\u0300-\u036f]/g;function N(a){if(this.constructor!==N){var b=Function.prototype.bind,c=b.apply,d=[null],e=d.concat;if(arguments instanceof Array)var h=arguments;else{h=x(arguments);for(var f,g=[];!(f=h.next()).done;)g.push(f.value);h=g}return new (c.call(b,N,e.call(d,h)))}for(b=0;b<arguments.length;b++)this.assign(arguments[b])}
N.prototype.assign=function(a){this.normalize=I(a.normalize,!0,this.normalize);var b=a.include,c=b||a.exclude||a.split;if("object"===typeof c){var d=!b,e="";a.include||(e+="\\p{Z}");c.letter&&(e+="\\p{L}");c.number&&(e+="\\p{N}",d=!!b);c.symbol&&(e+="\\p{S}");c.punctuation&&(e+="\\p{P}");c.control&&(e+="\\p{C}");if(c=c.char)e+="object"===typeof c?c.join(""):c;try{this.split=new RegExp("["+(b?"^":"")+e+"]+","u")}catch(h){this.split=/\s+/}this.numeric=d}else{try{this.split=I(c,Ca,this.split)}catch(h){this.split=
/\s+/}this.numeric=I(this.numeric,!0)}this.prepare=I(a.prepare,null,this.prepare);this.finalize=I(a.finalize,null,this.finalize);Ha||(this.mapper=new Map(Ba));this.rtl=a.rtl||!1;this.dedupe=I(a.dedupe,!0,this.dedupe);this.filter=I((c=a.filter)&&new Set(c),null,this.filter);this.matcher=I((c=a.matcher)&&new Map(c),null,this.matcher);this.mapper=I((c=a.mapper)&&new Map(c),null,this.mapper);this.stemmer=I((c=a.stemmer)&&new Map(c),null,this.stemmer);this.replacer=I(a.replacer,null,this.replacer);this.minlength=
I(a.minlength,1,this.minlength);this.maxlength=I(a.maxlength,0,this.maxlength);if(this.cache=c=I(a.cache,!0,this.cache))this.U=null,this.L="number"===typeof c?c:2E5,this.N=new Map,this.S=new Map,this.A=this.h=128;this.B="";this.F=null;this.C="";this.G=null;if(this.matcher)for(a=x(this.matcher.keys()),b=a.next();!b.done;b=a.next())this.B+=(this.B?"|":"")+b.value;if(this.stemmer)for(a=x(this.stemmer.keys()),b=a.next();!b.done;b=a.next())this.C+=(this.C?"|":"")+b.value;return this};
N.prototype.encode=function(a){var b=this;if(this.cache&&a.length<=this.h)if(this.U){if(this.N.has(a))return this.N.get(a)}else this.U=setTimeout(Ia,50,this);this.normalize&&(a="function"===typeof this.normalize?this.normalize(a):Ha?a.normalize("NFKD").replace(Ha,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3<a.length&&(a=a.replace(Fa,"$1 $2").replace(Ga,"$1 $2").replace(Da,"$1 "));for(var c=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||
this.replacer),d=[],e=this.split||""===this.split?a.split(this.split):a,h=0,f=void 0,g=void 0;h<e.length;h++)if((f=g=e[h])&&!(f.length<this.minlength))if(c)d.push(f);else if(!this.filter||!this.filter.has(f)){if(this.cache&&f.length<=this.A)if(this.U){var k=this.S.get(f);if(k||""===k){k&&d.push(k);continue}}else this.U=setTimeout(Ia,50,this);k=void 0;this.stemmer&&2<f.length&&(this.G||(this.G=new RegExp("(?!^)("+this.C+")$")),f=f.replace(this.G,function(q){return b.stemmer.get(q)}),k=1);f&&k&&(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.F||(this.F=new RegExp("("+this.B+")","g")),f=f.replace(this.F,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&&g.length<=this.A&&(this.S.set(g,f),this.S.size>this.L&&(this.S.clear(),this.A=this.A/1.1|0));f&&d.push(f)}this.finalize&&(d=this.finalize(d)||d);this.cache&&a.length<=this.h&&(this.N.set(a,d),this.N.size>this.L&&(this.N.clear(),this.h=this.h/1.1|0));return d};function Ha(a){a.U=null;a.N.clear();a.S.clear()};function Ia(a){var b,c,d,e,h,f,g,k;return I(function(l){a=a.data;b=self._index;c=a.args;d=a.task;switch(d){case "init":e=a.options||{};(h=e.config)&&(e=(await import(h))["default"]);(f=a.factory)?(Function("return "+f)()(self),self._index=new self.FlexSearch.Index(e),delete self.FlexSearch):self._index=new R(e);postMessage({id:a.id});break;default:g=a.id,k=b[d].apply(b,c),postMessage("search"===d?{id:g,msg:k}:{id:g})}l.h=0})};var Ja=0;
function Ka(a){function b(f){function g(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=M();if(this.worker){d?this.worker.on("message",g):this.worker.onmessage=g;if(a.config)return new Promise(function(k){e.h[++Ja]=function(){k(e)};e.worker.postMessage({id:Ja,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",factory:c,options:a});return this}}a=void 0===a?{}:a;if(!this)return new Ka(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,h=La(c,d,a.worker);return h.then?h.then(function(f){return b.call(e,f)}):b.call(this,h)}Ma("add");Ma("append");Ma("search");Ma("update");Ma("remove");
function Ma(a){Ka.prototype[a]=Ka.prototype[a+"Async"]=function(){var b=this,c=arguments,d,e,h,f,g;return I(function(k){d=b;e=[].slice.call(c);h=e[e.length-1];"function"===typeof h&&(f=h,e.splice(e.length-1,1));g=new Promise(function(l){d.h[++Ja]=l;d.worker.postMessage({task:a,id:Ja,args:e})});return f?(g.then(f),k.return(b)):k.return(g)})}}
function La(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(N(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 Na(a){Oa.call(a,"add");Oa.call(a,"append");Oa.call(a,"search");Oa.call(a,"update");Oa.call(a,"remove")}function Oa(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]}b=this[a].apply(this,b);d&&(b.then?b.then(d):d(b));return b}};function Pa(a,b,c,d,e,h,f,g){(d=a(c?c+"."+d:d,JSON.stringify(f)))&&d.then?d.then(function(){b.export(a,b,c,e,h+1,g)}):b.export(a,b,c,e,h+1,g)};function Qa(a,b,c,d){for(var e=[],h=0,f;h<a.index.length;h++)if(f=a.index[h],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}
this.replacer[k+1]);this.cache&&g.length<=this.A&&(this.S.set(g,f),this.S.size>this.L&&(this.S.clear(),this.A=this.A/1.1|0));f&&d.push(f)}this.finalize&&(d=this.finalize(d)||d);this.cache&&a.length<=this.h&&(this.N.set(a,d),this.N.size>this.L&&(this.N.clear(),this.h=this.h/1.1|0));return d};function Ia(a){a.U=null;a.N.clear();a.S.clear()};function Ja(a){var b,c,d,e,h,f,g,k;return ta(function(l){a=a.data;b=self._index;c=a.args;d=a.task;switch(d){case "init":e=a.options||{};(h=e.config)&&(e=(await import(h))["default"]);(f=a.factory)?(Function("return "+f)()(self),self._index=new self.FlexSearch.Index(e),delete self.FlexSearch):self._index=new O(e);postMessage({id:a.id});break;default:g=a.id,k=b[d].apply(b,c),postMessage("search"===d?{id:g,msg:k}:{id:g})}l.h=0})};var Ka=0;
function R(a){function b(f){function g(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",g):this.worker.onmessage=g;if(a.config)return new Promise(function(k){e.h[++Ka]=function(){k(e)};e.worker.postMessage({id:Ka,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",factory:c,options:a});return this}}a=void 0===a?{}:a;if(this.constructor!==R)return new R(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,h=La(c,d,a.worker);return h.then?h.then(function(f){return b.call(e,f)}):b.call(this,h)}Ma("add");Ma("append");Ma("search");Ma("update");Ma("remove");
function Ma(a){R.prototype[a]=R.prototype[a+"Async"]=function(){var b=this,c=arguments,d,e,h,f,g;return ta(function(k){d=b;e=[].slice.call(c);h=e[e.length-1];"function"===typeof h&&(f=h,e.splice(e.length-1,1));g=new Promise(function(l){d.h[++Ka]=l;d.worker.postMessage({task:a,id:Ka,args:e})});return f?(g.then(f),k.return(b)):k.return(g)})}}
function La(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="+Ja.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",
"module/worker/worker.js"),{type:"module"})};function Na(a){Oa.call(a,"add");Oa.call(a,"append");Oa.call(a,"search");Oa.call(a,"update");Oa.call(a,"remove")}function Oa(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]}b=this[a].apply(this,b);d&&(b.then?b.then(d):d(b));return b}};function Pa(a){var b=[];a=x(a.entries());for(var c=a.next();!c.done;c=a.next())b.push(c.value);return b}function Qa(a){var b=[];a=x(a.entries());for(var c=a.next();!c.done;c=a.next())b.push(Pa(c.value));return b}function Ra(a){var b=[];a=x(a.keys());for(var c=a.next();!c.done;c=a.next())b.push(c.value);return b}function Sa(a,b,c,d,e,h){if((c=a(b?b+"."+c:c,JSON.stringify(h)))&&c.then){var f=this;return c.then(function(){return f.export(a,b,d,e+1)})}return this.export(a,b,d,e+1)};function Ta(a,b,c,d){for(var e=[],h=0,f;h<a.index.length;h++)if(f=a.index[h],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 S(a){if(!this)return new S(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 h=0,f=0,g,k;f<b.index.length;f++){g=b.index[f];k=g.indexOf(e);if(0<=k)return h+k;h+=g.length}return-1};if("includes"===
d)return function(e){for(var h=0;h<b.index.length;h++)if(b.index[h].includes(e))return!0;return!1};if("slice"===d)return function(e,h){return Qa(b,e||0,h||b.length,!1)};if("splice"===d)return function(e,h){return Qa(b,e||0,h||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}})}S.prototype.clear=function(){this.index.length=0};
S.prototype.destroy=function(){this.proxy=this.index=null};S.prototype.push=function(){};function T(a){a=void 0===a?8:a;if(!this)return new T(a);this.index=M();this.B=[];this.size=0;32<a?(this.h=Ra,this.A=BigInt(a)):(this.h=Sa,this.A=a)}T.prototype.get=function(a){var b=this.h(a);return(b=this.index[b])&&b.get(a)};T.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 U(a){a=void 0===a?8:a;if(!this)return new U(a);this.index=M();this.h=[];32<a?(this.B=Ra,this.A=BigInt(a)):(this.B=Sa,this.A=a)}U.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=T.prototype;u.has=U.prototype.has=function(a){var b=this.B(a);return(b=this.index[b])&&b.has(a)};u.delete=U.prototype.delete=function(a){var b=this.B(a);(b=this.index[b])&&b.delete(a)&&this.size--};
u.clear=U.prototype.clear=function(){this.index=M();this.h=[];this.size=0};u.values=U.prototype.values=function Ta(){var b,c=this,d,e,h;return qa(Ta,function(f){switch(f.h){case 1:b=0;case 2:if(!(b<c.h.length)){f.h=0;break}d=y(c.h[b].values());e=d.next();case 5:if(e.done){b++;f.h=2;break}h=e.value;return G(f,h,6);case 6:e=d.next(),f.h=5}})};
u.keys=U.prototype.keys=function Ua(){var b,c=this,d,e,h;return qa(Ua,function(f){switch(f.h){case 1:b=0;case 2:if(!(b<c.h.length)){f.h=0;break}d=y(c.h[b].keys());e=d.next();case 5:if(e.done){b++;f.h=2;break}h=e.value;return G(f,h,6);case 6:e=d.next(),f.h=5}})};
u.entries=U.prototype.entries=function Va(){var b,c=this,d,e,h;return qa(Va,function(f){switch(f.h){case 1:b=0;case 2:if(!(b<c.h.length)){f.h=0;break}d=y(c.h[b].entries());e=d.next();case 5:if(e.done){b++;f.h=2;break}h=e.value;return G(f,h,6);case 6:e=d.next(),f.h=5}})};function Sa(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 Ra(){throw Error("The keystore is limited to 32 for EcmaScript5");};V.prototype.add=function(a,b,c){O(a)&&(b=a,a=xa(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.I[d];var h=this.index.get(this.field[d]);if("function"===typeof e)(e=e(b))&&h.add(a,e,!1,!0);else{var f=e.R;if(!f||f(b))e.constructor===String?e=[""+e]:N(e)&&(e=[e]),Wa(b,e,this.T,0,h,a,e[0],c)}}if(this.tag)for(d=0;d<this.M.length;d++){f=this.M[d];h=this.tag.get(this.$[d]);e=M();if("function"===typeof f){if(f=f(b),!f)continue}else{var g=
f.R;if(g&&!g(b))continue;f.constructor===String&&(f=""+f);f=xa(b,f)}if(h&&f){N(f)&&(f=[f]);g=0;for(var k,l=void 0;g<f.length;g++)if(k=f[g],!e[k]){e[k]=1;var m;(m=h.get(k))?l=m:h.set(k,l=[]);if(!c||!l.includes(a)){if(l.length===Math.pow(2,31)-1){m=new S(l);if(this.fastupdate)for(var n=y(this.reg.values()),p=n.next();!p.done;p=n.next())p=p.value,p.includes(l)&&(p[p.indexOf(l)]=m);h.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.H){var q=
M();for(c=0;c<this.H.length;c++)if(d=this.H[c],h=d.R,!h||h(b)){h=void 0;if("function"===typeof d){h=d(b);if(!h)continue;d=[d.la]}else if(N(d)||d.constructor===String){q[d]=b[d];continue}Xa(b,q,d,0,d[0],h)}}this.store.set(a,q||b)}}return this};function Xa(a,b,c,d,e,h){a=a[e];if(d===c.length-1)b[e]=h||a;else if(a)if(a.constructor===Array)for(b=b[e]=Array(a.length),e=0;e<a.length;e++)Xa(a,b,c,d,e);else b=b[e]||(b[e]=M()),e=c[++d],Xa(a,b,c,d,e)}
function Wa(a,b,c,d,e,h,f,g){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(h,a[b],!0,!0);return}a=a.join(" ")}e.add(h,a,g,!0)}else if(a.constructor===Array)for(f=0;f<a.length;f++)Wa(a,b,c,d,e,h,f,g);else f=b[++d],Wa(a,b,c,d,e,h,f,g);else e.db&&e.remove(h)};function Ya(a,b,c,d,e,h,f){var g=a.length,k=[],l;var m=M();for(var n=0,p=void 0,q;n<b;n++)for(var r=0;r<g;r++)if(q=a[r],n<q.length&&(p=q[n]))for(var v=0;v<p.length;v++){q=p[v];(l=m[q])?m[q]++:(l=0,m[q]=1);l=k[l]||(k[l]=[]);if(!f){var w=n+(r?0:h||0);l=l[w]||(l[w]=[])}l.push(q)}if(a=k.length)if(e)k=1<k.length?Za(k,d,c,f,0):(k=k[0]).length>c||d?k.slice(d,c+d):k;else{if(a<g)return[];k=k[a-1];if(c||d)if(f){if(k.length>c||d)k=k.slice(d,c+d)}else{e=[];for(f=0;f<k.length;f++)if(g=k[f],g.length>d)d-=g.length;
d)return function(e){for(var h=0;h<b.index.length;h++)if(b.index[h].includes(e))return!0;return!1};if("slice"===d)return function(e,h){return Ta(b,e||0,h||b.length,!1)};if("splice"===d)return function(e,h){return Ta(b,e||0,h||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}})}S.prototype.clear=function(){this.index.length=0};
S.prototype.destroy=function(){this.proxy=this.index=null};S.prototype.push=function(){};function T(a){a=void 0===a?8:a;if(!this)return new T(a);this.index=J();this.B=[];this.size=0;32<a?(this.h=Ua,this.A=BigInt(a)):(this.h=Va,this.A=a)}T.prototype.get=function(a){var b=this.h(a);return(b=this.index[b])&&b.get(a)};T.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 U(a){a=void 0===a?8:a;if(!this)return new U(a);this.index=J();this.h=[];32<a?(this.B=Ua,this.A=BigInt(a)):(this.B=Va,this.A=a)}U.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=T.prototype;u.has=U.prototype.has=function(a){var b=this.B(a);return(b=this.index[b])&&b.has(a)};u.delete=U.prototype.delete=function(a){var b=this.B(a);(b=this.index[b])&&b.delete(a)&&this.size--};
u.clear=U.prototype.clear=function(){this.index=J();this.h=[];this.size=0};u.values=U.prototype.values=function Wa(){var b,c=this,d,e,h;return ra(Wa,function(f){switch(f.h){case 1:b=0;case 2:if(!(b<c.h.length)){f.h=0;break}d=x(c.h[b].values());e=d.next();case 5:if(e.done){b++;f.h=2;break}h=e.value;return G(f,h,6);case 6:e=d.next(),f.h=5}})};
u.keys=U.prototype.keys=function Xa(){var b,c=this,d,e,h;return ra(Xa,function(f){switch(f.h){case 1:b=0;case 2:if(!(b<c.h.length)){f.h=0;break}d=x(c.h[b].keys());e=d.next();case 5:if(e.done){b++;f.h=2;break}h=e.value;return G(f,h,6);case 6:e=d.next(),f.h=5}})};
u.entries=U.prototype.entries=function Ya(){var b,c=this,d,e,h;return ra(Ya,function(f){switch(f.h){case 1:b=0;case 2:if(!(b<c.h.length)){f.h=0;break}d=x(c.h[b].entries());e=d.next();case 5:if(e.done){b++;f.h=2;break}h=e.value;return G(f,h,6);case 6:e=d.next(),f.h=5}})};function Va(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 Ua(){throw Error("The keystore is limited to 32 for EcmaScript5");};V.prototype.add=function(a,b,c){M(a)&&(b=a,a=za(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.I[d];var h=this.index.get(this.field[d]);if("function"===typeof e)(e=e(b))&&h.add(a,e,!1,!0);else{var f=e.R;if(!f||f(b))e.constructor===String?e=[""+e]:K(e)&&(e=[e]),Za(b,e,this.T,0,h,a,e[0],c)}}if(this.tag)for(d=0;d<this.M.length;d++){f=this.M[d];h=this.tag.get(this.$[d]);e=J();if("function"===typeof f){if(f=f(b),!f)continue}else{var g=
f.R;if(g&&!g(b))continue;f.constructor===String&&(f=""+f);f=za(b,f)}if(h&&f){K(f)&&(f=[f]);g=0;for(var k,l=void 0;g<f.length;g++)if(k=f[g],!e[k]){e[k]=1;var m;(m=h.get(k))?l=m:h.set(k,l=[]);if(!c||!l.includes(a)){if(l.length===Math.pow(2,31)-1){m=new S(l);if(this.fastupdate)for(var n=x(this.reg.values()),p=n.next();!p.done;p=n.next())p=p.value,p.includes(l)&&(p[p.indexOf(l)]=m);h.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.H){var q=
J();for(c=0;c<this.H.length;c++)if(d=this.H[c],h=d.R,!h||h(b)){h=void 0;if("function"===typeof d){h=d(b);if(!h)continue;d=[d.la]}else if(K(d)||d.constructor===String){q[d]=b[d];continue}$a(b,q,d,0,d[0],h)}}this.store.set(a,q||b)}}return this};function $a(a,b,c,d,e,h){a=a[e];if(d===c.length-1)b[e]=h||a;else if(a)if(a.constructor===Array)for(b=b[e]=Array(a.length),e=0;e<a.length;e++)$a(a,b,c,d,e);else b=b[e]||(b[e]=J()),e=c[++d],$a(a,b,c,d,e)}
function Za(a,b,c,d,e,h,f,g){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(h,a[b],!0,!0);return}a=a.join(" ")}e.add(h,a,g,!0)}else if(a.constructor===Array)for(f=0;f<a.length;f++)Za(a,b,c,d,e,h,f,g);else f=b[++d],Za(a,b,c,d,e,h,f,g);else e.db&&e.remove(h)};function ab(a,b,c,d,e,h,f){var g=a.length,k=[],l;var m=J();for(var n=0,p=void 0,q;n<b;n++)for(var r=0;r<g;r++)if(q=a[r],n<q.length&&(p=q[n]))for(var v=0;v<p.length;v++){q=p[v];(l=m[q])?m[q]++:(l=0,m[q]=1);l=k[l]||(k[l]=[]);if(!f){var w=n+(r?0:h||0);l=l[w]||(l[w]=[])}l.push(q)}if(a=k.length)if(e)k=1<k.length?bb(k,d,c,f,0):(k=k[0]).length>c||d?k.slice(d,c+d):k;else{if(a<g)return[];k=k[a-1];if(c||d)if(f){if(k.length>c||d)k=k.slice(d,c+d)}else{e=[];for(f=0;f<k.length;f++)if(g=k[f],g.length>d)d-=g.length;
else{if(g.length>c||d)g=g.slice(d,c+d),c-=g.length,d&&(d-=g.length);e.push(g);if(!c)break}k=1<e.length?[].concat.apply([],e):e[0]}}return k}
function Za(a,b,c,d,e){var h=[],f=M(),g=a.length,k=0;if(d)for(e=g-1;0<=e;e--){d=a[e];var l=d.length;for(g=0;g<l;g++){var m=d[g];if(!f[m])if(f[m]=1,b)b--;else if(h.push(m),h.length===c)return h}}else for(var n=ya(a),p=0;p<n;p++)for(var q=g-1;0<=q;q--)if(l=(d=a[q][p])&&d.length)for(var r=0;r<l;r++)if(m=d[r],!f[m])if(f[m]=1,b)b--;else{var v=p+(q<g-1?e||0:0);(h[v]||(h[v]=[])).push(m);if(++k===c)return h}return h}
function $a(a,b){for(var c=M(),d=[],e=0,h;e<b.length;e++){h=b[e];for(var f=0;f<h.length;f++)c[h[f]]=1}for(b=0;b<a.length;b++)e=a[b],1===c[e]&&(d.push(e),c[e]=2);return d};V.prototype.search=function(a,b,c,d){c||(!b&&O(a)?(c=a,a=""):O(b)&&(c=b,b=0));var e=[],h=[],f=0;if(c){c.constructor===Array&&(c={index:c});a=c.query||a;var g=c.pluck;var k=c.merge;var l=g||c.field||c.index;var m=this.tag&&c.tag;var n=this.store&&c.enrich;var p=c.suggest;var q=c.na;b=c.limit||b;var r=c.offset||0;b||(b=100);if(m&&(!this.db||!d)){m.constructor!==Array&&(m=[m]);for(var v=[],w=0,x=void 0;w<m.length;w++)if(x=m[w],x.field&&x.tag){var t=x.tag;if(t.constructor===Array)for(var z=0;z<t.length;z++)v.push(x.field,
t[z]);else v.push(x.field,t)}else{t=Object.keys(x);z=0;for(var A=void 0,B=void 0;z<t.length;z++)if(A=t[z],B=x[A],B.constructor===Array)for(var D=0;D<B.length;D++)v.push(A,B[D]);else v.push(A,B)}m=v;if(!a){h=[];if(v.length)for(g=0;g<v.length;g+=2){p=void 0;if(this.db){p=this.index.get(v[g]);if(!p)continue;h.push(p=p.db.tag(v[g+1],b,r,n))}else p=ab.call(this,v[g],v[g+1],b,r,n);e.push({field:v[g],tag:v[g+1],result:p})}return h.length?Promise.all(h).then(function(P){for(var Q=0;Q<P.length;Q++)e[Q].result=
P[Q];return e}):e}}N(l)&&(l=[l])}l||(l=this.field);v=!d&&(this.worker||this.db)&&[];w=0;for(z=x=t=void 0;w<l.length;w++)if(x=l[w],!this.db||!this.tag||this.I[w]){t=void 0;N(x)||(t=x,x=t.field,a=t.query||a,b=t.limit||b,r=t.offset||r,p=t.suggest||p,n=this.store&&(t.enrich||n));if(d)t=d[w];else{z=t||c;t=this.index.get(x);if(m){if(this.db){z.tag=m;var F=t.db.support_tag_search;z.field=l}F||(z.enrich=!1)}if(v){v[w]=t.search(a,b,z);z&&n&&(z.enrich=n);continue}else t=t.search(a,b,z),z&&n&&(z.enrich=n)}z=
t&&t.length;if(m&&z){A=[];B=0;if(this.db&&d){if(!F)for(D=l.length;D<d.length;D++){var K=d[D];if(K&&K.length)B++,A.push(K);else if(!p)return e}}else{D=0;for(var Hb=K=void 0;D<m.length;D+=2){K=this.tag.get(m[D]);if(!K)if(p)continue;else return e;if(Hb=(K=K&&K.get(m[D+1]))&&K.length)B++,A.push(K);else if(!p)return e}}if(B){t=$a(t,A);z=t.length;if(!z&&!p)return e;B--}}if(z)h[f]=x,e.push(t),f++;else if(1===l.length)return e}if(v){if(this.db&&m&&m.length&&!F)for(n=0;n<m.length;n+=2){h=this.index.get(m[n]);
if(!h)if(p)continue;else return e;v.push(h.db.tag(m[n+1],b,r,!1))}var Ib=this;return Promise.all(v).then(function(P){return P.length?Ib.search(a,b,c,P):P})}if(!f)return e;if(g&&(!n||!this.store))return e[0];v=[];r=0;for(p=void 0;r<h.length;r++){p=e[r];n&&p.length&&!p[0].doc&&(this.db?v.push(p=this.index.get(this.field[0]).db.enrich(p)):p.length&&(p=bb.call(this,p)));if(g)return p;e[r]={field:h[r],result:p}}if(n&&this.db&&v.length){var Da=this;return Promise.all(v).then(function(P){for(var Q=0;Q<P.length;Q++)e[Q].result=
P[Q];return k?cb(e,b):q?db(e,a,Da.index,Da.field,Da.I,q):e})}return k?cb(e,b):q?db(e,a,this.index,this.field,this.I,q):e};
function db(a,b,c,d,e,h){for(var f,g,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,g=f.encode(b)),p=0;p<m.length;p++){var q="",r=xa(m[p].doc,n),v=f.encode(r);r=r.split(f.split);for(var w=0,x,t;w<v.length;w++){x=v[w];t=r[w];for(var z=void 0,A=0,B;A<g.length;A++)if(B=g[A],"strict"===k){if(x===B){q+=(q?" ":"")+h.replace("$1",t);z=!0;break}}else{var D=x.indexOf(B);if(-1<D){q+=(q?" ":"")+t.substring(0,D)+h.replace("$1",t.substring(D,
B.length))+t.substring(D+B.length);z=!0;break}}z||(q+=(q?" ":"")+r[w])}m[p].na=q}return a}function cb(a,b){for(var c=[],d=M(),e=0,h,f;e<a.length;e++){h=a[e];f=h.result;for(var g=0,k,l,m;g<f.length;g++)if(l=f[g],k=l.id,m=d[k])m.push(h.field);else{if(c.length===b)return c;l.field=d[k]=[h.field];c.push(l)}}return c}function ab(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=bb.call(this,a));return a}}
function bb(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 V(a){if(!this)return new V(a);var b=a.document||a.doc||a,c,d;this.I=[];this.field=[];this.T=[];this.key=(c=b.key||b.id)&&eb(c,this.T)||"id";(d=a.keystore||0)&&(this.keystore=d);this.reg=(this.fastupdate=!!a.fastupdate)?d?new T(d):new Map:d?new U(d):new Set;this.H=(c=b.store||null)&&!0!==c&&[];this.store=c&&(d?new T(d):new Map);this.cache=(c=a.cache||null)&&new W(c);a.cache=!1;this.worker=a.worker;this.index=fb.call(this,a,b);this.tag=null;if(c=b.tag)if("string"===typeof c&&(c=[c]),c.length){this.tag=
new Map;this.M=[];this.$=[];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.M[b]=d.custom:(this.M[b]=eb(e,this.T),d.filter&&("string"===typeof this.M[b]&&(this.M[b]=new String(this.M[b])),this.M[b].R=d.filter));this.$[b]=e;this.tag.set(e,new Map)}}if(this.worker){a=[];c=y(this.index.values());for(b=c.next();!b.done;b=c.next())b=b.value,b.then&&a.push(b);if(a.length){var h=this;return Promise.all(a).then(function(f){for(var g=
0,k=y(h.index.entries()),l=k.next();!l.done;l=k.next()){l=l.value;var m=l[0];l[1].then&&h.index.set(m,f[g++])}return h})}}else a.db&&this.mount(a.db)}u=V.prototype;
u.mount=function(a){var b=this.field;if(this.tag)for(var c=0,d;c<this.$.length;c++){d=this.$[c];var e;this.index.set(d,e=new R({},this.reg));b===this.field&&(b=b.slice(0));b.push(d);e.tag=this.tag.get(d)}c=[];d={db:a.db,type:a.type,fastupdate:a.fastupdate};e=0;for(var h;e<b.length;e++){d.field=h=b[e];h=this.index.get(h);var f=new a.constructor(a.id,d);f.id=a.id;c[e]=f.mount(h);h.document=!0;e?h.bypass=!0:h.store=this.store}this.db=!0;return Promise.all(c)};
u.commit=function(a,b){var c=this,d,e,h,f;return I(function(g){if(1==g.h){d=[];e=y(c.index.values());for(h=e.next();!h.done;h=e.next())f=h.value,d.push(f.db.commit(f,a,b));return G(g,Promise.all(d),2)}c.reg.clear();g.h=0})};u.destroy=function(){for(var a=[],b=y(this.index.values()),c=b.next();!c.done;c=b.next())a.push(c.value.destroy());return Promise.all(a)};
function fb(a,b){var c=new Map,d=b.index||b.field||b;N(d)&&(d=[d]);for(var e=0,h,f=void 0;e<d.length;e++){h=d[e];N(h)||(f=h,h=h.field);f=O(f)?Object.assign({},a,f):a;if(this.worker){var g=new Ka(f);c.set(h,g)}this.worker||c.set(h,new R(f,this.reg));f.custom?this.I[e]=f.custom:(this.I[e]=eb(h,this.T),f.filter&&("string"===typeof this.I[e]&&(this.I[e]=new String(this.I[e])),this.I[e].R=f.filter));this.field[e]=h}if(this.H)for(a=b.store,N(a)&&(a=[a]),b=0;b<a.length;b++)d=a[b],e=d.field||d,d.custom?(this.H[b]=
d.custom,d.custom.la=e):(this.H[b]=eb(e,this.T),d.filter&&("string"===typeof this.H[b]&&(this.H[b]=new String(this.H[b])),this.H[b].R=d.filter));return c}function eb(a,b){for(var c=a.split(":"),d=0,e=0;e<c.length;e++)a=c[e],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(b[d]=!0),a&&(c[d++]=a);d<c.length&&(c.length=d);return 1<d?c:c[0]}u.append=function(a,b){return this.add(a,b,!0)};u.update=function(a,b){return this.remove(a).add(a,b)};
u.remove=function(a){O(a)&&(a=xa(a,this.key));for(var b=y(this.index.values()),c=b.next();!c.done;c=b.next())c.value.remove(a,!0);if(this.reg.has(a)){if(this.tag&&!this.fastupdate)for(b=y(this.tag.values()),c=b.next();!c.done;c=b.next()){c=c.value;for(var d=y(c),e=d.next();!e.done;e=d.next()){var h=e.value;e=h[0];h=h[1];var f=h.indexOf(a);-1<f&&(1<h.length?h.splice(f,1):c.delete(e))}}this.store&&this.store.delete(a);this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
u.clear=function(){for(var a=y(this.index.values()),b=a.next();!b.done;b=a.next())b.value.clear();if(this.tag)for(a=y(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=y(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=gb;
u.export=function(a,b,c,d,e,h){var f;"undefined"===typeof h&&(f=new Promise(function(k){h=k}));e||(e=0);d||(d=0);if(d<this.field.length){c=this.field[d];var g=this.index[c];b=this;g.export(a,b,e?c:"",d,e++,h)||(d++,b.export(a,b,c,d,1,h))}else{switch(e){case 1:b="tag";g=this.A;c=null;break;case 2:b="store";g=this.store;c=null;break;default:h();return}Pa(a,this,c,b,d,e,g,h)}return f};
u.import=function(a,b){if(b)switch(N(b)&&(b=JSON.parse(b)),a){case "tag":this.A=b;break;case "reg":this.fastupdate=!1;this.reg=b;a=0;for(var c;a<this.field.length;a++)c=this.index[this.field[a]],c.reg=b,c.fastupdate=!1;break;case "store":this.store=b;break;default:a=a.split("."),c=a[0],a=a[1],c&&a&&this.index[c].import(a,b)}};Na(V.prototype);function gb(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();var d=this.cache.get(a);if(!d){d=this.search(a,b,c);if(d.then){var e=this;d.then(function(h){e.cache.set(a,h);return h})}this.cache.set(a,d)}return d}function W(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}W.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)};
W.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};W.prototype.remove=function(a){for(var b=y(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)}};W.prototype.clear=function(){this.cache.clear();this.h=""};var hb={normalize:function(a){return a.toLowerCase()},dedupe:!1};var ib=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 jb=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["pf","f"]]),kb=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\1+/g,"$1"];var lb={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 mb=/[\x00-\x7F]+/g;var nb=/[\x00-\x7F]+/g;var ob=/[\x00-\x7F]+/g;var pb={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:hb,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:ib},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:ib,matcher:jb,replacer:kb},LatinExtra:{normalize:!0,dedupe:!0,mapper:ib,replacer:kb.concat([/(?!^)[aeo]/g,""]),matcher:jb},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=lb[d],h=1,f;h<c.length&&(f=c.charAt(h),"h"===f||"w"===
f||!(f=lb[f])||f===e||(d+=f,e=f,4!==d.length));h++);a[b]=d}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(mb," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(nb,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(ob," ")}}};var qb={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};M();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=M(),h=M(),f=this.depth,g=this.resolution,k=0;k<d;k++){var l=b[this.rtl?d-1-k:k],m=l.length;if(m&&(f||!h[l])){var n=this.score?this.score(b,l,k,null,0):rb(g,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):rb(g,d,k,m,n);sb(this,h,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):rb(g,d,k,m,q),sb(this,h,p,r,a,c);p=""}case "forward":if(1<m){for(q=0;q<m;q++)p+=l[q],sb(this,h,p,n,a,c);break}default:if(sb(this,h,l,n,a,c),f&&1<d&&k<d-1)for(m=M(),p=this.aa,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 v=this.score?this.score(b,n,k,l,r):rb(p+(d/2>p?0:1),d,k,q-1,r-1),w=this.bidirectional&&l>n;sb(this,e,w?n:l,v,a,c,w?l:n)}}}}this.fastupdate||this.reg.add(a)}else b=""}this.db&&
(b||this.commit_task.push({del:a}),this.da&&tb(this));return this};
function sb(a,b,c,d,e,h,f){var g=f?a.ctx:a.map,k;if(!b[c]||f&&!(k=b[c])[f])if(f?(b=k||(b[c]=M()),b[f]=1,(k=g.get(f))?g=k:g.set(f,g=new Map)):b[c]=1,(k=g.get(c))?g=k:g.set(c,g=k=[]),g=g[d]||(g[d]=[]),!h||!g.includes(e)){if(g.length===Math.pow(2,31)-1){b=new S(g);if(a.fastupdate)for(c=y(a.reg.values()),h=c.next();!h.done;h=c.next())h=h.value,h.includes(g)&&(h[h.indexOf(g)]=b);k[d]=g=b}g.push(e);a.fastupdate&&((d=a.reg.get(e))?d.push(g):a.reg.set(e,[g]))}}
function rb(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};function X(a,b,c,d){if(1===a.length)return a=a[0],a=c||a.length>b?b?a.slice(c,c+b):a.slice(c):a,d?ub(a):a;for(var e=[],h=0,f=void 0,g=void 0;h<a.length;h++)if((f=a[h])&&(g=f.length)){if(c){if(c>=g){c-=g;continue}c<g&&(f=b?f.slice(c,c+b):f.slice(c),g=f.length,c=0)}if(e.length)g>b&&(f=f.slice(0,b),g=f.length),e.push(f);else{if(g>=b)return g>b&&(f=f.slice(0,b)),d?ub(f):f;e=[f]}b-=g;if(!b)break}if(!e.length)return e;e=1<e.length?[].concat.apply([],e):e[0];return d?ub(e):e}
function ub(a){for(var b=0;b<a.length;b++)a[b]={score:b,id:a[b]};return a};Y.prototype.or=function(){var a=this,b=arguments,c=b[0];if(c.then)return c.then(function(){return a.or.apply(a,b)});if(c[0]&&c[0].index)return this.or.apply(this,c);var d=[];c=[];for(var e=0,h=0,f,g,k=0,l=void 0;k<b.length;k++)if(l=b[k]){e=l.limit||0;h=l.offset||0;f=l.enrich;g=l.resolve;var m=void 0;if(l.constructor===Y)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.and)m=this.and(l.and);else if(l.xor)m=this.xor(l.xor);else if(l.not)m=
this.not(l.not);else continue;d[k]=m;m.then&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=d.concat([a.result]));a.result=vb(d,e,h,f,g,a.J);return g?a.result:a});d.length&&(this.result.length&&(d=d.concat([this.result])),this.result=vb(d,e,h,f,g,this.J));return g?this.result:this};function vb(a,b,c,d,e,h){if(!a.length)return a;"object"===typeof b&&(c=b.offset||0,d=b.enrich||!1,b=b.limit||0);return 2>a.length?e?X(a[0],b,c,d):a[0]:Za(a,c,b,e,h)};Y.prototype.and=function(){if(this.result.length){var a=this,b=arguments,c=b[0];if(c.then)return c.then(function(){return a.and.apply(a,b)});if(c[0]&&c[0].index)return this.and.apply(this,c);var d=[];c=[];for(var e=0,h=0,f,g,k=0,l=void 0;k<b.length;k++)if(l=b[k]){e=l.limit||0;h=l.offset||0;f=l.resolve;g=l.suggest;var m=void 0;if(l.constructor===Y)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.or)m=this.or(l.or);else if(l.xor)m=this.xor(l.xor);
else if(l.not)m=this.not(l.not);else continue;d[k]=m;m.then&&c.push(m)}if(!d.length)return this.result=d,f?this.result:this;if(c.length)return Promise.all(c).then(function(){d=[a.result].concat(d);a.result=wb(d,e,h,f,a.J,g);return f?a.result:a});d=[this.result].concat(d);this.result=wb(d,e,h,f,this.J,g);return f?this.result:this}return this};function wb(a,b,c,d,e,h){if(2>a.length)return[];var f=[];M();var g=ya(a);return g?Ya(a,g,b,c,h,e,d):f};Y.prototype.xor=function(){var a=this,b=arguments,c=b[0];if(c.then)return c.then(function(){return a.xor.apply(a,b)});if(c[0]&&c[0].index)return this.xor.apply(this,c);var d=[];c=[];for(var e=0,h=0,f,g,k=0,l=void 0;k<b.length;k++)if(l=b[k]){e=l.limit||0;h=l.offset||0;f=l.enrich;g=l.resolve;var m=void 0;if(l.constructor===Y)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.or)m=this.or(l.or);else if(l.and)m=this.and(l.and);else if(l.not)m=
this.not(l.not);else continue;d[k]=m;m.then&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=[a.result].concat(d));a.result=xb(d,e,h,f,!g,a.J);return g?a.result:a});d.length&&(this.result.length&&(d=[this.result].concat(d)),this.result=xb(d,e,h,f,!g,a.J));return g?this.result:this};
function xb(a,b,c,d,e,h){if(!a.length)return a;if(2>a.length)return e?X(a[0],b,c,d):a[0];d=[];for(var f=M(),g=0,k=0,l;k<a.length;k++)if(l=a[k])for(var m=0,n;m<l.length;m++)if(n=l[m]){g<n.length&&(g=n.length);for(var p=0,q;p<n.length;p++)q=n[p],f[q]?f[q]++:f[q]=1}for(l=k=0;k<g;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(e){if(d.push(q),d.length===b)return d}else{var r=k+(m?h:0);d[r]||(d[r]=[]);d[r].push(q);if(++l===b)return d}return d};Y.prototype.not=function(){var a=this,b=arguments,c=b[0];if(c.then)return c.then(function(){return a.not.apply(a,b)});if(c[0]&&c[0].index)return this.not.apply(this,c);var d=[];c=[];for(var e=0,h=0,f,g=0,k=void 0;g<b.length;g++)if(k=b[g]){e=k.limit||0;h=k.offset||0;f=k.resolve;var l=void 0;if(k.constructor===Y)l=k.result;else if(k.constructor===Array)l=k;else if(k.index)k.resolve=!1,l=k.index.search(k).result;else if(k.or)l=this.or(k.or);else if(k.and)l=this.and(k.and);else if(k.xor)l=this.xor(k.xor);
else continue;d[g]=l;l.then&&c.push(l)}if(c.length)return Promise.all(c).then(function(){a.result=yb.call(a,d,e,h,f);return f?a.result:a});d.length&&(this.result=yb.call(this,d,e,h,f));return f?this.result:this};
function yb(a,b,c,d){if(!a.length)return this.result;var e=[];a=new Set(a.flat().flat());for(var h=0,f,g=0;h<this.result.length;h++)if(f=this.result[h])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[h]||(e[h]=[]),e[h].push(l),++g===b)return e;return e};function Y(a){if(!this)return new Y(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.J=a.boost||0,this.result=a.index.search(a).result,this;if(a.constructor===Y)return a;this.index=null;this.result=a||[];this.J=0}Y.prototype.limit=function(a){if(this.result.length)for(var b=[],c=0,d=0,e;d<this.result.length;d++)if(e=this.result[d],e.length+c<a)b[d]=e,c+=e.length;else{b[d]=e.slice(0,a-c);this.result=b;break}return this};
Y.prototype.offset=function(a){if(this.result.length){for(var b=[],c=0,d=0,e;d<this.result.length;d++)e=this.result[d],e.length+c<a?c+=e.length:(b[d]=e.slice(a-c),c=a);this.result=b}return this};Y.prototype.boost=function(a){this.J+=a;return this};Y.prototype.resolve=function(a,b,c){zb=1;var d=this.result;this.result=this.index=null;return d.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),X(d,a||100,b,c)):d};var zb=1;
R.prototype.search=function(a,b,c){c||(!b&&O(a)?(c=a,a=""):O(b)&&(c=b,b=0));var d=[],e=0,h;if(c){a=c.query||a;b=c.limit||b;e=c.offset||0;var f=c.context;var g=c.suggest;(h=zb&&!1!==c.resolve)||(zb=0);var k=h&&c.enrich;var l=c.boost;var m=this.db&&c.tag}else h=this.resolve||zb;a=this.encoder.encode(a);var n=a.length;b||!h||(b=100);if(1===n)return Ab.call(this,a[0],"",b,e,h,k,m);f=this.depth&&!1!==f;if(2===n&&f&&!g)return Ab.call(this,a[0],a[1],b,e,h,k,m);var p=c=0;if(1<n){for(var q=M(),r=[],v=0,w=
void 0;v<n;v++)if((w=a[v])&&!q[w]){if(g||this.db||Z(this,w))r.push(w),q[w]=1;else return h?d:new Y(d);w=w.length;c=Math.max(c,w);p=p?Math.min(p,w):w}a=r;n=a.length}if(!n)return h?d:new Y(d);var x=0;if(1===n)return Ab.call(this,a[0],"",b,e,h,k,m);if(2===n&&f&&!g)return Ab.call(this,a[0],a[1],b,e,h,k,m);if(1<n)if(f){var t=a[0];x=1}else 9<c&&3<c/p&&a.sort(va);if(this.db){if(this.db.search&&(f=this.db.search(this,a,b,e,g,h,k,m),!1!==f))return f;var z=this;return function(){var A,B,D;return I(function(F){switch(F.h){case 1:B=
A=void 0;case 2:if(!(x<n)){F.h=4;break}B=a[x];return t?G(F,Z(z,B,t,0,0,!1,!1),8):G(F,Z(z,B,"",0,0,!1,!1),7);case 7:A=F.F;A=Bb(A,d,g,z.resolution);F.h=6;break;case 8:A=F.F,A=Bb(A,d,g,z.aa),g&&!1===A&&d.length||(t=B);case 6:if(A)return F.return(A);if(g&&x===n-1){D=d.length;if(!D){if(t){t="";x=-1;F.h=3;break}return F.return(d)}if(1===D)return F.return(h?X(d[0],b,e):new Y(d[0]))}case 3:x++;F.h=2;break;case 4:return F.return(h?Ya(d,z.resolution,b,e,g,l,h):new Y(d[0]))}})}()}for(k=f=void 0;x<n;x++){k=a[x];
t?(f=Z(this,k,t,0,0,!1,!1),f=Bb(f,d,g,this.aa),g&&!1===f&&d.length||(t=k)):(f=Z(this,k,"",0,0,!1,!1),f=Bb(f,d,g,this.resolution));if(f)return f;if(g&&x===n-1){f=d.length;if(!f){if(t){t="";x=-1;continue}return d}if(1===f)return h?X(d[0],b,e):new Y(d[0])}}d=Ya(d,this.resolution,b,e,g,l,h);return h?d:new Y(d)};
function Ab(a,b,c,d,e,h,f){a=Z(this,a,b,c,d,e,h,f);return this.db?a.then(function(g){return e?g:g&&g.length?e?X(g,c,d):new Y(g):e?[]:new Y([])}):a&&a.length?e?X(a,c,d):new Y(a):e?[]:new Y([])}function Bb(a,b,c,d){var e=[];if(a){d=Math.min(a.length,d);for(var h=0,f=void 0;h<d;h++)(f=a[h])&&f&&(e[h]=f);if(e.length){b.push(e);return}}return!c&&e}
function Z(a,b,c,d,e,h,f,g){var k;c&&(k=a.bidirectional&&b>c);if(a.db)return c?a.db.get(k?c:b,k?b:c,d,e,h,f,g):a.db.get(b,"",d,e,h,f,g);a=c?(a=a.ctx.get(k?b:c))&&a.get(k?c: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 h=e.indexOf(a);h===c.length-1?e.pop():e.splice(h,1)}}else Cb(this.map,a),this.depth&&Cb(this.ctx,a);b||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.da&&tb(this));this.cache&&this.cache.remove(a);return this};
function Cb(a,b){var c=0;if(a.constructor===Array)for(var d=0,e=void 0,h;d<a.length;d++){if((e=a[d])&&e.length)if(h=e.indexOf(b),0<=h){1<e.length?(e.splice(h,1),c++):delete a[d];break}else c++}else for(d=y(a),e=d.next();!e.done;e=d.next())h=e.value,e=h[0],(h=Cb(h[1],b))?c+=h:a.delete(e);return c};function R(a,b){if(!this)return new R(a);if(a){var c=N(a)?a:a.preset;c&&(a=Object.assign({},qb[c],a))}else a={};c=a.context||{};var d=N(a.encoder)?pb[a.encoder]:a.encode||a.encoder||hb;this.encoder=d.encode?d:"object"===typeof d?new Ga(d):{encode:d};var e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&c.depth||0;this.bidirectional=!1!==c.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;(e=a.keystore||0)&&(this.keystore=e);this.map=
e?new T(e):new Map;this.ctx=e?new T(e):new Map;this.reg=b||(this.fastupdate?e?new T(e):new Map:e?new U(e):new Set);this.aa=c.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new W(e);this.resolve=!1!==a.resolve;if(e=a.db)this.db=this.mount(e);this.da=!1!==a.commit;this.commit_task=[];this.commit_timer=null}u=R.prototype;u.mount=function(a){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return a.mount(this)};
u.commit=function(a,b){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.commit(this,a,b)};u.destroy=function(){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.destroy()};function tb(a){a.commit_timer||(a.commit_timer=setTimeout(function(){a.commit_timer=null;a.db.commit(a,void 0,void 0)},0))}
function bb(a,b,c,d,e){var h=[],f=J(),g=a.length,k=0;if(d)for(e=g-1;0<=e;e--){d=a[e];var l=d.length;for(g=0;g<l;g++){var m=d[g];if(!f[m])if(f[m]=1,b)b--;else if(h.push(m),h.length===c)return h}}else for(var n=Aa(a),p=0;p<n;p++)for(var q=g-1;0<=q;q--)if(l=(d=a[q][p])&&d.length)for(var r=0;r<l;r++)if(m=d[r],!f[m])if(f[m]=1,b)b--;else{var v=p+(q<g-1?e||0:0);(h[v]||(h[v]=[])).push(m);if(++k===c)return h}return h}
function cb(a,b){for(var c=J(),d=[],e=0,h;e<b.length;e++){h=b[e];for(var f=0;f<h.length;f++)c[h[f]]=1}for(b=0;b<a.length;b++)e=a[b],1===c[e]&&(d.push(e),c[e]=2);return d};V.prototype.search=function(a,b,c,d){c||(!b&&M(a)?(c=a,a=""):M(b)&&(c=b,b=0));var e=[],h=[],f=0;if(c){c.constructor===Array&&(c={index:c});a=c.query||a;var g=c.pluck;var k=c.merge;var l=g||c.field||c.index;var m=this.tag&&c.tag;var n=this.store&&c.enrich;var p=c.suggest;var q=c.na;b=c.limit||b;var r=c.offset||0;b||(b=100);if(m&&(!this.db||!d)){m.constructor!==Array&&(m=[m]);for(var v=[],w=0,y=void 0;w<m.length;w++)if(y=m[w],y.field&&y.tag){var t=y.tag;if(t.constructor===Array)for(var z=0;z<t.length;z++)v.push(y.field,
t[z]);else v.push(y.field,t)}else{t=Object.keys(y);z=0;for(var A=void 0,B=void 0;z<t.length;z++)if(A=t[z],B=y[A],B.constructor===Array)for(var D=0;D<B.length;D++)v.push(A,B[D]);else v.push(A,B)}m=v;if(!a){h=[];if(v.length)for(g=0;g<v.length;g+=2){p=void 0;if(this.db){p=this.index.get(v[g]);if(!p)continue;h.push(p=p.db.tag(v[g+1],b,r,n))}else p=db.call(this,v[g],v[g+1],b,r,n);e.push({field:v[g],tag:v[g+1],result:p})}return h.length?Promise.all(h).then(function(P){for(var Q=0;Q<P.length;Q++)e[Q].result=
P[Q];return e}):e}}K(l)&&(l=[l])}l||(l=this.field);v=!d&&(this.worker||this.db)&&[];w=0;for(z=y=t=void 0;w<l.length;w++)if(y=l[w],!this.db||!this.tag||this.I[w]){t=void 0;K(y)||(t=y,y=t.field,a=t.query||a,b=t.limit||b,r=t.offset||r,p=t.suggest||p,n=this.store&&(t.enrich||n));if(d)t=d[w];else{z=t||c;t=this.index.get(y);if(m){if(this.db){z.tag=m;var F=t.db.support_tag_search;z.field=l}F||(z.enrich=!1)}if(v){v[w]=t.search(a,b,z);z&&n&&(z.enrich=n);continue}else t=t.search(a,b,z),z&&n&&(z.enrich=n)}z=
t&&t.length;if(m&&z){A=[];B=0;if(this.db&&d){if(!F)for(D=l.length;D<d.length;D++){var L=d[D];if(L&&L.length)B++,A.push(L);else if(!p)return e}}else{D=0;for(var Kb=L=void 0;D<m.length;D+=2){L=this.tag.get(m[D]);if(!L)if(p)continue;else return e;if(Kb=(L=L&&L.get(m[D+1]))&&L.length)B++,A.push(L);else if(!p)return e}}if(B){t=cb(t,A);z=t.length;if(!z&&!p)return e;B--}}if(z)h[f]=y,e.push(t),f++;else if(1===l.length)return e}if(v){if(this.db&&m&&m.length&&!F)for(n=0;n<m.length;n+=2){h=this.index.get(m[n]);
if(!h)if(p)continue;else return e;v.push(h.db.tag(m[n+1],b,r,!1))}var Lb=this;return Promise.all(v).then(function(P){return P.length?Lb.search(a,b,c,P):P})}if(!f)return e;if(g&&(!n||!this.store))return e[0];v=[];r=0;for(p=void 0;r<h.length;r++){p=e[r];n&&p.length&&!p[0].doc&&(this.db?v.push(p=this.index.get(this.field[0]).db.enrich(p)):p.length&&(p=eb.call(this,p)));if(g)return p;e[r]={field:h[r],result:p}}if(n&&this.db&&v.length){var Ea=this;return Promise.all(v).then(function(P){for(var Q=0;Q<P.length;Q++)e[Q].result=
P[Q];return k?fb(e,b):q?gb(e,a,Ea.index,Ea.field,Ea.I,q):e})}return k?fb(e,b):q?gb(e,a,this.index,this.field,this.I,q):e};
function gb(a,b,c,d,e,h){for(var f,g,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,g=f.encode(b)),p=0;p<m.length;p++){var q="",r=za(m[p].doc,n),v=f.encode(r);r=r.split(f.split);for(var w=0,y,t;w<v.length;w++){y=v[w];t=r[w];for(var z=void 0,A=0,B;A<g.length;A++)if(B=g[A],"strict"===k){if(y===B){q+=(q?" ":"")+h.replace("$1",t);z=!0;break}}else{var D=y.indexOf(B);if(-1<D){q+=(q?" ":"")+t.substring(0,D)+h.replace("$1",t.substring(D,
B.length))+t.substring(D+B.length);z=!0;break}}z||(q+=(q?" ":"")+r[w])}m[p].na=q}return a}function fb(a,b){for(var c=[],d=J(),e=0,h,f;e<a.length;e++){h=a[e];f=h.result;for(var g=0,k,l,m;g<f.length;g++)if(l=f[g],k=l.id,m=d[k])m.push(h.field);else{if(c.length===b)return c;l.field=d[k]=[h.field];c.push(l)}}return c}function db(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=eb.call(this,a));return a}}
function eb(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 V(a){if(this.constructor!==V)return new V(a);var b=a.document||a.doc||a,c,d;this.I=[];this.field=[];this.T=[];this.key=(c=b.key||b.id)&&hb(c,this.T)||"id";(d=a.keystore||0)&&(this.keystore=d);this.reg=(this.fastupdate=!!a.fastupdate)?d?new T(d):new Map:d?new U(d):new Set;this.H=(c=b.store||null)&&!0!==c&&[];this.store=c&&(d?new T(d):new Map);this.cache=(c=a.cache||null)&&new W(c);a.cache=!1;this.worker=a.worker;this.index=ib.call(this,a,b);this.tag=null;if(c=b.tag)if("string"===typeof c&&
(c=[c]),c.length){this.tag=new Map;this.M=[];this.$=[];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.M[b]=d.custom:(this.M[b]=hb(e,this.T),d.filter&&("string"===typeof this.M[b]&&(this.M[b]=new String(this.M[b])),this.M[b].R=d.filter));this.$[b]=e;this.tag.set(e,new Map)}}if(this.worker){a=[];c=x(this.index.values());for(b=c.next();!b.done;b=c.next())b=b.value,b.then&&a.push(b);if(a.length){var h=
this;return Promise.all(a).then(function(f){for(var g=0,k=x(h.index.entries()),l=k.next();!l.done;l=k.next()){l=l.value;var m=l[0];l[1].then&&h.index.set(m,f[g++])}return h})}}else a.db&&this.mount(a.db)}u=V.prototype;
u.mount=function(a){var b=this.field;if(this.tag)for(var c=0,d;c<this.$.length;c++){d=this.$[c];var e;this.index.set(d,e=new O({},this.reg));b===this.field&&(b=b.slice(0));b.push(d);e.tag=this.tag.get(d)}c=[];d={db:a.db,type:a.type,fastupdate:a.fastupdate};e=0;for(var h;e<b.length;e++){d.field=h=b[e];h=this.index.get(h);var f=new a.constructor(a.id,d);f.id=a.id;c[e]=f.mount(h);h.document=!0;e?h.bypass=!0:h.store=this.store}this.db=!0;return Promise.all(c)};
u.commit=function(a,b){var c=this,d,e,h,f;return ta(function(g){if(1==g.h){d=[];e=x(c.index.values());for(h=e.next();!h.done;h=e.next())f=h.value,d.push(f.db.commit(f,a,b));return G(g,Promise.all(d),2)}c.reg.clear();g.h=0})};u.destroy=function(){for(var a=[],b=x(this.index.values()),c=b.next();!c.done;c=b.next())a.push(c.value.destroy());return Promise.all(a)};
function ib(a,b){var c=new Map,d=b.index||b.field||b;K(d)&&(d=[d]);for(var e=0,h,f=void 0;e<d.length;e++){h=d[e];K(h)||(f=h,h=h.field);f=M(f)?Object.assign({},a,f):a;if(this.worker){var g=new R(f);c.set(h,g)}this.worker||c.set(h,new O(f,this.reg));f.custom?this.I[e]=f.custom:(this.I[e]=hb(h,this.T),f.filter&&("string"===typeof this.I[e]&&(this.I[e]=new String(this.I[e])),this.I[e].R=f.filter));this.field[e]=h}if(this.H)for(a=b.store,K(a)&&(a=[a]),b=0;b<a.length;b++)d=a[b],e=d.field||d,d.custom?(this.H[b]=
d.custom,d.custom.la=e):(this.H[b]=hb(e,this.T),d.filter&&("string"===typeof this.H[b]&&(this.H[b]=new String(this.H[b])),this.H[b].R=d.filter));return c}function hb(a,b){for(var c=a.split(":"),d=0,e=0;e<c.length;e++)a=c[e],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(b[d]=!0),a&&(c[d++]=a);d<c.length&&(c.length=d);return 1<d?c:c[0]}u.append=function(a,b){return this.add(a,b,!0)};u.update=function(a,b){return this.remove(a).add(a,b)};
u.remove=function(a){M(a)&&(a=za(a,this.key));for(var b=x(this.index.values()),c=b.next();!c.done;c=b.next())c.value.remove(a,!0);if(this.reg.has(a)){if(this.tag&&!this.fastupdate)for(b=x(this.tag.values()),c=b.next();!c.done;c=b.next()){c=c.value;for(var d=x(c),e=d.next();!e.done;e=d.next()){var h=e.value;e=h[0];h=h[1];var f=h.indexOf(a);-1<f&&(1<h.length?h.splice(f,1):c.delete(e))}}this.store&&this.store.delete(a);this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
u.clear=function(){for(var a=x(this.index.values()),b=a.next();!b.done;b=a.next())b.value.clear();if(this.tag)for(a=x(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=x(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=jb;
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 h=this;return b.then(function(){return h.export(a,e,c+1,d=0)})}return this.export(a,e,c+1,d=0)}switch(d){case 0:var f="reg";var g=Ra(this.reg);b=null;break;case 1:f="tag";g=Qa(this.tag);b=null;break;case 2:f="doc";g=Pa(this.store);b=null;break;case 3:f="cfg";g={};b=null;break;default:return}return Sa.call(this,a,b,f,c,d,g)};
u.import=function(a,b){if(b)switch(K(b)&&(b=JSON.parse(b)),a){case "tag":break;case "reg":this.fastupdate=!1;this.reg=new Set(b);for(a=0;a<this.field.length;a++)b=this.index.get(this.field[a]),b.fastupdate=!1,b.reg=this.reg;break;case "doc":this.store=new Map(b);break;default:a=a.split(".");var c=a[0];a=a[1];c&&a&&this.index.get(c).import(a,b)}};Na(V.prototype);function jb(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();var d=this.cache.get(a);if(!d){d=this.search(a,b,c);if(d.then){var e=this;d.then(function(h){e.cache.set(a,h);return h})}this.cache.set(a,d)}return d}function W(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}W.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)};
W.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};W.prototype.remove=function(a){for(var b=x(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)}};W.prototype.clear=function(){this.cache.clear();this.h=""};var kb={normalize:function(a){return a.toLowerCase()},dedupe:!1};var lb=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 mb=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["pf","f"]]),nb=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/([^0-9])\1+/g,"$1"];var ob={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 pb=/[\x00-\x7F]+/g;var qb=/[\x00-\x7F]+/g;var rb=/[\x00-\x7F]+/g;var sb={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:kb,LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:lb},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:lb,matcher:mb,replacer:nb},LatinExtra:{normalize:!0,dedupe:!0,mapper:lb,replacer:nb.concat([/(?!^)[aeo]/g,""]),matcher:mb},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=ob[d],h=1,f;h<c.length&&(f=c.charAt(h),"h"===f||"w"===
f||!(f=ob[f])||f===e||(d+=f,e=f,4!==d.length));h++);a[b]=d}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(pb," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(qb,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(rb," ")}}};var tb={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};J();O.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(),h=J(),f=this.depth,g=this.resolution,k=0;k<d;k++){var l=b[this.rtl?d-1-k:k],m=l.length;if(m&&(f||!h[l])){var n=this.score?this.score(b,l,k,null,0):ub(g,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):ub(g,d,k,m,n);vb(this,h,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):ub(g,d,k,m,q),vb(this,h,p,r,a,c);p=""}case "forward":if(1<m){for(q=0;q<m;q++)p+=l[q],vb(this,h,p,n,a,c);break}default:if(vb(this,h,l,n,a,c),f&&1<d&&k<d-1)for(m=J(),p=this.aa,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 v=this.score?this.score(b,n,k,l,r):ub(p+(d/2>p?0:1),d,k,q-1,r-1),w=this.bidirectional&&l>n;vb(this,e,w?n:l,v,a,c,w?l:n)}}}}this.fastupdate||this.reg.add(a)}else b=""}this.db&&
(b||this.commit_task.push({del:a}),this.da&&wb(this));return this};
function vb(a,b,c,d,e,h,f){var g=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=g.get(f))?g=k:g.set(f,g=new Map)):b[c]=1,(k=g.get(c))?g=k:g.set(c,g=k=[]),g=g[d]||(g[d]=[]),!h||!g.includes(e)){if(g.length===Math.pow(2,31)-1){b=new S(g);if(a.fastupdate)for(c=x(a.reg.values()),h=c.next();!h.done;h=c.next())h=h.value,h.includes(g)&&(h[h.indexOf(g)]=b);k[d]=g=b}g.push(e);a.fastupdate&&((d=a.reg.get(e))?d.push(g):a.reg.set(e,[g]))}}
function ub(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};function X(a,b,c,d){if(1===a.length)return a=a[0],a=c||a.length>b?b?a.slice(c,c+b):a.slice(c):a,d?xb(a):a;for(var e=[],h=0,f=void 0,g=void 0;h<a.length;h++)if((f=a[h])&&(g=f.length)){if(c){if(c>=g){c-=g;continue}c<g&&(f=b?f.slice(c,c+b):f.slice(c),g=f.length,c=0)}if(e.length)g>b&&(f=f.slice(0,b),g=f.length),e.push(f);else{if(g>=b)return g>b&&(f=f.slice(0,b)),d?xb(f):f;e=[f]}b-=g;if(!b)break}if(!e.length)return e;e=1<e.length?[].concat.apply([],e):e[0];return d?xb(e):e}
function xb(a){for(var b=0;b<a.length;b++)a[b]={score:b,id:a[b]};return a};Y.prototype.or=function(){var a=this,b=arguments,c=b[0];if(c.then)return c.then(function(){return a.or.apply(a,b)});if(c[0]&&c[0].index)return this.or.apply(this,c);var d=[];c=[];for(var e=0,h=0,f,g,k=0,l=void 0;k<b.length;k++)if(l=b[k]){e=l.limit||0;h=l.offset||0;f=l.enrich;g=l.resolve;var m=void 0;if(l.constructor===Y)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.and)m=this.and(l.and);else if(l.xor)m=this.xor(l.xor);else if(l.not)m=
this.not(l.not);else continue;d[k]=m;m.then&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=d.concat([a.result]));a.result=yb(d,e,h,f,g,a.J);return g?a.result:a});d.length&&(this.result.length&&(d=d.concat([this.result])),this.result=yb(d,e,h,f,g,this.J));return g?this.result:this};function yb(a,b,c,d,e,h){if(!a.length)return a;"object"===typeof b&&(c=b.offset||0,d=b.enrich||!1,b=b.limit||0);return 2>a.length?e?X(a[0],b,c,d):a[0]:bb(a,c,b,e,h)};Y.prototype.and=function(){if(this.result.length){var a=this,b=arguments,c=b[0];if(c.then)return c.then(function(){return a.and.apply(a,b)});if(c[0]&&c[0].index)return this.and.apply(this,c);var d=[];c=[];for(var e=0,h=0,f,g,k=0,l=void 0;k<b.length;k++)if(l=b[k]){e=l.limit||0;h=l.offset||0;f=l.resolve;g=l.suggest;var m=void 0;if(l.constructor===Y)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.or)m=this.or(l.or);else if(l.xor)m=this.xor(l.xor);
else if(l.not)m=this.not(l.not);else continue;d[k]=m;m.then&&c.push(m)}if(!d.length)return this.result=d,f?this.result:this;if(c.length)return Promise.all(c).then(function(){d=[a.result].concat(d);a.result=zb(d,e,h,f,a.J,g);return f?a.result:a});d=[this.result].concat(d);this.result=zb(d,e,h,f,this.J,g);return f?this.result:this}return this};function zb(a,b,c,d,e,h){if(2>a.length)return[];var f=[];J();var g=Aa(a);return g?ab(a,g,b,c,h,e,d):f};Y.prototype.xor=function(){var a=this,b=arguments,c=b[0];if(c.then)return c.then(function(){return a.xor.apply(a,b)});if(c[0]&&c[0].index)return this.xor.apply(this,c);var d=[];c=[];for(var e=0,h=0,f,g,k=0,l=void 0;k<b.length;k++)if(l=b[k]){e=l.limit||0;h=l.offset||0;f=l.enrich;g=l.resolve;var m=void 0;if(l.constructor===Y)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.or)m=this.or(l.or);else if(l.and)m=this.and(l.and);else if(l.not)m=
this.not(l.not);else continue;d[k]=m;m.then&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=[a.result].concat(d));a.result=Ab(d,e,h,f,!g,a.J);return g?a.result:a});d.length&&(this.result.length&&(d=[this.result].concat(d)),this.result=Ab(d,e,h,f,!g,a.J));return g?this.result:this};
function Ab(a,b,c,d,e,h){if(!a.length)return a;if(2>a.length)return e?X(a[0],b,c,d):a[0];d=[];for(var f=J(),g=0,k=0,l;k<a.length;k++)if(l=a[k])for(var m=0,n;m<l.length;m++)if(n=l[m]){g<n.length&&(g=n.length);for(var p=0,q;p<n.length;p++)q=n[p],f[q]?f[q]++:f[q]=1}for(l=k=0;k<g;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(e){if(d.push(q),d.length===b)return d}else{var r=k+(m?h:0);d[r]||(d[r]=[]);d[r].push(q);if(++l===b)return d}return d};Y.prototype.not=function(){var a=this,b=arguments,c=b[0];if(c.then)return c.then(function(){return a.not.apply(a,b)});if(c[0]&&c[0].index)return this.not.apply(this,c);var d=[];c=[];for(var e=0,h=0,f,g=0,k=void 0;g<b.length;g++)if(k=b[g]){e=k.limit||0;h=k.offset||0;f=k.resolve;var l=void 0;if(k.constructor===Y)l=k.result;else if(k.constructor===Array)l=k;else if(k.index)k.resolve=!1,l=k.index.search(k).result;else if(k.or)l=this.or(k.or);else if(k.and)l=this.and(k.and);else if(k.xor)l=this.xor(k.xor);
else continue;d[g]=l;l.then&&c.push(l)}if(c.length)return Promise.all(c).then(function(){a.result=Bb.call(a,d,e,h,f);return f?a.result:a});d.length&&(this.result=Bb.call(this,d,e,h,f));return f?this.result:this};
function Bb(a,b,c,d){if(!a.length)return this.result;var e=[];a=new Set(a.flat().flat());for(var h=0,f,g=0;h<this.result.length;h++)if(f=this.result[h])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[h]||(e[h]=[]),e[h].push(l),++g===b)return e;return e};function Y(a){if(this.constructor!==Y)return new Y(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,this.J=a.boost||0,this.result=a.index.search(a).result,this;if(a.constructor===Y)return a;this.index=null;this.result=a||[];this.J=0}Y.prototype.limit=function(a){if(this.result.length)for(var b=[],c=0,d=0,e;d<this.result.length;d++)if(e=this.result[d],e.length+c<a)b[d]=e,c+=e.length;else{b[d]=e.slice(0,a-c);this.result=b;break}return this};
Y.prototype.offset=function(a){if(this.result.length){for(var b=[],c=0,d=0,e;d<this.result.length;d++)e=this.result[d],e.length+c<a?c+=e.length:(b[d]=e.slice(a-c),c=a);this.result=b}return this};Y.prototype.boost=function(a){this.J+=a;return this};Y.prototype.resolve=function(a,b,c){Cb=1;var d=this.result;this.result=this.index=null;return d.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),X(d,a||100,b,c)):d};var Cb=1;
O.prototype.search=function(a,b,c){c||(!b&&M(a)?(c=a,a=""):M(b)&&(c=b,b=0));var d=[],e=0,h;if(c){a=c.query||a;b=c.limit||b;e=c.offset||0;var f=c.context;var g=c.suggest;(h=Cb&&!1!==c.resolve)||(Cb=0);var k=h&&c.enrich;var l=c.boost;var m=this.db&&c.tag}else h=this.resolve||Cb;a=this.encoder.encode(a);var n=a.length;b||!h||(b=100);if(1===n)return Db.call(this,a[0],"",b,e,h,k,m);f=this.depth&&!1!==f;if(2===n&&f&&!g)return Db.call(this,a[0],a[1],b,e,h,k,m);var p=c=0;if(1<n){for(var q=J(),r=[],v=0,w=
void 0;v<n;v++)if((w=a[v])&&!q[w]){if(g||this.db||Z(this,w))r.push(w),q[w]=1;else return h?d:new Y(d);w=w.length;c=Math.max(c,w);p=p?Math.min(p,w):w}a=r;n=a.length}if(!n)return h?d:new Y(d);var y=0;if(1===n)return Db.call(this,a[0],"",b,e,h,k,m);if(2===n&&f&&!g)return Db.call(this,a[0],a[1],b,e,h,k,m);if(1<n)if(f){var t=a[0];y=1}else 9<c&&3<c/p&&a.sort(xa);if(this.db){if(this.db.search&&(f=this.db.search(this,a,b,e,g,h,k,m),!1!==f))return f;var z=this;return function(){var A,B,D;return ta(function(F){switch(F.h){case 1:B=
A=void 0;case 2:if(!(y<n)){F.h=4;break}B=a[y];return t?G(F,Z(z,B,t,0,0,!1,!1),8):G(F,Z(z,B,"",0,0,!1,!1),7);case 7:A=F.F;A=Eb(A,d,g,z.resolution);F.h=6;break;case 8:A=F.F,A=Eb(A,d,g,z.aa),g&&!1===A&&d.length||(t=B);case 6:if(A)return F.return(A);if(g&&y===n-1){D=d.length;if(!D){if(t){t="";y=-1;F.h=3;break}return F.return(d)}if(1===D)return F.return(h?X(d[0],b,e):new Y(d[0]))}case 3:y++;F.h=2;break;case 4:return F.return(h?ab(d,z.resolution,b,e,g,l,h):new Y(d[0]))}})}()}for(k=f=void 0;y<n;y++){k=a[y];
t?(f=Z(this,k,t,0,0,!1,!1),f=Eb(f,d,g,this.aa),g&&!1===f&&d.length||(t=k)):(f=Z(this,k,"",0,0,!1,!1),f=Eb(f,d,g,this.resolution));if(f)return f;if(g&&y===n-1){f=d.length;if(!f){if(t){t="";y=-1;continue}return d}if(1===f)return h?X(d[0],b,e):new Y(d[0])}}d=ab(d,this.resolution,b,e,g,l,h);return h?d:new Y(d)};
function Db(a,b,c,d,e,h,f){a=Z(this,a,b,c,d,e,h,f);return this.db?a.then(function(g){return e?g:g&&g.length?e?X(g,c,d):new Y(g):e?[]:new Y([])}):a&&a.length?e?X(a,c,d):new Y(a):e?[]:new Y([])}function Eb(a,b,c,d){var e=[];if(a){d=Math.min(a.length,d);for(var h=0,f=void 0;h<d;h++)(f=a[h])&&f&&(e[h]=f);if(e.length){b.push(e);return}}return!c&&e}
function Z(a,b,c,d,e,h,f,g){var k;c&&(k=a.bidirectional&&b>c);if(a.db)return c?a.db.get(k?c:b,k?b:c,d,e,h,f,g):a.db.get(b,"",d,e,h,f,g);a=c?(a=a.ctx.get(k?b:c))&&a.get(k?c:b):a.map.get(b);return a};O.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 h=e.indexOf(a);h===c.length-1?e.pop():e.splice(h,1)}}else Fb(this.map,a),this.depth&&Fb(this.ctx,a);b||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.da&&wb(this));this.cache&&this.cache.remove(a);return this};
function Fb(a,b){var c=0;if(a.constructor===Array)for(var d=0,e=void 0,h;d<a.length;d++){if((e=a[d])&&e.length)if(h=e.indexOf(b),0<=h){1<e.length?(e.splice(h,1),c++):delete a[d];break}else c++}else for(d=x(a),e=d.next();!e.done;e=d.next())h=e.value,e=h[0],(h=Fb(h[1],b))?c+=h:a.delete(e);return c};function O(a,b){if(this.constructor!==O)return new O(a);if(a){var c=K(a)?a:a.preset;c&&(a=Object.assign({},tb[c],a))}else a={};c=a.context||{};var d=K(a.encoder)?sb[a.encoder]:a.encode||a.encoder||kb;this.encoder=d.encode?d:"object"===typeof d?new N(d):{encode:d};var e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&c.depth||0;this.bidirectional=!1!==c.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;(e=a.keystore||0)&&(this.keystore=
e);this.map=e?new T(e):new Map;this.ctx=e?new T(e):new Map;this.reg=b||(this.fastupdate?e?new T(e):new Map:e?new U(e):new Set);this.aa=c.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new W(e);this.resolve=!1!==a.resolve;if(e=a.db)this.db=this.mount(e);this.da=!1!==a.commit;this.commit_task=[];this.commit_timer=null}u=O.prototype;u.mount=function(a){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return a.mount(this)};
u.commit=function(a,b){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.commit(this,a,b)};u.destroy=function(){this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null);return this.db.destroy()};function wb(a){a.commit_timer||(a.commit_timer=setTimeout(function(){a.commit_timer=null;a.db.commit(a,void 0,void 0)},0))}
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 Db(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=y(a),d=c.next();!d.done;d=c.next()){var e=d.value;d=e[0];(e=Db(e[1]))?b+=e:a.delete(d)}return b}u.cleanup=function(){if(!this.fastupdate)return this;Db(this.map);this.depth&&Db(this.ctx);return this};u.searchCache=gb;
u.export=function(a,b,c,d,e,h){var f=!0;"undefined"===typeof h&&(f=new Promise(function(n){h=n}));switch(e||(e=0)){case 0:var g="reg";if(this.fastupdate){var k=M();for(var l=y(this.reg.keys()),m=l.next();!m.done;m=l.next())k[m.value]=1}else k=this.reg;break;case 1:g="cfg";k={doc:0,opt:this.h?1:0};break;case 2:g="map";k=this.map;break;case 3:g="ctx";k=this.ctx;break;default:"undefined"===typeof c&&h&&h();return}Pa(a,b||this,c,g,d,e,k,h);return f};
u.import=function(a,b){if(b)switch(N(b)&&(b=JSON.parse(b)),a){case "cfg":this.h=!!b.opt;break;case "reg":this.fastupdate=!1;this.reg=b;break;case "map":this.map=b;break;case "ctx":this.ctx=b}};
u.serialize=function(a){a=void 0===a?!0:a;if(!this.reg.size)return"";for(var b="",c="",d=y(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=y(this.map.entries());for(var h=e.next();!h.done;h=e.next()){var f=h.value;h=f[0];f=f[1];for(var g="",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+"]";g+=(g?",":"")+m}g='["'+h+'",['+
g+"]]";d+=(d?",":"")+g}d="index.map=new Map(["+d+"]);";e="";h=y(this.ctx.entries());for(f=h.next();!f.done;f=h.next())for(g=f.value,f=g[0],g=y(g[1].entries()),k=g.next();!k.done;k=g.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};Na(R.prototype);var Eb="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),Fb=["map","ctx","tag","reg","cfg"];
function Gb(a,b){b=void 0===b?{}:b;if(!this)return new Gb(a,b);"object"===typeof a&&(b=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.support_tag_search=!1;this.db=null;this.h={}}u=Gb.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=Eb.open(a.id+(a.field?":"+a.field:""),1);d.onupgradeneeded=function(){var e=a.db=this.result;Fb.forEach(function(h){e.objectStoreNames.contains(h)||e.createObjectStore(h)})};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(){return Eb.deleteDatabase(this.id+(this.field?":"+this.field:""))};u.clear=function(){for(var a=this.db.transaction(Fb,"readwrite"),b=0;b<Fb.length;b++)a.objectStore(Fb[b]).clear();return Jb(a)};
u.get=function(a,b,c,d,e,h){c=void 0===c?0:c;d=void 0===d?0:d;e=void 0===e?!0:e;h=void 0===h?!1:h;a=this.db.transaction(b?"ctx":"map","readonly").objectStore(b?"ctx":"map").get(b?b+":"+a:a);var f=this;return Jb(a).then(function(g){var k=[];if(!g||!g.length)return k;if(e){if(!c&&!d&&1===g.length)return g[0];for(var l=0,m=void 0;l<g.length;l++)if((m=g[l])&&m.length)if(d>=m.length)d-=m.length;else{for(var n=c?d+Math.min(m.length-d,c):m.length,p=d;p<n;p++)k.push(m[p]);d=0;if(k.length===c)break}return h?
f.enrich(k):k}return g})};u.tag=function(a,b,c,d){b=void 0===b?0:b;c=void 0===c?0:c;d=void 0===d?!1:d;a=this.db.transaction("tag","readonly").objectStore("tag").get(a);var e=this;return Jb(a).then(function(h){if(!h||!h.length||c>=h.length)return[];if(!b&&!c)return h;h=h.slice(c,c+b);return d?e.enrich(h):h})};
u.enrich=function(a){"object"!==typeof a&&(a=[a]);for(var b=this.db.transaction("reg","readonly").objectStore("reg"),c=[],d=0;d<a.length;d++)c[d]=Jb(b.get(a[d]));return Promise.all(c).then(function(e){for(var h=0;h<e.length;h++)e[h]={id:a[h],doc:e[h]?JSON.parse(e[h]):null};return e})};u.has=function(a){a=this.db.transaction("reg","readonly").objectStore("reg").getKey(a);return Jb(a)};u.search=null;u.info=function(){};
function Gb(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=x(a),d=c.next();!d.done;d=c.next()){var e=d.value;d=e[0];(e=Gb(e[1]))?b+=e:a.delete(d)}return b}u.cleanup=function(){if(!this.fastupdate)return this;Gb(this.map);this.depth&&Gb(this.ctx);return this};u.searchCache=jb;
u.export=function(a,b,c,d){d=void 0===d?0:d;switch(d){case 0:var e="reg";var h=Ra(this.reg);break;case 1:e="cfg";h={};break;case 2:e="map";h=Pa(this.map);break;case 3:e="ctx";h=Qa(this.ctx);break;default:return}return Sa.call(this,a,b,e,c,d,h)};u.import=function(a,b){if(b)switch(K(b)&&(b=JSON.parse(b)),a){case "reg":this.fastupdate=!1;this.reg=new Set(b);break;case "map":this.map=new Map(b);break;case "ctx":this.ctx=new Map(b)}};
u.serialize=function(a){a=void 0===a?!0:a;if(!this.reg.size)return"";for(var b="",c="",d=x(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=x(this.map.entries());for(var h=e.next();!h.done;h=e.next()){var f=h.value;h=f[0];f=f[1];for(var g="",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+"]";g+=(g?",":"")+m}g='["'+h+'",['+
g+"]]";d+=(d?",":"")+g}d="index.map=new Map(["+d+"]);";e="";h=x(this.ctx.entries());for(f=h.next();!f.done;f=h.next())for(g=f.value,f=g[0],g=x(g[1].entries()),k=g.next();!k.done;k=g.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};Na(O.prototype);var Hb="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),Ib=["map","ctx","tag","reg","cfg"];
function Jb(a,b){b=void 0===b?{}:b;if(!this)return new Jb(a,b);"object"===typeof a&&(b=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.support_tag_search=!1;this.db=null;this.h={}}u=Jb.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=Hb.open(a.id+(a.field?":"+a.field:""),1);d.onupgradeneeded=function(){var e=a.db=this.result;Ib.forEach(function(h){e.objectStoreNames.contains(h)||e.createObjectStore(h)})};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(){return Hb.deleteDatabase(this.id+(this.field?":"+this.field:""))};u.clear=function(){for(var a=this.db.transaction(Ib,"readwrite"),b=0;b<Ib.length;b++)a.objectStore(Ib[b]).clear();return Mb(a)};
u.get=function(a,b,c,d,e,h){c=void 0===c?0:c;d=void 0===d?0:d;e=void 0===e?!0:e;h=void 0===h?!1:h;a=this.db.transaction(b?"ctx":"map","readonly").objectStore(b?"ctx":"map").get(b?b+":"+a:a);var f=this;return Mb(a).then(function(g){var k=[];if(!g||!g.length)return k;if(e){if(!c&&!d&&1===g.length)return g[0];for(var l=0,m=void 0;l<g.length;l++)if((m=g[l])&&m.length)if(d>=m.length)d-=m.length;else{for(var n=c?d+Math.min(m.length-d,c):m.length,p=d;p<n;p++)k.push(m[p]);d=0;if(k.length===c)break}return h?
f.enrich(k):k}return g})};u.tag=function(a,b,c,d){b=void 0===b?0:b;c=void 0===c?0:c;d=void 0===d?!1:d;a=this.db.transaction("tag","readonly").objectStore("tag").get(a);var e=this;return Mb(a).then(function(h){if(!h||!h.length||c>=h.length)return[];if(!b&&!c)return h;h=h.slice(c,c+b);return d?e.enrich(h):h})};
u.enrich=function(a){"object"!==typeof a&&(a=[a]);for(var b=this.db.transaction("reg","readonly").objectStore("reg"),c=[],d=0;d<a.length;d++)c[d]=Mb(b.get(a[d]));return Promise.all(c).then(function(e){for(var h=0;h<e.length;h++)e[h]={id:a[h],doc:e[h]?JSON.parse(e[h]):null};return e})};u.has=function(a){a=this.db.transaction("reg","readonly").objectStore("reg").getKey(a);return Mb(a)};u.search=null;u.info=function(){};
u.transaction=function(a,b,c){var d=this,e=this.h[a+":"+b];if(e)return c.call(this,e);var h=this.db.transaction(a,b);this.h[a+":"+b]=e=h.objectStore(a);return new Promise(function(f,g){h.onerror=function(k){d.h[a+":"+b]=null;h.abort();h=e=null;g(k)};h.oncomplete=function(k){h=e=d.h[a+":"+b]=null;f(k||!0)};return c.call(d,e)})};
u.commit=function(a,b,c){var d=this,e,h,f;return I(function(g){switch(g.h){case 1:if(b)return G(g,d.clear(),12);e=a.commit_task;a.commit_task=[];h=0;f=void 0;case 4:if(!(h<e.length)){g.h=6;break}f=e[h];if(!f.clear){e[h]=f.pa;g.h=5;break}return G(g,d.clear(),8);case 8:b=!0;g.h=6;break;case 5:h++;g.h=4;break;case 6:if(b){g.h=3;break}c||(e=e.concat(wa(a.reg)));if(!e.length){g.h=10;break}return G(g,d.remove(e),11);case 11:case 10:g.h=3;break;case 12:a.commit_task=[];case 3:return a.reg.size?G(g,d.transaction("map",
"readwrite",function(k){for(var l=y(a.map),m=l.next(),n={};!m.done;n={O:void 0,Y:void 0},m=l.next())m=m.value,n.Y=m[0],n.O=m[1],n.O.length&&(b?k.put(n.O,n.Y):k.get(n.Y).onsuccess=function(p){return function(){var q=this.result,r;if(q&&q.length)for(var v=Math.max(q.length,p.O.length),w=0,x;w<v;w++){if((x=p.O[w])&&x.length){if((r=q[w])&&r.length)for(var t=0;t<x.length;t++)r.push(x[t]);else q[w]=x;r=1}}else q=p.O,r=1;r&&k.put(q,p.Y)}}(n))}),13):g.return();case 13:return G(g,d.transaction("ctx","readwrite",
function(k){for(var l=y(a.ctx),m=l.next(),n={};!m.done;n={W:void 0},m=l.next()){m=m.value;n.W=m[0];m=y(m[1]);for(var p=m.next(),q={};!p.done;q={P:void 0,Z:void 0},p=m.next())p=p.value,q.Z=p[0],q.P=p[1],q.P.length&&(b?k.put(q.P,n.W+":"+q.Z):k.get(n.W+":"+q.Z).onsuccess=function(r,v){return function(){var w=this.result,x;if(w&&w.length)for(var t=Math.max(w.length,r.P.length),z=0,A;z<t;z++){if((A=r.P[z])&&A.length){if((x=w[z])&&x.length)for(var B=0;B<A.length;B++)x.push(A[B]);else w[z]=A;x=1}}else w=
r.P,x=1;x&&k.put(w,v.W+":"+r.Z)}}(q,n))}}),14);case 14:if(a.store)return G(g,d.transaction("reg","readwrite",function(k){for(var l=y(a.store),m=l.next();!m.done;m=l.next()){var n=m.value;m=n[0];n=n[1];k.put("object"===typeof n?JSON.stringify(n):1,m)}}),16);if(a.bypass){g.h=16;break}return G(g,d.transaction("reg","readwrite",function(k){for(var l=y(a.reg.keys()),m=l.next();!m.done;m=l.next())k.put(1,m.value)}),16);case 16:if(!a.tag){g.h=20;break}return G(g,d.transaction("tag","readwrite",function(k){for(var l=
y(a.tag),m=l.next(),n={};!m.done;n={X:void 0,ba:void 0},m=l.next())m=m.value,n.ba=m[0],n.X=m[1],n.X.length&&(k.get(n.ba).onsuccess=function(p){return function(){var q=this.result;q=q&&q.length?q.concat(p.X):p.X;k.put(q,p.ba)}}(n))}),20);case 20:a.map.clear(),a.ctx.clear(),a.tag&&a.tag.clear(),a.store&&a.store.clear(),a.document||a.reg.clear(),g.h=0}})};
function Kb(a,b,c){for(var d=a.value,e,h,f=0,g=0,k;g<d.length;g++){if(k=c?d:d[g]){for(var l=0,m,n;l<b.length;l++)if(n=b[l],m=k.indexOf(h?parseInt(n,10):n),0>m&&!h&&"string"===typeof n&&!isNaN(n)&&(m=k.indexOf(parseInt(n,10)))&&(h=1),0<=m)if(e=1,1<k.length)k.splice(m,1);else{d[g]=[];break}f+=k.length}if(c)break}f?e&&a.update(d):a.delete();a.continue()}
u.remove=function(a){"object"!==typeof a&&(a=[a]);return Promise.all([this.transaction("map","readwrite",function(b){b.openCursor().onsuccess=function(){var c=this.result;c&&Kb(c,a)}}),this.transaction("ctx","readwrite",function(b){b.openCursor().onsuccess=function(){var c=this.result;c&&Kb(c,a)}}),this.transaction("tag","readwrite",function(b){b.openCursor().onsuccess=function(){var c=this.result;c&&Kb(c,a,!0)}}),this.transaction("reg","readwrite",function(b){for(var c=0;c<a.length;c++)b.delete(a[c])})])};
function Jb(a){return new Promise(function(b,c){a.onsuccess=function(){b(this.result)};a.oncomplete=function(){b(this.result)};a.onerror=c;a=null})};var Lb={Index:R,Charset:pb,Encoder:Ga,Document:V,Worker:Ka,Resolver:Y,IndexedDB:Gb,Language:{}},Mb=self,Nb;(Nb=Mb.define)&&Nb.amd?Nb([],function(){return Lb}):"object"===typeof Mb.exports?Mb.exports=Lb:Mb.FlexSearch=Lb;}(this||self));
u.commit=function(a,b,c){var d=this,e,h,f;return ta(function(g){switch(g.h){case 1:if(b)return G(g,d.clear(),12);e=a.commit_task;a.commit_task=[];h=0;f=void 0;case 4:if(!(h<e.length)){g.h=6;break}f=e[h];if(!f.clear){e[h]=f.pa;g.h=5;break}return G(g,d.clear(),8);case 8:b=!0;g.h=6;break;case 5:h++;g.h=4;break;case 6:if(b){g.h=3;break}c||(e=e.concat(ya(a.reg)));if(!e.length){g.h=10;break}return G(g,d.remove(e),11);case 11:case 10:g.h=3;break;case 12:a.commit_task=[];case 3:return a.reg.size?G(g,d.transaction("map",
"readwrite",function(k){for(var l=x(a.map),m=l.next(),n={};!m.done;n={O:void 0,Y:void 0},m=l.next())m=m.value,n.Y=m[0],n.O=m[1],n.O.length&&(b?k.put(n.O,n.Y):k.get(n.Y).onsuccess=function(p){return function(){var q=this.result,r;if(q&&q.length)for(var v=Math.max(q.length,p.O.length),w=0,y;w<v;w++){if((y=p.O[w])&&y.length){if((r=q[w])&&r.length)for(var t=0;t<y.length;t++)r.push(y[t]);else q[w]=y;r=1}}else q=p.O,r=1;r&&k.put(q,p.Y)}}(n))}),13):g.return();case 13:return G(g,d.transaction("ctx","readwrite",
function(k){for(var l=x(a.ctx),m=l.next(),n={};!m.done;n={W:void 0},m=l.next()){m=m.value;n.W=m[0];m=x(m[1]);for(var p=m.next(),q={};!p.done;q={P:void 0,Z:void 0},p=m.next())p=p.value,q.Z=p[0],q.P=p[1],q.P.length&&(b?k.put(q.P,n.W+":"+q.Z):k.get(n.W+":"+q.Z).onsuccess=function(r,v){return function(){var w=this.result,y;if(w&&w.length)for(var t=Math.max(w.length,r.P.length),z=0,A;z<t;z++){if((A=r.P[z])&&A.length){if((y=w[z])&&y.length)for(var B=0;B<A.length;B++)y.push(A[B]);else w[z]=A;y=1}}else w=
r.P,y=1;y&&k.put(w,v.W+":"+r.Z)}}(q,n))}}),14);case 14:if(a.store)return G(g,d.transaction("reg","readwrite",function(k){for(var l=x(a.store),m=l.next();!m.done;m=l.next()){var n=m.value;m=n[0];n=n[1];k.put("object"===typeof n?JSON.stringify(n):1,m)}}),16);if(a.bypass){g.h=16;break}return G(g,d.transaction("reg","readwrite",function(k){for(var l=x(a.reg.keys()),m=l.next();!m.done;m=l.next())k.put(1,m.value)}),16);case 16:if(!a.tag){g.h=20;break}return G(g,d.transaction("tag","readwrite",function(k){for(var l=
x(a.tag),m=l.next(),n={};!m.done;n={X:void 0,ba:void 0},m=l.next())m=m.value,n.ba=m[0],n.X=m[1],n.X.length&&(k.get(n.ba).onsuccess=function(p){return function(){var q=this.result;q=q&&q.length?q.concat(p.X):p.X;k.put(q,p.ba)}}(n))}),20);case 20:a.map.clear(),a.ctx.clear(),a.tag&&a.tag.clear(),a.store&&a.store.clear(),a.document||a.reg.clear(),g.h=0}})};
function Nb(a,b,c){for(var d=a.value,e,h,f=0,g=0,k;g<d.length;g++){if(k=c?d:d[g]){for(var l=0,m,n;l<b.length;l++)if(n=b[l],m=k.indexOf(h?parseInt(n,10):n),0>m&&!h&&"string"===typeof n&&!isNaN(n)&&(m=k.indexOf(parseInt(n,10)))&&(h=1),0<=m)if(e=1,1<k.length)k.splice(m,1);else{d[g]=[];break}f+=k.length}if(c)break}f?e&&a.update(d):a.delete();a.continue()}
u.remove=function(a){"object"!==typeof a&&(a=[a]);return Promise.all([this.transaction("map","readwrite",function(b){b.openCursor().onsuccess=function(){var c=this.result;c&&Nb(c,a)}}),this.transaction("ctx","readwrite",function(b){b.openCursor().onsuccess=function(){var c=this.result;c&&Nb(c,a)}}),this.transaction("tag","readwrite",function(b){b.openCursor().onsuccess=function(){var c=this.result;c&&Nb(c,a,!0)}}),this.transaction("reg","readwrite",function(b){for(var c=0;c<a.length;c++)b.delete(a[c])})])};
function Mb(a){return new Promise(function(b,c){a.onsuccess=function(){b(this.result)};a.oncomplete=function(){b(this.result)};a.onerror=c;a=null})};var Ob={Index:O,Charset:sb,Encoder:N,Document:V,Worker:R,Resolver:Y,IndexedDB:Jb,Language:{}},Pb=self,Qb;(Qb=Pb.define)&&Qb.amd?Qb([],function(){return Ob}):"object"===typeof Pb.exports?Pb.exports=Ob:Pb.FlexSearch=Ob;}(this||self));

View File

@@ -51,7 +51,7 @@ function v(a, c) {
}
;const w = /[^\p{L}\p{N}]+/u, x = /(\d{3})/g, y = /(\D)(\d{3})/g, z = /(\d{3})(\D)/g, B = "".normalize && /[\u0300-\u036f]/g;
function C(a) {
if (!this) {
if (this.constructor !== C) {
return new C(...arguments);
}
for (let c = 0; c < arguments.length; c++) {
@@ -509,7 +509,7 @@ function P(a, c) {
return b;
}
;function H(a, c) {
if (!this) {
if (this.constructor !== H) {
return new H(a);
}
if (a) {

View File

@@ -5,7 +5,7 @@
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
(function _f(self){'use strict';if(typeof module!=='undefined')self=module;else if(typeof process !== 'undefined')self=process;self._factory=_f;function t(a,c,b){const d=typeof b,e=typeof a;if("undefined"!==d){if("undefined"!==e){if(b){if("function"===e&&d===e)return function(h){return a(b(h))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var g=new Map(b);for(var f of a)g.set(f[0],f[1]);return g}if(c===Set){f=new Set(b);for(g of a.values())f.add(g);return f}}}return a}return b}return"undefined"===e?c:a}function u(){return Object.create(null)}function v(a,c){return c.length-a.length};const w=/[^\p{L}\p{N}]+/u,x=/(\d{3})/g,y=/(\D)(\d{3})/g,z=/(\d{3})(\D)/g,B="".normalize&&/[\u0300-\u036f]/g;function C(a){if(!this)return new C(...arguments);for(let c=0;c<arguments.length;c++)this.assign(arguments[c])}
(function _f(self){'use strict';if(typeof module!=='undefined')self=module;else if(typeof process !== 'undefined')self=process;self._factory=_f;function t(a,c,b){const d=typeof b,e=typeof a;if("undefined"!==d){if("undefined"!==e){if(b){if("function"===e&&d===e)return function(h){return a(b(h))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var g=new Map(b);for(var f of a)g.set(f[0],f[1]);return g}if(c===Set){f=new Set(b);for(g of a.values())f.add(g);return f}}}return a}return b}return"undefined"===e?c:a}function u(){return Object.create(null)}function v(a,c){return c.length-a.length};const w=/[^\p{L}\p{N}]+/u,x=/(\d{3})/g,y=/(\D)(\d{3})/g,z=/(\d{3})(\D)/g,B="".normalize&&/[\u0300-\u036f]/g;function C(a){if(this.constructor!==C)return new C(...arguments);for(let c=0;c<arguments.length;c++)this.assign(arguments[c])}
C.prototype.assign=function(a){this.normalize=t(a.normalize,!0,this.normalize);let c=a.include,b=c||a.exclude||a.split;if("object"===typeof b){let d=!c,e="";a.include||(e+="\\p{Z}");b.letter&&(e+="\\p{L}");b.number&&(e+="\\p{N}",d=!!c);b.symbol&&(e+="\\p{S}");b.punctuation&&(e+="\\p{P}");b.control&&(e+="\\p{C}");if(b=b.char)e+="object"===typeof b?b.join(""):b;try{this.split=new RegExp("["+(c?"^":"")+e+"]+","u")}catch(g){this.split=/\s+/}this.numeric=d}else{try{this.split=t(b,w,this.split)}catch(d){this.split=
/\s+/}this.numeric=t(this.numeric,!0)}this.prepare=t(a.prepare,null,this.prepare);this.finalize=t(a.finalize,null,this.finalize);this.rtl=a.rtl||!1;this.dedupe=t(a.dedupe,!0,this.dedupe);this.filter=t((b=a.filter)&&new Set(b),null,this.filter);this.matcher=t((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=t((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=t((b=a.stemmer)&&new Map(b),null,this.stemmer);this.replacer=t(a.replacer,null,this.replacer);this.minlength=t(a.minlength,1,this.minlength);
this.maxlength=t(a.maxlength,0,this.maxlength);if(this.cache=b=t(a.cache,!0,this.cache))this.j=null,this.v="number"===typeof b?b:2E5,this.h=new Map,this.i=new Map,this.l=this.g=128;this.m="";this.s=null;this.o="";this.u=null;if(this.matcher)for(const d of this.matcher.keys())this.m+=(this.m?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.o+=(this.o?"|":"")+d;return this};
@@ -19,7 +19,7 @@ function J(a,c,b,d,e,g,f){let h=f?a.ctx:a.map,k;if(!c[b]||f&&!(k=c[b])[f])f?(c=k
h=Math.max(h,n);k=k?Math.min(k,n):n}a=m;b=a.length}if(!b)return d;p=0;if(1===b)return M.call(this,a[0],"",c,e);if(2===b&&g&&!f)return M.call(this,a[0],a[1],c,e);if(1<b)if(g){var q=a[0];p=1}else 9<h&&3<h/k&&a.sort(v);for(let m,r;p<b;p++){r=a[p];q?(m=N(this,r,q),m=O(m,d,f,this.A),f&&!1===m&&d.length||(q=r)):(m=N(this,r,""),m=O(m,d,f,this.resolution));if(m)return m;if(f&&p===b-1){g=d.length;if(!g){if(q){q="";p=-1;continue}return d}if(1===g)return L(d[0],c,e)}}a:{a=d;d=this.resolution;q=f;b=a.length;
f=[];g=u();for(let m=0,r,l,n,A;m<d;m++)for(k=0;k<b;k++)if(n=a[k],m<n.length&&(r=n[m]))for(p=0;p<r.length;p++)l=r[p],(h=g[l])?g[l]++:(h=0,g[l]=1),A=f[h]||(f[h]=[]),A.push(l);if(a=f.length)if(q){if(1<f.length)b:for(a=[],d=u(),q=f.length,h=q-1;0<=h;h--)for(q=f[h],g=q.length,k=0;k<g;k++){if(b=q[k],!d[b])if(d[b]=1,e)e--;else if(a.push(b),a.length===c)break b}else a=(f=f[0]).length>c||e?f.slice(e,c+e):f;f=a}else{if(a<b){d=[];break a}f=f[a-1];if(c||e)if(f.length>c||e)f=f.slice(e,c+e)}d=f}return d};
function M(a,c,b,d){return(a=N(this,a,c))&&a.length?L(a,b,d):[]}function O(a,c,b,d){let e=[];if(a){d=Math.min(a.length,d);for(let g=0,f;g<d;g++)(f=a[g])&&f&&(e[g]=f);if(e.length){c.push(e);return}}return!b&&e}function N(a,c,b){let d;b&&(d=a.bidirectional&&c>b);a=b?(a=a.ctx.get(d?c:b))&&a.get(d?b:c):a.map.get(c);return a};H.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 d=0,e;d<b.length;d++){if(e=b[d])if(2>e.length)e.pop();else{const g=e.indexOf(a);g===b.length-1?e.pop():e.splice(g,1)}}else P(this.map,a),this.depth&&P(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function P(a,c){let b=0;if(a.constructor===Array)for(let d=0,e,g;d<a.length;d++){if((e=a[d])&&e.length)if(g=e.indexOf(c),0<=g){1<e.length?(e.splice(g,1),b++):delete a[d];break}else b++}else for(let d of a){const e=d[0],g=P(d[1],c);g?b+=g:a.delete(e)}return b};function H(a,c){if(!this)return new H(a);if(a){var b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},G[b],a))}else a={};b=a.context||{};const d=a.encode||a.encoder||F;this.encoder=d.encode?d:"object"===typeof d?new C(d):{encode:d};let e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&b.depth||0;this.bidirectional=!1!==b.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;e=!1;this.map=new Map;this.ctx=new Map;this.reg=c||(this.fastupdate?
new Map:new Set);this.A=b.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new E(e)}H.prototype.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};H.prototype.append=function(a,c){return this.add(a,c,!0)};H.prototype.contain=function(a){return this.reg.has(a)};H.prototype.update=function(a,c){const b=this,d=this.remove(a);return d&&d.then?d.then(()=>b.add(a,c)):this.add(a,c)};
function P(a,c){let b=0;if(a.constructor===Array)for(let d=0,e,g;d<a.length;d++){if((e=a[d])&&e.length)if(g=e.indexOf(c),0<=g){1<e.length?(e.splice(g,1),b++):delete a[d];break}else b++}else for(let d of a){const e=d[0],g=P(d[1],c);g?b+=g:a.delete(e)}return b};function H(a,c){if(this.constructor!==H)return new H(a);if(a){var b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},G[b],a))}else a={};b=a.context||{};const d=a.encode||a.encoder||F;this.encoder=d.encode?d:"object"===typeof d?new C(d):{encode:d};let e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&b.depth||0;this.bidirectional=!1!==b.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;e=!1;this.map=new Map;this.ctx=new Map;this.reg=
c||(this.fastupdate?new Map:new Set);this.A=b.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new E(e)}H.prototype.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};H.prototype.append=function(a,c){return this.add(a,c,!0)};H.prototype.contain=function(a){return this.reg.has(a)};H.prototype.update=function(a,c){const b=this,d=this.remove(a);return d&&d.then?d.then(()=>b.add(a,c)):this.add(a,c)};
function Q(a){let c=0;if(a.constructor===Array)for(let b=0,d;b<a.length;b++)(d=a[b])&&(c+=d.length);else for(const b of a){const d=b[0],e=Q(b[1]);e?c+=e:a.delete(d)}return c}H.prototype.cleanup=function(){if(!this.fastupdate)return this;Q(this.map);this.depth&&Q(this.ctx);return this};
H.prototype.searchCache=function(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();let d=this.cache.get(a);if(!d){d=this.search(a,c,b);if(d.then){const e=this;d.then(function(g){e.cache.set(a,g);return g})}this.cache.set(a,d)}return d};const R={Index:H,Charset:null,Encoder:C,Document:null,Worker:null,Resolver:null,IndexedDB:null,Language:{}},S=self;let T;(T=S.define)&&T.amd?T([],function(){return R}):"object"===typeof S.exports?S.exports=R:S.FlexSearch=R;}(this||self));

View File

@@ -50,7 +50,7 @@ function v(a, c) {
}
;const w = /[^\p{L}\p{N}]+/u, x = /(\d{3})/g, y = /(\D)(\d{3})/g, z = /(\d{3})(\D)/g, B = "".normalize && /[\u0300-\u036f]/g;
function C(a) {
if (!this) {
if (this.constructor !== C) {
return new C(...arguments);
}
for (let c = 0; c < arguments.length; c++) {
@@ -508,7 +508,7 @@ function P(a, c) {
return b;
}
;function H(a, c) {
if (!this) {
if (this.constructor !== H) {
return new H(a);
}
if (a) {

View File

@@ -5,7 +5,7 @@
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
function t(a,c,b){const d=typeof b,e=typeof a;if("undefined"!==d){if("undefined"!==e){if(b){if("function"===e&&d===e)return function(h){return a(b(h))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var g=new Map(b);for(var f of a)g.set(f[0],f[1]);return g}if(c===Set){f=new Set(b);for(g of a.values())f.add(g);return f}}}return a}return b}return"undefined"===e?c:a}function u(){return Object.create(null)}function v(a,c){return c.length-a.length};const w=/[^\p{L}\p{N}]+/u,x=/(\d{3})/g,y=/(\D)(\d{3})/g,z=/(\d{3})(\D)/g,B="".normalize&&/[\u0300-\u036f]/g;function C(a){if(!this)return new C(...arguments);for(let c=0;c<arguments.length;c++)this.assign(arguments[c])}
function t(a,c,b){const d=typeof b,e=typeof a;if("undefined"!==d){if("undefined"!==e){if(b){if("function"===e&&d===e)return function(h){return a(b(h))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var g=new Map(b);for(var f of a)g.set(f[0],f[1]);return g}if(c===Set){f=new Set(b);for(g of a.values())f.add(g);return f}}}return a}return b}return"undefined"===e?c:a}function u(){return Object.create(null)}function v(a,c){return c.length-a.length};const w=/[^\p{L}\p{N}]+/u,x=/(\d{3})/g,y=/(\D)(\d{3})/g,z=/(\d{3})(\D)/g,B="".normalize&&/[\u0300-\u036f]/g;function C(a){if(this.constructor!==C)return new C(...arguments);for(let c=0;c<arguments.length;c++)this.assign(arguments[c])}
C.prototype.assign=function(a){this.normalize=t(a.normalize,!0,this.normalize);let c=a.include,b=c||a.exclude||a.split;if("object"===typeof b){let d=!c,e="";a.include||(e+="\\p{Z}");b.letter&&(e+="\\p{L}");b.number&&(e+="\\p{N}",d=!!c);b.symbol&&(e+="\\p{S}");b.punctuation&&(e+="\\p{P}");b.control&&(e+="\\p{C}");if(b=b.char)e+="object"===typeof b?b.join(""):b;try{this.split=new RegExp("["+(c?"^":"")+e+"]+","u")}catch(g){this.split=/\s+/}this.numeric=d}else{try{this.split=t(b,w,this.split)}catch(d){this.split=
/\s+/}this.numeric=t(this.numeric,!0)}this.prepare=t(a.prepare,null,this.prepare);this.finalize=t(a.finalize,null,this.finalize);this.rtl=a.rtl||!1;this.dedupe=t(a.dedupe,!0,this.dedupe);this.filter=t((b=a.filter)&&new Set(b),null,this.filter);this.matcher=t((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=t((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=t((b=a.stemmer)&&new Map(b),null,this.stemmer);this.replacer=t(a.replacer,null,this.replacer);this.minlength=t(a.minlength,1,this.minlength);
this.maxlength=t(a.maxlength,0,this.maxlength);if(this.cache=b=t(a.cache,!0,this.cache))this.j=null,this.v="number"===typeof b?b:2E5,this.h=new Map,this.i=new Map,this.l=this.g=128;this.m="";this.s=null;this.o="";this.u=null;if(this.matcher)for(const d of this.matcher.keys())this.m+=(this.m?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.o+=(this.o?"|":"")+d;return this};
@@ -19,8 +19,8 @@ function K(a,c,b,d,e,g,f){let h=f?a.ctx:a.map,k;if(!c[b]||f&&!(k=c[b])[f])f?(c=k
h=Math.max(h,n);k=k?Math.min(k,n):n}a=m;b=a.length}if(!b)return d;p=0;if(1===b)return M.call(this,a[0],"",c,e);if(2===b&&g&&!f)return M.call(this,a[0],a[1],c,e);if(1<b)if(g){var q=a[0];p=1}else 9<h&&3<h/k&&a.sort(v);for(let m,r;p<b;p++){r=a[p];q?(m=N(this,r,q),m=O(m,d,f,this.A),f&&!1===m&&d.length||(q=r)):(m=N(this,r,""),m=O(m,d,f,this.resolution));if(m)return m;if(f&&p===b-1){g=d.length;if(!g){if(q){q="";p=-1;continue}return d}if(1===g)return L(d[0],c,e)}}a:{a=d;d=this.resolution;q=f;b=a.length;
f=[];g=u();for(let m=0,r,l,n,A;m<d;m++)for(k=0;k<b;k++)if(n=a[k],m<n.length&&(r=n[m]))for(p=0;p<r.length;p++)l=r[p],(h=g[l])?g[l]++:(h=0,g[l]=1),A=f[h]||(f[h]=[]),A.push(l);if(a=f.length)if(q){if(1<f.length)b:for(a=[],d=u(),q=f.length,h=q-1;0<=h;h--)for(q=f[h],g=q.length,k=0;k<g;k++){if(b=q[k],!d[b])if(d[b]=1,e)e--;else if(a.push(b),a.length===c)break b}else a=(f=f[0]).length>c||e?f.slice(e,c+e):f;f=a}else{if(a<b){d=[];break a}f=f[a-1];if(c||e)if(f.length>c||e)f=f.slice(e,c+e)}d=f}return d};
function M(a,c,b,d){return(a=N(this,a,c))&&a.length?L(a,b,d):[]}function O(a,c,b,d){let e=[];if(a){d=Math.min(a.length,d);for(let g=0,f;g<d;g++)(f=a[g])&&f&&(e[g]=f);if(e.length){c.push(e);return}}return!b&&e}function N(a,c,b){let d;b&&(d=a.bidirectional&&c>b);a=b?(a=a.ctx.get(d?c:b))&&a.get(d?b:c):a.map.get(c);return a};I.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 d=0,e;d<b.length;d++){if(e=b[d])if(2>e.length)e.pop();else{const g=e.indexOf(a);g===b.length-1?e.pop():e.splice(g,1)}}else P(this.map,a),this.depth&&P(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function P(a,c){let b=0;if(a.constructor===Array)for(let d=0,e,g;d<a.length;d++){if((e=a[d])&&e.length)if(g=e.indexOf(c),0<=g){1<e.length?(e.splice(g,1),b++):delete a[d];break}else b++}else for(let d of a){const e=d[0],g=P(d[1],c);g?b+=g:a.delete(e)}return b};function I(a,c){if(!this)return new I(a);if(a){var b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},G[b],a))}else a={};b=a.context||{};const d=a.encode||a.encoder||F;this.encoder=d.encode?d:"object"===typeof d?new C(d):{encode:d};let e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&b.depth||0;this.bidirectional=!1!==b.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;e=!1;this.map=new Map;this.ctx=new Map;this.reg=c||(this.fastupdate?
new Map:new Set);this.A=b.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new E(e)}I.prototype.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};I.prototype.append=function(a,c){return this.add(a,c,!0)};I.prototype.contain=function(a){return this.reg.has(a)};I.prototype.update=function(a,c){const b=this,d=this.remove(a);return d&&d.then?d.then(()=>b.add(a,c)):this.add(a,c)};
function P(a,c){let b=0;if(a.constructor===Array)for(let d=0,e,g;d<a.length;d++){if((e=a[d])&&e.length)if(g=e.indexOf(c),0<=g){1<e.length?(e.splice(g,1),b++):delete a[d];break}else b++}else for(let d of a){const e=d[0],g=P(d[1],c);g?b+=g:a.delete(e)}return b};function I(a,c){if(this.constructor!==I)return new I(a);if(a){var b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},G[b],a))}else a={};b=a.context||{};const d=a.encode||a.encoder||F;this.encoder=d.encode?d:"object"===typeof d?new C(d):{encode:d};let e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&b.depth||0;this.bidirectional=!1!==b.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;e=!1;this.map=new Map;this.ctx=new Map;this.reg=
c||(this.fastupdate?new Map:new Set);this.A=b.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new E(e)}I.prototype.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();this.cache&&this.cache.clear();return this};I.prototype.append=function(a,c){return this.add(a,c,!0)};I.prototype.contain=function(a){return this.reg.has(a)};I.prototype.update=function(a,c){const b=this,d=this.remove(a);return d&&d.then?d.then(()=>b.add(a,c)):this.add(a,c)};
function Q(a){let c=0;if(a.constructor===Array)for(let b=0,d;b<a.length;b++)(d=a[b])&&(c+=d.length);else for(const b of a){const d=b[0],e=Q(b[1]);e?c+=e:a.delete(d)}return c}I.prototype.cleanup=function(){if(!this.fastupdate)return this;Q(this.map);this.depth&&Q(this.ctx);return this};
I.prototype.searchCache=function(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();let d=this.cache.get(a);if(!d){d=this.search(a,c,b);if(d.then){const e=this;d.then(function(g){e.cache.set(a,g);return g})}this.cache.set(a,d)}return d};export default {Index:I,Charset:null,Encoder:C,Document:null,Worker:null,Resolver:null,IndexedDB:null,Language:{}};
export const Index=I;export const Charset=null;export const Encoder=C;export const Document=null;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};

View File

@@ -24,7 +24,7 @@ import "./document/search.js";
export default function Document(options) {
if (!this) {
if (this.constructor !== Document) {
return new Document(options);
}
@@ -40,9 +40,8 @@ export default function Document(options) {
keystore = options.keystore || 0;
keystore && (this.keystore = keystore);
this.fastupdate = !!options.fastupdate;
this.reg = this.fastupdate ? keystore && /* tag? */ /* stringify */ /* stringify */ /* single param */ /* skip update: */ /* append: */ /* skip update: */ /* skip_update: */
/* skip deletion */!0 /*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/ ? new KeystoreMap(keystore) : new Map() : keystore && !0 ? new KeystoreSet(keystore) : new Set();
this.reg = this.fastupdate ? keystore && /* tag? */ /* stringify */ /* stringify */ /* single param */ /* skip update: */ /* append: */ /* skip update: */
/* skip_update: */ /* skip deletion */!0 /*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/ ? new KeystoreMap(keystore) : new Map() : keystore && !0 ? new KeystoreSet(keystore) : new Set();
// todo support custom filter function
this.storetree = (tmp = document.store || null) && !0 !== tmp && [];
@@ -194,9 +193,11 @@ Document.prototype.commit = async function (replace, append) {
// queued:
// for(const index of this.index.values()){
// await index.db.commit(index, replace, append);
// }
// this.reg.clear();
};Document.prototype.destroy = function () {
};
Document.prototype.destroy = function () {
const promises = [];
for (const idx of this.index.values()) {
promises.push(idx.destroy());

View File

@@ -61,7 +61,7 @@ const whitespace = /[^\p{L}\p{N}]+/u,
export default function Encoder() {
if (!this) {
if (this.constructor !== Encoder) {
return new Encoder(...arguments);
}

View File

@@ -29,7 +29,7 @@ import "./index/remove.js";
export default function Index(options, _register) {
if (!this) {
if (this.constructor !== Index) {
return new Index(options);
}

View File

@@ -12,7 +12,7 @@ import "./resolve/not.js";
*/
export default function Resolver(result) {
if (!this) {
if (this.constructor !== Resolver) {
return new Resolver(result);
}
if (result && result.index) {

View File

@@ -1,110 +1,89 @@
// TODO return promises instead of inner await
import Index from "./index.js";
import Document from "./document.js";
import { create_object, is_string } from "./common.js";
function async(callback, self, field, key, index_doc, index, data, on_done) {
function map_to_json(map) {
const json = [];
for (const item of map.entries()) {
json.push(item);
}
return json;
}
//setTimeout(function(){
function ctx_to_json(ctx) {
const json = [];
for (const item of ctx.entries()) {
json.push(map_to_json(item));
}
return json;
}
function reg_to_json(reg) {
const json = [];
for (const key of reg.keys()) {
json.push(key);
}
return json;
}
function save(callback, field, key, index_doc, index, data) {
const res = callback(field ? field + "." + key : key, JSON.stringify(data));
// await isn't supported by ES5
if (res && res.then) {
res.then(function () {
self.export(callback, self, field, index_doc, index + 1, on_done);
const self = this;
return res.then(function () {
return self.export(callback, field, index_doc, index + 1);
});
} else {
self.export(callback, self, field, index_doc, index + 1, on_done);
}
//});
return this.export(callback, field, index_doc, index + 1);
}
/**
* @param callback
* @param self
* @param field
* @param index_doc
* @param index
* @param on_done
* @this {Index|Document}
*/
export function exportIndex(callback, self, field, index_doc, index, on_done) {
let return_value = /* tag? */ /* stringify */ /* stringify */ /* single param */ /* skip update: */ /* append: */ /* skip update: */ /* skip_update: */ /* skip deletion */ // splice:
!0 /*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/;
if ('undefined' == typeof on_done) {
return_value = new Promise(resolve => {
on_done = resolve;
});
}
export function exportIndex(callback, field, index_doc, index = 0) {
let key, data;
switch (index || (index = 0)) {
switch (index) {
case 0:
key = "reg";
// fastupdate isn't supported by export
if (this.fastupdate) {
data = create_object();
for (let key of this.reg.keys()) {
data[key] = 1;
}
} else {
data = this.reg;
}
data = reg_to_json(this.reg);
break;
case 1:
key = "cfg";
data = {
doc: 0,
opt: this.optimize ? 1 : 0
};
data = {};
break;
case 2:
key = "map";
data = this.map;
data = map_to_json(this.map);
break;
case 3:
key = "ctx";
data = this.ctx;
data = ctx_to_json(this.ctx);
break;
default:
if ('undefined' == typeof field && on_done) {
on_done();
}
return;
}
async(callback, self || this, field, key, index_doc, index, data, on_done);
return return_value;
return save.call(this, callback, field, key, index_doc, index, data);
}
/**
@@ -114,38 +93,32 @@ export function exportIndex(callback, self, field, index_doc, index, on_done) {
export function importIndex(key, data) {
if (!data) {
return;
}
if (is_string(data)) {
data = JSON.parse(data);
}
switch (key) {
case "cfg":
this.optimize = !!data.opt;
break;
case "reg":
// fastupdate isn't supported by import
// fast update isn't supported by export/import
this.fastupdate = /* suggest */ /* append: */ /* enrich */!1;
this.reg = data;
this.reg = new Set(data);
break;
case "map":
this.map = data;
this.map = new Map(data);
break;
case "ctx":
this.ctx = data;
this.ctx = new Map(data);
break;
}
}
@@ -154,71 +127,63 @@ export function importIndex(key, data) {
* @this Document
*/
export function exportDocument(callback, self, field, index_doc, index, on_done) {
let return_value;
if ('undefined' == typeof on_done) {
return_value = new Promise(resolve => {
on_done = resolve;
});
}
index || (index = 0);
index_doc || (index_doc = 0);
export function exportDocument(callback, field, index_doc = 0, index = 0) {
if (index_doc < this.field.length) {
const field = this.field[index_doc],
idx = this.index[field];
idx = this.index.get(field),
res = idx.export(callback, field, index_doc, index = 1);
// start from index 1, because document indexes does not additionally store register
self = this;
//setTimeout(function(){
if (!idx.export(callback, self, index ? field /*.replace(":", "-")*/ : "", index_doc, index++, on_done)) {
index_doc++;
index = 1;
self.export(callback, self, field, index_doc, index, on_done);
if (res && res.then) {
const self = this;
return res.then(function () {
return self.export(callback, field, index_doc + 1, index = 0);
});
}
//});
return this.export(callback, field, index_doc + 1, index = 0);
} else {
let key, data;
switch (index) {
case 0:
key = "reg";
data = reg_to_json(this.reg);
field = null;
break;
case 1:
key = "tag";
data = this.tagindex;
data = ctx_to_json(this.tag);
field = null;
break;
case 2:
key = "store";
data = this.store;
key = "doc";
data = map_to_json(this.store);
field = null;
break;
// case 3:
//
// key = "reg";
// data = this.register;
// break;
case 3:
key = "cfg";
data = {};
field = null;
break;
default:
on_done();
return;
}
async(callback, this, field, key, index_doc, index, data, on_done);
return save.call(this, callback, field, key, index_doc, index, data);
}
return return_value;
}
/**
@@ -228,12 +193,9 @@ export function exportDocument(callback, self, field, index_doc, index, on_done)
export function importDocument(key, data) {
if (!data) {
return;
}
if (is_string(data)) {
data = JSON.parse(data);
}
@@ -241,28 +203,26 @@ export function importDocument(key, data) {
case "tag":
this.tagindex = data;
this.tagindex = new Map(data);
break;
case "reg":
// fastupdate isn't supported by import
// fast update isn't supported by export/import
this.fastupdate = !1;
this.reg = data;
this.reg = new Set(data);
for (let i = 0, index; i < this.field.length; i++) {
index = this.index[this.field[i]];
index.reg = data;
index.fastupdate = !1;
for (let i = 0, idx; i < this.field.length; i++) {
idx = this.index.get(this.field[i]);
idx.fastupdate = !1;
idx.reg = this.reg;
}
break;
case "store":
case "doc":
this.store = data;
this.store = new Map(data);
break;
default:
@@ -272,8 +232,7 @@ export function importDocument(key, data) {
key = key[1];
if (field && key) {
this.index[field].import(key, data);
this.index.get(field).import(key, data);
}
}
}
@@ -290,7 +249,8 @@ ctx: "gulliver+travel:1,2,3|4,5,6|7,8,9;"
* @return {string}
*/
export function serialize(withFunctionWrapper = !0) {
export function serialize(withFunctionWrapper = /* tag? */ /* stringify */ /* stringify */ /* single param */ /* skip update: */ /* append: */ /* skip update: */ /* skip_update: */ /* skip deletion */ // splice:
!0 /*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/) {
if (!this.reg.size) return "";

View File

@@ -11,7 +11,7 @@ let pid = 0;
export default function WorkerIndex(options = {}) {
if (!this) {
if (this.constructor !== WorkerIndex) {
return new WorkerIndex(options);
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
import{IndexOptions,ContextOptions}from"./type.js";import Encoder from"./encoder.js";import Cache,{searchCache}from"./cache.js";import Charset from"./charset.js";import{KeystoreMap,KeystoreSet}from"./keystore.js";import{is_array,is_string}from"./common.js";import{exportIndex,importIndex,serialize}from"./serialize.js";import default_encoder from"./charset/latin/default.js";import apply_preset from"./preset.js";import apply_async from"./async.js";import tick from"./profiler.js";import"./index/add.js";import"./index/search.js";import"./index/remove.js";export default function Index(a,b){if(!this)return new Index(a);!1,a=a?apply_preset(a):{};const c=a.context||{},d=is_string(a.encoder)?Charset[a.encoder]:a.encode||a.encoder||default_encoder;this.encoder=d.encode?d:"object"==typeof d?new Encoder(d):{encode:d},this.compress=a.compress||a.compression||!1;let e;this.resolution=a.resolution||9,this.tokenize=e=a.tokenize||"strict",this.depth="strict"===e&&c.depth||0,this.bidirectional=!1!==c.bidirectional,this.fastupdate=!!a.fastupdate,this.score=a.score||null,e=a.keystore||0,e&&(this.keystore=e),this.map=e&&!0?new KeystoreMap(e):new Map,this.ctx=e&&!0?new KeystoreMap(e):new Map,this.reg=b||(this.fastupdate?e&&!0?new KeystoreMap(e):new Map:e&&!0?new KeystoreSet(e):new Set),this.resolution_ctx=c.resolution||1,this.rtl=d.rtl||a.rtl||!1,this.cache=(e=a.cache||null)&&new Cache(e),this.resolve=!1!==a.resolve,(e=a.db)&&(this.db=this.mount(e)),this.commit_auto=!1!==a.commit,this.commit_task=[],this.commit_timer=null}Index.prototype.mount=function(a){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),a.mount(this)},Index.prototype.commit=function(a,b){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.commit(this,a,b)},Index.prototype.destroy=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.destroy()};export function autoCommit(a,b,c){a.commit_timer||(a.commit_timer=setTimeout(function(){a.commit_timer=null,a.db.commit(a,b,c)},0))}Index.prototype.clear=function(){return 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}]),this},Index.prototype.append=function(a,b){return this.add(a,b,!0)},Index.prototype.contain=function(a){return this.db?this.db.has(a):this.reg.has(a)},Index.prototype.update=function(a,b){const c=this,d=this.remove(a);return d&&d.then?d.then(()=>c.add(a,b)):this.add(a,b)};function cleanup_index(a){let b=0;if(is_array(a))for(let c,d=0;d<a.length;d++)(c=a[d])&&(b+=c.length);else for(const c of a){const d=c[0],e=c[1],f=cleanup_index(e);f?b+=f:a.delete(d)}return b}Index.prototype.cleanup=function(){return this.fastupdate?(cleanup_index(this.map),this.depth&&cleanup_index(this.ctx),this):(!1,this)},Index.prototype.searchCache=searchCache,Index.prototype.export=exportIndex,Index.prototype.import=importIndex,Index.prototype.serialize=serialize,apply_async(Index.prototype);
import{IndexOptions,ContextOptions}from"./type.js";import Encoder from"./encoder.js";import Cache,{searchCache}from"./cache.js";import Charset from"./charset.js";import{KeystoreMap,KeystoreSet}from"./keystore.js";import{is_array,is_string}from"./common.js";import{exportIndex,importIndex,serialize}from"./serialize.js";import default_encoder from"./charset/latin/default.js";import apply_preset from"./preset.js";import apply_async from"./async.js";import tick from"./profiler.js";import"./index/add.js";import"./index/search.js";import"./index/remove.js";export default function Index(a,b){if(this.constructor!==Index)return new Index(a);!1,a=a?apply_preset(a):{};const c=a.context||{},d=is_string(a.encoder)?Charset[a.encoder]:a.encode||a.encoder||default_encoder;this.encoder=d.encode?d:"object"==typeof d?new Encoder(d):{encode:d},this.compress=a.compress||a.compression||!1;let e;this.resolution=a.resolution||9,this.tokenize=e=a.tokenize||"strict",this.depth="strict"===e&&c.depth||0,this.bidirectional=!1!==c.bidirectional,this.fastupdate=!!a.fastupdate,this.score=a.score||null,e=a.keystore||0,e&&(this.keystore=e),this.map=e&&!0?new KeystoreMap(e):new Map,this.ctx=e&&!0?new KeystoreMap(e):new Map,this.reg=b||(this.fastupdate?e&&!0?new KeystoreMap(e):new Map:e&&!0?new KeystoreSet(e):new Set),this.resolution_ctx=c.resolution||1,this.rtl=d.rtl||a.rtl||!1,this.cache=(e=a.cache||null)&&new Cache(e),this.resolve=!1!==a.resolve,(e=a.db)&&(this.db=this.mount(e)),this.commit_auto=!1!==a.commit,this.commit_task=[],this.commit_timer=null}Index.prototype.mount=function(a){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),a.mount(this)},Index.prototype.commit=function(a,b){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.commit(this,a,b)},Index.prototype.destroy=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.destroy()};export function autoCommit(a,b,c){a.commit_timer||(a.commit_timer=setTimeout(function(){a.commit_timer=null,a.db.commit(a,b,c)},0))}Index.prototype.clear=function(){return 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}]),this},Index.prototype.append=function(a,b){return this.add(a,b,!0)},Index.prototype.contain=function(a){return this.db?this.db.has(a):this.reg.has(a)},Index.prototype.update=function(a,b){const c=this,d=this.remove(a);return d&&d.then?d.then(()=>c.add(a,b)):this.add(a,b)};function cleanup_index(a){let b=0;if(is_array(a))for(let c,d=0;d<a.length;d++)(c=a[d])&&(b+=c.length);else for(const c of a){const d=c[0],e=c[1],f=cleanup_index(e);f?b+=f:a.delete(d)}return b}Index.prototype.cleanup=function(){return this.fastupdate?(cleanup_index(this.map),this.depth&&cleanup_index(this.ctx),this):(!1,this)},Index.prototype.searchCache=searchCache,Index.prototype.export=exportIndex,Index.prototype.import=importIndex,Index.prototype.serialize=serialize,apply_async(Index.prototype);

View File

@@ -1 +1 @@
import default_resolver from"./resolve/default.js";import{set_resolve}from"./index/search.js";import{ResolverOptions}from"./type.js";import"./resolve/or.js";import"./resolve/and.js";import"./resolve/xor.js";import"./resolve/not.js";export default function Resolver(a){return this?a&&a.index?(a.resolve=!1,this.index=a.index,this.boostval=a.boost||0,this.result=a.index.search(a).result,this):a.constructor===Resolver?a:void(this.index=null,this.result=a||[],this.boostval=0):new Resolver(a)}Resolver.prototype.limit=function(a){if(this.result.length){const b=[];let c=0;for(let d,e=0;e<this.result.length;e++)if(d=this.result[e],d.length+c<a)b[e]=d,c+=d.length;else{b[e]=d.slice(0,a-c),this.result=b;break}}return this},Resolver.prototype.offset=function(a){if(this.result.length){const b=[];let c=0;for(let d,e=0;e<this.result.length;e++)d=this.result[e],d.length+c<a?c+=d.length:(b[e]=d.slice(a-c),c=a);this.result=b}return this},Resolver.prototype.boost=function(a){return this.boostval+=a,this},Resolver.prototype.resolve=function(a,b,c){set_resolve(1);const d=this.result;return this.index=null,this.result=null,d.length?("object"==typeof a&&(c=a.enrich,b=a.offset,a=a.limit),default_resolver(d,a||100,b,c)):d};
import default_resolver from"./resolve/default.js";import{set_resolve}from"./index/search.js";import{ResolverOptions}from"./type.js";import"./resolve/or.js";import"./resolve/and.js";import"./resolve/xor.js";import"./resolve/not.js";export default function Resolver(a){return this.constructor===Resolver?a&&a.index?(a.resolve=!1,this.index=a.index,this.boostval=a.boost||0,this.result=a.index.search(a).result,this):a.constructor===Resolver?a:void(this.index=null,this.result=a||[],this.boostval=0):new Resolver(a)}Resolver.prototype.limit=function(a){if(this.result.length){const b=[];let c=0;for(let d,e=0;e<this.result.length;e++)if(d=this.result[e],d.length+c<a)b[e]=d,c+=d.length;else{b[e]=d.slice(0,a-c),this.result=b;break}}return this},Resolver.prototype.offset=function(a){if(this.result.length){const b=[];let c=0;for(let d,e=0;e<this.result.length;e++)d=this.result[e],d.length+c<a?c+=d.length:(b[e]=d.slice(a-c),c=a);this.result=b}return this},Resolver.prototype.boost=function(a){return this.boostval+=a,this},Resolver.prototype.resolve=function(a,b,c){set_resolve(1);const d=this.result;return this.index=null,this.result=null,d.length?("object"==typeof a&&(c=a.enrich,b=a.offset,a=a.limit),default_resolver(d,a||100,b,c)):d};

View File

@@ -1 +1 @@
import Index from"./index.js";import Document from"./document.js";import{create_object,is_string}from"./common.js";function async(a,b,c,d,e,f,g,h){const i=a(c?c+"."+d:d,JSON.stringify(g));i&&i.then?i.then(function(){b.export(a,b,c,e,f+1,h)}):b.export(a,b,c,e,f+1,h)}export function exportIndex(a,b,c,d,e,f){let g=!0;"undefined"==typeof f&&(g=new Promise(a=>{f=a}));let h,i;switch(e||(e=0)){case 0:if(h="reg",this.fastupdate){i=create_object();for(let a of this.reg.keys())i[a]=1}else i=this.reg;break;case 1:h="cfg",i={doc:0,opt:this.optimize?1:0};break;case 2:h="map",i=this.map;break;case 3:h="ctx",i=this.ctx;break;default:return void("undefined"==typeof c&&f&&f());}return async(a,b||this,c,h,d,e,i,f),g}export function importIndex(a,b){b&&(is_string(b)&&(b=JSON.parse(b)),"cfg"===a?this.optimize=!!b.opt:"reg"===a?(this.fastupdate=!1,this.reg=b):"map"===a?this.map=b:"ctx"===a?this.ctx=b:void 0)}export function exportDocument(a,b,c,d,e,f){let g;if("undefined"==typeof f&&(g=new Promise(a=>{f=a})),e||(e=0),d||(d=0),d<this.field.length){const c=this.field[d],g=this.index[c];b=this,g.export(a,b,e?c:"",d,e++,f)||(d++,e=1,b.export(a,b,c,d,e,f))}else{let b,g;switch(e){case 1:b="tag",g=this.tagindex,c=null;break;case 2:b="store",g=this.store,c=null;break;default:return void f();}async(a,this,c,b,d,e,g,f)}return g}export function importDocument(a,b){if(b)switch(is_string(b)&&(b=JSON.parse(b)),a){case"tag":this.tagindex=b;break;case"reg":this.fastupdate=!1,this.reg=b;for(let a,c=0;c<this.field.length;c++)a=this.index[this.field[c]],a.reg=b,a.fastupdate=!1;break;case"store":this.store=b;break;default:a=a.split(".");const c=a[0];a=a[1],c&&a&&this.index[c].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{create_object,is_string}from"./common.js";function map_to_json(a){const b=[];for(const c of a.entries())b.push(c);return b}function ctx_to_json(a){const b=[];for(const c of a.entries())b.push(map_to_json(c));return b}function reg_to_json(a){const b=[];for(const c of a.keys())b.push(c);return b}function save(a,b,c,d,e,f){const g=a(b?b+"."+c:c,JSON.stringify(f));if(g&&g.then){const c=this;return g.then(function(){return c.export(a,b,d,e+1)})}return this.export(a,b,d,e+1)}export function exportIndex(a,b,c,d=0){let e,f;switch(d){case 0:e="reg",f=reg_to_json(this.reg);break;case 1:e="cfg",f={};break;case 2:e="map",f=map_to_json(this.map);break;case 3:e="ctx",f=ctx_to_json(this.ctx);break;default:return;}return save.call(this,a,b,e,c,d,f)}export function importIndex(a,b){if(b)switch(is_string(b)&&(b=JSON.parse(b)),a){case"cfg":break;case"reg":this.fastupdate=!1,this.reg=new Set(b);break;case"map":this.map=new Map(b);break;case"ctx":this.ctx=new Map(b);}}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 e=this;return f.then(function(){return e.export(a,b,c+1,d=0)})}return this.export(a,b,c+1,d=0)}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),b=null;break;case 2:e="doc",f=map_to_json(this.store),b=null;break;case 3:e="cfg",f={},b=null;break;default:return;}return save.call(this,a,b,e,c,d,f)}}export function importDocument(a,b){if(b)switch(is_string(b)&&(b=JSON.parse(b)),a){case"tag":this.tagindex=new Map(b);break;case"reg":this.fastupdate=!1,this.reg=new Set(b);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"doc":this.store=new Map(b);break;default:a=a.split(".");const c=a[0];a=a[1],c&&a&&this.index.get(c).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}

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";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)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");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,is_function,is_object,is_string}from"./common.js";import handler from"./worker/handler.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.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");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}

View File

@@ -24,7 +24,7 @@ import "./document/search.js";
export default function Document(options) {
if (!this) {
if (this.constructor !== Document) {
return new Document(options);
}
@@ -40,9 +40,8 @@ export default function Document(options) {
keystore = options.keystore || 0;
keystore && (this.keystore = keystore);
this.fastupdate = !!options.fastupdate;
this.reg = this.fastupdate ? keystore && /* tag? */ /* stringify */ /* stringify */ /* single param */ /* skip update: */ /* append: */ /* skip update: */ /* skip_update: */
/* skip deletion */!0 /*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/ ? new KeystoreMap(keystore) : new Map() : keystore && !0 ? new KeystoreSet(keystore) : new Set();
this.reg = this.fastupdate ? keystore && /* tag? */ /* stringify */ /* stringify */ /* single param */ /* skip update: */ /* append: */ /* skip update: */
/* skip_update: */ /* skip deletion */!0 /*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/ ? new KeystoreMap(keystore) : new Map() : keystore && !0 ? new KeystoreSet(keystore) : new Set();
// todo support custom filter function
this.storetree = (tmp = document.store || null) && !0 !== tmp && [];
@@ -194,9 +193,11 @@ Document.prototype.commit = async function (replace, append) {
// queued:
// for(const index of this.index.values()){
// await index.db.commit(index, replace, append);
// }
// this.reg.clear();
};Document.prototype.destroy = function () {
};
Document.prototype.destroy = function () {
const promises = [];
for (const idx of this.index.values()) {
promises.push(idx.destroy());

View File

@@ -61,7 +61,7 @@ const whitespace = /[^\p{L}\p{N}]+/u,
export default function Encoder() {
if (!this) {
if (this.constructor !== Encoder) {
return new Encoder(...arguments);
}

View File

@@ -29,7 +29,7 @@ import "./index/remove.js";
export default function Index(options, _register) {
if (!this) {
if (this.constructor !== Index) {
return new Index(options);
}

View File

@@ -12,7 +12,7 @@ import "./resolve/not.js";
*/
export default function Resolver(result) {
if (!this) {
if (this.constructor !== Resolver) {
return new Resolver(result);
}
if (result && result.index) {

View File

@@ -1,110 +1,89 @@
// TODO return promises instead of inner await
import Index from "./index.js";
import Document from "./document.js";
import { create_object, is_string } from "./common.js";
function async(callback, self, field, key, index_doc, index, data, on_done) {
function map_to_json(map) {
const json = [];
for (const item of map.entries()) {
json.push(item);
}
return json;
}
//setTimeout(function(){
function ctx_to_json(ctx) {
const json = [];
for (const item of ctx.entries()) {
json.push(map_to_json(item));
}
return json;
}
function reg_to_json(reg) {
const json = [];
for (const key of reg.keys()) {
json.push(key);
}
return json;
}
function save(callback, field, key, index_doc, index, data) {
const res = callback(field ? field + "." + key : key, JSON.stringify(data));
// await isn't supported by ES5
if (res && res.then) {
res.then(function () {
self.export(callback, self, field, index_doc, index + 1, on_done);
const self = this;
return res.then(function () {
return self.export(callback, field, index_doc, index + 1);
});
} else {
self.export(callback, self, field, index_doc, index + 1, on_done);
}
//});
return this.export(callback, field, index_doc, index + 1);
}
/**
* @param callback
* @param self
* @param field
* @param index_doc
* @param index
* @param on_done
* @this {Index|Document}
*/
export function exportIndex(callback, self, field, index_doc, index, on_done) {
let return_value = /* tag? */ /* stringify */ /* stringify */ /* single param */ /* skip update: */ /* append: */ /* skip update: */ /* skip_update: */ /* skip deletion */ // splice:
!0 /*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/;
if ('undefined' == typeof on_done) {
return_value = new Promise(resolve => {
on_done = resolve;
});
}
export function exportIndex(callback, field, index_doc, index = 0) {
let key, data;
switch (index || (index = 0)) {
switch (index) {
case 0:
key = "reg";
// fastupdate isn't supported by export
if (this.fastupdate) {
data = create_object();
for (let key of this.reg.keys()) {
data[key] = 1;
}
} else {
data = this.reg;
}
data = reg_to_json(this.reg);
break;
case 1:
key = "cfg";
data = {
doc: 0,
opt: this.optimize ? 1 : 0
};
data = {};
break;
case 2:
key = "map";
data = this.map;
data = map_to_json(this.map);
break;
case 3:
key = "ctx";
data = this.ctx;
data = ctx_to_json(this.ctx);
break;
default:
if ('undefined' == typeof field && on_done) {
on_done();
}
return;
}
async(callback, self || this, field, key, index_doc, index, data, on_done);
return return_value;
return save.call(this, callback, field, key, index_doc, index, data);
}
/**
@@ -114,38 +93,32 @@ export function exportIndex(callback, self, field, index_doc, index, on_done) {
export function importIndex(key, data) {
if (!data) {
return;
}
if (is_string(data)) {
data = JSON.parse(data);
}
switch (key) {
case "cfg":
this.optimize = !!data.opt;
break;
case "reg":
// fastupdate isn't supported by import
// fast update isn't supported by export/import
this.fastupdate = /* suggest */ /* append: */ /* enrich */!1;
this.reg = data;
this.reg = new Set(data);
break;
case "map":
this.map = data;
this.map = new Map(data);
break;
case "ctx":
this.ctx = data;
this.ctx = new Map(data);
break;
}
}
@@ -154,71 +127,63 @@ export function importIndex(key, data) {
* @this Document
*/
export function exportDocument(callback, self, field, index_doc, index, on_done) {
let return_value;
if ('undefined' == typeof on_done) {
return_value = new Promise(resolve => {
on_done = resolve;
});
}
index || (index = 0);
index_doc || (index_doc = 0);
export function exportDocument(callback, field, index_doc = 0, index = 0) {
if (index_doc < this.field.length) {
const field = this.field[index_doc],
idx = this.index[field];
idx = this.index.get(field),
res = idx.export(callback, field, index_doc, index = 1);
// start from index 1, because document indexes does not additionally store register
self = this;
//setTimeout(function(){
if (!idx.export(callback, self, index ? field /*.replace(":", "-")*/ : "", index_doc, index++, on_done)) {
index_doc++;
index = 1;
self.export(callback, self, field, index_doc, index, on_done);
if (res && res.then) {
const self = this;
return res.then(function () {
return self.export(callback, field, index_doc + 1, index = 0);
});
}
//});
return this.export(callback, field, index_doc + 1, index = 0);
} else {
let key, data;
switch (index) {
case 0:
key = "reg";
data = reg_to_json(this.reg);
field = null;
break;
case 1:
key = "tag";
data = this.tagindex;
data = ctx_to_json(this.tag);
field = null;
break;
case 2:
key = "store";
data = this.store;
key = "doc";
data = map_to_json(this.store);
field = null;
break;
// case 3:
//
// key = "reg";
// data = this.register;
// break;
case 3:
key = "cfg";
data = {};
field = null;
break;
default:
on_done();
return;
}
async(callback, this, field, key, index_doc, index, data, on_done);
return save.call(this, callback, field, key, index_doc, index, data);
}
return return_value;
}
/**
@@ -228,12 +193,9 @@ export function exportDocument(callback, self, field, index_doc, index, on_done)
export function importDocument(key, data) {
if (!data) {
return;
}
if (is_string(data)) {
data = JSON.parse(data);
}
@@ -241,28 +203,26 @@ export function importDocument(key, data) {
case "tag":
this.tagindex = data;
this.tagindex = new Map(data);
break;
case "reg":
// fastupdate isn't supported by import
// fast update isn't supported by export/import
this.fastupdate = !1;
this.reg = data;
this.reg = new Set(data);
for (let i = 0, index; i < this.field.length; i++) {
index = this.index[this.field[i]];
index.reg = data;
index.fastupdate = !1;
for (let i = 0, idx; i < this.field.length; i++) {
idx = this.index.get(this.field[i]);
idx.fastupdate = !1;
idx.reg = this.reg;
}
break;
case "store":
case "doc":
this.store = data;
this.store = new Map(data);
break;
default:
@@ -272,8 +232,7 @@ export function importDocument(key, data) {
key = key[1];
if (field && key) {
this.index[field].import(key, data);
this.index.get(field).import(key, data);
}
}
}
@@ -290,7 +249,8 @@ ctx: "gulliver+travel:1,2,3|4,5,6|7,8,9;"
* @return {string}
*/
export function serialize(withFunctionWrapper = !0) {
export function serialize(withFunctionWrapper = /* tag? */ /* stringify */ /* stringify */ /* single param */ /* skip update: */ /* append: */ /* skip update: */ /* skip_update: */ /* skip deletion */ // splice:
!0 /*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/) {
if (!this.reg.size) return "";

View File

@@ -11,7 +11,7 @@ let pid = 0;
export default function WorkerIndex(options = {}) {
if (!this) {
if (this.constructor !== WorkerIndex) {
return new WorkerIndex(options);
}

View File

@@ -1,5 +1,5 @@
{
"name": "nodejs-commonjs-document",
"name": "nodejs-commonjs-basic-persistent",
"dependencies": {
"flexsearch": "github:nextapps-de/flexsearch#v0.8-preview",
"sqlite3": "^5.1.7"

View File

@@ -1,5 +1,5 @@
{
"name": "nodejs-commonjs-document",
"name": "nodejs-commonjs-basic-resolver",
"dependencies": {
"flexsearch": "github:nextapps-de/flexsearch#v0.8-preview"
}

View File

@@ -1,5 +1,5 @@
{
"name": "nodejs-commonjs-document",
"name": "nodejs-commonjs-basic-suggestion",
"dependencies": {
"flexsearch": "github:nextapps-de/flexsearch#v0.8-preview"
}

View File

@@ -1,5 +1,5 @@
{
"name": "nodejs-esm-document-worker",
"name": "nodejs-esm-basic-worker-extern-config",
"type": "module",
"dependencies": {
"flexsearch": "github:nextapps-de/flexsearch#v0.8-preview"

View File

@@ -1,5 +1,5 @@
{
"name": "nodejs-esm-document-worker",
"name": "nodejs-esm-basic-worker",
"type": "module",
"dependencies": {
"flexsearch": "github:nextapps-de/flexsearch#v0.8-preview"

View File

@@ -1,5 +1,5 @@
{
"name": "nodejs-commonjs-document",
"name": "nodejs-commonjs-basic",
"dependencies": {
"flexsearch": "github:nextapps-de/flexsearch#v0.8-preview"
}

View File

@@ -1,5 +1,5 @@
{
"name": "nodejs-commonjs-document",
"name": "nodejs-commonjs-language-pack",
"dependencies": {
"flexsearch": "github:nextapps-de/flexsearch#v0.8-preview"
}

View File

@@ -1,5 +1,5 @@
{
"name": "nodejs-commonjs-document",
"name": "nodejs-esm-basic-persistent",
"type": "module",
"dependencies": {
"flexsearch": "github:nextapps-de/flexsearch#v0.8-preview",

View File

@@ -1,5 +1,5 @@
{
"name": "nodejs-commonjs-document",
"name": "nodejs-esm-basic-resolver",
"type": "module",
"dependencies": {
"flexsearch": "github:nextapps-de/flexsearch#v0.8-preview"

View File

@@ -1,5 +1,5 @@
{
"name": "nodejs-commonjs-document",
"name": "nodejs-esm-basic-suggestion",
"type": "module",
"dependencies": {
"flexsearch": "github:nextapps-de/flexsearch#v0.8-preview"

View File

@@ -1,5 +1,5 @@
{
"name": "nodejs-esm-document-worker",
"name": "nodejs-esm-basic-worker-extern-config",
"type": "module",
"dependencies": {
"flexsearch": "github:nextapps-de/flexsearch#v0.8-preview"

View File

@@ -1,5 +1,5 @@
{
"name": "nodejs-esm-document-worker",
"name": "nodejs-esm-basic-worker",
"type": "module",
"dependencies": {
"flexsearch": "github:nextapps-de/flexsearch#v0.8-preview"

View File

@@ -1,5 +1,5 @@
{
"name": "nodejs-commonjs-document",
"name": "nodejs-esm-basic",
"type": "module",
"dependencies": {
"flexsearch": "github:nextapps-de/flexsearch#v0.8-preview"

View File

@@ -1,5 +1,5 @@
{
"name": "nodejs-commonjs-document",
"name": "nodejs-esm-language-pack",
"dependencies": {
"flexsearch": "github:nextapps-de/flexsearch#v0.8-preview"
}

View File

@@ -3,7 +3,7 @@
"preferGlobal": false,
"name": "flexsearch",
"version": "0.8.0",
"description": "Next-Generation full text search library with zero dependencies for Browser and Node.js",
"description": "Next-Generation full-text search library for Browser and Node.js",
"homepage": "https://github.com/nextapps-de/flexsearch/",
"author": "Thomas Wilkerling",
"copyright": "Nextapps GmbH",

View File

@@ -38,7 +38,7 @@ import "./document/search.js";
export default function Document(options){
if(!this) {
if(this.constructor !== Document) {
return new Document(options);
}

View File

@@ -63,7 +63,7 @@ const normalize = "".normalize && /[\u0300-\u036f]/g; // '´`ʼ.,
export default function Encoder(options){
if(!this){
if(this.constructor !== Encoder){
return new Encoder(...arguments);
}

View File

@@ -47,7 +47,7 @@ import "./index/remove.js";
export default function Index(options, _register){
if(!this){
if(this.constructor !== Index){
return new Index(options);
}

View File

@@ -12,7 +12,7 @@ import "./resolve/not.js";
*/
export default function Resolver(result){
if(!this){
if(this.constructor !== Resolver){
return new Resolver(result);
}
if(result && result.index){

View File

@@ -1,111 +1,89 @@
// TODO return promises instead of inner await
import Index from "./index.js";
import Document from "./document.js";
import { create_object, is_string } from "./common.js";
function async(callback, self, field, key, index_doc, index, data, on_done){
function map_to_json(map){
const json = [];
for(const item of map.entries()){
json.push(item);
}
return json;
}
//setTimeout(function(){
function ctx_to_json(ctx){
const json = [];
for(const item of ctx.entries()){
json.push(map_to_json(item));
}
return json;
}
function reg_to_json(reg){
const json = [];
for(const key of reg.keys()){
json.push(key);
}
return json;
}
function save(callback, field, key, index_doc, index, data){
const res = callback(field ? field + "." + key : key, JSON.stringify(data));
// await isn't supported by ES5
if(res && res["then"]){
res["then"](function(){
self.export(callback, self, field, index_doc, index + 1, on_done);
})
const self = this;
return res["then"](function(){
return self.export(callback, field, index_doc, index + 1);
});
}
else{
self.export(callback, self, field, index_doc, index + 1, on_done);
}
//});
return this.export(callback, field, index_doc, index + 1);
}
/**
* @param callback
* @param self
* @param field
* @param index_doc
* @param index
* @param on_done
* @this {Index|Document}
*/
export function exportIndex(callback, self, field, index_doc, index, on_done){
let return_value = true
if (typeof on_done === 'undefined') {
return_value = new Promise((resolve) => {
on_done = resolve
})
}
export function exportIndex(callback, field, index_doc, index = 0){
let key, data;
switch(index || (index = 0)){
switch(index){
case 0:
key = "reg";
// fastupdate isn't supported by export
if(this.fastupdate){
data = create_object();
for(let key of this.reg.keys()){
data[key] = 1;
}
}
else{
data = this.reg;
}
data = reg_to_json(this.reg);
break;
case 1:
key = "cfg";
data = {
"doc": 0,
"opt": this.optimize ? 1 : 0
};
data = {};
break;
case 2:
key = "map";
data = this.map;
data = map_to_json(this.map);
break;
case 3:
key = "ctx";
data = this.ctx;
data = ctx_to_json(this.ctx);
break;
default:
if (typeof field === 'undefined' && on_done) {
on_done();
}
return;
}
async(callback, self || this, field, key, index_doc, index, data, on_done);
return return_value;
return save.call(this, callback, field, key, index_doc, index, data);
}
/**
@@ -115,38 +93,32 @@ export function exportIndex(callback, self, field, index_doc, index, on_done){
export function importIndex(key, data){
if(!data){
return;
}
if(is_string(data)){
data = JSON.parse(data);
}
switch(key){
case "cfg":
this.optimize = !!data["opt"];
break;
case "reg":
// fastupdate isn't supported by import
// fast update isn't supported by export/import
this.fastupdate = false;
this.reg = data;
this.reg = new Set(data);
break;
case "map":
this.map = data;
this.map = new Map(data);
break;
case "ctx":
this.ctx = data;
this.ctx = new Map(data);
break;
}
}
@@ -155,35 +127,23 @@ export function importIndex(key, data){
* @this Document
*/
export function exportDocument(callback, self, field, index_doc, index, on_done){
let return_value
if (typeof on_done === 'undefined') {
return_value = new Promise((resolve) => {
on_done = resolve
})
}
index || (index = 0);
index_doc || (index_doc = 0);
export function exportDocument(callback, field, index_doc = 0, index = 0){
if(index_doc < this.field.length){
const field = this.field[index_doc];
const idx = this.index[field];
const idx = this.index.get(field);
// start from index 1, because document indexes does not additionally store register
const res = idx.export(callback, field, index_doc, index = 1);
self = this;
//setTimeout(function(){
if(!idx.export(callback, self, index ? field/*.replace(":", "-")*/ : "", index_doc, index++, on_done)){
index_doc++;
index = 1;
self.export(callback, self, field, index_doc, index, on_done);
if(res && res["then"]){
const self = this;
return res["then"](function(){
return self.export(callback, field, index_doc + 1, index = 0);
});
}
//});
return this.export(callback, field, index_doc + 1, index = 0);
}
else{
@@ -191,36 +151,41 @@ export function exportDocument(callback, self, field, index_doc, index, on_done)
switch(index){
case 0:
key = "reg";
data = reg_to_json(this.reg);
field = null;
break;
case 1:
key = "tag";
data = this.tagindex;
data = ctx_to_json(this.tag);
field = null;
break;
case 2:
key = "store";
data = this.store;
key = "doc";
data = map_to_json(this.store);
field = null;
break;
// case 3:
//
// key = "reg";
// data = this.register;
// break;
case 3:
key = "cfg";
data = {};
field = null;
break;
default:
on_done();
return;
}
async(callback, this, field, key, index_doc, index, data, on_done);
return save.call(this, callback, field, key, index_doc, index, data);
}
return return_value
}
/**
@@ -230,12 +195,9 @@ export function exportDocument(callback, self, field, index_doc, index, on_done)
export function importDocument(key, data){
if(!data){
return;
}
if(is_string(data)){
data = JSON.parse(data);
}
@@ -243,28 +205,26 @@ export function importDocument(key, data){
case "tag":
this.tagindex = data;
this.tagindex = new Map(data);
break;
case "reg":
// fastupdate isn't supported by import
// fast update isn't supported by export/import
this.fastupdate = false;
this.reg = data;
this.reg = new Set(data);
for(let i = 0, index; i < this.field.length; i++){
index = this.index[this.field[i]];
index.reg = data;
index.fastupdate = false;
for(let i = 0, idx; i < this.field.length; i++){
idx = this.index.get(this.field[i]);
idx.fastupdate = false;
idx.reg = this.reg;
}
break;
case "store":
case "doc":
this.store = data;
this.store = new Map(data);
break;
default:
@@ -274,8 +234,7 @@ export function importDocument(key, data){
key = key[1];
if(field && key){
this.index[field].import(key, data);
this.index.get(field).import(key, data);
}
}
}

View File

@@ -11,7 +11,7 @@ let pid = 0;
export default function WorkerIndex(options = {}){
if(!this) {
if(this.constructor !== WorkerIndex) {
return new WorkerIndex(options);
}