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

refactoring and cleanup

This commit is contained in:
Thomas Wilkerling
2025-03-08 09:06:42 +01:00
parent 281fc9288b
commit 7c064696ee
86 changed files with 2923 additions and 3026 deletions

View File

@@ -1943,4 +1943,4 @@ When you are using ESM in Node.js then just use the Modules explained one sectio
- The options `charset` and `lang` was removed from index (replaced by `Encoder.assign({...})`) - The options `charset` and `lang` was removed from index (replaced by `Encoder.assign({...})`)
- Every charset collection (files in folder `/lang/**.js`) is now exported as a config object (instead of a function). This config needs to be created by passing to the constructor `new Encoder(config)` or can be added to an existing instance via `encoder.assign(config)`. The reason was to keep the default encoder configuration when having multiple document indexes. - Every charset collection (files in folder `/lang/**.js`) is now exported as a config object (instead of a function). This config needs to be created by passing to the constructor `new Encoder(config)` or can be added to an existing instance via `encoder.assign(config)`. The reason was to keep the default encoder configuration when having multiple document indexes.
- The property `bool` from DocumentOptions was removed (replaced by `Resolver`) - The property `bool` from DocumentOptions was removed (replaced by `Resolver`)
- The static methods `FlexSearch.registerCharset()` and `FlexSearch.registerLanguage()` was removed, those collections are now exported to `FlexSearch.Charset` and `FlexSearch.Language` which can be accessed as module `import { Charset, Language } from "flexsearch"` - The static methods `FlexSearch.registerCharset()` and `FlexSearch.registerLanguage()` was removed, those collections are now exported to `FlexSearch.Charset` which can be accessed as module `import { Charset } from "flexsearch"` and language packs are now applied by `encoder.assign()`

File diff suppressed because it is too large Load Diff

View File

@@ -6,84 +6,84 @@
* https://github.com/nextapps-de/flexsearch * https://github.com/nextapps-de/flexsearch
*/ */
(function _f(self){'use strict';try{if(module)self=module}catch(e){}self._factory=_f;var u;function y(a,b,c){const d=typeof c,e=typeof a;if("undefined"!==d){if("undefined"!==e){if(c){if("function"===e&&d===e)return function(h){return a(c(h))};b=a.constructor;if(b===c.constructor){if(b===Array)return c.concat(a);if(b===Map){var f=new Map(c);for(var g of a)f.set(g[0],g[1]);return f}if(b===Set){g=new Set(c);for(f of a.values())g.add(f);return g}}}return a}return c}return"undefined"===e?b:a}function z(){return Object.create(null)}function aa(a,b){return b.length-a.length} (function _f(self){'use strict';try{if(module)self=module}catch(e){}self._factory=_f;var u;function y(a,b,c){const d=typeof c,e=typeof a;if("undefined"!==d){if("undefined"!==e){if(c){if("function"===e&&d===e)return function(h){return a(c(h))};b=a.constructor;if(b===c.constructor){if(b===Array)return c.concat(a);if(b===Map){var f=new Map(c);for(var g of a)f.set(g[0],g[1]);return f}if(b===Set){g=new Set(c);for(f of a.values())g.add(f);return g}}}return a}return c}return"undefined"===e?b:a}function z(){return Object.create(null)}function aa(a,b){return b.length-a.length}
function B(a){return"string"===typeof a}function C(a){return"object"===typeof a}function ba(a){const b=[];for(const c of a.keys())b.push(c);return b}function ca(a,b){if(B(b))a=a[b];else for(let c=0;a&&c<b.length;c++)a=a[b[c]];return a}function da(a){let b=0;for(let c=0,d;c<a.length;c++)(d=a[c])&&b<d.length&&(b=d.length);return b};const ea=/[^\p{L}\p{N}]+/u,fa=/(\d{3})/g,ha=/(\D)(\d{3})/g,ia=/(\d{3})(\D)/g,ja="".normalize&&/[\u0300-\u036f]/g,ka=!ja&&new Map([["\u00aa","a"],["\u00b2","2"],["\u00b3","3"],["\u00b9","1"],["\u00ba","o"],["\u00bc","1\u20444"],["\u00bd","1\u20442"],["\u00be","3\u20444"],["\u00e0","a"],["\u00e1","a"],["\u00e2","a"],["\u00e3","a"],["\u00e4","a"],["\u00e5","a"],["\u00e7","c"],["\u00e8","e"],["\u00e9","e"],["\u00ea","e"],["\u00eb","e"],["\u00ec","i"],["\u00ed","i"],["\u00ee","i"],["\u00ef","i"],["\u00f1", function B(a){return"string"===typeof a}function C(a){return"object"===typeof a}function ba(a){const b=[];for(const c of a.keys())b.push(c);return b}function ca(a,b){if(B(b))a=a[b];else for(let c=0;a&&c<b.length;c++)a=a[b[c]];return a}function da(a){let b=0;for(let c=0,d;c<a.length;c++)(d=a[c])&&b<d.length&&(b=d.length);return b};const ea=/[^\p{L}\p{N}]+/u,fa=/(\d{3})/g,ha=/(\D)(\d{3})/g,ia=/(\d{3})(\D)/g,ja="".normalize&&/[\u0300-\u036f]/g,ka=!ja&&[["\u00aa","a"],["\u00b2","2"],["\u00b3","3"],["\u00b9","1"],["\u00ba","o"],["\u00bc","1\u20444"],["\u00bd","1\u20442"],["\u00be","3\u20444"],["\u00e0","a"],["\u00e1","a"],["\u00e2","a"],["\u00e3","a"],["\u00e4","a"],["\u00e5","a"],["\u00e7","c"],["\u00e8","e"],["\u00e9","e"],["\u00ea","e"],["\u00eb","e"],["\u00ec","i"],["\u00ed","i"],["\u00ee","i"],["\u00ef","i"],["\u00f1","n"],
"n"],["\u00f2","o"],["\u00f3","o"],["\u00f4","o"],["\u00f5","o"],["\u00f6","o"],["\u00f9","u"],["\u00fa","u"],["\u00fb","u"],["\u00fc","u"],["\u00fd","y"],["\u00ff","y"],["\u0101","a"],["\u0103","a"],["\u0105","a"],["\u0107","c"],["\u0109","c"],["\u010b","c"],["\u010d","c"],["\u010f","d"],["\u0113","e"],["\u0115","e"],["\u0117","e"],["\u0119","e"],["\u011b","e"],["\u011d","g"],["\u011f","g"],["\u0121","g"],["\u0123","g"],["\u0125","h"],["\u0129","i"],["\u012b","i"],["\u012d","i"],["\u012f","i"],["\u0133", ["\u00f2","o"],["\u00f3","o"],["\u00f4","o"],["\u00f5","o"],["\u00f6","o"],["\u00f9","u"],["\u00fa","u"],["\u00fb","u"],["\u00fc","u"],["\u00fd","y"],["\u00ff","y"],["\u0101","a"],["\u0103","a"],["\u0105","a"],["\u0107","c"],["\u0109","c"],["\u010b","c"],["\u010d","c"],["\u010f","d"],["\u0113","e"],["\u0115","e"],["\u0117","e"],["\u0119","e"],["\u011b","e"],["\u011d","g"],["\u011f","g"],["\u0121","g"],["\u0123","g"],["\u0125","h"],["\u0129","i"],["\u012b","i"],["\u012d","i"],["\u012f","i"],["\u0133",
"ij"],["\u0135","j"],["\u0137","k"],["\u013a","l"],["\u013c","l"],["\u013e","l"],["\u0140","l"],["\u0144","n"],["\u0146","n"],["\u0148","n"],["\u0149","n"],["\u014d","o"],["\u014f","o"],["\u0151","o"],["\u0155","r"],["\u0157","r"],["\u0159","r"],["\u015b","s"],["\u015d","s"],["\u015f","s"],["\u0161","s"],["\u0163","t"],["\u0165","t"],["\u0169","u"],["\u016b","u"],["\u016d","u"],["\u016f","u"],["\u0171","u"],["\u0173","u"],["\u0175","w"],["\u0177","y"],["\u017a","z"],["\u017c","z"],["\u017e","z"], "ij"],["\u0135","j"],["\u0137","k"],["\u013a","l"],["\u013c","l"],["\u013e","l"],["\u0140","l"],["\u0144","n"],["\u0146","n"],["\u0148","n"],["\u0149","n"],["\u014d","o"],["\u014f","o"],["\u0151","o"],["\u0155","r"],["\u0157","r"],["\u0159","r"],["\u015b","s"],["\u015d","s"],["\u015f","s"],["\u0161","s"],["\u0163","t"],["\u0165","t"],["\u0169","u"],["\u016b","u"],["\u016d","u"],["\u016f","u"],["\u0171","u"],["\u0173","u"],["\u0175","w"],["\u0177","y"],["\u017a","z"],["\u017c","z"],["\u017e","z"],
["\u017f","s"],["\u01a1","o"],["\u01b0","u"],["\u01c6","dz"],["\u01c9","lj"],["\u01cc","nj"],["\u01ce","a"],["\u01d0","i"],["\u01d2","o"],["\u01d4","u"],["\u01d6","u"],["\u01d8","u"],["\u01da","u"],["\u01dc","u"],["\u01df","a"],["\u01e1","a"],["\u01e3","ae"],["\u00e6","ae"],["\u01fd","ae"],["\u01e7","g"],["\u01e9","k"],["\u01eb","o"],["\u01ed","o"],["\u01ef","\u0292"],["\u01f0","j"],["\u01f3","dz"],["\u01f5","g"],["\u01f9","n"],["\u01fb","a"],["\u01ff","\u00f8"],["\u0201","a"],["\u0203","a"],["\u0205", ["\u017f","s"],["\u01a1","o"],["\u01b0","u"],["\u01c6","dz"],["\u01c9","lj"],["\u01cc","nj"],["\u01ce","a"],["\u01d0","i"],["\u01d2","o"],["\u01d4","u"],["\u01d6","u"],["\u01d8","u"],["\u01da","u"],["\u01dc","u"],["\u01df","a"],["\u01e1","a"],["\u01e3","ae"],["\u00e6","ae"],["\u01fd","ae"],["\u01e7","g"],["\u01e9","k"],["\u01eb","o"],["\u01ed","o"],["\u01ef","\u0292"],["\u01f0","j"],["\u01f3","dz"],["\u01f5","g"],["\u01f9","n"],["\u01fb","a"],["\u01ff","\u00f8"],["\u0201","a"],["\u0203","a"],["\u0205",
"e"],["\u0207","e"],["\u0209","i"],["\u020b","i"],["\u020d","o"],["\u020f","o"],["\u0211","r"],["\u0213","r"],["\u0215","u"],["\u0217","u"],["\u0219","s"],["\u021b","t"],["\u021f","h"],["\u0227","a"],["\u0229","e"],["\u022b","o"],["\u022d","o"],["\u022f","o"],["\u0231","o"],["\u0233","y"],["\u02b0","h"],["\u02b1","h"],["\u0266","h"],["\u02b2","j"],["\u02b3","r"],["\u02b4","\u0279"],["\u02b5","\u027b"],["\u02b6","\u0281"],["\u02b7","w"],["\u02b8","y"],["\u02e0","\u0263"],["\u02e1","l"],["\u02e2","s"], "e"],["\u0207","e"],["\u0209","i"],["\u020b","i"],["\u020d","o"],["\u020f","o"],["\u0211","r"],["\u0213","r"],["\u0215","u"],["\u0217","u"],["\u0219","s"],["\u021b","t"],["\u021f","h"],["\u0227","a"],["\u0229","e"],["\u022b","o"],["\u022d","o"],["\u022f","o"],["\u0231","o"],["\u0233","y"],["\u02b0","h"],["\u02b1","h"],["\u0266","h"],["\u02b2","j"],["\u02b3","r"],["\u02b4","\u0279"],["\u02b5","\u027b"],["\u02b6","\u0281"],["\u02b7","w"],["\u02b8","y"],["\u02e0","\u0263"],["\u02e1","l"],["\u02e2","s"],
["\u02e3","x"],["\u02e4","\u0295"],["\u0390","\u03b9"],["\u03ac","\u03b1"],["\u03ad","\u03b5"],["\u03ae","\u03b7"],["\u03af","\u03b9"],["\u03b0","\u03c5"],["\u03ca","\u03b9"],["\u03cb","\u03c5"],["\u03cc","\u03bf"],["\u03cd","\u03c5"],["\u03ce","\u03c9"],["\u03d0","\u03b2"],["\u03d1","\u03b8"],["\u03d2","\u03a5"],["\u03d3","\u03a5"],["\u03d4","\u03a5"],["\u03d5","\u03c6"],["\u03d6","\u03c0"],["\u03f0","\u03ba"],["\u03f1","\u03c1"],["\u03f2","\u03c2"],["\u03f5","\u03b5"],["\u0439","\u0438"],["\u0450", ["\u02e3","x"],["\u02e4","\u0295"],["\u0390","\u03b9"],["\u03ac","\u03b1"],["\u03ad","\u03b5"],["\u03ae","\u03b7"],["\u03af","\u03b9"],["\u03b0","\u03c5"],["\u03ca","\u03b9"],["\u03cb","\u03c5"],["\u03cc","\u03bf"],["\u03cd","\u03c5"],["\u03ce","\u03c9"],["\u03d0","\u03b2"],["\u03d1","\u03b8"],["\u03d2","\u03a5"],["\u03d3","\u03a5"],["\u03d4","\u03a5"],["\u03d5","\u03c6"],["\u03d6","\u03c0"],["\u03f0","\u03ba"],["\u03f1","\u03c1"],["\u03f2","\u03c2"],["\u03f5","\u03b5"],["\u0439","\u0438"],["\u0450",
"\u0435"],["\u0451","\u0435"],["\u0453","\u0433"],["\u0457","\u0456"],["\u045c","\u043a"],["\u045d","\u0438"],["\u045e","\u0443"],["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]]); "\u0435"],["\u0451","\u0435"],["\u0453","\u0433"],["\u0457","\u0456"],["\u045c","\u043a"],["\u045d","\u0438"],["\u045e","\u0443"],["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]];
function E(a={}){if(!(this instanceof E))return new E(...arguments);for(a=0;a<arguments.length;a++)this.assign(arguments[a])} function E(a={}){if(!(this instanceof E))return new E(...arguments);for(a=0;a<arguments.length;a++)this.assign(arguments[a])}
E.prototype.assign=function(a){this.normalize=y(a.normalize,!0,this.normalize);let b=a.ga,c=b||a.na||a.split;if("object"===typeof c){let d=!b,e="";a.ga||(e+="\\p{Z}");c.ka&&(e+="\\p{L}");c.oa&&(e+="\\p{N}",d=!!b);c.qa&&(e+="\\p{S}");c.pa&&(e+="\\p{P}");c.control&&(e+="\\p{C}");if(c=c.char)e+="object"===typeof c?c.join(""):c;this.split=new RegExp("["+(b?"^":"")+e+"]+","u");this.numeric=d}else this.split=y(c,ea,this.split),this.numeric=y(this.numeric,!0);this.$=y(a.$,null,this.$);this.V=y(a.V,null, E.prototype.assign=function(a){this.normalize=y(a.normalize,!0,this.normalize);let b=a.ga,c=b||a.na||a.split;if("object"===typeof c){let d=!b,e="";a.ga||(e+="\\p{Z}");c.ka&&(e+="\\p{L}");c.oa&&(e+="\\p{N}",d=!!b);c.qa&&(e+="\\p{S}");c.pa&&(e+="\\p{P}");c.control&&(e+="\\p{C}");if(c=c.char)e+="object"===typeof c?c.join(""):c;this.split=new RegExp("["+(b?"^":"")+e+"]+","u");this.numeric=d}else this.split=y(c,ea,this.split),this.numeric=y(this.numeric,!0);this.$=y(a.$,null,this.$);this.V=y(a.V,null,
this.V);this.rtl=a.rtl||!1;this.C=y(a.C,!0,this.C);this.filter=y((c=a.filter)&&new Set(c),null,this.filter);this.J=y((c=a.J)&&new Map(c),null,this.J);this.D=y((c=a.D)&&new Map(c),null,this.D);this.N=y((c=a.N)&&new Map(c),null,this.N);this.K=y(a.K,null,this.K);this.Z=y(a.Z,1,this.Z);this.ha=y(a.ha,0,this.ha);if(this.cache=c=y(a.cache,!0,this.cache))this.X=null,this.ea="number"===typeof c?c:2E5,this.P=new Map,this.U=new Map,this.B=this.h=128;this.F="";this.ba=null;this.Y="";this.ca=null;if(this.J)for(const d of this.J.keys())this.F+= this.V);ka&&(this.G=new Map(ka));this.rtl=a.rtl||!1;this.C=y(a.C,!0,this.C);this.filter=y((c=a.filter)&&new Set(c),null,this.filter);this.J=y((c=a.J)&&new Map(c),null,this.J);this.G=y((c=a.G)&&new Map(c),null,this.G);this.N=y((c=a.N)&&new Map(c),null,this.N);this.K=y(a.K,null,this.K);this.Z=y(a.Z,1,this.Z);this.ha=y(a.ha,0,this.ha);if(this.cache=c=y(a.cache,!0,this.cache))this.X=null,this.ea="number"===typeof c?c:2E5,this.P=new Map,this.U=new Map,this.B=this.h=128;this.D="";this.ba=null;this.Y="";
(this.F?"|":"")+d;if(this.N)for(const d of this.N.keys())this.Y+=(this.Y?"|":"")+d;return this}; this.ca=null;if(this.J)for(const d of this.J.keys())this.D+=(this.D?"|":"")+d;if(this.N)for(const d of this.N.keys())this.Y+=(this.Y?"|":"")+d;return this};
E.prototype.encode=function(a){if(this.cache&&a.length<=this.h)if(this.X){if(this.P.has(a))return this.P.get(a)}else this.X=setTimeout(la,0,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):ja?a=a.normalize("NFKD").replace(ja,"").toLowerCase():(a=a.toLowerCase(),this.D=this.D?new Map([...ka,...this.D]):new Map(ka)));this.$&&(a=this.$(a));this.numeric&&3<a.length&&(a=a.replace(ha,"$1 $2").replace(ia,"$1 $2").replace(fa,"$1 "));const b=!(this.C||this.D||this.filter||this.J|| E.prototype.encode=function(a){if(this.cache&&a.length<=this.h)if(this.X){if(this.P.has(a))return this.P.get(a)}else this.X=setTimeout(la,0,this);this.normalize&&(a="function"===typeof this.normalize?this.normalize(a):ja?a.normalize("NFKD").replace(ja,"").toLowerCase():a.toLowerCase());this.$&&(a=this.$(a));this.numeric&&3<a.length&&(a=a.replace(ha,"$1 $2").replace(ia,"$1 $2").replace(fa,"$1 "));const b=!(this.C||this.G||this.filter||this.J||this.N||this.K);let c=[],d=this.split||""===this.split?
this.N||this.K);let c=[],d=this.split||""===this.split?a.split(this.split):a;for(let f=0,g,h;f<d.length;f++){if(!(g=h=d[f]))continue;if(g.length<this.Z)continue;if(b){c.push(g);continue}if(this.filter&&this.filter.has(g))continue;if(this.cache&&g.length<=this.B)if(this.X){var e=this.U.get(g);if(e||""===e){e&&c.push(e);continue}}else this.X=setTimeout(la,0,this);let k;this.N&&2<g.length&&(this.ca||(this.ca=new RegExp("(?!^)("+this.Y+")$")),g=g.replace(this.ca,l=>this.N.get(l)),k=1);this.J&&1<g.length&& a.split(this.split):a;for(let f=0,g,h;f<d.length;f++){if(!(g=h=d[f]))continue;if(g.length<this.Z)continue;if(b){c.push(g);continue}if(this.filter&&this.filter.has(g))continue;if(this.cache&&g.length<=this.B)if(this.X){var e=this.U.get(g);if(e||""===e){e&&c.push(e);continue}}else this.X=setTimeout(la,0,this);let k;this.N&&2<g.length&&(this.ca||(this.ca=new RegExp("(?!^)("+this.Y+")$")),g=g.replace(this.ca,l=>this.N.get(l)),k=1);this.J&&1<g.length&&(this.ba||(this.ba=new RegExp("("+this.D+")","g")),
(this.ba||(this.ba=new RegExp("("+this.F+")","g")),g=g.replace(this.ba,l=>this.J.get(l)),k=1);g&&k&&(g.length<this.Z||this.filter&&this.filter.has(g))&&(g="");if(g&&(this.D||this.C&&1<g.length)){e="";for(let l=0,m="",n,q;l<g.length;l++)n=g.charAt(l),n===m&&this.C||((q=this.D&&this.D.get(n))||""===q?q===m&&this.C||!(m=q)||(e+=q):e+=m=n);g=e}if(g&&this.K)for(e=0;g&&e<this.K.length;e+=2)g=g.replace(this.K[e],this.K[e+1]);this.cache&&h.length<=this.B&&(this.U.set(h,g),this.U.size>this.ea&&(this.U.clear(), g=g.replace(this.ba,l=>this.J.get(l)),k=1);g&&k&&(g.length<this.Z||this.filter&&this.filter.has(g))&&(g="");if(g&&(this.G||this.C&&1<g.length)){e="";for(let l=0,m="",n,q;l<g.length;l++)n=g.charAt(l),n===m&&this.C||((q=this.G&&this.G.get(n))||""===q?q===m&&this.C||!(m=q)||(e+=q):e+=m=n);g=e}if(g&&this.K)for(e=0;g&&e<this.K.length;e+=2)g=g.replace(this.K[e],this.K[e+1]);this.cache&&h.length<=this.B&&(this.U.set(h,g),this.U.size>this.ea&&(this.U.clear(),this.B=this.B/1.1|0));g&&c.push(g)}this.V&&(c=
this.B=this.B/1.1|0));g&&c.push(g)}this.V&&(c=this.V(c)||c);this.cache&&a.length<=this.h&&(this.P.set(a,c),this.P.size>this.ea&&(this.P.clear(),this.h=this.h/1.1|0));return c};function la(a){a.X=null;a.P.clear();a.U.clear()};function ma(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();let d=this.cache.get(a);if(!d){d=this.search(a,b,c);if(d instanceof Promise){const e=this;d.then(function(f){e.cache.set(a,f)})}this.cache.set(a,d)}return d}function F(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}F.prototype.set=function(a,b){this.cache.has(a)||(this.cache.set(this.h=a,b),this.limit&&this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value))}; this.V(c)||c);this.cache&&a.length<=this.h&&(this.P.set(a,c),this.P.size>this.ea&&(this.P.clear(),this.h=this.h/1.1|0));return c};function la(a){a.X=null;a.P.clear();a.U.clear()};function ma(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();let d=this.cache.get(a);if(!d){d=this.search(a,b,c);if(d instanceof Promise){const e=this;d.then(function(f){e.cache.set(a,f)})}this.cache.set(a,d)}return d}function F(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}F.prototype.set=function(a,b){this.cache.has(a)||(this.cache.set(this.h=a,b),this.limit&&this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value))};
F.prototype.get=function(a){const b=this.cache.get(a);b&&this.limit&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,b));return b};F.prototype.remove=function(a){for(const b of this.cache){const c=b[0];b[1].includes(a)&&this.cache.delete(c)}};F.prototype.clear=function(){this.cache.clear();this.h=""};function na(a,b,c,d){let e=[];for(let f=0,g;f<a.index.length;f++)if(g=a.index[f],b>=g.length)b-=g.length;else{b=g[d?"splice":"slice"](b,c);const h=b.length;if(h&&(e=e.length?e.concat(b):b,c-=h,d&&(a.length-=h),!c))break;b=0}return e} F.prototype.get=function(a){const b=this.cache.get(a);b&&this.limit&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,b));return b};F.prototype.remove=function(a){for(const b of this.cache){const c=b[0];b[1].includes(a)&&this.cache.delete(c)}};F.prototype.clear=function(){this.cache.clear();this.h=""};function na(a,b,c,d){let e=[];for(let f=0,g;f<a.index.length;f++)if(g=a.index[f],b>=g.length)b-=g.length;else{b=g[d?"splice":"slice"](b,c);const h=b.length;if(h&&(e=e.length?e.concat(b):b,c-=h,d&&(a.length-=h),!c))break;b=0}return e}
function H(a){if(!(this instanceof H))return new H(a);this.index=a?[a]:[];this.length=a?a.length:0;const b=this;return new Proxy([],{get(c,d){if("length"===d)return b.length;if("push"===d)return function(e){b.index[b.index.length-1].push(e);b.length++};if("pop"===d)return function(){if(b.length)return b.length--,b.index[b.index.length-1].pop()};if("indexOf"===d)return function(e){let f=0;for(let g=0,h,k;g<b.index.length;g++){h=b.index[g];k=h.indexOf(e);if(0<=k)return f+k;f+=h.length}return-1};if("includes"=== function H(a){if(!(this instanceof H))return new H(a);this.index=a?[a]:[];this.length=a?a.length:0;const b=this;return new Proxy([],{get(c,d){if("length"===d)return b.length;if("push"===d)return function(e){b.index[b.index.length-1].push(e);b.length++};if("pop"===d)return function(){if(b.length)return b.length--,b.index[b.index.length-1].pop()};if("indexOf"===d)return function(e){let f=0;for(let g=0,h,k;g<b.index.length;g++){h=b.index[g];k=h.indexOf(e);if(0<=k)return f+k;f+=h.length}return-1};if("includes"===
d)return function(e){for(let f=0;f<b.index.length;f++)if(b.index[f].includes(e))return!0;return!1};if("slice"===d)return function(e,f){return na(b,e||0,f||b.length,!1)};if("splice"===d)return function(e,f){return na(b,e||0,f||b.length,!0)};if("constructor"===d)return Array;if("symbol"!==typeof d)return(c=b.index[d/2**31|0])&&c[d]},set(c,d,e){c=d/2**31|0;(b.index[c]||(b.index[c]=[]))[d]=e;b.length++;return!0}})}H.prototype.clear=function(){this.index.length=0};H.prototype.push=function(){}; d)return function(e){for(let f=0;f<b.index.length;f++)if(b.index[f].includes(e))return!0;return!1};if("slice"===d)return function(e,f){return na(b,e||0,f||b.length,!1)};if("splice"===d)return function(e,f){return na(b,e||0,f||b.length,!0)};if("constructor"===d)return Array;if("symbol"!==typeof d)return(c=b.index[d/2**31|0])&&c[d]},set(c,d,e){c=d/2**31|0;(b.index[c]||(b.index[c]=[]))[d]=e;b.length++;return!0}})}H.prototype.clear=function(){this.index.length=0};H.prototype.push=function(){};
function K(a=8){if(!(this instanceof K))return new K(a);this.index=z();this.F=[];this.size=0;32<a?(this.h=oa,this.B=BigInt(a)):(this.h=pa,this.B=a)}K.prototype.get=function(a){const b=this.index[this.h(a)];return b&&b.get(a)};K.prototype.set=function(a,b){var c=this.h(a);let d=this.index[c];d?(c=d.size,d.set(a,b),(c-=d.size)&&this.size++):(this.index[c]=d=new Map([[a,b]]),this.F.push(d))}; function K(a=8){if(!(this instanceof K))return new K(a);this.index=z();this.D=[];this.size=0;32<a?(this.h=oa,this.B=BigInt(a)):(this.h=pa,this.B=a)}K.prototype.get=function(a){const b=this.index[this.h(a)];return b&&b.get(a)};K.prototype.set=function(a,b){var c=this.h(a);let d=this.index[c];d?(c=d.size,d.set(a,b),(c-=d.size)&&this.size++):(this.index[c]=d=new Map([[a,b]]),this.D.push(d))};
function L(a=8){if(!(this instanceof L))return new L(a);this.index=z();this.h=[];32<a?(this.F=oa,this.B=BigInt(a)):(this.F=pa,this.B=a)}L.prototype.add=function(a){var b=this.F(a);let c=this.index[b];c?(b=c.size,c.add(a),(b-=c.size)&&this.size++):(this.index[b]=c=new Set([a]),this.h.push(c))};u=K.prototype;u.has=L.prototype.has=function(a){const b=this.index[this.F(a)];return b&&b.has(a)};u.delete=L.prototype.delete=function(a){const b=this.index[this.F(a)];b&&b.delete(a)&&this.size--}; function L(a=8){if(!(this instanceof L))return new L(a);this.index=z();this.h=[];32<a?(this.D=oa,this.B=BigInt(a)):(this.D=pa,this.B=a)}L.prototype.add=function(a){var b=this.D(a);let c=this.index[b];c?(b=c.size,c.add(a),(b-=c.size)&&this.size++):(this.index[b]=c=new Set([a]),this.h.push(c))};u=K.prototype;u.has=L.prototype.has=function(a){const b=this.index[this.D(a)];return b&&b.has(a)};u.delete=L.prototype.delete=function(a){const b=this.index[this.D(a)];b&&b.delete(a)&&this.size--};
u.clear=L.prototype.clear=function(){this.index=z();this.h=[];this.size=0};u.values=L.prototype.values=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].values())yield b};u.keys=L.prototype.keys=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].keys())yield b};u.entries=L.prototype.entries=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].entries())yield b}; u.clear=L.prototype.clear=function(){this.index=z();this.h=[];this.size=0};u.values=L.prototype.values=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].values())yield b};u.keys=L.prototype.keys=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].keys())yield b};u.entries=L.prototype.entries=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].entries())yield b};
function pa(a){let b=2**this.B-1;if("number"==typeof a)return a&b;let c=0,d=this.B+1;for(let e=0;e<a.length;e++)c=(c*d^a.charCodeAt(e))&b;return 32===this.B?c+2**31:c}function oa(a){let b=BigInt(2)**this.B-BigInt(1);var c=typeof a;if("bigint"===c)return a&b;if("number"===c)return BigInt(a)&b;c=BigInt(0);let d=this.B+BigInt(1);for(let e=0;e<a.length;e++)c=(c*d^BigInt(a.charCodeAt(e)))&b;return c};function qa(a,b,c,d,e,f,g,h){(d=a(c?c+"."+d:d,JSON.stringify(g)))&&d.then?d.then(function(){b.export(a,b,c,e,f+1,h)}):b.export(a,b,c,e,f+1,h)};const ra=z(),M=z();var sa={normalize:function(a){return a.toLowerCase()},C:!1};const ta={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};function ua(a){O.call(a,"add");O.call(a,"append");O.call(a,"search");O.call(a,"update");O.call(a,"remove")}function O(a){this[a+"Async"]=function(){var b=arguments;const c=b[b.length-1];let d;"function"===typeof c&&(d=c,delete b[b.length-1]);this.async=!0;b=this[a].apply(this,b);this.async=!1;b.then?b.then(d):d(b);return b}};z();P.prototype.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.A.has(a))return this.update(a,b);b=this.encoder.encode(b);if(d=b.length){const l=z(),m=z(),n=this.depth,q=this.resolution;for(let t=0;t<d;t++){let p=b[this.rtl?d-1-t:t];var e=p.length;if(e&&(n||!m[p])){var f=this.score?this.score(b,p,t,null,0):Q(q,d,t),g="";switch(this.tokenize){case "full":if(2<e){for(f=0;f<e;f++)for(var h=e;h>f;h--){g=p.substring(f,h);var k=this.score?this.score(b,p,t,g,f):Q(q,d,t,e,f);R(this,m,g,k,a,c)}break}case "reverse":if(1< function pa(a){let b=2**this.B-1;if("number"==typeof a)return a&b;let c=0,d=this.B+1;for(let e=0;e<a.length;e++)c=(c*d^a.charCodeAt(e))&b;return 32===this.B?c+2**31:c}function oa(a){let b=BigInt(2)**this.B-BigInt(1);var c=typeof a;if("bigint"===c)return a&b;if("number"===c)return BigInt(a)&b;c=BigInt(0);let d=this.B+BigInt(1);for(let e=0;e<a.length;e++)c=(c*d^BigInt(a.charCodeAt(e)))&b;return c};function qa(a,b,c,d,e,f,g,h){(d=a(c?c+"."+d:d,JSON.stringify(g)))&&d.then?d.then(function(){b.export(a,b,c,e,f+1,h)}):b.export(a,b,c,e,f+1,h)};var ra={normalize:function(a){return a.toLowerCase()},C:!1};const sa={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};function ta(a){N.call(a,"add");N.call(a,"append");N.call(a,"search");N.call(a,"update");N.call(a,"remove")}function N(a){this[a+"Async"]=function(){var b=arguments;const c=b[b.length-1];let d;"function"===typeof c&&(d=c,delete b[b.length-1]);this.async=!0;b=this[a].apply(this,b);this.async=!1;b.then?b.then(d):d(b);return b}};z();O.prototype.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.A.has(a))return this.update(a,b);b=this.encoder.encode(b);if(d=b.length){const l=z(),m=z(),n=this.depth,q=this.resolution;for(let t=0;t<d;t++){let p=b[this.rtl?d-1-t:t];var e=p.length;if(e&&(n||!m[p])){var f=this.score?this.score(b,p,t,null,0):P(q,d,t),g="";switch(this.tokenize){case "full":if(2<e){for(f=0;f<e;f++)for(var h=e;h>f;h--){g=p.substring(f,h);var k=this.score?this.score(b,p,t,g,f):P(q,d,t,e,f);Q(this,m,g,k,a,c)}break}case "reverse":if(1<
e){for(h=e-1;0<h;h--)g=p[h]+g,k=this.score?this.score(b,p,t,g,h):Q(q,d,t,e,h),R(this,m,g,k,a,c);g=""}case "forward":if(1<e){for(h=0;h<e;h++)g+=p[h],R(this,m,g,f,a,c);break}default:if(R(this,m,p,f,a,c),n&&1<d&&t<d-1)for(e=z(),g=this.da,f=p,h=Math.min(n+1,d-t),e[f]=1,k=1;k<h;k++)if((p=b[this.rtl?d-1-t-k:t+k])&&!e[p]){e[p]=1;const r=this.score?this.score(b,f,t,p,k):Q(g+(d/2>g?0:1),d,t,h-1,k-1),x=this.bidirectional&&p>f;R(this,l,x?f:p,r,a,c,x?p:f)}}}}this.fastupdate||this.A.add(a)}else b=""}this.db&& e){for(h=e-1;0<h;h--)g=p[h]+g,k=this.score?this.score(b,p,t,g,h):P(q,d,t,e,h),Q(this,m,g,k,a,c);g=""}case "forward":if(1<e){for(h=0;h<e;h++)g+=p[h],Q(this,m,g,f,a,c);break}default:if(Q(this,m,p,f,a,c),n&&1<d&&t<d-1)for(e=z(),g=this.da,f=p,h=Math.min(n+1,d-t),e[f]=1,k=1;k<h;k++)if((p=b[this.rtl?d-1-t-k:t+k])&&!e[p]){e[p]=1;const r=this.score?this.score(b,f,t,p,k):P(g+(d/2>g?0:1),d,t,h-1,k-1),x=this.bidirectional&&p>f;Q(this,l,x?f:p,r,a,c,x?p:f)}}}}this.fastupdate||this.A.add(a)}else b=""}this.db&&
(b||this.R.push({del:a}),this.fa&&va(this));return this};function R(a,b,c,d,e,f,g){let h=g?a.I:a.map,k;if(!b[c]||!g||!(k=b[c])[g])if(g?(b=k||(b[c]=z()),b[g]=1,(k=h.get(g))?h=k:h.set(g,h=new Map)):b[c]=1,(k=h.get(c))?h=k:h.set(c,h=k=[]),h=h[d]||(h[d]=[]),!f||!h.includes(e)){if(h.length===2**31-1){b=new H(h);if(a.fastupdate)for(let l of a.A.values())l.includes(h)&&(l[l.indexOf(h)]=b);k[d]=h=b}h.push(e);a.fastupdate&&((d=a.A.get(e))?d.push(h):a.A.set(e,[h]))}} (b||this.R.push({del:a}),this.fa&&ua(this));return this};function Q(a,b,c,d,e,f,g){let h=g?a.I:a.map,k;if(!b[c]||!g||!(k=b[c])[g])if(g?(b=k||(b[c]=z()),b[g]=1,(k=h.get(g))?h=k:h.set(g,h=new Map)):b[c]=1,(k=h.get(c))?h=k:h.set(c,h=k=[]),h=h[d]||(h[d]=[]),!f||!h.includes(e)){if(h.length===2**31-1){b=new H(h);if(a.fastupdate)for(let l of a.A.values())l.includes(h)&&(l[l.indexOf(h)]=b);k[d]=h=b}h.push(e);a.fastupdate&&((d=a.A.get(e))?d.push(h):a.A.set(e,[h]))}}
function Q(a,b,c,d,e){return c&&1<a?b+(d||0)<=a?c+(e||0):(a-1)/(b+(d||0))*(c+(e||0))+1|0:0};function S(a,b,c,d){if(1===a.length)return a=a[0],a=c||a.length>b?b?a.slice(c,c+b):a.slice(c):a,d?wa(a):a;let e=[];for(let f=0,g,h;f<a.length;f++)if((g=a[f])&&(h=g.length)){if(c){if(c>=h){c-=h;continue}c<h&&(g=b?g.slice(c,c+b):g.slice(c),h=g.length,c=0)}if(e.length)h>b&&(g=g.slice(0,b),h=g.length),e.push(g);else{if(h>=b)return h>b&&(g=g.slice(0,b)),d?wa(g):g;e=[g]}b-=h;if(!b)break}if(!e.length)return e;e=1<e.length?[].concat.apply([],e):e[0];return d?wa(e):e} function P(a,b,c,d,e){return c&&1<a?b+(d||0)<=a?c+(e||0):(a-1)/(b+(d||0))*(c+(e||0))+1|0:0};function R(a,b,c,d){if(1===a.length)return a=a[0],a=c||a.length>b?b?a.slice(c,c+b):a.slice(c):a,d?va(a):a;let e=[];for(let f=0,g,h;f<a.length;f++)if((g=a[f])&&(h=g.length)){if(c){if(c>=h){c-=h;continue}c<h&&(g=b?g.slice(c,c+b):g.slice(c),h=g.length,c=0)}if(e.length)h>b&&(g=g.slice(0,b),h=g.length),e.push(g);else{if(h>=b)return h>b&&(g=g.slice(0,b)),d?va(g):g;e=[g]}b-=h;if(!b)break}if(!e.length)return e;e=1<e.length?[].concat.apply([],e):e[0];return d?va(e):e}
function wa(a){for(let b=0;b<a.length;b++)a[b]={score:b,id:a[b]};return a};T.prototype.or=function(){const a=this;let b=arguments;var c=b[0];if(c instanceof Promise)return c.then(function(){return a.or.apply(a,b)});if(c[0]&&c[0].index)return this.or.apply(this,c);let d=[];c=[];let e=0,f=0,g,h;for(let k=0,l;k<b.length;k++)if(l=b[k]){let m;if(l instanceof T)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.and)m=this.and(l.and);else if(l.xor)m=this.xor(l.xor);else if(l.G)m=this.G(l.G);else{e=l.limit||0;f=l.offset|| function va(a){for(let b=0;b<a.length;b++)a[b]={score:b,id:a[b]};return a};S.prototype.or=function(){const a=this;let b=arguments;var c=b[0];if(c instanceof Promise)return c.then(function(){return a.or.apply(a,b)});if(c[0]&&c[0].index)return this.or.apply(this,c);let d=[];c=[];let e=0,f=0,g,h;for(let k=0,l;k<b.length;k++)if(l=b[k]){let m;if(l instanceof S)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.and)m=this.and(l.and);else if(l.xor)m=this.xor(l.xor);else if(l.F)m=this.F(l.F);else{e=l.limit||0;f=l.offset||
0;g=l.enrich;h=l.resolve;continue}d[k]=m;m instanceof Promise&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=[a.result].concat(d));a.result=xa(d,e,f,g,h,a.O);return h?a.result:a});this.result.length&&(d=[this.result].concat(d));this.result=xa(d,e,f,g,h,a.O);return h?this.result:this}; 0;g=l.enrich;h=l.resolve;continue}d[k]=m;m instanceof Promise&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=[a.result].concat(d));a.result=wa(d,e,f,g,h,a.O);return h?a.result:a});this.result.length&&(d=[this.result].concat(d));this.result=wa(d,e,f,g,h,a.O);return h?this.result:this};
function xa(a,b,c,d,e,f){if(!a.length)return a;"object"===typeof b&&(c=b.offset||0,d=b.enrich||!1,b=b.limit||0);if(2>a.length)return e?S(a[0],b,c,d):a[0];d=[];let g=0,h=z(),k=da(a);for(let l=0,m;l<k;l++)for(let n=0,q;n<a.length;n++)if(q=a[n])if(m=q[l])for(let t=0,p;t<m.length;t++)if(p=m[t],!h[p])if(h[p]=1,c)c--;else{if(e)d.push(p);else{const r=l+(n?f:0);d[r]||(d[r]=[]);d[r].push(p)}if(b&&++g===b)return d}return d};T.prototype.and=function(){if(this.result.length){const b=this;let c=arguments;var a=c[0];if(a instanceof Promise)return a.then(function(){return b.and.apply(b,c)});if(a[0]&&a[0].index)return this.and.apply(this,a);let d=[];a=[];let e=0,f=0,g;for(let h=0,k;h<c.length;h++)if(k=c[h]){let l;if(k instanceof T)l=k.result;else if(k.constructor===Array)l=k;else if(k.index)k.resolve=!1,l=k.index.search(k).result;else if(k.or)l=this.or(k.or);else if(k.xor)l=this.xor(k.xor);else if(k.G)l=this.G(k.G);else{e= function wa(a,b,c,d,e,f){if(!a.length)return a;"object"===typeof b&&(c=b.offset||0,d=b.enrich||!1,b=b.limit||0);if(2>a.length)return e?R(a[0],b,c,d):a[0];d=[];let g=0,h=z(),k=da(a);for(let l=0,m;l<k;l++)for(let n=0,q;n<a.length;n++)if(q=a[n])if(m=q[l])for(let t=0,p;t<m.length;t++)if(p=m[t],!h[p])if(h[p]=1,c)c--;else{if(e)d.push(p);else{const r=l+(n?f:0);d[r]||(d[r]=[]);d[r].push(p)}if(b&&++g===b)return d}return d};S.prototype.and=function(){if(this.result.length){const b=this;let c=arguments;var a=c[0];if(a instanceof Promise)return a.then(function(){return b.and.apply(b,c)});if(a[0]&&a[0].index)return this.and.apply(this,a);let d=[];a=[];let e=0,f=0,g;for(let h=0,k;h<c.length;h++)if(k=c[h]){let l;if(k instanceof S)l=k.result;else if(k.constructor===Array)l=k;else if(k.index)k.resolve=!1,l=k.index.search(k).result;else if(k.or)l=this.or(k.or);else if(k.xor)l=this.xor(k.xor);else if(k.F)l=this.F(k.F);else{e=
k.limit||0;f=k.offset||0;g=k.resolve;continue}d[h]=l;l instanceof Promise&&a.push(l)}if(a.length)return Promise.all(a).then(function(){d=[b.result].concat(d);b.result=ya(d,e,f,g,b.O);return g?b.result:b});d=[this.result].concat(d);this.result=ya(d,e,f,g,b.O);return g?this.result:this}return this}; k.limit||0;f=k.offset||0;g=k.resolve;continue}d[h]=l;l instanceof Promise&&a.push(l)}if(a.length)return Promise.all(a).then(function(){d=[b.result].concat(d);b.result=xa(d,e,f,g,b.O);return g?b.result:b});d=[this.result].concat(d);this.result=xa(d,e,f,g,b.O);return g?this.result:this}return this};
function ya(a,b,c,d,e){if(2>a.length)return[];let f=[],g=0,h=z(),k=da(a);if(!k)return f;for(let l=0,m;l<a.length;l++){m=a[l];if(!m||!m.length)return[];let n=z(),q=0,t=l===a.length-1;for(let p=0,r;p<k;p++)if(r=m[p])for(let x=0,A,w;x<r.length;x++)if(A=r[x],!l)n[A]=p+1+(l?e:0),q=1;else if(t){if(w=h[A])if(q=1,c)c--;else if(d?f.push(A):(w--,p<w&&(w=p),f[w]||(f[w]=[]),f[w].push(A)),b&&++g===b)return f}else if(w=h[A])p+1<w&&(w=p+1),n[A]=w,q=1;if(!q)return[];h=n}return f};T.prototype.xor=function(){const a=this;let b=arguments;var c=b[0];if(c instanceof Promise)return c.then(function(){return a.xor.apply(a,b)});if(c[0]&&c[0].index)return this.xor.apply(this,c);let d=[];c=[];let e=0,f=0,g,h;for(let k=0,l;k<b.length;k++)if(l=b[k]){let m;if(l instanceof T)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.or)m=this.or(l.or);else if(l.and)m=this.and(l.and);else if(l.G)m=this.G(l.G);else{e=l.limit||0;f=l.offset|| function xa(a,b,c,d,e){if(2>a.length)return[];let f=[],g=0,h=z(),k=da(a);if(!k)return f;for(let l=0,m;l<a.length;l++){m=a[l];if(!m||!m.length)return[];let n=z(),q=0,t=l===a.length-1;for(let p=0,r;p<k;p++)if(r=m[p])for(let x=0,A,w;x<r.length;x++)if(A=r[x],!l)n[A]=p+1+(l?e:0),q=1;else if(t){if(w=h[A])if(q=1,c)c--;else if(d?f.push(A):(w--,p<w&&(w=p),f[w]||(f[w]=[]),f[w].push(A)),b&&++g===b)return f}else if(w=h[A])p+1<w&&(w=p+1),n[A]=w,q=1;if(!q)return[];h=n}return f};S.prototype.xor=function(){const a=this;let b=arguments;var c=b[0];if(c instanceof Promise)return c.then(function(){return a.xor.apply(a,b)});if(c[0]&&c[0].index)return this.xor.apply(this,c);let d=[];c=[];let e=0,f=0,g,h;for(let k=0,l;k<b.length;k++)if(l=b[k]){let m;if(l instanceof S)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.or)m=this.or(l.or);else if(l.and)m=this.and(l.and);else if(l.F)m=this.F(l.F);else{e=l.limit||0;f=l.offset||
0;g=l.enrich;h=l.resolve;continue}d[k]=m;m instanceof Promise&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=[a.result].concat(d));a.result=za(d,e,f,g,!h,a.O);return h?a.result:a});this.result.length&&(d=[this.result].concat(d));this.result=za(d,e,f,g,!h,a.O);return h?this.result:this}; 0;g=l.enrich;h=l.resolve;continue}d[k]=m;m instanceof Promise&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=[a.result].concat(d));a.result=ya(d,e,f,g,!h,a.O);return h?a.result:a});this.result.length&&(d=[this.result].concat(d));this.result=ya(d,e,f,g,!h,a.O);return h?this.result:this};
function za(a,b,c,d,e,f){if(!a.length)return a;if(2>a.length)return e?S(a[0],b,c,d):a[0];b=[];c=z();for(let g=0,h;g<a.length;g++)if(h=a[g])for(let k=0,l;k<h.length;k++)if(l=h[k])for(let m=0,n;m<l.length;m++)n=l[m],c[n]?c[n]++:c[n]=1;for(let g=0,h;g<a.length;g++)if(h=a[g])for(let k=0,l;k<h.length;k++)if(l=h[k])for(let m=0,n;m<l.length;m++)n=l[m],1===c[n]&&(e?b.push(n):(d=k+(g?f:0),b[d]||(b[d]=[]),b[d].push(n)));return b};T.prototype.G=function(){const a=this;let b=arguments;var c=b[0];if(c instanceof Promise)return c.then(function(){return a.G.apply(a,b)});if(c[0]&&c[0].index)return this.G.apply(this,c);let d=[];c=[];let e;for(let f=0,g;f<b.length;f++)if(g=b[f]){let h;if(g instanceof T)h=g.result;else if(g.constructor===Array)h=g;else if(g.index)g.resolve=!1,h=g.index.search(g).result;else if(g.or)h=this.or(g.or);else if(g.and)h=this.and(g.and);else if(g.xor)h=this.xor(g.xor);else{e=g.resolve;continue}d[f]=h;h instanceof function ya(a,b,c,d,e,f){if(!a.length)return a;if(2>a.length)return e?R(a[0],b,c,d):a[0];b=[];c=z();for(let g=0,h;g<a.length;g++)if(h=a[g])for(let k=0,l;k<h.length;k++)if(l=h[k])for(let m=0,n;m<l.length;m++)n=l[m],c[n]?c[n]++:c[n]=1;for(let g=0,h;g<a.length;g++)if(h=a[g])for(let k=0,l;k<h.length;k++)if(l=h[k])for(let m=0,n;m<l.length;m++)n=l[m],1===c[n]&&(e?b.push(n):(d=k+(g?f:0),b[d]||(b[d]=[]),b[d].push(n)));return b};S.prototype.F=function(){const a=this;let b=arguments;var c=b[0];if(c instanceof Promise)return c.then(function(){return a.F.apply(a,b)});if(c[0]&&c[0].index)return this.F.apply(this,c);let d=[];c=[];let e;for(let f=0,g;f<b.length;f++)if(g=b[f]){let h;if(g instanceof S)h=g.result;else if(g.constructor===Array)h=g;else if(g.index)g.resolve=!1,h=g.index.search(g).result;else if(g.or)h=this.or(g.or);else if(g.and)h=this.and(g.and);else if(g.xor)h=this.xor(g.xor);else{e=g.resolve;continue}d[f]=h;h instanceof
Promise&&c.push(h)}if(c.length)return Promise.all(c).then(function(){a.result=Aa.call(a,d,e);return e?a.result:a});this.result=Aa.call(this,d,e);return e?this.result:this};function Aa(a,b){if(!a.length)return this.result;const c=[];a=new Set(a.flat().flat());for(let d=0,e;d<this.result.length;d++)if(e=this.result[d])for(let f=0,g;f<e.length;f++)g=e[f],a.has(g)||(b?c.push(g):(c[d]||(c[d]=[]),c[d].push(g)));return c};function T(a){if(a&&a.index)return a.resolve=!1,this.index=a.index,a.index.search(a);if(!(this instanceof T))return new T(a);if(a instanceof T)return a;this.index=null;this.result=a||[];this.O=0}T.prototype.limit=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)if(e=this.result[d],e.length+c<a)b[d]=e,c+=e.length;else{b[d]=e.slice(0,a-c);this.result=b;break}}return this}; Promise&&c.push(h)}if(c.length)return Promise.all(c).then(function(){a.result=za.call(a,d,e);return e?a.result:a});this.result=za.call(this,d,e);return e?this.result:this};function za(a,b){if(!a.length)return this.result;const c=[];a=new Set(a.flat().flat());for(let d=0,e;d<this.result.length;d++)if(e=this.result[d])for(let f=0,g;f<e.length;f++)g=e[f],a.has(g)||(b?c.push(g):(c[d]||(c[d]=[]),c[d].push(g)));return c};function S(a){if(a&&a.index)return a.resolve=!1,this.index=a.index,a.index.search(a);if(!(this instanceof S))return new S(a);if(a instanceof S)return a;this.index=null;this.result=a||[];this.O=0}S.prototype.limit=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)if(e=this.result[d],e.length+c<a)b[d]=e,c+=e.length;else{b[d]=e.slice(0,a-c);this.result=b;break}}return this};
T.prototype.offset=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)e=this.result[d],e.length+c<a?c+=e.length:(b[d]=e.slice(a-c),c=a);this.result=b}return this};T.prototype.resolve=function(a,b,c){U=1;const d=this.result;this.result=this.index=null;return d.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),S(d,a||100,b,c)):d};function Ba(a,b,c,d){var e=a.length;let f=[],g=0,h,k,l;d&&(d=[]);for(let m=e-1,n;0<=m;m--){l=a[m];e=z();n=!h;for(let q=0,t;q<l.length;q++)if((t=l[q])&&t.length)for(let p=0,r;p<t.length;p++)if(r=t[p],h){if(h[r]){if(!m)if(c)c--;else if(f[g++]=r,g===b)return f;if(m||d)e[r]=1;n=!0}d&&!k[r]&&(k[r]=1,(d[q]||(d[q]=[])).push(r))}else e[r]=1;if(d)h||(k=e);else if(!n)return[];h=e}if(d)for(let m=d.length-1,n,q;0<=m;m--){n=d[m];q=n.length;for(let t=0,p;t<q;t++)if(p=n[t],!h[p]){if(c)c--;else if(f[g++]=p,g===b)return f; S.prototype.offset=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)e=this.result[d],e.length+c<a?c+=e.length:(b[d]=e.slice(a-c),c=a);this.result=b}return this};S.prototype.resolve=function(a,b,c){T=1;const d=this.result;this.result=this.index=null;return d.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),R(d,a||100,b,c)):d};function Aa(a,b,c,d){var e=a.length;let f=[],g=0,h,k,l;d&&(d=[]);for(let m=e-1,n;0<=m;m--){l=a[m];e=z();n=!h;for(let q=0,t;q<l.length;q++)if((t=l[q])&&t.length)for(let p=0,r;p<t.length;p++)if(r=t[p],h){if(h[r]){if(!m)if(c)c--;else if(f[g++]=r,g===b)return f;if(m||d)e[r]=1;n=!0}d&&!k[r]&&(k[r]=1,(d[q]||(d[q]=[])).push(r))}else e[r]=1;if(d)h||(k=e);else if(!n)return[];h=e}if(d)for(let m=d.length-1,n,q;0<=m;m--){n=d[m];q=n.length;for(let t=0,p;t<q;t++)if(p=n[t],!h[p]){if(c)c--;else if(f[g++]=p,g===b)return f;
h[p]=1}}return f}function Ca(a,b){const c=z(),d=z(),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 h=0,k;h<g.length;h++)k=g[h],c[k]&&!d[k]&&(d[k]=1,e.push(k))}return e};let U=1; h[p]=1}}return f}function Ba(a,b){const c=z(),d=z(),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 h=0,k;h<g.length;h++)k=g[h],c[k]&&!d[k]&&(d[k]=1,e.push(k))}return e};let T=1;
P.prototype.search=function(a,b,c){c||(!b&&C(a)?(c=a,a=""):C(b)&&(c=b,b=0));let d=[],e;let f,g=0,h,k,l;if(c){a=c.query||a;b=c.limit||b;g=c.offset||0;var m=c.context;f=c.suggest;(h=U&&!1!==c.resolve)||(U=0);k=h&&c.enrich;l=this.db&&c.tag}else h=this.resolve||U;a=this.encoder.encode(a);e=a.length;b||!h||(b=100);if(1===e)return Da.call(this,a[0],"",b,g,h,k,l);m=this.depth&&!1!==m;if(2===e&&m&&!f)return Da.call(this,a[0],a[1],b,g,h,k,l);let n=c=0;if(1<e){const p=z(),r=[];for(let x=0,A;x<e;x++)if((A=a[x])&& O.prototype.search=function(a,b,c){c||(!b&&C(a)?(c=a,a=""):C(b)&&(c=b,b=0));let d=[],e;let f,g=0,h,k,l;if(c){a=c.query||a;b=c.limit||b;g=c.offset||0;var m=c.context;f=c.suggest;(h=T&&!1!==c.resolve)||(T=0);k=h&&c.enrich;l=this.db&&c.tag}else h=this.resolve||T;a=this.encoder.encode(a);e=a.length;b||!h||(b=100);if(1===e)return Ca.call(this,a[0],"",b,g,h,k,l);m=this.depth&&!1!==m;if(2===e&&m&&!f)return Ca.call(this,a[0],a[1],b,g,h,k,l);let n=c=0;if(1<e){const p=z(),r=[];for(let x=0,A;x<e;x++)if((A=a[x])&&
!p[A]){if(f||this.db||V(this,A))r.push(A),p[A]=1;else return h?d:new T(d);const w=A.length;c=Math.max(c,w);n=n?Math.min(n,w):w}a=r;e=a.length}if(!e)return h?d:new T(d);let q=0,t;if(1===e)return Da.call(this,a[0],"",b,g,h,k,l);if(2===e&&m&&!f)return Da.call(this,a[0],a[1],b,g,h,k,l);1<e&&(m?(t=a[0],q=1):9<c&&3<c/n&&a.sort(aa));if(this.db){if(this.db.search&&(m=this.db.search(this,a,b,g,f,h,k,l),!1!==m))return m;const p=this;return async function(){for(let r,x;q<e;q++){x=a[q];t?(r=await V(p,x,t),r= !p[A]){if(f||this.db||U(this,A))r.push(A),p[A]=1;else return h?d:new S(d);const w=A.length;c=Math.max(c,w);n=n?Math.min(n,w):w}a=r;e=a.length}if(!e)return h?d:new S(d);let q=0,t;if(1===e)return Ca.call(this,a[0],"",b,g,h,k,l);if(2===e&&m&&!f)return Ca.call(this,a[0],a[1],b,g,h,k,l);1<e&&(m?(t=a[0],q=1):9<c&&3<c/n&&a.sort(aa));if(this.db){if(this.db.search&&(m=this.db.search(this,a,b,g,f,h,k,l),!1!==m))return m;const p=this;return async function(){for(let r,x;q<e;q++){x=a[q];t?(r=await U(p,x,t),r=
Ea(r,d,f,p.da,b,g,2===e),f&&!1===r&&d.length||(t=x)):(r=await V(p,x),r=Ea(r,d,f,p.resolution,b,g,1===e));if(r)return r;if(f&&q===e-1){let A=d.length;if(!A){if(t){t="";q=-1;continue}return d}if(1===A)return h?S(d[0],b,g):new T(d[0])}}return h?Ba(d,b,g,f):new T(d[0])}()}for(let p,r;q<e;q++){r=a[q];t?(p=V(this,r,t),p=Ea(p,d,f,this.da,b,g,2===e),f&&!1===p&&d.length||(t=r)):(p=V(this,r),p=Ea(p,d,f,this.resolution,b,g,1===e));if(p)return p;if(f&&q===e-1){m=d.length;if(!m){if(t){t="";q=-1;continue}return d}if(1=== Da(r,d,f,p.da,b,g,2===e),f&&!1===r&&d.length||(t=x)):(r=await U(p,x),r=Da(r,d,f,p.resolution,b,g,1===e));if(r)return r;if(f&&q===e-1){let A=d.length;if(!A){if(t){t="";q=-1;continue}return d}if(1===A)return h?R(d[0],b,g):new S(d[0])}}return h?Aa(d,b,g,f):new S(d[0])}()}for(let p,r;q<e;q++){r=a[q];t?(p=U(this,r,t),p=Da(p,d,f,this.da,b,g,2===e),f&&!1===p&&d.length||(t=r)):(p=U(this,r),p=Da(p,d,f,this.resolution,b,g,1===e));if(p)return p;if(f&&q===e-1){m=d.length;if(!m){if(t){t="";q=-1;continue}return d}if(1===
m)return h?S(d[0],b,g):new T(d[0])}}return h?Ba(d,b,g,f):new T(d[0])};function Da(a,b,c,d,e,f,g){a=V(this,a,b,c,d,e,f,g);return this.db?a.then(function(h){return e?h:h&&h.length?e?S(h,c,d):new T(h):e?[]:new T([])}):a&&a.length?e?S(a,c,d):new T(a):e?[]:new T([])} m)return h?R(d[0],b,g):new S(d[0])}}return h?Aa(d,b,g,f):new S(d[0])};function Ca(a,b,c,d,e,f,g){a=U(this,a,b,c,d,e,f,g);return this.db?a.then(function(h){return e?h:h&&h.length?e?R(h,c,d):new S(h):e?[]:new S([])}):a&&a.length?e?R(a,c,d):new S(a):e?[]:new S([])}
function Ea(a,b,c,d,e,f,g){let h=[];if(a){d=Math.min(a.length,d);for(let k=0,l=0,m;k<d;k++)if(m=a[k])if(f&&m&&g&&(m.length<=f?(f-=m.length,m=null):(m=m.slice(f),f=0)),m&&(h[k]=m,g&&(l+=m.length,l>=e)))break;if(h.length){if(g)return S(h,e,0);b.push(h);return}}return!c&&h}function V(a,b,c,d,e,f,g,h){let k;c&&(k=a.bidirectional&&b>c);if(a.db)return c?a.db.get(k?c:b,k?b:c,d,e,f,g,h):a.db.get(b,"",d,e,f,g,h);a=c?(a=a.I.get(k?b:c))&&a.get(k?c:b):a.map.get(b);return a};P.prototype.remove=function(a,b){const c=this.A.size&&(this.fastupdate?this.A.get(a):this.A.has(a));if(c){if(this.fastupdate)for(let d=0,e;d<c.length;d++){if(e=c[d])if(2>e.length)e.pop();else{const f=e.indexOf(a);f===c.length-1?e.pop():e.splice(f,1)}}else Fa(this.map,a),this.depth&&Fa(this.I,a);b||this.A.delete(a)}this.db&&(this.R.push({del:a}),this.fa&&va(this));this.cache&&this.cache.remove(a);return this}; function Da(a,b,c,d,e,f,g){let h=[];if(a){d=Math.min(a.length,d);for(let k=0,l=0,m;k<d;k++)if(m=a[k])if(f&&m&&g&&(m.length<=f?(f-=m.length,m=null):(m=m.slice(f),f=0)),m&&(h[k]=m,g&&(l+=m.length,l>=e)))break;if(h.length){if(g)return R(h,e,0);b.push(h);return}}return!c&&h}function U(a,b,c,d,e,f,g,h){let k;c&&(k=a.bidirectional&&b>c);if(a.db)return c?a.db.get(k?c:b,k?b:c,d,e,f,g,h):a.db.get(b,"",d,e,f,g,h);a=c?(a=a.I.get(k?b:c))&&a.get(k?c:b):a.map.get(b);return a};O.prototype.remove=function(a,b){const c=this.A.size&&(this.fastupdate?this.A.get(a):this.A.has(a));if(c){if(this.fastupdate)for(let d=0,e;d<c.length;d++){if(e=c[d])if(2>e.length)e.pop();else{const f=e.indexOf(a);f===c.length-1?e.pop():e.splice(f,1)}}else Ea(this.map,a),this.depth&&Ea(this.I,a);b||this.A.delete(a)}this.db&&(this.R.push({del:a}),this.fa&&ua(this));this.cache&&this.cache.remove(a);return this};
function Fa(a,b){let c=0;if(a.constructor===Array)for(let d=0,e,f;d<a.length;d++){if((e=a[d])&&e.length)if(f=e.indexOf(b),0<=f){1<e.length?(e.splice(f,1),c++):delete a[d];break}else c++}else for(let d of a){const e=d[0],f=Fa(d[1],b);f?c+=f:a.delete(e)}return c};function P(a,b){if(!(this instanceof P))return new P(a);if(a){var c=B(a)?a:a.preset;c&&(a=Object.assign({},ta[c],a))}else a={};c=a.context||{};const d=a.encode||a.encoder||sa;this.encoder=d.encode?d:"object"===typeof d?new E(d):{encode:d};let e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&c.depth||0;this.bidirectional=!1!==c.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;(e=a.keystore||0)&&(this.keystore=e);this.map=e?new K(e): function Ea(a,b){let c=0;if(a.constructor===Array)for(let d=0,e,f;d<a.length;d++){if((e=a[d])&&e.length)if(f=e.indexOf(b),0<=f){1<e.length?(e.splice(f,1),c++):delete a[d];break}else c++}else for(let d of a){const e=d[0],f=Ea(d[1],b);f?c+=f:a.delete(e)}return c};function O(a,b){if(!(this instanceof O))return new O(a);if(a){var c=B(a)?a:a.preset;c&&(a=Object.assign({},sa[c],a))}else a={};c=a.context||{};const d=a.encode||a.encoder||ra;this.encoder=d.encode?d:"object"===typeof d?new E(d):{encode:d};let e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&c.depth||0;this.bidirectional=!1!==c.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;(e=a.keystore||0)&&(this.keystore=e);this.map=e?new K(e):
new Map;this.I=e?new K(e):new Map;this.A=b||(this.fastupdate?e?new K(e):new Map:e?new L(e):new Set);this.da=c.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new F(e);this.resolve=!1!==a.resolve;if(e=a.db)this.db=e.mount(this);this.fa=!1!==a.commit;this.R=[];this.h=null}u=P.prototype;u.mount=function(a){this.h&&(clearTimeout(this.h),this.h=null);return a.mount(this)};u.commit=function(a,b){this.h&&(clearTimeout(this.h),this.h=null);return this.db.commit(this,a,b)}; new Map;this.I=e?new K(e):new Map;this.A=b||(this.fastupdate?e?new K(e):new Map:e?new L(e):new Set);this.da=c.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new F(e);this.resolve=!1!==a.resolve;if(e=a.db)this.db=e.mount(this);this.fa=!1!==a.commit;this.R=[];this.h=null}u=O.prototype;u.mount=function(a){this.h&&(clearTimeout(this.h),this.h=null);return a.mount(this)};u.commit=function(a,b){this.h&&(clearTimeout(this.h),this.h=null);return this.db.commit(this,a,b)};
function va(a){a.h||(a.h=setTimeout(function(){a.h=null;a.db.commit(a,void 0,void 0)},0))}u.clear=function(){this.map.clear();this.I.clear();this.A.clear();this.cache&&this.cache.clear();this.db&&(this.h&&clearTimeout(this.h),this.h=null,this.R=[{clear:!0}]);return this};u.append=function(a,b){return this.add(a,b,!0)};u.contain=function(a){return this.db?this.db.has(a):this.A.has(a)}; function ua(a){a.h||(a.h=setTimeout(function(){a.h=null;a.db.commit(a,void 0,void 0)},0))}u.clear=function(){this.map.clear();this.I.clear();this.A.clear();this.cache&&this.cache.clear();this.db&&(this.h&&clearTimeout(this.h),this.h=null,this.R=[{clear:!0}]);return this};u.append=function(a,b){return this.add(a,b,!0)};u.contain=function(a){return this.db?this.db.has(a):this.A.has(a)};
u.update=function(a,b){if(this.async){const c=this,d=this.remove(a);return d.then?d.then(()=>c.add(a,b)):this.add(a,b)}return this.remove(a).add(a,b)};function Ga(a){let b=0;if(a.constructor===Array)for(let c=0,d;c<a.length;c++)(d=a[c])&&(b+=d.length);else for(const c of a){const d=c[0],e=Ga(c[1]);e?b+=e:a.delete(d)}return b}u.cleanup=function(){if(!this.fastupdate)return this;Ga(this.map);this.depth&&Ga(this.I);return this};u.searchCache=ma; u.update=function(a,b){if(this.async){const c=this,d=this.remove(a);return d.then?d.then(()=>c.add(a,b)):this.add(a,b)}return this.remove(a).add(a,b)};function Fa(a){let b=0;if(a.constructor===Array)for(let c=0,d;c<a.length;c++)(d=a[c])&&(b+=d.length);else for(const c of a){const d=c[0],e=Fa(c[1]);e?b+=e:a.delete(d)}return b}u.cleanup=function(){if(!this.fastupdate)return this;Fa(this.map);this.depth&&Fa(this.I);return this};u.searchCache=ma;
u.export=function(a,b,c,d,e,f){let g=!0;"undefined"===typeof f&&(g=new Promise(l=>{f=l}));let h,k;switch(e||(e=0)){case 0:h="reg";if(this.fastupdate){k=z();for(let l of this.A.keys())k[l]=1}else k=this.A;break;case 1:h="cfg";k={doc:0,opt:this.B?1:0};break;case 2:h="map";k=this.map;break;case 3:h="ctx";k=this.I;break;default:"undefined"===typeof c&&f&&f();return}qa(a,b||this,c,h,d,e,k,f);return g}; u.export=function(a,b,c,d,e,f){let g=!0;"undefined"===typeof f&&(g=new Promise(l=>{f=l}));let h,k;switch(e||(e=0)){case 0:h="reg";if(this.fastupdate){k=z();for(let l of this.A.keys())k[l]=1}else k=this.A;break;case 1:h="cfg";k={doc:0,opt:this.B?1:0};break;case 2:h="map";k=this.map;break;case 3:h="ctx";k=this.I;break;default:"undefined"===typeof c&&f&&f();return}qa(a,b||this,c,h,d,e,k,f);return g};
u.import=function(a,b){if(b)switch(B(b)&&(b=JSON.parse(b)),a){case "cfg":this.B=!!b.opt;break;case "reg":this.fastupdate=!1;this.A=b;break;case "map":this.map=b;break;case "ctx":this.I=b}};ua(P.prototype);async function Ha(a){a=a.data;var b=self._index;const c=a.args;var d=a.task;switch(d){case "init":d=a.options||{};(b=d.config)&&(d=await import(b));(b=a.factory)?(Function("return "+b)()(self),self._index=new self.FlexSearch.Index(d),delete self.FlexSearch):self._index=new P(d);postMessage({id:a.id});break;default:a=a.id,b=b[d].apply(b,c),postMessage("search"===d?{id:a,msg:b}:{id:a})}};let Ia=0; u.import=function(a,b){if(b)switch(B(b)&&(b=JSON.parse(b)),a){case "cfg":this.B=!!b.opt;break;case "reg":this.fastupdate=!1;this.A=b;break;case "map":this.map=b;break;case "ctx":this.I=b}};ta(O.prototype);async function Ga(a){a=a.data;var b=self._index;const c=a.args;var d=a.task;switch(d){case "init":d=a.options||{};(b=d.config)&&(d=await import(b));(b=a.factory)?(Function("return "+b)()(self),self._index=new self.FlexSearch.Index(d),delete self.FlexSearch):self._index=new O(d);postMessage({id:a.id});break;default:a=a.id,b=b[d].apply(b,c),postMessage("search"===d?{id:a,msg:b}:{id:a})}};let Ha=0;
function W(a){function b(f){f=f.data||f;const g=f.id,h=g&&e.h[g];h&&(h(f.msg),delete e.h[g])}if(!(this instanceof W))return new W(a);a||(a={});let c=(self||window)._factory;c&&(c=c.toString());const d="undefined"===typeof window&&self.exports,e=this;this.worker=Ja(c,d,a.worker);this.h=z();if(this.worker){d?this.worker.on("message",b):this.worker.onmessage=b;if(a.config)return new Promise(function(f){e.h[++Ia]=function(){f(e)};e.worker.postMessage({id:Ia,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init", function V(a){function b(f){f=f.data||f;const g=f.id,h=g&&e.h[g];h&&(h(f.msg),delete e.h[g])}if(!(this instanceof V))return new V(a);a||(a={});let c=(self||window)._factory;c&&(c=c.toString());const d="undefined"===typeof window&&self.exports,e=this;this.worker=Ia(c,d,a.worker);this.h=z();if(this.worker){d?this.worker.on("message",b):this.worker.onmessage=b;if(a.config)return new Promise(function(f){e.h[++Ha]=function(){f(e)};e.worker.postMessage({id:Ha,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",
factory:c,options:a})}}X("add");X("append");X("search");X("update");X("remove");function X(a){W.prototype[a]=W.prototype[a+"Async"]=function(){const b=this,c=[].slice.call(arguments);var d=c[c.length-1];let e;"function"===typeof d&&(e=d,c.splice(c.length-1,1));d=new Promise(function(f){b.h[++Ia]=f;b.worker.postMessage({task:a,id:Ia,args:c})});return e?(d.then(e),this):d}} factory:c,options:a})}}W("add");W("append");W("search");W("update");W("remove");function W(a){V.prototype[a]=V.prototype[a+"Async"]=function(){const b=this,c=[].slice.call(arguments);var d=c[c.length-1];let e;"function"===typeof d&&(e=d,c.splice(c.length-1,1));d=new Promise(function(f){b.h[++Ha]=f;b.worker.postMessage({task:a,id:Ha,args:c})});return e?(d.then(e),this):d}}
function Ja(a,b,c){return b?new (require("worker_threads")["Worker"])(__dirname + "/node/node.js"):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+Ha.toString()],{type:"text/javascript"}))):new window.Worker(B(c)?c:"worker/worker.js",{type:"module"})};Y.prototype.add=function(a,b,c){C(a)&&(b=a,a=ca(b,this.key));if(b&&(a||0===a)){if(!c&&this.A.has(a))return this.update(a,b);for(let h=0,k;h<this.field.length;h++){k=this.M[h];var d=this.index.get(this.field[h]);if("function"===typeof k){var e=k(b);e&&d.add(a,e,!1,!0)}else if(e=k.T,!e||e(b))k instanceof String?k=[""+k]:B(k)&&(k=[k]),Ka(b,k,this.W,0,d,a,k[0],c)}if(this.tag)for(d=0;d<this.L.length;d++){var f=this.L[d];e=this.tag.get(this.aa[d]);let h=z();if("function"===typeof f){if(f=f(b),!f)continue}else{var g= function Ia(a,b,c){return b?new (require("worker_threads")["Worker"])(__dirname + "/node/node.js"):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+Ga.toString()],{type:"text/javascript"}))):new window.Worker(B(c)?c:"worker/worker.js",{type:"module"})};X.prototype.add=function(a,b,c){C(a)&&(b=a,a=ca(b,this.key));if(b&&(a||0===a)){if(!c&&this.A.has(a))return this.update(a,b);for(let h=0,k;h<this.field.length;h++){k=this.M[h];var d=this.index.get(this.field[h]);if("function"===typeof k){var e=k(b);e&&d.add(a,e,!1,!0)}else if(e=k.T,!e||e(b))k instanceof String?k=[""+k]:B(k)&&(k=[k]),Ja(b,k,this.W,0,d,a,k[0],c)}if(this.tag)for(d=0;d<this.L.length;d++){var f=this.L[d];e=this.tag.get(this.aa[d]);let h=z();if("function"===typeof f){if(f=f(b),!f)continue}else{var g=
f.T;if(g&&!g(b))continue;f instanceof String&&(f=""+f);f=ca(b,f)}if(e&&f){B(f)&&(f=[f]);for(let k=0,l,m;k<f.length;k++)if(l=f[k],!h[l]&&(h[l]=1,(g=e.get(l))?m=g:e.set(l,m=[]),!c||!m.includes(a))){if(m.length===2**31-1){g=new H(m);if(this.fastupdate)for(let n of this.A.values())n.includes(m)&&(n[n.indexOf(m)]=g);e.set(l,m=g)}m.push(a);this.fastupdate&&((g=this.A.get(a))?g.push(m):this.A.set(a,[m]))}}}if(this.store&&(!c||!this.store.has(a))){let h;if(this.H){h=z();for(let k=0,l;k<this.H.length;k++){l= f.T;if(g&&!g(b))continue;f instanceof String&&(f=""+f);f=ca(b,f)}if(e&&f){B(f)&&(f=[f]);for(let k=0,l,m;k<f.length;k++)if(l=f[k],!h[l]&&(h[l]=1,(g=e.get(l))?m=g:e.set(l,m=[]),!c||!m.includes(a))){if(m.length===2**31-1){g=new H(m);if(this.fastupdate)for(let n of this.A.values())n.includes(m)&&(n[n.indexOf(m)]=g);e.set(l,m=g)}m.push(a);this.fastupdate&&((g=this.A.get(a))?g.push(m):this.A.set(a,[m]))}}}if(this.store&&(!c||!this.store.has(a))){let h;if(this.H){h=z();for(let k=0,l;k<this.H.length;k++){l=
this.H[k];if((c=l.T)&&!c(b))continue;let m;if("function"===typeof l){m=l(b);if(!m)continue;l=[l.ia]}else if(B(l)||l instanceof String){h[l]=b[l];continue}La(b,h,l,0,l[0],m)}}this.store.set(a,h||b)}}return this};function La(a,b,c,d,e,f){a=a[e];if(d===c.length-1)b[e]=f||a;else if(a)if(a.constructor===Array)for(b=b[e]=Array(a.length),e=0;e<a.length;e++)La(a,b,c,d,e);else b=b[e]||(b[e]=z()),e=c[++d],La(a,b,c,d,e)} this.H[k];if((c=l.T)&&!c(b))continue;let m;if("function"===typeof l){m=l(b);if(!m)continue;l=[l.ia]}else if(B(l)||l instanceof String){h[l]=b[l];continue}Ka(b,h,l,0,l[0],m)}}this.store.set(a,h||b)}}return this};function Ka(a,b,c,d,e,f){a=a[e];if(d===c.length-1)b[e]=f||a;else if(a)if(a.constructor===Array)for(b=b[e]=Array(a.length),e=0;e<a.length;e++)Ka(a,b,c,d,e);else b=b[e]||(b[e]=z()),e=c[++d],Ka(a,b,c,d,e)}
function Ka(a,b,c,d,e,f,g,h){if(a=a[g])if(d===b.length-1){if(a.constructor===Array){if(c[d]){for(b=0;b<a.length;b++)e.add(f,a[b],!0,!0);return}a=a.join(" ")}e.add(f,a,h,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)Ka(a,b,c,d,e,f,g,h);else g=b[++d],Ka(a,b,c,d,e,f,g,h);else e.db&&e.remove(f)};Y.prototype.search=function(a,b,c,d){c||(!b&&C(a)?(c=a,a=""):C(b)&&(c=b,b=0));let e=[],f=[],g;let h;let k;let l,m=0;if(c)if(c.constructor===Array)k=c,c=null;else{a=c.query||a;g=c.pluck;h=c.merge;k=g||c.field||c.index;var n=this.tag&&c.tag;var q=this.store&&c.enrich;var t=c.suggest;b=c.limit||b;l=c.offset||0;b||(b=100);if(n&&(!this.db||!d)){n.constructor!==Array&&(n=[n]);var p=[];for(let w=0,v;w<n.length;w++)if(v=n[w],v.field&&v.tag){var r=v.tag;if(r.constructor===Array)for(var x=0;x<r.length;x++)p.push(v.field, function Ja(a,b,c,d,e,f,g,h){if(a=a[g])if(d===b.length-1){if(a.constructor===Array){if(c[d]){for(b=0;b<a.length;b++)e.add(f,a[b],!0,!0);return}a=a.join(" ")}e.add(f,a,h,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)Ja(a,b,c,d,e,f,g,h);else g=b[++d],Ja(a,b,c,d,e,f,g,h);else e.db&&e.remove(f)};X.prototype.search=function(a,b,c,d){c||(!b&&C(a)?(c=a,a=""):C(b)&&(c=b,b=0));let e=[],f=[],g;let h;let k;let l,m=0;if(c)if(c.constructor===Array)k=c,c=null;else{a=c.query||a;g=c.pluck;h=c.merge;k=g||c.field||c.index;var n=this.tag&&c.tag;var q=this.store&&c.enrich;var t=c.suggest;b=c.limit||b;l=c.offset||0;b||(b=100);if(n&&(!this.db||!d)){n.constructor!==Array&&(n=[n]);var p=[];for(let w=0,v;w<n.length;w++)if(v=n[w],v.field&&v.tag){var r=v.tag;if(r.constructor===Array)for(var x=0;x<r.length;x++)p.push(v.field,
r[x]);else p.push(v.field,r)}else{r=Object.keys(v);for(let I=0,J,D;I<r.length;I++)if(J=r[I],D=v[J],D.constructor===Array)for(x=0;x<D.length;x++)p.push(J,D[x]);else p.push(J,D)}n=p;if(!a){t=[];if(p.length)for(n=0;n<p.length;n+=2){if(this.db){d=this.index.get(p[n]);if(!d)continue;t.push(d=d.db.tag(p[n+1],b,l,q))}else d=Ma.call(this,p[n],p[n+1],b,l,q);e.push({field:p[n],tag:p[n+1],result:d})}return t.length?Promise.all(t).then(function(w){for(let v=0;v<w.length;v++)e[v].result=w[v];return e}):e}}B(k)&& r[x]);else p.push(v.field,r)}else{r=Object.keys(v);for(let I=0,J,D;I<r.length;I++)if(J=r[I],D=v[J],D.constructor===Array)for(x=0;x<D.length;x++)p.push(J,D[x]);else p.push(J,D)}n=p;if(!a){t=[];if(p.length)for(n=0;n<p.length;n+=2){if(this.db){d=this.index.get(p[n]);if(!d)continue;t.push(d=d.db.tag(p[n+1],b,l,q))}else d=La.call(this,p[n],p[n+1],b,l,q);e.push({field:p[n],tag:p[n+1],result:d})}return t.length?Promise.all(t).then(function(w){for(let v=0;v<w.length;v++)e[v].result=w[v];return e}):e}}B(k)&&
(k=[k])}k||(k=this.field);p=!d&&(this.worker||this.async)&&[];let A;for(let w=0,v,I,J;w<k.length;w++){I=k[w];if(this.db&&this.tag&&!this.M[w])continue;let D;B(I)||(D=I,I=D.field,a=D.query||a,b=D.limit||b,t=D.suggest||t);if(d)v=d[w];else if(r=D||c,x=this.index.get(I),n&&(this.db&&(r.tag=n,A=x.db.la,r.field=k),A||(r.enrich=!1)),p){p[w]=x.searchAsync(a,b,r);r&&q&&(r.enrich=q);continue}else v=x.search(a,b,r),r&&q&&(r.enrich=q);J=v&&v.length;if(n&&J){r=[];x=0;if(this.db&&d){if(!A)for(let N=k.length;N< (k=[k])}k||(k=this.field);p=!d&&(this.worker||this.async)&&[];let A;for(let w=0,v,I,J;w<k.length;w++){I=k[w];if(this.db&&this.tag&&!this.M[w])continue;let D;B(I)||(D=I,I=D.field,a=D.query||a,b=D.limit||b,t=D.suggest||t);if(d)v=d[w];else if(r=D||c,x=this.index.get(I),n&&(this.db&&(r.tag=n,A=x.db.la,r.field=k),A||(r.enrich=!1)),p){p[w]=x.searchAsync(a,b,r);r&&q&&(r.enrich=q);continue}else v=x.search(a,b,r),r&&q&&(r.enrich=q);J=v&&v.length;if(n&&J){r=[];x=0;if(this.db&&d){if(!A)for(let M=k.length;M<
d.length;N++){let G=d[N];if(G&&G.length)x++,r.push(G);else if(!t)return e}}else for(let N=0,G,$a;N<n.length;N+=2){G=this.tag.get(n[N]);if(!G)if(t)continue;else return e;if($a=(G=G&&G.get(n[N+1]))&&G.length)x++,r.push(G);else if(!t)return e}if(x){v=Ca(v,r);J=v.length;if(!J&&!t)return e;x--}}if(J)f[m]=I,e.push(v),m++;else if(1===k.length)return e}if(p){if(this.db&&n&&n.length&&!A)for(q=0;q<n.length;q+=2){d=this.index.get(n[q]);if(!d)if(t)continue;else return e;p.push(d.db.tag(n[q+1],b,l,!1))}const w= d.length;M++){let G=d[M];if(G&&G.length)x++,r.push(G);else if(!t)return e}}else for(let M=0,G,Za;M<n.length;M+=2){G=this.tag.get(n[M]);if(!G)if(t)continue;else return e;if(Za=(G=G&&G.get(n[M+1]))&&G.length)x++,r.push(G);else if(!t)return e}if(x){v=Ba(v,r);J=v.length;if(!J&&!t)return e;x--}}if(J)f[m]=I,e.push(v),m++;else if(1===k.length)return e}if(p){if(this.db&&n&&n.length&&!A)for(q=0;q<n.length;q+=2){d=this.index.get(n[q]);if(!d)if(t)continue;else return e;p.push(d.db.tag(n[q+1],b,l,!1))}const w=
this;return Promise.all(p).then(function(v){return v.length?w.search(a,b,c,v):v})}if(!m)return e;if(g&&(!q||!this.store))return e[0];p=[];for(let w=0,v;w<f.length;w++){v=e[w];q&&v.length&&!v[0].doc&&(this.db?p.push(v=this.index.get(this.field[0]).db.enrich(v)):v.length&&(v=Na.call(this,v)));if(g)return v;e[w]={field:f[w],result:v}}return q&&this.db&&p.length?Promise.all(p).then(function(w){for(let v=0;v<w.length;v++)e[v].result=w[v];return h?Oa(e,b):e}):h?Oa(e,b):e}; this;return Promise.all(p).then(function(v){return v.length?w.search(a,b,c,v):v})}if(!m)return e;if(g&&(!q||!this.store))return e[0];p=[];for(let w=0,v;w<f.length;w++){v=e[w];q&&v.length&&!v[0].doc&&(this.db?p.push(v=this.index.get(this.field[0]).db.enrich(v)):v.length&&(v=Ma.call(this,v)));if(g)return v;e[w]={field:f[w],result:v}}return q&&this.db&&p.length?Promise.all(p).then(function(w){for(let v=0;v<w.length;v++)e[v].result=w[v];return h?Na(e,b):e}):h?Na(e,b):e};
function Oa(a,b){const c=[],d=z();for(let e=0,f,g;e<a.length;e++){f=a[e];g=f.result;for(let h=0,k,l,m;h<g.length;h++)if(l=g[h],k=l.id,m=d[k])m.push(f.field);else{if(c.length===b)return c;l.field=d[k]=[f.field];c.push(l)}}return c}function Ma(a,b,c,d,e){a=this.tag.get(a);if(!a)return[];if((b=(a=a&&a.get(b))&&a.length-d)&&0<b){if(b>c||d)a=a.slice(d,d+c);e&&(a=Na.call(this,a));return a}} function Na(a,b){const c=[],d=z();for(let e=0,f,g;e<a.length;e++){f=a[e];g=f.result;for(let h=0,k,l,m;h<g.length;h++)if(l=g[h],k=l.id,m=d[k])m.push(f.field);else{if(c.length===b)return c;l.field=d[k]=[f.field];c.push(l)}}return c}function La(a,b,c,d,e){a=this.tag.get(a);if(!a)return[];if((b=(a=a&&a.get(b))&&a.length-d)&&0<b){if(b>c||d)a=a.slice(d,d+c);e&&(a=Ma.call(this,a));return a}}
function Na(a){const b=Array(a.length);for(let c=0,d;c<a.length;c++)d=a[c],b[c]={id:d,doc:this.store.get(d)};return b};function Y(a){if(!(this instanceof Y))return new Y(a);const b=a.document||a.doc||a;var c,d;this.M=[];this.field=[];this.W=[];this.key=(c=b.key||b.id)&&Pa(c,this.W)||"id";(d=a.keystore||0)&&(this.keystore=d);this.A=(this.fastupdate=!!a.fastupdate)?d?new K(d):new Map:d?new L(d):new Set;this.H=(c=b.store||null)&&!0!==c&&[];this.store=c&&(d?new K(d):new Map);this.cache=(c=a.cache||null)&&new F(c);a.cache=!1;this.worker=a.worker;this.async=!1;c=new Map;d=b.index||b.field||b;B(d)&&(d=[d]);for(let e=0,f, function Ma(a){const b=Array(a.length);for(let c=0,d;c<a.length;c++)d=a[c],b[c]={id:d,doc:this.store.get(d)};return b};function X(a){if(!(this instanceof X))return new X(a);const b=a.document||a.doc||a;var c,d;this.M=[];this.field=[];this.W=[];this.key=(c=b.key||b.id)&&Oa(c,this.W)||"id";(d=a.keystore||0)&&(this.keystore=d);this.A=(this.fastupdate=!!a.fastupdate)?d?new K(d):new Map:d?new L(d):new Set;this.H=(c=b.store||null)&&!0!==c&&[];this.store=c&&(d?new K(d):new Map);this.cache=(c=a.cache||null)&&new F(c);a.cache=!1;this.worker=a.worker;this.async=!1;c=new Map;d=b.index||b.field||b;B(d)&&(d=[d]);for(let e=0,f,
g;e<d.length;e++){f=d[e];B(f)||(g=f,f=f.field);g=C(g)?Object.assign({},a,g):a;if(this.worker){const h=new W(g);c.set(f,h);h.worker||(this.worker=!1)}this.worker||c.set(f,new P(g,this.A));g.S?this.M[e]=g.S:(this.M[e]=Pa(f,this.W),g.filter&&("string"===typeof this.M[e]&&(this.M[e]=new String(this.M[e])),this.M[e].T=g.filter));this.field[e]=f}if(this.H){d=b.store;B(d)&&(d=[d]);for(let e=0,f,g;e<d.length;e++)f=d[e],g=f.field||f,f.S?(this.H[e]=f.S,f.S.ia=g):(this.H[e]=Pa(g,this.W),f.filter&&("string"=== g;e<d.length;e++){f=d[e];B(f)||(g=f,f=f.field);g=C(g)?Object.assign({},a,g):a;if(this.worker){const h=new V(g);c.set(f,h);h.worker||(this.worker=!1)}this.worker||c.set(f,new O(g,this.A));g.S?this.M[e]=g.S:(this.M[e]=Oa(f,this.W),g.filter&&("string"===typeof this.M[e]&&(this.M[e]=new String(this.M[e])),this.M[e].T=g.filter));this.field[e]=f}if(this.H){d=b.store;B(d)&&(d=[d]);for(let e=0,f,g;e<d.length;e++)f=d[e],g=f.field||f,f.S?(this.H[e]=f.S,f.S.ia=g):(this.H[e]=Oa(g,this.W),f.filter&&("string"===
typeof this.H[e]&&(this.H[e]=new String(this.H[e])),this.H[e].T=f.filter))}this.index=c;this.tag=null;if(c=b.tag)if("string"===typeof c&&(c=[c]),c.length){this.tag=new Map;this.L=[];this.aa=[];for(let e=0,f,g;e<c.length;e++){f=c[e];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");f.S?this.L[e]=f.S:(this.L[e]=Pa(g,this.W),f.filter&&("string"===typeof this.L[e]&&(this.L[e]=new String(this.L[e])),this.L[e].T=f.filter));this.aa[e]=g;this.tag.set(g,new Map)}}a.db&& typeof this.H[e]&&(this.H[e]=new String(this.H[e])),this.H[e].T=f.filter))}this.index=c;this.tag=null;if(c=b.tag)if("string"===typeof c&&(c=[c]),c.length){this.tag=new Map;this.L=[];this.aa=[];for(let e=0,f,g;e<c.length;e++){f=c[e];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");f.S?this.L[e]=f.S:(this.L[e]=Oa(g,this.W),f.filter&&("string"===typeof this.L[e]&&(this.L[e]=new String(this.L[e])),this.L[e].T=f.filter));this.aa[e]=g;this.tag.set(g,new Map)}}a.db&&
this.mount(a.db)}u=Y.prototype; this.mount(a.db)}u=X.prototype;
u.mount=function(a){let b=this.field;if(this.tag)for(let e=0,f;e<this.aa.length;e++){f=this.aa[e];var c=this.index.get(f);c||(this.index.set(f,c=new P({},this.A)),b===this.field&&(b=b.slice(0)),b.push(f));c.tag=this.tag.get(f)}c=[];const d={db:a.db,type:a.type,fastupdate:a.fastupdate};for(let e=0,f,g;e<b.length;e++){d.field=g=b[e];f=this.index.get(g);const h=new a.constructor(a.id,d);h.id=a.id;c[e]=h.mount(f);f.document=!0;e?f.ja=!0:f.store=this.store}this.db=this.async=!0;return Promise.all(c)}; u.mount=function(a){let b=this.field;if(this.tag)for(let e=0,f;e<this.aa.length;e++){f=this.aa[e];var c=this.index.get(f);c||(this.index.set(f,c=new O({},this.A)),b===this.field&&(b=b.slice(0)),b.push(f));c.tag=this.tag.get(f)}c=[];const d={db:a.db,type:a.type,fastupdate:a.fastupdate};for(let e=0,f,g;e<b.length;e++){d.field=g=b[e];f=this.index.get(g);const h=new a.constructor(a.id,d);h.id=a.id;c[e]=h.mount(f);f.document=!0;e?f.ja=!0:f.store=this.store}this.db=this.async=!0;return Promise.all(c)};
u.commit=async function(a,b){const c=[];for(const d of this.index.values())c.push(d.db.commit(d,a,b));await Promise.all(c);this.A.clear()};function Pa(a,b){const c=a.split(":");let d=0;for(let e=0;e<c.length;e++)a=c[e],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(b[d]=!0),a&&(c[d++]=a);d<c.length&&(c.length=d);return 1<d?c:c[0]}u.append=function(a,b){return this.add(a,b,!0)};u.update=function(a,b){return this.remove(a).add(a,b)}; u.commit=async function(a,b){const c=[];for(const d of this.index.values())c.push(d.db.commit(d,a,b));await Promise.all(c);this.A.clear()};function Oa(a,b){const c=a.split(":");let d=0;for(let e=0;e<c.length;e++)a=c[e],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(b[d]=!0),a&&(c[d++]=a);d<c.length&&(c.length=d);return 1<d?c:c[0]}u.append=function(a,b){return this.add(a,b,!0)};u.update=function(a,b){return this.remove(a).add(a,b)};
u.remove=function(a){C(a)&&(a=ca(a,this.key));for(var b of this.index.values())b.remove(a,!0);if(this.A.has(a)){if(this.tag&&!this.fastupdate)for(let c of this.tag.values())for(let d of c){b=d[0];const e=d[1],f=e.indexOf(a);-1<f&&(1<e.length?e.splice(f,1):c.delete(b))}this.store&&this.store.delete(a);this.A.delete(a)}this.cache&&this.cache.remove(a);return this}; u.remove=function(a){C(a)&&(a=ca(a,this.key));for(var b of this.index.values())b.remove(a,!0);if(this.A.has(a)){if(this.tag&&!this.fastupdate)for(let c of this.tag.values())for(let d of c){b=d[0];const e=d[1],f=e.indexOf(a);-1<f&&(1<e.length?e.splice(f,1):c.delete(b))}this.store&&this.store.delete(a);this.A.delete(a)}this.cache&&this.cache.remove(a);return this};
u.clear=function(){for(const a of this.index.values())a.clear();if(this.tag)for(const a of this.tag.values())a.clear();this.store&&this.store.clear();return this};u.contain=function(a){return this.db?this.index.get(this.field[0]).db.has(a):this.A.has(a)};u.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};u.get=function(a){return this.db?this.index.get(this.field[0]).db.enrich(a).then(function(b){return b[0]&&b[0].doc}):this.store.get(a)}; u.clear=function(){for(const a of this.index.values())a.clear();if(this.tag)for(const a of this.tag.values())a.clear();this.store&&this.store.clear();return this};u.contain=function(a){return this.db?this.index.get(this.field[0]).db.has(a):this.A.has(a)};u.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};u.get=function(a){return this.db?this.index.get(this.field[0]).db.enrich(a).then(function(b){return b[0]&&b[0].doc}):this.store.get(a)};
u.set=function(a,b){this.store.set(a,b);return this};u.searchCache=ma;u.export=function(a,b,c,d,e,f){let g;"undefined"===typeof f&&(g=new Promise(k=>{f=k}));e||(e=0);d||(d=0);if(d<this.field.length){c=this.field[d];var h=this.index[c];b=this;h.export(a,b,e?c:"",d,e++,f)||(d++,b.export(a,b,c,d,1,f))}else{switch(e){case 1:b="tag";h=this.h;c=null;break;case 2:b="store";h=this.store;c=null;break;default:f();return}qa(a,this,c,b,d,e,h,f)}return g}; u.set=function(a,b){this.store.set(a,b);return this};u.searchCache=ma;u.export=function(a,b,c,d,e,f){let g;"undefined"===typeof f&&(g=new Promise(k=>{f=k}));e||(e=0);d||(d=0);if(d<this.field.length){c=this.field[d];var h=this.index[c];b=this;h.export(a,b,e?c:"",d,e++,f)||(d++,b.export(a,b,c,d,1,f))}else{switch(e){case 1:b="tag";h=this.h;c=null;break;case 2:b="store";h=this.store;c=null;break;default:f();return}qa(a,this,c,b,d,e,h,f)}return g};
u.import=function(a,b){if(b)switch(B(b)&&(b=JSON.parse(b)),a){case "tag":this.h=b;break;case "reg":this.fastupdate=!1;this.A=b;for(let d=0,e;d<this.field.length;d++)e=this.index[this.field[d]],e.A=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)}};ua(Y.prototype);const Qa="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),Ra=["map","ctx","tag","reg","cfg"]; u.import=function(a,b){if(b)switch(B(b)&&(b=JSON.parse(b)),a){case "tag":this.h=b;break;case "reg":this.fastupdate=!1;this.A=b;for(let d=0,e;d<this.field.length;d++)e=this.index[this.field[d]],e.A=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)}};ta(X.prototype);const Pa="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),Qa=["map","ctx","tag","reg","cfg"];
function Sa(a,b={}){if(!(this instanceof Sa))return new Sa(a,b);"object"===typeof a&&(b=a=a.name);a||console.info("Default storage space was used, because a name was not passed.");this.id="flexsearch"+(a?":"+a.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"");this.field=b.field?b.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"";this.la=!1;this.db=null;this.h={}}u=Sa.prototype;u.mount=function(a){if(a instanceof Y)return a.mount(this);a.db=this;return Ta(this)}; function Ra(a,b={}){if(!(this instanceof Ra))return new Ra(a,b);"object"===typeof a&&(b=a=a.name);a||console.info("Default storage space was used, because a name was not passed.");this.id="flexsearch"+(a?":"+a.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"");this.field=b.field?b.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"";this.la=!1;this.db=null;this.h={}}u=Ra.prototype;u.mount=function(a){if(a instanceof X)return a.mount(this);a.db=this;return Sa(this)};
function Ta(a){navigator.storage&&navigator.storage.persist();return a.db||new Promise(function(b,c){const d=Qa.open(a.id+(a.field?":"+a.field:""),1);d.onupgradeneeded=function(){const e=a.db=this.result;Ra.forEach(f=>{e.objectStoreNames.contains(f)||e.createObjectStore(f)})};d.onblocked=function(e){console.error("blocked",e);c()};d.onerror=function(e){console.error(this.error,e);c()};d.onsuccess=function(){a.db=this.result;a.db.onversionchange=function(){a.close()};b(a)}})} function Sa(a){navigator.storage&&navigator.storage.persist();return a.db||new Promise(function(b,c){const d=Pa.open(a.id+(a.field?":"+a.field:""),1);d.onupgradeneeded=function(){const e=a.db=this.result;Qa.forEach(f=>{e.objectStoreNames.contains(f)||e.createObjectStore(f)})};d.onblocked=function(e){console.error("blocked",e);c()};d.onerror=function(e){console.error(this.error,e);c()};d.onsuccess=function(){a.db=this.result;a.db.onversionchange=function(){a.close()};b(a)}})}
u.close=function(){this.db.close();this.db=null};u.clear=function(){const a=this.db.transaction(Ra,"readwrite");for(let b=0;b<Ra.length;b++)a.objectStore(Ra[b]).clear();return Z(a)}; u.close=function(){this.db.close();this.db=null};u.clear=function(){const a=this.db.transaction(Qa,"readwrite");for(let b=0;b<Qa.length;b++)a.objectStore(Qa[b]).clear();return Y(a)};
u.get=function(a,b,c=0,d=0,e=!0,f=!1){a=this.db.transaction(b?"ctx":"map","readonly").objectStore(b?"ctx":"map").get(b?b+":"+a:a);const g=this;return Z(a).then(function(h){let k=[];if(!h||!h.length)return k;if(e){if(!c&&!d&&1===h.length)return h[0];for(let l=0,m;l<h.length;l++)if((m=h[l])&&m.length){if(d>=m.length){d-=m.length;continue}const n=c?d+Math.min(m.length-d,c):m.length;for(let q=d;q<n;q++)k.push(m[q]);d=0;if(k.length===c)break}return f?g.enrich(k):k}return h})}; u.get=function(a,b,c=0,d=0,e=!0,f=!1){a=this.db.transaction(b?"ctx":"map","readonly").objectStore(b?"ctx":"map").get(b?b+":"+a:a);const g=this;return Y(a).then(function(h){let k=[];if(!h||!h.length)return k;if(e){if(!c&&!d&&1===h.length)return h[0];for(let l=0,m;l<h.length;l++)if((m=h[l])&&m.length){if(d>=m.length){d-=m.length;continue}const n=c?d+Math.min(m.length-d,c):m.length;for(let q=d;q<n;q++)k.push(m[q]);d=0;if(k.length===c)break}return f?g.enrich(k):k}return h})};
u.tag=function(a,b=0,c=0,d=!1){a=this.db.transaction("tag","readonly").objectStore("tag").get(a);const e=this;return Z(a).then(function(f){if(!f||!f.length||c>=f.length)return[];if(!b&&!c)return f;f=f.slice(c,c+b);return d?e.enrich(f):f})}; u.tag=function(a,b=0,c=0,d=!1){a=this.db.transaction("tag","readonly").objectStore("tag").get(a);const e=this;return Y(a).then(function(f){if(!f||!f.length||c>=f.length)return[];if(!b&&!c)return f;f=f.slice(c,c+b);return d?e.enrich(f):f})};
u.enrich=function(a){"object"!==typeof a&&(a=[a]);const b=this.db.transaction("reg","readonly").objectStore("reg"),c=[];for(let d=0;d<a.length;d++)c[d]=Z(b.get(a[d]));return Promise.all(c).then(function(d){for(let e=0;e<d.length;e++)d[e]={id:a[e],doc:d[e]?JSON.parse(d[e]):null};return d})};u.has=function(a){a=this.db.transaction("reg","readonly").objectStore("reg").getKey(a);return Z(a)};u.search=null;u.info=function(){}; u.enrich=function(a){"object"!==typeof a&&(a=[a]);const b=this.db.transaction("reg","readonly").objectStore("reg"),c=[];for(let d=0;d<a.length;d++)c[d]=Y(b.get(a[d]));return Promise.all(c).then(function(d){for(let e=0;e<d.length;e++)d[e]={id:a[e],doc:d[e]?JSON.parse(d[e]):null};return d})};u.has=function(a){a=this.db.transaction("reg","readonly").objectStore("reg").getKey(a);return Y(a)};u.search=null;u.info=function(){};
u.transaction=function(a,b,c){let d=this.h[a+":"+b];if(d)return c.call(this,d);let e=this.db.transaction(a,b);this.h[a+":"+b]=d=e.objectStore(a);return new Promise((f,g)=>{e.onerror=h=>{this.h[a+":"+b]=null;e.abort();e=d=null;g(h)};e.oncomplete=h=>{e=d=this.h[a+":"+b]=null;f(h||!0)};return c.call(this,d)})}; u.transaction=function(a,b,c){let d=this.h[a+":"+b];if(d)return c.call(this,d);let e=this.db.transaction(a,b);this.h[a+":"+b]=d=e.objectStore(a);return new Promise((f,g)=>{e.onerror=h=>{this.h[a+":"+b]=null;e.abort();e=d=null;g(h)};e.oncomplete=h=>{e=d=this.h[a+":"+b]=null;f(h||!0)};return c.call(this,d)})};
u.commit=async function(a,b,c){if(b)await this.clear(),a.R=[];else{let d=a.R;a.R=[];for(let e=0,f;e<d.length;e++)if(f=d[e],f.clear){await this.clear();b=!0;break}else d[e]=f.ma;b||(c||(d=d.concat(ba(a.A))),d.length&&await this.remove(d))}a.A.size&&(await this.transaction("map","readwrite",function(d){for(const e of a.map){const f=e[0],g=e[1];g.length&&(b?d.put(g,f):d.get(f).onsuccess=function(){let h=this.result;var k;if(h&&h.length){const l=Math.max(h.length,g.length);for(let m=0,n,q;m<l;m++)if((q= u.commit=async function(a,b,c){if(b)await this.clear(),a.R=[];else{let d=a.R;a.R=[];for(let e=0,f;e<d.length;e++)if(f=d[e],f.clear){await this.clear();b=!0;break}else d[e]=f.ma;b||(c||(d=d.concat(ba(a.A))),d.length&&await this.remove(d))}a.A.size&&(await this.transaction("map","readwrite",function(d){for(const e of a.map){const f=e[0],g=e[1];g.length&&(b?d.put(g,f):d.get(f).onsuccess=function(){let h=this.result;var k;if(h&&h.length){const l=Math.max(h.length,g.length);for(let m=0,n,q;m<l;m++)if((q=
g[m])&&q.length){if((n=h[m])&&n.length)for(k=0;k<q.length;k++)n.push(q[k]);else h[m]=q;k=1}}else h=g,k=1;k&&d.put(h,f)})}}),await this.transaction("ctx","readwrite",function(d){for(const e of a.I){const f=e[0],g=e[1];for(const h of g){const k=h[0],l=h[1];l.length&&(b?d.put(l,f+":"+k):d.get(f+":"+k).onsuccess=function(){let m=this.result;var n;if(m&&m.length){const q=Math.max(m.length,l.length);for(let t=0,p,r;t<q;t++)if((r=l[t])&&r.length){if((p=m[t])&&p.length)for(n=0;n<r.length;n++)p.push(r[n]); g[m])&&q.length){if((n=h[m])&&n.length)for(k=0;k<q.length;k++)n.push(q[k]);else h[m]=q;k=1}}else h=g,k=1;k&&d.put(h,f)})}}),await this.transaction("ctx","readwrite",function(d){for(const e of a.I){const f=e[0],g=e[1];for(const h of g){const k=h[0],l=h[1];l.length&&(b?d.put(l,f+":"+k):d.get(f+":"+k).onsuccess=function(){let m=this.result;var n;if(m&&m.length){const q=Math.max(m.length,l.length);for(let t=0,p,r;t<q;t++)if((r=l[t])&&r.length){if((p=m[t])&&p.length)for(n=0;n<r.length;n++)p.push(r[n]);
else m[t]=r;n=1}}else m=l,n=1;n&&d.put(m,f+":"+k)})}}}),a.store?await this.transaction("reg","readwrite",function(d){for(const e of a.store){const f=e[0],g=e[1];d.put("object"===typeof g?JSON.stringify(g):1,f)}}):a.ja||await this.transaction("reg","readwrite",function(d){for(const e of a.A.keys())d.put(1,e)}),a.tag&&await this.transaction("tag","readwrite",function(d){for(const e of a.tag){const f=e[0],g=e[1];g.length&&(d.get(f).onsuccess=function(){let h=this.result;h=h&&h.length?h.concat(g):g;d.put(h, else m[t]=r;n=1}}else m=l,n=1;n&&d.put(m,f+":"+k)})}}}),a.store?await this.transaction("reg","readwrite",function(d){for(const e of a.store){const f=e[0],g=e[1];d.put("object"===typeof g?JSON.stringify(g):1,f)}}):a.ja||await this.transaction("reg","readwrite",function(d){for(const e of a.A.keys())d.put(1,e)}),a.tag&&await this.transaction("tag","readwrite",function(d){for(const e of a.tag){const f=e[0],g=e[1];g.length&&(d.get(f).onsuccess=function(){let h=this.result;h=h&&h.length?h.concat(g):g;d.put(h,
f)})}}),a.map.clear(),a.I.clear(),a.tag&&a.tag.clear(),a.store&&a.store.clear(),a.document||a.A.clear())};function Ua(a,b,c){const d=a.value;let e,f,g=0;for(let h=0,k;h<d.length;h++){if(k=c?d:d[h]){for(let l=0,m,n;l<b.length;l++)if(n=b[l],m=k.indexOf(f?parseInt(n,10):n),0>m&&!f&&"string"===typeof n&&!isNaN(n)&&(m=k.indexOf(parseInt(n,10)))&&(f=1),0<=m)if(e=1,1<k.length)k.splice(m,1);else{d[h]=[];break}g+=k.length}if(c)break}g?e&&a.update(d):a.delete();a.continue()} f)})}}),a.map.clear(),a.I.clear(),a.tag&&a.tag.clear(),a.store&&a.store.clear(),a.document||a.A.clear())};function Ta(a,b,c){const d=a.value;let e,f,g=0;for(let h=0,k;h<d.length;h++){if(k=c?d:d[h]){for(let l=0,m,n;l<b.length;l++)if(n=b[l],m=k.indexOf(f?parseInt(n,10):n),0>m&&!f&&"string"===typeof n&&!isNaN(n)&&(m=k.indexOf(parseInt(n,10)))&&(f=1),0<=m)if(e=1,1<k.length)k.splice(m,1);else{d[h]=[];break}g+=k.length}if(c)break}g?e&&a.update(d):a.delete();a.continue()}
u.remove=function(a){"object"!==typeof a&&(a=[a]);return Promise.all([this.transaction("map","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&Ua(c,a)}}),this.transaction("ctx","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&Ua(c,a)}}),this.transaction("tag","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&Ua(c,a,!0)}}),this.transaction("reg","readwrite",function(b){for(let c=0;c<a.length;c++)b.delete(a[c])})])}; u.remove=function(a){"object"!==typeof a&&(a=[a]);return Promise.all([this.transaction("map","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&Ta(c,a)}}),this.transaction("ctx","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&Ta(c,a)}}),this.transaction("tag","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&Ta(c,a,!0)}}),this.transaction("reg","readwrite",function(b){for(let c=0;c<a.length;c++)b.delete(a[c])})])};
function Z(a){return new Promise((b,c)=>{a.onsuccess=function(){b(this.result)};a.oncomplete=function(){b(this.result)};a.onerror=c;a=null})};const Va=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 Wa={normalize:!0,C:!0,D:Va};const Xa=new Map([["ai","ei"],["ae","a"],["oe","o"],["ue","u"],["sh","s"],["ch","c"],["th","t"],["ph","f"],["pf","f"]]),Ya=[/([^aeo])h([aeo$])/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2"];var Za={normalize:!0,C:!0,D:Va,K:Ya,J:Xa};var ab={normalize:!0,C:!0,D:Va,K:Ya.concat([/(?!^)[aeoy]/g,""]),J:Xa};const bb={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};M["latin:exact"]={normalize:!1,C:!1};M["latin:default"]=sa;M["latin:simple"]={normalize:!0,C:!0};M["latin:balance"]=Wa;M["latin:advanced"]=Za;M["latin:extra"]=ab;M["latin:soundex"]={normalize:!0,C:!1,ga:{ka:!0},V:function(a){for(let c=0;c<a.length;c++){var b=a[c];let d=b.charAt(0),e=bb[d];for(let f=1,g;f<b.length&&(g=b.charAt(f),"h"===g||"w"===g||!(g=bb[g])||g===e||(d+=g,e=g,4!==d.length));f++);a[c]=d}}}; function Y(a){return new Promise((b,c)=>{a.onsuccess=function(){b(this.result)};a.oncomplete=function(){b(this.result)};a.onerror=c;a=null})};const Z=z();const Ua=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 Va={normalize:!0,C:!0,G:Ua};const Wa=new Map([["ai","ei"],["ae","a"],["oe","o"],["ue","u"],["sh","s"],["ch","c"],["th","t"],["ph","f"],["pf","f"]]),Xa=[/([^aeo])h([aeo$])/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2"];var Ya={normalize:!0,C:!0,G:Ua,K:Xa,J:Wa};var $a={normalize:!0,C:!0,G:Ua,K:Xa.concat([/(?!^)[aeoy]/g,""]),J:Wa};const ab={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};Z["latin:exact"]={normalize:!1,C:!1};Z["latin:default"]=ra;Z["latin:simple"]={normalize:!0,C:!0};Z["latin:balance"]=Va;Z["latin:advanced"]=Ya;Z["latin:extra"]=$a;Z["latin:soundex"]={normalize:!0,C:!1,ga:{ka:!0},V:function(a){for(let c=0;c<a.length;c++){var b=a[c];let d=b.charAt(0),e=ab[d];for(let f=1,g;f<b.length&&(g=b.charAt(f),"h"===g||"w"===g||!(g=ab[g])||g===e||(d+=g,e=g,4!==d.length));f++);a[c]=d}}};const bb={Index:O,Charset:Z,Encoder:E,Document:X,Worker:V,Resolver:S,IndexedDB:Ra},cb=self;let db;
const cb={Index:P,Encoder:E,Charset:M,Language:ra,Document:Y,Worker:W,Resolver:T,IndexedDB:Sa},db=self;let eb;(eb=db.define)&&eb.amd?eb([],function(){return cb}):"object"===typeof db.exports?db.exports=cb:db.FlexSearch=cb;}(this)); (db=cb.define)&&db.amd?db([],function(){return bb}):"object"===typeof cb.exports?cb.exports=bb:cb.FlexSearch=bb;}(this));

File diff suppressed because it is too large Load Diff

View File

@@ -6,84 +6,84 @@
* https://github.com/nextapps-de/flexsearch * https://github.com/nextapps-de/flexsearch
*/ */
var u;function y(a,b,c){const d=typeof c,e=typeof a;if("undefined"!==d){if("undefined"!==e){if(c){if("function"===e&&d===e)return function(h){return a(c(h))};b=a.constructor;if(b===c.constructor){if(b===Array)return c.concat(a);if(b===Map){var f=new Map(c);for(var g of a)f.set(g[0],g[1]);return f}if(b===Set){g=new Set(c);for(f of a.values())g.add(f);return g}}}return a}return c}return"undefined"===e?b:a}function z(){return Object.create(null)}function aa(a,b){return b.length-a.length} var u;function y(a,b,c){const d=typeof c,e=typeof a;if("undefined"!==d){if("undefined"!==e){if(c){if("function"===e&&d===e)return function(h){return a(c(h))};b=a.constructor;if(b===c.constructor){if(b===Array)return c.concat(a);if(b===Map){var f=new Map(c);for(var g of a)f.set(g[0],g[1]);return f}if(b===Set){g=new Set(c);for(f of a.values())g.add(f);return g}}}return a}return c}return"undefined"===e?b:a}function z(){return Object.create(null)}function aa(a,b){return b.length-a.length}
function B(a){return"string"===typeof a}function C(a){return"object"===typeof a}function ba(a){const b=[];for(const c of a.keys())b.push(c);return b}function ca(a,b){if(B(b))a=a[b];else for(let c=0;a&&c<b.length;c++)a=a[b[c]];return a}function da(a){let b=0;for(let c=0,d;c<a.length;c++)(d=a[c])&&b<d.length&&(b=d.length);return b};const ea=/[^\p{L}\p{N}]+/u,fa=/(\d{3})/g,ha=/(\D)(\d{3})/g,ia=/(\d{3})(\D)/g,ja="".normalize&&/[\u0300-\u036f]/g,ka=!ja&&new Map([["\u00aa","a"],["\u00b2","2"],["\u00b3","3"],["\u00b9","1"],["\u00ba","o"],["\u00bc","1\u20444"],["\u00bd","1\u20442"],["\u00be","3\u20444"],["\u00e0","a"],["\u00e1","a"],["\u00e2","a"],["\u00e3","a"],["\u00e4","a"],["\u00e5","a"],["\u00e7","c"],["\u00e8","e"],["\u00e9","e"],["\u00ea","e"],["\u00eb","e"],["\u00ec","i"],["\u00ed","i"],["\u00ee","i"],["\u00ef","i"],["\u00f1", function B(a){return"string"===typeof a}function C(a){return"object"===typeof a}function ba(a){const b=[];for(const c of a.keys())b.push(c);return b}function ca(a,b){if(B(b))a=a[b];else for(let c=0;a&&c<b.length;c++)a=a[b[c]];return a}function da(a){let b=0;for(let c=0,d;c<a.length;c++)(d=a[c])&&b<d.length&&(b=d.length);return b};const ea=/[^\p{L}\p{N}]+/u,fa=/(\d{3})/g,ha=/(\D)(\d{3})/g,ia=/(\d{3})(\D)/g,ja="".normalize&&/[\u0300-\u036f]/g,ka=!ja&&[["\u00aa","a"],["\u00b2","2"],["\u00b3","3"],["\u00b9","1"],["\u00ba","o"],["\u00bc","1\u20444"],["\u00bd","1\u20442"],["\u00be","3\u20444"],["\u00e0","a"],["\u00e1","a"],["\u00e2","a"],["\u00e3","a"],["\u00e4","a"],["\u00e5","a"],["\u00e7","c"],["\u00e8","e"],["\u00e9","e"],["\u00ea","e"],["\u00eb","e"],["\u00ec","i"],["\u00ed","i"],["\u00ee","i"],["\u00ef","i"],["\u00f1","n"],
"n"],["\u00f2","o"],["\u00f3","o"],["\u00f4","o"],["\u00f5","o"],["\u00f6","o"],["\u00f9","u"],["\u00fa","u"],["\u00fb","u"],["\u00fc","u"],["\u00fd","y"],["\u00ff","y"],["\u0101","a"],["\u0103","a"],["\u0105","a"],["\u0107","c"],["\u0109","c"],["\u010b","c"],["\u010d","c"],["\u010f","d"],["\u0113","e"],["\u0115","e"],["\u0117","e"],["\u0119","e"],["\u011b","e"],["\u011d","g"],["\u011f","g"],["\u0121","g"],["\u0123","g"],["\u0125","h"],["\u0129","i"],["\u012b","i"],["\u012d","i"],["\u012f","i"],["\u0133", ["\u00f2","o"],["\u00f3","o"],["\u00f4","o"],["\u00f5","o"],["\u00f6","o"],["\u00f9","u"],["\u00fa","u"],["\u00fb","u"],["\u00fc","u"],["\u00fd","y"],["\u00ff","y"],["\u0101","a"],["\u0103","a"],["\u0105","a"],["\u0107","c"],["\u0109","c"],["\u010b","c"],["\u010d","c"],["\u010f","d"],["\u0113","e"],["\u0115","e"],["\u0117","e"],["\u0119","e"],["\u011b","e"],["\u011d","g"],["\u011f","g"],["\u0121","g"],["\u0123","g"],["\u0125","h"],["\u0129","i"],["\u012b","i"],["\u012d","i"],["\u012f","i"],["\u0133",
"ij"],["\u0135","j"],["\u0137","k"],["\u013a","l"],["\u013c","l"],["\u013e","l"],["\u0140","l"],["\u0144","n"],["\u0146","n"],["\u0148","n"],["\u0149","n"],["\u014d","o"],["\u014f","o"],["\u0151","o"],["\u0155","r"],["\u0157","r"],["\u0159","r"],["\u015b","s"],["\u015d","s"],["\u015f","s"],["\u0161","s"],["\u0163","t"],["\u0165","t"],["\u0169","u"],["\u016b","u"],["\u016d","u"],["\u016f","u"],["\u0171","u"],["\u0173","u"],["\u0175","w"],["\u0177","y"],["\u017a","z"],["\u017c","z"],["\u017e","z"], "ij"],["\u0135","j"],["\u0137","k"],["\u013a","l"],["\u013c","l"],["\u013e","l"],["\u0140","l"],["\u0144","n"],["\u0146","n"],["\u0148","n"],["\u0149","n"],["\u014d","o"],["\u014f","o"],["\u0151","o"],["\u0155","r"],["\u0157","r"],["\u0159","r"],["\u015b","s"],["\u015d","s"],["\u015f","s"],["\u0161","s"],["\u0163","t"],["\u0165","t"],["\u0169","u"],["\u016b","u"],["\u016d","u"],["\u016f","u"],["\u0171","u"],["\u0173","u"],["\u0175","w"],["\u0177","y"],["\u017a","z"],["\u017c","z"],["\u017e","z"],
["\u017f","s"],["\u01a1","o"],["\u01b0","u"],["\u01c6","dz"],["\u01c9","lj"],["\u01cc","nj"],["\u01ce","a"],["\u01d0","i"],["\u01d2","o"],["\u01d4","u"],["\u01d6","u"],["\u01d8","u"],["\u01da","u"],["\u01dc","u"],["\u01df","a"],["\u01e1","a"],["\u01e3","ae"],["\u00e6","ae"],["\u01fd","ae"],["\u01e7","g"],["\u01e9","k"],["\u01eb","o"],["\u01ed","o"],["\u01ef","\u0292"],["\u01f0","j"],["\u01f3","dz"],["\u01f5","g"],["\u01f9","n"],["\u01fb","a"],["\u01ff","\u00f8"],["\u0201","a"],["\u0203","a"],["\u0205", ["\u017f","s"],["\u01a1","o"],["\u01b0","u"],["\u01c6","dz"],["\u01c9","lj"],["\u01cc","nj"],["\u01ce","a"],["\u01d0","i"],["\u01d2","o"],["\u01d4","u"],["\u01d6","u"],["\u01d8","u"],["\u01da","u"],["\u01dc","u"],["\u01df","a"],["\u01e1","a"],["\u01e3","ae"],["\u00e6","ae"],["\u01fd","ae"],["\u01e7","g"],["\u01e9","k"],["\u01eb","o"],["\u01ed","o"],["\u01ef","\u0292"],["\u01f0","j"],["\u01f3","dz"],["\u01f5","g"],["\u01f9","n"],["\u01fb","a"],["\u01ff","\u00f8"],["\u0201","a"],["\u0203","a"],["\u0205",
"e"],["\u0207","e"],["\u0209","i"],["\u020b","i"],["\u020d","o"],["\u020f","o"],["\u0211","r"],["\u0213","r"],["\u0215","u"],["\u0217","u"],["\u0219","s"],["\u021b","t"],["\u021f","h"],["\u0227","a"],["\u0229","e"],["\u022b","o"],["\u022d","o"],["\u022f","o"],["\u0231","o"],["\u0233","y"],["\u02b0","h"],["\u02b1","h"],["\u0266","h"],["\u02b2","j"],["\u02b3","r"],["\u02b4","\u0279"],["\u02b5","\u027b"],["\u02b6","\u0281"],["\u02b7","w"],["\u02b8","y"],["\u02e0","\u0263"],["\u02e1","l"],["\u02e2","s"], "e"],["\u0207","e"],["\u0209","i"],["\u020b","i"],["\u020d","o"],["\u020f","o"],["\u0211","r"],["\u0213","r"],["\u0215","u"],["\u0217","u"],["\u0219","s"],["\u021b","t"],["\u021f","h"],["\u0227","a"],["\u0229","e"],["\u022b","o"],["\u022d","o"],["\u022f","o"],["\u0231","o"],["\u0233","y"],["\u02b0","h"],["\u02b1","h"],["\u0266","h"],["\u02b2","j"],["\u02b3","r"],["\u02b4","\u0279"],["\u02b5","\u027b"],["\u02b6","\u0281"],["\u02b7","w"],["\u02b8","y"],["\u02e0","\u0263"],["\u02e1","l"],["\u02e2","s"],
["\u02e3","x"],["\u02e4","\u0295"],["\u0390","\u03b9"],["\u03ac","\u03b1"],["\u03ad","\u03b5"],["\u03ae","\u03b7"],["\u03af","\u03b9"],["\u03b0","\u03c5"],["\u03ca","\u03b9"],["\u03cb","\u03c5"],["\u03cc","\u03bf"],["\u03cd","\u03c5"],["\u03ce","\u03c9"],["\u03d0","\u03b2"],["\u03d1","\u03b8"],["\u03d2","\u03a5"],["\u03d3","\u03a5"],["\u03d4","\u03a5"],["\u03d5","\u03c6"],["\u03d6","\u03c0"],["\u03f0","\u03ba"],["\u03f1","\u03c1"],["\u03f2","\u03c2"],["\u03f5","\u03b5"],["\u0439","\u0438"],["\u0450", ["\u02e3","x"],["\u02e4","\u0295"],["\u0390","\u03b9"],["\u03ac","\u03b1"],["\u03ad","\u03b5"],["\u03ae","\u03b7"],["\u03af","\u03b9"],["\u03b0","\u03c5"],["\u03ca","\u03b9"],["\u03cb","\u03c5"],["\u03cc","\u03bf"],["\u03cd","\u03c5"],["\u03ce","\u03c9"],["\u03d0","\u03b2"],["\u03d1","\u03b8"],["\u03d2","\u03a5"],["\u03d3","\u03a5"],["\u03d4","\u03a5"],["\u03d5","\u03c6"],["\u03d6","\u03c0"],["\u03f0","\u03ba"],["\u03f1","\u03c1"],["\u03f2","\u03c2"],["\u03f5","\u03b5"],["\u0439","\u0438"],["\u0450",
"\u0435"],["\u0451","\u0435"],["\u0453","\u0433"],["\u0457","\u0456"],["\u045c","\u043a"],["\u045d","\u0438"],["\u045e","\u0443"],["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]]); "\u0435"],["\u0451","\u0435"],["\u0453","\u0433"],["\u0457","\u0456"],["\u045c","\u043a"],["\u045d","\u0438"],["\u045e","\u0443"],["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]];
function E(a={}){if(!(this instanceof E))return new E(...arguments);for(a=0;a<arguments.length;a++)this.assign(arguments[a])} function E(a={}){if(!(this instanceof E))return new E(...arguments);for(a=0;a<arguments.length;a++)this.assign(arguments[a])}
E.prototype.assign=function(a){this.normalize=y(a.normalize,!0,this.normalize);let b=a.ga,c=b||a.na||a.split;if("object"===typeof c){let d=!b,e="";a.ga||(e+="\\p{Z}");c.ka&&(e+="\\p{L}");c.oa&&(e+="\\p{N}",d=!!b);c.qa&&(e+="\\p{S}");c.pa&&(e+="\\p{P}");c.control&&(e+="\\p{C}");if(c=c.char)e+="object"===typeof c?c.join(""):c;this.split=new RegExp("["+(b?"^":"")+e+"]+","u");this.numeric=d}else this.split=y(c,ea,this.split),this.numeric=y(this.numeric,!0);this.$=y(a.$,null,this.$);this.V=y(a.V,null, E.prototype.assign=function(a){this.normalize=y(a.normalize,!0,this.normalize);let b=a.ga,c=b||a.na||a.split;if("object"===typeof c){let d=!b,e="";a.ga||(e+="\\p{Z}");c.ka&&(e+="\\p{L}");c.oa&&(e+="\\p{N}",d=!!b);c.qa&&(e+="\\p{S}");c.pa&&(e+="\\p{P}");c.control&&(e+="\\p{C}");if(c=c.char)e+="object"===typeof c?c.join(""):c;this.split=new RegExp("["+(b?"^":"")+e+"]+","u");this.numeric=d}else this.split=y(c,ea,this.split),this.numeric=y(this.numeric,!0);this.$=y(a.$,null,this.$);this.V=y(a.V,null,
this.V);this.rtl=a.rtl||!1;this.C=y(a.C,!0,this.C);this.filter=y((c=a.filter)&&new Set(c),null,this.filter);this.J=y((c=a.J)&&new Map(c),null,this.J);this.D=y((c=a.D)&&new Map(c),null,this.D);this.N=y((c=a.N)&&new Map(c),null,this.N);this.K=y(a.K,null,this.K);this.Z=y(a.Z,1,this.Z);this.ha=y(a.ha,0,this.ha);if(this.cache=c=y(a.cache,!0,this.cache))this.X=null,this.ea="number"===typeof c?c:2E5,this.P=new Map,this.U=new Map,this.B=this.h=128;this.F="";this.ba=null;this.Y="";this.ca=null;if(this.J)for(const d of this.J.keys())this.F+= this.V);ka&&(this.G=new Map(ka));this.rtl=a.rtl||!1;this.C=y(a.C,!0,this.C);this.filter=y((c=a.filter)&&new Set(c),null,this.filter);this.J=y((c=a.J)&&new Map(c),null,this.J);this.G=y((c=a.G)&&new Map(c),null,this.G);this.N=y((c=a.N)&&new Map(c),null,this.N);this.K=y(a.K,null,this.K);this.Z=y(a.Z,1,this.Z);this.ha=y(a.ha,0,this.ha);if(this.cache=c=y(a.cache,!0,this.cache))this.X=null,this.ea="number"===typeof c?c:2E5,this.P=new Map,this.U=new Map,this.B=this.h=128;this.D="";this.ba=null;this.Y="";
(this.F?"|":"")+d;if(this.N)for(const d of this.N.keys())this.Y+=(this.Y?"|":"")+d;return this}; this.ca=null;if(this.J)for(const d of this.J.keys())this.D+=(this.D?"|":"")+d;if(this.N)for(const d of this.N.keys())this.Y+=(this.Y?"|":"")+d;return this};
E.prototype.encode=function(a){if(this.cache&&a.length<=this.h)if(this.X){if(this.P.has(a))return this.P.get(a)}else this.X=setTimeout(la,0,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):ja?a=a.normalize("NFKD").replace(ja,"").toLowerCase():(a=a.toLowerCase(),this.D=this.D?new Map([...ka,...this.D]):new Map(ka)));this.$&&(a=this.$(a));this.numeric&&3<a.length&&(a=a.replace(ha,"$1 $2").replace(ia,"$1 $2").replace(fa,"$1 "));const b=!(this.C||this.D||this.filter||this.J|| E.prototype.encode=function(a){if(this.cache&&a.length<=this.h)if(this.X){if(this.P.has(a))return this.P.get(a)}else this.X=setTimeout(la,0,this);this.normalize&&(a="function"===typeof this.normalize?this.normalize(a):ja?a.normalize("NFKD").replace(ja,"").toLowerCase():a.toLowerCase());this.$&&(a=this.$(a));this.numeric&&3<a.length&&(a=a.replace(ha,"$1 $2").replace(ia,"$1 $2").replace(fa,"$1 "));const b=!(this.C||this.G||this.filter||this.J||this.N||this.K);let c=[],d=this.split||""===this.split?
this.N||this.K);let c=[],d=this.split||""===this.split?a.split(this.split):a;for(let f=0,g,h;f<d.length;f++){if(!(g=h=d[f]))continue;if(g.length<this.Z)continue;if(b){c.push(g);continue}if(this.filter&&this.filter.has(g))continue;if(this.cache&&g.length<=this.B)if(this.X){var e=this.U.get(g);if(e||""===e){e&&c.push(e);continue}}else this.X=setTimeout(la,0,this);let k;this.N&&2<g.length&&(this.ca||(this.ca=new RegExp("(?!^)("+this.Y+")$")),g=g.replace(this.ca,l=>this.N.get(l)),k=1);this.J&&1<g.length&& a.split(this.split):a;for(let f=0,g,h;f<d.length;f++){if(!(g=h=d[f]))continue;if(g.length<this.Z)continue;if(b){c.push(g);continue}if(this.filter&&this.filter.has(g))continue;if(this.cache&&g.length<=this.B)if(this.X){var e=this.U.get(g);if(e||""===e){e&&c.push(e);continue}}else this.X=setTimeout(la,0,this);let k;this.N&&2<g.length&&(this.ca||(this.ca=new RegExp("(?!^)("+this.Y+")$")),g=g.replace(this.ca,l=>this.N.get(l)),k=1);this.J&&1<g.length&&(this.ba||(this.ba=new RegExp("("+this.D+")","g")),
(this.ba||(this.ba=new RegExp("("+this.F+")","g")),g=g.replace(this.ba,l=>this.J.get(l)),k=1);g&&k&&(g.length<this.Z||this.filter&&this.filter.has(g))&&(g="");if(g&&(this.D||this.C&&1<g.length)){e="";for(let l=0,m="",n,q;l<g.length;l++)n=g.charAt(l),n===m&&this.C||((q=this.D&&this.D.get(n))||""===q?q===m&&this.C||!(m=q)||(e+=q):e+=m=n);g=e}if(g&&this.K)for(e=0;g&&e<this.K.length;e+=2)g=g.replace(this.K[e],this.K[e+1]);this.cache&&h.length<=this.B&&(this.U.set(h,g),this.U.size>this.ea&&(this.U.clear(), g=g.replace(this.ba,l=>this.J.get(l)),k=1);g&&k&&(g.length<this.Z||this.filter&&this.filter.has(g))&&(g="");if(g&&(this.G||this.C&&1<g.length)){e="";for(let l=0,m="",n,q;l<g.length;l++)n=g.charAt(l),n===m&&this.C||((q=this.G&&this.G.get(n))||""===q?q===m&&this.C||!(m=q)||(e+=q):e+=m=n);g=e}if(g&&this.K)for(e=0;g&&e<this.K.length;e+=2)g=g.replace(this.K[e],this.K[e+1]);this.cache&&h.length<=this.B&&(this.U.set(h,g),this.U.size>this.ea&&(this.U.clear(),this.B=this.B/1.1|0));g&&c.push(g)}this.V&&(c=
this.B=this.B/1.1|0));g&&c.push(g)}this.V&&(c=this.V(c)||c);this.cache&&a.length<=this.h&&(this.P.set(a,c),this.P.size>this.ea&&(this.P.clear(),this.h=this.h/1.1|0));return c};function la(a){a.X=null;a.P.clear();a.U.clear()};function ma(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();let d=this.cache.get(a);if(!d){d=this.search(a,b,c);if(d instanceof Promise){const e=this;d.then(function(f){e.cache.set(a,f)})}this.cache.set(a,d)}return d}function F(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}F.prototype.set=function(a,b){this.cache.has(a)||(this.cache.set(this.h=a,b),this.limit&&this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value))}; this.V(c)||c);this.cache&&a.length<=this.h&&(this.P.set(a,c),this.P.size>this.ea&&(this.P.clear(),this.h=this.h/1.1|0));return c};function la(a){a.X=null;a.P.clear();a.U.clear()};function ma(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();let d=this.cache.get(a);if(!d){d=this.search(a,b,c);if(d instanceof Promise){const e=this;d.then(function(f){e.cache.set(a,f)})}this.cache.set(a,d)}return d}function F(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}F.prototype.set=function(a,b){this.cache.has(a)||(this.cache.set(this.h=a,b),this.limit&&this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value))};
F.prototype.get=function(a){const b=this.cache.get(a);b&&this.limit&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,b));return b};F.prototype.remove=function(a){for(const b of this.cache){const c=b[0];b[1].includes(a)&&this.cache.delete(c)}};F.prototype.clear=function(){this.cache.clear();this.h=""};function na(a,b,c,d){let e=[];for(let f=0,g;f<a.index.length;f++)if(g=a.index[f],b>=g.length)b-=g.length;else{b=g[d?"splice":"slice"](b,c);const h=b.length;if(h&&(e=e.length?e.concat(b):b,c-=h,d&&(a.length-=h),!c))break;b=0}return e} F.prototype.get=function(a){const b=this.cache.get(a);b&&this.limit&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,b));return b};F.prototype.remove=function(a){for(const b of this.cache){const c=b[0];b[1].includes(a)&&this.cache.delete(c)}};F.prototype.clear=function(){this.cache.clear();this.h=""};function na(a,b,c,d){let e=[];for(let f=0,g;f<a.index.length;f++)if(g=a.index[f],b>=g.length)b-=g.length;else{b=g[d?"splice":"slice"](b,c);const h=b.length;if(h&&(e=e.length?e.concat(b):b,c-=h,d&&(a.length-=h),!c))break;b=0}return e}
function H(a){if(!(this instanceof H))return new H(a);this.index=a?[a]:[];this.length=a?a.length:0;const b=this;return new Proxy([],{get(c,d){if("length"===d)return b.length;if("push"===d)return function(e){b.index[b.index.length-1].push(e);b.length++};if("pop"===d)return function(){if(b.length)return b.length--,b.index[b.index.length-1].pop()};if("indexOf"===d)return function(e){let f=0;for(let g=0,h,k;g<b.index.length;g++){h=b.index[g];k=h.indexOf(e);if(0<=k)return f+k;f+=h.length}return-1};if("includes"=== function H(a){if(!(this instanceof H))return new H(a);this.index=a?[a]:[];this.length=a?a.length:0;const b=this;return new Proxy([],{get(c,d){if("length"===d)return b.length;if("push"===d)return function(e){b.index[b.index.length-1].push(e);b.length++};if("pop"===d)return function(){if(b.length)return b.length--,b.index[b.index.length-1].pop()};if("indexOf"===d)return function(e){let f=0;for(let g=0,h,k;g<b.index.length;g++){h=b.index[g];k=h.indexOf(e);if(0<=k)return f+k;f+=h.length}return-1};if("includes"===
d)return function(e){for(let f=0;f<b.index.length;f++)if(b.index[f].includes(e))return!0;return!1};if("slice"===d)return function(e,f){return na(b,e||0,f||b.length,!1)};if("splice"===d)return function(e,f){return na(b,e||0,f||b.length,!0)};if("constructor"===d)return Array;if("symbol"!==typeof d)return(c=b.index[d/2**31|0])&&c[d]},set(c,d,e){c=d/2**31|0;(b.index[c]||(b.index[c]=[]))[d]=e;b.length++;return!0}})}H.prototype.clear=function(){this.index.length=0};H.prototype.push=function(){}; d)return function(e){for(let f=0;f<b.index.length;f++)if(b.index[f].includes(e))return!0;return!1};if("slice"===d)return function(e,f){return na(b,e||0,f||b.length,!1)};if("splice"===d)return function(e,f){return na(b,e||0,f||b.length,!0)};if("constructor"===d)return Array;if("symbol"!==typeof d)return(c=b.index[d/2**31|0])&&c[d]},set(c,d,e){c=d/2**31|0;(b.index[c]||(b.index[c]=[]))[d]=e;b.length++;return!0}})}H.prototype.clear=function(){this.index.length=0};H.prototype.push=function(){};
function K(a=8){if(!(this instanceof K))return new K(a);this.index=z();this.F=[];this.size=0;32<a?(this.h=oa,this.B=BigInt(a)):(this.h=pa,this.B=a)}K.prototype.get=function(a){const b=this.index[this.h(a)];return b&&b.get(a)};K.prototype.set=function(a,b){var c=this.h(a);let d=this.index[c];d?(c=d.size,d.set(a,b),(c-=d.size)&&this.size++):(this.index[c]=d=new Map([[a,b]]),this.F.push(d))}; function K(a=8){if(!(this instanceof K))return new K(a);this.index=z();this.D=[];this.size=0;32<a?(this.h=oa,this.B=BigInt(a)):(this.h=pa,this.B=a)}K.prototype.get=function(a){const b=this.index[this.h(a)];return b&&b.get(a)};K.prototype.set=function(a,b){var c=this.h(a);let d=this.index[c];d?(c=d.size,d.set(a,b),(c-=d.size)&&this.size++):(this.index[c]=d=new Map([[a,b]]),this.D.push(d))};
function L(a=8){if(!(this instanceof L))return new L(a);this.index=z();this.h=[];32<a?(this.F=oa,this.B=BigInt(a)):(this.F=pa,this.B=a)}L.prototype.add=function(a){var b=this.F(a);let c=this.index[b];c?(b=c.size,c.add(a),(b-=c.size)&&this.size++):(this.index[b]=c=new Set([a]),this.h.push(c))};u=K.prototype;u.has=L.prototype.has=function(a){const b=this.index[this.F(a)];return b&&b.has(a)};u.delete=L.prototype.delete=function(a){const b=this.index[this.F(a)];b&&b.delete(a)&&this.size--}; function L(a=8){if(!(this instanceof L))return new L(a);this.index=z();this.h=[];32<a?(this.D=oa,this.B=BigInt(a)):(this.D=pa,this.B=a)}L.prototype.add=function(a){var b=this.D(a);let c=this.index[b];c?(b=c.size,c.add(a),(b-=c.size)&&this.size++):(this.index[b]=c=new Set([a]),this.h.push(c))};u=K.prototype;u.has=L.prototype.has=function(a){const b=this.index[this.D(a)];return b&&b.has(a)};u.delete=L.prototype.delete=function(a){const b=this.index[this.D(a)];b&&b.delete(a)&&this.size--};
u.clear=L.prototype.clear=function(){this.index=z();this.h=[];this.size=0};u.values=L.prototype.values=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].values())yield b};u.keys=L.prototype.keys=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].keys())yield b};u.entries=L.prototype.entries=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].entries())yield b}; u.clear=L.prototype.clear=function(){this.index=z();this.h=[];this.size=0};u.values=L.prototype.values=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].values())yield b};u.keys=L.prototype.keys=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].keys())yield b};u.entries=L.prototype.entries=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].entries())yield b};
function pa(a){let b=2**this.B-1;if("number"==typeof a)return a&b;let c=0,d=this.B+1;for(let e=0;e<a.length;e++)c=(c*d^a.charCodeAt(e))&b;return 32===this.B?c+2**31:c}function oa(a){let b=BigInt(2)**this.B-BigInt(1);var c=typeof a;if("bigint"===c)return a&b;if("number"===c)return BigInt(a)&b;c=BigInt(0);let d=this.B+BigInt(1);for(let e=0;e<a.length;e++)c=(c*d^BigInt(a.charCodeAt(e)))&b;return c};function qa(a,b,c,d,e,f,g,h){(d=a(c?c+"."+d:d,JSON.stringify(g)))&&d.then?d.then(function(){b.export(a,b,c,e,f+1,h)}):b.export(a,b,c,e,f+1,h)};const ra=z(),M=z();var sa={normalize:function(a){return a.toLowerCase()},C:!1};const ta={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};function ua(a){O.call(a,"add");O.call(a,"append");O.call(a,"search");O.call(a,"update");O.call(a,"remove")}function O(a){this[a+"Async"]=function(){var b=arguments;const c=b[b.length-1];let d;"function"===typeof c&&(d=c,delete b[b.length-1]);this.async=!0;b=this[a].apply(this,b);this.async=!1;b.then?b.then(d):d(b);return b}};z();P.prototype.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.A.has(a))return this.update(a,b);b=this.encoder.encode(b);if(d=b.length){const l=z(),m=z(),n=this.depth,q=this.resolution;for(let t=0;t<d;t++){let p=b[this.rtl?d-1-t:t];var e=p.length;if(e&&(n||!m[p])){var f=this.score?this.score(b,p,t,null,0):Q(q,d,t),g="";switch(this.tokenize){case "full":if(2<e){for(f=0;f<e;f++)for(var h=e;h>f;h--){g=p.substring(f,h);var k=this.score?this.score(b,p,t,g,f):Q(q,d,t,e,f);R(this,m,g,k,a,c)}break}case "reverse":if(1< function pa(a){let b=2**this.B-1;if("number"==typeof a)return a&b;let c=0,d=this.B+1;for(let e=0;e<a.length;e++)c=(c*d^a.charCodeAt(e))&b;return 32===this.B?c+2**31:c}function oa(a){let b=BigInt(2)**this.B-BigInt(1);var c=typeof a;if("bigint"===c)return a&b;if("number"===c)return BigInt(a)&b;c=BigInt(0);let d=this.B+BigInt(1);for(let e=0;e<a.length;e++)c=(c*d^BigInt(a.charCodeAt(e)))&b;return c};function qa(a,b,c,d,e,f,g,h){(d=a(c?c+"."+d:d,JSON.stringify(g)))&&d.then?d.then(function(){b.export(a,b,c,e,f+1,h)}):b.export(a,b,c,e,f+1,h)};var ra={normalize:function(a){return a.toLowerCase()},C:!1};const sa={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};function ta(a){N.call(a,"add");N.call(a,"append");N.call(a,"search");N.call(a,"update");N.call(a,"remove")}function N(a){this[a+"Async"]=function(){var b=arguments;const c=b[b.length-1];let d;"function"===typeof c&&(d=c,delete b[b.length-1]);this.async=!0;b=this[a].apply(this,b);this.async=!1;b.then?b.then(d):d(b);return b}};z();O.prototype.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.A.has(a))return this.update(a,b);b=this.encoder.encode(b);if(d=b.length){const l=z(),m=z(),n=this.depth,q=this.resolution;for(let t=0;t<d;t++){let p=b[this.rtl?d-1-t:t];var e=p.length;if(e&&(n||!m[p])){var f=this.score?this.score(b,p,t,null,0):P(q,d,t),g="";switch(this.tokenize){case "full":if(2<e){for(f=0;f<e;f++)for(var h=e;h>f;h--){g=p.substring(f,h);var k=this.score?this.score(b,p,t,g,f):P(q,d,t,e,f);Q(this,m,g,k,a,c)}break}case "reverse":if(1<
e){for(h=e-1;0<h;h--)g=p[h]+g,k=this.score?this.score(b,p,t,g,h):Q(q,d,t,e,h),R(this,m,g,k,a,c);g=""}case "forward":if(1<e){for(h=0;h<e;h++)g+=p[h],R(this,m,g,f,a,c);break}default:if(R(this,m,p,f,a,c),n&&1<d&&t<d-1)for(e=z(),g=this.da,f=p,h=Math.min(n+1,d-t),e[f]=1,k=1;k<h;k++)if((p=b[this.rtl?d-1-t-k:t+k])&&!e[p]){e[p]=1;const r=this.score?this.score(b,f,t,p,k):Q(g+(d/2>g?0:1),d,t,h-1,k-1),x=this.bidirectional&&p>f;R(this,l,x?f:p,r,a,c,x?p:f)}}}}this.fastupdate||this.A.add(a)}else b=""}this.db&& e){for(h=e-1;0<h;h--)g=p[h]+g,k=this.score?this.score(b,p,t,g,h):P(q,d,t,e,h),Q(this,m,g,k,a,c);g=""}case "forward":if(1<e){for(h=0;h<e;h++)g+=p[h],Q(this,m,g,f,a,c);break}default:if(Q(this,m,p,f,a,c),n&&1<d&&t<d-1)for(e=z(),g=this.da,f=p,h=Math.min(n+1,d-t),e[f]=1,k=1;k<h;k++)if((p=b[this.rtl?d-1-t-k:t+k])&&!e[p]){e[p]=1;const r=this.score?this.score(b,f,t,p,k):P(g+(d/2>g?0:1),d,t,h-1,k-1),x=this.bidirectional&&p>f;Q(this,l,x?f:p,r,a,c,x?p:f)}}}}this.fastupdate||this.A.add(a)}else b=""}this.db&&
(b||this.R.push({del:a}),this.fa&&va(this));return this};function R(a,b,c,d,e,f,g){let h=g?a.I:a.map,k;if(!b[c]||!g||!(k=b[c])[g])if(g?(b=k||(b[c]=z()),b[g]=1,(k=h.get(g))?h=k:h.set(g,h=new Map)):b[c]=1,(k=h.get(c))?h=k:h.set(c,h=k=[]),h=h[d]||(h[d]=[]),!f||!h.includes(e)){if(h.length===2**31-1){b=new H(h);if(a.fastupdate)for(let l of a.A.values())l.includes(h)&&(l[l.indexOf(h)]=b);k[d]=h=b}h.push(e);a.fastupdate&&((d=a.A.get(e))?d.push(h):a.A.set(e,[h]))}} (b||this.R.push({del:a}),this.fa&&ua(this));return this};function Q(a,b,c,d,e,f,g){let h=g?a.I:a.map,k;if(!b[c]||!g||!(k=b[c])[g])if(g?(b=k||(b[c]=z()),b[g]=1,(k=h.get(g))?h=k:h.set(g,h=new Map)):b[c]=1,(k=h.get(c))?h=k:h.set(c,h=k=[]),h=h[d]||(h[d]=[]),!f||!h.includes(e)){if(h.length===2**31-1){b=new H(h);if(a.fastupdate)for(let l of a.A.values())l.includes(h)&&(l[l.indexOf(h)]=b);k[d]=h=b}h.push(e);a.fastupdate&&((d=a.A.get(e))?d.push(h):a.A.set(e,[h]))}}
function Q(a,b,c,d,e){return c&&1<a?b+(d||0)<=a?c+(e||0):(a-1)/(b+(d||0))*(c+(e||0))+1|0:0};function S(a,b,c,d){if(1===a.length)return a=a[0],a=c||a.length>b?b?a.slice(c,c+b):a.slice(c):a,d?wa(a):a;let e=[];for(let f=0,g,h;f<a.length;f++)if((g=a[f])&&(h=g.length)){if(c){if(c>=h){c-=h;continue}c<h&&(g=b?g.slice(c,c+b):g.slice(c),h=g.length,c=0)}if(e.length)h>b&&(g=g.slice(0,b),h=g.length),e.push(g);else{if(h>=b)return h>b&&(g=g.slice(0,b)),d?wa(g):g;e=[g]}b-=h;if(!b)break}if(!e.length)return e;e=1<e.length?[].concat.apply([],e):e[0];return d?wa(e):e} function P(a,b,c,d,e){return c&&1<a?b+(d||0)<=a?c+(e||0):(a-1)/(b+(d||0))*(c+(e||0))+1|0:0};function R(a,b,c,d){if(1===a.length)return a=a[0],a=c||a.length>b?b?a.slice(c,c+b):a.slice(c):a,d?va(a):a;let e=[];for(let f=0,g,h;f<a.length;f++)if((g=a[f])&&(h=g.length)){if(c){if(c>=h){c-=h;continue}c<h&&(g=b?g.slice(c,c+b):g.slice(c),h=g.length,c=0)}if(e.length)h>b&&(g=g.slice(0,b),h=g.length),e.push(g);else{if(h>=b)return h>b&&(g=g.slice(0,b)),d?va(g):g;e=[g]}b-=h;if(!b)break}if(!e.length)return e;e=1<e.length?[].concat.apply([],e):e[0];return d?va(e):e}
function wa(a){for(let b=0;b<a.length;b++)a[b]={score:b,id:a[b]};return a};T.prototype.or=function(){const a=this;let b=arguments;var c=b[0];if(c instanceof Promise)return c.then(function(){return a.or.apply(a,b)});if(c[0]&&c[0].index)return this.or.apply(this,c);let d=[];c=[];let e=0,f=0,g,h;for(let k=0,l;k<b.length;k++)if(l=b[k]){let m;if(l instanceof T)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.and)m=this.and(l.and);else if(l.xor)m=this.xor(l.xor);else if(l.G)m=this.G(l.G);else{e=l.limit||0;f=l.offset|| function va(a){for(let b=0;b<a.length;b++)a[b]={score:b,id:a[b]};return a};S.prototype.or=function(){const a=this;let b=arguments;var c=b[0];if(c instanceof Promise)return c.then(function(){return a.or.apply(a,b)});if(c[0]&&c[0].index)return this.or.apply(this,c);let d=[];c=[];let e=0,f=0,g,h;for(let k=0,l;k<b.length;k++)if(l=b[k]){let m;if(l instanceof S)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.and)m=this.and(l.and);else if(l.xor)m=this.xor(l.xor);else if(l.F)m=this.F(l.F);else{e=l.limit||0;f=l.offset||
0;g=l.enrich;h=l.resolve;continue}d[k]=m;m instanceof Promise&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=[a.result].concat(d));a.result=xa(d,e,f,g,h,a.O);return h?a.result:a});this.result.length&&(d=[this.result].concat(d));this.result=xa(d,e,f,g,h,a.O);return h?this.result:this}; 0;g=l.enrich;h=l.resolve;continue}d[k]=m;m instanceof Promise&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=[a.result].concat(d));a.result=wa(d,e,f,g,h,a.O);return h?a.result:a});this.result.length&&(d=[this.result].concat(d));this.result=wa(d,e,f,g,h,a.O);return h?this.result:this};
function xa(a,b,c,d,e,f){if(!a.length)return a;"object"===typeof b&&(c=b.offset||0,d=b.enrich||!1,b=b.limit||0);if(2>a.length)return e?S(a[0],b,c,d):a[0];d=[];let g=0,h=z(),k=da(a);for(let l=0,m;l<k;l++)for(let n=0,q;n<a.length;n++)if(q=a[n])if(m=q[l])for(let t=0,p;t<m.length;t++)if(p=m[t],!h[p])if(h[p]=1,c)c--;else{if(e)d.push(p);else{const r=l+(n?f:0);d[r]||(d[r]=[]);d[r].push(p)}if(b&&++g===b)return d}return d};T.prototype.and=function(){if(this.result.length){const b=this;let c=arguments;var a=c[0];if(a instanceof Promise)return a.then(function(){return b.and.apply(b,c)});if(a[0]&&a[0].index)return this.and.apply(this,a);let d=[];a=[];let e=0,f=0,g;for(let h=0,k;h<c.length;h++)if(k=c[h]){let l;if(k instanceof T)l=k.result;else if(k.constructor===Array)l=k;else if(k.index)k.resolve=!1,l=k.index.search(k).result;else if(k.or)l=this.or(k.or);else if(k.xor)l=this.xor(k.xor);else if(k.G)l=this.G(k.G);else{e= function wa(a,b,c,d,e,f){if(!a.length)return a;"object"===typeof b&&(c=b.offset||0,d=b.enrich||!1,b=b.limit||0);if(2>a.length)return e?R(a[0],b,c,d):a[0];d=[];let g=0,h=z(),k=da(a);for(let l=0,m;l<k;l++)for(let n=0,q;n<a.length;n++)if(q=a[n])if(m=q[l])for(let t=0,p;t<m.length;t++)if(p=m[t],!h[p])if(h[p]=1,c)c--;else{if(e)d.push(p);else{const r=l+(n?f:0);d[r]||(d[r]=[]);d[r].push(p)}if(b&&++g===b)return d}return d};S.prototype.and=function(){if(this.result.length){const b=this;let c=arguments;var a=c[0];if(a instanceof Promise)return a.then(function(){return b.and.apply(b,c)});if(a[0]&&a[0].index)return this.and.apply(this,a);let d=[];a=[];let e=0,f=0,g;for(let h=0,k;h<c.length;h++)if(k=c[h]){let l;if(k instanceof S)l=k.result;else if(k.constructor===Array)l=k;else if(k.index)k.resolve=!1,l=k.index.search(k).result;else if(k.or)l=this.or(k.or);else if(k.xor)l=this.xor(k.xor);else if(k.F)l=this.F(k.F);else{e=
k.limit||0;f=k.offset||0;g=k.resolve;continue}d[h]=l;l instanceof Promise&&a.push(l)}if(a.length)return Promise.all(a).then(function(){d=[b.result].concat(d);b.result=ya(d,e,f,g,b.O);return g?b.result:b});d=[this.result].concat(d);this.result=ya(d,e,f,g,b.O);return g?this.result:this}return this}; k.limit||0;f=k.offset||0;g=k.resolve;continue}d[h]=l;l instanceof Promise&&a.push(l)}if(a.length)return Promise.all(a).then(function(){d=[b.result].concat(d);b.result=xa(d,e,f,g,b.O);return g?b.result:b});d=[this.result].concat(d);this.result=xa(d,e,f,g,b.O);return g?this.result:this}return this};
function ya(a,b,c,d,e){if(2>a.length)return[];let f=[],g=0,h=z(),k=da(a);if(!k)return f;for(let l=0,m;l<a.length;l++){m=a[l];if(!m||!m.length)return[];let n=z(),q=0,t=l===a.length-1;for(let p=0,r;p<k;p++)if(r=m[p])for(let x=0,A,w;x<r.length;x++)if(A=r[x],!l)n[A]=p+1+(l?e:0),q=1;else if(t){if(w=h[A])if(q=1,c)c--;else if(d?f.push(A):(w--,p<w&&(w=p),f[w]||(f[w]=[]),f[w].push(A)),b&&++g===b)return f}else if(w=h[A])p+1<w&&(w=p+1),n[A]=w,q=1;if(!q)return[];h=n}return f};T.prototype.xor=function(){const a=this;let b=arguments;var c=b[0];if(c instanceof Promise)return c.then(function(){return a.xor.apply(a,b)});if(c[0]&&c[0].index)return this.xor.apply(this,c);let d=[];c=[];let e=0,f=0,g,h;for(let k=0,l;k<b.length;k++)if(l=b[k]){let m;if(l instanceof T)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.or)m=this.or(l.or);else if(l.and)m=this.and(l.and);else if(l.G)m=this.G(l.G);else{e=l.limit||0;f=l.offset|| function xa(a,b,c,d,e){if(2>a.length)return[];let f=[],g=0,h=z(),k=da(a);if(!k)return f;for(let l=0,m;l<a.length;l++){m=a[l];if(!m||!m.length)return[];let n=z(),q=0,t=l===a.length-1;for(let p=0,r;p<k;p++)if(r=m[p])for(let x=0,A,w;x<r.length;x++)if(A=r[x],!l)n[A]=p+1+(l?e:0),q=1;else if(t){if(w=h[A])if(q=1,c)c--;else if(d?f.push(A):(w--,p<w&&(w=p),f[w]||(f[w]=[]),f[w].push(A)),b&&++g===b)return f}else if(w=h[A])p+1<w&&(w=p+1),n[A]=w,q=1;if(!q)return[];h=n}return f};S.prototype.xor=function(){const a=this;let b=arguments;var c=b[0];if(c instanceof Promise)return c.then(function(){return a.xor.apply(a,b)});if(c[0]&&c[0].index)return this.xor.apply(this,c);let d=[];c=[];let e=0,f=0,g,h;for(let k=0,l;k<b.length;k++)if(l=b[k]){let m;if(l instanceof S)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.or)m=this.or(l.or);else if(l.and)m=this.and(l.and);else if(l.F)m=this.F(l.F);else{e=l.limit||0;f=l.offset||
0;g=l.enrich;h=l.resolve;continue}d[k]=m;m instanceof Promise&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=[a.result].concat(d));a.result=za(d,e,f,g,!h,a.O);return h?a.result:a});this.result.length&&(d=[this.result].concat(d));this.result=za(d,e,f,g,!h,a.O);return h?this.result:this}; 0;g=l.enrich;h=l.resolve;continue}d[k]=m;m instanceof Promise&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=[a.result].concat(d));a.result=ya(d,e,f,g,!h,a.O);return h?a.result:a});this.result.length&&(d=[this.result].concat(d));this.result=ya(d,e,f,g,!h,a.O);return h?this.result:this};
function za(a,b,c,d,e,f){if(!a.length)return a;if(2>a.length)return e?S(a[0],b,c,d):a[0];b=[];c=z();for(let g=0,h;g<a.length;g++)if(h=a[g])for(let k=0,l;k<h.length;k++)if(l=h[k])for(let m=0,n;m<l.length;m++)n=l[m],c[n]?c[n]++:c[n]=1;for(let g=0,h;g<a.length;g++)if(h=a[g])for(let k=0,l;k<h.length;k++)if(l=h[k])for(let m=0,n;m<l.length;m++)n=l[m],1===c[n]&&(e?b.push(n):(d=k+(g?f:0),b[d]||(b[d]=[]),b[d].push(n)));return b};T.prototype.G=function(){const a=this;let b=arguments;var c=b[0];if(c instanceof Promise)return c.then(function(){return a.G.apply(a,b)});if(c[0]&&c[0].index)return this.G.apply(this,c);let d=[];c=[];let e;for(let f=0,g;f<b.length;f++)if(g=b[f]){let h;if(g instanceof T)h=g.result;else if(g.constructor===Array)h=g;else if(g.index)g.resolve=!1,h=g.index.search(g).result;else if(g.or)h=this.or(g.or);else if(g.and)h=this.and(g.and);else if(g.xor)h=this.xor(g.xor);else{e=g.resolve;continue}d[f]=h;h instanceof function ya(a,b,c,d,e,f){if(!a.length)return a;if(2>a.length)return e?R(a[0],b,c,d):a[0];b=[];c=z();for(let g=0,h;g<a.length;g++)if(h=a[g])for(let k=0,l;k<h.length;k++)if(l=h[k])for(let m=0,n;m<l.length;m++)n=l[m],c[n]?c[n]++:c[n]=1;for(let g=0,h;g<a.length;g++)if(h=a[g])for(let k=0,l;k<h.length;k++)if(l=h[k])for(let m=0,n;m<l.length;m++)n=l[m],1===c[n]&&(e?b.push(n):(d=k+(g?f:0),b[d]||(b[d]=[]),b[d].push(n)));return b};S.prototype.F=function(){const a=this;let b=arguments;var c=b[0];if(c instanceof Promise)return c.then(function(){return a.F.apply(a,b)});if(c[0]&&c[0].index)return this.F.apply(this,c);let d=[];c=[];let e;for(let f=0,g;f<b.length;f++)if(g=b[f]){let h;if(g instanceof S)h=g.result;else if(g.constructor===Array)h=g;else if(g.index)g.resolve=!1,h=g.index.search(g).result;else if(g.or)h=this.or(g.or);else if(g.and)h=this.and(g.and);else if(g.xor)h=this.xor(g.xor);else{e=g.resolve;continue}d[f]=h;h instanceof
Promise&&c.push(h)}if(c.length)return Promise.all(c).then(function(){a.result=Aa.call(a,d,e);return e?a.result:a});this.result=Aa.call(this,d,e);return e?this.result:this};function Aa(a,b){if(!a.length)return this.result;const c=[];a=new Set(a.flat().flat());for(let d=0,e;d<this.result.length;d++)if(e=this.result[d])for(let f=0,g;f<e.length;f++)g=e[f],a.has(g)||(b?c.push(g):(c[d]||(c[d]=[]),c[d].push(g)));return c};function T(a){if(a&&a.index)return a.resolve=!1,this.index=a.index,a.index.search(a);if(!(this instanceof T))return new T(a);if(a instanceof T)return a;this.index=null;this.result=a||[];this.O=0}T.prototype.limit=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)if(e=this.result[d],e.length+c<a)b[d]=e,c+=e.length;else{b[d]=e.slice(0,a-c);this.result=b;break}}return this}; Promise&&c.push(h)}if(c.length)return Promise.all(c).then(function(){a.result=za.call(a,d,e);return e?a.result:a});this.result=za.call(this,d,e);return e?this.result:this};function za(a,b){if(!a.length)return this.result;const c=[];a=new Set(a.flat().flat());for(let d=0,e;d<this.result.length;d++)if(e=this.result[d])for(let f=0,g;f<e.length;f++)g=e[f],a.has(g)||(b?c.push(g):(c[d]||(c[d]=[]),c[d].push(g)));return c};function S(a){if(a&&a.index)return a.resolve=!1,this.index=a.index,a.index.search(a);if(!(this instanceof S))return new S(a);if(a instanceof S)return a;this.index=null;this.result=a||[];this.O=0}S.prototype.limit=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)if(e=this.result[d],e.length+c<a)b[d]=e,c+=e.length;else{b[d]=e.slice(0,a-c);this.result=b;break}}return this};
T.prototype.offset=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)e=this.result[d],e.length+c<a?c+=e.length:(b[d]=e.slice(a-c),c=a);this.result=b}return this};T.prototype.resolve=function(a,b,c){U=1;const d=this.result;this.result=this.index=null;return d.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),S(d,a||100,b,c)):d};function Ba(a,b,c,d){var e=a.length;let f=[],g=0,h,k,l;d&&(d=[]);for(let m=e-1,n;0<=m;m--){l=a[m];e=z();n=!h;for(let q=0,t;q<l.length;q++)if((t=l[q])&&t.length)for(let p=0,r;p<t.length;p++)if(r=t[p],h){if(h[r]){if(!m)if(c)c--;else if(f[g++]=r,g===b)return f;if(m||d)e[r]=1;n=!0}d&&!k[r]&&(k[r]=1,(d[q]||(d[q]=[])).push(r))}else e[r]=1;if(d)h||(k=e);else if(!n)return[];h=e}if(d)for(let m=d.length-1,n,q;0<=m;m--){n=d[m];q=n.length;for(let t=0,p;t<q;t++)if(p=n[t],!h[p]){if(c)c--;else if(f[g++]=p,g===b)return f; S.prototype.offset=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)e=this.result[d],e.length+c<a?c+=e.length:(b[d]=e.slice(a-c),c=a);this.result=b}return this};S.prototype.resolve=function(a,b,c){T=1;const d=this.result;this.result=this.index=null;return d.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),R(d,a||100,b,c)):d};function Aa(a,b,c,d){var e=a.length;let f=[],g=0,h,k,l;d&&(d=[]);for(let m=e-1,n;0<=m;m--){l=a[m];e=z();n=!h;for(let q=0,t;q<l.length;q++)if((t=l[q])&&t.length)for(let p=0,r;p<t.length;p++)if(r=t[p],h){if(h[r]){if(!m)if(c)c--;else if(f[g++]=r,g===b)return f;if(m||d)e[r]=1;n=!0}d&&!k[r]&&(k[r]=1,(d[q]||(d[q]=[])).push(r))}else e[r]=1;if(d)h||(k=e);else if(!n)return[];h=e}if(d)for(let m=d.length-1,n,q;0<=m;m--){n=d[m];q=n.length;for(let t=0,p;t<q;t++)if(p=n[t],!h[p]){if(c)c--;else if(f[g++]=p,g===b)return f;
h[p]=1}}return f}function Ca(a,b){const c=z(),d=z(),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 h=0,k;h<g.length;h++)k=g[h],c[k]&&!d[k]&&(d[k]=1,e.push(k))}return e};let U=1; h[p]=1}}return f}function Ba(a,b){const c=z(),d=z(),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 h=0,k;h<g.length;h++)k=g[h],c[k]&&!d[k]&&(d[k]=1,e.push(k))}return e};let T=1;
P.prototype.search=function(a,b,c){c||(!b&&C(a)?(c=a,a=""):C(b)&&(c=b,b=0));let d=[],e;let f,g=0,h,k,l;if(c){a=c.query||a;b=c.limit||b;g=c.offset||0;var m=c.context;f=c.suggest;(h=U&&!1!==c.resolve)||(U=0);k=h&&c.enrich;l=this.db&&c.tag}else h=this.resolve||U;a=this.encoder.encode(a);e=a.length;b||!h||(b=100);if(1===e)return Da.call(this,a[0],"",b,g,h,k,l);m=this.depth&&!1!==m;if(2===e&&m&&!f)return Da.call(this,a[0],a[1],b,g,h,k,l);let n=c=0;if(1<e){const p=z(),r=[];for(let x=0,A;x<e;x++)if((A=a[x])&& O.prototype.search=function(a,b,c){c||(!b&&C(a)?(c=a,a=""):C(b)&&(c=b,b=0));let d=[],e;let f,g=0,h,k,l;if(c){a=c.query||a;b=c.limit||b;g=c.offset||0;var m=c.context;f=c.suggest;(h=T&&!1!==c.resolve)||(T=0);k=h&&c.enrich;l=this.db&&c.tag}else h=this.resolve||T;a=this.encoder.encode(a);e=a.length;b||!h||(b=100);if(1===e)return Ca.call(this,a[0],"",b,g,h,k,l);m=this.depth&&!1!==m;if(2===e&&m&&!f)return Ca.call(this,a[0],a[1],b,g,h,k,l);let n=c=0;if(1<e){const p=z(),r=[];for(let x=0,A;x<e;x++)if((A=a[x])&&
!p[A]){if(f||this.db||V(this,A))r.push(A),p[A]=1;else return h?d:new T(d);const w=A.length;c=Math.max(c,w);n=n?Math.min(n,w):w}a=r;e=a.length}if(!e)return h?d:new T(d);let q=0,t;if(1===e)return Da.call(this,a[0],"",b,g,h,k,l);if(2===e&&m&&!f)return Da.call(this,a[0],a[1],b,g,h,k,l);1<e&&(m?(t=a[0],q=1):9<c&&3<c/n&&a.sort(aa));if(this.db){if(this.db.search&&(m=this.db.search(this,a,b,g,f,h,k,l),!1!==m))return m;const p=this;return async function(){for(let r,x;q<e;q++){x=a[q];t?(r=await V(p,x,t),r= !p[A]){if(f||this.db||U(this,A))r.push(A),p[A]=1;else return h?d:new S(d);const w=A.length;c=Math.max(c,w);n=n?Math.min(n,w):w}a=r;e=a.length}if(!e)return h?d:new S(d);let q=0,t;if(1===e)return Ca.call(this,a[0],"",b,g,h,k,l);if(2===e&&m&&!f)return Ca.call(this,a[0],a[1],b,g,h,k,l);1<e&&(m?(t=a[0],q=1):9<c&&3<c/n&&a.sort(aa));if(this.db){if(this.db.search&&(m=this.db.search(this,a,b,g,f,h,k,l),!1!==m))return m;const p=this;return async function(){for(let r,x;q<e;q++){x=a[q];t?(r=await U(p,x,t),r=
Ea(r,d,f,p.da,b,g,2===e),f&&!1===r&&d.length||(t=x)):(r=await V(p,x),r=Ea(r,d,f,p.resolution,b,g,1===e));if(r)return r;if(f&&q===e-1){let A=d.length;if(!A){if(t){t="";q=-1;continue}return d}if(1===A)return h?S(d[0],b,g):new T(d[0])}}return h?Ba(d,b,g,f):new T(d[0])}()}for(let p,r;q<e;q++){r=a[q];t?(p=V(this,r,t),p=Ea(p,d,f,this.da,b,g,2===e),f&&!1===p&&d.length||(t=r)):(p=V(this,r),p=Ea(p,d,f,this.resolution,b,g,1===e));if(p)return p;if(f&&q===e-1){m=d.length;if(!m){if(t){t="";q=-1;continue}return d}if(1=== Da(r,d,f,p.da,b,g,2===e),f&&!1===r&&d.length||(t=x)):(r=await U(p,x),r=Da(r,d,f,p.resolution,b,g,1===e));if(r)return r;if(f&&q===e-1){let A=d.length;if(!A){if(t){t="";q=-1;continue}return d}if(1===A)return h?R(d[0],b,g):new S(d[0])}}return h?Aa(d,b,g,f):new S(d[0])}()}for(let p,r;q<e;q++){r=a[q];t?(p=U(this,r,t),p=Da(p,d,f,this.da,b,g,2===e),f&&!1===p&&d.length||(t=r)):(p=U(this,r),p=Da(p,d,f,this.resolution,b,g,1===e));if(p)return p;if(f&&q===e-1){m=d.length;if(!m){if(t){t="";q=-1;continue}return d}if(1===
m)return h?S(d[0],b,g):new T(d[0])}}return h?Ba(d,b,g,f):new T(d[0])};function Da(a,b,c,d,e,f,g){a=V(this,a,b,c,d,e,f,g);return this.db?a.then(function(h){return e?h:h&&h.length?e?S(h,c,d):new T(h):e?[]:new T([])}):a&&a.length?e?S(a,c,d):new T(a):e?[]:new T([])} m)return h?R(d[0],b,g):new S(d[0])}}return h?Aa(d,b,g,f):new S(d[0])};function Ca(a,b,c,d,e,f,g){a=U(this,a,b,c,d,e,f,g);return this.db?a.then(function(h){return e?h:h&&h.length?e?R(h,c,d):new S(h):e?[]:new S([])}):a&&a.length?e?R(a,c,d):new S(a):e?[]:new S([])}
function Ea(a,b,c,d,e,f,g){let h=[];if(a){d=Math.min(a.length,d);for(let k=0,l=0,m;k<d;k++)if(m=a[k])if(f&&m&&g&&(m.length<=f?(f-=m.length,m=null):(m=m.slice(f),f=0)),m&&(h[k]=m,g&&(l+=m.length,l>=e)))break;if(h.length){if(g)return S(h,e,0);b.push(h);return}}return!c&&h}function V(a,b,c,d,e,f,g,h){let k;c&&(k=a.bidirectional&&b>c);if(a.db)return c?a.db.get(k?c:b,k?b:c,d,e,f,g,h):a.db.get(b,"",d,e,f,g,h);a=c?(a=a.I.get(k?b:c))&&a.get(k?c:b):a.map.get(b);return a};P.prototype.remove=function(a,b){const c=this.A.size&&(this.fastupdate?this.A.get(a):this.A.has(a));if(c){if(this.fastupdate)for(let d=0,e;d<c.length;d++){if(e=c[d])if(2>e.length)e.pop();else{const f=e.indexOf(a);f===c.length-1?e.pop():e.splice(f,1)}}else Fa(this.map,a),this.depth&&Fa(this.I,a);b||this.A.delete(a)}this.db&&(this.R.push({del:a}),this.fa&&va(this));this.cache&&this.cache.remove(a);return this}; function Da(a,b,c,d,e,f,g){let h=[];if(a){d=Math.min(a.length,d);for(let k=0,l=0,m;k<d;k++)if(m=a[k])if(f&&m&&g&&(m.length<=f?(f-=m.length,m=null):(m=m.slice(f),f=0)),m&&(h[k]=m,g&&(l+=m.length,l>=e)))break;if(h.length){if(g)return R(h,e,0);b.push(h);return}}return!c&&h}function U(a,b,c,d,e,f,g,h){let k;c&&(k=a.bidirectional&&b>c);if(a.db)return c?a.db.get(k?c:b,k?b:c,d,e,f,g,h):a.db.get(b,"",d,e,f,g,h);a=c?(a=a.I.get(k?b:c))&&a.get(k?c:b):a.map.get(b);return a};O.prototype.remove=function(a,b){const c=this.A.size&&(this.fastupdate?this.A.get(a):this.A.has(a));if(c){if(this.fastupdate)for(let d=0,e;d<c.length;d++){if(e=c[d])if(2>e.length)e.pop();else{const f=e.indexOf(a);f===c.length-1?e.pop():e.splice(f,1)}}else Ea(this.map,a),this.depth&&Ea(this.I,a);b||this.A.delete(a)}this.db&&(this.R.push({del:a}),this.fa&&ua(this));this.cache&&this.cache.remove(a);return this};
function Fa(a,b){let c=0;if(a.constructor===Array)for(let d=0,e,f;d<a.length;d++){if((e=a[d])&&e.length)if(f=e.indexOf(b),0<=f){1<e.length?(e.splice(f,1),c++):delete a[d];break}else c++}else for(let d of a){const e=d[0],f=Fa(d[1],b);f?c+=f:a.delete(e)}return c};function P(a,b){if(!(this instanceof P))return new P(a);if(a){var c=B(a)?a:a.preset;c&&(a=Object.assign({},ta[c],a))}else a={};c=a.context||{};const d=a.encode||a.encoder||sa;this.encoder=d.encode?d:"object"===typeof d?new E(d):{encode:d};let e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&c.depth||0;this.bidirectional=!1!==c.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;(e=a.keystore||0)&&(this.keystore=e);this.map=e?new K(e): function Ea(a,b){let c=0;if(a.constructor===Array)for(let d=0,e,f;d<a.length;d++){if((e=a[d])&&e.length)if(f=e.indexOf(b),0<=f){1<e.length?(e.splice(f,1),c++):delete a[d];break}else c++}else for(let d of a){const e=d[0],f=Ea(d[1],b);f?c+=f:a.delete(e)}return c};function O(a,b){if(!(this instanceof O))return new O(a);if(a){var c=B(a)?a:a.preset;c&&(a=Object.assign({},sa[c],a))}else a={};c=a.context||{};const d=a.encode||a.encoder||ra;this.encoder=d.encode?d:"object"===typeof d?new E(d):{encode:d};let e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&c.depth||0;this.bidirectional=!1!==c.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;(e=a.keystore||0)&&(this.keystore=e);this.map=e?new K(e):
new Map;this.I=e?new K(e):new Map;this.A=b||(this.fastupdate?e?new K(e):new Map:e?new L(e):new Set);this.da=c.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new F(e);this.resolve=!1!==a.resolve;if(e=a.db)this.db=e.mount(this);this.fa=!1!==a.commit;this.R=[];this.h=null}u=P.prototype;u.mount=function(a){this.h&&(clearTimeout(this.h),this.h=null);return a.mount(this)};u.commit=function(a,b){this.h&&(clearTimeout(this.h),this.h=null);return this.db.commit(this,a,b)}; new Map;this.I=e?new K(e):new Map;this.A=b||(this.fastupdate?e?new K(e):new Map:e?new L(e):new Set);this.da=c.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new F(e);this.resolve=!1!==a.resolve;if(e=a.db)this.db=e.mount(this);this.fa=!1!==a.commit;this.R=[];this.h=null}u=O.prototype;u.mount=function(a){this.h&&(clearTimeout(this.h),this.h=null);return a.mount(this)};u.commit=function(a,b){this.h&&(clearTimeout(this.h),this.h=null);return this.db.commit(this,a,b)};
function va(a){a.h||(a.h=setTimeout(function(){a.h=null;a.db.commit(a,void 0,void 0)},0))}u.clear=function(){this.map.clear();this.I.clear();this.A.clear();this.cache&&this.cache.clear();this.db&&(this.h&&clearTimeout(this.h),this.h=null,this.R=[{clear:!0}]);return this};u.append=function(a,b){return this.add(a,b,!0)};u.contain=function(a){return this.db?this.db.has(a):this.A.has(a)}; function ua(a){a.h||(a.h=setTimeout(function(){a.h=null;a.db.commit(a,void 0,void 0)},0))}u.clear=function(){this.map.clear();this.I.clear();this.A.clear();this.cache&&this.cache.clear();this.db&&(this.h&&clearTimeout(this.h),this.h=null,this.R=[{clear:!0}]);return this};u.append=function(a,b){return this.add(a,b,!0)};u.contain=function(a){return this.db?this.db.has(a):this.A.has(a)};
u.update=function(a,b){if(this.async){const c=this,d=this.remove(a);return d.then?d.then(()=>c.add(a,b)):this.add(a,b)}return this.remove(a).add(a,b)};function Ga(a){let b=0;if(a.constructor===Array)for(let c=0,d;c<a.length;c++)(d=a[c])&&(b+=d.length);else for(const c of a){const d=c[0],e=Ga(c[1]);e?b+=e:a.delete(d)}return b}u.cleanup=function(){if(!this.fastupdate)return this;Ga(this.map);this.depth&&Ga(this.I);return this};u.searchCache=ma; u.update=function(a,b){if(this.async){const c=this,d=this.remove(a);return d.then?d.then(()=>c.add(a,b)):this.add(a,b)}return this.remove(a).add(a,b)};function Fa(a){let b=0;if(a.constructor===Array)for(let c=0,d;c<a.length;c++)(d=a[c])&&(b+=d.length);else for(const c of a){const d=c[0],e=Fa(c[1]);e?b+=e:a.delete(d)}return b}u.cleanup=function(){if(!this.fastupdate)return this;Fa(this.map);this.depth&&Fa(this.I);return this};u.searchCache=ma;
u.export=function(a,b,c,d,e,f){let g=!0;"undefined"===typeof f&&(g=new Promise(l=>{f=l}));let h,k;switch(e||(e=0)){case 0:h="reg";if(this.fastupdate){k=z();for(let l of this.A.keys())k[l]=1}else k=this.A;break;case 1:h="cfg";k={doc:0,opt:this.B?1:0};break;case 2:h="map";k=this.map;break;case 3:h="ctx";k=this.I;break;default:"undefined"===typeof c&&f&&f();return}qa(a,b||this,c,h,d,e,k,f);return g}; u.export=function(a,b,c,d,e,f){let g=!0;"undefined"===typeof f&&(g=new Promise(l=>{f=l}));let h,k;switch(e||(e=0)){case 0:h="reg";if(this.fastupdate){k=z();for(let l of this.A.keys())k[l]=1}else k=this.A;break;case 1:h="cfg";k={doc:0,opt:this.B?1:0};break;case 2:h="map";k=this.map;break;case 3:h="ctx";k=this.I;break;default:"undefined"===typeof c&&f&&f();return}qa(a,b||this,c,h,d,e,k,f);return g};
u.import=function(a,b){if(b)switch(B(b)&&(b=JSON.parse(b)),a){case "cfg":this.B=!!b.opt;break;case "reg":this.fastupdate=!1;this.A=b;break;case "map":this.map=b;break;case "ctx":this.I=b}};ua(P.prototype);async function Ha(a){a=a.data;var b=self._index;const c=a.args;var d=a.task;switch(d){case "init":d=a.options||{};(b=d.config)&&(d=await import(b));(b=a.factory)?(Function("return "+b)()(self),self._index=new self.FlexSearch.Index(d),delete self.FlexSearch):self._index=new P(d);postMessage({id:a.id});break;default:a=a.id,b=b[d].apply(b,c),postMessage("search"===d?{id:a,msg:b}:{id:a})}};let Ia=0; u.import=function(a,b){if(b)switch(B(b)&&(b=JSON.parse(b)),a){case "cfg":this.B=!!b.opt;break;case "reg":this.fastupdate=!1;this.A=b;break;case "map":this.map=b;break;case "ctx":this.I=b}};ta(O.prototype);async function Ga(a){a=a.data;var b=self._index;const c=a.args;var d=a.task;switch(d){case "init":d=a.options||{};(b=d.config)&&(d=await import(b));(b=a.factory)?(Function("return "+b)()(self),self._index=new self.FlexSearch.Index(d),delete self.FlexSearch):self._index=new O(d);postMessage({id:a.id});break;default:a=a.id,b=b[d].apply(b,c),postMessage("search"===d?{id:a,msg:b}:{id:a})}};let Ha=0;
function W(a){function b(f){f=f.data||f;const g=f.id,h=g&&e.h[g];h&&(h(f.msg),delete e.h[g])}if(!(this instanceof W))return new W(a);a||(a={});let c=(self||window)._factory;c&&(c=c.toString());const d="undefined"===typeof window&&self.exports,e=this;this.worker=Ja(c,d,a.worker);this.h=z();if(this.worker){d?this.worker.on("message",b):this.worker.onmessage=b;if(a.config)return new Promise(function(f){e.h[++Ia]=function(){f(e)};e.worker.postMessage({id:Ia,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init", function V(a){function b(f){f=f.data||f;const g=f.id,h=g&&e.h[g];h&&(h(f.msg),delete e.h[g])}if(!(this instanceof V))return new V(a);a||(a={});let c=(self||window)._factory;c&&(c=c.toString());const d="undefined"===typeof window&&self.exports,e=this;this.worker=Ia(c,d,a.worker);this.h=z();if(this.worker){d?this.worker.on("message",b):this.worker.onmessage=b;if(a.config)return new Promise(function(f){e.h[++Ha]=function(){f(e)};e.worker.postMessage({id:Ha,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",
factory:c,options:a})}}X("add");X("append");X("search");X("update");X("remove");function X(a){W.prototype[a]=W.prototype[a+"Async"]=function(){const b=this,c=[].slice.call(arguments);var d=c[c.length-1];let e;"function"===typeof d&&(e=d,c.splice(c.length-1,1));d=new Promise(function(f){b.h[++Ia]=f;b.worker.postMessage({task:a,id:Ia,args:c})});return e?(d.then(e),this):d}} factory:c,options:a})}}W("add");W("append");W("search");W("update");W("remove");function W(a){V.prototype[a]=V.prototype[a+"Async"]=function(){const b=this,c=[].slice.call(arguments);var d=c[c.length-1];let e;"function"===typeof d&&(e=d,c.splice(c.length-1,1));d=new Promise(function(f){b.h[++Ha]=f;b.worker.postMessage({task:a,id:Ha,args:c})});return e?(d.then(e),this):d}}
function Ja(a,b,c){return b?new (require("worker_threads")["Worker"])(__dirname + "/node/node.js"):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+Ha.toString()],{type:"text/javascript"}))):new window.Worker(B(c)?c:"worker/worker.js",{type:"module"})};Y.prototype.add=function(a,b,c){C(a)&&(b=a,a=ca(b,this.key));if(b&&(a||0===a)){if(!c&&this.A.has(a))return this.update(a,b);for(let h=0,k;h<this.field.length;h++){k=this.M[h];var d=this.index.get(this.field[h]);if("function"===typeof k){var e=k(b);e&&d.add(a,e,!1,!0)}else if(e=k.T,!e||e(b))k instanceof String?k=[""+k]:B(k)&&(k=[k]),Ka(b,k,this.W,0,d,a,k[0],c)}if(this.tag)for(d=0;d<this.L.length;d++){var f=this.L[d];e=this.tag.get(this.aa[d]);let h=z();if("function"===typeof f){if(f=f(b),!f)continue}else{var g= function Ia(a,b,c){return b?new (require("worker_threads")["Worker"])(__dirname + "/node/node.js"):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+Ga.toString()],{type:"text/javascript"}))):new window.Worker(B(c)?c:"worker/worker.js",{type:"module"})};X.prototype.add=function(a,b,c){C(a)&&(b=a,a=ca(b,this.key));if(b&&(a||0===a)){if(!c&&this.A.has(a))return this.update(a,b);for(let h=0,k;h<this.field.length;h++){k=this.M[h];var d=this.index.get(this.field[h]);if("function"===typeof k){var e=k(b);e&&d.add(a,e,!1,!0)}else if(e=k.T,!e||e(b))k instanceof String?k=[""+k]:B(k)&&(k=[k]),Ja(b,k,this.W,0,d,a,k[0],c)}if(this.tag)for(d=0;d<this.L.length;d++){var f=this.L[d];e=this.tag.get(this.aa[d]);let h=z();if("function"===typeof f){if(f=f(b),!f)continue}else{var g=
f.T;if(g&&!g(b))continue;f instanceof String&&(f=""+f);f=ca(b,f)}if(e&&f){B(f)&&(f=[f]);for(let k=0,l,m;k<f.length;k++)if(l=f[k],!h[l]&&(h[l]=1,(g=e.get(l))?m=g:e.set(l,m=[]),!c||!m.includes(a))){if(m.length===2**31-1){g=new H(m);if(this.fastupdate)for(let n of this.A.values())n.includes(m)&&(n[n.indexOf(m)]=g);e.set(l,m=g)}m.push(a);this.fastupdate&&((g=this.A.get(a))?g.push(m):this.A.set(a,[m]))}}}if(this.store&&(!c||!this.store.has(a))){let h;if(this.H){h=z();for(let k=0,l;k<this.H.length;k++){l= f.T;if(g&&!g(b))continue;f instanceof String&&(f=""+f);f=ca(b,f)}if(e&&f){B(f)&&(f=[f]);for(let k=0,l,m;k<f.length;k++)if(l=f[k],!h[l]&&(h[l]=1,(g=e.get(l))?m=g:e.set(l,m=[]),!c||!m.includes(a))){if(m.length===2**31-1){g=new H(m);if(this.fastupdate)for(let n of this.A.values())n.includes(m)&&(n[n.indexOf(m)]=g);e.set(l,m=g)}m.push(a);this.fastupdate&&((g=this.A.get(a))?g.push(m):this.A.set(a,[m]))}}}if(this.store&&(!c||!this.store.has(a))){let h;if(this.H){h=z();for(let k=0,l;k<this.H.length;k++){l=
this.H[k];if((c=l.T)&&!c(b))continue;let m;if("function"===typeof l){m=l(b);if(!m)continue;l=[l.ia]}else if(B(l)||l instanceof String){h[l]=b[l];continue}La(b,h,l,0,l[0],m)}}this.store.set(a,h||b)}}return this};function La(a,b,c,d,e,f){a=a[e];if(d===c.length-1)b[e]=f||a;else if(a)if(a.constructor===Array)for(b=b[e]=Array(a.length),e=0;e<a.length;e++)La(a,b,c,d,e);else b=b[e]||(b[e]=z()),e=c[++d],La(a,b,c,d,e)} this.H[k];if((c=l.T)&&!c(b))continue;let m;if("function"===typeof l){m=l(b);if(!m)continue;l=[l.ia]}else if(B(l)||l instanceof String){h[l]=b[l];continue}Ka(b,h,l,0,l[0],m)}}this.store.set(a,h||b)}}return this};function Ka(a,b,c,d,e,f){a=a[e];if(d===c.length-1)b[e]=f||a;else if(a)if(a.constructor===Array)for(b=b[e]=Array(a.length),e=0;e<a.length;e++)Ka(a,b,c,d,e);else b=b[e]||(b[e]=z()),e=c[++d],Ka(a,b,c,d,e)}
function Ka(a,b,c,d,e,f,g,h){if(a=a[g])if(d===b.length-1){if(a.constructor===Array){if(c[d]){for(b=0;b<a.length;b++)e.add(f,a[b],!0,!0);return}a=a.join(" ")}e.add(f,a,h,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)Ka(a,b,c,d,e,f,g,h);else g=b[++d],Ka(a,b,c,d,e,f,g,h);else e.db&&e.remove(f)};Y.prototype.search=function(a,b,c,d){c||(!b&&C(a)?(c=a,a=""):C(b)&&(c=b,b=0));let e=[],f=[],g;let h;let k;let l,m=0;if(c)if(c.constructor===Array)k=c,c=null;else{a=c.query||a;g=c.pluck;h=c.merge;k=g||c.field||c.index;var n=this.tag&&c.tag;var q=this.store&&c.enrich;var t=c.suggest;b=c.limit||b;l=c.offset||0;b||(b=100);if(n&&(!this.db||!d)){n.constructor!==Array&&(n=[n]);var p=[];for(let w=0,v;w<n.length;w++)if(v=n[w],v.field&&v.tag){var r=v.tag;if(r.constructor===Array)for(var x=0;x<r.length;x++)p.push(v.field, function Ja(a,b,c,d,e,f,g,h){if(a=a[g])if(d===b.length-1){if(a.constructor===Array){if(c[d]){for(b=0;b<a.length;b++)e.add(f,a[b],!0,!0);return}a=a.join(" ")}e.add(f,a,h,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)Ja(a,b,c,d,e,f,g,h);else g=b[++d],Ja(a,b,c,d,e,f,g,h);else e.db&&e.remove(f)};X.prototype.search=function(a,b,c,d){c||(!b&&C(a)?(c=a,a=""):C(b)&&(c=b,b=0));let e=[],f=[],g;let h;let k;let l,m=0;if(c)if(c.constructor===Array)k=c,c=null;else{a=c.query||a;g=c.pluck;h=c.merge;k=g||c.field||c.index;var n=this.tag&&c.tag;var q=this.store&&c.enrich;var t=c.suggest;b=c.limit||b;l=c.offset||0;b||(b=100);if(n&&(!this.db||!d)){n.constructor!==Array&&(n=[n]);var p=[];for(let w=0,v;w<n.length;w++)if(v=n[w],v.field&&v.tag){var r=v.tag;if(r.constructor===Array)for(var x=0;x<r.length;x++)p.push(v.field,
r[x]);else p.push(v.field,r)}else{r=Object.keys(v);for(let I=0,J,D;I<r.length;I++)if(J=r[I],D=v[J],D.constructor===Array)for(x=0;x<D.length;x++)p.push(J,D[x]);else p.push(J,D)}n=p;if(!a){t=[];if(p.length)for(n=0;n<p.length;n+=2){if(this.db){d=this.index.get(p[n]);if(!d)continue;t.push(d=d.db.tag(p[n+1],b,l,q))}else d=Ma.call(this,p[n],p[n+1],b,l,q);e.push({field:p[n],tag:p[n+1],result:d})}return t.length?Promise.all(t).then(function(w){for(let v=0;v<w.length;v++)e[v].result=w[v];return e}):e}}B(k)&& r[x]);else p.push(v.field,r)}else{r=Object.keys(v);for(let I=0,J,D;I<r.length;I++)if(J=r[I],D=v[J],D.constructor===Array)for(x=0;x<D.length;x++)p.push(J,D[x]);else p.push(J,D)}n=p;if(!a){t=[];if(p.length)for(n=0;n<p.length;n+=2){if(this.db){d=this.index.get(p[n]);if(!d)continue;t.push(d=d.db.tag(p[n+1],b,l,q))}else d=La.call(this,p[n],p[n+1],b,l,q);e.push({field:p[n],tag:p[n+1],result:d})}return t.length?Promise.all(t).then(function(w){for(let v=0;v<w.length;v++)e[v].result=w[v];return e}):e}}B(k)&&
(k=[k])}k||(k=this.field);p=!d&&(this.worker||this.async)&&[];let A;for(let w=0,v,I,J;w<k.length;w++){I=k[w];if(this.db&&this.tag&&!this.M[w])continue;let D;B(I)||(D=I,I=D.field,a=D.query||a,b=D.limit||b,t=D.suggest||t);if(d)v=d[w];else if(r=D||c,x=this.index.get(I),n&&(this.db&&(r.tag=n,A=x.db.la,r.field=k),A||(r.enrich=!1)),p){p[w]=x.searchAsync(a,b,r);r&&q&&(r.enrich=q);continue}else v=x.search(a,b,r),r&&q&&(r.enrich=q);J=v&&v.length;if(n&&J){r=[];x=0;if(this.db&&d){if(!A)for(let N=k.length;N< (k=[k])}k||(k=this.field);p=!d&&(this.worker||this.async)&&[];let A;for(let w=0,v,I,J;w<k.length;w++){I=k[w];if(this.db&&this.tag&&!this.M[w])continue;let D;B(I)||(D=I,I=D.field,a=D.query||a,b=D.limit||b,t=D.suggest||t);if(d)v=d[w];else if(r=D||c,x=this.index.get(I),n&&(this.db&&(r.tag=n,A=x.db.la,r.field=k),A||(r.enrich=!1)),p){p[w]=x.searchAsync(a,b,r);r&&q&&(r.enrich=q);continue}else v=x.search(a,b,r),r&&q&&(r.enrich=q);J=v&&v.length;if(n&&J){r=[];x=0;if(this.db&&d){if(!A)for(let M=k.length;M<
d.length;N++){let G=d[N];if(G&&G.length)x++,r.push(G);else if(!t)return e}}else for(let N=0,G,Xa;N<n.length;N+=2){G=this.tag.get(n[N]);if(!G)if(t)continue;else return e;if(Xa=(G=G&&G.get(n[N+1]))&&G.length)x++,r.push(G);else if(!t)return e}if(x){v=Ca(v,r);J=v.length;if(!J&&!t)return e;x--}}if(J)f[m]=I,e.push(v),m++;else if(1===k.length)return e}if(p){if(this.db&&n&&n.length&&!A)for(q=0;q<n.length;q+=2){d=this.index.get(n[q]);if(!d)if(t)continue;else return e;p.push(d.db.tag(n[q+1],b,l,!1))}const w= d.length;M++){let G=d[M];if(G&&G.length)x++,r.push(G);else if(!t)return e}}else for(let M=0,G,Wa;M<n.length;M+=2){G=this.tag.get(n[M]);if(!G)if(t)continue;else return e;if(Wa=(G=G&&G.get(n[M+1]))&&G.length)x++,r.push(G);else if(!t)return e}if(x){v=Ba(v,r);J=v.length;if(!J&&!t)return e;x--}}if(J)f[m]=I,e.push(v),m++;else if(1===k.length)return e}if(p){if(this.db&&n&&n.length&&!A)for(q=0;q<n.length;q+=2){d=this.index.get(n[q]);if(!d)if(t)continue;else return e;p.push(d.db.tag(n[q+1],b,l,!1))}const w=
this;return Promise.all(p).then(function(v){return v.length?w.search(a,b,c,v):v})}if(!m)return e;if(g&&(!q||!this.store))return e[0];p=[];for(let w=0,v;w<f.length;w++){v=e[w];q&&v.length&&!v[0].doc&&(this.db?p.push(v=this.index.get(this.field[0]).db.enrich(v)):v.length&&(v=Na.call(this,v)));if(g)return v;e[w]={field:f[w],result:v}}return q&&this.db&&p.length?Promise.all(p).then(function(w){for(let v=0;v<w.length;v++)e[v].result=w[v];return h?Oa(e,b):e}):h?Oa(e,b):e}; this;return Promise.all(p).then(function(v){return v.length?w.search(a,b,c,v):v})}if(!m)return e;if(g&&(!q||!this.store))return e[0];p=[];for(let w=0,v;w<f.length;w++){v=e[w];q&&v.length&&!v[0].doc&&(this.db?p.push(v=this.index.get(this.field[0]).db.enrich(v)):v.length&&(v=Ma.call(this,v)));if(g)return v;e[w]={field:f[w],result:v}}return q&&this.db&&p.length?Promise.all(p).then(function(w){for(let v=0;v<w.length;v++)e[v].result=w[v];return h?Na(e,b):e}):h?Na(e,b):e};
function Oa(a,b){const c=[],d=z();for(let e=0,f,g;e<a.length;e++){f=a[e];g=f.result;for(let h=0,k,l,m;h<g.length;h++)if(l=g[h],k=l.id,m=d[k])m.push(f.field);else{if(c.length===b)return c;l.field=d[k]=[f.field];c.push(l)}}return c}function Ma(a,b,c,d,e){a=this.tag.get(a);if(!a)return[];if((b=(a=a&&a.get(b))&&a.length-d)&&0<b){if(b>c||d)a=a.slice(d,d+c);e&&(a=Na.call(this,a));return a}} function Na(a,b){const c=[],d=z();for(let e=0,f,g;e<a.length;e++){f=a[e];g=f.result;for(let h=0,k,l,m;h<g.length;h++)if(l=g[h],k=l.id,m=d[k])m.push(f.field);else{if(c.length===b)return c;l.field=d[k]=[f.field];c.push(l)}}return c}function La(a,b,c,d,e){a=this.tag.get(a);if(!a)return[];if((b=(a=a&&a.get(b))&&a.length-d)&&0<b){if(b>c||d)a=a.slice(d,d+c);e&&(a=Ma.call(this,a));return a}}
function Na(a){const b=Array(a.length);for(let c=0,d;c<a.length;c++)d=a[c],b[c]={id:d,doc:this.store.get(d)};return b};function Y(a){if(!(this instanceof Y))return new Y(a);const b=a.document||a.doc||a;var c,d;this.M=[];this.field=[];this.W=[];this.key=(c=b.key||b.id)&&Pa(c,this.W)||"id";(d=a.keystore||0)&&(this.keystore=d);this.A=(this.fastupdate=!!a.fastupdate)?d?new K(d):new Map:d?new L(d):new Set;this.H=(c=b.store||null)&&!0!==c&&[];this.store=c&&(d?new K(d):new Map);this.cache=(c=a.cache||null)&&new F(c);a.cache=!1;this.worker=a.worker;this.async=!1;c=new Map;d=b.index||b.field||b;B(d)&&(d=[d]);for(let e=0,f, function Ma(a){const b=Array(a.length);for(let c=0,d;c<a.length;c++)d=a[c],b[c]={id:d,doc:this.store.get(d)};return b};function X(a){if(!(this instanceof X))return new X(a);const b=a.document||a.doc||a;var c,d;this.M=[];this.field=[];this.W=[];this.key=(c=b.key||b.id)&&Oa(c,this.W)||"id";(d=a.keystore||0)&&(this.keystore=d);this.A=(this.fastupdate=!!a.fastupdate)?d?new K(d):new Map:d?new L(d):new Set;this.H=(c=b.store||null)&&!0!==c&&[];this.store=c&&(d?new K(d):new Map);this.cache=(c=a.cache||null)&&new F(c);a.cache=!1;this.worker=a.worker;this.async=!1;c=new Map;d=b.index||b.field||b;B(d)&&(d=[d]);for(let e=0,f,
g;e<d.length;e++){f=d[e];B(f)||(g=f,f=f.field);g=C(g)?Object.assign({},a,g):a;if(this.worker){const h=new W(g);c.set(f,h);h.worker||(this.worker=!1)}this.worker||c.set(f,new P(g,this.A));g.S?this.M[e]=g.S:(this.M[e]=Pa(f,this.W),g.filter&&("string"===typeof this.M[e]&&(this.M[e]=new String(this.M[e])),this.M[e].T=g.filter));this.field[e]=f}if(this.H){d=b.store;B(d)&&(d=[d]);for(let e=0,f,g;e<d.length;e++)f=d[e],g=f.field||f,f.S?(this.H[e]=f.S,f.S.ia=g):(this.H[e]=Pa(g,this.W),f.filter&&("string"=== g;e<d.length;e++){f=d[e];B(f)||(g=f,f=f.field);g=C(g)?Object.assign({},a,g):a;if(this.worker){const h=new V(g);c.set(f,h);h.worker||(this.worker=!1)}this.worker||c.set(f,new O(g,this.A));g.S?this.M[e]=g.S:(this.M[e]=Oa(f,this.W),g.filter&&("string"===typeof this.M[e]&&(this.M[e]=new String(this.M[e])),this.M[e].T=g.filter));this.field[e]=f}if(this.H){d=b.store;B(d)&&(d=[d]);for(let e=0,f,g;e<d.length;e++)f=d[e],g=f.field||f,f.S?(this.H[e]=f.S,f.S.ia=g):(this.H[e]=Oa(g,this.W),f.filter&&("string"===
typeof this.H[e]&&(this.H[e]=new String(this.H[e])),this.H[e].T=f.filter))}this.index=c;this.tag=null;if(c=b.tag)if("string"===typeof c&&(c=[c]),c.length){this.tag=new Map;this.L=[];this.aa=[];for(let e=0,f,g;e<c.length;e++){f=c[e];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");f.S?this.L[e]=f.S:(this.L[e]=Pa(g,this.W),f.filter&&("string"===typeof this.L[e]&&(this.L[e]=new String(this.L[e])),this.L[e].T=f.filter));this.aa[e]=g;this.tag.set(g,new Map)}}a.db&& typeof this.H[e]&&(this.H[e]=new String(this.H[e])),this.H[e].T=f.filter))}this.index=c;this.tag=null;if(c=b.tag)if("string"===typeof c&&(c=[c]),c.length){this.tag=new Map;this.L=[];this.aa=[];for(let e=0,f,g;e<c.length;e++){f=c[e];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");f.S?this.L[e]=f.S:(this.L[e]=Oa(g,this.W),f.filter&&("string"===typeof this.L[e]&&(this.L[e]=new String(this.L[e])),this.L[e].T=f.filter));this.aa[e]=g;this.tag.set(g,new Map)}}a.db&&
this.mount(a.db)}u=Y.prototype; this.mount(a.db)}u=X.prototype;
u.mount=function(a){let b=this.field;if(this.tag)for(let e=0,f;e<this.aa.length;e++){f=this.aa[e];var c=this.index.get(f);c||(this.index.set(f,c=new P({},this.A)),b===this.field&&(b=b.slice(0)),b.push(f));c.tag=this.tag.get(f)}c=[];const d={db:a.db,type:a.type,fastupdate:a.fastupdate};for(let e=0,f,g;e<b.length;e++){d.field=g=b[e];f=this.index.get(g);const h=new a.constructor(a.id,d);h.id=a.id;c[e]=h.mount(f);f.document=!0;e?f.ja=!0:f.store=this.store}this.db=this.async=!0;return Promise.all(c)}; u.mount=function(a){let b=this.field;if(this.tag)for(let e=0,f;e<this.aa.length;e++){f=this.aa[e];var c=this.index.get(f);c||(this.index.set(f,c=new O({},this.A)),b===this.field&&(b=b.slice(0)),b.push(f));c.tag=this.tag.get(f)}c=[];const d={db:a.db,type:a.type,fastupdate:a.fastupdate};for(let e=0,f,g;e<b.length;e++){d.field=g=b[e];f=this.index.get(g);const h=new a.constructor(a.id,d);h.id=a.id;c[e]=h.mount(f);f.document=!0;e?f.ja=!0:f.store=this.store}this.db=this.async=!0;return Promise.all(c)};
u.commit=async function(a,b){const c=[];for(const d of this.index.values())c.push(d.db.commit(d,a,b));await Promise.all(c);this.A.clear()};function Pa(a,b){const c=a.split(":");let d=0;for(let e=0;e<c.length;e++)a=c[e],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(b[d]=!0),a&&(c[d++]=a);d<c.length&&(c.length=d);return 1<d?c:c[0]}u.append=function(a,b){return this.add(a,b,!0)};u.update=function(a,b){return this.remove(a).add(a,b)}; u.commit=async function(a,b){const c=[];for(const d of this.index.values())c.push(d.db.commit(d,a,b));await Promise.all(c);this.A.clear()};function Oa(a,b){const c=a.split(":");let d=0;for(let e=0;e<c.length;e++)a=c[e],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(b[d]=!0),a&&(c[d++]=a);d<c.length&&(c.length=d);return 1<d?c:c[0]}u.append=function(a,b){return this.add(a,b,!0)};u.update=function(a,b){return this.remove(a).add(a,b)};
u.remove=function(a){C(a)&&(a=ca(a,this.key));for(var b of this.index.values())b.remove(a,!0);if(this.A.has(a)){if(this.tag&&!this.fastupdate)for(let c of this.tag.values())for(let d of c){b=d[0];const e=d[1],f=e.indexOf(a);-1<f&&(1<e.length?e.splice(f,1):c.delete(b))}this.store&&this.store.delete(a);this.A.delete(a)}this.cache&&this.cache.remove(a);return this}; u.remove=function(a){C(a)&&(a=ca(a,this.key));for(var b of this.index.values())b.remove(a,!0);if(this.A.has(a)){if(this.tag&&!this.fastupdate)for(let c of this.tag.values())for(let d of c){b=d[0];const e=d[1],f=e.indexOf(a);-1<f&&(1<e.length?e.splice(f,1):c.delete(b))}this.store&&this.store.delete(a);this.A.delete(a)}this.cache&&this.cache.remove(a);return this};
u.clear=function(){for(const a of this.index.values())a.clear();if(this.tag)for(const a of this.tag.values())a.clear();this.store&&this.store.clear();return this};u.contain=function(a){return this.db?this.index.get(this.field[0]).db.has(a):this.A.has(a)};u.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};u.get=function(a){return this.db?this.index.get(this.field[0]).db.enrich(a).then(function(b){return b[0]&&b[0].doc}):this.store.get(a)}; u.clear=function(){for(const a of this.index.values())a.clear();if(this.tag)for(const a of this.tag.values())a.clear();this.store&&this.store.clear();return this};u.contain=function(a){return this.db?this.index.get(this.field[0]).db.has(a):this.A.has(a)};u.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};u.get=function(a){return this.db?this.index.get(this.field[0]).db.enrich(a).then(function(b){return b[0]&&b[0].doc}):this.store.get(a)};
u.set=function(a,b){this.store.set(a,b);return this};u.searchCache=ma;u.export=function(a,b,c,d,e,f){let g;"undefined"===typeof f&&(g=new Promise(k=>{f=k}));e||(e=0);d||(d=0);if(d<this.field.length){c=this.field[d];var h=this.index[c];b=this;h.export(a,b,e?c:"",d,e++,f)||(d++,b.export(a,b,c,d,1,f))}else{switch(e){case 1:b="tag";h=this.h;c=null;break;case 2:b="store";h=this.store;c=null;break;default:f();return}qa(a,this,c,b,d,e,h,f)}return g}; u.set=function(a,b){this.store.set(a,b);return this};u.searchCache=ma;u.export=function(a,b,c,d,e,f){let g;"undefined"===typeof f&&(g=new Promise(k=>{f=k}));e||(e=0);d||(d=0);if(d<this.field.length){c=this.field[d];var h=this.index[c];b=this;h.export(a,b,e?c:"",d,e++,f)||(d++,b.export(a,b,c,d,1,f))}else{switch(e){case 1:b="tag";h=this.h;c=null;break;case 2:b="store";h=this.store;c=null;break;default:f();return}qa(a,this,c,b,d,e,h,f)}return g};
u.import=function(a,b){if(b)switch(B(b)&&(b=JSON.parse(b)),a){case "tag":this.h=b;break;case "reg":this.fastupdate=!1;this.A=b;for(let d=0,e;d<this.field.length;d++)e=this.index[this.field[d]],e.A=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)}};ua(Y.prototype);const Qa="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),Ra=["map","ctx","tag","reg","cfg"]; u.import=function(a,b){if(b)switch(B(b)&&(b=JSON.parse(b)),a){case "tag":this.h=b;break;case "reg":this.fastupdate=!1;this.A=b;for(let d=0,e;d<this.field.length;d++)e=this.index[this.field[d]],e.A=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)}};ta(X.prototype);const Pa="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),Qa=["map","ctx","tag","reg","cfg"];
function Sa(a,b={}){if(!(this instanceof Sa))return new Sa(a,b);"object"===typeof a&&(b=a=a.name);a||console.info("Default storage space was used, because a name was not passed.");this.id="flexsearch"+(a?":"+a.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"");this.field=b.field?b.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"";this.la=!1;this.db=null;this.h={}}u=Sa.prototype;u.mount=function(a){if(a instanceof Y)return a.mount(this);a.db=this;return Ta(this)}; function Ra(a,b={}){if(!(this instanceof Ra))return new Ra(a,b);"object"===typeof a&&(b=a=a.name);a||console.info("Default storage space was used, because a name was not passed.");this.id="flexsearch"+(a?":"+a.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"");this.field=b.field?b.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"";this.la=!1;this.db=null;this.h={}}u=Ra.prototype;u.mount=function(a){if(a instanceof X)return a.mount(this);a.db=this;return Sa(this)};
function Ta(a){navigator.storage&&navigator.storage.persist();return a.db||new Promise(function(b,c){const d=Qa.open(a.id+(a.field?":"+a.field:""),1);d.onupgradeneeded=function(){const e=a.db=this.result;Ra.forEach(f=>{e.objectStoreNames.contains(f)||e.createObjectStore(f)})};d.onblocked=function(e){console.error("blocked",e);c()};d.onerror=function(e){console.error(this.error,e);c()};d.onsuccess=function(){a.db=this.result;a.db.onversionchange=function(){a.close()};b(a)}})} function Sa(a){navigator.storage&&navigator.storage.persist();return a.db||new Promise(function(b,c){const d=Pa.open(a.id+(a.field?":"+a.field:""),1);d.onupgradeneeded=function(){const e=a.db=this.result;Qa.forEach(f=>{e.objectStoreNames.contains(f)||e.createObjectStore(f)})};d.onblocked=function(e){console.error("blocked",e);c()};d.onerror=function(e){console.error(this.error,e);c()};d.onsuccess=function(){a.db=this.result;a.db.onversionchange=function(){a.close()};b(a)}})}
u.close=function(){this.db.close();this.db=null};u.clear=function(){const a=this.db.transaction(Ra,"readwrite");for(let b=0;b<Ra.length;b++)a.objectStore(Ra[b]).clear();return Z(a)}; u.close=function(){this.db.close();this.db=null};u.clear=function(){const a=this.db.transaction(Qa,"readwrite");for(let b=0;b<Qa.length;b++)a.objectStore(Qa[b]).clear();return Y(a)};
u.get=function(a,b,c=0,d=0,e=!0,f=!1){a=this.db.transaction(b?"ctx":"map","readonly").objectStore(b?"ctx":"map").get(b?b+":"+a:a);const g=this;return Z(a).then(function(h){let k=[];if(!h||!h.length)return k;if(e){if(!c&&!d&&1===h.length)return h[0];for(let l=0,m;l<h.length;l++)if((m=h[l])&&m.length){if(d>=m.length){d-=m.length;continue}const n=c?d+Math.min(m.length-d,c):m.length;for(let q=d;q<n;q++)k.push(m[q]);d=0;if(k.length===c)break}return f?g.enrich(k):k}return h})}; u.get=function(a,b,c=0,d=0,e=!0,f=!1){a=this.db.transaction(b?"ctx":"map","readonly").objectStore(b?"ctx":"map").get(b?b+":"+a:a);const g=this;return Y(a).then(function(h){let k=[];if(!h||!h.length)return k;if(e){if(!c&&!d&&1===h.length)return h[0];for(let l=0,m;l<h.length;l++)if((m=h[l])&&m.length){if(d>=m.length){d-=m.length;continue}const n=c?d+Math.min(m.length-d,c):m.length;for(let q=d;q<n;q++)k.push(m[q]);d=0;if(k.length===c)break}return f?g.enrich(k):k}return h})};
u.tag=function(a,b=0,c=0,d=!1){a=this.db.transaction("tag","readonly").objectStore("tag").get(a);const e=this;return Z(a).then(function(f){if(!f||!f.length||c>=f.length)return[];if(!b&&!c)return f;f=f.slice(c,c+b);return d?e.enrich(f):f})}; u.tag=function(a,b=0,c=0,d=!1){a=this.db.transaction("tag","readonly").objectStore("tag").get(a);const e=this;return Y(a).then(function(f){if(!f||!f.length||c>=f.length)return[];if(!b&&!c)return f;f=f.slice(c,c+b);return d?e.enrich(f):f})};
u.enrich=function(a){"object"!==typeof a&&(a=[a]);const b=this.db.transaction("reg","readonly").objectStore("reg"),c=[];for(let d=0;d<a.length;d++)c[d]=Z(b.get(a[d]));return Promise.all(c).then(function(d){for(let e=0;e<d.length;e++)d[e]={id:a[e],doc:d[e]?JSON.parse(d[e]):null};return d})};u.has=function(a){a=this.db.transaction("reg","readonly").objectStore("reg").getKey(a);return Z(a)};u.search=null;u.info=function(){}; u.enrich=function(a){"object"!==typeof a&&(a=[a]);const b=this.db.transaction("reg","readonly").objectStore("reg"),c=[];for(let d=0;d<a.length;d++)c[d]=Y(b.get(a[d]));return Promise.all(c).then(function(d){for(let e=0;e<d.length;e++)d[e]={id:a[e],doc:d[e]?JSON.parse(d[e]):null};return d})};u.has=function(a){a=this.db.transaction("reg","readonly").objectStore("reg").getKey(a);return Y(a)};u.search=null;u.info=function(){};
u.transaction=function(a,b,c){let d=this.h[a+":"+b];if(d)return c.call(this,d);let e=this.db.transaction(a,b);this.h[a+":"+b]=d=e.objectStore(a);return new Promise((f,g)=>{e.onerror=h=>{this.h[a+":"+b]=null;e.abort();e=d=null;g(h)};e.oncomplete=h=>{e=d=this.h[a+":"+b]=null;f(h||!0)};return c.call(this,d)})}; u.transaction=function(a,b,c){let d=this.h[a+":"+b];if(d)return c.call(this,d);let e=this.db.transaction(a,b);this.h[a+":"+b]=d=e.objectStore(a);return new Promise((f,g)=>{e.onerror=h=>{this.h[a+":"+b]=null;e.abort();e=d=null;g(h)};e.oncomplete=h=>{e=d=this.h[a+":"+b]=null;f(h||!0)};return c.call(this,d)})};
u.commit=async function(a,b,c){if(b)await this.clear(),a.R=[];else{let d=a.R;a.R=[];for(let e=0,f;e<d.length;e++)if(f=d[e],f.clear){await this.clear();b=!0;break}else d[e]=f.ma;b||(c||(d=d.concat(ba(a.A))),d.length&&await this.remove(d))}a.A.size&&(await this.transaction("map","readwrite",function(d){for(const e of a.map){const f=e[0],g=e[1];g.length&&(b?d.put(g,f):d.get(f).onsuccess=function(){let h=this.result;var k;if(h&&h.length){const l=Math.max(h.length,g.length);for(let m=0,n,q;m<l;m++)if((q= u.commit=async function(a,b,c){if(b)await this.clear(),a.R=[];else{let d=a.R;a.R=[];for(let e=0,f;e<d.length;e++)if(f=d[e],f.clear){await this.clear();b=!0;break}else d[e]=f.ma;b||(c||(d=d.concat(ba(a.A))),d.length&&await this.remove(d))}a.A.size&&(await this.transaction("map","readwrite",function(d){for(const e of a.map){const f=e[0],g=e[1];g.length&&(b?d.put(g,f):d.get(f).onsuccess=function(){let h=this.result;var k;if(h&&h.length){const l=Math.max(h.length,g.length);for(let m=0,n,q;m<l;m++)if((q=
g[m])&&q.length){if((n=h[m])&&n.length)for(k=0;k<q.length;k++)n.push(q[k]);else h[m]=q;k=1}}else h=g,k=1;k&&d.put(h,f)})}}),await this.transaction("ctx","readwrite",function(d){for(const e of a.I){const f=e[0],g=e[1];for(const h of g){const k=h[0],l=h[1];l.length&&(b?d.put(l,f+":"+k):d.get(f+":"+k).onsuccess=function(){let m=this.result;var n;if(m&&m.length){const q=Math.max(m.length,l.length);for(let t=0,p,r;t<q;t++)if((r=l[t])&&r.length){if((p=m[t])&&p.length)for(n=0;n<r.length;n++)p.push(r[n]); g[m])&&q.length){if((n=h[m])&&n.length)for(k=0;k<q.length;k++)n.push(q[k]);else h[m]=q;k=1}}else h=g,k=1;k&&d.put(h,f)})}}),await this.transaction("ctx","readwrite",function(d){for(const e of a.I){const f=e[0],g=e[1];for(const h of g){const k=h[0],l=h[1];l.length&&(b?d.put(l,f+":"+k):d.get(f+":"+k).onsuccess=function(){let m=this.result;var n;if(m&&m.length){const q=Math.max(m.length,l.length);for(let t=0,p,r;t<q;t++)if((r=l[t])&&r.length){if((p=m[t])&&p.length)for(n=0;n<r.length;n++)p.push(r[n]);
else m[t]=r;n=1}}else m=l,n=1;n&&d.put(m,f+":"+k)})}}}),a.store?await this.transaction("reg","readwrite",function(d){for(const e of a.store){const f=e[0],g=e[1];d.put("object"===typeof g?JSON.stringify(g):1,f)}}):a.ja||await this.transaction("reg","readwrite",function(d){for(const e of a.A.keys())d.put(1,e)}),a.tag&&await this.transaction("tag","readwrite",function(d){for(const e of a.tag){const f=e[0],g=e[1];g.length&&(d.get(f).onsuccess=function(){let h=this.result;h=h&&h.length?h.concat(g):g;d.put(h, else m[t]=r;n=1}}else m=l,n=1;n&&d.put(m,f+":"+k)})}}}),a.store?await this.transaction("reg","readwrite",function(d){for(const e of a.store){const f=e[0],g=e[1];d.put("object"===typeof g?JSON.stringify(g):1,f)}}):a.ja||await this.transaction("reg","readwrite",function(d){for(const e of a.A.keys())d.put(1,e)}),a.tag&&await this.transaction("tag","readwrite",function(d){for(const e of a.tag){const f=e[0],g=e[1];g.length&&(d.get(f).onsuccess=function(){let h=this.result;h=h&&h.length?h.concat(g):g;d.put(h,
f)})}}),a.map.clear(),a.I.clear(),a.tag&&a.tag.clear(),a.store&&a.store.clear(),a.document||a.A.clear())};function Ua(a,b,c){const d=a.value;let e,f,g=0;for(let h=0,k;h<d.length;h++){if(k=c?d:d[h]){for(let l=0,m,n;l<b.length;l++)if(n=b[l],m=k.indexOf(f?parseInt(n,10):n),0>m&&!f&&"string"===typeof n&&!isNaN(n)&&(m=k.indexOf(parseInt(n,10)))&&(f=1),0<=m)if(e=1,1<k.length)k.splice(m,1);else{d[h]=[];break}g+=k.length}if(c)break}g?e&&a.update(d):a.delete();a.continue()} f)})}}),a.map.clear(),a.I.clear(),a.tag&&a.tag.clear(),a.store&&a.store.clear(),a.document||a.A.clear())};function Ta(a,b,c){const d=a.value;let e,f,g=0;for(let h=0,k;h<d.length;h++){if(k=c?d:d[h]){for(let l=0,m,n;l<b.length;l++)if(n=b[l],m=k.indexOf(f?parseInt(n,10):n),0>m&&!f&&"string"===typeof n&&!isNaN(n)&&(m=k.indexOf(parseInt(n,10)))&&(f=1),0<=m)if(e=1,1<k.length)k.splice(m,1);else{d[h]=[];break}g+=k.length}if(c)break}g?e&&a.update(d):a.delete();a.continue()}
u.remove=function(a){"object"!==typeof a&&(a=[a]);return Promise.all([this.transaction("map","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&Ua(c,a)}}),this.transaction("ctx","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&Ua(c,a)}}),this.transaction("tag","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&Ua(c,a,!0)}}),this.transaction("reg","readwrite",function(b){for(let c=0;c<a.length;c++)b.delete(a[c])})])}; u.remove=function(a){"object"!==typeof a&&(a=[a]);return Promise.all([this.transaction("map","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&Ta(c,a)}}),this.transaction("ctx","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&Ta(c,a)}}),this.transaction("tag","readwrite",function(b){b.openCursor().onsuccess=function(){const c=this.result;c&&Ta(c,a,!0)}}),this.transaction("reg","readwrite",function(b){for(let c=0;c<a.length;c++)b.delete(a[c])})])};
function Z(a){return new Promise((b,c)=>{a.onsuccess=function(){b(this.result)};a.oncomplete=function(){b(this.result)};a.onerror=c;a=null})};const Va=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 Wa={normalize:!0,C:!0,D:Va};const Ya=new Map([["ai","ei"],["ae","a"],["oe","o"],["ue","u"],["sh","s"],["ch","c"],["th","t"],["ph","f"],["pf","f"]]),Za=[/([^aeo])h([aeo$])/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2"];var $a={normalize:!0,C:!0,D:Va,K:Za,J:Ya};var ab={normalize:!0,C:!0,D:Va,K:Za.concat([/(?!^)[aeoy]/g,""]),J:Ya};const bb={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};M["latin:exact"]={normalize:!1,C:!1};M["latin:default"]=sa;M["latin:simple"]={normalize:!0,C:!0};M["latin:balance"]=Wa;M["latin:advanced"]=$a;M["latin:extra"]=ab;M["latin:soundex"]={normalize:!0,C:!1,ga:{ka:!0},V:function(a){for(let c=0;c<a.length;c++){var b=a[c];let d=b.charAt(0),e=bb[d];for(let f=1,g;f<b.length&&(g=b.charAt(f),"h"===g||"w"===g||!(g=bb[g])||g===e||(d+=g,e=g,4!==d.length));f++);a[c]=d}}};export default {Index:P,Encoder:E,Charset:M,Language:ra,Document:Y,Worker:W,Resolver:T,IndexedDB:Sa}; function Y(a){return new Promise((b,c)=>{a.onsuccess=function(){b(this.result)};a.oncomplete=function(){b(this.result)};a.onerror=c;a=null})};const Z=z();const Ua=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 Va={normalize:!0,C:!0,G:Ua};const Xa=new Map([["ai","ei"],["ae","a"],["oe","o"],["ue","u"],["sh","s"],["ch","c"],["th","t"],["ph","f"],["pf","f"]]),Ya=[/([^aeo])h([aeo$])/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2"];var Za={normalize:!0,C:!0,G:Ua,K:Ya,J:Xa};var $a={normalize:!0,C:!0,G:Ua,K:Ya.concat([/(?!^)[aeoy]/g,""]),J:Xa};const ab={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};Z["latin:exact"]={normalize:!1,C:!1};Z["latin:default"]=ra;Z["latin:simple"]={normalize:!0,C:!0};Z["latin:balance"]=Va;Z["latin:advanced"]=Za;Z["latin:extra"]=$a;Z["latin:soundex"]={normalize:!0,C:!1,ga:{ka:!0},V:function(a){for(let c=0;c<a.length;c++){var b=a[c];let d=b.charAt(0),e=ab[d];for(let f=1,g;f<b.length&&(g=b.charAt(f),"h"===g||"w"===g||!(g=ab[g])||g===e||(d+=g,e=g,4!==d.length));f++);a[c]=d}}};export default {Index:O,Charset:Z,Encoder:E,Document:X,Worker:V,Resolver:S,IndexedDB:Ra};
export const Index=P;export const Encoder=E;export const Charset=M;export const Language=ra;export const Document=Y;export const Worker=W;export const Resolver=T;export const IndexedDB=Sa; export const Index=O;export const Charset=Z;export const Encoder=E;export const Document=X;export const Worker=V;export const Resolver=S;export const IndexedDB=Ra;

File diff suppressed because it is too large Load Diff

View File

@@ -5,49 +5,46 @@
* Hosted by Nextapps GmbH * Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch * https://github.com/nextapps-de/flexsearch
*/ */
(function(self){'use strict';var u;function x(a,b,c){const e=typeof c,d=typeof a;if("undefined"!==e){if("undefined"!==d){if(c){if("function"===d&&e===d)return function(h){return a(c(h))};b=a.constructor;if(b===c.constructor){if(b===Array)return c.concat(a);if(b===Map){var f=new Map(c);for(var g of a)f.set(g[0],g[1]);return f}if(b===Set){g=new Set(c);for(f of a.values())g.add(f);return g}}}return a}return c}return"undefined"===d?b:a}function y(){return Object.create(null)}function aa(a,b){return b.length-a.length} (function(self){'use strict';var v;function x(a,c,b){const e=typeof b,d=typeof a;if("undefined"!==e){if("undefined"!==d){if(b){if("function"===d&&e===d)return function(h){return a(b(h))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var f=new Map(b);for(var g of a)f.set(g[0],g[1]);return f}if(c===Set){g=new Set(b);for(f of a.values())g.add(f);return g}}}return a}return b}return"undefined"===d?c:a}function y(){return Object.create(null)}function aa(a,c){return c.length-a.length}
function z(a){return"string"===typeof a}function B(a){return"object"===typeof a}function F(a,b){if(z(b))a=a[b];else for(let c=0;a&&c<b.length;c++)a=a[b[c]];return a};const ba=/[^\p{L}\p{N}]+/u,ca=/(\d{3})/g,da=/(\D)(\d{3})/g,ea=/(\d{3})(\D)/g,G="".normalize&&/[\u0300-\u036f]/g,fa=!G&&new Map([["\u00aa","a"],["\u00b2","2"],["\u00b3","3"],["\u00b9","1"],["\u00ba","o"],["\u00bc","1\u20444"],["\u00bd","1\u20442"],["\u00be","3\u20444"],["\u00e0","a"],["\u00e1","a"],["\u00e2","a"],["\u00e3","a"],["\u00e4","a"],["\u00e5","a"],["\u00e7","c"],["\u00e8","e"],["\u00e9","e"],["\u00ea","e"],["\u00eb","e"],["\u00ec","i"],["\u00ed","i"],["\u00ee","i"],["\u00ef","i"],["\u00f1", function z(a){return"string"===typeof a}function E(a){return"object"===typeof a}function F(a,c){if(z(c))a=a[c];else for(let b=0;a&&b<c.length;b++)a=a[c[b]];return a};const ba=/[^\p{L}\p{N}]+/u,ca=/(\d{3})/g,da=/(\D)(\d{3})/g,ea=/(\d{3})(\D)/g,G="".normalize&&/[\u0300-\u036f]/g,fa=!G&&[["\u00aa","a"],["\u00b2","2"],["\u00b3","3"],["\u00b9","1"],["\u00ba","o"],["\u00bc","1\u20444"],["\u00bd","1\u20442"],["\u00be","3\u20444"],["\u00e0","a"],["\u00e1","a"],["\u00e2","a"],["\u00e3","a"],["\u00e4","a"],["\u00e5","a"],["\u00e7","c"],["\u00e8","e"],["\u00e9","e"],["\u00ea","e"],["\u00eb","e"],["\u00ec","i"],["\u00ed","i"],["\u00ee","i"],["\u00ef","i"],["\u00f1","n"],
"n"],["\u00f2","o"],["\u00f3","o"],["\u00f4","o"],["\u00f5","o"],["\u00f6","o"],["\u00f9","u"],["\u00fa","u"],["\u00fb","u"],["\u00fc","u"],["\u00fd","y"],["\u00ff","y"],["\u0101","a"],["\u0103","a"],["\u0105","a"],["\u0107","c"],["\u0109","c"],["\u010b","c"],["\u010d","c"],["\u010f","d"],["\u0113","e"],["\u0115","e"],["\u0117","e"],["\u0119","e"],["\u011b","e"],["\u011d","g"],["\u011f","g"],["\u0121","g"],["\u0123","g"],["\u0125","h"],["\u0129","i"],["\u012b","i"],["\u012d","i"],["\u012f","i"],["\u0133", ["\u00f2","o"],["\u00f3","o"],["\u00f4","o"],["\u00f5","o"],["\u00f6","o"],["\u00f9","u"],["\u00fa","u"],["\u00fb","u"],["\u00fc","u"],["\u00fd","y"],["\u00ff","y"],["\u0101","a"],["\u0103","a"],["\u0105","a"],["\u0107","c"],["\u0109","c"],["\u010b","c"],["\u010d","c"],["\u010f","d"],["\u0113","e"],["\u0115","e"],["\u0117","e"],["\u0119","e"],["\u011b","e"],["\u011d","g"],["\u011f","g"],["\u0121","g"],["\u0123","g"],["\u0125","h"],["\u0129","i"],["\u012b","i"],["\u012d","i"],["\u012f","i"],["\u0133",
"ij"],["\u0135","j"],["\u0137","k"],["\u013a","l"],["\u013c","l"],["\u013e","l"],["\u0140","l"],["\u0144","n"],["\u0146","n"],["\u0148","n"],["\u0149","n"],["\u014d","o"],["\u014f","o"],["\u0151","o"],["\u0155","r"],["\u0157","r"],["\u0159","r"],["\u015b","s"],["\u015d","s"],["\u015f","s"],["\u0161","s"],["\u0163","t"],["\u0165","t"],["\u0169","u"],["\u016b","u"],["\u016d","u"],["\u016f","u"],["\u0171","u"],["\u0173","u"],["\u0175","w"],["\u0177","y"],["\u017a","z"],["\u017c","z"],["\u017e","z"], "ij"],["\u0135","j"],["\u0137","k"],["\u013a","l"],["\u013c","l"],["\u013e","l"],["\u0140","l"],["\u0144","n"],["\u0146","n"],["\u0148","n"],["\u0149","n"],["\u014d","o"],["\u014f","o"],["\u0151","o"],["\u0155","r"],["\u0157","r"],["\u0159","r"],["\u015b","s"],["\u015d","s"],["\u015f","s"],["\u0161","s"],["\u0163","t"],["\u0165","t"],["\u0169","u"],["\u016b","u"],["\u016d","u"],["\u016f","u"],["\u0171","u"],["\u0173","u"],["\u0175","w"],["\u0177","y"],["\u017a","z"],["\u017c","z"],["\u017e","z"],
["\u017f","s"],["\u01a1","o"],["\u01b0","u"],["\u01c6","dz"],["\u01c9","lj"],["\u01cc","nj"],["\u01ce","a"],["\u01d0","i"],["\u01d2","o"],["\u01d4","u"],["\u01d6","u"],["\u01d8","u"],["\u01da","u"],["\u01dc","u"],["\u01df","a"],["\u01e1","a"],["\u01e3","ae"],["\u00e6","ae"],["\u01fd","ae"],["\u01e7","g"],["\u01e9","k"],["\u01eb","o"],["\u01ed","o"],["\u01ef","\u0292"],["\u01f0","j"],["\u01f3","dz"],["\u01f5","g"],["\u01f9","n"],["\u01fb","a"],["\u01ff","\u00f8"],["\u0201","a"],["\u0203","a"],["\u0205", ["\u017f","s"],["\u01a1","o"],["\u01b0","u"],["\u01c6","dz"],["\u01c9","lj"],["\u01cc","nj"],["\u01ce","a"],["\u01d0","i"],["\u01d2","o"],["\u01d4","u"],["\u01d6","u"],["\u01d8","u"],["\u01da","u"],["\u01dc","u"],["\u01df","a"],["\u01e1","a"],["\u01e3","ae"],["\u00e6","ae"],["\u01fd","ae"],["\u01e7","g"],["\u01e9","k"],["\u01eb","o"],["\u01ed","o"],["\u01ef","\u0292"],["\u01f0","j"],["\u01f3","dz"],["\u01f5","g"],["\u01f9","n"],["\u01fb","a"],["\u01ff","\u00f8"],["\u0201","a"],["\u0203","a"],["\u0205",
"e"],["\u0207","e"],["\u0209","i"],["\u020b","i"],["\u020d","o"],["\u020f","o"],["\u0211","r"],["\u0213","r"],["\u0215","u"],["\u0217","u"],["\u0219","s"],["\u021b","t"],["\u021f","h"],["\u0227","a"],["\u0229","e"],["\u022b","o"],["\u022d","o"],["\u022f","o"],["\u0231","o"],["\u0233","y"],["\u02b0","h"],["\u02b1","h"],["\u0266","h"],["\u02b2","j"],["\u02b3","r"],["\u02b4","\u0279"],["\u02b5","\u027b"],["\u02b6","\u0281"],["\u02b7","w"],["\u02b8","y"],["\u02e0","\u0263"],["\u02e1","l"],["\u02e2","s"], "e"],["\u0207","e"],["\u0209","i"],["\u020b","i"],["\u020d","o"],["\u020f","o"],["\u0211","r"],["\u0213","r"],["\u0215","u"],["\u0217","u"],["\u0219","s"],["\u021b","t"],["\u021f","h"],["\u0227","a"],["\u0229","e"],["\u022b","o"],["\u022d","o"],["\u022f","o"],["\u0231","o"],["\u0233","y"],["\u02b0","h"],["\u02b1","h"],["\u0266","h"],["\u02b2","j"],["\u02b3","r"],["\u02b4","\u0279"],["\u02b5","\u027b"],["\u02b6","\u0281"],["\u02b7","w"],["\u02b8","y"],["\u02e0","\u0263"],["\u02e1","l"],["\u02e2","s"],
["\u02e3","x"],["\u02e4","\u0295"],["\u0390","\u03b9"],["\u03ac","\u03b1"],["\u03ad","\u03b5"],["\u03ae","\u03b7"],["\u03af","\u03b9"],["\u03b0","\u03c5"],["\u03ca","\u03b9"],["\u03cb","\u03c5"],["\u03cc","\u03bf"],["\u03cd","\u03c5"],["\u03ce","\u03c9"],["\u03d0","\u03b2"],["\u03d1","\u03b8"],["\u03d2","\u03a5"],["\u03d3","\u03a5"],["\u03d4","\u03a5"],["\u03d5","\u03c6"],["\u03d6","\u03c0"],["\u03f0","\u03ba"],["\u03f1","\u03c1"],["\u03f2","\u03c2"],["\u03f5","\u03b5"],["\u0439","\u0438"],["\u0450", ["\u02e3","x"],["\u02e4","\u0295"],["\u0390","\u03b9"],["\u03ac","\u03b1"],["\u03ad","\u03b5"],["\u03ae","\u03b7"],["\u03af","\u03b9"],["\u03b0","\u03c5"],["\u03ca","\u03b9"],["\u03cb","\u03c5"],["\u03cc","\u03bf"],["\u03cd","\u03c5"],["\u03ce","\u03c9"],["\u03d0","\u03b2"],["\u03d1","\u03b8"],["\u03d2","\u03a5"],["\u03d3","\u03a5"],["\u03d4","\u03a5"],["\u03d5","\u03c6"],["\u03d6","\u03c0"],["\u03f0","\u03ba"],["\u03f1","\u03c1"],["\u03f2","\u03c2"],["\u03f5","\u03b5"],["\u0439","\u0438"],["\u0450",
"\u0435"],["\u0451","\u0435"],["\u0453","\u0433"],["\u0457","\u0456"],["\u045c","\u043a"],["\u045d","\u0438"],["\u045e","\u0443"],["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]]); "\u0435"],["\u0451","\u0435"],["\u0453","\u0433"],["\u0457","\u0456"],["\u045c","\u043a"],["\u045d","\u0438"],["\u045e","\u0443"],["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]];
function H(a={}){if(!(this instanceof H))return new H(...arguments);for(a=0;a<arguments.length;a++)this.assign(arguments[a])} function H(a={}){if(!(this instanceof H))return new H(...arguments);for(a=0;a<arguments.length;a++)this.assign(arguments[a])}
H.prototype.assign=function(a){this.normalize=x(a.normalize,!0,this.normalize);let b=a.aa,c=b||a.ga||a.split;if("object"===typeof c){let e=!b,d="";a.aa||(d+="\\p{Z}");c.fa&&(d+="\\p{L}");c.ha&&(d+="\\p{N}",e=!!b);c.ja&&(d+="\\p{S}");c.ia&&(d+="\\p{P}");c.control&&(d+="\\p{C}");if(c=c.char)d+="object"===typeof c?c.join(""):c;this.split=new RegExp("["+(b?"^":"")+d+"]+","u");this.numeric=e}else this.split=x(c,ba,this.split),this.numeric=x(this.numeric,!0);this.X=x(a.X,null,this.X);this.S=x(a.S,null, H.prototype.assign=function(a){this.normalize=x(a.normalize,!0,this.normalize);let c=a.aa,b=c||a.ga||a.split;if("object"===typeof b){let e=!c,d="";a.aa||(d+="\\p{Z}");b.fa&&(d+="\\p{L}");b.ha&&(d+="\\p{N}",e=!!c);b.ja&&(d+="\\p{S}");b.ia&&(d+="\\p{P}");b.control&&(d+="\\p{C}");if(b=b.char)d+="object"===typeof b?b.join(""):b;this.split=new RegExp("["+(c?"^":"")+d+"]+","u");this.numeric=e}else this.split=x(b,ba,this.split),this.numeric=x(this.numeric,!0);this.X=x(a.X,null,this.X);this.R=x(a.R,null,
this.S);this.rtl=a.rtl||!1;this.C=x(a.C,!0,this.C);this.filter=x((c=a.filter)&&new Set(c),null,this.filter);this.H=x((c=a.H)&&new Map(c),null,this.H);this.D=x((c=a.D)&&new Map(c),null,this.D);this.L=x((c=a.L)&&new Map(c),null,this.L);this.I=x(a.I,null,this.I);this.W=x(a.W,1,this.W);this.ba=x(a.ba,0,this.ba);if(this.cache=c=x(a.cache,!0,this.cache))this.U=null,this.$="number"===typeof c?c:2E5,this.N=new Map,this.R=new Map,this.B=this.h=128;this.F="";this.Y=null;this.V="";this.Z=null;if(this.H)for(const e of this.H.keys())this.F+= this.R);fa&&(this.C=new Map(fa));this.rtl=a.rtl||!1;this.A=x(a.A,!0,this.A);this.filter=x((b=a.filter)&&new Set(b),null,this.filter);this.F=x((b=a.F)&&new Map(b),null,this.F);this.C=x((b=a.C)&&new Map(b),null,this.C);this.J=x((b=a.J)&&new Map(b),null,this.J);this.G=x(a.G,null,this.G);this.W=x(a.W,1,this.W);this.ba=x(a.ba,0,this.ba);if(this.cache=b=x(a.cache,!0,this.cache))this.T=null,this.$="number"===typeof b?b:2E5,this.M=new Map,this.P=new Map,this.L=this.B=128;this.U="";this.Y=null;this.V="";this.Z=
(this.F?"|":"")+e;if(this.L)for(const e of this.L.keys())this.V+=(this.V?"|":"")+e;return this}; null;if(this.F)for(const e of this.F.keys())this.U+=(this.U?"|":"")+e;if(this.J)for(const e of this.J.keys())this.V+=(this.V?"|":"")+e;return this};
H.prototype.encode=function(a){if(this.cache&&a.length<=this.h)if(this.U){if(this.N.has(a))return this.N.get(a)}else this.U=setTimeout(ha,0,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):G?a=a.normalize("NFKD").replace(G,"").toLowerCase():(a=a.toLowerCase(),this.D=this.D?new Map([...fa,...this.D]):new Map(fa)));this.X&&(a=this.X(a));this.numeric&&3<a.length&&(a=a.replace(da,"$1 $2").replace(ea,"$1 $2").replace(ca,"$1 "));const b=!(this.C||this.D||this.filter||this.H|| H.prototype.encode=function(a){if(this.cache&&a.length<=this.B)if(this.T){if(this.M.has(a))return this.M.get(a)}else this.T=setTimeout(ha,0,this);this.normalize&&(a="function"===typeof this.normalize?this.normalize(a):G?a.normalize("NFKD").replace(G,"").toLowerCase():a.toLowerCase());this.X&&(a=this.X(a));this.numeric&&3<a.length&&(a=a.replace(da,"$1 $2").replace(ea,"$1 $2").replace(ca,"$1 "));const c=!(this.A||this.C||this.filter||this.F||this.J||this.G);let b=[],e=this.split||""===this.split?a.split(this.split):
this.L||this.I);let c=[],e=this.split||""===this.split?a.split(this.split):a;for(let f=0,g,h;f<e.length;f++){if(!(g=h=e[f]))continue;if(g.length<this.W)continue;if(b){c.push(g);continue}if(this.filter&&this.filter.has(g))continue;if(this.cache&&g.length<=this.B)if(this.U){var d=this.R.get(g);if(d||""===d){d&&c.push(d);continue}}else this.U=setTimeout(ha,0,this);let k;this.L&&2<g.length&&(this.Z||(this.Z=new RegExp("(?!^)("+this.V+")$")),g=g.replace(this.Z,m=>this.L.get(m)),k=1);this.H&&1<g.length&& a;for(let f=0,g,h;f<e.length;f++){if(!(g=h=e[f]))continue;if(g.length<this.W)continue;if(c){b.push(g);continue}if(this.filter&&this.filter.has(g))continue;if(this.cache&&g.length<=this.L)if(this.T){var d=this.P.get(g);if(d||""===d){d&&b.push(d);continue}}else this.T=setTimeout(ha,0,this);let k;this.J&&2<g.length&&(this.Z||(this.Z=new RegExp("(?!^)("+this.V+")$")),g=g.replace(this.Z,m=>this.J.get(m)),k=1);this.F&&1<g.length&&(this.Y||(this.Y=new RegExp("("+this.U+")","g")),g=g.replace(this.Y,m=>this.F.get(m)),
(this.Y||(this.Y=new RegExp("("+this.F+")","g")),g=g.replace(this.Y,m=>this.H.get(m)),k=1);g&&k&&(g.length<this.W||this.filter&&this.filter.has(g))&&(g="");if(g&&(this.D||this.C&&1<g.length)){d="";for(let m=0,l="",r,t;m<g.length;m++)r=g.charAt(m),r===l&&this.C||((t=this.D&&this.D.get(r))||""===t?t===l&&this.C||!(l=t)||(d+=t):d+=l=r);g=d}if(g&&this.I)for(d=0;g&&d<this.I.length;d+=2)g=g.replace(this.I[d],this.I[d+1]);this.cache&&h.length<=this.B&&(this.R.set(h,g),this.R.size>this.$&&(this.R.clear(), k=1);g&&k&&(g.length<this.W||this.filter&&this.filter.has(g))&&(g="");if(g&&(this.C||this.A&&1<g.length)){d="";for(let m=0,l="",r,t;m<g.length;m++)r=g.charAt(m),r===l&&this.A||((t=this.C&&this.C.get(r))||""===t?t===l&&this.A||!(l=t)||(d+=t):d+=l=r);g=d}if(g&&this.G)for(d=0;g&&d<this.G.length;d+=2)g=g.replace(this.G[d],this.G[d+1]);this.cache&&h.length<=this.L&&(this.P.set(h,g),this.P.size>this.$&&(this.P.clear(),this.L=this.L/1.1|0));g&&b.push(g)}this.R&&(b=this.R(b)||b);this.cache&&a.length<=this.B&&
this.B=this.B/1.1|0));g&&c.push(g)}this.S&&(c=this.S(c)||c);this.cache&&a.length<=this.h&&(this.N.set(a,c),this.N.size>this.$&&(this.N.clear(),this.h=this.h/1.1|0));return c};function ha(a){a.U=null;a.N.clear();a.R.clear()};function ia(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();let e=this.cache.get(a);if(!e){e=this.search(a,b,c);if(e instanceof Promise){const d=this;e.then(function(f){d.cache.set(a,f)})}this.cache.set(a,e)}return e}function I(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}I.prototype.set=function(a,b){this.cache.has(a)||(this.cache.set(this.h=a,b),this.limit&&this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value))}; (this.M.set(a,b),this.M.size>this.$&&(this.M.clear(),this.B=this.B/1.1|0));return b};function ha(a){a.T=null;a.M.clear();a.P.clear()};function ia(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();let e=this.cache.get(a);if(!e){e=this.search(a,c,b);if(e instanceof Promise){const d=this;e.then(function(f){d.cache.set(a,f)})}this.cache.set(a,e)}return e}function J(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.B=""}J.prototype.set=function(a,c){this.cache.has(a)||(this.cache.set(this.B=a,c),this.limit&&this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value))};
I.prototype.get=function(a){const b=this.cache.get(a);b&&this.limit&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,b));return b};I.prototype.remove=function(a){for(const b of this.cache){const c=b[0];b[1].includes(a)&&this.cache.delete(c)}};I.prototype.clear=function(){this.cache.clear();this.h=""};function J(a=8){if(!(this instanceof J))return new J(a);this.index=y();this.F=[];this.size=0;32<a?(this.h=ja,this.B=BigInt(a)):(this.h=ka,this.B=a)}J.prototype.get=function(a){const b=this.index[this.h(a)];return b&&b.get(a)};J.prototype.set=function(a,b){var c=this.h(a);let e=this.index[c];e?(c=e.size,e.set(a,b),(c-=e.size)&&this.size++):(this.index[c]=e=new Map([[a,b]]),this.F.push(e))}; J.prototype.get=function(a){const c=this.cache.get(a);c&&this.limit&&this.B!==a&&(this.cache.delete(a),this.cache.set(this.B=a,c));return c};J.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};J.prototype.clear=function(){this.cache.clear();this.B=""};function ja(a,c,b,e,d,f,g,h){(e=a(b?b+"."+e:e,JSON.stringify(g)))&&e.then?e.then(function(){c.export(a,c,b,d,f+1,h)}):c.export(a,c,b,d,f+1,h)};var ka={normalize:function(a){return a.toLowerCase()},A:!1};const la={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};function ma(a){K.call(a,"add");K.call(a,"append");K.call(a,"search");K.call(a,"update");K.call(a,"remove")}function K(a){this[a+"Async"]=function(){var c=arguments;const b=c[c.length-1];let e;"function"===typeof b&&(e=b,delete c[c.length-1]);this.async=!0;c=this[a].apply(this,c);this.async=!1;c.then?c.then(e):e(c);return c}};y();L.prototype.add=function(a,c,b,e){if(c&&(a||0===a)){if(!e&&!b&&this.h.has(a))return this.update(a,c);c=this.encoder.encode(c);if(e=c.length){const m=y(),l=y(),r=this.depth,t=this.resolution;for(let p=0;p<e;p++){let n=c[this.rtl?e-1-p:p];var d=n.length;if(d&&(r||!l[n])){var f=this.score?this.score(c,n,p,null,0):M(t,e,p),g="";switch(this.tokenize){case "full":if(2<d){for(f=0;f<d;f++)for(var h=d;h>f;h--){g=n.substring(f,h);var k=this.score?this.score(c,n,p,g,f):M(t,e,p,d,f);N(this,l,g,k,a,b)}break}case "reverse":if(1<
function L(a=8){if(!(this instanceof L))return new L(a);this.index=y();this.h=[];32<a?(this.F=ja,this.B=BigInt(a)):(this.F=ka,this.B=a)}L.prototype.add=function(a){var b=this.F(a);let c=this.index[b];c?(b=c.size,c.add(a),(b-=c.size)&&this.size++):(this.index[b]=c=new Set([a]),this.h.push(c))};u=J.prototype;u.has=L.prototype.has=function(a){const b=this.index[this.F(a)];return b&&b.has(a)};u.delete=L.prototype.delete=function(a){const b=this.index[this.F(a)];b&&b.delete(a)&&this.size--}; d){for(h=d-1;0<h;h--)g=n[h]+g,k=this.score?this.score(c,n,p,g,h):M(t,e,p,d,h),N(this,l,g,k,a,b);g=""}case "forward":if(1<d){for(h=0;h<d;h++)g+=n[h],N(this,l,g,f,a,b);break}default:if(N(this,l,n,f,a,b),r&&1<e&&p<e-1)for(d=y(),g=this.ca,f=n,h=Math.min(r+1,e-p),d[f]=1,k=1;k<h;k++)if((n=c[this.rtl?e-1-p-k:p+k])&&!d[n]){d[n]=1;const u=this.score?this.score(c,f,p,n,k):M(g+(e/2>g?0:1),e,p,h-1,k-1),B=this.bidirectional&&n>f;N(this,m,B?f:n,u,a,b,B?n:f)}}}}this.fastupdate||this.h.add(a)}}return this};
u.clear=L.prototype.clear=function(){this.index=y();this.h=[];this.size=0};u.values=L.prototype.values=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].values())yield b};u.keys=L.prototype.keys=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].keys())yield b};u.entries=L.prototype.entries=function*(){for(let a=0;a<this.h.length;a++)for(let b of this.h[a].entries())yield b}; function N(a,c,b,e,d,f,g){let h=g?a.I:a.map,k;c[b]&&g&&(k=c[b])[g]||(g?(c=k||(c[b]=y()),c[g]=1,(k=h.get(g))?h=k:h.set(g,h=new Map)):c[b]=1,(k=h.get(b))?h=k:h.set(b,h=[]),h=h[e]||(h[e]=[]),f&&h.includes(d)||(h.push(d),a.fastupdate&&((c=a.h.get(d))?c.push(h):a.h.set(d,[h]))))}function M(a,c,b,e,d){return b&&1<a?c+(e||0)<=a?b+(d||0):(a-1)/(c+(e||0))*(b+(d||0))+1|0:0};function O(a,c,b){if(1===a.length)return a=a[0],a=b||a.length>c?c?a.slice(b,b+c):a.slice(b):a;let e=[];for(let d=0,f,g;d<a.length;d++)if((f=a[d])&&(g=f.length)){if(b){if(b>=g){b-=g;continue}b<g&&(f=c?f.slice(b,b+c):f.slice(b),g=f.length,b=0)}if(e.length)g>c&&(f=f.slice(0,c),g=f.length),e.push(f);else{if(g>=c)return g>c&&(f=f.slice(0,c)),f;e=[f]}c-=g;if(!c)break}return e.length?e=1<e.length?[].concat.apply([],e):e[0]:e};function na(a,c,b,e){var d=a.length;let f=[],g=0,h,k,m;e&&(e=[]);for(let l=d-1,r;0<=l;l--){m=a[l];d=y();r=!h;for(let t=0,p;t<m.length;t++)if((p=m[t])&&p.length)for(let n=0,u;n<p.length;n++)if(u=p[n],h){if(h[u]){if(!l)if(b)b--;else if(f[g++]=u,g===c)return f;if(l||e)d[u]=1;r=!0}e&&!k[u]&&(k[u]=1,(e[t]||(e[t]=[])).push(u))}else d[u]=1;if(e)h||(k=d);else if(!r)return[];h=d}if(e)for(let l=e.length-1,r,t;0<=l;l--){r=e[l];t=r.length;for(let p=0,n;p<t;p++)if(n=r[p],!h[n]){if(b)b--;else if(f[g++]=n,g===c)return f;
function ka(a){let b=2**this.B-1;if("number"==typeof a)return a&b;let c=0,e=this.B+1;for(let d=0;d<a.length;d++)c=(c*e^a.charCodeAt(d))&b;return 32===this.B?c+2**31:c}function ja(a){let b=BigInt(2)**this.B-BigInt(1);var c=typeof a;if("bigint"===c)return a&b;if("number"===c)return BigInt(a)&b;c=BigInt(0);let e=this.B+BigInt(1);for(let d=0;d<a.length;d++)c=(c*e^BigInt(a.charCodeAt(d)))&b;return c};function la(a,b,c,e,d,f,g,h){(e=a(c?c+"."+e:e,JSON.stringify(g)))&&e.then?e.then(function(){b.export(a,b,c,d,f+1,h)}):b.export(a,b,c,d,f+1,h)};const ma=y(),M=y();var na={normalize:function(a){return a.toLowerCase()},C:!1};const oa={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};function pa(a){N.call(a,"add");N.call(a,"append");N.call(a,"search");N.call(a,"update");N.call(a,"remove")}function N(a){this[a+"Async"]=function(){var b=arguments;const c=b[b.length-1];let e;"function"===typeof c&&(e=c,delete b[b.length-1]);this.async=!0;b=this[a].apply(this,b);this.async=!1;b.then?b.then(e):e(b);return b}};y();O.prototype.add=function(a,b,c,e){if(b&&(a||0===a)){if(!e&&!c&&this.A.has(a))return this.update(a,b);b=this.encoder.encode(b);if(e=b.length){const m=y(),l=y(),r=this.depth,t=this.resolution;for(let p=0;p<e;p++){let n=b[this.rtl?e-1-p:p];var d=n.length;if(d&&(r||!l[n])){var f=this.score?this.score(b,n,p,null,0):P(t,e,p),g="";switch(this.tokenize){case "full":if(2<d){for(f=0;f<d;f++)for(var h=d;h>f;h--){g=n.substring(f,h);var k=this.score?this.score(b,n,p,g,f):P(t,e,p,d,f);Q(this,l,g,k,a,c)}break}case "reverse":if(1< h[n]=1}}return f}function oa(a,c){const b=y(),e=y(),d=[];for(let f=0;f<a.length;f++)b[a[f]]=1;for(let f=0,g;f<c.length;f++){g=c[f];for(let h=0,k;h<g.length;h++)k=g[h],b[k]&&!e[k]&&(e[k]=1,d.push(k))}return d};L.prototype.search=function(a,c,b){b||(!c&&E(a)?(b=a,a=""):E(c)&&(b=c,c=0));let e=[];let d,f=0;if(b){a=b.query||a;c=b.limit||c;f=b.offset||0;var g=b.context;d=b.suggest}a=this.encoder.encode(a);b=a.length;c||(c=100);if(1===b)return P.call(this,a[0],"",c,f);g=this.depth&&!1!==g;if(2===b&&g&&!d)return P.call(this,a[0],a[1],c,f);let h=0,k=0;if(1<b){var m=y();const r=[];for(let t=0,p;t<b;t++)if((p=a[t])&&!m[p]){if(d||R(this,p))r.push(p),m[p]=1;else return e;const n=p.length;h=Math.max(h,n);k=k?Math.min(k,
d){for(h=d-1;0<h;h--)g=n[h]+g,k=this.score?this.score(b,n,p,g,h):P(t,e,p,d,h),Q(this,l,g,k,a,c);g=""}case "forward":if(1<d){for(h=0;h<d;h++)g+=n[h],Q(this,l,g,f,a,c);break}default:if(Q(this,l,n,f,a,c),r&&1<e&&p<e-1)for(d=y(),g=this.ca,f=n,h=Math.min(r+1,e-p),d[f]=1,k=1;k<h;k++)if((n=b[this.rtl?e-1-p-k:p+k])&&!d[n]){d[n]=1;const v=this.score?this.score(b,f,p,n,k):P(g+(e/2>g?0:1),e,p,h-1,k-1),C=this.bidirectional&&n>f;Q(this,m,C?f:n,v,a,c,C?n:f)}}}}this.fastupdate||this.A.add(a)}}return this}; n):n}a=r;b=a.length}if(!b)return e;m=0;let l;if(1===b)return P.call(this,a[0],"",c,f);if(2===b&&g&&!d)return P.call(this,a[0],a[1],c,f);1<b&&(g?(l=a[0],m=1):9<h&&3<h/k&&a.sort(aa));for(let r,t;m<b;m++){t=a[m];l?(r=R(this,t,l),r=pa(r,e,d,this.ca,c,f,2===b),d&&!1===r&&e.length||(l=t)):(r=R(this,t),r=pa(r,e,d,this.resolution,c,f,1===b));if(r)return r;if(d&&m===b-1){g=e.length;if(!g){if(l){l="";m=-1;continue}return e}if(1===g)return O(e[0],c,f)}}return na(e,c,f,d)};
function Q(a,b,c,e,d,f,g){let h=g?a.K:a.map,k;b[c]&&g&&(k=b[c])[g]||(g?(b=k||(b[c]=y()),b[g]=1,(k=h.get(g))?h=k:h.set(g,h=new Map)):b[c]=1,(k=h.get(c))?h=k:h.set(c,h=[]),h=h[e]||(h[e]=[]),f&&h.includes(d)||(h.push(d),a.fastupdate&&((b=a.A.get(d))?b.push(h):a.A.set(d,[h]))))}function P(a,b,c,e,d){return c&&1<a?b+(e||0)<=a?c+(d||0):(a-1)/(b+(e||0))*(c+(d||0))+1|0:0};function R(a,b,c){if(1===a.length)return a=a[0],a=c||a.length>b?b?a.slice(c,c+b):a.slice(c):a;let e=[];for(let d=0,f,g;d<a.length;d++)if((f=a[d])&&(g=f.length)){if(c){if(c>=g){c-=g;continue}c<g&&(f=b?f.slice(c,c+b):f.slice(c),g=f.length,c=0)}if(e.length)g>b&&(f=f.slice(0,b),g=f.length),e.push(f);else{if(g>=b)return g>b&&(f=f.slice(0,b)),f;e=[f]}b-=g;if(!b)break}return e.length?e=1<e.length?[].concat.apply([],e):e[0]:e};function qa(a,b,c,e){var d=a.length;let f=[],g=0,h,k,m;e&&(e=[]);for(let l=d-1,r;0<=l;l--){m=a[l];d=y();r=!h;for(let t=0,p;t<m.length;t++)if((p=m[t])&&p.length)for(let n=0,v;n<p.length;n++)if(v=p[n],h){if(h[v]){if(!l)if(c)c--;else if(f[g++]=v,g===b)return f;if(l||e)d[v]=1;r=!0}e&&!k[v]&&(k[v]=1,(e[t]||(e[t]=[])).push(v))}else d[v]=1;if(e)h||(k=d);else if(!r)return[];h=d}if(e)for(let l=e.length-1,r,t;0<=l;l--){r=e[l];t=r.length;for(let p=0,n;p<t;p++)if(n=r[p],!h[n]){if(c)c--;else if(f[g++]=n,g===b)return f; function P(a,c,b,e){return(a=R(this,a,c))&&a.length?O(a,b,e):[]}function pa(a,c,b,e,d,f,g){let h=[];if(a){e=Math.min(a.length,e);for(let k=0,m=0,l;k<e;k++)if(l=a[k])if(f&&l&&g&&(l.length<=f?(f-=l.length,l=null):(l=l.slice(f),f=0)),l&&(h[k]=l,g&&(m+=l.length,m>=d)))break;if(h.length){if(g)return O(h,d,0);c.push(h);return}}return!b&&h}function R(a,c,b){let e;b&&(e=a.bidirectional&&c>b);a=b?(a=a.I.get(e?c:b))&&a.get(e?b:c):a.map.get(c);return a};L.prototype.remove=function(a,c){const b=this.h.size&&(this.fastupdate?this.h.get(a):this.h.has(a));if(b){if(this.fastupdate)for(let e=0,d;e<b.length;e++){if(d=b[e])if(2>d.length)d.pop();else{const f=d.indexOf(a);f===b.length-1?d.pop():d.splice(f,1)}}else S(this.map,a),this.depth&&S(this.I,a);c||this.h.delete(a)}this.cache&&this.cache.remove(a);return this};
h[n]=1}}return f}function ra(a,b){const c=y(),e=y(),d=[];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 h=0,k;h<g.length;h++)k=g[h],c[k]&&!e[k]&&(e[k]=1,d.push(k))}return d};O.prototype.search=function(a,b,c){c||(!b&&B(a)?(c=a,a=""):B(b)&&(c=b,b=0));let e=[];let d,f=0;if(c){a=c.query||a;b=c.limit||b;f=c.offset||0;var g=c.context;d=c.suggest}a=this.encoder.encode(a);c=a.length;b||(b=100);if(1===c)return T.call(this,a[0],"",b,f);g=this.depth&&!1!==g;if(2===c&&g&&!d)return T.call(this,a[0],a[1],b,f);let h=0,k=0;if(1<c){var m=y();const r=[];for(let t=0,p;t<c;t++)if((p=a[t])&&!m[p]){if(d||U(this,p))r.push(p),m[p]=1;else return e;const n=p.length;h=Math.max(h,n);k=k?Math.min(k, function S(a,c){let b=0;if(a.constructor===Array)for(let e=0,d,f;e<a.length;e++){if((d=a[e])&&d.length)if(f=d.indexOf(c),0<=f){1<d.length?(d.splice(f,1),b++):delete a[e];break}else b++}else for(let e of a){const d=e[0],f=S(e[1],c);f?b+=f:a.delete(d)}return b};function L(a,c){if(!(this instanceof L))return new L(a);if(a){var b=z(a)?a:a.preset;b&&(a=Object.assign({},la[b],a))}else a={};b=a.context||{};const e=a.encode||a.encoder||ka;this.encoder=e.encode?e:"object"===typeof e?new H(e):{encode:e};let d;this.resolution=a.resolution||9;this.tokenize=d=a.tokenize||"strict";this.depth="strict"===d&&b.depth||0;this.bidirectional=!1!==b.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;d=!1;this.map=new Map;this.I=new Map;this.h=c||(this.fastupdate?
n):n}a=r;c=a.length}if(!c)return e;m=0;let l;if(1===c)return T.call(this,a[0],"",b,f);if(2===c&&g&&!d)return T.call(this,a[0],a[1],b,f);1<c&&(g?(l=a[0],m=1):9<h&&3<h/k&&a.sort(aa));for(let r,t;m<c;m++){t=a[m];l?(r=U(this,t,l),r=sa(r,e,d,this.ca,b,f,2===c),d&&!1===r&&e.length||(l=t)):(r=U(this,t),r=sa(r,e,d,this.resolution,b,f,1===c));if(r)return r;if(d&&m===c-1){g=e.length;if(!g){if(l){l="";m=-1;continue}return e}if(1===g)return R(e[0],b,f)}}return qa(e,b,f,d)}; new Map:new Set);this.ca=b.resolution||1;this.rtl=e.rtl||a.rtl||!1;this.cache=(d=a.cache||null)&&new J(d)}v=L.prototype;v.clear=function(){this.map.clear();this.I.clear();this.h.clear();this.cache&&this.cache.clear();return this};v.append=function(a,c){return this.add(a,c,!0)};v.contain=function(a){return this.h.has(a)};v.update=function(a,c){if(this.async){const b=this,e=this.remove(a);return e.then?e.then(()=>b.add(a,c)):this.add(a,c)}return this.remove(a).add(a,c)};
function T(a,b,c,e){return(a=U(this,a,b))&&a.length?R(a,c,e):[]}function sa(a,b,c,e,d,f,g){let h=[];if(a){e=Math.min(a.length,e);for(let k=0,m=0,l;k<e;k++)if(l=a[k])if(f&&l&&g&&(l.length<=f?(f-=l.length,l=null):(l=l.slice(f),f=0)),l&&(h[k]=l,g&&(m+=l.length,m>=d)))break;if(h.length){if(g)return R(h,d,0);b.push(h);return}}return!c&&h}function U(a,b,c){let e;c&&(e=a.bidirectional&&b>c);a=c?(a=a.K.get(e?b:c))&&a.get(e?c:b):a.map.get(b);return a};O.prototype.remove=function(a,b){const c=this.A.size&&(this.fastupdate?this.A.get(a):this.A.has(a));if(c){if(this.fastupdate)for(let e=0,d;e<c.length;e++){if(d=c[e])if(2>d.length)d.pop();else{const f=d.indexOf(a);f===c.length-1?d.pop():d.splice(f,1)}}else V(this.map,a),this.depth&&V(this.K,a);b||this.A.delete(a)}this.cache&&this.cache.remove(a);return this}; function T(a){let c=0;if(a.constructor===Array)for(let b=0,e;b<a.length;b++)(e=a[b])&&(c+=e.length);else for(const b of a){const e=b[0],d=T(b[1]);d?c+=d:a.delete(e)}return c}v.cleanup=function(){if(!this.fastupdate)return this;T(this.map);this.depth&&T(this.I);return this};v.searchCache=ia;
function V(a,b){let c=0;if(a.constructor===Array)for(let e=0,d,f;e<a.length;e++){if((d=a[e])&&d.length)if(f=d.indexOf(b),0<=f){1<d.length?(d.splice(f,1),c++):delete a[e];break}else c++}else for(let e of a){const d=e[0],f=V(e[1],b);f?c+=f:a.delete(d)}return c};function O(a,b){if(!(this instanceof O))return new O(a);if(a){var c=z(a)?a:a.preset;c&&(a=Object.assign({},oa[c],a))}else a={};c=a.context||{};const e=a.encode||a.encoder||na;this.encoder=e.encode?e:"object"===typeof e?new H(e):{encode:e};let d;this.resolution=a.resolution||9;this.tokenize=d=a.tokenize||"strict";this.depth="strict"===d&&c.depth||0;this.bidirectional=!1!==c.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;this.map=(d=!1,new Map);this.K=d?new J(d):new Map;this.A= v.export=function(a,c,b,e,d,f){let g=!0;"undefined"===typeof f&&(g=new Promise(m=>{f=m}));let h,k;switch(d||(d=0)){case 0:h="reg";if(this.fastupdate){k=y();for(let m of this.h.keys())k[m]=1}else k=this.h;break;case 1:h="cfg";k={doc:0,opt:this.B?1:0};break;case 2:h="map";k=this.map;break;case 3:h="ctx";k=this.I;break;default:"undefined"===typeof b&&f&&f();return}ja(a,c||this,b,h,e,d,k,f);return g};
b||(this.fastupdate?d?new J(d):new Map:d?new L(d):new Set);this.ca=c.resolution||1;this.rtl=e.rtl||a.rtl||!1;this.cache=(d=a.cache||null)&&new I(d)}u=O.prototype;u.clear=function(){this.map.clear();this.K.clear();this.A.clear();this.cache&&this.cache.clear();return this};u.append=function(a,b){return this.add(a,b,!0)};u.contain=function(a){return this.A.has(a)}; v.import=function(a,c){if(c)switch(z(c)&&(c=JSON.parse(c)),a){case "cfg":this.B=!!c.opt;break;case "reg":this.fastupdate=!1;this.h=c;break;case "map":this.map=c;break;case "ctx":this.I=c}};ma(L.prototype);U.prototype.add=function(a,c,b){E(a)&&(c=a,a=F(c,this.key));if(c&&(a||0===a)){if(!b&&this.h.has(a))return this.update(a,c);for(let h=0,k;h<this.field.length;h++){k=this.K[h];var e=this.index.get(this.field[h]);if("function"===typeof k){var d=k(c);d&&e.add(a,d,!1,!0)}else if(d=k.O,!d||d(c))k instanceof String?k=[""+k]:z(k)&&(k=[k]),V(c,k,this.S,0,e,a,k[0],b)}if(this.tag)for(e=0;e<this.H.length;e++){var f=this.H[e];d=this.tag.get(this.da[e]);let h=y();if("function"===typeof f){if(f=f(c),!f)continue}else{var g=
u.update=function(a,b){if(this.async){const c=this,e=this.remove(a);return e.then?e.then(()=>c.add(a,b)):this.add(a,b)}return this.remove(a).add(a,b)};function W(a){let b=0;if(a.constructor===Array)for(let c=0,e;c<a.length;c++)(e=a[c])&&(b+=e.length);else for(const c of a){const e=c[0],d=W(c[1]);d?b+=d:a.delete(e)}return b}u.cleanup=function(){if(!this.fastupdate)return this;W(this.map);this.depth&&W(this.K);return this};u.searchCache=ia; f.O;if(g&&!g(c))continue;f instanceof String&&(f=""+f);f=F(c,f)}if(d&&f){z(f)&&(f=[f]);for(let k=0,m,l;k<f.length;k++)m=f[k],h[m]||(h[m]=1,(g=d.get(m))?l=g:d.set(m,l=[]),b&&l.includes(a)||(l.push(a),this.fastupdate&&((g=this.h.get(a))?g.push(l):this.h.set(a,[l]))))}}if(this.store&&(!b||!this.store.has(a))){let h;if(this.D){h=y();for(let k=0,m;k<this.D.length;k++){m=this.D[k];if((b=m.O)&&!b(c))continue;let l;if("function"===typeof m){l=m(c);if(!l)continue;m=[m.ea]}else if(z(m)||m instanceof String){h[m]=
u.export=function(a,b,c,e,d,f){let g=!0;"undefined"===typeof f&&(g=new Promise(m=>{f=m}));let h,k;switch(d||(d=0)){case 0:h="reg";if(this.fastupdate){k=y();for(let m of this.A.keys())k[m]=1}else k=this.A;break;case 1:h="cfg";k={doc:0,opt:this.h?1:0};break;case 2:h="map";k=this.map;break;case 3:h="ctx";k=this.K;break;default:"undefined"===typeof c&&f&&f();return}la(a,b||this,c,h,e,d,k,f);return g}; c[m];continue}W(c,h,m,0,m[0],l)}}this.store.set(a,h||c)}}return this};function W(a,c,b,e,d,f){a=a[d];if(e===b.length-1)c[d]=f||a;else if(a)if(a.constructor===Array)for(c=c[d]=Array(a.length),d=0;d<a.length;d++)W(a,c,b,e,d);else c=c[d]||(c[d]=y()),d=b[++e],W(a,c,b,e,d)}
u.import=function(a,b){if(b)switch(z(b)&&(b=JSON.parse(b)),a){case "cfg":this.h=!!b.opt;break;case "reg":this.fastupdate=!1;this.A=b;break;case "map":this.map=b;break;case "ctx":this.K=b}};pa(O.prototype);X.prototype.add=function(a,b,c){B(a)&&(b=a,a=F(b,this.key));if(b&&(a||0===a)){if(!c&&this.A.has(a))return this.update(a,b);for(let h=0,k;h<this.field.length;h++){k=this.M[h];var e=this.index.get(this.field[h]);if("function"===typeof k){var d=k(b);d&&e.add(a,d,!1,!0)}else if(d=k.P,!d||d(b))k instanceof String?k=[""+k]:z(k)&&(k=[k]),ta(b,k,this.T,0,e,a,k[0],c)}if(this.tag)for(e=0;e<this.J.length;e++){var f=this.J[e];d=this.tag.get(this.da[e]);let h=y();if("function"===typeof f){if(f=f(b),!f)continue}else{var g= function V(a,c,b,e,d,f,g,h){if(a=a[g])if(e===c.length-1){if(a.constructor===Array){if(b[e]){for(c=0;c<a.length;c++)d.add(f,a[c],!0,!0);return}a=a.join(" ")}d.add(f,a,h,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)V(a,c,b,e,d,f,g,h);else g=c[++e],V(a,c,b,e,d,f,g,h)};U.prototype.search=function(a,c,b,e){b||(!c&&E(a)?(b=a,a=""):E(c)&&(b=c,c=0));let d=[];var f=[];let g,h,k,m,l;let r=0;if(b)if(b.constructor===Array)m=b,b=null;else{a=b.query||a;var t=b.pluck;h=b.merge;m=t||b.field||b.index;l=this.tag&&b.tag;g=this.store&&b.enrich;k=b.suggest;c=b.limit||c;var p=b.offset||0;c||(c=100);if(l){l.constructor!==Array&&(l=[l]);var n=[];for(let w=0,q;w<l.length;w++)if(q=l[w],q.field&&q.tag){var u=q.tag;if(u.constructor===Array)for(var B=0;B<u.length;B++)n.push(q.field,u[B]);
f.P;if(g&&!g(b))continue;f instanceof String&&(f=""+f);f=F(b,f)}if(d&&f){z(f)&&(f=[f]);for(let k=0,m,l;k<f.length;k++)m=f[k],h[m]||(h[m]=1,(g=d.get(m))?l=g:d.set(m,l=[]),c&&l.includes(a)||(l.push(a),this.fastupdate&&((g=this.A.get(a))?g.push(l):this.A.set(a,[l]))))}}if(this.store&&(!c||!this.store.has(a))){let h;if(this.G){h=y();for(let k=0,m;k<this.G.length;k++){m=this.G[k];if((c=m.P)&&!c(b))continue;let l;if("function"===typeof m){l=m(b);if(!l)continue;m=[m.ea]}else if(z(m)||m instanceof String){h[m]= else n.push(q.field,u)}else{u=Object.keys(q);for(let C=0,D,A;C<u.length;C++)if(D=u[C],A=q[D],A.constructor===Array)for(B=0;B<A.length;B++)n.push(D,A[B]);else n.push(D,A)}l=n;if(!a){e=[];if(n.length)for(f=0;f<n.length;f+=2)t=qa.call(this,n[f],n[f+1],c,p,g),d.push({field:n[f],tag:n[f+1],result:t});return e.length?Promise.all(e).then(function(w){for(let q=0;q<w.length;q++)d[q].result=w[q];return d}):d}}z(m)&&(m=[m])}m||(m=this.field);p=!e&&(this.worker||this.async)&&[];for(let w=0,q,C,D;w<m.length;w++){C=
b[m];continue}ua(b,h,m,0,m[0],l)}}this.store.set(a,h||b)}}return this};function ua(a,b,c,e,d,f){a=a[d];if(e===c.length-1)b[d]=f||a;else if(a)if(a.constructor===Array)for(b=b[d]=Array(a.length),d=0;d<a.length;d++)ua(a,b,c,e,d);else b=b[d]||(b[d]=y()),d=c[++e],ua(a,b,c,e,d)} m[w];let A;z(C)||(A=C,C=A.field,a=A.query||a,c=A.limit||c,k=A.suggest||k);if(e)q=e[w];else if(n=A||b,u=this.index.get(C),l&&(n.enrich=!1),p){p[w]=u.searchAsync(a,c,n);n&&g&&(n.enrich=g);continue}else q=u.search(a,c,n),n&&g&&(n.enrich=g);D=q&&q.length;if(l&&D){n=[];u=0;for(let Q=0,I,ya;Q<l.length;Q+=2){I=this.tag.get(l[Q]);if(!I)if(k)continue;else return d;if(ya=(I=I&&I.get(l[Q+1]))&&I.length)u++,n.push(I);else if(!k)return d}if(u){q=oa(q,n);D=q.length;if(!D&&!k)return d;u--}}if(D)f[r]=C,d.push(q),
function ta(a,b,c,e,d,f,g,h){if(a=a[g])if(e===b.length-1){if(a.constructor===Array){if(c[e]){for(b=0;b<a.length;b++)d.add(f,a[b],!0,!0);return}a=a.join(" ")}d.add(f,a,h,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)ta(a,b,c,e,d,f,g,h);else g=b[++e],ta(a,b,c,e,d,f,g,h)};X.prototype.search=function(a,b,c,e){c||(!b&&B(a)?(c=a,a=""):B(b)&&(c=b,b=0));let d=[];var f=[];let g,h,k,m,l;let r=0;if(c)if(c.constructor===Array)m=c,c=null;else{a=c.query||a;var t=c.pluck;h=c.merge;m=t||c.field||c.index;l=this.tag&&c.tag;g=this.store&&c.enrich;k=c.suggest;b=c.limit||b;var p=c.offset||0;b||(b=100);if(l){l.constructor!==Array&&(l=[l]);var n=[];for(let w=0,q;w<l.length;w++)if(q=l[w],q.field&&q.tag){var v=q.tag;if(v.constructor===Array)for(var C=0;C<v.length;C++)n.push(q.field,v[C]); r++;else if(1===m.length)return d}if(p){const w=this;return Promise.all(p).then(function(q){return q.length?w.search(a,c,b,q):q})}if(!r)return d;if(t&&(!g||!this.store))return d[0];p=[];for(let w=0,q;w<f.length;w++){q=d[w];g&&q.length&&!q[0].doc&&q.length&&(q=ra.call(this,q));if(t)return q;d[w]={field:f[w],result:q}}return h?sa(d,c):d};
else n.push(q.field,v)}else{v=Object.keys(q);for(let D=0,E,A;D<v.length;D++)if(E=v[D],A=q[E],A.constructor===Array)for(C=0;C<A.length;C++)n.push(E,A[C]);else n.push(E,A)}l=n;if(!a){e=[];if(n.length)for(f=0;f<n.length;f+=2)t=va.call(this,n[f],n[f+1],b,p,g),d.push({field:n[f],tag:n[f+1],result:t});return e.length?Promise.all(e).then(function(w){for(let q=0;q<w.length;q++)d[q].result=w[q];return d}):d}}z(m)&&(m=[m])}m||(m=this.field);p=!e&&(this.worker||this.async)&&[];for(let w=0,q,D,E;w<m.length;w++){D= function sa(a,c){const b=[],e=y();for(let d=0,f,g;d<a.length;d++){f=a[d];g=f.result;for(let h=0,k,m,l;h<g.length;h++)if(m=g[h],k=m.id,l=e[k])l.push(f.field);else{if(b.length===c)return b;m.field=e[k]=[f.field];b.push(m)}}return b}function qa(a,c,b,e,d){a=this.tag.get(a);if(!a)return[];if((c=(a=a&&a.get(c))&&a.length-e)&&0<c){if(c>b||e)a=a.slice(e,e+b);d&&(a=ra.call(this,a));return a}}
m[w];let A;z(D)||(A=D,D=A.field,a=A.query||a,b=A.limit||b,k=A.suggest||k);if(e)q=e[w];else if(n=A||c,v=this.index.get(D),l&&(n.enrich=!1),p){p[w]=v.searchAsync(a,b,n);n&&g&&(n.enrich=g);continue}else q=v.search(a,b,n),n&&g&&(n.enrich=g);E=q&&q.length;if(l&&E){n=[];v=0;for(let S=0,K,Da;S<l.length;S+=2){K=this.tag.get(l[S]);if(!K)if(k)continue;else return d;if(Da=(K=K&&K.get(l[S+1]))&&K.length)v++,n.push(K);else if(!k)return d}if(v){q=ra(q,n);E=q.length;if(!E&&!k)return d;v--}}if(E)f[r]=D,d.push(q), function ra(a){const c=Array(a.length);for(let b=0,e;b<a.length;b++)e=a[b],c[b]={id:e,doc:this.store.get(e)};return c};function U(a){if(!(this instanceof U))return new U(a);const c=a.document||a.doc||a;var b;this.K=[];this.field=[];this.S=[];this.key=(b=c.key||c.id)&&X(b,this.S)||"id";this.h=(this.fastupdate=!!a.fastupdate)?new Map:new Set;this.D=(b=c.store||null)&&!0!==b&&[];this.store=b&&new Map;this.cache=(b=a.cache||null)&&new J(b);this.async=a.cache=!1;b=new Map;let e=c.index||c.field||c;z(e)&&(e=[e]);for(let d=0,f,g;d<e.length;d++)f=e[d],z(f)||(g=f,f=f.field),g=E(g)?Object.assign({},a,g):a,b.set(f,new L(g,this.h)),
r++;else if(1===m.length)return d}if(p){const w=this;return Promise.all(p).then(function(q){return q.length?w.search(a,b,c,q):q})}if(!r)return d;if(t&&(!g||!this.store))return d[0];p=[];for(let w=0,q;w<f.length;w++){q=d[w];g&&q.length&&!q[0].doc&&q.length&&(q=wa.call(this,q));if(t)return q;d[w]={field:f[w],result:q}}return h?xa(d,b):d}; g.N?this.K[d]=g.N:(this.K[d]=X(f,this.S),g.filter&&("string"===typeof this.K[d]&&(this.K[d]=new String(this.K[d])),this.K[d].O=g.filter)),this.field[d]=f;if(this.D){a=c.store;z(a)&&(a=[a]);for(let d=0,f,g;d<a.length;d++)f=a[d],g=f.field||f,f.N?(this.D[d]=f.N,f.N.ea=g):(this.D[d]=X(g,this.S),f.filter&&("string"===typeof this.D[d]&&(this.D[d]=new String(this.D[d])),this.D[d].O=f.filter))}this.index=b;this.tag=null;if(b=c.tag)if("string"===typeof b&&(b=[b]),b.length){this.tag=new Map;this.H=[];this.da=
function xa(a,b){const c=[],e=y();for(let d=0,f,g;d<a.length;d++){f=a[d];g=f.result;for(let h=0,k,m,l;h<g.length;h++)if(m=g[h],k=m.id,l=e[k])l.push(f.field);else{if(c.length===b)return c;m.field=e[k]=[f.field];c.push(m)}}return c}function va(a,b,c,e,d){a=this.tag.get(a);if(!a)return[];if((b=(a=a&&a.get(b))&&a.length-e)&&0<b){if(b>c||e)a=a.slice(e,e+c);d&&(a=wa.call(this,a));return a}} [];for(let d=0,f,g;d<b.length;d++){f=b[d];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");f.N?this.H[d]=f.N:(this.H[d]=X(g,this.S),f.filter&&("string"===typeof this.H[d]&&(this.H[d]=new String(this.H[d])),this.H[d].O=f.filter));this.da[d]=g;this.tag.set(g,new Map)}}}
function wa(a){const b=Array(a.length);for(let c=0,e;c<a.length;c++)e=a[c],b[c]={id:e,doc:this.store.get(e)};return b};function X(a){if(!(this instanceof X))return new X(a);const b=a.document||a.doc||a;var c;this.M=[];this.field=[];this.T=[];this.key=(c=b.key||b.id)&&Y(c,this.T)||"id";this.A=(this.fastupdate=!!a.fastupdate)?new Map:new Set;this.G=(c=b.store||null)&&!0!==c&&[];this.store=c&&new Map;this.cache=(c=a.cache||null)&&new I(c);this.async=a.cache=!1;c=new Map;let e=b.index||b.field||b;z(e)&&(e=[e]);for(let d=0,f,g;d<e.length;d++)f=e[d],z(f)||(g=f,f=f.field),g=B(g)?Object.assign({},a,g):a,c.set(f,new O(g,this.A)), function X(a,c){const b=a.split(":");let e=0;for(let d=0;d<b.length;d++)a=b[d],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(c[e]=!0),a&&(b[e++]=a);e<b.length&&(b.length=e);return 1<e?b:b[0]}v=U.prototype;v.append=function(a,c){return this.add(a,c,!0)};v.update=function(a,c){return this.remove(a).add(a,c)};
g.O?this.M[d]=g.O:(this.M[d]=Y(f,this.T),g.filter&&("string"===typeof this.M[d]&&(this.M[d]=new String(this.M[d])),this.M[d].P=g.filter)),this.field[d]=f;if(this.G){a=b.store;z(a)&&(a=[a]);for(let d=0,f,g;d<a.length;d++)f=a[d],g=f.field||f,f.O?(this.G[d]=f.O,f.O.ea=g):(this.G[d]=Y(g,this.T),f.filter&&("string"===typeof this.G[d]&&(this.G[d]=new String(this.G[d])),this.G[d].P=f.filter))}this.index=c;this.tag=null;if(c=b.tag)if("string"===typeof c&&(c=[c]),c.length){this.tag=new Map;this.J=[];this.da= v.remove=function(a){E(a)&&(a=F(a,this.key));for(var c of this.index.values())c.remove(a,!0);if(this.h.has(a)){if(this.tag&&!this.fastupdate)for(let b of this.tag.values())for(let e of b){c=e[0];const d=e[1],f=d.indexOf(a);-1<f&&(1<d.length?d.splice(f,1):b.delete(c))}this.store&&this.store.delete(a);this.h.delete(a)}this.cache&&this.cache.remove(a);return this};
[];for(let d=0,f,g;d<c.length;d++){f=c[d];g=f.field||f;if(!g)throw Error("The tag field from the document descriptor is undefined.");f.O?this.J[d]=f.O:(this.J[d]=Y(g,this.T),f.filter&&("string"===typeof this.J[d]&&(this.J[d]=new String(this.J[d])),this.J[d].P=f.filter));this.da[d]=g;this.tag.set(g,new Map)}}} v.clear=function(){for(const a of this.index.values())a.clear();if(this.tag)for(const a of this.tag.values())a.clear();this.store&&this.store.clear();return this};v.contain=function(a){return this.h.has(a)};v.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};v.get=function(a){return this.store.get(a)};v.set=function(a,c){this.store.set(a,c);return this};v.searchCache=ia;
function Y(a,b){const c=a.split(":");let e=0;for(let d=0;d<c.length;d++)a=c[d],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(b[e]=!0),a&&(c[e++]=a);e<c.length&&(c.length=e);return 1<e?c:c[0]}u=X.prototype;u.append=function(a,b){return this.add(a,b,!0)};u.update=function(a,b){return this.remove(a).add(a,b)}; v.export=function(a,c,b,e,d,f){let g;"undefined"===typeof f&&(g=new Promise(k=>{f=k}));d||(d=0);e||(e=0);if(e<this.field.length){b=this.field[e];var h=this.index[b];c=this;h.export(a,c,d?b:"",e,d++,f)||(e++,c.export(a,c,b,e,1,f))}else{switch(d){case 1:c="tag";h=this.L;b=null;break;case 2:c="store";h=this.store;b=null;break;default:f();return}ja(a,this,b,c,e,d,h,f)}return g};
u.remove=function(a){B(a)&&(a=F(a,this.key));for(var b of this.index.values())b.remove(a,!0);if(this.A.has(a)){if(this.tag&&!this.fastupdate)for(let c of this.tag.values())for(let e of c){b=e[0];const d=e[1],f=d.indexOf(a);-1<f&&(1<d.length?d.splice(f,1):c.delete(b))}this.store&&this.store.delete(a);this.A.delete(a)}this.cache&&this.cache.remove(a);return this}; v.import=function(a,c){if(c)switch(z(c)&&(c=JSON.parse(c)),a){case "tag":this.L=c;break;case "reg":this.fastupdate=!1;this.h=c;for(let e=0,d;e<this.field.length;e++)d=this.index[this.field[e]],d.h=c,d.fastupdate=!1;break;case "store":this.store=c;break;default:a=a.split(".");const b=a[0];a=a[1];b&&a&&this.index[b].import(a,c)}};ma(U.prototype);const Y=y();const ta=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 ua={normalize:!0,A:!0,C:ta};const va=new Map([["ai","ei"],["ae","a"],["oe","o"],["ue","u"],["sh","s"],["ch","c"],["th","t"],["ph","f"],["pf","f"]]),wa=[/([^aeo])h([aeo$])/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2"];var xa={normalize:!0,A:!0,C:ta,G:wa,F:va};var za={normalize:!0,A:!0,C:ta,G:wa.concat([/(?!^)[aeoy]/g,""]),F:va};const Aa={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};Y["latin:exact"]={normalize:!1,A:!1};Y["latin:default"]=ka;Y["latin:simple"]={normalize:!0,A:!0};Y["latin:balance"]=ua;Y["latin:advanced"]=xa;Y["latin:extra"]=za;Y["latin:soundex"]={normalize:!0,A:!1,aa:{fa:!0},R:function(a){for(let b=0;b<a.length;b++){var c=a[b];let e=c.charAt(0),d=Aa[e];for(let f=1,g;f<c.length&&(g=c.charAt(f),"h"===g||"w"===g||!(g=Aa[g])||g===d||(e+=g,d=g,4!==e.length));f++);a[b]=e}}};
u.clear=function(){for(const a of this.index.values())a.clear();if(this.tag)for(const a of this.tag.values())a.clear();this.store&&this.store.clear();return this};u.contain=function(a){return this.A.has(a)};u.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};u.get=function(a){return this.store.get(a)};u.set=function(a,b){this.store.set(a,b);return this};u.searchCache=ia; const Ba={Index:L,Charset:Y,Encoder:H,Document:U,Worker:null,Resolver:null,IndexedDB:null},Z=self;let Ca;(Ca=Z.define)&&Ca.amd?Ca([],function(){return Ba}):"object"===typeof Z.exports?Z.exports=Ba:Z.FlexSearch=Ba;}(this));
u.export=function(a,b,c,e,d,f){let g;"undefined"===typeof f&&(g=new Promise(k=>{f=k}));d||(d=0);e||(e=0);if(e<this.field.length){c=this.field[e];var h=this.index[c];b=this;h.export(a,b,d?c:"",e,d++,f)||(e++,b.export(a,b,c,e,1,f))}else{switch(d){case 1:b="tag";h=this.B;c=null;break;case 2:b="store";h=this.store;c=null;break;default:f();return}la(a,this,c,b,e,d,h,f)}return g};
u.import=function(a,b){if(b)switch(z(b)&&(b=JSON.parse(b)),a){case "tag":this.B=b;break;case "reg":this.fastupdate=!1;this.A=b;for(let e=0,d;e<this.field.length;e++)d=this.index[this.field[e]],d.A=b,d.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)}};pa(X.prototype);const ya=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 za={normalize:!0,C:!0,D:ya};const Aa=new Map([["ai","ei"],["ae","a"],["oe","o"],["ue","u"],["sh","s"],["ch","c"],["th","t"],["ph","f"],["pf","f"]]),Ba=[/([^aeo])h([aeo$])/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2"];var Ca={normalize:!0,C:!0,D:ya,I:Ba,H:Aa};var Ea={normalize:!0,C:!0,D:ya,I:Ba.concat([/(?!^)[aeoy]/g,""]),H:Aa};const Fa={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};M["latin:exact"]={normalize:!1,C:!1};M["latin:default"]=na;M["latin:simple"]={normalize:!0,C:!0};M["latin:balance"]=za;M["latin:advanced"]=Ca;M["latin:extra"]=Ea;M["latin:soundex"]={normalize:!0,C:!1,aa:{fa:!0},S:function(a){for(let c=0;c<a.length;c++){var b=a[c];let e=b.charAt(0),d=Fa[e];for(let f=1,g;f<b.length&&(g=b.charAt(f),"h"===g||"w"===g||!(g=Fa[g])||g===d||(e+=g,d=g,4!==e.length));f++);a[c]=e}}};
const Ga={Index:O,Encoder:H,Charset:M,Language:ma,Document:X,Worker:null,Resolver:null,IndexedDB:null},Z=self;let Ha;(Ha=Z.define)&&Ha.amd?Ha([],function(){return Ga}):"object"===typeof Z.exports?Z.exports=Ga:Z.FlexSearch=Ga;}(this));

File diff suppressed because it is too large Load Diff

View File

@@ -5,44 +5,40 @@
* Hosted by Nextapps GmbH * Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch * https://github.com/nextapps-de/flexsearch
*/ */
var u;function x(a,b,c){const e=typeof c,d=typeof a;if("undefined"!==e){if("undefined"!==d){if(c){if("function"===d&&e===d)return function(h){return a(c(h))};b=a.constructor;if(b===c.constructor){if(b===Array)return c.concat(a);if(b===Map){var f=new Map(c);for(var g of a)f.set(g[0],g[1]);return f}if(b===Set){g=new Set(c);for(f of a.values())g.add(f);return g}}}return a}return c}return"undefined"===d?b:a}function y(){return Object.create(null)}function aa(a,b){return b.length-a.length} var w;function x(a,b,c){const d=typeof c,e=typeof a;if("undefined"!==d){if("undefined"!==e){if(c){if("function"===e&&d===e)return function(h){return a(c(h))};b=a.constructor;if(b===c.constructor){if(b===Array)return c.concat(a);if(b===Map){var f=new Map(c);for(var g of a)f.set(g[0],g[1]);return f}if(b===Set){g=new Set(c);for(f of a.values())g.add(f);return g}}}return a}return c}return"undefined"===e?b:a}function y(){return Object.create(null)}function aa(a,b){return b.length-a.length}
function A(a){return"string"===typeof a}function B(a){return"object"===typeof a}function ba(a,b){if(A(b))a=a[b];else for(let c=0;a&&c<b.length;c++)a=a[b[c]];return a};const ca=/[^\p{L}\p{N}]+/u,da=/(\d{3})/g,ea=/(\D)(\d{3})/g,fa=/(\d{3})(\D)/g,F="".normalize&&/[\u0300-\u036f]/g,ha=!F&&new Map([["\u00aa","a"],["\u00b2","2"],["\u00b3","3"],["\u00b9","1"],["\u00ba","o"],["\u00bc","1\u20444"],["\u00bd","1\u20442"],["\u00be","3\u20444"],["\u00e0","a"],["\u00e1","a"],["\u00e2","a"],["\u00e3","a"],["\u00e4","a"],["\u00e5","a"],["\u00e7","c"],["\u00e8","e"],["\u00e9","e"],["\u00ea","e"],["\u00eb","e"],["\u00ec","i"],["\u00ed","i"],["\u00ee","i"],["\u00ef","i"],["\u00f1", function A(a){return"string"===typeof a}function E(a){return"object"===typeof a}function F(a,b){if(A(b))a=a[b];else for(let c=0;a&&c<b.length;c++)a=a[b[c]];return a};const ba=/[^\p{L}\p{N}]+/u,ca=/(\d{3})/g,da=/(\D)(\d{3})/g,ea=/(\d{3})(\D)/g,G="".normalize&&/[\u0300-\u036f]/g,H=!G&&[["\u00aa","a"],["\u00b2","2"],["\u00b3","3"],["\u00b9","1"],["\u00ba","o"],["\u00bc","1\u20444"],["\u00bd","1\u20442"],["\u00be","3\u20444"],["\u00e0","a"],["\u00e1","a"],["\u00e2","a"],["\u00e3","a"],["\u00e4","a"],["\u00e5","a"],["\u00e7","c"],["\u00e8","e"],["\u00e9","e"],["\u00ea","e"],["\u00eb","e"],["\u00ec","i"],["\u00ed","i"],["\u00ee","i"],["\u00ef","i"],["\u00f1","n"],["\u00f2",
"n"],["\u00f2","o"],["\u00f3","o"],["\u00f4","o"],["\u00f5","o"],["\u00f6","o"],["\u00f9","u"],["\u00fa","u"],["\u00fb","u"],["\u00fc","u"],["\u00fd","y"],["\u00ff","y"],["\u0101","a"],["\u0103","a"],["\u0105","a"],["\u0107","c"],["\u0109","c"],["\u010b","c"],["\u010d","c"],["\u010f","d"],["\u0113","e"],["\u0115","e"],["\u0117","e"],["\u0119","e"],["\u011b","e"],["\u011d","g"],["\u011f","g"],["\u0121","g"],["\u0123","g"],["\u0125","h"],["\u0129","i"],["\u012b","i"],["\u012d","i"],["\u012f","i"],["\u0133", "o"],["\u00f3","o"],["\u00f4","o"],["\u00f5","o"],["\u00f6","o"],["\u00f9","u"],["\u00fa","u"],["\u00fb","u"],["\u00fc","u"],["\u00fd","y"],["\u00ff","y"],["\u0101","a"],["\u0103","a"],["\u0105","a"],["\u0107","c"],["\u0109","c"],["\u010b","c"],["\u010d","c"],["\u010f","d"],["\u0113","e"],["\u0115","e"],["\u0117","e"],["\u0119","e"],["\u011b","e"],["\u011d","g"],["\u011f","g"],["\u0121","g"],["\u0123","g"],["\u0125","h"],["\u0129","i"],["\u012b","i"],["\u012d","i"],["\u012f","i"],["\u0133","ij"],
"ij"],["\u0135","j"],["\u0137","k"],["\u013a","l"],["\u013c","l"],["\u013e","l"],["\u0140","l"],["\u0144","n"],["\u0146","n"],["\u0148","n"],["\u0149","n"],["\u014d","o"],["\u014f","o"],["\u0151","o"],["\u0155","r"],["\u0157","r"],["\u0159","r"],["\u015b","s"],["\u015d","s"],["\u015f","s"],["\u0161","s"],["\u0163","t"],["\u0165","t"],["\u0169","u"],["\u016b","u"],["\u016d","u"],["\u016f","u"],["\u0171","u"],["\u0173","u"],["\u0175","w"],["\u0177","y"],["\u017a","z"],["\u017c","z"],["\u017e","z"], ["\u0135","j"],["\u0137","k"],["\u013a","l"],["\u013c","l"],["\u013e","l"],["\u0140","l"],["\u0144","n"],["\u0146","n"],["\u0148","n"],["\u0149","n"],["\u014d","o"],["\u014f","o"],["\u0151","o"],["\u0155","r"],["\u0157","r"],["\u0159","r"],["\u015b","s"],["\u015d","s"],["\u015f","s"],["\u0161","s"],["\u0163","t"],["\u0165","t"],["\u0169","u"],["\u016b","u"],["\u016d","u"],["\u016f","u"],["\u0171","u"],["\u0173","u"],["\u0175","w"],["\u0177","y"],["\u017a","z"],["\u017c","z"],["\u017e","z"],["\u017f",
["\u017f","s"],["\u01a1","o"],["\u01b0","u"],["\u01c6","dz"],["\u01c9","lj"],["\u01cc","nj"],["\u01ce","a"],["\u01d0","i"],["\u01d2","o"],["\u01d4","u"],["\u01d6","u"],["\u01d8","u"],["\u01da","u"],["\u01dc","u"],["\u01df","a"],["\u01e1","a"],["\u01e3","ae"],["\u00e6","ae"],["\u01fd","ae"],["\u01e7","g"],["\u01e9","k"],["\u01eb","o"],["\u01ed","o"],["\u01ef","\u0292"],["\u01f0","j"],["\u01f3","dz"],["\u01f5","g"],["\u01f9","n"],["\u01fb","a"],["\u01ff","\u00f8"],["\u0201","a"],["\u0203","a"],["\u0205", "s"],["\u01a1","o"],["\u01b0","u"],["\u01c6","dz"],["\u01c9","lj"],["\u01cc","nj"],["\u01ce","a"],["\u01d0","i"],["\u01d2","o"],["\u01d4","u"],["\u01d6","u"],["\u01d8","u"],["\u01da","u"],["\u01dc","u"],["\u01df","a"],["\u01e1","a"],["\u01e3","ae"],["\u00e6","ae"],["\u01fd","ae"],["\u01e7","g"],["\u01e9","k"],["\u01eb","o"],["\u01ed","o"],["\u01ef","\u0292"],["\u01f0","j"],["\u01f3","dz"],["\u01f5","g"],["\u01f9","n"],["\u01fb","a"],["\u01ff","\u00f8"],["\u0201","a"],["\u0203","a"],["\u0205","e"],
"e"],["\u0207","e"],["\u0209","i"],["\u020b","i"],["\u020d","o"],["\u020f","o"],["\u0211","r"],["\u0213","r"],["\u0215","u"],["\u0217","u"],["\u0219","s"],["\u021b","t"],["\u021f","h"],["\u0227","a"],["\u0229","e"],["\u022b","o"],["\u022d","o"],["\u022f","o"],["\u0231","o"],["\u0233","y"],["\u02b0","h"],["\u02b1","h"],["\u0266","h"],["\u02b2","j"],["\u02b3","r"],["\u02b4","\u0279"],["\u02b5","\u027b"],["\u02b6","\u0281"],["\u02b7","w"],["\u02b8","y"],["\u02e0","\u0263"],["\u02e1","l"],["\u02e2","s"], ["\u0207","e"],["\u0209","i"],["\u020b","i"],["\u020d","o"],["\u020f","o"],["\u0211","r"],["\u0213","r"],["\u0215","u"],["\u0217","u"],["\u0219","s"],["\u021b","t"],["\u021f","h"],["\u0227","a"],["\u0229","e"],["\u022b","o"],["\u022d","o"],["\u022f","o"],["\u0231","o"],["\u0233","y"],["\u02b0","h"],["\u02b1","h"],["\u0266","h"],["\u02b2","j"],["\u02b3","r"],["\u02b4","\u0279"],["\u02b5","\u027b"],["\u02b6","\u0281"],["\u02b7","w"],["\u02b8","y"],["\u02e0","\u0263"],["\u02e1","l"],["\u02e2","s"],["\u02e3",
["\u02e3","x"],["\u02e4","\u0295"],["\u0390","\u03b9"],["\u03ac","\u03b1"],["\u03ad","\u03b5"],["\u03ae","\u03b7"],["\u03af","\u03b9"],["\u03b0","\u03c5"],["\u03ca","\u03b9"],["\u03cb","\u03c5"],["\u03cc","\u03bf"],["\u03cd","\u03c5"],["\u03ce","\u03c9"],["\u03d0","\u03b2"],["\u03d1","\u03b8"],["\u03d2","\u03a5"],["\u03d3","\u03a5"],["\u03d4","\u03a5"],["\u03d5","\u03c6"],["\u03d6","\u03c0"],["\u03f0","\u03ba"],["\u03f1","\u03c1"],["\u03f2","\u03c2"],["\u03f5","\u03b5"],["\u0439","\u0438"],["\u0450", "x"],["\u02e4","\u0295"],["\u0390","\u03b9"],["\u03ac","\u03b1"],["\u03ad","\u03b5"],["\u03ae","\u03b7"],["\u03af","\u03b9"],["\u03b0","\u03c5"],["\u03ca","\u03b9"],["\u03cb","\u03c5"],["\u03cc","\u03bf"],["\u03cd","\u03c5"],["\u03ce","\u03c9"],["\u03d0","\u03b2"],["\u03d1","\u03b8"],["\u03d2","\u03a5"],["\u03d3","\u03a5"],["\u03d4","\u03a5"],["\u03d5","\u03c6"],["\u03d6","\u03c0"],["\u03f0","\u03ba"],["\u03f1","\u03c1"],["\u03f2","\u03c2"],["\u03f5","\u03b5"],["\u0439","\u0438"],["\u0450","\u0435"],
"\u0435"],["\u0451","\u0435"],["\u0453","\u0433"],["\u0457","\u0456"],["\u045c","\u043a"],["\u045d","\u0438"],["\u045e","\u0443"],["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]]); ["\u0451","\u0435"],["\u0453","\u0433"],["\u0457","\u0456"],["\u045c","\u043a"],["\u045d","\u0438"],["\u045e","\u0443"],["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]];
function G(a={}){if(!(this instanceof G))return new G(...arguments);for(a=0;a<arguments.length;a++)this.assign(arguments[a])} function J(a={}){if(!(this instanceof J))return new J(...arguments);for(a=0;a<arguments.length;a++)this.assign(arguments[a])}
G.prototype.assign=function(a){this.normalize=x(a.normalize,!0,this.normalize);let b=a.U,c=b||a.Z||a.split;if("object"===typeof c){let e=!b,d="";a.U||(d+="\\p{Z}");c.Y&&(d+="\\p{L}");c.$&&(d+="\\p{N}",e=!!b);c.ba&&(d+="\\p{S}");c.aa&&(d+="\\p{P}");c.control&&(d+="\\p{C}");if(c=c.char)d+="object"===typeof c?c.join(""):c;this.split=new RegExp("["+(b?"^":"")+d+"]+","u");this.numeric=e}else this.split=x(c,ca,this.split),this.numeric=x(this.numeric,!0);this.R=x(a.R,null,this.R);this.M=x(a.M,null,this.M); J.prototype.assign=function(a){this.normalize=x(a.normalize,!0,this.normalize);let b=a.U,c=b||a.Z||a.split;if("object"===typeof c){let d=!b,e="";a.U||(e+="\\p{Z}");c.Y&&(e+="\\p{L}");c.$&&(e+="\\p{N}",d=!!b);c.ba&&(e+="\\p{S}");c.aa&&(e+="\\p{P}");c.control&&(e+="\\p{C}");if(c=c.char)e+="object"===typeof c?c.join(""):c;this.split=new RegExp("["+(b?"^":"")+e+"]+","u");this.numeric=d}else this.split=x(c,ba,this.split),this.numeric=x(this.numeric,!0);this.P=x(a.P,null,this.P);this.L=x(a.L,null,this.L);
this.rtl=a.rtl||!1;this.C=x(a.C,!0,this.C);this.filter=x((c=a.filter)&&new Set(c),null,this.filter);this.H=x((c=a.H)&&new Map(c),null,this.H);this.D=x((c=a.D)&&new Map(c),null,this.D);this.K=x((c=a.K)&&new Map(c),null,this.K);this.I=x(a.I,null,this.I);this.P=x(a.P,1,this.P);this.V=x(a.V,0,this.V);this.A="";this.F=null;this.B="";this.S=null;if(this.H)for(const e of this.H.keys())this.A+=(this.A?"|":"")+e;if(this.K)for(const e of this.K.keys())this.B+=(this.B?"|":"")+e;return this}; H&&(this.B=new Map(H));this.rtl=a.rtl||!1;this.A=x(a.A,!0,this.A);this.filter=x((c=a.filter)&&new Set(c),null,this.filter);this.D=x((c=a.D)&&new Map(c),null,this.D);this.B=x((c=a.B)&&new Map(c),null,this.B);this.H=x((c=a.H)&&new Map(c),null,this.H);this.F=x(a.F,null,this.F);this.O=x(a.O,1,this.O);this.V=x(a.V,0,this.V);this.K="";this.R=null;this.J="";this.S=null;if(this.D)for(const d of this.D.keys())this.K+=(this.K?"|":"")+d;if(this.H)for(const d of this.H.keys())this.J+=(this.J?"|":"")+d;return this};
G.prototype.encode=function(a){this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):F?a=a.normalize("NFKD").replace(F,"").toLowerCase():(a=a.toLowerCase(),this.D=this.D?new Map([...ha,...this.D]):new Map(ha)));this.R&&(a=this.R(a));this.numeric&&3<a.length&&(a=a.replace(ea,"$1 $2").replace(fa,"$1 $2").replace(da,"$1 "));const b=!(this.C||this.D||this.filter||this.H||this.K||this.I);let c=[];a=this.split||""===this.split?a.split(this.split):a;for(let d=0,f;d<a.length;d++){if(!(f= J.prototype.encode=function(a){this.normalize&&(a="function"===typeof this.normalize?this.normalize(a):G?a.normalize("NFKD").replace(G,"").toLowerCase():a.toLowerCase());this.P&&(a=this.P(a));this.numeric&&3<a.length&&(a=a.replace(da,"$1 $2").replace(ea,"$1 $2").replace(ca,"$1 "));const b=!(this.A||this.B||this.filter||this.D||this.H||this.F);let c=[];a=this.split||""===this.split?a.split(this.split):a;for(let e=0,f;e<a.length;e++){if(!(f=a[e]))continue;if(f.length<this.O)continue;if(b){c.push(f);
a[d]))continue;if(f.length<this.P)continue;if(b){c.push(f);continue}if(this.filter&&this.filter.has(f))continue;let g;this.K&&2<f.length&&(this.S||(this.S=new RegExp("(?!^)("+this.B+")$")),f=f.replace(this.S,h=>this.K.get(h)),g=1);this.H&&1<f.length&&(this.F||(this.F=new RegExp("("+this.A+")","g")),f=f.replace(this.F,h=>this.H.get(h)),g=1);f&&g&&(f.length<this.P||this.filter&&this.filter.has(f))&&(f="");if(f&&(this.D||this.C&&1<f.length)){var e="";for(let h=0,k="",n,l;h<f.length;h++)n=f.charAt(h), continue}if(this.filter&&this.filter.has(f))continue;let g;this.H&&2<f.length&&(this.S||(this.S=new RegExp("(?!^)("+this.J+")$")),f=f.replace(this.S,h=>this.H.get(h)),g=1);this.D&&1<f.length&&(this.R||(this.R=new RegExp("("+this.K+")","g")),f=f.replace(this.R,h=>this.D.get(h)),g=1);f&&g&&(f.length<this.O||this.filter&&this.filter.has(f))&&(f="");if(f&&(this.B||this.A&&1<f.length)){var d="";for(let h=0,k="",n,l;h<f.length;h++)n=f.charAt(h),n===k&&this.A||((l=this.B&&this.B.get(n))||""===l?l===k&&this.A||
n===k&&this.C||((l=this.D&&this.D.get(n))||""===l?l===k&&this.C||!(k=l)||(e+=l):e+=k=n);f=e}if(f&&this.I)for(e=0;f&&e<this.I.length;e+=2)f=f.replace(this.I[e],this.I[e+1]);f&&c.push(f)}this.M&&(c=this.M(c)||c);return c};function H(a=8){if(!(this instanceof H))return new H(a);this.index=y();this.F=[];this.size=0;32<a?(this.A=ia,this.B=BigInt(a)):(this.A=ja,this.B=a)}H.prototype.get=function(a){const b=this.index[this.A(a)];return b&&b.get(a)};H.prototype.set=function(a,b){var c=this.A(a);let e=this.index[c];e?(c=e.size,e.set(a,b),(c-=e.size)&&this.size++):(this.index[c]=e=new Map([[a,b]]),this.F.push(e))}; !(k=l)||(d+=l):d+=k=n);f=d}if(f&&this.F)for(d=0;f&&d<this.F.length;d+=2)f=f.replace(this.F[d],this.F[d+1]);f&&c.push(f)}this.L&&(c=this.L(c)||c);return c};function fa(a,b,c,d,e,f,g,h){(d=a(c?c+"."+d:d,JSON.stringify(g)))&&d.then?d.then(function(){b.export(a,b,c,e,f+1,h)}):b.export(a,b,c,e,f+1,h)};var ha={normalize:function(a){return a.toLowerCase()},A:!1};const ia={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};function ja(a){K.call(a,"add");K.call(a,"append");K.call(a,"search");K.call(a,"update");K.call(a,"remove")}function K(a){this[a+"Async"]=function(){var b=arguments;const c=b[b.length-1];let d;"function"===typeof c&&(d=c,delete b[b.length-1]);this.async=!0;b=this[a].apply(this,b);this.async=!1;b.then?b.then(d):d(b);return b}};y();L.prototype.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.h.has(a))return this.update(a,b);b=this.encoder.encode(b);if(d=b.length){const n=y(),l=y(),r=this.depth,t=this.resolution;for(let p=0;p<d;p++){let m=b[this.rtl?d-1-p:p];var e=m.length;if(e&&(r||!l[m])){var f=this.score?this.score(b,m,p,null,0):M(t,d,p),g="";switch(this.tokenize){case "full":if(2<e){for(f=0;f<e;f++)for(var h=e;h>f;h--){g=m.substring(f,h);var k=this.score?this.score(b,m,p,g,f):M(t,d,p,e,f);N(this,l,g,k,a,c)}break}case "reverse":if(1<
function I(a=8){if(!(this instanceof I))return new I(a);this.index=y();this.A=[];32<a?(this.F=ia,this.B=BigInt(a)):(this.F=ja,this.B=a)}I.prototype.add=function(a){var b=this.F(a);let c=this.index[b];c?(b=c.size,c.add(a),(b-=c.size)&&this.size++):(this.index[b]=c=new Set([a]),this.A.push(c))};u=H.prototype;u.has=I.prototype.has=function(a){const b=this.index[this.F(a)];return b&&b.has(a)};u.delete=I.prototype.delete=function(a){const b=this.index[this.F(a)];b&&b.delete(a)&&this.size--}; e){for(h=e-1;0<h;h--)g=m[h]+g,k=this.score?this.score(b,m,p,g,h):M(t,d,p,e,h),N(this,l,g,k,a,c);g=""}case "forward":if(1<e){for(h=0;h<e;h++)g+=m[h],N(this,l,g,f,a,c);break}default:if(N(this,l,m,f,a,c),r&&1<d&&p<d-1)for(e=y(),g=this.W,f=m,h=Math.min(r+1,d-p),e[f]=1,k=1;k<h;k++)if((m=b[this.rtl?d-1-p-k:p+k])&&!e[m]){e[m]=1;const u=this.score?this.score(b,f,p,m,k):M(g+(d/2>g?0:1),d,p,h-1,k-1),B=this.bidirectional&&m>f;N(this,n,B?f:m,u,a,c,B?m:f)}}}}this.fastupdate||this.h.add(a)}}return this};
u.clear=I.prototype.clear=function(){this.index=y();this.A=[];this.size=0};u.values=I.prototype.values=function*(){for(let a=0;a<this.A.length;a++)for(let b of this.A[a].values())yield b};u.keys=I.prototype.keys=function*(){for(let a=0;a<this.A.length;a++)for(let b of this.A[a].keys())yield b};u.entries=I.prototype.entries=function*(){for(let a=0;a<this.A.length;a++)for(let b of this.A[a].entries())yield b}; function N(a,b,c,d,e,f,g){let h=g?a.G:a.map,k;b[c]&&g&&(k=b[c])[g]||(g?(b=k||(b[c]=y()),b[g]=1,(k=h.get(g))?h=k:h.set(g,h=new Map)):b[c]=1,(k=h.get(c))?h=k:h.set(c,h=[]),h=h[d]||(h[d]=[]),f&&h.includes(e)||(h.push(e),a.fastupdate&&((b=a.h.get(e))?b.push(h):a.h.set(e,[h]))))}function M(a,b,c,d,e){return c&&1<a?b+(d||0)<=a?c+(e||0):(a-1)/(b+(d||0))*(c+(e||0))+1|0:0};function O(a,b,c){if(1===a.length)return a=a[0],a=c||a.length>b?b?a.slice(c,c+b):a.slice(c):a;let d=[];for(let e=0,f,g;e<a.length;e++)if((f=a[e])&&(g=f.length)){if(c){if(c>=g){c-=g;continue}c<g&&(f=b?f.slice(c,c+b):f.slice(c),g=f.length,c=0)}if(d.length)g>b&&(f=f.slice(0,b),g=f.length),d.push(f);else{if(g>=b)return g>b&&(f=f.slice(0,b)),f;d=[f]}b-=g;if(!b)break}return d.length?d=1<d.length?[].concat.apply([],d):d[0]:d};function ka(a,b,c,d){var e=a.length;let f=[],g=0,h,k,n;d&&(d=[]);for(let l=e-1,r;0<=l;l--){n=a[l];e=y();r=!h;for(let t=0,p;t<n.length;t++)if((p=n[t])&&p.length)for(let m=0,u;m<p.length;m++)if(u=p[m],h){if(h[u]){if(!l)if(c)c--;else if(f[g++]=u,g===b)return f;if(l||d)e[u]=1;r=!0}d&&!k[u]&&(k[u]=1,(d[t]||(d[t]=[])).push(u))}else e[u]=1;if(d)h||(k=e);else if(!r)return[];h=e}if(d)for(let l=d.length-1,r,t;0<=l;l--){r=d[l];t=r.length;for(let p=0,m;p<t;p++)if(m=r[p],!h[m]){if(c)c--;else if(f[g++]=m,g===b)return f;
function ja(a){let b=2**this.B-1;if("number"==typeof a)return a&b;let c=0,e=this.B+1;for(let d=0;d<a.length;d++)c=(c*e^a.charCodeAt(d))&b;return 32===this.B?c+2**31:c}function ia(a){let b=BigInt(2)**this.B-BigInt(1);var c=typeof a;if("bigint"===c)return a&b;if("number"===c)return BigInt(a)&b;c=BigInt(0);let e=this.B+BigInt(1);for(let d=0;d<a.length;d++)c=(c*e^BigInt(a.charCodeAt(d)))&b;return c};function ka(a,b,c,e,d,f,g,h){(e=a(c?c+"."+e:e,JSON.stringify(g)))&&e.then?e.then(function(){b.export(a,b,c,d,f+1,h)}):b.export(a,b,c,d,f+1,h)};const la=y(),J=y();var ma={normalize:function(a){return a.toLowerCase()},C:!1};const na={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};function oa(a){L.call(a,"add");L.call(a,"append");L.call(a,"search");L.call(a,"update");L.call(a,"remove")}function L(a){this[a+"Async"]=function(){var b=arguments;const c=b[b.length-1];let e;"function"===typeof c&&(e=c,delete b[b.length-1]);this.async=!0;b=this[a].apply(this,b);this.async=!1;b.then?b.then(e):e(b);return b}};y();M.prototype.add=function(a,b,c,e){if(b&&(a||0===a)){if(!e&&!c&&this.h.has(a))return this.update(a,b);b=this.encoder.encode(b);if(e=b.length){const n=y(),l=y(),r=this.depth,t=this.resolution;for(let p=0;p<e;p++){let m=b[this.rtl?e-1-p:p];var d=m.length;if(d&&(r||!l[m])){var f=this.score?this.score(b,m,p,null,0):N(t,e,p),g="";switch(this.tokenize){case "full":if(2<d){for(f=0;f<d;f++)for(var h=d;h>f;h--){g=m.substring(f,h);var k=this.score?this.score(b,m,p,g,f):N(t,e,p,d,f);O(this,l,g,k,a,c)}break}case "reverse":if(1< h[m]=1}}return f}function la(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 h=0,k;h<g.length;h++)k=g[h],c[k]&&!d[k]&&(d[k]=1,e.push(k))}return e};L.prototype.search=function(a,b,c){c||(!b&&E(a)?(c=a,a=""):E(b)&&(c=b,b=0));let d=[];let e,f=0;if(c){a=c.query||a;b=c.limit||b;f=c.offset||0;var g=c.context;e=c.suggest}a=this.encoder.encode(a);c=a.length;b||(b=100);if(1===c)return Q.call(this,a[0],"",b,f);g=this.depth&&!1!==g;if(2===c&&g&&!e)return Q.call(this,a[0],a[1],b,f);let h=0,k=0;if(1<c){var n=y();const r=[];for(let t=0,p;t<c;t++)if((p=a[t])&&!n[p]){if(e||R(this,p))r.push(p),n[p]=1;else return d;const m=p.length;h=Math.max(h,m);k=k?Math.min(k,
d){for(h=d-1;0<h;h--)g=m[h]+g,k=this.score?this.score(b,m,p,g,h):N(t,e,p,d,h),O(this,l,g,k,a,c);g=""}case "forward":if(1<d){for(h=0;h<d;h++)g+=m[h],O(this,l,g,f,a,c);break}default:if(O(this,l,m,f,a,c),r&&1<e&&p<e-1)for(d=y(),g=this.W,f=m,h=Math.min(r+1,e-p),d[f]=1,k=1;k<h;k++)if((m=b[this.rtl?e-1-p-k:p+k])&&!d[m]){d[m]=1;const v=this.score?this.score(b,f,p,m,k):N(g+(e/2>g?0:1),e,p,h-1,k-1),C=this.bidirectional&&m>f;O(this,n,C?f:m,v,a,c,C?m:f)}}}}this.fastupdate||this.h.add(a)}}return this}; m):m}a=r;c=a.length}if(!c)return d;n=0;let l;if(1===c)return Q.call(this,a[0],"",b,f);if(2===c&&g&&!e)return Q.call(this,a[0],a[1],b,f);1<c&&(g?(l=a[0],n=1):9<h&&3<h/k&&a.sort(aa));for(let r,t;n<c;n++){t=a[n];l?(r=R(this,t,l),r=ma(r,d,e,this.W,b,f,2===c),e&&!1===r&&d.length||(l=t)):(r=R(this,t),r=ma(r,d,e,this.resolution,b,f,1===c));if(r)return r;if(e&&n===c-1){g=d.length;if(!g){if(l){l="";n=-1;continue}return d}if(1===g)return O(d[0],b,f)}}return ka(d,b,f,e)};
function O(a,b,c,e,d,f,g){let h=g?a.J:a.map,k;b[c]&&g&&(k=b[c])[g]||(g?(b=k||(b[c]=y()),b[g]=1,(k=h.get(g))?h=k:h.set(g,h=new Map)):b[c]=1,(k=h.get(c))?h=k:h.set(c,h=[]),h=h[e]||(h[e]=[]),f&&h.includes(d)||(h.push(d),a.fastupdate&&((b=a.h.get(d))?b.push(h):a.h.set(d,[h]))))}function N(a,b,c,e,d){return c&&1<a?b+(e||0)<=a?c+(d||0):(a-1)/(b+(e||0))*(c+(d||0))+1|0:0};function P(a,b,c){if(1===a.length)return a=a[0],a=c||a.length>b?b?a.slice(c,c+b):a.slice(c):a;let e=[];for(let d=0,f,g;d<a.length;d++)if((f=a[d])&&(g=f.length)){if(c){if(c>=g){c-=g;continue}c<g&&(f=b?f.slice(c,c+b):f.slice(c),g=f.length,c=0)}if(e.length)g>b&&(f=f.slice(0,b),g=f.length),e.push(f);else{if(g>=b)return g>b&&(f=f.slice(0,b)),f;e=[f]}b-=g;if(!b)break}return e.length?e=1<e.length?[].concat.apply([],e):e[0]:e};function pa(a,b,c,e){var d=a.length;let f=[],g=0,h,k,n;e&&(e=[]);for(let l=d-1,r;0<=l;l--){n=a[l];d=y();r=!h;for(let t=0,p;t<n.length;t++)if((p=n[t])&&p.length)for(let m=0,v;m<p.length;m++)if(v=p[m],h){if(h[v]){if(!l)if(c)c--;else if(f[g++]=v,g===b)return f;if(l||e)d[v]=1;r=!0}e&&!k[v]&&(k[v]=1,(e[t]||(e[t]=[])).push(v))}else d[v]=1;if(e)h||(k=d);else if(!r)return[];h=d}if(e)for(let l=e.length-1,r,t;0<=l;l--){r=e[l];t=r.length;for(let p=0,m;p<t;p++)if(m=r[p],!h[m]){if(c)c--;else if(f[g++]=m,g===b)return f; function Q(a,b,c,d){return(a=R(this,a,b))&&a.length?O(a,c,d):[]}function ma(a,b,c,d,e,f,g){let h=[];if(a){d=Math.min(a.length,d);for(let k=0,n=0,l;k<d;k++)if(l=a[k])if(f&&l&&g&&(l.length<=f?(f-=l.length,l=null):(l=l.slice(f),f=0)),l&&(h[k]=l,g&&(n+=l.length,n>=e)))break;if(h.length){if(g)return O(h,e,0);b.push(h);return}}return!c&&h}function R(a,b,c){let d;c&&(d=a.bidirectional&&b>c);a=c?(a=a.G.get(d?b:c))&&a.get(d?c:b):a.map.get(b);return a};L.prototype.remove=function(a,b){const c=this.h.size&&(this.fastupdate?this.h.get(a):this.h.has(a));if(c){if(this.fastupdate)for(let d=0,e;d<c.length;d++){if(e=c[d])if(2>e.length)e.pop();else{const f=e.indexOf(a);f===c.length-1?e.pop():e.splice(f,1)}}else S(this.map,a),this.depth&&S(this.G,a);b||this.h.delete(a)}return this};
h[m]=1}}return f}function qa(a,b){const c=y(),e=y(),d=[];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 h=0,k;h<g.length;h++)k=g[h],c[k]&&!e[k]&&(e[k]=1,d.push(k))}return d};M.prototype.search=function(a,b,c){c||(!b&&B(a)?(c=a,a=""):B(b)&&(c=b,b=0));let e=[];let d,f=0;if(c){a=c.query||a;b=c.limit||b;f=c.offset||0;var g=c.context;d=c.suggest}a=this.encoder.encode(a);c=a.length;b||(b=100);if(1===c)return Q.call(this,a[0],"",b,f);g=this.depth&&!1!==g;if(2===c&&g&&!d)return Q.call(this,a[0],a[1],b,f);let h=0,k=0;if(1<c){var n=y();const r=[];for(let t=0,p;t<c;t++)if((p=a[t])&&!n[p]){if(d||S(this,p))r.push(p),n[p]=1;else return e;const m=p.length;h=Math.max(h,m);k=k?Math.min(k, function S(a,b){let c=0;if(a.constructor===Array)for(let d=0,e,f;d<a.length;d++){if((e=a[d])&&e.length)if(f=e.indexOf(b),0<=f){1<e.length?(e.splice(f,1),c++):delete a[d];break}else c++}else for(let d of a){const e=d[0],f=S(d[1],b);f?c+=f:a.delete(e)}return c};function L(a,b){if(!(this instanceof L))return new L(a);if(a){var c=A(a)?a:a.preset;c&&(a=Object.assign({},ia[c],a))}else a={};c=a.context||{};const d=a.encode||a.encoder||ha;this.encoder=d.encode?d:"object"===typeof d?new J(d):{encode:d};let e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&c.depth||0;this.bidirectional=!1!==c.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;this.map=new Map;this.G=new Map;this.h=b||(this.fastupdate?
m):m}a=r;c=a.length}if(!c)return e;n=0;let l;if(1===c)return Q.call(this,a[0],"",b,f);if(2===c&&g&&!d)return Q.call(this,a[0],a[1],b,f);1<c&&(g?(l=a[0],n=1):9<h&&3<h/k&&a.sort(aa));for(let r,t;n<c;n++){t=a[n];l?(r=S(this,t,l),r=ra(r,e,d,this.W,b,f,2===c),d&&!1===r&&e.length||(l=t)):(r=S(this,t),r=ra(r,e,d,this.resolution,b,f,1===c));if(r)return r;if(d&&n===c-1){g=e.length;if(!g){if(l){l="";n=-1;continue}return e}if(1===g)return P(e[0],b,f)}}return pa(e,b,f,d)}; new Map:new Set);this.W=c.resolution||1;this.rtl=d.rtl||a.rtl||!1}w=L.prototype;w.clear=function(){this.map.clear();this.G.clear();this.h.clear();return this};w.append=function(a,b){return this.add(a,b,!0)};w.contain=function(a){return this.h.has(a)};w.update=function(a,b){if(this.async){const c=this,d=this.remove(a);return d.then?d.then(()=>c.add(a,b)):this.add(a,b)}return this.remove(a).add(a,b)};
function Q(a,b,c,e){return(a=S(this,a,b))&&a.length?P(a,c,e):[]}function ra(a,b,c,e,d,f,g){let h=[];if(a){e=Math.min(a.length,e);for(let k=0,n=0,l;k<e;k++)if(l=a[k])if(f&&l&&g&&(l.length<=f?(f-=l.length,l=null):(l=l.slice(f),f=0)),l&&(h[k]=l,g&&(n+=l.length,n>=d)))break;if(h.length){if(g)return P(h,d,0);b.push(h);return}}return!c&&h}function S(a,b,c){let e;c&&(e=a.bidirectional&&b>c);a=c?(a=a.J.get(e?b:c))&&a.get(e?c:b):a.map.get(b);return a};M.prototype.remove=function(a,b){const c=this.h.size&&(this.fastupdate?this.h.get(a):this.h.has(a));if(c){if(this.fastupdate)for(let e=0,d;e<c.length;e++){if(d=c[e])if(2>d.length)d.pop();else{const f=d.indexOf(a);f===c.length-1?d.pop():d.splice(f,1)}}else T(this.map,a),this.depth&&T(this.J,a);b||this.h.delete(a)}return this}; function T(a){let b=0;if(a.constructor===Array)for(let c=0,d;c<a.length;c++)(d=a[c])&&(b+=d.length);else for(const c of a){const d=c[0],e=T(c[1]);e?b+=e:a.delete(d)}return b}w.cleanup=function(){if(!this.fastupdate)return this;T(this.map);this.depth&&T(this.G);return this};
function T(a,b){let c=0;if(a.constructor===Array)for(let e=0,d,f;e<a.length;e++){if((d=a[e])&&d.length)if(f=d.indexOf(b),0<=f){1<d.length?(d.splice(f,1),c++):delete a[e];break}else c++}else for(let e of a){const d=e[0],f=T(e[1],b);f?c+=f:a.delete(d)}return c};function M(a,b){if(!(this instanceof M))return new M(a);if(a){var c=A(a)?a:a.preset;c&&(a=Object.assign({},na[c],a))}else a={};c=a.context||{};const e=a.encode||a.encoder||ma;this.encoder=e.encode?e:"object"===typeof e?new G(e):{encode:e};let d;this.resolution=a.resolution||9;this.tokenize=d=a.tokenize||"strict";this.depth="strict"===d&&c.depth||0;this.bidirectional=!1!==c.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;this.map=(d=!1,new Map);this.J=d?new H(d):new Map;this.h= w.export=function(a,b,c,d,e,f){let g=!0;"undefined"===typeof f&&(g=new Promise(n=>{f=n}));let h,k;switch(e||(e=0)){case 0:h="reg";if(this.fastupdate){k=y();for(let n of this.h.keys())k[n]=1}else k=this.h;break;case 1:h="cfg";k={doc:0,opt:this.K?1:0};break;case 2:h="map";k=this.map;break;case 3:h="ctx";k=this.G;break;default:"undefined"===typeof c&&f&&f();return}fa(a,b||this,c,h,d,e,k,f);return g};
b||(this.fastupdate?d?new H(d):new Map:d?new I(d):new Set);this.W=c.resolution||1;this.rtl=e.rtl||a.rtl||!1}u=M.prototype;u.clear=function(){this.map.clear();this.J.clear();this.h.clear();return this};u.append=function(a,b){return this.add(a,b,!0)};u.contain=function(a){return this.h.has(a)};u.update=function(a,b){if(this.async){const c=this,e=this.remove(a);return e.then?e.then(()=>c.add(a,b)):this.add(a,b)}return this.remove(a).add(a,b)}; w.import=function(a,b){if(b)switch(A(b)&&(b=JSON.parse(b)),a){case "cfg":this.K=!!b.opt;break;case "reg":this.fastupdate=!1;this.h=b;break;case "map":this.map=b;break;case "ctx":this.G=b}};ja(L.prototype);U.prototype.add=function(a,b,c){E(a)&&(b=a,a=F(b,this.key));if(b&&(a||0===a)){if(!c&&this.h.has(a))return this.update(a,b);for(let e=0,f;e<this.field.length;e++){f=this.I[e];const g=this.index.get(this.field[e]);if("function"===typeof f){var d=f(b);d&&g.add(a,d,!1,!0)}else if(d=f.T,!d||d(b))f instanceof String?f=[""+f]:A(f)&&(f=[f]),V(b,f,this.N,0,g,a,f[0],c)}if(this.store&&(!c||!this.store.has(a))){let e;if(this.C){e=y();for(let f=0,g;f<this.C.length;f++){g=this.C[f];if((c=g.T)&&!c(b))continue;let h;
function U(a){let b=0;if(a.constructor===Array)for(let c=0,e;c<a.length;c++)(e=a[c])&&(b+=e.length);else for(const c of a){const e=c[0],d=U(c[1]);d?b+=d:a.delete(e)}return b}u.cleanup=function(){if(!this.fastupdate)return this;U(this.map);this.depth&&U(this.J);return this}; if("function"===typeof g){h=g(b);if(!h)continue;g=[g.X]}else if(A(g)||g instanceof String){e[g]=b[g];continue}W(b,e,g,0,g[0],h)}}this.store.set(a,e||b)}}return this};function W(a,b,c,d,e,f){a=a[e];if(d===c.length-1)b[e]=f||a;else if(a)if(a.constructor===Array)for(b=b[e]=Array(a.length),e=0;e<a.length;e++)W(a,b,c,d,e);else b=b[e]||(b[e]=y()),e=c[++d],W(a,b,c,d,e)}
u.export=function(a,b,c,e,d,f){let g=!0;"undefined"===typeof f&&(g=new Promise(n=>{f=n}));let h,k;switch(d||(d=0)){case 0:h="reg";if(this.fastupdate){k=y();for(let n of this.h.keys())k[n]=1}else k=this.h;break;case 1:h="cfg";k={doc:0,opt:this.A?1:0};break;case 2:h="map";k=this.map;break;case 3:h="ctx";k=this.J;break;default:"undefined"===typeof c&&f&&f();return}ka(a,b||this,c,h,e,d,k,f);return g}; function V(a,b,c,d,e,f,g,h){if(a=a[g])if(d===b.length-1){if(a.constructor===Array){if(c[d]){for(b=0;b<a.length;b++)e.add(f,a[b],!0,!0);return}a=a.join(" ")}e.add(f,a,h,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)V(a,b,c,d,e,f,g,h);else g=b[++d],V(a,b,c,d,e,f,g,h)};U.prototype.search=function(a,b,c,d){c||(!b&&E(a)?(c=a,a=""):E(b)&&(c=b,b=0));let e=[];var f=[];let g,h,k,n,l;let r=0;if(c)if(c.constructor===Array)n=c,c=null;else{a=c.query||a;var t=c.pluck;h=c.merge;n=t||c.field||c.index;l=!1;g=this.store&&c.enrich;k=c.suggest;b=c.limit||b;var p=c.offset||0;b||(b=100);if(l){l.constructor!==Array&&(l=[l]);var m=[];for(let v=0,q;v<l.length;v++)if(q=l[v],q.field&&q.tag){var u=q.tag;if(u.constructor===Array)for(var B=0;B<u.length;B++)m.push(q.field,u[B]);else m.push(q.field,
u.import=function(a,b){if(b)switch(A(b)&&(b=JSON.parse(b)),a){case "cfg":this.A=!!b.opt;break;case "reg":this.fastupdate=!1;this.h=b;break;case "map":this.map=b;break;case "ctx":this.J=b}};oa(M.prototype);V.prototype.add=function(a,b,c){B(a)&&(b=a,a=ba(b,this.key));if(b&&(a||0===a)){if(!c&&this.h.has(a))return this.update(a,b);for(let d=0,f;d<this.field.length;d++){f=this.L[d];const g=this.index.get(this.field[d]);if("function"===typeof f){var e=f(b);e&&g.add(a,e,!1,!0)}else if(e=f.T,!e||e(b))f instanceof String?f=[""+f]:A(f)&&(f=[f]),W(b,f,this.O,0,g,a,f[0],c)}if(this.store&&(!c||!this.store.has(a))){let d;if(this.G){d=y();for(let f=0,g;f<this.G.length;f++){g=this.G[f];if((c=g.T)&&!c(b))continue; u)}else{u=Object.keys(q);for(let C=0,D,z;C<u.length;C++)if(D=u[C],z=q[D],z.constructor===Array)for(B=0;B<z.length;B++)m.push(D,z[B]);else m.push(D,z)}l=m;if(!a){d=[];if(m.length)for(f=0;f<m.length;f+=2)t=na.call(this,m[f],m[f+1],b,p,g),e.push({field:m[f],tag:m[f+1],result:t});return d.length?Promise.all(d).then(function(v){for(let q=0;q<v.length;q++)e[q].result=v[q];return e}):e}}A(n)&&(n=[n])}n||(n=this.field);p=!d&&(this.worker||this.async)&&[];for(let v=0,q,C,D;v<n.length;v++){C=n[v];let z;A(C)||
let h;if("function"===typeof g){h=g(b);if(!h)continue;g=[g.X]}else if(A(g)||g instanceof String){d[g]=b[g];continue}X(b,d,g,0,g[0],h)}}this.store.set(a,d||b)}}return this};function X(a,b,c,e,d,f){a=a[d];if(e===c.length-1)b[d]=f||a;else if(a)if(a.constructor===Array)for(b=b[d]=Array(a.length),d=0;d<a.length;d++)X(a,b,c,e,d);else b=b[d]||(b[d]=y()),d=c[++e],X(a,b,c,e,d)} (z=C,C=z.field,a=z.query||a,b=z.limit||b,k=z.suggest||k);if(d)q=d[v];else if(m=z||c,u=this.index.get(C),l&&(m.enrich=!1),p){p[v]=u.searchAsync(a,b,m);m&&g&&(m.enrich=g);continue}else q=u.search(a,b,m),m&&g&&(m.enrich=g);D=q&&q.length;if(l&&D){m=[];u=0;for(let P=0,I,sa;P<l.length;P+=2){I=this.tag.get(l[P]);if(!I)if(k)continue;else return e;if(sa=(I=I&&I.get(l[P+1]))&&I.length)u++,m.push(I);else if(!k)return e}if(u){q=la(q,m);D=q.length;if(!D&&!k)return e;u--}}if(D)f[r]=C,e.push(q),r++;else if(1===
function W(a,b,c,e,d,f,g,h){if(a=a[g])if(e===b.length-1){if(a.constructor===Array){if(c[e]){for(b=0;b<a.length;b++)d.add(f,a[b],!0,!0);return}a=a.join(" ")}d.add(f,a,h,!0)}else if(a.constructor===Array)for(g=0;g<a.length;g++)W(a,b,c,e,d,f,g,h);else g=b[++e],W(a,b,c,e,d,f,g,h)};V.prototype.search=function(a,b,c,e){c||(!b&&B(a)?(c=a,a=""):B(b)&&(c=b,b=0));let d=[];var f=[];let g,h,k,n,l;let r=0;if(c)if(c.constructor===Array)n=c,c=null;else{a=c.query||a;var t=c.pluck;h=c.merge;n=t||c.field||c.index;l=!1;g=this.store&&c.enrich;k=c.suggest;b=c.limit||b;var p=c.offset||0;b||(b=100);if(l){l.constructor!==Array&&(l=[l]);var m=[];for(let w=0,q;w<l.length;w++)if(q=l[w],q.field&&q.tag){var v=q.tag;if(v.constructor===Array)for(var C=0;C<v.length;C++)m.push(q.field,v[C]);else m.push(q.field, n.length)return e}if(p){const v=this;return Promise.all(p).then(function(q){return q.length?v.search(a,b,c,q):q})}if(!r)return e;if(t&&(!g||!this.store))return e[0];p=[];for(let v=0,q;v<f.length;v++){q=e[v];g&&q.length&&!q[0].doc&&q.length&&(q=oa.call(this,q));if(t)return q;e[v]={field:f[v],result:q}}return h?pa(e,b):e};
v)}else{v=Object.keys(q);for(let D=0,E,z;D<v.length;D++)if(E=v[D],z=q[E],z.constructor===Array)for(C=0;C<z.length;C++)m.push(E,z[C]);else m.push(E,z)}l=m;if(!a){e=[];if(m.length)for(f=0;f<m.length;f+=2)t=sa.call(this,m[f],m[f+1],b,p,g),d.push({field:m[f],tag:m[f+1],result:t});return e.length?Promise.all(e).then(function(w){for(let q=0;q<w.length;q++)d[q].result=w[q];return d}):d}}A(n)&&(n=[n])}n||(n=this.field);p=!e&&(this.worker||this.async)&&[];for(let w=0,q,D,E;w<n.length;w++){D=n[w];let z;A(D)|| function pa(a,b){const c=[],d=y();for(let e=0,f,g;e<a.length;e++){f=a[e];g=f.result;for(let h=0,k,n,l;h<g.length;h++)if(n=g[h],k=n.id,l=d[k])l.push(f.field);else{if(c.length===b)return c;n.field=d[k]=[f.field];c.push(n)}}return c}function na(a,b,c,d,e){a=this.tag.get(a);if(!a)return[];if((b=(a=a&&a.get(b))&&a.length-d)&&0<b){if(b>c||d)a=a.slice(d,d+c);e&&(a=oa.call(this,a));return a}}
(z=D,D=z.field,a=z.query||a,b=z.limit||b,k=z.suggest||k);if(e)q=e[w];else if(m=z||c,v=this.index.get(D),l&&(m.enrich=!1),p){p[w]=v.searchAsync(a,b,m);m&&g&&(m.enrich=g);continue}else q=v.search(a,b,m),m&&g&&(m.enrich=g);E=q&&q.length;if(l&&E){m=[];v=0;for(let R=0,K,xa;R<l.length;R+=2){K=this.tag.get(l[R]);if(!K)if(k)continue;else return d;if(xa=(K=K&&K.get(l[R+1]))&&K.length)v++,m.push(K);else if(!k)return d}if(v){q=qa(q,m);E=q.length;if(!E&&!k)return d;v--}}if(E)f[r]=D,d.push(q),r++;else if(1=== function oa(a){const b=Array(a.length);for(let c=0,d;c<a.length;c++)d=a[c],b[c]={id:d,doc:this.store.get(d)};return b};function U(a){if(!(this instanceof U))return new U(a);const b=a.document||a.doc||a;var c;this.I=[];this.field=[];this.N=[];this.key=(c=b.key||b.id)&&X(c,this.N)||"id";this.h=(this.fastupdate=!!a.fastupdate)?new Map:new Set;this.C=(c=b.store||null)&&!0!==c&&[];this.store=c&&new Map;this.async=!1;c=new Map;let d=b.index||b.field||b;A(d)&&(d=[d]);for(let e=0,f,g;e<d.length;e++)f=d[e],A(f)||(g=f,f=f.field),g=E(g)?Object.assign({},a,g):a,c.set(f,new L(g,this.h)),g.M?this.I[e]=g.M:(this.I[e]=X(f,this.N),
n.length)return d}if(p){const w=this;return Promise.all(p).then(function(q){return q.length?w.search(a,b,c,q):q})}if(!r)return d;if(t&&(!g||!this.store))return d[0];p=[];for(let w=0,q;w<f.length;w++){q=d[w];g&&q.length&&!q[0].doc&&q.length&&(q=ta.call(this,q));if(t)return q;d[w]={field:f[w],result:q}}return h?ua(d,b):d}; g.filter&&("string"===typeof this.I[e]&&(this.I[e]=new String(this.I[e])),this.I[e].T=g.filter)),this.field[e]=f;if(this.C){a=b.store;A(a)&&(a=[a]);for(let e=0,f,g;e<a.length;e++)f=a[e],g=f.field||f,f.M?(this.C[e]=f.M,f.M.X=g):(this.C[e]=X(g,this.N),f.filter&&("string"===typeof this.C[e]&&(this.C[e]=new String(this.C[e])),this.C[e].T=f.filter))}this.index=c}
function ua(a,b){const c=[],e=y();for(let d=0,f,g;d<a.length;d++){f=a[d];g=f.result;for(let h=0,k,n,l;h<g.length;h++)if(n=g[h],k=n.id,l=e[k])l.push(f.field);else{if(c.length===b)return c;n.field=e[k]=[f.field];c.push(n)}}return c}function sa(a,b,c,e,d){a=this.tag.get(a);if(!a)return[];if((b=(a=a&&a.get(b))&&a.length-e)&&0<b){if(b>c||e)a=a.slice(e,e+c);d&&(a=ta.call(this,a));return a}} function X(a,b){const c=a.split(":");let d=0;for(let e=0;e<c.length;e++)a=c[e],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(b[d]=!0),a&&(c[d++]=a);d<c.length&&(c.length=d);return 1<d?c:c[0]}w=U.prototype;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){E(a)&&(a=F(a,this.key));for(const b of this.index.values())b.remove(a,!0);this.h.has(a)&&(this.store&&this.store.delete(a),this.h.delete(a));return this};
function ta(a){const b=Array(a.length);for(let c=0,e;c<a.length;c++)e=a[c],b[c]={id:e,doc:this.store.get(e)};return b};function V(a){if(!(this instanceof V))return new V(a);const b=a.document||a.doc||a;var c;this.L=[];this.field=[];this.O=[];this.key=(c=b.key||b.id)&&Y(c,this.O)||"id";this.h=(this.fastupdate=!!a.fastupdate)?new Map:new Set;this.G=(c=b.store||null)&&!0!==c&&[];this.store=c&&new Map;this.async=!1;c=new Map;let e=b.index||b.field||b;A(e)&&(e=[e]);for(let d=0,f,g;d<e.length;d++)f=e[d],A(f)||(g=f,f=f.field),g=B(g)?Object.assign({},a,g):a,c.set(f,new M(g,this.h)),g.N?this.L[d]=g.N:(this.L[d]=Y(f,this.O), w.clear=function(){for(const a of this.index.values())a.clear();this.store&&this.store.clear();return this};w.contain=function(a){return this.h.has(a)};w.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};w.get=function(a){return this.store.get(a)};w.set=function(a,b){this.store.set(a,b);return this};
g.filter&&("string"===typeof this.L[d]&&(this.L[d]=new String(this.L[d])),this.L[d].T=g.filter)),this.field[d]=f;if(this.G){a=b.store;A(a)&&(a=[a]);for(let d=0,f,g;d<a.length;d++)f=a[d],g=f.field||f,f.N?(this.G[d]=f.N,f.N.X=g):(this.G[d]=Y(g,this.O),f.filter&&("string"===typeof this.G[d]&&(this.G[d]=new String(this.G[d])),this.G[d].T=f.filter))}this.index=c} w.export=function(a,b,c,d,e,f){let g;"undefined"===typeof f&&(g=new Promise(k=>{f=k}));e||(e=0);d||(d=0);if(d<this.field.length){c=this.field[d];var h=this.index[c];b=this;h.export(a,b,e?c:"",d,e++,f)||(d++,b.export(a,b,c,d,1,f))}else{switch(e){case 1:b="tag";h=this.J;c=null;break;case 2:b="store";h=this.store;c=null;break;default:f();return}fa(a,this,c,b,d,e,h,f)}return g};
function Y(a,b){const c=a.split(":");let e=0;for(let d=0;d<c.length;d++)a=c[d],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2))&&(b[e]=!0),a&&(c[e++]=a);e<c.length&&(c.length=e);return 1<e?c:c[0]}u=V.prototype;u.append=function(a,b){return this.add(a,b,!0)};u.update=function(a,b){return this.remove(a).add(a,b)};u.remove=function(a){B(a)&&(a=ba(a,this.key));for(const b of this.index.values())b.remove(a,!0);this.h.has(a)&&(this.store&&this.store.delete(a),this.h.delete(a));return this}; w.import=function(a,b){if(b)switch(A(b)&&(b=JSON.parse(b)),a){case "tag":this.J=b;break;case "reg":this.fastupdate=!1;this.h=b;for(let d=0,e;d<this.field.length;d++)e=this.index[this.field[d]],e.h=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)}};ja(U.prototype);const Y=y();const Z=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 qa={normalize:!0,A:!0,B:Z};const ra=new Map([["ai","ei"],["ae","a"],["oe","o"],["ue","u"],["sh","s"],["ch","c"],["th","t"],["ph","f"],["pf","f"]]),ta=[/([^aeo])h([aeo$])/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2"];var ua={normalize:!0,A:!0,B:Z,F:ta,D:ra};var va={normalize:!0,A:!0,B:Z,F:ta.concat([/(?!^)[aeoy]/g,""]),D:ra};const wa={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};Y["latin:exact"]={normalize:!1,A:!1};Y["latin:default"]=ha;Y["latin:simple"]={normalize:!0,A:!0};Y["latin:balance"]=qa;Y["latin:advanced"]=ua;Y["latin:extra"]=va;Y["latin:soundex"]={normalize:!0,A:!1,U:{Y:!0},L:function(a){for(let c=0;c<a.length;c++){var b=a[c];let d=b.charAt(0),e=wa[d];for(let f=1,g;f<b.length&&(g=b.charAt(f),"h"===g||"w"===g||!(g=wa[g])||g===e||(d+=g,e=g,4!==d.length));f++);a[c]=d}}};export default {Index:L,Charset:Y,Encoder:J,Document:U,Worker:null,Resolver:null,IndexedDB:null};
u.clear=function(){for(const a of this.index.values())a.clear();this.store&&this.store.clear();return this};u.contain=function(a){return this.h.has(a)};u.cleanup=function(){for(const a of this.index.values())a.cleanup();return this};u.get=function(a){return this.store.get(a)};u.set=function(a,b){this.store.set(a,b);return this}; export const Index=L;export const Charset=Y;export const Encoder=J;export const Document=U;export const Worker=null;export const Resolver=null;export const IndexedDB=null;
u.export=function(a,b,c,e,d,f){let g;"undefined"===typeof f&&(g=new Promise(k=>{f=k}));d||(d=0);e||(e=0);if(e<this.field.length){c=this.field[e];var h=this.index[c];b=this;h.export(a,b,d?c:"",e,d++,f)||(e++,b.export(a,b,c,e,1,f))}else{switch(d){case 1:b="tag";h=this.B;c=null;break;case 2:b="store";h=this.store;c=null;break;default:f();return}ka(a,this,c,b,e,d,h,f)}return g};
u.import=function(a,b){if(b)switch(A(b)&&(b=JSON.parse(b)),a){case "tag":this.B=b;break;case "reg":this.fastupdate=!1;this.h=b;for(let e=0,d;e<this.field.length;e++)d=this.index[this.field[e]],d.h=b,d.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)}};oa(V.prototype);const Z=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 va={normalize:!0,C:!0,D:Z};const wa=new Map([["ai","ei"],["ae","a"],["oe","o"],["ue","u"],["sh","s"],["ch","c"],["th","t"],["ph","f"],["pf","f"]]),ya=[/([^aeo])h([aeo$])/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2"];var za={normalize:!0,C:!0,D:Z,I:ya,H:wa};var Aa={normalize:!0,C:!0,D:Z,I:ya.concat([/(?!^)[aeoy]/g,""]),H:wa};const Ba={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};J["latin:exact"]={normalize:!1,C:!1};J["latin:default"]=ma;J["latin:simple"]={normalize:!0,C:!0};J["latin:balance"]=va;J["latin:advanced"]=za;J["latin:extra"]=Aa;J["latin:soundex"]={normalize:!0,C:!1,U:{Y:!0},M:function(a){for(let c=0;c<a.length;c++){var b=a[c];let e=b.charAt(0),d=Ba[e];for(let f=1,g;f<b.length&&(g=b.charAt(f),"h"===g||"w"===g||!(g=Ba[g])||g===d||(e+=g,d=g,4!==e.length));f++);a[c]=e}}};
export default {Index:M,Encoder:G,Charset:J,Language:la,Document:V,Worker:null,Resolver:null,IndexedDB:null};
export const Index=M;export const Encoder=G;export const Charset=J;export const Language=la;export const Document=V;export const Worker=null;export const Resolver=null;export const IndexedDB=null;

File diff suppressed because it is too large Load Diff

View File

@@ -5,119 +5,118 @@
* Hosted by Nextapps GmbH * Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch * https://github.com/nextapps-de/flexsearch
*/ */
(function(self){'use strict';var w;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}function y(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];if(b)return b.call(a);if("number"==typeof a.length)return{next:aa(a)};throw Error(String(a)+" is not an iterable or ArrayLike");}function ba(a){if(!(a instanceof Array)){a=y(a);for(var b,c=[];!(b=a.next()).done;)c.push(b.value);a=c}return a} (function(self){'use strict';var w;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}function y(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];if(b)return b.call(a);if("number"==typeof a.length)return{next:aa(a)};throw Error(String(a)+" is not an iterable or ArrayLike");}var ba="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};
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 z=da(this); function ca(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");}var z=ca(this);function B(a,b){if(b)a:{var c=z;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];if(!(e in c))break a;c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&ba(c,a,{configurable:!0,writable:!0,value:b})}}var da;
function B(a,b){if(b)a:{var c=z;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 ea;if("function"==typeof Object.setPrototypeOf)ea=Object.setPrototypeOf;else{var fa;a:{var ha={a:!0},ia={};try{ia.__proto__=ha;fa=ia.a;break a}catch(a){}fa=!1}ea=fa?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var ja=ea; if("function"==typeof Object.setPrototypeOf)da=Object.setPrototypeOf;else{var ea;a:{var fa={a:!0},ha={};try{ha.__proto__=fa;ea=ha.a;break a}catch(a){}ea=!1}da=ea?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var ia=da;function ja(){this.D=!1;this.A=null;this.G=void 0;this.h=1;this.R=0;this.C=null}function ka(a){if(a.D)throw new TypeError("Generator is already running");a.D=!0}ja.prototype.J=function(a){this.G=a};
function ka(){this.D=!1;this.A=null;this.G=void 0;this.h=1;this.R=0;this.C=null}function la(a){if(a.D)throw new TypeError("Generator is already running");a.D=!0}ka.prototype.K=function(a){this.G=a};function ma(a,b){a.C={Ca:b,Da:!0};a.h=a.R}ka.prototype.return=function(a){this.C={return:a};this.h=this.R};function F(a,b,c){a.h=c;return{value:b}}function na(a){this.h=new ka;this.A=a} function la(a,b){a.C={Ca:b,Da:!0};a.h=a.R}ja.prototype.return=function(a){this.C={return:a};this.h=this.R};function F(a,b,c){a.h=c;return{value:b}}function ma(a){this.h=new ja;this.A=a}function na(a,b){ka(a.h);var c=a.h.A;if(c)return oa(a,"return"in c?c["return"]:function(d){return{value:d,done:!0}},b,a.h.return);a.h.return(b);return pa(a)}
function oa(a,b){la(a.h);var c=a.h.A;if(c)return pa(a,"return"in c?c["return"]:function(d){return{value:d,done:!0}},b,a.h.return);a.h.return(b);return qa(a)}function pa(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 h=e.value}catch(f){return a.h.A=null,ma(a.h,f),qa(a)}a.h.A=null;d.call(a.h,h);return qa(a)} function oa(a,b,c,d){try{var e=b.call(a.h.A,c);if(!(e instanceof Object))throw new TypeError("Iterator result "+e+" is not an object");if(!e.done)return a.h.D=!1,e;var g=e.value}catch(f){return a.h.A=null,la(a.h,f),pa(a)}a.h.A=null;d.call(a.h,g);return pa(a)}function pa(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.G=void 0,la(a.h,c)}a.h.D=!1;if(a.h.C){b=a.h.C;a.h.C=null;if(b.Da)throw b.Ca;return{value:b.return,done:!0}}return{value:void 0,done:!0}}
function qa(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.G=void 0,ma(a.h,c)}a.h.D=!1;if(a.h.C){b=a.h.C;a.h.C=null;if(b.Da)throw b.Ca;return{value:b.return,done:!0}}return{value:void 0,done:!0}} function qa(a){this.next=function(b){ka(a.h);a.h.A?b=oa(a,a.h.A.next,b,a.h.J):(a.h.J(b),b=pa(a));return b};this.throw=function(b){ka(a.h);a.h.A?b=oa(a,a.h.A["throw"],b,a.h.J):(la(a.h,b),b=pa(a));return b};this.return=function(b){return na(a,b)};this[Symbol.iterator]=function(){return this}}function ra(a,b){b=new qa(new ma(b));ia&&a.prototype&&ia(b,a.prototype);return b}
function ra(a){this.next=function(b){la(a.h);a.h.A?b=pa(a,a.h.A.next,b,a.h.K):(a.h.K(b),b=qa(a));return b};this.throw=function(b){la(a.h);a.h.A?b=pa(a,a.h.A["throw"],b,a.h.K):(ma(a.h,b),b=qa(a));return b};this.return=function(b){return oa(a,b)};this[Symbol.iterator]=function(){return this}}function sa(a,b){b=new ra(new na(b));ja&&a.prototype&&ja(b,a.prototype);return b} function sa(a){function b(d){return a.next(d)}function c(d){return a.throw(d)}return new Promise(function(d,e){function g(f){f.done?d(f.value):Promise.resolve(f.value).then(b,c).then(g,e)}g(a.next())})}function ta(a){return sa(new qa(new ma(a)))}
function ta(a){function b(d){return a.next(d)}function c(d){return a.throw(d)}return new Promise(function(d,e){function h(f){f.done?d(f.value):Promise.resolve(f.value).then(b,c).then(h,e)}h(a.next())})}function ua(a){return ta(new ra(new na(a)))} B("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;ba(this,"description",{configurable:!0,writable:!0,value:f})}if(a)return a;c.prototype.toString=function(){return this.h};var d="jscomp_symbol_"+(1E9*Math.random()>>>0)+"_",e=0;return b});
B("Symbol",function(a){function b(h){if(this instanceof b)throw new TypeError("Symbol is not a constructor");return new c(d+(h||"")+"_"+e++,h)}function c(h,f){this.h=h;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}); 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.length;c++){var d=z[b[c]];"function"===typeof d&&"function"!=typeof d.prototype[a]&&ba(d.prototype,a,{configurable:!0,writable:!0,value:function(){return ua(aa(this))}})}return a});function ua(a){a={next:a};a[Symbol.iterator]=function(){return this};return a}
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.length;c++){var d=z[b[c]];"function"===typeof d&&"function"!=typeof d.prototype[a]&&ca(d.prototype,a,{configurable:!0,writable:!0,value:function(){return va(aa(this))}})}return a});function va(a){a={next:a};a[Symbol.iterator]=function(){return this};return a} B("Promise",function(a){function b(f){this.A=0;this.C=void 0;this.h=[];this.R=!1;var h=this.D();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.C(function(){h.G()})}this.h.push(f)};var e=z.setTimeout;c.prototype.C=function(f){e(f,0)};c.prototype.G=function(){for(;this.h&&this.h.length;){var f=this.h;this.h=[];for(var h=0;h<f.length;++h){var k=
B("Promise",function(a){function b(f){this.A=0;this.C=void 0;this.h=[];this.R=!1;var g=this.D();try{f(g.resolve,g.reject)}catch(k){g.reject(k)}}function c(){this.h=null}function d(f){return f instanceof b?f:new b(function(g){g(f)})}if(a)return a;c.prototype.A=function(f){if(null==this.h){this.h=[];var g=this;this.C(function(){g.G()})}this.h.push(f)};var e=z.setTimeout;c.prototype.C=function(f){e(f,0)};c.prototype.G=function(){for(;this.h&&this.h.length;){var f=this.h;this.h=[];for(var g=0;g<f.length;++g){var k= f[h];f[h]=null;try{k()}catch(l){this.D(l)}}}this.h=null};c.prototype.D=function(f){this.C(function(){throw f;})};b.prototype.D=function(){function f(l){return function(m){k||(k=!0,l.call(h,m))}}var h=this,k=!1;return{resolve:f(this.wa),reject:f(this.G)}};b.prototype.wa=function(f){if(f===this)this.G(new TypeError("A Promise cannot resolve to itself"));else if(f instanceof b)this.ya(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.va(f):
f[g];f[g]=null;try{k()}catch(l){this.D(l)}}}this.h=null};c.prototype.D=function(f){this.C(function(){throw f;})};b.prototype.D=function(){function f(l){return function(m){k||(k=!0,l.call(g,m))}}var g=this,k=!1;return{resolve:f(this.wa),reject:f(this.G)}};b.prototype.wa=function(f){if(f===this)this.G(new TypeError("A Promise cannot resolve to itself"));else if(f instanceof b)this.ya(f);else{a:switch(typeof f){case "object":var g=null!=f;break a;case "function":g=!0;break a;default:g=!1}g?this.va(f): this.J(f)}};b.prototype.va=function(f){var h=void 0;try{h=f.then}catch(k){this.G(k);return}"function"==typeof h?this.za(h,f):this.J(f)};b.prototype.G=function(f){this.pa(2,f)};b.prototype.J=function(f){this.pa(1,f)};b.prototype.pa=function(f,h){if(0!=this.A)throw Error("Cannot settle("+f+", "+h+"): Promise already settled in state"+this.A);this.A=f;this.C=h;2===this.A&&this.xa();this.ta()};b.prototype.xa=function(){var f=this;e(function(){if(f.ua()){var h=z.console;"undefined"!==typeof h&&h.error(f.C)}},
this.K(f)}};b.prototype.va=function(f){var g=void 0;try{g=f.then}catch(k){this.G(k);return}"function"==typeof g?this.za(g,f):this.K(f)};b.prototype.G=function(f){this.pa(2,f)};b.prototype.K=function(f){this.pa(1,f)};b.prototype.pa=function(f,g){if(0!=this.A)throw Error("Cannot settle("+f+", "+g+"): Promise already settled in state"+this.A);this.A=f;this.C=g;2===this.A&&this.xa();this.ta()};b.prototype.xa=function(){var f=this;e(function(){if(f.ua()){var g=z.console;"undefined"!==typeof g&&g.error(f.C)}}, 1)};b.prototype.ua=function(){if(this.R)return!1;var f=z.CustomEvent,h=z.Event,k=z.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=z.document.createEvent("CustomEvent"),f.initCustomEvent("unhandledrejection",!1,!0,f));f.promise=this;f.reason=this.C;return k(f)};b.prototype.ta=function(){if(null!=this.h){for(var f=0;f<this.h.length;++f)g.A(this.h[f]);this.h=null}};
1)};b.prototype.ua=function(){if(this.R)return!1;var f=z.CustomEvent,g=z.Event,k=z.dispatchEvent;if("undefined"===typeof k)return!0;"function"===typeof f?f=new f("unhandledrejection",{cancelable:!0}):"function"===typeof g?f=new g("unhandledrejection",{cancelable:!0}):(f=z.document.createEvent("CustomEvent"),f.initCustomEvent("unhandledrejection",!1,!0,f));f.promise=this;f.reason=this.C;return k(f)};b.prototype.ta=function(){if(null!=this.h){for(var f=0;f<this.h.length;++f)h.A(this.h[f]);this.h=null}}; var g=new c;b.prototype.ya=function(f){var h=this.D();f.fa(h.resolve,h.reject)};b.prototype.za=function(f,h){var k=this.D();try{f.call(h,k.resolve,k.reject)}catch(l){k.reject(l)}};b.prototype.then=function(f,h){function k(p,q){return"function"==typeof p?function(r){try{l(p(r))}catch(x){m(x)}}:q}var l,m,n=new b(function(p,q){l=p;m=q});this.fa(k(f,l),k(h,m));return n};b.prototype.catch=function(f){return this.then(void 0,f)};b.prototype.fa=function(f,h){function k(){switch(l.A){case 1:f(l.C);break;
var h=new c;b.prototype.ya=function(f){var g=this.D();f.fa(g.resolve,g.reject)};b.prototype.za=function(f,g){var k=this.D();try{f.call(g,k.resolve,k.reject)}catch(l){k.reject(l)}};b.prototype.then=function(f,g){function k(p,q){return"function"==typeof p?function(r){try{l(p(r))}catch(x){m(x)}}:q}var l,m,n=new b(function(p,q){l=p;m=q});this.fa(k(f,l),k(g,m));return n};b.prototype.catch=function(f){return this.then(void 0,f)};b.prototype.fa=function(f,g){function k(){switch(l.A){case 1:f(l.C);break; case 2:h(l.C);break;default:throw Error("Unexpected state: "+l.A);}}var l=this;null==this.h?g.A(k):this.h.push(k);this.R=!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=y(f),m=l.next();!m.done;m=l.next())d(m.value).fa(h,k)})};b.all=function(f){var h=y(f),k=h.next();return k.done?d([]):new b(function(l,m){function n(r){return function(x){p[r]=x;q--;0==q&&l(p)}}var p=[],q=0;do p.push(void 0),q++,d(k.value).fa(n(p.length-
case 2:g(l.C);break;default:throw Error("Unexpected state: "+l.A);}}var l=this;null==this.h?h.A(k):this.h.push(k);this.R=!0};b.resolve=d;b.reject=function(f){return new b(function(g,k){k(f)})};b.race=function(f){return new b(function(g,k){for(var l=y(f),m=l.next();!m.done;m=l.next())d(m.value).fa(g,k)})};b.all=function(f){var g=y(f),k=g.next();return k.done?d([]):new b(function(l,m){function n(r){return function(x){p[r]=x;q--;0==q&&l(p)}}var p=[],q=0;do p.push(void 0),q++,d(k.value).fa(n(p.length- 1),m),k=h.next();while(!k.done)})};return b});function va(a,b){a instanceof String&&(a+="");var c=0,d=!1,e={next:function(){if(!d&&c<a.length){var 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}B("Array.prototype.values",function(a){return a?a:function(){return va(this,function(b,c){return c})}});function G(a,b){return Object.prototype.hasOwnProperty.call(a,b)}
1),m),k=g.next();while(!k.done)})};return b});function wa(a,b){a instanceof String&&(a+="");var c=0,d=!1,e={next:function(){if(!d&&c<a.length){var h=c++;return{value:b(h,a[h]),done:!1}}d=!0;return{done:!0,value:void 0}}};e[Symbol.iterator]=function(){return e};return e}B("Array.prototype.values",function(a){return a?a:function(){return wa(this,function(b,c){return c})}});function G(a,b){return Object.prototype.hasOwnProperty.call(a,b)} B("WeakMap",function(a){function b(k){this.h=(h+=Math.random()+1).toString();if(k){k=y(k);for(var l;!(l=k.next()).done;)l=l.value,this.set(l[0],l[1])}}function c(){}function d(k){var l=typeof k;return"object"===l&&null!==k||"function"===l}function e(k){if(!G(k,f)){var l=new c;ba(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({}),
B("WeakMap",function(a){function b(k){this.h=(g+=Math.random()+1).toString();if(k){k=y(k);for(var l;!(l=k.next()).done;)l=l.value,this.set(l[0],l[1])}}function c(){}function d(k){var l=typeof k;return"object"===l&&null!==k||"function"===l}function e(k){if(!G(k,f)){var l=new c;ca(k,f,{value:l})}}function h(k){var l=Object[k];l&&(Object[k]=function(m){if(m instanceof c)return m;Object.isExtensible(m)&&e(m);return l(m)})}if(function(){if(!a||!Object.seal)return!1;try{var k=Object.seal({}),l=Object.seal({}), m=new a([[k,2],[l,3]]);if(2!=m.get(k)||3!=m.get(l))return!1;m.delete(k);m.set(l,4);return!m.has(k)&&4==m.get(l)}catch(n){return!1}}())return a;var f="$jscomp_hidden_"+Math.random();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(!G(k,f))throw Error("WeakMap key fail: "+k);k[f][this.h]=l;return this};b.prototype.get=function(k){return d(k)&&G(k,f)?k[f][this.h]:void 0};b.prototype.has=function(k){return d(k)&&G(k,
m=new a([[k,2],[l,3]]);if(2!=m.get(k)||3!=m.get(l))return!1;m.delete(k);m.set(l,4);return!m.has(k)&&4==m.get(l)}catch(n){return!1}}())return a;var f="$jscomp_hidden_"+Math.random();h("freeze");h("preventExtensions");h("seal");var g=0;b.prototype.set=function(k,l){if(!d(k))throw Error("Invalid WeakMap key");e(k);if(!G(k,f))throw Error("WeakMap key fail: "+k);k[f][this.h]=l;return this};b.prototype.get=function(k){return d(k)&&G(k,f)?k[f][this.h]:void 0};b.prototype.has=function(k){return d(k)&&G(k,
f)&&G(k[f],this.h)};b.prototype.delete=function(k){return d(k)&&G(k,f)&&G(k[f],this.h)?delete k[f][this.h]:!1};return b}); f)&&G(k[f],this.h)};b.prototype.delete=function(k){return d(k)&&G(k,f)&&G(k[f],this.h)?delete k[f][this.h]:!1};return b});
B("Map",function(a){function b(){var g={};return g.O=g.next=g.head=g}function c(g,k){var l=g[1];return va(function(){if(l){for(;l.head!=g[1];)l=l.O;for(;l.next!=l.head;)return l=l.next,{done:!1,value:k(l)};l=null}return{done:!0,value:void 0}})}function d(g,k){var l=k&&typeof k;"object"==l||"function"==l?h.has(k)?l=h.get(k):(l=""+ ++f,h.set(k,l)):l="p_"+k;var m=g[0][l];if(m&&G(g[0],l))for(g=0;g<m.length;g++){var n=m[g];if(k!==k&&n.key!==n.key||k===n.key)return{id:l,list:m,index:g,F:n}}return{id:l, B("Map",function(a){function b(){var h={};return h.O=h.next=h.head=h}function c(h,k){var l=h[1];return ua(function(){if(l){for(;l.head!=h[1];)l=l.O;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&&G(h[0],l))for(h=0;h<m.length;h++){var n=m[h];if(k!==k&&n.key!==n.key||k===n.key)return{id:l,list:m,index:h,F:n}}return{id:l,
list:m,index:-1,F:void 0}}function e(g){this[0]={};this[1]=b();this.size=0;if(g){g=y(g);for(var k;!(k=g.next()).done;)k=k.value,this.set(k[0],k[1])}}if(function(){if(!a||"function"!=typeof a||!a.prototype.entries||"function"!=typeof Object.seal)return!1;try{var g=Object.seal({x:4}),k=new a(y([[g,"s"]]));if("s"!=k.get(g)||1!=k.size||k.get({x:4})||k.set({x:4},"t")!=k||2!=k.size)return!1;var l=k.entries(),m=l.next();if(m.done||m.value[0]!=g||"s"!=m.value[1])return!1;m=l.next();return m.done||4!=m.value[0].x|| list:m,index:-1,F:void 0}}function e(h){this[0]={};this[1]=b();this.size=0;if(h){h=y(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(y([[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(n){return!1}}())return a;var h=new WeakMap;e.prototype.set=function(g,k){g=0===g?0:g;var l=d(this,g);l.list||(l.list=this[0][l.id]=[]);l.F?l.F.value=k:(l.F={next:this[1],O:this[1].O,head:this[1],key:g,value:k},l.list.push(l.F),this[1].O.next=l.F,this[1].O=l.F,this.size++);return this};e.prototype.delete=function(g){g=d(this,g);return g.F&&g.list?(g.list.splice(g.index,1),g.list.length||delete this[0][g.id],g.F.O.next=g.F.next,g.F.next.O=g.F.O,g.F.head=null, "t"!=m.value[1]||!l.next().done?!1:!0}catch(n){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],O:this[1].O,head:this[1],key:h,value:k},l.list.push(l.F),this[1].O.next=l.F,this[1].O=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.O.next=h.F.next,h.F.next.O=h.F.O,h.F.head=null,
this.size--,!0):!1};e.prototype.clear=function(){this[0]={};this[1]=this[1].O=b();this.size=0};e.prototype.has=function(g){return!!d(this,g).F};e.prototype.get=function(g){return(g=d(this,g).F)&&g.value};e.prototype.entries=function(){return c(this,function(g){return[g.key,g.value]})};e.prototype.keys=function(){return c(this,function(g){return g.key})};e.prototype.values=function(){return c(this,function(g){return g.value})};e.prototype.forEach=function(g,k){for(var l=this.entries(),m;!(m=l.next()).done;)m= this.size--,!0):!1};e.prototype.clear=function(){this[0]={};this[1]=this[1].O=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,g.call(k,m[1],m[0],this)};e.prototype[Symbol.iterator]=e.prototype.entries;var f=0;return e});B("Array.prototype.keys",function(a){return a?a:function(){return wa(this,function(b){return b})}}); m.value,h.call(k,m[1],m[0],this)};e.prototype[Symbol.iterator]=e.prototype.entries;var f=0;return e});B("Array.prototype.keys",function(a){return a?a:function(){return va(this,function(b){return b})}});
B("Set",function(a){function b(c){this.h=new Map;if(c){c=y(c);for(var d;!(d=c.next()).done;)this.add(d.value)}this.size=this.h.size}if(function(){if(!a||"function"!=typeof a||!a.prototype.entries||"function"!=typeof Object.seal)return!1;try{var c=Object.seal({x:4}),d=new a(y([c]));if(!d.has(c)||1!=d.size||d.add(c)!=d||1!=d.size||d.add({x:4})!=d||2!=d.size)return!1;var e=d.entries(),h=e.next();if(h.done||h.value[0]!=c||h.value[1]!=c)return!1;h=e.next();return h.done||h.value[0]==c||4!=h.value[0].x|| B("Set",function(a){function b(c){this.h=new Map;if(c){c=y(c);for(var d;!(d=c.next()).done;)this.add(d.value)}this.size=this.h.size}if(function(){if(!a||"function"!=typeof a||!a.prototype.entries||"function"!=typeof Object.seal)return!1;try{var c=Object.seal({x:4}),d=new a(y([c]));if(!d.has(c)||1!=d.size||d.add(c)!=d||1!=d.size||d.add({x:4})!=d||2!=d.size)return!1;var e=d.entries(),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||
h.value[1]!=h.value[0]?!1:e.next().done}catch(f){return!1}}())return a;b.prototype.add=function(c){c=0===c?0:c;this.h.set(c,c);this.size=this.h.size;return this};b.prototype.delete=function(c){c=this.h.delete(c);this.size=this.h.size;return c};b.prototype.clear=function(){this.h.clear();this.size=0};b.prototype.has=function(c){return this.h.has(c)};b.prototype.entries=function(){return this.h.entries()};b.prototype.values=function(){return this.h.values()};b.prototype.keys=b.prototype.values;b.prototype[Symbol.iterator]= 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(h){return c.call(d,h,h,e)})};return b});B("Object.is",function(a){return a?a:function(b,c){return b===c?0!==b||1/b===1/c:b!==b&&c!==c}});B("Array.prototype.includes",function(a){return a?a:function(b,c){var d=this;d instanceof String&&(d=String(d));var e=d.length;c=c||0;for(0>c&&(c=Math.max(c+e,0));c<e;c++){var h=d[c];if(h===b||Object.is(h,b))return!0}return!1}}); 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});B("Object.is",function(a){return a?a:function(b,c){return b===c?0!==b||1/b===1/c:b!==b&&c!==c}});B("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}});
B("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)}});B("Array.prototype.entries",function(a){return a?a:function(){return wa(this,function(b,c){return[b,c]})}}); B("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)}});B("Array.prototype.entries",function(a){return a?a:function(){return va(this,function(b,c){return[b,c]})}});
var xa="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)G(d,e)&&(a[e]=d[e])}return a};B("Object.assign",function(a){return a||xa});B("Array.prototype.flat",function(a){return a?a:function(b){b=void 0===b?1:b;var c=[];Array.prototype.forEach.call(this,function(d){Array.isArray(d)&&0<b?(d=Array.prototype.flat.call(d,b-1),c.push.apply(c,d)):c.push(d)});return c}});function H(a,b,c){var d=typeof c,e=typeof a;if("undefined"!==d){if("undefined"!==e){if(c){if("function"===e&&d===e)return function(h){return a(c(h))};b=a.constructor;if(b===c.constructor){if(b===Array)return c.concat(a);if(b===Map){b=new Map(c);d=y(a);for(e=d.next();!e.done;e=d.next())e=e.value,b.set(e[0],e[1]);return b}if(b===Set){b=new Set(c);d=y(a.values());for(e=d.next();!e.done;e=d.next())b.add(e.value);return b}}}return a}return c}return"undefined"===e?b:a} var wa="function"==typeof Object.assign?Object.assign:function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(d)for(var e in d)G(d,e)&&(a[e]=d[e])}return a};B("Object.assign",function(a){return a||wa});B("Array.prototype.flat",function(a){return a?a:function(b){b=void 0===b?1:b;var c=[];Array.prototype.forEach.call(this,function(d){Array.isArray(d)&&0<b?(d=Array.prototype.flat.call(d,b-1),c.push.apply(c,d)):c.push(d)});return c}});function H(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=y(a);for(e=d.next();!e.done;e=d.next())e=e.value,b.set(e[0],e[1]);return b}if(b===Set){b=new Set(c);d=y(a.values());for(e=d.next();!e.done;e=d.next())b.add(e.value);return b}}}return a}return c}return"undefined"===e?b:a}
function I(){return Object.create(null)}function ya(a,b){return b.length-a.length}function J(a){return"string"===typeof a}function K(a){return"object"===typeof a}function za(a){var b=[];a=y(a.keys());for(var c=a.next();!c.done;c=a.next())b.push(c.value);return b}function Aa(a,b){if(J(b))a=a[b];else for(var c=0;a&&c<b.length;c++)a=a[b[c]];return a}function Ba(a){for(var b=0,c=0,d=void 0;c<a.length;c++)(d=a[c])&&b<d.length&&(b=d.length);return b};var Ca=/[^\p{L}\p{N}]+/u,Da=/(\d{3})/g,Ea=/(\D)(\d{3})/g,Fa=/(\d{3})(\D)/g,Ga="".normalize&&/[\u0300-\u036f]/g,Ha=!Ga&&new Map([["\u00aa","a"],["\u00b2","2"],["\u00b3","3"],["\u00b9","1"],["\u00ba","o"],["\u00bc","1\u20444"],["\u00bd","1\u20442"],["\u00be","3\u20444"],["\u00e0","a"],["\u00e1","a"],["\u00e2","a"],["\u00e3","a"],["\u00e4","a"],["\u00e5","a"],["\u00e7","c"],["\u00e8","e"],["\u00e9","e"],["\u00ea","e"],["\u00eb","e"],["\u00ec","i"],["\u00ed","i"],["\u00ee","i"],["\u00ef","i"],["\u00f1", function I(){return Object.create(null)}function xa(a,b){return b.length-a.length}function J(a){return"string"===typeof a}function K(a){return"object"===typeof a}function ya(a){var b=[];a=y(a.keys());for(var c=a.next();!c.done;c=a.next())b.push(c.value);return b}function za(a,b){if(J(b))a=a[b];else for(var c=0;a&&c<b.length;c++)a=a[b[c]];return a}function Aa(a){for(var b=0,c=0,d=void 0;c<a.length;c++)(d=a[c])&&b<d.length&&(b=d.length);return b};var Ba=/[^\p{L}\p{N}]+/u,Ca=/(\d{3})/g,Da=/(\D)(\d{3})/g,Ea=/(\d{3})(\D)/g,Fa="".normalize&&/[\u0300-\u036f]/g,Ga=!Fa&&[["\u00aa","a"],["\u00b2","2"],["\u00b3","3"],["\u00b9","1"],["\u00ba","o"],["\u00bc","1\u20444"],["\u00bd","1\u20442"],["\u00be","3\u20444"],["\u00e0","a"],["\u00e1","a"],["\u00e2","a"],["\u00e3","a"],["\u00e4","a"],["\u00e5","a"],["\u00e7","c"],["\u00e8","e"],["\u00e9","e"],["\u00ea","e"],["\u00eb","e"],["\u00ec","i"],["\u00ed","i"],["\u00ee","i"],["\u00ef","i"],["\u00f1","n"],
"n"],["\u00f2","o"],["\u00f3","o"],["\u00f4","o"],["\u00f5","o"],["\u00f6","o"],["\u00f9","u"],["\u00fa","u"],["\u00fb","u"],["\u00fc","u"],["\u00fd","y"],["\u00ff","y"],["\u0101","a"],["\u0103","a"],["\u0105","a"],["\u0107","c"],["\u0109","c"],["\u010b","c"],["\u010d","c"],["\u010f","d"],["\u0113","e"],["\u0115","e"],["\u0117","e"],["\u0119","e"],["\u011b","e"],["\u011d","g"],["\u011f","g"],["\u0121","g"],["\u0123","g"],["\u0125","h"],["\u0129","i"],["\u012b","i"],["\u012d","i"],["\u012f","i"],["\u0133", ["\u00f2","o"],["\u00f3","o"],["\u00f4","o"],["\u00f5","o"],["\u00f6","o"],["\u00f9","u"],["\u00fa","u"],["\u00fb","u"],["\u00fc","u"],["\u00fd","y"],["\u00ff","y"],["\u0101","a"],["\u0103","a"],["\u0105","a"],["\u0107","c"],["\u0109","c"],["\u010b","c"],["\u010d","c"],["\u010f","d"],["\u0113","e"],["\u0115","e"],["\u0117","e"],["\u0119","e"],["\u011b","e"],["\u011d","g"],["\u011f","g"],["\u0121","g"],["\u0123","g"],["\u0125","h"],["\u0129","i"],["\u012b","i"],["\u012d","i"],["\u012f","i"],["\u0133",
"ij"],["\u0135","j"],["\u0137","k"],["\u013a","l"],["\u013c","l"],["\u013e","l"],["\u0140","l"],["\u0144","n"],["\u0146","n"],["\u0148","n"],["\u0149","n"],["\u014d","o"],["\u014f","o"],["\u0151","o"],["\u0155","r"],["\u0157","r"],["\u0159","r"],["\u015b","s"],["\u015d","s"],["\u015f","s"],["\u0161","s"],["\u0163","t"],["\u0165","t"],["\u0169","u"],["\u016b","u"],["\u016d","u"],["\u016f","u"],["\u0171","u"],["\u0173","u"],["\u0175","w"],["\u0177","y"],["\u017a","z"],["\u017c","z"],["\u017e","z"], "ij"],["\u0135","j"],["\u0137","k"],["\u013a","l"],["\u013c","l"],["\u013e","l"],["\u0140","l"],["\u0144","n"],["\u0146","n"],["\u0148","n"],["\u0149","n"],["\u014d","o"],["\u014f","o"],["\u0151","o"],["\u0155","r"],["\u0157","r"],["\u0159","r"],["\u015b","s"],["\u015d","s"],["\u015f","s"],["\u0161","s"],["\u0163","t"],["\u0165","t"],["\u0169","u"],["\u016b","u"],["\u016d","u"],["\u016f","u"],["\u0171","u"],["\u0173","u"],["\u0175","w"],["\u0177","y"],["\u017a","z"],["\u017c","z"],["\u017e","z"],
["\u017f","s"],["\u01a1","o"],["\u01b0","u"],["\u01c6","dz"],["\u01c9","lj"],["\u01cc","nj"],["\u01ce","a"],["\u01d0","i"],["\u01d2","o"],["\u01d4","u"],["\u01d6","u"],["\u01d8","u"],["\u01da","u"],["\u01dc","u"],["\u01df","a"],["\u01e1","a"],["\u01e3","ae"],["\u00e6","ae"],["\u01fd","ae"],["\u01e7","g"],["\u01e9","k"],["\u01eb","o"],["\u01ed","o"],["\u01ef","\u0292"],["\u01f0","j"],["\u01f3","dz"],["\u01f5","g"],["\u01f9","n"],["\u01fb","a"],["\u01ff","\u00f8"],["\u0201","a"],["\u0203","a"],["\u0205", ["\u017f","s"],["\u01a1","o"],["\u01b0","u"],["\u01c6","dz"],["\u01c9","lj"],["\u01cc","nj"],["\u01ce","a"],["\u01d0","i"],["\u01d2","o"],["\u01d4","u"],["\u01d6","u"],["\u01d8","u"],["\u01da","u"],["\u01dc","u"],["\u01df","a"],["\u01e1","a"],["\u01e3","ae"],["\u00e6","ae"],["\u01fd","ae"],["\u01e7","g"],["\u01e9","k"],["\u01eb","o"],["\u01ed","o"],["\u01ef","\u0292"],["\u01f0","j"],["\u01f3","dz"],["\u01f5","g"],["\u01f9","n"],["\u01fb","a"],["\u01ff","\u00f8"],["\u0201","a"],["\u0203","a"],["\u0205",
"e"],["\u0207","e"],["\u0209","i"],["\u020b","i"],["\u020d","o"],["\u020f","o"],["\u0211","r"],["\u0213","r"],["\u0215","u"],["\u0217","u"],["\u0219","s"],["\u021b","t"],["\u021f","h"],["\u0227","a"],["\u0229","e"],["\u022b","o"],["\u022d","o"],["\u022f","o"],["\u0231","o"],["\u0233","y"],["\u02b0","h"],["\u02b1","h"],["\u0266","h"],["\u02b2","j"],["\u02b3","r"],["\u02b4","\u0279"],["\u02b5","\u027b"],["\u02b6","\u0281"],["\u02b7","w"],["\u02b8","y"],["\u02e0","\u0263"],["\u02e1","l"],["\u02e2","s"], "e"],["\u0207","e"],["\u0209","i"],["\u020b","i"],["\u020d","o"],["\u020f","o"],["\u0211","r"],["\u0213","r"],["\u0215","u"],["\u0217","u"],["\u0219","s"],["\u021b","t"],["\u021f","h"],["\u0227","a"],["\u0229","e"],["\u022b","o"],["\u022d","o"],["\u022f","o"],["\u0231","o"],["\u0233","y"],["\u02b0","h"],["\u02b1","h"],["\u0266","h"],["\u02b2","j"],["\u02b3","r"],["\u02b4","\u0279"],["\u02b5","\u027b"],["\u02b6","\u0281"],["\u02b7","w"],["\u02b8","y"],["\u02e0","\u0263"],["\u02e1","l"],["\u02e2","s"],
["\u02e3","x"],["\u02e4","\u0295"],["\u0390","\u03b9"],["\u03ac","\u03b1"],["\u03ad","\u03b5"],["\u03ae","\u03b7"],["\u03af","\u03b9"],["\u03b0","\u03c5"],["\u03ca","\u03b9"],["\u03cb","\u03c5"],["\u03cc","\u03bf"],["\u03cd","\u03c5"],["\u03ce","\u03c9"],["\u03d0","\u03b2"],["\u03d1","\u03b8"],["\u03d2","\u03a5"],["\u03d3","\u03a5"],["\u03d4","\u03a5"],["\u03d5","\u03c6"],["\u03d6","\u03c0"],["\u03f0","\u03ba"],["\u03f1","\u03c1"],["\u03f2","\u03c2"],["\u03f5","\u03b5"],["\u0439","\u0438"],["\u0450", ["\u02e3","x"],["\u02e4","\u0295"],["\u0390","\u03b9"],["\u03ac","\u03b1"],["\u03ad","\u03b5"],["\u03ae","\u03b7"],["\u03af","\u03b9"],["\u03b0","\u03c5"],["\u03ca","\u03b9"],["\u03cb","\u03c5"],["\u03cc","\u03bf"],["\u03cd","\u03c5"],["\u03ce","\u03c9"],["\u03d0","\u03b2"],["\u03d1","\u03b8"],["\u03d2","\u03a5"],["\u03d3","\u03a5"],["\u03d4","\u03a5"],["\u03d5","\u03c6"],["\u03d6","\u03c0"],["\u03f0","\u03ba"],["\u03f1","\u03c1"],["\u03f2","\u03c2"],["\u03f5","\u03b5"],["\u0439","\u0438"],["\u0450",
"\u0435"],["\u0451","\u0435"],["\u0453","\u0433"],["\u0457","\u0456"],["\u045c","\u043a"],["\u045d","\u0438"],["\u045e","\u0443"],["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]]); "\u0435"],["\u0451","\u0435"],["\u0453","\u0433"],["\u0457","\u0456"],["\u045c","\u043a"],["\u045d","\u0438"],["\u045e","\u0443"],["\u0477","\u0475"],["\u04c2","\u0436"],["\u04d1","\u0430"],["\u04d3","\u0430"],["\u04d7","\u0435"],["\u04db","\u04d9"],["\u04dd","\u0436"],["\u04df","\u0437"],["\u04e3","\u0438"],["\u04e5","\u0438"],["\u04e7","\u043e"],["\u04eb","\u04e9"],["\u04ed","\u044d"],["\u04ef","\u0443"],["\u04f1","\u0443"],["\u04f3","\u0443"],["\u04f5","\u0447"]];
function M(a){a=void 0===a?{}:a;if(!(this instanceof M))return new (Function.prototype.bind.apply(M,[null].concat(ba(arguments))));for(var b=0;b<arguments.length;b++)this.assign(arguments[b])} function M(a){a=void 0===a?{}:a;if(!(this instanceof M)){var b=Function.prototype.bind,c=b.apply,d=[null],e=d.concat;if(arguments instanceof Array)var g=arguments;else{g=y(arguments);for(var f,h=[];!(f=g.next()).done;)h.push(f.value);g=h}return new (c.call(b,M,e.call(d,g)))}for(b=0;b<arguments.length;b++)this.assign(arguments[b])}
M.prototype.assign=function(a){this.normalize=H(a.normalize,!0,this.normalize);var b=a.ra,c=b||a.Ha||a.split;if("object"===typeof c){var d=!b,e="";a.ra||(e+="\\p{Z}");c.Ea&&(e+="\\p{L}");c.Ia&&(e+="\\p{N}",d=!!b);c.Ka&&(e+="\\p{S}");c.Ja&&(e+="\\p{P}");c.control&&(e+="\\p{C}");if(c=c.char)e+="object"===typeof c?c.join(""):c;this.split=new RegExp("["+(b?"^":"")+e+"]+","u");this.numeric=d}else this.split=H(c,Ca,this.split),this.numeric=H(this.numeric,!0);this.la=H(a.la,null,this.la);this.ca=H(a.ca, M.prototype.assign=function(a){this.normalize=H(a.normalize,!0,this.normalize);var b=a.ra,c=b||a.Ha||a.split;if("object"===typeof c){var d=!b,e="";a.ra||(e+="\\p{Z}");c.Ea&&(e+="\\p{L}");c.Ia&&(e+="\\p{N}",d=!!b);c.Ka&&(e+="\\p{S}");c.Ja&&(e+="\\p{P}");c.control&&(e+="\\p{C}");if(c=c.char)e+="object"===typeof c?c.join(""):c;this.split=new RegExp("["+(b?"^":"")+e+"]+","u");this.numeric=d}else this.split=H(c,Ba,this.split),this.numeric=H(this.numeric,!0);this.la=H(a.la,null,this.la);this.ca=H(a.ca,
null,this.ca);this.rtl=a.rtl||!1;this.H=H(a.H,!0,this.H);this.filter=H((c=a.filter)&&new Set(c),null,this.filter);this.N=H((c=a.N)&&new Map(c),null,this.N);this.I=H((c=a.I)&&new Map(c),null,this.I);this.U=H((c=a.U)&&new Map(c),null,this.U);this.P=H(a.P,null,this.P);this.ka=H(a.ka,1,this.ka);this.sa=H(a.sa,0,this.sa);if(this.cache=c=H(a.cache,!0,this.cache))this.ea=null,this.R="number"===typeof c?c:2E5,this.W=new Map,this.ba=new Map,this.A=this.h=128;this.C="";this.G=null;this.D="";this.K=null;if(this.N)for(a= null,this.ca);Ga&&(this.K=new Map(Ga));this.rtl=a.rtl||!1;this.H=H(a.H,!0,this.H);this.filter=H((c=a.filter)&&new Set(c),null,this.filter);this.N=H((c=a.N)&&new Map(c),null,this.N);this.K=H((c=a.K)&&new Map(c),null,this.K);this.U=H((c=a.U)&&new Map(c),null,this.U);this.P=H(a.P,null,this.P);this.ka=H(a.ka,1,this.ka);this.sa=H(a.sa,0,this.sa);if(this.cache=c=H(a.cache,!0,this.cache))this.ea=null,this.R="number"===typeof c?c:2E5,this.W=new Map,this.ba=new Map,this.A=this.h=128;this.C="";this.G=null;
y(this.N.keys()),b=a.next();!b.done;b=a.next())this.C+=(this.C?"|":"")+b.value;if(this.U)for(a=y(this.U.keys()),b=a.next();!b.done;b=a.next())this.D+=(this.D?"|":"")+b.value;return this}; this.D="";this.J=null;if(this.N)for(a=y(this.N.keys()),b=a.next();!b.done;b=a.next())this.C+=(this.C?"|":"")+b.value;if(this.U)for(a=y(this.U.keys()),b=a.next();!b.done;b=a.next())this.D+=(this.D?"|":"")+b.value;return this};
M.prototype.encode=function(a){var b=this;if(this.cache&&a.length<=this.h)if(this.ea){if(this.W.has(a))return this.W.get(a)}else this.ea=setTimeout(Ia,0,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):Ga?a=a.normalize("NFKD").replace(Ga,"").toLowerCase():(a=a.toLowerCase(),this.I=this.I?new Map([].concat(ba(Ha),ba(this.I))):new Map(Ha)));this.la&&(a=this.la(a));this.numeric&&3<a.length&&(a=a.replace(Ea,"$1 $2").replace(Fa,"$1 $2").replace(Da,"$1 "));for(var c=!(this.H|| M.prototype.encode=function(a){var b=this;if(this.cache&&a.length<=this.h)if(this.ea){if(this.W.has(a))return this.W.get(a)}else this.ea=setTimeout(Ha,0,this);this.normalize&&(a="function"===typeof this.normalize?this.normalize(a):Fa?a.normalize("NFKD").replace(Fa,"").toLowerCase():a.toLowerCase());this.la&&(a=this.la(a));this.numeric&&3<a.length&&(a=a.replace(Da,"$1 $2").replace(Ea,"$1 $2").replace(Ca,"$1 "));for(var c=!(this.H||this.K||this.filter||this.N||this.U||this.P),d=[],e=this.split||""===
this.I||this.filter||this.N||this.U||this.P),d=[],e=this.split||""===this.split?a.split(this.split):a,h=0,f=void 0,g=void 0;h<e.length;h++)if((f=g=e[h])&&!(f.length<this.ka))if(c)d.push(f);else if(!this.filter||!this.filter.has(f)){if(this.cache&&f.length<=this.A)if(this.ea){var k=this.ba.get(f);if(k||""===k){k&&d.push(k);continue}}else this.ea=setTimeout(Ia,0,this);k=void 0;this.U&&2<f.length&&(this.K||(this.K=new RegExp("(?!^)("+this.D+")$")),f=f.replace(this.K,function(q){return b.U.get(q)}),k= this.split?a.split(this.split):a,g=0,f=void 0,h=void 0;g<e.length;g++)if((f=h=e[g])&&!(f.length<this.ka))if(c)d.push(f);else if(!this.filter||!this.filter.has(f)){if(this.cache&&f.length<=this.A)if(this.ea){var k=this.ba.get(f);if(k||""===k){k&&d.push(k);continue}}else this.ea=setTimeout(Ha,0,this);k=void 0;this.U&&2<f.length&&(this.J||(this.J=new RegExp("(?!^)("+this.D+")$")),f=f.replace(this.J,function(q){return b.U.get(q)}),k=1);this.N&&1<f.length&&(this.G||(this.G=new RegExp("("+this.C+")","g")),
1);this.N&&1<f.length&&(this.G||(this.G=new RegExp("("+this.C+")","g")),f=f.replace(this.G,function(q){return b.N.get(q)}),k=1);f&&k&&(f.length<this.ka||this.filter&&this.filter.has(f))&&(f="");if(f&&(this.I||this.H&&1<f.length)){k="";for(var l=0,m="",n=void 0,p=void 0;l<f.length;l++)n=f.charAt(l),n===m&&this.H||((p=this.I&&this.I.get(n))||""===p?p===m&&this.H||!(m=p)||(k+=p):k+=m=n);f=k}if(f&&this.P)for(k=0;f&&k<this.P.length;k+=2)f=f.replace(this.P[k],this.P[k+1]);this.cache&&g.length<=this.A&& f=f.replace(this.G,function(q){return b.N.get(q)}),k=1);f&&k&&(f.length<this.ka||this.filter&&this.filter.has(f))&&(f="");if(f&&(this.K||this.H&&1<f.length)){k="";for(var l=0,m="",n=void 0,p=void 0;l<f.length;l++)n=f.charAt(l),n===m&&this.H||((p=this.K&&this.K.get(n))||""===p?p===m&&this.H||!(m=p)||(k+=p):k+=m=n);f=k}if(f&&this.P)for(k=0;f&&k<this.P.length;k+=2)f=f.replace(this.P[k],this.P[k+1]);this.cache&&h.length<=this.A&&(this.ba.set(h,f),this.ba.size>this.R&&(this.ba.clear(),this.A=this.A/1.1|
(this.ba.set(g,f),this.ba.size>this.R&&(this.ba.clear(),this.A=this.A/1.1|0));f&&d.push(f)}this.ca&&(d=this.ca(d)||d);this.cache&&a.length<=this.h&&(this.W.set(a,d),this.W.size>this.R&&(this.W.clear(),this.h=this.h/1.1|0));return d};function Ia(a){a.ea=null;a.W.clear();a.ba.clear()};function Ja(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();var d=this.cache.get(a);if(!d){d=this.search(a,b,c);if(d instanceof Promise){var e=this;d.then(function(h){e.cache.set(a,h)})}this.cache.set(a,d)}return d}function N(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}N.prototype.set=function(a,b){this.cache.has(a)||(this.cache.set(this.h=a,b),this.limit&&this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value))}; 0));f&&d.push(f)}this.ca&&(d=this.ca(d)||d);this.cache&&a.length<=this.h&&(this.W.set(a,d),this.W.size>this.R&&(this.W.clear(),this.h=this.h/1.1|0));return d};function Ha(a){a.ea=null;a.W.clear();a.ba.clear()};function Ia(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();var d=this.cache.get(a);if(!d){d=this.search(a,b,c);if(d instanceof Promise){var e=this;d.then(function(g){e.cache.set(a,g)})}this.cache.set(a,d)}return d}function N(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}N.prototype.set=function(a,b){this.cache.has(a)||(this.cache.set(this.h=a,b),this.limit&&this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value))};
N.prototype.get=function(a){var b=this.cache.get(a);b&&this.limit&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,b));return b};N.prototype.remove=function(a){for(var b=y(this.cache),c=b.next();!c.done;c=b.next()){c=c.value;var d=c[0];c[1].includes(a)&&this.cache.delete(d)}};N.prototype.clear=function(){this.cache.clear();this.h=""};function Ka(a,b,c,d){for(var e=[],h=0,f;h<a.index.length;h++)if(f=a.index[h],b>=f.length)b-=f.length;else{b=f[d?"splice":"slice"](b,c);if(f=b.length)if(e=e.length?e.concat(b):b,c-=f,d&&(a.length-=f),!c)break;b=0}return e} N.prototype.get=function(a){var b=this.cache.get(a);b&&this.limit&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,b));return b};N.prototype.remove=function(a){for(var b=y(this.cache),c=b.next();!c.done;c=b.next()){c=c.value;var d=c[0];c[1].includes(a)&&this.cache.delete(d)}};N.prototype.clear=function(){this.cache.clear();this.h=""};function Ja(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 Q(a){if(!(this instanceof Q))return new Q(a);this.index=a?[a]:[];this.length=a?a.length:0;var b=this;return new Proxy([],{get:function(c,d){if("length"===d)return b.length;if("push"===d)return function(e){b.index[b.index.length-1].push(e);b.length++};if("pop"===d)return function(){if(b.length)return b.length--,b.index[b.index.length-1].pop()};if("indexOf"===d)return function(e){for(var h=0,f=0,g,k;f<b.index.length;f++){g=b.index[f];k=g.indexOf(e);if(0<=k)return h+k;h+=g.length}return-1}; function Q(a){if(!(this instanceof Q))return new Q(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 h=0;h<b.index.length;h++)if(b.index[h].includes(e))return!0;return!1};if("slice"===d)return function(e,h){return Ka(b,e||0,h||b.length,!1)};if("splice"===d)return function(e,h){return Ka(b,e||0,h||b.length,!0)};if("constructor"===d)return Array;if("symbol"!==typeof d)return(c=b.index[d/Math.pow(2,31)|0])&&c[d]},set:function(c,d,e){c=d/Math.pow(2,31)|0;(b.index[c]||(b.index[c]=[]))[d]=e;b.length++;return!0}})} 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 Ja(b,e||0,g||b.length,!1)};if("splice"===d)return function(e,g){return Ja(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}})}
Q.prototype.clear=function(){this.index.length=0};Q.prototype.push=function(){};function R(a){a=void 0===a?8:a;if(!(this instanceof R))return new R(a);this.index=I();this.C=[];this.size=0;32<a?(this.h=La,this.A=BigInt(a)):(this.h=Ma,this.A=a)}R.prototype.get=function(a){var b=this.h(a);return(b=this.index[b])&&b.get(a)};R.prototype.set=function(a,b){var c=this.h(a),d=this.index[c];d?(c=d.size,d.set(a,b),(c-=d.size)&&this.size++):(this.index[c]=d=new Map([[a,b]]),this.C.push(d))}; Q.prototype.clear=function(){this.index.length=0};Q.prototype.push=function(){};function R(a){a=void 0===a?8:a;if(!(this instanceof R))return new R(a);this.index=I();this.C=[];this.size=0;32<a?(this.h=Ka,this.A=BigInt(a)):(this.h=La,this.A=a)}R.prototype.get=function(a){var b=this.h(a);return(b=this.index[b])&&b.get(a)};R.prototype.set=function(a,b){var c=this.h(a),d=this.index[c];d?(c=d.size,d.set(a,b),(c-=d.size)&&this.size++):(this.index[c]=d=new Map([[a,b]]),this.C.push(d))};
function S(a){a=void 0===a?8:a;if(!(this instanceof S))return new S(a);this.index=I();this.h=[];32<a?(this.C=La,this.A=BigInt(a)):(this.C=Ma,this.A=a)}S.prototype.add=function(a){var b=this.C(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))};w=R.prototype;w.has=S.prototype.has=function(a){var b=this.C(a);return(b=this.index[b])&&b.has(a)};w.delete=S.prototype.delete=function(a){var b=this.C(a);(b=this.index[b])&&b.delete(a)&&this.size--}; function S(a){a=void 0===a?8:a;if(!(this instanceof S))return new S(a);this.index=I();this.h=[];32<a?(this.C=Ka,this.A=BigInt(a)):(this.C=La,this.A=a)}S.prototype.add=function(a){var b=this.C(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))};w=R.prototype;w.has=S.prototype.has=function(a){var b=this.C(a);return(b=this.index[b])&&b.has(a)};w.delete=S.prototype.delete=function(a){var b=this.C(a);(b=this.index[b])&&b.delete(a)&&this.size--};
w.clear=S.prototype.clear=function(){this.index=I();this.h=[];this.size=0};w.values=S.prototype.values=function Na(){var b,c=this,d,e,h;return sa(Na,function(f){switch(f.h){case 1:b=0;case 2:if(!(b<c.h.length)){f.h=0;break}d=y(c.h[b].values());e=d.next();case 5:if(e.done){b++;f.h=2;break}h=e.value;return F(f,h,6);case 6:e=d.next(),f.h=5}})}; w.clear=S.prototype.clear=function(){this.index=I();this.h=[];this.size=0};w.values=S.prototype.values=function Ma(){var b,c=this,d,e,g;return ra(Ma,function(f){switch(f.h){case 1:b=0;case 2:if(!(b<c.h.length)){f.h=0;break}d=y(c.h[b].values());e=d.next();case 5:if(e.done){b++;f.h=2;break}g=e.value;return F(f,g,6);case 6:e=d.next(),f.h=5}})};
w.keys=S.prototype.keys=function Oa(){var b,c=this,d,e,h;return sa(Oa,function(f){switch(f.h){case 1:b=0;case 2:if(!(b<c.h.length)){f.h=0;break}d=y(c.h[b].keys());e=d.next();case 5:if(e.done){b++;f.h=2;break}h=e.value;return F(f,h,6);case 6:e=d.next(),f.h=5}})}; w.keys=S.prototype.keys=function Na(){var b,c=this,d,e,g;return ra(Na,function(f){switch(f.h){case 1:b=0;case 2:if(!(b<c.h.length)){f.h=0;break}d=y(c.h[b].keys());e=d.next();case 5:if(e.done){b++;f.h=2;break}g=e.value;return F(f,g,6);case 6:e=d.next(),f.h=5}})};
w.entries=S.prototype.entries=function Pa(){var b,c=this,d,e,h;return sa(Pa,function(f){switch(f.h){case 1:b=0;case 2:if(!(b<c.h.length)){f.h=0;break}d=y(c.h[b].entries());e=d.next();case 5:if(e.done){b++;f.h=2;break}h=e.value;return F(f,h,6);case 6:e=d.next(),f.h=5}})};function Ma(a){var b=Math.pow(2,this.A)-1;if("number"==typeof a)return a&b;for(var c=0,d=this.A+1,e=0;e<a.length;e++)c=(c*d^a.charCodeAt(e))&b;return 32===this.A?c+Math.pow(2,31):c} w.entries=S.prototype.entries=function Oa(){var b,c=this,d,e,g;return ra(Oa,function(f){switch(f.h){case 1:b=0;case 2:if(!(b<c.h.length)){f.h=0;break}d=y(c.h[b].entries());e=d.next();case 5:if(e.done){b++;f.h=2;break}g=e.value;return F(f,g,6);case 6:e=d.next(),f.h=5}})};function La(a){var b=Math.pow(2,this.A)-1;if("number"==typeof a)return a&b;for(var c=0,d=this.A+1,e=0;e<a.length;e++)c=(c*d^a.charCodeAt(e))&b;return 32===this.A?c+Math.pow(2,31):c}
function La(){throw Error("The keystore is limited to 32 for EcmaScript5");};function Qa(a,b,c,d,e,h,f,g){(d=a(c?c+"."+d:d,JSON.stringify(f)))&&d.then?d.then(function(){b.export(a,b,c,e,h+1,g)}):b.export(a,b,c,e,h+1,g)};var Ra=I(),T=I();var Sa={normalize:function(a){return a.toLowerCase()},H:!1};var Ta={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};function Ua(a){Va.call(a,"add");Va.call(a,"append");Va.call(a,"search");Va.call(a,"update");Va.call(a,"remove")}function Va(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]}this.async=!0;b=this[a].apply(this,b);this.async=!1;b.then?b.then(d):d(b);return b}};I();U.prototype.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.B.has(a))return this.update(a,b);b=this.encoder.encode(b);if(d=b.length){for(var e=I(),h=I(),f=this.depth,g=this.resolution,k=0;k<d;k++){var l=b[this.rtl?d-1-k:k],m=l.length;if(m&&(f||!h[l])){var n=this.score?this.score(b,l,k,null,0):Wa(g,d,k),p="";switch(this.tokenize){case "full":if(2<m){for(n=0;n<m;n++)for(var q=m;q>n;q--){p=l.substring(n,q);var r=this.score?this.score(b,l,k,p,n):Wa(g,d,k,m,n);Xa(this,h,p,r,a,c)}break}case "reverse":if(1< function Ka(){throw Error("The keystore is limited to 32 for EcmaScript5");};function Pa(a,b,c,d,e,g,f,h){(d=a(c?c+"."+d:d,JSON.stringify(f)))&&d.then?d.then(function(){b.export(a,b,c,e,g+1,h)}):b.export(a,b,c,e,g+1,h)};var Qa={normalize:function(a){return a.toLowerCase()},H:!1};var Ra={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};function Sa(a){Ta.call(a,"add");Ta.call(a,"append");Ta.call(a,"search");Ta.call(a,"update");Ta.call(a,"remove")}function Ta(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]}this.async=!0;b=this[a].apply(this,b);this.async=!1;b.then?b.then(d):d(b);return b}};I();T.prototype.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.B.has(a))return this.update(a,b);b=this.encoder.encode(b);if(d=b.length){for(var e=I(),g=I(),f=this.depth,h=this.resolution,k=0;k<d;k++){var l=b[this.rtl?d-1-k:k],m=l.length;if(m&&(f||!g[l])){var n=this.score?this.score(b,l,k,null,0):Ua(h,d,k),p="";switch(this.tokenize){case "full":if(2<m){for(n=0;n<m;n++)for(var q=m;q>n;q--){p=l.substring(n,q);var r=this.score?this.score(b,l,k,p,n):Ua(h,d,k,m,n);Va(this,g,p,r,a,c)}break}case "reverse":if(1<
m){for(q=m-1;0<q;q--)p=l[q]+p,r=this.score?this.score(b,l,k,p,q):Wa(g,d,k,m,q),Xa(this,h,p,r,a,c);p=""}case "forward":if(1<m){for(q=0;q<m;q++)p+=l[q],Xa(this,h,p,n,a,c);break}default:if(Xa(this,h,l,n,a,c),f&&1<d&&k<d-1)for(m=I(),p=this.na,n=l,q=Math.min(f+1,d-k),r=m[n]=1;r<q;r++)if((l=b[this.rtl?d-1-k-r:k+r])&&!m[l]){m[l]=1;var x=this.score?this.score(b,n,k,l,r):Wa(p+(d/2>p?0:1),d,k,q-1,r-1),u=this.bidirectional&&l>n;Xa(this,e,u?n:l,x,a,c,u?l:n)}}}}this.fastupdate||this.B.add(a)}else b=""}this.db&& m){for(q=m-1;0<q;q--)p=l[q]+p,r=this.score?this.score(b,l,k,p,q):Ua(h,d,k,m,q),Va(this,g,p,r,a,c);p=""}case "forward":if(1<m){for(q=0;q<m;q++)p+=l[q],Va(this,g,p,n,a,c);break}default:if(Va(this,g,l,n,a,c),f&&1<d&&k<d-1)for(m=I(),p=this.na,n=l,q=Math.min(f+1,d-k),r=m[n]=1;r<q;r++)if((l=b[this.rtl?d-1-k-r:k+r])&&!m[l]){m[l]=1;var x=this.score?this.score(b,n,k,l,r):Ua(p+(d/2>p?0:1),d,k,q-1,r-1),u=this.bidirectional&&l>n;Va(this,e,u?n:l,x,a,c,u?l:n)}}}}this.fastupdate||this.B.add(a)}else b=""}this.db&&
(b||this.X.push({del:a}),this.qa&&Ya(this));return this}; (b||this.X.push({del:a}),this.qa&&Wa(this));return this};
function Xa(a,b,c,d,e,h,f){var g=f?a.M:a.map,k;if(!b[c]||!f||!(k=b[c])[f])if(f?(b=k||(b[c]=I()),b[f]=1,(k=g.get(f))?g=k:g.set(f,g=new Map)):b[c]=1,(k=g.get(c))?g=k:g.set(c,g=k=[]),g=g[d]||(g[d]=[]),!h||!g.includes(e)){if(g.length===Math.pow(2,31)-1){b=new Q(g);if(a.fastupdate)for(c=y(a.B.values()),h=c.next();!h.done;h=c.next())h=h.value,h.includes(g)&&(h[h.indexOf(g)]=b);k[d]=g=b}g.push(e);a.fastupdate&&((d=a.B.get(e))?d.push(g):a.B.set(e,[g]))}} function Va(a,b,c,d,e,g,f){var h=f?a.M:a.map,k;if(!b[c]||!f||!(k=b[c])[f])if(f?(b=k||(b[c]=I()),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 Q(h);if(a.fastupdate)for(c=y(a.B.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.B.get(e))?d.push(h):a.B.set(e,[h]))}}
function Wa(a,b,c,d,e){return c&&1<a?b+(d||0)<=a?c+(e||0):(a-1)/(b+(d||0))*(c+(e||0))+1|0:0};function V(a,b,c,d){if(1===a.length)return a=a[0],a=c||a.length>b?b?a.slice(c,c+b):a.slice(c):a,d?Za(a):a;for(var e=[],h=0,f=void 0,g=void 0;h<a.length;h++)if((f=a[h])&&(g=f.length)){if(c){if(c>=g){c-=g;continue}c<g&&(f=b?f.slice(c,c+b):f.slice(c),g=f.length,c=0)}if(e.length)g>b&&(f=f.slice(0,b),g=f.length),e.push(f);else{if(g>=b)return g>b&&(f=f.slice(0,b)),d?Za(f):f;e=[f]}b-=g;if(!b)break}if(!e.length)return e;e=1<e.length?[].concat.apply([],e):e[0];return d?Za(e):e} function Ua(a,b,c,d,e){return c&&1<a?b+(d||0)<=a?c+(e||0):(a-1)/(b+(d||0))*(c+(e||0))+1|0:0};function U(a,b,c,d){if(1===a.length)return a=a[0],a=c||a.length>b?b?a.slice(c,c+b):a.slice(c):a,d?Xa(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}c<h&&(f=b?f.slice(c,c+b):f.slice(c),h=f.length,c=0)}if(e.length)h>b&&(f=f.slice(0,b),h=f.length),e.push(f);else{if(h>=b)return h>b&&(f=f.slice(0,b)),d?Xa(f):f;e=[f]}b-=h;if(!b)break}if(!e.length)return e;e=1<e.length?[].concat.apply([],e):e[0];return d?Xa(e):e}
function Za(a){for(var b=0;b<a.length;b++)a[b]={score:b,id:a[b]};return a};W.prototype.or=function(){var a=this,b=arguments,c=b[0];if(c instanceof Promise)return c.then(function(){return a.or.apply(a,b)});if(c[0]&&c[0].index)return this.or.apply(this,c);var d=[];c=[];for(var e=0,h=0,f,g,k=0,l=void 0;k<b.length;k++)if(l=b[k]){var m=void 0;if(l instanceof W)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.and)m=this.and(l.and);else if(l.xor)m=this.xor(l.xor);else if(l.J)m=this.J(l.J);else{e=l.limit||0;h=l.offset|| function Xa(a){for(var b=0;b<a.length;b++)a[b]={score:b,id:a[b]};return a};V.prototype.or=function(){var a=this,b=arguments,c=b[0];if(c instanceof Promise)return c.then(function(){return a.or.apply(a,b)});if(c[0]&&c[0].index)return this.or.apply(this,c);var d=[];c=[];for(var e=0,g=0,f,h,k=0,l=void 0;k<b.length;k++)if(l=b[k]){var m=void 0;if(l instanceof V)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.and)m=this.and(l.and);else if(l.xor)m=this.xor(l.xor);else if(l.I)m=this.I(l.I);else{e=l.limit||0;g=l.offset||
0;f=l.enrich;g=l.resolve;continue}d[k]=m;m instanceof Promise&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=[a.result].concat(d));a.result=$a(d,e,h,f,g,a.V);return g?a.result:a});this.result.length&&(d=[this.result].concat(d));this.result=$a(d,e,h,f,g,a.V);return g?this.result:this}; 0;f=l.enrich;h=l.resolve;continue}d[k]=m;m instanceof Promise&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=[a.result].concat(d));a.result=Ya(d,e,g,f,h,a.V);return h?a.result:a});this.result.length&&(d=[this.result].concat(d));this.result=Ya(d,e,g,f,h,a.V);return h?this.result:this};
function $a(a,b,c,d,e,h){if(!a.length)return a;"object"===typeof b&&(c=b.offset||0,d=b.enrich||!1,b=b.limit||0);if(2>a.length)return e?V(a[0],b,c,d):a[0];d=[];for(var f=0,g=I(),k=Ba(a),l=0,m;l<k;l++)for(var n=0;n<a.length;n++)if(m=a[n])if(m=m[l])for(var p=0,q;p<m.length;p++)if(q=m[p],!g[q])if(g[q]=1,c)c--;else{if(e)d.push(q);else{var r=l+(n?h:0);d[r]||(d[r]=[]);d[r].push(q)}if(b&&++f===b)return d}return d};W.prototype.and=function(){if(this.result.length){var a=this,b=arguments,c=b[0];if(c instanceof Promise)return c.then(function(){return a.and.apply(a,b)});if(c[0]&&c[0].index)return this.and.apply(this,c);var d=[];c=[];for(var e=0,h=0,f,g=0,k=void 0;g<b.length;g++)if(k=b[g]){var l=void 0;if(k instanceof W)l=k.result;else if(k.constructor===Array)l=k;else if(k.index)k.resolve=!1,l=k.index.search(k).result;else if(k.or)l=this.or(k.or);else if(k.xor)l=this.xor(k.xor);else if(k.J)l=this.J(k.J);else{e= function Ya(a,b,c,d,e,g){if(!a.length)return a;"object"===typeof b&&(c=b.offset||0,d=b.enrich||!1,b=b.limit||0);if(2>a.length)return e?U(a[0],b,c,d):a[0];d=[];for(var f=0,h=I(),k=Aa(a),l=0,m;l<k;l++)for(var n=0;n<a.length;n++)if(m=a[n])if(m=m[l])for(var p=0,q;p<m.length;p++)if(q=m[p],!h[q])if(h[q]=1,c)c--;else{if(e)d.push(q);else{var r=l+(n?g:0);d[r]||(d[r]=[]);d[r].push(q)}if(b&&++f===b)return d}return d};V.prototype.and=function(){if(this.result.length){var a=this,b=arguments,c=b[0];if(c instanceof Promise)return c.then(function(){return a.and.apply(a,b)});if(c[0]&&c[0].index)return this.and.apply(this,c);var d=[];c=[];for(var e=0,g=0,f,h=0,k=void 0;h<b.length;h++)if(k=b[h]){var l=void 0;if(k instanceof V)l=k.result;else if(k.constructor===Array)l=k;else if(k.index)k.resolve=!1,l=k.index.search(k).result;else if(k.or)l=this.or(k.or);else if(k.xor)l=this.xor(k.xor);else if(k.I)l=this.I(k.I);else{e=
k.limit||0;h=k.offset||0;f=k.resolve;continue}d[g]=l;l instanceof Promise&&c.push(l)}if(c.length)return Promise.all(c).then(function(){d=[a.result].concat(d);a.result=ab(d,e,h,f,a.V);return f?a.result:a});d=[this.result].concat(d);this.result=ab(d,e,h,f,a.V);return f?this.result:this}return this}; k.limit||0;g=k.offset||0;f=k.resolve;continue}d[h]=l;l instanceof Promise&&c.push(l)}if(c.length)return Promise.all(c).then(function(){d=[a.result].concat(d);a.result=Za(d,e,g,f,a.V);return f?a.result:a});d=[this.result].concat(d);this.result=Za(d,e,g,f,a.V);return f?this.result:this}return this};
function ab(a,b,c,d,e){if(2>a.length)return[];var h=[],f=0,g=I(),k=Ba(a);if(!k)return h;for(var l=0,m;l<a.length;l++){m=a[l];if(!m||!m.length)return[];for(var n=I(),p=0,q=l===a.length-1,r=0,x;r<k;r++)if(x=m[r])for(var u=0,t,v;u<x.length;u++)if(t=x[u],!l)n[t]=r+1+(l?e:0),p=1;else if(q){if(v=g[t])if(p=1,c)c--;else if(d?h.push(t):(v--,r<v&&(v=r),h[v]||(h[v]=[]),h[v].push(t)),b&&++f===b)return h}else if(v=g[t])r+1<v&&(v=r+1),n[t]=v,p=1;if(!p)return[];g=n}return h};W.prototype.xor=function(){var a=this,b=arguments,c=b[0];if(c instanceof Promise)return c.then(function(){return a.xor.apply(a,b)});if(c[0]&&c[0].index)return this.xor.apply(this,c);var d=[];c=[];for(var e=0,h=0,f,g,k=0,l=void 0;k<b.length;k++)if(l=b[k]){var m=void 0;if(l instanceof W)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.or)m=this.or(l.or);else if(l.and)m=this.and(l.and);else if(l.J)m=this.J(l.J);else{e=l.limit||0;h=l.offset|| function Za(a,b,c,d,e){if(2>a.length)return[];var g=[],f=0,h=I(),k=Aa(a);if(!k)return g;for(var l=0,m;l<a.length;l++){m=a[l];if(!m||!m.length)return[];for(var n=I(),p=0,q=l===a.length-1,r=0,x;r<k;r++)if(x=m[r])for(var u=0,t,v;u<x.length;u++)if(t=x[u],!l)n[t]=r+1+(l?e:0),p=1;else if(q){if(v=h[t])if(p=1,c)c--;else if(d?g.push(t):(v--,r<v&&(v=r),g[v]||(g[v]=[]),g[v].push(t)),b&&++f===b)return g}else if(v=h[t])r+1<v&&(v=r+1),n[t]=v,p=1;if(!p)return[];h=n}return g};V.prototype.xor=function(){var a=this,b=arguments,c=b[0];if(c instanceof Promise)return c.then(function(){return a.xor.apply(a,b)});if(c[0]&&c[0].index)return this.xor.apply(this,c);var d=[];c=[];for(var e=0,g=0,f,h,k=0,l=void 0;k<b.length;k++)if(l=b[k]){var m=void 0;if(l instanceof V)m=l.result;else if(l.constructor===Array)m=l;else if(l.index)l.resolve=!1,m=l.index.search(l).result;else if(l.or)m=this.or(l.or);else if(l.and)m=this.and(l.and);else if(l.I)m=this.I(l.I);else{e=l.limit||0;g=l.offset||
0;f=l.enrich;g=l.resolve;continue}d[k]=m;m instanceof Promise&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=[a.result].concat(d));a.result=bb(d,e,h,f,!g,a.V);return g?a.result:a});this.result.length&&(d=[this.result].concat(d));this.result=bb(d,e,h,f,!g,a.V);return g?this.result:this}; 0;f=l.enrich;h=l.resolve;continue}d[k]=m;m instanceof Promise&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=[a.result].concat(d));a.result=$a(d,e,g,f,!h,a.V);return h?a.result:a});this.result.length&&(d=[this.result].concat(d));this.result=$a(d,e,g,f,!h,a.V);return h?this.result:this};
function bb(a,b,c,d,e,h){if(!a.length)return a;if(2>a.length)return e?V(a[0],b,c,d):a[0];b=[];c=I();d=0;for(var f;d<a.length;d++)if(f=a[d])for(var g=0,k;g<f.length;g++)if(k=f[g])for(var l=0,m;l<k.length;l++)m=k[l],c[m]?c[m]++:c[m]=1;for(d=0;d<a.length;d++)if(f=a[d])for(g=0;g<f.length;g++)if(k=f[g])for(l=0;l<k.length;l++)if(m=k[l],1===c[m])if(e)b.push(m);else{var n=g+(d?h:0);b[n]||(b[n]=[]);b[n].push(m)}return b};W.prototype.J=function(){var a=this,b=arguments,c=b[0];if(c instanceof Promise)return c.then(function(){return a.J.apply(a,b)});if(c[0]&&c[0].index)return this.J.apply(this,c);var d=[];c=[];for(var e,h=0,f=void 0;h<b.length;h++)if(f=b[h]){var g=void 0;if(f instanceof W)g=f.result;else if(f.constructor===Array)g=f;else if(f.index)f.resolve=!1,g=f.index.search(f).result;else if(f.or)g=this.or(f.or);else if(f.and)g=this.and(f.and);else if(f.xor)g=this.xor(f.xor);else{e=f.resolve;continue}d[h]=g;g instanceof function $a(a,b,c,d,e,g){if(!a.length)return a;if(2>a.length)return e?U(a[0],b,c,d):a[0];b=[];c=I();d=0;for(var f;d<a.length;d++)if(f=a[d])for(var h=0,k;h<f.length;h++)if(k=f[h])for(var l=0,m;l<k.length;l++)m=k[l],c[m]?c[m]++:c[m]=1;for(d=0;d<a.length;d++)if(f=a[d])for(h=0;h<f.length;h++)if(k=f[h])for(l=0;l<k.length;l++)if(m=k[l],1===c[m])if(e)b.push(m);else{var n=h+(d?g:0);b[n]||(b[n]=[]);b[n].push(m)}return b};V.prototype.I=function(){var a=this,b=arguments,c=b[0];if(c instanceof Promise)return c.then(function(){return a.I.apply(a,b)});if(c[0]&&c[0].index)return this.I.apply(this,c);var d=[];c=[];for(var e,g=0,f=void 0;g<b.length;g++)if(f=b[g]){var h=void 0;if(f instanceof V)h=f.result;else if(f.constructor===Array)h=f;else if(f.index)f.resolve=!1,h=f.index.search(f).result;else if(f.or)h=this.or(f.or);else if(f.and)h=this.and(f.and);else if(f.xor)h=this.xor(f.xor);else{e=f.resolve;continue}d[g]=h;h instanceof
Promise&&c.push(g)}if(c.length)return Promise.all(c).then(function(){a.result=cb.call(a,d,e);return e?a.result:a});this.result=cb.call(this,d,e);return e?this.result:this};function cb(a,b){if(!a.length)return this.result;var c=[];a=new Set(a.flat().flat());for(var d=0,e;d<this.result.length;d++)if(e=this.result[d])for(var h=0,f;h<e.length;h++)f=e[h],a.has(f)||(b?c.push(f):(c[d]||(c[d]=[]),c[d].push(f)));return c};function W(a){if(a&&a.index)return a.resolve=!1,this.index=a.index,a.index.search(a);if(!(this instanceof W))return new W(a);if(a instanceof W)return a;this.index=null;this.result=a||[];this.V=0}W.prototype.limit=function(a){if(this.result.length)for(var b=[],c=0,d=0,e;d<this.result.length;d++)if(e=this.result[d],e.length+c<a)b[d]=e,c+=e.length;else{b[d]=e.slice(0,a-c);this.result=b;break}return this}; Promise&&c.push(h)}if(c.length)return Promise.all(c).then(function(){a.result=ab.call(a,d,e);return e?a.result:a});this.result=ab.call(this,d,e);return e?this.result:this};function ab(a,b){if(!a.length)return this.result;var c=[];a=new Set(a.flat().flat());for(var d=0,e;d<this.result.length;d++)if(e=this.result[d])for(var g=0,f;g<e.length;g++)f=e[g],a.has(f)||(b?c.push(f):(c[d]||(c[d]=[]),c[d].push(f)));return c};function V(a){if(a&&a.index)return a.resolve=!1,this.index=a.index,a.index.search(a);if(!(this instanceof V))return new V(a);if(a instanceof V)return a;this.index=null;this.result=a||[];this.V=0}V.prototype.limit=function(a){if(this.result.length)for(var b=[],c=0,d=0,e;d<this.result.length;d++)if(e=this.result[d],e.length+c<a)b[d]=e,c+=e.length;else{b[d]=e.slice(0,a-c);this.result=b;break}return this};
W.prototype.offset=function(a){if(this.result.length){for(var b=[],c=0,d=0,e;d<this.result.length;d++)e=this.result[d],e.length+c<a?c+=e.length:(b[d]=e.slice(a-c),c=a);this.result=b}return this};W.prototype.resolve=function(a,b,c){db=1;var d=this.result;this.result=this.index=null;return d.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),V(d,a||100,b,c)):d};function eb(a,b,c,d){var e=a.length,h=[],f=0,g;d&&(d=[]);for(var k=e-1,l;0<=k;k--){var m=a[k];e=I();l=!x;for(var n=0,p;n<m.length;n++)if((p=m[n])&&p.length)for(var q=0,r;q<p.length;q++)if(r=p[q],x){if(x[r]){if(!k)if(c)c--;else if(h[f++]=r,f===b)return h;if(k||d)e[r]=1;l=!0}d&&!g[r]&&(g[r]=1,(d[n]||(d[n]=[])).push(r))}else e[r]=1;if(d)x||(g=e);else if(!l)return[];var x=e}if(d)for(a=d.length-1;0<=a;a--)for(g=d[a],e=g.length,m=0;m<e;m++)if(k=g[m],!x[k]){if(c)c--;else if(h[f++]=k,f===b)return h;x[k]= V.prototype.offset=function(a){if(this.result.length){for(var b=[],c=0,d=0,e;d<this.result.length;d++)e=this.result[d],e.length+c<a?c+=e.length:(b[d]=e.slice(a-c),c=a);this.result=b}return this};V.prototype.resolve=function(a,b,c){bb=1;var d=this.result;this.result=this.index=null;return d.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),U(d,a||100,b,c)):d};function cb(a,b,c,d){var e=a.length,g=[],f=0,h;d&&(d=[]);for(var k=e-1,l;0<=k;k--){var m=a[k];e=I();l=!x;for(var n=0,p;n<m.length;n++)if((p=m[n])&&p.length)for(var q=0,r;q<p.length;q++)if(r=p[q],x){if(x[r]){if(!k)if(c)c--;else if(g[f++]=r,f===b)return g;if(k||d)e[r]=1;l=!0}d&&!h[r]&&(h[r]=1,(d[n]||(d[n]=[])).push(r))}else e[r]=1;if(d)x||(h=e);else if(!l)return[];var x=e}if(d)for(a=d.length-1;0<=a;a--)for(h=d[a],e=h.length,m=0;m<e;m++)if(k=h[m],!x[k]){if(c)c--;else if(g[f++]=k,f===b)return g;x[k]=
1}return h}function fb(a,b){for(var c=I(),d=I(),e=[],h=0;h<a.length;h++)c[a[h]]=1;for(a=0;a<b.length;a++){h=b[a];for(var f=0,g;f<h.length;f++)g=h[f],c[g]&&!d[g]&&(d[g]=1,e.push(g))}return e};var db=1; 1}return g}function db(a,b){for(var c=I(),d=I(),e=[],g=0;g<a.length;g++)c[a[g]]=1;for(a=0;a<b.length;a++){g=b[a];for(var f=0,h;f<g.length;f++)h=g[f],c[h]&&!d[h]&&(d[h]=1,e.push(h))}return e};var bb=1;
U.prototype.search=function(a,b,c){c||(!b&&K(a)?(c=a,a=""):K(b)&&(c=b,b=0));var d=[],e=0,h;if(c){a=c.query||a;b=c.limit||b;e=c.offset||0;var f=c.context;var g=c.suggest;(h=db&&!1!==c.resolve)||(db=0);var k=h&&c.enrich;var l=this.db&&c.tag}else h=this.resolve||db;a=this.encoder.encode(a);var m=a.length;b||!h||(b=100);if(1===m)return gb.call(this,a[0],"",b,e,h,k,l);f=this.depth&&!1!==f;if(2===m&&f&&!g)return gb.call(this,a[0],a[1],b,e,h,k,l);var n=c=0;if(1<m){for(var p=I(),q=[],r=0,x=void 0;r<m;r++)if((x= T.prototype.search=function(a,b,c){c||(!b&&K(a)?(c=a,a=""):K(b)&&(c=b,b=0));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;(g=bb&&!1!==c.resolve)||(bb=0);var k=g&&c.enrich;var l=this.db&&c.tag}else g=this.resolve||bb;a=this.encoder.encode(a);var m=a.length;b||!g||(b=100);if(1===m)return eb.call(this,a[0],"",b,e,g,k,l);f=this.depth&&!1!==f;if(2===m&&f&&!h)return eb.call(this,a[0],a[1],b,e,g,k,l);var n=c=0;if(1<m){for(var p=I(),q=[],r=0,x=void 0;r<m;r++)if((x=
a[r])&&!p[x]){if(g||this.db||X(this,x))q.push(x),p[x]=1;else return h?d:new W(d);x=x.length;c=Math.max(c,x);n=n?Math.min(n,x):x}a=q;m=a.length}if(!m)return h?d:new W(d);var u=0;if(1===m)return gb.call(this,a[0],"",b,e,h,k,l);if(2===m&&f&&!g)return gb.call(this,a[0],a[1],b,e,h,k,l);if(1<m)if(f){var t=a[0];u=1}else 9<c&&3<c/n&&a.sort(ya);if(this.db){if(this.db.search&&(f=this.db.search(this,a,b,e,g,h,k,l),!1!==f))return f;var v=this;return function(){var A,C,D;return ua(function(E){switch(E.h){case 1:C= a[r])&&!p[x]){if(h||this.db||W(this,x))q.push(x),p[x]=1;else return g?d:new V(d);x=x.length;c=Math.max(c,x);n=n?Math.min(n,x):x}a=q;m=a.length}if(!m)return g?d:new V(d);var u=0;if(1===m)return eb.call(this,a[0],"",b,e,g,k,l);if(2===m&&f&&!h)return eb.call(this,a[0],a[1],b,e,g,k,l);if(1<m)if(f){var t=a[0];u=1}else 9<c&&3<c/n&&a.sort(xa);if(this.db){if(this.db.search&&(f=this.db.search(this,a,b,e,h,g,k,l),!1!==f))return f;var v=this;return function(){var A,C,D;return ta(function(E){switch(E.h){case 1:C=
A=void 0;case 2:if(!(u<m)){E.h=4;break}C=a[u];return t?F(E,X(v,C,t),8):F(E,X(v,C),7);case 7:A=E.G;A=hb(A,d,g,v.resolution,b,e,1===m);E.h=6;break;case 8:A=E.G,A=hb(A,d,g,v.na,b,e,2===m),g&&!1===A&&d.length||(t=C);case 6:if(A)return E.return(A);if(g&&u===m-1){D=d.length;if(!D){if(t){t="";u=-1;E.h=3;break}return E.return(d)}if(1===D)return E.return(h?V(d[0],b,e):new W(d[0]))}case 3:u++;E.h=2;break;case 4:return E.return(h?eb(d,b,e,g):new W(d[0]))}})}()}for(k=f=void 0;u<m;u++){k=a[u];t?(f=X(this,k,t), A=void 0;case 2:if(!(u<m)){E.h=4;break}C=a[u];return t?F(E,W(v,C,t),8):F(E,W(v,C),7);case 7:A=E.G;A=fb(A,d,h,v.resolution,b,e,1===m);E.h=6;break;case 8:A=E.G,A=fb(A,d,h,v.na,b,e,2===m),h&&!1===A&&d.length||(t=C);case 6:if(A)return E.return(A);if(h&&u===m-1){D=d.length;if(!D){if(t){t="";u=-1;E.h=3;break}return E.return(d)}if(1===D)return E.return(g?U(d[0],b,e):new V(d[0]))}case 3:u++;E.h=2;break;case 4:return E.return(g?cb(d,b,e,h):new V(d[0]))}})}()}for(k=f=void 0;u<m;u++){k=a[u];t?(f=W(this,k,t),
f=hb(f,d,g,this.na,b,e,2===m),g&&!1===f&&d.length||(t=k)):(f=X(this,k),f=hb(f,d,g,this.resolution,b,e,1===m));if(f)return f;if(g&&u===m-1){f=d.length;if(!f){if(t){t="";u=-1;continue}return d}if(1===f)return h?V(d[0],b,e):new W(d[0])}}return h?eb(d,b,e,g):new W(d[0])};function gb(a,b,c,d,e,h,f){a=X(this,a,b,c,d,e,h,f);return this.db?a.then(function(g){return e?g:g&&g.length?e?V(g,c,d):new W(g):e?[]:new W([])}):a&&a.length?e?V(a,c,d):new W(a):e?[]:new W([])} f=fb(f,d,h,this.na,b,e,2===m),h&&!1===f&&d.length||(t=k)):(f=W(this,k),f=fb(f,d,h,this.resolution,b,e,1===m));if(f)return f;if(h&&u===m-1){f=d.length;if(!f){if(t){t="";u=-1;continue}return d}if(1===f)return g?U(d[0],b,e):new V(d[0])}}return g?cb(d,b,e,h):new V(d[0])};function eb(a,b,c,d,e,g,f){a=W(this,a,b,c,d,e,g,f);return this.db?a.then(function(h){return e?h:h&&h.length?e?U(h,c,d):new V(h):e?[]:new V([])}):a&&a.length?e?U(a,c,d):new V(a):e?[]:new V([])}
function hb(a,b,c,d,e,h,f){var g=[];if(a){d=Math.min(a.length,d);for(var k=0,l=0,m;k<d;k++)if(m=a[k])if(h&&m&&f&&(m.length<=h?(h-=m.length,m=null):(m=m.slice(h),h=0)),m&&(g[k]=m,f&&(l+=m.length,l>=e)))break;if(g.length){if(f)return V(g,e,0);b.push(g);return}}return!c&&g}function X(a,b,c,d,e,h,f,g){var k;c&&(k=a.bidirectional&&b>c);if(a.db)return c?a.db.get(k?c:b,k?b:c,d,e,h,f,g):a.db.get(b,"",d,e,h,f,g);a=c?(a=a.M.get(k?b:c))&&a.get(k?c:b):a.map.get(b);return a};U.prototype.remove=function(a,b){var c=this.B.size&&(this.fastupdate?this.B.get(a):this.B.has(a));if(c){if(this.fastupdate)for(var d=0,e;d<c.length;d++){if(e=c[d])if(2>e.length)e.pop();else{var h=e.indexOf(a);h===c.length-1?e.pop():e.splice(h,1)}}else ib(this.map,a),this.depth&&ib(this.M,a);b||this.B.delete(a)}this.db&&(this.X.push({del:a}),this.qa&&Ya(this));this.cache&&this.cache.remove(a);return this}; function fb(a,b,c,d,e,g,f){var h=[];if(a){d=Math.min(a.length,d);for(var k=0,l=0,m;k<d;k++)if(m=a[k])if(g&&m&&f&&(m.length<=g?(g-=m.length,m=null):(m=m.slice(g),g=0)),m&&(h[k]=m,f&&(l+=m.length,l>=e)))break;if(h.length){if(f)return U(h,e,0);b.push(h);return}}return!c&&h}function W(a,b,c,d,e,g,f,h){var k;c&&(k=a.bidirectional&&b>c);if(a.db)return c?a.db.get(k?c:b,k?b:c,d,e,g,f,h):a.db.get(b,"",d,e,g,f,h);a=c?(a=a.M.get(k?b:c))&&a.get(k?c:b):a.map.get(b);return a};T.prototype.remove=function(a,b){var c=this.B.size&&(this.fastupdate?this.B.get(a):this.B.has(a));if(c){if(this.fastupdate)for(var d=0,e;d<c.length;d++){if(e=c[d])if(2>e.length)e.pop();else{var g=e.indexOf(a);g===c.length-1?e.pop():e.splice(g,1)}}else gb(this.map,a),this.depth&&gb(this.M,a);b||this.B.delete(a)}this.db&&(this.X.push({del:a}),this.qa&&Wa(this));this.cache&&this.cache.remove(a);return this};
function ib(a,b){var c=0;if(a.constructor===Array)for(var d=0,e=void 0,h;d<a.length;d++){if((e=a[d])&&e.length)if(h=e.indexOf(b),0<=h){1<e.length?(e.splice(h,1),c++):delete a[d];break}else c++}else for(d=y(a),e=d.next();!e.done;e=d.next())h=e.value,e=h[0],(h=ib(h[1],b))?c+=h:a.delete(e);return c};function U(a,b){if(!(this instanceof U))return new U(a);if(a){var c=J(a)?a:a.preset;c&&(a=Object.assign({},Ta[c],a))}else a={};c=a.context||{};var d=a.encode||a.encoder||Sa;this.encoder=d.encode?d:"object"===typeof d?new M(d):{encode:d};var e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&c.depth||0;this.bidirectional=!1!==c.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;(e=a.keystore||0)&&(this.keystore=e);this.map=e?new R(e): function gb(a,b){var c=0;if(a.constructor===Array)for(var d=0,e=void 0,g;d<a.length;d++){if((e=a[d])&&e.length)if(g=e.indexOf(b),0<=g){1<e.length?(e.splice(g,1),c++):delete a[d];break}else c++}else for(d=y(a),e=d.next();!e.done;e=d.next())g=e.value,e=g[0],(g=gb(g[1],b))?c+=g:a.delete(e);return c};function T(a,b){if(!(this instanceof T))return new T(a);if(a){var c=J(a)?a:a.preset;c&&(a=Object.assign({},Ra[c],a))}else a={};c=a.context||{};var d=a.encode||a.encoder||Qa;this.encoder=d.encode?d:"object"===typeof d?new M(d):{encode:d};var e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&c.depth||0;this.bidirectional=!1!==c.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;(e=a.keystore||0)&&(this.keystore=e);this.map=e?new R(e):
new Map;this.M=e?new R(e):new Map;this.B=b||(this.fastupdate?e?new R(e):new Map:e?new S(e):new Set);this.na=c.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new N(e);this.resolve=!1!==a.resolve;if(e=a.db)this.db=e.mount(this);this.qa=!1!==a.commit;this.X=[];this.h=null}w=U.prototype;w.mount=function(a){this.h&&(clearTimeout(this.h),this.h=null);return a.mount(this)};w.commit=function(a,b){this.h&&(clearTimeout(this.h),this.h=null);return this.db.commit(this,a,b)}; new Map;this.M=e?new R(e):new Map;this.B=b||(this.fastupdate?e?new R(e):new Map:e?new S(e):new Set);this.na=c.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new N(e);this.resolve=!1!==a.resolve;if(e=a.db)this.db=e.mount(this);this.qa=!1!==a.commit;this.X=[];this.h=null}w=T.prototype;w.mount=function(a){this.h&&(clearTimeout(this.h),this.h=null);return a.mount(this)};w.commit=function(a,b){this.h&&(clearTimeout(this.h),this.h=null);return this.db.commit(this,a,b)};
function Ya(a){a.h||(a.h=setTimeout(function(){a.h=null;a.db.commit(a,void 0,void 0)},0))}w.clear=function(){this.map.clear();this.M.clear();this.B.clear();this.cache&&this.cache.clear();this.db&&(this.h&&clearTimeout(this.h),this.h=null,this.X=[{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.B.has(a)}; function Wa(a){a.h||(a.h=setTimeout(function(){a.h=null;a.db.commit(a,void 0,void 0)},0))}w.clear=function(){this.map.clear();this.M.clear();this.B.clear();this.cache&&this.cache.clear();this.db&&(this.h&&clearTimeout(this.h),this.h=null,this.X=[{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.B.has(a)};
w.update=function(a,b){if(this.async){var c=this,d=this.remove(a);return d.then?d.then(function(){return c.add(a,b)}):this.add(a,b)}return this.remove(a).add(a,b)};function jb(a){var b=0;if(a.constructor===Array)for(var c=0,d=void 0;c<a.length;c++)(d=a[c])&&(b+=d.length);else for(c=y(a),d=c.next();!d.done;d=c.next()){var e=d.value;d=e[0];(e=jb(e[1]))?b+=e:a.delete(d)}return b}w.cleanup=function(){if(!this.fastupdate)return this;jb(this.map);this.depth&&jb(this.M);return this};w.searchCache=Ja; w.update=function(a,b){if(this.async){var c=this,d=this.remove(a);return d.then?d.then(function(){return c.add(a,b)}):this.add(a,b)}return this.remove(a).add(a,b)};function hb(a){var b=0;if(a.constructor===Array)for(var c=0,d=void 0;c<a.length;c++)(d=a[c])&&(b+=d.length);else for(c=y(a),d=c.next();!d.done;d=c.next()){var e=d.value;d=e[0];(e=hb(e[1]))?b+=e:a.delete(d)}return b}w.cleanup=function(){if(!this.fastupdate)return this;hb(this.map);this.depth&&hb(this.M);return this};w.searchCache=Ia;
w.export=function(a,b,c,d,e,h){var f=!0;"undefined"===typeof h&&(f=new Promise(function(n){h=n}));switch(e||(e=0)){case 0:var g="reg";if(this.fastupdate){var k=I();for(var l=y(this.B.keys()),m=l.next();!m.done;m=l.next())k[m.value]=1}else k=this.B;break;case 1:g="cfg";k={doc:0,opt:this.A?1:0};break;case 2:g="map";k=this.map;break;case 3:g="ctx";k=this.M;break;default:"undefined"===typeof c&&h&&h();return}Qa(a,b||this,c,g,d,e,k,h);return f}; w.export=function(a,b,c,d,e,g){var f=!0;"undefined"===typeof g&&(f=new Promise(function(n){g=n}));switch(e||(e=0)){case 0:var h="reg";if(this.fastupdate){var k=I();for(var l=y(this.B.keys()),m=l.next();!m.done;m=l.next())k[m.value]=1}else k=this.B;break;case 1:h="cfg";k={doc:0,opt:this.A?1:0};break;case 2:h="map";k=this.map;break;case 3:h="ctx";k=this.M;break;default:"undefined"===typeof c&&g&&g();return}Pa(a,b||this,c,h,d,e,k,g);return f};
w.import=function(a,b){if(b)switch(J(b)&&(b=JSON.parse(b)),a){case "cfg":this.A=!!b.opt;break;case "reg":this.fastupdate=!1;this.B=b;break;case "map":this.map=b;break;case "ctx":this.M=b}};Ua(U.prototype);function kb(a){var b,c,d,e,h,f,g,k;return ua(function(l){a=a.data;b=self._index;c=a.args;d=a.task;switch(d){case "init":e=a.options||{};(h=e.config)&&(e=await import(h));(f=a.factory)?(Function("return "+f)()(self),self._index=new self.FlexSearch.Index(e),delete self.FlexSearch):self._index=new U(e);postMessage({id:a.id});break;default:g=a.id,k=b[d].apply(b,c),postMessage("search"===d?{id:g,msg:k}:{id:g})}l.h=0})};var lb=0; w.import=function(a,b){if(b)switch(J(b)&&(b=JSON.parse(b)),a){case "cfg":this.A=!!b.opt;break;case "reg":this.fastupdate=!1;this.B=b;break;case "map":this.map=b;break;case "ctx":this.M=b}};Sa(T.prototype);function ib(a){var b,c,d,e,g,f,h,k;return ta(function(l){a=a.data;b=self._index;c=a.args;d=a.task;switch(d){case "init":e=a.options||{};(g=e.config)&&(e=await import(g));(f=a.factory)?(Function("return "+f)()(self),self._index=new self.FlexSearch.Index(e),delete self.FlexSearch):self._index=new T(e);postMessage({id:a.id});break;default:h=a.id,k=b[d].apply(b,c),postMessage("search"===d?{id:h,msg:k}:{id:h})}l.h=0})};var jb=0;
function Y(a){function b(h){h=h.data||h;var f=h.id,g=f&&e.h[f];g&&(g(h.msg),delete e.h[f])}if(!(this instanceof Y))return new Y(a);a||(a={});var c=(self||window)._factory;c&&(c=c.toString());var d="undefined"===typeof window&&self.exports,e=this;this.worker=mb(c,d,a.worker);this.h=I();if(this.worker){d?this.worker.on("message",b):this.worker.onmessage=b;if(a.config)return new Promise(function(h){e.h[++lb]=function(){h(e)};e.worker.postMessage({id:lb,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",factory:c, function X(a){function b(g){g=g.data||g;var f=g.id,h=f&&e.h[f];h&&(h(g.msg),delete e.h[f])}if(!(this instanceof X))return new X(a);a||(a={});var c=(self||window)._factory;c&&(c=c.toString());var d="undefined"===typeof window&&self.exports,e=this;this.worker=kb(c,d,a.worker);this.h=I();if(this.worker){d?this.worker.on("message",b):this.worker.onmessage=b;if(a.config)return new Promise(function(g){e.h[++jb]=function(){g(e)};e.worker.postMessage({id:jb,task:"init",factory:c,options:a})});this.worker.postMessage({task:"init",factory:c,
options:a})}}nb("add");nb("append");nb("search");nb("update");nb("remove");function nb(a){Y.prototype[a]=Y.prototype[a+"Async"]=function(){var b=this,c=[].slice.call(arguments),d=c[c.length-1];if("function"===typeof d){var e=d;c.splice(c.length-1,1)}d=new Promise(function(h){b.h[++lb]=h;b.worker.postMessage({task:a,id:lb,args:c})});return e?(d.then(e),this):d}} options:a})}}lb("add");lb("append");lb("search");lb("update");lb("remove");function lb(a){X.prototype[a]=X.prototype[a+"Async"]=function(){var b=this,c=[].slice.call(arguments),d=c[c.length-1];if("function"===typeof d){var e=d;c.splice(c.length-1,1)}d=new Promise(function(g){b.h[++jb]=g;b.worker.postMessage({task:a,id:jb,args:c})});return e?(d.then(e),this):d}}
function mb(a,b,c){return b?new (require("worker_threads")["Worker"])(__dirname + "/node/node.js"):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+kb.toString()],{type:"text/javascript"}))):new window.Worker(J(c)?c:"worker/worker.js",{type:"module"})};Z.prototype.add=function(a,b,c){K(a)&&(b=a,a=Aa(b,this.key));if(b&&(a||0===a)){if(!c&&this.B.has(a))return this.update(a,b);for(var d=0,e;d<this.field.length;d++){e=this.T[d];var h=this.index.get(this.field[d]);if("function"===typeof e)(e=e(b))&&h.add(a,e,!1,!0);else{var f=e.aa;if(!f||f(b))e instanceof String?e=[""+e]:J(e)&&(e=[e]),ob(b,e,this.da,0,h,a,e[0],c)}}if(this.tag)for(d=0;d<this.S.length;d++){f=this.S[d];h=this.tag.get(this.ma[d]);e=I();if("function"===typeof f){if(f=f(b),!f)continue}else{var g= function kb(a,b,c){return b?new (require("worker_threads")["Worker"])(__dirname + "/node/node.js"):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+ib.toString()],{type:"text/javascript"}))):new window.Worker(J(c)?c:"worker/worker.js",{type:"module"})};Y.prototype.add=function(a,b,c){K(a)&&(b=a,a=za(b,this.key));if(b&&(a||0===a)){if(!c&&this.B.has(a))return this.update(a,b);for(var d=0,e;d<this.field.length;d++){e=this.T[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.aa;if(!f||f(b))e instanceof String?e=[""+e]:J(e)&&(e=[e]),mb(b,e,this.da,0,g,a,e[0],c)}}if(this.tag)for(d=0;d<this.S.length;d++){f=this.S[d];g=this.tag.get(this.ma[d]);e=I();if("function"===typeof f){if(f=f(b),!f)continue}else{var h=
f.aa;if(g&&!g(b))continue;f instanceof String&&(f=""+f);f=Aa(b,f)}if(h&&f){J(f)&&(f=[f]);g=0;for(var k,l=void 0;g<f.length;g++)if(k=f[g],!e[k]){e[k]=1;var m;(m=h.get(k))?l=m:h.set(k,l=[]);if(!c||!l.includes(a)){if(l.length===Math.pow(2,31)-1){m=new Q(l);if(this.fastupdate)for(var n=y(this.B.values()),p=n.next();!p.done;p=n.next())p=p.value,p.includes(l)&&(p[p.indexOf(l)]=m);h.set(k,l=m)}l.push(a);this.fastupdate&&((k=this.B.get(a))?k.push(l):this.B.set(a,[l]))}}}}if(this.store&&(!c||!this.store.has(a))){if(this.L){var q= f.aa;if(h&&!h(b))continue;f instanceof String&&(f=""+f);f=za(b,f)}if(g&&f){J(f)&&(f=[f]);h=0;for(var k,l=void 0;h<f.length;h++)if(k=f[h],!e[k]){e[k]=1;var m;(m=g.get(k))?l=m:g.set(k,l=[]);if(!c||!l.includes(a)){if(l.length===Math.pow(2,31)-1){m=new Q(l);if(this.fastupdate)for(var n=y(this.B.values()),p=n.next();!p.done;p=n.next())p=p.value,p.includes(l)&&(p[p.indexOf(l)]=m);g.set(k,l=m)}l.push(a);this.fastupdate&&((k=this.B.get(a))?k.push(l):this.B.set(a,[l]))}}}}if(this.store&&(!c||!this.store.has(a))){if(this.L){var q=
I();for(c=0;c<this.L.length;c++)if(d=this.L[c],h=d.aa,!h||h(b)){h=void 0;if("function"===typeof d){h=d(b);if(!h)continue;d=[d.Aa]}else if(J(d)||d instanceof String){q[d]=b[d];continue}pb(b,q,d,0,d[0],h)}}this.store.set(a,q||b)}}return this};function pb(a,b,c,d,e,h){a=a[e];if(d===c.length-1)b[e]=h||a;else if(a)if(a.constructor===Array)for(b=b[e]=Array(a.length),e=0;e<a.length;e++)pb(a,b,c,d,e);else b=b[e]||(b[e]=I()),e=c[++d],pb(a,b,c,d,e)} I();for(c=0;c<this.L.length;c++)if(d=this.L[c],g=d.aa,!g||g(b)){g=void 0;if("function"===typeof d){g=d(b);if(!g)continue;d=[d.Aa]}else if(J(d)||d instanceof String){q[d]=b[d];continue}nb(b,q,d,0,d[0],g)}}this.store.set(a,q||b)}}return this};function nb(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++)nb(a,b,c,d,e);else b=b[e]||(b[e]=I()),e=c[++d],nb(a,b,c,d,e)}
function ob(a,b,c,d,e,h,f,g){if(a=a[f])if(d===b.length-1){if(a.constructor===Array){if(c[d]){for(b=0;b<a.length;b++)e.add(h,a[b],!0,!0);return}a=a.join(" ")}e.add(h,a,g,!0)}else if(a.constructor===Array)for(f=0;f<a.length;f++)ob(a,b,c,d,e,h,f,g);else f=b[++d],ob(a,b,c,d,e,h,f,g);else e.db&&e.remove(h)};Z.prototype.search=function(a,b,c,d){c||(!b&&K(a)?(c=a,a=""):K(b)&&(c=b,b=0));var e=[],h=[],f=0;if(c)if(c.constructor===Array){var g=c;c=null}else{a=c.query||a;var k=c.pluck;var l=c.merge;g=k||c.field||c.index;var m=this.tag&&c.tag;var n=this.store&&c.enrich;var p=c.suggest;b=c.limit||b;var q=c.offset||0;b||(b=100);if(m&&(!this.db||!d)){m.constructor!==Array&&(m=[m]);for(var r=[],x=0,u=void 0;x<m.length;x++)if(u=m[x],u.field&&u.tag){var t=u.tag;if(t.constructor===Array)for(var v=0;v<t.length;v++)r.push(u.field, function mb(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++)mb(a,b,c,d,e,g,f,h);else f=b[++d],mb(a,b,c,d,e,g,f,h);else e.db&&e.remove(g)};Y.prototype.search=function(a,b,c,d){c||(!b&&K(a)?(c=a,a=""):K(b)&&(c=b,b=0));var e=[],g=[],f=0;if(c)if(c.constructor===Array){var h=c;c=null}else{a=c.query||a;var k=c.pluck;var l=c.merge;h=k||c.field||c.index;var m=this.tag&&c.tag;var n=this.store&&c.enrich;var p=c.suggest;b=c.limit||b;var q=c.offset||0;b||(b=100);if(m&&(!this.db||!d)){m.constructor!==Array&&(m=[m]);for(var r=[],x=0,u=void 0;x<m.length;x++)if(u=m[x],u.field&&u.tag){var t=u.tag;if(t.constructor===Array)for(var v=0;v<t.length;v++)r.push(u.field,
t[v]);else r.push(u.field,t)}else{t=Object.keys(u);v=0;for(var A=void 0,C=void 0;v<t.length;v++)if(A=t[v],C=u[A],C.constructor===Array)for(var D=0;D<C.length;D++)r.push(A,C[D]);else r.push(A,C)}m=r;if(!a){h=[];if(r.length)for(k=0;k<r.length;k+=2){p=void 0;if(this.db){p=this.index.get(r[k]);if(!p)continue;h.push(p=p.db.tag(r[k+1],b,q,n))}else p=qb.call(this,r[k],r[k+1],b,q,n);e.push({field:r[k],tag:r[k+1],result:p})}return h.length?Promise.all(h).then(function(O){for(var P=0;P<O.length;P++)e[P].result= t[v]);else r.push(u.field,t)}else{t=Object.keys(u);v=0;for(var A=void 0,C=void 0;v<t.length;v++)if(A=t[v],C=u[A],C.constructor===Array)for(var D=0;D<C.length;D++)r.push(A,C[D]);else r.push(A,C)}m=r;if(!a){g=[];if(r.length)for(k=0;k<r.length;k+=2){p=void 0;if(this.db){p=this.index.get(r[k]);if(!p)continue;g.push(p=p.db.tag(r[k+1],b,q,n))}else p=ob.call(this,r[k],r[k+1],b,q,n);e.push({field:r[k],tag:r[k+1],result:p})}return g.length?Promise.all(g).then(function(O){for(var P=0;P<O.length;P++)e[P].result=
O[P];return e}):e}}J(g)&&(g=[g])}g||(g=this.field);r=!d&&(this.worker||this.async)&&[];x=0;for(v=u=t=void 0;x<g.length;x++)if(u=g[x],!this.db||!this.tag||this.T[x]){t=void 0;J(u)||(t=u,u=t.field,a=t.query||a,b=t.limit||b,p=t.suggest||p);if(d)t=d[x];else{v=t||c;t=this.index.get(u);if(m){if(this.db){v.tag=m;var E=t.db.Fa;v.field=g}E||(v.enrich=!1)}if(r){r[x]=t.searchAsync(a,b,v);v&&n&&(v.enrich=n);continue}else t=t.search(a,b,v),v&&n&&(v.enrich=n)}v=t&&t.length;if(m&&v){A=[];C=0;if(this.db&&d){if(!E)for(D= O[P];return e}):e}}J(h)&&(h=[h])}h||(h=this.field);r=!d&&(this.worker||this.async)&&[];x=0;for(v=u=t=void 0;x<h.length;x++)if(u=h[x],!this.db||!this.tag||this.T[x]){t=void 0;J(u)||(t=u,u=t.field,a=t.query||a,b=t.limit||b,p=t.suggest||p);if(d)t=d[x];else{v=t||c;t=this.index.get(u);if(m){if(this.db){v.tag=m;var E=t.db.Fa;v.field=h}E||(v.enrich=!1)}if(r){r[x]=t.searchAsync(a,b,v);v&&n&&(v.enrich=n);continue}else t=t.search(a,b,v),v&&n&&(v.enrich=n)}v=t&&t.length;if(m&&v){A=[];C=0;if(this.db&&d){if(!E)for(D=
g.length;D<d.length;D++){var L=d[D];if(L&&L.length)C++,A.push(L);else if(!p)return e}}else{D=0;for(var Fb=L=void 0;D<m.length;D+=2){L=this.tag.get(m[D]);if(!L)if(p)continue;else return e;if(Fb=(L=L&&L.get(m[D+1]))&&L.length)C++,A.push(L);else if(!p)return e}}if(C){t=fb(t,A);v=t.length;if(!v&&!p)return e;C--}}if(v)h[f]=u,e.push(t),f++;else if(1===g.length)return e}if(r){if(this.db&&m&&m.length&&!E)for(n=0;n<m.length;n+=2){h=this.index.get(m[n]);if(!h)if(p)continue;else return e;r.push(h.db.tag(m[n+ h.length;D<d.length;D++){var L=d[D];if(L&&L.length)C++,A.push(L);else if(!p)return e}}else{D=0;for(var Db=L=void 0;D<m.length;D+=2){L=this.tag.get(m[D]);if(!L)if(p)continue;else return e;if(Db=(L=L&&L.get(m[D+1]))&&L.length)C++,A.push(L);else if(!p)return e}}if(C){t=db(t,A);v=t.length;if(!v&&!p)return e;C--}}if(v)g[f]=u,e.push(t),f++;else if(1===h.length)return e}if(r){if(this.db&&m&&m.length&&!E)for(n=0;n<m.length;n+=2){g=this.index.get(m[n]);if(!g)if(p)continue;else return e;r.push(g.db.tag(m[n+
1],b,q,!1))}var Gb=this;return Promise.all(r).then(function(O){return O.length?Gb.search(a,b,c,O):O})}if(!f)return e;if(k&&(!n||!this.store))return e[0];r=[];q=0;for(p=void 0;q<h.length;q++){p=e[q];n&&p.length&&!p[0].doc&&(this.db?r.push(p=this.index.get(this.field[0]).db.enrich(p)):p.length&&(p=rb.call(this,p)));if(k)return p;e[q]={field:h[q],result:p}}return n&&this.db&&r.length?Promise.all(r).then(function(O){for(var P=0;P<O.length;P++)e[P].result=O[P];return l?sb(e,b):e}):l?sb(e,b):e}; 1],b,q,!1))}var Eb=this;return Promise.all(r).then(function(O){return O.length?Eb.search(a,b,c,O):O})}if(!f)return e;if(k&&(!n||!this.store))return e[0];r=[];q=0;for(p=void 0;q<g.length;q++){p=e[q];n&&p.length&&!p[0].doc&&(this.db?r.push(p=this.index.get(this.field[0]).db.enrich(p)):p.length&&(p=pb.call(this,p)));if(k)return p;e[q]={field:g[q],result:p}}return n&&this.db&&r.length?Promise.all(r).then(function(O){for(var P=0;P<O.length;P++)e[P].result=O[P];return l?qb(e,b):e}):l?qb(e,b):e};
function sb(a,b){for(var c=[],d=I(),e=0,h,f;e<a.length;e++){h=a[e];f=h.result;for(var g=0,k,l,m;g<f.length;g++)if(l=f[g],k=l.id,m=d[k])m.push(h.field);else{if(c.length===b)return c;l.field=d[k]=[h.field];c.push(l)}}return c}function qb(a,b,c,d,e){a=this.tag.get(a);if(!a)return[];if((b=(a=a&&a.get(b))&&a.length-d)&&0<b){if(b>c||d)a=a.slice(d,d+c);e&&(a=rb.call(this,a));return a}}function rb(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 Z(a){if(!(this instanceof Z))return new Z(a);var b=a.document||a.doc||a,c,d;this.T=[];this.field=[];this.da=[];this.key=(c=b.key||b.id)&&tb(c,this.da)||"id";(d=a.keystore||0)&&(this.keystore=d);this.B=(this.fastupdate=!!a.fastupdate)?d?new R(d):new Map:d?new S(d):new Set;this.L=(c=b.store||null)&&!0!==c&&[];this.store=c&&(d?new R(d):new Map);this.cache=(c=a.cache||null)&&new N(c);a.cache=!1;this.worker=a.worker;this.async=!1;c=new Map;d=b.index||b.field||b;J(d)&&(d=[d]);for(var e=0,h,f=void 0;e< function qb(a,b){for(var c=[],d=I(),e=0,g,f;e<a.length;e++){g=a[e];f=g.result;for(var h=0,k,l,m;h<f.length;h++)if(l=f[h],k=l.id,m=d[k])m.push(g.field);else{if(c.length===b)return c;l.field=d[k]=[g.field];c.push(l)}}return c}function ob(a,b,c,d,e){a=this.tag.get(a);if(!a)return[];if((b=(a=a&&a.get(b))&&a.length-d)&&0<b){if(b>c||d)a=a.slice(d,d+c);e&&(a=pb.call(this,a));return a}}function pb(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 Y(a){if(!(this instanceof Y))return new Y(a);var b=a.document||a.doc||a,c,d;this.T=[];this.field=[];this.da=[];this.key=(c=b.key||b.id)&&rb(c,this.da)||"id";(d=a.keystore||0)&&(this.keystore=d);this.B=(this.fastupdate=!!a.fastupdate)?d?new R(d):new Map:d?new S(d):new Set;this.L=(c=b.store||null)&&!0!==c&&[];this.store=c&&(d?new R(d):new Map);this.cache=(c=a.cache||null)&&new N(c);a.cache=!1;this.worker=a.worker;this.async=!1;c=new Map;d=b.index||b.field||b;J(d)&&(d=[d]);for(var e=0,g,f=void 0;e<
d.length;e++){h=d[e];J(h)||(f=h,h=h.field);f=K(f)?Object.assign({},a,f):a;if(this.worker){var g=new Y(f);c.set(h,g);g.worker||(this.worker=!1)}this.worker||c.set(h,new U(f,this.B));f.Y?this.T[e]=f.Y:(this.T[e]=tb(h,this.da),f.filter&&("string"===typeof this.T[e]&&(this.T[e]=new String(this.T[e])),this.T[e].aa=f.filter));this.field[e]=h}if(this.L)for(d=b.store,J(d)&&(d=[d]),e=0;e<d.length;e++)h=d[e],f=h.field||h,h.Y?(this.L[e]=h.Y,h.Y.Aa=f):(this.L[e]=tb(f,this.da),h.filter&&("string"===typeof this.L[e]&& d.length;e++){g=d[e];J(g)||(f=g,g=g.field);f=K(f)?Object.assign({},a,f):a;if(this.worker){var h=new X(f);c.set(g,h);h.worker||(this.worker=!1)}this.worker||c.set(g,new T(f,this.B));f.Y?this.T[e]=f.Y:(this.T[e]=rb(g,this.da),f.filter&&("string"===typeof this.T[e]&&(this.T[e]=new String(this.T[e])),this.T[e].aa=f.filter));this.field[e]=g}if(this.L)for(d=b.store,J(d)&&(d=[d]),e=0;e<d.length;e++)g=d[e],f=g.field||g,g.Y?(this.L[e]=g.Y,g.Y.Aa=f):(this.L[e]=rb(f,this.da),g.filter&&("string"===typeof this.L[e]&&
(this.L[e]=new String(this.L[e])),this.L[e].aa=h.filter));this.index=c;this.tag=null;if(c=b.tag)if("string"===typeof c&&(c=[c]),c.length)for(this.tag=new Map,this.S=[],this.ma=[],b=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.Y?this.S[b]=d.Y:(this.S[b]=tb(e,this.da),d.filter&&("string"===typeof this.S[b]&&(this.S[b]=new String(this.S[b])),this.S[b].aa=d.filter));this.ma[b]=e;this.tag.set(e,new Map)}a.db&&this.mount(a.db)}w=Z.prototype; (this.L[e]=new String(this.L[e])),this.L[e].aa=g.filter));this.index=c;this.tag=null;if(c=b.tag)if("string"===typeof c&&(c=[c]),c.length)for(this.tag=new Map,this.S=[],this.ma=[],b=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.Y?this.S[b]=d.Y:(this.S[b]=rb(e,this.da),d.filter&&("string"===typeof this.S[b]&&(this.S[b]=new String(this.S[b])),this.S[b].aa=d.filter));this.ma[b]=e;this.tag.set(e,new Map)}a.db&&this.mount(a.db)}w=Y.prototype;
w.mount=function(a){var b=this.field;if(this.tag)for(var c=0,d;c<this.ma.length;c++){d=this.ma[c];var e=this.index.get(d);e||(this.index.set(d,e=new U({},this.B)),b===this.field&&(b=b.slice(0)),b.push(d));e.tag=this.tag.get(d)}c=[];d={db:a.db,type:a.type,fastupdate:a.fastupdate};e=0;for(var h;e<b.length;e++){d.field=h=b[e];h=this.index.get(h);var f=new a.constructor(a.id,d);f.id=a.id;c[e]=f.mount(h);h.document=!0;e?h.Ba=!0:h.store=this.store}this.db=this.async=!0;return Promise.all(c)}; w.mount=function(a){var b=this.field;if(this.tag)for(var c=0,d;c<this.ma.length;c++){d=this.ma[c];var e=this.index.get(d);e||(this.index.set(d,e=new T({},this.B)),b===this.field&&(b=b.slice(0)),b.push(d));e.tag=this.tag.get(d)}c=[];d={db:a.db,type:a.type,fastupdate:a.fastupdate};e=0;for(var g;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.Ba=!0:g.store=this.store}this.db=this.async=!0;return Promise.all(c)};
w.commit=function(a,b){var c=this,d,e,h,f;return ua(function(g){if(1==g.h){d=[];e=y(c.index.values());for(h=e.next();!h.done;h=e.next())f=h.value,d.push(f.db.commit(f,a,b));return F(g,Promise.all(d),2)}c.B.clear();g.h=0})};function tb(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.commit=function(a,b){var c=this,d,e,g,f;return ta(function(h){if(1==h.h){d=[];e=y(c.index.values());for(g=e.next();!g.done;g=e.next())f=g.value,d.push(f.db.commit(f,a,b));return F(h,Promise.all(d),2)}c.B.clear();h.h=0})};function rb(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.update=function(a,b){return this.remove(a).add(a,b)};
w.remove=function(a){K(a)&&(a=Aa(a,this.key));for(var b=y(this.index.values()),c=b.next();!c.done;c=b.next())c.value.remove(a,!0);if(this.B.has(a)){if(this.tag&&!this.fastupdate)for(b=y(this.tag.values()),c=b.next();!c.done;c=b.next()){c=c.value;for(var d=y(c),e=d.next();!e.done;e=d.next()){var h=e.value;e=h[0];h=h[1];var f=h.indexOf(a);-1<f&&(1<h.length?h.splice(f,1):c.delete(e))}}this.store&&this.store.delete(a);this.B.delete(a)}this.cache&&this.cache.remove(a);return this}; w.remove=function(a){K(a)&&(a=za(a,this.key));for(var b=y(this.index.values()),c=b.next();!c.done;c=b.next())c.value.remove(a,!0);if(this.B.has(a)){if(this.tag&&!this.fastupdate)for(b=y(this.tag.values()),c=b.next();!c.done;c=b.next()){c=c.value;for(var d=y(c),e=d.next();!e.done;e=d.next()){var 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.B.delete(a)}this.cache&&this.cache.remove(a);return this};
w.clear=function(){for(var a=y(this.index.values()),b=a.next();!b.done;b=a.next())b.value.clear();if(this.tag)for(a=y(this.tag.values()),b=a.next();!b.done;b=a.next())b.value.clear();this.store&&this.store.clear();return this};w.contain=function(a){return this.db?this.index.get(this.field[0]).db.has(a):this.B.has(a)};w.cleanup=function(){for(var a=y(this.index.values()),b=a.next();!b.done;b=a.next())b.value.cleanup();return this}; w.clear=function(){for(var a=y(this.index.values()),b=a.next();!b.done;b=a.next())b.value.clear();if(this.tag)for(a=y(this.tag.values()),b=a.next();!b.done;b=a.next())b.value.clear();this.store&&this.store.clear();return this};w.contain=function(a){return this.db?this.index.get(this.field[0]).db.has(a):this.B.has(a)};w.cleanup=function(){for(var a=y(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}):this.store.get(a)};w.set=function(a,b){this.store.set(a,b);return this};w.searchCache=Ja; 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}):this.store.get(a)};w.set=function(a,b){this.store.set(a,b);return this};w.searchCache=Ia;
w.export=function(a,b,c,d,e,h){var f;"undefined"===typeof h&&(f=new Promise(function(k){h=k}));e||(e=0);d||(d=0);if(d<this.field.length){c=this.field[d];var g=this.index[c];b=this;g.export(a,b,e?c:"",d,e++,h)||(d++,b.export(a,b,c,d,1,h))}else{switch(e){case 1:b="tag";g=this.h;c=null;break;case 2:b="store";g=this.store;c=null;break;default:h();return}Qa(a,this,c,b,d,e,g,h)}return f}; w.export=function(a,b,c,d,e,g){var f;"undefined"===typeof g&&(f=new Promise(function(k){g=k}));e||(e=0);d||(d=0);if(d<this.field.length){c=this.field[d];var h=this.index[c];b=this;h.export(a,b,e?c:"",d,e++,g)||(d++,b.export(a,b,c,d,1,g))}else{switch(e){case 1:b="tag";h=this.h;c=null;break;case 2:b="store";h=this.store;c=null;break;default:g();return}Pa(a,this,c,b,d,e,h,g)}return f};
w.import=function(a,b){if(b)switch(J(b)&&(b=JSON.parse(b)),a){case "tag":this.h=b;break;case "reg":this.fastupdate=!1;this.B=b;a=0;for(var c;a<this.field.length;a++)c=this.index[this.field[a]],c.B=b,c.fastupdate=!1;break;case "store":this.store=b;break;default:a=a.split("."),c=a[0],a=a[1],c&&a&&this.index[c].import(a,b)}};Ua(Z.prototype);var ub="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),vb=["map","ctx","tag","reg","cfg"]; w.import=function(a,b){if(b)switch(J(b)&&(b=JSON.parse(b)),a){case "tag":this.h=b;break;case "reg":this.fastupdate=!1;this.B=b;a=0;for(var c;a<this.field.length;a++)c=this.index[this.field[a]],c.B=b,c.fastupdate=!1;break;case "store":this.store=b;break;default:a=a.split("."),c=a[0],a=a[1],c&&a&&this.index[c].import(a,b)}};Sa(Y.prototype);var sb="undefined"!==typeof window&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),tb=["map","ctx","tag","reg","cfg"];
function wb(a,b){b=void 0===b?{}:b;if(!(this instanceof wb))return new wb(a,b);"object"===typeof a&&(b=a=a.name);a||console.info("Default storage space was used, because a name was not passed.");this.id="flexsearch"+(a?":"+a.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"");this.field=b.field?b.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"";this.Fa=!1;this.db=null;this.h={}}w=wb.prototype;w.mount=function(a){if(a instanceof Z)return a.mount(this);a.db=this;return xb(this)}; function ub(a,b){b=void 0===b?{}:b;if(!(this instanceof ub))return new ub(a,b);"object"===typeof a&&(b=a=a.name);a||console.info("Default storage space was used, because a name was not passed.");this.id="flexsearch"+(a?":"+a.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"");this.field=b.field?b.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"";this.Fa=!1;this.db=null;this.h={}}w=ub.prototype;w.mount=function(a){if(a instanceof Y)return a.mount(this);a.db=this;return vb(this)};
function xb(a){navigator.storage&&navigator.storage.persist();return a.db||new Promise(function(b,c){var d=ub.open(a.id+(a.field?":"+a.field:""),1);d.onupgradeneeded=function(){var e=a.db=this.result;vb.forEach(function(h){e.objectStoreNames.contains(h)||e.createObjectStore(h)})};d.onblocked=function(e){console.error("blocked",e);c()};d.onerror=function(e){console.error(this.error,e);c()};d.onsuccess=function(){a.db=this.result;a.db.onversionchange=function(){a.close()};b(a)}})} function vb(a){navigator.storage&&navigator.storage.persist();return a.db||new Promise(function(b,c){var d=sb.open(a.id+(a.field?":"+a.field:""),1);d.onupgradeneeded=function(){var e=a.db=this.result;tb.forEach(function(g){e.objectStoreNames.contains(g)||e.createObjectStore(g)})};d.onblocked=function(e){console.error("blocked",e);c()};d.onerror=function(e){console.error(this.error,e);c()};d.onsuccess=function(){a.db=this.result;a.db.onversionchange=function(){a.close()};b(a)}})}
w.close=function(){this.db.close();this.db=null};w.clear=function(){for(var a=this.db.transaction(vb,"readwrite"),b=0;b<vb.length;b++)a.objectStore(vb[b]).clear();return yb(a)}; w.close=function(){this.db.close();this.db=null};w.clear=function(){for(var a=this.db.transaction(tb,"readwrite"),b=0;b<tb.length;b++)a.objectStore(tb[b]).clear();return wb(a)};
w.get=function(a,b,c,d,e,h){c=void 0===c?0:c;d=void 0===d?0:d;e=void 0===e?!0:e;h=void 0===h?!1:h;a=this.db.transaction(b?"ctx":"map","readonly").objectStore(b?"ctx":"map").get(b?b+":"+a:a);var f=this;return yb(a).then(function(g){var k=[];if(!g||!g.length)return k;if(e){if(!c&&!d&&1===g.length)return g[0];for(var l=0,m=void 0;l<g.length;l++)if((m=g[l])&&m.length)if(d>=m.length)d-=m.length;else{for(var n=c?d+Math.min(m.length-d,c):m.length,p=d;p<n;p++)k.push(m[p]);d=0;if(k.length===c)break}return h? 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","readonly").objectStore(b?"ctx":"map").get(b?b+":"+a:a);var f=this;return wb(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 n=c?d+Math.min(m.length-d,c):m.length,p=d;p<n;p++)k.push(m[p]);d=0;if(k.length===c)break}return g?
f.enrich(k):k}return g})};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","readonly").objectStore("tag").get(a);var e=this;return yb(a).then(function(h){if(!h||!h.length||c>=h.length)return[];if(!b&&!c)return h;h=h.slice(c,c+b);return d?e.enrich(h):h})}; 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","readonly").objectStore("tag").get(a);var e=this;return wb(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]=yb(b.get(a[d]));return Promise.all(c).then(function(e){for(var h=0;h<e.length;h++)e[h]={id:a[h],doc:e[h]?JSON.parse(e[h]):null};return e})};w.has=function(a){a=this.db.transaction("reg","readonly").objectStore("reg").getKey(a);return yb(a)};w.search=null;w.info=function(){}; 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]=wb(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 wb(a)};w.search=null;w.info=function(){};
w.transaction=function(a,b,c){var d=this,e=this.h[a+":"+b];if(e)return c.call(this,e);var h=this.db.transaction(a,b);this.h[a+":"+b]=e=h.objectStore(a);return new Promise(function(f,g){h.onerror=function(k){d.h[a+":"+b]=null;h.abort();h=e=null;g(k)};h.oncomplete=function(k){h=e=d.h[a+":"+b]=null;f(k||!0)};return c.call(d,e)})}; w.transaction=function(a,b,c){var d=this,e=this.h[a+":"+b];if(e)return c.call(this,e);var g=this.db.transaction(a,b);this.h[a+":"+b]=e=g.objectStore(a);return new Promise(function(f,h){g.onerror=function(k){d.h[a+":"+b]=null;g.abort();g=e=null;h(k)};g.oncomplete=function(k){g=e=d.h[a+":"+b]=null;f(k||!0)};return c.call(d,e)})};
w.commit=function(a,b,c){var d=this,e,h,f;return ua(function(g){switch(g.h){case 1:if(b)return F(g,d.clear(),12);e=a.X;a.X=[];h=0;f=void 0;case 4:if(!(h<e.length)){g.h=6;break}f=e[h];if(!f.clear){e[h]=f.Ga;g.h=5;break}return F(g,d.clear(),8);case 8:b=!0;g.h=6;break;case 5:h++;g.h=4;break;case 6:if(b){g.h=3;break}c||(e=e.concat(za(a.B)));if(!e.length){g.h=10;break}return F(g,d.remove(e),11);case 11:case 10:g.h=3;break;case 12:a.X=[];case 3:return a.B.size?F(g,d.transaction("map","readwrite",function(k){for(var l= w.commit=function(a,b,c){var d=this,e,g,f;return ta(function(h){switch(h.h){case 1:if(b)return F(h,d.clear(),12);e=a.X;a.X=[];g=0;f=void 0;case 4:if(!(g<e.length)){h.h=6;break}f=e[g];if(!f.clear){e[g]=f.Ga;h.h=5;break}return F(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(ya(a.B)));if(!e.length){h.h=10;break}return F(h,d.remove(e),11);case 11:case 10:h.h=3;break;case 12:a.X=[];case 3:return a.B.size?F(h,d.transaction("map","readwrite",function(k){for(var l=
y(a.map),m=l.next(),n={};!m.done;n={Z:void 0,ia:void 0},m=l.next())m=m.value,n.ia=m[0],n.Z=m[1],n.Z.length&&(b?k.put(n.Z,n.ia):k.get(n.ia).onsuccess=function(p){return function(){var q=this.result,r;if(q&&q.length)for(var x=Math.max(q.length,p.Z.length),u=0,t;u<x;u++){if((t=p.Z[u])&&t.length){if((r=q[u])&&r.length)for(var v=0;v<t.length;v++)r.push(t[v]);else q[u]=t;r=1}}else q=p.Z,r=1;r&&k.put(q,p.ia)}}(n))}),13):g.return();case 13:return F(g,d.transaction("ctx","readwrite",function(k){for(var l= y(a.map),m=l.next(),n={};!m.done;n={Z:void 0,ia:void 0},m=l.next())m=m.value,n.ia=m[0],n.Z=m[1],n.Z.length&&(b?k.put(n.Z,n.ia):k.get(n.ia).onsuccess=function(p){return function(){var q=this.result,r;if(q&&q.length)for(var x=Math.max(q.length,p.Z.length),u=0,t;u<x;u++){if((t=p.Z[u])&&t.length){if((r=q[u])&&r.length)for(var v=0;v<t.length;v++)r.push(t[v]);else q[u]=t;r=1}}else q=p.Z,r=1;r&&k.put(q,p.ia)}}(n))}),13):h.return();case 13:return F(h,d.transaction("ctx","readwrite",function(k){for(var l=
y(a.M),m=l.next(),n={};!m.done;n={ga:void 0},m=l.next()){m=m.value;n.ga=m[0];m=y(m[1]);for(var p=m.next(),q={};!p.done;q={$:void 0,ja:void 0},p=m.next())p=p.value,q.ja=p[0],q.$=p[1],q.$.length&&(b?k.put(q.$,n.ga+":"+q.ja):k.get(n.ga+":"+q.ja).onsuccess=function(r,x){return function(){var u=this.result,t;if(u&&u.length)for(var v=Math.max(u.length,r.$.length),A=0,C;A<v;A++){if((C=r.$[A])&&C.length){if((t=u[A])&&t.length)for(var D=0;D<C.length;D++)t.push(C[D]);else u[A]=C;t=1}}else u=r.$,t=1;t&&k.put(u, y(a.M),m=l.next(),n={};!m.done;n={ga:void 0},m=l.next()){m=m.value;n.ga=m[0];m=y(m[1]);for(var p=m.next(),q={};!p.done;q={$:void 0,ja:void 0},p=m.next())p=p.value,q.ja=p[0],q.$=p[1],q.$.length&&(b?k.put(q.$,n.ga+":"+q.ja):k.get(n.ga+":"+q.ja).onsuccess=function(r,x){return function(){var u=this.result,t;if(u&&u.length)for(var v=Math.max(u.length,r.$.length),A=0,C;A<v;A++){if((C=r.$[A])&&C.length){if((t=u[A])&&t.length)for(var D=0;D<C.length;D++)t.push(C[D]);else u[A]=C;t=1}}else u=r.$,t=1;t&&k.put(u,
x.ga+":"+r.ja)}}(q,n))}}),14);case 14:if(a.store)return F(g,d.transaction("reg","readwrite",function(k){for(var l=y(a.store),m=l.next();!m.done;m=l.next()){var n=m.value;m=n[0];n=n[1];k.put("object"===typeof n?JSON.stringify(n):1,m)}}),16);if(a.Ba){g.h=16;break}return F(g,d.transaction("reg","readwrite",function(k){for(var l=y(a.B.keys()),m=l.next();!m.done;m=l.next())k.put(1,m.value)}),16);case 16:if(!a.tag){g.h=20;break}return F(g,d.transaction("tag","readwrite",function(k){for(var l=y(a.tag),m= x.ga+":"+r.ja)}}(q,n))}}),14);case 14:if(a.store)return F(h,d.transaction("reg","readwrite",function(k){for(var l=y(a.store),m=l.next();!m.done;m=l.next()){var n=m.value;m=n[0];n=n[1];k.put("object"===typeof n?JSON.stringify(n):1,m)}}),16);if(a.Ba){h.h=16;break}return F(h,d.transaction("reg","readwrite",function(k){for(var l=y(a.B.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 F(h,d.transaction("tag","readwrite",function(k){for(var l=y(a.tag),m=
l.next(),n={};!m.done;n={ha:void 0,oa:void 0},m=l.next())m=m.value,n.oa=m[0],n.ha=m[1],n.ha.length&&(k.get(n.oa).onsuccess=function(p){return function(){var q=this.result;q=q&&q.length?q.concat(p.ha):p.ha;k.put(q,p.oa)}}(n))}),20);case 20:a.map.clear(),a.M.clear(),a.tag&&a.tag.clear(),a.store&&a.store.clear(),a.document||a.B.clear(),g.h=0}})}; l.next(),n={};!m.done;n={ha:void 0,oa:void 0},m=l.next())m=m.value,n.oa=m[0],n.ha=m[1],n.ha.length&&(k.get(n.oa).onsuccess=function(p){return function(){var q=this.result;q=q&&q.length?q.concat(p.ha):p.ha;k.put(q,p.oa)}}(n))}),20);case 20:a.map.clear(),a.M.clear(),a.tag&&a.tag.clear(),a.store&&a.store.clear(),a.document||a.B.clear(),h.h=0}})};
function zb(a,b,c){for(var d=a.value,e,h,f=0,g=0,k;g<d.length;g++){if(k=c?d:d[g]){for(var l=0,m,n;l<b.length;l++)if(n=b[l],m=k.indexOf(h?parseInt(n,10):n),0>m&&!h&&"string"===typeof n&&!isNaN(n)&&(m=k.indexOf(parseInt(n,10)))&&(h=1),0<=m)if(e=1,1<k.length)k.splice(m,1);else{d[g]=[];break}f+=k.length}if(c)break}f?e&&a.update(d):a.delete();a.continue()} function xb(a,b,c){for(var d=a.value,e,g,f=0,h=0,k;h<d.length;h++){if(k=c?d:d[h]){for(var l=0,m,n;l<b.length;l++)if(n=b[l],m=k.indexOf(g?parseInt(n,10):n),0>m&&!g&&"string"===typeof n&&!isNaN(n)&&(m=k.indexOf(parseInt(n,10)))&&(g=1),0<=m)if(e=1,1<k.length)k.splice(m,1);else{d[h]=[];break}f+=k.length}if(c)break}f?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&&zb(c,a)}}),this.transaction("ctx","readwrite",function(b){b.openCursor().onsuccess=function(){var c=this.result;c&&zb(c,a)}}),this.transaction("tag","readwrite",function(b){b.openCursor().onsuccess=function(){var c=this.result;c&&zb(c,a,!0)}}),this.transaction("reg","readwrite",function(b){for(var c=0;c<a.length;c++)b.delete(a[c])})])}; 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&&xb(c,a)}}),this.transaction("ctx","readwrite",function(b){b.openCursor().onsuccess=function(){var c=this.result;c&&xb(c,a)}}),this.transaction("tag","readwrite",function(b){b.openCursor().onsuccess=function(){var c=this.result;c&&xb(c,a,!0)}}),this.transaction("reg","readwrite",function(b){for(var c=0;c<a.length;c++)b.delete(a[c])})])};
function yb(a){return new Promise(function(b,c){a.onsuccess=function(){b(this.result)};a.oncomplete=function(){b(this.result)};a.onerror=c;a=null})};var Ab=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"]]),Bb={normalize:!0,H:!0,I:Ab};var Cb=new Map([["ai","ei"],["ae","a"],["oe","o"],["ue","u"],["sh","s"],["ch","c"],["th","t"],["ph","f"],["pf","f"]]),Db=[/([^aeo])h([aeo$])/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2"],Eb={normalize:!0,H:!0,I:Ab,P:Db,N:Cb};var Hb={normalize:!0,H:!0,I:Ab,P:Db.concat([/(?!^)[aeoy]/g,""]),N:Cb};var Ib={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};T["latin:exact"]={normalize:!1,H:!1};T["latin:default"]=Sa;T["latin:simple"]={normalize:!0,H:!0};T["latin:balance"]=Bb;T["latin:advanced"]=Eb;T["latin:extra"]=Hb;T["latin:soundex"]={normalize:!0,H:!1,ra:{Ea:!0},ca:function(a){for(var b=0;b<a.length;b++){for(var c=a[b],d=c.charAt(0),e=Ib[d],h=1,f;h<c.length&&(f=c.charAt(h),"h"===f||"w"===f||!(f=Ib[f])||f===e||(d+=f,e=f,4!==d.length));h++);a[b]=d}}}; function wb(a){return new Promise(function(b,c){a.onsuccess=function(){b(this.result)};a.oncomplete=function(){b(this.result)};a.onerror=c;a=null})};var Z=I();var yb=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"]]),zb={normalize:!0,H:!0,K:yb};var Ab=new Map([["ai","ei"],["ae","a"],["oe","o"],["ue","u"],["sh","s"],["ch","c"],["th","t"],["ph","f"],["pf","f"]]),Bb=[/([^aeo])h([aeo$])/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2"],Cb={normalize:!0,H:!0,K:yb,P:Bb,N:Ab};var Fb={normalize:!0,H:!0,K:yb,P:Bb.concat([/(?!^)[aeoy]/g,""]),N:Ab};var Gb={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};Z["latin:exact"]={normalize:!1,H:!1};Z["latin:default"]=Qa;Z["latin:simple"]={normalize:!0,H:!0};Z["latin:balance"]=zb;Z["latin:advanced"]=Cb;Z["latin:extra"]=Fb;Z["latin:soundex"]={normalize:!0,H:!1,ra:{Ea:!0},ca:function(a){for(var b=0;b<a.length;b++){for(var c=a[b],d=c.charAt(0),e=Gb[d],g=1,f;g<c.length&&(f=c.charAt(g),"h"===f||"w"===f||!(f=Gb[f])||f===e||(d+=f,e=f,4!==d.length));g++);a[b]=d}}};var Hb={Index:T,Charset:Z,Encoder:M,Document:Y,Worker:X,Resolver:V,IndexedDB:ub},Ib=self,Jb;
var Jb={Index:U,Encoder:M,Charset:T,Language:Ra,Document:Z,Worker:Y,Resolver:W,IndexedDB:wb},Kb=self,Lb;(Lb=Kb.define)&&Lb.amd?Lb([],function(){return Jb}):"object"===typeof Kb.exports?Kb.exports=Jb:Kb.FlexSearch=Jb;}(this)); (Jb=Ib.define)&&Jb.amd?Jb([],function(){return Hb}):"object"===typeof Ib.exports?Ib.exports=Hb:Ib.FlexSearch=Hb;}(this));

View File

@@ -6,8 +6,7 @@
* https://github.com/nextapps-de/flexsearch * https://github.com/nextapps-de/flexsearch
*/ */
(function(self){'use strict'; (function(self){'use strict';
var t; function t(a, c, b) {
function u(a, c, b) {
const d = typeof b, e = typeof a; const d = typeof b, e = typeof a;
if ("undefined" !== d) { if ("undefined" !== d) {
if ("undefined" !== e) { if ("undefined" !== e) {
@@ -44,23 +43,23 @@ function u(a, c, b) {
} }
return "undefined" === e ? c : a; return "undefined" === e ? c : a;
} }
function v() { function u() {
return Object.create(null); return Object.create(null);
} }
function w(a, c) { function w(a, c) {
return c.length - a.length; return c.length - a.length;
} }
;const y = /[^\p{L}\p{N}]+/u, z = /(\d{3})/g, A = /(\D)(\d{3})/g, B = /(\d{3})(\D)/g, C = "".normalize && /[\u0300-\u036f]/g; ;const x = /[^\p{L}\p{N}]+/u, y = /(\d{3})/g, z = /(\D)(\d{3})/g, A = /(\d{3})(\D)/g, B = "".normalize && /[\u0300-\u036f]/g;
function D(a = {}) { function C(a = {}) {
if (!(this instanceof D)) { if (!(this instanceof C)) {
return new D(...arguments); return new C(...arguments);
} }
for (a = 0; a < arguments.length; a++) { for (a = 0; a < arguments.length; a++) {
this.assign(arguments[a]); this.assign(arguments[a]);
} }
} }
D.prototype.assign = function(a) { C.prototype.assign = function(a) {
this.normalize = u(a.normalize, !0, this.normalize); this.normalize = t(a.normalize, !0, this.normalize);
let c = a.N, b = c || a.O || a.split; let c = a.N, b = c || a.O || a.split;
if ("object" === typeof b) { if ("object" === typeof b) {
let d = !c, e = ""; let d = !c, e = "";
@@ -76,52 +75,52 @@ D.prototype.assign = function(a) {
this.split = new RegExp("[" + (c ? "^" : "") + e + "]+", "u"); this.split = new RegExp("[" + (c ? "^" : "") + e + "]+", "u");
this.numeric = d; this.numeric = d;
} else { } else {
this.split = u(b, y, this.split), this.numeric = u(this.numeric, !0); this.split = t(b, x, this.split), this.numeric = t(this.numeric, !0);
} }
this.H = u(a.H, null, this.H); this.H = t(a.H, null, this.H);
this.D = u(a.D, null, this.D); this.B = t(a.B, null, this.B);
this.rtl = a.rtl || !1; this.rtl = a.rtl || !1;
this.l = u(a.l, !0, this.l); this.i = t(a.i, !0, this.i);
this.filter = u((b = a.filter) && new Set(b), null, this.filter); this.filter = t((b = a.filter) && new Set(b), null, this.filter);
this.m = u((b = a.m) && new Map(b), null, this.m); this.j = t((b = a.j) && new Map(b), null, this.j);
this.v = u((b = a.v) && new Map(b), null, this.v); this.s = t((b = a.s) && new Map(b), null, this.s);
this.s = u((b = a.s) && new Map(b), null, this.s); this.m = t((b = a.m) && new Map(b), null, this.m);
this.o = u(a.o, null, this.o); this.l = t(a.l, null, this.l);
this.G = u(a.G, 1, this.G); this.G = t(a.G, 1, this.G);
this.K = u(a.K, 0, this.K); this.K = t(a.K, 0, this.K);
if (this.cache = b = u(a.cache, !0, this.cache)) { if (this.cache = b = t(a.cache, !0, this.cache)) {
this.C = null, this.L = "number" === typeof b ? b : 2e5, this.u = new Map(), this.A = new Map(), this.h = this.g = 128; this.A = null, this.L = "number" === typeof b ? b : 2e5, this.o = new Map(), this.u = new Map(), this.C = this.h = 128;
} }
this.i = ""; this.D = "";
this.I = null; this.I = null;
this.F = ""; this.F = "";
this.J = null; this.J = null;
if (this.j) {
for (const d of this.j.keys()) {
this.D += (this.D ? "|" : "") + d;
}
}
if (this.m) { if (this.m) {
for (const d of this.m.keys()) { for (const d of this.m.keys()) {
this.i += (this.i ? "|" : "") + d;
}
}
if (this.s) {
for (const d of this.s.keys()) {
this.F += (this.F ? "|" : "") + d; this.F += (this.F ? "|" : "") + d;
} }
} }
return this; return this;
}; };
D.prototype.encode = function(a) { C.prototype.encode = function(a) {
if (this.cache && a.length <= this.g) { if (this.cache && a.length <= this.h) {
if (this.C) { if (this.A) {
if (this.u.has(a)) { if (this.o.has(a)) {
return this.u.get(a); return this.o.get(a);
} }
} else { } else {
this.C = setTimeout(E, 0, this); this.A = setTimeout(D, 0, this);
} }
} }
this.normalize && (a = "function" === typeof this.normalize ? this.normalize(a) : C ? a.normalize("NFKD").replace(C, "").toLowerCase() : a.toLowerCase()); this.normalize && (a = "function" === typeof this.normalize ? this.normalize(a) : B ? a.normalize("NFKD").replace(B, "").toLowerCase() : a.toLowerCase());
this.H && (a = this.H(a)); this.H && (a = this.H(a));
this.numeric && 3 < a.length && (a = a.replace(A, "$1 $2").replace(B, "$1 $2").replace(z, "$1 ")); this.numeric && 3 < a.length && (a = a.replace(z, "$1 $2").replace(A, "$1 $2").replace(y, "$1 "));
const c = !(this.l || this.v || this.filter || this.m || this.s || this.o); const c = !(this.i || this.s || this.filter || this.j || this.m || this.l);
let b = [], d = this.split || "" === this.split ? a.split(this.split) : a; let b = [], d = this.split || "" === this.split ? a.split(this.split) : a;
for (let g = 0, f, h; g < d.length; g++) { for (let g = 0, f, h; g < d.length; g++) {
if (!(f = h = d[g])) { if (!(f = h = d[g])) {
@@ -137,188 +136,94 @@ D.prototype.encode = function(a) {
if (this.filter && this.filter.has(f)) { if (this.filter && this.filter.has(f)) {
continue; continue;
} }
if (this.cache && f.length <= this.h) { if (this.cache && f.length <= this.C) {
if (this.C) { if (this.A) {
var e = this.A.get(f); var e = this.u.get(f);
if (e || "" === e) { if (e || "" === e) {
e && b.push(e); e && b.push(e);
continue; continue;
} }
} else { } else {
this.C = setTimeout(E, 0, this); this.A = setTimeout(D, 0, this);
} }
} }
let l; let l;
this.s && 2 < f.length && (this.J || (this.J = new RegExp("(?!^)(" + this.F + ")$")), f = f.replace(this.J, r => this.s.get(r)), l = 1); this.m && 2 < f.length && (this.J || (this.J = new RegExp("(?!^)(" + this.F + ")$")), f = f.replace(this.J, r => this.m.get(r)), l = 1);
this.m && 1 < f.length && (this.I || (this.I = new RegExp("(" + this.i + ")", "g")), f = f.replace(this.I, r => this.m.get(r)), l = 1); this.j && 1 < f.length && (this.I || (this.I = new RegExp("(" + this.D + ")", "g")), f = f.replace(this.I, r => this.j.get(r)), l = 1);
f && l && (f.length < this.G || this.filter && this.filter.has(f)) && (f = ""); f && l && (f.length < this.G || this.filter && this.filter.has(f)) && (f = "");
if (f && (this.v || this.l && 1 < f.length)) { if (f && (this.s || this.i && 1 < f.length)) {
e = ""; e = "";
for (let r = 0, k = "", p, q; r < f.length; r++) { for (let r = 0, k = "", p, q; r < f.length; r++) {
p = f.charAt(r), p === k && this.l || ((q = this.v && this.v.get(p)) || "" === q ? q === k && this.l || !(k = q) || (e += q) : e += k = p); p = f.charAt(r), p === k && this.i || ((q = this.s && this.s.get(p)) || "" === q ? q === k && this.i || !(k = q) || (e += q) : e += k = p);
} }
f = e; f = e;
} }
if (f && this.o) { if (f && this.l) {
for (e = 0; f && e < this.o.length; e += 2) { for (e = 0; f && e < this.l.length; e += 2) {
f = f.replace(this.o[e], this.o[e + 1]); f = f.replace(this.l[e], this.l[e + 1]);
} }
} }
this.cache && h.length <= this.h && (this.A.set(h, f), this.A.size > this.L && (this.A.clear(), this.h = this.h / 1.1 | 0)); this.cache && h.length <= this.C && (this.u.set(h, f), this.u.size > this.L && (this.u.clear(), this.C = this.C / 1.1 | 0));
f && b.push(f); f && b.push(f);
} }
this.D && (b = this.D(b) || b); this.B && (b = this.B(b) || b);
this.cache && a.length <= this.g && (this.u.set(a, b), this.u.size > this.L && (this.u.clear(), this.g = this.g / 1.1 | 0)); this.cache && a.length <= this.h && (this.o.set(a, b), this.o.size > this.L && (this.o.clear(), this.h = this.h / 1.1 | 0));
return b; return b;
}; };
function E(a) { function D(a) {
a.C = null; a.A = null;
a.o.clear();
a.u.clear(); a.u.clear();
a.A.clear();
} }
;function F(a) { ;function E(a) {
this.limit = a && !0 !== a ? a : 1000; this.limit = a && !0 !== a ? a : 1000;
this.cache = new Map(); this.cache = new Map();
this.g = ""; this.h = "";
} }
F.prototype.set = function(a, c) { E.prototype.set = function(a, c) {
this.cache.has(a) || (this.cache.set(this.g = a, c), this.limit && this.cache.size > this.limit && this.cache.delete(this.cache.keys().next().value)); this.cache.has(a) || (this.cache.set(this.h = a, c), this.limit && this.cache.size > this.limit && this.cache.delete(this.cache.keys().next().value));
}; };
F.prototype.get = function(a) { E.prototype.get = function(a) {
const c = this.cache.get(a); const c = this.cache.get(a);
c && this.limit && this.g !== a && (this.cache.delete(a), this.cache.set(this.g = a, c)); c && this.limit && this.h !== a && (this.cache.delete(a), this.cache.set(this.h = a, c));
return c; return c;
}; };
F.prototype.remove = function(a) { E.prototype.remove = function(a) {
for (const c of this.cache) { for (const c of this.cache) {
const b = c[0]; const b = c[0];
c[1].includes(a) && this.cache.delete(b); c[1].includes(a) && this.cache.delete(b);
} }
}; };
F.prototype.clear = function() { E.prototype.clear = function() {
this.cache.clear(); this.cache.clear();
this.g = ""; this.h = "";
}; };
function G(a = 8) { var F = {normalize:function(a) {
if (!(this instanceof G)) {
return new G(a);
}
this.index = v();
this.i = [];
this.size = 0;
32 < a ? (this.g = H, this.h = BigInt(a)) : (this.g = I, this.h = a);
}
G.prototype.get = function(a) {
const c = this.index[this.g(a)];
return c && c.get(a);
};
G.prototype.set = function(a, c) {
var b = this.g(a);
let d = this.index[b];
d ? (b = d.size, d.set(a, c), (b -= d.size) && this.size++) : (this.index[b] = d = new Map([[a, c]]), this.i.push(d));
};
function J(a = 8) {
if (!(this instanceof J)) {
return new J(a);
}
this.index = v();
this.g = [];
32 < a ? (this.i = H, this.h = BigInt(a)) : (this.i = I, this.h = a);
}
J.prototype.add = function(a) {
var c = this.i(a);
let b = this.index[c];
b ? (c = b.size, b.add(a), (c -= b.size) && this.size++) : (this.index[c] = b = new Set([a]), this.g.push(b));
};
t = G.prototype;
t.has = J.prototype.has = function(a) {
const c = this.index[this.i(a)];
return c && c.has(a);
};
t.delete = J.prototype.delete = function(a) {
const c = this.index[this.i(a)];
c && c.delete(a) && this.size--;
};
t.clear = J.prototype.clear = function() {
this.index = v();
this.g = [];
this.size = 0;
};
t.values = J.prototype.values = function*() {
for (let a = 0; a < this.g.length; a++) {
for (let c of this.g[a].values()) {
yield c;
}
}
};
t.keys = J.prototype.keys = function*() {
for (let a = 0; a < this.g.length; a++) {
for (let c of this.g[a].keys()) {
yield c;
}
}
};
t.entries = J.prototype.entries = function*() {
for (let a = 0; a < this.g.length; a++) {
for (let c of this.g[a].entries()) {
yield c;
}
}
};
function I(a) {
let c = 2 ** this.h - 1;
if ("number" == typeof a) {
return a & c;
}
let b = 0, d = this.h + 1;
for (let e = 0; e < a.length; e++) {
b = (b * d ^ a.charCodeAt(e)) & c;
}
return 32 === this.h ? b + 2 ** 31 : b;
}
function H(a) {
let c = BigInt(2) ** this.h - BigInt(1);
var b = typeof a;
if ("bigint" === b) {
return a & c;
}
if ("number" === b) {
return BigInt(a) & c;
}
b = BigInt(0);
let d = this.h + BigInt(1);
for (let e = 0; e < a.length; e++) {
b = (b * d ^ BigInt(a.charCodeAt(e))) & c;
}
return b;
}
;const K = v(), L = v();
var aa = {normalize:function(a) {
return a.toLowerCase(); return a.toLowerCase();
}, l:!1}; }, i:!1};
const M = {memory:{resolution:1}, performance:{resolution:6, fastupdate:!0, context:{depth:1, resolution:3}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:9}}}; const G = {memory:{resolution:1}, performance:{resolution:6, fastupdate:!0, context:{depth:1, resolution:3}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:9}}};
v(); u();
N.prototype.add = function(a, c, b, d) { H.prototype.add = function(a, c, b, d) {
if (c && (a || 0 === a)) { if (c && (a || 0 === a)) {
if (!d && !b && this.j.has(a)) { if (!d && !b && this.g.has(a)) {
return this.update(a, c); return this.update(a, c);
} }
c = this.encoder.encode(c); c = this.encoder.encode(c);
if (d = c.length) { if (d = c.length) {
const r = v(), k = v(), p = this.depth, q = this.resolution; const r = u(), k = u(), p = this.depth, q = this.resolution;
for (let m = 0; m < d; m++) { for (let m = 0; m < d; m++) {
let n = c[this.rtl ? d - 1 - m : m]; let n = c[this.rtl ? d - 1 - m : m];
var e = n.length; var e = n.length;
if (e && (p || !k[n])) { if (e && (p || !k[n])) {
var g = this.score ? this.score(c, n, m, null, 0) : O(q, d, m), f = ""; var g = this.score ? this.score(c, n, m, null, 0) : I(q, d, m), f = "";
switch(this.tokenize) { switch(this.tokenize) {
case "full": case "full":
if (2 < e) { if (2 < e) {
for (g = 0; g < e; g++) { for (g = 0; g < e; g++) {
for (var h = e; h > g; h--) { for (var h = e; h > g; h--) {
f = n.substring(g, h); f = n.substring(g, h);
var l = this.score ? this.score(c, n, m, f, g) : O(q, d, m, e, g); var l = this.score ? this.score(c, n, m, f, g) : I(q, d, m, e, g);
P(this, k, f, l, a, b); J(this, k, f, l, a, b);
} }
} }
break; break;
@@ -326,43 +231,43 @@ N.prototype.add = function(a, c, b, d) {
case "reverse": case "reverse":
if (1 < e) { if (1 < e) {
for (h = e - 1; 0 < h; h--) { for (h = e - 1; 0 < h; h--) {
f = n[h] + f, l = this.score ? this.score(c, n, m, f, h) : O(q, d, m, e, h), P(this, k, f, l, a, b); f = n[h] + f, l = this.score ? this.score(c, n, m, f, h) : I(q, d, m, e, h), J(this, k, f, l, a, b);
} }
f = ""; f = "";
} }
case "forward": case "forward":
if (1 < e) { if (1 < e) {
for (h = 0; h < e; h++) { for (h = 0; h < e; h++) {
f += n[h], P(this, k, f, g, a, b); f += n[h], J(this, k, f, g, a, b);
} }
break; break;
} }
default: default:
if (P(this, k, n, g, a, b), p && 1 < d && m < d - 1) { if (J(this, k, n, g, a, b), p && 1 < d && m < d - 1) {
for (e = v(), f = this.M, g = n, h = Math.min(p + 1, d - m), e[g] = 1, l = 1; l < h; l++) { for (e = u(), f = this.M, g = n, h = Math.min(p + 1, d - m), e[g] = 1, l = 1; l < h; l++) {
if ((n = c[this.rtl ? d - 1 - m - l : m + l]) && !e[n]) { if ((n = c[this.rtl ? d - 1 - m - l : m + l]) && !e[n]) {
e[n] = 1; e[n] = 1;
const x = this.score ? this.score(c, g, m, n, l) : O(f + (d / 2 > f ? 0 : 1), d, m, h - 1, l - 1), R = this.bidirectional && n > g; const v = this.score ? this.score(c, g, m, n, l) : I(f + (d / 2 > f ? 0 : 1), d, m, h - 1, l - 1), M = this.bidirectional && n > g;
P(this, r, R ? g : n, x, a, b, R ? n : g); J(this, r, M ? g : n, v, a, b, M ? n : g);
} }
} }
} }
} }
} }
} }
this.fastupdate || this.j.add(a); this.fastupdate || this.g.add(a);
} }
} }
return this; return this;
}; };
function P(a, c, b, d, e, g, f) { function J(a, c, b, d, e, g, f) {
let h = f ? a.B : a.map, l; let h = f ? a.v : a.map, l;
c[b] && f && (l = c[b])[f] || (f ? (c = l || (c[b] = v()), c[f] = 1, (l = h.get(f)) ? h = l : h.set(f, h = new Map())) : c[b] = 1, (l = h.get(b)) ? h = l : h.set(b, h = []), h = h[d] || (h[d] = []), g && h.includes(e) || (h.push(e), a.fastupdate && ((c = a.j.get(e)) ? c.push(h) : a.j.set(e, [h])))); c[b] && f && (l = c[b])[f] || (f ? (c = l || (c[b] = u()), c[f] = 1, (l = h.get(f)) ? h = l : h.set(f, h = new Map())) : c[b] = 1, (l = h.get(b)) ? h = l : h.set(b, h = []), h = h[d] || (h[d] = []), g && h.includes(e) || (h.push(e), a.fastupdate && ((c = a.g.get(e)) ? c.push(h) : a.g.set(e, [h]))));
} }
function O(a, c, b, d, e) { function I(a, c, b, d, e) {
return b && 1 < a ? c + (d || 0) <= a ? b + (e || 0) : (a - 1) / (c + (d || 0)) * (b + (e || 0)) + 1 | 0 : 0; return b && 1 < a ? c + (d || 0) <= a ? b + (e || 0) : (a - 1) / (c + (d || 0)) * (b + (e || 0)) + 1 | 0 : 0;
} }
;function Q(a, c, b) { ;function K(a, c, b) {
if (1 === a.length) { if (1 === a.length) {
return a = a[0], a = b || a.length > c ? c ? a.slice(b, b + c) : a.slice(b) : a; return a = a[0], a = b || a.length > c ? c ? a.slice(b, b + c) : a.slice(b) : a;
} }
@@ -392,36 +297,36 @@ function O(a, c, b, d, e) {
} }
return d.length ? d = 1 < d.length ? [].concat.apply([], d) : d[0] : d; return d.length ? d = 1 < d.length ? [].concat.apply([], d) : d[0] : d;
} }
;function ba(a, c, b, d) { ;function L(a, c, b, d) {
var e = a.length; var e = a.length;
let g = [], f = 0, h, l, r; let g = [], f = 0, h, l, r;
d && (d = []); d && (d = []);
for (let k = e - 1, p; 0 <= k; k--) { for (let k = e - 1, p; 0 <= k; k--) {
r = a[k]; r = a[k];
e = v(); e = u();
p = !h; p = !h;
for (let q = 0, m; q < r.length; q++) { for (let q = 0, m; q < r.length; q++) {
if ((m = r[q]) && m.length) { if ((m = r[q]) && m.length) {
for (let n = 0, x; n < m.length; n++) { for (let n = 0, v; n < m.length; n++) {
if (x = m[n], h) { if (v = m[n], h) {
if (h[x]) { if (h[v]) {
if (!k) { if (!k) {
if (b) { if (b) {
b--; b--;
} else { } else {
if (g[f++] = x, f === c) { if (g[f++] = v, f === c) {
return g; return g;
} }
} }
} }
if (k || d) { if (k || d) {
e[x] = 1; e[v] = 1;
} }
p = !0; p = !0;
} }
d && !l[x] && (l[x] = 1, (d[q] || (d[q] = [])).push(x)); d && !l[v] && (l[v] = 1, (d[q] || (d[q] = [])).push(v));
} else { } else {
e[x] = 1; e[v] = 1;
} }
} }
} }
@@ -453,7 +358,7 @@ function O(a, c, b, d, e) {
} }
return g; return g;
} }
;N.prototype.search = function(a, c, b) { ;H.prototype.search = function(a, c, b) {
b || (c || "object" !== typeof a ? "object" === typeof c && (b = c, c = 0) : (b = a, a = "")); b || (c || "object" !== typeof a ? "object" === typeof c && (b = c, c = 0) : (b = a, a = ""));
let d = []; let d = [];
let e, g = 0; let e, g = 0;
@@ -468,19 +373,19 @@ function O(a, c, b, d, e) {
b = a.length; b = a.length;
c || (c = 100); c || (c = 100);
if (1 === b) { if (1 === b) {
return S.call(this, a[0], "", c, g); return N.call(this, a[0], "", c, g);
} }
f = this.depth && !1 !== f; f = this.depth && !1 !== f;
if (2 === b && f && !e) { if (2 === b && f && !e) {
return S.call(this, a[0], a[1], c, g); return N.call(this, a[0], a[1], c, g);
} }
let h = 0, l = 0; let h = 0, l = 0;
if (1 < b) { if (1 < b) {
var r = v(); var r = u();
const p = []; const p = [];
for (let q = 0, m; q < b; q++) { for (let q = 0, m; q < b; q++) {
if ((m = a[q]) && !r[m]) { if ((m = a[q]) && !r[m]) {
if (e || T(this, m)) { if (e || O(this, m)) {
p.push(m), r[m] = 1; p.push(m), r[m] = 1;
} else { } else {
return d; return d;
@@ -499,15 +404,15 @@ function O(a, c, b, d, e) {
r = 0; r = 0;
let k; let k;
if (1 === b) { if (1 === b) {
return S.call(this, a[0], "", c, g); return N.call(this, a[0], "", c, g);
} }
if (2 === b && f && !e) { if (2 === b && f && !e) {
return S.call(this, a[0], a[1], c, g); return N.call(this, a[0], a[1], c, g);
} }
1 < b && (f ? (k = a[0], r = 1) : 9 < h && 3 < h / l && a.sort(w)); 1 < b && (f ? (k = a[0], r = 1) : 9 < h && 3 < h / l && a.sort(w));
for (let p, q; r < b; r++) { for (let p, q; r < b; r++) {
q = a[r]; q = a[r];
k ? (p = T(this, q, k), p = U(p, d, e, this.M, c, g, 2 === b), e && !1 === p && d.length || (k = q)) : (p = T(this, q), p = U(p, d, e, this.resolution, c, g, 1 === b)); k ? (p = O(this, q, k), p = P(p, d, e, this.M, c, g, 2 === b), e && !1 === p && d.length || (k = q)) : (p = O(this, q), p = P(p, d, e, this.resolution, c, g, 1 === b));
if (p) { if (p) {
return p; return p;
} }
@@ -522,16 +427,16 @@ function O(a, c, b, d, e) {
return d; return d;
} }
if (1 === f) { if (1 === f) {
return Q(d[0], c, g); return K(d[0], c, g);
} }
} }
} }
return ba(d, c, g, e); return L(d, c, g, e);
}; };
function S(a, c, b, d) { function N(a, c, b, d) {
return (a = T(this, a, c)) && a.length ? Q(a, b, d) : []; return (a = O(this, a, c)) && a.length ? K(a, b, d) : [];
} }
function U(a, c, b, d, e, g, f) { function P(a, c, b, d, e, g, f) {
let h = []; let h = [];
if (a) { if (a) {
d = Math.min(a.length, d); d = Math.min(a.length, d);
@@ -544,7 +449,7 @@ function U(a, c, b, d, e, g, f) {
} }
if (h.length) { if (h.length) {
if (f) { if (f) {
return Q(h, e, 0); return K(h, e, 0);
} }
c.push(h); c.push(h);
return; return;
@@ -552,14 +457,14 @@ function U(a, c, b, d, e, g, f) {
} }
return !b && h; return !b && h;
} }
function T(a, c, b) { function O(a, c, b) {
let d; let d;
b && (d = a.bidirectional && c > b); b && (d = a.bidirectional && c > b);
a = b ? (a = a.B.get(d ? c : b)) && a.get(d ? b : c) : a.map.get(c); a = b ? (a = a.v.get(d ? c : b)) && a.get(d ? b : c) : a.map.get(c);
return a; return a;
} }
;N.prototype.remove = function(a, c) { ;H.prototype.remove = function(a, c) {
const b = this.j.size && (this.fastupdate ? this.j.get(a) : this.j.has(a)); const b = this.g.size && (this.fastupdate ? this.g.get(a) : this.g.has(a));
if (b) { if (b) {
if (this.fastupdate) { if (this.fastupdate) {
for (let d = 0, e; d < b.length; d++) { for (let d = 0, e; d < b.length; d++) {
@@ -573,14 +478,14 @@ function T(a, c, b) {
} }
} }
} else { } else {
V(this.map, a), this.depth && V(this.B, a); Q(this.map, a), this.depth && Q(this.v, a);
} }
c || this.j.delete(a); c || this.g.delete(a);
} }
this.cache && this.cache.remove(a); this.cache && this.cache.remove(a);
return this; return this;
}; };
function V(a, c) { function Q(a, c) {
let b = 0; let b = 0;
if (a.constructor === Array) { if (a.constructor === Array) {
for (let d = 0, e, g; d < a.length; d++) { for (let d = 0, e, g; d < a.length; d++) {
@@ -595,25 +500,25 @@ function V(a, c) {
} }
} else { } else {
for (let d of a) { for (let d of a) {
const e = d[0], g = V(d[1], c); const e = d[0], g = Q(d[1], c);
g ? b += g : a.delete(e); g ? b += g : a.delete(e);
} }
} }
return b; return b;
} }
;function N(a, c) { ;function H(a, c) {
if (!(this instanceof N)) { if (!(this instanceof H)) {
return new N(a); return new H(a);
} }
if (a) { if (a) {
var b = "string" === typeof a ? a : a.preset; var b = "string" === typeof a ? a : a.preset;
b && (M[b] || console.warn("Preset not found: " + b), a = Object.assign({}, M[b], a)); b && (G[b] || console.warn("Preset not found: " + b), a = Object.assign({}, G[b], a));
} else { } else {
a = {}; a = {};
} }
b = a.context || {}; b = a.context || {};
const d = a.encode || a.encoder || aa; const d = a.encode || a.encoder || F;
this.encoder = d.encode ? d : "object" === typeof d ? new D(d) : {encode:d}; this.encoder = d.encode ? d : "object" === typeof d ? new C(d) : {encode:d};
let e; let e;
this.resolution = a.resolution || 9; this.resolution = a.resolution || 9;
this.tokenize = e = a.tokenize || "strict"; this.tokenize = e = a.tokenize || "strict";
@@ -621,35 +526,35 @@ function V(a, c) {
this.bidirectional = !1 !== b.bidirectional; this.bidirectional = !1 !== b.bidirectional;
this.fastupdate = !!a.fastupdate; this.fastupdate = !!a.fastupdate;
this.score = a.score || null; this.score = a.score || null;
this.map = (e = !1, new Map()); e = !1;
this.B = e ? new G(e) : new Map(); this.map = new Map();
this.j = c || (this.fastupdate ? e ? new G(e) : new Map() : e ? new J(e) : new Set()); this.v = new Map();
this.g = c || (this.fastupdate ? new Map() : new Set());
this.M = b.resolution || 1; this.M = b.resolution || 1;
this.rtl = d.rtl || a.rtl || !1; this.rtl = d.rtl || a.rtl || !1;
this.cache = (e = a.cache || null) && new F(e); this.cache = (e = a.cache || null) && new E(e);
} }
t = N.prototype; H.prototype.clear = function() {
t.clear = function() {
this.map.clear(); this.map.clear();
this.B.clear(); this.v.clear();
this.j.clear(); this.g.clear();
this.cache && this.cache.clear(); this.cache && this.cache.clear();
return this; return this;
}; };
t.append = function(a, c) { H.prototype.append = function(a, c) {
return this.add(a, c, !0); return this.add(a, c, !0);
}; };
t.contain = function(a) { H.prototype.contain = function(a) {
return this.j.has(a); return this.g.has(a);
}; };
t.update = function(a, c) { H.prototype.update = function(a, c) {
if (this.async) { if (this.async) {
const b = this, d = this.remove(a); const b = this, d = this.remove(a);
return d.then ? d.then(() => b.add(a, c)) : this.add(a, c); return d.then ? d.then(() => b.add(a, c)) : this.add(a, c);
} }
return this.remove(a).add(a, c); return this.remove(a).add(a, c);
}; };
function W(a) { function R(a) {
let c = 0; let c = 0;
if (a.constructor === Array) { if (a.constructor === Array) {
for (let b = 0, d; b < a.length; b++) { for (let b = 0, d; b < a.length; b++) {
@@ -657,21 +562,21 @@ function W(a) {
} }
} else { } else {
for (const b of a) { for (const b of a) {
const d = b[0], e = W(b[1]); const d = b[0], e = R(b[1]);
e ? c += e : a.delete(d); e ? c += e : a.delete(d);
} }
} }
return c; return c;
} }
t.cleanup = function() { H.prototype.cleanup = function() {
if (!this.fastupdate) { if (!this.fastupdate) {
return console.info('Cleanup the index isn\'t required when not using "fastupdate".'), this; return console.info('Cleanup the index isn\'t required when not using "fastupdate".'), this;
} }
W(this.map); R(this.map);
this.depth && W(this.B); this.depth && R(this.v);
return this; return this;
}; };
t.searchCache = function(a, c, b) { H.prototype.searchCache = function(a, c, b) {
a = ("object" === typeof a ? "" + a.query : a).toLowerCase(); a = ("object" === typeof a ? "" + a.query : a).toLowerCase();
let d = this.cache.get(a); let d = this.cache.get(a);
if (!d) { if (!d) {
@@ -686,9 +591,10 @@ t.searchCache = function(a, c, b) {
} }
return d; return d;
}; };
const X = {Index:N, Encoder:D, Charset:L, Language:K, Document:null, Worker:null, Resolver:null, IndexedDB:null}, Y = self; const S = u();
let Z; const T = {Index:H, Charset:S, Encoder:C, Document:null, Worker:null, Resolver:null, IndexedDB:null}, U = self;
(Z = Y.define) && Z.amd ? Z([], function() { let V;
return X; (V = U.define) && V.amd ? V([], function() {
}) : "object" === typeof Y.exports ? Y.exports = X : Y.FlexSearch = X; return T;
}) : "object" === typeof U.exports ? U.exports = T : U.FlexSearch = T;
}(this)); }(this));

View File

@@ -5,24 +5,21 @@
* Hosted by Nextapps GmbH * Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch * https://github.com/nextapps-de/flexsearch
*/ */
(function(self){'use strict';var t;function u(a,c,b){const d=typeof b,e=typeof a;if("undefined"!==d){if("undefined"!==e){if(b){if("function"===e&&d===e)return function(h){return a(b(h))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var g=new Map(b);for(var f of a)g.set(f[0],f[1]);return g}if(c===Set){f=new Set(b);for(g of a.values())f.add(g);return f}}}return a}return b}return"undefined"===e?c:a}function v(){return Object.create(null)}function w(a,c){return c.length-a.length};const y=/[^\p{L}\p{N}]+/u,z=/(\d{3})/g,A=/(\D)(\d{3})/g,B=/(\d{3})(\D)/g,C="".normalize&&/[\u0300-\u036f]/g;function D(a={}){if(!(this instanceof D))return new D(...arguments);for(a=0;a<arguments.length;a++)this.assign(arguments[a])} (function(self){'use strict';function t(a,c,b){const d=typeof b,e=typeof a;if("undefined"!==d){if("undefined"!==e){if(b){if("function"===e&&d===e)return function(h){return a(b(h))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var g=new Map(b);for(var f of a)g.set(f[0],f[1]);return g}if(c===Set){f=new Set(b);for(g of a.values())f.add(g);return f}}}return a}return b}return"undefined"===e?c:a}function u(){return Object.create(null)}function w(a,c){return c.length-a.length};const x=/[^\p{L}\p{N}]+/u,y=/(\d{3})/g,z=/(\D)(\d{3})/g,A=/(\d{3})(\D)/g,B="".normalize&&/[\u0300-\u036f]/g;function C(a={}){if(!(this instanceof C))return new C(...arguments);for(a=0;a<arguments.length;a++)this.assign(arguments[a])}
D.prototype.assign=function(a){this.normalize=u(a.normalize,!0,this.normalize);let c=a.N,b=c||a.O||a.split;if("object"===typeof b){let d=!c,e="";a.N||(e+="\\p{Z}");b.P&&(e+="\\p{L}");b.R&&(e+="\\p{N}",d=!!c);b.T&&(e+="\\p{S}");b.S&&(e+="\\p{P}");b.control&&(e+="\\p{C}");if(b=b.char)e+="object"===typeof b?b.join(""):b;this.split=new RegExp("["+(c?"^":"")+e+"]+","u");this.numeric=d}else this.split=u(b,y,this.split),this.numeric=u(this.numeric,!0);this.H=u(a.H,null,this.H);this.D=u(a.D,null,this.D); C.prototype.assign=function(a){this.normalize=t(a.normalize,!0,this.normalize);let c=a.N,b=c||a.O||a.split;if("object"===typeof b){let d=!c,e="";a.N||(e+="\\p{Z}");b.P&&(e+="\\p{L}");b.R&&(e+="\\p{N}",d=!!c);b.T&&(e+="\\p{S}");b.S&&(e+="\\p{P}");b.control&&(e+="\\p{C}");if(b=b.char)e+="object"===typeof b?b.join(""):b;this.split=new RegExp("["+(c?"^":"")+e+"]+","u");this.numeric=d}else this.split=t(b,x,this.split),this.numeric=t(this.numeric,!0);this.H=t(a.H,null,this.H);this.B=t(a.B,null,this.B);
this.rtl=a.rtl||!1;this.l=u(a.l,!0,this.l);this.filter=u((b=a.filter)&&new Set(b),null,this.filter);this.m=u((b=a.m)&&new Map(b),null,this.m);this.v=u((b=a.v)&&new Map(b),null,this.v);this.s=u((b=a.s)&&new Map(b),null,this.s);this.o=u(a.o,null,this.o);this.G=u(a.G,1,this.G);this.K=u(a.K,0,this.K);if(this.cache=b=u(a.cache,!0,this.cache))this.C=null,this.L="number"===typeof b?b:2E5,this.u=new Map,this.A=new Map,this.h=this.g=128;this.i="";this.I=null;this.F="";this.J=null;if(this.m)for(const d of this.m.keys())this.i+= this.rtl=a.rtl||!1;this.i=t(a.i,!0,this.i);this.filter=t((b=a.filter)&&new Set(b),null,this.filter);this.j=t((b=a.j)&&new Map(b),null,this.j);this.s=t((b=a.s)&&new Map(b),null,this.s);this.m=t((b=a.m)&&new Map(b),null,this.m);this.l=t(a.l,null,this.l);this.G=t(a.G,1,this.G);this.K=t(a.K,0,this.K);if(this.cache=b=t(a.cache,!0,this.cache))this.A=null,this.L="number"===typeof b?b:2E5,this.o=new Map,this.u=new Map,this.C=this.h=128;this.D="";this.I=null;this.F="";this.J=null;if(this.j)for(const d of this.j.keys())this.D+=
(this.i?"|":"")+d;if(this.s)for(const d of this.s.keys())this.F+=(this.F?"|":"")+d;return this}; (this.D?"|":"")+d;if(this.m)for(const d of this.m.keys())this.F+=(this.F?"|":"")+d;return this};
D.prototype.encode=function(a){if(this.cache&&a.length<=this.g)if(this.C){if(this.u.has(a))return this.u.get(a)}else this.C=setTimeout(E,0,this);this.normalize&&(a="function"===typeof this.normalize?this.normalize(a):C?a.normalize("NFKD").replace(C,"").toLowerCase():a.toLowerCase());this.H&&(a=this.H(a));this.numeric&&3<a.length&&(a=a.replace(A,"$1 $2").replace(B,"$1 $2").replace(z,"$1 "));const c=!(this.l||this.v||this.filter||this.m||this.s||this.o);let b=[],d=this.split||""===this.split?a.split(this.split): C.prototype.encode=function(a){if(this.cache&&a.length<=this.h)if(this.A){if(this.o.has(a))return this.o.get(a)}else this.A=setTimeout(D,0,this);this.normalize&&(a="function"===typeof this.normalize?this.normalize(a):B?a.normalize("NFKD").replace(B,"").toLowerCase():a.toLowerCase());this.H&&(a=this.H(a));this.numeric&&3<a.length&&(a=a.replace(z,"$1 $2").replace(A,"$1 $2").replace(y,"$1 "));const c=!(this.i||this.s||this.filter||this.j||this.m||this.l);let b=[],d=this.split||""===this.split?a.split(this.split):
a;for(let g=0,f,h;g<d.length;g++){if(!(f=h=d[g]))continue;if(f.length<this.G)continue;if(c){b.push(f);continue}if(this.filter&&this.filter.has(f))continue;if(this.cache&&f.length<=this.h)if(this.C){var e=this.A.get(f);if(e||""===e){e&&b.push(e);continue}}else this.C=setTimeout(E,0,this);let l;this.s&&2<f.length&&(this.J||(this.J=new RegExp("(?!^)("+this.F+")$")),f=f.replace(this.J,r=>this.s.get(r)),l=1);this.m&&1<f.length&&(this.I||(this.I=new RegExp("("+this.i+")","g")),f=f.replace(this.I,r=>this.m.get(r)), a;for(let g=0,f,h;g<d.length;g++){if(!(f=h=d[g]))continue;if(f.length<this.G)continue;if(c){b.push(f);continue}if(this.filter&&this.filter.has(f))continue;if(this.cache&&f.length<=this.C)if(this.A){var e=this.u.get(f);if(e||""===e){e&&b.push(e);continue}}else this.A=setTimeout(D,0,this);let l;this.m&&2<f.length&&(this.J||(this.J=new RegExp("(?!^)("+this.F+")$")),f=f.replace(this.J,r=>this.m.get(r)),l=1);this.j&&1<f.length&&(this.I||(this.I=new RegExp("("+this.D+")","g")),f=f.replace(this.I,r=>this.j.get(r)),
l=1);f&&l&&(f.length<this.G||this.filter&&this.filter.has(f))&&(f="");if(f&&(this.v||this.l&&1<f.length)){e="";for(let r=0,k="",p,q;r<f.length;r++)p=f.charAt(r),p===k&&this.l||((q=this.v&&this.v.get(p))||""===q?q===k&&this.l||!(k=q)||(e+=q):e+=k=p);f=e}if(f&&this.o)for(e=0;f&&e<this.o.length;e+=2)f=f.replace(this.o[e],this.o[e+1]);this.cache&&h.length<=this.h&&(this.A.set(h,f),this.A.size>this.L&&(this.A.clear(),this.h=this.h/1.1|0));f&&b.push(f)}this.D&&(b=this.D(b)||b);this.cache&&a.length<=this.g&& l=1);f&&l&&(f.length<this.G||this.filter&&this.filter.has(f))&&(f="");if(f&&(this.s||this.i&&1<f.length)){e="";for(let r=0,k="",p,q;r<f.length;r++)p=f.charAt(r),p===k&&this.i||((q=this.s&&this.s.get(p))||""===q?q===k&&this.i||!(k=q)||(e+=q):e+=k=p);f=e}if(f&&this.l)for(e=0;f&&e<this.l.length;e+=2)f=f.replace(this.l[e],this.l[e+1]);this.cache&&h.length<=this.C&&(this.u.set(h,f),this.u.size>this.L&&(this.u.clear(),this.C=this.C/1.1|0));f&&b.push(f)}this.B&&(b=this.B(b)||b);this.cache&&a.length<=this.h&&
(this.u.set(a,b),this.u.size>this.L&&(this.u.clear(),this.g=this.g/1.1|0));return b};function E(a){a.C=null;a.u.clear();a.A.clear()};function F(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.g=""}F.prototype.set=function(a,c){this.cache.has(a)||(this.cache.set(this.g=a,c),this.limit&&this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value))};F.prototype.get=function(a){const c=this.cache.get(a);c&&this.limit&&this.g!==a&&(this.cache.delete(a),this.cache.set(this.g=a,c));return c};F.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}}; (this.o.set(a,b),this.o.size>this.L&&(this.o.clear(),this.h=this.h/1.1|0));return b};function D(a){a.A=null;a.o.clear();a.u.clear()};function E(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}E.prototype.set=function(a,c){this.cache.has(a)||(this.cache.set(this.h=a,c),this.limit&&this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value))};E.prototype.get=function(a){const c=this.cache.get(a);c&&this.limit&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,c));return c};E.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};
F.prototype.clear=function(){this.cache.clear();this.g=""};function G(a=8){if(!(this instanceof G))return new G(a);this.index=v();this.i=[];this.size=0;32<a?(this.g=H,this.h=BigInt(a)):(this.g=I,this.h=a)}G.prototype.get=function(a){const c=this.index[this.g(a)];return c&&c.get(a)};G.prototype.set=function(a,c){var b=this.g(a);let d=this.index[b];d?(b=d.size,d.set(a,c),(b-=d.size)&&this.size++):(this.index[b]=d=new Map([[a,c]]),this.i.push(d))}; E.prototype.clear=function(){this.cache.clear();this.h=""};var F={normalize:function(a){return a.toLowerCase()},i:!1};const G={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};u();H.prototype.add=function(a,c,b,d){if(c&&(a||0===a)){if(!d&&!b&&this.g.has(a))return this.update(a,c);c=this.encoder.encode(c);if(d=c.length){const r=u(),k=u(),p=this.depth,q=this.resolution;for(let m=0;m<d;m++){let n=c[this.rtl?d-1-m:m];var e=n.length;if(e&&(p||!k[n])){var g=this.score?this.score(c,n,m,null,0):I(q,d,m),f="";switch(this.tokenize){case "full":if(2<e){for(g=0;g<e;g++)for(var h=e;h>g;h--){f=n.substring(g,h);var l=this.score?this.score(c,n,m,f,g):I(q,d,m,e,g);J(this,k,f,l,a,b)}break}case "reverse":if(1<
function J(a=8){if(!(this instanceof J))return new J(a);this.index=v();this.g=[];32<a?(this.i=H,this.h=BigInt(a)):(this.i=I,this.h=a)}J.prototype.add=function(a){var c=this.i(a);let b=this.index[c];b?(c=b.size,b.add(a),(c-=b.size)&&this.size++):(this.index[c]=b=new Set([a]),this.g.push(b))};t=G.prototype;t.has=J.prototype.has=function(a){const c=this.index[this.i(a)];return c&&c.has(a)};t.delete=J.prototype.delete=function(a){const c=this.index[this.i(a)];c&&c.delete(a)&&this.size--}; e){for(h=e-1;0<h;h--)f=n[h]+f,l=this.score?this.score(c,n,m,f,h):I(q,d,m,e,h),J(this,k,f,l,a,b);f=""}case "forward":if(1<e){for(h=0;h<e;h++)f+=n[h],J(this,k,f,g,a,b);break}default:if(J(this,k,n,g,a,b),p&&1<d&&m<d-1)for(e=u(),f=this.M,g=n,h=Math.min(p+1,d-m),e[g]=1,l=1;l<h;l++)if((n=c[this.rtl?d-1-m-l:m+l])&&!e[n]){e[n]=1;const v=this.score?this.score(c,g,m,n,l):I(f+(d/2>f?0:1),d,m,h-1,l-1),L=this.bidirectional&&n>g;J(this,r,L?g:n,v,a,b,L?n:g)}}}}this.fastupdate||this.g.add(a)}}return this};
t.clear=J.prototype.clear=function(){this.index=v();this.g=[];this.size=0};t.values=J.prototype.values=function*(){for(let a=0;a<this.g.length;a++)for(let c of this.g[a].values())yield c};t.keys=J.prototype.keys=function*(){for(let a=0;a<this.g.length;a++)for(let c of this.g[a].keys())yield c};t.entries=J.prototype.entries=function*(){for(let a=0;a<this.g.length;a++)for(let c of this.g[a].entries())yield c}; function J(a,c,b,d,e,g,f){let h=f?a.v:a.map,l;c[b]&&f&&(l=c[b])[f]||(f?(c=l||(c[b]=u()),c[f]=1,(l=h.get(f))?h=l:h.set(f,h=new Map)):c[b]=1,(l=h.get(b))?h=l:h.set(b,h=[]),h=h[d]||(h[d]=[]),g&&h.includes(e)||(h.push(e),a.fastupdate&&((c=a.g.get(e))?c.push(h):a.g.set(e,[h]))))}function I(a,c,b,d,e){return b&&1<a?c+(d||0)<=a?b+(e||0):(a-1)/(c+(d||0))*(b+(e||0))+1|0:0};function K(a,c,b){if(1===a.length)return a=a[0],a=b||a.length>c?c?a.slice(b,b+c):a.slice(b):a;let d=[];for(let e=0,g,f;e<a.length;e++)if((g=a[e])&&(f=g.length)){if(b){if(b>=f){b-=f;continue}b<f&&(g=c?g.slice(b,b+c):g.slice(b),f=g.length,b=0)}if(d.length)f>c&&(g=g.slice(0,c),f=g.length),d.push(g);else{if(f>=c)return f>c&&(g=g.slice(0,c)),g;d=[g]}c-=f;if(!c)break}return d.length?d=1<d.length?[].concat.apply([],d):d[0]:d};function M(a,c,b,d){var e=a.length;let g=[],f=0,h,l,r;d&&(d=[]);for(let k=e-1,p;0<=k;k--){r=a[k];e=u();p=!h;for(let q=0,m;q<r.length;q++)if((m=r[q])&&m.length)for(let n=0,v;n<m.length;n++)if(v=m[n],h){if(h[v]){if(!k)if(b)b--;else if(g[f++]=v,f===c)return g;if(k||d)e[v]=1;p=!0}d&&!l[v]&&(l[v]=1,(d[q]||(d[q]=[])).push(v))}else e[v]=1;if(d)h||(l=e);else if(!p)return[];h=e}if(d)for(let k=d.length-1,p,q;0<=k;k--){p=d[k];q=p.length;for(let m=0,n;m<q;m++)if(n=p[m],!h[n]){if(b)b--;else if(g[f++]=n,f===c)return g;
function I(a){let c=2**this.h-1;if("number"==typeof a)return a&c;let b=0,d=this.h+1;for(let e=0;e<a.length;e++)b=(b*d^a.charCodeAt(e))&c;return 32===this.h?b+2**31:b}function H(a){let c=BigInt(2)**this.h-BigInt(1);var b=typeof a;if("bigint"===b)return a&c;if("number"===b)return BigInt(a)&c;b=BigInt(0);let d=this.h+BigInt(1);for(let e=0;e<a.length;e++)b=(b*d^BigInt(a.charCodeAt(e)))&c;return b};const K=v(),L=v();var M={normalize:function(a){return a.toLowerCase()},l:!1};const aa={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};v();N.prototype.add=function(a,c,b,d){if(c&&(a||0===a)){if(!d&&!b&&this.j.has(a))return this.update(a,c);c=this.encoder.encode(c);if(d=c.length){const r=v(),k=v(),p=this.depth,q=this.resolution;for(let m=0;m<d;m++){let n=c[this.rtl?d-1-m:m];var e=n.length;if(e&&(p||!k[n])){var g=this.score?this.score(c,n,m,null,0):O(q,d,m),f="";switch(this.tokenize){case "full":if(2<e){for(g=0;g<e;g++)for(var h=e;h>g;h--){f=n.substring(g,h);var l=this.score?this.score(c,n,m,f,g):O(q,d,m,e,g);P(this,k,f,l,a,b)}break}case "reverse":if(1< h[n]=1}}return g};H.prototype.search=function(a,c,b){b||(c||"object"!==typeof a?"object"===typeof c&&(b=c,c=0):(b=a,a=""));let d=[];let e,g=0;if(b){a=b.query||a;c=b.limit||c;g=b.offset||0;var f=b.context;e=b.suggest}a=this.encoder.encode(a);b=a.length;c||(c=100);if(1===b)return N.call(this,a[0],"",c,g);f=this.depth&&!1!==f;if(2===b&&f&&!e)return N.call(this,a[0],a[1],c,g);let h=0,l=0;if(1<b){var r=u();const p=[];for(let q=0,m;q<b;q++)if((m=a[q])&&!r[m]){if(e||O(this,m))p.push(m),r[m]=1;else return d;const n=m.length;
e){for(h=e-1;0<h;h--)f=n[h]+f,l=this.score?this.score(c,n,m,f,h):O(q,d,m,e,h),P(this,k,f,l,a,b);f=""}case "forward":if(1<e){for(h=0;h<e;h++)f+=n[h],P(this,k,f,g,a,b);break}default:if(P(this,k,n,g,a,b),p&&1<d&&m<d-1)for(e=v(),f=this.M,g=n,h=Math.min(p+1,d-m),e[g]=1,l=1;l<h;l++)if((n=c[this.rtl?d-1-m-l:m+l])&&!e[n]){e[n]=1;const x=this.score?this.score(c,g,m,n,l):O(f+(d/2>f?0:1),d,m,h-1,l-1),Q=this.bidirectional&&n>g;P(this,r,Q?g:n,x,a,b,Q?n:g)}}}}this.fastupdate||this.j.add(a)}}return this}; h=Math.max(h,n);l=l?Math.min(l,n):n}a=p;b=a.length}if(!b)return d;r=0;let k;if(1===b)return N.call(this,a[0],"",c,g);if(2===b&&f&&!e)return N.call(this,a[0],a[1],c,g);1<b&&(f?(k=a[0],r=1):9<h&&3<h/l&&a.sort(w));for(let p,q;r<b;r++){q=a[r];k?(p=O(this,q,k),p=P(p,d,e,this.M,c,g,2===b),e&&!1===p&&d.length||(k=q)):(p=O(this,q),p=P(p,d,e,this.resolution,c,g,1===b));if(p)return p;if(e&&r===b-1){f=d.length;if(!f){if(k){k="";r=-1;continue}return d}if(1===f)return K(d[0],c,g)}}return M(d,c,g,e)};
function P(a,c,b,d,e,g,f){let h=f?a.B:a.map,l;c[b]&&f&&(l=c[b])[f]||(f?(c=l||(c[b]=v()),c[f]=1,(l=h.get(f))?h=l:h.set(f,h=new Map)):c[b]=1,(l=h.get(b))?h=l:h.set(b,h=[]),h=h[d]||(h[d]=[]),g&&h.includes(e)||(h.push(e),a.fastupdate&&((c=a.j.get(e))?c.push(h):a.j.set(e,[h]))))}function O(a,c,b,d,e){return b&&1<a?c+(d||0)<=a?b+(e||0):(a-1)/(c+(d||0))*(b+(e||0))+1|0:0};function R(a,c,b){if(1===a.length)return a=a[0],a=b||a.length>c?c?a.slice(b,b+c):a.slice(b):a;let d=[];for(let e=0,g,f;e<a.length;e++)if((g=a[e])&&(f=g.length)){if(b){if(b>=f){b-=f;continue}b<f&&(g=c?g.slice(b,b+c):g.slice(b),f=g.length,b=0)}if(d.length)f>c&&(g=g.slice(0,c),f=g.length),d.push(g);else{if(f>=c)return f>c&&(g=g.slice(0,c)),g;d=[g]}c-=f;if(!c)break}return d.length?d=1<d.length?[].concat.apply([],d):d[0]:d};function ba(a,c,b,d){var e=a.length;let g=[],f=0,h,l,r;d&&(d=[]);for(let k=e-1,p;0<=k;k--){r=a[k];e=v();p=!h;for(let q=0,m;q<r.length;q++)if((m=r[q])&&m.length)for(let n=0,x;n<m.length;n++)if(x=m[n],h){if(h[x]){if(!k)if(b)b--;else if(g[f++]=x,f===c)return g;if(k||d)e[x]=1;p=!0}d&&!l[x]&&(l[x]=1,(d[q]||(d[q]=[])).push(x))}else e[x]=1;if(d)h||(l=e);else if(!p)return[];h=e}if(d)for(let k=d.length-1,p,q;0<=k;k--){p=d[k];q=p.length;for(let m=0,n;m<q;m++)if(n=p[m],!h[n]){if(b)b--;else if(g[f++]=n,f===c)return g; function N(a,c,b,d){return(a=O(this,a,c))&&a.length?K(a,b,d):[]}function P(a,c,b,d,e,g,f){let h=[];if(a){d=Math.min(a.length,d);for(let l=0,r=0,k;l<d;l++)if(k=a[l])if(g&&k&&f&&(k.length<=g?(g-=k.length,k=null):(k=k.slice(g),g=0)),k&&(h[l]=k,f&&(r+=k.length,r>=e)))break;if(h.length){if(f)return K(h,e,0);c.push(h);return}}return!b&&h}function O(a,c,b){let d;b&&(d=a.bidirectional&&c>b);a=b?(a=a.v.get(d?c:b))&&a.get(d?b:c):a.map.get(c);return a};H.prototype.remove=function(a,c){const b=this.g.size&&(this.fastupdate?this.g.get(a):this.g.has(a));if(b){if(this.fastupdate)for(let d=0,e;d<b.length;d++){if(e=b[d])if(2>e.length)e.pop();else{const g=e.indexOf(a);g===b.length-1?e.pop():e.splice(g,1)}}else Q(this.map,a),this.depth&&Q(this.v,a);c||this.g.delete(a)}this.cache&&this.cache.remove(a);return this};
h[n]=1}}return g};N.prototype.search=function(a,c,b){b||(c||"object"!==typeof a?"object"===typeof c&&(b=c,c=0):(b=a,a=""));let d=[];let e,g=0;if(b){a=b.query||a;c=b.limit||c;g=b.offset||0;var f=b.context;e=b.suggest}a=this.encoder.encode(a);b=a.length;c||(c=100);if(1===b)return S.call(this,a[0],"",c,g);f=this.depth&&!1!==f;if(2===b&&f&&!e)return S.call(this,a[0],a[1],c,g);let h=0,l=0;if(1<b){var r=v();const p=[];for(let q=0,m;q<b;q++)if((m=a[q])&&!r[m]){if(e||T(this,m))p.push(m),r[m]=1;else return d;const n=m.length; function Q(a,c){let b=0;if(a.constructor===Array)for(let d=0,e,g;d<a.length;d++){if((e=a[d])&&e.length)if(g=e.indexOf(c),0<=g){1<e.length?(e.splice(g,1),b++):delete a[d];break}else b++}else for(let d of a){const e=d[0],g=Q(d[1],c);g?b+=g:a.delete(e)}return b};function H(a,c){if(!(this instanceof H))return new H(a);if(a){var b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},G[b],a))}else a={};b=a.context||{};const d=a.encode||a.encoder||F;this.encoder=d.encode?d:"object"===typeof d?new C(d):{encode:d};let e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&b.depth||0;this.bidirectional=!1!==b.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;e=!1;this.map=new Map;this.v=new Map;this.g=
h=Math.max(h,n);l=l?Math.min(l,n):n}a=p;b=a.length}if(!b)return d;r=0;let k;if(1===b)return S.call(this,a[0],"",c,g);if(2===b&&f&&!e)return S.call(this,a[0],a[1],c,g);1<b&&(f?(k=a[0],r=1):9<h&&3<h/l&&a.sort(w));for(let p,q;r<b;r++){q=a[r];k?(p=T(this,q,k),p=U(p,d,e,this.M,c,g,2===b),e&&!1===p&&d.length||(k=q)):(p=T(this,q),p=U(p,d,e,this.resolution,c,g,1===b));if(p)return p;if(e&&r===b-1){f=d.length;if(!f){if(k){k="";r=-1;continue}return d}if(1===f)return R(d[0],c,g)}}return ba(d,c,g,e)}; c||(this.fastupdate?new Map:new Set);this.M=b.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new E(e)}H.prototype.clear=function(){this.map.clear();this.v.clear();this.g.clear();this.cache&&this.cache.clear();return this};H.prototype.append=function(a,c){return this.add(a,c,!0)};H.prototype.contain=function(a){return this.g.has(a)};
function S(a,c,b,d){return(a=T(this,a,c))&&a.length?R(a,b,d):[]}function U(a,c,b,d,e,g,f){let h=[];if(a){d=Math.min(a.length,d);for(let l=0,r=0,k;l<d;l++)if(k=a[l])if(g&&k&&f&&(k.length<=g?(g-=k.length,k=null):(k=k.slice(g),g=0)),k&&(h[l]=k,f&&(r+=k.length,r>=e)))break;if(h.length){if(f)return R(h,e,0);c.push(h);return}}return!b&&h}function T(a,c,b){let d;b&&(d=a.bidirectional&&c>b);a=b?(a=a.B.get(d?c:b))&&a.get(d?b:c):a.map.get(c);return a};N.prototype.remove=function(a,c){const b=this.j.size&&(this.fastupdate?this.j.get(a):this.j.has(a));if(b){if(this.fastupdate)for(let d=0,e;d<b.length;d++){if(e=b[d])if(2>e.length)e.pop();else{const g=e.indexOf(a);g===b.length-1?e.pop():e.splice(g,1)}}else V(this.map,a),this.depth&&V(this.B,a);c||this.j.delete(a)}this.cache&&this.cache.remove(a);return this}; H.prototype.update=function(a,c){if(this.async){const b=this,d=this.remove(a);return d.then?d.then(()=>b.add(a,c)):this.add(a,c)}return this.remove(a).add(a,c)};function R(a){let c=0;if(a.constructor===Array)for(let b=0,d;b<a.length;b++)(d=a[b])&&(c+=d.length);else for(const b of a){const d=b[0],e=R(b[1]);e?c+=e:a.delete(d)}return c}H.prototype.cleanup=function(){if(!this.fastupdate)return this;R(this.map);this.depth&&R(this.v);return this};
function V(a,c){let b=0;if(a.constructor===Array)for(let d=0,e,g;d<a.length;d++){if((e=a[d])&&e.length)if(g=e.indexOf(c),0<=g){1<e.length?(e.splice(g,1),b++):delete a[d];break}else b++}else for(let d of a){const e=d[0],g=V(d[1],c);g?b+=g:a.delete(e)}return b};function N(a,c){if(!(this instanceof N))return new N(a);if(a){var b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},aa[b],a))}else a={};b=a.context||{};const d=a.encode||a.encoder||M;this.encoder=d.encode?d:"object"===typeof d?new D(d):{encode:d};let e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&b.depth||0;this.bidirectional=!1!==b.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;this.map=(e=!1,new Map);this.B=e?new G(e): H.prototype.searchCache=function(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();let d=this.cache.get(a);if(!d){d=this.search(a,c,b);if(d instanceof Promise){const e=this;d.then(function(g){e.cache.set(a,g)})}this.cache.set(a,d)}return d};const S=u();const T={Index:H,Charset:S,Encoder:C,Document:null,Worker:null,Resolver:null,IndexedDB:null},U=self;let V;(V=U.define)&&V.amd?V([],function(){return T}):"object"===typeof U.exports?U.exports=T:U.FlexSearch=T;}(this));
new Map;this.j=c||(this.fastupdate?e?new G(e):new Map:e?new J(e):new Set);this.M=b.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new F(e)}t=N.prototype;t.clear=function(){this.map.clear();this.B.clear();this.j.clear();this.cache&&this.cache.clear();return this};t.append=function(a,c){return this.add(a,c,!0)};t.contain=function(a){return this.j.has(a)};
t.update=function(a,c){if(this.async){const b=this,d=this.remove(a);return d.then?d.then(()=>b.add(a,c)):this.add(a,c)}return this.remove(a).add(a,c)};function W(a){let c=0;if(a.constructor===Array)for(let b=0,d;b<a.length;b++)(d=a[b])&&(c+=d.length);else for(const b of a){const d=b[0],e=W(b[1]);e?c+=e:a.delete(d)}return c}t.cleanup=function(){if(!this.fastupdate)return this;W(this.map);this.depth&&W(this.B);return this};
t.searchCache=function(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();let d=this.cache.get(a);if(!d){d=this.search(a,c,b);if(d instanceof Promise){const e=this;d.then(function(g){e.cache.set(a,g)})}this.cache.set(a,d)}return d};const X={Index:N,Encoder:D,Charset:L,Language:K,Document:null,Worker:null,Resolver:null,IndexedDB:null},Y=self;let Z;(Z=Y.define)&&Z.amd?Z([],function(){return X}):"object"===typeof Y.exports?Y.exports=X:Y.FlexSearch=X;}(this));

View File

@@ -5,319 +5,63 @@
* Hosted by Nextapps GmbH * Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch * https://github.com/nextapps-de/flexsearch
*/ */
var t; function t() {
function u(a, c, b) {
const d = typeof b, e = typeof a;
if ("undefined" !== d) {
if ("undefined" !== e) {
if (b) {
if ("function" === e && d === e) {
return function(h) {
return a(b(h));
};
}
c = a.constructor;
if (c === b.constructor) {
if (c === Array) {
return b.concat(a);
}
if (c === Map) {
var g = new Map(b);
for (var f of a) {
g.set(f[0], f[1]);
}
return g;
}
if (c === Set) {
f = new Set(b);
for (g of a.values()) {
f.add(g);
}
return f;
}
}
}
return a;
}
return b;
}
return "undefined" === e ? c : a;
}
function v() {
return Object.create(null); return Object.create(null);
} }
function w(a, c) { function v(a, b) {
return c.length - a.length; return b.length - a.length;
} }
;const y = /[^\p{L}\p{N}]+/u, z = /(\d{3})/g, A = /(\D)(\d{3})/g, B = /(\d{3})(\D)/g, C = "".normalize && /[\u0300-\u036f]/g; ;function w(a) {
function D(a = {}) {
if (!(this instanceof D)) {
return new D(...arguments);
}
for (a = 0; a < arguments.length; a++) {
this.assign(arguments[a]);
}
}
D.prototype.assign = function(a) {
this.normalize = u(a.normalize, !0, this.normalize);
let c = a.N, b = c || a.O || a.split;
if ("object" === typeof b) {
let d = !c, e = "";
a.N || (e += "\\p{Z}");
b.P && (e += "\\p{L}");
b.R && (e += "\\p{N}", d = !!c);
b.T && (e += "\\p{S}");
b.S && (e += "\\p{P}");
b.control && (e += "\\p{C}");
if (b = b.char) {
e += "object" === typeof b ? b.join("") : b;
}
this.split = new RegExp("[" + (c ? "^" : "") + e + "]+", "u");
this.numeric = d;
} else {
this.split = u(b, y, this.split), this.numeric = u(this.numeric, !0);
}
this.H = u(a.H, null, this.H);
this.D = u(a.D, null, this.D);
this.rtl = a.rtl || !1;
this.l = u(a.l, !0, this.l);
this.filter = u((b = a.filter) && new Set(b), null, this.filter);
this.m = u((b = a.m) && new Map(b), null, this.m);
this.v = u((b = a.v) && new Map(b), null, this.v);
this.s = u((b = a.s) && new Map(b), null, this.s);
this.o = u(a.o, null, this.o);
this.G = u(a.G, 1, this.G);
this.K = u(a.K, 0, this.K);
if (this.cache = b = u(a.cache, !0, this.cache)) {
this.C = null, this.L = "number" === typeof b ? b : 2e5, this.u = new Map(), this.A = new Map(), this.h = this.g = 128;
}
this.i = "";
this.I = null;
this.F = "";
this.J = null;
if (this.m) {
for (const d of this.m.keys()) {
this.i += (this.i ? "|" : "") + d;
}
}
if (this.s) {
for (const d of this.s.keys()) {
this.F += (this.F ? "|" : "") + d;
}
}
return this;
};
D.prototype.encode = function(a) {
if (this.cache && a.length <= this.g) {
if (this.C) {
if (this.u.has(a)) {
return this.u.get(a);
}
} else {
this.C = setTimeout(E, 0, this);
}
}
this.normalize && (a = "function" === typeof this.normalize ? this.normalize(a) : C ? a.normalize("NFKD").replace(C, "").toLowerCase() : a.toLowerCase());
this.H && (a = this.H(a));
this.numeric && 3 < a.length && (a = a.replace(A, "$1 $2").replace(B, "$1 $2").replace(z, "$1 "));
const c = !(this.l || this.v || this.filter || this.m || this.s || this.o);
let b = [], d = this.split || "" === this.split ? a.split(this.split) : a;
for (let g = 0, f, h; g < d.length; g++) {
if (!(f = h = d[g])) {
continue;
}
if (f.length < this.G) {
continue;
}
if (c) {
b.push(f);
continue;
}
if (this.filter && this.filter.has(f)) {
continue;
}
if (this.cache && f.length <= this.h) {
if (this.C) {
var e = this.A.get(f);
if (e || "" === e) {
e && b.push(e);
continue;
}
} else {
this.C = setTimeout(E, 0, this);
}
}
let l;
this.s && 2 < f.length && (this.J || (this.J = new RegExp("(?!^)(" + this.F + ")$")), f = f.replace(this.J, r => this.s.get(r)), l = 1);
this.m && 1 < f.length && (this.I || (this.I = new RegExp("(" + this.i + ")", "g")), f = f.replace(this.I, r => this.m.get(r)), l = 1);
f && l && (f.length < this.G || this.filter && this.filter.has(f)) && (f = "");
if (f && (this.v || this.l && 1 < f.length)) {
e = "";
for (let r = 0, k = "", p, q; r < f.length; r++) {
p = f.charAt(r), p === k && this.l || ((q = this.v && this.v.get(p)) || "" === q ? q === k && this.l || !(k = q) || (e += q) : e += k = p);
}
f = e;
}
if (f && this.o) {
for (e = 0; f && e < this.o.length; e += 2) {
f = f.replace(this.o[e], this.o[e + 1]);
}
}
this.cache && h.length <= this.h && (this.A.set(h, f), this.A.size > this.L && (this.A.clear(), this.h = this.h / 1.1 | 0));
f && b.push(f);
}
this.D && (b = this.D(b) || b);
this.cache && a.length <= this.g && (this.u.set(a, b), this.u.size > this.L && (this.u.clear(), this.g = this.g / 1.1 | 0));
return b;
};
function E(a) {
a.C = null;
a.u.clear();
a.A.clear();
}
;function F(a) {
this.limit = a && !0 !== a ? a : 1000; this.limit = a && !0 !== a ? a : 1000;
this.cache = new Map(); this.cache = new Map();
this.g = ""; this.C = "";
} }
F.prototype.set = function(a, c) { w.prototype.set = function(a, b) {
this.cache.has(a) || (this.cache.set(this.g = a, c), this.limit && this.cache.size > this.limit && this.cache.delete(this.cache.keys().next().value)); this.cache.has(a) || (this.cache.set(this.C = a, b), this.limit && this.cache.size > this.limit && this.cache.delete(this.cache.keys().next().value));
}; };
F.prototype.get = function(a) { w.prototype.get = function(a) {
const c = this.cache.get(a); const b = this.cache.get(a);
c && this.limit && this.g !== a && (this.cache.delete(a), this.cache.set(this.g = a, c)); b && this.limit && this.C !== a && (this.cache.delete(a), this.cache.set(this.C = a, b));
return c;
};
F.prototype.remove = function(a) {
for (const c of this.cache) {
const b = c[0];
c[1].includes(a) && this.cache.delete(b);
}
};
F.prototype.clear = function() {
this.cache.clear();
this.g = "";
};
function G(a = 8) {
if (!(this instanceof G)) {
return new G(a);
}
this.index = v();
this.i = [];
this.size = 0;
32 < a ? (this.g = H, this.h = BigInt(a)) : (this.g = I, this.h = a);
}
G.prototype.get = function(a) {
const c = this.index[this.g(a)];
return c && c.get(a);
};
G.prototype.set = function(a, c) {
var b = this.g(a);
let d = this.index[b];
d ? (b = d.size, d.set(a, c), (b -= d.size) && this.size++) : (this.index[b] = d = new Map([[a, c]]), this.i.push(d));
};
function J(a = 8) {
if (!(this instanceof J)) {
return new J(a);
}
this.index = v();
this.g = [];
32 < a ? (this.i = H, this.h = BigInt(a)) : (this.i = I, this.h = a);
}
J.prototype.add = function(a) {
var c = this.i(a);
let b = this.index[c];
b ? (c = b.size, b.add(a), (c -= b.size) && this.size++) : (this.index[c] = b = new Set([a]), this.g.push(b));
};
t = G.prototype;
t.has = J.prototype.has = function(a) {
const c = this.index[this.i(a)];
return c && c.has(a);
};
t.delete = J.prototype.delete = function(a) {
const c = this.index[this.i(a)];
c && c.delete(a) && this.size--;
};
t.clear = J.prototype.clear = function() {
this.index = v();
this.g = [];
this.size = 0;
};
t.values = J.prototype.values = function*() {
for (let a = 0; a < this.g.length; a++) {
for (let c of this.g[a].values()) {
yield c;
}
}
};
t.keys = J.prototype.keys = function*() {
for (let a = 0; a < this.g.length; a++) {
for (let c of this.g[a].keys()) {
yield c;
}
}
};
t.entries = J.prototype.entries = function*() {
for (let a = 0; a < this.g.length; a++) {
for (let c of this.g[a].entries()) {
yield c;
}
}
};
function I(a) {
let c = 2 ** this.h - 1;
if ("number" == typeof a) {
return a & c;
}
let b = 0, d = this.h + 1;
for (let e = 0; e < a.length; e++) {
b = (b * d ^ a.charCodeAt(e)) & c;
}
return 32 === this.h ? b + 2 ** 31 : b;
}
function H(a) {
let c = BigInt(2) ** this.h - BigInt(1);
var b = typeof a;
if ("bigint" === b) {
return a & c;
}
if ("number" === b) {
return BigInt(a) & c;
}
b = BigInt(0);
let d = this.h + BigInt(1);
for (let e = 0; e < a.length; e++) {
b = (b * d ^ BigInt(a.charCodeAt(e))) & c;
}
return b; return b;
} };
;const K = v(), L = v(); w.prototype.remove = function(a) {
var M = {normalize:function(a) { for (const b of this.cache) {
return a.toLowerCase(); const c = b[0];
}, l:!1}; b[1].includes(a) && this.cache.delete(c);
const N = {memory:{resolution:1}, performance:{resolution:6, fastupdate:!0, context:{depth:1, resolution:3}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:9}}};
v();
P.prototype.add = function(a, c, b, d) {
if (c && (a || 0 === a)) {
if (!d && !b && this.j.has(a)) {
return this.update(a, c);
} }
c = this.encoder.encode(c); };
if (d = c.length) { w.prototype.clear = function() {
const r = v(), k = v(), p = this.depth, q = this.resolution; this.cache.clear();
for (let m = 0; m < d; m++) { this.C = "";
let n = c[this.rtl ? d - 1 - m : m]; };
const x = {memory:{resolution:1}, performance:{resolution:6, fastupdate:!0, context:{depth:1, resolution:3}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:9}}};
function y(a) {
const b = "string" === typeof a ? a : a.preset;
b && (x[b] || console.warn("Preset not found: " + b), a = Object.assign({}, x[b], a));
return a;
}
;t();
z.prototype.add = function(a, b, c, d) {
if (b && (a || 0 === a)) {
if (!d && !c && this.h.has(a)) {
return this.update(a, b);
}
b = this.encoder.encode(b);
if (d = b.length) {
const r = t(), k = t(), p = this.depth, q = this.resolution;
for (let l = 0; l < d; l++) {
let n = b[this.rtl ? d - 1 - l : l];
var e = n.length; var e = n.length;
if (e && (p || !k[n])) { if (e && (p || !k[n])) {
var g = this.score ? this.score(c, n, m, null, 0) : Q(q, d, m), f = ""; var f = this.score ? this.score(b, n, l, null, 0) : A(q, d, l), g = "";
switch(this.tokenize) { switch(this.tokenize) {
case "full": case "full":
if (2 < e) { if (2 < e) {
for (g = 0; g < e; g++) { for (f = 0; f < e; f++) {
for (var h = e; h > g; h--) { for (var h = e; h > f; h--) {
f = n.substring(g, h); g = n.substring(f, h);
var l = this.score ? this.score(c, n, m, f, g) : Q(q, d, m, e, g); var m = this.score ? this.score(b, n, l, g, f) : A(q, d, l, e, f);
R(this, k, f, l, a, b); B(this, k, g, m, a, c);
} }
} }
break; break;
@@ -325,108 +69,108 @@ P.prototype.add = function(a, c, b, d) {
case "reverse": case "reverse":
if (1 < e) { if (1 < e) {
for (h = e - 1; 0 < h; h--) { for (h = e - 1; 0 < h; h--) {
f = n[h] + f, l = this.score ? this.score(c, n, m, f, h) : Q(q, d, m, e, h), R(this, k, f, l, a, b); g = n[h] + g, m = this.score ? this.score(b, n, l, g, h) : A(q, d, l, e, h), B(this, k, g, m, a, c);
} }
f = ""; g = "";
} }
case "forward": case "forward":
if (1 < e) { if (1 < e) {
for (h = 0; h < e; h++) { for (h = 0; h < e; h++) {
f += n[h], R(this, k, f, g, a, b); g += n[h], B(this, k, g, f, a, c);
} }
break; break;
} }
default: default:
if (R(this, k, n, g, a, b), p && 1 < d && m < d - 1) { if (B(this, k, n, f, a, c), p && 1 < d && l < d - 1) {
for (e = v(), f = this.M, g = n, h = Math.min(p + 1, d - m), e[g] = 1, l = 1; l < h; l++) { for (e = t(), g = this.F, f = n, h = Math.min(p + 1, d - l), e[f] = 1, m = 1; m < h; m++) {
if ((n = c[this.rtl ? d - 1 - m - l : m + l]) && !e[n]) { if ((n = b[this.rtl ? d - 1 - l - m : l + m]) && !e[n]) {
e[n] = 1; e[n] = 1;
const x = this.score ? this.score(c, g, m, n, l) : Q(f + (d / 2 > f ? 0 : 1), d, m, h - 1, l - 1), O = this.bidirectional && n > g; const u = this.score ? this.score(b, f, l, n, m) : A(g + (d / 2 > g ? 0 : 1), d, l, h - 1, m - 1), H = this.bidirectional && n > f;
R(this, r, O ? g : n, x, a, b, O ? n : g); B(this, r, H ? f : n, u, a, c, H ? n : f);
} }
} }
} }
} }
} }
} }
this.fastupdate || this.j.add(a); this.fastupdate || this.h.add(a);
} }
} }
return this; return this;
}; };
function R(a, c, b, d, e, g, f) { function B(a, b, c, d, e, f, g) {
let h = f ? a.B : a.map, l; let h = g ? a.B : a.map, m;
c[b] && f && (l = c[b])[f] || (f ? (c = l || (c[b] = v()), c[f] = 1, (l = h.get(f)) ? h = l : h.set(f, h = new Map())) : c[b] = 1, (l = h.get(b)) ? h = l : h.set(b, h = []), h = h[d] || (h[d] = []), g && h.includes(e) || (h.push(e), a.fastupdate && ((c = a.j.get(e)) ? c.push(h) : a.j.set(e, [h])))); b[c] && g && (m = b[c])[g] || (g ? (b = m || (b[c] = t()), b[g] = 1, (m = h.get(g)) ? h = m : h.set(g, h = new Map())) : b[c] = 1, (m = h.get(c)) ? h = m : h.set(c, h = []), h = h[d] || (h[d] = []), f && h.includes(e) || (h.push(e), a.fastupdate && ((b = a.h.get(e)) ? b.push(h) : a.h.set(e, [h]))));
} }
function Q(a, c, b, d, e) { function A(a, b, c, d, e) {
return b && 1 < a ? c + (d || 0) <= a ? b + (e || 0) : (a - 1) / (c + (d || 0)) * (b + (e || 0)) + 1 | 0 : 0; return c && 1 < a ? b + (d || 0) <= a ? c + (e || 0) : (a - 1) / (b + (d || 0)) * (c + (e || 0)) + 1 | 0 : 0;
} }
;function S(a, c, b) { ;function C(a, b, c) {
if (1 === a.length) { if (1 === a.length) {
return a = a[0], a = b || a.length > c ? c ? a.slice(b, b + c) : a.slice(b) : a; return a = a[0], a = c || a.length > b ? b ? a.slice(c, c + b) : a.slice(c) : a;
} }
let d = []; let d = [];
for (let e = 0, g, f; e < a.length; e++) { for (let e = 0, f, g; e < a.length; e++) {
if ((g = a[e]) && (f = g.length)) { if ((f = a[e]) && (g = f.length)) {
if (b) { if (c) {
if (b >= f) { if (c >= g) {
b -= f; c -= g;
continue; continue;
} }
b < f && (g = c ? g.slice(b, b + c) : g.slice(b), f = g.length, b = 0); c < g && (f = b ? f.slice(c, c + b) : f.slice(c), g = f.length, c = 0);
} }
if (d.length) { if (d.length) {
f > c && (g = g.slice(0, c), f = g.length), d.push(g); g > b && (f = f.slice(0, b), g = f.length), d.push(f);
} else { } else {
if (f >= c) { if (g >= b) {
return f > c && (g = g.slice(0, c)), g; return g > b && (f = f.slice(0, b)), f;
} }
d = [g]; d = [f];
} }
c -= f; b -= g;
if (!c) { if (!b) {
break; break;
} }
} }
} }
return d.length ? d = 1 < d.length ? [].concat.apply([], d) : d[0] : d; return d.length ? d = 1 < d.length ? [].concat.apply([], d) : d[0] : d;
} }
;function T(a, c, b, d) { ;function D(a, b, c, d) {
var e = a.length; var e = a.length;
let g = [], f = 0, h, l, r; let f = [], g = 0, h, m, r;
d && (d = []); d && (d = []);
for (let k = e - 1, p; 0 <= k; k--) { for (let k = e - 1, p; 0 <= k; k--) {
r = a[k]; r = a[k];
e = v(); e = t();
p = !h; p = !h;
for (let q = 0, m; q < r.length; q++) { for (let q = 0, l; q < r.length; q++) {
if ((m = r[q]) && m.length) { if ((l = r[q]) && l.length) {
for (let n = 0, x; n < m.length; n++) { for (let n = 0, u; n < l.length; n++) {
if (x = m[n], h) { if (u = l[n], h) {
if (h[x]) { if (h[u]) {
if (!k) { if (!k) {
if (b) { if (c) {
b--; c--;
} else { } else {
if (g[f++] = x, f === c) { if (f[g++] = u, g === b) {
return g; return f;
} }
} }
} }
if (k || d) { if (k || d) {
e[x] = 1; e[u] = 1;
} }
p = !0; p = !0;
} }
d && !l[x] && (l[x] = 1, (d[q] || (d[q] = [])).push(x)); d && !m[u] && (m[u] = 1, (d[q] || (d[q] = [])).push(u));
} else { } else {
e[x] = 1; e[u] = 1;
} }
} }
} }
} }
if (d) { if (d) {
h || (l = e); h || (m = e);
} else if (!p) { } else if (!p) {
return []; return [];
} }
@@ -436,13 +180,13 @@ function Q(a, c, b, d, e) {
for (let k = d.length - 1, p, q; 0 <= k; k--) { for (let k = d.length - 1, p, q; 0 <= k; k--) {
p = d[k]; p = d[k];
q = p.length; q = p.length;
for (let m = 0, n; m < q; m++) { for (let l = 0, n; l < q; l++) {
if (n = p[m], !h[n]) { if (n = p[l], !h[n]) {
if (b) { if (c) {
b--; c--;
} else { } else {
if (g[f++] = n, f === c) { if (f[g++] = n, g === b) {
return g; return f;
} }
} }
h[n] = 1; h[n] = 1;
@@ -450,69 +194,69 @@ function Q(a, c, b, d, e) {
} }
} }
} }
return g; return f;
} }
;P.prototype.search = function(a, c, b) { ;z.prototype.search = function(a, b, c) {
b || (c || "object" !== typeof a ? "object" === typeof c && (b = c, c = 0) : (b = a, a = "")); c || (b || "object" !== typeof a ? "object" === typeof b && (c = b, b = 0) : (c = a, a = ""));
let d = []; let d = [];
let e, g = 0; let e, f = 0;
if (b) { if (c) {
a = b.query || a; a = c.query || a;
c = b.limit || c; b = c.limit || b;
g = b.offset || 0; f = c.offset || 0;
var f = b.context; var g = c.context;
e = !1; e = !1;
} }
a = this.encoder.encode(a); a = this.encoder.encode(a);
b = a.length; c = a.length;
c || (c = 100); b || (b = 100);
if (1 === b) { if (1 === c) {
return U.call(this, a[0], "", c, g); return E.call(this, a[0], "", b, f);
} }
f = this.depth && !1 !== f; g = this.depth && !1 !== g;
if (2 === b && f && !e) { if (2 === c && g && !e) {
return U.call(this, a[0], a[1], c, g); return E.call(this, a[0], a[1], b, f);
} }
let h = 0, l = 0; let h = 0, m = 0;
if (1 < b) { if (1 < c) {
var r = v(); var r = t();
const p = []; const p = [];
for (let q = 0, m; q < b; q++) { for (let q = 0, l; q < c; q++) {
if ((m = a[q]) && !r[m]) { if ((l = a[q]) && !r[l]) {
if (e || V(this, m)) { if (e || F(this, l)) {
p.push(m), r[m] = 1; p.push(l), r[l] = 1;
} else { } else {
return d; return d;
} }
const n = m.length; const n = l.length;
h = Math.max(h, n); h = Math.max(h, n);
l = l ? Math.min(l, n) : n; m = m ? Math.min(m, n) : n;
} }
} }
a = p; a = p;
b = a.length; c = a.length;
} }
if (!b) { if (!c) {
return d; return d;
} }
r = 0; r = 0;
let k; let k;
if (1 === b) { if (1 === c) {
return U.call(this, a[0], "", c, g); return E.call(this, a[0], "", b, f);
} }
if (2 === b && f && !e) { if (2 === c && g && !e) {
return U.call(this, a[0], a[1], c, g); return E.call(this, a[0], a[1], b, f);
} }
1 < b && (f ? (k = a[0], r = 1) : 9 < h && 3 < h / l && a.sort(w)); 1 < c && (g ? (k = a[0], r = 1) : 9 < h && 3 < h / m && a.sort(v));
for (let p, q; r < b; r++) { for (let p, q; r < c; r++) {
q = a[r]; q = a[r];
k ? (p = V(this, q, k), p = W(p, d, e, this.M, c, g, 2 === b), e && !1 === p && d.length || (k = q)) : (p = V(this, q), p = W(p, d, e, this.resolution, c, g, 1 === b)); k ? (p = F(this, q, k), p = G(p, d, e, this.F, b, f, 2 === c), e && !1 === p && d.length || (k = q)) : (p = F(this, q), p = G(p, d, e, this.resolution, b, f, 1 === c));
if (p) { if (p) {
return p; return p;
} }
if (e && r === b - 1) { if (e && r === c - 1) {
f = d.length; g = d.length;
if (!f) { if (!g) {
if (k) { if (k) {
k = ""; k = "";
r = -1; r = -1;
@@ -520,171 +264,191 @@ function Q(a, c, b, d, e) {
} }
return d; return d;
} }
if (1 === f) { if (1 === g) {
return S(d[0], c, g); return C(d[0], b, f);
} }
} }
} }
return T(d, c, g, e); return D(d, b, f, e);
}; };
function U(a, c, b, d) { function E(a, b, c, d) {
return (a = V(this, a, c)) && a.length ? S(a, b, d) : []; return (a = F(this, a, b)) && a.length ? C(a, c, d) : [];
} }
function W(a, c, b, d, e, g, f) { function G(a, b, c, d, e, f, g) {
let h = []; let h = [];
if (a) { if (a) {
d = Math.min(a.length, d); d = Math.min(a.length, d);
for (let l = 0, r = 0, k; l < d; l++) { for (let m = 0, r = 0, k; m < d; m++) {
if (k = a[l]) { if (k = a[m]) {
if (g && k && f && (k.length <= g ? (g -= k.length, k = null) : (k = k.slice(g), g = 0)), k && (h[l] = k, f && (r += k.length, r >= e))) { if (f && k && g && (k.length <= f ? (f -= k.length, k = null) : (k = k.slice(f), f = 0)), k && (h[m] = k, g && (r += k.length, r >= e))) {
break; break;
} }
} }
} }
if (h.length) { if (h.length) {
if (f) { if (g) {
return S(h, e, 0); return C(h, e, 0);
} }
c.push(h); b.push(h);
return; return;
} }
} }
return !b && h; return !c && h;
} }
function V(a, c, b) { function F(a, b, c) {
let d; let d;
b && (d = a.bidirectional && c > b); c && (d = a.bidirectional && b > c);
a = b ? (a = a.B.get(d ? c : b)) && a.get(d ? b : c) : a.map.get(c); a = c ? (a = a.B.get(d ? b : c)) && a.get(d ? c : b) : a.map.get(b);
return a; return a;
} }
;P.prototype.remove = function(a, c) { ;z.prototype.remove = function(a, b) {
const b = this.j.size && (this.fastupdate ? this.j.get(a) : this.j.has(a)); const c = this.h.size && (this.fastupdate ? this.h.get(a) : this.h.has(a));
if (b) { if (c) {
if (this.fastupdate) { if (this.fastupdate) {
for (let d = 0, e; d < b.length; d++) { for (let d = 0, e; d < c.length; d++) {
if (e = b[d]) { if (e = c[d]) {
if (2 > e.length) { if (2 > e.length) {
e.pop(); e.pop();
} else { } else {
const g = e.indexOf(a); const f = e.indexOf(a);
g === b.length - 1 ? e.pop() : e.splice(g, 1); f === c.length - 1 ? e.pop() : e.splice(f, 1);
} }
} }
} }
} else { } else {
X(this.map, a), this.depth && X(this.B, a); I(this.map, a), this.depth && I(this.B, a);
} }
c || this.j.delete(a); b || this.h.delete(a);
} }
this.cache && this.cache.remove(a); this.cache && this.cache.remove(a);
return this; return this;
}; };
function X(a, c) { function I(a, b) {
let b = 0; let c = 0;
if (a.constructor === Array) { if (a.constructor === Array) {
for (let d = 0, e, g; d < a.length; d++) { for (let d = 0, e, f; d < a.length; d++) {
if ((e = a[d]) && e.length) { if ((e = a[d]) && e.length) {
if (g = e.indexOf(c), 0 <= g) { if (f = e.indexOf(b), 0 <= f) {
1 < e.length ? (e.splice(g, 1), b++) : delete a[d]; 1 < e.length ? (e.splice(f, 1), c++) : delete a[d];
break; break;
} else { } else {
b++; c++;
} }
} }
} }
} else { } else {
for (let d of a) { for (let d of a) {
const e = d[0], g = X(d[1], c); const e = d[0], f = I(d[1], b);
g ? b += g : a.delete(e); f ? c += f : a.delete(e);
}
}
return b;
}
;function P(a, c) {
if (!(this instanceof P)) {
return new P(a);
}
if (a) {
var b = "string" === typeof a ? a : a.preset;
b && (N[b] || console.warn("Preset not found: " + b), a = Object.assign({}, N[b], a));
} else {
a = {};
}
b = a.context || {};
const d = a.encode || a.encoder || M;
this.encoder = d.encode ? d : "object" === typeof d ? new D(d) : {encode:d};
let e;
this.resolution = a.resolution || 9;
this.tokenize = e = a.tokenize || "strict";
this.depth = "strict" === e && b.depth || 0;
this.bidirectional = !1 !== b.bidirectional;
this.fastupdate = !!a.fastupdate;
this.score = a.score || null;
this.map = (e = !1, new Map());
this.B = e ? new G(e) : new Map();
this.j = c || (this.fastupdate ? e ? new G(e) : new Map() : e ? new J(e) : new Set());
this.M = b.resolution || 1;
this.rtl = d.rtl || a.rtl || !1;
this.cache = (e = a.cache || null) && new F(e);
}
t = P.prototype;
t.clear = function() {
this.map.clear();
this.B.clear();
this.j.clear();
this.cache && this.cache.clear();
return this;
};
t.append = function(a, c) {
return this.add(a, c, !0);
};
t.contain = function(a) {
return this.j.has(a);
};
t.update = function(a, c) {
if (this.async) {
const b = this, d = this.remove(a);
return d.then ? d.then(() => b.add(a, c)) : this.add(a, c);
}
return this.remove(a).add(a, c);
};
function Y(a) {
let c = 0;
if (a.constructor === Array) {
for (let b = 0, d; b < a.length; b++) {
(d = a[b]) && (c += d.length);
}
} else {
for (const b of a) {
const d = b[0], e = Y(b[1]);
e ? c += e : a.delete(d);
} }
} }
return c; return c;
} }
t.cleanup = function() { ;function z(a, b) {
if (!(this instanceof z)) {
return new z(a);
}
a = a ? y(a) : {};
const c = a.context || {}, d = a.encode || a.encoder || function(f) {
return f.toLowerCase().trim().split(/\s+/);
};
this.encoder = d.encode ? d : "object" === typeof d ? d : {encode:d};
let e;
this.resolution = a.resolution || 9;
this.tokenize = e = a.tokenize || "strict";
this.depth = "strict" === e && c.depth || 0;
this.bidirectional = !1 !== c.bidirectional;
this.fastupdate = !!a.fastupdate;
this.score = a.score || null;
e = !1;
this.map = new Map();
this.B = new Map();
this.h = b || (this.fastupdate ? new Map() : new Set());
this.F = c.resolution || 1;
this.rtl = d.rtl || a.rtl || !1;
this.cache = (e = a.cache || null) && new w(e);
}
z.prototype.clear = function() {
this.map.clear();
this.B.clear();
this.h.clear();
this.cache && this.cache.clear();
return this;
};
z.prototype.append = function(a, b) {
return this.add(a, b, !0);
};
z.prototype.contain = function(a) {
return this.h.has(a);
};
z.prototype.update = function(a, b) {
if (this.async) {
const c = this, d = this.remove(a);
return d.then ? d.then(() => c.add(a, b)) : this.add(a, b);
}
return this.remove(a).add(a, b);
};
function J(a) {
let b = 0;
if (a.constructor === Array) {
for (let c = 0, d; c < a.length; c++) {
(d = a[c]) && (b += d.length);
}
} else {
for (const c of a) {
const d = c[0], e = J(c[1]);
e ? b += e : a.delete(d);
}
}
return b;
}
z.prototype.cleanup = function() {
if (!this.fastupdate) { if (!this.fastupdate) {
return console.info('Cleanup the index isn\'t required when not using "fastupdate".'), this; return console.info('Cleanup the index isn\'t required when not using "fastupdate".'), this;
} }
Y(this.map); J(this.map);
this.depth && Y(this.B); this.depth && J(this.B);
return this; return this;
}; };
t.searchCache = function(a, c, b) { z.prototype.searchCache = function(a, b, c) {
a = ("object" === typeof a ? "" + a.query : a).toLowerCase(); a = ("object" === typeof a ? "" + a.query : a).toLowerCase();
let d = this.cache.get(a); let d = this.cache.get(a);
if (!d) { if (!d) {
d = this.search(a, c, b); d = this.search(a, b, c);
if (d instanceof Promise) { if (d instanceof Promise) {
const e = this; const e = this;
d.then(function(g) { d.then(function(f) {
e.cache.set(a, g); e.cache.set(a, f);
}); });
} }
this.cache.set(a, d); this.cache.set(a, d);
} }
return d; return d;
}; };
export default {Index:P, Encoder:D, Charset:L, Language:K, Document:null, Worker:null, Resolver:null, IndexedDB:null}; const K = t();
const L = 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 M = {normalize:!0, A:!0, D:L};
const N = new Map([["ai", "ei"], ["ae", "a"], ["oe", "o"], ["ue", "u"], ["sh", "s"], ["ch", "c"], ["th", "t"], ["ph", "f"], ["pf", "f"]]), O = [/([^aeo])h([aeo$])/g, "$1$2", /([aeo])h([^aeo]|$)/g, "$1$2"];
var P = {normalize:!0, A:!0, D:L, H:O, G:N};
var Q = {normalize:!0, A:!0, D:L, H:O.concat([/(?!^)[aeoy]/g, ""]), G:N};
const R = {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};
K["latin:exact"] = {normalize:!1, A:!1};
K["latin:default"] = {normalize:function(a) {
return a.toLowerCase();
}, A:!1};
K["latin:simple"] = {normalize:!0, A:!0};
K["latin:balance"] = M;
K["latin:advanced"] = P;
K["latin:extra"] = Q;
K["latin:soundex"] = {normalize:!0, A:!1, J:{K:!0}, I:function(a) {
for (let c = 0; c < a.length; c++) {
var b = a[c];
let d = b.charAt(0), e = R[d];
for (let f = 1, g; f < b.length && (g = b.charAt(f), "h" === g || "w" === g || !(g = R[g]) || g === e || (d += g, e = g, 4 !== d.length)); f++) {
}
a[c] = d;
}
}};
export default {Index:z, Charset:K, Encoder:null, Document:null, Worker:null, Resolver:null, IndexedDB:null};
export const Index=P;export const Encoder=D;export const Charset=L;export const Language=K;export const Document=null;export const Worker=null;export const Resolver=null;export const IndexedDB=null; export const Index=z;export const Charset=K;export const Encoder=null;export const Document=null;export const Worker=null;export const Resolver=null;export const IndexedDB=null;

View File

@@ -5,25 +5,16 @@
* Hosted by Nextapps GmbH * Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch * https://github.com/nextapps-de/flexsearch
*/ */
var t;function u(a,c,b){const d=typeof b,e=typeof a;if("undefined"!==d){if("undefined"!==e){if(b){if("function"===e&&d===e)return function(h){return a(b(h))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var g=new Map(b);for(var f of a)g.set(f[0],f[1]);return g}if(c===Set){f=new Set(b);for(g of a.values())f.add(g);return f}}}return a}return b}return"undefined"===e?c:a}function v(){return Object.create(null)}function w(a,c){return c.length-a.length};const y=/[^\p{L}\p{N}]+/u,z=/(\d{3})/g,A=/(\D)(\d{3})/g,B=/(\d{3})(\D)/g,C="".normalize&&/[\u0300-\u036f]/g;function D(a={}){if(!(this instanceof D))return new D(...arguments);for(a=0;a<arguments.length;a++)this.assign(arguments[a])} function t(){return Object.create(null)}function v(a,b){return b.length-a.length};function w(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.C=""}w.prototype.set=function(a,b){this.cache.has(a)||(this.cache.set(this.C=a,b),this.limit&&this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value))};w.prototype.get=function(a){const b=this.cache.get(a);b&&this.limit&&this.C!==a&&(this.cache.delete(a),this.cache.set(this.C=a,b));return b};w.prototype.remove=function(a){for(const b of this.cache){const c=b[0];b[1].includes(a)&&this.cache.delete(c)}};
D.prototype.assign=function(a){this.normalize=u(a.normalize,!0,this.normalize);let c=a.N,b=c||a.O||a.split;if("object"===typeof b){let d=!c,e="";a.N||(e+="\\p{Z}");b.P&&(e+="\\p{L}");b.R&&(e+="\\p{N}",d=!!c);b.T&&(e+="\\p{S}");b.S&&(e+="\\p{P}");b.control&&(e+="\\p{C}");if(b=b.char)e+="object"===typeof b?b.join(""):b;this.split=new RegExp("["+(c?"^":"")+e+"]+","u");this.numeric=d}else this.split=u(b,y,this.split),this.numeric=u(this.numeric,!0);this.H=u(a.H,null,this.H);this.D=u(a.D,null,this.D); w.prototype.clear=function(){this.cache.clear();this.C=""};const x={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};function y(a){const b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},x[b],a));return a};t();z.prototype.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.h.has(a))return this.update(a,b);b=this.encoder.encode(b);if(d=b.length){const r=t(),k=t(),p=this.depth,q=this.resolution;for(let l=0;l<d;l++){let n=b[this.rtl?d-1-l:l];var e=n.length;if(e&&(p||!k[n])){var f=this.score?this.score(b,n,l,null,0):A(q,d,l),g="";switch(this.tokenize){case "full":if(2<e){for(f=0;f<e;f++)for(var h=e;h>f;h--){g=n.substring(f,h);var m=this.score?this.score(b,n,l,g,f):A(q,d,l,e,f);B(this,k,g,m,a,c)}break}case "reverse":if(1<
this.rtl=a.rtl||!1;this.l=u(a.l,!0,this.l);this.filter=u((b=a.filter)&&new Set(b),null,this.filter);this.m=u((b=a.m)&&new Map(b),null,this.m);this.v=u((b=a.v)&&new Map(b),null,this.v);this.s=u((b=a.s)&&new Map(b),null,this.s);this.o=u(a.o,null,this.o);this.G=u(a.G,1,this.G);this.K=u(a.K,0,this.K);if(this.cache=b=u(a.cache,!0,this.cache))this.C=null,this.L="number"===typeof b?b:2E5,this.u=new Map,this.A=new Map,this.h=this.g=128;this.i="";this.I=null;this.F="";this.J=null;if(this.m)for(const d of this.m.keys())this.i+= e){for(h=e-1;0<h;h--)g=n[h]+g,m=this.score?this.score(b,n,l,g,h):A(q,d,l,e,h),B(this,k,g,m,a,c);g=""}case "forward":if(1<e){for(h=0;h<e;h++)g+=n[h],B(this,k,g,f,a,c);break}default:if(B(this,k,n,f,a,c),p&&1<d&&l<d-1)for(e=t(),g=this.F,f=n,h=Math.min(p+1,d-l),e[f]=1,m=1;m<h;m++)if((n=b[this.rtl?d-1-l-m:l+m])&&!e[n]){e[n]=1;const u=this.score?this.score(b,f,l,n,m):A(g+(d/2>g?0:1),d,l,h-1,m-1),G=this.bidirectional&&n>f;B(this,r,G?f:n,u,a,c,G?n:f)}}}}this.fastupdate||this.h.add(a)}}return this};
(this.i?"|":"")+d;if(this.s)for(const d of this.s.keys())this.F+=(this.F?"|":"")+d;return this}; function B(a,b,c,d,e,f,g){let h=g?a.B:a.map,m;b[c]&&g&&(m=b[c])[g]||(g?(b=m||(b[c]=t()),b[g]=1,(m=h.get(g))?h=m:h.set(g,h=new Map)):b[c]=1,(m=h.get(c))?h=m:h.set(c,h=[]),h=h[d]||(h[d]=[]),f&&h.includes(e)||(h.push(e),a.fastupdate&&((b=a.h.get(e))?b.push(h):a.h.set(e,[h]))))}function A(a,b,c,d,e){return c&&1<a?b+(d||0)<=a?c+(e||0):(a-1)/(b+(d||0))*(c+(e||0))+1|0:0};function C(a,b,c){if(1===a.length)return a=a[0],a=c||a.length>b?b?a.slice(c,c+b):a.slice(c):a;let d=[];for(let e=0,f,g;e<a.length;e++)if((f=a[e])&&(g=f.length)){if(c){if(c>=g){c-=g;continue}c<g&&(f=b?f.slice(c,c+b):f.slice(c),g=f.length,c=0)}if(d.length)g>b&&(f=f.slice(0,b),g=f.length),d.push(f);else{if(g>=b)return g>b&&(f=f.slice(0,b)),f;d=[f]}b-=g;if(!b)break}return d.length?d=1<d.length?[].concat.apply([],d):d[0]:d};function D(a,b,c,d){var e=a.length;let f=[],g=0,h,m,r;d&&(d=[]);for(let k=e-1,p;0<=k;k--){r=a[k];e=t();p=!h;for(let q=0,l;q<r.length;q++)if((l=r[q])&&l.length)for(let n=0,u;n<l.length;n++)if(u=l[n],h){if(h[u]){if(!k)if(c)c--;else if(f[g++]=u,g===b)return f;if(k||d)e[u]=1;p=!0}d&&!m[u]&&(m[u]=1,(d[q]||(d[q]=[])).push(u))}else e[u]=1;if(d)h||(m=e);else if(!p)return[];h=e}if(d)for(let k=d.length-1,p,q;0<=k;k--){p=d[k];q=p.length;for(let l=0,n;l<q;l++)if(n=p[l],!h[n]){if(c)c--;else if(f[g++]=n,g===b)return f;
D.prototype.encode=function(a){if(this.cache&&a.length<=this.g)if(this.C){if(this.u.has(a))return this.u.get(a)}else this.C=setTimeout(E,0,this);this.normalize&&(a="function"===typeof this.normalize?this.normalize(a):C?a.normalize("NFKD").replace(C,"").toLowerCase():a.toLowerCase());this.H&&(a=this.H(a));this.numeric&&3<a.length&&(a=a.replace(A,"$1 $2").replace(B,"$1 $2").replace(z,"$1 "));const c=!(this.l||this.v||this.filter||this.m||this.s||this.o);let b=[],d=this.split||""===this.split?a.split(this.split): h[n]=1}}return f};z.prototype.search=function(a,b,c){c||(b||"object"!==typeof a?"object"===typeof b&&(c=b,b=0):(c=a,a=""));let d=[];let e,f=0;if(c){a=c.query||a;b=c.limit||b;f=c.offset||0;var g=c.context;e=!1}a=this.encoder.encode(a);c=a.length;b||(b=100);if(1===c)return E.call(this,a[0],"",b,f);g=this.depth&&!1!==g;if(2===c&&g&&!e)return E.call(this,a[0],a[1],b,f);let h=0,m=0;if(1<c){var r=t();const p=[];for(let q=0,l;q<c;q++)if((l=a[q])&&!r[l]){if(e||F(this,l))p.push(l),r[l]=1;else return d;const n=l.length;h=Math.max(h,
a;for(let g=0,f,h;g<d.length;g++){if(!(f=h=d[g]))continue;if(f.length<this.G)continue;if(c){b.push(f);continue}if(this.filter&&this.filter.has(f))continue;if(this.cache&&f.length<=this.h)if(this.C){var e=this.A.get(f);if(e||""===e){e&&b.push(e);continue}}else this.C=setTimeout(E,0,this);let l;this.s&&2<f.length&&(this.J||(this.J=new RegExp("(?!^)("+this.F+")$")),f=f.replace(this.J,r=>this.s.get(r)),l=1);this.m&&1<f.length&&(this.I||(this.I=new RegExp("("+this.i+")","g")),f=f.replace(this.I,r=>this.m.get(r)), n);m=m?Math.min(m,n):n}a=p;c=a.length}if(!c)return d;r=0;let k;if(1===c)return E.call(this,a[0],"",b,f);if(2===c&&g&&!e)return E.call(this,a[0],a[1],b,f);1<c&&(g?(k=a[0],r=1):9<h&&3<h/m&&a.sort(v));for(let p,q;r<c;r++){q=a[r];k?(p=F(this,q,k),p=H(p,d,e,this.F,b,f,2===c),e&&!1===p&&d.length||(k=q)):(p=F(this,q),p=H(p,d,e,this.resolution,b,f,1===c));if(p)return p;if(e&&r===c-1){g=d.length;if(!g){if(k){k="";r=-1;continue}return d}if(1===g)return C(d[0],b,f)}}return D(d,b,f,e)};
l=1);f&&l&&(f.length<this.G||this.filter&&this.filter.has(f))&&(f="");if(f&&(this.v||this.l&&1<f.length)){e="";for(let r=0,k="",p,q;r<f.length;r++)p=f.charAt(r),p===k&&this.l||((q=this.v&&this.v.get(p))||""===q?q===k&&this.l||!(k=q)||(e+=q):e+=k=p);f=e}if(f&&this.o)for(e=0;f&&e<this.o.length;e+=2)f=f.replace(this.o[e],this.o[e+1]);this.cache&&h.length<=this.h&&(this.A.set(h,f),this.A.size>this.L&&(this.A.clear(),this.h=this.h/1.1|0));f&&b.push(f)}this.D&&(b=this.D(b)||b);this.cache&&a.length<=this.g&& function E(a,b,c,d){return(a=F(this,a,b))&&a.length?C(a,c,d):[]}function H(a,b,c,d,e,f,g){let h=[];if(a){d=Math.min(a.length,d);for(let m=0,r=0,k;m<d;m++)if(k=a[m])if(f&&k&&g&&(k.length<=f?(f-=k.length,k=null):(k=k.slice(f),f=0)),k&&(h[m]=k,g&&(r+=k.length,r>=e)))break;if(h.length){if(g)return C(h,e,0);b.push(h);return}}return!c&&h}function F(a,b,c){let d;c&&(d=a.bidirectional&&b>c);a=c?(a=a.B.get(d?b:c))&&a.get(d?c:b):a.map.get(b);return a};z.prototype.remove=function(a,b){const c=this.h.size&&(this.fastupdate?this.h.get(a):this.h.has(a));if(c){if(this.fastupdate)for(let d=0,e;d<c.length;d++){if(e=c[d])if(2>e.length)e.pop();else{const f=e.indexOf(a);f===c.length-1?e.pop():e.splice(f,1)}}else I(this.map,a),this.depth&&I(this.B,a);b||this.h.delete(a)}this.cache&&this.cache.remove(a);return this};
(this.u.set(a,b),this.u.size>this.L&&(this.u.clear(),this.g=this.g/1.1|0));return b};function E(a){a.C=null;a.u.clear();a.A.clear()};function F(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.g=""}F.prototype.set=function(a,c){this.cache.has(a)||(this.cache.set(this.g=a,c),this.limit&&this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value))};F.prototype.get=function(a){const c=this.cache.get(a);c&&this.limit&&this.g!==a&&(this.cache.delete(a),this.cache.set(this.g=a,c));return c};F.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}}; function I(a,b){let c=0;if(a.constructor===Array)for(let d=0,e,f;d<a.length;d++){if((e=a[d])&&e.length)if(f=e.indexOf(b),0<=f){1<e.length?(e.splice(f,1),c++):delete a[d];break}else c++}else for(let d of a){const e=d[0],f=I(d[1],b);f?c+=f:a.delete(e)}return c};function z(a,b){if(!(this instanceof z))return new z(a);a=a?y(a):{};const c=a.context||{},d=a.encode||a.encoder||function(f){return f.toLowerCase().trim().split(/\s+/)};this.encoder=d.encode?d:"object"===typeof d?d:{encode:d};let e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&c.depth||0;this.bidirectional=!1!==c.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;e=!1;this.map=new Map;this.B=new Map;this.h=b||(this.fastupdate?new Map:
F.prototype.clear=function(){this.cache.clear();this.g=""};function G(a=8){if(!(this instanceof G))return new G(a);this.index=v();this.i=[];this.size=0;32<a?(this.g=H,this.h=BigInt(a)):(this.g=I,this.h=a)}G.prototype.get=function(a){const c=this.index[this.g(a)];return c&&c.get(a)};G.prototype.set=function(a,c){var b=this.g(a);let d=this.index[b];d?(b=d.size,d.set(a,c),(b-=d.size)&&this.size++):(this.index[b]=d=new Map([[a,c]]),this.i.push(d))}; new Set);this.F=c.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new w(e)}z.prototype.clear=function(){this.map.clear();this.B.clear();this.h.clear();this.cache&&this.cache.clear();return this};z.prototype.append=function(a,b){return this.add(a,b,!0)};z.prototype.contain=function(a){return this.h.has(a)};z.prototype.update=function(a,b){if(this.async){const c=this,d=this.remove(a);return d.then?d.then(()=>c.add(a,b)):this.add(a,b)}return this.remove(a).add(a,b)};
function J(a=8){if(!(this instanceof J))return new J(a);this.index=v();this.g=[];32<a?(this.i=H,this.h=BigInt(a)):(this.i=I,this.h=a)}J.prototype.add=function(a){var c=this.i(a);let b=this.index[c];b?(c=b.size,b.add(a),(c-=b.size)&&this.size++):(this.index[c]=b=new Set([a]),this.g.push(b))};t=G.prototype;t.has=J.prototype.has=function(a){const c=this.index[this.i(a)];return c&&c.has(a)};t.delete=J.prototype.delete=function(a){const c=this.index[this.i(a)];c&&c.delete(a)&&this.size--}; function J(a){let b=0;if(a.constructor===Array)for(let c=0,d;c<a.length;c++)(d=a[c])&&(b+=d.length);else for(const c of a){const d=c[0],e=J(c[1]);e?b+=e:a.delete(d)}return b}z.prototype.cleanup=function(){if(!this.fastupdate)return this;J(this.map);this.depth&&J(this.B);return this};
t.clear=J.prototype.clear=function(){this.index=v();this.g=[];this.size=0};t.values=J.prototype.values=function*(){for(let a=0;a<this.g.length;a++)for(let c of this.g[a].values())yield c};t.keys=J.prototype.keys=function*(){for(let a=0;a<this.g.length;a++)for(let c of this.g[a].keys())yield c};t.entries=J.prototype.entries=function*(){for(let a=0;a<this.g.length;a++)for(let c of this.g[a].entries())yield c}; z.prototype.searchCache=function(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();let d=this.cache.get(a);if(!d){d=this.search(a,b,c);if(d instanceof Promise){const e=this;d.then(function(f){e.cache.set(a,f)})}this.cache.set(a,d)}return d};const K=t();const L=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 M={normalize:!0,A:!0,D:L};const N=new Map([["ai","ei"],["ae","a"],["oe","o"],["ue","u"],["sh","s"],["ch","c"],["th","t"],["ph","f"],["pf","f"]]),O=[/([^aeo])h([aeo$])/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2"];var P={normalize:!0,A:!0,D:L,H:O,G:N};var Q={normalize:!0,A:!0,D:L,H:O.concat([/(?!^)[aeoy]/g,""]),G:N};const R={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};K["latin:exact"]={normalize:!1,A:!1};K["latin:default"]={normalize:function(a){return a.toLowerCase()},A:!1};K["latin:simple"]={normalize:!0,A:!0};K["latin:balance"]=M;K["latin:advanced"]=P;K["latin:extra"]=Q;K["latin:soundex"]={normalize:!0,A:!1,J:{K:!0},I:function(a){for(let c=0;c<a.length;c++){var b=a[c];let d=b.charAt(0),e=R[d];for(let f=1,g;f<b.length&&(g=b.charAt(f),"h"===g||"w"===g||!(g=R[g])||g===e||(d+=g,e=g,4!==d.length));f++);a[c]=d}}};
function I(a){let c=2**this.h-1;if("number"==typeof a)return a&c;let b=0,d=this.h+1;for(let e=0;e<a.length;e++)b=(b*d^a.charCodeAt(e))&c;return 32===this.h?b+2**31:b}function H(a){let c=BigInt(2)**this.h-BigInt(1);var b=typeof a;if("bigint"===b)return a&c;if("number"===b)return BigInt(a)&c;b=BigInt(0);let d=this.h+BigInt(1);for(let e=0;e<a.length;e++)b=(b*d^BigInt(a.charCodeAt(e)))&c;return b};const K=v(),L=v();var M={normalize:function(a){return a.toLowerCase()},l:!1};const O={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};v();P.prototype.add=function(a,c,b,d){if(c&&(a||0===a)){if(!d&&!b&&this.j.has(a))return this.update(a,c);c=this.encoder.encode(c);if(d=c.length){const r=v(),k=v(),p=this.depth,q=this.resolution;for(let m=0;m<d;m++){let n=c[this.rtl?d-1-m:m];var e=n.length;if(e&&(p||!k[n])){var g=this.score?this.score(c,n,m,null,0):Q(q,d,m),f="";switch(this.tokenize){case "full":if(2<e){for(g=0;g<e;g++)for(var h=e;h>g;h--){f=n.substring(g,h);var l=this.score?this.score(c,n,m,f,g):Q(q,d,m,e,g);R(this,k,f,l,a,b)}break}case "reverse":if(1< export default {Index:z,Charset:K,Encoder:null,Document:null,Worker:null,Resolver:null,IndexedDB:null};
e){for(h=e-1;0<h;h--)f=n[h]+f,l=this.score?this.score(c,n,m,f,h):Q(q,d,m,e,h),R(this,k,f,l,a,b);f=""}case "forward":if(1<e){for(h=0;h<e;h++)f+=n[h],R(this,k,f,g,a,b);break}default:if(R(this,k,n,g,a,b),p&&1<d&&m<d-1)for(e=v(),f=this.M,g=n,h=Math.min(p+1,d-m),e[g]=1,l=1;l<h;l++)if((n=c[this.rtl?d-1-m-l:m+l])&&!e[n]){e[n]=1;const x=this.score?this.score(c,g,m,n,l):Q(f+(d/2>f?0:1),d,m,h-1,l-1),N=this.bidirectional&&n>g;R(this,r,N?g:n,x,a,b,N?n:g)}}}}this.fastupdate||this.j.add(a)}}return this}; export const Index=z;export const Charset=K;export const Encoder=null;export const Document=null;export const Worker=null;export const Resolver=null;export const IndexedDB=null;
function R(a,c,b,d,e,g,f){let h=f?a.B:a.map,l;c[b]&&f&&(l=c[b])[f]||(f?(c=l||(c[b]=v()),c[f]=1,(l=h.get(f))?h=l:h.set(f,h=new Map)):c[b]=1,(l=h.get(b))?h=l:h.set(b,h=[]),h=h[d]||(h[d]=[]),g&&h.includes(e)||(h.push(e),a.fastupdate&&((c=a.j.get(e))?c.push(h):a.j.set(e,[h]))))}function Q(a,c,b,d,e){return b&&1<a?c+(d||0)<=a?b+(e||0):(a-1)/(c+(d||0))*(b+(e||0))+1|0:0};function S(a,c,b){if(1===a.length)return a=a[0],a=b||a.length>c?c?a.slice(b,b+c):a.slice(b):a;let d=[];for(let e=0,g,f;e<a.length;e++)if((g=a[e])&&(f=g.length)){if(b){if(b>=f){b-=f;continue}b<f&&(g=c?g.slice(b,b+c):g.slice(b),f=g.length,b=0)}if(d.length)f>c&&(g=g.slice(0,c),f=g.length),d.push(g);else{if(f>=c)return f>c&&(g=g.slice(0,c)),g;d=[g]}c-=f;if(!c)break}return d.length?d=1<d.length?[].concat.apply([],d):d[0]:d};function T(a,c,b,d){var e=a.length;let g=[],f=0,h,l,r;d&&(d=[]);for(let k=e-1,p;0<=k;k--){r=a[k];e=v();p=!h;for(let q=0,m;q<r.length;q++)if((m=r[q])&&m.length)for(let n=0,x;n<m.length;n++)if(x=m[n],h){if(h[x]){if(!k)if(b)b--;else if(g[f++]=x,f===c)return g;if(k||d)e[x]=1;p=!0}d&&!l[x]&&(l[x]=1,(d[q]||(d[q]=[])).push(x))}else e[x]=1;if(d)h||(l=e);else if(!p)return[];h=e}if(d)for(let k=d.length-1,p,q;0<=k;k--){p=d[k];q=p.length;for(let m=0,n;m<q;m++)if(n=p[m],!h[n]){if(b)b--;else if(g[f++]=n,f===c)return g;
h[n]=1}}return g};P.prototype.search=function(a,c,b){b||(c||"object"!==typeof a?"object"===typeof c&&(b=c,c=0):(b=a,a=""));let d=[];let e,g=0;if(b){a=b.query||a;c=b.limit||c;g=b.offset||0;var f=b.context;e=!1}a=this.encoder.encode(a);b=a.length;c||(c=100);if(1===b)return U.call(this,a[0],"",c,g);f=this.depth&&!1!==f;if(2===b&&f&&!e)return U.call(this,a[0],a[1],c,g);let h=0,l=0;if(1<b){var r=v();const p=[];for(let q=0,m;q<b;q++)if((m=a[q])&&!r[m]){if(e||V(this,m))p.push(m),r[m]=1;else return d;const n=m.length;h=Math.max(h,
n);l=l?Math.min(l,n):n}a=p;b=a.length}if(!b)return d;r=0;let k;if(1===b)return U.call(this,a[0],"",c,g);if(2===b&&f&&!e)return U.call(this,a[0],a[1],c,g);1<b&&(f?(k=a[0],r=1):9<h&&3<h/l&&a.sort(w));for(let p,q;r<b;r++){q=a[r];k?(p=V(this,q,k),p=W(p,d,e,this.M,c,g,2===b),e&&!1===p&&d.length||(k=q)):(p=V(this,q),p=W(p,d,e,this.resolution,c,g,1===b));if(p)return p;if(e&&r===b-1){f=d.length;if(!f){if(k){k="";r=-1;continue}return d}if(1===f)return S(d[0],c,g)}}return T(d,c,g,e)};
function U(a,c,b,d){return(a=V(this,a,c))&&a.length?S(a,b,d):[]}function W(a,c,b,d,e,g,f){let h=[];if(a){d=Math.min(a.length,d);for(let l=0,r=0,k;l<d;l++)if(k=a[l])if(g&&k&&f&&(k.length<=g?(g-=k.length,k=null):(k=k.slice(g),g=0)),k&&(h[l]=k,f&&(r+=k.length,r>=e)))break;if(h.length){if(f)return S(h,e,0);c.push(h);return}}return!b&&h}function V(a,c,b){let d;b&&(d=a.bidirectional&&c>b);a=b?(a=a.B.get(d?c:b))&&a.get(d?b:c):a.map.get(c);return a};P.prototype.remove=function(a,c){const b=this.j.size&&(this.fastupdate?this.j.get(a):this.j.has(a));if(b){if(this.fastupdate)for(let d=0,e;d<b.length;d++){if(e=b[d])if(2>e.length)e.pop();else{const g=e.indexOf(a);g===b.length-1?e.pop():e.splice(g,1)}}else X(this.map,a),this.depth&&X(this.B,a);c||this.j.delete(a)}this.cache&&this.cache.remove(a);return this};
function X(a,c){let b=0;if(a.constructor===Array)for(let d=0,e,g;d<a.length;d++){if((e=a[d])&&e.length)if(g=e.indexOf(c),0<=g){1<e.length?(e.splice(g,1),b++):delete a[d];break}else b++}else for(let d of a){const e=d[0],g=X(d[1],c);g?b+=g:a.delete(e)}return b};function P(a,c){if(!(this instanceof P))return new P(a);if(a){var b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},O[b],a))}else a={};b=a.context||{};const d=a.encode||a.encoder||M;this.encoder=d.encode?d:"object"===typeof d?new D(d):{encode:d};let e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&b.depth||0;this.bidirectional=!1!==b.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;this.map=(e=!1,new Map);this.B=e?new G(e):
new Map;this.j=c||(this.fastupdate?e?new G(e):new Map:e?new J(e):new Set);this.M=b.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new F(e)}t=P.prototype;t.clear=function(){this.map.clear();this.B.clear();this.j.clear();this.cache&&this.cache.clear();return this};t.append=function(a,c){return this.add(a,c,!0)};t.contain=function(a){return this.j.has(a)};
t.update=function(a,c){if(this.async){const b=this,d=this.remove(a);return d.then?d.then(()=>b.add(a,c)):this.add(a,c)}return this.remove(a).add(a,c)};function Y(a){let c=0;if(a.constructor===Array)for(let b=0,d;b<a.length;b++)(d=a[b])&&(c+=d.length);else for(const b of a){const d=b[0],e=Y(b[1]);e?c+=e:a.delete(d)}return c}t.cleanup=function(){if(!this.fastupdate)return this;Y(this.map);this.depth&&Y(this.B);return this};
t.searchCache=function(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();let d=this.cache.get(a);if(!d){d=this.search(a,c,b);if(d instanceof Promise){const e=this;d.then(function(g){e.cache.set(a,g)})}this.cache.set(a,d)}return d};export default {Index:P,Encoder:D,Charset:L,Language:K,Document:null,Worker:null,Resolver:null,IndexedDB:null};
export const Index=P;export const Encoder=D;export const Charset=L;export const Language=K;export const Document=null;export const Worker=null;export const Resolver=null;export const IndexedDB=null;

View File

@@ -1,6 +1,6 @@
import { create_object } from "./common.js"; import { create_object } from "./common.js";
export const global_lang = create_object(); // export const global_lang = create_object();
export const global_charset = create_object(); export const global_charset = create_object();
/** /**
@@ -17,6 +17,6 @@ export function registerCharset(name, charset) {
* @param {Object} lang * @param {Object} lang
*/ */
export function registerLanguage(name, lang) { // export function registerLanguage(name, lang){
global_lang[name] = lang; // global_lang[name] = lang;
} // }

View File

@@ -39,11 +39,12 @@ export default function Document(options) {
keystore = options.keystore || 0; keystore = options.keystore || 0;
keystore && (this.keystore = keystore); keystore && (this.keystore = keystore);
this.fastupdate = !!options.fastupdate; this.fastupdate = !!options.fastupdate;
this.reg = this.fastupdate ? keystore ? new KeystoreMap(keystore) : new Map() : keystore ? new KeystoreSet(keystore) : new Set(); this.reg = this.fastupdate ? keystore && /* tag? */ /* stringify */ /* stringify */ /* skip update: */ /* append: */ /* skip update: */ /* skip_update: */ /* skip deletion */!0
/*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/ ? new KeystoreMap(keystore) : new Map() : keystore && !0 ? new KeystoreSet(keystore) : new Set();
// todo support custom filter function // todo support custom filter function
this.storetree = (tmp = document.store || null) && /* tag? */ /* stringify */ /* stringify */ /* skip update: */ /* append: */ /* skip update: */ /* skip_update: */ /* skip deletion */!0 /*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/ !== tmp && []; this.storetree = (tmp = document.store || null) && !0 !== tmp && [];
this.store = tmp && (keystore ? new KeystoreMap(keystore) : new Map()); this.store = tmp && (keystore && !0 ? new KeystoreMap(keystore) : new Map());
this.cache = (tmp = options.cache || null) && new Cache(tmp); this.cache = (tmp = options.cache || null) && new Cache(tmp);
// do not apply cache again for the indexes since .searchCache() // do not apply cache again for the indexes since .searchCache()

View File

@@ -43,7 +43,7 @@ const whitespace = /[^\p{L}\p{N}]+/u,
numeric_split_prev_char = /(\D)(\d{3})/g, numeric_split_prev_char = /(\D)(\d{3})/g,
numeric_split_next_char = /(\d{3})(\D)/g, numeric_split_next_char = /(\d{3})(\D)/g,
normalize = /[\u0300-\u036f]/g, normalize = /[\u0300-\u036f]/g,
normalize_mapper = !normalize && new Map([ normalize_mapper = !normalize && [
// Charset Normalization // Charset Normalization
@@ -71,7 +71,7 @@ const whitespace = /[^\p{L}\p{N}]+/u,
// ["|", " "], // ["|", " "],
// ["/", " "], // ["/", " "],
// ["\\", " "] // ["\\", " "]
]); // /[\p{Z}\p{S}\p{P}\p{C}]+/u; ]; // /[\p{Z}\p{S}\p{P}\p{C}]+/u;
//const numeric_split = /(\d{3})/g; //const numeric_split = /(\d{3})/g;
//.replace(/(\d{3})/g, "$1 ") //.replace(/(\d{3})/g, "$1 ")
@@ -183,9 +183,16 @@ Encoder.prototype.assign = function (options) {
*/ */
this.finalize = /** @type {Function|null} */parse_option(options.finalize, null, this.finalize); this.finalize = /** @type {Function|null} */parse_option(options.finalize, null, this.finalize);
// move the normalization fallback to the mapper
if (normalize_mapper) {
this.mapper = new Map(
/** @type {Array<Array<string, string>>} */normalize_mapper);
}
// options // options
this.rtl = options.rtl || /* suggest */ /* append: */ /* enrich */!1; this.rtl = options.rtl ||
/* suggest */ /* append: */ /* enrich */!1;
this.dedupe = parse_option(options.dedupe, !0, this.dedupe); this.dedupe = parse_option(options.dedupe, !0, this.dedupe);
this.filter = parse_option((tmp = options.filter) && new Set(tmp), null, this.filter); this.filter = parse_option((tmp = options.filter) && new Set(tmp), null, this.filter);
this.matcher = parse_option((tmp = options.matcher) && new Map(tmp), null, this.matcher); this.matcher = parse_option((tmp = options.matcher) && new Map(tmp), null, this.matcher);
@@ -333,10 +340,12 @@ Encoder.prototype.encode = function (str) {
str = str.normalize("NFKD").replace(normalize, "").toLowerCase(); str = str.normalize("NFKD").replace(normalize, "").toLowerCase();
} else { } else {
str = str.toLowerCase(); str = str.toLowerCase();
// if(SUPPORT_CHARSET){
this.mapper = this.mapper // this.mapper = this.mapper
// todo replace spread // // todo replace spread
? new Map([... /** @type {!Iterable} */normalize_mapper, ...this.mapper]) : new Map( /** @type {Map<string,string>} */normalize_mapper); // ? new Map([.../** @type {!Iterable} */(normalize_mapper), ...this.mapper])
// : new Map(/** @type {Map<string,string>} */ (normalize_mapper));
// }
} }
//if(!str) return str; //if(!str) return str;
} }

View File

@@ -12,7 +12,6 @@ import Cache, { searchCache } from "./cache.js";
import { KeystoreMap, KeystoreSet } from "./keystore.js"; import { KeystoreMap, KeystoreSet } from "./keystore.js";
import { is_array, is_string } from "./common.js"; import { is_array, is_string } from "./common.js";
import { exportIndex, importIndex } from "./serialize.js"; import { exportIndex, importIndex } from "./serialize.js";
import { global_lang, global_charset } from "./global.js";
import default_encoder from "./lang/latin/default.js"; import default_encoder from "./lang/latin/default.js";
import apply_preset from "./preset.js"; import apply_preset from "./preset.js";
import apply_async from "./async.js"; import apply_async from "./async.js";
@@ -33,30 +32,7 @@ export default function Index(options, _register) {
return new Index(options); return new Index(options);
} }
if (options) { options = options ? apply_preset(options) : {};
options = apply_preset(options);
// charset = options.charset;
// // lang = options.lang;
//
// if(is_string(charset)){
//
// if(!charset.includes(":")){
// charset += ":default";
// }
//
// charset = global_charset[charset];
// }
// if(is_string(lang)){
//
// lang = global_lang[lang];
// }
} else {
options = {};
}
// let charset, lang, tmp;
const context = options.context || {}, const context = options.context || {},
encoder = options.encode || options.encoder || default_encoder; encoder = options.encode || options.encoder || default_encoder;
@@ -77,9 +53,9 @@ export default function Index(options, _register) {
tmp = options.keystore || 0; tmp = options.keystore || 0;
tmp && (this.keystore = tmp); tmp && (this.keystore = tmp);
this.map = tmp ? new KeystoreMap(tmp) : new Map(); this.map = tmp && /* tag? */ /* stringify */ /* stringify */ /* skip update: */ /* append: */ /* skip update: */ /* skip_update: */ /* skip deletion */!0 /*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/ ? new KeystoreMap(tmp) : new Map();
this.ctx = tmp ? new KeystoreMap(tmp) : new Map(); this.ctx = tmp && !0 ? new KeystoreMap(tmp) : new Map();
this.reg = _register || (this.fastupdate ? tmp ? new KeystoreMap(tmp) : new Map() : tmp ? new KeystoreSet(tmp) : new Set()); this.reg = _register || (this.fastupdate ? tmp && !0 ? new KeystoreMap(tmp) : new Map() : tmp && !0 ? new KeystoreSet(tmp) : new Set());
this.resolution_ctx = context.resolution || 1; this.resolution_ctx = context.resolution || 1;
this.rtl = encoder.rtl || options.rtl || !1; this.rtl = encoder.rtl || options.rtl || !1;
@@ -146,7 +122,7 @@ Index.prototype.clear = function () {
if (this.db) { if (this.db) {
this.commit_timer && clearTimeout(this.commit_timer); this.commit_timer && clearTimeout(this.commit_timer);
this.commit_timer = null; this.commit_timer = null;
this.commit_task = [{ clear: /* tag? */ /* stringify */ /* stringify */ /* skip update: */ /* append: */ /* skip update: */ /* skip_update: */ /* skip deletion */!0 /*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/ }]; this.commit_task = [{ clear: !0 }];
//return this.db.clear(); //return this.db.clear();
} }

15
dist/module-debug/profiler.js vendored Normal file
View File

@@ -0,0 +1,15 @@
import { create_object } from "./common.js";
const data = create_object();
/**
* @param {!string} name
*/
export default function tick(name) {
/** @type {!Object<string, number>} */
const profiler = data.profiler || (data.profiler = {});
profiler[name] || (profiler[name] = 0);
profiler[name]++;
}

View File

@@ -6,7 +6,7 @@ import WorkerIndex from "./worker/index.js";
import Resolver from "./resolver.js"; import Resolver from "./resolver.js";
import Encoder from "./encoder.js"; import Encoder from "./encoder.js";
import IdxDB from "./db/indexeddb/index.js"; import IdxDB from "./db/indexeddb/index.js";
import { global_charset, global_lang } from "./global.js"; import { global_charset } from "./charset.js";
import charset_exact from "./lang/latin/exact.js"; import charset_exact from "./lang/latin/exact.js";
import charset_default from "./lang/latin/default.js"; import charset_default from "./lang/latin/default.js";
import charset_simple from "./lang/latin/simple.js"; import charset_simple from "./lang/latin/simple.js";
@@ -136,9 +136,8 @@ global_charset["latin:soundex"] = charset_soundex;
const FlexSearch = { const FlexSearch = {
Index: Index, Index: Index,
Encoder: Encoder,
Charset: global_charset, Charset: global_charset,
Language: global_lang, Encoder: Encoder,
Document: Document, Document: Document,
Worker: WorkerIndex, Worker: WorkerIndex,
Resolver: Resolver, Resolver: Resolver,

View File

@@ -23,7 +23,7 @@ parentPort.on("message", function (data) {
// load extern field configuration // load extern field configuration
if ("/" !== filepath[0] && "\\" !== filepath[0]) { if (filepath && "/" !== filepath[0] && "\\" !== filepath[0]) {
// current working directory // current working directory
const dir = process.cwd(); const dir = process.cwd();
filepath = join(dir, filepath); filepath = join(dir, filepath);

1
dist/module-min/async.js vendored Normal file
View File

@@ -0,0 +1 @@
import Document from"./document.js";import Index from"./index.js";export default function(a){register.call(a,"add"),register.call(a,"append"),register.call(a,"search"),register.call(a,"update"),register.call(a,"remove")}function register(a){this[a+"Async"]=function(){const b=arguments,c=b[b.length-1];let d;"function"==typeof c&&(d=c,delete b[b.length-1]),this.async=!0;const e=this[a].apply(this,b);return this.async=!1,e.then?e.then(d):d(e),e}}

1
dist/module-min/cache.js vendored Normal file
View File

@@ -0,0 +1 @@
import Index from"./index.js";import Document from"./document.js";export function searchCache(a,b,c){a=("object"==typeof a?""+a.query:""+a).toLowerCase();let d=this.cache.get(a);if(!d){if(d=this.search(a,b,c),d instanceof Promise){const b=this;d.then(function(c){b.cache.set(a,c)})}this.cache.set(a,d)}return d}export default function CacheClass(a){this.limit=a&&!0!==a?a:1000,this.cache=new Map,this.last=""}CacheClass.prototype.set=function(a,b){this.cache.has(a)||(this.cache.set(this.last=a,b),this.limit&&this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value))},CacheClass.prototype.get=function(a){const b=this.cache.get(a);return b&&this.limit&&this.last!==a&&(this.cache.delete(a),this.cache.set(this.last=a,b)),b},CacheClass.prototype.remove=function(a){for(const b of this.cache){const c=b[0],d=b[1];d.includes(a)&&this.cache.delete(c)}},CacheClass.prototype.clear=function(){this.cache.clear(),this.last=""};

1
dist/module-min/charset.js vendored Normal file
View File

@@ -0,0 +1 @@
import{create_object}from"./common.js";export const global_charset=create_object();export function registerCharset(a,b){global_charset[a]=b}

1
dist/module-min/common.js vendored Normal file
View File

@@ -0,0 +1 @@
export function parse_option(a,b,c){const d=typeof c,e=typeof a;if("undefined"!=d){if("undefined"!=e){if(c){if("function"==e&&d==e)return function(b){return a(c(b))};const b=a.constructor,f=c.constructor;if(b===f){if(b===Array)return c.concat(a);if(b===Map){const b=new Map(c);for(const c of a){const a=c[0],d=c[1];b.set(a,d)}return b}if(b===Set){const b=new Set(c);for(const c of a.values())b.add(c);return b}}}return a}return c}return"undefined"==e?b:a}export function create_object_array(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=create_object();return b}export function create_map_array(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=new Map;return b}export function create_arrays(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=[];return b}export function get_keys(a){return Object.keys(a)}export function create_object(){return Object.create(null)}export function concat(a){return[].concat.apply([],a)}export function sort_by_length_down(c,a){return a.length-c.length}export function sort_by_length_up(c,a){return c.length-a.length}export function is_array(a){return a.constructor===Array}export function is_string(a){return"string"==typeof a}export function is_object(a){return"object"==typeof a}export function is_function(a){return"function"==typeof a}export function toArray(a,b){const c=[];for(const d of a.keys())c.push(b?""+d:d);return c}export function parse_simple(a,b){if(is_string(b))a=a[b];else for(let c=0;a&&c<b.length;c++)a=a[b[c]];return a}export function get_max_len(a){let b=0;for(let c,d=0;d<a.length;d++)(c=a[d])&&b<c.length&&(b=c.length);return b}

1
dist/module-min/compress.js vendored Normal file
View File

@@ -0,0 +1 @@
let table,timer;const cache=new Map;function toRadix(a,b=255){if(!table){table=Array(b);for(let a=0;a<b;a++)table[a]=a+1;table=String.fromCharCode.apply(null,table)}let c,d=a,e="";for(;c=d%b,e=table.charAt(c)+e,d=0|d/b,!!d;);return e}export default function(a){if(!timer)timer=setTimeout(clear);else if(cache.has(a))return cache.get(a);const b=toRadix("number"==typeof a?a:lcg(a));return 2e5<cache.size&&cache.clear(),cache.set(a,b),b}function lcg(a){if("number"==typeof a)return a&4294967295;let b=0;for(let c=0;c<a.length;c++)b=(b*33^a.charCodeAt(c))&4294967295;return b+2147483648}function clear(){timer=null,cache.clear()}

132
dist/module-min/db/clickhouse/index.js vendored Normal file
View File

@@ -0,0 +1,132 @@
import{ClickHouse}from"clickhouse";import StorageInterface from"../interface.js";import Document from"../../document.js";import{concat,toArray}from"../../common.js";const defaults={host:"http://localhost",port:"8123",debug:!1,basicAuth:null,isUseGzip:!1,trimQuery:!1,usePost:!1,format:"json",raw:!1,config:{output_format_json_quote_64bit_integers:0,enable_http_compression:0,database:"default"}},VERSION=1,fields=["map","ctx","tag","reg","cfg"],types={text:"String",char:"String",varchar:"String",string:"String",number:"Int32",numeric:"Int32",integer:"Int32",smallint:"Int16",tinyint:"Int8",mediumint:"Int32",int:"Int32",int8:"Int8",uint8:"UInt8",int16:"Int16",uint16:"UInt16",int32:"Int32",uint32:"UInt32",int64:"Int64",uint64:"UInt64",bigint:"Int64"};function sanitize(a){return a.toLowerCase().replace(/[^a-z0-9_]/g,"")}let DB;export default function ClickhouseDB(a,b={}){if(!(this instanceof ClickhouseDB))return new ClickhouseDB(a,b);if("object"==typeof a&&(a=a.name,b=a),a||console.info("Default storage space was used, because a name was not passed."),this.id="flexsearch"+(a?"_"+sanitize(a):""),this.field=b.field?"_"+sanitize(b.field):"",this.type=b.type?types[b.type.toLowerCase()]:"String",!this.type)throw new Error("Unknown type of ID '"+b.type+"'");this.support_tag_search=!0,this.db=DB||(DB=b.db||null),Object.assign(defaults,b),b.database&&(defaults.config.database=b.database),this.db&&delete defaults.db}ClickhouseDB.prototype.mount=function(a){return a instanceof Document?a.mount(this):(defaults.resolution=Math.max(a.resolution,a.resolution_ctx),a.db=this,this.open())},ClickhouseDB.prototype.open=async function(){this.db||(this.db=DB||(DB=new ClickHouse(defaults)));const a=await this.db.query(`
SELECT 1 FROM system.databases WHERE name = '${this.id}';
`).toPromise();a&&a.length||(await this.db.query(`
CREATE DATABASE IF NOT EXISTS ${this.id};
`).toPromise());for(let a=0;a<fields.length;a++)switch(fields[a]){case"map":await this.db.query(`
CREATE TABLE IF NOT EXISTS ${this.id}.map${this.field}(
key String,
res ${255>=defaults.resolution?"UInt8":"UInt16"},
id ${this.type}
)
ENGINE = MergeTree
/*PRIMARY KEY (key)*/
ORDER BY (key, id);
`,{params:{name:this.id+".map"+this.field}}).toPromise();break;case"ctx":await this.db.query(`
CREATE TABLE IF NOT EXISTS ${this.id}.ctx${this.field}(
ctx String,
key String,
res ${255>=defaults.resolution?"UInt8":"UInt16"},
id ${this.type}
)
ENGINE = MergeTree
/*PRIMARY KEY (ctx, key)*/
ORDER BY (ctx, key, id);
`).toPromise();break;case"tag":await this.db.query(`
CREATE TABLE IF NOT EXISTS ${this.id}.tag${this.field}(
tag String,
id ${this.type}
)
ENGINE = MergeTree
/*PRIMARY KEY (ctx, key)*/
ORDER BY (tag, id);
`).toPromise();break;case"reg":await this.db.query(`
CREATE TABLE IF NOT EXISTS ${this.id}.reg(
id ${this.type},
doc Nullable(String)
)
ENGINE = MergeTree
ORDER BY (id);
`).toPromise();break;case"cfg":await this.db.query(`
CREATE TABLE IF NOT EXISTS ${this.id}.cfg${this.field}(
cfg String
)
ENGINE = TinyLog;
`).toPromise();}return this.db},ClickhouseDB.prototype.close=function(){return this.db.close(),this.db=null,this},ClickhouseDB.prototype.destroy=async function(){await Promise.all([this.db.query(`DROP TABLE ${this.id}.map${this.field};`).toPromise(),this.db.query(`DROP TABLE ${this.id}.ctx${this.field};`).toPromise(),this.db.query(`DROP TABLE ${this.id}.tag${this.field};`).toPromise(),this.db.query(`DROP TABLE ${this.id}.cfg${this.field};`).toPromise(),this.db.query(`DROP TABLE ${this.id}.reg;`).toPromise()]),this.close()},ClickhouseDB.prototype.clear=function(){return Promise.all([this.db.query(`TRUNCATE TABLE ${this.id}.map${this.field};`).toPromise(),this.db.query(`TRUNCATE TABLE ${this.id}.ctx${this.field};`).toPromise(),this.db.query(`TRUNCATE TABLE ${this.id}.tag${this.field};`).toPromise(),this.db.query(`TRUNCATE TABLE ${this.id}.cfg${this.field};`).toPromise(),this.db.query(`TRUNCATE TABLE ${this.id}.reg;`).toPromise()])};function create_result(a,b,c){if(b){for(let b=0;b<a.length;b++)c?a[b].doc&&(a[b].doc=JSON.parse(a[b].doc)):a[b]=a[b].id;return a}else{const b=[];for(let d,e=0;e<a.length;e++)d=a[e],b[d.res]||(b[d.res]=[]),b[d.res].push(c?d:d.id);return b}}ClickhouseDB.prototype.get=function(a,b,c=0,d=0,e=!0,f=!1,g){let h,j="",k=b?{ctx:b,key:a}:{key:a},l=this.id+(b?".ctx":".map")+this.field;if(g)for(let a=0,b=1;a<g.length;a+=2)j+=` AND ${l}.id IN (SELECT id FROM ${this.id}.tag_${sanitize(g[a])} WHERE tag = {tag${b}:String})`,k["tag"+b]=g[a+1],b++;return h=b?this.db.query(`
SELECT ${l}.id
${e?"":", res"}
${f?", doc":""}
FROM ${l}
${f?`
LEFT OUTER JOIN ${this.id}.reg ON ${this.id}.reg.id = ${l}.id
`:""}
WHERE ctx = {ctx:String} AND key = {key:String}
ORDER BY res
${c?"LIMIT "+c:""}
${d?"OFFSET "+d:""}`,{params:k}).toPromise():this.db.query(`
SELECT ${l}.id
${e?"":", res"}
${f?", doc":""}
FROM ${l}
${f?`
LEFT OUTER JOIN ${this.id}.reg ON ${this.id}.reg.id = ${l}.id
`:""}
WHERE key = {key:String}
ORDER BY res
${c?"LIMIT "+c:""}
${d?"OFFSET "+d:""}`,{params:k}).toPromise(),h.then(function(a){return create_result(a,e,f)})},ClickhouseDB.prototype.tag=function(a,b=0,c=0,d=!1){const e=this.id+".tag"+this.field,f=this.db.query(`
SELECT ${e}.id
${d?", doc":""}
FROM ${e}
${d?`
LEFT OUTER JOIN ${this.id}.reg ON ${this.id}.reg.id = ${e}.id
`:""}
WHERE tag = {tag:String}
${b?"LIMIT "+b:""}
${c?"OFFSET "+c:""}`,{params:{tag:a}}).toPromise();return d||f.then(function(a){return create_result(a,!0,!1)}),f},ClickhouseDB.prototype.enrich=async function(a){let b=1e5,c=[];"object"!=typeof a&&(a=[a]);for(let d=0;d<a.length;){const e=a.length-d>b?a.slice(d,d+b):d?a.slice(d):a;d+=e.length;let f={},g="";for(let a=0;a<e.length;a++)g+=(g?",":"")+"{id"+(a+1)+":String}",f["id"+(a+1)]=e[a];const h=await this.db.query(`
SELECT id, doc
FROM ${this.id}.reg
WHERE id IN (${g})`,{params:f}).toPromise();if(h&&h.length){for(let a,b=0;b<h.length;b++)(a=h[b].doc)&&(h[b].doc=JSON.parse(a));c.push(h)}}return 1===c.length?c[0]:1<c.length?concat(c):c},ClickhouseDB.prototype.has=function(a){return this.db.query(`
SELECT EXISTS(
SELECT 1
FROM ${this.id}.reg
WHERE id = {id:${this.type}}
LIMIT 1
)`,{params:{id:a}}).toPromise()},ClickhouseDB.prototype.search=function(a,b,c=100,d=0,e=!1,f=!0,g=!0,h){let i;if(1<b.length&&a.depth){let j,k="",l={},m=b[0];for(let c=1;c<b.length;c++){j=b[c];const d=a.bidirectional&&j>m;k+=(k?" OR ":"")+`(ctx = {ctx${c}:String} AND key = {key${c}:String})`,l["ctx"+c]=d?j:m,l["key"+c]=d?m:j,m=j}if(h){k="("+k+")";for(let a=0,b=1;a<h.length;a+=2)k+=` AND id IN (SELECT id FROM ${this.id}.tag_${sanitize(h[a])} WHERE tag = {tag${b}:String})`,l["tag"+b]=h[a+1],b++}i=this.db.query(`
SELECT r.id
${f?"":", res"}
${g?", doc":""}
FROM (
SELECT id, count(*) as count,
${e?"SUM":"MIN"}(res) as res
FROM ${this.id}.ctx${this.field}
WHERE ${k}
GROUP BY id
) as r
${g?`
LEFT OUTER JOIN ${this.id}.reg ON ${this.id}.reg.id = r.id
`:""}
${e?"":"WHERE count = "+(b.length-1)}
ORDER BY ${e?"count DESC, res":"res"}
${c?"LIMIT "+c:""}
${d?"OFFSET "+d:""}
`,{params:l}).toPromise()}else{let a="",j={};for(let c=0;c<b.length;c++)a+=(a?",":"")+`{key${c}:String}`,j["key"+c]=b[c];if(a="key "+(1<b.length?"IN ("+a+")":"= "+a),h){a="("+a+")";for(let b=0,c=1;b<h.length;b+=2)a+=` AND id IN (SELECT id FROM ${this.id}.tag_${sanitize(h[b])} WHERE tag = {tag${c}:String})`,j["tag"+c]=h[b+1],c++}i=this.db.query(`
SELECT r.id
${f?"":", res"}
${g?", doc":""}
FROM (
SELECT id, count(*) as count,
${e?"SUM":"MIN"}(res) as res
FROM ${this.id}.map${this.field}
WHERE ${a}
GROUP BY id
) as r
${g?`
LEFT OUTER JOIN ${this.id}.reg ON ${this.id}.reg.id = r.id
`:""}
${e?"":"WHERE count = "+b.length}
ORDER BY ${e?"count DESC, res":"res"}
${c?"LIMIT "+c:""}
${d?"OFFSET "+d:""}
`,{params:j}).toPromise()}return i.then(function(a){return create_result(a,f,g)})},ClickhouseDB.prototype.info=function(){},ClickhouseDB.prototype.transaction=function(a){return a.call(this)},ClickhouseDB.prototype.commit=async function(a,b,c){if(b)await this.clear(),a.commit_task=[];else{let d=a.commit_task;a.commit_task=[];for(let a,c=0;c<d.length;c++)if(a=d[c],a.clear){await this.clear(),b=!0;break}else d[c]=a.del;b||(!c&&(d=d.concat(toArray(a.reg))),d.length&&(await this.remove(d)))}if(a.reg.size){if(a.map.size){let b=[];for(const c of a.map){const a=c[0],d=c[1];for(let c,e=0;e<d.length;e++)if((c=d[e])&&c.length)for(let d=0;d<c.length;d++)b.push({key:a,res:e,id:c[d]})}b.length&&(await this.db.insert(`INSERT INTO ${this.id}.map${this.field} (key, res, id)`,b).toPromise())}if(a.ctx.size){let b=[];for(const c of a.ctx){const a=c[0],d=c[1];for(const c of d){const d=c[0],e=c[1];for(let c,f=0;f<e.length;f++)if((c=e[f])&&c.length)for(let e=0;e<c.length;e++)b.push({ctx:a,key:d,res:f,id:c[e]})}}b.length&&(await this.db.insert(`INSERT INTO ${this.id}.ctx${this.field} (ctx, key, res, id)`,b).toPromise())}if(a.tag){let b=[];for(const c of a.tag){const a=c[0],d=c[1];if(d.length)for(let c=0;c<d.length;c++)b.push({tag:a,id:d[c]})}b.length&&(await this.db.insert(`INSERT INTO ${this.id}.tag${this.field} (tag, id)`,b).toPromise())}if(a.store){let b=[];for(const c of a.store.entries()){const a=c[0],d=c[1];b.push({id:a,doc:d&&JSON.stringify(d)})}b.length&&(await this.db.insert(`INSERT INTO ${this.id}.reg (id, doc)`,b).toPromise())}else if(!a.bypass){let b=toArray(a.reg);for(let a=0;a<b.length;a++)b[a]={id:b[a]};b.length&&(await this.db.insert(`INSERT INTO ${this.id}.reg (id)`,b).toPromise())}a.map.clear(),a.ctx.clear(),a.tag&&a.tag.clear(),a.store&&a.store.clear(),a.document||a.reg.clear(),await Promise.all([this.db.query(`OPTIMIZE TABLE ${this.id}.map${this.field} FINAL`).toPromise(),this.db.query(`OPTIMIZE TABLE ${this.id}.ctx${this.field} FINAL`).toPromise(),this.db.query(`OPTIMIZE TABLE ${this.id}.tag${this.field} FINAL`).toPromise(),this.db.query(`OPTIMIZE TABLE ${this.id}.reg FINAL`).toPromise()])}},ClickhouseDB.prototype.remove=async function(a){for("object"!=typeof a&&(a=[a]);a.length;){let b=a.slice(0,1e5);a=a.slice(1e5),b="String"===this.type?"'"+b.join("','")+"'":b.join(","),await Promise.all([this.db.query(`
ALTER TABLE ${this.id}.map${this.field}
DELETE WHERE id IN (${b})
SETTINGS mutations_sync = 1;`).toPromise(),this.db.query(`
ALTER TABLE ${this.id}.ctx${this.field}
DELETE WHERE id IN (${b})
SETTINGS mutations_sync = 1;`).toPromise(),this.db.query(`
ALTER TABLE ${this.id}.tag${this.field}
DELETE WHERE id IN (${b})
SETTINGS mutations_sync = 1;`).toPromise(),this.db.query(`
ALTER TABLE ${this.id}.reg
DELETE WHERE id IN (${b})
SETTINGS mutations_sync = 1;`).toPromise()])}};

1
dist/module-min/db/indexeddb/index.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/module-min/db/mongo/index.js vendored Normal file

File diff suppressed because one or more lines are too long

135
dist/module-min/db/postgres/index.js vendored Normal file
View File

@@ -0,0 +1,135 @@
import pg_promise from"pg-promise";import StorageInterface from"../interface.js";import Document from"../../document.js";import{concat,toArray}from"../../common.js";const defaults={schema:"flexsearch",user:"postgres",pass:"postgres",name:"postgres",host:"localhost",port:"5432"},pgp=pg_promise(),VERSION=1,MAXIMUM_QUERY_VARS=16000,fields=["map","ctx","reg","tag","cfg"],types={text:"text",char:"text",varchar:"text",string:"text",number:"int",numeric:"int",integer:"int",smallint:"int",tinyint:"int",mediumint:"int",int:"int",int8:"int",uint8:"int",int16:"int",uint16:"int",int32:"int",uint32:"bigint",int64:"bigint",bigint:"bigint"};function sanitize(a){return a.toLowerCase().replace(/[^a-z0-9_]/g,"")}let DB,TRX;export default function PostgresDB(a,b={}){if(!(this instanceof PostgresDB))return new PostgresDB(a,b);if("object"==typeof a&&(a=a.name,b=a),a||console.info("Default storage space was used, because a name was not passed."),this.id=(b.schema?sanitize(b.schema):defaults.schema)+(a?"_"+sanitize(a):""),this.field=b.field?"_"+sanitize(b.field):"",this.type=b.type?types[b.type.toLowerCase()]:"text",this.support_tag_search=!0,!this.type)throw new Error("Unknown type of ID '"+b.type+"'");this.db=DB||(DB=b.db||null),Object.assign(defaults,b),this.db&&delete defaults.db}PostgresDB.prototype.mount=function(a){return a instanceof Document?a.mount(this):(a.db=this,this.open())},PostgresDB.prototype.open=async function(){this.db||(this.db=DB||(DB=pgp(`postgres://${defaults.user}:${encodeURIComponent(defaults.pass)}@${defaults.host}:${defaults.port}/${defaults.name}`)));const a=await this.db.oneOrNone(`
SELECT EXISTS (
SELECT 1
FROM information_schema.schemata
WHERE schema_name = '${this.id}'
);
`);a&&a.exists||(await this.db.none(`CREATE SCHEMA IF NOT EXISTS ${this.id};`));for(let a=0;a<fields.length;a++){const b=await this.db.oneOrNone(`
SELECT EXISTS (
SELECT 1 FROM pg_tables
WHERE schemaname = '${this.id}' AND tablename = '${fields[a]+("reg"===fields[a]?"":this.field)}'
);
`);if(b&&b.exists)continue;const c="text"===this.type?"varchar(128)":this.type;switch(fields[a]){case"map":await this.db.none(`
CREATE TABLE IF NOT EXISTS ${this.id}.map${this.field}(
key varchar(128) NOT NULL,
res smallint NOT NULL,
id ${c} NOT NULL
);
CREATE INDEX IF NOT EXISTS ${this.id}_map_index${this.field}
ON ${this.id}.map${this.field} (key);
CREATE INDEX IF NOT EXISTS ${this.id}_map_id${this.field}
ON ${this.id}.map${this.field} (id);
`);break;case"ctx":await this.db.none(`
CREATE TABLE IF NOT EXISTS ${this.id}.ctx${this.field}(
ctx varchar(128) NOT NULL,
key varchar(128) NOT NULL,
res smallint NOT NULL,
id ${c} NOT NULL
);
CREATE INDEX IF NOT EXISTS ${this.id}_ctx_index${this.field}
ON ${this.id}.ctx${this.field} (ctx, key);
CREATE INDEX IF NOT EXISTS ${this.id}_ctx_id${this.field}
ON ${this.id}.ctx${this.field} (id);
`);break;case"tag":await this.db.none(`
CREATE TABLE IF NOT EXISTS ${this.id}.tag${this.field}(
tag varchar(128) NOT NULL,
id ${c} NOT NULL
);
CREATE INDEX IF NOT EXISTS ${this.id}_tag_index${this.field}
ON ${this.id}.tag${this.field} (tag);
CREATE INDEX IF NOT EXISTS ${this.id}_tag_id${this.field}
ON ${this.id}.tag${this.field} (id);
`);break;case"reg":await this.db.none(`
CREATE TABLE IF NOT EXISTS ${this.id}.reg(
id ${c} NOT NULL
CONSTRAINT ${this.id}_reg_pk
PRIMARY KEY,
doc text DEFAULT NULL
);
`).catch(()=>{});break;case"cfg":await this.db.none(`
CREATE TABLE IF NOT EXISTS ${this.id}.cfg${this.field}(
cfg text NOT NULL
);
`);}}return this.db},PostgresDB.prototype.close=function(){return this.db.close&&this.db.close(),this.db=DB=null,this},PostgresDB.prototype.destroy=async function(){await this.db.none(`
DROP TABLE IF EXISTS ${this.id}.map${this.field};
DROP TABLE IF EXISTS ${this.id}.ctx${this.field};
DROP TABLE IF EXISTS ${this.id}.tag${this.field};
DROP TABLE IF EXISTS ${this.id}.cfg${this.field};
DROP TABLE IF EXISTS ${this.id}.reg;
`),this.close()},PostgresDB.prototype.clear=function(){return this.db.none(`
TRUNCATE TABLE ${this.id}.map${this.field};
TRUNCATE TABLE ${this.id}.ctx${this.field};
TRUNCATE TABLE ${this.id}.tag${this.field};
TRUNCATE TABLE ${this.id}.cfg${this.field};
TRUNCATE TABLE ${this.id}.reg;
`)};function create_result(a,b,c){if(b){for(let b=0;b<a.length;b++)c?a[b].doc&&(a[b].doc=JSON.parse(a[b].doc)):a[b]=a[b].id;return a}else{const b=[];for(let d,e=0;e<a.length;e++)d=a[e],b[d.res]||(b[d.res]=[]),b[d.res].push(c?d:d.id);return b}}PostgresDB.prototype.get=function(a,b,c=0,d=0,e=!0,f=!1,g){let h,j="",k=b?[b,a]:[a],l=this.id+(b?".ctx":".map")+this.field;if(g)for(let a=0,b=k.length+1;a<g.length;a+=2)j+=` AND ${l}.id IN (SELECT id FROM ${this.id}.tag_${sanitize(g[a])} WHERE tag = $${b++})`,k.push(g[a+1]);return h=b?this.db.any(`
SELECT ${l}.id
${e?"":", res"}
${f?", doc":""}
FROM ${l}
${f?`
LEFT JOIN ${this.id}.reg ON ${this.id}.reg.id = ${l}.id
`:""}
WHERE ctx = $1 AND key = $2 ${j}
ORDER BY res
${c?"LIMIT "+c:""}
${d?"OFFSET "+d:""}`,k):this.db.any(`
SELECT ${l}.id
${e?"":", res"}
${f?", doc":""}
FROM ${l}
${f?`
LEFT JOIN ${this.id}.reg ON ${this.id}.reg.id = ${l}.id
`:""}
WHERE key = $1 ${j}
ORDER BY res
${c?"LIMIT "+c:""}
${d?"OFFSET "+d:""}`,k),h.then(function(a){return create_result(a,e,f)})},PostgresDB.prototype.tag=function(a,b=0,c=0,d=!1){const e=this.id+".tag"+this.field,f=this.db.any(`
SELECT ${e}.id
${d?", doc":""}
FROM ${e}
${d?`
LEFT JOIN ${this.id}.reg ON ${this.id}.reg.id = ${e}.id
`:""}
WHERE tag = $1
${b?"LIMIT "+b:""}
${c?"OFFSET "+c:""}`,[a]);return d||f.then(function(a){return create_result(a,!0,!1)}),f},PostgresDB.prototype.enrich=async function(a){let b=[];"object"!=typeof a&&(a=[a]);for(let c=0;c<a.length;){const d=a.length-c>MAXIMUM_QUERY_VARS?a.slice(c,c+MAXIMUM_QUERY_VARS):c?a.slice(c):a;c+=d.length;let e="";for(let a=1;a<=d.length;a++)e+=(e?",":"")+"$"+a;const f=await this.db.any(`
SELECT id, doc
FROM ${this.id}.reg
WHERE id IN (${e})`,a);if(f&&f.length){for(let a,b=0;b<f.length;b++)(a=f[b].doc)&&(f[b].doc=JSON.parse(a));b.push(f)}}return 1===b.length?b[0]:1<b.length?concat(b):b},PostgresDB.prototype.has=function(a){return this.db.oneOrNone("SELECT EXISTS(SELECT 1 FROM "+this.id+".reg WHERE id = $1)",[a])},PostgresDB.prototype.search=function(a,b,c=100,d=0,e=!1,f=!0,g=!1,h){let i;if(1<b.length&&a.depth){let j,k="",l=[],m=b[0],n=1;for(let c=1;c<b.length;c++){j=b[c];const d=a.bidirectional&&j>m;k+=(k?" OR ":"")+`(ctx = $${n++} AND key = $${n++})`,l.push(d?j:m,d?m:j),m=j}if(h){k="("+k+")";for(let a=0;a<h.length;a+=2)k+=` AND id IN (SELECT id FROM ${this.id}.tag_${sanitize(h[a])} WHERE tag = $${n++})`,l.push(h[a+1])}i=this.db.any(`
SELECT r.id
${f?"":", res"}
${g?", doc":""}
FROM (
SELECT id, count(*) as count,
${e?"SUM":"MIN"}(res) as res
FROM ${this.id}.ctx${this.field}
WHERE ${k}
GROUP BY id
) as r
${g?`
LEFT JOIN ${this.id}.reg ON ${this.id}.reg.id = r.id
`:""}
${e?"":"WHERE count = "+(b.length-1)}
ORDER BY ${e?"count DESC, res":"res"}
${c?"LIMIT "+c:""}
${d?"OFFSET "+d:""}
`,l)}else{let a="",j=1,k=b.length;for(let b=0;b<k;b++)a+=(a?",":"")+"$"+j++;if(a="key "+(1<k?"IN ("+a+")":"= "+a),h){a="("+a+")";for(let c=0;c<h.length;c+=2)a+=` AND id IN (SELECT id FROM ${this.id}.tag_${sanitize(h[c])} WHERE tag = $${j++})`,b.push(h[c+1])}i=this.db.any(`
SELECT r.id
${f?"":", res"}
${g?", doc":""}
FROM (
SELECT id, count(*) as count,
${e?"SUM":"MIN"}(res) as res
FROM ${this.id}.map${this.field}
WHERE ${a}
GROUP BY id
) as r
${g?`
LEFT JOIN ${this.id}.reg ON ${this.id}.reg.id = r.id
`:""}
${e?"":"WHERE count = "+k}
ORDER BY ${e?"count DESC, res":"res"}
${c?"LIMIT "+c:""}
${d?"OFFSET "+d:""}
`,b)}return i.then(function(a){return create_result(a,f,g)})},PostgresDB.prototype.info=function(){},PostgresDB.prototype.transaction=function(a){if(TRX)return a.call(this,TRX);const b=this;return(TRX||this.db).tx(function(c){return a.call(b,TRX=c)}).finally(function(){TRX=null})},PostgresDB.prototype.commit=async function(a,b,c){if(b)await this.clear(),a.commit_task=[];else{let d=a.commit_task;a.commit_task=[];for(let a,c=0;c<d.length;c++)if(a=d[c],a.clear){await this.clear(),b=!0;break}else d[c]=a.del;b||(!c&&(d=d.concat(toArray(a.reg))),d.length&&(await this.remove(d)))}a.reg.size&&(await this.transaction(function(b){const c=[];if(a.store){let d=[],e=new pgp.helpers.ColumnSet(["id","doc"],{table:this.id+".reg"});for(const f of a.store.entries()){const a=f[0],g=f[1];if(d.push({id:a,doc:g&&JSON.stringify(g)}),d.length===MAXIMUM_QUERY_VARS){let a=pgp.helpers.insert(d,e);c.push(b.none(a.replace(/^(insert into )"([^"]+)"/,"$1 $2"))),d=[]}}if(d.length){let a=pgp.helpers.insert(d,e);c.push(b.none(a.replace(/^(insert into )"([^"]+)"/,"$1 $2")))}}else if(!a.bypass){let d=[],e=new pgp.helpers.ColumnSet(["id"],{table:this.id+".reg"});for(const f of a.reg.keys())if(d.push({id:f}),d.length===MAXIMUM_QUERY_VARS){let a=pgp.helpers.insert(d,e);c.push(b.none(a.replace(/^(insert into )"([^"]+)"/,"$1 $2"))),d=[]}if(d.length){let a=pgp.helpers.insert(d,e);c.push(b.none(a.replace(/^(insert into )"([^"]+)"/,"$1 $2")))}}if(a.map.size){let d=[],e=new pgp.helpers.ColumnSet(["key","res","id"],{table:this.id+".map"+this.field});for(const f of a.map){const a=f[0],g=f[1];for(let f,h=0;h<g.length;h++)if((f=g[h])&&f.length)for(let g=0;g<f.length;g++)if(d.push({key:a,res:h,id:f[g]}),d.length===MAXIMUM_QUERY_VARS){let a=pgp.helpers.insert(d,e);c.push(b.none(a.replace(/^(insert into )"([^"]+)"/,"$1 $2"))),d=[]}}if(d.length){let a=pgp.helpers.insert(d,e);c.push(b.none(a.replace(/^(insert into )"([^"]+)"/,"$1 $2")))}}if(a.ctx.size){let d=[],e=new pgp.helpers.ColumnSet(["ctx","key","res","id"],{table:this.id+".ctx"+this.field});for(const f of a.ctx){const a=f[0],g=f[1];for(const f of g){const g=f[0],h=f[1];for(let f,k=0;k<h.length;k++)if((f=h[k])&&f.length)for(let h=0;h<f.length;h++)if(d.push({ctx:a,key:g,res:k,id:f[h]}),d.length===MAXIMUM_QUERY_VARS){let a=pgp.helpers.insert(d,e);c.push(b.none(a.replace(/^(insert into )"([^"]+)"/,"$1 $2"))),d=[]}}}if(d.length){let a=pgp.helpers.insert(d,e);c.push(b.none(a.replace(/^(insert into )"([^"]+)"/,"$1 $2")))}}if(a.tag){let d=[],e=new pgp.helpers.ColumnSet(["tag","id"],{table:this.id+".tag"+this.field});for(const f of a.tag){const a=f[0],g=f[1];if(g.length)for(let f=0;f<g.length;f++)if(d.push({tag:a,id:g[f]}),d.length===MAXIMUM_QUERY_VARS){let a=pgp.helpers.insert(d,e);c.push(b.none(a.replace(/^(insert into )"([^"]+)"/,"$1 $2"))),d=[]}}if(d.length){let a=pgp.helpers.insert(d,e);c.push(b.none(a.replace(/^(insert into )"([^"]+)"/,"$1 $2")))}}return c.length?b.batch(c):void 0}),a.map.clear(),a.ctx.clear(),a.tag&&a.tag.clear(),a.store&&a.store.clear(),a.document||a.reg.clear())},PostgresDB.prototype.remove=function(a){if(a||0===a)return"object"!=typeof a&&(a=[a]),a.length?this.transaction(function(b){return a=[a],b.batch([b.none({text:"DELETE FROM "+this.id+".map"+this.field+" WHERE id = ANY ($1)",rowMode:"array"},a),b.none({text:"DELETE FROM "+this.id+".ctx"+this.field+" WHERE id = ANY ($1)",rowMode:"array"},a),b.none({text:"DELETE FROM "+this.id+".tag"+this.field+" WHERE id = ANY ($1)",rowMode:"array"},a),b.none({text:"DELETE FROM "+this.id+".reg WHERE id = ANY ($1)",rowMode:"array"},a)])}):void 0};

1
dist/module-min/db/redis/index.js vendored Normal file

File diff suppressed because one or more lines are too long

119
dist/module-min/db/sqlite/index.js vendored Normal file
View File

@@ -0,0 +1,119 @@
import sqlite3 from"sqlite3";import path from"path";import StorageInterface from"../interface.js";import{concat,toArray}from"../../common.js";import Document from"../../document.js";const VERSION=1,MAXIMUM_QUERY_VARS=16000,fields=["map","ctx","reg","tag","cfg"],types={text:"text",char:"text",varchar:"text",string:"text",number:"int",numeric:"int",integer:"int",smallint:"int",tinyint:"int",mediumint:"int",int:"int",int8:"int",uint8:"int",int16:"int",uint16:"int",int32:"int",uint32:"bigint",int64:"bigint",bigint:"bigint"};function sanitize(a){return a.toLowerCase().replace(/[^a-z0-9_]/g,"")}const TRX=Object.create(null),DB=Object.create(null);export default function SqliteDB(a,b={}){if(!(this instanceof SqliteDB))return new SqliteDB(a,b);if("object"==typeof a&&(a=a.name,b=a),a||console.info("Default storage space was used, because a name was not passed."),this.id=b.path||(":memory:"===a?a:"flexsearch"+(a?"-"+sanitize(a):"")+".sqlite"),this.field=b.field?"_"+sanitize(b.field):"",this.support_tag_search=!0,this.db=b.db||DB[this.id]||null,this.type=b.type?types[b.type.toLowerCase()]:"string",!this.type)throw new Error("Unknown type of ID '"+b.type+"'")}SqliteDB.prototype.mount=function(a){return a instanceof Document?a.mount(this):(a.db=this,this.open())},SqliteDB.prototype.open=async function(){if(!this.db&&!(this.db=DB[this.id])){let a=this.id;if(":memory:"!==a&&"/"!==a[0]&&"\\"!==a[0]){const b=process.cwd();a=path.join(b,this.id)}this.db=DB[this.id]=new sqlite3.Database(a)}const a=this.db;for(let b=0;b<fields.length;b++){const c=await this.promisfy({method:"get",stmt:"SELECT EXISTS(SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?) as exist",params:[fields[b]+("reg"===fields[b]?"":this.field)]});if(!c||!c.exist){let c,d;switch(fields[b]){case"map":c=`
CREATE TABLE IF NOT EXISTS main.map${this.field}(
key TEXT NOT NULL,
res INTEGER NOT NULL,
id ${this.type} NOT NULL
);
`,d=`
CREATE INDEX IF NOT EXISTS map_key_index${this.field}
ON map${this.field} (key);
CREATE INDEX IF NOT EXISTS map_id_index${this.field}
ON map${this.field} (id);
`;break;case"ctx":c=`
CREATE TABLE IF NOT EXISTS main.ctx${this.field}(
ctx TEXT NOT NULL,
key TEXT NOT NULL,
res INTEGER NOT NULL,
id ${this.type} NOT NULL
);
`,d=`
CREATE INDEX IF NOT EXISTS ctx_key_index${this.field}
ON ctx${this.field} (ctx, key);
CREATE INDEX IF NOT EXISTS ctx_id_index${this.field}
ON ctx${this.field} (id);
`;break;case"tag":c=`
CREATE TABLE IF NOT EXISTS main.tag${this.field}(
tag TEXT NOT NULL,
id ${this.type} NOT NULL
);
`,d=`
CREATE INDEX IF NOT EXISTS tag_index${this.field}
ON tag${this.field} (tag);
CREATE INDEX IF NOT EXISTS tag_id_index${this.field}
ON tag${this.field} (id);
`;break;case"reg":c=`
CREATE TABLE IF NOT EXISTS main.reg(
id ${this.type} NOT NULL
CONSTRAINT reg_pk${this.field}
PRIMARY KEY,
doc TEXT DEFAULT NULL
);
`,d=`
CREATE INDEX IF NOT EXISTS reg_index
ON reg (id);
`;break;case"cfg":c=`
CREATE TABLE IF NOT EXISTS main.cfg${this.field} (
cfg TEXT NOT NULL
);
`;}await new Promise(function(b,e){a.exec(c,function(c,f){return c?e(c):void(d?a.exec(d,function(a,c){return a?e(a):void b(c)}):b(f))})})}}return a.exec("PRAGMA optimize = 0x10002"),a},SqliteDB.prototype.close=function(){return this.db.close(),this.db=null,this},SqliteDB.prototype.destroy=async function(){await this.transaction(function(){this.db.run("DROP TABLE IF EXISTS main.map"+this.field+";"),this.db.run("DROP TABLE IF EXISTS main.ctx"+this.field+";"),this.db.run("DROP TABLE IF EXISTS main.tag"+this.field+";"),this.db.run("DROP TABLE IF EXISTS main.cfg"+this.field+";"),this.db.run("DROP TABLE IF EXISTS main.reg;")}),this.close()},SqliteDB.prototype.clear=function(){return this.transaction(function(){this.db.run("DELETE FROM main.map"+this.field+" WHERE 1;"),this.db.run("DELETE FROM main.ctx"+this.field+" WHERE 1;"),this.db.run("DELETE FROM main.tag"+this.field+" WHERE 1;"),this.db.run("DELETE FROM main.cfg"+this.field+" WHERE 1;"),this.db.run("DELETE FROM main.reg WHERE 1;")})};function create_result(a,b,c){if(b){for(let b=0;b<a.length;b++)c?a[b].doc&&(a[b].doc=JSON.parse(a[b].doc)):a[b]=a[b].id;return a}else{const b=[];for(let d,e=0;e<a.length;e++)d=a[e],b[d.res]||(b[d.res]=[]),b[d.res].push(c?d:d.id);return b}}SqliteDB.prototype.get=function(a,b,c=0,d=0,e=!0,f=!1,g){let h,j="",k=b?[b,a]:[a],l="main."+(b?"ctx":"map")+this.field;if(g)for(let a=0;a<g.length;a+=2)j+=` AND ${l}.id IN (SELECT id FROM main.tag_${sanitize(g[a])} WHERE tag = ?)`,k.push(g[a+1]);return h=b?this.promisfy({method:"all",stmt:`
SELECT ${l}.id
${e?"":", res"}
${f?", doc":""}
FROM ${l}
${f?`
LEFT JOIN main.reg ON main.reg.id = ${l}.id
`:""}
WHERE ctx = ? AND key = ? ${j}
ORDER BY res
${c?"LIMIT "+c:""}
${d?"OFFSET "+d:""}
`,params:k}):this.promisfy({method:"all",stmt:`
SELECT ${l}.id
${e?"":", res"}
${f?", doc":""}
FROM ${l}
${f?`
LEFT JOIN main.reg ON main.reg.id = ${l}.id
`:""}
WHERE key = ? ${j}
ORDER BY res
${c?"LIMIT "+c:""}
${d?"OFFSET "+d:""}
`,params:k}),h.then(function(a){return create_result(a,e,f)})},SqliteDB.prototype.tag=function(a,b=0,c=0,d=!1){const e="main.tag"+this.field,f=this.promisfy({method:"all",stmt:`
SELECT ${e}.id
${d?", doc":""}
FROM ${e}
${d?`
LEFT JOIN main.reg ON main.reg.id = ${e}.id
`:""}
WHERE tag = ?
${b?"LIMIT "+b:""}
${c?"OFFSET "+c:""}
`,params:[a]});return d||f.then(function(a){return create_result(a,!0,!1)}),f};function build_params(a){let b=",?";for(let c=1;c<a;)if(c<=a-c)b+=b,c*=2;else{b+=b.substring(0,2*(a-c));break}return b.substring(1)}SqliteDB.prototype.enrich=function(a){const b=[],c=[];"object"!=typeof a&&(a=[a]);for(let b=0;b<a.length;){const d=a.length-b>MAXIMUM_QUERY_VARS?a.slice(b,b+MAXIMUM_QUERY_VARS):b?a.slice(b):a;b+=d.length;let e=build_params(d.length);c.push(this.promisfy({method:"all",stmt:`SELECT id, doc FROM main.reg WHERE id IN (${e})`,params:d}))}return Promise.all(c).then(function(a){for(let c,d=0;d<a.length;d++)if(c=a[d],c&&c.length){for(let a,b=0;b<c.length;b++)(a=c[b].doc)&&(c[b].doc=JSON.parse(a));b.push(c)}return 1===b.length?b[0]:1<b.length?concat(b):b})},SqliteDB.prototype.has=function(a){return this.promisfy({method:"get",stmt:`SELECT EXISTS(SELECT 1 FROM main.reg WHERE id = ?) as exist`,params:[a]}).then(function(a){return a&&a.exist})},SqliteDB.prototype.search=function(a,b,c=100,d=0,e=!1,f=!0,g=!1,h){let i;if(1<b.length&&a.depth){let j,k="",l=[],m=b[0];for(let c=1;c<b.length;c++){j=b[c];const d=a.bidirectional&&j>m;k+=(k?" OR ":"")+`(ctx = ? AND key = ?)`,l.push(d?j:m,d?m:j),m=j}if(h){k="("+k+")";for(let a=0;a<h.length;a+=2)k+=` AND id IN (SELECT id FROM main.tag_${sanitize(h[a])} WHERE tag = ?)`,l.push(h[a+1])}i=this.promisfy({method:"all",stmt:`
SELECT r.id
${f?"":", res"}
${g?", doc":""}
FROM (
SELECT id, count(*) as count,
${e?"SUM":"MIN"}(res) as res
FROM main.ctx${this.field}
WHERE ${k}
GROUP BY id
) as r
${g?`
LEFT JOIN main.reg ON main.reg.id = r.id
`:""}
${e?"":"WHERE count = "+(b.length-1)}
ORDER BY ${e?"count DESC, res":"res"}
${c?"LIMIT "+c:""}
${d?"OFFSET "+d:""}
`,params:l})}else{let a="",j=b.length;for(let b=0;b<j;b++)a+=(a?" OR ":"")+`key = ?`;if(h){a="("+a+")";for(let c=0;c<h.length;c+=2)a+=` AND id IN (SELECT id FROM main.tag_${sanitize(h[c])} WHERE tag = ?)`,b.push(h[c+1])}i=this.promisfy({method:"all",stmt:`
SELECT r.id
${f?"":", res"}
${g?", doc":""}
FROM (
SELECT id, count(*) as count,
${e?"SUM":"MIN"}(res) as res
FROM main.map${this.field}
WHERE ${a}
GROUP BY id
) as r
${g?`
LEFT JOIN main.reg ON main.reg.id = r.id
`:""}
${e?"":"WHERE count = "+j}
ORDER BY ${e?"count DESC, res":"res"}
${c?"LIMIT "+c:""}
${d?"OFFSET "+d:""}
`,params:b})}return i.then(function(a){return create_result(a,f,g)})},SqliteDB.prototype.info=function(){},SqliteDB.prototype.transaction=function(a,b){const c=this;if(TRX[this.id])return TRX[this.id].then(function(){return c.transaction(a,b)});const d=this.db;return TRX[this.id]=new Promise(function(e,f){d.exec("PRAGMA optimize"),d.exec("PRAGMA busy_timeout = 5000"),d.exec("BEGIN"),d.parallelize(function(){a.call(c)}),d.exec("COMMIT",function(a,g){return TRX[c.id]=null,a?f(a):void(b&&b(g),e(g),d.exec("PRAGMA shrink_memory"))})})},SqliteDB.prototype.commit=async function(a,b,c){if(b)await this.clear(),a.commit_task=[];else{let d=a.commit_task;a.commit_task=[];for(let a,c=0;c<d.length;c++)if(a=d[c],a.clear){await this.clear(),b=!0;break}else d[c]=a.del;b||(!c&&(d=d.concat(toArray(a.reg))),d.length&&(await this.remove(d)))}a.reg.size&&(await this.transaction(function(){for(const b of a.map){const a=b[0],c=b[1];for(let b,d=0;d<c.length;d++)if((b=c[d])&&b.length){let c="",e=[];for(let f=0;f<b.length;f++)c+=(c?",":"")+"(?,?,?)",e.push(a,d,b[f]),(f===b.length-1||e.length+3>MAXIMUM_QUERY_VARS)&&(this.db.run("INSERT INTO main.map"+this.field+" (key, res, id) VALUES "+c,e),c="",e=[])}}for(const b of a.ctx){const a=b[0],c=b[1];for(const b of c){const c=b[0],d=b[1];for(let b,e=0;e<d.length;e++)if((b=d[e])&&b.length){let d="",f=[];for(let g=0;g<b.length;g++)d+=(d?",":"")+"(?,?,?,?)",f.push(a,c,e,b[g]),(g===b.length-1||f.length+4>MAXIMUM_QUERY_VARS)&&(this.db.run("INSERT INTO main.ctx"+this.field+" (ctx, key, res, id) VALUES "+d,f),d="",f=[])}}}if(a.store){let b="",c=[];for(const d of a.store.entries()){const a=d[0],e=d[1];b+=(b?",":"")+"(?,?)",c.push(a,"object"==typeof e?JSON.stringify(e):e||null),c.length+2>MAXIMUM_QUERY_VARS&&(this.db.run("INSERT INTO main.reg (id, doc) VALUES "+b,c),b="",c=[])}c.length&&this.db.run("INSERT INTO main.reg (id, doc) VALUES "+b,c)}else if(!a.bypass){let b=toArray(a.reg);for(let a=0;a<b.length;){const c=b.length-a>MAXIMUM_QUERY_VARS?b.slice(a,a+MAXIMUM_QUERY_VARS):a?b.slice(a):b;a+=c.length;const d=build_params(c.length);this.db.run("INSERT INTO main.reg (id) VALUES ("+d+")",c)}}if(a.tag){let b="",c=[];for(const d of a.tag){const a=d[0],e=d[1];if(e.length){for(let d=0;d<e.length;d++)b+=(b?",":"")+"(?,?)",c.push(a,e[d]);c.length+2>MAXIMUM_QUERY_VARS&&(this.db.run("INSERT INTO main.tag"+this.field+" (tag, id) VALUES "+b,c),b="",c=[])}}c.length&&this.db.run("INSERT INTO main.tag"+this.field+" (tag, id) VALUES "+b,c)}}),a.map.clear(),a.ctx.clear(),a.tag&&a.tag.clear(),a.store&&a.store.clear(),a.document||a.reg.clear())},SqliteDB.prototype.remove=function(a){"object"!=typeof a&&(a=[a]);let b;a.length>MAXIMUM_QUERY_VARS&&(b=a.slice(MAXIMUM_QUERY_VARS),a=a.slice(0,MAXIMUM_QUERY_VARS));const c=this;return this.transaction(function(){const b=build_params(a.length);this.db.run("DELETE FROM main.map"+c.field+" WHERE id IN ("+b+")",a),this.db.run("DELETE FROM main.ctx"+c.field+" WHERE id IN ("+b+")",a),this.db.run("DELETE FROM main.tag"+c.field+" WHERE id IN ("+b+")",a),this.db.run("DELETE FROM main.reg WHERE id IN ("+b+")",a)}).then(function(a){return b?c.remove(b):a})},SqliteDB.prototype.promisfy=function(a){const b=this.db;return new Promise(function(c,d){b[a.method](a.stmt,a.params||[],function(b,e){a.callback&&a.callback(e),b?d(b):c(e)})})};

1
dist/module-min/document.js vendored Normal file
View File

@@ -0,0 +1 @@
import{DocumentOptions}from"./type.js";import Index from"./index.js";import WorkerIndex from"./worker/index.js";import Cache,{searchCache}from"./cache.js";import{is_string,is_object,parse_simple}from"./common.js";import apply_async from"./async.js";import{exportDocument,importDocument}from"./serialize.js";import{KeystoreMap,KeystoreSet}from"./keystore.js";import"./document/add.js";import"./document/search.js";export default function Document(a){if(!(this instanceof Document))return new Document(a);const b=a.document||a.doc||a;let c,d;if(this.tree=[],this.field=[],this.marker=[],this.key=(c=b.key||b.id)&&parse_tree(c,this.marker)||"id",d=a.keystore||0,d&&(this.keystore=d),this.fastupdate=!!a.fastupdate,this.reg=this.fastupdate?d&&!0?new KeystoreMap(d):new Map:d&&!0?new KeystoreSet(d):new Set,this.storetree=(c=b.store||null)&&!0!==c&&[],this.store=c&&(d&&!0?new KeystoreMap(d):new Map),this.cache=(c=a.cache||null)&&new Cache(c),a.cache=!1,this.worker=a.worker,this.async=!1,this.index=parse_descriptor.call(this,a,b),(this.tag=null,(c=b.tag)&&("string"==typeof c&&(c=[c]),c.length))){this.tag=new Map,this.tagtree=[],this.tagfield=[];for(let a,b,d=0;d<c.length;d++){if(a=c[d],b=a.field||a,!b)throw new Error("The tag field from the document descriptor is undefined.");a.custom?this.tagtree[d]=a.custom:(this.tagtree[d]=parse_tree(b,this.marker),a.filter&&("string"==typeof this.tagtree[d]&&(this.tagtree[d]=new String(this.tagtree[d])),this.tagtree[d]._filter=a.filter)),this.tagfield[d]=b,this.tag.set(b,new Map)}}a.db&&this.mount(a.db)}Document.prototype.mount=function(a){let b=this.field;if(this.tag)for(let a,c=0;c<this.tagfield.length;c++){a=this.tagfield[c];let d=this.index.get(a);d||(this.index.set(a,d=new Index({},this.reg)),b===this.field&&(b=b.slice(0)),b.push(a)),d.tag=this.tag.get(a)}const c=[],d={db:a.db,type:a.type,fastupdate:a.fastupdate};for(let e,f,g=0;g<b.length;g++){d.field=f=b[g],e=this.index.get(f);const h=new a.constructor(a.id,d);h.id=a.id,c[g]=h.mount(e),e.document=!0,g?e.bypass=!0:e.store=this.store}return this.async=!0,this.db=!0,Promise.all(c)},Document.prototype.commit=async function(a,b){const c=[];for(const d of this.index.values())c.push(d.db.commit(d,a,b));await Promise.all(c),this.reg.clear()};function parse_descriptor(a,b){const c=new Map;let d=b.index||b.field||b;is_string(d)&&(d=[d]);for(let e,f,g=0;g<d.length;g++){if(e=d[g],is_string(e)||(f=e,e=e.field),f=is_object(f)?Object.assign({},a,f):a,this.worker){const a=new WorkerIndex(f);c.set(e,a),a.worker||(this.worker=!1)}this.worker||c.set(e,new Index(f,this.reg)),f.custom?this.tree[g]=f.custom:(this.tree[g]=parse_tree(e,this.marker),f.filter&&("string"==typeof this.tree[g]&&(this.tree[g]=new String(this.tree[g])),this.tree[g]._filter=f.filter)),this.field[g]=e}if(this.storetree){let a=b.store;is_string(a)&&(a=[a]);for(let b,c,d=0;d<a.length;d++)b=a[d],c=b.field||b,b.custom?(this.storetree[d]=b.custom,b.custom._field=c):(this.storetree[d]=parse_tree(c,this.marker),b.filter&&("string"==typeof this.storetree[d]&&(this.storetree[d]=new String(this.storetree[d])),this.storetree[d]._filter=b.filter))}return c}function parse_tree(a,b){const c=a.split(":");let d=0;for(let e=0;e<c.length;e++)a=c[e],"]"===a[a.length-1]&&(a=a.substring(0,a.length-2),a&&(b[d]=!0)),a&&(c[d++]=a);return d<c.length&&(c.length=d),1<d?c:c[0]}Document.prototype.append=function(a,b){return this.add(a,b,!0)},Document.prototype.update=function(a,b){return this.remove(a).add(a,b)},Document.prototype.remove=function(a){is_object(a)&&(a=parse_simple(a,this.key));for(const b of this.index.values())b.remove(a,!0);if(this.reg.has(a)){if(this.tag&&!this.fastupdate)for(let b of this.tag.values())for(let c of b){const d=c[0],e=c[1],f=e.indexOf(a);-1<f&&(1<e.length?e.splice(f,1):b.delete(d))}this.store&&this.store.delete(a),this.reg.delete(a)}return this.cache&&this.cache.remove(a),this},Document.prototype.clear=function(){for(const a of this.index.values())a.clear();if(this.tag)for(const a of this.tag.values())a.clear();return this.store&&this.store.clear(),this},Document.prototype.contain=function(a){return this.db?this.index.get(this.field[0]).db.has(a):this.reg.has(a)},Document.prototype.cleanup=function(){for(const a of this.index.values())a.cleanup();return this},Document.prototype.get=function(a){return this.db?this.index.get(this.field[0]).db.enrich(a).then(function(a){return a[0]&&a[0].doc}):this.store.get(a)},Document.prototype.set=function(a,b){return this.store.set(a,b),this},Document.prototype.searchCache=searchCache,Document.prototype.export=exportDocument,Document.prototype.import=importDocument,apply_async(Document.prototype);

1
dist/module-min/document/add.js vendored Normal file
View File

@@ -0,0 +1 @@
import{create_object,is_array,is_object,is_string,parse_simple}from"../common.js";import{KeystoreArray}from"../keystore.js";import Document from"../document.js";Document.prototype.add=function(a,b,c){if(is_object(a)&&(b=a,a=parse_simple(b,this.key)),b&&(a||0===a)){if(!c&&this.reg.has(a))return this.update(a,b);for(let d,e=0;e<this.field.length;e++){d=this.tree[e];const f=this.index.get(this.field[e]);if("function"==typeof d){const c=d(b);c&&f.add(a,c,!1,!0)}else{const e=d._filter;if(e&&!e(b))continue;d instanceof String?d=[""+d]:is_string(d)&&(d=[d]),add_index(b,d,this.marker,0,f,a,d[0],c)}}if(this.tag)for(let d=0;d<this.tagtree.length;d++){let e,f=this.tagtree[d],g=this.tagfield[d],h=this.tag.get(g),j=create_object();if("function"!=typeof f){const a=f._filter;if(a&&!a(b))continue;f instanceof String&&(f=""+f),e=parse_simple(b,f)}else if(e=f(b),!e)continue;if(!h||!e){continue}is_string(e)&&(e=[e]);for(let b,d,f=0;f<e.length;f++)if(b=e[f],!j[b]){j[b]=1;let e;if(e=h.get(b),e?d=e:h.set(b,d=[]),!c||!d.includes(a)){if(2147483647===d.length){const a=new KeystoreArray(d);if(this.fastupdate)for(let b of this.reg.values())b.includes(d)&&(b[b.indexOf(d)]=a);h.set(b,d=a)}if(d.push(a),this.fastupdate){const b=this.reg.get(a);b?b.push(d):this.reg.set(a,[d])}}}}if(this.store&&(!c||!this.store.has(a))){let c;if(this.storetree){c=create_object();for(let a,d=0;d<this.storetree.length;d++){a=this.storetree[d];const e=a._filter;if(e&&!e(b))continue;let f;if("function"==typeof a){if(f=a(b),!f)continue;a=[a._field]}else if(is_string(a)||a instanceof String){c[a]=b[a];continue}store_value(b,c,a,0,a[0],f)}}this.store.set(a,c||b)}}return this};function store_value(a,b,c,d,e,f){if(a=a[e],d===c.length-1)b[e]=f||a;else if(a)if(is_array(a)){b=b[e]=Array(a.length);for(let e=0;e<a.length;e++)store_value(a,b,c,d,e)}else b=b[e]||(b[e]=create_object()),e=c[++d],store_value(a,b,c,d,e)}function add_index(a,b,c,d,e,f,g,h){if(!(a=a[g]))e.db&&e.remove(f);else if(d===b.length-1){if(is_array(a)){if(c[d]){for(let b=0;b<a.length;b++)e.add(f,a[b],!0,!0);return}a=a.join(" ")}e.add(f,a,h,!0)}else if(is_array(a))for(let g=0;g<a.length;g++)add_index(a,b,c,d,e,f,g,h);else g=b[++d],add_index(a,b,c,d,e,f,g,h)}

1
dist/module-min/document/search.js vendored Normal file
View File

@@ -0,0 +1 @@
import{DocumentSearchOptions}from"../type.js";import{create_object,is_array,is_object,is_string}from"../common.js";import{intersect_union}from"../intersect.js";import Document from"../document.js";let debug=!1;Document.prototype.search=function(a,b,c,d){debug,c||(!b&&is_object(a)?(c=a,a=""):is_object(b)&&(c=b,b=0));let e,f,g,h,j,k,l,m=[],n=[],o=0;if(c)if(is_array(c))j=c,c=null;else{if(a=c.query||a,e=c.pluck,g=c.merge,j=e||c.field||c.index,k=this.tag&&c.tag,f=this.store&&c.enrich,h=c.suggest,b=c.limit||b,l=c.offset||0,b||(b=100),k&&(!this.db||!d)){debug,k.constructor!==Array&&(k=[k]);let c=[];for(let a,b=0;b<k.length;b++)if(a=k[b],a.field&&a.tag){const b=a.tag;if(b.constructor===Array)for(let d=0;d<b.length;d++)c.push(a.field,b[d]);else c.push(a.field,b)}else{const b=Object.keys(a);for(let d,e,f=0;f<b.length;f++)if(d=b[f],e=a[d],e.constructor===Array)for(let a=0;a<e.length;a++)c.push(d,e[a]);else c.push(d,e)}if(k=c,!a){let a=[];if(c.length)for(let d=0;d<c.length;d+=2){let e;if(this.db){const g=this.index.get(c[d]);if(!g){continue}debug,a.push(e=g.db.tag(c[d+1],b,l,f))}else debug,e=get_tag.call(this,c[d],c[d+1],b,l,f);m.push({field:c[d],tag:c[d+1],result:e})}return a.length?Promise.all(a).then(function(a){for(let b=0;b<a.length;b++)m[b].result=a[b];return m}):m}}is_string(j)&&(j=[j])}j||(j=this.field);let p,q=!d&&(this.worker||this.async)&&[];for(let e,g,l,r=0;r<j.length;r++){if(g=j[r],this.db&&this.tag&&!this.tree[r])continue;let i;if(is_string(g)||(i=g,g=i.field,a=i.query||a,b=i.limit||b,h=i.suggest||h),d)e=d[r];else{let d=i||c,h=this.index.get(g);if(k&&(this.db&&(d.tag=k,p=h.db.support_tag_search,d.field=j),!p&&(d.enrich=!1)),q){q[r]=h.searchAsync(a,b,d),d&&f&&(d.enrich=f);continue}else e=h.search(a,b,d),d&&f&&(d.enrich=f)}if(l=e&&e.length,k&&l){const a=[];let b=0;if(!(this.db&&d))for(let c,d,e=0;e<k.length;e+=2){if(debug,c=this.tag.get(k[e]),!c)if(!1,h)continue;else return m;if(c=c&&c.get(k[e+1]),d=c&&c.length,d)b++,a.push(c);else if(!h)return m}else if(!p)for(let c=j.length;c<d.length;c++){let e=d[c],f=e&&e.length;if(f)b++,a.push(e);else if(!h)return m}if(b){if(debug,e=intersect_union(e,a),l=e.length,!l&&!h)return m;b--}}if(l)n[o]=g,m.push(e),o++;else if(1===j.length)return m}if(q){if(this.db&&k&&k.length&&!p)for(let a=0;a<k.length;a+=2){const c=this.index.get(k[a]);if(!c)if(!1,h)continue;else return m;debug,q.push(c.db.tag(k[a+1],b,l,!1))}const d=this;return Promise.all(q).then(function(e){return e.length?d.search(a,b,c,e):e})}if(!o)return m;if(e&&(!f||!this.store))return m[0];q=[];for(let g,h=0;h<n.length;h++){if(g=m[h],f&&g.length&&!g[0].doc&&(this.db?(debug,q.push(g=this.index.get(this.field[0]).db.enrich(g))):g.length&&(g=apply_enrich.call(this,g))),e)return g;m[h]={field:n[h],result:g}}return f&&!0&&this.db&&q.length?Promise.all(q).then(function(a){for(let b=0;b<a.length;b++)m[b].result=a[b];return g?merge_fields(m,b,l):m}):g?merge_fields(m,b,l):m};function merge_fields(a,b){const c=[],d=create_object();for(let e,f,g=0;g<a.length;g++){e=a[g],f=e.result;for(let a,g,h,i=0;i<f.length;i++)if(g=f[i],a=g.id,h=d[a],!h){if(c.length===b)return c;g.field=d[a]=[e.field],c.push(g)}else h.push(e.field)}return c}function get_tag(a,b,c,d){let e=this.tag.get(a);if(!e)return!1,[];e=e&&e.get(b);e&&e.length-d}function apply_enrich(a){const b=Array(a.length);for(let c,d=0;d<a.length;d++)c=a[d],b[d]={id:c,doc:this.store.get(c)};return b}

1
dist/module-min/encoder.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/module-min/index.js vendored Normal file
View File

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

1
dist/module-min/index/add.js vendored Normal file
View File

@@ -0,0 +1 @@
import{create_object}from"../common.js";import Index,{autoCommit}from"../index.js";import default_compress from"../compress.js";import{KeystoreArray}from"../keystore.js";Index.prototype.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.reg.has(a))return this.update(a,b);b=this.encoder.encode(b);const e=b.length;if(e){const d=create_object(),f=create_object(),g=this.depth,h=this.resolution;for(let j=0;j<e;j++){let i=b[this.rtl?e-1-j:j],k=i.length;if(k&&(g||!f[i])){let l=this.score?this.score(b,i,j,null,0):get_score(h,e,j),m="";switch(this.tokenize){case"full":if(2<k){for(let d=0;d<k;d++)for(let g=k;g>d;g--){m=i.substring(d,g);const l=this.score?this.score(b,i,j,m,d):get_score(h,e,j,k,d);this.push_index(f,m,l,a,c)}break}case"reverse":if(1<k){for(let d=k-1;0<d;d--){m=i[d]+m;const g=this.score?this.score(b,i,j,m,d):get_score(h,e,j,k,d);this.push_index(f,m,g,a,c)}m=""}case"forward":if(1<k){for(let b=0;b<k;b++)m+=i[b],this.push_index(f,m,l,a,c);break}default:if(this.push_index(f,i,l,a,c),g&&1<e&&j<e-1){const f=create_object(),h=this.resolution_ctx,k=i,l=Math.min(g+1,e-j);f[k]=1;for(let g=1;g<l;g++)if(i=b[this.rtl?e-1-j-g:j+g],i&&!f[i]){f[i]=1;const m=this.score?this.score(b,k,j,i,g):get_score(h+(e/2>h?0:1),e,j,l-1,g-1),n=this.bidirectional&&i>k;this.push_index(d,n?k:i,m,a,c,n?i:k)}}}}}this.fastupdate||this.reg.add(a)}else b=""}return this.db&&(b||this.commit_task.push({del:a}),this.commit_auto&&autoCommit(this)),this},Index.prototype.push_index=function(a,b,c,d,e,f){let g,h=f?this.ctx:this.map;if((!a[b]||!f||!(g=a[b])[f])&&(f?(a=g||(a[b]=create_object()),a[f]=1,this.compress&&(f=default_compress(f)),g=h.get(f),g?h=g:h.set(f,h=new Map)):a[b]=1,this.compress&&(b=default_compress(b)),g=h.get(b),g?h=g:h.set(b,h=g=[]),h=h[c]||(h[c]=[]),!e||!h.includes(d))){if(2147483647===h.length){const a=new KeystoreArray(h);if(this.fastupdate)for(let b of this.reg.values())b.includes(h)&&(b[b.indexOf(h)]=a);g[c]=h=a}if(h.push(d),this.fastupdate){const a=this.reg.get(d);a?a.push(h):this.reg.set(d,[h])}}};function get_score(a,b,c,d,e){return c&&1<a?b+(d||0)<=a?c+(e||0):0|(a-1)/(b+(d||0))*(c+(e||0))+1:0}

1
dist/module-min/index/remove.js vendored Normal file
View File

@@ -0,0 +1 @@
import{create_object,is_array}from"../common.js";import Index,{autoCommit}from"../index.js";import default_compress from"../compress.js";Index.prototype.remove=function(a,b){const c=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(c){if(this.fastupdate){for(let b,d=0;d<c.length;d++)if(!(b=c[d]));else if(2>b.length)b.pop();else{const d=b.indexOf(a);d===c.length-1?b.pop():b.splice(d,1)}}else remove_index(this.map,a),this.depth&&remove_index(this.ctx,a);b||this.reg.delete(a)}return this.db&&(this.commit_task.push({del:a}),this.commit_auto&&autoCommit(this)),this.cache&&this.cache.remove(a),this};function remove_index(a,b){let c=0;if(is_array(a)){for(let d,e,f=0;f<a.length;f++)if((d=a[f])&&d.length)if(e=d.indexOf(b),0<=e){1<d.length?(d.splice(e,1),c++):delete a[f];break}else c++;}else for(let d of a){const e=d[0],f=d[1],g=remove_index(f,b);g?c+=g:a.delete(e)}return c}

1
dist/module-min/index/search.js vendored Normal file
View File

@@ -0,0 +1 @@
import{SearchOptions}from"../type.js";import{create_object,is_object,sort_by_length_down}from"../common.js";import Index from"../index.js";import default_compress from"../compress.js";import Resolver from"../resolver.js";import{intersect}from"../intersect.js";import resolve_default from"../resolve/default.js";let global_resolve=1;export function set_resolve(a){global_resolve=a}Index.prototype.search=function(a,b,c){c||(!b&&is_object(a)?(c=a,a=""):is_object(b)&&(c=b,b=0));let d,e,f,g,h,i,j=[],k=0;if(c?(a=c.query||a,b=c.limit||b,k=c.offset||0,e=c.context,f=c.suggest,g=global_resolve&&!1!==c.resolve,g||(global_resolve=0),h=g&&c.enrich,i=this.db&&c.tag):g=this.resolve||global_resolve,a=this.encoder.encode(a),d=a.length,b||!g||(b=100),1===d)return single_term_query.call(this,a[0],"",b,k,g,h,i);if(e=this.depth&&!1!==e,2===d&&e&&!f)return single_term_query.call(this,a[0],a[1],b,k,g,h,i);let l=0,m=0;if(1<d){const b=create_object(),c=[];for(let e,h=0;h<d;h++)if(e=a[h],e&&!b[e]){if(!f&&!this.db&&!this.get_array(e))return g?j:new Resolver(j);c.push(e),b[e]=1;const a=e.length;l=Math.max(l,a),m=m?Math.min(m,a):a}a=c,d=a.length}if(!d)return g?j:new Resolver(j);let n,o=0;if(1===d)return single_term_query.call(this,a[0],"",b,k,g,h,i);if(2===d&&e&&!f)return single_term_query.call(this,a[0],a[1],b,k,g,h,i);if(1<d&&(e?(n=a[0],o=1):9<l&&3<l/m&&a.sort(sort_by_length_down)),this.db){if(this.db.search){const c=this.db.search(this,a,b,k,f,g,h,i);if(!1!==c)return c}const c=this;return async function(){for(let e,h;o<d;o++){if(h=a[o],n?(e=await c.get_array(h,n),e=add_result(e,j,f,c.resolution_ctx,b,k,2===d),(!f||!1!==e||!j.length)&&(n=h)):(e=await c.get_array(h),e=add_result(e,j,f,c.resolution,b,k,1===d)),e)return e;if(f&&o==d-1){let a=j.length;if(!a){if(n){n="",o=-1;continue}return j}if(1===a)return g?resolve_default(j[0],b,k):new Resolver(j[0])}}return g?intersect(j,b,k,f):new Resolver(j[0])}()}for(let e,h;o<d;o++){if(h=a[o],n?(e=this.get_array(h,n),e=add_result(e,j,f,this.resolution_ctx,b,k,2===d),(!f||!1!==e||!j.length)&&(n=h)):(e=this.get_array(h),e=add_result(e,j,f,this.resolution,b,k,1===d)),e)return e;if(f&&o==d-1){const a=j.length;if(!a){if(n){n="",o=-1;continue}return j}if(1===a)return g?resolve_default(j[0],b,k):new Resolver(j[0])}}return g?intersect(j,b,k,f):new Resolver(j[0])};function single_term_query(a,b,c,d,e,f,g){const h=this.get_array(a,b,c,d,e,f,g);return this.db?h.then(function(a){return e?a:a&&a.length?e?resolve_default(a,c,d):new Resolver(a):e?[]:new Resolver([])}):h&&h.length?e?resolve_default(h,c,d):new Resolver(h):e?[]:new Resolver([])}function add_result(a,b,c,d,e,f,g){let h=[];if(a){d=Math.min(a.length,d);for(let b,c=0,i=0;c<d&&!((b=a[c])&&(f&&b&&g&&(b.length<=f?(f-=b.length,b=null):(b=b.slice(f),f=0)),b&&(h[c]=b,g&&(i+=b.length,i>=e))));c++);if(h.length)return g?resolve_default(h,e,0):void b.push(h)}return!c&&h}Index.prototype.get_array=function(a,b,c,d,e,f,g){let h,i;return(b&&(i=this.bidirectional&&a>b),this.compress&&(a=default_compress(a),b&&(b=default_compress(b))),this.db)?b?this.db.get(i?b:a,i?a:b,c,d,e,f,g):this.db.get(a,"",c,d,e,f,g):(b?(h=this.ctx.get(i?a:b),h=h&&h.get(i?b:a)):h=this.map.get(a),h)};

1
dist/module-min/intersect.js vendored Normal file
View File

@@ -0,0 +1 @@
import{create_object,concat,sort_by_length_up,get_max_len}from"./common.js";export function intersect(a,b,c,d){const e=a.length;let f,g,h,i,j=[],k=0;d&&(d=[]);for(let l,m=e-1;0<=m;m--){i=a[m],h=create_object(),l=!f;for(let a,e=0;e<i.length;e++)if(a=i[e],a&&a.length)for(let i,n=0;n<a.length;n++)if(i=a[n],f){if(f[i]){if(!m)if(c)c--;else if(j[k++]=i,k===b)return j;(m||d)&&(h[i]=1),l=!0}if(d&&!g[i]){g[i]=1;const a=d[e]||(d[e]=[]);a.push(i)}}else h[i]=1;if(d)f||(g=h);else if(!l)return[];f=h}if(d)for(let a,e,g=d.length-1;0<=g;g--){a=d[g],e=a.length;for(let d,g=0;g<e;g++)if(d=a[g],!f[d]){if(c)c--;else if(j[k++]=d,k===b)return j;f[d]=1}}return j}export function intersect_union(a,b){const c=create_object(),d=create_object(),e=[];for(let d=0;d<a.length;d++)c[a[d]]=1;for(let f,g=0;g<b.length;g++){f=b[g];for(let a,b=0;b<f.length;b++)a=f[b],c[a]&&!d[a]&&(d[a]=1,e.push(a))}return e}

1
dist/module-min/keystore.js vendored Normal file
View File

@@ -0,0 +1 @@
import{create_object}from"./common.js";export function KeystoreObj(a=8){return this instanceof KeystoreObj?(this.index=create_object(),this.keys=[],32<a?(this.crc=lcg64,this.bit=BigInt(a)):(this.crc=lcg,this.bit=a),new Proxy(this,{get(a,b){const c=a.crc(b),d=a.index[c];return d&&d[b]},set(a,b,c){const d=a.crc(b);let e=a.index[d];return e||(a.index[d]=e=create_object(),a.keys.push(d)),e[b]=c,!0},delete(a,b){const c=a.crc(b),d=a.index[c];return d&&delete d[b],!0}})):new KeystoreObj(a)}KeystoreObj.prototype.clear=function(){this.index=create_object(),this.keys=[]};function _slice(a,b,c,d){let e=[];for(let f,g=0;g<a.index.length;g++)if(f=a.index[g],b>=f.length)b-=f.length;else{const g=f[d?"splice":"slice"](b,c),h=g.length;if(h&&(e=e.length?e.concat(g):g,c-=h,d&&(a.length-=h),!c))break;b=0}return e}export function KeystoreArray(a){if(!(this instanceof KeystoreArray))return new KeystoreArray(a);this.index=a?[a]:[],this.length=a?a.length:0;const b=this;return new Proxy([],{get(a,c){if("length"===c)return b.length;if("push"===c)return function(a){b.index[b.index.length-1].push(a),b.length++};if("pop"===c)return function(){if(b.length)return b.length--,b.index[b.index.length-1].pop()};if("indexOf"===c)return function(a){let c=0;for(let d,e,f=0;f<b.index.length;f++){if(d=b.index[f],e=d.indexOf(a),0<=e)return c+e;c+=d.length}return-1};if("includes"===c)return function(a){for(let c=0;c<b.index.length;c++)if(b.index[c].includes(a))return!0;return!1};if("slice"===c)return function(a,c){return _slice(b,a||0,c||b.length,!1)};if("splice"===c)return function(a,c){return _slice(b,a||0,c||b.length,!0)};if("constructor"===c)return Array;if("symbol"!=typeof c){const a=b.index[0|c/2147483648];return a&&a[c]}},set(a,c,d){const e=0|c/2147483648,f=b.index[e]||(b.index[e]=[]);return f[c]=d,b.length++,!0}})}KeystoreArray.prototype.clear=function(){this.index.length=0},KeystoreArray.prototype.destroy=function(){this.index=null,this.proxy=null},KeystoreArray.prototype.push=function(){};export function KeystoreMap(a=8){return this instanceof KeystoreMap?void(this.index=create_object(),this.refs=[],this.size=0,32<a?(this.crc=lcg64,this.bit=BigInt(a)):(this.crc=lcg,this.bit=a)):new KeystoreMap(a)}KeystoreMap.prototype.get=function(a){const b=this.crc(a),c=this.index[b];return c&&c.get(a)},KeystoreMap.prototype.set=function(a,b){const c=this.crc(a);let d=this.index[c];if(d){let c=d.size;d.set(a,b),c-=d.size,c&&this.size++}else this.index[c]=d=new Map([[a,b]]),this.refs.push(d)};export function KeystoreSet(a=8){return this instanceof KeystoreSet?void(this.index=create_object(),this.refs=[],32<a?(this.crc=lcg64,this.bit=BigInt(a)):(this.crc=lcg,this.bit=a)):new KeystoreSet(a)}KeystoreSet.prototype.add=function(a){const b=this.crc(a);let c=this.index[b];if(c){let b=c.size;c.add(a),b-=c.size,b&&this.size++}else this.index[b]=c=new Set([a]),this.refs.push(c)},KeystoreMap.prototype.has=KeystoreSet.prototype.has=function(a){const b=this.crc(a),c=this.index[b];return c&&c.has(a)},KeystoreMap.prototype.delete=KeystoreSet.prototype.delete=function(a){const b=this.crc(a),c=this.index[b];c&&c.delete(a)&&this.size--},KeystoreMap.prototype.clear=KeystoreSet.prototype.clear=function(){this.index=create_object(),this.refs=[],this.size=0},KeystoreMap.prototype.values=KeystoreSet.prototype.values=function*(){for(let a=0;a<this.refs.length;a++)for(let b of this.refs[a].values())yield b},KeystoreMap.prototype.keys=KeystoreSet.prototype.keys=function*(){for(let a=0;a<this.refs.length;a++)for(let b of this.refs[a].keys())yield b},KeystoreMap.prototype.entries=KeystoreSet.prototype.entries=function*(){for(let a=0;a<this.refs.length;a++)for(let b of this.refs[a].entries())yield b};function lcg(a){let b=2**this.bit-1;if("number"==typeof a)return a&b;let c=0,d=this.bit+1;for(let e=0;e<a.length;e++)c=(c*d^a.charCodeAt(e))&b;return 32===this.bit?c+2147483648:c}function lcg64(a){let b=BigInt(2)**this.bit-BigInt(1),c=typeof a;if("bigint"==c)return a&b;if("number"==c)return BigInt(a)&b;let d=BigInt(0),e=this.bit+BigInt(1);for(let c=0;c<a.length;c++)d=(d*e^BigInt(a.charCodeAt(c)))&b;return d}

1
dist/module-min/lang/de.js vendored Normal file
View File

@@ -0,0 +1 @@
export const filter=new Set(["aber","als","am","an","auch","auf","aus","bei","bin","bis","bist","da","dadurch","daher","darum","das","dass","dass","dein","deine","dem","den","der","des","dessen","deshalb","die","dies","dieser","dieses","doch","dort","du","durch","ein","eine","einem","einen","einer","eines","er","es","euer","eure","fuer","hatte","hatten","hattest","hattet","hier","hinter","ich","ihr","ihre","im","in","ist","ja","jede","jedem","jeden","jeder","jedes","jener","jenes","jetzt","ggf","kann","kannst","koennen","koennt","machen","mein","meine","mit","muss","musst","musst","muessen","muesst","nach","nachdem","nein","nicht","noch","nun","oder","seid","sein","seine","sich","sie","sind","soll","sollen","sollst","sollt","sonst","soweit","sowie","und","unser","unsere","unter","usw","uvm","vom","von","vor","wann","warum","was","weiter","weitere","wenn","wer","werde","werden","werdet","weshalb","wie","wieder","wieso","wir","wird","wirst","wo","woher","wohin","zu","zum","zur","ueber"]);export const stemmer=new Map([["niss",""],["isch",""],["lich",""],["heit",""],["keit",""],["ell",""],["bar",""],["end",""],["ung",""],["est",""],["ern",""],["em",""],["er",""],["en",""],["es",""],["st",""],["ig",""],["ik",""],["e",""],["s",""]]);const map=new Map([["_"," "],["\xE4","ae"],["\xF6","oe"],["\xFC","ue"],["\xDF","ss"],["&"," und "],["\u20AC"," EUR "]]);export default{normalize:function(a){return a.toLowerCase()},prepare:function(a){return /[_äöüß&€]/.test(a)&&(a=a.replace(/[_äöüß&€]/g,a=>map.get(a))),a.replace(/str\b/g,"strasse").replace(/(?!\b)strasse\b/g," strasse").replace(/\bst\b/g,"sankt")},filter:filter,stemmer:stemmer};

1
dist/module-min/lang/en.js vendored Normal file
View File

@@ -0,0 +1 @@
export const filter=new Set(["a","about","above","after","again","against","all","also","am","an","and","any","are","arent","as","at","back","be","because","been","before","being","below","between","both","but","by","can","cannot","cant","come","could","couldnt","did","didnt","do","does","doesnt","doing","dont","down","during","each","even","few","for","from","further","get","go","good","had","hadnt","has","hasnt","have","havent","having","he","hed","her","here","heres","hers","herself","hes","him","himself","his","how","hows","i","id","if","ill","im","in","into","is","isnt","it","its","itself","ive","just","know","lets","like","lot","make","made","me","more","most","mustnt","my","myself","new","no","nor","not","now","of","off","on","once","one","only","or","other","ought","our","ours","ourselves","out","over","own","people","same","say","see","shant","she","shed","shell","shes","should","shouldnt","so","some","such","take","than","that","thats","the","their","theirs","them","themselves","then","there","theres","these","they","theyd","theyll","theyre","theyve","think","this","those","through","time","times","to","too","under","until","up","us","use","very","want","was","wasnt","way","we","wed","well","were","werent","weve","what","whats","when","whens","where","wheres","which","while","who","whom","whos","why","whys","will","with","wont","work","would","wouldnt","ya","you","youd","youll","your","youre","yours","yourself","yourselves","youve"]);export const stemmer=new Map([["ational",""],["iveness",""],["fulness",""],["ousness",""],["ization",""],["tional",""],["biliti",""],["icate",""],["ative",""],["alize",""],["iciti",""],["entli",""],["ousli",""],["alism",""],["ation",""],["aliti",""],["iviti",""],["ement",""],["izer",""],["able",""],["alli",""],["ator",""],["logi",""],["ical",""],["ance",""],["ence",""],["ness",""],["ble",""],["ment",""],["eli",""],["bli",""],["ful",""],["ant",""],["ent",""],["ism",""],["ate",""],["iti",""],["ous",""],["ive",""],["ize",""],["ing",""],["ion",""],["al",""],["ou",""],["er",""],["ic",""],["ly",""]]);export default{prepare:function(a){return a.replace(/´`ʼ/g,"'").replace(/_+/g," ").replace(/&/g," and ").replace(/\$/g," USD ").replace(/£/g," GBP ").replace(/([a-z])'s\b/g,"$1 is").replace(/\bi'm\b/g,"i am").replace(/\b(can't|cannot)\b/g,"can not").replace(/\bwon't\b/g,"will not").replace(/([a-z])n't\b/g,"$1 not").replace(/([a-z])'ll\b/g,"$1 will").replace(/([a-z])'re\b/g,"$1 are").replace(/([a-z])'ve\b/g,"$1 have").replace(/([a-z])'d\b/g,"$1 would")},filter:filter,stemmer:stemmer};

1
dist/module-min/lang/fr.js vendored Normal file
View File

@@ -0,0 +1 @@
export const filter=new Set(["au","aux","avec","ce","ces","dans","de","des","du","elle","en","et","eux","il","je","la","le","leur","lui","ma","mais","me","meme","mes","moi","mon","ne","nos","notre","nous","on","ou","par","pas","pour","qu","que","qui","sa","se","ses","son","sur","ta","te","tes","toi","ton","tu","un","une","vos","votre","vous","c","d","j","l","m","n","s","t","a","y","ete","etee","etees","etes","etant","suis","es","est","sommes","etes","sont","serai","seras","sera","serons","serez","seront","serais","serait","serions","seriez","seraient","etais","etait","etions","etiez","etaient","fus","fut","fumes","futes","furent","sois","soit","soyons","soyez","soient","fusse","fusses","fut","fussions","fussiez","fussent","ayant","eu","eue","eues","eus","ai","as","avons","avez","ont","aurai","auras","aura","aurons","aurez","auront","aurais","aurait","aurions","auriez","auraient","avais","avait","avions","aviez","avaient","eut","eumes","eutes","eurent","aie","aies","ait","ayons","ayez","aient","eusse","eusses","eut","eussions","eussiez","eussent","ceci","cela","cela","cet","cette","ici","ils","les","leurs","quel","quels","quelle","quelles","sans","soi"]);export const stemmer=new Map([["lement",""],["ient",""],["nera",""],["ment",""],["ais",""],["ait",""],["ant",""],["ent",""],["iez",""],["ion",""],["nez",""],["ai",""],["es",""],["er",""],["ez",""],["le",""],["na",""],["ne",""],["a",""],["e",""]]);export default{prepare:function(a){return a.replace(/´`ʼ/g,"'").replace(/_+/g," ").replace(/&/g," et ").replace(/€/g," EUR ").replace(/\bl'([^\b])/g,"la le $1").replace(/\bt'([^\b])/g,"ta te $1").replace(/\bc'([^\b])/g,"ca ce $1").replace(/\bd'([^\b])/g,"da de $1").replace(/\bj'([^\b])/g,"ja je $1").replace(/\bn'([^\b])/g,"na ne $1").replace(/\bm'([^\b])/g,"ma me $1").replace(/\bs'([^\b])/g,"sa se $1").replace(/\bau\b/g,"a le").replace(/\baux\b/g,"a les").replace(/\bdu\b/g,"de le").replace(/\bdes\b/g,"de les")},filter:filter,stemmer:stemmer};

View File

@@ -0,0 +1 @@
import Encoder from"../../encoder.js";import{soundex}from"./balance.js";export const matcher=new Map([["ai","ei"],["ae","a"],["oe","o"],["ue","u"],["sh","s"],["ch","c"],["th","t"],["ph","f"],["pf","f"]]);export const replacer=[/([^aeo])h([aeo$])/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2"];export default{normalize:!0,dedupe:!0,mapper:soundex,replacer:replacer,matcher:matcher};

1
dist/module-min/lang/latin/balance.js vendored Normal file
View File

@@ -0,0 +1 @@
import Encoder from"../../encoder.js";export const soundex=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"]]);export default{normalize:!0,dedupe:!0,mapper:soundex};

1
dist/module-min/lang/latin/default.js vendored Normal file
View File

@@ -0,0 +1 @@
import Encoder from"../../encoder.js";export default{normalize:function(a){return a.toLowerCase()},dedupe:!1};

1
dist/module-min/lang/latin/exact.js vendored Normal file
View File

@@ -0,0 +1 @@
export default{normalize:!1,dedupe:!1};

1
dist/module-min/lang/latin/extra.js vendored Normal file
View File

@@ -0,0 +1 @@
import Encoder from"../../encoder.js";import{soundex}from"./balance.js";import{matcher,replacer}from"./advanced.js";export const compact=[/(?!^)[aeoy]/g,""];export default{normalize:!0,dedupe:!0,mapper:soundex,replacer:replacer.concat(compact),matcher:matcher};

1
dist/module-min/lang/latin/simple.js vendored Normal file
View File

@@ -0,0 +1 @@
import Encoder from"../../encoder.js";export default{normalize:!0,dedupe:!0};

1
dist/module-min/lang/latin/soundex.js vendored Normal file
View File

@@ -0,0 +1 @@
export default{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let b=0;b<a.length;b++)a[b]=soundex(a[b])}};const codes={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,ß:2,d:3,t:3,l:4,m:5,n:5,r:6};function soundex(a){let b=a.charAt(0),c=codes[b];for(let d,e=1;e<a.length&&(d=a.charAt(e),!("h"!==d&&"w"!==d&&(d=codes[d],d&&d!==c&&(b+=d,c=d,4===b.length))));e++);return b}

1
dist/module-min/lang/us.js vendored Normal file
View File

@@ -0,0 +1 @@
export const filter=["a","about","above","after","again","against","all","also","am","an","and","any","are","aren't","as","at","be","because","been","before","being","below","both","but","by","can","cannot","can't","come","could","couldn't","did","didn't","do","does","doesn't","doing","dont","down","during","each","even","few","first","for","from","further","get","go","had","hadn't","has","hasn't","have","haven't","having","he","hed","her","here","here's","hers","herself","hes","him","himself","his","how","how's","i","id","if","ill","im","in","into","is","isn't","it","it's","itself","i've","just","know","let's","like","make","me","more","most","mustn't","my","myself","new","no","nor","not","now","of","off","on","once","only","or","other","ought","our","our's","ourselves","out","over","own","same","say","see","shan't","she","she'd","shell","shes","should","shouldn't","so","some","such","than","that","that's","the","their","theirs","them","themselves","then","there","there's","these","they","they'd","they'll","they're","they've","this","those","through","time","to","too","until","up","us","very","want","was","wasn't","way","we","wed","well","were","weren't","we've","what","what's","when","when's","where","where's","which","while","who","whom","who's","why","why's","will","with","won't","would","wouldn't","you","you'd","you'll","your","you're","your's","yourself","yourselves","you've"];export const stemmer={ational:"ate",iveness:"ive",fulness:"ful",ousness:"ous",ization:"ize",tional:"tion",biliti:"ble",icate:"ic",ative:"",alize:"al",iciti:"ic",entli:"ent",ousli:"ous",alism:"al",ation:"ate",aliti:"al",iviti:"ive",ement:"",enci:"ence",anci:"ance",izer:"ize",alli:"al",ator:"ate",logi:"log",ical:"ic",ance:"",ence:"",ness:"",able:"",ible:"",ment:"",eli:"e",bli:"ble",ful:"",ant:"",ent:"",ism:"",ate:"",iti:"",ous:"",ive:"",ize:"",al:"",ou:"",er:"",ic:""};export const matcher={};export default{filter:filter,stemmer:stemmer,matcher:matcher};

1
dist/module-min/preset.js vendored Normal file
View File

@@ -0,0 +1 @@
import{is_string}from"./common.js";import{IndexOptions}from"./type.js";const presets={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};export default function apply_preset(a){const b=is_string(a)?a:a.preset;return b&&(!1,a=Object.assign({},presets[b],a)),a}

1
dist/module-min/profiler.js vendored Normal file
View File

@@ -0,0 +1 @@
import{create_object}from"./common.js";const data=create_object();export default function tick(a){const b=data.profiler||(data.profiler={});b[a]||(b[a]=0),b[a]++}

1
dist/module-min/resolve/and.js vendored Normal file
View File

@@ -0,0 +1 @@
import Resolver from"../resolver.js";import default_resolver from"./default.js";import{create_object,get_max_len}from"../common.js";Resolver.prototype.and=function(){if(this.result.length){const a=this;let b=arguments,c=b[0];if(c instanceof Promise)return c.then(function(){return a.and.apply(a,b)});if(c[0]&&c[0].index)return this.and.apply(this,c);let d,e,f=[],g=[],h=0,i=0;for(let a,c=0;c<b.length;c++)if(a=b[c]){let b;if(a instanceof Resolver)b=a.result;else if(a.constructor===Array)b=a;else if(a.index)a.resolve=!1,b=a.index.search(a).result;else if(a.or)b=this.or(a.or);else if(a.xor)b=this.xor(a.xor);else if(a.not)b=this.not(a.not);else{h=a.limit||0,i=a.offset||0,d=a.enrich,e=a.resolve;continue}f[c]=b,b instanceof Promise&&g.push(b)}return g.length?Promise.all(g).then(function(){return f=[a.result].concat(f),a.result=intersect(f,h,i,d,e,a.boostval),e?a.result:a}):(f=[this.result].concat(f),this.result=intersect(f,h,i,d,e,a.boostval),e?this.result:this)}return this};function intersect(a,b,c,d,e,f){if(2>a.length)return[];let g=[],h=0,l=create_object(),m=get_max_len(a);if(!m)return g;for(let k,n=0;n<a.length;n++){if(k=a[n],!k||!k.length)return[];let d=create_object(),i=0,o=n===a.length-1;for(let a,p=0;p<m;p++)if(a=k[p],a)for(let j,m,q=0;q<a.length;q++)if(j=a[q],!n)d[j]=p+1+(n?f:0),i=1;else if(!o)(m=l[j])&&(p+1<m&&(m=p+1),d[j]=m,i=1);else if(m=l[j]){if(i=1,c){c--;continue}if(e?g.push(j):(m--,p<m&&(m=p),g[m]||(g[m]=[]),g[m].push(j)),b&&++h===b)return g}if(!i)return[];l=d}return g}

1
dist/module-min/resolve/default.js vendored Normal file
View File

@@ -0,0 +1 @@
import{concat}from"../common.js";export default function(a,b,c,d){if(1===a.length)return a=a[0],a=c||a.length>b?b?a.slice(c,c+b):a.slice(c):a,d?enrich_result(a):a;let e=[];for(let f,g,h=0;h<a.length;h++)if((f=a[h])&&(g=f.length)){if(c){if(c>=g){c-=g;continue}c<g&&(f=b?f.slice(c,c+b):f.slice(c),g=f.length,c=0)}if(!e.length){if(g>=b)return g>b&&(f=f.slice(0,b)),d?enrich_result(f):f;e=[f]}else g>b&&(f=f.slice(0,b),g=f.length),e.push(f);if(b-=g,!b)break}return e.length?(e=1<e.length?concat(e):e[0],d?enrich_result(e):e):e}function enrich_result(a){for(let b=0;b<a.length;b++)a[b]={score:b,id:a[b]};return a}

1
dist/module-min/resolve/not.js vendored Normal file
View File

@@ -0,0 +1 @@
import Resolver from"../resolver.js";import default_resolver from"./default.js";import{create_object}from"../common.js";Resolver.prototype.not=function(){const a=this;let b=arguments,c=b[0];if(c instanceof Promise)return c.then(function(){return a.not.apply(a,b)});if(c[0]&&c[0].index)return this.not.apply(this,c);let d,e,f=[],g=[],h=0,i=0;for(let a,c=0;c<b.length;c++)if(a=b[c]){let b;if(a instanceof Resolver)b=a.result;else if(a.constructor===Array)b=a;else if(a.index)a.resolve=!1,b=a.index.search(a).result;else if(a.or)b=this.or(a.or);else if(a.and)b=this.and(a.and);else if(a.xor)b=this.xor(a.xor);else{h=a.limit||0,i=a.offset||0,d=a.enrich,e=a.resolve;continue}f[c]=b,b instanceof Promise&&g.push(b)}return g.length?Promise.all(g).then(function(){return a.result=exclusion.call(a,f,h,i,e),e?a.result:a}):(this.result=exclusion.call(this,f,h,i,e),e?this.result:this)};function exclusion(a,b,c,d){if(!a.length)return this.result;const e=[],f=new Set(a.flat().flat());for(let g,h=0;h<this.result.length;h++)if(g=this.result[h],g)for(let a,b=0;b<g.length;b++)a=g[b],f.has(a)||(d?e.push(a):(e[h]||(e[h]=[]),e[h].push(a)));return e}

1
dist/module-min/resolve/or.js vendored Normal file
View File

@@ -0,0 +1 @@
import Resolver from"../resolver.js";import default_resolver from"./default.js";import{create_object,get_max_len}from"../common.js";Resolver.prototype.or=function(){const a=this;let b=arguments,c=b[0];if(c instanceof Promise)return c.then(function(){return a.or.apply(a,b)});if(c[0]&&c[0].index)return this.or.apply(this,c);let d,e,f=[],g=[],h=0,i=0;for(let a,c=0;c<b.length;c++)if(a=b[c]){let b;if(a instanceof Resolver)b=a.result;else if(a.constructor===Array)b=a;else if(a.index)a.resolve=!1,b=a.index.search(a).result;else if(a.and)b=this.and(a.and);else if(a.xor)b=this.xor(a.xor);else if(a.not)b=this.not(a.not);else{h=a.limit||0,i=a.offset||0,d=a.enrich,e=a.resolve;continue}f[c]=b,b instanceof Promise&&g.push(b)}return g.length?Promise.all(g).then(function(){return a.result.length&&(f=[a.result].concat(f)),a.result=resolver(f,h,i,d,e,a.boostval),e?a.result:a}):(this.result.length&&(f=[this.result].concat(f)),this.result=resolver(f,h,i,d,e,a.boostval),e?this.result:this)};function resolver(a,b,c,d,e,f){if(!a.length)return a;if("object"==typeof b&&(c=b.offset||0,d=b.enrich||!1,b=b.limit||0),2>a.length)return e?default_resolver(a[0],b,c,d):a[0];let g=[],h=0,l=create_object(),m=get_max_len(a);for(let n,o=0;o<m;o++)for(let d,j=0;j<a.length;j++)if(d=a[j],d&&(n=d[o],n))for(let a,d=0;d<n.length;d++)if(a=n[d],!l[a]){if(l[a]=1,c){c--;continue}if(e)g.push(a);else{const b=o+(j?f:0);g[b]||(g[b]=[]),g[b].push(a)}if(b&&++h===b)return g}return g}

1
dist/module-min/resolve/xor.js vendored Normal file
View File

@@ -0,0 +1 @@
import Resolver from"../resolver.js";import default_resolver from"./default.js";import{create_object}from"../common.js";Resolver.prototype.xor=function(){const a=this;let b=arguments,c=b[0];if(c instanceof Promise)return c.then(function(){return a.xor.apply(a,b)});if(c[0]&&c[0].index)return this.xor.apply(this,c);let d,e,f=[],g=[],h=0,i=0;for(let a,c=0;c<b.length;c++)if(a=b[c]){let b;if(a instanceof Resolver)b=a.result;else if(a.constructor===Array)b=a;else if(a.index)a.resolve=!1,b=a.index.search(a).result;else if(a.or)b=this.or(a.or);else if(a.and)b=this.and(a.and);else if(a.not)b=this.not(a.not);else{h=a.limit||0,i=a.offset||0,d=a.enrich,e=a.resolve;continue}f[c]=b,b instanceof Promise&&g.push(b)}return g.length?Promise.all(g).then(function(){return a.result.length&&(f=[a.result].concat(f)),a.result=exclusive(f,h,i,d,!e,a.boostval),e?a.result:a}):(this.result.length&&(f=[this.result].concat(f)),this.result=exclusive(f,h,i,d,!e,a.boostval),e?this.result:this)};function exclusive(a,b,c,d,e,f){if(!a.length)return a;if(2>a.length)return e?default_resolver(a[0],b,c,d):a[0];const g=[],h=create_object();for(let g,j=0;j<a.length;j++)if(g=a[j],g)for(let a,b=0;b<g.length;b++)if(a=g[b],a)for(let b,c=0;c<a.length;c++)b=a[c],h[b]?h[b]++:h[b]=1;for(let k,l=0;l<a.length;l++)if(k=a[l],k)for(let a,b=0;b<k.length;b++)if(a=k[b],a)for(let c,d=0;d<a.length;d++)if(c=a[d],1===h[c])if(e)g.push(c);else{const a=b+(l?f:0);g[a]||(g[a]=[]),g[a].push(c)}return g}

1
dist/module-min/resolver.js vendored Normal file
View File

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

1
dist/module-min/serialize.js vendored Normal file
View File

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

1
dist/module-min/type.js vendored Normal file
View File

@@ -0,0 +1 @@
import Encoder from"./encoder.js";import StorageInterface from"./db/interface.js";export let IndexOptions;export let DocumentOptions;export let ContextOptions;export let DocumentDescriptor;export let FieldOptions;export let TagOptions;export let StoreOptions;export let SearchOptions;export let DocumentSearchOptions;export let EncoderOptions;export let ResolverOptions;

1
dist/module-min/webpack.js vendored Normal file
View File

@@ -0,0 +1 @@
import{SearchOptions,ContextOptions,DocumentDescriptor,DocumentSearchOptions,FieldOptions,IndexOptions,DocumentOptions}from"./type.js";import Document from"./document.js";import Index from"./index.js";import WorkerIndex from"./worker/index.js";import Resolver from"./resolver.js";import Encoder from"./encoder.js";import IdxDB from"./db/indexeddb/index.js";import{global_charset}from"./charset.js";import charset_exact from"./lang/latin/exact.js";import charset_default from"./lang/latin/default.js";import charset_simple from"./lang/latin/simple.js";import charset_balance from"./lang/latin/balance.js";import charset_advanced from"./lang/latin/advanced.js";import charset_extra from"./lang/latin/extra.js";import charset_soundex from"./lang/latin/soundex.js";Index.prototype.add,Index.prototype.append,Index.prototype.search,Index.prototype.update,Index.prototype.remove,Index.prototype.contain,Index.prototype.clear,Index.prototype.cleanup,Document.prototype.add,Document.prototype.append,Document.prototype.search,Document.prototype.update,Document.prototype.remove,Document.prototype.contain,Document.prototype.clear,Document.prototype.cleanup,Document.prototype.get,Document.prototype.set,Index.prototype.searchCache,Document.prototype.searchCache,Index.prototype.addAsync,Index.prototype.appendAsync,Index.prototype.searchAsync,Index.prototype.updateAsync,Index.prototype.removeAsync,Document.prototype.addAsync,Document.prototype.appendAsync,Document.prototype.searchAsync,Document.prototype.updateAsync,Document.prototype.removeAsync,Index.prototype.export,Index.prototype.import,Document.prototype.export,Document.prototype.import,Index.prototype.mount,Index.prototype.commit,Index.db,Document.prototype.mount,Document.prototype.commit,Document.db,IndexOptions.preset,IndexOptions.context,IndexOptions.encoder,IndexOptions.encode,IndexOptions.resolution,IndexOptions.tokenize,IndexOptions.fastupdate,IndexOptions.score,IndexOptions.keystore,IndexOptions.rtl,IndexOptions.cache,IndexOptions.resolve,IndexOptions.db,DocumentOptions.context,DocumentOptions.encoder,DocumentOptions.encode,DocumentOptions.resolution,DocumentOptions.tokenize,DocumentOptions.fastupdate,DocumentOptions.score,DocumentOptions.keystore,DocumentOptions.rtl,DocumentOptions.cache,DocumentOptions.db,DocumentOptions.doc,DocumentOptions.document,DocumentOptions.worker,DocumentDescriptor.field,DocumentDescriptor.index,DocumentDescriptor.tag,DocumentDescriptor.store,ContextOptions.depth,ContextOptions.bidirectional,ContextOptions.resolution,SearchOptions.query,SearchOptions.limit,SearchOptions.offset,SearchOptions.context,SearchOptions.suggest,SearchOptions.resolve,SearchOptions.enrich,SearchOptions.tag,DocumentSearchOptions.query,DocumentSearchOptions.limit,DocumentSearchOptions.offset,DocumentSearchOptions.context,DocumentSearchOptions.suggest,DocumentSearchOptions.enrich,DocumentSearchOptions.tag,DocumentSearchOptions.field,DocumentSearchOptions.index,DocumentSearchOptions.pluck,DocumentSearchOptions.merge,global_charset["latin:exact"]=charset_exact,global_charset["latin:default"]=charset_default,global_charset["latin:simple"]=charset_simple,global_charset["latin:balance"]=charset_balance,global_charset["latin:advanced"]=charset_advanced,global_charset["latin:extra"]=charset_extra,global_charset["latin:soundex"]=charset_soundex;const FlexSearch={Index:Index,Charset:global_charset,Encoder:Encoder,Document:Document,Worker:WorkerIndex,Resolver:Resolver,IndexedDB:IdxDB};{const a=self;let b;(b=a.define)&&b.amd?b([],function(){return FlexSearch}):"object"==typeof a.exports?a.exports=FlexSearch:a.FlexSearch=FlexSearch}

1
dist/module-min/worker/handler.js vendored Normal file
View File

@@ -0,0 +1 @@
import Index from"../index.js";import{IndexOptions}from"../type.js";export default(async function(a){a=a.data;const b=self._index,c=a.args,d=a.task;switch(d){case"init":let e=a.options||{},f=e.config;f&&(e=f);const g=a.factory;g?(Function("return "+g)()(self),self._index=new self.FlexSearch.Index(e),delete self.FlexSearch):self._index=new Index(e),postMessage({id:a.id});break;default:const h=a.id,i=b[d].apply(b,c);postMessage("search"===d?{id:h,msg:i}:{id:h});}});

1
dist/module-min/worker/index.js vendored Normal file
View File

@@ -0,0 +1 @@
import{IndexOptions}from"../type.js";import{create_object,is_function,is_object,is_string}from"../common.js";import handler from"./handler.js";let pid=0;function WorkerIndex(a){function b(a){a=a.data||a;const b=a.id,c=b&&e.resolver[b];c&&(c(a.msg),delete e.resolver[b])}if(!(this instanceof WorkerIndex))return new WorkerIndex(a);a||(a={});let c=(self||window)._factory;c&&(c=c.toString());const d="undefined"==typeof window&&self.exports,e=this;if(this.worker=create(c,d,a.worker),this.resolver=create_object(),!!this.worker)return d?this.worker.on("message",b):this.worker.onmessage=b,a.config?new Promise(function(b){e.resolver[++pid]=function(){b(e)},e.worker.postMessage({id:pid,task:"init",factory:c,options:a})}):void this.worker.postMessage({task:"init",factory:c,options:a})}export default WorkerIndex;register("add"),register("append"),register("search"),register("update"),register("remove");function register(a){WorkerIndex.prototype[a]=WorkerIndex.prototype[a+"Async"]=function(){const b=this,c=[].slice.call(arguments),d=c[c.length-1];let e;is_function(d)&&(e=d,c.splice(c.length-1,1));const f=new Promise(function(d){b.resolver[++pid]=d,b.worker.postMessage({task:a,id:pid,args:c})});return e?(f.then(e),this):f}}function create(a,b,c){let d;return d=b?(0,eval)("new (require(\"worker_threads\")[\"Worker\"])(__dirname + \"/node/node.js\")"):a?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+handler.toString()],{type:"text/javascript"}))):new window.Worker(is_string(c)?c:"worker/worker.js",{type:"module"}),d}

1
dist/module-min/worker/node.js vendored Normal file
View File

@@ -0,0 +1 @@
const{parentPort}=require("worker_threads"),{join}=require("path"),{Index}=require("../flexsearch.bundle.min.js");let index;parentPort.on("message",function(a){const b=a.args,c=a.task,d=a.id;switch(c){case"init":let e=a.options||{},f=e.config;if(f&&"/"!==f[0]&&"\\"!==f[0]){const a=process.cwd();f=join(a,f)}f&&(e=require(f)),index=new Index(e);break;default:const g=index[c].apply(index,b);parentPort.postMessage("search"===c?{id:d,msg:g}:{id:d});}});

1
dist/module-min/worker/worker.js vendored Normal file
View File

@@ -0,0 +1 @@
import handler from"./handler.js";onmessage=handler;

View File

@@ -1,6 +1,6 @@
import { create_object } from "./common.js"; import { create_object } from "./common.js";
export const global_lang = create_object(); // export const global_lang = create_object();
export const global_charset = create_object(); export const global_charset = create_object();
/** /**
@@ -17,6 +17,6 @@ export function registerCharset(name, charset) {
* @param {Object} lang * @param {Object} lang
*/ */
export function registerLanguage(name, lang) { // export function registerLanguage(name, lang){
global_lang[name] = lang; // global_lang[name] = lang;
} // }

View File

@@ -39,11 +39,12 @@ export default function Document(options) {
keystore = options.keystore || 0; keystore = options.keystore || 0;
keystore && (this.keystore = keystore); keystore && (this.keystore = keystore);
this.fastupdate = !!options.fastupdate; this.fastupdate = !!options.fastupdate;
this.reg = this.fastupdate ? keystore ? new KeystoreMap(keystore) : new Map() : keystore ? new KeystoreSet(keystore) : new Set(); this.reg = this.fastupdate ? keystore && /* tag? */ /* stringify */ /* stringify */ /* skip update: */ /* append: */ /* skip update: */ /* skip_update: */ /* skip deletion */!0
/*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/ ? new KeystoreMap(keystore) : new Map() : keystore && !0 ? new KeystoreSet(keystore) : new Set();
// todo support custom filter function // todo support custom filter function
this.storetree = (tmp = document.store || null) && /* tag? */ /* stringify */ /* stringify */ /* skip update: */ /* append: */ /* skip update: */ /* skip_update: */ /* skip deletion */!0 /*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/ !== tmp && []; this.storetree = (tmp = document.store || null) && !0 !== tmp && [];
this.store = tmp && (keystore ? new KeystoreMap(keystore) : new Map()); this.store = tmp && (keystore && !0 ? new KeystoreMap(keystore) : new Map());
this.cache = (tmp = options.cache || null) && new Cache(tmp); this.cache = (tmp = options.cache || null) && new Cache(tmp);
// do not apply cache again for the indexes since .searchCache() // do not apply cache again for the indexes since .searchCache()

View File

@@ -43,7 +43,7 @@ const whitespace = /[^\p{L}\p{N}]+/u,
numeric_split_prev_char = /(\D)(\d{3})/g, numeric_split_prev_char = /(\D)(\d{3})/g,
numeric_split_next_char = /(\d{3})(\D)/g, numeric_split_next_char = /(\d{3})(\D)/g,
normalize = /[\u0300-\u036f]/g, normalize = /[\u0300-\u036f]/g,
normalize_mapper = !normalize && new Map([ normalize_mapper = !normalize && [
// Charset Normalization // Charset Normalization
@@ -71,7 +71,7 @@ const whitespace = /[^\p{L}\p{N}]+/u,
// ["|", " "], // ["|", " "],
// ["/", " "], // ["/", " "],
// ["\\", " "] // ["\\", " "]
]); // /[\p{Z}\p{S}\p{P}\p{C}]+/u; ]; // /[\p{Z}\p{S}\p{P}\p{C}]+/u;
//const numeric_split = /(\d{3})/g; //const numeric_split = /(\d{3})/g;
//.replace(/(\d{3})/g, "$1 ") //.replace(/(\d{3})/g, "$1 ")
@@ -183,9 +183,16 @@ Encoder.prototype.assign = function (options) {
*/ */
this.finalize = /** @type {Function|null} */parse_option(options.finalize, null, this.finalize); this.finalize = /** @type {Function|null} */parse_option(options.finalize, null, this.finalize);
// move the normalization fallback to the mapper
if (normalize_mapper) {
this.mapper = new Map(
/** @type {Array<Array<string, string>>} */normalize_mapper);
}
// options // options
this.rtl = options.rtl || /* suggest */ /* append: */ /* enrich */!1; this.rtl = options.rtl ||
/* suggest */ /* append: */ /* enrich */!1;
this.dedupe = parse_option(options.dedupe, !0, this.dedupe); this.dedupe = parse_option(options.dedupe, !0, this.dedupe);
this.filter = parse_option((tmp = options.filter) && new Set(tmp), null, this.filter); this.filter = parse_option((tmp = options.filter) && new Set(tmp), null, this.filter);
this.matcher = parse_option((tmp = options.matcher) && new Map(tmp), null, this.matcher); this.matcher = parse_option((tmp = options.matcher) && new Map(tmp), null, this.matcher);
@@ -333,10 +340,12 @@ Encoder.prototype.encode = function (str) {
str = str.normalize("NFKD").replace(normalize, "").toLowerCase(); str = str.normalize("NFKD").replace(normalize, "").toLowerCase();
} else { } else {
str = str.toLowerCase(); str = str.toLowerCase();
// if(SUPPORT_CHARSET){
this.mapper = this.mapper // this.mapper = this.mapper
// todo replace spread // // todo replace spread
? new Map([... /** @type {!Iterable} */normalize_mapper, ...this.mapper]) : new Map( /** @type {Map<string,string>} */normalize_mapper); // ? new Map([.../** @type {!Iterable} */(normalize_mapper), ...this.mapper])
// : new Map(/** @type {Map<string,string>} */ (normalize_mapper));
// }
} }
//if(!str) return str; //if(!str) return str;
} }

34
dist/module/index.js vendored
View File

@@ -12,7 +12,6 @@ import Cache, { searchCache } from "./cache.js";
import { KeystoreMap, KeystoreSet } from "./keystore.js"; import { KeystoreMap, KeystoreSet } from "./keystore.js";
import { is_array, is_string } from "./common.js"; import { is_array, is_string } from "./common.js";
import { exportIndex, importIndex } from "./serialize.js"; import { exportIndex, importIndex } from "./serialize.js";
import { global_lang, global_charset } from "./global.js";
import default_encoder from "./lang/latin/default.js"; import default_encoder from "./lang/latin/default.js";
import apply_preset from "./preset.js"; import apply_preset from "./preset.js";
import apply_async from "./async.js"; import apply_async from "./async.js";
@@ -33,30 +32,7 @@ export default function Index(options, _register) {
return new Index(options); return new Index(options);
} }
if (options) { options = options ? apply_preset(options) : {};
options = apply_preset(options);
// charset = options.charset;
// // lang = options.lang;
//
// if(is_string(charset)){
//
// if(!charset.includes(":")){
// charset += ":default";
// }
//
// charset = global_charset[charset];
// }
// if(is_string(lang)){
//
// lang = global_lang[lang];
// }
} else {
options = {};
}
// let charset, lang, tmp;
const context = options.context || {}, const context = options.context || {},
encoder = options.encode || options.encoder || default_encoder; encoder = options.encode || options.encoder || default_encoder;
@@ -77,9 +53,9 @@ export default function Index(options, _register) {
tmp = options.keystore || 0; tmp = options.keystore || 0;
tmp && (this.keystore = tmp); tmp && (this.keystore = tmp);
this.map = tmp ? new KeystoreMap(tmp) : new Map(); this.map = tmp && /* tag? */ /* stringify */ /* stringify */ /* skip update: */ /* append: */ /* skip update: */ /* skip_update: */ /* skip deletion */!0 /*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/ ? new KeystoreMap(tmp) : new Map();
this.ctx = tmp ? new KeystoreMap(tmp) : new Map(); this.ctx = tmp && !0 ? new KeystoreMap(tmp) : new Map();
this.reg = _register || (this.fastupdate ? tmp ? new KeystoreMap(tmp) : new Map() : tmp ? new KeystoreSet(tmp) : new Set()); this.reg = _register || (this.fastupdate ? tmp && !0 ? new KeystoreMap(tmp) : new Map() : tmp && !0 ? new KeystoreSet(tmp) : new Set());
this.resolution_ctx = context.resolution || 1; this.resolution_ctx = context.resolution || 1;
this.rtl = encoder.rtl || options.rtl || !1; this.rtl = encoder.rtl || options.rtl || !1;
@@ -146,7 +122,7 @@ Index.prototype.clear = function () {
if (this.db) { if (this.db) {
this.commit_timer && clearTimeout(this.commit_timer); this.commit_timer && clearTimeout(this.commit_timer);
this.commit_timer = null; this.commit_timer = null;
this.commit_task = [{ clear: /* tag? */ /* stringify */ /* stringify */ /* skip update: */ /* append: */ /* skip update: */ /* skip_update: */ /* skip deletion */!0 /*await rows.hasNext()*/ /*await rows.hasNext()*/ /*await rows.hasNext()*/ }]; this.commit_task = [{ clear: !0 }];
//return this.db.clear(); //return this.db.clear();
} }

15
dist/module/profiler.js vendored Normal file
View File

@@ -0,0 +1,15 @@
import { create_object } from "./common.js";
const data = create_object();
/**
* @param {!string} name
*/
export default function tick(name) {
/** @type {!Object<string, number>} */
const profiler = data.profiler || (data.profiler = {});
profiler[name] || (profiler[name] = 0);
profiler[name]++;
}

View File

@@ -6,7 +6,7 @@ import WorkerIndex from "./worker/index.js";
import Resolver from "./resolver.js"; import Resolver from "./resolver.js";
import Encoder from "./encoder.js"; import Encoder from "./encoder.js";
import IdxDB from "./db/indexeddb/index.js"; import IdxDB from "./db/indexeddb/index.js";
import { global_charset, global_lang } from "./global.js"; import { global_charset } from "./charset.js";
import charset_exact from "./lang/latin/exact.js"; import charset_exact from "./lang/latin/exact.js";
import charset_default from "./lang/latin/default.js"; import charset_default from "./lang/latin/default.js";
import charset_simple from "./lang/latin/simple.js"; import charset_simple from "./lang/latin/simple.js";
@@ -136,9 +136,8 @@ global_charset["latin:soundex"] = charset_soundex;
const FlexSearch = { const FlexSearch = {
Index: Index, Index: Index,
Encoder: Encoder,
Charset: global_charset, Charset: global_charset,
Language: global_lang, Encoder: Encoder,
Document: Document, Document: Document,
Worker: WorkerIndex, Worker: WorkerIndex,
Resolver: Resolver, Resolver: Resolver,

View File

@@ -23,7 +23,7 @@ parentPort.on("message", function (data) {
// load extern field configuration // load extern field configuration
if ("/" !== filepath[0] && "\\" !== filepath[0]) { if (filepath && "/" !== filepath[0] && "\\" !== filepath[0]) {
// current working directory // current working directory
const dir = process.cwd(); const dir = process.cwd();
filepath = join(dir, filepath); filepath = join(dir, filepath);

View File

@@ -38,26 +38,26 @@
"types": "./index.d.ts", "types": "./index.d.ts",
"scripts": { "scripts": {
"build": "npm run build:bundle && npm run build:bundle:debug", "build": "npm run build:bundle && npm run build:bundle:debug",
"build:bundle": "node task/build RELEASE=bundle DEBUG=false PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=true SUPPORT_RESOLVER=true SUPPORT_KEYSTORE=true SUPPORT_COMPRESSION=false", "build:bundle": "node task/build RELEASE=bundle DEBUG=false PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=true SUPPORT_RESOLVER=true SUPPORT_KEYSTORE=true SUPPORT_COMPRESSION=false",
"build:bundle:debug": "node task/build RELEASE=bundle DEBUG=true PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=true SUPPORT_RESOLVER=true SUPPORT_KEYSTORE=true SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT", "build:bundle:debug": "node task/build RELEASE=bundle DEBUG=true PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=true SUPPORT_RESOLVER=true SUPPORT_KEYSTORE=true SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT",
"build:compact": "node task/build RELEASE=compact DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false", "build:compact": "node task/build RELEASE=compact DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false",
"build:compact:debug": "node task/build RELEASE=compact DEBUG=true PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT", "build:compact:debug": "node task/build RELEASE=compact DEBUG=true PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT",
"build:light": "node task/build RELEASE=light DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=false SUPPORT_CACHE=true SUPPORT_ASYNC=false SUPPORT_STORE=false SUPPORT_TAGS=false SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=false SUPPORT_DOCUMENT=false POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false", "build:light": "node task/build RELEASE=light DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CHARSET=false SUPPORT_CACHE=true SUPPORT_ASYNC=false SUPPORT_STORE=false SUPPORT_TAGS=false SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=false SUPPORT_DOCUMENT=false POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false",
"build:light:debug": "node task/build RELEASE=light DEBUG=true PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=false SUPPORT_CACHE=true SUPPORT_ASYNC=false SUPPORT_STORE=false SUPPORT_TAGS=false SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=false SUPPORT_DOCUMENT=false POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT", "build:light:debug": "node task/build RELEASE=light DEBUG=true PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CHARSET=false SUPPORT_CACHE=true SUPPORT_ASYNC=false SUPPORT_STORE=false SUPPORT_TAGS=false SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=false SUPPORT_DOCUMENT=false POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT",
"build:custom": "node task/build RELEASE=custom", "build:custom": "node task/build RELEASE=custom",
"build:es5": "node task/build RELEASE=es5 DEBUG=false PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=true SUPPORT_PERSISTENT=true SUPPORT_RESOLVER=true SUPPORT_KEYSTORE=true SUPPORT_COMPRESSION=false LANGUAGE_OUT=ECMASCRIPT5_STRICT", "build:es5": "node task/build RELEASE=es5 DEBUG=false PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=true SUPPORT_PERSISTENT=true SUPPORT_RESOLVER=true SUPPORT_KEYSTORE=true SUPPORT_COMPRESSION=false LANGUAGE_OUT=ECMASCRIPT5_STRICT",
"build:es5:debug": "node task/build RELEASE=es5 DEBUG=true PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=true SUPPORT_PERSISTENT=true SUPPORT_RESOLVER=true SUPPORT_KEYSTORE=true SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT LANGUAGE_OUT=ECMASCRIPT5_STRICT", "build:es5:debug": "node task/build RELEASE=es5 DEBUG=true PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=true SUPPORT_PERSISTENT=true SUPPORT_RESOLVER=true SUPPORT_KEYSTORE=true SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT LANGUAGE_OUT=ECMASCRIPT5_STRICT",
"build:lang": "node task/build RELEASE=lang", "build:lang": "node task/build RELEASE=lang",
"build:module": "node task/babel && exit 0", "build:module": "node task/babel && exit 0",
"build:module:debug": "node task/babel DEBUG=true && exit 0", "build:module:debug": "node task/babel DEBUG=true && exit 0",
"build:module:min": "node task/babel RELEASE=min && exit 0", "build:module:min": "node task/babel RELEASE=min && exit 0",
"build:module:bundle": "node task/build RELEASE=bundle.module DEBUG=false PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=true SUPPORT_RESOLVER=true SUPPORT_KEYSTORE=true SUPPORT_COMPRESSION=false", "build:module:bundle": "node task/build RELEASE=bundle.module DEBUG=false PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=true SUPPORT_RESOLVER=true SUPPORT_KEYSTORE=true SUPPORT_COMPRESSION=false",
"build:module:bundle:debug": "node task/build RELEASE=bundle.module DEBUG=true PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=true SUPPORT_RESOLVER=true SUPPORT_KEYSTORE=true SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT", "build:module:bundle:debug": "node task/build RELEASE=bundle.module DEBUG=true PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=true SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=true SUPPORT_RESOLVER=true SUPPORT_KEYSTORE=true SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT",
"build:module:compact": "node task/build RELEASE=compact.module DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CACHE=false SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=false SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false", "build:module:compact": "node task/build RELEASE=compact.module DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CHARSET=true SUPPORT_CACHE=false SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=false SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false",
"build:module:compact:debug": "node task/build RELEASE=compact.module DEBUG=true PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CACHE=false SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=false SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT", "build:module:compact:debug": "node task/build RELEASE=compact.module DEBUG=true PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CHARSET=true SUPPORT_CACHE=false SUPPORT_ASYNC=true SUPPORT_STORE=true SUPPORT_TAGS=false SUPPORT_SUGGESTION=true SUPPORT_SERIALIZE=true SUPPORT_DOCUMENT=true POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT",
"build:module:light": "node task/build RELEASE=light.module DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=false SUPPORT_CACHE=true SUPPORT_ASYNC=false SUPPORT_STORE=false SUPPORT_TAGS=false SUPPORT_SUGGESTION=false SUPPORT_SERIALIZE=false SUPPORT_DOCUMENT=false POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false", "build:module:light": "node task/build RELEASE=light.module DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=false SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=false SUPPORT_STORE=false SUPPORT_TAGS=false SUPPORT_SUGGESTION=false SUPPORT_SERIALIZE=false SUPPORT_DOCUMENT=false POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false",
"build:module:light:debug": "node task/build RELEASE=light.module DEBUG=true PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=false SUPPORT_CACHE=true SUPPORT_ASYNC=false SUPPORT_STORE=false SUPPORT_TAGS=false SUPPORT_SUGGESTION=false SUPPORT_SERIALIZE=false SUPPORT_DOCUMENT=false POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT", "build:module:light:debug": "node task/build RELEASE=light.module DEBUG=true PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=false SUPPORT_CHARSET=true SUPPORT_CACHE=true SUPPORT_ASYNC=false SUPPORT_STORE=false SUPPORT_TAGS=false SUPPORT_SUGGESTION=false SUPPORT_SERIALIZE=false SUPPORT_DOCUMENT=false POLYFILL=false SUPPORT_PERSISTENT=false SUPPORT_RESOLVER=false SUPPORT_KEYSTORE=false SUPPORT_COMPRESSION=false FORMATTING=PRETTY_PRINT",
"build:all": "npm version --no-git-tag-version patch && npm run build:bundle && npm run build:bundle:debug && npm run build:light && npm run build:light:debug && npm run build:compact && npm run build:compact:debug && npm run build:module && npm run build:module:debug && npm run build:module:min && npm run build:module:bundle && npm run build:module:bundle:debug && npm run build:module:light && npm run build:module:light:debug && npm run build:module:compact && npm run build:module:compact:debug && npm run build:es5 && npm run build:es5:debug", "build:all": "npm run build:bundle && npm run build:bundle:debug && npm run build:light && npm run build:light:debug && npm run build:compact && npm run build:compact:debug && npm run build:module && npm run build:module:debug && npm run build:module:min && npm run build:module:bundle && npm run build:module:bundle:debug && npm run build:module:light && npm run build:module:light:debug && npm run build:module:compact && npm run build:module:compact:debug && npm run build:es5 && npm run build:es5:debug",
"test": "cd test && npm install && npm run test" "test": "cd test && npm install && npm run test"
}, },
"files": [ "files": [

View File

@@ -1,6 +1,6 @@
import { create_object } from "./common.js"; import { create_object } from "./common.js";
export const global_lang = create_object(); // export const global_lang = create_object();
export const global_charset = create_object(); export const global_charset = create_object();
/** /**
@@ -17,6 +17,6 @@ export function registerCharset(name, charset){
* @param {Object} lang * @param {Object} lang
*/ */
export function registerLanguage(name, lang){ // export function registerLanguage(name, lang){
global_lang[name] = lang; // global_lang[name] = lang;
} // }

View File

@@ -16,6 +16,9 @@ export const SUPPORT_WORKER = true;
/** @define {boolean|string} */ /** @define {boolean|string} */
export const SUPPORT_ENCODER = true; export const SUPPORT_ENCODER = true;
/** @define {boolean|string} */
export const SUPPORT_CHARSET = true;
/** @define {boolean} */ /** @define {boolean} */
export const SUPPORT_CACHE = true; export const SUPPORT_CACHE = true;

View File

@@ -54,14 +54,14 @@ export default function Document(options){
keystore && (this.keystore = keystore); keystore && (this.keystore = keystore);
this.fastupdate = !!options.fastupdate; this.fastupdate = !!options.fastupdate;
this.reg = this.fastupdate this.reg = this.fastupdate
? (keystore ? new KeystoreMap(keystore) : new Map()) ? (keystore && SUPPORT_KEYSTORE ? new KeystoreMap(keystore) : new Map())
: (keystore ? new KeystoreSet(keystore) : new Set()); : (keystore && SUPPORT_KEYSTORE ? new KeystoreSet(keystore) : new Set());
if(SUPPORT_STORE){ if(SUPPORT_STORE){
// todo support custom filter function // todo support custom filter function
this.storetree = (tmp = document.store || null) && tmp !== true && []; this.storetree = (tmp = document.store || null) && tmp !== true && [];
this.store = tmp && ( this.store = tmp && (
keystore keystore && SUPPORT_KEYSTORE
? new KeystoreMap(keystore) ? new KeystoreMap(keystore)
: new Map() : new Map()
); );

View File

@@ -1,6 +1,7 @@
// COMPILER BLOCK --> // COMPILER BLOCK -->
import { import {
SUPPORT_CACHE, SUPPORT_CACHE,
SUPPORT_CHARSET,
SUPPORT_COMPRESSION, SUPPORT_COMPRESSION,
SUPPORT_ENCODER SUPPORT_ENCODER
} from "./config.js"; } from "./config.js";
@@ -53,7 +54,7 @@ const numeric_split_next_char = /(\d{3})(\D)/g;
//.replace(/([^\d])([\d])/g, "$1 $2") //.replace(/([^\d])([\d])/g, "$1 $2")
//.replace(/([\d])([^\d])/g, "$1 $2") //.replace(/([\d])([^\d])/g, "$1 $2")
const normalize = "".normalize && /[\u0300-\u036f]/g; // '´`ʼ., const normalize = "".normalize && /[\u0300-\u036f]/g; // '´`ʼ.,
const normalize_mapper = SUPPORT_ENCODER && !normalize && new Map([ const normalize_mapper = SUPPORT_CHARSET && !normalize && [
// Charset Normalization // Charset Normalization
@@ -285,7 +286,7 @@ const normalize_mapper = SUPPORT_ENCODER && !normalize && new Map([
// ["|", " "], // ["|", " "],
// ["/", " "], // ["/", " "],
// ["\\", " "] // ["\\", " "]
]); ];
/** /**
* @param options * @param options
@@ -398,6 +399,15 @@ Encoder.prototype.assign = function(options){
parse_option(options.finalize, null, this.finalize) parse_option(options.finalize, null, this.finalize)
); );
// move the normalization fallback to the mapper
if(normalize_mapper){
this.mapper = new Map(
/** @type {Array<Array<string, string>>} */ (
normalize_mapper
)
);
}
// options // options
this.rtl = options.rtl || false; this.rtl = options.rtl || false;
@@ -554,12 +564,12 @@ Encoder.prototype.encode = function(str){
} }
else{ else{
str = str.toLowerCase(); str = str.toLowerCase();
if(SUPPORT_ENCODER){ // if(SUPPORT_CHARSET){
this.mapper = this.mapper // this.mapper = this.mapper
// todo replace spread // // todo replace spread
? new Map([.../** @type {!Iterable} */(normalize_mapper), ...this.mapper]) // ? new Map([.../** @type {!Iterable} */(normalize_mapper), ...this.mapper])
: new Map(/** @type {Map<string,string>} */ (normalize_mapper)); // : new Map(/** @type {Map<string,string>} */ (normalize_mapper));
} // }
} }
//if(!str) return str; //if(!str) return str;
} }

View File

@@ -29,7 +29,6 @@ import Cache, { searchCache } from "./cache.js";
import { KeystoreMap, KeystoreSet } from "./keystore.js"; import { KeystoreMap, KeystoreSet } from "./keystore.js";
import { is_array, is_string } from "./common.js"; import { is_array, is_string } from "./common.js";
import { exportIndex, importIndex } from "./serialize.js"; import { exportIndex, importIndex } from "./serialize.js";
import { global_lang, global_charset } from "./global.js";
import default_encoder from "./lang/latin/default.js"; import default_encoder from "./lang/latin/default.js";
import apply_preset from "./preset.js"; import apply_preset from "./preset.js";
import apply_async from "./async.js"; import apply_async from "./async.js";
@@ -52,38 +51,23 @@ export default function Index(options, _register){
PROFILER && tick("Index.create"); PROFILER && tick("Index.create");
if(options){ options = options
? apply_preset(options)
options = apply_preset(options); : {};
// charset = options.charset;
// // lang = options.lang;
//
// if(is_string(charset)){
//
// if(!charset.includes(":")){
// charset += ":default";
// }
//
// charset = global_charset[charset];
// }
// if(is_string(lang)){
//
// lang = global_lang[lang];
// }
}
else{
options = {};
}
// let charset, lang, tmp;
const context = options.context || {}; const context = options.context || {};
const encoder = options.encode || options.encoder || default_encoder; const encoder = options.encode || options.encoder || (
SUPPORT_ENCODER ? default_encoder : function(str){
return str.toLowerCase().trim().split(/\s+/);
}
);
this.encoder = encoder.encode this.encoder = encoder.encode
? encoder ? encoder
: typeof encoder === "object" : typeof encoder === "object"
? (SUPPORT_ENCODER
? new Encoder(encoder) ? new Encoder(encoder)
: encoder
)
: { encode: encoder }; : { encode: encoder };
if(SUPPORT_COMPRESSION){ if(SUPPORT_COMPRESSION){
@@ -101,12 +85,12 @@ export default function Index(options, _register){
tmp = SUPPORT_KEYSTORE && (options.keystore || 0); tmp = SUPPORT_KEYSTORE && (options.keystore || 0);
tmp && (this.keystore = tmp); tmp && (this.keystore = tmp);
this.map = tmp ? new KeystoreMap(tmp) : new Map(); this.map = tmp && SUPPORT_KEYSTORE ? new KeystoreMap(tmp) : new Map();
this.ctx = tmp ? new KeystoreMap(tmp) : new Map(); this.ctx = tmp && SUPPORT_KEYSTORE ? new KeystoreMap(tmp) : new Map();
this.reg = _register || ( this.reg = _register || (
this.fastupdate this.fastupdate
? (tmp ? new KeystoreMap(tmp) : new Map()) ? (tmp && SUPPORT_KEYSTORE ? new KeystoreMap(tmp) : new Map())
: (tmp ? new KeystoreSet(tmp) : new Set()) : (tmp && SUPPORT_KEYSTORE ? new KeystoreSet(tmp) : new Set())
); );
this.resolution_ctx = context.resolution || 1; this.resolution_ctx = context.resolution || 1;
this.rtl = (encoder.rtl) || options.rtl || false; this.rtl = (encoder.rtl) || options.rtl || false;

View File

@@ -7,6 +7,7 @@ import {
SUPPORT_SERIALIZE, SUPPORT_SERIALIZE,
SUPPORT_WORKER, SUPPORT_WORKER,
SUPPORT_ENCODER, SUPPORT_ENCODER,
SUPPORT_CHARSET,
SUPPORT_PERSISTENT, SUPPORT_PERSISTENT,
SUPPORT_RESOLVER, SUPPORT_RESOLVER,
SUPPORT_STORE SUPPORT_STORE
@@ -27,7 +28,7 @@ import WorkerIndex from "./worker/index.js";
import Resolver from "./resolver.js"; import Resolver from "./resolver.js";
import Encoder from "./encoder.js"; import Encoder from "./encoder.js";
import IdxDB from "./db/indexeddb/index.js"; import IdxDB from "./db/indexeddb/index.js";
import { global_charset, global_lang } from "./global.js"; import { global_charset } from "./charset.js";
import charset_exact from "./lang/latin/exact.js" import charset_exact from "./lang/latin/exact.js"
import charset_default from "./lang/latin/default.js" import charset_default from "./lang/latin/default.js"
import charset_simple from "./lang/latin/simple.js" import charset_simple from "./lang/latin/simple.js"
@@ -161,7 +162,7 @@ if(SUPPORT_PERSISTENT && SUPPORT_DOCUMENT){
/** @export */ DocumentSearchOptions.pluck; /** @export */ DocumentSearchOptions.pluck;
/** @export */ DocumentSearchOptions.merge; /** @export */ DocumentSearchOptions.merge;
if(SUPPORT_ENCODER){ if(SUPPORT_CHARSET){
global_charset["latin:exact"] = charset_exact; global_charset["latin:exact"] = charset_exact;
global_charset["latin:default"] = charset_default; global_charset["latin:default"] = charset_default;
global_charset["latin:simple"] = charset_simple; global_charset["latin:simple"] = charset_simple;
@@ -173,9 +174,8 @@ if(SUPPORT_ENCODER){
const FlexSearch = { const FlexSearch = {
"Index": Index, "Index": Index,
"Encoder": Encoder,
"Charset": global_charset, "Charset": global_charset,
"Language": global_lang, "Encoder": SUPPORT_ENCODER ? Encoder : null,
"Document": SUPPORT_DOCUMENT ? Document : null, "Document": SUPPORT_DOCUMENT ? Document : null,
"Worker": SUPPORT_WORKER ? WorkerIndex : null, "Worker": SUPPORT_WORKER ? WorkerIndex : null,
"Resolver": SUPPORT_RESOLVER ? Resolver : null, "Resolver": SUPPORT_RESOLVER ? Resolver : null,

View File

@@ -9,6 +9,7 @@
"POLYFILL": false, "POLYFILL": false,
"SUPPORT_WORKER": true, "SUPPORT_WORKER": true,
"SUPPORT_ENCODER": true, "SUPPORT_ENCODER": true,
"SUPPORT_CHARSET": true,
"SUPPORT_CACHE": true, "SUPPORT_CACHE": true,
"SUPPORT_ASYNC": true, "SUPPORT_ASYNC": true,
"SUPPORT_STORE": true, "SUPPORT_STORE": true,
@@ -37,8 +38,7 @@
"babel-plugin-transform-undefined-to-void" "babel-plugin-transform-undefined-to-void"
], ],
"ignore": [ "ignore": [
"config.js", "config.js"
"profiler.js"
], ],
"minified": false, "minified": false,
"compact": false, "compact": false,

View File

@@ -9,6 +9,7 @@
"POLYFILL": false, "POLYFILL": false,
"SUPPORT_WORKER": true, "SUPPORT_WORKER": true,
"SUPPORT_ENCODER": true, "SUPPORT_ENCODER": true,
"SUPPORT_CHARSET": true,
"SUPPORT_CACHE": true, "SUPPORT_CACHE": true,
"SUPPORT_ASYNC": true, "SUPPORT_ASYNC": true,
"SUPPORT_STORE": true, "SUPPORT_STORE": true,
@@ -37,8 +38,7 @@
"babel-plugin-transform-undefined-to-void" "babel-plugin-transform-undefined-to-void"
], ],
"ignore": [ "ignore": [
"config.js", "config.js"
"profiler.js"
], ],
"minified": false, "minified": false,
"compact": false, "compact": false,

View File

@@ -9,6 +9,7 @@
"POLYFILL": false, "POLYFILL": false,
"SUPPORT_WORKER": true, "SUPPORT_WORKER": true,
"SUPPORT_ENCODER": true, "SUPPORT_ENCODER": true,
"SUPPORT_CHARSET": true,
"SUPPORT_CACHE": true, "SUPPORT_CACHE": true,
"SUPPORT_ASYNC": true, "SUPPORT_ASYNC": true,
"SUPPORT_STORE": true, "SUPPORT_STORE": true,
@@ -39,8 +40,7 @@
"babel-plugin-transform-undefined-to-void" "babel-plugin-transform-undefined-to-void"
], ],
"ignore": [ "ignore": [
"config.js", "config.js"
"profiler.js"
], ],
"minified": true, "minified": true,
"compact": true, "compact": true,