1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-10-04 17:11:33 +02:00

hotfix remove/update/replace

This commit is contained in:
Thomas Wilkerling
2025-05-15 08:56:05 +02:00
parent 430e0c072c
commit e9c26f06b4
21 changed files with 381 additions and 352 deletions

View File

@@ -32,15 +32,16 @@
background-color: transparent;
position: absolute;
-webkit-appearance: none;
z-index: 1;
}
#autocomplete{
color: #999;
background-color: #f5f5f5;
pointer-events: none;
}
#trigger-prev,
#trigger-next{
z-index: -1;
#select-prev,
#select-next{
z-index: 0;
}
input{
padding:7px 5px;
@@ -90,17 +91,17 @@
<body>
<div id="header">
<form style="position: relative; width: 100%;">
<input type="text" id="trigger-prev" tabindex="1">
<input type="text" id="select-prev" tabindex="1">
<input type="text" id="autocomplete" readonly>
<input type="text" id="userinput" tabindex="2" placeholder="Search by movie title ..." autocorrect="off" spellcheck="false" autocomplete="off" autofocus>
<input type="text" id="trigger-next" tabindex="3">
<input type="text" id="select-next" tabindex="3">
</form>
<label>
<input type="checkbox" id="suggest" checked> Suggest
</label>
</div>
<!-- Iterate through results by arrow keys -->
<div id="suggestions"></div>
<!--<div id="info">iterate results by arrow keys</div>-->
<script type="module">
// Features:
@@ -120,9 +121,6 @@
// for "Result Highlighting" it requires the usage of a Document Index
// also when just adding id-content-pairs to a single index
const index = new Document({
// the cache is a perfect addition
// for an instant search on keypress
cache: true,
document: {
// storing documents is required in this example
store: true,
@@ -150,8 +148,8 @@
const autocomplete = document.getElementById("autocomplete");
const userinput = document.getElementById("userinput");
const suggest = document.getElementById("suggest");
const trigger_prev = document.getElementById("trigger-prev");
const trigger_next = document.getElementById("trigger-next");
const select_prev = document.getElementById("select-prev");
const select_next = document.getElementById("select-next");
let results = [];
let iterate = 0;
@@ -161,12 +159,12 @@
suggest.addEventListener("change", toggle_suggest, true);
suggestions.addEventListener("click", accept_suggestion, true);
trigger_prev.addEventListener("focus", function(){
select_prev.addEventListener("focus", function(){
iterate_selected({ key: "ArrowUp" });
userinput.focus();
}, true);
trigger_next.addEventListener("focus", function(){
select_next.addEventListener("focus", function(){
iterate_selected({ key: "ArrowDown" });
userinput.focus();
}, true);
@@ -180,6 +178,9 @@
function show_results(){
// the cache is a perfect addition
// for an instant search on keypress
results = index.searchCache({
query: userinput.value,
suggest: suggest.checked,

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.166 (Bundle/Debug)
* FlexSearch.js v0.8.167 (Bundle/Debug)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -2102,13 +2102,13 @@ P.prototype.remove = function(a, b) {
const c = this.reg.size && (this.fastupdate ? this.reg.get(a) : this.reg.has(a));
if (c) {
if (this.fastupdate) {
for (let d = 0, e; d < c.length; d++) {
if (e = c[d]) {
if (2 > e.length) {
for (let d = 0, e, f; d < c.length; d++) {
if ((e = c[d]) && (f = e.length)) {
if (e[f - 1] === a) {
e.pop();
} else {
const f = e.indexOf(a);
f === c.length - 1 ? e.pop() : e.splice(f, 1);
const g = e.indexOf(a);
0 <= g && e.splice(g, 1);
}
}
}
@@ -2131,8 +2131,13 @@ function sb(a, b) {
c++;
} else {
if (g = f.indexOf(b), 0 <= g) {
1 < f.length ? (f.splice(g, 1), c++) : delete a[e];
if (1 < f.length) {
f.splice(g, 1);
c++;
break;
} else {
delete a[e];
}
} else {
c++;
}
@@ -2141,9 +2146,7 @@ function sb(a, b) {
}
} else {
for (let e of a.entries()) {
d = e[0];
const f = sb(e[1], b);
f ? c += f : a.delete(d);
d = e[0], sb(e[1], b) ? c++ : a.delete(d);
}
}
return c;

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.166 (Bundle)
* FlexSearch.js v0.8.167 (Bundle)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -70,8 +70,8 @@ v.get=function(a){return this.db?this.index.get(this.field[0]).db.enrich(a).then
v.export=function(a,b,c=0,d=0){if(c<this.field.length){const g=this.field[c];if((b=this.index.get(g).export(a,g,c,d=1))&&b.then){const h=this;return b.then(function(){return h.export(a,g,c+1)})}return this.export(a,g,c+1)}let e,f;switch(d){case 0:e="reg";f=Ia(this.reg);b=null;break;case 1:e="tag";f=this.tag&&Ga(this.tag,this.reg.size);b=null;break;case 2:e="doc";f=this.store&&Ea(this.store);b=null;break;default:return}return Ka.call(this,a,b,e,f,c,d)};
v.import=function(a,b){var c=a.split(".");"json"===c[c.length-1]&&c.pop();const d=2<c.length?c[0]:"";c=2<c.length?c[2]:c[1];if(this.worker&&d)return this.index.get(d).import(a);if(b){"string"===typeof b&&(b=JSON.parse(b));if(d)return this.index.get(d).import(c,b);switch(c){case "reg":this.fastupdate=!1;this.reg=Ja(b,this.reg);for(let e=0,f;e<this.field.length;e++)f=this.index.get(this.field[e]),f.fastupdate=!1,f.reg=this.reg;if(this.worker){b=[];for(const e of this.index.values())b.push(e.import(a));
return Promise.all(b)}break;case "tag":this.tag=Ha(b,this.tag);break;case "doc":this.store=Fa(b,this.store)}}};ta(W.prototype);function rb(a,b,c){const d=(b?""+a:"object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new pb);let e=this.cache.get(d);if(!e){e=this.search(a,b,c);if(e.then){const f=this;e.then(function(g){f.cache.set(d,g);return g})}this.cache.set(d,e)}return e}function pb(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}pb.prototype.set=function(a,b){this.cache.set(this.h=a,b);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};
pb.prototype.get=function(a){const b=this.cache.get(a);b&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,b));return b};pb.prototype.remove=function(a){for(const b of this.cache){const c=b[0];b[1].includes(a)&&this.cache.delete(c)}};pb.prototype.clear=function(){this.cache.clear();this.h=""};O.prototype.remove=function(a,b){const c=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(c){if(this.fastupdate)for(let 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 sb(this.map,a),this.depth&&sb(this.ctx,a);b||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.T&&tb(this));this.cache&&this.cache.remove(a);return this};
function sb(a,b){let c=0;var d="undefined"===typeof b;if(a.constructor===Array)for(let e=0,f,g;e<a.length;e++){if((f=a[e])&&f.length)if(d)c++;else if(g=f.indexOf(b),0<=g){1<f.length?(f.splice(g,1),c++):delete a[e];break}else c++}else for(let e of a.entries()){d=e[0];const f=sb(e[1],b);f?c+=f:a.delete(d)}return c};const ub={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};O.prototype.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.reg.has(a))return this.update(a,b);d=this.depth;b=this.encoder.encode(b,!d);const l=b.length;if(l){const m=G(),n=G(),u=this.resolution;for(let r=0;r<l;r++){let p=b[this.rtl?l-1-r:r];var e=p.length;if(e&&(d||!n[p])){var f=this.score?this.score(b,p,r,null,0):vb(u,l,r),g="";switch(this.tokenize){case "full":if(2<e){for(let q=0,t;q<e;q++)for(f=e;f>q;f--){g=p.substring(q,f);t=this.rtl?e-1-q:q;var h=this.score?this.score(b,p,r,g,t):vb(u,
pb.prototype.get=function(a){const b=this.cache.get(a);b&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,b));return b};pb.prototype.remove=function(a){for(const b of this.cache){const c=b[0];b[1].includes(a)&&this.cache.delete(c)}};pb.prototype.clear=function(){this.cache.clear();this.h=""};O.prototype.remove=function(a,b){const c=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(c){if(this.fastupdate)for(let d=0,e,f;d<c.length;d++){if((e=c[d])&&(f=e.length))if(e[f-1]===a)e.pop();else{const g=e.indexOf(a);0<=g&&e.splice(g,1)}}else sb(this.map,a),this.depth&&sb(this.ctx,a);b||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.T&&tb(this));this.cache&&this.cache.remove(a);return this};
function sb(a,b){let c=0;var d="undefined"===typeof b;if(a.constructor===Array)for(let e=0,f,g;e<a.length;e++){if((f=a[e])&&f.length)if(d)c++;else if(g=f.indexOf(b),0<=g)if(1<f.length){f.splice(g,1);c++;break}else delete a[e];else c++}else for(let e of a.entries())d=e[0],sb(e[1],b)?c++:a.delete(d);return c};const ub={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};O.prototype.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.reg.has(a))return this.update(a,b);d=this.depth;b=this.encoder.encode(b,!d);const l=b.length;if(l){const m=G(),n=G(),u=this.resolution;for(let r=0;r<l;r++){let p=b[this.rtl?l-1-r:r];var e=p.length;if(e&&(d||!n[p])){var f=this.score?this.score(b,p,r,null,0):vb(u,l,r),g="";switch(this.tokenize){case "full":if(2<e){for(let q=0,t;q<e;q++)for(f=e;f>q;f--){g=p.substring(q,f);t=this.rtl?e-1-q:q;var h=this.score?this.score(b,p,r,g,t):vb(u,
l,r,e,t);wb(this,n,g,h,a,c)}break}case "bidirectional":case "reverse":if(1<e){for(h=e-1;0<h;h--){g=p[this.rtl?e-1-h:h]+g;var k=this.score?this.score(b,p,r,g,h):vb(u,l,r,e,h);wb(this,n,g,k,a,c)}g=""}case "forward":if(1<e){for(h=0;h<e;h++)g+=p[this.rtl?e-1-h:h],wb(this,n,g,f,a,c);break}default:if(wb(this,n,p,f,a,c),d&&1<l&&r<l-1)for(e=G(),g=this.U,f=p,h=Math.min(d+1,this.rtl?r+1:l-r),e[f]=1,k=1;k<h;k++)if((p=b[this.rtl?l-1-r-k:r+k])&&!e[p]){e[p]=1;const q=this.score?this.score(b,f,r,p,k-1):vb(g+(l/
2>g?0:1),l,r,h-1,k-1),t=this.bidirectional&&p>f;wb(this,m,t?f:p,q,a,c,t?p:f)}}}}this.fastupdate||this.reg.add(a)}else b=""}this.db&&(b||this.commit_task.push({del:a}),this.T&&tb(this));return this};
function wb(a,b,c,d,e,f,g){let h=g?a.ctx:a.map,k;if(!b[c]||g&&!(k=b[c])[g])if(g?(b=k||(b[c]=G()),b[g]=1,(k=h.get(g))?h=k:h.set(g,h=new Map)):b[c]=1,(k=h.get(c))?h=k:h.set(c,h=k=[]),h=h[d]||(h[d]=[]),!f||!h.includes(e)){if(h.length===2**31-1){b=new R(h);if(a.fastupdate)for(let l of a.reg.values())l.includes(h)&&(l[l.indexOf(h)]=b);k[d]=h=b}h.push(e);a.fastupdate&&((d=a.reg.get(e))?d.push(h):a.reg.set(e,[h]))}}

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.166 (Bundle/Module/Debug)
* FlexSearch.js v0.8.167 (Bundle/Module/Debug)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -2101,13 +2101,13 @@ P.prototype.remove = function(a, b) {
const c = this.reg.size && (this.fastupdate ? this.reg.get(a) : this.reg.has(a));
if (c) {
if (this.fastupdate) {
for (let d = 0, e; d < c.length; d++) {
if (e = c[d]) {
if (2 > e.length) {
for (let d = 0, e, f; d < c.length; d++) {
if ((e = c[d]) && (f = e.length)) {
if (e[f - 1] === a) {
e.pop();
} else {
const f = e.indexOf(a);
f === c.length - 1 ? e.pop() : e.splice(f, 1);
const g = e.indexOf(a);
0 <= g && e.splice(g, 1);
}
}
}
@@ -2130,8 +2130,13 @@ function sb(a, b) {
c++;
} else {
if (g = f.indexOf(b), 0 <= g) {
1 < f.length ? (f.splice(g, 1), c++) : delete a[e];
if (1 < f.length) {
f.splice(g, 1);
c++;
break;
} else {
delete a[e];
}
} else {
c++;
}
@@ -2140,9 +2145,7 @@ function sb(a, b) {
}
} else {
for (let e of a.entries()) {
d = e[0];
const f = sb(e[1], b);
f ? c += f : a.delete(d);
d = e[0], sb(e[1], b) ? c++ : a.delete(d);
}
}
return c;

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.166 (Bundle/Module)
* FlexSearch.js v0.8.167 (Bundle/Module)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -70,8 +70,8 @@ v.get=function(a){return this.db?this.index.get(this.field[0]).db.enrich(a).then
v.export=function(a,b,c=0,d=0){if(c<this.field.length){const g=this.field[c];if((b=this.index.get(g).export(a,g,c,d=1))&&b.then){const h=this;return b.then(function(){return h.export(a,g,c+1)})}return this.export(a,g,c+1)}let e,f;switch(d){case 0:e="reg";f=Ia(this.reg);b=null;break;case 1:e="tag";f=this.tag&&Ga(this.tag,this.reg.size);b=null;break;case 2:e="doc";f=this.store&&Ea(this.store);b=null;break;default:return}return Ka.call(this,a,b,e,f,c,d)};
v.import=function(a,b){var c=a.split(".");"json"===c[c.length-1]&&c.pop();const d=2<c.length?c[0]:"";c=2<c.length?c[2]:c[1];if(this.worker&&d)return this.index.get(d).import(a);if(b){"string"===typeof b&&(b=JSON.parse(b));if(d)return this.index.get(d).import(c,b);switch(c){case "reg":this.fastupdate=!1;this.reg=Ja(b,this.reg);for(let e=0,f;e<this.field.length;e++)f=this.index.get(this.field[e]),f.fastupdate=!1,f.reg=this.reg;if(this.worker){b=[];for(const e of this.index.values())b.push(e.import(a));
return Promise.all(b)}break;case "tag":this.tag=Ha(b,this.tag);break;case "doc":this.store=Fa(b,this.store)}}};ta(W.prototype);function rb(a,b,c){const d=(b?""+a:"object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new pb);let e=this.cache.get(d);if(!e){e=this.search(a,b,c);if(e.then){const f=this;e.then(function(g){f.cache.set(d,g);return g})}this.cache.set(d,e)}return e}function pb(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}pb.prototype.set=function(a,b){this.cache.set(this.h=a,b);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};
pb.prototype.get=function(a){const b=this.cache.get(a);b&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,b));return b};pb.prototype.remove=function(a){for(const b of this.cache){const c=b[0];b[1].includes(a)&&this.cache.delete(c)}};pb.prototype.clear=function(){this.cache.clear();this.h=""};O.prototype.remove=function(a,b){const c=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(c){if(this.fastupdate)for(let 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 sb(this.map,a),this.depth&&sb(this.ctx,a);b||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.T&&tb(this));this.cache&&this.cache.remove(a);return this};
function sb(a,b){let c=0;var d="undefined"===typeof b;if(a.constructor===Array)for(let e=0,f,g;e<a.length;e++){if((f=a[e])&&f.length)if(d)c++;else if(g=f.indexOf(b),0<=g){1<f.length?(f.splice(g,1),c++):delete a[e];break}else c++}else for(let e of a.entries()){d=e[0];const f=sb(e[1],b);f?c+=f:a.delete(d)}return c};const ub={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};O.prototype.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.reg.has(a))return this.update(a,b);d=this.depth;b=this.encoder.encode(b,!d);const l=b.length;if(l){const m=G(),n=G(),u=this.resolution;for(let r=0;r<l;r++){let p=b[this.rtl?l-1-r:r];var e=p.length;if(e&&(d||!n[p])){var f=this.score?this.score(b,p,r,null,0):vb(u,l,r),g="";switch(this.tokenize){case "full":if(2<e){for(let q=0,t;q<e;q++)for(f=e;f>q;f--){g=p.substring(q,f);t=this.rtl?e-1-q:q;var h=this.score?this.score(b,p,r,g,t):vb(u,
pb.prototype.get=function(a){const b=this.cache.get(a);b&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,b));return b};pb.prototype.remove=function(a){for(const b of this.cache){const c=b[0];b[1].includes(a)&&this.cache.delete(c)}};pb.prototype.clear=function(){this.cache.clear();this.h=""};O.prototype.remove=function(a,b){const c=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(c){if(this.fastupdate)for(let d=0,e,f;d<c.length;d++){if((e=c[d])&&(f=e.length))if(e[f-1]===a)e.pop();else{const g=e.indexOf(a);0<=g&&e.splice(g,1)}}else sb(this.map,a),this.depth&&sb(this.ctx,a);b||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.T&&tb(this));this.cache&&this.cache.remove(a);return this};
function sb(a,b){let c=0;var d="undefined"===typeof b;if(a.constructor===Array)for(let e=0,f,g;e<a.length;e++){if((f=a[e])&&f.length)if(d)c++;else if(g=f.indexOf(b),0<=g)if(1<f.length){f.splice(g,1);c++;break}else delete a[e];else c++}else for(let e of a.entries())d=e[0],sb(e[1],b)?c++:a.delete(d);return c};const ub={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};O.prototype.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.reg.has(a))return this.update(a,b);d=this.depth;b=this.encoder.encode(b,!d);const l=b.length;if(l){const m=G(),n=G(),u=this.resolution;for(let r=0;r<l;r++){let p=b[this.rtl?l-1-r:r];var e=p.length;if(e&&(d||!n[p])){var f=this.score?this.score(b,p,r,null,0):vb(u,l,r),g="";switch(this.tokenize){case "full":if(2<e){for(let q=0,t;q<e;q++)for(f=e;f>q;f--){g=p.substring(q,f);t=this.rtl?e-1-q:q;var h=this.score?this.score(b,p,r,g,t):vb(u,
l,r,e,t);wb(this,n,g,h,a,c)}break}case "bidirectional":case "reverse":if(1<e){for(h=e-1;0<h;h--){g=p[this.rtl?e-1-h:h]+g;var k=this.score?this.score(b,p,r,g,h):vb(u,l,r,e,h);wb(this,n,g,k,a,c)}g=""}case "forward":if(1<e){for(h=0;h<e;h++)g+=p[this.rtl?e-1-h:h],wb(this,n,g,f,a,c);break}default:if(wb(this,n,p,f,a,c),d&&1<l&&r<l-1)for(e=G(),g=this.U,f=p,h=Math.min(d+1,this.rtl?r+1:l-r),e[f]=1,k=1;k<h;k++)if((p=b[this.rtl?l-1-r-k:r+k])&&!e[p]){e[p]=1;const q=this.score?this.score(b,f,r,p,k-1):vb(g+(l/
2>g?0:1),l,r,h-1,k-1),t=this.bidirectional&&p>f;wb(this,m,t?f:p,q,a,c,t?p:f)}}}}this.fastupdate||this.reg.add(a)}else b=""}this.db&&(b||this.commit_task.push({del:a}),this.T&&tb(this));return this};
function wb(a,b,c,d,e,f,g){let h=g?a.ctx:a.map,k;if(!b[c]||g&&!(k=b[c])[g])if(g?(b=k||(b[c]=G()),b[g]=1,(k=h.get(g))?h=k:h.set(g,h=new Map)):b[c]=1,(k=h.get(c))?h=k:h.set(c,h=k=[]),h=h[d]||(h[d]=[]),!f||!h.includes(e)){if(h.length===2**31-1){b=new R(h);if(a.fastupdate)for(let l of a.reg.values())l.includes(h)&&(l[l.indexOf(h)]=b);k[d]=h=b}h.push(e);a.fastupdate&&((d=a.reg.get(e))?d.push(h):a.reg.set(e,[h]))}}

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.166 (Bundle/Debug)
* FlexSearch.js v0.8.167 (Bundle/Debug)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -1220,13 +1220,13 @@ Z.prototype.remove = function(a, c) {
const b = this.reg.size && (this.fastupdate ? this.reg.get(a) : this.reg.has(a));
if (b) {
if (this.fastupdate) {
for (let e = 0, d; e < b.length; e++) {
if (d = b[e]) {
if (2 > d.length) {
for (let e = 0, d, f; e < b.length; e++) {
if ((d = b[e]) && (f = d.length)) {
if (d[f - 1] === a) {
d.pop();
} else {
const f = d.indexOf(a);
f === b.length - 1 ? d.pop() : d.splice(f, 1);
const g = d.indexOf(a);
0 <= g && d.splice(g, 1);
}
}
}
@@ -1248,8 +1248,13 @@ function Sa(a, c) {
b++;
} else {
if (g = f.indexOf(c), 0 <= g) {
1 < f.length ? (f.splice(g, 1), b++) : delete a[d];
if (1 < f.length) {
f.splice(g, 1);
b++;
break;
} else {
delete a[d];
}
} else {
b++;
}
@@ -1258,9 +1263,7 @@ function Sa(a, c) {
}
} else {
for (let d of a.entries()) {
e = d[0];
const f = Sa(d[1], c);
f ? b += f : a.delete(e);
e = d[0], Sa(d[1], c) ? b++ : a.delete(e);
}
}
return b;

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.166 (Bundle)
* FlexSearch.js v0.8.167 (Bundle)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -43,8 +43,8 @@ A.clear=function(){const a=[];for(const c of this.index.values()){const b=c.clea
A.set=function(a,c){"object"===typeof a&&(c=a,a=S(c,this.key));this.store.set(a,c);return this};A.searchCache=Ra;
A.export=function(a,c,b=0,e=0){if(b<this.field.length){const g=this.field[b];if((c=this.index.get(g).export(a,g,b,e=1))&&c.then){const k=this;return c.then(function(){return k.export(a,g,b+1)})}return this.export(a,g,b+1)}let d,f;switch(e){case 0:d="reg";f=wa(this.reg);c=null;break;case 1:d="tag";f=this.tag&&sa(this.tag,this.reg.size);c=null;break;case 2:d="doc";f=this.store&&qa(this.store);c=null;break;default:return}return ya.call(this,a,c,d,f,b,e)};
A.import=function(a,c){var b=a.split(".");"json"===b[b.length-1]&&b.pop();a=2<b.length?b[0]:"";b=2<b.length?b[2]:b[1];if(c){"string"===typeof c&&(c=JSON.parse(c));if(a)return this.index.get(a).import(b,c);switch(b){case "reg":this.fastupdate=!1;this.reg=xa(c,this.reg);for(let e=0,d;e<this.field.length;e++)d=this.index.get(this.field[e]),d.fastupdate=!1,d.reg=this.reg;break;case "tag":this.tag=ta(c,this.tag);break;case "doc":this.store=ra(c,this.store)}}};la(X.prototype);function Ra(a,c,b){const e=(c?""+a:"object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new Y);let d=this.cache.get(e);if(!d){d=this.search(a,c,b);if(d.then){const f=this;d.then(function(g){f.cache.set(e,g);return g})}this.cache.set(e,d)}return d}function Y(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}Y.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)};
Y.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};Y.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};Y.prototype.clear=function(){this.cache.clear();this.h=""};Z.prototype.remove=function(a,c){const b=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.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 Sa(this.map,a),this.depth&&Sa(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function Sa(a,c){let b=0;var e="undefined"===typeof c;if(a.constructor===Array)for(let d=0,f,g;d<a.length;d++){if((f=a[d])&&f.length)if(e)b++;else if(g=f.indexOf(c),0<=g){1<f.length?(f.splice(g,1),b++):delete a[d];break}else b++}else for(let d of a.entries()){e=d[0];const f=Sa(d[1],c);f?b+=f:a.delete(e)}return b};const Ta={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};Z.prototype.add=function(a,c,b,e){if(c&&(a||0===a)){if(!e&&!b&&this.reg.has(a))return this.update(a,c);e=this.depth;c=this.encoder.encode(c,!e);const m=c.length;if(m){const n=N(),B=N(),x=this.resolution;for(let q=0;q<m;q++){let r=c[this.rtl?m-1-q:q];var d=r.length;if(d&&(e||!B[r])){var f=this.score?this.score(c,r,q,null,0):Ua(x,m,q),g="";switch(this.tokenize){case "full":if(2<d){for(let w=0,l;w<d;w++)for(f=d;f>w;f--){g=r.substring(w,f);l=this.rtl?d-1-w:w;var k=this.score?this.score(c,r,q,g,l):Ua(x,
Y.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};Y.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};Y.prototype.clear=function(){this.cache.clear();this.h=""};Z.prototype.remove=function(a,c){const b=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(b){if(this.fastupdate)for(let e=0,d,f;e<b.length;e++){if((d=b[e])&&(f=d.length))if(d[f-1]===a)d.pop();else{const g=d.indexOf(a);0<=g&&d.splice(g,1)}}else Sa(this.map,a),this.depth&&Sa(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function Sa(a,c){let b=0;var e="undefined"===typeof c;if(a.constructor===Array)for(let d=0,f,g;d<a.length;d++){if((f=a[d])&&f.length)if(e)b++;else if(g=f.indexOf(c),0<=g)if(1<f.length){f.splice(g,1);b++;break}else delete a[d];else b++}else for(let d of a.entries())e=d[0],Sa(d[1],c)?b++:a.delete(e);return b};const Ta={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};Z.prototype.add=function(a,c,b,e){if(c&&(a||0===a)){if(!e&&!b&&this.reg.has(a))return this.update(a,c);e=this.depth;c=this.encoder.encode(c,!e);const m=c.length;if(m){const n=N(),B=N(),x=this.resolution;for(let q=0;q<m;q++){let r=c[this.rtl?m-1-q:q];var d=r.length;if(d&&(e||!B[r])){var f=this.score?this.score(c,r,q,null,0):Ua(x,m,q),g="";switch(this.tokenize){case "full":if(2<d){for(let w=0,l;w<d;w++)for(f=d;f>w;f--){g=r.substring(w,f);l=this.rtl?d-1-w:w;var k=this.score?this.score(c,r,q,g,l):Ua(x,
m,q,d,l);Va(this,B,g,k,a,b)}break}case "bidirectional":case "reverse":if(1<d){for(k=d-1;0<k;k--){g=r[this.rtl?d-1-k:k]+g;var h=this.score?this.score(c,r,q,g,k):Ua(x,m,q,d,k);Va(this,B,g,h,a,b)}g=""}case "forward":if(1<d){for(k=0;k<d;k++)g+=r[this.rtl?d-1-k:k],Va(this,B,g,f,a,b);break}default:if(Va(this,B,r,f,a,b),e&&1<m&&q<m-1)for(d=N(),g=this.P,f=r,k=Math.min(e+1,this.rtl?q+1:m-q),d[f]=1,h=1;h<k;h++)if((r=c[this.rtl?m-1-q-h:q+h])&&!d[r]){d[r]=1;const w=this.score?this.score(c,f,q,r,h-1):Ua(g+(m/
2>g?0:1),m,q,k-1,h-1),l=this.bidirectional&&r>f;Va(this,n,l?f:r,w,a,b,l?r:f)}}}}this.fastupdate||this.reg.add(a)}}return this};function Va(a,c,b,e,d,f,g){let k=g?a.ctx:a.map,h;if(!c[b]||g&&!(h=c[b])[g])g?(c=h||(c[b]=N()),c[g]=1,(h=k.get(g))?k=h:k.set(g,k=new Map)):c[b]=1,(h=k.get(b))?k=h:k.set(b,k=[]),k=k[e]||(k[e]=[]),f&&k.includes(d)||(k.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(k):a.reg.set(d,[k])))}
function Ua(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};Z.prototype.search=function(a,c,b){b||(c||"object"!==typeof a?"object"===typeof c&&(b=c,c=0):(b=a,a=""));if(b&&b.cache)return b.cache=!1,c=this.searchCache(a,c,b),b.cache=!0,c;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;var k=!0;var h=b.resolution}"undefined"===typeof k&&(k=!0);f=this.depth&&!1!==f;b=this.encoder.encode(a,!f);a=b.length;c=c||(k?100:0);if(1===a)return g=d,(d=Wa(this,b[0],""))&&d.length?Ca.call(this,d,c,g):[];if(2===a&&f&&!g)return g=d,

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.166 (Bundle/Debug)
* FlexSearch.js v0.8.167 (Bundle/Debug)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -1219,13 +1219,13 @@ Z.prototype.remove = function(a, c) {
const b = this.reg.size && (this.fastupdate ? this.reg.get(a) : this.reg.has(a));
if (b) {
if (this.fastupdate) {
for (let e = 0, d; e < b.length; e++) {
if (d = b[e]) {
if (2 > d.length) {
for (let e = 0, d, f; e < b.length; e++) {
if ((d = b[e]) && (f = d.length)) {
if (d[f - 1] === a) {
d.pop();
} else {
const f = d.indexOf(a);
f === b.length - 1 ? d.pop() : d.splice(f, 1);
const g = d.indexOf(a);
0 <= g && d.splice(g, 1);
}
}
}
@@ -1247,8 +1247,13 @@ function Sa(a, c) {
b++;
} else {
if (g = f.indexOf(c), 0 <= g) {
1 < f.length ? (f.splice(g, 1), b++) : delete a[d];
if (1 < f.length) {
f.splice(g, 1);
b++;
break;
} else {
delete a[d];
}
} else {
b++;
}
@@ -1257,9 +1262,7 @@ function Sa(a, c) {
}
} else {
for (let d of a.entries()) {
e = d[0];
const f = Sa(d[1], c);
f ? b += f : a.delete(e);
e = d[0], Sa(d[1], c) ? b++ : a.delete(e);
}
}
return b;

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.166 (Bundle)
* FlexSearch.js v0.8.167 (Bundle)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -43,8 +43,8 @@ A.clear=function(){const a=[];for(const c of this.index.values()){const b=c.clea
A.set=function(a,c){"object"===typeof a&&(c=a,a=S(c,this.key));this.store.set(a,c);return this};A.searchCache=Ra;
A.export=function(a,c,b=0,e=0){if(b<this.field.length){const g=this.field[b];if((c=this.index.get(g).export(a,g,b,e=1))&&c.then){const k=this;return c.then(function(){return k.export(a,g,b+1)})}return this.export(a,g,b+1)}let d,f;switch(e){case 0:d="reg";f=wa(this.reg);c=null;break;case 1:d="tag";f=this.tag&&sa(this.tag,this.reg.size);c=null;break;case 2:d="doc";f=this.store&&qa(this.store);c=null;break;default:return}return ya.call(this,a,c,d,f,b,e)};
A.import=function(a,c){var b=a.split(".");"json"===b[b.length-1]&&b.pop();a=2<b.length?b[0]:"";b=2<b.length?b[2]:b[1];if(c){"string"===typeof c&&(c=JSON.parse(c));if(a)return this.index.get(a).import(b,c);switch(b){case "reg":this.fastupdate=!1;this.reg=xa(c,this.reg);for(let e=0,d;e<this.field.length;e++)d=this.index.get(this.field[e]),d.fastupdate=!1,d.reg=this.reg;break;case "tag":this.tag=va(c,this.tag);break;case "doc":this.store=ra(c,this.store)}}};la(X.prototype);function Ra(a,c,b){const e=(c?""+a:"object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new Y);let d=this.cache.get(e);if(!d){d=this.search(a,c,b);if(d.then){const f=this;d.then(function(g){f.cache.set(e,g);return g})}this.cache.set(e,d)}return d}function Y(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}Y.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)};
Y.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};Y.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};Y.prototype.clear=function(){this.cache.clear();this.h=""};Z.prototype.remove=function(a,c){const b=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.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 Sa(this.map,a),this.depth&&Sa(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function Sa(a,c){let b=0;var e="undefined"===typeof c;if(a.constructor===Array)for(let d=0,f,g;d<a.length;d++){if((f=a[d])&&f.length)if(e)b++;else if(g=f.indexOf(c),0<=g){1<f.length?(f.splice(g,1),b++):delete a[d];break}else b++}else for(let d of a.entries()){e=d[0];const f=Sa(d[1],c);f?b+=f:a.delete(e)}return b};const Ta={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};Z.prototype.add=function(a,c,b,e){if(c&&(a||0===a)){if(!e&&!b&&this.reg.has(a))return this.update(a,c);e=this.depth;c=this.encoder.encode(c,!e);const m=c.length;if(m){const n=N(),B=N(),x=this.resolution;for(let q=0;q<m;q++){let r=c[this.rtl?m-1-q:q];var d=r.length;if(d&&(e||!B[r])){var f=this.score?this.score(c,r,q,null,0):Ua(x,m,q),g="";switch(this.tokenize){case "full":if(2<d){for(let w=0,l;w<d;w++)for(f=d;f>w;f--){g=r.substring(w,f);l=this.rtl?d-1-w:w;var k=this.score?this.score(c,r,q,g,l):Ua(x,
Y.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};Y.prototype.remove=function(a){for(const c of this.cache){const b=c[0];c[1].includes(a)&&this.cache.delete(b)}};Y.prototype.clear=function(){this.cache.clear();this.h=""};Z.prototype.remove=function(a,c){const b=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(b){if(this.fastupdate)for(let e=0,d,f;e<b.length;e++){if((d=b[e])&&(f=d.length))if(d[f-1]===a)d.pop();else{const g=d.indexOf(a);0<=g&&d.splice(g,1)}}else Sa(this.map,a),this.depth&&Sa(this.ctx,a);c||this.reg.delete(a)}this.cache&&this.cache.remove(a);return this};
function Sa(a,c){let b=0;var e="undefined"===typeof c;if(a.constructor===Array)for(let d=0,f,g;d<a.length;d++){if((f=a[d])&&f.length)if(e)b++;else if(g=f.indexOf(c),0<=g)if(1<f.length){f.splice(g,1);b++;break}else delete a[d];else b++}else for(let d of a.entries())e=d[0],Sa(d[1],c)?b++:a.delete(e);return b};const Ta={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};Z.prototype.add=function(a,c,b,e){if(c&&(a||0===a)){if(!e&&!b&&this.reg.has(a))return this.update(a,c);e=this.depth;c=this.encoder.encode(c,!e);const m=c.length;if(m){const n=N(),B=N(),x=this.resolution;for(let q=0;q<m;q++){let r=c[this.rtl?m-1-q:q];var d=r.length;if(d&&(e||!B[r])){var f=this.score?this.score(c,r,q,null,0):Ua(x,m,q),g="";switch(this.tokenize){case "full":if(2<d){for(let w=0,l;w<d;w++)for(f=d;f>w;f--){g=r.substring(w,f);l=this.rtl?d-1-w:w;var k=this.score?this.score(c,r,q,g,l):Ua(x,
m,q,d,l);Va(this,B,g,k,a,b)}break}case "bidirectional":case "reverse":if(1<d){for(k=d-1;0<k;k--){g=r[this.rtl?d-1-k:k]+g;var h=this.score?this.score(c,r,q,g,k):Ua(x,m,q,d,k);Va(this,B,g,h,a,b)}g=""}case "forward":if(1<d){for(k=0;k<d;k++)g+=r[this.rtl?d-1-k:k],Va(this,B,g,f,a,b);break}default:if(Va(this,B,r,f,a,b),e&&1<m&&q<m-1)for(d=N(),g=this.P,f=r,k=Math.min(e+1,this.rtl?q+1:m-q),d[f]=1,h=1;h<k;h++)if((r=c[this.rtl?m-1-q-h:q+h])&&!d[r]){d[r]=1;const w=this.score?this.score(c,f,q,r,h-1):Ua(g+(m/
2>g?0:1),m,q,k-1,h-1),l=this.bidirectional&&r>f;Va(this,n,l?f:r,w,a,b,l?r:f)}}}}this.fastupdate||this.reg.add(a)}}return this};function Va(a,c,b,e,d,f,g){let k=g?a.ctx:a.map,h;if(!c[b]||g&&!(h=c[b])[g])g?(c=h||(c[b]=N()),c[g]=1,(h=k.get(g))?k=h:k.set(g,k=new Map)):c[b]=1,(h=k.get(b))?k=h:k.set(b,k=[]),k=k[e]||(k[e]=[]),f&&k.includes(d)||(k.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(k):a.reg.set(d,[k])))}
function Ua(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};Z.prototype.search=function(a,c,b){b||(c||"object"!==typeof a?"object"===typeof c&&(b=c,c=0):(b=a,a=""));if(b&&b.cache)return b.cache=!1,c=this.searchCache(a,c,b),b.cache=!0,c;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;var k=!0;var h=b.resolution}"undefined"===typeof k&&(k=!0);f=this.depth&&!1!==f;b=this.encoder.encode(a,!f);a=b.length;c=c||(k?100:0);if(1===a)return g=d,(d=Wa(this,b[0],""))&&d.length?Ca.call(this,d,c,g):[];if(2===a&&f&&!g)return g=d,

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.166 (ES5/Debug)
* FlexSearch.js v0.8.167 (ES5/Debug)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -3021,13 +3021,13 @@ W.prototype.remove = function(a, b) {
var c = this.reg.size && (this.fastupdate ? this.reg.get(a) : this.reg.has(a));
if (c) {
if (this.fastupdate) {
for (var d = 0, e; d < c.length; d++) {
if (e = c[d]) {
if (2 > e.length) {
for (var d = 0, e = void 0, f = void 0; d < c.length; d++) {
if ((e = c[d]) && (f = e.length)) {
if (e[f - 1] === a) {
e.pop();
} else {
var f = e.indexOf(a);
f === c.length - 1 ? e.pop() : e.splice(f, 1);
var g = e.indexOf(a);
0 <= g && e.splice(g, 1);
}
}
}
@@ -3049,8 +3049,13 @@ function Sb(a, b) {
c++;
} else {
if (g = f.indexOf(b), 0 <= g) {
1 < f.length ? (f.splice(g, 1), c++) : delete a[e];
if (1 < f.length) {
f.splice(g, 1);
c++;
break;
} else {
delete a[e];
}
} else {
c++;
}
@@ -3059,7 +3064,7 @@ function Sb(a, b) {
}
} else {
for (d = A(a.entries()), e = d.next(); !e.done; e = d.next()) {
f = e.value, e = f[0], (f = Sb(f[1], b)) ? c += f : a.delete(e);
e = e.value, f = e[0], Sb(e[1], b) ? c++ : a.delete(f);
}
}
return c;

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.166 (ES5)
* FlexSearch.js v0.8.167 (ES5)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -107,8 +107,8 @@ v.cleanup=function(){for(var a=A(this.index.values()),b=a.next();!b.done;b=a.nex
v.export=function(a,b,c,d){c=void 0===c?0:c;d=void 0===d?0:d;if(c<this.field.length){var e=this.field[c];if((b=this.index.get(e).export(a,e,c,d=1))&&b.then){var f=this;return b.then(function(){return f.export(a,e,c+1)})}return this.export(a,e,c+1)}switch(d){case 0:var g="reg";var h=eb(this.reg);b=null;break;case 1:g="tag";h=this.tag&&cb(this.tag,this.reg.size);b=null;break;case 2:g="doc";h=this.store&&ab(this.store);b=null;break;default:return}return gb.call(this,a,b,g,h,c,d)};
v.import=function(a,b){var c=a.split(".");"json"===c[c.length-1]&&c.pop();var d=2<c.length?c[0]:"";c=2<c.length?c[2]:c[1];if(this.worker&&d)return this.index.get(d).import(a);if(b){"string"===typeof b&&(b=JSON.parse(b));if(d)return this.index.get(d).import(c,b);switch(c){case "reg":this.fastupdate=!1;this.reg=fb(b,this.reg);for(b=0;b<this.field.length;b++)d=this.index.get(this.field[b]),d.fastupdate=!1,d.reg=this.reg;if(this.worker){b=[];d=A(this.index.values());for(c=d.next();!c.done;c=d.next())b.push(c.value.import(a));
return Promise.all(b)}break;case "tag":this.tag=db(b,this.tag);break;case "doc":this.store=bb(b,this.store)}}};Ra(pb.prototype);function Rb(a,b,c){var d=(b?""+a:"object"===typeof a?""+a.query:a).toLowerCase();this.cache||(this.cache=new Pb);var e=this.cache.get(d);if(!e){e=this.search(a,b,c);if(e.then){var f=this;e.then(function(g){f.cache.set(d,g);return g})}this.cache.set(d,e)}return e}function Pb(a){this.limit=a&&!0!==a?a:1E3;this.cache=new Map;this.h=""}Pb.prototype.set=function(a,b){this.cache.set(this.h=a,b);this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};
Pb.prototype.get=function(a){var b=this.cache.get(a);b&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,b));return b};Pb.prototype.remove=function(a){for(var b=A(this.cache),c=b.next();!c.done;c=b.next()){c=c.value;var d=c[0];c[1].includes(a)&&this.cache.delete(d)}};Pb.prototype.clear=function(){this.cache.clear();this.h=""};W.prototype.remove=function(a,b){var c=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(c){if(this.fastupdate)for(var d=0,e;d<c.length;d++){if(e=c[d])if(2>e.length)e.pop();else{var f=e.indexOf(a);f===c.length-1?e.pop():e.splice(f,1)}}else Sb(this.map,a),this.depth&&Sb(this.ctx,a);b||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.ca&&Tb(this));this.cache&&this.cache.remove(a);return this};
function Sb(a,b){var c=0,d="undefined"===typeof b;if(a.constructor===Array)for(var e=0,f=void 0,g;e<a.length;e++){if((f=a[e])&&f.length)if(d)c++;else if(g=f.indexOf(b),0<=g){1<f.length?(f.splice(g,1),c++):delete a[e];break}else c++}else for(d=A(a.entries()),e=d.next();!e.done;e=d.next())f=e.value,e=f[0],(f=Sb(f[1],b))?c+=f:a.delete(e);return c};var Ub={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};W.prototype.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.reg.has(a))return this.update(a,b);d=this.depth;b=this.encoder.encode(b,!d);var e=b.length;if(e){for(var f=S(),g=S(),h=this.resolution,k=0;k<e;k++){var l=b[this.rtl?e-1-k:k],m=l.length;if(m&&(d||!g[l])){var q=this.score?this.score(b,l,k,null,0):Vb(h,e,k),p="";switch(this.tokenize){case "full":if(2<m){q=0;for(var n;q<m;q++)for(var r=m;r>q;r--)p=l.substring(q,r),n=this.rtl?m-1-q:q,n=this.score?this.score(b,l,k,p,n):Vb(h,e,k,m,n),Wb(this,
Pb.prototype.get=function(a){var b=this.cache.get(a);b&&this.h!==a&&(this.cache.delete(a),this.cache.set(this.h=a,b));return b};Pb.prototype.remove=function(a){for(var b=A(this.cache),c=b.next();!c.done;c=b.next()){c=c.value;var d=c[0];c[1].includes(a)&&this.cache.delete(d)}};Pb.prototype.clear=function(){this.cache.clear();this.h=""};W.prototype.remove=function(a,b){var c=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(c){if(this.fastupdate)for(var d=0,e=void 0,f=void 0;d<c.length;d++){if((e=c[d])&&(f=e.length))if(e[f-1]===a)e.pop();else{var g=e.indexOf(a);0<=g&&e.splice(g,1)}}else Sb(this.map,a),this.depth&&Sb(this.ctx,a);b||this.reg.delete(a)}this.db&&(this.commit_task.push({del:a}),this.ca&&Tb(this));this.cache&&this.cache.remove(a);return this};
function Sb(a,b){var c=0,d="undefined"===typeof b;if(a.constructor===Array)for(var e=0,f=void 0,g;e<a.length;e++){if((f=a[e])&&f.length)if(d)c++;else if(g=f.indexOf(b),0<=g)if(1<f.length){f.splice(g,1);c++;break}else delete a[e];else c++}else for(d=A(a.entries()),e=d.next();!e.done;e=d.next())e=e.value,f=e[0],Sb(e[1],b)?c++:a.delete(f);return c};var Ub={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};W.prototype.add=function(a,b,c,d){if(b&&(a||0===a)){if(!d&&!c&&this.reg.has(a))return this.update(a,b);d=this.depth;b=this.encoder.encode(b,!d);var e=b.length;if(e){for(var f=S(),g=S(),h=this.resolution,k=0;k<e;k++){var l=b[this.rtl?e-1-k:k],m=l.length;if(m&&(d||!g[l])){var q=this.score?this.score(b,l,k,null,0):Vb(h,e,k),p="";switch(this.tokenize){case "full":if(2<m){q=0;for(var n;q<m;q++)for(var r=m;r>q;r--)p=l.substring(q,r),n=this.rtl?m-1-q:q,n=this.score?this.score(b,l,k,p,n):Vb(h,e,k,m,n),Wb(this,
g,p,n,a,c);break}case "bidirectional":case "reverse":if(1<m){for(r=m-1;0<r;r--)p=l[this.rtl?m-1-r:r]+p,n=this.score?this.score(b,l,k,p,r):Vb(h,e,k,m,r),Wb(this,g,p,n,a,c);p=""}case "forward":if(1<m){for(r=0;r<m;r++)p+=l[this.rtl?m-1-r:r],Wb(this,g,p,q,a,c);break}default:if(Wb(this,g,l,q,a,c),d&&1<e&&k<e-1)for(m=S(),p=this.da,q=l,r=Math.min(d+1,this.rtl?k+1:e-k),n=m[q]=1;n<r;n++)if((l=b[this.rtl?e-1-k-n:k+n])&&!m[l]){m[l]=1;var u=this.score?this.score(b,q,k,l,n-1):Vb(p+(e/2>p?0:1),e,k,r-1,n-1),w=this.bidirectional&&
l>q;Wb(this,f,w?q:l,u,a,c,w?l:q)}}}}this.fastupdate||this.reg.add(a)}else b=""}this.db&&(b||this.commit_task.push({del:a}),this.ca&&Tb(this));return this};
function Wb(a,b,c,d,e,f,g){var h=g?a.ctx:a.map,k;if(!b[c]||g&&!(k=b[c])[g])if(g?(b=k||(b[c]=S()),b[g]=1,(k=h.get(g))?h=k:h.set(g,h=new Map)):b[c]=1,(k=h.get(c))?h=k:h.set(c,h=k=[]),h=h[d]||(h[d]=[]),!f||!h.includes(e)){if(h.length===Math.pow(2,31)-1){b=new jb(h);if(a.fastupdate)for(c=A(a.reg.values()),f=c.next();!f.done;f=c.next())f=f.value,f.includes(h)&&(f[f.indexOf(h)]=b);k[d]=h=b}h.push(e);a.fastupdate&&((d=a.reg.get(e))?d.push(h):a.reg.set(e,[h]))}}

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.166 (Light/Debug)
* FlexSearch.js v0.8.167 (Light/Debug)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -8,11 +8,11 @@
(function(self){'use strict';
var r;
function u(a, c, b) {
const e = typeof b, d = typeof a;
if ("undefined" !== e) {
const f = typeof b, d = typeof a;
if ("undefined" !== f) {
if ("undefined" !== d) {
if (b) {
if ("function" === d && e === d) {
if ("function" === d && f === d) {
return function(k) {
return a(b(k));
};
@@ -24,17 +24,17 @@ function u(a, c, b) {
}
if (c === Map) {
var g = new Map(b);
for (var f of a) {
g.set(f[0], f[1]);
for (var e of a) {
g.set(e[0], e[1]);
}
return g;
}
if (c === Set) {
f = new Set(b);
e = new Set(b);
for (g of a.values()) {
f.add(g);
e.add(g);
}
return f;
return e;
}
}
}
@@ -63,14 +63,14 @@ function F(a = {}) {
r = F.prototype;
r.assign = function(a) {
this.normalize = u(a.normalize, !0, this.normalize);
let c = a.include, b = c || a.exclude || a.split, e;
let c = a.include, b = c || a.exclude || a.split, f;
if (b || "" === b) {
if ("object" === typeof b && b.constructor !== RegExp) {
let d = "";
e = !c;
f = !c;
c || (d += "\\p{Z}");
b.letter && (d += "\\p{L}");
b.number && (d += "\\p{N}", e = !!c);
b.number && (d += "\\p{N}", f = !!c);
b.symbol && (d += "\\p{S}");
b.punctuation && (d += "\\p{P}");
b.control && (d += "\\p{C}");
@@ -83,9 +83,9 @@ r.assign = function(a) {
console.error("Your split configuration:", b, "is not supported on this platform. It falls back to using simple whitespace splitter instead: /s+/."), this.split = /\s+/;
}
} else {
this.split = b, e = !1 === b || 2 > "a1a".split(b).length;
this.split = b, f = !1 === b || 2 > "a1a".split(b).length;
}
this.numeric = u(a.numeric, e);
this.numeric = u(a.numeric, f);
} else {
try {
this.split = u(this.split, A);
@@ -187,7 +187,7 @@ r.encode = function(a, c) {
this.prepare && (a = this.prepare(a));
this.numeric && 3 < a.length && (a = a.replace(C, "$1 $2").replace(D, "$1 $2").replace(B, "$1 "));
const b = !(this.dedupe || this.mapper || this.filter || this.matcher || this.stemmer || this.replacer);
let e = [], d = x(), g, f, k = this.split || "" === this.split ? a.split(this.split) : [a];
let f = [], d = x(), g, e, k = this.split || "" === this.split ? a.split(this.split) : [a];
for (let n = 0, h, w; n < k.length; n++) {
if ((h = w = k[n]) && !(h.length < this.minlength || h.length > this.maxlength)) {
if (c) {
@@ -202,14 +202,14 @@ r.encode = function(a, c) {
g = h;
}
if (b) {
e.push(h);
f.push(h);
} else {
if (!this.filter || ("function" === typeof this.filter ? this.filter(h) : !this.filter.has(h))) {
if (this.cache && h.length <= this.o) {
if (this.l) {
var l = this.j.get(h);
if (l || "" === l) {
l && e.push(l);
l && f.push(l);
continue;
}
} else {
@@ -245,21 +245,21 @@ r.encode = function(a, c) {
}
d[h] = 1;
} else {
if (f === h) {
if (e === h) {
continue;
}
f = h;
e = h;
}
}
e.push(h);
f.push(h);
}
}
}
}
}
this.finalize && (e = this.finalize(e) || e);
this.cache && a.length <= this.m && (this.i.set(a, e), this.i.size > this.A && (this.i.clear(), this.m = this.m / 1.1 | 0));
return e;
this.finalize && (f = this.finalize(f) || f);
this.cache && a.length <= this.m && (this.i.set(a, f), this.i.size > this.A && (this.i.clear(), this.m = this.m / 1.1 | 0));
return f;
};
function G(a) {
a.l = null;
@@ -273,41 +273,41 @@ function G(a) {
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, g, f; d < a.length; d++) {
if ((g = a[d]) && (f = g.length)) {
let f = [];
for (let d = 0, g, e; d < a.length; d++) {
if ((g = a[d]) && (e = g.length)) {
if (b) {
if (b >= f) {
b -= f;
if (b >= e) {
b -= e;
continue;
}
b < f && (g = c ? g.slice(b, b + c) : g.slice(b), f = g.length, b = 0);
b < e && (g = c ? g.slice(b, b + c) : g.slice(b), e = g.length, b = 0);
}
f > c && (g = g.slice(0, c), f = c);
if (!e.length && f >= c) {
e > c && (g = g.slice(0, c), e = c);
if (!f.length && e >= c) {
return g;
}
e.push(g);
c -= f;
f.push(g);
c -= e;
if (!c) {
break;
}
}
}
return e = 1 < e.length ? [].concat.apply([], e) : e[0];
return f = 1 < f.length ? [].concat.apply([], f) : f[0];
}
;x();
I.prototype.remove = function(a, c) {
const b = this.reg.size && (this.fastupdate ? this.reg.get(a) : this.reg.has(a));
if (b) {
if (this.fastupdate) {
for (let e = 0, d; e < b.length; e++) {
if (d = b[e]) {
if (2 > d.length) {
for (let f = 0, d, g; f < b.length; f++) {
if ((d = b[f]) && (g = d.length)) {
if (d[g - 1] === a) {
d.pop();
} else {
const g = d.indexOf(a);
g === b.length - 1 ? d.pop() : d.splice(g, 1);
const e = d.indexOf(a);
0 <= e && d.splice(e, 1);
}
}
}
@@ -320,16 +320,21 @@ I.prototype.remove = function(a, c) {
};
function J(a, c) {
let b = 0;
var e = "undefined" === typeof c;
var f = "undefined" === typeof c;
if (a.constructor === Array) {
for (let d = 0, g, f; d < a.length; d++) {
for (let d = 0, g, e; d < a.length; d++) {
if ((g = a[d]) && g.length) {
if (e) {
if (f) {
b++;
} else {
if (f = g.indexOf(c), 0 <= f) {
1 < g.length ? (g.splice(f, 1), b++) : delete a[d];
if (e = g.indexOf(c), 0 <= e) {
if (1 < g.length) {
g.splice(e, 1);
b++;
break;
} else {
delete a[d];
}
} else {
b++;
}
@@ -338,38 +343,36 @@ function J(a, c) {
}
} else {
for (let d of a.entries()) {
e = d[0];
const g = J(d[1], c);
g ? b += g : a.delete(e);
f = d[0], J(d[1], c) ? b++ : a.delete(f);
}
}
return b;
}
;const K = {memory:{resolution:1}, performance:{resolution:3, fastupdate:!0, context:{depth:1, resolution:1}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:3}}};
I.prototype.add = function(a, c, b, e) {
I.prototype.add = function(a, c, b, f) {
if (c && (a || 0 === a)) {
if (!e && !b && this.reg.has(a)) {
if (!f && !b && this.reg.has(a)) {
return this.update(a, c);
}
e = this.depth;
c = this.encoder.encode(c, !e);
f = this.depth;
c = this.encoder.encode(c, !f);
const n = c.length;
if (n) {
const h = x(), w = x(), v = this.resolution;
for (let p = 0; p < n; p++) {
let m = c[this.rtl ? n - 1 - p : p];
var d = m.length;
if (d && (e || !w[m])) {
var g = this.score ? this.score(c, m, p, null, 0) : L(v, n, p), f = "";
if (d && (f || !w[m])) {
var g = this.score ? this.score(c, m, p, null, 0) : L(v, n, p), e = "";
switch(this.tokenize) {
case "full":
if (2 < d) {
for (let q = 0, t; q < d; q++) {
for (g = d; g > q; g--) {
f = m.substring(q, g);
e = m.substring(q, g);
t = this.rtl ? d - 1 - q : q;
var k = this.score ? this.score(c, m, p, f, t) : L(v, n, p, d, t);
M(this, w, f, k, a, b);
var k = this.score ? this.score(c, m, p, e, t) : L(v, n, p, d, t);
M(this, w, e, k, a, b);
}
}
break;
@@ -378,25 +381,25 @@ I.prototype.add = function(a, c, b, e) {
case "reverse":
if (1 < d) {
for (k = d - 1; 0 < k; k--) {
f = m[this.rtl ? d - 1 - k : k] + f;
var l = this.score ? this.score(c, m, p, f, k) : L(v, n, p, d, k);
M(this, w, f, l, a, b);
e = m[this.rtl ? d - 1 - k : k] + e;
var l = this.score ? this.score(c, m, p, e, k) : L(v, n, p, d, k);
M(this, w, e, l, a, b);
}
f = "";
e = "";
}
case "forward":
if (1 < d) {
for (k = 0; k < d; k++) {
f += m[this.rtl ? d - 1 - k : k], M(this, w, f, g, a, b);
e += m[this.rtl ? d - 1 - k : k], M(this, w, e, g, a, b);
}
break;
}
default:
if (M(this, w, m, g, a, b), e && 1 < n && p < n - 1) {
for (d = x(), f = this.v, g = m, k = Math.min(e + 1, this.rtl ? p + 1 : n - p), d[g] = 1, l = 1; l < k; l++) {
if (M(this, w, m, g, a, b), f && 1 < n && p < n - 1) {
for (d = x(), e = this.v, g = m, k = Math.min(f + 1, this.rtl ? p + 1 : n - p), d[g] = 1, l = 1; l < k; l++) {
if ((m = c[this.rtl ? n - 1 - p - l : p + l]) && !d[m]) {
d[m] = 1;
const q = this.score ? this.score(c, g, p, m, l - 1) : L(f + (n / 2 > f ? 0 : 1), n, p, k - 1, l - 1), t = this.bidirectional && m > g;
const q = this.score ? this.score(c, g, p, m, l - 1) : L(e + (n / 2 > e ? 0 : 1), n, p, k - 1, l - 1), t = this.bidirectional && m > g;
M(this, h, t ? g : m, q, a, b, t ? m : g);
}
}
@@ -409,24 +412,24 @@ I.prototype.add = function(a, c, b, e) {
}
return this;
};
function M(a, c, b, e, d, g, f) {
let k = f ? a.ctx : a.map, l;
if (!c[b] || f && !(l = c[b])[f]) {
f ? (c = l || (c[b] = x()), c[f] = 1, (l = k.get(f)) ? k = l : k.set(f, k = new Map())) : c[b] = 1, (l = k.get(b)) ? k = l : k.set(b, k = []), k = k[e] || (k[e] = []), g && k.includes(d) || (k.push(d), a.fastupdate && ((c = a.reg.get(d)) ? c.push(k) : a.reg.set(d, [k])));
function M(a, c, b, f, d, g, e) {
let k = e ? a.ctx : a.map, l;
if (!c[b] || e && !(l = c[b])[e]) {
e ? (c = l || (c[b] = x()), c[e] = 1, (l = k.get(e)) ? k = l : k.set(e, k = new Map())) : c[b] = 1, (l = k.get(b)) ? k = l : k.set(b, k = []), k = k[f] || (k[f] = []), g && k.includes(d) || (k.push(d), a.fastupdate && ((c = a.reg.get(d)) ? c.push(k) : a.reg.set(d, [k])));
}
}
function L(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 L(a, c, b, f, d) {
return b && 1 < a ? c + (f || 0) <= a ? b + (d || 0) : (a - 1) / (c + (f || 0)) * (b + (d || 0)) + 1 | 0 : 0;
}
;I.prototype.search = function(a, c, b) {
b || (c || "object" !== typeof a ? "object" === typeof c && (b = c, c = 0) : (b = a, a = ""));
var e = [], d = 0;
var f = [], d = 0;
if (b) {
a = b.query || a;
c = b.limit || c;
d = b.offset || 0;
var g = b.context;
var f = b.suggest;
var e = b.suggest;
var k = !0;
var l = b.resolution;
}
@@ -436,10 +439,10 @@ function L(a, c, b, e, d) {
b = a.length;
c = c || (k ? 100 : 0);
if (1 === b) {
return f = d, (d = N(this, a[0], "")) && d.length ? H.call(this, d, c, f) : [];
return e = d, (d = N(this, a[0], "")) && d.length ? H.call(this, d, c, e) : [];
}
if (2 === b && g && !f) {
return f = d, (d = N(this, a[1], a[0])) && d.length ? H.call(this, d, c, f) : [];
if (2 === b && g && !e) {
return e = d, (d = N(this, a[1], a[0])) && d.length ? H.call(this, d, c, e) : [];
}
k = x();
var n = 0;
@@ -454,7 +457,7 @@ function L(a, c, b, e, d) {
m = N(this, q, h);
a: {
g = m;
var w = e, v = f, p = l;
var w = f, v = e, p = l;
let t = [];
if (g && g.length) {
if (g.length <= p) {
@@ -476,28 +479,28 @@ function L(a, c, b, e, d) {
m = v ? void 0 : t;
}
if (m) {
e = m;
f = m;
break;
}
h && (f && m && e.length || (h = q));
h && (e && m && f.length || (h = q));
}
f && h && n === b - 1 && !e.length && (l = this.resolution, h = "", n = -1, k = x());
e && h && n === b - 1 && !f.length && (l = this.resolution, h = "", n = -1, k = x());
}
a: {
a = e;
e = a.length;
a = f;
f = a.length;
h = a;
if (1 < e) {
if (1 < f) {
b: {
e = f;
f = e;
h = a.length;
f = [];
e = [];
b = x();
for (let m = 0, q, t, y, z; m < l; m++) {
for (n = 0; n < h; n++) {
if (y = a[n], m < y.length && (q = y[m])) {
for (g = 0; g < q.length; g++) {
if (t = q[g], (k = b[t]) ? b[t]++ : (k = 0, b[t] = 1), z = f[k] || (f[k] = []), z.push(t), c && k === h - 1 && z.length - d === c) {
if (t = q[g], (k = b[t]) ? b[t]++ : (k = 0, b[t] = 1), z = e[k] || (e[k] = []), z.push(t), c && k === h - 1 && z.length - d === c) {
h = d ? z.slice(d) : z;
break b;
}
@@ -505,14 +508,14 @@ function L(a, c, b, e, d) {
}
}
}
if (a = f.length) {
if (e) {
if (1 < f.length) {
if (a = e.length) {
if (f) {
if (1 < e.length) {
c: {
for (a = [], l = x(), e = f.length, k = e - 1; 0 <= k; k--) {
if (b = (e = f[k]) && e.length) {
for (a = [], l = x(), f = e.length, k = f - 1; 0 <= k; k--) {
if (b = (f = e[k]) && f.length) {
for (n = 0; n < b; n++) {
if (h = e[n], !l[h]) {
if (h = f[n], !l[h]) {
if (l[h] = 1, d) {
d--;
} else {
@@ -526,25 +529,25 @@ function L(a, c, b, e, d) {
}
}
} else {
a = (f = f[0]).length > c || d ? f.slice(d, c + d) : f;
a = (e = e[0]).length > c || d ? e.slice(d, c + d) : e;
}
f = a;
e = a;
} else {
if (a < h) {
h = [];
break b;
}
f = f[a - 1];
e = e[a - 1];
if (c || d) {
if (f.length > c || d) {
f = f.slice(d, c + d);
if (e.length > c || d) {
e = e.slice(d, c + d);
}
}
}
}
h = f;
h = e;
}
} else if (1 === e) {
} else if (1 === f) {
c = H.call(null, a[0], c, d);
break a;
}
@@ -553,8 +556,8 @@ function L(a, c, b, e, d) {
return c;
};
function N(a, c, b) {
let e;
b && (e = a.bidirectional && c > b) && (e = b, b = c, c = e);
let f;
b && (f = a.bidirectional && c > b) && (f = b, b = c, c = f);
a = b ? (a = a.ctx.get(b)) && a.get(c) : a.map.get(c);
return a;
}
@@ -569,19 +572,19 @@ function N(a, c, b) {
a = {};
}
b = a.context;
const e = !0 === b ? {depth:1} : b || {}, d = a.encode || a.encoder || {};
const f = !0 === b ? {depth:1} : b || {}, d = a.encode || a.encoder || {};
this.encoder = d.encode ? d : "object" === typeof d ? new F(d) : {encode:d};
this.resolution = a.resolution || 9;
this.tokenize = b = (b = a.tokenize) && "default" !== b && "exact" !== b && b || "strict";
this.depth = "strict" === b && e.depth || 0;
this.bidirectional = !1 !== e.bidirectional;
this.depth = "strict" === b && f.depth || 0;
this.bidirectional = !1 !== f.bidirectional;
this.fastupdate = !!a.fastupdate;
this.score = a.score || null;
e && e.depth && "strict" !== this.tokenize && console.warn('Context-Search could not applied, because it is just supported when using the tokenizer "strict".');
f && f.depth && "strict" !== this.tokenize && console.warn('Context-Search could not applied, because it is just supported when using the tokenizer "strict".');
this.map = new Map();
this.ctx = new Map();
this.reg = c || (this.fastupdate ? new Map() : new Set());
this.v = e.resolution || 3;
this.v = f.resolution || 3;
this.rtl = d.rtl || a.rtl || !1;
}
r = I.prototype;
@@ -598,8 +601,8 @@ r.contain = function(a) {
return this.reg.has(a);
};
r.update = function(a, c) {
const b = this, e = this.remove(a);
return e && e.then ? e.then(() => b.add(a, c)) : this.add(a, c);
const b = this, f = this.remove(a);
return f && f.then ? f.then(() => b.add(a, c)) : this.add(a, c);
};
r.cleanup = function() {
if (!this.fastupdate) {

View File

@@ -1,26 +1,26 @@
/**!
* FlexSearch.js v0.8.166 (Light)
* FlexSearch.js v0.8.167 (Light)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
(function(self){'use strict';var r;function u(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(k){return a(b(k))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var g=new Map(b);for(var f of a)g.set(f[0],f[1]);return g}if(c===Set){f=new Set(b);for(g of a.values())f.add(g);return f}}}return a}return b}return"undefined"===d?c:a}function x(){return Object.create(null)};const A=/[^\p{L}\p{N}]+/u,B=/(\d{3})/g,C=/(\D)(\d{3})/g,D=/(\d{3})(\D)/g,E=/[\u0300-\u036f]/g;function F(a={}){if(!this||this.constructor!==F)return new F(...arguments);if(arguments.length)for(a=0;a<arguments.length;a++)this.assign(arguments[a]);else this.assign(a)}r=F.prototype;
r.assign=function(a){this.normalize=u(a.normalize,!0,this.normalize);let c=a.include,b=c||a.exclude||a.split,e;if(b||""===b){if("object"===typeof b&&b.constructor!==RegExp){let d="";e=!c;c||(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;try{this.split=new RegExp("["+(c?"^":"")+d+"]+","u")}catch(g){this.split=/\s+/}}else this.split=b,e=!1===b||2>"a1a".split(b).length;
this.numeric=u(a.numeric,e)}else{try{this.split=u(this.split,A)}catch(d){this.split=/\s+/}this.numeric=u(a.numeric,u(this.numeric,!0))}this.prepare=u(a.prepare,null,this.prepare);this.finalize=u(a.finalize,null,this.finalize);b=a.filter;this.filter="function"===typeof b?b:u(b&&new Set(b),null,this.filter);this.dedupe=u(a.dedupe,!0,this.dedupe);this.matcher=u((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=u((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=u((b=a.stemmer)&&new Map(b),
(function(self){'use strict';var r;function u(a,c,b){const f=typeof b,d=typeof a;if("undefined"!==f){if("undefined"!==d){if(b){if("function"===d&&f===d)return function(k){return a(b(k))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var g=new Map(b);for(var e of a)g.set(e[0],e[1]);return g}if(c===Set){e=new Set(b);for(g of a.values())e.add(g);return e}}}return a}return b}return"undefined"===d?c:a}function x(){return Object.create(null)};const A=/[^\p{L}\p{N}]+/u,B=/(\d{3})/g,C=/(\D)(\d{3})/g,D=/(\d{3})(\D)/g,E=/[\u0300-\u036f]/g;function F(a={}){if(!this||this.constructor!==F)return new F(...arguments);if(arguments.length)for(a=0;a<arguments.length;a++)this.assign(arguments[a]);else this.assign(a)}r=F.prototype;
r.assign=function(a){this.normalize=u(a.normalize,!0,this.normalize);let c=a.include,b=c||a.exclude||a.split,f;if(b||""===b){if("object"===typeof b&&b.constructor!==RegExp){let d="";f=!c;c||(d+="\\p{Z}");b.letter&&(d+="\\p{L}");b.number&&(d+="\\p{N}",f=!!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;try{this.split=new RegExp("["+(c?"^":"")+d+"]+","u")}catch(g){this.split=/\s+/}}else this.split=b,f=!1===b||2>"a1a".split(b).length;
this.numeric=u(a.numeric,f)}else{try{this.split=u(this.split,A)}catch(d){this.split=/\s+/}this.numeric=u(a.numeric,u(this.numeric,!0))}this.prepare=u(a.prepare,null,this.prepare);this.finalize=u(a.finalize,null,this.finalize);b=a.filter;this.filter="function"===typeof b?b:u(b&&new Set(b),null,this.filter);this.dedupe=u(a.dedupe,!0,this.dedupe);this.matcher=u((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=u((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=u((b=a.stemmer)&&new Map(b),
null,this.stemmer);this.replacer=u(a.replacer,null,this.replacer);this.minlength=u(a.minlength,1,this.minlength);this.maxlength=u(a.maxlength,1024,this.maxlength);this.rtl=u(a.rtl,!1,this.rtl);if(this.cache=b=u(a.cache,!0,this.cache))this.l=null,this.A="number"===typeof b?b:2E5,this.i=new Map,this.j=new Map,this.o=this.m=128;this.g="";this.s=null;this.h="";this.u=null;if(this.matcher)for(const d of this.matcher.keys())this.g+=(this.g?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.h+=
(this.h?"|":"")+d;return this};r.addStemmer=function(a,c){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,c);this.h+=(this.h?"|":"")+a;this.u=null;this.cache&&G(this);return this};r.addFilter=function(a){"function"===typeof a?this.filter=a:(this.filter||(this.filter=new Set),this.filter.add(a));this.cache&&G(this);return this};
r.addMapper=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(1<a.length)return this.addMatcher(a,c);this.mapper||(this.mapper=new Map);this.mapper.set(a,c);this.cache&&G(this);return this};r.addMatcher=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(2>a.length&&(this.dedupe||this.mapper))return this.addMapper(a,c);this.matcher||(this.matcher=new Map);this.matcher.set(a,c);this.g+=(this.g?"|":"")+a;this.s=null;this.cache&&G(this);return this};
r.addReplacer=function(a,c){if("string"===typeof a)return this.addMatcher(a,c);this.replacer||(this.replacer=[]);this.replacer.push(a,c);this.cache&&G(this);return this};
r.encode=function(a,c){if(this.cache&&a.length<=this.m)if(this.l){if(this.i.has(a))return this.i.get(a)}else this.l=setTimeout(G,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=E?a.normalize("NFKD").replace(E,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3<a.length&&(a=a.replace(C,"$1 $2").replace(D,"$1 $2").replace(B,"$1 "));const b=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let e=[],
d=x(),g,f,k=this.split||""===this.split?a.split(this.split):[a];for(let n=0,h,w;n<k.length;n++)if((h=w=k[n])&&!(h.length<this.minlength||h.length>this.maxlength)){if(c){if(d[h])continue;d[h]=1}else{if(g===h)continue;g=h}if(b)e.push(h);else if(!this.filter||("function"===typeof this.filter?this.filter(h):!this.filter.has(h))){if(this.cache&&h.length<=this.o)if(this.l){var l=this.j.get(h);if(l||""===l){l&&e.push(l);continue}}else this.l=setTimeout(G,50,this);if(this.stemmer){this.u||(this.u=new RegExp("(?!^)("+
r.encode=function(a,c){if(this.cache&&a.length<=this.m)if(this.l){if(this.i.has(a))return this.i.get(a)}else this.l=setTimeout(G,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=E?a.normalize("NFKD").replace(E,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3<a.length&&(a=a.replace(C,"$1 $2").replace(D,"$1 $2").replace(B,"$1 "));const b=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let f=[],
d=x(),g,e,k=this.split||""===this.split?a.split(this.split):[a];for(let n=0,h,w;n<k.length;n++)if((h=w=k[n])&&!(h.length<this.minlength||h.length>this.maxlength)){if(c){if(d[h])continue;d[h]=1}else{if(g===h)continue;g=h}if(b)f.push(h);else if(!this.filter||("function"===typeof this.filter?this.filter(h):!this.filter.has(h))){if(this.cache&&h.length<=this.o)if(this.l){var l=this.j.get(h);if(l||""===l){l&&f.push(l);continue}}else this.l=setTimeout(G,50,this);if(this.stemmer){this.u||(this.u=new RegExp("(?!^)("+
this.h+")$"));let v;for(;v!==h&&2<h.length;)v=h,h=h.replace(this.u,p=>this.stemmer.get(p))}if(h&&(this.mapper||this.dedupe&&1<h.length)){l="";for(let v=0,p="",m,q;v<h.length;v++)m=h.charAt(v),m===p&&this.dedupe||((q=this.mapper&&this.mapper.get(m))||""===q?q===p&&this.dedupe||!(p=q)||(l+=q):l+=p=m);h=l}this.matcher&&1<h.length&&(this.s||(this.s=new RegExp("("+this.g+")","g")),h=h.replace(this.s,v=>this.matcher.get(v)));if(h&&this.replacer)for(l=0;h&&l<this.replacer.length;l+=2)h=h.replace(this.replacer[l],
this.replacer[l+1]);this.cache&&w.length<=this.o&&(this.j.set(w,h),this.j.size>this.A&&(this.j.clear(),this.o=this.o/1.1|0));if(h){if(h!==w)if(c){if(d[h])continue;d[h]=1}else{if(f===h)continue;f=h}e.push(h)}}}this.finalize&&(e=this.finalize(e)||e);this.cache&&a.length<=this.m&&(this.i.set(a,e),this.i.size>this.A&&(this.i.clear(),this.m=this.m/1.1|0));return e};function G(a){a.l=null;a.i.clear();a.j.clear()};function H(a,c,b){if(!a.length)return a;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,g,f;d<a.length;d++)if((g=a[d])&&(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)}f>c&&(g=g.slice(0,c),f=c);if(!e.length&&f>=c)return g;e.push(g);c-=f;if(!c)break}return e=1<e.length?[].concat.apply([],e):e[0]};x();I.prototype.remove=function(a,c){const b=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.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 g=d.indexOf(a);g===b.length-1?d.pop():d.splice(g,1)}}else J(this.map,a),this.depth&&J(this.ctx,a);c||this.reg.delete(a)}return this};
function J(a,c){let b=0;var e="undefined"===typeof c;if(a.constructor===Array)for(let d=0,g,f;d<a.length;d++){if((g=a[d])&&g.length)if(e)b++;else if(f=g.indexOf(c),0<=f){1<g.length?(g.splice(f,1),b++):delete a[d];break}else b++}else for(let d of a.entries()){e=d[0];const g=J(d[1],c);g?b+=g:a.delete(e)}return b};const K={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};I.prototype.add=function(a,c,b,e){if(c&&(a||0===a)){if(!e&&!b&&this.reg.has(a))return this.update(a,c);e=this.depth;c=this.encoder.encode(c,!e);const n=c.length;if(n){const h=x(),w=x(),v=this.resolution;for(let p=0;p<n;p++){let m=c[this.rtl?n-1-p:p];var d=m.length;if(d&&(e||!w[m])){var g=this.score?this.score(c,m,p,null,0):L(v,n,p),f="";switch(this.tokenize){case "full":if(2<d){for(let q=0,t;q<d;q++)for(g=d;g>q;g--){f=m.substring(q,g);t=this.rtl?d-1-q:q;var k=this.score?this.score(c,m,p,f,t):L(v,
n,p,d,t);M(this,w,f,k,a,b)}break}case "bidirectional":case "reverse":if(1<d){for(k=d-1;0<k;k--){f=m[this.rtl?d-1-k:k]+f;var l=this.score?this.score(c,m,p,f,k):L(v,n,p,d,k);M(this,w,f,l,a,b)}f=""}case "forward":if(1<d){for(k=0;k<d;k++)f+=m[this.rtl?d-1-k:k],M(this,w,f,g,a,b);break}default:if(M(this,w,m,g,a,b),e&&1<n&&p<n-1)for(d=x(),f=this.v,g=m,k=Math.min(e+1,this.rtl?p+1:n-p),d[g]=1,l=1;l<k;l++)if((m=c[this.rtl?n-1-p-l:p+l])&&!d[m]){d[m]=1;const q=this.score?this.score(c,g,p,m,l-1):L(f+(n/2>f?0:
1),n,p,k-1,l-1),t=this.bidirectional&&m>g;M(this,h,t?g:m,q,a,b,t?m:g)}}}}this.fastupdate||this.reg.add(a)}}return this};function M(a,c,b,e,d,g,f){let k=f?a.ctx:a.map,l;if(!c[b]||f&&!(l=c[b])[f])f?(c=l||(c[b]=x()),c[f]=1,(l=k.get(f))?k=l:k.set(f,k=new Map)):c[b]=1,(l=k.get(b))?k=l:k.set(b,k=[]),k=k[e]||(k[e]=[]),g&&k.includes(d)||(k.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(k):a.reg.set(d,[k])))}function L(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};I.prototype.search=function(a,c,b){b||(c||"object"!==typeof a?"object"===typeof c&&(b=c,c=0):(b=a,a=""));var e=[],d=0;if(b){a=b.query||a;c=b.limit||c;d=b.offset||0;var g=b.context;var f=b.suggest;var k=!0;var l=b.resolution}"undefined"===typeof k&&(k=!0);g=this.depth&&!1!==g;a=this.encoder.encode(a,!g);b=a.length;c=c||(k?100:0);if(1===b)return f=d,(d=N(this,a[0],""))&&d.length?H.call(this,d,c,f):[];if(2===b&&g&&!f)return f=d,(d=N(this,a[1],a[0]))&&d.length?H.call(this,d,c,f):[];k=x();var n=0;if(g){var h=
a[0];n=1}l||0===l||(l=h?this.v:this.resolution);for(let m,q;n<b;n++){if((q=a[n])&&!k[q]){k[q]=1;m=N(this,q,h);a:{g=m;var w=e,v=f,p=l;let t=[];if(g&&g.length){if(g.length<=p){w.push(g);m=void 0;break a}for(let y=0,z;y<p;y++)if(z=g[y])t[y]=z;if(t.length){w.push(t);m=void 0;break a}}m=v?void 0:t}if(m){e=m;break}h&&(f&&m&&e.length||(h=q))}f&&h&&n===b-1&&!e.length&&(l=this.resolution,h="",n=-1,k=x())}a:{a=e;e=a.length;h=a;if(1<e)b:{e=f;h=a.length;f=[];b=x();for(let m=0,q,t,y,z;m<l;m++)for(n=0;n<h;n++)if(y=
a[n],m<y.length&&(q=y[m]))for(g=0;g<q.length;g++)if(t=q[g],(k=b[t])?b[t]++:(k=0,b[t]=1),z=f[k]||(f[k]=[]),z.push(t),c&&k===h-1&&z.length-d===c){h=d?z.slice(d):z;break b}if(a=f.length)if(e){if(1<f.length)c:for(a=[],l=x(),e=f.length,k=e-1;0<=k;k--){if(b=(e=f[k])&&e.length)for(n=0;n<b;n++)if(h=e[n],!l[h])if(l[h]=1,d)d--;else if(a.push(h),a.length===c)break c}else a=(f=f[0]).length>c||d?f.slice(d,c+d):f;f=a}else{if(a<h){h=[];break b}f=f[a-1];if(c||d)if(f.length>c||d)f=f.slice(d,c+d)}h=f}else if(1===e){c=
H.call(null,a[0],c,d);break a}c=h}return c};function N(a,c,b){let e;b&&(e=a.bidirectional&&c>b)&&(e=b,b=c,c=e);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};function I(a,c){if(!this||this.constructor!==I)return new I(a);if(a){var b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},K[b],a))}else a={};b=a.context;const e=!0===b?{depth:1}:b||{},d=a.encode||a.encoder||{};this.encoder=d.encode?d:"object"===typeof d?new F(d):{encode:d};this.resolution=a.resolution||9;this.tokenize=b=(b=a.tokenize)&&"default"!==b&&"exact"!==b&&b||"strict";this.depth="strict"===b&&e.depth||0;this.bidirectional=!1!==e.bidirectional;this.fastupdate=!!a.fastupdate;this.score=
a.score||null;this.map=new Map;this.ctx=new Map;this.reg=c||(this.fastupdate?new Map:new Set);this.v=e.resolution||3;this.rtl=d.rtl||a.rtl||!1}r=I.prototype;r.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();return this};r.append=function(a,c){return this.add(a,c,!0)};r.contain=function(a){return this.reg.has(a)};r.update=function(a,c){const b=this,e=this.remove(a);return e&&e.then?e.then(()=>b.add(a,c)):this.add(a,c)};
this.replacer[l+1]);this.cache&&w.length<=this.o&&(this.j.set(w,h),this.j.size>this.A&&(this.j.clear(),this.o=this.o/1.1|0));if(h){if(h!==w)if(c){if(d[h])continue;d[h]=1}else{if(e===h)continue;e=h}f.push(h)}}}this.finalize&&(f=this.finalize(f)||f);this.cache&&a.length<=this.m&&(this.i.set(a,f),this.i.size>this.A&&(this.i.clear(),this.m=this.m/1.1|0));return f};function G(a){a.l=null;a.i.clear();a.j.clear()};function H(a,c,b){if(!a.length)return a;if(1===a.length)return a=a[0],a=b||a.length>c?c?a.slice(b,b+c):a.slice(b):a;let f=[];for(let d=0,g,e;d<a.length;d++)if((g=a[d])&&(e=g.length)){if(b){if(b>=e){b-=e;continue}b<e&&(g=c?g.slice(b,b+c):g.slice(b),e=g.length,b=0)}e>c&&(g=g.slice(0,c),e=c);if(!f.length&&e>=c)return g;f.push(g);c-=e;if(!c)break}return f=1<f.length?[].concat.apply([],f):f[0]};x();I.prototype.remove=function(a,c){const b=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(b){if(this.fastupdate)for(let f=0,d,g;f<b.length;f++){if((d=b[f])&&(g=d.length))if(d[g-1]===a)d.pop();else{const e=d.indexOf(a);0<=e&&d.splice(e,1)}}else J(this.map,a),this.depth&&J(this.ctx,a);c||this.reg.delete(a)}return this};
function J(a,c){let b=0;var f="undefined"===typeof c;if(a.constructor===Array)for(let d=0,g,e;d<a.length;d++){if((g=a[d])&&g.length)if(f)b++;else if(e=g.indexOf(c),0<=e)if(1<g.length){g.splice(e,1);b++;break}else delete a[d];else b++}else for(let d of a.entries())f=d[0],J(d[1],c)?b++:a.delete(f);return b};const K={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};I.prototype.add=function(a,c,b,f){if(c&&(a||0===a)){if(!f&&!b&&this.reg.has(a))return this.update(a,c);f=this.depth;c=this.encoder.encode(c,!f);const n=c.length;if(n){const h=x(),w=x(),v=this.resolution;for(let p=0;p<n;p++){let m=c[this.rtl?n-1-p:p];var d=m.length;if(d&&(f||!w[m])){var g=this.score?this.score(c,m,p,null,0):L(v,n,p),e="";switch(this.tokenize){case "full":if(2<d){for(let q=0,t;q<d;q++)for(g=d;g>q;g--){e=m.substring(q,g);t=this.rtl?d-1-q:q;var k=this.score?this.score(c,m,p,e,t):L(v,
n,p,d,t);M(this,w,e,k,a,b)}break}case "bidirectional":case "reverse":if(1<d){for(k=d-1;0<k;k--){e=m[this.rtl?d-1-k:k]+e;var l=this.score?this.score(c,m,p,e,k):L(v,n,p,d,k);M(this,w,e,l,a,b)}e=""}case "forward":if(1<d){for(k=0;k<d;k++)e+=m[this.rtl?d-1-k:k],M(this,w,e,g,a,b);break}default:if(M(this,w,m,g,a,b),f&&1<n&&p<n-1)for(d=x(),e=this.v,g=m,k=Math.min(f+1,this.rtl?p+1:n-p),d[g]=1,l=1;l<k;l++)if((m=c[this.rtl?n-1-p-l:p+l])&&!d[m]){d[m]=1;const q=this.score?this.score(c,g,p,m,l-1):L(e+(n/2>e?0:
1),n,p,k-1,l-1),t=this.bidirectional&&m>g;M(this,h,t?g:m,q,a,b,t?m:g)}}}}this.fastupdate||this.reg.add(a)}}return this};function M(a,c,b,f,d,g,e){let k=e?a.ctx:a.map,l;if(!c[b]||e&&!(l=c[b])[e])e?(c=l||(c[b]=x()),c[e]=1,(l=k.get(e))?k=l:k.set(e,k=new Map)):c[b]=1,(l=k.get(b))?k=l:k.set(b,k=[]),k=k[f]||(k[f]=[]),g&&k.includes(d)||(k.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(k):a.reg.set(d,[k])))}function L(a,c,b,f,d){return b&&1<a?c+(f||0)<=a?b+(d||0):(a-1)/(c+(f||0))*(b+(d||0))+1|0:0};I.prototype.search=function(a,c,b){b||(c||"object"!==typeof a?"object"===typeof c&&(b=c,c=0):(b=a,a=""));var f=[],d=0;if(b){a=b.query||a;c=b.limit||c;d=b.offset||0;var g=b.context;var e=b.suggest;var k=!0;var l=b.resolution}"undefined"===typeof k&&(k=!0);g=this.depth&&!1!==g;a=this.encoder.encode(a,!g);b=a.length;c=c||(k?100:0);if(1===b)return e=d,(d=N(this,a[0],""))&&d.length?H.call(this,d,c,e):[];if(2===b&&g&&!e)return e=d,(d=N(this,a[1],a[0]))&&d.length?H.call(this,d,c,e):[];k=x();var n=0;if(g){var h=
a[0];n=1}l||0===l||(l=h?this.v:this.resolution);for(let m,q;n<b;n++){if((q=a[n])&&!k[q]){k[q]=1;m=N(this,q,h);a:{g=m;var w=f,v=e,p=l;let t=[];if(g&&g.length){if(g.length<=p){w.push(g);m=void 0;break a}for(let y=0,z;y<p;y++)if(z=g[y])t[y]=z;if(t.length){w.push(t);m=void 0;break a}}m=v?void 0:t}if(m){f=m;break}h&&(e&&m&&f.length||(h=q))}e&&h&&n===b-1&&!f.length&&(l=this.resolution,h="",n=-1,k=x())}a:{a=f;f=a.length;h=a;if(1<f)b:{f=e;h=a.length;e=[];b=x();for(let m=0,q,t,y,z;m<l;m++)for(n=0;n<h;n++)if(y=
a[n],m<y.length&&(q=y[m]))for(g=0;g<q.length;g++)if(t=q[g],(k=b[t])?b[t]++:(k=0,b[t]=1),z=e[k]||(e[k]=[]),z.push(t),c&&k===h-1&&z.length-d===c){h=d?z.slice(d):z;break b}if(a=e.length)if(f){if(1<e.length)c:for(a=[],l=x(),f=e.length,k=f-1;0<=k;k--){if(b=(f=e[k])&&f.length)for(n=0;n<b;n++)if(h=f[n],!l[h])if(l[h]=1,d)d--;else if(a.push(h),a.length===c)break c}else a=(e=e[0]).length>c||d?e.slice(d,c+d):e;e=a}else{if(a<h){h=[];break b}e=e[a-1];if(c||d)if(e.length>c||d)e=e.slice(d,c+d)}h=e}else if(1===f){c=
H.call(null,a[0],c,d);break a}c=h}return c};function N(a,c,b){let f;b&&(f=a.bidirectional&&c>b)&&(f=b,b=c,c=f);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};function I(a,c){if(!this||this.constructor!==I)return new I(a);if(a){var b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},K[b],a))}else a={};b=a.context;const f=!0===b?{depth:1}:b||{},d=a.encode||a.encoder||{};this.encoder=d.encode?d:"object"===typeof d?new F(d):{encode:d};this.resolution=a.resolution||9;this.tokenize=b=(b=a.tokenize)&&"default"!==b&&"exact"!==b&&b||"strict";this.depth="strict"===b&&f.depth||0;this.bidirectional=!1!==f.bidirectional;this.fastupdate=!!a.fastupdate;this.score=
a.score||null;this.map=new Map;this.ctx=new Map;this.reg=c||(this.fastupdate?new Map:new Set);this.v=f.resolution||3;this.rtl=d.rtl||a.rtl||!1}r=I.prototype;r.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();return this};r.append=function(a,c){return this.add(a,c,!0)};r.contain=function(a){return this.reg.has(a)};r.update=function(a,c){const b=this,f=this.remove(a);return f&&f.then?f.then(()=>b.add(a,c)):this.add(a,c)};
r.cleanup=function(){if(!this.fastupdate)return this;J(this.map);this.depth&&J(this.ctx);return this};x();const O={Index:I,Charset:null,Encoder:F,Document:null,Worker:null,Resolver:null,IndexedDB:null,Language:{}},P="undefined"!==typeof self?self:"undefined"!==typeof global?global:self;let Q;(Q=P.define)&&Q.amd?Q([],function(){return O}):"object"===typeof P.exports?P.exports=O:P.FlexSearch=O;}(this||self));

View File

@@ -1,5 +1,5 @@
/**!
* FlexSearch.js v0.8.166 (Bundle/Debug)
* FlexSearch.js v0.8.167 (Bundle/Debug)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
@@ -7,11 +7,11 @@
*/
var r;
function u(a, c, b) {
const e = typeof b, d = typeof a;
if ("undefined" !== e) {
const f = typeof b, d = typeof a;
if ("undefined" !== f) {
if ("undefined" !== d) {
if (b) {
if ("function" === d && e === d) {
if ("function" === d && f === d) {
return function(k) {
return a(b(k));
};
@@ -23,17 +23,17 @@ function u(a, c, b) {
}
if (c === Map) {
var g = new Map(b);
for (var f of a) {
g.set(f[0], f[1]);
for (var e of a) {
g.set(e[0], e[1]);
}
return g;
}
if (c === Set) {
f = new Set(b);
e = new Set(b);
for (g of a.values()) {
f.add(g);
e.add(g);
}
return f;
return e;
}
}
}
@@ -62,14 +62,14 @@ function F(a = {}) {
r = F.prototype;
r.assign = function(a) {
this.normalize = u(a.normalize, !0, this.normalize);
let c = a.include, b = c || a.exclude || a.split, e;
let c = a.include, b = c || a.exclude || a.split, f;
if (b || "" === b) {
if ("object" === typeof b && b.constructor !== RegExp) {
let d = "";
e = !c;
f = !c;
c || (d += "\\p{Z}");
b.letter && (d += "\\p{L}");
b.number && (d += "\\p{N}", e = !!c);
b.number && (d += "\\p{N}", f = !!c);
b.symbol && (d += "\\p{S}");
b.punctuation && (d += "\\p{P}");
b.control && (d += "\\p{C}");
@@ -82,9 +82,9 @@ r.assign = function(a) {
console.error("Your split configuration:", b, "is not supported on this platform. It falls back to using simple whitespace splitter instead: /s+/."), this.split = /\s+/;
}
} else {
this.split = b, e = !1 === b || 2 > "a1a".split(b).length;
this.split = b, f = !1 === b || 2 > "a1a".split(b).length;
}
this.numeric = u(a.numeric, e);
this.numeric = u(a.numeric, f);
} else {
try {
this.split = u(this.split, A);
@@ -186,7 +186,7 @@ r.encode = function(a, c) {
this.prepare && (a = this.prepare(a));
this.numeric && 3 < a.length && (a = a.replace(C, "$1 $2").replace(D, "$1 $2").replace(B, "$1 "));
const b = !(this.dedupe || this.mapper || this.filter || this.matcher || this.stemmer || this.replacer);
let e = [], d = x(), g, f, k = this.split || "" === this.split ? a.split(this.split) : [a];
let f = [], d = x(), g, e, k = this.split || "" === this.split ? a.split(this.split) : [a];
for (let n = 0, h, w; n < k.length; n++) {
if ((h = w = k[n]) && !(h.length < this.minlength || h.length > this.maxlength)) {
if (c) {
@@ -201,14 +201,14 @@ r.encode = function(a, c) {
g = h;
}
if (b) {
e.push(h);
f.push(h);
} else {
if (!this.filter || ("function" === typeof this.filter ? this.filter(h) : !this.filter.has(h))) {
if (this.cache && h.length <= this.o) {
if (this.l) {
var l = this.j.get(h);
if (l || "" === l) {
l && e.push(l);
l && f.push(l);
continue;
}
} else {
@@ -244,21 +244,21 @@ r.encode = function(a, c) {
}
d[h] = 1;
} else {
if (f === h) {
if (e === h) {
continue;
}
f = h;
e = h;
}
}
e.push(h);
f.push(h);
}
}
}
}
}
this.finalize && (e = this.finalize(e) || e);
this.cache && a.length <= this.m && (this.i.set(a, e), this.i.size > this.A && (this.i.clear(), this.m = this.m / 1.1 | 0));
return e;
this.finalize && (f = this.finalize(f) || f);
this.cache && a.length <= this.m && (this.i.set(a, f), this.i.size > this.A && (this.i.clear(), this.m = this.m / 1.1 | 0));
return f;
};
function G(a) {
a.l = null;
@@ -272,41 +272,41 @@ function G(a) {
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, g, f; d < a.length; d++) {
if ((g = a[d]) && (f = g.length)) {
let f = [];
for (let d = 0, g, e; d < a.length; d++) {
if ((g = a[d]) && (e = g.length)) {
if (b) {
if (b >= f) {
b -= f;
if (b >= e) {
b -= e;
continue;
}
b < f && (g = c ? g.slice(b, b + c) : g.slice(b), f = g.length, b = 0);
b < e && (g = c ? g.slice(b, b + c) : g.slice(b), e = g.length, b = 0);
}
f > c && (g = g.slice(0, c), f = c);
if (!e.length && f >= c) {
e > c && (g = g.slice(0, c), e = c);
if (!f.length && e >= c) {
return g;
}
e.push(g);
c -= f;
f.push(g);
c -= e;
if (!c) {
break;
}
}
}
return e = 1 < e.length ? [].concat.apply([], e) : e[0];
return f = 1 < f.length ? [].concat.apply([], f) : f[0];
}
;x();
I.prototype.remove = function(a, c) {
const b = this.reg.size && (this.fastupdate ? this.reg.get(a) : this.reg.has(a));
if (b) {
if (this.fastupdate) {
for (let e = 0, d; e < b.length; e++) {
if (d = b[e]) {
if (2 > d.length) {
for (let f = 0, d, g; f < b.length; f++) {
if ((d = b[f]) && (g = d.length)) {
if (d[g - 1] === a) {
d.pop();
} else {
const g = d.indexOf(a);
g === b.length - 1 ? d.pop() : d.splice(g, 1);
const e = d.indexOf(a);
0 <= e && d.splice(e, 1);
}
}
}
@@ -319,16 +319,21 @@ I.prototype.remove = function(a, c) {
};
function J(a, c) {
let b = 0;
var e = "undefined" === typeof c;
var f = "undefined" === typeof c;
if (a.constructor === Array) {
for (let d = 0, g, f; d < a.length; d++) {
for (let d = 0, g, e; d < a.length; d++) {
if ((g = a[d]) && g.length) {
if (e) {
if (f) {
b++;
} else {
if (f = g.indexOf(c), 0 <= f) {
1 < g.length ? (g.splice(f, 1), b++) : delete a[d];
if (e = g.indexOf(c), 0 <= e) {
if (1 < g.length) {
g.splice(e, 1);
b++;
break;
} else {
delete a[d];
}
} else {
b++;
}
@@ -337,38 +342,36 @@ function J(a, c) {
}
} else {
for (let d of a.entries()) {
e = d[0];
const g = J(d[1], c);
g ? b += g : a.delete(e);
f = d[0], J(d[1], c) ? b++ : a.delete(f);
}
}
return b;
}
;const K = {memory:{resolution:1}, performance:{resolution:3, fastupdate:!0, context:{depth:1, resolution:1}}, match:{tokenize:"forward"}, score:{resolution:9, context:{depth:2, resolution:3}}};
I.prototype.add = function(a, c, b, e) {
I.prototype.add = function(a, c, b, f) {
if (c && (a || 0 === a)) {
if (!e && !b && this.reg.has(a)) {
if (!f && !b && this.reg.has(a)) {
return this.update(a, c);
}
e = this.depth;
c = this.encoder.encode(c, !e);
f = this.depth;
c = this.encoder.encode(c, !f);
const n = c.length;
if (n) {
const h = x(), w = x(), v = this.resolution;
for (let p = 0; p < n; p++) {
let m = c[this.rtl ? n - 1 - p : p];
var d = m.length;
if (d && (e || !w[m])) {
var g = this.score ? this.score(c, m, p, null, 0) : L(v, n, p), f = "";
if (d && (f || !w[m])) {
var g = this.score ? this.score(c, m, p, null, 0) : L(v, n, p), e = "";
switch(this.tokenize) {
case "full":
if (2 < d) {
for (let q = 0, t; q < d; q++) {
for (g = d; g > q; g--) {
f = m.substring(q, g);
e = m.substring(q, g);
t = this.rtl ? d - 1 - q : q;
var k = this.score ? this.score(c, m, p, f, t) : L(v, n, p, d, t);
M(this, w, f, k, a, b);
var k = this.score ? this.score(c, m, p, e, t) : L(v, n, p, d, t);
M(this, w, e, k, a, b);
}
}
break;
@@ -377,25 +380,25 @@ I.prototype.add = function(a, c, b, e) {
case "reverse":
if (1 < d) {
for (k = d - 1; 0 < k; k--) {
f = m[this.rtl ? d - 1 - k : k] + f;
var l = this.score ? this.score(c, m, p, f, k) : L(v, n, p, d, k);
M(this, w, f, l, a, b);
e = m[this.rtl ? d - 1 - k : k] + e;
var l = this.score ? this.score(c, m, p, e, k) : L(v, n, p, d, k);
M(this, w, e, l, a, b);
}
f = "";
e = "";
}
case "forward":
if (1 < d) {
for (k = 0; k < d; k++) {
f += m[this.rtl ? d - 1 - k : k], M(this, w, f, g, a, b);
e += m[this.rtl ? d - 1 - k : k], M(this, w, e, g, a, b);
}
break;
}
default:
if (M(this, w, m, g, a, b), e && 1 < n && p < n - 1) {
for (d = x(), f = this.v, g = m, k = Math.min(e + 1, this.rtl ? p + 1 : n - p), d[g] = 1, l = 1; l < k; l++) {
if (M(this, w, m, g, a, b), f && 1 < n && p < n - 1) {
for (d = x(), e = this.v, g = m, k = Math.min(f + 1, this.rtl ? p + 1 : n - p), d[g] = 1, l = 1; l < k; l++) {
if ((m = c[this.rtl ? n - 1 - p - l : p + l]) && !d[m]) {
d[m] = 1;
const q = this.score ? this.score(c, g, p, m, l - 1) : L(f + (n / 2 > f ? 0 : 1), n, p, k - 1, l - 1), t = this.bidirectional && m > g;
const q = this.score ? this.score(c, g, p, m, l - 1) : L(e + (n / 2 > e ? 0 : 1), n, p, k - 1, l - 1), t = this.bidirectional && m > g;
M(this, h, t ? g : m, q, a, b, t ? m : g);
}
}
@@ -408,24 +411,24 @@ I.prototype.add = function(a, c, b, e) {
}
return this;
};
function M(a, c, b, e, d, g, f) {
let k = f ? a.ctx : a.map, l;
if (!c[b] || f && !(l = c[b])[f]) {
f ? (c = l || (c[b] = x()), c[f] = 1, (l = k.get(f)) ? k = l : k.set(f, k = new Map())) : c[b] = 1, (l = k.get(b)) ? k = l : k.set(b, k = []), k = k[e] || (k[e] = []), g && k.includes(d) || (k.push(d), a.fastupdate && ((c = a.reg.get(d)) ? c.push(k) : a.reg.set(d, [k])));
function M(a, c, b, f, d, g, e) {
let k = e ? a.ctx : a.map, l;
if (!c[b] || e && !(l = c[b])[e]) {
e ? (c = l || (c[b] = x()), c[e] = 1, (l = k.get(e)) ? k = l : k.set(e, k = new Map())) : c[b] = 1, (l = k.get(b)) ? k = l : k.set(b, k = []), k = k[f] || (k[f] = []), g && k.includes(d) || (k.push(d), a.fastupdate && ((c = a.reg.get(d)) ? c.push(k) : a.reg.set(d, [k])));
}
}
function L(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 L(a, c, b, f, d) {
return b && 1 < a ? c + (f || 0) <= a ? b + (d || 0) : (a - 1) / (c + (f || 0)) * (b + (d || 0)) + 1 | 0 : 0;
}
;I.prototype.search = function(a, c, b) {
b || (c || "object" !== typeof a ? "object" === typeof c && (b = c, c = 0) : (b = a, a = ""));
var e = [], d = 0;
var f = [], d = 0;
if (b) {
a = b.query || a;
c = b.limit || c;
d = b.offset || 0;
var g = b.context;
var f = b.suggest;
var e = b.suggest;
var k = !0;
var l = b.resolution;
}
@@ -435,10 +438,10 @@ function L(a, c, b, e, d) {
b = a.length;
c = c || (k ? 100 : 0);
if (1 === b) {
return f = d, (d = N(this, a[0], "")) && d.length ? H.call(this, d, c, f) : [];
return e = d, (d = N(this, a[0], "")) && d.length ? H.call(this, d, c, e) : [];
}
if (2 === b && g && !f) {
return f = d, (d = N(this, a[1], a[0])) && d.length ? H.call(this, d, c, f) : [];
if (2 === b && g && !e) {
return e = d, (d = N(this, a[1], a[0])) && d.length ? H.call(this, d, c, e) : [];
}
k = x();
var n = 0;
@@ -453,7 +456,7 @@ function L(a, c, b, e, d) {
m = N(this, q, h);
a: {
g = m;
var w = e, v = f, p = l;
var w = f, v = e, p = l;
let t = [];
if (g && g.length) {
if (g.length <= p) {
@@ -475,28 +478,28 @@ function L(a, c, b, e, d) {
m = v ? void 0 : t;
}
if (m) {
e = m;
f = m;
break;
}
h && (f && m && e.length || (h = q));
h && (e && m && f.length || (h = q));
}
f && h && n === b - 1 && !e.length && (l = this.resolution, h = "", n = -1, k = x());
e && h && n === b - 1 && !f.length && (l = this.resolution, h = "", n = -1, k = x());
}
a: {
a = e;
e = a.length;
a = f;
f = a.length;
h = a;
if (1 < e) {
if (1 < f) {
b: {
e = f;
f = e;
h = a.length;
f = [];
e = [];
b = x();
for (let m = 0, q, t, y, z; m < l; m++) {
for (n = 0; n < h; n++) {
if (y = a[n], m < y.length && (q = y[m])) {
for (g = 0; g < q.length; g++) {
if (t = q[g], (k = b[t]) ? b[t]++ : (k = 0, b[t] = 1), z = f[k] || (f[k] = []), z.push(t), c && k === h - 1 && z.length - d === c) {
if (t = q[g], (k = b[t]) ? b[t]++ : (k = 0, b[t] = 1), z = e[k] || (e[k] = []), z.push(t), c && k === h - 1 && z.length - d === c) {
h = d ? z.slice(d) : z;
break b;
}
@@ -504,14 +507,14 @@ function L(a, c, b, e, d) {
}
}
}
if (a = f.length) {
if (e) {
if (1 < f.length) {
if (a = e.length) {
if (f) {
if (1 < e.length) {
c: {
for (a = [], l = x(), e = f.length, k = e - 1; 0 <= k; k--) {
if (b = (e = f[k]) && e.length) {
for (a = [], l = x(), f = e.length, k = f - 1; 0 <= k; k--) {
if (b = (f = e[k]) && f.length) {
for (n = 0; n < b; n++) {
if (h = e[n], !l[h]) {
if (h = f[n], !l[h]) {
if (l[h] = 1, d) {
d--;
} else {
@@ -525,25 +528,25 @@ function L(a, c, b, e, d) {
}
}
} else {
a = (f = f[0]).length > c || d ? f.slice(d, c + d) : f;
a = (e = e[0]).length > c || d ? e.slice(d, c + d) : e;
}
f = a;
e = a;
} else {
if (a < h) {
h = [];
break b;
}
f = f[a - 1];
e = e[a - 1];
if (c || d) {
if (f.length > c || d) {
f = f.slice(d, c + d);
if (e.length > c || d) {
e = e.slice(d, c + d);
}
}
}
}
h = f;
h = e;
}
} else if (1 === e) {
} else if (1 === f) {
c = H.call(null, a[0], c, d);
break a;
}
@@ -552,8 +555,8 @@ function L(a, c, b, e, d) {
return c;
};
function N(a, c, b) {
let e;
b && (e = a.bidirectional && c > b) && (e = b, b = c, c = e);
let f;
b && (f = a.bidirectional && c > b) && (f = b, b = c, c = f);
a = b ? (a = a.ctx.get(b)) && a.get(c) : a.map.get(c);
return a;
}
@@ -568,19 +571,19 @@ function N(a, c, b) {
a = {};
}
b = a.context;
const e = !0 === b ? {depth:1} : b || {}, d = a.encode || a.encoder || {};
const f = !0 === b ? {depth:1} : b || {}, d = a.encode || a.encoder || {};
this.encoder = d.encode ? d : "object" === typeof d ? new F(d) : {encode:d};
this.resolution = a.resolution || 9;
this.tokenize = b = (b = a.tokenize) && "default" !== b && "exact" !== b && b || "strict";
this.depth = "strict" === b && e.depth || 0;
this.bidirectional = !1 !== e.bidirectional;
this.depth = "strict" === b && f.depth || 0;
this.bidirectional = !1 !== f.bidirectional;
this.fastupdate = !!a.fastupdate;
this.score = a.score || null;
e && e.depth && "strict" !== this.tokenize && console.warn('Context-Search could not applied, because it is just supported when using the tokenizer "strict".');
f && f.depth && "strict" !== this.tokenize && console.warn('Context-Search could not applied, because it is just supported when using the tokenizer "strict".');
this.map = new Map();
this.ctx = new Map();
this.reg = c || (this.fastupdate ? new Map() : new Set());
this.v = e.resolution || 3;
this.v = f.resolution || 3;
this.rtl = d.rtl || a.rtl || !1;
}
r = I.prototype;
@@ -597,8 +600,8 @@ r.contain = function(a) {
return this.reg.has(a);
};
r.update = function(a, c) {
const b = this, e = this.remove(a);
return e && e.then ? e.then(() => b.add(a, c)) : this.add(a, c);
const b = this, f = this.remove(a);
return f && f.then ? f.then(() => b.add(a, c)) : this.add(a, c);
};
r.cleanup = function() {
if (!this.fastupdate) {

View File

@@ -1,27 +1,27 @@
/**!
* FlexSearch.js v0.8.166 (Bundle)
* FlexSearch.js v0.8.167 (Bundle)
* Author and Copyright: Thomas Wilkerling
* Licence: Apache-2.0
* Hosted by Nextapps GmbH
* https://github.com/nextapps-de/flexsearch
*/
var r;function u(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(k){return a(b(k))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var g=new Map(b);for(var f of a)g.set(f[0],f[1]);return g}if(c===Set){f=new Set(b);for(g of a.values())f.add(g);return f}}}return a}return b}return"undefined"===d?c:a}function x(){return Object.create(null)};const A=/[^\p{L}\p{N}]+/u,B=/(\d{3})/g,C=/(\D)(\d{3})/g,D=/(\d{3})(\D)/g,E=/[\u0300-\u036f]/g;function F(a={}){if(!this||this.constructor!==F)return new F(...arguments);if(arguments.length)for(a=0;a<arguments.length;a++)this.assign(arguments[a]);else this.assign(a)}r=F.prototype;
r.assign=function(a){this.normalize=u(a.normalize,!0,this.normalize);let c=a.include,b=c||a.exclude||a.split,e;if(b||""===b){if("object"===typeof b&&b.constructor!==RegExp){let d="";e=!c;c||(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;try{this.split=new RegExp("["+(c?"^":"")+d+"]+","u")}catch(g){this.split=/\s+/}}else this.split=b,e=!1===b||2>"a1a".split(b).length;
this.numeric=u(a.numeric,e)}else{try{this.split=u(this.split,A)}catch(d){this.split=/\s+/}this.numeric=u(a.numeric,u(this.numeric,!0))}this.prepare=u(a.prepare,null,this.prepare);this.finalize=u(a.finalize,null,this.finalize);b=a.filter;this.filter="function"===typeof b?b:u(b&&new Set(b),null,this.filter);this.dedupe=u(a.dedupe,!0,this.dedupe);this.matcher=u((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=u((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=u((b=a.stemmer)&&new Map(b),
var r;function u(a,c,b){const f=typeof b,d=typeof a;if("undefined"!==f){if("undefined"!==d){if(b){if("function"===d&&f===d)return function(k){return a(b(k))};c=a.constructor;if(c===b.constructor){if(c===Array)return b.concat(a);if(c===Map){var g=new Map(b);for(var e of a)g.set(e[0],e[1]);return g}if(c===Set){e=new Set(b);for(g of a.values())e.add(g);return e}}}return a}return b}return"undefined"===d?c:a}function x(){return Object.create(null)};const A=/[^\p{L}\p{N}]+/u,B=/(\d{3})/g,C=/(\D)(\d{3})/g,D=/(\d{3})(\D)/g,E=/[\u0300-\u036f]/g;function F(a={}){if(!this||this.constructor!==F)return new F(...arguments);if(arguments.length)for(a=0;a<arguments.length;a++)this.assign(arguments[a]);else this.assign(a)}r=F.prototype;
r.assign=function(a){this.normalize=u(a.normalize,!0,this.normalize);let c=a.include,b=c||a.exclude||a.split,f;if(b||""===b){if("object"===typeof b&&b.constructor!==RegExp){let d="";f=!c;c||(d+="\\p{Z}");b.letter&&(d+="\\p{L}");b.number&&(d+="\\p{N}",f=!!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;try{this.split=new RegExp("["+(c?"^":"")+d+"]+","u")}catch(g){this.split=/\s+/}}else this.split=b,f=!1===b||2>"a1a".split(b).length;
this.numeric=u(a.numeric,f)}else{try{this.split=u(this.split,A)}catch(d){this.split=/\s+/}this.numeric=u(a.numeric,u(this.numeric,!0))}this.prepare=u(a.prepare,null,this.prepare);this.finalize=u(a.finalize,null,this.finalize);b=a.filter;this.filter="function"===typeof b?b:u(b&&new Set(b),null,this.filter);this.dedupe=u(a.dedupe,!0,this.dedupe);this.matcher=u((b=a.matcher)&&new Map(b),null,this.matcher);this.mapper=u((b=a.mapper)&&new Map(b),null,this.mapper);this.stemmer=u((b=a.stemmer)&&new Map(b),
null,this.stemmer);this.replacer=u(a.replacer,null,this.replacer);this.minlength=u(a.minlength,1,this.minlength);this.maxlength=u(a.maxlength,1024,this.maxlength);this.rtl=u(a.rtl,!1,this.rtl);if(this.cache=b=u(a.cache,!0,this.cache))this.l=null,this.A="number"===typeof b?b:2E5,this.i=new Map,this.j=new Map,this.o=this.m=128;this.g="";this.s=null;this.h="";this.u=null;if(this.matcher)for(const d of this.matcher.keys())this.g+=(this.g?"|":"")+d;if(this.stemmer)for(const d of this.stemmer.keys())this.h+=
(this.h?"|":"")+d;return this};r.addStemmer=function(a,c){this.stemmer||(this.stemmer=new Map);this.stemmer.set(a,c);this.h+=(this.h?"|":"")+a;this.u=null;this.cache&&G(this);return this};r.addFilter=function(a){"function"===typeof a?this.filter=a:(this.filter||(this.filter=new Set),this.filter.add(a));this.cache&&G(this);return this};
r.addMapper=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(1<a.length)return this.addMatcher(a,c);this.mapper||(this.mapper=new Map);this.mapper.set(a,c);this.cache&&G(this);return this};r.addMatcher=function(a,c){if("object"===typeof a)return this.addReplacer(a,c);if(2>a.length&&(this.dedupe||this.mapper))return this.addMapper(a,c);this.matcher||(this.matcher=new Map);this.matcher.set(a,c);this.g+=(this.g?"|":"")+a;this.s=null;this.cache&&G(this);return this};
r.addReplacer=function(a,c){if("string"===typeof a)return this.addMatcher(a,c);this.replacer||(this.replacer=[]);this.replacer.push(a,c);this.cache&&G(this);return this};
r.encode=function(a,c){if(this.cache&&a.length<=this.m)if(this.l){if(this.i.has(a))return this.i.get(a)}else this.l=setTimeout(G,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=E?a.normalize("NFKD").replace(E,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3<a.length&&(a=a.replace(C,"$1 $2").replace(D,"$1 $2").replace(B,"$1 "));const b=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let e=[],
d=x(),g,f,k=this.split||""===this.split?a.split(this.split):[a];for(let n=0,h,w;n<k.length;n++)if((h=w=k[n])&&!(h.length<this.minlength||h.length>this.maxlength)){if(c){if(d[h])continue;d[h]=1}else{if(g===h)continue;g=h}if(b)e.push(h);else if(!this.filter||("function"===typeof this.filter?this.filter(h):!this.filter.has(h))){if(this.cache&&h.length<=this.o)if(this.l){var l=this.j.get(h);if(l||""===l){l&&e.push(l);continue}}else this.l=setTimeout(G,50,this);if(this.stemmer){this.u||(this.u=new RegExp("(?!^)("+
r.encode=function(a,c){if(this.cache&&a.length<=this.m)if(this.l){if(this.i.has(a))return this.i.get(a)}else this.l=setTimeout(G,50,this);this.normalize&&("function"===typeof this.normalize?a=this.normalize(a):a=E?a.normalize("NFKD").replace(E,"").toLowerCase():a.toLowerCase());this.prepare&&(a=this.prepare(a));this.numeric&&3<a.length&&(a=a.replace(C,"$1 $2").replace(D,"$1 $2").replace(B,"$1 "));const b=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let f=[],
d=x(),g,e,k=this.split||""===this.split?a.split(this.split):[a];for(let n=0,h,w;n<k.length;n++)if((h=w=k[n])&&!(h.length<this.minlength||h.length>this.maxlength)){if(c){if(d[h])continue;d[h]=1}else{if(g===h)continue;g=h}if(b)f.push(h);else if(!this.filter||("function"===typeof this.filter?this.filter(h):!this.filter.has(h))){if(this.cache&&h.length<=this.o)if(this.l){var l=this.j.get(h);if(l||""===l){l&&f.push(l);continue}}else this.l=setTimeout(G,50,this);if(this.stemmer){this.u||(this.u=new RegExp("(?!^)("+
this.h+")$"));let v;for(;v!==h&&2<h.length;)v=h,h=h.replace(this.u,p=>this.stemmer.get(p))}if(h&&(this.mapper||this.dedupe&&1<h.length)){l="";for(let v=0,p="",m,q;v<h.length;v++)m=h.charAt(v),m===p&&this.dedupe||((q=this.mapper&&this.mapper.get(m))||""===q?q===p&&this.dedupe||!(p=q)||(l+=q):l+=p=m);h=l}this.matcher&&1<h.length&&(this.s||(this.s=new RegExp("("+this.g+")","g")),h=h.replace(this.s,v=>this.matcher.get(v)));if(h&&this.replacer)for(l=0;h&&l<this.replacer.length;l+=2)h=h.replace(this.replacer[l],
this.replacer[l+1]);this.cache&&w.length<=this.o&&(this.j.set(w,h),this.j.size>this.A&&(this.j.clear(),this.o=this.o/1.1|0));if(h){if(h!==w)if(c){if(d[h])continue;d[h]=1}else{if(f===h)continue;f=h}e.push(h)}}}this.finalize&&(e=this.finalize(e)||e);this.cache&&a.length<=this.m&&(this.i.set(a,e),this.i.size>this.A&&(this.i.clear(),this.m=this.m/1.1|0));return e};function G(a){a.l=null;a.i.clear();a.j.clear()};function H(a,c,b){if(!a.length)return a;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,g,f;d<a.length;d++)if((g=a[d])&&(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)}f>c&&(g=g.slice(0,c),f=c);if(!e.length&&f>=c)return g;e.push(g);c-=f;if(!c)break}return e=1<e.length?[].concat.apply([],e):e[0]};x();I.prototype.remove=function(a,c){const b=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.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 g=d.indexOf(a);g===b.length-1?d.pop():d.splice(g,1)}}else J(this.map,a),this.depth&&J(this.ctx,a);c||this.reg.delete(a)}return this};
function J(a,c){let b=0;var e="undefined"===typeof c;if(a.constructor===Array)for(let d=0,g,f;d<a.length;d++){if((g=a[d])&&g.length)if(e)b++;else if(f=g.indexOf(c),0<=f){1<g.length?(g.splice(f,1),b++):delete a[d];break}else b++}else for(let d of a.entries()){e=d[0];const g=J(d[1],c);g?b+=g:a.delete(e)}return b};const K={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};I.prototype.add=function(a,c,b,e){if(c&&(a||0===a)){if(!e&&!b&&this.reg.has(a))return this.update(a,c);e=this.depth;c=this.encoder.encode(c,!e);const n=c.length;if(n){const h=x(),w=x(),v=this.resolution;for(let p=0;p<n;p++){let m=c[this.rtl?n-1-p:p];var d=m.length;if(d&&(e||!w[m])){var g=this.score?this.score(c,m,p,null,0):L(v,n,p),f="";switch(this.tokenize){case "full":if(2<d){for(let q=0,t;q<d;q++)for(g=d;g>q;g--){f=m.substring(q,g);t=this.rtl?d-1-q:q;var k=this.score?this.score(c,m,p,f,t):L(v,
n,p,d,t);M(this,w,f,k,a,b)}break}case "bidirectional":case "reverse":if(1<d){for(k=d-1;0<k;k--){f=m[this.rtl?d-1-k:k]+f;var l=this.score?this.score(c,m,p,f,k):L(v,n,p,d,k);M(this,w,f,l,a,b)}f=""}case "forward":if(1<d){for(k=0;k<d;k++)f+=m[this.rtl?d-1-k:k],M(this,w,f,g,a,b);break}default:if(M(this,w,m,g,a,b),e&&1<n&&p<n-1)for(d=x(),f=this.v,g=m,k=Math.min(e+1,this.rtl?p+1:n-p),d[g]=1,l=1;l<k;l++)if((m=c[this.rtl?n-1-p-l:p+l])&&!d[m]){d[m]=1;const q=this.score?this.score(c,g,p,m,l-1):L(f+(n/2>f?0:
1),n,p,k-1,l-1),t=this.bidirectional&&m>g;M(this,h,t?g:m,q,a,b,t?m:g)}}}}this.fastupdate||this.reg.add(a)}}return this};function M(a,c,b,e,d,g,f){let k=f?a.ctx:a.map,l;if(!c[b]||f&&!(l=c[b])[f])f?(c=l||(c[b]=x()),c[f]=1,(l=k.get(f))?k=l:k.set(f,k=new Map)):c[b]=1,(l=k.get(b))?k=l:k.set(b,k=[]),k=k[e]||(k[e]=[]),g&&k.includes(d)||(k.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(k):a.reg.set(d,[k])))}function L(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};I.prototype.search=function(a,c,b){b||(c||"object"!==typeof a?"object"===typeof c&&(b=c,c=0):(b=a,a=""));var e=[],d=0;if(b){a=b.query||a;c=b.limit||c;d=b.offset||0;var g=b.context;var f=b.suggest;var k=!0;var l=b.resolution}"undefined"===typeof k&&(k=!0);g=this.depth&&!1!==g;a=this.encoder.encode(a,!g);b=a.length;c=c||(k?100:0);if(1===b)return f=d,(d=N(this,a[0],""))&&d.length?H.call(this,d,c,f):[];if(2===b&&g&&!f)return f=d,(d=N(this,a[1],a[0]))&&d.length?H.call(this,d,c,f):[];k=x();var n=0;if(g){var h=
a[0];n=1}l||0===l||(l=h?this.v:this.resolution);for(let m,q;n<b;n++){if((q=a[n])&&!k[q]){k[q]=1;m=N(this,q,h);a:{g=m;var w=e,v=f,p=l;let t=[];if(g&&g.length){if(g.length<=p){w.push(g);m=void 0;break a}for(let y=0,z;y<p;y++)if(z=g[y])t[y]=z;if(t.length){w.push(t);m=void 0;break a}}m=v?void 0:t}if(m){e=m;break}h&&(f&&m&&e.length||(h=q))}f&&h&&n===b-1&&!e.length&&(l=this.resolution,h="",n=-1,k=x())}a:{a=e;e=a.length;h=a;if(1<e)b:{e=f;h=a.length;f=[];b=x();for(let m=0,q,t,y,z;m<l;m++)for(n=0;n<h;n++)if(y=
a[n],m<y.length&&(q=y[m]))for(g=0;g<q.length;g++)if(t=q[g],(k=b[t])?b[t]++:(k=0,b[t]=1),z=f[k]||(f[k]=[]),z.push(t),c&&k===h-1&&z.length-d===c){h=d?z.slice(d):z;break b}if(a=f.length)if(e){if(1<f.length)c:for(a=[],l=x(),e=f.length,k=e-1;0<=k;k--){if(b=(e=f[k])&&e.length)for(n=0;n<b;n++)if(h=e[n],!l[h])if(l[h]=1,d)d--;else if(a.push(h),a.length===c)break c}else a=(f=f[0]).length>c||d?f.slice(d,c+d):f;f=a}else{if(a<h){h=[];break b}f=f[a-1];if(c||d)if(f.length>c||d)f=f.slice(d,c+d)}h=f}else if(1===e){c=
H.call(null,a[0],c,d);break a}c=h}return c};function N(a,c,b){let e;b&&(e=a.bidirectional&&c>b)&&(e=b,b=c,c=e);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};function I(a,c){if(!this||this.constructor!==I)return new I(a);if(a){var b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},K[b],a))}else a={};b=a.context;const e=!0===b?{depth:1}:b||{},d=a.encode||a.encoder||{};this.encoder=d.encode?d:"object"===typeof d?new F(d):{encode:d};this.resolution=a.resolution||9;this.tokenize=b=(b=a.tokenize)&&"default"!==b&&"exact"!==b&&b||"strict";this.depth="strict"===b&&e.depth||0;this.bidirectional=!1!==e.bidirectional;this.fastupdate=!!a.fastupdate;this.score=
a.score||null;this.map=new Map;this.ctx=new Map;this.reg=c||(this.fastupdate?new Map:new Set);this.v=e.resolution||3;this.rtl=d.rtl||a.rtl||!1}r=I.prototype;r.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();return this};r.append=function(a,c){return this.add(a,c,!0)};r.contain=function(a){return this.reg.has(a)};r.update=function(a,c){const b=this,e=this.remove(a);return e&&e.then?e.then(()=>b.add(a,c)):this.add(a,c)};
this.replacer[l+1]);this.cache&&w.length<=this.o&&(this.j.set(w,h),this.j.size>this.A&&(this.j.clear(),this.o=this.o/1.1|0));if(h){if(h!==w)if(c){if(d[h])continue;d[h]=1}else{if(e===h)continue;e=h}f.push(h)}}}this.finalize&&(f=this.finalize(f)||f);this.cache&&a.length<=this.m&&(this.i.set(a,f),this.i.size>this.A&&(this.i.clear(),this.m=this.m/1.1|0));return f};function G(a){a.l=null;a.i.clear();a.j.clear()};function H(a,c,b){if(!a.length)return a;if(1===a.length)return a=a[0],a=b||a.length>c?c?a.slice(b,b+c):a.slice(b):a;let f=[];for(let d=0,g,e;d<a.length;d++)if((g=a[d])&&(e=g.length)){if(b){if(b>=e){b-=e;continue}b<e&&(g=c?g.slice(b,b+c):g.slice(b),e=g.length,b=0)}e>c&&(g=g.slice(0,c),e=c);if(!f.length&&e>=c)return g;f.push(g);c-=e;if(!c)break}return f=1<f.length?[].concat.apply([],f):f[0]};x();I.prototype.remove=function(a,c){const b=this.reg.size&&(this.fastupdate?this.reg.get(a):this.reg.has(a));if(b){if(this.fastupdate)for(let f=0,d,g;f<b.length;f++){if((d=b[f])&&(g=d.length))if(d[g-1]===a)d.pop();else{const e=d.indexOf(a);0<=e&&d.splice(e,1)}}else J(this.map,a),this.depth&&J(this.ctx,a);c||this.reg.delete(a)}return this};
function J(a,c){let b=0;var f="undefined"===typeof c;if(a.constructor===Array)for(let d=0,g,e;d<a.length;d++){if((g=a[d])&&g.length)if(f)b++;else if(e=g.indexOf(c),0<=e)if(1<g.length){g.splice(e,1);b++;break}else delete a[d];else b++}else for(let d of a.entries())f=d[0],J(d[1],c)?b++:a.delete(f);return b};const K={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};I.prototype.add=function(a,c,b,f){if(c&&(a||0===a)){if(!f&&!b&&this.reg.has(a))return this.update(a,c);f=this.depth;c=this.encoder.encode(c,!f);const n=c.length;if(n){const h=x(),w=x(),v=this.resolution;for(let p=0;p<n;p++){let m=c[this.rtl?n-1-p:p];var d=m.length;if(d&&(f||!w[m])){var g=this.score?this.score(c,m,p,null,0):L(v,n,p),e="";switch(this.tokenize){case "full":if(2<d){for(let q=0,t;q<d;q++)for(g=d;g>q;g--){e=m.substring(q,g);t=this.rtl?d-1-q:q;var k=this.score?this.score(c,m,p,e,t):L(v,
n,p,d,t);M(this,w,e,k,a,b)}break}case "bidirectional":case "reverse":if(1<d){for(k=d-1;0<k;k--){e=m[this.rtl?d-1-k:k]+e;var l=this.score?this.score(c,m,p,e,k):L(v,n,p,d,k);M(this,w,e,l,a,b)}e=""}case "forward":if(1<d){for(k=0;k<d;k++)e+=m[this.rtl?d-1-k:k],M(this,w,e,g,a,b);break}default:if(M(this,w,m,g,a,b),f&&1<n&&p<n-1)for(d=x(),e=this.v,g=m,k=Math.min(f+1,this.rtl?p+1:n-p),d[g]=1,l=1;l<k;l++)if((m=c[this.rtl?n-1-p-l:p+l])&&!d[m]){d[m]=1;const q=this.score?this.score(c,g,p,m,l-1):L(e+(n/2>e?0:
1),n,p,k-1,l-1),t=this.bidirectional&&m>g;M(this,h,t?g:m,q,a,b,t?m:g)}}}}this.fastupdate||this.reg.add(a)}}return this};function M(a,c,b,f,d,g,e){let k=e?a.ctx:a.map,l;if(!c[b]||e&&!(l=c[b])[e])e?(c=l||(c[b]=x()),c[e]=1,(l=k.get(e))?k=l:k.set(e,k=new Map)):c[b]=1,(l=k.get(b))?k=l:k.set(b,k=[]),k=k[f]||(k[f]=[]),g&&k.includes(d)||(k.push(d),a.fastupdate&&((c=a.reg.get(d))?c.push(k):a.reg.set(d,[k])))}function L(a,c,b,f,d){return b&&1<a?c+(f||0)<=a?b+(d||0):(a-1)/(c+(f||0))*(b+(d||0))+1|0:0};I.prototype.search=function(a,c,b){b||(c||"object"!==typeof a?"object"===typeof c&&(b=c,c=0):(b=a,a=""));var f=[],d=0;if(b){a=b.query||a;c=b.limit||c;d=b.offset||0;var g=b.context;var e=b.suggest;var k=!0;var l=b.resolution}"undefined"===typeof k&&(k=!0);g=this.depth&&!1!==g;a=this.encoder.encode(a,!g);b=a.length;c=c||(k?100:0);if(1===b)return e=d,(d=N(this,a[0],""))&&d.length?H.call(this,d,c,e):[];if(2===b&&g&&!e)return e=d,(d=N(this,a[1],a[0]))&&d.length?H.call(this,d,c,e):[];k=x();var n=0;if(g){var h=
a[0];n=1}l||0===l||(l=h?this.v:this.resolution);for(let m,q;n<b;n++){if((q=a[n])&&!k[q]){k[q]=1;m=N(this,q,h);a:{g=m;var w=f,v=e,p=l;let t=[];if(g&&g.length){if(g.length<=p){w.push(g);m=void 0;break a}for(let y=0,z;y<p;y++)if(z=g[y])t[y]=z;if(t.length){w.push(t);m=void 0;break a}}m=v?void 0:t}if(m){f=m;break}h&&(e&&m&&f.length||(h=q))}e&&h&&n===b-1&&!f.length&&(l=this.resolution,h="",n=-1,k=x())}a:{a=f;f=a.length;h=a;if(1<f)b:{f=e;h=a.length;e=[];b=x();for(let m=0,q,t,y,z;m<l;m++)for(n=0;n<h;n++)if(y=
a[n],m<y.length&&(q=y[m]))for(g=0;g<q.length;g++)if(t=q[g],(k=b[t])?b[t]++:(k=0,b[t]=1),z=e[k]||(e[k]=[]),z.push(t),c&&k===h-1&&z.length-d===c){h=d?z.slice(d):z;break b}if(a=e.length)if(f){if(1<e.length)c:for(a=[],l=x(),f=e.length,k=f-1;0<=k;k--){if(b=(f=e[k])&&f.length)for(n=0;n<b;n++)if(h=f[n],!l[h])if(l[h]=1,d)d--;else if(a.push(h),a.length===c)break c}else a=(e=e[0]).length>c||d?e.slice(d,c+d):e;e=a}else{if(a<h){h=[];break b}e=e[a-1];if(c||d)if(e.length>c||d)e=e.slice(d,c+d)}h=e}else if(1===f){c=
H.call(null,a[0],c,d);break a}c=h}return c};function N(a,c,b){let f;b&&(f=a.bidirectional&&c>b)&&(f=b,b=c,c=f);a=b?(a=a.ctx.get(b))&&a.get(c):a.map.get(c);return a};function I(a,c){if(!this||this.constructor!==I)return new I(a);if(a){var b="string"===typeof a?a:a.preset;b&&(a=Object.assign({},K[b],a))}else a={};b=a.context;const f=!0===b?{depth:1}:b||{},d=a.encode||a.encoder||{};this.encoder=d.encode?d:"object"===typeof d?new F(d):{encode:d};this.resolution=a.resolution||9;this.tokenize=b=(b=a.tokenize)&&"default"!==b&&"exact"!==b&&b||"strict";this.depth="strict"===b&&f.depth||0;this.bidirectional=!1!==f.bidirectional;this.fastupdate=!!a.fastupdate;this.score=
a.score||null;this.map=new Map;this.ctx=new Map;this.reg=c||(this.fastupdate?new Map:new Set);this.v=f.resolution||3;this.rtl=d.rtl||a.rtl||!1}r=I.prototype;r.clear=function(){this.map.clear();this.ctx.clear();this.reg.clear();return this};r.append=function(a,c){return this.add(a,c,!0)};r.contain=function(a){return this.reg.has(a)};r.update=function(a,c){const b=this,f=this.remove(a);return f&&f.then?f.then(()=>b.add(a,c)):this.add(a,c)};
r.cleanup=function(){if(!this.fastupdate)return this;J(this.map);this.depth&&J(this.ctx);return this};x();export default {Index:I,Charset:null,Encoder:F,Document:null,Worker:null,Resolver:null,IndexedDB:null,Language:{}};
export const Index=I;export const Charset=null;export const Encoder=F;export const Document=null;export const Worker=null;export const Resolver=null;export const IndexedDB=null;export const Language={};

View File

@@ -14,14 +14,16 @@ Index.prototype.remove = function (id, _skip_deletion) {
if (this.fastupdate) {
for (let i = 0, tmp; i < refs.length; i++) {
if (tmp = refs[i]) {
for (let i = 0, tmp, len; i < refs.length; i++) {
if ((tmp = refs[i]) && (len = tmp.length)) {
if (2 > tmp.length) {
if (tmp[len - 1] === id) {
tmp.pop();
} else {
const index = tmp.indexOf(id);
index === refs.length - 1 ? tmp.pop() : tmp.splice(index, 1);
if (0 <= index) {
tmp.splice(index, 1);
}
}
}
}
@@ -69,12 +71,12 @@ export function remove_index(map, id) {
if (1 < arr.length) {
arr.splice(index, 1);
count++;
break;
} else {
delete map[x];
}
break;
} else {
count++;
}
@@ -86,7 +88,7 @@ export function remove_index(map, id) {
value = item[1],
tmp = remove_index(value, id);
tmp ? count += tmp : map.delete(key);
tmp ? count++ : map.delete(key);
}
return count;

View File

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

View File

@@ -14,14 +14,16 @@ Index.prototype.remove = function (id, _skip_deletion) {
if (this.fastupdate) {
for (let i = 0, tmp; i < refs.length; i++) {
if (tmp = refs[i]) {
for (let i = 0, tmp, len; i < refs.length; i++) {
if ((tmp = refs[i]) && (len = tmp.length)) {
if (2 > tmp.length) {
if (tmp[len - 1] === id) {
tmp.pop();
} else {
const index = tmp.indexOf(id);
index === refs.length - 1 ? tmp.pop() : tmp.splice(index, 1);
if (0 <= index) {
tmp.splice(index, 1);
}
}
}
}
@@ -69,12 +71,12 @@ export function remove_index(map, id) {
if (1 < arr.length) {
arr.splice(index, 1);
count++;
break;
} else {
delete map[x];
}
break;
} else {
count++;
}
@@ -86,7 +88,7 @@ export function remove_index(map, id) {
value = item[1],
tmp = remove_index(value, id);
tmp ? count += tmp : map.delete(key);
tmp ? count++ : map.delete(key);
}
return count;

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "flexsearch",
"version": "0.8.166",
"version": "0.8.167",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "flexsearch",
"version": "0.8.166",
"version": "0.8.167",
"funding": [
{
"type": "github",

View File

@@ -2,7 +2,7 @@
"public": true,
"preferGlobal": false,
"name": "flexsearch",
"version": "0.8.166",
"version": "0.8.167",
"description": "Next-Generation full-text search library for Browser and Node.js",
"homepage": "https://github.com/nextapps-de/flexsearch/",
"author": "Thomas Wilkerling",

View File

@@ -25,23 +25,24 @@ Index.prototype.remove = function(id, _skip_deletion){
// fast updates did not fully clean up the key entries
for(let i = 0, tmp; i < refs.length; i++){
if((tmp = refs[i])){
for(let i = 0, tmp, len; i < refs.length; i++){
if((tmp = refs[i]) && (len = tmp.length)){
// todo check
//if(tmp.length < 1) throw new Error("invalid length");
//if(tmp.indexOf(id) < 0) throw new Error("invalid id");
if(tmp.length < 2){
if(tmp[len - 1] === id){
tmp.pop();
}
else{
const index = tmp.indexOf(id);
index === refs.length - 1
? tmp.pop()
: tmp.splice(index, 1);
if(index >= 0){
tmp.splice(index, 1);
}
}
}
else{
// todo investigate empty entries
// console.log(tmp)
}
}
@@ -137,13 +138,13 @@ export function remove_index(map, id){
if(arr.length > 1){
arr.splice(index, 1);
count++;
// the index key:[res, id] is unique
break;
}
else{
// remove resolution slot
delete map[x];
}
// the index key:[res, id] is unique
break;
}
else{
count++;
@@ -156,7 +157,7 @@ export function remove_index(map, id){
const key = item[0];
const value = item[1];
const tmp = remove_index(value, id);
tmp ? count += tmp
tmp ? count++ //count += tmp
: map.delete(key);
}