1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-09-25 04:51:29 +02:00

proper limit/offset for suggestions

This commit is contained in:
Thomas Wilkerling
2025-03-10 13:47:48 +01:00
parent 6dadab9354
commit da475effee
18 changed files with 733 additions and 918 deletions

View File

@@ -1010,42 +1010,27 @@ function Ia(a, b, c, d, e) {
}
if (a = g.length) {
if (e) {
e = [];
for (let n = a - 1, q = 0, r, p; 0 <= n; n--) {
if (r = g[n], p = r.length, d >= p) {
d -= p;
} else {
if (p + q > c || d) {
r = r.slice(d, c - q + d), p = r.length;
}
e.push(r);
q += p;
if (c === q) {
break;
}
}
}
if (1 < e.length) {
g = e;
e = [];
f = z();
k = g.length;
if (1 < g.length) {
e = g;
f = [];
g = z();
k = e.length;
for (l = 0; l < k; l++) {
for (a = g[l], h = a.length, m = 0; m < h; m++) {
if (b = a[m], !f[b]) {
if (f[b] = 1, d) {
for (a = e[l], h = a.length, m = 0; m < h; m++) {
if (b = a[m], !g[b]) {
if (g[b] = 1, d) {
d--;
} else {
if (e.push(b), e.length === c) {
if (f.push(b), f.length === c) {
break;
}
}
}
}
}
c = e;
c = f;
} else {
c = e[0];
c = g[0];
}
g = c;
} else {

View File

@@ -39,8 +39,8 @@ function Fa(a,b,c,d,e){if(2>a.length)return[];let f=[],g=0,h=z(),k=da(a);if(!k)r
g=l.enrich;h=l.resolve;continue}d[k]=m;m.then&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=[a.result].concat(d));a.result=Ga(d,e,f,g,!h,a.G);return h?a.result:a});this.result.length&&(d=[this.result].concat(d));this.result=Ga(d,e,f,g,!h,a.G);return h?this.result:this};
function Ga(a,b,c,d,e,f){if(!a.length)return a;if(2>a.length)return e?R(a[0],b,c,d):a[0];b=[];c=z();for(let g=0,h;g<a.length;g++)if(h=a[g])for(let k=0,l;k<h.length;k++)if(l=h[k])for(let m=0,n;m<l.length;m++)n=l[m],c[n]?c[n]++:c[n]=1;for(let g=0,h;g<a.length;g++)if(h=a[g])for(let k=0,l;k<h.length;k++)if(l=h[k])for(let m=0,n;m<l.length;m++)n=l[m],1===c[n]&&(e?b.push(n):(d=k+(g?f:0),b[d]||(b[d]=[]),b[d].push(n)));return b};S.prototype.not=function(){const a=this;let b=arguments;var c=b[0];if(c.then)return c.then(function(){return a.not.apply(a,b)});if(c[0]&&c[0].index)return this.not.apply(this,c);let d=[];c=[];let e;for(let f=0,g;f<b.length;f++)if(g=b[f]){let h;if(g.constructor===S)h=g.result;else if(g.constructor===Array)h=g;else if(g.index)g.resolve=!1,h=g.index.search(g).result;else if(g.or)h=this.or(g.or);else if(g.and)h=this.and(g.and);else if(g.xor)h=this.xor(g.xor);else{e=g.resolve;continue}d[f]=h;h.then&&c.push(h)}if(c.length)return Promise.all(c).then(function(){a.result=
Ha.call(a,d,e);return e?a.result:a});this.result=Ha.call(this,d,e);return e?this.result:this};function Ha(a,b){if(!a.length)return this.result;const c=[];a=new Set(a.flat().flat());for(let d=0,e;d<this.result.length;d++)if(e=this.result[d])for(let f=0,g;f<e.length;f++)g=e[f],a.has(g)||(b?c.push(g):(c[d]||(c[d]=[]),c[d].push(g)));return c};function S(a){if(!this)return new S(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,a.index.search(a);if(a.constructor===S)return a;this.index=null;this.result=a||[];this.G=0}S.prototype.limit=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)if(e=this.result[d],e.length+c<a)b[d]=e,c+=e.length;else{b[d]=e.slice(0,a-c);this.result=b;break}}return this};
S.prototype.offset=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)e=this.result[d],e.length+c<a?c+=e.length:(b[d]=e.slice(a-c),c=a);this.result=b}return this};S.prototype.boost=function(a){this.G+=a;return this};S.prototype.resolve=function(a,b,c){T=1;const d=this.result;this.result=this.index=null;return d.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),R(d,a||100,b,c)):d};function Ia(a,b,c,d,e){var f=a.length,g=[],h;var k=z();for(let n=0,q,r,p,t;n<b;n++)for(var l=0;l<f;l++)if(p=a[l],n<p.length&&(q=p[n]))for(var m=0;m<q.length;m++)r=q[m],(h=k[r])?k[r]++:(h=0,k[r]=1),t=g[h]||(g[h]=[]),t.push(r);if(a=g.length)if(e){e=[];for(let n=a-1,q=0,r,p;0<=n;n--)if(r=g[n],p=r.length,d>=p)d-=p;else{if(p+q>c||d)r=r.slice(d,c-q+d),p=r.length;e.push(r);q+=p;if(c===q)break}if(1<e.length){g=e;e=[];f=z();k=g.length;for(l=0;l<k;l++)for(a=g[l],h=a.length,m=0;m<h;m++)if(b=a[m],!f[b])if(f[b]=
1,d)d--;else if(e.push(b),e.length===c)break;c=e}else c=e[0];g=c}else{if(a<f)return[];g=g[a-1];if(g.length>c||d)g=g.slice(d,c+d)}return g}function Ja(a,b){const c=z(),d=z(),e=[];for(let f=0;f<a.length;f++)c[a[f]]=1;for(let f=0,g;f<b.length;f++){g=b[f];for(let h=0,k;h<g.length;h++)k=g[h],c[k]&&!d[k]&&(d[k]=1,e.push(k))}return e};let T=1;
S.prototype.offset=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)e=this.result[d],e.length+c<a?c+=e.length:(b[d]=e.slice(a-c),c=a);this.result=b}return this};S.prototype.boost=function(a){this.G+=a;return this};S.prototype.resolve=function(a,b,c){T=1;const d=this.result;this.result=this.index=null;return d.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),R(d,a||100,b,c)):d};function Ia(a,b,c,d,e){var f=a.length,g=[],h;var k=z();for(let n=0,q,r,p,t;n<b;n++)for(var l=0;l<f;l++)if(p=a[l],n<p.length&&(q=p[n]))for(var m=0;m<q.length;m++)r=q[m],(h=k[r])?k[r]++:(h=0,k[r]=1),t=g[h]||(g[h]=[]),t.push(r);if(a=g.length)if(e){if(1<g.length){e=g;f=[];g=z();k=e.length;for(l=0;l<k;l++)for(a=e[l],h=a.length,m=0;m<h;m++)if(b=a[m],!g[b])if(g[b]=1,d)d--;else if(f.push(b),f.length===c)break;c=f}else c=g[0];g=c}else{if(a<f)return[];g=g[a-1];if(g.length>c||d)g=g.slice(d,c+d)}return g}
function Ja(a,b){const c=z(),d=z(),e=[];for(let f=0;f<a.length;f++)c[a[f]]=1;for(let f=0,g;f<b.length;f++){g=b[f];for(let h=0,k;h<g.length;h++)k=g[h],c[k]&&!d[k]&&(d[k]=1,e.push(k))}return e};let T=1;
O.prototype.search=function(a,b,c){c||(!b&&C(a)?(c=a,a=""):C(b)&&(c=b,b=0));let d=[],e;let f,g=0,h,k,l;if(c){a=c.query||a;b=c.limit||b;g=c.offset||0;var m=c.context;f=c.suggest;(h=T&&!1!==c.resolve)||(T=0);k=h&&c.enrich;l=this.db&&c.tag}else h=this.resolve||T;a=this.encoder.encode(a);e=a.length;b||!h||(b=100);if(1===e)return U.call(this,a[0],"",b,g,h,k,l);m=this.depth&&!1!==m;if(2===e&&m&&!f)return U.call(this,a[0],a[1],b,g,h,k,l);let n=c=0;if(1<e){const p=z(),t=[];for(let x=0,A;x<e;x++)if((A=a[x])&&
!p[A]){if(f||this.db||V(this,A))t.push(A),p[A]=1;else return h?d:new S(d);const w=A.length;c=Math.max(c,w);n=n?Math.min(n,w):w}a=t;e=a.length}if(!e)return h?d:new S(d);let q=0,r;if(1===e)return U.call(this,a[0],"",b,g,h,k,l);if(2===e&&m&&!f)return U.call(this,a[0],a[1],b,g,h,k,l);1<e&&(m?(r=a[0],q=1):9<c&&3<c/n&&a.sort(aa));if(this.db){if(this.db.search&&(m=this.db.search(this,a,b,g,f,h,k,l),!1!==m))return m;const p=this;return async function(){for(let t,x;q<e;q++){x=a[q];r?(t=await V(p,x,r),t=Ka(t,
d,f,p.U,b,g,2===e),f&&!1===t&&d.length||(r=x)):(t=await V(p,x),t=Ka(t,d,f,p.resolution,b,g,1===e));if(t)return t;if(f&&q===e-1){let A=d.length;if(!A){if(r){r="";q=-1;continue}return d}if(1===A)return h?R(d[0],b,g):new S(d[0])}}return h?Ia(d,p.resolution,b,g,f):new S(d[0])}()}for(let p,t;q<e;q++){t=a[q];r?(p=V(this,t,r),p=Ka(p,d,f,this.U,b,g,2===e),f&&!1===p&&d.length||(r=t)):(p=V(this,t),p=Ka(p,d,f,this.resolution,b,g,1===e));if(p)return p;if(f&&q===e-1){m=d.length;if(!m){if(r){r="";q=-1;continue}return d}if(1===

View File

@@ -1009,42 +1009,27 @@ function Ia(a, b, c, d, e) {
}
if (a = g.length) {
if (e) {
e = [];
for (let n = a - 1, q = 0, r, p; 0 <= n; n--) {
if (r = g[n], p = r.length, d >= p) {
d -= p;
} else {
if (p + q > c || d) {
r = r.slice(d, c - q + d), p = r.length;
}
e.push(r);
q += p;
if (c === q) {
break;
}
}
}
if (1 < e.length) {
g = e;
e = [];
f = z();
k = g.length;
if (1 < g.length) {
e = g;
f = [];
g = z();
k = e.length;
for (l = 0; l < k; l++) {
for (a = g[l], h = a.length, m = 0; m < h; m++) {
if (b = a[m], !f[b]) {
if (f[b] = 1, d) {
for (a = e[l], h = a.length, m = 0; m < h; m++) {
if (b = a[m], !g[b]) {
if (g[b] = 1, d) {
d--;
} else {
if (e.push(b), e.length === c) {
if (f.push(b), f.length === c) {
break;
}
}
}
}
}
c = e;
c = f;
} else {
c = e[0];
c = g[0];
}
g = c;
} else {

View File

@@ -39,8 +39,8 @@ function Fa(a,b,c,d,e){if(2>a.length)return[];let f=[],g=0,h=z(),k=da(a);if(!k)r
g=l.enrich;h=l.resolve;continue}d[k]=m;m.then&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=[a.result].concat(d));a.result=Ga(d,e,f,g,!h,a.G);return h?a.result:a});this.result.length&&(d=[this.result].concat(d));this.result=Ga(d,e,f,g,!h,a.G);return h?this.result:this};
function Ga(a,b,c,d,e,f){if(!a.length)return a;if(2>a.length)return e?R(a[0],b,c,d):a[0];b=[];c=z();for(let g=0,h;g<a.length;g++)if(h=a[g])for(let k=0,l;k<h.length;k++)if(l=h[k])for(let m=0,n;m<l.length;m++)n=l[m],c[n]?c[n]++:c[n]=1;for(let g=0,h;g<a.length;g++)if(h=a[g])for(let k=0,l;k<h.length;k++)if(l=h[k])for(let m=0,n;m<l.length;m++)n=l[m],1===c[n]&&(e?b.push(n):(d=k+(g?f:0),b[d]||(b[d]=[]),b[d].push(n)));return b};S.prototype.not=function(){const a=this;let b=arguments;var c=b[0];if(c.then)return c.then(function(){return a.not.apply(a,b)});if(c[0]&&c[0].index)return this.not.apply(this,c);let d=[];c=[];let e;for(let f=0,g;f<b.length;f++)if(g=b[f]){let h;if(g.constructor===S)h=g.result;else if(g.constructor===Array)h=g;else if(g.index)g.resolve=!1,h=g.index.search(g).result;else if(g.or)h=this.or(g.or);else if(g.and)h=this.and(g.and);else if(g.xor)h=this.xor(g.xor);else{e=g.resolve;continue}d[f]=h;h.then&&c.push(h)}if(c.length)return Promise.all(c).then(function(){a.result=
Ha.call(a,d,e);return e?a.result:a});this.result=Ha.call(this,d,e);return e?this.result:this};function Ha(a,b){if(!a.length)return this.result;const c=[];a=new Set(a.flat().flat());for(let d=0,e;d<this.result.length;d++)if(e=this.result[d])for(let f=0,g;f<e.length;f++)g=e[f],a.has(g)||(b?c.push(g):(c[d]||(c[d]=[]),c[d].push(g)));return c};function S(a){if(!this)return new S(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,a.index.search(a);if(a.constructor===S)return a;this.index=null;this.result=a||[];this.G=0}S.prototype.limit=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)if(e=this.result[d],e.length+c<a)b[d]=e,c+=e.length;else{b[d]=e.slice(0,a-c);this.result=b;break}}return this};
S.prototype.offset=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)e=this.result[d],e.length+c<a?c+=e.length:(b[d]=e.slice(a-c),c=a);this.result=b}return this};S.prototype.boost=function(a){this.G+=a;return this};S.prototype.resolve=function(a,b,c){T=1;const d=this.result;this.result=this.index=null;return d.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),R(d,a||100,b,c)):d};function Ia(a,b,c,d,e){var f=a.length,g=[],h;var k=z();for(let n=0,q,r,p,t;n<b;n++)for(var l=0;l<f;l++)if(p=a[l],n<p.length&&(q=p[n]))for(var m=0;m<q.length;m++)r=q[m],(h=k[r])?k[r]++:(h=0,k[r]=1),t=g[h]||(g[h]=[]),t.push(r);if(a=g.length)if(e){e=[];for(let n=a-1,q=0,r,p;0<=n;n--)if(r=g[n],p=r.length,d>=p)d-=p;else{if(p+q>c||d)r=r.slice(d,c-q+d),p=r.length;e.push(r);q+=p;if(c===q)break}if(1<e.length){g=e;e=[];f=z();k=g.length;for(l=0;l<k;l++)for(a=g[l],h=a.length,m=0;m<h;m++)if(b=a[m],!f[b])if(f[b]=
1,d)d--;else if(e.push(b),e.length===c)break;c=e}else c=e[0];g=c}else{if(a<f)return[];g=g[a-1];if(g.length>c||d)g=g.slice(d,c+d)}return g}function Ja(a,b){const c=z(),d=z(),e=[];for(let f=0;f<a.length;f++)c[a[f]]=1;for(let f=0,g;f<b.length;f++){g=b[f];for(let h=0,k;h<g.length;h++)k=g[h],c[k]&&!d[k]&&(d[k]=1,e.push(k))}return e};let T=1;
S.prototype.offset=function(a){if(this.result.length){const b=[];let c=0;for(let d=0,e;d<this.result.length;d++)e=this.result[d],e.length+c<a?c+=e.length:(b[d]=e.slice(a-c),c=a);this.result=b}return this};S.prototype.boost=function(a){this.G+=a;return this};S.prototype.resolve=function(a,b,c){T=1;const d=this.result;this.result=this.index=null;return d.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),R(d,a||100,b,c)):d};function Ia(a,b,c,d,e){var f=a.length,g=[],h;var k=z();for(let n=0,q,r,p,t;n<b;n++)for(var l=0;l<f;l++)if(p=a[l],n<p.length&&(q=p[n]))for(var m=0;m<q.length;m++)r=q[m],(h=k[r])?k[r]++:(h=0,k[r]=1),t=g[h]||(g[h]=[]),t.push(r);if(a=g.length)if(e){if(1<g.length){e=g;f=[];g=z();k=e.length;for(l=0;l<k;l++)for(a=e[l],h=a.length,m=0;m<h;m++)if(b=a[m],!g[b])if(g[b]=1,d)d--;else if(f.push(b),f.length===c)break;c=f}else c=g[0];g=c}else{if(a<f)return[];g=g[a-1];if(g.length>c||d)g=g.slice(d,c+d)}return g}
function Ja(a,b){const c=z(),d=z(),e=[];for(let f=0;f<a.length;f++)c[a[f]]=1;for(let f=0,g;f<b.length;f++){g=b[f];for(let h=0,k;h<g.length;h++)k=g[h],c[k]&&!d[k]&&(d[k]=1,e.push(k))}return e};let T=1;
O.prototype.search=function(a,b,c){c||(!b&&C(a)?(c=a,a=""):C(b)&&(c=b,b=0));let d=[],e;let f,g=0,h,k,l;if(c){a=c.query||a;b=c.limit||b;g=c.offset||0;var m=c.context;f=c.suggest;(h=T&&!1!==c.resolve)||(T=0);k=h&&c.enrich;l=this.db&&c.tag}else h=this.resolve||T;a=this.encoder.encode(a);e=a.length;b||!h||(b=100);if(1===e)return U.call(this,a[0],"",b,g,h,k,l);m=this.depth&&!1!==m;if(2===e&&m&&!f)return U.call(this,a[0],a[1],b,g,h,k,l);let n=c=0;if(1<e){const p=z(),t=[];for(let x=0,A;x<e;x++)if((A=a[x])&&
!p[A]){if(f||this.db||V(this,A))t.push(A),p[A]=1;else return h?d:new S(d);const w=A.length;c=Math.max(c,w);n=n?Math.min(n,w):w}a=t;e=a.length}if(!e)return h?d:new S(d);let q=0,r;if(1===e)return U.call(this,a[0],"",b,g,h,k,l);if(2===e&&m&&!f)return U.call(this,a[0],a[1],b,g,h,k,l);1<e&&(m?(r=a[0],q=1):9<c&&3<c/n&&a.sort(aa));if(this.db){if(this.db.search&&(m=this.db.search(this,a,b,g,f,h,k,l),!1!==m))return m;const p=this;return async function(){for(let t,x;q<e;q++){x=a[q];r?(t=await V(p,x,r),t=Ka(t,
d,f,p.U,b,g,2===e),f&&!1===t&&d.length||(r=x)):(t=await V(p,x),t=Ka(t,d,f,p.resolution,b,g,1===e));if(t)return t;if(f&&q===e-1){let A=d.length;if(!A){if(r){r="";q=-1;continue}return d}if(1===A)return h?R(d[0],b,g):new S(d[0])}}return h?Ia(d,p.resolution,b,g,f):new S(d[0])}()}for(let p,t;q<e;q++){t=a[q];r?(p=V(this,t,r),p=Ka(p,d,f,this.U,b,g,2===e),f&&!1===p&&d.length||(r=t)):(p=V(this,t),p=Ka(p,d,f,this.resolution,b,g,1===e));if(p)return p;if(f&&q===e-1){m=d.length;if(!m){if(r){r="";q=-1;continue}return d}if(1===

View File

@@ -480,38 +480,22 @@ function O(a, c, b, e, d) {
a: {
a = e;
e = this.resolution;
m = g;
b = a.length;
g = [];
m = a.length;
b = [];
f = y();
for (let r = 0, t, p, n, w; r < e; r++) {
for (k = 0; k < b; k++) {
for (k = 0; k < m; k++) {
if (n = a[k], r < n.length && (t = n[r])) {
for (l = 0; l < t.length; l++) {
p = t[l], (h = f[p]) ? f[p]++ : (h = 0, f[p] = 1), w = g[h] || (g[h] = []), w.push(p);
p = t[l], (h = f[p]) ? f[p]++ : (h = 0, f[p] = 1), w = b[h] || (b[h] = []), w.push(p);
}
}
}
}
if (a = g.length) {
if (m) {
e = [];
for (let r = a - 1, t = 0, p, n; 0 <= r; r--) {
if (p = g[r], n = p.length, d >= n) {
d -= n;
} else {
if (n + t > c || d) {
p = p.slice(d, c - t + d), n = p.length;
}
e.push(p);
t += n;
if (c === t) {
break;
}
}
}
if (1 < e.length) {
g = e;
if (a = b.length) {
if (g) {
if (1 < b.length) {
g = b;
a = [];
e = y();
f = g.length;
@@ -530,21 +514,21 @@ function O(a, c, b, e, d) {
}
c = a;
} else {
c = e[0];
c = b[0];
}
g = c;
b = c;
} else {
if (a < b) {
if (a < m) {
e = [];
break a;
}
g = g[a - 1];
if (g.length > c || d) {
g = g.slice(d, c + d);
b = b[a - 1];
if (b.length > c || d) {
b = b.slice(d, c + d);
}
}
}
e = g;
e = b;
}
return e;
};

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -1867,42 +1867,27 @@ function ib(a, b, c, d, e) {
}
if (a = f.length) {
if (e) {
e = [];
g = a - 1;
for (a = 0; 0 <= g; g--) {
if (b = f[g], k = b.length, d >= k) {
d -= k;
} else {
if (k + a > c || d) {
b = b.slice(d, c - a + d), k = b.length;
}
e.push(b);
a += k;
if (c === a) {
break;
}
}
}
if (1 < e.length) {
f = [];
g = K();
if (1 < f.length) {
e = f;
g = [];
f = K();
k = e.length;
for (m = 0; m < k; m++) {
for (a = e[m], l = a.length, p = 0; p < l; p++) {
if (b = a[p], !g[b]) {
if (g[b] = 1, d) {
if (b = a[p], !f[b]) {
if (f[b] = 1, d) {
d--;
} else {
if (f.push(b), f.length === c) {
if (g.push(b), g.length === c) {
break;
}
}
}
}
}
c = f;
c = g;
} else {
c = e[0];
c = f[0];
}
f = c;
} else {

View File

@@ -70,8 +70,8 @@ function eb(a,b,c,d,e){if(2>a.length)return[];var g=[],f=0,h=K(),k=za(a);if(!k)r
f=l.enrich;h=l.resolve;continue}d[k]=m;m.then&&c.push(m)}if(c.length)return Promise.all(c).then(function(){a.result.length&&(d=[a.result].concat(d));a.result=fb(d,e,g,f,!h,a.M);return h?a.result:a});this.result.length&&(d=[this.result].concat(d));this.result=fb(d,e,g,f,!h,a.M);return h?this.result:this};
function fb(a,b,c,d,e,g){if(!a.length)return a;if(2>a.length)return e?W(a[0],b,c,d):a[0];b=[];c=K();d=0;for(var f;d<a.length;d++)if(f=a[d])for(var h=0,k;h<f.length;h++)if(k=f[h])for(var l=0,m;l<k.length;l++)m=k[l],c[m]?c[m]++:c[m]=1;for(d=0;d<a.length;d++)if(f=a[d])for(h=0;h<f.length;h++)if(k=f[h])for(l=0;l<k.length;l++)if(m=k[l],1===c[m])if(e)b.push(m);else{var n=h+(d?g:0);b[n]||(b[n]=[]);b[n].push(m)}return b};X.prototype.not=function(){var a=this,b=arguments,c=b[0];if(c.then)return c.then(function(){return a.not.apply(a,b)});if(c[0]&&c[0].index)return this.not.apply(this,c);var d=[];c=[];for(var e,g=0,f=void 0;g<b.length;g++)if(f=b[g]){var h=void 0;if(f.constructor===X)h=f.result;else if(f.constructor===Array)h=f;else if(f.index)f.resolve=!1,h=f.index.search(f).result;else if(f.or)h=this.or(f.or);else if(f.and)h=this.and(f.and);else if(f.xor)h=this.xor(f.xor);else{e=f.resolve;continue}d[g]=h;h.then&&c.push(h)}if(c.length)return Promise.all(c).then(function(){a.result=
gb.call(a,d,e);return e?a.result:a});this.result=gb.call(this,d,e);return e?this.result:this};function gb(a,b){if(!a.length)return this.result;var c=[];a=new Set(a.flat().flat());for(var d=0,e;d<this.result.length;d++)if(e=this.result[d])for(var g=0,f;g<e.length;g++)f=e[g],a.has(f)||(b?c.push(f):(c[d]||(c[d]=[]),c[d].push(f)));return c};function X(a){if(!this)return new X(a);if(a&&a.index)return a.resolve=!1,this.index=a.index,a.index.search(a);if(a.constructor===X)return a;this.index=null;this.result=a||[];this.M=0}X.prototype.limit=function(a){if(this.result.length)for(var b=[],c=0,d=0,e;d<this.result.length;d++)if(e=this.result[d],e.length+c<a)b[d]=e,c+=e.length;else{b[d]=e.slice(0,a-c);this.result=b;break}return this};
X.prototype.offset=function(a){if(this.result.length){for(var b=[],c=0,d=0,e;d<this.result.length;d++)e=this.result[d],e.length+c<a?c+=e.length:(b[d]=e.slice(a-c),c=a);this.result=b}return this};X.prototype.boost=function(a){this.M+=a;return this};X.prototype.resolve=function(a,b,c){hb=1;var d=this.result;this.result=this.index=null;return d.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),W(d,a||100,b,c)):d};function ib(a,b,c,d,e){var g=a.length,f=[],h;var k=K();for(var l=0,m=void 0,n;l<b;l++)for(var p=0;p<g;p++)if(n=a[p],l<n.length&&(m=n[l]))for(var q=0;q<m.length;q++)n=m[q],(h=k[n])?k[n]++:(h=0,k[n]=1),h=f[h]||(f[h]=[]),h.push(n);if(a=f.length)if(e){e=[];g=a-1;for(a=0;0<=g;g--)if(b=f[g],k=b.length,d>=k)d-=k;else{if(k+a>c||d)b=b.slice(d,c-a+d),k=b.length;e.push(b);a+=k;if(c===a)break}if(1<e.length){f=[];g=K();k=e.length;for(m=0;m<k;m++)for(a=e[m],l=a.length,p=0;p<l;p++)if(b=a[p],!g[b])if(g[b]=1,d)d--;
else if(f.push(b),f.length===c)break;c=f}else c=e[0];f=c}else{if(a<g)return[];f=f[a-1];if(f.length>c||d)f=f.slice(d,c+d)}return f}function jb(a,b){for(var c=K(),d=K(),e=[],g=0;g<a.length;g++)c[a[g]]=1;for(a=0;a<b.length;a++){g=b[a];for(var f=0,h;f<g.length;f++)h=g[f],c[h]&&!d[h]&&(d[h]=1,e.push(h))}return e};var hb=1;
X.prototype.offset=function(a){if(this.result.length){for(var b=[],c=0,d=0,e;d<this.result.length;d++)e=this.result[d],e.length+c<a?c+=e.length:(b[d]=e.slice(a-c),c=a);this.result=b}return this};X.prototype.boost=function(a){this.M+=a;return this};X.prototype.resolve=function(a,b,c){hb=1;var d=this.result;this.result=this.index=null;return d.length?("object"===typeof a&&(c=a.enrich,b=a.offset,a=a.limit),W(d,a||100,b,c)):d};function ib(a,b,c,d,e){var g=a.length,f=[],h;var k=K();for(var l=0,m=void 0,n;l<b;l++)for(var p=0;p<g;p++)if(n=a[p],l<n.length&&(m=n[l]))for(var q=0;q<m.length;q++)n=m[q],(h=k[n])?k[n]++:(h=0,k[n]=1),h=f[h]||(f[h]=[]),h.push(n);if(a=f.length)if(e){if(1<f.length){e=f;g=[];f=K();k=e.length;for(m=0;m<k;m++)for(a=e[m],l=a.length,p=0;p<l;p++)if(b=a[p],!f[b])if(f[b]=1,d)d--;else if(g.push(b),g.length===c)break;c=g}else c=f[0];f=c}else{if(a<g)return[];f=f[a-1];if(f.length>c||d)f=f.slice(d,c+d)}return f}
function jb(a,b){for(var c=K(),d=K(),e=[],g=0;g<a.length;g++)c[a[g]]=1;for(a=0;a<b.length;a++){g=b[a];for(var f=0,h;f<g.length;f++)h=g[f],c[h]&&!d[h]&&(d[h]=1,e.push(h))}return e};var hb=1;
V.prototype.search=function(a,b,c){c||(!b&&M(a)?(c=a,a=""):M(b)&&(c=b,b=0));var d=[],e=0,g;if(c){a=c.query||a;b=c.limit||b;e=c.offset||0;var f=c.context;var h=c.suggest;(g=hb&&!1!==c.resolve)||(hb=0);var k=g&&c.enrich;var l=this.db&&c.tag}else g=this.resolve||hb;a=this.encoder.encode(a);var m=a.length;b||!g||(b=100);if(1===m)return kb.call(this,a[0],"",b,e,g,k,l);f=this.depth&&!1!==f;if(2===m&&f&&!h)return kb.call(this,a[0],a[1],b,e,g,k,l);var n=c=0;if(1<m){for(var p=K(),q=[],r=0,y=void 0;r<m;r++)if((y=
a[r])&&!p[y]){if(h||this.db||Y(this,y))q.push(y),p[y]=1;else return g?d:new X(d);y=y.length;c=Math.max(c,y);n=n?Math.min(n,y):y}a=q;m=a.length}if(!m)return g?d:new X(d);var u=0;if(1===m)return kb.call(this,a[0],"",b,e,g,k,l);if(2===m&&f&&!h)return kb.call(this,a[0],a[1],b,e,g,k,l);if(1<m)if(f){var t=a[0];u=1}else 9<c&&3<c/n&&a.sort(wa);if(this.db){if(this.db.search&&(f=this.db.search(this,a,b,e,h,g,k,l),!1!==f))return f;var v=this;return function(){var A,C,D;return sa(function(E){switch(E.h){case 1:C=
A=void 0;case 2:if(!(u<m)){E.h=4;break}C=a[u];return t?F(E,Y(v,C,t),8):F(E,Y(v,C),7);case 7:A=E.G;A=lb(A,d,h,v.resolution,b,e,1===m);E.h=6;break;case 8:A=E.G,A=lb(A,d,h,v.da,b,e,2===m),h&&!1===A&&d.length||(t=C);case 6:if(A)return E.return(A);if(h&&u===m-1){D=d.length;if(!D){if(t){t="";u=-1;E.h=3;break}return E.return(d)}if(1===D)return E.return(g?W(d[0],b,e):new X(d[0]))}case 3:u++;E.h=2;break;case 4:return E.return(g?ib(d,v.resolution,b,e,h):new X(d[0]))}})}()}for(k=f=void 0;u<m;u++){k=a[u];t?(f=

View File

@@ -148,13 +148,13 @@ C.prototype.encode = function(a) {
}
}
let k;
this.stemmer && 2 < f.length && (this.A || (this.A = new RegExp("(?!^)(" + this.u + ")$")), f = f.replace(this.A, p => this.stemmer.get(p)), k = 1);
this.matcher && 1 < f.length && (this.v || (this.v = new RegExp("(" + this.s + ")", "g")), f = f.replace(this.v, p => this.matcher.get(p)), k = 1);
this.stemmer && 2 < f.length && (this.A || (this.A = new RegExp("(?!^)(" + this.u + ")$")), f = f.replace(this.A, m => this.stemmer.get(m)), k = 1);
this.matcher && 1 < f.length && (this.v || (this.v = new RegExp("(" + this.s + ")", "g")), f = f.replace(this.v, m => this.matcher.get(m)), k = 1);
f && k && (f.length < this.minlength || this.filter && this.filter.has(f)) && (f = "");
if (f && (this.mapper || this.dedupe && 1 < f.length)) {
e = "";
for (let p = 0, m = "", q, r; p < f.length; p++) {
q = f.charAt(p), q === m && this.dedupe || ((r = this.mapper && this.mapper.get(q)) || "" === r ? r === m && this.dedupe || !(m = r) || (e += r) : e += m = q);
for (let m = 0, l = "", p, r; m < f.length; m++) {
p = f.charAt(m), p === l && this.dedupe || ((r = this.mapper && this.mapper.get(p)) || "" === r ? r === l && this.dedupe || !(l = r) || (e += r) : e += l = p);
}
f = e;
}
@@ -211,20 +211,20 @@ H.prototype.add = function(a, c, b, d) {
}
c = this.encoder.encode(c);
if (d = c.length) {
const p = u(), m = u(), q = this.depth, r = this.resolution;
for (let l = 0; l < d; l++) {
let n = c[this.rtl ? d - 1 - l : l];
var e = n.length;
if (e && (q || !m[n])) {
var g = this.score ? this.score(c, n, l, null, 0) : I(r, d, l), f = "";
const m = u(), l = u(), p = this.depth, r = this.resolution;
for (let n = 0; n < d; n++) {
let q = c[this.rtl ? d - 1 - n : n];
var e = q.length;
if (e && (p || !l[q])) {
var g = this.score ? this.score(c, q, n, null, 0) : I(r, d, n), f = "";
switch(this.tokenize) {
case "full":
if (2 < e) {
for (g = 0; g < e; g++) {
for (var h = e; h > g; h--) {
f = n.substring(g, h);
var k = this.score ? this.score(c, n, l, f, g) : I(r, d, l, e, g);
J(this, m, f, k, a, b);
f = q.substring(g, h);
var k = this.score ? this.score(c, q, n, f, g) : I(r, d, n, e, g);
J(this, l, f, k, a, b);
}
}
break;
@@ -232,24 +232,24 @@ H.prototype.add = function(a, c, b, d) {
case "reverse":
if (1 < e) {
for (h = e - 1; 0 < h; h--) {
f = n[h] + f, k = this.score ? this.score(c, n, l, f, h) : I(r, d, l, e, h), J(this, m, f, k, a, b);
f = q[h] + f, k = this.score ? this.score(c, q, n, f, h) : I(r, d, n, e, h), J(this, l, f, k, a, b);
}
f = "";
}
case "forward":
if (1 < e) {
for (h = 0; h < e; h++) {
f += n[h], J(this, m, f, g, a, b);
f += q[h], J(this, l, f, g, a, b);
}
break;
}
default:
if (J(this, m, n, g, a, b), q && 1 < d && l < d - 1) {
for (e = u(), f = this.C, g = n, h = Math.min(q + 1, d - l), e[g] = 1, k = 1; k < h; k++) {
if ((n = c[this.rtl ? d - 1 - l - k : l + k]) && !e[n]) {
e[n] = 1;
const A = this.score ? this.score(c, g, l, n, k) : I(f + (d / 2 > f ? 0 : 1), d, l, h - 1, k - 1), M = this.bidirectional && n > g;
J(this, p, M ? g : n, A, a, b, M ? n : g);
if (J(this, l, q, g, a, b), p && 1 < d && n < d - 1) {
for (e = u(), f = this.C, g = q, h = Math.min(p + 1, d - n), e[g] = 1, k = 1; k < h; k++) {
if ((q = c[this.rtl ? d - 1 - n - k : n + k]) && !e[q]) {
e[q] = 1;
const A = this.score ? this.score(c, g, n, q, k) : I(f + (d / 2 > f ? 0 : 1), d, n, h - 1, k - 1), M = this.bidirectional && q > g;
J(this, m, M ? g : q, A, a, b, M ? q : g);
}
}
}
@@ -320,27 +320,27 @@ function I(a, c, b, d, e) {
}
var h = 0, k = 0;
if (1 < b) {
var p = u();
const q = [];
for (let r = 0, l; r < b; r++) {
if ((l = a[r]) && !p[l]) {
if (f || N(this, l)) {
q.push(l), p[l] = 1;
var m = u();
const p = [];
for (let r = 0, n; r < b; r++) {
if ((n = a[r]) && !m[n]) {
if (f || N(this, n)) {
p.push(n), m[n] = 1;
} else {
return d;
}
const n = l.length;
h = Math.max(h, n);
k = k ? Math.min(k, n) : n;
const q = n.length;
h = Math.max(h, q);
k = k ? Math.min(k, q) : q;
}
}
a = q;
a = p;
b = a.length;
}
if (!b) {
return d;
}
p = 0;
m = 0;
if (1 === b) {
return L.call(this, a[0], "", c, e);
}
@@ -349,24 +349,24 @@ function I(a, c, b, d, e) {
}
if (1 < b) {
if (g) {
var m = a[0];
p = 1;
var l = a[0];
m = 1;
} else {
9 < h && 3 < h / k && a.sort(v);
}
}
for (let q, r; p < b; p++) {
r = a[p];
m ? (q = N(this, r, m), q = O(q, d, f, this.C, c, e, 2 === b), f && !1 === q && d.length || (m = r)) : (q = N(this, r), q = O(q, d, f, this.resolution, c, e, 1 === b));
if (q) {
return q;
for (let p, r; m < b; m++) {
r = a[m];
l ? (p = N(this, r, l), p = O(p, d, f, this.C, c, e, 2 === b), f && !1 === p && d.length || (l = r)) : (p = N(this, r), p = O(p, d, f, this.resolution, c, e, 1 === b));
if (p) {
return p;
}
if (f && p === b - 1) {
if (f && m === b - 1) {
g = d.length;
if (!g) {
if (m) {
m = "";
p = -1;
if (l) {
l = "";
m = -1;
continue;
}
return d;
@@ -379,44 +379,28 @@ function I(a, c, b, d, e) {
a: {
a = d;
d = this.resolution;
m = f;
b = a.length;
f = [];
l = a.length;
b = [];
g = u();
for (let q = 0, r, l, n, A; q < d; q++) {
for (k = 0; k < b; k++) {
if (n = a[k], q < n.length && (r = n[q])) {
for (p = 0; p < r.length; p++) {
l = r[p], (h = g[l]) ? g[l]++ : (h = 0, g[l] = 1), A = f[h] || (f[h] = []), A.push(l);
for (let p = 0, r, n, q, A; p < d; p++) {
for (k = 0; k < l; k++) {
if (q = a[k], p < q.length && (r = q[p])) {
for (m = 0; m < r.length; m++) {
n = r[m], (h = g[n]) ? g[n]++ : (h = 0, g[n] = 1), A = b[h] || (b[h] = []), A.push(n);
}
}
}
}
if (a = f.length) {
if (m) {
d = [];
for (let q = a - 1, r = 0, l, n; 0 <= q; q--) {
if (l = f[q], n = l.length, e >= n) {
e -= n;
} else {
if (n + r > c || e) {
l = l.slice(e, c - r + e), n = l.length;
}
d.push(l);
r += n;
if (c === r) {
break;
}
}
}
if (1 < d.length) {
f = d;
if (a = b.length) {
if (f) {
if (1 < b.length) {
f = b;
a = [];
d = u();
g = f.length;
for (k = 0; k < g; k++) {
for (m = f[k], h = m.length, p = 0; p < h; p++) {
if (b = m[p], !d[b]) {
for (l = f[k], h = l.length, m = 0; m < h; m++) {
if (b = l[m], !d[b]) {
if (d[b] = 1, e) {
e--;
} else {
@@ -429,21 +413,21 @@ function I(a, c, b, d, e) {
}
c = a;
} else {
c = d[0];
c = b[0];
}
f = c;
b = c;
} else {
if (a < b) {
if (a < l) {
d = [];
break a;
}
f = f[a - 1];
if (f.length > c || e) {
f = f.slice(e, c + e);
b = b[a - 1];
if (b.length > c || e) {
b = b.slice(e, c + e);
}
}
}
d = f;
d = b;
}
return d;
};
@@ -454,9 +438,9 @@ function O(a, c, b, d, e, g, f) {
let h = [];
if (a) {
d = Math.min(a.length, d);
for (let k = 0, p = 0, m; k < d; k++) {
if (m = a[k]) {
if (g && m && f && (m.length <= g ? (g -= m.length, m = null) : (m = m.slice(g), g = 0)), m && (h[k] = m, f && (p += m.length, p >= e))) {
for (let k = 0, m = 0, l; k < d; k++) {
if (l = a[k]) {
if (g && l && f && (l.length <= g ? (g -= l.length, l = null) : (l = l.slice(g), g = 0)), l && (h[k] = l, f && (m += l.length, m >= e))) {
break;
}
}

View File

@@ -10,16 +10,15 @@ C.prototype.assign=function(a){this.normalize=t(a.normalize,!0,this.normalize);l
t(a.prepare,null,this.prepare);this.finalize=t(a.finalize,null,this.finalize);this.rtl=a.rtl||!1;this.dedupe=t(a.dedupe,!0,this.dedupe);this.filter=t((b=a.filter)&&new Set(b),null,this.filter);this.matcher=t((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=t((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=t((b=a.stemmer)&&new Map(b),null,this.stemmer);this.replacer=t(a.replacer,null,this.replacer);this.minlength=t(a.minlength,1,this.minlength);this.maxlength=t(a.maxlength,0,this.maxlength);
if(this.cache=b=t(a.cache,!0,this.cache))this.m=null,this.B="number"===typeof b?b:2E5,this.i=new Map,this.j=new Map,this.o=this.h=128;this.s="";this.v=null;this.u="";this.A=null;if(this.matcher)for(const d of this.matcher.keys())this.s+=(this.s?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.u+=(this.u?"|":"")+d;return this};
C.prototype.encode=function(a){if(this.cache&&a.length<=this.h)if(this.m){if(this.i.has(a))return this.i.get(a)}else this.m=setTimeout(D,0,this);this.normalize&&(a="function"===typeof this.normalize?this.normalize(a):B?a.normalize("NFKD").replace(B,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3<a.length&&(a=a.replace(y,"$1 $2").replace(z,"$1 $2").replace(x,"$1 "));const c=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let b=
[],d=this.split||""===this.split?a.split(this.split):a;for(let g=0,f,h;g<d.length;g++){if(!(f=h=d[g]))continue;if(f.length<this.minlength)continue;if(c){b.push(f);continue}if(this.filter&&this.filter.has(f))continue;if(this.cache&&f.length<=this.o)if(this.m){var e=this.j.get(f);if(e||""===e){e&&b.push(e);continue}}else this.m=setTimeout(D,0,this);let k;this.stemmer&&2<f.length&&(this.A||(this.A=new RegExp("(?!^)("+this.u+")$")),f=f.replace(this.A,p=>this.stemmer.get(p)),k=1);this.matcher&&1<f.length&&
(this.v||(this.v=new RegExp("("+this.s+")","g")),f=f.replace(this.v,p=>this.matcher.get(p)),k=1);f&&k&&(f.length<this.minlength||this.filter&&this.filter.has(f))&&(f="");if(f&&(this.mapper||this.dedupe&&1<f.length)){e="";for(let p=0,m="",q,r;p<f.length;p++)q=f.charAt(p),q===m&&this.dedupe||((r=this.mapper&&this.mapper.get(q))||""===r?r===m&&this.dedupe||!(m=r)||(e+=r):e+=m=q);f=e}if(f&&this.replacer)for(e=0;f&&e<this.replacer.length;e+=2)f=f.replace(this.replacer[e],this.replacer[e+1]);this.cache&&
[],d=this.split||""===this.split?a.split(this.split):a;for(let g=0,f,h;g<d.length;g++){if(!(f=h=d[g]))continue;if(f.length<this.minlength)continue;if(c){b.push(f);continue}if(this.filter&&this.filter.has(f))continue;if(this.cache&&f.length<=this.o)if(this.m){var e=this.j.get(f);if(e||""===e){e&&b.push(e);continue}}else this.m=setTimeout(D,0,this);let k;this.stemmer&&2<f.length&&(this.A||(this.A=new RegExp("(?!^)("+this.u+")$")),f=f.replace(this.A,m=>this.stemmer.get(m)),k=1);this.matcher&&1<f.length&&
(this.v||(this.v=new RegExp("("+this.s+")","g")),f=f.replace(this.v,m=>this.matcher.get(m)),k=1);f&&k&&(f.length<this.minlength||this.filter&&this.filter.has(f))&&(f="");if(f&&(this.mapper||this.dedupe&&1<f.length)){e="";for(let m=0,l="",p,r;m<f.length;m++)p=f.charAt(m),p===l&&this.dedupe||((r=this.mapper&&this.mapper.get(p))||""===r?r===l&&this.dedupe||!(l=r)||(e+=r):e+=l=p);f=e}if(f&&this.replacer)for(e=0;f&&e<this.replacer.length;e+=2)f=f.replace(this.replacer[e],this.replacer[e+1]);this.cache&&
h.length<=this.o&&(this.j.set(h,f),this.j.size>this.B&&(this.j.clear(),this.o=this.o/1.1|0));f&&b.push(f)}this.finalize&&(b=this.finalize(b)||b);this.cache&&a.length<=this.h&&(this.i.set(a,b),this.i.size>this.B&&(this.i.clear(),this.h=this.h/1.1|0));return b};function D(a){a.m=null;a.i.clear();a.j.clear()};function E(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}E.prototype.set=function(a,c){this.cache.set(this.h=a,c);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};E.prototype.get=function(a){const c=this.cache.get(a);c&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,c));return c};E.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};
E.prototype.clear=function(){this.cache.clear();this.h=""};const F={normalize:function(a){return a.toLowerCase()},dedupe:!1};const G={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};u();H.prototype.add=function(a,c,b,d){if(c&&(a||0===a)){if(!d&&!b&&this.g.has(a))return this.update(a,c);c=this.encoder.encode(c);if(d=c.length){const p=u(),m=u(),q=this.depth,r=this.resolution;for(let l=0;l<d;l++){let n=c[this.rtl?d-1-l:l];var e=n.length;if(e&&(q||!m[n])){var g=this.score?this.score(c,n,l,null,0):I(r,d,l),f="";switch(this.tokenize){case "full":if(2<e){for(g=0;g<e;g++)for(var h=e;h>g;h--){f=n.substring(g,h);var k=this.score?this.score(c,n,l,f,g):I(r,d,l,e,g);J(this,m,f,k,a,b)}break}case "reverse":if(1<
e){for(h=e-1;0<h;h--)f=n[h]+f,k=this.score?this.score(c,n,l,f,h):I(r,d,l,e,h),J(this,m,f,k,a,b);f=""}case "forward":if(1<e){for(h=0;h<e;h++)f+=n[h],J(this,m,f,g,a,b);break}default:if(J(this,m,n,g,a,b),q&&1<d&&l<d-1)for(e=u(),f=this.C,g=n,h=Math.min(q+1,d-l),e[g]=1,k=1;k<h;k++)if((n=c[this.rtl?d-1-l-k:l+k])&&!e[n]){e[n]=1;const A=this.score?this.score(c,g,l,n,k):I(f+(d/2>f?0:1),d,l,h-1,k-1),L=this.bidirectional&&n>g;J(this,p,L?g:n,A,a,b,L?n:g)}}}}this.fastupdate||this.g.add(a)}}return this};
function J(a,c,b,d,e,g,f){let h=f?a.l:a.map,k;c[b]&&f&&(k=c[b])[f]||(f?(c=k||(c[b]=u()),c[f]=1,(k=h.get(f))?h=k:h.set(f,h=new Map)):c[b]=1,(k=h.get(b))?h=k:h.set(b,h=[]),h=h[d]||(h[d]=[]),g&&h.includes(e)||(h.push(e),a.fastupdate&&((c=a.g.get(e))?c.push(h):a.g.set(e,[h]))))}function I(a,c,b,d,e){return b&&1<a?c+(d||0)<=a?b+(e||0):(a-1)/(c+(d||0))*(b+(e||0))+1|0:0};function K(a,c,b){if(1===a.length)return a=a[0],a=b||a.length>c?c?a.slice(b,b+c):a.slice(b):a;let d=[];for(let e=0,g,f;e<a.length;e++)if((g=a[e])&&(f=g.length)){if(b){if(b>=f){b-=f;continue}b<f&&(g=c?g.slice(b,b+c):g.slice(b),f=g.length,b=0)}if(d.length)f>c&&(g=g.slice(0,c),f=g.length),d.push(g);else{if(f>=c)return f>c&&(g=g.slice(0,c)),g;d=[g]}c-=f;if(!c)break}return d.length?d=1<d.length?[].concat.apply([],d):d[0]:d};H.prototype.search=function(a,c,b){b||(c||"object"!==typeof a?"object"===typeof c&&(b=c,c=0):(b=a,a=""));var d=[],e=0;if(b){a=b.query||a;c=b.limit||c;e=b.offset||0;var g=b.context;var f=b.suggest}a=this.encoder.encode(a);b=a.length;c||(c=100);if(1===b)return M.call(this,a[0],"",c,e);g=this.depth&&!1!==g;if(2===b&&g&&!f)return M.call(this,a[0],a[1],c,e);var h=0,k=0;if(1<b){var p=u();const q=[];for(let r=0,l;r<b;r++)if((l=a[r])&&!p[l]){if(f||N(this,l))q.push(l),p[l]=1;else return d;const n=l.length;
h=Math.max(h,n);k=k?Math.min(k,n):n}a=q;b=a.length}if(!b)return d;p=0;if(1===b)return M.call(this,a[0],"",c,e);if(2===b&&g&&!f)return M.call(this,a[0],a[1],c,e);if(1<b)if(g){var m=a[0];p=1}else 9<h&&3<h/k&&a.sort(v);for(let q,r;p<b;p++){r=a[p];m?(q=N(this,r,m),q=O(q,d,f,this.C,c,e,2===b),f&&!1===q&&d.length||(m=r)):(q=N(this,r),q=O(q,d,f,this.resolution,c,e,1===b));if(q)return q;if(f&&p===b-1){g=d.length;if(!g){if(m){m="";p=-1;continue}return d}if(1===g)return K(d[0],c,e)}}a:{a=d;d=this.resolution;
m=f;b=a.length;f=[];g=u();for(let q=0,r,l,n,A;q<d;q++)for(k=0;k<b;k++)if(n=a[k],q<n.length&&(r=n[q]))for(p=0;p<r.length;p++)l=r[p],(h=g[l])?g[l]++:(h=0,g[l]=1),A=f[h]||(f[h]=[]),A.push(l);if(a=f.length)if(m){d=[];for(let q=a-1,r=0,l,n;0<=q;q--)if(l=f[q],n=l.length,e>=n)e-=n;else{if(n+r>c||e)l=l.slice(e,c-r+e),n=l.length;d.push(l);r+=n;if(c===r)break}if(1<d.length){f=d;a=[];d=u();g=f.length;for(k=0;k<g;k++)for(m=f[k],h=m.length,p=0;p<h;p++)if(b=m[p],!d[b])if(d[b]=1,e)e--;else if(a.push(b),a.length===
c)break;c=a}else c=d[0];f=c}else{if(a<b){d=[];break a}f=f[a-1];if(f.length>c||e)f=f.slice(e,c+e)}d=f}return d};function M(a,c,b,d){return(a=N(this,a,c))&&a.length?K(a,b,d):[]}function O(a,c,b,d,e,g,f){let h=[];if(a){d=Math.min(a.length,d);for(let k=0,p=0,m;k<d;k++)if(m=a[k])if(g&&m&&f&&(m.length<=g?(g-=m.length,m=null):(m=m.slice(g),g=0)),m&&(h[k]=m,f&&(p+=m.length,p>=e)))break;if(h.length){if(f)return K(h,e,0);c.push(h);return}}return!b&&h}
function N(a,c,b){let d;b&&(d=a.bidirectional&&c>b);a=b?(a=a.l.get(d?c:b))&&a.get(d?b:c):a.map.get(c);return a};H.prototype.remove=function(a,c){const b=this.g.size&&(this.fastupdate?this.g.get(a):this.g.has(a));if(b){if(this.fastupdate)for(let d=0,e;d<b.length;d++){if(e=b[d])if(2>e.length)e.pop();else{const g=e.indexOf(a);g===b.length-1?e.pop():e.splice(g,1)}}else P(this.map,a),this.depth&&P(this.l,a);c||this.g.delete(a)}this.cache&&this.cache.remove(a);return this};
E.prototype.clear=function(){this.cache.clear();this.h=""};const F={normalize:function(a){return a.toLowerCase()},dedupe:!1};const G={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};u();H.prototype.add=function(a,c,b,d){if(c&&(a||0===a)){if(!d&&!b&&this.g.has(a))return this.update(a,c);c=this.encoder.encode(c);if(d=c.length){const m=u(),l=u(),p=this.depth,r=this.resolution;for(let n=0;n<d;n++){let q=c[this.rtl?d-1-n:n];var e=q.length;if(e&&(p||!l[q])){var g=this.score?this.score(c,q,n,null,0):I(r,d,n),f="";switch(this.tokenize){case "full":if(2<e){for(g=0;g<e;g++)for(var h=e;h>g;h--){f=q.substring(g,h);var k=this.score?this.score(c,q,n,f,g):I(r,d,n,e,g);J(this,l,f,k,a,b)}break}case "reverse":if(1<
e){for(h=e-1;0<h;h--)f=q[h]+f,k=this.score?this.score(c,q,n,f,h):I(r,d,n,e,h),J(this,l,f,k,a,b);f=""}case "forward":if(1<e){for(h=0;h<e;h++)f+=q[h],J(this,l,f,g,a,b);break}default:if(J(this,l,q,g,a,b),p&&1<d&&n<d-1)for(e=u(),f=this.C,g=q,h=Math.min(p+1,d-n),e[g]=1,k=1;k<h;k++)if((q=c[this.rtl?d-1-n-k:n+k])&&!e[q]){e[q]=1;const A=this.score?this.score(c,g,n,q,k):I(f+(d/2>f?0:1),d,n,h-1,k-1),L=this.bidirectional&&q>g;J(this,m,L?g:q,A,a,b,L?q:g)}}}}this.fastupdate||this.g.add(a)}}return this};
function J(a,c,b,d,e,g,f){let h=f?a.l:a.map,k;c[b]&&f&&(k=c[b])[f]||(f?(c=k||(c[b]=u()),c[f]=1,(k=h.get(f))?h=k:h.set(f,h=new Map)):c[b]=1,(k=h.get(b))?h=k:h.set(b,h=[]),h=h[d]||(h[d]=[]),g&&h.includes(e)||(h.push(e),a.fastupdate&&((c=a.g.get(e))?c.push(h):a.g.set(e,[h]))))}function I(a,c,b,d,e){return b&&1<a?c+(d||0)<=a?b+(e||0):(a-1)/(c+(d||0))*(b+(e||0))+1|0:0};function K(a,c,b){if(1===a.length)return a=a[0],a=b||a.length>c?c?a.slice(b,b+c):a.slice(b):a;let d=[];for(let e=0,g,f;e<a.length;e++)if((g=a[e])&&(f=g.length)){if(b){if(b>=f){b-=f;continue}b<f&&(g=c?g.slice(b,b+c):g.slice(b),f=g.length,b=0)}if(d.length)f>c&&(g=g.slice(0,c),f=g.length),d.push(g);else{if(f>=c)return f>c&&(g=g.slice(0,c)),g;d=[g]}c-=f;if(!c)break}return d.length?d=1<d.length?[].concat.apply([],d):d[0]:d};H.prototype.search=function(a,c,b){b||(c||"object"!==typeof a?"object"===typeof c&&(b=c,c=0):(b=a,a=""));var d=[],e=0;if(b){a=b.query||a;c=b.limit||c;e=b.offset||0;var g=b.context;var f=b.suggest}a=this.encoder.encode(a);b=a.length;c||(c=100);if(1===b)return M.call(this,a[0],"",c,e);g=this.depth&&!1!==g;if(2===b&&g&&!f)return M.call(this,a[0],a[1],c,e);var h=0,k=0;if(1<b){var m=u();const p=[];for(let r=0,n;r<b;r++)if((n=a[r])&&!m[n]){if(f||N(this,n))p.push(n),m[n]=1;else return d;const q=n.length;
h=Math.max(h,q);k=k?Math.min(k,q):q}a=p;b=a.length}if(!b)return d;m=0;if(1===b)return M.call(this,a[0],"",c,e);if(2===b&&g&&!f)return M.call(this,a[0],a[1],c,e);if(1<b)if(g){var l=a[0];m=1}else 9<h&&3<h/k&&a.sort(v);for(let p,r;m<b;m++){r=a[m];l?(p=N(this,r,l),p=O(p,d,f,this.C,c,e,2===b),f&&!1===p&&d.length||(l=r)):(p=N(this,r),p=O(p,d,f,this.resolution,c,e,1===b));if(p)return p;if(f&&m===b-1){g=d.length;if(!g){if(l){l="";m=-1;continue}return d}if(1===g)return K(d[0],c,e)}}a:{a=d;d=this.resolution;
l=a.length;b=[];g=u();for(let p=0,r,n,q,A;p<d;p++)for(k=0;k<l;k++)if(q=a[k],p<q.length&&(r=q[p]))for(m=0;m<r.length;m++)n=r[m],(h=g[n])?g[n]++:(h=0,g[n]=1),A=b[h]||(b[h]=[]),A.push(n);if(a=b.length)if(f){if(1<b.length){f=b;a=[];d=u();g=f.length;for(k=0;k<g;k++)for(l=f[k],h=l.length,m=0;m<h;m++)if(b=l[m],!d[b])if(d[b]=1,e)e--;else if(a.push(b),a.length===c)break;c=a}else c=b[0];b=c}else{if(a<l){d=[];break a}b=b[a-1];if(b.length>c||e)b=b.slice(e,c+e)}d=b}return d};
function M(a,c,b,d){return(a=N(this,a,c))&&a.length?K(a,b,d):[]}function O(a,c,b,d,e,g,f){let h=[];if(a){d=Math.min(a.length,d);for(let k=0,m=0,l;k<d;k++)if(l=a[k])if(g&&l&&f&&(l.length<=g?(g-=l.length,l=null):(l=l.slice(g),g=0)),l&&(h[k]=l,f&&(m+=l.length,m>=e)))break;if(h.length){if(f)return K(h,e,0);c.push(h);return}}return!b&&h}function N(a,c,b){let d;b&&(d=a.bidirectional&&c>b);a=b?(a=a.l.get(d?c:b))&&a.get(d?b:c):a.map.get(c);return a};H.prototype.remove=function(a,c){const b=this.g.size&&(this.fastupdate?this.g.get(a):this.g.has(a));if(b){if(this.fastupdate)for(let d=0,e;d<b.length;d++){if(e=b[d])if(2>e.length)e.pop();else{const g=e.indexOf(a);g===b.length-1?e.pop():e.splice(g,1)}}else P(this.map,a),this.depth&&P(this.l,a);c||this.g.delete(a)}this.cache&&this.cache.remove(a);return this};
function P(a,c){let b=0;if(a.constructor===Array)for(let d=0,e,g;d<a.length;d++){if((e=a[d])&&e.length)if(g=e.indexOf(c),0<=g){1<e.length?(e.splice(g,1),b++):delete a[d];break}else b++}else for(let d of a){const e=d[0],g=P(d[1],c);g?b+=g:a.delete(e)}return b};function H(a,c){if(!this)return new H(a);if(a){var b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},G[b],a))}else a={};b=a.context||{};const d=a.encode||a.encoder||F;this.encoder=d.encode?d:"object"===typeof d?new C(d):{encode:d};let e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&b.depth||0;this.bidirectional=!1!==b.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;e=!1;this.map=new Map;this.l=new Map;this.g=c||(this.fastupdate?
new Map:new Set);this.C=b.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new E(e)}H.prototype.clear=function(){this.map.clear();this.l.clear();this.g.clear();this.cache&&this.cache.clear();return this};H.prototype.append=function(a,c){return this.add(a,c,!0)};H.prototype.contain=function(a){return this.g.has(a)};H.prototype.update=function(a,c){if(this.async){const b=this,d=this.remove(a);return d.then?d.then(()=>b.add(a,c)):this.add(a,c)}return this.remove(a).add(a,c)};
function Q(a){let c=0;if(a.constructor===Array)for(let b=0,d;b<a.length;b++)(d=a[b])&&(c+=d.length);else for(const b of a){const d=b[0],e=Q(b[1]);e?c+=e:a.delete(d)}return c}H.prototype.cleanup=function(){if(!this.fastupdate)return this;Q(this.map);this.depth&&Q(this.l);return this};

View File

@@ -8,27 +8,27 @@
function t() {
return Object.create(null);
}
function u(a, b) {
return b.length - a.length;
function u(a, c) {
return c.length - a.length;
}
;function v(a) {
this.limit = a && !0 !== a ? a : 1000;
this.cache = new Map();
this.B = "";
}
v.prototype.set = function(a, b) {
this.cache.set(this.B = a, b);
v.prototype.set = function(a, c) {
this.cache.set(this.B = a, c);
this.cache.size > this.limit && this.cache.delete(this.cache.keys().next().value);
};
v.prototype.get = function(a) {
const b = this.cache.get(a);
b && this.B !== a && (this.cache.delete(a), this.cache.set(this.B = a, b));
return b;
const c = this.cache.get(a);
c && this.B !== a && (this.cache.delete(a), this.cache.set(this.B = a, c));
return c;
};
v.prototype.remove = function(a) {
for (const b of this.cache) {
const c = b[0];
b[1].includes(a) && this.cache.delete(c);
for (const c of this.cache) {
const b = c[0];
c[1].includes(a) && this.cache.delete(b);
}
};
v.prototype.clear = function() {
@@ -44,12 +44,12 @@ const D = /[\x00-\x7F]+/g;
var E = {LatinExact:{normalize:!1, dedupe:!1}, LatinDefault:{normalize:function(a) {
return a.toLowerCase();
}, dedupe:!1}, LatinSimple:{normalize:!0, dedupe:!0}, LatinBalance:{normalize:!0, dedupe:!0, mapper:w}, LatinAdvanced:{normalize:!0, dedupe:!0, mapper:w, replacer:z, matcher:x}, LatinExtra:{normalize:!0, dedupe:!0, mapper:w, replacer:z.concat([/(?!^)[aeoy]/g, ""]), matcher:x}, LatinSoundex:{normalize:!0, dedupe:!1, include:{letter:!0}, finalize:function(a) {
for (let c = 0; c < a.length; c++) {
var b = a[c];
let d = b.charAt(0), e = A[d];
for (let f = 1, g; f < b.length && (g = b.charAt(f), "h" === g || "w" === g || !(g = A[g]) || g === e || (d += g, e = g, 4 !== d.length)); f++) {
for (let b = 0; b < a.length; b++) {
var c = a[b];
let d = c.charAt(0), e = A[d];
for (let f = 1, g; f < c.length && (g = c.charAt(f), "h" === g || "w" === g || !(g = A[g]) || g === e || (d += g, e = g, 4 !== d.length)); f++) {
}
a[c] = d;
a[b] = d;
}
}}, ArabicDefault:{rtl:!0, normalize:!1, dedupe:!0, prepare:function(a) {
return ("" + a).replace(B, " ");
@@ -60,32 +60,32 @@ var E = {LatinExact:{normalize:!1, dedupe:!1}, LatinDefault:{normalize:function(
}}};
const F = {memory:{resolution:1}, performance:{resolution:6, fastupdate:!0, context:{depth:1, resolution:3}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:9}}};
function G(a) {
const b = "string" === typeof a ? a : a.preset;
b && (F[b] || console.warn("Preset not found: " + b), a = Object.assign({}, F[b], a));
const c = "string" === typeof a ? a : a.preset;
c && (F[c] || console.warn("Preset not found: " + c), a = Object.assign({}, F[c], a));
return a;
}
;t();
H.prototype.add = function(a, b, c, d) {
if (b && (a || 0 === a)) {
if (!d && !c && this.h.has(a)) {
return this.update(a, b);
H.prototype.add = function(a, c, b, d) {
if (c && (a || 0 === a)) {
if (!d && !b && this.h.has(a)) {
return this.update(a, c);
}
b = this.encoder.encode(b);
if (d = b.length) {
const q = t(), n = t(), p = this.depth, r = this.resolution;
for (let k = 0; k < d; k++) {
let m = b[this.rtl ? d - 1 - k : k];
var e = m.length;
if (e && (p || !n[m])) {
var f = this.score ? this.score(b, m, k, null, 0) : I(r, d, k), g = "";
c = this.encoder.encode(c);
if (d = c.length) {
const p = t(), m = t(), q = this.depth, r = this.resolution;
for (let l = 0; l < d; l++) {
let n = c[this.rtl ? d - 1 - l : l];
var e = n.length;
if (e && (q || !m[n])) {
var f = this.score ? this.score(c, n, l, null, 0) : I(r, d, l), g = "";
switch(this.tokenize) {
case "full":
if (2 < e) {
for (f = 0; f < e; f++) {
for (var h = e; h > f; h--) {
g = m.substring(f, h);
var l = this.score ? this.score(b, m, k, g, f) : I(r, d, k, e, f);
K(this, n, g, l, a, c);
g = n.substring(f, h);
var k = this.score ? this.score(c, n, l, g, f) : I(r, d, l, e, f);
K(this, m, g, k, a, b);
}
}
break;
@@ -93,24 +93,24 @@ H.prototype.add = function(a, b, c, d) {
case "reverse":
if (1 < e) {
for (h = e - 1; 0 < h; h--) {
g = m[h] + g, l = this.score ? this.score(b, m, k, g, h) : I(r, d, k, e, h), K(this, n, g, l, a, c);
g = n[h] + g, k = this.score ? this.score(c, n, l, g, h) : I(r, d, l, e, h), K(this, m, g, k, a, b);
}
g = "";
}
case "forward":
if (1 < e) {
for (h = 0; h < e; h++) {
g += m[h], K(this, n, g, f, a, c);
g += n[h], K(this, m, g, f, a, b);
}
break;
}
default:
if (K(this, n, m, f, a, c), p && 1 < d && k < d - 1) {
for (e = t(), g = this.C, f = m, h = Math.min(p + 1, d - k), e[f] = 1, l = 1; l < h; l++) {
if ((m = b[this.rtl ? d - 1 - k - l : k + l]) && !e[m]) {
e[m] = 1;
const y = this.score ? this.score(b, f, k, m, l) : I(g + (d / 2 > g ? 0 : 1), d, k, h - 1, l - 1), J = this.bidirectional && m > f;
K(this, q, J ? f : m, y, a, c, J ? m : f);
if (K(this, m, n, f, a, b), q && 1 < d && l < d - 1) {
for (e = t(), g = this.C, f = n, h = Math.min(q + 1, d - l), e[f] = 1, k = 1; k < h; k++) {
if ((n = c[this.rtl ? d - 1 - l - k : l + k]) && !e[n]) {
e[n] = 1;
const y = this.score ? this.score(c, f, l, n, k) : I(g + (d / 2 > g ? 0 : 1), d, l, h - 1, k - 1), J = this.bidirectional && n > f;
K(this, p, J ? f : n, y, a, b, J ? n : f);
}
}
}
@@ -122,202 +122,186 @@ H.prototype.add = function(a, b, c, d) {
}
return this;
};
function K(a, b, c, d, e, f, g) {
let h = g ? a.A : a.map, l;
b[c] && g && (l = b[c])[g] || (g ? (b = l || (b[c] = t()), b[g] = 1, (l = h.get(g)) ? h = l : h.set(g, h = new Map())) : b[c] = 1, (l = h.get(c)) ? h = l : h.set(c, h = []), h = h[d] || (h[d] = []), f && h.includes(e) || (h.push(e), a.fastupdate && ((b = a.h.get(e)) ? b.push(h) : a.h.set(e, [h]))));
function K(a, c, b, d, e, f, g) {
let h = g ? a.A : a.map, k;
c[b] && g && (k = c[b])[g] || (g ? (c = k || (c[b] = t()), c[g] = 1, (k = h.get(g)) ? h = k : h.set(g, h = new Map())) : c[b] = 1, (k = h.get(b)) ? h = k : h.set(b, h = []), h = h[d] || (h[d] = []), f && h.includes(e) || (h.push(e), a.fastupdate && ((c = a.h.get(e)) ? c.push(h) : a.h.set(e, [h]))));
}
function I(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 I(a, c, b, d, e) {
return b && 1 < a ? c + (d || 0) <= a ? b + (e || 0) : (a - 1) / (c + (d || 0)) * (b + (e || 0)) + 1 | 0 : 0;
}
;function L(a, b, c) {
;function L(a, c, b) {
if (1 === a.length) {
return a = a[0], a = c || a.length > b ? b ? a.slice(c, c + b) : a.slice(c) : a;
return a = a[0], a = b || a.length > c ? c ? a.slice(b, b + c) : a.slice(b) : a;
}
let d = [];
for (let e = 0, f, g; e < a.length; e++) {
if ((f = a[e]) && (g = f.length)) {
if (c) {
if (c >= g) {
c -= g;
if (b) {
if (b >= g) {
b -= g;
continue;
}
c < g && (f = b ? f.slice(c, c + b) : f.slice(c), g = f.length, c = 0);
b < g && (f = c ? f.slice(b, b + c) : f.slice(b), g = f.length, b = 0);
}
if (d.length) {
g > b && (f = f.slice(0, b), g = f.length), d.push(f);
g > c && (f = f.slice(0, c), g = f.length), d.push(f);
} else {
if (g >= b) {
return g > b && (f = f.slice(0, b)), f;
if (g >= c) {
return g > c && (f = f.slice(0, c)), f;
}
d = [f];
}
b -= g;
if (!b) {
c -= g;
if (!c) {
break;
}
}
}
return d.length ? d = 1 < d.length ? [].concat.apply([], d) : d[0] : d;
}
;H.prototype.search = function(a, b, c) {
c || (b || "object" !== typeof a ? "object" === typeof b && (c = b, b = 0) : (c = a, a = ""));
;H.prototype.search = function(a, c, b) {
b || (c || "object" !== typeof a ? "object" === typeof c && (b = c, c = 0) : (b = a, a = ""));
var d = [], e = 0;
if (c) {
a = c.query || a;
b = c.limit || b;
e = c.offset || 0;
var f = c.context;
if (b) {
a = b.query || a;
c = b.limit || c;
e = b.offset || 0;
var f = b.context;
var g = !1;
}
a = this.encoder.encode(a);
c = a.length;
b || (b = 100);
if (1 === c) {
return M.call(this, a[0], "", b, e);
b = a.length;
c || (c = 100);
if (1 === b) {
return M.call(this, a[0], "", c, e);
}
f = this.depth && !1 !== f;
if (2 === c && f && !g) {
return M.call(this, a[0], a[1], b, e);
if (2 === b && f && !g) {
return M.call(this, a[0], a[1], c, e);
}
var h = 0, l = 0;
if (1 < c) {
var q = t();
const p = [];
for (let r = 0, k; r < c; r++) {
if ((k = a[r]) && !q[k]) {
if (g || N(this, k)) {
p.push(k), q[k] = 1;
var h = 0, k = 0;
if (1 < b) {
var p = t();
const q = [];
for (let r = 0, l; r < b; r++) {
if ((l = a[r]) && !p[l]) {
if (g || N(this, l)) {
q.push(l), p[l] = 1;
} else {
return d;
}
const m = k.length;
h = Math.max(h, m);
l = l ? Math.min(l, m) : m;
const n = l.length;
h = Math.max(h, n);
k = k ? Math.min(k, n) : n;
}
}
a = p;
c = a.length;
a = q;
b = a.length;
}
if (!c) {
if (!b) {
return d;
}
q = 0;
if (1 === c) {
return M.call(this, a[0], "", b, e);
p = 0;
if (1 === b) {
return M.call(this, a[0], "", c, e);
}
if (2 === c && f && !g) {
return M.call(this, a[0], a[1], b, e);
if (2 === b && f && !g) {
return M.call(this, a[0], a[1], c, e);
}
if (1 < c) {
if (1 < b) {
if (f) {
var n = a[0];
q = 1;
var m = a[0];
p = 1;
} else {
9 < h && 3 < h / l && a.sort(u);
9 < h && 3 < h / k && a.sort(u);
}
}
for (let p, r; q < c; q++) {
r = a[q];
n ? (p = N(this, r, n), p = O(p, d, g, this.C, b, e, 2 === c), g && !1 === p && d.length || (n = r)) : (p = N(this, r), p = O(p, d, g, this.resolution, b, e, 1 === c));
if (p) {
return p;
for (let q, r; p < b; p++) {
r = a[p];
m ? (q = N(this, r, m), q = O(q, d, g, this.C, c, e, 2 === b), g && !1 === q && d.length || (m = r)) : (q = N(this, r), q = O(q, d, g, this.resolution, c, e, 1 === b));
if (q) {
return q;
}
if (g && q === c - 1) {
if (g && p === b - 1) {
f = d.length;
if (!f) {
if (n) {
n = "";
q = -1;
if (m) {
m = "";
p = -1;
continue;
}
return d;
}
if (1 === f) {
return L(d[0], b, e);
return L(d[0], c, e);
}
}
}
a: {
a = d;
d = this.resolution;
n = g;
c = a.length;
g = [];
m = a.length;
b = [];
f = t();
for (let p = 0, r, k, m, y; p < d; p++) {
for (l = 0; l < c; l++) {
if (m = a[l], p < m.length && (r = m[p])) {
for (q = 0; q < r.length; q++) {
k = r[q], (h = f[k]) ? f[k]++ : (h = 0, f[k] = 1), y = g[h] || (g[h] = []), y.push(k);
for (let q = 0, r, l, n, y; q < d; q++) {
for (k = 0; k < m; k++) {
if (n = a[k], q < n.length && (r = n[q])) {
for (p = 0; p < r.length; p++) {
l = r[p], (h = f[l]) ? f[l]++ : (h = 0, f[l] = 1), y = b[h] || (b[h] = []), y.push(l);
}
}
}
}
if (a = g.length) {
if (n) {
d = [];
for (let p = a - 1, r = 0, k, m; 0 <= p; p--) {
if (k = g[p], m = k.length, e >= m) {
e -= m;
} else {
if (m + r > b || e) {
k = k.slice(e, b - r + e), m = k.length;
}
d.push(k);
r += m;
if (b === r) {
break;
}
}
}
if (1 < d.length) {
g = d;
if (a = b.length) {
if (g) {
if (1 < b.length) {
g = b;
a = [];
d = t();
f = g.length;
for (l = 0; l < f; l++) {
for (n = g[l], h = n.length, q = 0; q < h; q++) {
if (c = n[q], !d[c]) {
if (d[c] = 1, e) {
for (k = 0; k < f; k++) {
for (m = g[k], h = m.length, p = 0; p < h; p++) {
if (b = m[p], !d[b]) {
if (d[b] = 1, e) {
e--;
} else {
if (a.push(c), a.length === b) {
if (a.push(b), a.length === c) {
break;
}
}
}
}
}
b = a;
c = a;
} else {
b = d[0];
c = b[0];
}
g = b;
b = c;
} else {
if (a < c) {
if (a < m) {
d = [];
break a;
}
g = g[a - 1];
if (g.length > b || e) {
g = g.slice(e, b + e);
b = b[a - 1];
if (b.length > c || e) {
b = b.slice(e, c + e);
}
}
}
d = g;
d = b;
}
return d;
};
function M(a, b, c, d) {
return (a = N(this, a, b)) && a.length ? L(a, c, d) : [];
function M(a, c, b, d) {
return (a = N(this, a, c)) && a.length ? L(a, b, d) : [];
}
function O(a, b, c, d, e, f, g) {
function O(a, c, b, d, e, f, g) {
let h = [];
if (a) {
d = Math.min(a.length, d);
for (let l = 0, q = 0, n; l < d; l++) {
if (n = a[l]) {
if (f && n && g && (n.length <= f ? (f -= n.length, n = null) : (n = n.slice(f), f = 0)), n && (h[l] = n, g && (q += n.length, q >= e))) {
for (let k = 0, p = 0, m; k < d; k++) {
if (m = a[k]) {
if (f && m && g && (m.length <= f ? (f -= m.length, m = null) : (m = m.slice(f), f = 0)), m && (h[k] = m, g && (p += m.length, p >= e))) {
break;
}
}
@@ -326,82 +310,82 @@ function O(a, b, c, d, e, f, g) {
if (g) {
return L(h, e, 0);
}
b.push(h);
c.push(h);
return;
}
}
return !c && h;
return !b && h;
}
function N(a, b, c) {
function N(a, c, b) {
let d;
c && (d = a.bidirectional && b > c);
a = c ? (a = a.A.get(d ? b : c)) && a.get(d ? c : b) : a.map.get(b);
b && (d = a.bidirectional && c > b);
a = b ? (a = a.A.get(d ? c : b)) && a.get(d ? b : c) : a.map.get(c);
return a;
}
;H.prototype.remove = function(a, b) {
const c = this.h.size && (this.fastupdate ? this.h.get(a) : this.h.has(a));
if (c) {
;H.prototype.remove = function(a, c) {
const b = this.h.size && (this.fastupdate ? this.h.get(a) : this.h.has(a));
if (b) {
if (this.fastupdate) {
for (let d = 0, e; d < c.length; d++) {
if (e = c[d]) {
for (let d = 0, e; d < b.length; d++) {
if (e = b[d]) {
if (2 > e.length) {
e.pop();
} else {
const f = e.indexOf(a);
f === c.length - 1 ? e.pop() : e.splice(f, 1);
f === b.length - 1 ? e.pop() : e.splice(f, 1);
}
}
}
} else {
P(this.map, a), this.depth && P(this.A, a);
}
b || this.h.delete(a);
c || this.h.delete(a);
}
this.cache && this.cache.remove(a);
return this;
};
function P(a, b) {
let c = 0;
function P(a, c) {
let b = 0;
if (a.constructor === Array) {
for (let d = 0, e, f; d < a.length; d++) {
if ((e = a[d]) && e.length) {
if (f = e.indexOf(b), 0 <= f) {
1 < e.length ? (e.splice(f, 1), c++) : delete a[d];
if (f = e.indexOf(c), 0 <= f) {
1 < e.length ? (e.splice(f, 1), b++) : delete a[d];
break;
} else {
c++;
b++;
}
}
}
} else {
for (let d of a) {
const e = d[0], f = P(d[1], b);
f ? c += f : a.delete(e);
const e = d[0], f = P(d[1], c);
f ? b += f : a.delete(e);
}
}
return c;
return b;
}
;function H(a, b) {
;function H(a, c) {
if (!this) {
return new H(a);
}
a = a ? G(a) : {};
const c = a.context || {}, d = a.encode || a.encoder || function(f) {
const b = a.context || {}, d = a.encode || a.encoder || function(f) {
return f.toLowerCase().trim().split(/\s+/);
};
this.encoder = d.encode ? d : "object" === typeof d ? d : {encode:d};
let e;
this.resolution = a.resolution || 9;
this.tokenize = e = a.tokenize || "strict";
this.depth = "strict" === e && c.depth || 0;
this.bidirectional = !1 !== c.bidirectional;
this.depth = "strict" === e && b.depth || 0;
this.bidirectional = !1 !== b.bidirectional;
this.fastupdate = !!a.fastupdate;
this.score = a.score || null;
e = !1;
this.map = new Map();
this.A = new Map();
this.h = b || (this.fastupdate ? new Map() : new Set());
this.C = c.resolution || 1;
this.h = c || (this.fastupdate ? new Map() : new Set());
this.C = b.resolution || 1;
this.rtl = d.rtl || a.rtl || !1;
this.cache = (e = a.cache || null) && new v(e);
}
@@ -412,32 +396,32 @@ H.prototype.clear = function() {
this.cache && this.cache.clear();
return this;
};
H.prototype.append = function(a, b) {
return this.add(a, b, !0);
H.prototype.append = function(a, c) {
return this.add(a, c, !0);
};
H.prototype.contain = function(a) {
return this.h.has(a);
};
H.prototype.update = function(a, b) {
H.prototype.update = function(a, c) {
if (this.async) {
const c = this, d = this.remove(a);
return d.then ? d.then(() => c.add(a, b)) : this.add(a, b);
const b = this, d = this.remove(a);
return d.then ? d.then(() => b.add(a, c)) : this.add(a, c);
}
return this.remove(a).add(a, b);
return this.remove(a).add(a, c);
};
function Q(a) {
let b = 0;
let c = 0;
if (a.constructor === Array) {
for (let c = 0, d; c < a.length; c++) {
(d = a[c]) && (b += d.length);
for (let b = 0, d; b < a.length; b++) {
(d = a[b]) && (c += d.length);
}
} else {
for (const c of a) {
const d = c[0], e = Q(c[1]);
e ? b += e : a.delete(d);
for (const b of a) {
const d = b[0], e = Q(b[1]);
e ? c += e : a.delete(d);
}
}
return b;
return c;
}
H.prototype.cleanup = function() {
if (!this.fastupdate) {
@@ -447,11 +431,11 @@ H.prototype.cleanup = function() {
this.depth && Q(this.A);
return this;
};
H.prototype.searchCache = function(a, b, c) {
H.prototype.searchCache = function(a, c, b) {
a = ("object" === typeof a ? "" + a.query : a).toLowerCase();
let d = this.cache.get(a);
if (!d) {
d = this.search(a, b, c);
d = this.search(a, c, b);
if (d.then) {
const e = this;
d.then(function(f) {

View File

@@ -5,17 +5,16 @@
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
function t(){return Object.create(null)}function u(a,b){return b.length-a.length};function v(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.B=""}v.prototype.set=function(a,b){this.cache.set(this.B=a,b);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};v.prototype.get=function(a){const b=this.cache.get(a);b&&this.B!==a&&(this.cache.delete(a),this.cache.set(this.B=a,b));return b};v.prototype.remove=function(a){for(const b of this.cache){const c=b[0];b[1].includes(a)&&this.cache.delete(c)}};
v.prototype.clear=function(){this.cache.clear();this.B=""};const w=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]);const x=new Map([["ai","ei"],["ae","a"],["oe","o"],["ue","u"],["sh","s"],["ch","c"],["th","t"],["ph","f"],["pf","f"]]),z=[/([^aeo])h([aeo$])/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2"];const A={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,"\u00df":2,d:3,t:3,l:4,m:5,n:5,r:6};const B=/[\x00-\x7F]+/g;const C=/[\x00-\x7F]+/g;const D=/[\x00-\x7F]+/g;var E={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:{normalize:function(a){return a.toLowerCase()},dedupe:!1},LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:w},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:w,replacer:z,matcher:x},LatinExtra:{normalize:!0,dedupe:!0,mapper:w,replacer:z.concat([/(?!^)[aeoy]/g,""]),matcher:x},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let c=0;c<a.length;c++){var b=a[c];let d=b.charAt(0),e=A[d];
for(let f=1,g;f<b.length&&(g=b.charAt(f),"h"===g||"w"===g||!(g=A[g])||g===e||(d+=g,e=g,4!==d.length));f++);a[c]=d}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(B," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(C,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(D," ")}}};const F={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};function G(a){const b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},F[b],a));return a};t();H.prototype.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.h.has(a))return this.update(a,b);b=this.encoder.encode(b);if(d=b.length){const q=t(),n=t(),p=this.depth,r=this.resolution;for(let k=0;k<d;k++){let m=b[this.rtl?d-1-k:k];var e=m.length;if(e&&(p||!n[m])){var f=this.score?this.score(b,m,k,null,0):J(r,d,k),g="";switch(this.tokenize){case "full":if(2<e){for(f=0;f<e;f++)for(var h=e;h>f;h--){g=m.substring(f,h);var l=this.score?this.score(b,m,k,g,f):J(r,d,k,e,f);K(this,n,g,l,a,c)}break}case "reverse":if(1<
e){for(h=e-1;0<h;h--)g=m[h]+g,l=this.score?this.score(b,m,k,g,h):J(r,d,k,e,h),K(this,n,g,l,a,c);g=""}case "forward":if(1<e){for(h=0;h<e;h++)g+=m[h],K(this,n,g,f,a,c);break}default:if(K(this,n,m,f,a,c),p&&1<d&&k<d-1)for(e=t(),g=this.C,f=m,h=Math.min(p+1,d-k),e[f]=1,l=1;l<h;l++)if((m=b[this.rtl?d-1-k-l:k+l])&&!e[m]){e[m]=1;const y=this.score?this.score(b,f,k,m,l):J(g+(d/2>g?0:1),d,k,h-1,l-1),I=this.bidirectional&&m>f;K(this,q,I?f:m,y,a,c,I?m:f)}}}}this.fastupdate||this.h.add(a)}}return this};
function K(a,b,c,d,e,f,g){let h=g?a.A:a.map,l;b[c]&&g&&(l=b[c])[g]||(g?(b=l||(b[c]=t()),b[g]=1,(l=h.get(g))?h=l:h.set(g,h=new Map)):b[c]=1,(l=h.get(c))?h=l:h.set(c,h=[]),h=h[d]||(h[d]=[]),f&&h.includes(e)||(h.push(e),a.fastupdate&&((b=a.h.get(e))?b.push(h):a.h.set(e,[h]))))}function J(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 L(a,b,c){if(1===a.length)return a=a[0],a=c||a.length>b?b?a.slice(c,c+b):a.slice(c):a;let d=[];for(let e=0,f,g;e<a.length;e++)if((f=a[e])&&(g=f.length)){if(c){if(c>=g){c-=g;continue}c<g&&(f=b?f.slice(c,c+b):f.slice(c),g=f.length,c=0)}if(d.length)g>b&&(f=f.slice(0,b),g=f.length),d.push(f);else{if(g>=b)return g>b&&(f=f.slice(0,b)),f;d=[f]}b-=g;if(!b)break}return d.length?d=1<d.length?[].concat.apply([],d):d[0]:d};H.prototype.search=function(a,b,c){c||(b||"object"!==typeof a?"object"===typeof b&&(c=b,b=0):(c=a,a=""));var d=[],e=0;if(c){a=c.query||a;b=c.limit||b;e=c.offset||0;var f=c.context;var g=!1}a=this.encoder.encode(a);c=a.length;b||(b=100);if(1===c)return M.call(this,a[0],"",b,e);f=this.depth&&!1!==f;if(2===c&&f&&!g)return M.call(this,a[0],a[1],b,e);var h=0,l=0;if(1<c){var q=t();const p=[];for(let r=0,k;r<c;r++)if((k=a[r])&&!q[k]){if(g||N(this,k))p.push(k),q[k]=1;else return d;const m=k.length;h=Math.max(h,
m);l=l?Math.min(l,m):m}a=p;c=a.length}if(!c)return d;q=0;if(1===c)return M.call(this,a[0],"",b,e);if(2===c&&f&&!g)return M.call(this,a[0],a[1],b,e);if(1<c)if(f){var n=a[0];q=1}else 9<h&&3<h/l&&a.sort(u);for(let p,r;q<c;q++){r=a[q];n?(p=N(this,r,n),p=O(p,d,g,this.C,b,e,2===c),g&&!1===p&&d.length||(n=r)):(p=N(this,r),p=O(p,d,g,this.resolution,b,e,1===c));if(p)return p;if(g&&q===c-1){f=d.length;if(!f){if(n){n="";q=-1;continue}return d}if(1===f)return L(d[0],b,e)}}a:{a=d;d=this.resolution;n=g;c=a.length;
g=[];f=t();for(let p=0,r,k,m,y;p<d;p++)for(l=0;l<c;l++)if(m=a[l],p<m.length&&(r=m[p]))for(q=0;q<r.length;q++)k=r[q],(h=f[k])?f[k]++:(h=0,f[k]=1),y=g[h]||(g[h]=[]),y.push(k);if(a=g.length)if(n){d=[];for(let p=a-1,r=0,k,m;0<=p;p--)if(k=g[p],m=k.length,e>=m)e-=m;else{if(m+r>b||e)k=k.slice(e,b-r+e),m=k.length;d.push(k);r+=m;if(b===r)break}if(1<d.length){g=d;a=[];d=t();f=g.length;for(l=0;l<f;l++)for(n=g[l],h=n.length,q=0;q<h;q++)if(c=n[q],!d[c])if(d[c]=1,e)e--;else if(a.push(c),a.length===b)break;b=a}else b=
d[0];g=b}else{if(a<c){d=[];break a}g=g[a-1];if(g.length>b||e)g=g.slice(e,b+e)}d=g}return d};function M(a,b,c,d){return(a=N(this,a,b))&&a.length?L(a,c,d):[]}function O(a,b,c,d,e,f,g){let h=[];if(a){d=Math.min(a.length,d);for(let l=0,q=0,n;l<d;l++)if(n=a[l])if(f&&n&&g&&(n.length<=f?(f-=n.length,n=null):(n=n.slice(f),f=0)),n&&(h[l]=n,g&&(q+=n.length,q>=e)))break;if(h.length){if(g)return L(h,e,0);b.push(h);return}}return!c&&h}
function N(a,b,c){let d;c&&(d=a.bidirectional&&b>c);a=c?(a=a.A.get(d?b:c))&&a.get(d?c:b):a.map.get(b);return a};H.prototype.remove=function(a,b){const c=this.h.size&&(this.fastupdate?this.h.get(a):this.h.has(a));if(c){if(this.fastupdate)for(let d=0,e;d<c.length;d++){if(e=c[d])if(2>e.length)e.pop();else{const f=e.indexOf(a);f===c.length-1?e.pop():e.splice(f,1)}}else P(this.map,a),this.depth&&P(this.A,a);b||this.h.delete(a)}this.cache&&this.cache.remove(a);return this};
function P(a,b){let c=0;if(a.constructor===Array)for(let d=0,e,f;d<a.length;d++){if((e=a[d])&&e.length)if(f=e.indexOf(b),0<=f){1<e.length?(e.splice(f,1),c++):delete a[d];break}else c++}else for(let d of a){const e=d[0],f=P(d[1],b);f?c+=f:a.delete(e)}return c};function H(a,b){if(!this)return new H(a);a=a?G(a):{};const c=a.context||{},d=a.encode||a.encoder||function(f){return f.toLowerCase().trim().split(/\s+/)};this.encoder=d.encode?d:"object"===typeof d?d:{encode:d};let e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&c.depth||0;this.bidirectional=!1!==c.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;e=!1;this.map=new Map;this.A=new Map;this.h=b||(this.fastupdate?new Map:new Set);this.C=
c.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new v(e)}H.prototype.clear=function(){this.map.clear();this.A.clear();this.h.clear();this.cache&&this.cache.clear();return this};H.prototype.append=function(a,b){return this.add(a,b,!0)};H.prototype.contain=function(a){return this.h.has(a)};H.prototype.update=function(a,b){if(this.async){const c=this,d=this.remove(a);return d.then?d.then(()=>c.add(a,b)):this.add(a,b)}return this.remove(a).add(a,b)};
function Q(a){let b=0;if(a.constructor===Array)for(let c=0,d;c<a.length;c++)(d=a[c])&&(b+=d.length);else for(const c of a){const d=c[0],e=Q(c[1]);e?b+=e:a.delete(d)}return b}H.prototype.cleanup=function(){if(!this.fastupdate)return this;Q(this.map);this.depth&&Q(this.A);return this};
H.prototype.searchCache=function(a,b,c){a=("object"===typeof a?""+a.query:a).toLowerCase();let d=this.cache.get(a);if(!d){d=this.search(a,b,c);if(d.then){const e=this;d.then(function(f){e.cache.set(a,f);return f})}this.cache.set(a,d)}return d};export default {Index:H,Charset:E,Encoder:null,Document:null,Worker:null,Resolver:null,IndexedDB:null,Language:{}};
function t(){return Object.create(null)}function u(a,c){return c.length-a.length};function v(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.B=""}v.prototype.set=function(a,c){this.cache.set(this.B=a,c);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};v.prototype.get=function(a){const c=this.cache.get(a);c&&this.B!==a&&(this.cache.delete(a),this.cache.set(this.B=a,c));return c};v.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};
v.prototype.clear=function(){this.cache.clear();this.B=""};const w=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]);const x=new Map([["ai","ei"],["ae","a"],["oe","o"],["ue","u"],["sh","s"],["ch","c"],["th","t"],["ph","f"],["pf","f"]]),z=[/([^aeo])h([aeo$])/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2"];const A={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,"\u00df":2,d:3,t:3,l:4,m:5,n:5,r:6};const B=/[\x00-\x7F]+/g;const C=/[\x00-\x7F]+/g;const D=/[\x00-\x7F]+/g;var E={LatinExact:{normalize:!1,dedupe:!1},LatinDefault:{normalize:function(a){return a.toLowerCase()},dedupe:!1},LatinSimple:{normalize:!0,dedupe:!0},LatinBalance:{normalize:!0,dedupe:!0,mapper:w},LatinAdvanced:{normalize:!0,dedupe:!0,mapper:w,replacer:z,matcher:x},LatinExtra:{normalize:!0,dedupe:!0,mapper:w,replacer:z.concat([/(?!^)[aeoy]/g,""]),matcher:x},LatinSoundex:{normalize:!0,dedupe:!1,include:{letter:!0},finalize:function(a){for(let b=0;b<a.length;b++){var c=a[b];let d=c.charAt(0),e=A[d];
for(let f=1,g;f<c.length&&(g=c.charAt(f),"h"===g||"w"===g||!(g=A[g])||g===e||(d+=g,e=g,4!==d.length));f++);a[b]=d}}},ArabicDefault:{rtl:!0,normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(B," ")}},CjkDefault:{normalize:!1,dedupe:!0,split:"",prepare:function(a){return(""+a).replace(C,"")}},CyrillicDefault:{normalize:!1,dedupe:!0,prepare:function(a){return(""+a).replace(D," ")}}};const F={memory:{resolution:1},performance:{resolution:6,fastupdate:!0,context:{depth:1,resolution:3}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:9}}};function G(a){const c="string"===typeof a?a:a.preset;c&&(a=Object.assign({},F[c],a));return a};t();H.prototype.add=function(a,c,b,d){if(c&&(a||0===a)){if(!d&&!b&&this.h.has(a))return this.update(a,c);c=this.encoder.encode(c);if(d=c.length){const p=t(),m=t(),q=this.depth,r=this.resolution;for(let l=0;l<d;l++){let n=c[this.rtl?d-1-l:l];var e=n.length;if(e&&(q||!m[n])){var f=this.score?this.score(c,n,l,null,0):J(r,d,l),g="";switch(this.tokenize){case "full":if(2<e){for(f=0;f<e;f++)for(var h=e;h>f;h--){g=n.substring(f,h);var k=this.score?this.score(c,n,l,g,f):J(r,d,l,e,f);K(this,m,g,k,a,b)}break}case "reverse":if(1<
e){for(h=e-1;0<h;h--)g=n[h]+g,k=this.score?this.score(c,n,l,g,h):J(r,d,l,e,h),K(this,m,g,k,a,b);g=""}case "forward":if(1<e){for(h=0;h<e;h++)g+=n[h],K(this,m,g,f,a,b);break}default:if(K(this,m,n,f,a,b),q&&1<d&&l<d-1)for(e=t(),g=this.C,f=n,h=Math.min(q+1,d-l),e[f]=1,k=1;k<h;k++)if((n=c[this.rtl?d-1-l-k:l+k])&&!e[n]){e[n]=1;const y=this.score?this.score(c,f,l,n,k):J(g+(d/2>g?0:1),d,l,h-1,k-1),I=this.bidirectional&&n>f;K(this,p,I?f:n,y,a,b,I?n:f)}}}}this.fastupdate||this.h.add(a)}}return this};
function K(a,c,b,d,e,f,g){let h=g?a.A:a.map,k;c[b]&&g&&(k=c[b])[g]||(g?(c=k||(c[b]=t()),c[g]=1,(k=h.get(g))?h=k:h.set(g,h=new Map)):c[b]=1,(k=h.get(b))?h=k:h.set(b,h=[]),h=h[d]||(h[d]=[]),f&&h.includes(e)||(h.push(e),a.fastupdate&&((c=a.h.get(e))?c.push(h):a.h.set(e,[h]))))}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 L(a,c,b){if(1===a.length)return a=a[0],a=b||a.length>c?c?a.slice(b,b+c):a.slice(b):a;let d=[];for(let e=0,f,g;e<a.length;e++)if((f=a[e])&&(g=f.length)){if(b){if(b>=g){b-=g;continue}b<g&&(f=c?f.slice(b,b+c):f.slice(b),g=f.length,b=0)}if(d.length)g>c&&(f=f.slice(0,c),g=f.length),d.push(f);else{if(g>=c)return g>c&&(f=f.slice(0,c)),f;d=[f]}c-=g;if(!c)break}return d.length?d=1<d.length?[].concat.apply([],d):d[0]:d};H.prototype.search=function(a,c,b){b||(c||"object"!==typeof a?"object"===typeof c&&(b=c,c=0):(b=a,a=""));var d=[],e=0;if(b){a=b.query||a;c=b.limit||c;e=b.offset||0;var f=b.context;var g=!1}a=this.encoder.encode(a);b=a.length;c||(c=100);if(1===b)return M.call(this,a[0],"",c,e);f=this.depth&&!1!==f;if(2===b&&f&&!g)return M.call(this,a[0],a[1],c,e);var h=0,k=0;if(1<b){var p=t();const q=[];for(let r=0,l;r<b;r++)if((l=a[r])&&!p[l]){if(g||N(this,l))q.push(l),p[l]=1;else return d;const n=l.length;h=Math.max(h,
n);k=k?Math.min(k,n):n}a=q;b=a.length}if(!b)return d;p=0;if(1===b)return M.call(this,a[0],"",c,e);if(2===b&&f&&!g)return M.call(this,a[0],a[1],c,e);if(1<b)if(f){var m=a[0];p=1}else 9<h&&3<h/k&&a.sort(u);for(let q,r;p<b;p++){r=a[p];m?(q=N(this,r,m),q=O(q,d,g,this.C,c,e,2===b),g&&!1===q&&d.length||(m=r)):(q=N(this,r),q=O(q,d,g,this.resolution,c,e,1===b));if(q)return q;if(g&&p===b-1){f=d.length;if(!f){if(m){m="";p=-1;continue}return d}if(1===f)return L(d[0],c,e)}}a:{a=d;d=this.resolution;m=a.length;
b=[];f=t();for(let q=0,r,l,n,y;q<d;q++)for(k=0;k<m;k++)if(n=a[k],q<n.length&&(r=n[q]))for(p=0;p<r.length;p++)l=r[p],(h=f[l])?f[l]++:(h=0,f[l]=1),y=b[h]||(b[h]=[]),y.push(l);if(a=b.length)if(g){if(1<b.length){g=b;a=[];d=t();f=g.length;for(k=0;k<f;k++)for(m=g[k],h=m.length,p=0;p<h;p++)if(b=m[p],!d[b])if(d[b]=1,e)e--;else if(a.push(b),a.length===c)break;c=a}else c=b[0];b=c}else{if(a<m){d=[];break a}b=b[a-1];if(b.length>c||e)b=b.slice(e,c+e)}d=b}return d};
function M(a,c,b,d){return(a=N(this,a,c))&&a.length?L(a,b,d):[]}function O(a,c,b,d,e,f,g){let h=[];if(a){d=Math.min(a.length,d);for(let k=0,p=0,m;k<d;k++)if(m=a[k])if(f&&m&&g&&(m.length<=f?(f-=m.length,m=null):(m=m.slice(f),f=0)),m&&(h[k]=m,g&&(p+=m.length,p>=e)))break;if(h.length){if(g)return L(h,e,0);c.push(h);return}}return!b&&h}function N(a,c,b){let d;b&&(d=a.bidirectional&&c>b);a=b?(a=a.A.get(d?c:b))&&a.get(d?b:c):a.map.get(c);return a};H.prototype.remove=function(a,c){const b=this.h.size&&(this.fastupdate?this.h.get(a):this.h.has(a));if(b){if(this.fastupdate)for(let d=0,e;d<b.length;d++){if(e=b[d])if(2>e.length)e.pop();else{const f=e.indexOf(a);f===b.length-1?e.pop():e.splice(f,1)}}else P(this.map,a),this.depth&&P(this.A,a);c||this.h.delete(a)}this.cache&&this.cache.remove(a);return this};
function P(a,c){let b=0;if(a.constructor===Array)for(let d=0,e,f;d<a.length;d++){if((e=a[d])&&e.length)if(f=e.indexOf(c),0<=f){1<e.length?(e.splice(f,1),b++):delete a[d];break}else b++}else for(let d of a){const e=d[0],f=P(d[1],c);f?b+=f:a.delete(e)}return b};function H(a,c){if(!this)return new H(a);a=a?G(a):{};const b=a.context||{},d=a.encode||a.encoder||function(f){return f.toLowerCase().trim().split(/\s+/)};this.encoder=d.encode?d:"object"===typeof d?d:{encode:d};let e;this.resolution=a.resolution||9;this.tokenize=e=a.tokenize||"strict";this.depth="strict"===e&&b.depth||0;this.bidirectional=!1!==b.bidirectional;this.fastupdate=!!a.fastupdate;this.score=a.score||null;e=!1;this.map=new Map;this.A=new Map;this.h=c||(this.fastupdate?new Map:new Set);this.C=
b.resolution||1;this.rtl=d.rtl||a.rtl||!1;this.cache=(e=a.cache||null)&&new v(e)}H.prototype.clear=function(){this.map.clear();this.A.clear();this.h.clear();this.cache&&this.cache.clear();return this};H.prototype.append=function(a,c){return this.add(a,c,!0)};H.prototype.contain=function(a){return this.h.has(a)};H.prototype.update=function(a,c){if(this.async){const b=this,d=this.remove(a);return d.then?d.then(()=>b.add(a,c)):this.add(a,c)}return this.remove(a).add(a,c)};
function Q(a){let c=0;if(a.constructor===Array)for(let b=0,d;b<a.length;b++)(d=a[b])&&(c+=d.length);else for(const b of a){const d=b[0],e=Q(b[1]);e?c+=e:a.delete(d)}return c}H.prototype.cleanup=function(){if(!this.fastupdate)return this;Q(this.map);this.depth&&Q(this.A);return this};
H.prototype.searchCache=function(a,c,b){a=("object"===typeof a?""+a.query:a).toLowerCase();let d=this.cache.get(a);if(!d){d=this.search(a,c,b);if(d.then){const e=this;d.then(function(f){e.cache.set(a,f);return f})}this.cache.set(a,d)}return d};export default {Index:H,Charset:E,Encoder:null,Document:null,Worker:null,Resolver:null,IndexedDB:null,Language:{}};
export const Index=H;export const Charset=E;export const Encoder=null;export const Document=null;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};

View File

@@ -92,31 +92,7 @@ export function intersect(arrays, resolution, limit, offset, suggest) {
}
} else {
const final = [];
for (let i = result_len - 1, count = 0, arr, arr_len; 0 <= i; i--) {
arr = result[i];
arr_len = arr.length;
if (offset >= arr_len) {
offset -= arr_len;
continue;
}
if (arr_len + count > limit || offset) {
arr = arr.slice(offset, limit - count + offset);
arr_len = arr.length;
}
final.push(arr);
count += arr_len;
if (limit === count) {
break;
}
}
result = 1 < final.length ? union(final, offset, limit) : final[0];
result = 1 < result.length ? union(result, offset, limit) : result[0];
}
}

View File

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

View File

@@ -92,31 +92,7 @@ export function intersect(arrays, resolution, limit, offset, suggest) {
}
} else {
const final = [];
for (let i = result_len - 1, count = 0, arr, arr_len; 0 <= i; i--) {
arr = result[i];
arr_len = arr.length;
if (offset >= arr_len) {
offset -= arr_len;
continue;
}
if (arr_len + count > limit || offset) {
arr = arr.slice(offset, limit - count + offset);
arr_len = arr.length;
}
final.push(arr);
count += arr_len;
if (limit === count) {
break;
}
}
result = 1 < final.length ? union(final, offset, limit) : final[0];
result = 1 < result.length ? union(result, offset, limit) : result[0];
}
}

View File

@@ -93,33 +93,9 @@ export function intersect(arrays, resolution, limit, offset, suggest) {
}
else{
const final = [];
for(let i = result_len - 1, count = 0, arr, arr_len; i >= 0; i--){
arr = result[i];
arr_len = arr.length;
if(offset >= arr_len){
offset -= arr_len;
continue;
}
if((arr_len + count) > limit || offset){
arr = arr.slice(offset, limit - count + offset);
arr_len = arr.length;
}
final.push(arr);
count += arr_len;
if(limit === count){
break;
}
}
result = final.length > 1
? union(final, offset, limit)
: final[0];
result = result.length > 1
? union(result, offset, limit)
: result[0];
}
}