@wovin/connect-ucan-store-proxy 0.0.13 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
- import{b as eo,d as tr,e as Xs}from"./chunk-R5T56SIO.min.js";import{a as Zi,b as Js,c as Ys}from"./chunk-U6LK5UQW.min.js";var Ff=Zi((iR,jf)=>{"use strict";jf.exports=pa;var kf=128,Ng=127,Rg=~Ng,$g=Math.pow(2,31);function pa(e,t,r){if(Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw pa.bytes=0,new RangeError("Could not encode varint");t=t||[],r=r||0;for(var n=r;e>=$g;)t[r++]=e&255|kf,e/=128;for(;e&Rg;)t[r++]=e&255|kf,e>>>=7;return t[r]=e|0,pa.bytes=r-n+1,t}});var Kf=Zi((oR,zf)=>{"use strict";zf.exports=ha;var Pg=128,Vf=127;function ha(e,n){var r=0,n=n||0,i=0,o=n,s,a=e.length;do{if(o>=a||i>49)throw ha.bytes=0,new RangeError("Could not decode varint");s=e[o++],r+=i<28?(s&Vf)<<i:(s&Vf)*Math.pow(2,i),i+=7}while(s>=Pg);return ha.bytes=o-n,r}});var Gf=Zi((sR,qf)=>{"use strict";var Ug=Math.pow(2,7),Bg=Math.pow(2,14),Dg=Math.pow(2,21),Mg=Math.pow(2,28),Lg=Math.pow(2,35),kg=Math.pow(2,42),jg=Math.pow(2,49),Fg=Math.pow(2,56),Vg=Math.pow(2,63);qf.exports=function(e){return e<Ug?1:e<Bg?2:e<Dg?3:e<Mg?4:e<Lg?5:e<kg?6:e<jg?7:e<Fg?8:e<Vg?9:10}});var go=Zi((aR,Wf)=>{"use strict";Wf.exports={encode:Ff(),decode:Kf(),encodingLength:Gf()}});var Ty=["string","number","bigint","symbol"],Ay=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function vc(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(Ty.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(Oy(e))return"Buffer";let r=Ey(e);return r||"Object"}function Oy(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function Ey(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Ay.includes(t))return t}var K=class{constructor(t,r,n){this.major=t,this.majorEncoded=t<<5,this.name=r,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(t){return this.major<t.major?-1:this.major>t.major?1:0}};K.uint=new K(0,"uint",!0);K.negint=new K(1,"negint",!0);K.bytes=new K(2,"bytes",!0);K.string=new K(3,"string",!0);K.array=new K(4,"array",!1);K.map=new K(5,"map",!1);K.tag=new K(6,"tag",!1);K.float=new K(7,"float",!0);K.false=new K(7,"false",!0);K.true=new K(7,"true",!0);K.null=new K(7,"null",!0);K.undefined=new K(7,"undefined",!0);K.break=new K(7,"break",!0);var fe=class{constructor(t,r,n){this.type=t,this.value=r,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};var pn=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Iy=new TextDecoder,xy=new TextEncoder;function to(e){return pn&&globalThis.Buffer.isBuffer(e)}function Ac(e){return e instanceof Uint8Array?to(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Oc=pn?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):wc(e,t,r):(e,t,r)=>r-t>64?Iy.decode(e.subarray(t,r)):wc(e,t,r),Ec=pn?e=>e.length>64?globalThis.Buffer.from(e):_c(e):e=>e.length>64?xy.encode(e):_c(e);var hn=pn?(e,t,r)=>to(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Ic=pn?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Ac(globalThis.Buffer.concat(e,t))):(e,t)=>{let r=new Uint8Array(t),n=0;for(let i of e)n+i.length>r.length&&(i=i.subarray(0,r.length-n)),r.set(i,n),n+=i.length;return r},xc=pn?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Sc(e,t){if(to(e)&&to(t))return e.compare(t);for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}function _c(e){let t=[],r=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=i&63|128):(i&64512)===55296&&n+1<e.length&&(e.charCodeAt(n+1)&64512)===56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++n)&1023),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=i&63|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=i&63|128)}return t}function wc(e,t,r){let n=[];for(;t<r;){let i=e[t],o=null,s=i>239?4:i>223?3:i>191?2:1;if(t+s<=r){let a,u,c,l;switch(s){case 1:i<128&&(o=i);break;case 2:a=e[t+1],(a&192)===128&&(l=(i&31)<<6|a&63,l>127&&(o=l));break;case 3:a=e[t+1],u=e[t+2],(a&192)===128&&(u&192)===128&&(l=(i&15)<<12|(a&63)<<6|u&63,l>2047&&(l<55296||l>57343)&&(o=l));break;case 4:a=e[t+1],u=e[t+2],c=e[t+3],(a&192)===128&&(u&192)===128&&(c&192)===128&&(l=(i&15)<<18|(a&63)<<12|(u&63)<<6|c&63,l>65535&&l<1114112&&(o=l))}}o===null?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),t+=s}return Sy(n)}var Tc=4096;function Sy(e){let t=e.length;if(t<=Tc)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Tc));return r}var Cy=256,ro=class{constructor(t=Cy){this.chunkSize=t,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(t){let r=this.chunks[this.chunks.length-1];if(this.cursor+t.length<=this.maxCursor+1){let i=r.length-(this.maxCursor-this.cursor)-1;r.set(t,i)}else{if(r){let i=r.length-(this.maxCursor-this.cursor)-1;i<r.length&&(this.chunks[this.chunks.length-1]=r.subarray(0,i),this.maxCursor=this.cursor-1)}t.length<64&&t.length<this.chunkSize?(r=xc(this.chunkSize),this.chunks.push(r),this.maxCursor+=r.length,this._initReuseChunk===null&&(this._initReuseChunk=r),r.set(t,0)):(this.chunks.push(t),this.maxCursor+=t.length)}this.cursor+=t.length}toBytes(t=!1){let r;if(this.chunks.length===1){let n=this.chunks[0];t&&this.cursor>n.length/2?(r=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):r=hn(n,0,this.cursor)}else r=Ic(this.chunks,this.cursor);return t&&this.reset(),r}};var ve="CBOR decode error:",Qs="CBOR encode error:",ei=[];ei[23]=1;ei[24]=2;ei[25]=3;ei[26]=5;ei[27]=9;function rr(e,t,r){if(e.length-t<r)throw new Error(`${ve} not enough data for type`)}var qe=[24,256,65536,4294967296,BigInt("18446744073709551616")];function ut(e,t,r){rr(e,t,1);let n=e[t];if(r.strict===!0&&n<qe[0])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);return n}function ct(e,t,r){rr(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<qe[1])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);return n}function ft(e,t,r){rr(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<qe[2])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);return n}function lt(e,t,r){rr(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<qe[3])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${ve} integers outside of the safe integer range are not supported`)}function Cc(e,t,r,n){return new fe(K.uint,ut(e,t+1,n),2)}function Nc(e,t,r,n){return new fe(K.uint,ct(e,t+1,n),3)}function Rc(e,t,r,n){return new fe(K.uint,ft(e,t+1,n),5)}function $c(e,t,r,n){return new fe(K.uint,lt(e,t+1,n),9)}function vt(e,t){return Je(e,0,t.value)}function Je(e,t,r){if(r<qe[0]){let n=Number(r);e.push([t|n])}else if(r<qe[1]){let n=Number(r);e.push([t|24,n])}else if(r<qe[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<qe[3]){let n=Number(r);e.push([t|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<qe[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),s=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=s&255,s=s>>8,i[3]=s&255,s=s>>8,i[2]=s&255,s=s>>8,i[1]=s&255,e.push(i)}else throw new Error(`${ve} encountered BigInt larger than allowable range`)}}vt.encodedSize=function(t){return Je.encodedSize(t.value)};Je.encodedSize=function(t){return t<qe[0]?1:t<qe[1]?2:t<qe[2]?3:t<qe[3]?5:9};vt.compareTokens=function(t,r){return t.value<r.value?-1:t.value>r.value?1:0};function Pc(e,t,r,n){return new fe(K.negint,-1-ut(e,t+1,n),2)}function Uc(e,t,r,n){return new fe(K.negint,-1-ct(e,t+1,n),3)}function Bc(e,t,r,n){return new fe(K.negint,-1-ft(e,t+1,n),5)}var Zs=BigInt(-1),Dc=BigInt(1);function Mc(e,t,r,n){let i=lt(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new fe(K.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${ve} integers outside of the safe integer range are not supported`);return new fe(K.negint,Zs-BigInt(i),9)}function no(e,t){let r=t.value,n=typeof r=="bigint"?r*Zs-Dc:r*-1-1;Je(e,t.type.majorEncoded,n)}no.encodedSize=function(t){let r=t.value,n=typeof r=="bigint"?r*Zs-Dc:r*-1-1;return n<qe[0]?1:n<qe[1]?2:n<qe[2]?3:n<qe[3]?5:9};no.compareTokens=function(t,r){return t.value<r.value?1:t.value>r.value?-1:0};function ti(e,t,r,n){rr(e,t,r+n);let i=hn(e,t+r,t+r+n);return new fe(K.bytes,i,r+n)}function Lc(e,t,r,n){return ti(e,t,1,r)}function kc(e,t,r,n){return ti(e,t,2,ut(e,t+1,n))}function jc(e,t,r,n){return ti(e,t,3,ct(e,t+1,n))}function Fc(e,t,r,n){return ti(e,t,5,ft(e,t+1,n))}function Vc(e,t,r,n){let i=lt(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer bytes lengths not supported`);return ti(e,t,9,i)}function io(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===K.string?Ec(e.value):e.value),e.encodedBytes}function yn(e,t){let r=io(t);Je(e,t.type.majorEncoded,r.length),e.push(r)}yn.encodedSize=function(t){let r=io(t);return Je.encodedSize(r.length)+r.length};yn.compareTokens=function(t,r){return Ry(io(t),io(r))};function Ry(e,t){return e.length<t.length?-1:e.length>t.length?1:Sc(e,t)}function ri(e,t,r,n,i){let o=r+n;rr(e,t,o);let s=new fe(K.string,Oc(e,t+r,t+o),o);return i.retainStringBytes===!0&&(s.byteValue=hn(e,t+r,t+o)),s}function zc(e,t,r,n){return ri(e,t,1,r,n)}function Kc(e,t,r,n){return ri(e,t,2,ut(e,t+1,n),n)}function qc(e,t,r,n){return ri(e,t,3,ct(e,t+1,n),n)}function Gc(e,t,r,n){return ri(e,t,5,ft(e,t+1,n),n)}function Wc(e,t,r,n){let i=lt(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer string lengths not supported`);return ri(e,t,9,i,n)}var Hc=yn;function gn(e,t,r,n){return new fe(K.array,n,r)}function Jc(e,t,r,n){return gn(e,t,1,r)}function Xc(e,t,r,n){return gn(e,t,2,ut(e,t+1,n))}function Yc(e,t,r,n){return gn(e,t,3,ct(e,t+1,n))}function Qc(e,t,r,n){return gn(e,t,5,ft(e,t+1,n))}function Zc(e,t,r,n){let i=lt(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer array lengths not supported`);return gn(e,t,9,i)}function ef(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ve} indefinite length items not allowed`);return gn(e,t,1,1/0)}function oo(e,t){Je(e,K.array.majorEncoded,t.value)}oo.compareTokens=vt.compareTokens;oo.encodedSize=function(t){return Je.encodedSize(t.value)};function mn(e,t,r,n){return new fe(K.map,n,r)}function tf(e,t,r,n){return mn(e,t,1,r)}function rf(e,t,r,n){return mn(e,t,2,ut(e,t+1,n))}function nf(e,t,r,n){return mn(e,t,3,ct(e,t+1,n))}function of(e,t,r,n){return mn(e,t,5,ft(e,t+1,n))}function sf(e,t,r,n){let i=lt(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer map lengths not supported`);return mn(e,t,9,i)}function af(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ve} indefinite length items not allowed`);return mn(e,t,1,1/0)}function so(e,t){Je(e,K.map.majorEncoded,t.value)}so.compareTokens=vt.compareTokens;so.encodedSize=function(t){return Je.encodedSize(t.value)};function uf(e,t,r,n){return new fe(K.tag,r,1)}function cf(e,t,r,n){return new fe(K.tag,ut(e,t+1,n),2)}function ff(e,t,r,n){return new fe(K.tag,ct(e,t+1,n),3)}function lf(e,t,r,n){return new fe(K.tag,ft(e,t+1,n),5)}function df(e,t,r,n){return new fe(K.tag,lt(e,t+1,n),9)}function ao(e,t){Je(e,K.tag.majorEncoded,t.value)}ao.compareTokens=vt.compareTokens;ao.encodedSize=function(t){return Je.encodedSize(t.value)};var My=20,Ly=21,ky=22,jy=23;function pf(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${ve} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new fe(K.null,null,1):new fe(K.undefined,void 0,1)}function hf(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ve} indefinite length items not allowed`);return new fe(K.break,void 0,1)}function ea(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${ve} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${ve} Infinity values are not supported`)}return new fe(K.float,e,t)}function yf(e,t,r,n){return ea(ta(e,t+1),3,n)}function gf(e,t,r,n){return ea(ra(e,t+1),5,n)}function mf(e,t,r,n){return ea(wf(e,t+1),9,n)}function uo(e,t,r){let n=t.value;if(n===!1)e.push([K.float.majorEncoded|My]);else if(n===!0)e.push([K.float.majorEncoded|Ly]);else if(n===null)e.push([K.float.majorEncoded|ky]);else if(n===void 0)e.push([K.float.majorEncoded|jy]);else{let i,o=!1;(!r||r.float64!==!0)&&(vf(n),i=ta(Bt,1),n===i||Number.isNaN(n)?(Bt[0]=249,e.push(Bt.slice(0,3)),o=!0):(_f(n),i=ra(Bt,1),n===i&&(Bt[0]=250,e.push(Bt.slice(0,5)),o=!0))),o||(Fy(n),i=wf(Bt,1),Bt[0]=251,e.push(Bt.slice(0,9)))}}uo.encodedSize=function(t,r){let n=t.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){vf(n);let i=ta(Bt,1);if(n===i||Number.isNaN(n))return 3;if(_f(n),i=ra(Bt,1),n===i)return 5}return 9};var bf=new ArrayBuffer(9),_t=new DataView(bf,1),Bt=new Uint8Array(bf,0);function vf(e){if(e===1/0)_t.setUint16(0,31744,!1);else if(e===-1/0)_t.setUint16(0,64512,!1);else if(Number.isNaN(e))_t.setUint16(0,32256,!1);else{_t.setFloat32(0,e);let t=_t.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)_t.setUint16(0,31744,!1);else if(r===0)_t.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?_t.setUint16(0,0):i<-14?_t.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):_t.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function ta(e,t){if(e.length-t<2)throw new Error(`${ve} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}function _f(e){_t.setFloat32(0,e,!1)}function ra(e,t){if(e.length-t<4)throw new Error(`${ve} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function Fy(e){_t.setFloat64(0,e,!1)}function wf(e,t){if(e.length-t<8)throw new Error(`${ve} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}uo.compareTokens=vt.compareTokens;function Ee(e,t,r){throw new Error(`${ve} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function co(e){return()=>{throw new Error(`${ve} ${e}`)}}var ue=[];for(let e=0;e<=23;e++)ue[e]=Ee;ue[24]=Cc;ue[25]=Nc;ue[26]=Rc;ue[27]=$c;ue[28]=Ee;ue[29]=Ee;ue[30]=Ee;ue[31]=Ee;for(let e=32;e<=55;e++)ue[e]=Ee;ue[56]=Pc;ue[57]=Uc;ue[58]=Bc;ue[59]=Mc;ue[60]=Ee;ue[61]=Ee;ue[62]=Ee;ue[63]=Ee;for(let e=64;e<=87;e++)ue[e]=Lc;ue[88]=kc;ue[89]=jc;ue[90]=Fc;ue[91]=Vc;ue[92]=Ee;ue[93]=Ee;ue[94]=Ee;ue[95]=co("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ue[e]=zc;ue[120]=Kc;ue[121]=qc;ue[122]=Gc;ue[123]=Wc;ue[124]=Ee;ue[125]=Ee;ue[126]=Ee;ue[127]=co("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ue[e]=Jc;ue[152]=Xc;ue[153]=Yc;ue[154]=Qc;ue[155]=Zc;ue[156]=Ee;ue[157]=Ee;ue[158]=Ee;ue[159]=ef;for(let e=160;e<=183;e++)ue[e]=tf;ue[184]=rf;ue[185]=nf;ue[186]=of;ue[187]=sf;ue[188]=Ee;ue[189]=Ee;ue[190]=Ee;ue[191]=af;for(let e=192;e<=215;e++)ue[e]=uf;ue[216]=cf;ue[217]=ff;ue[218]=lf;ue[219]=df;ue[220]=Ee;ue[221]=Ee;ue[222]=Ee;ue[223]=Ee;for(let e=224;e<=243;e++)ue[e]=co("simple values are not supported");ue[244]=Ee;ue[245]=Ee;ue[246]=Ee;ue[247]=pf;ue[248]=co("simple values are not supported");ue[249]=yf;ue[250]=gf;ue[251]=mf;ue[252]=Ee;ue[253]=Ee;ue[254]=Ee;ue[255]=hf;var Dt=[];for(let e=0;e<24;e++)Dt[e]=new fe(K.uint,e,1);for(let e=-1;e>=-24;e--)Dt[31-e]=new fe(K.negint,e,1);Dt[64]=new fe(K.bytes,new Uint8Array(0),1);Dt[96]=new fe(K.string,"",1);Dt[128]=new fe(K.array,0,1);Dt[160]=new fe(K.map,0,1);Dt[244]=new fe(K.false,!1,1);Dt[245]=new fe(K.true,!0,1);Dt[246]=new fe(K.null,null,1);function na(){let e=[];return e[K.uint.major]=vt,e[K.negint.major]=no,e[K.bytes.major]=yn,e[K.string.major]=Hc,e[K.array.major]=oo,e[K.map.major]=so,e[K.tag.major]=ao,e[K.float.major]=uo,e}var hN=na(),yN=new ro,lo=class e{constructor(t,r){this.obj=t,this.parent=r}includes(t){let r=this;do if(r.obj===t)return!0;while(r=r.parent);return!1}static createCheck(t,r){if(t&&t.includes(r))throw new Error(`${Qs} object contains circular references`);return new e(r,t)}},yr={null:new fe(K.null,null),undefined:new fe(K.undefined,void 0),true:new fe(K.true,!0),false:new fe(K.false,!1),emptyArray:new fe(K.array,0),emptyMap:new fe(K.map,0)},gr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new fe(K.float,e):e>=0?new fe(K.uint,e):new fe(K.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new fe(K.uint,e):new fe(K.negint,e)},Uint8Array(e,t,r,n){return new fe(K.bytes,e)},string(e,t,r,n){return new fe(K.string,e)},boolean(e,t,r,n){return e?yr.true:yr.false},null(e,t,r,n){return yr.null},undefined(e,t,r,n){return yr.undefined},ArrayBuffer(e,t,r,n){return new fe(K.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new fe(K.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[yr.emptyArray,new fe(K.break)]:yr.emptyArray;n=lo.createCheck(n,e);let i=[],o=0;for(let s of e)i[o++]=fo(s,r,n);return r.addBreakTokens?[new fe(K.array,e.length),i,new fe(K.break)]:[new fe(K.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),s=i?e.size:o.length;if(!s)return r.addBreakTokens===!0?[yr.emptyMap,new fe(K.break)]:yr.emptyMap;n=lo.createCheck(n,e);let a=[],u=0;for(let c of o)a[u++]=[fo(c,r,n),fo(i?e.get(c):e[c],r,n)];return Ky(a,r),r.addBreakTokens?[new fe(K.map,s),a,new fe(K.break)]:[new fe(K.map,s),a]}};gr.Map=gr.Object;gr.Buffer=gr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))gr[`${e}Array`]=gr.DataView;function fo(e,t={},r){let n=vc(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||gr[n];if(typeof i=="function"){let s=i(e,n,t,r);if(s!=null)return s}let o=gr[n];if(!o)throw new Error(`${Qs} unsupported type: ${n}`);return o(e,n,t,r)}function Ky(e,t){t.mapSorter&&e.sort(t.mapSorter)}var qy={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},ia=class{constructor(t,r={}){this._pos=0,this.data=t,this.options=r}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let t=this.data[this._pos],r=Dt[t];if(r===void 0){let n=ue[t];if(!n)throw new Error(`${ve} no decoder for major type ${t>>>5} (byte 0x${t.toString(16).padStart(2,"0")})`);let i=t&31;r=n(this.data,this._pos,i,this.options)}return this._pos+=r.encodedLength,r}},ni=Symbol.for("DONE"),po=Symbol.for("BREAK");function Gy(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=ii(t,r);if(o===po){if(e.value===1/0)break;throw new Error(`${ve} got unexpected break to lengthed array`)}if(o===ni)throw new Error(`${ve} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function Wy(e,t,r){let n=r.useMaps===!0,i=n?void 0:{},o=n?new Map:void 0;for(let s=0;s<e.value;s++){let a=ii(t,r);if(a===po){if(e.value===1/0)break;throw new Error(`${ve} got unexpected break to lengthed map`)}if(a===ni)throw new Error(`${ve} found map but not enough entries (got ${s} [no key], expected ${e.value})`);if(n!==!0&&typeof a!="string")throw new Error(`${ve} non-string keys not supported (got ${typeof a})`);if(r.rejectDuplicateMapKeys===!0&&(n&&o.has(a)||!n&&a in i))throw new Error(`${ve} found repeat map key "${a}"`);let u=ii(t,r);if(u===ni)throw new Error(`${ve} found map but not enough entries (got ${s} [no value], expected ${e.value})`);n?o.set(a,u):i[a]=u}return n?o:i}function ii(e,t){if(e.done())return ni;let r=e.next();if(r.type===K.break)return po;if(r.type.terminal)return r.value;if(r.type===K.array)return Gy(r,e,t);if(r.type===K.map)return Wy(r,e,t);if(r.type===K.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=ii(e,t);return t.tags[r.value](n)}throw new Error(`${ve} tag not supported (${r.value})`)}throw new Error("unsupported")}function Tf(e,t){if(!(e instanceof Uint8Array))throw new Error(`${ve} data to decode must be a Uint8Array`);t=Object.assign({},qy,t);let r=t.tokenizer||new ia(e,t),n=ii(r,t);if(n===ni)throw new Error(`${ve} did not find any content to decode`);if(n===po)throw new Error(`${ve} got unexpected break`);return[n,e.subarray(r.pos())]}function oa(e,t){let[r,n]=Tf(e,t);if(n.length>0)throw new Error(`${ve} too many terminals, data makes no sense`);return r}var ON=new Uint8Array(0);function Af(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function bn(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}function Xy(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(r[s]!==255)throw new TypeError(o+" is ambiguous");r[s]=i}var a=e.length,u=e.charAt(0),c=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function p(E){if(E instanceof Uint8Array||(ArrayBuffer.isView(E)?E=new Uint8Array(E.buffer,E.byteOffset,E.byteLength):Array.isArray(E)&&(E=Uint8Array.from(E))),!(E instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(E.length===0)return"";for(var z=0,W=0,T=0,k=E.length;T!==k&&E[T]===0;)T++,z++;for(var G=(k-T)*l+1>>>0,H=new Uint8Array(G);T!==k;){for(var F=E[T],Y=0,V=G-1;(F!==0||Y<W)&&V!==-1;V--,Y++)F+=256*H[V]>>>0,H[V]=F%a>>>0,F=F/a>>>0;if(F!==0)throw new Error("Non-zero carry");W=Y,T++}for(var ae=G-W;ae!==G&&H[ae]===0;)ae++;for(var L=u.repeat(z);ae<G;++ae)L+=e.charAt(H[ae]);return L}function S(E){if(typeof E!="string")throw new TypeError("Expected String");if(E.length===0)return new Uint8Array;var z=0;if(E[z]!==" "){for(var W=0,T=0;E[z]===u;)W++,z++;for(var k=(E.length-z)*c+1>>>0,G=new Uint8Array(k);E[z];){var H=r[E.charCodeAt(z)];if(H===255)return;for(var F=0,Y=k-1;(H!==0||F<T)&&Y!==-1;Y--,F++)H+=a*G[Y]>>>0,G[Y]=H%256>>>0,H=H/256>>>0;if(H!==0)throw new Error("Non-zero carry");T=F,z++}if(E[z]!==" "){for(var V=k-T;V!==k&&G[V]===0;)V++;for(var ae=new Uint8Array(W+(k-V)),L=W;V!==k;)ae[L++]=G[V++];return ae}}}function x(E){var z=S(E);if(z)return z;throw new Error(`Non-${t} character`)}return{encode:p,decodeUnsafe:S,decode:x}}var Yy=Xy,Qy=Yy,Of=Qy;var sa=class{name;prefix;baseEncode;constructor(t,r,n){this.name=t,this.prefix=r,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},aa=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,r,n){this.name=t,this.prefix=r;let i=r.codePointAt(0);if(i===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=i,this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Ef(this,t)}},ua=class{decoders;constructor(t){this.decoders=t}or(t){return Ef(this,t)}decode(t){let r=t[0],n=this.decoders[r];if(n!=null)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Ef(e,t){return new ua({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var ca=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,r,n,i){this.name=t,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new sa(t,r,n),this.decoder=new aa(t,r,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function If({name:e,prefix:t,encode:r,decode:n}){return new ca(e,t,r,n)}function vn({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=Of(r,e);return If({prefix:t,name:e,encode:n,decode:o=>bn(i(o))})}function Zy(e,t,r,n){let i={};for(let l=0;l<t.length;++l)i[t[l]]=l;let o=e.length;for(;e[o-1]==="=";)--o;let s=new Uint8Array(o*r/8|0),a=0,u=0,c=0;for(let l=0;l<o;++l){let p=i[e[l]];if(p===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|p,a+=r,a>=8&&(a-=8,s[c++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return s}function eg(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let u=0;u<e.length;++u)for(a=a<<8|e[u],s+=8;s>r;)s-=r,o+=t[i&a>>s];if(s!==0&&(o+=t[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o}function qt({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return If({prefix:t,name:e,encode(i){return eg(i,n,r)},decode(i){return Zy(i,n,r,e)}})}var oi=qt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),RN=qt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),$N=qt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),PN=qt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),UN=qt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),BN=qt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),DN=qt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),MN=qt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),LN=qt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ho=vn({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),FN=vn({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var nr=vn({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),KN=vn({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var tg=Cf,xf=128,rg=127,ng=~rg,ig=Math.pow(2,31);function Cf(e,t,r){t=t||[],r=r||0;for(var n=r;e>=ig;)t[r++]=e&255|xf,e/=128;for(;e&ng;)t[r++]=e&255|xf,e>>>=7;return t[r]=e|0,Cf.bytes=r-n+1,t}var og=fa,sg=128,Sf=127;function fa(e,n){var r=0,n=n||0,i=0,o=n,s,a=e.length;do{if(o>=a)throw fa.bytes=0,new RangeError("Could not decode varint");s=e[o++],r+=i<28?(s&Sf)<<i:(s&Sf)*Math.pow(2,i),i+=7}while(s>=sg);return fa.bytes=o-n,r}var ag=Math.pow(2,7),ug=Math.pow(2,14),cg=Math.pow(2,21),fg=Math.pow(2,28),lg=Math.pow(2,35),dg=Math.pow(2,42),pg=Math.pow(2,49),hg=Math.pow(2,56),yg=Math.pow(2,63),gg=function(e){return e<ag?1:e<ug?2:e<cg?3:e<fg?4:e<lg?5:e<dg?6:e<pg?7:e<hg?8:e<yg?9:10},mg={encode:tg,decode:og,encodingLength:gg},bg=mg,si=bg;function ai(e,t=0){return[si.decode(e,t),si.decode.bytes]}function _n(e,t,r=0){return si.encode(e,t,r),t}function wn(e){return si.encodingLength(e)}function Rf(e,t){let r=t.byteLength,n=wn(e),i=n+wn(r),o=new Uint8Array(i+r);return _n(e,o,0),_n(r,o,n),o.set(t,i),new Tn(e,r,t,o)}function $f(e){let t=bn(e),[r,n]=ai(t),[i,o]=ai(t.subarray(n)),s=t.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Tn(r,i,s,t)}function Pf(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Af(e.bytes,r.bytes)}}var Tn=class{code;size;digest;bytes;constructor(t,r,n,i){this.code=t,this.size=r,this.digest=n,this.bytes=i}};function Uf(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return wg(r,la(e),t??nr.encoder);default:return Tg(r,la(e),t??oi.encoder)}}var Bf=new WeakMap;function la(e){let t=Bf.get(e);if(t==null){let r=new Map;return Bf.set(e,r),r}return t}var ci=class e{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==ui)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Ag)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return e.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:r}=this.multihash,n=Rf(t,r);return e.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return e.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&Pf(t.multihash,n.multihash)}toString(t){return Uf(this,t)}toJSON(){return{"/":Uf(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof e)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new e(n,i,o,s??Df(n,i,o.bytes))}else if(r[Og]===!0){let{version:n,multihash:i,code:o}=r,s=$f(i);return e.create(n,o,s)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==ui)throw new Error(`Version 0 CID must use dag-pb (code: ${ui}) block encoding`);return new e(t,r,n,n.bytes)}case 1:{let i=Df(t,r,n.bytes);return new e(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return e.create(0,ui,t)}static createV1(t,r){return e.create(1,t,r)}static decode(t){let[r,n]=e.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=e.inspectBytes(t),n=r.size-r.multihashSize,i=bn(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new Tn(r.multihashCode,r.digestSize,o,i);return[r.version===0?e.createV0(s):e.createV1(r.codec,s),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[p,S]=ai(t.subarray(r));return r+=S,p},i=n(),o=ui;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),u=n(),c=r+u,l=c-s;return{version:i,codec:o,multihashCode:a,digestSize:u,multihashSize:l,size:c}}static parse(t,r){let[n,i]=_g(t,r),o=e.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return la(o).set(n,t),o}};function _g(e,t){switch(e[0]){case"Q":{let r=t??nr;return[nr.prefix,r.decode(`${nr.prefix}${e}`)]}case nr.prefix:{let r=t??nr;return[nr.prefix,r.decode(e)]}case oi.prefix:{let r=t??oi;return[oi.prefix,r.decode(e)]}case ho.prefix:{let r=t??ho;return[ho.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function wg(e,t,r){let{prefix:n}=r;if(n!==nr.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let o=r.encode(e).slice(1);return t.set(n,o),o}else return i}function Tg(e,t,r){let{prefix:n}=r,i=t.get(n);if(i==null){let o=r.encode(e);return t.set(n,o),o}else return i}var ui=112,Ag=18;function Df(e,t,r){let n=wn(e),i=n+wn(t),o=new Uint8Array(i+r.byteLength);return _n(e,o,0),_n(t,o,n),o.set(r,i),o}var Og=Symbol.for("@ipld/js-cid/CID");var Lf=42;function Eg(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=ci.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new fe(K.tag,Lf),new fe(K.bytes,r)]}function Ig(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function xg(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}var Mf={float64:!0,typeEncoders:{Object:Eg,undefined:Ig,number:xg}},rR={...Mf,typeEncoders:{...Mf.typeEncoders}};function Sg(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return ci.decode(e.subarray(1))}var yo={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};yo.tags[Lf]=Sg;var nR={...yo,tags:yo.tags.slice()};var da=e=>oa(e,yo);var mr=Js(go(),1),fi={SHA2_256:18,LENGTH:32,DAG_PB:112},ya=40;function An(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=mr.default.decode(e);return t.seek(mr.default.decode.bytes),r}function ga(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),r=0;return{version:2,characteristics:[t.getBigUint64(r,!0),t.getBigUint64(r+=8,!0)],dataOffset:Number(t.getBigUint64(r+=8,!0)),dataSize:Number(t.getBigUint64(r+=8,!0)),indexOffset:Number(t.getBigUint64(r+=8,!0))}}function ma(e){mr.default.decode(e);let t=mr.default.decode.bytes,r=mr.default.decode(e.subarray(mr.default.decode.bytes)),n=mr.default.decode.bytes;return t+n+r}var br={Null:e=>e===null?e:void 0,Int:e=>Number.isInteger(e)?e:void 0,Float:e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,String:e=>typeof e=="string"?e:void 0,Bool:e=>typeof e=="boolean"?e:void 0,Bytes:e=>e instanceof Uint8Array?e:void 0,Link:e=>e!==null&&typeof e=="object"&&e.asCID===e?e:void 0,List:e=>Array.isArray(e)?e:void 0,Map:e=>e!==null&&typeof e=="object"&&e.asCID!==e&&!Array.isArray(e)&&!(e instanceof Uint8Array)?e:void 0},li={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":br.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(br.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=li["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=li["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:br.Int,CarV1HeaderOrV2Pragma:e=>{if(br.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,s]=t[i];switch(o){case"roots":{let a=li["CarV1HeaderOrV2Pragma > roots (anon)"](e[o]);if(a===void 0)return;if(a!==s||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=a}}break;case"version":{n--;let a=li.Int(e[o]);if(a===void 0)return;if(a!==s||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=a}}break;default:return}}if(!(n>0))return r}},di={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":br.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(br.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=di["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=di["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:br.Int,CarV1HeaderOrV2Pragma:e=>{if(br.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,s]=t[i];switch(o){case"roots":{let a=di["CarV1HeaderOrV2Pragma > roots (anon)"](s);if(a===void 0)return;if(a!==s||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=a}}break;case"version":{n--;let a=di.Int(s);if(a===void 0)return;if(a!==s||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=a}}break;default:return}}if(!(n>0))return r}},ba={toTyped:li.CarV1HeaderOrV2Pragma,toRepresentation:di.CarV1HeaderOrV2Pragma};var bR=na();var Gg=Js(go(),1);var AR=[new fe(K.map,2),new fe(K.string,"version"),new fe(K.uint,1),new fe(K.string,"roots")],OR=new fe(K.tag,42);async function va(e,t){let r=An(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),i=da(n);if(ba.toTyped(i)===void 0)throw new Error("Invalid CAR header format");if(i.version!==1&&i.version!==2||t!==void 0&&i.version!==t)throw new Error(`Invalid CAR version: ${i.version}${t!==void 0?` (expected ${t})`:""}`);if(i.version===1){if(!Array.isArray(i.roots))throw new Error("Invalid CAR header format");return i}if(i.roots!==void 0)throw new Error("Invalid CAR header format");let o=ga(await e.exactly(ya,!0));e.seek(o.dataOffset-e.pos);let s=await va(e,1);return Object.assign(s,o)}async function Hg(e){let t=await e.exactly(2,!1);if(t[0]===fi.SHA2_256&&t[1]===fi.LENGTH){let s=await e.exactly(34,!0),a=eo(s);return tr.create(0,fi.DAG_PB,a)}let r=An(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=An(await e.upTo(8),e),i=await e.exactly(ma(await e.upTo(8)),!0),o=eo(i);return tr.create(r,n,o)}async function Hf(e){let t=e.pos,r=An(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await Hg(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function Jg(e){let{cid:t,blockLength:r}=await Hf(e);return{bytes:await e.exactly(r,!0),cid:t}}async function Xg(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await Hf(e),o={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(o.blockLength),o}function mo(e){let t=(async()=>{let r=await va(e);if(r.version===2){let n=e.pos-r.dataOffset;e=Qg(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await Jg(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await Xg(e)}}}function pi(e){let t=0;return{async upTo(r){return e.subarray(t,t+Math.min(r,e.length-t))},async exactly(r,n=!1){if(r>e.length-t)throw new Error("Unexpected end of data");let i=e.subarray(t,t+r);return n&&(t+=r),i},seek(r){t+=r},get pos(){return t}}}function Yg(e){let t=0,r=0,n=0,i=new Uint8Array(0),o=async s=>{r=i.length-n;let a=[i.subarray(n)];for(;r<s;){let c=await e();if(c==null)break;r<0?c.length>r&&a.push(c.subarray(-r)):a.push(c),r+=c.length}i=new Uint8Array(a.reduce((c,l)=>c+l.length,0));let u=0;for(let c of a)i.set(c,u),u+=c.length;n=0};return{async upTo(s){return i.length-n<s&&await o(s),i.subarray(n,n+Math.min(i.length-n,s))},async exactly(s,a=!1){if(i.length-n<s&&await o(s),i.length-n<s)throw new Error("Unexpected end of data");let u=i.subarray(n,n+s);return a&&(t+=s,n+=s),u},seek(s){t+=s,n+=s},get pos(){return t}}}function bo(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return Yg(r)}function Qg(e,t){let r=0;return{async upTo(n){let i=await e.upTo(n);return i.length+r>t&&(i=i.subarray(0,t-r)),i},async exactly(n,i=!1){let o=await e.exactly(n,i);if(o.length+r>t)throw new Error("Unexpected end of data");return i&&(r+=n),o},seek(n){r+=n,e.seek(n)},get pos(){return e.pos}}}var Dr=class{constructor(t,r){this._header=t,this._blocks=r,this._keys=r.map(n=>n.cid.toString())}get version(){return this._header.version}async getRoots(){return this._header.roots}async has(t){return this._keys.indexOf(t.toString())>-1}async get(t){let r=this._keys.indexOf(t.toString());return r>-1?this._blocks[r]:void 0}async*blocks(){for(let t of this._blocks)yield t}async*cids(){for(let t of this._blocks)yield t.cid}static async fromBytes(t){if(!(t instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Jf(pi(t))}static async fromIterable(t){if(!t||typeof t[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Jf(bo(t))}};async function Jf(e){let t=mo(e),r=await t.header(),n=[];for await(let i of t.blocks())n.push(i);return new Dr(r,n)}var em=Js(go(),1);var tm={0:"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'",1:function(t,r){return"Cannot apply '"+t+"' to '"+r.toString()+"': Field not found."},5:"'keys()' can only be used on observable objects, arrays, sets and maps",6:"'values()' can only be used on observable objects, arrays, sets and maps",7:"'entries()' can only be used on observable objects, arrays and maps",8:"'set()' can only be used on observable objects, arrays and maps",9:"'remove()' can only be used on observable objects, arrays and maps",10:"'has()' can only be used on observable objects, arrays and maps",11:"'get()' can only be used on observable objects, arrays and maps",12:"Invalid annotation",13:"Dynamic observable objects cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",14:"Intercept handlers should return nothing or a change object",15:"Observable arrays cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",16:"Modification exception: the internal structure of an observable array was changed.",17:function(t,r){return"[mobx.array] Index out of bounds, "+t+" is larger than "+r},18:"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js",19:function(t){return"Cannot initialize from classes that inherit from Map: "+t.constructor.name},20:function(t){return"Cannot initialize map from "+t},21:function(t){return"Cannot convert to map from '"+t+"'"},22:"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js",23:"It is not possible to get index atoms from arrays",24:function(t){return"Cannot obtain administration from "+t},25:function(t,r){return"the entry '"+t+"' does not exist in the observable map '"+r+"'"},26:"please specify a property",27:function(t,r){return"no observable property '"+t.toString()+"' found on the observable object '"+r+"'"},28:function(t){return"Cannot obtain atom from "+t},29:"Expecting some object",30:"invalid action stack. did you forget to finish an action?",31:"missing option for computed: get",32:function(t,r){return"Cycle detected in computation "+t+": "+r},33:function(t){return"The setter of computed value '"+t+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"},34:function(t){return"[ComputedValue '"+t+"'] It is not possible to assign a new value to a computed value."},35:"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`",36:"isolateGlobalState should be called before MobX is running any reactions",37:function(t){return"[mobx] `observableArray."+t+"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice()."+t+"()` instead"},38:"'ownKeys()' can only be used on observable objects",39:"'defineProperty()' can only be used on observable objects"},rm=tm;function le(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i=typeof e=="string"?e:rm[e];throw typeof i=="function"&&(i=i.apply(null,r)),new Error("[MobX] "+i)}var nm={};function Pa(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:nm}var ll=Object.assign,xo=Object.getOwnPropertyDescriptor,Wt=Object.defineProperty,vi=Object.prototype,So=[];Object.freeze(So);var Ua={};Object.freeze(Ua);var im=typeof Proxy<"u",om=Object.toString();function dl(){im||le("`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`")}function hi(e){Q.verifyProxies&&le("MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to "+e)}function St(){return++Q.mobxGuid}function Ba(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var En=function(){};function je(e){return typeof e=="function"}function Lr(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function Do(e){return e!==null&&typeof e=="object"}function jt(e){if(!Do(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r.toString()===om}function pl(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Mo(e,t,r){Wt(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function hl(e,t,r){Wt(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}function wr(e,t){var r="isMobX"+e;return t.prototype[r]=!0,function(n){return Do(n)&&n[r]===!0}}function Nn(e){return e instanceof Map}function _i(e){return e instanceof Set}var yl=typeof Object.getOwnPropertySymbols<"u";function sm(e){var t=Object.keys(e);if(!yl)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(n){return vi.propertyIsEnumerable.call(e,n)})):t}var Lo=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:yl?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Ta(e){return typeof e=="string"?e:typeof e=="symbol"?e.toString():new String(e).toString()}function gl(e){return e===null?null:typeof e=="object"?""+e:e}function Et(e,t){return vi.hasOwnProperty.call(e,t)}var am=Object.getOwnPropertyDescriptors||function(t){var r={};return Lo(t).forEach(function(n){r[n]=xo(t,n)}),r};function Xf(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,fm(n.key),n)}}function Da(e,t,r){return t&&Xf(e.prototype,t),r&&Xf(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function sr(){return sr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},sr.apply(this,arguments)}function ml(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Aa(e,t)}function Aa(e,t){return Aa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Aa(e,t)}function Ao(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function um(e,t){if(e){if(typeof e=="string")return Yf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Yf(e,t)}}function Yf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function In(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=um(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cm(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function fm(e){var t=cm(e,"string");return typeof t=="symbol"?t:String(t)}var ot=Symbol("mobx-stored-annotations");function Ht(e){function t(r,n){if(wi(n))return e.decorate_20223_(r,n);Rn(r,n,e)}return Object.assign(t,e)}function Rn(e,t,r){if(Et(e,ot)||Mo(e,ot,sr({},e[ot])),Co(r)&&!Et(e[ot],t)){var n=e.constructor.name+".prototype."+t.toString();le("'"+n+"' is decorated with 'override', but no such decorated member was found on prototype.")}lm(e,r,t),Co(r)||(e[ot][t]=r)}function lm(e,t,r){if(!Co(t)&&Et(e[ot],r)){var n=e.constructor.name+".prototype."+r.toString(),i=e[ot][r].annotationType_,o=t.annotationType_;le("Cannot apply '@"+o+"' to '"+n+"':"+(`
1
+ import{b as to,d as tr,e as Xs}from"./chunk-PXG467HN.min.js";import{a as eo,b as Js,c as Ys}from"./chunk-LB22G6E6.min.js";var Ff=eo((iR,jf)=>{"use strict";jf.exports=pa;var kf=128,Ng=127,Rg=~Ng,$g=Math.pow(2,31);function pa(e,t,r){if(Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw pa.bytes=0,new RangeError("Could not encode varint");t=t||[],r=r||0;for(var n=r;e>=$g;)t[r++]=e&255|kf,e/=128;for(;e&Rg;)t[r++]=e&255|kf,e>>>=7;return t[r]=e|0,pa.bytes=r-n+1,t}});var Kf=eo((oR,zf)=>{"use strict";zf.exports=ha;var Pg=128,Vf=127;function ha(e,n){var r=0,n=n||0,i=0,o=n,s,a=e.length;do{if(o>=a||i>49)throw ha.bytes=0,new RangeError("Could not decode varint");s=e[o++],r+=i<28?(s&Vf)<<i:(s&Vf)*Math.pow(2,i),i+=7}while(s>=Pg);return ha.bytes=o-n,r}});var Gf=eo((sR,qf)=>{"use strict";var Ug=Math.pow(2,7),Bg=Math.pow(2,14),Dg=Math.pow(2,21),Mg=Math.pow(2,28),Lg=Math.pow(2,35),kg=Math.pow(2,42),jg=Math.pow(2,49),Fg=Math.pow(2,56),Vg=Math.pow(2,63);qf.exports=function(e){return e<Ug?1:e<Bg?2:e<Dg?3:e<Mg?4:e<Lg?5:e<kg?6:e<jg?7:e<Fg?8:e<Vg?9:10}});var mo=eo((aR,Wf)=>{"use strict";Wf.exports={encode:Ff(),decode:Kf(),encodingLength:Gf()}});var Ty=["string","number","bigint","symbol"],Ay=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function vc(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(Ty.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(Oy(e))return"Buffer";let r=Ey(e);return r||"Object"}function Oy(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function Ey(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Ay.includes(t))return t}var K=class{constructor(t,r,n){this.major=t,this.majorEncoded=t<<5,this.name=r,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(t){return this.major<t.major?-1:this.major>t.major?1:0}};K.uint=new K(0,"uint",!0);K.negint=new K(1,"negint",!0);K.bytes=new K(2,"bytes",!0);K.string=new K(3,"string",!0);K.array=new K(4,"array",!1);K.map=new K(5,"map",!1);K.tag=new K(6,"tag",!1);K.float=new K(7,"float",!0);K.false=new K(7,"false",!0);K.true=new K(7,"true",!0);K.null=new K(7,"null",!0);K.undefined=new K(7,"undefined",!0);K.break=new K(7,"break",!0);var fe=class{constructor(t,r,n){this.type=t,this.value=r,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};var pn=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Iy=new TextDecoder,xy=new TextEncoder;function ro(e){return pn&&globalThis.Buffer.isBuffer(e)}function Ac(e){return e instanceof Uint8Array?ro(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Oc=pn?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):wc(e,t,r):(e,t,r)=>r-t>64?Iy.decode(e.subarray(t,r)):wc(e,t,r),Ec=pn?e=>e.length>64?globalThis.Buffer.from(e):_c(e):e=>e.length>64?xy.encode(e):_c(e);var hn=pn?(e,t,r)=>ro(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Ic=pn?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Ac(globalThis.Buffer.concat(e,t))):(e,t)=>{let r=new Uint8Array(t),n=0;for(let i of e)n+i.length>r.length&&(i=i.subarray(0,r.length-n)),r.set(i,n),n+=i.length;return r},xc=pn?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Sc(e,t){if(ro(e)&&ro(t))return e.compare(t);for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}function _c(e){let t=[],r=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=i&63|128):(i&64512)===55296&&n+1<e.length&&(e.charCodeAt(n+1)&64512)===56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++n)&1023),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=i&63|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=i&63|128)}return t}function wc(e,t,r){let n=[];for(;t<r;){let i=e[t],o=null,s=i>239?4:i>223?3:i>191?2:1;if(t+s<=r){let a,u,c,l;switch(s){case 1:i<128&&(o=i);break;case 2:a=e[t+1],(a&192)===128&&(l=(i&31)<<6|a&63,l>127&&(o=l));break;case 3:a=e[t+1],u=e[t+2],(a&192)===128&&(u&192)===128&&(l=(i&15)<<12|(a&63)<<6|u&63,l>2047&&(l<55296||l>57343)&&(o=l));break;case 4:a=e[t+1],u=e[t+2],c=e[t+3],(a&192)===128&&(u&192)===128&&(c&192)===128&&(l=(i&15)<<18|(a&63)<<12|(u&63)<<6|c&63,l>65535&&l<1114112&&(o=l))}}o===null?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),t+=s}return Sy(n)}var Tc=4096;function Sy(e){let t=e.length;if(t<=Tc)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Tc));return r}var Cy=256,no=class{constructor(t=Cy){this.chunkSize=t,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(t){let r=this.chunks[this.chunks.length-1];if(this.cursor+t.length<=this.maxCursor+1){let i=r.length-(this.maxCursor-this.cursor)-1;r.set(t,i)}else{if(r){let i=r.length-(this.maxCursor-this.cursor)-1;i<r.length&&(this.chunks[this.chunks.length-1]=r.subarray(0,i),this.maxCursor=this.cursor-1)}t.length<64&&t.length<this.chunkSize?(r=xc(this.chunkSize),this.chunks.push(r),this.maxCursor+=r.length,this._initReuseChunk===null&&(this._initReuseChunk=r),r.set(t,0)):(this.chunks.push(t),this.maxCursor+=t.length)}this.cursor+=t.length}toBytes(t=!1){let r;if(this.chunks.length===1){let n=this.chunks[0];t&&this.cursor>n.length/2?(r=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):r=hn(n,0,this.cursor)}else r=Ic(this.chunks,this.cursor);return t&&this.reset(),r}};var ve="CBOR decode error:",Qs="CBOR encode error:",ei=[];ei[23]=1;ei[24]=2;ei[25]=3;ei[26]=5;ei[27]=9;function rr(e,t,r){if(e.length-t<r)throw new Error(`${ve} not enough data for type`)}var qe=[24,256,65536,4294967296,BigInt("18446744073709551616")];function ut(e,t,r){rr(e,t,1);let n=e[t];if(r.strict===!0&&n<qe[0])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);return n}function ct(e,t,r){rr(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<qe[1])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);return n}function ft(e,t,r){rr(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<qe[2])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);return n}function lt(e,t,r){rr(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<qe[3])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${ve} integers outside of the safe integer range are not supported`)}function Cc(e,t,r,n){return new fe(K.uint,ut(e,t+1,n),2)}function Nc(e,t,r,n){return new fe(K.uint,ct(e,t+1,n),3)}function Rc(e,t,r,n){return new fe(K.uint,ft(e,t+1,n),5)}function $c(e,t,r,n){return new fe(K.uint,lt(e,t+1,n),9)}function vt(e,t){return Je(e,0,t.value)}function Je(e,t,r){if(r<qe[0]){let n=Number(r);e.push([t|n])}else if(r<qe[1]){let n=Number(r);e.push([t|24,n])}else if(r<qe[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<qe[3]){let n=Number(r);e.push([t|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<qe[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),s=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=s&255,s=s>>8,i[3]=s&255,s=s>>8,i[2]=s&255,s=s>>8,i[1]=s&255,e.push(i)}else throw new Error(`${ve} encountered BigInt larger than allowable range`)}}vt.encodedSize=function(t){return Je.encodedSize(t.value)};Je.encodedSize=function(t){return t<qe[0]?1:t<qe[1]?2:t<qe[2]?3:t<qe[3]?5:9};vt.compareTokens=function(t,r){return t.value<r.value?-1:t.value>r.value?1:0};function Pc(e,t,r,n){return new fe(K.negint,-1-ut(e,t+1,n),2)}function Uc(e,t,r,n){return new fe(K.negint,-1-ct(e,t+1,n),3)}function Bc(e,t,r,n){return new fe(K.negint,-1-ft(e,t+1,n),5)}var Zs=BigInt(-1),Dc=BigInt(1);function Mc(e,t,r,n){let i=lt(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new fe(K.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${ve} integers outside of the safe integer range are not supported`);return new fe(K.negint,Zs-BigInt(i),9)}function io(e,t){let r=t.value,n=typeof r=="bigint"?r*Zs-Dc:r*-1-1;Je(e,t.type.majorEncoded,n)}io.encodedSize=function(t){let r=t.value,n=typeof r=="bigint"?r*Zs-Dc:r*-1-1;return n<qe[0]?1:n<qe[1]?2:n<qe[2]?3:n<qe[3]?5:9};io.compareTokens=function(t,r){return t.value<r.value?1:t.value>r.value?-1:0};function ti(e,t,r,n){rr(e,t,r+n);let i=hn(e,t+r,t+r+n);return new fe(K.bytes,i,r+n)}function Lc(e,t,r,n){return ti(e,t,1,r)}function kc(e,t,r,n){return ti(e,t,2,ut(e,t+1,n))}function jc(e,t,r,n){return ti(e,t,3,ct(e,t+1,n))}function Fc(e,t,r,n){return ti(e,t,5,ft(e,t+1,n))}function Vc(e,t,r,n){let i=lt(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer bytes lengths not supported`);return ti(e,t,9,i)}function oo(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===K.string?Ec(e.value):e.value),e.encodedBytes}function yn(e,t){let r=oo(t);Je(e,t.type.majorEncoded,r.length),e.push(r)}yn.encodedSize=function(t){let r=oo(t);return Je.encodedSize(r.length)+r.length};yn.compareTokens=function(t,r){return Ry(oo(t),oo(r))};function Ry(e,t){return e.length<t.length?-1:e.length>t.length?1:Sc(e,t)}function ri(e,t,r,n,i){let o=r+n;rr(e,t,o);let s=new fe(K.string,Oc(e,t+r,t+o),o);return i.retainStringBytes===!0&&(s.byteValue=hn(e,t+r,t+o)),s}function zc(e,t,r,n){return ri(e,t,1,r,n)}function Kc(e,t,r,n){return ri(e,t,2,ut(e,t+1,n),n)}function qc(e,t,r,n){return ri(e,t,3,ct(e,t+1,n),n)}function Gc(e,t,r,n){return ri(e,t,5,ft(e,t+1,n),n)}function Wc(e,t,r,n){let i=lt(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer string lengths not supported`);return ri(e,t,9,i,n)}var Hc=yn;function gn(e,t,r,n){return new fe(K.array,n,r)}function Jc(e,t,r,n){return gn(e,t,1,r)}function Xc(e,t,r,n){return gn(e,t,2,ut(e,t+1,n))}function Yc(e,t,r,n){return gn(e,t,3,ct(e,t+1,n))}function Qc(e,t,r,n){return gn(e,t,5,ft(e,t+1,n))}function Zc(e,t,r,n){let i=lt(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer array lengths not supported`);return gn(e,t,9,i)}function ef(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ve} indefinite length items not allowed`);return gn(e,t,1,1/0)}function so(e,t){Je(e,K.array.majorEncoded,t.value)}so.compareTokens=vt.compareTokens;so.encodedSize=function(t){return Je.encodedSize(t.value)};function mn(e,t,r,n){return new fe(K.map,n,r)}function tf(e,t,r,n){return mn(e,t,1,r)}function rf(e,t,r,n){return mn(e,t,2,ut(e,t+1,n))}function nf(e,t,r,n){return mn(e,t,3,ct(e,t+1,n))}function of(e,t,r,n){return mn(e,t,5,ft(e,t+1,n))}function sf(e,t,r,n){let i=lt(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer map lengths not supported`);return mn(e,t,9,i)}function af(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ve} indefinite length items not allowed`);return mn(e,t,1,1/0)}function ao(e,t){Je(e,K.map.majorEncoded,t.value)}ao.compareTokens=vt.compareTokens;ao.encodedSize=function(t){return Je.encodedSize(t.value)};function uf(e,t,r,n){return new fe(K.tag,r,1)}function cf(e,t,r,n){return new fe(K.tag,ut(e,t+1,n),2)}function ff(e,t,r,n){return new fe(K.tag,ct(e,t+1,n),3)}function lf(e,t,r,n){return new fe(K.tag,ft(e,t+1,n),5)}function df(e,t,r,n){return new fe(K.tag,lt(e,t+1,n),9)}function uo(e,t){Je(e,K.tag.majorEncoded,t.value)}uo.compareTokens=vt.compareTokens;uo.encodedSize=function(t){return Je.encodedSize(t.value)};var My=20,Ly=21,ky=22,jy=23;function pf(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${ve} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new fe(K.null,null,1):new fe(K.undefined,void 0,1)}function hf(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ve} indefinite length items not allowed`);return new fe(K.break,void 0,1)}function ea(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${ve} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${ve} Infinity values are not supported`)}return new fe(K.float,e,t)}function yf(e,t,r,n){return ea(ta(e,t+1),3,n)}function gf(e,t,r,n){return ea(ra(e,t+1),5,n)}function mf(e,t,r,n){return ea(wf(e,t+1),9,n)}function co(e,t,r){let n=t.value;if(n===!1)e.push([K.float.majorEncoded|My]);else if(n===!0)e.push([K.float.majorEncoded|Ly]);else if(n===null)e.push([K.float.majorEncoded|ky]);else if(n===void 0)e.push([K.float.majorEncoded|jy]);else{let i,o=!1;(!r||r.float64!==!0)&&(vf(n),i=ta(Bt,1),n===i||Number.isNaN(n)?(Bt[0]=249,e.push(Bt.slice(0,3)),o=!0):(_f(n),i=ra(Bt,1),n===i&&(Bt[0]=250,e.push(Bt.slice(0,5)),o=!0))),o||(Fy(n),i=wf(Bt,1),Bt[0]=251,e.push(Bt.slice(0,9)))}}co.encodedSize=function(t,r){let n=t.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){vf(n);let i=ta(Bt,1);if(n===i||Number.isNaN(n))return 3;if(_f(n),i=ra(Bt,1),n===i)return 5}return 9};var bf=new ArrayBuffer(9),_t=new DataView(bf,1),Bt=new Uint8Array(bf,0);function vf(e){if(e===1/0)_t.setUint16(0,31744,!1);else if(e===-1/0)_t.setUint16(0,64512,!1);else if(Number.isNaN(e))_t.setUint16(0,32256,!1);else{_t.setFloat32(0,e);let t=_t.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)_t.setUint16(0,31744,!1);else if(r===0)_t.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?_t.setUint16(0,0):i<-14?_t.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):_t.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function ta(e,t){if(e.length-t<2)throw new Error(`${ve} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}function _f(e){_t.setFloat32(0,e,!1)}function ra(e,t){if(e.length-t<4)throw new Error(`${ve} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function Fy(e){_t.setFloat64(0,e,!1)}function wf(e,t){if(e.length-t<8)throw new Error(`${ve} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}co.compareTokens=vt.compareTokens;function Ee(e,t,r){throw new Error(`${ve} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function fo(e){return()=>{throw new Error(`${ve} ${e}`)}}var ue=[];for(let e=0;e<=23;e++)ue[e]=Ee;ue[24]=Cc;ue[25]=Nc;ue[26]=Rc;ue[27]=$c;ue[28]=Ee;ue[29]=Ee;ue[30]=Ee;ue[31]=Ee;for(let e=32;e<=55;e++)ue[e]=Ee;ue[56]=Pc;ue[57]=Uc;ue[58]=Bc;ue[59]=Mc;ue[60]=Ee;ue[61]=Ee;ue[62]=Ee;ue[63]=Ee;for(let e=64;e<=87;e++)ue[e]=Lc;ue[88]=kc;ue[89]=jc;ue[90]=Fc;ue[91]=Vc;ue[92]=Ee;ue[93]=Ee;ue[94]=Ee;ue[95]=fo("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ue[e]=zc;ue[120]=Kc;ue[121]=qc;ue[122]=Gc;ue[123]=Wc;ue[124]=Ee;ue[125]=Ee;ue[126]=Ee;ue[127]=fo("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ue[e]=Jc;ue[152]=Xc;ue[153]=Yc;ue[154]=Qc;ue[155]=Zc;ue[156]=Ee;ue[157]=Ee;ue[158]=Ee;ue[159]=ef;for(let e=160;e<=183;e++)ue[e]=tf;ue[184]=rf;ue[185]=nf;ue[186]=of;ue[187]=sf;ue[188]=Ee;ue[189]=Ee;ue[190]=Ee;ue[191]=af;for(let e=192;e<=215;e++)ue[e]=uf;ue[216]=cf;ue[217]=ff;ue[218]=lf;ue[219]=df;ue[220]=Ee;ue[221]=Ee;ue[222]=Ee;ue[223]=Ee;for(let e=224;e<=243;e++)ue[e]=fo("simple values are not supported");ue[244]=Ee;ue[245]=Ee;ue[246]=Ee;ue[247]=pf;ue[248]=fo("simple values are not supported");ue[249]=yf;ue[250]=gf;ue[251]=mf;ue[252]=Ee;ue[253]=Ee;ue[254]=Ee;ue[255]=hf;var Dt=[];for(let e=0;e<24;e++)Dt[e]=new fe(K.uint,e,1);for(let e=-1;e>=-24;e--)Dt[31-e]=new fe(K.negint,e,1);Dt[64]=new fe(K.bytes,new Uint8Array(0),1);Dt[96]=new fe(K.string,"",1);Dt[128]=new fe(K.array,0,1);Dt[160]=new fe(K.map,0,1);Dt[244]=new fe(K.false,!1,1);Dt[245]=new fe(K.true,!0,1);Dt[246]=new fe(K.null,null,1);function na(){let e=[];return e[K.uint.major]=vt,e[K.negint.major]=io,e[K.bytes.major]=yn,e[K.string.major]=Hc,e[K.array.major]=so,e[K.map.major]=ao,e[K.tag.major]=uo,e[K.float.major]=co,e}var hN=na(),yN=new no,po=class e{constructor(t,r){this.obj=t,this.parent=r}includes(t){let r=this;do if(r.obj===t)return!0;while(r=r.parent);return!1}static createCheck(t,r){if(t&&t.includes(r))throw new Error(`${Qs} object contains circular references`);return new e(r,t)}},yr={null:new fe(K.null,null),undefined:new fe(K.undefined,void 0),true:new fe(K.true,!0),false:new fe(K.false,!1),emptyArray:new fe(K.array,0),emptyMap:new fe(K.map,0)},gr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new fe(K.float,e):e>=0?new fe(K.uint,e):new fe(K.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new fe(K.uint,e):new fe(K.negint,e)},Uint8Array(e,t,r,n){return new fe(K.bytes,e)},string(e,t,r,n){return new fe(K.string,e)},boolean(e,t,r,n){return e?yr.true:yr.false},null(e,t,r,n){return yr.null},undefined(e,t,r,n){return yr.undefined},ArrayBuffer(e,t,r,n){return new fe(K.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new fe(K.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[yr.emptyArray,new fe(K.break)]:yr.emptyArray;n=po.createCheck(n,e);let i=[],o=0;for(let s of e)i[o++]=lo(s,r,n);return r.addBreakTokens?[new fe(K.array,e.length),i,new fe(K.break)]:[new fe(K.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),s=i?e.size:o.length;if(!s)return r.addBreakTokens===!0?[yr.emptyMap,new fe(K.break)]:yr.emptyMap;n=po.createCheck(n,e);let a=[],u=0;for(let c of o)a[u++]=[lo(c,r,n),lo(i?e.get(c):e[c],r,n)];return Ky(a,r),r.addBreakTokens?[new fe(K.map,s),a,new fe(K.break)]:[new fe(K.map,s),a]}};gr.Map=gr.Object;gr.Buffer=gr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))gr[`${e}Array`]=gr.DataView;function lo(e,t={},r){let n=vc(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||gr[n];if(typeof i=="function"){let s=i(e,n,t,r);if(s!=null)return s}let o=gr[n];if(!o)throw new Error(`${Qs} unsupported type: ${n}`);return o(e,n,t,r)}function Ky(e,t){t.mapSorter&&e.sort(t.mapSorter)}var qy={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},ia=class{constructor(t,r={}){this._pos=0,this.data=t,this.options=r}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let t=this.data[this._pos],r=Dt[t];if(r===void 0){let n=ue[t];if(!n)throw new Error(`${ve} no decoder for major type ${t>>>5} (byte 0x${t.toString(16).padStart(2,"0")})`);let i=t&31;r=n(this.data,this._pos,i,this.options)}return this._pos+=r.encodedLength,r}},ni=Symbol.for("DONE"),ho=Symbol.for("BREAK");function Gy(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=ii(t,r);if(o===ho){if(e.value===1/0)break;throw new Error(`${ve} got unexpected break to lengthed array`)}if(o===ni)throw new Error(`${ve} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function Wy(e,t,r){let n=r.useMaps===!0,i=n?void 0:{},o=n?new Map:void 0;for(let s=0;s<e.value;s++){let a=ii(t,r);if(a===ho){if(e.value===1/0)break;throw new Error(`${ve} got unexpected break to lengthed map`)}if(a===ni)throw new Error(`${ve} found map but not enough entries (got ${s} [no key], expected ${e.value})`);if(n!==!0&&typeof a!="string")throw new Error(`${ve} non-string keys not supported (got ${typeof a})`);if(r.rejectDuplicateMapKeys===!0&&(n&&o.has(a)||!n&&a in i))throw new Error(`${ve} found repeat map key "${a}"`);let u=ii(t,r);if(u===ni)throw new Error(`${ve} found map but not enough entries (got ${s} [no value], expected ${e.value})`);n?o.set(a,u):i[a]=u}return n?o:i}function ii(e,t){if(e.done())return ni;let r=e.next();if(r.type===K.break)return ho;if(r.type.terminal)return r.value;if(r.type===K.array)return Gy(r,e,t);if(r.type===K.map)return Wy(r,e,t);if(r.type===K.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=ii(e,t);return t.tags[r.value](n)}throw new Error(`${ve} tag not supported (${r.value})`)}throw new Error("unsupported")}function Tf(e,t){if(!(e instanceof Uint8Array))throw new Error(`${ve} data to decode must be a Uint8Array`);t=Object.assign({},qy,t);let r=t.tokenizer||new ia(e,t),n=ii(r,t);if(n===ni)throw new Error(`${ve} did not find any content to decode`);if(n===ho)throw new Error(`${ve} got unexpected break`);return[n,e.subarray(r.pos())]}function oa(e,t){let[r,n]=Tf(e,t);if(n.length>0)throw new Error(`${ve} too many terminals, data makes no sense`);return r}var ON=new Uint8Array(0);function Af(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function bn(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}function Xy(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(r[s]!==255)throw new TypeError(o+" is ambiguous");r[s]=i}var a=e.length,u=e.charAt(0),c=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function p(E){if(E instanceof Uint8Array||(ArrayBuffer.isView(E)?E=new Uint8Array(E.buffer,E.byteOffset,E.byteLength):Array.isArray(E)&&(E=Uint8Array.from(E))),!(E instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(E.length===0)return"";for(var z=0,W=0,T=0,k=E.length;T!==k&&E[T]===0;)T++,z++;for(var G=(k-T)*l+1>>>0,H=new Uint8Array(G);T!==k;){for(var F=E[T],Y=0,V=G-1;(F!==0||Y<W)&&V!==-1;V--,Y++)F+=256*H[V]>>>0,H[V]=F%a>>>0,F=F/a>>>0;if(F!==0)throw new Error("Non-zero carry");W=Y,T++}for(var ae=G-W;ae!==G&&H[ae]===0;)ae++;for(var L=u.repeat(z);ae<G;++ae)L+=e.charAt(H[ae]);return L}function S(E){if(typeof E!="string")throw new TypeError("Expected String");if(E.length===0)return new Uint8Array;var z=0;if(E[z]!==" "){for(var W=0,T=0;E[z]===u;)W++,z++;for(var k=(E.length-z)*c+1>>>0,G=new Uint8Array(k);E[z];){var H=r[E.charCodeAt(z)];if(H===255)return;for(var F=0,Y=k-1;(H!==0||F<T)&&Y!==-1;Y--,F++)H+=a*G[Y]>>>0,G[Y]=H%256>>>0,H=H/256>>>0;if(H!==0)throw new Error("Non-zero carry");T=F,z++}if(E[z]!==" "){for(var V=k-T;V!==k&&G[V]===0;)V++;for(var ae=new Uint8Array(W+(k-V)),L=W;V!==k;)ae[L++]=G[V++];return ae}}}function x(E){var z=S(E);if(z)return z;throw new Error(`Non-${t} character`)}return{encode:p,decodeUnsafe:S,decode:x}}var Yy=Xy,Qy=Yy,Of=Qy;var sa=class{name;prefix;baseEncode;constructor(t,r,n){this.name=t,this.prefix=r,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}},aa=class{name;prefix;baseDecode;prefixCodePoint;constructor(t,r,n){this.name=t,this.prefix=r;let i=r.codePointAt(0);if(i===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=i,this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Ef(this,t)}},ua=class{decoders;constructor(t){this.decoders=t}or(t){return Ef(this,t)}decode(t){let r=t[0],n=this.decoders[r];if(n!=null)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Ef(e,t){return new ua({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var ca=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(t,r,n,i){this.name=t,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new sa(t,r,n),this.decoder=new aa(t,r,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}};function If({name:e,prefix:t,encode:r,decode:n}){return new ca(e,t,r,n)}function vn({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=Of(r,e);return If({prefix:t,name:e,encode:n,decode:o=>bn(i(o))})}function Zy(e,t,r,n){let i={};for(let l=0;l<t.length;++l)i[t[l]]=l;let o=e.length;for(;e[o-1]==="=";)--o;let s=new Uint8Array(o*r/8|0),a=0,u=0,c=0;for(let l=0;l<o;++l){let p=i[e[l]];if(p===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|p,a+=r,a>=8&&(a-=8,s[c++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return s}function eg(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let u=0;u<e.length;++u)for(a=a<<8|e[u],s+=8;s>r;)s-=r,o+=t[i&a>>s];if(s!==0&&(o+=t[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o}function qt({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return If({prefix:t,name:e,encode(i){return eg(i,n,r)},decode(i){return Zy(i,n,r,e)}})}var oi=qt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),RN=qt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),$N=qt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),PN=qt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),UN=qt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),BN=qt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),DN=qt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),MN=qt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),LN=qt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var yo=vn({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),FN=vn({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var nr=vn({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),KN=vn({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var tg=Cf,xf=128,rg=127,ng=~rg,ig=Math.pow(2,31);function Cf(e,t,r){t=t||[],r=r||0;for(var n=r;e>=ig;)t[r++]=e&255|xf,e/=128;for(;e&ng;)t[r++]=e&255|xf,e>>>=7;return t[r]=e|0,Cf.bytes=r-n+1,t}var og=fa,sg=128,Sf=127;function fa(e,n){var r=0,n=n||0,i=0,o=n,s,a=e.length;do{if(o>=a)throw fa.bytes=0,new RangeError("Could not decode varint");s=e[o++],r+=i<28?(s&Sf)<<i:(s&Sf)*Math.pow(2,i),i+=7}while(s>=sg);return fa.bytes=o-n,r}var ag=Math.pow(2,7),ug=Math.pow(2,14),cg=Math.pow(2,21),fg=Math.pow(2,28),lg=Math.pow(2,35),dg=Math.pow(2,42),pg=Math.pow(2,49),hg=Math.pow(2,56),yg=Math.pow(2,63),gg=function(e){return e<ag?1:e<ug?2:e<cg?3:e<fg?4:e<lg?5:e<dg?6:e<pg?7:e<hg?8:e<yg?9:10},mg={encode:tg,decode:og,encodingLength:gg},bg=mg,si=bg;function ai(e,t=0){return[si.decode(e,t),si.decode.bytes]}function _n(e,t,r=0){return si.encode(e,t,r),t}function wn(e){return si.encodingLength(e)}function Rf(e,t){let r=t.byteLength,n=wn(e),i=n+wn(r),o=new Uint8Array(i+r);return _n(e,o,0),_n(r,o,n),o.set(t,i),new Tn(e,r,t,o)}function $f(e){let t=bn(e),[r,n]=ai(t),[i,o]=ai(t.subarray(n)),s=t.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Tn(r,i,s,t)}function Pf(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Af(e.bytes,r.bytes)}}var Tn=class{code;size;digest;bytes;constructor(t,r,n,i){this.code=t,this.size=r,this.digest=n,this.bytes=i}};function Uf(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return wg(r,la(e),t??nr.encoder);default:return Tg(r,la(e),t??oi.encoder)}}var Bf=new WeakMap;function la(e){let t=Bf.get(e);if(t==null){let r=new Map;return Bf.set(e,r),r}return t}var ci=class e{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==ui)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Ag)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return e.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:r}=this.multihash,n=Rf(t,r);return e.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return e.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&Pf(t.multihash,n.multihash)}toString(t){return Uf(this,t)}toJSON(){return{"/":Uf(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof e)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new e(n,i,o,s??Df(n,i,o.bytes))}else if(r[Og]===!0){let{version:n,multihash:i,code:o}=r,s=$f(i);return e.create(n,o,s)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==ui)throw new Error(`Version 0 CID must use dag-pb (code: ${ui}) block encoding`);return new e(t,r,n,n.bytes)}case 1:{let i=Df(t,r,n.bytes);return new e(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return e.create(0,ui,t)}static createV1(t,r){return e.create(1,t,r)}static decode(t){let[r,n]=e.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=e.inspectBytes(t),n=r.size-r.multihashSize,i=bn(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new Tn(r.multihashCode,r.digestSize,o,i);return[r.version===0?e.createV0(s):e.createV1(r.codec,s),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[p,S]=ai(t.subarray(r));return r+=S,p},i=n(),o=ui;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),u=n(),c=r+u,l=c-s;return{version:i,codec:o,multihashCode:a,digestSize:u,multihashSize:l,size:c}}static parse(t,r){let[n,i]=_g(t,r),o=e.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return la(o).set(n,t),o}};function _g(e,t){switch(e[0]){case"Q":{let r=t??nr;return[nr.prefix,r.decode(`${nr.prefix}${e}`)]}case nr.prefix:{let r=t??nr;return[nr.prefix,r.decode(e)]}case oi.prefix:{let r=t??oi;return[oi.prefix,r.decode(e)]}case yo.prefix:{let r=t??yo;return[yo.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function wg(e,t,r){let{prefix:n}=r;if(n!==nr.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let o=r.encode(e).slice(1);return t.set(n,o),o}else return i}function Tg(e,t,r){let{prefix:n}=r,i=t.get(n);if(i==null){let o=r.encode(e);return t.set(n,o),o}else return i}var ui=112,Ag=18;function Df(e,t,r){let n=wn(e),i=n+wn(t),o=new Uint8Array(i+r.byteLength);return _n(e,o,0),_n(t,o,n),o.set(r,i),o}var Og=Symbol.for("@ipld/js-cid/CID");var Lf=42;function Eg(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=ci.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new fe(K.tag,Lf),new fe(K.bytes,r)]}function Ig(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function xg(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}var Mf={float64:!0,typeEncoders:{Object:Eg,undefined:Ig,number:xg}},rR={...Mf,typeEncoders:{...Mf.typeEncoders}};function Sg(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return ci.decode(e.subarray(1))}var go={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};go.tags[Lf]=Sg;var nR={...go,tags:go.tags.slice()};var da=e=>oa(e,go);var mr=Js(mo(),1),fi={SHA2_256:18,LENGTH:32,DAG_PB:112},ya=40;function An(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=mr.default.decode(e);return t.seek(mr.default.decode.bytes),r}function ga(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),r=0;return{version:2,characteristics:[t.getBigUint64(r,!0),t.getBigUint64(r+=8,!0)],dataOffset:Number(t.getBigUint64(r+=8,!0)),dataSize:Number(t.getBigUint64(r+=8,!0)),indexOffset:Number(t.getBigUint64(r+=8,!0))}}function ma(e){mr.default.decode(e);let t=mr.default.decode.bytes,r=mr.default.decode(e.subarray(mr.default.decode.bytes)),n=mr.default.decode.bytes;return t+n+r}var br={Null:e=>e===null?e:void 0,Int:e=>Number.isInteger(e)?e:void 0,Float:e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,String:e=>typeof e=="string"?e:void 0,Bool:e=>typeof e=="boolean"?e:void 0,Bytes:e=>e instanceof Uint8Array?e:void 0,Link:e=>e!==null&&typeof e=="object"&&e.asCID===e?e:void 0,List:e=>Array.isArray(e)?e:void 0,Map:e=>e!==null&&typeof e=="object"&&e.asCID!==e&&!Array.isArray(e)&&!(e instanceof Uint8Array)?e:void 0},li={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":br.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(br.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=li["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=li["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:br.Int,CarV1HeaderOrV2Pragma:e=>{if(br.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,s]=t[i];switch(o){case"roots":{let a=li["CarV1HeaderOrV2Pragma > roots (anon)"](e[o]);if(a===void 0)return;if(a!==s||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=a}}break;case"version":{n--;let a=li.Int(e[o]);if(a===void 0)return;if(a!==s||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=a}}break;default:return}}if(!(n>0))return r}},di={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":br.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(br.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=di["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=di["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:br.Int,CarV1HeaderOrV2Pragma:e=>{if(br.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,s]=t[i];switch(o){case"roots":{let a=di["CarV1HeaderOrV2Pragma > roots (anon)"](s);if(a===void 0)return;if(a!==s||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=a}}break;case"version":{n--;let a=di.Int(s);if(a===void 0)return;if(a!==s||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=a}}break;default:return}}if(!(n>0))return r}},ba={toTyped:li.CarV1HeaderOrV2Pragma,toRepresentation:di.CarV1HeaderOrV2Pragma};var bR=na();var Gg=Js(mo(),1);var AR=[new fe(K.map,2),new fe(K.string,"version"),new fe(K.uint,1),new fe(K.string,"roots")],OR=new fe(K.tag,42);async function va(e,t){let r=An(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),i=da(n);if(ba.toTyped(i)===void 0)throw new Error("Invalid CAR header format");if(i.version!==1&&i.version!==2||t!==void 0&&i.version!==t)throw new Error(`Invalid CAR version: ${i.version}${t!==void 0?` (expected ${t})`:""}`);if(i.version===1){if(!Array.isArray(i.roots))throw new Error("Invalid CAR header format");return i}if(i.roots!==void 0)throw new Error("Invalid CAR header format");let o=ga(await e.exactly(ya,!0));e.seek(o.dataOffset-e.pos);let s=await va(e,1);return Object.assign(s,o)}async function Hg(e){let t=await e.exactly(2,!1);if(t[0]===fi.SHA2_256&&t[1]===fi.LENGTH){let s=await e.exactly(34,!0),a=to(s);return tr.create(0,fi.DAG_PB,a)}let r=An(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=An(await e.upTo(8),e),i=await e.exactly(ma(await e.upTo(8)),!0),o=to(i);return tr.create(r,n,o)}async function Hf(e){let t=e.pos,r=An(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await Hg(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function Jg(e){let{cid:t,blockLength:r}=await Hf(e);return{bytes:await e.exactly(r,!0),cid:t}}async function Xg(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await Hf(e),o={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(o.blockLength),o}function bo(e){let t=(async()=>{let r=await va(e);if(r.version===2){let n=e.pos-r.dataOffset;e=Qg(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await Jg(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await Xg(e)}}}function pi(e){let t=0;return{async upTo(r){return e.subarray(t,t+Math.min(r,e.length-t))},async exactly(r,n=!1){if(r>e.length-t)throw new Error("Unexpected end of data");let i=e.subarray(t,t+r);return n&&(t+=r),i},seek(r){t+=r},get pos(){return t}}}function Yg(e){let t=0,r=0,n=0,i=new Uint8Array(0),o=async s=>{r=i.length-n;let a=[i.subarray(n)];for(;r<s;){let c=await e();if(c==null)break;r<0?c.length>r&&a.push(c.subarray(-r)):a.push(c),r+=c.length}i=new Uint8Array(a.reduce((c,l)=>c+l.length,0));let u=0;for(let c of a)i.set(c,u),u+=c.length;n=0};return{async upTo(s){return i.length-n<s&&await o(s),i.subarray(n,n+Math.min(i.length-n,s))},async exactly(s,a=!1){if(i.length-n<s&&await o(s),i.length-n<s)throw new Error("Unexpected end of data");let u=i.subarray(n,n+s);return a&&(t+=s,n+=s),u},seek(s){t+=s,n+=s},get pos(){return t}}}function vo(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return Yg(r)}function Qg(e,t){let r=0;return{async upTo(n){let i=await e.upTo(n);return i.length+r>t&&(i=i.subarray(0,t-r)),i},async exactly(n,i=!1){let o=await e.exactly(n,i);if(o.length+r>t)throw new Error("Unexpected end of data");return i&&(r+=n),o},seek(n){r+=n,e.seek(n)},get pos(){return e.pos}}}var Dr=class{constructor(t,r){this._header=t,this._blocks=r,this._keys=r.map(n=>n.cid.toString())}get version(){return this._header.version}async getRoots(){return this._header.roots}async has(t){return this._keys.indexOf(t.toString())>-1}async get(t){let r=this._keys.indexOf(t.toString());return r>-1?this._blocks[r]:void 0}async*blocks(){for(let t of this._blocks)yield t}async*cids(){for(let t of this._blocks)yield t.cid}static async fromBytes(t){if(!(t instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Jf(pi(t))}static async fromIterable(t){if(!t||typeof t[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Jf(vo(t))}};async function Jf(e){let t=bo(e),r=await t.header(),n=[];for await(let i of t.blocks())n.push(i);return new Dr(r,n)}var em=Js(mo(),1);var tm={0:"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'",1:function(t,r){return"Cannot apply '"+t+"' to '"+r.toString()+"': Field not found."},5:"'keys()' can only be used on observable objects, arrays, sets and maps",6:"'values()' can only be used on observable objects, arrays, sets and maps",7:"'entries()' can only be used on observable objects, arrays and maps",8:"'set()' can only be used on observable objects, arrays and maps",9:"'remove()' can only be used on observable objects, arrays and maps",10:"'has()' can only be used on observable objects, arrays and maps",11:"'get()' can only be used on observable objects, arrays and maps",12:"Invalid annotation",13:"Dynamic observable objects cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",14:"Intercept handlers should return nothing or a change object",15:"Observable arrays cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",16:"Modification exception: the internal structure of an observable array was changed.",17:function(t,r){return"[mobx.array] Index out of bounds, "+t+" is larger than "+r},18:"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js",19:function(t){return"Cannot initialize from classes that inherit from Map: "+t.constructor.name},20:function(t){return"Cannot initialize map from "+t},21:function(t){return"Cannot convert to map from '"+t+"'"},22:"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js",23:"It is not possible to get index atoms from arrays",24:function(t){return"Cannot obtain administration from "+t},25:function(t,r){return"the entry '"+t+"' does not exist in the observable map '"+r+"'"},26:"please specify a property",27:function(t,r){return"no observable property '"+t.toString()+"' found on the observable object '"+r+"'"},28:function(t){return"Cannot obtain atom from "+t},29:"Expecting some object",30:"invalid action stack. did you forget to finish an action?",31:"missing option for computed: get",32:function(t,r){return"Cycle detected in computation "+t+": "+r},33:function(t){return"The setter of computed value '"+t+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"},34:function(t){return"[ComputedValue '"+t+"'] It is not possible to assign a new value to a computed value."},35:"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`",36:"isolateGlobalState should be called before MobX is running any reactions",37:function(t){return"[mobx] `observableArray."+t+"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice()."+t+"()` instead"},38:"'ownKeys()' can only be used on observable objects",39:"'defineProperty()' can only be used on observable objects"},rm=tm;function le(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i=typeof e=="string"?e:rm[e];throw typeof i=="function"&&(i=i.apply(null,r)),new Error("[MobX] "+i)}var nm={};function Pa(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:nm}var ll=Object.assign,So=Object.getOwnPropertyDescriptor,Wt=Object.defineProperty,vi=Object.prototype,Co=[];Object.freeze(Co);var Ua={};Object.freeze(Ua);var im=typeof Proxy<"u",om=Object.toString();function dl(){im||le("`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`")}function hi(e){Q.verifyProxies&&le("MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to "+e)}function St(){return++Q.mobxGuid}function Ba(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var En=function(){};function je(e){return typeof e=="function"}function Lr(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function Mo(e){return e!==null&&typeof e=="object"}function jt(e){if(!Mo(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r.toString()===om}function pl(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Lo(e,t,r){Wt(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function hl(e,t,r){Wt(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}function wr(e,t){var r="isMobX"+e;return t.prototype[r]=!0,function(n){return Mo(n)&&n[r]===!0}}function Nn(e){return e instanceof Map}function _i(e){return e instanceof Set}var yl=typeof Object.getOwnPropertySymbols<"u";function sm(e){var t=Object.keys(e);if(!yl)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(n){return vi.propertyIsEnumerable.call(e,n)})):t}var ko=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:yl?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Ta(e){return typeof e=="string"?e:typeof e=="symbol"?e.toString():new String(e).toString()}function gl(e){return e===null?null:typeof e=="object"?""+e:e}function Et(e,t){return vi.hasOwnProperty.call(e,t)}var am=Object.getOwnPropertyDescriptors||function(t){var r={};return ko(t).forEach(function(n){r[n]=So(t,n)}),r};function Xf(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,fm(n.key),n)}}function Da(e,t,r){return t&&Xf(e.prototype,t),r&&Xf(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function sr(){return sr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},sr.apply(this,arguments)}function ml(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Aa(e,t)}function Aa(e,t){return Aa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},Aa(e,t)}function Oo(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function um(e,t){if(e){if(typeof e=="string")return Yf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Yf(e,t)}}function Yf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function In(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=um(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cm(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function fm(e){var t=cm(e,"string");return typeof t=="symbol"?t:String(t)}var ot=Symbol("mobx-stored-annotations");function Ht(e){function t(r,n){if(wi(n))return e.decorate_20223_(r,n);Rn(r,n,e)}return Object.assign(t,e)}function Rn(e,t,r){if(Et(e,ot)||Lo(e,ot,sr({},e[ot])),No(r)&&!Et(e[ot],t)){var n=e.constructor.name+".prototype."+t.toString();le("'"+n+"' is decorated with 'override', but no such decorated member was found on prototype.")}lm(e,r,t),No(r)||(e[ot][t]=r)}function lm(e,t,r){if(!No(t)&&Et(e[ot],r)){var n=e.constructor.name+".prototype."+r.toString(),i=e[ot][r].annotationType_,o=t.annotationType_;le("Cannot apply '@"+o+"' to '"+n+"':"+(`
3
3
  The field is already decorated with '@`+i+"'.")+`
4
4
  Re-decorating fields is not allowed.
5
- Use '@override' decorator for methods overridden by subclass.`)}}function dm(e){return Et(e,ot)||Mo(e,ot,sr({},e[ot])),e[ot]}function wi(e){return typeof e=="object"&&typeof e.kind=="string"}function ko(e,t){t.includes(e.kind)||le("The decorator applied to '"+String(e.name)+"' cannot be used on a "+e.kind+" element")}var be=Symbol("mobx administration"),Ti=function(){function e(r){r===void 0&&(r="Atom@"+St()),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ie.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=r}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(n){return n()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(n){return n()})},t.reportObserved=function(){return Ml(this)},t.reportChanged=function(){At(),Ll(this),Ot()},t.toString=function(){return this.name_},e}(),Ma=wr("Atom",Ti);function bl(e,t,r){t===void 0&&(t=En),r===void 0&&(r=En);var n=new Ti(e);return t!==En&&Pn(n,t),r!==En&&Gr(n,r),n}function pm(e,t){return e===t}function hm(e,t){return qa(e,t)}function ym(e,t){return qa(e,t,1)}function gm(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Ge={identity:pm,structural:hm,default:gm,shallow:ym};function kr(e,t,r){return Cn(e)?e:Array.isArray(e)?Pe.array(e,{name:r}):jt(e)?Pe.object(e,void 0,{name:r}):Nn(e)?Pe.map(e,{name:r}):_i(e)?Pe.set(e,{name:r}):typeof e=="function"&&!qr(e)&&!mi(e)?pl(e)?Sn(e):gi(r,e):e}function mm(e,t,r){if(e==null||zr(e)||Un(e)||Jt(e)||Wr(e))return e;if(Array.isArray(e))return Pe.array(e,{name:r,deep:!1});if(jt(e))return Pe.object(e,void 0,{name:r,deep:!1});if(Nn(e))return Pe.map(e,{name:r,deep:!1});if(_i(e))return Pe.set(e,{name:r,deep:!1});le("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets")}function jo(e){return e}function bm(e,t){return Cn(e)&&le("observable.struct should not be used with observable values"),qa(e,t)?t:e}var vm="override";function Co(e){return e.annotationType_===vm}function Ai(e,t){return{annotationType_:e,options_:t,make_:_m,extend_:wm,decorate_20223_:Tm}}function _m(e,t,r,n){var i;if((i=this.options_)!=null&&i.bound)return this.extend_(e,t,r,!1)===null?0:1;if(n===e.target_)return this.extend_(e,t,r,!1)===null?0:2;if(qr(r.value))return 1;var o=vl(e,this,t,r,!1);return Wt(n,t,o),2}function wm(e,t,r,n){var i=vl(e,this,t,r);return e.defineProperty_(t,i,n)}function Tm(e,t){ko(t,["method","field"]);var r=t.kind,n=t.name,i=t.addInitializer,o=this,s=function(c){var l,p,S,x;return jr((l=(p=o.options_)==null?void 0:p.name)!=null?l:n.toString(),c,(S=(x=o.options_)==null?void 0:x.autoAction)!=null?S:!1)};if(r=="field"){i(function(){Rn(this,n,o)});return}if(r=="method"){var a;return qr(e)||(e=s(e)),(a=this.options_)!=null&&a.bound&&i(function(){var u=this,c=u[n].bind(u);c.isMobxAction=!0,u[n]=c}),e}le("Cannot apply '"+o.annotationType_+"' to '"+String(n)+"' (kind: "+r+"):"+(`
5
+ Use '@override' decorator for methods overridden by subclass.`)}}function dm(e){return Et(e,ot)||Lo(e,ot,sr({},e[ot])),e[ot]}function wi(e){return typeof e=="object"&&typeof e.kind=="string"}function jo(e,t){t.includes(e.kind)||le("The decorator applied to '"+String(e.name)+"' cannot be used on a "+e.kind+" element")}var be=Symbol("mobx administration"),Ti=function(){function e(r){r===void 0&&(r="Atom@"+St()),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ie.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=r}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(n){return n()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(n){return n()})},t.reportObserved=function(){return Ml(this)},t.reportChanged=function(){At(),Ll(this),Ot()},t.toString=function(){return this.name_},e}(),Ma=wr("Atom",Ti);function bl(e,t,r){t===void 0&&(t=En),r===void 0&&(r=En);var n=new Ti(e);return t!==En&&Pn(n,t),r!==En&&Gr(n,r),n}function pm(e,t){return e===t}function hm(e,t){return qa(e,t)}function ym(e,t){return qa(e,t,1)}function gm(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Ge={identity:pm,structural:hm,default:gm,shallow:ym};function kr(e,t,r){return Cn(e)?e:Array.isArray(e)?Pe.array(e,{name:r}):jt(e)?Pe.object(e,void 0,{name:r}):Nn(e)?Pe.map(e,{name:r}):_i(e)?Pe.set(e,{name:r}):typeof e=="function"&&!qr(e)&&!mi(e)?pl(e)?Sn(e):gi(r,e):e}function mm(e,t,r){if(e==null||zr(e)||Un(e)||Jt(e)||Wr(e))return e;if(Array.isArray(e))return Pe.array(e,{name:r,deep:!1});if(jt(e))return Pe.object(e,void 0,{name:r,deep:!1});if(Nn(e))return Pe.map(e,{name:r,deep:!1});if(_i(e))return Pe.set(e,{name:r,deep:!1});le("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets")}function Fo(e){return e}function bm(e,t){return Cn(e)&&le("observable.struct should not be used with observable values"),qa(e,t)?t:e}var vm="override";function No(e){return e.annotationType_===vm}function Ai(e,t){return{annotationType_:e,options_:t,make_:_m,extend_:wm,decorate_20223_:Tm}}function _m(e,t,r,n){var i;if((i=this.options_)!=null&&i.bound)return this.extend_(e,t,r,!1)===null?0:1;if(n===e.target_)return this.extend_(e,t,r,!1)===null?0:2;if(qr(r.value))return 1;var o=vl(e,this,t,r,!1);return Wt(n,t,o),2}function wm(e,t,r,n){var i=vl(e,this,t,r);return e.defineProperty_(t,i,n)}function Tm(e,t){jo(t,["method","field"]);var r=t.kind,n=t.name,i=t.addInitializer,o=this,s=function(c){var l,p,S,x;return jr((l=(p=o.options_)==null?void 0:p.name)!=null?l:n.toString(),c,(S=(x=o.options_)==null?void 0:x.autoAction)!=null?S:!1)};if(r=="field"){i(function(){Rn(this,n,o)});return}if(r=="method"){var a;return qr(e)||(e=s(e)),(a=this.options_)!=null&&a.bound&&i(function(){var u=this,c=u[n].bind(u);c.isMobxAction=!0,u[n]=c}),e}le("Cannot apply '"+o.annotationType_+"' to '"+String(n)+"' (kind: "+r+"):"+(`
6
6
  '`+o.annotationType_+"' can only be used on properties with a function value."))}function Am(e,t,r,n){var i=t.annotationType_,o=n.value;je(o)||le("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
7
- '`+i+"' can only be used on properties with a function value."))}function vl(e,t,r,n,i){var o,s,a,u,c,l,p;i===void 0&&(i=Q.safeDescriptors),Am(e,t,r,n);var S=n.value;if((o=t.options_)!=null&&o.bound){var x;S=S.bind((x=e.proxy_)!=null?x:e.target_)}return{value:jr((s=(a=t.options_)==null?void 0:a.name)!=null?s:r.toString(),S,(u=(c=t.options_)==null?void 0:c.autoAction)!=null?u:!1,(l=t.options_)!=null&&l.bound?(p=e.proxy_)!=null?p:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function _l(e,t){return{annotationType_:e,options_:t,make_:Om,extend_:Em,decorate_20223_:Im}}function Om(e,t,r,n){var i;if(n===e.target_)return this.extend_(e,t,r,!1)===null?0:2;if((i=this.options_)!=null&&i.bound&&(!Et(e.target_,t)||!mi(e.target_[t]))&&this.extend_(e,t,r,!1)===null)return 0;if(mi(r.value))return 1;var o=wl(e,this,t,r,!1,!1);return Wt(n,t,o),2}function Em(e,t,r,n){var i,o=wl(e,this,t,r,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,o,n)}function Im(e,t){var r;ko(t,["method"]);var n=t.name,i=t.addInitializer;return mi(e)||(e=Sn(e)),(r=this.options_)!=null&&r.bound&&i(function(){var o=this,s=o[n].bind(o);s.isMobXFlow=!0,o[n]=s}),e}function xm(e,t,r,n){var i=t.annotationType_,o=n.value;je(o)||le("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
8
- '`+i+"' can only be used on properties with a generator function value."))}function wl(e,t,r,n,i,o){o===void 0&&(o=Q.safeDescriptors),xm(e,t,r,n);var s=n.value;if(mi(s)||(s=Sn(s)),i){var a;s=s.bind((a=e.proxy_)!=null?a:e.target_),s.isMobXFlow=!0}return{value:s,configurable:o?e.isPlainObject_:!0,enumerable:!1,writable:!o}}function La(e,t){return{annotationType_:e,options_:t,make_:Sm,extend_:Cm,decorate_20223_:Nm}}function Sm(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function Cm(e,t,r,n){return Rm(e,this,t,r),e.defineComputedProperty_(t,sr({},this.options_,{get:r.get,set:r.set}),n)}function Nm(e,t){ko(t,["getter"]);var r=this,n=t.name,i=t.addInitializer;return i(function(){var o=Bn(this)[be],s=sr({},r.options_,{get:e,context:this});s.name||(s.name=o.name_+"."+n.toString()),o.values_.set(n,new Fr(s))}),function(){return this[be].getObservablePropValue_(n)}}function Rm(e,t,r,n){var i=t.annotationType_,o=n.get;o||le("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
9
- '`+i+"' can only be used on getter(+setter) properties."))}function Fo(e,t){return{annotationType_:e,options_:t,make_:$m,extend_:Pm,decorate_20223_:Um}}function $m(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function Pm(e,t,r,n){var i,o;return Bm(e,this,t,r),e.defineObservableProperty_(t,r.value,(i=(o=this.options_)==null?void 0:o.enhancer)!=null?i:kr,n)}function Um(e,t){if(t.kind==="field")throw le("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");ko(t,["accessor"]);var r=this,n=t.kind,i=t.name,o=new WeakSet;function s(a,u){var c,l,p=Bn(a)[be],S=new _r(u,(c=(l=r.options_)==null?void 0:l.enhancer)!=null?c:kr,p.name_+"."+i.toString(),!1);p.values_.set(i,S),o.add(a)}if(n=="accessor")return{get:function(){return o.has(this)||s(this,e.get.call(this)),this[be].getObservablePropValue_(i)},set:function(u){return o.has(this)||s(this,u),this[be].setObservablePropValue_(i,u)},init:function(u){return o.has(this)||s(this,u),u}}}function Bm(e,t,r,n){var i=t.annotationType_;"value"in n||le("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
10
- '`+i+"' cannot be used on getter/setter properties"))}var Dm="true",Mm=Tl();function Tl(e){return{annotationType_:Dm,options_:e,make_:Lm,extend_:km,decorate_20223_:jm}}function Lm(e,t,r,n){var i,o;if(r.get)return Me.make_(e,t,r,n);if(r.set){var s=jr(t.toString(),r.set);return n===e.target_?e.defineProperty_(t,{configurable:Q.safeDescriptors?e.isPlainObject_:!0,set:s})===null?0:2:(Wt(n,t,{configurable:!0,set:s}),2)}if(n!==e.target_&&typeof r.value=="function"){var a;if(pl(r.value)){var u,c=(u=this.options_)!=null&&u.autoBind?Sn.bound:Sn;return c.make_(e,t,r,n)}var l=(a=this.options_)!=null&&a.autoBind?gi.bound:gi;return l.make_(e,t,r,n)}var p=((i=this.options_)==null?void 0:i.deep)===!1?Pe.ref:Pe;if(typeof r.value=="function"&&(o=this.options_)!=null&&o.autoBind){var S;r.value=r.value.bind((S=e.proxy_)!=null?S:e.target_)}return p.make_(e,t,r,n)}function km(e,t,r,n){var i,o;if(r.get)return Me.extend_(e,t,r,n);if(r.set)return e.defineProperty_(t,{configurable:Q.safeDescriptors?e.isPlainObject_:!0,set:jr(t.toString(),r.set)},n);if(typeof r.value=="function"&&(i=this.options_)!=null&&i.autoBind){var s;r.value=r.value.bind((s=e.proxy_)!=null?s:e.target_)}var a=((o=this.options_)==null?void 0:o.deep)===!1?Pe.ref:Pe;return a.extend_(e,t,r,n)}function jm(e,t){le("'"+this.annotationType_+"' cannot be used as a decorator")}var Fm="observable",Vm="observable.ref",zm="observable.shallow",Km="observable.struct",Al={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Al);function vo(e){return e||Al}var Oa=Fo(Fm),qm=Fo(Vm,{enhancer:jo}),Gm=Fo(zm,{enhancer:mm}),Wm=Fo(Km,{enhancer:bm}),Ol=Ht(Oa);function _o(e){return e.deep===!0?kr:e.deep===!1?jo:Jm(e.defaultDecorator)}function Hm(e){var t;return e?(t=e.defaultDecorator)!=null?t:Tl(e):void 0}function Jm(e){var t,r;return e&&(t=(r=e.options_)==null?void 0:r.enhancer)!=null?t:kr}function El(e,t,r){if(wi(t))return Oa.decorate_20223_(e,t);if(Lr(t)){Rn(e,t,Oa);return}return Cn(e)?e:jt(e)?Pe.object(e,t,r):Array.isArray(e)?Pe.array(e,t):Nn(e)?Pe.map(e,t):_i(e)?Pe.set(e,t):typeof e=="object"&&e!==null?e:Pe.box(e,t)}ll(El,Ol);var Xm={box:function(t,r){var n=vo(r);return new _r(t,_o(n),n.name,!0,n.equals)},array:function(t,r){var n=vo(r);return(Q.useProxies===!1||n.proxy===!1?Xb:jb)(t,_o(n),n.name)},map:function(t,r){var n=vo(r);return new td(t,_o(n),n.name)},set:function(t,r){var n=vo(r);return new id(t,_o(n),n.name)},object:function(t,r,n){return Hr(function(){return Cb(Q.useProxies===!1||n?.proxy===!1?Bn({},n):Mb({},n),t,r)})},ref:Ht(qm),shallow:Ht(Gm),deep:Ol,struct:Ht(Wm)},Pe=ll(El,Xm),Il="computed",Ym="computed.struct",Ea=La(Il),Qm=La(Ym,{equals:Ge.structural}),Me=function(t,r){if(wi(r))return Ea.decorate_20223_(t,r);if(Lr(r))return Rn(t,r,Ea);if(jt(t))return Ht(La(Il,t));je(t)||le("First argument to `computed` should be an expression."),je(r)&&le("A setter as second argument is no longer supported, use `{ set: fn }` option instead");var n=jt(r)?r:{};return n.get=t,n.name||(n.name=t.name||""),new Fr(n)};Object.assign(Me,Ea);Me.struct=Ht(Qm);var Qf,Zf,No=0,Zm=1,eb=(Qf=(Zf=xo(function(){},"name"))==null?void 0:Zf.configurable)!=null?Qf:!1,el={value:"action",configurable:!0,writable:!1,enumerable:!1};function jr(e,t,r,n){r===void 0&&(r=!1),je(t)||le("`action` can only be invoked on functions"),(typeof e!="string"||!e)&&le("actions should have valid names, got: '"+e+"'");function i(){return xl(e,r,t,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},eb&&(el.value=e,Wt(i,"name",el)),i}function xl(e,t,r,n,i){var o=tb(e,t,n,i);try{return r.apply(n,i)}catch(s){throw o.error_=s,s}finally{rb(o)}}function tb(e,t,r,n){var i=Xe()&&!!e,o=0;if(i){o=Date.now();var s=n?Array.from(n):So;dt({type:ja,name:e,object:r,arguments:s})}var a=Q.trackingDerivation,u=!t||!a;At();var c=Q.allowStateChanges;u&&(Kr(),c=Vo(!0));var l=ka(!0),p={runAsAction_:u,prevDerivation_:a,prevAllowStateChanges_:c,prevAllowStateReads_:l,notifySpy_:i,startTime_:o,actionId_:Zm++,parentActionId_:No};return No=p.actionId_,p}function rb(e){No!==e.actionId_&&le(30),No=e.parentActionId_,e.error_!==void 0&&(Q.suppressReactionErrors=!0),zo(e.prevAllowStateChanges_),yi(e.prevAllowStateReads_),Ot(),e.runAsAction_&&or(e.prevDerivation_),e.notifySpy_&&pt({time:Date.now()-e.startTime_}),Q.suppressReactionErrors=!1}function nb(e,t){var r=Vo(e);try{return t()}finally{zo(r)}}function Vo(e){var t=Q.allowStateChanges;return Q.allowStateChanges=e,t}function zo(e){Q.allowStateChanges=e}var Sl,ib="create";Sl=Symbol.toPrimitive;var _r=function(e){ml(t,e);function t(n,i,o,s,a){var u;return o===void 0&&(o="ObservableValue@"+St()),s===void 0&&(s=!0),a===void 0&&(a=Ge.default),u=e.call(this,o)||this,u.enhancer=void 0,u.name_=void 0,u.equals=void 0,u.hasUnreportedChange_=!1,u.interceptors_=void 0,u.changeListeners_=void 0,u.value_=void 0,u.dehancer=void 0,u.enhancer=i,u.name_=o,u.equals=a,u.value_=i(n,void 0,o),s&&Xe()&&Vr({type:ib,object:Ao(u),observableKind:"value",debugObjectName:u.name_,newValue:""+u.value_}),u}var r=t.prototype;return r.dehanceValue=function(i){return this.dehancer!==void 0?this.dehancer(i):i},r.set=function(i){var o=this.value_;if(i=this.prepareNewValue_(i),i!==Q.UNCHANGED){var s=Xe();s&&dt({type:Mt,object:this,observableKind:"value",debugObjectName:this.name_,newValue:i,oldValue:o}),this.setNewValue_(i),s&&pt()}},r.prepareNewValue_=function(i){if(Gt(this),wt(this)){var o=Tt(this,{object:this,type:Mt,newValue:i});if(!o)return Q.UNCHANGED;i=o.newValue}return i=this.enhancer(i,this.value_,this.name_),this.equals(this.value_,i)?Q.UNCHANGED:i},r.setNewValue_=function(i){var o=this.value_;this.value_=i,this.reportChanged(),Lt(this)&&kt(this,{type:Mt,object:this,newValue:i,oldValue:o})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(i){return xi(this,i)},r.observe_=function(i,o){return o&&i({observableKind:"value",debugObjectName:this.name_,object:this,type:Mt,newValue:this.value_,oldValue:void 0}),Si(this,i)},r.raw=function(){return this.value_},r.toJSON=function(){return this.get()},r.toString=function(){return this.name_+"["+this.value_+"]"},r.valueOf=function(){return gl(this.get())},r[Sl]=function(){return this.valueOf()},t}(Ti),ob=wr("ObservableValue",_r),Cl;Cl=Symbol.toPrimitive;var Fr=function(){function e(r){this.dependenciesState_=Ie.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.isBeingObserved_=!1,this.isPendingUnobservation_=!1,this.observers_=new Set,this.diffValue_=0,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ie.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Ro(null),this.name_=void 0,this.triggeredBy_=void 0,this.isComputing_=!1,this.isRunningSetter_=!1,this.derivation=void 0,this.setter_=void 0,this.isTracing_=It.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,r.get||le(31),this.derivation=r.get,this.name_=r.name||"ComputedValue@"+St(),r.set&&(this.setter_=jr(this.name_+"-setter",r.set)),this.equals_=r.equals||(r.compareStructural||r.struct?Ge.structural:Ge.default),this.scope_=r.context,this.requiresReaction_=r.requiresReaction,this.keepAlive_=!!r.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){hb(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(n){return n()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(n){return n()})},t.get=function(){if(this.isComputing_&&le(32,this.name_,this.derivation),Q.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)Ia(this)&&(this.warnAboutUntrackedRead_(),At(),this.value_=this.computeValue_(!1),Ot());else if(Ml(this),Ia(this)){var n=Q.trackingContext;this.keepAlive_&&!n&&(Q.trackingContext=this),this.trackAndCompute()&&pb(this),Q.trackingContext=n}var i=this.value_;if(Oo(i))throw i.cause;return i},t.set=function(n){if(this.setter_){this.isRunningSetter_&&le(33,this.name_),this.isRunningSetter_=!0;try{this.setter_.call(this.scope_,n)}finally{this.isRunningSetter_=!1}}else le(34,this.name_)},t.trackAndCompute=function(){var n=this.value_,i=this.dependenciesState_===Ie.NOT_TRACKING_,o=this.computeValue_(!0),s=i||Oo(n)||Oo(o)||!this.equals_(n,o);return s&&(this.value_=o,Xe()&&Vr({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:n,newValue:o})),s},t.computeValue_=function(n){this.isComputing_=!0;var i=Vo(!1),o;if(n)o=Rl(this,this.derivation,this.scope_);else if(Q.disableErrorBoundaries===!0)o=this.derivation.call(this.scope_);else try{o=this.derivation.call(this.scope_)}catch(s){o=new Ro(s)}return zo(i),this.isComputing_=!1,o},t.suspend_=function(){this.keepAlive_||(xa(this),this.value_=void 0,this.isTracing_!==It.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' was suspended and it will recompute on the next access."))},t.observe_=function(n,i){var o=this,s=!0,a=void 0;return Ct(function(){var u=o.get();if(!s||i){var c=Kr();n({observableKind:"computed",debugObjectName:o.name_,type:Mt,object:o,newValue:u,oldValue:a}),or(c)}s=!1,a=u})},t.warnAboutUntrackedRead_=function(){this.isTracing_!==It.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute."),(typeof this.requiresReaction_=="boolean"?this.requiresReaction_:Q.computedRequiresReaction)&&console.warn("[mobx] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute.")},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return gl(this.get())},t[Cl]=function(){return this.valueOf()},e}(),Oi=wr("ComputedValue",Fr),Ie;(function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"})(Ie||(Ie={}));var It;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(It||(It={}));var Ro=function(t){this.cause=void 0,this.cause=t};function Oo(e){return e instanceof Ro}function Ia(e){switch(e.dependenciesState_){case Ie.UP_TO_DATE_:return!1;case Ie.NOT_TRACKING_:case Ie.STALE_:return!0;case Ie.POSSIBLY_STALE_:{for(var t=ka(!0),r=Kr(),n=e.observing_,i=n.length,o=0;o<i;o++){var s=n[o];if(Oi(s)){if(Q.disableErrorBoundaries)s.get();else try{s.get()}catch{return or(r),yi(t),!0}if(e.dependenciesState_===Ie.STALE_)return or(r),yi(t),!0}}return $l(e),or(r),yi(t),!1}}}function Nl(){return Q.trackingDerivation!==null}function Gt(e){var t=e.observers_.size>0;!Q.allowStateChanges&&(t||Q.enforceActions==="always")&&console.warn("[MobX] "+(Q.enforceActions?"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: ":"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ")+e.name_)}function sb(e){!Q.allowStateReads&&Q.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}function Rl(e,t,r){var n=ka(!0);$l(e),e.newObserving_=new Array(e.observing_.length+100),e.unboundDepsCount_=0,e.runId_=++Q.runId;var i=Q.trackingDerivation;Q.trackingDerivation=e,Q.inBatch++;var o;if(Q.disableErrorBoundaries===!0)o=t.call(r);else try{o=t.call(r)}catch(s){o=new Ro(s)}return Q.inBatch--,Q.trackingDerivation=i,ub(e),ab(e),yi(n),o}function ab(e){e.observing_.length===0&&(typeof e.requiresObservable_=="boolean"?e.requiresObservable_:Q.reactionRequiresObservable)&&console.warn("[mobx] Derivation '"+e.name_+"' is created/updated without reading any observable value.")}function ub(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=Ie.UP_TO_DATE_,i=0,o=e.unboundDepsCount_,s=0;s<o;s++){var a=r[s];a.diffValue_===0&&(a.diffValue_=1,i!==s&&(r[i]=a),i++),a.dependenciesState_>n&&(n=a.dependenciesState_)}for(r.length=i,e.newObserving_=null,o=t.length;o--;){var u=t[o];u.diffValue_===0&&Bl(u,e),u.diffValue_=0}for(;i--;){var c=r[i];c.diffValue_===1&&(c.diffValue_=0,db(c,e))}n!==Ie.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}function xa(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)Bl(t[r],e);e.dependenciesState_=Ie.NOT_TRACKING_}function Re(e){var t=Kr();try{return e()}finally{or(t)}}function Kr(){var e=Q.trackingDerivation;return Q.trackingDerivation=null,e}function or(e){Q.trackingDerivation=e}function ka(e){var t=Q.allowStateReads;return Q.allowStateReads=e,t}function yi(e){Q.allowStateReads=e}function $l(e){if(e.dependenciesState_!==Ie.UP_TO_DATE_){e.dependenciesState_=Ie.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ie.UP_TO_DATE_}}var Eo=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},Io=!0,Pl=!1,Q=function(){var e=Pa();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Io=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new Eo().version&&(Io=!1),Io?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Eo):(setTimeout(function(){Pl||le(35)},1),new Eo)}();function cb(){if((Q.pendingReactions.length||Q.inBatch||Q.isRunningReactions)&&le(36),Pl=!0,Io){var e=Pa();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),Q=new Eo}}function Ul(){return Q}function fb(e){return e.observers_&&e.observers_.size>0}function lb(e){return e.observers_}function db(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Bl(e,t){e.observers_.delete(t),e.observers_.size===0&&Dl(e)}function Dl(e){e.isPendingUnobservation_===!1&&(e.isPendingUnobservation_=!0,Q.pendingUnobservations.push(e))}function At(){Q.inBatch++}function Ot(){if(--Q.inBatch===0){Fl();for(var e=Q.pendingUnobservations,t=0;t<e.length;t++){var r=e[t];r.isPendingUnobservation_=!1,r.observers_.size===0&&(r.isBeingObserved_&&(r.isBeingObserved_=!1,r.onBUO()),r instanceof Fr&&r.suspend_())}Q.pendingUnobservations=[]}}function Ml(e){sb(e);var t=Q.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved_&&Q.trackingContext&&(e.isBeingObserved_=!0,e.onBO())),e.isBeingObserved_):(e.observers_.size===0&&Q.inBatch>0&&Dl(e),!1)}function Ll(e){e.lowestObserverState_!==Ie.STALE_&&(e.lowestObserverState_=Ie.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ie.UP_TO_DATE_&&(t.isTracing_!==It.NONE&&kl(t,e),t.onBecomeStale_()),t.dependenciesState_=Ie.STALE_}))}function pb(e){e.lowestObserverState_!==Ie.STALE_&&(e.lowestObserverState_=Ie.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ie.POSSIBLY_STALE_?(t.dependenciesState_=Ie.STALE_,t.isTracing_!==It.NONE&&kl(t,e)):t.dependenciesState_===Ie.UP_TO_DATE_&&(e.lowestObserverState_=Ie.UP_TO_DATE_)}))}function hb(e){e.lowestObserverState_===Ie.UP_TO_DATE_&&(e.lowestObserverState_=Ie.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ie.UP_TO_DATE_&&(t.dependenciesState_=Ie.POSSIBLY_STALE_,t.onBecomeStale_())}))}function kl(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===It.BREAK){var r=[];jl(Ei(e),r,1),new Function(`debugger;
7
+ '`+i+"' can only be used on properties with a function value."))}function vl(e,t,r,n,i){var o,s,a,u,c,l,p;i===void 0&&(i=Q.safeDescriptors),Am(e,t,r,n);var S=n.value;if((o=t.options_)!=null&&o.bound){var x;S=S.bind((x=e.proxy_)!=null?x:e.target_)}return{value:jr((s=(a=t.options_)==null?void 0:a.name)!=null?s:r.toString(),S,(u=(c=t.options_)==null?void 0:c.autoAction)!=null?u:!1,(l=t.options_)!=null&&l.bound?(p=e.proxy_)!=null?p:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function _l(e,t){return{annotationType_:e,options_:t,make_:Om,extend_:Em,decorate_20223_:Im}}function Om(e,t,r,n){var i;if(n===e.target_)return this.extend_(e,t,r,!1)===null?0:2;if((i=this.options_)!=null&&i.bound&&(!Et(e.target_,t)||!mi(e.target_[t]))&&this.extend_(e,t,r,!1)===null)return 0;if(mi(r.value))return 1;var o=wl(e,this,t,r,!1,!1);return Wt(n,t,o),2}function Em(e,t,r,n){var i,o=wl(e,this,t,r,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,o,n)}function Im(e,t){var r;jo(t,["method"]);var n=t.name,i=t.addInitializer;return mi(e)||(e=Sn(e)),(r=this.options_)!=null&&r.bound&&i(function(){var o=this,s=o[n].bind(o);s.isMobXFlow=!0,o[n]=s}),e}function xm(e,t,r,n){var i=t.annotationType_,o=n.value;je(o)||le("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
8
+ '`+i+"' can only be used on properties with a generator function value."))}function wl(e,t,r,n,i,o){o===void 0&&(o=Q.safeDescriptors),xm(e,t,r,n);var s=n.value;if(mi(s)||(s=Sn(s)),i){var a;s=s.bind((a=e.proxy_)!=null?a:e.target_),s.isMobXFlow=!0}return{value:s,configurable:o?e.isPlainObject_:!0,enumerable:!1,writable:!o}}function La(e,t){return{annotationType_:e,options_:t,make_:Sm,extend_:Cm,decorate_20223_:Nm}}function Sm(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function Cm(e,t,r,n){return Rm(e,this,t,r),e.defineComputedProperty_(t,sr({},this.options_,{get:r.get,set:r.set}),n)}function Nm(e,t){jo(t,["getter"]);var r=this,n=t.name,i=t.addInitializer;return i(function(){var o=Bn(this)[be],s=sr({},r.options_,{get:e,context:this});s.name||(s.name=o.name_+"."+n.toString()),o.values_.set(n,new Fr(s))}),function(){return this[be].getObservablePropValue_(n)}}function Rm(e,t,r,n){var i=t.annotationType_,o=n.get;o||le("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
9
+ '`+i+"' can only be used on getter(+setter) properties."))}function Vo(e,t){return{annotationType_:e,options_:t,make_:$m,extend_:Pm,decorate_20223_:Um}}function $m(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function Pm(e,t,r,n){var i,o;return Bm(e,this,t,r),e.defineObservableProperty_(t,r.value,(i=(o=this.options_)==null?void 0:o.enhancer)!=null?i:kr,n)}function Um(e,t){if(t.kind==="field")throw le("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");jo(t,["accessor"]);var r=this,n=t.kind,i=t.name,o=new WeakSet;function s(a,u){var c,l,p=Bn(a)[be],S=new _r(u,(c=(l=r.options_)==null?void 0:l.enhancer)!=null?c:kr,p.name_+"."+i.toString(),!1);p.values_.set(i,S),o.add(a)}if(n=="accessor")return{get:function(){return o.has(this)||s(this,e.get.call(this)),this[be].getObservablePropValue_(i)},set:function(u){return o.has(this)||s(this,u),this[be].setObservablePropValue_(i,u)},init:function(u){return o.has(this)||s(this,u),u}}}function Bm(e,t,r,n){var i=t.annotationType_;"value"in n||le("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
10
+ '`+i+"' cannot be used on getter/setter properties"))}var Dm="true",Mm=Tl();function Tl(e){return{annotationType_:Dm,options_:e,make_:Lm,extend_:km,decorate_20223_:jm}}function Lm(e,t,r,n){var i,o;if(r.get)return Me.make_(e,t,r,n);if(r.set){var s=jr(t.toString(),r.set);return n===e.target_?e.defineProperty_(t,{configurable:Q.safeDescriptors?e.isPlainObject_:!0,set:s})===null?0:2:(Wt(n,t,{configurable:!0,set:s}),2)}if(n!==e.target_&&typeof r.value=="function"){var a;if(pl(r.value)){var u,c=(u=this.options_)!=null&&u.autoBind?Sn.bound:Sn;return c.make_(e,t,r,n)}var l=(a=this.options_)!=null&&a.autoBind?gi.bound:gi;return l.make_(e,t,r,n)}var p=((i=this.options_)==null?void 0:i.deep)===!1?Pe.ref:Pe;if(typeof r.value=="function"&&(o=this.options_)!=null&&o.autoBind){var S;r.value=r.value.bind((S=e.proxy_)!=null?S:e.target_)}return p.make_(e,t,r,n)}function km(e,t,r,n){var i,o;if(r.get)return Me.extend_(e,t,r,n);if(r.set)return e.defineProperty_(t,{configurable:Q.safeDescriptors?e.isPlainObject_:!0,set:jr(t.toString(),r.set)},n);if(typeof r.value=="function"&&(i=this.options_)!=null&&i.autoBind){var s;r.value=r.value.bind((s=e.proxy_)!=null?s:e.target_)}var a=((o=this.options_)==null?void 0:o.deep)===!1?Pe.ref:Pe;return a.extend_(e,t,r,n)}function jm(e,t){le("'"+this.annotationType_+"' cannot be used as a decorator")}var Fm="observable",Vm="observable.ref",zm="observable.shallow",Km="observable.struct",Al={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Al);function _o(e){return e||Al}var Oa=Vo(Fm),qm=Vo(Vm,{enhancer:Fo}),Gm=Vo(zm,{enhancer:mm}),Wm=Vo(Km,{enhancer:bm}),Ol=Ht(Oa);function wo(e){return e.deep===!0?kr:e.deep===!1?Fo:Jm(e.defaultDecorator)}function Hm(e){var t;return e?(t=e.defaultDecorator)!=null?t:Tl(e):void 0}function Jm(e){var t,r;return e&&(t=(r=e.options_)==null?void 0:r.enhancer)!=null?t:kr}function El(e,t,r){if(wi(t))return Oa.decorate_20223_(e,t);if(Lr(t)){Rn(e,t,Oa);return}return Cn(e)?e:jt(e)?Pe.object(e,t,r):Array.isArray(e)?Pe.array(e,t):Nn(e)?Pe.map(e,t):_i(e)?Pe.set(e,t):typeof e=="object"&&e!==null?e:Pe.box(e,t)}ll(El,Ol);var Xm={box:function(t,r){var n=_o(r);return new _r(t,wo(n),n.name,!0,n.equals)},array:function(t,r){var n=_o(r);return(Q.useProxies===!1||n.proxy===!1?Xb:jb)(t,wo(n),n.name)},map:function(t,r){var n=_o(r);return new td(t,wo(n),n.name)},set:function(t,r){var n=_o(r);return new id(t,wo(n),n.name)},object:function(t,r,n){return Hr(function(){return Cb(Q.useProxies===!1||n?.proxy===!1?Bn({},n):Mb({},n),t,r)})},ref:Ht(qm),shallow:Ht(Gm),deep:Ol,struct:Ht(Wm)},Pe=ll(El,Xm),Il="computed",Ym="computed.struct",Ea=La(Il),Qm=La(Ym,{equals:Ge.structural}),Me=function(t,r){if(wi(r))return Ea.decorate_20223_(t,r);if(Lr(r))return Rn(t,r,Ea);if(jt(t))return Ht(La(Il,t));je(t)||le("First argument to `computed` should be an expression."),je(r)&&le("A setter as second argument is no longer supported, use `{ set: fn }` option instead");var n=jt(r)?r:{};return n.get=t,n.name||(n.name=t.name||""),new Fr(n)};Object.assign(Me,Ea);Me.struct=Ht(Qm);var Qf,Zf,Ro=0,Zm=1,eb=(Qf=(Zf=So(function(){},"name"))==null?void 0:Zf.configurable)!=null?Qf:!1,el={value:"action",configurable:!0,writable:!1,enumerable:!1};function jr(e,t,r,n){r===void 0&&(r=!1),je(t)||le("`action` can only be invoked on functions"),(typeof e!="string"||!e)&&le("actions should have valid names, got: '"+e+"'");function i(){return xl(e,r,t,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},eb&&(el.value=e,Wt(i,"name",el)),i}function xl(e,t,r,n,i){var o=tb(e,t,n,i);try{return r.apply(n,i)}catch(s){throw o.error_=s,s}finally{rb(o)}}function tb(e,t,r,n){var i=Xe()&&!!e,o=0;if(i){o=Date.now();var s=n?Array.from(n):Co;dt({type:ja,name:e,object:r,arguments:s})}var a=Q.trackingDerivation,u=!t||!a;At();var c=Q.allowStateChanges;u&&(Kr(),c=zo(!0));var l=ka(!0),p={runAsAction_:u,prevDerivation_:a,prevAllowStateChanges_:c,prevAllowStateReads_:l,notifySpy_:i,startTime_:o,actionId_:Zm++,parentActionId_:Ro};return Ro=p.actionId_,p}function rb(e){Ro!==e.actionId_&&le(30),Ro=e.parentActionId_,e.error_!==void 0&&(Q.suppressReactionErrors=!0),Ko(e.prevAllowStateChanges_),yi(e.prevAllowStateReads_),Ot(),e.runAsAction_&&or(e.prevDerivation_),e.notifySpy_&&pt({time:Date.now()-e.startTime_}),Q.suppressReactionErrors=!1}function nb(e,t){var r=zo(e);try{return t()}finally{Ko(r)}}function zo(e){var t=Q.allowStateChanges;return Q.allowStateChanges=e,t}function Ko(e){Q.allowStateChanges=e}var Sl,ib="create";Sl=Symbol.toPrimitive;var _r=function(e){ml(t,e);function t(n,i,o,s,a){var u;return o===void 0&&(o="ObservableValue@"+St()),s===void 0&&(s=!0),a===void 0&&(a=Ge.default),u=e.call(this,o)||this,u.enhancer=void 0,u.name_=void 0,u.equals=void 0,u.hasUnreportedChange_=!1,u.interceptors_=void 0,u.changeListeners_=void 0,u.value_=void 0,u.dehancer=void 0,u.enhancer=i,u.name_=o,u.equals=a,u.value_=i(n,void 0,o),s&&Xe()&&Vr({type:ib,object:Oo(u),observableKind:"value",debugObjectName:u.name_,newValue:""+u.value_}),u}var r=t.prototype;return r.dehanceValue=function(i){return this.dehancer!==void 0?this.dehancer(i):i},r.set=function(i){var o=this.value_;if(i=this.prepareNewValue_(i),i!==Q.UNCHANGED){var s=Xe();s&&dt({type:Mt,object:this,observableKind:"value",debugObjectName:this.name_,newValue:i,oldValue:o}),this.setNewValue_(i),s&&pt()}},r.prepareNewValue_=function(i){if(Gt(this),wt(this)){var o=Tt(this,{object:this,type:Mt,newValue:i});if(!o)return Q.UNCHANGED;i=o.newValue}return i=this.enhancer(i,this.value_,this.name_),this.equals(this.value_,i)?Q.UNCHANGED:i},r.setNewValue_=function(i){var o=this.value_;this.value_=i,this.reportChanged(),Lt(this)&&kt(this,{type:Mt,object:this,newValue:i,oldValue:o})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(i){return xi(this,i)},r.observe_=function(i,o){return o&&i({observableKind:"value",debugObjectName:this.name_,object:this,type:Mt,newValue:this.value_,oldValue:void 0}),Si(this,i)},r.raw=function(){return this.value_},r.toJSON=function(){return this.get()},r.toString=function(){return this.name_+"["+this.value_+"]"},r.valueOf=function(){return gl(this.get())},r[Sl]=function(){return this.valueOf()},t}(Ti),ob=wr("ObservableValue",_r),Cl;Cl=Symbol.toPrimitive;var Fr=function(){function e(r){this.dependenciesState_=Ie.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.isBeingObserved_=!1,this.isPendingUnobservation_=!1,this.observers_=new Set,this.diffValue_=0,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ie.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new $o(null),this.name_=void 0,this.triggeredBy_=void 0,this.isComputing_=!1,this.isRunningSetter_=!1,this.derivation=void 0,this.setter_=void 0,this.isTracing_=It.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,r.get||le(31),this.derivation=r.get,this.name_=r.name||"ComputedValue@"+St(),r.set&&(this.setter_=jr(this.name_+"-setter",r.set)),this.equals_=r.equals||(r.compareStructural||r.struct?Ge.structural:Ge.default),this.scope_=r.context,this.requiresReaction_=r.requiresReaction,this.keepAlive_=!!r.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){hb(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(n){return n()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(n){return n()})},t.get=function(){if(this.isComputing_&&le(32,this.name_,this.derivation),Q.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)Ia(this)&&(this.warnAboutUntrackedRead_(),At(),this.value_=this.computeValue_(!1),Ot());else if(Ml(this),Ia(this)){var n=Q.trackingContext;this.keepAlive_&&!n&&(Q.trackingContext=this),this.trackAndCompute()&&pb(this),Q.trackingContext=n}var i=this.value_;if(Eo(i))throw i.cause;return i},t.set=function(n){if(this.setter_){this.isRunningSetter_&&le(33,this.name_),this.isRunningSetter_=!0;try{this.setter_.call(this.scope_,n)}finally{this.isRunningSetter_=!1}}else le(34,this.name_)},t.trackAndCompute=function(){var n=this.value_,i=this.dependenciesState_===Ie.NOT_TRACKING_,o=this.computeValue_(!0),s=i||Eo(n)||Eo(o)||!this.equals_(n,o);return s&&(this.value_=o,Xe()&&Vr({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:n,newValue:o})),s},t.computeValue_=function(n){this.isComputing_=!0;var i=zo(!1),o;if(n)o=Rl(this,this.derivation,this.scope_);else if(Q.disableErrorBoundaries===!0)o=this.derivation.call(this.scope_);else try{o=this.derivation.call(this.scope_)}catch(s){o=new $o(s)}return Ko(i),this.isComputing_=!1,o},t.suspend_=function(){this.keepAlive_||(xa(this),this.value_=void 0,this.isTracing_!==It.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' was suspended and it will recompute on the next access."))},t.observe_=function(n,i){var o=this,s=!0,a=void 0;return Ct(function(){var u=o.get();if(!s||i){var c=Kr();n({observableKind:"computed",debugObjectName:o.name_,type:Mt,object:o,newValue:u,oldValue:a}),or(c)}s=!1,a=u})},t.warnAboutUntrackedRead_=function(){this.isTracing_!==It.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute."),(typeof this.requiresReaction_=="boolean"?this.requiresReaction_:Q.computedRequiresReaction)&&console.warn("[mobx] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute.")},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return gl(this.get())},t[Cl]=function(){return this.valueOf()},e}(),Oi=wr("ComputedValue",Fr),Ie;(function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"})(Ie||(Ie={}));var It;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(It||(It={}));var $o=function(t){this.cause=void 0,this.cause=t};function Eo(e){return e instanceof $o}function Ia(e){switch(e.dependenciesState_){case Ie.UP_TO_DATE_:return!1;case Ie.NOT_TRACKING_:case Ie.STALE_:return!0;case Ie.POSSIBLY_STALE_:{for(var t=ka(!0),r=Kr(),n=e.observing_,i=n.length,o=0;o<i;o++){var s=n[o];if(Oi(s)){if(Q.disableErrorBoundaries)s.get();else try{s.get()}catch{return or(r),yi(t),!0}if(e.dependenciesState_===Ie.STALE_)return or(r),yi(t),!0}}return $l(e),or(r),yi(t),!1}}}function Nl(){return Q.trackingDerivation!==null}function Gt(e){var t=e.observers_.size>0;!Q.allowStateChanges&&(t||Q.enforceActions==="always")&&console.warn("[MobX] "+(Q.enforceActions?"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: ":"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ")+e.name_)}function sb(e){!Q.allowStateReads&&Q.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}function Rl(e,t,r){var n=ka(!0);$l(e),e.newObserving_=new Array(e.observing_.length+100),e.unboundDepsCount_=0,e.runId_=++Q.runId;var i=Q.trackingDerivation;Q.trackingDerivation=e,Q.inBatch++;var o;if(Q.disableErrorBoundaries===!0)o=t.call(r);else try{o=t.call(r)}catch(s){o=new $o(s)}return Q.inBatch--,Q.trackingDerivation=i,ub(e),ab(e),yi(n),o}function ab(e){e.observing_.length===0&&(typeof e.requiresObservable_=="boolean"?e.requiresObservable_:Q.reactionRequiresObservable)&&console.warn("[mobx] Derivation '"+e.name_+"' is created/updated without reading any observable value.")}function ub(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=Ie.UP_TO_DATE_,i=0,o=e.unboundDepsCount_,s=0;s<o;s++){var a=r[s];a.diffValue_===0&&(a.diffValue_=1,i!==s&&(r[i]=a),i++),a.dependenciesState_>n&&(n=a.dependenciesState_)}for(r.length=i,e.newObserving_=null,o=t.length;o--;){var u=t[o];u.diffValue_===0&&Bl(u,e),u.diffValue_=0}for(;i--;){var c=r[i];c.diffValue_===1&&(c.diffValue_=0,db(c,e))}n!==Ie.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}function xa(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)Bl(t[r],e);e.dependenciesState_=Ie.NOT_TRACKING_}function Re(e){var t=Kr();try{return e()}finally{or(t)}}function Kr(){var e=Q.trackingDerivation;return Q.trackingDerivation=null,e}function or(e){Q.trackingDerivation=e}function ka(e){var t=Q.allowStateReads;return Q.allowStateReads=e,t}function yi(e){Q.allowStateReads=e}function $l(e){if(e.dependenciesState_!==Ie.UP_TO_DATE_){e.dependenciesState_=Ie.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ie.UP_TO_DATE_}}var Io=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},xo=!0,Pl=!1,Q=function(){var e=Pa();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(xo=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new Io().version&&(xo=!1),xo?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Io):(setTimeout(function(){Pl||le(35)},1),new Io)}();function cb(){if((Q.pendingReactions.length||Q.inBatch||Q.isRunningReactions)&&le(36),Pl=!0,xo){var e=Pa();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),Q=new Io}}function Ul(){return Q}function fb(e){return e.observers_&&e.observers_.size>0}function lb(e){return e.observers_}function db(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Bl(e,t){e.observers_.delete(t),e.observers_.size===0&&Dl(e)}function Dl(e){e.isPendingUnobservation_===!1&&(e.isPendingUnobservation_=!0,Q.pendingUnobservations.push(e))}function At(){Q.inBatch++}function Ot(){if(--Q.inBatch===0){Fl();for(var e=Q.pendingUnobservations,t=0;t<e.length;t++){var r=e[t];r.isPendingUnobservation_=!1,r.observers_.size===0&&(r.isBeingObserved_&&(r.isBeingObserved_=!1,r.onBUO()),r instanceof Fr&&r.suspend_())}Q.pendingUnobservations=[]}}function Ml(e){sb(e);var t=Q.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved_&&Q.trackingContext&&(e.isBeingObserved_=!0,e.onBO())),e.isBeingObserved_):(e.observers_.size===0&&Q.inBatch>0&&Dl(e),!1)}function Ll(e){e.lowestObserverState_!==Ie.STALE_&&(e.lowestObserverState_=Ie.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ie.UP_TO_DATE_&&(t.isTracing_!==It.NONE&&kl(t,e),t.onBecomeStale_()),t.dependenciesState_=Ie.STALE_}))}function pb(e){e.lowestObserverState_!==Ie.STALE_&&(e.lowestObserverState_=Ie.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ie.POSSIBLY_STALE_?(t.dependenciesState_=Ie.STALE_,t.isTracing_!==It.NONE&&kl(t,e)):t.dependenciesState_===Ie.UP_TO_DATE_&&(e.lowestObserverState_=Ie.UP_TO_DATE_)}))}function hb(e){e.lowestObserverState_===Ie.UP_TO_DATE_&&(e.lowestObserverState_=Ie.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ie.UP_TO_DATE_&&(t.dependenciesState_=Ie.POSSIBLY_STALE_,t.onBecomeStale_())}))}function kl(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===It.BREAK){var r=[];jl(Ei(e),r,1),new Function(`debugger;
11
11
  /*
12
12
  Tracing '`+e.name_+`'
13
13
 
@@ -22,12 +22,12 @@ The dependencies for this derivation are:
22
22
  `+r.join(`
23
23
  `)+`
24
24
  */
25
- `)()}}function jl(e,t,r){if(t.length>=1e3){t.push("(and many more)");return}t.push(""+" ".repeat(r-1)+e.name),e.dependencies&&e.dependencies.forEach(function(n){return jl(n,t,r+1)})}var xn=function(){function e(r,n,i,o){r===void 0&&(r="Reaction@"+St()),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ie.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=It.NONE,this.name_=r,this.onInvalidate_=n,this.errorHandler_=i,this.requiresObservable_=o}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,Q.pendingReactions.push(this),Fl())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){At(),this.isScheduled_=!1;var n=Q.trackingContext;if(Q.trackingContext=this,Ia(this)){this.isTrackPending_=!0;try{this.onInvalidate_(),this.isTrackPending_&&Xe()&&Vr({name:this.name_,type:"scheduled-reaction"})}catch(i){this.reportExceptionInDerivation_(i)}}Q.trackingContext=n,Ot()}},t.track=function(n){if(!this.isDisposed_){At();var i=Xe(),o;i&&(o=Date.now(),dt({name:this.name_,type:"reaction"})),this.isRunning_=!0;var s=Q.trackingContext;Q.trackingContext=this;var a=Rl(this,n,void 0);Q.trackingContext=s,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&xa(this),Oo(a)&&this.reportExceptionInDerivation_(a.cause),i&&pt({time:Date.now()-o}),Ot()}},t.reportExceptionInDerivation_=function(n){var i=this;if(this.errorHandler_){this.errorHandler_(n,this);return}if(Q.disableErrorBoundaries)throw n;var o="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";Q.suppressReactionErrors?console.warn("[mobx] (error in reaction '"+this.name_+"' suppressed, fix error of causing action below)"):console.error(o,n),Xe()&&Vr({type:"error",name:this.name_,message:o,error:""+n}),Q.globalReactionErrorHandlers.forEach(function(s){return s(n,i)})},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(At(),xa(this),Ot()))},t.getDisposer_=function(n){var i=this,o=function s(){i.dispose(),n==null||n.removeEventListener==null||n.removeEventListener("abort",s)};return n==null||n.addEventListener==null||n.addEventListener("abort",o),o[be]=this,o},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(n){n===void 0&&(n=!1),Fa(this,n)},e}();var tl=100,Sa=function(t){return t()};function Fl(){Q.inBatch>0||Q.isRunningReactions||Sa(yb)}function yb(){Q.isRunningReactions=!0;for(var e=Q.pendingReactions,t=0;e.length>0;){++t===tl&&(console.error("Reaction doesn't converge to a stable state after "+tl+" iterations."+(" Probably there is a cycle in the reactive function: "+e[0])),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n<i;n++)r[n].runReaction_()}Q.isRunningReactions=!1}var $o=wr("Reaction",xn);function gb(e){var t=Sa;Sa=function(n){return e(function(){return t(n)})}}function Xe(){return!!Q.spyListeners.length}function Vr(e){if(Q.spyListeners.length)for(var t=Q.spyListeners,r=0,n=t.length;r<n;r++)t[r](e)}function dt(e){var t=sr({},e,{spyReportStart:!0});Vr(t)}var mb={type:"report-end",spyReportEnd:!0};function pt(e){Vr(e?sr({},e,{type:"report-end",spyReportEnd:!0}):mb)}function bb(e){return Q.spyListeners.push(e),Ba(function(){Q.spyListeners=Q.spyListeners.filter(function(t){return t!==e})})}var ja="action",vb="action.bound",Vl="autoAction",_b="autoAction.bound",zl="<unnamed action>",Ca=Ai(ja),wb=Ai(vb,{bound:!0}),Na=Ai(Vl,{autoAction:!0}),Tb=Ai(_b,{autoAction:!0,bound:!0});function Kl(e){var t=function(n,i){if(je(n))return jr(n.name||zl,n,e);if(je(i))return jr(n,i,e);if(wi(i))return(e?Na:Ca).decorate_20223_(n,i);if(Lr(i))return Rn(n,i,e?Na:Ca);if(Lr(n))return Ht(Ai(e?Vl:ja,{name:n,autoAction:e}));le("Invalid arguments for `action`")};return t}var st=Kl(!1);Object.assign(st,Ca);var gi=Kl(!0);Object.assign(gi,Na);st.bound=Ht(wb);gi.bound=Ht(Tb);function $n(e){return xl(e.name||zl,!1,e,this,void 0)}function qr(e){return je(e)&&e.isMobxAction===!0}function Ct(e,t){var r,n,i,o,s;t===void 0&&(t=Ua),je(e)||le("Autorun expects a function as first argument"),qr(e)&&le("Autorun does not accept actions since actions are untrackable");var a=(r=(n=t)==null?void 0:n.name)!=null?r:e.name||"Autorun@"+St(),u=!t.scheduler&&!t.delay,c;if(u)c=new xn(a,function(){this.track(S)},t.onError,t.requiresObservable);else{var l=ql(t),p=!1;c=new xn(a,function(){p||(p=!0,l(function(){p=!1,c.isDisposed_||c.track(S)}))},t.onError,t.requiresObservable)}function S(){e(c)}return(i=t)!=null&&(o=i.signal)!=null&&o.aborted||c.schedule_(),c.getDisposer_((s=t)==null?void 0:s.signal)}var Ab=function(t){return t()};function ql(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Ab}function Gl(e,t,r){var n,i,o,s;r===void 0&&(r=Ua),(!je(e)||!je(t))&&le("First and second argument to reaction should be functions"),jt(r)||le("Third argument of reactions should be an object");var a=(n=r.name)!=null?n:"Reaction@"+St(),u=st(a,r.onError?Ob(r.onError,t):t),c=!r.scheduler&&!r.delay,l=ql(r),p=!0,S=!1,x,E,z=r.compareStructural?Ge.structural:r.equals||Ge.default,W=new xn(a,function(){p||c?T():S||(S=!0,l(T))},r.onError,r.requiresObservable);function T(){if(S=!1,!W.isDisposed_){var k=!1;W.track(function(){var G=nb(!1,function(){return e(W)});k=p||!z(x,G),E=x,x=G}),(p&&r.fireImmediately||!p&&k)&&u(x,E,W),p=!1}}return(i=r)!=null&&(o=i.signal)!=null&&o.aborted||W.schedule_(),W.getDisposer_((s=r)==null?void 0:s.signal)}function Ob(e,t){return function(){try{return t.apply(this,arguments)}catch(r){e.call(this,r)}}}var Eb="onBO",Ib="onBUO";function Pn(e,t,r){return Wl(Eb,e,t,r)}function Gr(e,t,r){return Wl(Ib,e,t,r)}function Wl(e,t,r,n){var i=typeof n=="function"?xt(t,r):xt(t),o=je(n)?n:r,s=e+"L";return i[s]?i[s].add(o):i[s]=new Set([o]),function(){var a=i[s];a&&(a.delete(o),a.size===0&&delete i[s])}}var xb="never",wo="always",Sb="observed";function Hl(e){e.isolateGlobalState===!0&&cb();var t=e.useProxies,r=e.enforceActions;if(t!==void 0&&(Q.useProxies=t===wo?!0:t===xb?!1:typeof Proxy<"u"),t==="ifavailable"&&(Q.verifyProxies=!0),r!==void 0){var n=r===wo?wo:r===Sb;Q.enforceActions=n,Q.allowStateChanges=!(n===!0||n===wo)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in e&&(Q[i]=!!e[i])}),Q.allowStateReads=!Q.observableRequiresReaction,Q.disableErrorBoundaries===!0&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),e.reactionScheduler&&gb(e.reactionScheduler)}function Cb(e,t,r,n){arguments.length>4&&le("'extendObservable' expected 2-4 arguments"),typeof e!="object"&&le("'extendObservable' expects an object as first argument"),Jt(e)&&le("'extendObservable' should not be used on maps, use map.merge instead"),jt(t)||le("'extendObservable' only accepts plain objects as second argument"),(Cn(t)||Cn(r))&&le("Extending an object with another observable (object) is not supported");var i=am(t);return Hr(function(){var o=Bn(e,n)[be];Lo(i).forEach(function(s){o.extend_(s,i[s],r&&s in r?r[s]:!0)})}),e}function Ei(e,t){return Jl(xt(e,t))}function Jl(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=Nb(e.observing_).map(Jl)),t}function Ii(e,t){return Xl(xt(e,t))}function Xl(e){var t={name:e.name_};return fb(e)&&(t.observers=Array.from(lb(e)).map(Xl)),t}function Nb(e){return Array.from(new Set(e))}var Rb=0;function Yl(){this.message="FLOW_CANCELLED"}Yl.prototype=Object.create(Error.prototype);var _a=_l("flow"),$b=_l("flow.bound",{bound:!0}),Sn=Object.assign(function(t,r){if(wi(r))return _a.decorate_20223_(t,r);if(Lr(r))return Rn(t,r,_a);arguments.length!==1&&le("Flow expects single argument with generator function");var n=t,i=n.name||"<unnamed flow>",o=function(){var a=this,u=arguments,c=++Rb,l=st(i+" - runid: "+c+" - init",n).apply(a,u),p,S=void 0,x=new Promise(function(E,z){var W=0;p=z;function T(H){S=void 0;var F;try{F=st(i+" - runid: "+c+" - yield "+W++,l.next).call(l,H)}catch(Y){return z(Y)}G(F)}function k(H){S=void 0;var F;try{F=st(i+" - runid: "+c+" - yield "+W++,l.throw).call(l,H)}catch(Y){return z(Y)}G(F)}function G(H){if(je(H?.then)){H.then(G,z);return}return H.done?E(H.value):(S=Promise.resolve(H.value),S.then(T,k))}T(void 0)});return x.cancel=st(i+" - runid: "+c+" - cancel",function(){try{S&&rl(S);var E=l.return(void 0),z=Promise.resolve(E.value);z.then(En,En),rl(z),p(new Yl)}catch(W){p(W)}}),x};return o.isMobXFlow=!0,o},_a);Sn.bound=Ht($b);function rl(e){je(e.cancel)&&e.cancel()}function mi(e){return e?.isMobXFlow===!0}function Pb(e,t){return e?t!==void 0?Jt(e)||Un(e)?le("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead."):zr(e)?e[be].values_.has(t):!1:zr(e)||!!e[be]||Ma(e)||$o(e)||Oi(e):!1}function Cn(e){return arguments.length!==1&&le("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),Pb(e)}function Ub(e){if(zr(e))return e[be].ownKeys_();le(38)}function To(e,t,r){return e.set(t,r),r}function On(e,t){if(e==null||typeof e!="object"||e instanceof Date||!Cn(e))return e;if(ob(e)||Oi(e))return On(e.get(),t);if(t.has(e))return t.get(e);if(Un(e)){var r=To(t,e,new Array(e.length));return e.forEach(function(s,a){r[a]=On(s,t)}),r}if(Wr(e)){var n=To(t,e,new Set);return e.forEach(function(s){n.add(On(s,t))}),n}if(Jt(e)){var i=To(t,e,new Map);return e.forEach(function(s,a){i.set(a,On(s,t))}),i}else{var o=To(t,e,{});return Ub(e).forEach(function(s){vi.propertyIsEnumerable.call(e,s)&&(o[s]=On(e[s],t))}),o}}function ar(e,t){return t&&le("toJS no longer supports options"),On(e,new Map)}function Fa(){for(var e=!1,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];typeof r[r.length-1]=="boolean"&&(e=r.pop());var i=Bb(r);if(!i)return le("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");i.isTracing_===It.NONE&&console.log("[mobx.trace] '"+i.name_+"' tracing enabled"),i.isTracing_=e?It.BREAK:It.LOG}function Bb(e){switch(e.length){case 0:return Q.trackingDerivation;case 1:return xt(e[0]);case 2:return xt(e[0],e[1])}}function ir(e,t){t===void 0&&(t=void 0),At();try{return e.apply(t)}finally{Ot()}}function Mr(e){return e[be]}var Db={has:function(t,r){return Q.trackingDerivation&&hi("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),Mr(t).has_(r)},get:function(t,r){return Mr(t).get_(r)},set:function(t,r,n){var i;return Lr(r)?(Mr(t).values_.has(r)||hi("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),(i=Mr(t).set_(r,n,!0))!=null?i:!0):!1},deleteProperty:function(t,r){var n;return hi("delete properties from an observable object. Use 'remove' from 'mobx' instead."),Lr(r)?(n=Mr(t).delete_(r,!0))!=null?n:!0:!1},defineProperty:function(t,r,n){var i;return hi("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),(i=Mr(t).defineProperty_(r,n))!=null?i:!0},ownKeys:function(t){return Q.trackingDerivation&&hi("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),Mr(t).ownKeys_()},preventExtensions:function(t){le(13)}};function Mb(e,t){var r,n;return dl(),e=Bn(e,t),(n=(r=e[be]).proxy_)!=null?n:r.proxy_=new Proxy(e,Db)}function wt(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function xi(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),Ba(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function Tt(e,t){var r=Kr();try{for(var n=[].concat(e.interceptors_||[]),i=0,o=n.length;i<o&&(t=n[i](t),t&&!t.type&&le(14),!!t);i++);return t}finally{or(r)}}function Lt(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function Si(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),Ba(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function kt(e,t){var r=Kr(),n=e.changeListeners_;if(n){n=n.slice();for(var i=0,o=n.length;i<o;i++)n[i](t);or(r)}}function Tr(e,t,r){return Hr(function(){var n,i=Bn(e,r)[be];t&&e[ot]&&le("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),(n=t)!=null||(t=dm(e)),Lo(t).forEach(function(o){return i.make_(o,t[o])})}),e}var nl="splice",Mt="update",Lb=1e4,kb={get:function(t,r){var n=t[be];return r===be?n:r==="length"?n.getArrayLength_():typeof r=="string"&&!isNaN(r)?n.get_(parseInt(r)):Et(Po,r)?Po[r]:t[r]},set:function(t,r,n){var i=t[be];return r==="length"&&i.setArrayLength_(n),typeof r=="symbol"||isNaN(r)?t[r]=n:i.set_(parseInt(r),n),!0},preventExtensions:function(){le(15)}},Va=function(){function e(r,n,i,o){r===void 0&&(r="ObservableArray@"+St()),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=i,this.legacyMode_=o,this.atom_=new Ti(r),this.enhancer_=function(s,a){return n(s,a,r+"[..]")}}var t=e.prototype;return t.dehanceValue_=function(n){return this.dehancer!==void 0?this.dehancer(n):n},t.dehanceValues_=function(n){return this.dehancer!==void 0&&n.length>0?n.map(this.dehancer):n},t.intercept_=function(n){return xi(this,n)},t.observe_=function(n,i){return i===void 0&&(i=!1),i&&n({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),Si(this,n)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(n){(typeof n!="number"||isNaN(n)||n<0)&&le("Out of range: "+n);var i=this.values_.length;if(n!==i)if(n>i){for(var o=new Array(n-i),s=0;s<n-i;s++)o[s]=void 0;this.spliceWithArray_(i,0,o)}else this.spliceWithArray_(n,i-n)},t.updateArrayLength_=function(n,i){n!==this.lastKnownLength_&&le(16),this.lastKnownLength_+=i,this.legacyMode_&&i>0&&ad(n+i+1)},t.spliceWithArray_=function(n,i,o){var s=this;Gt(this.atom_);var a=this.values_.length;if(n===void 0?n=0:n>a?n=a:n<0&&(n=Math.max(0,a+n)),arguments.length===1?i=a-n:i==null?i=0:i=Math.max(0,Math.min(i,a-n)),o===void 0&&(o=So),wt(this)){var u=Tt(this,{object:this.proxy_,type:nl,index:n,removedCount:i,added:o});if(!u)return So;i=u.removedCount,o=u.added}o=o.length===0?o:o.map(function(p){return s.enhancer_(p,void 0)}),this.legacyMode_;var c=o.length-i;this.updateArrayLength_(a,c);var l=this.spliceItemsIntoValues_(n,i,o);return(i!==0||o.length!==0)&&this.notifyArraySplice_(n,o,l),this.dehanceValues_(l)},t.spliceItemsIntoValues_=function(n,i,o){if(o.length<Lb){var s;return(s=this.values_).splice.apply(s,[n,i].concat(o))}else{var a=this.values_.slice(n,n+i),u=this.values_.slice(n+i);this.values_.length+=o.length-i;for(var c=0;c<o.length;c++)this.values_[n+c]=o[c];for(var l=0;l<u.length;l++)this.values_[n+o.length+l]=u[l];return a}},t.notifyArrayChildUpdate_=function(n,i,o){var s=!this.owned_&&Xe(),a=Lt(this),u=a||s?{observableKind:"array",object:this.proxy_,type:Mt,debugObjectName:this.atom_.name_,index:n,newValue:i,oldValue:o}:null;s&&dt(u),this.atom_.reportChanged(),a&&kt(this,u),s&&pt()},t.notifyArraySplice_=function(n,i,o){var s=!this.owned_&&Xe(),a=Lt(this),u=a||s?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:nl,index:n,removed:o,added:i,removedCount:o.length,addedCount:i.length}:null;s&&dt(u),this.atom_.reportChanged(),a&&kt(this,u),s&&pt()},t.get_=function(n){if(this.legacyMode_&&n>=this.values_.length){console.warn("[mobx.array] Attempt to read an array index ("+n+") that is out of bounds ("+this.values_.length+"). Please check length first. Out of bound indices will not be tracked by MobX");return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[n])},t.set_=function(n,i){var o=this.values_;if(this.legacyMode_&&n>o.length&&le(17,n,o.length),n<o.length){Gt(this.atom_);var s=o[n];if(wt(this)){var a=Tt(this,{type:Mt,object:this.proxy_,index:n,newValue:i});if(!a)return;i=a.newValue}i=this.enhancer_(i,s);var u=i!==s;u&&(o[n]=i,this.notifyArrayChildUpdate_(n,i,s))}else{for(var c=new Array(n+1-o.length),l=0;l<c.length-1;l++)c[l]=void 0;c[c.length-1]=i,this.spliceWithArray_(o.length,0,c)}},e}();function jb(e,t,r,n){return r===void 0&&(r="ObservableArray@"+St()),n===void 0&&(n=!1),dl(),Hr(function(){var i=new Va(r,t,n,!1);hl(i.values_,be,i);var o=new Proxy(i.values_,kb);return i.proxy_=o,e&&e.length&&i.spliceWithArray_(0,0,e),o})}var Po={clear:function(){return this.splice(0)},replace:function(t){var r=this[be];return r.spliceWithArray_(0,r.values_.length,t)},toJSON:function(){return this.slice()},splice:function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var s=this[be];switch(arguments.length){case 0:return[];case 1:return s.spliceWithArray_(t);case 2:return s.spliceWithArray_(t,r)}return s.spliceWithArray_(t,r,i)},spliceWithArray:function(t,r,n){return this[be].spliceWithArray_(t,r,n)},push:function(){for(var t=this[be],r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return t.spliceWithArray_(t.values_.length,0,n),t.values_.length},pop:function(){return this.splice(Math.max(this[be].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[be],r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return t.spliceWithArray_(0,0,n),t.values_.length},reverse:function(){return Q.trackingDerivation&&le(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Q.trackingDerivation&&le(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var r=this[be],n=r.dehanceValues_(r.values_).indexOf(t);return n>-1?(this.splice(n,1),!0):!1}};Ue("at",ht);Ue("concat",ht);Ue("flat",ht);Ue("includes",ht);Ue("indexOf",ht);Ue("join",ht);Ue("lastIndexOf",ht);Ue("slice",ht);Ue("toString",ht);Ue("toLocaleString",ht);Ue("toSorted",ht);Ue("toSpliced",ht);Ue("with",ht);Ue("every",Ft);Ue("filter",Ft);Ue("find",Ft);Ue("findIndex",Ft);Ue("findLast",Ft);Ue("findLastIndex",Ft);Ue("flatMap",Ft);Ue("forEach",Ft);Ue("map",Ft);Ue("some",Ft);Ue("toReversed",Ft);Ue("reduce",Ql);Ue("reduceRight",Ql);function Ue(e,t){typeof Array.prototype[e]=="function"&&(Po[e]=t(e))}function ht(e){return function(){var t=this[be];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function Ft(e){return function(t,r){var n=this,i=this[be];i.atom_.reportObserved();var o=i.dehanceValues_(i.values_);return o[e](function(s,a){return t.call(r,s,a,n)})}}function Ql(e){return function(){var t=this,r=this[be];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(o,s,a){return i(o,s,a,t)},n[e].apply(n,arguments)}}var Fb=wr("ObservableArrayAdministration",Va);function Un(e){return Do(e)&&Fb(e[be])}var Zl,ed,Vb={},vr="add",Uo="delete";Zl=Symbol.iterator;ed=Symbol.toStringTag;var td=function(){function e(r,n,i){var o=this;n===void 0&&(n=kr),i===void 0&&(i="ObservableMap@"+St()),this.enhancer_=void 0,this.name_=void 0,this[be]=Vb,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=i,je(Map)||le(18),Hr(function(){o.keysAtom_=bl(o.name_+".keys()"),o.data_=new Map,o.hasMap_=new Map,r&&o.merge(r)})}var t=e.prototype;return t.has_=function(n){return this.data_.has(n)},t.has=function(n){var i=this;if(!Q.trackingDerivation)return this.has_(n);var o=this.hasMap_.get(n);if(!o){var s=o=new _r(this.has_(n),jo,this.name_+"."+Ta(n)+"?",!1);this.hasMap_.set(n,s),Gr(s,function(){return i.hasMap_.delete(n)})}return o.get()},t.set=function(n,i){var o=this.has_(n);if(wt(this)){var s=Tt(this,{type:o?Mt:vr,object:this,newValue:i,name:n});if(!s)return this;i=s.newValue}return o?this.updateValue_(n,i):this.addValue_(n,i),this},t.delete=function(n){var i=this;if(Gt(this.keysAtom_),wt(this)){var o=Tt(this,{type:Uo,object:this,name:n});if(!o)return!1}if(this.has_(n)){var s=Xe(),a=Lt(this),u=a||s?{observableKind:"map",debugObjectName:this.name_,type:Uo,object:this,oldValue:this.data_.get(n).value_,name:n}:null;return s&&dt(u),ir(function(){var c;i.keysAtom_.reportChanged(),(c=i.hasMap_.get(n))==null||c.setNewValue_(!1);var l=i.data_.get(n);l.setNewValue_(void 0),i.data_.delete(n)}),a&&kt(this,u),s&&pt(),!0}return!1},t.updateValue_=function(n,i){var o=this.data_.get(n);if(i=o.prepareNewValue_(i),i!==Q.UNCHANGED){var s=Xe(),a=Lt(this),u=a||s?{observableKind:"map",debugObjectName:this.name_,type:Mt,object:this,oldValue:o.value_,name:n,newValue:i}:null;s&&dt(u),o.setNewValue_(i),a&&kt(this,u),s&&pt()}},t.addValue_=function(n,i){var o=this;Gt(this.keysAtom_),ir(function(){var c,l=new _r(i,o.enhancer_,o.name_+"."+Ta(n),!1);o.data_.set(n,l),i=l.value_,(c=o.hasMap_.get(n))==null||c.setNewValue_(!0),o.keysAtom_.reportChanged()});var s=Xe(),a=Lt(this),u=a||s?{observableKind:"map",debugObjectName:this.name_,type:vr,object:this,name:n,newValue:i}:null;s&&dt(u),a&&kt(this,u),s&&pt()},t.get=function(n){return this.has(n)?this.dehanceValue_(this.data_.get(n).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(n){return this.dehancer!==void 0?this.dehancer(n):n},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var n=this,i=this.keys();return bi({next:function(){var s=i.next(),a=s.done,u=s.value;return{done:a,value:a?void 0:n.get(u)}}})},t.entries=function(){var n=this,i=this.keys();return bi({next:function(){var s=i.next(),a=s.done,u=s.value;return{done:a,value:a?void 0:[u,n.get(u)]}}})},t[Zl]=function(){return this.entries()},t.forEach=function(n,i){for(var o=In(this),s;!(s=o()).done;){var a=s.value,u=a[0],c=a[1];n.call(i,c,u,this)}},t.merge=function(n){var i=this;return Jt(n)&&(n=new Map(n)),ir(function(){jt(n)?sm(n).forEach(function(o){return i.set(o,n[o])}):Array.isArray(n)?n.forEach(function(o){var s=o[0],a=o[1];return i.set(s,a)}):Nn(n)?(n.constructor!==Map&&le(19,n),n.forEach(function(o,s){return i.set(s,o)})):n!=null&&le(20,n)}),this},t.clear=function(){var n=this;ir(function(){Re(function(){for(var i=In(n.keys()),o;!(o=i()).done;){var s=o.value;n.delete(s)}})})},t.replace=function(n){var i=this;return ir(function(){for(var o=zb(n),s=new Map,a=!1,u=In(i.data_.keys()),c;!(c=u()).done;){var l=c.value;if(!o.has(l)){var p=i.delete(l);if(p)a=!0;else{var S=i.data_.get(l);s.set(l,S)}}}for(var x=In(o.entries()),E;!(E=x()).done;){var z=E.value,W=z[0],T=z[1],k=i.data_.has(W);if(i.set(W,T),i.data_.has(W)){var G=i.data_.get(W);s.set(W,G),k||(a=!0)}}if(!a)if(i.data_.size!==s.size)i.keysAtom_.reportChanged();else for(var H=i.data_.keys(),F=s.keys(),Y=H.next(),V=F.next();!Y.done;){if(Y.value!==V.value){i.keysAtom_.reportChanged();break}Y=H.next(),V=F.next()}i.data_=s}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(n,i){return i===!0&&le("`observe` doesn't support fireImmediately=true in combination with maps."),Si(this,n)},t.intercept_=function(n){return xi(this,n)},Da(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:ed,get:function(){return"Map"}}]),e}(),Jt=wr("ObservableMap",td);function zb(e){if(Nn(e)||Jt(e))return e;if(Array.isArray(e))return new Map(e);if(jt(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}else return le(21,e)}var rd,nd,Kb={};rd=Symbol.iterator;nd=Symbol.toStringTag;var id=function(){function e(r,n,i){var o=this;n===void 0&&(n=kr),i===void 0&&(i="ObservableSet@"+St()),this.name_=void 0,this[be]=Kb,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=i,je(Set)||le(22),this.enhancer_=function(s,a){return n(s,a,i)},Hr(function(){o.atom_=bl(o.name_),r&&o.replace(r)})}var t=e.prototype;return t.dehanceValue_=function(n){return this.dehancer!==void 0?this.dehancer(n):n},t.clear=function(){var n=this;ir(function(){Re(function(){for(var i=In(n.data_.values()),o;!(o=i()).done;){var s=o.value;n.delete(s)}})})},t.forEach=function(n,i){for(var o=In(this),s;!(s=o()).done;){var a=s.value;n.call(i,a,a,this)}},t.add=function(n){var i=this;if(Gt(this.atom_),wt(this)){var o=Tt(this,{type:vr,object:this,newValue:n});if(!o)return this}if(!this.has(n)){ir(function(){i.data_.add(i.enhancer_(n,void 0)),i.atom_.reportChanged()});var s=Xe(),a=Lt(this),u=a||s?{observableKind:"set",debugObjectName:this.name_,type:vr,object:this,newValue:n}:null;s&&dt(u),a&&kt(this,u),s&&pt()}return this},t.delete=function(n){var i=this;if(wt(this)){var o=Tt(this,{type:Uo,object:this,oldValue:n});if(!o)return!1}if(this.has(n)){var s=Xe(),a=Lt(this),u=a||s?{observableKind:"set",debugObjectName:this.name_,type:Uo,object:this,oldValue:n}:null;return s&&dt(u),ir(function(){i.atom_.reportChanged(),i.data_.delete(n)}),a&&kt(this,u),s&&pt(),!0}return!1},t.has=function(n){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(n))},t.entries=function(){var n=0,i=Array.from(this.keys()),o=Array.from(this.values());return bi({next:function(){var a=n;return n+=1,a<o.length?{value:[i[a],o[a]],done:!1}:{done:!0}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var n=this,i=0,o=Array.from(this.data_.values());return bi({next:function(){return i<o.length?{value:n.dehanceValue_(o[i++]),done:!1}:{done:!0}}})},t.replace=function(n){var i=this;return Wr(n)&&(n=new Set(n)),ir(function(){Array.isArray(n)?(i.clear(),n.forEach(function(o){return i.add(o)})):_i(n)?(i.clear(),n.forEach(function(o){return i.add(o)})):n!=null&&le("Cannot initialize set from "+n)}),this},t.observe_=function(n,i){return i===!0&&le("`observe` doesn't support fireImmediately=true in combination with sets."),Si(this,n)},t.intercept_=function(n){return xi(this,n)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[rd]=function(){return this.values()},Da(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:nd,get:function(){return"Set"}}]),e}(),Wr=wr("ObservableSet",id),il=Object.create(null),ol="remove",Ra=function(){function e(r,n,i,o){n===void 0&&(n=new Map),o===void 0&&(o=Mm),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=r,this.values_=n,this.name_=i,this.defaultAnnotation_=o,this.keysAtom_=new Ti(this.name_+".keys"),this.isPlainObject_=jt(this.target_),ud(this.defaultAnnotation_)||le("defaultAnnotation must be valid annotation"),this.appliedAnnotations_={}}var t=e.prototype;return t.getObservablePropValue_=function(n){return this.values_.get(n).get()},t.setObservablePropValue_=function(n,i){var o=this.values_.get(n);if(o instanceof Fr)return o.set(i),!0;if(wt(this)){var s=Tt(this,{type:Mt,object:this.proxy_||this.target_,name:n,newValue:i});if(!s)return null;i=s.newValue}if(i=o.prepareNewValue_(i),i!==Q.UNCHANGED){var a=Lt(this),u=Xe(),c=a||u?{type:Mt,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:o.value_,name:n,newValue:i}:null;u&&dt(c),o.setNewValue_(i),a&&kt(this,c),u&&pt()}return!0},t.get_=function(n){return Q.trackingDerivation&&!Et(this.target_,n)&&this.has_(n),this.target_[n]},t.set_=function(n,i,o){return o===void 0&&(o=!1),Et(this.target_,n)?this.values_.has(n)?this.setObservablePropValue_(n,i):o?Reflect.set(this.target_,n,i):(this.target_[n]=i,!0):this.extend_(n,{value:i,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,o)},t.has_=function(n){if(!Q.trackingDerivation)return n in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var i=this.pendingKeys_.get(n);return i||(i=new _r(n in this.target_,jo,this.name_+"."+Ta(n)+"?",!1),this.pendingKeys_.set(n,i)),i.get()},t.make_=function(n,i){if(i===!0&&(i=this.defaultAnnotation_),i!==!1){if(ul(this,i,n),!(n in this.target_)){var o;if((o=this.target_[ot])!=null&&o[n])return;le(1,i.annotationType_,this.name_+"."+n.toString())}for(var s=this.target_;s&&s!==vi;){var a=xo(s,n);if(a){var u=i.make_(this,n,a,s);if(u===0)return;if(u===1)break}s=Object.getPrototypeOf(s)}al(this,i,n)}},t.extend_=function(n,i,o,s){if(s===void 0&&(s=!1),o===!0&&(o=this.defaultAnnotation_),o===!1)return this.defineProperty_(n,i,s);ul(this,o,n);var a=o.extend_(this,n,i,s);return a&&al(this,o,n),a},t.defineProperty_=function(n,i,o){o===void 0&&(o=!1),Gt(this.keysAtom_);try{At();var s=this.delete_(n);if(!s)return s;if(wt(this)){var a=Tt(this,{object:this.proxy_||this.target_,name:n,type:vr,newValue:i.value});if(!a)return null;var u=a.newValue;i.value!==u&&(i=sr({},i,{value:u}))}if(o){if(!Reflect.defineProperty(this.target_,n,i))return!1}else Wt(this.target_,n,i);this.notifyPropertyAddition_(n,i.value)}finally{Ot()}return!0},t.defineObservableProperty_=function(n,i,o,s){s===void 0&&(s=!1),Gt(this.keysAtom_);try{At();var a=this.delete_(n);if(!a)return a;if(wt(this)){var u=Tt(this,{object:this.proxy_||this.target_,name:n,type:vr,newValue:i});if(!u)return null;i=u.newValue}var c=sl(n),l={configurable:Q.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:c.get,set:c.set};if(s){if(!Reflect.defineProperty(this.target_,n,l))return!1}else Wt(this.target_,n,l);var p=new _r(i,o,this.name_+"."+n.toString(),!1);this.values_.set(n,p),this.notifyPropertyAddition_(n,p.value_)}finally{Ot()}return!0},t.defineComputedProperty_=function(n,i,o){o===void 0&&(o=!1),Gt(this.keysAtom_);try{At();var s=this.delete_(n);if(!s)return s;if(wt(this)){var a=Tt(this,{object:this.proxy_||this.target_,name:n,type:vr,newValue:void 0});if(!a)return null}i.name||(i.name=this.name_+"."+n.toString()),i.context=this.proxy_||this.target_;var u=sl(n),c={configurable:Q.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:u.get,set:u.set};if(o){if(!Reflect.defineProperty(this.target_,n,c))return!1}else Wt(this.target_,n,c);this.values_.set(n,new Fr(i)),this.notifyPropertyAddition_(n,void 0)}finally{Ot()}return!0},t.delete_=function(n,i){if(i===void 0&&(i=!1),Gt(this.keysAtom_),!Et(this.target_,n))return!0;if(wt(this)){var o=Tt(this,{object:this.proxy_||this.target_,name:n,type:ol});if(!o)return null}try{var s,a;At();var u=Lt(this),c=Xe(),l=this.values_.get(n),p=void 0;if(!l&&(u||c)){var S;p=(S=xo(this.target_,n))==null?void 0:S.value}if(i){if(!Reflect.deleteProperty(this.target_,n))return!1}else delete this.target_[n];if(delete this.appliedAnnotations_[n],l&&(this.values_.delete(n),l instanceof _r&&(p=l.value_),Ll(l)),this.keysAtom_.reportChanged(),(s=this.pendingKeys_)==null||(a=s.get(n))==null||a.set(n in this.target_),u||c){var x={type:ol,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:p,name:n};c&&dt(x),u&&kt(this,x),c&&pt()}}finally{Ot()}return!0},t.observe_=function(n,i){return i===!0&&le("`observe` doesn't support the fire immediately property for observable objects."),Si(this,n)},t.intercept_=function(n){return xi(this,n)},t.notifyPropertyAddition_=function(n,i){var o,s,a=Lt(this),u=Xe();if(a||u){var c=a||u?{type:vr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:n,newValue:i}:null;u&&dt(c),a&&kt(this,c),u&&pt()}(o=this.pendingKeys_)==null||(s=o.get(n))==null||s.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Lo(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Bn(e,t){var r;if(t&&zr(e)&&le("Options can't be provided for already observable objects."),Et(e,be))return Ka(e)instanceof Ra||le("Cannot convert '"+Bo(e)+`' into observable object:
25
+ `)()}}function jl(e,t,r){if(t.length>=1e3){t.push("(and many more)");return}t.push(""+" ".repeat(r-1)+e.name),e.dependencies&&e.dependencies.forEach(function(n){return jl(n,t,r+1)})}var xn=function(){function e(r,n,i,o){r===void 0&&(r="Reaction@"+St()),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ie.NOT_TRACKING_,this.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=It.NONE,this.name_=r,this.onInvalidate_=n,this.errorHandler_=i,this.requiresObservable_=o}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,Q.pendingReactions.push(this),Fl())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){At(),this.isScheduled_=!1;var n=Q.trackingContext;if(Q.trackingContext=this,Ia(this)){this.isTrackPending_=!0;try{this.onInvalidate_(),this.isTrackPending_&&Xe()&&Vr({name:this.name_,type:"scheduled-reaction"})}catch(i){this.reportExceptionInDerivation_(i)}}Q.trackingContext=n,Ot()}},t.track=function(n){if(!this.isDisposed_){At();var i=Xe(),o;i&&(o=Date.now(),dt({name:this.name_,type:"reaction"})),this.isRunning_=!0;var s=Q.trackingContext;Q.trackingContext=this;var a=Rl(this,n,void 0);Q.trackingContext=s,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&xa(this),Eo(a)&&this.reportExceptionInDerivation_(a.cause),i&&pt({time:Date.now()-o}),Ot()}},t.reportExceptionInDerivation_=function(n){var i=this;if(this.errorHandler_){this.errorHandler_(n,this);return}if(Q.disableErrorBoundaries)throw n;var o="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";Q.suppressReactionErrors?console.warn("[mobx] (error in reaction '"+this.name_+"' suppressed, fix error of causing action below)"):console.error(o,n),Xe()&&Vr({type:"error",name:this.name_,message:o,error:""+n}),Q.globalReactionErrorHandlers.forEach(function(s){return s(n,i)})},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(At(),xa(this),Ot()))},t.getDisposer_=function(n){var i=this,o=function s(){i.dispose(),n==null||n.removeEventListener==null||n.removeEventListener("abort",s)};return n==null||n.addEventListener==null||n.addEventListener("abort",o),o[be]=this,o},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(n){n===void 0&&(n=!1),Fa(this,n)},e}();var tl=100,Sa=function(t){return t()};function Fl(){Q.inBatch>0||Q.isRunningReactions||Sa(yb)}function yb(){Q.isRunningReactions=!0;for(var e=Q.pendingReactions,t=0;e.length>0;){++t===tl&&(console.error("Reaction doesn't converge to a stable state after "+tl+" iterations."+(" Probably there is a cycle in the reactive function: "+e[0])),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n<i;n++)r[n].runReaction_()}Q.isRunningReactions=!1}var Po=wr("Reaction",xn);function gb(e){var t=Sa;Sa=function(n){return e(function(){return t(n)})}}function Xe(){return!!Q.spyListeners.length}function Vr(e){if(Q.spyListeners.length)for(var t=Q.spyListeners,r=0,n=t.length;r<n;r++)t[r](e)}function dt(e){var t=sr({},e,{spyReportStart:!0});Vr(t)}var mb={type:"report-end",spyReportEnd:!0};function pt(e){Vr(e?sr({},e,{type:"report-end",spyReportEnd:!0}):mb)}function bb(e){return Q.spyListeners.push(e),Ba(function(){Q.spyListeners=Q.spyListeners.filter(function(t){return t!==e})})}var ja="action",vb="action.bound",Vl="autoAction",_b="autoAction.bound",zl="<unnamed action>",Ca=Ai(ja),wb=Ai(vb,{bound:!0}),Na=Ai(Vl,{autoAction:!0}),Tb=Ai(_b,{autoAction:!0,bound:!0});function Kl(e){var t=function(n,i){if(je(n))return jr(n.name||zl,n,e);if(je(i))return jr(n,i,e);if(wi(i))return(e?Na:Ca).decorate_20223_(n,i);if(Lr(i))return Rn(n,i,e?Na:Ca);if(Lr(n))return Ht(Ai(e?Vl:ja,{name:n,autoAction:e}));le("Invalid arguments for `action`")};return t}var st=Kl(!1);Object.assign(st,Ca);var gi=Kl(!0);Object.assign(gi,Na);st.bound=Ht(wb);gi.bound=Ht(Tb);function $n(e){return xl(e.name||zl,!1,e,this,void 0)}function qr(e){return je(e)&&e.isMobxAction===!0}function Ct(e,t){var r,n,i,o,s;t===void 0&&(t=Ua),je(e)||le("Autorun expects a function as first argument"),qr(e)&&le("Autorun does not accept actions since actions are untrackable");var a=(r=(n=t)==null?void 0:n.name)!=null?r:e.name||"Autorun@"+St(),u=!t.scheduler&&!t.delay,c;if(u)c=new xn(a,function(){this.track(S)},t.onError,t.requiresObservable);else{var l=ql(t),p=!1;c=new xn(a,function(){p||(p=!0,l(function(){p=!1,c.isDisposed_||c.track(S)}))},t.onError,t.requiresObservable)}function S(){e(c)}return(i=t)!=null&&(o=i.signal)!=null&&o.aborted||c.schedule_(),c.getDisposer_((s=t)==null?void 0:s.signal)}var Ab=function(t){return t()};function ql(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Ab}function Gl(e,t,r){var n,i,o,s;r===void 0&&(r=Ua),(!je(e)||!je(t))&&le("First and second argument to reaction should be functions"),jt(r)||le("Third argument of reactions should be an object");var a=(n=r.name)!=null?n:"Reaction@"+St(),u=st(a,r.onError?Ob(r.onError,t):t),c=!r.scheduler&&!r.delay,l=ql(r),p=!0,S=!1,x,E,z=r.compareStructural?Ge.structural:r.equals||Ge.default,W=new xn(a,function(){p||c?T():S||(S=!0,l(T))},r.onError,r.requiresObservable);function T(){if(S=!1,!W.isDisposed_){var k=!1;W.track(function(){var G=nb(!1,function(){return e(W)});k=p||!z(x,G),E=x,x=G}),(p&&r.fireImmediately||!p&&k)&&u(x,E,W),p=!1}}return(i=r)!=null&&(o=i.signal)!=null&&o.aborted||W.schedule_(),W.getDisposer_((s=r)==null?void 0:s.signal)}function Ob(e,t){return function(){try{return t.apply(this,arguments)}catch(r){e.call(this,r)}}}var Eb="onBO",Ib="onBUO";function Pn(e,t,r){return Wl(Eb,e,t,r)}function Gr(e,t,r){return Wl(Ib,e,t,r)}function Wl(e,t,r,n){var i=typeof n=="function"?xt(t,r):xt(t),o=je(n)?n:r,s=e+"L";return i[s]?i[s].add(o):i[s]=new Set([o]),function(){var a=i[s];a&&(a.delete(o),a.size===0&&delete i[s])}}var xb="never",To="always",Sb="observed";function Hl(e){e.isolateGlobalState===!0&&cb();var t=e.useProxies,r=e.enforceActions;if(t!==void 0&&(Q.useProxies=t===To?!0:t===xb?!1:typeof Proxy<"u"),t==="ifavailable"&&(Q.verifyProxies=!0),r!==void 0){var n=r===To?To:r===Sb;Q.enforceActions=n,Q.allowStateChanges=!(n===!0||n===To)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in e&&(Q[i]=!!e[i])}),Q.allowStateReads=!Q.observableRequiresReaction,Q.disableErrorBoundaries===!0&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),e.reactionScheduler&&gb(e.reactionScheduler)}function Cb(e,t,r,n){arguments.length>4&&le("'extendObservable' expected 2-4 arguments"),typeof e!="object"&&le("'extendObservable' expects an object as first argument"),Jt(e)&&le("'extendObservable' should not be used on maps, use map.merge instead"),jt(t)||le("'extendObservable' only accepts plain objects as second argument"),(Cn(t)||Cn(r))&&le("Extending an object with another observable (object) is not supported");var i=am(t);return Hr(function(){var o=Bn(e,n)[be];ko(i).forEach(function(s){o.extend_(s,i[s],r&&s in r?r[s]:!0)})}),e}function Ei(e,t){return Jl(xt(e,t))}function Jl(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=Nb(e.observing_).map(Jl)),t}function Ii(e,t){return Xl(xt(e,t))}function Xl(e){var t={name:e.name_};return fb(e)&&(t.observers=Array.from(lb(e)).map(Xl)),t}function Nb(e){return Array.from(new Set(e))}var Rb=0;function Yl(){this.message="FLOW_CANCELLED"}Yl.prototype=Object.create(Error.prototype);var _a=_l("flow"),$b=_l("flow.bound",{bound:!0}),Sn=Object.assign(function(t,r){if(wi(r))return _a.decorate_20223_(t,r);if(Lr(r))return Rn(t,r,_a);arguments.length!==1&&le("Flow expects single argument with generator function");var n=t,i=n.name||"<unnamed flow>",o=function(){var a=this,u=arguments,c=++Rb,l=st(i+" - runid: "+c+" - init",n).apply(a,u),p,S=void 0,x=new Promise(function(E,z){var W=0;p=z;function T(H){S=void 0;var F;try{F=st(i+" - runid: "+c+" - yield "+W++,l.next).call(l,H)}catch(Y){return z(Y)}G(F)}function k(H){S=void 0;var F;try{F=st(i+" - runid: "+c+" - yield "+W++,l.throw).call(l,H)}catch(Y){return z(Y)}G(F)}function G(H){if(je(H?.then)){H.then(G,z);return}return H.done?E(H.value):(S=Promise.resolve(H.value),S.then(T,k))}T(void 0)});return x.cancel=st(i+" - runid: "+c+" - cancel",function(){try{S&&rl(S);var E=l.return(void 0),z=Promise.resolve(E.value);z.then(En,En),rl(z),p(new Yl)}catch(W){p(W)}}),x};return o.isMobXFlow=!0,o},_a);Sn.bound=Ht($b);function rl(e){je(e.cancel)&&e.cancel()}function mi(e){return e?.isMobXFlow===!0}function Pb(e,t){return e?t!==void 0?Jt(e)||Un(e)?le("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead."):zr(e)?e[be].values_.has(t):!1:zr(e)||!!e[be]||Ma(e)||Po(e)||Oi(e):!1}function Cn(e){return arguments.length!==1&&le("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),Pb(e)}function Ub(e){if(zr(e))return e[be].ownKeys_();le(38)}function Ao(e,t,r){return e.set(t,r),r}function On(e,t){if(e==null||typeof e!="object"||e instanceof Date||!Cn(e))return e;if(ob(e)||Oi(e))return On(e.get(),t);if(t.has(e))return t.get(e);if(Un(e)){var r=Ao(t,e,new Array(e.length));return e.forEach(function(s,a){r[a]=On(s,t)}),r}if(Wr(e)){var n=Ao(t,e,new Set);return e.forEach(function(s){n.add(On(s,t))}),n}if(Jt(e)){var i=Ao(t,e,new Map);return e.forEach(function(s,a){i.set(a,On(s,t))}),i}else{var o=Ao(t,e,{});return Ub(e).forEach(function(s){vi.propertyIsEnumerable.call(e,s)&&(o[s]=On(e[s],t))}),o}}function ar(e,t){return t&&le("toJS no longer supports options"),On(e,new Map)}function Fa(){for(var e=!1,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];typeof r[r.length-1]=="boolean"&&(e=r.pop());var i=Bb(r);if(!i)return le("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");i.isTracing_===It.NONE&&console.log("[mobx.trace] '"+i.name_+"' tracing enabled"),i.isTracing_=e?It.BREAK:It.LOG}function Bb(e){switch(e.length){case 0:return Q.trackingDerivation;case 1:return xt(e[0]);case 2:return xt(e[0],e[1])}}function ir(e,t){t===void 0&&(t=void 0),At();try{return e.apply(t)}finally{Ot()}}function Mr(e){return e[be]}var Db={has:function(t,r){return Q.trackingDerivation&&hi("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),Mr(t).has_(r)},get:function(t,r){return Mr(t).get_(r)},set:function(t,r,n){var i;return Lr(r)?(Mr(t).values_.has(r)||hi("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),(i=Mr(t).set_(r,n,!0))!=null?i:!0):!1},deleteProperty:function(t,r){var n;return hi("delete properties from an observable object. Use 'remove' from 'mobx' instead."),Lr(r)?(n=Mr(t).delete_(r,!0))!=null?n:!0:!1},defineProperty:function(t,r,n){var i;return hi("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),(i=Mr(t).defineProperty_(r,n))!=null?i:!0},ownKeys:function(t){return Q.trackingDerivation&&hi("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),Mr(t).ownKeys_()},preventExtensions:function(t){le(13)}};function Mb(e,t){var r,n;return dl(),e=Bn(e,t),(n=(r=e[be]).proxy_)!=null?n:r.proxy_=new Proxy(e,Db)}function wt(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function xi(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),Ba(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function Tt(e,t){var r=Kr();try{for(var n=[].concat(e.interceptors_||[]),i=0,o=n.length;i<o&&(t=n[i](t),t&&!t.type&&le(14),!!t);i++);return t}finally{or(r)}}function Lt(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function Si(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),Ba(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function kt(e,t){var r=Kr(),n=e.changeListeners_;if(n){n=n.slice();for(var i=0,o=n.length;i<o;i++)n[i](t);or(r)}}function Tr(e,t,r){return Hr(function(){var n,i=Bn(e,r)[be];t&&e[ot]&&le("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),(n=t)!=null||(t=dm(e)),ko(t).forEach(function(o){return i.make_(o,t[o])})}),e}var nl="splice",Mt="update",Lb=1e4,kb={get:function(t,r){var n=t[be];return r===be?n:r==="length"?n.getArrayLength_():typeof r=="string"&&!isNaN(r)?n.get_(parseInt(r)):Et(Uo,r)?Uo[r]:t[r]},set:function(t,r,n){var i=t[be];return r==="length"&&i.setArrayLength_(n),typeof r=="symbol"||isNaN(r)?t[r]=n:i.set_(parseInt(r),n),!0},preventExtensions:function(){le(15)}},Va=function(){function e(r,n,i,o){r===void 0&&(r="ObservableArray@"+St()),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=i,this.legacyMode_=o,this.atom_=new Ti(r),this.enhancer_=function(s,a){return n(s,a,r+"[..]")}}var t=e.prototype;return t.dehanceValue_=function(n){return this.dehancer!==void 0?this.dehancer(n):n},t.dehanceValues_=function(n){return this.dehancer!==void 0&&n.length>0?n.map(this.dehancer):n},t.intercept_=function(n){return xi(this,n)},t.observe_=function(n,i){return i===void 0&&(i=!1),i&&n({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),Si(this,n)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(n){(typeof n!="number"||isNaN(n)||n<0)&&le("Out of range: "+n);var i=this.values_.length;if(n!==i)if(n>i){for(var o=new Array(n-i),s=0;s<n-i;s++)o[s]=void 0;this.spliceWithArray_(i,0,o)}else this.spliceWithArray_(n,i-n)},t.updateArrayLength_=function(n,i){n!==this.lastKnownLength_&&le(16),this.lastKnownLength_+=i,this.legacyMode_&&i>0&&ad(n+i+1)},t.spliceWithArray_=function(n,i,o){var s=this;Gt(this.atom_);var a=this.values_.length;if(n===void 0?n=0:n>a?n=a:n<0&&(n=Math.max(0,a+n)),arguments.length===1?i=a-n:i==null?i=0:i=Math.max(0,Math.min(i,a-n)),o===void 0&&(o=Co),wt(this)){var u=Tt(this,{object:this.proxy_,type:nl,index:n,removedCount:i,added:o});if(!u)return Co;i=u.removedCount,o=u.added}o=o.length===0?o:o.map(function(p){return s.enhancer_(p,void 0)}),this.legacyMode_;var c=o.length-i;this.updateArrayLength_(a,c);var l=this.spliceItemsIntoValues_(n,i,o);return(i!==0||o.length!==0)&&this.notifyArraySplice_(n,o,l),this.dehanceValues_(l)},t.spliceItemsIntoValues_=function(n,i,o){if(o.length<Lb){var s;return(s=this.values_).splice.apply(s,[n,i].concat(o))}else{var a=this.values_.slice(n,n+i),u=this.values_.slice(n+i);this.values_.length+=o.length-i;for(var c=0;c<o.length;c++)this.values_[n+c]=o[c];for(var l=0;l<u.length;l++)this.values_[n+o.length+l]=u[l];return a}},t.notifyArrayChildUpdate_=function(n,i,o){var s=!this.owned_&&Xe(),a=Lt(this),u=a||s?{observableKind:"array",object:this.proxy_,type:Mt,debugObjectName:this.atom_.name_,index:n,newValue:i,oldValue:o}:null;s&&dt(u),this.atom_.reportChanged(),a&&kt(this,u),s&&pt()},t.notifyArraySplice_=function(n,i,o){var s=!this.owned_&&Xe(),a=Lt(this),u=a||s?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:nl,index:n,removed:o,added:i,removedCount:o.length,addedCount:i.length}:null;s&&dt(u),this.atom_.reportChanged(),a&&kt(this,u),s&&pt()},t.get_=function(n){if(this.legacyMode_&&n>=this.values_.length){console.warn("[mobx.array] Attempt to read an array index ("+n+") that is out of bounds ("+this.values_.length+"). Please check length first. Out of bound indices will not be tracked by MobX");return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[n])},t.set_=function(n,i){var o=this.values_;if(this.legacyMode_&&n>o.length&&le(17,n,o.length),n<o.length){Gt(this.atom_);var s=o[n];if(wt(this)){var a=Tt(this,{type:Mt,object:this.proxy_,index:n,newValue:i});if(!a)return;i=a.newValue}i=this.enhancer_(i,s);var u=i!==s;u&&(o[n]=i,this.notifyArrayChildUpdate_(n,i,s))}else{for(var c=new Array(n+1-o.length),l=0;l<c.length-1;l++)c[l]=void 0;c[c.length-1]=i,this.spliceWithArray_(o.length,0,c)}},e}();function jb(e,t,r,n){return r===void 0&&(r="ObservableArray@"+St()),n===void 0&&(n=!1),dl(),Hr(function(){var i=new Va(r,t,n,!1);hl(i.values_,be,i);var o=new Proxy(i.values_,kb);return i.proxy_=o,e&&e.length&&i.spliceWithArray_(0,0,e),o})}var Uo={clear:function(){return this.splice(0)},replace:function(t){var r=this[be];return r.spliceWithArray_(0,r.values_.length,t)},toJSON:function(){return this.slice()},splice:function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var s=this[be];switch(arguments.length){case 0:return[];case 1:return s.spliceWithArray_(t);case 2:return s.spliceWithArray_(t,r)}return s.spliceWithArray_(t,r,i)},spliceWithArray:function(t,r,n){return this[be].spliceWithArray_(t,r,n)},push:function(){for(var t=this[be],r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return t.spliceWithArray_(t.values_.length,0,n),t.values_.length},pop:function(){return this.splice(Math.max(this[be].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[be],r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return t.spliceWithArray_(0,0,n),t.values_.length},reverse:function(){return Q.trackingDerivation&&le(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Q.trackingDerivation&&le(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var r=this[be],n=r.dehanceValues_(r.values_).indexOf(t);return n>-1?(this.splice(n,1),!0):!1}};Ue("at",ht);Ue("concat",ht);Ue("flat",ht);Ue("includes",ht);Ue("indexOf",ht);Ue("join",ht);Ue("lastIndexOf",ht);Ue("slice",ht);Ue("toString",ht);Ue("toLocaleString",ht);Ue("toSorted",ht);Ue("toSpliced",ht);Ue("with",ht);Ue("every",Ft);Ue("filter",Ft);Ue("find",Ft);Ue("findIndex",Ft);Ue("findLast",Ft);Ue("findLastIndex",Ft);Ue("flatMap",Ft);Ue("forEach",Ft);Ue("map",Ft);Ue("some",Ft);Ue("toReversed",Ft);Ue("reduce",Ql);Ue("reduceRight",Ql);function Ue(e,t){typeof Array.prototype[e]=="function"&&(Uo[e]=t(e))}function ht(e){return function(){var t=this[be];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function Ft(e){return function(t,r){var n=this,i=this[be];i.atom_.reportObserved();var o=i.dehanceValues_(i.values_);return o[e](function(s,a){return t.call(r,s,a,n)})}}function Ql(e){return function(){var t=this,r=this[be];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(o,s,a){return i(o,s,a,t)},n[e].apply(n,arguments)}}var Fb=wr("ObservableArrayAdministration",Va);function Un(e){return Mo(e)&&Fb(e[be])}var Zl,ed,Vb={},vr="add",Bo="delete";Zl=Symbol.iterator;ed=Symbol.toStringTag;var td=function(){function e(r,n,i){var o=this;n===void 0&&(n=kr),i===void 0&&(i="ObservableMap@"+St()),this.enhancer_=void 0,this.name_=void 0,this[be]=Vb,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=n,this.name_=i,je(Map)||le(18),Hr(function(){o.keysAtom_=bl(o.name_+".keys()"),o.data_=new Map,o.hasMap_=new Map,r&&o.merge(r)})}var t=e.prototype;return t.has_=function(n){return this.data_.has(n)},t.has=function(n){var i=this;if(!Q.trackingDerivation)return this.has_(n);var o=this.hasMap_.get(n);if(!o){var s=o=new _r(this.has_(n),Fo,this.name_+"."+Ta(n)+"?",!1);this.hasMap_.set(n,s),Gr(s,function(){return i.hasMap_.delete(n)})}return o.get()},t.set=function(n,i){var o=this.has_(n);if(wt(this)){var s=Tt(this,{type:o?Mt:vr,object:this,newValue:i,name:n});if(!s)return this;i=s.newValue}return o?this.updateValue_(n,i):this.addValue_(n,i),this},t.delete=function(n){var i=this;if(Gt(this.keysAtom_),wt(this)){var o=Tt(this,{type:Bo,object:this,name:n});if(!o)return!1}if(this.has_(n)){var s=Xe(),a=Lt(this),u=a||s?{observableKind:"map",debugObjectName:this.name_,type:Bo,object:this,oldValue:this.data_.get(n).value_,name:n}:null;return s&&dt(u),ir(function(){var c;i.keysAtom_.reportChanged(),(c=i.hasMap_.get(n))==null||c.setNewValue_(!1);var l=i.data_.get(n);l.setNewValue_(void 0),i.data_.delete(n)}),a&&kt(this,u),s&&pt(),!0}return!1},t.updateValue_=function(n,i){var o=this.data_.get(n);if(i=o.prepareNewValue_(i),i!==Q.UNCHANGED){var s=Xe(),a=Lt(this),u=a||s?{observableKind:"map",debugObjectName:this.name_,type:Mt,object:this,oldValue:o.value_,name:n,newValue:i}:null;s&&dt(u),o.setNewValue_(i),a&&kt(this,u),s&&pt()}},t.addValue_=function(n,i){var o=this;Gt(this.keysAtom_),ir(function(){var c,l=new _r(i,o.enhancer_,o.name_+"."+Ta(n),!1);o.data_.set(n,l),i=l.value_,(c=o.hasMap_.get(n))==null||c.setNewValue_(!0),o.keysAtom_.reportChanged()});var s=Xe(),a=Lt(this),u=a||s?{observableKind:"map",debugObjectName:this.name_,type:vr,object:this,name:n,newValue:i}:null;s&&dt(u),a&&kt(this,u),s&&pt()},t.get=function(n){return this.has(n)?this.dehanceValue_(this.data_.get(n).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(n){return this.dehancer!==void 0?this.dehancer(n):n},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var n=this,i=this.keys();return bi({next:function(){var s=i.next(),a=s.done,u=s.value;return{done:a,value:a?void 0:n.get(u)}}})},t.entries=function(){var n=this,i=this.keys();return bi({next:function(){var s=i.next(),a=s.done,u=s.value;return{done:a,value:a?void 0:[u,n.get(u)]}}})},t[Zl]=function(){return this.entries()},t.forEach=function(n,i){for(var o=In(this),s;!(s=o()).done;){var a=s.value,u=a[0],c=a[1];n.call(i,c,u,this)}},t.merge=function(n){var i=this;return Jt(n)&&(n=new Map(n)),ir(function(){jt(n)?sm(n).forEach(function(o){return i.set(o,n[o])}):Array.isArray(n)?n.forEach(function(o){var s=o[0],a=o[1];return i.set(s,a)}):Nn(n)?(n.constructor!==Map&&le(19,n),n.forEach(function(o,s){return i.set(s,o)})):n!=null&&le(20,n)}),this},t.clear=function(){var n=this;ir(function(){Re(function(){for(var i=In(n.keys()),o;!(o=i()).done;){var s=o.value;n.delete(s)}})})},t.replace=function(n){var i=this;return ir(function(){for(var o=zb(n),s=new Map,a=!1,u=In(i.data_.keys()),c;!(c=u()).done;){var l=c.value;if(!o.has(l)){var p=i.delete(l);if(p)a=!0;else{var S=i.data_.get(l);s.set(l,S)}}}for(var x=In(o.entries()),E;!(E=x()).done;){var z=E.value,W=z[0],T=z[1],k=i.data_.has(W);if(i.set(W,T),i.data_.has(W)){var G=i.data_.get(W);s.set(W,G),k||(a=!0)}}if(!a)if(i.data_.size!==s.size)i.keysAtom_.reportChanged();else for(var H=i.data_.keys(),F=s.keys(),Y=H.next(),V=F.next();!Y.done;){if(Y.value!==V.value){i.keysAtom_.reportChanged();break}Y=H.next(),V=F.next()}i.data_=s}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(n,i){return i===!0&&le("`observe` doesn't support fireImmediately=true in combination with maps."),Si(this,n)},t.intercept_=function(n){return xi(this,n)},Da(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:ed,get:function(){return"Map"}}]),e}(),Jt=wr("ObservableMap",td);function zb(e){if(Nn(e)||Jt(e))return e;if(Array.isArray(e))return new Map(e);if(jt(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}else return le(21,e)}var rd,nd,Kb={};rd=Symbol.iterator;nd=Symbol.toStringTag;var id=function(){function e(r,n,i){var o=this;n===void 0&&(n=kr),i===void 0&&(i="ObservableSet@"+St()),this.name_=void 0,this[be]=Kb,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=i,je(Set)||le(22),this.enhancer_=function(s,a){return n(s,a,i)},Hr(function(){o.atom_=bl(o.name_),r&&o.replace(r)})}var t=e.prototype;return t.dehanceValue_=function(n){return this.dehancer!==void 0?this.dehancer(n):n},t.clear=function(){var n=this;ir(function(){Re(function(){for(var i=In(n.data_.values()),o;!(o=i()).done;){var s=o.value;n.delete(s)}})})},t.forEach=function(n,i){for(var o=In(this),s;!(s=o()).done;){var a=s.value;n.call(i,a,a,this)}},t.add=function(n){var i=this;if(Gt(this.atom_),wt(this)){var o=Tt(this,{type:vr,object:this,newValue:n});if(!o)return this}if(!this.has(n)){ir(function(){i.data_.add(i.enhancer_(n,void 0)),i.atom_.reportChanged()});var s=Xe(),a=Lt(this),u=a||s?{observableKind:"set",debugObjectName:this.name_,type:vr,object:this,newValue:n}:null;s&&dt(u),a&&kt(this,u),s&&pt()}return this},t.delete=function(n){var i=this;if(wt(this)){var o=Tt(this,{type:Bo,object:this,oldValue:n});if(!o)return!1}if(this.has(n)){var s=Xe(),a=Lt(this),u=a||s?{observableKind:"set",debugObjectName:this.name_,type:Bo,object:this,oldValue:n}:null;return s&&dt(u),ir(function(){i.atom_.reportChanged(),i.data_.delete(n)}),a&&kt(this,u),s&&pt(),!0}return!1},t.has=function(n){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(n))},t.entries=function(){var n=0,i=Array.from(this.keys()),o=Array.from(this.values());return bi({next:function(){var a=n;return n+=1,a<o.length?{value:[i[a],o[a]],done:!1}:{done:!0}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var n=this,i=0,o=Array.from(this.data_.values());return bi({next:function(){return i<o.length?{value:n.dehanceValue_(o[i++]),done:!1}:{done:!0}}})},t.replace=function(n){var i=this;return Wr(n)&&(n=new Set(n)),ir(function(){Array.isArray(n)?(i.clear(),n.forEach(function(o){return i.add(o)})):_i(n)?(i.clear(),n.forEach(function(o){return i.add(o)})):n!=null&&le("Cannot initialize set from "+n)}),this},t.observe_=function(n,i){return i===!0&&le("`observe` doesn't support fireImmediately=true in combination with sets."),Si(this,n)},t.intercept_=function(n){return xi(this,n)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[rd]=function(){return this.values()},Da(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:nd,get:function(){return"Set"}}]),e}(),Wr=wr("ObservableSet",id),il=Object.create(null),ol="remove",Ra=function(){function e(r,n,i,o){n===void 0&&(n=new Map),o===void 0&&(o=Mm),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=r,this.values_=n,this.name_=i,this.defaultAnnotation_=o,this.keysAtom_=new Ti(this.name_+".keys"),this.isPlainObject_=jt(this.target_),ud(this.defaultAnnotation_)||le("defaultAnnotation must be valid annotation"),this.appliedAnnotations_={}}var t=e.prototype;return t.getObservablePropValue_=function(n){return this.values_.get(n).get()},t.setObservablePropValue_=function(n,i){var o=this.values_.get(n);if(o instanceof Fr)return o.set(i),!0;if(wt(this)){var s=Tt(this,{type:Mt,object:this.proxy_||this.target_,name:n,newValue:i});if(!s)return null;i=s.newValue}if(i=o.prepareNewValue_(i),i!==Q.UNCHANGED){var a=Lt(this),u=Xe(),c=a||u?{type:Mt,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:o.value_,name:n,newValue:i}:null;u&&dt(c),o.setNewValue_(i),a&&kt(this,c),u&&pt()}return!0},t.get_=function(n){return Q.trackingDerivation&&!Et(this.target_,n)&&this.has_(n),this.target_[n]},t.set_=function(n,i,o){return o===void 0&&(o=!1),Et(this.target_,n)?this.values_.has(n)?this.setObservablePropValue_(n,i):o?Reflect.set(this.target_,n,i):(this.target_[n]=i,!0):this.extend_(n,{value:i,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,o)},t.has_=function(n){if(!Q.trackingDerivation)return n in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var i=this.pendingKeys_.get(n);return i||(i=new _r(n in this.target_,Fo,this.name_+"."+Ta(n)+"?",!1),this.pendingKeys_.set(n,i)),i.get()},t.make_=function(n,i){if(i===!0&&(i=this.defaultAnnotation_),i!==!1){if(ul(this,i,n),!(n in this.target_)){var o;if((o=this.target_[ot])!=null&&o[n])return;le(1,i.annotationType_,this.name_+"."+n.toString())}for(var s=this.target_;s&&s!==vi;){var a=So(s,n);if(a){var u=i.make_(this,n,a,s);if(u===0)return;if(u===1)break}s=Object.getPrototypeOf(s)}al(this,i,n)}},t.extend_=function(n,i,o,s){if(s===void 0&&(s=!1),o===!0&&(o=this.defaultAnnotation_),o===!1)return this.defineProperty_(n,i,s);ul(this,o,n);var a=o.extend_(this,n,i,s);return a&&al(this,o,n),a},t.defineProperty_=function(n,i,o){o===void 0&&(o=!1),Gt(this.keysAtom_);try{At();var s=this.delete_(n);if(!s)return s;if(wt(this)){var a=Tt(this,{object:this.proxy_||this.target_,name:n,type:vr,newValue:i.value});if(!a)return null;var u=a.newValue;i.value!==u&&(i=sr({},i,{value:u}))}if(o){if(!Reflect.defineProperty(this.target_,n,i))return!1}else Wt(this.target_,n,i);this.notifyPropertyAddition_(n,i.value)}finally{Ot()}return!0},t.defineObservableProperty_=function(n,i,o,s){s===void 0&&(s=!1),Gt(this.keysAtom_);try{At();var a=this.delete_(n);if(!a)return a;if(wt(this)){var u=Tt(this,{object:this.proxy_||this.target_,name:n,type:vr,newValue:i});if(!u)return null;i=u.newValue}var c=sl(n),l={configurable:Q.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:c.get,set:c.set};if(s){if(!Reflect.defineProperty(this.target_,n,l))return!1}else Wt(this.target_,n,l);var p=new _r(i,o,this.name_+"."+n.toString(),!1);this.values_.set(n,p),this.notifyPropertyAddition_(n,p.value_)}finally{Ot()}return!0},t.defineComputedProperty_=function(n,i,o){o===void 0&&(o=!1),Gt(this.keysAtom_);try{At();var s=this.delete_(n);if(!s)return s;if(wt(this)){var a=Tt(this,{object:this.proxy_||this.target_,name:n,type:vr,newValue:void 0});if(!a)return null}i.name||(i.name=this.name_+"."+n.toString()),i.context=this.proxy_||this.target_;var u=sl(n),c={configurable:Q.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:u.get,set:u.set};if(o){if(!Reflect.defineProperty(this.target_,n,c))return!1}else Wt(this.target_,n,c);this.values_.set(n,new Fr(i)),this.notifyPropertyAddition_(n,void 0)}finally{Ot()}return!0},t.delete_=function(n,i){if(i===void 0&&(i=!1),Gt(this.keysAtom_),!Et(this.target_,n))return!0;if(wt(this)){var o=Tt(this,{object:this.proxy_||this.target_,name:n,type:ol});if(!o)return null}try{var s,a;At();var u=Lt(this),c=Xe(),l=this.values_.get(n),p=void 0;if(!l&&(u||c)){var S;p=(S=So(this.target_,n))==null?void 0:S.value}if(i){if(!Reflect.deleteProperty(this.target_,n))return!1}else delete this.target_[n];if(delete this.appliedAnnotations_[n],l&&(this.values_.delete(n),l instanceof _r&&(p=l.value_),Ll(l)),this.keysAtom_.reportChanged(),(s=this.pendingKeys_)==null||(a=s.get(n))==null||a.set(n in this.target_),u||c){var x={type:ol,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:p,name:n};c&&dt(x),u&&kt(this,x),c&&pt()}}finally{Ot()}return!0},t.observe_=function(n,i){return i===!0&&le("`observe` doesn't support the fire immediately property for observable objects."),Si(this,n)},t.intercept_=function(n){return xi(this,n)},t.notifyPropertyAddition_=function(n,i){var o,s,a=Lt(this),u=Xe();if(a||u){var c=a||u?{type:vr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:n,newValue:i}:null;u&&dt(c),a&&kt(this,c),u&&pt()}(o=this.pendingKeys_)==null||(s=o.get(n))==null||s.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),ko(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Bn(e,t){var r;if(t&&zr(e)&&le("Options can't be provided for already observable objects."),Et(e,be))return Ka(e)instanceof Ra||le("Cannot convert '"+Do(e)+`' into observable object:
26
26
  The target is already observable of different type.
27
- Extending builtins is not supported.`),e;Object.isExtensible(e)||le("Cannot make the designated object observable; it is not extensible");var n=(r=t?.name)!=null?r:(jt(e)?"ObservableObject":e.constructor.name)+"@"+St(),i=new Ra(e,new Map,String(n),Hm(t));return Mo(e,be,i),e}var qb=wr("ObservableObjectAdministration",Ra);function sl(e){return il[e]||(il[e]={get:function(){return this[be].getObservablePropValue_(e)},set:function(r){return this[be].setObservablePropValue_(e,r)}})}function zr(e){return Do(e)?qb(e[be]):!1}function al(e,t,r){var n;e.appliedAnnotations_[r]=t,(n=e.target_[ot])==null||delete n[r]}function ul(e,t,r){if(ud(t)||le("Cannot annotate '"+e.name_+"."+r.toString()+"': Invalid annotation."),!Co(t)&&Et(e.appliedAnnotations_,r)){var n=e.name_+"."+r.toString(),i=e.appliedAnnotations_[r].annotationType_,o=t.annotationType_;le("Cannot apply '"+o+"' to '"+n+"':"+(`
27
+ Extending builtins is not supported.`),e;Object.isExtensible(e)||le("Cannot make the designated object observable; it is not extensible");var n=(r=t?.name)!=null?r:(jt(e)?"ObservableObject":e.constructor.name)+"@"+St(),i=new Ra(e,new Map,String(n),Hm(t));return Lo(e,be,i),e}var qb=wr("ObservableObjectAdministration",Ra);function sl(e){return il[e]||(il[e]={get:function(){return this[be].getObservablePropValue_(e)},set:function(r){return this[be].setObservablePropValue_(e,r)}})}function zr(e){return Mo(e)?qb(e[be]):!1}function al(e,t,r){var n;e.appliedAnnotations_[r]=t,(n=e.target_[ot])==null||delete n[r]}function ul(e,t,r){if(ud(t)||le("Cannot annotate '"+e.name_+"."+r.toString()+"': Invalid annotation."),!No(t)&&Et(e.appliedAnnotations_,r)){var n=e.name_+"."+r.toString(),i=e.appliedAnnotations_[r].annotationType_,o=t.annotationType_;le("Cannot apply '"+o+"' to '"+n+"':"+(`
28
28
  The field is already annotated with '`+i+"'.")+`
29
29
  Re-annotating fields is not allowed.
30
- Use 'override' annotation for methods overridden by subclass.`)}}var Gb=sd(0),Wb=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),wa=0,od=function(){};function Hb(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}Hb(od,Array.prototype);var za=function(e,t,r){ml(n,e);function n(o,s,a,u){var c;return a===void 0&&(a="ObservableArray@"+St()),u===void 0&&(u=!1),c=e.call(this)||this,Hr(function(){var l=new Va(a,s,u,!0);l.proxy_=Ao(c),hl(Ao(c),be,l),o&&o.length&&c.spliceWithArray(0,0,o),Wb&&Object.defineProperty(Ao(c),"0",Gb)}),c}var i=n.prototype;return i.concat=function(){this[be].atom_.reportObserved();for(var s=arguments.length,a=new Array(s),u=0;u<s;u++)a[u]=arguments[u];return Array.prototype.concat.apply(this.slice(),a.map(function(c){return Un(c)?c.slice():c}))},i[r]=function(){var o=this,s=0;return bi({next:function(){return s<o.length?{value:o[s++],done:!1}:{done:!0,value:void 0}}})},Da(n,[{key:"length",get:function(){return this[be].getArrayLength_()},set:function(s){this[be].setArrayLength_(s)}},{key:t,get:function(){return"Array"}}]),n}(od,Symbol.toStringTag,Symbol.iterator);Object.entries(Po).forEach(function(e){var t=e[0],r=e[1];t!=="concat"&&Mo(za.prototype,t,r)});function sd(e){return{enumerable:!1,configurable:!0,get:function(){return this[be].get_(e)},set:function(r){this[be].set_(e,r)}}}function Jb(e){Wt(za.prototype,""+e,sd(e))}function ad(e){if(e>wa){for(var t=wa;t<e+100;t++)Jb(t);wa=e}}ad(1e3);function Xb(e,t,r){return new za(e,t,r)}function xt(e,t){if(typeof e=="object"&&e!==null){if(Un(e))return t!==void 0&&le(23),e[be].atom_;if(Wr(e))return e.atom_;if(Jt(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||le(25,t,Bo(e)),r}if(zr(e)){if(!t)return le(26);var n=e[be].values_.get(t);return n||le(27,t,Bo(e)),n}if(Ma(e)||Oi(e)||$o(e))return e}else if(je(e)&&$o(e[be]))return e[be];le(28)}function Ka(e,t){if(e||le(29),t!==void 0)return Ka(xt(e,t));if(Ma(e)||Oi(e)||$o(e)||Jt(e)||Wr(e))return e;if(e[be])return e[be];le(24,e)}function Bo(e,t){var r;if(t!==void 0)r=xt(e,t);else{if(qr(e))return e.name;zr(e)||Jt(e)||Wr(e)?r=Ka(e):r=xt(e)}return r.name_}function Hr(e){var t=Kr(),r=Vo(!0);At();try{return e()}finally{Ot(),zo(r),or(t)}}var cl=vi.toString;function qa(e,t,r){return r===void 0&&(r=-1),$a(e,t,r)}function $a(e,t,r,n,i){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var o=typeof e;if(o!=="function"&&o!=="object"&&typeof t!="object")return!1;var s=cl.call(e);if(s!==cl.call(t))return!1;switch(s){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:+e==0?1/+e===1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return typeof Symbol<"u"&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":r>=0&&r++;break}e=fl(e),t=fl(t);var a=s==="[object Array]";if(!a){if(typeof e!="object"||typeof t!="object")return!1;var u=e.constructor,c=t.constructor;if(u!==c&&!(je(u)&&u instanceof u&&je(c)&&c instanceof c)&&"constructor"in e&&"constructor"in t)return!1}if(r===0)return!1;r<0&&(r=-1),n=n||[],i=i||[];for(var l=n.length;l--;)if(n[l]===e)return i[l]===t;if(n.push(e),i.push(t),a){if(l=e.length,l!==t.length)return!1;for(;l--;)if(!$a(e[l],t[l],r-1,n,i))return!1}else{var p=Object.keys(e),S;if(l=p.length,Object.keys(t).length!==l)return!1;for(;l--;)if(S=p[l],!(Et(t,S)&&$a(e[S],t[S],r-1,n,i)))return!1}return n.pop(),i.pop(),!0}function fl(e){return Un(e)?e.slice():Nn(e)||Jt(e)||_i(e)||Wr(e)?Array.from(e.entries()):e}function bi(e){return e[Symbol.iterator]=Yb,e}function Yb(){return this}function ud(e){return e instanceof Object&&typeof e.annotationType_=="string"&&je(e.make_)&&je(e.extend_)}["Symbol","Map","Set"].forEach(function(e){var t=Pa();typeof t[e]>"u"&&le("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:bb,extras:{getDebugName:Bo},$mobx:be});var Qb=Object.create,Ga=Object.defineProperty,Zb=Object.getOwnPropertyDescriptor,cd=Object.getOwnPropertyNames,ev=Object.getPrototypeOf,tv=Object.prototype.hasOwnProperty,Le=(e,t)=>function(){return t||(0,e[cd(e)[0]])((t={exports:{}}).exports,t),t.exports},Wa=(e,t)=>{for(var r in t)Ga(e,r,{get:t[r],enumerable:!0})},rv=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of cd(t))!tv.call(e,i)&&i!==r&&Ga(e,i,{get:()=>t[i],enumerable:!(n=Zb(t,i))||n.enumerable});return e},Nt=(e,t,r)=>(r=e!=null?Qb(ev(e)):{},rv(t||!e||!e.__esModule?Ga(r,"default",{value:e,enumerable:!0}):r,e));var ur=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/typebox.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Type=e.JsonType=e.JavaScriptTypeBuilder=e.JsonTypeBuilder=e.TypeBuilder=e.TypeBuilderError=e.TransformEncodeBuilder=e.TransformDecodeBuilder=e.TemplateLiteralDslParser=e.TemplateLiteralGenerator=e.TemplateLiteralGeneratorError=e.TemplateLiteralFinite=e.TemplateLiteralFiniteError=e.TemplateLiteralParser=e.TemplateLiteralParserError=e.TemplateLiteralResolver=e.TemplateLiteralPattern=e.TemplateLiteralPatternError=e.UnionResolver=e.KeyArrayResolver=e.KeyArrayResolverError=e.KeyResolver=e.ObjectMap=e.Intrinsic=e.IndexedAccessor=e.TypeClone=e.TypeExtends=e.TypeExtendsResult=e.TypeExtendsError=e.ExtendsUndefined=e.TypeGuard=e.TypeGuardUnknownTypeError=e.ValueGuard=e.FormatRegistry=e.TypeBoxError=e.TypeRegistry=e.PatternStringExact=e.PatternNumberExact=e.PatternBooleanExact=e.PatternString=e.PatternNumber=e.PatternBoolean=e.Kind=e.Hint=e.Optional=e.Readonly=e.Transform=void 0,e.Transform=Symbol.for("TypeBox.Transform"),e.Readonly=Symbol.for("TypeBox.Readonly"),e.Optional=Symbol.for("TypeBox.Optional"),e.Hint=Symbol.for("TypeBox.Hint"),e.Kind=Symbol.for("TypeBox.Kind"),e.PatternBoolean="(true|false)",e.PatternNumber="(0|[1-9][0-9]*)",e.PatternString="(.*)",e.PatternBooleanExact=`^${e.PatternBoolean}$`,e.PatternNumberExact=`^${e.PatternNumber}$`,e.PatternStringExact=`^${e.PatternString}$`;var t;(function(d){let w=new Map;function C(){return new Map(w)}d.Entries=C;function D(){return w.clear()}d.Clear=D;function P(_){return w.delete(_)}d.Delete=P;function N(_){return w.has(_)}d.Has=N;function g(_,f){w.set(_,f)}d.Set=g;function R(_){return w.get(_)}d.Get=R})(t||(e.TypeRegistry=t={}));var r=class extends Error{constructor(d){super(d)}};e.TypeBoxError=r;var n;(function(d){let w=new Map;function C(){return new Map(w)}d.Entries=C;function D(){return w.clear()}d.Clear=D;function P(_){return w.delete(_)}d.Delete=P;function N(_){return w.has(_)}d.Has=N;function g(_,f){w.set(_,f)}d.Set=g;function R(_){return w.get(_)}d.Get=R})(n||(e.FormatRegistry=n={}));var i;(function(d){function w(v){return Array.isArray(v)}d.IsArray=w;function C(v){return typeof v=="bigint"}d.IsBigInt=C;function D(v){return typeof v=="boolean"}d.IsBoolean=D;function P(v){return v instanceof globalThis.Date}d.IsDate=P;function N(v){return v===null}d.IsNull=N;function g(v){return typeof v=="number"}d.IsNumber=g;function R(v){return typeof v=="object"&&v!==null}d.IsObject=R;function _(v){return typeof v=="string"}d.IsString=_;function f(v){return v instanceof globalThis.Uint8Array}d.IsUint8Array=f;function I(v){return v===void 0}d.IsUndefined=I})(i||(e.ValueGuard=i={}));var o=class extends r{};e.TypeGuardUnknownTypeError=o;var s;(function(d){function w(m){try{return new RegExp(m),!0}catch{return!1}}function C(m){if(!i.IsString(m))return!1;for(let Ne=0;Ne<m.length;Ne++){let bt=m.charCodeAt(Ne);if(bt>=7&&bt<=13||bt===27||bt===127)return!1}return!0}function D(m){return g(m)||ze(m)}function P(m){return i.IsUndefined(m)||i.IsBigInt(m)}function N(m){return i.IsUndefined(m)||i.IsNumber(m)}function g(m){return i.IsUndefined(m)||i.IsBoolean(m)}function R(m){return i.IsUndefined(m)||i.IsString(m)}function _(m){return i.IsUndefined(m)||i.IsString(m)&&C(m)&&w(m)}function f(m){return i.IsUndefined(m)||i.IsString(m)&&C(m)}function I(m){return i.IsUndefined(m)||ze(m)}function v(m){return we(m,"Any")&&R(m.$id)}d.TAny=v;function b(m){return we(m,"Array")&&m.type==="array"&&R(m.$id)&&ze(m.items)&&N(m.minItems)&&N(m.maxItems)&&g(m.uniqueItems)&&I(m.contains)&&N(m.minContains)&&N(m.maxContains)}d.TArray=b;function U(m){return we(m,"AsyncIterator")&&m.type==="AsyncIterator"&&R(m.$id)&&ze(m.items)}d.TAsyncIterator=U;function q(m){return we(m,"BigInt")&&m.type==="bigint"&&R(m.$id)&&P(m.exclusiveMaximum)&&P(m.exclusiveMinimum)&&P(m.maximum)&&P(m.minimum)&&P(m.multipleOf)}d.TBigInt=q;function te(m){return we(m,"Boolean")&&m.type==="boolean"&&R(m.$id)}d.TBoolean=te;function ie(m){return we(m,"Constructor")&&m.type==="Constructor"&&R(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Ne=>ze(Ne))&&ze(m.returns)}d.TConstructor=ie;function ge(m){return we(m,"Date")&&m.type==="Date"&&R(m.$id)&&N(m.exclusiveMaximumTimestamp)&&N(m.exclusiveMinimumTimestamp)&&N(m.maximumTimestamp)&&N(m.minimumTimestamp)&&N(m.multipleOfTimestamp)}d.TDate=ge;function _e(m){return we(m,"Function")&&m.type==="Function"&&R(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Ne=>ze(Ne))&&ze(m.returns)}d.TFunction=_e;function Be(m){return we(m,"Integer")&&m.type==="integer"&&R(m.$id)&&N(m.exclusiveMaximum)&&N(m.exclusiveMinimum)&&N(m.maximum)&&N(m.minimum)&&N(m.multipleOf)}d.TInteger=Be;function Fe(m){return we(m,"Intersect")&&!(i.IsString(m.type)&&m.type!=="object")&&i.IsArray(m.allOf)&&m.allOf.every(Ne=>ze(Ne)&&!Qn(Ne))&&R(m.type)&&(g(m.unevaluatedProperties)||I(m.unevaluatedProperties))&&R(m.$id)}d.TIntersect=Fe;function Rr(m){return we(m,"Iterator")&&m.type==="Iterator"&&R(m.$id)&&ze(m.items)}d.TIterator=Rr;function we(m,Ne){return hr(m)&&m[e.Kind]===Ne}d.TKindOf=we;function hr(m){return i.IsObject(m)&&e.Kind in m&&i.IsString(m[e.Kind])}d.TKind=hr;function $r(m){return $(m)&&i.IsString(m.const)}d.TLiteralString=$r;function A(m){return $(m)&&i.IsNumber(m.const)}d.TLiteralNumber=A;function de(m){return $(m)&&i.IsBoolean(m.const)}d.TLiteralBoolean=de;function $(m){return we(m,"Literal")&&R(m.$id)&&(i.IsBoolean(m.const)||i.IsNumber(m.const)||i.IsString(m.const))}d.TLiteral=$;function me(m){return we(m,"Never")&&i.IsObject(m.not)&&Object.getOwnPropertyNames(m.not).length===0}d.TNever=me;function se(m){return we(m,"Not")&&ze(m.not)}d.TNot=se;function he(m){return we(m,"Null")&&m.type==="null"&&R(m.$id)}d.TNull=he;function Se(m){return we(m,"Number")&&m.type==="number"&&R(m.$id)&&N(m.exclusiveMaximum)&&N(m.exclusiveMinimum)&&N(m.maximum)&&N(m.minimum)&&N(m.multipleOf)}d.TNumber=Se;function ke(m){return we(m,"Object")&&m.type==="object"&&R(m.$id)&&i.IsObject(m.properties)&&D(m.additionalProperties)&&N(m.minProperties)&&N(m.maxProperties)&&Object.entries(m.properties).every(([Ne,bt])=>C(Ne)&&ze(bt))}d.TObject=ke;function rt(m){return we(m,"Promise")&&m.type==="Promise"&&R(m.$id)&&ze(m.item)}d.TPromise=rt;function Ze(m){return we(m,"Record")&&m.type==="object"&&R(m.$id)&&D(m.additionalProperties)&&i.IsObject(m.patternProperties)&&(Ne=>{let bt=Object.getOwnPropertyNames(Ne.patternProperties);return bt.length===1&&w(bt[0])&&i.IsObject(Ne.patternProperties)&&ze(Ne.patternProperties[bt[0]])})(m)}d.TRecord=Ze;function it(m){return i.IsObject(m)&&e.Hint in m&&m[e.Hint]==="Recursive"}d.TRecursive=it;function er(m){return we(m,"Ref")&&R(m.$id)&&i.IsString(m.$ref)}d.TRef=er;function fn(m){return we(m,"String")&&m.type==="string"&&R(m.$id)&&N(m.minLength)&&N(m.maxLength)&&_(m.pattern)&&f(m.format)}d.TString=fn;function ln(m){return we(m,"Symbol")&&m.type==="symbol"&&R(m.$id)}d.TSymbol=ln;function Pr(m){return we(m,"TemplateLiteral")&&m.type==="string"&&i.IsString(m.pattern)&&m.pattern[0]==="^"&&m.pattern[m.pattern.length-1]==="$"}d.TTemplateLiteral=Pr;function Xi(m){return we(m,"This")&&R(m.$id)&&i.IsString(m.$ref)}d.TThis=Xi;function Qn(m){return i.IsObject(m)&&e.Transform in m}d.TTransform=Qn;function Ve(m){return we(m,"Tuple")&&m.type==="array"&&R(m.$id)&&i.IsNumber(m.minItems)&&i.IsNumber(m.maxItems)&&m.minItems===m.maxItems&&(i.IsUndefined(m.items)&&i.IsUndefined(m.additionalItems)&&m.minItems===0||i.IsArray(m.items)&&m.items.every(Ne=>ze(Ne)))}d.TTuple=Ve;function Yi(m){return we(m,"Undefined")&&m.type==="undefined"&&R(m.$id)}d.TUndefined=Yi;function qs(m){return Ur(m)&&m.anyOf.every(Ne=>$r(Ne)||A(Ne))}d.TUnionLiteral=qs;function Ur(m){return we(m,"Union")&&R(m.$id)&&i.IsObject(m)&&i.IsArray(m.anyOf)&&m.anyOf.every(Ne=>ze(Ne))}d.TUnion=Ur;function dn(m){return we(m,"Uint8Array")&&m.type==="Uint8Array"&&R(m.$id)&&N(m.minByteLength)&&N(m.maxByteLength)}d.TUint8Array=dn;function nt(m){return we(m,"Unknown")&&R(m.$id)}d.TUnknown=nt;function Qi(m){return we(m,"Unsafe")}d.TUnsafe=Qi;function Zn(m){return we(m,"Void")&&m.type==="void"&&R(m.$id)}d.TVoid=Zn;function Gs(m){return i.IsObject(m)&&m[e.Readonly]==="Readonly"}d.TReadonly=Gs;function Ws(m){return i.IsObject(m)&&m[e.Optional]==="Optional"}d.TOptional=Ws;function ze(m){return i.IsObject(m)&&(v(m)||b(m)||te(m)||q(m)||U(m)||ie(m)||ge(m)||_e(m)||Be(m)||Fe(m)||Rr(m)||$(m)||me(m)||se(m)||he(m)||Se(m)||ke(m)||rt(m)||Ze(m)||er(m)||fn(m)||ln(m)||Pr(m)||Xi(m)||Ve(m)||Yi(m)||Ur(m)||dn(m)||nt(m)||Qi(m)||Zn(m)||hr(m)&&t.Has(m[e.Kind]))}d.TSchema=ze})(s||(e.TypeGuard=s={}));var a;(function(d){function w(C){return C[e.Kind]==="Intersect"?C.allOf.every(D=>w(D)):C[e.Kind]==="Union"?C.anyOf.some(D=>w(D)):C[e.Kind]==="Undefined"?!0:C[e.Kind]==="Not"?!w(C.not):!1}d.Check=w})(a||(e.ExtendsUndefined=a={}));var u=class extends r{};e.TypeExtendsError=u;var c;(function(d){d[d.Union=0]="Union",d[d.True=1]="True",d[d.False=2]="False"})(c||(e.TypeExtendsResult=c={}));var l;(function(d){function w(h){return h===c.False?h:c.True}function C(h){throw new u(h)}function D(h){return s.TNever(h)||s.TIntersect(h)||s.TUnion(h)||s.TUnknown(h)||s.TAny(h)}function P(h,y){return s.TNever(y)?we(h,y):s.TIntersect(y)?_e(h,y):s.TUnion(y)?Hs(h,y):s.TUnknown(y)?bc(h,y):s.TAny(y)?N(h,y):C("StructuralRight")}function N(h,y){return c.True}function g(h,y){return s.TIntersect(y)?_e(h,y):s.TUnion(y)&&y.anyOf.some(Oe=>s.TAny(Oe)||s.TUnknown(Oe))?c.True:s.TUnion(y)?c.Union:s.TUnknown(y)||s.TAny(y)?c.True:c.Union}function R(h,y){return s.TUnknown(h)?c.False:s.TAny(h)?c.Union:s.TNever(h)?c.True:c.False}function _(h,y){return s.TObject(y)&&Pr(y)?c.True:D(y)?P(h,y):s.TArray(y)?w(Ce(h.items,y.items)):c.False}function f(h,y){return D(y)?P(h,y):s.TAsyncIterator(y)?w(Ce(h.items,y.items)):c.False}function I(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):s.TBigInt(y)?c.True:c.False}function v(h,y){return s.TLiteral(h)&&i.IsBoolean(h.const)||s.TBoolean(h)?c.True:c.False}function b(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):s.TBoolean(y)?c.True:c.False}function U(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TConstructor(y)?h.parameters.length>y.parameters.length?c.False:h.parameters.every((Oe,Ut)=>w(Ce(y.parameters[Ut],Oe))===c.True)?w(Ce(h.returns,y.returns)):c.False:c.False}function q(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):s.TDate(y)?c.True:c.False}function te(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TFunction(y)?h.parameters.length>y.parameters.length?c.False:h.parameters.every((Oe,Ut)=>w(Ce(y.parameters[Ut],Oe))===c.True)?w(Ce(h.returns,y.returns)):c.False:c.False}function ie(h,y){return s.TLiteral(h)&&i.IsNumber(h.const)||s.TNumber(h)||s.TInteger(h)?c.True:c.False}function ge(h,y){return s.TInteger(y)||s.TNumber(y)?c.True:D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):c.False}function _e(h,y){return y.allOf.every(Oe=>Ce(h,Oe)===c.True)?c.True:c.False}function Be(h,y){return h.allOf.some(Oe=>Ce(Oe,y)===c.True)?c.True:c.False}function Fe(h,y){return D(y)?P(h,y):s.TIterator(y)?w(Ce(h.items,y.items)):c.False}function Rr(h,y){return s.TLiteral(y)&&y.const===h.const?c.True:D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):s.TString(y)?Zn(h,y):s.TNumber(y)?$(h,y):s.TInteger(y)?ie(h,y):s.TBoolean(y)?v(h,y):c.False}function we(h,y){return c.False}function hr(h,y){return c.True}function $r(h){let[y,Oe]=[h,0];for(;s.TNot(y);)y=y.not,Oe+=1;return Oe%2===0?y:e.Type.Unknown()}function A(h,y){return s.TNot(h)?Ce($r(h),y):s.TNot(y)?Ce(h,$r(y)):C("Invalid fallthrough for Not")}function de(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):s.TNull(y)?c.True:c.False}function $(h,y){return s.TLiteralNumber(h)||s.TNumber(h)||s.TInteger(h)?c.True:c.False}function me(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):s.TInteger(y)||s.TNumber(y)?c.True:c.False}function se(h,y){return Object.getOwnPropertyNames(h.properties).length===y}function he(h){return Pr(h)}function Se(h){return se(h,0)||se(h,1)&&"description"in h.properties&&s.TUnion(h.properties.description)&&h.properties.description.anyOf.length===2&&(s.TString(h.properties.description.anyOf[0])&&s.TUndefined(h.properties.description.anyOf[1])||s.TString(h.properties.description.anyOf[1])&&s.TUndefined(h.properties.description.anyOf[0]))}function ke(h){return se(h,0)}function rt(h){return se(h,0)}function Ze(h){return se(h,0)}function it(h){return se(h,0)}function er(h){return Pr(h)}function fn(h){let y=e.Type.Number();return se(h,0)||se(h,1)&&"length"in h.properties&&w(Ce(h.properties.length,y))===c.True}function ln(h){return se(h,0)}function Pr(h){let y=e.Type.Number();return se(h,0)||se(h,1)&&"length"in h.properties&&w(Ce(h.properties.length,y))===c.True}function Xi(h){let y=e.Type.Function([e.Type.Any()],e.Type.Any());return se(h,0)||se(h,1)&&"then"in h.properties&&w(Ce(h.properties.then,y))===c.True}function Qn(h,y){return Ce(h,y)===c.False||s.TOptional(h)&&!s.TOptional(y)?c.False:c.True}function Ve(h,y){return s.TUnknown(h)?c.False:s.TAny(h)?c.Union:s.TNever(h)||s.TLiteralString(h)&&he(y)||s.TLiteralNumber(h)&&ke(y)||s.TLiteralBoolean(h)&&rt(y)||s.TSymbol(h)&&Se(y)||s.TBigInt(h)&&Ze(y)||s.TString(h)&&he(y)||s.TSymbol(h)&&Se(y)||s.TNumber(h)&&ke(y)||s.TInteger(h)&&ke(y)||s.TBoolean(h)&&rt(y)||s.TUint8Array(h)&&er(y)||s.TDate(h)&&it(y)||s.TConstructor(h)&&ln(y)||s.TFunction(h)&&fn(y)?c.True:s.TRecord(h)&&s.TString(Ur(h))?y[e.Hint]==="Record"?c.True:c.False:s.TRecord(h)&&s.TNumber(Ur(h))?se(y,0)?c.True:c.False:c.False}function Yi(h,y){return D(y)?P(h,y):s.TRecord(y)?nt(h,y):s.TObject(y)?(()=>{for(let Oe of Object.getOwnPropertyNames(y.properties)){if(!(Oe in h.properties)&&!s.TOptional(y.properties[Oe]))return c.False;if(s.TOptional(y.properties[Oe]))return c.True;if(Qn(h.properties[Oe],y.properties[Oe])===c.False)return c.False}return c.True})():c.False}function qs(h,y){return D(y)?P(h,y):s.TObject(y)&&Xi(y)?c.True:s.TPromise(y)?w(Ce(h.item,y.item)):c.False}function Ur(h){return e.PatternNumberExact in h.patternProperties?e.Type.Number():e.PatternStringExact in h.patternProperties?e.Type.String():C("Unknown record key pattern")}function dn(h){return e.PatternNumberExact in h.patternProperties?h.patternProperties[e.PatternNumberExact]:e.PatternStringExact in h.patternProperties?h.patternProperties[e.PatternStringExact]:C("Unable to get record value schema")}function nt(h,y){let[Oe,Ut]=[Ur(y),dn(y)];return s.TLiteralString(h)&&s.TNumber(Oe)&&w(Ce(h,Ut))===c.True?c.True:s.TUint8Array(h)&&s.TNumber(Oe)||s.TString(h)&&s.TNumber(Oe)||s.TArray(h)&&s.TNumber(Oe)?Ce(h,Ut):s.TObject(h)?(()=>{for(let wy of Object.getOwnPropertyNames(h.properties))if(Qn(Ut,h.properties[wy])===c.False)return c.False;return c.True})():c.False}function Qi(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?Ce(dn(h),dn(y)):c.False}function Zn(h,y){return s.TLiteral(h)&&i.IsString(h.const)||s.TString(h)?c.True:c.False}function Gs(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):s.TString(y)?c.True:c.False}function Ws(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):s.TSymbol(y)?c.True:c.False}function ze(h,y){return s.TTemplateLiteral(h)?Ce(F.Resolve(h),y):s.TTemplateLiteral(y)?Ce(h,F.Resolve(y)):C("Invalid fallthrough for TemplateLiteral")}function m(h,y){return s.TArray(y)&&h.items!==void 0&&h.items.every(Oe=>Ce(Oe,y.items)===c.True)}function Ne(h,y){return s.TNever(h)?c.True:s.TUnknown(h)?c.False:s.TAny(h)?c.Union:c.False}function bt(h,y){return D(y)?P(h,y):s.TObject(y)&&Pr(y)||s.TArray(y)&&m(h,y)?c.True:s.TTuple(y)?i.IsUndefined(h.items)&&!i.IsUndefined(y.items)||!i.IsUndefined(h.items)&&i.IsUndefined(y.items)?c.False:i.IsUndefined(h.items)&&!i.IsUndefined(y.items)||h.items.every((Oe,Ut)=>Ce(Oe,y.items[Ut])===c.True)?c.True:c.False:c.False}function hy(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):s.TUint8Array(y)?c.True:c.False}function yy(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):s.TVoid(y)?by(h,y):s.TUndefined(y)?c.True:c.False}function Hs(h,y){return y.anyOf.some(Oe=>Ce(h,Oe)===c.True)?c.True:c.False}function gy(h,y){return h.anyOf.every(Oe=>Ce(Oe,y)===c.True)?c.True:c.False}function bc(h,y){return c.True}function my(h,y){return s.TNever(y)?we(h,y):s.TIntersect(y)?_e(h,y):s.TUnion(y)?Hs(h,y):s.TAny(y)?N(h,y):s.TString(y)?Zn(h,y):s.TNumber(y)?$(h,y):s.TInteger(y)?ie(h,y):s.TBoolean(y)?v(h,y):s.TArray(y)?R(h,y):s.TTuple(y)?Ne(h,y):s.TObject(y)?Ve(h,y):s.TUnknown(y)?c.True:c.False}function by(h,y){return s.TUndefined(h)||s.TUndefined(h)?c.True:c.False}function vy(h,y){return s.TIntersect(y)?_e(h,y):s.TUnion(y)?Hs(h,y):s.TUnknown(y)?bc(h,y):s.TAny(y)?N(h,y):s.TObject(y)?Ve(h,y):s.TVoid(y)?c.True:c.False}function Ce(h,y){return s.TTemplateLiteral(h)||s.TTemplateLiteral(y)?ze(h,y):s.TNot(h)||s.TNot(y)?A(h,y):s.TAny(h)?g(h,y):s.TArray(h)?_(h,y):s.TBigInt(h)?I(h,y):s.TBoolean(h)?b(h,y):s.TAsyncIterator(h)?f(h,y):s.TConstructor(h)?U(h,y):s.TDate(h)?q(h,y):s.TFunction(h)?te(h,y):s.TInteger(h)?ge(h,y):s.TIntersect(h)?Be(h,y):s.TIterator(h)?Fe(h,y):s.TLiteral(h)?Rr(h,y):s.TNever(h)?hr(h,y):s.TNull(h)?de(h,y):s.TNumber(h)?me(h,y):s.TObject(h)?Yi(h,y):s.TRecord(h)?Qi(h,y):s.TString(h)?Gs(h,y):s.TSymbol(h)?Ws(h,y):s.TTuple(h)?bt(h,y):s.TPromise(h)?qs(h,y):s.TUint8Array(h)?hy(h,y):s.TUndefined(h)?yy(h,y):s.TUnion(h)?gy(h,y):s.TUnknown(h)?my(h,y):s.TVoid(h)?vy(h,y):C(`Unknown left type operand '${h[e.Kind]}'`)}function _y(h,y){return Ce(h,y)}d.Extends=_y})(l||(e.TypeExtends=l={}));var p;(function(d){function w(_){return _.map(f=>N(f))}function C(_){return new Date(_.getTime())}function D(_){return new Uint8Array(_)}function P(_){let f=Object.getOwnPropertyNames(_).reduce((v,b)=>({...v,[b]:N(_[b])}),{}),I=Object.getOwnPropertySymbols(_).reduce((v,b)=>({...v,[b]:N(_[b])}),{});return{...f,...I}}function N(_){return i.IsArray(_)?w(_):i.IsDate(_)?C(_):i.IsUint8Array(_)?D(_):i.IsObject(_)?P(_):_}function g(_){return _.map(f=>R(f))}d.Rest=g;function R(_,f={}){return{...N(_),...f}}d.Type=R})(p||(e.TypeClone=p={}));var S;(function(d){function w(U){return U.map(q=>{let{[e.Optional]:te,...ie}=p.Type(q);return ie})}function C(U){return U.every(q=>s.TOptional(q))}function D(U){return U.some(q=>s.TOptional(q))}function P(U){return C(U.allOf)?e.Type.Optional(e.Type.Intersect(w(U.allOf))):U}function N(U){return D(U.anyOf)?e.Type.Optional(e.Type.Union(w(U.anyOf))):U}function g(U){return U[e.Kind]==="Intersect"?P(U):U[e.Kind]==="Union"?N(U):U}function R(U,q){let te=U.allOf.reduce((ie,ge)=>{let _e=v(ge,q);return _e[e.Kind]==="Never"?ie:[...ie,_e]},[]);return g(e.Type.Intersect(te))}function _(U,q){let te=U.anyOf.map(ie=>v(ie,q));return g(e.Type.Union(te))}function f(U,q){let te=U.properties[q];return i.IsUndefined(te)?e.Type.Never():e.Type.Union([te])}function I(U,q){let te=U.items;if(i.IsUndefined(te))return e.Type.Never();let ie=te[q];return i.IsUndefined(ie)?e.Type.Never():ie}function v(U,q){return U[e.Kind]==="Intersect"?R(U,q):U[e.Kind]==="Union"?_(U,q):U[e.Kind]==="Object"?f(U,q):U[e.Kind]==="Tuple"?I(U,q):e.Type.Never()}function b(U,q,te={}){let ie=q.map(ge=>v(U,ge.toString()));return g(e.Type.Union(ie,te))}d.Resolve=b})(S||(e.IndexedAccessor=S={}));var x;(function(d){function w(I){let[v,b]=[I.slice(0,1),I.slice(1)];return`${v.toLowerCase()}${b}`}function C(I){let[v,b]=[I.slice(0,1),I.slice(1)];return`${v.toUpperCase()}${b}`}function D(I){return I.toUpperCase()}function P(I){return I.toLowerCase()}function N(I,v){let b=V.ParseExact(I.pattern);if(!L.Check(b))return{...I,pattern:g(I.pattern,v)};let te=[...j.Generate(b)].map(_e=>e.Type.Literal(_e)),ie=R(te,v),ge=e.Type.Union(ie);return e.Type.TemplateLiteral([ge])}function g(I,v){return typeof I=="string"?v==="Uncapitalize"?w(I):v==="Capitalize"?C(I):v==="Uppercase"?D(I):v==="Lowercase"?P(I):I:I.toString()}function R(I,v){if(I.length===0)return[];let[b,...U]=I;return[f(b,v),...R(U,v)]}function _(I,v){return s.TTemplateLiteral(I)?N(I,v):s.TUnion(I)?e.Type.Union(R(I.anyOf,v)):s.TLiteral(I)?e.Type.Literal(g(I.const,v)):I}function f(I,v){return _(I,v)}d.Map=f})(x||(e.Intrinsic=x={}));var E;(function(d){function w(g,R){return e.Type.Intersect(g.allOf.map(_=>P(_,R)),{...g})}function C(g,R){return e.Type.Union(g.anyOf.map(_=>P(_,R)),{...g})}function D(g,R){return R(g)}function P(g,R){return g[e.Kind]==="Intersect"?w(g,R):g[e.Kind]==="Union"?C(g,R):g[e.Kind]==="Object"?D(g,R):g}function N(g,R,_){return{...P(p.Type(g),R),..._}}d.Map=N})(E||(e.ObjectMap=E={}));var z;(function(d){function w(f){return f[0]==="^"&&f[f.length-1]==="$"?f.slice(1,f.length-1):f}function C(f,I){return f.allOf.reduce((v,b)=>[...v,...g(b,I)],[])}function D(f,I){let v=f.anyOf.map(b=>g(b,I));return[...v.reduce((b,U)=>U.map(q=>v.every(te=>te.includes(q))?b.add(q):b)[0],new Set)]}function P(f,I){return Object.getOwnPropertyNames(f.properties)}function N(f,I){return I.includePatterns?Object.getOwnPropertyNames(f.patternProperties):[]}function g(f,I){return s.TIntersect(f)?C(f,I):s.TUnion(f)?D(f,I):s.TObject(f)?P(f,I):s.TRecord(f)?N(f,I):[]}function R(f,I){return[...new Set(g(f,I))]}d.ResolveKeys=R;function _(f){return`^(${R(f,{includePatterns:!0}).map(b=>`(${w(b)})`).join("|")})$`}d.ResolvePattern=_})(z||(e.KeyResolver=z={}));var W=class extends r{};e.KeyArrayResolverError=W;var T;(function(d){function w(C){return Array.isArray(C)?C:s.TUnionLiteral(C)?C.anyOf.map(D=>D.const.toString()):s.TLiteral(C)?[C.const]:s.TTemplateLiteral(C)?(()=>{let D=V.ParseExact(C.pattern);if(!L.Check(D))throw new W("Cannot resolve keys from infinite template expression");return[...j.Generate(D)]})():[]}d.Resolve=w})(T||(e.KeyArrayResolver=T={}));var k;(function(d){function*w(D){for(let P of D.anyOf)P[e.Kind]==="Union"?yield*w(P):yield P}function C(D){return e.Type.Union([...w(D)],{...D})}d.Resolve=C})(k||(e.UnionResolver=k={}));var G=class extends r{};e.TemplateLiteralPatternError=G;var H;(function(d){function w(N){throw new G(N)}function C(N){return N.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function D(N,g){return s.TTemplateLiteral(N)?N.pattern.slice(1,N.pattern.length-1):s.TUnion(N)?`(${N.anyOf.map(R=>D(R,g)).join("|")})`:s.TNumber(N)?`${g}${e.PatternNumber}`:s.TInteger(N)?`${g}${e.PatternNumber}`:s.TBigInt(N)?`${g}${e.PatternNumber}`:s.TString(N)?`${g}${e.PatternString}`:s.TLiteral(N)?`${g}${C(N.const.toString())}`:s.TBoolean(N)?`${g}${e.PatternBoolean}`:w(`Unexpected Kind '${N[e.Kind]}'`)}function P(N){return`^${N.map(g=>D(g,"")).join("")}$`}d.Create=P})(H||(e.TemplateLiteralPattern=H={}));var F;(function(d){function w(C){let D=V.ParseExact(C.pattern);if(!L.Check(D))return e.Type.String();let P=[...j.Generate(D)].map(N=>e.Type.Literal(N));return e.Type.Union(P)}d.Resolve=w})(F||(e.TemplateLiteralResolver=F={}));var Y=class extends r{};e.TemplateLiteralParserError=Y;var V;(function(d){function w(U,q,te){return U[q]===te&&U.charCodeAt(q-1)!==92}function C(U,q){return w(U,q,"(")}function D(U,q){return w(U,q,")")}function P(U,q){return w(U,q,"|")}function N(U){if(!(C(U,0)&&D(U,U.length-1)))return!1;let q=0;for(let te=0;te<U.length;te++)if(C(U,te)&&(q+=1),D(U,te)&&(q-=1),q===0&&te!==U.length-1)return!1;return!0}function g(U){return U.slice(1,U.length-1)}function R(U){let q=0;for(let te=0;te<U.length;te++)if(C(U,te)&&(q+=1),D(U,te)&&(q-=1),P(U,te)&&q===0)return!0;return!1}function _(U){for(let q=0;q<U.length;q++)if(C(U,q))return!0;return!1}function f(U){let[q,te]=[0,0],ie=[];for(let _e=0;_e<U.length;_e++)if(C(U,_e)&&(q+=1),D(U,_e)&&(q-=1),P(U,_e)&&q===0){let Be=U.slice(te,_e);Be.length>0&&ie.push(v(Be)),te=_e+1}let ge=U.slice(te);return ge.length>0&&ie.push(v(ge)),ie.length===0?{type:"const",const:""}:ie.length===1?ie[0]:{type:"or",expr:ie}}function I(U){function q(ge,_e){if(!C(ge,_e))throw new Y("TemplateLiteralParser: Index must point to open parens");let Be=0;for(let Fe=_e;Fe<ge.length;Fe++)if(C(ge,Fe)&&(Be+=1),D(ge,Fe)&&(Be-=1),Be===0)return[_e,Fe];throw new Y("TemplateLiteralParser: Unclosed group parens in expression")}function te(ge,_e){for(let Be=_e;Be<ge.length;Be++)if(C(ge,Be))return[_e,Be];return[_e,ge.length]}let ie=[];for(let ge=0;ge<U.length;ge++)if(C(U,ge)){let[_e,Be]=q(U,ge),Fe=U.slice(_e,Be+1);ie.push(v(Fe)),ge=Be}else{let[_e,Be]=te(U,ge),Fe=U.slice(_e,Be);Fe.length>0&&ie.push(v(Fe)),ge=Be-1}return ie.length===0?{type:"const",const:""}:ie.length===1?ie[0]:{type:"and",expr:ie}}function v(U){return N(U)?v(g(U)):R(U)?f(U):_(U)?I(U):{type:"const",const:U}}d.Parse=v;function b(U){return v(U.slice(1,U.length-1))}d.ParseExact=b})(V||(e.TemplateLiteralParser=V={}));var ae=class extends r{};e.TemplateLiteralFiniteError=ae;var L;(function(d){function w(g){throw new ae(g)}function C(g){return g.type==="or"&&g.expr.length===2&&g.expr[0].type==="const"&&g.expr[0].const==="0"&&g.expr[1].type==="const"&&g.expr[1].const==="[1-9][0-9]*"}function D(g){return g.type==="or"&&g.expr.length===2&&g.expr[0].type==="const"&&g.expr[0].const==="true"&&g.expr[1].type==="const"&&g.expr[1].const==="false"}function P(g){return g.type==="const"&&g.const===".*"}function N(g){return D(g)?!0:C(g)||P(g)?!1:g.type==="and"?g.expr.every(R=>N(R)):g.type==="or"?g.expr.every(R=>N(R)):g.type==="const"?!0:w("Unknown expression type")}d.Check=N})(L||(e.TemplateLiteralFinite=L={}));var M=class extends r{};e.TemplateLiteralGeneratorError=M;var j;(function(d){function*w(g){if(g.length===1)return yield*g[0];for(let R of g[0])for(let _ of w(g.slice(1)))yield`${R}${_}`}function*C(g){return yield*w(g.expr.map(R=>[...N(R)]))}function*D(g){for(let R of g.expr)yield*N(R)}function*P(g){return yield g.const}function*N(g){return g.type==="and"?yield*C(g):g.type==="or"?yield*D(g):g.type==="const"?yield*P(g):(()=>{throw new M("Unknown expression")})()}d.Generate=N})(j||(e.TemplateLiteralGenerator=j={}));var ne;(function(d){function*w(N){let g=N.trim().replace(/"|'/g,"");return g==="boolean"?yield e.Type.Boolean():g==="number"?yield e.Type.Number():g==="bigint"?yield e.Type.BigInt():g==="string"?yield e.Type.String():yield(()=>{let R=g.split("|").map(_=>e.Type.Literal(_.trim()));return R.length===0?e.Type.Never():R.length===1?R[0]:e.Type.Union(R)})()}function*C(N){if(N[1]!=="{"){let g=e.Type.Literal("$"),R=D(N.slice(1));return yield*[g,...R]}for(let g=2;g<N.length;g++)if(N[g]==="}"){let R=w(N.slice(2,g)),_=D(N.slice(g+1));return yield*[...R,..._]}yield e.Type.Literal(N)}function*D(N){for(let g=0;g<N.length;g++)if(N[g]==="$"){let R=e.Type.Literal(N.slice(0,g)),_=C(N.slice(g));return yield*[R,..._]}yield e.Type.Literal(N)}function P(N){return[...D(N)]}d.Parse=P})(ne||(e.TemplateLiteralDslParser=ne={}));var re=class{constructor(d){this.schema=d}Decode(d){return new O(this.schema,d)}};e.TransformDecodeBuilder=re;var O=class{constructor(d,w){this.schema=d,this.decode=w}Encode(d){let w=p.Type(this.schema);return s.TTransform(w)?(()=>{let P={Encode:N=>w[e.Transform].Encode(d(N)),Decode:N=>this.decode(w[e.Transform].Decode(N))};return{...w,[e.Transform]:P}})():(()=>{let C={Decode:this.decode,Encode:d};return{...w,[e.Transform]:C}})()}};e.TransformEncodeBuilder=O;var J=0,oe=class extends r{};e.TypeBuilderError=oe;var X=class{Create(d){return d}Throw(d){throw new oe(d)}Discard(d,w){return w.reduce((C,D)=>{let{[D]:P,...N}=C;return N},d)}Strict(d){return JSON.parse(JSON.stringify(d))}};e.TypeBuilder=X;var Z=class extends X{ReadonlyOptional(d){return this.Readonly(this.Optional(d))}Readonly(d){return{...p.Type(d),[e.Readonly]:"Readonly"}}Optional(d){return{...p.Type(d),[e.Optional]:"Optional"}}Any(d={}){return this.Create({...d,[e.Kind]:"Any"})}Array(d,w={}){return this.Create({...w,[e.Kind]:"Array",type:"array",items:p.Type(d)})}Boolean(d={}){return this.Create({...d,[e.Kind]:"Boolean",type:"boolean"})}Capitalize(d,w={}){return{...x.Map(p.Type(d),"Capitalize"),...w}}Composite(d,w){let C=e.Type.Intersect(d,{}),P=z.ResolveKeys(C,{includePatterns:!1}).reduce((N,g)=>({...N,[g]:e.Type.Index(C,[g])}),{});return e.Type.Object(P,w)}Enum(d,w={}){if(i.IsUndefined(d))return this.Throw("Enum undefined or empty");let C=Object.getOwnPropertyNames(d).filter(N=>isNaN(N)).map(N=>d[N]),P=[...new Set(C)].map(N=>e.Type.Literal(N));return this.Union(P,{...w,[e.Hint]:"Enum"})}Extends(d,w,C,D,P={}){switch(l.Extends(d,w)){case c.Union:return this.Union([p.Type(C,P),p.Type(D,P)]);case c.True:return p.Type(C,P);case c.False:return p.Type(D,P)}}Exclude(d,w,C={}){return s.TTemplateLiteral(d)?this.Exclude(F.Resolve(d),w,C):s.TTemplateLiteral(w)?this.Exclude(d,F.Resolve(w),C):s.TUnion(d)?(()=>{let D=d.anyOf.filter(P=>l.Extends(P,w)===c.False);return D.length===1?p.Type(D[0],C):this.Union(D,C)})():l.Extends(d,w)!==c.False?this.Never(C):p.Type(d,C)}Extract(d,w,C={}){return s.TTemplateLiteral(d)?this.Extract(F.Resolve(d),w,C):s.TTemplateLiteral(w)?this.Extract(d,F.Resolve(w),C):s.TUnion(d)?(()=>{let D=d.anyOf.filter(P=>l.Extends(P,w)!==c.False);return D.length===1?p.Type(D[0],C):this.Union(D,C)})():l.Extends(d,w)!==c.False?p.Type(d,C):this.Never(C)}Index(d,w,C={}){return s.TArray(d)&&s.TNumber(w)?p.Type(d.items,C):s.TTuple(d)&&s.TNumber(w)?(()=>{let P=(i.IsUndefined(d.items)?[]:d.items).map(N=>p.Type(N));return this.Union(P,C)})():(()=>{let D=T.Resolve(w),P=p.Type(d);return S.Resolve(P,D,C)})()}Integer(d={}){return this.Create({...d,[e.Kind]:"Integer",type:"integer"})}Intersect(d,w={}){if(d.length===0)return e.Type.Never();if(d.length===1)return p.Type(d[0],w);d.some(N=>s.TTransform(N))&&this.Throw("Cannot intersect transform types");let C=d.every(N=>s.TObject(N)),D=p.Rest(d),P=s.TSchema(w.unevaluatedProperties)?{unevaluatedProperties:p.Type(w.unevaluatedProperties)}:{};return w.unevaluatedProperties===!1||s.TSchema(w.unevaluatedProperties)||C?this.Create({...w,...P,[e.Kind]:"Intersect",type:"object",allOf:D}):this.Create({...w,...P,[e.Kind]:"Intersect",allOf:D})}KeyOf(d,w={}){return s.TRecord(d)?(()=>{let C=Object.getOwnPropertyNames(d.patternProperties)[0];return C===e.PatternNumberExact?this.Number(w):C===e.PatternStringExact?this.String(w):this.Throw("Unable to resolve key type from Record key pattern")})():s.TTuple(d)?(()=>{let D=(i.IsUndefined(d.items)?[]:d.items).map((P,N)=>e.Type.Literal(N.toString()));return this.Union(D,w)})():s.TArray(d)?this.Number(w):(()=>{let C=z.ResolveKeys(d,{includePatterns:!1});if(C.length===0)return this.Never(w);let D=C.map(P=>this.Literal(P));return this.Union(D,w)})()}Literal(d,w={}){return this.Create({...w,[e.Kind]:"Literal",const:d,type:typeof d})}Lowercase(d,w={}){return{...x.Map(p.Type(d),"Lowercase"),...w}}Never(d={}){return this.Create({...d,[e.Kind]:"Never",not:{}})}Not(d,w){return this.Create({...w,[e.Kind]:"Not",not:p.Type(d)})}Null(d={}){return this.Create({...d,[e.Kind]:"Null",type:"null"})}Number(d={}){return this.Create({...d,[e.Kind]:"Number",type:"number"})}Object(d,w={}){let C=Object.getOwnPropertyNames(d),D=C.filter(R=>s.TOptional(d[R])),P=C.filter(R=>!D.includes(R)),N=s.TSchema(w.additionalProperties)?{additionalProperties:p.Type(w.additionalProperties)}:{},g=C.reduce((R,_)=>({...R,[_]:p.Type(d[_])}),{});return P.length>0?this.Create({...w,...N,[e.Kind]:"Object",type:"object",properties:g,required:P}):this.Create({...w,...N,[e.Kind]:"Object",type:"object",properties:g})}Omit(d,w,C={}){let D=T.Resolve(w);return E.Map(this.Discard(p.Type(d),["$id",e.Transform]),P=>{i.IsArray(P.required)&&(P.required=P.required.filter(N=>!D.includes(N)),P.required.length===0&&delete P.required);for(let N of Object.getOwnPropertyNames(P.properties))D.includes(N)&&delete P.properties[N];return this.Create(P)},C)}Partial(d,w={}){return E.Map(this.Discard(p.Type(d),["$id",e.Transform]),C=>{let D=Object.getOwnPropertyNames(C.properties).reduce((P,N)=>({...P,[N]:this.Optional(C.properties[N])}),{});return this.Object(D,this.Discard(C,["required"]))},w)}Pick(d,w,C={}){let D=T.Resolve(w);return E.Map(this.Discard(p.Type(d),["$id",e.Transform]),P=>{i.IsArray(P.required)&&(P.required=P.required.filter(N=>D.includes(N)),P.required.length===0&&delete P.required);for(let N of Object.getOwnPropertyNames(P.properties))D.includes(N)||delete P.properties[N];return this.Create(P)},C)}Record(d,w,C={}){return s.TTemplateLiteral(d)?(()=>{let D=V.ParseExact(d.pattern);return L.Check(D)?this.Object([...j.Generate(D)].reduce((P,N)=>({...P,[N]:p.Type(w)}),{}),C):this.Create({...C,[e.Kind]:"Record",type:"object",patternProperties:{[d.pattern]:p.Type(w)}})})():s.TUnion(d)?(()=>{let D=k.Resolve(d);if(s.TUnionLiteral(D)){let P=D.anyOf.reduce((N,g)=>({...N,[g.const]:p.Type(w)}),{});return this.Object(P,{...C,[e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():s.TLiteral(d)?i.IsString(d.const)||i.IsNumber(d.const)?this.Object({[d.const]:p.Type(w)},C):this.Throw("Record key of type literal is not of type string or number"):s.TInteger(d)||s.TNumber(d)?this.Create({...C,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:p.Type(w)}}):s.TString(d)?(()=>{let D=i.IsUndefined(d.pattern)?e.PatternStringExact:d.pattern;return this.Create({...C,[e.Kind]:"Record",type:"object",patternProperties:{[D]:p.Type(w)}})})():this.Never()}Recursive(d,w={}){i.IsUndefined(w.$id)&&(w.$id=`T${J++}`);let C=d({[e.Kind]:"This",$ref:`${w.$id}`});return C.$id=w.$id,this.Create({...w,[e.Hint]:"Recursive",...C})}Ref(d,w={}){return i.IsString(d)?this.Create({...w,[e.Kind]:"Ref",$ref:d}):(i.IsUndefined(d.$id)&&this.Throw("Reference target type must specify an $id"),this.Create({...w,[e.Kind]:"Ref",$ref:d.$id}))}Required(d,w={}){return E.Map(this.Discard(p.Type(d),["$id",e.Transform]),C=>{let D=Object.getOwnPropertyNames(C.properties).reduce((P,N)=>({...P,[N]:this.Discard(C.properties[N],[e.Optional])}),{});return this.Object(D,C)},w)}Rest(d){return s.TTuple(d)&&!i.IsUndefined(d.items)?p.Rest(d.items):s.TIntersect(d)?p.Rest(d.allOf):s.TUnion(d)?p.Rest(d.anyOf):[]}String(d={}){return this.Create({...d,[e.Kind]:"String",type:"string"})}TemplateLiteral(d,w={}){let C=i.IsString(d)?H.Create(ne.Parse(d)):H.Create(d);return this.Create({...w,[e.Kind]:"TemplateLiteral",type:"string",pattern:C})}Transform(d){return new re(d)}Tuple(d,w={}){let[C,D,P]=[!1,d.length,d.length],N=p.Rest(d),g=d.length>0?{...w,[e.Kind]:"Tuple",type:"array",items:N,additionalItems:C,minItems:D,maxItems:P}:{...w,[e.Kind]:"Tuple",type:"array",minItems:D,maxItems:P};return this.Create(g)}Uncapitalize(d,w={}){return{...x.Map(p.Type(d),"Uncapitalize"),...w}}Union(d,w={}){return s.TTemplateLiteral(d)?F.Resolve(d):(()=>{let C=d;if(C.length===0)return this.Never(w);if(C.length===1)return this.Create(p.Type(C[0],w));let D=p.Rest(C);return this.Create({...w,[e.Kind]:"Union",anyOf:D})})()}Unknown(d={}){return this.Create({...d,[e.Kind]:"Unknown"})}Unsafe(d={}){return this.Create({...d,[e.Kind]:d[e.Kind]||"Unsafe"})}Uppercase(d,w={}){return{...x.Map(p.Type(d),"Uppercase"),...w}}};e.JsonTypeBuilder=Z;var pe=class extends Z{AsyncIterator(d,w={}){return this.Create({...w,[e.Kind]:"AsyncIterator",type:"AsyncIterator",items:p.Type(d)})}Awaited(d,w={}){let C=D=>D.length>0?(()=>{let[P,...N]=D;return[this.Awaited(P),...C(N)]})():D;return s.TIntersect(d)?e.Type.Intersect(C(d.allOf)):s.TUnion(d)?e.Type.Union(C(d.anyOf)):s.TPromise(d)?this.Awaited(d.item):p.Type(d,w)}BigInt(d={}){return this.Create({...d,[e.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(d,w={}){return this.Tuple([...d.parameters],{...w})}Constructor(d,w,C){let[D,P]=[p.Rest(d),p.Type(w)];return this.Create({...C,[e.Kind]:"Constructor",type:"Constructor",parameters:D,returns:P})}Date(d={}){return this.Create({...d,[e.Kind]:"Date",type:"Date"})}Function(d,w,C){let[D,P]=[p.Rest(d),p.Type(w)];return this.Create({...C,[e.Kind]:"Function",type:"Function",parameters:D,returns:P})}InstanceType(d,w={}){return p.Type(d.returns,w)}Iterator(d,w={}){return this.Create({...w,[e.Kind]:"Iterator",type:"Iterator",items:p.Type(d)})}Parameters(d,w={}){return this.Tuple(d.parameters,{...w})}Promise(d,w={}){return this.Create({...w,[e.Kind]:"Promise",type:"Promise",item:p.Type(d)})}RegExp(d,w={}){let C=i.IsString(d)?d:d.source;return this.Create({...w,[e.Kind]:"String",type:"string",pattern:C})}RegEx(d,w={}){return this.RegExp(d,w)}ReturnType(d,w={}){return p.Type(d.returns,w)}Symbol(d){return this.Create({...d,[e.Kind]:"Symbol",type:"symbol"})}Undefined(d={}){return this.Create({...d,[e.Kind]:"Undefined",type:"undefined"})}Uint8Array(d={}){return this.Create({...d,[e.Kind]:"Uint8Array",type:"Uint8Array"})}Void(d={}){return this.Create({...d,[e.Kind]:"Void",type:"void"})}};e.JavaScriptTypeBuilder=pe,e.JsonType=new Z,e.Type=new pe}}),Dn=Nt(ur(),1),{String:nv,Optional:iv,Boolean:ov,Object:sv,Number:av}=Dn.Type,uv=nv.bind(Dn.Type),cv=av.bind(Dn.Type),d$=sv.bind(Dn.Type),p$=iv.bind(Dn.Type),fv=ov.bind(Dn.Type),h$=uv(),y$=cv(),g$=fv();function fd(e){return Array.isArray(e)?e:[e]}var lv=Le({"../../../node_modules/.pnpm/browser-or-node@2.1.1/node_modules/browser-or-node/lib/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},r=typeof window<"u"&&typeof window.document<"u",n=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,i=(typeof self>"u"?"undefined":t(self))==="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope",o=typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),s=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u";e.isBrowser=r,e.isWebWorker=i,e.isNode=n,e.isJsDom=o,e.isDeno=s}}),dv=Le({"../../../node_modules/.pnpm/fast-json-stable-stringify@2.1.0/node_modules/fast-json-stable-stringify/index.js"(e,t){"use strict";t.exports=function(r,n){n||(n={}),typeof n=="function"&&(n={cmp:n});var i=typeof n.cycles=="boolean"?n.cycles:!1,o=n.cmp&&function(a){return function(u){return function(c,l){var p={key:c,value:u[c]},S={key:l,value:u[l]};return a(p,S)}}}(n.cmp),s=[];return function a(u){if(u&&u.toJSON&&typeof u.toJSON=="function"&&(u=u.toJSON()),u!==void 0){if(typeof u=="number")return isFinite(u)?""+u:"null";if(typeof u!="object")return JSON.stringify(u);var c,l;if(Array.isArray(u)){for(l="[",c=0;c<u.length;c++)c&&(l+=","),l+=a(u[c])||"null";return l+"]"}if(u===null)return"null";if(s.indexOf(u)!==-1){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var p=s.push(u)-1,S=Object.keys(u).sort(o&&o(u));for(l="",c=0;c<S.length;c++){var x=S[c],E=a(u[x]);E&&(l&&(l+=","),l+=JSON.stringify(x)+":"+E)}return s.splice(p,1),"{"+l+"}"}}(r)}}}),pv=Le({"../../../node_modules/.pnpm/safe-stable-stringify@2.4.3/node_modules/safe-stable-stringify/index.js"(e,t){"use strict";var{hasOwnProperty:r}=Object.prototype,n=W();n.configure=W,n.stringify=n,n.default=n,e.stringify=n,e.configure=W,t.exports=n;var i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function o(T){return T.length<5e3&&!i.test(T)?`"${T}"`:JSON.stringify(T)}function s(T){if(T.length>200)return T.sort();for(let k=1;k<T.length;k++){let G=T[k],H=k;for(;H!==0&&T[H-1]>G;)T[H]=T[H-1],H--;T[H]=G}return T}var a=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function u(T){return a.call(T)!==void 0&&T.length!==0}function c(T,k,G){T.length<G&&(G=T.length);let H=k===","?"":" ",F=`"0":${H}${T[0]}`;for(let Y=1;Y<G;Y++)F+=`${k}"${Y}":${H}${T[Y]}`;return F}function l(T){if(r.call(T,"circularValue")){let k=T.circularValue;if(typeof k=="string")return`"${k}"`;if(k==null)return k;if(k===Error||k===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function p(T,k){let G;if(r.call(T,k)&&(G=T[k],typeof G!="boolean"))throw new TypeError(`The "${k}" argument must be of type boolean`);return G===void 0?!0:G}function S(T,k){let G;if(r.call(T,k)){if(G=T[k],typeof G!="number")throw new TypeError(`The "${k}" argument must be of type number`);if(!Number.isInteger(G))throw new TypeError(`The "${k}" argument must be an integer`);if(G<1)throw new RangeError(`The "${k}" argument must be >= 1`)}return G===void 0?1/0:G}function x(T){return T===1?"1 item":`${T} items`}function E(T){let k=new Set;for(let G of T)(typeof G=="string"||typeof G=="number")&&k.add(String(G));return k}function z(T){if(r.call(T,"strict")){let k=T.strict;if(typeof k!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(k)return G=>{let H=`Object can not safely be stringified. Received type ${typeof G}`;throw typeof G!="function"&&(H+=` (${G.toString()})`),new Error(H)}}}function W(T){T={...T};let k=z(T);k&&(T.bigint===void 0&&(T.bigint=!1),"circularValue"in T||(T.circularValue=Error));let G=l(T),H=p(T,"bigint"),F=p(T,"deterministic"),Y=S(T,"maximumDepth"),V=S(T,"maximumBreadth");function ae(re,O,J,oe,X,Z){let pe=O[re];switch(typeof pe=="object"&&pe!==null&&typeof pe.toJSON=="function"&&(pe=pe.toJSON(re)),pe=oe.call(O,re,pe),typeof pe){case"string":return o(pe);case"object":{if(pe===null)return"null";if(J.indexOf(pe)!==-1)return G;let d="",w=",",C=Z;if(Array.isArray(pe)){if(pe.length===0)return"[]";if(Y<J.length+1)return'"[Array]"';J.push(pe),X!==""&&(Z+=X,d+=`
30
+ Use 'override' annotation for methods overridden by subclass.`)}}var Gb=sd(0),Wb=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),wa=0,od=function(){};function Hb(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}Hb(od,Array.prototype);var za=function(e,t,r){ml(n,e);function n(o,s,a,u){var c;return a===void 0&&(a="ObservableArray@"+St()),u===void 0&&(u=!1),c=e.call(this)||this,Hr(function(){var l=new Va(a,s,u,!0);l.proxy_=Oo(c),hl(Oo(c),be,l),o&&o.length&&c.spliceWithArray(0,0,o),Wb&&Object.defineProperty(Oo(c),"0",Gb)}),c}var i=n.prototype;return i.concat=function(){this[be].atom_.reportObserved();for(var s=arguments.length,a=new Array(s),u=0;u<s;u++)a[u]=arguments[u];return Array.prototype.concat.apply(this.slice(),a.map(function(c){return Un(c)?c.slice():c}))},i[r]=function(){var o=this,s=0;return bi({next:function(){return s<o.length?{value:o[s++],done:!1}:{done:!0,value:void 0}}})},Da(n,[{key:"length",get:function(){return this[be].getArrayLength_()},set:function(s){this[be].setArrayLength_(s)}},{key:t,get:function(){return"Array"}}]),n}(od,Symbol.toStringTag,Symbol.iterator);Object.entries(Uo).forEach(function(e){var t=e[0],r=e[1];t!=="concat"&&Lo(za.prototype,t,r)});function sd(e){return{enumerable:!1,configurable:!0,get:function(){return this[be].get_(e)},set:function(r){this[be].set_(e,r)}}}function Jb(e){Wt(za.prototype,""+e,sd(e))}function ad(e){if(e>wa){for(var t=wa;t<e+100;t++)Jb(t);wa=e}}ad(1e3);function Xb(e,t,r){return new za(e,t,r)}function xt(e,t){if(typeof e=="object"&&e!==null){if(Un(e))return t!==void 0&&le(23),e[be].atom_;if(Wr(e))return e.atom_;if(Jt(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||le(25,t,Do(e)),r}if(zr(e)){if(!t)return le(26);var n=e[be].values_.get(t);return n||le(27,t,Do(e)),n}if(Ma(e)||Oi(e)||Po(e))return e}else if(je(e)&&Po(e[be]))return e[be];le(28)}function Ka(e,t){if(e||le(29),t!==void 0)return Ka(xt(e,t));if(Ma(e)||Oi(e)||Po(e)||Jt(e)||Wr(e))return e;if(e[be])return e[be];le(24,e)}function Do(e,t){var r;if(t!==void 0)r=xt(e,t);else{if(qr(e))return e.name;zr(e)||Jt(e)||Wr(e)?r=Ka(e):r=xt(e)}return r.name_}function Hr(e){var t=Kr(),r=zo(!0);At();try{return e()}finally{Ot(),Ko(r),or(t)}}var cl=vi.toString;function qa(e,t,r){return r===void 0&&(r=-1),$a(e,t,r)}function $a(e,t,r,n,i){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var o=typeof e;if(o!=="function"&&o!=="object"&&typeof t!="object")return!1;var s=cl.call(e);if(s!==cl.call(t))return!1;switch(s){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:+e==0?1/+e===1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return typeof Symbol<"u"&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":r>=0&&r++;break}e=fl(e),t=fl(t);var a=s==="[object Array]";if(!a){if(typeof e!="object"||typeof t!="object")return!1;var u=e.constructor,c=t.constructor;if(u!==c&&!(je(u)&&u instanceof u&&je(c)&&c instanceof c)&&"constructor"in e&&"constructor"in t)return!1}if(r===0)return!1;r<0&&(r=-1),n=n||[],i=i||[];for(var l=n.length;l--;)if(n[l]===e)return i[l]===t;if(n.push(e),i.push(t),a){if(l=e.length,l!==t.length)return!1;for(;l--;)if(!$a(e[l],t[l],r-1,n,i))return!1}else{var p=Object.keys(e),S;if(l=p.length,Object.keys(t).length!==l)return!1;for(;l--;)if(S=p[l],!(Et(t,S)&&$a(e[S],t[S],r-1,n,i)))return!1}return n.pop(),i.pop(),!0}function fl(e){return Un(e)?e.slice():Nn(e)||Jt(e)||_i(e)||Wr(e)?Array.from(e.entries()):e}function bi(e){return e[Symbol.iterator]=Yb,e}function Yb(){return this}function ud(e){return e instanceof Object&&typeof e.annotationType_=="string"&&je(e.make_)&&je(e.extend_)}["Symbol","Map","Set"].forEach(function(e){var t=Pa();typeof t[e]>"u"&&le("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:bb,extras:{getDebugName:Do},$mobx:be});var Qb=Object.create,Ga=Object.defineProperty,Zb=Object.getOwnPropertyDescriptor,cd=Object.getOwnPropertyNames,ev=Object.getPrototypeOf,tv=Object.prototype.hasOwnProperty,Le=(e,t)=>function(){return t||(0,e[cd(e)[0]])((t={exports:{}}).exports,t),t.exports},Wa=(e,t)=>{for(var r in t)Ga(e,r,{get:t[r],enumerable:!0})},rv=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of cd(t))!tv.call(e,i)&&i!==r&&Ga(e,i,{get:()=>t[i],enumerable:!(n=Zb(t,i))||n.enumerable});return e},Nt=(e,t,r)=>(r=e!=null?Qb(ev(e)):{},rv(t||!e||!e.__esModule?Ga(r,"default",{value:e,enumerable:!0}):r,e));var ur=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/typebox.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Type=e.JsonType=e.JavaScriptTypeBuilder=e.JsonTypeBuilder=e.TypeBuilder=e.TypeBuilderError=e.TransformEncodeBuilder=e.TransformDecodeBuilder=e.TemplateLiteralDslParser=e.TemplateLiteralGenerator=e.TemplateLiteralGeneratorError=e.TemplateLiteralFinite=e.TemplateLiteralFiniteError=e.TemplateLiteralParser=e.TemplateLiteralParserError=e.TemplateLiteralResolver=e.TemplateLiteralPattern=e.TemplateLiteralPatternError=e.UnionResolver=e.KeyArrayResolver=e.KeyArrayResolverError=e.KeyResolver=e.ObjectMap=e.Intrinsic=e.IndexedAccessor=e.TypeClone=e.TypeExtends=e.TypeExtendsResult=e.TypeExtendsError=e.ExtendsUndefined=e.TypeGuard=e.TypeGuardUnknownTypeError=e.ValueGuard=e.FormatRegistry=e.TypeBoxError=e.TypeRegistry=e.PatternStringExact=e.PatternNumberExact=e.PatternBooleanExact=e.PatternString=e.PatternNumber=e.PatternBoolean=e.Kind=e.Hint=e.Optional=e.Readonly=e.Transform=void 0,e.Transform=Symbol.for("TypeBox.Transform"),e.Readonly=Symbol.for("TypeBox.Readonly"),e.Optional=Symbol.for("TypeBox.Optional"),e.Hint=Symbol.for("TypeBox.Hint"),e.Kind=Symbol.for("TypeBox.Kind"),e.PatternBoolean="(true|false)",e.PatternNumber="(0|[1-9][0-9]*)",e.PatternString="(.*)",e.PatternBooleanExact=`^${e.PatternBoolean}$`,e.PatternNumberExact=`^${e.PatternNumber}$`,e.PatternStringExact=`^${e.PatternString}$`;var t;(function(d){let w=new Map;function C(){return new Map(w)}d.Entries=C;function D(){return w.clear()}d.Clear=D;function P(_){return w.delete(_)}d.Delete=P;function N(_){return w.has(_)}d.Has=N;function g(_,f){w.set(_,f)}d.Set=g;function R(_){return w.get(_)}d.Get=R})(t||(e.TypeRegistry=t={}));var r=class extends Error{constructor(d){super(d)}};e.TypeBoxError=r;var n;(function(d){let w=new Map;function C(){return new Map(w)}d.Entries=C;function D(){return w.clear()}d.Clear=D;function P(_){return w.delete(_)}d.Delete=P;function N(_){return w.has(_)}d.Has=N;function g(_,f){w.set(_,f)}d.Set=g;function R(_){return w.get(_)}d.Get=R})(n||(e.FormatRegistry=n={}));var i;(function(d){function w(v){return Array.isArray(v)}d.IsArray=w;function C(v){return typeof v=="bigint"}d.IsBigInt=C;function D(v){return typeof v=="boolean"}d.IsBoolean=D;function P(v){return v instanceof globalThis.Date}d.IsDate=P;function N(v){return v===null}d.IsNull=N;function g(v){return typeof v=="number"}d.IsNumber=g;function R(v){return typeof v=="object"&&v!==null}d.IsObject=R;function _(v){return typeof v=="string"}d.IsString=_;function f(v){return v instanceof globalThis.Uint8Array}d.IsUint8Array=f;function I(v){return v===void 0}d.IsUndefined=I})(i||(e.ValueGuard=i={}));var o=class extends r{};e.TypeGuardUnknownTypeError=o;var s;(function(d){function w(m){try{return new RegExp(m),!0}catch{return!1}}function C(m){if(!i.IsString(m))return!1;for(let Ne=0;Ne<m.length;Ne++){let bt=m.charCodeAt(Ne);if(bt>=7&&bt<=13||bt===27||bt===127)return!1}return!0}function D(m){return g(m)||ze(m)}function P(m){return i.IsUndefined(m)||i.IsBigInt(m)}function N(m){return i.IsUndefined(m)||i.IsNumber(m)}function g(m){return i.IsUndefined(m)||i.IsBoolean(m)}function R(m){return i.IsUndefined(m)||i.IsString(m)}function _(m){return i.IsUndefined(m)||i.IsString(m)&&C(m)&&w(m)}function f(m){return i.IsUndefined(m)||i.IsString(m)&&C(m)}function I(m){return i.IsUndefined(m)||ze(m)}function v(m){return we(m,"Any")&&R(m.$id)}d.TAny=v;function b(m){return we(m,"Array")&&m.type==="array"&&R(m.$id)&&ze(m.items)&&N(m.minItems)&&N(m.maxItems)&&g(m.uniqueItems)&&I(m.contains)&&N(m.minContains)&&N(m.maxContains)}d.TArray=b;function U(m){return we(m,"AsyncIterator")&&m.type==="AsyncIterator"&&R(m.$id)&&ze(m.items)}d.TAsyncIterator=U;function q(m){return we(m,"BigInt")&&m.type==="bigint"&&R(m.$id)&&P(m.exclusiveMaximum)&&P(m.exclusiveMinimum)&&P(m.maximum)&&P(m.minimum)&&P(m.multipleOf)}d.TBigInt=q;function te(m){return we(m,"Boolean")&&m.type==="boolean"&&R(m.$id)}d.TBoolean=te;function ie(m){return we(m,"Constructor")&&m.type==="Constructor"&&R(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Ne=>ze(Ne))&&ze(m.returns)}d.TConstructor=ie;function ge(m){return we(m,"Date")&&m.type==="Date"&&R(m.$id)&&N(m.exclusiveMaximumTimestamp)&&N(m.exclusiveMinimumTimestamp)&&N(m.maximumTimestamp)&&N(m.minimumTimestamp)&&N(m.multipleOfTimestamp)}d.TDate=ge;function _e(m){return we(m,"Function")&&m.type==="Function"&&R(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Ne=>ze(Ne))&&ze(m.returns)}d.TFunction=_e;function Be(m){return we(m,"Integer")&&m.type==="integer"&&R(m.$id)&&N(m.exclusiveMaximum)&&N(m.exclusiveMinimum)&&N(m.maximum)&&N(m.minimum)&&N(m.multipleOf)}d.TInteger=Be;function Fe(m){return we(m,"Intersect")&&!(i.IsString(m.type)&&m.type!=="object")&&i.IsArray(m.allOf)&&m.allOf.every(Ne=>ze(Ne)&&!Qn(Ne))&&R(m.type)&&(g(m.unevaluatedProperties)||I(m.unevaluatedProperties))&&R(m.$id)}d.TIntersect=Fe;function Rr(m){return we(m,"Iterator")&&m.type==="Iterator"&&R(m.$id)&&ze(m.items)}d.TIterator=Rr;function we(m,Ne){return hr(m)&&m[e.Kind]===Ne}d.TKindOf=we;function hr(m){return i.IsObject(m)&&e.Kind in m&&i.IsString(m[e.Kind])}d.TKind=hr;function $r(m){return $(m)&&i.IsString(m.const)}d.TLiteralString=$r;function A(m){return $(m)&&i.IsNumber(m.const)}d.TLiteralNumber=A;function de(m){return $(m)&&i.IsBoolean(m.const)}d.TLiteralBoolean=de;function $(m){return we(m,"Literal")&&R(m.$id)&&(i.IsBoolean(m.const)||i.IsNumber(m.const)||i.IsString(m.const))}d.TLiteral=$;function me(m){return we(m,"Never")&&i.IsObject(m.not)&&Object.getOwnPropertyNames(m.not).length===0}d.TNever=me;function se(m){return we(m,"Not")&&ze(m.not)}d.TNot=se;function he(m){return we(m,"Null")&&m.type==="null"&&R(m.$id)}d.TNull=he;function Se(m){return we(m,"Number")&&m.type==="number"&&R(m.$id)&&N(m.exclusiveMaximum)&&N(m.exclusiveMinimum)&&N(m.maximum)&&N(m.minimum)&&N(m.multipleOf)}d.TNumber=Se;function ke(m){return we(m,"Object")&&m.type==="object"&&R(m.$id)&&i.IsObject(m.properties)&&D(m.additionalProperties)&&N(m.minProperties)&&N(m.maxProperties)&&Object.entries(m.properties).every(([Ne,bt])=>C(Ne)&&ze(bt))}d.TObject=ke;function rt(m){return we(m,"Promise")&&m.type==="Promise"&&R(m.$id)&&ze(m.item)}d.TPromise=rt;function Ze(m){return we(m,"Record")&&m.type==="object"&&R(m.$id)&&D(m.additionalProperties)&&i.IsObject(m.patternProperties)&&(Ne=>{let bt=Object.getOwnPropertyNames(Ne.patternProperties);return bt.length===1&&w(bt[0])&&i.IsObject(Ne.patternProperties)&&ze(Ne.patternProperties[bt[0]])})(m)}d.TRecord=Ze;function it(m){return i.IsObject(m)&&e.Hint in m&&m[e.Hint]==="Recursive"}d.TRecursive=it;function er(m){return we(m,"Ref")&&R(m.$id)&&i.IsString(m.$ref)}d.TRef=er;function fn(m){return we(m,"String")&&m.type==="string"&&R(m.$id)&&N(m.minLength)&&N(m.maxLength)&&_(m.pattern)&&f(m.format)}d.TString=fn;function ln(m){return we(m,"Symbol")&&m.type==="symbol"&&R(m.$id)}d.TSymbol=ln;function Pr(m){return we(m,"TemplateLiteral")&&m.type==="string"&&i.IsString(m.pattern)&&m.pattern[0]==="^"&&m.pattern[m.pattern.length-1]==="$"}d.TTemplateLiteral=Pr;function Yi(m){return we(m,"This")&&R(m.$id)&&i.IsString(m.$ref)}d.TThis=Yi;function Qn(m){return i.IsObject(m)&&e.Transform in m}d.TTransform=Qn;function Ve(m){return we(m,"Tuple")&&m.type==="array"&&R(m.$id)&&i.IsNumber(m.minItems)&&i.IsNumber(m.maxItems)&&m.minItems===m.maxItems&&(i.IsUndefined(m.items)&&i.IsUndefined(m.additionalItems)&&m.minItems===0||i.IsArray(m.items)&&m.items.every(Ne=>ze(Ne)))}d.TTuple=Ve;function Qi(m){return we(m,"Undefined")&&m.type==="undefined"&&R(m.$id)}d.TUndefined=Qi;function qs(m){return Ur(m)&&m.anyOf.every(Ne=>$r(Ne)||A(Ne))}d.TUnionLiteral=qs;function Ur(m){return we(m,"Union")&&R(m.$id)&&i.IsObject(m)&&i.IsArray(m.anyOf)&&m.anyOf.every(Ne=>ze(Ne))}d.TUnion=Ur;function dn(m){return we(m,"Uint8Array")&&m.type==="Uint8Array"&&R(m.$id)&&N(m.minByteLength)&&N(m.maxByteLength)}d.TUint8Array=dn;function nt(m){return we(m,"Unknown")&&R(m.$id)}d.TUnknown=nt;function Zi(m){return we(m,"Unsafe")}d.TUnsafe=Zi;function Zn(m){return we(m,"Void")&&m.type==="void"&&R(m.$id)}d.TVoid=Zn;function Gs(m){return i.IsObject(m)&&m[e.Readonly]==="Readonly"}d.TReadonly=Gs;function Ws(m){return i.IsObject(m)&&m[e.Optional]==="Optional"}d.TOptional=Ws;function ze(m){return i.IsObject(m)&&(v(m)||b(m)||te(m)||q(m)||U(m)||ie(m)||ge(m)||_e(m)||Be(m)||Fe(m)||Rr(m)||$(m)||me(m)||se(m)||he(m)||Se(m)||ke(m)||rt(m)||Ze(m)||er(m)||fn(m)||ln(m)||Pr(m)||Yi(m)||Ve(m)||Qi(m)||Ur(m)||dn(m)||nt(m)||Zi(m)||Zn(m)||hr(m)&&t.Has(m[e.Kind]))}d.TSchema=ze})(s||(e.TypeGuard=s={}));var a;(function(d){function w(C){return C[e.Kind]==="Intersect"?C.allOf.every(D=>w(D)):C[e.Kind]==="Union"?C.anyOf.some(D=>w(D)):C[e.Kind]==="Undefined"?!0:C[e.Kind]==="Not"?!w(C.not):!1}d.Check=w})(a||(e.ExtendsUndefined=a={}));var u=class extends r{};e.TypeExtendsError=u;var c;(function(d){d[d.Union=0]="Union",d[d.True=1]="True",d[d.False=2]="False"})(c||(e.TypeExtendsResult=c={}));var l;(function(d){function w(h){return h===c.False?h:c.True}function C(h){throw new u(h)}function D(h){return s.TNever(h)||s.TIntersect(h)||s.TUnion(h)||s.TUnknown(h)||s.TAny(h)}function P(h,y){return s.TNever(y)?we(h,y):s.TIntersect(y)?_e(h,y):s.TUnion(y)?Hs(h,y):s.TUnknown(y)?bc(h,y):s.TAny(y)?N(h,y):C("StructuralRight")}function N(h,y){return c.True}function g(h,y){return s.TIntersect(y)?_e(h,y):s.TUnion(y)&&y.anyOf.some(Oe=>s.TAny(Oe)||s.TUnknown(Oe))?c.True:s.TUnion(y)?c.Union:s.TUnknown(y)||s.TAny(y)?c.True:c.Union}function R(h,y){return s.TUnknown(h)?c.False:s.TAny(h)?c.Union:s.TNever(h)?c.True:c.False}function _(h,y){return s.TObject(y)&&Pr(y)?c.True:D(y)?P(h,y):s.TArray(y)?w(Ce(h.items,y.items)):c.False}function f(h,y){return D(y)?P(h,y):s.TAsyncIterator(y)?w(Ce(h.items,y.items)):c.False}function I(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):s.TBigInt(y)?c.True:c.False}function v(h,y){return s.TLiteral(h)&&i.IsBoolean(h.const)||s.TBoolean(h)?c.True:c.False}function b(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):s.TBoolean(y)?c.True:c.False}function U(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TConstructor(y)?h.parameters.length>y.parameters.length?c.False:h.parameters.every((Oe,Ut)=>w(Ce(y.parameters[Ut],Oe))===c.True)?w(Ce(h.returns,y.returns)):c.False:c.False}function q(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):s.TDate(y)?c.True:c.False}function te(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TFunction(y)?h.parameters.length>y.parameters.length?c.False:h.parameters.every((Oe,Ut)=>w(Ce(y.parameters[Ut],Oe))===c.True)?w(Ce(h.returns,y.returns)):c.False:c.False}function ie(h,y){return s.TLiteral(h)&&i.IsNumber(h.const)||s.TNumber(h)||s.TInteger(h)?c.True:c.False}function ge(h,y){return s.TInteger(y)||s.TNumber(y)?c.True:D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):c.False}function _e(h,y){return y.allOf.every(Oe=>Ce(h,Oe)===c.True)?c.True:c.False}function Be(h,y){return h.allOf.some(Oe=>Ce(Oe,y)===c.True)?c.True:c.False}function Fe(h,y){return D(y)?P(h,y):s.TIterator(y)?w(Ce(h.items,y.items)):c.False}function Rr(h,y){return s.TLiteral(y)&&y.const===h.const?c.True:D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):s.TString(y)?Zn(h,y):s.TNumber(y)?$(h,y):s.TInteger(y)?ie(h,y):s.TBoolean(y)?v(h,y):c.False}function we(h,y){return c.False}function hr(h,y){return c.True}function $r(h){let[y,Oe]=[h,0];for(;s.TNot(y);)y=y.not,Oe+=1;return Oe%2===0?y:e.Type.Unknown()}function A(h,y){return s.TNot(h)?Ce($r(h),y):s.TNot(y)?Ce(h,$r(y)):C("Invalid fallthrough for Not")}function de(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):s.TNull(y)?c.True:c.False}function $(h,y){return s.TLiteralNumber(h)||s.TNumber(h)||s.TInteger(h)?c.True:c.False}function me(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):s.TInteger(y)||s.TNumber(y)?c.True:c.False}function se(h,y){return Object.getOwnPropertyNames(h.properties).length===y}function he(h){return Pr(h)}function Se(h){return se(h,0)||se(h,1)&&"description"in h.properties&&s.TUnion(h.properties.description)&&h.properties.description.anyOf.length===2&&(s.TString(h.properties.description.anyOf[0])&&s.TUndefined(h.properties.description.anyOf[1])||s.TString(h.properties.description.anyOf[1])&&s.TUndefined(h.properties.description.anyOf[0]))}function ke(h){return se(h,0)}function rt(h){return se(h,0)}function Ze(h){return se(h,0)}function it(h){return se(h,0)}function er(h){return Pr(h)}function fn(h){let y=e.Type.Number();return se(h,0)||se(h,1)&&"length"in h.properties&&w(Ce(h.properties.length,y))===c.True}function ln(h){return se(h,0)}function Pr(h){let y=e.Type.Number();return se(h,0)||se(h,1)&&"length"in h.properties&&w(Ce(h.properties.length,y))===c.True}function Yi(h){let y=e.Type.Function([e.Type.Any()],e.Type.Any());return se(h,0)||se(h,1)&&"then"in h.properties&&w(Ce(h.properties.then,y))===c.True}function Qn(h,y){return Ce(h,y)===c.False||s.TOptional(h)&&!s.TOptional(y)?c.False:c.True}function Ve(h,y){return s.TUnknown(h)?c.False:s.TAny(h)?c.Union:s.TNever(h)||s.TLiteralString(h)&&he(y)||s.TLiteralNumber(h)&&ke(y)||s.TLiteralBoolean(h)&&rt(y)||s.TSymbol(h)&&Se(y)||s.TBigInt(h)&&Ze(y)||s.TString(h)&&he(y)||s.TSymbol(h)&&Se(y)||s.TNumber(h)&&ke(y)||s.TInteger(h)&&ke(y)||s.TBoolean(h)&&rt(y)||s.TUint8Array(h)&&er(y)||s.TDate(h)&&it(y)||s.TConstructor(h)&&ln(y)||s.TFunction(h)&&fn(y)?c.True:s.TRecord(h)&&s.TString(Ur(h))?y[e.Hint]==="Record"?c.True:c.False:s.TRecord(h)&&s.TNumber(Ur(h))?se(y,0)?c.True:c.False:c.False}function Qi(h,y){return D(y)?P(h,y):s.TRecord(y)?nt(h,y):s.TObject(y)?(()=>{for(let Oe of Object.getOwnPropertyNames(y.properties)){if(!(Oe in h.properties)&&!s.TOptional(y.properties[Oe]))return c.False;if(s.TOptional(y.properties[Oe]))return c.True;if(Qn(h.properties[Oe],y.properties[Oe])===c.False)return c.False}return c.True})():c.False}function qs(h,y){return D(y)?P(h,y):s.TObject(y)&&Yi(y)?c.True:s.TPromise(y)?w(Ce(h.item,y.item)):c.False}function Ur(h){return e.PatternNumberExact in h.patternProperties?e.Type.Number():e.PatternStringExact in h.patternProperties?e.Type.String():C("Unknown record key pattern")}function dn(h){return e.PatternNumberExact in h.patternProperties?h.patternProperties[e.PatternNumberExact]:e.PatternStringExact in h.patternProperties?h.patternProperties[e.PatternStringExact]:C("Unable to get record value schema")}function nt(h,y){let[Oe,Ut]=[Ur(y),dn(y)];return s.TLiteralString(h)&&s.TNumber(Oe)&&w(Ce(h,Ut))===c.True?c.True:s.TUint8Array(h)&&s.TNumber(Oe)||s.TString(h)&&s.TNumber(Oe)||s.TArray(h)&&s.TNumber(Oe)?Ce(h,Ut):s.TObject(h)?(()=>{for(let wy of Object.getOwnPropertyNames(h.properties))if(Qn(Ut,h.properties[wy])===c.False)return c.False;return c.True})():c.False}function Zi(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?Ce(dn(h),dn(y)):c.False}function Zn(h,y){return s.TLiteral(h)&&i.IsString(h.const)||s.TString(h)?c.True:c.False}function Gs(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):s.TString(y)?c.True:c.False}function Ws(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):s.TSymbol(y)?c.True:c.False}function ze(h,y){return s.TTemplateLiteral(h)?Ce(F.Resolve(h),y):s.TTemplateLiteral(y)?Ce(h,F.Resolve(y)):C("Invalid fallthrough for TemplateLiteral")}function m(h,y){return s.TArray(y)&&h.items!==void 0&&h.items.every(Oe=>Ce(Oe,y.items)===c.True)}function Ne(h,y){return s.TNever(h)?c.True:s.TUnknown(h)?c.False:s.TAny(h)?c.Union:c.False}function bt(h,y){return D(y)?P(h,y):s.TObject(y)&&Pr(y)||s.TArray(y)&&m(h,y)?c.True:s.TTuple(y)?i.IsUndefined(h.items)&&!i.IsUndefined(y.items)||!i.IsUndefined(h.items)&&i.IsUndefined(y.items)?c.False:i.IsUndefined(h.items)&&!i.IsUndefined(y.items)||h.items.every((Oe,Ut)=>Ce(Oe,y.items[Ut])===c.True)?c.True:c.False:c.False}function hy(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):s.TUint8Array(y)?c.True:c.False}function yy(h,y){return D(y)?P(h,y):s.TObject(y)?Ve(h,y):s.TRecord(y)?nt(h,y):s.TVoid(y)?by(h,y):s.TUndefined(y)?c.True:c.False}function Hs(h,y){return y.anyOf.some(Oe=>Ce(h,Oe)===c.True)?c.True:c.False}function gy(h,y){return h.anyOf.every(Oe=>Ce(Oe,y)===c.True)?c.True:c.False}function bc(h,y){return c.True}function my(h,y){return s.TNever(y)?we(h,y):s.TIntersect(y)?_e(h,y):s.TUnion(y)?Hs(h,y):s.TAny(y)?N(h,y):s.TString(y)?Zn(h,y):s.TNumber(y)?$(h,y):s.TInteger(y)?ie(h,y):s.TBoolean(y)?v(h,y):s.TArray(y)?R(h,y):s.TTuple(y)?Ne(h,y):s.TObject(y)?Ve(h,y):s.TUnknown(y)?c.True:c.False}function by(h,y){return s.TUndefined(h)||s.TUndefined(h)?c.True:c.False}function vy(h,y){return s.TIntersect(y)?_e(h,y):s.TUnion(y)?Hs(h,y):s.TUnknown(y)?bc(h,y):s.TAny(y)?N(h,y):s.TObject(y)?Ve(h,y):s.TVoid(y)?c.True:c.False}function Ce(h,y){return s.TTemplateLiteral(h)||s.TTemplateLiteral(y)?ze(h,y):s.TNot(h)||s.TNot(y)?A(h,y):s.TAny(h)?g(h,y):s.TArray(h)?_(h,y):s.TBigInt(h)?I(h,y):s.TBoolean(h)?b(h,y):s.TAsyncIterator(h)?f(h,y):s.TConstructor(h)?U(h,y):s.TDate(h)?q(h,y):s.TFunction(h)?te(h,y):s.TInteger(h)?ge(h,y):s.TIntersect(h)?Be(h,y):s.TIterator(h)?Fe(h,y):s.TLiteral(h)?Rr(h,y):s.TNever(h)?hr(h,y):s.TNull(h)?de(h,y):s.TNumber(h)?me(h,y):s.TObject(h)?Qi(h,y):s.TRecord(h)?Zi(h,y):s.TString(h)?Gs(h,y):s.TSymbol(h)?Ws(h,y):s.TTuple(h)?bt(h,y):s.TPromise(h)?qs(h,y):s.TUint8Array(h)?hy(h,y):s.TUndefined(h)?yy(h,y):s.TUnion(h)?gy(h,y):s.TUnknown(h)?my(h,y):s.TVoid(h)?vy(h,y):C(`Unknown left type operand '${h[e.Kind]}'`)}function _y(h,y){return Ce(h,y)}d.Extends=_y})(l||(e.TypeExtends=l={}));var p;(function(d){function w(_){return _.map(f=>N(f))}function C(_){return new Date(_.getTime())}function D(_){return new Uint8Array(_)}function P(_){let f=Object.getOwnPropertyNames(_).reduce((v,b)=>({...v,[b]:N(_[b])}),{}),I=Object.getOwnPropertySymbols(_).reduce((v,b)=>({...v,[b]:N(_[b])}),{});return{...f,...I}}function N(_){return i.IsArray(_)?w(_):i.IsDate(_)?C(_):i.IsUint8Array(_)?D(_):i.IsObject(_)?P(_):_}function g(_){return _.map(f=>R(f))}d.Rest=g;function R(_,f={}){return{...N(_),...f}}d.Type=R})(p||(e.TypeClone=p={}));var S;(function(d){function w(U){return U.map(q=>{let{[e.Optional]:te,...ie}=p.Type(q);return ie})}function C(U){return U.every(q=>s.TOptional(q))}function D(U){return U.some(q=>s.TOptional(q))}function P(U){return C(U.allOf)?e.Type.Optional(e.Type.Intersect(w(U.allOf))):U}function N(U){return D(U.anyOf)?e.Type.Optional(e.Type.Union(w(U.anyOf))):U}function g(U){return U[e.Kind]==="Intersect"?P(U):U[e.Kind]==="Union"?N(U):U}function R(U,q){let te=U.allOf.reduce((ie,ge)=>{let _e=v(ge,q);return _e[e.Kind]==="Never"?ie:[...ie,_e]},[]);return g(e.Type.Intersect(te))}function _(U,q){let te=U.anyOf.map(ie=>v(ie,q));return g(e.Type.Union(te))}function f(U,q){let te=U.properties[q];return i.IsUndefined(te)?e.Type.Never():e.Type.Union([te])}function I(U,q){let te=U.items;if(i.IsUndefined(te))return e.Type.Never();let ie=te[q];return i.IsUndefined(ie)?e.Type.Never():ie}function v(U,q){return U[e.Kind]==="Intersect"?R(U,q):U[e.Kind]==="Union"?_(U,q):U[e.Kind]==="Object"?f(U,q):U[e.Kind]==="Tuple"?I(U,q):e.Type.Never()}function b(U,q,te={}){let ie=q.map(ge=>v(U,ge.toString()));return g(e.Type.Union(ie,te))}d.Resolve=b})(S||(e.IndexedAccessor=S={}));var x;(function(d){function w(I){let[v,b]=[I.slice(0,1),I.slice(1)];return`${v.toLowerCase()}${b}`}function C(I){let[v,b]=[I.slice(0,1),I.slice(1)];return`${v.toUpperCase()}${b}`}function D(I){return I.toUpperCase()}function P(I){return I.toLowerCase()}function N(I,v){let b=V.ParseExact(I.pattern);if(!L.Check(b))return{...I,pattern:g(I.pattern,v)};let te=[...j.Generate(b)].map(_e=>e.Type.Literal(_e)),ie=R(te,v),ge=e.Type.Union(ie);return e.Type.TemplateLiteral([ge])}function g(I,v){return typeof I=="string"?v==="Uncapitalize"?w(I):v==="Capitalize"?C(I):v==="Uppercase"?D(I):v==="Lowercase"?P(I):I:I.toString()}function R(I,v){if(I.length===0)return[];let[b,...U]=I;return[f(b,v),...R(U,v)]}function _(I,v){return s.TTemplateLiteral(I)?N(I,v):s.TUnion(I)?e.Type.Union(R(I.anyOf,v)):s.TLiteral(I)?e.Type.Literal(g(I.const,v)):I}function f(I,v){return _(I,v)}d.Map=f})(x||(e.Intrinsic=x={}));var E;(function(d){function w(g,R){return e.Type.Intersect(g.allOf.map(_=>P(_,R)),{...g})}function C(g,R){return e.Type.Union(g.anyOf.map(_=>P(_,R)),{...g})}function D(g,R){return R(g)}function P(g,R){return g[e.Kind]==="Intersect"?w(g,R):g[e.Kind]==="Union"?C(g,R):g[e.Kind]==="Object"?D(g,R):g}function N(g,R,_){return{...P(p.Type(g),R),..._}}d.Map=N})(E||(e.ObjectMap=E={}));var z;(function(d){function w(f){return f[0]==="^"&&f[f.length-1]==="$"?f.slice(1,f.length-1):f}function C(f,I){return f.allOf.reduce((v,b)=>[...v,...g(b,I)],[])}function D(f,I){let v=f.anyOf.map(b=>g(b,I));return[...v.reduce((b,U)=>U.map(q=>v.every(te=>te.includes(q))?b.add(q):b)[0],new Set)]}function P(f,I){return Object.getOwnPropertyNames(f.properties)}function N(f,I){return I.includePatterns?Object.getOwnPropertyNames(f.patternProperties):[]}function g(f,I){return s.TIntersect(f)?C(f,I):s.TUnion(f)?D(f,I):s.TObject(f)?P(f,I):s.TRecord(f)?N(f,I):[]}function R(f,I){return[...new Set(g(f,I))]}d.ResolveKeys=R;function _(f){return`^(${R(f,{includePatterns:!0}).map(b=>`(${w(b)})`).join("|")})$`}d.ResolvePattern=_})(z||(e.KeyResolver=z={}));var W=class extends r{};e.KeyArrayResolverError=W;var T;(function(d){function w(C){return Array.isArray(C)?C:s.TUnionLiteral(C)?C.anyOf.map(D=>D.const.toString()):s.TLiteral(C)?[C.const]:s.TTemplateLiteral(C)?(()=>{let D=V.ParseExact(C.pattern);if(!L.Check(D))throw new W("Cannot resolve keys from infinite template expression");return[...j.Generate(D)]})():[]}d.Resolve=w})(T||(e.KeyArrayResolver=T={}));var k;(function(d){function*w(D){for(let P of D.anyOf)P[e.Kind]==="Union"?yield*w(P):yield P}function C(D){return e.Type.Union([...w(D)],{...D})}d.Resolve=C})(k||(e.UnionResolver=k={}));var G=class extends r{};e.TemplateLiteralPatternError=G;var H;(function(d){function w(N){throw new G(N)}function C(N){return N.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function D(N,g){return s.TTemplateLiteral(N)?N.pattern.slice(1,N.pattern.length-1):s.TUnion(N)?`(${N.anyOf.map(R=>D(R,g)).join("|")})`:s.TNumber(N)?`${g}${e.PatternNumber}`:s.TInteger(N)?`${g}${e.PatternNumber}`:s.TBigInt(N)?`${g}${e.PatternNumber}`:s.TString(N)?`${g}${e.PatternString}`:s.TLiteral(N)?`${g}${C(N.const.toString())}`:s.TBoolean(N)?`${g}${e.PatternBoolean}`:w(`Unexpected Kind '${N[e.Kind]}'`)}function P(N){return`^${N.map(g=>D(g,"")).join("")}$`}d.Create=P})(H||(e.TemplateLiteralPattern=H={}));var F;(function(d){function w(C){let D=V.ParseExact(C.pattern);if(!L.Check(D))return e.Type.String();let P=[...j.Generate(D)].map(N=>e.Type.Literal(N));return e.Type.Union(P)}d.Resolve=w})(F||(e.TemplateLiteralResolver=F={}));var Y=class extends r{};e.TemplateLiteralParserError=Y;var V;(function(d){function w(U,q,te){return U[q]===te&&U.charCodeAt(q-1)!==92}function C(U,q){return w(U,q,"(")}function D(U,q){return w(U,q,")")}function P(U,q){return w(U,q,"|")}function N(U){if(!(C(U,0)&&D(U,U.length-1)))return!1;let q=0;for(let te=0;te<U.length;te++)if(C(U,te)&&(q+=1),D(U,te)&&(q-=1),q===0&&te!==U.length-1)return!1;return!0}function g(U){return U.slice(1,U.length-1)}function R(U){let q=0;for(let te=0;te<U.length;te++)if(C(U,te)&&(q+=1),D(U,te)&&(q-=1),P(U,te)&&q===0)return!0;return!1}function _(U){for(let q=0;q<U.length;q++)if(C(U,q))return!0;return!1}function f(U){let[q,te]=[0,0],ie=[];for(let _e=0;_e<U.length;_e++)if(C(U,_e)&&(q+=1),D(U,_e)&&(q-=1),P(U,_e)&&q===0){let Be=U.slice(te,_e);Be.length>0&&ie.push(v(Be)),te=_e+1}let ge=U.slice(te);return ge.length>0&&ie.push(v(ge)),ie.length===0?{type:"const",const:""}:ie.length===1?ie[0]:{type:"or",expr:ie}}function I(U){function q(ge,_e){if(!C(ge,_e))throw new Y("TemplateLiteralParser: Index must point to open parens");let Be=0;for(let Fe=_e;Fe<ge.length;Fe++)if(C(ge,Fe)&&(Be+=1),D(ge,Fe)&&(Be-=1),Be===0)return[_e,Fe];throw new Y("TemplateLiteralParser: Unclosed group parens in expression")}function te(ge,_e){for(let Be=_e;Be<ge.length;Be++)if(C(ge,Be))return[_e,Be];return[_e,ge.length]}let ie=[];for(let ge=0;ge<U.length;ge++)if(C(U,ge)){let[_e,Be]=q(U,ge),Fe=U.slice(_e,Be+1);ie.push(v(Fe)),ge=Be}else{let[_e,Be]=te(U,ge),Fe=U.slice(_e,Be);Fe.length>0&&ie.push(v(Fe)),ge=Be-1}return ie.length===0?{type:"const",const:""}:ie.length===1?ie[0]:{type:"and",expr:ie}}function v(U){return N(U)?v(g(U)):R(U)?f(U):_(U)?I(U):{type:"const",const:U}}d.Parse=v;function b(U){return v(U.slice(1,U.length-1))}d.ParseExact=b})(V||(e.TemplateLiteralParser=V={}));var ae=class extends r{};e.TemplateLiteralFiniteError=ae;var L;(function(d){function w(g){throw new ae(g)}function C(g){return g.type==="or"&&g.expr.length===2&&g.expr[0].type==="const"&&g.expr[0].const==="0"&&g.expr[1].type==="const"&&g.expr[1].const==="[1-9][0-9]*"}function D(g){return g.type==="or"&&g.expr.length===2&&g.expr[0].type==="const"&&g.expr[0].const==="true"&&g.expr[1].type==="const"&&g.expr[1].const==="false"}function P(g){return g.type==="const"&&g.const===".*"}function N(g){return D(g)?!0:C(g)||P(g)?!1:g.type==="and"?g.expr.every(R=>N(R)):g.type==="or"?g.expr.every(R=>N(R)):g.type==="const"?!0:w("Unknown expression type")}d.Check=N})(L||(e.TemplateLiteralFinite=L={}));var M=class extends r{};e.TemplateLiteralGeneratorError=M;var j;(function(d){function*w(g){if(g.length===1)return yield*g[0];for(let R of g[0])for(let _ of w(g.slice(1)))yield`${R}${_}`}function*C(g){return yield*w(g.expr.map(R=>[...N(R)]))}function*D(g){for(let R of g.expr)yield*N(R)}function*P(g){return yield g.const}function*N(g){return g.type==="and"?yield*C(g):g.type==="or"?yield*D(g):g.type==="const"?yield*P(g):(()=>{throw new M("Unknown expression")})()}d.Generate=N})(j||(e.TemplateLiteralGenerator=j={}));var ne;(function(d){function*w(N){let g=N.trim().replace(/"|'/g,"");return g==="boolean"?yield e.Type.Boolean():g==="number"?yield e.Type.Number():g==="bigint"?yield e.Type.BigInt():g==="string"?yield e.Type.String():yield(()=>{let R=g.split("|").map(_=>e.Type.Literal(_.trim()));return R.length===0?e.Type.Never():R.length===1?R[0]:e.Type.Union(R)})()}function*C(N){if(N[1]!=="{"){let g=e.Type.Literal("$"),R=D(N.slice(1));return yield*[g,...R]}for(let g=2;g<N.length;g++)if(N[g]==="}"){let R=w(N.slice(2,g)),_=D(N.slice(g+1));return yield*[...R,..._]}yield e.Type.Literal(N)}function*D(N){for(let g=0;g<N.length;g++)if(N[g]==="$"){let R=e.Type.Literal(N.slice(0,g)),_=C(N.slice(g));return yield*[R,..._]}yield e.Type.Literal(N)}function P(N){return[...D(N)]}d.Parse=P})(ne||(e.TemplateLiteralDslParser=ne={}));var re=class{constructor(d){this.schema=d}Decode(d){return new O(this.schema,d)}};e.TransformDecodeBuilder=re;var O=class{constructor(d,w){this.schema=d,this.decode=w}Encode(d){let w=p.Type(this.schema);return s.TTransform(w)?(()=>{let P={Encode:N=>w[e.Transform].Encode(d(N)),Decode:N=>this.decode(w[e.Transform].Decode(N))};return{...w,[e.Transform]:P}})():(()=>{let C={Decode:this.decode,Encode:d};return{...w,[e.Transform]:C}})()}};e.TransformEncodeBuilder=O;var J=0,oe=class extends r{};e.TypeBuilderError=oe;var X=class{Create(d){return d}Throw(d){throw new oe(d)}Discard(d,w){return w.reduce((C,D)=>{let{[D]:P,...N}=C;return N},d)}Strict(d){return JSON.parse(JSON.stringify(d))}};e.TypeBuilder=X;var Z=class extends X{ReadonlyOptional(d){return this.Readonly(this.Optional(d))}Readonly(d){return{...p.Type(d),[e.Readonly]:"Readonly"}}Optional(d){return{...p.Type(d),[e.Optional]:"Optional"}}Any(d={}){return this.Create({...d,[e.Kind]:"Any"})}Array(d,w={}){return this.Create({...w,[e.Kind]:"Array",type:"array",items:p.Type(d)})}Boolean(d={}){return this.Create({...d,[e.Kind]:"Boolean",type:"boolean"})}Capitalize(d,w={}){return{...x.Map(p.Type(d),"Capitalize"),...w}}Composite(d,w){let C=e.Type.Intersect(d,{}),P=z.ResolveKeys(C,{includePatterns:!1}).reduce((N,g)=>({...N,[g]:e.Type.Index(C,[g])}),{});return e.Type.Object(P,w)}Enum(d,w={}){if(i.IsUndefined(d))return this.Throw("Enum undefined or empty");let C=Object.getOwnPropertyNames(d).filter(N=>isNaN(N)).map(N=>d[N]),P=[...new Set(C)].map(N=>e.Type.Literal(N));return this.Union(P,{...w,[e.Hint]:"Enum"})}Extends(d,w,C,D,P={}){switch(l.Extends(d,w)){case c.Union:return this.Union([p.Type(C,P),p.Type(D,P)]);case c.True:return p.Type(C,P);case c.False:return p.Type(D,P)}}Exclude(d,w,C={}){return s.TTemplateLiteral(d)?this.Exclude(F.Resolve(d),w,C):s.TTemplateLiteral(w)?this.Exclude(d,F.Resolve(w),C):s.TUnion(d)?(()=>{let D=d.anyOf.filter(P=>l.Extends(P,w)===c.False);return D.length===1?p.Type(D[0],C):this.Union(D,C)})():l.Extends(d,w)!==c.False?this.Never(C):p.Type(d,C)}Extract(d,w,C={}){return s.TTemplateLiteral(d)?this.Extract(F.Resolve(d),w,C):s.TTemplateLiteral(w)?this.Extract(d,F.Resolve(w),C):s.TUnion(d)?(()=>{let D=d.anyOf.filter(P=>l.Extends(P,w)!==c.False);return D.length===1?p.Type(D[0],C):this.Union(D,C)})():l.Extends(d,w)!==c.False?p.Type(d,C):this.Never(C)}Index(d,w,C={}){return s.TArray(d)&&s.TNumber(w)?p.Type(d.items,C):s.TTuple(d)&&s.TNumber(w)?(()=>{let P=(i.IsUndefined(d.items)?[]:d.items).map(N=>p.Type(N));return this.Union(P,C)})():(()=>{let D=T.Resolve(w),P=p.Type(d);return S.Resolve(P,D,C)})()}Integer(d={}){return this.Create({...d,[e.Kind]:"Integer",type:"integer"})}Intersect(d,w={}){if(d.length===0)return e.Type.Never();if(d.length===1)return p.Type(d[0],w);d.some(N=>s.TTransform(N))&&this.Throw("Cannot intersect transform types");let C=d.every(N=>s.TObject(N)),D=p.Rest(d),P=s.TSchema(w.unevaluatedProperties)?{unevaluatedProperties:p.Type(w.unevaluatedProperties)}:{};return w.unevaluatedProperties===!1||s.TSchema(w.unevaluatedProperties)||C?this.Create({...w,...P,[e.Kind]:"Intersect",type:"object",allOf:D}):this.Create({...w,...P,[e.Kind]:"Intersect",allOf:D})}KeyOf(d,w={}){return s.TRecord(d)?(()=>{let C=Object.getOwnPropertyNames(d.patternProperties)[0];return C===e.PatternNumberExact?this.Number(w):C===e.PatternStringExact?this.String(w):this.Throw("Unable to resolve key type from Record key pattern")})():s.TTuple(d)?(()=>{let D=(i.IsUndefined(d.items)?[]:d.items).map((P,N)=>e.Type.Literal(N.toString()));return this.Union(D,w)})():s.TArray(d)?this.Number(w):(()=>{let C=z.ResolveKeys(d,{includePatterns:!1});if(C.length===0)return this.Never(w);let D=C.map(P=>this.Literal(P));return this.Union(D,w)})()}Literal(d,w={}){return this.Create({...w,[e.Kind]:"Literal",const:d,type:typeof d})}Lowercase(d,w={}){return{...x.Map(p.Type(d),"Lowercase"),...w}}Never(d={}){return this.Create({...d,[e.Kind]:"Never",not:{}})}Not(d,w){return this.Create({...w,[e.Kind]:"Not",not:p.Type(d)})}Null(d={}){return this.Create({...d,[e.Kind]:"Null",type:"null"})}Number(d={}){return this.Create({...d,[e.Kind]:"Number",type:"number"})}Object(d,w={}){let C=Object.getOwnPropertyNames(d),D=C.filter(R=>s.TOptional(d[R])),P=C.filter(R=>!D.includes(R)),N=s.TSchema(w.additionalProperties)?{additionalProperties:p.Type(w.additionalProperties)}:{},g=C.reduce((R,_)=>({...R,[_]:p.Type(d[_])}),{});return P.length>0?this.Create({...w,...N,[e.Kind]:"Object",type:"object",properties:g,required:P}):this.Create({...w,...N,[e.Kind]:"Object",type:"object",properties:g})}Omit(d,w,C={}){let D=T.Resolve(w);return E.Map(this.Discard(p.Type(d),["$id",e.Transform]),P=>{i.IsArray(P.required)&&(P.required=P.required.filter(N=>!D.includes(N)),P.required.length===0&&delete P.required);for(let N of Object.getOwnPropertyNames(P.properties))D.includes(N)&&delete P.properties[N];return this.Create(P)},C)}Partial(d,w={}){return E.Map(this.Discard(p.Type(d),["$id",e.Transform]),C=>{let D=Object.getOwnPropertyNames(C.properties).reduce((P,N)=>({...P,[N]:this.Optional(C.properties[N])}),{});return this.Object(D,this.Discard(C,["required"]))},w)}Pick(d,w,C={}){let D=T.Resolve(w);return E.Map(this.Discard(p.Type(d),["$id",e.Transform]),P=>{i.IsArray(P.required)&&(P.required=P.required.filter(N=>D.includes(N)),P.required.length===0&&delete P.required);for(let N of Object.getOwnPropertyNames(P.properties))D.includes(N)||delete P.properties[N];return this.Create(P)},C)}Record(d,w,C={}){return s.TTemplateLiteral(d)?(()=>{let D=V.ParseExact(d.pattern);return L.Check(D)?this.Object([...j.Generate(D)].reduce((P,N)=>({...P,[N]:p.Type(w)}),{}),C):this.Create({...C,[e.Kind]:"Record",type:"object",patternProperties:{[d.pattern]:p.Type(w)}})})():s.TUnion(d)?(()=>{let D=k.Resolve(d);if(s.TUnionLiteral(D)){let P=D.anyOf.reduce((N,g)=>({...N,[g.const]:p.Type(w)}),{});return this.Object(P,{...C,[e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():s.TLiteral(d)?i.IsString(d.const)||i.IsNumber(d.const)?this.Object({[d.const]:p.Type(w)},C):this.Throw("Record key of type literal is not of type string or number"):s.TInteger(d)||s.TNumber(d)?this.Create({...C,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:p.Type(w)}}):s.TString(d)?(()=>{let D=i.IsUndefined(d.pattern)?e.PatternStringExact:d.pattern;return this.Create({...C,[e.Kind]:"Record",type:"object",patternProperties:{[D]:p.Type(w)}})})():this.Never()}Recursive(d,w={}){i.IsUndefined(w.$id)&&(w.$id=`T${J++}`);let C=d({[e.Kind]:"This",$ref:`${w.$id}`});return C.$id=w.$id,this.Create({...w,[e.Hint]:"Recursive",...C})}Ref(d,w={}){return i.IsString(d)?this.Create({...w,[e.Kind]:"Ref",$ref:d}):(i.IsUndefined(d.$id)&&this.Throw("Reference target type must specify an $id"),this.Create({...w,[e.Kind]:"Ref",$ref:d.$id}))}Required(d,w={}){return E.Map(this.Discard(p.Type(d),["$id",e.Transform]),C=>{let D=Object.getOwnPropertyNames(C.properties).reduce((P,N)=>({...P,[N]:this.Discard(C.properties[N],[e.Optional])}),{});return this.Object(D,C)},w)}Rest(d){return s.TTuple(d)&&!i.IsUndefined(d.items)?p.Rest(d.items):s.TIntersect(d)?p.Rest(d.allOf):s.TUnion(d)?p.Rest(d.anyOf):[]}String(d={}){return this.Create({...d,[e.Kind]:"String",type:"string"})}TemplateLiteral(d,w={}){let C=i.IsString(d)?H.Create(ne.Parse(d)):H.Create(d);return this.Create({...w,[e.Kind]:"TemplateLiteral",type:"string",pattern:C})}Transform(d){return new re(d)}Tuple(d,w={}){let[C,D,P]=[!1,d.length,d.length],N=p.Rest(d),g=d.length>0?{...w,[e.Kind]:"Tuple",type:"array",items:N,additionalItems:C,minItems:D,maxItems:P}:{...w,[e.Kind]:"Tuple",type:"array",minItems:D,maxItems:P};return this.Create(g)}Uncapitalize(d,w={}){return{...x.Map(p.Type(d),"Uncapitalize"),...w}}Union(d,w={}){return s.TTemplateLiteral(d)?F.Resolve(d):(()=>{let C=d;if(C.length===0)return this.Never(w);if(C.length===1)return this.Create(p.Type(C[0],w));let D=p.Rest(C);return this.Create({...w,[e.Kind]:"Union",anyOf:D})})()}Unknown(d={}){return this.Create({...d,[e.Kind]:"Unknown"})}Unsafe(d={}){return this.Create({...d,[e.Kind]:d[e.Kind]||"Unsafe"})}Uppercase(d,w={}){return{...x.Map(p.Type(d),"Uppercase"),...w}}};e.JsonTypeBuilder=Z;var pe=class extends Z{AsyncIterator(d,w={}){return this.Create({...w,[e.Kind]:"AsyncIterator",type:"AsyncIterator",items:p.Type(d)})}Awaited(d,w={}){let C=D=>D.length>0?(()=>{let[P,...N]=D;return[this.Awaited(P),...C(N)]})():D;return s.TIntersect(d)?e.Type.Intersect(C(d.allOf)):s.TUnion(d)?e.Type.Union(C(d.anyOf)):s.TPromise(d)?this.Awaited(d.item):p.Type(d,w)}BigInt(d={}){return this.Create({...d,[e.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(d,w={}){return this.Tuple([...d.parameters],{...w})}Constructor(d,w,C){let[D,P]=[p.Rest(d),p.Type(w)];return this.Create({...C,[e.Kind]:"Constructor",type:"Constructor",parameters:D,returns:P})}Date(d={}){return this.Create({...d,[e.Kind]:"Date",type:"Date"})}Function(d,w,C){let[D,P]=[p.Rest(d),p.Type(w)];return this.Create({...C,[e.Kind]:"Function",type:"Function",parameters:D,returns:P})}InstanceType(d,w={}){return p.Type(d.returns,w)}Iterator(d,w={}){return this.Create({...w,[e.Kind]:"Iterator",type:"Iterator",items:p.Type(d)})}Parameters(d,w={}){return this.Tuple(d.parameters,{...w})}Promise(d,w={}){return this.Create({...w,[e.Kind]:"Promise",type:"Promise",item:p.Type(d)})}RegExp(d,w={}){let C=i.IsString(d)?d:d.source;return this.Create({...w,[e.Kind]:"String",type:"string",pattern:C})}RegEx(d,w={}){return this.RegExp(d,w)}ReturnType(d,w={}){return p.Type(d.returns,w)}Symbol(d){return this.Create({...d,[e.Kind]:"Symbol",type:"symbol"})}Undefined(d={}){return this.Create({...d,[e.Kind]:"Undefined",type:"undefined"})}Uint8Array(d={}){return this.Create({...d,[e.Kind]:"Uint8Array",type:"Uint8Array"})}Void(d={}){return this.Create({...d,[e.Kind]:"Void",type:"void"})}};e.JavaScriptTypeBuilder=pe,e.JsonType=new Z,e.Type=new pe}}),Dn=Nt(ur(),1),{String:nv,Optional:iv,Boolean:ov,Object:sv,Number:av}=Dn.Type,uv=nv.bind(Dn.Type),cv=av.bind(Dn.Type),d$=sv.bind(Dn.Type),p$=iv.bind(Dn.Type),fv=ov.bind(Dn.Type),h$=uv(),y$=cv(),g$=fv();function fd(e){return Array.isArray(e)?e:[e]}var lv=Le({"../../../node_modules/.pnpm/browser-or-node@2.1.1/node_modules/browser-or-node/lib/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},r=typeof window<"u"&&typeof window.document<"u",n=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,i=(typeof self>"u"?"undefined":t(self))==="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope",o=typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),s=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u";e.isBrowser=r,e.isWebWorker=i,e.isNode=n,e.isJsDom=o,e.isDeno=s}}),dv=Le({"../../../node_modules/.pnpm/fast-json-stable-stringify@2.1.0/node_modules/fast-json-stable-stringify/index.js"(e,t){"use strict";t.exports=function(r,n){n||(n={}),typeof n=="function"&&(n={cmp:n});var i=typeof n.cycles=="boolean"?n.cycles:!1,o=n.cmp&&function(a){return function(u){return function(c,l){var p={key:c,value:u[c]},S={key:l,value:u[l]};return a(p,S)}}}(n.cmp),s=[];return function a(u){if(u&&u.toJSON&&typeof u.toJSON=="function"&&(u=u.toJSON()),u!==void 0){if(typeof u=="number")return isFinite(u)?""+u:"null";if(typeof u!="object")return JSON.stringify(u);var c,l;if(Array.isArray(u)){for(l="[",c=0;c<u.length;c++)c&&(l+=","),l+=a(u[c])||"null";return l+"]"}if(u===null)return"null";if(s.indexOf(u)!==-1){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var p=s.push(u)-1,S=Object.keys(u).sort(o&&o(u));for(l="",c=0;c<S.length;c++){var x=S[c],E=a(u[x]);E&&(l&&(l+=","),l+=JSON.stringify(x)+":"+E)}return s.splice(p,1),"{"+l+"}"}}(r)}}}),pv=Le({"../../../node_modules/.pnpm/safe-stable-stringify@2.4.3/node_modules/safe-stable-stringify/index.js"(e,t){"use strict";var{hasOwnProperty:r}=Object.prototype,n=W();n.configure=W,n.stringify=n,n.default=n,e.stringify=n,e.configure=W,t.exports=n;var i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function o(T){return T.length<5e3&&!i.test(T)?`"${T}"`:JSON.stringify(T)}function s(T){if(T.length>200)return T.sort();for(let k=1;k<T.length;k++){let G=T[k],H=k;for(;H!==0&&T[H-1]>G;)T[H]=T[H-1],H--;T[H]=G}return T}var a=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function u(T){return a.call(T)!==void 0&&T.length!==0}function c(T,k,G){T.length<G&&(G=T.length);let H=k===","?"":" ",F=`"0":${H}${T[0]}`;for(let Y=1;Y<G;Y++)F+=`${k}"${Y}":${H}${T[Y]}`;return F}function l(T){if(r.call(T,"circularValue")){let k=T.circularValue;if(typeof k=="string")return`"${k}"`;if(k==null)return k;if(k===Error||k===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function p(T,k){let G;if(r.call(T,k)&&(G=T[k],typeof G!="boolean"))throw new TypeError(`The "${k}" argument must be of type boolean`);return G===void 0?!0:G}function S(T,k){let G;if(r.call(T,k)){if(G=T[k],typeof G!="number")throw new TypeError(`The "${k}" argument must be of type number`);if(!Number.isInteger(G))throw new TypeError(`The "${k}" argument must be an integer`);if(G<1)throw new RangeError(`The "${k}" argument must be >= 1`)}return G===void 0?1/0:G}function x(T){return T===1?"1 item":`${T} items`}function E(T){let k=new Set;for(let G of T)(typeof G=="string"||typeof G=="number")&&k.add(String(G));return k}function z(T){if(r.call(T,"strict")){let k=T.strict;if(typeof k!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(k)return G=>{let H=`Object can not safely be stringified. Received type ${typeof G}`;throw typeof G!="function"&&(H+=` (${G.toString()})`),new Error(H)}}}function W(T){T={...T};let k=z(T);k&&(T.bigint===void 0&&(T.bigint=!1),"circularValue"in T||(T.circularValue=Error));let G=l(T),H=p(T,"bigint"),F=p(T,"deterministic"),Y=S(T,"maximumDepth"),V=S(T,"maximumBreadth");function ae(re,O,J,oe,X,Z){let pe=O[re];switch(typeof pe=="object"&&pe!==null&&typeof pe.toJSON=="function"&&(pe=pe.toJSON(re)),pe=oe.call(O,re,pe),typeof pe){case"string":return o(pe);case"object":{if(pe===null)return"null";if(J.indexOf(pe)!==-1)return G;let d="",w=",",C=Z;if(Array.isArray(pe)){if(pe.length===0)return"[]";if(Y<J.length+1)return'"[Array]"';J.push(pe),X!==""&&(Z+=X,d+=`
31
31
  ${Z}`,w=`,
32
32
  ${Z}`);let _=Math.min(pe.length,V),f=0;for(;f<_-1;f++){let v=ae(String(f),pe,J,oe,X,Z);d+=v!==void 0?v:"null",d+=w}let I=ae(String(f),pe,J,oe,X,Z);if(d+=I!==void 0?I:"null",pe.length-1>V){let v=pe.length-V-1;d+=`${w}"... ${x(v)} not stringified"`}return X!==""&&(d+=`
33
33
  ${C}`),J.pop(),`[${d}]`}let D=Object.keys(pe),P=D.length;if(P===0)return"{}";if(Y<J.length+1)return'"[Object]"';let N="",g="";X!==""&&(Z+=X,w=`,
@@ -45,20 +45,20 @@ ${X}`,R=Math.min(O.length,V),_=0;for(;_<R-1;_++){let I=M(String(_),O[_],J,oe,X);
45
45
  ${Z}`,J.pop(),`[${N}]`}let pe=Object.keys(O),d=pe.length;if(d===0)return"{}";if(Y<J.length+1)return'"[Object]"';X+=oe;let w=`,
46
46
  ${X}`,C="",D="",P=Math.min(d,V);u(O)&&(C+=c(O,w,V),pe=pe.slice(O.length),P-=O.length,D=w),F&&(pe=s(pe)),J.push(O);for(let N=0;N<P;N++){let g=pe[N],R=M(g,O[g],J,oe,X);R!==void 0&&(C+=`${D}${o(g)}: ${R}`,D=w)}if(d>V){let N=d-V;C+=`${D}"...": "${x(N)} not stringified"`,D=w}return D!==""&&(C=`
47
47
  ${X}${C}
48
- ${Z}`),J.pop(),`{${C}}`}case"number":return isFinite(O)?String(O):k?k(O):"null";case"boolean":return O===!0?"true":"false";case"undefined":return;case"bigint":if(H)return String(O);default:return k?k(O):void 0}}function j(re,O,J){switch(typeof O){case"string":return o(O);case"object":{if(O===null)return"null";if(typeof O.toJSON=="function"){if(O=O.toJSON(re),typeof O!="object")return j(re,O,J);if(O===null)return"null"}if(J.indexOf(O)!==-1)return G;let oe="";if(Array.isArray(O)){if(O.length===0)return"[]";if(Y<J.length+1)return'"[Array]"';J.push(O);let w=Math.min(O.length,V),C=0;for(;C<w-1;C++){let P=j(String(C),O[C],J);oe+=P!==void 0?P:"null",oe+=","}let D=j(String(C),O[C],J);if(oe+=D!==void 0?D:"null",O.length-1>V){let P=O.length-V-1;oe+=`,"... ${x(P)} not stringified"`}return J.pop(),`[${oe}]`}let X=Object.keys(O),Z=X.length;if(Z===0)return"{}";if(Y<J.length+1)return'"[Object]"';let pe="",d=Math.min(Z,V);u(O)&&(oe+=c(O,",",V),X=X.slice(O.length),d-=O.length,pe=","),F&&(X=s(X)),J.push(O);for(let w=0;w<d;w++){let C=X[w],D=j(C,O[C],J);D!==void 0&&(oe+=`${pe}${o(C)}:${D}`,pe=",")}if(Z>V){let w=Z-V;oe+=`${pe}"...":"${x(w)} not stringified"`}return J.pop(),`{${oe}}`}case"number":return isFinite(O)?String(O):k?k(O):"null";case"boolean":return O===!0?"true":"false";case"undefined":return;case"bigint":if(H)return String(O);default:return k?k(O):void 0}}function ne(re,O,J){if(arguments.length>1){let oe="";if(typeof J=="number"?oe=" ".repeat(Math.min(J,10)):typeof J=="string"&&(oe=J.slice(0,10)),O!=null){if(typeof O=="function")return ae("",{"":re},[],O,oe,"");if(Array.isArray(O))return L("",re,[],E(O),oe,"")}if(oe.length!==0)return M("",re,[],oe,"")}return j("",re,[])}return ne}}}),kn=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/guard.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IsValueType=e.IsSymbol=e.IsFunction=e.IsString=e.IsBigInt=e.IsInteger=e.IsNumber=e.IsBoolean=e.IsNull=e.IsUndefined=e.IsArray=e.IsObject=e.IsPlainObject=e.HasPropertyKey=e.IsDate=e.IsUint8Array=e.IsPromise=e.IsTypedArray=e.IsIterator=e.IsAsyncIterator=void 0;function t(F){return c(F)&&Symbol.asyncIterator in F}e.IsAsyncIterator=t;function r(F){return c(F)&&Symbol.iterator in F}e.IsIterator=r;function n(F){return ArrayBuffer.isView(F)}e.IsTypedArray=n;function i(F){return F instanceof Promise}e.IsPromise=i;function o(F){return F instanceof Uint8Array}e.IsUint8Array=o;function s(F){return F instanceof Date&&Number.isFinite(F.getTime())}e.IsDate=s;function a(F,Y){return Y in F}e.HasPropertyKey=a;function u(F){return c(F)&&k(F.constructor)&&F.constructor.name==="Object"}e.IsPlainObject=u;function c(F){return F!==null&&typeof F=="object"}e.IsObject=c;function l(F){return Array.isArray(F)&&!ArrayBuffer.isView(F)}e.IsArray=l;function p(F){return F===void 0}e.IsUndefined=p;function S(F){return F===null}e.IsNull=S;function x(F){return typeof F=="boolean"}e.IsBoolean=x;function E(F){return typeof F=="number"}e.IsNumber=E;function z(F){return E(F)&&Number.isInteger(F)}e.IsInteger=z;function W(F){return typeof F=="bigint"}e.IsBigInt=W;function T(F){return typeof F=="string"}e.IsString=T;function k(F){return typeof F=="function"}e.IsFunction=k;function G(F){return typeof F=="symbol"}e.IsSymbol=G;function H(F){return W(F)||x(F)||S(F)||E(F)||T(F)||G(F)||p(F)}e.IsValueType=H}}),yp=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/system/system.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultErrorFunction=e.TypeSystemPolicy=e.TypeSystemErrorFunction=e.TypeSystem=e.TypeSystemDuplicateFormat=e.TypeSystemDuplicateTypeKind=void 0;var t=kn(),r=hs(),n=ur(),i=class extends n.TypeBoxError{constructor(l){super(`Duplicate type kind '${l}' detected`)}};e.TypeSystemDuplicateTypeKind=i;var o=class extends n.TypeBoxError{constructor(l){super(`Duplicate string format '${l}' detected`)}};e.TypeSystemDuplicateFormat=o;var s;(function(l){function p(x,E){if(n.TypeRegistry.Has(x))throw new i(x);return n.TypeRegistry.Set(x,E),(z={})=>n.Type.Unsafe({...z,[n.Kind]:x})}l.Type=p;function S(x,E){if(n.FormatRegistry.Has(x))throw new o(x);return n.FormatRegistry.Set(x,E),x}l.Format=S})(s||(e.TypeSystem=s={}));var a;(function(l){let p=c;function S(){p=c}l.Reset=S;function x(z){p=z}l.Set=x;function E(){return p}l.Get=E})(a||(e.TypeSystemErrorFunction=a={}));var u;(function(l){l.ExactOptionalPropertyTypes=!1,l.AllowArrayObject=!1,l.AllowNaN=!1,l.AllowNullVoid=!1;function p(W,T){return l.ExactOptionalPropertyTypes?T in W:W[T]!==void 0}l.IsExactOptionalProperty=p;function S(W){let T=(0,t.IsObject)(W);return l.AllowArrayObject?T:T&&!(0,t.IsArray)(W)}l.IsObjectLike=S;function x(W){return S(W)&&!(W instanceof Date)&&!(W instanceof Uint8Array)}l.IsRecordLike=x;function E(W){let T=(0,t.IsNumber)(W);return l.AllowNaN?T:T&&Number.isFinite(W)}l.IsNumberLike=E;function z(W){let T=(0,t.IsUndefined)(W);return l.AllowNullVoid?T||W===null:T}l.IsVoidLike=z})(u||(e.TypeSystemPolicy=u={}));function c(l,p){switch(p){case r.ValueErrorType.ArrayContains:return"Expected array to contain at least one matching value";case r.ValueErrorType.ArrayMaxContains:return`Expected array to contain no more than ${l.maxContains} matching values`;case r.ValueErrorType.ArrayMinContains:return`Expected array to contain at least ${l.minContains} matching values`;case r.ValueErrorType.ArrayMaxItems:return`Expected array length to be less or equal to ${l.maxItems}`;case r.ValueErrorType.ArrayMinItems:return`Expected array length to be greater or equal to ${l.minItems}`;case r.ValueErrorType.ArrayUniqueItems:return"Expected array elements to be unique";case r.ValueErrorType.Array:return"Expected array";case r.ValueErrorType.AsyncIterator:return"Expected AsyncIterator";case r.ValueErrorType.BigIntExclusiveMaximum:return`Expected bigint to be less than ${l.exclusiveMaximum}`;case r.ValueErrorType.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${l.exclusiveMinimum}`;case r.ValueErrorType.BigIntMaximum:return`Expected bigint to be less or equal to ${l.maximum}`;case r.ValueErrorType.BigIntMinimum:return`Expected bigint to be greater or equal to ${l.minimum}`;case r.ValueErrorType.BigIntMultipleOf:return`Expected bigint to be a multiple of ${l.multipleOf}`;case r.ValueErrorType.BigInt:return"Expected bigint";case r.ValueErrorType.Boolean:return"Expected boolean";case r.ValueErrorType.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${l.exclusiveMinimumTimestamp}`;case r.ValueErrorType.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${l.exclusiveMaximumTimestamp}`;case r.ValueErrorType.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${l.minimumTimestamp}`;case r.ValueErrorType.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${l.maximumTimestamp}`;case r.ValueErrorType.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${l.multipleOfTimestamp}`;case r.ValueErrorType.Date:return"Expected Date";case r.ValueErrorType.Function:return"Expected function";case r.ValueErrorType.IntegerExclusiveMaximum:return`Expected integer to be less than ${l.exclusiveMaximum}`;case r.ValueErrorType.IntegerExclusiveMinimum:return`Expected integer to be greater than ${l.exclusiveMinimum}`;case r.ValueErrorType.IntegerMaximum:return`Expected integer to be less or equal to ${l.maximum}`;case r.ValueErrorType.IntegerMinimum:return`Expected integer to be greater or equal to ${l.minimum}`;case r.ValueErrorType.IntegerMultipleOf:return`Expected integer to be a multiple of ${l.multipleOf}`;case r.ValueErrorType.Integer:return"Expected integer";case r.ValueErrorType.IntersectUnevaluatedProperties:return"Unexpected property";case r.ValueErrorType.Intersect:return"Expected all values to match";case r.ValueErrorType.Iterator:return"Expected Iterator";case r.ValueErrorType.Literal:return`Expected ${typeof l.const=="string"?`'${l.const}'`:l.const}`;case r.ValueErrorType.Never:return"Never";case r.ValueErrorType.Not:return"Value should not match";case r.ValueErrorType.Null:return"Expected null";case r.ValueErrorType.NumberExclusiveMaximum:return`Expected number to be less than ${l.exclusiveMaximum}`;case r.ValueErrorType.NumberExclusiveMinimum:return`Expected number to be greater than ${l.exclusiveMinimum}`;case r.ValueErrorType.NumberMaximum:return`Expected number to be less or equal to ${l.maximum}`;case r.ValueErrorType.NumberMinimum:return`Expected number to be greater or equal to ${l.minimum}`;case r.ValueErrorType.NumberMultipleOf:return`Expected number to be a multiple of ${l.multipleOf}`;case r.ValueErrorType.Number:return"Expected number";case r.ValueErrorType.Object:return"Expected object";case r.ValueErrorType.ObjectAdditionalProperties:return"Unexpected property";case r.ValueErrorType.ObjectMaxProperties:return`Expected object to have no more than ${l.maxProperties} properties`;case r.ValueErrorType.ObjectMinProperties:return`Expected object to have at least ${l.minProperties} properties`;case r.ValueErrorType.ObjectRequiredProperty:return"Required property";case r.ValueErrorType.Promise:return"Expected Promise";case r.ValueErrorType.StringFormatUnknown:return`Unknown format '${l.format}'`;case r.ValueErrorType.StringFormat:return`Expected string to match '${l.format}' format`;case r.ValueErrorType.StringMaxLength:return`Expected string length less or equal to ${l.maxLength}`;case r.ValueErrorType.StringMinLength:return`Expected string length greater or equal to ${l.minLength}`;case r.ValueErrorType.StringPattern:return`Expected string to match '${l.pattern}'`;case r.ValueErrorType.String:return"Expected string";case r.ValueErrorType.Symbol:return"Expected symbol";case r.ValueErrorType.TupleLength:return`Expected tuple to have ${l.maxItems||0} elements`;case r.ValueErrorType.Tuple:return"Expected tuple";case r.ValueErrorType.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${l.maxByteLength}`;case r.ValueErrorType.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${l.minByteLength}`;case r.ValueErrorType.Uint8Array:return"Expected Uint8Array";case r.ValueErrorType.Undefined:return"Expected undefined";case r.ValueErrorType.Union:return"Expected union value";case r.ValueErrorType.Void:return"Expected void";case r.ValueErrorType.Kind:return`Expected kind '${l[n.Kind]}'`;default:return"Unknown error type"}}e.DefaultErrorFunction=c}}),ps=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/deref.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Deref=e.TypeDereferenceError=void 0;var t=ur(),r=class extends t.TypeBoxError{constructor(i){super(`Unable to dereference schema with $id '${i.$id}'`),this.schema=i}};e.TypeDereferenceError=r;function n(i,o){let s=o.findIndex(a=>a.$id===i.$ref);if(s===-1)throw new r(i);return o[s]}e.Deref=n}}),vu=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/hash.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.ByteMarker=e.ValueHashError=void 0;var t=kn(),r=class extends Error{constructor(M){super("Unable to hash value"),this.value=M}};e.ValueHashError=r;var n;(function(M){M[M.Undefined=0]="Undefined",M[M.Null=1]="Null",M[M.Boolean=2]="Boolean",M[M.Number=3]="Number",M[M.String=4]="String",M[M.Object=5]="Object",M[M.Array=6]="Array",M[M.Date=7]="Date",M[M.Uint8Array=8]="Uint8Array",M[M.Symbol=9]="Symbol",M[M.BigInt=10]="BigInt"})(n||(e.ByteMarker=n={}));var i=BigInt("14695981039346656037"),[o,s]=[BigInt("1099511628211"),BigInt("2")**BigInt("64")],a=Array.from({length:256}).map((M,j)=>BigInt(j)),u=new Float64Array(1),c=new DataView(u.buffer),l=new Uint8Array(u.buffer);function*p(M){let j=M===0?1:Math.ceil(Math.floor(Math.log2(M)+1)/8);for(let ne=0;ne<j;ne++)yield M>>8*(j-1-ne)&255}function S(M){ae(n.Array);for(let j of M)V(j)}function x(M){ae(n.Boolean),ae(M?1:0)}function E(M){ae(n.BigInt),c.setBigInt64(0,M);for(let j of l)ae(j)}function z(M){ae(n.Date),V(M.getTime())}function W(M){ae(n.Null)}function T(M){ae(n.Number),c.setFloat64(0,M);for(let j of l)ae(j)}function k(M){ae(n.Object);for(let j of globalThis.Object.keys(M).sort())V(j),V(M[j])}function G(M){ae(n.String);for(let j=0;j<M.length;j++)for(let ne of p(M.charCodeAt(j)))ae(ne)}function H(M){ae(n.Symbol),V(M.description)}function F(M){ae(n.Uint8Array);for(let j=0;j<M.length;j++)ae(M[j])}function Y(M){return ae(n.Undefined)}function V(M){if((0,t.IsArray)(M))return S(M);if((0,t.IsBoolean)(M))return x(M);if((0,t.IsBigInt)(M))return E(M);if((0,t.IsDate)(M))return z(M);if((0,t.IsNull)(M))return W(M);if((0,t.IsNumber)(M))return T(M);if((0,t.IsPlainObject)(M))return k(M);if((0,t.IsString)(M))return G(M);if((0,t.IsSymbol)(M))return H(M);if((0,t.IsUint8Array)(M))return F(M);if((0,t.IsUndefined)(M))return Y(M);throw new r(M)}function ae(M){i=i^a[M],i=i*o%s}function L(M){return i=BigInt("14695981039346656037"),V(M),i}e.Hash=L}}),hs=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/errors/errors.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Errors=e.ValueErrorIterator=e.EscapeKey=e.ValueErrorsUnknownTypeError=e.ValueErrorType=void 0;var t=kn(),r=yp(),n=ps(),i=vu(),o=ur(),s;(function(f){f[f.ArrayContains=0]="ArrayContains",f[f.ArrayMaxContains=1]="ArrayMaxContains",f[f.ArrayMaxItems=2]="ArrayMaxItems",f[f.ArrayMinContains=3]="ArrayMinContains",f[f.ArrayMinItems=4]="ArrayMinItems",f[f.ArrayUniqueItems=5]="ArrayUniqueItems",f[f.Array=6]="Array",f[f.AsyncIterator=7]="AsyncIterator",f[f.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",f[f.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",f[f.BigIntMaximum=10]="BigIntMaximum",f[f.BigIntMinimum=11]="BigIntMinimum",f[f.BigIntMultipleOf=12]="BigIntMultipleOf",f[f.BigInt=13]="BigInt",f[f.Boolean=14]="Boolean",f[f.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",f[f.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",f[f.DateMaximumTimestamp=17]="DateMaximumTimestamp",f[f.DateMinimumTimestamp=18]="DateMinimumTimestamp",f[f.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",f[f.Date=20]="Date",f[f.Function=21]="Function",f[f.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",f[f.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",f[f.IntegerMaximum=24]="IntegerMaximum",f[f.IntegerMinimum=25]="IntegerMinimum",f[f.IntegerMultipleOf=26]="IntegerMultipleOf",f[f.Integer=27]="Integer",f[f.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",f[f.Intersect=29]="Intersect",f[f.Iterator=30]="Iterator",f[f.Kind=31]="Kind",f[f.Literal=32]="Literal",f[f.Never=33]="Never",f[f.Not=34]="Not",f[f.Null=35]="Null",f[f.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",f[f.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",f[f.NumberMaximum=38]="NumberMaximum",f[f.NumberMinimum=39]="NumberMinimum",f[f.NumberMultipleOf=40]="NumberMultipleOf",f[f.Number=41]="Number",f[f.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",f[f.ObjectMaxProperties=43]="ObjectMaxProperties",f[f.ObjectMinProperties=44]="ObjectMinProperties",f[f.ObjectRequiredProperty=45]="ObjectRequiredProperty",f[f.Object=46]="Object",f[f.Promise=47]="Promise",f[f.StringFormatUnknown=48]="StringFormatUnknown",f[f.StringFormat=49]="StringFormat",f[f.StringMaxLength=50]="StringMaxLength",f[f.StringMinLength=51]="StringMinLength",f[f.StringPattern=52]="StringPattern",f[f.String=53]="String",f[f.Symbol=54]="Symbol",f[f.TupleLength=55]="TupleLength",f[f.Tuple=56]="Tuple",f[f.Uint8ArrayMaxByteLength=57]="Uint8ArrayMaxByteLength",f[f.Uint8ArrayMinByteLength=58]="Uint8ArrayMinByteLength",f[f.Uint8Array=59]="Uint8Array",f[f.Undefined=60]="Undefined",f[f.Union=61]="Union",f[f.Void=62]="Void"})(s||(e.ValueErrorType=s={}));var a=class extends o.TypeBoxError{constructor(f){super("Unknown type"),this.schema=f}};e.ValueErrorsUnknownTypeError=a;function u(f){return f.replace(/~/g,"~0").replace(/\//g,"~1")}e.EscapeKey=u;function c(f){return f!==void 0}var l=class{constructor(f){this.iterator=f}[Symbol.iterator](){return this.iterator}First(){let f=this.iterator.next();return f.done?void 0:f.value}};e.ValueErrorIterator=l;function p(f,I,v,b){return{type:f,schema:I,path:v,value:b,message:r.TypeSystemErrorFunction.Get()(I,f)}}function*S(f,I,v,b){}function*x(f,I,v,b){if(!(0,t.IsArray)(b))return yield p(s.Array,f,v,b);c(f.minItems)&&!(b.length>=f.minItems)&&(yield p(s.ArrayMinItems,f,v,b)),c(f.maxItems)&&!(b.length<=f.maxItems)&&(yield p(s.ArrayMaxItems,f,v,b));for(let te=0;te<b.length;te++)yield*R(f.items,I,`${v}/${te}`,b[te]);if(f.uniqueItems===!0&&!function(){let te=new Set;for(let ie of b){let ge=(0,i.Hash)(ie);if(te.has(ge))return!1;te.add(ge)}return!0}()&&(yield p(s.ArrayUniqueItems,f,v,b)),!(c(f.contains)||c(f.minContains)||c(f.maxContains)))return;let U=c(f.contains)?f.contains:o.Type.Never(),q=b.reduce((te,ie,ge)=>R(U,I,`${v}${ge}`,ie).next().done===!0?te+1:te,0);q===0&&(yield p(s.ArrayContains,f,v,b)),(0,t.IsNumber)(f.minContains)&&q<f.minContains&&(yield p(s.ArrayMinContains,f,v,b)),(0,t.IsNumber)(f.maxContains)&&q>f.maxContains&&(yield p(s.ArrayMaxContains,f,v,b))}function*E(f,I,v,b){(0,t.IsAsyncIterator)(b)||(yield p(s.AsyncIterator,f,v,b))}function*z(f,I,v,b){if(!(0,t.IsBigInt)(b))return yield p(s.BigInt,f,v,b);c(f.exclusiveMaximum)&&!(b<f.exclusiveMaximum)&&(yield p(s.BigIntExclusiveMaximum,f,v,b)),c(f.exclusiveMinimum)&&!(b>f.exclusiveMinimum)&&(yield p(s.BigIntExclusiveMinimum,f,v,b)),c(f.maximum)&&!(b<=f.maximum)&&(yield p(s.BigIntMaximum,f,v,b)),c(f.minimum)&&!(b>=f.minimum)&&(yield p(s.BigIntMinimum,f,v,b)),c(f.multipleOf)&&b%f.multipleOf!==BigInt(0)&&(yield p(s.BigIntMultipleOf,f,v,b))}function*W(f,I,v,b){(0,t.IsBoolean)(b)||(yield p(s.Boolean,f,v,b))}function*T(f,I,v,b){yield*R(f.returns,I,v,b.prototype)}function*k(f,I,v,b){if(!(0,t.IsDate)(b))return yield p(s.Date,f,v,b);c(f.exclusiveMaximumTimestamp)&&!(b.getTime()<f.exclusiveMaximumTimestamp)&&(yield p(s.DateExclusiveMaximumTimestamp,f,v,b)),c(f.exclusiveMinimumTimestamp)&&!(b.getTime()>f.exclusiveMinimumTimestamp)&&(yield p(s.DateExclusiveMinimumTimestamp,f,v,b)),c(f.maximumTimestamp)&&!(b.getTime()<=f.maximumTimestamp)&&(yield p(s.DateMaximumTimestamp,f,v,b)),c(f.minimumTimestamp)&&!(b.getTime()>=f.minimumTimestamp)&&(yield p(s.DateMinimumTimestamp,f,v,b)),c(f.multipleOfTimestamp)&&b.getTime()%f.multipleOfTimestamp!==0&&(yield p(s.DateMultipleOfTimestamp,f,v,b))}function*G(f,I,v,b){(0,t.IsFunction)(b)||(yield p(s.Function,f,v,b))}function*H(f,I,v,b){if(!(0,t.IsInteger)(b))return yield p(s.Integer,f,v,b);c(f.exclusiveMaximum)&&!(b<f.exclusiveMaximum)&&(yield p(s.IntegerExclusiveMaximum,f,v,b)),c(f.exclusiveMinimum)&&!(b>f.exclusiveMinimum)&&(yield p(s.IntegerExclusiveMinimum,f,v,b)),c(f.maximum)&&!(b<=f.maximum)&&(yield p(s.IntegerMaximum,f,v,b)),c(f.minimum)&&!(b>=f.minimum)&&(yield p(s.IntegerMinimum,f,v,b)),c(f.multipleOf)&&b%f.multipleOf!==0&&(yield p(s.IntegerMultipleOf,f,v,b))}function*F(f,I,v,b){for(let U of f.allOf){let q=R(U,I,v,b).next();q.done||(yield p(s.Intersect,f,v,b),yield q.value)}if(f.unevaluatedProperties===!1){let U=new RegExp(o.KeyResolver.ResolvePattern(f));for(let q of Object.getOwnPropertyNames(b))U.test(q)||(yield p(s.IntersectUnevaluatedProperties,f,`${v}/${q}`,b))}if(typeof f.unevaluatedProperties=="object"){let U=new RegExp(o.KeyResolver.ResolvePattern(f));for(let q of Object.getOwnPropertyNames(b))if(!U.test(q)){let te=R(f.unevaluatedProperties,I,`${v}/${q}`,b[q]).next();te.done||(yield te.value)}}}function*Y(f,I,v,b){(0,t.IsIterator)(b)||(yield p(s.Iterator,f,v,b))}function*V(f,I,v,b){b!==f.const&&(yield p(s.Literal,f,v,b))}function*ae(f,I,v,b){yield p(s.Never,f,v,b)}function*L(f,I,v,b){R(f.not,I,v,b).next().done===!0&&(yield p(s.Not,f,v,b))}function*M(f,I,v,b){(0,t.IsNull)(b)||(yield p(s.Null,f,v,b))}function*j(f,I,v,b){if(!r.TypeSystemPolicy.IsNumberLike(b))return yield p(s.Number,f,v,b);c(f.exclusiveMaximum)&&!(b<f.exclusiveMaximum)&&(yield p(s.NumberExclusiveMaximum,f,v,b)),c(f.exclusiveMinimum)&&!(b>f.exclusiveMinimum)&&(yield p(s.NumberExclusiveMinimum,f,v,b)),c(f.maximum)&&!(b<=f.maximum)&&(yield p(s.NumberMaximum,f,v,b)),c(f.minimum)&&!(b>=f.minimum)&&(yield p(s.NumberMinimum,f,v,b)),c(f.multipleOf)&&b%f.multipleOf!==0&&(yield p(s.NumberMultipleOf,f,v,b))}function*ne(f,I,v,b){if(!r.TypeSystemPolicy.IsObjectLike(b))return yield p(s.Object,f,v,b);c(f.minProperties)&&!(Object.getOwnPropertyNames(b).length>=f.minProperties)&&(yield p(s.ObjectMinProperties,f,v,b)),c(f.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=f.maxProperties)&&(yield p(s.ObjectMaxProperties,f,v,b));let U=Array.isArray(f.required)?f.required:[],q=Object.getOwnPropertyNames(f.properties),te=Object.getOwnPropertyNames(b);for(let ie of U)te.includes(ie)||(yield p(s.ObjectRequiredProperty,f.properties[ie],`${v}/${u(ie)}`,void 0));if(f.additionalProperties===!1)for(let ie of te)q.includes(ie)||(yield p(s.ObjectAdditionalProperties,f,`${v}/${u(ie)}`,b[ie]));if(typeof f.additionalProperties=="object")for(let ie of te)q.includes(ie)||(yield*R(f.additionalProperties,I,`${v}/${u(ie)}`,b[ie]));for(let ie of q){let ge=f.properties[ie];f.required&&f.required.includes(ie)?(yield*R(ge,I,`${v}/${u(ie)}`,b[ie]),o.ExtendsUndefined.Check(f)&&!(ie in b)&&(yield p(s.ObjectRequiredProperty,ge,`${v}/${u(ie)}`,void 0))):r.TypeSystemPolicy.IsExactOptionalProperty(b,ie)&&(yield*R(ge,I,`${v}/${u(ie)}`,b[ie]))}}function*re(f,I,v,b){(0,t.IsPromise)(b)||(yield p(s.Promise,f,v,b))}function*O(f,I,v,b){if(!r.TypeSystemPolicy.IsRecordLike(b))return yield p(s.Object,f,v,b);c(f.minProperties)&&!(Object.getOwnPropertyNames(b).length>=f.minProperties)&&(yield p(s.ObjectMinProperties,f,v,b)),c(f.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=f.maxProperties)&&(yield p(s.ObjectMaxProperties,f,v,b));let[U,q]=Object.entries(f.patternProperties)[0],te=new RegExp(U);for(let[ie,ge]of Object.entries(b))te.test(ie)&&(yield*R(q,I,`${v}/${u(ie)}`,ge));if(typeof f.additionalProperties=="object")for(let[ie,ge]of Object.entries(b))te.test(ie)||(yield*R(f.additionalProperties,I,`${v}/${u(ie)}`,ge));if(f.additionalProperties===!1){for(let[ie,ge]of Object.entries(b))if(!te.test(ie))return yield p(s.ObjectAdditionalProperties,f,`${v}/${u(ie)}`,ge)}}function*J(f,I,v,b){yield*R((0,n.Deref)(f,I),I,v,b)}function*oe(f,I,v,b){if(!(0,t.IsString)(b))return yield p(s.String,f,v,b);c(f.minLength)&&!(b.length>=f.minLength)&&(yield p(s.StringMinLength,f,v,b)),c(f.maxLength)&&!(b.length<=f.maxLength)&&(yield p(s.StringMaxLength,f,v,b)),(0,t.IsString)(f.pattern)&&(new RegExp(f.pattern).test(b)||(yield p(s.StringPattern,f,v,b))),(0,t.IsString)(f.format)&&(o.FormatRegistry.Has(f.format)?o.FormatRegistry.Get(f.format)(b)||(yield p(s.StringFormat,f,v,b)):yield p(s.StringFormatUnknown,f,v,b))}function*X(f,I,v,b){(0,t.IsSymbol)(b)||(yield p(s.Symbol,f,v,b))}function*Z(f,I,v,b){if(!(0,t.IsString)(b))return yield p(s.String,f,v,b);new RegExp(f.pattern).test(b)||(yield p(s.StringPattern,f,v,b))}function*pe(f,I,v,b){yield*R((0,n.Deref)(f,I),I,v,b)}function*d(f,I,v,b){if(!(0,t.IsArray)(b))return yield p(s.Tuple,f,v,b);if(f.items===void 0&&b.length!==0)return yield p(s.TupleLength,f,v,b);if(b.length!==f.maxItems)return yield p(s.TupleLength,f,v,b);if(f.items)for(let U=0;U<f.items.length;U++)yield*R(f.items[U],I,`${v}/${U}`,b[U])}function*w(f,I,v,b){(0,t.IsUndefined)(b)||(yield p(s.Undefined,f,v,b))}function*C(f,I,v,b){let U=0;for(let q of f.anyOf){let te=[...R(q,I,v,b)];if(te.length===0)return;U+=te.length}U>0&&(yield p(s.Union,f,v,b))}function*D(f,I,v,b){if(!(0,t.IsUint8Array)(b))return yield p(s.Uint8Array,f,v,b);c(f.maxByteLength)&&!(b.length<=f.maxByteLength)&&(yield p(s.Uint8ArrayMaxByteLength,f,v,b)),c(f.minByteLength)&&!(b.length>=f.minByteLength)&&(yield p(s.Uint8ArrayMinByteLength,f,v,b))}function*P(f,I,v,b){}function*N(f,I,v,b){r.TypeSystemPolicy.IsVoidLike(b)||(yield p(s.Void,f,v,b))}function*g(f,I,v,b){o.TypeRegistry.Get(f[o.Kind])(f,b)||(yield p(s.Kind,f,v,b))}function*R(f,I,v,b){let U=c(f.$id)?[...I,f]:I,q=f;switch(q[o.Kind]){case"Any":return yield*S(q,U,v,b);case"Array":return yield*x(q,U,v,b);case"AsyncIterator":return yield*E(q,U,v,b);case"BigInt":return yield*z(q,U,v,b);case"Boolean":return yield*W(q,U,v,b);case"Constructor":return yield*T(q,U,v,b);case"Date":return yield*k(q,U,v,b);case"Function":return yield*G(q,U,v,b);case"Integer":return yield*H(q,U,v,b);case"Intersect":return yield*F(q,U,v,b);case"Iterator":return yield*Y(q,U,v,b);case"Literal":return yield*V(q,U,v,b);case"Never":return yield*ae(q,U,v,b);case"Not":return yield*L(q,U,v,b);case"Null":return yield*M(q,U,v,b);case"Number":return yield*j(q,U,v,b);case"Object":return yield*ne(q,U,v,b);case"Promise":return yield*re(q,U,v,b);case"Record":return yield*O(q,U,v,b);case"Ref":return yield*J(q,U,v,b);case"String":return yield*oe(q,U,v,b);case"Symbol":return yield*X(q,U,v,b);case"TemplateLiteral":return yield*Z(q,U,v,b);case"This":return yield*pe(q,U,v,b);case"Tuple":return yield*d(q,U,v,b);case"Undefined":return yield*w(q,U,v,b);case"Union":return yield*C(q,U,v,b);case"Uint8Array":return yield*D(q,U,v,b);case"Unknown":return yield*P(q,U,v,b);case"Void":return yield*N(q,U,v,b);default:if(!o.TypeRegistry.Has(q[o.Kind]))throw new a(f);return yield*g(q,U,v,b)}}function _(...f){let I=f.length===3?R(f[0],f[1],"",f[2]):R(f[0],[],"",f[1]);return new l(I)}e.Errors=_}}),hv=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/errors/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(n,i,o,s){s===void 0&&(s=o);var a=Object.getOwnPropertyDescriptor(i,o);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(n,s,a)}:function(n,i,o,s){s===void 0&&(s=o),n[s]=i[o]}),r=e&&e.__exportStar||function(n,i){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,n,o)};Object.defineProperty(e,"__esModule",{value:!0}),r(hs(),e)}}),gp=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/system/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(i,o,s,a){a===void 0&&(a=s);var u=Object.getOwnPropertyDescriptor(o,s);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[s]}}),Object.defineProperty(i,a,u)}:function(i,o,s,a){a===void 0&&(a=s),i[a]=o[s]}),r=e&&e.__exportStar||function(i,o){for(var s in i)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&t(o,i,s)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorType=void 0;var n=hs();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),r(yp(),e)}}),yv=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/check.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Check=e.ValueCheckUnknownTypeError=void 0;var t=kn(),r=gp(),n=ps(),i=vu(),o=ur(),s=class extends o.TypeBoxError{constructor(g){super("Unknown type"),this.schema=g}};e.ValueCheckUnknownTypeError=s;function a(g){return g[o.Kind]==="Any"||g[o.Kind]==="Unknown"}function u(g){return g!==void 0}function c(g,R,_){return!0}function l(g,R,_){if(!(0,t.IsArray)(_)||u(g.minItems)&&!(_.length>=g.minItems)||u(g.maxItems)&&!(_.length<=g.maxItems)||!_.every(v=>P(g.items,R,v))||g.uniqueItems===!0&&!function(){let v=new Set;for(let b of _){let U=(0,i.Hash)(b);if(v.has(U))return!1;v.add(U)}return!0}())return!1;if(!(u(g.contains)||(0,t.IsNumber)(g.minContains)||(0,t.IsNumber)(g.maxContains)))return!0;let f=u(g.contains)?g.contains:o.Type.Never(),I=_.reduce((v,b)=>P(f,R,b)?v+1:v,0);return!(I===0||(0,t.IsNumber)(g.minContains)&&I<g.minContains||(0,t.IsNumber)(g.maxContains)&&I>g.maxContains)}function p(g,R,_){return(0,t.IsAsyncIterator)(_)}function S(g,R,_){return!(!(0,t.IsBigInt)(_)||u(g.exclusiveMaximum)&&!(_<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(_>g.exclusiveMinimum)||u(g.maximum)&&!(_<=g.maximum)||u(g.minimum)&&!(_>=g.minimum)||u(g.multipleOf)&&_%g.multipleOf!==BigInt(0))}function x(g,R,_){return(0,t.IsBoolean)(_)}function E(g,R,_){return P(g.returns,R,_.prototype)}function z(g,R,_){return!(!(0,t.IsDate)(_)||u(g.exclusiveMaximumTimestamp)&&!(_.getTime()<g.exclusiveMaximumTimestamp)||u(g.exclusiveMinimumTimestamp)&&!(_.getTime()>g.exclusiveMinimumTimestamp)||u(g.maximumTimestamp)&&!(_.getTime()<=g.maximumTimestamp)||u(g.minimumTimestamp)&&!(_.getTime()>=g.minimumTimestamp)||u(g.multipleOfTimestamp)&&_.getTime()%g.multipleOfTimestamp!==0)}function W(g,R,_){return(0,t.IsFunction)(_)}function T(g,R,_){return!(!(0,t.IsInteger)(_)||u(g.exclusiveMaximum)&&!(_<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(_>g.exclusiveMinimum)||u(g.maximum)&&!(_<=g.maximum)||u(g.minimum)&&!(_>=g.minimum)||u(g.multipleOf)&&_%g.multipleOf!==0)}function k(g,R,_){let f=g.allOf.every(I=>P(I,R,_));if(g.unevaluatedProperties===!1){let I=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(_).every(b=>I.test(b));return f&&v}else if(o.TypeGuard.TSchema(g.unevaluatedProperties)){let I=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(_).every(b=>I.test(b)||P(g.unevaluatedProperties,R,_[b]));return f&&v}else return f}function G(g,R,_){return(0,t.IsIterator)(_)}function H(g,R,_){return _===g.const}function F(g,R,_){return!1}function Y(g,R,_){return!P(g.not,R,_)}function V(g,R,_){return(0,t.IsNull)(_)}function ae(g,R,_){return!(!r.TypeSystemPolicy.IsNumberLike(_)||u(g.exclusiveMaximum)&&!(_<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(_>g.exclusiveMinimum)||u(g.minimum)&&!(_>=g.minimum)||u(g.maximum)&&!(_<=g.maximum)||u(g.multipleOf)&&_%g.multipleOf!==0)}function L(g,R,_){if(!r.TypeSystemPolicy.IsObjectLike(_)||u(g.minProperties)&&!(Object.getOwnPropertyNames(_).length>=g.minProperties)||u(g.maxProperties)&&!(Object.getOwnPropertyNames(_).length<=g.maxProperties))return!1;let f=Object.getOwnPropertyNames(g.properties);for(let I of f){let v=g.properties[I];if(g.required&&g.required.includes(I)){if(!P(v,R,_[I])||(o.ExtendsUndefined.Check(v)||a(v))&&!(I in _))return!1}else if(r.TypeSystemPolicy.IsExactOptionalProperty(_,I)&&!P(v,R,_[I]))return!1}if(g.additionalProperties===!1){let I=Object.getOwnPropertyNames(_);return g.required&&g.required.length===f.length&&I.length===f.length?!0:I.every(v=>f.includes(v))}else return typeof g.additionalProperties=="object"?Object.getOwnPropertyNames(_).every(v=>f.includes(v)||P(g.additionalProperties,R,_[v])):!0}function M(g,R,_){return(0,t.IsPromise)(_)}function j(g,R,_){if(!r.TypeSystemPolicy.IsRecordLike(_)||u(g.minProperties)&&!(Object.getOwnPropertyNames(_).length>=g.minProperties)||u(g.maxProperties)&&!(Object.getOwnPropertyNames(_).length<=g.maxProperties))return!1;let[f,I]=Object.entries(g.patternProperties)[0],v=new RegExp(f),b=Object.entries(_).every(([te,ie])=>v.test(te)?P(I,R,ie):!0),U=typeof g.additionalProperties=="object"?Object.entries(_).every(([te,ie])=>v.test(te)?!0:P(g.additionalProperties,R,ie)):!0,q=g.additionalProperties===!1?Object.getOwnPropertyNames(_).every(te=>v.test(te)):!0;return b&&U&&q}function ne(g,R,_){return P((0,n.Deref)(g,R),R,_)}function re(g,R,_){return!(0,t.IsString)(_)||u(g.minLength)&&!(_.length>=g.minLength)||u(g.maxLength)&&!(_.length<=g.maxLength)||u(g.pattern)&&!new RegExp(g.pattern).test(_)?!1:u(g.format)?o.FormatRegistry.Has(g.format)?o.FormatRegistry.Get(g.format)(_):!1:!0}function O(g,R,_){return(0,t.IsSymbol)(_)}function J(g,R,_){return(0,t.IsString)(_)&&new RegExp(g.pattern).test(_)}function oe(g,R,_){return P((0,n.Deref)(g,R),R,_)}function X(g,R,_){if(!(0,t.IsArray)(_)||g.items===void 0&&_.length!==0||_.length!==g.maxItems)return!1;if(!g.items)return!0;for(let f=0;f<g.items.length;f++)if(!P(g.items[f],R,_[f]))return!1;return!0}function Z(g,R,_){return(0,t.IsUndefined)(_)}function pe(g,R,_){return g.anyOf.some(f=>P(f,R,_))}function d(g,R,_){return!(!(0,t.IsUint8Array)(_)||u(g.maxByteLength)&&!(_.length<=g.maxByteLength)||u(g.minByteLength)&&!(_.length>=g.minByteLength))}function w(g,R,_){return!0}function C(g,R,_){return r.TypeSystemPolicy.IsVoidLike(_)}function D(g,R,_){return o.TypeRegistry.Has(g[o.Kind])?o.TypeRegistry.Get(g[o.Kind])(g,_):!1}function P(g,R,_){let f=u(g.$id)?[...R,g]:R,I=g;switch(I[o.Kind]){case"Any":return c(I,f,_);case"Array":return l(I,f,_);case"AsyncIterator":return p(I,f,_);case"BigInt":return S(I,f,_);case"Boolean":return x(I,f,_);case"Constructor":return E(I,f,_);case"Date":return z(I,f,_);case"Function":return W(I,f,_);case"Integer":return T(I,f,_);case"Intersect":return k(I,f,_);case"Iterator":return G(I,f,_);case"Literal":return H(I,f,_);case"Never":return F(I,f,_);case"Not":return Y(I,f,_);case"Null":return V(I,f,_);case"Number":return ae(I,f,_);case"Object":return L(I,f,_);case"Promise":return M(I,f,_);case"Record":return j(I,f,_);case"Ref":return ne(I,f,_);case"String":return re(I,f,_);case"Symbol":return O(I,f,_);case"TemplateLiteral":return J(I,f,_);case"This":return oe(I,f,_);case"Tuple":return X(I,f,_);case"Undefined":return Z(I,f,_);case"Union":return pe(I,f,_);case"Uint8Array":return d(I,f,_);case"Unknown":return w(I,f,_);case"Void":return C(I,f,_);default:if(!o.TypeRegistry.Has(I[o.Kind]))throw new s(I);return D(I,f,_)}}function N(...g){return g.length===3?P(g[0],g[1],g[2]):P(g[0],[],g[1])}e.Check=N}}),gv=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/transform.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EncodeTransform=e.DecodeTransform=e.HasTransform=e.TransformEncodeError=e.TransformDecodeError=e.TransformEncodeCheckError=e.TransformDecodeCheckError=void 0;var t=kn(),r=ps(),n=yv(),i=ur(),o=class extends i.TypeBoxError{constructor(S,x,E){super("Unable to decode due to invalid value"),this.schema=S,this.value=x,this.error=E}};e.TransformDecodeCheckError=o;var s=class extends i.TypeBoxError{constructor(S,x,E){super("Unable to encode due to invalid value"),this.schema=S,this.value=x,this.error=E}};e.TransformEncodeCheckError=s;var a=class extends i.TypeBoxError{constructor(S,x,E){super(`${E instanceof Error?E.message:"Unknown error"}`),this.schema=S,this.value=x}};e.TransformDecodeError=a;var u=class extends i.TypeBoxError{constructor(S,x,E){super(`${E instanceof Error?E.message:"Unknown error"}`),this.schema=S,this.value=x}};e.TransformEncodeError=u;var c;(function(S){function x(O,J){return i.TypeGuard.TTransform(O)||j(O.items,J)}function E(O,J){return i.TypeGuard.TTransform(O)||j(O.items,J)}function z(O,J){return i.TypeGuard.TTransform(O)||j(O.returns,J)||O.parameters.some(oe=>j(oe,J))}function W(O,J){return i.TypeGuard.TTransform(O)||j(O.returns,J)||O.parameters.some(oe=>j(oe,J))}function T(O,J){return i.TypeGuard.TTransform(O)||i.TypeGuard.TTransform(O.unevaluatedProperties)||O.allOf.some(oe=>j(oe,J))}function k(O,J){return i.TypeGuard.TTransform(O)||j(O.items,J)}function G(O,J){return i.TypeGuard.TTransform(O)||j(O.not,J)}function H(O,J){return i.TypeGuard.TTransform(O)||Object.values(O.properties).some(oe=>j(oe,J))||i.TypeGuard.TSchema(O.additionalProperties)&&j(O.additionalProperties,J)}function F(O,J){return i.TypeGuard.TTransform(O)||j(O.item,J)}function Y(O,J){let oe=Object.getOwnPropertyNames(O.patternProperties)[0],X=O.patternProperties[oe];return i.TypeGuard.TTransform(O)||j(X,J)||i.TypeGuard.TSchema(O.additionalProperties)&&i.TypeGuard.TTransform(O.additionalProperties)}function V(O,J){return i.TypeGuard.TTransform(O)?!0:j((0,r.Deref)(O,J),J)}function ae(O,J){return i.TypeGuard.TTransform(O)?!0:j((0,r.Deref)(O,J),J)}function L(O,J){return i.TypeGuard.TTransform(O)||!(0,t.IsUndefined)(O.items)&&O.items.some(oe=>j(oe,J))}function M(O,J){return i.TypeGuard.TTransform(O)||O.anyOf.some(oe=>j(oe,J))}function j(O,J){let oe=(0,t.IsString)(O.$id)?[...J,O]:J,X=O;if(O.$id&&ne.has(O.$id))return!1;switch(O.$id&&ne.add(O.$id),O[i.Kind]){case"Array":return x(X,oe);case"AsyncIterator":return E(X,oe);case"Constructor":return z(X,oe);case"Function":return W(X,oe);case"Intersect":return T(X,oe);case"Iterator":return k(X,oe);case"Not":return G(X,oe);case"Object":return H(X,oe);case"Promise":return F(X,oe);case"Record":return Y(X,oe);case"Ref":return V(X,oe);case"This":return ae(X,oe);case"Tuple":return L(X,oe);case"Union":return M(X,oe);default:return i.TypeGuard.TTransform(O)}}let ne=new Set;function re(O,J){return ne.clear(),j(O,J)}S.Has=re})(c||(e.HasTransform=c={}));var l;(function(S){function x(L,M){try{return i.TypeGuard.TTransform(L)?L[i.Transform].Decode(M):M}catch(j){throw new a(L,M,j)}}function E(L,M,j){return(0,t.IsArray)(j)?x(L,j.map(ne=>V(L.items,M,ne))):x(L,j)}function z(L,M,j){if(!(0,t.IsPlainObject)(j)||(0,t.IsValueType)(j))return x(L,j);let ne=i.KeyResolver.ResolveKeys(L,{includePatterns:!1}),re=ne.reduce((X,Z)=>Z in X?{...X,[Z]:V(i.IndexedAccessor.Resolve(L,[Z]),M,X[Z])}:X,j);if(!i.TypeGuard.TTransform(L.unevaluatedProperties))return x(L,re);let O=Object.getOwnPropertyNames(re),J=L.unevaluatedProperties,oe=O.reduce((X,Z)=>ne.includes(Z)?X:{...X,[Z]:x(J,X[Z])},re);return x(L,oe)}function W(L,M,j){return x(L,V(L.not,M,j))}function T(L,M,j){if(!(0,t.IsPlainObject)(j))return x(L,j);let ne=i.KeyResolver.ResolveKeys(L,{includePatterns:!1}),re=ne.reduce((X,Z)=>Z in X?{...X,[Z]:V(L.properties[Z],M,X[Z])}:X,j);if(!i.TypeGuard.TSchema(L.additionalProperties))return x(L,re);let O=Object.getOwnPropertyNames(re),J=L.additionalProperties,oe=O.reduce((X,Z)=>ne.includes(Z)?X:{...X,[Z]:x(J,X[Z])},re);return x(L,oe)}function k(L,M,j){if(!(0,t.IsPlainObject)(j))return x(L,j);let ne=Object.getOwnPropertyNames(L.patternProperties)[0],re=new RegExp(ne),O=Object.getOwnPropertyNames(j).reduce((Z,pe)=>re.test(pe)?{...Z,[pe]:V(L.patternProperties[ne],M,Z[pe])}:Z,j);if(!i.TypeGuard.TSchema(L.additionalProperties))return x(L,O);let J=Object.getOwnPropertyNames(O),oe=L.additionalProperties,X=J.reduce((Z,pe)=>re.test(pe)?Z:{...Z,[pe]:x(oe,Z[pe])},O);return x(L,X)}function G(L,M,j){let ne=(0,r.Deref)(L,M);return x(L,V(ne,M,j))}function H(L,M,j){let ne=(0,r.Deref)(L,M);return x(L,V(ne,M,j))}function F(L,M,j){return(0,t.IsArray)(j)&&(0,t.IsArray)(L.items)?x(L,L.items.map((ne,re)=>V(ne,M,j[re]))):x(L,j)}function Y(L,M,j){let ne=x(L,j);for(let re of L.anyOf)if((0,n.Check)(re,M,ne))return V(re,M,ne);return ne}function V(L,M,j){let ne=typeof L.$id=="string"?[...M,L]:M,re=L;switch(L[i.Kind]){case"Array":return E(re,ne,j);case"Intersect":return z(re,ne,j);case"Not":return W(re,ne,j);case"Object":return T(re,ne,j);case"Record":return k(re,ne,j);case"Ref":return G(re,ne,j);case"Symbol":return x(re,j);case"This":return H(re,ne,j);case"Tuple":return F(re,ne,j);case"Union":return Y(re,ne,j);default:return x(re,j)}}function ae(L,M,j){return V(L,M,j)}S.Decode=ae})(l||(e.DecodeTransform=l={}));var p;(function(S){function x(L,M){try{return i.TypeGuard.TTransform(L)?L[i.Transform].Encode(M):M}catch(j){throw new u(L,M,j)}}function E(L,M,j){let ne=x(L,j);return(0,t.IsArray)(ne)?ne.map(re=>V(L.items,M,re)):ne}function z(L,M,j){let ne=x(L,j);if(!(0,t.IsPlainObject)(j)||(0,t.IsValueType)(j))return ne;let re=i.KeyResolver.ResolveKeys(L,{includePatterns:!1}),O=re.reduce((X,Z)=>Z in ne?{...X,[Z]:V(i.IndexedAccessor.Resolve(L,[Z]),M,X[Z])}:X,ne);if(!i.TypeGuard.TTransform(L.unevaluatedProperties))return x(L,O);let J=Object.getOwnPropertyNames(O),oe=L.unevaluatedProperties;return J.reduce((X,Z)=>re.includes(Z)?X:{...X,[Z]:x(oe,X[Z])},O)}function W(L,M,j){return x(L.not,x(L,j))}function T(L,M,j){let ne=x(L,j);if(!(0,t.IsPlainObject)(j))return ne;let re=i.KeyResolver.ResolveKeys(L,{includePatterns:!1}),O=re.reduce((X,Z)=>Z in X?{...X,[Z]:V(L.properties[Z],M,X[Z])}:X,ne);if(!i.TypeGuard.TSchema(L.additionalProperties))return O;let J=Object.getOwnPropertyNames(O),oe=L.additionalProperties;return J.reduce((X,Z)=>re.includes(Z)?X:{...X,[Z]:x(oe,X[Z])},O)}function k(L,M,j){let ne=x(L,j);if(!(0,t.IsPlainObject)(j))return ne;let re=Object.getOwnPropertyNames(L.patternProperties)[0],O=new RegExp(re),J=Object.getOwnPropertyNames(j).reduce((Z,pe)=>O.test(pe)?{...Z,[pe]:V(L.patternProperties[re],M,Z[pe])}:Z,ne);if(!i.TypeGuard.TSchema(L.additionalProperties))return x(L,J);let oe=Object.getOwnPropertyNames(J),X=L.additionalProperties;return oe.reduce((Z,pe)=>O.test(pe)?Z:{...Z,[pe]:x(X,Z[pe])},J)}function G(L,M,j){let ne=(0,r.Deref)(L,M),re=V(ne,M,j);return x(L,re)}function H(L,M,j){let ne=(0,r.Deref)(L,M),re=V(ne,M,j);return x(L,re)}function F(L,M,j){let ne=x(L,j);return(0,t.IsArray)(L.items)?L.items.map((re,O)=>V(re,M,ne[O])):[]}function Y(L,M,j){for(let ne of L.anyOf){if(!(0,n.Check)(ne,M,j))continue;let re=V(ne,M,j);return x(L,re)}for(let ne of L.anyOf){let re=V(ne,M,j);if((0,n.Check)(L,M,re))return x(L,re)}return x(L,j)}function V(L,M,j){let ne=typeof L.$id=="string"?[...M,L]:M,re=L;switch(L[i.Kind]){case"Array":return E(re,ne,j);case"Intersect":return z(re,ne,j);case"Not":return W(re,ne,j);case"Object":return T(re,ne,j);case"Record":return k(re,ne,j);case"Ref":return G(re,ne,j);case"This":return H(re,ne,j);case"Tuple":return F(re,ne,j);case"Union":return Y(re,ne,j);default:return x(re,j)}}function ae(L,M,j){return V(L,M,j)}S.Encode=ae})(p||(e.EncodeTransform=p={}))}}),mv=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/compiler/compiler.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeCompiler=e.Policy=e.TypeCompilerTypeGuardError=e.TypeCompilerUnknownTypeError=e.TypeCheck=void 0;var t=gv(),r=kn(),n=hs(),i=gp(),o=ps(),s=vu(),a=ur(),u=class{constructor(T,k,G,H){this.schema=T,this.references=k,this.checkFunc=G,this.code=H,this.hasTransform=t.HasTransform.Has(T,k)}Code(){return this.code}Errors(T){return(0,n.Errors)(this.schema,this.references,T)}Check(T){return this.checkFunc(T)}Decode(T){if(!this.checkFunc(T))throw new t.TransformDecodeCheckError(this.schema,T,this.Errors(T).First());return this.hasTransform?t.DecodeTransform.Decode(this.schema,this.references,T):T}Encode(T){let k=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,T):T;if(!this.checkFunc(k))throw new t.TransformEncodeCheckError(this.schema,T,this.Errors(T).First());return k}};e.TypeCheck=u;var c;(function(T){function k(Y){return Y===36}T.DollarSign=k;function G(Y){return Y===95}T.IsUnderscore=G;function H(Y){return Y>=65&&Y<=90||Y>=97&&Y<=122}T.IsAlpha=H;function F(Y){return Y>=48&&Y<=57}T.IsNumeric=F})(c||(c={}));var l;(function(T){function k(Y){return Y.length===0?!1:c.IsNumeric(Y.charCodeAt(0))}function G(Y){if(k(Y))return!1;for(let V=0;V<Y.length;V++){let ae=Y.charCodeAt(V);if(!(c.IsAlpha(ae)||c.IsNumeric(ae)||c.DollarSign(ae)||c.IsUnderscore(ae)))return!1}return!0}function H(Y){return Y.replace(/'/g,"\\'")}function F(Y,V){return G(V)?`${Y}.${V}`:`${Y}['${H(V)}']`}T.Encode=F})(l||(l={}));var p;(function(T){function k(G){let H=[];for(let F=0;F<G.length;F++){let Y=G.charCodeAt(F);c.IsNumeric(Y)||c.IsAlpha(Y)?H.push(G.charAt(F)):H.push(`_${Y}_`)}return H.join("").replace(/__/g,"_")}T.Encode=k})(p||(p={}));var S;(function(T){function k(G){return G.replace(/'/g,"\\'")}T.Escape=k})(S||(S={}));var x=class extends a.TypeBoxError{constructor(T){super("Unknown type"),this.schema=T}};e.TypeCompilerUnknownTypeError=x;var E=class extends a.TypeBoxError{constructor(T){super("Preflight validation check failed to guard for the given schema"),this.schema=T}};e.TypeCompilerTypeGuardError=E;var z;(function(T){function k(V,ae,L){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${ae}' in ${V} ? ${L} : true)`:`(${l.Encode(V,ae)} !== undefined ? ${L} : true)`}T.IsExactOptionalProperty=k;function G(V){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${V} === 'object' && ${V} !== null)`:`(typeof ${V} === 'object' && ${V} !== null && !Array.isArray(${V}))`}T.IsObjectLike=G;function H(V){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${V} === 'object' && ${V} !== null && !(${V} instanceof Date) && !(${V} instanceof Uint8Array))`:`(typeof ${V} === 'object' && ${V} !== null && !Array.isArray(${V}) && !(${V} instanceof Date) && !(${V} instanceof Uint8Array))`}T.IsRecordLike=H;function F(V){return i.TypeSystemPolicy.AllowNaN?`typeof ${V} === 'number'`:`(typeof ${V} === 'number' && Number.isFinite(${V}))`}T.IsNumberLike=F;function Y(V){return i.TypeSystemPolicy.AllowNullVoid?`(${V} === undefined || ${V} === null)`:`${V} === undefined`}T.IsVoidLike=Y})(z||(e.Policy=z={}));var W;(function(T){function k(A){return A[a.Kind]==="Any"||A[a.Kind]==="Unknown"}function*G(A,de,$){yield"true"}function*H(A,de,$){yield`Array.isArray(${$})`;let[me,se]=[Fe("value","any"),Fe("acc","number")];(0,r.IsNumber)(A.maxItems)&&(yield`${$}.length <= ${A.maxItems}`),(0,r.IsNumber)(A.minItems)&&(yield`${$}.length >= ${A.minItems}`);let he=ie(A.items,de,"value");if(yield`${$}.every((${me}) => ${he})`,a.TypeGuard.TSchema(A.contains)||(0,r.IsNumber)(A.minContains)||(0,r.IsNumber)(A.maxContains)){let Se=a.TypeGuard.TSchema(A.contains)?A.contains:a.Type.Never(),ke=ie(Se,de,"value"),rt=(0,r.IsNumber)(A.minContains)?[`(count >= ${A.minContains})`]:[],Ze=(0,r.IsNumber)(A.maxContains)?[`(count <= ${A.maxContains})`]:[],it=`const count = value.reduce((${se}, ${me}) => ${ke} ? acc + 1 : acc, 0)`,er=["(count > 0)",...rt,...Ze].join(" && ");yield`((${me}) => { ${it}; return ${er}})(${$})`}A.uniqueItems===!0&&(yield`((${me}) => { const set = new Set(); for(const element of value) { const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true } )(${$})`)}function*F(A,de,$){yield`(typeof value === 'object' && Symbol.asyncIterator in ${$})`}function*Y(A,de,$){yield`(typeof ${$} === 'bigint')`,(0,r.IsBigInt)(A.exclusiveMaximum)&&(yield`${$} < BigInt(${A.exclusiveMaximum})`),(0,r.IsBigInt)(A.exclusiveMinimum)&&(yield`${$} > BigInt(${A.exclusiveMinimum})`),(0,r.IsBigInt)(A.maximum)&&(yield`${$} <= BigInt(${A.maximum})`),(0,r.IsBigInt)(A.minimum)&&(yield`${$} >= BigInt(${A.minimum})`),(0,r.IsBigInt)(A.multipleOf)&&(yield`(${$} % BigInt(${A.multipleOf})) === 0`)}function*V(A,de,$){yield`(typeof ${$} === 'boolean')`}function*ae(A,de,$){yield*q(A.returns,de,`${$}.prototype`)}function*L(A,de,$){yield`(${$} instanceof Date) && Number.isFinite(${$}.getTime())`,(0,r.IsNumber)(A.exclusiveMaximumTimestamp)&&(yield`${$}.getTime() < ${A.exclusiveMaximumTimestamp}`),(0,r.IsNumber)(A.exclusiveMinimumTimestamp)&&(yield`${$}.getTime() > ${A.exclusiveMinimumTimestamp}`),(0,r.IsNumber)(A.maximumTimestamp)&&(yield`${$}.getTime() <= ${A.maximumTimestamp}`),(0,r.IsNumber)(A.minimumTimestamp)&&(yield`${$}.getTime() >= ${A.minimumTimestamp}`),(0,r.IsNumber)(A.multipleOfTimestamp)&&(yield`(${$}.getTime() % ${A.multipleOfTimestamp}) === 0`)}function*M(A,de,$){yield`(typeof ${$} === 'function')`}function*j(A,de,$){yield`(typeof ${$} === 'number' && Number.isInteger(${$}))`,(0,r.IsNumber)(A.exclusiveMaximum)&&(yield`${$} < ${A.exclusiveMaximum}`),(0,r.IsNumber)(A.exclusiveMinimum)&&(yield`${$} > ${A.exclusiveMinimum}`),(0,r.IsNumber)(A.maximum)&&(yield`${$} <= ${A.maximum}`),(0,r.IsNumber)(A.minimum)&&(yield`${$} >= ${A.minimum}`),(0,r.IsNumber)(A.multipleOf)&&(yield`(${$} % ${A.multipleOf}) === 0`)}function*ne(A,de,$){let me=A.allOf.map(se=>ie(se,de,$)).join(" && ");if(A.unevaluatedProperties===!1){let se=_e(`${new RegExp(a.KeyResolver.ResolvePattern(A))};`),he=`Object.getOwnPropertyNames(${$}).every(key => ${se}.test(key))`;yield`(${me} && ${he})`}else if(a.TypeGuard.TSchema(A.unevaluatedProperties)){let se=_e(`${new RegExp(a.KeyResolver.ResolvePattern(A))};`),he=`Object.getOwnPropertyNames(${$}).every(key => ${se}.test(key) || ${ie(A.unevaluatedProperties,de,`${$}[key]`)})`;yield`(${me} && ${he})`}else yield`(${me})`}function*re(A,de,$){yield`(typeof value === 'object' && Symbol.iterator in ${$})`}function*O(A,de,$){typeof A.const=="number"||typeof A.const=="boolean"?yield`(${$} === ${A.const})`:yield`(${$} === '${S.Escape(A.const)}')`}function*J(A,de,$){yield"false"}function*oe(A,de,$){yield`(!${ie(A.not,de,$)})`}function*X(A,de,$){yield`(${$} === null)`}function*Z(A,de,$){yield z.IsNumberLike($),(0,r.IsNumber)(A.exclusiveMaximum)&&(yield`${$} < ${A.exclusiveMaximum}`),(0,r.IsNumber)(A.exclusiveMinimum)&&(yield`${$} > ${A.exclusiveMinimum}`),(0,r.IsNumber)(A.maximum)&&(yield`${$} <= ${A.maximum}`),(0,r.IsNumber)(A.minimum)&&(yield`${$} >= ${A.minimum}`),(0,r.IsNumber)(A.multipleOf)&&(yield`(${$} % ${A.multipleOf}) === 0`)}function*pe(A,de,$){yield z.IsObjectLike($),(0,r.IsNumber)(A.minProperties)&&(yield`Object.getOwnPropertyNames(${$}).length >= ${A.minProperties}`),(0,r.IsNumber)(A.maxProperties)&&(yield`Object.getOwnPropertyNames(${$}).length <= ${A.maxProperties}`);let me=Object.getOwnPropertyNames(A.properties);for(let se of me){let he=l.Encode($,se),Se=A.properties[se];if(A.required&&A.required.includes(se))yield*q(Se,de,he),(a.ExtendsUndefined.Check(Se)||k(Se))&&(yield`('${se}' in ${$})`);else{let ke=ie(Se,de,he);yield z.IsExactOptionalProperty($,se,ke)}}if(A.additionalProperties===!1)if(A.required&&A.required.length===me.length)yield`Object.getOwnPropertyNames(${$}).length === ${me.length}`;else{let se=`[${me.map(he=>`'${he}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${$}).every(key => ${se}.includes(key))`}if(typeof A.additionalProperties=="object"){let se=ie(A.additionalProperties,de,`${$}[key]`),he=`[${me.map(Se=>`'${Se}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${$}).every(key => ${he}.includes(key) || ${se}))`}}function*d(A,de,$){yield`(typeof value === 'object' && typeof ${$}.then === 'function')`}function*w(A,de,$){yield z.IsRecordLike($),(0,r.IsNumber)(A.minProperties)&&(yield`Object.getOwnPropertyNames(${$}).length >= ${A.minProperties}`),(0,r.IsNumber)(A.maxProperties)&&(yield`Object.getOwnPropertyNames(${$}).length <= ${A.maxProperties}`);let[me,se]=Object.entries(A.patternProperties)[0],he=_e(`${new RegExp(me)}`),Se=ie(se,de,"value"),ke=a.TypeGuard.TSchema(A.additionalProperties)?ie(A.additionalProperties,de,$):A.additionalProperties===!1?"false":"true",rt=`(${he}.test(key) ? ${Se} : ${ke})`;yield`(Object.entries(${$}).every(([key, value]) => ${rt}))`}function*C(A,de,$){let me=(0,o.Deref)(A,de);if(te.functions.has(A.$ref))return yield`${ge(A.$ref)}(${$})`;yield*q(me,de,$)}function*D(A,de,$){yield`(typeof ${$} === 'string')`,(0,r.IsNumber)(A.maxLength)&&(yield`${$}.length <= ${A.maxLength}`),(0,r.IsNumber)(A.minLength)&&(yield`${$}.length >= ${A.minLength}`),A.pattern!==void 0&&(yield`${_e(`${new RegExp(A.pattern)};`)}.test(${$})`),A.format!==void 0&&(yield`format('${A.format}', ${$})`)}function*P(A,de,$){yield`(typeof ${$} === 'symbol')`}function*N(A,de,$){yield`(typeof ${$} === 'string')`,yield`${_e(`${new RegExp(A.pattern)};`)}.test(${$})`}function*g(A,de,$){yield`${ge(A.$ref)}(${$})`}function*R(A,de,$){if(yield`Array.isArray(${$})`,A.items===void 0)return yield`${$}.length === 0`;yield`(${$}.length === ${A.maxItems})`;for(let me=0;me<A.items.length;me++)yield`${ie(A.items[me],de,`${$}[${me}]`)}`}function*_(A,de,$){yield`${$} === undefined`}function*f(A,de,$){yield`(${A.anyOf.map(se=>ie(se,de,$)).join(" || ")})`}function*I(A,de,$){yield`${$} instanceof Uint8Array`,(0,r.IsNumber)(A.maxByteLength)&&(yield`(${$}.length <= ${A.maxByteLength})`),(0,r.IsNumber)(A.minByteLength)&&(yield`(${$}.length >= ${A.minByteLength})`)}function*v(A,de,$){yield"true"}function*b(A,de,$){yield z.IsVoidLike($)}function*U(A,de,$){let me=te.instances.size;te.instances.set(me,A),yield`kind('${A[a.Kind]}', ${me}, ${$})`}function*q(A,de,$,me=!0){let se=(0,r.IsString)(A.$id)?[...de,A]:de,he=A;if(me&&(0,r.IsString)(A.$id)){let Se=ge(A.$id);if(te.functions.has(Se))return yield`${Se}(${$})`;{let ke=Be(Se,A,de,"value",!1);return te.functions.set(Se,ke),yield`${Se}(${$})`}}switch(he[a.Kind]){case"Any":return yield*G(he,se,$);case"Array":return yield*H(he,se,$);case"AsyncIterator":return yield*F(he,se,$);case"BigInt":return yield*Y(he,se,$);case"Boolean":return yield*V(he,se,$);case"Constructor":return yield*ae(he,se,$);case"Date":return yield*L(he,se,$);case"Function":return yield*M(he,se,$);case"Integer":return yield*j(he,se,$);case"Intersect":return yield*ne(he,se,$);case"Iterator":return yield*re(he,se,$);case"Literal":return yield*O(he,se,$);case"Never":return yield*J(he,se,$);case"Not":return yield*oe(he,se,$);case"Null":return yield*X(he,se,$);case"Number":return yield*Z(he,se,$);case"Object":return yield*pe(he,se,$);case"Promise":return yield*d(he,se,$);case"Record":return yield*w(he,se,$);case"Ref":return yield*C(he,se,$);case"String":return yield*D(he,se,$);case"Symbol":return yield*P(he,se,$);case"TemplateLiteral":return yield*N(he,se,$);case"This":return yield*g(he,se,$);case"Tuple":return yield*R(he,se,$);case"Undefined":return yield*_(he,se,$);case"Union":return yield*f(he,se,$);case"Uint8Array":return yield*I(he,se,$);case"Unknown":return yield*v(he,se,$);case"Void":return yield*b(he,se,$);default:if(!a.TypeRegistry.Has(he[a.Kind]))throw new x(A);return yield*U(he,se,$)}}let te={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function ie(A,de,$,me=!0){return`(${[...q(A,de,$,me)].join(" && ")})`}function ge(A){return`check_${p.Encode(A)}`}function _e(A){let de=`local_${te.variables.size}`;return te.variables.set(de,`const ${de} = ${A}`),de}function Be(A,de,$,me,se=!0){let[he,Se]=[`
48
+ ${Z}`),J.pop(),`{${C}}`}case"number":return isFinite(O)?String(O):k?k(O):"null";case"boolean":return O===!0?"true":"false";case"undefined":return;case"bigint":if(H)return String(O);default:return k?k(O):void 0}}function j(re,O,J){switch(typeof O){case"string":return o(O);case"object":{if(O===null)return"null";if(typeof O.toJSON=="function"){if(O=O.toJSON(re),typeof O!="object")return j(re,O,J);if(O===null)return"null"}if(J.indexOf(O)!==-1)return G;let oe="";if(Array.isArray(O)){if(O.length===0)return"[]";if(Y<J.length+1)return'"[Array]"';J.push(O);let w=Math.min(O.length,V),C=0;for(;C<w-1;C++){let P=j(String(C),O[C],J);oe+=P!==void 0?P:"null",oe+=","}let D=j(String(C),O[C],J);if(oe+=D!==void 0?D:"null",O.length-1>V){let P=O.length-V-1;oe+=`,"... ${x(P)} not stringified"`}return J.pop(),`[${oe}]`}let X=Object.keys(O),Z=X.length;if(Z===0)return"{}";if(Y<J.length+1)return'"[Object]"';let pe="",d=Math.min(Z,V);u(O)&&(oe+=c(O,",",V),X=X.slice(O.length),d-=O.length,pe=","),F&&(X=s(X)),J.push(O);for(let w=0;w<d;w++){let C=X[w],D=j(C,O[C],J);D!==void 0&&(oe+=`${pe}${o(C)}:${D}`,pe=",")}if(Z>V){let w=Z-V;oe+=`${pe}"...":"${x(w)} not stringified"`}return J.pop(),`{${oe}}`}case"number":return isFinite(O)?String(O):k?k(O):"null";case"boolean":return O===!0?"true":"false";case"undefined":return;case"bigint":if(H)return String(O);default:return k?k(O):void 0}}function ne(re,O,J){if(arguments.length>1){let oe="";if(typeof J=="number"?oe=" ".repeat(Math.min(J,10)):typeof J=="string"&&(oe=J.slice(0,10)),O!=null){if(typeof O=="function")return ae("",{"":re},[],O,oe,"");if(Array.isArray(O))return L("",re,[],E(O),oe,"")}if(oe.length!==0)return M("",re,[],oe,"")}return j("",re,[])}return ne}}}),kn=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/guard.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IsValueType=e.IsSymbol=e.IsFunction=e.IsString=e.IsBigInt=e.IsInteger=e.IsNumber=e.IsBoolean=e.IsNull=e.IsUndefined=e.IsArray=e.IsObject=e.IsPlainObject=e.HasPropertyKey=e.IsDate=e.IsUint8Array=e.IsPromise=e.IsTypedArray=e.IsIterator=e.IsAsyncIterator=void 0;function t(F){return c(F)&&Symbol.asyncIterator in F}e.IsAsyncIterator=t;function r(F){return c(F)&&Symbol.iterator in F}e.IsIterator=r;function n(F){return ArrayBuffer.isView(F)}e.IsTypedArray=n;function i(F){return F instanceof Promise}e.IsPromise=i;function o(F){return F instanceof Uint8Array}e.IsUint8Array=o;function s(F){return F instanceof Date&&Number.isFinite(F.getTime())}e.IsDate=s;function a(F,Y){return Y in F}e.HasPropertyKey=a;function u(F){return c(F)&&k(F.constructor)&&F.constructor.name==="Object"}e.IsPlainObject=u;function c(F){return F!==null&&typeof F=="object"}e.IsObject=c;function l(F){return Array.isArray(F)&&!ArrayBuffer.isView(F)}e.IsArray=l;function p(F){return F===void 0}e.IsUndefined=p;function S(F){return F===null}e.IsNull=S;function x(F){return typeof F=="boolean"}e.IsBoolean=x;function E(F){return typeof F=="number"}e.IsNumber=E;function z(F){return E(F)&&Number.isInteger(F)}e.IsInteger=z;function W(F){return typeof F=="bigint"}e.IsBigInt=W;function T(F){return typeof F=="string"}e.IsString=T;function k(F){return typeof F=="function"}e.IsFunction=k;function G(F){return typeof F=="symbol"}e.IsSymbol=G;function H(F){return W(F)||x(F)||S(F)||E(F)||T(F)||G(F)||p(F)}e.IsValueType=H}}),yp=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/system/system.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultErrorFunction=e.TypeSystemPolicy=e.TypeSystemErrorFunction=e.TypeSystem=e.TypeSystemDuplicateFormat=e.TypeSystemDuplicateTypeKind=void 0;var t=kn(),r=ys(),n=ur(),i=class extends n.TypeBoxError{constructor(l){super(`Duplicate type kind '${l}' detected`)}};e.TypeSystemDuplicateTypeKind=i;var o=class extends n.TypeBoxError{constructor(l){super(`Duplicate string format '${l}' detected`)}};e.TypeSystemDuplicateFormat=o;var s;(function(l){function p(x,E){if(n.TypeRegistry.Has(x))throw new i(x);return n.TypeRegistry.Set(x,E),(z={})=>n.Type.Unsafe({...z,[n.Kind]:x})}l.Type=p;function S(x,E){if(n.FormatRegistry.Has(x))throw new o(x);return n.FormatRegistry.Set(x,E),x}l.Format=S})(s||(e.TypeSystem=s={}));var a;(function(l){let p=c;function S(){p=c}l.Reset=S;function x(z){p=z}l.Set=x;function E(){return p}l.Get=E})(a||(e.TypeSystemErrorFunction=a={}));var u;(function(l){l.ExactOptionalPropertyTypes=!1,l.AllowArrayObject=!1,l.AllowNaN=!1,l.AllowNullVoid=!1;function p(W,T){return l.ExactOptionalPropertyTypes?T in W:W[T]!==void 0}l.IsExactOptionalProperty=p;function S(W){let T=(0,t.IsObject)(W);return l.AllowArrayObject?T:T&&!(0,t.IsArray)(W)}l.IsObjectLike=S;function x(W){return S(W)&&!(W instanceof Date)&&!(W instanceof Uint8Array)}l.IsRecordLike=x;function E(W){let T=(0,t.IsNumber)(W);return l.AllowNaN?T:T&&Number.isFinite(W)}l.IsNumberLike=E;function z(W){let T=(0,t.IsUndefined)(W);return l.AllowNullVoid?T||W===null:T}l.IsVoidLike=z})(u||(e.TypeSystemPolicy=u={}));function c(l,p){switch(p){case r.ValueErrorType.ArrayContains:return"Expected array to contain at least one matching value";case r.ValueErrorType.ArrayMaxContains:return`Expected array to contain no more than ${l.maxContains} matching values`;case r.ValueErrorType.ArrayMinContains:return`Expected array to contain at least ${l.minContains} matching values`;case r.ValueErrorType.ArrayMaxItems:return`Expected array length to be less or equal to ${l.maxItems}`;case r.ValueErrorType.ArrayMinItems:return`Expected array length to be greater or equal to ${l.minItems}`;case r.ValueErrorType.ArrayUniqueItems:return"Expected array elements to be unique";case r.ValueErrorType.Array:return"Expected array";case r.ValueErrorType.AsyncIterator:return"Expected AsyncIterator";case r.ValueErrorType.BigIntExclusiveMaximum:return`Expected bigint to be less than ${l.exclusiveMaximum}`;case r.ValueErrorType.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${l.exclusiveMinimum}`;case r.ValueErrorType.BigIntMaximum:return`Expected bigint to be less or equal to ${l.maximum}`;case r.ValueErrorType.BigIntMinimum:return`Expected bigint to be greater or equal to ${l.minimum}`;case r.ValueErrorType.BigIntMultipleOf:return`Expected bigint to be a multiple of ${l.multipleOf}`;case r.ValueErrorType.BigInt:return"Expected bigint";case r.ValueErrorType.Boolean:return"Expected boolean";case r.ValueErrorType.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${l.exclusiveMinimumTimestamp}`;case r.ValueErrorType.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${l.exclusiveMaximumTimestamp}`;case r.ValueErrorType.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${l.minimumTimestamp}`;case r.ValueErrorType.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${l.maximumTimestamp}`;case r.ValueErrorType.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${l.multipleOfTimestamp}`;case r.ValueErrorType.Date:return"Expected Date";case r.ValueErrorType.Function:return"Expected function";case r.ValueErrorType.IntegerExclusiveMaximum:return`Expected integer to be less than ${l.exclusiveMaximum}`;case r.ValueErrorType.IntegerExclusiveMinimum:return`Expected integer to be greater than ${l.exclusiveMinimum}`;case r.ValueErrorType.IntegerMaximum:return`Expected integer to be less or equal to ${l.maximum}`;case r.ValueErrorType.IntegerMinimum:return`Expected integer to be greater or equal to ${l.minimum}`;case r.ValueErrorType.IntegerMultipleOf:return`Expected integer to be a multiple of ${l.multipleOf}`;case r.ValueErrorType.Integer:return"Expected integer";case r.ValueErrorType.IntersectUnevaluatedProperties:return"Unexpected property";case r.ValueErrorType.Intersect:return"Expected all values to match";case r.ValueErrorType.Iterator:return"Expected Iterator";case r.ValueErrorType.Literal:return`Expected ${typeof l.const=="string"?`'${l.const}'`:l.const}`;case r.ValueErrorType.Never:return"Never";case r.ValueErrorType.Not:return"Value should not match";case r.ValueErrorType.Null:return"Expected null";case r.ValueErrorType.NumberExclusiveMaximum:return`Expected number to be less than ${l.exclusiveMaximum}`;case r.ValueErrorType.NumberExclusiveMinimum:return`Expected number to be greater than ${l.exclusiveMinimum}`;case r.ValueErrorType.NumberMaximum:return`Expected number to be less or equal to ${l.maximum}`;case r.ValueErrorType.NumberMinimum:return`Expected number to be greater or equal to ${l.minimum}`;case r.ValueErrorType.NumberMultipleOf:return`Expected number to be a multiple of ${l.multipleOf}`;case r.ValueErrorType.Number:return"Expected number";case r.ValueErrorType.Object:return"Expected object";case r.ValueErrorType.ObjectAdditionalProperties:return"Unexpected property";case r.ValueErrorType.ObjectMaxProperties:return`Expected object to have no more than ${l.maxProperties} properties`;case r.ValueErrorType.ObjectMinProperties:return`Expected object to have at least ${l.minProperties} properties`;case r.ValueErrorType.ObjectRequiredProperty:return"Required property";case r.ValueErrorType.Promise:return"Expected Promise";case r.ValueErrorType.StringFormatUnknown:return`Unknown format '${l.format}'`;case r.ValueErrorType.StringFormat:return`Expected string to match '${l.format}' format`;case r.ValueErrorType.StringMaxLength:return`Expected string length less or equal to ${l.maxLength}`;case r.ValueErrorType.StringMinLength:return`Expected string length greater or equal to ${l.minLength}`;case r.ValueErrorType.StringPattern:return`Expected string to match '${l.pattern}'`;case r.ValueErrorType.String:return"Expected string";case r.ValueErrorType.Symbol:return"Expected symbol";case r.ValueErrorType.TupleLength:return`Expected tuple to have ${l.maxItems||0} elements`;case r.ValueErrorType.Tuple:return"Expected tuple";case r.ValueErrorType.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${l.maxByteLength}`;case r.ValueErrorType.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${l.minByteLength}`;case r.ValueErrorType.Uint8Array:return"Expected Uint8Array";case r.ValueErrorType.Undefined:return"Expected undefined";case r.ValueErrorType.Union:return"Expected union value";case r.ValueErrorType.Void:return"Expected void";case r.ValueErrorType.Kind:return`Expected kind '${l[n.Kind]}'`;default:return"Unknown error type"}}e.DefaultErrorFunction=c}}),hs=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/deref.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Deref=e.TypeDereferenceError=void 0;var t=ur(),r=class extends t.TypeBoxError{constructor(i){super(`Unable to dereference schema with $id '${i.$id}'`),this.schema=i}};e.TypeDereferenceError=r;function n(i,o){let s=o.findIndex(a=>a.$id===i.$ref);if(s===-1)throw new r(i);return o[s]}e.Deref=n}}),vu=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/hash.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.ByteMarker=e.ValueHashError=void 0;var t=kn(),r=class extends Error{constructor(M){super("Unable to hash value"),this.value=M}};e.ValueHashError=r;var n;(function(M){M[M.Undefined=0]="Undefined",M[M.Null=1]="Null",M[M.Boolean=2]="Boolean",M[M.Number=3]="Number",M[M.String=4]="String",M[M.Object=5]="Object",M[M.Array=6]="Array",M[M.Date=7]="Date",M[M.Uint8Array=8]="Uint8Array",M[M.Symbol=9]="Symbol",M[M.BigInt=10]="BigInt"})(n||(e.ByteMarker=n={}));var i=BigInt("14695981039346656037"),[o,s]=[BigInt("1099511628211"),BigInt("2")**BigInt("64")],a=Array.from({length:256}).map((M,j)=>BigInt(j)),u=new Float64Array(1),c=new DataView(u.buffer),l=new Uint8Array(u.buffer);function*p(M){let j=M===0?1:Math.ceil(Math.floor(Math.log2(M)+1)/8);for(let ne=0;ne<j;ne++)yield M>>8*(j-1-ne)&255}function S(M){ae(n.Array);for(let j of M)V(j)}function x(M){ae(n.Boolean),ae(M?1:0)}function E(M){ae(n.BigInt),c.setBigInt64(0,M);for(let j of l)ae(j)}function z(M){ae(n.Date),V(M.getTime())}function W(M){ae(n.Null)}function T(M){ae(n.Number),c.setFloat64(0,M);for(let j of l)ae(j)}function k(M){ae(n.Object);for(let j of globalThis.Object.keys(M).sort())V(j),V(M[j])}function G(M){ae(n.String);for(let j=0;j<M.length;j++)for(let ne of p(M.charCodeAt(j)))ae(ne)}function H(M){ae(n.Symbol),V(M.description)}function F(M){ae(n.Uint8Array);for(let j=0;j<M.length;j++)ae(M[j])}function Y(M){return ae(n.Undefined)}function V(M){if((0,t.IsArray)(M))return S(M);if((0,t.IsBoolean)(M))return x(M);if((0,t.IsBigInt)(M))return E(M);if((0,t.IsDate)(M))return z(M);if((0,t.IsNull)(M))return W(M);if((0,t.IsNumber)(M))return T(M);if((0,t.IsPlainObject)(M))return k(M);if((0,t.IsString)(M))return G(M);if((0,t.IsSymbol)(M))return H(M);if((0,t.IsUint8Array)(M))return F(M);if((0,t.IsUndefined)(M))return Y(M);throw new r(M)}function ae(M){i=i^a[M],i=i*o%s}function L(M){return i=BigInt("14695981039346656037"),V(M),i}e.Hash=L}}),ys=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/errors/errors.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Errors=e.ValueErrorIterator=e.EscapeKey=e.ValueErrorsUnknownTypeError=e.ValueErrorType=void 0;var t=kn(),r=yp(),n=hs(),i=vu(),o=ur(),s;(function(f){f[f.ArrayContains=0]="ArrayContains",f[f.ArrayMaxContains=1]="ArrayMaxContains",f[f.ArrayMaxItems=2]="ArrayMaxItems",f[f.ArrayMinContains=3]="ArrayMinContains",f[f.ArrayMinItems=4]="ArrayMinItems",f[f.ArrayUniqueItems=5]="ArrayUniqueItems",f[f.Array=6]="Array",f[f.AsyncIterator=7]="AsyncIterator",f[f.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",f[f.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",f[f.BigIntMaximum=10]="BigIntMaximum",f[f.BigIntMinimum=11]="BigIntMinimum",f[f.BigIntMultipleOf=12]="BigIntMultipleOf",f[f.BigInt=13]="BigInt",f[f.Boolean=14]="Boolean",f[f.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",f[f.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",f[f.DateMaximumTimestamp=17]="DateMaximumTimestamp",f[f.DateMinimumTimestamp=18]="DateMinimumTimestamp",f[f.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",f[f.Date=20]="Date",f[f.Function=21]="Function",f[f.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",f[f.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",f[f.IntegerMaximum=24]="IntegerMaximum",f[f.IntegerMinimum=25]="IntegerMinimum",f[f.IntegerMultipleOf=26]="IntegerMultipleOf",f[f.Integer=27]="Integer",f[f.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",f[f.Intersect=29]="Intersect",f[f.Iterator=30]="Iterator",f[f.Kind=31]="Kind",f[f.Literal=32]="Literal",f[f.Never=33]="Never",f[f.Not=34]="Not",f[f.Null=35]="Null",f[f.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",f[f.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",f[f.NumberMaximum=38]="NumberMaximum",f[f.NumberMinimum=39]="NumberMinimum",f[f.NumberMultipleOf=40]="NumberMultipleOf",f[f.Number=41]="Number",f[f.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",f[f.ObjectMaxProperties=43]="ObjectMaxProperties",f[f.ObjectMinProperties=44]="ObjectMinProperties",f[f.ObjectRequiredProperty=45]="ObjectRequiredProperty",f[f.Object=46]="Object",f[f.Promise=47]="Promise",f[f.StringFormatUnknown=48]="StringFormatUnknown",f[f.StringFormat=49]="StringFormat",f[f.StringMaxLength=50]="StringMaxLength",f[f.StringMinLength=51]="StringMinLength",f[f.StringPattern=52]="StringPattern",f[f.String=53]="String",f[f.Symbol=54]="Symbol",f[f.TupleLength=55]="TupleLength",f[f.Tuple=56]="Tuple",f[f.Uint8ArrayMaxByteLength=57]="Uint8ArrayMaxByteLength",f[f.Uint8ArrayMinByteLength=58]="Uint8ArrayMinByteLength",f[f.Uint8Array=59]="Uint8Array",f[f.Undefined=60]="Undefined",f[f.Union=61]="Union",f[f.Void=62]="Void"})(s||(e.ValueErrorType=s={}));var a=class extends o.TypeBoxError{constructor(f){super("Unknown type"),this.schema=f}};e.ValueErrorsUnknownTypeError=a;function u(f){return f.replace(/~/g,"~0").replace(/\//g,"~1")}e.EscapeKey=u;function c(f){return f!==void 0}var l=class{constructor(f){this.iterator=f}[Symbol.iterator](){return this.iterator}First(){let f=this.iterator.next();return f.done?void 0:f.value}};e.ValueErrorIterator=l;function p(f,I,v,b){return{type:f,schema:I,path:v,value:b,message:r.TypeSystemErrorFunction.Get()(I,f)}}function*S(f,I,v,b){}function*x(f,I,v,b){if(!(0,t.IsArray)(b))return yield p(s.Array,f,v,b);c(f.minItems)&&!(b.length>=f.minItems)&&(yield p(s.ArrayMinItems,f,v,b)),c(f.maxItems)&&!(b.length<=f.maxItems)&&(yield p(s.ArrayMaxItems,f,v,b));for(let te=0;te<b.length;te++)yield*R(f.items,I,`${v}/${te}`,b[te]);if(f.uniqueItems===!0&&!function(){let te=new Set;for(let ie of b){let ge=(0,i.Hash)(ie);if(te.has(ge))return!1;te.add(ge)}return!0}()&&(yield p(s.ArrayUniqueItems,f,v,b)),!(c(f.contains)||c(f.minContains)||c(f.maxContains)))return;let U=c(f.contains)?f.contains:o.Type.Never(),q=b.reduce((te,ie,ge)=>R(U,I,`${v}${ge}`,ie).next().done===!0?te+1:te,0);q===0&&(yield p(s.ArrayContains,f,v,b)),(0,t.IsNumber)(f.minContains)&&q<f.minContains&&(yield p(s.ArrayMinContains,f,v,b)),(0,t.IsNumber)(f.maxContains)&&q>f.maxContains&&(yield p(s.ArrayMaxContains,f,v,b))}function*E(f,I,v,b){(0,t.IsAsyncIterator)(b)||(yield p(s.AsyncIterator,f,v,b))}function*z(f,I,v,b){if(!(0,t.IsBigInt)(b))return yield p(s.BigInt,f,v,b);c(f.exclusiveMaximum)&&!(b<f.exclusiveMaximum)&&(yield p(s.BigIntExclusiveMaximum,f,v,b)),c(f.exclusiveMinimum)&&!(b>f.exclusiveMinimum)&&(yield p(s.BigIntExclusiveMinimum,f,v,b)),c(f.maximum)&&!(b<=f.maximum)&&(yield p(s.BigIntMaximum,f,v,b)),c(f.minimum)&&!(b>=f.minimum)&&(yield p(s.BigIntMinimum,f,v,b)),c(f.multipleOf)&&b%f.multipleOf!==BigInt(0)&&(yield p(s.BigIntMultipleOf,f,v,b))}function*W(f,I,v,b){(0,t.IsBoolean)(b)||(yield p(s.Boolean,f,v,b))}function*T(f,I,v,b){yield*R(f.returns,I,v,b.prototype)}function*k(f,I,v,b){if(!(0,t.IsDate)(b))return yield p(s.Date,f,v,b);c(f.exclusiveMaximumTimestamp)&&!(b.getTime()<f.exclusiveMaximumTimestamp)&&(yield p(s.DateExclusiveMaximumTimestamp,f,v,b)),c(f.exclusiveMinimumTimestamp)&&!(b.getTime()>f.exclusiveMinimumTimestamp)&&(yield p(s.DateExclusiveMinimumTimestamp,f,v,b)),c(f.maximumTimestamp)&&!(b.getTime()<=f.maximumTimestamp)&&(yield p(s.DateMaximumTimestamp,f,v,b)),c(f.minimumTimestamp)&&!(b.getTime()>=f.minimumTimestamp)&&(yield p(s.DateMinimumTimestamp,f,v,b)),c(f.multipleOfTimestamp)&&b.getTime()%f.multipleOfTimestamp!==0&&(yield p(s.DateMultipleOfTimestamp,f,v,b))}function*G(f,I,v,b){(0,t.IsFunction)(b)||(yield p(s.Function,f,v,b))}function*H(f,I,v,b){if(!(0,t.IsInteger)(b))return yield p(s.Integer,f,v,b);c(f.exclusiveMaximum)&&!(b<f.exclusiveMaximum)&&(yield p(s.IntegerExclusiveMaximum,f,v,b)),c(f.exclusiveMinimum)&&!(b>f.exclusiveMinimum)&&(yield p(s.IntegerExclusiveMinimum,f,v,b)),c(f.maximum)&&!(b<=f.maximum)&&(yield p(s.IntegerMaximum,f,v,b)),c(f.minimum)&&!(b>=f.minimum)&&(yield p(s.IntegerMinimum,f,v,b)),c(f.multipleOf)&&b%f.multipleOf!==0&&(yield p(s.IntegerMultipleOf,f,v,b))}function*F(f,I,v,b){for(let U of f.allOf){let q=R(U,I,v,b).next();q.done||(yield p(s.Intersect,f,v,b),yield q.value)}if(f.unevaluatedProperties===!1){let U=new RegExp(o.KeyResolver.ResolvePattern(f));for(let q of Object.getOwnPropertyNames(b))U.test(q)||(yield p(s.IntersectUnevaluatedProperties,f,`${v}/${q}`,b))}if(typeof f.unevaluatedProperties=="object"){let U=new RegExp(o.KeyResolver.ResolvePattern(f));for(let q of Object.getOwnPropertyNames(b))if(!U.test(q)){let te=R(f.unevaluatedProperties,I,`${v}/${q}`,b[q]).next();te.done||(yield te.value)}}}function*Y(f,I,v,b){(0,t.IsIterator)(b)||(yield p(s.Iterator,f,v,b))}function*V(f,I,v,b){b!==f.const&&(yield p(s.Literal,f,v,b))}function*ae(f,I,v,b){yield p(s.Never,f,v,b)}function*L(f,I,v,b){R(f.not,I,v,b).next().done===!0&&(yield p(s.Not,f,v,b))}function*M(f,I,v,b){(0,t.IsNull)(b)||(yield p(s.Null,f,v,b))}function*j(f,I,v,b){if(!r.TypeSystemPolicy.IsNumberLike(b))return yield p(s.Number,f,v,b);c(f.exclusiveMaximum)&&!(b<f.exclusiveMaximum)&&(yield p(s.NumberExclusiveMaximum,f,v,b)),c(f.exclusiveMinimum)&&!(b>f.exclusiveMinimum)&&(yield p(s.NumberExclusiveMinimum,f,v,b)),c(f.maximum)&&!(b<=f.maximum)&&(yield p(s.NumberMaximum,f,v,b)),c(f.minimum)&&!(b>=f.minimum)&&(yield p(s.NumberMinimum,f,v,b)),c(f.multipleOf)&&b%f.multipleOf!==0&&(yield p(s.NumberMultipleOf,f,v,b))}function*ne(f,I,v,b){if(!r.TypeSystemPolicy.IsObjectLike(b))return yield p(s.Object,f,v,b);c(f.minProperties)&&!(Object.getOwnPropertyNames(b).length>=f.minProperties)&&(yield p(s.ObjectMinProperties,f,v,b)),c(f.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=f.maxProperties)&&(yield p(s.ObjectMaxProperties,f,v,b));let U=Array.isArray(f.required)?f.required:[],q=Object.getOwnPropertyNames(f.properties),te=Object.getOwnPropertyNames(b);for(let ie of U)te.includes(ie)||(yield p(s.ObjectRequiredProperty,f.properties[ie],`${v}/${u(ie)}`,void 0));if(f.additionalProperties===!1)for(let ie of te)q.includes(ie)||(yield p(s.ObjectAdditionalProperties,f,`${v}/${u(ie)}`,b[ie]));if(typeof f.additionalProperties=="object")for(let ie of te)q.includes(ie)||(yield*R(f.additionalProperties,I,`${v}/${u(ie)}`,b[ie]));for(let ie of q){let ge=f.properties[ie];f.required&&f.required.includes(ie)?(yield*R(ge,I,`${v}/${u(ie)}`,b[ie]),o.ExtendsUndefined.Check(f)&&!(ie in b)&&(yield p(s.ObjectRequiredProperty,ge,`${v}/${u(ie)}`,void 0))):r.TypeSystemPolicy.IsExactOptionalProperty(b,ie)&&(yield*R(ge,I,`${v}/${u(ie)}`,b[ie]))}}function*re(f,I,v,b){(0,t.IsPromise)(b)||(yield p(s.Promise,f,v,b))}function*O(f,I,v,b){if(!r.TypeSystemPolicy.IsRecordLike(b))return yield p(s.Object,f,v,b);c(f.minProperties)&&!(Object.getOwnPropertyNames(b).length>=f.minProperties)&&(yield p(s.ObjectMinProperties,f,v,b)),c(f.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=f.maxProperties)&&(yield p(s.ObjectMaxProperties,f,v,b));let[U,q]=Object.entries(f.patternProperties)[0],te=new RegExp(U);for(let[ie,ge]of Object.entries(b))te.test(ie)&&(yield*R(q,I,`${v}/${u(ie)}`,ge));if(typeof f.additionalProperties=="object")for(let[ie,ge]of Object.entries(b))te.test(ie)||(yield*R(f.additionalProperties,I,`${v}/${u(ie)}`,ge));if(f.additionalProperties===!1){for(let[ie,ge]of Object.entries(b))if(!te.test(ie))return yield p(s.ObjectAdditionalProperties,f,`${v}/${u(ie)}`,ge)}}function*J(f,I,v,b){yield*R((0,n.Deref)(f,I),I,v,b)}function*oe(f,I,v,b){if(!(0,t.IsString)(b))return yield p(s.String,f,v,b);c(f.minLength)&&!(b.length>=f.minLength)&&(yield p(s.StringMinLength,f,v,b)),c(f.maxLength)&&!(b.length<=f.maxLength)&&(yield p(s.StringMaxLength,f,v,b)),(0,t.IsString)(f.pattern)&&(new RegExp(f.pattern).test(b)||(yield p(s.StringPattern,f,v,b))),(0,t.IsString)(f.format)&&(o.FormatRegistry.Has(f.format)?o.FormatRegistry.Get(f.format)(b)||(yield p(s.StringFormat,f,v,b)):yield p(s.StringFormatUnknown,f,v,b))}function*X(f,I,v,b){(0,t.IsSymbol)(b)||(yield p(s.Symbol,f,v,b))}function*Z(f,I,v,b){if(!(0,t.IsString)(b))return yield p(s.String,f,v,b);new RegExp(f.pattern).test(b)||(yield p(s.StringPattern,f,v,b))}function*pe(f,I,v,b){yield*R((0,n.Deref)(f,I),I,v,b)}function*d(f,I,v,b){if(!(0,t.IsArray)(b))return yield p(s.Tuple,f,v,b);if(f.items===void 0&&b.length!==0)return yield p(s.TupleLength,f,v,b);if(b.length!==f.maxItems)return yield p(s.TupleLength,f,v,b);if(f.items)for(let U=0;U<f.items.length;U++)yield*R(f.items[U],I,`${v}/${U}`,b[U])}function*w(f,I,v,b){(0,t.IsUndefined)(b)||(yield p(s.Undefined,f,v,b))}function*C(f,I,v,b){let U=0;for(let q of f.anyOf){let te=[...R(q,I,v,b)];if(te.length===0)return;U+=te.length}U>0&&(yield p(s.Union,f,v,b))}function*D(f,I,v,b){if(!(0,t.IsUint8Array)(b))return yield p(s.Uint8Array,f,v,b);c(f.maxByteLength)&&!(b.length<=f.maxByteLength)&&(yield p(s.Uint8ArrayMaxByteLength,f,v,b)),c(f.minByteLength)&&!(b.length>=f.minByteLength)&&(yield p(s.Uint8ArrayMinByteLength,f,v,b))}function*P(f,I,v,b){}function*N(f,I,v,b){r.TypeSystemPolicy.IsVoidLike(b)||(yield p(s.Void,f,v,b))}function*g(f,I,v,b){o.TypeRegistry.Get(f[o.Kind])(f,b)||(yield p(s.Kind,f,v,b))}function*R(f,I,v,b){let U=c(f.$id)?[...I,f]:I,q=f;switch(q[o.Kind]){case"Any":return yield*S(q,U,v,b);case"Array":return yield*x(q,U,v,b);case"AsyncIterator":return yield*E(q,U,v,b);case"BigInt":return yield*z(q,U,v,b);case"Boolean":return yield*W(q,U,v,b);case"Constructor":return yield*T(q,U,v,b);case"Date":return yield*k(q,U,v,b);case"Function":return yield*G(q,U,v,b);case"Integer":return yield*H(q,U,v,b);case"Intersect":return yield*F(q,U,v,b);case"Iterator":return yield*Y(q,U,v,b);case"Literal":return yield*V(q,U,v,b);case"Never":return yield*ae(q,U,v,b);case"Not":return yield*L(q,U,v,b);case"Null":return yield*M(q,U,v,b);case"Number":return yield*j(q,U,v,b);case"Object":return yield*ne(q,U,v,b);case"Promise":return yield*re(q,U,v,b);case"Record":return yield*O(q,U,v,b);case"Ref":return yield*J(q,U,v,b);case"String":return yield*oe(q,U,v,b);case"Symbol":return yield*X(q,U,v,b);case"TemplateLiteral":return yield*Z(q,U,v,b);case"This":return yield*pe(q,U,v,b);case"Tuple":return yield*d(q,U,v,b);case"Undefined":return yield*w(q,U,v,b);case"Union":return yield*C(q,U,v,b);case"Uint8Array":return yield*D(q,U,v,b);case"Unknown":return yield*P(q,U,v,b);case"Void":return yield*N(q,U,v,b);default:if(!o.TypeRegistry.Has(q[o.Kind]))throw new a(f);return yield*g(q,U,v,b)}}function _(...f){let I=f.length===3?R(f[0],f[1],"",f[2]):R(f[0],[],"",f[1]);return new l(I)}e.Errors=_}}),hv=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/errors/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(n,i,o,s){s===void 0&&(s=o);var a=Object.getOwnPropertyDescriptor(i,o);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(n,s,a)}:function(n,i,o,s){s===void 0&&(s=o),n[s]=i[o]}),r=e&&e.__exportStar||function(n,i){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,n,o)};Object.defineProperty(e,"__esModule",{value:!0}),r(ys(),e)}}),gp=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/system/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(i,o,s,a){a===void 0&&(a=s);var u=Object.getOwnPropertyDescriptor(o,s);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[s]}}),Object.defineProperty(i,a,u)}:function(i,o,s,a){a===void 0&&(a=s),i[a]=o[s]}),r=e&&e.__exportStar||function(i,o){for(var s in i)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&t(o,i,s)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorType=void 0;var n=ys();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),r(yp(),e)}}),yv=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/check.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Check=e.ValueCheckUnknownTypeError=void 0;var t=kn(),r=gp(),n=hs(),i=vu(),o=ur(),s=class extends o.TypeBoxError{constructor(g){super("Unknown type"),this.schema=g}};e.ValueCheckUnknownTypeError=s;function a(g){return g[o.Kind]==="Any"||g[o.Kind]==="Unknown"}function u(g){return g!==void 0}function c(g,R,_){return!0}function l(g,R,_){if(!(0,t.IsArray)(_)||u(g.minItems)&&!(_.length>=g.minItems)||u(g.maxItems)&&!(_.length<=g.maxItems)||!_.every(v=>P(g.items,R,v))||g.uniqueItems===!0&&!function(){let v=new Set;for(let b of _){let U=(0,i.Hash)(b);if(v.has(U))return!1;v.add(U)}return!0}())return!1;if(!(u(g.contains)||(0,t.IsNumber)(g.minContains)||(0,t.IsNumber)(g.maxContains)))return!0;let f=u(g.contains)?g.contains:o.Type.Never(),I=_.reduce((v,b)=>P(f,R,b)?v+1:v,0);return!(I===0||(0,t.IsNumber)(g.minContains)&&I<g.minContains||(0,t.IsNumber)(g.maxContains)&&I>g.maxContains)}function p(g,R,_){return(0,t.IsAsyncIterator)(_)}function S(g,R,_){return!(!(0,t.IsBigInt)(_)||u(g.exclusiveMaximum)&&!(_<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(_>g.exclusiveMinimum)||u(g.maximum)&&!(_<=g.maximum)||u(g.minimum)&&!(_>=g.minimum)||u(g.multipleOf)&&_%g.multipleOf!==BigInt(0))}function x(g,R,_){return(0,t.IsBoolean)(_)}function E(g,R,_){return P(g.returns,R,_.prototype)}function z(g,R,_){return!(!(0,t.IsDate)(_)||u(g.exclusiveMaximumTimestamp)&&!(_.getTime()<g.exclusiveMaximumTimestamp)||u(g.exclusiveMinimumTimestamp)&&!(_.getTime()>g.exclusiveMinimumTimestamp)||u(g.maximumTimestamp)&&!(_.getTime()<=g.maximumTimestamp)||u(g.minimumTimestamp)&&!(_.getTime()>=g.minimumTimestamp)||u(g.multipleOfTimestamp)&&_.getTime()%g.multipleOfTimestamp!==0)}function W(g,R,_){return(0,t.IsFunction)(_)}function T(g,R,_){return!(!(0,t.IsInteger)(_)||u(g.exclusiveMaximum)&&!(_<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(_>g.exclusiveMinimum)||u(g.maximum)&&!(_<=g.maximum)||u(g.minimum)&&!(_>=g.minimum)||u(g.multipleOf)&&_%g.multipleOf!==0)}function k(g,R,_){let f=g.allOf.every(I=>P(I,R,_));if(g.unevaluatedProperties===!1){let I=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(_).every(b=>I.test(b));return f&&v}else if(o.TypeGuard.TSchema(g.unevaluatedProperties)){let I=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(_).every(b=>I.test(b)||P(g.unevaluatedProperties,R,_[b]));return f&&v}else return f}function G(g,R,_){return(0,t.IsIterator)(_)}function H(g,R,_){return _===g.const}function F(g,R,_){return!1}function Y(g,R,_){return!P(g.not,R,_)}function V(g,R,_){return(0,t.IsNull)(_)}function ae(g,R,_){return!(!r.TypeSystemPolicy.IsNumberLike(_)||u(g.exclusiveMaximum)&&!(_<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(_>g.exclusiveMinimum)||u(g.minimum)&&!(_>=g.minimum)||u(g.maximum)&&!(_<=g.maximum)||u(g.multipleOf)&&_%g.multipleOf!==0)}function L(g,R,_){if(!r.TypeSystemPolicy.IsObjectLike(_)||u(g.minProperties)&&!(Object.getOwnPropertyNames(_).length>=g.minProperties)||u(g.maxProperties)&&!(Object.getOwnPropertyNames(_).length<=g.maxProperties))return!1;let f=Object.getOwnPropertyNames(g.properties);for(let I of f){let v=g.properties[I];if(g.required&&g.required.includes(I)){if(!P(v,R,_[I])||(o.ExtendsUndefined.Check(v)||a(v))&&!(I in _))return!1}else if(r.TypeSystemPolicy.IsExactOptionalProperty(_,I)&&!P(v,R,_[I]))return!1}if(g.additionalProperties===!1){let I=Object.getOwnPropertyNames(_);return g.required&&g.required.length===f.length&&I.length===f.length?!0:I.every(v=>f.includes(v))}else return typeof g.additionalProperties=="object"?Object.getOwnPropertyNames(_).every(v=>f.includes(v)||P(g.additionalProperties,R,_[v])):!0}function M(g,R,_){return(0,t.IsPromise)(_)}function j(g,R,_){if(!r.TypeSystemPolicy.IsRecordLike(_)||u(g.minProperties)&&!(Object.getOwnPropertyNames(_).length>=g.minProperties)||u(g.maxProperties)&&!(Object.getOwnPropertyNames(_).length<=g.maxProperties))return!1;let[f,I]=Object.entries(g.patternProperties)[0],v=new RegExp(f),b=Object.entries(_).every(([te,ie])=>v.test(te)?P(I,R,ie):!0),U=typeof g.additionalProperties=="object"?Object.entries(_).every(([te,ie])=>v.test(te)?!0:P(g.additionalProperties,R,ie)):!0,q=g.additionalProperties===!1?Object.getOwnPropertyNames(_).every(te=>v.test(te)):!0;return b&&U&&q}function ne(g,R,_){return P((0,n.Deref)(g,R),R,_)}function re(g,R,_){return!(0,t.IsString)(_)||u(g.minLength)&&!(_.length>=g.minLength)||u(g.maxLength)&&!(_.length<=g.maxLength)||u(g.pattern)&&!new RegExp(g.pattern).test(_)?!1:u(g.format)?o.FormatRegistry.Has(g.format)?o.FormatRegistry.Get(g.format)(_):!1:!0}function O(g,R,_){return(0,t.IsSymbol)(_)}function J(g,R,_){return(0,t.IsString)(_)&&new RegExp(g.pattern).test(_)}function oe(g,R,_){return P((0,n.Deref)(g,R),R,_)}function X(g,R,_){if(!(0,t.IsArray)(_)||g.items===void 0&&_.length!==0||_.length!==g.maxItems)return!1;if(!g.items)return!0;for(let f=0;f<g.items.length;f++)if(!P(g.items[f],R,_[f]))return!1;return!0}function Z(g,R,_){return(0,t.IsUndefined)(_)}function pe(g,R,_){return g.anyOf.some(f=>P(f,R,_))}function d(g,R,_){return!(!(0,t.IsUint8Array)(_)||u(g.maxByteLength)&&!(_.length<=g.maxByteLength)||u(g.minByteLength)&&!(_.length>=g.minByteLength))}function w(g,R,_){return!0}function C(g,R,_){return r.TypeSystemPolicy.IsVoidLike(_)}function D(g,R,_){return o.TypeRegistry.Has(g[o.Kind])?o.TypeRegistry.Get(g[o.Kind])(g,_):!1}function P(g,R,_){let f=u(g.$id)?[...R,g]:R,I=g;switch(I[o.Kind]){case"Any":return c(I,f,_);case"Array":return l(I,f,_);case"AsyncIterator":return p(I,f,_);case"BigInt":return S(I,f,_);case"Boolean":return x(I,f,_);case"Constructor":return E(I,f,_);case"Date":return z(I,f,_);case"Function":return W(I,f,_);case"Integer":return T(I,f,_);case"Intersect":return k(I,f,_);case"Iterator":return G(I,f,_);case"Literal":return H(I,f,_);case"Never":return F(I,f,_);case"Not":return Y(I,f,_);case"Null":return V(I,f,_);case"Number":return ae(I,f,_);case"Object":return L(I,f,_);case"Promise":return M(I,f,_);case"Record":return j(I,f,_);case"Ref":return ne(I,f,_);case"String":return re(I,f,_);case"Symbol":return O(I,f,_);case"TemplateLiteral":return J(I,f,_);case"This":return oe(I,f,_);case"Tuple":return X(I,f,_);case"Undefined":return Z(I,f,_);case"Union":return pe(I,f,_);case"Uint8Array":return d(I,f,_);case"Unknown":return w(I,f,_);case"Void":return C(I,f,_);default:if(!o.TypeRegistry.Has(I[o.Kind]))throw new s(I);return D(I,f,_)}}function N(...g){return g.length===3?P(g[0],g[1],g[2]):P(g[0],[],g[1])}e.Check=N}}),gv=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/transform.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EncodeTransform=e.DecodeTransform=e.HasTransform=e.TransformEncodeError=e.TransformDecodeError=e.TransformEncodeCheckError=e.TransformDecodeCheckError=void 0;var t=kn(),r=hs(),n=yv(),i=ur(),o=class extends i.TypeBoxError{constructor(S,x,E){super("Unable to decode due to invalid value"),this.schema=S,this.value=x,this.error=E}};e.TransformDecodeCheckError=o;var s=class extends i.TypeBoxError{constructor(S,x,E){super("Unable to encode due to invalid value"),this.schema=S,this.value=x,this.error=E}};e.TransformEncodeCheckError=s;var a=class extends i.TypeBoxError{constructor(S,x,E){super(`${E instanceof Error?E.message:"Unknown error"}`),this.schema=S,this.value=x}};e.TransformDecodeError=a;var u=class extends i.TypeBoxError{constructor(S,x,E){super(`${E instanceof Error?E.message:"Unknown error"}`),this.schema=S,this.value=x}};e.TransformEncodeError=u;var c;(function(S){function x(O,J){return i.TypeGuard.TTransform(O)||j(O.items,J)}function E(O,J){return i.TypeGuard.TTransform(O)||j(O.items,J)}function z(O,J){return i.TypeGuard.TTransform(O)||j(O.returns,J)||O.parameters.some(oe=>j(oe,J))}function W(O,J){return i.TypeGuard.TTransform(O)||j(O.returns,J)||O.parameters.some(oe=>j(oe,J))}function T(O,J){return i.TypeGuard.TTransform(O)||i.TypeGuard.TTransform(O.unevaluatedProperties)||O.allOf.some(oe=>j(oe,J))}function k(O,J){return i.TypeGuard.TTransform(O)||j(O.items,J)}function G(O,J){return i.TypeGuard.TTransform(O)||j(O.not,J)}function H(O,J){return i.TypeGuard.TTransform(O)||Object.values(O.properties).some(oe=>j(oe,J))||i.TypeGuard.TSchema(O.additionalProperties)&&j(O.additionalProperties,J)}function F(O,J){return i.TypeGuard.TTransform(O)||j(O.item,J)}function Y(O,J){let oe=Object.getOwnPropertyNames(O.patternProperties)[0],X=O.patternProperties[oe];return i.TypeGuard.TTransform(O)||j(X,J)||i.TypeGuard.TSchema(O.additionalProperties)&&i.TypeGuard.TTransform(O.additionalProperties)}function V(O,J){return i.TypeGuard.TTransform(O)?!0:j((0,r.Deref)(O,J),J)}function ae(O,J){return i.TypeGuard.TTransform(O)?!0:j((0,r.Deref)(O,J),J)}function L(O,J){return i.TypeGuard.TTransform(O)||!(0,t.IsUndefined)(O.items)&&O.items.some(oe=>j(oe,J))}function M(O,J){return i.TypeGuard.TTransform(O)||O.anyOf.some(oe=>j(oe,J))}function j(O,J){let oe=(0,t.IsString)(O.$id)?[...J,O]:J,X=O;if(O.$id&&ne.has(O.$id))return!1;switch(O.$id&&ne.add(O.$id),O[i.Kind]){case"Array":return x(X,oe);case"AsyncIterator":return E(X,oe);case"Constructor":return z(X,oe);case"Function":return W(X,oe);case"Intersect":return T(X,oe);case"Iterator":return k(X,oe);case"Not":return G(X,oe);case"Object":return H(X,oe);case"Promise":return F(X,oe);case"Record":return Y(X,oe);case"Ref":return V(X,oe);case"This":return ae(X,oe);case"Tuple":return L(X,oe);case"Union":return M(X,oe);default:return i.TypeGuard.TTransform(O)}}let ne=new Set;function re(O,J){return ne.clear(),j(O,J)}S.Has=re})(c||(e.HasTransform=c={}));var l;(function(S){function x(L,M){try{return i.TypeGuard.TTransform(L)?L[i.Transform].Decode(M):M}catch(j){throw new a(L,M,j)}}function E(L,M,j){return(0,t.IsArray)(j)?x(L,j.map(ne=>V(L.items,M,ne))):x(L,j)}function z(L,M,j){if(!(0,t.IsPlainObject)(j)||(0,t.IsValueType)(j))return x(L,j);let ne=i.KeyResolver.ResolveKeys(L,{includePatterns:!1}),re=ne.reduce((X,Z)=>Z in X?{...X,[Z]:V(i.IndexedAccessor.Resolve(L,[Z]),M,X[Z])}:X,j);if(!i.TypeGuard.TTransform(L.unevaluatedProperties))return x(L,re);let O=Object.getOwnPropertyNames(re),J=L.unevaluatedProperties,oe=O.reduce((X,Z)=>ne.includes(Z)?X:{...X,[Z]:x(J,X[Z])},re);return x(L,oe)}function W(L,M,j){return x(L,V(L.not,M,j))}function T(L,M,j){if(!(0,t.IsPlainObject)(j))return x(L,j);let ne=i.KeyResolver.ResolveKeys(L,{includePatterns:!1}),re=ne.reduce((X,Z)=>Z in X?{...X,[Z]:V(L.properties[Z],M,X[Z])}:X,j);if(!i.TypeGuard.TSchema(L.additionalProperties))return x(L,re);let O=Object.getOwnPropertyNames(re),J=L.additionalProperties,oe=O.reduce((X,Z)=>ne.includes(Z)?X:{...X,[Z]:x(J,X[Z])},re);return x(L,oe)}function k(L,M,j){if(!(0,t.IsPlainObject)(j))return x(L,j);let ne=Object.getOwnPropertyNames(L.patternProperties)[0],re=new RegExp(ne),O=Object.getOwnPropertyNames(j).reduce((Z,pe)=>re.test(pe)?{...Z,[pe]:V(L.patternProperties[ne],M,Z[pe])}:Z,j);if(!i.TypeGuard.TSchema(L.additionalProperties))return x(L,O);let J=Object.getOwnPropertyNames(O),oe=L.additionalProperties,X=J.reduce((Z,pe)=>re.test(pe)?Z:{...Z,[pe]:x(oe,Z[pe])},O);return x(L,X)}function G(L,M,j){let ne=(0,r.Deref)(L,M);return x(L,V(ne,M,j))}function H(L,M,j){let ne=(0,r.Deref)(L,M);return x(L,V(ne,M,j))}function F(L,M,j){return(0,t.IsArray)(j)&&(0,t.IsArray)(L.items)?x(L,L.items.map((ne,re)=>V(ne,M,j[re]))):x(L,j)}function Y(L,M,j){let ne=x(L,j);for(let re of L.anyOf)if((0,n.Check)(re,M,ne))return V(re,M,ne);return ne}function V(L,M,j){let ne=typeof L.$id=="string"?[...M,L]:M,re=L;switch(L[i.Kind]){case"Array":return E(re,ne,j);case"Intersect":return z(re,ne,j);case"Not":return W(re,ne,j);case"Object":return T(re,ne,j);case"Record":return k(re,ne,j);case"Ref":return G(re,ne,j);case"Symbol":return x(re,j);case"This":return H(re,ne,j);case"Tuple":return F(re,ne,j);case"Union":return Y(re,ne,j);default:return x(re,j)}}function ae(L,M,j){return V(L,M,j)}S.Decode=ae})(l||(e.DecodeTransform=l={}));var p;(function(S){function x(L,M){try{return i.TypeGuard.TTransform(L)?L[i.Transform].Encode(M):M}catch(j){throw new u(L,M,j)}}function E(L,M,j){let ne=x(L,j);return(0,t.IsArray)(ne)?ne.map(re=>V(L.items,M,re)):ne}function z(L,M,j){let ne=x(L,j);if(!(0,t.IsPlainObject)(j)||(0,t.IsValueType)(j))return ne;let re=i.KeyResolver.ResolveKeys(L,{includePatterns:!1}),O=re.reduce((X,Z)=>Z in ne?{...X,[Z]:V(i.IndexedAccessor.Resolve(L,[Z]),M,X[Z])}:X,ne);if(!i.TypeGuard.TTransform(L.unevaluatedProperties))return x(L,O);let J=Object.getOwnPropertyNames(O),oe=L.unevaluatedProperties;return J.reduce((X,Z)=>re.includes(Z)?X:{...X,[Z]:x(oe,X[Z])},O)}function W(L,M,j){return x(L.not,x(L,j))}function T(L,M,j){let ne=x(L,j);if(!(0,t.IsPlainObject)(j))return ne;let re=i.KeyResolver.ResolveKeys(L,{includePatterns:!1}),O=re.reduce((X,Z)=>Z in X?{...X,[Z]:V(L.properties[Z],M,X[Z])}:X,ne);if(!i.TypeGuard.TSchema(L.additionalProperties))return O;let J=Object.getOwnPropertyNames(O),oe=L.additionalProperties;return J.reduce((X,Z)=>re.includes(Z)?X:{...X,[Z]:x(oe,X[Z])},O)}function k(L,M,j){let ne=x(L,j);if(!(0,t.IsPlainObject)(j))return ne;let re=Object.getOwnPropertyNames(L.patternProperties)[0],O=new RegExp(re),J=Object.getOwnPropertyNames(j).reduce((Z,pe)=>O.test(pe)?{...Z,[pe]:V(L.patternProperties[re],M,Z[pe])}:Z,ne);if(!i.TypeGuard.TSchema(L.additionalProperties))return x(L,J);let oe=Object.getOwnPropertyNames(J),X=L.additionalProperties;return oe.reduce((Z,pe)=>O.test(pe)?Z:{...Z,[pe]:x(X,Z[pe])},J)}function G(L,M,j){let ne=(0,r.Deref)(L,M),re=V(ne,M,j);return x(L,re)}function H(L,M,j){let ne=(0,r.Deref)(L,M),re=V(ne,M,j);return x(L,re)}function F(L,M,j){let ne=x(L,j);return(0,t.IsArray)(L.items)?L.items.map((re,O)=>V(re,M,ne[O])):[]}function Y(L,M,j){for(let ne of L.anyOf){if(!(0,n.Check)(ne,M,j))continue;let re=V(ne,M,j);return x(L,re)}for(let ne of L.anyOf){let re=V(ne,M,j);if((0,n.Check)(L,M,re))return x(L,re)}return x(L,j)}function V(L,M,j){let ne=typeof L.$id=="string"?[...M,L]:M,re=L;switch(L[i.Kind]){case"Array":return E(re,ne,j);case"Intersect":return z(re,ne,j);case"Not":return W(re,ne,j);case"Object":return T(re,ne,j);case"Record":return k(re,ne,j);case"Ref":return G(re,ne,j);case"This":return H(re,ne,j);case"Tuple":return F(re,ne,j);case"Union":return Y(re,ne,j);default:return x(re,j)}}function ae(L,M,j){return V(L,M,j)}S.Encode=ae})(p||(e.EncodeTransform=p={}))}}),mv=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/compiler/compiler.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeCompiler=e.Policy=e.TypeCompilerTypeGuardError=e.TypeCompilerUnknownTypeError=e.TypeCheck=void 0;var t=gv(),r=kn(),n=ys(),i=gp(),o=hs(),s=vu(),a=ur(),u=class{constructor(T,k,G,H){this.schema=T,this.references=k,this.checkFunc=G,this.code=H,this.hasTransform=t.HasTransform.Has(T,k)}Code(){return this.code}Errors(T){return(0,n.Errors)(this.schema,this.references,T)}Check(T){return this.checkFunc(T)}Decode(T){if(!this.checkFunc(T))throw new t.TransformDecodeCheckError(this.schema,T,this.Errors(T).First());return this.hasTransform?t.DecodeTransform.Decode(this.schema,this.references,T):T}Encode(T){let k=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,T):T;if(!this.checkFunc(k))throw new t.TransformEncodeCheckError(this.schema,T,this.Errors(T).First());return k}};e.TypeCheck=u;var c;(function(T){function k(Y){return Y===36}T.DollarSign=k;function G(Y){return Y===95}T.IsUnderscore=G;function H(Y){return Y>=65&&Y<=90||Y>=97&&Y<=122}T.IsAlpha=H;function F(Y){return Y>=48&&Y<=57}T.IsNumeric=F})(c||(c={}));var l;(function(T){function k(Y){return Y.length===0?!1:c.IsNumeric(Y.charCodeAt(0))}function G(Y){if(k(Y))return!1;for(let V=0;V<Y.length;V++){let ae=Y.charCodeAt(V);if(!(c.IsAlpha(ae)||c.IsNumeric(ae)||c.DollarSign(ae)||c.IsUnderscore(ae)))return!1}return!0}function H(Y){return Y.replace(/'/g,"\\'")}function F(Y,V){return G(V)?`${Y}.${V}`:`${Y}['${H(V)}']`}T.Encode=F})(l||(l={}));var p;(function(T){function k(G){let H=[];for(let F=0;F<G.length;F++){let Y=G.charCodeAt(F);c.IsNumeric(Y)||c.IsAlpha(Y)?H.push(G.charAt(F)):H.push(`_${Y}_`)}return H.join("").replace(/__/g,"_")}T.Encode=k})(p||(p={}));var S;(function(T){function k(G){return G.replace(/'/g,"\\'")}T.Escape=k})(S||(S={}));var x=class extends a.TypeBoxError{constructor(T){super("Unknown type"),this.schema=T}};e.TypeCompilerUnknownTypeError=x;var E=class extends a.TypeBoxError{constructor(T){super("Preflight validation check failed to guard for the given schema"),this.schema=T}};e.TypeCompilerTypeGuardError=E;var z;(function(T){function k(V,ae,L){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${ae}' in ${V} ? ${L} : true)`:`(${l.Encode(V,ae)} !== undefined ? ${L} : true)`}T.IsExactOptionalProperty=k;function G(V){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${V} === 'object' && ${V} !== null)`:`(typeof ${V} === 'object' && ${V} !== null && !Array.isArray(${V}))`}T.IsObjectLike=G;function H(V){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${V} === 'object' && ${V} !== null && !(${V} instanceof Date) && !(${V} instanceof Uint8Array))`:`(typeof ${V} === 'object' && ${V} !== null && !Array.isArray(${V}) && !(${V} instanceof Date) && !(${V} instanceof Uint8Array))`}T.IsRecordLike=H;function F(V){return i.TypeSystemPolicy.AllowNaN?`typeof ${V} === 'number'`:`(typeof ${V} === 'number' && Number.isFinite(${V}))`}T.IsNumberLike=F;function Y(V){return i.TypeSystemPolicy.AllowNullVoid?`(${V} === undefined || ${V} === null)`:`${V} === undefined`}T.IsVoidLike=Y})(z||(e.Policy=z={}));var W;(function(T){function k(A){return A[a.Kind]==="Any"||A[a.Kind]==="Unknown"}function*G(A,de,$){yield"true"}function*H(A,de,$){yield`Array.isArray(${$})`;let[me,se]=[Fe("value","any"),Fe("acc","number")];(0,r.IsNumber)(A.maxItems)&&(yield`${$}.length <= ${A.maxItems}`),(0,r.IsNumber)(A.minItems)&&(yield`${$}.length >= ${A.minItems}`);let he=ie(A.items,de,"value");if(yield`${$}.every((${me}) => ${he})`,a.TypeGuard.TSchema(A.contains)||(0,r.IsNumber)(A.minContains)||(0,r.IsNumber)(A.maxContains)){let Se=a.TypeGuard.TSchema(A.contains)?A.contains:a.Type.Never(),ke=ie(Se,de,"value"),rt=(0,r.IsNumber)(A.minContains)?[`(count >= ${A.minContains})`]:[],Ze=(0,r.IsNumber)(A.maxContains)?[`(count <= ${A.maxContains})`]:[],it=`const count = value.reduce((${se}, ${me}) => ${ke} ? acc + 1 : acc, 0)`,er=["(count > 0)",...rt,...Ze].join(" && ");yield`((${me}) => { ${it}; return ${er}})(${$})`}A.uniqueItems===!0&&(yield`((${me}) => { const set = new Set(); for(const element of value) { const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true } )(${$})`)}function*F(A,de,$){yield`(typeof value === 'object' && Symbol.asyncIterator in ${$})`}function*Y(A,de,$){yield`(typeof ${$} === 'bigint')`,(0,r.IsBigInt)(A.exclusiveMaximum)&&(yield`${$} < BigInt(${A.exclusiveMaximum})`),(0,r.IsBigInt)(A.exclusiveMinimum)&&(yield`${$} > BigInt(${A.exclusiveMinimum})`),(0,r.IsBigInt)(A.maximum)&&(yield`${$} <= BigInt(${A.maximum})`),(0,r.IsBigInt)(A.minimum)&&(yield`${$} >= BigInt(${A.minimum})`),(0,r.IsBigInt)(A.multipleOf)&&(yield`(${$} % BigInt(${A.multipleOf})) === 0`)}function*V(A,de,$){yield`(typeof ${$} === 'boolean')`}function*ae(A,de,$){yield*q(A.returns,de,`${$}.prototype`)}function*L(A,de,$){yield`(${$} instanceof Date) && Number.isFinite(${$}.getTime())`,(0,r.IsNumber)(A.exclusiveMaximumTimestamp)&&(yield`${$}.getTime() < ${A.exclusiveMaximumTimestamp}`),(0,r.IsNumber)(A.exclusiveMinimumTimestamp)&&(yield`${$}.getTime() > ${A.exclusiveMinimumTimestamp}`),(0,r.IsNumber)(A.maximumTimestamp)&&(yield`${$}.getTime() <= ${A.maximumTimestamp}`),(0,r.IsNumber)(A.minimumTimestamp)&&(yield`${$}.getTime() >= ${A.minimumTimestamp}`),(0,r.IsNumber)(A.multipleOfTimestamp)&&(yield`(${$}.getTime() % ${A.multipleOfTimestamp}) === 0`)}function*M(A,de,$){yield`(typeof ${$} === 'function')`}function*j(A,de,$){yield`(typeof ${$} === 'number' && Number.isInteger(${$}))`,(0,r.IsNumber)(A.exclusiveMaximum)&&(yield`${$} < ${A.exclusiveMaximum}`),(0,r.IsNumber)(A.exclusiveMinimum)&&(yield`${$} > ${A.exclusiveMinimum}`),(0,r.IsNumber)(A.maximum)&&(yield`${$} <= ${A.maximum}`),(0,r.IsNumber)(A.minimum)&&(yield`${$} >= ${A.minimum}`),(0,r.IsNumber)(A.multipleOf)&&(yield`(${$} % ${A.multipleOf}) === 0`)}function*ne(A,de,$){let me=A.allOf.map(se=>ie(se,de,$)).join(" && ");if(A.unevaluatedProperties===!1){let se=_e(`${new RegExp(a.KeyResolver.ResolvePattern(A))};`),he=`Object.getOwnPropertyNames(${$}).every(key => ${se}.test(key))`;yield`(${me} && ${he})`}else if(a.TypeGuard.TSchema(A.unevaluatedProperties)){let se=_e(`${new RegExp(a.KeyResolver.ResolvePattern(A))};`),he=`Object.getOwnPropertyNames(${$}).every(key => ${se}.test(key) || ${ie(A.unevaluatedProperties,de,`${$}[key]`)})`;yield`(${me} && ${he})`}else yield`(${me})`}function*re(A,de,$){yield`(typeof value === 'object' && Symbol.iterator in ${$})`}function*O(A,de,$){typeof A.const=="number"||typeof A.const=="boolean"?yield`(${$} === ${A.const})`:yield`(${$} === '${S.Escape(A.const)}')`}function*J(A,de,$){yield"false"}function*oe(A,de,$){yield`(!${ie(A.not,de,$)})`}function*X(A,de,$){yield`(${$} === null)`}function*Z(A,de,$){yield z.IsNumberLike($),(0,r.IsNumber)(A.exclusiveMaximum)&&(yield`${$} < ${A.exclusiveMaximum}`),(0,r.IsNumber)(A.exclusiveMinimum)&&(yield`${$} > ${A.exclusiveMinimum}`),(0,r.IsNumber)(A.maximum)&&(yield`${$} <= ${A.maximum}`),(0,r.IsNumber)(A.minimum)&&(yield`${$} >= ${A.minimum}`),(0,r.IsNumber)(A.multipleOf)&&(yield`(${$} % ${A.multipleOf}) === 0`)}function*pe(A,de,$){yield z.IsObjectLike($),(0,r.IsNumber)(A.minProperties)&&(yield`Object.getOwnPropertyNames(${$}).length >= ${A.minProperties}`),(0,r.IsNumber)(A.maxProperties)&&(yield`Object.getOwnPropertyNames(${$}).length <= ${A.maxProperties}`);let me=Object.getOwnPropertyNames(A.properties);for(let se of me){let he=l.Encode($,se),Se=A.properties[se];if(A.required&&A.required.includes(se))yield*q(Se,de,he),(a.ExtendsUndefined.Check(Se)||k(Se))&&(yield`('${se}' in ${$})`);else{let ke=ie(Se,de,he);yield z.IsExactOptionalProperty($,se,ke)}}if(A.additionalProperties===!1)if(A.required&&A.required.length===me.length)yield`Object.getOwnPropertyNames(${$}).length === ${me.length}`;else{let se=`[${me.map(he=>`'${he}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${$}).every(key => ${se}.includes(key))`}if(typeof A.additionalProperties=="object"){let se=ie(A.additionalProperties,de,`${$}[key]`),he=`[${me.map(Se=>`'${Se}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${$}).every(key => ${he}.includes(key) || ${se}))`}}function*d(A,de,$){yield`(typeof value === 'object' && typeof ${$}.then === 'function')`}function*w(A,de,$){yield z.IsRecordLike($),(0,r.IsNumber)(A.minProperties)&&(yield`Object.getOwnPropertyNames(${$}).length >= ${A.minProperties}`),(0,r.IsNumber)(A.maxProperties)&&(yield`Object.getOwnPropertyNames(${$}).length <= ${A.maxProperties}`);let[me,se]=Object.entries(A.patternProperties)[0],he=_e(`${new RegExp(me)}`),Se=ie(se,de,"value"),ke=a.TypeGuard.TSchema(A.additionalProperties)?ie(A.additionalProperties,de,$):A.additionalProperties===!1?"false":"true",rt=`(${he}.test(key) ? ${Se} : ${ke})`;yield`(Object.entries(${$}).every(([key, value]) => ${rt}))`}function*C(A,de,$){let me=(0,o.Deref)(A,de);if(te.functions.has(A.$ref))return yield`${ge(A.$ref)}(${$})`;yield*q(me,de,$)}function*D(A,de,$){yield`(typeof ${$} === 'string')`,(0,r.IsNumber)(A.maxLength)&&(yield`${$}.length <= ${A.maxLength}`),(0,r.IsNumber)(A.minLength)&&(yield`${$}.length >= ${A.minLength}`),A.pattern!==void 0&&(yield`${_e(`${new RegExp(A.pattern)};`)}.test(${$})`),A.format!==void 0&&(yield`format('${A.format}', ${$})`)}function*P(A,de,$){yield`(typeof ${$} === 'symbol')`}function*N(A,de,$){yield`(typeof ${$} === 'string')`,yield`${_e(`${new RegExp(A.pattern)};`)}.test(${$})`}function*g(A,de,$){yield`${ge(A.$ref)}(${$})`}function*R(A,de,$){if(yield`Array.isArray(${$})`,A.items===void 0)return yield`${$}.length === 0`;yield`(${$}.length === ${A.maxItems})`;for(let me=0;me<A.items.length;me++)yield`${ie(A.items[me],de,`${$}[${me}]`)}`}function*_(A,de,$){yield`${$} === undefined`}function*f(A,de,$){yield`(${A.anyOf.map(se=>ie(se,de,$)).join(" || ")})`}function*I(A,de,$){yield`${$} instanceof Uint8Array`,(0,r.IsNumber)(A.maxByteLength)&&(yield`(${$}.length <= ${A.maxByteLength})`),(0,r.IsNumber)(A.minByteLength)&&(yield`(${$}.length >= ${A.minByteLength})`)}function*v(A,de,$){yield"true"}function*b(A,de,$){yield z.IsVoidLike($)}function*U(A,de,$){let me=te.instances.size;te.instances.set(me,A),yield`kind('${A[a.Kind]}', ${me}, ${$})`}function*q(A,de,$,me=!0){let se=(0,r.IsString)(A.$id)?[...de,A]:de,he=A;if(me&&(0,r.IsString)(A.$id)){let Se=ge(A.$id);if(te.functions.has(Se))return yield`${Se}(${$})`;{let ke=Be(Se,A,de,"value",!1);return te.functions.set(Se,ke),yield`${Se}(${$})`}}switch(he[a.Kind]){case"Any":return yield*G(he,se,$);case"Array":return yield*H(he,se,$);case"AsyncIterator":return yield*F(he,se,$);case"BigInt":return yield*Y(he,se,$);case"Boolean":return yield*V(he,se,$);case"Constructor":return yield*ae(he,se,$);case"Date":return yield*L(he,se,$);case"Function":return yield*M(he,se,$);case"Integer":return yield*j(he,se,$);case"Intersect":return yield*ne(he,se,$);case"Iterator":return yield*re(he,se,$);case"Literal":return yield*O(he,se,$);case"Never":return yield*J(he,se,$);case"Not":return yield*oe(he,se,$);case"Null":return yield*X(he,se,$);case"Number":return yield*Z(he,se,$);case"Object":return yield*pe(he,se,$);case"Promise":return yield*d(he,se,$);case"Record":return yield*w(he,se,$);case"Ref":return yield*C(he,se,$);case"String":return yield*D(he,se,$);case"Symbol":return yield*P(he,se,$);case"TemplateLiteral":return yield*N(he,se,$);case"This":return yield*g(he,se,$);case"Tuple":return yield*R(he,se,$);case"Undefined":return yield*_(he,se,$);case"Union":return yield*f(he,se,$);case"Uint8Array":return yield*I(he,se,$);case"Unknown":return yield*v(he,se,$);case"Void":return yield*b(he,se,$);default:if(!a.TypeRegistry.Has(he[a.Kind]))throw new x(A);return yield*U(he,se,$)}}let te={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function ie(A,de,$,me=!0){return`(${[...q(A,de,$,me)].join(" && ")})`}function ge(A){return`check_${p.Encode(A)}`}function _e(A){let de=`local_${te.variables.size}`;return te.variables.set(de,`const ${de} = ${A}`),de}function Be(A,de,$,me,se=!0){let[he,Se]=[`
49
49
  `,it=>"".padStart(it," ")],ke=Fe("value","any"),rt=Rr("boolean"),Ze=[...q(de,$,me,se)].map(it=>`${Se(4)}${it}`).join(` &&${he}`);return`function ${A}(${ke})${rt} {${he}${Se(2)}return (${he}${Ze}${he}${Se(2)})
50
50
  }`}function Fe(A,de){let $=te.language==="typescript"?`: ${de}`:"";return`${A}${$}`}function Rr(A){return te.language==="typescript"?`: ${A}`:""}function we(A,de,$){let me=Be("check",A,de,"value"),se=Fe("value","any"),he=Rr("boolean"),Se=[...te.functions.values()],ke=[...te.variables.values()],rt=(0,r.IsString)(A.$id)?`return function check(${se})${he} {
51
51
  return ${ge(A.$id)}(value)
52
52
  }`:`return ${me}`;return[...ke,...Se,rt].join(`
53
- `)}function hr(...A){let de={language:"javascript"},[$,me,se]=A.length===2&&(0,r.IsArray)(A[1])?[A[0],A[1],de]:A.length===2&&!(0,r.IsArray)(A[1])?[A[0],[],A[1]]:A.length===3?[A[0],A[1],A[2]]:A.length===1?[A[0],[],de]:[null,[],de];if(te.language=se.language,te.variables.clear(),te.functions.clear(),te.instances.clear(),!a.TypeGuard.TSchema($))throw new E($);for(let he of me)if(!a.TypeGuard.TSchema(he))throw new E(he);return we($,me,se)}T.Code=hr;function $r(A,de=[]){let $=hr(A,de,{language:"javascript"}),me=globalThis.Function("kind","format","hash",$),se=new Map(te.instances);function he(Ze,it,er){if(!a.TypeRegistry.Has(Ze)||!se.has(it))return!1;let fn=a.TypeRegistry.Get(Ze),ln=se.get(it);return fn(ln,er)}function Se(Ze,it){return a.FormatRegistry.Has(Ze)?a.FormatRegistry.Get(Ze)(it):!1}function ke(Ze){return(0,s.Hash)(Ze)}let rt=me(he,Se,ke);return new u(A,de,rt,$)}T.Compile=$r})(W||(e.TypeCompiler=W={}))}}),bv=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/compiler/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(i,o,s,a){a===void 0&&(a=s);var u=Object.getOwnPropertyDescriptor(o,s);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[s]}}),Object.defineProperty(i,a,u)}:function(i,o,s,a){a===void 0&&(a=s),i[a]=o[s]}),r=e&&e.__exportStar||function(i,o){for(var s in i)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&t(o,i,s)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorIterator=e.ValueErrorType=void 0;var n=hv();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),Object.defineProperty(e,"ValueErrorIterator",{enumerable:!0,get:function(){return n.ValueErrorIterator}}),r(mv(),e)}}),Jo=Nt(lv(),1),vv=Nt(dv(),1),mp=!1,bp=!1;Jo.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(mp=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(bp=process?.env?.LOGGER_PERF_PREFIX==="true"));var _v={prefix:void 0,time:mp,delta:bp,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},Ha=[],vp=class{sinceFirst=0;sinceLast=0;time=!1;delta=!1;constructor(e,t,r,n){Object.assign(this,{sinceFirst:e,sinceLast:t,time:r,delta:n})}toString(){let e=this.sinceFirst*.001,t=e.toFixed(e<5?2:1),r=this.sinceLast<1e3?`${this.sinceLast.toFixed(0)}`.padStart(5," "):`${`${(this.sinceLast*.001).toFixed(this.sinceLast<1e4?1:0)}`.padStart(4," ")}s`;return`[${[this.time?t:null,this.delta?r:null].filter(n=>n!=null).join(",")}]`}},_p=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},$i=!1,$e=class at{static ERROR=2;static WARN=4;static INFO=6;static LOG=6;static DEBUG=8;static VERBOSE=10;static firstLog=0;static lastLog=0;static setup(t=at.INFO,r={}){r=Object.assign({},_v,r),t>10&&console.debug("setup logger",{config:r});let n=this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}),i=(...u)=>{typeof window<"u"&&window?.FORCE_DISABLE_LOGLEVEL&&n(...u)};i.isDisabled=!0,i.isEnabled=!1;let o=this.wrapLog(console.groupCollapsed,r),s=(u,c)=>{function l(...S){let x=S[S.length-1];return x===i?x():(o(...S.slice(0,-1)),(async()=>{try{let E=x();return E instanceof Promise?await E:E}finally{console.groupEnd()}})())}let p=Object.assign(c.bind({}),{isEnabled:u,isDisabled:!u,group:l,force:c});return u?p:Object.assign(i.bind({}),{isEnabled:u,isDisabled:!u,group:l,force:p})},a=s(t>=at.ERROR,this.wrapLog(console.error,r));return{ERROR:(...u)=>(a(...u),new Error((0,vv.default)(u))),WARN:s(t>=at.WARN,this.wrapLog(console.warn,r)),LOG:s(t>=at.INFO,this.wrapLog(console.log,r)),DEBUG:s(t>=at.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:s(t>=at.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(t,r){if(Jo.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=Jo.isBrowser&&navigator.userAgent.includes("Chrome")?["",at.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&($i?n.push(new _p("dim",r.prefix)):n.push(r.prefix)),t.bind(console,...n)}}static timeStr(t,r,n=0){if(!performance.now)return;let i=performance.now();at.firstLog||(at.firstLog=i,at.lastLog=i);let o=new vp(i-at.firstLog,i-at.lastLog,t,r);return at.lastLog=i,n?o.toString():o}static getOriginFromStack(t){let r=!1;for(let n of t.split(`
54
- `)){let i=n.match(/^\s+at\s+(.*)/);if(i){if(r)return i[1].trim().replace(__dirname,"");r=!0}}}};Jo.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(Ha&&Ha.length){for(let t of Ha)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof vp))return null;$i||($i=!0);let t=$e.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof _p?($i||($i=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var wp=Nt(pv(),1),B$=wp.default.configure,Zr=wp.default,Ja=100,{WARN:wv,LOG:D$,DEBUG:Ke,VERBOSE:Te,ERROR:M$}=$e.setup($e.INFO),Xo=Pe.set();Hl({enforceActions:"always"});if(!new class{xyz}().hasOwnProperty("xyz"))throw new Error("Transpiler is not configured correctly");var He=({caller:e,thread:t,pattern:r,args:n})=>Re(()=>(n=n||r,`${!Array.isArray(t)&&t?.name?t.name+" | ":""}${e??"caller?"}${n?`{${typeof n=="string"?n:Zr(n)}}`:""}`));function Tp(e,t){return Re(()=>Ge.structural(e.get(),t.get()))}function jn(e,t){return Ge.shallow(e.applogs,t.applogs)}function ys(e,t){if(e.size!==t.size)return!1;for(let r=0;r<e.size;r++){let n=e.nodes[r],i=t.nodes[r];if(Te.isEnabled&&Te("queryNodesComparer",r,n,i),!Ge.structural(n.variables,i.variables))return Te.isEnabled&&Te("[queryNodesComparer] changed vars:",r,n,i),!1;if(!jn(n.logsOfThisNode,i.logsOfThisNode))return Te.isEnabled&&Te("[queryNodesComparer] changed logsOfThisNode:",r,n,i),!1}return Te.isEnabled&&Te("[queryNodesComparer] equal:",{a:e,b:t}),!0}var Tv=0;function fr(e,{name:t,equals:r}={}){let n=`observableArrayMap@${++Tv}{${t}}`;Te.isEnabled&&Te(`[${n}] create`,{fnname:e.name,fn:e,name:t,equals:r});let i,o=Op(e,a=>{i?Re(()=>(r??Ge.structural)(i,a))?Ke.isEnabled&&Ke(`[${n}] update skipped`,{updatedItems:a,observableArr:i}):(i.replace(a),Ke.isEnabled&&Ke(`[${n}] updated`,{updatedItems:a,observableArr:i})):i=Pe.array(a,{deep:!1,name:t,equals:r})},{name:n});if(n.includes("useRoots")){var s=xt(i);Ke(`[${n}] deps`,{disposeAutorun:o,rootsAtom:s,observableArr:i,observers:Ii(i)}),$n(()=>Xo.add(s))}return Te.isEnabled&&Pn(i,()=>{Te(`[${n}] observed`,Ii(i),{rootsAtom:s,observableArr:i})}),Gr(i,()=>{Te.isEnabled&&Te(`[${n}] dispose`),s&&$n(()=>Xo.delete(s)),o()}),i}var Av=0;function Ap(e,{name:t}={}){let r=`observableSetMap@${++Av}{${t}}`;Te.isEnabled&&Te(`[${r}] create`,{fnname:e.name,fn:e,name:t});let n,i=Op(e,s=>{if(!n)n=Pe.set(s,{deep:!1,name:t});else{let{deleted:a,added:u}=Re(()=>{let c=new Set(n.values()),l=new Set;for(let p of s)n.has(p)?(Te.isEnabled&&Te(`[${r}] unchanged`,p,{updatedItems:s,observableSet:n}),c.delete(p)):l.add(p);return Ke.isEnabled&&Ke(`[${r}] updated:`,{unseen:c,added:l,updatedItems:s,observableSet:n}),{added:l,deleted:c}});for(let c of a)n.delete(c);for(let c of u)n.add(c)}},{name:r});if(r.includes("useRoots")){var o=xt(n);Ke.isEnabled&&Ke(`[${r}] deps`,{disposeAutorun:i,rootsAtom:o,observableSet:n,observers:Ii(n)}),$n(()=>Xo.add(o))}return Te.isEnabled&&Pn(n,()=>{Te(`[${r}] observed`,Ii(n),{rootsAtom:o,observableSet:n})}),Gr(n,()=>{Te.isEnabled&&Te(`[${r}] dispose`),o&&$n(()=>Xo.delete(o)),i()}),n}function Op(e,t=null,{name:r}={}){Ke.isEnabled&&Ke("[autorunButAlsoImmediately] create",{fnname:e.name,fn:e,name:r});let n=`${r}.autorunImm`,i,o=new xn(n,function(...c){Ke.isEnabled&&Ke(`[${n}] reaction.invalidate`,c),s()});function s(){o.track(function(){let c=Ja&&performance.now();Ke.isEnabled&&Ke(`[${n}] runAndTrack:`,{name:r??e.name,fn:e}),i=e(),Ke.isEnabled&&Ke(`[${n}] runAndTrack =>`,i),$n(()=>{t?.(i)}),Ja&&performance.now()-c>Ja&&wv(`[${n}] took ${performance.now()-c}ms`)})}return s(),Ke.isEnabled&&Ke(`[${n}] deps of reaction`,{reaction:o,result:i,deps:Ei(o)}),()=>{Te.isEnabled&&Te(`[${n}] dispose`),setTimeout(()=>o.dispose())}}function Qe(e,t,r=!1){if(qr(t))throw new Error("computedFnDeepCompare shouldn't be used on actions");let n=!1,i=0,o=typeof r=="boolean"?{keepAlive:r}:r,s=new Map;return function(...a){let u,c=Re(()=>a),l=`computedFnDeepCompare(${e||t.name}#${++i})${o.argsDebugName?`{${o.argsDebugName(...a)}}`:""}`;for(let[x,E]of s.entries())if(Ge.structural(x,c)){u=E;break}if(u){let x=u.get();return Te.isEnabled&&Te(`[${l}] cache hit`,{untrackedArgs:c,cachedResult:x}),x}if(!o.keepAlive&&!Nl())return!n&&Ul().computedRequiresReaction&&(console.warn("invoking a computedFn from outside an reactive context won't be memoized, unless keepAlive is set"),n=!0),t.apply(this,a);Te.isEnabled&&Te(`[${l}] new computation`,{untrackedArgs:c});let p,S=Me(()=>(Te.isEnabled&&Te(`[${l}] update->rerun`,Re(()=>({args:a})),t),Te.isEnabled&&Fa(),p=t.apply(this,a)),{...o,name:l});if(Te.isEnabled&&Te(`[${l}] deps`,Ei(S),{untrackedArgs:c}),s.set(c,S),!o.keepAlive){let x=Gr(S,()=>{Te.isEnabled&&Te(`[${l}] dispose`,S),x(),s.delete(c),o.onCleanup&&o.onCleanup(p,...a),p=void 0})}return S.get()}}function Ov(e){let t=0,r="",n=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("?r+=o+`
53
+ `)}function hr(...A){let de={language:"javascript"},[$,me,se]=A.length===2&&(0,r.IsArray)(A[1])?[A[0],A[1],de]:A.length===2&&!(0,r.IsArray)(A[1])?[A[0],[],A[1]]:A.length===3?[A[0],A[1],A[2]]:A.length===1?[A[0],[],de]:[null,[],de];if(te.language=se.language,te.variables.clear(),te.functions.clear(),te.instances.clear(),!a.TypeGuard.TSchema($))throw new E($);for(let he of me)if(!a.TypeGuard.TSchema(he))throw new E(he);return we($,me,se)}T.Code=hr;function $r(A,de=[]){let $=hr(A,de,{language:"javascript"}),me=globalThis.Function("kind","format","hash",$),se=new Map(te.instances);function he(Ze,it,er){if(!a.TypeRegistry.Has(Ze)||!se.has(it))return!1;let fn=a.TypeRegistry.Get(Ze),ln=se.get(it);return fn(ln,er)}function Se(Ze,it){return a.FormatRegistry.Has(Ze)?a.FormatRegistry.Get(Ze)(it):!1}function ke(Ze){return(0,s.Hash)(Ze)}let rt=me(he,Se,ke);return new u(A,de,rt,$)}T.Compile=$r})(W||(e.TypeCompiler=W={}))}}),bv=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/compiler/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(i,o,s,a){a===void 0&&(a=s);var u=Object.getOwnPropertyDescriptor(o,s);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[s]}}),Object.defineProperty(i,a,u)}:function(i,o,s,a){a===void 0&&(a=s),i[a]=o[s]}),r=e&&e.__exportStar||function(i,o){for(var s in i)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&t(o,i,s)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorIterator=e.ValueErrorType=void 0;var n=hv();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),Object.defineProperty(e,"ValueErrorIterator",{enumerable:!0,get:function(){return n.ValueErrorIterator}}),r(mv(),e)}}),Xo=Nt(lv(),1),vv=Nt(dv(),1),mp=!1,bp=!1;Xo.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(mp=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(bp=process?.env?.LOGGER_PERF_PREFIX==="true"));var _v={prefix:void 0,time:mp,delta:bp,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},Ha=[],vp=class{sinceFirst=0;sinceLast=0;time=!1;delta=!1;constructor(e,t,r,n){Object.assign(this,{sinceFirst:e,sinceLast:t,time:r,delta:n})}toString(){let e=this.sinceFirst*.001,t=e.toFixed(e<5?2:1),r=this.sinceLast<1e3?`${this.sinceLast.toFixed(0)}`.padStart(5," "):`${`${(this.sinceLast*.001).toFixed(this.sinceLast<1e4?1:0)}`.padStart(4," ")}s`;return`[${[this.time?t:null,this.delta?r:null].filter(n=>n!=null).join(",")}]`}},_p=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},$i=!1,$e=class at{static ERROR=2;static WARN=4;static INFO=6;static LOG=6;static DEBUG=8;static VERBOSE=10;static firstLog=0;static lastLog=0;static setup(t=at.INFO,r={}){r=Object.assign({},_v,r),t>10&&console.debug("setup logger",{config:r});let n=this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}),i=(...u)=>{typeof window<"u"&&window?.FORCE_DISABLE_LOGLEVEL&&n(...u)};i.isDisabled=!0,i.isEnabled=!1;let o=this.wrapLog(console.groupCollapsed,r),s=(u,c)=>{function l(...S){let x=S[S.length-1];return x===i?x():(o(...S.slice(0,-1)),(async()=>{try{let E=x();return E instanceof Promise?await E:E}finally{console.groupEnd()}})())}let p=Object.assign(c.bind({}),{isEnabled:u,isDisabled:!u,group:l,force:c});return u?p:Object.assign(i.bind({}),{isEnabled:u,isDisabled:!u,group:l,force:p})},a=s(t>=at.ERROR,this.wrapLog(console.error,r));return{ERROR:(...u)=>(a(...u),new Error((0,vv.default)(u))),WARN:s(t>=at.WARN,this.wrapLog(console.warn,r)),LOG:s(t>=at.INFO,this.wrapLog(console.log,r)),DEBUG:s(t>=at.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:s(t>=at.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(t,r){if(Xo.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=Xo.isBrowser&&navigator.userAgent.includes("Chrome")?["",at.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&($i?n.push(new _p("dim",r.prefix)):n.push(r.prefix)),t.bind(console,...n)}}static timeStr(t,r,n=0){if(!performance.now)return;let i=performance.now();at.firstLog||(at.firstLog=i,at.lastLog=i);let o=new vp(i-at.firstLog,i-at.lastLog,t,r);return at.lastLog=i,n?o.toString():o}static getOriginFromStack(t){let r=!1;for(let n of t.split(`
54
+ `)){let i=n.match(/^\s+at\s+(.*)/);if(i){if(r)return i[1].trim().replace(__dirname,"");r=!0}}}};Xo.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(Ha&&Ha.length){for(let t of Ha)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof vp))return null;$i||($i=!0);let t=$e.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof _p?($i||($i=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var wp=Nt(pv(),1),B$=wp.default.configure,Zr=wp.default,Ja=100,{WARN:wv,LOG:D$,DEBUG:Ke,VERBOSE:Te,ERROR:M$}=$e.setup($e.INFO),Yo=Pe.set();Hl({enforceActions:"always"});if(!new class{xyz}().hasOwnProperty("xyz"))throw new Error("Transpiler is not configured correctly");var He=({caller:e,thread:t,pattern:r,args:n})=>Re(()=>(n=n||r,`${!Array.isArray(t)&&t?.name?t.name+" | ":""}${e??"caller?"}${n?`{${typeof n=="string"?n:Zr(n)}}`:""}`));function Tp(e,t){return Re(()=>Ge.structural(e.get(),t.get()))}function jn(e,t){return Ge.shallow(e.applogs,t.applogs)}function gs(e,t){if(e.size!==t.size)return!1;for(let r=0;r<e.size;r++){let n=e.nodes[r],i=t.nodes[r];if(Te.isEnabled&&Te("queryNodesComparer",r,n,i),!Ge.structural(n.variables,i.variables))return Te.isEnabled&&Te("[queryNodesComparer] changed vars:",r,n,i),!1;if(!jn(n.logsOfThisNode,i.logsOfThisNode))return Te.isEnabled&&Te("[queryNodesComparer] changed logsOfThisNode:",r,n,i),!1}return Te.isEnabled&&Te("[queryNodesComparer] equal:",{a:e,b:t}),!0}var Tv=0;function fr(e,{name:t,equals:r}={}){let n=`observableArrayMap@${++Tv}{${t}}`;Te.isEnabled&&Te(`[${n}] create`,{fnname:e.name,fn:e,name:t,equals:r});let i,o=Op(e,a=>{i?Re(()=>(r??Ge.structural)(i,a))?Ke.isEnabled&&Ke(`[${n}] update skipped`,{updatedItems:a,observableArr:i}):(i.replace(a),Ke.isEnabled&&Ke(`[${n}] updated`,{updatedItems:a,observableArr:i})):i=Pe.array(a,{deep:!1,name:t,equals:r})},{name:n});if(n.includes("useRoots")){var s=xt(i);Ke(`[${n}] deps`,{disposeAutorun:o,rootsAtom:s,observableArr:i,observers:Ii(i)}),$n(()=>Yo.add(s))}return Te.isEnabled&&Pn(i,()=>{Te(`[${n}] observed`,Ii(i),{rootsAtom:s,observableArr:i})}),Gr(i,()=>{Te.isEnabled&&Te(`[${n}] dispose`),s&&$n(()=>Yo.delete(s)),o()}),i}var Av=0;function Ap(e,{name:t}={}){let r=`observableSetMap@${++Av}{${t}}`;Te.isEnabled&&Te(`[${r}] create`,{fnname:e.name,fn:e,name:t});let n,i=Op(e,s=>{if(!n)n=Pe.set(s,{deep:!1,name:t});else{let{deleted:a,added:u}=Re(()=>{let c=new Set(n.values()),l=new Set;for(let p of s)n.has(p)?(Te.isEnabled&&Te(`[${r}] unchanged`,p,{updatedItems:s,observableSet:n}),c.delete(p)):l.add(p);return Ke.isEnabled&&Ke(`[${r}] updated:`,{unseen:c,added:l,updatedItems:s,observableSet:n}),{added:l,deleted:c}});for(let c of a)n.delete(c);for(let c of u)n.add(c)}},{name:r});if(r.includes("useRoots")){var o=xt(n);Ke.isEnabled&&Ke(`[${r}] deps`,{disposeAutorun:i,rootsAtom:o,observableSet:n,observers:Ii(n)}),$n(()=>Yo.add(o))}return Te.isEnabled&&Pn(n,()=>{Te(`[${r}] observed`,Ii(n),{rootsAtom:o,observableSet:n})}),Gr(n,()=>{Te.isEnabled&&Te(`[${r}] dispose`),o&&$n(()=>Yo.delete(o)),i()}),n}function Op(e,t=null,{name:r}={}){Ke.isEnabled&&Ke("[autorunButAlsoImmediately] create",{fnname:e.name,fn:e,name:r});let n=`${r}.autorunImm`,i,o=new xn(n,function(...c){Ke.isEnabled&&Ke(`[${n}] reaction.invalidate`,c),s()});function s(){o.track(function(){let c=Ja&&performance.now();Ke.isEnabled&&Ke(`[${n}] runAndTrack:`,{name:r??e.name,fn:e}),i=e(),Ke.isEnabled&&Ke(`[${n}] runAndTrack =>`,i),$n(()=>{t?.(i)}),Ja&&performance.now()-c>Ja&&wv(`[${n}] took ${performance.now()-c}ms`)})}return s(),Ke.isEnabled&&Ke(`[${n}] deps of reaction`,{reaction:o,result:i,deps:Ei(o)}),()=>{Te.isEnabled&&Te(`[${n}] dispose`),setTimeout(()=>o.dispose())}}function Qe(e,t,r=!1){if(qr(t))throw new Error("computedFnDeepCompare shouldn't be used on actions");let n=!1,i=0,o=typeof r=="boolean"?{keepAlive:r}:r,s=new Map;return function(...a){let u,c=Re(()=>a),l=`computedFnDeepCompare(${e||t.name}#${++i})${o.argsDebugName?`{${o.argsDebugName(...a)}}`:""}`;for(let[x,E]of s.entries())if(Ge.structural(x,c)){u=E;break}if(u){let x=u.get();return Te.isEnabled&&Te(`[${l}] cache hit`,{untrackedArgs:c,cachedResult:x}),x}if(!o.keepAlive&&!Nl())return!n&&Ul().computedRequiresReaction&&(console.warn("invoking a computedFn from outside an reactive context won't be memoized, unless keepAlive is set"),n=!0),t.apply(this,a);Te.isEnabled&&Te(`[${l}] new computation`,{untrackedArgs:c});let p,S=Me(()=>(Te.isEnabled&&Te(`[${l}] update->rerun`,Re(()=>({args:a})),t),Te.isEnabled&&Fa(),p=t.apply(this,a)),{...o,name:l});if(Te.isEnabled&&Te(`[${l}] deps`,Ei(S),{untrackedArgs:c}),s.set(c,S),!o.keepAlive){let x=Gr(S,()=>{Te.isEnabled&&Te(`[${l}] dispose`,S),x(),s.delete(c),o.onCleanup&&o.onCleanup(p,...a),p=void 0})}return S.get()}}function Ov(e){let t=0,r="",n=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("?r+=o+`
55
55
  `+" ".repeat(++t):o===")"?r+=`
56
56
  `+" ".repeat(--t)+o:o===","&&n===0?r+=o+`
57
57
  `+" ".repeat(t):o==="{"&&n===0?(n++,r+=o+`
58
58
  `+" ".repeat(t+1)):o==="}"&&n===1?(n--,r+=`
59
- `+" ".repeat(t)+o):o==="{"&&n>0?(n++,r+=o):(o==="}"&&n>1&&n--,r+=o)}return r}var{WARN:ld,LOG:L$,DEBUG:Ev,VERBOSE:k$,ERROR:Jr}=$e.setup($e.INFO,{prefix:"[thread]"});function Yt(e){return e.init!==void 0}var gs=class{constructor(e,t,r,n=[],i={}){this.name=e,this._applogs=n,this.parents=t===null?null:fd(t),this.filters=r,Re(()=>this.parents?.length===0)&&ld("[Thread] empty parents array",e),i.skipObservable||Tr(this,{applogsCids:Me,applogsByCid:Me,insert:st,size:Me,isEmpty:Me,firstLog:Me,latestLog:Me},{name:`Thread{${e}}`})}filters;parents;_subscribers=[];get readOnly(){return this.parents.length!==1?!0:this.parents[0].readOnly}insert(e){if(this.readOnly)throw Jr("[Thread] insert() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw Jr("[Thread] insert() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw Jr("[Thread] insert() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insert(e)}insertRaw(e){if(this.readOnly)throw Jr("[Thread] insertRaw() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw Jr("[Thread] insertRaw() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw Jr("[Thread] insertRaw() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insertRaw(e)}subscribe(e){return this._subscribers.push(e),this.unsubscribe.bind(this,e)}unsubscribe(e){let t=this._subscribers.indexOf(e);t!==-1?this._subscribers.splice(t,1):ld("unsubscribe called for non-existent",e)}notifySubscribers(e){Ev(`[thread: ${this.name}] notifying`,this._subscribers.length,"subscribers of",{...e,subs:this._subscribers});for(let t of this._subscribers)t(e)}get applogs(){return this._applogs}get applogsCids(){return this._applogs.map(e=>e.cid)}map(e){return this.applogs.map(e)}get findLast(){return this.applogs.findLast.bind(this.applogs)}get findFirst(){return this.applogs.find.bind(this.applogs)}get firstLog(){return this.applogs[0]}get latestLog(){return this.applogs[this.applogs.length-1]}hasApplog(e,t){if(t)return this.applogs.includes(e);if(!e.cid)throw Jr("[hasApplogs] applog without CID:",e);return this.hasApplogCid(e.cid)}hasApplogCid(e){return this.applogsCids.includes(e.toString())}get applogsByCid(){return new Map(this.applogs.map(e=>[e.cid,e]))}getApplog(e){return this.applogsByCid.get(e.toString())}hasApplogWithDiffTs(e){return this.applogs.find(t=>t.en===e.en&&t.at===e.at&&t.vl===e.vl&&t.ag===e.ag)}get isEmpty(){return this.size===0}get size(){return this.applogs.length}get length(){return this.applogs.length}get untrackedSize(){return Re(()=>this.size)}get nameAndSizeUntracked(){return Re(()=>`${this.name} (${this.size})`)}get prettyName(){return Ov(this.name)}get hasParents(){return!!this.parents?.length}};var _u=class Ep extends gs{static fromArray(t,r){return new Ep(r||"static",null,[],t)}constructor(t,r,n,i){super(t,r,n,i,{skipObservable:!0})}get readOnly(){return!0}},Ip={};Wa(Ip,{code:()=>Gp,decode:()=>Ts,encode:()=>Bu,format:()=>wd,name:()=>Nw,parse:()=>$w,stringify:()=>wd});var Iv=["string","number","bigint","symbol"],xv=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function Sv(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(Iv.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(Cv(e))return"Buffer";let r=Nv(e);return r||"Object"}function Cv(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function Nv(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(xv.includes(t))return t}var B=class{constructor(e,t,r){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=r}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}};B.uint=new B(0,"uint",!0);B.negint=new B(1,"negint",!0);B.bytes=new B(2,"bytes",!0);B.string=new B(3,"string",!0);B.array=new B(4,"array",!1);B.map=new B(5,"map",!1);B.tag=new B(6,"tag",!1);B.float=new B(7,"float",!0);B.false=new B(7,"false",!0);B.true=new B(7,"true",!0);B.null=new B(7,"null",!0);B.undefined=new B(7,"undefined",!0);B.break=new B(7,"break",!0);var ee=class{constructor(e,t,r){this.type=e,this.value=t,this.encodedLength=r,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}},Fn=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Rv=new TextDecoder,$v=new TextEncoder;function Yo(e){return Fn&&globalThis.Buffer.isBuffer(e)}function wu(e){return e instanceof Uint8Array?Yo(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Pv=Fn?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):pd(e,t,r):(e,t,r)=>r-t>64?Rv.decode(e.subarray(t,r)):pd(e,t,r),xp=Fn?e=>e.length>64?globalThis.Buffer.from(e):dd(e):e=>e.length>64?$v.encode(e):dd(e);var Tu=Fn?(e,t,r)=>Yo(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Uv=Fn?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),wu(globalThis.Buffer.concat(e,t))):(e,t)=>{let r=new Uint8Array(t),n=0;for(let i of e)n+i.length>r.length&&(i=i.subarray(0,r.length-n)),r.set(i,n),n+=i.length;return r},Bv=Fn?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Dv(e,t){if(Yo(e)&&Yo(t))return e.compare(t);for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}function dd(e){let t=[],r=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=i&63|128):(i&64512)===55296&&n+1<e.length&&(e.charCodeAt(n+1)&64512)===56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++n)&1023),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=i&63|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=i&63|128)}return t}function pd(e,t,r){let n=[];for(;t<r;){let i=e[t],o=null,s=i>239?4:i>223?3:i>191?2:1;if(t+s<=r){let a,u,c,l;switch(s){case 1:i<128&&(o=i);break;case 2:a=e[t+1],(a&192)===128&&(l=(i&31)<<6|a&63,l>127&&(o=l));break;case 3:a=e[t+1],u=e[t+2],(a&192)===128&&(u&192)===128&&(l=(i&15)<<12|(a&63)<<6|u&63,l>2047&&(l<55296||l>57343)&&(o=l));break;case 4:a=e[t+1],u=e[t+2],c=e[t+3],(a&192)===128&&(u&192)===128&&(c&192)===128&&(l=(i&15)<<18|(a&63)<<12|(u&63)<<6|c&63,l>65535&&l<1114112&&(o=l))}}o===null?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),t+=s}return Sp(n)}var hd=4096;function Sp(e){let t=e.length;if(t<=hd)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=hd));return r}var Mv=256,Cp=class{constructor(e=Mv){this.chunkSize=e,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(e){let t=this.chunks[this.chunks.length-1];if(this.cursor+e.length<=this.maxCursor+1){let n=t.length-(this.maxCursor-this.cursor)-1;t.set(e,n)}else{if(t){let n=t.length-(this.maxCursor-this.cursor)-1;n<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,n),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=Bv(this.chunkSize),this.chunks.push(t),this.maxCursor+=t.length,this._initReuseChunk===null&&(this._initReuseChunk=t),t.set(e,0)):(this.chunks.push(e),this.maxCursor+=e.length)}this.cursor+=e.length}toBytes(e=!1){let t;if(this.chunks.length===1){let r=this.chunks[0];e&&this.cursor>r.length/2?(t=this.cursor===r.length?r:r.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):t=Tu(r,0,this.cursor)}else t=Uv(this.chunks,this.cursor);return e&&this.reset(),t}},ye="CBOR decode error:",Qr="CBOR encode error:",Fi=[];Fi[23]=1;Fi[24]=2;Fi[25]=3;Fi[26]=5;Fi[27]=9;function Vn(e,t,r){if(e.length-t<r)throw new Error(`${ye} not enough data for type`)}var Ye=[24,256,65536,4294967296,BigInt("18446744073709551616")];function tn(e,t,r){Vn(e,t,1);let n=e[t];if(r.strict===!0&&n<Ye[0])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);return n}function rn(e,t,r){Vn(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<Ye[1])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);return n}function nn(e,t,r){Vn(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<Ye[2])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);return n}function on(e,t,r){Vn(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<Ye[3])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${ye} integers outside of the safe integer range are not supported`)}function Lv(e,t,r,n){return new ee(B.uint,tn(e,t+1,n),2)}function kv(e,t,r,n){return new ee(B.uint,rn(e,t+1,n),3)}function jv(e,t,r,n){return new ee(B.uint,nn(e,t+1,n),5)}function Fv(e,t,r,n){return new ee(B.uint,on(e,t+1,n),9)}function sn(e,t){return Pt(e,0,t.value)}function Pt(e,t,r){if(r<Ye[0]){let n=Number(r);e.push([t|n])}else if(r<Ye[1]){let n=Number(r);e.push([t|24,n])}else if(r<Ye[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<Ye[3]){let n=Number(r);e.push([t|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<Ye[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),s=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=s&255,s=s>>8,i[3]=s&255,s=s>>8,i[2]=s&255,s=s>>8,i[1]=s&255,e.push(i)}else throw new Error(`${ye} encountered BigInt larger than allowable range`)}}sn.encodedSize=function(t){return Pt.encodedSize(t.value)};Pt.encodedSize=function(t){return t<Ye[0]?1:t<Ye[1]?2:t<Ye[2]?3:t<Ye[3]?5:9};sn.compareTokens=function(t,r){return t.value<r.value?-1:t.value>r.value?1:0};function Vv(e,t,r,n){return new ee(B.negint,-1-tn(e,t+1,n),2)}function zv(e,t,r,n){return new ee(B.negint,-1-rn(e,t+1,n),3)}function Kv(e,t,r,n){return new ee(B.negint,-1-nn(e,t+1,n),5)}var Au=BigInt(-1),Np=BigInt(1);function qv(e,t,r,n){let i=on(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new ee(B.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${ye} integers outside of the safe integer range are not supported`);return new ee(B.negint,Au-BigInt(i),9)}function Ou(e,t){let r=t.value,n=typeof r=="bigint"?r*Au-Np:r*-1-1;Pt(e,t.type.majorEncoded,n)}Ou.encodedSize=function(t){let r=t.value,n=typeof r=="bigint"?r*Au-Np:r*-1-1;return n<Ye[0]?1:n<Ye[1]?2:n<Ye[2]?3:n<Ye[3]?5:9};Ou.compareTokens=function(t,r){return t.value<r.value?1:t.value>r.value?-1:0};function Vi(e,t,r,n){Vn(e,t,r+n);let i=Tu(e,t+r,t+r+n);return new ee(B.bytes,i,r+n)}function Gv(e,t,r,n){return Vi(e,t,1,r)}function Wv(e,t,r,n){return Vi(e,t,2,tn(e,t+1,n))}function Hv(e,t,r,n){return Vi(e,t,3,rn(e,t+1,n))}function Jv(e,t,r,n){return Vi(e,t,5,nn(e,t+1,n))}function Xv(e,t,r,n){let i=on(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer bytes lengths not supported`);return Vi(e,t,9,i)}function Qo(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===B.string?xp(e.value):e.value),e.encodedBytes}function ms(e,t){let r=Qo(t);Pt(e,t.type.majorEncoded,r.length),e.push(r)}ms.encodedSize=function(t){let r=Qo(t);return Pt.encodedSize(r.length)+r.length};ms.compareTokens=function(t,r){return Yv(Qo(t),Qo(r))};function Yv(e,t){return e.length<t.length?-1:e.length>t.length?1:Dv(e,t)}function zi(e,t,r,n,i){let o=r+n;Vn(e,t,o);let s=new ee(B.string,Pv(e,t+r,t+o),o);return i.retainStringBytes===!0&&(s.byteValue=Tu(e,t+r,t+o)),s}function Qv(e,t,r,n){return zi(e,t,1,r,n)}function Zv(e,t,r,n){return zi(e,t,2,tn(e,t+1,n),n)}function e_(e,t,r,n){return zi(e,t,3,rn(e,t+1,n),n)}function t_(e,t,r,n){return zi(e,t,5,nn(e,t+1,n),n)}function r_(e,t,r,n){let i=on(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer string lengths not supported`);return zi(e,t,9,i,n)}var n_=ms;function zn(e,t,r,n){return new ee(B.array,n,r)}function i_(e,t,r,n){return zn(e,t,1,r)}function o_(e,t,r,n){return zn(e,t,2,tn(e,t+1,n))}function s_(e,t,r,n){return zn(e,t,3,rn(e,t+1,n))}function a_(e,t,r,n){return zn(e,t,5,nn(e,t+1,n))}function u_(e,t,r,n){let i=on(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer array lengths not supported`);return zn(e,t,9,i)}function c_(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ye} indefinite length items not allowed`);return zn(e,t,1,1/0)}function Eu(e,t){Pt(e,B.array.majorEncoded,t.value)}Eu.compareTokens=sn.compareTokens;Eu.encodedSize=function(t){return Pt.encodedSize(t.value)};function Kn(e,t,r,n){return new ee(B.map,n,r)}function f_(e,t,r,n){return Kn(e,t,1,r)}function l_(e,t,r,n){return Kn(e,t,2,tn(e,t+1,n))}function d_(e,t,r,n){return Kn(e,t,3,rn(e,t+1,n))}function p_(e,t,r,n){return Kn(e,t,5,nn(e,t+1,n))}function h_(e,t,r,n){let i=on(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer map lengths not supported`);return Kn(e,t,9,i)}function y_(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ye} indefinite length items not allowed`);return Kn(e,t,1,1/0)}function Iu(e,t){Pt(e,B.map.majorEncoded,t.value)}Iu.compareTokens=sn.compareTokens;Iu.encodedSize=function(t){return Pt.encodedSize(t.value)};function g_(e,t,r,n){return new ee(B.tag,r,1)}function m_(e,t,r,n){return new ee(B.tag,tn(e,t+1,n),2)}function b_(e,t,r,n){return new ee(B.tag,rn(e,t+1,n),3)}function v_(e,t,r,n){return new ee(B.tag,nn(e,t+1,n),5)}function __(e,t,r,n){return new ee(B.tag,on(e,t+1,n),9)}function xu(e,t){Pt(e,B.tag.majorEncoded,t.value)}xu.compareTokens=sn.compareTokens;xu.encodedSize=function(t){return Pt.encodedSize(t.value)};var w_=20,T_=21,A_=22,O_=23;function E_(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${ye} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ee(B.null,null,1):new ee(B.undefined,void 0,1)}function I_(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ye} indefinite length items not allowed`);return new ee(B.break,void 0,1)}function Su(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${ye} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${ye} Infinity values are not supported`)}return new ee(B.float,e,t)}function x_(e,t,r,n){return Su(Nu(e,t+1),3,n)}function S_(e,t,r,n){return Su(Ru(e,t+1),5,n)}function C_(e,t,r,n){return Su(Up(e,t+1),9,n)}function Cu(e,t,r){let n=t.value;if(n===!1)e.push([B.float.majorEncoded|w_]);else if(n===!0)e.push([B.float.majorEncoded|T_]);else if(n===null)e.push([B.float.majorEncoded|A_]);else if(n===void 0)e.push([B.float.majorEncoded|O_]);else{let i,o=!1;(!r||r.float64!==!0)&&($p(n),i=Nu(zt,1),n===i||Number.isNaN(n)?(zt[0]=249,e.push(zt.slice(0,3)),o=!0):(Pp(n),i=Ru(zt,1),n===i&&(zt[0]=250,e.push(zt.slice(0,5)),o=!0))),o||(N_(n),i=Up(zt,1),zt[0]=251,e.push(zt.slice(0,9)))}}Cu.encodedSize=function(t,r){let n=t.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){$p(n);let i=Nu(zt,1);if(n===i||Number.isNaN(n))return 3;if(Pp(n),i=Ru(zt,1),n===i)return 5}return 9};var Rp=new ArrayBuffer(9),Rt=new DataView(Rp,1),zt=new Uint8Array(Rp,0);function $p(e){if(e===1/0)Rt.setUint16(0,31744,!1);else if(e===-1/0)Rt.setUint16(0,64512,!1);else if(Number.isNaN(e))Rt.setUint16(0,32256,!1);else{Rt.setFloat32(0,e);let t=Rt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)Rt.setUint16(0,31744,!1);else if(r===0)Rt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?Rt.setUint16(0,0):i<-14?Rt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):Rt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function Nu(e,t){if(e.length-t<2)throw new Error(`${ye} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}function Pp(e){Rt.setFloat32(0,e,!1)}function Ru(e,t){if(e.length-t<4)throw new Error(`${ye} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function N_(e){Rt.setFloat64(0,e,!1)}function Up(e,t){if(e.length-t<8)throw new Error(`${ye} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}Cu.compareTokens=sn.compareTokens;function xe(e,t,r){throw new Error(`${ye} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function bs(e){return()=>{throw new Error(`${ye} ${e}`)}}var ce=[];for(let e=0;e<=23;e++)ce[e]=xe;ce[24]=Lv;ce[25]=kv;ce[26]=jv;ce[27]=Fv;ce[28]=xe;ce[29]=xe;ce[30]=xe;ce[31]=xe;for(let e=32;e<=55;e++)ce[e]=xe;ce[56]=Vv;ce[57]=zv;ce[58]=Kv;ce[59]=qv;ce[60]=xe;ce[61]=xe;ce[62]=xe;ce[63]=xe;for(let e=64;e<=87;e++)ce[e]=Gv;ce[88]=Wv;ce[89]=Hv;ce[90]=Jv;ce[91]=Xv;ce[92]=xe;ce[93]=xe;ce[94]=xe;ce[95]=bs("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ce[e]=Qv;ce[120]=Zv;ce[121]=e_;ce[122]=t_;ce[123]=r_;ce[124]=xe;ce[125]=xe;ce[126]=xe;ce[127]=bs("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ce[e]=i_;ce[152]=o_;ce[153]=s_;ce[154]=a_;ce[155]=u_;ce[156]=xe;ce[157]=xe;ce[158]=xe;ce[159]=c_;for(let e=160;e<=183;e++)ce[e]=f_;ce[184]=l_;ce[185]=d_;ce[186]=p_;ce[187]=h_;ce[188]=xe;ce[189]=xe;ce[190]=xe;ce[191]=y_;for(let e=192;e<=215;e++)ce[e]=g_;ce[216]=m_;ce[217]=b_;ce[218]=v_;ce[219]=__;ce[220]=xe;ce[221]=xe;ce[222]=xe;ce[223]=xe;for(let e=224;e<=243;e++)ce[e]=bs("simple values are not supported");ce[244]=xe;ce[245]=xe;ce[246]=xe;ce[247]=E_;ce[248]=bs("simple values are not supported");ce[249]=x_;ce[250]=S_;ce[251]=C_;ce[252]=xe;ce[253]=xe;ce[254]=xe;ce[255]=I_;var Zt=[];for(let e=0;e<24;e++)Zt[e]=new ee(B.uint,e,1);for(let e=-1;e>=-24;e--)Zt[31-e]=new ee(B.negint,e,1);Zt[64]=new ee(B.bytes,new Uint8Array(0),1);Zt[96]=new ee(B.string,"",1);Zt[128]=new ee(B.array,0,1);Zt[160]=new ee(B.map,0,1);Zt[244]=new ee(B.false,!1,1);Zt[245]=new ee(B.true,!0,1);Zt[246]=new ee(B.null,null,1);function $u(){let e=[];return e[B.uint.major]=sn,e[B.negint.major]=Ou,e[B.bytes.major]=ms,e[B.string.major]=n_,e[B.array.major]=Eu,e[B.map.major]=Iu,e[B.tag.major]=xu,e[B.float.major]=Cu,e}var j$=$u(),Xa=new Cp,yd=class Bp{constructor(t,r){this.obj=t,this.parent=r}includes(t){let r=this;do if(r.obj===t)return!0;while(r=r.parent);return!1}static createCheck(t,r){if(t&&t.includes(r))throw new Error(`${Qr} object contains circular references`);return new Bp(r,t)}},Ar={null:new ee(B.null,null),undefined:new ee(B.undefined,void 0),true:new ee(B.true,!0),false:new ee(B.false,!1),emptyArray:new ee(B.array,0),emptyMap:new ee(B.map,0)},xr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ee(B.float,e):e>=0?new ee(B.uint,e):new ee(B.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ee(B.uint,e):new ee(B.negint,e)},Uint8Array(e,t,r,n){return new ee(B.bytes,e)},string(e,t,r,n){return new ee(B.string,e)},boolean(e,t,r,n){return e?Ar.true:Ar.false},null(e,t,r,n){return Ar.null},undefined(e,t,r,n){return Ar.undefined},ArrayBuffer(e,t,r,n){return new ee(B.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ee(B.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Ar.emptyArray,new ee(B.break)]:Ar.emptyArray;n=yd.createCheck(n,e);let i=[],o=0;for(let s of e)i[o++]=qo(s,r,n);return r.addBreakTokens?[new ee(B.array,e.length),i,new ee(B.break)]:[new ee(B.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),s=i?e.size:o.length;if(!s)return r.addBreakTokens===!0?[Ar.emptyMap,new ee(B.break)]:Ar.emptyMap;n=yd.createCheck(n,e);let a=[],u=0;for(let c of o)a[u++]=[qo(c,r,n),qo(i?e.get(c):e[c],r,n)];return R_(a,r),r.addBreakTokens?[new ee(B.map,s),a,new ee(B.break)]:[new ee(B.map,s),a]}};xr.Map=xr.Object;xr.Buffer=xr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))xr[`${e}Array`]=xr.DataView;function qo(e,t={},r){let n=Sv(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||xr[n];if(typeof i=="function"){let s=i(e,n,t,r);if(s!=null)return s}let o=xr[n];if(!o)throw new Error(`${Qr} unsupported type: ${n}`);return o(e,n,t,r)}function R_(e,t){t.mapSorter&&e.sort(t.mapSorter)}function Dp(e,t,r,n){if(Array.isArray(t))for(let i of t)Dp(e,i,r,n);else r[t.type.major](e,t,n)}function $_(e,t,r){let n=qo(e,r);if(!Array.isArray(n)&&r.quickEncodeToken){let i=r.quickEncodeToken(n);if(i)return i;let o=t[n.type.major];if(o.encodedSize){let s=o.encodedSize(n,r),a=new Cp(s);if(o(a,n,r),a.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return wu(a.chunks[0])}}return Xa.reset(),Dp(Xa,n,t,r),Xa.toBytes(!0)}var P_={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},U_=class{constructor(e,t={}){this._pos=0,this.data=e,this.options=t}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let e=this.data[this._pos],t=Zt[e];if(t===void 0){let r=ce[e];if(!r)throw new Error(`${ye} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);let n=e&31;t=r(this.data,this._pos,n,this.options)}return this._pos+=t.encodedLength,t}},Ui=Symbol.for("DONE"),vs=Symbol.for("BREAK");function B_(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=Bi(t,r);if(o===vs){if(e.value===1/0)break;throw new Error(`${ye} got unexpected break to lengthed array`)}if(o===Ui)throw new Error(`${ye} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function D_(e,t,r){let n=r.useMaps===!0,i=n?void 0:{},o=n?new Map:void 0;for(let s=0;s<e.value;s++){let a=Bi(t,r);if(a===vs){if(e.value===1/0)break;throw new Error(`${ye} got unexpected break to lengthed map`)}if(a===Ui)throw new Error(`${ye} found map but not enough entries (got ${s} [no key], expected ${e.value})`);if(n!==!0&&typeof a!="string")throw new Error(`${ye} non-string keys not supported (got ${typeof a})`);if(r.rejectDuplicateMapKeys===!0&&(n&&o.has(a)||!n&&a in i))throw new Error(`${ye} found repeat map key "${a}"`);let u=Bi(t,r);if(u===Ui)throw new Error(`${ye} found map but not enough entries (got ${s} [no value], expected ${e.value})`);n?o.set(a,u):i[a]=u}return n?o:i}function Bi(e,t){if(e.done())return Ui;let r=e.next();if(r.type===B.break)return vs;if(r.type.terminal)return r.value;if(r.type===B.array)return B_(r,e,t);if(r.type===B.map)return D_(r,e,t);if(r.type===B.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Bi(e,t);return t.tags[r.value](n)}throw new Error(`${ye} tag not supported (${r.value})`)}throw new Error("unsupported")}function M_(e,t){if(!(e instanceof Uint8Array))throw new Error(`${ye} data to decode must be a Uint8Array`);t=Object.assign({},P_,t);let r=t.tokenizer||new U_(e,t),n=Bi(r,t);if(n===Ui)throw new Error(`${ye} did not find any content to decode`);if(n===vs)throw new Error(`${ye} got unexpected break`);return[n,e.subarray(r.pos())]}function Mp(e,t){let[r,n]=M_(e,t);if(n.length>0)throw new Error(`${ye} too many terminals, data makes no sense`);return r}var L_=class extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){let t=this.inRecursive[this.inRecursive.length-1];t&&(t.type===B.array&&(t.elements++,t.elements!==1&&e.push([44])),t.type===B.map&&(t.elements++,t.elements!==1&&(t.elements%2===1?e.push([44]):e.push([58]))))}[B.uint.major](e,t){this.prefix(e);let r=String(t.value),n=[];for(let i=0;i<r.length;i++)n[i]=r.charCodeAt(i);e.push(n)}[B.negint.major](e,t){this[B.uint.major](e,t)}[B.bytes.major](e,t){throw new Error(`${Qr} unsupported type: Uint8Array`)}[B.string.major](e,t){this.prefix(e);let r=xp(JSON.stringify(t.value));e.push(r.length>32?wu(r):r)}[B.array.major](e,t){this.prefix(e),this.inRecursive.push({type:B.array,elements:0}),e.push([91])}[B.map.major](e,t){this.prefix(e),this.inRecursive.push({type:B.map,elements:0}),e.push([123])}[B.tag.major](e,t){}[B.float.major](e,t){if(t.type.name==="break"){let o=this.inRecursive.pop();if(o){if(o.type===B.array)e.push([93]);else if(o.type===B.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(t.value===void 0)throw new Error(`${Qr} unsupported type: undefined`);if(this.prefix(e),t.type.name==="true"){e.push([116,114,117,101]);return}else if(t.type.name==="false"){e.push([102,97,108,115,101]);return}else if(t.type.name==="null"){e.push([110,117,108,108]);return}let r=String(t.value),n=[],i=!1;for(let o=0;o<r.length;o++)n[o]=r.charCodeAt(o),!i&&(n[o]===46||n[o]===101||n[o]===69)&&(i=!0);i||(n.push(46),n.push(48)),e.push(n)}};function k_(e,t){if(Array.isArray(e[0])||Array.isArray(t[0]))throw new Error(`${Qr} complex map keys are not supported`);let r=e[0],n=t[0];if(r.type!==B.string||n.type!==B.string)throw new Error(`${Qr} non-string map keys are not supported`);if(r<n)return-1;if(r>n)return 1;throw new Error(`${Qr} unexpected duplicate map keys, this is not supported`)}var j_={addBreakTokens:!0,mapSorter:k_};function F_(e,t){return t=Object.assign({},j_,t),$_(e,new L_,t)}var Lp=class{constructor(e,t={}){this._pos=0,this.data=e,this.options=t,this.modeStack=["value"],this.lastToken=""}pos(){return this._pos}done(){return this._pos>=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<e.length)throw new Error(`${ye} unexpected end of input at position ${this._pos}`);for(let t=0;t<e.length;t++)if(this.data[this._pos++]!==e[t])throw new Error(`${ye} unexpected token at position ${this._pos}, expected to find '${String.fromCharCode(...e)}'`)}parseNumber(){let e=this._pos,t=!1,r=!1,n=s=>{for(;!this.done();){let a=this.ch();if(s.includes(a))this._pos++;else break}};if(this.ch()===45&&(t=!0,this._pos++),this.ch()===48)if(this._pos++,this.ch()===46)this._pos++,r=!0;else return new ee(B.uint,0,this._pos-e);if(n([48,49,50,51,52,53,54,55,56,57]),t&&this._pos===e+1)throw new Error(`${ye} unexpected token at position ${this._pos}`);if(!this.done()&&this.ch()===46){if(r)throw new Error(`${ye} unexpected token at position ${this._pos}`);r=!0,this._pos++,n([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++,n([48,49,50,51,52,53,54,55,56,57]));let i=String.fromCharCode.apply(null,this.data.subarray(e,this._pos)),o=parseFloat(i);return r?new ee(B.float,o,this._pos-e):this.options.allowBigInt!==!0||Number.isSafeInteger(o)?new ee(o>=0?B.uint:B.negint,o,this._pos-e):new ee(o>=0?B.uint:B.negint,BigInt(i),this._pos-e)}parseString(){if(this.ch()!==34)throw new Error(`${ye} unexpected character at position ${this._pos}; this shouldn't happen`);this._pos++;for(let i=this._pos,o=0;i<this.data.length&&o<65536;i++,o++){let s=this.data[i];if(s===92||s<32||s>=128)break;if(s===34){let a=String.fromCharCode.apply(null,this.data.subarray(this._pos,i));return this._pos=i+1,new ee(B.string,a,o)}}let e=this._pos,t=[],r=()=>{if(this._pos+4>=this.data.length)throw new Error(`${ye} unexpected end of unicode escape sequence at position ${this._pos}`);let i=0;for(let o=0;o<4;o++){let s=this.ch();if(s>=48&&s<=57)s-=48;else if(s>=97&&s<=102)s=s-97+10;else if(s>=65&&s<=70)s=s-65+10;else throw new Error(`${ye} unexpected unicode escape character at position ${this._pos}`);i=i*16+s,this._pos++}return i},n=()=>{let i=this.ch(),o=null,s=i>239?4:i>223?3:i>191?2:1;if(this._pos+s>this.data.length)throw new Error(`${ye} unexpected unicode sequence at position ${this._pos}`);let a,u,c,l;switch(s){case 1:i<128&&(o=i);break;case 2:a=this.data[this._pos+1],(a&192)===128&&(l=(i&31)<<6|a&63,l>127&&(o=l));break;case 3:a=this.data[this._pos+1],u=this.data[this._pos+2],(a&192)===128&&(u&192)===128&&(l=(i&15)<<12|(a&63)<<6|u&63,l>2047&&(l<55296||l>57343)&&(o=l));break;case 4:a=this.data[this._pos+1],u=this.data[this._pos+2],c=this.data[this._pos+3],(a&192)===128&&(u&192)===128&&(c&192)===128&&(l=(i&15)<<18|(a&63)<<12|(u&63)<<6|c&63,l>65535&&l<1114112&&(o=l))}o===null?(o=65533,s=1):o>65535&&(o-=65536,t.push(o>>>10&1023|55296),o=56320|o&1023),t.push(o),this._pos+=s};for(;!this.done();){let i=this.ch(),o;switch(i){case 92:if(this._pos++,this.done())throw new Error(`${ye} unexpected string termination at position ${this._pos}`);switch(o=this.ch(),this._pos++,o){case 34:case 39:case 92:case 47:t.push(o);break;case 98:t.push(8);break;case 116:t.push(9);break;case 110:t.push(10);break;case 102:t.push(12);break;case 114:t.push(13);break;case 117:t.push(r());break;default:throw new Error(`${ye} unexpected string escape character at position ${this._pos}`)}break;case 34:return this._pos++,new ee(B.string,Sp(t),this._pos-e);default:if(i<32)throw new Error(`${ye} invalid control character at position ${this._pos}`);i<128?(t.push(i),this._pos++):n()}}throw new Error(`${ye} unexpected end of string at position ${this._pos}`)}parseValue(){switch(this.ch()){case 123:return this.modeStack.push("obj-start"),this._pos++,new ee(B.map,1/0,1);case 91:return this.modeStack.push("array-start"),this._pos++,new ee(B.array,1/0,1);case 34:return this.parseString();case 110:return this.expect([110,117,108,108]),new ee(B.null,null,4);case 102:return this.expect([102,97,108,115,101]),new ee(B.false,!1,5);case 116:return this.expect([116,114,117,101]),new ee(B.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(`${ye} 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 ee(B.break,void 0,1);if(this.ch()!==44)throw new Error(`${ye} 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 ee(B.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 ee(B.break,void 0,1);if(this.ch()!==44)throw new Error(`${ye} 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 ee(B.break,void 0,1);let e=this.parseString();if(this.skipWhitespace(),this.ch()!==58)throw new Error(`${ye} 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(`${ye} unexpected parse state at position ${this._pos}; this shouldn't happen`)}}};function V_(e,t){return t=Object.assign({tokenizer:new Lp(e,t)},t),Mp(e,t)}var F$=new Uint8Array(0);function z_(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function Pu(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}function K_(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(r[s]!==255)throw new TypeError(o+" is ambiguous");r[s]=i}var a=e.length,u=e.charAt(0),c=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function p(E){if(E instanceof Uint8Array||(ArrayBuffer.isView(E)?E=new Uint8Array(E.buffer,E.byteOffset,E.byteLength):Array.isArray(E)&&(E=Uint8Array.from(E))),!(E instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(E.length===0)return"";for(var z=0,W=0,T=0,k=E.length;T!==k&&E[T]===0;)T++,z++;for(var G=(k-T)*l+1>>>0,H=new Uint8Array(G);T!==k;){for(var F=E[T],Y=0,V=G-1;(F!==0||Y<W)&&V!==-1;V--,Y++)F+=256*H[V]>>>0,H[V]=F%a>>>0,F=F/a>>>0;if(F!==0)throw new Error("Non-zero carry");W=Y,T++}for(var ae=G-W;ae!==G&&H[ae]===0;)ae++;for(var L=u.repeat(z);ae<G;++ae)L+=e.charAt(H[ae]);return L}function S(E){if(typeof E!="string")throw new TypeError("Expected String");if(E.length===0)return new Uint8Array;var z=0;if(E[z]!==" "){for(var W=0,T=0;E[z]===u;)W++,z++;for(var k=(E.length-z)*c+1>>>0,G=new Uint8Array(k);E[z];){var H=r[E.charCodeAt(z)];if(H===255)return;for(var F=0,Y=k-1;(H!==0||F<T)&&Y!==-1;Y--,F++)H+=a*G[Y]>>>0,G[Y]=H%256>>>0,H=H/256>>>0;if(H!==0)throw new Error("Non-zero carry");T=F,z++}if(E[z]!==" "){for(var V=k-T;V!==k&&G[V]===0;)V++;for(var ae=new Uint8Array(W+(k-V)),L=W;V!==k;)ae[L++]=G[V++];return ae}}}function x(E){var z=S(E);if(z)return z;throw new Error(`Non-${t} character`)}return{encode:p,decodeUnsafe:S,decode:x}}var q_=K_,G_=q_,W_=G_,H_=class{name;prefix;baseEncode;constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},J_=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,r){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return kp(this,e)}},X_=class{decoders;constructor(e){this.decoders=e}or(e){return kp(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r!=null)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function kp(e,t){return new X_({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Y_=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new H_(e,t,r),this.decoder=new J_(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function jp({name:e,prefix:t,encode:r,decode:n}){return new Y_(e,t,r,n)}function _s({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=W_(r,e);return jp({prefix:t,name:e,encode:n,decode:o=>Pu(i(o))})}function Q_(e,t,r,n){let i={};for(let l=0;l<t.length;++l)i[t[l]]=l;let o=e.length;for(;e[o-1]==="=";)--o;let s=new Uint8Array(o*r/8|0),a=0,u=0,c=0;for(let l=0;l<o;++l){let p=i[e[l]];if(p===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|p,a+=r,a>=8&&(a-=8,s[c++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return s}function Z_(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let u=0;u<e.length;++u)for(a=a<<8|e[u],s+=8;s>r;)s-=r,o+=t[i&a>>s];if(s!==0&&(o+=t[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o}function gt({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return jp({prefix:t,name:e,encode(i){return Z_(i,n,r)},decode(i){return Q_(i,n,r,e)}})}var Go=gt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),V$=gt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),z$=gt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),K$=gt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),q$=gt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),G$=gt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),W$=gt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),H$=gt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),J$=gt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Ir=_s({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),X$=_s({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Fp={};Wa(Fp,{Digest:()=>ws,create:()=>rs,decode:()=>Uu,equals:()=>zp});var ew=Vp,gd=128,tw=127,rw=~tw,nw=Math.pow(2,31);function Vp(e,t,r){t=t||[],r=r||0;for(var n=r;e>=nw;)t[r++]=e&255|gd,e/=128;for(;e&rw;)t[r++]=e&255|gd,e>>>=7;return t[r]=e|0,Vp.bytes=r-n+1,t}var iw=su,ow=128,md=127;function su(e,n){var r=0,n=n||0,i=0,o=n,s,a=e.length;do{if(o>=a)throw su.bytes=0,new RangeError("Could not decode varint");s=e[o++],r+=i<28?(s&md)<<i:(s&md)*Math.pow(2,i),i+=7}while(s>=ow);return su.bytes=o-n,r}var sw=Math.pow(2,7),aw=Math.pow(2,14),uw=Math.pow(2,21),cw=Math.pow(2,28),fw=Math.pow(2,35),lw=Math.pow(2,42),dw=Math.pow(2,49),pw=Math.pow(2,56),hw=Math.pow(2,63),yw=function(e){return e<sw?1:e<aw?2:e<uw?3:e<cw?4:e<fw?5:e<lw?6:e<dw?7:e<pw?8:e<hw?9:10},gw={encode:ew,decode:iw,encodingLength:yw},mw=gw,Zo=mw;function au(e,t=0){return[Zo.decode(e,t),Zo.decode.bytes]}function es(e,t,r=0){return Zo.encode(e,t,r),t}function ts(e){return Zo.encodingLength(e)}function rs(e,t){let r=t.byteLength,n=ts(e),i=n+ts(r),o=new Uint8Array(i+r);return es(e,o,0),es(r,o,n),o.set(t,i),new ws(e,r,t,o)}function Uu(e){let t=Pu(e),[r,n]=au(t),[i,o]=au(t.subarray(n)),s=t.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new ws(r,i,s,t)}function zp(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&z_(e.bytes,r.bytes)}}var ws=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function bd(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return vw(r,uu(e),t??Ir.encoder);default:return _w(r,uu(e),t??Go.encoder)}}var vd=new WeakMap;function uu(e){let t=vd.get(e);if(t==null){let r=new Map;return vd.set(e,r),r}return t}var $t=class et{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==Ci)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==ww)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return et.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:r}=this.multihash,n=rs(t,r);return et.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return et.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&zp(t.multihash,n.multihash)}toString(t){return bd(this,t)}toJSON(){return{"/":bd(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof et)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new et(n,i,o,s??_d(n,i,o.bytes))}else if(r[Tw]===!0){let{version:n,multihash:i,code:o}=r,s=Uu(i);return et.create(n,o,s)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==Ci)throw new Error(`Version 0 CID must use dag-pb (code: ${Ci}) block encoding`);return new et(t,r,n,n.bytes)}case 1:{let i=_d(t,r,n.bytes);return new et(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return et.create(0,Ci,t)}static createV1(t,r){return et.create(1,t,r)}static decode(t){let[r,n]=et.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=et.inspectBytes(t),n=r.size-r.multihashSize,i=Pu(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new ws(r.multihashCode,r.digestSize,o,i);return[r.version===0?et.createV0(s):et.createV1(r.codec,s),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[p,S]=au(t.subarray(r));return r+=S,p},i=n(),o=Ci;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),u=n(),c=r+u,l=c-s;return{version:i,codec:o,multihashCode:a,digestSize:u,multihashSize:l,size:c}}static parse(t,r){let[n,i]=bw(t,r),o=et.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return uu(o).set(n,t),o}};function bw(e,t){switch(e[0]){case"Q":{let r=t??Ir;return[Ir.prefix,r.decode(`${Ir.prefix}${e}`)]}case Ir.prefix:{let r=t??Ir;return[Ir.prefix,r.decode(e)]}case Go.prefix:{let r=t??Go;return[Go.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function vw(e,t,r){let{prefix:n}=r;if(n!==Ir.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let o=r.encode(e).slice(1);return t.set(n,o),o}else return i}function _w(e,t,r){let{prefix:n}=r,i=t.get(n);if(i==null){let o=r.encode(e);return t.set(n,o),o}else return i}var Ci=112,ww=18;function _d(e,t,r){let n=ts(e),i=n+ts(t),o=new Uint8Array(i+r.byteLength);return es(e,o,0),es(t,o,n),o.set(r,i),o}var Tw=Symbol.for("@ipld/js-cid/CID");function Kp({name:e,code:t,encode:r}){return new Aw(e,t,r)}var Aw=class{name;code;encode;constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?rs(this.code,t):t.then(r=>rs(this.code,r))}else throw Error("Unknown type, must be binary type")}},qp=gt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Y$=gt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Q$=gt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Z$=gt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function Ow(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=$t.asCID(e);if(!t)return null;let r=t.toString();return[new ee(B.map,1/0,1),new ee(B.string,"/",1),new ee(B.string,r,r.length),new ee(B.break,void 0,1)]}function ns(e){let t=qp.encode(e).slice(1);return[new ee(B.map,1/0,1),new ee(B.string,"/",1),new ee(B.map,1/0,1),new ee(B.string,"bytes",5),new ee(B.string,t,t.length),new ee(B.break,void 0,1),new ee(B.break,void 0,1)]}function Vt(e){return ns(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function Ew(e){return ns(new Uint8Array(e))}function Iw(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function xw(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}var Sw={typeEncoders:{Object:Ow,Buffer:ns,Uint8Array:ns,Int8Array:Vt,Uint16Array:Vt,Int16Array:Vt,Uint32Array:Vt,Int32Array:Vt,Float32Array:Vt,Float64Array:Vt,Uint8ClampedArray:Vt,BigInt64Array:Vt,BigUint64Array:Vt,DataView:Vt,ArrayBuffer:Ew,undefined:Iw,number:xw}},Cw=class extends Lp{constructor(e,t){super(e,t),this.tokenBuffer=[]}done(){return this.tokenBuffer.length===0&&super.done()}_next(){return this.tokenBuffer.length>0?this.tokenBuffer.pop():super.next()}next(){let e=this._next();if(e.type===B.map){let t=this._next();if(t.type===B.string&&t.value==="/"){let r=this._next();if(r.type===B.string){if(this._next().type!==B.break)throw new Error("Invalid encoded CID form");return this.tokenBuffer.push(r),new ee(B.tag,42,0)}if(r.type===B.map){let n=this._next();if(n.type===B.string&&n.value==="bytes"){let i=this._next();if(i.type===B.string){for(let s=0;s<2;s++)if(this._next().type!==B.break)throw new Error("Invalid encoded Bytes form");let o=qp.decode(`m${i.value}`);return new ee(B.bytes,o,i.value.length)}this.tokenBuffer.push(i)}this.tokenBuffer.push(n)}this.tokenBuffer.push(r)}this.tokenBuffer.push(t)}return e}},cu={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};cu.tags[42]=$t.parse;var Nw="dag-json",Gp=297,Bu=e=>F_(e,Sw),Ts=e=>{let t=Object.assign(cu,{tokenizer:new Cw(e,cu)});return V_(e,t)},wd=e=>Rw.decode(Bu(e)),Rw=new TextDecoder,$w=e=>Ts(Pw.encode(e)),Pw=new TextEncoder;function Uw(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Bw(e,...t){if(!Uw(e))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function Td(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Dw(e,t){Bw(e);let r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}function Mw(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}var Ya=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Xt=(e,t)=>e<<32-t|e>>>t,Lw=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Lw)throw new Error("Non little-endian hardware is not supported");function kw(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Wp(e){if(typeof e=="string"&&(e=kw(e)),!Mw(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}var jw=class{clone(){return this._cloneInto()}},eP={}.toString;function Fw(e){let t=n=>e().update(Wp(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Vw(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),u=n?4:0,c=n?0:4;e.setUint32(t+u,s,n),e.setUint32(t+c,a,n)}var zw=class extends jw{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Ya(this.buffer)}update(e){Td(this);let{view:t,buffer:r,blockLen:n}=this;e=Wp(e);let i=e.length;for(let o=0;o<i;){let s=Math.min(n-this.pos,i-o);if(s===n){let a=Ya(e);for(;n<=i-o;o+=n)this.process(a,o);continue}r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Td(this),Dw(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let l=o;l<n;l++)t[l]=0;Vw(r,n-8,BigInt(this.length*8),i),this.process(r,0);let s=Ya(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let u=a/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<u;l++)s.setUint32(4*l,c[l],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return e.length=n,e.pos=s,e.finished=i,e.destroyed=o,n%t&&e.buffer.set(r),e}},Kw=(e,t,r)=>e&t^~e&r,qw=(e,t,r)=>e&t^e&r^t&r,Gw=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Or=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Er=new Uint32Array(64),Ww=class extends zw{constructor(){super(64,32,8,!1),this.A=Or[0]|0,this.B=Or[1]|0,this.C=Or[2]|0,this.D=Or[3]|0,this.E=Or[4]|0,this.F=Or[5]|0,this.G=Or[6]|0,this.H=Or[7]|0}get(){let{A:e,B:t,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[e,t,r,n,i,o,s,a]}set(e,t,r,n,i,o,s,a){this.A=e|0,this.B=t|0,this.C=r|0,this.D=n|0,this.E=i|0,this.F=o|0,this.G=s|0,this.H=a|0}process(e,t){for(let l=0;l<16;l++,t+=4)Er[l]=e.getUint32(t,!1);for(let l=16;l<64;l++){let p=Er[l-15],S=Er[l-2],x=Xt(p,7)^Xt(p,18)^p>>>3,E=Xt(S,17)^Xt(S,19)^S>>>10;Er[l]=E+Er[l-7]+x+Er[l-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let l=0;l<64;l++){let p=Xt(s,6)^Xt(s,11)^Xt(s,25),S=c+p+Kw(s,a,u)+Gw[l]+Er[l]|0,E=(Xt(r,2)^Xt(r,13)^Xt(r,22))+qw(r,n,i)|0;c=u,u=a,a=s,s=o+S|0,o=i,i=n,n=r,r=S+E|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(r,n,i,o,s,a,u,c)}roundClean(){Er.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},Hw=Fw(()=>new Ww);var We=Nt(ur(),1),Hp=Nt(bv(),1),fu=e=>We.Type.Union([e,We.Type.Null()]);var Jp=/^(k51qz|baguq)[0-9a-z]{56,57}$/,Jw=/^[0-9A-Fa-f]{7,8}$/g;We.FormatRegistry.Set("EntityID",e=>!!e.match(Jw)||!!e.match(Jp));var Xp=We.Type.String(),As=e=>e?.enc instanceof Uint8Array;We.FormatRegistry.Set("CID",e=>!!e.match(Jp));var Du=We.Type.String({format:"CID"}),Xw=/^http([s]?):\/\/.*\..*/;We.FormatRegistry.Set("URL",e=>!!e.match(Xw));var Yw=We.Type.String({format:"URL"}),Mu=We.Type.Object({en:Xp,at:We.Type.String(),vl:fu(We.Type.Union([We.Type.String(),We.Type.Boolean(),We.Type.Number()])),ts:We.Type.String(),ag:We.Type.String(),pv:fu(Du)}),lu=Hp.TypeCompiler.Compile(Mu);var Qw=lu.Check.bind(lu),Yp=We.Type.Composite([We.Type.Object({cid:Du}),Mu]),is=Hp.TypeCompiler.Compile(Yp),Qp=e=>Array.from(is.Errors(e)),Lu=is.Check.bind(is),Zw=_s({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),tP=_s({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});function Zp(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var e0=Kp({name:"sha2-256",code:18,encode:Zp("SHA-256")}),rP=Kp({name:"sha2-512",code:19,encode:Zp("SHA-512")}),{WARN:Ad,LOG:nP,DEBUG:t0,VERBOSE:os,ERROR:r0}=$e.setup($e.INFO),eh=114;function ku(e,t=["cid"]){if(!e)throw r0("falsy log",e);let r=e.cid;if(As(e))return r||(r=Os(ju(e).bytes).toString()),Ad("preparing an encrypted applog - really?"),{log:e,cid:r};let n={};for(let[i,o]of Object.entries(e))o===void 0&&(Ad(`log.${i} is undefined, which is not allowed - encoding as null`,e),o=null),t.includes(i)?os("excluding app log",{key:i,val:o}):n[i]=o;return{log:n,cid:r}}function th(e){return Os(rh(e).bytes)}function rh(e){return ju(ku(e)?.log)}function Os(e){let t=Hw(e),r=Fp.create(e0.code,t),n=$t.create(1,Gp,r);return os("[getCidSync]",{bytes:e,hash:t,digest:r,cid:n}),n}function ju(e){t0("[encodeBlock]",e);let t=Bu(e);return{bytes:t,cid:Os(t)}}function Fu(e){let t=null,r=[];try{t=$t.parse(e)}catch(n){os("[retrieveThread] couldn't parse pubID with default base"),r.push(n)}if(!t)try{t=$t.parse(e,Zw)}catch(n){os("[retrieveThread] couldn't parse pubID with base36"),r.push(n)}return{cid:t,errors:t?null:r,isIpns:t&&nh(t)}}function nh(e){return e.code===eh}function du(e){return typeof e=="string"?$t.parse(e):typeof e.toV1!="function"?$t.decode(e.bytes):e}function Es(e,t){if(!e||!t)throw new Error(`[areCidsEqual] invalid params: ${e}, ${t}`);if(e===t)return!0;let r=du(e),n=du(t);return r.toV1().toString()===n.toV1().toString()}function Vu(e,t){return e instanceof Set?e.has(typeof t=="string"?t:t.toV1().toString()):e.some(r=>Es(r,t))}function Od(e){let t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function n0(e,t){let r=Od(e),n=Od(t);return+r<+n}var i0=typeof global=="object"&&global&&global.Object===Object&&global,ih=i0,o0=typeof self=="object"&&self&&self.Object===Object&&self,s0=ih||o0||Function("return this")(),mt=s0,a0=mt.Symbol,Qt=a0,oh=Object.prototype,u0=oh.hasOwnProperty,c0=oh.toString,Ni=Qt?Qt.toStringTag:void 0;function f0(e){var t=u0.call(e,Ni),r=e[Ni];try{e[Ni]=void 0;var n=!0}catch{}var i=c0.call(e);return n&&(t?e[Ni]=r:delete e[Ni]),i}var l0=f0,d0=Object.prototype,p0=d0.toString;function h0(e){return p0.call(e)}var y0=h0,g0="[object Null]",m0="[object Undefined]",Ed=Qt?Qt.toStringTag:void 0;function b0(e){return e==null?e===void 0?m0:g0:Ed&&Ed in Object(e)?l0(e):y0(e)}var qn=b0;function v0(e){return e!=null&&typeof e=="object"}var en=v0,_0="[object Symbol]";function w0(e){return typeof e=="symbol"||en(e)&&qn(e)==_0}var Ln=w0;function T0(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var A0=T0,O0=Array.isArray,Kt=O0,E0=1/0,Id=Qt?Qt.prototype:void 0,xd=Id?Id.toString:void 0;function sh(e){if(typeof e=="string")return e;if(Kt(e))return A0(e,sh)+"";if(Ln(e))return xd?xd.call(e):"";var t=e+"";return t=="0"&&1/e==-E0?"-0":t}var I0=sh,x0=/\s/;function S0(e){for(var t=e.length;t--&&x0.test(e.charAt(t)););return t}var C0=S0,N0=/^\s+/;function R0(e){return e&&e.slice(0,C0(e)+1).replace(N0,"")}var $0=R0;function P0(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var cr=P0,Sd=NaN,U0=/^[-+]0x[0-9a-f]+$/i,B0=/^0b[01]+$/i,D0=/^0o[0-7]+$/i,M0=parseInt;function L0(e){if(typeof e=="number")return e;if(Ln(e))return Sd;if(cr(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=cr(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=$0(e);var r=B0.test(e);return r||D0.test(e)?M0(e.slice(2),r?2:8):U0.test(e)?Sd:+e}var k0=L0,Cd=1/0,j0=17976931348623157e292;function F0(e){if(!e)return e===0?e:0;if(e=k0(e),e===Cd||e===-Cd){var t=e<0?-1:1;return t*j0}return e===e?e:0}var V0=F0;function z0(e){var t=V0(e),r=t%1;return t===t?r?t-r:t:0}var Nd=z0;function K0(e){return e}var Is=K0,q0="[object AsyncFunction]",G0="[object Function]",W0="[object GeneratorFunction]",H0="[object Proxy]";function J0(e){if(!cr(e))return!1;var t=qn(e);return t==G0||t==W0||t==q0||t==H0}var ah=J0,X0=mt["__core-js_shared__"],Qa=X0,Rd=function(){var e=/[^.]+$/.exec(Qa&&Qa.keys&&Qa.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Y0(e){return!!Rd&&Rd in e}var Q0=Y0,Z0=Function.prototype,eT=Z0.toString;function tT(e){if(e!=null){try{return eT.call(e)}catch{}try{return e+""}catch{}}return""}var an=tT,rT=/[\\^$.*+?()[\]{}|]/g,nT=/^\[object .+?Constructor\]$/,iT=Function.prototype,oT=Object.prototype,sT=iT.toString,aT=oT.hasOwnProperty,uT=RegExp("^"+sT.call(aT).replace(rT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function cT(e){if(!cr(e)||Q0(e))return!1;var t=ah(e)?uT:nT;return t.test(an(e))}var fT=cT;function lT(e,t){return e?.[t]}var dT=lT;function pT(e,t){var r=dT(e,t);return fT(r)?r:void 0}var un=pT,hT=un(mt,"WeakMap"),Di=hT,yT=Di&&new Di,ss=yT,gT=ss?function(e,t){return ss.set(e,t),e}:Is,uh=gT,$d=Object.create,mT=function(){function e(){}return function(t){if(!cr(t))return{};if($d)return $d(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),zu=mT;function bT(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=zu(e.prototype),n=e.apply(r,t);return cr(n)?n:r}}var Mi=bT,vT=1;function _T(e,t,r){var n=t&vT,i=Mi(e);function o(){var s=this&&this!==mt&&this instanceof o?i:e;return s.apply(n?r:this,arguments)}return o}var wT=_T;function TT(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var Ku=TT,AT=Math.max;function OT(e,t,r,n){for(var i=-1,o=e.length,s=r.length,a=-1,u=t.length,c=AT(o-s,0),l=Array(u+c),p=!n;++a<u;)l[a]=t[a];for(;++i<s;)(p||i<o)&&(l[r[i]]=e[i]);for(;c--;)l[a++]=e[i++];return l}var ch=OT,ET=Math.max;function IT(e,t,r,n){for(var i=-1,o=e.length,s=-1,a=r.length,u=-1,c=t.length,l=ET(o-a,0),p=Array(l+c),S=!n;++i<l;)p[i]=e[i];for(var x=i;++u<c;)p[x+u]=t[u];for(;++s<a;)(S||i<o)&&(p[x+r[s]]=e[i++]);return p}var fh=IT;function xT(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}var ST=xT;function CT(){}var qu=CT,NT=4294967295;function as(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=NT,this.__views__=[]}as.prototype=zu(qu.prototype);as.prototype.constructor=as;var Gu=as;function RT(){}var lh=RT,$T=ss?function(e){return ss.get(e)}:lh,dh=$T,PT={},Pd=PT,UT=Object.prototype,BT=UT.hasOwnProperty;function DT(e){for(var t=e.name+"",r=Pd[t],n=BT.call(Pd,t)?r.length:0;n--;){var i=r[n],o=i.func;if(o==null||o==e)return i.name}return t}var MT=DT;function us(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}us.prototype=zu(qu.prototype);us.prototype.constructor=us;var pu=us;function LT(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var ph=LT;function kT(e){if(e instanceof Gu)return e.clone();var t=new pu(e.__wrapped__,e.__chain__);return t.__actions__=ph(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var jT=kT,FT=Object.prototype,VT=FT.hasOwnProperty;function cs(e){if(en(e)&&!Kt(e)&&!(e instanceof Gu)){if(e instanceof pu)return e;if(VT.call(e,"__wrapped__"))return jT(e)}return new pu(e)}cs.prototype=qu.prototype;cs.prototype.constructor=cs;var zT=cs;function KT(e){var t=MT(e),r=zT[t];if(typeof r!="function"||!(t in Gu.prototype))return!1;if(e===r)return!0;var n=dh(r);return!!n&&e===n[0]}var qT=KT,GT=800,WT=16,HT=Date.now;function JT(e){var t=0,r=0;return function(){var n=HT(),i=WT-(n-r);if(r=n,i>0){if(++t>=GT)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var hh=JT,XT=hh(uh),yh=XT,YT=/\{\n\/\* \[wrapped with (.+)\] \*/,QT=/,? & /;function ZT(e){var t=e.match(YT);return t?t[1].split(QT):[]}var eA=ZT,tA=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function rA(e,t){var r=t.length;if(!r)return e;var n=r-1;return t[n]=(r>1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(tA,`{
59
+ `+" ".repeat(t)+o):o==="{"&&n>0?(n++,r+=o):(o==="}"&&n>1&&n--,r+=o)}return r}var{WARN:ld,LOG:L$,DEBUG:Ev,VERBOSE:k$,ERROR:Jr}=$e.setup($e.INFO,{prefix:"[thread]"});function Yt(e){return e.init!==void 0}var ms=class{constructor(e,t,r,n=[],i={}){this.name=e,this._applogs=n,this.parents=t===null?null:fd(t),this.filters=r,Re(()=>this.parents?.length===0)&&ld("[Thread] empty parents array",e),i.skipObservable||Tr(this,{applogsCids:Me,applogsByCid:Me,insert:st,size:Me,isEmpty:Me,firstLog:Me,latestLog:Me},{name:`Thread{${e}}`})}filters;parents;_subscribers=[];get readOnly(){return this.parents.length!==1?!0:this.parents[0].readOnly}insert(e){if(this.readOnly)throw Jr("[Thread] insert() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw Jr("[Thread] insert() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw Jr("[Thread] insert() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insert(e)}insertRaw(e){if(this.readOnly)throw Jr("[Thread] insertRaw() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw Jr("[Thread] insertRaw() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw Jr("[Thread] insertRaw() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insertRaw(e)}subscribe(e){return this._subscribers.push(e),this.unsubscribe.bind(this,e)}unsubscribe(e){let t=this._subscribers.indexOf(e);t!==-1?this._subscribers.splice(t,1):ld("unsubscribe called for non-existent",e)}notifySubscribers(e){Ev(`[thread: ${this.name}] notifying`,this._subscribers.length,"subscribers of",{...e,subs:this._subscribers});for(let t of this._subscribers)t(e)}get applogs(){return this._applogs}get applogsCids(){return this._applogs.map(e=>e.cid)}map(e){return this.applogs.map(e)}get findLast(){return this.applogs.findLast.bind(this.applogs)}get findFirst(){return this.applogs.find.bind(this.applogs)}get firstLog(){return this.applogs[0]}get latestLog(){return this.applogs[this.applogs.length-1]}hasApplog(e,t){if(t)return this.applogs.includes(e);if(!e.cid)throw Jr("[hasApplogs] applog without CID:",e);return this.hasApplogCid(e.cid)}hasApplogCid(e){return this.applogsCids.includes(e.toString())}get applogsByCid(){return new Map(this.applogs.map(e=>[e.cid,e]))}getApplog(e){return this.applogsByCid.get(e.toString())}hasApplogWithDiffTs(e){return this.applogs.find(t=>t.en===e.en&&t.at===e.at&&t.vl===e.vl&&t.ag===e.ag)}get isEmpty(){return this.size===0}get size(){return this.applogs.length}get length(){return this.applogs.length}get untrackedSize(){return Re(()=>this.size)}get nameAndSizeUntracked(){return Re(()=>`${this.name} (${this.size})`)}get prettyName(){return Ov(this.name)}get hasParents(){return!!this.parents?.length}};var _u=class Ep extends ms{static fromArray(t,r){return new Ep(r||"static",null,[],t)}constructor(t,r,n,i){super(t,r,n,i,{skipObservable:!0})}get readOnly(){return!0}},Ip={};Wa(Ip,{code:()=>Gp,decode:()=>As,encode:()=>Bu,format:()=>wd,name:()=>Nw,parse:()=>$w,stringify:()=>wd});var Iv=["string","number","bigint","symbol"],xv=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function Sv(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(Iv.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(Cv(e))return"Buffer";let r=Nv(e);return r||"Object"}function Cv(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function Nv(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(xv.includes(t))return t}var B=class{constructor(e,t,r){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=r}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}};B.uint=new B(0,"uint",!0);B.negint=new B(1,"negint",!0);B.bytes=new B(2,"bytes",!0);B.string=new B(3,"string",!0);B.array=new B(4,"array",!1);B.map=new B(5,"map",!1);B.tag=new B(6,"tag",!1);B.float=new B(7,"float",!0);B.false=new B(7,"false",!0);B.true=new B(7,"true",!0);B.null=new B(7,"null",!0);B.undefined=new B(7,"undefined",!0);B.break=new B(7,"break",!0);var ee=class{constructor(e,t,r){this.type=e,this.value=t,this.encodedLength=r,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}},Fn=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Rv=new TextDecoder,$v=new TextEncoder;function Qo(e){return Fn&&globalThis.Buffer.isBuffer(e)}function wu(e){return e instanceof Uint8Array?Qo(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Pv=Fn?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):pd(e,t,r):(e,t,r)=>r-t>64?Rv.decode(e.subarray(t,r)):pd(e,t,r),xp=Fn?e=>e.length>64?globalThis.Buffer.from(e):dd(e):e=>e.length>64?$v.encode(e):dd(e);var Tu=Fn?(e,t,r)=>Qo(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Uv=Fn?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),wu(globalThis.Buffer.concat(e,t))):(e,t)=>{let r=new Uint8Array(t),n=0;for(let i of e)n+i.length>r.length&&(i=i.subarray(0,r.length-n)),r.set(i,n),n+=i.length;return r},Bv=Fn?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Dv(e,t){if(Qo(e)&&Qo(t))return e.compare(t);for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}function dd(e){let t=[],r=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=i&63|128):(i&64512)===55296&&n+1<e.length&&(e.charCodeAt(n+1)&64512)===56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++n)&1023),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=i&63|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=i&63|128)}return t}function pd(e,t,r){let n=[];for(;t<r;){let i=e[t],o=null,s=i>239?4:i>223?3:i>191?2:1;if(t+s<=r){let a,u,c,l;switch(s){case 1:i<128&&(o=i);break;case 2:a=e[t+1],(a&192)===128&&(l=(i&31)<<6|a&63,l>127&&(o=l));break;case 3:a=e[t+1],u=e[t+2],(a&192)===128&&(u&192)===128&&(l=(i&15)<<12|(a&63)<<6|u&63,l>2047&&(l<55296||l>57343)&&(o=l));break;case 4:a=e[t+1],u=e[t+2],c=e[t+3],(a&192)===128&&(u&192)===128&&(c&192)===128&&(l=(i&15)<<18|(a&63)<<12|(u&63)<<6|c&63,l>65535&&l<1114112&&(o=l))}}o===null?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),t+=s}return Sp(n)}var hd=4096;function Sp(e){let t=e.length;if(t<=hd)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=hd));return r}var Mv=256,Cp=class{constructor(e=Mv){this.chunkSize=e,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(e){let t=this.chunks[this.chunks.length-1];if(this.cursor+e.length<=this.maxCursor+1){let n=t.length-(this.maxCursor-this.cursor)-1;t.set(e,n)}else{if(t){let n=t.length-(this.maxCursor-this.cursor)-1;n<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,n),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=Bv(this.chunkSize),this.chunks.push(t),this.maxCursor+=t.length,this._initReuseChunk===null&&(this._initReuseChunk=t),t.set(e,0)):(this.chunks.push(e),this.maxCursor+=e.length)}this.cursor+=e.length}toBytes(e=!1){let t;if(this.chunks.length===1){let r=this.chunks[0];e&&this.cursor>r.length/2?(t=this.cursor===r.length?r:r.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):t=Tu(r,0,this.cursor)}else t=Uv(this.chunks,this.cursor);return e&&this.reset(),t}},ye="CBOR decode error:",Qr="CBOR encode error:",Fi=[];Fi[23]=1;Fi[24]=2;Fi[25]=3;Fi[26]=5;Fi[27]=9;function Vn(e,t,r){if(e.length-t<r)throw new Error(`${ye} not enough data for type`)}var Ye=[24,256,65536,4294967296,BigInt("18446744073709551616")];function tn(e,t,r){Vn(e,t,1);let n=e[t];if(r.strict===!0&&n<Ye[0])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);return n}function rn(e,t,r){Vn(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<Ye[1])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);return n}function nn(e,t,r){Vn(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<Ye[2])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);return n}function on(e,t,r){Vn(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<Ye[3])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${ye} integers outside of the safe integer range are not supported`)}function Lv(e,t,r,n){return new ee(B.uint,tn(e,t+1,n),2)}function kv(e,t,r,n){return new ee(B.uint,rn(e,t+1,n),3)}function jv(e,t,r,n){return new ee(B.uint,nn(e,t+1,n),5)}function Fv(e,t,r,n){return new ee(B.uint,on(e,t+1,n),9)}function sn(e,t){return Pt(e,0,t.value)}function Pt(e,t,r){if(r<Ye[0]){let n=Number(r);e.push([t|n])}else if(r<Ye[1]){let n=Number(r);e.push([t|24,n])}else if(r<Ye[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<Ye[3]){let n=Number(r);e.push([t|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<Ye[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),s=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=s&255,s=s>>8,i[3]=s&255,s=s>>8,i[2]=s&255,s=s>>8,i[1]=s&255,e.push(i)}else throw new Error(`${ye} encountered BigInt larger than allowable range`)}}sn.encodedSize=function(t){return Pt.encodedSize(t.value)};Pt.encodedSize=function(t){return t<Ye[0]?1:t<Ye[1]?2:t<Ye[2]?3:t<Ye[3]?5:9};sn.compareTokens=function(t,r){return t.value<r.value?-1:t.value>r.value?1:0};function Vv(e,t,r,n){return new ee(B.negint,-1-tn(e,t+1,n),2)}function zv(e,t,r,n){return new ee(B.negint,-1-rn(e,t+1,n),3)}function Kv(e,t,r,n){return new ee(B.negint,-1-nn(e,t+1,n),5)}var Au=BigInt(-1),Np=BigInt(1);function qv(e,t,r,n){let i=on(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new ee(B.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${ye} integers outside of the safe integer range are not supported`);return new ee(B.negint,Au-BigInt(i),9)}function Ou(e,t){let r=t.value,n=typeof r=="bigint"?r*Au-Np:r*-1-1;Pt(e,t.type.majorEncoded,n)}Ou.encodedSize=function(t){let r=t.value,n=typeof r=="bigint"?r*Au-Np:r*-1-1;return n<Ye[0]?1:n<Ye[1]?2:n<Ye[2]?3:n<Ye[3]?5:9};Ou.compareTokens=function(t,r){return t.value<r.value?1:t.value>r.value?-1:0};function Vi(e,t,r,n){Vn(e,t,r+n);let i=Tu(e,t+r,t+r+n);return new ee(B.bytes,i,r+n)}function Gv(e,t,r,n){return Vi(e,t,1,r)}function Wv(e,t,r,n){return Vi(e,t,2,tn(e,t+1,n))}function Hv(e,t,r,n){return Vi(e,t,3,rn(e,t+1,n))}function Jv(e,t,r,n){return Vi(e,t,5,nn(e,t+1,n))}function Xv(e,t,r,n){let i=on(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer bytes lengths not supported`);return Vi(e,t,9,i)}function Zo(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===B.string?xp(e.value):e.value),e.encodedBytes}function bs(e,t){let r=Zo(t);Pt(e,t.type.majorEncoded,r.length),e.push(r)}bs.encodedSize=function(t){let r=Zo(t);return Pt.encodedSize(r.length)+r.length};bs.compareTokens=function(t,r){return Yv(Zo(t),Zo(r))};function Yv(e,t){return e.length<t.length?-1:e.length>t.length?1:Dv(e,t)}function zi(e,t,r,n,i){let o=r+n;Vn(e,t,o);let s=new ee(B.string,Pv(e,t+r,t+o),o);return i.retainStringBytes===!0&&(s.byteValue=Tu(e,t+r,t+o)),s}function Qv(e,t,r,n){return zi(e,t,1,r,n)}function Zv(e,t,r,n){return zi(e,t,2,tn(e,t+1,n),n)}function e_(e,t,r,n){return zi(e,t,3,rn(e,t+1,n),n)}function t_(e,t,r,n){return zi(e,t,5,nn(e,t+1,n),n)}function r_(e,t,r,n){let i=on(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer string lengths not supported`);return zi(e,t,9,i,n)}var n_=bs;function zn(e,t,r,n){return new ee(B.array,n,r)}function i_(e,t,r,n){return zn(e,t,1,r)}function o_(e,t,r,n){return zn(e,t,2,tn(e,t+1,n))}function s_(e,t,r,n){return zn(e,t,3,rn(e,t+1,n))}function a_(e,t,r,n){return zn(e,t,5,nn(e,t+1,n))}function u_(e,t,r,n){let i=on(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer array lengths not supported`);return zn(e,t,9,i)}function c_(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ye} indefinite length items not allowed`);return zn(e,t,1,1/0)}function Eu(e,t){Pt(e,B.array.majorEncoded,t.value)}Eu.compareTokens=sn.compareTokens;Eu.encodedSize=function(t){return Pt.encodedSize(t.value)};function Kn(e,t,r,n){return new ee(B.map,n,r)}function f_(e,t,r,n){return Kn(e,t,1,r)}function l_(e,t,r,n){return Kn(e,t,2,tn(e,t+1,n))}function d_(e,t,r,n){return Kn(e,t,3,rn(e,t+1,n))}function p_(e,t,r,n){return Kn(e,t,5,nn(e,t+1,n))}function h_(e,t,r,n){let i=on(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer map lengths not supported`);return Kn(e,t,9,i)}function y_(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ye} indefinite length items not allowed`);return Kn(e,t,1,1/0)}function Iu(e,t){Pt(e,B.map.majorEncoded,t.value)}Iu.compareTokens=sn.compareTokens;Iu.encodedSize=function(t){return Pt.encodedSize(t.value)};function g_(e,t,r,n){return new ee(B.tag,r,1)}function m_(e,t,r,n){return new ee(B.tag,tn(e,t+1,n),2)}function b_(e,t,r,n){return new ee(B.tag,rn(e,t+1,n),3)}function v_(e,t,r,n){return new ee(B.tag,nn(e,t+1,n),5)}function __(e,t,r,n){return new ee(B.tag,on(e,t+1,n),9)}function xu(e,t){Pt(e,B.tag.majorEncoded,t.value)}xu.compareTokens=sn.compareTokens;xu.encodedSize=function(t){return Pt.encodedSize(t.value)};var w_=20,T_=21,A_=22,O_=23;function E_(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${ye} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ee(B.null,null,1):new ee(B.undefined,void 0,1)}function I_(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ye} indefinite length items not allowed`);return new ee(B.break,void 0,1)}function Su(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${ye} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${ye} Infinity values are not supported`)}return new ee(B.float,e,t)}function x_(e,t,r,n){return Su(Nu(e,t+1),3,n)}function S_(e,t,r,n){return Su(Ru(e,t+1),5,n)}function C_(e,t,r,n){return Su(Up(e,t+1),9,n)}function Cu(e,t,r){let n=t.value;if(n===!1)e.push([B.float.majorEncoded|w_]);else if(n===!0)e.push([B.float.majorEncoded|T_]);else if(n===null)e.push([B.float.majorEncoded|A_]);else if(n===void 0)e.push([B.float.majorEncoded|O_]);else{let i,o=!1;(!r||r.float64!==!0)&&($p(n),i=Nu(zt,1),n===i||Number.isNaN(n)?(zt[0]=249,e.push(zt.slice(0,3)),o=!0):(Pp(n),i=Ru(zt,1),n===i&&(zt[0]=250,e.push(zt.slice(0,5)),o=!0))),o||(N_(n),i=Up(zt,1),zt[0]=251,e.push(zt.slice(0,9)))}}Cu.encodedSize=function(t,r){let n=t.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){$p(n);let i=Nu(zt,1);if(n===i||Number.isNaN(n))return 3;if(Pp(n),i=Ru(zt,1),n===i)return 5}return 9};var Rp=new ArrayBuffer(9),Rt=new DataView(Rp,1),zt=new Uint8Array(Rp,0);function $p(e){if(e===1/0)Rt.setUint16(0,31744,!1);else if(e===-1/0)Rt.setUint16(0,64512,!1);else if(Number.isNaN(e))Rt.setUint16(0,32256,!1);else{Rt.setFloat32(0,e);let t=Rt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)Rt.setUint16(0,31744,!1);else if(r===0)Rt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?Rt.setUint16(0,0):i<-14?Rt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):Rt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function Nu(e,t){if(e.length-t<2)throw new Error(`${ye} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}function Pp(e){Rt.setFloat32(0,e,!1)}function Ru(e,t){if(e.length-t<4)throw new Error(`${ye} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function N_(e){Rt.setFloat64(0,e,!1)}function Up(e,t){if(e.length-t<8)throw new Error(`${ye} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}Cu.compareTokens=sn.compareTokens;function xe(e,t,r){throw new Error(`${ye} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function vs(e){return()=>{throw new Error(`${ye} ${e}`)}}var ce=[];for(let e=0;e<=23;e++)ce[e]=xe;ce[24]=Lv;ce[25]=kv;ce[26]=jv;ce[27]=Fv;ce[28]=xe;ce[29]=xe;ce[30]=xe;ce[31]=xe;for(let e=32;e<=55;e++)ce[e]=xe;ce[56]=Vv;ce[57]=zv;ce[58]=Kv;ce[59]=qv;ce[60]=xe;ce[61]=xe;ce[62]=xe;ce[63]=xe;for(let e=64;e<=87;e++)ce[e]=Gv;ce[88]=Wv;ce[89]=Hv;ce[90]=Jv;ce[91]=Xv;ce[92]=xe;ce[93]=xe;ce[94]=xe;ce[95]=vs("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ce[e]=Qv;ce[120]=Zv;ce[121]=e_;ce[122]=t_;ce[123]=r_;ce[124]=xe;ce[125]=xe;ce[126]=xe;ce[127]=vs("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ce[e]=i_;ce[152]=o_;ce[153]=s_;ce[154]=a_;ce[155]=u_;ce[156]=xe;ce[157]=xe;ce[158]=xe;ce[159]=c_;for(let e=160;e<=183;e++)ce[e]=f_;ce[184]=l_;ce[185]=d_;ce[186]=p_;ce[187]=h_;ce[188]=xe;ce[189]=xe;ce[190]=xe;ce[191]=y_;for(let e=192;e<=215;e++)ce[e]=g_;ce[216]=m_;ce[217]=b_;ce[218]=v_;ce[219]=__;ce[220]=xe;ce[221]=xe;ce[222]=xe;ce[223]=xe;for(let e=224;e<=243;e++)ce[e]=vs("simple values are not supported");ce[244]=xe;ce[245]=xe;ce[246]=xe;ce[247]=E_;ce[248]=vs("simple values are not supported");ce[249]=x_;ce[250]=S_;ce[251]=C_;ce[252]=xe;ce[253]=xe;ce[254]=xe;ce[255]=I_;var Zt=[];for(let e=0;e<24;e++)Zt[e]=new ee(B.uint,e,1);for(let e=-1;e>=-24;e--)Zt[31-e]=new ee(B.negint,e,1);Zt[64]=new ee(B.bytes,new Uint8Array(0),1);Zt[96]=new ee(B.string,"",1);Zt[128]=new ee(B.array,0,1);Zt[160]=new ee(B.map,0,1);Zt[244]=new ee(B.false,!1,1);Zt[245]=new ee(B.true,!0,1);Zt[246]=new ee(B.null,null,1);function $u(){let e=[];return e[B.uint.major]=sn,e[B.negint.major]=Ou,e[B.bytes.major]=bs,e[B.string.major]=n_,e[B.array.major]=Eu,e[B.map.major]=Iu,e[B.tag.major]=xu,e[B.float.major]=Cu,e}var j$=$u(),Xa=new Cp,yd=class Bp{constructor(t,r){this.obj=t,this.parent=r}includes(t){let r=this;do if(r.obj===t)return!0;while(r=r.parent);return!1}static createCheck(t,r){if(t&&t.includes(r))throw new Error(`${Qr} object contains circular references`);return new Bp(r,t)}},Ar={null:new ee(B.null,null),undefined:new ee(B.undefined,void 0),true:new ee(B.true,!0),false:new ee(B.false,!1),emptyArray:new ee(B.array,0),emptyMap:new ee(B.map,0)},xr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ee(B.float,e):e>=0?new ee(B.uint,e):new ee(B.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ee(B.uint,e):new ee(B.negint,e)},Uint8Array(e,t,r,n){return new ee(B.bytes,e)},string(e,t,r,n){return new ee(B.string,e)},boolean(e,t,r,n){return e?Ar.true:Ar.false},null(e,t,r,n){return Ar.null},undefined(e,t,r,n){return Ar.undefined},ArrayBuffer(e,t,r,n){return new ee(B.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ee(B.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Ar.emptyArray,new ee(B.break)]:Ar.emptyArray;n=yd.createCheck(n,e);let i=[],o=0;for(let s of e)i[o++]=Go(s,r,n);return r.addBreakTokens?[new ee(B.array,e.length),i,new ee(B.break)]:[new ee(B.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),s=i?e.size:o.length;if(!s)return r.addBreakTokens===!0?[Ar.emptyMap,new ee(B.break)]:Ar.emptyMap;n=yd.createCheck(n,e);let a=[],u=0;for(let c of o)a[u++]=[Go(c,r,n),Go(i?e.get(c):e[c],r,n)];return R_(a,r),r.addBreakTokens?[new ee(B.map,s),a,new ee(B.break)]:[new ee(B.map,s),a]}};xr.Map=xr.Object;xr.Buffer=xr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))xr[`${e}Array`]=xr.DataView;function Go(e,t={},r){let n=Sv(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||xr[n];if(typeof i=="function"){let s=i(e,n,t,r);if(s!=null)return s}let o=xr[n];if(!o)throw new Error(`${Qr} unsupported type: ${n}`);return o(e,n,t,r)}function R_(e,t){t.mapSorter&&e.sort(t.mapSorter)}function Dp(e,t,r,n){if(Array.isArray(t))for(let i of t)Dp(e,i,r,n);else r[t.type.major](e,t,n)}function $_(e,t,r){let n=Go(e,r);if(!Array.isArray(n)&&r.quickEncodeToken){let i=r.quickEncodeToken(n);if(i)return i;let o=t[n.type.major];if(o.encodedSize){let s=o.encodedSize(n,r),a=new Cp(s);if(o(a,n,r),a.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return wu(a.chunks[0])}}return Xa.reset(),Dp(Xa,n,t,r),Xa.toBytes(!0)}var P_={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},U_=class{constructor(e,t={}){this._pos=0,this.data=e,this.options=t}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let e=this.data[this._pos],t=Zt[e];if(t===void 0){let r=ce[e];if(!r)throw new Error(`${ye} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);let n=e&31;t=r(this.data,this._pos,n,this.options)}return this._pos+=t.encodedLength,t}},Ui=Symbol.for("DONE"),_s=Symbol.for("BREAK");function B_(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=Bi(t,r);if(o===_s){if(e.value===1/0)break;throw new Error(`${ye} got unexpected break to lengthed array`)}if(o===Ui)throw new Error(`${ye} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function D_(e,t,r){let n=r.useMaps===!0,i=n?void 0:{},o=n?new Map:void 0;for(let s=0;s<e.value;s++){let a=Bi(t,r);if(a===_s){if(e.value===1/0)break;throw new Error(`${ye} got unexpected break to lengthed map`)}if(a===Ui)throw new Error(`${ye} found map but not enough entries (got ${s} [no key], expected ${e.value})`);if(n!==!0&&typeof a!="string")throw new Error(`${ye} non-string keys not supported (got ${typeof a})`);if(r.rejectDuplicateMapKeys===!0&&(n&&o.has(a)||!n&&a in i))throw new Error(`${ye} found repeat map key "${a}"`);let u=Bi(t,r);if(u===Ui)throw new Error(`${ye} found map but not enough entries (got ${s} [no value], expected ${e.value})`);n?o.set(a,u):i[a]=u}return n?o:i}function Bi(e,t){if(e.done())return Ui;let r=e.next();if(r.type===B.break)return _s;if(r.type.terminal)return r.value;if(r.type===B.array)return B_(r,e,t);if(r.type===B.map)return D_(r,e,t);if(r.type===B.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Bi(e,t);return t.tags[r.value](n)}throw new Error(`${ye} tag not supported (${r.value})`)}throw new Error("unsupported")}function M_(e,t){if(!(e instanceof Uint8Array))throw new Error(`${ye} data to decode must be a Uint8Array`);t=Object.assign({},P_,t);let r=t.tokenizer||new U_(e,t),n=Bi(r,t);if(n===Ui)throw new Error(`${ye} did not find any content to decode`);if(n===_s)throw new Error(`${ye} got unexpected break`);return[n,e.subarray(r.pos())]}function Mp(e,t){let[r,n]=M_(e,t);if(n.length>0)throw new Error(`${ye} too many terminals, data makes no sense`);return r}var L_=class extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){let t=this.inRecursive[this.inRecursive.length-1];t&&(t.type===B.array&&(t.elements++,t.elements!==1&&e.push([44])),t.type===B.map&&(t.elements++,t.elements!==1&&(t.elements%2===1?e.push([44]):e.push([58]))))}[B.uint.major](e,t){this.prefix(e);let r=String(t.value),n=[];for(let i=0;i<r.length;i++)n[i]=r.charCodeAt(i);e.push(n)}[B.negint.major](e,t){this[B.uint.major](e,t)}[B.bytes.major](e,t){throw new Error(`${Qr} unsupported type: Uint8Array`)}[B.string.major](e,t){this.prefix(e);let r=xp(JSON.stringify(t.value));e.push(r.length>32?wu(r):r)}[B.array.major](e,t){this.prefix(e),this.inRecursive.push({type:B.array,elements:0}),e.push([91])}[B.map.major](e,t){this.prefix(e),this.inRecursive.push({type:B.map,elements:0}),e.push([123])}[B.tag.major](e,t){}[B.float.major](e,t){if(t.type.name==="break"){let o=this.inRecursive.pop();if(o){if(o.type===B.array)e.push([93]);else if(o.type===B.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(t.value===void 0)throw new Error(`${Qr} unsupported type: undefined`);if(this.prefix(e),t.type.name==="true"){e.push([116,114,117,101]);return}else if(t.type.name==="false"){e.push([102,97,108,115,101]);return}else if(t.type.name==="null"){e.push([110,117,108,108]);return}let r=String(t.value),n=[],i=!1;for(let o=0;o<r.length;o++)n[o]=r.charCodeAt(o),!i&&(n[o]===46||n[o]===101||n[o]===69)&&(i=!0);i||(n.push(46),n.push(48)),e.push(n)}};function k_(e,t){if(Array.isArray(e[0])||Array.isArray(t[0]))throw new Error(`${Qr} complex map keys are not supported`);let r=e[0],n=t[0];if(r.type!==B.string||n.type!==B.string)throw new Error(`${Qr} non-string map keys are not supported`);if(r<n)return-1;if(r>n)return 1;throw new Error(`${Qr} unexpected duplicate map keys, this is not supported`)}var j_={addBreakTokens:!0,mapSorter:k_};function F_(e,t){return t=Object.assign({},j_,t),$_(e,new L_,t)}var Lp=class{constructor(e,t={}){this._pos=0,this.data=e,this.options=t,this.modeStack=["value"],this.lastToken=""}pos(){return this._pos}done(){return this._pos>=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<e.length)throw new Error(`${ye} unexpected end of input at position ${this._pos}`);for(let t=0;t<e.length;t++)if(this.data[this._pos++]!==e[t])throw new Error(`${ye} unexpected token at position ${this._pos}, expected to find '${String.fromCharCode(...e)}'`)}parseNumber(){let e=this._pos,t=!1,r=!1,n=s=>{for(;!this.done();){let a=this.ch();if(s.includes(a))this._pos++;else break}};if(this.ch()===45&&(t=!0,this._pos++),this.ch()===48)if(this._pos++,this.ch()===46)this._pos++,r=!0;else return new ee(B.uint,0,this._pos-e);if(n([48,49,50,51,52,53,54,55,56,57]),t&&this._pos===e+1)throw new Error(`${ye} unexpected token at position ${this._pos}`);if(!this.done()&&this.ch()===46){if(r)throw new Error(`${ye} unexpected token at position ${this._pos}`);r=!0,this._pos++,n([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++,n([48,49,50,51,52,53,54,55,56,57]));let i=String.fromCharCode.apply(null,this.data.subarray(e,this._pos)),o=parseFloat(i);return r?new ee(B.float,o,this._pos-e):this.options.allowBigInt!==!0||Number.isSafeInteger(o)?new ee(o>=0?B.uint:B.negint,o,this._pos-e):new ee(o>=0?B.uint:B.negint,BigInt(i),this._pos-e)}parseString(){if(this.ch()!==34)throw new Error(`${ye} unexpected character at position ${this._pos}; this shouldn't happen`);this._pos++;for(let i=this._pos,o=0;i<this.data.length&&o<65536;i++,o++){let s=this.data[i];if(s===92||s<32||s>=128)break;if(s===34){let a=String.fromCharCode.apply(null,this.data.subarray(this._pos,i));return this._pos=i+1,new ee(B.string,a,o)}}let e=this._pos,t=[],r=()=>{if(this._pos+4>=this.data.length)throw new Error(`${ye} unexpected end of unicode escape sequence at position ${this._pos}`);let i=0;for(let o=0;o<4;o++){let s=this.ch();if(s>=48&&s<=57)s-=48;else if(s>=97&&s<=102)s=s-97+10;else if(s>=65&&s<=70)s=s-65+10;else throw new Error(`${ye} unexpected unicode escape character at position ${this._pos}`);i=i*16+s,this._pos++}return i},n=()=>{let i=this.ch(),o=null,s=i>239?4:i>223?3:i>191?2:1;if(this._pos+s>this.data.length)throw new Error(`${ye} unexpected unicode sequence at position ${this._pos}`);let a,u,c,l;switch(s){case 1:i<128&&(o=i);break;case 2:a=this.data[this._pos+1],(a&192)===128&&(l=(i&31)<<6|a&63,l>127&&(o=l));break;case 3:a=this.data[this._pos+1],u=this.data[this._pos+2],(a&192)===128&&(u&192)===128&&(l=(i&15)<<12|(a&63)<<6|u&63,l>2047&&(l<55296||l>57343)&&(o=l));break;case 4:a=this.data[this._pos+1],u=this.data[this._pos+2],c=this.data[this._pos+3],(a&192)===128&&(u&192)===128&&(c&192)===128&&(l=(i&15)<<18|(a&63)<<12|(u&63)<<6|c&63,l>65535&&l<1114112&&(o=l))}o===null?(o=65533,s=1):o>65535&&(o-=65536,t.push(o>>>10&1023|55296),o=56320|o&1023),t.push(o),this._pos+=s};for(;!this.done();){let i=this.ch(),o;switch(i){case 92:if(this._pos++,this.done())throw new Error(`${ye} unexpected string termination at position ${this._pos}`);switch(o=this.ch(),this._pos++,o){case 34:case 39:case 92:case 47:t.push(o);break;case 98:t.push(8);break;case 116:t.push(9);break;case 110:t.push(10);break;case 102:t.push(12);break;case 114:t.push(13);break;case 117:t.push(r());break;default:throw new Error(`${ye} unexpected string escape character at position ${this._pos}`)}break;case 34:return this._pos++,new ee(B.string,Sp(t),this._pos-e);default:if(i<32)throw new Error(`${ye} invalid control character at position ${this._pos}`);i<128?(t.push(i),this._pos++):n()}}throw new Error(`${ye} unexpected end of string at position ${this._pos}`)}parseValue(){switch(this.ch()){case 123:return this.modeStack.push("obj-start"),this._pos++,new ee(B.map,1/0,1);case 91:return this.modeStack.push("array-start"),this._pos++,new ee(B.array,1/0,1);case 34:return this.parseString();case 110:return this.expect([110,117,108,108]),new ee(B.null,null,4);case 102:return this.expect([102,97,108,115,101]),new ee(B.false,!1,5);case 116:return this.expect([116,114,117,101]),new ee(B.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(`${ye} 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 ee(B.break,void 0,1);if(this.ch()!==44)throw new Error(`${ye} 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 ee(B.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 ee(B.break,void 0,1);if(this.ch()!==44)throw new Error(`${ye} 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 ee(B.break,void 0,1);let e=this.parseString();if(this.skipWhitespace(),this.ch()!==58)throw new Error(`${ye} 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(`${ye} unexpected parse state at position ${this._pos}; this shouldn't happen`)}}};function V_(e,t){return t=Object.assign({tokenizer:new Lp(e,t)},t),Mp(e,t)}var F$=new Uint8Array(0);function z_(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function Pu(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}function K_(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(r[s]!==255)throw new TypeError(o+" is ambiguous");r[s]=i}var a=e.length,u=e.charAt(0),c=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function p(E){if(E instanceof Uint8Array||(ArrayBuffer.isView(E)?E=new Uint8Array(E.buffer,E.byteOffset,E.byteLength):Array.isArray(E)&&(E=Uint8Array.from(E))),!(E instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(E.length===0)return"";for(var z=0,W=0,T=0,k=E.length;T!==k&&E[T]===0;)T++,z++;for(var G=(k-T)*l+1>>>0,H=new Uint8Array(G);T!==k;){for(var F=E[T],Y=0,V=G-1;(F!==0||Y<W)&&V!==-1;V--,Y++)F+=256*H[V]>>>0,H[V]=F%a>>>0,F=F/a>>>0;if(F!==0)throw new Error("Non-zero carry");W=Y,T++}for(var ae=G-W;ae!==G&&H[ae]===0;)ae++;for(var L=u.repeat(z);ae<G;++ae)L+=e.charAt(H[ae]);return L}function S(E){if(typeof E!="string")throw new TypeError("Expected String");if(E.length===0)return new Uint8Array;var z=0;if(E[z]!==" "){for(var W=0,T=0;E[z]===u;)W++,z++;for(var k=(E.length-z)*c+1>>>0,G=new Uint8Array(k);E[z];){var H=r[E.charCodeAt(z)];if(H===255)return;for(var F=0,Y=k-1;(H!==0||F<T)&&Y!==-1;Y--,F++)H+=a*G[Y]>>>0,G[Y]=H%256>>>0,H=H/256>>>0;if(H!==0)throw new Error("Non-zero carry");T=F,z++}if(E[z]!==" "){for(var V=k-T;V!==k&&G[V]===0;)V++;for(var ae=new Uint8Array(W+(k-V)),L=W;V!==k;)ae[L++]=G[V++];return ae}}}function x(E){var z=S(E);if(z)return z;throw new Error(`Non-${t} character`)}return{encode:p,decodeUnsafe:S,decode:x}}var q_=K_,G_=q_,W_=G_,H_=class{name;prefix;baseEncode;constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},J_=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,r){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return kp(this,e)}},X_=class{decoders;constructor(e){this.decoders=e}or(e){return kp(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r!=null)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function kp(e,t){return new X_({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Y_=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new H_(e,t,r),this.decoder=new J_(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function jp({name:e,prefix:t,encode:r,decode:n}){return new Y_(e,t,r,n)}function ws({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=W_(r,e);return jp({prefix:t,name:e,encode:n,decode:o=>Pu(i(o))})}function Q_(e,t,r,n){let i={};for(let l=0;l<t.length;++l)i[t[l]]=l;let o=e.length;for(;e[o-1]==="=";)--o;let s=new Uint8Array(o*r/8|0),a=0,u=0,c=0;for(let l=0;l<o;++l){let p=i[e[l]];if(p===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|p,a+=r,a>=8&&(a-=8,s[c++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return s}function Z_(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let u=0;u<e.length;++u)for(a=a<<8|e[u],s+=8;s>r;)s-=r,o+=t[i&a>>s];if(s!==0&&(o+=t[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o}function gt({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return jp({prefix:t,name:e,encode(i){return Z_(i,n,r)},decode(i){return Q_(i,n,r,e)}})}var Wo=gt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),V$=gt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),z$=gt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),K$=gt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),q$=gt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),G$=gt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),W$=gt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),H$=gt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),J$=gt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Ir=ws({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),X$=ws({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Fp={};Wa(Fp,{Digest:()=>Ts,create:()=>ns,decode:()=>Uu,equals:()=>zp});var ew=Vp,gd=128,tw=127,rw=~tw,nw=Math.pow(2,31);function Vp(e,t,r){t=t||[],r=r||0;for(var n=r;e>=nw;)t[r++]=e&255|gd,e/=128;for(;e&rw;)t[r++]=e&255|gd,e>>>=7;return t[r]=e|0,Vp.bytes=r-n+1,t}var iw=su,ow=128,md=127;function su(e,n){var r=0,n=n||0,i=0,o=n,s,a=e.length;do{if(o>=a)throw su.bytes=0,new RangeError("Could not decode varint");s=e[o++],r+=i<28?(s&md)<<i:(s&md)*Math.pow(2,i),i+=7}while(s>=ow);return su.bytes=o-n,r}var sw=Math.pow(2,7),aw=Math.pow(2,14),uw=Math.pow(2,21),cw=Math.pow(2,28),fw=Math.pow(2,35),lw=Math.pow(2,42),dw=Math.pow(2,49),pw=Math.pow(2,56),hw=Math.pow(2,63),yw=function(e){return e<sw?1:e<aw?2:e<uw?3:e<cw?4:e<fw?5:e<lw?6:e<dw?7:e<pw?8:e<hw?9:10},gw={encode:ew,decode:iw,encodingLength:yw},mw=gw,es=mw;function au(e,t=0){return[es.decode(e,t),es.decode.bytes]}function ts(e,t,r=0){return es.encode(e,t,r),t}function rs(e){return es.encodingLength(e)}function ns(e,t){let r=t.byteLength,n=rs(e),i=n+rs(r),o=new Uint8Array(i+r);return ts(e,o,0),ts(r,o,n),o.set(t,i),new Ts(e,r,t,o)}function Uu(e){let t=Pu(e),[r,n]=au(t),[i,o]=au(t.subarray(n)),s=t.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Ts(r,i,s,t)}function zp(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&z_(e.bytes,r.bytes)}}var Ts=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function bd(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return vw(r,uu(e),t??Ir.encoder);default:return _w(r,uu(e),t??Wo.encoder)}}var vd=new WeakMap;function uu(e){let t=vd.get(e);if(t==null){let r=new Map;return vd.set(e,r),r}return t}var $t=class et{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==Ci)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==ww)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return et.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:r}=this.multihash,n=ns(t,r);return et.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return et.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&zp(t.multihash,n.multihash)}toString(t){return bd(this,t)}toJSON(){return{"/":bd(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof et)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new et(n,i,o,s??_d(n,i,o.bytes))}else if(r[Tw]===!0){let{version:n,multihash:i,code:o}=r,s=Uu(i);return et.create(n,o,s)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==Ci)throw new Error(`Version 0 CID must use dag-pb (code: ${Ci}) block encoding`);return new et(t,r,n,n.bytes)}case 1:{let i=_d(t,r,n.bytes);return new et(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return et.create(0,Ci,t)}static createV1(t,r){return et.create(1,t,r)}static decode(t){let[r,n]=et.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=et.inspectBytes(t),n=r.size-r.multihashSize,i=Pu(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new Ts(r.multihashCode,r.digestSize,o,i);return[r.version===0?et.createV0(s):et.createV1(r.codec,s),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[p,S]=au(t.subarray(r));return r+=S,p},i=n(),o=Ci;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),u=n(),c=r+u,l=c-s;return{version:i,codec:o,multihashCode:a,digestSize:u,multihashSize:l,size:c}}static parse(t,r){let[n,i]=bw(t,r),o=et.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return uu(o).set(n,t),o}};function bw(e,t){switch(e[0]){case"Q":{let r=t??Ir;return[Ir.prefix,r.decode(`${Ir.prefix}${e}`)]}case Ir.prefix:{let r=t??Ir;return[Ir.prefix,r.decode(e)]}case Wo.prefix:{let r=t??Wo;return[Wo.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function vw(e,t,r){let{prefix:n}=r;if(n!==Ir.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let o=r.encode(e).slice(1);return t.set(n,o),o}else return i}function _w(e,t,r){let{prefix:n}=r,i=t.get(n);if(i==null){let o=r.encode(e);return t.set(n,o),o}else return i}var Ci=112,ww=18;function _d(e,t,r){let n=rs(e),i=n+rs(t),o=new Uint8Array(i+r.byteLength);return ts(e,o,0),ts(t,o,n),o.set(r,i),o}var Tw=Symbol.for("@ipld/js-cid/CID");function Kp({name:e,code:t,encode:r}){return new Aw(e,t,r)}var Aw=class{name;code;encode;constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?ns(this.code,t):t.then(r=>ns(this.code,r))}else throw Error("Unknown type, must be binary type")}},qp=gt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Y$=gt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Q$=gt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Z$=gt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function Ow(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=$t.asCID(e);if(!t)return null;let r=t.toString();return[new ee(B.map,1/0,1),new ee(B.string,"/",1),new ee(B.string,r,r.length),new ee(B.break,void 0,1)]}function is(e){let t=qp.encode(e).slice(1);return[new ee(B.map,1/0,1),new ee(B.string,"/",1),new ee(B.map,1/0,1),new ee(B.string,"bytes",5),new ee(B.string,t,t.length),new ee(B.break,void 0,1),new ee(B.break,void 0,1)]}function Vt(e){return is(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function Ew(e){return is(new Uint8Array(e))}function Iw(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function xw(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}var Sw={typeEncoders:{Object:Ow,Buffer:is,Uint8Array:is,Int8Array:Vt,Uint16Array:Vt,Int16Array:Vt,Uint32Array:Vt,Int32Array:Vt,Float32Array:Vt,Float64Array:Vt,Uint8ClampedArray:Vt,BigInt64Array:Vt,BigUint64Array:Vt,DataView:Vt,ArrayBuffer:Ew,undefined:Iw,number:xw}},Cw=class extends Lp{constructor(e,t){super(e,t),this.tokenBuffer=[]}done(){return this.tokenBuffer.length===0&&super.done()}_next(){return this.tokenBuffer.length>0?this.tokenBuffer.pop():super.next()}next(){let e=this._next();if(e.type===B.map){let t=this._next();if(t.type===B.string&&t.value==="/"){let r=this._next();if(r.type===B.string){if(this._next().type!==B.break)throw new Error("Invalid encoded CID form");return this.tokenBuffer.push(r),new ee(B.tag,42,0)}if(r.type===B.map){let n=this._next();if(n.type===B.string&&n.value==="bytes"){let i=this._next();if(i.type===B.string){for(let s=0;s<2;s++)if(this._next().type!==B.break)throw new Error("Invalid encoded Bytes form");let o=qp.decode(`m${i.value}`);return new ee(B.bytes,o,i.value.length)}this.tokenBuffer.push(i)}this.tokenBuffer.push(n)}this.tokenBuffer.push(r)}this.tokenBuffer.push(t)}return e}},cu={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};cu.tags[42]=$t.parse;var Nw="dag-json",Gp=297,Bu=e=>F_(e,Sw),As=e=>{let t=Object.assign(cu,{tokenizer:new Cw(e,cu)});return V_(e,t)},wd=e=>Rw.decode(Bu(e)),Rw=new TextDecoder,$w=e=>As(Pw.encode(e)),Pw=new TextEncoder;function Uw(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Bw(e,...t){if(!Uw(e))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function Td(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Dw(e,t){Bw(e);let r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}function Mw(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}var Ya=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Xt=(e,t)=>e<<32-t|e>>>t,Lw=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Lw)throw new Error("Non little-endian hardware is not supported");function kw(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Wp(e){if(typeof e=="string"&&(e=kw(e)),!Mw(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}var jw=class{clone(){return this._cloneInto()}},eP={}.toString;function Fw(e){let t=n=>e().update(Wp(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Vw(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),u=n?4:0,c=n?0:4;e.setUint32(t+u,s,n),e.setUint32(t+c,a,n)}var zw=class extends jw{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Ya(this.buffer)}update(e){Td(this);let{view:t,buffer:r,blockLen:n}=this;e=Wp(e);let i=e.length;for(let o=0;o<i;){let s=Math.min(n-this.pos,i-o);if(s===n){let a=Ya(e);for(;n<=i-o;o+=n)this.process(a,o);continue}r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Td(this),Dw(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let l=o;l<n;l++)t[l]=0;Vw(r,n-8,BigInt(this.length*8),i),this.process(r,0);let s=Ya(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let u=a/4,c=this.get();if(u>c.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<u;l++)s.setUint32(4*l,c[l],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return e.length=n,e.pos=s,e.finished=i,e.destroyed=o,n%t&&e.buffer.set(r),e}},Kw=(e,t,r)=>e&t^~e&r,qw=(e,t,r)=>e&t^e&r^t&r,Gw=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Or=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Er=new Uint32Array(64),Ww=class extends zw{constructor(){super(64,32,8,!1),this.A=Or[0]|0,this.B=Or[1]|0,this.C=Or[2]|0,this.D=Or[3]|0,this.E=Or[4]|0,this.F=Or[5]|0,this.G=Or[6]|0,this.H=Or[7]|0}get(){let{A:e,B:t,C:r,D:n,E:i,F:o,G:s,H:a}=this;return[e,t,r,n,i,o,s,a]}set(e,t,r,n,i,o,s,a){this.A=e|0,this.B=t|0,this.C=r|0,this.D=n|0,this.E=i|0,this.F=o|0,this.G=s|0,this.H=a|0}process(e,t){for(let l=0;l<16;l++,t+=4)Er[l]=e.getUint32(t,!1);for(let l=16;l<64;l++){let p=Er[l-15],S=Er[l-2],x=Xt(p,7)^Xt(p,18)^p>>>3,E=Xt(S,17)^Xt(S,19)^S>>>10;Er[l]=E+Er[l-7]+x+Er[l-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:u,H:c}=this;for(let l=0;l<64;l++){let p=Xt(s,6)^Xt(s,11)^Xt(s,25),S=c+p+Kw(s,a,u)+Gw[l]+Er[l]|0,E=(Xt(r,2)^Xt(r,13)^Xt(r,22))+qw(r,n,i)|0;c=u,u=a,a=s,s=o+S|0,o=i,i=n,n=r,r=S+E|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,u=u+this.G|0,c=c+this.H|0,this.set(r,n,i,o,s,a,u,c)}roundClean(){Er.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},Hw=Fw(()=>new Ww);var We=Nt(ur(),1),Hp=Nt(bv(),1),fu=e=>We.Type.Union([e,We.Type.Null()]);var Jp=/^(k51qz|baguq)[0-9a-z]{56,57}$/,Jw=/^[0-9A-Fa-f]{7,8}$/g;We.FormatRegistry.Set("EntityID",e=>!!e.match(Jw)||!!e.match(Jp));var Xp=We.Type.String(),Os=e=>e?.enc instanceof Uint8Array;We.FormatRegistry.Set("CID",e=>!!e.match(Jp));var Du=We.Type.String({format:"CID"}),Xw=/^http([s]?):\/\/.*\..*/;We.FormatRegistry.Set("URL",e=>!!e.match(Xw));var Yw=We.Type.String({format:"URL"}),Mu=We.Type.Object({en:Xp,at:We.Type.String(),vl:fu(We.Type.Union([We.Type.String(),We.Type.Boolean(),We.Type.Number()])),ts:We.Type.String(),ag:We.Type.String(),pv:fu(Du)}),lu=Hp.TypeCompiler.Compile(Mu);var Qw=lu.Check.bind(lu),Yp=We.Type.Composite([We.Type.Object({cid:Du}),Mu]),os=Hp.TypeCompiler.Compile(Yp),Qp=e=>Array.from(os.Errors(e)),Lu=os.Check.bind(os),Zw=ws({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),tP=ws({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});function Zp(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var e0=Kp({name:"sha2-256",code:18,encode:Zp("SHA-256")}),rP=Kp({name:"sha2-512",code:19,encode:Zp("SHA-512")}),{WARN:Ad,LOG:nP,DEBUG:t0,VERBOSE:ss,ERROR:r0}=$e.setup($e.INFO),eh=114;function ku(e,t=["cid"]){if(!e)throw r0("falsy log",e);let r=e.cid;if(Os(e))return r||(r=Es(ju(e).bytes).toString()),Ad("preparing an encrypted applog - really?"),{log:e,cid:r};let n={};for(let[i,o]of Object.entries(e))o===void 0&&(Ad(`log.${i} is undefined, which is not allowed - encoding as null`,e),o=null),t.includes(i)?ss("excluding app log",{key:i,val:o}):n[i]=o;return{log:n,cid:r}}function th(e){return Es(rh(e).bytes)}function rh(e){return ju(ku(e)?.log)}function Es(e){let t=Hw(e),r=Fp.create(e0.code,t),n=$t.create(1,Gp,r);return ss("[getCidSync]",{bytes:e,hash:t,digest:r,cid:n}),n}function ju(e){t0("[encodeBlock]",e);let t=Bu(e);return{bytes:t,cid:Es(t)}}function Fu(e){let t=null,r=[];try{t=$t.parse(e)}catch(n){ss("[retrieveThread] couldn't parse pubID with default base"),r.push(n)}if(!t)try{t=$t.parse(e,Zw)}catch(n){ss("[retrieveThread] couldn't parse pubID with base36"),r.push(n)}return{cid:t,errors:t?null:r,isIpns:t&&nh(t)}}function nh(e){return e.code===eh}function du(e){return typeof e=="string"?$t.parse(e):typeof e.toV1!="function"?$t.decode(e.bytes):e}function Is(e,t){if(!e||!t)throw new Error(`[areCidsEqual] invalid params: ${e}, ${t}`);if(e===t)return!0;let r=du(e),n=du(t);return r.toV1().toString()===n.toV1().toString()}function Vu(e,t){return e instanceof Set?e.has(typeof t=="string"?t:t.toV1().toString()):e.some(r=>Is(r,t))}function Od(e){let t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function n0(e,t){let r=Od(e),n=Od(t);return+r<+n}var i0=typeof global=="object"&&global&&global.Object===Object&&global,ih=i0,o0=typeof self=="object"&&self&&self.Object===Object&&self,s0=ih||o0||Function("return this")(),mt=s0,a0=mt.Symbol,Qt=a0,oh=Object.prototype,u0=oh.hasOwnProperty,c0=oh.toString,Ni=Qt?Qt.toStringTag:void 0;function f0(e){var t=u0.call(e,Ni),r=e[Ni];try{e[Ni]=void 0;var n=!0}catch{}var i=c0.call(e);return n&&(t?e[Ni]=r:delete e[Ni]),i}var l0=f0,d0=Object.prototype,p0=d0.toString;function h0(e){return p0.call(e)}var y0=h0,g0="[object Null]",m0="[object Undefined]",Ed=Qt?Qt.toStringTag:void 0;function b0(e){return e==null?e===void 0?m0:g0:Ed&&Ed in Object(e)?l0(e):y0(e)}var qn=b0;function v0(e){return e!=null&&typeof e=="object"}var en=v0,_0="[object Symbol]";function w0(e){return typeof e=="symbol"||en(e)&&qn(e)==_0}var Ln=w0;function T0(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var A0=T0,O0=Array.isArray,Kt=O0,E0=1/0,Id=Qt?Qt.prototype:void 0,xd=Id?Id.toString:void 0;function sh(e){if(typeof e=="string")return e;if(Kt(e))return A0(e,sh)+"";if(Ln(e))return xd?xd.call(e):"";var t=e+"";return t=="0"&&1/e==-E0?"-0":t}var I0=sh,x0=/\s/;function S0(e){for(var t=e.length;t--&&x0.test(e.charAt(t)););return t}var C0=S0,N0=/^\s+/;function R0(e){return e&&e.slice(0,C0(e)+1).replace(N0,"")}var $0=R0;function P0(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var cr=P0,Sd=NaN,U0=/^[-+]0x[0-9a-f]+$/i,B0=/^0b[01]+$/i,D0=/^0o[0-7]+$/i,M0=parseInt;function L0(e){if(typeof e=="number")return e;if(Ln(e))return Sd;if(cr(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=cr(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=$0(e);var r=B0.test(e);return r||D0.test(e)?M0(e.slice(2),r?2:8):U0.test(e)?Sd:+e}var k0=L0,Cd=1/0,j0=17976931348623157e292;function F0(e){if(!e)return e===0?e:0;if(e=k0(e),e===Cd||e===-Cd){var t=e<0?-1:1;return t*j0}return e===e?e:0}var V0=F0;function z0(e){var t=V0(e),r=t%1;return t===t?r?t-r:t:0}var Nd=z0;function K0(e){return e}var xs=K0,q0="[object AsyncFunction]",G0="[object Function]",W0="[object GeneratorFunction]",H0="[object Proxy]";function J0(e){if(!cr(e))return!1;var t=qn(e);return t==G0||t==W0||t==q0||t==H0}var ah=J0,X0=mt["__core-js_shared__"],Qa=X0,Rd=function(){var e=/[^.]+$/.exec(Qa&&Qa.keys&&Qa.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Y0(e){return!!Rd&&Rd in e}var Q0=Y0,Z0=Function.prototype,eT=Z0.toString;function tT(e){if(e!=null){try{return eT.call(e)}catch{}try{return e+""}catch{}}return""}var an=tT,rT=/[\\^$.*+?()[\]{}|]/g,nT=/^\[object .+?Constructor\]$/,iT=Function.prototype,oT=Object.prototype,sT=iT.toString,aT=oT.hasOwnProperty,uT=RegExp("^"+sT.call(aT).replace(rT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function cT(e){if(!cr(e)||Q0(e))return!1;var t=ah(e)?uT:nT;return t.test(an(e))}var fT=cT;function lT(e,t){return e?.[t]}var dT=lT;function pT(e,t){var r=dT(e,t);return fT(r)?r:void 0}var un=pT,hT=un(mt,"WeakMap"),Di=hT,yT=Di&&new Di,as=yT,gT=as?function(e,t){return as.set(e,t),e}:xs,uh=gT,$d=Object.create,mT=function(){function e(){}return function(t){if(!cr(t))return{};if($d)return $d(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),zu=mT;function bT(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=zu(e.prototype),n=e.apply(r,t);return cr(n)?n:r}}var Mi=bT,vT=1;function _T(e,t,r){var n=t&vT,i=Mi(e);function o(){var s=this&&this!==mt&&this instanceof o?i:e;return s.apply(n?r:this,arguments)}return o}var wT=_T;function TT(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var Ku=TT,AT=Math.max;function OT(e,t,r,n){for(var i=-1,o=e.length,s=r.length,a=-1,u=t.length,c=AT(o-s,0),l=Array(u+c),p=!n;++a<u;)l[a]=t[a];for(;++i<s;)(p||i<o)&&(l[r[i]]=e[i]);for(;c--;)l[a++]=e[i++];return l}var ch=OT,ET=Math.max;function IT(e,t,r,n){for(var i=-1,o=e.length,s=-1,a=r.length,u=-1,c=t.length,l=ET(o-a,0),p=Array(l+c),S=!n;++i<l;)p[i]=e[i];for(var x=i;++u<c;)p[x+u]=t[u];for(;++s<a;)(S||i<o)&&(p[x+r[s]]=e[i++]);return p}var fh=IT;function xT(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}var ST=xT;function CT(){}var qu=CT,NT=4294967295;function us(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=NT,this.__views__=[]}us.prototype=zu(qu.prototype);us.prototype.constructor=us;var Gu=us;function RT(){}var lh=RT,$T=as?function(e){return as.get(e)}:lh,dh=$T,PT={},Pd=PT,UT=Object.prototype,BT=UT.hasOwnProperty;function DT(e){for(var t=e.name+"",r=Pd[t],n=BT.call(Pd,t)?r.length:0;n--;){var i=r[n],o=i.func;if(o==null||o==e)return i.name}return t}var MT=DT;function cs(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}cs.prototype=zu(qu.prototype);cs.prototype.constructor=cs;var pu=cs;function LT(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var ph=LT;function kT(e){if(e instanceof Gu)return e.clone();var t=new pu(e.__wrapped__,e.__chain__);return t.__actions__=ph(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var jT=kT,FT=Object.prototype,VT=FT.hasOwnProperty;function fs(e){if(en(e)&&!Kt(e)&&!(e instanceof Gu)){if(e instanceof pu)return e;if(VT.call(e,"__wrapped__"))return jT(e)}return new pu(e)}fs.prototype=qu.prototype;fs.prototype.constructor=fs;var zT=fs;function KT(e){var t=MT(e),r=zT[t];if(typeof r!="function"||!(t in Gu.prototype))return!1;if(e===r)return!0;var n=dh(r);return!!n&&e===n[0]}var qT=KT,GT=800,WT=16,HT=Date.now;function JT(e){var t=0,r=0;return function(){var n=HT(),i=WT-(n-r);if(r=n,i>0){if(++t>=GT)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var hh=JT,XT=hh(uh),yh=XT,YT=/\{\n\/\* \[wrapped with (.+)\] \*/,QT=/,? & /;function ZT(e){var t=e.match(YT);return t?t[1].split(QT):[]}var eA=ZT,tA=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function rA(e,t){var r=t.length;if(!r)return e;var n=r-1;return t[n]=(r>1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(tA,`{
60
60
  /* [wrapped with `+t+`] */
61
- `)}var nA=rA;function iA(e){return function(){return e}}var oA=iA,sA=function(){try{var e=un(Object,"defineProperty");return e({},"",{}),e}catch{}}(),fs=sA,aA=fs?function(e,t){return fs(e,"toString",{configurable:!0,enumerable:!1,value:oA(t),writable:!0})}:Is,uA=aA,cA=hh(uA),Wu=cA;function fA(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var lA=fA;function dA(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}var pA=dA;function hA(e){return e!==e}var yA=hA;function gA(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}var mA=gA;function bA(e,t,r){return t===t?mA(e,t,r):pA(e,yA,r)}var vA=bA;function _A(e,t){var r=e==null?0:e.length;return!!r&&vA(e,t,0)>-1}var wA=_A,TA=1,AA=2,OA=8,EA=16,IA=32,xA=64,SA=128,CA=256,NA=512,RA=[["ary",SA],["bind",TA],["bindKey",AA],["curry",OA],["curryRight",EA],["flip",NA],["partial",IA],["partialRight",xA],["rearg",CA]];function $A(e,t){return lA(RA,function(r){var n="_."+r[0];t&r[1]&&!wA(e,n)&&e.push(n)}),e.sort()}var PA=$A;function UA(e,t,r){var n=t+"";return Wu(e,nA(n,PA(eA(n),r)))}var gh=UA,BA=1,DA=2,MA=4,LA=8,Ud=32,Bd=64;function kA(e,t,r,n,i,o,s,a,u,c){var l=t&LA,p=l?s:void 0,S=l?void 0:s,x=l?o:void 0,E=l?void 0:o;t|=l?Ud:Bd,t&=~(l?Bd:Ud),t&MA||(t&=~(BA|DA));var z=[e,t,i,x,p,E,S,a,u,c],W=r.apply(void 0,z);return qT(e)&&yh(W,z),W.placeholder=n,gh(W,e,t)}var mh=kA;function jA(e){var t=e;return t.placeholder}var Hu=jA,FA=9007199254740991,VA=/^(?:0|[1-9]\d*)$/;function zA(e,t){var r=typeof e;return t=t??FA,!!t&&(r=="number"||r!="symbol"&&VA.test(e))&&e>-1&&e%1==0&&e<t}var xs=zA,KA=Math.min;function qA(e,t){for(var r=e.length,n=KA(t.length,r),i=ph(e);n--;){var o=t[n];e[n]=xs(o,r)?i[o]:void 0}return e}var GA=qA,Dd="__lodash_placeholder__";function WA(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var s=e[r];(s===t||s===Dd)&&(e[r]=Dd,o[i++]=r)}return o}var Li=WA,HA=1,JA=2,XA=8,YA=16,QA=128,ZA=512;function bh(e,t,r,n,i,o,s,a,u,c){var l=t&QA,p=t&HA,S=t&JA,x=t&(XA|YA),E=t&ZA,z=S?void 0:Mi(e);function W(){for(var T=arguments.length,k=Array(T),G=T;G--;)k[G]=arguments[G];if(x)var H=Hu(W),F=ST(k,H);if(n&&(k=ch(k,n,i,x)),o&&(k=fh(k,o,s,x)),T-=F,x&&T<c){var Y=Li(k,H);return mh(e,t,bh,W.placeholder,r,k,Y,a,u,c-T)}var V=p?r:this,ae=S?V[e]:e;return T=k.length,a?k=GA(k,a):E&&T>1&&k.reverse(),l&&u<T&&(k.length=u),this&&this!==mt&&this instanceof W&&(ae=z||Mi(ae)),ae.apply(V,k)}return W}var vh=bh;function e1(e,t,r){var n=Mi(e);function i(){for(var o=arguments.length,s=Array(o),a=o,u=Hu(i);a--;)s[a]=arguments[a];var c=o<3&&s[0]!==u&&s[o-1]!==u?[]:Li(s,u);if(o-=c.length,o<r)return mh(e,t,vh,i.placeholder,void 0,s,c,void 0,void 0,r-o);var l=this&&this!==mt&&this instanceof i?n:e;return Ku(l,this,s)}return i}var t1=e1,r1=1;function n1(e,t,r,n){var i=t&r1,o=Mi(e);function s(){for(var a=-1,u=arguments.length,c=-1,l=n.length,p=Array(l+u),S=this&&this!==mt&&this instanceof s?o:e;++c<l;)p[c]=n[c];for(;u--;)p[c++]=arguments[++a];return Ku(S,i?r:this,p)}return s}var i1=n1,Md="__lodash_placeholder__",Za=1,o1=2,s1=4,Ld=8,Ri=128,kd=256,a1=Math.min;function u1(e,t){var r=e[1],n=t[1],i=r|n,o=i<(Za|o1|Ri),s=n==Ri&&r==Ld||n==Ri&&r==kd&&e[7].length<=t[8]||n==(Ri|kd)&&t[7].length<=t[8]&&r==Ld;if(!(o||s))return e;n&Za&&(e[2]=t[2],i|=r&Za?0:s1);var a=t[3];if(a){var u=e[3];e[3]=u?ch(u,a,t[4]):a,e[4]=u?Li(e[3],Md):t[4]}return a=t[5],a&&(u=e[5],e[5]=u?fh(u,a,t[6]):a,e[6]=u?Li(e[5],Md):t[6]),a=t[7],a&&(e[7]=a),n&Ri&&(e[8]=e[8]==null?t[8]:a1(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}var c1=u1,f1="Expected a function",jd=1,l1=2,eu=8,tu=16,ru=32,Fd=64,Vd=Math.max;function d1(e,t,r,n,i,o,s,a){var u=t&l1;if(!u&&typeof e!="function")throw new TypeError(f1);var c=n?n.length:0;if(c||(t&=~(ru|Fd),n=i=void 0),s=s===void 0?s:Vd(Nd(s),0),a=a===void 0?a:Nd(a),c-=i?i.length:0,t&Fd){var l=n,p=i;n=i=void 0}var S=u?void 0:dh(e),x=[e,t,r,n,i,l,p,o,s,a];if(S&&c1(x,S),e=x[0],t=x[1],r=x[2],n=x[3],i=x[4],a=x[9]=x[9]===void 0?u?0:e.length:Vd(x[9]-c,0),!a&&t&(eu|tu)&&(t&=~(eu|tu)),!t||t==jd)var E=wT(e,t,r);else t==eu||t==tu?E=t1(e,t,a):(t==ru||t==(jd|ru))&&!i.length?E=i1(e,t,r,n):E=vh.apply(void 0,x);var z=S?uh:yh;return gh(z(E,x),e,t)}var p1=d1;function h1(e,t,r){t=="__proto__"&&fs?fs(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var y1=h1;function g1(e,t){return e===t||e!==e&&t!==t}var Ju=g1,m1=Object.prototype,b1=m1.hasOwnProperty;function v1(e,t,r){var n=e[t];(!(b1.call(e,t)&&Ju(n,r))||r===void 0&&!(t in e))&&y1(e,t,r)}var _1=v1,zd=Math.max;function w1(e,t,r){return t=zd(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=zd(n.length-t,0),s=Array(o);++i<o;)s[i]=n[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=n[i];return a[t]=r(s),Ku(e,this,a)}}var _h=w1;function T1(e,t){return Wu(_h(e,t,Is),e+"")}var A1=T1,O1=9007199254740991;function E1(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=O1}var Xu=E1;function I1(e){return e!=null&&Xu(e.length)&&!ah(e)}var x1=I1,S1=Object.prototype;function C1(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||S1;return e===r}var N1=C1;function R1(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var $1=R1,P1="[object Arguments]";function U1(e){return en(e)&&qn(e)==P1}var Kd=U1,wh=Object.prototype,B1=wh.hasOwnProperty,D1=wh.propertyIsEnumerable,M1=Kd(function(){return arguments}())?Kd:function(e){return en(e)&&B1.call(e,"callee")&&!D1.call(e,"callee")},Yu=M1;function L1(){return!1}var k1=L1,Th=typeof exports=="object"&&exports&&!exports.nodeType&&exports,qd=Th&&typeof module=="object"&&module&&!module.nodeType&&module,j1=qd&&qd.exports===Th,Gd=j1?mt.Buffer:void 0,F1=Gd?Gd.isBuffer:void 0,V1=F1||k1,hu=V1,z1="[object Arguments]",K1="[object Array]",q1="[object Boolean]",G1="[object Date]",W1="[object Error]",H1="[object Function]",J1="[object Map]",X1="[object Number]",Y1="[object Object]",Q1="[object RegExp]",Z1="[object Set]",eO="[object String]",tO="[object WeakMap]",rO="[object ArrayBuffer]",nO="[object DataView]",iO="[object Float32Array]",oO="[object Float64Array]",sO="[object Int8Array]",aO="[object Int16Array]",uO="[object Int32Array]",cO="[object Uint8Array]",fO="[object Uint8ClampedArray]",lO="[object Uint16Array]",dO="[object Uint32Array]",De={};De[iO]=De[oO]=De[sO]=De[aO]=De[uO]=De[cO]=De[fO]=De[lO]=De[dO]=!0;De[z1]=De[K1]=De[rO]=De[q1]=De[nO]=De[G1]=De[W1]=De[H1]=De[J1]=De[X1]=De[Y1]=De[Q1]=De[Z1]=De[eO]=De[tO]=!1;function pO(e){return en(e)&&Xu(e.length)&&!!De[qn(e)]}var hO=pO;function yO(e){return function(t){return e(t)}}var gO=yO,Ah=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pi=Ah&&typeof module=="object"&&module&&!module.nodeType&&module,mO=Pi&&Pi.exports===Ah,nu=mO&&ih.process,bO=function(){try{var e=Pi&&Pi.require&&Pi.require("util").types;return e||nu&&nu.binding&&nu.binding("util")}catch{}}(),Wd=bO,Hd=Wd&&Wd.isTypedArray,vO=Hd?gO(Hd):hO,Oh=vO,_O=Object.prototype,wO=_O.hasOwnProperty;function TO(e,t){var r=Kt(e),n=!r&&Yu(e),i=!r&&!n&&hu(e),o=!r&&!n&&!i&&Oh(e),s=r||n||i||o,a=s?$1(e.length,String):[],u=a.length;for(var c in e)(t||wO.call(e,c))&&!(s&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||xs(c,u)))&&a.push(c);return a}var AO=TO;function OO(e,t){return function(r){return e(t(r))}}var EO=OO,IO=EO(Object.keys,Object),xO=IO,SO=Object.prototype,CO=SO.hasOwnProperty;function NO(e){if(!N1(e))return xO(e);var t=[];for(var r in Object(e))CO.call(e,r)&&r!="constructor"&&t.push(r);return t}var RO=NO;function $O(e){return x1(e)?AO(e):RO(e)}var Eh=$O,PO=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,UO=/^\w*$/;function BO(e,t){if(Kt(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Ln(e)?!0:UO.test(e)||!PO.test(e)||t!=null&&e in Object(t)}var Qu=BO,DO=un(Object,"create"),ki=DO;function MO(){this.__data__=ki?ki(null):{},this.size=0}var LO=MO;function kO(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var jO=kO,FO="__lodash_hash_undefined__",VO=Object.prototype,zO=VO.hasOwnProperty;function KO(e){var t=this.__data__;if(ki){var r=t[e];return r===FO?void 0:r}return zO.call(t,e)?t[e]:void 0}var qO=KO,GO=Object.prototype,WO=GO.hasOwnProperty;function HO(e){var t=this.__data__;return ki?t[e]!==void 0:WO.call(t,e)}var JO=HO,XO="__lodash_hash_undefined__";function YO(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ki&&t===void 0?XO:t,this}var QO=YO;function Gn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Gn.prototype.clear=LO;Gn.prototype.delete=jO;Gn.prototype.get=qO;Gn.prototype.has=JO;Gn.prototype.set=QO;var Jd=Gn;function ZO(){this.__data__=[],this.size=0}var eE=ZO;function tE(e,t){for(var r=e.length;r--;)if(Ju(e[r][0],t))return r;return-1}var Ss=tE,rE=Array.prototype,nE=rE.splice;function iE(e){var t=this.__data__,r=Ss(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():nE.call(t,r,1),--this.size,!0}var oE=iE;function sE(e){var t=this.__data__,r=Ss(t,e);return r<0?void 0:t[r][1]}var aE=sE;function uE(e){return Ss(this.__data__,e)>-1}var cE=uE;function fE(e,t){var r=this.__data__,n=Ss(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var lE=fE;function Wn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Wn.prototype.clear=eE;Wn.prototype.delete=oE;Wn.prototype.get=aE;Wn.prototype.has=cE;Wn.prototype.set=lE;var Cs=Wn,dE=un(mt,"Map"),ji=dE;function pE(){this.size=0,this.__data__={hash:new Jd,map:new(ji||Cs),string:new Jd}}var hE=pE;function yE(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var gE=yE;function mE(e,t){var r=e.__data__;return gE(t)?r[typeof t=="string"?"string":"hash"]:r.map}var Ns=mE;function bE(e){var t=Ns(this,e).delete(e);return this.size-=t?1:0,t}var vE=bE;function _E(e){return Ns(this,e).get(e)}var wE=_E;function TE(e){return Ns(this,e).has(e)}var AE=TE;function OE(e,t){var r=Ns(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var EE=OE;function Hn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Hn.prototype.clear=hE;Hn.prototype.delete=vE;Hn.prototype.get=wE;Hn.prototype.has=AE;Hn.prototype.set=EE;var Rs=Hn,IE="Expected a function";function Zu(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(IE);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(Zu.Cache||Rs),r}Zu.Cache=Rs;var xE=Zu,SE=500;function CE(e){var t=xE(e,function(n){return r.size===SE&&r.clear(),n}),r=t.cache;return t}var NE=CE,RE=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$E=/\\(\\)?/g,PE=NE(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(RE,function(r,n,i,o){t.push(i?o.replace($E,"$1"):n||r)}),t}),UE=PE;function BE(e){return e==null?"":I0(e)}var DE=BE;function ME(e,t){return Kt(e)?e:Qu(e,t)?[e]:UE(DE(e))}var $s=ME,LE=1/0;function kE(e){if(typeof e=="string"||Ln(e))return e;var t=e+"";return t=="0"&&1/e==-LE?"-0":t}var Ki=kE;function jE(e,t){t=$s(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[Ki(t[r++])];return r&&r==n?e:void 0}var ec=jE;function FE(e,t,r){var n=e==null?void 0:ec(e,t);return n===void 0?r:n}var VE=FE;function zE(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var Ih=zE,Xd=Qt?Qt.isConcatSpreadable:void 0;function KE(e){return Kt(e)||Yu(e)||!!(Xd&&e&&e[Xd])}var qE=KE;function xh(e,t,r,n,i){var o=-1,s=e.length;for(r||(r=qE),i||(i=[]);++o<s;){var a=e[o];t>0&&r(a)?t>1?xh(a,t-1,r,n,i):Ih(i,a):n||(i[i.length]=a)}return i}var GE=xh;function WE(e){var t=e==null?0:e.length;return t?GE(e,1):[]}var HE=WE;function JE(e){return Wu(_h(e,void 0,HE),e+"")}var XE=JE;function YE(){this.__data__=new Cs,this.size=0}var QE=YE;function ZE(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var eI=ZE;function tI(e){return this.__data__.get(e)}var rI=tI;function nI(e){return this.__data__.has(e)}var iI=nI,oI=200;function sI(e,t){var r=this.__data__;if(r instanceof Cs){var n=r.__data__;if(!ji||n.length<oI-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Rs(n)}return r.set(e,t),this.size=r.size,this}var aI=sI;function Jn(e){var t=this.__data__=new Cs(e);this.size=t.size}Jn.prototype.clear=QE;Jn.prototype.delete=eI;Jn.prototype.get=rI;Jn.prototype.has=iI;Jn.prototype.set=aI;var Wo=Jn;function uI(e,t){for(var r=-1,n=e==null?0:e.length,i=0,o=[];++r<n;){var s=e[r];t(s,r,e)&&(o[i++]=s)}return o}var cI=uI;function fI(){return[]}var lI=fI,dI=Object.prototype,pI=dI.propertyIsEnumerable,Yd=Object.getOwnPropertySymbols,hI=Yd?function(e){return e==null?[]:(e=Object(e),cI(Yd(e),function(t){return pI.call(e,t)}))}:lI,yI=hI;function gI(e,t,r){var n=t(e);return Kt(e)?n:Ih(n,r(e))}var mI=gI;function bI(e){return mI(e,Eh,yI)}var Qd=bI,vI=un(mt,"DataView"),yu=vI,_I=un(mt,"Promise"),gu=_I,wI=un(mt,"Set"),Mn=wI,Zd="[object Map]",TI="[object Object]",ep="[object Promise]",tp="[object Set]",rp="[object WeakMap]",np="[object DataView]",AI=an(yu),OI=an(ji),EI=an(gu),II=an(Mn),xI=an(Di),Yr=qn;(yu&&Yr(new yu(new ArrayBuffer(1)))!=np||ji&&Yr(new ji)!=Zd||gu&&Yr(gu.resolve())!=ep||Mn&&Yr(new Mn)!=tp||Di&&Yr(new Di)!=rp)&&(Yr=function(e){var t=qn(e),r=t==TI?e.constructor:void 0,n=r?an(r):"";if(n)switch(n){case AI:return np;case OI:return Zd;case EI:return ep;case II:return tp;case xI:return rp}return t});var ip=Yr,SI=mt.Uint8Array,op=SI,CI="__lodash_hash_undefined__";function NI(e){return this.__data__.set(e,CI),this}var RI=NI;function $I(e){return this.__data__.has(e)}var PI=$I;function ls(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Rs;++t<r;)this.add(e[t])}ls.prototype.add=ls.prototype.push=RI;ls.prototype.has=PI;var UI=ls;function BI(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var DI=BI;function MI(e,t){return e.has(t)}var LI=MI,kI=1,jI=2;function FI(e,t,r,n,i,o){var s=r&kI,a=e.length,u=t.length;if(a!=u&&!(s&&u>a))return!1;var c=o.get(e),l=o.get(t);if(c&&l)return c==t&&l==e;var p=-1,S=!0,x=r&jI?new UI:void 0;for(o.set(e,t),o.set(t,e);++p<a;){var E=e[p],z=t[p];if(n)var W=s?n(z,E,p,t,e,o):n(E,z,p,e,t,o);if(W!==void 0){if(W)continue;S=!1;break}if(x){if(!DI(t,function(T,k){if(!LI(x,k)&&(E===T||i(E,T,r,n,o)))return x.push(k)})){S=!1;break}}else if(!(E===z||i(E,z,r,n,o))){S=!1;break}}return o.delete(e),o.delete(t),S}var Sh=FI;function VI(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var zI=VI;function KI(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var Ch=KI,qI=1,GI=2,WI="[object Boolean]",HI="[object Date]",JI="[object Error]",XI="[object Map]",YI="[object Number]",QI="[object RegExp]",ZI="[object Set]",ex="[object String]",tx="[object Symbol]",rx="[object ArrayBuffer]",nx="[object DataView]",sp=Qt?Qt.prototype:void 0,iu=sp?sp.valueOf:void 0;function ix(e,t,r,n,i,o,s){switch(r){case nx:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case rx:return!(e.byteLength!=t.byteLength||!o(new op(e),new op(t)));case WI:case HI:case YI:return Ju(+e,+t);case JI:return e.name==t.name&&e.message==t.message;case QI:case ex:return e==t+"";case XI:var a=zI;case ZI:var u=n&qI;if(a||(a=Ch),e.size!=t.size&&!u)return!1;var c=s.get(e);if(c)return c==t;n|=GI,s.set(e,t);var l=Sh(a(e),a(t),n,i,o,s);return s.delete(e),l;case tx:if(iu)return iu.call(e)==iu.call(t)}return!1}var ox=ix,sx=1,ax=Object.prototype,ux=ax.hasOwnProperty;function cx(e,t,r,n,i,o){var s=r&sx,a=Qd(e),u=a.length,c=Qd(t),l=c.length;if(u!=l&&!s)return!1;for(var p=u;p--;){var S=a[p];if(!(s?S in t:ux.call(t,S)))return!1}var x=o.get(e),E=o.get(t);if(x&&E)return x==t&&E==e;var z=!0;o.set(e,t),o.set(t,e);for(var W=s;++p<u;){S=a[p];var T=e[S],k=t[S];if(n)var G=s?n(k,T,S,t,e,o):n(T,k,S,e,t,o);if(!(G===void 0?T===k||i(T,k,r,n,o):G)){z=!1;break}W||(W=S=="constructor")}if(z&&!W){var H=e.constructor,F=t.constructor;H!=F&&"constructor"in e&&"constructor"in t&&!(typeof H=="function"&&H instanceof H&&typeof F=="function"&&F instanceof F)&&(z=!1)}return o.delete(e),o.delete(t),z}var fx=cx,lx=1,ap="[object Arguments]",up="[object Array]",Ko="[object Object]",dx=Object.prototype,cp=dx.hasOwnProperty;function px(e,t,r,n,i,o){var s=Kt(e),a=Kt(t),u=s?up:ip(e),c=a?up:ip(t);u=u==ap?Ko:u,c=c==ap?Ko:c;var l=u==Ko,p=c==Ko,S=u==c;if(S&&hu(e)){if(!hu(t))return!1;s=!0,l=!1}if(S&&!l)return o||(o=new Wo),s||Oh(e)?Sh(e,t,r,n,i,o):ox(e,t,u,r,n,i,o);if(!(r&lx)){var x=l&&cp.call(e,"__wrapped__"),E=p&&cp.call(t,"__wrapped__");if(x||E){var z=x?e.value():e,W=E?t.value():t;return o||(o=new Wo),i(z,W,r,n,o)}}return S?(o||(o=new Wo),fx(e,t,r,n,i,o)):!1}var hx=px;function Nh(e,t,r,n,i){return e===t?!0:e==null||t==null||!en(e)&&!en(t)?e!==e&&t!==t:hx(e,t,r,n,Nh,i)}var Rh=Nh,yx=1,gx=2;function mx(e,t,r,n){var i=r.length,o=i,s=!n;if(e==null)return!o;for(e=Object(e);i--;){var a=r[i];if(s&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<o;){a=r[i];var u=a[0],c=e[u],l=a[1];if(s&&a[2]){if(c===void 0&&!(u in e))return!1}else{var p=new Wo;if(n)var S=n(c,l,u,e,t,p);if(!(S===void 0?Rh(l,c,yx|gx,n,p):S))return!1}}return!0}var bx=mx;function vx(e){return e===e&&!cr(e)}var $h=vx;function _x(e){for(var t=Eh(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,$h(i)]}return t}var wx=_x;function Tx(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var Ph=Tx;function Ax(e){var t=wx(e);return t.length==1&&t[0][2]?Ph(t[0][0],t[0][1]):function(r){return r===e||bx(r,e,t)}}var Ox=Ax;function Ex(e,t){return e!=null&&t in Object(e)}var Ix=Ex;function xx(e,t,r){t=$s(t,e);for(var n=-1,i=t.length,o=!1;++n<i;){var s=Ki(t[n]);if(!(o=e!=null&&r(e,s)))break;e=e[s]}return o||++n!=i?o:(i=e==null?0:e.length,!!i&&Xu(i)&&xs(s,i)&&(Kt(e)||Yu(e)))}var Sx=xx;function Cx(e,t){return e!=null&&Sx(e,t,Ix)}var Uh=Cx,Nx=1,Rx=2;function $x(e,t){return Qu(e)&&$h(t)?Ph(Ki(e),t):function(r){var n=VE(r,e);return n===void 0&&n===t?Uh(r,e):Rh(t,n,Nx|Rx)}}var Px=$x;function Ux(e){return function(t){return t?.[e]}}var Bx=Ux;function Dx(e){return function(t){return ec(t,e)}}var Mx=Dx;function Lx(e){return Qu(e)?Bx(Ki(e)):Mx(e)}var kx=Lx;function jx(e){return typeof e=="function"?e:e==null?Is:typeof e=="object"?Kt(e)?Px(e[0],e[1]):Ox(e):kx(e)}var Fx=jx;function Vx(e,t,r,n){if(!cr(e))return e;t=$s(t,e);for(var i=-1,o=t.length,s=o-1,a=e;a!=null&&++i<o;){var u=Ki(t[i]),c=r;if(u==="__proto__"||u==="constructor"||u==="prototype")return e;if(i!=s){var l=a[u];c=n?n(l,u,a):void 0,c===void 0&&(c=cr(l)?l:xs(t[i+1])?[]:{})}_1(a,u,c),a=a[u]}return e}var zx=Vx;function Kx(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var s=t[n],a=ec(e,s);r(a,s)&&zx(o,$s(s,e),a)}return o}var qx=Kx,Gx=32,tc=A1(function(e,t){var r=Li(t,Hu(tc));return p1(e,Gx,void 0,t,r)});tc.placeholder={};var Wx=tc;function Hx(e,t){return qx(e,t,function(r,n){return Uh(e,n)})}var Jx=Hx,Xx=XE(function(e,t){return e==null?{}:Jx(e,t)}),fp=Xx,Yx=4294967295,Qx=Yx-1,Zx=Math.floor,eS=Math.min;function tS(e,t,r,n){var i=0,o=e==null?0:e.length;if(o===0)return 0;t=r(t);for(var s=t!==t,a=t===null,u=Ln(t),c=t===void 0;i<o;){var l=Zx((i+o)/2),p=r(e[l]),S=p!==void 0,x=p===null,E=p===p,z=Ln(p);if(s)var W=n||E;else c?W=E&&(n||S):a?W=E&&S&&(n||!x):u?W=E&&S&&!x&&(n||!z):x||z?W=!1:W=n?p<=t:p<t;W?i=l+1:o=l}return eS(o,Qx)}var rS=tS;function nS(e,t,r){return rS(e,t,Fx(r,2))}var iS=nS,oS=1/0,iP=Mn&&1/Ch(new Mn([,-0]))[1]==oS?function(e){return new Mn(e)}:lh;var{WARN:oP,LOG:sP,DEBUG:aP,VERBOSE:sS,ERROR:aS}=$e.setup($e.INFO),Bh=(e,t,r="asc")=>r==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),rc=(e,t,r)=>Ge.structural(fp(t,e),fp(r,e)),Dh=(e,t,r="asc")=>Bh(e.ts,t.ts,r),uS=Wx(rc,["en","at"]);function Sr(e,t="asc"){return e.sort((r,n)=>Dh(r,n,t))}var Mh=(e,t)=>n0(new Date(e.ts),new Date(t.ts));var nc=e=>{let t=new Map;for(let r of e){if(!r)throw aS("falsy entry in applogs",e),new Error("falsy entry in applogs");let n=r.cid;t.has(n)?sS("Skipping duplicate applog:",[t.get(n),r]):t.set(n,r)}return Array.from(t.values())};function Lh(e){return typeof e=="string"&&e.startsWith("?")}function kh(e){return e.slice(1)}function Ps(e,t){let r={},n={};for(let[i,o]of Object.entries(e))if(Lh(o)){let s=kh(o),a=t[s];a?n[i]=a:r[i]=s}else n[i]=o;return[n,r]}function jh(e,t,r){let n;if(t){let i=typeof t;i==="string"?n=t===r:i==="function"?n=t(r):typeof t.has=="function"?n=t.has(r):Array.isArray(t)&&!Array.isArray(r)?n=t.includes(r):n=t===r}else n=t===r;return e.charAt(0)==="!"?!n:n}var Fh=function(t){for(var r=0,n=0,i=t.length;n<i;n++)r+=t[n];return r},lp=function(t){return Fh(t)/t.length},yt={max:function(e){return Math.max.apply(null,e)},min:function(e){return Math.min.apply(null,e)},range:function(e){return yt.max(e)-yt.min(e)},midrange:function(e){return yt.range(e)/2},sum:Fh,mean:lp,average:lp,median:function(e){e.sort(function(r,n){return r-n});var t=e.length/2;return t%1?e[t-.5]:(e[t-1]+e[t])/2},modes:function(e){if(!e.length)return[];var t={},r=0,n=[];return e.forEach(function(i){t[i]?t[i]++:t[i]=1,t[i]>r?(n=[i],r=t[i]):t[i]===r&&(n.push(i),r=t[i])}),n},variance:function(e){var t=yt.mean(e);return yt.mean(e.map(function(r){return Math.pow(r-t,2)}))},standardDeviation:function(e){return Math.sqrt(yt.variance(e))},meanAbsoluteDeviation:function(e){var t=yt.mean(e);return yt.mean(e.map(function(r){return Math.abs(r-t)}))},zScores:function(e){var t=yt.mean(e),r=yt.standardDeviation(e);return e.map(function(n){return(n-t)/r})}};yt.average=yt.mean;function ic(){return new Date().toISOString()}var{WARN:cS,LOG:uP,DEBUG:fS,VERBOSE:cP,ERROR:ds}=$e.setup($e.INFO);function Vh(e,t){let r=ic(),n=t;return e.map(o=>zh(o,{ts:r,threadForPv:n}))}function zh(e,{ts:t,threadForPv:r}={}){let n=Gh(e,t??ic()),i=Wh(n,r),o=th(i).toString();e.cid&&e.cid!==o&&cS("[finalizeApplogForInsert] overwriting wrong CID",{log:e,cid:o,logWithPv:i});let s={...i,cid:o};if(!Lu(s))throw ds(`Bogus Applog ${JSON.stringify(s)}`,Qp(s));return Object.freeze(s)}function Kh(e){return!!e.ts}function qh(e){return!!e.pv}function Gh(e,t){return Kh(e)?e:{...e,ts:t}}function Wh(e,t){if(e.pv!==void 0)return e;if(t){let{en:r,at:n}=e,i=t.findLast(s=>s.en==r&&s.at==n);if(rc(["en","at","vl","ts","ag"],e,i))throw ds("[withPvFrom] Same as previous:",{log:e,pv:i,thread:t});let o=(e.pv!==void 0?e.pv:i?.cid)??null;return{...e,pv:o}}else{if(!qh(e))throw ds("[withPvFrom] no thread and no pv:",e);return e}}function qi(e){let t=()=>(Re(()=>e.length<2&&fS(`joinThreads with count=${e.length}`)),Sr(nc(e.flatMap(i=>{let o=i.applogs;if(!o)throw ds("falsy applogs of thread",i),new Error("falsy applogs of thread");return o})))),r=Re(()=>t()),n=st(function(i,o){return Yt(i)?{init:Re(()=>t())}:{added:i.added.filter(s=>!this.hasApplog(s,!0)),removed:i.removed?.filter(s=>!!this.parents.some(u=>u===o?!1:u.hasApplog(s,!0)))}});return new Us(Re(()=>`join(~ ${e.map(i=>i.name).join(", ")})`),e,["?"],r,n)}var{WARN:dp,LOG:fP,DEBUG:pp,VERBOSE:Xr,ERROR:hp}=$e.setup($e.INFO),Us=class Hh extends gs{constructor(t,r,n,i,o,s=null){super(t,r,n,o?Pe.array([...i],{deep:!1,name:`${t}.array`}):i),this.name=t,this._initialLogs=i,this._eventMapper=o,this._writeMapper=s,Tr(this,{onParentUpdate:st}),o&&this.subscribeToParents()}static mapWrites(t,r,n){return new Hh(`${r}<${t.nameAndSizeUntracked}>`,t,t.filters,t._applogs,null,n)}_parentSubscriptions=null;insert(t){let r=this._writeMapper?this._writeMapper(t):t;if(!(this._writeMapper&&!r))return this.parents.forEach(n=>n.insert(r))}insertRaw(t){let r=this._writeMapper?this._writeMapper(t):t;if(!(this._writeMapper&&!r))return this.parents.forEach(n=>n.insertRaw(r))}subscribeToParents(){this._parentSubscriptions=new Map;let t=Ct(()=>{this.parents.length||dp("MappedThread has no parents",this),Xr(`[MappedThread: ${this.name}] subscribing to parents:`,this.parents.map(n=>n.name));let r=new Set([...this._parentSubscriptions.keys()]);for(let n of this.parents){r.delete(n)&&Xr(`[MappedThread: ${this.name}] Skipping re-sub to parent`,n.nameAndSizeUntracked),Xr(`[MappedThread: ${this.name}] sub to new parent`,n.nameAndSizeUntracked);let o=this.onParentUpdate.bind(this,n),s=n.subscribe(o);this._parentSubscriptions.set(n,s)}for(let n of r)Xr(`[MappedThread: ${this.name}] un-subscribing from old parent`,n.nameAndSizeUntracked),this._parentSubscriptions.get(n)(),this._parentSubscriptions.delete(n)})}subscribe(t){return this._parentSubscriptions||this.subscribeToParents(),super.subscribe(t)}triggerRemap(){if(!this._eventMapper)throw hp("triggerRemap on a thread that is not actually mapping?!",this.nameAndSizeUntracked);pp(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.length!==1&&dp(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap with parentCount=${this.parents.length} - not meant for this`),this.parents.forEach(t=>{this.onParentUpdate(t,{init:Re(()=>ar(t.applogs))})})}onParentUpdate(t,r){Xr(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate`,r);let n=this._eventMapper?this._eventMapper(r,t):r;if(this._eventMapper)if(Xr(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => mapped`,n),Yt(n))this._applogs.replace([...n.init]);else{for(let i of n.added)this._applogs.splice(iS(this._applogs,i,"ts"),0,i);if(n.removed){for(let i of n.removed)if(!this._applogs.remove(i))if(!Yt(r)&&r.removed?.includes(i))pp("Ignoring remove event for non-existent because it was part of parent event's removed",i,r);else throw hp(`MappedThread{${this.name}} toRemove contained log that doesn't exist`,i,{thread:this,event:r,mapResult:n})}}Xr(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => deps?`,Ei(this._applogs)),this.notifySubscribers(n)}get readOnly(){return!1}},{WARN:lP,LOG:dP,DEBUG:pP,VERBOSE:ou,ERROR:lS}=$e.setup($e.INFO),lr=Qe("rollingFilter",function(t,r,n={}){let i=Jh(r),o=mu(i),s=Pe.array(Re(function(){return o(t.applogs)}),{deep:!1,name:`${t.name} | ${n.name||`rollingFilter.array{${Zr(i)}}`}`}),a=p=>{let S;return Yt(p)?S={init:o(p.init)}:S={added:o(p.added),removed:p.removed},ou(`rollingFilter{${t.nameAndSizeUntracked} | ${n.name?` '${n.name}'}`:""} parentUpdate`,i,p,"=>",S),S},u=new Us(`${t.name} | ${n.name||`rollingFilter{${Zr(i)}}`}`,t,[...t.filters,...n.extraFilterName?[n.extraFilterName]:[]],s,a),c=Gl(()=>ar(r),p=>{ou(`rollingFilter<${t.nameAndSizeUntracked}>${n.name?` '${n.name}'`:""} patternUpdate`,i,"=>",p),i=p,o=mu(i),u.triggerRemap()}),l=Gr(s,()=>{ou(`rollingFilter<${Re(()=>t.name)}>${n.name?` '${n.name}'`:""} unobserve`,i),c(),l()});return u},{equals:jn,argsDebugName:(e,t,r)=>He({caller:"rollingFilter",thread:e,pattern:t,args:r})}),oc=Qe("rollingMapper",function(t,r,n={}){let i=Re(()=>r.call(null,{init:t.applogs},t));if(!Yt(i))throw lS("Initial run must return init event");let o=i.init;return new Us(`${t.name} | ${n.name||"rollingMapper"}`,t,[...t.filters,...n.extraFilterName?[n.extraFilterName]:[]],o,r)},{equals:jn,argsDebugName:(e,t,r)=>He({caller:"rollingMapper",thread:e,args:r})}),dS=Qe("rollingAcc",function(t,r,n,i={}){let o=st(n);return o({init:t.applogs},r),t.subscribe(s=>{o(s,r)}),r},{argsDebugName:(e,t,r,n)=>`rollingAcc{${e.nameAndSizeUntracked}${n?.name?` | ${n?.name}`:""}}`}),Jh=function(t){let r=Re(function(){return Object.fromEntries(Object.entries(ar(t)).map(([i,o])=>[ar(i),ar(o)]))});if(!Object.entries(r).length)throw new Error("Pattern is empty");return r};function mu(e){return function(r){return r.filter(function(i){for(let o of Object.keys(e)){let s=e[o];if(s===void 0)continue;let a=i[o.startsWith("!")?o.slice(1):o];if(!jh(o,s,a))return!1}return!0})}}var{WARN:pS,LOG:hS,DEBUG:yS,VERBOSE:gS,ERROR:Ho}=$e.setup($e.INFO),Xh=class extends gs{constructor(e,t=[],r){super(e,null,r,t),Tr(this,{})}purge(e){let t=this.applogs.length;return this._applogs=this.applogs.filter(r=>!e.includes(r.cid)),t-this.applogs.length}insert(e){let t=Vh(e,this);return this.insertRaw(t)}insertRaw(e){let t=nc(e);if(t.length!==e.length)throw Ho(`[insertRaw] duplicate applogs passed: ${e.length-t.length}`,{appLogsToInsert:e,deduplicated:t});let r=e.filter(o=>!Lu(o));if(r.length)throw Ho(`[insertRaw] bogus applogs passed: ${r.length}`,{bogus:r});let n=e.filter(o=>this.hasApplog(o,!1));if(n.length)throw Ho(`[insertRaw] already existing applogs passed: ${n.length}`,{existing:n});if(!e.length){pS("[insertRaw] skipping empty insert empty logs array");return}(!this.hasParents&&!(this instanceof Xn)?hS:yS)("Inserting:",e.length===1?e[0]:e,{ds:this}),Sr(e);let i=this._applogs.length&&Mh(e[0],this._applogs[this._applogs.length-1]);return this._applogs.push(...e),i&&Sr(this._applogs),this.notifySubscribers({added:e,removed:null}),this.persist(e),e}get readOnly(){return!1}},Xn=class bu extends Xh{constructor(t,r,n,i){super(t,r,n),this._readOnly=i,Tr(this,{_applogs:Pe.shallow})}static empty(t){return bu.fromArray([],t??"empty in-memory",!1)}static fromArray(t,r,n=!1){return new bu(r??"in-memory",t,[],n)}get readOnly(){return this._readOnly}async persist(t){if(gS("[InMem.persist] no persist for",t),this.readOnly)throw Ho("[persist] called for readOnly thread")}},{WARN:hP,LOG:yP,DEBUG:gP,VERBOSE:mP,ERROR:bP}=$e.setup($e.INFO);var bS=class{constructor(e,t,r=null){this.logsOfThisNode=e,this.variables=t,this.prevNode=r,Tr(this,{threadOfTrail:Me})}get record(){return this.variables}get threadOfTrail(){return this.prevNode?qi([this.logsOfThisNode,this.prevNode.threadOfTrail]):this.logsOfThisNode}get trailLogs(){return this.threadOfTrail.applogs}},Yh=class{constructor(e){this.nodes=e,Tr(this,{threadOfAllTrails:Me,size:Me,isEmpty:Me})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return Re(()=>this.records.length)}get records(){return fr(()=>this.nodes.map(({variables:e})=>e),{name:"QueryResult.records"})}get leafNodeThread(){return qi(fr(()=>this.nodes.map(({logsOfThisNode:e})=>e),{name:"QueryResult.leafNodeThread"}))}get leafNodeLogs(){return fr(()=>this.nodes.map(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogs"})}get threadOfAllTrails(){return qi(fr(()=>this.nodes.map(e=>e.threadOfTrail),{name:"QueryResult.threadOfAllTrails"}))}get thread(){return this.threadOfAllTrails}get allApplogs(){return this.threadOfAllTrails.applogs}},{WARN:TU,LOG:Bs,DEBUG:dr,VERBOSE:Ae,ERROR:cn}=$e.setup($e.INFO,{prefix:"[q]"}),vS=Qe("lastWriteWins",function(t,{inverseToOnlyReturnFirstLogs:r,tolerateAlreadyFiltered:n}={}){if(Ae(`lastWriteWins${r?".inversed":""} < ${t.nameAndSizeUntracked} > initializing`),t.filters.includes("lastWriteWins")){if(n)return dr("[lastWriteWins] already filtered, but tolerateAlreadyFiltered=true, so returning"),t;throw cn("thread already filtered lastWriteWins:",t.filters,{name:t.name})}let i,o=oc(t,function(a,u){let c=Yt(a),l,p=[],S=c?null:[];c?(i=new Map,l=a.init):l=a.added;let x;for(let E=r?0:l.length-1;r?E<l.length:E>=0;r?E++:E--){let z=l[E],W=z.en+"|"+z.at;if(x&&(r?x>z.ts:x<z.ts))throw cn("lastWriteWins.mapper logs not sorted:",x,r?">":"<",z.ts,{log:z,i:E,newLogs:l,inverseToOnlyReturnFirstLogs:r});x=z.ts;let T=i.get(W);(!T||(r?T.ts>z.ts:T.ts<z.ts))&&(T&&!c&&S.push(T),p.push(z),i.set(W,z))}return Sr(p),Ae.isDisabled||Ae(`lastWriteWins${r?".inversed":""}<${t.nameAndSizeUntracked}> mapped event`,c?{...Object.fromEntries(Object.entries(a).map(([E,z])=>[E,z?.length])),toAdd:p.length,toRemove:S}:{...a,toAdd:p,toRemove:S}),c?{init:p}:{added:p,removed:S}},{name:`lastWriteWins${r?".inversed":""}`,extraFilterName:"lastWriteWins"});return Ae.isDisabled||Ct(()=>{Ae(`lastWriteWins<${t.nameAndSizeUntracked}> filtered down to`,o.applogs.length)}),o},{equals:jn,argsDebugName:e=>He({caller:"lastWriteWins",thread:e})}),AU=Qe("withoutDeleted",function(t){if(Ae.isEnabled&&Ae(`withoutDeleted<${t.nameAndSizeUntracked}>`),t.filters.includes("withoutDeleted"))throw cn("thread already filtered withoutDeleted:",t.filters,{name:t.name});let r=lr(t,{at:["isDeleted","relation/isDeleted","block/isDeleted"],vl:!0},{name:"isDeleted"});Ae.isEnabled&&Ae(`withoutDeleted<${t.nameAndSizeUntracked}> deletionLogs:`,Re(function(){return[...r.applogs]}));let n=He({caller:"allDeletedEntities",thread:t}),i=Ap(function(){return r.map(s=>s.en)},{name:n});return Ae.isEnabled&&Ct(()=>{Ae(`withoutDeleted<${t.nameAndSizeUntracked}> deleted:`,[...i])}),lr(t,{"!en":i},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:jn}),Qh=Qe("query",function e(t,r,n={},i={}){let o=Zh(t);dr(`query<${o.nameAndSizeUntracked}>:`,r);let s=Array.isArray(r)?r:[r],a;if(s.length===1)a=null;else{let l=s.slice(0,-1);a=e(o,l,n,i)}let u=s[s.length-1],c=_S(o,a,u,i);return Ae.isDisabled||Ct(()=>Ae("query result:",ar(c))),c},{equals:ys,argsDebugName:(e,t,r)=>He({caller:"query",thread:e,args:r?{pattern:t,startVars:r}:t})}),_S=Qe("queryStep",function(t,r,n,i={}){if(dr(`queryStep<${t.nameAndSizeUntracked}> with`,r?.untrackedSize??"all","nodes, pattern:",n),!Object.entries(n).length)throw new Error("Pattern is empty");function o(a){let[u,c]=Ps(n,a?.variables??{});Ae("[queryStep.doQuery] patternWithoutVars: ",u);let l=lr(t,u),p=Ds(c),S=fr(function(){let E=l.map(z=>({log:z,vars:p(z)}));return Ae.isEnabled&&Ae("[queryStep.doQuery] step node:",a?.variables," =>",E,"from:",Re(()=>l.applogs)),E.map(({log:z,vars:W})=>{let T=Object.assign({},a?.variables,W);return new bS(_u.fromArray([z],He({caller:"QueryNode",thread:l,pattern:`${Zr(T)}@${Zr(u)}`})),T,a)})},{name:He({caller:"doQuery.mapNodes",thread:l,pattern:n})});return Ae.isEnabled&&Ct(()=>Ae("[queryStep.doQuery] resultNodes:",[...S])),i.debug&&Bs("[queryStep] step result:",Re(()=>S.map(({variables:x,logsOfThisNode:E})=>({variables:x,thread:E})))),S}let s=fr(function(){return dr(`[queryStep] Running with ${r?.nodes?.length} input nodes:`),r?[...r.nodes.flatMap(o)]:[...o(null)]},{name:He({caller:"queryStep",thread:t,pattern:n})});return Ae.isEnabled&&Ct(()=>Ae("[queryStep] observableResultNodes:",[...s])),new Yh(s)},{equals:ys,argsDebugName:(e,t,r)=>He({caller:"queryStep",thread:e,pattern:r})}),OU=Qe("queryNot",function(t,r,n,i={}){let o=r.nodes;dr(`queryNot<${t.nameAndSizeUntracked}> from: ${o.length} nodes`);let s=Array.isArray(n)?n:[n];for(let a of s){if(!Object.entries(n).length)throw new Error("Pattern is empty");o=o.filter(function({variables:c}){let[l,p]=Ps(a,c??{});Ae("[queryNot] patternWithoutVars: ",l);let S=lr(t,l);return Ae("[queryNot] step node:",c," =>",S.size,"applogs"),Ae.isDisabled||Ae("[queryNot] step node:",c," => empty?",Re(()=>S.applogs)),i.debug&&Bs("[queryNot] node result:",c,"=>",S.applogs),S.isEmpty})}return new Yh(o)},{equals:ys,argsDebugName:(e,t,r)=>He({caller:"queryNot",thread:e,pattern:r})}),EU=Qe("filterAndMap",function(t,r,n){dr(`filterAndMap<${t.nameAndSizeUntracked}>`,r);let i=lr(t,r);Ae("[filterAndMap] filtered:",i.untrackedSize),Ae.isDisabled||Ct(()=>Ae("[filterAndMap] filtered:",i.applogs));let o=He({thread:t,pattern:r,caller:"filterAndMap"}),s=fr(()=>AS(i,n),{name:o});return Ae.isDisabled||Ct(()=>Ae("[filterAndMap] mapped:",s)),s},{equals:Ge.structural,argsDebugName:(e,t)=>He({caller:"filterAndMap",thread:e,pattern:t})}),IU=Qe("queryAndMap",function(t,r,n,i={}){let o=Zh(t);dr(`queryAndMap<${o.nameAndSizeUntracked}>`,{patternOrPatterns:r,variables:i,map:n});let s=He({thread:o,caller:"queryAndMap"}),a=Qh(o,r);Ae("[queryAndMap] filtered count:",a.untrackedSize);let u=fr(()=>OS(a,n),{name:s});return Ae.isDisabled||Ct(()=>Ae("[queryAndMap] result:",ar(u))),u},{equals:Ge.structural,argsDebugName:(e,t)=>He({caller:"queryAndMap",thread:e,pattern:t})}),xU=Qe("queryEntity",function(t,r,n,i){dr(`queryEntity<${t.nameAndSizeUntracked}>`,n,r);let o=lr(t,{en:n,at:ES(r,i)});return Ae("queryEntity applogs:",o.applogs),Me(()=>o.isEmpty?null:Object.fromEntries(o.map(({at:s,vl:a})=>[s.slice(r.length+1),a])))},{equals:Tp,argsDebugName:(e,t,r)=>He({caller:"queryEntity",thread:e,args:{name:t,entityID:r}})}),SU=Qe("agentsOfThread",function(t){dr(`agentsOfThread<${t.nameAndSizeUntracked}>`);let r=Pe.map(),n=st(o=>{for(let s of Yt(o)?o.init:o.added){let a=r.get(s.ag)??0;r.set(s.ag,a+1)}for(let s of!Yt(o)&&o.removed||[]){let a=r.get(s.ag);if(!a||a<1)throw cn("[agentsOfThread] number is now negative",{log:s,event:o,mapped:r,prev:a});r.set(s.ag,a-1)}Bs(`agentsOfThread<${t.nameAndSizeUntracked}> processed event`,{event:o,mapped:r})});n({init:t.applogs});let i=t.subscribe(n);return Pn(r,i),r}),wS=Qe("entityOverlap",function(t,r){return Bs(`entityOverlap<${t.nameAndSizeUntracked}, ${r.nameAndSizeUntracked}>`),Me(()=>{let n=new Set(t.map(o=>o.en)),i=new Set(r.map(o=>o.en));return[...n].filter(o=>i.has(o))})});var CU=Qe("entityOverlapCount",function(t,r){return Me(()=>wS(t,r).get().length)}),TS=Qe("querySingle",function(t,r,n={}){let i=Qh(t,r,n);return Me(()=>{if(i.isEmpty)return null;if(i.size>1)throw cn("[querySingle] got",i.size,"results:",i);let o=i.nodes[0].logsOfThisNode;if(o.size!=1)throw cn("[querySingle] single result, but got",o.size,"logs:",o.applogs);return o.applogs[0]})},{equals:Ge.structural,argsDebugName:(e,t)=>He({caller:"querySingle",thread:e,pattern:t})}),NU=Qe("querySingleAndMap",function(t,r,n,i={}){let o=TS(t,r,i);return Me(()=>{let s=o.get();if(s)return typeof n=="string"?s[n]:Ds(n)(s)})},{equals:Ge.structural,argsDebugName:(e,t)=>He({caller:"querySingleAndMap",thread:e,pattern:t})}),AS=function(t,r){return typeof r=="function"?t.map(r):typeof r=="string"?t.map(n=>n[r]):t.map(Ds(r))},OS=function(t,r){return typeof r=="function"?t.records.map(r):typeof r=="string"?t.nodes.map(n=>{if(!Object.hasOwn(n.record,r)){if(n.logsOfThisNode.size!==1)throw cn(`not sure what to map (it's not a var and a result node log count of ${n.logsOfThisNode.size})`);return n.logsOfThisNode.firstLog[r]}return n.record[r]}):t.nodes.map(n=>Ds(r)(t))};function Ds(e){return t=>Object.entries(e).reduce((r,[n,i])=>(r[i]=t[n],r),{})}function ES(e,t){return t.map(r=>IS(e,r))}function IS(e,t){return`${e}/${t}`}function Zh(e){return Array.isArray(e)?Xn.fromArray(e,`threadFromArray[${e.length}]`,!0):e}var CS=Le({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js"(e,t){"use strict";t.exports=s;var r=128,n=127,i=~n,o=Math.pow(2,31);function s(a,u,c){if(Number.MAX_SAFE_INTEGER&&a>Number.MAX_SAFE_INTEGER)throw s.bytes=0,new RangeError("Could not encode varint");u=u||[],c=c||0;for(var l=c;a>=o;)u[c++]=a&255|r,a/=128;for(;a&i;)u[c++]=a&255|r,a>>>=7;return u[c]=a|0,s.bytes=c-l+1,u}}}),NS=Le({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/decode.js"(e,t){"use strict";t.exports=i;var r=128,n=127;function i(o,u){var a=0,u=u||0,c=0,l=u,p,S=o.length;do{if(l>=S||c>49)throw i.bytes=0,new RangeError("Could not decode varint");p=o[l++],a+=c<28?(p&n)<<c:(p&n)*Math.pow(2,c),c+=7}while(p>=r);return i.bytes=l-u,a}}}),RS=Le({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/length.js"(e,t){"use strict";var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),s=Math.pow(2,35),a=Math.pow(2,42),u=Math.pow(2,49),c=Math.pow(2,56),l=Math.pow(2,63);t.exports=function(p){return p<r?1:p<n?2:p<i?3:p<o?4:p<s?5:p<a?6:p<u?7:p<c?8:p<l?9:10}}}),lc=Le({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/index.js"(e,t){"use strict";t.exports={encode:CS(),decode:NS(),encodingLength:RS()}}}),jU=new Uint8Array(0);function $S(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function dc(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}function PS(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(r[s]!==255)throw new TypeError(o+" is ambiguous");r[s]=i}var a=e.length,u=e.charAt(0),c=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function p(E){if(E instanceof Uint8Array||(ArrayBuffer.isView(E)?E=new Uint8Array(E.buffer,E.byteOffset,E.byteLength):Array.isArray(E)&&(E=Uint8Array.from(E))),!(E instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(E.length===0)return"";for(var z=0,W=0,T=0,k=E.length;T!==k&&E[T]===0;)T++,z++;for(var G=(k-T)*l+1>>>0,H=new Uint8Array(G);T!==k;){for(var F=E[T],Y=0,V=G-1;(F!==0||Y<W)&&V!==-1;V--,Y++)F+=256*H[V]>>>0,H[V]=F%a>>>0,F=F/a>>>0;if(F!==0)throw new Error("Non-zero carry");W=Y,T++}for(var ae=G-W;ae!==G&&H[ae]===0;)ae++;for(var L=u.repeat(z);ae<G;++ae)L+=e.charAt(H[ae]);return L}function S(E){if(typeof E!="string")throw new TypeError("Expected String");if(E.length===0)return new Uint8Array;var z=0;if(E[z]!==" "){for(var W=0,T=0;E[z]===u;)W++,z++;for(var k=(E.length-z)*c+1>>>0,G=new Uint8Array(k);E[z];){var H=r[E.charCodeAt(z)];if(H===255)return;for(var F=0,Y=k-1;(H!==0||F<T)&&Y!==-1;Y--,F++)H+=a*G[Y]>>>0,G[Y]=H%256>>>0,H=H/256>>>0;if(H!==0)throw new Error("Non-zero carry");T=F,z++}if(E[z]!==" "){for(var V=k-T;V!==k&&G[V]===0;)V++;for(var ae=new Uint8Array(W+(k-V)),L=W;V!==k;)ae[L++]=G[V++];return ae}}}function x(E){var z=S(E);if(z)return z;throw new Error(`Non-${t} character`)}return{encode:p,decodeUnsafe:S,decode:x}}var US=PS,BS=US,DS=BS,MS=class{name;prefix;baseEncode;constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},LS=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,r){this.name=e,this.prefix=t;let n=t.codePointAt(0);if(n===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n,this.baseDecode=r}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return ay(this,e)}},kS=class{decoders;constructor(e){this.decoders=e}or(e){return ay(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r!=null)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function ay(e,t){return new kS({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var jS=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new MS(e,t,r),this.decoder=new LS(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function uy({name:e,prefix:t,encode:r,decode:n}){return new jS(e,t,r,n)}function Vs({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=DS(r,e);return uy({prefix:t,name:e,encode:n,decode:o=>dc(i(o))})}function FS(e,t,r,n){let i={};for(let l=0;l<t.length;++l)i[t[l]]=l;let o=e.length;for(;e[o-1]==="=";)--o;let s=new Uint8Array(o*r/8|0),a=0,u=0,c=0;for(let l=0;l<o;++l){let p=i[e[l]];if(p===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|p,a+=r,a>=8&&(a-=8,s[c++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return s}function VS(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let u=0;u<e.length;++u)for(a=a<<8|e[u],s+=8;s>r;)s-=r,o+=t[i&a>>s];if(s!==0&&(o+=t[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o}function pr({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return uy({prefix:t,name:e,encode(i){return VS(i,n,r)},decode(i){return FS(i,n,r,e)}})}var Ls=pr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),FU=pr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),VU=pr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),zU=pr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),KU=pr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),qU=pr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),GU=pr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),WU=pr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),HU=pr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),sc=Vs({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),JU=Vs({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Cr=Vs({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),XU=Vs({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),zS=cy,ey=128,KS=127,qS=~KS,GS=Math.pow(2,31);function cy(e,t,r){t=t||[],r=r||0;for(var n=r;e>=GS;)t[r++]=e&255|ey,e/=128;for(;e&qS;)t[r++]=e&255|ey,e>>>=7;return t[r]=e|0,cy.bytes=r-n+1,t}var WS=ac,HS=128,ty=127;function ac(e,n){var r=0,n=n||0,i=0,o=n,s,a=e.length;do{if(o>=a)throw ac.bytes=0,new RangeError("Could not decode varint");s=e[o++],r+=i<28?(s&ty)<<i:(s&ty)*Math.pow(2,i),i+=7}while(s>=HS);return ac.bytes=o-n,r}var JS=Math.pow(2,7),XS=Math.pow(2,14),YS=Math.pow(2,21),QS=Math.pow(2,28),ZS=Math.pow(2,35),eC=Math.pow(2,42),tC=Math.pow(2,49),rC=Math.pow(2,56),nC=Math.pow(2,63),iC=function(e){return e<JS?1:e<XS?2:e<YS?3:e<QS?4:e<ZS?5:e<eC?6:e<tC?7:e<rC?8:e<nC?9:10},oC={encode:zS,decode:WS,encodingLength:iC},sC=oC,ks=sC;function uc(e,t=0){return[ks.decode(e,t),ks.decode.bytes]}function js(e,t,r=0){return ks.encode(e,t,r),t}function Fs(e){return ks.encodingLength(e)}function aC(e,t){let r=t.byteLength,n=Fs(e),i=n+Fs(r),o=new Uint8Array(i+r);return js(e,o,0),js(r,o,n),o.set(t,i),new pc(e,r,t,o)}function uC(e){let t=dc(e),[r,n]=uc(t),[i,o]=uc(t.subarray(n)),s=t.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new pc(r,i,s,t)}function cC(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&$S(e.bytes,r.bytes)}}var pc=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function ry(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return lC(r,cc(e),t??Cr.encoder);default:return dC(r,cc(e),t??Ls.encoder)}}var ny=new WeakMap;function cc(e){let t=ny.get(e);if(t==null){let r=new Map;return ny.set(e,r),r}return t}var fy=class tt{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==Gi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==pC)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return tt.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:r}=this.multihash,n=aC(t,r);return tt.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return tt.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&cC(t.multihash,n.multihash)}toString(t){return ry(this,t)}toJSON(){return{"/":ry(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof tt)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new tt(n,i,o,s??iy(n,i,o.bytes))}else if(r[hC]===!0){let{version:n,multihash:i,code:o}=r,s=uC(i);return tt.create(n,o,s)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==Gi)throw new Error(`Version 0 CID must use dag-pb (code: ${Gi}) block encoding`);return new tt(t,r,n,n.bytes)}case 1:{let i=iy(t,r,n.bytes);return new tt(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return tt.create(0,Gi,t)}static createV1(t,r){return tt.create(1,t,r)}static decode(t){let[r,n]=tt.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=tt.inspectBytes(t),n=r.size-r.multihashSize,i=dc(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new pc(r.multihashCode,r.digestSize,o,i);return[r.version===0?tt.createV0(s):tt.createV1(r.codec,s),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[p,S]=uc(t.subarray(r));return r+=S,p},i=n(),o=Gi;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),u=n(),c=r+u,l=c-s;return{version:i,codec:o,multihashCode:a,digestSize:u,multihashSize:l,size:c}}static parse(t,r){let[n,i]=fC(t,r),o=tt.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return cc(o).set(n,t),o}};function fC(e,t){switch(e[0]){case"Q":{let r=t??Cr;return[Cr.prefix,r.decode(`${Cr.prefix}${e}`)]}case Cr.prefix:{let r=t??Cr;return[Cr.prefix,r.decode(e)]}case Ls.prefix:{let r=t??Ls;return[Ls.prefix,r.decode(e)]}case sc.prefix:{let r=t??sc;return[sc.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function lC(e,t,r){let{prefix:n}=r;if(n!==Cr.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let o=r.encode(e).slice(1);return t.set(n,o),o}else return i}function dC(e,t,r){let{prefix:n}=r,i=t.get(n);if(i==null){let o=r.encode(e);return t.set(n,o),o}else return i}var Gi=112,pC=18;function iy(e,t,r){let n=Fs(e),i=n+Fs(t),o=new Uint8Array(i+r.byteLength);return js(e,o,0),js(t,o,n),o.set(r,i),o}var hC=Symbol.for("@ipld/js-cid/CID"),ly=42;function yC(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=fy.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new ee(B.tag,ly),new ee(B.bytes,r)]}function gC(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function mC(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}var oy={float64:!0,typeEncoders:{Object:yC,undefined:gC,number:mC}},YU={...oy,typeEncoders:{...oy.typeEncoders}};function bC(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return fy.decode(e.subarray(1))}var fc={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};fc.tags[ly]=bC;var QU={...fc,tags:fc.tags.slice()};var ZU=Nt(lc(),1);var Nr={Null:e=>e===null?e:void 0,Int:e=>Number.isInteger(e)?e:void 0,Float:e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,String:e=>typeof e=="string"?e:void 0,Bool:e=>typeof e=="boolean"?e:void 0,Bytes:e=>e instanceof Uint8Array?e:void 0,Link:e=>e!==null&&typeof e=="object"&&e.asCID===e?e:void 0,List:e=>Array.isArray(e)?e:void 0,Map:e=>e!==null&&typeof e=="object"&&e.asCID!==e&&!Array.isArray(e)&&!(e instanceof Uint8Array)?e:void 0},Wi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Nr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Nr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Wi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=Wi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Nr.Int,CarV1HeaderOrV2Pragma:e=>{if(Nr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,s]=t[i];switch(o){case"roots":{let a=Wi["CarV1HeaderOrV2Pragma > roots (anon)"](e[o]);if(a===void 0)return;if(a!==s||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=a}}break;case"version":{n--;let a=Wi.Int(e[o]);if(a===void 0)return;if(a!==s||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=a}}break;default:return}}if(!(n>0))return r}},Hi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Nr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Nr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Hi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=Hi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Nr.Int,CarV1HeaderOrV2Pragma:e=>{if(Nr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,s]=t[i];switch(o){case"roots":{let a=Hi["CarV1HeaderOrV2Pragma > roots (anon)"](s);if(a===void 0)return;if(a!==s||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=a}}break;case"version":{n--;let a=Hi.Int(s);if(a===void 0)return;if(a!==s||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=a}}break;default:return}}if(!(n>0))return r}},eB={toTyped:Wi.CarV1HeaderOrV2Pragma,toRepresentation:Hi.CarV1HeaderOrV2Pragma},tB=$u(),rB=Nt(lc(),1),nB=[new ee(B.map,2),new ee(B.string,"version"),new ee(B.uint,1),new ee(B.string,"roots")],iB=new ee(B.tag,42);var oB=Nt(lc(),1);var{WARN:dy,LOG:sB,DEBUG:sy,VERBOSE:hc,ERROR:Ms}=$e.setup($e.INFO);async function yc(e){let t=await py(e);return await gc(t)}async function gc({rootCID:e,blockStore:t},r=[]){if(!e||!t)throw Ms("Empty roots/blocks",{rootCID:e,blockStore:t});let n=await Yn(t,e),i,o=null,s=null;if(hc("[decodePubFromBlocks] root:",e.toString(),n,{blockStore:t}),!n)throw Ms("root not found in blockStore",{blockStore:t,rootCID:e});if(n?.info){o=n.applogs;let l=await Yn(t,o);i=await _C(l,t),s=await Yn(t,n.info),sy("new format - infoLogs",s.logs.map(p=>({[p.toString()]:p})))}else i=n.applogs;let a=async l=>{let p=l,S=await Yn(t,p);if(!S)throw Ms("Could not find applog CID in pub blocks:",p.toString(),{cid:p,root:n,blockStore:t}),new Error(`Could not find applog CID in pub blocks: ${p.toString()}`);return S.pv instanceof $t&&(S.pv=S.pv.toV1().toString()),{...S,cid:p.toV1().toString()}},u;if(u=await Promise.all(i.map(a)),n.prev){if(Es(n.prev,e)||Vu(r,n.prev))throw Ms("[pubFromBlocks] pub chain has a loop",{rootCID:e,prev:n.prev,recursionTrace:r});u=u.concat((await gc({rootCID:n.prev,blockStore:t},[...r,e])).applogs)}let c={cid:e,info:{...s,logs:await Promise.all(s.logs.map(a))},applogsCID:o,applogs:u};return sy("[decodePubFromBlocks] result:",c,{rootCID:e.toString(),root:n,blockStore:t,applogs:u,info:s}),c}async function py(e){let r=(await e.getRoots()).map(i=>(typeof i.toV1=="function"?i:$t.decode(i.bytes)).toV1().toString()),n=new Map;for await(let{cid:i,bytes:o}of e.blocks()){let s=typeof i.toV1=="function"?i:$t.decode(i.bytes);hc({cidFromCarblocks:i,cid:s}),n.set(s.toV1().toString(),o)}return r.length!==1&&dy("Unexpected roots count:",r),{rootCID:$t.parse(r[0]),blockStore:{get:i=>n.get(i.toV1().toString())}}}async function Yn(e,t){try{var r=await e.get(t);if(!r)return dy("returning null"),null}catch(n){if(n.message==="Not Found")return null;throw n}return Ts(r)}function mc(e){return async function*(){for(;;){let{done:t,value:r}=await e.read();if(hc("[car] chunk",{done:t,value:r}),t)break;yield r}}()}var{WARN:aB,LOG:uB,DEBUG:cB,VERBOSE:fB,ERROR:vC}=$e.setup($e.INFO);async function _C(e,t){return wC(e)?(await Promise.all(e.chunks.map(async r=>{let n=await Yn(t,r);if(!n.logs)throw vC("Weird chunk",n);return n.logs}))).flat():e.logs}function wC(e){return e.chunks}var{WARN:Ks,LOG:t2,DEBUG:Ji,VERBOSE:r2,ERROR:zs}=Xs.setup(Xs.INFO);async function n2(e,t,{readOnly:r=!0,pinnedCID:n}={}){let{cid:i,errors:o,isIpns:s}=Fu(t);if(!i)throw zs("Failed to parse pubID",t,o);Ji("[retrieveThread] parsedPubID",i);let a;if(n)Ji("[retrieveThread] using pinnedCID"),s||Ks("pubID isn't IPNS, but pinnedCID different:",{pubID:t,pinnedCID:n}),a=tr.parse(n);else if(!s)Ji("[retrieveThread] pubID is not IPNS - using as CID"),a=i;else{if(!t)throw zs("[retrieveThread] neither pubID nor pinnedCID provided");try{a=await TC(e.baseUrl,t),Ji("Resolved pub to CID",a.toString())}catch(x){throw zs(`Failed to resolve IPNS ${t}:`,x)}}let u=await AC(e.gatewayBaseUrl,a),{applogs:c}=await yc(u),l=c.filter(x=>As(x));l.length&&Ks(`Found ${l.length} encrypted logs - skipping`);let p=c.filter(x=>!(x instanceof Uint8Array));Sr(p);let S=Xn.fromArray(p,`preview${t&&t!==a.toString()?"-"+t:""}@${a.toString()}`,r);return{cid:a,thread:S,encryptedCount:l.length}}async function TC(e,t){e=Ys(e);let n=await(await fetch(`${e}/name/${t}`)).json();return n.value.startsWith("/ipfs/")||Ks("IPNS value is not '/ipfs/..':",n),tr.parse(n.value.replace("/ipfs/",""))}async function AC(e,t){e=Ys(e),Ji("Retrieving:",t.toString(),"from",e);let r=`${e}/ipfs/${t}?format=car&dag-scope=all`,n=await fetch(r),i;if((!n?.ok||!n?.body)&&(i=zs(`[retrieveCar] unexpected response ${n?.statusText}`,{url:r}),Ks("Gateway failed:",r,i)),i=mc(n.body.getReader()),i instanceof Error)throw i;return await Dr.fromIterable(i)}export{n2 as a,TC as b,AC as c};
61
+ `)}var nA=rA;function iA(e){return function(){return e}}var oA=iA,sA=function(){try{var e=un(Object,"defineProperty");return e({},"",{}),e}catch{}}(),ls=sA,aA=ls?function(e,t){return ls(e,"toString",{configurable:!0,enumerable:!1,value:oA(t),writable:!0})}:xs,uA=aA,cA=hh(uA),Wu=cA;function fA(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var lA=fA;function dA(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}var pA=dA;function hA(e){return e!==e}var yA=hA;function gA(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}var mA=gA;function bA(e,t,r){return t===t?mA(e,t,r):pA(e,yA,r)}var vA=bA;function _A(e,t){var r=e==null?0:e.length;return!!r&&vA(e,t,0)>-1}var wA=_A,TA=1,AA=2,OA=8,EA=16,IA=32,xA=64,SA=128,CA=256,NA=512,RA=[["ary",SA],["bind",TA],["bindKey",AA],["curry",OA],["curryRight",EA],["flip",NA],["partial",IA],["partialRight",xA],["rearg",CA]];function $A(e,t){return lA(RA,function(r){var n="_."+r[0];t&r[1]&&!wA(e,n)&&e.push(n)}),e.sort()}var PA=$A;function UA(e,t,r){var n=t+"";return Wu(e,nA(n,PA(eA(n),r)))}var gh=UA,BA=1,DA=2,MA=4,LA=8,Ud=32,Bd=64;function kA(e,t,r,n,i,o,s,a,u,c){var l=t&LA,p=l?s:void 0,S=l?void 0:s,x=l?o:void 0,E=l?void 0:o;t|=l?Ud:Bd,t&=~(l?Bd:Ud),t&MA||(t&=~(BA|DA));var z=[e,t,i,x,p,E,S,a,u,c],W=r.apply(void 0,z);return qT(e)&&yh(W,z),W.placeholder=n,gh(W,e,t)}var mh=kA;function jA(e){var t=e;return t.placeholder}var Hu=jA,FA=9007199254740991,VA=/^(?:0|[1-9]\d*)$/;function zA(e,t){var r=typeof e;return t=t??FA,!!t&&(r=="number"||r!="symbol"&&VA.test(e))&&e>-1&&e%1==0&&e<t}var Ss=zA,KA=Math.min;function qA(e,t){for(var r=e.length,n=KA(t.length,r),i=ph(e);n--;){var o=t[n];e[n]=Ss(o,r)?i[o]:void 0}return e}var GA=qA,Dd="__lodash_placeholder__";function WA(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var s=e[r];(s===t||s===Dd)&&(e[r]=Dd,o[i++]=r)}return o}var Li=WA,HA=1,JA=2,XA=8,YA=16,QA=128,ZA=512;function bh(e,t,r,n,i,o,s,a,u,c){var l=t&QA,p=t&HA,S=t&JA,x=t&(XA|YA),E=t&ZA,z=S?void 0:Mi(e);function W(){for(var T=arguments.length,k=Array(T),G=T;G--;)k[G]=arguments[G];if(x)var H=Hu(W),F=ST(k,H);if(n&&(k=ch(k,n,i,x)),o&&(k=fh(k,o,s,x)),T-=F,x&&T<c){var Y=Li(k,H);return mh(e,t,bh,W.placeholder,r,k,Y,a,u,c-T)}var V=p?r:this,ae=S?V[e]:e;return T=k.length,a?k=GA(k,a):E&&T>1&&k.reverse(),l&&u<T&&(k.length=u),this&&this!==mt&&this instanceof W&&(ae=z||Mi(ae)),ae.apply(V,k)}return W}var vh=bh;function e1(e,t,r){var n=Mi(e);function i(){for(var o=arguments.length,s=Array(o),a=o,u=Hu(i);a--;)s[a]=arguments[a];var c=o<3&&s[0]!==u&&s[o-1]!==u?[]:Li(s,u);if(o-=c.length,o<r)return mh(e,t,vh,i.placeholder,void 0,s,c,void 0,void 0,r-o);var l=this&&this!==mt&&this instanceof i?n:e;return Ku(l,this,s)}return i}var t1=e1,r1=1;function n1(e,t,r,n){var i=t&r1,o=Mi(e);function s(){for(var a=-1,u=arguments.length,c=-1,l=n.length,p=Array(l+u),S=this&&this!==mt&&this instanceof s?o:e;++c<l;)p[c]=n[c];for(;u--;)p[c++]=arguments[++a];return Ku(S,i?r:this,p)}return s}var i1=n1,Md="__lodash_placeholder__",Za=1,o1=2,s1=4,Ld=8,Ri=128,kd=256,a1=Math.min;function u1(e,t){var r=e[1],n=t[1],i=r|n,o=i<(Za|o1|Ri),s=n==Ri&&r==Ld||n==Ri&&r==kd&&e[7].length<=t[8]||n==(Ri|kd)&&t[7].length<=t[8]&&r==Ld;if(!(o||s))return e;n&Za&&(e[2]=t[2],i|=r&Za?0:s1);var a=t[3];if(a){var u=e[3];e[3]=u?ch(u,a,t[4]):a,e[4]=u?Li(e[3],Md):t[4]}return a=t[5],a&&(u=e[5],e[5]=u?fh(u,a,t[6]):a,e[6]=u?Li(e[5],Md):t[6]),a=t[7],a&&(e[7]=a),n&Ri&&(e[8]=e[8]==null?t[8]:a1(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}var c1=u1,f1="Expected a function",jd=1,l1=2,eu=8,tu=16,ru=32,Fd=64,Vd=Math.max;function d1(e,t,r,n,i,o,s,a){var u=t&l1;if(!u&&typeof e!="function")throw new TypeError(f1);var c=n?n.length:0;if(c||(t&=~(ru|Fd),n=i=void 0),s=s===void 0?s:Vd(Nd(s),0),a=a===void 0?a:Nd(a),c-=i?i.length:0,t&Fd){var l=n,p=i;n=i=void 0}var S=u?void 0:dh(e),x=[e,t,r,n,i,l,p,o,s,a];if(S&&c1(x,S),e=x[0],t=x[1],r=x[2],n=x[3],i=x[4],a=x[9]=x[9]===void 0?u?0:e.length:Vd(x[9]-c,0),!a&&t&(eu|tu)&&(t&=~(eu|tu)),!t||t==jd)var E=wT(e,t,r);else t==eu||t==tu?E=t1(e,t,a):(t==ru||t==(jd|ru))&&!i.length?E=i1(e,t,r,n):E=vh.apply(void 0,x);var z=S?uh:yh;return gh(z(E,x),e,t)}var p1=d1;function h1(e,t,r){t=="__proto__"&&ls?ls(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var y1=h1;function g1(e,t){return e===t||e!==e&&t!==t}var Ju=g1,m1=Object.prototype,b1=m1.hasOwnProperty;function v1(e,t,r){var n=e[t];(!(b1.call(e,t)&&Ju(n,r))||r===void 0&&!(t in e))&&y1(e,t,r)}var _1=v1,zd=Math.max;function w1(e,t,r){return t=zd(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=zd(n.length-t,0),s=Array(o);++i<o;)s[i]=n[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=n[i];return a[t]=r(s),Ku(e,this,a)}}var _h=w1;function T1(e,t){return Wu(_h(e,t,xs),e+"")}var A1=T1,O1=9007199254740991;function E1(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=O1}var Xu=E1;function I1(e){return e!=null&&Xu(e.length)&&!ah(e)}var x1=I1,S1=Object.prototype;function C1(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||S1;return e===r}var N1=C1;function R1(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var $1=R1,P1="[object Arguments]";function U1(e){return en(e)&&qn(e)==P1}var Kd=U1,wh=Object.prototype,B1=wh.hasOwnProperty,D1=wh.propertyIsEnumerable,M1=Kd(function(){return arguments}())?Kd:function(e){return en(e)&&B1.call(e,"callee")&&!D1.call(e,"callee")},Yu=M1;function L1(){return!1}var k1=L1,Th=typeof exports=="object"&&exports&&!exports.nodeType&&exports,qd=Th&&typeof module=="object"&&module&&!module.nodeType&&module,j1=qd&&qd.exports===Th,Gd=j1?mt.Buffer:void 0,F1=Gd?Gd.isBuffer:void 0,V1=F1||k1,hu=V1,z1="[object Arguments]",K1="[object Array]",q1="[object Boolean]",G1="[object Date]",W1="[object Error]",H1="[object Function]",J1="[object Map]",X1="[object Number]",Y1="[object Object]",Q1="[object RegExp]",Z1="[object Set]",eO="[object String]",tO="[object WeakMap]",rO="[object ArrayBuffer]",nO="[object DataView]",iO="[object Float32Array]",oO="[object Float64Array]",sO="[object Int8Array]",aO="[object Int16Array]",uO="[object Int32Array]",cO="[object Uint8Array]",fO="[object Uint8ClampedArray]",lO="[object Uint16Array]",dO="[object Uint32Array]",De={};De[iO]=De[oO]=De[sO]=De[aO]=De[uO]=De[cO]=De[fO]=De[lO]=De[dO]=!0;De[z1]=De[K1]=De[rO]=De[q1]=De[nO]=De[G1]=De[W1]=De[H1]=De[J1]=De[X1]=De[Y1]=De[Q1]=De[Z1]=De[eO]=De[tO]=!1;function pO(e){return en(e)&&Xu(e.length)&&!!De[qn(e)]}var hO=pO;function yO(e){return function(t){return e(t)}}var gO=yO,Ah=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pi=Ah&&typeof module=="object"&&module&&!module.nodeType&&module,mO=Pi&&Pi.exports===Ah,nu=mO&&ih.process,bO=function(){try{var e=Pi&&Pi.require&&Pi.require("util").types;return e||nu&&nu.binding&&nu.binding("util")}catch{}}(),Wd=bO,Hd=Wd&&Wd.isTypedArray,vO=Hd?gO(Hd):hO,Oh=vO,_O=Object.prototype,wO=_O.hasOwnProperty;function TO(e,t){var r=Kt(e),n=!r&&Yu(e),i=!r&&!n&&hu(e),o=!r&&!n&&!i&&Oh(e),s=r||n||i||o,a=s?$1(e.length,String):[],u=a.length;for(var c in e)(t||wO.call(e,c))&&!(s&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Ss(c,u)))&&a.push(c);return a}var AO=TO;function OO(e,t){return function(r){return e(t(r))}}var EO=OO,IO=EO(Object.keys,Object),xO=IO,SO=Object.prototype,CO=SO.hasOwnProperty;function NO(e){if(!N1(e))return xO(e);var t=[];for(var r in Object(e))CO.call(e,r)&&r!="constructor"&&t.push(r);return t}var RO=NO;function $O(e){return x1(e)?AO(e):RO(e)}var Eh=$O,PO=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,UO=/^\w*$/;function BO(e,t){if(Kt(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Ln(e)?!0:UO.test(e)||!PO.test(e)||t!=null&&e in Object(t)}var Qu=BO,DO=un(Object,"create"),ki=DO;function MO(){this.__data__=ki?ki(null):{},this.size=0}var LO=MO;function kO(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var jO=kO,FO="__lodash_hash_undefined__",VO=Object.prototype,zO=VO.hasOwnProperty;function KO(e){var t=this.__data__;if(ki){var r=t[e];return r===FO?void 0:r}return zO.call(t,e)?t[e]:void 0}var qO=KO,GO=Object.prototype,WO=GO.hasOwnProperty;function HO(e){var t=this.__data__;return ki?t[e]!==void 0:WO.call(t,e)}var JO=HO,XO="__lodash_hash_undefined__";function YO(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ki&&t===void 0?XO:t,this}var QO=YO;function Gn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Gn.prototype.clear=LO;Gn.prototype.delete=jO;Gn.prototype.get=qO;Gn.prototype.has=JO;Gn.prototype.set=QO;var Jd=Gn;function ZO(){this.__data__=[],this.size=0}var eE=ZO;function tE(e,t){for(var r=e.length;r--;)if(Ju(e[r][0],t))return r;return-1}var Cs=tE,rE=Array.prototype,nE=rE.splice;function iE(e){var t=this.__data__,r=Cs(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():nE.call(t,r,1),--this.size,!0}var oE=iE;function sE(e){var t=this.__data__,r=Cs(t,e);return r<0?void 0:t[r][1]}var aE=sE;function uE(e){return Cs(this.__data__,e)>-1}var cE=uE;function fE(e,t){var r=this.__data__,n=Cs(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var lE=fE;function Wn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Wn.prototype.clear=eE;Wn.prototype.delete=oE;Wn.prototype.get=aE;Wn.prototype.has=cE;Wn.prototype.set=lE;var Ns=Wn,dE=un(mt,"Map"),ji=dE;function pE(){this.size=0,this.__data__={hash:new Jd,map:new(ji||Ns),string:new Jd}}var hE=pE;function yE(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var gE=yE;function mE(e,t){var r=e.__data__;return gE(t)?r[typeof t=="string"?"string":"hash"]:r.map}var Rs=mE;function bE(e){var t=Rs(this,e).delete(e);return this.size-=t?1:0,t}var vE=bE;function _E(e){return Rs(this,e).get(e)}var wE=_E;function TE(e){return Rs(this,e).has(e)}var AE=TE;function OE(e,t){var r=Rs(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var EE=OE;function Hn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Hn.prototype.clear=hE;Hn.prototype.delete=vE;Hn.prototype.get=wE;Hn.prototype.has=AE;Hn.prototype.set=EE;var $s=Hn,IE="Expected a function";function Zu(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(IE);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var s=e.apply(this,n);return r.cache=o.set(i,s)||o,s};return r.cache=new(Zu.Cache||$s),r}Zu.Cache=$s;var xE=Zu,SE=500;function CE(e){var t=xE(e,function(n){return r.size===SE&&r.clear(),n}),r=t.cache;return t}var NE=CE,RE=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$E=/\\(\\)?/g,PE=NE(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(RE,function(r,n,i,o){t.push(i?o.replace($E,"$1"):n||r)}),t}),UE=PE;function BE(e){return e==null?"":I0(e)}var DE=BE;function ME(e,t){return Kt(e)?e:Qu(e,t)?[e]:UE(DE(e))}var Ps=ME,LE=1/0;function kE(e){if(typeof e=="string"||Ln(e))return e;var t=e+"";return t=="0"&&1/e==-LE?"-0":t}var Ki=kE;function jE(e,t){t=Ps(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[Ki(t[r++])];return r&&r==n?e:void 0}var ec=jE;function FE(e,t,r){var n=e==null?void 0:ec(e,t);return n===void 0?r:n}var VE=FE;function zE(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var Ih=zE,Xd=Qt?Qt.isConcatSpreadable:void 0;function KE(e){return Kt(e)||Yu(e)||!!(Xd&&e&&e[Xd])}var qE=KE;function xh(e,t,r,n,i){var o=-1,s=e.length;for(r||(r=qE),i||(i=[]);++o<s;){var a=e[o];t>0&&r(a)?t>1?xh(a,t-1,r,n,i):Ih(i,a):n||(i[i.length]=a)}return i}var GE=xh;function WE(e){var t=e==null?0:e.length;return t?GE(e,1):[]}var HE=WE;function JE(e){return Wu(_h(e,void 0,HE),e+"")}var XE=JE;function YE(){this.__data__=new Ns,this.size=0}var QE=YE;function ZE(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var eI=ZE;function tI(e){return this.__data__.get(e)}var rI=tI;function nI(e){return this.__data__.has(e)}var iI=nI,oI=200;function sI(e,t){var r=this.__data__;if(r instanceof Ns){var n=r.__data__;if(!ji||n.length<oI-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new $s(n)}return r.set(e,t),this.size=r.size,this}var aI=sI;function Jn(e){var t=this.__data__=new Ns(e);this.size=t.size}Jn.prototype.clear=QE;Jn.prototype.delete=eI;Jn.prototype.get=rI;Jn.prototype.has=iI;Jn.prototype.set=aI;var Ho=Jn;function uI(e,t){for(var r=-1,n=e==null?0:e.length,i=0,o=[];++r<n;){var s=e[r];t(s,r,e)&&(o[i++]=s)}return o}var cI=uI;function fI(){return[]}var lI=fI,dI=Object.prototype,pI=dI.propertyIsEnumerable,Yd=Object.getOwnPropertySymbols,hI=Yd?function(e){return e==null?[]:(e=Object(e),cI(Yd(e),function(t){return pI.call(e,t)}))}:lI,yI=hI;function gI(e,t,r){var n=t(e);return Kt(e)?n:Ih(n,r(e))}var mI=gI;function bI(e){return mI(e,Eh,yI)}var Qd=bI,vI=un(mt,"DataView"),yu=vI,_I=un(mt,"Promise"),gu=_I,wI=un(mt,"Set"),Mn=wI,Zd="[object Map]",TI="[object Object]",ep="[object Promise]",tp="[object Set]",rp="[object WeakMap]",np="[object DataView]",AI=an(yu),OI=an(ji),EI=an(gu),II=an(Mn),xI=an(Di),Yr=qn;(yu&&Yr(new yu(new ArrayBuffer(1)))!=np||ji&&Yr(new ji)!=Zd||gu&&Yr(gu.resolve())!=ep||Mn&&Yr(new Mn)!=tp||Di&&Yr(new Di)!=rp)&&(Yr=function(e){var t=qn(e),r=t==TI?e.constructor:void 0,n=r?an(r):"";if(n)switch(n){case AI:return np;case OI:return Zd;case EI:return ep;case II:return tp;case xI:return rp}return t});var ip=Yr,SI=mt.Uint8Array,op=SI,CI="__lodash_hash_undefined__";function NI(e){return this.__data__.set(e,CI),this}var RI=NI;function $I(e){return this.__data__.has(e)}var PI=$I;function ds(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new $s;++t<r;)this.add(e[t])}ds.prototype.add=ds.prototype.push=RI;ds.prototype.has=PI;var UI=ds;function BI(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var DI=BI;function MI(e,t){return e.has(t)}var LI=MI,kI=1,jI=2;function FI(e,t,r,n,i,o){var s=r&kI,a=e.length,u=t.length;if(a!=u&&!(s&&u>a))return!1;var c=o.get(e),l=o.get(t);if(c&&l)return c==t&&l==e;var p=-1,S=!0,x=r&jI?new UI:void 0;for(o.set(e,t),o.set(t,e);++p<a;){var E=e[p],z=t[p];if(n)var W=s?n(z,E,p,t,e,o):n(E,z,p,e,t,o);if(W!==void 0){if(W)continue;S=!1;break}if(x){if(!DI(t,function(T,k){if(!LI(x,k)&&(E===T||i(E,T,r,n,o)))return x.push(k)})){S=!1;break}}else if(!(E===z||i(E,z,r,n,o))){S=!1;break}}return o.delete(e),o.delete(t),S}var Sh=FI;function VI(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var zI=VI;function KI(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var Ch=KI,qI=1,GI=2,WI="[object Boolean]",HI="[object Date]",JI="[object Error]",XI="[object Map]",YI="[object Number]",QI="[object RegExp]",ZI="[object Set]",ex="[object String]",tx="[object Symbol]",rx="[object ArrayBuffer]",nx="[object DataView]",sp=Qt?Qt.prototype:void 0,iu=sp?sp.valueOf:void 0;function ix(e,t,r,n,i,o,s){switch(r){case nx:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case rx:return!(e.byteLength!=t.byteLength||!o(new op(e),new op(t)));case WI:case HI:case YI:return Ju(+e,+t);case JI:return e.name==t.name&&e.message==t.message;case QI:case ex:return e==t+"";case XI:var a=zI;case ZI:var u=n&qI;if(a||(a=Ch),e.size!=t.size&&!u)return!1;var c=s.get(e);if(c)return c==t;n|=GI,s.set(e,t);var l=Sh(a(e),a(t),n,i,o,s);return s.delete(e),l;case tx:if(iu)return iu.call(e)==iu.call(t)}return!1}var ox=ix,sx=1,ax=Object.prototype,ux=ax.hasOwnProperty;function cx(e,t,r,n,i,o){var s=r&sx,a=Qd(e),u=a.length,c=Qd(t),l=c.length;if(u!=l&&!s)return!1;for(var p=u;p--;){var S=a[p];if(!(s?S in t:ux.call(t,S)))return!1}var x=o.get(e),E=o.get(t);if(x&&E)return x==t&&E==e;var z=!0;o.set(e,t),o.set(t,e);for(var W=s;++p<u;){S=a[p];var T=e[S],k=t[S];if(n)var G=s?n(k,T,S,t,e,o):n(T,k,S,e,t,o);if(!(G===void 0?T===k||i(T,k,r,n,o):G)){z=!1;break}W||(W=S=="constructor")}if(z&&!W){var H=e.constructor,F=t.constructor;H!=F&&"constructor"in e&&"constructor"in t&&!(typeof H=="function"&&H instanceof H&&typeof F=="function"&&F instanceof F)&&(z=!1)}return o.delete(e),o.delete(t),z}var fx=cx,lx=1,ap="[object Arguments]",up="[object Array]",qo="[object Object]",dx=Object.prototype,cp=dx.hasOwnProperty;function px(e,t,r,n,i,o){var s=Kt(e),a=Kt(t),u=s?up:ip(e),c=a?up:ip(t);u=u==ap?qo:u,c=c==ap?qo:c;var l=u==qo,p=c==qo,S=u==c;if(S&&hu(e)){if(!hu(t))return!1;s=!0,l=!1}if(S&&!l)return o||(o=new Ho),s||Oh(e)?Sh(e,t,r,n,i,o):ox(e,t,u,r,n,i,o);if(!(r&lx)){var x=l&&cp.call(e,"__wrapped__"),E=p&&cp.call(t,"__wrapped__");if(x||E){var z=x?e.value():e,W=E?t.value():t;return o||(o=new Ho),i(z,W,r,n,o)}}return S?(o||(o=new Ho),fx(e,t,r,n,i,o)):!1}var hx=px;function Nh(e,t,r,n,i){return e===t?!0:e==null||t==null||!en(e)&&!en(t)?e!==e&&t!==t:hx(e,t,r,n,Nh,i)}var Rh=Nh,yx=1,gx=2;function mx(e,t,r,n){var i=r.length,o=i,s=!n;if(e==null)return!o;for(e=Object(e);i--;){var a=r[i];if(s&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<o;){a=r[i];var u=a[0],c=e[u],l=a[1];if(s&&a[2]){if(c===void 0&&!(u in e))return!1}else{var p=new Ho;if(n)var S=n(c,l,u,e,t,p);if(!(S===void 0?Rh(l,c,yx|gx,n,p):S))return!1}}return!0}var bx=mx;function vx(e){return e===e&&!cr(e)}var $h=vx;function _x(e){for(var t=Eh(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,$h(i)]}return t}var wx=_x;function Tx(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var Ph=Tx;function Ax(e){var t=wx(e);return t.length==1&&t[0][2]?Ph(t[0][0],t[0][1]):function(r){return r===e||bx(r,e,t)}}var Ox=Ax;function Ex(e,t){return e!=null&&t in Object(e)}var Ix=Ex;function xx(e,t,r){t=Ps(t,e);for(var n=-1,i=t.length,o=!1;++n<i;){var s=Ki(t[n]);if(!(o=e!=null&&r(e,s)))break;e=e[s]}return o||++n!=i?o:(i=e==null?0:e.length,!!i&&Xu(i)&&Ss(s,i)&&(Kt(e)||Yu(e)))}var Sx=xx;function Cx(e,t){return e!=null&&Sx(e,t,Ix)}var Uh=Cx,Nx=1,Rx=2;function $x(e,t){return Qu(e)&&$h(t)?Ph(Ki(e),t):function(r){var n=VE(r,e);return n===void 0&&n===t?Uh(r,e):Rh(t,n,Nx|Rx)}}var Px=$x;function Ux(e){return function(t){return t?.[e]}}var Bx=Ux;function Dx(e){return function(t){return ec(t,e)}}var Mx=Dx;function Lx(e){return Qu(e)?Bx(Ki(e)):Mx(e)}var kx=Lx;function jx(e){return typeof e=="function"?e:e==null?xs:typeof e=="object"?Kt(e)?Px(e[0],e[1]):Ox(e):kx(e)}var Fx=jx;function Vx(e,t,r,n){if(!cr(e))return e;t=Ps(t,e);for(var i=-1,o=t.length,s=o-1,a=e;a!=null&&++i<o;){var u=Ki(t[i]),c=r;if(u==="__proto__"||u==="constructor"||u==="prototype")return e;if(i!=s){var l=a[u];c=n?n(l,u,a):void 0,c===void 0&&(c=cr(l)?l:Ss(t[i+1])?[]:{})}_1(a,u,c),a=a[u]}return e}var zx=Vx;function Kx(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var s=t[n],a=ec(e,s);r(a,s)&&zx(o,Ps(s,e),a)}return o}var qx=Kx,Gx=32,tc=A1(function(e,t){var r=Li(t,Hu(tc));return p1(e,Gx,void 0,t,r)});tc.placeholder={};var Wx=tc;function Hx(e,t){return qx(e,t,function(r,n){return Uh(e,n)})}var Jx=Hx,Xx=XE(function(e,t){return e==null?{}:Jx(e,t)}),fp=Xx,Yx=4294967295,Qx=Yx-1,Zx=Math.floor,eS=Math.min;function tS(e,t,r,n){var i=0,o=e==null?0:e.length;if(o===0)return 0;t=r(t);for(var s=t!==t,a=t===null,u=Ln(t),c=t===void 0;i<o;){var l=Zx((i+o)/2),p=r(e[l]),S=p!==void 0,x=p===null,E=p===p,z=Ln(p);if(s)var W=n||E;else c?W=E&&(n||S):a?W=E&&S&&(n||!x):u?W=E&&S&&!x&&(n||!z):x||z?W=!1:W=n?p<=t:p<t;W?i=l+1:o=l}return eS(o,Qx)}var rS=tS;function nS(e,t,r){return rS(e,t,Fx(r,2))}var iS=nS,oS=1/0,iP=Mn&&1/Ch(new Mn([,-0]))[1]==oS?function(e){return new Mn(e)}:lh;var{WARN:oP,LOG:sP,DEBUG:aP,VERBOSE:sS,ERROR:aS}=$e.setup($e.INFO),Bh=(e,t,r="asc")=>r==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),rc=(e,t,r)=>Ge.structural(fp(t,e),fp(r,e)),Dh=(e,t,r="asc")=>Bh(e.ts,t.ts,r),uS=Wx(rc,["en","at"]);function Sr(e,t="asc"){return e.sort((r,n)=>Dh(r,n,t))}var Mh=(e,t)=>n0(new Date(e.ts),new Date(t.ts));var nc=e=>{let t=new Map;for(let r of e){if(!r)throw aS("falsy entry in applogs",e),new Error("falsy entry in applogs");let n=r.cid;t.has(n)?sS("Skipping duplicate applog:",[t.get(n),r]):t.set(n,r)}return Array.from(t.values())};function Lh(e){return typeof e=="string"&&e.startsWith("?")}function kh(e){return e.slice(1)}function Us(e,t){let r={},n={};for(let[i,o]of Object.entries(e))if(Lh(o)){let s=kh(o),a=t[s];a?n[i]=a:r[i]=s}else n[i]=o;return[n,r]}function jh(e,t,r){let n;if(t){let i=typeof t;i==="string"?n=t===r:i==="function"?n=t(r):typeof t.has=="function"?n=t.has(r):Array.isArray(t)&&!Array.isArray(r)?n=t.includes(r):n=t===r}else n=t===r;return e.charAt(0)==="!"?!n:n}var Fh=function(t){for(var r=0,n=0,i=t.length;n<i;n++)r+=t[n];return r},lp=function(t){return Fh(t)/t.length},yt={max:function(e){return Math.max.apply(null,e)},min:function(e){return Math.min.apply(null,e)},range:function(e){return yt.max(e)-yt.min(e)},midrange:function(e){return yt.range(e)/2},sum:Fh,mean:lp,average:lp,median:function(e){e.sort(function(r,n){return r-n});var t=e.length/2;return t%1?e[t-.5]:(e[t-1]+e[t])/2},modes:function(e){if(!e.length)return[];var t={},r=0,n=[];return e.forEach(function(i){t[i]?t[i]++:t[i]=1,t[i]>r?(n=[i],r=t[i]):t[i]===r&&(n.push(i),r=t[i])}),n},variance:function(e){var t=yt.mean(e);return yt.mean(e.map(function(r){return Math.pow(r-t,2)}))},standardDeviation:function(e){return Math.sqrt(yt.variance(e))},meanAbsoluteDeviation:function(e){var t=yt.mean(e);return yt.mean(e.map(function(r){return Math.abs(r-t)}))},zScores:function(e){var t=yt.mean(e),r=yt.standardDeviation(e);return e.map(function(n){return(n-t)/r})}};yt.average=yt.mean;function ic(){return new Date().toISOString()}var{WARN:cS,LOG:uP,DEBUG:fS,VERBOSE:cP,ERROR:ps}=$e.setup($e.INFO);function Vh(e,t){let r=ic(),n=t;return e.map(o=>zh(o,{ts:r,threadForPv:n}))}function zh(e,{ts:t,threadForPv:r}={}){let n=Gh(e,t??ic()),i=Wh(n,r),o=th(i).toString();e.cid&&e.cid!==o&&cS("[finalizeApplogForInsert] overwriting wrong CID",{log:e,cid:o,logWithPv:i});let s={...i,cid:o};if(!Lu(s))throw ps(`Bogus Applog ${JSON.stringify(s)}`,Qp(s));return Object.freeze(s)}function Kh(e){return!!e.ts}function qh(e){return!!e.pv}function Gh(e,t){return Kh(e)?e:{...e,ts:t}}function Wh(e,t){if(e.pv!==void 0)return e;if(t){let{en:r,at:n}=e,i=t.findLast(s=>s.en==r&&s.at==n);if(rc(["en","at","vl","ts","ag"],e,i))throw ps("[withPvFrom] Same as previous:",{log:e,pv:i,thread:t});let o=(e.pv!==void 0?e.pv:i?.cid)??null;return{...e,pv:o}}else{if(!qh(e))throw ps("[withPvFrom] no thread and no pv:",e);return e}}function qi(e){let t=()=>(Re(()=>e.length<2&&fS(`joinThreads with count=${e.length}`)),Sr(nc(e.flatMap(i=>{let o=i.applogs;if(!o)throw ps("falsy applogs of thread",i),new Error("falsy applogs of thread");return o})))),r=Re(()=>t()),n=st(function(i,o){return Yt(i)?{init:Re(()=>t())}:{added:i.added.filter(s=>!this.hasApplog(s,!0)),removed:i.removed?.filter(s=>!!this.parents.some(u=>u===o?!1:u.hasApplog(s,!0)))}});return new Bs(Re(()=>`join(~ ${e.map(i=>i.name).join(", ")})`),e,["?"],r,n)}var{WARN:dp,LOG:fP,DEBUG:pp,VERBOSE:Xr,ERROR:hp}=$e.setup($e.INFO),Bs=class Hh extends ms{constructor(t,r,n,i,o,s=null){super(t,r,n,o?Pe.array([...i],{deep:!1,name:`${t}.array`}):i),this.name=t,this._initialLogs=i,this._eventMapper=o,this._writeMapper=s,Tr(this,{onParentUpdate:st}),o&&this.subscribeToParents()}static mapWrites(t,r,n){return new Hh(`${r}<${t.nameAndSizeUntracked}>`,t,t.filters,t._applogs,null,n)}_parentSubscriptions=null;insert(t){let r=this._writeMapper?this._writeMapper(t):t;if(!(this._writeMapper&&!r))return this.parents.forEach(n=>n.insert(r))}insertRaw(t){let r=this._writeMapper?this._writeMapper(t):t;if(!(this._writeMapper&&!r))return this.parents.forEach(n=>n.insertRaw(r))}subscribeToParents(){this._parentSubscriptions=new Map;let t=Ct(()=>{this.parents.length||dp("MappedThread has no parents",this),Xr(`[MappedThread: ${this.name}] subscribing to parents:`,this.parents.map(n=>n.name));let r=new Set([...this._parentSubscriptions.keys()]);for(let n of this.parents){r.delete(n)&&Xr(`[MappedThread: ${this.name}] Skipping re-sub to parent`,n.nameAndSizeUntracked),Xr(`[MappedThread: ${this.name}] sub to new parent`,n.nameAndSizeUntracked);let o=this.onParentUpdate.bind(this,n),s=n.subscribe(o);this._parentSubscriptions.set(n,s)}for(let n of r)Xr(`[MappedThread: ${this.name}] un-subscribing from old parent`,n.nameAndSizeUntracked),this._parentSubscriptions.get(n)(),this._parentSubscriptions.delete(n)})}subscribe(t){return this._parentSubscriptions||this.subscribeToParents(),super.subscribe(t)}triggerRemap(){if(!this._eventMapper)throw hp("triggerRemap on a thread that is not actually mapping?!",this.nameAndSizeUntracked);pp(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.length!==1&&dp(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap with parentCount=${this.parents.length} - not meant for this`),this.parents.forEach(t=>{this.onParentUpdate(t,{init:Re(()=>ar(t.applogs))})})}onParentUpdate(t,r){Xr(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate`,r);let n=this._eventMapper?this._eventMapper(r,t):r;if(this._eventMapper)if(Xr(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => mapped`,n),Yt(n))this._applogs.replace([...n.init]);else{for(let i of n.added)this._applogs.splice(iS(this._applogs,i,"ts"),0,i);if(n.removed){for(let i of n.removed)if(!this._applogs.remove(i))if(!Yt(r)&&r.removed?.includes(i))pp("Ignoring remove event for non-existent because it was part of parent event's removed",i,r);else throw hp(`MappedThread{${this.name}} toRemove contained log that doesn't exist`,i,{thread:this,event:r,mapResult:n})}}Xr(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => deps?`,Ei(this._applogs)),this.notifySubscribers(n)}get readOnly(){return!1}},{WARN:lP,LOG:dP,DEBUG:pP,VERBOSE:ou,ERROR:lS}=$e.setup($e.INFO),lr=Qe("rollingFilter",function(t,r,n={}){let i=Jh(r),o=mu(i),s=Pe.array(Re(function(){return o(t.applogs)}),{deep:!1,name:`${t.name} | ${n.name||`rollingFilter.array{${Zr(i)}}`}`}),a=p=>{let S;return Yt(p)?S={init:o(p.init)}:S={added:o(p.added),removed:p.removed},ou(`rollingFilter{${t.nameAndSizeUntracked} | ${n.name?` '${n.name}'}`:""} parentUpdate`,i,p,"=>",S),S},u=new Bs(`${t.name} | ${n.name||`rollingFilter{${Zr(i)}}`}`,t,[...t.filters,...n.extraFilterName?[n.extraFilterName]:[]],s,a),c=Gl(()=>ar(r),p=>{ou(`rollingFilter<${t.nameAndSizeUntracked}>${n.name?` '${n.name}'`:""} patternUpdate`,i,"=>",p),i=p,o=mu(i),u.triggerRemap()}),l=Gr(s,()=>{ou(`rollingFilter<${Re(()=>t.name)}>${n.name?` '${n.name}'`:""} unobserve`,i),c(),l()});return u},{equals:jn,argsDebugName:(e,t,r)=>He({caller:"rollingFilter",thread:e,pattern:t,args:r})}),oc=Qe("rollingMapper",function(t,r,n={}){let i=Re(()=>r.call(null,{init:t.applogs},t));if(!Yt(i))throw lS("Initial run must return init event");let o=i.init;return new Bs(`${t.name} | ${n.name||"rollingMapper"}`,t,[...t.filters,...n.extraFilterName?[n.extraFilterName]:[]],o,r)},{equals:jn,argsDebugName:(e,t,r)=>He({caller:"rollingMapper",thread:e,args:r})}),dS=Qe("rollingAcc",function(t,r,n,i={}){let o=st(n);return o({init:t.applogs},r),t.subscribe(s=>{o(s,r)}),r},{argsDebugName:(e,t,r,n)=>`rollingAcc{${e.nameAndSizeUntracked}${n?.name?` | ${n?.name}`:""}}`}),Jh=function(t){let r=Re(function(){return Object.fromEntries(Object.entries(ar(t)).map(([i,o])=>[ar(i),ar(o)]))});if(!Object.entries(r).length)throw new Error("Pattern is empty");return r};function mu(e){return function(r){return r.filter(function(i){for(let o of Object.keys(e)){let s=e[o];if(s===void 0)continue;let a=i[o.startsWith("!")?o.slice(1):o];if(!jh(o,s,a))return!1}return!0})}}var{WARN:pS,LOG:hS,DEBUG:yS,VERBOSE:gS,ERROR:Jo}=$e.setup($e.INFO),Xh=class extends ms{constructor(e,t=[],r){super(e,null,r,t),Tr(this,{})}purge(e){let t=this.applogs.length;return this._applogs=this.applogs.filter(r=>!e.includes(r.cid)),t-this.applogs.length}insert(e){let t=Vh(e,this);return this.insertRaw(t)}insertRaw(e){let t=nc(e);if(t.length!==e.length)throw Jo(`[insertRaw] duplicate applogs passed: ${e.length-t.length}`,{appLogsToInsert:e,deduplicated:t});let r=e.filter(o=>!Lu(o));if(r.length)throw Jo(`[insertRaw] bogus applogs passed: ${r.length}`,{bogus:r});let n=e.filter(o=>this.hasApplog(o,!1));if(n.length)throw Jo(`[insertRaw] already existing applogs passed: ${n.length}`,{existing:n});if(!e.length){pS("[insertRaw] skipping empty insert empty logs array");return}(!this.hasParents&&!(this instanceof Xn)?hS:yS)("Inserting:",e.length===1?e[0]:e,{ds:this}),Sr(e);let i=this._applogs.length&&Mh(e[0],this._applogs[this._applogs.length-1]);return this._applogs.push(...e),i&&Sr(this._applogs),this.notifySubscribers({added:e,removed:null}),this.persist(e),e}get readOnly(){return!1}},Xn=class bu extends Xh{constructor(t,r,n,i){super(t,r,n),this._readOnly=i,Tr(this,{_applogs:Pe.shallow})}static empty(t){return bu.fromArray([],t??"empty in-memory",!1)}static fromArray(t,r,n=!1){return new bu(r??"in-memory",t,[],n)}get readOnly(){return this._readOnly}async persist(t){if(gS("[InMem.persist] no persist for",t),this.readOnly)throw Jo("[persist] called for readOnly thread")}},{WARN:hP,LOG:yP,DEBUG:gP,VERBOSE:mP,ERROR:bP}=$e.setup($e.INFO);var bS=class{constructor(e,t,r=null){this.logsOfThisNode=e,this.variables=t,this.prevNode=r,Tr(this,{threadOfTrail:Me})}get record(){return this.variables}get threadOfTrail(){return this.prevNode?qi([this.logsOfThisNode,this.prevNode.threadOfTrail]):this.logsOfThisNode}get trailLogs(){return this.threadOfTrail.applogs}},Yh=class{constructor(e){this.nodes=e,Tr(this,{threadOfAllTrails:Me,size:Me,isEmpty:Me})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return Re(()=>this.records.length)}get records(){return fr(()=>this.nodes.map(({variables:e})=>e),{name:"QueryResult.records"})}get leafNodeThread(){return qi(fr(()=>this.nodes.map(({logsOfThisNode:e})=>e),{name:"QueryResult.leafNodeThread"}))}get leafNodeLogs(){return fr(()=>this.nodes.map(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogs"})}get threadOfAllTrails(){return qi(fr(()=>this.nodes.map(e=>e.threadOfTrail),{name:"QueryResult.threadOfAllTrails"}))}get thread(){return this.threadOfAllTrails}get allApplogs(){return this.threadOfAllTrails.applogs}},{WARN:TU,LOG:Ds,DEBUG:dr,VERBOSE:Ae,ERROR:cn}=$e.setup($e.INFO,{prefix:"[q]"}),vS=Qe("lastWriteWins",function(t,{inverseToOnlyReturnFirstLogs:r,tolerateAlreadyFiltered:n}={}){if(Ae(`lastWriteWins${r?".inversed":""} < ${t.nameAndSizeUntracked} > initializing`),t.filters.includes("lastWriteWins")){if(n)return dr("[lastWriteWins] already filtered, but tolerateAlreadyFiltered=true, so returning"),t;throw cn("thread already filtered lastWriteWins:",t.filters,{name:t.name})}let i,o=oc(t,function(a,u){let c=Yt(a),l,p=[],S=c?null:[];c?(i=new Map,l=a.init):l=a.added;let x;for(let E=r?0:l.length-1;r?E<l.length:E>=0;r?E++:E--){let z=l[E],W=z.en+"|"+z.at;if(x&&(r?x>z.ts:x<z.ts))throw cn("lastWriteWins.mapper logs not sorted:",x,r?">":"<",z.ts,{log:z,i:E,newLogs:l,inverseToOnlyReturnFirstLogs:r});x=z.ts;let T=i.get(W);(!T||(r?T.ts>z.ts:T.ts<z.ts))&&(T&&!c&&S.push(T),p.push(z),i.set(W,z))}return Sr(p),Ae.isDisabled||Ae(`lastWriteWins${r?".inversed":""}<${t.nameAndSizeUntracked}> mapped event`,c?{...Object.fromEntries(Object.entries(a).map(([E,z])=>[E,z?.length])),toAdd:p.length,toRemove:S}:{...a,toAdd:p,toRemove:S}),c?{init:p}:{added:p,removed:S}},{name:`lastWriteWins${r?".inversed":""}`,extraFilterName:"lastWriteWins"});return Ae.isDisabled||Ct(()=>{Ae(`lastWriteWins<${t.nameAndSizeUntracked}> filtered down to`,o.applogs.length)}),o},{equals:jn,argsDebugName:e=>He({caller:"lastWriteWins",thread:e})}),AU=Qe("withoutDeleted",function(t){if(Ae.isEnabled&&Ae(`withoutDeleted<${t.nameAndSizeUntracked}>`),t.filters.includes("withoutDeleted"))throw cn("thread already filtered withoutDeleted:",t.filters,{name:t.name});let r=lr(t,{at:["isDeleted","relation/isDeleted","block/isDeleted"],vl:!0},{name:"isDeleted"});Ae.isEnabled&&Ae(`withoutDeleted<${t.nameAndSizeUntracked}> deletionLogs:`,Re(function(){return[...r.applogs]}));let n=He({caller:"allDeletedEntities",thread:t}),i=Ap(function(){return r.map(s=>s.en)},{name:n});return Ae.isEnabled&&Ct(()=>{Ae(`withoutDeleted<${t.nameAndSizeUntracked}> deleted:`,[...i])}),lr(t,{"!en":i},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:jn}),Qh=Qe("query",function e(t,r,n={},i={}){let o=Zh(t);dr(`query<${o.nameAndSizeUntracked}>:`,r);let s=Array.isArray(r)?r:[r],a;if(s.length===1)a=null;else{let l=s.slice(0,-1);a=e(o,l,n,i)}let u=s[s.length-1],c=_S(o,a,u,i);return Ae.isDisabled||Ct(()=>Ae("query result:",ar(c))),c},{equals:gs,argsDebugName:(e,t,r)=>He({caller:"query",thread:e,args:r?{pattern:t,startVars:r}:t})}),_S=Qe("queryStep",function(t,r,n,i={}){if(dr(`queryStep<${t.nameAndSizeUntracked}> with`,r?.untrackedSize??"all","nodes, pattern:",n),!Object.entries(n).length)throw new Error("Pattern is empty");function o(a){let[u,c]=Us(n,a?.variables??{});Ae("[queryStep.doQuery] patternWithoutVars: ",u);let l=lr(t,u),p=Ms(c),S=fr(function(){let E=l.map(z=>({log:z,vars:p(z)}));return Ae.isEnabled&&Ae("[queryStep.doQuery] step node:",a?.variables," =>",E,"from:",Re(()=>l.applogs)),E.map(({log:z,vars:W})=>{let T=Object.assign({},a?.variables,W);return new bS(_u.fromArray([z],He({caller:"QueryNode",thread:l,pattern:`${Zr(T)}@${Zr(u)}`})),T,a)})},{name:He({caller:"doQuery.mapNodes",thread:l,pattern:n})});return Ae.isEnabled&&Ct(()=>Ae("[queryStep.doQuery] resultNodes:",[...S])),i.debug&&Ds("[queryStep] step result:",Re(()=>S.map(({variables:x,logsOfThisNode:E})=>({variables:x,thread:E})))),S}let s=fr(function(){return dr(`[queryStep] Running with ${r?.nodes?.length} input nodes:`),r?[...r.nodes.flatMap(o)]:[...o(null)]},{name:He({caller:"queryStep",thread:t,pattern:n})});return Ae.isEnabled&&Ct(()=>Ae("[queryStep] observableResultNodes:",[...s])),new Yh(s)},{equals:gs,argsDebugName:(e,t,r)=>He({caller:"queryStep",thread:e,pattern:r})}),OU=Qe("queryNot",function(t,r,n,i={}){let o=r.nodes;dr(`queryNot<${t.nameAndSizeUntracked}> from: ${o.length} nodes`);let s=Array.isArray(n)?n:[n];for(let a of s){if(!Object.entries(n).length)throw new Error("Pattern is empty");o=o.filter(function({variables:c}){let[l,p]=Us(a,c??{});Ae("[queryNot] patternWithoutVars: ",l);let S=lr(t,l);return Ae("[queryNot] step node:",c," =>",S.size,"applogs"),Ae.isDisabled||Ae("[queryNot] step node:",c," => empty?",Re(()=>S.applogs)),i.debug&&Ds("[queryNot] node result:",c,"=>",S.applogs),S.isEmpty})}return new Yh(o)},{equals:gs,argsDebugName:(e,t,r)=>He({caller:"queryNot",thread:e,pattern:r})}),EU=Qe("filterAndMap",function(t,r,n){dr(`filterAndMap<${t.nameAndSizeUntracked}>`,r);let i=lr(t,r);Ae("[filterAndMap] filtered:",i.untrackedSize),Ae.isDisabled||Ct(()=>Ae("[filterAndMap] filtered:",i.applogs));let o=He({thread:t,pattern:r,caller:"filterAndMap"}),s=fr(()=>AS(i,n),{name:o});return Ae.isDisabled||Ct(()=>Ae("[filterAndMap] mapped:",s)),s},{equals:Ge.structural,argsDebugName:(e,t)=>He({caller:"filterAndMap",thread:e,pattern:t})}),IU=Qe("queryAndMap",function(t,r,n,i={}){let o=Zh(t);dr(`queryAndMap<${o.nameAndSizeUntracked}>`,{patternOrPatterns:r,variables:i,map:n});let s=He({thread:o,caller:"queryAndMap"}),a=Qh(o,r);Ae("[queryAndMap] filtered count:",a.untrackedSize);let u=fr(()=>OS(a,n),{name:s});return Ae.isDisabled||Ct(()=>Ae("[queryAndMap] result:",ar(u))),u},{equals:Ge.structural,argsDebugName:(e,t)=>He({caller:"queryAndMap",thread:e,pattern:t})}),xU=Qe("queryEntity",function(t,r,n,i){dr(`queryEntity<${t.nameAndSizeUntracked}>`,n,r);let o=lr(t,{en:n,at:ES(r,i)});return Ae("queryEntity applogs:",o.applogs),Me(()=>o.isEmpty?null:Object.fromEntries(o.map(({at:s,vl:a})=>[s.slice(r.length+1),a])))},{equals:Tp,argsDebugName:(e,t,r)=>He({caller:"queryEntity",thread:e,args:{name:t,entityID:r}})}),SU=Qe("agentsOfThread",function(t){dr(`agentsOfThread<${t.nameAndSizeUntracked}>`);let r=Pe.map(),n=st(o=>{for(let s of Yt(o)?o.init:o.added){let a=r.get(s.ag)??0;r.set(s.ag,a+1)}for(let s of!Yt(o)&&o.removed||[]){let a=r.get(s.ag);if(!a||a<1)throw cn("[agentsOfThread] number is now negative",{log:s,event:o,mapped:r,prev:a});r.set(s.ag,a-1)}Ds(`agentsOfThread<${t.nameAndSizeUntracked}> processed event`,{event:o,mapped:r})});n({init:t.applogs});let i=t.subscribe(n);return Pn(r,i),r}),wS=Qe("entityOverlap",function(t,r){return Ds(`entityOverlap<${t.nameAndSizeUntracked}, ${r.nameAndSizeUntracked}>`),Me(()=>{let n=new Set(t.map(o=>o.en)),i=new Set(r.map(o=>o.en));return[...n].filter(o=>i.has(o))})});var CU=Qe("entityOverlapCount",function(t,r){return Me(()=>wS(t,r).get().length)}),TS=Qe("querySingle",function(t,r,n={}){let i=Qh(t,r,n);return Me(()=>{if(i.isEmpty)return null;if(i.size>1)throw cn("[querySingle] got",i.size,"results:",i);let o=i.nodes[0].logsOfThisNode;if(o.size!=1)throw cn("[querySingle] single result, but got",o.size,"logs:",o.applogs);return o.applogs[0]})},{equals:Ge.structural,argsDebugName:(e,t)=>He({caller:"querySingle",thread:e,pattern:t})}),NU=Qe("querySingleAndMap",function(t,r,n,i={}){let o=TS(t,r,i);return Me(()=>{let s=o.get();if(s)return typeof n=="string"?s[n]:Ms(n)(s)})},{equals:Ge.structural,argsDebugName:(e,t)=>He({caller:"querySingleAndMap",thread:e,pattern:t})}),AS=function(t,r){return typeof r=="function"?t.map(r):typeof r=="string"?t.map(n=>n[r]):t.map(Ms(r))},OS=function(t,r){return typeof r=="function"?t.records.map(r):typeof r=="string"?t.nodes.map(n=>{if(!Object.hasOwn(n.record,r)){if(n.logsOfThisNode.size!==1)throw cn(`not sure what to map (it's not a var and a result node log count of ${n.logsOfThisNode.size})`);return n.logsOfThisNode.firstLog[r]}return n.record[r]}):t.nodes.map(n=>Ms(r)(t))};function Ms(e){return t=>Object.entries(e).reduce((r,[n,i])=>(r[i]=t[n],r),{})}function ES(e,t){return t.map(r=>IS(e,r))}function IS(e,t){return`${e}/${t}`}function Zh(e){return Array.isArray(e)?Xn.fromArray(e,`threadFromArray[${e.length}]`,!0):e}var CS=Le({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js"(e,t){"use strict";t.exports=s;var r=128,n=127,i=~n,o=Math.pow(2,31);function s(a,u,c){if(Number.MAX_SAFE_INTEGER&&a>Number.MAX_SAFE_INTEGER)throw s.bytes=0,new RangeError("Could not encode varint");u=u||[],c=c||0;for(var l=c;a>=o;)u[c++]=a&255|r,a/=128;for(;a&i;)u[c++]=a&255|r,a>>>=7;return u[c]=a|0,s.bytes=c-l+1,u}}}),NS=Le({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/decode.js"(e,t){"use strict";t.exports=i;var r=128,n=127;function i(o,u){var a=0,u=u||0,c=0,l=u,p,S=o.length;do{if(l>=S||c>49)throw i.bytes=0,new RangeError("Could not decode varint");p=o[l++],a+=c<28?(p&n)<<c:(p&n)*Math.pow(2,c),c+=7}while(p>=r);return i.bytes=l-u,a}}}),RS=Le({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/length.js"(e,t){"use strict";var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),s=Math.pow(2,35),a=Math.pow(2,42),u=Math.pow(2,49),c=Math.pow(2,56),l=Math.pow(2,63);t.exports=function(p){return p<r?1:p<n?2:p<i?3:p<o?4:p<s?5:p<a?6:p<u?7:p<c?8:p<l?9:10}}}),lc=Le({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/index.js"(e,t){"use strict";t.exports={encode:CS(),decode:NS(),encodingLength:RS()}}}),jU=new Uint8Array(0);function $S(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function dc(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}function PS(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(r[s]!==255)throw new TypeError(o+" is ambiguous");r[s]=i}var a=e.length,u=e.charAt(0),c=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function p(E){if(E instanceof Uint8Array||(ArrayBuffer.isView(E)?E=new Uint8Array(E.buffer,E.byteOffset,E.byteLength):Array.isArray(E)&&(E=Uint8Array.from(E))),!(E instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(E.length===0)return"";for(var z=0,W=0,T=0,k=E.length;T!==k&&E[T]===0;)T++,z++;for(var G=(k-T)*l+1>>>0,H=new Uint8Array(G);T!==k;){for(var F=E[T],Y=0,V=G-1;(F!==0||Y<W)&&V!==-1;V--,Y++)F+=256*H[V]>>>0,H[V]=F%a>>>0,F=F/a>>>0;if(F!==0)throw new Error("Non-zero carry");W=Y,T++}for(var ae=G-W;ae!==G&&H[ae]===0;)ae++;for(var L=u.repeat(z);ae<G;++ae)L+=e.charAt(H[ae]);return L}function S(E){if(typeof E!="string")throw new TypeError("Expected String");if(E.length===0)return new Uint8Array;var z=0;if(E[z]!==" "){for(var W=0,T=0;E[z]===u;)W++,z++;for(var k=(E.length-z)*c+1>>>0,G=new Uint8Array(k);E[z];){var H=r[E.charCodeAt(z)];if(H===255)return;for(var F=0,Y=k-1;(H!==0||F<T)&&Y!==-1;Y--,F++)H+=a*G[Y]>>>0,G[Y]=H%256>>>0,H=H/256>>>0;if(H!==0)throw new Error("Non-zero carry");T=F,z++}if(E[z]!==" "){for(var V=k-T;V!==k&&G[V]===0;)V++;for(var ae=new Uint8Array(W+(k-V)),L=W;V!==k;)ae[L++]=G[V++];return ae}}}function x(E){var z=S(E);if(z)return z;throw new Error(`Non-${t} character`)}return{encode:p,decodeUnsafe:S,decode:x}}var US=PS,BS=US,DS=BS,MS=class{name;prefix;baseEncode;constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},LS=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,r){this.name=e,this.prefix=t;let n=t.codePointAt(0);if(n===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n,this.baseDecode=r}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return ay(this,e)}},kS=class{decoders;constructor(e){this.decoders=e}or(e){return ay(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r!=null)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function ay(e,t){return new kS({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var jS=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new MS(e,t,r),this.decoder=new LS(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function uy({name:e,prefix:t,encode:r,decode:n}){return new jS(e,t,r,n)}function zs({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=DS(r,e);return uy({prefix:t,name:e,encode:n,decode:o=>dc(i(o))})}function FS(e,t,r,n){let i={};for(let l=0;l<t.length;++l)i[t[l]]=l;let o=e.length;for(;e[o-1]==="=";)--o;let s=new Uint8Array(o*r/8|0),a=0,u=0,c=0;for(let l=0;l<o;++l){let p=i[e[l]];if(p===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|p,a+=r,a>=8&&(a-=8,s[c++]=255&u>>a)}if(a>=r||255&u<<8-a)throw new SyntaxError("Unexpected end of data");return s}function VS(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let u=0;u<e.length;++u)for(a=a<<8|e[u],s+=8;s>r;)s-=r,o+=t[i&a>>s];if(s!==0&&(o+=t[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o}function pr({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return uy({prefix:t,name:e,encode(i){return VS(i,n,r)},decode(i){return FS(i,n,r,e)}})}var ks=pr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),FU=pr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),VU=pr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),zU=pr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),KU=pr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),qU=pr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),GU=pr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),WU=pr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),HU=pr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),sc=zs({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),JU=zs({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Cr=zs({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),XU=zs({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),zS=cy,ey=128,KS=127,qS=~KS,GS=Math.pow(2,31);function cy(e,t,r){t=t||[],r=r||0;for(var n=r;e>=GS;)t[r++]=e&255|ey,e/=128;for(;e&qS;)t[r++]=e&255|ey,e>>>=7;return t[r]=e|0,cy.bytes=r-n+1,t}var WS=ac,HS=128,ty=127;function ac(e,n){var r=0,n=n||0,i=0,o=n,s,a=e.length;do{if(o>=a)throw ac.bytes=0,new RangeError("Could not decode varint");s=e[o++],r+=i<28?(s&ty)<<i:(s&ty)*Math.pow(2,i),i+=7}while(s>=HS);return ac.bytes=o-n,r}var JS=Math.pow(2,7),XS=Math.pow(2,14),YS=Math.pow(2,21),QS=Math.pow(2,28),ZS=Math.pow(2,35),eC=Math.pow(2,42),tC=Math.pow(2,49),rC=Math.pow(2,56),nC=Math.pow(2,63),iC=function(e){return e<JS?1:e<XS?2:e<YS?3:e<QS?4:e<ZS?5:e<eC?6:e<tC?7:e<rC?8:e<nC?9:10},oC={encode:zS,decode:WS,encodingLength:iC},sC=oC,js=sC;function uc(e,t=0){return[js.decode(e,t),js.decode.bytes]}function Fs(e,t,r=0){return js.encode(e,t,r),t}function Vs(e){return js.encodingLength(e)}function aC(e,t){let r=t.byteLength,n=Vs(e),i=n+Vs(r),o=new Uint8Array(i+r);return Fs(e,o,0),Fs(r,o,n),o.set(t,i),new pc(e,r,t,o)}function uC(e){let t=dc(e),[r,n]=uc(t),[i,o]=uc(t.subarray(n)),s=t.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new pc(r,i,s,t)}function cC(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&$S(e.bytes,r.bytes)}}var pc=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function ry(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return lC(r,cc(e),t??Cr.encoder);default:return dC(r,cc(e),t??ks.encoder)}}var ny=new WeakMap;function cc(e){let t=ny.get(e);if(t==null){let r=new Map;return ny.set(e,r),r}return t}var fy=class tt{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==Gi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==pC)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return tt.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:r}=this.multihash,n=aC(t,r);return tt.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return tt.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&cC(t.multihash,n.multihash)}toString(t){return ry(this,t)}toJSON(){return{"/":ry(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof tt)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new tt(n,i,o,s??iy(n,i,o.bytes))}else if(r[hC]===!0){let{version:n,multihash:i,code:o}=r,s=uC(i);return tt.create(n,o,s)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==Gi)throw new Error(`Version 0 CID must use dag-pb (code: ${Gi}) block encoding`);return new tt(t,r,n,n.bytes)}case 1:{let i=iy(t,r,n.bytes);return new tt(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return tt.create(0,Gi,t)}static createV1(t,r){return tt.create(1,t,r)}static decode(t){let[r,n]=tt.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=tt.inspectBytes(t),n=r.size-r.multihashSize,i=dc(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new pc(r.multihashCode,r.digestSize,o,i);return[r.version===0?tt.createV0(s):tt.createV1(r.codec,s),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[p,S]=uc(t.subarray(r));return r+=S,p},i=n(),o=Gi;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),u=n(),c=r+u,l=c-s;return{version:i,codec:o,multihashCode:a,digestSize:u,multihashSize:l,size:c}}static parse(t,r){let[n,i]=fC(t,r),o=tt.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return cc(o).set(n,t),o}};function fC(e,t){switch(e[0]){case"Q":{let r=t??Cr;return[Cr.prefix,r.decode(`${Cr.prefix}${e}`)]}case Cr.prefix:{let r=t??Cr;return[Cr.prefix,r.decode(e)]}case ks.prefix:{let r=t??ks;return[ks.prefix,r.decode(e)]}case sc.prefix:{let r=t??sc;return[sc.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function lC(e,t,r){let{prefix:n}=r;if(n!==Cr.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let o=r.encode(e).slice(1);return t.set(n,o),o}else return i}function dC(e,t,r){let{prefix:n}=r,i=t.get(n);if(i==null){let o=r.encode(e);return t.set(n,o),o}else return i}var Gi=112,pC=18;function iy(e,t,r){let n=Vs(e),i=n+Vs(t),o=new Uint8Array(i+r.byteLength);return Fs(e,o,0),Fs(t,o,n),o.set(r,i),o}var hC=Symbol.for("@ipld/js-cid/CID"),ly=42;function yC(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=fy.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new ee(B.tag,ly),new ee(B.bytes,r)]}function gC(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function mC(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}var oy={float64:!0,typeEncoders:{Object:yC,undefined:gC,number:mC}},YU={...oy,typeEncoders:{...oy.typeEncoders}};function bC(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return fy.decode(e.subarray(1))}var fc={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};fc.tags[ly]=bC;var QU={...fc,tags:fc.tags.slice()};var ZU=Nt(lc(),1);var Nr={Null:e=>e===null?e:void 0,Int:e=>Number.isInteger(e)?e:void 0,Float:e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,String:e=>typeof e=="string"?e:void 0,Bool:e=>typeof e=="boolean"?e:void 0,Bytes:e=>e instanceof Uint8Array?e:void 0,Link:e=>e!==null&&typeof e=="object"&&e.asCID===e?e:void 0,List:e=>Array.isArray(e)?e:void 0,Map:e=>e!==null&&typeof e=="object"&&e.asCID!==e&&!Array.isArray(e)&&!(e instanceof Uint8Array)?e:void 0},Wi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Nr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Nr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Wi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=Wi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Nr.Int,CarV1HeaderOrV2Pragma:e=>{if(Nr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,s]=t[i];switch(o){case"roots":{let a=Wi["CarV1HeaderOrV2Pragma > roots (anon)"](e[o]);if(a===void 0)return;if(a!==s||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=a}}break;case"version":{n--;let a=Wi.Int(e[o]);if(a===void 0)return;if(a!==s||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=a}}break;default:return}}if(!(n>0))return r}},Hi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Nr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Nr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Hi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=Hi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Nr.Int,CarV1HeaderOrV2Pragma:e=>{if(Nr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,s]=t[i];switch(o){case"roots":{let a=Hi["CarV1HeaderOrV2Pragma > roots (anon)"](s);if(a===void 0)return;if(a!==s||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=a}}break;case"version":{n--;let a=Hi.Int(s);if(a===void 0)return;if(a!==s||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=a}}break;default:return}}if(!(n>0))return r}},eB={toTyped:Wi.CarV1HeaderOrV2Pragma,toRepresentation:Hi.CarV1HeaderOrV2Pragma},tB=$u(),rB=Nt(lc(),1),nB=[new ee(B.map,2),new ee(B.string,"version"),new ee(B.uint,1),new ee(B.string,"roots")],iB=new ee(B.tag,42);var oB=Nt(lc(),1);var{WARN:dy,LOG:sB,DEBUG:sy,VERBOSE:hc,ERROR:Ls}=$e.setup($e.INFO);async function yc(e){let t=await py(e);return await gc(t)}async function gc({rootCID:e,blockStore:t},r=[]){if(!e||!t)throw Ls("Empty roots/blocks",{rootCID:e,blockStore:t});let n=await Yn(t,e),i,o=null,s=null;if(hc("[decodePubFromBlocks] root:",e.toString(),n,{blockStore:t}),!n)throw Ls("root not found in blockStore",{blockStore:t,rootCID:e});if(n?.info){o=n.applogs;let l=await Yn(t,o);i=await _C(l,t),s=await Yn(t,n.info),sy("new format - infoLogs",s.logs.map(p=>({[p.toString()]:p})))}else i=n.applogs;let a=async l=>{let p=l,S=await Yn(t,p);if(!S)throw Ls("Could not find applog CID in pub blocks:",p.toString(),{cid:p,root:n,blockStore:t}),new Error(`Could not find applog CID in pub blocks: ${p.toString()}`);return S.pv instanceof $t&&(S.pv=S.pv.toV1().toString()),{...S,cid:p.toV1().toString()}},u;if(u=await Promise.all(i.map(a)),n.prev){if(Is(n.prev,e)||Vu(r,n.prev))throw Ls("[pubFromBlocks] pub chain has a loop",{rootCID:e,prev:n.prev,recursionTrace:r});u=u.concat((await gc({rootCID:n.prev,blockStore:t},[...r,e])).applogs)}let c={cid:e,info:{...s,logs:await Promise.all(s.logs.map(a))},applogsCID:o,applogs:u};return sy("[decodePubFromBlocks] result:",c,{rootCID:e.toString(),root:n,blockStore:t,applogs:u,info:s}),c}async function py(e){let r=(await e.getRoots()).map(i=>(typeof i.toV1=="function"?i:$t.decode(i.bytes)).toV1().toString()),n=new Map;for await(let{cid:i,bytes:o}of e.blocks()){let s=typeof i.toV1=="function"?i:$t.decode(i.bytes);hc({cidFromCarblocks:i,cid:s}),n.set(s.toV1().toString(),o)}return r.length!==1&&dy("Unexpected roots count:",r),{rootCID:$t.parse(r[0]),blockStore:{get:i=>n.get(i.toV1().toString())}}}async function Yn(e,t){try{var r=await e.get(t);if(!r)return dy("returning null"),null}catch(n){if(n.message==="Not Found")return null;throw n}return As(r)}function mc(e){return async function*(){for(;;){let{done:t,value:r}=await e.read();if(hc("[car] chunk",{done:t,value:r}),t)break;yield r}}()}var{WARN:aB,LOG:uB,DEBUG:cB,VERBOSE:fB,ERROR:vC}=$e.setup($e.INFO);async function _C(e,t){return wC(e)?(await Promise.all(e.chunks.map(async r=>{let n=await Yn(t,r);if(!n.logs)throw vC("Weird chunk",n);return n.logs}))).flat():e.logs}function wC(e){return e.chunks}var{WARN:Ks,LOG:t2,DEBUG:Ji,VERBOSE:r2,ERROR:Xi}=Xs.setup(Xs.INFO);async function n2(e,t,{readOnly:r=!0,pinnedCID:n}={}){let{cid:i,errors:o,isIpns:s}=Fu(t);if(!i)throw Xi("Failed to parse pubID",t,o);Ji("[retrieveThread] parsedPubID",i);let a;if(n)Ji("[retrieveThread] using pinnedCID"),s||Ks("pubID isn't IPNS, but pinnedCID different:",{pubID:t,pinnedCID:n}),a=tr.parse(n);else if(!s)Ji("[retrieveThread] pubID is not IPNS - using as CID"),a=i;else{if(!t)throw Xi("[retrieveThread] neither pubID nor pinnedCID provided");if(!e.nameBaseUrl)throw Xi("[retrieveThread] IPNS, but no nameBaseUrl");try{a=await TC(e,t),Ji("Resolved pub to CID",a.toString())}catch(x){throw Xi(`Failed to resolve IPNS ${t}:`,x)}}let u=await AC(e.gatewayBaseUrl,a),{applogs:c}=await yc(u),l=c.filter(x=>Os(x));l.length&&Ks(`Found ${l.length} encrypted logs - skipping`);let p=c.filter(x=>!(x instanceof Uint8Array));Sr(p);let S=Xn.fromArray(p,`preview${t&&t!==a.toString()?"-"+t:""}@${a.toString()}`,r);return{cid:a,thread:S,encryptedCount:l.length}}async function TC(e,t){let r=Ys(e.nameBaseUrl),i=await(await fetch(`${r}/name/${t}`)).json();return i.value.startsWith("/ipfs/")||Ks("IPNS value is not '/ipfs/..':",i),tr.parse(i.value.replace("/ipfs/",""))}async function AC(e,t){e=Ys(e),Ji("Retrieving:",t.toString(),"from",e);let r=`${e}/ipfs/${t}?format=car&dag-scope=all`,n=await fetch(r),i;if((!n?.ok||!n?.body)&&(i=Xi(`[retrieveCar] unexpected response ${n?.statusText}`,{url:r}),Ks("Gateway failed:",r,i)),i=mc(n.body.getReader()),i instanceof Error)throw i;return await Dr.fromIterable(i)}export{n2 as a,TC as b,AC as c};
62
62
  /*! Bundled license information:
63
63
 
64
64
  @noble/hashes/esm/utils.js:
@@ -75,4 +75,4 @@ lodash-es/lodash.js:
75
75
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
76
76
  *)
77
77
  */
78
- //# sourceMappingURL=chunk-4WKM2MPH.min.js.map
78
+ //# sourceMappingURL=chunk-ZG42REPJ.min.js.map