/**! * FlexSearch.js v0.8.200 (ES5/Debug) * Author and Copyright: Thomas Wilkerling * Licence: Apache-2.0 * Hosted by Nextapps GmbH * https://github.com/nextapps-de/flexsearch */ (function _f(self){'use strict';if(typeof module!=='undefined')self=module;else if(typeof process !== 'undefined')self=process;self._factory=_f; var w; function aa(a) { var b = 0; return function() { return b < a.length ? {done:!1, value:a[b++]} : {done:!0}; }; } function C(a) { var b = "undefined" != typeof Symbol && Symbol.iterator && a[Symbol.iterator]; if (b) { return b.call(a); } if ("number" == typeof a.length) { return {next:aa(a)}; } throw Error(String(a) + " is not an iterable or ArrayLike"); } var ca = "function" == typeof Object.defineProperties ? Object.defineProperty : function(a, b, c) { if (a == Array.prototype || a == Object.prototype) { return a; } a[b] = c.value; return a; }; function da(a) { a = ["object" == typeof globalThis && globalThis, a, "object" == typeof window && window, "object" == typeof self && self, "object" == typeof global && global]; for (var b = 0; b < a.length; ++b) { var c = a[b]; if (c && c.Math == Math) { return c; } } throw Error("Cannot find global object"); } var ea = da(this); function H(a, b) { if (b) { a: { var c = ea; a = a.split("."); for (var d = 0; d < a.length - 1; d++) { var e = a[d]; if (!(e in c)) { break a; } c = c[e]; } a = a[a.length - 1]; d = c[a]; b = b(d); b != d && null != b && ca(c, a, {configurable:!0, writable:!0, value:b}); } } } var fa; if ("function" == typeof Object.setPrototypeOf) { fa = Object.setPrototypeOf; } else { var ha; a: { var ia = {a:!0}, ja = {}; try { ja.__proto__ = ia; ha = ja.a; break a; } catch (a) { } ha = !1; } fa = ha ? function(a, b) { a.__proto__ = b; if (a.__proto__ !== b) { throw new TypeError(a + " is not extensible"); } return a; } : null; } var ka = fa; function la() { this.D = !1; this.A = null; this.B = void 0; this.h = 1; this.I = 0; this.C = null; } function ma(a) { if (a.D) { throw new TypeError("Generator is already running"); } a.D = !0; } la.prototype.H = function(a) { this.B = a; }; function na(a, b) { a.C = {oa:b, pa:!0}; a.h = a.I; } la.prototype.return = function(a) { this.C = {return:a}; this.h = this.I; }; function K(a, b, c) { a.h = c; return {value:b}; } function pa(a) { this.h = new la(); this.A = a; } function qa(a, b) { ma(a.h); var c = a.h.A; if (c) { return ra(a, "return" in c ? c["return"] : function(d) { return {value:d, done:!0}; }, b, a.h.return); } a.h.return(b); return sa(a); } function ra(a, b, c, d) { try { var e = b.call(a.h.A, c); if (!(e instanceof Object)) { throw new TypeError("Iterator result " + e + " is not an object"); } if (!e.done) { return a.h.D = !1, e; } var g = e.value; } catch (f) { return a.h.A = null, na(a.h, f), sa(a); } a.h.A = null; d.call(a.h, g); return sa(a); } function sa(a) { for (; a.h.h;) { try { var b = a.A(a.h); if (b) { return a.h.D = !1, {value:b.value, done:!1}; } } catch (c) { a.h.B = void 0, na(a.h, c); } } a.h.D = !1; if (a.h.C) { b = a.h.C; a.h.C = null; if (b.pa) { throw b.oa; } return {value:b.return, done:!0}; } return {value:void 0, done:!0}; } function ta(a) { this.next = function(b) { ma(a.h); a.h.A ? b = ra(a, a.h.A.next, b, a.h.H) : (a.h.H(b), b = sa(a)); return b; }; this.throw = function(b) { ma(a.h); a.h.A ? b = ra(a, a.h.A["throw"], b, a.h.H) : (na(a.h, b), b = sa(a)); return b; }; this.return = function(b) { return qa(a, b); }; this[Symbol.iterator] = function() { return this; }; } function ua(a, b) { b = new ta(new pa(b)); ka && a.prototype && ka(b, a.prototype); return b; } function va(a) { function b(d) { return a.next(d); } function c(d) { return a.throw(d); } return new Promise(function(d, e) { function g(f) { f.done ? d(f.value) : Promise.resolve(f.value).then(b, c).then(g, e); } g(a.next()); }); } function wa(a) { return va(new ta(new pa(a))); } H("Symbol", function(a) { function b(g) { if (this instanceof b) { throw new TypeError("Symbol is not a constructor"); } return new c(d + (g || "") + "_" + e++, g); } function c(g, f) { this.h = g; ca(this, "description", {configurable:!0, writable:!0, value:f}); } if (a) { return a; } c.prototype.toString = function() { return this.h; }; var d = "jscomp_symbol_" + (1E9 * Math.random() >>> 0) + "_", e = 0; return b; }); H("Symbol.iterator", function(a) { if (a) { return a; } a = Symbol("Symbol.iterator"); for (var b = "Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "), c = 0; c < b.length; c++) { var d = ea[b[c]]; "function" === typeof d && "function" != typeof d.prototype[a] && ca(d.prototype, a, {configurable:!0, writable:!0, value:function() { return xa(aa(this)); }}); } return a; }); function xa(a) { a = {next:a}; a[Symbol.iterator] = function() { return this; }; return a; } H("Promise", function(a) { function b(f) { this.A = 0; this.B = void 0; this.h = []; this.N = !1; var h = this.C(); try { f(h.resolve, h.reject); } catch (k) { h.reject(k); } } function c() { this.h = null; } function d(f) { return f instanceof b ? f : new b(function(h) { h(f); }); } if (a) { return a; } c.prototype.A = function(f) { if (null == this.h) { this.h = []; var h = this; this.B(function() { h.D(); }); } this.h.push(f); }; var e = ea.setTimeout; c.prototype.B = function(f) { e(f, 0); }; c.prototype.D = function() { for (; this.h && this.h.length;) { var f = this.h; this.h = []; for (var h = 0; h < f.length; ++h) { var k = f[h]; f[h] = null; try { k(); } catch (l) { this.C(l); } } } this.h = null; }; c.prototype.C = function(f) { this.B(function() { throw f; }); }; b.prototype.C = function() { function f(l) { return function(m) { k || (k = !0, l.call(h, m)); }; } var h = this, k = !1; return {resolve:f(this.ja), reject:f(this.D)}; }; b.prototype.ja = function(f) { if (f === this) { this.D(new TypeError("A Promise cannot resolve to itself")); } else { if (f instanceof b) { this.la(f); } else { a: { switch(typeof f) { case "object": var h = null != f; break a; case "function": h = !0; break a; default: h = !1; } } h ? this.ia(f) : this.I(f); } } }; b.prototype.ia = function(f) { var h = void 0; try { h = f.then; } catch (k) { this.D(k); return; } "function" == typeof h ? this.ma(h, f) : this.I(f); }; b.prototype.D = function(f) { this.O(2, f); }; b.prototype.I = function(f) { this.O(1, f); }; b.prototype.O = function(f, h) { if (0 != this.A) { throw Error("Cannot settle(" + f + ", " + h + "): Promise already settled in state" + this.A); } this.A = f; this.B = h; 2 === this.A && this.ka(); this.U(); }; b.prototype.ka = function() { var f = this; e(function() { if (f.ha()) { var h = ea.console; "undefined" !== typeof h && h.error(f.B); } }, 1); }; b.prototype.ha = function() { if (this.N) { return !1; } var f = ea.CustomEvent, h = ea.Event, k = ea.dispatchEvent; if ("undefined" === typeof k) { return !0; } "function" === typeof f ? f = new f("unhandledrejection", {cancelable:!0}) : "function" === typeof h ? f = new h("unhandledrejection", {cancelable:!0}) : (f = ea.document.createEvent("CustomEvent"), f.initCustomEvent("unhandledrejection", !1, !0, f)); f.promise = this; f.reason = this.B; return k(f); }; b.prototype.U = function() { if (null != this.h) { for (var f = 0; f < this.h.length; ++f) { g.A(this.h[f]); } this.h = null; } }; var g = new c(); b.prototype.la = function(f) { var h = this.C(); f.V(h.resolve, h.reject); }; b.prototype.ma = function(f, h) { var k = this.C(); try { f.call(h, k.resolve, k.reject); } catch (l) { k.reject(l); } }; b.prototype.then = function(f, h) { function k(n, q) { return "function" == typeof n ? function(t) { try { l(n(t)); } catch (u) { m(u); } } : q; } var l, m, p = new b(function(n, q) { l = n; m = q; }); this.V(k(f, l), k(h, m)); return p; }; b.prototype.catch = function(f) { return this.then(void 0, f); }; b.prototype.V = function(f, h) { function k() { switch(l.A) { case 1: f(l.B); break; case 2: h(l.B); break; default: throw Error("Unexpected state: " + l.A); } } var l = this; null == this.h ? g.A(k) : this.h.push(k); this.N = !0; }; b.resolve = d; b.reject = function(f) { return new b(function(h, k) { k(f); }); }; b.race = function(f) { return new b(function(h, k) { for (var l = C(f), m = l.next(); !m.done; m = l.next()) { d(m.value).V(h, k); } }); }; b.all = function(f) { var h = C(f), k = h.next(); return k.done ? d([]) : new b(function(l, m) { function p(t) { return function(u) { n[t] = u; q--; 0 == q && l(n); }; } var n = [], q = 0; do { n.push(void 0), q++, d(k.value).V(p(n.length - 1), m), k = h.next(); } while (!k.done); }); }; return b; }); function ya(a, b) { a instanceof String && (a += ""); var c = 0, d = !1, e = {next:function() { if (!d && c < a.length) { var g = c++; return {value:b(g, a[g]), done:!1}; } d = !0; return {done:!0, value:void 0}; }}; e[Symbol.iterator] = function() { return e; }; return e; } H("Array.prototype.values", function(a) { return a ? a : function() { return ya(this, function(b, c) { return c; }); }; }); H("Array.prototype.keys", function(a) { return a ? a : function() { return ya(this, function(b) { return b; }); }; }); function za(a, b) { return Object.prototype.hasOwnProperty.call(a, b); } H("WeakMap", function(a) { function b(k) { this.h = (h += Math.random() + 1).toString(); if (k) { k = C(k); for (var l; !(l = k.next()).done;) { l = l.value, this.set(l[0], l[1]); } } } function c() { } function d(k) { var l = typeof k; return "object" === l && null !== k || "function" === l; } function e(k) { if (!za(k, f)) { var l = new c(); ca(k, f, {value:l}); } } function g(k) { var l = Object[k]; l && (Object[k] = function(m) { if (m instanceof c) { return m; } Object.isExtensible(m) && e(m); return l(m); }); } if (function() { if (!a || !Object.seal) { return !1; } try { var k = Object.seal({}), l = Object.seal({}), m = new a([[k, 2], [l, 3]]); if (2 != m.get(k) || 3 != m.get(l)) { return !1; } m.delete(k); m.set(l, 4); return !m.has(k) && 4 == m.get(l); } catch (p) { return !1; } }()) { return a; } var f = "$jscomp_hidden_" + Math.random(); g("freeze"); g("preventExtensions"); g("seal"); var h = 0; b.prototype.set = function(k, l) { if (!d(k)) { throw Error("Invalid WeakMap key"); } e(k); if (!za(k, f)) { throw Error("WeakMap key fail: " + k); } k[f][this.h] = l; return this; }; b.prototype.get = function(k) { return d(k) && za(k, f) ? k[f][this.h] : void 0; }; b.prototype.has = function(k) { return d(k) && za(k, f) && za(k[f], this.h); }; b.prototype.delete = function(k) { return d(k) && za(k, f) && za(k[f], this.h) ? delete k[f][this.h] : !1; }; return b; }); H("Map", function(a) { function b() { var h = {}; return h.K = h.next = h.head = h; } function c(h, k) { var l = h[1]; return xa(function() { if (l) { for (; l.head != h[1];) { l = l.K; } for (; l.next != l.head;) { return l = l.next, {done:!1, value:k(l)}; } l = null; } return {done:!0, value:void 0}; }); } function d(h, k) { var l = k && typeof k; "object" == l || "function" == l ? g.has(k) ? l = g.get(k) : (l = "" + ++f, g.set(k, l)) : l = "p_" + k; var m = h[0][l]; if (m && za(h[0], l)) { for (h = 0; h < m.length; h++) { var p = m[h]; if (k !== k && p.key !== p.key || k === p.key) { return {id:l, list:m, index:h, F:p}; } } } return {id:l, list:m, index:-1, F:void 0}; } function e(h) { this[0] = {}; this[1] = b(); this.size = 0; if (h) { h = C(h); for (var k; !(k = h.next()).done;) { k = k.value, this.set(k[0], k[1]); } } } if (function() { if (!a || "function" != typeof a || !a.prototype.entries || "function" != typeof Object.seal) { return !1; } try { var h = Object.seal({x:4}), k = new a(C([[h, "s"]])); if ("s" != k.get(h) || 1 != k.size || k.get({x:4}) || k.set({x:4}, "t") != k || 2 != k.size) { return !1; } var l = k.entries(), m = l.next(); if (m.done || m.value[0] != h || "s" != m.value[1]) { return !1; } m = l.next(); return m.done || 4 != m.value[0].x || "t" != m.value[1] || !l.next().done ? !1 : !0; } catch (p) { return !1; } }()) { return a; } var g = new WeakMap(); e.prototype.set = function(h, k) { h = 0 === h ? 0 : h; var l = d(this, h); l.list || (l.list = this[0][l.id] = []); l.F ? l.F.value = k : (l.F = {next:this[1], K:this[1].K, head:this[1], key:h, value:k}, l.list.push(l.F), this[1].K.next = l.F, this[1].K = l.F, this.size++); return this; }; e.prototype.delete = function(h) { h = d(this, h); return h.F && h.list ? (h.list.splice(h.index, 1), h.list.length || delete this[0][h.id], h.F.K.next = h.F.next, h.F.next.K = h.F.K, h.F.head = null, this.size--, !0) : !1; }; e.prototype.clear = function() { this[0] = {}; this[1] = this[1].K = b(); this.size = 0; }; e.prototype.has = function(h) { return !!d(this, h).F; }; e.prototype.get = function(h) { return (h = d(this, h).F) && h.value; }; e.prototype.entries = function() { return c(this, function(h) { return [h.key, h.value]; }); }; e.prototype.keys = function() { return c(this, function(h) { return h.key; }); }; e.prototype.values = function() { return c(this, function(h) { return h.value; }); }; e.prototype.forEach = function(h, k) { for (var l = this.entries(), m; !(m = l.next()).done;) { m = m.value, h.call(k, m[1], m[0], this); } }; e.prototype[Symbol.iterator] = e.prototype.entries; var f = 0; return e; }); H("Set", function(a) { function b(c) { this.h = new Map(); if (c) { c = C(c); for (var d; !(d = c.next()).done;) { this.add(d.value); } } this.size = this.h.size; } if (function() { if (!a || "function" != typeof a || !a.prototype.entries || "function" != typeof Object.seal) { return !1; } try { var c = Object.seal({x:4}), d = new a(C([c])); if (!d.has(c) || 1 != d.size || d.add(c) != d || 1 != d.size || d.add({x:4}) != d || 2 != d.size) { return !1; } var e = d.entries(), g = e.next(); if (g.done || g.value[0] != c || g.value[1] != c) { return !1; } g = e.next(); return g.done || g.value[0] == c || 4 != g.value[0].x || g.value[1] != g.value[0] ? !1 : e.next().done; } catch (f) { return !1; } }()) { return a; } b.prototype.add = function(c) { c = 0 === c ? 0 : c; this.h.set(c, c); this.size = this.h.size; return this; }; b.prototype.delete = function(c) { c = this.h.delete(c); this.size = this.h.size; return c; }; b.prototype.clear = function() { this.h.clear(); this.size = 0; }; b.prototype.has = function(c) { return this.h.has(c); }; b.prototype.entries = function() { return this.h.entries(); }; b.prototype.values = function() { return this.h.values(); }; b.prototype.keys = b.prototype.values; b.prototype[Symbol.iterator] = b.prototype.values; b.prototype.forEach = function(c, d) { var e = this; this.h.forEach(function(g) { return c.call(d, g, g, e); }); }; return b; }); H("Object.is", function(a) { return a ? a : function(b, c) { return b === c ? 0 !== b || 1 / b === 1 / c : b !== b && c !== c; }; }); H("Array.prototype.includes", function(a) { return a ? a : function(b, c) { var d = this; d instanceof String && (d = String(d)); var e = d.length; c = c || 0; for (0 > c && (c = Math.max(c + e, 0)); c < e; c++) { var g = d[c]; if (g === b || Object.is(g, b)) { return !0; } } return !1; }; }); H("String.prototype.includes", function(a) { return a ? a : function(b, c) { if (null == this) { throw new TypeError("The 'this' value for String.prototype.includes must not be null or undefined"); } if (b instanceof RegExp) { throw new TypeError("First argument to String.prototype.includes must not be a regular expression"); } return -1 !== this.indexOf(b, c || 0); }; }); H("Array.prototype.entries", function(a) { return a ? a : function() { return ya(this, function(b, c) { return [b, c]; }); }; }); var Aa = "function" == typeof Object.assign ? Object.assign : function(a, b) { for (var c = 1; c < arguments.length; c++) { var d = arguments[c]; if (d) { for (var e in d) { za(d, e) && (a[e] = d[e]); } } } return a; }; H("Object.assign", function(a) { return a || Aa; }); H("Array.prototype.flat", function(a) { return a ? a : function(b) { b = void 0 === b ? 1 : b; var c = []; Array.prototype.forEach.call(this, function(d) { Array.isArray(d) && 0 < b ? (d = Array.prototype.flat.call(d, b - 1), c.push.apply(c, d)) : c.push(d); }); return c; }; }); H("Promise.prototype.finally", function(a) { return a ? a : function(b) { return this.then(function(c) { return Promise.resolve(b()).then(function() { return c; }); }, function(c) { return Promise.resolve(b()).then(function() { throw c; }); }); }; }); function P(a, b, c) { var d = typeof c, e = typeof a; if ("undefined" !== d) { if ("undefined" !== e) { if (c) { if ("function" === e && d === e) { return function(g) { return a(c(g)); }; } b = a.constructor; if (b === c.constructor) { if (b === Array) { return c.concat(a); } if (b === Map) { b = new Map(c); d = C(a); for (e = d.next(); !e.done; e = d.next()) { e = e.value, b.set(e[0], e[1]); } return b; } if (b === Set) { b = new Set(c); d = C(a.values()); for (e = d.next(); !e.done; e = d.next()) { b.add(e.value); } return b; } } } return a; } return c; } return "undefined" === e ? b : a; } function Ba(a, b) { return "undefined" === typeof a ? b : a; } function S() { return Object.create(null); } function T(a) { return "string" === typeof a; } function Ca(a) { return "object" === typeof a; } function Da(a) { var b = []; a = C(a.keys()); for (var c = a.next(); !c.done; c = a.next()) { b.push(c.value); } return b; } function Ea(a, b) { if (T(b)) { a = a[b]; } else { for (var c = 0; a && c < b.length; c++) { a = a[b[c]]; } } return a; } ;var Fa = /[^\p{L}\p{N}]+/u, Ga = /(\d{3})/g, Ha = /(\D)(\d{3})/g, Ia = /(\d{3})(\D)/g, Ja = /[\u0300-\u036f]/g; function Ka(a) { a = void 0 === a ? {} : a; if (!this || this.constructor !== Ka) { var b = Function.prototype.bind, c = b.apply, d = [null], e = d.concat; if (arguments instanceof Array) { var g = arguments; } else { g = C(arguments); for (var f, h = []; !(f = g.next()).done;) { h.push(f.value); } g = h; } return new (c.call(b, Ka, e.call(d, g)))(); } if (arguments.length) { for (b = 0; b < arguments.length; b++) { this.assign(arguments[b]); } } else { this.assign(a); } } w = Ka.prototype; w.assign = function(a) { this.normalize = P(a.normalize, !0, this.normalize); var b = a.include, c = b || a.exclude || a.split; if (c || "" === c) { if ("object" === typeof c && c.constructor !== RegExp) { var d = ""; var e = !b; b || (d += "\\p{Z}"); c.letter && (d += "\\p{L}"); c.number && (d += "\\p{N}", e = !!b); c.symbol && (d += "\\p{S}"); c.punctuation && (d += "\\p{P}"); c.control && (d += "\\p{C}"); if (c = c.char) { d += "object" === typeof c ? c.join("") : c; } try { this.split = new RegExp("[" + (b ? "^" : "") + d + "]+", "u"); } catch (g) { console.error("Your split configuration:", c, "is not supported on this platform. It falls back to using simple whitespace splitter instead: /s+/."), this.split = /\s+/; } } else { this.split = c, e = !1 === c || 2 > "a1a".split(c).length; } this.numeric = P(a.numeric, e); } else { try { this.split = P(this.split, Fa); } catch (g) { console.warn("This platform does not support unicode regex. It falls back to using simple whitespace splitter instead: /s+/."), this.split = /\s+/; } this.numeric = P(a.numeric, P(this.numeric, !0)); } this.prepare = P(a.prepare, null, this.prepare); this.finalize = P(a.finalize, null, this.finalize); c = a.filter; this.filter = "function" === typeof c ? c : P(c && new Set(c), null, this.filter); this.dedupe = P(a.dedupe, !0, this.dedupe); this.matcher = P((c = a.matcher) && new Map(c), null, this.matcher); this.mapper = P((c = a.mapper) && new Map(c), null, this.mapper); this.stemmer = P((c = a.stemmer) && new Map(c), null, this.stemmer); this.replacer = P(a.replacer, null, this.replacer); this.minlength = P(a.minlength, 1, this.minlength); this.maxlength = P(a.maxlength, 1024, this.maxlength); this.rtl = P(a.rtl, !1, this.rtl); if (this.cache = c = P(a.cache, !0, this.cache)) { this.D = null, this.U = "number" === typeof c ? c : 2e5, this.B = new Map(), this.C = new Map(), this.I = this.H = 128; } this.h = ""; this.N = null; this.A = ""; this.O = null; if (this.matcher) { for (a = C(this.matcher.keys()), b = a.next(); !b.done; b = a.next()) { this.h += (this.h ? "|" : "") + b.value; } } if (this.stemmer) { for (a = C(this.stemmer.keys()), b = a.next(); !b.done; b = a.next()) { this.A += (this.A ? "|" : "") + b.value; } } return this; }; w.addStemmer = function(a, b) { this.stemmer || (this.stemmer = new Map()); this.stemmer.set(a, b); this.A += (this.A ? "|" : "") + a; this.O = null; this.cache && La(this); return this; }; w.addFilter = function(a) { "function" === typeof a ? this.filter = a : (this.filter || (this.filter = new Set()), this.filter.add(a)); this.cache && La(this); return this; }; w.addMapper = function(a, b) { if ("object" === typeof a) { return this.addReplacer(a, b); } if (1 < a.length) { return this.addMatcher(a, b); } this.mapper || (this.mapper = new Map()); this.mapper.set(a, b); this.cache && La(this); return this; }; w.addMatcher = function(a, b) { if ("object" === typeof a) { return this.addReplacer(a, b); } if (2 > a.length && (this.dedupe || this.mapper)) { return this.addMapper(a, b); } this.matcher || (this.matcher = new Map()); this.matcher.set(a, b); this.h += (this.h ? "|" : "") + a; this.N = null; this.cache && La(this); return this; }; w.addReplacer = function(a, b) { if ("string" === typeof a) { return this.addMatcher(a, b); } this.replacer || (this.replacer = []); this.replacer.push(a, b); this.cache && La(this); return this; }; w.encode = function(a, b) { var c = this; if (this.cache && a.length <= this.H) { if (this.D) { if (this.B.has(a)) { return this.B.get(a); } } else { this.D = setTimeout(La, 50, this); } } this.normalize && ("function" === typeof this.normalize ? a = this.normalize(a) : a = Ja ? a.normalize("NFKD").replace(Ja, "").toLowerCase() : a.toLowerCase()); this.prepare && (a = this.prepare(a)); this.numeric && 3 < a.length && (a = a.replace(Ha, "$1 $2").replace(Ia, "$1 $2").replace(Ga, "$1 ")); for (var d = !(this.dedupe || this.mapper || this.filter || this.matcher || this.stemmer || this.replacer), e = [], g = S(), f, h, k = this.split || "" === this.split ? a.split(this.split) : [a], l = 0, m = void 0, p = void 0; l < k.length; l++) { if ((m = p = k[l]) && !(m.length < this.minlength || m.length > this.maxlength)) { if (b) { if (g[m]) { continue; } g[m] = 1; } else { if (f === m) { continue; } f = m; } if (d) { e.push(m); } else { if (!this.filter || ("function" === typeof this.filter ? this.filter(m) : !this.filter.has(m))) { if (this.cache && m.length <= this.I) { if (this.D) { var n = this.C.get(m); if (n || "" === n) { n && e.push(n); continue; } } else { this.D = setTimeout(La, 50, this); } } if (this.stemmer) { for (this.O || (this.O = new RegExp("(?!^)(" + this.A + ")$")), n = void 0; n !== m && 2 < m.length;) { n = m, m = m.replace(this.O, function(x) { return c.stemmer.get(x); }); } } if (m && (this.mapper || this.dedupe && 1 < m.length)) { n = ""; for (var q = 0, t = "", u = void 0, v = void 0; q < m.length; q++) { u = m.charAt(q), u === t && this.dedupe || ((v = this.mapper && this.mapper.get(u)) || "" === v ? v === t && this.dedupe || !(t = v) || (n += v) : n += t = u); } m = n; } this.matcher && 1 < m.length && (this.N || (this.N = new RegExp("(" + this.h + ")", "g")), m = m.replace(this.N, function(x) { return c.matcher.get(x); })); if (m && this.replacer) { for (n = 0; m && n < this.replacer.length; n += 2) { m = m.replace(this.replacer[n], this.replacer[n + 1]); } } this.cache && p.length <= this.I && (this.C.set(p, m), this.C.size > this.U && (this.C.clear(), this.I = this.I / 1.1 | 0)); if (m) { if (m !== p) { if (b) { if (g[m]) { continue; } g[m] = 1; } else { if (h === m) { continue; } h = m; } } e.push(m); } } } } } this.finalize && (e = this.finalize(e) || e); this.cache && a.length <= this.H && (this.B.set(a, e), this.B.size > this.U && (this.B.clear(), this.H = this.H / 1.1 | 0)); return e; }; function La(a) { a.D = null; a.B.clear(); a.C.clear(); } ;function Ma(a, b, c) { c || (b || "object" !== typeof a ? "object" === typeof b && (c = b, b = 0) : c = a); c && (a = c.query || a, b = c.limit || b); var d = "" + (b || 0); if (c) { var e = c; d += (e.offset || 0) + !!e.context + !!e.suggest + (!1 !== e.resolve) + (e.resolution || this.resolution) + (e.boost || 0); } a = ("" + a).toLowerCase(); this.cache || (this.cache = new Na()); e = this.cache.get(a + d); if (!e) { var g = c && c.cache; g && (c.cache = !1); e = this.search(a, b, c); g && (c.cache = g); this.cache.set(a + d, e); } return e; } function Na(a) { this.limit = a && !0 !== a ? a : 1000; this.cache = new Map(); this.h = ""; } Na.prototype.set = function(a, b) { this.cache.set(this.h = a, b); this.cache.size > this.limit && this.cache.delete(this.cache.keys().next().value); }; Na.prototype.get = function(a) { var b = this.cache.get(a); b && this.h !== a && (this.cache.delete(a), this.cache.set(this.h = a, b)); return b; }; Na.prototype.remove = function(a) { for (var b = C(this.cache), c = b.next(); !c.done; c = b.next()) { c = c.value; var d = c[0]; c[1].includes(a) && this.cache.delete(d); } }; Na.prototype.clear = function() { this.cache.clear(); this.h = ""; }; var Oa = {normalize:!1, numeric:!1, dedupe:!1}; var Pa = {}; var Qa = new Map([["b", "p"], ["v", "f"], ["w", "f"], ["z", "s"], ["x", "s"], ["d", "t"], ["n", "m"], ["c", "k"], ["g", "k"], ["j", "k"], ["q", "k"], ["i", "e"], ["y", "e"], ["u", "o"]]); var Ra = new Map([["ae", "a"], ["oe", "o"], ["sh", "s"], ["kh", "k"], ["th", "t"], ["ph", "f"], ["pf", "f"]]), Sa = [/([^aeo])h(.)/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2", /(.)\1+/g, "$1"]; var Ta = {a:"", e:"", i:"", o:"", u:"", y:"", b:1, f:1, p:1, v:1, c:2, g:2, j:2, k:2, q:2, s:2, x:2, z:2, "\u00df":2, d:3, t:3, l:4, m:5, n:5, r:6}; var Ua = {Exact:Oa, Default:Pa, Normalize:Pa, LatinBalance:{mapper:Qa}, LatinAdvanced:{mapper:Qa, matcher:Ra, replacer:Sa}, LatinExtra:{mapper:Qa, replacer:Sa.concat([/(?!^)[aeo]/g, ""]), matcher:Ra}, LatinSoundex:{dedupe:!1, include:{letter:!0}, finalize:function(a) { for (var b = 0; b < a.length; b++) { for (var c = a[b], d = c.charAt(0), e = Ta[d], g = 1, f; g < c.length && (f = c.charAt(g), "h" === f || "w" === f || !(f = Ta[f]) || f === e || (d += f, e = f, 4 !== d.length)); g++) { } a[b] = d; } }}, CJK:{split:""}, LatinExact:Oa, LatinDefault:Pa, LatinSimple:Pa}; function Va(a, b, c, d) { for (var e = [], g = 0, f; g < a.index.length; g++) { if (f = a.index[g], b >= f.length) { b -= f.length; } else { b = f[d ? "splice" : "slice"](b, c); if (f = b.length) { if (e = e.length ? e.concat(b) : b, c -= f, d && (a.length -= f), !c) { break; } } b = 0; } } return e; } function Wa(a) { if (!this || this.constructor !== Wa) { return new Wa(a); } this.index = a ? [a] : []; this.length = a ? a.length : 0; var b = this; return new Proxy([], {get:function(c, d) { if ("length" === d) { return b.length; } if ("push" === d) { return function(e) { b.index[b.index.length - 1].push(e); b.length++; }; } if ("pop" === d) { return function() { if (b.length) { return b.length--, b.index[b.index.length - 1].pop(); } }; } if ("indexOf" === d) { return function(e) { for (var g = 0, f = 0, h, k; f < b.index.length; f++) { h = b.index[f]; k = h.indexOf(e); if (0 <= k) { return g + k; } g += h.length; } return -1; }; } if ("includes" === d) { return function(e) { for (var g = 0; g < b.index.length; g++) { if (b.index[g].includes(e)) { return !0; } } return !1; }; } if ("slice" === d) { return function(e, g) { return Va(b, e || 0, g || b.length, !1); }; } if ("splice" === d) { return function(e, g) { return Va(b, e || 0, g || b.length, !0); }; } if ("constructor" === d) { return Array; } if ("symbol" !== typeof d) { return (c = b.index[d / Math.pow(2, 31) | 0]) && c[d]; } }, set:function(c, d, e) { c = d / Math.pow(2, 31) | 0; (b.index[c] || (b.index[c] = []))[d] = e; b.length++; return !0; }}); } Wa.prototype.clear = function() { this.index.length = 0; }; Wa.prototype.destroy = function() { this.proxy = this.index = null; }; Wa.prototype.push = function() { }; function Xa(a) { a = void 0 === a ? 8 : a; if (!this || this.constructor !== Xa) { return new Xa(a); } this.index = S(); this.h = []; this.size = 0; 32 < a ? (this.A = Ya, this.B = BigInt(a)) : (this.A = Za, this.B = a); } Xa.prototype.get = function(a) { var b = this.A(a); return (b = this.index[b]) && b.get(a); }; Xa.prototype.set = function(a, b) { var c = this.A(a), d = this.index[c]; d ? (c = d.size, d.set(a, b), (c -= d.size) && this.size++) : (this.index[c] = d = new Map([[a, b]]), this.h.push(d), this.size++); }; function X(a) { a = void 0 === a ? 8 : a; if (!this || this.constructor !== X) { return new X(a); } this.index = S(); this.h = []; this.size = 0; 32 < a ? (this.A = Ya, this.B = BigInt(a)) : (this.A = Za, this.B = a); } X.prototype.add = function(a) { var b = this.A(a), c = this.index[b]; c ? (b = c.size, c.add(a), (b -= c.size) && this.size++) : (this.index[b] = c = new Set([a]), this.h.push(c), this.size++); }; w = Xa.prototype; w.has = X.prototype.has = function(a) { var b = this.A(a); return (b = this.index[b]) && b.has(a); }; w.delete = X.prototype.delete = function(a) { var b = this.A(a); (b = this.index[b]) && b.delete(a) && this.size--; }; w.clear = X.prototype.clear = function() { this.index = S(); this.h = []; this.size = 0; }; w.values = X.prototype.values = function $a() { var b, c = this, d, e, g; return ua($a, function(f) { switch(f.h) { case 1: b = 0; case 2: if (!(b < c.h.length)) { f.h = 0; break; } d = C(c.h[b].values()); e = d.next(); case 5: if (e.done) { b++; f.h = 2; break; } g = e.value; return K(f, g, 6); case 6: e = d.next(), f.h = 5; } }); }; w.keys = X.prototype.keys = function ab() { var b, c = this, d, e, g; return ua(ab, function(f) { switch(f.h) { case 1: b = 0; case 2: if (!(b < c.h.length)) { f.h = 0; break; } d = C(c.h[b].keys()); e = d.next(); case 5: if (e.done) { b++; f.h = 2; break; } g = e.value; return K(f, g, 6); case 6: e = d.next(), f.h = 5; } }); }; w.entries = X.prototype.entries = function bb() { var b, c = this, d, e, g; return ua(bb, function(f) { switch(f.h) { case 1: b = 0; case 2: if (!(b < c.h.length)) { f.h = 0; break; } d = C(c.h[b].entries()); e = d.next(); case 5: if (e.done) { b++; f.h = 2; break; } g = e.value; return K(f, g, 6); case 6: e = d.next(), f.h = 5; } }); }; function Za(a) { var b = Math.pow(2, this.B) - 1; if ("number" == typeof a) { return a & b; } for (var c = 0, d = this.B + 1, e = 0; e < a.length; e++) { c = (c * d ^ a.charCodeAt(e)) & b; } return 32 === this.B ? c + Math.pow(2, 31) : c; } function Ya() { throw Error("The keystore is limited to 32 for EcmaScript5"); } ;var cb, db; function eb(a) { var b, c, d, e, g, f; return wa(function(h) { switch(h.h) { case 1: a = a.data; b = a.task; c = a.id; d = a.args; switch(b) { case "init": db = a.options || {}; (e = a.factory) ? (Function("return " + e)()(self), cb = new self.FlexSearch.Index(db), delete self.FlexSearch) : cb = new Y(db); postMessage({id:c}); break; default: h.h = 2; return; }h.h = 0; break; case 2: if ("export" === b) { if (!db.export || "function" !== typeof db.export) { throw Error('Either no extern configuration provided for the Worker-Index or no method was defined on the config property "export".'); } d[1] ? (d[0] = db.export, d[2] = 0, d[3] = 1) : d = null; } if ("import" === b) { if (!db.import || "function" !== typeof db.import) { throw Error('Either no extern configuration provided for the Worker-Index or no method was defined on the config property "import".'); } if (!d[0]) { h.h = 5; break; } return K(h, db.import.call(cb, d[0]), 11); } g = d && cb[b].apply(cb, d); if (!g || !g.then) { h.h = 6; break; } return K(h, g, 7); case 7: g = h.B; case 6: if (!g || !g.await) { h.h = 8; break; } return K(h, g.await, 9); case 9: g = h.B; case 8: "search" === b && g.result && (g = g.result); h.h = 5; break; case 11: f = h.B, cb.import(d[0], f); case 5: postMessage("search" === b ? {id:c, msg:g} : {id:c}), h.h = 0; } }); } ;function fb(a) { gb.call(a, "add"); gb.call(a, "append"); gb.call(a, "search"); gb.call(a, "update"); gb.call(a, "remove"); gb.call(a, "searchCache"); } var hb, ib, jb; function kb() { hb = jb = 0; } function gb(a) { this[a + "Async"] = function() { var b = arguments, c = b[b.length - 1]; if ("function" === typeof c) { var d = c; delete b[b.length - 1]; } hb ? jb || (jb = Date.now() - ib >= this.priority * this.priority * 3) : (hb = setTimeout(kb, 0), ib = Date.now()); if (jb) { var e = this; return new Promise(function(f) { setTimeout(function() { f(e[a + "Async"].apply(e, b)); }, 0); }); } var g = this[a].apply(this, b); c = g.then ? g : new Promise(function(f) { return f(g); }); d && c.then(d); return c; }; } ;var lb = 0; function mb(a, b) { function c(h) { function k(l) { l = l.data || l; var m = l.id, p = m && g.h[m]; p && (p(l.msg), delete g.h[m]); } this.worker = h; this.h = S(); if (this.worker) { e ? this.worker.on("message", k) : this.worker.onmessage = k; if (a.config) { return new Promise(function(l) { 1e9 < lb && (lb = 0); g.h[++lb] = function() { l(g); }; g.worker.postMessage({id:lb, task:"init", factory:d, options:a}); }); } this.priority = a.priority || 4; this.encoder = b || null; this.worker.postMessage({task:"init", factory:d, options:a}); return this; } console.warn("Worker is not available on this platform. Please report on Github: https://github.com/nextapps-de/flexsearch/issues"); } a = void 0 === a ? {} : a; if (!this || this.constructor !== mb) { return new mb(a); } var d = "undefined" !== typeof self ? self._factory : "undefined" !== typeof window ? window._factory : null; d && (d = d.toString()); var e = "undefined" === typeof window, g = this, f = nb(d, e, a.worker); return f.then ? f.then(function(h) { return c.call(g, h); }) : c.call(this, f); } ob("add"); ob("append"); ob("search"); ob("update"); ob("remove"); ob("clear"); ob("export"); ob("import"); mb.prototype.searchCache = Ma; fb(mb.prototype); function ob(a) { mb.prototype[a] = function() { var b = this, c = [].slice.call(arguments), d = c[c.length - 1]; if ("function" === typeof d) { var e = d; c.pop(); } d = new Promise(function(g) { "export" === a && "function" === typeof c[0] && (c[0] = null); 1e9 < lb && (lb = 0); b.h[++lb] = g; b.worker.postMessage({task:a, id:lb, args:c}); }); return e ? (d.then(e), this) : d; }; } function nb(a, b, c) { return b ? "undefined" !== typeof module ? new(require("worker_threads")["Worker"])(__dirname+"/node/node.js") : import("worker_threads").then(function(worker){return new worker["Worker"]((1,eval)("import.meta.dirname")+"/node/node.mjs")}) : a ? new window.Worker(URL.createObjectURL(new Blob(["onmessage=" + eb.toString()], {type:"text/javascript"}))) : new window.Worker("string" === typeof c ? c : (0,eval)("import.meta.url").replace("/worker.js", "/worker/worker.js").replace("flexsearch.bundle.module.min.js", "module/worker/worker.js"), {type:"module"}); } ;pb.prototype.add = function(a, b, c) { Ca(a) && (b = a, a = Ea(b, this.key)); if (b && (a || 0 === a)) { if (!c && this.reg.has(a)) { return this.update(a, b); } for (var d = 0, e; d < this.field.length; d++) { e = this.M[d]; var g = this.index.get(this.field[d]); if ("function" === typeof e) { (e = e(b)) && g.add(a, e, !1, !0); } else { var f = e.S; if (!f || f(b)) { e.constructor === String ? e = ["" + e] : T(e) && (e = [e]), qb(b, e, this.T, 0, g, a, e[0], c); } } } if (this.tag) { for (d = 0; d < this.L.length; d++) { f = this.L[d]; var h = this.ba[d]; g = this.tag.get(h); e = S(); if ("function" === typeof f) { if (f = f(b), !f) { continue; } } else { var k = f.S; if (k && !k(b)) { continue; } f.constructor === String && (f = "" + f); f = Ea(b, f); } if (g && f) { for (T(f) && (f = [f]), h = 0, k = void 0; h < f.length; h++) { var l = f[h]; if (!e[l]) { e[l] = 1; var m; (m = g.get(l)) ? k = m : g.set(l, k = []); if (!c || !k.includes(a)) { if (k.length === Math.pow(2, 31) - 1) { m = new Wa(k); if (this.fastupdate) { for (var p = C(this.reg.values()), n = p.next(); !n.done; n = p.next()) { n = n.value, n.includes(k) && (n[n.indexOf(k)] = m); } } g.set(l, k = m); } k.push(a); this.fastupdate && ((l = this.reg.get(a)) ? l.push(k) : this.reg.set(a, [k])); } } } } else { g || console.warn("Tag '" + h + "' was not found"); } } } if (this.store && (!c || !this.store.has(a))) { if (this.J) { var q = S(); for (c = 0; c < this.J.length; c++) { if (d = this.J[c], g = d.S, !g || g(b)) { g = void 0; if ("function" === typeof d) { g = d(b); if (!g) { continue; } d = [d.na]; } else if (T(d) || d.constructor === String) { q[d] = b[d]; continue; } rb(b, q, d, 0, d[0], g); } } } this.store.set(a, q || b); } this.worker && (this.fastupdate || this.reg.add(a)); } return this; }; function rb(a, b, c, d, e, g) { a = a[e]; if (d === c.length - 1) { b[e] = g || a; } else if (a) { if (a.constructor === Array) { for (b = b[e] = Array(a.length), e = 0; e < a.length; e++) { rb(a, b, c, d, e); } } else { b = b[e] || (b[e] = S()), e = c[++d], rb(a, b, c, d, e); } } } function qb(a, b, c, d, e, g, f, h) { if (a = a[f]) { if (d === b.length - 1) { if (a.constructor === Array) { if (c[d]) { for (b = 0; b < a.length; b++) { e.add(g, a[b], !0, !0); } return; } a = a.join(" "); } e.add(g, a, h, !0); } else { if (a.constructor === Array) { for (f = 0; f < a.length; f++) { qb(a, b, c, d, e, g, f, h); } } else { f = b[++d], qb(a, b, c, d, e, g, f, h); } } } else { e.db && e.remove(g); } } ;function sb(a, b, c, d) { if (!a.length) { return a; } if (1 === a.length) { return a = a[0], a = c || a.length > b ? a.slice(c, c + b) : a, d ? tb.call(this, a) : a; } for (var e = [], g = 0, f = void 0, h = void 0; g < a.length; g++) { if ((f = a[g]) && (h = f.length)) { if (c) { if (c >= h) { c -= h; continue; } f = f.slice(c, c + b); h = f.length; c = 0; } h > b && (f = f.slice(0, b), h = b); if (!e.length && h >= b) { return d ? tb.call(this, f) : f; } e.push(f); b -= h; if (!b) { break; } } } e = 1 < e.length ? [].concat.apply([], e) : e[0]; return d ? tb.call(this, e) : e; } ;function ub(a, b, c, d) { var e = d[0]; if (e[0] && e[0].query) { return a[b].apply(a, e); } if (!("and" !== b && "not" !== b || a.result.length || a.await || e.suggest)) { return 1 < d.length && (e = d[d.length - 1]), (d = e.resolve) ? a.await || a.result : a; } var g = [], f = 0, h = 0, k; b = {}; for (e = 0; e < d.length; b = {aa:void 0, $:void 0, ca:void 0, fa:void 0}, e++) { var l = d[e]; if (l) { var m = void 0; if (l.constructor === Z) { m = l.await || l.result; } else if (l.then || l.constructor === Array) { m = l; } else { f = l.limit || 0; h = l.offset || 0; var p = l.suggest; var n = l.resolve; var q = (k = l.highlight && n) || l.enrich && n; m = l.queue; b.ca = l.async || m; (k = l.index) ? a.index || (a.index = k) : k = a.index; if (l.query || l.tag) { if (!a.index) { throw Error("Resolver can't apply because the corresponding Index was never specified"); } var t = l.field || l.pluck; if (t) { if (!a.index.index) { throw Error("Resolver can't apply because the corresponding Document Index was not specified"); } k = a.index.index.get(t); if (!k) { throw Error("Resolver can't apply because the specified Document Field '" + t + "' was not found"); } } if (m && (u || a.await)) { var u = 1; b.aa = void 0; b.fa = a.G.length; b.$ = new Promise(function(x) { return function(y) { x.aa = y; }; }(b)); (function(x) { return function(y, E) { x.$.H = function() { E.index = null; E.resolve = !1; var B = x.ca ? y.searchAsync(E) : y.search(E); if (B.then) { return B.then(function(r) { a.G[x.fa] = r = r.result || r; (0,x.aa)(r); return r; }); } B = B.result || B; (0,x.aa)(B); return B; }; }; })(b)(k, Object.assign({}, l)); a.G.push(b.$); g[e] = b.$; continue; } else { l.resolve = !1, l.index = null, m = b.ca ? k.searchAsync(l) : k.search(l), l.resolve = n, l.index = k; } } else if (l.and) { m = vb(l, "and", k); } else if (l.or) { m = vb(l, "or", k); } else if (l.not) { m = vb(l, "not", k); } else if (l.xor) { m = vb(l, "xor", k); } else { continue; } } m.await ? (u = 1, m = m.await) : m.then ? (u = 1, m = m.then(function(x) { return x.result || x; })) : m = m.result || m; g[e] = m; } } u && !a.await && (a.await = new Promise(function(x) { a.return = x; })); if (u) { var v = Promise.all(g).then(function(x) { for (var y = 0; y < a.G.length; y++) { if (a.G[y] === v) { a.G[y] = function() { return c.call(a, x, f, h, q, n, p); }; break; } } wb(a); }); a.G.push(v); } else if (a.await) { a.G.push(function() { return c.call(a, g, f, h, q, n, p); }); } else { return c.call(a, g, f, h, q, n, p); } return n ? a.await || a.result : a; } function vb(a, b, c) { a = a[b]; var d = a[0] || a; d.index || (d.index = c); c = new Z(d); 1 < a.length && (c = c[b].apply(c, a.slice(1))); return c; } ;Z.prototype.or = function() { return ub(this, "or", xb, arguments); }; function xb(a, b, c, d, e) { a.length && (this.result.length && a.push(this.result), 2 > a.length ? this.result = a[0] : (this.result = yb(a, b, c, !1, this.h), c = 0)); e && (this.await = null); return e ? this.resolve(b, c, d) : this; } ;Z.prototype.and = function() { return ub(this, "and", zb, arguments); }; function zb(a, b, c, d, e, g) { if (!g && !this.result.length) { return e ? this.result : this; } if (a.length) { if (this.result.length && a.unshift(this.result), 2 > a.length) { this.result = a[0]; } else { for (var f = 0, h = 0, k = void 0, l = void 0; h < a.length; h++) { if ((k = a[h]) && (l = k.length)) { f < l && (f = l); } else if (!g) { f = 0; break; } } if (f) { this.result = Ab(a, f, b, c, g, this.h, e); var m = !0; } else { this.result = []; } } } else { g || (this.result = a); } e && (this.await = null); return e ? this.resolve(b, c, d, m) : this; } ;Z.prototype.xor = function() { return ub(this, "xor", Bb, arguments); }; function Bb(a, b, c, d, e, g) { if (a.length) { if (this.result.length && a.unshift(this.result), 2 > a.length) { this.result = a[0]; } else { a: { g = c; var f = this.h; for (var h = [], k = S(), l = 0, m = 0, p; m < a.length; m++) { if (p = a[m]) { l < p.length && (l = p.length); for (var n = 0, q; n < p.length; n++) { if (q = p[n]) { for (var t = 0, u; t < q.length; t++) { u = q[t], k[u] = k[u] ? 2 : 1; } } } } } for (p = m = 0; m < l; m++) { for (n = 0; n < a.length; n++) { if (q = a[n]) { if (q = q[m]) { for (t = 0; t < q.length; t++) { if (u = q[t], 1 === k[u]) { if (g) { g--; } else { if (e) { if (h.push(u), h.length === b) { a = h; break a; } } else { var v = m + (n ? f : 0); h[v] || (h[v] = []); h[v].push(u); if (++p === b) { a = h; break a; } } } } } } } } } a = h; } this.result = a; f = !0; } } else { g || (this.result = a); } e && (this.await = null); return e ? this.resolve(b, c, d, f) : this; } ;Z.prototype.not = function() { return ub(this, "not", Cb, arguments); }; function Cb(a, b, c, d, e, g) { if (!g && !this.result.length) { return e ? this.result : this; } if (a.length && this.result.length) { a: { g = c; var f = []; a = new Set(a.flat().flat()); for (var h = 0, k, l = 0; h < this.result.length; h++) { if (k = this.result[h]) { for (var m = 0, p; m < k.length; m++) { if (p = k[m], !a.has(p)) { if (g) { g--; } else { if (e) { if (f.push(p), f.length === b) { g = f; break a; } } else { if (f[h] || (f[h] = []), f[h].push(p), ++l === b) { g = f; break a; } } } } } } } g = f; } this.result = g; f = !0; } e && (this.await = null); return e ? this.resolve(b, c, d, f) : this; } ;function Z(a, b) { if (!this || this.constructor !== Z) { return new Z(a, b); } var c = 0, d; if (a && a.index) { var e = a; b = e.index; c = e.boost || 0; if (e.query) { var g = e.resolve; a = e.async || e.queue; e.resolve = !1; e.index = null; a = a ? b.searchAsync(e) : b.search(e); e.resolve = g; e.index = b; a = a.result || a; } else { a = []; } } if (a && a.then) { var f = this; a = a.then(function(l) { f.G[0] = f.result = l.result || l; wb(f); }); var h = [a]; a = []; var k = new Promise(function(l) { d = l; }); } this.index = b || null; this.result = a || []; this.h = c; this.G = h || []; this.await = k || null; this.return = d || null; } Z.prototype.limit = function(a) { if (this.result.length) { for (var b = [], c = 0, d; c < this.result.length; c++) { if (d = this.result[c]) { if (d.length <= a) { if (b[c] = d, a -= d.length, !a) { break; } } else { b[c] = d.slice(0, a); break; } } } this.result = b; } return this; }; Z.prototype.offset = function(a) { if (this.result.length) { for (var b = [], c = 0, d; c < this.result.length; c++) { if (d = this.result[c]) { d.length <= a ? a -= d.length : (b[c] = d.slice(a), a = 0); } } this.result = b; } return this; }; Z.prototype.boost = function(a) { this.h += a; return this; }; function wb(a, b) { for (var c = a.result, d = 0, e; d < a.G.length; d++) { if (e = a.G[d]) { if ("function" === typeof e) { c = e(), a.G[d] = c = c.result || c, d--; } else if (e.H) { c = e.H(), a.G[d] = c = c.result || c, d--; } else if (e.then) { return a.await; } } } d = a.return; a.result = c; a.G = []; a.await = null; a.return = null; b || d(c); return c; } Z.prototype.resolve = function(a, b, c, d) { var e = this.await ? wb(this, !0) : this.result; if (e.then) { var g = this; return e.then(function() { return g.resolve(a, b, c); }); } e.length && ("object" === typeof a && (c = a.enrich, b = a.offset, a.highlight && console.warn('Highlighting results is not supported within the resolve() method. Instead pass highlight options within the last resolver stage like { query: "...", resolve: true, highlight: ... }.'), a = a.limit), e = d ? c ? tb.call(this.index, e) : e : sb.call(this.index, e, a || 100, b, c)); d = this.return; this.return = this.await = this.G = this.result = this.index = null; d && d(e); return e; }; function Ab(a, b, c, d, e, g, f) { var h = a.length, k = []; var l = S(); for (var m = 0, p = void 0, n, q; m < b; m++) { for (var t = 0; t < h; t++) { var u = a[t]; if (m < u.length && (p = u[m])) { for (var v = 0; v < p.length; v++) { n = p[v]; (u = l[n]) ? l[n]++ : (u = 0, l[n] = 1); q = k[u] || (k[u] = []); if (!f) { var x = m + (t || !e ? 0 : g || 0); q = q[x] || (q[x] = []); } q.push(n); if (f && c && u === h - 1 && q.length - d === c) { return d ? q.slice(d) : q; } } } } } if (a = k.length) { if (e) { k = 1 < k.length ? yb(k, c, d, f, g) : (k = k[0]) && c && k.length > c || d ? k.slice(d, c + d) : k; } else { if (a < h) { return []; } k = k[a - 1]; if (c || d) { if (f) { if (k.length > c || d) { k = k.slice(d, c + d); } } else { e = []; for (g = 0; g < k.length; g++) { if (f = k[g]) { if (d && f.length > d) { d -= f.length; } else { if (c && f.length > c || d) { f = f.slice(d, c + d), c -= f.length, d && (d -= f.length); } e.push(f); if (!c) { break; } } } } k = e; } } } } return k; } function yb(a, b, c, d, e) { var g = [], f = S(), h = a.length, k; if (d) { for (e = h - 1; 0 <= e; e--) { if (k = (d = a[e]) && d.length) { for (h = 0; h < k; h++) { var l = d[h]; if (!f[l]) { if (f[l] = 1, c) { c--; } else { if (g.push(l), g.length === b) { return g; } } } } } } } else { for (var m = h - 1, p, n = 0; 0 <= m; m--) { p = a[m]; for (var q = 0; q < p.length; q++) { if (k = (d = p[q]) && d.length) { for (var t = 0; t < k; t++) { if (l = d[t], !f[l]) { if (f[l] = 1, c) { c--; } else { var u = (q + (m < h - 1 ? e || 0 : 0)) / (m + 1) | 0; (g[u] || (g[u] = [])).push(l); if (++n === b) { return g; } } } } } } } } return g; } function Db(a, b, c) { for (var d = S(), e = [], g = 0, f; g < b.length; g++) { f = b[g]; for (var h = 0; h < f.length; h++) { d[f[h]] = 1; } } if (c) { for (b = 0; b < a.length; b++) { c = a[b], d[c] && (e.push(c), d[c] = 0); } } else { for (b = 0; b < a.result.length; b++) { for (c = a.result[b], f = 0; f < c.length; f++) { g = c[f], d[g] && ((e[b] || (e[b] = [])).push(g), d[g] = 0); } } } return e; } ;S(); function Eb(a, b, c, d, e) { if ("string" === typeof e) { var g = e; e = ""; } else { g = e.template; } if (!g) { throw Error('No template pattern was specified by the search option "highlight"'); } var f = g.indexOf("$1"); if (-1 === f) { throw Error('Invalid highlight template. The replacement pattern "$1" was not found in template: ' + g); } var h = g.substring(f + 2); f = g.substring(0, f); var k = e && e.boundary, l = !e || !1 !== e.clip, m = e && e.merge && h && f && new RegExp(h + " " + f, "g"); e = e && e.ellipsis; var p = 0; if ("object" === typeof e) { var n = e.template; p = n.length - 2; e = e.pattern; } "string" !== typeof e && (e = !1 === e ? "" : "..."); p && (e = n.replace("$1", e)); n = e.length - p; if ("object" === typeof k) { var q = k.before; 0 === q && (q = -1); var t = k.after; 0 === t && (t = -1); k = k.total || 9e5; } p = new Map(); for (var u, v = 0, x, y; v < b.length; v++) { if (d) { var E = b; y = d; } else { E = b[v]; y = E.field; if (!y) { continue; } E = E.result; } u = c.get(y); x = u.encoder; u = p.get(x); "string" !== typeof u && (u = x.encode(a), p.set(x, u)); for (var B = 0; B < E.length; B++) { var r = E[B].doc; if (r && (r = Ea(r, y))) { var A = r.trim().split(/\s+/); if (A.length) { r = ""; for (var F = [], U = [], G = -1, N = -1, Q = 0, D = 0; D < A.length; D++) { var R = A[D], W = x.encode(R); W = 1 < W.length ? W.join(" ") : W[0]; var O = void 0; if (W && R) { for (var L = R.length, M = (x.split ? R.replace(x.split, "") : R).length - W.length, ba = "", oa = 0, z = 0; z < u.length; z++) { var I = u[z]; if (I) { var J = I.length; J += M; oa && J <= oa || (I = W.indexOf(I), -1 < I && (ba = (I ? R.substring(0, I) : "") + f + R.substring(I, I + J) + h + (I + J < L ? R.substring(I + J) : ""), oa = J, O = !0)); } } ba && (k && (0 > G && (G = r.length + (r ? 1 : 0)), N = r.length + (r ? 1 : 0) + ba.length, Q += L, U.push(F.length), F.push({match:ba})), r += (r ? " " : "") + ba); } if (!O) { R = A[D], r += (r ? " " : "") + R, k && F.push({text:R}); } else if (k && Q >= k) { break; } } Q = U.length * (g.length - 2); if (q || t || k && r.length - Q > k) { if (Q = k + Q - 2 * n, D = N - G, 0 < q && (D += q), 0 < t && (D += t), D <= Q) { A = q ? G - (0 < q ? q : 0) : G - ((Q - D) / 2 | 0), F = t ? N + (0 < t ? t : 0) : A + Q, l || (0 < A && " " !== r.charAt(A) && " " !== r.charAt(A - 1) && (A = r.indexOf(" ", A), 0 > A && (A = 0)), F < r.length && " " !== r.charAt(F - 1) && " " !== r.charAt(F) && (F = r.lastIndexOf(" ", F), F < N ? F = N : ++F)), r = (A ? e : "") + r.substring(A, F) + (F < r.length ? e : ""); } else { N = []; Q = {}; G = {}; D = {}; R = {}; W = {}; M = L = O = 0; for (oa = ba = 1;;) { I = void 0; for (z = 0; z < U.length; z++) { J = U[z]; if (M) { if (L !== M) { if (D[z + 1]) { continue; } J += M; if (Q[J]) { O -= n; G[z + 1] = 1; D[z + 1] = 1; continue; } if (J >= F.length - 1) { if (J >= F.length) { D[z + 1] = 1; J >= A.length && (G[z + 1] = 1); continue; } O -= n; } r = F[J].text; var V = t && W[z]; if (V) { if (0 < V) { if (r.length > V) { if (D[z + 1] = 1, l) { r = r.substring(0, V); } else { continue; } } (V -= r.length) || (V = -1); W[z] = V; } else { D[z + 1] = 1; continue; } } if (O + r.length + 1 <= k) { r = " " + r, N[z] += r; } else if (l) { I = k - O - 1, 0 < I && (r = " " + r.substring(0, I), N[z] += r), D[z + 1] = 1; } else { D[z + 1] = 1; continue; } } else { if (D[z]) { continue; } J -= L; if (Q[J]) { O -= n; D[z] = 1; G[z] = 1; continue; } if (0 >= J) { if (0 > J) { D[z] = 1; G[z] = 1; continue; } O -= n; } r = F[J].text; if (V = q && R[z]) { if (0 < V) { if (r.length > V) { if (D[z] = 1, l) { r = r.substring(r.length - V); } else { continue; } } (V -= r.length) || (V = -1); R[z] = V; } else { D[z] = 1; continue; } } if (O + r.length + 1 <= k) { r += " ", N[z] = r + N[z]; } else if (l) { I = r.length + 1 - (k - O), 0 <= I && I < r.length && (r = r.substring(I) + " ", N[z] = r + N[z]), D[z] = 1; } else { D[z] = 1; continue; } } } else { r = F[J].match; q && (R[z] = q); t && (W[z] = t); z && O++; I = void 0; J ? !z && n && (O += n) : (G[z] = 1, D[z] = 1); J >= A.length - 1 ? I = 1 : J < F.length - 1 && F[J + 1].match ? I = 1 : n && (O += n); O -= g.length - 2; if (!z || O + r.length <= k) { N[z] = r; } else { I = ba = oa = G[z] = 0; break; } I && (G[z + 1] = 1, D[z + 1] = 1); } O += r.length; I = Q[J] = 1; } if (I) { L === M ? M++ : L++; } else { L === M ? ba = 0 : oa = 0; if (!ba && !oa) { break; } ba ? (L++, M = L) : M++; } } r = ""; for (A = 0; A < N.length; A++) { F = (A && G[A] ? " " : (A && !e ? " " : "") + e) + N[A], r += F; } e && !G[N.length] && (r += e); } } m && (r = r.replace(m, " ")); E[B].highlight = r; } } } if (d) { break; } } return b; } ;pb.prototype.search = function(a, b, c, d) { c || (!b && Ca(a) ? (c = a, a = "") : Ca(b) && (c = b, b = 0)); var e = [], g = [], f = 0, h = !0; if (c) { c.constructor === Array && (c = {index:c}); a = c.query || a; var k = c.pluck; var l = c.merge; var m = c.boost; var p = k || c.field || (p = c.index) && (p.index ? null : p); var n = this.tag && c.tag; var q = c.suggest; h = !1 !== c.resolve; var t = c.cache; this.store && c.highlight && !h ? console.warn("Highlighting results can only be done on a final resolver task or when calling .resolve({ highlight: ... })") : this.store && c.enrich && !h && console.warn("Enrich results can only be done on a final resolver task or when calling .resolve({ enrich: true })"); var u = h && this.store && c.highlight; var v = !!u || h && this.store && c.enrich; b = c.limit || b; var x = c.offset || 0; b || (b = h ? 100 : 0); if (n && (!this.db || !d)) { n.constructor !== Array && (n = [n]); for (var y = [], E = 0, B = void 0; E < n.length; E++) { B = n[E]; if (T(B)) { throw Error("A tag option can't be a string, instead it needs a { field: tag } format."); } if (B.field && B.tag) { var r = B.tag; if (r.constructor === Array) { for (var A = 0; A < r.length; A++) { y.push(B.field, r[A]); } } else { y.push(B.field, r); } } else { r = Object.keys(B); A = 0; for (var F = void 0, U = void 0; A < r.length; A++) { if (F = r[A], U = B[F], U.constructor === Array) { for (var G = 0; G < U.length; G++) { y.push(F, U[G]); } } else { y.push(F, U); } } } } if (!y.length) { throw Error("Your tag definition within the search options is probably wrong. No valid tags found."); } n = y; if (!a) { g = []; if (y.length) { for (n = 0; n < y.length; n += 2) { d = void 0; if (this.db) { d = this.index.get(y[n]); if (!d) { console.warn("Tag '" + y[n] + ":" + y[n + 1] + "' will be skipped because there is no field '" + y[n] + "'."); continue; } g.push(d = d.db.tag(y[n + 1], b, x, v)); } else { d = Fb.call(this, y[n], y[n + 1], b, x, v); } e.push(h ? {field:y[n], tag:y[n + 1], result:d} : [d]); } } if (g.length) { var N = this; return Promise.all(g).then(function(L) { for (var M = 0; M < L.length; M++) { h ? e[M].result = L[M] : e[M] = L[M]; } return h ? e : new Z(1 < e.length ? Ab(e, 1, 0, 0, q, m) : e[0], N); }); } return h ? e : new Z(1 < e.length ? Ab(e, 1, 0, 0, q, m) : e[0], this); } } if (!h && !k) { if (p = p || this.field) { T(p) ? k = p : (p.constructor === Array && 1 === p.length && (p = p[0]), k = p.field || p.index); } if (!k) { throw Error("Apply resolver on document search requires either the option 'pluck' to be set or just select a single field name in your query."); } } p && p.constructor !== Array && (p = [p]); } p || (p = this.field); y = (this.worker || this.db) && !d && []; E = 0; for (A = B = r = void 0; E < p.length; E++) { if (B = p[E], !this.db || !this.tag || this.M[E]) { r = void 0; T(B) || (r = B, B = r.field, a = r.query || a, b = Ba(r.limit, b), x = Ba(r.offset, x), q = Ba(r.suggest, q), u = h && this.store && Ba(r.highlight, u), v = !!u || h && this.store && Ba(r.enrich, v), t = Ba(r.cache, t)); if (d) { r = d[E]; } else { A = r || c || {}; F = A.enrich; r = this.index.get(B); if (n) { if (this.db) { A.tag = n; var Q = r.db.support_tag_search; A.field = p; } !Q && F && (A.enrich = !1); } r = t ? r.searchCache(a, b, A) : r.search(a, b, A); F && (A.enrich = F); if (y) { y[E] = r; continue; } } A = (r = r.result || r) && r.length; if (n && A) { F = []; U = 0; if (this.db && d) { if (!Q) { for (G = p.length; G < d.length; G++) { var D = d[G]; if (D && D.length) { U++, F.push(D); } else if (!q) { return h ? e : new Z(e, this); } } } } else { G = 0; for (var R = D = void 0; G < n.length; G += 2) { D = this.tag.get(n[G]); if (!D) { if (console.warn("Tag '" + n[G] + ":" + n[G + 1] + "' will be skipped because there is no field '" + n[G] + "'."), q) { continue; } else { return h ? e : new Z(e, this); } } if (R = (D = D && D.get(n[G + 1])) && D.length) { U++, F.push(D); } else if (!q) { return h ? e : new Z(e, this); } } } if (U) { r = Db(r, F, h); A = r.length; if (!A && !q) { return h ? r : new Z(r, this); } U--; } } if (A) { g[f] = B, e.push(r), f++; } else if (1 === p.length) { return h ? e : new Z(e, this); } } } if (y) { if (this.db && n && n.length && !Q) { for (v = 0; v < n.length; v += 2) { g = this.index.get(n[v]); if (!g) { if (console.warn("Tag '" + n[v] + ":" + n[v + 1] + "' was not found because there is no field '" + n[v] + "'."), q) { continue; } else { return h ? e : new Z(e, this); } } y.push(g.db.tag(n[v + 1], b, x, !1)); } } var W = this; return Promise.all(y).then(function(L) { c && (c.resolve = h); L.length && (L = W.search(a, b, c, L)); return L; }); } if (!f) { return h ? e : new Z(e, this); } if (k && (!v || !this.store)) { return e = e[0], h ? e : new Z(e, this); } y = []; for (x = 0; x < g.length; x++) { n = e[x]; v && n.length && "undefined" === typeof n[0].doc && (this.db ? y.push(n = this.index.get(this.field[0]).db.enrich(n)) : n = tb.call(this, n)); if (k) { return h ? u ? Eb(a, n, this.index, k, u) : n : new Z(n, this); } e[x] = {field:g[x], result:n}; } if (v && this.db && y.length) { var O = this; return Promise.all(y).then(function(L) { for (var M = 0; M < L.length; M++) { e[M].result = L[M]; } u && (e = Eb(a, e, O.index, k, u)); return l ? Gb(e) : e; }); } u && (e = Eb(a, e, this.index, k, u)); return l ? Gb(e) : e; }; function Gb(a) { for (var b = [], c = S(), d = S(), e = 0, g, f, h = void 0, k, l, m; e < a.length; e++) { g = a[e]; f = g.field; g = g.result; for (var p = 0; p < g.length; p++) { if (k = g[p], "object" !== typeof k ? k = {id:h = k} : h = k.id, (l = c[h]) ? l.push(f) : (k.field = c[h] = [f], b.push(k)), m = k.highlight) { l = d[h], l || (d[h] = l = {}, k.highlight = l), l[f] = m; } } } return b; } function Fb(a, b, c, d, e) { a = this.tag.get(a); if (!a) { return []; } a = a.get(b); if (!a) { return []; } b = a.length - d; if (0 < b) { if (c && b > c || d) { a = a.slice(d, d + c); } e && (a = tb.call(this, a)); } return a; } function tb(a) { if (!this || !this.store) { return a; } if (this.db) { return this.index.get(this.field[0]).db.enrich(a); } for (var b = Array(a.length), c = 0, d; c < a.length; c++) { d = a[c], b[c] = {id:d, doc:this.store.get(d)}; } return b; } ;function pb(a) { if (!this || this.constructor !== pb) { return new pb(a); } var b = a.document || a.doc || a, c, d; this.M = []; this.field = []; this.T = []; this.key = (c = b.key || b.id) && Hb(c, this.T) || "id"; (d = a.keystore || 0) && (this.keystore = d); this.fastupdate = !!a.fastupdate; this.reg = !this.fastupdate || a.worker || a.db ? d ? new X(d) : new Set() : d ? new Xa(d) : new Map(); this.J = (c = b.store || null) && c && !0 !== c && []; this.store = c && (d ? new Xa(d) : new Map()); this.cache = (c = a.cache || null) && new Na(c); a.cache = !1; this.worker = a.worker || !1; this.priority = a.priority || 4; this.index = Ib.call(this, a, b); this.tag = null; if (c = b.tag) { if ("string" === typeof c && (c = [c]), c.length) { this.tag = new Map(); this.L = []; this.ba = []; b = 0; for (var e = d = void 0; b < c.length; b++) { d = c[b]; e = d.field || d; if (!e) { throw Error("The tag field from the document descriptor is undefined."); } d.custom ? this.L[b] = d.custom : (this.L[b] = Hb(e, this.T), d.filter && ("string" === typeof this.L[b] && (this.L[b] = new String(this.L[b])), this.L[b].S = d.filter)); this.ba[b] = e; this.tag.set(e, new Map()); } } } if (this.worker) { this.fastupdate = !1; a = []; c = C(this.index.values()); for (b = c.next(); !b.done; b = c.next()) { b = b.value, b.then && a.push(b); } if (a.length) { var g = this; return Promise.all(a).then(function(f) { for (var h = 0, k = C(g.index.entries()), l = k.next(); !l.done; l = k.next()) { var m = l.value; l = m[0]; m = m[1]; m.then && (m = f[h], g.index.set(l, m), h++); } return g; }); } } else { a.db && (this.fastupdate = !1, this.mount(a.db)); } } w = pb.prototype; w.mount = function(a) { if (this.worker) { throw Error("You can't use Worker-Indexes on a persistent model. That would be useless, since each of the persistent model acts like Worker-Index by default (Master/Slave)."); } var b = this.field; if (this.tag) { for (var c = 0, d = void 0; c < this.ba.length; c++) { d = this.ba[c]; var e = void 0; this.index.set(d, e = new Y({}, this.reg)); b === this.field && (b = b.slice(0)); b.push(d); e.tag = this.tag.get(d); } } c = []; d = {db:a.db, type:a.type, fastupdate:a.fastupdate}; e = 0; var g = void 0; for (g = void 0; e < b.length; e++) { d.field = g = b[e]; g = this.index.get(g); var f = new a.constructor(a.id, d); f.id = a.id; c[e] = f.mount(g); g.document = !0; e ? g.bypass = !0 : g.store = this.store; } var h = this; return this.db = Promise.all(c).then(function() { h.db = !0; }); }; w.commit = function(a, b) { var c = this, d, e, g, f; return wa(function(h) { if (1 == h.h) { d = []; e = C(c.index.values()); for (g = e.next(); !g.done; g = e.next()) { f = g.value, d.push(f.commit(a, b)); } return K(h, Promise.all(d), 2); } c.reg.clear(); h.h = 0; }); }; w.destroy = function() { for (var a = [], b = C(this.index.values()), c = b.next(); !c.done; c = b.next()) { a.push(c.value.destroy()); } return Promise.all(a); }; function Ib(a, b) { var c = new Map(), d = b.index || b.field || b; T(d) && (d = [d]); for (var e = 0, g, f = void 0; e < d.length; e++) { g = d[e]; T(g) || (f = g, g = g.field); f = Ca(f) ? Object.assign({}, a, f) : a; if (this.worker) { var h = (h = f.encoder) && h.encode ? h : new Ka("string" === typeof h ? Ua[h] : h || {}); h = new mb(f, h); c.set(g, h); } this.worker || c.set(g, new Y(f, this.reg)); f.custom ? this.M[e] = f.custom : (this.M[e] = Hb(g, this.T), f.filter && ("string" === typeof this.M[e] && (this.M[e] = new String(this.M[e])), this.M[e].S = f.filter)); this.field[e] = g; } if (this.J) { for (a = b.store, T(a) && (a = [a]), b = 0; b < a.length; b++) { d = a[b], e = d.field || d, d.custom ? (this.J[b] = d.custom, d.custom.na = e) : (this.J[b] = Hb(e, this.T), d.filter && ("string" === typeof this.J[b] && (this.J[b] = new String(this.J[b])), this.J[b].S = d.filter)); } } return c; } function Hb(a, b) { for (var c = a.split(":"), d = 0, e = 0; e < c.length; e++) { a = c[e], "]" === a[a.length - 1] && (a = a.substring(0, a.length - 2)) && (b[d] = !0), a && (c[d++] = a); } d < c.length && (c.length = d); return 1 < d ? c : c[0]; } w.append = function(a, b) { return this.add(a, b, !0); }; w.update = function(a, b) { return this.remove(a).add(a, b); }; w.remove = function(a) { Ca(a) && (a = Ea(a, this.key)); for (var b = C(this.index.values()), c = b.next(); !c.done; c = b.next()) { c.value.remove(a, !0); } if (this.reg.has(a)) { if (this.tag && !this.fastupdate) { for (b = C(this.tag.values()), c = b.next(); !c.done; c = b.next()) { c = c.value; for (var d = C(c), e = d.next(); !e.done; e = d.next()) { var g = e.value; e = g[0]; g = g[1]; var f = g.indexOf(a); -1 < f && (1 < g.length ? g.splice(f, 1) : c.delete(e)); } } } this.store && this.store.delete(a); this.reg.delete(a); } this.cache && this.cache.remove(a); return this; }; w.clear = function() { for (var a = [], b = C(this.index.values()), c = b.next(); !c.done; c = b.next()) { c = c.value.clear(), c.then && a.push(c); } if (this.tag) { for (b = C(this.tag.values()), c = b.next(); !c.done; c = b.next()) { c.value.clear(); } } this.store && this.store.clear(); this.cache && this.cache.clear(); return a.length ? Promise.all(a) : this; }; w.contain = function(a) { return this.db ? this.index.get(this.field[0]).db.has(a) : this.reg.has(a); }; w.cleanup = function() { for (var a = C(this.index.values()), b = a.next(); !b.done; b = a.next()) { b.value.cleanup(); } return this; }; w.get = function(a) { return this.db ? this.index.get(this.field[0]).db.enrich(a).then(function(b) { return b[0] && b[0].doc || null; }) : this.store.get(a) || null; }; w.set = function(a, b) { "object" === typeof a && (b = a, a = Ea(b, this.key)); this.store.set(a, b); return this; }; w.searchCache = Ma; w.export = Jb; w.import = Kb; fb(pb.prototype); function Lb(a, b) { b = void 0 === b ? 0 : b; var c = [], d = []; b && (b = 250000 / b * 5000 | 0); a = C(a.entries()); for (var e = a.next(); !e.done; e = a.next()) { d.push(e.value), d.length === b && (c.push(d), d = []); } d.length && c.push(d); return c; } function Mb(a, b) { b || (b = new Map()); for (var c = 0, d; c < a.length; c++) { d = a[c], b.set(d[0], d[1]); } return b; } function Nb(a, b) { b = void 0 === b ? 0 : b; var c = [], d = []; b && (b = 250000 / b * 1000 | 0); a = C(a.entries()); for (var e = a.next(); !e.done; e = a.next()) { e = e.value, d.push([e[0], Lb(e[1])[0]]), d.length === b && (c.push(d), d = []); } d.length && c.push(d); return c; } function Ob(a, b) { b || (b = new Map()); for (var c = 0, d, e; c < a.length; c++) { d = a[c], e = b.get(d[0]), b.set(d[0], Mb(d[1], e)); } return b; } function Pb(a) { var b = [], c = []; a = C(a.keys()); for (var d = a.next(); !d.done; d = a.next()) { c.push(d.value), 250000 === c.length && (b.push(c), c = []); } c.length && b.push(c); return b; } function Qb(a, b) { b || (b = new Set()); for (var c = 0; c < a.length; c++) { b.add(a[c]); } return b; } function Rb(a, b, c, d, e, g, f) { f = void 0 === f ? 0 : f; var h = d && d.constructor === Array, k = h ? d.shift() : d; if (!k) { return this.export(a, b, e, g + 1); } if ((k = a((b ? b + "." : "") + (f + 1) + "." + c, JSON.stringify(k))) && k.then) { var l = this; return k.then(function() { return Rb.call(l, a, b, c, h ? d : null, e, g, f + 1); }); } return Rb.call(this, a, b, c, h ? d : null, e, g, f + 1); } function Jb(a, b, c, d) { c = void 0 === c ? 0 : c; d = void 0 === d ? 0 : d; if (c < this.field.length) { var e = this.field[c]; if ((b = this.index.get(e).export(a, e, c, d = 1)) && b.then) { var g = this; return b.then(function() { return g.export(a, e, c + 1); }); } return this.export(a, e, c + 1); } switch(d) { case 0: var f = "reg"; var h = Pb(this.reg); b = null; break; case 1: f = "tag"; h = this.tag && Nb(this.tag, this.reg.size); b = null; break; case 2: f = "doc"; h = this.store && Lb(this.store); b = null; break; default: return; } return Rb.call(this, a, b, f, h, c, d); } function Kb(a, b) { var c = a.split("."); "json" === c[c.length - 1] && c.pop(); var d = 2 < c.length ? c[0] : ""; c = 2 < c.length ? c[2] : c[1]; if (this.worker && d) { return this.index.get(d).import(a); } if (b) { "string" === typeof b && (b = JSON.parse(b)); if (d) { return this.index.get(d).import(c, b); } switch(c) { case "reg": this.fastupdate = !1; this.reg = Qb(b, this.reg); for (b = 0; b < this.field.length; b++) { d = this.index.get(this.field[b]), d.fastupdate = !1, d.reg = this.reg; } if (this.worker) { b = []; d = C(this.index.values()); for (c = d.next(); !c.done; c = d.next()) { b.push(c.value.import(a)); } return Promise.all(b); } break; case "tag": this.tag = Ob(b, this.tag); break; case "doc": this.store = Mb(b, this.store); } } } function Sb(a, b) { var c = ""; a = C(a.entries()); for (var d = a.next(); !d.done; d = a.next()) { var e = d.value; d = e[0]; e = e[1]; for (var g = "", f = 0, h; f < e.length; f++) { h = e[f] || [""]; for (var k = "", l = 0; l < h.length; l++) { k += (k ? "," : "") + ("string" === b ? '"' + h[l] + '"' : h[l]); } k = "[" + k + "]"; g += (g ? "," : "") + k; } g = '["' + d + '",[' + g + "]]"; c += (c ? "," : "") + g; } return c; } ;Y.prototype.remove = function(a, b) { var c = this.reg.size && (this.fastupdate ? this.reg.get(a) : this.reg.has(a)); if (c) { if (this.fastupdate) { for (var d = 0, e = void 0, g = void 0; d < c.length; d++) { if ((e = c[d]) && (g = e.length)) { if (e[g - 1] === a) { e.pop(); } else { var f = e.indexOf(a); 0 <= f && e.splice(f, 1); } } } } else { Tb(this.map, a), this.depth && Tb(this.ctx, a); } b || this.reg.delete(a); } this.db && (this.commit_task.push({del:a}), this.ea && Ub(this)); this.cache && this.cache.remove(a); return this; }; function Tb(a, b) { var c = 0, d = "undefined" === typeof b; if (a.constructor === Array) { for (var e = 0, g = void 0, f, h = void 0; e < a.length; e++) { if ((g = a[e]) && g.length) { if (d) { return 1; } f = g.indexOf(b); if (0 <= f) { if (1 < g.length) { return g.splice(f, 1), 1; } delete a[e]; if (c) { return 1; } h = 1; } else { if (h) { return 1; } c++; } } } } else { for (d = C(a.entries()), e = d.next(); !e.done; e = d.next()) { e = e.value, g = e[0], Tb(e[1], b) ? c++ : a.delete(g); } } return c; } ;var Vb = {memory:{resolution:1}, performance:{resolution:3, fastupdate:!0, context:{depth:1, resolution:1}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:3}}}; Y.prototype.add = function(a, b, c, d) { if (b && (a || 0 === a)) { if (!d && !c && this.reg.has(a)) { return this.update(a, b); } d = this.depth; b = this.encoder.encode(b, !d); var e = b.length; if (e) { for (var g = S(), f = S(), h = this.resolution, k = 0; k < e; k++) { var l = b[this.rtl ? e - 1 - k : k], m = l.length; if (m && (d || !f[l])) { var p = this.score ? this.score(b, l, k, null, 0) : Wb(h, e, k), n = ""; switch(this.tokenize) { case "full": if (2 < m) { p = 0; for (var q; p < m; p++) { for (var t = m; t > p; t--) { n = l.substring(p, t), q = this.rtl ? m - 1 - p : p, q = this.score ? this.score(b, l, k, n, q) : Wb(h, e, k, m, q), Xb(this, f, n, q, a, c); } } break; } case "bidirectional": case "reverse": if (1 < m) { for (t = m - 1; 0 < t; t--) { n = l[this.rtl ? m - 1 - t : t] + n, q = this.score ? this.score(b, l, k, n, t) : Wb(h, e, k, m, t), Xb(this, f, n, q, a, c); } n = ""; } case "forward": if (1 < m) { for (t = 0; t < m; t++) { n += l[this.rtl ? m - 1 - t : t], Xb(this, f, n, p, a, c); } break; } default: if (Xb(this, f, l, p, a, c), d && 1 < e && k < e - 1) { for (m = S(), n = this.ga, p = l, t = Math.min(d + 1, this.rtl ? k + 1 : e - k), q = m[p] = 1; q < t; q++) { if ((l = b[this.rtl ? e - 1 - k - q : k + q]) && !m[l]) { m[l] = 1; var u = this.score ? this.score(b, p, k, l, q - 1) : Wb(n + (e / 2 > n ? 0 : 1), e, k, t - 1, q - 1), v = this.bidirectional && l > p; Xb(this, g, v ? p : l, u, a, c, v ? l : p); } } } } } } this.fastupdate || this.reg.add(a); } else { b = ""; } } this.db && (b || this.commit_task.push({del:a}), this.ea && Ub(this)); return this; }; function Xb(a, b, c, d, e, g, f) { var h = f ? a.ctx : a.map, k; if (!b[c] || f && !(k = b[c])[f]) { if (f ? (b = k || (b[c] = S()), b[f] = 1, (k = h.get(f)) ? h = k : h.set(f, h = new Map())) : b[c] = 1, (k = h.get(c)) ? h = k : h.set(c, h = k = []), h = h[d] || (h[d] = []), !g || !h.includes(e)) { if (h.length === Math.pow(2, 31) - 1) { b = new Wa(h); if (a.fastupdate) { for (c = C(a.reg.values()), g = c.next(); !g.done; g = c.next()) { g = g.value, g.includes(h) && (g[g.indexOf(h)] = b); } } k[d] = h = b; } h.push(e); a.fastupdate && ((d = a.reg.get(e)) ? d.push(h) : a.reg.set(e, [h])); } } } function Wb(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; } ;Y.prototype.search = function(a, b, c) { c || (b || "object" !== typeof a ? "object" === typeof b && (c = b, b = 0) : (c = a, a = "")); if (c && c.cache) { return c.cache = !1, a = this.searchCache(a, b, c), c.cache = !0, a; } var d = [], e = 0, g; if (c) { a = c.query || a; b = c.limit || b; e = c.offset || 0; var f = c.context; var h = c.suggest; var k = (g = c.resolve) && c.enrich; var l = c.boost; var m = c.resolution; var p = this.db && c.tag; } "undefined" === typeof g && (g = this.resolve); f = this.depth && !1 !== f; var n = this.encoder.encode(a, !f); var q = n.length; b = b || (g ? 100 : 0); if (1 === q) { return Yb.call(this, n[0], "", b, e, g, k, p); } if (2 === q && f && !h) { return Yb.call(this, n[1], n[0], b, e, g, k, p); } var t = S(), u = 0; if (f) { var v = n[0]; u = 1; } m || 0 === m || (m = v ? this.ga : this.resolution); if (this.db) { if (this.db.search && (c = this.db.search(this, n, b, e, h, g, k, p), !1 !== c)) { return c; } var x = this; return function() { var y, E; return wa(function(B) { switch(B.h) { case 1: E = y = void 0; case 2: if (!(u < q)) { B.h = 4; break; } E = n[u]; if (!E || t[E]) { B.h = 5; break; } t[E] = 1; return K(B, Zb(x, E, v, 0, 0, !1, !1), 6); case 6: y = B.B; if (y = $b(y, d, h, m)) { d = y; B.h = 4; break; } v && (h && y && d.length || (v = E)); case 5: h && v && u === q - 1 && !d.length && (m = x.resolution, v = "", u = -1, t = S()); u++; B.h = 2; break; case 4: return B.return(ac(d, m, b, e, h, l, g)); } }); }(); } for (a = c = void 0; u < q; u++) { if ((a = n[u]) && !t[a]) { t[a] = 1; c = Zb(this, a, v, 0, 0, !1, !1); if (c = $b(c, d, h, m)) { d = c; break; } v && (h && c && d.length || (v = a)); } h && v && u === q - 1 && !d.length && (m = this.resolution, v = "", u = -1, t = S()); } return ac(d, m, b, e, h, l, g); }; function ac(a, b, c, d, e, g, f) { var h = a.length, k = a; if (1 < h) { k = Ab(a, b, c, d, e, g, f); } else if (1 === h) { return f ? sb.call(null, a[0], c, d) : new Z(a[0], this); } return f ? k : new Z(k, this); } function Yb(a, b, c, d, e, g, f) { a = Zb(this, a, b, c, d, e, g, f); return this.db ? a.then(function(h) { return e ? h || [] : new Z(h, this); }) : a && a.length ? e ? sb.call(this, a, c, d) : new Z(a, this) : e ? [] : new Z([], this); } function $b(a, b, c, d) { var e = []; if (a && a.length) { if (a.length <= d) { b.push(a); return; } for (var g = 0, f; g < d; g++) { if (f = a[g]) { e[g] = f; } } if (e.length) { b.push(e); return; } } if (!c) { return e; } } function Zb(a, b, c, d, e, g, f, h) { var k; c && (k = a.bidirectional && b > c) && (k = c, c = b, b = k); if (a.db) { return a.db.get(b, c, d, e, g, f, h); } a = c ? (a = a.ctx.get(c)) && a.get(b) : a.map.get(b); return a; } ;function Y(a, b) { if (!this || this.constructor !== Y) { return new Y(a); } if (a) { var c = T(a) ? a : a.preset; c && (Vb[c] || console.warn("Preset not found: " + c), a = Object.assign({}, Vb[c], a)); } else { a = {}; } c = a.context; var d = !0 === c ? {depth:1} : c || {}, e = T(a.encoder) ? Ua[a.encoder] : a.encode || a.encoder || {}; this.encoder = e.encode ? e : "object" === typeof e ? new Ka(e) : {encode:e}; this.resolution = a.resolution || 9; this.tokenize = c = (c = a.tokenize) && "default" !== c && "exact" !== c && c || "strict"; this.depth = "strict" === c && d.depth || 0; this.bidirectional = !1 !== d.bidirectional; this.fastupdate = !!a.fastupdate; this.score = a.score || null; d && d.depth && "strict" !== this.tokenize && console.warn('Context-Search could not applied, because it is just supported when using the tokenizer "strict".'); (c = a.keystore || 0) && (this.keystore = c); this.map = c ? new Xa(c) : new Map(); this.ctx = c ? new Xa(c) : new Map(); this.reg = b || (this.fastupdate ? c ? new Xa(c) : new Map() : c ? new X(c) : new Set()); this.ga = d.resolution || 3; this.rtl = e.rtl || a.rtl || !1; this.cache = (c = a.cache || null) && new Na(c); this.resolve = !1 !== a.resolve; if (c = a.db) { this.db = this.mount(c); } this.ea = !1 !== a.commit; this.commit_task = []; this.commit_timer = null; this.priority = a.priority || 4; } w = Y.prototype; w.mount = function(a) { this.commit_timer && (clearTimeout(this.commit_timer), this.commit_timer = null); return a.mount(this); }; w.commit = function(a, b) { this.commit_timer && (clearTimeout(this.commit_timer), this.commit_timer = null); return this.db.commit(this, a, b); }; w.destroy = function() { this.commit_timer && (clearTimeout(this.commit_timer), this.commit_timer = null); return this.db.destroy(); }; function Ub(a) { a.commit_timer || (a.commit_timer = setTimeout(function() { a.commit_timer = null; a.db.commit(a, void 0, void 0); }, 1)); } w.clear = function() { this.map.clear(); this.ctx.clear(); this.reg.clear(); this.cache && this.cache.clear(); this.db && (this.commit_timer && clearTimeout(this.commit_timer), this.commit_timer = null, this.commit_task = [{clear:!0}]); return this; }; w.append = function(a, b) { return this.add(a, b, !0); }; w.contain = function(a) { return this.db ? this.db.has(a) : this.reg.has(a); }; w.update = function(a, b) { var c = this, d = this.remove(a); return d && d.then ? d.then(function() { return c.add(a, b); }) : this.add(a, b); }; w.cleanup = function() { if (!this.fastupdate) { return console.info('Cleanup the index isn\'t required when not using "fastupdate".'), this; } Tb(this.map); this.depth && Tb(this.ctx); return this; }; w.searchCache = Ma; w.export = function(a, b, c, d) { c = void 0 === c ? 0 : c; d = void 0 === d ? 0 : d; switch(d) { case 0: var e = "reg"; var g = Pb(this.reg); break; case 1: e = "cfg"; g = null; break; case 2: e = "map"; g = Lb(this.map, this.reg.size); break; case 3: e = "ctx"; g = Nb(this.ctx, this.reg.size); break; default: return; } return Rb.call(this, a, b, e, g, c, d); }; w.import = function(a, b) { if (b) { switch("string" === typeof b && (b = JSON.parse(b)), a = a.split("."), "json" === a[a.length - 1] && a.pop(), 3 === a.length && a.shift(), a = 1 < a.length ? a[1] : a[0], a) { case "reg": this.fastupdate = !1; this.reg = Qb(b, this.reg); break; case "map": this.map = Mb(b, this.map); break; case "ctx": this.ctx = Ob(b, this.ctx); } } }; w.serialize = function(a) { a = void 0 === a ? !0 : a; var b = "", c = "", d = ""; if (this.reg.size) { var e; c = C(this.reg.keys()); for (var g = c.next(); !g.done; g = c.next()) { g = g.value, e || (e = typeof g), b += (b ? "," : "") + ("string" === e ? '"' + g + '"' : g); } b = "index.reg=new Set([" + b + "]);"; c = Sb(this.map, e); c = "index.map=new Map([" + c + "]);"; g = C(this.ctx.entries()); for (var f = g.next(); !f.done; f = g.next()) { var h = f.value; f = h[0]; h = Sb(h[1], e); h = "new Map([" + h + "])"; h = '["' + f + '",' + h + "]"; d += (d ? "," : "") + h; } d = "index.ctx=new Map([" + d + "]);"; } return a ? "function inject(index){" + b + c + d + "}" : b + c + d; }; fb(Y.prototype); var bc = "undefined" !== typeof window && (window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB), cc = ["map", "ctx", "tag", "reg", "cfg"], dc = S(); function ec(a, b) { b = void 0 === b ? {} : b; if (!this || this.constructor !== ec) { return new ec(a, b); } "object" === typeof a && (b = a, a = a.name); a || console.info("Default storage space was used, because a name was not passed."); this.id = "flexsearch" + (a ? ":" + a.toLowerCase().replace(/[^a-z0-9_\-]/g, "") : ""); this.field = b.field ? b.field.toLowerCase().replace(/[^a-z0-9_\-]/g, "") : ""; this.type = b.type; this.fastupdate = this.support_tag_search = !1; this.db = null; this.h = {}; } w = ec.prototype; w.mount = function(a) { if (a.index) { return a.mount(this); } a.db = this; return this.open(); }; w.open = function() { if (this.db) { return this.db; } var a = this; navigator.storage && navigator.storage.persist(); dc[a.id] || (dc[a.id] = []); dc[a.id].push(a.field); var b = bc.open(a.id, 1); b.onupgradeneeded = function() { for (var c = a.db = this.result, d = 0, e; d < cc.length; d++) { e = cc[d]; for (var g = 0, f; g < dc[a.id].length; g++) { f = dc[a.id][g], c.objectStoreNames.contains(e + ("reg" !== e ? f ? ":" + f : "" : "")) || c.createObjectStore(e + ("reg" !== e ? f ? ":" + f : "" : "")); } } }; return a.db = fc(b, function(c) { a.db = c; a.db.onversionchange = function() { a.close(); }; }); }; w.close = function() { this.db && this.db.close(); this.db = null; }; w.destroy = function() { var a = bc.deleteDatabase(this.id); return fc(a); }; w.clear = function() { for (var a = [], b = 0, c; b < cc.length; b++) { c = cc[b]; for (var d = 0, e; d < dc[this.id].length; d++) { e = dc[this.id][d], a.push(c + ("reg" !== c ? e ? ":" + e : "" : "")); } } b = this.db.transaction(a, "readwrite"); for (c = 0; c < a.length; c++) { b.objectStore(a[c]).clear(); } return fc(b); }; w.get = function(a, b, c, d, e, g) { c = void 0 === c ? 0 : c; d = void 0 === d ? 0 : d; e = void 0 === e ? !0 : e; g = void 0 === g ? !1 : g; a = this.db.transaction((b ? "ctx" : "map") + (this.field ? ":" + this.field : ""), "readonly").objectStore((b ? "ctx" : "map") + (this.field ? ":" + this.field : "")).get(b ? b + ":" + a : a); var f = this; return fc(a).then(function(h) { var k = []; if (!h || !h.length) { return k; } if (e) { if (!c && !d && 1 === h.length) { return h[0]; } for (var l = 0, m = void 0; l < h.length; l++) { if ((m = h[l]) && m.length) { if (d >= m.length) { d -= m.length; } else { for (var p = c ? d + Math.min(m.length - d, c) : m.length, n = d; n < p; n++) { k.push(m[n]); } d = 0; if (k.length === c) { break; } } } } return g ? f.enrich(k) : k; } return h; }); }; w.tag = function(a, b, c, d) { b = void 0 === b ? 0 : b; c = void 0 === c ? 0 : c; d = void 0 === d ? !1 : d; a = this.db.transaction("tag" + (this.field ? ":" + this.field : ""), "readonly").objectStore("tag" + (this.field ? ":" + this.field : "")).get(a); var e = this; return fc(a).then(function(g) { if (!g || !g.length || c >= g.length) { return []; } if (!b && !c) { return g; } g = g.slice(c, c + b); return d ? e.enrich(g) : g; }); }; w.enrich = function(a) { "object" !== typeof a && (a = [a]); for (var b = this.db.transaction("reg", "readonly").objectStore("reg"), c = [], d = 0; d < a.length; d++) { c[d] = fc(b.get(a[d])); } return Promise.all(c).then(function(e) { for (var g = 0; g < e.length; g++) { e[g] = {id:a[g], doc:e[g] ? JSON.parse(e[g]) : null}; } return e; }); }; w.has = function(a) { a = this.db.transaction("reg", "readonly").objectStore("reg").getKey(a); return fc(a).then(function(b) { return !!b; }); }; w.search = null; w.info = function() { }; w.transaction = function(a, b, c) { a += "reg" !== a ? this.field ? ":" + this.field : "" : ""; var d = this.h[a + ":" + b]; if (d) { return c.call(this, d); } var e = this.db.transaction(a, b); this.h[a + ":" + b] = d = e.objectStore(a); var g = c.call(this, d); this.h[a + ":" + b] = null; return fc(e).finally(function() { e = d = null; return g; }); }; w.commit = function(a, b, c) { var d = this, e, g, f; return wa(function(h) { switch(h.h) { case 1: if (b) { return K(h, d.clear(), 12); } e = a.commit_task; a.commit_task = []; g = 0; f = void 0; case 4: if (!(g < e.length)) { h.h = 6; break; } f = e[g]; if (!f.clear) { e[g] = f.del; h.h = 5; break; } return K(h, d.clear(), 8); case 8: b = !0; h.h = 6; break; case 5: g++; h.h = 4; break; case 6: if (b) { h.h = 3; break; } c || (e = e.concat(Da(a.reg))); if (!e.length) { h.h = 10; break; } return K(h, d.remove(e), 11); case 11: case 10: h.h = 3; break; case 12: a.commit_task = []; case 3: return a.reg.size ? K(h, d.transaction("map", "readwrite", function(k) { for (var l = C(a.map), m = l.next(), p = {}; !m.done; p = {P:void 0, Y:void 0}, m = l.next()) { m = m.value, p.Y = m[0], p.P = m[1], p.P.length && (b ? k.put(p.P, p.Y) : k.get(p.Y).onsuccess = function(n) { return function() { var q = this.result, t; if (q && q.length) { for (var u = Math.max(q.length, n.P.length), v = 0, x; v < u; v++) { if ((x = n.P[v]) && x.length) { if ((t = q[v]) && t.length) { for (var y = 0; y < x.length; y++) { t.push(x[y]); } } else { q[v] = x; } t = 1; } } } else { q = n.P, t = 1; } t && k.put(q, n.Y); }; }(p)); } }), 13) : h.return(); case 13: return K(h, d.transaction("ctx", "readwrite", function(k) { for (var l = C(a.ctx), m = l.next(), p = {}; !m.done; p = {W:void 0}, m = l.next()) { m = m.value; p.W = m[0]; m = C(m[1]); for (var n = m.next(), q = {}; !n.done; q = {R:void 0, Z:void 0}, n = m.next()) { n = n.value, q.Z = n[0], q.R = n[1], q.R.length && (b ? k.put(q.R, p.W + ":" + q.Z) : k.get(p.W + ":" + q.Z).onsuccess = function(t, u) { return function() { var v = this.result, x; if (v && v.length) { for (var y = Math.max(v.length, t.R.length), E = 0, B; E < y; E++) { if ((B = t.R[E]) && B.length) { if ((x = v[E]) && x.length) { for (var r = 0; r < B.length; r++) { x.push(B[r]); } } else { v[E] = B; } x = 1; } } } else { v = t.R, x = 1; } x && k.put(v, u.W + ":" + t.Z); }; }(q, p)); } } }), 14); case 14: if (a.store) { return K(h, d.transaction("reg", "readwrite", function(k) { for (var l = C(a.store), m = l.next(); !m.done; m = l.next()) { var p = m.value; m = p[0]; p = p[1]; k.put("object" === typeof p ? JSON.stringify(p) : 1, m); } }), 16); } if (a.bypass) { h.h = 16; break; } return K(h, d.transaction("reg", "readwrite", function(k) { for (var l = C(a.reg.keys()), m = l.next(); !m.done; m = l.next()) { k.put(1, m.value); } }), 16); case 16: if (!a.tag) { h.h = 20; break; } return K(h, d.transaction("tag", "readwrite", function(k) { for (var l = C(a.tag), m = l.next(), p = {}; !m.done; p = {X:void 0, da:void 0}, m = l.next()) { m = m.value, p.da = m[0], p.X = m[1], p.X.length && (k.get(p.da).onsuccess = function(n) { return function() { var q = this.result; q = q && q.length ? q.concat(n.X) : n.X; k.put(q, n.da); }; }(p)); } }), 20); case 20: a.map.clear(), a.ctx.clear(), a.tag && a.tag.clear(), a.store && a.store.clear(), a.document || a.reg.clear(), h.h = 0; } }); }; function gc(a, b, c) { for (var d = a.value, e, g = 0, f = 0, h; f < d.length; f++) { if (h = c ? d : d[f]) { for (var k = 0, l; k < b.length; k++) { if (l = b[k], l = h.indexOf(l), 0 <= l) { if (e = 1, 1 < h.length) { h.splice(l, 1); } else { d[f] = []; break; } } } g += h.length; } if (c) { break; } } g ? e && a.update(d) : a.delete(); a.continue(); } w.remove = function(a) { "object" !== typeof a && (a = [a]); return Promise.all([this.transaction("map", "readwrite", function(b) { b.openCursor().onsuccess = function() { var c = this.result; c && gc(c, a); }; }), this.transaction("ctx", "readwrite", function(b) { b.openCursor().onsuccess = function() { var c = this.result; c && gc(c, a); }; }), this.transaction("tag", "readwrite", function(b) { b.openCursor().onsuccess = function() { var c = this.result; c && gc(c, a, !0); }; }), this.transaction("reg", "readwrite", function(b) { for (var c = 0; c < a.length; c++) { b.delete(a[c]); } })]); }; function fc(a, b) { return new Promise(function(c, d) { a.onsuccess = a.oncomplete = function() { b && b(this.result); b = null; c(this.result); }; a.onerror = a.onblocked = d; a = null; }); } ;var hc = {Index:Y, Charset:Ua, Encoder:Ka, Document:pb, Worker:mb, Resolver:Z, IndexedDB:ec, Language:{}}, ic = "undefined" !== typeof self ? self : "undefined" !== typeof global ? global : self, jc; (jc = ic.define) && jc.amd ? jc([], function() { return hc; }) : "object" === typeof ic.exports ? ic.exports = hc : ic.FlexSearch = hc; }(this||self));