flexsearch
Advanced tools
Comparing version 0.7.2 to 0.7.3
@@ -33,2 +33,8 @@ # Changelog | ||
These features have been removed: | ||
- Where-Clause | ||
- Index Information `index.info()` | ||
- Paging Cursor (was replaced by `offset`) | ||
#### Migration Quick Overview | ||
@@ -116,2 +122,29 @@ | ||
#### Where Clause Replacement | ||
Old Syntax: | ||
```js | ||
const result = index.where({ | ||
cat: "comedy", | ||
year: "2018" | ||
}); | ||
``` | ||
Equivalent Syntax (0.7.x): | ||
```js | ||
const data = Object.values(index.store); | ||
``` | ||
The line above retrieves data from the document store (just useful when not already available in your runtime). | ||
```js | ||
const result = data.filter(function(item){ | ||
return item.cat === "comedy" && item.year === "2018"; | ||
}); | ||
``` | ||
Also considering using the <a href="https://github.com/nextapps-de/flexsearch#tags">Tag-Search</a> feature, which partially replaces the Where-Clause with a huge performance boost. | ||
### v0.6.0 | ||
@@ -118,0 +151,0 @@ |
/**! | ||
* FlexSearch.js v0.7.2 (Bundle) | ||
* Copyright 2018-2021 Nextapps GmbH | ||
* FlexSearch.js v0.7.3 (Bundle) | ||
* Copyright 2018-2022 Nextapps GmbH | ||
* Author: Thomas Wilkerling | ||
@@ -9,26 +9,26 @@ * Licence: Apache-2.0 | ||
(function _f(self){'use strict';try{if(module)self=module}catch(e){}self._factory=_f;var t;function u(a){return"undefined"!==typeof a?a:!0}function aa(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=v();return b}function v(){return Object.create(null)}function ba(a,b){return b.length-a.length}function x(a){return"string"===typeof a}function C(a){return"object"===typeof a}function D(a){return"function"===typeof a};function ca(a,b){var c=da;if(a&&(b&&(a=E(a,b)),this.H&&(a=E(a,this.H)),this.J&&1<a.length&&(a=E(a,this.J)),c||""===c)){a=a.split(c);if(this.filter){b=this.filter;c=a.length;const d=[];for(let e=0,f=0;e<c;e++){const g=a[e];g&&!b[g]&&(d[f++]=g)}a=d}return a}return a}const da=/[\p{Z}\p{S}\p{P}\p{C}]+/u,ea=/[\u0300-\u036f]/g; | ||
function fa(a,b){const c=Object.keys(a),d=c.length,e=[];let f="",g=0;for(let h=0,k,m;h<d;h++)k=c[h],(m=a[k])?(e[g++]=F(b?"(?!\\b)"+k+"(\\b|_)":k),e[g++]=m):f+=(f?"|":"")+k;f&&(e[g++]=F(b?"(?!\\b)("+f+")(\\b|_)":"("+f+")"),e[g]="");return e}function E(a,b){for(let c=0,d=b.length;c<d&&(a=a.replace(b[c],b[c+1]),a);c+=2);return a}function F(a){return new RegExp(a,"g")}function ha(a){let b="",c="";for(let d=0,e=a.length,f;d<e;d++)(f=a[d])!==c&&(b+=c=f);return b};var ja={encode:ia,F:!1,G:""};function ia(a){return ca.call(this,a.toLowerCase(),!1)};const ka={},G={};function la(a){I(a,"add");I(a,"append");I(a,"search");I(a,"update");I(a,"remove")}function I(a,b){a[b+"Async"]=function(){const c=this,d=arguments;var e=d[d.length-1];let f;D(e)&&(f=e,delete d[d.length-1]);e=new Promise(function(g){setTimeout(function(){c.async=!0;const h=c[b].apply(c,d);c.async=!1;g(h)})});return f?(e.then(f),this):e}};function ma(a,b,c,d){const e=a.length;let f=[],g,h,k=0;d&&(d=[]);for(let m=e-1;0<=m;m--){const n=a[m],w=n.length,q=v();let r=!g;for(let l=0;l<w;l++){const p=n[l],z=p.length;if(z)for(let B=0,A,y;B<z;B++)if(y=p[B],g){if(g[y]){if(!m)if(c)c--;else if(f[k++]=y,k===b)return f;if(m||d)q[y]=1;r=!0}if(d&&(h[y]=(A=h[y])?++A:A=1,A<e)){const H=d[A-2]||(d[A-2]=[]);H[H.length]=y}}else q[y]=1}if(d)g||(h=q);else if(!r)return[];g=q}if(d)for(let m=d.length-1,n,w;0<=m;m--){n=d[m];w=n.length;for(let q=0,r;q<w;q++)if(r= | ||
function fa(a,b){const c=Object.keys(a),d=c.length,e=[];let f="",g=0;for(let h=0,k,m;h<d;h++)k=c[h],(m=a[k])?(e[g++]=F(b?"(?!\\b)"+k+"(\\b|_)":k),e[g++]=m):f+=(f?"|":"")+k;f&&(e[g++]=F(b?"(?!\\b)("+f+")(\\b|_)":"("+f+")"),e[g]="");return e}function E(a,b){for(let c=0,d=b.length;c<d&&(a=a.replace(b[c],b[c+1]),a);c+=2);return a}function F(a){return new RegExp(a,"g")}function ha(a){let b="",c="";for(let d=0,e=a.length,f;d<e;d++)(f=a[d])!==c&&(b+=c=f);return b};var ja={encode:ia,F:!1,G:""};function ia(a){return ca.call(this,(""+a).toLowerCase(),!1)};const ka={},G={};function la(a){I(a,"add");I(a,"append");I(a,"search");I(a,"update");I(a,"remove")}function I(a,b){a[b+"Async"]=function(){const c=this,d=arguments;var e=d[d.length-1];let f;D(e)&&(f=e,delete d[d.length-1]);e=new Promise(function(g){setTimeout(function(){c.async=!0;const h=c[b].apply(c,d);c.async=!1;g(h)})});return f?(e.then(f),this):e}};function ma(a,b,c,d){const e=a.length;let f=[],g,h,k=0;d&&(d=[]);for(let m=e-1;0<=m;m--){const n=a[m],w=n.length,q=v();let r=!g;for(let l=0;l<w;l++){const p=n[l],z=p.length;if(z)for(let B=0,A,y;B<z;B++)if(y=p[B],g){if(g[y]){if(!m)if(c)c--;else if(f[k++]=y,k===b)return f;if(m||d)q[y]=1;r=!0}if(d&&(A=(h[y]||0)+1,h[y]=A,A<e)){const H=d[A-2]||(d[A-2]=[]);H[H.length]=y}}else q[y]=1}if(d)g||(h=q);else if(!r)return[];g=q}if(d)for(let m=d.length-1,n,w;0<=m;m--){n=d[m];w=n.length;for(let q=0,r;q<w;q++)if(r= | ||
n[q],!g[r]){if(c)c--;else if(f[k++]=r,k===b)return f;g[r]=1}}return f}function na(a,b){const c=v(),d=v(),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[e.length]=k)}return e};function J(a){this.l=!0!==a&&a;this.cache=v();this.h=[]}function oa(a,b,c){C(a)&&(a=a.query);let d=this.cache.get(a);d||(d=this.search(a,b,c),this.cache.set(a,d));return d}J.prototype.set=function(a,b){if(!this.cache[a]){var c=this.h.length;c===this.l?delete this.cache[this.h[c-1]]:c++;for(--c;0<c;c--)this.h[c]=this.h[c-1];this.h[0]=a}this.cache[a]=b};J.prototype.get=function(a){const b=this.cache[a];if(this.l&&b&&(a=this.h.indexOf(a))){const c=this.h[a-1];this.h[a-1]=this.h[a];this.h[a]=c}return b};const qa={memory:{charset:"latin:extra",D:3,B:4,m:!1},performance:{D:3,B:3,s:!1,context:{depth:2,D:1}},match:{charset:"latin:extra",G:"reverse"},score:{charset:"latin:advanced",D:20,B:3,context:{depth:3,D:9}},"default":{}};function ra(a,b,c,d,e,f){setTimeout(function(){const g=a(c,JSON.stringify(f));g&&g.then?g.then(function(){b.export(a,b,c,d,e+1)}):b.export(a,b,c,d,e+1)})};function K(a,b){if(!(this instanceof K))return new K(a);var c;if(a){x(a)?a=qa[a]:(c=a.preset)&&(a=Object.assign({},c[c],a));c=a.charset;var d=a.lang;x(c)&&(-1===c.indexOf(":")&&(c+=":default"),c=G[c]);x(d)&&(d=ka[d])}else a={};let e,f,g=a.context||{};this.encode=a.encode||c&&c.encode||ia;this.register=b||v();this.D=e=a.resolution||9;this.G=b=c&&c.G||a.tokenize||"strict";this.depth="strict"===b&&g.depth;this.l=u(g.bidirectional);this.s=f=u(a.optimize);this.m=u(a.fastupdate);this.B=a.minlength||1;this.C= | ||
a.boost;this.map=f?aa(e):v();this.A=e=g.resolution||1;this.h=f?aa(e):v();this.F=c&&c.F||a.rtl;this.H=(b=a.matcher||d&&d.H)&&fa(b,!1);this.J=(b=a.stemmer||d&&d.J)&&fa(b,!0);if(c=b=a.filter||d&&d.filter){c=b;d=v();for(let h=0,k=c.length;h<k;h++)d[c[h]]=1;c=d}this.filter=c;this.cache=(b=a.cache)&&new J(b)}t=K.prototype;t.append=function(a,b){return this.add(a,b,!0)}; | ||
t.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.register[a])return this.update(a,b);b=this.encode(b);if(d=b.length){const m=v(),n=v(),w=this.depth,q=this.D;for(let r=0;r<d;r++){let l=b[this.F?d-1-r:r];var e=l.length;if(l&&e>=this.B&&(w||!n[l])){var f=L(q,d,r),g="";switch(this.G){case "full":if(3<e){for(f=0;f<e;f++)for(var h=e;h>f;h--)if(h-f>=this.B){var k=L(q,d,r,e,f);g=l.substring(f,h);M(this,n,g,k,a,c)}break}case "reverse":if(2<e){for(h=e-1;0<h;h--)g=l[h]+g,g.length>=this.B&&M(this,n, | ||
t.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.register[a])return this.update(a,b);b=this.encode(b);if(d=b.length){const m=v(),n=v(),w=this.depth,q=this.D;for(let r=0;r<d;r++){let l=b[this.F?d-1-r:r];var e=l.length;if(l&&e>=this.B&&(w||!n[l])){var f=L(q,d,r),g="";switch(this.G){case "full":if(2<e){for(f=0;f<e;f++)for(var h=e;h>f;h--)if(h-f>=this.B){var k=L(q,d,r,e,f);g=l.substring(f,h);M(this,n,g,k,a,c)}break}case "reverse":if(1<e){for(h=e-1;0<h;h--)g=l[h]+g,g.length>=this.B&&M(this,n, | ||
g,L(q,d,r,e,h),a,c);g=""}case "forward":if(1<e){for(h=0;h<e;h++)g+=l[h],g.length>=this.B&&M(this,n,g,f,a,c);break}default:if(this.C&&(f=Math.min(f/this.C(b,l,r)|0,q-1)),M(this,n,l,f,a,c),w&&1<d&&r<d-1)for(e=v(),g=this.A,f=l,h=Math.min(w+1,d-r),e[f]=1,k=1;k<h;k++)if((l=b[this.F?d-1-r-k:r+k])&&l.length>=this.B&&!e[l]){e[l]=1;const p=this.l&&l>f;M(this,m,p?f:l,L(g+(d/2>g?0:1),d,r,h-1,k-1),a,c,p?l:f)}}}}this.m||(this.register[a]=1)}}return this}; | ||
function L(a,b,c,d,e){return c&&1<a?b+(d||0)<=a?c+(e||0):(a-1)/(b+(d||0))*(c+(e||0))+1|0:0}function M(a,b,c,d,e,f,g){let h=g?a.h:a.map;if(!b[c]||g&&!b[c][g])a.s&&(h=h[d]),g?(b=b[c]||(b[c]=v()),b[g]=1,h=h[g]||(h[g]=v())):b[c]=1,h=h[c]||(h[c]=[]),a.s||(h=h[d]||(h[d]=[])),f&&-1!==h.indexOf(e)||(h[h.length]=e,a.m&&(a=a.register[e]||(a.register[e]=[]),a[a.length]=h))} | ||
t.search=function(a,b,c){c||(!b&&C(a)?(c=a,a=c.query):C(b)&&(c=b));let d=[],e;let f,g=0;if(c){b=c.limit;g=c.offset||0;var h=c.context;f=c.suggest}if(a&&(a=this.encode(a),e=a.length,1<e)){c=v();var k=[];for(let n=0,w=0,q;n<e;n++)if((q=a[n])&&q.length>=this.B&&!c[q])if(this.s||f||this.map[q])k[w++]=q,c[q]=1;else return d;a=k;e=a.length}if(!e)return d;b||(b=100);h=this.depth&&1<e&&!1!==h;c=0;let m;h?(m=a[0],c=1):1<e&&a.sort(ba);for(let n,w;c<e;c++){w=a[c];h?(n=sa(this,d,f,b,g,2===e,w,m),f&&!1===n&&d.length|| | ||
(m=w)):n=sa(this,d,f,b,g,1===e,w);if(n)return n;if(f&&c===e-1){k=d.length;if(!k){if(h){h=0;c=-1;continue}return d}if(1===k)return ta(d[0],b,g)}}return ma(d,b,g,f)}; | ||
function L(a,b,c,d,e){return c&&1<a?b+(d||0)<=a?c+(e||0):(a-1)/(b+(d||0))*(c+(e||0))+1|0:0}function M(a,b,c,d,e,f,g){let h=g?a.h:a.map;if(!b[c]||g&&!b[c][g])a.s&&(h=h[d]),g?(b=b[c]||(b[c]=v()),b[g]=1,h=h[g]||(h[g]=v())):b[c]=1,h=h[c]||(h[c]=[]),a.s||(h=h[d]||(h[d]=[])),f&&h.includes(e)||(h[h.length]=e,a.m&&(a=a.register[e]||(a.register[e]=[]),a[a.length]=h))} | ||
t.search=function(a,b,c){c||(!b&&C(a)?(c=a,a=c.query):C(b)&&(c=b));let d=[],e;let f,g=0;if(c){a=c.query||a;b=c.limit;g=c.offset||0;var h=c.context;f=c.suggest}if(a&&(a=this.encode(""+a),e=a.length,1<e)){c=v();var k=[];for(let n=0,w=0,q;n<e;n++)if((q=a[n])&&q.length>=this.B&&!c[q])if(this.s||f||this.map[q])k[w++]=q,c[q]=1;else return d;a=k;e=a.length}if(!e)return d;b||(b=100);h=this.depth&&1<e&&!1!==h;c=0;let m;h?(m=a[0],c=1):1<e&&a.sort(ba);for(let n,w;c<e;c++){w=a[c];h?(n=sa(this,d,f,b,g,2===e,w, | ||
m),f&&!1===n&&d.length||(m=w)):n=sa(this,d,f,b,g,1===e,w);if(n)return n;if(f&&c===e-1){k=d.length;if(!k){if(h){h=0;c=-1;continue}return d}if(1===k)return ta(d[0],b,g)}}return ma(d,b,g,f)}; | ||
function sa(a,b,c,d,e,f,g,h){let k=[],m=h?a.h:a.map;a.s||(m=ua(m,g,h,a.l));if(m){let n=0;const w=Math.min(m.length,h?a.A:a.D);for(let q=0,r=0,l,p;q<w;q++)if(l=m[q])if(a.s&&(l=ua(l,g,h,a.l)),e&&l&&f&&(p=l.length,p<=e?(e-=p,l=null):(l=l.slice(e),e=0)),l&&(k[n++]=l,f&&(r+=l.length,r>=d)))break;if(n){if(f)return ta(k,d,0);b[b.length]=k;return}}return!c&&k}function ta(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} | ||
function ua(a,b,c,d){c?(d=d&&b>c,a=(a=a[d?b:c])&&a[d?c:b]):a=a[b];return a}t.contain=function(a){return!!this.register[a]};t.update=function(a,b){return this.remove(a).add(a,b)}; | ||
t.remove=function(a,b){const c=this.register[a];if(c){if(this.m)for(let d=0,e;d<c.length;d++)e=c[d],e.splice(e.indexOf(a),1);else N(this.map,a,this.D,this.s),this.depth&&N(this.h,a,this.A,this.s);b||delete this.register[a];if(this.cache){b=this.cache;for(let d=0,e,f;d<b.h.length;d++)f=b.h[d],e=b.cache[f],-1!==e.indexOf(a)&&(b.h.splice(d--,1),delete b.cache[f])}}return this}; | ||
t.remove=function(a,b){const c=this.register[a];if(c){if(this.m)for(let d=0,e;d<c.length;d++)e=c[d],e.splice(e.indexOf(a),1);else N(this.map,a,this.D,this.s),this.depth&&N(this.h,a,this.A,this.s);b||delete this.register[a];if(this.cache){b=this.cache;for(let d=0,e,f;d<b.h.length;d++)f=b.h[d],e=b.cache[f],e.includes(a)&&(b.h.splice(d--,1),delete b.cache[f])}}return this}; | ||
function N(a,b,c,d,e){let f=0;if(a.constructor===Array)if(e)b=a.indexOf(b),-1!==b?1<a.length&&(a.splice(b,1),f++):f++;else{e=Math.min(a.length,c);for(let g=0,h;g<e;g++)if(h=a[g])f=N(h,b,c,d,e),d||f||delete a[g]}else for(let g in a)(f=N(a[g],b,c,d,e))||delete a[g];return f}t.searchCache=oa; | ||
t.export=function(a,b,c,d,e){let f,g;switch(e||(e=0)){case 0:f="reg";if(this.m){g=v();for(let h in this.register)g[h]=1}else g=this.register;break;case 1:f="cfg";g={doc:0,opt:this.s?1:0};break;case 2:f="map";g=this.map;break;case 3:f="ctx";g=this.h;break;default:return}ra(a,b||this,c?c+"."+f:f,d,e,g);return!0};t.import=function(a,b){if(b)switch(x(b)&&(b=JSON.parse(b)),a){case "cfg":this.s=!!b.opt;break;case "reg":this.m=!1;this.register=b;break;case "map":this.map=b;break;case "ctx":this.h=b}};la(K.prototype);function va(a){a=a.data;var b=self._index;const c=a.args;var d=a.task;switch(d){case "init":d=a.options||{};a=a.factory;b=d.encode;d.cache=!1;b&&0===b.indexOf("function")&&(d.encode=Function("return "+b)());a?(Function("return "+a)()(self),self._index=new self.FlexSearch.Index(d),delete self.FlexSearch):self._index=new K(d);break;default:a=a.id,b=b[d].apply(b,c),postMessage("search"===d?{id:a,msg:b}:{id:a})}};let wa=0;function O(a){if(!(this instanceof O))return new O(a);var b;a?D(b=a.encode)&&(a.encode=b.toString()):a={};(b=(self||window)._factory)&&(b=b.toString());const c=self.exports,d=this;this.o=xa(b,c,a.worker);this.h=v();if(this.o){if(c)this.o.on("message",function(e){d.h[e.id](e.msg);delete d.h[e.id]});else this.o.onmessage=function(e){e=e.data;d.h[e.id](e.msg);delete d.h[e.id]};this.o.postMessage({task:"init",factory:b,options:a})}}P("add");P("append");P("search");P("update");P("remove"); | ||
function P(a){O.prototype[a]=O.prototype[a+"Async"]=function(){const b=this,c=[].slice.call(arguments);var d=c[c.length-1];let e;D(d)&&(e=d,c.splice(c.length-1,1));d=new Promise(function(f){setTimeout(function(){b.h[++wa]=f;b.o.postMessage({task:a,id:wa,args:c})})});return e?(d.then(e),this):d}} | ||
t.export=function(a,b,c,d,e){let f,g;switch(e||(e=0)){case 0:f="reg";if(this.m){g=v();for(let h in this.register)g[h]=1}else g=this.register;break;case 1:f="cfg";g={doc:0,opt:this.s?1:0};break;case 2:f="map";g=this.map;break;case 3:f="ctx";g=this.h;break;default:return}ra(a,b||this,c?c+"."+f:f,d,e,g);return!0};t.import=function(a,b){if(b)switch(x(b)&&(b=JSON.parse(b)),a){case "cfg":this.s=!!b.opt;break;case "reg":this.m=!1;this.register=b;break;case "map":this.map=b;break;case "ctx":this.h=b}};la(K.prototype);function va(a){a=a.data;var b=self._index;const c=a.args;var d=a.task;switch(d){case "init":d=a.options||{};a=a.factory;b=d.encode;d.cache=!1;b&&0===b.indexOf("function")&&(d.encode=Function("return "+b)());a?(Function("return "+a)()(self),self._index=new self.FlexSearch.Index(d),delete self.FlexSearch):self._index=new K(d);break;default:a=a.id,b=b[d].apply(b,c),postMessage("search"===d?{id:a,msg:b}:{id:a})}};let wa=0;function O(a){if(!(this instanceof O))return new O(a);var b;a?D(b=a.encode)&&(a.encode=b.toString()):a={};(b=(self||window)._factory)&&(b=b.toString());const c="undefined"===typeof window&&self.exports,d=this;this.o=xa(b,c,a.worker);this.h=v();if(this.o){if(c)this.o.on("message",function(e){d.h[e.id](e.msg);delete d.h[e.id]});else this.o.onmessage=function(e){e=e.data;d.h[e.id](e.msg);delete d.h[e.id]};this.o.postMessage({task:"init",factory:b,options:a})}}P("add");P("append");P("search"); | ||
P("update");P("remove");function P(a){O.prototype[a]=O.prototype[a+"Async"]=function(){const b=this,c=[].slice.call(arguments);var d=c[c.length-1];let e;D(d)&&(e=d,c.splice(c.length-1,1));d=new Promise(function(f){setTimeout(function(){b.h[++wa]=f;b.o.postMessage({task:a,id:wa,args:c})})});return e?(d.then(e),this):d}} | ||
function xa(a,b,c){let d;try{d=b?eval('new (require("worker_threads")["Worker"])("../dist/node/node.js")'):a?new Worker(URL.createObjectURL(new Blob(["onmessage="+va.toString()],{type:"text/javascript"}))):new Worker(x(c)?c:"worker/worker.js",{type:"module"})}catch(e){}return d};function Q(a){if(!(this instanceof Q))return new Q(a);var b=a.document||a.doc||a,c;this.K=[];this.h=[];this.A=[];this.register=v();this.key=(c=b.key||b.id)&&S(c,this.A)||"id";this.m=u(a.fastupdate);this.C=(c=b.store)&&!0!==c&&[];this.store=c&&v();this.I=(c=b.tag)&&S(c,this.A);this.l=c&&v();this.cache=(c=a.cache)&&new J(c);a.cache=!1;this.o=a.worker;this.async=!1;c=v();let d=b.index||b.field||b;x(d)&&(d=[d]);for(let e=0,f,g;e<d.length;e++)f=d[e],x(f)||(g=f,f=f.field),g=C(g)?Object.assign({},a,g):a, | ||
this.o&&(c[f]=new O(g),c[f].o||(this.o=!1)),this.o||(c[f]=new K(g,this.register)),this.K[e]=S(f,this.A),this.h[e]=f;if(this.C)for(a=b.store,x(a)&&(a=[a]),b=0;b<a.length;b++)this.C[b]=S(a[b],this.A);this.index=c}function S(a,b){const c=a.split(":");let d=0;for(let e=0;e<c.length;e++)a=c[e],0<=a.indexOf("[]")&&(a=a.substring(0,a.length-2))&&(b[d]=!0),a&&(c[d++]=a);d<c.length&&(c.length=d);return 1<d?c:c[0]}function T(a,b){if(x(b))a=a[b];else for(let c=0;a&&c<b.length;c++)a=a[b[c]];return a} | ||
function U(a,b,c,d,e){a=a[e];if(d===c.length-1)b[e]=a;else if(a)if(a.constructor===Array)for(b=b[e]=Array(a.length),e=0;e<a.length;e++)U(a,b,c,d,e);else b=b[e]||(b[e]=v()),e=c[++d],U(a,b,c,d,e)}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)}t=Q.prototype; | ||
t.add=function(a,b,c){C(a)&&(b=a,a=T(b,this.key));if(b&&(a||0===a)){if(!c&&this.register[a])return this.update(a,b);for(let d=0,e,f;d<this.h.length;d++)f=this.h[d],e=this.K[d],x(e)&&(e=[e]),V(b,e,this.A,0,this.index[f],a,e[0],c);if(this.I){let d=T(b,this.I),e=v();x(d)&&(d=[d]);for(let f=0,g,h;f<d.length;f++)if(g=d[f],!e[g]&&(e[g]=1,h=this.l[g]||(this.l[g]=[]),!c||-1===h.indexOf(a)))if(h[h.length]=a,this.m){const k=this.register[a]||(this.register[a]=[]);k[k.length]=h}}if(this.store&&(!c||!this.store[a])){let d; | ||
t.add=function(a,b,c){C(a)&&(b=a,a=T(b,this.key));if(b&&(a||0===a)){if(!c&&this.register[a])return this.update(a,b);for(let d=0,e,f;d<this.h.length;d++)f=this.h[d],e=this.K[d],x(e)&&(e=[e]),V(b,e,this.A,0,this.index[f],a,e[0],c);if(this.I){let d=T(b,this.I),e=v();x(d)&&(d=[d]);for(let f=0,g,h;f<d.length;f++)if(g=d[f],!e[g]&&(e[g]=1,h=this.l[g]||(this.l[g]=[]),!c||!h.includes(a)))if(h[h.length]=a,this.m){const k=this.register[a]||(this.register[a]=[]);k[k.length]=h}}if(this.store&&(!c||!this.store[a])){let d; | ||
if(this.C){d=v();for(let e=0,f;e<this.C.length;e++)f=this.C[e],x(f)?d[f]=b[f]:U(b,d,f,0,f[0])}this.store[a]=d||b}}return this};t.append=function(a,b){return this.add(a,b,!0)};t.update=function(a,b){return this.remove(a).add(a,b)}; | ||
t.remove=function(a){C(a)&&(a=T(a,this.key));if(this.register[a]){for(var b=0;b<this.h.length&&(this.index[this.h[b]].remove(a,!this.o),!this.m);b++);if(this.I&&!this.m)for(let c in this.l){b=this.l[c];const d=b.indexOf(a);-1!==d&&(1<b.length?b.splice(d,1):delete this.l[c])}this.store&&delete this.store[a];delete this.register[a]}return this}; | ||
t.search=function(a,b,c,d){c||(!b&&C(a)?(c=a,a=c.query):C(b)&&(c=b,b=0));let e=[],f=[],g,h,k,m,n,w,q=0;if(c)if(c.constructor===Array)k=c,c=null;else{k=(g=c.pluck)||c.index||c.field;m=c.tag;h=this.store&&c.enrich;n="and"===c.bool;b=c.limit||100;w=c.offset||0;if(m&&(x(m)&&(m=[m]),!a)){for(let l=0,p;l<m.length;l++)if(p=ya.call(this,m[l],b,w,h))e[e.length]=p,q++;return q?e:[]}x(k)&&(k=[k])}k||(k=this.h);n=n&&(1<k.length||m&&1<m.length);const r=!d&&(this.o||this.async)&&[];for(let l=0,p,z,B;l<k.length;l++){let A; | ||
z=k[l];x(z)||(A=z,z=z.field);if(r)r[l]=this.index[z].searchAsync(a,b,A||c);else{d?p=d[l]:p=this.index[z].search(a,b,A||c);B=p&&p.length;if(m&&B){const y=[];let H=0;n&&(y[0]=[p]);for(let X=0,pa,R;X<m.length;X++)if(pa=m[X],B=(R=this.l[pa])&&R.length)H++,y[y.length]=n?[R]:R;H&&(p=n?ma(y,b||100,w||0):na(p,y),B=p.length)}if(B)f[q]=z,e[q++]=p;else if(n)return[]}}if(r){const l=this;return new Promise(function(p){Promise.all(r).then(function(z){p(l.search(a,b,c,z))})})}if(!q)return[];if(g&&(!h||!this.store))return e[0]; | ||
for(let l=0,p;l<f.length;l++){p=e[l];p.length&&h&&(p=za.call(this,p));if(g)return p;e[l]={field:f[l],result:p}}return e};function ya(a,b,c,d){let e=this.l[a],f=e&&e.length-c;if(f&&0<f){if(f>b||c)e=e.slice(c,c+b);d&&(e=za.call(this,e));return{tag:a,result:e}}}function za(a){const b=Array(a.length);for(let c=0,d;c<a.length;c++)d=a[c],b[c]={id:d,doc:this.store[d]};return b}t.contain=function(a){return!!this.register[a]};t.get=function(a){return this.store[a]};t.set=function(a,b){this.store[a]=b;return this}; | ||
t.searchCache=oa;t.export=function(a,b,c,d,e){e||(e=0);d||(d=0);if(d<this.h.length){const f=this.h[d],g=this.index[f];b=this;setTimeout(function(){g.export(a,b,e?f.replace(":","-"):"",d,e++)||(d++,e=1,b.export(a,b,f,d,e))})}else{let f;switch(e){case 1:c="tag";f=this.l;break;case 2:c="store";f=this.store;break;default:return}ra(a,this,c,d,e,f)}}; | ||
t.import=function(a,b){if(b)switch(x(b)&&(b=JSON.parse(b)),a){case "tag":this.l=b;break;case "reg":this.m=!1;this.register=b;for(let d=0,e;d<this.h.length;d++)e=this.index[this.h[d]],e.register=b,e.m=!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)}};la(Q.prototype);var Ba={encode:Aa,F:!1,G:""};const Ca=[F("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",F("[\u00e8\u00e9\u00ea\u00eb]"),"e",F("[\u00ec\u00ed\u00ee\u00ef]"),"i",F("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",F("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",F("[\u00fd\u0177\u00ff]"),"y",F("\u00f1"),"n",F("[\u00e7c]"),"k",F("\u00df"),"s",F(" & ")," and "];function Aa(a){var b=a;b.normalize&&(b=b.normalize("NFD").replace(ea,""));return ca.call(this,b.toLowerCase(),!a.normalize&&Ca)};var Ea={encode:Da,F:!1,G:"strict"};const Fa=/[^a-z0-9]+/,Ga={b:"p",v:"f",w:"f",z:"s",x:"s","\u00df":"s",d:"t",n:"m",c:"k",g:"k",j:"k",q:"k",i:"e",y:"e",u:"o"};function Da(a){a=Aa.call(this,a).join(" ");const b=[];if(a){const c=a.split(Fa),d=c.length;for(let e=0,f,g=0;e<d;e++)if((a=c[e])&&(!this.filter||!this.filter[a])){f=a[0];let h=Ga[f]||f,k=h;for(let m=1;m<a.length;m++){f=a[m];const n=Ga[f]||f;n&&n!==k&&(h+=n,k=n)}b[g++]=h}}return b};var Ia={encode:Ha,F:!1,G:""};const Ja=[F("ae"),"a",F("oe"),"o",F("sh"),"s",F("th"),"t",F("ph"),"f",F("pf"),"f",F("(?![aeo])h(?![aeo])"),"",F("(?!^[aeo])h(?!^[aeo])"),""];function Ha(a,b){a&&(a=Da.call(this,a).join(" "),2<a.length&&(a=E(a,Ja)),b||(1<a.length&&(a=ha(a)),a&&(a=a.split(" "))));return a};var La={encode:Ka,F:!1,G:""};const Ma=F("(?!\\b)[aeo]");function Ka(a){a&&(a=Ha.call(this,a,!0),1<a.length&&(a=a.replace(Ma,"")),1<a.length&&(a=ha(a)),a&&(a=a.split(" ")));return a};G["latin:default"]=ja;G["latin:simple"]=Ba;G["latin:balance"]=Ea;G["latin:advanced"]=Ia;G["latin:extra"]=La;const W=self;let Y;const Z={Index:K,Document:Q,Worker:O,registerCharset:function(a,b){G[a]=b},registerLanguage:function(a,b){ka[a]=b}};(Y=W.define)&&Y.amd?Y([],function(){return Z}):W.exports?W.exports=Z:W.FlexSearch=Z;}(this)); | ||
t.search=function(a,b,c,d){c||(!b&&C(a)?(c=a,a=""):C(b)&&(c=b,b=0));let e=[],f=[],g,h,k,m,n,w,q=0;if(c)if(c.constructor===Array)k=c,c=null;else{a=c.query||a;k=(g=c.pluck)||c.index||c.field;m=c.tag;h=this.store&&c.enrich;n="and"===c.bool;b=c.limit||b||100;w=c.offset||0;if(m&&(x(m)&&(m=[m]),!a)){for(let l=0,p;l<m.length;l++)if(p=ya.call(this,m[l],b,w,h))e[e.length]=p,q++;return q?e:[]}x(k)&&(k=[k])}k||(k=this.h);n=n&&(1<k.length||m&&1<m.length);const r=!d&&(this.o||this.async)&&[];for(let l=0,p,z,B;l< | ||
k.length;l++){let A;z=k[l];x(z)||(A=z,z=A.field,a=A.query||a,b=A.limit||b);if(r)r[l]=this.index[z].searchAsync(a,b,A||c);else{d?p=d[l]:p=this.index[z].search(a,b,A||c);B=p&&p.length;if(m&&B){const y=[];let H=0;n&&(y[0]=[p]);for(let X=0,pa,R;X<m.length;X++)if(pa=m[X],B=(R=this.l[pa])&&R.length)H++,y[y.length]=n?[R]:R;H&&(p=n?ma(y,b||100,w||0):na(p,y),B=p.length)}if(B)f[q]=z,e[q++]=p;else if(n)return[]}}if(r){const l=this;return new Promise(function(p){Promise.all(r).then(function(z){p(l.search(a,b, | ||
c,z))})})}if(!q)return[];if(g&&(!h||!this.store))return e[0];for(let l=0,p;l<f.length;l++){p=e[l];p.length&&h&&(p=za.call(this,p));if(g)return p;e[l]={field:f[l],result:p}}return e};function ya(a,b,c,d){let e=this.l[a],f=e&&e.length-c;if(f&&0<f){if(f>b||c)e=e.slice(c,c+b);d&&(e=za.call(this,e));return{tag:a,result:e}}}function za(a){const b=Array(a.length);for(let c=0,d;c<a.length;c++)d=a[c],b[c]={id:d,doc:this.store[d]};return b}t.contain=function(a){return!!this.register[a]};t.get=function(a){return this.store[a]}; | ||
t.set=function(a,b){this.store[a]=b;return this};t.searchCache=oa;t.export=function(a,b,c,d,e){e||(e=0);d||(d=0);if(d<this.h.length){const f=this.h[d],g=this.index[f];b=this;setTimeout(function(){g.export(a,b,e?f:"",d,e++)||(d++,e=1,b.export(a,b,f,d,e))})}else{let f;switch(e){case 1:c="tag";f=this.l;break;case 2:c="store";f=this.store;break;default:return}ra(a,this,c,d,e,f)}}; | ||
t.import=function(a,b){if(b)switch(x(b)&&(b=JSON.parse(b)),a){case "tag":this.l=b;break;case "reg":this.m=!1;this.register=b;for(let d=0,e;d<this.h.length;d++)e=this.index[this.h[d]],e.register=b,e.m=!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)}};la(Q.prototype);var Ba={encode:Aa,F:!1,G:""};const Ca=[F("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",F("[\u00e8\u00e9\u00ea\u00eb]"),"e",F("[\u00ec\u00ed\u00ee\u00ef]"),"i",F("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",F("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",F("[\u00fd\u0177\u00ff]"),"y",F("\u00f1"),"n",F("[\u00e7c]"),"k",F("\u00df"),"s",F(" & ")," and "];function Aa(a){var b=a=""+a;b.normalize&&(b=b.normalize("NFD").replace(ea,""));return ca.call(this,b.toLowerCase(),!a.normalize&&Ca)};var Ea={encode:Da,F:!1,G:"strict"};const Fa=/[^a-z0-9]+/,Ga={b:"p",v:"f",w:"f",z:"s",x:"s","\u00df":"s",d:"t",n:"m",c:"k",g:"k",j:"k",q:"k",i:"e",y:"e",u:"o"};function Da(a){a=Aa.call(this,a).join(" ");const b=[];if(a){const c=a.split(Fa),d=c.length;for(let e=0,f,g=0;e<d;e++)if((a=c[e])&&(!this.filter||!this.filter[a])){f=a[0];let h=Ga[f]||f,k=h;for(let m=1;m<a.length;m++){f=a[m];const n=Ga[f]||f;n&&n!==k&&(h+=n,k=n)}b[g++]=h}}return b};var Ia={encode:Ha,F:!1,G:""};const Ja=[F("ae"),"a",F("oe"),"o",F("sh"),"s",F("th"),"t",F("ph"),"f",F("pf"),"f",F("(?![aeo])h(?![aeo])"),"",F("(?!^[aeo])h(?!^[aeo])"),""];function Ha(a,b){a&&(a=Da.call(this,a).join(" "),2<a.length&&(a=E(a,Ja)),b||(1<a.length&&(a=ha(a)),a&&(a=a.split(" "))));return a||[]};var La={encode:Ka,F:!1,G:""};const Ma=F("(?!\\b)[aeo]");function Ka(a){a&&(a=Ha.call(this,a,!0),1<a.length&&(a=a.replace(Ma,"")),1<a.length&&(a=ha(a)),a&&(a=a.split(" ")));return a||[]};G["latin:default"]=ja;G["latin:simple"]=Ba;G["latin:balance"]=Ea;G["latin:advanced"]=Ia;G["latin:extra"]=La;const W=self;let Y;const Z={Index:K,Document:Q,Worker:O,registerCharset:function(a,b){G[a]=b},registerLanguage:function(a,b){ka[a]=b}};(Y=W.define)&&Y.amd?Y([],function(){return Z}):W.exports?W.exports=Z:W.FlexSearch=Z;}(this)); |
/**! | ||
* FlexSearch.js v0.7.2 (Compact) | ||
* Copyright 2018-2021 Nextapps GmbH | ||
* FlexSearch.js v0.7.3 (Compact) | ||
* Copyright 2018-2022 Nextapps GmbH | ||
* Author: Thomas Wilkerling | ||
@@ -8,21 +8,21 @@ * Licence: Apache-2.0 | ||
*/ | ||
(function(self){'use strict';var t;function v(a){return"undefined"!==typeof a?a:!0}function w(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=z();return b}function z(){return Object.create(null)}function aa(a,b){return b.length-a.length}function C(a){return"string"===typeof a}function D(a){return"object"===typeof a};function E(a,b){var c=ba;if(a&&(b&&(a=F(a,b)),this.H&&(a=F(a,this.H)),this.I&&1<a.length&&(a=F(a,this.I)),c||""===c)){a=a.split(c);if(this.filter){b=this.filter;c=a.length;const e=[];for(let d=0,f=0;d<c;d++){const g=a[d];g&&!b[g]&&(e[f++]=g)}a=e}return a}return a}const ba=/[\p{Z}\p{S}\p{P}\p{C}]+/u,ca=/[\u0300-\u036f]/g; | ||
function H(a,b){const c=Object.keys(a),e=c.length,d=[];let f="",g=0;for(let h=0,k,m;h<e;h++)k=c[h],(m=a[k])?(d[g++]=I(b?"(?!\\b)"+k+"(\\b|_)":k),d[g++]=m):f+=(f?"|":"")+k;f&&(d[g++]=I(b?"(?!\\b)("+f+")(\\b|_)":"("+f+")"),d[g]="");return d}function F(a,b){for(let c=0,e=b.length;c<e&&(a=a.replace(b[c],b[c+1]),a);c+=2);return a}function I(a){return new RegExp(a,"g")}function J(a){let b="",c="";for(let e=0,d=a.length,f;e<d;e++)(f=a[e])!==c&&(b+=c=f);return b};var da={encode:K,B:!1,C:""};function K(a){return E.call(this,a.toLowerCase(),!1)};const ea={},L={};function fa(a){M(a,"add");M(a,"append");M(a,"search");M(a,"update");M(a,"remove")}function M(a,b){a[b+"Async"]=function(){const c=this,e=arguments;var d=e[e.length-1];let f;"function"===typeof d&&(f=d,delete e[e.length-1]);d=new Promise(function(g){setTimeout(function(){c.async=!0;const h=c[b].apply(c,e);c.async=!1;g(h)})});return f?(d.then(f),this):d}};function ha(a,b,c,e){const d=a.length;let f=[],g,h,k=0;e&&(e=[]);for(let m=d-1;0<=m;m--){const n=a[m],u=n.length,q=z();let r=!g;for(let l=0;l<u;l++){const p=n[l],y=p.length;if(y)for(let B=0,A,x;B<y;B++)if(x=p[B],g){if(g[x]){if(!m)if(c)c--;else if(f[k++]=x,k===b)return f;if(m||e)q[x]=1;r=!0}if(e&&(h[x]=(A=h[x])?++A:A=1,A<d)){const G=e[A-2]||(e[A-2]=[]);G[G.length]=x}}else q[x]=1}if(e)g||(h=q);else if(!r)return[];g=q}if(e)for(let m=e.length-1,n,u;0<=m;m--){n=e[m];u=n.length;for(let q=0,r;q<u;q++)if(r= | ||
n[q],!g[r]){if(c)c--;else if(f[k++]=r,k===b)return f;g[r]=1}}return f}function ja(a,b){const c=z(),e=z(),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[d.length]=k)}return d};const ka={memory:{charset:"latin:extra",A:3,m:4,D:!1},performance:{A:3,m:3,s:!1,context:{depth:2,A:1}},match:{charset:"latin:extra",C:"reverse"},score:{charset:"latin:advanced",A:20,m:3,context:{depth:3,A:9}},"default":{}};function O(a,b){if(!(this instanceof O))return new O(a);var c;let e;a?(C(a)?a=ka[a]:(c=a.preset)&&(a=Object.assign({},c[c],a)),c=a.charset,e=a.lang,C(c)&&(-1===c.indexOf(":")&&(c+=":default"),c=L[c]),C(e)&&(e=ea[e])):a={};let d,f,g=a.context||{};this.encode=a.encode||c&&c.encode||K;this.register=b||z();this.A=d=a.resolution||9;this.C=b=c&&c.C||a.tokenize||"strict";this.depth="strict"===b&&g.depth;this.l=v(g.bidirectional);this.s=f=v(a.optimize);this.D=v(a.fastupdate);this.m=a.minlength||1;this.G= | ||
a.boost;this.h=f?w(d):z();this.F=d=g.resolution||1;this.o=f?w(d):z();this.B=c&&c.B||a.rtl;this.H=(b=a.matcher||e&&e.H)&&H(b,!1);this.I=(b=a.stemmer||e&&e.I)&&H(b,!0);if(a=b=a.filter||e&&e.filter){a=b;c=z();for(let h=0,k=a.length;h<k;h++)c[a[h]]=1;a=c}this.filter=a}t=O.prototype;t.append=function(a,b){return this.add(a,b,!0)}; | ||
t.add=function(a,b,c,e){if(b&&(a||0===a)){if(!e&&!c&&this.register[a])return this.update(a,b);b=this.encode(b);if(e=b.length){const m=z(),n=z(),u=this.depth,q=this.A;for(let r=0;r<e;r++){let l=b[this.B?e-1-r:r];var d=l.length;if(l&&d>=this.m&&(u||!n[l])){var f=P(q,e,r),g="";switch(this.C){case "full":if(3<d){for(f=0;f<d;f++)for(var h=d;h>f;h--)if(h-f>=this.m){var k=P(q,e,r,d,f);g=l.substring(f,h);Q(this,n,g,k,a,c)}break}case "reverse":if(2<d){for(h=d-1;0<h;h--)g=l[h]+g,g.length>=this.m&&Q(this,n, | ||
g,P(q,e,r,d,h),a,c);g=""}case "forward":if(1<d){for(h=0;h<d;h++)g+=l[h],g.length>=this.m&&Q(this,n,g,f,a,c);break}default:if(this.G&&(f=Math.min(f/this.G(b,l,r)|0,q-1)),Q(this,n,l,f,a,c),u&&1<e&&r<e-1)for(d=z(),g=this.F,f=l,h=Math.min(u+1,e-r),d[f]=1,k=1;k<h;k++)if((l=b[this.B?e-1-r-k:r+k])&&l.length>=this.m&&!d[l]){d[l]=1;const p=this.l&&l>f;Q(this,m,p?f:l,P(g+(e/2>g?0:1),e,r,h-1,k-1),a,c,p?l:f)}}}}this.D||(this.register[a]=1)}}return this}; | ||
function P(a,b,c,e,d){return c&&1<a?b+(e||0)<=a?c+(d||0):(a-1)/(b+(e||0))*(c+(d||0))+1|0:0}function Q(a,b,c,e,d,f,g){let h=g?a.o:a.h;if(!b[c]||g&&!b[c][g])a.s&&(h=h[e]),g?(b=b[c]||(b[c]=z()),b[g]=1,h=h[g]||(h[g]=z())):b[c]=1,h=h[c]||(h[c]=[]),a.s||(h=h[e]||(h[e]=[])),f&&-1!==h.indexOf(d)||(h[h.length]=d,a.D&&(a=a.register[d]||(a.register[d]=[]),a[a.length]=h))} | ||
t.search=function(a,b,c){c||(!b&&D(a)?(c=a,a=c.query):D(b)&&(c=b));let e=[],d;let f,g=0;if(c){b=c.limit;g=c.offset||0;var h=c.context;f=c.suggest}if(a&&(a=this.encode(a),d=a.length,1<d)){c=z();var k=[];for(let n=0,u=0,q;n<d;n++)if((q=a[n])&&q.length>=this.m&&!c[q])if(this.s||f||this.h[q])k[u++]=q,c[q]=1;else return e;a=k;d=a.length}if(!d)return e;b||(b=100);h=this.depth&&1<d&&!1!==h;c=0;let m;h?(m=a[0],c=1):1<d&&a.sort(aa);for(let n,u;c<d;c++){u=a[c];h?(n=la(this,e,f,b,g,2===d,u,m),f&&!1===n&&e.length|| | ||
(m=u)):n=la(this,e,f,b,g,1===d,u);if(n)return n;if(f&&c===d-1){k=e.length;if(!k){if(h){h=0;c=-1;continue}return e}if(1===k)return ma(e[0],b,g)}}return ha(e,b,g,f)}; | ||
function la(a,b,c,e,d,f,g,h){let k=[],m=h?a.o:a.h;a.s||(m=na(m,g,h,a.l));if(m){let n=0;const u=Math.min(m.length,h?a.F:a.A);for(let q=0,r=0,l,p;q<u;q++)if(l=m[q])if(a.s&&(l=na(l,g,h,a.l)),d&&l&&f&&(p=l.length,p<=d?(d-=p,l=null):(l=l.slice(d),d=0)),l&&(k[n++]=l,f&&(r+=l.length,r>=e)))break;if(n){if(f)return ma(k,e,0);b[b.length]=k;return}}return!c&&k}function ma(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} | ||
function na(a,b,c,e){c?(e=e&&b>c,a=(a=a[e?b:c])&&a[e?c:b]):a=a[b];return a}t.contain=function(a){return!!this.register[a]};t.update=function(a,b){return this.remove(a).add(a,b)};t.remove=function(a,b){const c=this.register[a];if(c){if(this.D)for(let e=0,d;e<c.length;e++)d=c[e],d.splice(d.indexOf(a),1);else R(this.h,a,this.A,this.s),this.depth&&R(this.o,a,this.F,this.s);b||delete this.register[a]}return this}; | ||
function R(a,b,c,e,d){let f=0;if(a.constructor===Array)if(d)b=a.indexOf(b),-1!==b?1<a.length&&(a.splice(b,1),f++):f++;else{d=Math.min(a.length,c);for(let g=0,h;g<d;g++)if(h=a[g])f=R(h,b,c,e,d),e||f||delete a[g]}else for(let g in a)(f=R(a[g],b,c,e,d))||delete a[g];return f}fa(O.prototype);function T(a){if(!(this instanceof T))return new T(a);var b=a.document||a.doc||a,c;this.F=[];this.h=[];this.o=[];this.register=z();this.key=(c=b.key||b.id)&&U(c,this.o)||"id";this.D=v(a.fastupdate);this.l=(c=b.store)&&!0!==c&&[];this.store=c&&z();this.async=!1;c=z();let e=b.index||b.field||b;C(e)&&(e=[e]);for(let d=0,f,g;d<e.length;d++)f=e[d],C(f)||(g=f,f=f.field),g=D(g)?Object.assign({},a,g):a,this.G||(c[f]=new O(g,this.register)),this.F[d]=U(f,this.o),this.h[d]=f;if(this.l)for(a=b.store,C(a)&&(a= | ||
(function(self){'use strict';var t;function v(a){return"undefined"!==typeof a?a:!0}function w(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=y();return b}function y(){return Object.create(null)}function aa(a,b){return b.length-a.length}function C(a){return"string"===typeof a}function D(a){return"object"===typeof a};function E(a,b){var c=ba;if(a&&(b&&(a=F(a,b)),this.G&&(a=F(a,this.G)),this.H&&1<a.length&&(a=F(a,this.H)),c||""===c)){a=a.split(c);if(this.filter){b=this.filter;c=a.length;const e=[];for(let d=0,f=0;d<c;d++){const g=a[d];g&&!b[g]&&(e[f++]=g)}a=e}return a}return a}const ba=/[\p{Z}\p{S}\p{P}\p{C}]+/u,ca=/[\u0300-\u036f]/g; | ||
function H(a,b){const c=Object.keys(a),e=c.length,d=[];let f="",g=0;for(let h=0,k,m;h<e;h++)k=c[h],(m=a[k])?(d[g++]=I(b?"(?!\\b)"+k+"(\\b|_)":k),d[g++]=m):f+=(f?"|":"")+k;f&&(d[g++]=I(b?"(?!\\b)("+f+")(\\b|_)":"("+f+")"),d[g]="");return d}function F(a,b){for(let c=0,e=b.length;c<e&&(a=a.replace(b[c],b[c+1]),a);c+=2);return a}function I(a){return new RegExp(a,"g")}function J(a){let b="",c="";for(let e=0,d=a.length,f;e<d;e++)(f=a[e])!==c&&(b+=c=f);return b};var da={encode:K,B:!1,C:""};function K(a){return E.call(this,(""+a).toLowerCase(),!1)};const ea={},L={};function fa(a){M(a,"add");M(a,"append");M(a,"search");M(a,"update");M(a,"remove")}function M(a,b){a[b+"Async"]=function(){const c=this,e=arguments;var d=e[e.length-1];let f;"function"===typeof d&&(f=d,delete e[e.length-1]);d=new Promise(function(g){setTimeout(function(){c.async=!0;const h=c[b].apply(c,e);c.async=!1;g(h)})});return f?(d.then(f),this):d}};function ha(a,b,c,e){const d=a.length;let f=[],g,h,k=0;e&&(e=[]);for(let m=d-1;0<=m;m--){const n=a[m],u=n.length,q=y();let r=!g;for(let l=0;l<u;l++){const p=n[l],z=p.length;if(z)for(let B=0,A,x;B<z;B++)if(x=p[B],g){if(g[x]){if(!m)if(c)c--;else if(f[k++]=x,k===b)return f;if(m||e)q[x]=1;r=!0}if(e&&(A=(h[x]||0)+1,h[x]=A,A<d)){const G=e[A-2]||(e[A-2]=[]);G[G.length]=x}}else q[x]=1}if(e)g||(h=q);else if(!r)return[];g=q}if(e)for(let m=e.length-1,n,u;0<=m;m--){n=e[m];u=n.length;for(let q=0,r;q<u;q++)if(r= | ||
n[q],!g[r]){if(c)c--;else if(f[k++]=r,k===b)return f;g[r]=1}}return f}function ja(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[d.length]=k)}return d};const ka={memory:{charset:"latin:extra",A:3,m:4,D:!1},performance:{A:3,m:3,s:!1,context:{depth:2,A:1}},match:{charset:"latin:extra",C:"reverse"},score:{charset:"latin:advanced",A:20,m:3,context:{depth:3,A:9}},"default":{}};function O(a,b){if(!(this instanceof O))return new O(a);var c;let e;a?(C(a)?a=ka[a]:(c=a.preset)&&(a=Object.assign({},c[c],a)),c=a.charset,e=a.lang,C(c)&&(-1===c.indexOf(":")&&(c+=":default"),c=L[c]),C(e)&&(e=ea[e])):a={};let d,f,g=a.context||{};this.encode=a.encode||c&&c.encode||K;this.register=b||y();this.A=d=a.resolution||9;this.C=b=c&&c.C||a.tokenize||"strict";this.depth="strict"===b&&g.depth;this.h=v(g.bidirectional);this.s=f=v(a.optimize);this.D=v(a.fastupdate);this.m=a.minlength||1;this.F= | ||
a.boost;this.map=f?w(d):y();this.o=d=g.resolution||1;this.l=f?w(d):y();this.B=c&&c.B||a.rtl;this.G=(b=a.matcher||e&&e.G)&&H(b,!1);this.H=(b=a.stemmer||e&&e.H)&&H(b,!0);if(a=b=a.filter||e&&e.filter){a=b;c=y();for(let h=0,k=a.length;h<k;h++)c[a[h]]=1;a=c}this.filter=a}t=O.prototype;t.append=function(a,b){return this.add(a,b,!0)}; | ||
t.add=function(a,b,c,e){if(b&&(a||0===a)){if(!e&&!c&&this.register[a])return this.update(a,b);b=this.encode(b);if(e=b.length){const m=y(),n=y(),u=this.depth,q=this.A;for(let r=0;r<e;r++){let l=b[this.B?e-1-r:r];var d=l.length;if(l&&d>=this.m&&(u||!n[l])){var f=P(q,e,r),g="";switch(this.C){case "full":if(2<d){for(f=0;f<d;f++)for(var h=d;h>f;h--)if(h-f>=this.m){var k=P(q,e,r,d,f);g=l.substring(f,h);Q(this,n,g,k,a,c)}break}case "reverse":if(1<d){for(h=d-1;0<h;h--)g=l[h]+g,g.length>=this.m&&Q(this,n, | ||
g,P(q,e,r,d,h),a,c);g=""}case "forward":if(1<d){for(h=0;h<d;h++)g+=l[h],g.length>=this.m&&Q(this,n,g,f,a,c);break}default:if(this.F&&(f=Math.min(f/this.F(b,l,r)|0,q-1)),Q(this,n,l,f,a,c),u&&1<e&&r<e-1)for(d=y(),g=this.o,f=l,h=Math.min(u+1,e-r),d[f]=1,k=1;k<h;k++)if((l=b[this.B?e-1-r-k:r+k])&&l.length>=this.m&&!d[l]){d[l]=1;const p=this.h&&l>f;Q(this,m,p?f:l,P(g+(e/2>g?0:1),e,r,h-1,k-1),a,c,p?l:f)}}}}this.D||(this.register[a]=1)}}return this}; | ||
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 Q(a,b,c,e,d,f,g){let h=g?a.l:a.map;if(!b[c]||g&&!b[c][g])a.s&&(h=h[e]),g?(b=b[c]||(b[c]=y()),b[g]=1,h=h[g]||(h[g]=y())):b[c]=1,h=h[c]||(h[c]=[]),a.s||(h=h[e]||(h[e]=[])),f&&h.includes(d)||(h[h.length]=d,a.D&&(a=a.register[d]||(a.register[d]=[]),a[a.length]=h))} | ||
t.search=function(a,b,c){c||(!b&&D(a)?(c=a,a=c.query):D(b)&&(c=b));let e=[],d;let f,g=0;if(c){a=c.query||a;b=c.limit;g=c.offset||0;var h=c.context;f=c.suggest}if(a&&(a=this.encode(""+a),d=a.length,1<d)){c=y();var k=[];for(let n=0,u=0,q;n<d;n++)if((q=a[n])&&q.length>=this.m&&!c[q])if(this.s||f||this.map[q])k[u++]=q,c[q]=1;else return e;a=k;d=a.length}if(!d)return e;b||(b=100);h=this.depth&&1<d&&!1!==h;c=0;let m;h?(m=a[0],c=1):1<d&&a.sort(aa);for(let n,u;c<d;c++){u=a[c];h?(n=la(this,e,f,b,g,2===d,u, | ||
m),f&&!1===n&&e.length||(m=u)):n=la(this,e,f,b,g,1===d,u);if(n)return n;if(f&&c===d-1){k=e.length;if(!k){if(h){h=0;c=-1;continue}return e}if(1===k)return ma(e[0],b,g)}}return ha(e,b,g,f)}; | ||
function la(a,b,c,e,d,f,g,h){let k=[],m=h?a.l:a.map;a.s||(m=na(m,g,h,a.h));if(m){let n=0;const u=Math.min(m.length,h?a.o:a.A);for(let q=0,r=0,l,p;q<u;q++)if(l=m[q])if(a.s&&(l=na(l,g,h,a.h)),d&&l&&f&&(p=l.length,p<=d?(d-=p,l=null):(l=l.slice(d),d=0)),l&&(k[n++]=l,f&&(r+=l.length,r>=e)))break;if(n){if(f)return ma(k,e,0);b[b.length]=k;return}}return!c&&k}function ma(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} | ||
function na(a,b,c,e){c?(e=e&&b>c,a=(a=a[e?b:c])&&a[e?c:b]):a=a[b];return a}t.contain=function(a){return!!this.register[a]};t.update=function(a,b){return this.remove(a).add(a,b)};t.remove=function(a,b){const c=this.register[a];if(c){if(this.D)for(let e=0,d;e<c.length;e++)d=c[e],d.splice(d.indexOf(a),1);else R(this.map,a,this.A,this.s),this.depth&&R(this.l,a,this.o,this.s);b||delete this.register[a]}return this}; | ||
function R(a,b,c,e,d){let f=0;if(a.constructor===Array)if(d)b=a.indexOf(b),-1!==b?1<a.length&&(a.splice(b,1),f++):f++;else{d=Math.min(a.length,c);for(let g=0,h;g<d;g++)if(h=a[g])f=R(h,b,c,e,d),e||f||delete a[g]}else for(let g in a)(f=R(a[g],b,c,e,d))||delete a[g];return f}fa(O.prototype);function T(a){if(!(this instanceof T))return new T(a);var b=a.document||a.doc||a,c;this.F=[];this.h=[];this.o=[];this.register=y();this.key=(c=b.key||b.id)&&U(c,this.o)||"id";this.D=v(a.fastupdate);this.l=(c=b.store)&&!0!==c&&[];this.store=c&&y();this.async=!1;c=y();let e=b.index||b.field||b;C(e)&&(e=[e]);for(let d=0,f,g;d<e.length;d++)f=e[d],C(f)||(g=f,f=f.field),g=D(g)?Object.assign({},a,g):a,this.I||(c[f]=new O(g,this.register)),this.F[d]=U(f,this.o),this.h[d]=f;if(this.l)for(a=b.store,C(a)&&(a= | ||
[a]),b=0;b<a.length;b++)this.l[b]=U(a[b],this.o);this.index=c}function U(a,b){const c=a.split(":");let e=0;for(let d=0;d<c.length;d++)a=c[d],0<=a.indexOf("[]")&&(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]}function oa(a,b){if(C(b))a=a[b];else for(let c=0;a&&c<b.length;c++)a=a[b[c]];return a} | ||
function V(a,b,c,e,d){a=a[d];if(e===c.length-1)b[d]=a;else if(a)if(a.constructor===Array)for(b=b[d]=Array(a.length),d=0;d<a.length;d++)V(a,b,c,e,d);else b=b[d]||(b[d]=z()),d=c[++e],V(a,b,c,e,d)}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)}t=T.prototype; | ||
t.add=function(a,b,c){D(a)&&(b=a,a=oa(b,this.key));if(b&&(a||0===a)){if(!c&&this.register[a])return this.update(a,b);for(let e=0,d,f;e<this.h.length;e++)f=this.h[e],d=this.F[e],C(d)&&(d=[d]),W(b,d,this.o,0,this.index[f],a,d[0],c);if(this.store&&(!c||!this.store[a])){let e;if(this.l){e=z();for(let d=0,f;d<this.l.length;d++)f=this.l[d],C(f)?e[f]=b[f]:V(b,e,f,0,f[0])}this.store[a]=e||b}}return this};t.append=function(a,b){return this.add(a,b,!0)};t.update=function(a,b){return this.remove(a).add(a,b)}; | ||
t.remove=function(a){D(a)&&(a=oa(a,this.key));if(this.register[a]){for(let b=0;b<this.h.length&&(this.index[this.h[b]].remove(a,!this.G),!this.D);b++);this.store&&delete this.store[a];delete this.register[a]}return this}; | ||
t.search=function(a,b,c,e){c||(!b&&D(a)?(c=a,a=c.query):D(b)&&(c=b,b=0));let d=[],f=[],g,h,k,m,n,u,q=0;if(c)if(c.constructor===Array)k=c,c=null;else{k=(g=c.pluck)||c.index||c.field;m=!1;h=this.store&&c.enrich;n="and"===c.bool;b=c.limit||100;u=c.offset||0;if(m&&(C(m)&&(m=[m]),!a)){for(let l=0,p;l<m.length;l++)if(p=pa.call(this,m[l],b,u,h))d[d.length]=p,q++;return q?d:[]}C(k)&&(k=[k])}k||(k=this.h);n=n&&(1<k.length||m&&1<m.length);const r=!e&&(this.G||this.async)&&[];for(let l=0,p,y,B;l<k.length;l++){let A; | ||
y=k[l];C(y)||(A=y,y=y.field);if(r)r[l]=this.index[y].searchAsync(a,b,A||c);else{e?p=e[l]:p=this.index[y].search(a,b,A||c);B=p&&p.length;if(m&&B){const x=[];let G=0;n&&(x[0]=[p]);for(let S=0,ia,N;S<m.length;S++)if(ia=m[S],B=(N=this.J[ia])&&N.length)G++,x[x.length]=n?[N]:N;G&&(p=n?ha(x,b||100,u||0):ja(p,x),B=p.length)}if(B)f[q]=y,d[q++]=p;else if(n)return[]}}if(r){const l=this;return new Promise(function(p){Promise.all(r).then(function(y){p(l.search(a,b,c,y))})})}if(!q)return[];if(g&&(!h||!this.store))return d[0]; | ||
for(let l=0,p;l<f.length;l++){p=d[l];p.length&&h&&(p=qa.call(this,p));if(g)return p;d[l]={field:f[l],result:p}}return d};function pa(a,b,c,e){let d=this.J[a],f=d&&d.length-c;if(f&&0<f){if(f>b||c)d=d.slice(c,c+b);e&&(d=qa.call(this,d));return{tag:a,result:d}}}function qa(a){const b=Array(a.length);for(let c=0,e;c<a.length;c++)e=a[c],b[c]={id:e,doc:this.store[e]};return b}t.contain=function(a){return!!this.register[a]};t.get=function(a){return this.store[a]};t.set=function(a,b){this.store[a]=b;return this}; | ||
fa(T.prototype);var sa={encode:ra,B:!1,C:""};const ta=[I("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",I("[\u00e8\u00e9\u00ea\u00eb]"),"e",I("[\u00ec\u00ed\u00ee\u00ef]"),"i",I("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",I("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",I("[\u00fd\u0177\u00ff]"),"y",I("\u00f1"),"n",I("[\u00e7c]"),"k",I("\u00df"),"s",I(" & ")," and "];function ra(a){var b=a;b.normalize&&(b=b.normalize("NFD").replace(ca,""));return E.call(this,b.toLowerCase(),!a.normalize&&ta)};var va={encode:ua,B:!1,C:"strict"};const wa=/[^a-z0-9]+/,xa={b:"p",v:"f",w:"f",z:"s",x:"s","\u00df":"s",d:"t",n:"m",c:"k",g:"k",j:"k",q:"k",i:"e",y:"e",u:"o"};function ua(a){a=ra.call(this,a).join(" ");const b=[];if(a){const c=a.split(wa),e=c.length;for(let d=0,f,g=0;d<e;d++)if((a=c[d])&&(!this.filter||!this.filter[a])){f=a[0];let h=xa[f]||f,k=h;for(let m=1;m<a.length;m++){f=a[m];const n=xa[f]||f;n&&n!==k&&(h+=n,k=n)}b[g++]=h}}return b};var za={encode:ya,B:!1,C:""};const Aa=[I("ae"),"a",I("oe"),"o",I("sh"),"s",I("th"),"t",I("ph"),"f",I("pf"),"f",I("(?![aeo])h(?![aeo])"),"",I("(?!^[aeo])h(?!^[aeo])"),""];function ya(a,b){a&&(a=ua.call(this,a).join(" "),2<a.length&&(a=F(a,Aa)),b||(1<a.length&&(a=J(a)),a&&(a=a.split(" "))));return a};var Ca={encode:Ba,B:!1,C:""};const Da=I("(?!\\b)[aeo]");function Ba(a){a&&(a=ya.call(this,a,!0),1<a.length&&(a=a.replace(Da,"")),1<a.length&&(a=J(a)),a&&(a=a.split(" ")));return a};L["latin:default"]=da;L["latin:simple"]=sa;L["latin:balance"]=va;L["latin:advanced"]=za;L["latin:extra"]=Ca;const X=self;let Y;const Z={Index:O,Document:T,Worker:null,registerCharset:function(a,b){L[a]=b},registerLanguage:function(a,b){ea[a]=b}};(Y=X.define)&&Y.amd?Y([],function(){return Z}):X.exports?X.exports=Z:X.FlexSearch=Z;}(this)); | ||
function V(a,b,c,e,d){a=a[d];if(e===c.length-1)b[d]=a;else if(a)if(a.constructor===Array)for(b=b[d]=Array(a.length),d=0;d<a.length;d++)V(a,b,c,e,d);else b=b[d]||(b[d]=y()),d=c[++e],V(a,b,c,e,d)}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)}t=T.prototype; | ||
t.add=function(a,b,c){D(a)&&(b=a,a=oa(b,this.key));if(b&&(a||0===a)){if(!c&&this.register[a])return this.update(a,b);for(let e=0,d,f;e<this.h.length;e++)f=this.h[e],d=this.F[e],C(d)&&(d=[d]),W(b,d,this.o,0,this.index[f],a,d[0],c);if(this.store&&(!c||!this.store[a])){let e;if(this.l){e=y();for(let d=0,f;d<this.l.length;d++)f=this.l[d],C(f)?e[f]=b[f]:V(b,e,f,0,f[0])}this.store[a]=e||b}}return this};t.append=function(a,b){return this.add(a,b,!0)};t.update=function(a,b){return this.remove(a).add(a,b)}; | ||
t.remove=function(a){D(a)&&(a=oa(a,this.key));if(this.register[a]){for(let b=0;b<this.h.length&&(this.index[this.h[b]].remove(a,!this.I),!this.D);b++);this.store&&delete this.store[a];delete this.register[a]}return this}; | ||
t.search=function(a,b,c,e){c||(!b&&D(a)?(c=a,a=""):D(b)&&(c=b,b=0));let d=[],f=[],g,h,k,m,n,u,q=0;if(c)if(c.constructor===Array)k=c,c=null;else{a=c.query||a;k=(g=c.pluck)||c.index||c.field;m=!1;h=this.store&&c.enrich;n="and"===c.bool;b=c.limit||b||100;u=c.offset||0;if(m&&(C(m)&&(m=[m]),!a)){for(let l=0,p;l<m.length;l++)if(p=pa.call(this,m[l],b,u,h))d[d.length]=p,q++;return q?d:[]}C(k)&&(k=[k])}k||(k=this.h);n=n&&(1<k.length||m&&1<m.length);const r=!e&&(this.I||this.async)&&[];for(let l=0,p,z,B;l< | ||
k.length;l++){let A;z=k[l];C(z)||(A=z,z=A.field,a=A.query||a,b=A.limit||b);if(r)r[l]=this.index[z].searchAsync(a,b,A||c);else{e?p=e[l]:p=this.index[z].search(a,b,A||c);B=p&&p.length;if(m&&B){const x=[];let G=0;n&&(x[0]=[p]);for(let S=0,ia,N;S<m.length;S++)if(ia=m[S],B=(N=this.J[ia])&&N.length)G++,x[x.length]=n?[N]:N;G&&(p=n?ha(x,b||100,u||0):ja(p,x),B=p.length)}if(B)f[q]=z,d[q++]=p;else if(n)return[]}}if(r){const l=this;return new Promise(function(p){Promise.all(r).then(function(z){p(l.search(a,b, | ||
c,z))})})}if(!q)return[];if(g&&(!h||!this.store))return d[0];for(let l=0,p;l<f.length;l++){p=d[l];p.length&&h&&(p=qa.call(this,p));if(g)return p;d[l]={field:f[l],result:p}}return d};function pa(a,b,c,e){let d=this.J[a],f=d&&d.length-c;if(f&&0<f){if(f>b||c)d=d.slice(c,c+b);e&&(d=qa.call(this,d));return{tag:a,result:d}}}function qa(a){const b=Array(a.length);for(let c=0,e;c<a.length;c++)e=a[c],b[c]={id:e,doc:this.store[e]};return b}t.contain=function(a){return!!this.register[a]};t.get=function(a){return this.store[a]}; | ||
t.set=function(a,b){this.store[a]=b;return this};fa(T.prototype);var sa={encode:ra,B:!1,C:""};const ta=[I("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",I("[\u00e8\u00e9\u00ea\u00eb]"),"e",I("[\u00ec\u00ed\u00ee\u00ef]"),"i",I("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",I("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",I("[\u00fd\u0177\u00ff]"),"y",I("\u00f1"),"n",I("[\u00e7c]"),"k",I("\u00df"),"s",I(" & ")," and "];function ra(a){var b=a=""+a;b.normalize&&(b=b.normalize("NFD").replace(ca,""));return E.call(this,b.toLowerCase(),!a.normalize&&ta)};var va={encode:ua,B:!1,C:"strict"};const wa=/[^a-z0-9]+/,xa={b:"p",v:"f",w:"f",z:"s",x:"s","\u00df":"s",d:"t",n:"m",c:"k",g:"k",j:"k",q:"k",i:"e",y:"e",u:"o"};function ua(a){a=ra.call(this,a).join(" ");const b=[];if(a){const c=a.split(wa),e=c.length;for(let d=0,f,g=0;d<e;d++)if((a=c[d])&&(!this.filter||!this.filter[a])){f=a[0];let h=xa[f]||f,k=h;for(let m=1;m<a.length;m++){f=a[m];const n=xa[f]||f;n&&n!==k&&(h+=n,k=n)}b[g++]=h}}return b};var za={encode:ya,B:!1,C:""};const Aa=[I("ae"),"a",I("oe"),"o",I("sh"),"s",I("th"),"t",I("ph"),"f",I("pf"),"f",I("(?![aeo])h(?![aeo])"),"",I("(?!^[aeo])h(?!^[aeo])"),""];function ya(a,b){a&&(a=ua.call(this,a).join(" "),2<a.length&&(a=F(a,Aa)),b||(1<a.length&&(a=J(a)),a&&(a=a.split(" "))));return a||[]};var Ca={encode:Ba,B:!1,C:""};const Da=I("(?!\\b)[aeo]");function Ba(a){a&&(a=ya.call(this,a,!0),1<a.length&&(a=a.replace(Da,"")),1<a.length&&(a=J(a)),a&&(a=a.split(" ")));return a||[]};L["latin:default"]=da;L["latin:simple"]=sa;L["latin:balance"]=va;L["latin:advanced"]=za;L["latin:extra"]=Ca;const X=self;let Y;const Z={Index:O,Document:T,Worker:null,registerCharset:function(a,b){L[a]=b},registerLanguage:function(a,b){ea[a]=b}};(Y=X.define)&&Y.amd?Y([],function(){return Z}):X.exports?X.exports=Z:X.FlexSearch=Z;}(this)); |
/**! | ||
* FlexSearch.js v0.7.2 (Debug) | ||
* Copyright 2018-2021 Nextapps GmbH | ||
* FlexSearch.js v0.7.3 (Debug) | ||
* Copyright 2018-2022 Nextapps GmbH | ||
* Author: Thomas Wilkerling | ||
@@ -78,3 +78,3 @@ * Licence: Apache-2.0 | ||
function fa(a) { | ||
return ba.call(this, a.toLowerCase(), !1, ca, !1); | ||
return ba.call(this, ("" + a).toLowerCase(), !1, ca, !1); | ||
} | ||
@@ -133,3 +133,3 @@ ;const ia = {}, I = {}; | ||
} | ||
if (d && (h[A] = (B = h[A]) ? ++B : B = 1, B < e)) { | ||
if (d && (B = (h[A] || 0) + 1, h[A] = B, B < e)) { | ||
const H = d[B - 2] || (d[B - 2] = []); | ||
@@ -146,6 +146,4 @@ H[H.length] = A; | ||
g || (h = q); | ||
} else { | ||
if (!n) { | ||
return []; | ||
} | ||
} else if (!n) { | ||
return []; | ||
} | ||
@@ -220,6 +218,6 @@ g = q; | ||
for (let b = 0, c, d; b < this.queue.length; b++) { | ||
d = this.queue[b], c = this.cache[d], -1 !== c.indexOf(a) && (this.queue.splice(b--, 1), delete this.cache[d]); | ||
d = this.queue[b], c = this.cache[d], c.includes(a) && (this.queue.splice(b--, 1), delete this.cache[d]); | ||
} | ||
}; | ||
const na = {memory:{charset:"latin:extra", resolution:3, minlength:4, fastupdate:!1}, performance:{resolution:3, minlength:3, optimize:!1, context:{depth:2, resolution:1}}, match:{charset:"latin:extra", tokenize:"reverse", }, score:{charset:"latin:advanced", resolution:20, minlength:3, context:{depth:3, resolution:9, }}, "default":{}, }; | ||
const na = {memory:{charset:"latin:extra", resolution:3, minlength:4, fastupdate:!1}, performance:{resolution:3, minlength:3, optimize:!1, context:{depth:2, resolution:1}}, match:{charset:"latin:extra", tokenize:"reverse",}, score:{charset:"latin:advanced", resolution:20, minlength:3, context:{depth:3, resolution:9,}}, "default":{},}; | ||
function pa(a, b, c, d, e, f) { | ||
@@ -289,3 +287,3 @@ setTimeout(function() { | ||
} | ||
b = this.encode(b); | ||
b = this.encode("" + b); | ||
if (d = b.length) { | ||
@@ -300,3 +298,3 @@ const m = w(), p = w(), u = this.depth, q = this.resolution; | ||
case "full": | ||
if (3 < e) { | ||
if (2 < e) { | ||
for (f = 0; f < e; f++) { | ||
@@ -314,3 +312,3 @@ for (var h = e; h > f; h--) { | ||
case "reverse": | ||
if (2 < e) { | ||
if (1 < e) { | ||
for (h = e - 1; 0 < h; h--) { | ||
@@ -352,3 +350,3 @@ g = l[h] + g, g.length >= this.minlength && (k = M(q, d, n, e, h), this.push_index(p, g, k, a, c)); | ||
if (!a[b] || f && !a[b][f]) { | ||
this.optimize && (g = g[c]), f ? (a = a[b] || (a[b] = w()), a[f] = 1, g = g[f] || (g[f] = w())) : a[b] = 1, g = g[b] || (g[b] = []), this.optimize || (g = g[c] || (g[c] = [])), e && -1 !== g.indexOf(d) || (g[g.length] = d, this.fastupdate && (a = this.register[d] || (this.register[d] = []), a[a.length] = g)); | ||
this.optimize && (g = g[c]), f ? (a = a[b] || (a[b] = w()), a[f] = 1, g = g[f] || (g[f] = w())) : a[b] = 1, g = g[b] || (g[b] = []), this.optimize || (g = g[c] || (g[c] = [])), e && g.includes(d) || (g[g.length] = d, this.fastupdate && (a = this.register[d] || (this.register[d] = []), a[a.length] = g)); | ||
} | ||
@@ -361,2 +359,3 @@ }; | ||
if (c) { | ||
a = c.query || a; | ||
b = c.limit; | ||
@@ -367,3 +366,3 @@ g = c.offset || 0; | ||
} | ||
if (a && (a = this.encode(a), e = a.length, 1 < e)) { | ||
if (a && (a = this.encode("" + a), e = a.length, 1 < e)) { | ||
c = w(); | ||
@@ -564,3 +563,3 @@ var k = []; | ||
(b = (self || window)._factory) && (b = b.toString()); | ||
const c = self.exports, d = this; | ||
const c = "undefined" === typeof window && self.exports, d = this; | ||
this.worker = ua(b, c, a.worker); | ||
@@ -667,11 +666,9 @@ this.resolver = w(); | ||
b[e] = a; | ||
} else { | ||
if (a) { | ||
if (a.constructor === Array) { | ||
for (b = b[e] = Array(a.length), e = 0; e < a.length; e++) { | ||
U(a, b, c, d, e); | ||
} | ||
} else { | ||
b = b[e] || (b[e] = w()), e = c[++d], U(a, b, c, d, e); | ||
} else if (a) { | ||
if (a.constructor === Array) { | ||
for (b = b[e] = Array(a.length), e = 0; e < a.length; e++) { | ||
U(a, b, c, d, e); | ||
} | ||
} else { | ||
b = b[e] || (b[e] = w()), e = c[++d], U(a, b, c, d, e); | ||
} | ||
@@ -717,3 +714,3 @@ } | ||
for (let f = 0, g, h; f < d.length; f++) { | ||
if (g = d[f], !e[g] && (e[g] = 1, h = this.tagindex[g] || (this.tagindex[g] = []), !c || -1 === h.indexOf(a))) { | ||
if (g = d[f], !e[g] && (e[g] = 1, h = this.tagindex[g] || (this.tagindex[g] = []), !c || !h.includes(a))) { | ||
if (h[h.length] = a, this.fastupdate) { | ||
@@ -763,3 +760,3 @@ const k = this.register[a] || (this.register[a] = []); | ||
R.prototype.search = function(a, b, c, d) { | ||
c || (!b && z(a) ? (c = a, a = c.query) : z(b) && (c = b, b = 0)); | ||
c || (!b && z(a) ? (c = a, a = "") : z(b) && (c = b, b = 0)); | ||
let e = [], f = [], g, h, k, m, p, u, q = 0; | ||
@@ -770,2 +767,3 @@ if (c) { | ||
} else { | ||
a = c.query || a; | ||
k = (g = c.pluck) || c.index || c.field; | ||
@@ -775,3 +773,3 @@ m = c.tag; | ||
p = "and" === c.bool; | ||
b = c.limit || 100; | ||
b = c.limit || b || 100; | ||
u = c.offset || 0; | ||
@@ -795,3 +793,3 @@ if (m && (x(m) && (m = [m]), !a)) { | ||
y = k[l]; | ||
x(y) || (B = y, y = y.field); | ||
x(y) || (B = y, y = B.field, a = B.query || a, b = B.limit || b); | ||
if (n) { | ||
@@ -814,6 +812,4 @@ n[l] = this.index[y].searchAsync(a, b, B || c); | ||
f[q] = y, e[q++] = t; | ||
} else { | ||
if (p) { | ||
return []; | ||
} | ||
} else if (p) { | ||
return []; | ||
} | ||
@@ -881,3 +877,3 @@ } | ||
setTimeout(function() { | ||
g.export(a, b, e ? f.replace(":", "-") : "", d, e++) || (d++, e = 1, b.export(a, b, f, d, e)); | ||
g.export(a, b, e ? f : "", d, e++) || (d++, e = 1, b.export(a, b, f, d, e)); | ||
}); | ||
@@ -959,3 +955,3 @@ } else { | ||
a && (a = Ka.call(this, a).join(" "), 2 < a.length && (a = E(a, Wa)), b || (1 < a.length && (a = F(a)), a && (a = a.split(" ")))); | ||
return a; | ||
return a || []; | ||
} | ||
@@ -966,3 +962,3 @@ ;var Ya = {encode:Xa, rtl:!1, tokenize:""}; | ||
a && (a = Oa.call(this, a, !0), 1 < a.length && (a = a.replace(Za, "")), 1 < a.length && (a = F(a)), a && (a = a.split(" "))); | ||
return a; | ||
return a || []; | ||
} | ||
@@ -969,0 +965,0 @@ ;I["latin:default"] = ha; |
/**! | ||
* FlexSearch.js v0.7.2 (ES5) | ||
* Copyright 2018-2021 Nextapps GmbH | ||
* FlexSearch.js v0.7.3 (ES5) | ||
* Copyright 2018-2022 Nextapps GmbH | ||
* Author: Thomas Wilkerling | ||
@@ -9,7 +9,7 @@ * Licence: Apache-2.0 | ||
(function(self){'use strict';var t;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}var v="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 ba(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 w=ba(this);function x(a,b){if(b)a:{var c=w;a=a.split(".");for(var d=0;d<a.length-1;d++){var f=a[d];if(!(f in c))break a;c=c[f]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&v(c,a,{configurable:!0,writable:!0,value:b})}} | ||
x("Symbol",function(a){function b(g){if(this instanceof b)throw new TypeError("Symbol is not a constructor");return new c(d+(g||"")+"_"+f++,g)}function c(g,e){this.h=g;v(this,"description",{configurable:!0,writable:!0,value:e})}if(a)return a;c.prototype.toString=function(){return this.h};var d="jscomp_symbol_"+(1E9*Math.random()>>>0)+"_",f=0;return b}); | ||
x("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=w[b[c]];"function"===typeof d&&"function"!=typeof d.prototype[a]&&v(d.prototype,a,{configurable:!0,writable:!0,value:function(){return ca(aa(this))}})}return a});function ca(a){a={next:a};a[Symbol.iterator]=function(){return this};return a} | ||
function da(a,b){a instanceof String&&(a+="");var c=0,d=!1,f={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}}};f[Symbol.iterator]=function(){return f};return f}x("Array.prototype.keys",function(a){return a?a:function(){return da(this,function(b){return b})}});function ea(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:aa(a)}} | ||
x("Promise",function(a){function b(e){this.l=0;this.m=void 0;this.h=[];this.M=!1;var h=this.o();try{e(h.resolve,h.reject)}catch(k){h.reject(k)}}function c(){this.h=null}function d(e){return e instanceof b?e:new b(function(h){h(e)})}if(a)return a;c.prototype.l=function(e){if(null==this.h){this.h=[];var h=this;this.m(function(){h.D()})}this.h.push(e)};var f=w.setTimeout;c.prototype.m=function(e){f(e,0)};c.prototype.D=function(){for(;this.h&&this.h.length;){var e=this.h;this.h=[];for(var h=0;h<e.length;++h){var k= | ||
function ba(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 w=ba(this);function y(a,b){if(b)a:{var c=w;a=a.split(".");for(var d=0;d<a.length-1;d++){var f=a[d];if(!(f in c))break a;c=c[f]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&v(c,a,{configurable:!0,writable:!0,value:b})}} | ||
y("Symbol",function(a){function b(g){if(this instanceof b)throw new TypeError("Symbol is not a constructor");return new c(d+(g||"")+"_"+f++,g)}function c(g,e){this.h=g;v(this,"description",{configurable:!0,writable:!0,value:e})}if(a)return a;c.prototype.toString=function(){return this.h};var d="jscomp_symbol_"+(1E9*Math.random()>>>0)+"_",f=0;return b}); | ||
y("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=w[b[c]];"function"===typeof d&&"function"!=typeof d.prototype[a]&&v(d.prototype,a,{configurable:!0,writable:!0,value:function(){return ca(aa(this))}})}return a});function ca(a){a={next:a};a[Symbol.iterator]=function(){return this};return a} | ||
function da(a,b){a instanceof String&&(a+="");var c=0,d=!1,f={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}}};f[Symbol.iterator]=function(){return f};return f}y("Array.prototype.keys",function(a){return a?a:function(){return da(this,function(b){return b})}});function ea(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:aa(a)}} | ||
y("Promise",function(a){function b(e){this.l=0;this.m=void 0;this.h=[];this.M=!1;var h=this.o();try{e(h.resolve,h.reject)}catch(k){h.reject(k)}}function c(){this.h=null}function d(e){return e instanceof b?e:new b(function(h){h(e)})}if(a)return a;c.prototype.l=function(e){if(null==this.h){this.h=[];var h=this;this.m(function(){h.D()})}this.h.push(e)};var f=w.setTimeout;c.prototype.m=function(e){f(e,0)};c.prototype.D=function(){for(;this.h&&this.h.length;){var e=this.h;this.h=[];for(var h=0;h<e.length;++h){var k= | ||
e[h];e[h]=null;try{k()}catch(l){this.o(l)}}}this.h=null};c.prototype.o=function(e){this.m(function(){throw e;})};b.prototype.o=function(){function e(l){return function(p){k||(k=!0,l.call(h,p))}}var h=this,k=!1;return{resolve:e(this.S),reject:e(this.D)}};b.prototype.S=function(e){if(e===this)this.D(new TypeError("A Promise cannot resolve to itself"));else if(e instanceof b)this.U(e);else{a:switch(typeof e){case "object":var h=null!=e;break a;case "function":h=!0;break a;default:h=!1}h?this.R(e):this.I(e)}}; | ||
@@ -20,27 +20,29 @@ b.prototype.R=function(e){var h=void 0;try{h=e.then}catch(k){this.D(k);return}"function"==typeof h?this.V(h,e):this.I(e)};b.prototype.D=function(e){this.N(2,e)};b.prototype.I=function(e){this.N(1,e)};b.prototype.N=function(e,h){if(0!=this.l)throw Error("Cannot settle("+e+", "+h+"): Promise already settled in state"+this.l);this.l=e;this.m=h;2===this.l&&this.T();this.O()};b.prototype.T=function(){var e=this;f(function(){if(e.P()){var h=w.console;"undefined"!==typeof h&&h.error(e.m)}},1)};b.prototype.P= | ||
l.l);}}var l=this;null==this.h?g.l(k):this.h.push(k);this.M=!0};b.resolve=d;b.reject=function(e){return new b(function(h,k){k(e)})};b.race=function(e){return new b(function(h,k){for(var l=ea(e),p=l.next();!p.done;p=l.next())d(p.value).J(h,k)})};b.all=function(e){var h=ea(e),k=h.next();return k.done?d([]):new b(function(l,p){function n(r){return function(u){m[r]=u;q--;0==q&&l(m)}}var m=[],q=0;do m.push(void 0),q++,d(k.value).J(n(m.length-1),p),k=h.next();while(!k.done)})};return b}); | ||
var fa="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 f in d)Object.prototype.hasOwnProperty.call(d,f)&&(a[f]=d[f])}return a};x("Object.assign",function(a){return a||fa});function C(a){return"undefined"!==typeof a?a:!0}function ha(a){for(var b=Array(a),c=0;c<a;c++)b[c]=D();return b}function D(){return Object.create(null)}function ia(a,b){return b.length-a.length}function E(a){return"string"===typeof a}function F(a){return"object"===typeof a}function H(a){return"function"===typeof a};function ja(a,b){var c=ka;if(a&&(b&&(a=I(a,b)),this.K&&(a=I(a,this.K)),this.L&&1<a.length&&(a=I(a,this.L)),c||""===c)){a=a.split(c);if(this.filter){b=this.filter;c=a.length;for(var d=[],f=0,g=0;f<c;f++){var e=a[f];e&&!b[e]&&(d[g++]=e)}a=d}return a}return a}var ka=/[\p{Z}\p{S}\p{P}\p{C}]+/u,la=/[\u0300-\u036f]/g; | ||
function ma(a,b){for(var c=Object.keys(a),d=c.length,f=[],g="",e=0,h=0,k,l;h<d;h++)k=c[h],(l=a[k])?(f[e++]=J(b?"(?!\\b)"+k+"(\\b|_)":k),f[e++]=l):g+=(g?"|":"")+k;g&&(f[e++]=J(b?"(?!\\b)("+g+")(\\b|_)":"("+g+")"),f[e]="");return f}function I(a,b){for(var c=0,d=b.length;c<d&&(a=a.replace(b[c],b[c+1]),a);c+=2);return a}function J(a){return new RegExp(a,"g")}function na(a){for(var b="",c="",d=0,f=a.length,g=void 0;d<f;d++)(g=a[d])!==c&&(b+=c=g);return b};var pa={encode:oa,G:!1,H:""};function oa(a){return ja.call(this,a.toLowerCase(),!1)};var qa={},L={};function ra(a){M(a,"add");M(a,"append");M(a,"search");M(a,"update");M(a,"remove")}function M(a,b){a[b+"Async"]=function(){var c=this,d=arguments,f=d[d.length-1];if(H(f)){var g=f;delete d[d.length-1]}f=new Promise(function(e){setTimeout(function(){c.async=!0;var h=c[b].apply(c,d);c.async=!1;e(h)})});return g?(f.then(g),this):f}};function sa(a,b,c,d){var f=a.length,g=[],e,h=0;d&&(d=[]);for(var k=f-1;0<=k;k--){for(var l=a[k],p=l.length,n=D(),m=!B,q=0;q<p;q++){var r=l[q],u=r.length;if(u)for(var A=0,y=void 0,z;A<u;A++)if(z=r[A],B){if(B[z]){if(!k)if(c)c--;else if(g[h++]=z,h===b)return g;if(k||d)n[z]=1;m=!0}if(d&&(e[z]=(y=e[z])?++y:y=1,y<f)){var K=d[y-2]||(d[y-2]=[]);K[K.length]=z}}else n[z]=1}if(d)B||(e=n);else if(!m)return[];var B=n}if(d)for(a=d.length-1;0<=a;a--)for(f=d[a],e=f.length,k=0;k<e;k++)if(l=f[k],!B[l]){if(c)c--;else if(g[h++]= | ||
l,h===b)return g;B[l]=1}return g}function ta(a,b){for(var c=D(),d=D(),f=[],g=0;g<a.length;g++)c[a[g]]=1;for(a=0;a<b.length;a++){g=b[a];for(var e=0,h;e<g.length;e++)h=g[e],c[h]&&!d[h]&&(d[h]=1,f[f.length]=h)}return f};function N(a){this.l=!0!==a&&a;this.cache=D();this.h=[]}function ua(a,b,c){F(a)&&(a=a.query);var d=this.cache.get(a);d||(d=this.search(a,b,c),this.cache.set(a,d));return d}N.prototype.set=function(a,b){if(!this.cache[a]){var c=this.h.length;c===this.l?delete this.cache[this.h[c-1]]:c++;for(--c;0<c;c--)this.h[c]=this.h[c-1];this.h[0]=a}this.cache[a]=b};N.prototype.get=function(a){var b=this.cache[a];if(this.l&&b&&(a=this.h.indexOf(a))){var c=this.h[a-1];this.h[a-1]=this.h[a];this.h[a]=c}return b};var va={memory:{charset:"latin:extra",F:3,C:4,s:!1},performance:{F:3,C:3,B:!1,context:{depth:2,F:1}},match:{charset:"latin:extra",H:"reverse"},score:{charset:"latin:advanced",F:20,C:3,context:{depth:3,F:9}},"default":{}};function wa(a,b,c,d,f,g){setTimeout(function(){var e=a(c,JSON.stringify(g));e&&e.then?e.then(function(){b.export(a,b,c,d,f+1)}):b.export(a,b,c,d,f+1)})};function O(a,b){if(!(this instanceof O))return new O(a);var c;if(a){E(a)?a=va[a]:(c=a.preset)&&(a=Object.assign({},c[c],a));c=a.charset;var d=a.lang;E(c)&&(-1===c.indexOf(":")&&(c+=":default"),c=L[c]);E(d)&&(d=qa[d])}else a={};var f,g,e=a.context||{};this.encode=a.encode||c&&c.encode||oa;this.register=b||D();this.F=f=a.resolution||9;this.H=b=c&&c.H||a.tokenize||"strict";this.depth="strict"===b&&e.depth;this.l=C(e.bidirectional);this.B=g=C(a.optimize);this.s=C(a.fastupdate);this.C=a.minlength||1;this.o= | ||
a.boost;this.map=g?ha(f):D();this.m=f=e.resolution||1;this.h=g?ha(f):D();this.G=c&&c.G||a.rtl;this.K=(b=a.matcher||d&&d.K)&&ma(b,!1);this.L=(b=a.stemmer||d&&d.L)&&ma(b,!0);if(c=b=a.filter||d&&d.filter){c=b;d=D();e=0;for(f=c.length;e<f;e++)d[c[e]]=1;c=d}this.filter=c;this.cache=(b=a.cache)&&new N(b)}t=O.prototype;t.append=function(a,b){return this.add(a,b,!0)}; | ||
t.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.register[a])return this.update(a,b);b=this.encode(b);if(d=b.length){for(var f=D(),g=D(),e=this.depth,h=this.F,k=0;k<d;k++){var l=b[this.G?d-1-k:k],p=l.length;if(l&&p>=this.C&&(e||!g[l])){var n=P(h,d,k),m="";switch(this.H){case "full":if(3<p){for(n=0;n<p;n++)for(var q=p;q>n;q--)if(q-n>=this.C){var r=P(h,d,k,p,n);m=l.substring(n,q);Q(this,g,m,r,a,c)}break}case "reverse":if(2<p){for(q=p-1;0<q;q--)m=l[q]+m,m.length>=this.C&&Q(this,g,m,P(h,d,k, | ||
p,q),a,c);m=""}case "forward":if(1<p){for(q=0;q<p;q++)m+=l[q],m.length>=this.C&&Q(this,g,m,n,a,c);break}default:if(this.o&&(n=Math.min(n/this.o(b,l,k)|0,h-1)),Q(this,g,l,n,a,c),e&&1<d&&k<d-1)for(p=D(),m=this.m,n=l,q=Math.min(e+1,d-k),r=p[n]=1;r<q;r++)if((l=b[this.G?d-1-k-r:k+r])&&l.length>=this.C&&!p[l]){p[l]=1;var u=this.l&&l>n;Q(this,f,u?n:l,P(m+(d/2>m?0:1),d,k,q-1,r-1),a,c,u?l:n)}}}}this.s||(this.register[a]=1)}}return this}; | ||
function P(a,b,c,d,f){return c&&1<a?b+(d||0)<=a?c+(f||0):(a-1)/(b+(d||0))*(c+(f||0))+1|0:0}function Q(a,b,c,d,f,g,e){var h=e?a.h:a.map;if(!b[c]||e&&!b[c][e])a.B&&(h=h[d]),e?(b=b[c]||(b[c]=D()),b[e]=1,h=h[e]||(h[e]=D())):b[c]=1,h=h[c]||(h[c]=[]),a.B||(h=h[d]||(h[d]=[])),g&&-1!==h.indexOf(f)||(h[h.length]=f,a.s&&(a=a.register[f]||(a.register[f]=[]),a[a.length]=h))} | ||
t.search=function(a,b,c){c||(!b&&F(a)?(c=a,a=c.query):F(b)&&(c=b));var d=[],f=0;if(c){b=c.limit;f=c.offset||0;var g=c.context;var e=c.suggest}if(a){a=this.encode(a);var h=a.length;if(1<h){c=D();for(var k=[],l=0,p=0,n;l<h;l++)if((n=a[l])&&n.length>=this.C&&!c[n])if(this.B||e||this.map[n])k[p++]=n,c[n]=1;else return d;a=k;h=a.length}}if(!h)return d;b||(b=100);g=this.depth&&1<h&&!1!==g;c=0;if(g){var m=a[0];c=1}else 1<h&&a.sort(ia);for(;c<h;c++){l=a[c];g?(k=xa(this,d,e,b,f,2===h,l,m),e&&!1===k&&d.length|| | ||
(m=l)):k=xa(this,d,e,b,f,1===h,l);if(k)return k;if(e&&c===h-1){k=d.length;if(!k){if(g){g=0;c=-1;continue}return d}if(1===k)return ya(d[0],b,f)}}return sa(d,b,f,e)}; | ||
y("Object.is",function(a){return a?a:function(b,c){return b===c?0!==b||1/b===1/c:b!==b&&c!==c}});y("Array.prototype.includes",function(a){return a?a:function(b,c){var d=this;d instanceof String&&(d=String(d));var f=d.length;c=c||0;for(0>c&&(c=Math.max(c+f,0));c<f;c++){var g=d[c];if(g===b||Object.is(g,b))return!0}return!1}}); | ||
y("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)}}); | ||
var fa="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 f in d)Object.prototype.hasOwnProperty.call(d,f)&&(a[f]=d[f])}return a};y("Object.assign",function(a){return a||fa});function C(a){return"undefined"!==typeof a?a:!0}function ha(a){for(var b=Array(a),c=0;c<a;c++)b[c]=D();return b}function D(){return Object.create(null)}function ia(a,b){return b.length-a.length}function E(a){return"string"===typeof a}function F(a){return"object"===typeof a}function G(a){return"function"===typeof a};function ja(a,b){var c=ka;if(a&&(b&&(a=I(a,b)),this.K&&(a=I(a,this.K)),this.L&&1<a.length&&(a=I(a,this.L)),c||""===c)){a=a.split(c);if(this.filter){b=this.filter;c=a.length;for(var d=[],f=0,g=0;f<c;f++){var e=a[f];e&&!b[e]&&(d[g++]=e)}a=d}return a}return a}var ka=/[\p{Z}\p{S}\p{P}\p{C}]+/u,la=/[\u0300-\u036f]/g; | ||
function ma(a,b){for(var c=Object.keys(a),d=c.length,f=[],g="",e=0,h=0,k,l;h<d;h++)k=c[h],(l=a[k])?(f[e++]=J(b?"(?!\\b)"+k+"(\\b|_)":k),f[e++]=l):g+=(g?"|":"")+k;g&&(f[e++]=J(b?"(?!\\b)("+g+")(\\b|_)":"("+g+")"),f[e]="");return f}function I(a,b){for(var c=0,d=b.length;c<d&&(a=a.replace(b[c],b[c+1]),a);c+=2);return a}function J(a){return new RegExp(a,"g")}function na(a){for(var b="",c="",d=0,f=a.length,g=void 0;d<f;d++)(g=a[d])!==c&&(b+=c=g);return b};var pa={encode:oa,G:!1,H:""};function oa(a){return ja.call(this,(""+a).toLowerCase(),!1)};var qa={},K={};function ra(a){L(a,"add");L(a,"append");L(a,"search");L(a,"update");L(a,"remove")}function L(a,b){a[b+"Async"]=function(){var c=this,d=arguments,f=d[d.length-1];if(G(f)){var g=f;delete d[d.length-1]}f=new Promise(function(e){setTimeout(function(){c.async=!0;var h=c[b].apply(c,d);c.async=!1;e(h)})});return g?(f.then(g),this):f}};function sa(a,b,c,d){var f=a.length,g=[],e,h=0;d&&(d=[]);for(var k=f-1;0<=k;k--){for(var l=a[k],p=l.length,n=D(),m=!B,q=0;q<p;q++){var r=l[q],u=r.length;if(u)for(var A=0,x,z;A<u;A++)if(z=r[A],B){if(B[z]){if(!k)if(c)c--;else if(g[h++]=z,h===b)return g;if(k||d)n[z]=1;m=!0}d&&(x=(e[z]||0)+1,e[z]=x,x<f&&(x=d[x-2]||(d[x-2]=[]),x[x.length]=z))}else n[z]=1}if(d)B||(e=n);else if(!m)return[];var B=n}if(d)for(a=d.length-1;0<=a;a--)for(f=d[a],e=f.length,k=0;k<e;k++)if(l=f[k],!B[l]){if(c)c--;else if(g[h++]=l, | ||
h===b)return g;B[l]=1}return g}function ta(a,b){for(var c=D(),d=D(),f=[],g=0;g<a.length;g++)c[a[g]]=1;for(a=0;a<b.length;a++){g=b[a];for(var e=0,h;e<g.length;e++)h=g[e],c[h]&&!d[h]&&(d[h]=1,f[f.length]=h)}return f};function M(a){this.l=!0!==a&&a;this.cache=D();this.h=[]}function ua(a,b,c){F(a)&&(a=a.query);var d=this.cache.get(a);d||(d=this.search(a,b,c),this.cache.set(a,d));return d}M.prototype.set=function(a,b){if(!this.cache[a]){var c=this.h.length;c===this.l?delete this.cache[this.h[c-1]]:c++;for(--c;0<c;c--)this.h[c]=this.h[c-1];this.h[0]=a}this.cache[a]=b};M.prototype.get=function(a){var b=this.cache[a];if(this.l&&b&&(a=this.h.indexOf(a))){var c=this.h[a-1];this.h[a-1]=this.h[a];this.h[a]=c}return b};var va={memory:{charset:"latin:extra",F:3,C:4,s:!1},performance:{F:3,C:3,B:!1,context:{depth:2,F:1}},match:{charset:"latin:extra",H:"reverse"},score:{charset:"latin:advanced",F:20,C:3,context:{depth:3,F:9}},"default":{}};function wa(a,b,c,d,f,g){setTimeout(function(){var e=a(c,JSON.stringify(g));e&&e.then?e.then(function(){b.export(a,b,c,d,f+1)}):b.export(a,b,c,d,f+1)})};function N(a,b){if(!(this instanceof N))return new N(a);var c;if(a){E(a)?a=va[a]:(c=a.preset)&&(a=Object.assign({},c[c],a));c=a.charset;var d=a.lang;E(c)&&(-1===c.indexOf(":")&&(c+=":default"),c=K[c]);E(d)&&(d=qa[d])}else a={};var f,g,e=a.context||{};this.encode=a.encode||c&&c.encode||oa;this.register=b||D();this.F=f=a.resolution||9;this.H=b=c&&c.H||a.tokenize||"strict";this.depth="strict"===b&&e.depth;this.l=C(e.bidirectional);this.B=g=C(a.optimize);this.s=C(a.fastupdate);this.C=a.minlength||1;this.o= | ||
a.boost;this.map=g?ha(f):D();this.m=f=e.resolution||1;this.h=g?ha(f):D();this.G=c&&c.G||a.rtl;this.K=(b=a.matcher||d&&d.K)&&ma(b,!1);this.L=(b=a.stemmer||d&&d.L)&&ma(b,!0);if(c=b=a.filter||d&&d.filter){c=b;d=D();e=0;for(f=c.length;e<f;e++)d[c[e]]=1;c=d}this.filter=c;this.cache=(b=a.cache)&&new M(b)}t=N.prototype;t.append=function(a,b){return this.add(a,b,!0)}; | ||
t.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.register[a])return this.update(a,b);b=this.encode(b);if(d=b.length){for(var f=D(),g=D(),e=this.depth,h=this.F,k=0;k<d;k++){var l=b[this.G?d-1-k:k],p=l.length;if(l&&p>=this.C&&(e||!g[l])){var n=O(h,d,k),m="";switch(this.H){case "full":if(2<p){for(n=0;n<p;n++)for(var q=p;q>n;q--)if(q-n>=this.C){var r=O(h,d,k,p,n);m=l.substring(n,q);P(this,g,m,r,a,c)}break}case "reverse":if(1<p){for(q=p-1;0<q;q--)m=l[q]+m,m.length>=this.C&&P(this,g,m,O(h,d,k, | ||
p,q),a,c);m=""}case "forward":if(1<p){for(q=0;q<p;q++)m+=l[q],m.length>=this.C&&P(this,g,m,n,a,c);break}default:if(this.o&&(n=Math.min(n/this.o(b,l,k)|0,h-1)),P(this,g,l,n,a,c),e&&1<d&&k<d-1)for(p=D(),m=this.m,n=l,q=Math.min(e+1,d-k),r=p[n]=1;r<q;r++)if((l=b[this.G?d-1-k-r:k+r])&&l.length>=this.C&&!p[l]){p[l]=1;var u=this.l&&l>n;P(this,f,u?n:l,O(m+(d/2>m?0:1),d,k,q-1,r-1),a,c,u?l:n)}}}}this.s||(this.register[a]=1)}}return this}; | ||
function O(a,b,c,d,f){return c&&1<a?b+(d||0)<=a?c+(f||0):(a-1)/(b+(d||0))*(c+(f||0))+1|0:0}function P(a,b,c,d,f,g,e){var h=e?a.h:a.map;if(!b[c]||e&&!b[c][e])a.B&&(h=h[d]),e?(b=b[c]||(b[c]=D()),b[e]=1,h=h[e]||(h[e]=D())):b[c]=1,h=h[c]||(h[c]=[]),a.B||(h=h[d]||(h[d]=[])),g&&h.includes(f)||(h[h.length]=f,a.s&&(a=a.register[f]||(a.register[f]=[]),a[a.length]=h))} | ||
t.search=function(a,b,c){c||(!b&&F(a)?(c=a,a=c.query):F(b)&&(c=b));var d=[],f=0;if(c){a=c.query||a;b=c.limit;f=c.offset||0;var g=c.context;var e=c.suggest}if(a){a=this.encode(""+a);var h=a.length;if(1<h){c=D();for(var k=[],l=0,p=0,n;l<h;l++)if((n=a[l])&&n.length>=this.C&&!c[n])if(this.B||e||this.map[n])k[p++]=n,c[n]=1;else return d;a=k;h=a.length}}if(!h)return d;b||(b=100);g=this.depth&&1<h&&!1!==g;c=0;if(g){var m=a[0];c=1}else 1<h&&a.sort(ia);for(;c<h;c++){l=a[c];g?(k=xa(this,d,e,b,f,2===h,l,m), | ||
e&&!1===k&&d.length||(m=l)):k=xa(this,d,e,b,f,1===h,l);if(k)return k;if(e&&c===h-1){k=d.length;if(!k){if(g){g=0;c=-1;continue}return d}if(1===k)return ya(d[0],b,f)}}return sa(d,b,f,e)}; | ||
function xa(a,b,c,d,f,g,e,h){var k=[],l=h?a.h:a.map;a.B||(l=za(l,e,h,a.l));if(l){for(var p=0,n=Math.min(l.length,h?a.m:a.F),m=0,q=0,r,u;m<n;m++)if(r=l[m])if(a.B&&(r=za(r,e,h,a.l)),f&&r&&g&&(u=r.length,u<=f?(f-=u,r=null):(r=r.slice(f),f=0)),r&&(k[p++]=r,g&&(q+=r.length,q>=d)))break;if(p){if(g)return ya(k,d,0);b[b.length]=k;return}}return!c&&k}function ya(a,b,c){a=1===a.length?a[0]:[].concat.apply([],a);return c||a.length>b?a.slice(c,c+b):a} | ||
function za(a,b,c,d){c?(d=d&&b>c,a=(a=a[d?b:c])&&a[d?c:b]):a=a[b];return a}t.contain=function(a){return!!this.register[a]};t.update=function(a,b){return this.remove(a).add(a,b)}; | ||
t.remove=function(a,b){var c=this.register[a];if(c){if(this.s)for(var d=0,f;d<c.length;d++)f=c[d],f.splice(f.indexOf(a),1);else R(this.map,a,this.F,this.B),this.depth&&R(this.h,a,this.m,this.B);b||delete this.register[a];if(this.cache)for(b=this.cache,c=0;c<b.h.length;c++)f=b.h[c],d=b.cache[f],-1!==d.indexOf(a)&&(b.h.splice(c--,1),delete b.cache[f])}return this}; | ||
function R(a,b,c,d,f){var g=0;if(a.constructor===Array)if(f)b=a.indexOf(b),-1!==b?1<a.length&&(a.splice(b,1),g++):g++;else{f=Math.min(a.length,c);for(var e=0,h;e<f;e++)if(h=a[e])g=R(h,b,c,d,f),d||g||delete a[e]}else for(e in a)(g=R(a[e],b,c,d,f))||delete a[e];return g}t.searchCache=ua; | ||
t.export=function(a,b,c,d,f){switch(f||(f=0)){case 0:var g="reg";if(this.s){var e=D();for(var h in this.register)e[h]=1}else e=this.register;break;case 1:g="cfg";e={doc:0,opt:this.B?1:0};break;case 2:g="map";e=this.map;break;case 3:g="ctx";e=this.h;break;default:return}wa(a,b||this,c?c+"."+g:g,d,f,e);return!0};t.import=function(a,b){if(b)switch(E(b)&&(b=JSON.parse(b)),a){case "cfg":this.B=!!b.opt;break;case "reg":this.s=!1;this.register=b;break;case "map":this.map=b;break;case "ctx":this.h=b}};ra(O.prototype);function Aa(a){a=a.data;var b=self._index,c=a.args,d=a.task;switch(d){case "init":d=a.options||{};a=a.factory;b=d.encode;d.cache=!1;b&&0===b.indexOf("function")&&(d.encode=Function("return "+b)());a?(Function("return "+a)()(self),self._index=new self.FlexSearch.Index(d),delete self.FlexSearch):self._index=new O(d);break;default:a=a.id,b=b[d].apply(b,c),postMessage("search"===d?{id:a,msg:b}:{id:a})}};var Ba=0;function S(a){if(!(this instanceof S))return new S(a);var b;a?H(b=a.encode)&&(a.encode=b.toString()):a={};(b=(self||window)._factory)&&(b=b.toString());var c=self.exports,d=this;this.A=Ca(b,c,a.worker);this.h=D();if(this.A){if(c)this.A.on("message",function(f){d.h[f.id](f.msg);delete d.h[f.id]});else this.A.onmessage=function(f){f=f.data;d.h[f.id](f.msg);delete d.h[f.id]};this.A.postMessage({task:"init",factory:b,options:a})}}T("add");T("append");T("search");T("update");T("remove"); | ||
function T(a){S.prototype[a]=S.prototype[a+"Async"]=function(){var b=this,c=[].slice.call(arguments),d=c[c.length-1];if(H(d)){var f=d;c.splice(c.length-1,1)}d=new Promise(function(g){setTimeout(function(){b.h[++Ba]=g;b.A.postMessage({task:a,id:Ba,args:c})})});return f?(d.then(f),this):d}} | ||
function Ca(a,b,c){try{var d=b?eval('new (require("worker_threads")["Worker"])("../dist/node/node.js")'):a?new Worker(URL.createObjectURL(new Blob(["onmessage="+Aa.toString()],{type:"text/javascript"}))):new Worker(E(c)?c:"worker/worker.js",{type:"module"})}catch(f){}return d};function U(a){if(!(this instanceof U))return new U(a);var b=a.document||a.doc||a,c;this.I=[];this.h=[];this.m=[];this.register=D();this.key=(c=b.key||b.id)&&V(c,this.m)||"id";this.s=C(a.fastupdate);this.o=(c=b.store)&&!0!==c&&[];this.store=c&&D();this.D=(c=b.tag)&&V(c,this.m);this.l=c&&D();this.cache=(c=a.cache)&&new N(c);a.cache=!1;this.A=a.worker;this.async=!1;c=D();var d=b.index||b.field||b;E(d)&&(d=[d]);for(var f=0,g,e=void 0;f<d.length;f++)g=d[f],E(g)||(e=g,g=g.field),e=F(e)?Object.assign({}, | ||
a,e):a,this.A&&(c[g]=new S(e),c[g].A||(this.A=!1)),this.A||(c[g]=new O(e,this.register)),this.I[f]=V(g,this.m),this.h[f]=g;if(this.o)for(a=b.store,E(a)&&(a=[a]),b=0;b<a.length;b++)this.o[b]=V(a[b],this.m);this.index=c}function V(a,b){for(var c=a.split(":"),d=0,f=0;f<c.length;f++)a=c[f],0<=a.indexOf("[]")&&(a=a.substring(0,a.length-2))&&(b[d]=!0),a&&(c[d++]=a);d<c.length&&(c.length=d);return 1<d?c:c[0]}function W(a,b){if(E(b))a=a[b];else for(var c=0;a&&c<b.length;c++)a=a[b[c]];return a} | ||
function X(a,b,c,d,f){a=a[f];if(d===c.length-1)b[f]=a;else if(a)if(a.constructor===Array)for(b=b[f]=Array(a.length),f=0;f<a.length;f++)X(a,b,c,d,f);else b=b[f]||(b[f]=D()),f=c[++d],X(a,b,c,d,f)}function Y(a,b,c,d,f,g,e,h){if(a=a[e])if(d===b.length-1){if(a.constructor===Array){if(c[d]){for(b=0;b<a.length;b++)f.add(g,a[b],!0,!0);return}a=a.join(" ")}f.add(g,a,h,!0)}else if(a.constructor===Array)for(e=0;e<a.length;e++)Y(a,b,c,d,f,g,e,h);else e=b[++d],Y(a,b,c,d,f,g,e,h)}t=U.prototype; | ||
t.add=function(a,b,c){F(a)&&(b=a,a=W(b,this.key));if(b&&(a||0===a)){if(!c&&this.register[a])return this.update(a,b);for(var d=0,f,g;d<this.h.length;d++)g=this.h[d],f=this.I[d],E(f)&&(f=[f]),Y(b,f,this.m,0,this.index[g],a,f[0],c);if(this.D){d=W(b,this.D);f=D();E(d)&&(d=[d]);g=0;for(var e;g<d.length;g++)if(e=d[g],!f[e]&&(f[e]=1,e=this.l[e]||(this.l[e]=[]),!c||-1===e.indexOf(a)))if(e[e.length]=a,this.s){var h=this.register[a]||(this.register[a]=[]);h[h.length]=e}}if(this.store&&(!c||!this.store[a])){if(this.o){var k= | ||
D();for(c=0;c<this.o.length;c++)d=this.o[c],E(d)?k[d]=b[d]:X(b,k,d,0,d[0])}this.store[a]=k||b}}return this};t.append=function(a,b){return this.add(a,b,!0)};t.update=function(a,b){return this.remove(a).add(a,b)}; | ||
t.remove=function(a){F(a)&&(a=W(a,this.key));if(this.register[a]){for(var b=0;b<this.h.length&&(this.index[this.h[b]].remove(a,!this.A),!this.s);b++);if(this.D&&!this.s)for(var c in this.l){b=this.l[c];var d=b.indexOf(a);-1!==d&&(1<b.length?b.splice(d,1):delete this.l[c])}this.store&&delete this.store[a];delete this.register[a]}return this}; | ||
t.search=function(a,b,c,d){c||(!b&&F(a)?(c=a,a=c.query):F(b)&&(c=b,b=0));var f=[],g=[],e,h=0;if(c)if(c.constructor===Array){var k=c;c=null}else{k=(e=c.pluck)||c.index||c.field;var l=c.tag;var p=this.store&&c.enrich;var n="and"===c.bool;b=c.limit||100;var m=c.offset||0;if(l&&(E(l)&&(l=[l]),!a)){g=0;for(e=void 0;g<l.length;g++)if(e=Da.call(this,l[g],b,m,p))f[f.length]=e,h++;return h?f:[]}E(k)&&(k=[k])}k||(k=this.h);n=n&&(1<k.length||l&&1<l.length);for(var q=!d&&(this.A||this.async)&&[],r=0,u=void 0, | ||
A=void 0,y=void 0;r<k.length;r++)if(y=void 0,A=k[r],E(A)||(y=A,A=A.field),q)q[r]=this.index[A].searchAsync(a,b,y||c);else{d?u=d[r]:u=this.index[A].search(a,b,y||c);y=u&&u.length;if(l&&y){var z=[],K=0;n&&(z[0]=[u]);var B=0,G=void 0;for(G=void 0;B<l.length;B++)if(G=l[B],y=(G=this.l[G])&&G.length)K++,z[z.length]=n?[G]:G;K&&(u=n?sa(z,b||100,m||0):ta(u,z),y=u.length)}if(y)g[h]=A,f[h++]=u;else if(n)return[]}if(q){var La=this;return new Promise(function(Ma){Promise.all(q).then(function(Na){Ma(La.search(a, | ||
t.remove=function(a,b){var c=this.register[a];if(c){if(this.s)for(var d=0,f;d<c.length;d++)f=c[d],f.splice(f.indexOf(a),1);else Q(this.map,a,this.F,this.B),this.depth&&Q(this.h,a,this.m,this.B);b||delete this.register[a];if(this.cache)for(b=this.cache,c=0;c<b.h.length;c++)f=b.h[c],d=b.cache[f],d.includes(a)&&(b.h.splice(c--,1),delete b.cache[f])}return this}; | ||
function Q(a,b,c,d,f){var g=0;if(a.constructor===Array)if(f)b=a.indexOf(b),-1!==b?1<a.length&&(a.splice(b,1),g++):g++;else{f=Math.min(a.length,c);for(var e=0,h;e<f;e++)if(h=a[e])g=Q(h,b,c,d,f),d||g||delete a[e]}else for(e in a)(g=Q(a[e],b,c,d,f))||delete a[e];return g}t.searchCache=ua; | ||
t.export=function(a,b,c,d,f){switch(f||(f=0)){case 0:var g="reg";if(this.s){var e=D();for(var h in this.register)e[h]=1}else e=this.register;break;case 1:g="cfg";e={doc:0,opt:this.B?1:0};break;case 2:g="map";e=this.map;break;case 3:g="ctx";e=this.h;break;default:return}wa(a,b||this,c?c+"."+g:g,d,f,e);return!0};t.import=function(a,b){if(b)switch(E(b)&&(b=JSON.parse(b)),a){case "cfg":this.B=!!b.opt;break;case "reg":this.s=!1;this.register=b;break;case "map":this.map=b;break;case "ctx":this.h=b}};ra(N.prototype);function Aa(a){a=a.data;var b=self._index,c=a.args,d=a.task;switch(d){case "init":d=a.options||{};a=a.factory;b=d.encode;d.cache=!1;b&&0===b.indexOf("function")&&(d.encode=Function("return "+b)());a?(Function("return "+a)()(self),self._index=new self.FlexSearch.Index(d),delete self.FlexSearch):self._index=new N(d);break;default:a=a.id,b=b[d].apply(b,c),postMessage("search"===d?{id:a,msg:b}:{id:a})}};var Ba=0;function R(a){if(!(this instanceof R))return new R(a);var b;a?G(b=a.encode)&&(a.encode=b.toString()):a={};(b=(self||window)._factory)&&(b=b.toString());var c="undefined"===typeof window&&self.exports,d=this;this.A=Ca(b,c,a.worker);this.h=D();if(this.A){if(c)this.A.on("message",function(f){d.h[f.id](f.msg);delete d.h[f.id]});else this.A.onmessage=function(f){f=f.data;d.h[f.id](f.msg);delete d.h[f.id]};this.A.postMessage({task:"init",factory:b,options:a})}}S("add");S("append");S("search"); | ||
S("update");S("remove");function S(a){R.prototype[a]=R.prototype[a+"Async"]=function(){var b=this,c=[].slice.call(arguments),d=c[c.length-1];if(G(d)){var f=d;c.splice(c.length-1,1)}d=new Promise(function(g){setTimeout(function(){b.h[++Ba]=g;b.A.postMessage({task:a,id:Ba,args:c})})});return f?(d.then(f),this):d}} | ||
function Ca(a,b,c){try{var d=b?eval('new (require("worker_threads")["Worker"])("../dist/node/node.js")'):a?new Worker(URL.createObjectURL(new Blob(["onmessage="+Aa.toString()],{type:"text/javascript"}))):new Worker(E(c)?c:"worker/worker.js",{type:"module"})}catch(f){}return d};function T(a){if(!(this instanceof T))return new T(a);var b=a.document||a.doc||a,c;this.I=[];this.h=[];this.m=[];this.register=D();this.key=(c=b.key||b.id)&&U(c,this.m)||"id";this.s=C(a.fastupdate);this.o=(c=b.store)&&!0!==c&&[];this.store=c&&D();this.D=(c=b.tag)&&U(c,this.m);this.l=c&&D();this.cache=(c=a.cache)&&new M(c);a.cache=!1;this.A=a.worker;this.async=!1;c=D();var d=b.index||b.field||b;E(d)&&(d=[d]);for(var f=0,g,e=void 0;f<d.length;f++)g=d[f],E(g)||(e=g,g=g.field),e=F(e)?Object.assign({}, | ||
a,e):a,this.A&&(c[g]=new R(e),c[g].A||(this.A=!1)),this.A||(c[g]=new N(e,this.register)),this.I[f]=U(g,this.m),this.h[f]=g;if(this.o)for(a=b.store,E(a)&&(a=[a]),b=0;b<a.length;b++)this.o[b]=U(a[b],this.m);this.index=c}function U(a,b){for(var c=a.split(":"),d=0,f=0;f<c.length;f++)a=c[f],0<=a.indexOf("[]")&&(a=a.substring(0,a.length-2))&&(b[d]=!0),a&&(c[d++]=a);d<c.length&&(c.length=d);return 1<d?c:c[0]}function V(a,b){if(E(b))a=a[b];else for(var c=0;a&&c<b.length;c++)a=a[b[c]];return a} | ||
function W(a,b,c,d,f){a=a[f];if(d===c.length-1)b[f]=a;else if(a)if(a.constructor===Array)for(b=b[f]=Array(a.length),f=0;f<a.length;f++)W(a,b,c,d,f);else b=b[f]||(b[f]=D()),f=c[++d],W(a,b,c,d,f)}function X(a,b,c,d,f,g,e,h){if(a=a[e])if(d===b.length-1){if(a.constructor===Array){if(c[d]){for(b=0;b<a.length;b++)f.add(g,a[b],!0,!0);return}a=a.join(" ")}f.add(g,a,h,!0)}else if(a.constructor===Array)for(e=0;e<a.length;e++)X(a,b,c,d,f,g,e,h);else e=b[++d],X(a,b,c,d,f,g,e,h)}t=T.prototype; | ||
t.add=function(a,b,c){F(a)&&(b=a,a=V(b,this.key));if(b&&(a||0===a)){if(!c&&this.register[a])return this.update(a,b);for(var d=0,f,g;d<this.h.length;d++)g=this.h[d],f=this.I[d],E(f)&&(f=[f]),X(b,f,this.m,0,this.index[g],a,f[0],c);if(this.D){d=V(b,this.D);f=D();E(d)&&(d=[d]);g=0;for(var e;g<d.length;g++)if(e=d[g],!f[e]&&(f[e]=1,e=this.l[e]||(this.l[e]=[]),!c||!e.includes(a)))if(e[e.length]=a,this.s){var h=this.register[a]||(this.register[a]=[]);h[h.length]=e}}if(this.store&&(!c||!this.store[a])){if(this.o){var k= | ||
D();for(c=0;c<this.o.length;c++)d=this.o[c],E(d)?k[d]=b[d]:W(b,k,d,0,d[0])}this.store[a]=k||b}}return this};t.append=function(a,b){return this.add(a,b,!0)};t.update=function(a,b){return this.remove(a).add(a,b)}; | ||
t.remove=function(a){F(a)&&(a=V(a,this.key));if(this.register[a]){for(var b=0;b<this.h.length&&(this.index[this.h[b]].remove(a,!this.A),!this.s);b++);if(this.D&&!this.s)for(var c in this.l){b=this.l[c];var d=b.indexOf(a);-1!==d&&(1<b.length?b.splice(d,1):delete this.l[c])}this.store&&delete this.store[a];delete this.register[a]}return this}; | ||
t.search=function(a,b,c,d){c||(!b&&F(a)?(c=a,a=""):F(b)&&(c=b,b=0));var f=[],g=[],e,h=0;if(c)if(c.constructor===Array){var k=c;c=null}else{a=c.query||a;k=(e=c.pluck)||c.index||c.field;var l=c.tag;var p=this.store&&c.enrich;var n="and"===c.bool;b=c.limit||b||100;var m=c.offset||0;if(l&&(E(l)&&(l=[l]),!a)){g=0;for(e=void 0;g<l.length;g++)if(e=Da.call(this,l[g],b,m,p))f[f.length]=e,h++;return h?f:[]}E(k)&&(k=[k])}k||(k=this.h);n=n&&(1<k.length||l&&1<l.length);for(var q=!d&&(this.A||this.async)&&[],r= | ||
0,u=void 0,A=void 0,x=void 0;r<k.length;r++)if(x=void 0,A=k[r],E(A)||(x=A,A=x.field,a=x.query||a,b=x.limit||b),q)q[r]=this.index[A].searchAsync(a,b,x||c);else{d?u=d[r]:u=this.index[A].search(a,b,x||c);x=u&&u.length;if(l&&x){var z=[],B=0;n&&(z[0]=[u]);var Z=0,H=void 0;for(H=void 0;Z<l.length;Z++)if(H=l[Z],x=(H=this.l[H])&&H.length)B++,z[z.length]=n?[H]:H;B&&(u=n?sa(z,b||100,m||0):ta(u,z),x=u.length)}if(x)g[h]=A,f[h++]=u;else if(n)return[]}if(q){var La=this;return new Promise(function(Ma){Promise.all(q).then(function(Na){Ma(La.search(a, | ||
b,c,Na))})})}if(!h)return[];if(e&&(!p||!this.store))return f[0];l=0;for(m=void 0;l<g.length;l++){m=f[l];m.length&&p&&(m=Ea.call(this,m));if(e)return m;f[l]={field:g[l],result:m}}return f};function Da(a,b,c,d){var f=this.l[a],g=f&&f.length-c;if(g&&0<g){if(g>b||c)f=f.slice(c,c+b);d&&(f=Ea.call(this,f));return{tag:a,result:f}}}function Ea(a){for(var b=Array(a.length),c=0,d;c<a.length;c++)d=a[c],b[c]={id:d,doc:this.store[d]};return b}t.contain=function(a){return!!this.register[a]};t.get=function(a){return this.store[a]}; | ||
t.set=function(a,b){this.store[a]=b;return this};t.searchCache=ua;t.export=function(a,b,c,d,f){f||(f=0);d||(d=0);if(d<this.h.length){var g=this.h[d],e=this.index[g];b=this;setTimeout(function(){e.export(a,b,f?g.replace(":","-"):"",d,f++)||(d++,f=1,b.export(a,b,g,d,f))})}else{switch(f){case 1:c="tag";var h=this.l;break;case 2:c="store";h=this.store;break;default:return}wa(a,this,c,d,f,h)}}; | ||
t.import=function(a,b){if(b)switch(E(b)&&(b=JSON.parse(b)),a){case "tag":this.l=b;break;case "reg":this.s=!1;this.register=b;a=0;for(var c;a<this.h.length;a++)c=this.index[this.h[a]],c.register=b,c.s=!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)}};ra(U.prototype);var Ga={encode:Fa,G:!1,H:""},Ha=[J("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",J("[\u00e8\u00e9\u00ea\u00eb]"),"e",J("[\u00ec\u00ed\u00ee\u00ef]"),"i",J("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",J("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",J("[\u00fd\u0177\u00ff]"),"y",J("\u00f1"),"n",J("[\u00e7c]"),"k",J("\u00df"),"s",J(" & ")," and "];function Fa(a){var b=a;b.normalize&&(b=b.normalize("NFD").replace(la,""));return ja.call(this,b.toLowerCase(),!a.normalize&&Ha)};var Ja={encode:Ia,G:!1,H:"strict"},Ka=/[^a-z0-9]+/,Oa={b:"p",v:"f",w:"f",z:"s",x:"s","\u00df":"s",d:"t",n:"m",c:"k",g:"k",j:"k",q:"k",i:"e",y:"e",u:"o"};function Ia(a){a=Fa.call(this,a).join(" ");var b=[];if(a)for(var c=a.split(Ka),d=c.length,f=0,g,e=0;f<d;f++)if((a=c[f])&&(!this.filter||!this.filter[a])){g=a[0];for(var h=Oa[g]||g,k=h,l=1;l<a.length;l++)g=a[l],(g=Oa[g]||g)&&g!==k&&(h+=g,k=g);b[e++]=h}return b};var Qa={encode:Pa,G:!1,H:""},Ra=[J("ae"),"a",J("oe"),"o",J("sh"),"s",J("th"),"t",J("ph"),"f",J("pf"),"f",J("(?![aeo])h(?![aeo])"),"",J("(?!^[aeo])h(?!^[aeo])"),""];function Pa(a,b){a&&(a=Ia.call(this,a).join(" "),2<a.length&&(a=I(a,Ra)),b||(1<a.length&&(a=na(a)),a&&(a=a.split(" "))));return a};var Ta={encode:Sa,G:!1,H:""},Ua=J("(?!\\b)[aeo]");function Sa(a){a&&(a=Pa.call(this,a,!0),1<a.length&&(a=a.replace(Ua,"")),1<a.length&&(a=na(a)),a&&(a=a.split(" ")));return a};L["latin:default"]=pa;L["latin:simple"]=Ga;L["latin:balance"]=Ja;L["latin:advanced"]=Qa;L["latin:extra"]=Ta;var Z=self,Va,Wa={Index:O,Document:U,Worker:S,registerCharset:function(a,b){L[a]=b},registerLanguage:function(a,b){qa[a]=b}};(Va=Z.define)&&Va.amd?Va([],function(){return Wa}):Z.exports?Z.exports=Wa:Z.FlexSearch=Wa;}(this)); | ||
t.set=function(a,b){this.store[a]=b;return this};t.searchCache=ua;t.export=function(a,b,c,d,f){f||(f=0);d||(d=0);if(d<this.h.length){var g=this.h[d],e=this.index[g];b=this;setTimeout(function(){e.export(a,b,f?g:"",d,f++)||(d++,f=1,b.export(a,b,g,d,f))})}else{switch(f){case 1:c="tag";var h=this.l;break;case 2:c="store";h=this.store;break;default:return}wa(a,this,c,d,f,h)}}; | ||
t.import=function(a,b){if(b)switch(E(b)&&(b=JSON.parse(b)),a){case "tag":this.l=b;break;case "reg":this.s=!1;this.register=b;a=0;for(var c;a<this.h.length;a++)c=this.index[this.h[a]],c.register=b,c.s=!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)}};ra(T.prototype);var Ga={encode:Fa,G:!1,H:""},Ha=[J("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",J("[\u00e8\u00e9\u00ea\u00eb]"),"e",J("[\u00ec\u00ed\u00ee\u00ef]"),"i",J("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",J("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",J("[\u00fd\u0177\u00ff]"),"y",J("\u00f1"),"n",J("[\u00e7c]"),"k",J("\u00df"),"s",J(" & ")," and "];function Fa(a){var b=a=""+a;b.normalize&&(b=b.normalize("NFD").replace(la,""));return ja.call(this,b.toLowerCase(),!a.normalize&&Ha)};var Ja={encode:Ia,G:!1,H:"strict"},Ka=/[^a-z0-9]+/,Oa={b:"p",v:"f",w:"f",z:"s",x:"s","\u00df":"s",d:"t",n:"m",c:"k",g:"k",j:"k",q:"k",i:"e",y:"e",u:"o"};function Ia(a){a=Fa.call(this,a).join(" ");var b=[];if(a)for(var c=a.split(Ka),d=c.length,f=0,g,e=0;f<d;f++)if((a=c[f])&&(!this.filter||!this.filter[a])){g=a[0];for(var h=Oa[g]||g,k=h,l=1;l<a.length;l++)g=a[l],(g=Oa[g]||g)&&g!==k&&(h+=g,k=g);b[e++]=h}return b};var Qa={encode:Pa,G:!1,H:""},Ra=[J("ae"),"a",J("oe"),"o",J("sh"),"s",J("th"),"t",J("ph"),"f",J("pf"),"f",J("(?![aeo])h(?![aeo])"),"",J("(?!^[aeo])h(?!^[aeo])"),""];function Pa(a,b){a&&(a=Ia.call(this,a).join(" "),2<a.length&&(a=I(a,Ra)),b||(1<a.length&&(a=na(a)),a&&(a=a.split(" "))));return a||[]};var Ta={encode:Sa,G:!1,H:""},Ua=J("(?!\\b)[aeo]");function Sa(a){a&&(a=Pa.call(this,a,!0),1<a.length&&(a=a.replace(Ua,"")),1<a.length&&(a=na(a)),a&&(a=a.split(" ")));return a||[]};K["latin:default"]=pa;K["latin:simple"]=Ga;K["latin:balance"]=Ja;K["latin:advanced"]=Qa;K["latin:extra"]=Ta;var Y=self,Va,Wa={Index:N,Document:T,Worker:R,registerCharset:function(a,b){K[a]=b},registerLanguage:function(a,b){qa[a]=b}};(Va=Y.define)&&Va.amd?Va([],function(){return Wa}):Y.exports?Y.exports=Wa:Y.FlexSearch=Wa;}(this)); |
/**! | ||
* FlexSearch.js v0.7.2 (Light) | ||
* Copyright 2018-2021 Nextapps GmbH | ||
* FlexSearch.js v0.7.3 (Light) | ||
* Copyright 2018-2022 Nextapps GmbH | ||
* Author: Thomas Wilkerling | ||
@@ -8,12 +8,12 @@ * Licence: Apache-2.0 | ||
*/ | ||
(function(self){'use strict';function t(a){return"undefined"!==typeof a?a:!0}function v(a){const c=Array(a);for(let b=0;b<a;b++)c[b]=y();return c}function y(){return Object.create(null)}function z(a,c){return c.length-a.length};const A=/[\p{Z}\p{S}\p{P}\p{C}]+/u;function B(a,c){const b=Object.keys(a),d=b.length,e=[];let h="",f=0;for(let g=0,l,n;g<d;g++)l=b[g],(n=a[l])?(e[f++]=new RegExp(c?"(?!\\b)"+l+"(\\b|_)":l,"g"),e[f++]=n):h+=(h?"|":"")+l;h&&(e[f++]=new RegExp(c?"(?!\\b)("+h+")(\\b|_)":"("+h+")","g"),e[f]="");return e}function C(a,c){for(let b=0,d=c.length;b<d&&(a=a.replace(c[b],c[b+1]),a);b+=2);return a};function D(a){if(a=a.toLowerCase())if(this.o&&(a=C(a,this.o)),this.A&&1<a.length&&(a=C(a,this.A)),A||""===A)if(a=a.split(A),this.filter){var c=this.filter;const b=a.length,d=[];for(let e=0,h=0;e<b;e++){const f=a[e];f&&!c[f]&&(d[h++]=f)}a=d}return a};const F={},G={};function H(a,c,b,d){const e=a.length;let h=[],f,g,l=0;d&&(d=[]);for(let n=e-1;0<=n;n--){const m=a[n],r=m.length,p=y();let q=!f;for(let k=0;k<r;k++){const u=m[k],M=u.length;if(M)for(let E=0,x,w;E<M;E++)if(w=u[E],f){if(f[w]){if(!n)if(b)b--;else if(h[l++]=w,l===c)return h;if(n||d)p[w]=1;q=!0}if(d&&(g[w]=(x=g[w])?++x:x=1,x<e)){const N=d[x-2]||(d[x-2]=[]);N[N.length]=w}}else p[w]=1}if(d)f||(g=p);else if(!q)return[];f=p}if(d)for(let n=d.length-1,m,r;0<=n;n--){m=d[n];r=m.length;for(let p=0,q;p<r;p++)if(q= | ||
m[p],!f[q]){if(b)b--;else if(h[l++]=q,l===c)return h;f[q]=1}}return h};function I(a,c){if(!(this instanceof I))return new I(a);let b;if(a){var d=a.charset;b=a.lang;"string"===typeof d&&(-1===d.indexOf(":")&&(d+=":default"),d=G[d]);"string"===typeof b&&(b=F[b])}else a={};let e,h,f=a.context||{};this.encode=a.encode||d&&d.encode||D;this.register=c||y();this.v=e=a.resolution||9;this.C=c=d&&d.C||a.tokenize||"strict";this.j="strict"===c&&f.depth;this.l=t(f.bidirectional);this.g=h=t(a.optimize);this.s=t(a.fastupdate);this.h=a.minlength||1;this.D=a.boost;this.i=h?v(e):y(); | ||
this.B=e=f.resolution||1;this.m=h?v(e):y();this.u=d&&d.u||a.rtl;this.o=(c=a.matcher||b&&b.o)&&B(c,!1);this.A=(c=a.stemmer||b&&b.A)&&B(c,!0);if(a=c=a.filter||b&&b.filter){a=c;d=y();for(let g=0,l=a.length;g<l;g++)d[a[g]]=1;a=d}this.filter=a}I.prototype.append=function(a,c){return this.add(a,c,!0)}; | ||
I.prototype.add=function(a,c,b,d){if(c&&(a||0===a)){if(!d&&!b&&this.register[a])return this.update(a,c);c=this.encode(c);if(d=c.length){const n=y(),m=y(),r=this.j,p=this.v;for(let q=0;q<d;q++){let k=c[this.u?d-1-q:q];var e=k.length;if(k&&e>=this.h&&(r||!m[k])){var h=J(p,d,q),f="";switch(this.C){case "full":if(3<e){for(h=0;h<e;h++)for(var g=e;g>h;g--)if(g-h>=this.h){var l=J(p,d,q,e,h);f=k.substring(h,g);K(this,m,f,l,a,b)}break}case "reverse":if(2<e){for(g=e-1;0<g;g--)f=k[g]+f,f.length>=this.h&&K(this, | ||
m,f,J(p,d,q,e,g),a,b);f=""}case "forward":if(1<e){for(g=0;g<e;g++)f+=k[g],f.length>=this.h&&K(this,m,f,h,a,b);break}default:if(this.D&&(h=Math.min(h/this.D(c,k,q)|0,p-1)),K(this,m,k,h,a,b),r&&1<d&&q<d-1)for(e=y(),f=this.B,h=k,g=Math.min(r+1,d-q),e[h]=1,l=1;l<g;l++)if((k=c[this.u?d-1-q-l:q+l])&&k.length>=this.h&&!e[k]){e[k]=1;const u=this.l&&k>h;K(this,n,u?h:k,J(f+(d/2>f?0:1),d,q,g-1,l-1),a,b,u?k:h)}}}}this.s||(this.register[a]=1)}}return this}; | ||
function J(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,d,e,h,f){let g=f?a.m:a.i;if(!c[b]||f&&!c[b][f])a.g&&(g=g[d]),f?(c=c[b]||(c[b]=y()),c[f]=1,g=g[f]||(g[f]=y())):c[b]=1,g=g[b]||(g[b]=[]),a.g||(g=g[d]||(g[d]=[])),h&&-1!==g.indexOf(e)||(g[g.length]=e,a.s&&(a=a.register[e]||(a.register[e]=[]),a[a.length]=g))} | ||
I.prototype.search=function(a,c,b){b||(c||"object"!==typeof a?"object"===typeof c&&(b=c):(b=a,a=b.query));let d=[],e;let h,f=0;if(b){c=b.limit;f=b.offset||0;var g=b.context;h=!1}if(a&&(a=this.encode(a),e=a.length,1<e)){b=y();var l=[];for(let m=0,r=0,p;m<e;m++)if((p=a[m])&&p.length>=this.h&&!b[p])if(this.g||h||this.i[p])l[r++]=p,b[p]=1;else return d;a=l;e=a.length}if(!e)return d;c||(c=100);g=this.j&&1<e&&!1!==g;b=0;let n;g?(n=a[0],b=1):1<e&&a.sort(z);for(let m,r;b<e;b++){r=a[b];g?(m=L(this,d,h,c,f, | ||
2===e,r,n),h&&!1===m&&d.length||(n=r)):m=L(this,d,h,c,f,1===e,r);if(m)return m;if(h&&b===e-1){l=d.length;if(!l){if(g){g=0;b=-1;continue}return d}if(1===l)return O(d[0],c,f)}}return H(d,c,f,h)}; | ||
function L(a,c,b,d,e,h,f,g){let l=[],n=g?a.m:a.i;a.g||(n=P(n,f,g,a.l));if(n){let m=0;const r=Math.min(n.length,g?a.B:a.v);for(let p=0,q=0,k,u;p<r;p++)if(k=n[p])if(a.g&&(k=P(k,f,g,a.l)),e&&k&&h&&(u=k.length,u<=e?(e-=u,k=null):(k=k.slice(e),e=0)),k&&(l[m++]=k,h&&(q+=k.length,q>=d)))break;if(m){if(h)return O(l,d,0);c[c.length]=l;return}}return!b&&l}function O(a,c,b){a=1===a.length?a[0]:[].concat.apply([],a);return b||a.length>c?a.slice(b,b+c):a} | ||
function P(a,c,b,d){b?(d=d&&c>b,a=(a=a[d?c:b])&&a[d?b:c]):a=a[c];return a}I.prototype.contain=function(a){return!!this.register[a]};I.prototype.update=function(a,c){return this.remove(a).add(a,c)};I.prototype.remove=function(a,c){const b=this.register[a];if(b){if(this.s)for(let d=0,e;d<b.length;d++)e=b[d],e.splice(e.indexOf(a),1);else Q(this.i,a,this.v,this.g),this.j&&Q(this.m,a,this.B,this.g);c||delete this.register[a]}return this}; | ||
(function(self){'use strict';function t(a){return"undefined"!==typeof a?a:!0}function v(a){const c=Array(a);for(let b=0;b<a;b++)c[b]=y();return c}function y(){return Object.create(null)}function z(a,c){return c.length-a.length};const A=/[\p{Z}\p{S}\p{P}\p{C}]+/u;function B(a,c){const b=Object.keys(a),d=b.length,e=[];let h="",f=0;for(let g=0,l,n;g<d;g++)l=b[g],(n=a[l])?(e[f++]=new RegExp(c?"(?!\\b)"+l+"(\\b|_)":l,"g"),e[f++]=n):h+=(h?"|":"")+l;h&&(e[f++]=new RegExp(c?"(?!\\b)("+h+")(\\b|_)":"("+h+")","g"),e[f]="");return e}function C(a,c){for(let b=0,d=c.length;b<d&&(a=a.replace(c[b],c[b+1]),a);b+=2);return a};function D(a){if(a=(""+a).toLowerCase())if(this.o&&(a=C(a,this.o)),this.A&&1<a.length&&(a=C(a,this.A)),A||""===A)if(a=a.split(A),this.filter){var c=this.filter;const b=a.length,d=[];for(let e=0,h=0;e<b;e++){const f=a[e];f&&!c[f]&&(d[h++]=f)}a=d}return a};const F={},G={};function H(a,c,b,d){const e=a.length;let h=[],f,g,l=0;d&&(d=[]);for(let n=e-1;0<=n;n--){const m=a[n],r=m.length,p=y();let q=!f;for(let k=0;k<r;k++){const u=m[k],M=u.length;if(M)for(let E=0,x,w;E<M;E++)if(w=u[E],f){if(f[w]){if(!n)if(b)b--;else if(h[l++]=w,l===c)return h;if(n||d)p[w]=1;q=!0}if(d&&(x=(g[w]||0)+1,g[w]=x,x<e)){const N=d[x-2]||(d[x-2]=[]);N[N.length]=w}}else p[w]=1}if(d)f||(g=p);else if(!q)return[];f=p}if(d)for(let n=d.length-1,m,r;0<=n;n--){m=d[n];r=m.length;for(let p=0,q;p<r;p++)if(q= | ||
m[p],!f[q]){if(b)b--;else if(h[l++]=q,l===c)return h;f[q]=1}}return h};function I(a,c){if(!(this instanceof I))return new I(a);let b;if(a){var d=a.charset;b=a.lang;"string"===typeof d&&(-1===d.indexOf(":")&&(d+=":default"),d=G[d]);"string"===typeof b&&(b=F[b])}else a={};let e,h,f=a.context||{};this.encode=a.encode||d&&d.encode||D;this.register=c||y();this.s=e=a.resolution||9;this.B=c=d&&d.B||a.tokenize||"strict";this.i="strict"===c&&f.depth;this.j=t(f.bidirectional);this.g=h=t(a.optimize);this.m=t(a.fastupdate);this.h=a.minlength||1;this.C=a.boost;this.map=h?v(e):y(); | ||
this.v=e=f.resolution||1;this.l=h?v(e):y();this.u=d&&d.u||a.rtl;this.o=(c=a.matcher||b&&b.o)&&B(c,!1);this.A=(c=a.stemmer||b&&b.A)&&B(c,!0);if(a=c=a.filter||b&&b.filter){a=c;d=y();for(let g=0,l=a.length;g<l;g++)d[a[g]]=1;a=d}this.filter=a}I.prototype.append=function(a,c){return this.add(a,c,!0)}; | ||
I.prototype.add=function(a,c,b,d){if(c&&(a||0===a)){if(!d&&!b&&this.register[a])return this.update(a,c);c=this.encode(c);if(d=c.length){const n=y(),m=y(),r=this.i,p=this.s;for(let q=0;q<d;q++){let k=c[this.u?d-1-q:q];var e=k.length;if(k&&e>=this.h&&(r||!m[k])){var h=J(p,d,q),f="";switch(this.B){case "full":if(2<e){for(h=0;h<e;h++)for(var g=e;g>h;g--)if(g-h>=this.h){var l=J(p,d,q,e,h);f=k.substring(h,g);K(this,m,f,l,a,b)}break}case "reverse":if(1<e){for(g=e-1;0<g;g--)f=k[g]+f,f.length>=this.h&&K(this, | ||
m,f,J(p,d,q,e,g),a,b);f=""}case "forward":if(1<e){for(g=0;g<e;g++)f+=k[g],f.length>=this.h&&K(this,m,f,h,a,b);break}default:if(this.C&&(h=Math.min(h/this.C(c,k,q)|0,p-1)),K(this,m,k,h,a,b),r&&1<d&&q<d-1)for(e=y(),f=this.v,h=k,g=Math.min(r+1,d-q),e[h]=1,l=1;l<g;l++)if((k=c[this.u?d-1-q-l:q+l])&&k.length>=this.h&&!e[k]){e[k]=1;const u=this.j&&k>h;K(this,n,u?h:k,J(f+(d/2>f?0:1),d,q,g-1,l-1),a,b,u?k:h)}}}}this.m||(this.register[a]=1)}}return this}; | ||
function J(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,d,e,h,f){let g=f?a.l:a.map;if(!c[b]||f&&!c[b][f])a.g&&(g=g[d]),f?(c=c[b]||(c[b]=y()),c[f]=1,g=g[f]||(g[f]=y())):c[b]=1,g=g[b]||(g[b]=[]),a.g||(g=g[d]||(g[d]=[])),h&&g.includes(e)||(g[g.length]=e,a.m&&(a=a.register[e]||(a.register[e]=[]),a[a.length]=g))} | ||
I.prototype.search=function(a,c,b){b||(c||"object"!==typeof a?"object"===typeof c&&(b=c):(b=a,a=b.query));let d=[],e;let h,f=0;if(b){a=b.query||a;c=b.limit;f=b.offset||0;var g=b.context;h=!1}if(a&&(a=this.encode(""+a),e=a.length,1<e)){b=y();var l=[];for(let m=0,r=0,p;m<e;m++)if((p=a[m])&&p.length>=this.h&&!b[p])if(this.g||h||this.map[p])l[r++]=p,b[p]=1;else return d;a=l;e=a.length}if(!e)return d;c||(c=100);g=this.i&&1<e&&!1!==g;b=0;let n;g?(n=a[0],b=1):1<e&&a.sort(z);for(let m,r;b<e;b++){r=a[b];g? | ||
(m=L(this,d,h,c,f,2===e,r,n),h&&!1===m&&d.length||(n=r)):m=L(this,d,h,c,f,1===e,r);if(m)return m;if(h&&b===e-1){l=d.length;if(!l){if(g){g=0;b=-1;continue}return d}if(1===l)return O(d[0],c,f)}}return H(d,c,f,h)}; | ||
function L(a,c,b,d,e,h,f,g){let l=[],n=g?a.l:a.map;a.g||(n=P(n,f,g,a.j));if(n){let m=0;const r=Math.min(n.length,g?a.v:a.s);for(let p=0,q=0,k,u;p<r;p++)if(k=n[p])if(a.g&&(k=P(k,f,g,a.j)),e&&k&&h&&(u=k.length,u<=e?(e-=u,k=null):(k=k.slice(e),e=0)),k&&(l[m++]=k,h&&(q+=k.length,q>=d)))break;if(m){if(h)return O(l,d,0);c[c.length]=l;return}}return!b&&l}function O(a,c,b){a=1===a.length?a[0]:[].concat.apply([],a);return b||a.length>c?a.slice(b,b+c):a} | ||
function P(a,c,b,d){b?(d=d&&c>b,a=(a=a[d?c:b])&&a[d?b:c]):a=a[c];return a}I.prototype.contain=function(a){return!!this.register[a]};I.prototype.update=function(a,c){return this.remove(a).add(a,c)};I.prototype.remove=function(a,c){const b=this.register[a];if(b){if(this.m)for(let d=0,e;d<b.length;d++)e=b[d],e.splice(e.indexOf(a),1);else Q(this.map,a,this.s,this.g),this.i&&Q(this.l,a,this.v,this.g);c||delete this.register[a]}return this}; | ||
function Q(a,c,b,d,e){let h=0;if(a.constructor===Array)if(e)c=a.indexOf(c),-1!==c?1<a.length&&(a.splice(c,1),h++):h++;else{e=Math.min(a.length,b);for(let f=0,g;f<e;f++)if(g=a[f])h=Q(g,c,b,d,e),d||h||delete a[f]}else for(let f in a)(h=Q(a[f],c,b,d,e))||delete a[f];return h};const R=self;let S;const T={Index:I,Document:null,Worker:null,registerCharset:function(a,c){G[a]=c},registerLanguage:function(a,c){F[a]=c}};(S=R.define)&&S.amd?S([],function(){return T}):R.exports?R.exports=T:R.FlexSearch=T;}(this)); |
@@ -1,1 +0,1 @@ | ||
import{IndexInterface,DocumentInterface}from"./type.js";import{create_object,is_object}from"./common.js";function CacheClass(a){this.limit=!0!==a&&a,this.cache=create_object(),this.queue=[]}export default CacheClass;export function searchCache(a,b,c){is_object(a)&&(a=a.query);let d=this.cache.get(a);return d||(d=this.search(a,b,c),this.cache.set(a,d)),d}CacheClass.prototype.set=function(a,b){if(!this.cache[a]){let b=this.queue.length;b===this.limit?delete this.cache[this.queue[b-1]]:b++;for(let a=b-1;0<a;a--)this.queue[a]=this.queue[a-1];this.queue[0]=a}this.cache[a]=b},CacheClass.prototype.get=function(a){const b=this.cache[a];if(this.limit&&b){const b=this.queue.indexOf(a);if(b){const a=this.queue[b-1];this.queue[b-1]=this.queue[b],this.queue[b]=a}}return b},CacheClass.prototype.del=function(a){for(let b,c,d=0;d<this.queue.length;d++)c=this.queue[d],b=this.cache[c],-1!==b.indexOf(a)&&(this.queue.splice(d--,1),delete this.cache[c])}; | ||
import{IndexInterface,DocumentInterface}from"./type.js";import{create_object,is_object}from"./common.js";function CacheClass(a){this.limit=!0!==a&&a,this.cache=create_object(),this.queue=[]}export default CacheClass;export function searchCache(a,b,c){is_object(a)&&(a=a.query);let d=this.cache.get(a);return d||(d=this.search(a,b,c),this.cache.set(a,d)),d}CacheClass.prototype.set=function(a,b){if(!this.cache[a]){let b=this.queue.length;b===this.limit?delete this.cache[this.queue[b-1]]:b++;for(let a=b-1;0<a;a--)this.queue[a]=this.queue[a-1];this.queue[0]=a}this.cache[a]=b},CacheClass.prototype.get=function(a){const b=this.cache[a];if(this.limit&&b){const b=this.queue.indexOf(a);if(b){const a=this.queue[b-1];this.queue[b-1]=this.queue[b],this.queue[b]=a}}return b},CacheClass.prototype.del=function(a){for(let b,c,d=0;d<this.queue.length;d++)c=this.queue[d],b=this.cache[c],b.includes(a)&&(this.queue.splice(d--,1),delete this.cache[c])}; |
@@ -1,1 +0,1 @@ | ||
import{SUPPORT_ASYNC,SUPPORT_CACHE,SUPPORT_SERIALIZE,SUPPORT_STORE,SUPPORT_TAGS,SUPPORT_WORKER}from"./config.js";import Index from"./index.js";import{DocumentInterface}from"./type.js";import Cache,{searchCache}from"./cache.js";import{create_object,is_array,is_string,is_object,parse_option,get_keys}from"./common.js";import apply_async from"./async.js";import{intersect,intersect_union}from"./intersect.js";import{exportDocument,importDocument}from"./serialize.js";import WorkerIndex from"./worker/index.js";function Document(a){if(!(this instanceof Document))return new Document(a);const b=a.document||a.doc||a;let c;this.tree=[],this.field=[],this.marker=[],this.register=create_object(),this.key=(c=b.key||b.id)&&parse_tree(c,this.marker)||"id",this.fastupdate=parse_option(a.fastupdate,!0),SUPPORT_STORE&&(this.storetree=(c=b.store)&&!0!==c&&[],this.store=c&&create_object()),SUPPORT_TAGS&&(this.tag=(c=b.tag)&&parse_tree(c,this.marker),this.tagindex=c&&create_object()),SUPPORT_CACHE&&(this.cache=(c=a.cache)&&new Cache(c),a.cache=!1),SUPPORT_WORKER&&(this.worker=a.worker),SUPPORT_ASYNC&&(this.async=!1),this.index=parse_descriptor.call(this,a,b)}export default Document;function parse_descriptor(a,b){const c=create_object();let d=b.index||b.field||b;is_string(d)&&(d=[d]);for(let e,f,g=0;g<d.length;g++)e=d[g],is_string(e)||(f=e,e=e.field),f=is_object(f)?Object.assign({},a,f):a,SUPPORT_WORKER&&this.worker&&(c[e]=new WorkerIndex(f),!c[e].worker&&(this.worker=!1)),this.worker||(c[e]=new Index(f,this.register)),this.tree[g]=parse_tree(e,this.marker),this.field[g]=e;if(SUPPORT_STORE&&this.storetree){let a=b.store;is_string(a)&&(a=[a]);for(let b=0;b<a.length;b++)this.storetree[b]=parse_tree(a[b],this.marker)}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],0<=a.indexOf("[]")&&(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]}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}function store_value(a,b,c,d,e){if(a=a[e],d===c.length-1)b[e]=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],a)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)}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.register[a])return this.update(a,b);for(let d,e,f=0;f<this.field.length;f++)e=this.field[f],d=this.tree[f],is_string(d)&&(d=[d]),add_index(b,d,this.marker,0,this.index[e],a,d[0],c);if(SUPPORT_TAGS&&this.tag){let d=parse_simple(b,this.tag),e=create_object();is_string(d)&&(d=[d]);for(let b,f,g=0;g<d.length;g++)if(b=d[g],!e[b]&&(e[b]=1,f=this.tagindex[b]||(this.tagindex[b]=[]),(!c||-1===f.indexOf(a))&&(f[f.length]=a,this.fastupdate))){const b=this.register[a]||(this.register[a]=[]);b[b.length]=f}}if(SUPPORT_STORE&&this.store&&(!c||!this.store[a])){let c;if(this.storetree){c=create_object();for(let a,d=0;d<this.storetree.length;d++)a=this.storetree[d],is_string(a)?c[a]=b[a]:store_value(b,c,a,0,a[0])}this.store[a]=c||b}}return this},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){if(is_object(a)&&(a=parse_simple(a,this.key)),this.register[a]){for(let b=0;b<this.field.length&&(this.index[this.field[b]].remove(a,!this.worker),!this.fastupdate);b++);if(SUPPORT_TAGS&&this.tag&&!this.fastupdate)for(let b in this.tagindex){const c=this.tagindex[b],d=c.indexOf(a);-1!==d&&(1<c.length?c.splice(d,1):delete this.tagindex[b])}SUPPORT_STORE&&this.store&&delete this.store[a],delete this.register[a]}return this},Document.prototype.search=function(a,b,c,d){c||(!b&&is_object(a)?(c=a,a=c.query):is_object(b)&&(c=b,b=0));let e,f,g,h,j,k,l=[],m=[],n=0;if(c)if(is_array(c))g=c,c=null;else{if(e=c.pluck,g=e||c.index||c.field,h=SUPPORT_TAGS&&c.tag,f=SUPPORT_STORE&&this.store&&c.enrich,j="and"===c.bool,b=c.limit||100,k=c.offset||0,h&&(is_string(h)&&(h=[h]),!a)){for(let a,c=0;c<h.length;c++)a=get_tag.call(this,h[c],b,k,f),a&&(l[l.length]=a,n++);return n?l:[]}is_string(g)&&(g=[g])}g||(g=this.field),j=j&&(1<g.length||h&&1<h.length);const o=!d&&(this.worker||this.async)&&[];for(let e,f,p,q=0;q<g.length;q++){let i;if(f=g[q],is_string(f)||(i=f,f=f.field),o){o[q]=this.index[f].searchAsync(a,b,i||c);continue}else e=d?d[q]:this.index[f].search(a,b,i||c);if(p=e&&e.length,h&&p){const a=[];let c=0;j&&(a[0]=[e]);for(let b,d,e=0;e<h.length;e++)b=h[e],d=this.tagindex[b],p=d&&d.length,p&&(c++,a[a.length]=j?[d]:d);c&&(e=j?intersect(a,b||100,k||0):intersect_union(e,a),p=e.length)}if(p)m[n]=f,l[n++]=e;else if(j)return[]}if(o){const d=this;return new Promise(function(e){Promise.all(o).then(function(f){e(d.search(a,b,c,f))})})}if(!n)return[];if(e&&(!f||!this.store))return l[0];for(let g,h=0;h<m.length;h++){if(g=l[h],g.length&&f&&(g=apply_enrich.call(this,g)),e)return g;l[h]={field:m[h],result:g}}return l};function get_tag(a,b,c,d){let e=this.tagindex[a],f=e&&e.length-c;if(f&&0<f)return(f>b||c)&&(e=e.slice(c,c+b)),d&&(e=apply_enrich.call(this,e)),{tag:a,result:e}}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[c]};return b}Document.prototype.contain=function(a){return!!this.register[a]},SUPPORT_STORE&&(Document.prototype.get=function(a){return this.store[a]},Document.prototype.set=function(a,b){return this.store[a]=b,this}),SUPPORT_CACHE&&(Document.prototype.searchCache=searchCache),SUPPORT_SERIALIZE&&(Document.prototype.export=exportDocument,Document.prototype.import=importDocument),SUPPORT_ASYNC&&apply_async(Document.prototype); | ||
import{SUPPORT_ASYNC,SUPPORT_CACHE,SUPPORT_SERIALIZE,SUPPORT_STORE,SUPPORT_TAGS,SUPPORT_WORKER}from"./config.js";import Index from"./index.js";import{DocumentInterface}from"./type.js";import Cache,{searchCache}from"./cache.js";import{create_object,is_array,is_string,is_object,parse_option,get_keys}from"./common.js";import apply_async from"./async.js";import{intersect,intersect_union}from"./intersect.js";import{exportDocument,importDocument}from"./serialize.js";import WorkerIndex from"./worker/index.js";function Document(a){if(!(this instanceof Document))return new Document(a);const b=a.document||a.doc||a;let c;this.tree=[],this.field=[],this.marker=[],this.register=create_object(),this.key=(c=b.key||b.id)&&parse_tree(c,this.marker)||"id",this.fastupdate=parse_option(a.fastupdate,!0),SUPPORT_STORE&&(this.storetree=(c=b.store)&&!0!==c&&[],this.store=c&&create_object()),SUPPORT_TAGS&&(this.tag=(c=b.tag)&&parse_tree(c,this.marker),this.tagindex=c&&create_object()),SUPPORT_CACHE&&(this.cache=(c=a.cache)&&new Cache(c),a.cache=!1),SUPPORT_WORKER&&(this.worker=a.worker),SUPPORT_ASYNC&&(this.async=!1),this.index=parse_descriptor.call(this,a,b)}export default Document;function parse_descriptor(a,b){const c=create_object();let d=b.index||b.field||b;is_string(d)&&(d=[d]);for(let e,f,g=0;g<d.length;g++)e=d[g],is_string(e)||(f=e,e=e.field),f=is_object(f)?Object.assign({},a,f):a,SUPPORT_WORKER&&this.worker&&(c[e]=new WorkerIndex(f),!c[e].worker&&(this.worker=!1)),this.worker||(c[e]=new Index(f,this.register)),this.tree[g]=parse_tree(e,this.marker),this.field[g]=e;if(SUPPORT_STORE&&this.storetree){let a=b.store;is_string(a)&&(a=[a]);for(let b=0;b<a.length;b++)this.storetree[b]=parse_tree(a[b],this.marker)}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],0<=a.indexOf("[]")&&(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]}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}function store_value(a,b,c,d,e){if(a=a[e],d===c.length-1)b[e]=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],a)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)}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.register[a])return this.update(a,b);for(let d,e,f=0;f<this.field.length;f++)e=this.field[f],d=this.tree[f],is_string(d)&&(d=[d]),add_index(b,d,this.marker,0,this.index[e],a,d[0],c);if(SUPPORT_TAGS&&this.tag){let d=parse_simple(b,this.tag),e=create_object();is_string(d)&&(d=[d]);for(let b,f,g=0;g<d.length;g++)if(b=d[g],!e[b]&&(e[b]=1,f=this.tagindex[b]||(this.tagindex[b]=[]),(!c||!f.includes(a))&&(f[f.length]=a,this.fastupdate))){const b=this.register[a]||(this.register[a]=[]);b[b.length]=f}}if(SUPPORT_STORE&&this.store&&(!c||!this.store[a])){let c;if(this.storetree){c=create_object();for(let a,d=0;d<this.storetree.length;d++)a=this.storetree[d],is_string(a)?c[a]=b[a]:store_value(b,c,a,0,a[0])}this.store[a]=c||b}}return this},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){if(is_object(a)&&(a=parse_simple(a,this.key)),this.register[a]){for(let b=0;b<this.field.length&&(this.index[this.field[b]].remove(a,!this.worker),!this.fastupdate);b++);if(SUPPORT_TAGS&&this.tag&&!this.fastupdate)for(let b in this.tagindex){const c=this.tagindex[b],d=c.indexOf(a);-1!==d&&(1<c.length?c.splice(d,1):delete this.tagindex[b])}SUPPORT_STORE&&this.store&&delete this.store[a],delete this.register[a]}return this},Document.prototype.search=function(a,b,c,d){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=0;if(c)if(is_array(c))g=c,c=null;else{if(a=c.query||a,e=c.pluck,g=e||c.index||c.field,h=SUPPORT_TAGS&&c.tag,f=SUPPORT_STORE&&this.store&&c.enrich,j="and"===c.bool,b=c.limit||b||100,k=c.offset||0,h&&(is_string(h)&&(h=[h]),!a)){for(let a,c=0;c<h.length;c++)a=get_tag.call(this,h[c],b,k,f),a&&(l[l.length]=a,n++);return n?l:[]}is_string(g)&&(g=[g])}g||(g=this.field),j=j&&(1<g.length||h&&1<h.length);const o=!d&&(this.worker||this.async)&&[];for(let e,f,p,q=0;q<g.length;q++){let i;if(f=g[q],is_string(f)||(i=f,f=i.field,a=i.query||a,b=i.limit||b),o){o[q]=this.index[f].searchAsync(a,b,i||c);continue}else e=d?d[q]:this.index[f].search(a,b,i||c);if(p=e&&e.length,h&&p){const a=[];let c=0;j&&(a[0]=[e]);for(let b,d,e=0;e<h.length;e++)b=h[e],d=this.tagindex[b],p=d&&d.length,p&&(c++,a[a.length]=j?[d]:d);c&&(e=j?intersect(a,b||100,k||0):intersect_union(e,a),p=e.length)}if(p)m[n]=f,l[n++]=e;else if(j)return[]}if(o){const d=this;return new Promise(function(e){Promise.all(o).then(function(f){e(d.search(a,b,c,f))})})}if(!n)return[];if(e&&(!f||!this.store))return l[0];for(let g,h=0;h<m.length;h++){if(g=l[h],g.length&&f&&(g=apply_enrich.call(this,g)),e)return g;l[h]={field:m[h],result:g}}return l};function get_tag(a,b,c,d){let e=this.tagindex[a],f=e&&e.length-c;if(f&&0<f)return(f>b||c)&&(e=e.slice(c,c+b)),d&&(e=apply_enrich.call(this,e)),{tag:a,result:e}}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[c]};return b}Document.prototype.contain=function(a){return!!this.register[a]},SUPPORT_STORE&&(Document.prototype.get=function(a){return this.store[a]},Document.prototype.set=function(a,b){return this.store[a]=b,this}),SUPPORT_CACHE&&(Document.prototype.searchCache=searchCache),SUPPORT_SERIALIZE&&(Document.prototype.export=exportDocument,Document.prototype.import=importDocument),SUPPORT_ASYNC&&apply_async(Document.prototype); |
@@ -1,1 +0,1 @@ | ||
import{SUPPORT_ENCODER,SUPPORT_CACHE,SUPPORT_ASYNC,SUPPORT_SUGGESTION,SUPPORT_SERIALIZE}from"./config.js";import{IndexInterface}from"./type.js";import{encode as default_encoder}from"./lang/latin/default.js";import{create_object,create_object_array,concat,sort_by_length_down,is_array,is_string,is_object,parse_option}from"./common.js";import{pipeline,init_stemmer_or_matcher,init_filter}from"./lang.js";import{global_lang,global_charset}from"./global.js";import apply_async from"./async.js";import{intersect}from"./intersect.js";import Cache,{searchCache}from"./cache.js";import apply_preset from"./preset.js";import{exportIndex,importIndex}from"./serialize.js";function Index(a,b){if(!(this instanceof Index))return new Index(a);let c,d,e;a?(SUPPORT_ENCODER&&(a=apply_preset(a)),c=a.charset,d=a.lang,is_string(c)&&(-1===c.indexOf(":")&&(c+=":default"),c=global_charset[c]),is_string(d)&&(d=global_lang[d])):a={};let f,g,h=a.context||{};this.encode=a.encode||c&&c.encode||default_encoder,this.register=b||create_object(),this.resolution=f=a.resolution||9,this.tokenize=e=c&&c.tokenize||a.tokenize||"strict",this.depth="strict"===e&&h.depth,this.bidirectional=parse_option(h.bidirectional,!0),this.optimize=g=parse_option(a.optimize,!0),this.fastupdate=parse_option(a.fastupdate,!0),this.minlength=a.minlength||1,this.boost=a.boost,this.map=g?create_object_array(f):create_object(),this.resolution_ctx=f=h.resolution||1,this.ctx=g?create_object_array(f):create_object(),this.rtl=c&&c.rtl||a.rtl,this.matcher=(e=a.matcher||d&&d.matcher)&&init_stemmer_or_matcher(e,!1),this.stemmer=(e=a.stemmer||d&&d.stemmer)&&init_stemmer_or_matcher(e,!0),this.filter=(e=a.filter||d&&d.filter)&&init_filter(e),SUPPORT_CACHE&&(this.cache=(e=a.cache)&&new Cache(e))}export default Index;Index.prototype.append=function(a,b){return this.add(a,b,!0)},Index.prototype.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.register[a])return this.update(a,b);b=this.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(i&&k>=this.minlength&&(g||!f[i])){let l=get_score(h,e,j),m="";switch(this.tokenize){case"full":if(3<k){for(let b=0;b<k;b++)for(let d=k;d>b;d--)if(d-b>=this.minlength){const g=get_score(h,e,j,k,b);m=i.substring(b,d),this.push_index(f,m,g,a,c)}break}case"reverse":if(2<k){for(let b=k-1;0<b;b--)if(m=i[b]+m,m.length>=this.minlength){const d=get_score(h,e,j,k,b);this.push_index(f,m,d,a,c)}m=""}case"forward":if(1<k){for(let b=0;b<k;b++)m+=i[b],m.length>=this.minlength&&this.push_index(f,m,l,a,c);break}default:if(this.boost&&(l=Math.min(0|l/this.boost(b,i,j),h-1)),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&&i.length>=this.minlength&&!f[i]){f[i]=1;const b=get_score(h+(e/2>h?0:1),e,j,l-1,g-1),m=this.bidirectional&&i>k;this.push_index(d,m?k:i,b,a,c,m?i:k)}}}}}this.fastupdate||(this.register[a]=1)}}return this};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}Index.prototype.push_index=function(a,b,c,d,e,f){let g=f?this.ctx:this.map;if((!a[b]||f&&!a[b][f])&&(this.optimize&&(g=g[c]),f?(a=a[b]||(a[b]=create_object()),a[f]=1,g=g[f]||(g[f]=create_object())):a[b]=1,g=g[b]||(g[b]=[]),this.optimize||(g=g[c]||(g[c]=[])),(!e||-1===g.indexOf(d))&&(g[g.length]=d,this.fastupdate))){const a=this.register[d]||(this.register[d]=[]);a[a.length]=g}},Index.prototype.search=function(a,b,c){c||(!b&&is_object(a)?(c=a,a=c.query):is_object(b)&&(c=b));let d,e,f,g=[],h=0;if(c&&(b=c.limit,h=c.offset||0,e=c.context,f=SUPPORT_SUGGESTION&&c.suggest),a&&(a=this.encode(a),d=a.length,1<d)){const b=create_object(),c=[];for(let e,h=0,i=0;h<d;h++)if(e=a[h],e&&e.length>=this.minlength&&!b[e]){if(!this.optimize&&!f&&!this.map[e])return g;c[i++]=e,b[e]=1}a=c,d=a.length}if(!d)return g;b||(b=100);let i,j=this.depth&&1<d&&!1!==e,k=0;j?(i=a[0],k=1):1<d&&a.sort(sort_by_length_down);for(let e,l;k<d;k++){if(l=a[k],j?(e=this.add_result(g,f,b,h,2===d,l,i),(!f||!1!==e||!g.length)&&(i=l)):e=this.add_result(g,f,b,h,1===d,l),e)return e;if(f&&k==d-1){let a=g.length;if(!a){if(j){j=0,k=-1;continue}return g}if(1===a)return single_result(g[0],b,h)}}return intersect(g,b,h,f)},Index.prototype.add_result=function(a,b,c,d,e,f,g){let h=[],i=g?this.ctx:this.map;if(this.optimize||(i=get_array(i,f,g,this.bidirectional)),i){let b=0;const j=Math.min(i.length,g?this.resolution_ctx:this.resolution);for(let a,k,l=0,m=0;l<j&&(a=i[l],!(a&&(this.optimize&&(a=get_array(a,f,g,this.bidirectional)),d&&a&&e&&(k=a.length,k<=d?(d-=k,a=null):(a=a.slice(d),d=0)),a&&(h[b++]=a,e&&(m+=a.length,m>=c)))));l++);if(b)return e?single_result(h,c,0):void(a[a.length]=h)}return!b&&h};function single_result(a,b,c){return a=1===a.length?a[0]:concat(a),c||a.length>b?a.slice(c,c+b):a}function get_array(a,b,c,d){if(c){const e=d&&b>c;a=a[e?b:c],a=a&&a[e?c:b]}else a=a[b];return a}Index.prototype.contain=function(a){return!!this.register[a]},Index.prototype.update=function(a,b){return this.remove(a).add(a,b)},Index.prototype.remove=function(a,b){const c=this.register[a];if(c){if(this.fastupdate)for(let b,d=0;d<c.length;d++)b=c[d],b.splice(b.indexOf(a),1);else remove_index(this.map,a,this.resolution,this.optimize),this.depth&&remove_index(this.ctx,a,this.resolution_ctx,this.optimize);b||delete this.register[a],SUPPORT_CACHE&&this.cache&&this.cache.del(a)}return this};function remove_index(a,b,c,d,e){let f=0;if(!is_array(a))for(let g in a)f=remove_index(a[g],b,c,d,e),f||delete a[g];else if(!e){e=Math.min(a.length,c);for(let g,h=0;h<e;h++)g=a[h],g&&(f=remove_index(g,b,c,d,e),!d&&!f&&delete a[h])}else{const c=a.indexOf(b);-1===c?f++:1<a.length&&(a.splice(c,1),f++)}return f}SUPPORT_CACHE&&(Index.prototype.searchCache=searchCache),SUPPORT_SERIALIZE&&(Index.prototype.export=exportIndex,Index.prototype.import=importIndex),SUPPORT_ASYNC&&apply_async(Index.prototype); | ||
import{SUPPORT_ENCODER,SUPPORT_CACHE,SUPPORT_ASYNC,SUPPORT_SUGGESTION,SUPPORT_SERIALIZE}from"./config.js";import{IndexInterface}from"./type.js";import{encode as default_encoder}from"./lang/latin/default.js";import{create_object,create_object_array,concat,sort_by_length_down,is_array,is_string,is_object,parse_option}from"./common.js";import{pipeline,init_stemmer_or_matcher,init_filter}from"./lang.js";import{global_lang,global_charset}from"./global.js";import apply_async from"./async.js";import{intersect}from"./intersect.js";import Cache,{searchCache}from"./cache.js";import apply_preset from"./preset.js";import{exportIndex,importIndex}from"./serialize.js";function Index(a,b){if(!(this instanceof Index))return new Index(a);let c,d,e;a?(SUPPORT_ENCODER&&(a=apply_preset(a)),c=a.charset,d=a.lang,is_string(c)&&(-1===c.indexOf(":")&&(c+=":default"),c=global_charset[c]),is_string(d)&&(d=global_lang[d])):a={};let f,g,h=a.context||{};this.encode=a.encode||c&&c.encode||default_encoder,this.register=b||create_object(),this.resolution=f=a.resolution||9,this.tokenize=e=c&&c.tokenize||a.tokenize||"strict",this.depth="strict"===e&&h.depth,this.bidirectional=parse_option(h.bidirectional,!0),this.optimize=g=parse_option(a.optimize,!0),this.fastupdate=parse_option(a.fastupdate,!0),this.minlength=a.minlength||1,this.boost=a.boost,this.map=g?create_object_array(f):create_object(),this.resolution_ctx=f=h.resolution||1,this.ctx=g?create_object_array(f):create_object(),this.rtl=c&&c.rtl||a.rtl,this.matcher=(e=a.matcher||d&&d.matcher)&&init_stemmer_or_matcher(e,!1),this.stemmer=(e=a.stemmer||d&&d.stemmer)&&init_stemmer_or_matcher(e,!0),this.filter=(e=a.filter||d&&d.filter)&&init_filter(e),SUPPORT_CACHE&&(this.cache=(e=a.cache)&&new Cache(e))}export default Index;Index.prototype.append=function(a,b){return this.add(a,b,!0)},Index.prototype.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.register[a])return this.update(a,b);b=this.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(i&&k>=this.minlength&&(g||!f[i])){let l=get_score(h,e,j),m="";switch(this.tokenize){case"full":if(2<k){for(let b=0;b<k;b++)for(let d=k;d>b;d--)if(d-b>=this.minlength){const g=get_score(h,e,j,k,b);m=i.substring(b,d),this.push_index(f,m,g,a,c)}break}case"reverse":if(1<k){for(let b=k-1;0<b;b--)if(m=i[b]+m,m.length>=this.minlength){const d=get_score(h,e,j,k,b);this.push_index(f,m,d,a,c)}m=""}case"forward":if(1<k){for(let b=0;b<k;b++)m+=i[b],m.length>=this.minlength&&this.push_index(f,m,l,a,c);break}default:if(this.boost&&(l=Math.min(0|l/this.boost(b,i,j),h-1)),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&&i.length>=this.minlength&&!f[i]){f[i]=1;const b=get_score(h+(e/2>h?0:1),e,j,l-1,g-1),m=this.bidirectional&&i>k;this.push_index(d,m?k:i,b,a,c,m?i:k)}}}}}this.fastupdate||(this.register[a]=1)}}return this};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}Index.prototype.push_index=function(a,b,c,d,e,f){let g=f?this.ctx:this.map;if((!a[b]||f&&!a[b][f])&&(this.optimize&&(g=g[c]),f?(a=a[b]||(a[b]=create_object()),a[f]=1,g=g[f]||(g[f]=create_object())):a[b]=1,g=g[b]||(g[b]=[]),this.optimize||(g=g[c]||(g[c]=[])),(!e||!g.includes(d))&&(g[g.length]=d,this.fastupdate))){const a=this.register[d]||(this.register[d]=[]);a[a.length]=g}},Index.prototype.search=function(a,b,c){c||(!b&&is_object(a)?(c=a,a=c.query):is_object(b)&&(c=b));let d,e,f,g=[],h=0;if(c&&(a=c.query||a,b=c.limit,h=c.offset||0,e=c.context,f=SUPPORT_SUGGESTION&&c.suggest),a&&(a=this.encode(""+a),d=a.length,1<d)){const b=create_object(),c=[];for(let e,h=0,i=0;h<d;h++)if(e=a[h],e&&e.length>=this.minlength&&!b[e]){if(!this.optimize&&!f&&!this.map[e])return g;c[i++]=e,b[e]=1}a=c,d=a.length}if(!d)return g;b||(b=100);let i,j=this.depth&&1<d&&!1!==e,k=0;j?(i=a[0],k=1):1<d&&a.sort(sort_by_length_down);for(let e,l;k<d;k++){if(l=a[k],j?(e=this.add_result(g,f,b,h,2===d,l,i),(!f||!1!==e||!g.length)&&(i=l)):e=this.add_result(g,f,b,h,1===d,l),e)return e;if(f&&k==d-1){let a=g.length;if(!a){if(j){j=0,k=-1;continue}return g}if(1===a)return single_result(g[0],b,h)}}return intersect(g,b,h,f)},Index.prototype.add_result=function(a,b,c,d,e,f,g){let h=[],i=g?this.ctx:this.map;if(this.optimize||(i=get_array(i,f,g,this.bidirectional)),i){let b=0;const j=Math.min(i.length,g?this.resolution_ctx:this.resolution);for(let a,k,l=0,m=0;l<j&&(a=i[l],!(a&&(this.optimize&&(a=get_array(a,f,g,this.bidirectional)),d&&a&&e&&(k=a.length,k<=d?(d-=k,a=null):(a=a.slice(d),d=0)),a&&(h[b++]=a,e&&(m+=a.length,m>=c)))));l++);if(b)return e?single_result(h,c,0):void(a[a.length]=h)}return!b&&h};function single_result(a,b,c){return a=1===a.length?a[0]:concat(a),c||a.length>b?a.slice(c,c+b):a}function get_array(a,b,c,d){if(c){const e=d&&b>c;a=a[e?b:c],a=a&&a[e?c:b]}else a=a[b];return a}Index.prototype.contain=function(a){return!!this.register[a]},Index.prototype.update=function(a,b){return this.remove(a).add(a,b)},Index.prototype.remove=function(a,b){const c=this.register[a];if(c){if(this.fastupdate)for(let b,d=0;d<c.length;d++)b=c[d],b.splice(b.indexOf(a),1);else remove_index(this.map,a,this.resolution,this.optimize),this.depth&&remove_index(this.ctx,a,this.resolution_ctx,this.optimize);b||delete this.register[a],SUPPORT_CACHE&&this.cache&&this.cache.del(a)}return this};function remove_index(a,b,c,d,e){let f=0;if(!is_array(a))for(let g in a)f=remove_index(a[g],b,c,d,e),f||delete a[g];else if(!e){e=Math.min(a.length,c);for(let g,h=0;h<e;h++)g=a[h],g&&(f=remove_index(g,b,c,d,e),!d&&!f&&delete a[h])}else{const c=a.indexOf(b);-1===c?f++:1<a.length&&(a.splice(c,1),f++)}return f}SUPPORT_CACHE&&(Index.prototype.searchCache=searchCache),SUPPORT_SERIALIZE&&(Index.prototype.export=exportIndex,Index.prototype.import=importIndex),SUPPORT_ASYNC&&apply_async(Index.prototype); |
@@ -1,1 +0,1 @@ | ||
import{create_object,concat}from"./common.js";export function intersect(a,b,c,d){const e=a.length;let f,g,h=[],i=0;d&&(d=[]);for(let j=e-1;0<=j;j--){const k=a[j],l=k.length,m=create_object();let n=!f;for(let a=0;a<l;a++){const l=k[a],o=l.length;if(o)for(let a,k,p=0;p<o;p++)if(k=l[p],f){if(f[k]){if(!j)if(c)c--;else if(h[i++]=k,i===b)return h;(j||d)&&(m[k]=1),n=!0}if(d&&(g[k]=(a=g[k])?++a:a=1,a<e)){const b=d[a-2]||(d[a-2]=[]);b[b.length]=k}}else m[k]=1}if(d)f||(g=m);else if(!n)return[];f=m}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(h[i++]=d,i===b)return h;f[d]=1}}return h}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[e.length]=a)}return e} | ||
import{create_object,concat}from"./common.js";export function intersect(a,b,c,d){const e=a.length;let f,g,h=[],i=0;d&&(d=[]);for(let j=e-1;0<=j;j--){const k=a[j],l=k.length,m=create_object();let n=!f;for(let a=0;a<l;a++){const l=k[a],o=l.length;if(o)for(let a,k,p=0;p<o;p++)if(k=l[p],f){if(f[k]){if(!j)if(c)c--;else if(h[i++]=k,i===b)return h;(j||d)&&(m[k]=1),n=!0}if(d&&(a=(g[k]||0)+1,g[k]=a,a<e)){const b=d[a-2]||(d[a-2]=[]);b[b.length]=k}}else m[k]=1}if(d)f||(g=m);else if(!n)return[];f=m}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(h[i++]=d,i===b)return h;f[d]=1}}return h}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[e.length]=a)}return e} |
@@ -1,1 +0,1 @@ | ||
import{IndexInterface}from"../../type.js";import{pipeline}from"../../lang.js";export const rtl=!0;export const tokenize="";export default{encode:encode,rtl:!0};const regex=/[\x00-\x7F]+/g;export function encode(a){return pipeline.call(this,a.replace(regex," "),!1," ",!1)} | ||
import{IndexInterface}from"../../type.js";import{pipeline}from"../../lang.js";export const rtl=!0;export const tokenize="";export default{encode:encode,rtl:!0};const regex=/[\x00-\x7F]+/g,split=/\s+/;export function encode(a){return pipeline.call(this,(""+a).replace(regex," "),!1,split,!1)} |
@@ -1,1 +0,1 @@ | ||
import{IndexInterface}from"../../type.js";import{pipeline}from"../../lang.js";export const rtl=!1;export const tokenize="strict";export default{encode:encode,rtl:!1,tokenize:"strict"};const regex=/[\x00-\x7F]+/g;export function encode(a){return pipeline.call(this,a.replace(regex,""),!1,"",!1)} | ||
import{IndexInterface}from"../../type.js";import{pipeline}from"../../lang.js";export const rtl=!1;export const tokenize="strict";export default{encode:encode,rtl:!1,tokenize:"strict"};const regex=/[\x00-\x7F]+/g;export function encode(a){return pipeline.call(this,(""+a).replace(regex,""),!1,"",!1)} |
@@ -1,1 +0,1 @@ | ||
import{IndexInterface}from"../../type.js";import{pipeline}from"../../lang.js";export const rtl=!1;export const tokenize="";export default{encode:encode,rtl:!1};const regex=/[\x00-\x7F]+/g;export function encode(a){return pipeline.call(this,a.replace(regex," "),!1," ",!1)} | ||
import{IndexInterface}from"../../type.js";import{pipeline}from"../../lang.js";export const rtl=!1;export const tokenize="";export default{encode:encode,rtl:!1};const regex=/[\x00-\x7F]+/g,split=/\s+/;export function encode(a){return pipeline.call(this,(""+a).replace(regex," "),!1,split,!1)} |
@@ -1,1 +0,1 @@ | ||
import{IndexInterface}from"../../type.js";import{regex,replace,collapse}from"../../lang.js";import{encode as encode_balance}from"./balance.js";export const rtl=!1;export const tokenize="";export default{encode:encode,rtl:!1,tokenize:""};const regex_ae=regex("ae"),regex_oe=regex("oe"),regex_sh=regex("sh"),regex_th=regex("th"),regex_ph=regex("ph"),regex_pf=regex("pf"),pairs=[regex_ae,"a",regex_oe,"o",regex_sh,"s",regex_th,"t",regex_ph,"f",regex_pf,"f",regex("(?![aeo])h(?![aeo])"),"",regex("(?!^[aeo])h(?!^[aeo])"),""];export function encode(a,b){return a&&(a=encode_balance.call(this,a).join(" "),2<a.length&&(a=replace(a,pairs)),!b&&(1<a.length&&(a=collapse(a)),a&&(a=a.split(" ")))),a} | ||
import{IndexInterface}from"../../type.js";import{regex,replace,collapse}from"../../lang.js";import{encode as encode_balance}from"./balance.js";export const rtl=!1;export const tokenize="";export default{encode:encode,rtl:!1,tokenize:""};const regex_ae=regex("ae"),regex_oe=regex("oe"),regex_sh=regex("sh"),regex_th=regex("th"),regex_ph=regex("ph"),regex_pf=regex("pf"),pairs=[regex_ae,"a",regex_oe,"o",regex_sh,"s",regex_th,"t",regex_ph,"f",regex_pf,"f",regex("(?![aeo])h(?![aeo])"),"",regex("(?!^[aeo])h(?!^[aeo])"),""];export function encode(a,b){return a&&(a=encode_balance.call(this,a).join(" "),2<a.length&&(a=replace(a,pairs)),!b&&(1<a.length&&(a=collapse(a)),a&&(a=a.split(" ")))),a||[]} |
@@ -1,1 +0,1 @@ | ||
import{IndexInterface}from"../../type.js";import{pipeline,normalize,regex_whitespace}from"../../lang.js";export const rtl=!1;export const tokenize="";export default{encode:encode,rtl:!1,tokenize:""};export function encode(a){return pipeline.call(this,a.toLowerCase(),!1,regex_whitespace,!1)} | ||
import{IndexInterface}from"../../type.js";import{pipeline,normalize,regex_whitespace}from"../../lang.js";export const rtl=!1;export const tokenize="";export default{encode:encode,rtl:!1,tokenize:""};export function encode(a){return pipeline.call(this,(""+a).toLowerCase(),!1,regex_whitespace,!1)} |
@@ -1,1 +0,1 @@ | ||
import{IndexInterface}from"../../type.js";import{regex,replace,collapse}from"../../lang.js";import{encode as encode_advanced}from"./advanced.js";export const rtl=!1;export const tokenize="";export default{encode:encode,rtl:!1,tokenize:""};const prefix="(?!\\b)",regex_vowel=regex("(?!\\b)[aeo]"),pairs=[regex_vowel,""];export function encode(a){return a&&(a=encode_advanced.call(this,a,!0),1<a.length&&(a=a.replace(regex_vowel,"")),1<a.length&&(a=collapse(a)),a&&(a=a.split(" "))),a} | ||
import{IndexInterface}from"../../type.js";import{regex,replace,collapse}from"../../lang.js";import{encode as encode_advanced}from"./advanced.js";export const rtl=!1;export const tokenize="";export default{encode:encode,rtl:!1,tokenize:""};const prefix="(?!\\b)",regex_vowel=regex("(?!\\b)[aeo]"),pairs=[regex_vowel,""];export function encode(a){return a&&(a=encode_advanced.call(this,a,!0),1<a.length&&(a=a.replace(regex_vowel,"")),1<a.length&&(a=collapse(a)),a&&(a=a.split(" "))),a||[]} |
@@ -1,1 +0,1 @@ | ||
import{IndexInterface,DocumentInterface}from"./type.js";import{create_object,is_string}from"./common.js";function async(a,b,c,d,e,f){setTimeout(function(){const g=a(c,JSON.stringify(f));g&&g.then?g.then(function(){b.export(a,b,c,d,e+1)}):b.export(a,b,c,d,e+1)})}export function exportIndex(a,b,c,d,e){let f,g;switch(e||(e=0)){case 0:if(f="reg",this.fastupdate)for(let a in g=create_object(),this.register)g[a]=1;else g=this.register;break;case 1:f="cfg",g={doc:0,opt:this.optimize?1:0};break;case 2:f="map",g=this.map;break;case 3:f="ctx",g=this.ctx;break;default:return;}return async(a,b||this,c?c+"."+f:f,d,e,g),!0}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.register=b):"map"===a?this.map=b:"ctx"===a?this.ctx=b:void 0)}export function exportDocument(a,b,c,d,e){if(e||(e=0),d||(d=0),d<this.field.length){const c=this.field[d],f=this.index[c];b=this,setTimeout(function(){f.export(a,b,e?c.replace(":","-"):"",d,e++)||(d++,e=1,b.export(a,b,c,d,e))})}else{let b,c;switch(e){case 1:b="tag",c=this.tagindex;break;case 2:b="store",c=this.store;break;default:return;}async(a,this,b,d,e,c)}}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.register=b;for(let a,c=0;c<this.field.length;c++)a=this.index[this.field[c]],a.register=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);}} | ||
import{IndexInterface,DocumentInterface}from"./type.js";import{create_object,is_string}from"./common.js";function async(a,b,c,d,e,f){setTimeout(function(){const g=a(c,JSON.stringify(f));g&&g.then?g.then(function(){b.export(a,b,c,d,e+1)}):b.export(a,b,c,d,e+1)})}export function exportIndex(a,b,c,d,e){let f,g;switch(e||(e=0)){case 0:if(f="reg",this.fastupdate)for(let a in g=create_object(),this.register)g[a]=1;else g=this.register;break;case 1:f="cfg",g={doc:0,opt:this.optimize?1:0};break;case 2:f="map",g=this.map;break;case 3:f="ctx",g=this.ctx;break;default:return;}return async(a,b||this,c?c+"."+f:f,d,e,g),!0}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.register=b):"map"===a?this.map=b:"ctx"===a?this.ctx=b:void 0)}export function exportDocument(a,b,c,d,e){if(e||(e=0),d||(d=0),d<this.field.length){const c=this.field[d],f=this.index[c];b=this,setTimeout(function(){f.export(a,b,e?c:"",d,e++)||(d++,e=1,b.export(a,b,c,d,e))})}else{let b,c;switch(e){case 1:b="tag",c=this.tagindex;break;case 2:b="store",c=this.store;break;default:return;}async(a,this,b,d,e,c)}}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.register=b;for(let a,c=0;c<this.field.length;c++)a=this.index[this.field[c]],a.register=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,1 +0,1 @@ | ||
import{create_object,is_function,is_object,is_string}from"../common.js";import handler from"./handler.js";let pid=0;function WorkerIndex(a){if(!(this instanceof WorkerIndex))return new WorkerIndex(a);let b;a?is_function(b=a.encode)&&(a.encode=b.toString()):a={};let c=(self||window)._factory;c&&(c=c.toString());const d=self.exports,e=this;this.worker=create(c,d,a.worker),this.resolver=create_object();this.worker&&(d?this.worker.on("message",function(a){e.resolver[a.id](a.msg),delete e.resolver[a.id]}):this.worker.onmessage=function(a){a=a.data,e.resolver[a.id](a.msg),delete e.resolver[a.id]},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){setTimeout(function(){b.resolver[++pid]=d,b.worker.postMessage({task:a,id:pid,args:c})})});return e?(f.then(e),this):f}}function create(factory,is_node_js,worker_path){let worker;try{worker=is_node_js?eval("new (require(\"worker_threads\")[\"Worker\"])(\"../dist/node/node.js\")"):factory?new Worker(URL.createObjectURL(new Blob(["onmessage="+handler.toString()],{type:"text/javascript"}))):new Worker(is_string(worker_path)?worker_path:"worker/worker.js",{type:"module"})}catch(a){}return worker} | ||
import{create_object,is_function,is_object,is_string}from"../common.js";import handler from"./handler.js";let pid=0;function WorkerIndex(a){if(!(this instanceof WorkerIndex))return new WorkerIndex(a);let b;a?is_function(b=a.encode)&&(a.encode=b.toString()):a={};let c=(self||window)._factory;c&&(c=c.toString());const d="undefined"==typeof window&&self.exports,e=this;this.worker=create(c,d,a.worker),this.resolver=create_object();this.worker&&(d?this.worker.on("message",function(a){e.resolver[a.id](a.msg),delete e.resolver[a.id]}):this.worker.onmessage=function(a){a=a.data,e.resolver[a.id](a.msg),delete e.resolver[a.id]},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){setTimeout(function(){b.resolver[++pid]=d,b.worker.postMessage({task:a,id:pid,args:c})})});return e?(f.then(e),this):f}}function create(factory,is_node_js,worker_path){let worker;try{worker=is_node_js?eval("new (require(\"worker_threads\")[\"Worker\"])(\"../dist/node/node.js\")"):factory?new Worker(URL.createObjectURL(new Blob(["onmessage="+handler.toString()],{type:"text/javascript"}))):new Worker(is_string(worker_path)?worker_path:"worker/worker.js",{type:"module"})}catch(a){}return worker} |
{ | ||
"name": "flexsearch", | ||
"version": "0.7.2", | ||
"version": "0.7.3", | ||
"description": "Next-Generation full text search library with zero dependencies.", | ||
@@ -25,2 +25,4 @@ "homepage": "https://github.com/nextapps-de/flexsearch/", | ||
"browser": "dist/flexsearch.bundle.js", | ||
"module": "dist/module/index.js", | ||
"types": "./index.d.ts", | ||
"preferGlobal": false, | ||
@@ -52,2 +54,3 @@ "repository": { | ||
"task/**", | ||
"index.d.ts", | ||
"README.md", | ||
@@ -76,6 +79,6 @@ "CHANGELOG.md", | ||
"cpx": "^1.5.0", | ||
"google-closure-compiler": "^20220905.0.0", | ||
"shx": "^0.3.3", | ||
"google-closure-compiler": "^20210604.0.0-nightly", | ||
"web-servo": "^0.5.1" | ||
} | ||
} |
@@ -163,3 +163,3 @@ import { IndexInterface, DocumentInterface } from "./type.js"; | ||
if(item.indexOf(id) !== -1){ | ||
if(item.includes(id)){ | ||
@@ -166,0 +166,0 @@ this.queue.splice(i--, 1); |
/**! | ||
* FlexSearch.js | ||
* Copyright 2018-2021 Nextapps GmbH | ||
* Copyright 2018-2022 Nextapps GmbH | ||
* Author: Thomas Wilkerling | ||
@@ -61,2 +61,4 @@ * Licence: Apache-2.0 | ||
// TODO case-insensitive tags | ||
this.tag = ((opt = document["tag"]) && parse_tree(opt, this.marker)); | ||
@@ -189,2 +191,4 @@ this.tagindex = opt && create_object(); | ||
// TODO support generic function created from string when tree depth > 1 | ||
function parse_simple(obj, tree){ | ||
@@ -207,2 +211,4 @@ | ||
// TODO support generic function created from string when tree depth > 1 | ||
function store_value(obj, store, tree, pos, key){ | ||
@@ -351,3 +357,3 @@ | ||
if(!_append || (arr.indexOf(id) === -1)){ | ||
if(!_append || !arr.includes(id)){ | ||
@@ -485,3 +491,3 @@ arr[arr.length] = id; | ||
options = /** @type {Object} */ (query); | ||
query = options["query"]; | ||
query = ""; | ||
} | ||
@@ -508,2 +514,3 @@ else if(is_object(limit)){ | ||
query = options["query"] || query; | ||
pluck = options["pluck"]; | ||
@@ -514,3 +521,3 @@ field = pluck || options["index"] || options["field"] /*|| (is_string(options) && [options])*/; | ||
bool = options["bool"] === "and"; | ||
limit = options["limit"] || 100; | ||
limit = options["limit"] || limit || 100; | ||
offset = options["offset"] || 0; | ||
@@ -561,3 +568,3 @@ | ||
let opt; | ||
let field_options; | ||
@@ -568,4 +575,6 @@ key = field[i]; | ||
opt = key; | ||
key = key["field"]; | ||
field_options = key; | ||
key = field_options["field"]; | ||
query = field_options["query"] || query; | ||
limit = field_options["limit"] || limit; | ||
} | ||
@@ -575,3 +584,3 @@ | ||
promises[i] = this.index[key].searchAsync(query, limit, opt || options); | ||
promises[i] = this.index[key].searchAsync(query, limit, field_options || options); | ||
@@ -590,3 +599,3 @@ // just collect and continue | ||
res = this.index[key].search(query, limit, opt || options); | ||
res = this.index[key].search(query, limit, field_options || options); | ||
} | ||
@@ -593,0 +602,0 @@ |
/**! | ||
* FlexSearch.js | ||
* Copyright 2018-2021 Nextapps GmbH | ||
* Copyright 2018-2022 Nextapps GmbH | ||
* Author: Thomas Wilkerling | ||
@@ -120,2 +120,6 @@ * Licence: Apache-2.0 | ||
// TODO: | ||
// string + number as text | ||
// boolean, null, undefined as ? | ||
/** | ||
@@ -137,3 +141,3 @@ * @param {!number|string} id | ||
content = this.encode(content); | ||
content = this.encode("" + content); | ||
const length = content.length; | ||
@@ -166,3 +170,3 @@ | ||
if(term_length > 3){ | ||
if(term_length > 2){ | ||
@@ -185,3 +189,3 @@ for(let x = 0; x < term_length; x++){ | ||
// fallthrough to next case when term length < 4 | ||
// fallthrough to next case when term length < 3 | ||
@@ -192,3 +196,3 @@ case "reverse": | ||
if(term_length > 2){ | ||
if(term_length > 1){ | ||
@@ -361,3 +365,3 @@ for(let x = term_length - 1; x > 0; x--){ | ||
if(!append || (arr.indexOf(id) === -1)){ | ||
if(!append || !arr.includes(id)){ | ||
@@ -405,2 +409,3 @@ arr[arr.length] = id; | ||
query = options["query"] || query; | ||
limit = options["limit"]; | ||
@@ -414,3 +419,3 @@ offset = options["offset"] || 0; | ||
query = /** @type {Array} */ (this.encode(query)); | ||
query = /** @type {Array} */ (this.encode("" + query)); | ||
length = query.length; | ||
@@ -431,3 +436,3 @@ | ||
// this fast path just could applied when not in memory-optimized mode | ||
// this fast path can just apply when not in memory-optimized mode | ||
@@ -434,0 +439,0 @@ if(!this.optimize && !suggest && !this.map[term]){ |
import { create_object, concat } from "./common.js"; | ||
/** | ||
* Implementation based on Array.indexOf() provides better performance, | ||
* Implementation based on Array.includes() provides better performance, | ||
* but it needs at least one word in the query which is less frequent. | ||
@@ -100,3 +100,3 @@ * Also on large indexes it does not scale well performance-wise. | ||
// | ||
// found = arr.indexOf(id) !== -1; | ||
// found = arr.includes(id); | ||
// | ||
@@ -284,3 +284,4 @@ // if(found){ | ||
check_suggest[id] = (check_idx = check_suggest[id]) ? ++check_idx : check_idx = 1; | ||
check_idx = (check_suggest[id] || 0) + 1; | ||
check_suggest[id] = check_idx; | ||
@@ -378,3 +379,3 @@ // do not adding IDs which are already included in the result (saves one loop) | ||
for(let x = 0, arr; x < arrays.length; x++){ | ||
for(let x = 0, arr; x < arrays.length; x++){ | ||
@@ -381,0 +382,0 @@ arr = arrays[x]; |
@@ -48,2 +48,4 @@ import { IndexInterface } from "./type.js"; | ||
// TODO improve normalize + remove non-delimited chars like in "I'm" + split on whitespace+ | ||
export const regex_whitespace = /[\p{Z}\p{S}\p{P}\p{C}]+/u; | ||
@@ -50,0 +52,0 @@ const regex_normalize = /[\u0300-\u036f]/g; |
@@ -12,4 +12,6 @@ import { IndexInterface } from "../../type.js"; | ||
const regex = /[\x00-\x7F]+/g; | ||
const split = /\s+/; | ||
/** | ||
* @param {string|number} str | ||
* @this IndexInterface | ||
@@ -23,7 +25,7 @@ */ | ||
this, | ||
/* string: */ str.replace(regex, " "), | ||
/* string: */ ("" + str).replace(regex, " "), | ||
/* normalize: */ false, | ||
/* split: */ " ", | ||
/* split: */ split, | ||
/* collapse: */ false | ||
); | ||
} |
@@ -15,2 +15,3 @@ import { IndexInterface } from "../../type.js"; | ||
/** | ||
* @param {string|number} str | ||
* @this IndexInterface | ||
@@ -24,3 +25,3 @@ */ | ||
this, | ||
/* string: */ str.replace(regex, ""), | ||
/* string: */ ("" + str).replace(regex, ""), | ||
/* normalize: */ false, | ||
@@ -27,0 +28,0 @@ /* split: */ "", |
@@ -12,4 +12,6 @@ import { IndexInterface } from "../../type.js"; | ||
const regex = /[\x00-\x7F]+/g; | ||
const split = /\s+/; | ||
/** | ||
* @param {string|number} str | ||
* @this IndexInterface | ||
@@ -23,7 +25,7 @@ */ | ||
this, | ||
/* string: */ str.replace(regex, " "), | ||
/* string: */ ("" + str).replace(regex, " "), | ||
/* normalize: */ false, | ||
/* split: */ " ", | ||
/* split: */ split, | ||
/* collapse: */ false | ||
); | ||
} |
@@ -61,2 +61,4 @@ import { IndexInterface } from "../../type.js"; | ||
/** | ||
* @param {string|number} str | ||
* @param {boolean=} _skip_postprocessing | ||
* @this IndexInterface | ||
@@ -90,3 +92,3 @@ */ | ||
return str; | ||
return str || []; | ||
} |
@@ -65,2 +65,3 @@ import { IndexInterface } from "../../type.js"; | ||
/** | ||
* @param {string|number} str | ||
* @this IndexInterface | ||
@@ -67,0 +68,0 @@ */ |
@@ -13,2 +13,3 @@ import { IndexInterface } from "../../type.js"; | ||
/** | ||
* @param {string|number} str | ||
* @this IndexInterface | ||
@@ -22,3 +23,3 @@ */ | ||
this, | ||
/* string: */ str.toLowerCase(), | ||
/* string: */ ("" + str).toLowerCase(), | ||
/* normalize: */ false, | ||
@@ -25,0 +26,0 @@ /* split: */ regex_whitespace, |
@@ -39,2 +39,3 @@ import { IndexInterface } from "../../type.js"; | ||
/** | ||
* @param {string|number} str | ||
* @this IndexInterface | ||
@@ -66,3 +67,3 @@ */ | ||
return str; | ||
return str || []; | ||
} |
@@ -44,3 +44,3 @@ import { IndexInterface } from "../../type.js"; | ||
/** | ||
* @param {string} str | ||
* @param {string|number} str | ||
* @this IndexInterface | ||
@@ -47,0 +47,0 @@ */ |
@@ -0,1 +1,3 @@ | ||
// TODO return promises instead of inner await | ||
import { IndexInterface, DocumentInterface } from "./type.js"; | ||
@@ -151,3 +153,3 @@ import { create_object, is_string } from "./common.js"; | ||
if(!idx.export(callback, self, index ? field.replace(":", "-") : "", index_doc, index++)){ | ||
if(!idx.export(callback, self, index ? field/*.replace(":", "-")*/ : "", index_doc, index++)){ | ||
@@ -154,0 +156,0 @@ index_doc++; |
@@ -43,3 +43,3 @@ //import { promise as Promise } from "../polyfill.js"; | ||
const is_node_js = self["exports"]; | ||
const is_node_js = typeof window === "undefined" && self["exports"]; | ||
const _self = this; | ||
@@ -46,0 +46,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
358894
93
5523
3109