Spaces:
Running
Running
var y;function J(t,i,e){const s=typeof e,n=typeof t;if(s!=="undefined"){if(n!=="undefined"){if(e){if(n==="function"&&s===n)return function(l){return t(e(l))};if(i=t.constructor,i===e.constructor){if(i===Array)return e.concat(t);if(i===Map){var r=new Map(e);for(var h of t)r.set(h[0],h[1]);return r}if(i===Set){h=new Set(e);for(r of t.values())h.add(r);return h}}}return t}return e}return n==="undefined"?i:t}function G(t,i){return typeof t>"u"?i:t}function O(){return Object.create(null)}function N(t){return typeof t=="string"}function lt(t){return typeof t=="object"}function ot(t,i){if(N(i))t=t[i];else for(let e=0;t&&e<i.length;e++)t=t[i[e]];return t}const fe=/[^\p{L}\p{N}]+/u,ue=/(\d{3})/g,ce=/(\D)(\d{3})/g,ge=/(\d{3})(\D)/g,Ht=/[\u0300-\u036f]/g;function ft(t={}){if(!this||this.constructor!==ft)return new ft(...arguments);if(arguments.length)for(t=0;t<arguments.length;t++)this.assign(arguments[t]);else this.assign(t)}y=ft.prototype;y.assign=function(t){this.normalize=J(t.normalize,!0,this.normalize);let i=t.include,e=i||t.exclude||t.split,s;if(e||e===""){if(typeof e=="object"&&e.constructor!==RegExp){let n="";s=!i,i||(n+="\\p{Z}"),e.letter&&(n+="\\p{L}"),e.number&&(n+="\\p{N}",s=!!i),e.symbol&&(n+="\\p{S}"),e.punctuation&&(n+="\\p{P}"),e.control&&(n+="\\p{C}"),(e=e.char)&&(n+=typeof e=="object"?e.join(""):e);try{this.split=new RegExp("["+(i?"^":"")+n+"]+","u")}catch{this.split=/\s+/}}else this.split=e,s=e===!1||"a1a".split(e).length<2;this.numeric=J(t.numeric,s)}else{try{this.split=J(this.split,fe)}catch{this.split=/\s+/}this.numeric=J(t.numeric,J(this.numeric,!0))}if(this.prepare=J(t.prepare,null,this.prepare),this.finalize=J(t.finalize,null,this.finalize),e=t.filter,this.filter=typeof e=="function"?e:J(e&&new Set(e),null,this.filter),this.dedupe=J(t.dedupe,!0,this.dedupe),this.matcher=J((e=t.matcher)&&new Map(e),null,this.matcher),this.mapper=J((e=t.mapper)&&new Map(e),null,this.mapper),this.stemmer=J((e=t.stemmer)&&new Map(e),null,this.stemmer),this.replacer=J(t.replacer,null,this.replacer),this.minlength=J(t.minlength,1,this.minlength),this.maxlength=J(t.maxlength,1024,this.maxlength),this.rtl=J(t.rtl,!1,this.rtl),(this.cache=e=J(t.cache,!0,this.cache))&&(this.F=null,this.L=typeof e=="number"?e:2e5,this.B=new Map,this.D=new Map,this.I=this.H=128),this.h="",this.J=null,this.A="",this.K=null,this.matcher)for(const n of this.matcher.keys())this.h+=(this.h?"|":"")+n;if(this.stemmer)for(const n of this.stemmer.keys())this.A+=(this.A?"|":"")+n;return this};y.addStemmer=function(t,i){return this.stemmer||(this.stemmer=new Map),this.stemmer.set(t,i),this.A+=(this.A?"|":"")+t,this.K=null,this.cache&&D(this),this};y.addFilter=function(t){return typeof t=="function"?this.filter=t:(this.filter||(this.filter=new Set),this.filter.add(t)),this.cache&&D(this),this};y.addMapper=function(t,i){return typeof t=="object"?this.addReplacer(t,i):t.length>1?this.addMatcher(t,i):(this.mapper||(this.mapper=new Map),this.mapper.set(t,i),this.cache&&D(this),this)};y.addMatcher=function(t,i){return typeof t=="object"?this.addReplacer(t,i):t.length<2&&(this.dedupe||this.mapper)?this.addMapper(t,i):(this.matcher||(this.matcher=new Map),this.matcher.set(t,i),this.h+=(this.h?"|":"")+t,this.J=null,this.cache&&D(this),this)};y.addReplacer=function(t,i){return typeof t=="string"?this.addMatcher(t,i):(this.replacer||(this.replacer=[]),this.replacer.push(t,i),this.cache&&D(this),this)};y.encode=function(t,i){if(this.cache&&t.length<=this.H)if(this.F){if(this.B.has(t))return this.B.get(t)}else this.F=setTimeout(D,50,this);this.normalize&&(typeof this.normalize=="function"?t=this.normalize(t):t=Ht?t.normalize("NFKD").replace(Ht,"").toLowerCase():t.toLowerCase()),this.prepare&&(t=this.prepare(t)),this.numeric&&t.length>3&&(t=t.replace(ce,"$1 $2").replace(ge,"$1 $2").replace(ue,"$1 "));const e=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer);let s=[],n=O(),r,h,l=this.split||this.split===""?t.split(this.split):[t];for(let f=0,u,g;f<l.length;f++)if((u=g=l[f])&&!(u.length<this.minlength||u.length>this.maxlength)){if(i){if(n[u])continue;n[u]=1}else{if(r===u)continue;r=u}if(e)s.push(u);else if(!this.filter||(typeof this.filter=="function"?this.filter(u):!this.filter.has(u))){if(this.cache&&u.length<=this.I)if(this.F){var o=this.D.get(u);if(o||o===""){o&&s.push(o);continue}}else this.F=setTimeout(D,50,this);if(this.stemmer){this.K||(this.K=new RegExp("(?!^)("+this.A+")$"));let m;for(;m!==u&&u.length>2;)m=u,u=u.replace(this.K,d=>this.stemmer.get(d))}if(u&&(this.mapper||this.dedupe&&u.length>1)){o="";for(let m=0,d="",a,c;m<u.length;m++)a=u.charAt(m),a===d&&this.dedupe||((c=this.mapper&&this.mapper.get(a))||c===""?c===d&&this.dedupe||!(d=c)||(o+=c):o+=d=a);u=o}if(this.matcher&&u.length>1&&(this.J||(this.J=new RegExp("("+this.h+")","g")),u=u.replace(this.J,m=>this.matcher.get(m))),u&&this.replacer)for(o=0;u&&o<this.replacer.length;o+=2)u=u.replace(this.replacer[o],this.replacer[o+1]);if(this.cache&&g.length<=this.I&&(this.D.set(g,u),this.D.size>this.L&&(this.D.clear(),this.I=this.I/1.1|0)),u){if(u!==g)if(i){if(n[u])continue;n[u]=1}else{if(h===u)continue;h=u}s.push(u)}}}return this.finalize&&(s=this.finalize(s)||s),this.cache&&t.length<=this.H&&(this.B.set(t,s),this.B.size>this.L&&(this.B.clear(),this.H=this.H/1.1|0)),s};function D(t){t.F=null,t.B.clear(),t.D.clear()}function Pt(t,i,e){e||(i||typeof t!="object"?typeof i=="object"&&(e=i,i=0):e=t),e&&(t=e.query||t,i=e.limit||i);let s=""+(i||0);e&&(s+=(e.offset||0)+!!e.context+!!e.suggest+(e.resolve!==!1)+(e.resolution||this.resolution)+(e.boost||0)),t=(""+t).toLowerCase(),this.cache||(this.cache=new U);let n=this.cache.get(t+s);if(!n){const r=e&&e.cache;r&&(e.cache=!1),n=this.search(t,i,e),r&&(e.cache=r),this.cache.set(t+s,n)}return n}function U(t){this.limit=t&&t!==!0?t:1e3,this.cache=new Map,this.h=""}U.prototype.set=function(t,i){this.cache.set(this.h=t,i),this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};U.prototype.get=function(t){const i=this.cache.get(t);return i&&this.h!==t&&(this.cache.delete(t),this.cache.set(this.h=t,i)),i};U.prototype.remove=function(t){for(const i of this.cache){const e=i[0];i[1].includes(t)&&this.cache.delete(e)}};U.prototype.clear=function(){this.cache.clear(),this.h=""};const Wt={normalize:!1,numeric:!1,dedupe:!1},pt={},St=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]),Kt=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),Zt=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"],Qt={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,ß:2,d:3,t:3,l:4,m:5,n:5,r:6};var Et={Exact:Wt,Default:pt,Normalize:pt,LatinBalance:{mapper:St},LatinAdvanced:{mapper:St,matcher:Kt,replacer:Zt},LatinExtra:{mapper:St,replacer:Zt.concat([/(?!^)[aeo]/g,""]),matcher:Kt},LatinSoundex:{dedupe:!1,include:{letter:!0},finalize:function(t){for(let e=0;e<t.length;e++){var i=t[e];let s=i.charAt(0),n=Qt[s];for(let r=1,h;r<i.length&&(h=i.charAt(r),h==="h"||h==="w"||!(h=Qt[h])||h===n||(s+=h,n=h,s.length!==4));r++);t[e]=s}}},CJK:{split:""},LatinExact:Wt,LatinDefault:pt,LatinSimple:pt};function Vt(t,i,e,s){let n=[];for(let r=0,h;r<t.index.length;r++)if(h=t.index[r],i>=h.length)i-=h.length;else{i=h[s?"splice":"slice"](i,e);const l=i.length;if(l&&(n=n.length?n.concat(i):i,e-=l,s&&(t.length-=l),!e))break;i=0}return n}function et(t){if(!this||this.constructor!==et)return new et(t);this.index=t?[t]:[],this.length=t?t.length:0;const i=this;return new Proxy([],{get(e,s){if(s==="length")return i.length;if(s==="push")return function(n){i.index[i.index.length-1].push(n),i.length++};if(s==="pop")return function(){if(i.length)return i.length--,i.index[i.index.length-1].pop()};if(s==="indexOf")return function(n){let r=0;for(let h=0,l,o;h<i.index.length;h++){if(l=i.index[h],o=l.indexOf(n),o>=0)return r+o;r+=l.length}return-1};if(s==="includes")return function(n){for(let r=0;r<i.index.length;r++)if(i.index[r].includes(n))return!0;return!1};if(s==="slice")return function(n,r){return Vt(i,n||0,r||i.length,!1)};if(s==="splice")return function(n,r){return Vt(i,n||0,r||i.length,!0)};if(s==="constructor")return Array;if(typeof s!="symbol")return(e=i.index[s/2**31|0])&&e[s]},set(e,s,n){return e=s/2**31|0,(i.index[e]||(i.index[e]=[]))[s]=n,i.length++,!0}})}et.prototype.clear=function(){this.index.length=0};et.prototype.push=function(){};function F(t=8){if(!this||this.constructor!==F)return new F(t);this.index=O(),this.h=[],this.size=0,t>32?(this.B=te,this.A=BigInt(t)):(this.B=qt,this.A=t)}F.prototype.get=function(t){const i=this.index[this.B(t)];return i&&i.get(t)};F.prototype.set=function(t,i){var e=this.B(t);let s=this.index[e];s?(e=s.size,s.set(t,i),(e-=s.size)&&this.size++):(this.index[e]=s=new Map([[t,i]]),this.h.push(s),this.size++)};function H(t=8){if(!this||this.constructor!==H)return new H(t);this.index=O(),this.h=[],this.size=0,t>32?(this.B=te,this.A=BigInt(t)):(this.B=qt,this.A=t)}H.prototype.add=function(t){var i=this.B(t);let e=this.index[i];e?(i=e.size,e.add(t),(i-=e.size)&&this.size++):(this.index[i]=e=new Set([t]),this.h.push(e),this.size++)};y=F.prototype;y.has=H.prototype.has=function(t){const i=this.index[this.B(t)];return i&&i.has(t)};y.delete=H.prototype.delete=function(t){const i=this.index[this.B(t)];i&&i.delete(t)&&this.size--};y.clear=H.prototype.clear=function(){this.index=O(),this.h=[],this.size=0};y.values=H.prototype.values=function*(){for(let t=0;t<this.h.length;t++)for(let i of this.h[t].values())yield i};y.keys=H.prototype.keys=function*(){for(let t=0;t<this.h.length;t++)for(let i of this.h[t].keys())yield i};y.entries=H.prototype.entries=function*(){for(let t=0;t<this.h.length;t++)for(let i of this.h[t].entries())yield i};function qt(t){let i=2**this.A-1;if(typeof t=="number")return t&i;let e=0,s=this.A+1;for(let n=0;n<t.length;n++)e=(e*s^t.charCodeAt(n))&i;return this.A===32?e+2**31:e}function te(t){let i=BigInt(2)**this.A-BigInt(1);var e=typeof t;if(e==="bigint")return t&i;if(e==="number")return BigInt(t)&i;e=BigInt(0);let s=this.A+BigInt(1);for(let n=0;n<t.length;n++)e=(e*s^BigInt(t.charCodeAt(n)))&i;return e}let E,ht;async function pe(t){t=t.data;var i=t.task;const e=t.id;let s=t.args;switch(i){case"init":ht=t.options||{},(i=t.factory)?(Function("return "+i)()(self),E=new self.FlexSearch.Index(ht),delete self.FlexSearch):E=new W(ht),postMessage({id:e});break;default:let n;i==="export"&&(s[1]?(s[0]=ht.export,s[2]=0,s[3]=1):s=null),i==="import"?s[0]&&(t=await ht.import.call(E,s[0]),E.import(s[0],t)):((n=s&&E[i].apply(E,s))&&n.then&&(n=await n),n&&n.await&&(n=await n.await),i==="search"&&n.result&&(n=n.result)),postMessage(i==="search"?{id:e,msg:n}:{id:e})}}function $t(t){q.call(t,"add"),q.call(t,"append"),q.call(t,"search"),q.call(t,"update"),q.call(t,"remove"),q.call(t,"searchCache")}let zt,Xt,mt;function de(){zt=mt=0}function q(t){this[t+"Async"]=function(){const i=arguments;var e=i[i.length-1];let s;if(typeof e=="function"&&(s=e,delete i[i.length-1]),zt?mt||(mt=Date.now()-Xt>=this.priority*this.priority*3):(zt=setTimeout(de,0),Xt=Date.now()),mt){const r=this;return new Promise(h=>{setTimeout(function(){h(r[t+"Async"].apply(r,i))},0)})}const n=this[t].apply(this,i);return e=n.then?n:new Promise(r=>r(n)),s&&e.then(s),e}}let Q=0;function it(t={},i){function e(l){function o(f){f=f.data||f;const u=f.id,g=u&&r.h[u];g&&(g(f.msg),delete r.h[u])}if(this.worker=l,this.h=O(),this.worker)return n?this.worker.on("message",o):this.worker.onmessage=o,t.config?new Promise(function(f){Q>1e9&&(Q=0),r.h[++Q]=function(){f(r)},r.worker.postMessage({id:Q,task:"init",factory:s,options:t})}):(this.priority=t.priority||4,this.encoder=i||null,this.worker.postMessage({task:"init",factory:s,options:t}),this)}if(!this||this.constructor!==it)return new it(t);let s=typeof self<"u"?self._factory:typeof window<"u"?window._factory:null;s&&(s=s.toString());const n=typeof window>"u",r=this,h=ae(s,n,t.worker);return h.then?h.then(function(l){return e.call(r,l)}):e.call(this,h)}V("add");V("append");V("search");V("update");V("remove");V("clear");V("export");V("import");it.prototype.searchCache=Pt;$t(it.prototype);function V(t){it.prototype[t]=function(){const i=this,e=[].slice.call(arguments);var s=e[e.length-1];let n;return typeof s=="function"&&(n=s,e.pop()),s=new Promise(function(r){t==="export"&&typeof e[0]=="function"&&(e[0]=null),Q>1e9&&(Q=0),i.h[++Q]=r,i.worker.postMessage({task:t,id:Q,args:e})}),n?(s.then(n),this):s}}function ae(t,i,e){return i?typeof module<"u"?new(require("worker_threads")).Worker(__dirname+"/worker/node.js"):Promise.resolve().then(function(){return _e}).then(function(s){return new s.Worker(import.meta.dirname+"/node/node.mjs")}):t?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+pe.toString()],{type:"text/javascript"}))):new window.Worker(typeof e=="string"?e:import.meta.url.replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js","module/worker/worker.js"),{type:"module"})}nt.prototype.add=function(t,i,e){if(lt(t)&&(i=t,t=ot(i,this.key)),i&&(t||t===0)){if(!e&&this.reg.has(t))return this.update(t,i);for(let l=0,o;l<this.field.length;l++){o=this.B[l];var s=this.index.get(this.field[l]);if(typeof o=="function"){var n=o(i);n&&s.add(t,n,e,!0)}else n=o.G,(!n||n(i))&&(o.constructor===String?o=[""+o]:N(o)&&(o=[o]),Ct(i,o,this.D,0,s,t,o[0],e))}if(this.tag)for(s=0;s<this.A.length;s++){var r=this.A[s];n=this.tag.get(this.F[s]);let l=O();if(typeof r=="function"){if(r=r(i),!r)continue}else{var h=r.G;if(h&&!h(i))continue;r.constructor===String&&(r=""+r),r=ot(i,r)}if(n&&r){N(r)&&(r=[r]);for(let o=0,f,u;o<r.length;o++)if(f=r[o],!l[f]&&(l[f]=1,(h=n.get(f))?u=h:n.set(f,u=[]),!e||!u.includes(t))){if(u.length===2**31-1){if(h=new et(u),this.fastupdate)for(let g of this.reg.values())g.includes(u)&&(g[g.indexOf(u)]=h);n.set(f,u=h)}u.push(t),this.fastupdate&&((h=this.reg.get(t))?h.push(u):this.reg.set(t,[u]))}}}if(this.store&&(!e||!this.store.has(t))){let l;if(this.h){l=O();for(let o=0,f;o<this.h.length;o++){if(f=this.h[o],(e=f.G)&&!e(i))continue;let u;if(typeof f=="function"){if(u=f(i),!u)continue;f=[f.O]}else if(N(f)||f.constructor===String){l[f]=i[f];continue}Bt(i,l,f,0,f[0],u)}}this.store.set(t,l||i)}this.worker&&(this.fastupdate||this.reg.add(t))}return this};function Bt(t,i,e,s,n,r){if(t=t[n],s===e.length-1)i[n]=r||t;else if(t)if(t.constructor===Array)for(i=i[n]=Array(t.length),n=0;n<t.length;n++)Bt(t,i,e,s,n);else i=i[n]||(i[n]=O()),n=e[++s],Bt(t,i,e,s,n)}function Ct(t,i,e,s,n,r,h,l){if(t=t[h])if(s===i.length-1){if(t.constructor===Array){if(e[s]){for(i=0;i<t.length;i++)n.add(r,t[i],!0,!0);return}t=t.join(" ")}n.add(r,t,l,!0)}else if(t.constructor===Array)for(h=0;h<t.length;h++)Ct(t,i,e,s,n,r,h,l);else h=i[++s],Ct(t,i,e,s,n,r,h,l)}function Jt(t,i,e,s){if(!t.length)return t;if(t.length===1)return t=t[0],t=e||t.length>i?t.slice(e,e+i):t,s?tt.call(this,t):t;let n=[];for(let r=0,h,l;r<t.length;r++)if((h=t[r])&&(l=h.length)){if(e){if(e>=l){e-=l;continue}h=h.slice(e,e+i),l=h.length,e=0}if(l>i&&(h=h.slice(0,i),l=i),!n.length&&l>=i)return s?tt.call(this,h):h;if(n.push(h),i-=l,!i)break}return n=n.length>1?[].concat.apply([],n):n[0],s?tt.call(this,n):n}function bt(t,i,e,s){var n=s[0];if(n[0]&&n[0].query)return t[i].apply(t,n);if(!(i!=="and"&&i!=="not"||t.result.length||t.await||n.suggest))return s.length>1&&(n=s[s.length-1]),(s=n.resolve)?t.await||t.result:t;let r=[],h=0,l=0,o,f,u,g,m;for(i=0;i<s.length;i++)if(n=s[i]){var d=void 0;if(n.constructor===B)d=n.await||n.result;else if(n.then||n.constructor===Array)d=n;else{h=n.limit||0,l=n.offset||0,u=n.suggest,f=n.resolve,o=((g=n.highlight||t.highlight)||n.enrich)&&f,d=n.queue;let a=n.async||d,c=n.index,p=n.query;if(c?t.index||(t.index=c):c=t.index,p||n.tag){const x=n.field||n.pluck;if(x&&(!p||t.query&&!g||(t.query=p,t.field=x,t.highlight=g),c=c.index.get(x)),d&&(m||t.await)){m=1;let w;const b=t.C.length,_=new Promise(function(z){w=z});(function(z,S){_.h=function(){S.index=null,S.resolve=!1;let j=a?z.searchAsync(S):z.search(S);return j.then?j.then(function(k){return t.C[b]=k=k.result||k,w(k),k}):(j=j.result||j,w(j),j)}})(c,Object.assign({},n)),t.C.push(_),r[i]=_;continue}else n.resolve=!1,n.index=null,d=a?c.searchAsync(n):c.search(n),n.resolve=f,n.index=c}else if(n.and)d=dt(n,"and",c);else if(n.or)d=dt(n,"or",c);else if(n.not)d=dt(n,"not",c);else if(n.xor)d=dt(n,"xor",c);else continue}d.await?(m=1,d=d.await):d.then?(m=1,d=d.then(function(a){return a.result||a})):d=d.result||d,r[i]=d}if(m&&!t.await&&(t.await=new Promise(function(a){t.return=a})),m){const a=Promise.all(r).then(function(c){for(let p=0;p<t.C.length;p++)if(t.C[p]===a){t.C[p]=function(){return e.call(t,c,h,l,o,f,u,g)};break}Rt(t)});t.C.push(a)}else if(t.await)t.C.push(function(){return e.call(t,r,h,l,o,f,u,g)});else return e.call(t,r,h,l,o,f,u,g);return f?t.await||t.result:t}function dt(t,i,e){t=t[i];const s=t[0]||t;return s.index||(s.index=e),e=new B(s),t.length>1&&(e=e[i].apply(e,t.slice(1))),e}B.prototype.or=function(){return bt(this,"or",me,arguments)};function me(t,i,e,s,n,r,h){return t.length&&(this.result.length&&t.push(this.result),t.length<2?this.result=t[0]:(this.result=ee(t,i,e,!1,this.h),e=0)),n&&(this.await=null),n?this.resolve(i,e,s,h):this}B.prototype.and=function(){return bt(this,"and",we,arguments)};function we(t,i,e,s,n,r,h){if(!r&&!this.result.length)return n?this.result:this;let l;if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{let o=0;for(let f=0,u,g;f<t.length;f++)if((u=t[f])&&(g=u.length))o<g&&(o=g);else if(!r){o=0;break}o?(this.result=yt(t,o,i,e,r,this.h,n),l=!0):this.result=[]}else r||(this.result=t);return n&&(this.await=null),n?this.resolve(i,e,s,h,l):this}B.prototype.xor=function(){return bt(this,"xor",ye,arguments)};function ye(t,i,e,s,n,r,h){if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{t:{r=e;var l=this.h;const o=[],f=O();let u=0;for(let g=0,m;g<t.length;g++)if(m=t[g]){u<m.length&&(u=m.length);for(let d=0,a;d<m.length;d++)if(a=m[d])for(let c=0,p;c<a.length;c++)p=a[c],f[p]=f[p]?2:1}for(let g=0,m,d=0;g<u;g++)for(let a=0,c;a<t.length;a++)if((c=t[a])&&(m=c[g])){for(let p=0,x;p<m.length;p++)if(x=m[p],f[x]===1)if(r)r--;else if(n){if(o.push(x),o.length===i){t=o;break t}}else{const w=g+(a?l:0);if(o[w]||(o[w]=[]),o[w].push(x),++d===i){t=o;break t}}}t=o}this.result=t,l=!0}else r||(this.result=t);return n&&(this.await=null),n?this.resolve(i,e,s,h,l):this}B.prototype.not=function(){return bt(this,"not",xe,arguments)};function xe(t,i,e,s,n,r,h){if(!r&&!this.result.length)return n?this.result:this;if(t.length&&this.result.length){t:{r=e;var l=[];t=new Set(t.flat().flat());for(let o=0,f,u=0;o<this.result.length;o++)if(f=this.result[o]){for(let g=0,m;g<f.length;g++)if(m=f[g],!t.has(m)){if(r)r--;else if(n){if(l.push(m),l.length===i){t=l;break t}}else if(l[o]||(l[o]=[]),l[o].push(m),++u===i){t=l;break t}}}t=l}this.result=t,l=!0}return n&&(this.await=null),n?this.resolve(i,e,s,h,l):this}function wt(t,i,e,s,n){let r,h,l;typeof n=="string"?(r=n,n=""):r=n.template,h=r.indexOf("$1"),l=r.substring(h+2),h=r.substring(0,h);let o=n&&n.boundary,f=!n||n.clip!==!1,u=n&&n.merge&&l&&h&&new RegExp(l+" "+h,"g");n=n&&n.ellipsis;var g=0;if(typeof n=="object"){var m=n.template;g=m.length-2,n=n.pattern}typeof n!="string"&&(n=n===!1?"":"..."),g&&(n=m.replace("$1",n)),m=n.length-g;let d,a;typeof o=="object"&&(d=o.before,d===0&&(d=-1),a=o.after,a===0&&(a=-1),o=o.total||9e5),g=new Map;for(let jt=0,Y,Ft,st;jt<i.length;jt++){let rt;if(s)rt=i,st=s;else{var c=i[jt];if(st=c.field,!st)continue;rt=c.result}Ft=e.get(st),Y=Ft.encoder,c=g.get(Y),typeof c!="string"&&(c=Y.encode(t),g.set(Y,c));for(let ct=0;ct<rt.length;ct++){var p=rt[ct].doc;if(!p||(p=ot(p,st),!p))continue;var x=p.trim().split(/\s+/);if(!x.length)continue;p="";var w=[];let gt=[];for(var b=-1,_=-1,z=0,S=0;S<x.length;S++){var j=x[S],k=Y.encode(j);k=k.length>1?k.join(" "):k[0];let v;if(k&&j){for(var M=j.length,I=(Y.split?j.replace(Y.split,""):j).length-k.length,A="",$=0,R=0;R<c.length;R++){var T=c[R];if(T){var P=T.length;P+=I,$&&P<=$||(T=k.indexOf(T),T>-1&&(A=(T?j.substring(0,T):"")+h+j.substring(T,T+P)+l+(T+P<M?j.substring(T+P):""),$=P,v=!0))}}A&&(o&&(b<0&&(b=p.length+(p?1:0)),_=p.length+(p?1:0)+A.length,z+=M,gt.push(w.length),w.push({match:A})),p+=(p?" ":"")+A)}if(!v)j=x[S],p+=(p?" ":"")+j,o&&w.push({text:j});else if(o&&z>=o)break}if(z=gt.length*(r.length-2),d||a||o&&p.length-z>o)if(z=o+z-m*2,S=_-b,d>0&&(S+=d),a>0&&(S+=a),S<=z)x=d?b-(d>0?d:0):b-((z-S)/2|0),w=a?_+(a>0?a:0):x+z,f||(x>0&&p.charAt(x)!==" "&&p.charAt(x-1)!==" "&&(x=p.indexOf(" ",x),x<0&&(x=0)),w<p.length&&p.charAt(w-1)!==" "&&p.charAt(w)!==" "&&(w=p.lastIndexOf(" ",w),w<_?w=_:++w)),p=(x?n:"")+p.substring(x,w)+(w<p.length?n:"");else{for(_=[],b={},z={},S={},j={},k={},A=I=M=0,R=$=1;;){var K=void 0;for(let v=0,C;v<gt.length;v++){if(C=gt[v],A)if(I!==A){if(S[v+1])continue;if(C+=A,b[C]){M-=m,z[v+1]=1,S[v+1]=1;continue}if(C>=w.length-1){if(C>=w.length){S[v+1]=1,C>=x.length&&(z[v+1]=1);continue}M-=m}if(p=w[C].text,P=a&&k[v])if(P>0){if(p.length>P)if(S[v+1]=1,f)p=p.substring(0,P);else continue;(P-=p.length)||(P=-1),k[v]=P}else{S[v+1]=1;continue}if(M+p.length+1<=o)p=" "+p,_[v]+=p;else if(f)K=o-M-1,K>0&&(p=" "+p.substring(0,K),_[v]+=p),S[v+1]=1;else{S[v+1]=1;continue}}else{if(S[v])continue;if(C-=I,b[C]){M-=m,S[v]=1,z[v]=1;continue}if(C<=0){if(C<0){S[v]=1,z[v]=1;continue}M-=m}if(p=w[C].text,P=d&&j[v])if(P>0){if(p.length>P)if(S[v]=1,f)p=p.substring(p.length-P);else continue;(P-=p.length)||(P=-1),j[v]=P}else{S[v]=1;continue}if(M+p.length+1<=o)p+=" ",_[v]=p+_[v];else if(f)K=p.length+1-(o-M),K>=0&&K<p.length&&(p=p.substring(K)+" ",_[v]=p+_[v]),S[v]=1;else{S[v]=1;continue}}else{p=w[C].match,d&&(j[v]=d),a&&(k[v]=a),v&&M++;let Mt;if(C?!v&&m&&(M+=m):(z[v]=1,S[v]=1),C>=x.length-1||C<w.length-1&&w[C+1].match?Mt=1:m&&(M+=m),M-=r.length-2,!v||M+p.length<=o)_[v]=p;else{K=$=R=z[v]=0;break}Mt&&(z[v+1]=1,S[v+1]=1)}M+=p.length,K=b[C]=1}if(K)I===A?A++:I++;else{if(I===A?$=0:R=0,!$&&!R)break;$?(I++,A=I):A++}}p="";for(let v=0,C;v<_.length;v++)C=(v&&z[v]?" ":(v&&!n?" ":"")+n)+_[v],p+=C;n&&!z[_.length]&&(p+=n)}u&&(p=p.replace(u," ")),rt[ct].highlight=p}if(s)break}return i}function B(t,i){if(!this||this.constructor!==B)return new B(t,i);let e=0,s,n,r,h,l,o;if(t&&t.index){const f=t;if(i=f.index,e=f.boost||0,n=f.query){r=f.field||f.pluck,h=f.highlight;const u=f.resolve;t=f.async||f.queue,f.resolve=!1,f.index=null,t=t?i.searchAsync(f):i.search(f),f.resolve=u,f.index=i,t=t.result||t}else t=[]}if(t&&t.then){const f=this;t=t.then(function(u){f.C[0]=f.result=u.result||u,Rt(f)}),s=[t],t=[],l=new Promise(function(u){o=u})}this.index=i||null,this.result=t||[],this.h=e,this.C=s||[],this.await=l||null,this.return=o||null,this.highlight=h||null,this.query=n||"",this.field=r||""}y=B.prototype;y.limit=function(t){if(this.await){const i=this;this.C.push(function(){return i.limit(t).result})}else if(this.result.length){const i=[];for(let e=0,s;e<this.result.length;e++)if(s=this.result[e])if(s.length<=t){if(i[e]=s,t-=s.length,!t)break}else{i[e]=s.slice(0,t);break}this.result=i}return this};y.offset=function(t){if(this.await){const i=this;this.C.push(function(){return i.offset(t).result})}else if(this.result.length){const i=[];for(let e=0,s;e<this.result.length;e++)(s=this.result[e])&&(s.length<=t?t-=s.length:(i[e]=s.slice(t),t=0));this.result=i}return this};y.boost=function(t){if(this.await){const i=this;this.C.push(function(){return i.boost(t).result})}else this.h+=t;return this};function Rt(t,i){let e=t.result;var s=t.await;t.await=null;for(let n=0,r;n<t.C.length;n++)if(r=t.C[n]){if(typeof r=="function")e=r(),t.C[n]=e=e.result||e,n--;else if(r.h)e=r.h(),t.C[n]=e=e.result||e,n--;else if(r.then)return t.await=s}return s=t.return,t.C=[],t.return=null,i||s(e),e}y.resolve=function(t,i,e,s,n){let r=this.await?Rt(this,!0):this.result;if(r.then){const h=this;return r.then(function(){return h.resolve(t,i,e,s,n)})}return r.length&&(typeof t=="object"?(s=t.highlight||this.highlight,e=!!s||t.enrich,i=t.offset,t=t.limit):(s=s||this.highlight,e=!!s||e),r=n?e?tt.call(this.index,r):r:Jt.call(this.index,r,t||100,i,e)),this.finalize(r,s)};y.finalize=function(t,i){if(t.then){const s=this;return t.then(function(n){return s.finalize(n,i)})}i&&t.length&&this.query&&(t=wt(this.query,t,this.index.index,this.field,i));const e=this.return;return this.highlight=this.index=this.result=this.C=this.await=this.return=null,this.query=this.field="",e&&e(t),t};function yt(t,i,e,s,n,r,h){const l=t.length;let o=[],f,u;f=O();for(let g=0,m,d,a,c;g<i;g++)for(let p=0;p<l;p++)if(a=t[p],g<a.length&&(m=a[g]))for(let x=0;x<m.length;x++){if(d=m[x],(u=f[d])?f[d]++:(u=0,f[d]=1),c=o[u]||(o[u]=[]),!h){let w=g+(p||!n?0:r||0);c=c[w]||(c[w]=[])}if(c.push(d),h&&e&&u===l-1&&c.length-s===e)return s?c.slice(s):c}if(t=o.length)if(n)o=o.length>1?ee(o,e,s,h,r):(o=o[0])&&e&&o.length>e||s?o.slice(s,e+s):o;else{if(t<l)return[];if(o=o[t-1],e||s)if(h)(o.length>e||s)&&(o=o.slice(s,e+s));else{n=[];for(let g=0,m;g<o.length;g++)if(m=o[g]){if(s&&m.length>s)s-=m.length;else if((e&&m.length>e||s)&&(m=m.slice(s,e+s),e-=m.length,s&&(s-=m.length)),n.push(m),!e)break}o=n}}return o}function ee(t,i,e,s,n){const r=[],h=O();let l;var o=t.length;let f;if(s){for(n=o-1;n>=0;n--)if(f=(s=t[n])&&s.length){for(o=0;o<f;o++)if(l=s[o],!h[l]){if(h[l]=1,e)e--;else if(r.push(l),r.length===i)return r}}}else for(let u=o-1,g,m=0;u>=0;u--){g=t[u];for(let d=0;d<g.length;d++)if(f=(s=g[d])&&s.length){for(let a=0;a<f;a++)if(l=s[a],!h[l])if(h[l]=1,e)e--;else{let c=(d+(u<o-1&&n||0))/(u+1)|0;if((r[c]||(r[c]=[])).push(l),++m===i)return r}}}return r}function ke(t,i,e){const s=O(),n=[];for(let r=0,h;r<i.length;r++){h=i[r];for(let l=0;l<h.length;l++)s[h[l]]=1}if(e)for(let r=0,h;r<t.length;r++)h=t[r],s[h]&&(n.push(h),s[h]=0);else for(let r=0,h,l;r<t.result.length;r++)for(h=t.result[r],i=0;i<h.length;i++)l=h[i],s[l]&&((n[r]||(n[r]=[])).push(l),s[l]=0);return n}nt.prototype.search=function(t,i,e,s){e||(!i&<(t)?(e=t,t=""):lt(i)&&(e=i,i=0));let n=[];var r=[];let h,l,o,f,u,g,m=0,d=!0,a;if(e){e.constructor===Array&&(e={index:e}),t=e.query||t,h=e.pluck,l=e.merge,f=e.boost,g=h||e.field||(g=e.index)&&(g.index?null:g);var c=this.tag&&e.tag;o=e.suggest,d=e.resolve!==!1,u=e.cache,a=d&&this.store&&e.highlight;var p=!!a||d&&this.store&&e.enrich;i=e.limit||i;var x=e.offset||0;if(i||(i=d?100:0),c&&(!this.db||!s)){c.constructor!==Array&&(c=[c]);var w=[];for(let j=0,k;j<c.length;j++)if(k=c[j],k.field&&k.tag){var b=k.tag;if(b.constructor===Array)for(var _=0;_<b.length;_++)w.push(k.field,b[_]);else w.push(k.field,b)}else{b=Object.keys(k);for(let M=0,I,A;M<b.length;M++)if(I=b[M],A=k[I],A.constructor===Array)for(_=0;_<A.length;_++)w.push(I,A[_]);else w.push(I,A)}if(c=w,!t){if(r=[],w.length)for(c=0;c<w.length;c+=2){if(this.db){if(s=this.index.get(w[c]),!s)continue;r.push(s=s.db.tag(w[c+1],i,x,p))}else s=ve.call(this,w[c],w[c+1],i,x,p);n.push(d?{field:w[c],tag:w[c+1],result:s}:[s])}if(r.length){const j=this;return Promise.all(r).then(function(k){for(let M=0;M<k.length;M++)d?n[M].result=k[M]:n[M]=k[M];return d?n:new B(n.length>1?yt(n,1,0,0,o,f):n[0],j)})}return d?n:new B(n.length>1?yt(n,1,0,0,o,f):n[0],this)}}d||h||!(g=g||this.field)||(N(g)?h=g:(g.constructor===Array&&g.length===1&&(g=g[0]),h=g.field||g.index)),g&&g.constructor!==Array&&(g=[g])}g||(g=this.field);let z;w=(this.worker||this.db)&&!s&&[];for(let j=0,k,M,I;j<g.length;j++){if(M=g[j],this.db&&this.tag&&!this.B[j])continue;let A;if(N(M)||(A=M,M=A.field,t=A.query||t,i=G(A.limit,i),x=G(A.offset,x),o=G(A.suggest,o),a=d&&this.store&&G(A.highlight,a),p=!!a||d&&this.store&&G(A.enrich,p),u=G(A.cache,u)),s)k=s[j];else{b=A||e||{},_=b.enrich;var S=this.index.get(M);if(c&&(this.db&&(b.tag=c,z=S.db.support_tag_search,b.field=g),!z&&_&&(b.enrich=!1)),k=u?S.searchCache(t,i,b):S.search(t,i,b),_&&(b.enrich=_),w){w[j]=k;continue}}if(I=(k=k.result||k)&&k.length,c&&I){if(b=[],_=0,this.db&&s){if(!z)for(S=g.length;S<s.length;S++){let $=s[S];if($&&$.length)_++,b.push($);else if(!o)return d?n:new B(n,this)}}else for(let $=0,R,T;$<c.length;$+=2){if(R=this.tag.get(c[$]),!R){if(o)continue;return d?n:new B(n,this)}if(T=(R=R&&R.get(c[$+1]))&&R.length)_++,b.push(R);else if(!o)return d?n:new B(n,this)}if(_){if(k=ke(k,b,d),I=k.length,!I&&!o)return d?k:new B(k,this);_--}}if(I)r[m]=M,n.push(k),m++;else if(g.length===1)return d?n:new B(n,this)}if(w){if(this.db&&c&&c.length&&!z)for(p=0;p<c.length;p+=2){if(r=this.index.get(c[p]),!r){if(o)continue;return d?n:new B(n,this)}w.push(r.db.tag(c[p+1],i,x,!1))}const j=this;return Promise.all(w).then(function(k){return e&&(e.resolve=d),k.length&&(k=j.search(t,i,e,k)),k})}if(!m)return d?n:new B(n,this);if(h&&(!p||!this.store))return n=n[0],d?n:new B(n,this);for(w=[],x=0;x<r.length;x++){if(c=n[x],p&&c.length&&typeof c[0].doc>"u"&&(this.db?w.push(c=this.index.get(this.field[0]).db.enrich(c)):c=tt.call(this,c)),h)return d?a?wt(t,c,this.index,h,a):c:new B(c,this);n[x]={field:r[x],result:c}}if(p&&this.db&&w.length){const j=this;return Promise.all(w).then(function(k){for(let M=0;M<k.length;M++)n[M].result=k[M];return a&&(n=wt(t,n,j.index,h,a)),l?Yt(n):n})}return a&&(n=wt(t,n,this.index,h,a)),l?Yt(n):n};function Yt(t){const i=[],e=O(),s=O();for(let n=0,r,h,l,o,f,u,g;n<t.length;n++){r=t[n],h=r.field,l=r.result;for(let m=0;m<l.length;m++)f=l[m],typeof f!="object"?f={id:o=f}:o=f.id,(u=e[o])?u.push(h):(f.field=e[o]=[h],i.push(f)),(g=f.highlight)&&(u=s[o],u||(s[o]=u={},f.highlight=u),u[h]=g)}return i}function ve(t,i,e,s,n){return t=this.tag.get(t),t?(t=t.get(i),t?(i=t.length-s,i>0&&((e&&i>e||s)&&(t=t.slice(s,s+e)),n&&(t=tt.call(this,t))),t):[]):[]}function tt(t){if(!this||!this.store)return t;if(this.db)return this.index.get(this.field[0]).db.enrich(t);const i=Array(t.length);for(let e=0,s;e<t.length;e++)s=t[e],i[e]={id:s,doc:this.store.get(s)};return i}function nt(t){if(!this||this.constructor!==nt)return new nt(t);const i=t.document||t.doc||t;let e,s;if(this.B=[],this.field=[],this.D=[],this.key=(e=i.key||i.id)&&xt(e,this.D)||"id",(s=t.keystore||0)&&(this.keystore=s),this.fastupdate=!!t.fastupdate,this.reg=!this.fastupdate||t.worker||t.db?s?new H(s):new Set:s?new F(s):new Map,this.h=(e=i.store||null)&&e&&e!==!0&&[],this.store=e?s?new F(s):new Map:null,this.cache=(e=t.cache||null)&&new U(e),t.cache=!1,this.worker=t.worker||!1,this.priority=t.priority||4,this.index=be.call(this,t,i),this.tag=null,(e=i.tag)&&(typeof e=="string"&&(e=[e]),e.length)){this.tag=new Map,this.A=[],this.F=[];for(let n=0,r,h;n<e.length;n++){if(r=e[n],h=r.field||r,!h)throw Error("The tag field from the document descriptor is undefined.");r.custom?this.A[n]=r.custom:(this.A[n]=xt(h,this.D),r.filter&&(typeof this.A[n]=="string"&&(this.A[n]=new String(this.A[n])),this.A[n].G=r.filter)),this.F[n]=h,this.tag.set(h,new Map)}}if(this.worker){this.fastupdate=!1,t=[];for(const n of this.index.values())n.then&&t.push(n);if(t.length){const n=this;return Promise.all(t).then(function(r){let h=0;for(const l of n.index.entries()){const o=l[0];let f=l[1];f.then&&(f=r[h],n.index.set(o,f),h++)}return n})}}else t.db&&(this.fastupdate=!1,this.mount(t.db))}y=nt.prototype;y.mount=function(t){let i=this.field;if(this.tag)for(let r=0,h;r<this.F.length;r++){h=this.F[r];var e=void 0;this.index.set(h,e=new W({},this.reg)),i===this.field&&(i=i.slice(0)),i.push(h),e.tag=this.tag.get(h)}e=[];const s={db:t.db,type:t.type,fastupdate:t.fastupdate};for(let r=0,h,l;r<i.length;r++){s.field=l=i[r],h=this.index.get(l);const o=new t.constructor(t.id,s);o.id=t.id,e[r]=o.mount(h),h.document=!0,r?h.bypass=!0:h.store=this.store}const n=this;return this.db=Promise.all(e).then(function(){n.db=!0})};y.commit=async function(){const t=[];for(const i of this.index.values())t.push(i.commit());await Promise.all(t),this.reg.clear()};y.destroy=function(){const t=[];for(const i of this.index.values())t.push(i.destroy());return Promise.all(t)};function be(t,i){const e=new Map;let s=i.index||i.field||i;N(s)&&(s=[s]);for(let r=0,h,l;r<s.length;r++){if(h=s[r],N(h)||(l=h,h=h.field),l=lt(l)?Object.assign({},t,l):t,this.worker){var n=void 0;n=(n=l.encoder)&&n.encode?n:new ft(typeof n=="string"?Et[n]:n||{}),n=new it(l,n),e.set(h,n)}this.worker||e.set(h,new W(l,this.reg)),l.custom?this.B[r]=l.custom:(this.B[r]=xt(h,this.D),l.filter&&(typeof this.B[r]=="string"&&(this.B[r]=new String(this.B[r])),this.B[r].G=l.filter)),this.field[r]=h}if(this.h){t=i.store,N(t)&&(t=[t]);for(let r=0,h,l;r<t.length;r++)h=t[r],l=h.field||h,h.custom?(this.h[r]=h.custom,h.custom.O=l):(this.h[r]=xt(l,this.D),h.filter&&(typeof this.h[r]=="string"&&(this.h[r]=new String(this.h[r])),this.h[r].G=h.filter))}return e}function xt(t,i){const e=t.split(":");let s=0;for(let n=0;n<e.length;n++)t=e[n],t[t.length-1]==="]"&&(t=t.substring(0,t.length-2))&&(i[s]=!0),t&&(e[s++]=t);return s<e.length&&(e.length=s),s>1?e:e[0]}y.append=function(t,i){return this.add(t,i,!0)};y.update=function(t,i){return this.remove(t).add(t,i)};y.remove=function(t){lt(t)&&(t=ot(t,this.key));for(var i of this.index.values())i.remove(t,!0);if(this.reg.has(t)){if(this.tag&&!this.fastupdate)for(let e of this.tag.values())for(let s of e){i=s[0];const n=s[1],r=n.indexOf(t);r>-1&&(n.length>1?n.splice(r,1):e.delete(i))}this.store&&this.store.delete(t),this.reg.delete(t)}return this.cache&&this.cache.remove(t),this};y.clear=function(){const t=[];for(const i of this.index.values()){const e=i.clear();e.then&&t.push(e)}if(this.tag)for(const i of this.tag.values())i.clear();return this.store&&this.store.clear(),this.cache&&this.cache.clear(),t.length?Promise.all(t):this};y.contain=function(t){return this.db?this.index.get(this.field[0]).db.has(t):this.reg.has(t)};y.cleanup=function(){for(const t of this.index.values())t.cleanup();return this};y.get=function(t){return this.db?this.index.get(this.field[0]).db.enrich(t).then(function(i){return i[0]&&i[0].doc||null}):this.store.get(t)||null};y.set=function(t,i){return typeof t=="object"&&(i=t,t=ot(i,this.key)),this.store.set(t,i),this};y.searchCache=Pt;y.export=je;y.import=Me;$t(nt.prototype);function Tt(t,i=0){let e=[],s=[];i&&(i=25e4/i*5e3|0);for(const n of t.entries())s.push(n),s.length===i&&(e.push(s),s=[]);return s.length&&e.push(s),e}function Nt(t,i){i||(i=new Map);for(let e=0,s;e<t.length;e++)s=t[e],i.set(s[0],s[1]);return i}function ie(t,i=0){let e=[],s=[];i&&(i=25e4/i*1e3|0);for(const n of t.entries())s.push([n[0],Tt(n[1])[0]]),s.length===i&&(e.push(s),s=[]);return s.length&&e.push(s),e}function ne(t,i){i||(i=new Map);for(let e=0,s,n;e<t.length;e++)s=t[e],n=i.get(s[0]),i.set(s[0],Nt(s[1],n));return i}function se(t){let i=[],e=[];for(const s of t.keys())e.push(s),e.length===25e4&&(i.push(e),e=[]);return e.length&&i.push(e),i}function re(t,i){i||(i=new Set);for(let e=0;e<t.length;e++)i.add(t[e]);return i}function kt(t,i,e,s,n,r,h=0){const l=s&&s.constructor===Array;var o=l?s.shift():s;if(!o)return this.export(t,i,n,r+1);if((o=t((i?i+".":"")+(h+1)+"."+e,JSON.stringify(o)))&&o.then){const f=this;return o.then(function(){return kt.call(f,t,i,e,l?s:null,n,r,h+1)})}return kt.call(this,t,i,e,l?s:null,n,r,h+1)}function je(t,i,e=0,s=0){if(e<this.field.length){const h=this.field[e];if((i=this.index.get(h).export(t,h,e,s=1))&&i.then){const l=this;return i.then(function(){return l.export(t,h,e+1)})}return this.export(t,h,e+1)}let n,r;switch(s){case 0:n="reg",r=se(this.reg),i=null;break;case 1:n="tag",r=this.tag&&ie(this.tag,this.reg.size),i=null;break;case 2:n="doc",r=this.store&&Tt(this.store),i=null;break;default:return}return kt.call(this,t,i,n,r||null,e,s)}function Me(t,i){var e=t.split(".");e[e.length-1]==="json"&&e.pop();const s=e.length>2?e[0]:"";if(e=e.length>2?e[2]:e[1],this.worker&&s)return this.index.get(s).import(t);if(i){if(typeof i=="string"&&(i=JSON.parse(i)),s)return this.index.get(s).import(e,i);switch(e){case"reg":this.fastupdate=!1,this.reg=re(i,this.reg);for(let n=0,r;n<this.field.length;n++)r=this.index.get(this.field[n]),r.fastupdate=!1,r.reg=this.reg;if(this.worker){i=[];for(const n of this.index.values())i.push(n.import(t));return Promise.all(i)}break;case"tag":this.tag=ne(i,this.tag);break;case"doc":this.store=Nt(i,this.store)}}}function Lt(t,i){let e="";for(const s of t.entries()){t=s[0];const n=s[1];let r="";for(let h=0,l;h<n.length;h++){l=n[h]||[""];let o="";for(let f=0;f<l.length;f++)o+=(o?",":"")+(i==="string"?'"'+l[f]+'"':l[f]);o="["+o+"]",r+=(r?",":"")+o}r='["'+t+'",['+r+"]]",e+=(e?",":"")+r}return e}W.prototype.remove=function(t,i){const e=this.reg.size&&(this.fastupdate?this.reg.get(t):this.reg.has(t));if(e){if(this.fastupdate){for(let s=0,n,r;s<e.length;s++)if((n=e[s])&&(r=n.length))if(n[r-1]===t)n.pop();else{const h=n.indexOf(t);h>=0&&n.splice(h,1)}}else ut(this.map,t),this.depth&&ut(this.ctx,t);i||this.reg.delete(t)}return this.db&&(this.commit_task.push({del:t}),this.M&&he(this)),this.cache&&this.cache.remove(t),this};function ut(t,i){let e=0;var s=typeof i>"u";if(t.constructor===Array){for(let n=0,r,h,l;n<t.length;n++)if((r=t[n])&&r.length){if(s)return 1;if(h=r.indexOf(i),h>=0){if(r.length>1)return r.splice(h,1),1;if(delete t[n],e)return 1;l=1}else{if(l)return 1;e++}}}else for(let n of t.entries())s=n[0],ut(n[1],i)?e++:t.delete(s);return e}const Se={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};W.prototype.add=function(t,i,e,s){if(i&&(t||t===0)){if(!s&&!e&&this.reg.has(t))return this.update(t,i);s=this.depth,i=this.encoder.encode(i,!s);const f=i.length;if(f){const u=O(),g=O(),m=this.resolution;for(let d=0;d<f;d++){let a=i[this.rtl?f-1-d:d];var n=a.length;if(n&&(s||!g[a])){var r=this.score?this.score(i,a,d,null,0):at(m,f,d),h="";switch(this.tokenize){case"tolerant":if(Z(this,g,a,r,t,e),n>2){for(let c=1,p,x,w,b;c<n-1;c++)p=a.charAt(c),x=a.charAt(c+1),w=a.substring(0,c)+x,b=a.substring(c+2),h=w+p+b,Z(this,g,h,r,t,e),h=w+b,Z(this,g,h,r,t,e);Z(this,g,a.substring(0,a.length-1),r,t,e)}break;case"full":if(n>2){for(let c=0,p;c<n;c++)for(r=n;r>c;r--){h=a.substring(c,r),p=this.rtl?n-1-c:c;var l=this.score?this.score(i,a,d,h,p):at(m,f,d,n,p);Z(this,g,h,l,t,e)}break}case"bidirectional":case"reverse":if(n>1){for(l=n-1;l>0;l--){h=a[this.rtl?n-1-l:l]+h;var o=this.score?this.score(i,a,d,h,l):at(m,f,d,n,l);Z(this,g,h,o,t,e)}h=""}case"forward":if(n>1){for(l=0;l<n;l++)h+=a[this.rtl?n-1-l:l],Z(this,g,h,r,t,e);break}default:if(Z(this,g,a,r,t,e),s&&f>1&&d<f-1)for(n=this.N,h=a,r=Math.min(s+1,this.rtl?d+1:f-d),l=1;l<r;l++){a=i[this.rtl?f-1-d-l:d+l],o=this.bidirectional&&a>h;const c=this.score?this.score(i,h,d,a,l-1):at(n+(f/2>n?0:1),f,d,r-1,l-1);Z(this,u,o?h:a,c,t,e,o?a:h)}}}}this.fastupdate||this.reg.add(t)}}return this.db&&(this.commit_task.push(e?{ins:t}:{del:t}),this.M&&he(this)),this};function Z(t,i,e,s,n,r,h){let l,o;if(!(l=i[e])||h&&!l[h]){if(h?(i=l||(i[e]=O()),i[h]=1,o=t.ctx,(l=o.get(h))?o=l:o.set(h,o=t.keystore?new F(t.keystore):new Map)):(o=t.map,i[e]=1),(l=o.get(e))?o=l:o.set(e,o=l=[]),r){for(let f=0,u;f<l.length;f++)if((u=l[f])&&u.includes(n)){if(f<=s)return;u.splice(u.indexOf(n),1),t.fastupdate&&(i=t.reg.get(n))&&i.splice(i.indexOf(u),1);break}}if(o=o[s]||(o[s]=[]),o.push(n),o.length===2**31-1){if(i=new et(o),t.fastupdate)for(let f of t.reg.values())f.includes(o)&&(f[f.indexOf(o)]=i);l[s]=o=i}t.fastupdate&&((s=t.reg.get(n))?s.push(o):t.reg.set(n,[o]))}}function at(t,i,e,s,n){return e&&t>1?i+(s||0)<=t?e+(n||0):(t-1)/(i+(s||0))*(e+(n||0))+1|0:0}W.prototype.search=function(t,i,e){if(e||(i||typeof t!="object"?typeof i=="object"&&(e=i,i=0):(e=t,t="")),e&&e.cache)return e.cache=!1,t=this.searchCache(t,i,e),e.cache=!0,t;let s=[],n,r,h,l=0,o,f,u,g,m;e&&(t=e.query||t,i=e.limit||i,l=e.offset||0,r=e.context,h=e.suggest,m=(o=e.resolve)&&e.enrich,u=e.boost,g=e.resolution,f=this.db&&e.tag),typeof o>"u"&&(o=this.resolve),r=this.depth&&r!==!1;let d=this.encoder.encode(t,!r);if(n=d.length,i=i||(o?100:0),n===1)return Ut.call(this,d[0],"",i,l,o,m,f);if(n===2&&r&&!h)return Ut.call(this,d[1],d[0],i,l,o,m,f);let a=O(),c=0,p;if(r&&(p=d[0],c=1),g||g===0||(g=p?this.N:this.resolution),this.db){if(this.db.search&&(e=this.db.search(this,d,i,l,h,o,m,f),e!==!1))return e;const x=this;return async function(){for(let w,b;c<n;c++){if((b=d[c])&&!a[b]){if(a[b]=1,w=await Ot(x,b,p,0,0,!1,!1),w=Gt(w,s,h,g)){s=w;break}p&&(h&&w&&s.length||(p=b))}h&&p&&c===n-1&&!s.length&&(g=x.resolution,p="",c=-1,a=O())}return Dt(s,g,i,l,h,u,o)}()}for(let x,w;c<n;c++){if((w=d[c])&&!a[w]){if(a[w]=1,x=Ot(this,w,p,0,0,!1,!1),x=Gt(x,s,h,g)){s=x;break}p&&(h&&x&&s.length||(p=w))}h&&p&&c===n-1&&!s.length&&(g=this.resolution,p="",c=-1,a=O())}return Dt(s,g,i,l,h,u,o)};function Dt(t,i,e,s,n,r,h){let l=t.length,o=t;if(l>1)o=yt(t,i,e,s,n,r,h);else if(l===1)return h?Jt.call(null,t[0],e,s):new B(t[0],this);return h?o:new B(o,this)}function Ut(t,i,e,s,n,r,h){return t=Ot(this,t,i,e,s,n,r,h),this.db?t.then(function(l){return n?l||[]:new B(l,this)}):t&&t.length?n?Jt.call(this,t,e,s):new B(t,this):n?[]:new B([],this)}function Gt(t,i,e,s){let n=[];if(t&&t.length){if(t.length<=s){i.push(t);return}for(let r=0,h;r<s;r++)(h=t[r])&&(n[r]=h);if(n.length){i.push(n);return}}if(!e)return n}function Ot(t,i,e,s,n,r,h,l){let o;return e&&(o=t.bidirectional&&i>e)&&(o=e,e=i,i=o),t.db?t.db.get(i,e,s,n,r,h,l):(t=e?(t=t.ctx.get(e))&&t.get(i):t.map.get(i),t)}function W(t,i){if(!this||this.constructor!==W)return new W(t);if(t){var e=N(t)?t:t.preset;e&&(t=Object.assign({},Se[e],t))}else t={};e=t.context;const s=e===!0?{depth:1}:e||{},n=N(t.encoder)?Et[t.encoder]:t.encode||t.encoder||{};this.encoder=n.encode?n:typeof n=="object"?new ft(n):{encode:n},this.resolution=t.resolution||9,this.tokenize=e=(e=t.tokenize)&&e!=="default"&&e!=="exact"&&e||"strict",this.depth=e==="strict"&&s.depth||0,this.bidirectional=s.bidirectional!==!1,this.fastupdate=!!t.fastupdate,this.score=t.score||null,(e=t.keystore||0)&&(this.keystore=e),this.map=e?new F(e):new Map,this.ctx=e?new F(e):new Map,this.reg=i||(this.fastupdate?e?new F(e):new Map:e?new H(e):new Set),this.N=s.resolution||3,this.rtl=n.rtl||t.rtl||!1,this.cache=(e=t.cache||null)&&new U(e),this.resolve=t.resolve!==!1,(e=t.db)&&(this.db=this.mount(e)),this.M=t.commit!==!1,this.commit_task=[],this.commit_timer=null,this.priority=t.priority||4}y=W.prototype;y.mount=function(t){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),t.mount(this)};y.commit=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.commit(this)};y.destroy=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.destroy()};function he(t){t.commit_timer||(t.commit_timer=setTimeout(function(){t.commit_timer=null,t.db.commit(t)},1))}y.clear=function(){return this.map.clear(),this.ctx.clear(),this.reg.clear(),this.cache&&this.cache.clear(),this.db?(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[],this.db.clear()):this};y.append=function(t,i){return this.add(t,i,!0)};y.contain=function(t){return this.db?this.db.has(t):this.reg.has(t)};y.update=function(t,i){const e=this,s=this.remove(t);return s&&s.then?s.then(()=>e.add(t,i)):this.add(t,i)};y.cleanup=function(){return this.fastupdate?(ut(this.map),this.depth&&ut(this.ctx),this):this};y.searchCache=Pt;y.export=function(t,i,e=0,s=0){let n,r;switch(s){case 0:n="reg",r=se(this.reg);break;case 1:n="cfg",r=null;break;case 2:n="map",r=Tt(this.map,this.reg.size);break;case 3:n="ctx",r=ie(this.ctx,this.reg.size);break;default:return}return kt.call(this,t,i,n,r,e,s)};y.import=function(t,i){if(i)switch(typeof i=="string"&&(i=JSON.parse(i)),t=t.split("."),t[t.length-1]==="json"&&t.pop(),t.length===3&&t.shift(),t=t.length>1?t[1]:t[0],t){case"reg":this.fastupdate=!1,this.reg=re(i,this.reg);break;case"map":this.map=Nt(i,this.map);break;case"ctx":this.ctx=ne(i,this.ctx)}};y.serialize=function(t=!0){let i="",e="",s="";if(this.reg.size){let r;for(var n of this.reg.keys())r||(r=typeof n),i+=(i?",":"")+(r==="string"?'"'+n+'"':n);i="index.reg=new Set(["+i+"]);",e=Lt(this.map,r),e="index.map=new Map(["+e+"]);";for(const h of this.ctx.entries()){n=h[0];let l=Lt(h[1],r);l="new Map(["+l+"])",l='["'+n+'",'+l+"]",s+=(s?",":"")+l}s="index.ctx=new Map(["+s+"]);"}return t?"function inject(index){"+i+e+s+"}":i+e+s};$t(W.prototype);const le=typeof window<"u"&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),vt=["map","ctx","tag","reg","cfg"],L=O();function It(t,i={}){if(!this||this.constructor!==It)return new It(t,i);typeof t=="object"&&(i=t,t=t.name),t||console.info("Default storage space was used, because a name was not passed."),this.id="flexsearch"+(t?":"+t.toLowerCase().replace(/[^a-z0-9_\-]/g,""):""),this.field=i.field?i.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"",this.type=i.type,this.fastupdate=this.support_tag_search=!1,this.db=null,this.h={}}y=It.prototype;y.mount=function(t){return t.index?t.mount(this):(t.db=this,this.open())};y.open=function(){if(this.db)return this.db;let t=this;navigator.storage&&navigator.storage.persist(),L[t.id]||(L[t.id]=[]),L[t.id].push(t.field);const i=le.open(t.id,1);return i.onupgradeneeded=function(){const e=t.db=this.result;for(let s=0,n;s<vt.length;s++){n=vt[s];for(let r=0,h;r<L[t.id].length;r++)h=L[t.id][r],e.objectStoreNames.contains(n+(n!=="reg"&&h?":"+h:""))||e.createObjectStore(n+(n!=="reg"&&h?":"+h:""))}},t.db=X(i,function(e){t.db=e,t.db.onversionchange=function(){t.close()}})};y.close=function(){this.db&&this.db.close(),this.db=null};y.destroy=function(){const t=le.deleteDatabase(this.id);return X(t)};y.clear=function(){const t=[];for(let e=0,s;e<vt.length;e++){s=vt[e];for(let n=0,r;n<L[this.id].length;n++)r=L[this.id][n],t.push(s+(s!=="reg"&&r?":"+r:""))}const i=this.db.transaction(t,"readwrite");for(let e=0;e<t.length;e++)i.objectStore(t[e]).clear();return X(i)};y.get=function(t,i,e=0,s=0,n=!0,r=!1){t=this.db.transaction((i?"ctx":"map")+(this.field?":"+this.field:""),"readonly").objectStore((i?"ctx":"map")+(this.field?":"+this.field:"")).get(i?i+":"+t:t);const h=this;return X(t).then(function(l){let o=[];if(!l||!l.length)return o;if(n){if(!e&&!s&&l.length===1)return l[0];for(let f=0,u;f<l.length;f++)if((u=l[f])&&u.length){if(s>=u.length){s-=u.length;continue}const g=e?s+Math.min(u.length-s,e):u.length;for(let m=s;m<g;m++)o.push(u[m]);if(s=0,o.length===e)break}return r?h.enrich(o):o}return l})};y.tag=function(t,i=0,e=0,s=!1){t=this.db.transaction("tag"+(this.field?":"+this.field:""),"readonly").objectStore("tag"+(this.field?":"+this.field:"")).get(t);const n=this;return X(t).then(function(r){return!r||!r.length||e>=r.length?[]:!i&&!e?r:(r=r.slice(e,e+i),s?n.enrich(r):r)})};y.enrich=function(t){typeof t!="object"&&(t=[t]);const i=this.db.transaction("reg","readonly").objectStore("reg"),e=[];for(let s=0;s<t.length;s++)e[s]=X(i.get(t[s]));return Promise.all(e).then(function(s){for(let n=0;n<s.length;n++)s[n]={id:t[n],doc:s[n]?JSON.parse(s[n]):null};return s})};y.has=function(t){return t=this.db.transaction("reg","readonly").objectStore("reg").getKey(t),X(t).then(function(i){return!!i})};y.search=null;y.info=function(){};y.transaction=function(t,i,e){t+=t!=="reg"&&this.field?":"+this.field:"";let s=this.h[t+":"+i];if(s)return e.call(this,s);let n=this.db.transaction(t,i);this.h[t+":"+i]=s=n.objectStore(t);const r=e.call(this,s);return this.h[t+":"+i]=null,X(n).finally(function(){return n=s=null,r})};y.commit=async function(t){let i=t.commit_task,e=[];t.commit_task=[];for(let s=0,n;s<i.length;s++)n=i[s],n.del&&e.push(n.del);e.length&&await this.remove(e),t.reg.size&&(await this.transaction("map","readwrite",function(s){for(const n of t.map){const r=n[0],h=n[1];h.length&&(s.get(r).onsuccess=function(){let l=this.result;var o;if(l&&l.length){const f=Math.max(l.length,h.length);for(let u=0,g,m;u<f;u++)if((m=h[u])&&m.length){if((g=l[u])&&g.length)for(o=0;o<m.length;o++)g.push(m[o]);else l[u]=m;o=1}}else l=h,o=1;o&&s.put(l,r)})}}),await this.transaction("ctx","readwrite",function(s){for(const n of t.ctx){const r=n[0],h=n[1];for(const l of h){const o=l[0],f=l[1];f.length&&(s.get(r+":"+o).onsuccess=function(){let u=this.result;var g;if(u&&u.length){const m=Math.max(u.length,f.length);for(let d=0,a,c;d<m;d++)if((c=f[d])&&c.length){if((a=u[d])&&a.length)for(g=0;g<c.length;g++)a.push(c[g]);else u[d]=c;g=1}}else u=f,g=1;g&&s.put(u,r+":"+o)})}}}),t.store?await this.transaction("reg","readwrite",function(s){for(const n of t.store){const r=n[0],h=n[1];s.put(typeof h=="object"?JSON.stringify(h):1,r)}}):t.bypass||await this.transaction("reg","readwrite",function(s){for(const n of t.reg.keys())s.put(1,n)}),t.tag&&await this.transaction("tag","readwrite",function(s){for(const n of t.tag){const r=n[0],h=n[1];h.length&&(s.get(r).onsuccess=function(){let l=this.result;l=l&&l.length?l.concat(h):h,s.put(l,r)})}}),t.map.clear(),t.ctx.clear(),t.tag&&t.tag.clear(),t.store&&t.store.clear(),t.document||t.reg.clear())};function _t(t,i,e){const s=t.value;let n,r=0;for(let h=0,l;h<s.length;h++){if(l=e?s:s[h]){for(let o=0,f,u;o<i.length;o++)if(u=i[o],f=l.indexOf(u),f>=0)if(n=1,l.length>1)l.splice(f,1);else{s[h]=[];break}r+=l.length}if(e)break}r?n&&t.update(s):t.delete(),t.continue()}y.remove=function(t){return typeof t!="object"&&(t=[t]),Promise.all([this.transaction("map","readwrite",function(i){i.openCursor().onsuccess=function(){const e=this.result;e&&_t(e,t)}}),this.transaction("ctx","readwrite",function(i){i.openCursor().onsuccess=function(){const e=this.result;e&&_t(e,t)}}),this.transaction("tag","readwrite",function(i){i.openCursor().onsuccess=function(){const e=this.result;e&&_t(e,t,!0)}}),this.transaction("reg","readwrite",function(i){for(let e=0;e<t.length;e++)i.delete(t[e])})])};function X(t,i){return new Promise((e,s)=>{t.onsuccess=t.oncomplete=function(){i&&i(this.result),i=null,e(this.result)},t.onerror=t.onblocked=s,t=null})}const oe=W;let At=new oe;self.onmessage=t=>{switch(t.data.type){case"clear":At=new oe,postMessage({identifier:t.data.identifier});break;case"points":for(let e of t.data.points)At.add(e.id,e.text);postMessage({identifier:t.data.identifier});break;case"query":let i=At.search(t.data.query,{limit:t.data.limit});postMessage({identifier:t.data.identifier,result:i});break}};var _e=Object.freeze({__proto__:null}); | |