basebee
Version:
Basebee is a powerful key-value store built on top of Autobase and Hyperbee, designed to efficiently manage data with customizable key/value encodings, prefix-based key organization, and batch operations. It integrates stream-based APIs for handling key-v
81 lines (73 loc) • 709 kB
JavaScript
/**
* Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
* Original file: /npm/queue-tick@1.0.1/queue-microtask.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
var e$t="function"==typeof queueMicrotask?queueMicrotask:e=>Promise.resolve().then(e);
/**
* Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
* Original file: /npm/fast-fifo@1.3.2/index.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
const t$w=class t{constructor(t){if(!(t>0)||0!=(t-1&t))throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(t),this.mask=t-1,this.top=0,this.btm=0,this.next=null;}clear(){this.top=this.btm=0,this.next=null,this.buffer.fill(void 0);}push(t){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=t,this.top=this.top+1&this.mask,!0)}shift(){const t=this.buffer[this.btm];if(void 0!==t)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,t}peek(){return this.buffer[this.btm]}isEmpty(){return void 0===this.buffer[this.btm]}};var i$r=class i{constructor(i){this.hwm=i||16,this.head=new t$w(this.hwm),this.tail=this.head,this.length=0;}clear(){this.head=this.tail,this.head.clear(),this.length=0;}push(i){if(this.length++,!this.head.push(i)){const h=this.head;this.head=h.next=new t$w(2*this.head.buffer.length),this.head.push(i);}}shift(){0!==this.length&&this.length--;const t=this.tail.shift();if(void 0===t&&this.tail.next){const t=this.tail.next;return this.tail.next=null,this.tail=t,this.tail.shift()}return t}peek(){const t=this.tail.peek();return void 0===t&&this.tail.next?this.tail.next.peek():t}isEmpty(){return 0===this.length}};
/**
* Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
* Original file: /npm/text-decoder@1.2.0/index.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
var e$s=class e{constructor(e){this.decoder=new TextDecoder("utf16le"===e?"utf16-le":e);}get remaining(){return -1}decode(e){return this.decoder.decode(e,{stream:!0})}flush(){return this.decoder.decode(new Uint8Array(0))}};const t$v=e$s,r$A=e$s;var s$x=class s{constructor(e="utf8"){switch(this.encoding=function(e){switch(e=e.toLowerCase()){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 e;default:throw new Error("Unknown encoding: "+e)}}(e),this.encoding){case"utf8":this.decoder=new r$A;break;case"utf16le":case"base64":throw new Error("Unsupported encoding: "+this.encoding);default:this.decoder=new t$v(this.encoding);}}get remaining(){return this.decoder.remaining}push(e){return "string"==typeof e?e:this.decoder.decode(e)}write(e){return this.push(e)}end(e){let t="";return e&&(t=this.push(e)),t+=this.decoder.flush(),t}};
/**
* Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
* Original file: /npm/streamx@2.20.1/index.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
function r$z(t){return t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n$z(){}function s$w(){s$w.init.call(this);}function a$n(t){return void 0===t._maxListeners?s$w.defaultMaxListeners:t._maxListeners}function l$l(t,e,i,r){var s,l,u,h;if("function"!=typeof i)throw new TypeError('"listener" argument must be a function');if((l=t._events)?(l.newListener&&(t.emit("newListener",e,i.listener?i.listener:i),l=t._events),u=l[e]):(l=t._events=new n$z,t._eventsCount=0),u){if("function"==typeof u?u=l[e]=r?[i,u]:[u,i]:r?u.unshift(i):u.push(i),!u.warned&&(s=a$n(t))&&s>0&&u.length>s){u.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+e+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=t,o.type=e,o.count=u.length,h=o,"function"==typeof console.warn?console.warn(h):console.log(h);}}else u=l[e]=i,++t._eventsCount;return t}function u$n(t,e,i){var r=!1;function n(){t.removeListener(e,n),r||(r=!0,i.apply(t,arguments));}return n.listener=i,n}function h$m(t){var e=this._events;if(e){var i=e[t];if("function"==typeof i)return 1;if(i)return i.length}return 0}function o$w(t,e){for(var i=new Array(e);e--;)i[e]=t[e];return i}n$z.prototype=Object.create(null),s$w.EventEmitter=s$w,s$w.usingDomains=!1,s$w.prototype.domain=void 0,s$w.prototype._events=void 0,s$w.prototype._maxListeners=void 0,s$w.defaultMaxListeners=10,s$w.init=function(){this.domain=null,s$w.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new n$z,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0;},s$w.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||isNaN(t))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=t,this},s$w.prototype.getMaxListeners=function(){return a$n(this)},s$w.prototype.emit=function(t){var e,i,r,n,s,a,l,u="error"===t;if(a=this._events)u=u&&null==a.error;else if(!u)return !1;if(l=this.domain,u){if(e=arguments[1],!l){if(e instanceof Error)throw e;var h=new Error('Uncaught, unspecified "error" event. ('+e+")");throw h.context=e,h}return e||(e=new Error('Uncaught, unspecified "error" event')),e.domainEmitter=this,e.domain=l,e.domainThrown=!1,l.emit("error",e),!1}if(!(i=a[t]))return !1;var d="function"==typeof i;switch(r=arguments.length){case 1:!function(t,e,i){if(e)t.call(i);else for(var r=t.length,n=o$w(t,r),s=0;s<r;++s)n[s].call(i);}(i,d,this);break;case 2:!function(t,e,i,r){if(e)t.call(i,r);else for(var n=t.length,s=o$w(t,n),a=0;a<n;++a)s[a].call(i,r);}(i,d,this,arguments[1]);break;case 3:!function(t,e,i,r,n){if(e)t.call(i,r,n);else for(var s=t.length,a=o$w(t,s),l=0;l<s;++l)a[l].call(i,r,n);}(i,d,this,arguments[1],arguments[2]);break;case 4:!function(t,e,i,r,n,s){if(e)t.call(i,r,n,s);else for(var a=t.length,l=o$w(t,a),u=0;u<a;++u)l[u].call(i,r,n,s);}(i,d,this,arguments[1],arguments[2],arguments[3]);break;default:for(n=new Array(r-1),s=1;s<r;s++)n[s-1]=arguments[s];!function(t,e,i,r){if(e)t.apply(i,r);else for(var n=t.length,s=o$w(t,n),a=0;a<n;++a)s[a].apply(i,r);}(i,d,this,n);}return !0},s$w.prototype.addListener=function(t,e){return l$l(this,t,e,!1)},s$w.prototype.on=s$w.prototype.addListener,s$w.prototype.prependListener=function(t,e){return l$l(this,t,e,!0)},s$w.prototype.once=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.on(t,u$n(this,t,e)),this},s$w.prototype.prependOnceListener=function(t,e){if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');return this.prependListener(t,u$n(this,t,e)),this},s$w.prototype.removeListener=function(t,e){var i,r,s,a,l;if("function"!=typeof e)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(i=r[t]))return this;if(i===e||i.listener&&i.listener===e)0==--this._eventsCount?this._events=new n$z:(delete r[t],r.removeListener&&this.emit("removeListener",t,i.listener||e));else if("function"!=typeof i){for(s=-1,a=i.length;a-- >0;)if(i[a]===e||i[a].listener&&i[a].listener===e){l=i[a].listener,s=a;break}if(s<0)return this;if(1===i.length){if(i[0]=void 0,0==--this._eventsCount)return this._events=new n$z,this;delete r[t];}else !function(t,e){for(var i=e,r=i+1,n=t.length;r<n;i+=1,r+=1)t[i]=t[r];t.pop();}(i,s);r.removeListener&&this.emit("removeListener",t,l||e);}return this},s$w.prototype.off=function(t,e){return this.removeListener(t,e)},s$w.prototype.removeAllListeners=function(t){var e,i;if(!(i=this._events))return this;if(!i.removeListener)return 0===arguments.length?(this._events=new n$z,this._eventsCount=0):i[t]&&(0==--this._eventsCount?this._events=new n$z:delete i[t]),this;if(0===arguments.length){for(var r,s=Object.keys(i),a=0;a<s.length;++a)"removeListener"!==(r=s[a])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=new n$z,this._eventsCount=0,this}if("function"==typeof(e=i[t]))this.removeListener(t,e);else if(e)do{this.removeListener(t,e[e.length-1]);}while(e[0]);return this},s$w.prototype.listeners=function(t){var e,i=this._events;return i&&(e=i[t])?"function"==typeof e?[e.listener||e]:function(t){for(var e=new Array(t.length),i=0;i<e.length;++i)e[i]=t[i].listener||t[i];return e}(e):[]},s$w.listenerCount=function(t,e){return "function"==typeof t.listenerCount?t.listenerCount(e):h$m.call(t,e)},s$w.prototype.listenerCount=h$m,s$w.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var d$h=r$z(Object.freeze({__proto__:null,default:s$w,EventEmitter:s$w}));const{EventEmitter:p$i}=d$h,f$n=new Error("Stream was destroyed"),_$b=new Error("Premature close"),c$o=e$t,S$d=i$r,m$e=s$x,x$9=536870911,b$c=1^x$9,w$e=64,y$o=128,v$b=256,g$k=1024,k$9=2048,T$b=4096,L$d=8192,E$h=16384,N$a=32768,P$a=131072,W$a=131328,C$e=536805375,M$c=768^x$9,A$d=536838143,q$9=536739839,U$c=1<<18,O$a=2<<18,F$b=4<<18,R$9=8<<18,j$9=16<<18,D$d=32<<18,B$g=64<<18,I$c=128<<18,z$9=256<<18,K$b=512<<18,G$9=1024<<18,H$a=469499903,J$9=535822335,Q$e=503316479,V$9=268435455,X$9=262160,Y$b=536608751,Z$9=8404992,$$9=14,tt$6=15,et$6=8405006,it$6=33587200,rt$6=33587215,nt$5=2359296,st$6=270794767,at$5=Symbol.asyncIterator||Symbol("asyncIterator");let lt$5 = class lt{constructor(t,{highWaterMark:e=16384,map:i=null,mapWritable:r,byteLength:n,byteLengthWritable:s}={}){this.stream=t,this.queue=new S$d,this.highWaterMark=e,this.buffered=0,this.error=null,this.pipeline=null,this.drains=null,this.byteLength=s||n||Ct$5,this.map=r||i,this.afterWrite=_t$5.bind(this),this.afterUpdateNextTick=mt$5.bind(this);}get ended(){return 0!=(this.stream._duplexState&D$d)}push(t){return null!==this.map&&(t=this.map(t)),this.buffered+=this.byteLength(t),this.queue.push(t),this.buffered<this.highWaterMark?(this.stream._duplexState|=R$9,!0):(this.stream._duplexState|=6291456,!1)}shift(){const t=this.queue.shift();return this.buffered-=this.byteLength(t),0===this.buffered&&(this.stream._duplexState&=534773759),t}end(t){"function"==typeof t?this.stream.once("finish",t):null!=t&&this.push(t),this.stream._duplexState=(this.stream._duplexState|K$b)&J$9;}autoBatch(t,e){const i=[],r=this.stream;for(i.push(t);(r._duplexState&st$6)===nt$5;)i.push(r._writableState.shift());if(0!=(r._duplexState&tt$6))return e(null);r._writev(i,e);}update(){const t=this.stream;t._duplexState|=O$a;do{for(;(t._duplexState&st$6)===R$9;){const e=this.shift();t._duplexState|=67371008,t._write(e,this.afterWrite);}0==(1310720&t._duplexState)&&this.updateNonPrimary();}while(!0===this.continueUpdate());t._duplexState&=536346623;}updateNonPrimary(){const t=this.stream;if((144965647&t._duplexState)===K$b)return t._duplexState=402653183&(t._duplexState|U$c),void t._final(pt$5.bind(this));4!=(t._duplexState&$$9)?1==(t._duplexState&rt$6)&&(t._duplexState=(t._duplexState|X$9)&b$c,t._open(xt$5.bind(this))):0==(t._duplexState&it$6)&&(t._duplexState|=X$9,t._destroy(ft$5.bind(this)));}continueUpdate(){return 0!=(this.stream._duplexState&I$c)&&(this.stream._duplexState&=Q$e,!0)}updateCallback(){(35127311&this.stream._duplexState)===F$b?this.update():this.updateNextTick();}updateNextTick(){0==(this.stream._duplexState&I$c)&&(this.stream._duplexState|=I$c,0==(this.stream._duplexState&O$a)&&c$o(this.afterUpdateNextTick));}};let ut$5 = class ut{constructor(t,{highWaterMark:e=16384,map:i=null,mapReadable:r,byteLength:n,byteLengthReadable:s}={}){this.stream=t,this.queue=new S$d,this.highWaterMark=0===e?1:e,this.buffered=0,this.readAhead=e>0,this.error=null,this.pipeline=null,this.byteLength=s||n||Ct$5,this.map=r||i,this.pipeTo=null,this.afterRead=ct$5.bind(this),this.afterUpdateNextTick=St$5.bind(this);}get ended(){return 0!=(this.stream._duplexState&E$h)}pipe(t,e){if(null!==this.pipeTo)throw new Error("Can only pipe to one destination");if("function"!=typeof e&&(e=null),this.stream._duplexState|=512,this.pipeTo=t,this.pipeline=new ot$5(this.stream,t,e),e&&this.stream.on("error",Mt$5),Wt$5(t))t._writableState.pipeline=this.pipeline,e&&t.on("error",Mt$5),t.on("finish",this.pipeline.finished.bind(this.pipeline));else {const e=this.pipeline.done.bind(this.pipeline,t),i=this.pipeline.done.bind(this.pipeline,t,null);t.on("error",e),t.on("close",i),t.on("finish",this.pipeline.finished.bind(this.pipeline));}t.on("drain",dt$5.bind(this)),this.stream.emit("piping",t),t.emit("pipe",this.stream);}push(t){const e=this.stream;return null===t?(this.highWaterMark=0,e._duplexState=536805311&(e._duplexState|g$k),!1):null!==this.map&&null===(t=this.map(t))?(e._duplexState&=C$e,this.buffered<this.highWaterMark):(this.buffered+=this.byteLength(t),this.queue.push(t),e._duplexState=(e._duplexState|y$o)&C$e,this.buffered<this.highWaterMark)}shift(){const t=this.queue.shift();return this.buffered-=this.byteLength(t),0===this.buffered&&(this.stream._duplexState&=536862591),t}unshift(t){const e=[null!==this.map?this.map(t):t];for(;this.buffered>0;)e.push(this.shift());for(let t=0;t<e.length-1;t++){const i=e[t];this.buffered+=this.byteLength(i),this.queue.push(i);}this.push(e[e.length-1]);}read(){const t=this.stream;if((16527&t._duplexState)===y$o){const e=this.shift();return null!==this.pipeTo&&!1===this.pipeTo.write(e)&&(t._duplexState&=M$c),0!=(t._duplexState&k$9)&&t.emit("data",e),e}return !1===this.readAhead&&(t._duplexState|=P$a,this.updateNextTick()),null}drain(){const t=this.stream;for(;(16527&t._duplexState)===y$o&&0!=(768&t._duplexState);){const e=this.shift();null!==this.pipeTo&&!1===this.pipeTo.write(e)&&(t._duplexState&=M$c),0!=(t._duplexState&k$9)&&t.emit("data",e);}}update(){const t=this.stream;t._duplexState|=32;do{for(this.drain();this.buffered<this.highWaterMark&&(214047&t._duplexState)===P$a;)t._duplexState|=65552,t._read(this.afterRead),this.drain();4224==(12431&t._duplexState)&&(t._duplexState|=L$d,t.emit("readable")),0==(80&t._duplexState)&&this.updateNonPrimary();}while(!0===this.continueUpdate());t._duplexState&=536870879;}updateNonPrimary(){const t=this.stream;(1167&t._duplexState)===g$k&&(t._duplexState=536869887&(t._duplexState|E$h),t.emit("end"),(t._duplexState&et$6)===Z$9&&(t._duplexState|=4),null!==this.pipeTo&&this.pipeTo.end()),4!=(t._duplexState&$$9)?1==(t._duplexState&rt$6)&&(t._duplexState=(t._duplexState|X$9)&b$c,t._open(xt$5.bind(this))):0==(t._duplexState&it$6)&&(t._duplexState|=X$9,t._destroy(ft$5.bind(this)));}continueUpdate(){return 0!=(this.stream._duplexState&N$a)&&(this.stream._duplexState&=A$d,!0)}updateCallback(){(32879&this.stream._duplexState)===w$e?this.update():this.updateNextTick();}updateNextTick(){0==(this.stream._duplexState&N$a)&&(this.stream._duplexState|=N$a,0==(32&this.stream._duplexState)&&c$o(this.afterUpdateNextTick));}};let ht$6 = class ht{constructor(t){this.data=null,this.afterTransform=bt$5.bind(t),this.afterFinal=null;}};let ot$5 = class ot{constructor(t,e,i){this.from=t,this.to=e,this.afterPipe=i,this.error=null,this.pipeToFinished=!1;}finished(){this.pipeToFinished=!0;}done(t,e){e&&(this.error=e),t!==this.to||(this.to=null,null===this.from)?t!==this.from||(this.from=null,null===this.to)?(null!==this.afterPipe&&this.afterPipe(this.error),this.to=this.from=this.afterPipe=null):0==(t._duplexState&E$h)&&this.to.destroy(this.error||new Error("Readable stream closed before ending")):0!=(this.from._duplexState&E$h)&&this.pipeToFinished||this.from.destroy(this.error||new Error("Writable stream closed prematurely"));}};function dt$5(){this.stream._duplexState|=512,this.updateCallback();}function pt$5(t){const e=this.stream;t&&e.destroy(t),0==(e._duplexState&$$9)&&(e._duplexState|=D$d,e.emit("finish")),(e._duplexState&et$6)===Z$9&&(e._duplexState|=4),e._duplexState&=H$a,0==(e._duplexState&O$a)?this.update():this.updateNextTick();}function ft$5(t){const e=this.stream;t||this.error===f$n||(t=this.error),t&&e.emit("error",t),e._duplexState|=8,e.emit("close");const i=e._readableState,r=e._writableState;if(null!==i&&null!==i.pipeline&&i.pipeline.done(e,t),null!==r){for(;null!==r.drains&&r.drains.length>0;)r.drains.shift().resolve(!1);null!==r.pipeline&&r.pipeline.done(e,t);}}function _t$5(t){const e=this.stream;t&&e.destroy(t),e._duplexState&=H$a,null!==this.drains&&function(t){for(let e=0;e<t.length;e++)0==--t[e].writes&&(t.shift().resolve(!0),e--);}(this.drains),(6553615&e._duplexState)===j$9&&(e._duplexState&=532676607,(e._duplexState&B$g)===B$g&&e.emit("drain")),this.updateCallback();}function ct$5(t){t&&this.stream.destroy(t),this.stream._duplexState&=536870895,!1===this.readAhead&&0==(this.stream._duplexState&v$b)&&(this.stream._duplexState&=q$9),this.updateCallback();}function St$5(){0==(32&this.stream._duplexState)&&(this.stream._duplexState&=A$d,this.update());}function mt$5(){0==(this.stream._duplexState&O$a)&&(this.stream._duplexState&=Q$e,this.update());}function xt$5(t){const e=this.stream;t&&e.destroy(t),0==(4&e._duplexState)&&(0==(17423&e._duplexState)&&(e._duplexState|=w$e),0==(142606351&e._duplexState)&&(e._duplexState|=F$b),e.emit("open")),e._duplexState&=Y$b,null!==e._writableState&&e._writableState.updateCallback(),null!==e._readableState&&e._readableState.updateCallback();}function bt$5(t,e){null!=e&&this.push(e),this._writableState.afterWrite(t);}function wt$5(t){null!==this._readableState&&("data"===t&&(this._duplexState|=133376,this._readableState.updateNextTick()),"readable"===t&&(this._duplexState|=T$b,this._readableState.updateNextTick())),null!==this._writableState&&"drain"===t&&(this._duplexState|=B$g,this._writableState.updateNextTick());}let yt$5 = class yt extends p$i{constructor(t){super(),this._duplexState=0,this._readableState=null,this._writableState=null,t&&(t.open&&(this._open=t.open),t.destroy&&(this._destroy=t.destroy),t.predestroy&&(this._predestroy=t.predestroy),t.signal&&t.signal.addEventListener("abort",At$5.bind(this))),this.on("newListener",wt$5);}_open(t){t(null);}_destroy(t){t(null);}_predestroy(){}get readable(){return null!==this._readableState||void 0}get writable(){return null!==this._writableState||void 0}get destroyed(){return 0!=(8&this._duplexState)}get destroying(){return 0!=(this._duplexState&$$9)}destroy(t){0==(this._duplexState&$$9)&&(t||(t=f$n),this._duplexState=535822271&(4|this._duplexState),null!==this._readableState&&(this._readableState.highWaterMark=0,this._readableState.error=t),null!==this._writableState&&(this._writableState.highWaterMark=0,this._writableState.error=t),this._duplexState|=2,this._predestroy(),this._duplexState&=536870909,null!==this._readableState&&this._readableState.updateNextTick(),null!==this._writableState&&this._writableState.updateNextTick());}};let vt$5 = class vt extends yt$5{constructor(t){super(t),this._duplexState|=8519681,this._readableState=new ut$5(this,t),t&&(!1===this._readableState.readAhead&&(this._duplexState&=q$9),t.read&&(this._read=t.read),t.eagerOpen&&this._readableState.updateNextTick(),t.encoding&&this.setEncoding(t.encoding));}setEncoding(t){const e=new m$e(t),i=this._readableState.map||Nt$5;return this._readableState.map=function(t){const r=e.push(t);return ""===r&&(0!==t.byteLength||e.remaining>0)?null:i(r)},this}_read(t){t(null);}pipe(t,e){return this._readableState.updateNextTick(),this._readableState.pipe(t,e),t}read(){return this._readableState.updateNextTick(),this._readableState.read()}push(t){return this._readableState.updateNextTick(),this._readableState.push(t)}unshift(t){return this._readableState.updateNextTick(),this._readableState.unshift(t)}resume(){return this._duplexState|=W$a,this._readableState.updateNextTick(),this}pause(){return this._duplexState&=!1===this._readableState.readAhead?536739583:536870655,this}static _fromAsyncIterator(t,e){let i;const r=new vt({...e,read(e){t.next().then(n).then(e.bind(null,null)).catch(e);},predestroy(){i=t.return();},destroy(t){if(!i)return t(null);i.then(t.bind(null,null)).catch(t);}});return r;function n(t){t.done?r.push(null):r.push(t.value);}}static from(t,e){if(Wt$5(i=t)&&i.readable)return t;var i;if(t[at$5])return this._fromAsyncIterator(t[at$5](),e);Array.isArray(t)||(t=void 0===t?[]:[t]);let r=0;return new vt({...e,read(e){this.push(r===t.length?null:t[r++]),e(null);}})}static isBackpressured(t){return 0!=(17422&t._duplexState)||t._readableState.buffered>=t._readableState.highWaterMark}static isPaused(t){return 0==(t._duplexState&v$b)}[at$5](){const t=this;let e=null,i=null,r=null;return this.on("error",(t=>{e=t;})),this.on("readable",(function(){null!==i&&n(t.read());})),this.on("close",(function(){null!==i&&n(null);})),{[at$5](){return this},next:()=>new Promise((function(e,s){i=e,r=s;const a=t.read();null!==a?n(a):0!=(8&t._duplexState)&&n(null);})),return:()=>s(null),throw:t=>s(t)};function n(n){null!==r&&(e?r(e):null===n&&0==(t._duplexState&E$h)?r(f$n):i({value:n,done:null===n}),r=i=null);}function s(e){return t.destroy(e),new Promise(((i,r)=>{if(8&t._duplexState)return i({value:void 0,done:!0});t.once("close",(function(){e?r(e):i({value:void 0,done:!0});}));}))}}};let gt$5 = class gt extends yt$5{constructor(t){super(t),this._duplexState|=16385,this._writableState=new lt$5(this,t),t&&(t.writev&&(this._writev=t.writev),t.write&&(this._write=t.write),t.final&&(this._final=t.final),t.eagerOpen&&this._writableState.updateNextTick());}cork(){this._duplexState|=G$9;}uncork(){this._duplexState&=V$9,this._writableState.updateNextTick();}_writev(t,e){e(null);}_write(t,e){this._writableState.autoBatch(t,e);}_final(t){t(null);}static isBackpressured(t){return 0!=(146800654&t._duplexState)}static drained(t){if(t.destroyed)return Promise.resolve(!1);const e=t._writableState;var i;const r=((i=t)._writev!==gt.prototype._writev&&i._writev!==kt$5.prototype._writev?Math.min(1,e.queue.length):e.queue.length)+(t._duplexState&z$9?1:0);return 0===r?Promise.resolve(!0):(null===e.drains&&(e.drains=[]),new Promise((t=>{e.drains.push({writes:r,resolve:t});})))}write(t){return this._writableState.updateNextTick(),this._writableState.push(t)}end(t){return this._writableState.updateNextTick(),this._writableState.end(t),this}};let kt$5 = class kt extends vt$5{constructor(t){super(t),this._duplexState=1|this._duplexState&P$a,this._writableState=new lt$5(this,t),t&&(t.writev&&(this._writev=t.writev),t.write&&(this._write=t.write),t.final&&(this._final=t.final));}cork(){this._duplexState|=G$9;}uncork(){this._duplexState&=V$9,this._writableState.updateNextTick();}_writev(t,e){e(null);}_write(t,e){this._writableState.autoBatch(t,e);}_final(t){t(null);}write(t){return this._writableState.updateNextTick(),this._writableState.push(t)}end(t){return this._writableState.updateNextTick(),this._writableState.end(t),this}};let Tt$5 = class Tt extends kt$5{constructor(t){super(t),this._transformState=new ht$6(this),t&&(t.transform&&(this._transform=t.transform),t.flush&&(this._flush=t.flush));}_write(t,e){this._readableState.buffered>=this._readableState.highWaterMark?this._transformState.data=t:this._transform(t,this._transformState.afterTransform);}_read(t){if(null!==this._transformState.data){const e=this._transformState.data;this._transformState.data=null,t(null),this._transform(e,this._transformState.afterTransform);}else t(null);}destroy(t){super.destroy(t),null!==this._transformState.data&&(this._transformState.data=null,this._transformState.afterTransform());}_transform(t,e){e(null,t);}_flush(t){t(null);}_final(t){this._transformState.afterFinal=t,this._flush(Lt$5.bind(this));}};function Lt$5(t,e){const i=this._transformState.afterFinal;if(t)return i(t);null!=e&&this.push(e),this.push(null),i(null);}function Et$5(t,...e){const i=Array.isArray(t)?[...t,...e]:[t,...e],r=i.length&&"function"==typeof i[i.length-1]?i.pop():null;if(i.length<2)throw new Error("Pipeline requires at least 2 streams");let n=i[0],s=null,a=null;for(let t=1;t<i.length;t++)s=i[t],Wt$5(n)?n.pipe(s,u):(l(n,!0,t>1,u),n.pipe(s)),n=s;if(r){let t=!1;const e=Wt$5(s)||!(!s._writableState||!s._writableState.autoDestroy);s.on("error",(t=>{null===a&&(a=t);})),s.on("finish",(()=>{t=!0,e||r(a);})),e&&s.on("close",(()=>r(a||(t?null:_$b))));}return s;function l(t,e,i,r){t.on("error",r),t.on("close",(function(){if(t._readableState&&!t._readableState.ended)return r(_$b);if(i&&t._writableState&&!t._writableState.ended)return r(_$b)}));}function u(t){if(t&&!a){a=t;for(const e of i)e.destroy(t);}}}function Nt$5(t){return t}function Pt$5(t){return !!t._readableState||!!t._writableState}function Wt$5(t){return "number"==typeof t._duplexState&&Pt$5(t)}function Ct$5(t){return function(t){return "object"==typeof t&&null!==t&&"number"==typeof t.byteLength}(t)?t.byteLength:1024}function Mt$5(){}function At$5(){this.destroy(new Error("Stream aborted."));}var qt$4={pipeline:Et$5,pipelinePromise:function(...t){return new Promise(((e,i)=>Et$5(...t,(t=>{if(t)return i(t);e();}))))},isStream:Pt$5,isStreamx:Wt$5,isEnded:function(t){return !!t._readableState&&t._readableState.ended},isFinished:function(t){return !!t._writableState&&t._writableState.ended},getStreamError:function(t,e={}){const i=t._readableState&&t._readableState.error||t._writableState&&t._writableState.error;return e.all||i!==f$n?i:null},Stream:yt$5,Writable:gt$5,Readable:vt$5,Duplex:kt$5,Transform:Tt$5,PassThrough:class extends Tt$5{}},Ut$3=qt$4.Duplex,Ot$3=qt$4.PassThrough,Ft$3=qt$4.Readable,Rt$3=qt$4.Stream,jt$3=qt$4.Transform,Dt$3=qt$4.Writable,Bt$3=qt$4.getStreamError,It$3=qt$4.isEnded,zt$3=qt$4.isFinished,Kt$3=qt$4.isStream,Gt$3=qt$4.isStreamx,Ht$3=qt$4.pipeline,Jt$3=qt$4.pipelinePromise;
var streamx = /*#__PURE__*/Object.freeze({
__proto__: null,
Duplex: Ut$3,
PassThrough: Ot$3,
Readable: Ft$3,
Stream: Rt$3,
Transform: jt$3,
Writable: Dt$3,
default: qt$4,
getStreamError: Bt$3,
isEnded: It$3,
isFinished: zt$3,
isStream: Kt$3,
isStreamx: Gt$3,
pipeline: Ht$3,
pipelinePromise: Jt$3
});
/**
* Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
* Original file: /npm/b4a@1.6.7/browser.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
var t$u={exports:{}};function e$r(t){return t.length}var n$y={byteLength:e$r,toString:function(t){const e=t.byteLength;let n="";for(let r=0;r<e;r++)n+=String.fromCharCode(t[r]);return n},write:function(t,n,r=0,o=e$r(n)){const f=Math.min(o,t.byteLength-r);for(let e=0;e<f;e++)t[r+e]=n.charCodeAt(e);return f}};const r$y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o$v=new Uint8Array(256);for(let t=0;t<64;t++)o$v[r$y.charCodeAt(t)]=t;function f$m(t){let e=t.length;return 61===t.charCodeAt(e-1)&&e--,e>1&&61===t.charCodeAt(e-1)&&e--,3*e>>>2}o$v[45]=62,o$v[95]=63;var i$q={byteLength:f$m,toString:function(t){const e=t.byteLength;let n="";for(let o=0;o<e;o+=3)n+=r$y[t[o]>>2]+r$y[(3&t[o])<<4|t[o+1]>>4]+r$y[(15&t[o+1])<<2|t[o+2]>>6]+r$y[63&t[o+2]];return e%3==2?n=n.substring(0,n.length-1)+"=":e%3==1&&(n=n.substring(0,n.length-2)+"=="),n},write:function(t,e,n=0,r=f$m(e)){const i=Math.min(r,t.byteLength-n);for(let n=0,r=0;r<i;n+=4){const f=o$v[e.charCodeAt(n)],i=o$v[e.charCodeAt(n+1)],u=o$v[e.charCodeAt(n+2)],a=o$v[e.charCodeAt(n+3)];t[r++]=f<<2|i>>4,t[r++]=(15&i)<<4|u>>2,t[r++]=(3&u)<<6|63&a;}return i}};function u$m(t){return t.length>>>1}var a$m={byteLength:u$m,toString:function(t){const e=t.byteLength;t=new DataView(t.buffer,t.byteOffset,e);let n="",r=0;for(let o=e-e%4;r<o;r+=4)n+=t.getUint32(r).toString(16).padStart(8,"0");for(;r<e;r++)n+=t.getUint8(r).toString(16).padStart(2,"0");return n},write:function(t,e,n=0,r=u$m(e)){const o=Math.min(r,t.byteLength-n);for(let r=0;r<o;r++){const o=b$b(e.charCodeAt(2*r)),f=b$b(e.charCodeAt(2*r+1));if(void 0===o||void 0===f)return t.subarray(0,r);t[n+r]=o<<4|f;}return o}};function b$b(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-65+10:t>=97&&t<=102?t-97+10:void 0}function c$n(t){let e=0;for(let n=0,r=t.length;n<r;n++){const o=t.charCodeAt(n);if(o>=55296&&o<=56319&&n+1<r){const r=t.charCodeAt(n+1);if(r>=56320&&r<=57343){e+=4,n++;continue}}e+=o<=127?1:o<=2047?2:3;}return e}let g$j,s$v;if("undefined"!=typeof TextDecoder){const t=new TextDecoder;g$j=function(e){return t.decode(e)};}else g$j=function(t){const e=t.byteLength;let n="",r=0;for(;r<e;){let o=t[r];if(o<=127){n+=String.fromCharCode(o),r++;continue}let f=0,i=0;if(o<=223?(f=1,i=31&o):o<=239?(f=2,i=15&o):o<=244&&(f=3,i=7&o),e-r-f>0){let e=0;for(;e<f;)o=t[r+e+1],i=i<<6|63&o,e+=1;}else i=65533,f=e-r;n+=String.fromCodePoint(i),r+=f+1;}return n};if("undefined"!=typeof TextEncoder){const t=new TextEncoder;s$v=function(e,n,r=0,o=c$n(n)){const f=Math.min(o,e.byteLength-r);return t.encodeInto(n,e.subarray(r,r+f)),f};}else s$v=function(t,e,n=0,r=c$n(e)){const o=Math.min(r,t.byteLength-n);t=t.subarray(n,n+o);let f=0,i=0;for(;f<e.length;){const n=e.codePointAt(f);if(n<=127){t[i++]=n,f++;continue}let r=0,o=0;for(n<=2047?(r=6,o=192):n<=65535?(r=12,o=224):n<=2097151&&(r=18,o=240),t[i++]=o|n>>r,r-=6;r>=0;)t[i++]=128|n>>r&63,r-=6;f+=n>=65536?2:1;}return o};var y$n={byteLength:c$n,toString:g$j,write:s$v};function h$l(t){return 2*t.length}var l$k={byteLength:h$l,toString:function(t){const e=t.byteLength;let n="";for(let r=0;r<e-1;r+=2)n+=String.fromCharCode(t[r]+256*t[r+1]);return n},write:function(t,e,n=0,r=h$l(e)){const o=Math.min(r,t.byteLength-n);let f=o;for(let r=0;r<e.length&&!((f-=2)<0);++r){const o=e.charCodeAt(r),f=o>>8,i=o%256;t[n+2*r]=i,t[n+2*r+1]=f;}return o}};!function(t,e){const r=n$y,o=i$q,f=a$m,u=y$n,b=l$k,c=255===new Uint8Array(Uint16Array.of(255).buffer)[0];function g(t){switch(t){case"ascii":return r;case"base64":return o;case"hex":return f;case"utf8":case"utf-8":case void 0:case null:return u;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b;default:throw new Error(`Unknown encoding: ${t}`)}}function s(t){return t instanceof Uint8Array}function h(t,e,n){return "string"==typeof t?function(t,e){const n=g(e),r=new Uint8Array(n.byteLength(t));return n.write(r,t,0,r.byteLength),r}(t,e):Array.isArray(t)?function(t){const e=new Uint8Array(t.length);return e.set(t),e}(t):ArrayBuffer.isView(t)?function(t){const e=new Uint8Array(t.byteLength);return e.set(t),e}(t):function(t,e,n){return new Uint8Array(t,e,n)}(t,e,n)}function L(t,e,n,r,o){if(0===t.byteLength)return -1;if("string"==typeof n?(r=n,n=0):void 0===n?n=o?0:t.length-1:n<0&&(n+=t.byteLength),n>=t.byteLength){if(o)return -1;n=t.byteLength-1;}else if(n<0){if(!o)return -1;n=0;}if("string"==typeof e)e=h(e,r);else if("number"==typeof e)return e&=255,o?t.indexOf(e,n):t.lastIndexOf(e,n);if(0===e.byteLength)return -1;if(o){let r=-1;for(let o=n;o<t.byteLength;o++)if(t[o]===e[-1===r?0:o-r]){if(-1===r&&(r=o),o-r+1===e.byteLength)return r}else -1!==r&&(o-=o-r),r=-1;}else {n+e.byteLength>t.byteLength&&(n=t.byteLength-e.byteLength);for(let r=n;r>=0;r--){let n=!0;for(let o=0;o<e.byteLength;o++)if(t[r+o]!==e[o]){n=!1;break}if(n)return r}}return -1}function w(t,e,n,r){return L(t,e,n,r,!0)}function d(t,e,n){const r=t[e];t[e]=t[n],t[n]=r;}t.exports=e={isBuffer:s,isEncoding:function(t){try{return g(t),!0}catch{return !1}},alloc:function(t,n,r){const o=new Uint8Array(t);return void 0!==n&&e.fill(o,n,0,o.byteLength,r),o},allocUnsafe:function(t){return new Uint8Array(t)},allocUnsafeSlow:function(t){return new Uint8Array(t)},byteLength:function(t,e){return g(e).byteLength(t)},compare:function(t,e){if(t===e)return 0;const n=Math.min(t.byteLength,e.byteLength);t=new DataView(t.buffer,t.byteOffset,t.byteLength),e=new DataView(e.buffer,e.byteOffset,e.byteLength);let r=0;for(let o=n-n%4;r<o;r+=4){if(t.getUint32(r,c)!==e.getUint32(r,c))break}for(;r<n;r++){const n=t.getUint8(r),o=e.getUint8(r);if(n<o)return -1;if(n>o)return 1}return t.byteLength>e.byteLength?1:t.byteLength<e.byteLength?-1:0},concat:function(t,e){void 0===e&&(e=t.reduce(((t,e)=>t+e.byteLength),0));const n=new Uint8Array(e);let r=0;for(const e of t){if(r+e.byteLength>n.byteLength){const t=e.subarray(0,n.byteLength-r);return n.set(t,r),n}n.set(e,r),r+=e.byteLength;}return n},copy:function(t,e,n=0,r=0,o=t.byteLength){if(o>0&&o<r)return 0;if(o===r)return 0;if(0===t.byteLength||0===e.byteLength)return 0;if(n<0)throw new RangeError("targetStart is out of range");if(r<0||r>=t.byteLength)throw new RangeError("sourceStart is out of range");if(o<0)throw new RangeError("sourceEnd is out of range");n>=e.byteLength&&(n=e.byteLength),o>t.byteLength&&(o=t.byteLength),e.byteLength-n<o-r&&(o=e.length-n+r);const f=o-r;return t===e?e.copyWithin(n,r,o):e.set(t.subarray(r,o),n),f},equals:function(t,e){if(t===e)return !0;if(t.byteLength!==e.byteLength)return !1;const n=t.byteLength;t=new DataView(t.buffer,t.byteOffset,t.byteLength),e=new DataView(e.buffer,e.byteOffset,e.byteLength);let r=0;for(let o=n-n%4;r<o;r+=4)if(t.getUint32(r,c)!==e.getUint32(r,c))return !1;for(;r<n;r++)if(t.getUint8(r)!==e.getUint8(r))return !1;return !0},fill:function(t,e,n,r,o){if("string"==typeof e?"string"==typeof n?(o=n,n=0,r=t.byteLength):"string"==typeof r&&(o=r,r=t.byteLength):"number"==typeof e?e&=255:"boolean"==typeof e&&(e=+e),n<0||t.byteLength<n||t.byteLength<r)throw new RangeError("Out of range index");if(void 0===n&&(n=0),void 0===r&&(r=t.byteLength),r<=n)return t;if(e||(e=0),"number"==typeof e)for(let o=n;o<r;++o)t[o]=e;else {const f=(e=s(e)?e:h(e,o)).byteLength;for(let o=0;o<r-n;++o)t[o+n]=e[o%f];}return t},from:h,includes:function(t,e,n,r){return -1!==w(t,e,n,r)},indexOf:w,lastIndexOf:function(t,e,n,r){return L(t,e,n,r,!1)},swap16:function(t){const e=t.byteLength;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let n=0;n<e;n+=2)d(t,n,n+1);return t},swap32:function(t){const e=t.byteLength;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let n=0;n<e;n+=4)d(t,n,n+3),d(t,n+1,n+2);return t},swap64:function(t){const e=t.byteLength;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let n=0;n<e;n+=8)d(t,n,n+7),d(t,n+1,n+6),d(t,n+2,n+5),d(t,n+3,n+4);return t},toBuffer:function(t){return t},toString:function(t,e,n=0,r=t.byteLength){const o=t.byteLength;return n>=o||r<=n?"":(n<0&&(n=0),r>o&&(r=o),(0!==n||r<o)&&(t=t.subarray(n,r)),g(e).toString(t))},write:function(t,e,n,r,o){return void 0===n?o="utf8":void 0===r&&"string"==typeof n?(o=n,n=void 0):void 0===o&&"string"==typeof r&&(o=r,r=void 0),g(o).write(t,e,n,r)},writeDoubleLE:function(t,e,n){return void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(n,e,!0),n+8},writeFloatLE:function(t,e,n){return void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(n,e,!0),n+4},writeUInt32LE:function(t,e,n){return void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setUint32(n,e,!0),n+4},writeInt32LE:function(t,e,n){return void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setInt32(n,e,!0),n+4},readDoubleLE:function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat64(e,!0)},readFloatLE:function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat32(e,!0)},readUInt32LE:function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(e,!0)},readInt32LE:function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getInt32(e,!0)},writeDoubleBE:function(t,e,n){return void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(n,e,!1),n+8},writeFloatBE:function(t,e,n){return void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(n,e,!1),n+4},writeUInt32BE:function(t,e,n){return void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setUint32(n,e,!1),n+4},writeInt32BE:function(t,e,n){return void 0===n&&(n=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setInt32(n,e,!1),n+4},readDoubleBE:function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat64(e,!1)},readFloatBE:function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getFloat32(e,!1)},readUInt32BE:function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(e,!1)},readInt32BE:function(t,e){return void 0===e&&(e=0),new DataView(t.buffer,t.byteOffset,t.byteLength).getInt32(e,!1)}};}(t$u,t$u.exports);var L$c=t$u.exports;
/**
* Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
* Original file: /npm/ready-resource@1.1.1/index.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
function e$q(e){return e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function t$t(){}function n$x(){n$x.init.call(this);}function r$x(e){return void 0===e._maxListeners?n$x.defaultMaxListeners:e._maxListeners}function i$p(e,n,i,s){var o,u,l,f;if("function"!=typeof i)throw new TypeError('"listener" argument must be a function');if((u=e._events)?(u.newListener&&(e.emit("newListener",n,i.listener?i.listener:i),u=e._events),l=u[n]):(u=e._events=new t$t,e._eventsCount=0),l){if("function"==typeof l?l=u[n]=s?[i,l]:[l,i]:s?l.unshift(i):l.push(i),!l.warned&&(o=r$x(e))&&o>0&&l.length>o){l.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+l.length+" "+n+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=n,a.count=l.length,f=a,"function"==typeof console.warn?console.warn(f):console.log(f);}}else l=u[n]=i,++e._eventsCount;return e}function s$u(e,t,n){var r=!1;function i(){e.removeListener(t,i),r||(r=!0,n.apply(e,arguments));}return i.listener=n,i}function o$u(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function u$l(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}t$t.prototype=Object.create(null),n$x.EventEmitter=n$x,n$x.usingDomains=!1,n$x.prototype.domain=void 0,n$x.prototype._events=void 0,n$x.prototype._maxListeners=void 0,n$x.defaultMaxListeners=10,n$x.init=function(){this.domain=null,n$x.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new t$t,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0;},n$x.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},n$x.prototype.getMaxListeners=function(){return r$x(this)},n$x.prototype.emit=function(e){var t,n,r,i,s,o,l,f="error"===e;if(o=this._events)f=f&&null==o.error;else if(!f)return !1;if(l=this.domain,f){if(t=arguments[1],!l){if(t instanceof Error)throw t;var a=new Error('Uncaught, unspecified "error" event. ('+t+")");throw a.context=t,a}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=l,t.domainThrown=!1,l.emit("error",t),!1}if(!(n=o[e]))return !1;var c="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=u$l(e,r),s=0;s<r;++s)i[s].call(n);}(n,c,this);break;case 2:!function(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,s=u$l(e,i),o=0;o<i;++o)s[o].call(n,r);}(n,c,this,arguments[1]);break;case 3:!function(e,t,n,r,i){if(t)e.call(n,r,i);else for(var s=e.length,o=u$l(e,s),l=0;l<s;++l)o[l].call(n,r,i);}(n,c,this,arguments[1],arguments[2]);break;case 4:!function(e,t,n,r,i,s){if(t)e.call(n,r,i,s);else for(var o=e.length,l=u$l(e,o),f=0;f<o;++f)l[f].call(n,r,i,s);}(n,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),s=1;s<r;s++)i[s-1]=arguments[s];!function(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,s=u$l(e,i),o=0;o<i;++o)s[o].apply(n,r);}(n,c,this,i);}return !0},n$x.prototype.addListener=function(e,t){return i$p(this,e,t,!1)},n$x.prototype.on=n$x.prototype.addListener,n$x.prototype.prependListener=function(e,t){return i$p(this,e,t,!0)},n$x.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,s$u(this,e,t)),this},n$x.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,s$u(this,e,t)),this},n$x.prototype.removeListener=function(e,n){var r,i,s,o,u;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if(!(i=this._events))return this;if(!(r=i[e]))return this;if(r===n||r.listener&&r.listener===n)0==--this._eventsCount?this._events=new t$t:(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||n));else if("function"!=typeof r){for(s=-1,o=r.length;o-- >0;)if(r[o]===n||r[o].listener&&r[o].listener===n){u=r[o].listener,s=o;break}if(s<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new t$t,this;delete i[e];}else !function(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop();}(r,s);i.removeListener&&this.emit("removeListener",e,u||n);}return this},n$x.prototype.off=function(e,t){return this.removeListener(e,t)},n$x.prototype.removeAllListeners=function(e){var n,r;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=new t$t,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new t$t:delete r[e]),this;if(0===arguments.length){for(var i,s=Object.keys(r),o=0;o<s.length;++o)"removeListener"!==(i=s[o])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=new t$t,this._eventsCount=0,this}if("function"==typeof(n=r[e]))this.removeListener(e,n);else if(n)do{this.removeListener(e,n[n.length-1]);}while(n[0]);return this},n$x.prototype.listeners=function(e){var t,n=this._events;return n&&(t=n[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(t):[]},n$x.listenerCount=function(e,t){return "function"==typeof e.listenerCount?e.listenerCount(t):o$u.call(e,t)},n$x.prototype.listenerCount=o$u,n$x.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};const l$j=e$q(Object.freeze({__proto__:null,default:n$x,EventEmitter:n$x}));var f$l=class f extends l$j{constructor(){super(),this.opening=null,this.closing=null,this.opened=!1,this.closed=!1;}ready(){return null!==this.opening||(this.opening=async function(e){try{await e._open();}catch(t){throw e.close(),t}e.opened=!0,e.emit("ready");}(this)),this.opening}close(){return null!==this.closing||(this.closing=async function(e){try{!1===e.opened&&null!==e.opening&&await e.opening;}catch{}!0!==e.opened&&null!==e.opening||await e._close();e.closed=!0,e.emit("close");}(this)),this.closing}async _open(){}async _close(){}};
/**
* Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
* Original file: /npm/debounceify@1.1.0/index.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
var n$w=function(n,u=null){return r.running=null,r;async function r(){if(null!==r.running)try{await r.running;}catch(n){}if(null!==r.running)return r.running;r.running=n.call(u);try{return await r.running}finally{r.running=null;}}};
/**
* Bundled by jsDelivr using Rollup v2.79.1 and Terser v5.19.2.
* Original file: /npm/b4a@1.6.6/browser.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
var t$s={exports:{}};function e$p(t){return t.length}var n$v={byteLength:e$p,toString:function(t){const e=t.byteLength;let n="";for(let r=0;r<e;r++)n+=String.fromCharCode(t[r]);return n},write:function(t,n,r=0,o=e$p(n)){const f=Math.min(o,t.byteLength-r);for(let e=0;e<f;e++)t[r+e]=n.charCodeAt(e);return f}};const r$w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o$t=new Uint8Array(256);for(let t=0;t<64;t++)o$t[r$w.charCodeAt(t)]=t;function f$k(t){let e=t.length;return 61===t.charCodeAt(e-1)&&e--,e>1&&61===t.charCodeAt(e-1)&&e--,3*e>>>2}o$t[45]=62,o$t[95]=63;var i$o={byteLength:f$k,toString:function(t){const e=t.byteLength;let n="";for(let o=0;o<e;o+=3)n+=r$w[t[o]>>2]+r$w[(3&t[o])<<4|t[o+1]>>4]+r$w[(15&t[o+1])<<2|t[o+2]>>6]+r$w[63&t[o+2]];return e%3==2?n=n.substring(0,n.length-1)+"=":e%3==1&&(n=n.substring(0,n.length-2)+"=="),n},write:function(t,e,n=0,r=f$k(e)){const i=Math.min(r,t.byteLength-n);for(let n=0,r=0;r<i;n+=4){const f=o$t[e.charCodeAt(n)],i=o$t[e.charCodeAt(n+1)],u=o$t[e.charCodeAt(n+2)],a=o$t[e.charCodeAt(n+3)];t[r++]=f<<2|i>>4,t[r++]=(15&i)<<4|u>>2,t[r++]=(3&u)<<6|63&a;}return i}};function u$k(t){return t.length>>>1}var a$l={byteLength:u$k,toString:function(t){const e=t.byteLength;t=new DataView(t.buffer,t.byteOffset,e);let n="",r=0;for(let o=e-e%4;r<o;r+=4)n+=t.getUint32(r).toString(16).padStart(8,"0");for(;r<e;r++)n+=t.getUint8(r).toString(16).padStart(2,"0");return n},write:function(t,e,n=0,r=u$k(e)){const o=Math.min(r,t.byteLength-n);for(let r=0;r<o;r++){const o=c$m(e.charCodeAt(2*r)),f=c$m(e.charCodeAt(2*r+1));if(void 0===o||void 0===f)return t.subarray(0,r);t[n+r]=o<<4|f;}return o}};function c$m(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-65+10:t>=97&&t<=102?t-97+10:void 0}function g$i(t){let e=0;for(let n=0,r=t.length;n<r;n++){const o=t.charCodeAt(n);if(o>=55296&&o<=56319&&n+1<r){const r=t.charCodeAt(n+1);if(r>=56320&&r<=57343){e+=4,n++;continue}}e+=o<=127?1:o<=2047?2:3;}return e}let s$t,y$m;if("undefined"!=typeof TextDecoder){const t=new TextDecoder;s$t=function(e){return t.decode(e)};}else s$t=function(t){const e=t.byteLength;let n="",r=0;for(;r<e;){let o=t[r];if(o<=127){n+=String.fromCharCode(o),r++;continue}let f=0,i=0;if(o<=223?(f=1,i=31&o):o<=239?(f=2,i=15&o):o<=244&&(f=3,i=7&o),e-r-f>0){let e=0;for(;e<f;)o=t[r+e+1],i=i<<6|63&o,e+=1;}else i=65533,f=e-r;n+=String.fromCodePoint(i),r+=f+1;}return n};if("undefined"!=typeof TextEncoder){const t=new TextEncoder;y$m=function(e,n,r=0,o=g$i(n)){const f=Math.min(o,e.byteLength-r);return t.encodeInto(n,e.subarray(r,r+f)),f};}else y$m=function(t,e,n=0,r=g$i(e)){const o=Math.min(r,t.byteLength-n);t=t.subarray(n,n+o);let f=0,i=0;for(;f<e.length;){const n=e.codePointAt(f);if(n<=127){t[i++]=n,f++;continue}let r=0,o=0;for(n<=2047?(r=6,o=192):n<=65535?(r=12,o=224):n<=2097151&&(r=18,o=240),t[i++]=o|n>>r,r-=6;r>=0;)t[i++]=128|n>>r&63,r-=6;f+=n>=65536?2:1;}return o};var b$a={byteLength:g$i,toString:s$t,write:y$m};function h$k(t){return 2*t.length}var l$i={byteLength:h$k,toString:function(t){const e=t.byteLength;let n="";for(let r=0;r<e-1;r+=2)n+=String.fromCharCode(t[r]+256*t[r+1]);return n},write:function(t,e,n=0,r=h$k(e)){const o=Math.min(r,t.byteLength-n);let f=o;for(let r=0;r<e.length&&!((f-=2)<0);++r){const o=e.charCodeAt(r),f=o>>8,i=o%256;t[n+2*r]=i,t[n+2*r+1]=f;}return o}};!function(t,e){const r=n$v,o=i$o,f=a$l,u=b$a,c=l$i,g=255===new Uint8Array(Uint16Array.of(255).buffer)[0];function s(t){switch(t){case"ascii":return r;case"base64":return o;case"hex":return f;case"utf8":case"utf-8":case void 0:return u;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c;default:throw new Error(`Unknown encoding: ${t}`)}}function y(t){return t instanceof Uint8Array}function h(t,e,n){return "string"==typeof t?function(t,e){const n=s(e),r=new Uint8Array(n.byteLength(t));return n.write(r,t,0,r.byteLength),r}(t,e):Array.isArray(t)?function(t){const e=new Uint8Array(t.length);return e.set(t),e}(t):ArrayBuffer.isView(t)?function(t){const e=new Uint8Array(t.byteLength);return e.set(t),e}(t):function(t,e,n){return new Uint8Array(t,e,n)}(t,e,n)}function L(t,e,n,r,o){if(0===t.byteLength)return -1;if("string"==typeof n?(r=n,n=0):void 0===n?n=o?0:t.length-1:n<0&&(n+=t.byteLength),n>=t.byteLength){if(o)return -1;n=t.byteLength-1;}else if(n<0){if(!o)return -1;n=0;}if("string"==typeof e)e=h(e,r);else if("number"==typeof e)return e&=255,o?t.indexOf(e,n):t.lastIndexOf(e,n);if(0===e.byteLength)return -1;if(o){let r=-1;for(let o=n;o<t.byteLength;o++)if(t[o]===e[-1===r?0:o-r]){if(-1===r&&(r=o),o-r+1===e.byteLength)return r}else -1!==r&&(o-=o-r),r=-1;}else {n+e.byteLength>t.byteLength&&(n=t.byteLength-e.byteLength);for(let r=n;r>=0;r--){let n=!0;for(let o=0;o<e.byteLength;o++)if(t[r+o]!==e[o]){n=!1;break}if(n)return r}}return -1}function w(t,e,n,r){return L(t,e,n,r,!0)}function d(t,e,n){const r=t[e];t[e]=t[n],t[n]=r;}t.exports=e={isBuffer:y,isEncoding:function(t){try{return s(t),!0}catch{return !1}},alloc:function(t,n,r){const o=new Uint8Array(t);return void 0!==n&&e.fill(o,n,0,o.byteLength,r),o},allocUnsafe:function(t){return new Uint8Array(t)},allocUnsafeSlow:function(t){return new Uint8Array(t)},byteLength:function(t,e){return s(e).byteLength(t)},compare:function(t,e){if(t===e)return 0;const n=Math.min(t.byteLength,e.byteLength);t=new DataView(t.buffer,t.byteOffset,t.byteLength),e=new DataView(e.buffer,e.byteOffset,e.byteLength);let r=0;for(let o=n-n%4;r<o;r+=4){if(t.getUint32(r,g)!==e.getUint32(r,g))break}for(;r<n;r++){const n=t.getUint8(r),o=e.getUint8(r);if(n<o)return -1;if(n>o)return 1}return t.byteLength>e.byteLength?1:t.byteLength<e.byteLength?-1:0},concat:function(t,e){void 0===e&&(e=t.reduce(((t,e)=>t+e.byteLength),0));const n=new Uint8Array(e);let r=0;for(const e of t){if(r+e.byteLength>n.byteLength){const t=e.subarray(0,n.byteLength-r);return n.set(t,r),n}n.set(e,r),r+=e.byteLength;}return n},copy:function(t,e,n=0,r=0,o=t.byteLength){if(o>0&&o<r)return 0;if(o===r)return 0;if(0===t.byteLength||0===e.byteLength)return 0;if(n<0)throw new RangeError("targetStart is out of range");if(r<0||r>=t.byteLength)throw new RangeError("sourceStart is out of range");if(o<0)throw new RangeError("sourceEnd is out of range");n>=e.byteLength&&(n=e.byteLength),o>t.byteLength&&(o=t.byteLength),e.byteLength-n<o-r&&(o=e.length-n+r);const f=o-r;return t===e?e.copyWithin(n,r,o):e.set(t.subarray(r,o),n),f},equ