var wr=Object.defineProperty;var sn=t=>{throw TypeError(t)};var gr=(t,e,n)=>e in t?wr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var v=(t,e,n)=>gr(t,typeof e!="symbol"?e+"":e,n),kt=(t,e,n)=>e.has(t)||sn("Cannot "+n);var A=(t,e,n)=>(kt(t,e,"read from private field"),n?n.call(t):e.get(t)),P=(t,e,n)=>e.has(t)?sn("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),U=(t,e,n,r)=>(kt(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),z=(t,e,n)=>(kt(t,e,"access private method"),n);var Ue=(t,e,n,r)=>({set _(i){U(t,e,i,n)},get _(){return A(t,e,r)}});import{g as yr,r as he,h as kn,t as mr,i as br,j as Ot,c as An,k as xr,l as Er,m as _r,b as kr,e as Ar,C as ae}from"./cid-DnxG1pfC.js";function ee(){const t={};return t.promise=new Promise((e,n)=>{t.resolve=e,t.reject=n}),t}class on{constructor(e){v(this,"buffer");v(this,"mask");v(this,"top");v(this,"btm");v(this,"next");if(!(e>0)||e-1&e)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){const e=this.buffer[this.btm];if(e!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}isEmpty(){return this.buffer[this.btm]===void 0}}class At{constructor(e={}){v(this,"size");v(this,"hwm");v(this,"head");v(this,"tail");this.hwm=e.splitLimit??16,this.head=new on(this.hwm),this.tail=this.head,this.size=0}calculateSize(e){return(e==null?void 0:e.byteLength)!=null?e.byteLength:1}push(e){if((e==null?void 0:e.value)!=null&&(this.size+=this.calculateSize(e.value)),!this.head.push(e)){const n=this.head;this.head=n.next=new on(2*this.head.buffer.length),this.head.push(e)}}shift(){let e=this.tail.shift();if(e===void 0&&this.tail.next!=null){const n=this.tail.next;this.tail.next=null,this.tail=n,e=this.tail.shift()}return(e==null?void 0:e.value)!=null&&(this.size-=this.calculateSize(e.value)),e}isEmpty(){return this.head.isEmpty()}}let Cr=class extends Error{constructor(n,r){super(n??"The operation was aborted");v(this,"type");v(this,"code");this.type="aborted",this.code=r??"ABORT_ERR"}};function Ir(t={}){return vr(n=>{const r=n.shift();if(r==null)return{done:!0};if(r.error!=null)throw r.error;return{done:r.done===!0,value:r.value}},t)}function vr(t,e){e=e??{};let n=e.onEnd,r=new At,i,s,o,u=ee();const d=async()=>{try{return r.isEmpty()?o?{done:!0}:await new Promise((c,p)=>{s=D=>{s=null,r.push(D);try{c(t(r))}catch(w){p(w)}return i}}):t(r)}finally{r.isEmpty()&&queueMicrotask(()=>{u.resolve(),u=ee()})}},g=c=>s!=null?s(c):(r.push(c),i),h=c=>(r=new At,s!=null?s({error:c}):(r.push({error:c}),i)),l=c=>{if(o)return i;if((e==null?void 0:e.objectMode)!==!0&&(c==null?void 0:c.byteLength)==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return g({done:!1,value:c})},E=c=>o?i:(o=!0,c!=null?h(c):g({done:!0})),_=()=>(r=new At,E(),{done:!0}),N=c=>(E(c),{done:!0});if(i={[Symbol.asyncIterator](){return this},next:d,return:_,throw:N,push:l,end:E,get readableLength(){return r.size},onEmpty:async c=>{const p=c==null?void 0:c.signal;if(p==null||p.throwIfAborted(),r.isEmpty())return;let D,w;p!=null&&(D=new Promise((b,x)=>{w=()=>{x(new Cr)},p.addEventListener("abort",w)}));try{await Promise.race([u.promise,D])}finally{w!=null&&p!=null&&(p==null||p.removeEventListener("abort",w))}}},n==null)return i;const a=i;return i={[Symbol.asyncIterator](){return this},next(){return a.next()},throw(c){return a.throw(c),n!=null&&(n(c),n=void 0),{done:!0}},return(){return a.return(),n!=null&&(n(),n=void 0),{done:!0}},push:l,end(c){return a.end(c),n!=null&&(n(c),n=void 0),i},get readableLength(){return a.readableLength},onEmpty:c=>a.onEmpty(c)},i}let an=class extends Error{constructor(n,r,i){super(n??"The operation was aborted");v(this,"type");v(this,"code");this.type="aborted",this.name=i??"AbortError",this.code=r??"ABORT_ERR"}};async function Nr(t,e,n){if(e==null)return t;if(e.aborted)return t.catch(()=>{}),Promise.reject(new an(n==null?void 0:n.errorMessage,n==null?void 0:n.errorCode,n==null?void 0:n.errorName));let r;const i=new an(n==null?void 0:n.errorMessage,n==null?void 0:n.errorCode,n==null?void 0:n.errorName);try{return await Promise.race([t,new Promise((s,o)=>{r=()=>{o(i)},e.addEventListener("abort",r)})])}finally{r!=null&&e.removeEventListener("abort",r)}}function ie(t=0){return new Uint8Array(t)}function ce(t=0){return new Uint8Array(t)}const Tr=Math.pow(2,7),Sr=Math.pow(2,14),$r=Math.pow(2,21),Pt=Math.pow(2,28),zt=Math.pow(2,35),Mt=Math.pow(2,42),jt=Math.pow(2,49),B=128,j=127;function Xe(t){if(tNumber.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Cn(t,e,n=0){switch(Xe(t)){case 8:e[n++]=t&255|B,t/=128;case 7:e[n++]=t&255|B,t/=128;case 6:e[n++]=t&255|B,t/=128;case 5:e[n++]=t&255|B,t/=128;case 4:e[n++]=t&255|B,t>>>=7;case 3:e[n++]=t&255|B,t>>>=7;case 2:e[n++]=t&255|B,t>>>=7;case 1:{e[n++]=t&255,t>>>=7;break}default:throw new Error("unreachable")}return e}function Fr(t,e,n=0){switch(Xe(t)){case 8:e.set(n++,t&255|B),t/=128;case 7:e.set(n++,t&255|B),t/=128;case 6:e.set(n++,t&255|B),t/=128;case 5:e.set(n++,t&255|B),t/=128;case 4:e.set(n++,t&255|B),t>>>=7;case 3:e.set(n++,t&255|B),t>>>=7;case 2:e.set(n++,t&255|B),t>>>=7;case 1:{e.set(n++,t&255),t>>>=7;break}default:throw new Error("unreachable")}return e}function In(t,e){let n=t[e],r=0;if(r+=n&j,ni+s.length,0));const n=ce(e);let r=0;for(const i of t)n.set(i,r),r+=i.length;return n}function Lr(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let n=0;n0&&this.appendAll(e)}*[(_n=vn,Symbol.iterator)](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let n=0;for(const r of e)if(r instanceof Uint8Array)n+=r.byteLength,this.bufs.push(r);else if(tt(r))n+=r.byteLength,this.bufs.push(...r.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=n}prepend(...e){this.prependAll(e)}prependAll(e){let n=0;for(const r of e.reverse())if(r instanceof Uint8Array)n+=r.byteLength,this.bufs.unshift(r);else if(tt(r))n+=r.byteLength,this.bufs.unshift(...r.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=n}get(e){const n=cn(this.bufs,e);return n.buf[n.index]}set(e,n){const r=cn(this.bufs,e);r.buf[r.index]=n}write(e,n=0){if(e instanceof Uint8Array)for(let r=0;r0;)if(e>=this.bufs[0].byteLength)e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}}}slice(e,n){const{bufs:r,length:i}=this._subList(e,n);return un(r,i)}subarray(e,n){const{bufs:r,length:i}=this._subList(e,n);return r.length===1?r[0]:un(r,i)}sublist(e,n){const{bufs:r,length:i}=this._subList(e,n),s=new st;return s.length=i,s.bufs=[...r],s}_subList(e,n){if(e=e??0,n=n??this.length,e<0&&(e=this.length+e),n<0&&(n=this.length+n),e<0||n>this.length)throw new RangeError("index is out of bounds");if(e===n)return{bufs:[],length:0};if(e===0&&n===this.length)return{bufs:this.bufs,length:this.length};const r=[];let i=0;for(let s=0;s=d)continue;const g=e>=u&&eu&&n<=d;if(g&&h){if(e===u&&n===d){r.push(o);break}const l=e-u;r.push(o.subarray(l,l+(n-e)));break}if(g){if(e===0){r.push(o);continue}r.push(o.subarray(e-u));continue}if(h){if(n===d){r.push(o);break}r.push(o.subarray(0,n-u));break}r.push(o)}return{bufs:r,length:n-e}}indexOf(e,n=0){if(!tt(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');const r=e instanceof Uint8Array?e:e.subarray();if(n=Number(n??0),isNaN(n)&&(n=0),n<0&&(n=this.length+n),n<0&&(n=0),e.length===0)return n>this.length?this.length:n;const i=r.byteLength;if(i===0)throw new TypeError("search must be at least 1 byte long");const s=256,o=new Int32Array(s);for(let l=0;l=0;E--){const _=this.get(l+E);if(r[E]!==_){h=Math.max(1,E-u[_]);break}}if(h===0)return l}return-1}getInt8(e){const n=this.subarray(e,e+1);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt8(0)}setInt8(e,n){const r=ce(1);new DataView(r.buffer,r.byteOffset,r.byteLength).setInt8(0,n),this.write(r,e)}getInt16(e,n){const r=this.subarray(e,e+2);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt16(0,n)}setInt16(e,n,r){const i=ie(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt16(0,n,r),this.write(i,e)}getInt32(e,n){const r=this.subarray(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt32(0,n)}setInt32(e,n,r){const i=ie(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(0,n,r),this.write(i,e)}getBigInt64(e,n){const r=this.subarray(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getBigInt64(0,n)}setBigInt64(e,n,r){const i=ie(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigInt64(0,n,r),this.write(i,e)}getUint8(e){const n=this.subarray(e,e+1);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint8(0)}setUint8(e,n){const r=ce(1);new DataView(r.buffer,r.byteOffset,r.byteLength).setUint8(0,n),this.write(r,e)}getUint16(e,n){const r=this.subarray(e,e+2);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint16(0,n)}setUint16(e,n,r){const i=ie(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint16(0,n,r),this.write(i,e)}getUint32(e,n){const r=this.subarray(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint32(0,n)}setUint32(e,n,r){const i=ie(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,n,r),this.write(i,e)}getBigUint64(e,n){const r=this.subarray(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getBigUint64(0,n)}setBigUint64(e,n,r){const i=ie(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigUint64(0,n,r),this.write(i,e)}getFloat32(e,n){const r=this.subarray(e,e+4);return new DataView(r.buffer,r.byteOffset,r.byteLength).getFloat32(0,n)}setFloat32(e,n,r){const i=ie(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(0,n,r),this.write(i,e)}getFloat64(e,n){const r=this.subarray(e,e+8);return new DataView(r.buffer,r.byteOffset,r.byteLength).getFloat64(0,n)}setFloat64(e,n,r){const i=ie(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(0,n,r),this.write(i,e)}equals(e){if(e==null||!(e instanceof st)||e.bufs.length!==this.bufs.length)return!1;for(let n=0;ni+s.byteLength,0)),r.length=n,r}}function Nn(t){const[e,n]=t[Symbol.asyncIterator]!=null?[t[Symbol.asyncIterator](),Symbol.asyncIterator]:[t[Symbol.iterator](),Symbol.iterator],r=[];return{peek:()=>e.next(),push:i=>{r.push(i)},next:()=>r.length>0?{done:!1,value:r.shift()}:e.next(),[n](){return this}}}function Dr(t){return t[Symbol.asyncIterator]!=null}function Aa(t,e){let n=0;if(Dr(t))return async function*(){for await(const d of t)yield e(d,n++)}();const r=Nn(t),{value:i,done:s}=r.next();if(s===!0)return function*(){}();const o=e(i,n++);if(typeof o.then=="function")return async function*(){yield await o;for(const d of r)yield e(d,n++)}();const u=e;return function*(){yield o;for(const d of r)yield u(d,n++)}()}class Ur{constructor(){v(this,"readNext");v(this,"haveNext");v(this,"ended");v(this,"nextResult");v(this,"error");this.ended=!1,this.readNext=ee(),this.haveNext=ee()}[Symbol.asyncIterator](){return this}async next(){if(this.nextResult==null&&await this.haveNext.promise,this.nextResult==null)throw new Error("HaveNext promise resolved but nextResult was undefined");const e=this.nextResult;return this.nextResult=void 0,this.readNext.resolve(),this.readNext=ee(),e}async throw(e){return this.ended=!0,this.error=e,e!=null&&(this.haveNext.promise.catch(()=>{}),this.haveNext.reject(e)),{done:!0,value:void 0}}async return(){const e={done:!0,value:void 0};return this.ended=!0,this.nextResult=e,this.haveNext.resolve(),e}async push(e,n){await this._push(e,n)}async end(e,n){e!=null?await this.throw(e):await this._push(void 0,n)}async _push(e,n){if(e!=null&&this.ended)throw this.error??new Error("Cannot push value onto an ended pushable");for(;this.nextResult!=null;)await this.readNext.promise;e!=null?this.nextResult={done:!1,value:e}:(this.ended=!0,this.nextResult={done:!0,value:void 0}),this.haveNext.resolve(),this.haveNext=ee(),await Nr(this.readNext.promise,n==null?void 0:n.signal,n)}}function Or(){return new Ur}function Pr(t){return t[Symbol.asyncIterator]!=null}async function zr(t,e,n){try{await Promise.all(t.map(async r=>{for await(const i of r)await e.push(i,{signal:n}),n.throwIfAborted()})),await e.end(void 0,{signal:n})}catch(r){await e.end(r,{signal:n}).catch(()=>{})}}async function*Mr(t){const e=new AbortController,n=Or();zr(t,n,e.signal).catch(()=>{});try{yield*n}finally{e.abort()}}function*jr(t){for(const e of t)yield*e}function Rr(...t){const e=[];for(const n of t)Pr(n)||e.push(n);return e.length===t.length?jr(e):Mr(t)}function Ca(t,...e){if(t==null)throw new Error("Empty pipeline");if(Ct(t)){const r=t;t=()=>r.source}else if(Sn(t)||Tn(t)){const r=t;t=()=>r}const n=[t,...e];if(n.length>1&&Ct(n[n.length-1])&&(n[n.length-1]=n[n.length-1].sink),n.length>2)for(let r=1;r{let e;for(;t.length>0;)e=t.shift()(e);return e},Tn=t=>(t==null?void 0:t[Symbol.asyncIterator])!=null,Sn=t=>(t==null?void 0:t[Symbol.iterator])!=null,Ct=t=>t==null?!1:t.sink!=null&&t.source!=null,Hr=t=>e=>{const n=t.sink(e);if((n==null?void 0:n.then)!=null){const r=Ir({objectMode:!0});n.then(()=>{r.end()},o=>{r.end(o)});let i;const s=t.source;if(Tn(s))i=async function*(){yield*s,r.end()};else if(Sn(s))i=function*(){yield*s,r.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return Rr(r,i())}return t.source};class Ia extends Event{constructor(n,r){super(n);v(this,"type");v(this,"detail");this.type=n,this.detail=r}}const Rt=new Float32Array([-0]),ue=new Uint8Array(Rt.buffer);function Gr(t,e,n){Rt[0]=t,e[n]=ue[0],e[n+1]=ue[1],e[n+2]=ue[2],e[n+3]=ue[3]}function qr(t,e){return ue[0]=t[e],ue[1]=t[e+1],ue[2]=t[e+2],ue[3]=t[e+3],Rt[0]}const Vt=new Float64Array([-0]),R=new Uint8Array(Vt.buffer);function Wr(t,e,n){Vt[0]=t,e[n]=R[0],e[n+1]=R[1],e[n+2]=R[2],e[n+3]=R[3],e[n+4]=R[4],e[n+5]=R[5],e[n+6]=R[6],e[n+7]=R[7]}function Xr(t,e){return R[0]=t[e],R[1]=t[e+1],R[2]=t[e+2],R[3]=t[e+3],R[4]=t[e+4],R[5]=t[e+5],R[6]=t[e+6],R[7]=t[e+7],Vt[0]}const Jr=BigInt(Number.MAX_SAFE_INTEGER),Kr=BigInt(Number.MIN_SAFE_INTEGER);class V{constructor(e,n){v(this,"lo");v(this,"hi");this.lo=e|0,this.hi=n|0}toNumber(e=!1){if(!e&&this.hi>>>31>0){const n=~this.lo+1>>>0;let r=~this.hi>>>0;return n===0&&(r=r+1>>>0),-(n+r*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){const n=~this.lo+1>>>0;let r=~this.hi>>>0;return n===0&&(r=r+1>>>0),-(BigInt(n)+(BigInt(r)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){const e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){const e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){const e=this.lo,n=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return r===0?n===0?e<16384?e<128?1:2:e<2097152?3:4:n<16384?n<128?5:6:n<2097152?7:8:r<128?9:10}static fromBigInt(e){if(e===0n)return de;if(eKr)return this.fromNumber(Number(e));const n=e<0n;n&&(e=-e);let r=e>>32n,i=e-(r<<32n);return n&&(r=~r|0n,i=~i|0n,++i>fn&&(i=0n,++r>fn&&(r=0n))),new V(Number(i),Number(r))}static fromNumber(e){if(e===0)return de;const n=e<0;n&&(e=-e);let r=e>>>0,i=(e-r)/4294967296>>>0;return n&&(i=~i>>>0,r=~r>>>0,++r>4294967295&&(r=0,++i>4294967295&&(i=0))),new V(r,i)}static from(e){return typeof e=="number"?V.fromNumber(e):typeof e=="bigint"?V.fromBigInt(e):typeof e=="string"?V.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new V(e.low>>>0,e.high>>>0):de}}const de=new V(0,0);de.toBigInt=function(){return 0n};de.zzEncode=de.zzDecode=function(){return this};de.length=function(){return 1};const fn=4294967296n;function Zr(t){let e=0,n=0;for(let r=0;r191&&u<224?s[o++]=(u&31)<<6|t[e++]&63:u>239&&u<365?(u=((u&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,s[o++]=55296+(u>>10),s[o++]=56320+(u&1023)):s[o++]=(u&15)<<12|(t[e++]&63)<<6|t[e++]&63,o>8191&&((i??(i=[])).push(String.fromCharCode.apply(String,s)),o=0);return i!=null?(o>0&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))}function $n(t,e,n){const r=n;let i,s;for(let o=0;o>6|192,e[n++]=i&63|128):(i&64512)===55296&&((s=t.charCodeAt(o+1))&64512)===56320?(i=65536+((i&1023)<<10)+(s&1023),++o,e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128);return n-r}function Z(t,e){return RangeError(`index out of range: ${t.pos} + ${e??1} > ${t.len}`)}function nt(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}class Yr{constructor(e){v(this,"buf");v(this,"pos");v(this,"len");v(this,"_slice",Uint8Array.prototype.subarray);this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Z(this,10);return e}int32(){return this.uint32()|0}sint32(){const e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw Z(this,4);return nt(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw Z(this,4);return nt(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw Z(this,4);const e=qr(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw Z(this,4);const e=Xr(this.buf,this.pos);return this.pos+=8,e}bytes(){const e=this.uint32(),n=this.pos,r=this.pos+e;if(r>this.len)throw Z(this,e);return this.pos+=e,n===r?new Uint8Array(0):this.buf.subarray(n,r)}string(){const e=this.bytes();return Qr(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Z(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Z(this);while(this.buf[this.pos++]&128);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){const e=new V(0,0);let n=0;if(this.len-this.pos>4){for(;n<4;++n)if(e.lo=(e.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;n=0}else{for(;n<3;++n){if(this.pos>=this.len)throw Z(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<>>0,e}if(this.len-this.pos>4){for(;n<5;++n)if(e.hi=(e.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return e}else for(;n<5;++n){if(this.pos>=this.len)throw Z(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw Z(this,8);const e=nt(this.buf,this.pos+=4),n=nt(this.buf,this.pos+=4);return new V(e,n)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){const e=In(this.buf,this.pos);return this.pos+=Xe(e),e}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}}function ei(t){return new Yr(t instanceof Uint8Array?t:t.subarray())}function va(t,e,n){const r=ei(t);return e.decode(r,void 0,n)}const ti=yr({prefix:"9",name:"base10",alphabet:"0123456789"}),ni=Object.freeze(Object.defineProperty({__proto__:null,base10:ti},Symbol.toStringTag,{value:"Module"})),ri=he({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ii=he({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),si=Object.freeze(Object.defineProperty({__proto__:null,base16:ri,base16upper:ii},Symbol.toStringTag,{value:"Module"})),oi=he({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),ai=Object.freeze(Object.defineProperty({__proto__:null,base2:oi},Symbol.toStringTag,{value:"Module"})),Fn=Array.from("๐Ÿš€๐Ÿชโ˜„๐Ÿ›ฐ๐ŸŒŒ๐ŸŒ‘๐ŸŒ’๐ŸŒ“๐ŸŒ”๐ŸŒ•๐ŸŒ–๐ŸŒ—๐ŸŒ˜๐ŸŒ๐ŸŒ๐ŸŒŽ๐Ÿ‰โ˜€๐Ÿ’ป๐Ÿ–ฅ๐Ÿ’พ๐Ÿ’ฟ๐Ÿ˜‚โค๐Ÿ˜๐Ÿคฃ๐Ÿ˜Š๐Ÿ™๐Ÿ’•๐Ÿ˜ญ๐Ÿ˜˜๐Ÿ‘๐Ÿ˜…๐Ÿ‘๐Ÿ˜๐Ÿ”ฅ๐Ÿฅฐ๐Ÿ’”๐Ÿ’–๐Ÿ’™๐Ÿ˜ข๐Ÿค”๐Ÿ˜†๐Ÿ™„๐Ÿ’ช๐Ÿ˜‰โ˜บ๐Ÿ‘Œ๐Ÿค—๐Ÿ’œ๐Ÿ˜”๐Ÿ˜Ž๐Ÿ˜‡๐ŸŒน๐Ÿคฆ๐ŸŽ‰๐Ÿ’žโœŒโœจ๐Ÿคท๐Ÿ˜ฑ๐Ÿ˜Œ๐ŸŒธ๐Ÿ™Œ๐Ÿ˜‹๐Ÿ’—๐Ÿ’š๐Ÿ˜๐Ÿ’›๐Ÿ™‚๐Ÿ’“๐Ÿคฉ๐Ÿ˜„๐Ÿ˜€๐Ÿ–ค๐Ÿ˜ƒ๐Ÿ’ฏ๐Ÿ™ˆ๐Ÿ‘‡๐ŸŽถ๐Ÿ˜’๐Ÿคญโฃ๐Ÿ˜œ๐Ÿ’‹๐Ÿ‘€๐Ÿ˜ช๐Ÿ˜‘๐Ÿ’ฅ๐Ÿ™‹๐Ÿ˜ž๐Ÿ˜ฉ๐Ÿ˜ก๐Ÿคช๐Ÿ‘Š๐Ÿฅณ๐Ÿ˜ฅ๐Ÿคค๐Ÿ‘‰๐Ÿ’ƒ๐Ÿ˜ณโœ‹๐Ÿ˜š๐Ÿ˜๐Ÿ˜ด๐ŸŒŸ๐Ÿ˜ฌ๐Ÿ™ƒ๐Ÿ€๐ŸŒท๐Ÿ˜ป๐Ÿ˜“โญโœ…๐Ÿฅบ๐ŸŒˆ๐Ÿ˜ˆ๐Ÿค˜๐Ÿ’ฆโœ”๐Ÿ˜ฃ๐Ÿƒ๐Ÿ’โ˜น๐ŸŽŠ๐Ÿ’˜๐Ÿ˜ โ˜๐Ÿ˜•๐ŸŒบ๐ŸŽ‚๐ŸŒป๐Ÿ˜๐Ÿ–•๐Ÿ’๐Ÿ™Š๐Ÿ˜น๐Ÿ—ฃ๐Ÿ’ซ๐Ÿ’€๐Ÿ‘‘๐ŸŽต๐Ÿคž๐Ÿ˜›๐Ÿ”ด๐Ÿ˜ค๐ŸŒผ๐Ÿ˜ซโšฝ๐Ÿค™โ˜•๐Ÿ†๐Ÿคซ๐Ÿ‘ˆ๐Ÿ˜ฎ๐Ÿ™†๐Ÿป๐Ÿƒ๐Ÿถ๐Ÿ’๐Ÿ˜ฒ๐ŸŒฟ๐Ÿงก๐ŸŽโšก๐ŸŒž๐ŸŽˆโŒโœŠ๐Ÿ‘‹๐Ÿ˜ฐ๐Ÿคจ๐Ÿ˜ถ๐Ÿค๐Ÿšถ๐Ÿ’ฐ๐Ÿ“๐Ÿ’ข๐ŸคŸ๐Ÿ™๐Ÿšจ๐Ÿ’จ๐Ÿคฌโœˆ๐ŸŽ€๐Ÿบ๐Ÿค“๐Ÿ˜™๐Ÿ’Ÿ๐ŸŒฑ๐Ÿ˜–๐Ÿ‘ถ๐Ÿฅดโ–ถโžกโ“๐Ÿ’Ž๐Ÿ’ธโฌ‡๐Ÿ˜จ๐ŸŒš๐Ÿฆ‹๐Ÿ˜ท๐Ÿ•บโš ๐Ÿ™…๐Ÿ˜Ÿ๐Ÿ˜ต๐Ÿ‘Ž๐Ÿคฒ๐Ÿค ๐Ÿคง๐Ÿ“Œ๐Ÿ”ต๐Ÿ’…๐Ÿง๐Ÿพ๐Ÿ’๐Ÿ˜—๐Ÿค‘๐ŸŒŠ๐Ÿคฏ๐Ÿทโ˜Ž๐Ÿ’ง๐Ÿ˜ฏ๐Ÿ’†๐Ÿ‘†๐ŸŽค๐Ÿ™‡๐Ÿ‘โ„๐ŸŒด๐Ÿ’ฃ๐Ÿธ๐Ÿ’Œ๐Ÿ“๐Ÿฅ€๐Ÿคข๐Ÿ‘…๐Ÿ’ก๐Ÿ’ฉ๐Ÿ‘๐Ÿ“ธ๐Ÿ‘ป๐Ÿค๐Ÿคฎ๐ŸŽผ๐Ÿฅต๐Ÿšฉ๐ŸŽ๐ŸŠ๐Ÿ‘ผ๐Ÿ’๐Ÿ“ฃ๐Ÿฅ‚"),ui=Fn.reduce((t,e,n)=>(t[n]=e,t),[]),ci=Fn.reduce((t,e,n)=>{const r=e.codePointAt(0);if(r==null)throw new Error(`Invalid character: ${e}`);return t[r]=n,t},[]);function fi(t){return t.reduce((e,n)=>(e+=ui[n],e),"")}function hi(t){const e=[];for(const n of t){const r=n.codePointAt(0);if(r==null)throw new Error(`Invalid character: ${n}`);const i=ci[r];if(i==null)throw new Error(`Non-base256emoji character: ${n}`);e.push(i)}return new Uint8Array(e)}const li=kn({prefix:"๐Ÿš€",name:"base256emoji",encode:fi,decode:hi}),di=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:li},Symbol.toStringTag,{value:"Module"})),Ht=he({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),pi=he({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),wi=he({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),gi=he({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),yi=Object.freeze(Object.defineProperty({__proto__:null,base64:Ht,base64pad:pi,base64url:wi,base64urlpad:gi},Symbol.toStringTag,{value:"Module"})),mi=he({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),bi=Object.freeze(Object.defineProperty({__proto__:null,base8:mi},Symbol.toStringTag,{value:"Module"})),xi=kn({prefix:"\0",name:"identity",encode:t=>mr(t),decode:t=>br(t)}),Ei=Object.freeze(Object.defineProperty({__proto__:null,identity:xi},Symbol.toStringTag,{value:"Module"}));new TextEncoder;const _i=new TextDecoder,Na=512;function Ta(t){return JSON.parse(_i.decode(t))}const ki="raw",Ai=85;function Ci(t){return Ot(t)}function Ii(t){return Ot(t)}const Sa=Object.freeze(Object.defineProperty({__proto__:null,code:Ai,decode:Ii,encode:Ci,name:ki},Symbol.toStringTag,{value:"Module"})),Bn=0,vi="identity",Ln=Ot;function Ni(t,e){if((e==null?void 0:e.truncate)!=null&&e.truncate!==t.byteLength){if(e.truncate<0||e.truncate>t.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${t.byteLength}`);t=t.subarray(0,e.truncate)}return An(Bn,Ln(t))}const $a={code:Bn,name:vi,encode:Ln,digest:Ni},Ti=20;function Dn({name:t,code:e,encode:n,minDigestLength:r,maxDigestLength:i}){return new Si(t,e,n,r,i)}class Si{constructor(e,n,r,i,s){v(this,"name");v(this,"code");v(this,"encode");v(this,"minDigestLength");v(this,"maxDigestLength");this.name=e,this.code=n,this.encode=r,this.minDigestLength=i??Ti,this.maxDigestLength=s}digest(e,n){if((n==null?void 0:n.truncate)!=null){if(n.truncatethis.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?hn(r,this.code,n==null?void 0:n.truncate):r.then(i=>hn(i,this.code,n==null?void 0:n.truncate))}else throw Error("Unknown type, must be binary type")}}function hn(t,e,n){if(n!=null&&n!==t.byteLength){if(n>t.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${t.byteLength}`);t=t.subarray(0,n)}return An(e,t)}function Un(t){return async e=>new Uint8Array(await crypto.subtle.digest(t,e))}const Fa=Dn({name:"sha2-256",code:18,encode:Un("SHA-256")}),Ba=Dn({name:"sha2-512",code:19,encode:Un("SHA-512")}),ln={...Ei,...ai,...bi,...ni,...si,..._r,...Er,...xr,...yi,...di};function On(t,e,n,r){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:n},decoder:{decode:r}}}const dn=On("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),It=On("ascii","a",t=>{let e="a";for(let n=0;n{t=t.substring(1);const e=ce(t.length);for(let n=0;n4096)return ce(o);i+o>8192&&(r=ce(8192),i=0);const u=r.subarray(i,i+=o);return i&7&&(i=(i|7)+1),u}}class Pe{constructor(e,n,r){v(this,"fn");v(this,"len");v(this,"next");v(this,"val");this.fn=e,this.len=n,this.next=void 0,this.val=r}}function vt(){}class Li{constructor(e){v(this,"head");v(this,"tail");v(this,"len");v(this,"next");this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}}const Di=Bi();function Ui(t){return globalThis.Buffer!=null?ce(t):Di(t)}class St{constructor(){v(this,"len");v(this,"head");v(this,"tail");v(this,"states");this.len=0,this.head=new Pe(vt,0,0),this.tail=this.head,this.states=null}_push(e,n,r){return this.tail=this.tail.next=new Pe(e,n,r),this.len+=n,this}uint32(e){return this.len+=(this.tail=this.tail.next=new Pi((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(rt,10,V.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){const n=V.fromBigInt(e);return this._push(rt,n.length(),n)}uint64Number(e){return this._push(Cn,Xe(e),e)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){const n=V.fromBigInt(e).zzEncode();return this._push(rt,n.length(),n)}sint64Number(e){const n=V.fromNumber(e).zzEncode();return this._push(rt,n.length(),n)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(Nt,1,e?1:0)}fixed32(e){return this._push(Oe,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){const n=V.fromBigInt(e);return this._push(Oe,4,n.lo)._push(Oe,4,n.hi)}fixed64Number(e){const n=V.fromNumber(e);return this._push(Oe,4,n.lo)._push(Oe,4,n.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(Gr,4,e)}double(e){return this._push(Wr,8,e)}bytes(e){const n=e.length>>>0;return n===0?this._push(Nt,1,0):this.uint32(n)._push(zi,n,e)}string(e){const n=Zr(e);return n!==0?this.uint32(n)._push($n,n,e):this._push(Nt,1,0)}fork(){return this.states=new Li(this),this.head=this.tail=new Pe(vt,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Pe(vt,0,0),this.len=0),this}ldelim(){const e=this.head,n=this.tail,r=this.len;return this.reset().uint32(r),r!==0&&(this.tail.next=e.next,this.tail=n,this.len+=r),this}finish(){let e=this.head.next;const n=Ui(this.len);let r=0;for(;e!=null;)e.fn(e.val,n,r),r+=e.len,e=e.next;return n}}function Nt(t,e,n){e[n]=t&255}function Oi(t,e,n){for(;t>127;)e[n++]=t&127|128,t>>>=7;e[n]=t}class Pi extends Pe{constructor(n,r){super(Oi,n,r);v(this,"next");this.next=void 0}}function rt(t,e,n){for(;t.hi!==0;)e[n++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[n++]=t.lo&127|128,t.lo=t.lo>>>7;e[n++]=t.lo}function Oe(t,e,n){e[n]=t&255,e[n+1]=t>>>8&255,e[n+2]=t>>>16&255,e[n+3]=t>>>24}function zi(t,e,n){e.set(t,n)}globalThis.Buffer!=null&&(St.prototype.bytes=function(t){const e=t.length>>>0;return this.uint32(e),e>0&&this._push(Mi,e,t),this},St.prototype.string=function(t){const e=globalThis.Buffer.byteLength(t);return this.uint32(e),e>0&&this._push(ji,e,t),this});function Mi(t,e,n){e.set(t,n)}function ji(t,e,n){t.length<40?$n(t,e,n):e.utf8Write!=null?e.utf8Write(t,n):e.set(Fi(t),n)}function Ri(){return new St}function La(t,e){const n=Ri();return e.encode(t,n,{lengthDelimited:!1}),n.finish()}var ft;(function(t){t[t.VARINT=0]="VARINT",t[t.BIT64=1]="BIT64",t[t.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",t[t.START_GROUP=3]="START_GROUP",t[t.END_GROUP=4]="END_GROUP",t[t.BIT32=5]="BIT32"})(ft||(ft={}));function Pn(t,e,n,r){return{name:t,type:e,encode:n,decode:r}}function Da(t){function e(i){if(t[i.toString()]==null)throw new Error("Invalid enum value");return t[i]}const n=function(s,o){const u=e(s);o.int32(u)},r=function(s){const o=s.int32();return e(o)};return Pn("enum",ft.VARINT,n,r)}function Ua(t,e){return Pn("message",ft.LENGTH_DELIMITED,t,e)}var Vi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Gt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var $t={exports:{}};(function(t,e){(function(n,r){var i={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function s(a){if(!Array.isArray(a)&&!ArrayBuffer.isView(a))return!1;for(var c=0;c255)return!1;return!0}function o(a,c){return(a&65535)*c+(((a>>>16)*c&65535)<<16)}function u(a,c){return a<>>32-c}function d(a){return a^=a>>>16,a=o(a,2246822507),a^=a>>>13,a=o(a,3266489909),a^=a>>>16,a}function g(a,c){a=[a[0]>>>16,a[0]&65535,a[1]>>>16,a[1]&65535],c=[c[0]>>>16,c[0]&65535,c[1]>>>16,c[1]&65535];var p=[0,0,0,0];return p[3]+=a[3]+c[3],p[2]+=p[3]>>>16,p[3]&=65535,p[2]+=a[2]+c[2],p[1]+=p[2]>>>16,p[2]&=65535,p[1]+=a[1]+c[1],p[0]+=p[1]>>>16,p[1]&=65535,p[0]+=a[0]+c[0],p[0]&=65535,[p[0]<<16|p[1],p[2]<<16|p[3]]}function h(a,c){a=[a[0]>>>16,a[0]&65535,a[1]>>>16,a[1]&65535],c=[c[0]>>>16,c[0]&65535,c[1]>>>16,c[1]&65535];var p=[0,0,0,0];return p[3]+=a[3]*c[3],p[2]+=p[3]>>>16,p[3]&=65535,p[2]+=a[2]*c[3],p[1]+=p[2]>>>16,p[2]&=65535,p[2]+=a[3]*c[2],p[1]+=p[2]>>>16,p[2]&=65535,p[1]+=a[1]*c[3],p[0]+=p[1]>>>16,p[1]&=65535,p[1]+=a[2]*c[2],p[0]+=p[1]>>>16,p[1]&=65535,p[1]+=a[3]*c[1],p[0]+=p[1]>>>16,p[1]&=65535,p[0]+=a[0]*c[3]+a[1]*c[2]+a[2]*c[1]+a[3]*c[0],p[0]&=65535,[p[0]<<16|p[1],p[2]<<16|p[3]]}function l(a,c){return c%=64,c===32?[a[1],a[0]]:c<32?[a[0]<>>32-c,a[1]<>>32-c]:(c-=32,[a[1]<>>32-c,a[0]<>>32-c])}function E(a,c){return c%=64,c===0?a:c<32?[a[0]<>>32-c,a[1]<>>1]),a=h(a,[4283543511,3981806797]),a=_(a,[0,a[0]>>>1]),a=h(a,[3301882366,444984403]),a=_(a,[0,a[0]>>>1]),a}i.x86.hash32=function(a,c){if(i.inputValidation&&!s(a))return r;c=c||0;for(var p=a.length%4,D=a.length-p,w=c,b=0,x=3432918353,I=461845907,T=0;T>>0},i.x86.hash128=function(a,c){if(i.inputValidation&&!s(a))return r;c=c||0;for(var p=a.length%16,D=a.length-p,w=c,b=c,x=c,I=c,T=0,L=0,k=0,O=0,Ze=597399067,Qe=2869860233,Ye=951274213,et=2716044179,S=0;S>>0).toString(16)).slice(-8)+("00000000"+(b>>>0).toString(16)).slice(-8)+("00000000"+(x>>>0).toString(16)).slice(-8)+("00000000"+(I>>>0).toString(16)).slice(-8)},i.x64.hash128=function(a,c){if(i.inputValidation&&!s(a))return r;c=c||0;for(var p=a.length%16,D=a.length-p,w=[0,c],b=[0,c],x=[0,0],I=[0,0],T=[2277735313,289559509],L=[1291169091,658871167],k=0;k>>0).toString(16)).slice(-8)+("00000000"+(w[1]>>>0).toString(16)).slice(-8)+("00000000"+(b[0]>>>0).toString(16)).slice(-8)+("00000000"+(b[1]>>>0).toString(16)).slice(-8)},t.exports&&(e=t.exports=i),e.murmurHash3=i})()})($t,$t.exports);var Hi=$t.exports,Gi=Hi;const Oa=Gt(Gi),Ie=1e3,ve=Ie*60,Ne=ve*60,pe=Ne*24,Me=pe*7,Te=pe*365.25,je=Te/12;function qi(t,e){if(typeof t=="string")return Wi(t);if(typeof t=="number")return Ki(t,e);throw Error(`Value provided to ms() must be a string or number. value=${JSON.stringify(t)}`)}var zn=qi;function Wi(t){if(typeof t!="string"||t.length===0||t.length>100)throw Error(`Value provided to ms.parse() must be a string with length between 1 and 99. value=${JSON.stringify(t)}`);let e=/^(?-?\d*\.?\d+) *(?milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|months?|mo|years?|yrs?|y)?$/i.exec(t);if(!(e!=null&&e.groups))return NaN;let{value:n,unit:r="ms"}=e.groups,i=parseFloat(n),s=r.toLowerCase();switch(s){case"years":case"year":case"yrs":case"yr":case"y":return i*Te;case"months":case"month":case"mo":return i*je;case"weeks":case"week":case"w":return i*Me;case"days":case"day":case"d":return i*pe;case"hours":case"hour":case"hrs":case"hr":case"h":return i*Ne;case"minutes":case"minute":case"mins":case"min":case"m":return i*ve;case"seconds":case"second":case"secs":case"sec":case"s":return i*Ie;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return i;default:throw Error(`Unknown unit "${s}" provided to ms.parse(). value=${JSON.stringify(t)}`)}}function Xi(t){let e=Math.abs(t);return e>=Te?`${Math.round(t/Te)}y`:e>=je?`${Math.round(t/je)}mo`:e>=Me?`${Math.round(t/Me)}w`:e>=pe?`${Math.round(t/pe)}d`:e>=Ne?`${Math.round(t/Ne)}h`:e>=ve?`${Math.round(t/ve)}m`:e>=Ie?`${Math.round(t/Ie)}s`:`${t}ms`}function Ji(t){let e=Math.abs(t);return e>=Te?le(t,e,Te,"year"):e>=je?le(t,e,je,"month"):e>=Me?le(t,e,Me,"week"):e>=pe?le(t,e,pe,"day"):e>=Ne?le(t,e,Ne,"hour"):e>=ve?le(t,e,ve,"minute"):e>=Ie?le(t,e,Ie,"second"):`${t} ms`}function Ki(t,e){if(typeof t!="number"||!Number.isFinite(t))throw Error("Value provided to ms.format() must be of type number.");return e!=null&&e.long?Ji(t):Xi(t)}function le(t,e,n,r){let i=e>=n*1.5;return`${Math.round(t/n)} ${r}${i?"s":""}`}function Zi(t){n.debug=n,n.default=n,n.coerce=d,n.disable=s,n.enable=i,n.enabled=o,n.humanize=zn,n.destroy=g,Object.keys(t).forEach(h=>{n[h]=t[h]}),n.names=[],n.skips=[],n.formatters={};function e(h){let l=0;for(let E=0;E{if(T==="%%")return"%";x++;const k=n.formatters[L];if(typeof k=="function"){const O=p[x];T=k.call(D,O),p.splice(x,1),x--}return T}),n.formatArgs.call(D,p),(l==null?void 0:l.onLog)!=null&&l.onLog(...p),(D.log||n.log).apply(D,p)}return c.namespace=h,c.useColors=n.useColors(),c.color=n.selectColor(h),c.extend=r,c.destroy=n.destroy,Object.defineProperty(c,"enabled",{enumerable:!0,configurable:!1,get:()=>_!==null?_:(N!==n.namespaces&&(N=n.namespaces,a=n.enabled(h)),a),set:p=>{_=p}}),typeof n.init=="function"&&n.init(c),c}function r(h,l){const E=n(this.namespace+(typeof l>"u"?":":l)+h);return E.log=this.log,E}function i(h){n.save(h),n.namespaces=h,n.names=[],n.skips=[];let l;const E=(typeof h=="string"?h:"").split(/[\s,]+/),_=E.length;for(l=0;l<_;l++)E[l]&&(h=E[l].replace(/\*/g,".*?"),h[0]==="-"?n.skips.push(new RegExp("^"+h.substr(1)+"$")):n.names.push(new RegExp("^"+h+"$")))}function s(){const h=[...n.names.map(u),...n.skips.map(u).map(l=>"-"+l)].join(",");return n.enable(""),h}function o(h){if(h[h.length-1]==="*")return!0;let l,E;for(l=0,E=n.skips.length;l=31||typeof navigator<"u"&&((i=navigator.userAgent)==null?void 0:i.toLowerCase().match(/applewebkit\/(\d+)/))}function ts(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+zn(this.diff),!this.useColors)return;const e="color: "+this.color;t.splice(1,0,e,"color: inherit");let n=0,r=0;t[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(n++,i==="%c"&&(r=n))}),t.splice(r,0,e)}const ns=console.debug??console.log??(()=>{});function rs(t){try{t?Y==null||Y.setItem("debug",t):Y==null||Y.removeItem("debug")}catch{}}function is(){let t;try{t=Y==null?void 0:Y.getItem("debug")}catch{}return!t&&typeof globalThis.process<"u"&&"env"in globalThis.process&&(t=Qi.DEBUG),t}function ss(){try{return localStorage}catch{}}function os(t){t.j=function(e){try{return JSON.stringify(e)}catch(n){return"[UnexpectedJSONParseError]: "+n.message}}}const J=Zi({formatArgs:ts,save:rs,load:is,useColors:es,setupFormatters:os,colors:Yi,storage:Y,log:ns});J.formatters.b=t=>t==null?"undefined":kr.baseEncode(t);J.formatters.t=t=>t==null?"undefined":Ar.baseEncode(t);J.formatters.m=t=>t==null?"undefined":Ht.baseEncode(t);J.formatters.p=t=>t==null?"undefined":t.toString();J.formatters.c=t=>t==null?"undefined":t.toString();J.formatters.k=t=>t==null?"undefined":t.toString();J.formatters.a=t=>t==null?"undefined":t.toString();function as(t){const e=()=>{};return e.enabled=!1,e.color="",e.diff=0,e.log=()=>{},e.namespace=t,e.destroy=()=>!0,e.extend=()=>e,e}function Pa(){return{forComponent(t){return us(t)}}}function us(t){let e=as(`${t}:trace`);return J.enabled(`${t}:trace`)&&J.names.map(n=>n.toString()).find(n=>n.includes(":trace"))!=null&&(e=J(`${t}:trace`)),Object.assign(J(t),{error:J(`${t}:error`),trace:e})}var Mn={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(d,g,h){this.fn=d,this.context=g,this.once=h||!1}function s(d,g,h,l,E){if(typeof h!="function")throw new TypeError("The listener must be a function");var _=new i(h,l||d,E),N=n?n+g:g;return d._events[N]?d._events[N].fn?d._events[N]=[d._events[N],_]:d._events[N].push(_):(d._events[N]=_,d._eventsCount++),d}function o(d,g){--d._eventsCount===0?d._events=new r:delete d._events[g]}function u(){this._events=new r,this._eventsCount=0}u.prototype.eventNames=function(){var g=[],h,l;if(this._eventsCount===0)return g;for(l in h=this._events)e.call(h,l)&&g.push(n?l.slice(1):l);return Object.getOwnPropertySymbols?g.concat(Object.getOwnPropertySymbols(h)):g},u.prototype.listeners=function(g){var h=n?n+g:g,l=this._events[h];if(!l)return[];if(l.fn)return[l.fn];for(var E=0,_=l.length,N=new Array(_);E<_;E++)N[E]=l[E].fn;return N},u.prototype.listenerCount=function(g){var h=n?n+g:g,l=this._events[h];return l?l.fn?1:l.length:0},u.prototype.emit=function(g,h,l,E,_,N){var a=n?n+g:g;if(!this._events[a])return!1;var c=this._events[a],p=arguments.length,D,w;if(c.fn){switch(c.once&&this.removeListener(g,c.fn,void 0,!0),p){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,h),!0;case 3:return c.fn.call(c.context,h,l),!0;case 4:return c.fn.call(c.context,h,l,E),!0;case 5:return c.fn.call(c.context,h,l,E,_),!0;case 6:return c.fn.call(c.context,h,l,E,_,N),!0}for(w=1,D=new Array(p-1);we.major?1:0}}f.uint=new f(0,"uint",!0);f.negint=new f(1,"negint",!0);f.bytes=new f(2,"bytes",!0);f.string=new f(3,"string",!0);f.array=new f(4,"array",!1);f.map=new f(5,"map",!1);f.tag=new f(6,"tag",!1);f.float=new f(7,"float",!0);f.false=new f(7,"false",!0);f.true=new f(7,"true",!0);f.null=new f(7,"null",!0);f.undefined=new f(7,"undefined",!0);f.break=new f(7,"break",!0);class m{constructor(e,n,r){this.type=e,this.value=n,this.encodedLength=r,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}}const $e=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",gs=new TextDecoder,ys=new TextEncoder;function ht(t){return $e&&globalThis.Buffer.isBuffer(t)}function qt(t){return t instanceof Uint8Array?ht(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t:Uint8Array.from(t)}const ms=$e?(t,e,n)=>n-e>64?globalThis.Buffer.from(t.subarray(e,n)).toString("utf8"):wn(t,e,n):(t,e,n)=>n-e>64?gs.decode(t.subarray(e,n)):wn(t,e,n),jn=$e?t=>t.length>64?globalThis.Buffer.from(t):pn(t):t=>t.length>64?ys.encode(t):pn(t),ne=t=>Uint8Array.from(t),Wt=$e?(t,e,n)=>ht(t)?new Uint8Array(t.subarray(e,n)):t.slice(e,n):(t,e,n)=>t.slice(e,n),bs=$e?(t,e)=>(t=t.map(n=>n instanceof Uint8Array?n:globalThis.Buffer.from(n)),qt(globalThis.Buffer.concat(t,e))):(t,e)=>{const n=new Uint8Array(e);let r=0;for(let i of t)r+i.length>n.length&&(i=i.subarray(0,n.length-r)),n.set(i,r),r+=i.length;return n},xs=$e?t=>globalThis.Buffer.allocUnsafe(t):t=>new Uint8Array(t);function Es(t,e){if(ht(t)&&ht(e))return t.compare(e);for(let n=0;n>6|192,e[n++]=i&63|128):(i&64512)===55296&&r+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e}function wn(t,e,n){const r=[];for(;e239?4:i>223?3:i>191?2:1;if(e+o<=n){let u,d,g,h;switch(o){case 1:i<128&&(s=i);break;case 2:u=t[e+1],(u&192)===128&&(h=(i&31)<<6|u&63,h>127&&(s=h));break;case 3:u=t[e+1],d=t[e+2],(u&192)===128&&(d&192)===128&&(h=(i&15)<<12|(u&63)<<6|d&63,h>2047&&(h<55296||h>57343)&&(s=h));break;case 4:u=t[e+1],d=t[e+2],g=t[e+3],(u&192)===128&&(d&192)===128&&(g&192)===128&&(h=(i&15)<<18|(u&63)<<12|(d&63)<<6|g&63,h>65535&&h<1114112&&(s=h))}}s===null?(s=65533,o=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|s&1023),r.push(s),e+=o}return Rn(r)}const gn=4096;function Rn(t){const e=t.length;if(e<=gn)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr.length/2?(n=this.cursor===r.length?r:r.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):n=Wt(r,0,this.cursor)}else n=bs(this.chunks,this.cursor);return e&&this.reset(),n}}const C="CBOR decode error:",lt="CBOR encode error:";function Fe(t,e,n){if(t.length-e>>8,r&255])}else if(n>>24&255,r>>>16&255,r>>>8&255,r&255])}else{const r=BigInt(n);if(r>BigInt(32)&BigInt(4294967295));i[8]=s&255,s=s>>8,i[7]=s&255,s=s>>8,i[6]=s&255,s=s>>8,i[5]=s&255,i[4]=o&255,o=o>>8,i[3]=o&255,o=o>>8,i[2]=o&255,o=o>>8,i[1]=o&255,t.push(i)}else throw new Error(`${C} encountered BigInt larger than allowable range`)}}be.encodedSize=function(e){return K.encodedSize(e.value)};K.encodedSize=function(e){return en.value?1:0};function vs(t,e,n,r){return new m(f.negint,-1-we(t,e+1,r),2)}function Ns(t,e,n,r){return new m(f.negint,-1-ge(t,e+1,r),3)}function Ts(t,e,n,r){return new m(f.negint,-1-ye(t,e+1,r),5)}const Xt=BigInt(-1),Hn=BigInt(1);function Ss(t,e,n,r){const i=me(t,e+1,r);if(typeof i!="bigint"){const s=-1-i;if(s>=Number.MIN_SAFE_INTEGER)return new m(f.negint,s,9)}if(r.allowBigInt!==!0)throw new Error(`${C} integers outside of the safe integer range are not supported`);return new m(f.negint,Xt-BigInt(i),9)}function Jt(t,e){const n=e.value,r=typeof n=="bigint"?n*Xt-Hn:n*-1-1;K(t,e.type.majorEncoded,r)}Jt.encodedSize=function(e){const n=e.value,r=typeof n=="bigint"?n*Xt-Hn:n*-1-1;return rn.value?-1:0};function Je(t,e,n,r){Fe(t,e,n+r);const i=Wt(t,e+n,e+n+r);return new m(f.bytes,i,n+r)}function $s(t,e,n,r){return Je(t,e,1,n)}function Fs(t,e,n,r){return Je(t,e,2,we(t,e+1,r))}function Bs(t,e,n,r){return Je(t,e,3,ge(t,e+1,r))}function Ls(t,e,n,r){return Je(t,e,5,ye(t,e+1,r))}function Ds(t,e,n,r){const i=me(t,e+1,r);if(typeof i=="bigint")throw new Error(`${C} 64-bit integer bytes lengths not supported`);return Je(t,e,9,i)}function dt(t){return t.encodedBytes===void 0&&(t.encodedBytes=t.type===f.string?jn(t.value):t.value),t.encodedBytes}function bt(t,e){const n=dt(e);K(t,e.type.majorEncoded,n.length),t.push(n)}bt.encodedSize=function(e){const n=dt(e);return K.encodedSize(n.length)+n.length};bt.compareTokens=function(e,n){return Us(dt(e),dt(n))};function Us(t,e){return t.lengthe.length?1:Es(t,e)}function Ke(t,e,n,r,i){const s=n+r;Fe(t,e,s);const o=new m(f.string,ms(t,e+n,e+s),s);return i.retainStringBytes===!0&&(o.byteValue=Wt(t,e+n,e+s)),o}function Os(t,e,n,r){return Ke(t,e,1,n,r)}function Ps(t,e,n,r){return Ke(t,e,2,we(t,e+1,r),r)}function zs(t,e,n,r){return Ke(t,e,3,ge(t,e+1,r),r)}function Ms(t,e,n,r){return Ke(t,e,5,ye(t,e+1,r),r)}function js(t,e,n,r){const i=me(t,e+1,r);if(typeof i=="bigint")throw new Error(`${C} 64-bit integer string lengths not supported`);return Ke(t,e,9,i,r)}const Rs=bt;function Be(t,e,n,r){return new m(f.array,r,n)}function Vs(t,e,n,r){return Be(t,e,1,n)}function Hs(t,e,n,r){return Be(t,e,2,we(t,e+1,r))}function Gs(t,e,n,r){return Be(t,e,3,ge(t,e+1,r))}function qs(t,e,n,r){return Be(t,e,5,ye(t,e+1,r))}function Ws(t,e,n,r){const i=me(t,e+1,r);if(typeof i=="bigint")throw new Error(`${C} 64-bit integer array lengths not supported`);return Be(t,e,9,i)}function Xs(t,e,n,r){if(r.allowIndefinite===!1)throw new Error(`${C} indefinite length items not allowed`);return Be(t,e,1,1/0)}function Kt(t,e){K(t,f.array.majorEncoded,e.value)}Kt.compareTokens=be.compareTokens;Kt.encodedSize=function(e){return K.encodedSize(e.value)};function Le(t,e,n,r){return new m(f.map,r,n)}function Js(t,e,n,r){return Le(t,e,1,n)}function Ks(t,e,n,r){return Le(t,e,2,we(t,e+1,r))}function Zs(t,e,n,r){return Le(t,e,3,ge(t,e+1,r))}function Qs(t,e,n,r){return Le(t,e,5,ye(t,e+1,r))}function Ys(t,e,n,r){const i=me(t,e+1,r);if(typeof i=="bigint")throw new Error(`${C} 64-bit integer map lengths not supported`);return Le(t,e,9,i)}function eo(t,e,n,r){if(r.allowIndefinite===!1)throw new Error(`${C} indefinite length items not allowed`);return Le(t,e,1,1/0)}function Zt(t,e){K(t,f.map.majorEncoded,e.value)}Zt.compareTokens=be.compareTokens;Zt.encodedSize=function(e){return K.encodedSize(e.value)};function to(t,e,n,r){return new m(f.tag,n,1)}function no(t,e,n,r){return new m(f.tag,we(t,e+1,r),2)}function ro(t,e,n,r){return new m(f.tag,ge(t,e+1,r),3)}function io(t,e,n,r){return new m(f.tag,ye(t,e+1,r),5)}function so(t,e,n,r){return new m(f.tag,me(t,e+1,r),9)}function Qt(t,e){K(t,f.tag.majorEncoded,e.value)}Qt.compareTokens=be.compareTokens;Qt.encodedSize=function(e){return K.encodedSize(e.value)};const oo=20,ao=21,uo=22,co=23;function fo(t,e,n,r){if(r.allowUndefined===!1)throw new Error(`${C} undefined values are not supported`);return r.coerceUndefinedToNull===!0?new m(f.null,null,1):new m(f.undefined,void 0,1)}function ho(t,e,n,r){if(r.allowIndefinite===!1)throw new Error(`${C} indefinite length items not allowed`);return new m(f.break,void 0,1)}function Yt(t,e,n){if(n){if(n.allowNaN===!1&&Number.isNaN(t))throw new Error(`${C} NaN values are not supported`);if(n.allowInfinity===!1&&(t===1/0||t===-1/0))throw new Error(`${C} Infinity values are not supported`)}return new m(f.float,t,e)}function lo(t,e,n,r){return Yt(tn(t,e+1),3,r)}function po(t,e,n,r){return Yt(nn(t,e+1),5,r)}function wo(t,e,n,r){return Yt(Xn(t,e+1),9,r)}function en(t,e,n){const r=e.value;if(r===!1)t.push([f.float.majorEncoded|oo]);else if(r===!0)t.push([f.float.majorEncoded|ao]);else if(r===null)t.push([f.float.majorEncoded|uo]);else if(r===void 0)t.push([f.float.majorEncoded|co]);else{let i,s=!1;(!n||n.float64!==!0)&&(qn(r),i=tn(Q,1),r===i||Number.isNaN(r)?(Q[0]=249,t.push(Q.slice(0,3)),s=!0):(Wn(r),i=nn(Q,1),r===i&&(Q[0]=250,t.push(Q.slice(0,5)),s=!0))),s||(go(r),i=Xn(Q,1),Q[0]=251,t.push(Q.slice(0,9)))}}en.encodedSize=function(e,n){const r=e.value;if(r===!1||r===!0||r===null||r===void 0)return 1;if(!n||n.float64!==!0){qn(r);let i=tn(Q,1);if(r===i||Number.isNaN(r))return 3;if(Wn(r),i=nn(Q,1),r===i)return 5}return 9};const Gn=new ArrayBuffer(9),G=new DataView(Gn,1),Q=new Uint8Array(Gn,0);function qn(t){if(t===1/0)G.setUint16(0,31744,!1);else if(t===-1/0)G.setUint16(0,64512,!1);else if(Number.isNaN(t))G.setUint16(0,32256,!1);else{G.setFloat32(0,t);const e=G.getUint32(0),n=(e&2139095040)>>23,r=e&8388607;if(n===255)G.setUint16(0,31744,!1);else if(n===0)G.setUint16(0,(t&2147483648)>>16|r>>13,!1);else{const i=n-127;i<-24?G.setUint16(0,0):i<-14?G.setUint16(0,(e&2147483648)>>16|1<<24+i,!1):G.setUint16(0,(e&2147483648)>>16|i+15<<10|r>>13,!1)}}}function tn(t,e){if(t.length-e<2)throw new Error(`${C} not enough data for float16`);const n=(t[e]<<8)+t[e+1];if(n===31744)return 1/0;if(n===64512)return-1/0;if(n===32256)return NaN;const r=n>>10&31,i=n&1023;let s;return r===0?s=i*2**-24:r!==31?s=(i+1024)*2**(r-25):s=i===0?1/0:NaN,n&32768?-s:s}function Wn(t){G.setFloat32(0,t,!1)}function nn(t,e){if(t.length-e<4)throw new Error(`${C} not enough data for float32`);const n=(t.byteOffset||0)+e;return new DataView(t.buffer,n,4).getFloat32(0,!1)}function go(t){G.setFloat64(0,t,!1)}function Xn(t,e){if(t.length-e<8)throw new Error(`${C} not enough data for float64`);const n=(t.byteOffset||0)+e;return new DataView(t.buffer,n,8).getFloat64(0,!1)}en.compareTokens=be.compareTokens;function F(t,e,n){throw new Error(`${C} encountered invalid minor (${n}) for major ${t[e]>>>5}`)}function xt(t){return()=>{throw new Error(`${C} ${t}`)}}const y=[];for(let t=0;t<=23;t++)y[t]=F;y[24]=ks;y[25]=As;y[26]=Cs;y[27]=Is;y[28]=F;y[29]=F;y[30]=F;y[31]=F;for(let t=32;t<=55;t++)y[t]=F;y[56]=vs;y[57]=Ns;y[58]=Ts;y[59]=Ss;y[60]=F;y[61]=F;y[62]=F;y[63]=F;for(let t=64;t<=87;t++)y[t]=$s;y[88]=Fs;y[89]=Bs;y[90]=Ls;y[91]=Ds;y[92]=F;y[93]=F;y[94]=F;y[95]=xt("indefinite length bytes/strings are not supported");for(let t=96;t<=119;t++)y[t]=Os;y[120]=Ps;y[121]=zs;y[122]=Ms;y[123]=js;y[124]=F;y[125]=F;y[126]=F;y[127]=xt("indefinite length bytes/strings are not supported");for(let t=128;t<=151;t++)y[t]=Vs;y[152]=Hs;y[153]=Gs;y[154]=qs;y[155]=Ws;y[156]=F;y[157]=F;y[158]=F;y[159]=Xs;for(let t=160;t<=183;t++)y[t]=Js;y[184]=Ks;y[185]=Zs;y[186]=Qs;y[187]=Ys;y[188]=F;y[189]=F;y[190]=F;y[191]=eo;for(let t=192;t<=215;t++)y[t]=to;y[216]=no;y[217]=ro;y[218]=io;y[219]=so;y[220]=F;y[221]=F;y[222]=F;y[223]=F;for(let t=224;t<=243;t++)y[t]=xt("simple values are not supported");y[244]=F;y[245]=F;y[246]=F;y[247]=fo;y[248]=xt("simple values are not supported");y[249]=lo;y[250]=po;y[251]=wo;y[252]=F;y[253]=F;y[254]=F;y[255]=ho;const te=[];for(let t=0;t<24;t++)te[t]=new m(f.uint,t,1);for(let t=-1;t>=-24;t--)te[31-t]=new m(f.negint,t,1);te[64]=new m(f.bytes,new Uint8Array(0),1);te[96]=new m(f.string,"",1);te[128]=new m(f.array,0,1);te[160]=new m(f.map,0,1);te[244]=new m(f.false,!1,1);te[245]=new m(f.true,!0,1);te[246]=new m(f.null,null,1);function yo(t){switch(t.type){case f.false:return ne([244]);case f.true:return ne([245]);case f.null:return ne([246]);case f.bytes:return t.value.length?void 0:ne([64]);case f.string:return t.value===""?ne([96]):void 0;case f.array:return t.value===0?ne([128]):void 0;case f.map:return t.value===0?ne([160]):void 0;case f.uint:return t.value<24?ne([Number(t.value)]):void 0;case f.negint:if(t.value>=-24)return ne([31-Number(t.value)])}}const mo={float64:!1,mapSorter:Eo,quickEncodeToken:yo};function bo(){const t=[];return t[f.uint.major]=be,t[f.negint.major]=Jt,t[f.bytes.major]=bt,t[f.string.major]=Rs,t[f.array.major]=Kt,t[f.map.major]=Zt,t[f.tag.major]=Qt,t[f.float.major]=en,t}const Jn=bo(),Tt=new Vn;class pt{constructor(e,n){this.obj=e,this.parent=n}includes(e){let n=this;do if(n.obj===e)return!0;while(n=n.parent);return!1}static createCheck(e,n){if(e&&e.includes(n))throw new Error(`${lt} object contains circular references`);return new pt(n,e)}}const se={null:new m(f.null,null),undefined:new m(f.undefined,void 0),true:new m(f.true,!0),false:new m(f.false,!1),emptyArray:new m(f.array,0),emptyMap:new m(f.map,0)},fe={number(t,e,n,r){return!Number.isInteger(t)||!Number.isSafeInteger(t)?new m(f.float,t):t>=0?new m(f.uint,t):new m(f.negint,t)},bigint(t,e,n,r){return t>=BigInt(0)?new m(f.uint,t):new m(f.negint,t)},Uint8Array(t,e,n,r){return new m(f.bytes,t)},string(t,e,n,r){return new m(f.string,t)},boolean(t,e,n,r){return t?se.true:se.false},null(t,e,n,r){return se.null},undefined(t,e,n,r){return se.undefined},ArrayBuffer(t,e,n,r){return new m(f.bytes,new Uint8Array(t))},DataView(t,e,n,r){return new m(f.bytes,new Uint8Array(t.buffer,t.byteOffset,t.byteLength))},Array(t,e,n,r){if(!t.length)return n.addBreakTokens===!0?[se.emptyArray,new m(f.break)]:se.emptyArray;r=pt.createCheck(r,t);const i=[];let s=0;for(const o of t)i[s++]=ot(o,n,r);return n.addBreakTokens?[new m(f.array,t.length),i,new m(f.break)]:[new m(f.array,t.length),i]},Object(t,e,n,r){const i=e!=="Object",s=i?t.keys():Object.keys(t),o=i?t.size:s.length;if(!o)return n.addBreakTokens===!0?[se.emptyMap,new m(f.break)]:se.emptyMap;r=pt.createCheck(r,t);const u=[];let d=0;for(const g of s)u[d++]=[ot(g,n,r),ot(i?t.get(g):t[g],n,r)];return xo(u,n),n.addBreakTokens?[new m(f.map,o),u,new m(f.break)]:[new m(f.map,o),u]}};fe.Map=fe.Object;fe.Buffer=fe.Uint8Array;for(const t of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))fe[`${t}Array`]=fe.DataView;function ot(t,e={},n){const r=ds(t),i=e&&e.typeEncoders&&e.typeEncoders[r]||fe[r];if(typeof i=="function"){const o=i(t,r,e,n);if(o!=null)return o}const s=fe[r];if(!s)throw new Error(`${lt} unsupported type: ${r}`);return s(t,r,e,n)}function xo(t,e){e.mapSorter&&t.sort(e.mapSorter)}function Eo(t,e){const n=Array.isArray(t[0])?t[0][0]:t[0],r=Array.isArray(e[0])?e[0][0]:e[0];if(n.type!==r.type)return n.type.compare(r.type);const i=n.type.major,s=Jn[i].compareTokens(n,r);return s===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),s}function Kn(t,e,n,r){if(Array.isArray(e))for(const i of e)Kn(t,i,n,r);else n[e.type.major](t,e,r)}function _o(t,e,n){const r=ot(t,n);if(!Array.isArray(r)&&n.quickEncodeToken){const i=n.quickEncodeToken(r);if(i)return i;const s=e[r.type.major];if(s.encodedSize){const o=s.encodedSize(r,n),u=new Vn(o);if(s(u,r,n),u.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${r} was wrong`);return qt(u.chunks[0])}}return Tt.reset(),Kn(Tt,r,e,n),Tt.toBytes(!0)}function za(t,e){return e=Object.assign({},mo,e),_o(t,Jn,e)}const ko={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0};class Ao{constructor(e,n={}){this._pos=0,this.data=e,this.options=n}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){const e=this.data[this._pos];let n=te[e];if(n===void 0){const r=y[e];if(!r)throw new Error(`${C} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);const i=e&31;n=r(this.data,this._pos,i,this.options)}return this._pos+=n.encodedLength,n}}const Re=Symbol.for("DONE"),Et=Symbol.for("BREAK");function Co(t,e,n){const r=[];for(let i=0;i0)throw new Error(`${C} too many terminals, data makes no sense`);return n}const Qn=42;function No(t){return t instanceof ArrayBuffer?new Uint8Array(t,0,t.byteLength):t}function To(t){if(t.asCID!==t&&t["/"]!==t.bytes)return null;const e=ae.asCID(t);if(!e)return null;const n=new Uint8Array(e.bytes.byteLength+1);return n.set(e.bytes,1),[new m(f.tag,Qn),new m(f.bytes,n)]}function So(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function $o(t){if(Number.isNaN(t))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(t===1/0||t===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}function Fo(t){for(const e of t.keys())if(typeof e!="string"||e.length===0)throw new Error("Non-string Map keys are not supported by the IPLD Data Model and cannot be encoded");return null}const Bo={typeEncoders:{Map:Fo,Object:To,undefined:So,number:$o}};({...Bo.typeEncoders});function Lo(t){if(t[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return ae.decode(t.subarray(1))}const wt={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};wt.tags[Qn]=Lo;({...wt,tags:wt.tags.slice()});const Ma=113,ja=t=>Zn(No(t),wt);class Ra extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){const n=this.inRecursive[this.inRecursive.length-1];n&&(n.type===f.array&&(n.elements++,n.elements!==1&&e.push([44])),n.type===f.map&&(n.elements++,n.elements!==1&&(n.elements%2===1?e.push([44]):e.push([58]))))}[f.uint.major](e,n){this.prefix(e);const r=String(n.value),i=[];for(let s=0;s32?qt(r):r)}[f.array.major](e,n){this.prefix(e),this.inRecursive.push({type:f.array,elements:0}),e.push([91])}[f.map.major](e,n){this.prefix(e),this.inRecursive.push({type:f.map,elements:0}),e.push([123])}[f.tag.major](e,n){}[f.float.major](e,n){if(n.type.name==="break"){const o=this.inRecursive.pop();if(o){if(o.type===f.array)e.push([93]);else if(o.type===f.map)e.push([125]);else throw new Error("Unexpected recursive type; this should not happen!");return}throw new Error("Unexpected break; this should not happen!")}if(n.value===void 0)throw new Error(`${lt} unsupported type: undefined`);if(this.prefix(e),n.type.name==="true"){e.push([116,114,117,101]);return}else if(n.type.name==="false"){e.push([102,97,108,115,101]);return}else if(n.type.name==="null"){e.push([110,117,108,108]);return}const r=String(n.value),i=[];let s=!1;for(let o=0;o=this.data.length}ch(){return this.data[this._pos]}currentMode(){return this.modeStack[this.modeStack.length-1]}skipWhitespace(){let e=this.ch();for(;e===32||e===9||e===13||e===10;)e=this.data[++this._pos]}expect(e){if(this.data.length-this._pos{for(;!this.done();){const d=this.ch();if(u.includes(d))this._pos++;else break}};if(this.ch()===45&&(n=!0,this._pos++),this.ch()===48)if(this._pos++,this.ch()===46)this._pos++,r=!0;else return new m(f.uint,0,this._pos-e);if(i([48,49,50,51,52,53,54,55,56,57]),n&&this._pos===e+1)throw new Error(`${C} unexpected token at position ${this._pos}`);if(!this.done()&&this.ch()===46){if(r)throw new Error(`${C} unexpected token at position ${this._pos}`);r=!0,this._pos++,i([48,49,50,51,52,53,54,55,56,57])}!this.done()&&(this.ch()===101||this.ch()===69)&&(r=!0,this._pos++,!this.done()&&(this.ch()===43||this.ch()===45)&&this._pos++,i([48,49,50,51,52,53,54,55,56,57]));const s=String.fromCharCode.apply(null,this.data.subarray(e,this._pos)),o=parseFloat(s);return r?new m(f.float,o,this._pos-e):this.options.allowBigInt!==!0||Number.isSafeInteger(o)?new m(o>=0?f.uint:f.negint,o,this._pos-e):new m(o>=0?f.uint:f.negint,BigInt(s),this._pos-e)}parseString(){if(this.ch()!==34)throw new Error(`${C} unexpected character at position ${this._pos}; this shouldn't happen`);this._pos++;for(let s=this._pos,o=0;s=128)break;if(u===34){const d=String.fromCharCode.apply(null,this.data.subarray(this._pos,s));return this._pos=s+1,new m(f.string,d,o)}}const e=this._pos,n=[],r=()=>{if(this._pos+4>=this.data.length)throw new Error(`${C} unexpected end of unicode escape sequence at position ${this._pos}`);let s=0;for(let o=0;o<4;o++){let u=this.ch();if(u>=48&&u<=57)u-=48;else if(u>=97&&u<=102)u=u-97+10;else if(u>=65&&u<=70)u=u-65+10;else throw new Error(`${C} unexpected unicode escape character at position ${this._pos}`);s=s*16+u,this._pos++}return s},i=()=>{const s=this.ch();let o=null,u=s>239?4:s>223?3:s>191?2:1;if(this._pos+u>this.data.length)throw new Error(`${C} unexpected unicode sequence at position ${this._pos}`);let d,g,h,l;switch(u){case 1:s<128&&(o=s);break;case 2:d=this.data[this._pos+1],(d&192)===128&&(l=(s&31)<<6|d&63,l>127&&(o=l));break;case 3:d=this.data[this._pos+1],g=this.data[this._pos+2],(d&192)===128&&(g&192)===128&&(l=(s&15)<<12|(d&63)<<6|g&63,l>2047&&(l<55296||l>57343)&&(o=l));break;case 4:d=this.data[this._pos+1],g=this.data[this._pos+2],h=this.data[this._pos+3],(d&192)===128&&(g&192)===128&&(h&192)===128&&(l=(s&15)<<18|(d&63)<<12|(g&63)<<6|h&63,l>65535&&l<1114112&&(o=l))}o===null?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),this._pos+=u};for(;!this.done();){const s=this.ch();let o;switch(s){case 92:if(this._pos++,this.done())throw new Error(`${C} unexpected string termination at position ${this._pos}`);switch(o=this.ch(),this._pos++,o){case 34:case 39:case 92:case 47:n.push(o);break;case 98:n.push(8);break;case 116:n.push(9);break;case 110:n.push(10);break;case 102:n.push(12);break;case 114:n.push(13);break;case 117:n.push(r());break;default:throw new Error(`${C} unexpected string escape character at position ${this._pos}`)}break;case 34:return this._pos++,new m(f.string,Rn(n),this._pos-e);default:if(s<32)throw new Error(`${C} invalid control character at position ${this._pos}`);s<128?(n.push(s),this._pos++):i()}}throw new Error(`${C} unexpected end of string at position ${this._pos}`)}parseValue(){switch(this.ch()){case 123:return this.modeStack.push("obj-start"),this._pos++,new m(f.map,1/0,1);case 91:return this.modeStack.push("array-start"),this._pos++,new m(f.array,1/0,1);case 34:return this.parseString();case 110:return this.expect([110,117,108,108]),new m(f.null,null,4);case 102:return this.expect([102,97,108,115,101]),new m(f.false,!1,5);case 116:return this.expect([116,114,117,101]),new m(f.true,!0,4);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.parseNumber();default:throw new Error(`${C} unexpected character at position ${this._pos}`)}}next(){switch(this.skipWhitespace(),this.currentMode()){case"value":return this.modeStack.pop(),this.parseValue();case"array-value":{if(this.modeStack.pop(),this.ch()===93)return this._pos++,this.skipWhitespace(),new m(f.break,void 0,1);if(this.ch()!==44)throw new Error(`${C} unexpected character at position ${this._pos}, was expecting array delimiter but found '${String.fromCharCode(this.ch())}'`);return this._pos++,this.modeStack.push("array-value"),this.skipWhitespace(),this.parseValue()}case"array-start":return this.modeStack.pop(),this.ch()===93?(this._pos++,this.skipWhitespace(),new m(f.break,void 0,1)):(this.modeStack.push("array-value"),this.skipWhitespace(),this.parseValue());case"obj-key":if(this.ch()===125)return this.modeStack.pop(),this._pos++,this.skipWhitespace(),new m(f.break,void 0,1);if(this.ch()!==44)throw new Error(`${C} unexpected character at position ${this._pos}, was expecting object delimiter but found '${String.fromCharCode(this.ch())}'`);this._pos++,this.skipWhitespace();case"obj-start":{if(this.modeStack.pop(),this.ch()===125)return this._pos++,this.skipWhitespace(),new m(f.break,void 0,1);const e=this.parseString();if(this.skipWhitespace(),this.ch()!==58)throw new Error(`${C} unexpected character at position ${this._pos}, was expecting key/value delimiter ':' but found '${String.fromCharCode(this.ch())}'`);return this._pos++,this.modeStack.push("obj-value"),e}case"obj-value":return this.modeStack.pop(),this.modeStack.push("obj-key"),this.skipWhitespace(),this.parseValue();default:throw new Error(`${C} unexpected parse state at position ${this._pos}; this shouldn't happen`)}}}function Do(t,e){return e=Object.assign({tokenizer:new Yn(t,e)},e),Zn(t,e)}function Uo(t){return t instanceof ArrayBuffer?new Uint8Array(t,0,t.byteLength):t}class Oo extends Yn{constructor(e,n){super(e,n),this.tokenBuffer=[]}done(){return this.tokenBuffer.length===0&&super.done()}_next(){return this.tokenBuffer.length>0?this.tokenBuffer.pop():super.next()}next(){const e=this._next();if(e.type===f.map){const n=this._next();if(n.type===f.string&&n.value==="/"){const r=this._next();if(r.type===f.string){if(this._next().type!==f.break)throw new Error("Invalid encoded CID form");return this.tokenBuffer.push(r),new m(f.tag,42,0)}if(r.type===f.map){const i=this._next();if(i.type===f.string&&i.value==="bytes"){const s=this._next();if(s.type===f.string){for(let u=0;u<2;u++)if(this._next().type!==f.break)throw new Error("Invalid encoded Bytes form");const o=Ht.decode(`m${s.value}`);return new m(f.bytes,o,s.value.length)}this.tokenBuffer.push(s)}this.tokenBuffer.push(i)}this.tokenBuffer.push(r)}this.tokenBuffer.push(n)}return e}}const Ft={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Ft.tags[42]=ae.parse;const Va=297,Ha=t=>{const e=Uo(t),n=Object.assign(Ft,{tokenizer:new Oo(e,Ft)});return Do(e,n)};new TextDecoder;new TextEncoder;const Po=new TextDecoder;function rn(t,e){let n=0;for(let r=0;;r+=7){if(r>=64)throw new Error("protobuf: varint overflow");if(e>=t.length)throw new Error("protobuf: unexpected end of data");const i=t[e++];if(n+=r<28?(i&127)<t.length)throw new Error("protobuf: unexpected end of data");return[t.subarray(e,r),r]}function er(t,e){let n;return[n,e]=rn(t,e),[n&7,n>>3,e]}function zo(t){const e={},n=t.length;let r=0;for(;rn)throw new Error("protobuf: (PBLink) unexpected end of data");return e}function Mo(t){const e=t.length;let n=0,r,i=!1,s;for(;ne)throw new Error("protobuf: (PBNode) unexpected end of data");const o={};return s&&(o.Data=s),o.Links=r||[],o}const tr=new TextEncoder,yn=2**32,jo=2**31;function Ro(t,e){let n=e.length;if(typeof t.Tsize=="number"){if(t.Tsize<0)throw new Error("Tsize cannot be negative");if(!Number.isSafeInteger(t.Tsize))throw new Error("Tsize too large for encoding");n=ze(e,n,t.Tsize)-1,e[n]=24}if(typeof t.Name=="string"){const r=tr.encode(t.Name);n-=r.length,e.set(r,n),n=ze(e,n,r.length)-1,e[n]=18}return t.Hash&&(n-=t.Hash.length,e.set(t.Hash,n),n=ze(e,n,t.Hash.length)-1,e[n]=10),e.length-n}function Vo(t){const e=Go(t),n=new Uint8Array(e);let r=e;if(t.Data&&(r-=t.Data.length,n.set(t.Data,r),r=ze(n,r,t.Data.length)-1,n[r]=10),t.Links)for(let i=t.Links.length-1;i>=0;i--){const s=Ro(t.Links[i],n.subarray(0,r));r-=s,r=ze(n,r,s)-1,n[r]=18}return n}function Ho(t){let e=0;if(t.Hash){const n=t.Hash.length;e+=1+n+xe(n)}if(typeof t.Name=="string"){const n=tr.encode(t.Name).length;e+=1+n+xe(n)}return typeof t.Tsize=="number"&&(e+=1+xe(t.Tsize)),e}function Go(t){let e=0;if(t.Data){const n=t.Data.length;e+=1+n+xe(n)}if(t.Links)for(const n of t.Links){const r=Ho(n);e+=1+r+xe(r)}return e}function ze(t,e,n){e-=xe(n);const r=e;for(;n>=jo;)t[e++]=n&127|128,n/=128;for(;n>=128;)t[e++]=n&127|128,n>>>=7;return t[e]=n,r}function xe(t){return t%2===0&&t++,Math.floor((qo(t)+6)/7)}function qo(t){let e=0;return t>=yn&&(t=Math.floor(t/yn),e=32),t>=65536&&(t>>>=16,e+=16),t>=256&&(t>>>=8,e+=8),e+Wo[t]}const Wo=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8],Xo=["Data","Links"],Jo=["Hash","Name","Tsize"],Bt=new TextEncoder;function nr(t,e){if(t===e)return 0;const n=t.Name?Bt.encode(t.Name):[],r=e.Name?Bt.encode(e.Name):[];let i=n.length,s=r.length;for(let o=0,u=Math.min(i,s);o!e.includes(n))}function rr(t){if(typeof t.asCID=="object"){const n=ae.asCID(t);if(!n)throw new TypeError("Invalid DAG-PB form");return{Hash:n}}if(typeof t!="object"||Array.isArray(t))throw new TypeError("Invalid DAG-PB form");const e={};if(t.Hash){let n=ae.asCID(t.Hash);try{n||(typeof t.Hash=="string"?n=ae.parse(t.Hash):t.Hash instanceof Uint8Array&&(n=ae.decode(t.Hash)))}catch(r){throw new TypeError(`Invalid DAG-PB form: ${r.message}`)}n&&(e.Hash=n)}if(!e.Hash)throw new TypeError("Invalid DAG-PB form");return typeof t.Name=="string"&&(e.Name=t.Name),typeof t.Tsize=="number"&&(e.Tsize=t.Tsize),e}function ir(t){if((t instanceof Uint8Array||typeof t=="string")&&(t={Data:t}),typeof t!="object"||Array.isArray(t))throw new TypeError("Invalid DAG-PB form");const e={};if(t.Data!==void 0)if(typeof t.Data=="string")e.Data=Bt.encode(t.Data);else if(t.Data instanceof Uint8Array)e.Data=t.Data;else throw new TypeError("Invalid DAG-PB form");if(t.Links!==void 0)if(Array.isArray(t.Links))e.Links=t.Links.map(rr),e.Links.sort(nr);else throw new TypeError("Invalid DAG-PB form");else e.Links=[];return e}function sr(t){if(!t||typeof t!="object"||Array.isArray(t)||t instanceof Uint8Array||t["/"]&&t["/"]===t.bytes)throw new TypeError("Invalid DAG-PB form");if(!mn(t,Xo))throw new TypeError("Invalid DAG-PB form (extraneous properties)");if(t.Data!==void 0&&!(t.Data instanceof Uint8Array))throw new TypeError("Invalid DAG-PB form (Data must be bytes)");if(!Array.isArray(t.Links))throw new TypeError("Invalid DAG-PB form (Links must be a list)");for(let e=0;e0&&nr(n,t.Links[e-1])===-1)throw new TypeError("Invalid DAG-PB form (links must be sorted by Name bytes)")}}function Ko(t,e=[]){return ir({Data:t,Links:e})}function Zo(t,e,n){return rr({Hash:n,Name:t,Tsize:e})}function Qo(t){return t instanceof ArrayBuffer?new Uint8Array(t,0,t.byteLength):t}const Yo="dag-pb",ea=112;function ta(t){sr(t);const e={};return t.Links&&(e.Links=t.Links.map(n=>{const r={};return n.Hash&&(r.Hash=n.Hash.bytes),n.Name!==void 0&&(r.Name=n.Name),n.Tsize!==void 0&&(r.Tsize=n.Tsize),r})),t.Data&&(e.Data=t.Data),Vo(e)}function na(t){const e=Qo(t),n=Mo(e),r={};return n.Data&&(r.Data=n.Data),n.Links&&(r.Links=n.Links.map(i=>{const s={};try{s.Hash=ae.decode(i.Hash)}catch{}if(!s.Hash)throw new Error("Invalid Hash field found in link, expected CID");return i.Name!==void 0&&(s.Name=i.Name),i.Tsize!==void 0&&(s.Tsize=i.Tsize),s})),r}const Ga=Object.freeze(Object.defineProperty({__proto__:null,code:ea,createLink:Zo,createNode:Ko,decode:na,encode:ta,name:Yo,prepare:ir,validate:sr},Symbol.toStringTag,{value:"Module"}));function ra(t){return t[Symbol.asyncIterator]!=null}function qa(t,e){let n=0;if(ra(t))return async function*(){for await(const d of t)await e(d,n++)&&(yield d)}();const r=Nn(t),{value:i,done:s}=r.next();if(s===!0)return function*(){}();const o=e(i,n++);if(typeof o.then=="function")return async function*(){await o&&(yield i);for(const d of r)await e(d,n++)&&(yield d)}();const u=e;return function*(){o===!0&&(yield i);for(const d of r)u(d,n++)&&(yield d)}()}class or extends Error{constructor(e){super(e),this.name="TimeoutError"}}class ia extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const bn=t=>globalThis.DOMException===void 0?new ia(t):new DOMException(t),xn=t=>{const e=t.reason===void 0?bn("This operation was aborted."):t.reason;return e instanceof Error?e:bn(e)};function sa(t,e){const{milliseconds:n,fallback:r,message:i,customTimers:s={setTimeout,clearTimeout}}=e;let o,u;const g=new Promise((h,l)=>{if(typeof n!="number"||Math.sign(n)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(e.signal){const{signal:_}=e;_.aborted&&l(xn(_)),u=()=>{l(xn(_))},_.addEventListener("abort",u,{once:!0})}if(n===Number.POSITIVE_INFINITY){t.then(h,l);return}const E=new or;o=s.setTimeout.call(void 0,()=>{if(r){try{h(r())}catch(_){l(_)}return}typeof t.cancel=="function"&&t.cancel(),i===!1?h():i instanceof Error?l(i):(E.message=i??`Promise timed out after ${n} milliseconds`,l(E))},n),(async()=>{try{h(await t)}catch(_){l(_)}})()}).finally(()=>{g.clear(),u&&e.signal&&e.signal.removeEventListener("abort",u)});return g.clear=()=>{s.clearTimeout.call(void 0,o),o=void 0},g}function oa(t,e,n){let r=0,i=t.length;for(;i>0;){const s=Math.trunc(i/2);let o=r+s;n(t[o],e)<=0?(r=++o,i-=s+1):i=s}return r}var q;class aa{constructor(){P(this,q,[])}enqueue(e,n){n={priority:0,...n};const r={priority:n.priority,id:n.id,run:e};if(this.size===0||A(this,q)[this.size-1].priority>=n.priority){A(this,q).push(r);return}const i=oa(A(this,q),r,(s,o)=>o.priority-s.priority);A(this,q).splice(i,0,r)}setPriority(e,n){const r=A(this,q).findIndex(s=>s.id===e);if(r===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);const[i]=A(this,q).splice(r,1);this.enqueue(i.run,{priority:n,id:e})}dequeue(){const e=A(this,q).shift();return e==null?void 0:e.run}filter(e){return A(this,q).filter(n=>n.priority===e.priority).map(n=>n.run)}get size(){return A(this,q).length}}q=new WeakMap;var Ee,_e,oe,He,ke,Ge,W,Ae,H,qe,X,Ce,re,We,mt,$,ar,ur,cr,fr,hr,at,Lt,Dt,ut,lr,ct;class Wa extends fs{constructor(n){var r,i;super();P(this,$);P(this,Ee);P(this,_e);P(this,oe,0);P(this,He);P(this,ke);P(this,Ge,0);P(this,W);P(this,Ae);P(this,H);P(this,qe);P(this,X,0);P(this,Ce);P(this,re);P(this,We);P(this,mt,1n);v(this,"timeout");if(n={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:aa,...n},!(typeof n.intervalCap=="number"&&n.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${((r=n.intervalCap)==null?void 0:r.toString())??""}\` (${typeof n.intervalCap})`);if(n.interval===void 0||!(Number.isFinite(n.interval)&&n.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${((i=n.interval)==null?void 0:i.toString())??""}\` (${typeof n.interval})`);U(this,Ee,n.carryoverConcurrencyCount),U(this,_e,n.intervalCap===Number.POSITIVE_INFINITY||n.interval===0),U(this,He,n.intervalCap),U(this,ke,n.interval),U(this,H,new n.queueClass),U(this,qe,n.queueClass),this.concurrency=n.concurrency,this.timeout=n.timeout,U(this,We,n.throwOnTimeout===!0),U(this,re,n.autoStart===!1)}get concurrency(){return A(this,Ce)}set concurrency(n){if(!(typeof n=="number"&&n>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${n}\` (${typeof n})`);U(this,Ce,n),z(this,$,ut).call(this)}setPriority(n,r){A(this,H).setPriority(n,r)}async add(n,r={}){return r.id??(r.id=(Ue(this,mt)._++).toString()),r={timeout:this.timeout,throwOnTimeout:A(this,We),...r},new Promise((i,s)=>{A(this,H).enqueue(async()=>{var o;Ue(this,X)._++;try{(o=r.signal)==null||o.throwIfAborted(),Ue(this,oe)._++;let u=n({signal:r.signal});r.timeout&&(u=sa(Promise.resolve(u),{milliseconds:r.timeout})),r.signal&&(u=Promise.race([u,z(this,$,lr).call(this,r.signal)]));const d=await u;i(d),this.emit("completed",d)}catch(u){if(u instanceof or&&!r.throwOnTimeout){i();return}s(u),this.emit("error",u)}finally{z(this,$,cr).call(this)}},r),this.emit("add"),z(this,$,at).call(this)})}async addAll(n,r){return Promise.all(n.map(async i=>this.add(i,r)))}start(){return A(this,re)?(U(this,re,!1),z(this,$,ut).call(this),this):this}pause(){U(this,re,!0)}clear(){U(this,H,new(A(this,qe)))}async onEmpty(){A(this,H).size!==0&&await z(this,$,ct).call(this,"empty")}async onSizeLessThan(n){A(this,H).sizeA(this,H).size{z(this,$,fr).call(this)},r)),!0}return!1},at=function(){if(A(this,H).size===0)return A(this,W)&&clearInterval(A(this,W)),U(this,W,void 0),this.emit("empty"),A(this,X)===0&&this.emit("idle"),!1;if(!A(this,re)){const n=!A(this,$,hr);if(A(this,$,ar)&&A(this,$,ur)){const r=A(this,H).dequeue();return r?(this.emit("active"),r(),n&&z(this,$,Lt).call(this),!0):!1}}return!1},Lt=function(){A(this,_e)||A(this,W)!==void 0||(U(this,W,setInterval(()=>{z(this,$,Dt).call(this)},A(this,ke))),U(this,Ge,Date.now()+A(this,ke)))},Dt=function(){A(this,oe)===0&&A(this,X)===0&&A(this,W)&&(clearInterval(A(this,W)),U(this,W,void 0)),U(this,oe,A(this,Ee)?A(this,X):0),z(this,$,ut).call(this)},ut=function(){for(;z(this,$,at).call(this););},lr=async function(n){return new Promise((r,i)=>{n.addEventListener("abort",()=>{i(n.reason)},{once:!0})})},ct=async function(n,r){return new Promise(i=>{const s=()=>{r&&!r()||(this.off(n,s),i())};this.on(n,s)})};function ua(t){return t[Symbol.asyncIterator]!=null}function Xa(t){if(ua(t))return(async()=>{for await(const e of t)return e})();for(const e of t)return e}function ca(t){return t[Symbol.asyncIterator]!=null}function Ja(t){if(ca(t))return(async()=>{const n=[];for await(const r of t)n.push(r);return n})();const e=[];for(const n of t)e.push(n);return e}const it=globalThis.CustomEvent??Event;async function*Ka(t,e={}){let n=e.concurrency??1/0;n<1&&(n=1/0);const r=e.ordered??!1,i=new EventTarget,s=[];let o=ee(),u=ee(),d=!1,g,h=!1;i.addEventListener("task-complete",()=>{u.resolve()}),Promise.resolve().then(async()=>{try{for await(const N of t){if(s.length===n&&(o=ee(),await o.promise),h)break;const a={done:!1};s.push(a),N().then(c=>{a.done=!0,a.ok=!0,a.value=c,i.dispatchEvent(new it("task-complete"))},c=>{a.done=!0,a.err=c,i.dispatchEvent(new it("task-complete"))})}d=!0,i.dispatchEvent(new it("task-complete"))}catch(N){g=N,i.dispatchEvent(new it("task-complete"))}});function l(){var N;return r?(N=s[0])==null?void 0:N.done:!!s.find(a=>a.done)}function*E(){for(;s.length>0&&s[0].done;){const N=s[0];if(s.shift(),N.ok)yield N.value;else throw h=!0,o.resolve(),N.err;o.resolve()}}function*_(){for(;l();)for(let N=0;N{if(Object.prototype.toString.call(t)!=="[object Object]")return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.prototype};const yt=fa,{hasOwnProperty:dr}=Object.prototype,{propertyIsEnumerable:ha}=Object,Se=(t,e,n)=>Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0}),la=Vi,En={concatArrays:!1,ignoreUndefined:!1},_t=t=>{const e=[];for(const n in t)dr.call(t,n)&&e.push(n);if(Object.getOwnPropertySymbols){const n=Object.getOwnPropertySymbols(t);for(const r of n)ha.call(t,r)&&e.push(r)}return e};function De(t){return Array.isArray(t)?da(t):yt(t)?pa(t):t}function da(t){const e=t.slice(0,0);return _t(t).forEach(n=>{Se(e,n,De(t[n]))}),e}function pa(t){const e=Object.getPrototypeOf(t)===null?Object.create(null):{};return _t(t).forEach(n=>{Se(e,n,De(t[n]))}),e}const pr=(t,e,n,r)=>(n.forEach(i=>{typeof e[i]>"u"&&r.ignoreUndefined||(i in t&&t[i]!==Object.getPrototypeOf(t)?Se(t,i,Ut(t[i],e[i],r)):Se(t,i,De(e[i])))}),t),wa=(t,e,n)=>{let r=t.slice(0,0),i=0;return[t,e].forEach(s=>{const o=[];for(let u=0;u!o.includes(u)),n)}),r};function Ut(t,e,n){return n.concatArrays&&Array.isArray(t)&&Array.isArray(e)?wa(t,e,n):!yt(e)||!yt(t)?De(e):pr(t,e,_t(e),n)}var ga=function(...t){const e=Ut(De(En),this!==la&&this||{},En);let n={_:{}};for(const r of t)if(r!==void 0){if(!yt(r))throw new TypeError("`"+r+"` is not an Option Object");n=Ut(n,{_:r},e)}return n._};const Za=Gt(ga);export{Ka as $,ea as A,$i as B,Ia as C,Ai as D,fs as E,Ma as F,Va as G,Na as H,na as I,Do as J,f as K,m as L,Ba as M,us as N,Nn as O,qa as P,Pa as Q,Vi as R,wi as S,Yn as T,st as U,Cn as V,tt as W,Xa as X,Wa as Y,Ja as Z,ka as _,Ir as a,sa as a0,Za as a1,or as a2,Ga as a3,ta as a4,Sa as a5,ir as a6,Dn as a7,ja as a8,Ha as a9,Ta as aa,Ea as b,ce as c,_a as d,Xe as e,Da as f,La as g,va as h,ie as i,Ca as j,Aa as k,$a as l,Ua as m,Lr as n,ln as o,ee as p,Fi as q,Nr as r,Fa as s,un as t,Ht as u,Oa as v,Gt as w,za as x,Zn as y,Rr as z}; //# sourceMappingURL=index-BqzxYBEc.js.map