From 83fbad0d0375764cf37e183aceafbea496bff456 Mon Sep 17 00:00:00 2001 From: Fergus McDowall Date: Wed, 9 Nov 2022 09:31:33 +0100 Subject: [PATCH] forgot to add these... --- dist/search-index-3.3.0.js | 2 + dist/search-index-3.3.0.js.LICENSE.txt | 14 ++++++ dist/search-index-esm-3.3.0.js | 2 + dist/search-index-esm-3.3.0.js.LICENSE.txt | 14 ++++++ test/src/LAST_UPDATED-test.js | 52 ++++++++++++++++++++++ 5 files changed, 84 insertions(+) create mode 100644 dist/search-index-3.3.0.js create mode 100644 dist/search-index-3.3.0.js.LICENSE.txt create mode 100644 dist/search-index-esm-3.3.0.js create mode 100644 dist/search-index-esm-3.3.0.js.LICENSE.txt create mode 100644 test/src/LAST_UPDATED-test.js diff --git a/dist/search-index-3.3.0.js b/dist/search-index-3.3.0.js new file mode 100644 index 00000000..2b94af2d --- /dev/null +++ b/dist/search-index-3.3.0.js @@ -0,0 +1,2 @@ +/*! For license information please see search-index-3.3.0.js.LICENSE.txt */ +var SearchIndex;(()=>{var t={9464:(t,e,n)=>{"use strict";const{fromCallback:r}=n(6957),i=n(4473),{getCallback:o,getOptions:s}=n(2520),a=Symbol("promise"),c=Symbol("status"),h=Symbol("operations"),u=Symbol("finishClose"),l=Symbol("closeCallbacks");e.AbstractChainedBatch=class{constructor(t){if("object"!=typeof t||null===t)throw new TypeError("The first argument must be an abstract-level database, received "+(null===t?"null":typeof t));this[h]=[],this[l]=[],this[c]="open",this[u]=this[u].bind(this),this.db=t,this.db.attachResource(this),this.nextTick=t.nextTick}get length(){return this[h].length}put(t,e,n){if("open"!==this[c])throw new i("Batch is not open: cannot call put() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});const r=this.db._checkKey(t)||this.db._checkValue(e);if(r)throw r;const o=n&&null!=n.sublevel?n.sublevel:this.db,s=n,a=o.keyEncoding(n&&n.keyEncoding),u=o.valueEncoding(n&&n.valueEncoding),l=a.format;n={...n,keyEncoding:l,valueEncoding:u.format},o!==this.db&&(n.sublevel=null);const f=o.prefixKey(a.encode(t),l),d=u.encode(e);return this._put(f,d,n),this[h].push({...s,type:"put",key:t,value:e}),this}_put(t,e,n){}del(t,e){if("open"!==this[c])throw new i("Batch is not open: cannot call del() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});const n=this.db._checkKey(t);if(n)throw n;const r=e&&null!=e.sublevel?e.sublevel:this.db,o=e,s=r.keyEncoding(e&&e.keyEncoding),a=s.format;return e={...e,keyEncoding:a},r!==this.db&&(e.sublevel=null),this._del(r.prefixKey(s.encode(t),a),e),this[h].push({...o,type:"del",key:t}),this}_del(t,e){}clear(){if("open"!==this[c])throw new i("Batch is not open: cannot call clear() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});return this._clear(),this[h]=[],this}_clear(){}write(t,e){return e=o(t,e),e=r(e,a),t=s(t),"open"!==this[c]?this.nextTick(e,new i("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"})):0===this.length?this.close(e):(this[c]="writing",this._write(t,(t=>{this[c]="closing",this[l].push((()=>e(t))),t||this.db.emit("batch",this[h]),this._close(this[u])}))),e[a]}_write(t,e){}close(t){return t=r(t,a),"closing"===this[c]?this[l].push(t):"closed"===this[c]?this.nextTick(t):(this[l].push(t),"writing"!==this[c]&&(this[c]="closing",this._close(this[u]))),t[a]}_close(t){this.nextTick(t)}[u](){this[c]="closed",this.db.detachResource(this);const t=this[l];this[l]=[];for(const e of t)e()}}},3961:(t,e,n)=>{"use strict";const{fromCallback:r}=n(6957),i=n(4473),{getOptions:o,getCallback:s}=n(2520),a=Symbol("promise"),c=Symbol("callback"),h=Symbol("working"),u=Symbol("handleOne"),l=Symbol("handleMany"),f=Symbol("autoClose"),d=Symbol("finishWork"),p=Symbol("returnMany"),y=Symbol("closing"),g=Symbol("handleClose"),b=Symbol("closed"),m=Symbol("closeCallbacks"),E=Symbol("keyEncoding"),v=Symbol("valueEncoding"),w=Symbol("abortOnClose"),_=Symbol("legacy"),T=Symbol("keys"),S=Symbol("values"),L=Symbol("limit"),A=Symbol("count"),O=Object.freeze({}),k=()=>{};let x=!1;class R{constructor(t,e,n){if("object"!=typeof t||null===t)throw new TypeError("The first argument must be an abstract-level database, received "+(null===t?"null":typeof t));if("object"!=typeof e||null===e)throw new TypeError("The second argument must be an options object");this[b]=!1,this[m]=[],this[h]=!1,this[y]=!1,this[f]=!1,this[c]=null,this[u]=this[u].bind(this),this[l]=this[l].bind(this),this[g]=this[g].bind(this),this[E]=e[E],this[v]=e[v],this[_]=n,this[L]=Number.isInteger(e.limit)&&e.limit>=0?e.limit:1/0,this[A]=0,this[w]=!!e.abortOnClose,this.db=t,this.db.attachResource(this),this.nextTick=t.nextTick}get count(){return this[A]}get limit(){return this[L]}next(t){let e;if(void 0===t)e=new Promise(((e,n)=>{t=(t,r,i)=>{t?n(t):this[_]?void 0===r&&void 0===i?e():e([r,i]):e(r)}}));else if("function"!=typeof t)throw new TypeError("Callback must be a function");return this[y]?this.nextTick(t,new i("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[h]?this.nextTick(t,new i("Iterator is busy: cannot call next() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[h]=!0,this[c]=t,this[A]>=this[L]?this.nextTick(this[u],null):this._next(this[u])),e}_next(t){this.nextTick(t)}nextv(t,e,n){return n=s(e,n),n=r(n,a),e=o(e,O),Number.isInteger(t)?(this[y]?this.nextTick(n,new i("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[h]?this.nextTick(n,new i("Iterator is busy: cannot call nextv() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(t<1&&(t=1),this[L]<1/0&&(t=Math.min(t,this[L]-this[A])),this[h]=!0,this[c]=n,t<=0?this.nextTick(this[l],null,[]):this._nextv(t,e,this[l])),n[a]):(this.nextTick(n,new TypeError("The first argument 'size' must be an integer")),n[a])}_nextv(t,e,n){const r=[],i=(e,o,s)=>e?n(e):(this[_]?void 0===o&&void 0===s:void 0===o)?n(null,r):(r.push(this[_]?[o,s]:o),void(r.length===t?n(null,r):this._next(i)));this._next(i)}all(t,e){return e=s(t,e),e=r(e,a),t=o(t,O),this[y]?this.nextTick(e,new i("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[h]?this.nextTick(e,new i("Iterator is busy: cannot call all() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[h]=!0,this[c]=e,this[f]=!0,this[A]>=this[L]?this.nextTick(this[l],null,[]):this._all(t,this[l])),e[a]}_all(t,e){let n=this[A];const r=[],i=()=>{const t=this[L]<1/0?Math.min(1e3,this[L]-n):1e3;t<=0?this.nextTick(e,null,r):this._nextv(t,O,o)},o=(t,o)=>{t?e(t):0===o.length?e(null,r):(r.push.apply(r,o),n+=o.length,i())};i()}[d](){const t=this[c];return this[w]&&null===t?k:(this[h]=!1,this[c]=null,this[y]&&this._close(this[g]),t)}[p](t,e,n){this[f]?this.close(t.bind(null,e,n)):t(e,n)}seek(t,e){if(e=o(e,O),this[y]);else{if(this[h])throw new i("Iterator is busy: cannot call seek() until next() has completed",{code:"LEVEL_ITERATOR_BUSY"});{const n=this.db.keyEncoding(e.keyEncoding||this[E]),r=n.format;e.keyEncoding!==r&&(e={...e,keyEncoding:r});const i=this.db.prefixKey(n.encode(t),r);this._seek(i,e)}}}_seek(t,e){throw new i("Iterator does not support seek()",{code:"LEVEL_NOT_SUPPORTED"})}close(t){return t=r(t,a),this[b]?this.nextTick(t):this[y]?this[m].push(t):(this[y]=!0,this[m].push(t),this[h]?this[w]&&this[d]()(new i("Aborted on iterator close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this._close(this[g])),t[a]}_close(t){this.nextTick(t)}[g](){this[b]=!0,this.db.detachResource(this);const t=this[m];this[m]=[];for(const e of t)e()}async*[Symbol.asyncIterator](){try{let t;for(;void 0!==(t=await this.next());)yield t}finally{this[b]||await this.close()}}}class I extends R{constructor(t,e){super(t,e,!0),this[T]=!1!==e.keys,this[S]=!1!==e.values}[u](t,e,n){const r=this[d]();if(t)return r(t);try{e=this[T]&&void 0!==e?this[E].decode(e):void 0,n=this[S]&&void 0!==n?this[v].decode(n):void 0}catch(t){return r(new C("entry",t))}void 0===e&&void 0===n||this[A]++,r(null,e,n)}[l](t,e){const n=this[d]();if(t)return this[p](n,t);try{for(const t of e){const e=t[0],n=t[1];t[0]=this[T]&&void 0!==e?this[E].decode(e):void 0,t[1]=this[S]&&void 0!==n?this[v].decode(n):void 0}}catch(t){return this[p](n,new C("entries",t))}this[A]+=e.length,this[p](n,null,e)}end(t){return x||"undefined"==typeof console||(x=!0,console.warn(new i("The iterator.end() method was renamed to close() and end() is an alias that will be removed in a future version",{code:"LEVEL_LEGACY"}))),this.close(t)}}class C extends i{constructor(t,e){super(`Iterator could not decode ${t}`,{code:"LEVEL_DECODE_ERROR",cause:e})}}for(const t of["_ended property","_nexting property","_end method"])Object.defineProperty(I.prototype,t.split(" ")[0],{get(){throw new i(`The ${t} has been removed`,{code:"LEVEL_LEGACY"})},set(){throw new i(`The ${t} has been removed`,{code:"LEVEL_LEGACY"})}});I.keyEncoding=E,I.valueEncoding=v,e.AbstractIterator=I,e.AbstractKeyIterator=class extends R{constructor(t,e){super(t,e,!1)}[u](t,e){const n=this[d]();if(t)return n(t);try{e=void 0!==e?this[E].decode(e):void 0}catch(t){return n(new C("key",t))}void 0!==e&&this[A]++,n(null,e)}[l](t,e){const n=this[d]();if(t)return this[p](n,t);try{for(let t=0;t{"use strict";const{supports:r}=n(3658),{Transcoder:i}=n(8499),{EventEmitter:o}=n(7187),{fromCallback:s}=n(6957),a=n(4473),{AbstractIterator:c}=n(3961),{DefaultKeyIterator:h,DefaultValueIterator:u}=n(5429),{DeferredIterator:l,DeferredKeyIterator:f,DeferredValueIterator:d}=n(593),{DefaultChainedBatch:p}=n(4765),{getCallback:y,getOptions:g}=n(2520),b=n(56),m=Symbol("promise"),E=Symbol("landed"),v=Symbol("resources"),w=Symbol("closeResources"),_=Symbol("operations"),T=Symbol("undefer"),S=Symbol("deferOpen"),L=Symbol("options"),A=Symbol("status"),O=Symbol("defaultOptions"),k=Symbol("transcoder"),x=Symbol("keyEncoding"),R=Symbol("valueEncoding"),I=()=>{};class C extends o{constructor(t,e){if(super(),"object"!=typeof t||null===t)throw new TypeError("The first argument 'manifest' must be an object");e=g(e);const{keyEncoding:n,valueEncoding:o,passive:s,...a}=e;this[v]=new Set,this[_]=[],this[S]=!0,this[L]=a,this[A]="opening",this.supports=r(t,{status:!0,promises:!0,clear:!0,getMany:!0,deferredOpen:!0,snapshots:!1!==t.snapshots,permanence:!1!==t.permanence,keyIterator:!0,valueIterator:!0,iteratorNextv:!0,iteratorAll:!0,encodings:t.encodings||{},events:Object.assign({},t.events,{opening:!0,open:!0,closing:!0,closed:!0,put:!0,del:!0,batch:!0,clear:!0})}),this[k]=new i(U(this)),this[x]=this[k].encoding(n||"utf8"),this[R]=this[k].encoding(o||"utf8");for(const t of this[k].encodings())this.supports.encodings[t.commonName]||(this.supports.encodings[t.commonName]=!0);this[O]={empty:Object.freeze({}),entry:Object.freeze({keyEncoding:this[x].commonName,valueEncoding:this[R].commonName}),key:Object.freeze({keyEncoding:this[x].commonName})},this.nextTick((()=>{this[S]&&this.open({passive:!1},I)}))}get status(){return this[A]}keyEncoding(t){return this[k].encoding(null!=t?t:this[x])}valueEncoding(t){return this[k].encoding(null!=t?t:this[R])}open(t,e){e=y(t,e),e=s(e,m),(t={...this[L],...g(t)}).createIfMissing=!1!==t.createIfMissing,t.errorIfExists=!!t.errorIfExists;const n=t=>{"closing"===this[A]||"opening"===this[A]?this.once(E,t?()=>n(t):n):"open"!==this[A]?e(new a("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN",cause:t})):e()};return t.passive?"opening"===this[A]?this.once(E,n):this.nextTick(n):"closed"===this[A]||this[S]?(this[S]=!1,this[A]="opening",this.emit("opening"),this._open(t,(t=>{if(t)return this[A]="closed",this[w]((()=>{this.emit(E),n(t)})),void this[T]();this[A]="open",this[T](),this.emit(E),"open"===this[A]&&this.emit("open"),"open"===this[A]&&this.emit("ready"),n()}))):"open"===this[A]?this.nextTick(n):this.once(E,(()=>this.open(t,e))),e[m]}_open(t,e){this.nextTick(e)}close(t){t=s(t,m);const e=n=>{"opening"===this[A]||"closing"===this[A]?this.once(E,n?e(n):e):"closed"!==this[A]?t(new a("Database is not closed",{code:"LEVEL_DATABASE_NOT_CLOSED",cause:n})):t()};if("open"===this[A]){this[A]="closing",this.emit("closing");const t=t=>{this[A]="open",this[T](),this.emit(E),e(t)};this[w]((()=>{this._close((n=>{if(n)return t(n);this[A]="closed",this[T](),this.emit(E),"closed"===this[A]&&this.emit("closed"),e()}))}))}else"closed"===this[A]?this.nextTick(e):this.once(E,(()=>this.close(t)));return t[m]}[w](t){if(0===this[v].size)return this.nextTick(t);let e=this[v].size,n=!0;const r=()=>{0==--e&&(n?this.nextTick(t):t())};for(const t of this[v])t.close(r);n=!1,this[v].clear()}_close(t){this.nextTick(t)}get(t,e,n){if(n=y(e,n),n=s(n,m),e=g(e,this[O].entry),"opening"===this[A])return this.defer((()=>this.get(t,e,n))),n[m];if(D(this,n))return n[m];const r=this._checkKey(t);if(r)return this.nextTick(n,r),n[m];const i=this.keyEncoding(e.keyEncoding),o=this.valueEncoding(e.valueEncoding),c=i.format,h=o.format;return e.keyEncoding===c&&e.valueEncoding===h||(e=Object.assign({},e,{keyEncoding:c,valueEncoding:h})),this._get(this.prefixKey(i.encode(t),c),e,((t,e)=>{if(t)return("LEVEL_NOT_FOUND"===t.code||t.notFound||/NotFound/i.test(t))&&(t.code||(t.code="LEVEL_NOT_FOUND"),t.notFound||(t.notFound=!0),t.status||(t.status=404)),n(t);try{e=o.decode(e)}catch(t){return n(new a("Could not decode value",{code:"LEVEL_DECODE_ERROR",cause:t}))}n(null,e)})),n[m]}_get(t,e,n){this.nextTick(n,new Error("NotFound"))}getMany(t,e,n){if(n=y(e,n),n=s(n,m),e=g(e,this[O].entry),"opening"===this[A])return this.defer((()=>this.getMany(t,e,n))),n[m];if(D(this,n))return n[m];if(!Array.isArray(t))return this.nextTick(n,new TypeError("The first argument 'keys' must be an array")),n[m];if(0===t.length)return this.nextTick(n,null,[]),n[m];const r=this.keyEncoding(e.keyEncoding),i=this.valueEncoding(e.valueEncoding),o=r.format,c=i.format;e.keyEncoding===o&&e.valueEncoding===c||(e=Object.assign({},e,{keyEncoding:o,valueEncoding:c}));const h=new Array(t.length);for(let e=0;e{if(t)return n(t);try{for(let t=0;tthis.put(t,e,n,r))),r[m];if(D(this,r))return r[m];const i=this._checkKey(t)||this._checkValue(e);if(i)return this.nextTick(r,i),r[m];const o=this.keyEncoding(n.keyEncoding),a=this.valueEncoding(n.valueEncoding),c=o.format,h=a.format;n.keyEncoding===c&&n.valueEncoding===h||(n=Object.assign({},n,{keyEncoding:c,valueEncoding:h}));const u=this.prefixKey(o.encode(t),c),l=a.encode(e);return this._put(u,l,n,(n=>{if(n)return r(n);this.emit("put",t,e),r()})),r[m]}_put(t,e,n,r){this.nextTick(r)}del(t,e,n){if(n=y(e,n),n=s(n,m),e=g(e,this[O].key),"opening"===this[A])return this.defer((()=>this.del(t,e,n))),n[m];if(D(this,n))return n[m];const r=this._checkKey(t);if(r)return this.nextTick(n,r),n[m];const i=this.keyEncoding(e.keyEncoding),o=i.format;return e.keyEncoding!==o&&(e=Object.assign({},e,{keyEncoding:o})),this._del(this.prefixKey(i.encode(t),o),e,(e=>{if(e)return n(e);this.emit("del",t),n()})),n[m]}_del(t,e,n){this.nextTick(n)}batch(t,e,n){if(!arguments.length){if("opening"===this[A])return new p(this);if("open"!==this[A])throw new a("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._chainedBatch()}if(n="function"==typeof t?t:y(e,n),n=s(n,m),e=g(e,this[O].empty),"opening"===this[A])return this.defer((()=>this.batch(t,e,n))),n[m];if(D(this,n))return n[m];if(!Array.isArray(t))return this.nextTick(n,new TypeError("The first argument 'operations' must be an array")),n[m];if(0===t.length)return this.nextTick(n),n[m];const r=new Array(t.length),{keyEncoding:i,valueEncoding:o,...c}=e;for(let e=0;e{if(e)return n(e);this.emit("batch",t),n()})),n[m]}_batch(t,e,n){this.nextTick(n)}sublevel(t,e){return this._sublevel(t,N.defaults(e))}_sublevel(t,e){return new N(this,t,e)}prefixKey(t,e){return t}clear(t,e){if(e=y(t,e),e=s(e,m),t=g(t,this[O].empty),"opening"===this[A])return this.defer((()=>this.clear(t,e))),e[m];if(D(this,e))return e[m];const n=t,r=this.keyEncoding(t.keyEncoding);return(t=b(t,r)).keyEncoding=r.format,0===t.limit?this.nextTick(e):this._clear(t,(t=>{if(t)return e(t);this.emit("clear",n),e()})),e[m]}_clear(t,e){this.nextTick(e)}iterator(t){const e=this.keyEncoding(t&&t.keyEncoding),n=this.valueEncoding(t&&t.valueEncoding);if((t=b(t,e)).keys=!1!==t.keys,t.values=!1!==t.values,t[c.keyEncoding]=e,t[c.valueEncoding]=n,t.keyEncoding=e.format,t.valueEncoding=n.format,"opening"===this[A])return new l(this,t);if("open"!==this[A])throw new a("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._iterator(t)}_iterator(t){return new c(this,t)}keys(t){const e=this.keyEncoding(t&&t.keyEncoding),n=this.valueEncoding(t&&t.valueEncoding);if((t=b(t,e))[c.keyEncoding]=e,t[c.valueEncoding]=n,t.keyEncoding=e.format,t.valueEncoding=n.format,"opening"===this[A])return new f(this,t);if("open"!==this[A])throw new a("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._keys(t)}_keys(t){return new h(this,t)}values(t){const e=this.keyEncoding(t&&t.keyEncoding),n=this.valueEncoding(t&&t.valueEncoding);if((t=b(t,e))[c.keyEncoding]=e,t[c.valueEncoding]=n,t.keyEncoding=e.format,t.valueEncoding=n.format,"opening"===this[A])return new d(this,t);if("open"!==this[A])throw new a("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._values(t)}_values(t){return new u(this,t)}defer(t){if("function"!=typeof t)throw new TypeError("The first argument must be a function");this[_].push(t)}[T](){if(0===this[_].length)return;const t=this[_];this[_]=[];for(const e of t)e()}attachResource(t){if("object"!=typeof t||null===t||"function"!=typeof t.close)throw new TypeError("The first argument must be a resource object");this[v].add(t)}detachResource(t){this[v].delete(t)}_chainedBatch(){return new p(this)}_checkKey(t){if(null==t)return new a("Key cannot be null or undefined",{code:"LEVEL_INVALID_KEY"})}_checkValue(t){if(null==t)return new a("Value cannot be null or undefined",{code:"LEVEL_INVALID_VALUE"})}}C.prototype.nextTick=n(6909);const{AbstractSublevel:N}=n(9650)({AbstractLevel:C});e.AbstractLevel=C,e.AbstractSublevel=N;const D=function(t,e){return"open"!==t[A]&&(t.nextTick(e,new a("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"})),!0)},U=function(t){return Object.keys(t.supports.encodings).filter((e=>!!t.supports.encodings[e]))}},875:(t,e,n)=>{"use strict";e.AbstractLevel=n(9071).AbstractLevel,e.AbstractSublevel=n(9071).AbstractSublevel,e.AbstractIterator=n(3961).AbstractIterator,e.AbstractKeyIterator=n(3961).AbstractKeyIterator,e.AbstractValueIterator=n(3961).AbstractValueIterator,e.AbstractChainedBatch=n(9464).AbstractChainedBatch},2970:(t,e,n)=>{"use strict";const{AbstractIterator:r,AbstractKeyIterator:i,AbstractValueIterator:o}=n(3961),s=Symbol("unfix"),a=Symbol("iterator"),c=Symbol("handleOne"),h=Symbol("handleMany"),u=Symbol("callback");class l extends r{constructor(t,e,n,r){super(t,e),this[a]=n,this[s]=r,this[c]=this[c].bind(this),this[h]=this[h].bind(this),this[u]=null}[c](t,e,n){const r=this[u];if(t)return r(t);void 0!==e&&(e=this[s](e)),r(t,e,n)}[h](t,e){const n=this[u];if(t)return n(t);for(const t of e){const e=t[0];void 0!==e&&(t[0]=this[s](e))}n(t,e)}}class f extends i{constructor(t,e,n,r){super(t,e),this[a]=n,this[s]=r,this[c]=this[c].bind(this),this[h]=this[h].bind(this),this[u]=null}[c](t,e){const n=this[u];if(t)return n(t);void 0!==e&&(e=this[s](e)),n(t,e)}[h](t,e){const n=this[u];if(t)return n(t);for(let t=0;t{"use strict";const r=n(4473),{Buffer:i}=n(8764)||{},{AbstractSublevelIterator:o,AbstractSublevelKeyIterator:s,AbstractSublevelValueIterator:a}=n(2970),c=Symbol("prefix"),h=Symbol("upperBound"),u=Symbol("prefixRange"),l=Symbol("parent"),f=Symbol("unfix"),d=new TextEncoder,p={separator:"!"};t.exports=function({AbstractLevel:t}){class e extends t{static defaults(t){if("string"==typeof t)throw new r("The subleveldown string shorthand for { separator } has been removed",{code:"LEVEL_LEGACY"});if(t&&t.open)throw new r("The subleveldown open option has been removed",{code:"LEVEL_LEGACY"});return null==t?p:t.separator?t:{...t,separator:"!"}}constructor(t,n,i){const{separator:o,manifest:s,...a}=e.defaults(i);n=E(n,o);const u=o.charCodeAt(0)+1,p=t[l]||t;if(!d.encode(n).every((t=>t>u&&t<127)))throw new r(`Prefix must use bytes > ${u} < 127`,{code:"LEVEL_INVALID_PREFIX"});super(y(p,s),a);const g=(t.prefix||"")+o+n+o,v=g.slice(0,-1)+String.fromCharCode(u);this[l]=p,this[c]=new b(g),this[h]=new b(v),this[f]=new m,this.nextTick=p.nextTick}prefixKey(t,e){if("utf8"===e)return this[c].utf8+t;if(0===t.byteLength)return this[c][e];if("view"===e){const e=this[c].view,n=new Uint8Array(e.byteLength+t.byteLength);return n.set(e,0),n.set(t,e.byteLength),n}{const e=this[c].buffer;return i.concat([e,t],e.byteLength+t.byteLength)}}[u](t,e){void 0!==t.gte?t.gte=this.prefixKey(t.gte,e):void 0!==t.gt?t.gt=this.prefixKey(t.gt,e):t.gte=this[c][e],void 0!==t.lte?t.lte=this.prefixKey(t.lte,e):void 0!==t.lt?t.lt=this.prefixKey(t.lt,e):t.lte=this[h][e]}get prefix(){return this[c].utf8}get db(){return this[l]}_open(t,e){this[l].open({passive:!0},e)}_put(t,e,n,r){this[l].put(t,e,n,r)}_get(t,e,n){this[l].get(t,e,n)}_getMany(t,e,n){this[l].getMany(t,e,n)}_del(t,e,n){this[l].del(t,e,n)}_batch(t,e,n){this[l].batch(t,e,n)}_clear(t,e){this[u](t,t.keyEncoding),this[l].clear(t,e)}_iterator(t){this[u](t,t.keyEncoding);const e=this[l].iterator(t),n=this[f].get(this[c].utf8.length,t.keyEncoding);return new o(this,t,e,n)}_keys(t){this[u](t,t.keyEncoding);const e=this[l].keys(t),n=this[f].get(this[c].utf8.length,t.keyEncoding);return new s(this,t,e,n)}_values(t){this[u](t,t.keyEncoding);const e=this[l].values(t);return new a(this,t,e)}}return{AbstractSublevel:e}};const y=function(t,e){return{...t.supports,createIfMissing:!1,errorIfExists:!1,events:{},additionalMethods:{},...e,encodings:{utf8:g(t,"utf8"),buffer:g(t,"buffer"),view:g(t,"view")}}},g=function(t,e){return!!t.supports.encodings[e]&&t.keyEncoding(e).name===e};class b{constructor(t){this.utf8=t,this.view=d.encode(t),this.buffer=i?i.from(this.view.buffer,0,this.view.byteLength):{}}}class m{constructor(){this.cache=new Map}get(t,e){let n=this.cache.get(e);return void 0===n&&(n="view"===e?function(t,e){return e.subarray(t)}.bind(null,t):function(t,e){return e.slice(t)}.bind(null,t),this.cache.set(e,n)),n}}const E=function(t,e){let n=0,r=t.length;for(;nn&&t[r-1]===e;)r--;return t.slice(n,r)}},2520:(t,e)=>{"use strict";e.getCallback=function(t,e){return"function"==typeof t?t:e},e.getOptions=function(t,e){return"object"==typeof t&&null!==t?t:void 0!==e?e:{}}},4765:(t,e,n)=>{"use strict";const{AbstractChainedBatch:r}=n(9464),i=n(4473),o=Symbol("encoded");e.DefaultChainedBatch=class extends r{constructor(t){super(t),this[o]=[]}_put(t,e,n){this[o].push({...n,type:"put",key:t,value:e})}_del(t,e){this[o].push({...e,type:"del",key:t})}_clear(){this[o]=[]}_write(t,e){"opening"===this.db.status?this.db.defer((()=>this._write(t,e))):"open"===this.db.status?0===this[o].length?this.nextTick(e):this.db._batch(this[o],t,e):this.nextTick(e,new i("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"}))}}},5429:(t,e,n)=>{"use strict";const{AbstractKeyIterator:r,AbstractValueIterator:i}=n(3961),o=Symbol("iterator"),s=Symbol("callback"),a=Symbol("handleOne"),c=Symbol("handleMany");class h extends r{constructor(t,e){super(t,e),this[o]=t.iterator({...e,keys:!0,values:!1}),this[a]=this[a].bind(this),this[c]=this[c].bind(this)}}class u extends i{constructor(t,e){super(t,e),this[o]=t.iterator({...e,keys:!1,values:!0}),this[a]=this[a].bind(this),this[c]=this[c].bind(this)}}for(const t of[h,u]){const e=t===h,n=e?t=>t[0]:t=>t[1];t.prototype._next=function(t){this[s]=t,this[o].next(this[a])},t.prototype[a]=function(t,n,r){const i=this[s];t?i(t):i(null,e?n:r)},t.prototype._nextv=function(t,e,n){this[s]=n,this[o].nextv(t,e,this[c])},t.prototype._all=function(t,e){this[s]=e,this[o].all(t,this[c])},t.prototype[c]=function(t,e){const r=this[s];t?r(t):r(null,e.map(n))},t.prototype._seek=function(t,e){this[o].seek(t,e)},t.prototype._close=function(t){this[o].close(t)}}e.DefaultKeyIterator=h,e.DefaultValueIterator=u},593:(t,e,n)=>{"use strict";const{AbstractIterator:r,AbstractKeyIterator:i,AbstractValueIterator:o}=n(3961),s=n(4473),a=Symbol("nut"),c=Symbol("undefer"),h=Symbol("factory");class u extends r{constructor(t,e){super(t,e),this[a]=null,this[h]=()=>t.iterator(e),this.db.defer((()=>this[c]()))}}class l extends i{constructor(t,e){super(t,e),this[a]=null,this[h]=()=>t.keys(e),this.db.defer((()=>this[c]()))}}class f extends o{constructor(t,e){super(t,e),this[a]=null,this[h]=()=>t.values(e),this.db.defer((()=>this[c]()))}}for(const t of[u,l,f])t.prototype[c]=function(){"open"===this.db.status&&(this[a]=this[h]())},t.prototype._next=function(t){null!==this[a]?this[a].next(t):"opening"===this.db.status?this.db.defer((()=>this._next(t))):this.nextTick(t,new s("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._nextv=function(t,e,n){null!==this[a]?this[a].nextv(t,e,n):"opening"===this.db.status?this.db.defer((()=>this._nextv(t,e,n))):this.nextTick(n,new s("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._all=function(t,e){null!==this[a]?this[a].all(e):"opening"===this.db.status?this.db.defer((()=>this._all(t,e))):this.nextTick(e,new s("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._seek=function(t,e){null!==this[a]?this[a]._seek(t,e):"opening"===this.db.status&&this.db.defer((()=>this._seek(t,e)))},t.prototype._close=function(t){null!==this[a]?this[a].close(t):"opening"===this.db.status?this.db.defer((()=>this._close(t))):this.nextTick(t)};e.DeferredIterator=u,e.DeferredKeyIterator=l,e.DeferredValueIterator=f},6909:(t,e,n)=>{"use strict";const r=n(4375);t.exports=function(t,...e){0===e.length?r(t):r((()=>t(...e)))}},56:(t,e,n)=>{"use strict";const r=n(4473),i=Object.prototype.hasOwnProperty,o=new Set(["lt","lte","gt","gte"]);t.exports=function(t,e){const n={};for(const s in t)if(i.call(t,s)&&"keyEncoding"!==s&&"valueEncoding"!==s){if("start"===s||"end"===s)throw new r(`The legacy range option '${s}' has been removed`,{code:"LEVEL_LEGACY"});if("encoding"===s)throw new r("The levelup-style 'encoding' alias has been removed, use 'valueEncoding' instead",{code:"LEVEL_LEGACY"});o.has(s)?n[s]=e.encode(t[s]):n[s]=t[s]}return n.reverse=!!n.reverse,n.limit=Number.isInteger(n.limit)&&n.limit>=0?n.limit:-1,n}},3658:(t,e)=>{"use strict";e.supports=function(...t){const e=t.reduce(((t,e)=>Object.assign(t,e)),{});return Object.assign(e,{snapshots:e.snapshots||!1,permanence:e.permanence||!1,seek:e.seek||!1,clear:e.clear||!1,getMany:e.getMany||!1,keyIterator:e.keyIterator||!1,valueIterator:e.valueIterator||!1,iteratorNextv:e.iteratorNextv||!1,iteratorAll:e.iteratorAll||!1,status:e.status||!1,createIfMissing:e.createIfMissing||!1,errorIfExists:e.errorIfExists||!1,deferredOpen:e.deferredOpen||!1,promises:e.promises||!1,streams:e.streams||!1,encodings:Object.assign({},e.encodings),events:Object.assign({},e.events),additionalMethods:Object.assign({},e.additionalMethods)})}},9742:(t,e)=>{"use strict";e.byteLength=function(t){var e=c(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,o=c(t),s=o[0],a=o[1],h=new i(function(t,e,n){return 3*(e+n)/4-n}(0,s,a)),u=0,l=a>0?s-4:s;for(n=0;n>16&255,h[u++]=e>>8&255,h[u++]=255&e;return 2===a&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,h[u++]=255&e),1===a&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,h[u++]=e>>8&255,h[u++]=255&e),h},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,c=r-i;ac?c:a+s));return 1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),o.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function h(t,e,r){for(var i,o,s=[],a=e;a>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},1708:(t,e,n)=>{"use strict";const{AbstractLevel:r}=n(875),i=n(4473),o=n(9967),{fromCallback:s}=n(6957),{Iterator:a}=n(8212),c=n(9687),h=n(9968),u=n(1217),l="level-js-",f=Symbol("idb"),d=Symbol("namePrefix"),p=Symbol("location"),y=Symbol("version"),g=Symbol("store"),b=Symbol("onComplete"),m=Symbol("promise");class E extends r{constructor(t,e,n){if("function"==typeof e||"function"==typeof n)throw new i("The levelup-style callback argument has been removed",{code:"LEVEL_LEGACY"});const{prefix:r,version:o,...s}=e||{};if(super({encodings:{view:!0},snapshots:!1,createIfMissing:!1,errorIfExists:!1,seek:!0},s),"string"!=typeof t)throw new Error("constructor requires a location string argument");this[p]=t,this[d]=null==r?l:r,this[y]=parseInt(o||1,10),this[f]=null}get location(){return this[p]}get namePrefix(){return this[d]}get version(){return this[y]}get db(){return this[f]}get type(){return"browser-level"}_open(t,e){const n=indexedDB.open(this[d]+this[p],this[y]);n.onerror=function(){e(n.error||new Error("unknown error"))},n.onsuccess=()=>{this[f]=n.result,e()},n.onupgradeneeded=t=>{const e=t.target.result;e.objectStoreNames.contains(this[p])||e.createObjectStore(this[p])}}[g](t){return this[f].transaction([this[p]],t).objectStore(this[p])}[b](t,e){const n=t.transaction;n.onabort=function(){e(n.error||new Error("aborted by user"))},n.oncomplete=function(){e(null,t.result)}}_get(t,e,n){const r=this[g]("readonly");let o;try{o=r.get(t)}catch(t){return this.nextTick(n,t)}this[b](o,(function(t,e){return t?n(t):void 0===e?n(new i("Entry not found",{code:"LEVEL_NOT_FOUND"})):void n(null,c(e))}))}_getMany(t,e,n){const r=this[g]("readonly"),i=t.map((t=>e=>{let n;try{n=r.get(t)}catch(t){return e(t)}n.onsuccess=()=>{const t=n.result;e(null,void 0===t?t:c(t))},n.onerror=t=>{t.stopPropagation(),e(n.error)}}));o(i,16,n)}_del(t,e,n){const r=this[g]("readwrite");let i;try{i=r.delete(t)}catch(t){return this.nextTick(n,t)}this[b](i,n)}_put(t,e,n,r){const i=this[g]("readwrite");let o;try{o=i.put(e,t)}catch(t){return this.nextTick(r,t)}this[b](o,r)}_iterator(t){return new a(this,this[p],t)}_batch(t,e,n){const r=this[g]("readwrite"),i=r.transaction;let o,s=0;i.onabort=function(){n(o||i.error||new Error("aborted by user"))},i.oncomplete=function(){n()},function e(){const n=t[s++],a=n.key;let c;try{c="del"===n.type?r.delete(a):r.put(n.value,a)}catch(t){return o=t,void i.abort()}s=0)return h(this,this[p],n,t,e);try{const t=this[g]("readwrite");r=n?t.delete(n):t.clear()}catch(t){return this.nextTick(e,t)}this[b](r,e)}_close(t){this[f].close(),this.nextTick(t)}}E.destroy=function(t,e,n){"function"==typeof e&&(n=e,e=l),n=s(n,m);const r=indexedDB.deleteDatabase(e+t);return r.onsuccess=function(){n()},r.onerror=function(t){n(t)},n[m]},e.BrowserLevel=E},8212:(t,e,n)=>{"use strict";const{AbstractIterator:r}=n(875),i=n(1217),o=n(9687),s=Symbol("cache"),a=Symbol("finished"),c=Symbol("options"),h=Symbol("currentOptions"),u=Symbol("position"),l=Symbol("location"),f=Symbol("first"),d={};function p(t){"function"==typeof t.commit&&t.commit()}e.Iterator=class extends r{constructor(t,e,n){super(t,n),this[s]=[],this[a]=0===this.limit,this[c]=n,this[h]={...n},this[u]=void 0,this[l]=e,this[f]=!0}_nextv(t,e,n){if(this[f]=!1,this[a])return this.nextTick(n,null,[]);if(this[s].length>0)return t=Math.min(t,this[s].length),this.nextTick(n,null,this[s].splice(0,t));let r;void 0!==this[u]&&(this[c].reverse?(this[h].lt=this[u],this[h].lte=void 0):(this[h].gt=this[u],this[h].gte=void 0));try{r=i(this[h])}catch(t){return this[a]=!0,this.nextTick(n,null,[])}const d=this.db.db.transaction([this[l]],"readonly"),y=d.objectStore(this[l]),g=[];if(this[c].reverse)y[!this[c].values&&y.openKeyCursor?"openKeyCursor":"openCursor"](r,"prev").onsuccess=e=>{const n=e.target.result;if(n){const{key:e,value:r}=n;this[u]=e,g.push([this[c].keys&&void 0!==e?o(e):void 0,this[c].values&&void 0!==r?o(r):void 0]),g.length{if(void 0===e||void 0===n)return;const r=Math.max(e.length,n.length);0===r||t===1/0?this[a]=!0:this[u]=e[r-1],g.length=r;for(let t=0;t{e=t.target.result,i()}:(e=[],this.nextTick(i)),this[c].values?y.getAll(r,t<1/0?t:void 0).onsuccess=t=>{n=t.target.result,i()}:(n=[],this.nextTick(i))}d.onabort=()=>{n(d.error||new Error("aborted by user")),n=null},d.oncomplete=()=>{n(null,g),n=null}}_next(t){if(this[s].length>0){const[e,n]=this[s].shift();this.nextTick(t,null,e,n)}else if(this[a])this.nextTick(t);else{let e=Math.min(100,this.limit-this.count);this[f]&&(this[f]=!1,e=1),this._nextv(e,d,((e,n)=>{if(e)return t(e);this[s]=n,this._next(t)}))}}_all(t,e){this[f]=!1;const n=this[s].splice(0,this[s].length),r=this.limit-this.count-n.length;if(r<=0)return this.nextTick(e,null,n);this._nextv(r,d,((t,r)=>{if(t)return e(t);n.length>0&&(r=n.concat(r)),e(null,r)}))}_seek(t,e){let n;this[f]=!0,this[s]=[],this[a]=!1,this[u]=void 0,this[h]={...this[c]};try{n=i(this[c])}catch(t){return void(this[a]=!0)}null===n||n.includes(t)?this[c].reverse?this[h].lte=t:this[h].gte=t:this[a]=!0}}},9968:t=>{"use strict";t.exports=function(t,e,n,r,i){if(0===r.limit)return t.nextTick(i);const o=t.db.transaction([e],"readwrite"),s=o.objectStore(e);let a=0;o.oncomplete=function(){i()},o.onabort=function(){i(o.error||new Error("aborted by user"))};const c=s.openKeyCursor?"openKeyCursor":"openCursor",h=r.reverse?"prev":"next";s[c](n,h).onsuccess=function(t){const e=t.target.result;e&&(s.delete(e.key).onsuccess=function(){(r.limit<=0||++a{"use strict";const e=new TextEncoder;t.exports=function(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):e.encode(t)}},1217:t=>{"use strict";t.exports=function(t){const e=void 0!==t.gte?t.gte:void 0!==t.gt?t.gt:void 0,n=void 0!==t.lte?t.lte:void 0!==t.lt?t.lt:void 0,r=void 0===t.gte,i=void 0===t.lte;return void 0!==e&&void 0!==n?IDBKeyRange.bound(e,n,r,i):void 0!==e?IDBKeyRange.lowerBound(e,r):void 0!==n?IDBKeyRange.upperBound(n,i):null}},8764:(t,e,n)=>{"use strict";const r=n(9742),i=n(645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=c,e.SlowBuffer=function(t){return+t!=t&&(t=0),c.alloc(+t)},e.INSPECT_MAX_BYTES=50;const s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,c.prototype),e}function c(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return h(t,e,n)}function h(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!c.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|y(t,e);let r=a(n);const i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return f(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return d(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return d(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return c.from(r,e,n);const i=function(t){if(c.isBuffer(t)){const e=0|p(t.length),n=a(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||J(t.length)?a(0):f(t):"Buffer"===t.type&&Array.isArray(t.data)?f(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return c.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function l(t){return u(t),a(t<0?0:0|p(t))}function f(t){const e=t.length<0?0:0|p(t.length),n=a(e);for(let r=0;r=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function y(t,e){if(c.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(t).length;default:if(i)return r?-1:$(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,n);case"utf8":case"utf-8":return A(this,e,n);case"ascii":return k(this,e,n);case"latin1":case"binary":return x(this,e,n);case"base64":return L(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function b(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function m(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),J(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=c.from(e,r)),c.isBuffer(e))return 0===e.length?-1:E(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):E(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function E(t,e,n,r,i){let o,s=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,c/=2,n/=2}function h(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;oa&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=e.length;let s;for(r>o/2&&(r=o/2),s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function L(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function A(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,c;switch(s){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(c=(31&e)<<6|63&n,c>127&&(o=c));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(c=(15&e)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(c=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){const e=t.length;if(e<=O)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr.length?(c.isBuffer(e)||(e=c.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!c.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},c.byteLength=y,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;en&&(t+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(t,e,n,r,i){if(Y(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0);const a=Math.min(o,s),h=this.slice(r,i),u=t.slice(e,n);for(let t=0;t>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return v(this,t,e,n);case"utf8":case"utf-8":return w(this,t,e,n);case"ascii":case"latin1":case"binary":return _(this,t,e,n);case"base64":return T(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const O=4096;function k(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;ir)&&(n=r);let i="";for(let r=e;rn)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,n,r,i,o){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function D(t,e,n,r,i){G(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function U(t,e,n,r,i){G(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function P(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function M(t,e,n,r,o){return e=+e,n>>>=0,o||P(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function B(t,e,n,r,o){return e=+e,n>>>=0,o||P(t,0,n,8),i.write(t,e,n,r,52,8),n+8}c.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||C(t,e,this.length);let r=this[t],i=1,o=0;for(;++o>>=0,e>>>=0,n||C(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),this[t]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readBigUInt64LE=Q((function(t){z(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<>>=0,e>>>=0,n||C(t,e,this.length);let r=this[t],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*e)),r},c.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||C(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},c.prototype.readInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){t>>>=0,e||C(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(t,e){t>>>=0,e||C(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readBigInt64LE=Q((function(t){z(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<>>=0,e||C(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return t>>>=0,e||C(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return t>>>=0,e||C(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return t>>>=0,e||C(t,8,this.length),i.read(this,t,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||N(this,t,e,n,Math.pow(2,8*n)-1,0);let i=1,o=0;for(this[e]=255&t;++o>>=0,n>>>=0,r||N(this,t,e,n,Math.pow(2,8*n)-1,0);let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,1,255,0),this[e]=255&t,e+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigUInt64LE=Q((function(t,e=0){return D(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Q((function(t,e=0){return U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);N(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+n},c.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);N(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},c.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},c.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigInt64LE=Q((function(t,e=0){return D(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Q((function(t,e=0){return U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(t,e,n){return M(this,t,e,!0,n)},c.prototype.writeFloatBE=function(t,e,n){return M(this,t,e,!1,n)},c.prototype.writeDoubleLE=function(t,e,n){return B(this,t,e,!0,n)},c.prototype.writeDoubleBE=function(t,e,n){return B(this,t,e,!1,n)},c.prototype.copy=function(t,e,n,r){if(!c.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function G(t,e,n,r,i,o){if(t>n||t3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){z(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||W(e,t.length-(n+1))}(r,i,o)}function z(t,e){if("number"!=typeof t)throw new j.ERR_INVALID_ARG_TYPE(e,"number",t)}function W(t,e,n){if(Math.floor(t)!==t)throw z(t,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=V(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=V(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);const K=/[^+/0-9A-Za-z-_]/g;function $(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function q(t){return r.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(K,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,n,r){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function J(t){return t!=t}const X=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Q(t){return"undefined"==typeof BigInt?Z:t}function Z(){throw new Error("BigInt not supported")}},6957:(t,e,n)=>{"use strict";var r=n(886);e.fromCallback=function(t,e){if(void 0===t){var n=new Promise((function(e,n){t=function(t,r){t?n(t):e(r)}}));t[void 0!==e?e:"promise"]=n}else if("function"!=typeof t)throw new TypeError("Callback must be a function");return t},e.fromPromise=function(t,e){if(void 0===e)return t;t.then((function(t){r((()=>e(null,t)))})).catch((function(t){r((()=>e(t)))}))}},886:t=>{t.exports="function"==typeof queueMicrotask?queueMicrotask:t=>Promise.resolve().then(t)},8840:(t,e)=>{function n(t){for(var e="",n=0;n0?"F"+s:"D"+n(s)},e.decode=function(t){if("DaN"===t)return NaN;if("FF"===t)return 1/0;if("DD"===t)return-1/0;var e="D"===t[0],r=(e?n(t):t).slice(2).split("M");return Number((e?"-":"")+r[1]+"e"+String(Number(r[0])-500))}},2833:(t,e)=>{var n={"?":"?@","!":"??",'"':"?%"},r={"?@":"?","??":"!","?%":'"'};e.factory=function(t){return{encode:e,decode:function(e){if("A"===e)return null;if("K!"===e)return[];for(var n,i=e.split('"'),o=[[]],s=0,a=i.length,c=0;c{var r=n(8840),i=n(2833);e.flip=function(t){var e=t.toString(),n="";for(var r in e)n+="."==e[r]?".":9-+e[r];return n},e.number=r,e.string={encode:function(t){return/\x00|\x01/.test(t)?"J"+t.replace(/\x01/g,"").replace(/\x00/g,""):"J"+t},decode:function(t){if("J"===t[0])return t.substring(1)}},e.encode=function(t){return e[typeof t].encode(t)},e.decode=function(t){if(""===t)return t;if(!o[t[0]])throw new Error("no decoder for:"+JSON.stringify(t));return o[t[0]](t)},e.object=i.factory(e),e.boolean={encode:function(t){return t?"C":"B"},decode:function(t){return"C"===t}},e.undefined={encode:function(t){return"L"},decode:function(){}};var o={A:e.object.decode,B:e.boolean.decode,C:e.boolean.decode,D:e.number.decode,F:e.number.decode,J:e.string.decode,K:e.object.decode,L:e.undefined.decode};e.buffer=!1,e.type="charwise"},6729:t=>{"use strict";var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||t,s),c=n?n+e:e;return t._events[c]?t._events[c].fn?t._events[c]=[t._events[c],a]:t._events[c].push(a):(t._events[c]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},a.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i{"use strict";var e,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};e=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var i=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,e){return new Promise((function(n,r){function i(n){t.removeListener(e,o),r(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}y(t,e,o,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&y(t,"error",e,{once:!0})}(t,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function c(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function h(t,e,n,r){var i,o,s,h;if(a(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),s=o[e]),void 0===s)s=o[e]=n,++t._eventsCount;else if("function"==typeof s?s=o[e]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=c(t))>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,h=u,console&&console.warn&&console.warn(h)}return t}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=u.bind(r);return i.listener=n,r.wrapFn=i,i}function f(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[t];if(void 0===c)return!1;if("function"==typeof c)r(c,this,e);else{var h=c.length,u=p(c,h);for(n=0;n=0;o--)if(n[o]===e||n[o].listener===e){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1=0;r--)this.removeListener(t,e[r]);return this},o.prototype.listeners=function(t){return f(this,t,!0)},o.prototype.rawListeners=function(t){return f(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):d.call(t,e)},o.prototype.listenerCount=d,o.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},9203:(t,e,n)=>{const r=n(7270),{BrowserLevel:i}=n(1708);t.exports=t=>r(Object.assign({db:i},t))},7270:(t,e,n)=>{const r=n(2483),i=n(9563),o=n(8936),s=t=>void 0===t?void 0:t.map((t=>(t._match=t._match.flat(1/0).map((t=>"string"==typeof t?JSON.parse(t):t)).sort(((t,e)=>t.FIELDe.FIELD?1:t.VALUEe.VALUE?1:t.SCOREe.SCORE?1:0)),t))),a=t=>{const e=i(t),n=o(t);return n.TIMESTAMP_CREATED().then((()=>({AGGREGATION_FILTER:e.AGGREGATION_FILTER,AND:(t,n)=>e.INTERSECTION(t,n).then(s),BUCKET:e.BUCKET,BUCKETS:e.BUCKETS,CREATED:e.CREATED,DELETE:n.DELETE,DISTINCT:e.DISTINCT,EXIST:e.EXIST,EXPORT:e.EXPORT,FACETS:e.FACETS,FIELDS:e.FIELDS,GET:(t,n)=>e.GET(t,n).then(s),IMPORT:n.IMPORT,LAST_UPDATED:e.LAST_UPDATED,MAX:e.MAX,MIN:e.MIN,NOT:(...t)=>e.SET_SUBTRACTION(...t).then(s),OBJECT:e.OBJECT,OR:(t,n)=>e.UNION(t,n).then((t=>t.union)).then(s),PUT:n.PUT,SORT:e.SORT,STORE:t._db,TIMESTAMP_LAST_UPDATED:n.TIMESTAMP_LAST_UPDATED,parseToken:e.parseToken})))};t.exports=t=>((t={})=>new Promise(((e,n)=>{const i=new(0,(t=Object.assign({name:"fii",tokenAppend:"",caseSensitive:!0,stopwords:[],doNotIndexField:[],storeVectors:!0,docExistsSpace:"DOC"},t)).db)(t.name,{keyEncoding:r,valueEncoding:"json"});i.open((r=>r?n(r):e(Object.assign(t,{_db:i}))))})))(t).then(a)},6782:t=>{const e=null,n=void 0;t.exports=(t,r)=>new Promise(((i,o)=>{if(Array.isArray(t))return o(new Error("token cannot be Array"));if(void 0===t&&(t={}),"string"==typeof t){if(-1===t.indexOf(":"))return i({FIELD:r,VALUE:{GTE:t,LTE:t}});const[e,...n]=t.split(":");return i({FIELD:[e],VALUE:{GTE:n.join(":"),LTE:n.join(":")}})}return"number"==typeof t&&(t={VALUE:{GTE:t,LTE:t}}),null===t.VALUE&&(t.VALUE={GTE:null,LTE:null}),"string"!=typeof t.VALUE&&"number"!=typeof t.VALUE||(t.VALUE={GTE:t.VALUE,LTE:t.VALUE}),void 0!==t.VALUE&&Object.keys(t.VALUE).length||(t.VALUE={GTE:e,LTE:n}),void 0===t.VALUE.GTE&&(t.VALUE.GTE=e),void 0===t.VALUE.LTE&&(t.VALUE.LTE=n),t.VALUE=Object.assign(t.VALUE,{GTE:t.VALUE.GTE,LTE:t.VALUE.LTE}),void 0===t.FIELD?i(Object.assign(t,{FIELD:r})):(t.FIELD=[t.FIELD].flat(),i(t))}))},9563:(t,e,n)=>{const r=n(6782),i=n(2483),{EntryStream:o}=n(6741);i.LO=null,i.HI=void 0,t.exports=t=>{const e=t=>"string"==typeof t,n=async t=>r(t,await u()),s=async(e,r=(t=>new Promise((e=>e(t)))))=>new Promise((async(i,o)=>{const s=t=>void 0===t?i(void 0):t instanceof Promise?i(t):void 0;try{s(e),e=await n(e),e=await(e=>{const n=e=>t.caseSensitive||"string"!=typeof e?e:e.toLowerCase();return{FIELD:e.FIELD.map(n),VALUE:{GTE:n(e.VALUE.GTE),LTE:n(e.VALUE.LTE)}}})(e),e=await(e=>e.VALUE.GTE===e.VALUE.LTE&&t.stopwords.includes(e.VALUE.GTE)?void 0:e)(e),s(e=await(e=>void 0===e?h(void 0):e.VALUE.GTE===e.VALUE.LTE&&t.queryReplace&&t.queryReplace[e.VALUE.GTE]?a(t.queryReplace[e.VALUE.GTE].map((t=>({FIELD:e.FIELD,VALUE:{GTE:t,LTE:t}})))).then((t=>t.union)):e)(e)),s(e=await r(e))}catch(t){return o(t)}return Array.isArray(e)?i(e):i(h(e))})),a=async(t,e)=>Promise.all(t.map((t=>s(t,e)))).then((t=>{const e=t.flat(1/0).reduce(((t,e)=>(e&&t.set(e._id,[...t.get(e._id)||[],e._match]),t)),new Map);return{sumTokensMinusStopwords:t.filter((t=>t)).length,union:Array.from(e.keys()).map((t=>({_id:t,_match:e.get(t)})))}})),c=(t,e,n)=>{const r=[];return void 0===e&&"number"!=typeof e||r.push(e),n&&r.push(i.HI),["IDX",t,r]},h=e=>new Promise((n=>{if(void 0===e)return n(void 0);const r=new Map;return Promise.all(e.FIELD.map((n=>new Promise((i=>new o(t._db,{gte:c(n,e.VALUE.GTE),lte:c(n,e.VALUE.LTE,!0),limit:e.LIMIT,reverse:e.REVERSE}).on("data",(t=>t.value.forEach((e=>r.set(e,[...r.get(e)||[],JSON.stringify({FIELD:t.key[1],VALUE:t.key[2][0],SCORE:t.key[2][1]})]))))).on("end",i)))))).then((()=>n(Array.from(r.keys()).map((t=>({_id:t,_match:r.get(t)}))))))})),u=()=>new Promise((e=>{const n=[];new o(t._db,{gte:["FIELD",i.LO],lte:["FIELD",i.HI]}).on("data",(t=>n.push(t.value))).on("end",(()=>e(n)))})),l=(t,e)=>e&&0!==e.length?(e=new Set(e.map((t=>t._id))),t.map((t=>Object.assign(t,{_id:[...new Set([...t._id].filter((t=>e.has(t))))]})))):t,f=async t=>n(t).then((t=>s(t).then((e=>Object.assign(t,{_id:[...e.reduce(((t,e)=>t.add(e._id)),new Set)].sort(),VALUE:t.VALUE}))))),d=e=>new Promise(((n,r)=>{const i=[];new o(t._db,e).on("data",(t=>{i.push(t)})).on("end",(()=>n(i)))})),p=(t,e)=>n(t).then((t=>h(Object.assign(t,{LIMIT:1,REVERSE:e})))).then((t=>t.length?JSON.parse(t.pop()._match.pop()).VALUE:null)),y=t=>n(t).then((t=>Promise.all(t.FIELD.map((e=>{let n=t.VALUE.LTE;void 0!==t.VALUE.LTE&&"number"!=typeof t.VALUE.LTE&&(n+="○");let r=t.VALUE.GTE;return t.VALUE.GTE&&"number"!=typeof t.VALUE.GTE&&(r+=" "),d({gte:c(e,r),lte:c(e,n,!0),keys:!0,values:!1}).then((t=>t.map((({key:t})=>({FIELD:t[1],VALUE:t[2][0]})))))}))))).then((t=>t.flat())),g=t=>n(t).then((t=>Promise.all(t.FIELD.map((e=>d({gte:c(e,t.VALUE.GTE),lte:c(e,t.VALUE.LTE,!0)}).then((t=>t.map((t=>({FIELD:t.key[1],VALUE:t.key[2][0],_id:t.value})))))))))).then((t=>t.flat())),b=new Intl.Collator("en",{numeric:!0,sensitivity:"base"});return{AGGREGATE:({BUCKETS:t,FACETS:e,QUERY:n})=>Promise.all([t,e,n]).then((([t=[],e=[],n=[]])=>({BUCKETS:l(t.flat(),n),FACETS:l(e.flat(),n),RESULT:n}))),AGGREGATION_FILTER:l,BUCKET:f,BUCKETS:(...t)=>Promise.all(t.map(f)),CREATED:()=>t._db.get(["~CREATED"]),DISTINCT:(...t)=>Promise.all(t.length?t.map(y):[y({})]).then((t=>[...t.flat().reduce(((t,e)=>t.add(JSON.stringify(e))),new Set)].map(JSON.parse))),EXIST:(...e)=>Promise.all(e.map((e=>t._db.get([t.docExistsSpace,e]).catch((t=>null))))).then((t=>t.reduce(((t,n,r)=>(null!=n&&t.push(e[r]),t)),[]))),EXPORT:d,FACETS:(...t)=>Promise.all(t.length?t.map(g):[g({})]).then((t=>[...t.flat().reduce(((t,e)=>t.add(JSON.stringify(e))),new Set)].map(JSON.parse))),FIELDS:u,GET:s,INTERSECTION:(t,e)=>a(t,e).then((t=>t.union.filter((e=>e._match.length===t.sumTokensMinusStopwords)))),LAST_UPDATED:()=>t._db.get(["~LAST_UPDATED"]),MAX:t=>p(t,!0),MIN:p,OBJECT:e=>Promise.all(e.map((e=>t._db.get(["DOC",e._id]).catch((t=>null))))).then((t=>e.map(((e,n)=>(e._object=t[n],e))))),SET_SUBTRACTION:(t,n)=>Promise.all([e(t)?s(t):t,e(n)?s(n):n]).then((([t,e])=>t.filter((t=>-1===e.map((t=>t._id)).indexOf(t._id))))),SORT:t=>new Promise((e=>e(t.sort(((t,e)=>b.compare(t._id,e._id)))))),UNION:a,parseToken:n}}},8936:(t,e,n)=>{const r=n(3692),i=n(9563);t.exports=t=>{let e=0;const n=(e,n)=>{if(null==e._object)return{_id:e._id,keys:[]};const i=[];return r(e._object).forEach((function(e){let r=!0;const o=this.path.filter((t=>!Number.isInteger(+t))).join(".");if("_id"===o&&(r=!1),n.doNotIndexField.filter((t=>o.startsWith(t))).length&&(r=!1),this.isLeaf&&t.stopwords.includes((this.node+"").split("#")[0])&&(r=!1),r&&this.isLeaf){let e;try{const t=JSON.parse(this.node);if(!Array.isArray(t))throw new Error;e=JSON.stringify([o,t])}catch(t){e=JSON.stringify([o,[this.node]])}i.push(t.caseSensitive?e:e.toLowerCase())}})),{_id:e._id,keys:i}},o=(t,e)=>(e.keys.forEach((n=>{t[n]=t[n]||[],t[n].push(e._id)})),t),s=(r,s,a,c,h)=>new Promise((u=>{r=r.map((t=>{var n;return t._id=void 0===(n=t._id)?++e:"string"==typeof n||"number"==typeof n?n:void 0,t._object&&(t._object._id=t._id),t})),h=Object.assign(t,h),i(t).EXIST(...r.map((t=>t._id))).then((t=>((t,e,n)=>{const r=Object.keys(t);return Promise.all(r.map((t=>["IDX",...JSON.parse(t)])).map((t=>new Promise(((n,r)=>e.get(t).then(n).catch((t=>n([])))))))).then((e=>e.map(((e,i)=>{const o=new Set(e),s=new Set(t[r[i]]);if("put"===n)return{key:["IDX",...JSON.parse(r[i])],type:n,value:[...new Set([...o,...s])].sort()};if("del"===n){const t=[...new Set([...o].filter((t=>!s.has(t))))];return{key:["IDX",...JSON.parse(r[i])],type:0===t.length?"del":"put",value:t}}return e}))))})(((t,e)=>t.map((t=>n(t,e))).reduce(o,{}))(r,h),s,a).then((e=>s.batch(e.concat(h.storeVectors?((t,e)=>t.map((t=>({key:["DOC",t._id],type:e,value:t._object}))))(r,a):[]).concat((t=>[...new Set(t.map((t=>t.key[1].split(":")[0])))].map((t=>({type:"put",key:["FIELD",t],value:t}))))(e)),(e=>u(r.map((e=>{let n;return"put"===a?n=t.includes(e._id)?"UPDATED":"CREATED":"del"===a&&(n=null===e._object?"FAILED":"DELETED"),{_id:e._id,operation:c,status:n}})))))))))})),a=e=>t._db.put(["~LAST_UPDATED"],Date.now()).then((()=>e));return{DELETE:e=>i(t).OBJECT(e.map((t=>({_id:t})))).then((e=>s(e,t._db,"del","DELETE",{}))).then(a),IMPORT:e=>t._db.clear().then((()=>t._db.batch(e.map((t=>Object.assign(t,{type:"put"})))))),PUT:(e,n={})=>s(e.map((t=>({_id:t._id,_object:t}))),t._db,"put","PUT",n).then(a),TIMESTAMP_CREATED:()=>t._db.get(["~CREATED"]).then().catch((e=>t._db.put(["~CREATED"],Date.now()).then(a))),TIMESTAMP_LAST_UPDATED:a}}},645:(t,e)=>{e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<>1,u=-7,l=n?i-1:0,f=n?-1:1,d=t[e+l];for(l+=f,o=d&(1<<-u)-1,d>>=-u,u+=a;u>0;o=256*o+t[e+l],l+=f,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+t[e+l],l+=f,u-=8);if(0===o)o=1-h;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=h}return(d?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,c,h=8*o-i-1,u=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),(e+=s+l>=1?f/c:f*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=u?(a=0,s=u):s+l>=1?(a=(e*c-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[n+d]=255&a,d+=p,a/=256,i-=8);for(s=s<0;t[n+d]=255&s,d+=p,s/=256,h-=8);t[n+d-p]|=128*y}},5717:t=>{"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}},6741:(t,e,n)=>{"use strict";const{Readable:r}=n(8473),i=Symbol("iterator"),o=Symbol("nextv");class s extends r{constructor(t,e,n){const{highWaterMark:r,...s}=n||{};super({objectMode:!0,highWaterMark:r||1e3}),this[i]=t[e](s),this[o]=this[o].bind(this),this.once("end",this.destroy.bind(this,null,null))}get db(){return this[i].db}_read(t){this.destroyed||this[i].nextv(t,this[o])}[o](t,e){if(!this.destroyed){if(t)return this.destroy(t);if(0===e.length)this.push(null);else for(const t of e)this.push(t)}}_destroy(t,e){this[i].close((function(n){e(t||n)}))}}e.EntryStream=class extends s{constructor(t,e){super(t,"iterator",{...e,keys:!0,values:!0})}[o](t,e){if(!this.destroyed){if(t)return this.destroy(t);if(0===e.length)this.push(null);else for(const[t,n]of e)this.push({key:t,value:n})}}},e.KeyStream=class extends s{constructor(t,e){super(t,"keys",e)}},e.ValueStream=class extends s{constructor(t,e){super(t,"values",e)}}},8499:(t,e,n)=>{"use strict";const r=n(4473),i=n(8002),{Encoding:o}=n(8266),{BufferFormat:s,ViewFormat:a,UTF8Format:c}=n(2376),h=Symbol("formats"),u=Symbol("encodings"),l=new Set(["buffer","view","utf8"]);e.Transcoder=class{constructor(t){if(!Array.isArray(t))throw new TypeError("The first argument 'formats' must be an array");if(!t.every((t=>l.has(t))))throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'");this[u]=new Map,this[h]=new Set(t);for(const t in i)try{this.encoding(t)}catch(t){if("LEVEL_ENCODING_NOT_SUPPORTED"!==t.code)throw t}}encodings(){return Array.from(new Set(this[u].values()))}encoding(t){let e=this[u].get(t);if(void 0===e){if("string"==typeof t&&""!==t){if(e=d[t],!e)throw new r(`Encoding '${t}' is not found`,{code:"LEVEL_ENCODING_NOT_FOUND"})}else{if("object"!=typeof t||null===t)throw new TypeError("First argument 'encoding' must be a string or object");e=function(t){if(t instanceof o)return t;const e="type"in t&&"string"==typeof t.type?t.type:void 0,n=t.name||e||"anonymous-"+p++;switch(function(t){return"format"in t&&void 0!==t.format?t.format:"buffer"in t&&"boolean"==typeof t.buffer?t.buffer?"buffer":"utf8":"code"in t&&Number.isInteger(t.code)?"view":"buffer"}(t)){case"view":return new a({...t,name:n});case"utf8":return new c({...t,name:n});case"buffer":return new s({...t,name:n});default:throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}}(t)}const{name:n,format:i}=e;if(!this[h].has(i))if(this[h].has("view"))e=e.createViewTranscoder();else if(this[h].has("buffer"))e=e.createBufferTranscoder();else{if(!this[h].has("utf8"))throw new r(`Encoding '${n}' cannot be transcoded`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"});e=e.createUTF8Transcoder()}for(const r of[t,n,e.name,e.commonName])this[u].set(r,e)}return e}};const f={binary:i.buffer,"utf-8":i.utf8},d={...i,...f};let p=0},8266:(t,e,n)=>{"use strict";const r=n(4473),i=new Set(["buffer","view","utf8"]);e.Encoding=class{constructor(t){if(this.encode=t.encode||this.encode,this.decode=t.decode||this.decode,this.name=t.name||this.name,this.format=t.format||this.format,"function"!=typeof this.encode)throw new TypeError("The 'encode' property must be a function");if("function"!=typeof this.decode)throw new TypeError("The 'decode' property must be a function");if(this.encode=this.encode.bind(this),this.decode=this.decode.bind(this),"string"!=typeof this.name||""===this.name)throw new TypeError("The 'name' property must be a string");if("string"!=typeof this.format||!i.has(this.format))throw new TypeError("The 'format' property must be one of 'buffer', 'view', 'utf8'");t.createViewTranscoder&&(this.createViewTranscoder=t.createViewTranscoder),t.createBufferTranscoder&&(this.createBufferTranscoder=t.createBufferTranscoder),t.createUTF8Transcoder&&(this.createUTF8Transcoder=t.createUTF8Transcoder)}get commonName(){return this.name.split("+")[0]}createBufferTranscoder(){throw new r(`Encoding '${this.name}' cannot be transcoded to 'buffer'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createViewTranscoder(){throw new r(`Encoding '${this.name}' cannot be transcoded to 'view'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createUTF8Transcoder(){throw new r(`Encoding '${this.name}' cannot be transcoded to 'utf8'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}}},8002:(t,e,n)=>{"use strict";const{Buffer:r}=n(8764)||{Buffer:{isBuffer:()=>!1}},{textEncoder:i,textDecoder:o}=n(4005)(),{BufferFormat:s,ViewFormat:a,UTF8Format:c}=n(2376),h=t=>t;e.utf8=new c({encode:function(t){return r.isBuffer(t)?t.toString("utf8"):ArrayBuffer.isView(t)?o.decode(t):String(t)},decode:h,name:"utf8",createViewTranscoder(){return new a({encode:function(t){return ArrayBuffer.isView(t)?t:i.encode(t)},decode:function(t){return o.decode(t)},name:`${this.name}+view`})},createBufferTranscoder(){return new s({encode:function(t){return r.isBuffer(t)?t:ArrayBuffer.isView(t)?r.from(t.buffer,t.byteOffset,t.byteLength):r.from(String(t),"utf8")},decode:function(t){return t.toString("utf8")},name:`${this.name}+buffer`})}}),e.json=new c({encode:JSON.stringify,decode:JSON.parse,name:"json"}),e.buffer=new s({encode:function(t){return r.isBuffer(t)?t:ArrayBuffer.isView(t)?r.from(t.buffer,t.byteOffset,t.byteLength):r.from(String(t),"utf8")},decode:h,name:"buffer",createViewTranscoder(){return new a({encode:function(t){return ArrayBuffer.isView(t)?t:r.from(String(t),"utf8")},decode:function(t){return r.from(t.buffer,t.byteOffset,t.byteLength)},name:`${this.name}+view`})}}),e.view=new a({encode:function(t){return ArrayBuffer.isView(t)?t:i.encode(t)},decode:h,name:"view",createBufferTranscoder(){return new s({encode:function(t){return r.isBuffer(t)?t:ArrayBuffer.isView(t)?r.from(t.buffer,t.byteOffset,t.byteLength):r.from(String(t),"utf8")},decode:h,name:`${this.name}+buffer`})}}),e.hex=new s({encode:function(t){return r.isBuffer(t)?t:r.from(String(t),"hex")},decode:function(t){return t.toString("hex")},name:"hex"}),e.base64=new s({encode:function(t){return r.isBuffer(t)?t:r.from(String(t),"base64")},decode:function(t){return t.toString("base64")},name:"base64"})},2376:(t,e,n)=>{"use strict";const{Buffer:r}=n(8764)||{},{Encoding:i}=n(8266),o=n(4005);class s extends i{constructor(t){super({...t,format:"buffer"})}createViewTranscoder(){return new a({encode:this.encode,decode:t=>this.decode(r.from(t.buffer,t.byteOffset,t.byteLength)),name:`${this.name}+view`})}createBufferTranscoder(){return this}}class a extends i{constructor(t){super({...t,format:"view"})}createBufferTranscoder(){return new s({encode:t=>{const e=this.encode(t);return r.from(e.buffer,e.byteOffset,e.byteLength)},decode:this.decode,name:`${this.name}+buffer`})}createViewTranscoder(){return this}}e.BufferFormat=s,e.ViewFormat=a,e.UTF8Format=class extends i{constructor(t){super({...t,format:"utf8"})}createBufferTranscoder(){return new s({encode:t=>r.from(this.encode(t),"utf8"),decode:t=>this.decode(t.toString("utf8")),name:`${this.name}+buffer`})}createViewTranscoder(){const{textEncoder:t,textDecoder:e}=o();return new a({encode:e=>t.encode(this.encode(e)),decode:t=>this.decode(e.decode(t)),name:`${this.name}+view`})}createUTF8Transcoder(){return this}}},4005:t=>{"use strict";let e=null;t.exports=function(){return null===e&&(e={textEncoder:new TextEncoder,textDecoder:new TextDecoder}),e}},9593:(t,e,n)=>{var r=n(4155);const i="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,o="function"==typeof AbortController?AbortController:class{constructor(){this.signal=new c}abort(){this.signal.dispatchEvent("abort")}},s="function"==typeof AbortSignal,a="function"==typeof o.AbortSignal,c=s?AbortSignal:a?o.AbortController:class{constructor(){this.aborted=!1,this._listeners=[]}dispatchEvent(t){if("abort"===t){this.aborted=!0;const e={type:t,target:this};this.onabort(e),this._listeners.forEach((t=>t(e)),this)}}onabort(){}addEventListener(t,e){"abort"===t&&this._listeners.push(e)}removeEventListener(t,e){"abort"===t&&(this._listeners=this._listeners.filter((t=>t!==e)))}},h=new Set,u=(t,e)=>{const n=`LRU_CACHE_OPTION_${t}`;d(n)&&p(n,`${t} option`,`options.${e}`,E)},l=(t,e)=>{const n=`LRU_CACHE_METHOD_${t}`;if(d(n)){const{prototype:r}=E,{get:i}=Object.getOwnPropertyDescriptor(r,t);p(n,`${t} method`,`cache.${e}()`,i)}},f=(...t)=>{"object"==typeof r&&r&&"function"==typeof r.emitWarning?r.emitWarning(...t):console.error(...t)},d=t=>!h.has(t),p=(t,e,n,r)=>{h.add(t),f(`The ${e} is deprecated. Please use ${n} instead.`,"DeprecationWarning",t,r)},y=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),g=t=>y(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?b:null:null;class b extends Array{constructor(t){super(t),this.fill(0)}}class m{constructor(t){if(0===t)return[];const e=g(t);this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class E{constructor(t={}){const{max:e=0,ttl:n,ttlResolution:r=1,ttlAutopurge:i,updateAgeOnGet:o,updateAgeOnHas:s,allowStale:a,dispose:c,disposeAfter:l,noDisposeOnSet:p,noUpdateTTL:b,maxSize:v=0,sizeCalculation:w,fetchMethod:_,fetchContext:T,noDeleteOnFetchRejection:S,noDeleteOnStaleGet:L}=t,{length:A,maxAge:O,stale:k}=t instanceof E?{}:t;if(0!==e&&!y(e))throw new TypeError("max option must be a nonnegative integer");const x=e?g(e):Array;if(!x)throw new Error("invalid max value: "+e);if(this.max=e,this.maxSize=v,this.sizeCalculation=w||A,this.sizeCalculation){if(!this.maxSize)throw new TypeError("cannot set sizeCalculation without setting maxSize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(this.fetchMethod=_||null,this.fetchMethod&&"function"!=typeof this.fetchMethod)throw new TypeError("fetchMethod must be a function if specified");if(this.fetchContext=T,!this.fetchMethod&&void 0!==T)throw new TypeError("cannot set fetchContext without fetchMethod");if(this.keyMap=new Map,this.keyList=new Array(e).fill(null),this.valList=new Array(e).fill(null),this.next=new x(e),this.prev=new x(e),this.head=0,this.tail=0,this.free=new m(e),this.initialFill=1,this.size=0,"function"==typeof c&&(this.dispose=c),"function"==typeof l?(this.disposeAfter=l,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!p,this.noUpdateTTL=!!b,this.noDeleteOnFetchRejection=!!S,0!==this.maxSize){if(!y(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!a||!!k,this.noDeleteOnStaleGet=!!L,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!s,this.ttlResolution=y(r)||0===r?r:1,this.ttlAutopurge=!!i,this.ttl=n||O||0,this.ttl){if(!y(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}if(0===this.max&&0===this.ttl&&0===this.maxSize)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.max&&!this.maxSize){const t="LRU_CACHE_UNBOUNDED";d(t)&&(h.add(t),f("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,E))}k&&u("stale","allowStale"),O&&u("maxAge","ttl"),A&&u("length","sizeCalculation")}getRemainingTTL(t){return this.has(t,{updateAgeOnHas:!1})?1/0:0}initializeTTLTracking(){this.ttls=new b(this.max),this.starts=new b(this.max),this.setItemTTL=(t,e,n=i.now())=>{if(this.starts[t]=0!==e?n:0,this.ttls[t]=e,0!==e&&this.ttlAutopurge){const n=setTimeout((()=>{this.isStale(t)&&this.delete(this.keyList[t])}),e+1);n.unref&&n.unref()}},this.updateItemAge=t=>{this.starts[t]=0!==this.ttls[t]?i.now():0};let t=0;const e=()=>{const e=i.now();if(this.ttlResolution>0){t=e;const n=setTimeout((()=>t=0),this.ttlResolution);n.unref&&n.unref()}return e};this.getRemainingTTL=n=>{const r=this.keyMap.get(n);return void 0===r?0:0===this.ttls[r]||0===this.starts[r]?1/0:this.starts[r]+this.ttls[r]-(t||e())},this.isStale=n=>0!==this.ttls[n]&&0!==this.starts[n]&&(t||e())-this.starts[n]>this.ttls[n]}updateItemAge(t){}setItemTTL(t,e,n){}isStale(t){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new b(this.max),this.removeItemSize=t=>this.calculatedSize-=this.sizes[t],this.requireSize=(t,e,n,r)=>{if(!y(n)){if(!r)throw new TypeError("invalid size value (must be positive integer)");if("function"!=typeof r)throw new TypeError("sizeCalculation must be a function");if(n=r(e,t),!y(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return n},this.addItemSize=(t,e,n,r)=>{this.sizes[t]=r;const i=this.maxSize-this.sizes[t];for(;this.calculatedSize>i;)this.evict(!0);this.calculatedSize+=this.sizes[t]}}removeItemSize(t){}addItemSize(t,e,n,r){}requireSize(t,e,n,r){if(n||r)throw new TypeError("cannot set size without setting maxSize on cache")}*indexes({allowStale:t=this.allowStale}={}){if(this.size)for(let e=this.tail;this.isValidIndex(e)&&(!t&&this.isStale(e)||(yield e),e!==this.head);)e=this.prev[e]}*rindexes({allowStale:t=this.allowStale}={}){if(this.size)for(let e=this.head;this.isValidIndex(e)&&(!t&&this.isStale(e)||(yield e),e!==this.tail);)e=this.next[e]}isValidIndex(t){return this.keyMap.get(this.keyList[t])===t}*entries(){for(const t of this.indexes())yield[this.keyList[t],this.valList[t]]}*rentries(){for(const t of this.rindexes())yield[this.keyList[t],this.valList[t]]}*keys(){for(const t of this.indexes())yield this.keyList[t]}*rkeys(){for(const t of this.rindexes())yield this.keyList[t]}*values(){for(const t of this.indexes())yield this.valList[t]}*rvalues(){for(const t of this.rindexes())yield this.valList[t]}[Symbol.iterator](){return this.entries()}find(t,e={}){for(const n of this.indexes())if(t(this.valList[n],this.keyList[n],this))return this.get(this.keyList[n],e)}forEach(t,e=this){for(const n of this.indexes())t.call(e,this.valList[n],this.keyList[n],this)}rforEach(t,e=this){for(const n of this.rindexes())t.call(e,this.valList[n],this.keyList[n],this)}get prune(){return l("prune","purgeStale"),this.purgeStale}purgeStale(){let t=!1;for(const e of this.rindexes({allowStale:!0}))this.isStale(e)&&(this.delete(this.keyList[e]),t=!0);return t}dump(){const t=[];for(const e of this.indexes({allowStale:!0})){const n=this.keyList[e],r=this.valList[e],o={value:this.isBackgroundFetch(r)?r.__staleWhileFetching:r};if(this.ttls){o.ttl=this.ttls[e];const t=i.now()-this.starts[e];o.start=Math.floor(Date.now()-t)}this.sizes&&(o.size=this.sizes[e]),t.unshift([n,o])}return t}load(t){this.clear();for(const[e,n]of t){if(n.start){const t=Date.now()-n.start;n.start=i.now()-t}this.set(e,n.value,n)}}dispose(t,e,n){}set(t,e,{ttl:n=this.ttl,start:r,noDisposeOnSet:i=this.noDisposeOnSet,size:o=0,sizeCalculation:s=this.sizeCalculation,noUpdateTTL:a=this.noUpdateTTL}={}){o=this.requireSize(t,e,o,s);let c=0===this.size?void 0:this.keyMap.get(t);if(void 0===c)c=this.newIndex(),this.keyList[c]=t,this.valList[c]=e,this.keyMap.set(t,c),this.next[this.tail]=c,this.prev[c]=this.tail,this.tail=c,this.size++,this.addItemSize(c,e,t,o),a=!1;else{const n=this.valList[c];e!==n&&(this.isBackgroundFetch(n)?n.__abortController.abort():i||(this.dispose(n,t,"set"),this.disposeAfter&&this.disposed.push([n,t,"set"])),this.removeItemSize(c),this.valList[c]=e,this.addItemSize(c,e,t,o)),this.moveToTail(c)}if(0===n||0!==this.ttl||this.ttls||this.initializeTTLTracking(),a||this.setItemTTL(c,n,r),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return 0===this.size?this.tail:this.size===this.max&&0!==this.max?this.evict(!1):0!==this.free.length?this.free.pop():this.initialFill++}pop(){if(this.size){const t=this.valList[this.head];return this.evict(!0),t}}evict(t){const e=this.head,n=this.keyList[e],r=this.valList[e];return this.isBackgroundFetch(r)?r.__abortController.abort():(this.dispose(r,n,"evict"),this.disposeAfter&&this.disposed.push([r,n,"evict"])),this.removeItemSize(e),t&&(this.keyList[e]=null,this.valList[e]=null,this.free.push(e)),this.head=this.next[e],this.keyMap.delete(n),this.size--,e}has(t,{updateAgeOnHas:e=this.updateAgeOnHas}={}){const n=this.keyMap.get(t);return void 0!==n&&!this.isStale(n)&&(e&&this.updateItemAge(n),!0)}peek(t,{allowStale:e=this.allowStale}={}){const n=this.keyMap.get(t);if(void 0!==n&&(e||!this.isStale(n)))return this.valList[n]}backgroundFetch(t,e,n,r){const i=void 0===e?void 0:this.valList[e];if(this.isBackgroundFetch(i))return i;const s=new o,a={signal:s.signal,options:n,context:r},c=new Promise((e=>e(this.fetchMethod(t,i,a)))).then((e=>(s.signal.aborted||this.set(t,e,a.options),e)),(r=>{if(this.valList[e]===c&&(n.noDeleteOnFetchRejection&&void 0!==c.__staleWhileFetching?this.valList[e]=c.__staleWhileFetching:this.delete(t)),c.__returned===c)throw r}));return c.__abortController=s,c.__staleWhileFetching=i,c.__returned=null,void 0===e?(this.set(t,c,a.options),e=this.keyMap.get(t)):this.valList[e]=c,c}isBackgroundFetch(t){return t&&"object"==typeof t&&"function"==typeof t.then&&Object.prototype.hasOwnProperty.call(t,"__staleWhileFetching")&&Object.prototype.hasOwnProperty.call(t,"__returned")&&(t.__returned===t||null===t.__returned)}async fetch(t,{allowStale:e=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:i=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:s=0,sizeCalculation:a=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:h=this.noDeleteOnFetchRejection,fetchContext:u=this.fetchContext}={}){if(!this.fetchMethod)return this.get(t,{allowStale:e,updateAgeOnGet:n,noDeleteOnStaleGet:r});const l={allowStale:e,updateAgeOnGet:n,noDeleteOnStaleGet:r,ttl:i,noDisposeOnSet:o,size:s,sizeCalculation:a,noUpdateTTL:c,noDeleteOnFetchRejection:h};let f=this.keyMap.get(t);if(void 0===f){const e=this.backgroundFetch(t,f,l,u);return e.__returned=e}{const r=this.valList[f];if(this.isBackgroundFetch(r))return e&&void 0!==r.__staleWhileFetching?r.__staleWhileFetching:r.__returned=r;if(!this.isStale(f))return this.moveToTail(f),n&&this.updateItemAge(f),r;const i=this.backgroundFetch(t,f,l,u);return e&&void 0!==i.__staleWhileFetching?i.__staleWhileFetching:i.__returned=i}}get(t,{allowStale:e=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet}={}){const i=this.keyMap.get(t);if(void 0!==i){const o=this.valList[i],s=this.isBackgroundFetch(o);if(this.isStale(i))return s?e?o.__staleWhileFetching:void 0:(r||this.delete(t),e?o:void 0);if(s)return;return this.moveToTail(i),n&&this.updateItemAge(i),o}}connect(t,e){this.prev[e]=t,this.next[t]=e}moveToTail(t){t!==this.tail&&(t===this.head?this.head=this.next[t]:this.connect(this.prev[t],this.next[t]),this.connect(this.tail,t),this.tail=t)}get del(){return l("del","delete"),this.delete}delete(t){let e=!1;if(0!==this.size){const n=this.keyMap.get(t);if(void 0!==n)if(e=!0,1===this.size)this.clear();else{this.removeItemSize(n);const e=this.valList[n];this.isBackgroundFetch(e)?e.__abortController.abort():(this.dispose(e,t,"delete"),this.disposeAfter&&this.disposed.push([e,t,"delete"])),this.keyMap.delete(t),this.keyList[n]=null,this.valList[n]=null,n===this.tail?this.tail=this.prev[n]:n===this.head?this.head=this.next[n]:(this.next[this.prev[n]]=this.next[n],this.prev[this.next[n]]=this.prev[n]),this.size--,this.free.push(n)}}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return e}clear(){for(const t of this.rindexes({allowStale:!0})){const e=this.valList[t];if(this.isBackgroundFetch(e))e.__abortController.abort();else{const n=this.keyList[t];this.dispose(e,n,"delete"),this.disposeAfter&&this.disposed.push([e,n,"delete"])}}if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return l("reset","clear"),this.clear}get length(){return((t,e)=>{const n="LRU_CACHE_PROPERTY_length";if(d(n)){const{prototype:e}=E,{get:r}=Object.getOwnPropertyDescriptor(e,t);p(n,"length property","cache.size",r)}})("length"),this.size}static get AbortController(){return o}static get AbortSignal(){return c}}t.exports=E},4473:t=>{"use strict";t.exports=class extends Error{constructor(t,e){super(t||""),"object"==typeof e&&null!==e&&(e.code&&(this.code=String(e.code)),e.expected&&(this.expected=!0),e.transient&&(this.transient=!0),e.cause&&(this.cause=e.cause)),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}},6349:function(t,e){!function(t){"use strict";const e=function(t,e){return t.slice(e-1).map(((n,r)=>t.slice(r,r+e)))};t.ngraminator=function(t,n){return n.reduce(((n,r)=>[...e(t,r),...n]),[]).sort()},Object.defineProperty(t,"__esModule",{value:!0})}(e)},4155:t=>{var e,n,r=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(n){try{return e.call(null,t,0)}catch(n){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var a,c=[],h=!1,u=-1;function l(){h&&a&&(h=!1,a.length?c=a.concat(c):u=-1,c.length&&f())}function f(){if(!h){var t=s(l);h=!0;for(var e=c.length;e;){for(a=c,c=[];++u1)for(var n=1;n{let r;t.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:n.g):t=>(r||(r=Promise.resolve())).then(t).catch((t=>setTimeout((()=>{throw t}),0)))},4281:t=>{"use strict";var e={};function n(t,n,r){r||(r=Error);var i=function(t){var e,r;function i(e,r,i){return t.call(this,function(t,e,r){return"string"==typeof n?n:n(t,e,r)}(e,r,i))||this}return r=t,(e=i).prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r,i}(r);i.prototype.name=r.name,i.prototype.code=t,e[t]=i}function r(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map((function(t){return String(t)})),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:2===n?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}n("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(t,e,n){var i,o,s,a,c;if("string"==typeof e&&(o="not ",e.substr(0,o.length)===o)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,n){return(void 0===n||n>t.length)&&(n=t.length),t.substring(n-e.length,n)===e}(t," argument"))s="The ".concat(t," ").concat(i," ").concat(r(e,"type"));else{var h=("number"!=typeof c&&(c=0),c+".".length>(a=t).length||-1===a.indexOf(".",c)?"argument":"property");s='The "'.concat(t,'" ').concat(h," ").concat(i," ").concat(r(e,"type"))}return s+". Received type ".concat(typeof n)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.q=e},6753:(t,e,n)=>{"use strict";var r=n(4155),i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=u;var o=n(9481),s=n(4229);n(5717)(u,o);for(var a=i(s.prototype),c=0;c{"use strict";t.exports=i;var r=n(4605);function i(t){if(!(this instanceof i))return new i(t);r.call(this,t)}n(5717)(i,r),i.prototype._transform=function(t,e,n){n(null,t)}},9481:(t,e,n)=>{"use strict";var r,i=n(4155);t.exports=L,L.ReadableState=S,n(7187).EventEmitter;var o,s=function(t,e){return t.listeners(e).length},a=n(2503),c=n(8764).Buffer,h=n.g.Uint8Array||function(){},u=n(4616);o=u&&u.debuglog?u.debuglog("stream"):function(){};var l,f,d,p=n(7327),y=n(1195),g=n(2457).getHighWaterMark,b=n(4281).q,m=b.ERR_INVALID_ARG_TYPE,E=b.ERR_STREAM_PUSH_AFTER_EOF,v=b.ERR_METHOD_NOT_IMPLEMENTED,w=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n(5717)(L,a);var _=y.errorOrDestroy,T=["error","close","destroy","pause","resume"];function S(t,e,i){r=r||n(6753),t=t||{},"boolean"!=typeof i&&(i=e instanceof r),this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g(this,t,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=n(2553).s),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function L(t){if(r=r||n(6753),!(this instanceof L))return new L(t);var e=this instanceof r;this._readableState=new S(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function A(t,e,n,r,i){o("readableAddChunk",e);var s,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(o("onEofChunk"),!e.ended){if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,e.sync?R(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,I(t)))}}(t,a);else if(i||(s=function(t,e){var n,r;return r=e,c.isBuffer(r)||r instanceof h||"string"==typeof e||void 0===e||t.objectMode||(n=new m("chunk",["string","Buffer","Uint8Array"],e)),n}(a,e)),s)_(t,s);else if(a.objectMode||e&&e.length>0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===c.prototype||(e=function(t){return c.from(t)}(e)),r)a.endEmitted?_(t,new w):O(t,a,e,!0);else if(a.ended)_(t,new E);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!n?(e=a.decoder.write(e),a.objectMode||0!==e.length?O(t,a,e,!1):C(t,a)):O(t,a,e,!1)}else r||(a.reading=!1,C(t,a));return!a.ended&&(a.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=k?t=k:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function R(t){var e=t._readableState;o("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(o("emitReadable",e.flowing),e.emittedReadable=!0,i.nextTick(I,t))}function I(t){var e=t._readableState;o("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,M(t)}function C(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(N,t,e))}function N(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function U(t){o("readable nexttick read 0"),t.read(0)}function P(t,e){o("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),M(t),e.flowing&&!e.reading&&t.read(0)}function M(t){var e=t._readableState;for(o("flow",e.flowing);e.flowing&&null!==t.read(););}function B(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):n=e.buffer.consume(t,e.decoder),n);var n}function j(t){var e=t._readableState;o("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,i.nextTick(F,e,t))}function F(t,e){if(o("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var n=e._writableState;(!n||n.autoDestroy&&n.finished)&&e.destroy()}}function V(t,e){for(var n=0,r=t.length;n=e.highWaterMark:e.length>0)||e.ended))return o("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?j(this):R(this),null;if(0===(t=x(t,e))&&e.ended)return 0===e.length&&j(this),null;var r,i=e.needReadable;return o("need readable",i),(0===e.length||e.length-t0?B(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&j(this)),null!==r&&this.emit("data",r),r},L.prototype._read=function(t){_(this,new v("_read()"))},L.prototype.pipe=function(t,e){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=t;break;case 1:r.pipes=[r.pipes,t];break;default:r.pipes.push(t)}r.pipesCount+=1,o("pipe count=%d opts=%j",r.pipesCount,e);var a=e&&!1===e.end||t===i.stdout||t===i.stderr?y:c;function c(){o("onend"),t.end()}r.endEmitted?i.nextTick(a):n.once("end",a),t.on("unpipe",(function e(i,s){o("onunpipe"),i===n&&s&&!1===s.hasUnpiped&&(s.hasUnpiped=!0,o("cleanup"),t.removeListener("close",d),t.removeListener("finish",p),t.removeListener("drain",h),t.removeListener("error",f),t.removeListener("unpipe",e),n.removeListener("end",c),n.removeListener("end",y),n.removeListener("data",l),u=!0,!r.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}));var h=function(t){return function(){var e=t._readableState;o("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,M(t))}}(n);t.on("drain",h);var u=!1;function l(e){o("ondata");var i=t.write(e);o("dest.write",i),!1===i&&((1===r.pipesCount&&r.pipes===t||r.pipesCount>1&&-1!==V(r.pipes,t))&&!u&&(o("false write response, pause",r.awaitDrain),r.awaitDrain++),n.pause())}function f(e){o("onerror",e),y(),t.removeListener("error",f),0===s(t,"error")&&_(t,e)}function d(){t.removeListener("finish",p),y()}function p(){o("onfinish"),t.removeListener("close",d),y()}function y(){o("unpipe"),n.unpipe(t)}return n.on("data",l),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events.error?Array.isArray(t._events.error)?t._events.error.unshift(n):t._events.error=[n,t._events.error]:t.on(e,n)}(t,"error",f),t.once("close",d),t.once("finish",p),t.emit("pipe",n),r.flowing||(o("pipe resume"),n.resume()),t},L.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==r.flowing&&this.resume()):"readable"===t&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,o("on readable",r.length,r.reading),r.length?R(this):r.reading||i.nextTick(U,this))),n},L.prototype.addListener=L.prototype.on,L.prototype.removeListener=function(t,e){var n=a.prototype.removeListener.call(this,t,e);return"readable"===t&&i.nextTick(D,this),n},L.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||i.nextTick(D,this),e},L.prototype.resume=function(){var t=this._readableState;return t.flowing||(o("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(P,t,e))}(this,t)),t.paused=!1,this},L.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},L.prototype.wrap=function(t){var e=this,n=this._readableState,r=!1;for(var i in t.on("end",(function(){if(o("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){o("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i||(n.objectMode||i&&i.length)&&(e.push(i)||(r=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var s=0;s{"use strict";t.exports=u;var r=n(4281).q,i=r.ERR_METHOD_NOT_IMPLEMENTED,o=r.ERR_MULTIPLE_CALLBACK,s=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=r.ERR_TRANSFORM_WITH_LENGTH_0,c=n(6753);function h(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{"use strict";var r,i=n(4155);function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;for(t.entry=null;r;){var i=r.callback;e.pendingcb--,i(undefined),r=r.next}e.corkedRequestsFree.next=t}(e,t)}}t.exports=L,L.WritableState=S;var s,a={deprecate:n(4927)},c=n(2503),h=n(8764).Buffer,u=n.g.Uint8Array||function(){},l=n(1195),f=n(2457).getHighWaterMark,d=n(4281).q,p=d.ERR_INVALID_ARG_TYPE,y=d.ERR_METHOD_NOT_IMPLEMENTED,g=d.ERR_MULTIPLE_CALLBACK,b=d.ERR_STREAM_CANNOT_PIPE,m=d.ERR_STREAM_DESTROYED,E=d.ERR_STREAM_NULL_VALUES,v=d.ERR_STREAM_WRITE_AFTER_END,w=d.ERR_UNKNOWN_ENCODING,_=l.errorOrDestroy;function T(){}function S(t,e,s){r=r||n(6753),t=t||{},"boolean"!=typeof s&&(s=e instanceof r),this.objectMode=!!t.objectMode,s&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=f(this,t,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,o=n.writecb;if("function"!=typeof o)throw new g;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,o){--e.pendingcb,n?(i.nextTick(o,r),i.nextTick(I,t,e),t._writableState.errorEmitted=!0,_(t,r)):(o(r),t._writableState.errorEmitted=!0,_(t,r),I(t,e))}(t,n,r,e,o);else{var s=x(n)||t.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||k(t,n),r?i.nextTick(O,t,n,s,o):O(t,n,s,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function L(t){var e=this instanceof(r=r||n(6753));if(!e&&!s.call(L,this))return new L(t);this._writableState=new S(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),c.call(this)}function A(t,e,n,r,i,o,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new m("write")):n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function O(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),I(t,e)}function k(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),s=e.corkedRequestsFree;s.entry=n;for(var a=0,c=!0;n;)i[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;i.allBuffers=c,A(t,e,!0,e.length,i,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;n;){var h=n.chunk,u=n.encoding,l=n.callback;if(A(t,e,!1,e.objectMode?1:h.length,h,u,l),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function x(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function R(t,e){t._final((function(n){e.pendingcb--,n&&_(t,n),e.prefinished=!0,t.emit("prefinish"),I(t,e)}))}function I(t,e){var n=x(e);if(n&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,i.nextTick(R,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var r=t._readableState;(!r||r.autoDestroy&&r.endEmitted)&&t.destroy()}return n}n(5717)(L,c),S.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(S.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(s=Function.prototype[Symbol.hasInstance],Object.defineProperty(L,Symbol.hasInstance,{value:function(t){return!!s.call(this,t)||this===L&&t&&t._writableState instanceof S}})):s=function(t){return t instanceof this},L.prototype.pipe=function(){_(this,new b)},L.prototype.write=function(t,e,n){var r,o=this._writableState,s=!1,a=!o.objectMode&&(r=t,h.isBuffer(r)||r instanceof u);return a&&!h.isBuffer(t)&&(t=function(t){return h.from(t)}(t)),"function"==typeof e&&(n=e,e=null),a?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof n&&(n=T),o.ending?function(t,e){var n=new v;_(t,n),i.nextTick(e,n)}(this,n):(a||function(t,e,n,r){var o;return null===n?o=new E:"string"==typeof n||e.objectMode||(o=new p("chunk",["string","Buffer"],n)),!o||(_(t,o),i.nextTick(r,o),!1)}(this,o,t,n))&&(o.pendingcb++,s=function(t,e,n,r,i,o){if(!n){var s=function(t,e,n){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,n)),e}(e,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=e.objectMode?1:r.length;e.length+=a;var c=e.length-1))throw new w(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(L.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(L.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),L.prototype._write=function(t,e,n){n(new y("_write()"))},L.prototype._writev=null,L.prototype.end=function(t,e,n){var r=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||function(t,e,n){e.ending=!0,I(t,e),n&&(e.finished?i.nextTick(n):t.once("finish",n)),e.ended=!0,t.writable=!1}(this,r,n),this},Object.defineProperty(L.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(L.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),L.prototype.destroy=l.destroy,L.prototype._undestroy=l.undestroy,L.prototype._destroy=function(t,e){e(t)}},5850:(t,e,n)=>{"use strict";var r,i=n(4155);function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var s=n(8610),a=Symbol("lastResolve"),c=Symbol("lastReject"),h=Symbol("error"),u=Symbol("ended"),l=Symbol("lastPromise"),f=Symbol("handlePromise"),d=Symbol("stream");function p(t,e){return{value:t,done:e}}function y(t){var e=t[a];if(null!==e){var n=t[d].read();null!==n&&(t[l]=null,t[a]=null,t[c]=null,e(p(n,!1)))}}function g(t){i.nextTick(y,t)}var b=Object.getPrototypeOf((function(){})),m=Object.setPrototypeOf((o(r={get stream(){return this[d]},next:function(){var t=this,e=this[h];if(null!==e)return Promise.reject(e);if(this[u])return Promise.resolve(p(void 0,!0));if(this[d].destroyed)return new Promise((function(e,n){i.nextTick((function(){t[h]?n(t[h]):e(p(void 0,!0))}))}));var n,r=this[l];if(r)n=new Promise(function(t,e){return function(n,r){t.then((function(){e[u]?n(p(void 0,!0)):e[f](n,r)}),r)}}(r,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(p(o,!1));n=new Promise(this[f])}return this[l]=n,n}},Symbol.asyncIterator,(function(){return this})),o(r,"return",(function(){var t=this;return new Promise((function(e,n){t[d].destroy(null,(function(t){t?n(t):e(p(void 0,!0))}))}))})),r),b);t.exports=function(t){var e,n=Object.create(m,(o(e={},d,{value:t,writable:!0}),o(e,a,{value:null,writable:!0}),o(e,c,{value:null,writable:!0}),o(e,h,{value:null,writable:!0}),o(e,u,{value:t._readableState.endEmitted,writable:!0}),o(e,f,{value:function(t,e){var r=n[d].read();r?(n[l]=null,n[a]=null,n[c]=null,t(p(r,!1))):(n[a]=t,n[c]=e)},writable:!0}),e));return n[l]=null,s(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=n[c];return null!==e&&(n[l]=null,n[a]=null,n[c]=null,e(t)),void(n[h]=t)}var r=n[a];null!==r&&(n[l]=null,n[a]=null,n[c]=null,r(p(void 0,!0))),n[u]=!0})),t.on("readable",g.bind(null,n)),n}},7327:(t,e,n)=>{"use strict";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){for(var n=0;n0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n}},{key:"concat",value:function(t){if(0===this.length)return s.alloc(0);for(var e,n,r,i=s.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,n=i,r=a,s.prototype.copy.call(e,n,r),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var n;return ti.length?i.length:t;if(o===i.length?r+=i:r+=i.slice(0,t),0==(t-=o)){o===i.length?(++n,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(t){var e=s.allocUnsafe(t),n=this.head,r=1;for(n.data.copy(e),t-=n.data.length;n=n.next;){var i=n.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,e}},{key:c,value:function(t,e){return a(this,function(t){for(var e=1;e{"use strict";var r=n(4155);function i(t,e){s(t,e),o(t)}function o(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function s(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var n=this,a=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return a||c?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,r.nextTick(s,this,t)):r.nextTick(s,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?n._writableState?n._writableState.errorEmitted?r.nextTick(o,n):(n._writableState.errorEmitted=!0,r.nextTick(i,n,t)):r.nextTick(i,n,t):e?(r.nextTick(o,n),e(t)):r.nextTick(o,n)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var n=t._readableState,r=t._writableState;n&&n.autoDestroy||r&&r.autoDestroy?t.destroy(e):t.emit("error",e)}}},8610:(t,e,n)=>{"use strict";var r=n(4281).q.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,n,o){if("function"==typeof n)return t(e,null,n);n||(n={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var n=arguments.length,r=new Array(n),i=0;i{t.exports=function(){throw new Error("Readable.from is not available in the browser")}},9946:(t,e,n)=>{"use strict";var r,i=n(4281).q,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(t){if(t)throw t}function c(t,e,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var a=!1;t.on("close",(function(){a=!0})),void 0===r&&(r=n(8610)),r(t,{readable:e,writable:i},(function(t){if(t)return o(t);a=!0,o()}));var c=!1;return function(e){if(!a&&!c)return c=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new s("pipe"))}}function h(t){t()}function u(t,e){return t.pipe(e)}function l(t){return t.length?"function"!=typeof t[t.length-1]?a:t.pop():a}t.exports=function(){for(var t=arguments.length,e=new Array(t),n=0;n0,(function(t){r||(r=t),t&&s.forEach(h),o||(s.forEach(h),i(r))}))}));return e.reduce(u)}},2457:(t,e,n)=>{"use strict";var r=n(4281).q.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,n,i){var o=function(t,e,n){return null!=t.highWaterMark?t.highWaterMark:e?t[n]:null}(e,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new r(i?n:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},2503:(t,e,n)=>{t.exports=n(7187).EventEmitter},8473:(t,e,n)=>{(e=t.exports=n(9481)).Stream=e,e.Readable=e,e.Writable=n(4229),e.Duplex=n(6753),e.Transform=n(4605),e.PassThrough=n(2725),e.finished=n(8610),e.pipeline=n(9946)},9967:(t,e,n)=>{t.exports=function(t,e,n){if("number"!=typeof e)throw new Error("second argument must be a Number");let i,o,s,a,c,h,u=!0;function l(t){function e(){n&&n(t,i),n=null}u?r(e):e()}function f(e,n,r){if(i[e]=r,n&&(c=!0),0==--s||n)l(n);else if(!c&&h{"use strict";var r=n(396).Buffer,i=r.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=c,this.end=h,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=u,this.end=l,e=3;break;default:return this.write=f,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function c(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function h(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function u(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function f(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}e.s=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0?(i>0&&(t.lastNeed=i-1),i):--r=0?(i>0&&(t.lastNeed=i-2),i):--r=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},396:(t,e,n)=>{var r=n(8764),i=r.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function s(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(o(r,e),e.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},s.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},971:t=>{t.exports=function(t,e){e=Object.assign({},{ngramLengths:[1]},e);const n=t.reduce(((t,n,r,i)=>(e.ngramLengths.forEach((e=>{var o=i.slice(r,r+e);o.length===e&&(n=JSON.stringify(o),t[n]=t[n]||[],t[n].push(r))})),t)),{});return Object.keys(n).map((t=>({term:JSON.parse(t),positions:n[t]}))).sort(((t,e)=>t.term[0]>e.term[0]))}},3692:t=>{var e=t.exports=function(t){return new n(t)};function n(t){this.value=t}function r(t,e,n){var r=[],s=[],u=!0;return function t(l){var f=n?i(l):l,d={},p=!0,y={node:f,node_:l,path:[].concat(r),parent:s[s.length-1],parents:s,key:r.slice(-1)[0],isRoot:0===r.length,level:r.length,circular:null,update:function(t,e){y.isRoot||(y.parent.node[y.key]=t),y.node=t,e&&(p=!1)},delete:function(t){delete y.parent.node[y.key],t&&(p=!1)},remove:function(t){a(y.parent.node)?y.parent.node.splice(y.key,1):delete y.parent.node[y.key],t&&(p=!1)},keys:null,before:function(t){d.before=t},after:function(t){d.after=t},pre:function(t){d.pre=t},post:function(t){d.post=t},stop:function(){u=!1},block:function(){p=!1}};if(!u)return y;function g(){if("object"==typeof y.node&&null!==y.node){y.keys&&y.node_===y.node||(y.keys=o(y.node)),y.isLeaf=0==y.keys.length;for(var t=0;t{function r(t){try{if(!n.g.localStorage)return!1}catch(t){return!1}var e=n.g.localStorage[t];return null!=e&&"true"===String(e).toLowerCase()}t.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}},1861:t=>{t.exports=t=>{const e=t=>"string"==typeof t||t instanceof String,n=(r,i)=>new Promise((async o=>{return null===r?o(JSON.stringify([null,"1.00"])):(s=r)&&0===Object.keys(s).length&&Object.getPrototypeOf(s)===Object.prototype?o(JSON.stringify([[],"1.00"])):Number.isInteger(r)?o(JSON.stringify([r,r])):e(r)?o(t.tokenizer(r,i,t)):(t=>"object"==typeof t&&null!==t&&!Array.isArray(t))(r)?o((a=r,new Promise((async e=>{const r={};for(const e in a)r[e]=await n(a[e],e,t);return e(r)})))):(t=>Array.isArray(t))(r)?o((c=r,Promise.all(c.map(n)))):o(r);var s,a,c})),r=async r=>new Promise((async i=>{e(r)&&(r={body:r}),Object.prototype.hasOwnProperty.call(r,"_id")||(r._id=t.idGenerator.next().value);const o={};for(const t in r)o[t]="_id"!==t?await n(r[t],t):r[t];return i(o)}));return{processDocuments:t=>Promise.all(t.map(r))}}},2225:(t,e,n)=>{const r=n(9203),i=n(7155),o=n(9593),s=n(6291),a=n(6761),c=n(4147),h=t=>new Promise((async e=>{const r=new o({max:1e3}),c=new((await Promise.resolve().then(n.bind(n,5613))).default)({concurrency:1}),h=a(t,r,c),u=s(t,r);return h._INCREMENT_DOC_COUNT(0).then((()=>e({_AND:t.fii.AND,_BUCKET:t.fii.BUCKET,_GET:t.fii.GET,_NOT:t.fii.NOT,_OR:t.fii.OR,_CACHE:r,_PAGE:u.PAGE,_SCORE:u.SCORE,_SEARCH:u.SEARCH,_SORT:u.SORT,DELETE:h.DELETE,FLUSH:h.FLUSH,IMPORT:h.IMPORT,PUT:h.PUT,PUT_RAW:h.PUT_RAW,TOKENIZATION_PIPELINE_STAGES:i,ALL_DOCUMENTS:u.ALL_DOCUMENTS,BUCKETS:t.fii.BUCKETS,CREATED:t.fii.CREATED,DICTIONARY:u.DICTIONARY,DISTINCT:u.DISTINCT,DOCUMENTS:u.DOCUMENTS,DOCUMENT_COUNT:u.DOCUMENT_COUNT,EXPORT:t.fii.EXPORT,FACETS:u.FACETS,FIELDS:t.fii.FIELDS,INDEX:t.fii,LAST_UPDATED:t.fii.LAST_UPDATED,MAX:t.fii.MAX,MIN:t.fii.MIN,QUERY:u.QUERY,SEARCH:u.SEARCH})))}));t.exports=t=>((t={})=>new Promise(((e,n)=>(t=Object.assign({cacheLength:1e3,caseSensitive:!1,docExistsSpace:"DOC_RAW",idGenerator:function*(){let t=0;for(;;)yield Date.now()+"-"+t++}(),skipFields:[],ngrams:{},replace:{},storeRawDocs:!0,stopwords:[],storeVectors:!0,tokenAppend:"#",tokenSplitRegex:/[\p{L}\d]+/gu,tokenizer:i.tokenizer},t),r(t).then((n=>e(Object.assign({fii:n},t))))))))(t).then(h).then((t=>(t=>new Promise(((e,n)=>{const r=["CREATED_WITH"],i="search-index@"+c.version;return t.INDEX.STORE.get(r).then((t=>i===t?e():n(new Error("This index was created with "+t+", you are running "+i)))).catch((n=>t.INDEX.STORE.put(r,i).then(e)))})))(t).then((()=>t))))},6291:(t,e,n)=>{const{EntryStream:r}=n(6741);t.exports=(t,e)=>{const n=e=>new Promise(((n,i)=>{const o=[];new r(t.fii.STORE,{gte:["DOC_RAW",null],lte:["DOC_RAW",void 0],limit:e}).on("data",(t=>o.push({_id:t.value._id,_doc:t.value}))).on("end",(()=>n(o)))})),i=(...e)=>e.length?Promise.all(e.map((e=>t.fii.STORE.get(["DOC_RAW",e]).catch((t=>null))))):n(),o=(...e)=>t.fii.DISTINCT(...e).then((t=>[...t.reduce(((t,e)=>t.add(JSON.stringify(Object.assign(e,{VALUE:e.VALUE})))),new Set)].map(JSON.parse))),s=(...e)=>t.fii.FACETS(...e).then((t=>[...t.reduce(((t,e)=>t.add(JSON.stringify(Object.assign(e,{VALUE:e.VALUE})))),new Set)].map(JSON.parse))),a=(t,e)=>{const n=(e=Object.assign({NUMBER:0,SIZE:20},e||{})).NUMBER*e.SIZE,r=n+e.SIZE||void 0;return t.slice(n,r)},c=(t,e={})=>{const n=t=>!e.FIELDS||e.FIELDS.includes(t.FIELD);return"TFIDF"===(e=Object.assign({TYPE:"TFIDF"},e)).TYPE?u().then((e=>t.map(((t,r,i)=>{const o=Math.log((e+1)/i.length);return t._score=+t._match.filter(n).reduce(((t,e)=>t+o*+e.SCORE),0).toFixed(2),t})))):"PRODUCT"===e.TYPE?new Promise((e=>e(t.map((t=>(t._score=+t._match.filter(n).reduce(((t,e)=>t*+e.SCORE),1).toFixed(2),t)))))):"CONCAT"===e.TYPE?new Promise((e=>e(t.map((t=>(t._score=t._match.filter(n).reduce(((t,e)=>t+e.SCORE),""),t)))))):"SUM"===e.TYPE?new Promise((e=>e(t.map((t=>(t._score=+t._match.filter(n).reduce(((t,e)=>t+ +e.SCORE),0).toFixed(2),t)))))):"VALUE"===e.TYPE?new Promise((e=>e(t.map((t=>(t._score=t._match.filter(n).reduce(((t,e)=>t+e.VALUE),""),t)))))):void 0},h=(t,e)=>(e=Object.assign({DIRECTION:"DESCENDING",TYPE:"NUMERIC"},e||{}),t.sort(((t,e)=>t._ide._id?1:0)).sort({NUMERIC:{DESCENDING:(t,e)=>+e._score-+t._score,ASCENDING:(t,e)=>+t._score-+e._score},ALPHABETIC:{DESCENDING:(t,e)=>t._scoree._score?-1:0,ASCENDING:(t,e)=>t._scoree._score?1:0}}[e.TYPE][e.DIRECTION])),u=()=>t.fii.STORE.get(["DOCUMENT_COUNT"]),l=(e,r={})=>{const o=e=>"string"==typeof e||"number"==typeof e?t.fii.GET(e,r.PIPELINE):e.FIELD||e.VALUE?t.fii.GET(e):e.AND?t.fii.AND(e.AND.map(o),r.PIPELINE):e.GET?t.fii.GET(e.GET,r.PIPELINE):e.NOT?t.fii.NOT(o(e.NOT.INCLUDE),o(e.NOT.EXCLUDE)):e.OR?t.fii.OR(e.OR.map(o),r.PIPELINE):e.ALL_DOCUMENTS?n(e.ALL_DOCUMENTS):void 0;return o(e).then((t=>t.RESULT?Object.assign(t,{RESULT_LENGTH:t.RESULT.length}):{RESULT:t,RESULT_LENGTH:t.length})).then((e=>r.BUCKETS?t.fii.BUCKETS(...r.BUCKETS).then((n=>Object.assign(e,{BUCKETS:t.fii.AGGREGATION_FILTER(n,e.RESULT)}))):e)).then((n=>r.FACETS?n.RESULT.length?e.ALL_DOCUMENTS?s(...r.FACETS).then((t=>Object.assign(n,{FACETS:t}))):s(...r.FACETS).then((e=>Object.assign(n,{FACETS:t.fii.AGGREGATION_FILTER(e,n.RESULT)}))):Object.assign(n,{FACETS:[]}):n)).then((t=>{return r.WEIGHT?Object.assign({RESULT:(e=t.RESULT,n=r.WEIGHT,e.map((t=>(t._match=t._match.map((t=>(n.forEach((e=>{let n=!1;e.FIELD&&e.VALUE?e.FIELD===t.FIELD&&e.VALUE===t.VALUE&&(n=!0):e.FIELD?e.FIELD===t.FIELD&&(n=!0):e.VALUE&&e.VALUE===t.VALUE&&(n=!0),n&&(t.SCORE=(e.WEIGHT*+t.SCORE).toFixed(2))})),t))),t))))},t):t;var e,n})).then((t=>r.SCORE?c(t.RESULT,r.SCORE).then((e=>Object.assign(t,{RESULT:e}))):t)).then((t=>Object.assign(t,r.SORT?{RESULT:h(t.RESULT,r.SORT)}:{}))).then((t=>Object.assign(t,r.PAGE?{RESULT:a(t.RESULT,r.PAGE)}:{}))).then((t=>r.DOCUMENTS?i(...t.RESULT.map((t=>t._id))).then((e=>Object.assign(t,{RESULT:t.RESULT.map(((t,n)=>Object.assign(t,{_doc:e[n]})))}))):t))},f=(t,n)=>new Promise((r=>(n=JSON.stringify(n),e.has(n)?r(e.get(n)):t.then((t=>e.set(n,t))).then((()=>r(e.get(n)))))));return{ALL_DOCUMENTS:n,DICTIONARY:t=>f((t=>o(t).then((t=>Array.from(t.reduce(((t,e)=>t.add(e.VALUE)),new Set)).sort(((t,e)=>(t+"").localeCompare(e+"",void 0,{numeric:!0,sensitivity:"base"}))))))(t),{DICTIONARY:t||null}),DISTINCT:o,DOCUMENTS:(...t)=>f(i(...t),{DOCUMENTS:t}),DOCUMENT_COUNT:u,FACETS:s,PAGE:a,QUERY:(t,e)=>f(l(t,e),{QUERY:[t,e]}),SCORE:c,SEARCH:(t,e)=>f(((t,e)=>l({AND:[...t]},Object.assign({SCORE:{TYPE:"TFIDF"},SORT:!0},e)))(t,e),{SEARCH:[t,e]}),SORT:h}}},7155:(t,e,n)=>{const r=n(971),{ngraminator:i}=n(6349),o=([t,e,n])=>Promise.resolve([t.match(n.tokenSplitRegex)||[],e,n]),s=([t,e,n])=>[n.skipFields.includes(e)?[]:t,e,n],a=([t,e,n])=>Promise.resolve([t.map((t=>n.caseSensitive?t:t.toLowerCase())),e,n]),c=([t,e,n])=>{const{fields:r,values:i}=n.replace,o=()=>t.reduce(((t,e)=>[e,...t,...i[e]||[]]),[]);return i?r?r.includes(e)?Promise.resolve([o(),e,n]):Promise.resolve([t,e,n]):Promise.resolve([o(),e,n]):Promise.resolve([t,e,n])},h=([t,e,n])=>{let{fields:r,lengths:o,join:s=" "}=n.ngrams;return r||(r=[e]),o&&r.includes(e)?[i(t.filter((t=>null!==t)),o).map((t=>t.join(s))),e,n]:Promise.resolve([t,e,n])},u=([t,e,n])=>[t.filter((t=>!n.stopwords.includes(t.toLowerCase()))),e,n],l=([t,e,n])=>{const i=r(t),o=i.reduce(((t,e)=>Math.max(e.positions.length,t)),0);return Promise.resolve([i.map((t=>JSON.stringify([t.term[0],(t.positions.length/o).toFixed(2)]))).sort(),e,n])};e.SPY=([t,e,n])=>(console.log("----------------"),console.log("field ->"),console.log(e),console.log("tokens ->"),console.log(t),console.log("----------------"),Promise.resolve([t,e,n])),e.tokenizer=(t,e,n)=>o([t,e,n]).then(s).then(a).then(c).then(h).then(u).then(l).then((([t,e,n])=>t)),e.SPLIT=o,e.SKIP=s,e.LOWACASE=a,e.REPLACE=c,e.NGRAMS=h,e.STOPWORDS=u,e.SCORE_TERM_FREQUENCY=l},6761:(t,e,n)=>{const r=n(1861);t.exports=(t,e,n)=>{const i=e=>t.fii.STORE.get(["DOCUMENT_COUNT"]).then((n=>t.fii.STORE.put(["DOCUMENT_COUNT"],+n+e))).catch((n=>t.fii.STORE.put(["DOCUMENT_COUNT"],e))),o=(n,r,i)=>(e.clear(),Promise.all(n.map(((e,n)=>t.fii.STORE.put(["DOC_RAW",r[n]],i?{}:e)))).then((t=>n.map(((t,e)=>({_id:r[e],status:"OK",operation:"_PUT_RAW"}))))));return{DELETE:(...n)=>{return r=n,t.fii.DELETE(r).then((n=>{e.clear();const r=n.filter((t=>"DELETED"===t.status));return Promise.all([Promise.all(r.map((e=>t.fii.STORE.del(["DOC_RAW",e._id])))),(i=r.length,t.fii.STORE.get(["DOCUMENT_COUNT"]).then((e=>t.fii.STORE.put(["DOCUMENT_COUNT"],+e-i))))]).then((()=>n));var i}));var r},FLUSH:()=>t.fii.STORE.clear().then((()=>{e.clear();const n=Date.now();return t.fii.STORE.batch([{type:"put",key:["~CREATED"],value:n},{type:"put",key:["~LAST_UPDATED"],value:n},{type:"put",key:["DOCUMENT_COUNT"],value:0}])})).then((()=>!0)),IMPORT:n=>(e.clear(),Promise.resolve(t.fii.IMPORT(n))),PUT:(s,a)=>n.add((()=>((n,s)=>(e.clear(),s=Object.assign(t,s),r(t).processDocuments(n).then((e=>t.fii.PUT(e,s).then((e=>Promise.all([o(n,e.map((t=>t._id)),!t.storeRawDocs),i(e.filter((t=>"CREATED"===t.status)).length)]).then((()=>e))))))))(s,a))),PUT_RAW:o,_INCREMENT_DOC_COUNT:i}}},2361:()=>{},4616:()=>{},5613:(t,e,n)=>{"use strict";n.r(e),n.d(e,{AbortError:()=>z,default:()=>W});var r=n(6729);class i extends Error{constructor(t){super(t),this.name="TimeoutError"}}class o extends Error{constructor(t){super(),this.name="AbortError",this.message=t}}const s=t=>void 0===globalThis.DOMException?new o(t):new DOMException(t),a=t=>{const e=void 0===t.reason?s("This operation was aborted."):t.reason;return e instanceof Error?e:s(e)};var c,h=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)};class u{constructor(){c.set(this,[])}enqueue(t,e){const n={priority:(e={priority:0,...e}).priority,run:t};if(this.size&&h(this,c,"f")[this.size-1].priority>=e.priority)return void h(this,c,"f").push(n);const r=function(t,e,n){let r=0,i=t.length;for(;i>0;){const n=Math.trunc(i/2);let s=r+n;o=t[s],e.priority-o.priority<=0?(r=++s,i-=n+1):i=n}var o;return r}(h(this,c,"f"),n);h(this,c,"f").splice(r,0,n)}dequeue(){const t=h(this,c,"f").shift();return null==t?void 0:t.run}filter(t){return h(this,c,"f").filter((e=>e.priority===t.priority)).map((t=>t.run))}get size(){return h(this,c,"f").length}}c=new WeakMap;var l,f,d,p,y,g,b,m,E,v,w,_,T,S,L,A,O,k,x,R,I,C,N,D,U,P,M,B,j=function(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n},F=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)};const V=()=>{},G=new i;class z extends Error{}class W extends r{constructor(t){var e,n,r,i;if(super(),l.add(this),f.set(this,void 0),d.set(this,void 0),p.set(this,0),y.set(this,void 0),g.set(this,void 0),b.set(this,0),m.set(this,void 0),E.set(this,void 0),v.set(this,void 0),w.set(this,void 0),_.set(this,0),T.set(this,void 0),S.set(this,void 0),L.set(this,V),A.set(this,V),O.set(this,void 0),k.set(this,void 0),!("number"==typeof(t={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:u,...t}).intervalCap&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${null!==(n=null===(e=t.intervalCap)||void 0===e?void 0:e.toString())&&void 0!==n?n:""}\` (${typeof t.intervalCap})`);if(void 0===t.interval||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${null!==(i=null===(r=t.interval)||void 0===r?void 0:r.toString())&&void 0!==i?i:""}\` (${typeof t.interval})`);j(this,f,t.carryoverConcurrencyCount,"f"),j(this,d,t.intervalCap===Number.POSITIVE_INFINITY||0===t.interval,"f"),j(this,y,t.intervalCap,"f"),j(this,g,t.interval,"f"),j(this,v,new t.queueClass,"f"),j(this,w,t.queueClass,"f"),this.concurrency=t.concurrency,j(this,O,t.timeout,"f"),j(this,k,!0===t.throwOnTimeout,"f"),j(this,S,!1===t.autoStart,"f")}get concurrency(){return F(this,T,"f")}set concurrency(t){if(!("number"==typeof t&&t>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);j(this,T,t,"f"),F(this,l,"m",B).call(this)}async add(t,e={}){return new Promise(((n,r)=>{F(this,v,"f").enqueue((async()=>{var i,o,s;j(this,_,(o=F(this,_,"f"),++o),"f"),j(this,p,(s=F(this,p,"f"),++s),"f");try{if(null===(i=e.signal)||void 0===i?void 0:i.aborted)return void r(new z("The task was aborted."));const o=void 0===F(this,O,"f")&&void 0===e.timeout?t({signal:e.signal}):function(t,e,n,r){let i;const o=new Promise(((o,s)=>{if("number"!=typeof e||1!==Math.sign(e))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${e}\``);if(e!==Number.POSITIVE_INFINITY){if((r={customTimers:{setTimeout,clearTimeout},...r}).signal){const{signal:t}=r;t.aborted&&s(a(t)),t.addEventListener("abort",(()=>{s(a(t))}))}i=r.customTimers.setTimeout.call(void 0,(()=>{try{o(n())}catch(t){s(t)}}),e),(async()=>{try{o(await t)}catch(t){s(t)}finally{r.customTimers.clearTimeout.call(void 0,i)}})()}else o(t)}));return o.clear=()=>{clearTimeout(i),i=void 0},o}(Promise.resolve(t({signal:e.signal})),void 0===e.timeout?F(this,O,"f"):e.timeout,(()=>{(void 0===e.throwOnTimeout?F(this,k,"f"):e.throwOnTimeout)&&r(G)})),s=await o;n(s),this.emit("completed",s)}catch(t){r(t),this.emit("error",t)}F(this,l,"m",I).call(this)}),e),F(this,l,"m",U).call(this),this.emit("add")}))}async addAll(t,e){return Promise.all(t.map((async t=>this.add(t,e))))}start(){return F(this,S,"f")?(j(this,S,!1,"f"),F(this,l,"m",B).call(this),this):this}pause(){j(this,S,!0,"f")}clear(){j(this,v,new(F(this,w,"f")),"f")}async onEmpty(){if(0!==F(this,v,"f").size)return new Promise((t=>{const e=F(this,L,"f");j(this,L,(()=>{e(),t()}),"f")}))}async onSizeLessThan(t){if(!(F(this,v,"f").size{const n=()=>{F(this,v,"f").size{const e=F(this,A,"f");j(this,A,(()=>{e(),t()}),"f")}))}get size(){return F(this,v,"f").size}sizeBy(t){return F(this,v,"f").filter(t).length}get pending(){return F(this,_,"f")}get isPaused(){return F(this,S,"f")}get timeout(){return F(this,O,"f")}set timeout(t){j(this,O,t,"f")}}f=new WeakMap,d=new WeakMap,p=new WeakMap,y=new WeakMap,g=new WeakMap,b=new WeakMap,m=new WeakMap,E=new WeakMap,v=new WeakMap,w=new WeakMap,_=new WeakMap,T=new WeakMap,S=new WeakMap,L=new WeakMap,A=new WeakMap,O=new WeakMap,k=new WeakMap,l=new WeakSet,x=function(){return F(this,d,"f")||F(this,p,"f"){F(this,l,"m",N).call(this)}),e),"f"),!0;j(this,p,F(this,f,"f")?F(this,_,"f"):0,"f")}return!1},U=function(){if(0===F(this,v,"f").size)return F(this,m,"f")&&clearInterval(F(this,m,"f")),j(this,m,void 0,"f"),F(this,l,"m",C).call(this),!1;if(!F(this,S,"f")){const t=!F(this,l,"m",D).call(this);if(F(this,l,"a",x)&&F(this,l,"a",R)){const e=F(this,v,"f").dequeue();return!!e&&(this.emit("active"),e(),t&&F(this,l,"m",P).call(this),!0)}}return!1},P=function(){F(this,d,"f")||void 0!==F(this,m,"f")||(j(this,m,setInterval((()=>{F(this,l,"m",M).call(this)}),F(this,g,"f")),"f"),j(this,b,Date.now()+F(this,g,"f"),"f"))},M=function(){0===F(this,p,"f")&&0===F(this,_,"f")&&F(this,m,"f")&&(clearInterval(F(this,m,"f")),j(this,m,void 0,"f")),j(this,p,F(this,f,"f")?F(this,_,"f"):0,"f"),F(this,l,"m",B).call(this)},B=function(){for(;F(this,l,"m",U).call(this););}},4147:t=>{"use strict";t.exports=JSON.parse('{"name":"search-index","version":"3.3.0","description":"A network resilient, persistent full-text search library for the browser and Node.js","keywords":["search","elasticsearch","elastic","lunr.js","flexsearch","norch","solr"],"engines":{"node":">=12"},"main":"src/node.js","browser":"src/browser.js","files":["dist","src"],"directories":{"lib":"src"},"scripts":{"build":"npm run empty-sandbox && rm -rf ./dist/* && webpack && cp dist/search-index-$npm_package_version.js dist/search-index.js","demo-export":"node demo/generate-index/export.js","demo-fetch":"node demo/generate-index/fetch.js","demo-process":"node demo/generate-index/process.js","demo-rebuild":"npm run demo-fetch && npm run demo-process && npm run demo-export && npm run demo-link-lib","demo-start":"http-server -c-1 demo & open-cli http://127.0.0.1:8080","demo-link-lib":"cd demo/lib && ln -sf ../../dist/search-index.js && cd ../../","empty-sandbox":"rm -rf fii && rm -rf test/sandbox && mkdir test/sandbox","lint":"standard --fix test/src/* src/* demo/src/* demo/generate-index/*.js","test":"npm run empty-sandbox && npm run test-node && npm run test-browser && npm run lint","test-browser":"npm run build && cat test/sandbox/browser-tests.js | tape-run","test-node":"npm run empty-sandbox && tape test/src/*-test.js","toc":"doctoc docs/API.md --title \'# API Documentation for search-index\' && doctoc docs/FAQ.md --title \'# FAQ\'"},"repository":{"type":"git","url":"git+https://github.com/fergiemcdowall/search-index.git"},"author":"Fergus McDowall","license":"MIT","bugs":{"url":"https://github.com/fergiemcdowall/search-index/issues"},"homepage":"https://fergiemcdowall.github.io/search-index/","devDependencies":{"assert":"^2.0.0","doctoc":"^2.2.0","fuzzyset":"1.0.5","http-server":"14.1.0","memory-level":"^1.0.0","open-cli":"^7.0.1","os-browserify":"^0.3.0","path":"^0.12.7","path-browserify":"^1.0.1","process":"^0.11.10","standard":"^17.0.0","stemmer":"^1.0.5","stopword":"^2.0.2","stream-browserify":"^3.0.0","tape":"^5.5.3","tape-run":"^10.0.0","webpack":"^5.72.0","webpack-cli":"^4.9.2","world-bank-dataset":"^1.0.0"},"dependencies":{"browser-level":"^1.0.1","classic-level":"^1.2.0","fergies-inverted-index":"^10.1.0","level-read-stream":"^1.1.0","lru-cache":"^7.9.0","ngraminator":"^3.0.1","p-queue":"^7.2.0","term-vector":"^1.0.0"}}')}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={exports:{}};return t[r].call(o.exports,o,o.exports,n),o.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r=n(2225);SearchIndex=r})(); \ No newline at end of file diff --git a/dist/search-index-3.3.0.js.LICENSE.txt b/dist/search-index-3.3.0.js.LICENSE.txt new file mode 100644 index 00000000..603d19e3 --- /dev/null +++ b/dist/search-index-3.3.0.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ + +/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ + +/*! queue-microtask. MIT License. Feross Aboukhadijeh */ + +/*! run-parallel-limit. MIT License. Feross Aboukhadijeh */ + +/*! safe-buffer. MIT License. Feross Aboukhadijeh */ diff --git a/dist/search-index-esm-3.3.0.js b/dist/search-index-esm-3.3.0.js new file mode 100644 index 00000000..9eae8e01 --- /dev/null +++ b/dist/search-index-esm-3.3.0.js @@ -0,0 +1,2 @@ +/*! For license information please see search-index-esm-3.3.0.js.LICENSE.txt */ +var t={9464:(t,e,n)=>{const{fromCallback:r}=n(6957),i=n(4473),{getCallback:o,getOptions:s}=n(2520),a=Symbol("promise"),h=Symbol("status"),c=Symbol("operations"),u=Symbol("finishClose"),l=Symbol("closeCallbacks");e.AbstractChainedBatch=class{constructor(t){if("object"!=typeof t||null===t)throw new TypeError("The first argument must be an abstract-level database, received "+(null===t?"null":typeof t));this[c]=[],this[l]=[],this[h]="open",this[u]=this[u].bind(this),this.db=t,this.db.attachResource(this),this.nextTick=t.nextTick}get length(){return this[c].length}put(t,e,n){if("open"!==this[h])throw new i("Batch is not open: cannot call put() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});const r=this.db._checkKey(t)||this.db._checkValue(e);if(r)throw r;const o=n&&null!=n.sublevel?n.sublevel:this.db,s=n,a=o.keyEncoding(n&&n.keyEncoding),u=o.valueEncoding(n&&n.valueEncoding),l=a.format;n={...n,keyEncoding:l,valueEncoding:u.format},o!==this.db&&(n.sublevel=null);const f=o.prefixKey(a.encode(t),l),d=u.encode(e);return this._put(f,d,n),this[c].push({...s,type:"put",key:t,value:e}),this}_put(t,e,n){}del(t,e){if("open"!==this[h])throw new i("Batch is not open: cannot call del() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});const n=this.db._checkKey(t);if(n)throw n;const r=e&&null!=e.sublevel?e.sublevel:this.db,o=e,s=r.keyEncoding(e&&e.keyEncoding),a=s.format;return e={...e,keyEncoding:a},r!==this.db&&(e.sublevel=null),this._del(r.prefixKey(s.encode(t),a),e),this[c].push({...o,type:"del",key:t}),this}_del(t,e){}clear(){if("open"!==this[h])throw new i("Batch is not open: cannot call clear() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});return this._clear(),this[c]=[],this}_clear(){}write(t,e){return e=o(t,e),e=r(e,a),t=s(t),"open"!==this[h]?this.nextTick(e,new i("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"})):0===this.length?this.close(e):(this[h]="writing",this._write(t,(t=>{this[h]="closing",this[l].push((()=>e(t))),t||this.db.emit("batch",this[c]),this._close(this[u])}))),e[a]}_write(t,e){}close(t){return t=r(t,a),"closing"===this[h]?this[l].push(t):"closed"===this[h]?this.nextTick(t):(this[l].push(t),"writing"!==this[h]&&(this[h]="closing",this._close(this[u]))),t[a]}_close(t){this.nextTick(t)}[u](){this[h]="closed",this.db.detachResource(this);const t=this[l];this[l]=[];for(const e of t)e()}}},3961:(t,e,n)=>{const{fromCallback:r}=n(6957),i=n(4473),{getOptions:o,getCallback:s}=n(2520),a=Symbol("promise"),h=Symbol("callback"),c=Symbol("working"),u=Symbol("handleOne"),l=Symbol("handleMany"),f=Symbol("autoClose"),d=Symbol("finishWork"),p=Symbol("returnMany"),y=Symbol("closing"),g=Symbol("handleClose"),b=Symbol("closed"),m=Symbol("closeCallbacks"),E=Symbol("keyEncoding"),v=Symbol("valueEncoding"),w=Symbol("abortOnClose"),_=Symbol("legacy"),T=Symbol("keys"),S=Symbol("values"),L=Symbol("limit"),A=Symbol("count"),O=Object.freeze({}),k=()=>{};let x=!1;class R{constructor(t,e,n){if("object"!=typeof t||null===t)throw new TypeError("The first argument must be an abstract-level database, received "+(null===t?"null":typeof t));if("object"!=typeof e||null===e)throw new TypeError("The second argument must be an options object");this[b]=!1,this[m]=[],this[c]=!1,this[y]=!1,this[f]=!1,this[h]=null,this[u]=this[u].bind(this),this[l]=this[l].bind(this),this[g]=this[g].bind(this),this[E]=e[E],this[v]=e[v],this[_]=n,this[L]=Number.isInteger(e.limit)&&e.limit>=0?e.limit:1/0,this[A]=0,this[w]=!!e.abortOnClose,this.db=t,this.db.attachResource(this),this.nextTick=t.nextTick}get count(){return this[A]}get limit(){return this[L]}next(t){let e;if(void 0===t)e=new Promise(((e,n)=>{t=(t,r,i)=>{t?n(t):this[_]?void 0===r&&void 0===i?e():e([r,i]):e(r)}}));else if("function"!=typeof t)throw new TypeError("Callback must be a function");return this[y]?this.nextTick(t,new i("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[c]?this.nextTick(t,new i("Iterator is busy: cannot call next() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[c]=!0,this[h]=t,this[A]>=this[L]?this.nextTick(this[u],null):this._next(this[u])),e}_next(t){this.nextTick(t)}nextv(t,e,n){return n=s(e,n),n=r(n,a),e=o(e,O),Number.isInteger(t)?(this[y]?this.nextTick(n,new i("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[c]?this.nextTick(n,new i("Iterator is busy: cannot call nextv() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(t<1&&(t=1),this[L]<1/0&&(t=Math.min(t,this[L]-this[A])),this[c]=!0,this[h]=n,t<=0?this.nextTick(this[l],null,[]):this._nextv(t,e,this[l])),n[a]):(this.nextTick(n,new TypeError("The first argument 'size' must be an integer")),n[a])}_nextv(t,e,n){const r=[],i=(e,o,s)=>e?n(e):(this[_]?void 0===o&&void 0===s:void 0===o)?n(null,r):(r.push(this[_]?[o,s]:o),void(r.length===t?n(null,r):this._next(i)));this._next(i)}all(t,e){return e=s(t,e),e=r(e,a),t=o(t,O),this[y]?this.nextTick(e,new i("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[c]?this.nextTick(e,new i("Iterator is busy: cannot call all() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[c]=!0,this[h]=e,this[f]=!0,this[A]>=this[L]?this.nextTick(this[l],null,[]):this._all(t,this[l])),e[a]}_all(t,e){let n=this[A];const r=[],i=()=>{const t=this[L]<1/0?Math.min(1e3,this[L]-n):1e3;t<=0?this.nextTick(e,null,r):this._nextv(t,O,o)},o=(t,o)=>{t?e(t):0===o.length?e(null,r):(r.push.apply(r,o),n+=o.length,i())};i()}[d](){const t=this[h];return this[w]&&null===t?k:(this[c]=!1,this[h]=null,this[y]&&this._close(this[g]),t)}[p](t,e,n){this[f]?this.close(t.bind(null,e,n)):t(e,n)}seek(t,e){if(e=o(e,O),this[y]);else{if(this[c])throw new i("Iterator is busy: cannot call seek() until next() has completed",{code:"LEVEL_ITERATOR_BUSY"});{const n=this.db.keyEncoding(e.keyEncoding||this[E]),r=n.format;e.keyEncoding!==r&&(e={...e,keyEncoding:r});const i=this.db.prefixKey(n.encode(t),r);this._seek(i,e)}}}_seek(t,e){throw new i("Iterator does not support seek()",{code:"LEVEL_NOT_SUPPORTED"})}close(t){return t=r(t,a),this[b]?this.nextTick(t):this[y]?this[m].push(t):(this[y]=!0,this[m].push(t),this[c]?this[w]&&this[d]()(new i("Aborted on iterator close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this._close(this[g])),t[a]}_close(t){this.nextTick(t)}[g](){this[b]=!0,this.db.detachResource(this);const t=this[m];this[m]=[];for(const e of t)e()}async*[Symbol.asyncIterator](){try{let t;for(;void 0!==(t=await this.next());)yield t}finally{this[b]||await this.close()}}}class I extends R{constructor(t,e){super(t,e,!0),this[T]=!1!==e.keys,this[S]=!1!==e.values}[u](t,e,n){const r=this[d]();if(t)return r(t);try{e=this[T]&&void 0!==e?this[E].decode(e):void 0,n=this[S]&&void 0!==n?this[v].decode(n):void 0}catch(t){return r(new C("entry",t))}void 0===e&&void 0===n||this[A]++,r(null,e,n)}[l](t,e){const n=this[d]();if(t)return this[p](n,t);try{for(const t of e){const e=t[0],n=t[1];t[0]=this[T]&&void 0!==e?this[E].decode(e):void 0,t[1]=this[S]&&void 0!==n?this[v].decode(n):void 0}}catch(t){return this[p](n,new C("entries",t))}this[A]+=e.length,this[p](n,null,e)}end(t){return x||"undefined"==typeof console||(x=!0,console.warn(new i("The iterator.end() method was renamed to close() and end() is an alias that will be removed in a future version",{code:"LEVEL_LEGACY"}))),this.close(t)}}class C extends i{constructor(t,e){super(`Iterator could not decode ${t}`,{code:"LEVEL_DECODE_ERROR",cause:e})}}for(const t of["_ended property","_nexting property","_end method"])Object.defineProperty(I.prototype,t.split(" ")[0],{get(){throw new i(`The ${t} has been removed`,{code:"LEVEL_LEGACY"})},set(){throw new i(`The ${t} has been removed`,{code:"LEVEL_LEGACY"})}});I.keyEncoding=E,I.valueEncoding=v,e.AbstractIterator=I,e.AbstractKeyIterator=class extends R{constructor(t,e){super(t,e,!1)}[u](t,e){const n=this[d]();if(t)return n(t);try{e=void 0!==e?this[E].decode(e):void 0}catch(t){return n(new C("key",t))}void 0!==e&&this[A]++,n(null,e)}[l](t,e){const n=this[d]();if(t)return this[p](n,t);try{for(let t=0;t{const{supports:r}=n(3658),{Transcoder:i}=n(8499),{EventEmitter:o}=n(7187),{fromCallback:s}=n(6957),a=n(4473),{AbstractIterator:h}=n(3961),{DefaultKeyIterator:c,DefaultValueIterator:u}=n(5429),{DeferredIterator:l,DeferredKeyIterator:f,DeferredValueIterator:d}=n(593),{DefaultChainedBatch:p}=n(4765),{getCallback:y,getOptions:g}=n(2520),b=n(56),m=Symbol("promise"),E=Symbol("landed"),v=Symbol("resources"),w=Symbol("closeResources"),_=Symbol("operations"),T=Symbol("undefer"),S=Symbol("deferOpen"),L=Symbol("options"),A=Symbol("status"),O=Symbol("defaultOptions"),k=Symbol("transcoder"),x=Symbol("keyEncoding"),R=Symbol("valueEncoding"),I=()=>{};class C extends o{constructor(t,e){if(super(),"object"!=typeof t||null===t)throw new TypeError("The first argument 'manifest' must be an object");e=g(e);const{keyEncoding:n,valueEncoding:o,passive:s,...a}=e;this[v]=new Set,this[_]=[],this[S]=!0,this[L]=a,this[A]="opening",this.supports=r(t,{status:!0,promises:!0,clear:!0,getMany:!0,deferredOpen:!0,snapshots:!1!==t.snapshots,permanence:!1!==t.permanence,keyIterator:!0,valueIterator:!0,iteratorNextv:!0,iteratorAll:!0,encodings:t.encodings||{},events:Object.assign({},t.events,{opening:!0,open:!0,closing:!0,closed:!0,put:!0,del:!0,batch:!0,clear:!0})}),this[k]=new i(U(this)),this[x]=this[k].encoding(n||"utf8"),this[R]=this[k].encoding(o||"utf8");for(const t of this[k].encodings())this.supports.encodings[t.commonName]||(this.supports.encodings[t.commonName]=!0);this[O]={empty:Object.freeze({}),entry:Object.freeze({keyEncoding:this[x].commonName,valueEncoding:this[R].commonName}),key:Object.freeze({keyEncoding:this[x].commonName})},this.nextTick((()=>{this[S]&&this.open({passive:!1},I)}))}get status(){return this[A]}keyEncoding(t){return this[k].encoding(null!=t?t:this[x])}valueEncoding(t){return this[k].encoding(null!=t?t:this[R])}open(t,e){e=y(t,e),e=s(e,m),(t={...this[L],...g(t)}).createIfMissing=!1!==t.createIfMissing,t.errorIfExists=!!t.errorIfExists;const n=t=>{"closing"===this[A]||"opening"===this[A]?this.once(E,t?()=>n(t):n):"open"!==this[A]?e(new a("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN",cause:t})):e()};return t.passive?"opening"===this[A]?this.once(E,n):this.nextTick(n):"closed"===this[A]||this[S]?(this[S]=!1,this[A]="opening",this.emit("opening"),this._open(t,(t=>{if(t)return this[A]="closed",this[w]((()=>{this.emit(E),n(t)})),void this[T]();this[A]="open",this[T](),this.emit(E),"open"===this[A]&&this.emit("open"),"open"===this[A]&&this.emit("ready"),n()}))):"open"===this[A]?this.nextTick(n):this.once(E,(()=>this.open(t,e))),e[m]}_open(t,e){this.nextTick(e)}close(t){t=s(t,m);const e=n=>{"opening"===this[A]||"closing"===this[A]?this.once(E,n?e(n):e):"closed"!==this[A]?t(new a("Database is not closed",{code:"LEVEL_DATABASE_NOT_CLOSED",cause:n})):t()};if("open"===this[A]){this[A]="closing",this.emit("closing");const t=t=>{this[A]="open",this[T](),this.emit(E),e(t)};this[w]((()=>{this._close((n=>{if(n)return t(n);this[A]="closed",this[T](),this.emit(E),"closed"===this[A]&&this.emit("closed"),e()}))}))}else"closed"===this[A]?this.nextTick(e):this.once(E,(()=>this.close(t)));return t[m]}[w](t){if(0===this[v].size)return this.nextTick(t);let e=this[v].size,n=!0;const r=()=>{0==--e&&(n?this.nextTick(t):t())};for(const t of this[v])t.close(r);n=!1,this[v].clear()}_close(t){this.nextTick(t)}get(t,e,n){if(n=y(e,n),n=s(n,m),e=g(e,this[O].entry),"opening"===this[A])return this.defer((()=>this.get(t,e,n))),n[m];if(D(this,n))return n[m];const r=this._checkKey(t);if(r)return this.nextTick(n,r),n[m];const i=this.keyEncoding(e.keyEncoding),o=this.valueEncoding(e.valueEncoding),h=i.format,c=o.format;return e.keyEncoding===h&&e.valueEncoding===c||(e=Object.assign({},e,{keyEncoding:h,valueEncoding:c})),this._get(this.prefixKey(i.encode(t),h),e,((t,e)=>{if(t)return("LEVEL_NOT_FOUND"===t.code||t.notFound||/NotFound/i.test(t))&&(t.code||(t.code="LEVEL_NOT_FOUND"),t.notFound||(t.notFound=!0),t.status||(t.status=404)),n(t);try{e=o.decode(e)}catch(t){return n(new a("Could not decode value",{code:"LEVEL_DECODE_ERROR",cause:t}))}n(null,e)})),n[m]}_get(t,e,n){this.nextTick(n,new Error("NotFound"))}getMany(t,e,n){if(n=y(e,n),n=s(n,m),e=g(e,this[O].entry),"opening"===this[A])return this.defer((()=>this.getMany(t,e,n))),n[m];if(D(this,n))return n[m];if(!Array.isArray(t))return this.nextTick(n,new TypeError("The first argument 'keys' must be an array")),n[m];if(0===t.length)return this.nextTick(n,null,[]),n[m];const r=this.keyEncoding(e.keyEncoding),i=this.valueEncoding(e.valueEncoding),o=r.format,h=i.format;e.keyEncoding===o&&e.valueEncoding===h||(e=Object.assign({},e,{keyEncoding:o,valueEncoding:h}));const c=new Array(t.length);for(let e=0;e{if(t)return n(t);try{for(let t=0;tthis.put(t,e,n,r))),r[m];if(D(this,r))return r[m];const i=this._checkKey(t)||this._checkValue(e);if(i)return this.nextTick(r,i),r[m];const o=this.keyEncoding(n.keyEncoding),a=this.valueEncoding(n.valueEncoding),h=o.format,c=a.format;n.keyEncoding===h&&n.valueEncoding===c||(n=Object.assign({},n,{keyEncoding:h,valueEncoding:c}));const u=this.prefixKey(o.encode(t),h),l=a.encode(e);return this._put(u,l,n,(n=>{if(n)return r(n);this.emit("put",t,e),r()})),r[m]}_put(t,e,n,r){this.nextTick(r)}del(t,e,n){if(n=y(e,n),n=s(n,m),e=g(e,this[O].key),"opening"===this[A])return this.defer((()=>this.del(t,e,n))),n[m];if(D(this,n))return n[m];const r=this._checkKey(t);if(r)return this.nextTick(n,r),n[m];const i=this.keyEncoding(e.keyEncoding),o=i.format;return e.keyEncoding!==o&&(e=Object.assign({},e,{keyEncoding:o})),this._del(this.prefixKey(i.encode(t),o),e,(e=>{if(e)return n(e);this.emit("del",t),n()})),n[m]}_del(t,e,n){this.nextTick(n)}batch(t,e,n){if(!arguments.length){if("opening"===this[A])return new p(this);if("open"!==this[A])throw new a("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._chainedBatch()}if(n="function"==typeof t?t:y(e,n),n=s(n,m),e=g(e,this[O].empty),"opening"===this[A])return this.defer((()=>this.batch(t,e,n))),n[m];if(D(this,n))return n[m];if(!Array.isArray(t))return this.nextTick(n,new TypeError("The first argument 'operations' must be an array")),n[m];if(0===t.length)return this.nextTick(n),n[m];const r=new Array(t.length),{keyEncoding:i,valueEncoding:o,...h}=e;for(let e=0;e{if(e)return n(e);this.emit("batch",t),n()})),n[m]}_batch(t,e,n){this.nextTick(n)}sublevel(t,e){return this._sublevel(t,N.defaults(e))}_sublevel(t,e){return new N(this,t,e)}prefixKey(t,e){return t}clear(t,e){if(e=y(t,e),e=s(e,m),t=g(t,this[O].empty),"opening"===this[A])return this.defer((()=>this.clear(t,e))),e[m];if(D(this,e))return e[m];const n=t,r=this.keyEncoding(t.keyEncoding);return(t=b(t,r)).keyEncoding=r.format,0===t.limit?this.nextTick(e):this._clear(t,(t=>{if(t)return e(t);this.emit("clear",n),e()})),e[m]}_clear(t,e){this.nextTick(e)}iterator(t){const e=this.keyEncoding(t&&t.keyEncoding),n=this.valueEncoding(t&&t.valueEncoding);if((t=b(t,e)).keys=!1!==t.keys,t.values=!1!==t.values,t[h.keyEncoding]=e,t[h.valueEncoding]=n,t.keyEncoding=e.format,t.valueEncoding=n.format,"opening"===this[A])return new l(this,t);if("open"!==this[A])throw new a("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._iterator(t)}_iterator(t){return new h(this,t)}keys(t){const e=this.keyEncoding(t&&t.keyEncoding),n=this.valueEncoding(t&&t.valueEncoding);if((t=b(t,e))[h.keyEncoding]=e,t[h.valueEncoding]=n,t.keyEncoding=e.format,t.valueEncoding=n.format,"opening"===this[A])return new f(this,t);if("open"!==this[A])throw new a("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._keys(t)}_keys(t){return new c(this,t)}values(t){const e=this.keyEncoding(t&&t.keyEncoding),n=this.valueEncoding(t&&t.valueEncoding);if((t=b(t,e))[h.keyEncoding]=e,t[h.valueEncoding]=n,t.keyEncoding=e.format,t.valueEncoding=n.format,"opening"===this[A])return new d(this,t);if("open"!==this[A])throw new a("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._values(t)}_values(t){return new u(this,t)}defer(t){if("function"!=typeof t)throw new TypeError("The first argument must be a function");this[_].push(t)}[T](){if(0===this[_].length)return;const t=this[_];this[_]=[];for(const e of t)e()}attachResource(t){if("object"!=typeof t||null===t||"function"!=typeof t.close)throw new TypeError("The first argument must be a resource object");this[v].add(t)}detachResource(t){this[v].delete(t)}_chainedBatch(){return new p(this)}_checkKey(t){if(null==t)return new a("Key cannot be null or undefined",{code:"LEVEL_INVALID_KEY"})}_checkValue(t){if(null==t)return new a("Value cannot be null or undefined",{code:"LEVEL_INVALID_VALUE"})}}C.prototype.nextTick=n(6909);const{AbstractSublevel:N}=n(9650)({AbstractLevel:C});e.AbstractLevel=C,e.AbstractSublevel=N;const D=function(t,e){return"open"!==t[A]&&(t.nextTick(e,new a("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"})),!0)},U=function(t){return Object.keys(t.supports.encodings).filter((e=>!!t.supports.encodings[e]))}},875:(t,e,n)=>{e.AbstractLevel=n(9071).AbstractLevel,e.AbstractSublevel=n(9071).AbstractSublevel,e.AbstractIterator=n(3961).AbstractIterator,e.AbstractKeyIterator=n(3961).AbstractKeyIterator,e.AbstractValueIterator=n(3961).AbstractValueIterator,e.AbstractChainedBatch=n(9464).AbstractChainedBatch},2970:(t,e,n)=>{const{AbstractIterator:r,AbstractKeyIterator:i,AbstractValueIterator:o}=n(3961),s=Symbol("unfix"),a=Symbol("iterator"),h=Symbol("handleOne"),c=Symbol("handleMany"),u=Symbol("callback");class l extends r{constructor(t,e,n,r){super(t,e),this[a]=n,this[s]=r,this[h]=this[h].bind(this),this[c]=this[c].bind(this),this[u]=null}[h](t,e,n){const r=this[u];if(t)return r(t);void 0!==e&&(e=this[s](e)),r(t,e,n)}[c](t,e){const n=this[u];if(t)return n(t);for(const t of e){const e=t[0];void 0!==e&&(t[0]=this[s](e))}n(t,e)}}class f extends i{constructor(t,e,n,r){super(t,e),this[a]=n,this[s]=r,this[h]=this[h].bind(this),this[c]=this[c].bind(this),this[u]=null}[h](t,e){const n=this[u];if(t)return n(t);void 0!==e&&(e=this[s](e)),n(t,e)}[c](t,e){const n=this[u];if(t)return n(t);for(let t=0;t{const r=n(4473),{Buffer:i}=n(8764)||{},{AbstractSublevelIterator:o,AbstractSublevelKeyIterator:s,AbstractSublevelValueIterator:a}=n(2970),h=Symbol("prefix"),c=Symbol("upperBound"),u=Symbol("prefixRange"),l=Symbol("parent"),f=Symbol("unfix"),d=new TextEncoder,p={separator:"!"};t.exports=function({AbstractLevel:t}){class e extends t{static defaults(t){if("string"==typeof t)throw new r("The subleveldown string shorthand for { separator } has been removed",{code:"LEVEL_LEGACY"});if(t&&t.open)throw new r("The subleveldown open option has been removed",{code:"LEVEL_LEGACY"});return null==t?p:t.separator?t:{...t,separator:"!"}}constructor(t,n,i){const{separator:o,manifest:s,...a}=e.defaults(i);n=E(n,o);const u=o.charCodeAt(0)+1,p=t[l]||t;if(!d.encode(n).every((t=>t>u&&t<127)))throw new r(`Prefix must use bytes > ${u} < 127`,{code:"LEVEL_INVALID_PREFIX"});super(y(p,s),a);const g=(t.prefix||"")+o+n+o,v=g.slice(0,-1)+String.fromCharCode(u);this[l]=p,this[h]=new b(g),this[c]=new b(v),this[f]=new m,this.nextTick=p.nextTick}prefixKey(t,e){if("utf8"===e)return this[h].utf8+t;if(0===t.byteLength)return this[h][e];if("view"===e){const e=this[h].view,n=new Uint8Array(e.byteLength+t.byteLength);return n.set(e,0),n.set(t,e.byteLength),n}{const e=this[h].buffer;return i.concat([e,t],e.byteLength+t.byteLength)}}[u](t,e){void 0!==t.gte?t.gte=this.prefixKey(t.gte,e):void 0!==t.gt?t.gt=this.prefixKey(t.gt,e):t.gte=this[h][e],void 0!==t.lte?t.lte=this.prefixKey(t.lte,e):void 0!==t.lt?t.lt=this.prefixKey(t.lt,e):t.lte=this[c][e]}get prefix(){return this[h].utf8}get db(){return this[l]}_open(t,e){this[l].open({passive:!0},e)}_put(t,e,n,r){this[l].put(t,e,n,r)}_get(t,e,n){this[l].get(t,e,n)}_getMany(t,e,n){this[l].getMany(t,e,n)}_del(t,e,n){this[l].del(t,e,n)}_batch(t,e,n){this[l].batch(t,e,n)}_clear(t,e){this[u](t,t.keyEncoding),this[l].clear(t,e)}_iterator(t){this[u](t,t.keyEncoding);const e=this[l].iterator(t),n=this[f].get(this[h].utf8.length,t.keyEncoding);return new o(this,t,e,n)}_keys(t){this[u](t,t.keyEncoding);const e=this[l].keys(t),n=this[f].get(this[h].utf8.length,t.keyEncoding);return new s(this,t,e,n)}_values(t){this[u](t,t.keyEncoding);const e=this[l].values(t);return new a(this,t,e)}}return{AbstractSublevel:e}};const y=function(t,e){return{...t.supports,createIfMissing:!1,errorIfExists:!1,events:{},additionalMethods:{},...e,encodings:{utf8:g(t,"utf8"),buffer:g(t,"buffer"),view:g(t,"view")}}},g=function(t,e){return!!t.supports.encodings[e]&&t.keyEncoding(e).name===e};class b{constructor(t){this.utf8=t,this.view=d.encode(t),this.buffer=i?i.from(this.view.buffer,0,this.view.byteLength):{}}}class m{constructor(){this.cache=new Map}get(t,e){let n=this.cache.get(e);return void 0===n&&(n="view"===e?function(t,e){return e.subarray(t)}.bind(null,t):function(t,e){return e.slice(t)}.bind(null,t),this.cache.set(e,n)),n}}const E=function(t,e){let n=0,r=t.length;for(;nn&&t[r-1]===e;)r--;return t.slice(n,r)}},2520:(t,e)=>{e.getCallback=function(t,e){return"function"==typeof t?t:e},e.getOptions=function(t,e){return"object"==typeof t&&null!==t?t:void 0!==e?e:{}}},4765:(t,e,n)=>{const{AbstractChainedBatch:r}=n(9464),i=n(4473),o=Symbol("encoded");e.DefaultChainedBatch=class extends r{constructor(t){super(t),this[o]=[]}_put(t,e,n){this[o].push({...n,type:"put",key:t,value:e})}_del(t,e){this[o].push({...e,type:"del",key:t})}_clear(){this[o]=[]}_write(t,e){"opening"===this.db.status?this.db.defer((()=>this._write(t,e))):"open"===this.db.status?0===this[o].length?this.nextTick(e):this.db._batch(this[o],t,e):this.nextTick(e,new i("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"}))}}},5429:(t,e,n)=>{const{AbstractKeyIterator:r,AbstractValueIterator:i}=n(3961),o=Symbol("iterator"),s=Symbol("callback"),a=Symbol("handleOne"),h=Symbol("handleMany");class c extends r{constructor(t,e){super(t,e),this[o]=t.iterator({...e,keys:!0,values:!1}),this[a]=this[a].bind(this),this[h]=this[h].bind(this)}}class u extends i{constructor(t,e){super(t,e),this[o]=t.iterator({...e,keys:!1,values:!0}),this[a]=this[a].bind(this),this[h]=this[h].bind(this)}}for(const t of[c,u]){const e=t===c,n=e?t=>t[0]:t=>t[1];t.prototype._next=function(t){this[s]=t,this[o].next(this[a])},t.prototype[a]=function(t,n,r){const i=this[s];t?i(t):i(null,e?n:r)},t.prototype._nextv=function(t,e,n){this[s]=n,this[o].nextv(t,e,this[h])},t.prototype._all=function(t,e){this[s]=e,this[o].all(t,this[h])},t.prototype[h]=function(t,e){const r=this[s];t?r(t):r(null,e.map(n))},t.prototype._seek=function(t,e){this[o].seek(t,e)},t.prototype._close=function(t){this[o].close(t)}}e.DefaultKeyIterator=c,e.DefaultValueIterator=u},593:(t,e,n)=>{const{AbstractIterator:r,AbstractKeyIterator:i,AbstractValueIterator:o}=n(3961),s=n(4473),a=Symbol("nut"),h=Symbol("undefer"),c=Symbol("factory");class u extends r{constructor(t,e){super(t,e),this[a]=null,this[c]=()=>t.iterator(e),this.db.defer((()=>this[h]()))}}class l extends i{constructor(t,e){super(t,e),this[a]=null,this[c]=()=>t.keys(e),this.db.defer((()=>this[h]()))}}class f extends o{constructor(t,e){super(t,e),this[a]=null,this[c]=()=>t.values(e),this.db.defer((()=>this[h]()))}}for(const t of[u,l,f])t.prototype[h]=function(){"open"===this.db.status&&(this[a]=this[c]())},t.prototype._next=function(t){null!==this[a]?this[a].next(t):"opening"===this.db.status?this.db.defer((()=>this._next(t))):this.nextTick(t,new s("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._nextv=function(t,e,n){null!==this[a]?this[a].nextv(t,e,n):"opening"===this.db.status?this.db.defer((()=>this._nextv(t,e,n))):this.nextTick(n,new s("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._all=function(t,e){null!==this[a]?this[a].all(e):"opening"===this.db.status?this.db.defer((()=>this._all(t,e))):this.nextTick(e,new s("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._seek=function(t,e){null!==this[a]?this[a]._seek(t,e):"opening"===this.db.status&&this.db.defer((()=>this._seek(t,e)))},t.prototype._close=function(t){null!==this[a]?this[a].close(t):"opening"===this.db.status?this.db.defer((()=>this._close(t))):this.nextTick(t)};e.DeferredIterator=u,e.DeferredKeyIterator=l,e.DeferredValueIterator=f},6909:(t,e,n)=>{const r=n(4375);t.exports=function(t,...e){0===e.length?r(t):r((()=>t(...e)))}},56:(t,e,n)=>{const r=n(4473),i=Object.prototype.hasOwnProperty,o=new Set(["lt","lte","gt","gte"]);t.exports=function(t,e){const n={};for(const s in t)if(i.call(t,s)&&"keyEncoding"!==s&&"valueEncoding"!==s){if("start"===s||"end"===s)throw new r(`The legacy range option '${s}' has been removed`,{code:"LEVEL_LEGACY"});if("encoding"===s)throw new r("The levelup-style 'encoding' alias has been removed, use 'valueEncoding' instead",{code:"LEVEL_LEGACY"});o.has(s)?n[s]=e.encode(t[s]):n[s]=t[s]}return n.reverse=!!n.reverse,n.limit=Number.isInteger(n.limit)&&n.limit>=0?n.limit:-1,n}},3658:(t,e)=>{e.supports=function(...t){const e=t.reduce(((t,e)=>Object.assign(t,e)),{});return Object.assign(e,{snapshots:e.snapshots||!1,permanence:e.permanence||!1,seek:e.seek||!1,clear:e.clear||!1,getMany:e.getMany||!1,keyIterator:e.keyIterator||!1,valueIterator:e.valueIterator||!1,iteratorNextv:e.iteratorNextv||!1,iteratorAll:e.iteratorAll||!1,status:e.status||!1,createIfMissing:e.createIfMissing||!1,errorIfExists:e.errorIfExists||!1,deferredOpen:e.deferredOpen||!1,promises:e.promises||!1,streams:e.streams||!1,encodings:Object.assign({},e.encodings),events:Object.assign({},e.events),additionalMethods:Object.assign({},e.additionalMethods)})}},9742:(t,e)=>{e.byteLength=function(t){var e=h(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,o=h(t),s=o[0],a=o[1],c=new i(function(t,e,n){return 3*(e+n)/4-n}(0,s,a)),u=0,l=a>0?s-4:s;for(n=0;n>16&255,c[u++]=e>>8&255,c[u++]=255&e;return 2===a&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,c[u++]=255&e),1===a&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,c[u++]=e>>8&255,c[u++]=255&e),c},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=16383,a=0,h=r-i;ah?h:a+s));return 1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),o.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function c(t,e,r){for(var i,o,s=[],a=e;a>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},1708:(t,e,n)=>{const{AbstractLevel:r}=n(875),i=n(4473),o=n(9967),{fromCallback:s}=n(6957),{Iterator:a}=n(8212),h=n(9687),c=n(9968),u=n(1217),l="level-js-",f=Symbol("idb"),d=Symbol("namePrefix"),p=Symbol("location"),y=Symbol("version"),g=Symbol("store"),b=Symbol("onComplete"),m=Symbol("promise");class E extends r{constructor(t,e,n){if("function"==typeof e||"function"==typeof n)throw new i("The levelup-style callback argument has been removed",{code:"LEVEL_LEGACY"});const{prefix:r,version:o,...s}=e||{};if(super({encodings:{view:!0},snapshots:!1,createIfMissing:!1,errorIfExists:!1,seek:!0},s),"string"!=typeof t)throw new Error("constructor requires a location string argument");this[p]=t,this[d]=null==r?l:r,this[y]=parseInt(o||1,10),this[f]=null}get location(){return this[p]}get namePrefix(){return this[d]}get version(){return this[y]}get db(){return this[f]}get type(){return"browser-level"}_open(t,e){const n=indexedDB.open(this[d]+this[p],this[y]);n.onerror=function(){e(n.error||new Error("unknown error"))},n.onsuccess=()=>{this[f]=n.result,e()},n.onupgradeneeded=t=>{const e=t.target.result;e.objectStoreNames.contains(this[p])||e.createObjectStore(this[p])}}[g](t){return this[f].transaction([this[p]],t).objectStore(this[p])}[b](t,e){const n=t.transaction;n.onabort=function(){e(n.error||new Error("aborted by user"))},n.oncomplete=function(){e(null,t.result)}}_get(t,e,n){const r=this[g]("readonly");let o;try{o=r.get(t)}catch(t){return this.nextTick(n,t)}this[b](o,(function(t,e){return t?n(t):void 0===e?n(new i("Entry not found",{code:"LEVEL_NOT_FOUND"})):void n(null,h(e))}))}_getMany(t,e,n){const r=this[g]("readonly"),i=t.map((t=>e=>{let n;try{n=r.get(t)}catch(t){return e(t)}n.onsuccess=()=>{const t=n.result;e(null,void 0===t?t:h(t))},n.onerror=t=>{t.stopPropagation(),e(n.error)}}));o(i,16,n)}_del(t,e,n){const r=this[g]("readwrite");let i;try{i=r.delete(t)}catch(t){return this.nextTick(n,t)}this[b](i,n)}_put(t,e,n,r){const i=this[g]("readwrite");let o;try{o=i.put(e,t)}catch(t){return this.nextTick(r,t)}this[b](o,r)}_iterator(t){return new a(this,this[p],t)}_batch(t,e,n){const r=this[g]("readwrite"),i=r.transaction;let o,s=0;i.onabort=function(){n(o||i.error||new Error("aborted by user"))},i.oncomplete=function(){n()},function e(){const n=t[s++],a=n.key;let h;try{h="del"===n.type?r.delete(a):r.put(n.value,a)}catch(t){return o=t,void i.abort()}s=0)return c(this,this[p],n,t,e);try{const t=this[g]("readwrite");r=n?t.delete(n):t.clear()}catch(t){return this.nextTick(e,t)}this[b](r,e)}_close(t){this[f].close(),this.nextTick(t)}}E.destroy=function(t,e,n){"function"==typeof e&&(n=e,e=l),n=s(n,m);const r=indexedDB.deleteDatabase(e+t);return r.onsuccess=function(){n()},r.onerror=function(t){n(t)},n[m]},e.BrowserLevel=E},8212:(t,e,n)=>{const{AbstractIterator:r}=n(875),i=n(1217),o=n(9687),s=Symbol("cache"),a=Symbol("finished"),h=Symbol("options"),c=Symbol("currentOptions"),u=Symbol("position"),l=Symbol("location"),f=Symbol("first"),d={};function p(t){"function"==typeof t.commit&&t.commit()}e.Iterator=class extends r{constructor(t,e,n){super(t,n),this[s]=[],this[a]=0===this.limit,this[h]=n,this[c]={...n},this[u]=void 0,this[l]=e,this[f]=!0}_nextv(t,e,n){if(this[f]=!1,this[a])return this.nextTick(n,null,[]);if(this[s].length>0)return t=Math.min(t,this[s].length),this.nextTick(n,null,this[s].splice(0,t));let r;void 0!==this[u]&&(this[h].reverse?(this[c].lt=this[u],this[c].lte=void 0):(this[c].gt=this[u],this[c].gte=void 0));try{r=i(this[c])}catch(t){return this[a]=!0,this.nextTick(n,null,[])}const d=this.db.db.transaction([this[l]],"readonly"),y=d.objectStore(this[l]),g=[];if(this[h].reverse)y[!this[h].values&&y.openKeyCursor?"openKeyCursor":"openCursor"](r,"prev").onsuccess=e=>{const n=e.target.result;if(n){const{key:e,value:r}=n;this[u]=e,g.push([this[h].keys&&void 0!==e?o(e):void 0,this[h].values&&void 0!==r?o(r):void 0]),g.length{if(void 0===e||void 0===n)return;const r=Math.max(e.length,n.length);0===r||t===1/0?this[a]=!0:this[u]=e[r-1],g.length=r;for(let t=0;t{e=t.target.result,i()}:(e=[],this.nextTick(i)),this[h].values?y.getAll(r,t<1/0?t:void 0).onsuccess=t=>{n=t.target.result,i()}:(n=[],this.nextTick(i))}d.onabort=()=>{n(d.error||new Error("aborted by user")),n=null},d.oncomplete=()=>{n(null,g),n=null}}_next(t){if(this[s].length>0){const[e,n]=this[s].shift();this.nextTick(t,null,e,n)}else if(this[a])this.nextTick(t);else{let e=Math.min(100,this.limit-this.count);this[f]&&(this[f]=!1,e=1),this._nextv(e,d,((e,n)=>{if(e)return t(e);this[s]=n,this._next(t)}))}}_all(t,e){this[f]=!1;const n=this[s].splice(0,this[s].length),r=this.limit-this.count-n.length;if(r<=0)return this.nextTick(e,null,n);this._nextv(r,d,((t,r)=>{if(t)return e(t);n.length>0&&(r=n.concat(r)),e(null,r)}))}_seek(t,e){let n;this[f]=!0,this[s]=[],this[a]=!1,this[u]=void 0,this[c]={...this[h]};try{n=i(this[h])}catch(t){return void(this[a]=!0)}null===n||n.includes(t)?this[h].reverse?this[c].lte=t:this[c].gte=t:this[a]=!0}}},9968:t=>{t.exports=function(t,e,n,r,i){if(0===r.limit)return t.nextTick(i);const o=t.db.transaction([e],"readwrite"),s=o.objectStore(e);let a=0;o.oncomplete=function(){i()},o.onabort=function(){i(o.error||new Error("aborted by user"))};const h=s.openKeyCursor?"openKeyCursor":"openCursor",c=r.reverse?"prev":"next";s[h](n,c).onsuccess=function(t){const e=t.target.result;e&&(s.delete(e.key).onsuccess=function(){(r.limit<=0||++a{const e=new TextEncoder;t.exports=function(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):e.encode(t)}},1217:t=>{t.exports=function(t){const e=void 0!==t.gte?t.gte:void 0!==t.gt?t.gt:void 0,n=void 0!==t.lte?t.lte:void 0!==t.lt?t.lt:void 0,r=void 0===t.gte,i=void 0===t.lte;return void 0!==e&&void 0!==n?IDBKeyRange.bound(e,n,r,i):void 0!==e?IDBKeyRange.lowerBound(e,r):void 0!==n?IDBKeyRange.upperBound(n,i):null}},8764:(t,e,n)=>{const r=n(9742),i=n(645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=h,e.SlowBuffer=function(t){return+t!=t&&(t=0),h.alloc(+t)},e.INSPECT_MAX_BYTES=50;const s=2147483647;function a(t){if(t>s)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,h.prototype),e}function h(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return c(t,e,n)}function c(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!h.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|y(t,e);let r=a(n);const i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return f(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return d(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return d(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return h.from(r,e,n);const i=function(t){if(h.isBuffer(t)){const e=0|p(t.length),n=a(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||J(t.length)?a(0):f(t):"Buffer"===t.type&&Array.isArray(t.data)?f(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return h.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function u(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function l(t){return u(t),a(t<0?0:0|p(t))}function f(t){const e=t.length<0?0:0|p(t.length),n=a(e);for(let r=0;r=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|t}function y(t,e){if(h.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(t).length;default:if(i)return r?-1:$(t).length;e=(""+e).toLowerCase(),i=!0}}function g(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,n);case"utf8":case"utf-8":return A(this,e,n);case"ascii":return k(this,e,n);case"latin1":case"binary":return x(this,e,n);case"base64":return L(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function b(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function m(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),J(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=h.from(e,r)),h.isBuffer(e))return 0===e.length?-1:E(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):E(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function E(t,e,n,r,i){let o,s=1,a=t.length,h=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,h/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){let r=-1;for(o=n;oa&&(n=a-h),o=n;o>=0;o--){let n=!0;for(let r=0;ri&&(r=i):r=i;const o=e.length;let s;for(r>o/2&&(r=o/2),s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function L(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function A(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i239?4:e>223?3:e>191?2:1;if(i+s<=n){let n,r,a,h;switch(s){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(h=(31&e)<<6|63&n,h>127&&(o=h));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(h=(15&e)<<12|(63&n)<<6|63&r,h>2047&&(h<55296||h>57343)&&(o=h));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(h=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,h>65535&&h<1114112&&(o=h))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(t){const e=t.length;if(e<=O)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr.length?(h.isBuffer(e)||(e=h.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!h.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},h.byteLength=y,h.prototype._isBuffer=!0,h.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;en&&(t+=" ... "),""},o&&(h.prototype[o]=h.prototype.inspect),h.prototype.compare=function(t,e,n,r,i){if(Y(t,Uint8Array)&&(t=h.from(t,t.offset,t.byteLength)),!h.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0);const a=Math.min(o,s),c=this.slice(r,i),u=t.slice(e,n);for(let t=0;t>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return v(this,t,e,n);case"utf8":case"utf-8":return w(this,t,e,n);case"ascii":case"latin1":case"binary":return _(this,t,e,n);case"base64":return T(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const O=4096;function k(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;ir)&&(n=r);let i="";for(let r=e;rn)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,n,r,i,o){if(!h.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function D(t,e,n,r,i){G(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,n}function U(t,e,n,r,i){G(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s>>=8,t[n+2]=s,s>>=8,t[n+1]=s,s>>=8,t[n]=s,n+8}function P(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function M(t,e,n,r,o){return e=+e,n>>>=0,o||P(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function B(t,e,n,r,o){return e=+e,n>>>=0,o||P(t,0,n,8),i.write(t,e,n,r,52,8),n+8}h.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||C(t,e,this.length);let r=this[t],i=1,o=0;for(;++o>>=0,e>>>=0,n||C(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},h.prototype.readUint8=h.prototype.readUInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),this[t]},h.prototype.readUint16LE=h.prototype.readUInt16LE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]|this[t+1]<<8},h.prototype.readUint16BE=h.prototype.readUInt16BE=function(t,e){return t>>>=0,e||C(t,2,this.length),this[t]<<8|this[t+1]},h.prototype.readUint32LE=h.prototype.readUInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},h.prototype.readUint32BE=h.prototype.readUInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},h.prototype.readBigUInt64LE=Q((function(t){z(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<>>=0,e>>>=0,n||C(t,e,this.length);let r=this[t],i=1,o=0;for(;++o=i&&(r-=Math.pow(2,8*e)),r},h.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||C(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},h.prototype.readInt8=function(t,e){return t>>>=0,e||C(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},h.prototype.readInt16LE=function(t,e){t>>>=0,e||C(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},h.prototype.readInt16BE=function(t,e){t>>>=0,e||C(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},h.prototype.readInt32LE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},h.prototype.readInt32BE=function(t,e){return t>>>=0,e||C(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},h.prototype.readBigInt64LE=Q((function(t){z(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<>>=0,e||C(t,4,this.length),i.read(this,t,!0,23,4)},h.prototype.readFloatBE=function(t,e){return t>>>=0,e||C(t,4,this.length),i.read(this,t,!1,23,4)},h.prototype.readDoubleLE=function(t,e){return t>>>=0,e||C(t,8,this.length),i.read(this,t,!0,52,8)},h.prototype.readDoubleBE=function(t,e){return t>>>=0,e||C(t,8,this.length),i.read(this,t,!1,52,8)},h.prototype.writeUintLE=h.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||N(this,t,e,n,Math.pow(2,8*n)-1,0);let i=1,o=0;for(this[e]=255&t;++o>>=0,n>>>=0,r||N(this,t,e,n,Math.pow(2,8*n)-1,0);let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},h.prototype.writeUint8=h.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,1,255,0),this[e]=255&t,e+1},h.prototype.writeUint16LE=h.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},h.prototype.writeUint16BE=h.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},h.prototype.writeUint32LE=h.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},h.prototype.writeUint32BE=h.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},h.prototype.writeBigUInt64LE=Q((function(t,e=0){return D(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),h.prototype.writeBigUInt64BE=Q((function(t,e=0){return U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),h.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);N(this,t,e,n,r-1,-r)}let i=0,o=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+n},h.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);N(this,t,e,n,r-1,-r)}let i=n-1,o=1,s=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/o>>0)-s&255;return e+n},h.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},h.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},h.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},h.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},h.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},h.prototype.writeBigInt64LE=Q((function(t,e=0){return D(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),h.prototype.writeBigInt64BE=Q((function(t,e=0){return U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),h.prototype.writeFloatLE=function(t,e,n){return M(this,t,e,!0,n)},h.prototype.writeFloatBE=function(t,e,n){return M(this,t,e,!1,n)},h.prototype.writeDoubleLE=function(t,e,n){return B(this,t,e,!0,n)},h.prototype.writeDoubleBE=function(t,e,n){return B(this,t,e,!1,n)},h.prototype.copy=function(t,e,n,r){if(!h.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function G(t,e,n,r,i,o){if(t>n||t3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){z(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||W(e,t.length-(n+1))}(r,i,o)}function z(t,e){if("number"!=typeof t)throw new j.ERR_INVALID_ARG_TYPE(e,"number",t)}function W(t,e,n){if(Math.floor(t)!==t)throw z(t,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=V(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=V(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);const K=/[^+/0-9A-Za-z-_]/g;function $(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function q(t){return r.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(K,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,n,r){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function J(t){return t!=t}const X=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Q(t){return"undefined"==typeof BigInt?Z:t}function Z(){throw new Error("BigInt not supported")}},6957:(t,e,n)=>{var r=n(886);e.fromCallback=function(t,e){if(void 0===t){var n=new Promise((function(e,n){t=function(t,r){t?n(t):e(r)}}));t[void 0!==e?e:"promise"]=n}else if("function"!=typeof t)throw new TypeError("Callback must be a function");return t},e.fromPromise=function(t,e){if(void 0===e)return t;t.then((function(t){r((()=>e(null,t)))})).catch((function(t){r((()=>e(t)))}))}},886:t=>{t.exports="function"==typeof queueMicrotask?queueMicrotask:t=>Promise.resolve().then(t)},8840:(t,e)=>{function n(t){for(var e="",n=0;n0?"F"+s:"D"+n(s)},e.decode=function(t){if("DaN"===t)return NaN;if("FF"===t)return 1/0;if("DD"===t)return-1/0;var e="D"===t[0],r=(e?n(t):t).slice(2).split("M");return Number((e?"-":"")+r[1]+"e"+String(Number(r[0])-500))}},2833:(t,e)=>{var n={"?":"?@","!":"??",'"':"?%"},r={"?@":"?","??":"!","?%":'"'};e.factory=function(t){return{encode:e,decode:function(e){if("A"===e)return null;if("K!"===e)return[];for(var n,i=e.split('"'),o=[[]],s=0,a=i.length,h=0;h{var r=n(8840),i=n(2833);e.flip=function(t){var e=t.toString(),n="";for(var r in e)n+="."==e[r]?".":9-+e[r];return n},e.number=r,e.string={encode:function(t){return/\x00|\x01/.test(t)?"J"+t.replace(/\x01/g,"").replace(/\x00/g,""):"J"+t},decode:function(t){if("J"===t[0])return t.substring(1)}},e.encode=function(t){return e[typeof t].encode(t)},e.decode=function(t){if(""===t)return t;if(!o[t[0]])throw new Error("no decoder for:"+JSON.stringify(t));return o[t[0]](t)},e.object=i.factory(e),e.boolean={encode:function(t){return t?"C":"B"},decode:function(t){return"C"===t}},e.undefined={encode:function(t){return"L"},decode:function(){}};var o={A:e.object.decode,B:e.boolean.decode,C:e.boolean.decode,D:e.number.decode,F:e.number.decode,J:e.string.decode,K:e.object.decode,L:e.undefined.decode};e.buffer=!1,e.type="charwise"},6729:t=>{var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new i(r,o||t,s),h=n?n+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},a.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,s=new Array(o);i{var e,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};e=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var i=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,e){return new Promise((function(n,r){function i(n){t.removeListener(e,o),r(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}y(t,e,o,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&y(t,"error",e,{once:!0})}(t,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function h(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function c(t,e,n,r){var i,o,s,c;if(a(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),s=o[e]),void 0===s)s=o[e]=n,++t._eventsCount;else if("function"==typeof s?s=o[e]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=h(t))>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,c=u,console&&console.warn&&console.warn(c)}return t}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=u.bind(r);return i.listener=n,r.wrapFn=i,i}function f(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var h=o[t];if(void 0===h)return!1;if("function"==typeof h)r(h,this,e);else{var c=h.length,u=p(h,c);for(n=0;n=0;o--)if(n[o]===e||n[o].listener===e){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1=0;r--)this.removeListener(t,e[r]);return this},o.prototype.listeners=function(t){return f(this,t,!0)},o.prototype.rawListeners=function(t){return f(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):d.call(t,e)},o.prototype.listenerCount=d,o.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},9203:(t,e,n)=>{const r=n(7270),{BrowserLevel:i}=n(1708);t.exports=t=>r(Object.assign({db:i},t))},7270:(t,e,n)=>{const r=n(2483),i=n(9563),o=n(8936),s=t=>void 0===t?void 0:t.map((t=>(t._match=t._match.flat(1/0).map((t=>"string"==typeof t?JSON.parse(t):t)).sort(((t,e)=>t.FIELDe.FIELD?1:t.VALUEe.VALUE?1:t.SCOREe.SCORE?1:0)),t))),a=t=>{const e=i(t),n=o(t);return n.TIMESTAMP_CREATED().then((()=>({AGGREGATION_FILTER:e.AGGREGATION_FILTER,AND:(t,n)=>e.INTERSECTION(t,n).then(s),BUCKET:e.BUCKET,BUCKETS:e.BUCKETS,CREATED:e.CREATED,DELETE:n.DELETE,DISTINCT:e.DISTINCT,EXIST:e.EXIST,EXPORT:e.EXPORT,FACETS:e.FACETS,FIELDS:e.FIELDS,GET:(t,n)=>e.GET(t,n).then(s),IMPORT:n.IMPORT,LAST_UPDATED:e.LAST_UPDATED,MAX:e.MAX,MIN:e.MIN,NOT:(...t)=>e.SET_SUBTRACTION(...t).then(s),OBJECT:e.OBJECT,OR:(t,n)=>e.UNION(t,n).then((t=>t.union)).then(s),PUT:n.PUT,SORT:e.SORT,STORE:t._db,TIMESTAMP_LAST_UPDATED:n.TIMESTAMP_LAST_UPDATED,parseToken:e.parseToken})))};t.exports=t=>((t={})=>new Promise(((e,n)=>{const i=new(0,(t=Object.assign({name:"fii",tokenAppend:"",caseSensitive:!0,stopwords:[],doNotIndexField:[],storeVectors:!0,docExistsSpace:"DOC"},t)).db)(t.name,{keyEncoding:r,valueEncoding:"json"});i.open((r=>r?n(r):e(Object.assign(t,{_db:i}))))})))(t).then(a)},6782:t=>{const e=null,n=void 0;t.exports=(t,r)=>new Promise(((i,o)=>{if(Array.isArray(t))return o(new Error("token cannot be Array"));if(void 0===t&&(t={}),"string"==typeof t){if(-1===t.indexOf(":"))return i({FIELD:r,VALUE:{GTE:t,LTE:t}});const[e,...n]=t.split(":");return i({FIELD:[e],VALUE:{GTE:n.join(":"),LTE:n.join(":")}})}return"number"==typeof t&&(t={VALUE:{GTE:t,LTE:t}}),null===t.VALUE&&(t.VALUE={GTE:null,LTE:null}),"string"!=typeof t.VALUE&&"number"!=typeof t.VALUE||(t.VALUE={GTE:t.VALUE,LTE:t.VALUE}),void 0!==t.VALUE&&Object.keys(t.VALUE).length||(t.VALUE={GTE:e,LTE:n}),void 0===t.VALUE.GTE&&(t.VALUE.GTE=e),void 0===t.VALUE.LTE&&(t.VALUE.LTE=n),t.VALUE=Object.assign(t.VALUE,{GTE:t.VALUE.GTE,LTE:t.VALUE.LTE}),void 0===t.FIELD?i(Object.assign(t,{FIELD:r})):(t.FIELD=[t.FIELD].flat(),i(t))}))},9563:(t,e,n)=>{const r=n(6782),i=n(2483),{EntryStream:o}=n(6741);i.LO=null,i.HI=void 0,t.exports=t=>{const e=t=>"string"==typeof t,n=async t=>r(t,await u()),s=async(e,r=(t=>new Promise((e=>e(t)))))=>new Promise((async(i,o)=>{const s=t=>void 0===t?i(void 0):t instanceof Promise?i(t):void 0;try{s(e),e=await n(e),e=await(e=>{const n=e=>t.caseSensitive||"string"!=typeof e?e:e.toLowerCase();return{FIELD:e.FIELD.map(n),VALUE:{GTE:n(e.VALUE.GTE),LTE:n(e.VALUE.LTE)}}})(e),e=await(e=>e.VALUE.GTE===e.VALUE.LTE&&t.stopwords.includes(e.VALUE.GTE)?void 0:e)(e),s(e=await(e=>void 0===e?c(void 0):e.VALUE.GTE===e.VALUE.LTE&&t.queryReplace&&t.queryReplace[e.VALUE.GTE]?a(t.queryReplace[e.VALUE.GTE].map((t=>({FIELD:e.FIELD,VALUE:{GTE:t,LTE:t}})))).then((t=>t.union)):e)(e)),s(e=await r(e))}catch(t){return o(t)}return Array.isArray(e)?i(e):i(c(e))})),a=async(t,e)=>Promise.all(t.map((t=>s(t,e)))).then((t=>{const e=t.flat(1/0).reduce(((t,e)=>(e&&t.set(e._id,[...t.get(e._id)||[],e._match]),t)),new Map);return{sumTokensMinusStopwords:t.filter((t=>t)).length,union:Array.from(e.keys()).map((t=>({_id:t,_match:e.get(t)})))}})),h=(t,e,n)=>{const r=[];return void 0===e&&"number"!=typeof e||r.push(e),n&&r.push(i.HI),["IDX",t,r]},c=e=>new Promise((n=>{if(void 0===e)return n(void 0);const r=new Map;return Promise.all(e.FIELD.map((n=>new Promise((i=>new o(t._db,{gte:h(n,e.VALUE.GTE),lte:h(n,e.VALUE.LTE,!0),limit:e.LIMIT,reverse:e.REVERSE}).on("data",(t=>t.value.forEach((e=>r.set(e,[...r.get(e)||[],JSON.stringify({FIELD:t.key[1],VALUE:t.key[2][0],SCORE:t.key[2][1]})]))))).on("end",i)))))).then((()=>n(Array.from(r.keys()).map((t=>({_id:t,_match:r.get(t)}))))))})),u=()=>new Promise((e=>{const n=[];new o(t._db,{gte:["FIELD",i.LO],lte:["FIELD",i.HI]}).on("data",(t=>n.push(t.value))).on("end",(()=>e(n)))})),l=(t,e)=>e&&0!==e.length?(e=new Set(e.map((t=>t._id))),t.map((t=>Object.assign(t,{_id:[...new Set([...t._id].filter((t=>e.has(t))))]})))):t,f=async t=>n(t).then((t=>s(t).then((e=>Object.assign(t,{_id:[...e.reduce(((t,e)=>t.add(e._id)),new Set)].sort(),VALUE:t.VALUE}))))),d=e=>new Promise(((n,r)=>{const i=[];new o(t._db,e).on("data",(t=>{i.push(t)})).on("end",(()=>n(i)))})),p=(t,e)=>n(t).then((t=>c(Object.assign(t,{LIMIT:1,REVERSE:e})))).then((t=>t.length?JSON.parse(t.pop()._match.pop()).VALUE:null)),y=t=>n(t).then((t=>Promise.all(t.FIELD.map((e=>{let n=t.VALUE.LTE;void 0!==t.VALUE.LTE&&"number"!=typeof t.VALUE.LTE&&(n+="○");let r=t.VALUE.GTE;return t.VALUE.GTE&&"number"!=typeof t.VALUE.GTE&&(r+=" "),d({gte:h(e,r),lte:h(e,n,!0),keys:!0,values:!1}).then((t=>t.map((({key:t})=>({FIELD:t[1],VALUE:t[2][0]})))))}))))).then((t=>t.flat())),g=t=>n(t).then((t=>Promise.all(t.FIELD.map((e=>d({gte:h(e,t.VALUE.GTE),lte:h(e,t.VALUE.LTE,!0)}).then((t=>t.map((t=>({FIELD:t.key[1],VALUE:t.key[2][0],_id:t.value})))))))))).then((t=>t.flat())),b=new Intl.Collator("en",{numeric:!0,sensitivity:"base"});return{AGGREGATE:({BUCKETS:t,FACETS:e,QUERY:n})=>Promise.all([t,e,n]).then((([t=[],e=[],n=[]])=>({BUCKETS:l(t.flat(),n),FACETS:l(e.flat(),n),RESULT:n}))),AGGREGATION_FILTER:l,BUCKET:f,BUCKETS:(...t)=>Promise.all(t.map(f)),CREATED:()=>t._db.get(["~CREATED"]),DISTINCT:(...t)=>Promise.all(t.length?t.map(y):[y({})]).then((t=>[...t.flat().reduce(((t,e)=>t.add(JSON.stringify(e))),new Set)].map(JSON.parse))),EXIST:(...e)=>Promise.all(e.map((e=>t._db.get([t.docExistsSpace,e]).catch((t=>null))))).then((t=>t.reduce(((t,n,r)=>(null!=n&&t.push(e[r]),t)),[]))),EXPORT:d,FACETS:(...t)=>Promise.all(t.length?t.map(g):[g({})]).then((t=>[...t.flat().reduce(((t,e)=>t.add(JSON.stringify(e))),new Set)].map(JSON.parse))),FIELDS:u,GET:s,INTERSECTION:(t,e)=>a(t,e).then((t=>t.union.filter((e=>e._match.length===t.sumTokensMinusStopwords)))),LAST_UPDATED:()=>t._db.get(["~LAST_UPDATED"]),MAX:t=>p(t,!0),MIN:p,OBJECT:e=>Promise.all(e.map((e=>t._db.get(["DOC",e._id]).catch((t=>null))))).then((t=>e.map(((e,n)=>(e._object=t[n],e))))),SET_SUBTRACTION:(t,n)=>Promise.all([e(t)?s(t):t,e(n)?s(n):n]).then((([t,e])=>t.filter((t=>-1===e.map((t=>t._id)).indexOf(t._id))))),SORT:t=>new Promise((e=>e(t.sort(((t,e)=>b.compare(t._id,e._id)))))),UNION:a,parseToken:n}}},8936:(t,e,n)=>{const r=n(3692),i=n(9563);t.exports=t=>{let e=0;const n=(e,n)=>{if(null==e._object)return{_id:e._id,keys:[]};const i=[];return r(e._object).forEach((function(e){let r=!0;const o=this.path.filter((t=>!Number.isInteger(+t))).join(".");if("_id"===o&&(r=!1),n.doNotIndexField.filter((t=>o.startsWith(t))).length&&(r=!1),this.isLeaf&&t.stopwords.includes((this.node+"").split("#")[0])&&(r=!1),r&&this.isLeaf){let e;try{const t=JSON.parse(this.node);if(!Array.isArray(t))throw new Error;e=JSON.stringify([o,t])}catch(t){e=JSON.stringify([o,[this.node]])}i.push(t.caseSensitive?e:e.toLowerCase())}})),{_id:e._id,keys:i}},o=(t,e)=>(e.keys.forEach((n=>{t[n]=t[n]||[],t[n].push(e._id)})),t),s=(r,s,a,h,c)=>new Promise((u=>{r=r.map((t=>{var n;return t._id=void 0===(n=t._id)?++e:"string"==typeof n||"number"==typeof n?n:void 0,t._object&&(t._object._id=t._id),t})),c=Object.assign(t,c),i(t).EXIST(...r.map((t=>t._id))).then((t=>((t,e,n)=>{const r=Object.keys(t);return Promise.all(r.map((t=>["IDX",...JSON.parse(t)])).map((t=>new Promise(((n,r)=>e.get(t).then(n).catch((t=>n([])))))))).then((e=>e.map(((e,i)=>{const o=new Set(e),s=new Set(t[r[i]]);if("put"===n)return{key:["IDX",...JSON.parse(r[i])],type:n,value:[...new Set([...o,...s])].sort()};if("del"===n){const t=[...new Set([...o].filter((t=>!s.has(t))))];return{key:["IDX",...JSON.parse(r[i])],type:0===t.length?"del":"put",value:t}}return e}))))})(((t,e)=>t.map((t=>n(t,e))).reduce(o,{}))(r,c),s,a).then((e=>s.batch(e.concat(c.storeVectors?((t,e)=>t.map((t=>({key:["DOC",t._id],type:e,value:t._object}))))(r,a):[]).concat((t=>[...new Set(t.map((t=>t.key[1].split(":")[0])))].map((t=>({type:"put",key:["FIELD",t],value:t}))))(e)),(e=>u(r.map((e=>{let n;return"put"===a?n=t.includes(e._id)?"UPDATED":"CREATED":"del"===a&&(n=null===e._object?"FAILED":"DELETED"),{_id:e._id,operation:h,status:n}})))))))))})),a=e=>t._db.put(["~LAST_UPDATED"],Date.now()).then((()=>e));return{DELETE:e=>i(t).OBJECT(e.map((t=>({_id:t})))).then((e=>s(e,t._db,"del","DELETE",{}))).then(a),IMPORT:e=>t._db.clear().then((()=>t._db.batch(e.map((t=>Object.assign(t,{type:"put"})))))),PUT:(e,n={})=>s(e.map((t=>({_id:t._id,_object:t}))),t._db,"put","PUT",n).then(a),TIMESTAMP_CREATED:()=>t._db.get(["~CREATED"]).then().catch((e=>t._db.put(["~CREATED"],Date.now()).then(a))),TIMESTAMP_LAST_UPDATED:a}}},645:(t,e)=>{e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,h=(1<>1,u=-7,l=n?i-1:0,f=n?-1:1,d=t[e+l];for(l+=f,o=d&(1<<-u)-1,d>>=-u,u+=a;u>0;o=256*o+t[e+l],l+=f,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+t[e+l],l+=f,u-=8);if(0===o)o=1-c;else{if(o===h)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),o-=c}return(d?-1:1)*s*Math.pow(2,o-r)},e.write=function(t,e,n,r,i,o){var s,a,h,c=8*o-i-1,u=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-s))<1&&(s--,h*=2),(e+=s+l>=1?f/h:f*Math.pow(2,1-l))*h>=2&&(s++,h/=2),s+l>=u?(a=0,s=u):s+l>=1?(a=(e*h-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[n+d]=255&a,d+=p,a/=256,i-=8);for(s=s<0;t[n+d]=255&s,d+=p,s/=256,c-=8);t[n+d-p]|=128*y}},5717:t=>{"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}},6741:(t,e,n)=>{const{Readable:r}=n(8473),i=Symbol("iterator"),o=Symbol("nextv");class s extends r{constructor(t,e,n){const{highWaterMark:r,...s}=n||{};super({objectMode:!0,highWaterMark:r||1e3}),this[i]=t[e](s),this[o]=this[o].bind(this),this.once("end",this.destroy.bind(this,null,null))}get db(){return this[i].db}_read(t){this.destroyed||this[i].nextv(t,this[o])}[o](t,e){if(!this.destroyed){if(t)return this.destroy(t);if(0===e.length)this.push(null);else for(const t of e)this.push(t)}}_destroy(t,e){this[i].close((function(n){e(t||n)}))}}e.EntryStream=class extends s{constructor(t,e){super(t,"iterator",{...e,keys:!0,values:!0})}[o](t,e){if(!this.destroyed){if(t)return this.destroy(t);if(0===e.length)this.push(null);else for(const[t,n]of e)this.push({key:t,value:n})}}},e.KeyStream=class extends s{constructor(t,e){super(t,"keys",e)}},e.ValueStream=class extends s{constructor(t,e){super(t,"values",e)}}},8499:(t,e,n)=>{const r=n(4473),i=n(8002),{Encoding:o}=n(8266),{BufferFormat:s,ViewFormat:a,UTF8Format:h}=n(2376),c=Symbol("formats"),u=Symbol("encodings"),l=new Set(["buffer","view","utf8"]);e.Transcoder=class{constructor(t){if(!Array.isArray(t))throw new TypeError("The first argument 'formats' must be an array");if(!t.every((t=>l.has(t))))throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'");this[u]=new Map,this[c]=new Set(t);for(const t in i)try{this.encoding(t)}catch(t){if("LEVEL_ENCODING_NOT_SUPPORTED"!==t.code)throw t}}encodings(){return Array.from(new Set(this[u].values()))}encoding(t){let e=this[u].get(t);if(void 0===e){if("string"==typeof t&&""!==t){if(e=d[t],!e)throw new r(`Encoding '${t}' is not found`,{code:"LEVEL_ENCODING_NOT_FOUND"})}else{if("object"!=typeof t||null===t)throw new TypeError("First argument 'encoding' must be a string or object");e=function(t){if(t instanceof o)return t;const e="type"in t&&"string"==typeof t.type?t.type:void 0,n=t.name||e||"anonymous-"+p++;switch(function(t){return"format"in t&&void 0!==t.format?t.format:"buffer"in t&&"boolean"==typeof t.buffer?t.buffer?"buffer":"utf8":"code"in t&&Number.isInteger(t.code)?"view":"buffer"}(t)){case"view":return new a({...t,name:n});case"utf8":return new h({...t,name:n});case"buffer":return new s({...t,name:n});default:throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}}(t)}const{name:n,format:i}=e;if(!this[c].has(i))if(this[c].has("view"))e=e.createViewTranscoder();else if(this[c].has("buffer"))e=e.createBufferTranscoder();else{if(!this[c].has("utf8"))throw new r(`Encoding '${n}' cannot be transcoded`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"});e=e.createUTF8Transcoder()}for(const r of[t,n,e.name,e.commonName])this[u].set(r,e)}return e}};const f={binary:i.buffer,"utf-8":i.utf8},d={...i,...f};let p=0},8266:(t,e,n)=>{const r=n(4473),i=new Set(["buffer","view","utf8"]);e.Encoding=class{constructor(t){if(this.encode=t.encode||this.encode,this.decode=t.decode||this.decode,this.name=t.name||this.name,this.format=t.format||this.format,"function"!=typeof this.encode)throw new TypeError("The 'encode' property must be a function");if("function"!=typeof this.decode)throw new TypeError("The 'decode' property must be a function");if(this.encode=this.encode.bind(this),this.decode=this.decode.bind(this),"string"!=typeof this.name||""===this.name)throw new TypeError("The 'name' property must be a string");if("string"!=typeof this.format||!i.has(this.format))throw new TypeError("The 'format' property must be one of 'buffer', 'view', 'utf8'");t.createViewTranscoder&&(this.createViewTranscoder=t.createViewTranscoder),t.createBufferTranscoder&&(this.createBufferTranscoder=t.createBufferTranscoder),t.createUTF8Transcoder&&(this.createUTF8Transcoder=t.createUTF8Transcoder)}get commonName(){return this.name.split("+")[0]}createBufferTranscoder(){throw new r(`Encoding '${this.name}' cannot be transcoded to 'buffer'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createViewTranscoder(){throw new r(`Encoding '${this.name}' cannot be transcoded to 'view'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createUTF8Transcoder(){throw new r(`Encoding '${this.name}' cannot be transcoded to 'utf8'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}}},8002:(t,e,n)=>{const{Buffer:r}=n(8764)||{Buffer:{isBuffer:()=>!1}},{textEncoder:i,textDecoder:o}=n(4005)(),{BufferFormat:s,ViewFormat:a,UTF8Format:h}=n(2376),c=t=>t;e.utf8=new h({encode:function(t){return r.isBuffer(t)?t.toString("utf8"):ArrayBuffer.isView(t)?o.decode(t):String(t)},decode:c,name:"utf8",createViewTranscoder(){return new a({encode:function(t){return ArrayBuffer.isView(t)?t:i.encode(t)},decode:function(t){return o.decode(t)},name:`${this.name}+view`})},createBufferTranscoder(){return new s({encode:function(t){return r.isBuffer(t)?t:ArrayBuffer.isView(t)?r.from(t.buffer,t.byteOffset,t.byteLength):r.from(String(t),"utf8")},decode:function(t){return t.toString("utf8")},name:`${this.name}+buffer`})}}),e.json=new h({encode:JSON.stringify,decode:JSON.parse,name:"json"}),e.buffer=new s({encode:function(t){return r.isBuffer(t)?t:ArrayBuffer.isView(t)?r.from(t.buffer,t.byteOffset,t.byteLength):r.from(String(t),"utf8")},decode:c,name:"buffer",createViewTranscoder(){return new a({encode:function(t){return ArrayBuffer.isView(t)?t:r.from(String(t),"utf8")},decode:function(t){return r.from(t.buffer,t.byteOffset,t.byteLength)},name:`${this.name}+view`})}}),e.view=new a({encode:function(t){return ArrayBuffer.isView(t)?t:i.encode(t)},decode:c,name:"view",createBufferTranscoder(){return new s({encode:function(t){return r.isBuffer(t)?t:ArrayBuffer.isView(t)?r.from(t.buffer,t.byteOffset,t.byteLength):r.from(String(t),"utf8")},decode:c,name:`${this.name}+buffer`})}}),e.hex=new s({encode:function(t){return r.isBuffer(t)?t:r.from(String(t),"hex")},decode:function(t){return t.toString("hex")},name:"hex"}),e.base64=new s({encode:function(t){return r.isBuffer(t)?t:r.from(String(t),"base64")},decode:function(t){return t.toString("base64")},name:"base64"})},2376:(t,e,n)=>{const{Buffer:r}=n(8764)||{},{Encoding:i}=n(8266),o=n(4005);class s extends i{constructor(t){super({...t,format:"buffer"})}createViewTranscoder(){return new a({encode:this.encode,decode:t=>this.decode(r.from(t.buffer,t.byteOffset,t.byteLength)),name:`${this.name}+view`})}createBufferTranscoder(){return this}}class a extends i{constructor(t){super({...t,format:"view"})}createBufferTranscoder(){return new s({encode:t=>{const e=this.encode(t);return r.from(e.buffer,e.byteOffset,e.byteLength)},decode:this.decode,name:`${this.name}+buffer`})}createViewTranscoder(){return this}}e.BufferFormat=s,e.ViewFormat=a,e.UTF8Format=class extends i{constructor(t){super({...t,format:"utf8"})}createBufferTranscoder(){return new s({encode:t=>r.from(this.encode(t),"utf8"),decode:t=>this.decode(t.toString("utf8")),name:`${this.name}+buffer`})}createViewTranscoder(){const{textEncoder:t,textDecoder:e}=o();return new a({encode:e=>t.encode(this.encode(e)),decode:t=>this.decode(e.decode(t)),name:`${this.name}+view`})}createUTF8Transcoder(){return this}}},4005:t=>{let e=null;t.exports=function(){return null===e&&(e={textEncoder:new TextEncoder,textDecoder:new TextDecoder}),e}},9593:(t,e,n)=>{var r=n(4155);const i="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,o="function"==typeof AbortController?AbortController:class{constructor(){this.signal=new h}abort(){this.signal.dispatchEvent("abort")}},s="function"==typeof AbortSignal,a="function"==typeof o.AbortSignal,h=s?AbortSignal:a?o.AbortController:class{constructor(){this.aborted=!1,this._listeners=[]}dispatchEvent(t){if("abort"===t){this.aborted=!0;const e={type:t,target:this};this.onabort(e),this._listeners.forEach((t=>t(e)),this)}}onabort(){}addEventListener(t,e){"abort"===t&&this._listeners.push(e)}removeEventListener(t,e){"abort"===t&&(this._listeners=this._listeners.filter((t=>t!==e)))}},c=new Set,u=(t,e)=>{const n=`LRU_CACHE_OPTION_${t}`;d(n)&&p(n,`${t} option`,`options.${e}`,E)},l=(t,e)=>{const n=`LRU_CACHE_METHOD_${t}`;if(d(n)){const{prototype:r}=E,{get:i}=Object.getOwnPropertyDescriptor(r,t);p(n,`${t} method`,`cache.${e}()`,i)}},f=(...t)=>{"object"==typeof r&&r&&"function"==typeof r.emitWarning?r.emitWarning(...t):console.error(...t)},d=t=>!c.has(t),p=(t,e,n,r)=>{c.add(t),f(`The ${e} is deprecated. Please use ${n} instead.`,"DeprecationWarning",t,r)},y=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),g=t=>y(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?b:null:null;class b extends Array{constructor(t){super(t),this.fill(0)}}class m{constructor(t){if(0===t)return[];const e=g(t);this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class E{constructor(t={}){const{max:e=0,ttl:n,ttlResolution:r=1,ttlAutopurge:i,updateAgeOnGet:o,updateAgeOnHas:s,allowStale:a,dispose:h,disposeAfter:l,noDisposeOnSet:p,noUpdateTTL:b,maxSize:v=0,sizeCalculation:w,fetchMethod:_,fetchContext:T,noDeleteOnFetchRejection:S,noDeleteOnStaleGet:L}=t,{length:A,maxAge:O,stale:k}=t instanceof E?{}:t;if(0!==e&&!y(e))throw new TypeError("max option must be a nonnegative integer");const x=e?g(e):Array;if(!x)throw new Error("invalid max value: "+e);if(this.max=e,this.maxSize=v,this.sizeCalculation=w||A,this.sizeCalculation){if(!this.maxSize)throw new TypeError("cannot set sizeCalculation without setting maxSize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(this.fetchMethod=_||null,this.fetchMethod&&"function"!=typeof this.fetchMethod)throw new TypeError("fetchMethod must be a function if specified");if(this.fetchContext=T,!this.fetchMethod&&void 0!==T)throw new TypeError("cannot set fetchContext without fetchMethod");if(this.keyMap=new Map,this.keyList=new Array(e).fill(null),this.valList=new Array(e).fill(null),this.next=new x(e),this.prev=new x(e),this.head=0,this.tail=0,this.free=new m(e),this.initialFill=1,this.size=0,"function"==typeof h&&(this.dispose=h),"function"==typeof l?(this.disposeAfter=l,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!p,this.noUpdateTTL=!!b,this.noDeleteOnFetchRejection=!!S,0!==this.maxSize){if(!y(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!a||!!k,this.noDeleteOnStaleGet=!!L,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!s,this.ttlResolution=y(r)||0===r?r:1,this.ttlAutopurge=!!i,this.ttl=n||O||0,this.ttl){if(!y(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}if(0===this.max&&0===this.ttl&&0===this.maxSize)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.max&&!this.maxSize){const t="LRU_CACHE_UNBOUNDED";d(t)&&(c.add(t),f("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,E))}k&&u("stale","allowStale"),O&&u("maxAge","ttl"),A&&u("length","sizeCalculation")}getRemainingTTL(t){return this.has(t,{updateAgeOnHas:!1})?1/0:0}initializeTTLTracking(){this.ttls=new b(this.max),this.starts=new b(this.max),this.setItemTTL=(t,e,n=i.now())=>{if(this.starts[t]=0!==e?n:0,this.ttls[t]=e,0!==e&&this.ttlAutopurge){const n=setTimeout((()=>{this.isStale(t)&&this.delete(this.keyList[t])}),e+1);n.unref&&n.unref()}},this.updateItemAge=t=>{this.starts[t]=0!==this.ttls[t]?i.now():0};let t=0;const e=()=>{const e=i.now();if(this.ttlResolution>0){t=e;const n=setTimeout((()=>t=0),this.ttlResolution);n.unref&&n.unref()}return e};this.getRemainingTTL=n=>{const r=this.keyMap.get(n);return void 0===r?0:0===this.ttls[r]||0===this.starts[r]?1/0:this.starts[r]+this.ttls[r]-(t||e())},this.isStale=n=>0!==this.ttls[n]&&0!==this.starts[n]&&(t||e())-this.starts[n]>this.ttls[n]}updateItemAge(t){}setItemTTL(t,e,n){}isStale(t){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new b(this.max),this.removeItemSize=t=>this.calculatedSize-=this.sizes[t],this.requireSize=(t,e,n,r)=>{if(!y(n)){if(!r)throw new TypeError("invalid size value (must be positive integer)");if("function"!=typeof r)throw new TypeError("sizeCalculation must be a function");if(n=r(e,t),!y(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return n},this.addItemSize=(t,e,n,r)=>{this.sizes[t]=r;const i=this.maxSize-this.sizes[t];for(;this.calculatedSize>i;)this.evict(!0);this.calculatedSize+=this.sizes[t]}}removeItemSize(t){}addItemSize(t,e,n,r){}requireSize(t,e,n,r){if(n||r)throw new TypeError("cannot set size without setting maxSize on cache")}*indexes({allowStale:t=this.allowStale}={}){if(this.size)for(let e=this.tail;this.isValidIndex(e)&&(!t&&this.isStale(e)||(yield e),e!==this.head);)e=this.prev[e]}*rindexes({allowStale:t=this.allowStale}={}){if(this.size)for(let e=this.head;this.isValidIndex(e)&&(!t&&this.isStale(e)||(yield e),e!==this.tail);)e=this.next[e]}isValidIndex(t){return this.keyMap.get(this.keyList[t])===t}*entries(){for(const t of this.indexes())yield[this.keyList[t],this.valList[t]]}*rentries(){for(const t of this.rindexes())yield[this.keyList[t],this.valList[t]]}*keys(){for(const t of this.indexes())yield this.keyList[t]}*rkeys(){for(const t of this.rindexes())yield this.keyList[t]}*values(){for(const t of this.indexes())yield this.valList[t]}*rvalues(){for(const t of this.rindexes())yield this.valList[t]}[Symbol.iterator](){return this.entries()}find(t,e={}){for(const n of this.indexes())if(t(this.valList[n],this.keyList[n],this))return this.get(this.keyList[n],e)}forEach(t,e=this){for(const n of this.indexes())t.call(e,this.valList[n],this.keyList[n],this)}rforEach(t,e=this){for(const n of this.rindexes())t.call(e,this.valList[n],this.keyList[n],this)}get prune(){return l("prune","purgeStale"),this.purgeStale}purgeStale(){let t=!1;for(const e of this.rindexes({allowStale:!0}))this.isStale(e)&&(this.delete(this.keyList[e]),t=!0);return t}dump(){const t=[];for(const e of this.indexes({allowStale:!0})){const n=this.keyList[e],r=this.valList[e],o={value:this.isBackgroundFetch(r)?r.__staleWhileFetching:r};if(this.ttls){o.ttl=this.ttls[e];const t=i.now()-this.starts[e];o.start=Math.floor(Date.now()-t)}this.sizes&&(o.size=this.sizes[e]),t.unshift([n,o])}return t}load(t){this.clear();for(const[e,n]of t){if(n.start){const t=Date.now()-n.start;n.start=i.now()-t}this.set(e,n.value,n)}}dispose(t,e,n){}set(t,e,{ttl:n=this.ttl,start:r,noDisposeOnSet:i=this.noDisposeOnSet,size:o=0,sizeCalculation:s=this.sizeCalculation,noUpdateTTL:a=this.noUpdateTTL}={}){o=this.requireSize(t,e,o,s);let h=0===this.size?void 0:this.keyMap.get(t);if(void 0===h)h=this.newIndex(),this.keyList[h]=t,this.valList[h]=e,this.keyMap.set(t,h),this.next[this.tail]=h,this.prev[h]=this.tail,this.tail=h,this.size++,this.addItemSize(h,e,t,o),a=!1;else{const n=this.valList[h];e!==n&&(this.isBackgroundFetch(n)?n.__abortController.abort():i||(this.dispose(n,t,"set"),this.disposeAfter&&this.disposed.push([n,t,"set"])),this.removeItemSize(h),this.valList[h]=e,this.addItemSize(h,e,t,o)),this.moveToTail(h)}if(0===n||0!==this.ttl||this.ttls||this.initializeTTLTracking(),a||this.setItemTTL(h,n,r),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return 0===this.size?this.tail:this.size===this.max&&0!==this.max?this.evict(!1):0!==this.free.length?this.free.pop():this.initialFill++}pop(){if(this.size){const t=this.valList[this.head];return this.evict(!0),t}}evict(t){const e=this.head,n=this.keyList[e],r=this.valList[e];return this.isBackgroundFetch(r)?r.__abortController.abort():(this.dispose(r,n,"evict"),this.disposeAfter&&this.disposed.push([r,n,"evict"])),this.removeItemSize(e),t&&(this.keyList[e]=null,this.valList[e]=null,this.free.push(e)),this.head=this.next[e],this.keyMap.delete(n),this.size--,e}has(t,{updateAgeOnHas:e=this.updateAgeOnHas}={}){const n=this.keyMap.get(t);return void 0!==n&&!this.isStale(n)&&(e&&this.updateItemAge(n),!0)}peek(t,{allowStale:e=this.allowStale}={}){const n=this.keyMap.get(t);if(void 0!==n&&(e||!this.isStale(n)))return this.valList[n]}backgroundFetch(t,e,n,r){const i=void 0===e?void 0:this.valList[e];if(this.isBackgroundFetch(i))return i;const s=new o,a={signal:s.signal,options:n,context:r},h=new Promise((e=>e(this.fetchMethod(t,i,a)))).then((e=>(s.signal.aborted||this.set(t,e,a.options),e)),(r=>{if(this.valList[e]===h&&(n.noDeleteOnFetchRejection&&void 0!==h.__staleWhileFetching?this.valList[e]=h.__staleWhileFetching:this.delete(t)),h.__returned===h)throw r}));return h.__abortController=s,h.__staleWhileFetching=i,h.__returned=null,void 0===e?(this.set(t,h,a.options),e=this.keyMap.get(t)):this.valList[e]=h,h}isBackgroundFetch(t){return t&&"object"==typeof t&&"function"==typeof t.then&&Object.prototype.hasOwnProperty.call(t,"__staleWhileFetching")&&Object.prototype.hasOwnProperty.call(t,"__returned")&&(t.__returned===t||null===t.__returned)}async fetch(t,{allowStale:e=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:i=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:s=0,sizeCalculation:a=this.sizeCalculation,noUpdateTTL:h=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,fetchContext:u=this.fetchContext}={}){if(!this.fetchMethod)return this.get(t,{allowStale:e,updateAgeOnGet:n,noDeleteOnStaleGet:r});const l={allowStale:e,updateAgeOnGet:n,noDeleteOnStaleGet:r,ttl:i,noDisposeOnSet:o,size:s,sizeCalculation:a,noUpdateTTL:h,noDeleteOnFetchRejection:c};let f=this.keyMap.get(t);if(void 0===f){const e=this.backgroundFetch(t,f,l,u);return e.__returned=e}{const r=this.valList[f];if(this.isBackgroundFetch(r))return e&&void 0!==r.__staleWhileFetching?r.__staleWhileFetching:r.__returned=r;if(!this.isStale(f))return this.moveToTail(f),n&&this.updateItemAge(f),r;const i=this.backgroundFetch(t,f,l,u);return e&&void 0!==i.__staleWhileFetching?i.__staleWhileFetching:i.__returned=i}}get(t,{allowStale:e=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet}={}){const i=this.keyMap.get(t);if(void 0!==i){const o=this.valList[i],s=this.isBackgroundFetch(o);if(this.isStale(i))return s?e?o.__staleWhileFetching:void 0:(r||this.delete(t),e?o:void 0);if(s)return;return this.moveToTail(i),n&&this.updateItemAge(i),o}}connect(t,e){this.prev[e]=t,this.next[t]=e}moveToTail(t){t!==this.tail&&(t===this.head?this.head=this.next[t]:this.connect(this.prev[t],this.next[t]),this.connect(this.tail,t),this.tail=t)}get del(){return l("del","delete"),this.delete}delete(t){let e=!1;if(0!==this.size){const n=this.keyMap.get(t);if(void 0!==n)if(e=!0,1===this.size)this.clear();else{this.removeItemSize(n);const e=this.valList[n];this.isBackgroundFetch(e)?e.__abortController.abort():(this.dispose(e,t,"delete"),this.disposeAfter&&this.disposed.push([e,t,"delete"])),this.keyMap.delete(t),this.keyList[n]=null,this.valList[n]=null,n===this.tail?this.tail=this.prev[n]:n===this.head?this.head=this.next[n]:(this.next[this.prev[n]]=this.next[n],this.prev[this.next[n]]=this.prev[n]),this.size--,this.free.push(n)}}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return e}clear(){for(const t of this.rindexes({allowStale:!0})){const e=this.valList[t];if(this.isBackgroundFetch(e))e.__abortController.abort();else{const n=this.keyList[t];this.dispose(e,n,"delete"),this.disposeAfter&&this.disposed.push([e,n,"delete"])}}if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return l("reset","clear"),this.clear}get length(){return((t,e)=>{const n="LRU_CACHE_PROPERTY_length";if(d(n)){const{prototype:e}=E,{get:r}=Object.getOwnPropertyDescriptor(e,t);p(n,"length property","cache.size",r)}})("length"),this.size}static get AbortController(){return o}static get AbortSignal(){return h}}t.exports=E},4473:t=>{t.exports=class extends Error{constructor(t,e){super(t||""),"object"==typeof e&&null!==e&&(e.code&&(this.code=String(e.code)),e.expected&&(this.expected=!0),e.transient&&(this.transient=!0),e.cause&&(this.cause=e.cause)),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}},6349:function(t,e){!function(t){const e=function(t,e){return t.slice(e-1).map(((n,r)=>t.slice(r,r+e)))};t.ngraminator=function(t,n){return n.reduce(((n,r)=>[...e(t,r),...n]),[]).sort()},Object.defineProperty(t,"__esModule",{value:!0})}(e)},4155:t=>{var e,n,r=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(n){try{return e.call(null,t,0)}catch(n){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var a,h=[],c=!1,u=-1;function l(){c&&a&&(c=!1,a.length?h=a.concat(h):u=-1,h.length&&f())}function f(){if(!c){var t=s(l);c=!0;for(var e=h.length;e;){for(a=h,h=[];++u1)for(var n=1;n{let r;t.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:n.g):t=>(r||(r=Promise.resolve())).then(t).catch((t=>setTimeout((()=>{throw t}),0)))},4281:t=>{var e={};function n(t,n,r){r||(r=Error);var i=function(t){var e,r;function i(e,r,i){return t.call(this,function(t,e,r){return"string"==typeof n?n:n(t,e,r)}(e,r,i))||this}return r=t,(e=i).prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r,i}(r);i.prototype.name=r.name,i.prototype.code=t,e[t]=i}function r(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map((function(t){return String(t)})),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:2===n?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}n("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(t,e,n){var i,o,s,a,h;if("string"==typeof e&&(o="not ",e.substr(0,o.length)===o)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,n){return(void 0===n||n>t.length)&&(n=t.length),t.substring(n-e.length,n)===e}(t," argument"))s="The ".concat(t," ").concat(i," ").concat(r(e,"type"));else{var c=("number"!=typeof h&&(h=0),h+".".length>(a=t).length||-1===a.indexOf(".",h)?"argument":"property");s='The "'.concat(t,'" ').concat(c," ").concat(i," ").concat(r(e,"type"))}return s+". Received type ".concat(typeof n)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.q=e},6753:(t,e,n)=>{var r=n(4155),i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=u;var o=n(9481),s=n(4229);n(5717)(u,o);for(var a=i(s.prototype),h=0;h{t.exports=i;var r=n(4605);function i(t){if(!(this instanceof i))return new i(t);r.call(this,t)}n(5717)(i,r),i.prototype._transform=function(t,e,n){n(null,t)}},9481:(t,e,n)=>{var r,i=n(4155);t.exports=L,L.ReadableState=S,n(7187).EventEmitter;var o,s=function(t,e){return t.listeners(e).length},a=n(2503),h=n(8764).Buffer,c=n.g.Uint8Array||function(){},u=n(4616);o=u&&u.debuglog?u.debuglog("stream"):function(){};var l,f,d,p=n(7327),y=n(1195),g=n(2457).getHighWaterMark,b=n(4281).q,m=b.ERR_INVALID_ARG_TYPE,E=b.ERR_STREAM_PUSH_AFTER_EOF,v=b.ERR_METHOD_NOT_IMPLEMENTED,w=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n(5717)(L,a);var _=y.errorOrDestroy,T=["error","close","destroy","pause","resume"];function S(t,e,i){r=r||n(6753),t=t||{},"boolean"!=typeof i&&(i=e instanceof r),this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g(this,t,"readableHighWaterMark",i),this.buffer=new p,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(l||(l=n(2553).s),this.decoder=new l(t.encoding),this.encoding=t.encoding)}function L(t){if(r=r||n(6753),!(this instanceof L))return new L(t);var e=this instanceof r;this._readableState=new S(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function A(t,e,n,r,i){o("readableAddChunk",e);var s,a=t._readableState;if(null===e)a.reading=!1,function(t,e){if(o("onEofChunk"),!e.ended){if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,e.sync?R(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,I(t)))}}(t,a);else if(i||(s=function(t,e){var n,r;return r=e,h.isBuffer(r)||r instanceof c||"string"==typeof e||void 0===e||t.objectMode||(n=new m("chunk",["string","Buffer","Uint8Array"],e)),n}(a,e)),s)_(t,s);else if(a.objectMode||e&&e.length>0)if("string"==typeof e||a.objectMode||Object.getPrototypeOf(e)===h.prototype||(e=function(t){return h.from(t)}(e)),r)a.endEmitted?_(t,new w):O(t,a,e,!0);else if(a.ended)_(t,new E);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!n?(e=a.decoder.write(e),a.objectMode||0!==e.length?O(t,a,e,!1):C(t,a)):O(t,a,e,!1)}else r||(a.reading=!1,C(t,a));return!a.ended&&(a.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=k?t=k:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function R(t){var e=t._readableState;o("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(o("emitReadable",e.flowing),e.emittedReadable=!0,i.nextTick(I,t))}function I(t){var e=t._readableState;o("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,M(t)}function C(t,e){e.readingMore||(e.readingMore=!0,i.nextTick(N,t,e))}function N(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function U(t){o("readable nexttick read 0"),t.read(0)}function P(t,e){o("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),M(t),e.flowing&&!e.reading&&t.read(0)}function M(t){var e=t._readableState;for(o("flow",e.flowing);e.flowing&&null!==t.read(););}function B(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):n=e.buffer.consume(t,e.decoder),n);var n}function j(t){var e=t._readableState;o("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,i.nextTick(F,e,t))}function F(t,e){if(o("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var n=e._writableState;(!n||n.autoDestroy&&n.finished)&&e.destroy()}}function V(t,e){for(var n=0,r=t.length;n=e.highWaterMark:e.length>0)||e.ended))return o("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?j(this):R(this),null;if(0===(t=x(t,e))&&e.ended)return 0===e.length&&j(this),null;var r,i=e.needReadable;return o("need readable",i),(0===e.length||e.length-t0?B(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&j(this)),null!==r&&this.emit("data",r),r},L.prototype._read=function(t){_(this,new v("_read()"))},L.prototype.pipe=function(t,e){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=t;break;case 1:r.pipes=[r.pipes,t];break;default:r.pipes.push(t)}r.pipesCount+=1,o("pipe count=%d opts=%j",r.pipesCount,e);var a=e&&!1===e.end||t===i.stdout||t===i.stderr?y:h;function h(){o("onend"),t.end()}r.endEmitted?i.nextTick(a):n.once("end",a),t.on("unpipe",(function e(i,s){o("onunpipe"),i===n&&s&&!1===s.hasUnpiped&&(s.hasUnpiped=!0,o("cleanup"),t.removeListener("close",d),t.removeListener("finish",p),t.removeListener("drain",c),t.removeListener("error",f),t.removeListener("unpipe",e),n.removeListener("end",h),n.removeListener("end",y),n.removeListener("data",l),u=!0,!r.awaitDrain||t._writableState&&!t._writableState.needDrain||c())}));var c=function(t){return function(){var e=t._readableState;o("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,M(t))}}(n);t.on("drain",c);var u=!1;function l(e){o("ondata");var i=t.write(e);o("dest.write",i),!1===i&&((1===r.pipesCount&&r.pipes===t||r.pipesCount>1&&-1!==V(r.pipes,t))&&!u&&(o("false write response, pause",r.awaitDrain),r.awaitDrain++),n.pause())}function f(e){o("onerror",e),y(),t.removeListener("error",f),0===s(t,"error")&&_(t,e)}function d(){t.removeListener("finish",p),y()}function p(){o("onfinish"),t.removeListener("close",d),y()}function y(){o("unpipe"),n.unpipe(t)}return n.on("data",l),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events.error?Array.isArray(t._events.error)?t._events.error.unshift(n):t._events.error=[n,t._events.error]:t.on(e,n)}(t,"error",f),t.once("close",d),t.once("finish",p),t.emit("pipe",n),r.flowing||(o("pipe resume"),n.resume()),t},L.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o0,!1!==r.flowing&&this.resume()):"readable"===t&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,o("on readable",r.length,r.reading),r.length?R(this):r.reading||i.nextTick(U,this))),n},L.prototype.addListener=L.prototype.on,L.prototype.removeListener=function(t,e){var n=a.prototype.removeListener.call(this,t,e);return"readable"===t&&i.nextTick(D,this),n},L.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||i.nextTick(D,this),e},L.prototype.resume=function(){var t=this._readableState;return t.flowing||(o("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,i.nextTick(P,t,e))}(this,t)),t.paused=!1,this},L.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},L.prototype.wrap=function(t){var e=this,n=this._readableState,r=!1;for(var i in t.on("end",(function(){if(o("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){o("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i||(n.objectMode||i&&i.length)&&(e.push(i)||(r=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var s=0;s{t.exports=u;var r=n(4281).q,i=r.ERR_METHOD_NOT_IMPLEMENTED,o=r.ERR_MULTIPLE_CALLBACK,s=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=r.ERR_TRANSFORM_WITH_LENGTH_0,h=n(6753);function c(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new o);n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length{var r,i=n(4155);function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;for(t.entry=null;r;){var i=r.callback;e.pendingcb--,i(undefined),r=r.next}e.corkedRequestsFree.next=t}(e,t)}}t.exports=L,L.WritableState=S;var s,a={deprecate:n(4927)},h=n(2503),c=n(8764).Buffer,u=n.g.Uint8Array||function(){},l=n(1195),f=n(2457).getHighWaterMark,d=n(4281).q,p=d.ERR_INVALID_ARG_TYPE,y=d.ERR_METHOD_NOT_IMPLEMENTED,g=d.ERR_MULTIPLE_CALLBACK,b=d.ERR_STREAM_CANNOT_PIPE,m=d.ERR_STREAM_DESTROYED,E=d.ERR_STREAM_NULL_VALUES,v=d.ERR_STREAM_WRITE_AFTER_END,w=d.ERR_UNKNOWN_ENCODING,_=l.errorOrDestroy;function T(){}function S(t,e,s){r=r||n(6753),t=t||{},"boolean"!=typeof s&&(s=e instanceof r),this.objectMode=!!t.objectMode,s&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=f(this,t,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,o=n.writecb;if("function"!=typeof o)throw new g;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,o){--e.pendingcb,n?(i.nextTick(o,r),i.nextTick(I,t,e),t._writableState.errorEmitted=!0,_(t,r)):(o(r),t._writableState.errorEmitted=!0,_(t,r),I(t,e))}(t,n,r,e,o);else{var s=x(n)||t.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||k(t,n),r?i.nextTick(O,t,n,s,o):O(t,n,s,o)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function L(t){var e=this instanceof(r=r||n(6753));if(!e&&!s.call(L,this))return new L(t);this._writableState=new S(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),h.call(this)}function A(t,e,n,r,i,o,s){e.writelen=r,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new m("write")):n?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function O(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),I(t,e)}function k(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),s=e.corkedRequestsFree;s.entry=n;for(var a=0,h=!0;n;)i[a]=n,n.isBuf||(h=!1),n=n.next,a+=1;i.allBuffers=h,A(t,e,!0,e.length,i,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,u=n.encoding,l=n.callback;if(A(t,e,!1,e.objectMode?1:c.length,c,u,l),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function x(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function R(t,e){t._final((function(n){e.pendingcb--,n&&_(t,n),e.prefinished=!0,t.emit("prefinish"),I(t,e)}))}function I(t,e){var n=x(e);if(n&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,i.nextTick(R,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var r=t._readableState;(!r||r.autoDestroy&&r.endEmitted)&&t.destroy()}return n}n(5717)(L,h),S.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(S.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(s=Function.prototype[Symbol.hasInstance],Object.defineProperty(L,Symbol.hasInstance,{value:function(t){return!!s.call(this,t)||this===L&&t&&t._writableState instanceof S}})):s=function(t){return t instanceof this},L.prototype.pipe=function(){_(this,new b)},L.prototype.write=function(t,e,n){var r,o=this._writableState,s=!1,a=!o.objectMode&&(r=t,c.isBuffer(r)||r instanceof u);return a&&!c.isBuffer(t)&&(t=function(t){return c.from(t)}(t)),"function"==typeof e&&(n=e,e=null),a?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof n&&(n=T),o.ending?function(t,e){var n=new v;_(t,n),i.nextTick(e,n)}(this,n):(a||function(t,e,n,r){var o;return null===n?o=new E:"string"==typeof n||e.objectMode||(o=new p("chunk",["string","Buffer"],n)),!o||(_(t,o),i.nextTick(r,o),!1)}(this,o,t,n))&&(o.pendingcb++,s=function(t,e,n,r,i,o){if(!n){var s=function(t,e,n){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=c.from(e,n)),e}(e,r,i);r!==s&&(n=!0,i="buffer",r=s)}var a=e.objectMode?1:r.length;e.length+=a;var h=e.length-1))throw new w(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(L.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(L.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),L.prototype._write=function(t,e,n){n(new y("_write()"))},L.prototype._writev=null,L.prototype.end=function(t,e,n){var r=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||function(t,e,n){e.ending=!0,I(t,e),n&&(e.finished?i.nextTick(n):t.once("finish",n)),e.ended=!0,t.writable=!1}(this,r,n),this},Object.defineProperty(L.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(L.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),L.prototype.destroy=l.destroy,L.prototype._undestroy=l.undestroy,L.prototype._destroy=function(t,e){e(t)}},5850:(t,e,n)=>{var r,i=n(4155);function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var s=n(8610),a=Symbol("lastResolve"),h=Symbol("lastReject"),c=Symbol("error"),u=Symbol("ended"),l=Symbol("lastPromise"),f=Symbol("handlePromise"),d=Symbol("stream");function p(t,e){return{value:t,done:e}}function y(t){var e=t[a];if(null!==e){var n=t[d].read();null!==n&&(t[l]=null,t[a]=null,t[h]=null,e(p(n,!1)))}}function g(t){i.nextTick(y,t)}var b=Object.getPrototypeOf((function(){})),m=Object.setPrototypeOf((o(r={get stream(){return this[d]},next:function(){var t=this,e=this[c];if(null!==e)return Promise.reject(e);if(this[u])return Promise.resolve(p(void 0,!0));if(this[d].destroyed)return new Promise((function(e,n){i.nextTick((function(){t[c]?n(t[c]):e(p(void 0,!0))}))}));var n,r=this[l];if(r)n=new Promise(function(t,e){return function(n,r){t.then((function(){e[u]?n(p(void 0,!0)):e[f](n,r)}),r)}}(r,this));else{var o=this[d].read();if(null!==o)return Promise.resolve(p(o,!1));n=new Promise(this[f])}return this[l]=n,n}},Symbol.asyncIterator,(function(){return this})),o(r,"return",(function(){var t=this;return new Promise((function(e,n){t[d].destroy(null,(function(t){t?n(t):e(p(void 0,!0))}))}))})),r),b);t.exports=function(t){var e,n=Object.create(m,(o(e={},d,{value:t,writable:!0}),o(e,a,{value:null,writable:!0}),o(e,h,{value:null,writable:!0}),o(e,c,{value:null,writable:!0}),o(e,u,{value:t._readableState.endEmitted,writable:!0}),o(e,f,{value:function(t,e){var r=n[d].read();r?(n[l]=null,n[a]=null,n[h]=null,t(p(r,!1))):(n[a]=t,n[h]=e)},writable:!0}),e));return n[l]=null,s(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=n[h];return null!==e&&(n[l]=null,n[a]=null,n[h]=null,e(t)),void(n[c]=t)}var r=n[a];null!==r&&(n[l]=null,n[a]=null,n[h]=null,r(p(void 0,!0))),n[u]=!0})),t.on("readable",g.bind(null,n)),n}},7327:(t,e,n)=>{function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){for(var n=0;n0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n}},{key:"concat",value:function(t){if(0===this.length)return s.alloc(0);for(var e,n,r,i=s.allocUnsafe(t>>>0),o=this.head,a=0;o;)e=o.data,n=i,r=a,s.prototype.copy.call(e,n,r),a+=o.data.length,o=o.next;return i}},{key:"consume",value:function(t,e){var n;return ti.length?i.length:t;if(o===i.length?r+=i:r+=i.slice(0,t),0==(t-=o)){o===i.length?(++n,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(t){var e=s.allocUnsafe(t),n=this.head,r=1;for(n.data.copy(e),t-=n.data.length;n=n.next;){var i=n.data,o=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,o),0==(t-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,e}},{key:h,value:function(t,e){return a(this,function(t){for(var e=1;e{var r=n(4155);function i(t,e){s(t,e),o(t)}function o(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function s(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var n=this,a=this._readableState&&this._readableState.destroyed,h=this._writableState&&this._writableState.destroyed;return a||h?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,r.nextTick(s,this,t)):r.nextTick(s,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?n._writableState?n._writableState.errorEmitted?r.nextTick(o,n):(n._writableState.errorEmitted=!0,r.nextTick(i,n,t)):r.nextTick(i,n,t):e?(r.nextTick(o,n),e(t)):r.nextTick(o,n)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var n=t._readableState,r=t._writableState;n&&n.autoDestroy||r&&r.autoDestroy?t.destroy(e):t.emit("error",e)}}},8610:(t,e,n)=>{var r=n(4281).q.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,n,o){if("function"==typeof n)return t(e,null,n);n||(n={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var n=arguments.length,r=new Array(n),i=0;i{t.exports=function(){throw new Error("Readable.from is not available in the browser")}},9946:(t,e,n)=>{var r,i=n(4281).q,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(t){if(t)throw t}function h(t,e,i,o){o=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(o);var a=!1;t.on("close",(function(){a=!0})),void 0===r&&(r=n(8610)),r(t,{readable:e,writable:i},(function(t){if(t)return o(t);a=!0,o()}));var h=!1;return function(e){if(!a&&!h)return h=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new s("pipe"))}}function c(t){t()}function u(t,e){return t.pipe(e)}function l(t){return t.length?"function"!=typeof t[t.length-1]?a:t.pop():a}t.exports=function(){for(var t=arguments.length,e=new Array(t),n=0;n0,(function(t){r||(r=t),t&&s.forEach(c),o||(s.forEach(c),i(r))}))}));return e.reduce(u)}},2457:(t,e,n)=>{var r=n(4281).q.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,n,i){var o=function(t,e,n){return null!=t.highWaterMark?t.highWaterMark:e?t[n]:null}(e,i,n);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new r(i?n:"highWaterMark",o);return Math.floor(o)}return t.objectMode?16:16384}}},2503:(t,e,n)=>{t.exports=n(7187).EventEmitter},8473:(t,e,n)=>{(e=t.exports=n(9481)).Stream=e,e.Readable=e,e.Writable=n(4229),e.Duplex=n(6753),e.Transform=n(4605),e.PassThrough=n(2725),e.finished=n(8610),e.pipeline=n(9946)},9967:(t,e,n)=>{t.exports=function(t,e,n){if("number"!=typeof e)throw new Error("second argument must be a Number");let i,o,s,a,h,c,u=!0;function l(t){function e(){n&&n(t,i),n=null}u?r(e):e()}function f(e,n,r){if(i[e]=r,n&&(h=!0),0==--s||n)l(n);else if(!h&&c{var r=n(396).Buffer,i=r.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=h,this.end=c,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=u,this.end=l,e=3;break;default:return this.write=f,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function s(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function h(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function u(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function f(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}e.s=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0?(i>0&&(t.lastNeed=i-1),i):--r=0?(i>0&&(t.lastNeed=i-2),i):--r=0?(i>0&&(2===i?i=0:t.lastNeed=i-3),i):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},396:(t,e,n)=>{var r=n(8764),i=r.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function s(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(o(r,e),e.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},s.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},971:t=>{t.exports=function(t,e){e=Object.assign({},{ngramLengths:[1]},e);const n=t.reduce(((t,n,r,i)=>(e.ngramLengths.forEach((e=>{var o=i.slice(r,r+e);o.length===e&&(n=JSON.stringify(o),t[n]=t[n]||[],t[n].push(r))})),t)),{});return Object.keys(n).map((t=>({term:JSON.parse(t),positions:n[t]}))).sort(((t,e)=>t.term[0]>e.term[0]))}},3692:t=>{var e=t.exports=function(t){return new n(t)};function n(t){this.value=t}function r(t,e,n){var r=[],s=[],u=!0;return function t(l){var f=n?i(l):l,d={},p=!0,y={node:f,node_:l,path:[].concat(r),parent:s[s.length-1],parents:s,key:r.slice(-1)[0],isRoot:0===r.length,level:r.length,circular:null,update:function(t,e){y.isRoot||(y.parent.node[y.key]=t),y.node=t,e&&(p=!1)},delete:function(t){delete y.parent.node[y.key],t&&(p=!1)},remove:function(t){a(y.parent.node)?y.parent.node.splice(y.key,1):delete y.parent.node[y.key],t&&(p=!1)},keys:null,before:function(t){d.before=t},after:function(t){d.after=t},pre:function(t){d.pre=t},post:function(t){d.post=t},stop:function(){u=!1},block:function(){p=!1}};if(!u)return y;function g(){if("object"==typeof y.node&&null!==y.node){y.keys&&y.node_===y.node||(y.keys=o(y.node)),y.isLeaf=0==y.keys.length;for(var t=0;t{function r(t){try{if(!n.g.localStorage)return!1}catch(t){return!1}var e=n.g.localStorage[t];return null!=e&&"true"===String(e).toLowerCase()}t.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}},1861:t=>{t.exports=t=>{const e=t=>"string"==typeof t||t instanceof String,n=(r,i)=>new Promise((async o=>{return null===r?o(JSON.stringify([null,"1.00"])):(s=r)&&0===Object.keys(s).length&&Object.getPrototypeOf(s)===Object.prototype?o(JSON.stringify([[],"1.00"])):Number.isInteger(r)?o(JSON.stringify([r,r])):e(r)?o(t.tokenizer(r,i,t)):(t=>"object"==typeof t&&null!==t&&!Array.isArray(t))(r)?o((a=r,new Promise((async e=>{const r={};for(const e in a)r[e]=await n(a[e],e,t);return e(r)})))):(t=>Array.isArray(t))(r)?o((h=r,Promise.all(h.map(n)))):o(r);var s,a,h})),r=async r=>new Promise((async i=>{e(r)&&(r={body:r}),Object.prototype.hasOwnProperty.call(r,"_id")||(r._id=t.idGenerator.next().value);const o={};for(const t in r)o[t]="_id"!==t?await n(r[t],t):r[t];return i(o)}));return{processDocuments:t=>Promise.all(t.map(r))}}},2225:(t,e,n)=>{const r=n(9203),i=n(7155),o=n(9593),s=n(6291),a=n(6761),h=n(4147),c=t=>new Promise((async e=>{const r=new o({max:1e3}),h=new((await Promise.resolve().then(n.bind(n,5613))).default)({concurrency:1}),c=a(t,r,h),u=s(t,r);return c._INCREMENT_DOC_COUNT(0).then((()=>e({_AND:t.fii.AND,_BUCKET:t.fii.BUCKET,_GET:t.fii.GET,_NOT:t.fii.NOT,_OR:t.fii.OR,_CACHE:r,_PAGE:u.PAGE,_SCORE:u.SCORE,_SEARCH:u.SEARCH,_SORT:u.SORT,DELETE:c.DELETE,FLUSH:c.FLUSH,IMPORT:c.IMPORT,PUT:c.PUT,PUT_RAW:c.PUT_RAW,TOKENIZATION_PIPELINE_STAGES:i,ALL_DOCUMENTS:u.ALL_DOCUMENTS,BUCKETS:t.fii.BUCKETS,CREATED:t.fii.CREATED,DICTIONARY:u.DICTIONARY,DISTINCT:u.DISTINCT,DOCUMENTS:u.DOCUMENTS,DOCUMENT_COUNT:u.DOCUMENT_COUNT,EXPORT:t.fii.EXPORT,FACETS:u.FACETS,FIELDS:t.fii.FIELDS,INDEX:t.fii,LAST_UPDATED:t.fii.LAST_UPDATED,MAX:t.fii.MAX,MIN:t.fii.MIN,QUERY:u.QUERY,SEARCH:u.SEARCH})))}));t.exports=t=>((t={})=>new Promise(((e,n)=>(t=Object.assign({cacheLength:1e3,caseSensitive:!1,docExistsSpace:"DOC_RAW",idGenerator:function*(){let t=0;for(;;)yield Date.now()+"-"+t++}(),skipFields:[],ngrams:{},replace:{},storeRawDocs:!0,stopwords:[],storeVectors:!0,tokenAppend:"#",tokenSplitRegex:/[\p{L}\d]+/gu,tokenizer:i.tokenizer},t),r(t).then((n=>e(Object.assign({fii:n},t))))))))(t).then(c).then((t=>(t=>new Promise(((e,n)=>{const r=["CREATED_WITH"],i="search-index@"+h.version;return t.INDEX.STORE.get(r).then((t=>i===t?e():n(new Error("This index was created with "+t+", you are running "+i)))).catch((n=>t.INDEX.STORE.put(r,i).then(e)))})))(t).then((()=>t))))},6291:(t,e,n)=>{const{EntryStream:r}=n(6741);t.exports=(t,e)=>{const n=e=>new Promise(((n,i)=>{const o=[];new r(t.fii.STORE,{gte:["DOC_RAW",null],lte:["DOC_RAW",void 0],limit:e}).on("data",(t=>o.push({_id:t.value._id,_doc:t.value}))).on("end",(()=>n(o)))})),i=(...e)=>e.length?Promise.all(e.map((e=>t.fii.STORE.get(["DOC_RAW",e]).catch((t=>null))))):n(),o=(...e)=>t.fii.DISTINCT(...e).then((t=>[...t.reduce(((t,e)=>t.add(JSON.stringify(Object.assign(e,{VALUE:e.VALUE})))),new Set)].map(JSON.parse))),s=(...e)=>t.fii.FACETS(...e).then((t=>[...t.reduce(((t,e)=>t.add(JSON.stringify(Object.assign(e,{VALUE:e.VALUE})))),new Set)].map(JSON.parse))),a=(t,e)=>{const n=(e=Object.assign({NUMBER:0,SIZE:20},e||{})).NUMBER*e.SIZE,r=n+e.SIZE||void 0;return t.slice(n,r)},h=(t,e={})=>{const n=t=>!e.FIELDS||e.FIELDS.includes(t.FIELD);return"TFIDF"===(e=Object.assign({TYPE:"TFIDF"},e)).TYPE?u().then((e=>t.map(((t,r,i)=>{const o=Math.log((e+1)/i.length);return t._score=+t._match.filter(n).reduce(((t,e)=>t+o*+e.SCORE),0).toFixed(2),t})))):"PRODUCT"===e.TYPE?new Promise((e=>e(t.map((t=>(t._score=+t._match.filter(n).reduce(((t,e)=>t*+e.SCORE),1).toFixed(2),t)))))):"CONCAT"===e.TYPE?new Promise((e=>e(t.map((t=>(t._score=t._match.filter(n).reduce(((t,e)=>t+e.SCORE),""),t)))))):"SUM"===e.TYPE?new Promise((e=>e(t.map((t=>(t._score=+t._match.filter(n).reduce(((t,e)=>t+ +e.SCORE),0).toFixed(2),t)))))):"VALUE"===e.TYPE?new Promise((e=>e(t.map((t=>(t._score=t._match.filter(n).reduce(((t,e)=>t+e.VALUE),""),t)))))):void 0},c=(t,e)=>(e=Object.assign({DIRECTION:"DESCENDING",TYPE:"NUMERIC"},e||{}),t.sort(((t,e)=>t._ide._id?1:0)).sort({NUMERIC:{DESCENDING:(t,e)=>+e._score-+t._score,ASCENDING:(t,e)=>+t._score-+e._score},ALPHABETIC:{DESCENDING:(t,e)=>t._scoree._score?-1:0,ASCENDING:(t,e)=>t._scoree._score?1:0}}[e.TYPE][e.DIRECTION])),u=()=>t.fii.STORE.get(["DOCUMENT_COUNT"]),l=(e,r={})=>{const o=e=>"string"==typeof e||"number"==typeof e?t.fii.GET(e,r.PIPELINE):e.FIELD||e.VALUE?t.fii.GET(e):e.AND?t.fii.AND(e.AND.map(o),r.PIPELINE):e.GET?t.fii.GET(e.GET,r.PIPELINE):e.NOT?t.fii.NOT(o(e.NOT.INCLUDE),o(e.NOT.EXCLUDE)):e.OR?t.fii.OR(e.OR.map(o),r.PIPELINE):e.ALL_DOCUMENTS?n(e.ALL_DOCUMENTS):void 0;return o(e).then((t=>t.RESULT?Object.assign(t,{RESULT_LENGTH:t.RESULT.length}):{RESULT:t,RESULT_LENGTH:t.length})).then((e=>r.BUCKETS?t.fii.BUCKETS(...r.BUCKETS).then((n=>Object.assign(e,{BUCKETS:t.fii.AGGREGATION_FILTER(n,e.RESULT)}))):e)).then((n=>r.FACETS?n.RESULT.length?e.ALL_DOCUMENTS?s(...r.FACETS).then((t=>Object.assign(n,{FACETS:t}))):s(...r.FACETS).then((e=>Object.assign(n,{FACETS:t.fii.AGGREGATION_FILTER(e,n.RESULT)}))):Object.assign(n,{FACETS:[]}):n)).then((t=>{return r.WEIGHT?Object.assign({RESULT:(e=t.RESULT,n=r.WEIGHT,e.map((t=>(t._match=t._match.map((t=>(n.forEach((e=>{let n=!1;e.FIELD&&e.VALUE?e.FIELD===t.FIELD&&e.VALUE===t.VALUE&&(n=!0):e.FIELD?e.FIELD===t.FIELD&&(n=!0):e.VALUE&&e.VALUE===t.VALUE&&(n=!0),n&&(t.SCORE=(e.WEIGHT*+t.SCORE).toFixed(2))})),t))),t))))},t):t;var e,n})).then((t=>r.SCORE?h(t.RESULT,r.SCORE).then((e=>Object.assign(t,{RESULT:e}))):t)).then((t=>Object.assign(t,r.SORT?{RESULT:c(t.RESULT,r.SORT)}:{}))).then((t=>Object.assign(t,r.PAGE?{RESULT:a(t.RESULT,r.PAGE)}:{}))).then((t=>r.DOCUMENTS?i(...t.RESULT.map((t=>t._id))).then((e=>Object.assign(t,{RESULT:t.RESULT.map(((t,n)=>Object.assign(t,{_doc:e[n]})))}))):t))},f=(t,n)=>new Promise((r=>(n=JSON.stringify(n),e.has(n)?r(e.get(n)):t.then((t=>e.set(n,t))).then((()=>r(e.get(n)))))));return{ALL_DOCUMENTS:n,DICTIONARY:t=>f((t=>o(t).then((t=>Array.from(t.reduce(((t,e)=>t.add(e.VALUE)),new Set)).sort(((t,e)=>(t+"").localeCompare(e+"",void 0,{numeric:!0,sensitivity:"base"}))))))(t),{DICTIONARY:t||null}),DISTINCT:o,DOCUMENTS:(...t)=>f(i(...t),{DOCUMENTS:t}),DOCUMENT_COUNT:u,FACETS:s,PAGE:a,QUERY:(t,e)=>f(l(t,e),{QUERY:[t,e]}),SCORE:h,SEARCH:(t,e)=>f(((t,e)=>l({AND:[...t]},Object.assign({SCORE:{TYPE:"TFIDF"},SORT:!0},e)))(t,e),{SEARCH:[t,e]}),SORT:c}}},7155:(t,e,n)=>{const r=n(971),{ngraminator:i}=n(6349),o=([t,e,n])=>Promise.resolve([t.match(n.tokenSplitRegex)||[],e,n]),s=([t,e,n])=>[n.skipFields.includes(e)?[]:t,e,n],a=([t,e,n])=>Promise.resolve([t.map((t=>n.caseSensitive?t:t.toLowerCase())),e,n]),h=([t,e,n])=>{const{fields:r,values:i}=n.replace,o=()=>t.reduce(((t,e)=>[e,...t,...i[e]||[]]),[]);return i?r?r.includes(e)?Promise.resolve([o(),e,n]):Promise.resolve([t,e,n]):Promise.resolve([o(),e,n]):Promise.resolve([t,e,n])},c=([t,e,n])=>{let{fields:r,lengths:o,join:s=" "}=n.ngrams;return r||(r=[e]),o&&r.includes(e)?[i(t.filter((t=>null!==t)),o).map((t=>t.join(s))),e,n]:Promise.resolve([t,e,n])},u=([t,e,n])=>[t.filter((t=>!n.stopwords.includes(t.toLowerCase()))),e,n],l=([t,e,n])=>{const i=r(t),o=i.reduce(((t,e)=>Math.max(e.positions.length,t)),0);return Promise.resolve([i.map((t=>JSON.stringify([t.term[0],(t.positions.length/o).toFixed(2)]))).sort(),e,n])};e.SPY=([t,e,n])=>(console.log("----------------"),console.log("field ->"),console.log(e),console.log("tokens ->"),console.log(t),console.log("----------------"),Promise.resolve([t,e,n])),e.tokenizer=(t,e,n)=>o([t,e,n]).then(s).then(a).then(h).then(c).then(u).then(l).then((([t,e,n])=>t)),e.SPLIT=o,e.SKIP=s,e.LOWACASE=a,e.REPLACE=h,e.NGRAMS=c,e.STOPWORDS=u,e.SCORE_TERM_FREQUENCY=l},6761:(t,e,n)=>{const r=n(1861);t.exports=(t,e,n)=>{const i=e=>t.fii.STORE.get(["DOCUMENT_COUNT"]).then((n=>t.fii.STORE.put(["DOCUMENT_COUNT"],+n+e))).catch((n=>t.fii.STORE.put(["DOCUMENT_COUNT"],e))),o=(n,r,i)=>(e.clear(),Promise.all(n.map(((e,n)=>t.fii.STORE.put(["DOC_RAW",r[n]],i?{}:e)))).then((t=>n.map(((t,e)=>({_id:r[e],status:"OK",operation:"_PUT_RAW"}))))));return{DELETE:(...n)=>{return r=n,t.fii.DELETE(r).then((n=>{e.clear();const r=n.filter((t=>"DELETED"===t.status));return Promise.all([Promise.all(r.map((e=>t.fii.STORE.del(["DOC_RAW",e._id])))),(i=r.length,t.fii.STORE.get(["DOCUMENT_COUNT"]).then((e=>t.fii.STORE.put(["DOCUMENT_COUNT"],+e-i))))]).then((()=>n));var i}));var r},FLUSH:()=>t.fii.STORE.clear().then((()=>{e.clear();const n=Date.now();return t.fii.STORE.batch([{type:"put",key:["~CREATED"],value:n},{type:"put",key:["~LAST_UPDATED"],value:n},{type:"put",key:["DOCUMENT_COUNT"],value:0}])})).then((()=>!0)),IMPORT:n=>(e.clear(),Promise.resolve(t.fii.IMPORT(n))),PUT:(s,a)=>n.add((()=>((n,s)=>(e.clear(),s=Object.assign(t,s),r(t).processDocuments(n).then((e=>t.fii.PUT(e,s).then((e=>Promise.all([o(n,e.map((t=>t._id)),!t.storeRawDocs),i(e.filter((t=>"CREATED"===t.status)).length)]).then((()=>e))))))))(s,a))),PUT_RAW:o,_INCREMENT_DOC_COUNT:i}}},2361:()=>{},4616:()=>{},5613:(t,e,n)=>{n.r(e),n.d(e,{AbortError:()=>z,default:()=>W});var r=n(6729);class i extends Error{constructor(t){super(t),this.name="TimeoutError"}}class o extends Error{constructor(t){super(),this.name="AbortError",this.message=t}}const s=t=>void 0===globalThis.DOMException?new o(t):new DOMException(t),a=t=>{const e=void 0===t.reason?s("This operation was aborted."):t.reason;return e instanceof Error?e:s(e)};var h,c=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)};class u{constructor(){h.set(this,[])}enqueue(t,e){const n={priority:(e={priority:0,...e}).priority,run:t};if(this.size&&c(this,h,"f")[this.size-1].priority>=e.priority)return void c(this,h,"f").push(n);const r=function(t,e,n){let r=0,i=t.length;for(;i>0;){const n=Math.trunc(i/2);let s=r+n;o=t[s],e.priority-o.priority<=0?(r=++s,i-=n+1):i=n}var o;return r}(c(this,h,"f"),n);c(this,h,"f").splice(r,0,n)}dequeue(){const t=c(this,h,"f").shift();return null==t?void 0:t.run}filter(t){return c(this,h,"f").filter((e=>e.priority===t.priority)).map((t=>t.run))}get size(){return c(this,h,"f").length}}h=new WeakMap;var l,f,d,p,y,g,b,m,E,v,w,_,T,S,L,A,O,k,x,R,I,C,N,D,U,P,M,B,j=function(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n},F=function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)};const V=()=>{},G=new i;class z extends Error{}class W extends r{constructor(t){var e,n,r,i;if(super(),l.add(this),f.set(this,void 0),d.set(this,void 0),p.set(this,0),y.set(this,void 0),g.set(this,void 0),b.set(this,0),m.set(this,void 0),E.set(this,void 0),v.set(this,void 0),w.set(this,void 0),_.set(this,0),T.set(this,void 0),S.set(this,void 0),L.set(this,V),A.set(this,V),O.set(this,void 0),k.set(this,void 0),!("number"==typeof(t={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:u,...t}).intervalCap&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${null!==(n=null===(e=t.intervalCap)||void 0===e?void 0:e.toString())&&void 0!==n?n:""}\` (${typeof t.intervalCap})`);if(void 0===t.interval||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${null!==(i=null===(r=t.interval)||void 0===r?void 0:r.toString())&&void 0!==i?i:""}\` (${typeof t.interval})`);j(this,f,t.carryoverConcurrencyCount,"f"),j(this,d,t.intervalCap===Number.POSITIVE_INFINITY||0===t.interval,"f"),j(this,y,t.intervalCap,"f"),j(this,g,t.interval,"f"),j(this,v,new t.queueClass,"f"),j(this,w,t.queueClass,"f"),this.concurrency=t.concurrency,j(this,O,t.timeout,"f"),j(this,k,!0===t.throwOnTimeout,"f"),j(this,S,!1===t.autoStart,"f")}get concurrency(){return F(this,T,"f")}set concurrency(t){if(!("number"==typeof t&&t>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);j(this,T,t,"f"),F(this,l,"m",B).call(this)}async add(t,e={}){return new Promise(((n,r)=>{F(this,v,"f").enqueue((async()=>{var i,o,s;j(this,_,(o=F(this,_,"f"),++o),"f"),j(this,p,(s=F(this,p,"f"),++s),"f");try{if(null===(i=e.signal)||void 0===i?void 0:i.aborted)return void r(new z("The task was aborted."));const o=void 0===F(this,O,"f")&&void 0===e.timeout?t({signal:e.signal}):function(t,e,n,r){let i;const o=new Promise(((o,s)=>{if("number"!=typeof e||1!==Math.sign(e))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${e}\``);if(e!==Number.POSITIVE_INFINITY){if((r={customTimers:{setTimeout,clearTimeout},...r}).signal){const{signal:t}=r;t.aborted&&s(a(t)),t.addEventListener("abort",(()=>{s(a(t))}))}i=r.customTimers.setTimeout.call(void 0,(()=>{try{o(n())}catch(t){s(t)}}),e),(async()=>{try{o(await t)}catch(t){s(t)}finally{r.customTimers.clearTimeout.call(void 0,i)}})()}else o(t)}));return o.clear=()=>{clearTimeout(i),i=void 0},o}(Promise.resolve(t({signal:e.signal})),void 0===e.timeout?F(this,O,"f"):e.timeout,(()=>{(void 0===e.throwOnTimeout?F(this,k,"f"):e.throwOnTimeout)&&r(G)})),s=await o;n(s),this.emit("completed",s)}catch(t){r(t),this.emit("error",t)}F(this,l,"m",I).call(this)}),e),F(this,l,"m",U).call(this),this.emit("add")}))}async addAll(t,e){return Promise.all(t.map((async t=>this.add(t,e))))}start(){return F(this,S,"f")?(j(this,S,!1,"f"),F(this,l,"m",B).call(this),this):this}pause(){j(this,S,!0,"f")}clear(){j(this,v,new(F(this,w,"f")),"f")}async onEmpty(){if(0!==F(this,v,"f").size)return new Promise((t=>{const e=F(this,L,"f");j(this,L,(()=>{e(),t()}),"f")}))}async onSizeLessThan(t){if(!(F(this,v,"f").size{const n=()=>{F(this,v,"f").size{const e=F(this,A,"f");j(this,A,(()=>{e(),t()}),"f")}))}get size(){return F(this,v,"f").size}sizeBy(t){return F(this,v,"f").filter(t).length}get pending(){return F(this,_,"f")}get isPaused(){return F(this,S,"f")}get timeout(){return F(this,O,"f")}set timeout(t){j(this,O,t,"f")}}f=new WeakMap,d=new WeakMap,p=new WeakMap,y=new WeakMap,g=new WeakMap,b=new WeakMap,m=new WeakMap,E=new WeakMap,v=new WeakMap,w=new WeakMap,_=new WeakMap,T=new WeakMap,S=new WeakMap,L=new WeakMap,A=new WeakMap,O=new WeakMap,k=new WeakMap,l=new WeakSet,x=function(){return F(this,d,"f")||F(this,p,"f"){F(this,l,"m",N).call(this)}),e),"f"),!0;j(this,p,F(this,f,"f")?F(this,_,"f"):0,"f")}return!1},U=function(){if(0===F(this,v,"f").size)return F(this,m,"f")&&clearInterval(F(this,m,"f")),j(this,m,void 0,"f"),F(this,l,"m",C).call(this),!1;if(!F(this,S,"f")){const t=!F(this,l,"m",D).call(this);if(F(this,l,"a",x)&&F(this,l,"a",R)){const e=F(this,v,"f").dequeue();return!!e&&(this.emit("active"),e(),t&&F(this,l,"m",P).call(this),!0)}}return!1},P=function(){F(this,d,"f")||void 0!==F(this,m,"f")||(j(this,m,setInterval((()=>{F(this,l,"m",M).call(this)}),F(this,g,"f")),"f"),j(this,b,Date.now()+F(this,g,"f"),"f"))},M=function(){0===F(this,p,"f")&&0===F(this,_,"f")&&F(this,m,"f")&&(clearInterval(F(this,m,"f")),j(this,m,void 0,"f")),j(this,p,F(this,f,"f")?F(this,_,"f"):0,"f"),F(this,l,"m",B).call(this)},B=function(){for(;F(this,l,"m",U).call(this););}},4147:t=>{t.exports=JSON.parse('{"name":"search-index","version":"3.3.0","description":"A network resilient, persistent full-text search library for the browser and Node.js","keywords":["search","elasticsearch","elastic","lunr.js","flexsearch","norch","solr"],"engines":{"node":">=12"},"main":"src/node.js","browser":"src/browser.js","files":["dist","src"],"directories":{"lib":"src"},"scripts":{"build":"npm run empty-sandbox && rm -rf ./dist/* && webpack && cp dist/search-index-$npm_package_version.js dist/search-index.js","demo-export":"node demo/generate-index/export.js","demo-fetch":"node demo/generate-index/fetch.js","demo-process":"node demo/generate-index/process.js","demo-rebuild":"npm run demo-fetch && npm run demo-process && npm run demo-export && npm run demo-link-lib","demo-start":"http-server -c-1 demo & open-cli http://127.0.0.1:8080","demo-link-lib":"cd demo/lib && ln -sf ../../dist/search-index.js && cd ../../","empty-sandbox":"rm -rf fii && rm -rf test/sandbox && mkdir test/sandbox","lint":"standard --fix test/src/* src/* demo/src/* demo/generate-index/*.js","test":"npm run empty-sandbox && npm run test-node && npm run test-browser && npm run lint","test-browser":"npm run build && cat test/sandbox/browser-tests.js | tape-run","test-node":"npm run empty-sandbox && tape test/src/*-test.js","toc":"doctoc docs/API.md --title \'# API Documentation for search-index\' && doctoc docs/FAQ.md --title \'# FAQ\'"},"repository":{"type":"git","url":"git+https://github.com/fergiemcdowall/search-index.git"},"author":"Fergus McDowall","license":"MIT","bugs":{"url":"https://github.com/fergiemcdowall/search-index/issues"},"homepage":"https://fergiemcdowall.github.io/search-index/","devDependencies":{"assert":"^2.0.0","doctoc":"^2.2.0","fuzzyset":"1.0.5","http-server":"14.1.0","memory-level":"^1.0.0","open-cli":"^7.0.1","os-browserify":"^0.3.0","path":"^0.12.7","path-browserify":"^1.0.1","process":"^0.11.10","standard":"^17.0.0","stemmer":"^1.0.5","stopword":"^2.0.2","stream-browserify":"^3.0.0","tape":"^5.5.3","tape-run":"^10.0.0","webpack":"^5.72.0","webpack-cli":"^4.9.2","world-bank-dataset":"^1.0.0"},"dependencies":{"browser-level":"^1.0.1","classic-level":"^1.2.0","fergies-inverted-index":"^10.1.0","level-read-stream":"^1.1.0","lru-cache":"^7.9.0","ngraminator":"^3.0.1","p-queue":"^7.2.0","term-vector":"^1.0.0"}}')}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={exports:{}};return t[r].call(o.exports,o,o.exports,n),o.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n(2225); \ No newline at end of file diff --git a/dist/search-index-esm-3.3.0.js.LICENSE.txt b/dist/search-index-esm-3.3.0.js.LICENSE.txt new file mode 100644 index 00000000..603d19e3 --- /dev/null +++ b/dist/search-index-esm-3.3.0.js.LICENSE.txt @@ -0,0 +1,14 @@ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ + +/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ + +/*! queue-microtask. MIT License. Feross Aboukhadijeh */ + +/*! run-parallel-limit. MIT License. Feross Aboukhadijeh */ + +/*! safe-buffer. MIT License. Feross Aboukhadijeh */ diff --git a/test/src/LAST_UPDATED-test.js b/test/src/LAST_UPDATED-test.js new file mode 100644 index 00000000..e3276bbe --- /dev/null +++ b/test/src/LAST_UPDATED-test.js @@ -0,0 +1,52 @@ +const si = require('../../') +const test = require('tape') + +const sandbox = 'test/sandbox/' +const indexName = sandbox + 'LAST_UPDATED' + +let timestamp + +test('create index', t => { + t.plan(1) + si({ name: indexName }).then(db => { + global[indexName] = db + t.ok(db, !undefined) + }) +}) + +test('timestamp was created', t => { + t.plan(1) + global[indexName].INDEX.STORE.get(['~LAST_UPDATED']).then(lastUpdated => { + timestamp = lastUpdated + return t.pass('timestamp created') + }) +}) + +test('can read LAST_UPDATED timestamp with API', t => { + t.plan(1) + global[indexName].LAST_UPDATED().then(res => t.equals(res, timestamp)) +}) + +test('is valid timestamp', t => { + t.plan(1) + global[indexName].INDEX.STORE.get(['~LAST_UPDATED']).then(lastUpdated => + t.ok(new Date(lastUpdated)) + ) +}) + +test('update index', t => { + t.plan(1) + global[indexName] + .PUT([ + { + _id: 0, + body: 'test doc' + } + ]) + .then(res => t.ok(true)) +}) + +test('LAST_UPDATED timestamp has increased', t => { + t.plan(1) + global[indexName].LAST_UPDATED().then(res => t.ok(res > timestamp)) +})