From 5c54b465a8c4a5f444a28b3226d7703875f67f42 Mon Sep 17 00:00:00 2001 From: Thomas Wilkerling Date: Sun, 7 Jan 2024 23:59:35 +0100 Subject: [PATCH] fix esm export (build) --- dist/flexsearch.bundle.debug.js | 383 ++++++++++++------------ dist/flexsearch.bundle.min.js | 56 ++-- dist/flexsearch.bundle.module.debug.js | 379 ++++++++++++----------- dist/flexsearch.bundle.module.min.js | 56 ++-- dist/flexsearch.compact.debug.js | 203 +++++++------ dist/flexsearch.compact.min.js | 40 +-- dist/flexsearch.compact.module.debug.js | 199 ++++++------ dist/flexsearch.compact.module.min.js | 40 +-- dist/flexsearch.es5.debug.js | 30 +- dist/flexsearch.es5.min.js | 8 +- dist/flexsearch.light.debug.js | 33 +- dist/flexsearch.light.min.js | 12 +- dist/flexsearch.light.module.debug.js | 47 ++- dist/flexsearch.light.module.min.js | 18 +- package-lock.json | 4 +- package.json | 2 +- src/config.js | 3 + src/webpack.js | 34 ++- task/build.js | 4 +- 19 files changed, 772 insertions(+), 779 deletions(-) diff --git a/dist/flexsearch.bundle.debug.js b/dist/flexsearch.bundle.debug.js index e196a0e..b8734de 100644 --- a/dist/flexsearch.bundle.debug.js +++ b/dist/flexsearch.bundle.debug.js @@ -1,5 +1,5 @@ /**! - * FlexSearch.js v0.7.39 (Bundle) + * FlexSearch.js v0.7.40 (Bundle) * Author and Copyright: Thomas Wilkerling * Licence: Apache-2.0 * Hosted by Nextapps GmbH @@ -10,31 +10,31 @@ var t; function u(a) { return "undefined" !== typeof a ? a : !0; } -function aa(a) { +function v(a) { const b = Array(a); for (let c = 0; c < a; c++) { - b[c] = v(); + b[c] = x(); } return b; } -function v() { +function x() { return Object.create(null); } -function ba(a, b) { +function aa(a, b) { return b.length - a.length; } -function x(a) { +function C(a) { return "string" === typeof a; } -function C(a) { +function D(a) { return "object" === typeof a; } -function D(a) { +function E(a) { return "function" === typeof a; } -;function ca(a, b) { - var c = da; - if (a && (b && (a = E(a, b)), this.H && (a = E(a, this.H)), this.J && 1 < a.length && (a = E(a, this.J)), c || "" === c)) { +;function ba(a, b) { + var c = ca; + if (a && (b && (a = F(a, b)), this.H && (a = F(a, this.H)), this.J && 1 < a.length && (a = F(a, this.J)), c || "" === c)) { b = a.split(c); if (this.filter) { a = this.filter; @@ -52,49 +52,49 @@ function D(a) { } return a; } -const da = /[\p{Z}\p{S}\p{P}\p{C}]+/u, ea = /[\u0300-\u036f]/g; -function fa(a, b) { +const ca = /[\p{Z}\p{S}\p{P}\p{C}]+/u, da = /[\u0300-\u036f]/g; +function ea(a, b) { const c = Object.keys(a), d = c.length, e = []; let f = "", h = 0; for (let g = 0, k, m; g < d; g++) { - k = c[g], (m = a[k]) ? (e[h++] = F(b ? "(?!\\b)" + k + "(\\b|_)" : k), e[h++] = m) : f += (f ? "|" : "") + k; + k = c[g], (m = a[k]) ? (e[h++] = G(b ? "(?!\\b)" + k + "(\\b|_)" : k), e[h++] = m) : f += (f ? "|" : "") + k; } - f && (e[h++] = F(b ? "(?!\\b)(" + f + ")(\\b|_)" : "(" + f + ")"), e[h] = ""); + f && (e[h++] = G(b ? "(?!\\b)(" + f + ")(\\b|_)" : "(" + f + ")"), e[h] = ""); return e; } -function E(a, b) { +function F(a, b) { for (let c = 0, d = b.length; c < d && (a = a.replace(b[c], b[c + 1]), a); c += 2) { } return a; } -function F(a) { +function G(a) { return new RegExp(a, "g"); } -function ha(a) { +function fa(a) { let b = "", c = ""; for (let d = 0, e = a.length, f; d < e; d++) { (f = a[d]) !== c && (b += c = f); } return b; } -;var ja = {encode:ia, F:!1, G:""}; -function ia(a) { - return ca.call(this, ("" + a).toLowerCase(), !1); +;var ia = {encode:ha, F:!1, G:""}; +function ha(a) { + return ba.call(this, ("" + a).toLowerCase(), !1); } -;const ka = {}, G = {}; -function la(a) { - I(a, "add"); - I(a, "append"); - I(a, "search"); - I(a, "update"); - I(a, "remove"); +;const ja = {}, I = {}; +function ka(a) { + J(a, "add"); + J(a, "append"); + J(a, "search"); + J(a, "update"); + J(a, "remove"); } -function I(a, b) { +function J(a, b) { a[b + "Async"] = function() { const c = this, d = arguments; var e = d[d.length - 1]; let f; - D(e) && (f = e, delete d[d.length - 1]); + E(e) && (f = e, delete d[d.length - 1]); e = new Promise(function(h) { setTimeout(function() { c.async = !0; @@ -106,12 +106,12 @@ function I(a, b) { return f ? (e.then(f), this) : e; }; } -;function ma(a, b, c, d) { +;function la(a, b, c, d) { const e = a.length; let f = [], h, g, k = 0; d && (d = []); for (let m = e - 1; 0 <= m; m--) { - const n = a[m], w = n.length, q = v(); + const n = a[m], w = n.length, q = x(); let r = !h; for (let l = 0; l < w; l++) { const p = n[l], A = p.length; @@ -170,8 +170,8 @@ function I(a, b) { } return f; } -function na(a, b) { - const c = v(), d = v(), e = []; +function ma(a, b) { + const c = x(), d = x(), e = []; for (let f = 0; f < a.length; f++) { c[a[f]] = 1; } @@ -183,18 +183,18 @@ function na(a, b) { } return e; } -;function J(a) { +;function K(a) { this.l = !0 !== a && a; - this.cache = v(); + this.cache = x(); this.h = []; } -function oa(a, b, c) { - C(a) && (a = a.query); +function na(a, b, c) { + D(a) && (a = a.query); let d = this.cache.get(a); d || (d = this.search(a, b, c), this.cache.set(a, d)); return d; } -J.prototype.set = function(a, b) { +K.prototype.set = function(a, b) { if (!this.cache[a]) { var c = this.h.length; c === this.l ? delete this.cache[this.h[c - 1]] : c++; @@ -205,7 +205,7 @@ J.prototype.set = function(a, b) { } this.cache[a] = b; }; -J.prototype.get = function(a) { +K.prototype.get = function(a) { const b = this.cache[a]; if (this.l && b && (a = this.h.indexOf(a))) { const c = this.h[a - 1]; @@ -214,8 +214,8 @@ J.prototype.get = function(a) { } return b; }; -const pa = {memory:{charset:"latin:extra", D:3, B:4, m:!1}, performance:{D:3, B:3, s:!1, context:{depth:2, D:1}}, match:{charset:"latin:extra", G:"reverse"}, score:{charset:"latin:advanced", D:20, B:3, context:{depth:3, D:9}}, "default":{}}; -function ra(a, b, c, d, e, f, h, g) { +const oa = {memory:{charset:"latin:extra", D:3, B:4, m:!1}, performance:{D:3, B:3, s:!1, context:{depth:2, D:1}}, match:{charset:"latin:extra", G:"reverse"}, score:{charset:"latin:advanced", D:20, B:3, context:{depth:3, D:9}}, "default":{}}; +function qa(a, b, c, d, e, f, h, g) { setTimeout(function() { const k = a(c ? c + "." + d : d, JSON.stringify(h)); k && k.then ? k.then(function() { @@ -223,14 +223,14 @@ function ra(a, b, c, d, e, f, h, g) { }) : b.export(a, b, c, e, f + 1, g); }); } -;function K(a, b) { - if (!(this instanceof K)) { - return new K(a); +;function L(a, b) { + if (!(this instanceof L)) { + return new L(a); } var c; if (a) { - if (x(a)) { - pa[a] || console.warn("Preset not found: " + a), a = pa[a]; + if (C(a)) { + oa[a] || console.warn("Preset not found: " + a), a = oa[a]; } else { if (c = a.preset) { c[c] || console.warn("Preset not found: " + c), a = Object.assign({}, c[c], a); @@ -238,14 +238,14 @@ function ra(a, b, c, d, e, f, h, g) { } c = a.charset; var d = a.lang; - x(c) && (-1 === c.indexOf(":") && (c += ":default"), c = G[c]); - x(d) && (d = ka[d]); + C(c) && (-1 === c.indexOf(":") && (c += ":default"), c = I[c]); + C(d) && (d = ja[d]); } else { a = {}; } let e, f, h = a.context || {}; - this.encode = a.encode || c && c.encode || ia; - this.register = b || v(); + this.encode = a.encode || c && c.encode || ha; + this.register = b || x(); this.D = e = a.resolution || 9; this.G = b = c && c.G || a.tokenize || "strict"; this.depth = "strict" === b && h.depth; @@ -254,24 +254,24 @@ function ra(a, b, c, d, e, f, h, g) { this.m = u(a.fastupdate); this.B = a.minlength || 1; this.C = a.boost; - this.map = f ? aa(e) : v(); + this.map = f ? v(e) : x(); this.A = e = h.resolution || 1; - this.h = f ? aa(e) : v(); + this.h = f ? v(e) : x(); this.F = c && c.F || a.rtl; - this.H = (b = a.matcher || d && d.H) && fa(b, !1); - this.J = (b = a.stemmer || d && d.J) && fa(b, !0); + this.H = (b = a.matcher || d && d.H) && ea(b, !1); + this.J = (b = a.stemmer || d && d.J) && ea(b, !0); if (c = b = a.filter || d && d.filter) { c = b; - d = v(); + d = x(); for (let g = 0, k = c.length; g < k; g++) { d[c[g]] = 1; } c = d; } this.filter = c; - this.cache = (b = a.cache) && new J(b); + this.cache = (b = a.cache) && new K(b); } -t = K.prototype; +t = L.prototype; t.append = function(a, b) { return this.add(a, b, !0); }; @@ -282,21 +282,21 @@ t.add = function(a, b, c, d) { } b = this.encode(b); if (d = b.length) { - const m = v(), n = v(), w = this.depth, q = this.D; + const m = x(), n = x(), w = this.depth, q = this.D; for (let r = 0; r < d; r++) { let l = b[this.F ? d - 1 - r : r]; var e = l.length; if (l && e >= this.B && (w || !n[l])) { - var f = L(q, d, r), h = ""; + var f = M(q, d, r), h = ""; switch(this.G) { case "full": if (2 < e) { for (f = 0; f < e; f++) { for (var g = e; g > f; g--) { if (g - f >= this.B) { - var k = L(q, d, r, e, f); + var k = M(q, d, r, e, f); h = l.substring(f, g); - M(this, n, h, k, a, c); + N(this, n, h, k, a, c); } } } @@ -305,24 +305,24 @@ t.add = function(a, b, c, d) { case "reverse": if (1 < e) { for (g = e - 1; 0 < g; g--) { - h = l[g] + h, h.length >= this.B && M(this, n, h, L(q, d, r, e, g), a, c); + h = l[g] + h, h.length >= this.B && N(this, n, h, M(q, d, r, e, g), a, c); } h = ""; } case "forward": if (1 < e) { for (g = 0; g < e; g++) { - h += l[g], h.length >= this.B && M(this, n, h, f, a, c); + h += l[g], h.length >= this.B && N(this, n, h, f, a, c); } break; } default: - if (this.C && (f = Math.min(f / this.C(b, l, r) | 0, q - 1)), M(this, n, l, f, a, c), w && 1 < d && r < d - 1) { - for (e = v(), h = this.A, f = l, g = Math.min(w + 1, d - r), e[f] = 1, k = 1; k < g; k++) { + if (this.C && (f = Math.min(f / this.C(b, l, r) | 0, q - 1)), N(this, n, l, f, a, c), w && 1 < d && r < d - 1) { + for (e = x(), h = this.A, f = l, g = Math.min(w + 1, d - r), e[f] = 1, k = 1; k < g; k++) { if ((l = b[this.F ? d - 1 - r - k : r + k]) && l.length >= this.B && !e[l]) { e[l] = 1; const p = this.l && l > f; - M(this, m, p ? f : l, L(h + (d / 2 > h ? 0 : 1), d, r, g - 1, k - 1), a, c, p ? l : f); + N(this, m, p ? f : l, M(h + (d / 2 > h ? 0 : 1), d, r, g - 1, k - 1), a, c, p ? l : f); } } } @@ -334,17 +334,17 @@ t.add = function(a, b, c, d) { } return this; }; -function L(a, b, c, d, e) { +function M(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 M(a, b, c, d, e, f, h) { +function N(a, b, c, d, e, f, h) { let g = h ? a.h : a.map; if (!b[c] || h && !b[c][h]) { - a.s && (g = g[d]), h ? (b = b[c] || (b[c] = v()), b[h] = 1, g = g[h] || (g[h] = v())) : b[c] = 1, g = g[c] || (g[c] = []), a.s || (g = g[d] || (g[d] = [])), f && g.includes(e) || (g[g.length] = e, a.m && (a = a.register[e] || (a.register[e] = []), a[a.length] = g)); + a.s && (g = g[d]), h ? (b = b[c] || (b[c] = x()), b[h] = 1, g = g[h] || (g[h] = x())) : b[c] = 1, g = g[c] || (g[c] = []), a.s || (g = g[d] || (g[d] = [])), f && g.includes(e) || (g[g.length] = e, a.m && (a = a.register[e] || (a.register[e] = []), a[a.length] = g)); } } t.search = function(a, b, c) { - c || (!b && C(a) ? (c = a, a = c.query) : C(b) && (c = b)); + c || (!b && D(a) ? (c = a, a = c.query) : D(b) && (c = b)); let d = [], e; let f, h = 0; if (c) { @@ -355,7 +355,7 @@ t.search = function(a, b, c) { f = c.suggest; } if (a && (a = this.encode("" + a), e = a.length, 1 < e)) { - c = v(); + c = x(); var k = []; for (let n = 0, w = 0, q; n < e; n++) { if ((q = a[n]) && q.length >= this.B && !c[q]) { @@ -376,10 +376,10 @@ t.search = function(a, b, c) { g = this.depth && 1 < e && !1 !== g; c = 0; let m; - g ? (m = a[0], c = 1) : 1 < e && a.sort(ba); + g ? (m = a[0], c = 1) : 1 < e && a.sort(aa); for (let n, w; c < e; c++) { w = a[c]; - g ? (n = sa(this, d, f, b, h, 2 === e, w, m), f && !1 === n && d.length || (m = w)) : n = sa(this, d, f, b, h, 1 === e, w); + g ? (n = ra(this, d, f, b, h, 2 === e, w, m), f && !1 === n && d.length || (m = w)) : n = ra(this, d, f, b, h, 1 === e, w); if (n) { return n; } @@ -394,28 +394,28 @@ t.search = function(a, b, c) { return d; } if (1 === k) { - return ta(d[0], b, h); + return sa(d[0], b, h); } } } - return ma(d, b, h, f); + return la(d, b, h, f); }; -function sa(a, b, c, d, e, f, h, g) { +function ra(a, b, c, d, e, f, h, g) { let k = [], m = g ? a.h : a.map; - a.s || (m = ua(m, h, g, a.l)); + a.s || (m = ta(m, h, g, a.l)); if (m) { let n = 0; const w = Math.min(m.length, g ? a.A : a.D); for (let q = 0, r = 0, l, p; q < w; q++) { if (l = m[q]) { - if (a.s && (l = ua(l, h, g, a.l)), e && l && f && (p = l.length, p <= e ? (e -= p, l = null) : (l = l.slice(e), e = 0)), l && (k[n++] = l, f && (r += l.length, r >= d))) { + if (a.s && (l = ta(l, h, g, a.l)), e && l && f && (p = l.length, p <= e ? (e -= p, l = null) : (l = l.slice(e), e = 0)), l && (k[n++] = l, f && (r += l.length, r >= d))) { break; } } } if (n) { if (f) { - return ta(k, d, 0); + return sa(k, d, 0); } b[b.length] = k; return; @@ -423,11 +423,11 @@ function sa(a, b, c, d, e, f, h, g) { } return !c && k; } -function ta(a, b, c) { +function sa(a, b, c) { a = 1 === a.length ? a[0] : [].concat.apply([], a); return c || a.length > b ? a.slice(c, c + b) : a; } -function ua(a, b, c, d) { +function ta(a, b, c, d) { c ? (d = d && b > c, a = (a = a[d ? b : c]) && a[d ? c : b]) : a = a[b]; return a; } @@ -445,7 +445,7 @@ t.remove = function(a, b) { e = c[d], e.splice(e.indexOf(a), 1); } } else { - N(this.map, a, this.D, this.s), this.depth && N(this.h, a, this.A, this.s); + O(this.map, a, this.D, this.s), this.depth && O(this.h, a, this.A, this.s); } b || delete this.register[a]; if (this.cache) { @@ -457,7 +457,7 @@ t.remove = function(a, b) { } return this; }; -function N(a, b, c, d, e) { +function O(a, b, c, d, e) { let f = 0; if (a.constructor === Array) { if (e) { @@ -466,18 +466,18 @@ function N(a, b, c, d, e) { e = Math.min(a.length, c); for (let h = 0, g; h < e; h++) { if (g = a[h]) { - f = N(g, b, c, d, e), d || f || delete a[h]; + f = O(g, b, c, d, e), d || f || delete a[h]; } } } } else { for (let h in a) { - (f = N(a[h], b, c, d, e)) || delete a[h]; + (f = O(a[h], b, c, d, e)) || delete a[h]; } } return f; } -t.searchCache = oa; +t.searchCache = na; t.export = function(a, b, c, d, e, f) { let h = !0; "undefined" === typeof f && (h = new Promise(m => { @@ -488,7 +488,7 @@ t.export = function(a, b, c, d, e, f) { case 0: g = "reg"; if (this.m) { - k = v(); + k = x(); for (let m in this.register) { k[m] = 1; } @@ -512,12 +512,12 @@ t.export = function(a, b, c, d, e, f) { "undefined" === typeof c && f && f(); return; } - ra(a, b || this, c, g, d, e, k, f); + qa(a, b || this, c, g, d, e, k, f); return h; }; t.import = function(a, b) { if (b) { - switch(x(b) && (b = JSON.parse(b)), a) { + switch(C(b) && (b = JSON.parse(b)), a) { case "cfg": this.s = !!b.opt; break; @@ -533,8 +533,8 @@ t.import = function(a, b) { } } }; -la(K.prototype); -function va(a) { +ka(L.prototype); +function ua(a) { a = a.data; var b = self._index; const c = a.args; @@ -546,23 +546,23 @@ function va(a) { b = d.encode; d.cache = !1; b && 0 === b.indexOf("function") && (d.encode = Function("return " + b)()); - a ? (Function("return " + a)()(self), self._index = new self.FlexSearch.Index(d), delete self.FlexSearch) : self._index = new K(d); + a ? (Function("return " + a)()(self), self._index = new self.FlexSearch.Index(d), delete self.FlexSearch) : self._index = new L(d); break; default: a = a.id, b = b[d].apply(b, c), postMessage("search" === d ? {id:a, msg:b} : {id:a}); } } -;let wa = 0; -function O(a) { - if (!(this instanceof O)) { - return new O(a); +;let va = 0; +function P(a) { + if (!(this instanceof P)) { + return new P(a); } var b; - a ? D(b = a.encode) && (a.encode = b.toString()) : a = {}; + a ? E(b = a.encode) && (a.encode = b.toString()) : a = {}; (b = (self || window)._factory) && (b = b.toString()); const c = "undefined" === typeof window && self.exports, d = this; - this.o = xa(b, c, a.worker); - this.h = v(); + this.o = wa(b, c, a.worker); + this.h = x(); if (this.o) { if (c) { this.o.on("message", function(e) { @@ -579,67 +579,67 @@ function O(a) { this.o.postMessage({task:"init", factory:b, options:a}); } } -P("add"); -P("append"); -P("search"); -P("update"); -P("remove"); -function P(a) { - O.prototype[a] = O.prototype[a + "Async"] = function() { +Q("add"); +Q("append"); +Q("search"); +Q("update"); +Q("remove"); +function Q(a) { + P.prototype[a] = P.prototype[a + "Async"] = function() { const b = this, c = [].slice.call(arguments); var d = c[c.length - 1]; let e; - D(d) && (e = d, c.splice(c.length - 1, 1)); + E(d) && (e = d, c.splice(c.length - 1, 1)); d = new Promise(function(f) { setTimeout(function() { - b.h[++wa] = f; - b.o.postMessage({task:a, id:wa, args:c}); + b.h[++va] = f; + b.o.postMessage({task:a, id:va, args:c}); }); }); return e ? (d.then(e), this) : d; }; } -function xa(a, b, c) { +function wa(a, b, c) { let d; try { - d = b ? eval('new (require("worker_threads")["Worker"])("../dist/node/node.js")') : a ? new Worker(URL.createObjectURL(new Blob(["onmessage=" + va.toString()], {type:"text/javascript"}))) : new Worker(x(c) ? c : "worker/worker.js", {type:"module"}); + d = b ? eval('new (require("worker_threads")["Worker"])("../dist/node/node.js")') : a ? new Worker(URL.createObjectURL(new Blob(["onmessage=" + ua.toString()], {type:"text/javascript"}))) : new Worker(C(c) ? c : "worker/worker.js", {type:"module"}); } catch (e) { } return d; } -;function Q(a) { - if (!(this instanceof Q)) { - return new Q(a); +;function S(a) { + if (!(this instanceof S)) { + return new S(a); } var b = a.document || a.doc || a, c; this.K = []; this.h = []; this.A = []; - this.register = v(); - this.key = (c = b.key || b.id) && S(c, this.A) || "id"; + this.register = x(); + this.key = (c = b.key || b.id) && T(c, this.A) || "id"; this.m = u(a.fastupdate); this.C = (c = b.store) && !0 !== c && []; - this.store = c && v(); - this.I = (c = b.tag) && S(c, this.A); - this.l = c && v(); - this.cache = (c = a.cache) && new J(c); + this.store = c && x(); + this.I = (c = b.tag) && T(c, this.A); + this.l = c && x(); + this.cache = (c = a.cache) && new K(c); a.cache = !1; this.o = a.worker; this.async = !1; - c = v(); + c = x(); let d = b.index || b.field || b; - x(d) && (d = [d]); + C(d) && (d = [d]); for (let e = 0, f, h; e < d.length; e++) { - f = d[e], x(f) || (h = f, f = f.field), h = C(h) ? Object.assign({}, a, h) : a, this.o && (c[f] = new O(h), c[f].o || (this.o = !1)), this.o || (c[f] = new K(h, this.register)), this.K[e] = S(f, this.A), this.h[e] = f; + f = d[e], C(f) || (h = f, f = f.field), h = D(h) ? Object.assign({}, a, h) : a, this.o && (c[f] = new P(h), c[f].o || (this.o = !1)), this.o || (c[f] = new L(h, this.register)), this.K[e] = T(f, this.A), this.h[e] = f; } if (this.C) { - for (a = b.store, x(a) && (a = [a]), b = 0; b < a.length; b++) { - this.C[b] = S(a[b], this.A); + for (a = b.store, C(a) && (a = [a]), b = 0; b < a.length; b++) { + this.C[b] = T(a[b], this.A); } } this.index = c; } -function S(a, b) { +function T(a, b) { const c = a.split(":"); let d = 0; for (let e = 0; e < c.length; e++) { @@ -648,8 +648,8 @@ function S(a, b) { d < c.length && (c.length = d); return 1 < d ? c : c[0]; } -function T(a, b) { - if (x(b)) { +function U(a, b) { + if (C(b)) { a = a[b]; } else { for (let c = 0; a && c < b.length; c++) { @@ -658,21 +658,21 @@ function T(a, b) { } return a; } -function U(a, b, c, d, e) { +function V(a, b, c, d, e) { a = a[e]; if (d === c.length - 1) { b[e] = a; } else if (a) { if (a.constructor === Array) { for (b = b[e] = Array(a.length), e = 0; e < a.length; e++) { - U(a, b, c, d, e); + V(a, b, c, d, e); } } else { - b = b[e] || (b[e] = v()), e = c[++d], U(a, b, c, d, e); + b = b[e] || (b[e] = x()), e = c[++d], V(a, b, c, d, e); } } } -function V(a, b, c, d, e, f, h, g) { +function X(a, b, c, d, e, f, h, g) { if (a = a[h]) { if (d === b.length - 1) { if (a.constructor === Array) { @@ -688,27 +688,27 @@ function V(a, b, c, d, e, f, h, g) { } else { if (a.constructor === Array) { for (h = 0; h < a.length; h++) { - V(a, b, c, d, e, f, h, g); + X(a, b, c, d, e, f, h, g); } } else { - h = b[++d], V(a, b, c, d, e, f, h, g); + h = b[++d], X(a, b, c, d, e, f, h, g); } } } } -t = Q.prototype; +t = S.prototype; t.add = function(a, b, c) { - C(a) && (b = a, a = T(b, this.key)); + D(a) && (b = a, a = U(b, this.key)); if (b && (a || 0 === a)) { if (!c && this.register[a]) { return this.update(a, b); } for (let d = 0, e, f; d < this.h.length; d++) { - f = this.h[d], e = this.K[d], x(e) && (e = [e]), V(b, e, this.A, 0, this.index[f], a, e[0], c); + f = this.h[d], e = this.K[d], C(e) && (e = [e]), X(b, e, this.A, 0, this.index[f], a, e[0], c); } if (this.I) { - let d = T(b, this.I), e = v(); - x(d) && (d = [d]); + let d = U(b, this.I), e = x(); + C(d) && (d = [d]); for (let f = 0, h, g; f < d.length; f++) { if (h = d[f], !e[h] && (e[h] = 1, g = this.l[h] || (this.l[h] = []), !c || !g.includes(a))) { if (g[g.length] = a, this.m) { @@ -721,9 +721,9 @@ t.add = function(a, b, c) { if (this.store && (!c || !this.store[a])) { let d; if (this.C) { - d = v(); + d = x(); for (let e = 0, f; e < this.C.length; e++) { - f = this.C[e], x(f) ? d[f] = b[f] : U(b, d, f, 0, f[0]); + f = this.C[e], C(f) ? d[f] = b[f] : V(b, d, f, 0, f[0]); } } this.store[a] = d || b; @@ -738,7 +738,7 @@ t.update = function(a, b) { return this.remove(a).add(a, b); }; t.remove = function(a) { - C(a) && (a = T(a, this.key)); + D(a) && (a = U(a, this.key)); if (this.register[a]) { for (var b = 0; b < this.h.length && (this.index[this.h[b]].remove(a, !this.o), !this.m); b++) { } @@ -755,7 +755,7 @@ t.remove = function(a) { return this; }; t.search = function(a, b, c, d) { - c || (!b && C(a) ? (c = a, a = "") : C(b) && (c = b, b = 0)); + c || (!b && D(a) ? (c = a, a = "") : D(b) && (c = b, b = 0)); let e = [], f = [], h, g, k, m, n, w, q = 0; if (c) { if (c.constructor === Array) { @@ -768,15 +768,15 @@ t.search = function(a, b, c, d) { n = "and" === c.bool; b = c.limit || b || 100; w = c.offset || 0; - if (m && (x(m) && (m = [m]), !a)) { + if (m && (C(m) && (m = [m]), !a)) { for (let l = 0, p; l < m.length; l++) { - if (p = ya.call(this, m[l], b, w, g)) { + if (p = xa.call(this, m[l], b, w, g)) { e[e.length] = p, q++; } } return q ? e : []; } - x(k) && (k = [k]); + C(k) && (k = [k]); } } k || (k = this.h); @@ -785,7 +785,7 @@ t.search = function(a, b, c, d) { for (let l = 0, p, A, B; l < k.length; l++) { let z; A = k[l]; - x(A) || (z = A, A = z.field, a = z.query || a, b = z.limit || b, g = z.enrich || g); + C(A) || (z = A, A = z.field, a = z.query || a, b = z.limit || b, g = z.enrich || g); if (r) { r[l] = this.index[A].searchAsync(a, b, z || c); } else { @@ -795,12 +795,12 @@ t.search = function(a, b, c, d) { const y = []; let H = 0; n && (y[0] = [p]); - for (let X = 0, qa, R; X < m.length; X++) { - if (qa = m[X], B = (R = this.l[qa]) && R.length) { + for (let W = 0, pa, R; W < m.length; W++) { + if (pa = m[W], B = (R = this.l[pa]) && R.length) { H++, y[y.length] = n ? [R] : R; } } - H && (p = n ? ma(y, b || 100, w || 0) : na(p, y), B = p.length); + H && (p = n ? la(y, b || 100, w || 0) : ma(p, y), B = p.length); } if (B) { f[q] = A, e[q++] = p; @@ -825,7 +825,7 @@ t.search = function(a, b, c, d) { } for (let l = 0, p; l < f.length; l++) { p = e[l]; - p.length && g && (p = za.call(this, p)); + p.length && g && (p = ya.call(this, p)); if (h) { return p; } @@ -833,17 +833,17 @@ t.search = function(a, b, c, d) { } return e; }; -function ya(a, b, c, d) { +function xa(a, b, c, d) { let e = this.l[a], f = e && e.length - c; if (f && 0 < f) { if (f > b || c) { e = e.slice(c, c + b); } - d && (e = za.call(this, e)); + d && (e = ya.call(this, e)); return {tag:a, result:e}; } } -function za(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[d]}; @@ -860,7 +860,7 @@ t.set = function(a, b) { this.store[a] = b; return this; }; -t.searchCache = oa; +t.searchCache = na; t.export = function(a, b, c, d, e, f) { let h; "undefined" === typeof f && (h = new Promise(g => { @@ -891,13 +891,13 @@ t.export = function(a, b, c, d, e, f) { f(); return; } - ra(a, this, c, g, d, e, k, f); + qa(a, this, c, g, d, e, k, f); } return h; }; t.import = function(a, b) { if (b) { - switch(x(b) && (b = JSON.parse(b)), a) { + switch(C(b) && (b = JSON.parse(b)), a) { case "tag": this.l = b; break; @@ -919,28 +919,28 @@ t.import = function(a, b) { } } }; -la(Q.prototype); -var Ba = {encode:Aa, F:!1, G:""}; -const Ca = [F("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"), "a", F("[\u00e8\u00e9\u00ea\u00eb]"), "e", F("[\u00ec\u00ed\u00ee\u00ef]"), "i", F("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"), "o", F("[\u00f9\u00fa\u00fb\u00fc\u0171]"), "u", F("[\u00fd\u0177\u00ff]"), "y", F("\u00f1"), "n", F("[\u00e7c]"), "k", F("\u00df"), "s", F(" & "), " and "]; -function Aa(a) { +ka(S.prototype); +var Aa = {encode:za, F:!1, G:""}; +const Ba = [G("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"), "a", G("[\u00e8\u00e9\u00ea\u00eb]"), "e", G("[\u00ec\u00ed\u00ee\u00ef]"), "i", G("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"), "o", G("[\u00f9\u00fa\u00fb\u00fc\u0171]"), "u", G("[\u00fd\u0177\u00ff]"), "y", G("\u00f1"), "n", G("[\u00e7c]"), "k", G("\u00df"), "s", G(" & "), " and "]; +function za(a) { var b = a = "" + a; - b.normalize && (b = b.normalize("NFD").replace(ea, "")); - return ca.call(this, b.toLowerCase(), !a.normalize && Ca); + b.normalize && (b = b.normalize("NFD").replace(da, "")); + return ba.call(this, b.toLowerCase(), !a.normalize && Ba); } -;var Ea = {encode:Da, F:!1, G:"strict"}; -const Fa = /[^a-z0-9]+/, Ga = {b:"p", v:"f", w:"f", z:"s", x:"s", "\u00df":"s", d:"t", n:"m", c:"k", g:"k", j:"k", q:"k", i:"e", y:"e", u:"o"}; -function Da(a) { - a = Aa.call(this, a).join(" "); +;var Da = {encode:Ca, F:!1, G:"strict"}; +const Ea = /[^a-z0-9]+/, Fa = {b:"p", v:"f", w:"f", z:"s", x:"s", "\u00df":"s", d:"t", n:"m", c:"k", g:"k", j:"k", q:"k", i:"e", y:"e", u:"o"}; +function Ca(a) { + a = za.call(this, a).join(" "); const b = []; if (a) { - const c = a.split(Fa), d = c.length; + const c = a.split(Ea), d = c.length; for (let e = 0, f, h = 0; e < d; e++) { if ((a = c[e]) && (!this.filter || !this.filter[a])) { f = a[0]; - let g = Ga[f] || f, k = g; + let g = Fa[f] || f, k = g; for (let m = 1; m < a.length; m++) { f = a[m]; - const n = Ga[f] || f; + const n = Fa[f] || f; n && n !== k && (g += n, k = n); } b[h++] = g; @@ -949,31 +949,30 @@ function Da(a) { } return b; } -;var Ia = {encode:Ha, F:!1, G:""}; -const Ja = [F("ae"), "a", F("oe"), "o", F("sh"), "s", F("th"), "t", F("ph"), "f", F("pf"), "f", F("(?![aeo])h(?![aeo])"), "", F("(?!^[aeo])h(?!^[aeo])"), ""]; -function Ha(a, b) { - a && (a = Da.call(this, a).join(" "), 2 < a.length && (a = E(a, Ja)), b || (1 < a.length && (a = ha(a)), a && (a = a.split(" ")))); +;var Ha = {encode:Ga, F:!1, G:""}; +const Ia = [G("ae"), "a", G("oe"), "o", G("sh"), "s", G("th"), "t", G("ph"), "f", G("pf"), "f", G("(?![aeo])h(?![aeo])"), "", G("(?!^[aeo])h(?!^[aeo])"), ""]; +function Ga(a, b) { + a && (a = Ca.call(this, a).join(" "), 2 < a.length && (a = F(a, Ia)), b || (1 < a.length && (a = fa(a)), a && (a = a.split(" ")))); return a || []; } -;var La = {encode:Ka, F:!1, G:""}; -const Ma = F("(?!\\b)[aeo]"); -function Ka(a) { - a && (a = Ha.call(this, a, !0), 1 < a.length && (a = a.replace(Ma, "")), 1 < a.length && (a = ha(a)), a && (a = a.split(" "))); +;var Ka = {encode:Ja, F:!1, G:""}; +const La = G("(?!\\b)[aeo]"); +function Ja(a) { + a && (a = Ga.call(this, a, !0), 1 < a.length && (a = a.replace(La, "")), 1 < a.length && (a = fa(a)), a && (a = a.split(" "))); return a || []; } -;G["latin:default"] = ja; -G["latin:simple"] = Ba; -G["latin:balance"] = Ea; -G["latin:advanced"] = Ia; -G["latin:extra"] = La; -const W = self; -let Y; -const Z = {Index:K, Document:Q, Worker:O, registerCharset:function(a, b) { - G[a] = b; +;I["latin:default"] = ia; +I["latin:simple"] = Aa; +I["latin:balance"] = Da; +I["latin:advanced"] = Ha; +I["latin:extra"] = Ka; +const Y = {Index:L, Document:S, Worker:P, registerCharset:function(a, b) { + I[a] = b; }, registerLanguage:function(a, b) { - ka[a] = b; + ja[a] = b; }}; -(Y = W.define) && Y.amd ? Y([], function() { - return Z; -}) : W.exports ? W.exports = Z : W.FlexSearch = Z; +let Z; +(Z = self.define) && Z.amd ? Z([], function() { + return Y; +}) : self.exports ? self.exports = Y : self.FlexSearch = Y; }(this)); diff --git a/dist/flexsearch.bundle.min.js b/dist/flexsearch.bundle.min.js index 25b5c60..cc14085 100644 --- a/dist/flexsearch.bundle.min.js +++ b/dist/flexsearch.bundle.min.js @@ -1,34 +1,34 @@ /**! - * FlexSearch.js v0.7.39 (Bundle) + * FlexSearch.js v0.7.40 (Bundle) * Author and Copyright: Thomas Wilkerling * Licence: Apache-2.0 * Hosted by Nextapps GmbH * https://github.com/nextapps-de/flexsearch */ -(function _factory(self){'use strict';var t;function u(a){return"undefined"!==typeof a?a:!0}function aa(a){const b=Array(a);for(let c=0;c=this.B&&(w||!n[l])){var f=L(q,d,r),h="";switch(this.G){case "full":if(2f;g--)if(g-f>=this.B){var k=L(q,d,r,e,f);h=l.substring(f,g);M(this,n,h,k,a,c)}break}case "reverse":if(1=this.B&&M(this,n, -h,L(q,d,r,e,g),a,c);h=""}case "forward":if(1=this.B&&M(this,n,h,f,a,c);break}default:if(this.C&&(f=Math.min(f/this.C(b,l,r)|0,q-1)),M(this,n,l,f,a,c),w&&1=this.B&&!e[l]){e[l]=1;const p=this.l&&l>f;M(this,m,p?f:l,L(h+(d/2>h?0:1),d,r,g-1,k-1),a,c,p?l:f)}}}}this.m||(this.register[a]=1)}}return this}; -function L(a,b,c,d,e){return c&&1=this.B&&!c[q])if(this.s||f||this.map[q])k[w++]=q,c[q]=1;else return d;a=k;e=a.length}if(!e)return d;b||(b=100);g=this.depth&&1=d)))break;if(n){if(f)return ta(k,d,0);b[b.length]=k;return}}return!c&&k}function ta(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} -function ua(a,b,c,d){c?(d=d&&b>c,a=(a=a[d?b:c])&&a[d?c:b]):a=a[b];return a}t.contain=function(a){return!!this.register[a]};t.update=function(a,b){return this.remove(a).add(a,b)}; -t.remove=function(a,b){const c=this.register[a];if(c){if(this.m)for(let d=0,e;d{f=m}));let g,k;switch(e||(e=0)){case 0:g="reg";if(this.m){k=v();for(let m in this.register)k[m]=1}else k=this.register;break;case 1:g="cfg";k={doc:0,opt:this.s?1:0};break;case 2:g="map";k=this.map;break;case 3:g="ctx";k=this.h;break;default:"undefined"===typeof c&&f&&f();return}ra(a,b||this,c,g,d,e,k,f);return h}; -t.import=function(a,b){if(b)switch(x(b)&&(b=JSON.parse(b)),a){case "cfg":this.s=!!b.opt;break;case "reg":this.m=!1;this.register=b;break;case "map":this.map=b;break;case "ctx":this.h=b}};la(K.prototype);function va(a){a=a.data;var b=self._index;const c=a.args;var d=a.task;switch(d){case "init":d=a.options||{};a=a.factory;b=d.encode;d.cache=!1;b&&0===b.indexOf("function")&&(d.encode=Function("return "+b)());a?(Function("return "+a)()(self),self._index=new self.FlexSearch.Index(d),delete self.FlexSearch):self._index=new K(d);break;default:a=a.id,b=b[d].apply(b,c),postMessage("search"===d?{id:a,msg:b}:{id:a})}};let wa=0;function O(a){if(!(this instanceof O))return new O(a);var b;a?D(b=a.encode)&&(a.encode=b.toString()):a={};(b=(self||window)._factory)&&(b=b.toString());const c="undefined"===typeof window&&self.exports,d=this;this.o=xa(b,c,a.worker);this.h=v();if(this.o){if(c)this.o.on("message",function(e){d.h[e.id](e.msg);delete d.h[e.id]});else this.o.onmessage=function(e){e=e.data;d.h[e.id](e.msg);delete d.h[e.id]};this.o.postMessage({task:"init",factory:b,options:a})}}P("add");P("append");P("search"); -P("update");P("remove");function P(a){O.prototype[a]=O.prototype[a+"Async"]=function(){const b=this,c=[].slice.call(arguments);var d=c[c.length-1];let e;D(d)&&(e=d,c.splice(c.length-1,1));d=new Promise(function(f){setTimeout(function(){b.h[++wa]=f;b.o.postMessage({task:a,id:wa,args:c})})});return e?(d.then(e),this):d}} -function xa(a,b,c){let d;try{d=b?eval('new (require("worker_threads")["Worker"])("../dist/node/node.js")'):a?new Worker(URL.createObjectURL(new Blob(["onmessage="+va.toString()],{type:"text/javascript"}))):new Worker(x(c)?c:"worker/worker.js",{type:"module"})}catch(e){}return d};function Q(a){if(!(this instanceof Q))return new Q(a);var b=a.document||a.doc||a,c;this.K=[];this.h=[];this.A=[];this.register=v();this.key=(c=b.key||b.id)&&S(c,this.A)||"id";this.m=u(a.fastupdate);this.C=(c=b.store)&&!0!==c&&[];this.store=c&&v();this.I=(c=b.tag)&&S(c,this.A);this.l=c&&v();this.cache=(c=a.cache)&&new J(c);a.cache=!1;this.o=a.worker;this.async=!1;c=v();let d=b.index||b.field||b;x(d)&&(d=[d]);for(let e=0,f,h;eb||c)e=e.slice(c,c+b);d&&(e=za.call(this,e));return{tag:a,result:e}}}function za(a){const b=Array(a.length);for(let c=0,d;c{f=g}));e||(e=0);d||(d=0);if(d=this.B&&(w||!n[l])){var f=M(q,d,r),h="";switch(this.G){case "full":if(2f;g--)if(g-f>=this.B){var k=M(q,d,r,e,f);h=l.substring(f,g);N(this,n,h,k,a,c)}break}case "reverse":if(1=this.B&&N(this,n, +h,M(q,d,r,e,g),a,c);h=""}case "forward":if(1=this.B&&N(this,n,h,f,a,c);break}default:if(this.C&&(f=Math.min(f/this.C(b,l,r)|0,q-1)),N(this,n,l,f,a,c),w&&1=this.B&&!e[l]){e[l]=1;const p=this.l&&l>f;N(this,m,p?f:l,M(h+(d/2>h?0:1),d,r,g-1,k-1),a,c,p?l:f)}}}}this.m||(this.register[a]=1)}}return this}; +function M(a,b,c,d,e){return c&&1=this.B&&!c[q])if(this.s||f||this.map[q])k[w++]=q,c[q]=1;else return d;a=k;e=a.length}if(!e)return d;b||(b=100);g=this.depth&&1=d)))break;if(n){if(f)return sa(k,d,0);b[b.length]=k;return}}return!c&&k}function sa(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} +function ta(a,b,c,d){c?(d=d&&b>c,a=(a=a[d?b:c])&&a[d?c:b]):a=a[b];return a}t.contain=function(a){return!!this.register[a]};t.update=function(a,b){return this.remove(a).add(a,b)}; +t.remove=function(a,b){const c=this.register[a];if(c){if(this.m)for(let d=0,e;d{f=m}));let g,k;switch(e||(e=0)){case 0:g="reg";if(this.m){k=x();for(let m in this.register)k[m]=1}else k=this.register;break;case 1:g="cfg";k={doc:0,opt:this.s?1:0};break;case 2:g="map";k=this.map;break;case 3:g="ctx";k=this.h;break;default:"undefined"===typeof c&&f&&f();return}qa(a,b||this,c,g,d,e,k,f);return h}; +t.import=function(a,b){if(b)switch(C(b)&&(b=JSON.parse(b)),a){case "cfg":this.s=!!b.opt;break;case "reg":this.m=!1;this.register=b;break;case "map":this.map=b;break;case "ctx":this.h=b}};ka(L.prototype);function ua(a){a=a.data;var b=self._index;const c=a.args;var d=a.task;switch(d){case "init":d=a.options||{};a=a.factory;b=d.encode;d.cache=!1;b&&0===b.indexOf("function")&&(d.encode=Function("return "+b)());a?(Function("return "+a)()(self),self._index=new self.FlexSearch.Index(d),delete self.FlexSearch):self._index=new L(d);break;default:a=a.id,b=b[d].apply(b,c),postMessage("search"===d?{id:a,msg:b}:{id:a})}};let va=0;function P(a){if(!(this instanceof P))return new P(a);var b;a?E(b=a.encode)&&(a.encode=b.toString()):a={};(b=(self||window)._factory)&&(b=b.toString());const c="undefined"===typeof window&&self.exports,d=this;this.o=wa(b,c,a.worker);this.h=x();if(this.o){if(c)this.o.on("message",function(e){d.h[e.id](e.msg);delete d.h[e.id]});else this.o.onmessage=function(e){e=e.data;d.h[e.id](e.msg);delete d.h[e.id]};this.o.postMessage({task:"init",factory:b,options:a})}}Q("add");Q("append");Q("search"); +Q("update");Q("remove");function Q(a){P.prototype[a]=P.prototype[a+"Async"]=function(){const b=this,c=[].slice.call(arguments);var d=c[c.length-1];let e;E(d)&&(e=d,c.splice(c.length-1,1));d=new Promise(function(f){setTimeout(function(){b.h[++va]=f;b.o.postMessage({task:a,id:va,args:c})})});return e?(d.then(e),this):d}} +function wa(a,b,c){let d;try{d=b?eval('new (require("worker_threads")["Worker"])("../dist/node/node.js")'):a?new Worker(URL.createObjectURL(new Blob(["onmessage="+ua.toString()],{type:"text/javascript"}))):new Worker(C(c)?c:"worker/worker.js",{type:"module"})}catch(e){}return d};function S(a){if(!(this instanceof S))return new S(a);var b=a.document||a.doc||a,c;this.K=[];this.h=[];this.A=[];this.register=x();this.key=(c=b.key||b.id)&&T(c,this.A)||"id";this.m=u(a.fastupdate);this.C=(c=b.store)&&!0!==c&&[];this.store=c&&x();this.I=(c=b.tag)&&T(c,this.A);this.l=c&&x();this.cache=(c=a.cache)&&new K(c);a.cache=!1;this.o=a.worker;this.async=!1;c=x();let d=b.index||b.field||b;C(d)&&(d=[d]);for(let e=0,f,h;eb||c)e=e.slice(c,c+b);d&&(e=ya.call(this,e));return{tag:a,result:e}}}function ya(a){const b=Array(a.length);for(let c=0,d;c{f=g}));e||(e=0);d||(d=0);if(d= this.B && (w || !n[l])) { - var f = L(q, d, r), h = ""; + var f = O(q, d, r), h = ""; switch(this.G) { case "full": if (2 < e) { for (f = 0; f < e; f++) { for (var g = e; g > f; g--) { if (g - f >= this.B) { - var k = L(q, d, r, e, f); + var k = O(q, d, r, e, f); h = l.substring(f, g); - M(this, n, h, k, a, c); + P(this, n, h, k, a, c); } } } @@ -304,24 +304,24 @@ t.add = function(a, b, c, d) { case "reverse": if (1 < e) { for (g = e - 1; 0 < g; g--) { - h = l[g] + h, h.length >= this.B && M(this, n, h, L(q, d, r, e, g), a, c); + h = l[g] + h, h.length >= this.B && P(this, n, h, O(q, d, r, e, g), a, c); } h = ""; } case "forward": if (1 < e) { for (g = 0; g < e; g++) { - h += l[g], h.length >= this.B && M(this, n, h, f, a, c); + h += l[g], h.length >= this.B && P(this, n, h, f, a, c); } break; } default: - if (this.C && (f = Math.min(f / this.C(b, l, r) | 0, q - 1)), M(this, n, l, f, a, c), w && 1 < d && r < d - 1) { - for (e = v(), h = this.A, f = l, g = Math.min(w + 1, d - r), e[f] = 1, k = 1; k < g; k++) { + if (this.C && (f = Math.min(f / this.C(b, l, r) | 0, q - 1)), P(this, n, l, f, a, c), w && 1 < d && r < d - 1) { + for (e = x(), h = this.A, f = l, g = Math.min(w + 1, d - r), e[f] = 1, k = 1; k < g; k++) { if ((l = b[this.F ? d - 1 - r - k : r + k]) && l.length >= this.B && !e[l]) { e[l] = 1; const p = this.l && l > f; - M(this, m, p ? f : l, L(h + (d / 2 > h ? 0 : 1), d, r, g - 1, k - 1), a, c, p ? l : f); + P(this, m, p ? f : l, O(h + (d / 2 > h ? 0 : 1), d, r, g - 1, k - 1), a, c, p ? l : f); } } } @@ -333,17 +333,17 @@ t.add = function(a, b, c, d) { } return this; }; -function L(a, b, c, d, e) { +function O(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 M(a, b, c, d, e, f, h) { +function P(a, b, c, d, e, f, h) { let g = h ? a.h : a.map; if (!b[c] || h && !b[c][h]) { - a.s && (g = g[d]), h ? (b = b[c] || (b[c] = v()), b[h] = 1, g = g[h] || (g[h] = v())) : b[c] = 1, g = g[c] || (g[c] = []), a.s || (g = g[d] || (g[d] = [])), f && g.includes(e) || (g[g.length] = e, a.m && (a = a.register[e] || (a.register[e] = []), a[a.length] = g)); + a.s && (g = g[d]), h ? (b = b[c] || (b[c] = x()), b[h] = 1, g = g[h] || (g[h] = x())) : b[c] = 1, g = g[c] || (g[c] = []), a.s || (g = g[d] || (g[d] = [])), f && g.includes(e) || (g[g.length] = e, a.m && (a = a.register[e] || (a.register[e] = []), a[a.length] = g)); } } t.search = function(a, b, c) { - c || (!b && C(a) ? (c = a, a = c.query) : C(b) && (c = b)); + c || (!b && D(a) ? (c = a, a = c.query) : D(b) && (c = b)); let d = [], e; let f, h = 0; if (c) { @@ -354,7 +354,7 @@ t.search = function(a, b, c) { f = c.suggest; } if (a && (a = this.encode("" + a), e = a.length, 1 < e)) { - c = v(); + c = x(); var k = []; for (let n = 0, w = 0, q; n < e; n++) { if ((q = a[n]) && q.length >= this.B && !c[q]) { @@ -375,10 +375,10 @@ t.search = function(a, b, c) { g = this.depth && 1 < e && !1 !== g; c = 0; let m; - g ? (m = a[0], c = 1) : 1 < e && a.sort(ba); + g ? (m = a[0], c = 1) : 1 < e && a.sort(aa); for (let n, w; c < e; c++) { w = a[c]; - g ? (n = sa(this, d, f, b, h, 2 === e, w, m), f && !1 === n && d.length || (m = w)) : n = sa(this, d, f, b, h, 1 === e, w); + g ? (n = pa(this, d, f, b, h, 2 === e, w, m), f && !1 === n && d.length || (m = w)) : n = pa(this, d, f, b, h, 1 === e, w); if (n) { return n; } @@ -393,28 +393,28 @@ t.search = function(a, b, c) { return d; } if (1 === k) { - return ta(d[0], b, h); + return qa(d[0], b, h); } } } - return ma(d, b, h, f); + return ja(d, b, h, f); }; -function sa(a, b, c, d, e, f, h, g) { +function pa(a, b, c, d, e, f, h, g) { let k = [], m = g ? a.h : a.map; - a.s || (m = ua(m, h, g, a.l)); + a.s || (m = ra(m, h, g, a.l)); if (m) { let n = 0; const w = Math.min(m.length, g ? a.A : a.D); for (let q = 0, r = 0, l, p; q < w; q++) { if (l = m[q]) { - if (a.s && (l = ua(l, h, g, a.l)), e && l && f && (p = l.length, p <= e ? (e -= p, l = null) : (l = l.slice(e), e = 0)), l && (k[n++] = l, f && (r += l.length, r >= d))) { + if (a.s && (l = ra(l, h, g, a.l)), e && l && f && (p = l.length, p <= e ? (e -= p, l = null) : (l = l.slice(e), e = 0)), l && (k[n++] = l, f && (r += l.length, r >= d))) { break; } } } if (n) { if (f) { - return ta(k, d, 0); + return qa(k, d, 0); } b[b.length] = k; return; @@ -422,11 +422,11 @@ function sa(a, b, c, d, e, f, h, g) { } return !c && k; } -function ta(a, b, c) { +function qa(a, b, c) { a = 1 === a.length ? a[0] : [].concat.apply([], a); return c || a.length > b ? a.slice(c, c + b) : a; } -function ua(a, b, c, d) { +function ra(a, b, c, d) { c ? (d = d && b > c, a = (a = a[d ? b : c]) && a[d ? c : b]) : a = a[b]; return a; } @@ -444,7 +444,7 @@ t.remove = function(a, b) { e = c[d], e.splice(e.indexOf(a), 1); } } else { - N(this.map, a, this.D, this.s), this.depth && N(this.h, a, this.A, this.s); + Q(this.map, a, this.D, this.s), this.depth && Q(this.h, a, this.A, this.s); } b || delete this.register[a]; if (this.cache) { @@ -456,7 +456,7 @@ t.remove = function(a, b) { } return this; }; -function N(a, b, c, d, e) { +function Q(a, b, c, d, e) { let f = 0; if (a.constructor === Array) { if (e) { @@ -465,18 +465,18 @@ function N(a, b, c, d, e) { e = Math.min(a.length, c); for (let h = 0, g; h < e; h++) { if (g = a[h]) { - f = N(g, b, c, d, e), d || f || delete a[h]; + f = Q(g, b, c, d, e), d || f || delete a[h]; } } } } else { for (let h in a) { - (f = N(a[h], b, c, d, e)) || delete a[h]; + (f = Q(a[h], b, c, d, e)) || delete a[h]; } } return f; } -t.searchCache = oa; +t.searchCache = la; t.export = function(a, b, c, d, e, f) { let h = !0; "undefined" === typeof f && (h = new Promise(m => { @@ -487,7 +487,7 @@ t.export = function(a, b, c, d, e, f) { case 0: g = "reg"; if (this.m) { - k = v(); + k = x(); for (let m in this.register) { k[m] = 1; } @@ -511,12 +511,12 @@ t.export = function(a, b, c, d, e, f) { "undefined" === typeof c && f && f(); return; } - ra(a, b || this, c, g, d, e, k, f); + oa(a, b || this, c, g, d, e, k, f); return h; }; t.import = function(a, b) { if (b) { - switch(x(b) && (b = JSON.parse(b)), a) { + switch(C(b) && (b = JSON.parse(b)), a) { case "cfg": this.s = !!b.opt; break; @@ -532,8 +532,8 @@ t.import = function(a, b) { } } }; -la(K.prototype); -function va(a) { +ia(N.prototype); +function sa(a) { a = a.data; var b = self._index; const c = a.args; @@ -545,23 +545,23 @@ function va(a) { b = d.encode; d.cache = !1; b && 0 === b.indexOf("function") && (d.encode = Function("return " + b)()); - a ? (Function("return " + a)()(self), self._index = new self.FlexSearch.Index(d), delete self.FlexSearch) : self._index = new K(d); + a ? (Function("return " + a)()(self), self._index = new self.FlexSearch.Index(d), delete self.FlexSearch) : self._index = new N(d); break; default: a = a.id, b = b[d].apply(b, c), postMessage("search" === d ? {id:a, msg:b} : {id:a}); } } -;let wa = 0; -function O(a) { - if (!(this instanceof O)) { - return new O(a); +;let ta = 0; +function S(a) { + if (!(this instanceof S)) { + return new S(a); } var b; - a ? D(b = a.encode) && (a.encode = b.toString()) : a = {}; + a ? E(b = a.encode) && (a.encode = b.toString()) : a = {}; (b = (self || window)._factory) && (b = b.toString()); const c = "undefined" === typeof window && self.exports, d = this; - this.o = xa(b, c, a.worker); - this.h = v(); + this.o = ua(b, c, a.worker); + this.h = x(); if (this.o) { if (c) { this.o.on("message", function(e) { @@ -578,67 +578,67 @@ function O(a) { this.o.postMessage({task:"init", factory:b, options:a}); } } -P("add"); -P("append"); -P("search"); -P("update"); -P("remove"); -function P(a) { - O.prototype[a] = O.prototype[a + "Async"] = function() { +T("add"); +T("append"); +T("search"); +T("update"); +T("remove"); +function T(a) { + S.prototype[a] = S.prototype[a + "Async"] = function() { const b = this, c = [].slice.call(arguments); var d = c[c.length - 1]; let e; - D(d) && (e = d, c.splice(c.length - 1, 1)); + E(d) && (e = d, c.splice(c.length - 1, 1)); d = new Promise(function(f) { setTimeout(function() { - b.h[++wa] = f; - b.o.postMessage({task:a, id:wa, args:c}); + b.h[++ta] = f; + b.o.postMessage({task:a, id:ta, args:c}); }); }); return e ? (d.then(e), this) : d; }; } -function xa(a, b, c) { +function ua(a, b, c) { let d; try { - d = b ? eval('new (require("worker_threads")["Worker"])("../dist/node/node.js")') : a ? new Worker(URL.createObjectURL(new Blob(["onmessage=" + va.toString()], {type:"text/javascript"}))) : new Worker(x(c) ? c : "worker/worker.js", {type:"module"}); + d = b ? eval('new (require("worker_threads")["Worker"])("../dist/node/node.js")') : a ? new Worker(URL.createObjectURL(new Blob(["onmessage=" + sa.toString()], {type:"text/javascript"}))) : new Worker(C(c) ? c : "worker/worker.js", {type:"module"}); } catch (e) { } return d; } -;function Q(a) { - if (!(this instanceof Q)) { - return new Q(a); +;function U(a) { + if (!(this instanceof U)) { + return new U(a); } var b = a.document || a.doc || a, c; this.K = []; this.h = []; this.A = []; - this.register = v(); - this.key = (c = b.key || b.id) && S(c, this.A) || "id"; + this.register = x(); + this.key = (c = b.key || b.id) && V(c, this.A) || "id"; this.m = u(a.fastupdate); this.C = (c = b.store) && !0 !== c && []; - this.store = c && v(); - this.I = (c = b.tag) && S(c, this.A); - this.l = c && v(); - this.cache = (c = a.cache) && new J(c); + this.store = c && x(); + this.I = (c = b.tag) && V(c, this.A); + this.l = c && x(); + this.cache = (c = a.cache) && new M(c); a.cache = !1; this.o = a.worker; this.async = !1; - c = v(); + c = x(); let d = b.index || b.field || b; - x(d) && (d = [d]); + C(d) && (d = [d]); for (let e = 0, f, h; e < d.length; e++) { - f = d[e], x(f) || (h = f, f = f.field), h = C(h) ? Object.assign({}, a, h) : a, this.o && (c[f] = new O(h), c[f].o || (this.o = !1)), this.o || (c[f] = new K(h, this.register)), this.K[e] = S(f, this.A), this.h[e] = f; + f = d[e], C(f) || (h = f, f = f.field), h = D(h) ? Object.assign({}, a, h) : a, this.o && (c[f] = new S(h), c[f].o || (this.o = !1)), this.o || (c[f] = new N(h, this.register)), this.K[e] = V(f, this.A), this.h[e] = f; } if (this.C) { - for (a = b.store, x(a) && (a = [a]), b = 0; b < a.length; b++) { - this.C[b] = S(a[b], this.A); + for (a = b.store, C(a) && (a = [a]), b = 0; b < a.length; b++) { + this.C[b] = V(a[b], this.A); } } this.index = c; } -function S(a, b) { +function V(a, b) { const c = a.split(":"); let d = 0; for (let e = 0; e < c.length; e++) { @@ -647,8 +647,8 @@ function S(a, b) { d < c.length && (c.length = d); return 1 < d ? c : c[0]; } -function T(a, b) { - if (x(b)) { +function X(a, b) { + if (C(b)) { a = a[b]; } else { for (let c = 0; a && c < b.length; c++) { @@ -657,21 +657,21 @@ function T(a, b) { } return a; } -function U(a, b, c, d, e) { +function Y(a, b, c, d, e) { a = a[e]; if (d === c.length - 1) { b[e] = a; } else if (a) { if (a.constructor === Array) { for (b = b[e] = Array(a.length), e = 0; e < a.length; e++) { - U(a, b, c, d, e); + Y(a, b, c, d, e); } } else { - b = b[e] || (b[e] = v()), e = c[++d], U(a, b, c, d, e); + b = b[e] || (b[e] = x()), e = c[++d], Y(a, b, c, d, e); } } } -function V(a, b, c, d, e, f, h, g) { +function Z(a, b, c, d, e, f, h, g) { if (a = a[h]) { if (d === b.length - 1) { if (a.constructor === Array) { @@ -687,27 +687,27 @@ function V(a, b, c, d, e, f, h, g) { } else { if (a.constructor === Array) { for (h = 0; h < a.length; h++) { - V(a, b, c, d, e, f, h, g); + Z(a, b, c, d, e, f, h, g); } } else { - h = b[++d], V(a, b, c, d, e, f, h, g); + h = b[++d], Z(a, b, c, d, e, f, h, g); } } } } -t = Q.prototype; +t = U.prototype; t.add = function(a, b, c) { - C(a) && (b = a, a = T(b, this.key)); + D(a) && (b = a, a = X(b, this.key)); if (b && (a || 0 === a)) { if (!c && this.register[a]) { return this.update(a, b); } for (let d = 0, e, f; d < this.h.length; d++) { - f = this.h[d], e = this.K[d], x(e) && (e = [e]), V(b, e, this.A, 0, this.index[f], a, e[0], c); + f = this.h[d], e = this.K[d], C(e) && (e = [e]), Z(b, e, this.A, 0, this.index[f], a, e[0], c); } if (this.I) { - let d = T(b, this.I), e = v(); - x(d) && (d = [d]); + let d = X(b, this.I), e = x(); + C(d) && (d = [d]); for (let f = 0, h, g; f < d.length; f++) { if (h = d[f], !e[h] && (e[h] = 1, g = this.l[h] || (this.l[h] = []), !c || !g.includes(a))) { if (g[g.length] = a, this.m) { @@ -720,9 +720,9 @@ t.add = function(a, b, c) { if (this.store && (!c || !this.store[a])) { let d; if (this.C) { - d = v(); + d = x(); for (let e = 0, f; e < this.C.length; e++) { - f = this.C[e], x(f) ? d[f] = b[f] : U(b, d, f, 0, f[0]); + f = this.C[e], C(f) ? d[f] = b[f] : Y(b, d, f, 0, f[0]); } } this.store[a] = d || b; @@ -737,7 +737,7 @@ t.update = function(a, b) { return this.remove(a).add(a, b); }; t.remove = function(a) { - C(a) && (a = T(a, this.key)); + D(a) && (a = X(a, this.key)); if (this.register[a]) { for (var b = 0; b < this.h.length && (this.index[this.h[b]].remove(a, !this.o), !this.m); b++) { } @@ -754,7 +754,7 @@ t.remove = function(a) { return this; }; t.search = function(a, b, c, d) { - c || (!b && C(a) ? (c = a, a = "") : C(b) && (c = b, b = 0)); + c || (!b && D(a) ? (c = a, a = "") : D(b) && (c = b, b = 0)); let e = [], f = [], h, g, k, m, n, w, q = 0; if (c) { if (c.constructor === Array) { @@ -767,15 +767,15 @@ t.search = function(a, b, c, d) { n = "and" === c.bool; b = c.limit || b || 100; w = c.offset || 0; - if (m && (x(m) && (m = [m]), !a)) { + if (m && (C(m) && (m = [m]), !a)) { for (let l = 0, p; l < m.length; l++) { - if (p = ya.call(this, m[l], b, w, g)) { + if (p = va.call(this, m[l], b, w, g)) { e[e.length] = p, q++; } } return q ? e : []; } - x(k) && (k = [k]); + C(k) && (k = [k]); } } k || (k = this.h); @@ -784,7 +784,7 @@ t.search = function(a, b, c, d) { for (let l = 0, p, A, B; l < k.length; l++) { let z; A = k[l]; - x(A) || (z = A, A = z.field, a = z.query || a, b = z.limit || b, g = z.enrich || g); + C(A) || (z = A, A = z.field, a = z.query || a, b = z.limit || b, g = z.enrich || g); if (r) { r[l] = this.index[A].searchAsync(a, b, z || c); } else { @@ -794,12 +794,12 @@ t.search = function(a, b, c, d) { const y = []; let H = 0; n && (y[0] = [p]); - for (let X = 0, qa, R; X < m.length; X++) { - if (qa = m[X], B = (R = this.l[qa]) && R.length) { + for (let W = 0, na, R; W < m.length; W++) { + if (na = m[W], B = (R = this.l[na]) && R.length) { H++, y[y.length] = n ? [R] : R; } } - H && (p = n ? ma(y, b || 100, w || 0) : na(p, y), B = p.length); + H && (p = n ? ja(y, b || 100, w || 0) : ka(p, y), B = p.length); } if (B) { f[q] = A, e[q++] = p; @@ -824,7 +824,7 @@ t.search = function(a, b, c, d) { } for (let l = 0, p; l < f.length; l++) { p = e[l]; - p.length && g && (p = za.call(this, p)); + p.length && g && (p = wa.call(this, p)); if (h) { return p; } @@ -832,17 +832,17 @@ t.search = function(a, b, c, d) { } return e; }; -function ya(a, b, c, d) { +function va(a, b, c, d) { let e = this.l[a], f = e && e.length - c; if (f && 0 < f) { if (f > b || c) { e = e.slice(c, c + b); } - d && (e = za.call(this, e)); + d && (e = wa.call(this, e)); return {tag:a, result:e}; } } -function za(a) { +function wa(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[d]}; @@ -859,7 +859,7 @@ t.set = function(a, b) { this.store[a] = b; return this; }; -t.searchCache = oa; +t.searchCache = la; t.export = function(a, b, c, d, e, f) { let h; "undefined" === typeof f && (h = new Promise(g => { @@ -890,13 +890,13 @@ t.export = function(a, b, c, d, e, f) { f(); return; } - ra(a, this, c, g, d, e, k, f); + oa(a, this, c, g, d, e, k, f); } return h; }; t.import = function(a, b) { if (b) { - switch(x(b) && (b = JSON.parse(b)), a) { + switch(C(b) && (b = JSON.parse(b)), a) { case "tag": this.l = b; break; @@ -918,28 +918,28 @@ t.import = function(a, b) { } } }; -la(Q.prototype); -var Ba = {encode:Aa, F:!1, G:""}; -const Ca = [F("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"), "a", F("[\u00e8\u00e9\u00ea\u00eb]"), "e", F("[\u00ec\u00ed\u00ee\u00ef]"), "i", F("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"), "o", F("[\u00f9\u00fa\u00fb\u00fc\u0171]"), "u", F("[\u00fd\u0177\u00ff]"), "y", F("\u00f1"), "n", F("[\u00e7c]"), "k", F("\u00df"), "s", F(" & "), " and "]; -function Aa(a) { +ia(U.prototype); +var ya = {encode:xa, F:!1, G:""}; +const za = [J("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"), "a", J("[\u00e8\u00e9\u00ea\u00eb]"), "e", J("[\u00ec\u00ed\u00ee\u00ef]"), "i", J("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"), "o", J("[\u00f9\u00fa\u00fb\u00fc\u0171]"), "u", J("[\u00fd\u0177\u00ff]"), "y", J("\u00f1"), "n", J("[\u00e7c]"), "k", J("\u00df"), "s", J(" & "), " and "]; +function xa(a) { var b = a = "" + a; - b.normalize && (b = b.normalize("NFD").replace(ea, "")); - return ca.call(this, b.toLowerCase(), !a.normalize && Ca); + b.normalize && (b = b.normalize("NFD").replace(ca, "")); + return F.call(this, b.toLowerCase(), !a.normalize && za); } -;var Ea = {encode:Da, F:!1, G:"strict"}; -const Fa = /[^a-z0-9]+/, Ga = {b:"p", v:"f", w:"f", z:"s", x:"s", "\u00df":"s", d:"t", n:"m", c:"k", g:"k", j:"k", q:"k", i:"e", y:"e", u:"o"}; -function Da(a) { - a = Aa.call(this, a).join(" "); +;var Ba = {encode:Aa, F:!1, G:"strict"}; +const Ca = /[^a-z0-9]+/, Da = {b:"p", v:"f", w:"f", z:"s", x:"s", "\u00df":"s", d:"t", n:"m", c:"k", g:"k", j:"k", q:"k", i:"e", y:"e", u:"o"}; +function Aa(a) { + a = xa.call(this, a).join(" "); const b = []; if (a) { - const c = a.split(Fa), d = c.length; + const c = a.split(Ca), d = c.length; for (let e = 0, f, h = 0; e < d; e++) { if ((a = c[e]) && (!this.filter || !this.filter[a])) { f = a[0]; - let g = Ga[f] || f, k = g; + let g = Da[f] || f, k = g; for (let m = 1; m < a.length; m++) { f = a[m]; - const n = Ga[f] || f; + const n = Da[f] || f; n && n !== k && (g += n, k = n); } b[h++] = g; @@ -948,31 +948,26 @@ function Da(a) { } return b; } -;var Ia = {encode:Ha, F:!1, G:""}; -const Ja = [F("ae"), "a", F("oe"), "o", F("sh"), "s", F("th"), "t", F("ph"), "f", F("pf"), "f", F("(?![aeo])h(?![aeo])"), "", F("(?!^[aeo])h(?!^[aeo])"), ""]; -function Ha(a, b) { - a && (a = Da.call(this, a).join(" "), 2 < a.length && (a = E(a, Ja)), b || (1 < a.length && (a = ha(a)), a && (a = a.split(" ")))); +;var Fa = {encode:Ea, F:!1, G:""}; +const Ga = [J("ae"), "a", J("oe"), "o", J("sh"), "s", J("th"), "t", J("ph"), "f", J("pf"), "f", J("(?![aeo])h(?![aeo])"), "", J("(?!^[aeo])h(?!^[aeo])"), ""]; +function Ea(a, b) { + a && (a = Aa.call(this, a).join(" "), 2 < a.length && (a = G(a, Ga)), b || (1 < a.length && (a = da(a)), a && (a = a.split(" ")))); return a || []; } -;var La = {encode:Ka, F:!1, G:""}; -const Ma = F("(?!\\b)[aeo]"); -function Ka(a) { - a && (a = Ha.call(this, a, !0), 1 < a.length && (a = a.replace(Ma, "")), 1 < a.length && (a = ha(a)), a && (a = a.split(" "))); +;var Ia = {encode:Ha, F:!1, G:""}; +const Ja = J("(?!\\b)[aeo]"); +function Ha(a) { + a && (a = Ea.call(this, a, !0), 1 < a.length && (a = a.replace(Ja, "")), 1 < a.length && (a = da(a)), a && (a = a.split(" "))); return a || []; } -;G["latin:default"] = ja; -G["latin:simple"] = Ba; -G["latin:balance"] = Ea; -G["latin:advanced"] = Ia; -G["latin:extra"] = La; -const W = self; -let Y; -const Z = {Index:K, Document:Q, Worker:O, registerCharset:function(a, b) { - G[a] = b; +;K["latin:default"] = fa; +K["latin:simple"] = ya; +K["latin:balance"] = Ba; +K["latin:advanced"] = Fa; +K["latin:extra"] = Ia; +export default {Index:N, Document:U, Worker:S, registerCharset:function(a, b) { + K[a] = b; }, registerLanguage:function(a, b) { - ka[a] = b; + ha[a] = b; }}; -(Y = W.define) && Y.amd ? Y([], function() { - return Z; -}) : W.exports ? W.exports = Z : W.FlexSearch = Z; diff --git a/dist/flexsearch.bundle.module.min.js b/dist/flexsearch.bundle.module.min.js index 5a3ca19..82b70c9 100644 --- a/dist/flexsearch.bundle.module.min.js +++ b/dist/flexsearch.bundle.module.min.js @@ -1,34 +1,34 @@ /**! - * FlexSearch.js v0.7.39 (Bundle.module) + * FlexSearch.js v0.7.40 (Bundle.module) * Author and Copyright: Thomas Wilkerling * Licence: Apache-2.0 * Hosted by Nextapps GmbH * https://github.com/nextapps-de/flexsearch */ -var t;function u(a){return"undefined"!==typeof a?a:!0}function aa(a){const b=Array(a);for(let c=0;c=this.B&&(w||!n[l])){var f=L(q,d,r),h="";switch(this.G){case "full":if(2f;g--)if(g-f>=this.B){var k=L(q,d,r,e,f);h=l.substring(f,g);M(this,n,h,k,a,c)}break}case "reverse":if(1=this.B&&M(this,n, -h,L(q,d,r,e,g),a,c);h=""}case "forward":if(1=this.B&&M(this,n,h,f,a,c);break}default:if(this.C&&(f=Math.min(f/this.C(b,l,r)|0,q-1)),M(this,n,l,f,a,c),w&&1=this.B&&!e[l]){e[l]=1;const p=this.l&&l>f;M(this,m,p?f:l,L(h+(d/2>h?0:1),d,r,g-1,k-1),a,c,p?l:f)}}}}this.m||(this.register[a]=1)}}return this}; -function L(a,b,c,d,e){return c&&1=this.B&&!c[q])if(this.s||f||this.map[q])k[w++]=q,c[q]=1;else return d;a=k;e=a.length}if(!e)return d;b||(b=100);g=this.depth&&1=d)))break;if(n){if(f)return ta(k,d,0);b[b.length]=k;return}}return!c&&k}function ta(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} -function ua(a,b,c,d){c?(d=d&&b>c,a=(a=a[d?b:c])&&a[d?c:b]):a=a[b];return a}t.contain=function(a){return!!this.register[a]};t.update=function(a,b){return this.remove(a).add(a,b)}; -t.remove=function(a,b){const c=this.register[a];if(c){if(this.m)for(let d=0,e;d{f=m}));let g,k;switch(e||(e=0)){case 0:g="reg";if(this.m){k=v();for(let m in this.register)k[m]=1}else k=this.register;break;case 1:g="cfg";k={doc:0,opt:this.s?1:0};break;case 2:g="map";k=this.map;break;case 3:g="ctx";k=this.h;break;default:"undefined"===typeof c&&f&&f();return}ra(a,b||this,c,g,d,e,k,f);return h}; -t.import=function(a,b){if(b)switch(x(b)&&(b=JSON.parse(b)),a){case "cfg":this.s=!!b.opt;break;case "reg":this.m=!1;this.register=b;break;case "map":this.map=b;break;case "ctx":this.h=b}};la(K.prototype);function va(a){a=a.data;var b=self._index;const c=a.args;var d=a.task;switch(d){case "init":d=a.options||{};a=a.factory;b=d.encode;d.cache=!1;b&&0===b.indexOf("function")&&(d.encode=Function("return "+b)());a?(Function("return "+a)()(self),self._index=new self.FlexSearch.Index(d),delete self.FlexSearch):self._index=new K(d);break;default:a=a.id,b=b[d].apply(b,c),postMessage("search"===d?{id:a,msg:b}:{id:a})}};let wa=0;function O(a){if(!(this instanceof O))return new O(a);var b;a?D(b=a.encode)&&(a.encode=b.toString()):a={};(b=(self||window)._factory)&&(b=b.toString());const c="undefined"===typeof window&&self.exports,d=this;this.o=xa(b,c,a.worker);this.h=v();if(this.o){if(c)this.o.on("message",function(e){d.h[e.id](e.msg);delete d.h[e.id]});else this.o.onmessage=function(e){e=e.data;d.h[e.id](e.msg);delete d.h[e.id]};this.o.postMessage({task:"init",factory:b,options:a})}}P("add");P("append");P("search"); -P("update");P("remove");function P(a){O.prototype[a]=O.prototype[a+"Async"]=function(){const b=this,c=[].slice.call(arguments);var d=c[c.length-1];let e;D(d)&&(e=d,c.splice(c.length-1,1));d=new Promise(function(f){setTimeout(function(){b.h[++wa]=f;b.o.postMessage({task:a,id:wa,args:c})})});return e?(d.then(e),this):d}} -function xa(a,b,c){let d;try{d=b?eval('new (require("worker_threads")["Worker"])("../dist/node/node.js")'):a?new Worker(URL.createObjectURL(new Blob(["onmessage="+va.toString()],{type:"text/javascript"}))):new Worker(x(c)?c:"worker/worker.js",{type:"module"})}catch(e){}return d};function Q(a){if(!(this instanceof Q))return new Q(a);var b=a.document||a.doc||a,c;this.K=[];this.h=[];this.A=[];this.register=v();this.key=(c=b.key||b.id)&&S(c,this.A)||"id";this.m=u(a.fastupdate);this.C=(c=b.store)&&!0!==c&&[];this.store=c&&v();this.I=(c=b.tag)&&S(c,this.A);this.l=c&&v();this.cache=(c=a.cache)&&new J(c);a.cache=!1;this.o=a.worker;this.async=!1;c=v();let d=b.index||b.field||b;x(d)&&(d=[d]);for(let e=0,f,h;eb||c)e=e.slice(c,c+b);d&&(e=za.call(this,e));return{tag:a,result:e}}}function za(a){const b=Array(a.length);for(let c=0,d;c{f=g}));e||(e=0);d||(d=0);if(d=this.B&&(w||!n[l])){var f=O(q,d,r),h="";switch(this.G){case "full":if(2f;g--)if(g-f>=this.B){var k=O(q,d,r,e,f);h=l.substring(f,g);P(this,n,h,k,a,c)}break}case "reverse":if(1=this.B&&P(this,n, +h,O(q,d,r,e,g),a,c);h=""}case "forward":if(1=this.B&&P(this,n,h,f,a,c);break}default:if(this.C&&(f=Math.min(f/this.C(b,l,r)|0,q-1)),P(this,n,l,f,a,c),w&&1=this.B&&!e[l]){e[l]=1;const p=this.l&&l>f;P(this,m,p?f:l,O(h+(d/2>h?0:1),d,r,g-1,k-1),a,c,p?l:f)}}}}this.m||(this.register[a]=1)}}return this}; +function O(a,b,c,d,e){return c&&1=this.B&&!c[q])if(this.s||f||this.map[q])k[w++]=q,c[q]=1;else return d;a=k;e=a.length}if(!e)return d;b||(b=100);g=this.depth&&1=d)))break;if(n){if(f)return qa(k,d,0);b[b.length]=k;return}}return!c&&k}function qa(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} +function ra(a,b,c,d){c?(d=d&&b>c,a=(a=a[d?b:c])&&a[d?c:b]):a=a[b];return a}t.contain=function(a){return!!this.register[a]};t.update=function(a,b){return this.remove(a).add(a,b)}; +t.remove=function(a,b){const c=this.register[a];if(c){if(this.m)for(let d=0,e;d{f=m}));let g,k;switch(e||(e=0)){case 0:g="reg";if(this.m){k=x();for(let m in this.register)k[m]=1}else k=this.register;break;case 1:g="cfg";k={doc:0,opt:this.s?1:0};break;case 2:g="map";k=this.map;break;case 3:g="ctx";k=this.h;break;default:"undefined"===typeof c&&f&&f();return}oa(a,b||this,c,g,d,e,k,f);return h}; +t.import=function(a,b){if(b)switch(C(b)&&(b=JSON.parse(b)),a){case "cfg":this.s=!!b.opt;break;case "reg":this.m=!1;this.register=b;break;case "map":this.map=b;break;case "ctx":this.h=b}};ia(N.prototype);function sa(a){a=a.data;var b=self._index;const c=a.args;var d=a.task;switch(d){case "init":d=a.options||{};a=a.factory;b=d.encode;d.cache=!1;b&&0===b.indexOf("function")&&(d.encode=Function("return "+b)());a?(Function("return "+a)()(self),self._index=new self.FlexSearch.Index(d),delete self.FlexSearch):self._index=new N(d);break;default:a=a.id,b=b[d].apply(b,c),postMessage("search"===d?{id:a,msg:b}:{id:a})}};let ta=0;function S(a){if(!(this instanceof S))return new S(a);var b;a?E(b=a.encode)&&(a.encode=b.toString()):a={};(b=(self||window)._factory)&&(b=b.toString());const c="undefined"===typeof window&&self.exports,d=this;this.o=ua(b,c,a.worker);this.h=x();if(this.o){if(c)this.o.on("message",function(e){d.h[e.id](e.msg);delete d.h[e.id]});else this.o.onmessage=function(e){e=e.data;d.h[e.id](e.msg);delete d.h[e.id]};this.o.postMessage({task:"init",factory:b,options:a})}}T("add");T("append");T("search"); +T("update");T("remove");function T(a){S.prototype[a]=S.prototype[a+"Async"]=function(){const b=this,c=[].slice.call(arguments);var d=c[c.length-1];let e;E(d)&&(e=d,c.splice(c.length-1,1));d=new Promise(function(f){setTimeout(function(){b.h[++ta]=f;b.o.postMessage({task:a,id:ta,args:c})})});return e?(d.then(e),this):d}} +function ua(a,b,c){let d;try{d=b?eval('new (require("worker_threads")["Worker"])("../dist/node/node.js")'):a?new Worker(URL.createObjectURL(new Blob(["onmessage="+sa.toString()],{type:"text/javascript"}))):new Worker(C(c)?c:"worker/worker.js",{type:"module"})}catch(e){}return d};function U(a){if(!(this instanceof U))return new U(a);var b=a.document||a.doc||a,c;this.K=[];this.h=[];this.A=[];this.register=x();this.key=(c=b.key||b.id)&&V(c,this.A)||"id";this.m=u(a.fastupdate);this.C=(c=b.store)&&!0!==c&&[];this.store=c&&x();this.I=(c=b.tag)&&V(c,this.A);this.l=c&&x();this.cache=(c=a.cache)&&new M(c);a.cache=!1;this.o=a.worker;this.async=!1;c=x();let d=b.index||b.field||b;C(d)&&(d=[d]);for(let e=0,f,h;eb||c)e=e.slice(c,c+b);d&&(e=wa.call(this,e));return{tag:a,result:e}}}function wa(a){const b=Array(a.length);for(let c=0,d;c{f=g}));e||(e=0);d||(d=0);if(d= this.m && (u || !n[l])) { - var f = P(q, e, r), g = ""; + var f = Q(q, e, r), g = ""; switch(this.C) { case "full": if (2 < d) { for (f = 0; f < d; f++) { for (var h = d; h > f; h--) { if (h - f >= this.m) { - var k = P(q, e, r, d, f); + var k = Q(q, e, r, d, f); g = l.substring(f, h); - Q(this, n, g, k, a, c); + S(this, n, g, k, a, c); } } } @@ -263,24 +263,24 @@ t.add = function(a, b, c, e) { case "reverse": if (1 < d) { for (h = d - 1; 0 < h; h--) { - g = l[h] + g, g.length >= this.m && Q(this, n, g, P(q, e, r, d, h), a, c); + g = l[h] + g, g.length >= this.m && S(this, n, g, Q(q, e, r, d, h), a, c); } g = ""; } case "forward": if (1 < d) { for (h = 0; h < d; h++) { - g += l[h], g.length >= this.m && Q(this, n, g, f, a, c); + g += l[h], g.length >= this.m && S(this, n, g, f, a, c); } break; } default: - if (this.F && (f = Math.min(f / this.F(b, l, r) | 0, q - 1)), Q(this, n, l, f, a, c), u && 1 < e && r < e - 1) { + if (this.F && (f = Math.min(f / this.F(b, l, r) | 0, q - 1)), S(this, n, l, f, a, c), u && 1 < e && r < e - 1) { for (d = z(), g = this.o, f = l, h = Math.min(u + 1, e - r), d[f] = 1, k = 1; k < h; k++) { if ((l = b[this.B ? e - 1 - r - k : r + k]) && l.length >= this.m && !d[l]) { d[l] = 1; const p = this.h && l > f; - Q(this, m, p ? f : l, P(g + (e / 2 > g ? 0 : 1), e, r, h - 1, k - 1), a, c, p ? l : f); + S(this, m, p ? f : l, Q(g + (e / 2 > g ? 0 : 1), e, r, h - 1, k - 1), a, c, p ? l : f); } } } @@ -292,10 +292,10 @@ t.add = function(a, b, c, e) { } return this; }; -function P(a, b, c, e, d) { +function Q(a, b, c, e, d) { return c && 1 < a ? b + (e || 0) <= a ? c + (d || 0) : (a - 1) / (b + (e || 0)) * (c + (d || 0)) + 1 | 0 : 0; } -function Q(a, b, c, e, d, f, g) { +function S(a, b, c, e, d, f, g) { let h = g ? a.l : a.map; if (!b[c] || g && !b[c][g]) { a.s && (h = h[e]), g ? (b = b[c] || (b[c] = z()), b[g] = 1, h = h[g] || (h[g] = z())) : b[c] = 1, h = h[c] || (h[c] = []), a.s || (h = h[e] || (h[e] = [])), f && h.includes(d) || (h[h.length] = d, a.D && (a = a.register[d] || (a.register[d] = []), a[a.length] = h)); @@ -337,7 +337,7 @@ t.search = function(a, b, c) { h ? (m = a[0], c = 1) : 1 < d && a.sort(aa); for (let n, u; c < d; c++) { u = a[c]; - h ? (n = la(this, e, f, b, g, 2 === d, u, m), f && !1 === n && e.length || (m = u)) : n = la(this, e, f, b, g, 1 === d, u); + h ? (n = ka(this, e, f, b, g, 2 === d, u, m), f && !1 === n && e.length || (m = u)) : n = ka(this, e, f, b, g, 1 === d, u); if (n) { return n; } @@ -352,28 +352,28 @@ t.search = function(a, b, c) { return e; } if (1 === k) { - return ma(e[0], b, g); + return la(e[0], b, g); } } } - return ha(e, b, g, f); + return fa(e, b, g, f); }; -function la(a, b, c, e, d, f, g, h) { +function ka(a, b, c, e, d, f, g, h) { let k = [], m = h ? a.l : a.map; - a.s || (m = na(m, g, h, a.h)); + a.s || (m = ma(m, g, h, a.h)); if (m) { let n = 0; const u = Math.min(m.length, h ? a.o : a.A); for (let q = 0, r = 0, l, p; q < u; q++) { if (l = m[q]) { - if (a.s && (l = na(l, g, h, a.h)), d && l && f && (p = l.length, p <= d ? (d -= p, l = null) : (l = l.slice(d), d = 0)), l && (k[n++] = l, f && (r += l.length, r >= e))) { + if (a.s && (l = ma(l, g, h, a.h)), d && l && f && (p = l.length, p <= d ? (d -= p, l = null) : (l = l.slice(d), d = 0)), l && (k[n++] = l, f && (r += l.length, r >= e))) { break; } } } if (n) { if (f) { - return ma(k, e, 0); + return la(k, e, 0); } b[b.length] = k; return; @@ -381,11 +381,11 @@ function la(a, b, c, e, d, f, g, h) { } return !c && k; } -function ma(a, b, c) { +function la(a, b, c) { a = 1 === a.length ? a[0] : [].concat.apply([], a); return c || a.length > b ? a.slice(c, c + b) : a; } -function na(a, b, c, e) { +function ma(a, b, c, e) { c ? (e = e && b > c, a = (a = a[e ? b : c]) && a[e ? c : b]) : a = a[b]; return a; } @@ -403,13 +403,13 @@ t.remove = function(a, b) { d = c[e], d.splice(d.indexOf(a), 1); } } else { - R(this.map, a, this.A, this.s), this.depth && R(this.l, a, this.o, this.s); + T(this.map, a, this.A, this.s), this.depth && T(this.l, a, this.o, this.s); } b || delete this.register[a]; } return this; }; -function R(a, b, c, e, d) { +function T(a, b, c, e, d) { let f = 0; if (a.constructor === Array) { if (d) { @@ -418,28 +418,28 @@ function R(a, b, c, e, d) { d = Math.min(a.length, c); for (let g = 0, h; g < d; g++) { if (h = a[g]) { - f = R(h, b, c, e, d), e || f || delete a[g]; + f = T(h, b, c, e, d), e || f || delete a[g]; } } } } else { for (let g in a) { - (f = R(a[g], b, c, e, d)) || delete a[g]; + (f = T(a[g], b, c, e, d)) || delete a[g]; } } return f; } -fa(O.prototype); -function T(a) { - if (!(this instanceof T)) { - return new T(a); +ea(P.prototype); +function U(a) { + if (!(this instanceof U)) { + return new U(a); } var b = a.document || a.doc || a, c; this.F = []; this.h = []; this.o = []; this.register = z(); - this.key = (c = b.key || b.id) && U(c, this.o) || "id"; + this.key = (c = b.key || b.id) && V(c, this.o) || "id"; this.D = v(a.fastupdate); this.l = (c = b.store) && !0 !== c && []; this.store = c && z(); @@ -448,16 +448,16 @@ function T(a) { let e = b.index || b.field || b; C(e) && (e = [e]); for (let d = 0, f, g; d < e.length; d++) { - f = e[d], C(f) || (g = f, f = f.field), g = D(g) ? Object.assign({}, a, g) : a, this.I || (c[f] = new O(g, this.register)), this.F[d] = U(f, this.o), this.h[d] = f; + f = e[d], C(f) || (g = f, f = f.field), g = D(g) ? Object.assign({}, a, g) : a, this.I || (c[f] = new P(g, this.register)), this.F[d] = V(f, this.o), this.h[d] = f; } if (this.l) { for (a = b.store, C(a) && (a = [a]), b = 0; b < a.length; b++) { - this.l[b] = U(a[b], this.o); + this.l[b] = V(a[b], this.o); } } this.index = c; } -function U(a, b) { +function V(a, b) { const c = a.split(":"); let e = 0; for (let d = 0; d < c.length; d++) { @@ -466,7 +466,7 @@ function U(a, b) { e < c.length && (c.length = e); return 1 < e ? c : c[0]; } -function oa(a, b) { +function na(a, b) { if (C(b)) { a = a[b]; } else { @@ -476,21 +476,21 @@ function oa(a, b) { } return a; } -function V(a, b, c, e, d) { +function W(a, b, c, e, d) { a = a[d]; if (e === c.length - 1) { b[d] = a; } else if (a) { if (a.constructor === Array) { for (b = b[d] = Array(a.length), d = 0; d < a.length; d++) { - V(a, b, c, e, d); + W(a, b, c, e, d); } } else { - b = b[d] || (b[d] = z()), d = c[++e], V(a, b, c, e, d); + b = b[d] || (b[d] = z()), d = c[++e], W(a, b, c, e, d); } } } -function W(a, b, c, e, d, f, g, h) { +function X(a, b, c, e, d, f, g, h) { if (a = a[g]) { if (e === b.length - 1) { if (a.constructor === Array) { @@ -506,30 +506,30 @@ function W(a, b, c, e, d, f, g, h) { } else { if (a.constructor === Array) { for (g = 0; g < a.length; g++) { - W(a, b, c, e, d, f, g, h); + X(a, b, c, e, d, f, g, h); } } else { - g = b[++e], W(a, b, c, e, d, f, g, h); + g = b[++e], X(a, b, c, e, d, f, g, h); } } } } -t = T.prototype; +t = U.prototype; t.add = function(a, b, c) { - D(a) && (b = a, a = oa(b, this.key)); + D(a) && (b = a, a = na(b, this.key)); if (b && (a || 0 === a)) { if (!c && this.register[a]) { return this.update(a, b); } for (let e = 0, d, f; e < this.h.length; e++) { - f = this.h[e], d = this.F[e], C(d) && (d = [d]), W(b, d, this.o, 0, this.index[f], a, d[0], c); + f = this.h[e], d = this.F[e], C(d) && (d = [d]), X(b, d, this.o, 0, this.index[f], a, d[0], c); } if (this.store && (!c || !this.store[a])) { let e; if (this.l) { e = z(); for (let d = 0, f; d < this.l.length; d++) { - f = this.l[d], C(f) ? e[f] = b[f] : V(b, e, f, 0, f[0]); + f = this.l[d], C(f) ? e[f] = b[f] : W(b, e, f, 0, f[0]); } } this.store[a] = e || b; @@ -544,7 +544,7 @@ t.update = function(a, b) { return this.remove(a).add(a, b); }; t.remove = function(a) { - D(a) && (a = oa(a, this.key)); + D(a) && (a = na(a, this.key)); if (this.register[a]) { for (let b = 0; b < this.h.length && (this.index[this.h[b]].remove(a, !this.I), !this.D); b++) { } @@ -569,7 +569,7 @@ t.search = function(a, b, c, e) { u = c.offset || 0; if (m && (C(m) && (m = [m]), !a)) { for (let l = 0, p; l < m.length; l++) { - if (p = pa.call(this, m[l], b, u, h)) { + if (p = oa.call(this, m[l], b, u, h)) { d[d.length] = p, q++; } } @@ -594,12 +594,12 @@ t.search = function(a, b, c, e) { const x = []; let G = 0; n && (x[0] = [p]); - for (let S = 0, ja, N; S < m.length; S++) { - if (ja = m[S], B = (N = this.J[ja]) && N.length) { + for (let R = 0, ia, N; R < m.length; R++) { + if (ia = m[R], B = (N = this.J[ia]) && N.length) { G++, x[x.length] = n ? [N] : N; } } - G && (p = n ? ha(x, b || 100, u || 0) : ia(p, x), B = p.length); + G && (p = n ? fa(x, b || 100, u || 0) : ha(p, x), B = p.length); } if (B) { f[q] = A, d[q++] = p; @@ -624,7 +624,7 @@ t.search = function(a, b, c, e) { } for (let l = 0, p; l < f.length; l++) { p = d[l]; - p.length && h && (p = qa.call(this, p)); + p.length && h && (p = pa.call(this, p)); if (g) { return p; } @@ -632,17 +632,17 @@ t.search = function(a, b, c, e) { } return d; }; -function pa(a, b, c, e) { +function oa(a, b, c, e) { let d = this.J[a], f = d && d.length - c; if (f && 0 < f) { if (f > b || c) { d = d.slice(c, c + b); } - e && (d = qa.call(this, d)); + e && (d = pa.call(this, d)); return {tag:a, result:d}; } } -function qa(a) { +function pa(a) { const b = Array(a.length); for (let c = 0, e; c < a.length; c++) { e = a[c], b[c] = {id:e, doc:this.store[e]}; @@ -659,28 +659,28 @@ t.set = function(a, b) { this.store[a] = b; return this; }; -fa(T.prototype); -var sa = {encode:ra, B:!1, C:""}; -const ta = [I("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"), "a", I("[\u00e8\u00e9\u00ea\u00eb]"), "e", I("[\u00ec\u00ed\u00ee\u00ef]"), "i", I("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"), "o", I("[\u00f9\u00fa\u00fb\u00fc\u0171]"), "u", I("[\u00fd\u0177\u00ff]"), "y", I("\u00f1"), "n", I("[\u00e7c]"), "k", I("\u00df"), "s", I(" & "), " and "]; -function ra(a) { +ea(U.prototype); +var ra = {encode:qa, B:!1, C:""}; +const sa = [I("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"), "a", I("[\u00e8\u00e9\u00ea\u00eb]"), "e", I("[\u00ec\u00ed\u00ee\u00ef]"), "i", I("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"), "o", I("[\u00f9\u00fa\u00fb\u00fc\u0171]"), "u", I("[\u00fd\u0177\u00ff]"), "y", I("\u00f1"), "n", I("[\u00e7c]"), "k", I("\u00df"), "s", I(" & "), " and "]; +function qa(a) { var b = a = "" + a; b.normalize && (b = b.normalize("NFD").replace(ca, "")); - return E.call(this, b.toLowerCase(), !a.normalize && ta); + return E.call(this, b.toLowerCase(), !a.normalize && sa); } -;var va = {encode:ua, B:!1, C:"strict"}; -const wa = /[^a-z0-9]+/, xa = {b:"p", v:"f", w:"f", z:"s", x:"s", "\u00df":"s", d:"t", n:"m", c:"k", g:"k", j:"k", q:"k", i:"e", y:"e", u:"o"}; -function ua(a) { - a = ra.call(this, a).join(" "); +;var ua = {encode:ta, B:!1, C:"strict"}; +const va = /[^a-z0-9]+/, wa = {b:"p", v:"f", w:"f", z:"s", x:"s", "\u00df":"s", d:"t", n:"m", c:"k", g:"k", j:"k", q:"k", i:"e", y:"e", u:"o"}; +function ta(a) { + a = qa.call(this, a).join(" "); const b = []; if (a) { - const c = a.split(wa), e = c.length; + const c = a.split(va), e = c.length; for (let d = 0, f, g = 0; d < e; d++) { if ((a = c[d]) && (!this.filter || !this.filter[a])) { f = a[0]; - let h = xa[f] || f, k = h; + let h = wa[f] || f, k = h; for (let m = 1; m < a.length; m++) { f = a[m]; - const n = xa[f] || f; + const n = wa[f] || f; n && n !== k && (h += n, k = n); } b[g++] = h; @@ -689,31 +689,30 @@ function ua(a) { } return b; } -;var za = {encode:ya, B:!1, C:""}; -const Aa = [I("ae"), "a", I("oe"), "o", I("sh"), "s", I("th"), "t", I("ph"), "f", I("pf"), "f", I("(?![aeo])h(?![aeo])"), "", I("(?!^[aeo])h(?!^[aeo])"), ""]; -function ya(a, b) { - a && (a = ua.call(this, a).join(" "), 2 < a.length && (a = F(a, Aa)), b || (1 < a.length && (a = J(a)), a && (a = a.split(" ")))); +;var ya = {encode:xa, B:!1, C:""}; +const za = [I("ae"), "a", I("oe"), "o", I("sh"), "s", I("th"), "t", I("ph"), "f", I("pf"), "f", I("(?![aeo])h(?![aeo])"), "", I("(?!^[aeo])h(?!^[aeo])"), ""]; +function xa(a, b) { + a && (a = ta.call(this, a).join(" "), 2 < a.length && (a = F(a, za)), b || (1 < a.length && (a = J(a)), a && (a = a.split(" ")))); return a || []; } -;var Ca = {encode:Ba, B:!1, C:""}; -const Da = I("(?!\\b)[aeo]"); -function Ba(a) { - a && (a = ya.call(this, a, !0), 1 < a.length && (a = a.replace(Da, "")), 1 < a.length && (a = J(a)), a && (a = a.split(" "))); +;var Ba = {encode:Aa, B:!1, C:""}; +const Ca = I("(?!\\b)[aeo]"); +function Aa(a) { + a && (a = xa.call(this, a, !0), 1 < a.length && (a = a.replace(Ca, "")), 1 < a.length && (a = J(a)), a && (a = a.split(" "))); return a || []; } -;L["latin:default"] = da; -L["latin:simple"] = sa; -L["latin:balance"] = va; -L["latin:advanced"] = za; -L["latin:extra"] = Ca; -const X = self; -let Y; -const Z = {Index:O, Document:T, Worker:null, registerCharset:function(a, b) { - L[a] = b; +;M["latin:default"] = da; +M["latin:simple"] = ra; +M["latin:balance"] = ua; +M["latin:advanced"] = ya; +M["latin:extra"] = Ba; +const Y = {Index:P, Document:U, Worker:null, registerCharset:function(a, b) { + M[a] = b; }, registerLanguage:function(a, b) { - ea[a] = b; + L[a] = b; }}; -(Y = X.define) && Y.amd ? Y([], function() { - return Z; -}) : X.exports ? X.exports = Z : X.FlexSearch = Z; +let Z; +(Z = self.define) && Z.amd ? Z([], function() { + return Y; +}) : self.exports ? self.exports = Y : self.FlexSearch = Y; }(this)); diff --git a/dist/flexsearch.compact.min.js b/dist/flexsearch.compact.min.js index 3cf914d..cab54d7 100644 --- a/dist/flexsearch.compact.min.js +++ b/dist/flexsearch.compact.min.js @@ -1,27 +1,27 @@ /**! - * FlexSearch.js v0.7.39 (Compact) + * FlexSearch.js v0.7.40 (Compact) * Author and Copyright: Thomas Wilkerling * Licence: Apache-2.0 * Hosted by Nextapps GmbH * https://github.com/nextapps-de/flexsearch */ (function(self){'use strict';var t;function v(a){return"undefined"!==typeof a?a:!0}function w(a){const b=Array(a);for(let c=0;c=this.m&&(u||!n[l])){var f=P(q,e,r),g="";switch(this.C){case "full":if(2f;h--)if(h-f>=this.m){var k=P(q,e,r,d,f);g=l.substring(f,h);Q(this,n,g,k,a,c)}break}case "reverse":if(1=this.m&&Q(this,n, -g,P(q,e,r,d,h),a,c);g=""}case "forward":if(1=this.m&&Q(this,n,g,f,a,c);break}default:if(this.F&&(f=Math.min(f/this.F(b,l,r)|0,q-1)),Q(this,n,l,f,a,c),u&&1=this.m&&!d[l]){d[l]=1;const p=this.h&&l>f;Q(this,m,p?f:l,P(g+(e/2>g?0:1),e,r,h-1,k-1),a,c,p?l:f)}}}}this.D||(this.register[a]=1)}}return this}; -function P(a,b,c,e,d){return c&&1=this.m&&!c[q])if(this.s||f||this.map[q])k[u++]=q,c[q]=1;else return e;a=k;d=a.length}if(!d)return e;b||(b=100);h=this.depth&&1=e)))break;if(n){if(f)return ma(k,e,0);b[b.length]=k;return}}return!c&&k}function ma(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} -function na(a,b,c,e){c?(e=e&&b>c,a=(a=a[e?b:c])&&a[e?c:b]):a=a[b];return a}t.contain=function(a){return!!this.register[a]};t.update=function(a,b){return this.remove(a).add(a,b)};t.remove=function(a,b){const c=this.register[a];if(c){if(this.D)for(let e=0,d;eb||c)d=d.slice(c,c+b);e&&(d=qa.call(this,d));return{tag:a,result:d}}}function qa(a){const b=Array(a.length);for(let c=0,e;c=this.m&&(u||!n[l])){var f=Q(q,e,r),g="";switch(this.C){case "full":if(2f;h--)if(h-f>=this.m){var k=Q(q,e,r,d,f);g=l.substring(f,h);S(this,n,g,k,a,c)}break}case "reverse":if(1=this.m&&S(this,n, +g,Q(q,e,r,d,h),a,c);g=""}case "forward":if(1=this.m&&S(this,n,g,f,a,c);break}default:if(this.F&&(f=Math.min(f/this.F(b,l,r)|0,q-1)),S(this,n,l,f,a,c),u&&1=this.m&&!d[l]){d[l]=1;const p=this.h&&l>f;S(this,m,p?f:l,Q(g+(e/2>g?0:1),e,r,h-1,k-1),a,c,p?l:f)}}}}this.D||(this.register[a]=1)}}return this}; +function Q(a,b,c,e,d){return c&&1=this.m&&!c[q])if(this.s||f||this.map[q])k[u++]=q,c[q]=1;else return e;a=k;d=a.length}if(!d)return e;b||(b=100);h=this.depth&&1=e)))break;if(n){if(f)return la(k,e,0);b[b.length]=k;return}}return!c&&k}function la(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} +function ma(a,b,c,e){c?(e=e&&b>c,a=(a=a[e?b:c])&&a[e?c:b]):a=a[b];return a}t.contain=function(a){return!!this.register[a]};t.update=function(a,b){return this.remove(a).add(a,b)};t.remove=function(a,b){const c=this.register[a];if(c){if(this.D)for(let e=0,d;eb||c)d=d.slice(c,c+b);e&&(d=pa.call(this,d));return{tag:a,result:d}}}function pa(a){const b=Array(a.length);for(let c=0,e;c= this.m && (u || !n[l])) { - var f = P(q, e, r), g = ""; + var f = T(q, e, r), g = ""; switch(this.C) { case "full": if (2 < d) { for (f = 0; f < d; f++) { for (var h = d; h > f; h--) { if (h - f >= this.m) { - var k = P(q, e, r, d, f); + var k = T(q, e, r, d, f); g = l.substring(f, h); - Q(this, n, g, k, a, c); + U(this, n, g, k, a, c); } } } @@ -263,24 +263,24 @@ t.add = function(a, b, c, e) { case "reverse": if (1 < d) { for (h = d - 1; 0 < h; h--) { - g = l[h] + g, g.length >= this.m && Q(this, n, g, P(q, e, r, d, h), a, c); + g = l[h] + g, g.length >= this.m && U(this, n, g, T(q, e, r, d, h), a, c); } g = ""; } case "forward": if (1 < d) { for (h = 0; h < d; h++) { - g += l[h], g.length >= this.m && Q(this, n, g, f, a, c); + g += l[h], g.length >= this.m && U(this, n, g, f, a, c); } break; } default: - if (this.F && (f = Math.min(f / this.F(b, l, r) | 0, q - 1)), Q(this, n, l, f, a, c), u && 1 < e && r < e - 1) { + if (this.F && (f = Math.min(f / this.F(b, l, r) | 0, q - 1)), U(this, n, l, f, a, c), u && 1 < e && r < e - 1) { for (d = z(), g = this.o, f = l, h = Math.min(u + 1, e - r), d[f] = 1, k = 1; k < h; k++) { if ((l = b[this.B ? e - 1 - r - k : r + k]) && l.length >= this.m && !d[l]) { d[l] = 1; const p = this.h && l > f; - Q(this, m, p ? f : l, P(g + (e / 2 > g ? 0 : 1), e, r, h - 1, k - 1), a, c, p ? l : f); + U(this, m, p ? f : l, T(g + (e / 2 > g ? 0 : 1), e, r, h - 1, k - 1), a, c, p ? l : f); } } } @@ -292,10 +292,10 @@ t.add = function(a, b, c, e) { } return this; }; -function P(a, b, c, e, d) { +function T(a, b, c, e, d) { return c && 1 < a ? b + (e || 0) <= a ? c + (d || 0) : (a - 1) / (b + (e || 0)) * (c + (d || 0)) + 1 | 0 : 0; } -function Q(a, b, c, e, d, f, g) { +function U(a, b, c, e, d, f, g) { let h = g ? a.l : a.map; if (!b[c] || g && !b[c][g]) { a.s && (h = h[e]), g ? (b = b[c] || (b[c] = z()), b[g] = 1, h = h[g] || (h[g] = z())) : b[c] = 1, h = h[c] || (h[c] = []), a.s || (h = h[e] || (h[e] = [])), f && h.includes(d) || (h[h.length] = d, a.D && (a = a.register[d] || (a.register[d] = []), a[a.length] = h)); @@ -337,7 +337,7 @@ t.search = function(a, b, c) { h ? (m = a[0], c = 1) : 1 < d && a.sort(aa); for (let n, u; c < d; c++) { u = a[c]; - h ? (n = la(this, e, f, b, g, 2 === d, u, m), f && !1 === n && e.length || (m = u)) : n = la(this, e, f, b, g, 1 === d, u); + h ? (n = ia(this, e, f, b, g, 2 === d, u, m), f && !1 === n && e.length || (m = u)) : n = ia(this, e, f, b, g, 1 === d, u); if (n) { return n; } @@ -352,28 +352,28 @@ t.search = function(a, b, c) { return e; } if (1 === k) { - return ma(e[0], b, g); + return ja(e[0], b, g); } } } - return ha(e, b, g, f); + return Q(e, b, g, f); }; -function la(a, b, c, e, d, f, g, h) { +function ia(a, b, c, e, d, f, g, h) { let k = [], m = h ? a.l : a.map; - a.s || (m = na(m, g, h, a.h)); + a.s || (m = ka(m, g, h, a.h)); if (m) { let n = 0; const u = Math.min(m.length, h ? a.o : a.A); for (let q = 0, r = 0, l, p; q < u; q++) { if (l = m[q]) { - if (a.s && (l = na(l, g, h, a.h)), d && l && f && (p = l.length, p <= d ? (d -= p, l = null) : (l = l.slice(d), d = 0)), l && (k[n++] = l, f && (r += l.length, r >= e))) { + if (a.s && (l = ka(l, g, h, a.h)), d && l && f && (p = l.length, p <= d ? (d -= p, l = null) : (l = l.slice(d), d = 0)), l && (k[n++] = l, f && (r += l.length, r >= e))) { break; } } } if (n) { if (f) { - return ma(k, e, 0); + return ja(k, e, 0); } b[b.length] = k; return; @@ -381,11 +381,11 @@ function la(a, b, c, e, d, f, g, h) { } return !c && k; } -function ma(a, b, c) { +function ja(a, b, c) { a = 1 === a.length ? a[0] : [].concat.apply([], a); return c || a.length > b ? a.slice(c, c + b) : a; } -function na(a, b, c, e) { +function ka(a, b, c, e) { c ? (e = e && b > c, a = (a = a[e ? b : c]) && a[e ? c : b]) : a = a[b]; return a; } @@ -403,13 +403,13 @@ t.remove = function(a, b) { d = c[e], d.splice(d.indexOf(a), 1); } } else { - R(this.map, a, this.A, this.s), this.depth && R(this.l, a, this.o, this.s); + V(this.map, a, this.A, this.s), this.depth && V(this.l, a, this.o, this.s); } b || delete this.register[a]; } return this; }; -function R(a, b, c, e, d) { +function V(a, b, c, e, d) { let f = 0; if (a.constructor === Array) { if (d) { @@ -418,28 +418,28 @@ function R(a, b, c, e, d) { d = Math.min(a.length, c); for (let g = 0, h; g < d; g++) { if (h = a[g]) { - f = R(h, b, c, e, d), e || f || delete a[g]; + f = V(h, b, c, e, d), e || f || delete a[g]; } } } } else { for (let g in a) { - (f = R(a[g], b, c, e, d)) || delete a[g]; + (f = V(a[g], b, c, e, d)) || delete a[g]; } } return f; } -fa(O.prototype); -function T(a) { - if (!(this instanceof T)) { - return new T(a); +O(S.prototype); +function W(a) { + if (!(this instanceof W)) { + return new W(a); } var b = a.document || a.doc || a, c; this.F = []; this.h = []; this.o = []; this.register = z(); - this.key = (c = b.key || b.id) && U(c, this.o) || "id"; + this.key = (c = b.key || b.id) && X(c, this.o) || "id"; this.D = v(a.fastupdate); this.l = (c = b.store) && !0 !== c && []; this.store = c && z(); @@ -448,16 +448,16 @@ function T(a) { let e = b.index || b.field || b; C(e) && (e = [e]); for (let d = 0, f, g; d < e.length; d++) { - f = e[d], C(f) || (g = f, f = f.field), g = D(g) ? Object.assign({}, a, g) : a, this.I || (c[f] = new O(g, this.register)), this.F[d] = U(f, this.o), this.h[d] = f; + f = e[d], C(f) || (g = f, f = f.field), g = D(g) ? Object.assign({}, a, g) : a, this.I || (c[f] = new S(g, this.register)), this.F[d] = X(f, this.o), this.h[d] = f; } if (this.l) { for (a = b.store, C(a) && (a = [a]), b = 0; b < a.length; b++) { - this.l[b] = U(a[b], this.o); + this.l[b] = X(a[b], this.o); } } this.index = c; } -function U(a, b) { +function X(a, b) { const c = a.split(":"); let e = 0; for (let d = 0; d < c.length; d++) { @@ -466,7 +466,7 @@ function U(a, b) { e < c.length && (c.length = e); return 1 < e ? c : c[0]; } -function oa(a, b) { +function la(a, b) { if (C(b)) { a = a[b]; } else { @@ -476,21 +476,21 @@ function oa(a, b) { } return a; } -function V(a, b, c, e, d) { +function Y(a, b, c, e, d) { a = a[d]; if (e === c.length - 1) { b[d] = a; } else if (a) { if (a.constructor === Array) { for (b = b[d] = Array(a.length), d = 0; d < a.length; d++) { - V(a, b, c, e, d); + Y(a, b, c, e, d); } } else { - b = b[d] || (b[d] = z()), d = c[++e], V(a, b, c, e, d); + b = b[d] || (b[d] = z()), d = c[++e], Y(a, b, c, e, d); } } } -function W(a, b, c, e, d, f, g, h) { +function Z(a, b, c, e, d, f, g, h) { if (a = a[g]) { if (e === b.length - 1) { if (a.constructor === Array) { @@ -506,30 +506,30 @@ function W(a, b, c, e, d, f, g, h) { } else { if (a.constructor === Array) { for (g = 0; g < a.length; g++) { - W(a, b, c, e, d, f, g, h); + Z(a, b, c, e, d, f, g, h); } } else { - g = b[++e], W(a, b, c, e, d, f, g, h); + g = b[++e], Z(a, b, c, e, d, f, g, h); } } } } -t = T.prototype; +t = W.prototype; t.add = function(a, b, c) { - D(a) && (b = a, a = oa(b, this.key)); + D(a) && (b = a, a = la(b, this.key)); if (b && (a || 0 === a)) { if (!c && this.register[a]) { return this.update(a, b); } for (let e = 0, d, f; e < this.h.length; e++) { - f = this.h[e], d = this.F[e], C(d) && (d = [d]), W(b, d, this.o, 0, this.index[f], a, d[0], c); + f = this.h[e], d = this.F[e], C(d) && (d = [d]), Z(b, d, this.o, 0, this.index[f], a, d[0], c); } if (this.store && (!c || !this.store[a])) { let e; if (this.l) { e = z(); for (let d = 0, f; d < this.l.length; d++) { - f = this.l[d], C(f) ? e[f] = b[f] : V(b, e, f, 0, f[0]); + f = this.l[d], C(f) ? e[f] = b[f] : Y(b, e, f, 0, f[0]); } } this.store[a] = e || b; @@ -544,7 +544,7 @@ t.update = function(a, b) { return this.remove(a).add(a, b); }; t.remove = function(a) { - D(a) && (a = oa(a, this.key)); + D(a) && (a = la(a, this.key)); if (this.register[a]) { for (let b = 0; b < this.h.length && (this.index[this.h[b]].remove(a, !this.I), !this.D); b++) { } @@ -569,7 +569,7 @@ t.search = function(a, b, c, e) { u = c.offset || 0; if (m && (C(m) && (m = [m]), !a)) { for (let l = 0, p; l < m.length; l++) { - if (p = pa.call(this, m[l], b, u, h)) { + if (p = ma.call(this, m[l], b, u, h)) { d[d.length] = p, q++; } } @@ -594,12 +594,12 @@ t.search = function(a, b, c, e) { const x = []; let G = 0; n && (x[0] = [p]); - for (let S = 0, ja, N; S < m.length; S++) { - if (ja = m[S], B = (N = this.J[ja]) && N.length) { + for (let R = 0, fa, N; R < m.length; R++) { + if (fa = m[R], B = (N = this.J[fa]) && N.length) { G++, x[x.length] = n ? [N] : N; } } - G && (p = n ? ha(x, b || 100, u || 0) : ia(p, x), B = p.length); + G && (p = n ? Q(x, b || 100, u || 0) : ea(p, x), B = p.length); } if (B) { f[q] = A, d[q++] = p; @@ -624,7 +624,7 @@ t.search = function(a, b, c, e) { } for (let l = 0, p; l < f.length; l++) { p = d[l]; - p.length && h && (p = qa.call(this, p)); + p.length && h && (p = na.call(this, p)); if (g) { return p; } @@ -632,17 +632,17 @@ t.search = function(a, b, c, e) { } return d; }; -function pa(a, b, c, e) { +function ma(a, b, c, e) { let d = this.J[a], f = d && d.length - c; if (f && 0 < f) { if (f > b || c) { d = d.slice(c, c + b); } - e && (d = qa.call(this, d)); + e && (d = na.call(this, d)); return {tag:a, result:d}; } } -function qa(a) { +function na(a) { const b = Array(a.length); for (let c = 0, e; c < a.length; c++) { e = a[c], b[c] = {id:e, doc:this.store[e]}; @@ -659,28 +659,28 @@ t.set = function(a, b) { this.store[a] = b; return this; }; -fa(T.prototype); -var sa = {encode:ra, B:!1, C:""}; -const ta = [I("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"), "a", I("[\u00e8\u00e9\u00ea\u00eb]"), "e", I("[\u00ec\u00ed\u00ee\u00ef]"), "i", I("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"), "o", I("[\u00f9\u00fa\u00fb\u00fc\u0171]"), "u", I("[\u00fd\u0177\u00ff]"), "y", I("\u00f1"), "n", I("[\u00e7c]"), "k", I("\u00df"), "s", I(" & "), " and "]; -function ra(a) { +O(W.prototype); +var pa = {encode:oa, B:!1, C:""}; +const qa = [I("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"), "a", I("[\u00e8\u00e9\u00ea\u00eb]"), "e", I("[\u00ec\u00ed\u00ee\u00ef]"), "i", I("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"), "o", I("[\u00f9\u00fa\u00fb\u00fc\u0171]"), "u", I("[\u00fd\u0177\u00ff]"), "y", I("\u00f1"), "n", I("[\u00e7c]"), "k", I("\u00df"), "s", I(" & "), " and "]; +function oa(a) { var b = a = "" + a; b.normalize && (b = b.normalize("NFD").replace(ca, "")); - return E.call(this, b.toLowerCase(), !a.normalize && ta); + return E.call(this, b.toLowerCase(), !a.normalize && qa); } -;var va = {encode:ua, B:!1, C:"strict"}; -const wa = /[^a-z0-9]+/, xa = {b:"p", v:"f", w:"f", z:"s", x:"s", "\u00df":"s", d:"t", n:"m", c:"k", g:"k", j:"k", q:"k", i:"e", y:"e", u:"o"}; -function ua(a) { - a = ra.call(this, a).join(" "); +;var sa = {encode:ra, B:!1, C:"strict"}; +const ta = /[^a-z0-9]+/, ua = {b:"p", v:"f", w:"f", z:"s", x:"s", "\u00df":"s", d:"t", n:"m", c:"k", g:"k", j:"k", q:"k", i:"e", y:"e", u:"o"}; +function ra(a) { + a = oa.call(this, a).join(" "); const b = []; if (a) { - const c = a.split(wa), e = c.length; + const c = a.split(ta), e = c.length; for (let d = 0, f, g = 0; d < e; d++) { if ((a = c[d]) && (!this.filter || !this.filter[a])) { f = a[0]; - let h = xa[f] || f, k = h; + let h = ua[f] || f, k = h; for (let m = 1; m < a.length; m++) { f = a[m]; - const n = xa[f] || f; + const n = ua[f] || f; n && n !== k && (h += n, k = n); } b[g++] = h; @@ -689,31 +689,26 @@ function ua(a) { } return b; } -;var za = {encode:ya, B:!1, C:""}; -const Aa = [I("ae"), "a", I("oe"), "o", I("sh"), "s", I("th"), "t", I("ph"), "f", I("pf"), "f", I("(?![aeo])h(?![aeo])"), "", I("(?!^[aeo])h(?!^[aeo])"), ""]; -function ya(a, b) { - a && (a = ua.call(this, a).join(" "), 2 < a.length && (a = F(a, Aa)), b || (1 < a.length && (a = J(a)), a && (a = a.split(" ")))); +;var wa = {encode:va, B:!1, C:""}; +const xa = [I("ae"), "a", I("oe"), "o", I("sh"), "s", I("th"), "t", I("ph"), "f", I("pf"), "f", I("(?![aeo])h(?![aeo])"), "", I("(?!^[aeo])h(?!^[aeo])"), ""]; +function va(a, b) { + a && (a = ra.call(this, a).join(" "), 2 < a.length && (a = F(a, xa)), b || (1 < a.length && (a = J(a)), a && (a = a.split(" ")))); return a || []; } -;var Ca = {encode:Ba, B:!1, C:""}; -const Da = I("(?!\\b)[aeo]"); -function Ba(a) { - a && (a = ya.call(this, a, !0), 1 < a.length && (a = a.replace(Da, "")), 1 < a.length && (a = J(a)), a && (a = a.split(" "))); +;var za = {encode:ya, B:!1, C:""}; +const Aa = I("(?!\\b)[aeo]"); +function ya(a) { + a && (a = va.call(this, a, !0), 1 < a.length && (a = a.replace(Aa, "")), 1 < a.length && (a = J(a)), a && (a = a.split(" "))); return a || []; } -;L["latin:default"] = da; -L["latin:simple"] = sa; -L["latin:balance"] = va; -L["latin:advanced"] = za; -L["latin:extra"] = Ca; -const X = self; -let Y; -const Z = {Index:O, Document:T, Worker:null, registerCharset:function(a, b) { - L[a] = b; +;M["latin:default"] = da; +M["latin:simple"] = pa; +M["latin:balance"] = sa; +M["latin:advanced"] = wa; +M["latin:extra"] = za; +export default {Index:S, Document:W, Worker:null, registerCharset:function(a, b) { + M[a] = b; }, registerLanguage:function(a, b) { - ea[a] = b; + L[a] = b; }}; -(Y = X.define) && Y.amd ? Y([], function() { - return Z; -}) : X.exports ? X.exports = Z : X.FlexSearch = Z; }(this)); diff --git a/dist/flexsearch.compact.module.min.js b/dist/flexsearch.compact.module.min.js index b57af90..9da0b30 100644 --- a/dist/flexsearch.compact.module.min.js +++ b/dist/flexsearch.compact.module.min.js @@ -1,27 +1,27 @@ /**! - * FlexSearch.js v0.7.39 (Compact.module) + * FlexSearch.js v0.7.40 (Compact.module) * Author and Copyright: Thomas Wilkerling * Licence: Apache-2.0 * Hosted by Nextapps GmbH * https://github.com/nextapps-de/flexsearch */ (function(self){'use strict';var t;function v(a){return"undefined"!==typeof a?a:!0}function w(a){const b=Array(a);for(let c=0;c=this.m&&(u||!n[l])){var f=P(q,e,r),g="";switch(this.C){case "full":if(2f;h--)if(h-f>=this.m){var k=P(q,e,r,d,f);g=l.substring(f,h);Q(this,n,g,k,a,c)}break}case "reverse":if(1=this.m&&Q(this,n, -g,P(q,e,r,d,h),a,c);g=""}case "forward":if(1=this.m&&Q(this,n,g,f,a,c);break}default:if(this.F&&(f=Math.min(f/this.F(b,l,r)|0,q-1)),Q(this,n,l,f,a,c),u&&1=this.m&&!d[l]){d[l]=1;const p=this.h&&l>f;Q(this,m,p?f:l,P(g+(e/2>g?0:1),e,r,h-1,k-1),a,c,p?l:f)}}}}this.D||(this.register[a]=1)}}return this}; -function P(a,b,c,e,d){return c&&1=this.m&&!c[q])if(this.s||f||this.map[q])k[u++]=q,c[q]=1;else return e;a=k;d=a.length}if(!d)return e;b||(b=100);h=this.depth&&1=e)))break;if(n){if(f)return ma(k,e,0);b[b.length]=k;return}}return!c&&k}function ma(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} -function na(a,b,c,e){c?(e=e&&b>c,a=(a=a[e?b:c])&&a[e?c:b]):a=a[b];return a}t.contain=function(a){return!!this.register[a]};t.update=function(a,b){return this.remove(a).add(a,b)};t.remove=function(a,b){const c=this.register[a];if(c){if(this.D)for(let e=0,d;eb||c)d=d.slice(c,c+b);e&&(d=qa.call(this,d));return{tag:a,result:d}}}function qa(a){const b=Array(a.length);for(let c=0,e;c=this.m&&(u||!n[l])){var f=T(q,e,r),g="";switch(this.C){case "full":if(2f;h--)if(h-f>=this.m){var k=T(q,e,r,d,f);g=l.substring(f,h);U(this,n,g,k,a,c)}break}case "reverse":if(1=this.m&&U(this,n, +g,T(q,e,r,d,h),a,c);g=""}case "forward":if(1=this.m&&U(this,n,g,f,a,c);break}default:if(this.F&&(f=Math.min(f/this.F(b,l,r)|0,q-1)),U(this,n,l,f,a,c),u&&1=this.m&&!d[l]){d[l]=1;const p=this.h&&l>f;U(this,m,p?f:l,T(g+(e/2>g?0:1),e,r,h-1,k-1),a,c,p?l:f)}}}}this.D||(this.register[a]=1)}}return this}; +function T(a,b,c,e,d){return c&&1=this.m&&!c[q])if(this.s||f||this.map[q])k[u++]=q,c[q]=1;else return e;a=k;d=a.length}if(!d)return e;b||(b=100);h=this.depth&&1=e)))break;if(n){if(f)return ja(k,e,0);b[b.length]=k;return}}return!c&&k}function ja(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} +function ka(a,b,c,e){c?(e=e&&b>c,a=(a=a[e?b:c])&&a[e?c:b]):a=a[b];return a}t.contain=function(a){return!!this.register[a]};t.update=function(a,b){return this.remove(a).add(a,b)};t.remove=function(a,b){const c=this.register[a];if(c){if(this.D)for(let e=0,d;eb||c)d=d.slice(c,c+b);e&&(d=na.call(this,d));return{tag:a,result:d}}}function na(a){const b=Array(a.length);for(let c=0,e;cb||c)e=e.slice(c,c+b);d&&(e=Ea.call(this,e));return{tag:a,result:e}}}function Ea(a){for(var b=Array(a.length),c=0,d;cb||c)e=e.slice(c,c+b);d&&(e=Ea.call(this,e));return{tag:a,result:e}}}function Ea(a){for(var b=Array(a.length),c=0,d;c=this.h&&(r||!m[k])){var h=J(p,d,q),f="";switch(this.B){case "full":if(2h;g--)if(g-h>=this.h){var l=J(p,d,q,e,h);f=k.substring(h,g);K(this,m,f,l,a,c)}break}case "reverse":if(1=this.h&&K(this, m,f,J(p,d,q,e,g),a,c);f=""}case "forward":if(1=this.h&&K(this,m,f,h,a,c);break}default:if(this.C&&(h=Math.min(h/this.C(b,k,q)|0,p-1)),K(this,m,k,h,a,c),r&&1=this.h&&!e[k]){e[k]=1;const u=this.j&&k>h;K(this,n,u?h:k,J(f+(d/2>f?0:1),d,q,g-1,l-1),a,c,u?k:h)}}}}this.m||(this.register[a]=1)}}return this}; function J(a,b,c,d,e){return c&&1=this.h&&!c[p])if(this.g||h||this.map[p])l[r++]=p,c[p]=1;else return d;a=l;e=a.length}if(!e)return d;b||(b=100);g=this.i&&1=d)))break;if(m){if(h)return O(l,d,0);b[b.length]=l;return}}return!c&&l}function O(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} +(m=N(this,d,h,b,f,2===e,r,n),h&&!1===m&&d.length||(n=r)):m=N(this,d,h,b,f,1===e,r);if(m)return m;if(h&&c===e-1){l=d.length;if(!l){if(g){g=0;c=-1;continue}return d}if(1===l)return O(d[0],b,f)}}return H(d,b,f,h)}; +function N(a,b,c,d,e,h,f,g){let l=[],n=g?a.l:a.map;a.g||(n=P(n,f,g,a.j));if(n){let m=0;const r=Math.min(n.length,g?a.v:a.s);for(let p=0,q=0,k,u;p=d)))break;if(m){if(h)return O(l,d,0);b[b.length]=l;return}}return!c&&l}function O(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} function P(a,b,c,d){c?(d=d&&b>c,a=(a=a[d?b:c])&&a[d?c:b]):a=a[b];return a}I.prototype.contain=function(a){return!!this.register[a]};I.prototype.update=function(a,b){return this.remove(a).add(a,b)};I.prototype.remove=function(a,b){const c=this.register[a];if(c){if(this.m)for(let d=0,e;d= this.h && (r || !m[k])) { - var h = J(p, d, q), f = ""; + var h = L(p, d, q), f = ""; switch(this.B) { case "full": if (2 < e) { for (h = 0; h < e; h++) { for (var g = e; g > h; g--) { if (g - h >= this.h) { - var l = J(p, d, q, e, h); + var l = L(p, d, q, e, h); f = k.substring(h, g); - K(this, m, f, l, a, c); + M(this, m, f, l, a, c); } } } @@ -193,24 +193,24 @@ I.prototype.add = function(a, b, c, d) { case "reverse": if (1 < e) { for (g = e - 1; 0 < g; g--) { - f = k[g] + f, f.length >= this.h && K(this, m, f, J(p, d, q, e, g), a, c); + f = k[g] + f, f.length >= this.h && M(this, m, f, L(p, d, q, e, g), a, c); } f = ""; } case "forward": if (1 < e) { for (g = 0; g < e; g++) { - f += k[g], f.length >= this.h && K(this, m, f, h, a, c); + f += k[g], f.length >= this.h && M(this, m, f, h, a, c); } break; } default: - if (this.C && (h = Math.min(h / this.C(b, k, q) | 0, p - 1)), K(this, m, k, h, a, c), r && 1 < d && q < d - 1) { + if (this.C && (h = Math.min(h / this.C(b, k, q) | 0, p - 1)), M(this, m, k, h, a, c), r && 1 < d && q < d - 1) { for (e = y(), f = this.v, h = k, g = Math.min(r + 1, d - q), e[h] = 1, l = 1; l < g; l++) { if ((k = b[this.u ? d - 1 - q - l : q + l]) && k.length >= this.h && !e[k]) { e[k] = 1; const u = this.j && k > h; - K(this, n, u ? h : k, J(f + (d / 2 > f ? 0 : 1), d, q, g - 1, l - 1), a, c, u ? k : h); + M(this, n, u ? h : k, L(f + (d / 2 > f ? 0 : 1), d, q, g - 1, l - 1), a, c, u ? k : h); } } } @@ -222,10 +222,10 @@ I.prototype.add = function(a, b, c, d) { } return this; }; -function J(a, b, c, d, e) { +function L(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 K(a, b, c, d, e, h, f) { +function M(a, b, c, d, e, h, f) { let g = f ? a.l : a.map; if (!b[c] || f && !b[c][f]) { a.g && (g = g[d]), f ? (b = b[c] || (b[c] = y()), b[f] = 1, g = g[f] || (g[f] = y())) : b[c] = 1, g = g[c] || (g[c] = []), a.g || (g = g[d] || (g[d] = [])), h && g.includes(e) || (g[g.length] = e, a.m && (a = a.register[e] || (a.register[e] = []), a[a.length] = g)); @@ -267,7 +267,7 @@ I.prototype.search = function(a, b, c) { g ? (n = a[0], c = 1) : 1 < e && a.sort(z); for (let m, r; c < e; c++) { r = a[c]; - g ? (m = L(this, d, h, b, f, 2 === e, r, n), h && !1 === m && d.length || (n = r)) : m = L(this, d, h, b, f, 1 === e, r); + g ? (m = N(this, d, h, b, f, 2 === e, r, n), h && !1 === m && d.length || (n = r)) : m = N(this, d, h, b, f, 1 === e, r); if (m) { return m; } @@ -288,7 +288,7 @@ I.prototype.search = function(a, b, c) { } return H(d, b, f, h); }; -function L(a, b, c, d, e, h, f, g) { +function N(a, b, c, d, e, h, f, g) { let l = [], n = g ? a.l : a.map; a.g || (n = P(n, f, g, a.j)); if (n) { @@ -359,14 +359,9 @@ function Q(a, b, c, d, e) { } return h; } -;const R = self; -let S; -const T = {Index:I, Document:null, Worker:null, registerCharset:function(a, b) { +;export default {Index:I, Document:null, Worker:null, registerCharset:function(a, b) { G[a] = b; }, registerLanguage:function(a, b) { F[a] = b; }}; -(S = R.define) && S.amd ? S([], function() { - return T; -}) : R.exports ? R.exports = T : R.FlexSearch = T; diff --git a/dist/flexsearch.light.module.min.js b/dist/flexsearch.light.module.min.js index ee4561a..a899307 100644 --- a/dist/flexsearch.light.module.min.js +++ b/dist/flexsearch.light.module.min.js @@ -1,18 +1,18 @@ /**! - * FlexSearch.js v0.7.39 (Light.module) + * FlexSearch.js v0.7.40 (Light.module) * Author and Copyright: Thomas Wilkerling * Licence: Apache-2.0 * Hosted by Nextapps GmbH * https://github.com/nextapps-de/flexsearch */ -function t(a){return"undefined"!==typeof a?a:!0}function v(a){const b=Array(a);for(let c=0;c=this.h&&(r||!m[k])){var h=J(p,d,q),f="";switch(this.B){case "full":if(2h;g--)if(g-h>=this.h){var l=J(p,d,q,e,h);f=k.substring(h,g);K(this,m,f,l,a,c)}break}case "reverse":if(1=this.h&&K(this, -m,f,J(p,d,q,e,g),a,c);f=""}case "forward":if(1=this.h&&K(this,m,f,h,a,c);break}default:if(this.C&&(h=Math.min(h/this.C(b,k,q)|0,p-1)),K(this,m,k,h,a,c),r&&1=this.h&&!e[k]){e[k]=1;const u=this.j&&k>h;K(this,n,u?h:k,J(f+(d/2>f?0:1),d,q,g-1,l-1),a,c,u?k:h)}}}}this.m||(this.register[a]=1)}}return this}; -function J(a,b,c,d,e){return c&&1=this.h&&(r||!m[k])){var h=L(p,d,q),f="";switch(this.B){case "full":if(2h;g--)if(g-h>=this.h){var l=L(p,d,q,e,h);f=k.substring(h,g);M(this,m,f,l,a,c)}break}case "reverse":if(1=this.h&&M(this, +m,f,L(p,d,q,e,g),a,c);f=""}case "forward":if(1=this.h&&M(this,m,f,h,a,c);break}default:if(this.C&&(h=Math.min(h/this.C(b,k,q)|0,p-1)),M(this,m,k,h,a,c),r&&1=this.h&&!e[k]){e[k]=1;const u=this.j&&k>h;M(this,n,u?h:k,L(f+(d/2>f?0:1),d,q,g-1,l-1),a,c,u?k:h)}}}}this.m||(this.register[a]=1)}}return this}; +function L(a,b,c,d,e){return c&&1=this.h&&!c[p])if(this.g||h||this.map[p])l[r++]=p,c[p]=1;else return d;a=l;e=a.length}if(!e)return d;b||(b=100);g=this.i&&1=d)))break;if(m){if(h)return O(l,d,0);b[b.length]=l;return}}return!c&&l}function O(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} +(m=N(this,d,h,b,f,2===e,r,n),h&&!1===m&&d.length||(n=r)):m=N(this,d,h,b,f,1===e,r);if(m)return m;if(h&&c===e-1){l=d.length;if(!l){if(g){g=0;c=-1;continue}return d}if(1===l)return O(d[0],b,f)}}return H(d,b,f,h)}; +function N(a,b,c,d,e,h,f,g){let l=[],n=g?a.l:a.map;a.g||(n=P(n,f,g,a.j));if(n){let m=0;const r=Math.min(n.length,g?a.v:a.s);for(let p=0,q=0,k,u;p=d)))break;if(m){if(h)return O(l,d,0);b[b.length]=l;return}}return!c&&l}function O(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} function P(a,b,c,d){c?(d=d&&b>c,a=(a=a[d?b:c])&&a[d?c:b]):a=a[b];return a}I.prototype.contain=function(a){return!!this.register[a]};I.prototype.update=function(a,b){return this.remove(a).add(a,b)};I.prototype.remove=function(a,b){const c=this.register[a];if(c){if(this.m)for(let d=0,e;d