diff --git a/dist/flexsearch.min.js b/dist/flexsearch.bundle.js similarity index 81% rename from dist/flexsearch.min.js rename to dist/flexsearch.bundle.js index 01f08e4..be4ba98 100644 --- a/dist/flexsearch.min.js +++ b/dist/flexsearch.bundle.js @@ -1,16 +1,16 @@ /**! - * FlexSearch.js v0.7.0-beta + * FlexSearch.js v0.7.0-beta (Bundle) * Copyright 2019 Nextapps GmbH * Author: Thomas Wilkerling * Licence: Apache-2.0 * https://github.com/nextapps-de/flexsearch */ -(function _f(self){'use strict';try{if(module)self=module}catch(e){}self._factory=_f;var u;const w=/[\W_]+/;function aa(a){if(a=a.toLowerCase())if(a&&this.C&&(a=y(a,this.C)),this.G&&1=b)return f.concat(l.slice(c,b-h+c));f=f.concat(c? -l.slice(c):l);h+=n;c=0}return f}function ha(a,b){const c=B(),d=B(),e=[];for(let f=0;f=e&&(f=e-1);this.s=e;this.threshold=f;this.u=b=c&&c.I||a.tokenize||"strict";this.depth="strict"===b&&h.depth;this.v=z(h.bidirectional,!0);this.m=g="memory"=== +(function _f(self){'use strict';try{if(module)self=module}catch(e){}self._factory=_f;var u;const w=/[\W_]+/;function aa(a){if(a=a.toLowerCase())if(a&&this.C&&(a=y(a,this.C)),this.G&&1=b)return f.concat(l.slice(c,b-h+c));f=f.concat(c? +l.slice(c):l);h+=n;c=0}return f}function ha(a,b){const c=B(),d=B(),e=[];for(let f=0;f=e&&(f=e-1);this.s=e;this.threshold=f;this.u=b=c&&c.I||a.tokenize||"strict";this.depth="strict"===b&&h.depth;this.v=z(h.bidirectional,!0);this.m=g="memory"=== a.optimize;this.j=z(a.fastupdate,!0);this.o=a.minlength||1;this.map=g?A(e-f):B();e=h.resolution||e;f=h.threshold||f;f>=e&&(f=e-1);this.h=e;this.l=f;this.g=g?A(e-f):B();this.F=c&&c.F||a.rtl;this.C=(b=a.matcher||d&&d.C)&&H(b,!1);this.G=(b=a.stemmer||d&&d.G)&&H(b,!0);if(c=b=a.filter||d&&d.filter){c=b;d=B();for(let k=0,l=c.length;k=this.o&&(n||!r[m])){var e=Math.min(this.s/l*p|0,p);if(eg;k--)f=m.substring(g,k),f.length>=this.o&&M(this,r,f,h,a,c)}break}case "reverse":if(2< -d){for(g=d-1;0=this.o&&M(this,r,f,e,a,c);f=""}case "forward":if(1=this.o&&M(this,r,f,e,a,c);break;default:if(M(this,r,m,e,a,c),n&&1=this.o&&!e[m]){if(e[m]=1,k=Math.min((this.h-g)/l*p+h|0,p+(h-1)),kf;M(this,v,t?f:m,k,a,c,t?m:f)}}else g=Math.min(g+1,l-p)}}}}this.j||(this.register[a]=1)}}return this}; -function M(a,b,c,d,e,f,g){let h=g?a.g:a.map;if(!b[c]||g&&!b[c][g])a.m&&(h=h[d]),g?(b=b[c]||(b[c]=B()),b[g]=1,h=h[g]||(h[g]=B())):b[c]=1,h=h[c]||(h[c]=[]),a.m||(h=h[d]||(h[d]=[])),f&&-1!==h.indexOf(e)||(h[h.length]=e,a.j&&(a=a.register[e]||(a.register[e]=[]),a[a.length]=h))} +u.add=function(a,b,c){if(this.register[a]&&!c)return this.update(a,b);if(b&&(a||0===a)){b=this.encode(b);const l=b.length;if(l){const n=this.depth,q=this.s-this.threshold,r=B(),v=B();for(let p=0;p=this.o&&(n||!r[m])){var e=Math.min(this.s/l*p|0,p);if(eg;k--)f=m.substring(g,k),f.length>=this.o&&O(this,r,f,h,a,c)}break}case "reverse":if(2< +d){for(g=d-1;0=this.o&&O(this,r,f,e,a,c);f=""}case "forward":if(1=this.o&&O(this,r,f,e,a,c);break;default:if(O(this,r,m,e,a,c),n&&1=this.o&&!e[m]){if(e[m]=1,k=Math.min((this.h-g)/l*p+h|0,p+(h-1)),kf;O(this,v,t?f:m,k,a,c,t?m:f)}}else g=Math.min(g+1,l-p)}}}}this.j||(this.register[a]=1)}}return this}; +function O(a,b,c,d,e,f,g){let h=g?a.g:a.map;if(!b[c]||g&&!b[c][g])a.m&&(h=h[d]),g?(b=b[c]||(b[c]=B()),b[g]=1,h=h[g]||(h[g]=B())):b[c]=1,h=h[c]||(h[c]=[]),a.m||(h=h[d]||(h[d]=[])),f&&-1!==h.indexOf(e)||(h[h.length]=e,a.j&&(a=a.register[e]||(a.register[e]=[]),a[a.length]=h))} u.search=function(a,b,c){D(a)?(c=a,a=c.query):D(b)&&(c=b);let d=[],e;var f=this.threshold;let g,h=0;if(c){b=c.limit;h=c.offset||0;f=z(c.threshold,f);var k=c.context;g=c.suggest}if(a&&(a=this.encode(a),e=a.length,1=this.o&&!c[v])if(this.m||g||this.map[v])l[r++]=v,c[v]=1;else return d;a=l;e=a.length}if(!e)return d;b||(b=100);c=this.s-f;f=this.h-f;k=this.depth&&1=e)));r++);if(q){if(g)return oa(l,e,0);b[b.length]=l;return}}return!c&&l}function oa(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} @@ -18,16 +18,16 @@ function pa(a,b,c,d){c?(d=d&&b>c,a=(a=a[d?b:c])&&a[d?c:b]):a=a[b];return a}u.con u.remove=function(a,b){const c=this.register[a];if(c){if(this.j)for(let d=0,e;db||c)e=e.slice(c,c+b);d&&(e=ua.call(this,e));return{tag:a,result:e}}}function ua(a){const b=Array(a.length);for(let c=0,d;c=b)return g.concat(k.slice(0,b-h));g=g.concat(k);h+=r}return g} -;const ka={memory:{charset:"latin:extra",m:3,j:3,s:!1,l:"memory"},performance:{threshold:8,j:3,context:{depth:1,u:!0}},match:{charset:"latin:extra",H:"full",m:3},score:{charset:"latin:advanced",threshold:1,context:{depth:3,u:!0}},"default":{m:3,threshold:0,depth:3}};function O(a,b){if(!(this instanceof O))return new O(a);var d;let c;a?(H(a)?a=ka[a]:(d=a.preset)&&(a=Object.assign({},ka[d],a)),d=a.charset,c=a.lang,H(d)&&(-1===d.indexOf(":")&&(d+=":default"),d=fa[d]),H(c)&&(c=ea[c])):a={};let e,g,f,h=a.context||{};this.encode=a.encode||d&&d.encode||ba;this.register=b||G();e=a.resolution||9;g=a.threshold||0;g>=e&&(g=e-1);this.m=e;this.threshold=g;this.v=b=d&&d.H||a.tokenize||"strict";this.depth="strict"===b&&h.depth;this.u=A(h.bidirectional,!0);this.l=f="memory"=== -a.optimize;this.s=A(a.fastupdate,!0);this.j=a.minlength||1;this.g=f?E(e-g):G();e=h.resolution||e;g=h.threshold||g;g>=e&&(g=e-1);this.h=e;this.o=g;this.i=f?E(e-g):G();this.B=d&&d.B||a.rtl;this.A=(b=a.matcher||c&&c.A)&&da(b,!1);this.C=(b=a.stemmer||c&&c.C)&&da(b,!0);if(a=b=a.filter||c&&c.filter){a=b;d=G();for(let l=0,k=a.length;l=this.j&&(r||!t[p])){var e=Math.min(this.m/k*v|0,v);if(ef;l--)g=p.substring(f,l),g.length>=this.j&&P(this,t,g,h,a,d)}break}case "reverse":if(2< -c){for(f=c-1;0=this.j&&P(this,t,g,e,a,d);g=""}case "forward":if(1=this.j&&P(this,t,g,e,a,d);break;default:if(P(this,t,p,e,a,d),r&&1=this.j&&!e[p]){if(e[p]=1,l=Math.min((this.h-f)/k*v+h|0,v+(h-1)),lg;P(this,m,z?g:p,l,a,d,z?p:g)}}else f=Math.min(f+1,k-v)}}}}this.s||(this.register[a]=1)}}return this}; -function P(a,b,d,c,e,g,f){let h=f?a.i:a.g;if(!b[d]||f&&!b[d][f])a.l&&(h=h[c]),f?(b[d]||(b[d]=G()),b[d][f]=1,h=h[f]||(h[f]=G())):b[d]=1,h=h[d]||(h[d]=[]),a.l||(h=h[c]||(h[c]=[])),g&&-1!==h.indexOf(e)||(h[h.length]=e,a.s&&(a=a.register[e]||(a.register[e]=[]),a[a.length]=h))} -w.search=function(a,b,d){I(a)?(d=a,a=d.query):I(b)&&(d=b);let c=[],e;var g=this.threshold;let f,h=0;if(d){b=d.limit;h=d.offset||0;g=A(d.threshold,g);var l=d.context;f=d.suggest}if(a&&(a=this.encode(a),e=a.length,1=this.j&&!d[m])if(this.l||f||this.g[m])k[t++]=m,d[m]=1;else return c;a=k;e=a.length}if(!e)return c;b||(b=100);d=this.m-g;g=this.h-g;l=this.depth&&1b?c.slice(0,b):c}}return ja(c,b,h,f)};function ma(a,b,d,c){d?(c=c&&b>d,a=(a=a[c?b:d])&&a[c?d:b]):a=a[b];return a} -function la(a,b,d,c,e,g,f,h){let l=[],k=h?a.i:a.g;a.l||(k=ma(k,f,h,a.u));if(k){let r=0;c=Math.min(k.length,c);for(let q=0,t=0,m;q=e)));q++);if(r){if(g)return l=1===r?l[0]:[].concat.apply([],l),l.length>e?l.slice(0,e):l;b[b.length]=l;return}}return!d&&l}w.contain=function(a){return!!this.register[a]};w.update=function(a,b){return this.remove(a).add(a,b)}; -w.remove=function(a,b){const d=this.register[a];if(d){if(this.s)for(let c=0,e;cb||q)f=f.slice(q,q+b);h&&(f=oa.call(c,f));n= -{tag:g,result:f}}else n=void 0;n&&(e[e.length]=n,t++)}return t?e:[]}m||(m=c.g);r=r&&(1=b)return f.concat(l.slice(c,b-h+c));f=f.concat(c? +l.slice(c):l);h+=n;c=0}return f}function fa(a,b){const c=B(),e=B(),d=[];for(let f=0;f=d&&(f=d-1);this.m=d;this.threshold=f;this.u=b=c&&c.H||a.tokenize||"strict";this.depth="strict"===b&&h.depth;this.v=z(h.bidirectional,!0);this.l=g="memory"=== +a.optimize;this.s=z(a.fastupdate,!0);this.j=a.minlength||1;this.g=g?A(d-f):B();d=h.resolution||d;f=h.threshold||f;f>=d&&(f=d-1);this.h=d;this.o=f;this.i=g?A(d-f):B();this.B=c&&c.B||a.rtl;this.A=(b=a.matcher||e&&e.A)&&G(b,!1);this.C=(b=a.stemmer||e&&e.C)&&G(b,!0);if(a=b=a.filter||e&&e.filter){a=b;c=B();for(let k=0,l=a.length;k=this.j&&(n||!r[m])){var d=Math.min(this.m/l*p|0,p);if(dg;k--)f=m.substring(g,k),f.length>=this.j&&Q(this,r,f,h,a,c)}break}case "reverse":if(2< +e){for(g=e-1;0=this.j&&Q(this,r,f,d,a,c);f=""}case "forward":if(1=this.j&&Q(this,r,f,d,a,c);break;default:if(Q(this,r,m,d,a,c),n&&1=this.j&&!d[m]){if(d[m]=1,k=Math.min((this.h-g)/l*p+h|0,p+(h-1)),kf;Q(this,u,t?f:m,k,a,c,t?m:f)}}else g=Math.min(g+1,l-p)}}}}this.s||(this.register[a]=1)}}return this}; +function Q(a,b,c,e,d,f,g){let h=g?a.i:a.g;if(!b[c]||g&&!b[c][g])a.l&&(h=h[e]),g?(b=b[c]||(b[c]=B()),b[g]=1,h=h[g]||(h[g]=B())):b[c]=1,h=h[c]||(h[c]=[]),a.l||(h=h[e]||(h[e]=[])),f&&-1!==h.indexOf(d)||(h[h.length]=d,a.s&&(a=a.register[d]||(a.register[d]=[]),a[a.length]=h))} +v.search=function(a,b,c){D(a)?(c=a,a=c.query):D(b)&&(c=b);let e=[],d;var f=this.threshold;let g,h=0;if(c){b=c.limit;h=c.offset||0;f=z(c.threshold,f);var k=c.context;g=c.suggest}if(a&&(a=this.encode(a),d=a.length,1=this.j&&!c[u])if(this.l||g||this.g[u])l[r++]=u,c[u]=1;else return e;a=l;d=a.length}if(!d)return e;b||(b=100);c=this.m-f;f=this.h-f;k=this.depth&&1=d)));r++);if(q){if(g)return ia(l,d,0);b[b.length]=l;return}}return!c&&l}function ia(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} +function ja(a,b,c,e){c?(e=e&&b>c,a=(a=a[e?b:c])&&a[e?c:b]):a=a[b];return a}v.contain=function(a){return!!this.register[a]};v.update=function(a,b){return this.remove(a).add(a,b)};v.remove=function(a,b){const c=this.register[a];if(c){if(this.s)for(let e=0,d;eb||c)d=d.slice(c,c+b);e&&(d=la.call(this,d));return{tag:a,result:d}}}function la(a){const b=Array(a.length);for(let c=0,e;c= b) { + return f.concat(l.slice(c, b - k + c)); + } + f = f.concat(c ? l.slice(c) : l); + k += n; + c = 0; + } + } + } + return f; +} +function ea(a, b) { + const c = y(), d = y(), e = []; + for (let f = 0; f < a.length; f++) { + c[a[f]] = 1; + } + for (let f = 0, g; f < b.length; f++) { + g = b[f]; + for (let k = 0, h; k < g.length; k++) { + h = g[k], c[h] && !d[h] && (d[h] = 1, e[e.length] = h); + } + } + return e; +} +;function N(a) { + this.limit = !0 !== a && a; + this.cache = y(); + this.queue = []; +} +function fa(a, b, c) { + A(a) && (a = a.query); + let d = this.cache.get(a); + d || (d = this.search(a, b, c), this.cache.set(a, d)); + return d; +} +N.prototype.set = function(a, b) { + if (!this.cache[a]) { + var c = this.queue.length; + c === this.limit ? delete this.cache[this.queue[c - 1]] : c++; + for (--c; 0 < c; c--) { + this.queue[c] = this.queue[c - 1]; + } + this.queue[0] = a; + } + this.cache[a] = b; +}; +N.prototype.get = function(a) { + const b = this.cache[a]; + if (this.limit && b && (a = this.queue.indexOf(a))) { + const c = this.queue[a - 1]; + this.queue[a - 1] = this.queue[a]; + this.queue[a] = c; + } + return b; +}; +N.prototype.del = function(a) { + for (let b = 0, c, d; b < this.queue.length; b++) { + d = this.queue[b], c = this.cache[d], -1 !== c.indexOf(a) && (this.queue.splice(b--, 1), delete this.cache[d]); + } +}; +const ha = {memory:{charset:"latin:extra", resolution:3, minlength:3, fastupdate:!1, optimize:"memory"}, performance:{threshold:8, minlength:3, context:{depth:1, bidirectional:!0}}, match:{charset:"latin:extra", tokenize:"full", resolution:3, }, score:{charset:"latin:advanced", threshold:1, context:{depth:3, bidirectional:!0}}, "default":{resolution:3, threshold:0, depth:3}, }; +function ka(a, b, c, d, e, f) { + setTimeout(function() { + const g = a(c, JSON.stringify(f)); + g && g.then ? g.then(function() { + b.export(a, b, c, d, e + 1); + }) : b.export(a, b, c, d, e + 1); + }); +} +;function O(a, b) { + if (!(this instanceof O)) { + return new O(a); + } + var c; + if (a) { + if (z(a)) { + ha[a] || console.warn("Preset not found: " + a), a = ha[a]; + } else { + if (c = a.preset) { + c[c] || console.warn("Preset not found: " + c), a = Object.assign({}, c[c], a); + } + } + c = a.charset; + var d = a.lang; + z(c) && (-1 === c.indexOf(":") && (c += ":default"), c = H[c]); + z(d) && (d = G[d]); + } else { + a = {}; + } + let e, f, g, k = a.context || {}; + this.encode = a.encode || c && c.encode || ba; + this.register = b || y(); + e = a.resolution || 9; + f = a.threshold || 0; + f >= e && (f = e - 1); + this.resolution = e; + this.threshold = f; + this.tokenizer = b = c && c.tokenize || a.tokenize || "strict"; + this.depth = "strict" === b && k.depth; + this.bidirectional = v(k.bidirectional, !0); + this.optimize = g = "memory" === a.optimize; + this.fastupdate = v(a.fastupdate, !0); + this.minlength = a.minlength || 1; + this.map = g ? x(e - f) : y(); + e = k.resolution || e; + f = k.threshold || f; + f >= e && (f = e - 1); + this.resolution_ctx = e; + this.threshold_ctx = f; + this.ctx = g ? x(e - f) : y(); + this.rtl = c && c.rtl || a.rtl; + this.matcher = (b = a.matcher || d && d.matcher) && C(b, !1); + this.stemmer = (b = a.stemmer || d && d.stemmer) && C(b, !0); + if (c = b = a.filter || d && d.filter) { + c = b; + d = y(); + for (let h = 0, l = c.length; h < l; h++) { + d[c[h]] = 1; + } + c = d; + } + this.filter = c; + this.cache = (b = a.cache) && new N(b); +} +O.prototype.pipeline = function(a, b, c, d) { + if (a) { + b && a && (a = D(a, b)); + a && this.matcher && (a = D(a, this.matcher)); + this.stemmer && 1 < a.length && (a = D(a, this.stemmer)); + if (d && 1 < a.length) { + d = b = ""; + for (let e = 0, f = a.length, g; e < f; e++) { + (g = a[e]) !== d && (b += d = g); + } + a = b; + } + if (a && (c || "" === c)) { + a = a.split(c); + if (this.filter) { + c = this.filter; + b = a.length; + d = []; + for (let e = 0, f = 0; e < b; e++) { + const g = a[e]; + g && !c[g] && (d[f++] = g); + } + a = d; + } + return a; + } + } + return a; +}; +O.prototype.append = function(a, b) { + return this.add(a, b, !0); +}; +O.prototype.add = function(a, b, c) { + if (this.register[a] && !c) { + return this.update(a, b); + } + if (b && (a || 0 === a)) { + b = this.encode(b); + const l = b.length; + if (l) { + const n = this.depth, q = this.resolution - this.threshold, r = y(), p = y(); + for (let t = 0; t < l; t++) { + let m = b[this.rtl ? l - 1 - t : t]; + var d = m.length; + if (m && d >= this.minlength && (n || !r[m])) { + var e = Math.min(this.resolution / l * t | 0, t); + if (e < q) { + var f = ""; + switch(this.tokenizer) { + case "full": + if (3 < d) { + for (var g = 0; g < d; g++) { + var k = g ? Math.min(e / 2 + this.resolution / d * g / 2 | 0, e + g) : e; + if (k < q) { + for (var h = d; h > g; h--) { + f = m.substring(g, h), f.length >= this.minlength && this.push_index(r, f, k, a, c); + } + } + } + break; + } + case "reverse": + if (2 < d) { + for (g = d - 1; 0 < g; g--) { + f = m[g] + f, f.length >= this.minlength && this.push_index(r, f, e, a, c); + } + f = ""; + } + case "forward": + if (1 < d) { + for (g = 0; g < d; g++) { + f += m[g], f.length >= this.minlength && this.push_index(r, f, e, a, c); + } + } + break; + default: + if (this.push_index(r, m, e, a, c), n && 1 < l && t < l - 1) { + for (d = this.resolution_ctx - this.threshold_ctx, e = y(), f = m, g = Math.min(n + 1, l - t), e[f] = 1, k = 1; k < g; k++) { + if ((m = b[this.rtl ? l - 1 - t - k : t + k]) && m.length >= this.minlength && !e[m]) { + if (e[m] = 1, h = Math.min((this.resolution_ctx - g) / l * t + k | 0, t + (k - 1)), h < d) { + const u = this.bidirectional && m > f; + this.push_index(p, u ? f : m, h, a, c, u ? m : f); + } + } else { + g = Math.min(g + 1, l - t); + } + } + } + } + } + } + } + this.fastupdate || (this.register[a] = 1); + } + } + return this; +}; +O.prototype.push_index = function(a, b, c, d, e, f) { + let g = f ? this.ctx : this.map; + if (!a[b] || f && !a[b][f]) { + this.optimize && (g = g[c]), f ? (a = a[b] || (a[b] = y()), a[f] = 1, g = g[f] || (g[f] = y())) : a[b] = 1, g = g[b] || (g[b] = []), this.optimize || (g = g[c] || (g[c] = [])), e && -1 !== g.indexOf(d) || (g[g.length] = d, this.fastupdate && (a = this.register[d] || (this.register[d] = []), a[a.length] = g)); + } +}; +O.prototype.search = function(a, b, c) { + A(a) ? (c = a, a = c.query) : A(b) && (c = b); + let d = [], e; + var f = this.threshold; + let g, k = 0; + if (c) { + b = c.limit; + k = c.offset || 0; + f = v(c.threshold, f); + var h = c.context; + g = c.suggest; + } + if (a && (a = this.encode(a), e = a.length, 1 < e)) { + c = y(); + var l = []; + for (let q = 0, r = 0, p; q < e; q++) { + if ((p = a[q]) && p.length >= this.minlength && !c[p]) { + if (this.optimize || g || this.map[p]) { + l[r++] = p, c[p] = 1; + } else { + return d; + } + } + } + a = l; + e = a.length; + } + if (!e) { + return d; + } + b || (b = 100); + c = this.resolution - f; + f = this.resolution_ctx - f; + h = this.depth && 1 < e && !1 !== h; + l = 0; + let n; + h ? (n = a[0], l = 1) : 1 < e && a.sort(ca); + for (let q, r; l < e; l++) { + r = a[l]; + h ? (q = this.add_result(d, g, f, b, k, 2 === e, r, n), g && !1 === q && d.length || (n = r)) : q = this.add_result(d, g, c, b, k, 1 === e, r); + if (q) { + return q; + } + if (g && l === e - 1) { + let p = d.length; + if (!p) { + if (h) { + h = 0; + l = -1; + continue; + } + return d; + } + if (1 === p) { + return la(d[0], b, k); + } + } + } + return da(d, b, k, g); +}; +O.prototype.add_result = function(a, b, c, d, e, f, g, k) { + let h = [], l = k ? this.ctx : this.map; + this.optimize || (l = ma(l, g, k, this.bidirectional)); + if (l) { + let n = 0; + c = Math.min(l.length, c); + for (let q = 0, r = 0, p, t; q < c && !(p = l[q], this.optimize && (p = ma(p, g, k, this.bidirectional)), p && f && (t = p.length, t <= e ? (e -= t, p = null) : e && (p = p.slice(e), e = 0)), p && (h[n++] = p, f && (r += p.length, r >= d))); q++) { + } + if (n) { + if (f) { + return la(h, d, 0); + } + a[a.length] = h; + return; + } + } + return !b && h; +}; +function la(a, b, c) { + a = 1 === a.length ? a[0] : [].concat.apply([], a); + return c || a.length > b ? a.slice(c, c + b) : a; +} +function ma(a, b, c, d) { + c ? (d = d && b > c, a = (a = a[d ? b : c]) && a[d ? c : b]) : a = a[b]; + return a; +} +O.prototype.contain = function(a) { + return !!this.register[a]; +}; +O.prototype.update = function(a, b) { + return this.remove(a).add(a, b); +}; +O.prototype.remove = function(a, b) { + const c = this.register[a]; + if (c) { + if (this.fastupdate) { + for (let d = 0, e; d < c.length; d++) { + e = c[d], e.splice(e.indexOf(a), 1); + } + } else { + P(this.map, a, this.resolution - this.threshold, this.optimize), this.depth && P(this.ctx, a, this.resolution_ctx - this.threshold_ctx, this.optimize); + } + b || delete this.register[a]; + this.cache && this.cache.del(a); + } + return this; +}; +function P(a, b, c, d, e) { + let f = 0; + if (a.constructor === Array) { + if (e) { + b = a.indexOf(b), -1 !== b ? 1 < a.length && (a.splice(b, 1), f++) : f++; + } else { + e = Math.min(a.length, c); + for (let g = 0, k; g < e; g++) { + if (k = a[g]) { + f = P(k, b, c, d, e), d || f || delete a[g]; + } + } + } + } else { + for (let g in a) { + (f = P(a[g], b, c, d, e)) || delete a[g]; + } + } + return f; +} +O.prototype.searchCache = fa; +O.prototype.export = function(a, b, c, d, e) { + let f, g; + switch(e || (e = 0)) { + case 0: + f = "reg"; + if (this.fastupdate) { + g = y(); + for (let k in this.register) { + g[k] = 1; + } + } else { + g = this.register; + } + break; + case 1: + f = "cfg"; + g = {doc:0, opt:this.optimize ? 1 : 0}; + break; + case 2: + f = "map"; + g = this.map; + break; + case 3: + f = "ctx"; + g = this.ctx; + break; + default: + return; + } + ka(a, b || this, c ? c + "." + f : f, d, e, g); + return !0; +}; +O.prototype.import = function(a, b) { + if (b) { + switch(z(b) && (b = JSON.parse(b)), a) { + case "cfg": + this.optimize = !!b.opt; + break; + case "reg": + this.fastupdate = !1; + this.register = b; + break; + case "map": + this.map = b; + break; + case "ctx": + this.ctx = b; + } + } +}; +J(O.prototype); +function na(a) { + var b = self._index; + a = a.data; + var c = a.args; + const d = a.task; + switch(d) { + case "init": + b = a.options || {}; + a = a.factory; + c = b.encode; + b.cache = !1; + c && 0 === c.indexOf("function") && (b.encode = Function("return " + c)()); + a ? (Function("return " + a)()(self), self._index = new self.FlexSearch.Index(b), delete self.FlexSearch) : self._index = new O(b); + break; + case "search": + b = b.search.apply(b, c); + postMessage(b); + break; + default: + b[d].apply(b, c); + } +} +;function Q(a, b) { + var c; + A(a) ? b = a : b ? B(c = b.encode) && (b.encode = c.toString()) : b = {}; + (a = (self || window)._factory) && (a = a.toString()); + c = self.exports; + if (this.worker = oa(a, c)) { + this.resolver = null; + var d = this; + if (c) { + this.worker.on("message", function(e) { + d.resolver(e); + }); + } else { + this.worker.onmessage = function(e) { + d.resolver(e.data); + }; + } + this.worker.postMessage({task:"init", factory:a, options:b}); + } +} +S("add"); +S("append"); +S("search"); +S("update"); +S("remove"); +function S(a) { + Q.prototype[a] = Q.prototype[a + "Async"] = function() { + const b = this, c = [].slice.call(arguments); + var d = c[c.length - 1]; + let e; + B(d) && (e = d, c.splice(c.length - 1, 1)); + d = new I(function(f) { + setTimeout(function() { + b.worker.postMessage({task:a, args:c}); + "search" === a ? b.resolver = f : f(); + }); + }); + return e ? (d.then(e), this) : d; + }; +} +function oa(a, b) { + let c; + try { + c = b ? eval('new (require("worker_threads")["Worker"])("../dist/node/node.js")') : a ? new Worker(URL.createObjectURL(new Blob(["onmessage=" + na.toString()], {type:"text/javascript"}))) : new Worker("worker.js", {type:"module"}); + } catch (d) { + } + return c; +} +;function T(a) { + if (!(this instanceof T)) { + return new T(a); + } + var b; + a || (a = {}); + this.tree = []; + this.field = []; + this.marker = []; + this.register = y(); + this.key = (b = a.key) && U(b, this.marker) || "id"; + this.fastupdate = v(a.fastupdate, !0); + this.extern = !!(b = a.extern); + this.storetree = !this.extern && (b = a.store) && !0 !== b && []; + this.store = b && (this.extern ? b : y()); + this.tag = (b = a.tag) && U(b, this.marker); + this.tagindex = b && y(); + this.cache = (b = a.cache) && new N(b); + a.cache = !1; + this.worker = a.worker; + this.async = !1; + b = a; + a = y(); + let c = b.doc; + if (z(c)) { + c = [c]; + } else { + if (c.constructor !== Array) { + var d = c; + c = Object.keys(c); + } + } + for (let e = 0, f, g; e < c.length; e++) { + f = c[e], z(f) ? d && (g = d[f]) : (g = f, f = f.field), g = A(g) ? Object.assign({}, b, g) : b, this.worker && (a[f] = new Q(g), a[f].worker || (this.worker = !1)), this.worker || (a[f] = new O(g, this.register)), this.tree[e] = U(f, this.marker), this.field[e] = f; + } + if (this.storetree) { + for (d = b.store, z(d) && (d = [d]), b = 0; b < d.length; b++) { + this.storetree[b] = U(d[b], this.marker); + } + } + this.index = a; +} +function U(a, b) { + const c = a.split(":"); + let d = 0; + for (let e = 0; e < c.length; e++) { + a = c[e], 0 <= a.indexOf("[]") && (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]; +} +function pa(a, b) { + if (z(b)) { + a = a[b]; + } else { + for (let c = 0; a && c < b.length; c++) { + a = a[b[c]]; + } + } + return a; +} +function V(a, b, c, d, e) { + a = a[e]; + if (d === c.length - 1) { + b[e] = a; + } else { + if (a) { + if (a.constructor === Array) { + for (b = b[e] = Array(a.length), e = 0; e < a.length; e++) { + V(a, b, c, d, e); + } + } else { + b = b[e] || (b[e] = y()), e = c[++d], V(a, b, c, d, e); + } + } + } +} +function W(a, b, c, d, e, f, g, k) { + a = a[g]; + if (d === b.length - 1) { + if (a.constructor === Array) { + if (c[d]) { + for (b = 0; b < a.length; b++) { + e.add(f, a[b], !0); + } + return; + } + a = a.join(" "); + } + e.add(f, a, k); + } else { + if (a) { + if (a.constructor === Array) { + for (g = 0; g < a.length; g++) { + W(a, b, c, d, e, f, g, k); + } + } else { + g = b[++d], W(a, b, c, d, e, f, g, k); + } + } + } +} +T.prototype.add = function(a, b, c) { + A(a) && (b = a, a = pa(b, this.key)); + if (b && (a || 0 === a)) { + if (this.register[a]) { + return this.update(a, b); + } + for (let d = 0, e, f; d < this.field.length; d++) { + f = this.field[d], e = this.tree[d], z(e) && (e = [e]), W(b, e, this.marker, 0, this.index[f], a, e[0], c); + } + if (this.tag) { + let d = pa(b, this.tag), e = y(); + z(d) && (d = [d]); + for (let f = 0, g, k; f < d.length; f++) { + if (g = d[f], !e[g] && (e[g] = 1, k = this.tagindex[g] || (this.tagindex[g] = []), !c || -1 === k.indexOf(a))) { + if (k[k.length] = a, this.fastupdate) { + const h = this.register[a] || (this.register[a] = []); + h[h.length] = k; + } + } + } + } + if (this.store && !this.extern) { + let d; + if (this.storetree) { + d = y(); + for (let e = 0, f; e < this.storetree.length; e++) { + f = this.storetree[e], z(f) ? d[f] = b[f] : V(b, d, f, 0, f[0]); + } + } + this.store[a] = d || b; + } + } + return this; +}; +T.prototype.append = function(a, b) { + return this.add(a, b, !0); +}; +T.prototype.update = function(a, b) { + return this.remove(a).add(a, b); +}; +T.prototype.remove = function(a) { + A(a) && (a = a[this.key]); + if (this.register[a]) { + for (var b = 0; b < this.field.length && (this.index[this.field[b]].remove(a, !0), !this.fastupdate || this.worker); b++) { + } + if (this.tag && (!this.fastupdate || this.worker)) { + for (let c in this.tagindex) { + b = this.tagindex[c]; + const d = b.indexOf(a); + -1 !== d && (1 < b.length ? b.splice(d, 1) : delete this.tagindex[c]); + } + } + this.store && !this.extern && delete this.store[a]; + delete this.register[a]; + } + return this; +}; +T.prototype.search = function(a, b, c, d) { + A(a) ? (c = a, a = c.query) : A(b) && (c = b, b = 0); + let e = [], f = [], g, k, h, l, n, q, r, p = 0; + if (c) { + if (c.constructor === Array) { + h = c, c = null; + } else { + if (h = (g = c.pluck) || c.field || c.doc, n = c.tag, k = this.store && c.enrich, q = "and" === c.bool, b = c.limit || 100, r = c.offset || 0, h && (z(h) ? h = [h] : h.constructor !== Array && (l = h, h = Object.keys(h))), n && (z(n) && (n = [n]), !a)) { + for (let m = 0, u; m < n.length; m++) { + if (u = qa.call(this, n[m], b, r, k)) { + e[e.length] = u, p++; + } + } + return p ? e : []; + } + } + } + h || (h = this.field); + q = q && (1 < h.length || n && 1 < n.length); + const t = !d && (this.worker || this.async) && []; + for (let m = 0, u, w, E; m < h.length; m++) { + let K; + w = h[m]; + z(w) ? l && (K = l[w]) : (K = w, w = w.field); + if (t) { + t[m] = this.index[w].searchAsync(a, b, K || c); + } else { + u = d ? d[m] : this.index[w].search(a, b, K || c); + E = u.length; + if (n && E) { + const F = []; + let ia = 0; + q && (F[0] = [u]); + for (let R = 0, ja, L; R < n.length; R++) { + if (ja = n[R], E = (L = this.tagindex[ja]) && L.length) { + ia++, F[F.length] = q ? [L] : L; + } + } + ia && (u = q ? da(F, b || 100, r || 0) : ea(u, F), E = u.length); + } + if (E) { + f[p] = w, e[p++] = u; + } else { + if (q) { + return []; + } + } + } + } + if (t) { + const m = this; + return new Promise(function(u) { + Promise.all(t).then(function(w) { + u(m.search(a, b, c, w)); + }); + }); + } + if (!p) { + return []; + } + if (g && (!k || !this.store)) { + return e[0]; + } + for (let m = 0, u; m < f.length; m++) { + u = e[m]; + u.length && k && (u = ra.call(this, u)); + if (g) { + return u; + } + e[m] = {field:f[m], result:u}; + } + return e; +}; +function qa(a, b, c, d) { + let e = this.tagindex[a], f = e && e.length - c; + if (f && 0 < f) { + if (f > b || c) { + e = e.slice(c, c + b); + } + d && (e = ra.call(this, e)); + return {tag:a, result:e}; + } +} +function ra(a) { + const b = Array(a.length); + for (let c = 0, d; c < a.length; c++) { + d = a[c], b[c] = {key:d, doc:this.store[d]}; + } + return b; +} +T.prototype.contain = function(a) { + return !!this.register[a]; +}; +T.prototype.get = function(a) { + return this.store[a]; +}; +T.prototype.set = function(a, b) { + this.store[a] = b; + return this; +}; +T.prototype.searchCache = fa; +T.prototype.export = function(a, b, c, d, e) { + e || (e = 0); + d || (d = 0); + if (d < this.field.length) { + const f = this.field[d], g = this.index[f]; + b = this; + setTimeout(function() { + g.export(a, b, e ? f.replace(":", "-") : "", d, e++) || (d++, e = 1, b.export(a, b, f, d, e)); + }); + } else { + let f; + switch(e) { + case 1: + c = "tag"; + f = this.tagindex; + break; + case 2: + c = "store"; + f = this.store; + break; + default: + return; + } + ka(a, this, c, d, e, f); + } +}; +T.prototype.import = function(a, b) { + if (b) { + switch(z(b) && (b = JSON.parse(b)), a) { + case "tag": + this.tagindex = b; + break; + case "reg": + this.fastupdate = !1; + this.register = b; + for (let d = 0, e; d < this.field.length; d++) { + e = this.index[this.field[d]], e.register = b, e.fastupdate = !1; + } + break; + case "store": + this.store = b; + break; + default: + a = a.split("."); + const c = a[0]; + a = a[1]; + c && a && this.index[c].import(a, b); + } + } +}; +J(T.prototype); +const X = self; +let Y; +const Z = {Index:O, Document:T, Worker:Q, registerCharset:function(a, b) { + H[a] = b; +}, registerLanguage:function(a, b) { + G[a] = b; +}}; +(Y = X.define) && Y.amd ? Y([], function() { + return Z; +}) : X.exports ? X.exports = Z : X.FlexSearch = Z; +}(this)); diff --git a/dist/flexsearch.es5.js b/dist/flexsearch.es5.js new file mode 100644 index 0000000..f537b05 --- /dev/null +++ b/dist/flexsearch.es5.js @@ -0,0 +1,44 @@ +/**! + * FlexSearch.js v0.7.0-beta (ES5) + * Copyright 2019 Nextapps GmbH + * Author: Thomas Wilkerling + * Licence: Apache-2.0 + * https://github.com/nextapps-de/flexsearch + */ +(function(self){'use strict';var u;function v(a){var b=0;return function(){return b>>0)+"_",f=0;return b}); +B("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)return g.concat(w.slice(c,b-e+c));g=g.concat(c?w.slice(c):w);e+=f;c= +0}return g}function qa(a,b){for(var c=G(),d=G(),f=[],g=0;g=e&&(h=e-1);this.v=e;this.threshold=h;this.j=b=c&&c.O||a.tokenize||"strict";this.depth="strict"===b&&g.depth;this.C=F(g.bidirectional,!0);this.s=f= +"memory"===a.optimize;this.m=F(a.fastupdate,!0);this.u=a.minlength||1;this.map=f?ha(e-h):G();e=g.resolution||e;h=g.threshold||h;h>=e&&(h=e-1);this.h=e;this.i=h;this.g=f?ha(e-h):G();this.H=c&&c.H||a.rtl;this.G=(b=a.matcher||d&&d.G)&&ja(b,!1);this.I=(b=a.stemmer||d&&d.I)&&ja(b,!0);if(c=b=a.filter||d&&d.filter){c=b;d=G();g=0;for(e=c.length;g=this.u&&(f||!e[l])){var q=Math.min(this.v/d*k|0,k);if(qp;t--)m=l.substring(p,t),m.length>=this.u&&O(this,e,m,r,a,c)}break}case "reverse":if(2< +n){for(p=n-1;0=this.u&&O(this,e,m,q,a,c);m=""}case "forward":if(1=this.u&&O(this,e,m,q,a,c);break;default:if(O(this,e,l,q,a,c),f&&1=this.u&&!q[l]){if(q[l]=1,t=Math.min((this.h-p)/d*k+r|0,k+(r-1)),tm;O(this,h,x?m:l,t,a,c,x?l:m)}}else p=Math.min(p+1,d-k)}}}}this.m||(this.register[a]=1)}}return this}; +function O(a,b,c,d,f,g,e){var h=e?a.g:a.map;if(!b[c]||e&&!b[c][e])a.s&&(h=h[d]),e?(b=b[c]||(b[c]=G()),b[e]=1,h=h[e]||(h[e]=G())):b[c]=1,h=h[c]||(h[c]=[]),a.s||(h=h[d]||(h[d]=[])),g&&-1!==h.indexOf(f)||(h[h.length]=f,a.m&&(a=a.register[f]||(a.register[f]=[]),a[a.length]=h))} +u.search=function(a,b,c){I(a)?(c=a,a=c.query):I(b)&&(c=b);var d=[],f=this.threshold,g=0;if(c){b=c.limit;g=c.offset||0;f=F(c.threshold,f);var e=c.context;var h=c.suggest}if(a){a=this.encode(a);var k=a.length;if(1=this.u&&!c[m])if(this.s||h||this.map[m])l[q++]=m,c[m]=1;else return d;a=l;k=a.length}}if(!k)return d;b||(b=100);c=this.v-f;f=this.h-f;e=this.depth&&1=f)));m++);if(q){if(e)return va(l,f,0);b[b.length]=l;return}}return!c&&l}function va(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} +function wa(a,b,c,d){c?(d=d&&b>c,a=(a=a[d?b:c])&&a[d?c:b]):a=a[b];return a}u.contain=function(a){return!!this.register[a]};u.update=function(a,b){return this.remove(a).add(a,b)}; +u.remove=function(a,b){var c=this.register[a];if(c){if(this.m)for(var d=0,f;db||c)f=f.slice(c,c+b);d&&(f=Ba.call(this,f));return{tag:a,result:f}}}function Ba(a){for(var b=Array(a.length),c=0,d;c=c)return g.concat(l.slice(0,c-h));g=g.concat(l);h+=r}return g};function I(a,c){if(!(this instanceof I))return new I(a);let d;if(a){var b=a.charset;d=a.lang;"string"===typeof b&&(-1===b.indexOf(":")&&(b+=":default"),b=F[b]);"string"===typeof d&&(d=E[d])}else a={};let e,g,f,h=a.context||{};this.encode=a.encode||b&&b.encode||v;this.register=c||B();e=a.resolution||9;g=a.threshold||0;g>=e&&(g=e-1);this.i=e;this.s=g;this.F=c=b&&b.G||a.tokenize||"strict";this.m="strict"===c&&h.depth;this.v=z(h.bidirectional,!0);this.g=f="memory"===a.optimize;this.C=z(a.fastupdate,!0); -this.h=a.minlength||1;this.j=f?A(e-g):B();e=h.resolution||e;g=h.threshold||g;g>=e&&(g=e-1);this.l=e;this.D=g;this.B=f?A(e-g):B();this.u=b&&b.u||a.rtl;this.o=(c=a.matcher||d&&d.o)&&D(c,!1);this.A=(c=a.stemmer||d&&d.A)&&D(c,!0);if(a=c=a.filter||d&&d.filter){a=c;b=B();for(let k=0,l=a.length;k=this.h&&(r||!p[q])){var e=Math.min(this.i/l*t|0,t);if(ef;k--)g=q.substring(f,k),g.length>=this.h&&J(this,p,g,h,a,d)}break}case "reverse":if(2< -b){for(f=b-1;0=this.h&&J(this,p,g,e,a,d);g=""}case "forward":if(1=this.h&&J(this,p,g,e,a,d);break;default:if(J(this,p,q,e,a,d),r&&1=this.h&&!e[q]){if(e[q]=1,k=Math.min((this.l-f)/l*t+h|0,t+(h-1)),kg;J(this,m,w?g:q,k,a,d,w?q:g)}}else f=Math.min(f+1,l-t)}}}}this.C||(this.register[a]=1)}}return this}; -function J(a,c,d,b,e,g,f){let h=f?a.B:a.j;if(!c[d]||f&&!c[d][f])a.g&&(h=h[b]),f?(c[d]||(c[d]=B()),c[d][f]=1,h=h[f]||(h[f]=B())):c[d]=1,h=h[d]||(h[d]=[]),a.g||(h=h[b]||(h[b]=[])),g&&-1!==h.indexOf(e)||(h[h.length]=e,a.C&&(a=a.register[e]||(a.register[e]=[]),a[a.length]=h))} -I.prototype.search=function(a,c,d){"object"===typeof a?(d=a,a=d.query):"object"===typeof c&&(d=c);let b=[],e;var g=this.s;let f,h=0;if(d){c=d.limit;h=d.offset||0;g=z(d.threshold,g);var k=d.context;f=!1}if(a&&(a=this.encode(a),e=a.length,1=this.h&&!d[m])if(this.g||f||this.j[m])l[p++]=m,d[m]=1;else return b;a=l;e=a.length}if(!e)return b;c||(c=100);d=this.i-g;g=this.l-g;k=this.m&&1c?b.slice(0,c):b}}return G(b,c,h,f)};function L(a,c,d,b){d?(b=b&&c>d,a=(a=a[b?c:d])&&a[b?d:c]):a=a[c];return a} -function K(a,c,d,b,e,g,f,h){let k=[],l=h?a.B:a.j;a.g||(l=L(l,f,h,a.v));if(l){let r=0;b=Math.min(l.length,b);for(let n=0,p=0,m;n=e)));n++);if(r){if(g)return k=1===r?k[0]:[].concat.apply([],k),k.length>e?k.slice(0,e):k;c[c.length]=k;return}}return!d&&k}I.prototype.contain=function(a){return!!this.register[a]};I.prototype.update=function(a,c){return this.remove(a).add(a,c)}; -I.prototype.remove=function(a,c){const d=this.register[a];if(d){if(this.C)for(let b=0,e;b=b)return g.concat(k.slice(c,b-h+c));g=g.concat(c? +k.slice(c):k);h+=n;c=0}return g};function H(a,b){if(!(this instanceof H))return new H(a);let c;if(a){var d=a.charset;c=a.lang;"string"===typeof d&&(-1===d.indexOf(":")&&(d+=":default"),d=F[d]);"string"===typeof c&&(c=E[c])}else a={};let e,g,f,h=a.context||{};this.encode=a.encode||d&&d.encode||v;this.register=b||B();e=a.resolution||9;g=a.threshold||0;g>=e&&(g=e-1);this.i=e;this.s=g;this.F=b=d&&d.G||a.tokenize||"strict";this.m="strict"===b&&h.depth;this.v=z(h.bidirectional,!0);this.g=f="memory"===a.optimize;this.C=z(a.fastupdate,!0); +this.h=a.minlength||1;this.j=f?A(e-g):B();e=h.resolution||e;g=h.threshold||g;g>=e&&(g=e-1);this.l=e;this.D=g;this.B=f?A(e-g):B();this.u=d&&d.u||a.rtl;this.o=(b=a.matcher||c&&c.o)&&D(b,!1);this.A=(b=a.stemmer||c&&c.A)&&D(b,!0);if(a=b=a.filter||c&&c.filter){a=b;d=B();for(let l=0,k=a.length;l=this.h&&(n||!q[p])){var e=Math.min(this.i/k*m|0,m);if(ef;l--)g=p.substring(f,l),g.length>=this.h&&I(this,q,g,h,a,c)}break}case "reverse":if(2< +d){for(f=d-1;0=this.h&&I(this,q,g,e,a,c);g=""}case "forward":if(1=this.h&&I(this,q,g,e,a,c);break;default:if(I(this,q,p,e,a,c),n&&1=this.h&&!e[p]){if(e[p]=1,l=Math.min((this.l-f)/k*m+h|0,m+(h-1)),lg;I(this,t,x?g:p,l,a,c,x?p:g)}}else f=Math.min(f+1,k-m)}}}}this.C||(this.register[a]=1)}}return this}; +function I(a,b,c,d,e,g,f){let h=f?a.B:a.j;if(!b[c]||f&&!b[c][f])a.g&&(h=h[d]),f?(b=b[c]||(b[c]=B()),b[f]=1,h=h[f]||(h[f]=B())):b[c]=1,h=h[c]||(h[c]=[]),a.g||(h=h[d]||(h[d]=[])),g&&-1!==h.indexOf(e)||(h[h.length]=e,a.C&&(a=a.register[e]||(a.register[e]=[]),a[a.length]=h))} +H.prototype.search=function(a,b,c){"object"===typeof a?(c=a,a=c.query):"object"===typeof b&&(c=b);let d=[],e;var g=this.s;let f,h=0;if(c){b=c.limit;h=c.offset||0;g=z(c.threshold,g);var l=c.context;f=!1}if(a&&(a=this.encode(a),e=a.length,1=this.h&&!c[t])if(this.g||f||this.j[t])k[q++]=t,c[t]=1;else return d;a=k;e=a.length}if(!e)return d;b||(b=100);c=this.i-g;g=this.l-g;l=this.m&&1=e)));q++);if(r){if(f)return K(k,e,0);b[b.length]=k;return}}return!c&&k}function K(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} +function L(a,b,c,d){c?(d=d&&b>c,a=(a=a[d?b:c])&&a[d?c:b]):a=a[b];return a}H.prototype.contain=function(a){return!!this.register[a]};H.prototype.update=function(a,b){return this.remove(a).add(a,b)};H.prototype.remove=function(a,b){const c=this.register[a];if(c){if(this.C)for(let d=0,e;d