/**! * FlexSearch.js v0.8.157 (Bundle/Debug) * Author and Copyright: Thomas Wilkerling * Licence: Apache-2.0 * Hosted by Nextapps GmbH * https://github.com/nextapps-de/flexsearch */ var r; function u(a, c, b) { const e = typeof b, d = typeof a; if ("undefined" !== e) { if ("undefined" !== d) { if (b) { if ("function" === d && e === d) { return function(k) { return a(b(k)); }; } c = a.constructor; if (c === b.constructor) { if (c === Array) { return b.concat(a); } if (c === Map) { var g = new Map(b); for (var f of a) { g.set(f[0], f[1]); } return g; } if (c === Set) { f = new Set(b); for (g of a.values()) { f.add(g); } return f; } } } return a; } return b; } return "undefined" === d ? c : a; } function x() { return Object.create(null); } ;const A = /[^\p{L}\p{N}]+/u, B = /(\d{3})/g, C = /(\D)(\d{3})/g, D = /(\d{3})(\D)/g, E = /[\u0300-\u036f]/g; function F(a = {}) { if (!this || this.constructor !== F) { return new F(...arguments); } if (arguments.length) { for (a = 0; a < arguments.length; a++) { this.assign(arguments[a]); } } else { this.assign(a); } } r = F.prototype; r.assign = function(a) { this.normalize = u(a.normalize, !0, this.normalize); let c = a.include, b = c || a.exclude || a.split, e; if (b || "" === b) { if ("object" === typeof b && b.constructor !== RegExp) { let d = ""; e = !c; c || (d += "\\p{Z}"); b.letter && (d += "\\p{L}"); b.number && (d += "\\p{N}", e = !!c); b.symbol && (d += "\\p{S}"); b.punctuation && (d += "\\p{P}"); b.control && (d += "\\p{C}"); if (b = b.char) { d += "object" === typeof b ? b.join("") : b; } try { this.split = new RegExp("[" + (c ? "^" : "") + d + "]+", "u"); } catch (g) { console.error("Your split configuration:", b, "is not supported on this platform. It falls back to using simple whitespace splitter instead: /s+/."), this.split = /\s+/; } } else { this.split = b, e = !1 === b || 2 > "a1a".split(b).length; } this.numeric = u(a.numeric, e); } else { try { this.split = u(this.split, A); } catch (d) { console.warn("This platform does not support unicode regex. It falls back to using simple whitespace splitter instead: /s+/."), this.split = /\s+/; } this.numeric = u(a.numeric, u(this.numeric, !0)); } this.prepare = u(a.prepare, null, this.prepare); this.finalize = u(a.finalize, null, this.finalize); b = a.filter; this.filter = "function" === typeof b ? b : u(b && new Set(b), null, this.filter); this.dedupe = u(a.dedupe, !0, this.dedupe); this.matcher = u((b = a.matcher) && new Map(b), null, this.matcher); this.mapper = u((b = a.mapper) && new Map(b), null, this.mapper); this.stemmer = u((b = a.stemmer) && new Map(b), null, this.stemmer); this.replacer = u(a.replacer, null, this.replacer); this.minlength = u(a.minlength, 1, this.minlength); this.maxlength = u(a.maxlength, 1024, this.maxlength); this.rtl = u(a.rtl, !1, this.rtl); if (this.cache = b = u(a.cache, !0, this.cache)) { this.l = null, this.A = "number" === typeof b ? b : 2e5, this.i = new Map(), this.j = new Map(), this.o = this.m = 128; } this.g = ""; this.s = null; this.h = ""; this.u = null; if (this.matcher) { for (const d of this.matcher.keys()) { this.g += (this.g ? "|" : "") + d; } } if (this.stemmer) { for (const d of this.stemmer.keys()) { this.h += (this.h ? "|" : "") + d; } } return this; }; r.addStemmer = function(a, c) { this.stemmer || (this.stemmer = new Map()); this.stemmer.set(a, c); this.h += (this.h ? "|" : "") + a; this.u = null; this.cache && G(this); return this; }; r.addFilter = function(a) { "function" === typeof a ? this.filter = a : (this.filter || (this.filter = new Set()), this.filter.add(a)); this.cache && G(this); return this; }; r.addMapper = function(a, c) { if ("object" === typeof a) { return this.addReplacer(a, c); } if (1 < a.length) { return this.addMatcher(a, c); } this.mapper || (this.mapper = new Map()); this.mapper.set(a, c); this.cache && G(this); return this; }; r.addMatcher = function(a, c) { if ("object" === typeof a) { return this.addReplacer(a, c); } if (2 > a.length && (this.dedupe || this.mapper)) { return this.addMapper(a, c); } this.matcher || (this.matcher = new Map()); this.matcher.set(a, c); this.g += (this.g ? "|" : "") + a; this.s = null; this.cache && G(this); return this; }; r.addReplacer = function(a, c) { if ("string" === typeof a) { return this.addMatcher(a, c); } this.replacer || (this.replacer = []); this.replacer.push(a, c); this.cache && G(this); return this; }; r.encode = function(a, c) { if (this.cache && a.length <= this.m) { if (this.l) { if (this.i.has(a)) { return this.i.get(a); } } else { this.l = setTimeout(G, 50, this); } } this.normalize && ("function" === typeof this.normalize ? a = this.normalize(a) : a = E ? a.normalize("NFKD").replace(E, "").toLowerCase() : a.toLowerCase()); this.prepare && (a = this.prepare(a)); this.numeric && 3 < a.length && (a = a.replace(C, "$1 $2").replace(D, "$1 $2").replace(B, "$1 ")); const b = !(this.dedupe || this.mapper || this.filter || this.matcher || this.stemmer || this.replacer); let e = [], d = x(), g, f, k = this.split || "" === this.split ? a.split(this.split) : [a]; for (let n = 0, h, w; n < k.length; n++) { if ((h = w = k[n]) && !(h.length < this.minlength || h.length > this.maxlength)) { if (c) { if (d[h]) { continue; } d[h] = 1; } else { if (g === h) { continue; } g = h; } if (b) { e.push(h); } else { if (!this.filter || ("function" === typeof this.filter ? this.filter(h) : !this.filter.has(h))) { if (this.cache && h.length <= this.o) { if (this.l) { var l = this.j.get(h); if (l || "" === l) { l && e.push(l); continue; } } else { this.l = setTimeout(G, 50, this); } } if (this.stemmer) { this.u || (this.u = new RegExp("(?!^)(" + this.h + ")$")); let v; for (; v !== h && 2 < h.length;) { v = h, h = h.replace(this.u, p => this.stemmer.get(p)); } } if (h && (this.mapper || this.dedupe && 1 < h.length)) { l = ""; for (let v = 0, p = "", m, q; v < h.length; v++) { m = h.charAt(v), m === p && this.dedupe || ((q = this.mapper && this.mapper.get(m)) || "" === q ? q === p && this.dedupe || !(p = q) || (l += q) : l += p = m); } h = l; } this.matcher && 1 < h.length && (this.s || (this.s = new RegExp("(" + this.g + ")", "g")), h = h.replace(this.s, v => this.matcher.get(v))); if (h && this.replacer) { for (l = 0; h && l < this.replacer.length; l += 2) { h = h.replace(this.replacer[l], this.replacer[l + 1]); } } this.cache && w.length <= this.o && (this.j.set(w, h), this.j.size > this.A && (this.j.clear(), this.o = this.o / 1.1 | 0)); if (h) { if (h !== w) { if (c) { if (d[h]) { continue; } d[h] = 1; } else { if (f === h) { continue; } f = h; } } e.push(h); } } } } } this.finalize && (e = this.finalize(e) || e); this.cache && a.length <= this.m && (this.i.set(a, e), this.i.size > this.A && (this.i.clear(), this.m = this.m / 1.1 | 0)); return e; }; function G(a) { a.l = null; a.i.clear(); a.j.clear(); } ;function H(a, c, b) { if (!a.length) { return a; } if (1 === a.length) { return a = a[0], a = b || a.length > c ? c ? a.slice(b, b + c) : a.slice(b) : a; } let e = []; for (let d = 0, g, f; d < a.length; d++) { if ((g = a[d]) && (f = g.length)) { if (b) { if (b >= f) { b -= f; continue; } b < f && (g = c ? g.slice(b, b + c) : g.slice(b), f = g.length, b = 0); } f > c && (g = g.slice(0, c), f = c); if (!e.length && f >= c) { return g; } e.push(g); c -= f; if (!c) { break; } } } return e = 1 < e.length ? [].concat.apply([], e) : e[0]; } ;x(); I.prototype.remove = function(a, c) { const b = this.reg.size && (this.fastupdate ? this.reg.get(a) : this.reg.has(a)); if (b) { if (this.fastupdate) { for (let e = 0, d; e < b.length; e++) { if (d = b[e]) { if (2 > d.length) { d.pop(); } else { const g = d.indexOf(a); g === b.length - 1 ? d.pop() : d.splice(g, 1); } } } } else { J(this.map, a), this.depth && J(this.ctx, a); } c || this.reg.delete(a); } return this; }; function J(a, c) { let b = 0; var e = "undefined" === typeof c; if (a.constructor === Array) { for (let d = 0, g, f; d < a.length; d++) { if ((g = a[d]) && g.length) { if (e) { b++; } else { if (f = g.indexOf(c), 0 <= f) { 1 < g.length ? (g.splice(f, 1), b++) : delete a[d]; break; } else { b++; } } } } } else { for (let d of a.entries()) { e = d[0]; const g = J(d[1], c); g ? b += g : a.delete(e); } } return b; } ;const K = {memory:{resolution:1}, performance:{resolution:3, fastupdate:!0, context:{depth:1, resolution:1}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:3}}}; I.prototype.add = function(a, c, b, e) { if (c && (a || 0 === a)) { if (!e && !b && this.reg.has(a)) { return this.update(a, c); } e = this.depth; c = this.encoder.encode(c, !e); const n = c.length; if (n) { const h = x(), w = x(), v = this.resolution; for (let p = 0; p < n; p++) { let m = c[this.rtl ? n - 1 - p : p]; var d = m.length; if (d && (e || !w[m])) { var g = this.score ? this.score(c, m, p, null, 0) : L(v, n, p), f = ""; switch(this.tokenize) { case "full": if (2 < d) { for (let q = 0, t; q < d; q++) { for (g = d; g > q; g--) { f = m.substring(q, g); t = this.rtl ? d - 1 - q : q; var k = this.score ? this.score(c, m, p, f, t) : L(v, n, p, d, t); M(this, w, f, k, a, b); } } break; } case "bidirectional": case "reverse": if (1 < d) { for (k = d - 1; 0 < k; k--) { f = m[this.rtl ? d - 1 - k : k] + f; var l = this.score ? this.score(c, m, p, f, k) : L(v, n, p, d, k); M(this, w, f, l, a, b); } f = ""; } case "forward": if (1 < d) { for (k = 0; k < d; k++) { f += m[this.rtl ? d - 1 - k : k], M(this, w, f, g, a, b); } break; } default: if (M(this, w, m, g, a, b), e && 1 < n && p < n - 1) { for (d = x(), f = this.v, g = m, k = Math.min(e + 1, this.rtl ? p + 1 : n - p), d[g] = 1, l = 1; l < k; l++) { if ((m = c[this.rtl ? n - 1 - p - l : p + l]) && !d[m]) { d[m] = 1; const q = this.score ? this.score(c, g, p, m, l - 1) : L(f + (n / 2 > f ? 0 : 1), n, p, k - 1, l - 1), t = this.bidirectional && m > g; M(this, h, t ? g : m, q, a, b, t ? m : g); } } } } } } this.fastupdate || this.reg.add(a); } } return this; }; function M(a, c, b, e, d, g, f) { let k = f ? a.ctx : a.map, l; if (!c[b] || f && !(l = c[b])[f]) { f ? (c = l || (c[b] = x()), c[f] = 1, (l = k.get(f)) ? k = l : k.set(f, k = new Map())) : c[b] = 1, (l = k.get(b)) ? k = l : k.set(b, k = []), k = k[e] || (k[e] = []), g && k.includes(d) || (k.push(d), a.fastupdate && ((c = a.reg.get(d)) ? c.push(k) : a.reg.set(d, [k]))); } } function L(a, c, b, e, d) { return b && 1 < a ? c + (e || 0) <= a ? b + (d || 0) : (a - 1) / (c + (e || 0)) * (b + (d || 0)) + 1 | 0 : 0; } ;I.prototype.search = function(a, c, b) { b || (c || "object" !== typeof a ? "object" === typeof c && (b = c, c = 0) : (b = a, a = "")); var e = [], d = 0; if (b) { a = b.query || a; c = b.limit || c; d = b.offset || 0; var g = b.context; var f = b.suggest; var k = !0; var l = b.resolution; } else { k = !0; } g = this.depth && !1 !== g; a = this.encoder.encode(a, !g); b = a.length; c = c || (k ? 100 : 0); if (1 === b) { return f = d, (d = N(this, a[0], "")) && d.length ? H.call(this, d, c, f) : []; } if (2 === b && g && !f) { return f = d, (d = N(this, a[1], a[0])) && d.length ? H.call(this, d, c, f) : []; } k = x(); var n = 0; if (g) { var h = a[0]; n = 1; } l || 0 === l || (l = h ? this.v : this.resolution); for (let m, q; n < b; n++) { if ((q = a[n]) && !k[q]) { k[q] = 1; m = N(this, q, h); a: { g = m; var w = e, v = f, p = l; let t = []; if (g && g.length) { if (g.length <= p) { w.push(g); m = void 0; break a; } for (let y = 0, z; y < p; y++) { if (z = g[y]) { t[y] = z; } } if (t.length) { w.push(t); m = void 0; break a; } } m = v ? void 0 : t; } if (m) { e = m; break; } h && (f && m && e.length || (h = q)); } f && h && n === b - 1 && !e.length && (l = this.resolution, h = "", n = -1, k = x()); } a: { a = e; e = a.length; h = a; if (1 < e) { b: { e = f; h = a.length; f = []; b = x(); for (let m = 0, q, t, y, z; m < l; m++) { for (n = 0; n < h; n++) { if (y = a[n], m < y.length && (q = y[m])) { for (g = 0; g < q.length; g++) { if (t = q[g], (k = b[t]) ? b[t]++ : (k = 0, b[t] = 1), z = f[k] || (f[k] = []), z.push(t), c && k === h - 1 && z.length - d === c) { h = d ? z.slice(d) : z; break b; } } } } } if (a = f.length) { if (e) { if (1 < f.length) { c: { for (a = [], l = x(), e = f.length, k = e - 1; 0 <= k; k--) { if (b = (e = f[k]) && e.length) { for (n = 0; n < b; n++) { if (h = e[n], !l[h]) { if (l[h] = 1, d) { d--; } else { if (a.push(h), a.length === c) { break c; } } } } } } } } else { a = (f = f[0]).length > c || d ? f.slice(d, c + d) : f; } f = a; } else { if (a < h) { h = []; break b; } f = f[a - 1]; if (c || d) { if (f.length > c || d) { f = f.slice(d, c + d); } } } } h = f; } } else if (1 === e) { c = H.call(null, a[0], c, d); break a; } c = h; } return c; }; function N(a, c, b) { let e; b && (e = a.bidirectional && c > b) && (e = b, b = c, c = e); a = b ? (a = a.ctx.get(b)) && a.get(c) : a.map.get(c); return a; } ;function I(a, c) { if (!this || this.constructor !== I) { return new I(a); } if (a) { var b = "string" === typeof a ? a : a.preset; b && (K[b] || console.warn("Preset not found: " + b), a = Object.assign({}, K[b], a)); } else { a = {}; } b = a.context; const e = !0 === b ? {depth:1} : b || {}, d = a.encode || a.encoder || {}; this.encoder = d.encode ? d : "object" === typeof d ? new F(d) : {encode:d}; this.resolution = a.resolution || 9; this.tokenize = b = (b = a.tokenize) && "default" !== b && "exact" !== b && b || "strict"; this.depth = "strict" === b && e.depth || 0; this.bidirectional = !1 !== e.bidirectional; this.fastupdate = !!a.fastupdate; this.score = a.score || null; e && e.depth && "strict" !== this.tokenize && console.warn('Context-Search could not applied, because it is just supported when using the tokenizer "strict".'); this.map = new Map(); this.ctx = new Map(); this.reg = c || (this.fastupdate ? new Map() : new Set()); this.v = e.resolution || 3; this.rtl = d.rtl || a.rtl || !1; } r = I.prototype; r.clear = function() { this.map.clear(); this.ctx.clear(); this.reg.clear(); return this; }; r.append = function(a, c) { return this.add(a, c, !0); }; r.contain = function(a) { return this.reg.has(a); }; r.update = function(a, c) { const b = this, e = this.remove(a); return e && e.then ? e.then(() => b.add(a, c)) : this.add(a, c); }; r.cleanup = function() { if (!this.fastupdate) { return console.info('Cleanup the index isn\'t required when not using "fastupdate".'), this; } J(this.map); this.depth && J(this.ctx); return this; }; x(); export default {Index:I, Charset:null, Encoder:F, Document:null, Worker:null, Resolver:null, IndexedDB:null, Language:{}}; export const Index=I;export const Charset=null;export const Encoder=F;export const Document=null;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};