flexsearch
Advanced tools
Comparing version 0.3.61 to 0.4.0
/* | ||
FlexSearch v0.3.61 | ||
FlexSearch v0.4.0 | ||
Copyright 2019 Nextapps GmbH | ||
@@ -8,17 +8,21 @@ Author: Thomas Wilkerling | ||
*/ | ||
'use strict';(function(f,p,d){let k;(k=d.define)&&k.amd?k([],function(){return p}):(k=d.modules)?k[f.toLowerCase()]=p:"object"===typeof exports?module.exports=p:d[f]=p})("FlexSearch",function(){function f(b){z(b)&&(b=F[b]);b||(b=v);this.id=b.id||L++;this.init(b);p(this,"index",function(){return this.b});p(this,"length",function(){return Object.keys(this.b).length})}function p(b,a,c){Object.defineProperty(b,a,{get:c})}function d(b){return new RegExp(b,"g")}function k(b,a){for(let c=0;c<a.length;c+= | ||
2)b=b.replace(a[c],a[c+1]);return b}function y(b,a,c,g,e,d,m){if(a[c])return a[c];e=e?(9-(m||4.5))*d+(m||4.5)*e:d;a[c]=e;e>=m&&(b=b[9-(e+.5>>0)],b=b[c]||(b[c]=[]),b[b.length]=g);return e}function C(b,a){if(b){const c=Object.keys(b);for(let g=0,d=c.length;g<d;g++){const d=c[g],e=b[d];if(e)for(let c=0,g=e.length;c<g;c++)if(e[c]===a){1===g?delete b[d]:e.splice(c,1);break}else"object"===typeof e[c]&&C(e[c],a)}}}function D(b){let a="",c="";var d="";for(let e=0;e<b.length;e++){const g=b[e];if(g!==c)if(e&& | ||
"h"===g){if(d="a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&d||" "===c)a+=g}else a+=g;d=e===b.length-1?"":b[e+1];c=g}return a}function M(b,a){b=b.length-a.length;return 0>b?1:b?-1:0}function N(b,a){b=b.length-a.length;return 0>b?-1:b?1:0}function O(b,a,c){let d=[],e;const t=b.length;if(1<t){b.sort(N);const g=u();let l=b[0],n=l.length,h=0;for(;h<n;)g["@"+l[h++]]=1;let f,q=0,r=0;for(;++r<t;){let G=!1;const k=r===t-1;e=[];l=b[r];n=l.length; | ||
for(h=0;h<n;){f=l[h++];var m="@"+f;if(g[m]){const b=g[m];if(b===r){if(k){if(d[q++]=f,a&&q===a)return d}else g[m]=r+1;G=!0}else c&&(m=e[b]||(e[b]=[]),m[m.length]=f)}}if(!G&&!c)break}if(c&&(q=d.length,(r=e.length)&&(!a||q<a)))for(;r--;)if(f=e[r])for(h=0,n=f.length;h<n;h++)if(d[q++]=f[h],a&&q===a)return d}else t&&(d=b[0],a&&d.length>a&&(d=d.slice(0,a)));return d}function z(b){return"string"===typeof b}function A(b){return"function"===typeof b}function B(b){return"undefined"===typeof b}function H(b){const a= | ||
Array(b);for(let c=0;c<b;c++)a[c]=u();return a}function u(){return Object.create(null)}const v={encode:"icase",a:"forward",j:!1,cache:!1,async:!1,l:!1,h:!1,threshold:0,depth:0},F={memory:{encode:"extra",a:"strict",threshold:7},speed:{encode:"icase",a:"strict",threshold:7,depth:2},match:{encode:"extra",a:"full"},score:{encode:"extra",a:"strict",threshold:5,depth:4},balance:{encode:"balance",a:"strict",threshold:6,depth:3},fastest:{encode:"icase",a:"strict",threshold:9,depth:1}},E=[];let L=0;const I= | ||
d("\\W+"),J={},K={};f.create=function(b){return new f(b)};f.registerMatcher=function(b){for(const a in b)b.hasOwnProperty(a)&&E.push(d(a),b[a]);return this};f.registerEncoder=function(b,a){x[b]=a.bind(x);return this};f.registerLanguage=function(b,a){J[b]=a.filter;K[b]=a.stemmer;return this};f.encode=function(b,a){return x[b](a)};f.prototype.init=function(b){this.i=[];b||(b=v);var a=b.preset,c=a?F[a]:{};this.a=b.tokenize||c.a||this.a||v.a;this.h=b.rtl||this.h||v.h;this.async="undefined"===typeof Promise|| | ||
B(a=b.async)?this.async||v.async:a;this.threshold=B(a=b.threshold)?c.threshold||this.threshold||v.threshold:a;this.depth=B(a=b.depth)?c.depth||this.depth||v.depth:a;this.f=(a=B(a=b.encode)?c.encode:a)&&x[a]&&x[a].bind(x)||(A(a)?a:this.f||!1);(a=b.matcher)&&this.addMatcher(a);if(a=b.filter){a=J[a]||a;c=this.f;var g=u();if(a)for(let b=0;b<a.length;b++){const d=c?c(a[b]):a[b];g[d]=String.fromCharCode(65E3-a.length+b)}this.filter=a=g}if(a=b.stemmer){var e;b=K[a]||a;a=this.f;c=[];if(b)for(e in b)b.hasOwnProperty(e)&& | ||
(g=a?a(e):e,c.push(d("(?=.{"+(g.length+3)+",})"+g+"$"),a?a(b[e]):b[e]));this.stemmer=e=c}this.g=H(10-(this.threshold||0));this.c=u();this.b=u();return this};f.prototype.encode=function(b){b&&E.length&&(b=k(b,E));b&&this.i.length&&(b=k(b,this.i));b&&this.f&&(b=this.f(b));b&&this.stemmer&&(b=k(b,this.stemmer));return b};f.prototype.addMatcher=function(b){const a=this.i;for(const c in b)b.hasOwnProperty(c)&&a.push(d(c),b[c]);return this};f.prototype.add=function(b,a,c,d,e){if(a&&z(a)&&(b||0===b)){var g= | ||
"@"+b;if(this.b[g]&&!d)return this.update(b,a);if(!e){if(this.async&&"function"!==typeof importScripts){let e=this;g=new Promise(function(c){setTimeout(function(){e.add(b,a,null,d,!0);e=null;c()})});if(c)g.then(c);else return g;return this}if(c)return this.add(b,a,null,d,!0),c(),this}a=this.encode(a);if(!a.length)return this;c=this.a;e=A(c)?c(a):a.split(I);const k=u();k._ctx=u();const q=this.threshold,r=this.depth,t=this.g,w=e.length,p=this.h;for(let a=0;a<w;a++){var m=e[a];if(m){var f=m.length,l= | ||
(p?a+1:w-a)/w,n="";switch(c){case "reverse":case "both":for(var h=f;--h;)n=m[h]+n,y(t,k,n,b,p?1:(f-h)/f,l,q);n="";case "forward":for(h=0;h<f;h++)n+=m[h],y(t,k,n,b,p?(h+1)/f:1,l,q);break;case "full":for(h=0;h<f;h++){const a=(p?h+1:f-h)/f;for(let c=f;c>h;c--)n=m.substring(h,c),y(t,k,n,b,a,l,q)}break;default:if(f=y(t,k,m,b,1,l,q),r&&1<w&&f>=q)for(f=k._ctx[m]||(k._ctx[m]=u()),m=this.c[m]||(this.c[m]=H(10-(q||0))),l=a-r,n=a+r+1,0>l&&(l=0),n>w&&(n=w);l<n;l++)l!==a&&y(m,f,e[l],b,0,10-(l<a?a-l:l-a),q)}}}this.b[g]= | ||
1}return this};f.prototype.update=function(b,a,c){this.b["@"+b]&&z(a)&&(this.remove(b),this.add(b,a,c,!0));return this};f.prototype.remove=function(b,a,c){var d="@"+b;if(this.b[d]){if(!c){if(this.async&&"function"!==typeof importScripts){let c=this;d=new Promise(function(a){setTimeout(function(){c.remove(b,null,!0);c=null;a()})});if(a)d.then(a);else return d;return this}if(a)return this.remove(b,null,!0),a(),this}for(a=0;a<10-(this.threshold||0);a++)C(this.g[a],b);this.depth&&C(this.c,b);delete this.b[d]}return this}; | ||
f.prototype.search=function(b,a,c,d){let e=b;let f=[];if("object"===typeof b){(c=b.callback||a)&&(e.callback=null);a=b.limit;var g=b.threshold;b=b.query}g||(g=this.threshold||0);A(a)?(c=a,a=1E3):a||0===a||(a=1E3);if(!d){if(this.async&&"function"!==typeof importScripts){let b=this;g=new Promise(function(c){setTimeout(function(){c(b.search(e,a,null,!0));b=null})});if(c)g.then(c);else return g;return this}if(c)return c(this.search(e,a,null,!0)),this}if(!b||!z(b))return f;e=b;e=this.encode(e);if(!e.length)return f; | ||
c=this.a;c=A(c)?c(e):e.split(I);b=c.length;d=!0;const k=[],l=u();let n;if(1<b)if(this.depth){n=!0;var h=c[0];l[h]=1}else c.sort(M);let p;if(!n||(p=this.c)[h])for(let a=n?1:0;a<b;a++){const b=c[a];if(b){if(!l[b]){const a=[];let c=!1,e=0;if(h=n?p[h]:this.g){let d;for(let f=0;f<10-g;f++)if(d=h[f][b])a[e++]=d,c=!0}if(c)k[k.length]=1<e?a.concat.apply([],a):a[0];else{d=!1;break}l[b]=1}h=b}}else d=!1;d&&(f=O(k,a,!1));return f};f.prototype.clear=function(){return this.destroy().init()};f.prototype.destroy= | ||
function(){this.g=this.c=this.b=null;return this};const x={icase:function(b){return b.toLowerCase()},simple:function(){const b=[d("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",d("[\u00e8\u00e9\u00ea\u00eb]"),"e",d("[\u00ec\u00ed\u00ee\u00ef]"),"i",d("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",d("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",d("[\u00fd\u0177\u00ff]"),"y",d("\u00f1"),"n",d("\u00e7"),"c",d("\u00df"),"s",d(" & ")," and ",d("[-/]")," ",d("[^a-z0-9 ]"),"",d("\\s+")," "];return function(a){a= | ||
k(a.toLowerCase(),b);return" "===a?"":a}}(),advanced:function(){const b=[d("ae"),"a",d("ai"),"ei",d("ay"),"ei",d("ey"),"ei",d("oe"),"o",d("ue"),"u",d("ie"),"i",d("sz"),"s",d("zs"),"s",d("sh"),"s",d("ck"),"k",d("cc"),"k",d("dt"),"t",d("ph"),"f",d("pf"),"f",d("ou"),"o",d("uo"),"u"];return function(a,c){if(!a)return a;a=this.simple(a);2<a.length&&(a=k(a,b));c||1<a.length&&(a=D(a));return a}}(),extra:function(){const b=[d("p"),"b",d("z"),"s",d("[cgq]"),"k",d("n"),"m",d("d"),"t",d("[vw]"),"f",d("[aeiouy]"), | ||
""];return function(a){if(!a)return a;a=this.advanced(a,!0);if(1<a.length){a=a.split(" ");for(let c=0;c<a.length;c++){const d=a[c];1<d.length&&(a[c]=d[0]+k(d.substring(1),b))}a=a.join(" ");a=D(a)}return a}}(),balance:function(){const b=[d("[-/]")," ",d("[^a-z0-9 ]"),"",d("\\s+")," "];return function(a){return D(k(a.toLowerCase(),b))}}()};return f}(!1),this); | ||
'use strict';(function(f,x,d){let p;(p=d.define)&&p.amd?p([],function(){return x}):(p=d.modules)?p[f.toLowerCase()]=x:"object"===typeof exports?module.exports=x:d[f]=x})("FlexSearch",function(){function f(a,b){const c=b?b.id:a&&a.id;this.id=c||0===c?c:M++;this.init(a,b);x(this,"index",function(){return this.c});x(this,"length",function(){return Object.keys(this.c).length})}function x(a,b,c){Object.defineProperty(a,b,{get:c})}function d(a){return new RegExp(a,"g")}function p(a,b){for(let c=0;c<b.length;c+= | ||
2)a=a.replace(b[c],b[c+1]);return a}function A(a,b,c,h,g,l,e){if(b[c])return b[c];g=g?(9-(e||6))*l+(e||6)*g:l;b[c]=g;g>=e&&(a=a[9-(g+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=h);return g}function E(a,b){if(a){const c=Object.keys(a);for(let h=0,g=c.length;h<g;h++){const g=c[h],e=a[g];if(e)for(let c=0,h=e.length;c<h;c++)if(e[c]===b){1===h?delete a[g]:e.splice(c,1);break}else y(e[c])&&E(e[c],b)}}}function F(a){let b="",c="";var h="";for(let g=0;g<a.length;g++){const l=a[g];if(l!==c)if(g&&"h"===l){if(h="a"=== | ||
h||"e"===h||"i"===h||"o"===h||"u"===h||"y"===h,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&h||" "===c)b+=l}else b+=l;h=g===a.length-1?"":a[g+1];c=l}return b}function N(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function O(a,b){a=a.length-b.length;return 0>a?-1:a?1:0}function P(a,b,c,h){let g=[],l;const e=a.length;if(1<e){a.sort(O);const n=v();let q=a[0],k=q.length,r=0;for(;r<k;)n["@"+q[r++]]=1;let m,f=0,t=0;for(;++t<e;){let w=!1;const p=t===e-1;l=[];q=a[t];k=q.length;for(r=0;r<k;){m= | ||
q[r++];var d="@"+m;if(n[d]){const a=n[d];if(a===t){if(p){if(g[f++]=c?c[d]:m,b&&f===b)return g}else n[d]=t+1;w=!0}else h&&(d=l[a]||(l[a]=[]),d[d.length]=m)}}if(!w&&!h)break}if(h&&(f=g.length,(t=l.length)&&(!b||f<b)))for(;t--;)if(m=l[t])for(r=0,k=m.length;r<k;r++)if(g[f++]=c?c["@"+m[r]]:m[r],b&&f===b)return g}else if(e)if(c)for(a=a[0],h=a.length,b&&b<h&&(h=b),g=Array(h),b=0;b<h;b++)g[b]=c["@"+a[b]];else g=a[0],b&&g.length>b&&(g=g.slice(0,b));return g}function B(a){return"string"===typeof a}function C(a){return"function"=== | ||
typeof a}function y(a){return"object"===typeof a}function D(a){return"undefined"===typeof a}function H(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=v();return b}function v(){return Object.create(null)}const u={encode:"icase",b:"forward",o:!1,cache:!1,async:!1,s:!1,l:!1,threshold:0,depth:0,a:!1},I={memory:{encode:"extra",b:"strict",threshold:7},speed:{encode:"icase",b:"strict",threshold:7,depth:2},match:{encode:"extra",b:"full"},score:{encode:"extra",b:"strict",threshold:5,depth:4},balance:{encode:"balance", | ||
b:"strict",threshold:6,depth:3},fastest:{encode:"icase",b:"strict",threshold:9,depth:1}},G=[];let M=0;const J=d("\\W+"),K={},L={};f.create=function(a){return new f(a)};f.registerMatcher=function(a){for(const b in a)a.hasOwnProperty(b)&&G.push(d(b),a[b]);return this};f.registerEncoder=function(a,b){z[a]=b.bind(z);return this};f.registerLanguage=function(a,b){K[a]=b.filter;L[a]=b.stemmer;return this};f.encode=function(a,b){return z[a](b)};f.prototype.init=function(a,b){this.m=[];if(b){var c=b.preset; | ||
a=b}else a||(a=u),c=a.preset;b={};B(a)?(b=I[a],a={}):c&&(b=I[c]);this.b=a.tokenize||b.b||this.b||u.b;this.l=a.rtl||this.l||u.l;this.async="undefined"===typeof Promise||D(c=a.async)?this.async||u.async:c;this.threshold=D(c=a.threshold)?b.threshold||this.threshold||u.threshold:c;this.depth=D(c=a.depth)?b.depth||this.depth||u.depth:c;this.h=(c=D(c=a.encode)?b.encode||u.encode:c)&&z[c]&&z[c].bind(z)||(C(c)?c:this.h||!1);(c=a.matcher)&&this.addMatcher(c);if(c=a.filter){c=K[c]||c;b=this.h;var h=v();if(c)for(var g= | ||
0;g<c.length;g++){var l=b?b(c[g]):c[g];h[l]=String.fromCharCode(65E3-c.length+g)}this.filter=c=h}if(c=a.stemmer){var e;b=L[c]||c;h=this.h;g=[];if(b)for(e in b)b.hasOwnProperty(e)&&(l=h?h(e):e,g.push(d("(?=.{"+(l.length+3)+",})"+l+"$"),h?h(b[e]):b[e]));this.stemmer=e=g}this.a=e=(c=a.doc)?c:this.a||u.a;this.j=H(10-(this.threshold||0));this.g=v();this.c=v();this.f=e&&v();if(e)if(a.doc=null,c=e.field,b=e.index=[],h=e.ref={},e.id=e.id.split(":"),c.constructor===Array)for(e=0;e<c.length;e++)h[c[e]]=e,c[e]= | ||
c[e].split(":"),b[e]=new f(a),b[e].f=this.f;else h[c]=0,e.field=[c.split(":")],b[0]=new f(a),b[0].f=this.f;return this};f.prototype.encode=function(a){a&&G.length&&(a=p(a,G));a&&this.m.length&&(a=p(a,this.m));a&&this.h&&(a=this.h(a));a&&this.stemmer&&(a=p(a,this.stemmer));return a};f.prototype.addMatcher=function(a){const b=this.m;for(const c in a)a.hasOwnProperty(c)&&b.push(d(c),a[c]);return this};f.prototype.add=function(a,b,c,h,g){if(this.a&&y(a))return this.i("add",a,b);if(b&&B(b)&&(a||0===a)){var l= | ||
"@"+a;if(this.c[l]&&!h)return this.update(a,b);if(!g){if(this.async&&"function"!==typeof importScripts){let e=this;l=new Promise(function(c){setTimeout(function(){e.add(a,b,null,h,!0);e=null;c()})});if(c)l.then(c);else return l;return this}if(c)return this.add(a,b,null,h,!0),c(),this}b=this.encode(b);if(!b.length)return this;c=this.b;g=C(c)?c(b):b.split(J);const q=v();q._ctx=v();const m=this.threshold,p=this.depth,t=this.j,w=g.length,u=this.l;for(let b=0;b<w;b++){var e=g[b];if(e){var d=e.length,n= | ||
(u?b+1:w-b)/w,f="";switch(c){case "reverse":case "both":for(var k=d;--k;)f=e[k]+f,A(t,q,f,a,u?1:(d-k)/d,n,m);f="";case "forward":for(k=0;k<d;k++)f+=e[k],A(t,q,f,a,u?(k+1)/d:1,n,m);break;case "full":for(k=0;k<d;k++){const b=(u?k+1:d-k)/d;for(let c=d;c>k;c--)f=e.substring(k,c),A(t,q,f,a,b,n,m)}break;default:if(d=A(t,q,e,a,1,n,m),p&&1<w&&d>=m)for(d=q._ctx[e]||(q._ctx[e]=v()),e=this.g[e]||(this.g[e]=H(10-(m||0))),n=b-p,f=b+p+1,0>n&&(n=0),f>w&&(f=w);n<f;n++)n!==b&&A(e,d,g[n],a,0,10-(n<b?b-n:n-b),m)}}}this.c[l]= | ||
1}return this};f.prototype.i=function(a,b,c){if(b.constructor===Array)for(let d=0,e=b.length;d<e;d++){if(d===e-1)return this.i(a,b[d],c);this.i(a,b[d])}else{const h=this.a.index;let e=this.a.id,f;for(var d=0;d<e.length;d++)f=(f||b)[e[d]];if("remove"===a){delete this.f["@"+f];for(let a=0,b=h.length;a<b;a++){if(a===b-1)return h[a].remove(f,c);h[a].remove(f)}}e=this.a.field;for(let l=0,q=e.length;l<q;l++){d=e[l];let k;for(var g=0;g<d.length;g++)k=(k||b)[d[g]];this.f["@"+f]=b;d=h[l];g="add"===a?d.add: | ||
d.update;if(l===q-1)return g.call(d,f,k,c);g.call(d,f,k)}}};f.prototype.update=function(a,b,c){if(this.a&&y(a))return this.i("update",a,b);this.c["@"+a]&&B(b)&&(this.remove(a),this.add(a,b,c,!0));return this};f.prototype.remove=function(a,b,c){if(this.a&&y(a))return this.i("remove",a,b);var d="@"+a;if(this.c[d]){if(!c){if(this.async&&"function"!==typeof importScripts){let c=this;d=new Promise(function(b){setTimeout(function(){c.remove(a,null,!0);c=null;b()})});if(b)d.then(b);else return d;return this}if(b)return this.remove(a, | ||
null,!0),b(),this}for(b=0;b<10-(this.threshold||0);b++)E(this.j[b],a);this.depth&&E(this.g,a);delete this.c[d]}return this};f.prototype.search=function(a,b,c,d){if(y(b)){if(b.constructor===Array)for(var g=0;g<b.length;g++)b[g].query=a;else b.query=a;a=b;b=0}let f=a;let e=[];if(y(a)&&a.constructor!==Array){(c=a.callback||b)&&(f.callback=null);b=a.limit;var h=a.threshold;var n=a.boost;a=a.query}if(this.a){h=this.a.ref;var p=this.a.index,k=f.field;if(k)f.field=null;else if(f.constructor===Array){var r= | ||
f;k=[];for(var m=0;m<f.length;m++)k[m]=f[m].field}else k=Object.keys(h);if(y(k)){k.constructor===Array||(k=[k]);m=k.length;for(a=0;a<m;a++)r&&(f=r[a]),e[a]=p[h[k[a]]].search(f);return c?c(e.concat.apply([],e)):this.async?new Promise(function(a){Promise.all(e).then(function(b){a(b.concat.apply([],b))})}):e.concat.apply([],e)}return p[h[k]].search(f,c)}h||(h=this.threshold||0);C(b)?(c=b,b=1E3):b||0===b||(b=1E3);if(!d){if(this.async&&"function"!==typeof importScripts){let a=this;h=new Promise(function(c){setTimeout(function(){c(a.search(f, | ||
b,null,!0));a=null})});if(c)h.then(c);else return h;return this}if(c)return c(this.search(f,b,null,!0)),this}if(!a||!B(a))return e;f=a;f=this.encode(f);if(!f.length)return e;c=this.b;c=C(c)?c(f):f.split(J);r=c.length;a=!0;d=[];g=v();1<r&&(this.depth?(p=!0,m=c[0],g[m]=1):c.sort(N));if(!p||(k=this.g)[m]){let b=0;n&&(h=(h||1)/n,0>n&&(b=h));for(n=p?1:0;n<r;n++){const e=c[n];if(e){if(!g[e]){const c=[];let f=!1,l=0;if(m=p?k[m]:this.j){let a;for(let d=b;d<10-h;d++)if(a=m[d][e])c[l++]=a,f=!0}if(f)d[d.length]= | ||
1<l?c.concat.apply([],c):c[0];else{a=!1;break}g[e]=1}m=e}}}else a=!1;a&&(e=P(d,b,this.f,!1));return e};f.prototype.clear=function(){return this.destroy().init()};f.prototype.destroy=function(){this.j=this.g=this.c=null;return this};const z={icase:function(a){return a.toLowerCase()},simple:function(){const a=[d("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",d("[\u00e8\u00e9\u00ea\u00eb]"),"e",d("[\u00ec\u00ed\u00ee\u00ef]"),"i",d("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",d("[\u00f9\u00fa\u00fb\u00fc\u0171]"), | ||
"u",d("[\u00fd\u0177\u00ff]"),"y",d("\u00f1"),"n",d("\u00e7"),"c",d("\u00df"),"s",d(" & ")," and ",d("[-/]")," ",d("[^a-z0-9 ]"),"",d("\\s+")," "];return function(b){b=p(b.toLowerCase(),a);return" "===b?"":b}}(),advanced:function(){const a=[d("ae"),"a",d("ai"),"ei",d("ay"),"ei",d("ey"),"ei",d("oe"),"o",d("ue"),"u",d("ie"),"i",d("sz"),"s",d("zs"),"s",d("sh"),"s",d("ck"),"k",d("cc"),"k",d("dt"),"t",d("ph"),"f",d("pf"),"f",d("ou"),"o",d("uo"),"u"];return function(b,c){if(!b)return b;b=this.simple(b); | ||
2<b.length&&(b=p(b,a));c||1<b.length&&(b=F(b));return b}}(),extra:function(){const a=[d("p"),"b",d("z"),"s",d("[cgq]"),"k",d("n"),"m",d("d"),"t",d("[vw]"),"f",d("[aeiouy]"),""];return function(b){if(!b)return b;b=this.advanced(b,!0);if(1<b.length){b=b.split(" ");for(let c=0;c<b.length;c++){const d=b[c];1<d.length&&(b[c]=d[0]+p(d.substring(1),a))}b=b.join(" ");b=F(b)}return b}}(),balance:function(){const a=[d("[-/]")," ",d("[^a-z0-9 ]"),"",d("\\s+")," "];return function(b){return F(p(b.toLowerCase(), | ||
a))}}()};return f}(!1),this); |
/* | ||
FlexSearch v0.3.61 | ||
FlexSearch v0.4.0 | ||
Copyright 2019 Nextapps GmbH | ||
@@ -8,31 +8,35 @@ Author: Thomas Wilkerling | ||
*/ | ||
'use strict';function K(g){var k=0;return function(){return k<g.length?{done:!1,value:g[k++]}:{done:!0}}}function L(g){var k="undefined"!=typeof Symbol&&Symbol.iterator&&g[Symbol.iterator];return k?k.call(g):{next:K(g)}}var R="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this,S="function"==typeof Object.defineProperties?Object.defineProperty:function(g,k,e){g!=Array.prototype&&g!=Object.prototype&&(g[k]=e.value)}; | ||
function T(g,k){if(k){var e=R;g=g.split(".");for(var h=0;h<g.length-1;h++){var l=g[h];l in e||(e[l]={});e=e[l]}g=g[g.length-1];h=e[g];k=k(h);k!=h&&null!=k&&S(e,g,{configurable:!0,writable:!0,value:k})}} | ||
T("Promise",function(g){function k(d){this.b=0;this.i=void 0;this.a=[];var c=this.c();try{d(c.resolve,c.reject)}catch(D){c.reject(D)}}function e(){this.a=null}function h(d){return d instanceof k?d:new k(function(c){c(d)})}if(g)return g;e.prototype.b=function(d){if(null==this.a){this.a=[];var c=this;this.c(function(){c.i()})}this.a.push(d)};var l=R.setTimeout;e.prototype.c=function(d){l(d,0)};e.prototype.i=function(){for(;this.a&&this.a.length;){var d=this.a;this.a=[];for(var c=0;c<d.length;++c){var e= | ||
d[c];d[c]=null;try{e()}catch(E){this.f(E)}}}this.a=null};e.prototype.f=function(d){this.c(function(){throw d;})};k.prototype.c=function(){function d(d){return function(k){e||(e=!0,d.call(c,k))}}var c=this,e=!1;return{resolve:d(this.G),reject:d(this.f)}};k.prototype.G=function(d){if(d===this)this.f(new TypeError("A Promise cannot resolve to itself"));else if(d instanceof k)this.H(d);else{a:switch(typeof d){case "object":var c=null!=d;break a;case "function":c=!0;break a;default:c=!1}c?this.F(d):this.j(d)}}; | ||
k.prototype.F=function(d){var c=void 0;try{c=d.then}catch(D){this.f(D);return}"function"==typeof c?this.I(c,d):this.j(d)};k.prototype.f=function(c){this.m(2,c)};k.prototype.j=function(c){this.m(1,c)};k.prototype.m=function(c,e){if(0!=this.b)throw Error("Cannot settle("+c+", "+e+"): Promise already settled in state"+this.b);this.b=c;this.i=e;this.u()};k.prototype.u=function(){if(null!=this.a){for(var d=0;d<this.a.length;++d)c.b(this.a[d]);this.a=null}};var c=new e;k.prototype.H=function(c){var d=this.c(); | ||
c.A(d.resolve,d.reject)};k.prototype.I=function(c,e){var d=this.c();try{c.call(e,d.resolve,d.reject)}catch(E){d.reject(E)}};k.prototype.then=function(c,e){function d(c,d){return"function"==typeof c?function(d){try{g(c(d))}catch(v){h(v)}}:d}var g,h,A=new k(function(c,d){g=c;h=d});this.A(d(c,g),d(e,h));return A};k.prototype.catch=function(c){return this.then(void 0,c)};k.prototype.A=function(d,e){function k(){switch(g.b){case 1:d(g.i);break;case 2:e(g.i);break;default:throw Error("Unexpected state: "+ | ||
g.b);}}var g=this;null==this.a?c.b(k):this.a.push(k)};k.resolve=h;k.reject=function(c){return new k(function(d,e){e(c)})};k.race=function(c){return new k(function(d,e){for(var k=L(c),g=k.next();!g.done;g=k.next())h(g.value).A(d,e)})};k.all=function(c){var d=L(c),e=d.next();return e.done?h([]):new k(function(c,k){function g(d){return function(e){l[d]=e;C--;0==C&&c(l)}}var l=[],C=0;do l.push(void 0),C++,h(e.value).A(g(l.length-1),k),e=d.next();while(!e.done)})};return k}); | ||
(function(g,k,e){var h;(h=e.define)&&h.amd?h([],function(){return k}):(h=e.modules)?h[g.toLowerCase()]=k:"object"===typeof exports?module.exports=k:e[g]=k})("FlexSearch",function X(g){function e(b){C(b)&&((b=M[b])||console.warn("Preset not found: "+b));b||(b=r);this.id=b.id||Y++;this.init(b);l(this,"index",function(){return this.a});l(this,"length",function(){return Object.keys(this.a).length})}function h(b,a,f,c){this.v!==this.h&&(this.l=this.l.concat(f),this.v++,c&&this.l.length>=c&&(this.v=this.h), | ||
this.C&&this.v===this.h&&(this.cache&&this.o.set(a,this.l),this.C(this.l),this.l=[]));return this}function l(b,a,f){Object.defineProperty(b,a,{get:f})}function c(b){return new RegExp(b,"g")}function d(b,a){for(var f=0;f<a.length;f+=2)b=b.replace(a[f],a[f+1]);return b}function A(b,a,f,c,d,e,g){if(a[f])return a[f];d=d?(9-(g||4.5))*e+(g||4.5)*d:e;a[f]=d;d>=g&&(b=b[9-(d+.5>>0)],b=b[f]||(b[f]=[]),b[b.length]=c);return d}function D(b,a){if(b)for(var f=Object.keys(b),c=0,d=f.length;c<d;c++){var e=f[c],g= | ||
b[e];if(g)for(var y=0,h=g.length;y<h;y++)if(g[y]===a){1===h?delete b[e]:g.splice(y,1);break}else"object"===typeof g[y]&&D(g[y],a)}}function E(b){for(var a="",f="",c="",d=0;d<b.length;d++){var e=b[d];if(e!==f)if(d&&"h"===e){if(c="a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c,("a"===f||"e"===f||"i"===f||"o"===f||"u"===f||"y"===f)&&c||" "===f)a+=e}else a+=e;c=d===b.length-1?"":b[d+1];f=e}return a}function U(b,a){b=b.length-a.length;return 0>b?1:b?-1:0}function W(b,a){b=b.length-a.length;return 0> | ||
b?-1:b?1:0}function V(b,a,f){var c=[],d=b.length;if(1<d){b.sort(W);for(var e=z(),g=b[0],y=g.length,h=0;h<y;)e["@"+g[h++]]=1;for(var l,F=0,q=0;++q<d;){var x=!1,u=q===d-1;var p=[];g=b[q];y=g.length;for(h=0;h<y;){l=g[h++];var m="@"+l;if(e[m]){var n=e[m];if(n===q){if(u){if(c[F++]=l,a&&F===a)return c}else e[m]=q+1;x=!0}else f&&(m=p[n]||(p[n]=[]),m[m.length]=l)}}if(!x&&!f)break}if(f&&(F=c.length,(q=p.length)&&(!a||F<a)))for(;q--;)if(l=p[q])for(h=0,y=l.length;h<y;h++)if(c[F++]=l[h],a&&F===a)return c}else d&& | ||
(c=b[0],a&&c.length>a&&(c=c.slice(0,a)));return c}function C(b){return"string"===typeof b}function H(b){return"function"===typeof b}function v(b){return"undefined"===typeof b}function N(b){for(var a=Array(b),f=0;f<b;f++)a[f]=z();return a}function z(){return Object.create(null)}function Z(){var b,a;self.onmessage=function(f){if(f=f.data)if(f.search){var c=a.search(f.content,f.threshold?{limit:f.limit,threshold:f.threshold}:f.limit);self.postMessage({id:b,content:f.content,limit:f.limit,result:c})}else f.add? | ||
a.add(f.id,f.content):f.update?a.update(f.id,f.content):f.remove?a.remove(f.id):f.clear?a.clear():f.info?(f=a.info(),f.worker=b,console.log(f)):f.register&&(b=f.id,f.options.cache=!1,f.options.async=!1,f.options.worker=!1,a=(new Function(f.register.substring(f.register.indexOf("{")+1,f.register.lastIndexOf("}"))))(),a=new a(f.options))}}function aa(b,a,f,c){b=g("flexsearch","id"+b,Z,function(a){(a=a.data)&&a.result&&c(a.id,a.content,a.result,a.limit)},a);var d=X.toString();f.id=a;b.postMessage({register:d, | ||
options:f,id:a});return b}var r={encode:"icase",g:"forward",w:!1,cache:!1,async:!1,h:!1,B:!1,threshold:0,depth:0},M={memory:{encode:"extra",g:"strict",threshold:7},speed:{encode:"icase",g:"strict",threshold:7,depth:2},match:{encode:"extra",g:"full"},score:{encode:"extra",g:"strict",threshold:5,depth:4},balance:{encode:"balance",g:"strict",threshold:6,depth:3},fastest:{encode:"icase",g:"strict",threshold:9,depth:1}},J=[],Y=0,O=c("\\W+"),P={},Q={};e.create=function(b){return new e(b)};e.registerMatcher= | ||
function(b){for(var a in b)b.hasOwnProperty(a)&&J.push(c(a),b[a]);return this};e.registerEncoder=function(b,a){G[b]=a.bind(G);return this};e.registerLanguage=function(b,a){P[b]=a.filter;Q[b]=a.stemmer;return this};e.encode=function(b,a){return G[b](a)};e.prototype.init=function(b){this.i=[];b||(b=r);var a=b.preset,f=a?M[a]:{};f||console.warn("Preset not found: "+a);if(a=b.worker)if("undefined"===typeof Worker)b.worker=!1,this.f=null;else{var d=parseInt(a,10)||4;this.u=-1;this.v=0;this.l=[];this.C= | ||
null;this.f=Array(d);for(var e=0;e<d;e++)this.f[e]=aa(this.id,e,b,h.bind(this))}this.g=b.tokenize||f.g||this.g||r.g;this.B=b.rtl||this.B||r.B;this.async="undefined"===typeof Promise||v(a=b.async)?this.async||r.async:a;this.h=v(a=b.worker)?this.h||r.h:a;this.threshold=v(a=b.threshold)?f.threshold||this.threshold||r.threshold:a;this.depth=v(a=b.depth)?f.depth||this.depth||r.depth:a;this.w=v(a=b.suggest)?this.w||r.w:a;this.j=(a=v(a=b.encode)?f.encode:a)&&G[a]&&G[a].bind(G)||(H(a)?a:this.j||!1);(a=b.matcher)&& | ||
this.addMatcher(a);if(a=b.filter){a=P[a]||a;f=this.j;d=z();if(a)for(e=0;e<a.length;e++){var g=f?f(a[e]):a[e];d[g]=String.fromCharCode(65E3-a.length+e)}this.filter=d}if(a=b.stemmer){f=Q[a]||a;d=this.j;e=[];if(f)for(var l in f)f.hasOwnProperty(l)&&(g=d?d(l):l,e.push(c("(?=.{"+(g.length+3)+",})"+g+"$"),d?d(f[l]):f[l]));this.stemmer=e}this.b=N(10-(this.threshold||0));this.c=z();this.a=z();this.m=!0;this.o=(this.cache=a=v(a=b.cache)?this.cache||r.cache:a)?new ba(a):!1;return this};e.prototype.encode=function(b){b&& | ||
J.length&&(b=d(b,J));b&&this.i.length&&(b=d(b,this.i));b&&this.j&&(b=this.j(b));b&&this.stemmer&&(b=d(b,this.stemmer));return b};e.prototype.addMatcher=function(b){var a=this.i,f;for(f in b)b.hasOwnProperty(f)&&a.push(c(f),b[f]);return this};e.prototype.add=function(b,a,f,c,d){if(a&&C(a)&&(b||0===b)){var e="@"+b;if(this.a[e]&&!c)return this.update(b,a);if(this.h)return++this.u>=this.f.length&&(this.u=0),this.f[this.u].postMessage({add:!0,id:b,content:a}),this.a[e]=""+this.u,f&&f(),this;if(!d){if(this.async&& | ||
"function"!==typeof importScripts){var g=this;e=new Promise(function(f){setTimeout(function(){g.add(b,a,null,c,!0);g=null;f()})});if(f)e.then(f);else return e;return this}if(f)return this.add(b,a,null,c,!0),f(),this}a=this.encode(a);if(!a.length)return this;f=this.g;d=H(f)?f(a):a.split(O);var h=z();h._ctx=z();for(var B=this.threshold,l=this.depth,I=this.b,q=d.length,x=this.B,u=0;u<q;u++){var p=d[u];if(p){var m=p.length,n=(x?u+1:q-u)/q,w="";switch(f){case "reverse":case "both":for(var t=m;--t;)w=p[t]+ | ||
w,A(I,h,w,b,x?1:(m-t)/m,n,B);w="";case "forward":for(t=0;t<m;t++)w+=p[t],A(I,h,w,b,x?(t+1)/m:1,n,B);break;case "full":for(t=0;t<m;t++)for(var v=(x?t+1:m-t)/m,r=m;r>t;r--)w=p.substring(t,r),A(I,h,w,b,v,n,B);break;default:if(m=A(I,h,p,b,1,n,B),l&&1<q&&m>=B)for(m=h._ctx[p]||(h._ctx[p]=z()),p=this.c[p]||(this.c[p]=N(10-(B||0))),n=u-l,w=u+l+1,0>n&&(n=0),w>q&&(w=q);n<w;n++)n!==u&&A(p,m,d[n],b,0,10-(n<u?u-n:n-u),B)}}}this.a[e]=1;this.m=!1}return this};e.prototype.update=function(b,a,f){this.a["@"+b]&&C(a)&& | ||
(this.remove(b),this.add(b,a,f,!0));return this};e.prototype.remove=function(b,a,f){var c="@"+b;if(this.a[c]){if(this.h)return this.f[this.a[c]].postMessage({remove:!0,id:b}),delete this.a[c],a&&a(),this;if(!f){if(this.async&&"function"!==typeof importScripts){var d=this;c=new Promise(function(a){setTimeout(function(){d.remove(b,null,!0);d=null;a()})});if(a)c.then(a);else return c;return this}if(a)return this.remove(b,null,!0),a(),this}for(a=0;a<10-(this.threshold||0);a++)D(this.b[a],b);this.depth&& | ||
D(this.c,b);delete this.a[c];this.m=!1}return this};e.prototype.search=function(b,a,c,d){var f=b,e=[];if("object"===typeof b){(c=b.callback||a)&&(f.callback=null);a=b.limit;var g=b.threshold;b=b.query}g||(g=this.threshold||0);H(a)?(c=a,a=1E3):a||0===a||(a=1E3);if(this.h)for(this.C=c,this.v=0,this.l=[],e=0;e<this.h;e++)this.f[e].postMessage({search:!0,limit:a,threshold:g,content:b});else{if(!d){if(this.async&&"function"!==typeof importScripts){var h=this;b=new Promise(function(b){setTimeout(function(){b(h.search(f, | ||
a,null,!0));h=null})});if(c)b.then(c);else return b;return this}if(c)return c(this.search(f,a,null,!0)),this}if(!b||!C(b))return e;f=b;if(this.cache)if(this.m){if(c=this.o.get(b))return c}else this.o.clear(),this.m=!0;f=this.encode(f);if(!f.length)return e;c=this.g;c=H(c)?c(f):f.split(O);d=c.length;var l=!0,B=[],r=z();if(1<d)if(this.depth){var q=!0;var x=c[0];r[x]=1}else c.sort(U);var u;if(!q||(u=this.c)[x])for(var p=q?1:0;p<d;p++){var m=c[p];if(m){if(!r[m]){var n=[],w=!1,t=0;if(x=q?u[x]:this.b)for(var v= | ||
void 0,A=0;A<10-g;A++)if(v=x[A][m])n[t++]=v,w=!0;if(w)B[B.length]=1<t?n.concat.apply([],n):n[0];else if(!this.w){l=!1;break}r[m]=1}x=m}}else l=!1;l&&(e=V(B,a,this.w));this.cache&&this.o.set(b,e);return e}};e.prototype.info=function(){if(this.h)for(var b=0;b<this.h;b++)this.f[b].postMessage({info:!0,id:this.id});else{for(var a,c=0,d=0,e=0,g=0;g<10-(this.threshold||0);g++){b=Object.keys(this.b[g]);for(var h=0;h<b.length;h++)a=this.b[g][b[h]].length,c+=1*a+2*b[h].length+4,d+=a,e+=2*b[h].length}b=Object.keys(this.a); | ||
a=b.length;for(g=0;g<a;g++)c+=2*b[g].length+2;return{id:this.id,memory:c,items:a,sequences:d,chars:e,cache:this.cache&&this.cache.s?this.cache.s.length:!1,matcher:J.length+(this.i?this.i.length:0),worker:this.h,threshold:this.threshold,depth:this.depth,contextual:this.depth&&"strict"===this.g}}};e.prototype.clear=function(){return this.destroy().init()};e.prototype.destroy=function(){this.cache&&(this.o.clear(),this.o=null);this.b=this.c=this.a=null;return this};e.prototype.export=function(){return JSON.stringify([this.b, | ||
this.c,this.a])};e.prototype.import=function(b){b=JSON.parse(b);this.b=b[0];this.c=b[1];this.a=b[2]};var G={icase:function(b){return b.toLowerCase()},simple:function(){var b=[c("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",c("[\u00e8\u00e9\u00ea\u00eb]"),"e",c("[\u00ec\u00ed\u00ee\u00ef]"),"i",c("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",c("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",c("[\u00fd\u0177\u00ff]"),"y",c("\u00f1"),"n",c("\u00e7"),"c",c("\u00df"),"s",c(" & ")," and ",c("[-/]")," ",c("[^a-z0-9 ]"), | ||
"",c("\\s+")," "];return function(a){a=d(a.toLowerCase(),b);return" "===a?"":a}}(),advanced:function(){var b=[c("ae"),"a",c("ai"),"ei",c("ay"),"ei",c("ey"),"ei",c("oe"),"o",c("ue"),"u",c("ie"),"i",c("sz"),"s",c("zs"),"s",c("sh"),"s",c("ck"),"k",c("cc"),"k",c("dt"),"t",c("ph"),"f",c("pf"),"f",c("ou"),"o",c("uo"),"u"];return function(a,c){if(!a)return a;a=this.simple(a);2<a.length&&(a=d(a,b));c||1<a.length&&(a=E(a));return a}}(),extra:function(){var b=[c("p"),"b",c("z"),"s",c("[cgq]"),"k",c("n"),"m", | ||
c("d"),"t",c("[vw]"),"f",c("[aeiouy]"),""];return function(a){if(!a)return a;a=this.advanced(a,!0);if(1<a.length){a=a.split(" ");for(var c=0;c<a.length;c++){var e=a[c];1<e.length&&(a[c]=e[0]+d(e.substring(1),b))}a=a.join(" ");a=E(a)}return a}}(),balance:function(){var b=[c("[-/]")," ",c("[^a-z0-9 ]"),"",c("\\s+")," "];return function(a){return E(d(a.toLowerCase(),b))}}()},ba=function(){function b(a){this.clear();this.D=!0!==a&&a}b.prototype.clear=function(){this.cache=z();this.count=z();this.index= | ||
z();this.s=[]};b.prototype.set=function(a,b){if(this.D&&v(this.cache[a])){var c=this.s.length;if(c===this.D){c--;var e=this.s[c];delete this.cache[e];delete this.count[e];delete this.index[e]}this.index[a]=c;this.s[c]=a;this.count[a]=-1;this.cache[a]=b;this.get(a)}else this.cache[a]=b};b.prototype.get=function(a){var b=this.cache[a];if(this.D&&b){var c=++this.count[a],e=this.index,d=e[a];if(0<d){for(var g=this.s,h=d;this.count[g[--d]]<=c&&-1!==d;);d++;if(d!==h){for(c=h;c>d;c--)h=g[c-1],g[c]=h,e[h]= | ||
c;g[d]=a;e[a]=d}}}return b};return b}();return e}(function(){var g={},k="undefined"!==typeof Blob&&"undefined"!==typeof URL&&URL.createObjectURL;return function(e,h,l,c,d){l=k?URL.createObjectURL(new Blob(["("+l.toString()+")()"],{type:"text/javascript"})):e+".es5.js";e+="-"+h;g[e]||(g[e]=[]);g[e][d]=new Worker(l);g[e][d].onmessage=c;console.log("Register Worker: "+e+"@"+d);return g[e][d]}}()),this); | ||
'use strict';function L(g){var l=0;return function(){return l<g.length?{done:!1,value:g[l++]}:{done:!0}}}function M(g){var l="undefined"!=typeof Symbol&&Symbol.iterator&&g[Symbol.iterator];return l?l.call(g):{next:L(g)}}var S="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this,T="function"==typeof Object.defineProperties?Object.defineProperty:function(g,l,d){g!=Array.prototype&&g!=Object.prototype&&(g[l]=d.value)}; | ||
function U(g,l){if(l){var d=S;g=g.split(".");for(var m=0;m<g.length-1;m++){var k=g[m];k in d||(d[k]={});d=d[k]}g=g[g.length-1];m=d[g];l=l(m);l!=m&&null!=l&&T(d,g,{configurable:!0,writable:!0,value:l})}} | ||
U("Promise",function(g){function l(e){this.f=0;this.o=void 0;this.a=[];var d=this.i();try{e(d.resolve,d.reject)}catch(C){d.reject(C)}}function d(){this.a=null}function m(e){return e instanceof l?e:new l(function(d){d(e)})}if(g)return g;d.prototype.f=function(e){if(null==this.a){this.a=[];var d=this;this.i(function(){d.o()})}this.a.push(e)};var k=S.setTimeout;d.prototype.i=function(e){k(e,0)};d.prototype.o=function(){for(;this.a&&this.a.length;){var e=this.a;this.a=[];for(var d=0;d<e.length;++d){var f= | ||
e[d];e[d]=null;try{f()}catch(G){this.l(G)}}}this.a=null};d.prototype.l=function(e){this.i(function(){throw e;})};l.prototype.i=function(){function e(e){return function(l){f||(f=!0,e.call(d,l))}}var d=this,f=!1;return{resolve:e(this.L),reject:e(this.l)}};l.prototype.L=function(e){if(e===this)this.l(new TypeError("A Promise cannot resolve to itself"));else if(e instanceof l)this.M(e);else{a:switch(typeof e){case "object":var d=null!=e;break a;case "function":d=!0;break a;default:d=!1}d?this.K(e):this.v(e)}}; | ||
l.prototype.K=function(e){var d=void 0;try{d=e.then}catch(C){this.l(C);return}"function"==typeof d?this.N(d,e):this.v(e)};l.prototype.l=function(d){this.I(2,d)};l.prototype.v=function(d){this.I(1,d)};l.prototype.I=function(d,f){if(0!=this.f)throw Error("Cannot settle("+d+", "+f+"): Promise already settled in state"+this.f);this.f=d;this.o=f;this.J()};l.prototype.J=function(){if(null!=this.a){for(var d=0;d<this.a.length;++d)f.f(this.a[d]);this.a=null}};var f=new d;l.prototype.M=function(d){var e=this.i(); | ||
d.D(e.resolve,e.reject)};l.prototype.N=function(d,f){var e=this.i();try{d.call(f,e.resolve,e.reject)}catch(G){e.reject(G)}};l.prototype.then=function(d,f){function e(d,e){return"function"==typeof d?function(e){try{g(d(e))}catch(E){m(E)}}:e}var g,m,D=new l(function(d,e){g=d;m=e});this.D(e(d,g),e(f,m));return D};l.prototype.catch=function(d){return this.then(void 0,d)};l.prototype.D=function(d,l){function e(){switch(g.f){case 1:d(g.o);break;case 2:l(g.o);break;default:throw Error("Unexpected state: "+ | ||
g.f);}}var g=this;null==this.a?f.f(e):this.a.push(e)};l.resolve=m;l.reject=function(d){return new l(function(e,f){f(d)})};l.race=function(d){return new l(function(e,f){for(var l=M(d),g=l.next();!g.done;g=l.next())m(g.value).D(e,f)})};l.all=function(d){var e=M(d),f=e.next();return f.done?m([]):new l(function(d,l){function g(e){return function(f){k[e]=f;F--;0==F&&d(k)}}var k=[],F=0;do k.push(void 0),F++,m(f.value).D(g(k.length-1),l),f=e.next();while(!f.done)})};return l}); | ||
(function(g,l,d){var m;(m=d.define)&&m.amd?m([],function(){return l}):(m=d.modules)?m[g.toLowerCase()]=l:"object"===typeof exports?module.exports=l:d[g]=l})("FlexSearch",function Y(g){function d(a,b){var c=b?b.id:a&&a.id;this.id=c||0===c?c:Z++;this.init(a,b);k(this,"index",function(){return this.b});k(this,"length",function(){return Object.keys(this.b).length})}function m(a,b,c,d){this.B!==this.h&&(this.u=this.u.concat(c),this.B++,d&&this.u.length>=d&&(this.B=this.h),this.G&&this.B===this.h&&(this.cache&& | ||
this.w.set(b,this.u),this.G(this.u),this.u=[]));return this}function k(a,b,c){Object.defineProperty(a,b,{get:c})}function f(a){return new RegExp(a,"g")}function e(a,b){for(var c=0;c<b.length;c+=2)a=a.replace(b[c],b[c+1]);return a}function D(a,b,c,d,h,u,e){if(b[c])return b[c];h=h?(9-(e||6))*u+(e||6)*h:u;b[c]=h;h>=e&&(a=a[9-(h+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=d);return h}function C(a,b){if(a)for(var c=Object.keys(a),d=0,h=c.length;d<h;d++){var u=c[d],e=a[u];if(e)for(var f=0,g=e.length;f<g;f++)if(e[f]=== | ||
b){1===g?delete a[u]:e.splice(f,1);break}else E(e[f])&&C(e[f],b)}}function G(a){for(var b="",c="",d="",h=0;h<a.length;h++){var u=a[h];if(u!==c)if(h&&"h"===u){if(d="a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&d||" "===c)b+=u}else b+=u;d=h===a.length-1?"":a[h+1];c=u}return b}function V(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function X(a,b){a=a.length-b.length;return 0>a?-1:a?1:0}function W(a,b,c,d){var h=[],u=a.length;if(1<u){a.sort(X); | ||
for(var e=B(),f=a[0],r=f.length,g=0;g<r;)e["@"+f[g++]]=1;for(var p,m=0,q=0;++q<u;){var k=!1,x=q===u-1;var v=[];f=a[q];r=f.length;for(g=0;g<r;){p=f[g++];var n="@"+p;if(e[n]){var w=e[n];if(w===q){if(x){if(h[m++]=c?c[n]:p,b&&m===b)return h}else e[n]=q+1;k=!0}else d&&(n=v[w]||(v[w]=[]),n[n.length]=p)}}if(!k&&!d)break}if(d&&(m=h.length,(q=v.length)&&(!b||m<b)))for(;q--;)if(p=v[q])for(g=0,r=p.length;g<r;g++)if(h[m++]=c?c["@"+p[g]]:p[g],b&&m===b)return h}else if(u)if(c)for(a=a[0],d=a.length,b&&b<d&&(d=b), | ||
h=Array(d),b=0;b<d;b++)h[b]=c["@"+a[b]];else h=a[0],b&&h.length>b&&(h=h.slice(0,b));return h}function F(a){return"string"===typeof a}function I(a){return"function"===typeof a}function E(a){return"object"===typeof a}function z(a){return"undefined"===typeof a}function N(a){for(var b=Array(a),c=0;c<a;c++)b[c]=B();return b}function B(){return Object.create(null)}function aa(){var a,b;self.onmessage=function(c){if(c=c.data)if(c.search){var d=b.search(c.content,c.threshold?{limit:c.limit,threshold:c.threshold}: | ||
c.limit);self.postMessage({id:a,content:c.content,limit:c.limit,result:d})}else c.add?b.add(c.id,c.content):c.update?b.update(c.id,c.content):c.remove?b.remove(c.id):c.clear?b.clear():c.info?(c=b.info(),c.worker=a,console.log(c)):c.register&&(a=c.id,c.options.cache=!1,c.options.async=!1,c.options.worker=!1,b=(new Function(c.register.substring(c.register.indexOf("{")+1,c.register.lastIndexOf("}"))))(),b=new b(c.options))}}function ba(a,b,c,d){a=g("flexsearch","id"+a,aa,function(a){(a=a.data)&&a.result&& | ||
d(a.id,a.content,a.result,a.limit)},b);var h=Y.toString();c.id=b;a.postMessage({register:h,options:c,id:b});return a}var t={encode:"icase",g:"forward",C:!1,cache:!1,async:!1,h:!1,F:!1,threshold:0,depth:0,c:!1},O={memory:{encode:"extra",g:"strict",threshold:7},speed:{encode:"icase",g:"strict",threshold:7,depth:2},match:{encode:"extra",g:"full"},score:{encode:"extra",g:"strict",threshold:5,depth:4},balance:{encode:"balance",g:"strict",threshold:6,depth:3},fastest:{encode:"icase",g:"strict",threshold:9, | ||
depth:1}},K=[],Z=0,P=f("\\W+"),Q={},R={};d.create=function(a){return new d(a)};d.registerMatcher=function(a){for(var b in a)a.hasOwnProperty(b)&&K.push(f(b),a[b]);return this};d.registerEncoder=function(a,b){H[a]=b.bind(H);return this};d.registerLanguage=function(a,b){Q[a]=b.filter;R[a]=b.stemmer;return this};d.encode=function(a,b){return H[a](b)};d.prototype.init=function(a,b){this.f=[];if(b){var c=b.preset;a=b}else a||(a=t),c=a.preset;b={};F(a)?((b=O[a])||console.warn("Preset not found: "+a),a= | ||
{}):c&&((b=O[c])||console.warn("Preset not found: "+c));if(c=a.worker)if("undefined"===typeof Worker)a.worker=!1,this.a=null;else{var e=parseInt(c,10)||4;this.v=-1;this.B=0;this.u=[];this.G=null;this.a=Array(e);for(var h=0;h<e;h++)this.a[h]=ba(this.id,h,a,m.bind(this))}this.g=a.tokenize||b.g||this.g||t.g;this.F=a.rtl||this.F||t.F;this.async="undefined"===typeof Promise||z(c=a.async)?this.async||t.async:c;this.h=z(c=a.worker)?this.h||t.h:c;this.threshold=z(c=a.threshold)?b.threshold||this.threshold|| | ||
t.threshold:c;this.depth=z(c=a.depth)?b.depth||this.depth||t.depth:c;this.C=z(c=a.suggest)?this.C||t.C:c;this.i=(c=z(c=a.encode)?b.encode||t.encode:c)&&H[c]&&H[c].bind(H)||(I(c)?c:this.i||!1);(c=a.matcher)&&this.addMatcher(c);if(c=a.filter){c=Q[c]||c;b=this.i;e=B();if(c)for(h=0;h<c.length;h++){var u=b?b(c[h]):c[h];e[u]=String.fromCharCode(65E3-c.length+h)}this.filter=e}if(c=a.stemmer){b=R[c]||c;e=this.i;h=[];if(b)for(var g in b)b.hasOwnProperty(g)&&(u=e?e(g):g,h.push(f("(?=.{"+(u.length+3)+",})"+ | ||
u+"$"),e?e(b[g]):b[g]));this.stemmer=h}this.c=h=(c=a.doc)?c:this.c||t.c;this.m=N(10-(this.threshold||0));this.s=B();this.b=B();this.j=h&&B();if(h)if(a.doc=null,g=h.field,b=h.index=[],e=h.ref={},h.id=h.id.split(":"),g.constructor===Array)for(h=0;h<g.length;h++)e[g[h]]=h,g[h]=g[h].split(":"),b[h]=new d(a),b[h].j=this.j;else e[g]=0,h.field=[g.split(":")],b[0]=new d(a),b[0].j=this.j;this.o=!0;this.w=(this.cache=c=z(c=a.cache)?this.cache||t.cache:c)?new ca(c):!1;return this};d.prototype.encode=function(a){a&& | ||
K.length&&(a=e(a,K));a&&this.f.length&&(a=e(a,this.f));a&&this.i&&(a=this.i(a));a&&this.stemmer&&(a=e(a,this.stemmer));return a};d.prototype.addMatcher=function(a){var b=this.f,c;for(c in a)a.hasOwnProperty(c)&&b.push(f(c),a[c]);return this};d.prototype.add=function(a,b,c,d,h){if(this.c&&E(a))return this.l("add",a,b);if(b&&F(b)&&(a||0===a)){var e="@"+a;if(this.b[e]&&!d)return this.update(a,b);if(this.h)return++this.v>=this.a.length&&(this.v=0),this.a[this.v].postMessage({add:!0,id:a,content:b}),this.b[e]= | ||
""+this.v,c&&c(),this;if(!h){if(this.async&&"function"!==typeof importScripts){var f=this;e=new Promise(function(c){setTimeout(function(){f.add(a,b,null,d,!0);f=null;c()})});if(c)e.then(c);else return e;return this}if(c)return this.add(a,b,null,d,!0),c(),this}b=this.encode(b);if(!b.length)return this;c=this.g;h=I(c)?c(b):b.split(P);var g=B();g._ctx=B();for(var r=this.threshold,m=this.depth,p=this.m,k=h.length,q=this.F,A=0;A<k;A++){var x=h[A];if(x){var v=x.length,n=(q?A+1:k-A)/k,w="";switch(c){case "reverse":case "both":for(var y= | ||
v;--y;)w=x[y]+w,D(p,g,w,a,q?1:(v-y)/v,n,r);w="";case "forward":for(y=0;y<v;y++)w+=x[y],D(p,g,w,a,q?(y+1)/v:1,n,r);break;case "full":for(y=0;y<v;y++)for(var t=(q?y+1:v-y)/v,z=v;z>y;z--)w=x.substring(y,z),D(p,g,w,a,t,n,r);break;default:if(v=D(p,g,x,a,1,n,r),m&&1<k&&v>=r)for(v=g._ctx[x]||(g._ctx[x]=B()),x=this.s[x]||(this.s[x]=N(10-(r||0))),n=A-m,w=A+m+1,0>n&&(n=0),w>k&&(w=k);n<w;n++)n!==A&&D(x,v,h[n],a,0,10-(n<A?A-n:n-A),r)}}}this.b[e]=1;this.o=!1}return this};d.prototype.l=function(a,b,c){if(b.constructor=== | ||
Array)for(var d=0,e=b.length;d<e;d++){if(d===e-1)return this.l(a,b[d],c);this.l(a,b[d])}else{d=this.c.index;for(var f=this.c.id,g=0;g<f.length;g++)e=(e||b)[f[g]];if("remove"===a)for(delete this.j["@"+e],f=0,g=d.length;f<g;f++){if(f===g-1)return d[f].remove(e,c);d[f].remove(e)}f=this.c.field;g=0;for(var m=f.length;g<m;g++){for(var k=f[g],J=void 0,p=0;p<k.length;p++)J=(J||b)[k[p]];this.j["@"+e]=b;k=d[g];p="add"===a?k.add:k.update;if(g===m-1)return p.call(k,e,J,c);p.call(k,e,J)}}};d.prototype.update= | ||
function(a,b,c){if(this.c&&E(a))return this.l("update",a,b);this.b["@"+a]&&F(b)&&(this.remove(a),this.add(a,b,c,!0));return this};d.prototype.remove=function(a,b,c){if(this.c&&E(a))return this.l("remove",a,b);var d="@"+a;if(this.b[d]){if(this.h)return this.a[this.b[d]].postMessage({remove:!0,id:a}),delete this.b[d],b&&b(),this;if(!c){if(this.async&&"function"!==typeof importScripts){var e=this;d=new Promise(function(b){setTimeout(function(){e.remove(a,null,!0);e=null;b()})});if(b)d.then(b);else return d; | ||
return this}if(b)return this.remove(a,null,!0),b(),this}for(b=0;b<10-(this.threshold||0);b++)C(this.m[b],a);this.depth&&C(this.s,a);delete this.b[d];this.o=!1}return this};d.prototype.search=function(a,b,c,d){if(E(b)){if(b.constructor===Array)for(var e=0;e<b.length;e++)b[e].query=a;else b.query=a;a=b;b=0}var f=a,g=[];if(E(a)&&a.constructor!==Array){(c=a.callback||b)&&(f.callback=null);b=a.limit;var r=a.threshold;var m=a.boost;a=a.query}if(this.c){a=this.c.ref;r=this.c.index;var k=f.field;if(k)f.field= | ||
null;else if(f.constructor===Array){var p=f;k=[];for(var t=0;t<f.length;t++)k[t]=f[t].field}else k=Object.keys(a);if(E(k)){k.constructor===Array||(k=[k]);t=k.length;for(var q=0;q<t;q++)p&&(f=p[q]),g[q]=r[a[k[q]]].search(f);return c?c(g.concat.apply([],g)):this.async?new Promise(function(a){Promise.all(g).then(function(b){a(b.concat.apply([],b))})}):g.concat.apply([],g)}return r[a[k]].search(f,c)}r||(r=this.threshold||0);I(b)?(c=b,b=1E3):b||0===b||(b=1E3);if(this.h)for(this.G=c,this.B=0,this.u=[], | ||
k=0;k<this.h;k++)this.a[k].postMessage({search:!0,limit:b,threshold:r,content:a});else{if(!d){if(this.async&&"function"!==typeof importScripts){var A=this;a=new Promise(function(a){setTimeout(function(){a(A.search(f,b,null,!0));A=null})});if(c)a.then(c);else return a;return this}if(c)return c(this.search(f,b,null,!0)),this}if(!a||!F(a))return g;f=a;if(this.cache)if(this.o){if(c=this.w.get(a))return c}else this.w.clear(),this.o=!0;f=this.encode(f);if(!f.length)return g;c=this.g;c=I(c)?c(f):f.split(P); | ||
p=c.length;d=!0;e=[];var x=B();1<p&&(this.depth?(k=!0,q=c[0],x[q]=1):c.sort(V));if(!k||(t=this.s)[q]){var v=0;m&&(r=(r||1)/m,0>m&&(v=r));for(m=k?1:0;m<p;m++){var n=c[m];if(n){if(!x[n]){var w=[],y=!1,z=0;if(q=k?t[q]:this.m)for(var D=void 0,C=v;C<10-r;C++)if(D=q[C][n])w[z++]=D,y=!0;if(y)e[e.length]=1<z?w.concat.apply([],w):w[0];else if(!this.C){d=!1;break}x[n]=1}q=n}}}else d=!1;d&&(g=W(e,b,this.j,this.C));this.cache&&this.w.set(a,g);return g}};d.prototype.info=function(){if(this.h)for(var a=0;a<this.h;a++)this.a[a].postMessage({info:!0, | ||
id:this.id});else{for(var b,c=0,d=0,e=0,f=0;f<10-(this.threshold||0);f++){a=Object.keys(this.m[f]);for(var g=0;g<a.length;g++)b=this.m[f][a[g]].length,c+=1*b+2*a[g].length+4,d+=b,e+=2*a[g].length}a=Object.keys(this.b);b=a.length;for(f=0;f<b;f++)c+=2*a[f].length+2;return{id:this.id,memory:c,items:b,sequences:d,chars:e,cache:this.cache&&this.cache.A?this.cache.A.length:!1,matcher:K.length+(this.f?this.f.length:0),worker:this.h,threshold:this.threshold,depth:this.depth,contextual:this.depth&&"strict"=== | ||
this.g}}};d.prototype.clear=function(){return this.destroy().init()};d.prototype.destroy=function(){this.cache&&(this.w.clear(),this.w=null);this.m=this.s=this.b=null;return this};d.prototype.export=function(){if(this.c){for(var a=this.c.index,b=Array(a.length+1),c=0;c<a.length;c++)b[c]=[a[c].m,a[c].s,a[c].b];b[c]=this.j;return JSON.stringify(b)}return JSON.stringify([this.m,this.s,this.b])};d.prototype.import=function(a){a=JSON.parse(a);if(this.c){for(var b=this.c.index,c=b.length,d=0;d<c;d++){var e= | ||
b[d];e.m=a[d][0];e.s=a[d][1];e.b=a[d][2];e.j=a[c]}this.j=a[c]}else this.m=a[0],this.s=a[1],this.b=a[2],this.j=a[3]};var H={icase:function(a){return a.toLowerCase()},simple:function(){var a=[f("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",f("[\u00e8\u00e9\u00ea\u00eb]"),"e",f("[\u00ec\u00ed\u00ee\u00ef]"),"i",f("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",f("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",f("[\u00fd\u0177\u00ff]"),"y",f("\u00f1"),"n",f("\u00e7"),"c",f("\u00df"),"s",f(" & ")," and ",f("[-/]"), | ||
" ",f("[^a-z0-9 ]"),"",f("\\s+")," "];return function(b){b=e(b.toLowerCase(),a);return" "===b?"":b}}(),advanced:function(){var a=[f("ae"),"a",f("ai"),"ei",f("ay"),"ei",f("ey"),"ei",f("oe"),"o",f("ue"),"u",f("ie"),"i",f("sz"),"s",f("zs"),"s",f("sh"),"s",f("ck"),"k",f("cc"),"k",f("dt"),"t",f("ph"),"f",f("pf"),"f",f("ou"),"o",f("uo"),"u"];return function(b,c){if(!b)return b;b=this.simple(b);2<b.length&&(b=e(b,a));c||1<b.length&&(b=G(b));return b}}(),extra:function(){var a=[f("p"),"b",f("z"),"s",f("[cgq]"), | ||
"k",f("n"),"m",f("d"),"t",f("[vw]"),"f",f("[aeiouy]"),""];return function(b){if(!b)return b;b=this.advanced(b,!0);if(1<b.length){b=b.split(" ");for(var c=0;c<b.length;c++){var d=b[c];1<d.length&&(b[c]=d[0]+e(d.substring(1),a))}b=b.join(" ");b=G(b)}return b}}(),balance:function(){var a=[f("[-/]")," ",f("[^a-z0-9 ]"),"",f("\\s+")," "];return function(b){return G(e(b.toLowerCase(),a))}}()},ca=function(){function a(a){this.clear();this.H=!0!==a&&a}a.prototype.clear=function(){this.cache=B();this.count= | ||
B();this.index=B();this.A=[]};a.prototype.set=function(a,c){if(this.H&&z(this.cache[a])){var b=this.A.length;if(b===this.H){b--;var d=this.A[b];delete this.cache[d];delete this.count[d];delete this.index[d]}this.index[a]=b;this.A[b]=a;this.count[a]=-1;this.cache[a]=c;this.get(a)}else this.cache[a]=c};a.prototype.get=function(a){var b=this.cache[a];if(this.H&&b){var d=++this.count[a],e=this.index,f=e[a];if(0<f){for(var g=this.A,k=f;this.count[g[--f]]<=d&&-1!==f;);f++;if(f!==k){for(d=k;d>f;d--)k=g[d- | ||
1],g[d]=k,e[k]=d;g[f]=a;e[a]=f}}}return b};return a}();return d}(function(){var g={},l="undefined"!==typeof Blob&&"undefined"!==typeof URL&&URL.createObjectURL;return function(d,m,k,f,e){k=l?URL.createObjectURL(new Blob(["("+k.toString()+")()"],{type:"text/javascript"})):d+".es5.js";d+="-"+m;g[d]||(g[d]=[]);g[d][e]=new Worker(k);g[d][e].onmessage=f;console.log("Register Worker: "+d+"@"+e);return g[d][e]}}()),this); |
/* | ||
FlexSearch v0.3.61 | ||
FlexSearch v0.4.0 | ||
Copyright 2019 Nextapps GmbH | ||
@@ -8,12 +8,12 @@ Author: Thomas Wilkerling | ||
*/ | ||
'use strict';(function(e,l,u){let n;(n=u.define)&&n.amd?n([],function(){return l}):(n=u.modules)?n[e.toLowerCase()]=l:"object"===typeof exports?module.exports=l:u[e]=l})("FlexSearch",function(){function e(a){a||(a=v);this.id=a.id||G++;this.init(a);l(this,"index",function(){return this.a});l(this,"length",function(){return Object.keys(this.a).length})}function l(a,b,c){Object.defineProperty(a,b,{get:c})}function u(a,b){for(let c=0;c<b.length;c+=2)a=a.replace(b[c],b[c+1]);return a}function n(a,b,c, | ||
f,d,p,g){if(b[c])return b[c];d=d?(9-(g||4.5))*p+(g||4.5)*d:p;b[c]=d;d>=g&&(a=a[9-(d+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=f);return d}function y(a,b){if(a){const c=Object.keys(a);for(let f=0,d=c.length;f<d;f++){const d=c[f],g=a[d];if(g)for(let c=0,f=g.length;c<f;c++)if(g[c]===b){1===f?delete a[d]:g.splice(c,1);break}else"object"===typeof g[c]&&y(g[c],b)}}}function H(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function I(a,b){a=a.length-b.length;return 0>a?-1:a?1:0}function x(a){return"function"=== | ||
typeof a}function z(a){return"undefined"===typeof a}function C(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=t();return b}function t(){return Object.create(null)}const v={encode:"icase",b:"forward",j:!1,cache:!1,async:!1,l:!1,h:!1,threshold:0,depth:0},A=[];let G=0;const D=/\W+/g,E={},F={};e.create=function(a){return new e(a)};e.registerMatcher=function(a){for(const b in a)a.hasOwnProperty(b)&&A.push(new RegExp(b,"g"),a[b]);return this};e.registerEncoder=function(a,b){w[a]=b.bind(w);return this};e.registerLanguage= | ||
function(a,b){E[a]=b.filter;F[a]=b.stemmer;return this};e.encode=function(a,b){return w[a](b)};e.prototype.init=function(a){this.i=[];a||(a=v);var b=a.preset,c={};this.b=a.tokenize||c.b||this.b||v.b;this.h=a.rtl||this.h||v.h;this.threshold=z(b=a.threshold)?c.threshold||this.threshold||v.threshold:b;this.depth=z(b=a.depth)?c.depth||this.depth||v.depth:b;this.f=(b=z(b=a.encode)?c.encode:b)&&w[b]&&w[b].bind(w)||(x(b)?b:this.f||!1);(b=a.matcher)&&this.addMatcher(b);if(b=a.filter){b=E[b]||b;c=this.f;var f= | ||
t();if(b)for(let a=0;a<b.length;a++){const d=c?c(b[a]):b[a];f[d]=String.fromCharCode(65E3-b.length+a)}this.filter=b=f}if(b=a.stemmer){var d;a=F[b]||b;b=this.f;c=[];if(a)for(d in a)a.hasOwnProperty(d)&&(f=b?b(d):d,c.push(new RegExp("(?=.{"+(f.length+3)+",})"+f+"$","g"),b?b(a[d]):a[d]));this.stemmer=d=c}this.g=C(10-(this.threshold||0));this.c=t();this.a=t();return this};e.prototype.encode=function(a){a&&A.length&&(a=u(a,A));a&&this.i.length&&(a=u(a,this.i));a&&this.f&&(a=this.f(a));a&&this.stemmer&& | ||
(a=u(a,this.stemmer));return a};e.prototype.addMatcher=function(a){const b=this.i;for(const c in a)a.hasOwnProperty(c)&&b.push(new RegExp(c,"g"),a[c]);return this};e.prototype.add=function(a,b,c,f,d){if(b&&"string"===typeof b&&(a||0===a)){const e="@"+a;if(this.a[e]&&!f)return this.update(a,b);if(!d&&c)return this.add(a,b,null,f,!0),c(),this;b=this.encode(b);if(!b.length)return this;c=this.b;b=x(c)?c(b):b.split(D);f=t();f._ctx=t();d=this.threshold;const B=this.depth,r=this.g,q=b.length,l=this.h;for(let e= | ||
0;e<q;e++){var p=b[e];if(p){var g=p.length,k=(l?e+1:q-e)/q,m="";switch(c){case "reverse":case "both":for(var h=g;--h;)m=p[h]+m,n(r,f,m,a,l?1:(g-h)/g,k,d);m="";case "forward":for(h=0;h<g;h++)m+=p[h],n(r,f,m,a,l?(h+1)/g:1,k,d);break;case "full":for(h=0;h<g;h++){const b=(l?h+1:g-h)/g;for(let c=g;c>h;c--)m=p.substring(h,c),n(r,f,m,a,b,k,d)}break;default:if(g=n(r,f,p,a,1,k,d),B&&1<q&&g>=d)for(g=f._ctx[p]||(f._ctx[p]=t()),p=this.c[p]||(this.c[p]=C(10-(d||0))),k=e-B,m=e+B+1,0>k&&(k=0),m>q&&(m=q);k<m;k++)k!== | ||
e&&n(p,g,b[k],a,0,10-(k<e?e-k:k-e),d)}}}this.a[e]=1}return this};e.prototype.update=function(a,b,c){this.a["@"+a]&&"string"===typeof b&&(this.remove(a),this.add(a,b,c,!0));return this};e.prototype.remove=function(a,b,c){const f="@"+a;if(this.a[f]){if(!c&&b)return this.remove(a,null,!0),b(),this;for(b=0;b<10-(this.threshold||0);b++)y(this.g[b],a);this.depth&&y(this.c,a);delete this.a[f]}return this};e.prototype.search=function(a,b,c,f){var d=a,e=[];if("object"===typeof a){b=a.limit;var g=a.threshold; | ||
a=a.query}g||(g=this.threshold||0);x(b)?(c=b,b=1E3):b||0===b||(b=1E3);if(!f&&c)return c(this.search(d,b,null,!0)),this;if(!a||"string"!==typeof a)return e;d=this.encode(a);if(!d.length)return e;a=this.b;a=x(a)?a(d):d.split(D);c=a.length;f=!0;d=[];var k=t();if(1<c)if(this.depth){var m=!0;var h=a[0];k[h]=1}else a.sort(H);var l;if(!m||(l=this.c)[h])for(var n=m?1:0;n<c;n++){var r=a[n];if(r){if(!k[r]){var q=[];let a=!1,b=0;if(h=m?l[h]:this.g){let c;for(let d=0;d<10-g;d++)if(c=h[d][r])q[b++]=c,a=!0}if(a)d[d.length]= | ||
1<b?q.concat.apply([],q):q[0];else{f=!1;break}k[r]=1}h=r}}else f=!1;if(f)a:{g=[];e=d.length;if(1<e){d.sort(I);m=t();l=d[0];h=l.length;for(a=0;a<h;)m["@"+l[a++]]=1;for(k=f=0;++k<e;){n=!1;r=k===e-1;l=d[k];h=l.length;for(a=0;a<h;)if(c=l[a++],q="@"+c,m[q]&&m[q]===k){if(r){if(g[f++]=c,b&&f===b){e=g;break a}}else m[q]=k+1;n=!0}if(!n)break}}else e&&(g=d[0],b&&g.length>b&&(g=g.slice(0,b)));e=g}return e};e.prototype.clear=function(){return this.destroy().init()};e.prototype.destroy=function(){this.g=this.c= | ||
this.a=null;return this};const w={icase:function(a){return a.toLowerCase()}};return e}(!1),this); | ||
'use strict';(function(e,l,u){let n;(n=u.define)&&n.amd?n([],function(){return l}):(n=u.modules)?n[e.toLowerCase()]=l:"object"===typeof exports?module.exports=l:u[e]=l})("FlexSearch",function(){function e(a,c){const b=c?c.id:a&&a.id;this.id=b||0===b?b:G++;this.init(a,c);l(this,"index",function(){return this.a});l(this,"length",function(){return Object.keys(this.a).length})}function l(a,c,b){Object.defineProperty(a,c,{get:b})}function u(a,c){for(let b=0;b<c.length;b+=2)a=a.replace(c[b],c[b+1]);return a} | ||
function n(a,c,b,f,d,p,g){if(c[b])return c[b];d=d?(9-(g||6))*p+(g||6)*d:p;c[b]=d;d>=g&&(a=a[9-(d+.5>>0)],a=a[b]||(a[b]=[]),a[a.length]=f);return d}function y(a,c){if(a){const b=Object.keys(a);for(let f=0,d=b.length;f<d;f++){const d=b[f],g=a[d];if(g)for(let b=0,f=g.length;b<f;b++)if(g[b]===c){1===f?delete a[d]:g.splice(b,1);break}else"object"===typeof g[b]&&y(g[b],c)}}}function H(a,c){a=a.length-c.length;return 0>a?1:a?-1:0}function I(a,c){a=a.length-c.length;return 0>a?-1:a?1:0}function x(a){return"function"=== | ||
typeof a}function z(a){return"undefined"===typeof a}function C(a){const c=Array(a);for(let b=0;b<a;b++)c[b]=t();return c}function t(){return Object.create(null)}const v={encode:"icase",b:"forward",l:!1,cache:!1,async:!1,m:!1,h:!1,threshold:0,depth:0,j:!1},A=[];let G=0;const D=/\W+/g,E={},F={};e.create=function(a){return new e(a)};e.registerMatcher=function(a){for(const c in a)a.hasOwnProperty(c)&&A.push(new RegExp(c,"g"),a[c]);return this};e.registerEncoder=function(a,c){w[a]=c.bind(w);return this}; | ||
e.registerLanguage=function(a,c){E[a]=c.filter;F[a]=c.stemmer;return this};e.encode=function(a,c){return w[a](c)};e.prototype.init=function(a,c){this.i=[];if(c){var b=c.preset;a=c}else a||(a=v),b=a.preset;c={};this.b=a.tokenize||c.b||this.b||v.b;this.h=a.rtl||this.h||v.h;this.threshold=z(b=a.threshold)?c.threshold||this.threshold||v.threshold:b;this.depth=z(b=a.depth)?c.depth||this.depth||v.depth:b;this.f=(b=z(b=a.encode)?c.encode||v.encode:b)&&w[b]&&w[b].bind(w)||(x(b)?b:this.f||!1);(b=a.matcher)&& | ||
this.addMatcher(b);if(b=a.filter){b=E[b]||b;c=this.f;var f=t();if(b)for(let a=0;a<b.length;a++){const d=c?c(b[a]):b[a];f[d]=String.fromCharCode(65E3-b.length+a)}this.filter=b=f}if(b=a.stemmer){var d;a=F[b]||b;b=this.f;c=[];if(a)for(d in a)a.hasOwnProperty(d)&&(f=b?b(d):d,c.push(new RegExp("(?=.{"+(f.length+3)+",})"+f+"$","g"),b?b(a[d]):a[d]));this.stemmer=d=c}this.g=C(10-(this.threshold||0));this.c=t();this.a=t();return this};e.prototype.encode=function(a){a&&A.length&&(a=u(a,A));a&&this.i.length&& | ||
(a=u(a,this.i));a&&this.f&&(a=this.f(a));a&&this.stemmer&&(a=u(a,this.stemmer));return a};e.prototype.addMatcher=function(a){const c=this.i;for(const b in a)a.hasOwnProperty(b)&&c.push(new RegExp(b,"g"),a[b]);return this};e.prototype.add=function(a,c,b,f,d){if(c&&"string"===typeof c&&(a||0===a)){const e="@"+a;if(this.a[e]&&!f)return this.update(a,c);if(!d&&b)return this.add(a,c,null,f,!0),b(),this;c=this.encode(c);if(!c.length)return this;b=this.b;c=x(b)?b(c):c.split(D);f=t();f._ctx=t();d=this.threshold; | ||
const B=this.depth,r=this.g,q=c.length,l=this.h;for(let e=0;e<q;e++){var p=c[e];if(p){var g=p.length,k=(l?e+1:q-e)/q,m="";switch(b){case "reverse":case "both":for(var h=g;--h;)m=p[h]+m,n(r,f,m,a,l?1:(g-h)/g,k,d);m="";case "forward":for(h=0;h<g;h++)m+=p[h],n(r,f,m,a,l?(h+1)/g:1,k,d);break;case "full":for(h=0;h<g;h++){const c=(l?h+1:g-h)/g;for(let b=g;b>h;b--)m=p.substring(h,b),n(r,f,m,a,c,k,d)}break;default:if(g=n(r,f,p,a,1,k,d),B&&1<q&&g>=d)for(g=f._ctx[p]||(f._ctx[p]=t()),p=this.c[p]||(this.c[p]= | ||
C(10-(d||0))),k=e-B,m=e+B+1,0>k&&(k=0),m>q&&(m=q);k<m;k++)k!==e&&n(p,g,c[k],a,0,10-(k<e?e-k:k-e),d)}}}this.a[e]=1}return this};e.prototype.update=function(a,c,b){this.a["@"+a]&&"string"===typeof c&&(this.remove(a),this.add(a,c,b,!0));return this};e.prototype.remove=function(a,c,b){const f="@"+a;if(this.a[f]){if(!b&&c)return this.remove(a,null,!0),c(),this;for(c=0;c<10-(this.threshold||0);c++)y(this.g[c],a);this.depth&&y(this.c,a);delete this.a[f]}return this};e.prototype.search=function(a,c,b,f){var d= | ||
a,e=[];if("object"===typeof a){c=a.limit;var g=a.threshold;a=a.query}g||(g=this.threshold||0);x(c)?(b=c,c=1E3):c||0===c||(c=1E3);if(!f&&b)return b(this.search(d,c,null,!0)),this;if(!a||"string"!==typeof a)return e;d=this.encode(a);if(!d.length)return e;a=this.b;a=x(a)?a(d):d.split(D);b=a.length;f=!0;d=[];var k=t();if(1<b)if(this.depth){var m=!0;var h=a[0];k[h]=1}else a.sort(H);var l;if(!m||(l=this.c)[h])for(var n=m?1:0;n<b;n++){var r=a[n];if(r){if(!k[r]){var q=[];let a=!1,b=0;if(h=m?l[h]:this.g){let c; | ||
for(let d=0;d<10-g;d++)if(c=h[d][r])q[b++]=c,a=!0}if(a)d[d.length]=1<b?q.concat.apply([],q):q[0];else{f=!1;break}k[r]=1}h=r}}else f=!1;if(f)a:{g=[];e=d.length;if(1<e){d.sort(I);m=t();l=d[0];h=l.length;for(a=0;a<h;)m["@"+l[a++]]=1;for(k=f=0;++k<e;){n=!1;r=k===e-1;l=d[k];h=l.length;for(a=0;a<h;)if(b=l[a++],q="@"+b,m[q]&&m[q]===k){if(r){if(g[f++]=b,c&&f===c){e=g;break a}}else m[q]=k+1;n=!0}if(!n)break}}else e&&(g=d[0],c&&g.length>c&&(g=g.slice(0,c)));e=g}return e};e.prototype.clear=function(){return this.destroy().init()}; | ||
e.prototype.destroy=function(){this.g=this.c=this.a=null;return this};const w={icase:function(a){return a.toLowerCase()}};return e}(!1),this); |
/* | ||
FlexSearch v0.3.61 | ||
FlexSearch v0.4.0 | ||
Copyright 2019 Nextapps GmbH | ||
@@ -8,24 +8,29 @@ Author: Thomas Wilkerling | ||
*/ | ||
'use strict';(function(u,A,h){let w;(w=h.define)&&w.amd?w([],function(){return A}):(w=h.modules)?w[u.toLowerCase()]=A:"object"===typeof exports?module.exports=A:h[u]=A})("FlexSearch",function P(u){function h(b){E(b)&&(b=K[b]);b||(b=v);this.id=b.id||Q++;this.init(b);B(this,"index",function(){return this.a});B(this,"length",function(){return Object.keys(this.a).length})}function w(b,a,c,d){this.m!==this.c&&(this.g=this.g.concat(c),this.m++,d&&this.g.length>=d&&(this.m=this.c),this.B&&this.m===this.c&& | ||
(this.cache&&this.j.set(a,this.g),this.B(this.g),this.g=[]));return this}function B(b,a,c){Object.defineProperty(b,a,{get:c})}function f(b){return new RegExp(b,"g")}function m(b,a){for(let c=0;c<a.length;c+=2)b=b.replace(a[c],a[c+1]);return b}function D(b,a,c,d,e,l,g){if(a[c])return a[c];e=e?(9-(g||4.5))*l+(g||4.5)*e:l;a[c]=e;e>=g&&(b=b[9-(e+.5>>0)],b=b[c]||(b[c]=[]),b[b.length]=d);return e}function I(b,a){if(b){const c=Object.keys(b);for(let d=0,e=c.length;d<e;d++){const e=c[d],g=b[e];if(g)for(let c= | ||
0,d=g.length;c<d;c++)if(g[c]===a){1===d?delete b[e]:g.splice(c,1);break}else"object"===typeof g[c]&&I(g[c],a)}}}function J(b){let a="",c="";var d="";for(let e=0;e<b.length;e++){const l=b[e];if(l!==c)if(e&&"h"===l){if(d="a"===d||"e"===d||"i"===d||"o"===d||"u"===d||"y"===d,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&d||" "===c)a+=l}else a+=l;d=e===b.length-1?"":b[e+1];c=l}return a}function R(b,a){b=b.length-a.length;return 0>b?1:b?-1:0}function S(b,a){b=b.length-a.length;return 0>b?-1:b? | ||
1:0}function T(b,a,c){let d=[],e;const l=b.length;if(1<l){b.sort(S);const f=r();let h=b[0],n=h.length,k=0;for(;k<n;)f["@"+h[k++]]=1;let z,q=0,t=0;for(;++t<l;){let y=!1;const p=t===l-1;e=[];h=b[t];n=h.length;for(k=0;k<n;){z=h[k++];var g="@"+z;if(f[g]){const b=f[g];if(b===t){if(p){if(d[q++]=z,a&&q===a)return d}else f[g]=t+1;y=!0}else c&&(g=e[b]||(e[b]=[]),g[g.length]=z)}}if(!y&&!c)break}if(c&&(q=d.length,(t=e.length)&&(!a||q<a)))for(;t--;)if(z=e[t])for(k=0,n=z.length;k<n;k++)if(d[q++]=z[k],a&&q===a)return d}else l&& | ||
(d=b[0],a&&d.length>a&&(d=d.slice(0,a)));return d}function E(b){return"string"===typeof b}function G(b){return"function"===typeof b}function x(b){return"undefined"===typeof b}function L(b){const a=Array(b);for(let c=0;c<b;c++)a[c]=r();return a}function r(){return Object.create(null)}function U(){let b,a;self.onmessage=function(c){if(c=c.data)if(c.search){const d=a.search(c.content,c.threshold?{limit:c.limit,threshold:c.threshold}:c.limit);self.postMessage({id:b,content:c.content,limit:c.limit,result:d})}else c.add? | ||
a.add(c.id,c.content):c.update?a.update(c.id,c.content):c.remove?a.remove(c.id):c.clear?a.clear():c.info?(c=a.info(),c.worker=b,console.log(c)):c.register&&(b=c.id,c.options.cache=!1,c.options.async=!1,c.options.worker=!1,a=(new Function(c.register.substring(c.register.indexOf("{")+1,c.register.lastIndexOf("}"))))(),a=new a(c.options))}}function V(b,a,c,d){b=u("flexsearch","id"+b,U,function(a){(a=a.data)&&a.result&&d(a.id,a.content,a.result,a.limit)},a);const e=P.toString();c.id=a;b.postMessage({register:e, | ||
options:c,id:a});return b}const v={encode:"icase",b:"forward",u:!1,cache:!1,async:!1,c:!1,A:!1,threshold:0,depth:0},K={memory:{encode:"extra",b:"strict",threshold:7},speed:{encode:"icase",b:"strict",threshold:7,depth:2},match:{encode:"extra",b:"full"},score:{encode:"extra",b:"strict",threshold:5,depth:4},balance:{encode:"balance",b:"strict",threshold:6,depth:3},fastest:{encode:"icase",b:"strict",threshold:9,depth:1}},H=[];let Q=0;const M=f("\\W+"),N={},O={};h.create=function(b){return new h(b)};h.registerMatcher= | ||
function(b){for(const a in b)b.hasOwnProperty(a)&&H.push(f(a),b[a]);return this};h.registerEncoder=function(b,a){C[b]=a.bind(C);return this};h.registerLanguage=function(b,a){N[b]=a.filter;O[b]=a.stemmer;return this};h.encode=function(b,a){return C[b](a)};h.prototype.init=function(b){this.o=[];b||(b=v);var a=b.preset,c=a?K[a]:{};if(a=b.worker)if("undefined"===typeof Worker)b.worker=!1,this.i=null;else{var d=parseInt(a,10)||4;this.w=-1;this.m=0;this.g=[];this.B=null;this.i=Array(d);for(var e=0;e<d;e++)this.i[e]= | ||
V(this.id,e,b,w.bind(this))}this.b=b.tokenize||c.b||this.b||v.b;this.A=b.rtl||this.A||v.A;this.async="undefined"===typeof Promise||x(a=b.async)?this.async||v.async:a;this.c=x(a=b.worker)?this.c||v.c:a;this.threshold=x(a=b.threshold)?c.threshold||this.threshold||v.threshold:a;this.depth=x(a=b.depth)?c.depth||this.depth||v.depth:a;this.u=x(a=b.suggest)?this.u||v.u:a;this.s=(a=x(a=b.encode)?c.encode:a)&&C[a]&&C[a].bind(C)||(G(a)?a:this.s||!1);(a=b.matcher)&&this.addMatcher(a);if(a=b.filter){a=N[a]|| | ||
a;c=this.s;d=r();if(a)for(e=0;e<a.length;e++){var l=c?c(a[e]):a[e];d[l]=String.fromCharCode(65E3-a.length+e)}this.filter=a=d}if(a=b.stemmer){var g;c=O[a]||a;d=this.s;e=[];if(c)for(g in c)c.hasOwnProperty(g)&&(l=d?d(g):g,e.push(f("(?=.{"+(l.length+3)+",})"+l+"$"),d?d(c[g]):c[g]));this.stemmer=g=e}this.f=L(10-(this.threshold||0));this.h=r();this.a=r();this.v=!0;this.j=(this.cache=a=x(a=b.cache)?this.cache||v.cache:a)?new W(a):!1;return this};h.prototype.encode=function(b){b&&H.length&&(b=m(b,H));b&& | ||
this.o.length&&(b=m(b,this.o));b&&this.s&&(b=this.s(b));b&&this.stemmer&&(b=m(b,this.stemmer));return b};h.prototype.addMatcher=function(b){const a=this.o;for(const c in b)b.hasOwnProperty(c)&&a.push(f(c),b[c]);return this};h.prototype.add=function(b,a,c,d,e){if(a&&E(a)&&(b||0===b)){var f="@"+b;if(this.a[f]&&!d)return this.update(b,a);if(this.c)return++this.w>=this.i.length&&(this.w=0),this.i[this.w].postMessage({add:!0,id:b,content:a}),this.a[f]=""+this.w,c&&c(),this;if(!e){if(this.async&&"function"!== | ||
typeof importScripts){let e=this;f=new Promise(function(c){setTimeout(function(){e.add(b,a,null,d,!0);e=null;c()})});if(c)f.then(c);else return f;return this}if(c)return this.add(b,a,null,d,!0),c(),this}a=this.encode(a);if(!a.length)return this;c=this.b;e=G(c)?c(a):a.split(M);const l=r();l._ctx=r();const q=this.threshold,t=this.depth,F=this.f,m=e.length,y=this.A;for(let a=0;a<m;a++){var g=e[a];if(g){var h=g.length,p=(y?a+1:m-a)/m,n="";switch(c){case "reverse":case "both":for(var k=h;--k;)n=g[k]+n, | ||
D(F,l,n,b,y?1:(h-k)/h,p,q);n="";case "forward":for(k=0;k<h;k++)n+=g[k],D(F,l,n,b,y?(k+1)/h:1,p,q);break;case "full":for(k=0;k<h;k++){const a=(y?k+1:h-k)/h;for(let c=h;c>k;c--)n=g.substring(k,c),D(F,l,n,b,a,p,q)}break;default:if(h=D(F,l,g,b,1,p,q),t&&1<m&&h>=q)for(h=l._ctx[g]||(l._ctx[g]=r()),g=this.h[g]||(this.h[g]=L(10-(q||0))),p=a-t,n=a+t+1,0>p&&(p=0),n>m&&(n=m);p<n;p++)p!==a&&D(g,h,e[p],b,0,10-(p<a?a-p:p-a),q)}}}this.a[f]=1;this.v=!1}return this};h.prototype.update=function(b,a,c){this.a["@"+b]&& | ||
E(a)&&(this.remove(b),this.add(b,a,c,!0));return this};h.prototype.remove=function(b,a,c){var d="@"+b;if(this.a[d]){if(this.c)return this.i[this.a[d]].postMessage({remove:!0,id:b}),delete this.a[d],a&&a(),this;if(!c){if(this.async&&"function"!==typeof importScripts){let c=this;d=new Promise(function(a){setTimeout(function(){c.remove(b,null,!0);c=null;a()})});if(a)d.then(a);else return d;return this}if(a)return this.remove(b,null,!0),a(),this}for(a=0;a<10-(this.threshold||0);a++)I(this.f[a],b);this.depth&& | ||
I(this.h,b);delete this.a[d];this.v=!1}return this};h.prototype.search=function(b,a,c,d){let e=b,f;var g=[];"object"===typeof b&&((c=b.callback||a)&&(e.callback=null),a=b.limit,f=b.threshold,b=b.query);f||(f=this.threshold||0);G(a)?(c=a,a=1E3):a||0===a||(a=1E3);if(this.c)for(this.B=c,this.m=0,this.g=[],g=0;g<this.c;g++)this.i[g].postMessage({search:!0,limit:a,threshold:f,content:b});else{if(!d){if(this.async&&"function"!==typeof importScripts){let d=this;b=new Promise(function(b){setTimeout(function(){b(d.search(e, | ||
a,null,!0));d=null})});if(c)b.then(c);else return b;return this}if(c)return c(this.search(e,a,null,!0)),this}if(!b||!E(b))return g;e=b;if(this.cache)if(this.v){if(c=this.j.get(b))return c}else this.j.clear(),this.v=!0;e=this.encode(e);if(!e.length)return g;c=this.b;c=G(c)?c(e):e.split(M);d=c.length;var h=!0,p=[],n=r();if(1<d)if(this.depth){var k=!0;var m=c[0];n[m]=1}else c.sort(R);var q;if(!k||(q=this.h)[m])for(let a=k?1:0;a<d;a++){const b=c[a];if(b){if(!n[b]){const a=[];let c=!1,d=0;if(m=k?q[m]: | ||
this.f){let e;for(let g=0;g<10-f;g++)if(e=m[g][b])a[d++]=e,c=!0}if(c)p[p.length]=1<d?a.concat.apply([],a):a[0];else if(!this.u){h=!1;break}n[b]=1}m=b}}else h=!1;h&&(g=T(p,a,this.u));this.cache&&this.j.set(b,g);return g}};h.prototype.info=function(){if(this.c)for(var b=0;b<this.c;b++)this.i[b].postMessage({info:!0,id:this.id});else{var a=0,c=0,d=0;for(var e=0;e<10-(this.threshold||0);e++){b=Object.keys(this.f[e]);for(let g=0;g<b.length;g++){var f=this.f[e][b[g]].length;a+=1*f+2*b[g].length+4;c+=f; | ||
d+=2*b[g].length}}b=Object.keys(this.a);f=b.length;for(e=0;e<f;e++)a+=2*b[e].length+2;return{id:this.id,memory:a,items:f,sequences:c,chars:d,cache:this.cache&&this.cache.l?this.cache.l.length:!1,matcher:H.length+(this.o?this.o.length:0),worker:this.c,threshold:this.threshold,depth:this.depth,contextual:this.depth&&"strict"===this.b}}};h.prototype.clear=function(){return this.destroy().init()};h.prototype.destroy=function(){this.cache&&(this.j.clear(),this.j=null);this.f=this.h=this.a=null;return this}; | ||
h.prototype.export=function(){return JSON.stringify([this.f,this.h,this.a])};h.prototype.import=function(b){b=JSON.parse(b);this.f=b[0];this.h=b[1];this.a=b[2]};const C={icase:function(b){return b.toLowerCase()},simple:function(){const b=[f("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",f("[\u00e8\u00e9\u00ea\u00eb]"),"e",f("[\u00ec\u00ed\u00ee\u00ef]"),"i",f("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",f("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",f("[\u00fd\u0177\u00ff]"),"y",f("\u00f1"),"n",f("\u00e7"), | ||
"c",f("\u00df"),"s",f(" & ")," and ",f("[-/]")," ",f("[^a-z0-9 ]"),"",f("\\s+")," "];return function(a){a=m(a.toLowerCase(),b);return" "===a?"":a}}(),advanced:function(){const b=[f("ae"),"a",f("ai"),"ei",f("ay"),"ei",f("ey"),"ei",f("oe"),"o",f("ue"),"u",f("ie"),"i",f("sz"),"s",f("zs"),"s",f("sh"),"s",f("ck"),"k",f("cc"),"k",f("dt"),"t",f("ph"),"f",f("pf"),"f",f("ou"),"o",f("uo"),"u"];return function(a,c){if(!a)return a;a=this.simple(a);2<a.length&&(a=m(a,b));c||1<a.length&&(a=J(a));return a}}(),extra:function(){const b= | ||
[f("p"),"b",f("z"),"s",f("[cgq]"),"k",f("n"),"m",f("d"),"t",f("[vw]"),"f",f("[aeiouy]"),""];return function(a){if(!a)return a;a=this.advanced(a,!0);if(1<a.length){a=a.split(" ");for(let c=0;c<a.length;c++){const d=a[c];1<d.length&&(a[c]=d[0]+m(d.substring(1),b))}a=a.join(" ");a=J(a)}return a}}(),balance:function(){const b=[f("[-/]")," ",f("[^a-z0-9 ]"),"",f("\\s+")," "];return function(a){return J(m(a.toLowerCase(),b))}}()},W=function(){function b(a){this.clear();this.C=!0!==a&&a}b.prototype.clear= | ||
function(){this.cache=r();this.count=r();this.index=r();this.l=[]};b.prototype.set=function(a,b){if(this.C&&x(this.cache[a])){let c=this.l.length;if(c===this.C){c--;const a=this.l[c];delete this.cache[a];delete this.count[a];delete this.index[a]}this.index[a]=c;this.l[c]=a;this.count[a]=-1;this.cache[a]=b;this.get(a)}else this.cache[a]=b};b.prototype.get=function(a){const b=this.cache[a];if(this.C&&b){var d=++this.count[a];const b=this.index;let c=b[a];if(0<c){const f=this.l;for(var e=c;this.count[f[--c]]<= | ||
d&&-1!==c;);c++;if(c!==e){for(d=e;d>c;d--)e=f[d-1],f[d]=e,b[e]=d;f[c]=a;b[a]=c}}}return b};return b}();return h}(function(){const u={},A="undefined"!==typeof Blob&&"undefined"!==typeof URL&&URL.createObjectURL;return function(h,w,B,f,m){B=A?URL.createObjectURL(new Blob(["("+B.toString()+")()"],{type:"text/javascript"})):h+".min.js";h+="-"+w;u[h]||(u[h]=[]);u[h][m]=new Worker(B);u[h][m].onmessage=f;return u[h][m]}}()),this); | ||
'use strict';(function(t,A,g){let w;(w=g.define)&&w.amd?w([],function(){return A}):(w=g.modules)?w[t.toLowerCase()]=A:"object"===typeof exports?module.exports=A:g[t]=A})("FlexSearch",function Q(t){function g(a,b){const c=b?b.id:a&&a.id;this.id=c||0===c?c:R++;this.init(a,b);B(this,"index",function(){return this.a});B(this,"length",function(){return Object.keys(this.a).length})}function w(a,b,c,e){this.s!==this.f&&(this.j=this.j.concat(c),this.s++,e&&this.j.length>=e&&(this.s=this.f),this.F&&this.s=== | ||
this.f&&(this.cache&&this.m.set(b,this.j),this.F(this.j),this.j=[]));return this}function B(a,b,c){Object.defineProperty(a,b,{get:c})}function f(a){return new RegExp(a,"g")}function n(a,b){for(let c=0;c<b.length;c+=2)a=a.replace(b[c],b[c+1]);return a}function F(a,b,c,e,d,l,h){if(b[c])return b[c];d=d?(9-(h||6))*l+(h||6)*d:l;b[c]=d;d>=h&&(a=a[9-(d+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=e);return d}function J(a,b){if(a){const c=Object.keys(a);for(let e=0,d=c.length;e<d;e++){const d=c[e],h=a[d];if(h)for(let c= | ||
0,e=h.length;c<e;c++)if(h[c]===b){1===e?delete a[d]:h.splice(c,1);break}else z(h[c])&&J(h[c],b)}}}function K(a){let b="",c="";var e="";for(let d=0;d<a.length;d++){const l=a[d];if(l!==c)if(d&&"h"===l){if(e="a"===e||"e"===e||"i"===e||"o"===e||"u"===e||"y"===e,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&e||" "===c)b+=l}else b+=l;e=d===a.length-1?"":a[d+1];c=l}return b}function S(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function T(a,b){a=a.length-b.length;return 0>a?-1:a?1:0}function U(a, | ||
b,c,e){let d=[],l;const h=a.length;if(1<h){a.sort(T);const x=u();let k=a[0],r=k.length,g=0;for(;g<r;)x["@"+k[g++]]=1;let m,C=0,v=0;for(;++v<h;){let p=!1;const V=v===h-1;l=[];k=a[v];r=k.length;for(g=0;g<r;){m=k[g++];var f="@"+m;if(x[f]){const a=x[f];if(a===v){if(V){if(d[C++]=c?c[f]:m,b&&C===b)return d}else x[f]=v+1;p=!0}else e&&(f=l[a]||(l[a]=[]),f[f.length]=m)}}if(!p&&!e)break}if(e&&(C=d.length,(v=l.length)&&(!b||C<b)))for(;v--;)if(m=l[v])for(g=0,r=m.length;g<r;g++)if(d[C++]=c?c["@"+m[g]]:m[g],b&& | ||
C===b)return d}else if(h)if(c)for(a=a[0],e=a.length,b&&b<e&&(e=b),d=Array(e),b=0;b<e;b++)d[b]=c["@"+a[b]];else d=a[0],b&&d.length>b&&(d=d.slice(0,b));return d}function G(a){return"string"===typeof a}function H(a){return"function"===typeof a}function z(a){return"object"===typeof a}function y(a){return"undefined"===typeof a}function L(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=u();return b}function u(){return Object.create(null)}function W(){let a,b;self.onmessage=function(c){if(c=c.data)if(c.search){const e= | ||
b.search(c.content,c.threshold?{limit:c.limit,threshold:c.threshold}:c.limit);self.postMessage({id:a,content:c.content,limit:c.limit,result:e})}else c.add?b.add(c.id,c.content):c.update?b.update(c.id,c.content):c.remove?b.remove(c.id):c.clear?b.clear():c.info?(c=b.info(),c.worker=a,console.log(c)):c.register&&(a=c.id,c.options.cache=!1,c.options.async=!1,c.options.worker=!1,b=(new Function(c.register.substring(c.register.indexOf("{")+1,c.register.lastIndexOf("}"))))(),b=new b(c.options))}}function X(a, | ||
b,c,e){a=t("flexsearch","id"+a,W,function(a){(a=a.data)&&a.result&&e(a.id,a.content,a.result,a.limit)},b);const d=Q.toString();c.id=b;a.postMessage({register:d,options:c,id:b});return a}const q={encode:"icase",c:"forward",A:!1,cache:!1,async:!1,f:!1,D:!1,threshold:0,depth:0,b:!1},M={memory:{encode:"extra",c:"strict",threshold:7},speed:{encode:"icase",c:"strict",threshold:7,depth:2},match:{encode:"extra",c:"full"},score:{encode:"extra",c:"strict",threshold:5,depth:4},balance:{encode:"balance",c:"strict", | ||
threshold:6,depth:3},fastest:{encode:"icase",c:"strict",threshold:9,depth:1}},I=[];let R=0;const N=f("\\W+"),O={},P={};g.create=function(a){return new g(a)};g.registerMatcher=function(a){for(const b in a)a.hasOwnProperty(b)&&I.push(f(b),a[b]);return this};g.registerEncoder=function(a,b){E[a]=b.bind(E);return this};g.registerLanguage=function(a,b){O[a]=b.filter;P[a]=b.stemmer;return this};g.encode=function(a,b){return E[a](b)};g.prototype.init=function(a,b){this.u=[];if(b){var c=b.preset;a=b}else a|| | ||
(a=q),c=a.preset;b={};G(a)?(b=M[a],a={}):c&&(b=M[c]);if(c=a.worker)if("undefined"===typeof Worker)a.worker=!1,this.l=null;else{var e=parseInt(c,10)||4;this.C=-1;this.s=0;this.j=[];this.F=null;this.l=Array(e);for(var d=0;d<e;d++)this.l[d]=X(this.id,d,a,w.bind(this))}this.c=a.tokenize||b.c||this.c||q.c;this.D=a.rtl||this.D||q.D;this.async="undefined"===typeof Promise||y(c=a.async)?this.async||q.async:c;this.f=y(c=a.worker)?this.f||q.f:c;this.threshold=y(c=a.threshold)?b.threshold||this.threshold||q.threshold: | ||
c;this.depth=y(c=a.depth)?b.depth||this.depth||q.depth:c;this.A=y(c=a.suggest)?this.A||q.A:c;this.v=(c=y(c=a.encode)?b.encode||q.encode:c)&&E[c]&&E[c].bind(E)||(H(c)?c:this.v||!1);(c=a.matcher)&&this.addMatcher(c);if(c=a.filter){c=O[c]||c;b=this.v;e=u();if(c)for(d=0;d<c.length;d++){var l=b?b(c[d]):c[d];e[l]=String.fromCharCode(65E3-c.length+d)}this.filter=c=e}if(c=a.stemmer){var h;b=P[c]||c;e=this.v;d=[];if(b)for(h in b)b.hasOwnProperty(h)&&(l=e?e(h):h,d.push(f("(?=.{"+(l.length+3)+",})"+l+"$"),e? | ||
e(b[h]):b[h]));this.stemmer=h=d}this.b=d=(c=a.doc)?c:this.b||q.b;this.h=L(10-(this.threshold||0));this.i=u();this.a=u();this.g=d&&u();if(d)if(a.doc=null,h=d.field,b=d.index=[],e=d.ref={},d.id=d.id.split(":"),h.constructor===Array)for(d=0;d<h.length;d++)e[h[d]]=d,h[d]=h[d].split(":"),b[d]=new g(a),b[d].g=this.g;else e[h]=0,d.field=[h.split(":")],b[0]=new g(a),b[0].g=this.g;this.B=!0;this.m=(this.cache=c=y(c=a.cache)?this.cache||q.cache:c)?new Y(c):!1;return this};g.prototype.encode=function(a){a&& | ||
I.length&&(a=n(a,I));a&&this.u.length&&(a=n(a,this.u));a&&this.v&&(a=this.v(a));a&&this.stemmer&&(a=n(a,this.stemmer));return a};g.prototype.addMatcher=function(a){const b=this.u;for(const c in a)a.hasOwnProperty(c)&&b.push(f(c),a[c]);return this};g.prototype.add=function(a,b,c,e,d){if(this.b&&z(a))return this.w("add",a,b);if(b&&G(b)&&(a||0===a)){var l="@"+a;if(this.a[l]&&!e)return this.update(a,b);if(this.f)return++this.C>=this.l.length&&(this.C=0),this.l[this.C].postMessage({add:!0,id:a,content:b}), | ||
this.a[l]=""+this.C,c&&c(),this;if(!d){if(this.async&&"function"!==typeof importScripts){let d=this;l=new Promise(function(c){setTimeout(function(){d.add(a,b,null,e,!0);d=null;c()})});if(c)l.then(c);else return l;return this}if(c)return this.add(a,b,null,e,!0),c(),this}b=this.encode(b);if(!b.length)return this;c=this.c;d=H(c)?c(b):b.split(N);const r=u();r._ctx=u();const m=this.threshold,x=this.depth,v=this.h,D=d.length,n=this.D;for(let b=0;b<D;b++){var h=d[b];if(h){var f=h.length,g=(n?b+1:D-b)/D, | ||
k="";switch(c){case "reverse":case "both":for(var p=f;--p;)k=h[p]+k,F(v,r,k,a,n?1:(f-p)/f,g,m);k="";case "forward":for(p=0;p<f;p++)k+=h[p],F(v,r,k,a,n?(p+1)/f:1,g,m);break;case "full":for(p=0;p<f;p++){const b=(n?p+1:f-p)/f;for(let c=f;c>p;c--)k=h.substring(p,c),F(v,r,k,a,b,g,m)}break;default:if(f=F(v,r,h,a,1,g,m),x&&1<D&&f>=m)for(f=r._ctx[h]||(r._ctx[h]=u()),h=this.i[h]||(this.i[h]=L(10-(m||0))),g=b-x,k=b+x+1,0>g&&(g=0),k>D&&(k=D);g<k;g++)g!==b&&F(h,f,d[g],a,0,10-(g<b?b-g:g-b),m)}}}this.a[l]=1;this.B= | ||
!1}return this};g.prototype.w=function(a,b,c){if(b.constructor===Array)for(let d=0,e=b.length;d<e;d++){if(d===e-1)return this.w(a,b[d],c);this.w(a,b[d])}else{const f=this.b.index;let h=this.b.id,g;for(var e=0;e<h.length;e++)g=(g||b)[h[e]];if("remove"===a){delete this.g["@"+g];for(let a=0,b=f.length;a<b;a++){if(a===b-1)return f[a].remove(g,c);f[a].remove(g)}}h=this.b.field;for(let l=0,k=h.length;l<k;l++){e=h[l];let r;for(var d=0;d<e.length;d++)r=(r||b)[e[d]];this.g["@"+g]=b;e=f[l];d="add"===a?e.add: | ||
e.update;if(l===k-1)return d.call(e,g,r,c);d.call(e,g,r)}}};g.prototype.update=function(a,b,c){if(this.b&&z(a))return this.w("update",a,b);this.a["@"+a]&&G(b)&&(this.remove(a),this.add(a,b,c,!0));return this};g.prototype.remove=function(a,b,c){if(this.b&&z(a))return this.w("remove",a,b);var e="@"+a;if(this.a[e]){if(this.f)return this.l[this.a[e]].postMessage({remove:!0,id:a}),delete this.a[e],b&&b(),this;if(!c){if(this.async&&"function"!==typeof importScripts){let c=this;e=new Promise(function(b){setTimeout(function(){c.remove(a, | ||
null,!0);c=null;b()})});if(b)e.then(b);else return e;return this}if(b)return this.remove(a,null,!0),b(),this}for(b=0;b<10-(this.threshold||0);b++)J(this.h[b],a);this.depth&&J(this.i,a);delete this.a[e];this.B=!1}return this};g.prototype.search=function(a,b,c,e){if(z(b)){if(b.constructor===Array)for(var d=0;d<b.length;d++)b[d].query=a;else b.query=a;a=b;b=0}let f=a;let h=[];if(z(a)&&a.constructor!==Array){(c=a.callback||b)&&(f.callback=null);b=a.limit;var g=a.threshold;var n=a.boost;a=a.query}if(this.b){a= | ||
this.b.ref;g=this.b.index;var k=f.field;if(k)f.field=null;else if(f.constructor===Array){var p=f;k=[];for(var q=0;q<f.length;q++)k[q]=f[q].field}else k=Object.keys(a);if(z(k)){k.constructor===Array||(k=[k]);q=k.length;for(var m=0;m<q;m++)p&&(f=p[m]),h[m]=g[a[k[m]]].search(f);return c?c(h.concat.apply([],h)):this.async?new Promise(function(a){Promise.all(h).then(function(b){a(b.concat.apply([],b))})}):h.concat.apply([],h)}return g[a[k]].search(f,c)}g||(g=this.threshold||0);H(b)?(c=b,b=1E3):b||0=== | ||
b||(b=1E3);if(this.f)for(this.F=c,this.s=0,this.j=[],k=0;k<this.f;k++)this.l[k].postMessage({search:!0,limit:b,threshold:g,content:a});else{if(!e){if(this.async&&"function"!==typeof importScripts){let d=this;a=new Promise(function(a){setTimeout(function(){a(d.search(f,b,null,!0));d=null})});if(c)a.then(c);else return a;return this}if(c)return c(this.search(f,b,null,!0)),this}if(!a||!G(a))return h;f=a;if(this.cache)if(this.B){if(c=this.m.get(a))return c}else this.m.clear(),this.B=!0;f=this.encode(f); | ||
if(!f.length)return h;c=this.c;c=H(c)?c(f):f.split(N);p=c.length;e=!0;d=[];var t=u();1<p&&(this.depth?(k=!0,m=c[0],t[m]=1):c.sort(S));if(!k||(q=this.i)[m]){let a=0;n&&(g=(g||1)/n,0>n&&(a=g));for(n=k?1:0;n<p;n++){const b=c[n];if(b){if(!t[b]){const c=[];let f=!1,h=0;if(m=k?q[m]:this.h){let d;for(let e=a;e<10-g;e++)if(d=m[e][b])c[h++]=d,f=!0}if(f)d[d.length]=1<h?c.concat.apply([],c):c[0];else if(!this.A){e=!1;break}t[b]=1}m=b}}}else e=!1;e&&(h=U(d,b,this.g,this.A));this.cache&&this.m.set(a,h);return h}}; | ||
g.prototype.info=function(){if(this.f)for(var a=0;a<this.f;a++)this.l[a].postMessage({info:!0,id:this.id});else{var b=0,c=0,e=0;for(var d=0;d<10-(this.threshold||0);d++){a=Object.keys(this.h[d]);for(let h=0;h<a.length;h++){var f=this.h[d][a[h]].length;b+=1*f+2*a[h].length+4;c+=f;e+=2*a[h].length}}a=Object.keys(this.a);f=a.length;for(d=0;d<f;d++)b+=2*a[d].length+2;return{id:this.id,memory:b,items:f,sequences:c,chars:e,cache:this.cache&&this.cache.o?this.cache.o.length:!1,matcher:I.length+(this.u?this.u.length: | ||
0),worker:this.f,threshold:this.threshold,depth:this.depth,contextual:this.depth&&"strict"===this.c}}};g.prototype.clear=function(){return this.destroy().init()};g.prototype.destroy=function(){this.cache&&(this.m.clear(),this.m=null);this.h=this.i=this.a=null;return this};g.prototype.export=function(){if(this.b){const a=this.b.index,b=Array(a.length+1);let c=0;for(;c<a.length;c++)b[c]=[a[c].h,a[c].i,a[c].a];b[c]=this.g;return JSON.stringify(b)}return JSON.stringify([this.h,this.i,this.a])};g.prototype.import= | ||
function(a){a=JSON.parse(a);if(this.b){const b=this.b.index,c=b.length;for(let e=0;e<c;e++){const d=b[e];d.h=a[e][0];d.i=a[e][1];d.a=a[e][2];d.g=a[c]}this.g=a[c]}else this.h=a[0],this.i=a[1],this.a=a[2],this.g=a[3]};const E={icase:function(a){return a.toLowerCase()},simple:function(){const a=[f("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",f("[\u00e8\u00e9\u00ea\u00eb]"),"e",f("[\u00ec\u00ed\u00ee\u00ef]"),"i",f("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",f("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u", | ||
f("[\u00fd\u0177\u00ff]"),"y",f("\u00f1"),"n",f("\u00e7"),"c",f("\u00df"),"s",f(" & ")," and ",f("[-/]")," ",f("[^a-z0-9 ]"),"",f("\\s+")," "];return function(b){b=n(b.toLowerCase(),a);return" "===b?"":b}}(),advanced:function(){const a=[f("ae"),"a",f("ai"),"ei",f("ay"),"ei",f("ey"),"ei",f("oe"),"o",f("ue"),"u",f("ie"),"i",f("sz"),"s",f("zs"),"s",f("sh"),"s",f("ck"),"k",f("cc"),"k",f("dt"),"t",f("ph"),"f",f("pf"),"f",f("ou"),"o",f("uo"),"u"];return function(b,c){if(!b)return b;b=this.simple(b);2<b.length&& | ||
(b=n(b,a));c||1<b.length&&(b=K(b));return b}}(),extra:function(){const a=[f("p"),"b",f("z"),"s",f("[cgq]"),"k",f("n"),"m",f("d"),"t",f("[vw]"),"f",f("[aeiouy]"),""];return function(b){if(!b)return b;b=this.advanced(b,!0);if(1<b.length){b=b.split(" ");for(let c=0;c<b.length;c++){const e=b[c];1<e.length&&(b[c]=e[0]+n(e.substring(1),a))}b=b.join(" ");b=K(b)}return b}}(),balance:function(){const a=[f("[-/]")," ",f("[^a-z0-9 ]"),"",f("\\s+")," "];return function(b){return K(n(b.toLowerCase(),a))}}()}, | ||
Y=function(){function a(a){this.clear();this.G=!0!==a&&a}a.prototype.clear=function(){this.cache=u();this.count=u();this.index=u();this.o=[]};a.prototype.set=function(a,c){if(this.G&&y(this.cache[a])){let b=this.o.length;if(b===this.G){b--;const a=this.o[b];delete this.cache[a];delete this.count[a];delete this.index[a]}this.index[a]=b;this.o[b]=a;this.count[a]=-1;this.cache[a]=c;this.get(a)}else this.cache[a]=c};a.prototype.get=function(a){const b=this.cache[a];if(this.G&&b){var e=++this.count[a]; | ||
const b=this.index;let c=b[a];if(0<c){const f=this.o;for(var d=c;this.count[f[--c]]<=e&&-1!==c;);c++;if(c!==d){for(e=d;e>c;e--)d=f[e-1],f[e]=d,b[d]=e;f[c]=a;b[a]=c}}}return b};return a}();return g}(function(){const t={},A="undefined"!==typeof Blob&&"undefined"!==typeof URL&&URL.createObjectURL;return function(g,w,B,f,n){B=A?URL.createObjectURL(new Blob(["("+B.toString()+")()"],{type:"text/javascript"})):g+".min.js";g+="-"+w;t[g]||(t[g]=[]);t[g][n]=new Worker(B);t[g][n].onmessage=f;return t[g][n]}}()), | ||
this); |
/* | ||
FlexSearch v0.3.61 | ||
FlexSearch v0.4.0 | ||
Copyright 2019 Nextapps GmbH | ||
@@ -8,21 +8,25 @@ Author: Thomas Wilkerling | ||
*/ | ||
'use strict';(function(g,w,d){let m;(m=d.define)&&m.amd?m([],function(){return w}):(m=d.modules)?m[g.toLowerCase()]=w:"object"===typeof exports?module.exports=w:d[g]=w})("FlexSearch",function(){function g(b){B(b)&&(b=G[b]);b||(b=n);this.id=b.id||L++;this.init(b);w(this,"index",function(){return this.b});w(this,"length",function(){return Object.keys(this.b).length})}function w(b,a,c){Object.defineProperty(b,a,{get:c})}function d(b){return new RegExp(b,"g")}function m(b,a){for(let c=0;c<a.length;c+= | ||
2)b=b.replace(a[c],a[c+1]);return b}function A(b,a,c,f,e,d,h){if(a[c])return a[c];e=e?(9-(h||4.5))*d+(h||4.5)*e:d;a[c]=e;e>=h&&(b=b[9-(e+.5>>0)],b=b[c]||(b[c]=[]),b[b.length]=f);return e}function E(b,a){if(b){const c=Object.keys(b);for(let f=0,e=c.length;f<e;f++){const e=c[f],h=b[e];if(h)for(let c=0,f=h.length;c<f;c++)if(h[c]===a){1===f?delete b[e]:h.splice(c,1);break}else"object"===typeof h[c]&&E(h[c],a)}}}function F(b){let a="",c="";var f="";for(let e=0;e<b.length;e++){const d=b[e];if(d!==c)if(e&& | ||
"h"===d){if(f="a"===f||"e"===f||"i"===f||"o"===f||"u"===f||"y"===f,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&f||" "===c)a+=d}else a+=d;f=e===b.length-1?"":b[e+1];c=d}return a}function M(b,a){b=b.length-a.length;return 0>b?1:b?-1:0}function N(b,a){b=b.length-a.length;return 0>b?-1:b?1:0}function O(b,a,c){let f=[],e;const d=b.length;if(1<d){b.sort(N);const p=t();let l=b[0],g=l.length,k=0;for(;k<g;)p["@"+l[k++]]=1;let x,q=0,u=0;for(;++u<d;){let v=!1;const r=u===d-1;e=[];l=b[u];g=l.length; | ||
for(k=0;k<g;){x=l[k++];var h="@"+x;if(p[h]){const b=p[h];if(b===u){if(r){if(f[q++]=x,a&&q===a)return f}else p[h]=u+1;v=!0}else c&&(h=e[b]||(e[b]=[]),h[h.length]=x)}}if(!v&&!c)break}if(c&&(q=f.length,(u=e.length)&&(!a||q<a)))for(;u--;)if(x=e[u])for(k=0,g=x.length;k<g;k++)if(f[q++]=x[k],a&&q===a)return f}else d&&(f=b[0],a&&f.length>a&&(f=f.slice(0,a)));return f}function B(b){return"string"===typeof b}function C(b){return"function"===typeof b}function y(b){return"undefined"===typeof b}function H(b){const a= | ||
Array(b);for(let c=0;c<b;c++)a[c]=t();return a}function t(){return Object.create(null)}const n={encode:"icase",a:"forward",l:!1,cache:!1,async:!1,u:!1,o:!1,threshold:0,depth:0},G={memory:{encode:"extra",a:"strict",threshold:7},speed:{encode:"icase",a:"strict",threshold:7,depth:2},match:{encode:"extra",a:"full"},score:{encode:"extra",a:"strict",threshold:5,depth:4},balance:{encode:"balance",a:"strict",threshold:6,depth:3},fastest:{encode:"icase",a:"strict",threshold:9,depth:1}},D=[];let L=0;const I= | ||
d("\\W+"),J={},K={};g.create=function(b){return new g(b)};g.registerMatcher=function(b){for(const a in b)b.hasOwnProperty(a)&&D.push(d(a),b[a]);return this};g.registerEncoder=function(b,a){z[b]=a.bind(z);return this};g.registerLanguage=function(b,a){J[b]=a.filter;K[b]=a.stemmer;return this};g.encode=function(b,a){return z[b](a)};g.prototype.init=function(b){this.i=[];b||(b=n);var a=b.preset,c=a?G[a]:{};this.a=b.tokenize||c.a||this.a||n.a;this.o=b.rtl||this.o||n.o;this.async="undefined"===typeof Promise|| | ||
y(a=b.async)?this.async||n.async:a;this.threshold=y(a=b.threshold)?c.threshold||this.threshold||n.threshold:a;this.depth=y(a=b.depth)?c.depth||this.depth||n.depth:a;this.l=y(a=b.suggest)?this.l||n.l:a;this.j=(a=y(a=b.encode)?c.encode:a)&&z[a]&&z[a].bind(z)||(C(a)?a:this.j||!1);(a=b.matcher)&&this.addMatcher(a);if(a=b.filter){a=J[a]||a;c=this.j;var f=t();if(a)for(var e=0;e<a.length;e++){var p=c?c(a[e]):a[e];f[p]=String.fromCharCode(65E3-a.length+e)}this.filter=a=f}if(a=b.stemmer){var h;c=K[a]||a;f= | ||
this.j;e=[];if(c)for(h in c)c.hasOwnProperty(h)&&(p=f?f(h):h,e.push(d("(?=.{"+(p.length+3)+",})"+p+"$"),f?f(c[h]):c[h]));this.stemmer=h=e}this.c=H(10-(this.threshold||0));this.f=t();this.b=t();this.m=!0;this.h=(this.cache=a=y(a=b.cache)?this.cache||n.cache:a)?new P(a):!1;return this};g.prototype.encode=function(b){b&&D.length&&(b=m(b,D));b&&this.i.length&&(b=m(b,this.i));b&&this.j&&(b=this.j(b));b&&this.stemmer&&(b=m(b,this.stemmer));return b};g.prototype.addMatcher=function(b){const a=this.i;for(const c in b)b.hasOwnProperty(c)&& | ||
a.push(d(c),b[c]);return this};g.prototype.add=function(b,a,c,f,e){if(a&&B(a)&&(b||0===b)){var d="@"+b;if(this.b[d]&&!f)return this.update(b,a);if(!e){if(this.async&&"function"!==typeof importScripts){let e=this;d=new Promise(function(c){setTimeout(function(){e.add(b,a,null,f,!0);e=null;c()})});if(c)d.then(c);else return d;return this}if(c)return this.add(b,a,null,f,!0),c(),this}a=this.encode(a);if(!a.length)return this;c=this.a;e=C(c)?c(a):a.split(I);const p=t();p._ctx=t();const q=this.threshold, | ||
u=this.depth,m=this.c,v=e.length,n=this.o;for(let a=0;a<v;a++){var h=e[a];if(h){var g=h.length,l=(n?a+1:v-a)/v,r="";switch(c){case "reverse":case "both":for(var k=g;--k;)r=h[k]+r,A(m,p,r,b,n?1:(g-k)/g,l,q);r="";case "forward":for(k=0;k<g;k++)r+=h[k],A(m,p,r,b,n?(k+1)/g:1,l,q);break;case "full":for(k=0;k<g;k++){const a=(n?k+1:g-k)/g;for(let c=g;c>k;c--)r=h.substring(k,c),A(m,p,r,b,a,l,q)}break;default:if(g=A(m,p,h,b,1,l,q),u&&1<v&&g>=q)for(g=p._ctx[h]||(p._ctx[h]=t()),h=this.f[h]||(this.f[h]=H(10- | ||
(q||0))),l=a-u,r=a+u+1,0>l&&(l=0),r>v&&(r=v);l<r;l++)l!==a&&A(h,g,e[l],b,0,10-(l<a?a-l:l-a),q)}}}this.b[d]=1;this.m=!1}return this};g.prototype.update=function(b,a,c){this.b["@"+b]&&B(a)&&(this.remove(b),this.add(b,a,c,!0));return this};g.prototype.remove=function(b,a,c){var f="@"+b;if(this.b[f]){if(!c){if(this.async&&"function"!==typeof importScripts){let c=this;f=new Promise(function(a){setTimeout(function(){c.remove(b,null,!0);c=null;a()})});if(a)f.then(a);else return f;return this}if(a)return this.remove(b, | ||
null,!0),a(),this}for(a=0;a<10-(this.threshold||0);a++)E(this.c[a],b);this.depth&&E(this.f,b);delete this.b[f];this.m=!1}return this};g.prototype.search=function(b,a,c,f){let e=b,d,h=[];"object"===typeof b&&((c=b.callback||a)&&(e.callback=null),a=b.limit,d=b.threshold,b=b.query);d||(d=this.threshold||0);C(a)?(c=a,a=1E3):a||0===a||(a=1E3);if(!f){if(this.async&&"function"!==typeof importScripts){let d=this;b=new Promise(function(b){setTimeout(function(){b(d.search(e,a,null,!0));d=null})});if(c)b.then(c); | ||
else return b;return this}if(c)return c(this.search(e,a,null,!0)),this}if(!b||!B(b))return h;e=b;if(this.cache)if(this.m){if(c=this.h.get(b))return c}else this.h.clear(),this.m=!0;e=this.encode(e);if(!e.length)return h;c=this.a;c=C(c)?c(e):e.split(I);f=c.length;let g=!0;const l=[],m=t();let k;if(1<f)if(this.depth){k=!0;var n=c[0];m[n]=1}else c.sort(M);let q;if(!k||(q=this.f)[n])for(let a=k?1:0;a<f;a++){const b=c[a];if(b){if(!m[b]){const a=[];let c=!1,f=0;if(n=k?q[n]:this.c){let e;for(let h=0;h<10- | ||
d;h++)if(e=n[h][b])a[f++]=e,c=!0}if(c)l[l.length]=1<f?a.concat.apply([],a):a[0];else if(!this.l){g=!1;break}m[b]=1}n=b}}else g=!1;g&&(h=O(l,a,this.l));this.cache&&this.h.set(b,h);return h};g.prototype.info=function(){let b;let a=0,c=0,d=0;for(var e=0;e<10-(this.threshold||0);e++){b=Object.keys(this.c[e]);for(let f=0;f<b.length;f++){var g=this.c[e][b[f]].length;a+=1*g+2*b[f].length+4;c+=g;d+=2*b[f].length}}b=Object.keys(this.b);g=b.length;for(e=0;e<g;e++)a+=2*b[e].length+2;return{id:this.id,memory:a, | ||
items:g,sequences:c,chars:d,cache:this.cache&&this.cache.g?this.cache.g.length:!1,matcher:D.length+(this.i?this.i.length:0),worker:this.u,threshold:this.threshold,depth:this.depth,contextual:this.depth&&"strict"===this.a}};g.prototype.clear=function(){return this.destroy().init()};g.prototype.destroy=function(){this.cache&&(this.h.clear(),this.h=null);this.c=this.f=this.b=null;return this};g.prototype.export=function(){return JSON.stringify([this.c,this.f,this.b])};g.prototype.import=function(b){b= | ||
JSON.parse(b);this.c=b[0];this.f=b[1];this.b=b[2]};const z={icase:function(b){return b.toLowerCase()},simple:function(){const b=[d("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",d("[\u00e8\u00e9\u00ea\u00eb]"),"e",d("[\u00ec\u00ed\u00ee\u00ef]"),"i",d("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",d("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",d("[\u00fd\u0177\u00ff]"),"y",d("\u00f1"),"n",d("\u00e7"),"c",d("\u00df"),"s",d(" & ")," and ",d("[-/]")," ",d("[^a-z0-9 ]"),"",d("\\s+")," "];return function(a){a= | ||
m(a.toLowerCase(),b);return" "===a?"":a}}(),advanced:function(){const b=[d("ae"),"a",d("ai"),"ei",d("ay"),"ei",d("ey"),"ei",d("oe"),"o",d("ue"),"u",d("ie"),"i",d("sz"),"s",d("zs"),"s",d("sh"),"s",d("ck"),"k",d("cc"),"k",d("dt"),"t",d("ph"),"f",d("pf"),"f",d("ou"),"o",d("uo"),"u"];return function(a,c){if(!a)return a;a=this.simple(a);2<a.length&&(a=m(a,b));c||1<a.length&&(a=F(a));return a}}(),extra:function(){const b=[d("p"),"b",d("z"),"s",d("[cgq]"),"k",d("n"),"m",d("d"),"t",d("[vw]"),"f",d("[aeiouy]"), | ||
""];return function(a){if(!a)return a;a=this.advanced(a,!0);if(1<a.length){a=a.split(" ");for(let c=0;c<a.length;c++){const d=a[c];1<d.length&&(a[c]=d[0]+m(d.substring(1),b))}a=a.join(" ");a=F(a)}return a}}(),balance:function(){const b=[d("[-/]")," ",d("[^a-z0-9 ]"),"",d("\\s+")," "];return function(a){return F(m(a.toLowerCase(),b))}}()},P=function(){function b(a){this.clear();this.s=!0!==a&&a}b.prototype.clear=function(){this.cache=t();this.count=t();this.index=t();this.g=[]};b.prototype.set=function(a, | ||
b){if(this.s&&y(this.cache[a])){let c=this.g.length;if(c===this.s){c--;const a=this.g[c];delete this.cache[a];delete this.count[a];delete this.index[a]}this.index[a]=c;this.g[c]=a;this.count[a]=-1;this.cache[a]=b;this.get(a)}else this.cache[a]=b};b.prototype.get=function(a){const b=this.cache[a];if(this.s&&b){var d=++this.count[a];const b=this.index;let c=b[a];if(0<c){const f=this.g;for(var e=c;this.count[f[--c]]<=d&&-1!==c;);c++;if(c!==e){for(d=e;d>c;d--)e=f[d-1],f[d]=e,b[e]=d;f[c]=a;b[a]=c}}}return b}; | ||
return b}();return g}(!1),this); | ||
'use strict';(function(h,w,d){let p;(p=d.define)&&p.amd?p([],function(){return w}):(p=d.modules)?p[h.toLowerCase()]=w:"object"===typeof exports?module.exports=w:d[h]=w})("FlexSearch",function(){function h(a,b){const c=b?b.id:a&&a.id;this.id=c||0===c?c:N++;this.init(a,b);w(this,"index",function(){return this.b});w(this,"length",function(){return Object.keys(this.b).length})}function w(a,b,c){Object.defineProperty(a,b,{get:c})}function d(a){return new RegExp(a,"g")}function p(a,b){for(let c=0;c<b.length;c+= | ||
2)a=a.replace(b[c],b[c+1]);return a}function C(a,b,c,f,e,l,g){if(b[c])return b[c];e=e?(9-(g||6))*l+(g||6)*e:l;b[c]=e;e>=g&&(a=a[9-(e+.5>>0)],a=a[c]||(a[c]=[]),a[a.length]=f);return e}function G(a,b){if(a){const c=Object.keys(a);for(let f=0,e=c.length;f<e;f++){const e=c[f],g=a[e];if(g)for(let c=0,f=g.length;c<f;c++)if(g[c]===b){1===f?delete a[e]:g.splice(c,1);break}else x(g[c])&&G(g[c],b)}}}function H(a){let b="",c="";var f="";for(let e=0;e<a.length;e++){const l=a[e];if(l!==c)if(e&&"h"===l){if(f="a"=== | ||
f||"e"===f||"i"===f||"o"===f||"u"===f||"y"===f,("a"===c||"e"===c||"i"===c||"o"===c||"u"===c||"y"===c)&&f||" "===c)b+=l}else b+=l;f=e===a.length-1?"":a[e+1];c=l}return b}function O(a,b){a=a.length-b.length;return 0>a?1:a?-1:0}function P(a,b){a=a.length-b.length;return 0>a?-1:a?1:0}function Q(a,b,c,f){let e=[],l;const g=a.length;if(1<g){a.sort(P);const n=u();let k=a[0],r=k.length,q=0;for(;q<r;)n["@"+k[q++]]=1;let m,h=0,v=0;for(;++v<g;){let y=!1;const p=v===g-1;l=[];k=a[v];r=k.length;for(q=0;q<r;){m= | ||
k[q++];var d="@"+m;if(n[d]){const a=n[d];if(a===v){if(p){if(e[h++]=c?c[d]:m,b&&h===b)return e}else n[d]=v+1;y=!0}else f&&(d=l[a]||(l[a]=[]),d[d.length]=m)}}if(!y&&!f)break}if(f&&(h=e.length,(v=l.length)&&(!b||h<b)))for(;v--;)if(m=l[v])for(q=0,r=m.length;q<r;q++)if(e[h++]=c?c["@"+m[q]]:m[q],b&&h===b)return e}else if(g)if(c)for(a=a[0],f=a.length,b&&b<f&&(f=b),e=Array(f),b=0;b<f;b++)e[b]=c["@"+a[b]];else e=a[0],b&&e.length>b&&(e=e.slice(0,b));return e}function D(a){return"string"===typeof a}function E(a){return"function"=== | ||
typeof a}function x(a){return"object"===typeof a}function z(a){return"undefined"===typeof a}function I(a){const b=Array(a);for(let c=0;c<a;c++)b[c]=u();return b}function u(){return Object.create(null)}const t={encode:"icase",c:"forward",s:!1,cache:!1,async:!1,A:!1,v:!1,threshold:0,depth:0,a:!1},J={memory:{encode:"extra",c:"strict",threshold:7},speed:{encode:"icase",c:"strict",threshold:7,depth:2},match:{encode:"extra",c:"full"},score:{encode:"extra",c:"strict",threshold:5,depth:4},balance:{encode:"balance", | ||
c:"strict",threshold:6,depth:3},fastest:{encode:"icase",c:"strict",threshold:9,depth:1}},F=[];let N=0;const K=d("\\W+"),L={},M={};h.create=function(a){return new h(a)};h.registerMatcher=function(a){for(const b in a)a.hasOwnProperty(b)&&F.push(d(b),a[b]);return this};h.registerEncoder=function(a,b){B[a]=b.bind(B);return this};h.registerLanguage=function(a,b){L[a]=b.filter;M[a]=b.stemmer;return this};h.encode=function(a,b){return B[a](b)};h.prototype.init=function(a,b){this.l=[];if(b){var c=b.preset; | ||
a=b}else a||(a=t),c=a.preset;b={};D(a)?(b=J[a],a={}):c&&(b=J[c]);this.c=a.tokenize||b.c||this.c||t.c;this.v=a.rtl||this.v||t.v;this.async="undefined"===typeof Promise||z(c=a.async)?this.async||t.async:c;this.threshold=z(c=a.threshold)?b.threshold||this.threshold||t.threshold:c;this.depth=z(c=a.depth)?b.depth||this.depth||t.depth:c;this.s=z(c=a.suggest)?this.s||t.s:c;this.m=(c=z(c=a.encode)?b.encode||t.encode:c)&&B[c]&&B[c].bind(B)||(E(c)?c:this.m||!1);(c=a.matcher)&&this.addMatcher(c);if(c=a.filter){c= | ||
L[c]||c;b=this.m;var f=u();if(c)for(var e=0;e<c.length;e++){var l=b?b(c[e]):c[e];f[l]=String.fromCharCode(65E3-c.length+e)}this.filter=c=f}if(c=a.stemmer){var g;b=M[c]||c;f=this.m;e=[];if(b)for(g in b)b.hasOwnProperty(g)&&(l=f?f(g):g,e.push(d("(?=.{"+(l.length+3)+",})"+l+"$"),f?f(b[g]):b[g]));this.stemmer=g=e}this.a=e=(c=a.doc)?c:this.a||t.a;this.g=I(10-(this.threshold||0));this.h=u();this.b=u();this.f=e&&u();if(e)if(a.doc=null,g=e.field,b=e.index=[],f=e.ref={},e.id=e.id.split(":"),g.constructor=== | ||
Array)for(e=0;e<g.length;e++)f[g[e]]=e,g[e]=g[e].split(":"),b[e]=new h(a),b[e].f=this.f;else f[g]=0,e.field=[g.split(":")],b[0]=new h(a),b[0].f=this.f;this.u=!0;this.j=(this.cache=c=z(c=a.cache)?this.cache||t.cache:c)?new R(c):!1;return this};h.prototype.encode=function(a){a&&F.length&&(a=p(a,F));a&&this.l.length&&(a=p(a,this.l));a&&this.m&&(a=this.m(a));a&&this.stemmer&&(a=p(a,this.stemmer));return a};h.prototype.addMatcher=function(a){const b=this.l;for(const c in a)a.hasOwnProperty(c)&&b.push(d(c), | ||
a[c]);return this};h.prototype.add=function(a,b,c,f,e){if(this.a&&x(a))return this.o("add",a,b);if(b&&D(b)&&(a||0===a)){var l="@"+a;if(this.b[l]&&!f)return this.update(a,b);if(!e){if(this.async&&"function"!==typeof importScripts){let e=this;l=new Promise(function(c){setTimeout(function(){e.add(a,b,null,f,!0);e=null;c()})});if(c)l.then(c);else return l;return this}if(c)return this.add(a,b,null,f,!0),c(),this}b=this.encode(b);if(!b.length)return this;c=this.c;e=E(c)?c(b):b.split(K);const r=u();r._ctx= | ||
u();const m=this.threshold,p=this.depth,v=this.g,A=e.length,y=this.v;for(let b=0;b<A;b++){var g=e[b];if(g){var d=g.length,n=(y?b+1:A-b)/A,k="";switch(c){case "reverse":case "both":for(var h=d;--h;)k=g[h]+k,C(v,r,k,a,y?1:(d-h)/d,n,m);k="";case "forward":for(h=0;h<d;h++)k+=g[h],C(v,r,k,a,y?(h+1)/d:1,n,m);break;case "full":for(h=0;h<d;h++){const b=(y?h+1:d-h)/d;for(let c=d;c>h;c--)k=g.substring(h,c),C(v,r,k,a,b,n,m)}break;default:if(d=C(v,r,g,a,1,n,m),p&&1<A&&d>=m)for(d=r._ctx[g]||(r._ctx[g]=u()),g= | ||
this.h[g]||(this.h[g]=I(10-(m||0))),n=b-p,k=b+p+1,0>n&&(n=0),k>A&&(k=A);n<k;n++)n!==b&&C(g,d,e[n],a,0,10-(n<b?b-n:n-b),m)}}}this.b[l]=1;this.u=!1}return this};h.prototype.o=function(a,b,c){if(b.constructor===Array)for(let e=0,f=b.length;e<f;e++){if(e===f-1)return this.o(a,b[e],c);this.o(a,b[e])}else{const d=this.a.index;let g=this.a.id,h;for(var f=0;f<g.length;f++)h=(h||b)[g[f]];if("remove"===a){delete this.f["@"+h];for(let a=0,b=d.length;a<b;a++){if(a===b-1)return d[a].remove(h,c);d[a].remove(h)}}g= | ||
this.a.field;for(let l=0,k=g.length;l<k;l++){f=g[l];let r;for(var e=0;e<f.length;e++)r=(r||b)[f[e]];this.f["@"+h]=b;f=d[l];e="add"===a?f.add:f.update;if(l===k-1)return e.call(f,h,r,c);e.call(f,h,r)}}};h.prototype.update=function(a,b,c){if(this.a&&x(a))return this.o("update",a,b);this.b["@"+a]&&D(b)&&(this.remove(a),this.add(a,b,c,!0));return this};h.prototype.remove=function(a,b,c){if(this.a&&x(a))return this.o("remove",a,b);var f="@"+a;if(this.b[f]){if(!c){if(this.async&&"function"!==typeof importScripts){let c= | ||
this;f=new Promise(function(b){setTimeout(function(){c.remove(a,null,!0);c=null;b()})});if(b)f.then(b);else return f;return this}if(b)return this.remove(a,null,!0),b(),this}for(b=0;b<10-(this.threshold||0);b++)G(this.g[b],a);this.depth&&G(this.h,a);delete this.b[f];this.u=!1}return this};h.prototype.search=function(a,b,c,f){if(x(b)){if(b.constructor===Array)for(var e=0;e<b.length;e++)b[e].query=a;else b.query=a;a=b;b=0}let d=a;let g=[];if(x(a)&&a.constructor!==Array){(c=a.callback||b)&&(d.callback= | ||
null);b=a.limit;var h=a.threshold;var n=a.boost;a=a.query}if(this.a){a=this.a.ref;h=this.a.index;var k=d.field;if(k)d.field=null;else if(d.constructor===Array){var p=d;k=[];for(var q=0;q<d.length;q++)k[q]=d[q].field}else k=Object.keys(a);if(x(k)){k.constructor===Array||(k=[k]);q=k.length;for(var m=0;m<q;m++)p&&(d=p[m]),g[m]=h[a[k[m]]].search(d);return c?c(g.concat.apply([],g)):this.async?new Promise(function(a){Promise.all(g).then(function(b){a(b.concat.apply([],b))})}):g.concat.apply([],g)}return h[a[k]].search(d, | ||
c)}h||(h=this.threshold||0);E(b)?(c=b,b=1E3):b||0===b||(b=1E3);if(!f){if(this.async&&"function"!==typeof importScripts){let e=this;a=new Promise(function(a){setTimeout(function(){a(e.search(d,b,null,!0));e=null})});if(c)a.then(c);else return a;return this}if(c)return c(this.search(d,b,null,!0)),this}if(!a||!D(a))return g;d=a;if(this.cache)if(this.u){if(c=this.j.get(a))return c}else this.j.clear(),this.u=!0;d=this.encode(d);if(!d.length)return g;c=this.c;c=E(c)?c(d):d.split(K);p=c.length;f=!0;e=[]; | ||
const t=u();1<p&&(this.depth?(k=!0,m=c[0],t[m]=1):c.sort(O));if(!k||(q=this.h)[m]){let a=0;n&&(h=(h||1)/n,0>n&&(a=h));for(n=k?1:0;n<p;n++){const b=c[n];if(b){if(!t[b]){const c=[];let d=!1,g=0;if(m=k?q[m]:this.g){let e;for(let f=a;f<10-h;f++)if(e=m[f][b])c[g++]=e,d=!0}if(d)e[e.length]=1<g?c.concat.apply([],c):c[0];else if(!this.s){f=!1;break}t[b]=1}m=b}}}else f=!1;f&&(g=Q(e,b,this.f,this.s));this.cache&&this.j.set(a,g);return g};h.prototype.info=function(){let a;let b=0,c=0,f=0;for(var e=0;e<10-(this.threshold|| | ||
0);e++){a=Object.keys(this.g[e]);for(let g=0;g<a.length;g++){var d=this.g[e][a[g]].length;b+=1*d+2*a[g].length+4;c+=d;f+=2*a[g].length}}a=Object.keys(this.b);d=a.length;for(e=0;e<d;e++)b+=2*a[e].length+2;return{id:this.id,memory:b,items:d,sequences:c,chars:f,cache:this.cache&&this.cache.i?this.cache.i.length:!1,matcher:F.length+(this.l?this.l.length:0),worker:this.A,threshold:this.threshold,depth:this.depth,contextual:this.depth&&"strict"===this.c}};h.prototype.clear=function(){return this.destroy().init()}; | ||
h.prototype.destroy=function(){this.cache&&(this.j.clear(),this.j=null);this.g=this.h=this.b=null;return this};h.prototype.export=function(){if(this.a){const a=this.a.index,b=Array(a.length+1);let c=0;for(;c<a.length;c++)b[c]=[a[c].g,a[c].h,a[c].b];b[c]=this.f;return JSON.stringify(b)}return JSON.stringify([this.g,this.h,this.b])};h.prototype.import=function(a){a=JSON.parse(a);if(this.a){const b=this.a.index,c=b.length;for(let d=0;d<c;d++){const e=b[d];e.g=a[d][0];e.h=a[d][1];e.b=a[d][2];e.f=a[c]}this.f= | ||
a[c]}else this.g=a[0],this.h=a[1],this.b=a[2],this.f=a[3]};const B={icase:function(a){return a.toLowerCase()},simple:function(){const a=[d("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",d("[\u00e8\u00e9\u00ea\u00eb]"),"e",d("[\u00ec\u00ed\u00ee\u00ef]"),"i",d("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",d("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",d("[\u00fd\u0177\u00ff]"),"y",d("\u00f1"),"n",d("\u00e7"),"c",d("\u00df"),"s",d(" & ")," and ",d("[-/]")," ",d("[^a-z0-9 ]"),"",d("\\s+")," "];return function(b){b= | ||
p(b.toLowerCase(),a);return" "===b?"":b}}(),advanced:function(){const a=[d("ae"),"a",d("ai"),"ei",d("ay"),"ei",d("ey"),"ei",d("oe"),"o",d("ue"),"u",d("ie"),"i",d("sz"),"s",d("zs"),"s",d("sh"),"s",d("ck"),"k",d("cc"),"k",d("dt"),"t",d("ph"),"f",d("pf"),"f",d("ou"),"o",d("uo"),"u"];return function(b,c){if(!b)return b;b=this.simple(b);2<b.length&&(b=p(b,a));c||1<b.length&&(b=H(b));return b}}(),extra:function(){const a=[d("p"),"b",d("z"),"s",d("[cgq]"),"k",d("n"),"m",d("d"),"t",d("[vw]"),"f",d("[aeiouy]"), | ||
""];return function(b){if(!b)return b;b=this.advanced(b,!0);if(1<b.length){b=b.split(" ");for(let c=0;c<b.length;c++){const d=b[c];1<d.length&&(b[c]=d[0]+p(d.substring(1),a))}b=b.join(" ");b=H(b)}return b}}(),balance:function(){const a=[d("[-/]")," ",d("[^a-z0-9 ]"),"",d("\\s+")," "];return function(b){return H(p(b.toLowerCase(),a))}}()},R=function(){function a(a){this.clear();this.w=!0!==a&&a}a.prototype.clear=function(){this.cache=u();this.count=u();this.index=u();this.i=[]};a.prototype.set=function(a, | ||
c){if(this.w&&z(this.cache[a])){let b=this.i.length;if(b===this.w){b--;const a=this.i[b];delete this.cache[a];delete this.count[a];delete this.index[a]}this.index[a]=b;this.i[b]=a;this.count[a]=-1;this.cache[a]=c;this.get(a)}else this.cache[a]=c};a.prototype.get=function(a){const b=this.cache[a];if(this.w&&b){var d=++this.count[a];const b=this.index;let c=b[a];if(0<c){const f=this.i;for(var e=c;this.count[f[--c]]<=d&&-1!==c;);c++;if(c!==e){for(d=e;d>c;d--)e=f[d-1],f[d]=e,b[e]=d;f[c]=a;b[a]=c}}}return b}; | ||
return a}();return h}(!1),this); |
{ | ||
"name": "flexsearch", | ||
"version": "0.3.61", | ||
"version": "0.4.0", | ||
"description": "Next-Generation full text search library with zero dependencies.", | ||
@@ -29,8 +29,8 @@ "homepage": "https://github.com/nextapps-de/flexsearch/", | ||
"scripts": { | ||
"build": "node compile RELEASE=min DEBUG=false PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_PRESETS=true SUPPORT_SUGGESTIONS=true SUPPORT_SERIALIZE=true SUPPORT_INFO=true SUPPORT_LANG_DE=false SUPPORT_LANG_EN=false", | ||
"build-light": "node compile RELEASE=light DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=false SUPPORT_CACHE=false SUPPORT_ASYNC=false SUPPORT_PRESETS=false SUPPORT_SUGGESTIONS=false SUPPORT_SERIALIZE=false SUPPORT_INFO=false SUPPORT_LANG_DE=false SUPPORT_LANG_EN=false", | ||
"build-compact": "node compile RELEASE=compact DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CACHE=false SUPPORT_ASYNC=true SUPPORT_PRESETS=true SUPPORT_SUGGESTIONS=false SUPPORT_SERIALIZE=false SUPPORT_INFO=false SUPPORT_LANG_DE=false SUPPORT_LANG_EN=false", | ||
"build-custom": "node compile RELEASE=custom DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=false SUPPORT_CACHE=false SUPPORT_ASYNC=false SUPPORT_PRESETS=false SUPPORT_SUGGESTIONS=false SUPPORT_SERIALIZE=false SUPPORT_INFO=false SUPPORT_LANG_DE=false SUPPORT_LANG_EN=false", | ||
"build-es5": "node compile RELEASE=es5 DEBUG=true PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_PRESETS=true SUPPORT_SUGGESTIONS=true SUPPORT_SERIALIZE=true SUPPORT_INFO=true SUPPORT_LANG_DE=false SUPPORT_LANG_EN=false LANGUAGE_OUT=ECMASCRIPT5_STRICT", | ||
"build-node": "node compile RELEASE=node DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_PRESETS=true SUPPORT_SUGGESTIONS=true SUPPORT_SERIALIZE=true SUPPORT_INFO=true SUPPORT_LANG_DE=false SUPPORT_LANG_EN=false", | ||
"build": "node compile RELEASE=min DEBUG=false PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_PRESETS=true SUPPORT_SUGGESTIONS=true SUPPORT_SERIALIZE=true SUPPORT_INFO=true SUPPORT_DOCUMENTS=true SUPPORT_LANG_DE=false SUPPORT_LANG_EN=false", | ||
"build-light": "node compile RELEASE=light DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=false SUPPORT_CACHE=false SUPPORT_ASYNC=false SUPPORT_PRESETS=false SUPPORT_SUGGESTIONS=false SUPPORT_SERIALIZE=false SUPPORT_INFO=false SUPPORT_DOCUMENTS=false SUPPORT_LANG_DE=false SUPPORT_LANG_EN=false", | ||
"build-compact": "node compile RELEASE=compact DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CACHE=false SUPPORT_ASYNC=true SUPPORT_PRESETS=true SUPPORT_SUGGESTIONS=false SUPPORT_SERIALIZE=false SUPPORT_INFO=false SUPPORT_DOCUMENTS=true SUPPORT_LANG_DE=false SUPPORT_LANG_EN=false", | ||
"build-custom": "node compile RELEASE=custom DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=false SUPPORT_CACHE=false SUPPORT_ASYNC=false SUPPORT_PRESETS=false SUPPORT_SUGGESTIONS=false SUPPORT_SERIALIZE=false SUPPORT_INFO=false SUPPORT_DOCUMENTS=false SUPPORT_LANG_DE=false SUPPORT_LANG_EN=false", | ||
"build-es5": "node compile RELEASE=es5 DEBUG=true PROFILER=false SUPPORT_WORKER=true SUPPORT_ENCODER=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_PRESETS=true SUPPORT_SUGGESTIONS=true SUPPORT_SERIALIZE=true SUPPORT_INFO=true SUPPORT_DOCUMENTS=true SUPPORT_LANG_DE=false SUPPORT_LANG_EN=false LANGUAGE_OUT=ECMASCRIPT5_STRICT", | ||
"build-node": "node compile RELEASE=node DEBUG=false PROFILER=false SUPPORT_WORKER=false SUPPORT_ENCODER=true SUPPORT_CACHE=true SUPPORT_ASYNC=true SUPPORT_PRESETS=true SUPPORT_SUGGESTIONS=true SUPPORT_SERIALIZE=true SUPPORT_INFO=true SUPPORT_DOCUMENTS=true SUPPORT_LANG_DE=false SUPPORT_LANG_EN=false", | ||
"build-lang": "node compile RELEASE=lang", | ||
@@ -37,0 +37,0 @@ "build-all": "npm run build && npm run build-light && npm run build-compact && npm run build-es5 && npm run build-node && npm run build-lang", |
307
README.md
<p align="center"> | ||
<br> | ||
<img src="https://rawgithub.com/nextapps-de/flexsearch/master/doc/flexsearch.svg" alt="Search Library" width="50%"> | ||
<img src="https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@master/doc/flexsearch.svg" alt="Search Library" width="50%"> | ||
<br><br> | ||
@@ -18,8 +18,10 @@ <a target="_blank" href="https://www.npmjs.com/package/flexsearch"><img src="https://img.shields.io/npm/v/flexsearch.svg"></a> | ||
When it comes to raw search speed <a href="https://rawgit.com/nextapps-de/flexsearch/master/test/benchmark.html" target="_blank">FlexSearch outperforms every single searching library out there</a> and also provides flexible search capabilities like multi-word matching, phonetic transformations or partial matching. | ||
Depending on the used options it also providing the <a href="#memory">most memory-efficient index</a>. Keep in mind that updating and/or removing existing items from the index has a significant cost. When your index needs to be updated very often then <a href="https://github.com/nextapps-de/bulksearch" target="_blank">BulkSearch</a> may be a better choice. | ||
When it comes to raw search speed <a href="https://raw.githack.com/nextapps-de/flexsearch/master/test/benchmark.html" target="_blank">FlexSearch outperforms every single searching library out there</a> and also provides flexible search capabilities like multi-word matching, phonetic transformations or partial matching. | ||
Depending on the used options it also provides the <a href="#memory">most memory-efficient index</a>. Keep in mind that updating and/or removing existing items from the index has a significant cost. When your index needs to be updated very often then <a href="https://github.com/nextapps-de/bulksearch" target="_blank">BulkSearch</a> may be a better choice. | ||
FlexSearch also provides you a non-blocking asynchronous processing model as well as web workers to perform any updates or queries on the index in parallel through dedicated balanced threads. | ||
<a href="#installation">Installation Guide</a>  •  <a href="#api">API Reference</a>  •  <a href="#profiles">Example Options</a>  •  <a href="#builds">Custom Builds</a>  •  <a target="_blank" href="https://github.com/nextapps-de/flexsearch-server">Flexsearch Server</a> | ||
FlexSearch Server is also available here: <a target="_blank" href="https://github.com/nextapps-de/flexsearch-server">https://github.com/nextapps-de/flexsearch-server</a>. | ||
<a href="#installation">Installation Guide</a>  •  <a href="#api">API Reference</a>  •  <a href="#profiles">Example Options</a>  •  <a href="#builds">Custom Builds</a>  •  <a target="_blank" href="https://github.com/nextapps-de/flexsearch-server">Flexsearch Server</a>  •  <a href="CHANGELOG.md">Changelog</a> | ||
Supported Platforms: | ||
@@ -29,7 +31,8 @@ - Browser | ||
> FlexSearch Server is also available here: <a target="_blank" href="https://github.com/nextapps-de/flexsearch-server">https://github.com/nextapps-de/flexsearch-server</a> | ||
Demos: | ||
- <a href="https://raw.githack.com/nextapps-de/flexsearch/master/demo/autocomplete.html" target="_blank">Auto-Complete</a> | ||
Library Comparison: | ||
- <a href="https://rawgit.com/nextapps-de/flexsearch/master/test/benchmark.html" target="_blank">Benchmark "Gulliver's Travels"</a> | ||
- <a href="https://rawgit.com/nextapps-de/flexsearch/master/test/matching.html" target="_blank">Relevance Scoring</a> | ||
- <a href="https://raw.githack.com/nextapps-de/flexsearch/master/test/benchmark.html" target="_blank">Benchmark "Gulliver's Travels"</a> | ||
- <a href="https://raw.githack.com/nextapps-de/flexsearch/master/test/matching.html" target="_blank">Relevance Scoring</a> | ||
- <a href="#consumption">Memory Consumption</a> | ||
@@ -84,4 +87,4 @@ | ||
</td> | ||
<td>x</td> | ||
<td>x</td> | ||
<td>✔</td> | ||
<td>✔</td> | ||
<td>-</td> | ||
@@ -94,4 +97,4 @@ </tr> | ||
</td> | ||
<td>x</td> | ||
<td>x</td> | ||
<td>✔</td> | ||
<td>✔</td> | ||
<td>-</td> | ||
@@ -104,3 +107,3 @@ </tr> | ||
</td> | ||
<td>x</td> | ||
<td>✔</td> | ||
<td>-</td> | ||
@@ -114,5 +117,5 @@ <td>-</td> | ||
</td> | ||
<td>x</td> | ||
<td>x</td> | ||
<td>x</td> | ||
<td>✔</td> | ||
<td>✔</td> | ||
<td>✔</td> | ||
</tr> | ||
@@ -122,7 +125,16 @@ <tr></tr> | ||
<td> | ||
<a href="#docs">Index Documents (Field-Search)</a> | ||
</td> | ||
<td>✔</td> | ||
<td>✔</td> | ||
<td>-</td> | ||
</tr> | ||
<tr></tr> | ||
<tr> | ||
<td> | ||
Partial Matching | ||
</td> | ||
<td>x</td> | ||
<td>x</td> | ||
<td>x</td> | ||
<td>✔</td> | ||
<td>✔</td> | ||
<td>✔</td> | ||
</tr> | ||
@@ -134,5 +146,5 @@ <tr></tr> | ||
</td> | ||
<td>x</td> | ||
<td>x</td> | ||
<td>x</td> | ||
<td>✔</td> | ||
<td>✔</td> | ||
<td>✔</td> | ||
</tr> | ||
@@ -144,5 +156,5 @@ <tr></tr> | ||
</td> | ||
<td>x</td> | ||
<td>x</td> | ||
<td>x</td> | ||
<td>✔</td> | ||
<td>✔</td> | ||
<td>✔</td> | ||
</tr> | ||
@@ -154,3 +166,3 @@ <tr></tr> | ||
</td> | ||
<td>x</td> | ||
<td>✔</td> | ||
<td>-</td> | ||
@@ -164,3 +176,3 @@ <td>-</td> | ||
</td> | ||
<td>x</td> | ||
<td>✔</td> | ||
<td>-</td> | ||
@@ -174,4 +186,4 @@ <td>-</td> | ||
</td> | ||
<td>x</td> | ||
<td>x</td> | ||
<td>✔</td> | ||
<td>✔</td> | ||
<td>-</td> | ||
@@ -184,5 +196,5 @@ </tr> | ||
</td> | ||
<td>x</td> | ||
<td>x</td> | ||
<td>x</td> | ||
<td>✔</td> | ||
<td>✔</td> | ||
<td>✔</td> | ||
</tr> | ||
@@ -202,3 +214,3 @@ <tr> | ||
Comparison: <a href="https://rawgit.com/nextapps-de/flexsearch/master/test/benchmark.html" target="_blank">Benchmark "Gulliver's Travels"</a> | ||
Comparison: <a href="https://raw.githack.com/nextapps-de/flexsearch/master/test/benchmark.html" target="_blank">Benchmark "Gulliver's Travels"</a> | ||
@@ -389,3 +401,3 @@ ##### Query Test: "Gulliver's Travels" | ||
Library Comparison: <a href="https://rawgit.com/nextapps-de/flexsearch/master/test/benchmark.html" target="_blank">Benchmark "Gulliver's Travels"</a> | ||
Library Comparison: <a href="https://raw.githack.com/nextapps-de/flexsearch/master/test/benchmark.html" target="_blank">Benchmark "Gulliver's Travels"</a> | ||
@@ -397,9 +409,9 @@ <a name="contextual"></a> | ||
FlexSearch introduce a new scoring mechanism called __Contextual Search__ which was invented by Thomas Wilkerling, the author of this library. A Contextual Search <a href="https://rawgit.com/nextapps-de/flexsearch/master/test/benchmark.html" target="_blank">incredibly boost up queries to a complete new level</a> but also requires a lot of additionally memory. | ||
FlexSearch introduce a new scoring mechanism called __Contextual Search__ which was invented by Thomas Wilkerling, the author of this library. A Contextual Search <a href="https://raw.githack.com/nextapps-de/flexsearch/master/test/benchmark.html" target="_blank">incredibly boost up queries to a complete new level</a> but also requires a lot of additionally memory. | ||
The basic idea of this concept is to limit relevance by its context instead of calculating relevance through the whole (unlimited) distance. | ||
Imagine you add a text block of some sentences to an index ID. Assuming the query includes a combination of first and last word from this text block, are they really relevant to each other? | ||
In this way contextual search <a href="https://rawgit.com/nextapps-de/flexsearch/master/test/matching.html" target="_blank">also improves the results of relevance-based queries</a> on large amount of text data. | ||
In this way contextual search <a href="https://raw.githack.com/nextapps-de/flexsearch/master/test/matching.html" target="_blank">also improves the results of relevance-based queries</a> on large amount of text data. | ||
<p align="center"> | ||
<img src="https://rawgithub.com/nextapps-de/flexsearch/master/doc/contextual-index.svg"> | ||
<img src="https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@master/doc/contextual-index.svg"> | ||
</p> | ||
@@ -510,3 +522,3 @@ | ||
```html | ||
<script src="https://cdn.rawgit.com/nextapps-de/flexsearch/master/dist/flexsearch.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@master/dist/flexsearch.min.js"></script> | ||
``` | ||
@@ -516,3 +528,3 @@ | ||
```html | ||
<script src="https://cdn.rawgit.com/nextapps-de/flexsearch/0.3.51/dist/flexsearch.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@0.3.51/dist/flexsearch.min.js"></script> | ||
``` | ||
@@ -970,3 +982,3 @@ | ||
tokenize: function(str){ | ||
return str.split(/[\x00-\x7F]+/); | ||
return str.replace(/[\x00-\x7F]/g, "").split(""); | ||
} | ||
@@ -979,13 +991,9 @@ }); | ||
```js | ||
index.add(0, "서울시가 잠이 든 시간에 아무 말, 미뤄, 미뤄"); | ||
index.add(0, "一个单词"); | ||
``` | ||
```js | ||
var results = index.search("든"); | ||
var results = index.search("单词"); | ||
``` | ||
```js | ||
var results = index.search("시간에"); | ||
``` | ||
<a name="index.info"></a> | ||
@@ -1018,2 +1026,197 @@ ### Get info about an index | ||
``` | ||
<a name="docs"></a> | ||
## Index Documents (Field-Search) | ||
#### The Document Descriptor | ||
Assume the document is an array of data like: | ||
```js | ||
var docs = [{ | ||
id: 0, | ||
title: "Title", | ||
cat: "Category", | ||
content: "Body" | ||
},{ | ||
id: 1, | ||
title: "Title", | ||
cat: "Category", | ||
content: "Body" | ||
}]; | ||
``` | ||
Provide a document descriptor ___doc___ when initializing a new index, e.g. related to the example above: | ||
```js | ||
var index = new FlexSearch({ | ||
tokenize: "strict", | ||
depth: 3, | ||
doc: { | ||
id: "id", | ||
field: "content" | ||
} | ||
}); | ||
``` | ||
The above example will index one field ("content"), to index multiple fields just pass an array: | ||
```js | ||
var index = new FlexSearch({ | ||
doc: { | ||
id: "id", | ||
field: [ | ||
"title", | ||
"cat", | ||
"content" | ||
] | ||
} | ||
}); | ||
``` | ||
#### Complex Objects | ||
Assume the document array looks more complex (has nested branches etc.), e.g.: | ||
```js | ||
var docs = [{ | ||
data:{ | ||
id: 0, | ||
title: "Title", | ||
body: { | ||
content: "Body" | ||
} | ||
} | ||
},{ | ||
data:{ | ||
id: 1, | ||
title: "Title", | ||
body: { | ||
content: "Body" | ||
} | ||
} | ||
}]; | ||
``` | ||
Then use the colon separated notation ___"root:child"___ to define hierarchy within the document descriptor: | ||
```js | ||
var index = new FlexSearch({ | ||
doc: { | ||
id: "data:id", | ||
field: [ | ||
"data:title", | ||
"data:content:body" | ||
] | ||
} | ||
}); | ||
``` | ||
#### Add/Update/Remove Documents to the Index | ||
Just pass the document array (or one single object) to the index: | ||
```js | ||
index.add(docs); | ||
``` | ||
Update (single object or array of objects): | ||
```js | ||
index.update({ | ||
data:{ | ||
id: 0, | ||
title: "Foo", | ||
body: { | ||
content: "Bar" | ||
} | ||
} | ||
}); | ||
``` | ||
Remove (single object or array of objects): | ||
```js | ||
index.remove(docs); | ||
``` | ||
When you know the id, you can also simply remove by: | ||
```js | ||
index.remove(id); | ||
``` | ||
#### Field-Search | ||
When searching you have several options when using documents. | ||
This will search through all indexed fields: | ||
```js | ||
var results = index.search("body"); | ||
``` | ||
This will search on a specific field): | ||
```js | ||
var results = index.search({ | ||
field: "title", | ||
query: "title" | ||
}); | ||
``` | ||
The colon notation also has to be applied for the searching respectively, e.g.: | ||
```js | ||
var results = index.search({ | ||
field: "data:body", | ||
query: "body" | ||
}); | ||
``` | ||
This could also be written as: | ||
```js | ||
var results = index.search("body", { | ||
field: "data:body", | ||
}); | ||
``` | ||
Search the same query on multiple fields: | ||
```js | ||
var results = index.search({ | ||
query: "title", | ||
field: ["title", "body"] | ||
}); | ||
``` | ||
Could also be written as: | ||
```js | ||
var results = index.search("title", { | ||
field: ["title", "body"] | ||
}); | ||
``` | ||
Search different queries on multiple fields: | ||
```js | ||
var results = index.search([{ | ||
field: "title", | ||
query: "title" | ||
},{ | ||
field: "body", | ||
query: "body" | ||
}]); | ||
``` | ||
Boost scoring on specific fields: | ||
```js | ||
var results = index.search([{ | ||
field: "title", | ||
query: "title", | ||
boost: 2 | ||
},{ | ||
field: "body", | ||
query: "body", | ||
boost: 0.5 | ||
}]); | ||
``` | ||
<a name="chaining"></a> | ||
@@ -1036,3 +1239,3 @@ ### Chaining | ||
<a name="contextual_enable"></a> | ||
### Enable Contextual Scoring | ||
## Enable Contextual Scoring | ||
@@ -1057,3 +1260,3 @@ Create an index and just set the limit of relevance as "depth": | ||
<a name="cache"></a> | ||
### Enable Auto-Balanced Cache | ||
## Enable Auto-Balanced Cache | ||
@@ -1074,3 +1277,3 @@ Create index and just set a limit of cache entries: | ||
<a name="webworker"></a> | ||
### WebWorker Sharding (Browser only) | ||
## WebWorker Sharding (Browser only) | ||
@@ -1564,3 +1767,3 @@ Worker get its own dedicated memory and also run in their own dedicated thread without blocking the UI while processing. Especially for larger indexes, web worker improves speed and available memory a lot. FlexSearch index was tested with a 250 Mb text file including 10 Million words. <!--The indexing was done silently in background by multiple parallel running workers in about 7 minutes. The final index reserves ~ 8.2 Mb memory/space. The search result took ~ 0.25 ms.--> | ||
<br> | ||
<img src="https://rawgithub.com/nextapps-de/flexsearch/master/doc/memory-comparison.svg"> | ||
<img src="https://cdn.jsdelivr.net/gh/nextapps-de/flexsearch@master/doc/memory-comparison.svg"> | ||
@@ -1642,4 +1845,4 @@ <a name="profiles"></a> | ||
Compare these presets: | ||
- <a href="https://rawgit.com/nextapps-de/flexsearch/master/test/matching-presets.html" target="_blank">Relevance Scoring</a><br> | ||
- <a href="https://rawgit.com/nextapps-de/flexsearch/master/test/benchmark-presets.html" target="_blank">Benchmarks</a> | ||
- <a href="https://raw.githack.com/nextapps-de/flexsearch/master/test/matching-presets.html" target="_blank">Relevance Scoring</a><br> | ||
- <a href="https://raw.githack.com/nextapps-de/flexsearch/master/test/benchmark-presets.html" target="_blank">Benchmarks</a> | ||
@@ -1931,2 +2134,4 @@ ## Best Practices | ||
<a href="CHANGELOG.md">Changelog</a> | ||
--- | ||
@@ -1933,0 +2138,0 @@ |
114
test/test.js
@@ -876,3 +876,3 @@ if(typeof module !== "undefined"){ | ||
tokenize: function(str){ | ||
return str.split(/[\x00-\x7F]+/); | ||
return str.replace(/[\x00-\x7F]/g, "").split(""); | ||
} | ||
@@ -885,2 +885,6 @@ }); | ||
expect(index.search("시간에")).to.include(0); | ||
index.add(1, "一个单词"); | ||
expect(index.search("单词")).to.include(1); | ||
}); | ||
@@ -1078,28 +1082,100 @@ }); | ||
if(env !== "light"){ | ||
if(env !== "light") describe("Suggestion", function(){ | ||
describe("Suggestion", function(){ | ||
it("Should have been suggested properly by relevance", function(){ | ||
it("Should have been suggested properly by relevance", function(){ | ||
var index = new FlexSearch({ | ||
encode: "advanced", | ||
tokenize: "strict", | ||
suggest: true | ||
}); | ||
var index = new FlexSearch({ | ||
encode: "advanced", | ||
tokenize: "strict", | ||
suggest: true | ||
}); | ||
index.add(0, "1 2 3 2 4 1 5 3"); | ||
index.add(1, "zero one two three four five six seven eight nine ten"); | ||
index.add(2, "four two zero one three ten five seven eight six nine"); | ||
index.add(0, "1 2 3 2 4 1 5 3"); | ||
index.add(1, "zero one two three four five six seven eight nine ten"); | ||
index.add(2, "four two zero one three ten five seven eight six nine"); | ||
expect(index.search("1 3 4 7")).to.have.members([0]); | ||
expect(index.search("1 3 9 7")).to.have.members([0]); | ||
expect(index.search("one foobar two")).to.have.members([1, 2]); | ||
expect(index.search("zero one foobar two foobar")).to.have.members([1, 2]); | ||
//TODO | ||
//expect(index.search("zero one foobar two foobar")[0]).to.equal(1); | ||
}); | ||
}); | ||
expect(index.search("1 3 4 7")).to.have.members([0]); | ||
expect(index.search("1 3 9 7")).to.have.members([0]); | ||
expect(index.search("one foobar two")).to.have.members([1, 2]); | ||
expect(index.search("zero one foobar two foobar")).to.have.members([1, 2]); | ||
//TODO | ||
//expect(index.search("zero one foobar two foobar")[0]).to.equal(1); | ||
// ------------------------------------------------------------------------ | ||
// Multi-Field Documents | ||
// ------------------------------------------------------------------------ | ||
if(typeof Worker !== "undefined" && !this._phantom){ | ||
require("./test.es6.js")(FlexSearch, env); | ||
} | ||
// ------------------------------------------------------------------------ | ||
// Export / Import | ||
// ------------------------------------------------------------------------ | ||
if(env !== "light") describe("Export / Import", function(){ | ||
var data; | ||
it("Should have been exported properly", function(){ | ||
var index = new FlexSearch({ | ||
tokenize: "reverse", | ||
doc: { | ||
id: "id", | ||
field: "title" | ||
} | ||
}); | ||
index.add({id: 0, title: "foo"}); | ||
index.add({id: 1, title: "bar"}); | ||
index.add({id: 2, title: "foobar"}); | ||
if(env === ""){ | ||
expect(index.doc.index[0].length).to.equal(3); | ||
data = index.export(); | ||
expect(data).to.equal(JSON.stringify([ | ||
[ | ||
index.doc.index[0]._map, | ||
index.doc.index[0]._ctx, | ||
index.doc.index[0]._ids | ||
], | ||
index._doc | ||
])); | ||
} | ||
else{ | ||
data = index.export(); | ||
} | ||
}); | ||
} | ||
it("Should have been imported properly", function(){ | ||
var index = new FlexSearch("score", { | ||
doc: { | ||
id: "id", | ||
field: "title" | ||
} | ||
}); | ||
index.import(data); | ||
if(env === ""){ | ||
expect(index.doc.index[0].length).to.equal(3); | ||
} | ||
expect(index.search("foo")).to.have.lengthOf(2); | ||
expect(index.search("bar")).to.have.lengthOf(2); | ||
expect(index.search("foobar")).to.have.lengthOf(1); | ||
expect(index.search("foobar")[0].id).to.equal(2); | ||
}); | ||
}); | ||
// ------------------------------------------------------------------------ | ||
@@ -1106,0 +1182,0 @@ // Feature Tests |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
340825
22
4337
2114