@wovin/connect-ucan-store-proxy 0.0.16 → 0.0.18
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.
- package/dist/chunk-BTZHN3XS.min.js +3 -0
- package/dist/chunk-BTZHN3XS.min.js.map +1 -0
- package/dist/chunk-SAONHXKJ.min.js +2 -0
- package/dist/chunk-SAONHXKJ.min.js.map +1 -0
- package/dist/chunk-VFOYRUCV.min.js +78 -0
- package/dist/chunk-VFOYRUCV.min.js.map +1 -0
- package/dist/chunk-YVV7XKRH.min.js +2 -0
- package/dist/chunk-YVV7XKRH.min.js.map +1 -0
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/retrieve.min.js +1 -1
- package/dist/store.min.js +1 -1
- package/dist/utils.d.ts +4 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.min.js +1 -1
- package/package.json +8 -8
- package/dist/chunk-EHSVSU5O.min.js +0 -2
- package/dist/chunk-EHSVSU5O.min.js.map +0 -1
- package/dist/chunk-OWXA5F6K.min.js +0 -3
- package/dist/chunk-OWXA5F6K.min.js.map +0 -1
- package/dist/chunk-T4F3ZRAG.min.js +0 -2
- package/dist/chunk-T4F3ZRAG.min.js.map +0 -1
- package/dist/chunk-V35AFUSX.min.js +0 -78
- package/dist/chunk-V35AFUSX.min.js.map +0 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import{b as Eo,d as xt,e as Ta}from"./chunk-BTZHN3XS.min.js";import{a as Oo,b as wa,c as Aa}from"./chunk-YVV7XKRH.min.js";var il=Oo((g$,nl)=>{"use strict";nl.exports=Da;var rl=128,Gg=127,Wg=~Gg,Hg=Math.pow(2,31);function Da(e,t,r){if(Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw Da.bytes=0,new RangeError("Could not encode varint");t=t||[],r=r||0;for(var n=r;e>=Hg;)t[r++]=e&255|rl,e/=128;for(;e&Wg;)t[r++]=e&255|rl,e>>>=7;return t[r]=e|0,Da.bytes=r-n+1,t}});var al=Oo((m$,sl)=>{"use strict";sl.exports=La;var Jg=128,ol=127;function La(e,n){var r=0,n=n||0,i=0,o=n,s,a=e.length;do{if(o>=a||i>49)throw La.bytes=0,new RangeError("Could not decode varint");s=e[o++],r+=i<28?(s&ol)<<i:(s&ol)*Math.pow(2,i),i+=7}while(s>=Jg);return La.bytes=o-n,r}});var cl=Oo((b$,ul)=>{"use strict";var Xg=Math.pow(2,7),Yg=Math.pow(2,14),Qg=Math.pow(2,21),Zg=Math.pow(2,28),em=Math.pow(2,35),tm=Math.pow(2,42),rm=Math.pow(2,49),nm=Math.pow(2,56),im=Math.pow(2,63);ul.exports=function(e){return e<Xg?1:e<Yg?2:e<Qg?3:e<Zg?4:e<em?5:e<tm?6:e<rm?7:e<nm?8:e<im?9:10}});var jo=Oo((v$,fl)=>{"use strict";fl.exports={encode:il(),decode:al(),encodingLength:cl()}});var dg=["Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function Yc(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(t==="string"||t==="number"||t==="bigint"||t==="symbol")return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(e instanceof Uint8Array)return"Uint8Array";if(e.constructor===Object)return"Object";let r=pg(e);return r||"Object"}function pg(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(dg.includes(t))return t}var L=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}static equals(t,r){return t===r||t.major===r.major&&t.name===r.name}};L.uint=new L(0,"uint",!0);L.negint=new L(1,"negint",!0);L.bytes=new L(2,"bytes",!0);L.string=new L(3,"string",!0);L.array=new L(4,"array",!1);L.map=new L(5,"map",!1);L.tag=new L(6,"tag",!1);L.float=new L(7,"float",!0);L.false=new L(7,"false",!0);L.true=new L(7,"true",!0);L.null=new L(7,"null",!0);L.undefined=new L(7,"undefined",!0);L.break=new L(7,"break",!0);var se=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 wi=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",hg=new TextEncoder;function Io(e){return wi&&globalThis.Buffer.isBuffer(e)}function Ti(e){return e instanceof Uint8Array?Io(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var yg=24,gg=200,Oa=wi?e=>e.length>=yg?globalThis.Buffer.from(e):Qc(e):e=>e.length>=gg?hg.encode(e):Qc(e),sr=e=>Uint8Array.from(e),Zc=wi?(e,t,r)=>Io(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),ef=wi?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Ti(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},tf=wi?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function So(e,t){if(Io(e)&&Io(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 Qc(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):(i>=55296&&i<=57343&&(i=65533),t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=i&63|128)}return t}var mg=256,Ai=class{constructor(t=mg){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=tf(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=Zc(n,0,this.cursor)}else r=ef(this.chunks,this.cursor);return t&&this.reset(),r}},xo=class{constructor(t){this.dest=t,this.cursor=0,this.chunks=[t]}reset(){this.cursor=0}push(t){if(this.cursor+t.length>this.dest.length)throw new Error("write out of bounds, destination buffer is too small");this.dest.set(t,this.cursor),this.cursor+=t.length}toBytes(t=!1){let r=this.dest.subarray(0,this.cursor);return t&&this.reset(),r}};var Te="CBOR decode error:",Ea="CBOR encode error:",Oi=[];Oi[23]=1;Oi[24]=2;Oi[25]=3;Oi[26]=5;Oi[27]=9;function mr(e,t,r){if(e.length-t<r)throw new Error(`${Te} not enough data for type`)}var Ye=[24,256,65536,4294967296,BigInt("18446744073709551616")];function yt(e,t,r){mr(e,t,1);let n=e[t];if(r.strict===!0&&n<Ye[0])throw new Error(`${Te} integer encoded in more bytes than necessary (strict decode)`);return n}function gt(e,t,r){mr(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<Ye[1])throw new Error(`${Te} integer encoded in more bytes than necessary (strict decode)`);return n}function mt(e,t,r){mr(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(`${Te} integer encoded in more bytes than necessary (strict decode)`);return n}function bt(e,t,r){mr(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(`${Te} 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(`${Te} integers outside of the safe integer range are not supported`)}function rf(e,t,r,n){return new se(L.uint,yt(e,t+1,n),2)}function nf(e,t,r,n){return new se(L.uint,gt(e,t+1,n),3)}function of(e,t,r,n){return new se(L.uint,mt(e,t+1,n),5)}function sf(e,t,r,n){return new se(L.uint,bt(e,t+1,n),9)}function Ct(e,t){return Qe(e,0,t.value)}function Qe(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(`${Te} encountered BigInt larger than allowable range`)}}Ct.encodedSize=function(t){return Qe.encodedSize(t.value)};Qe.encodedSize=function(t){return t<Ye[0]?1:t<Ye[1]?2:t<Ye[2]?3:t<Ye[3]?5:9};Ct.compareTokens=function(t,r){return t.value<r.value?-1:t.value>r.value?1:0};function af(e,t,r,n){return new se(L.negint,-1-yt(e,t+1,n),2)}function uf(e,t,r,n){return new se(L.negint,-1-gt(e,t+1,n),3)}function cf(e,t,r,n){return new se(L.negint,-1-mt(e,t+1,n),5)}var Ia=BigInt(-1),ff=BigInt(1);function lf(e,t,r,n){let i=bt(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new se(L.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${Te} integers outside of the safe integer range are not supported`);return new se(L.negint,Ia-BigInt(i),9)}function Co(e,t){let r=t.value,n=typeof r=="bigint"?r*Ia-ff:r*-1-1;Qe(e,t.type.majorEncoded,n)}Co.encodedSize=function(t){let r=t.value,n=typeof r=="bigint"?r*Ia-ff:r*-1-1;return n<Ye[0]?1:n<Ye[1]?2:n<Ye[2]?3:n<Ye[3]?5:9};Co.compareTokens=function(t,r){return t.value<r.value?1:t.value>r.value?-1:0};function Ei(e,t,r,n){mr(e,t,r+n);let i=e.slice(t+r,t+r+n);return new se(L.bytes,i,r+n)}function df(e,t,r,n){return Ei(e,t,1,r)}function pf(e,t,r,n){return Ei(e,t,2,yt(e,t+1,n))}function hf(e,t,r,n){return Ei(e,t,3,gt(e,t+1,n))}function yf(e,t,r,n){return Ei(e,t,5,mt(e,t+1,n))}function gf(e,t,r,n){let i=bt(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Te} 64-bit integer bytes lengths not supported`);return Ei(e,t,9,i)}function No(e){return e.encodedBytes===void 0&&(e.encodedBytes=L.equals(e.type,L.string)?Oa(e.value):e.value),e.encodedBytes}function Dn(e,t){let r=No(t);Qe(e,t.type.majorEncoded,r.length),e.push(r)}Dn.encodedSize=function(t){let r=No(t);return Qe.encodedSize(r.length)+r.length};Dn.compareTokens=function(t,r){return vg(No(t),No(r))};function vg(e,t){return e.length<t.length?-1:e.length>t.length?1:So(e,t)}var mf=new TextDecoder,wg=32;function Tg(e,t,r){if(r-t<wg){let i="";for(let o=t;o<r;o++){let s=e[o];if(s&128)return mf.decode(e.subarray(t,r));i+=String.fromCharCode(s)}return i}return mf.decode(e.subarray(t,r))}function Ii(e,t,r,n,i){let o=r+n;mr(e,t,o);let s=new se(L.string,Tg(e,t+r,t+o),o);return i.retainStringBytes===!0&&(s.byteValue=e.slice(t+r,t+o)),s}function bf(e,t,r,n){return Ii(e,t,1,r,n)}function vf(e,t,r,n){return Ii(e,t,2,yt(e,t+1,n),n)}function _f(e,t,r,n){return Ii(e,t,3,gt(e,t+1,n),n)}function wf(e,t,r,n){return Ii(e,t,5,mt(e,t+1,n),n)}function Tf(e,t,r,n){let i=bt(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Te} 64-bit integer string lengths not supported`);return Ii(e,t,9,i,n)}var Af=Dn;function Ln(e,t,r,n){return new se(L.array,n,r)}function Of(e,t,r,n){return Ln(e,t,1,r)}function Ef(e,t,r,n){return Ln(e,t,2,yt(e,t+1,n))}function If(e,t,r,n){return Ln(e,t,3,gt(e,t+1,n))}function Sf(e,t,r,n){return Ln(e,t,5,mt(e,t+1,n))}function xf(e,t,r,n){let i=bt(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Te} 64-bit integer array lengths not supported`);return Ln(e,t,9,i)}function Cf(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Te} indefinite length items not allowed`);return Ln(e,t,1,1/0)}function Ro(e,t){Qe(e,L.array.majorEncoded,t.value)}Ro.compareTokens=Ct.compareTokens;Ro.encodedSize=function(t){return Qe.encodedSize(t.value)};function jn(e,t,r,n){return new se(L.map,n,r)}function Nf(e,t,r,n){return jn(e,t,1,r)}function Rf(e,t,r,n){return jn(e,t,2,yt(e,t+1,n))}function $f(e,t,r,n){return jn(e,t,3,gt(e,t+1,n))}function Pf(e,t,r,n){return jn(e,t,5,mt(e,t+1,n))}function Uf(e,t,r,n){let i=bt(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Te} 64-bit integer map lengths not supported`);return jn(e,t,9,i)}function Bf(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Te} indefinite length items not allowed`);return jn(e,t,1,1/0)}function $o(e,t){Qe(e,L.map.majorEncoded,t.value)}$o.compareTokens=Ct.compareTokens;$o.encodedSize=function(t){return Qe.encodedSize(t.value)};function kf(e,t,r,n){return new se(L.tag,r,1)}function Mf(e,t,r,n){return new se(L.tag,yt(e,t+1,n),2)}function Df(e,t,r,n){return new se(L.tag,gt(e,t+1,n),3)}function Lf(e,t,r,n){return new se(L.tag,mt(e,t+1,n),5)}function jf(e,t,r,n){return new se(L.tag,bt(e,t+1,n),9)}function Po(e,t){Qe(e,L.tag.majorEncoded,t.value)}Po.compareTokens=Ct.compareTokens;Po.encodedSize=function(t){return Qe.encodedSize(t.value)};var Sa=20,xa=21,Ca=22,Na=23;function Ff(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${Te} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new se(L.null,null,1):new se(L.undefined,void 0,1)}function Vf(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Te} indefinite length items not allowed`);return new se(L.break,void 0,1)}function Ra(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${Te} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${Te} Infinity values are not supported`)}return new se(L.float,e,t)}function zf(e,t,r,n){return Ra($a(e,t+1),3,n)}function qf(e,t,r,n){return Ra(Pa(e,t+1),5,n)}function Kf(e,t,r,n){return Ra(Jf(e,t+1),9,n)}function Uo(e,t,r){let n=t.value;if(n===!1)e.push([L.float.majorEncoded|Sa]);else if(n===!0)e.push([L.float.majorEncoded|xa]);else if(n===null)e.push([L.float.majorEncoded|Ca]);else if(n===void 0)e.push([L.float.majorEncoded|Na]);else{let i,o=!1;(!r||r.float64!==!0)&&(Wf(n),i=$a(Wt,1),n===i||Number.isNaN(n)?(Wt[0]=249,e.push(Wt.slice(0,3)),o=!0):(Hf(n),i=Pa(Wt,1),n===i&&(Wt[0]=250,e.push(Wt.slice(0,5)),o=!0))),o||(Sg(n),i=Jf(Wt,1),Wt[0]=251,e.push(Wt.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){Wf(n);let i=$a(Wt,1);if(n===i||Number.isNaN(n))return 3;if(Hf(n),i=Pa(Wt,1),n===i)return 5}return 9};var Gf=new ArrayBuffer(9),Nt=new DataView(Gf,1),Wt=new Uint8Array(Gf,0);function Wf(e){if(e===1/0)Nt.setUint16(0,31744,!1);else if(e===-1/0)Nt.setUint16(0,64512,!1);else if(Number.isNaN(e))Nt.setUint16(0,32256,!1);else{Nt.setFloat32(0,e);let t=Nt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)Nt.setUint16(0,31744,!1);else if(r===0)Nt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?Nt.setUint16(0,0):i<-14?Nt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):Nt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function $a(e,t){if(e.length-t<2)throw new Error(`${Te} 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 Hf(e){Nt.setFloat32(0,e,!1)}function Pa(e,t){if(e.length-t<4)throw new Error(`${Te} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function Sg(e){Nt.setFloat64(0,e,!1)}function Jf(e,t){if(e.length-t<8)throw new Error(`${Te} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}Uo.compareTokens=Ct.compareTokens;function xe(e,t,r){throw new Error(`${Te} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Bo(e){return()=>{throw new Error(`${Te} ${e}`)}}var ae=[];for(let e=0;e<=23;e++)ae[e]=xe;ae[24]=rf;ae[25]=nf;ae[26]=of;ae[27]=sf;ae[28]=xe;ae[29]=xe;ae[30]=xe;ae[31]=xe;for(let e=32;e<=55;e++)ae[e]=xe;ae[56]=af;ae[57]=uf;ae[58]=cf;ae[59]=lf;ae[60]=xe;ae[61]=xe;ae[62]=xe;ae[63]=xe;for(let e=64;e<=87;e++)ae[e]=df;ae[88]=pf;ae[89]=hf;ae[90]=yf;ae[91]=gf;ae[92]=xe;ae[93]=xe;ae[94]=xe;ae[95]=Bo("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ae[e]=bf;ae[120]=vf;ae[121]=_f;ae[122]=wf;ae[123]=Tf;ae[124]=xe;ae[125]=xe;ae[126]=xe;ae[127]=Bo("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ae[e]=Of;ae[152]=Ef;ae[153]=If;ae[154]=Sf;ae[155]=xf;ae[156]=xe;ae[157]=xe;ae[158]=xe;ae[159]=Cf;for(let e=160;e<=183;e++)ae[e]=Nf;ae[184]=Rf;ae[185]=$f;ae[186]=Pf;ae[187]=Uf;ae[188]=xe;ae[189]=xe;ae[190]=xe;ae[191]=Bf;for(let e=192;e<=215;e++)ae[e]=kf;ae[216]=Mf;ae[217]=Df;ae[218]=Lf;ae[219]=jf;ae[220]=xe;ae[221]=xe;ae[222]=xe;ae[223]=xe;for(let e=224;e<=243;e++)ae[e]=Bo("simple values are not supported");ae[244]=xe;ae[245]=xe;ae[246]=xe;ae[247]=Ff;ae[248]=Bo("simple values are not supported");ae[249]=zf;ae[250]=qf;ae[251]=Kf;ae[252]=xe;ae[253]=xe;ae[254]=xe;ae[255]=Vf;var Ht=[];for(let e=0;e<24;e++)Ht[e]=new se(L.uint,e,1);for(let e=-1;e>=-24;e--)Ht[31-e]=new se(L.negint,e,1);Ht[64]=new se(L.bytes,new Uint8Array(0),1);Ht[96]=new se(L.string,"",1);Ht[128]=new se(L.array,0,1);Ht[160]=new se(L.map,0,1);Ht[244]=new se(L.false,!1,1);Ht[245]=new se(L.true,!0,1);Ht[246]=new se(L.null,null,1);function Ua(e){switch(e.type){case L.false:return sr([244]);case L.true:return sr([245]);case L.null:return sr([246]);case L.bytes:return e.value.length?void 0:sr([64]);case L.string:return e.value===""?sr([96]):void 0;case L.array:return e.value===0?sr([128]):void 0;case L.map:return e.value===0?sr([160]):void 0;case L.uint:return e.value<24?sr([Number(e.value)]):void 0;case L.negint:if(e.value>=-24)return sr([31-Number(e.value)])}}var Yf=Object.freeze({float64:!0,mapSorter:$g,quickEncodeToken:Ua});function Ba(){let e=[];return e[L.uint.major]=Ct,e[L.negint.major]=Co,e[L.bytes.major]=Dn,e[L.string.major]=Af,e[L.array.major]=Ro,e[L.map.major]=$o,e[L.tag.major]=Po,e[L.float.major]=Uo,e}var Cg=Ba(),Ng=new Ai,ko=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(`${Ea} object contains circular references`);return new e(r,t)}},Rr={null:new se(L.null,null),undefined:new se(L.undefined,void 0),true:new se(L.true,!0),false:new se(L.false,!1),emptyArray:new se(L.array,0),emptyMap:new se(L.map,0)},$r={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new se(L.float,e):e>=0?new se(L.uint,e):new se(L.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new se(L.uint,e):new se(L.negint,e)},Uint8Array(e,t,r,n){return new se(L.bytes,e)},string(e,t,r,n){return new se(L.string,e)},boolean(e,t,r,n){return e?Rr.true:Rr.false},null(e,t,r,n){return Rr.null},undefined(e,t,r,n){return Rr.undefined},ArrayBuffer(e,t,r,n){return new se(L.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new se(L.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Rr.emptyArray,new se(L.break)]:Rr.emptyArray;n=ko.createCheck(n,e);let i=[],o=0;for(let s of e)i[o++]=Si(s,r,n);return r.addBreakTokens?[new se(L.array,e.length),i,new se(L.break)]:[new se(L.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,a;if(s){a=new Array(s),n=ko.createCheck(n,e);let u=!i&&r.ignoreUndefinedProperties,f=0;for(let l of o){let p=i?e.get(l):e[l];u&&p===void 0||(a[f++]=[Si(l,r,n),Si(p,r,n)])}f<s&&(a.length=f)}return a?.length?(Rg(a,r),r.addBreakTokens?[new se(L.map,a.length),a,new se(L.break)]:[new se(L.map,a.length),a]):r.addBreakTokens===!0?[Rr.emptyMap,new se(L.break)]:Rr.emptyMap}};$r.Map=$r.Object;$r.Buffer=$r.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))$r[`${e}Array`]=$r.DataView;function Si(e,t={},r){let n=Yc(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||$r[n];if(typeof i=="function"){let s=i(e,n,t,r);if(s!=null)return s}let o=$r[n];if(!o)throw new Error(`${Ea} unsupported type: ${n}`);return o(e,n,t,r)}function Rg(e,t){t.mapSorter&&e.sort(t.mapSorter)}function $g(e,t){if(e[0]instanceof se&&t[0]instanceof se){let r=e[0],n=t[0];return r._keyBytes||(r._keyBytes=Xf(r.value)),n._keyBytes||(n._keyBytes=Xf(n.value)),So(r._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function Xf(e){return Pg(e,Cg,Yf)}function Qf(e,t,r,n){if(Array.isArray(t))for(let i of t)Qf(e,i,r,n);else r[t.type.major](e,t,n)}var GR=L.uint.majorEncoded,WR=L.negint.majorEncoded,HR=L.bytes.majorEncoded,JR=L.string.majorEncoded,XR=L.array.majorEncoded,YR=L.float.majorEncoded|Sa,QR=L.float.majorEncoded|xa,ZR=L.float.majorEncoded|Ca,e$=L.float.majorEncoded|Na,t$=BigInt(-1),r$=BigInt(1);function Pg(e,t,r,n){let i=n instanceof Uint8Array,o=i?new xo(n):Ng,s=Si(e,r);if(!Array.isArray(s)&&r.quickEncodeToken){let a=r.quickEncodeToken(s);if(a)return i?(o.push(a),o.toBytes()):a;let u=t[s.type.major];if(u.encodedSize){let f=u.encodedSize(s,r);if(i||(o=new Ai(f)),u(o,s,r),o.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${s} was wrong`);return i?o.toBytes():Ti(o.chunks[0])}}return o.reset(),Qf(o,s,t,r),o.toBytes(!0)}var Ug={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},Mo=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=Ht[t];if(r===void 0){let n=ae[t];if(!n)throw new Error(`${Te} 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}},xi=Symbol.for("DONE"),Do=Symbol.for("BREAK");function Bg(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=Fn(t,r);if(o===Do){if(e.value===1/0)break;throw new Error(`${Te} got unexpected break to lengthed array`)}if(o===xi)throw new Error(`${Te} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function kg(e,t,r){let n=r.useMaps===!0,i=r.rejectDuplicateMapKeys===!0,o=n?void 0:{},s=n?new Map:void 0;for(let a=0;a<e.value;a++){let u=Fn(t,r);if(u===Do){if(e.value===1/0)break;throw new Error(`${Te} got unexpected break to lengthed map`)}if(u===xi)throw new Error(`${Te} found map but not enough entries (got ${a} [no key], expected ${e.value})`);if(!n&&typeof u!="string")throw new Error(`${Te} non-string keys not supported (got ${typeof u})`);if(i&&(n&&s.has(u)||!n&&Object.hasOwn(o,u)))throw new Error(`${Te} found repeat map key "${u}"`);let f=Fn(t,r);if(f===xi)throw new Error(`${Te} found map but not enough entries (got ${a} [no value], expected ${e.value})`);n?s.set(u,f):o[u]=f}return n?s:o}function Fn(e,t){if(e.done())return xi;let r=e.next();if(L.equals(r.type,L.break))return Do;if(r.type.terminal)return r.value;if(L.equals(r.type,L.array))return Bg(r,e,t);if(L.equals(r.type,L.map))return kg(r,e,t);if(L.equals(r.type,L.tag)){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Fn(e,t);return t.tags[r.value](n)}throw new Error(`${Te} tag not supported (${r.value})`)}throw new Error("unsupported")}function Zf(e,t){if(!(e instanceof Uint8Array))throw new Error(`${Te} data to decode must be a Uint8Array`);t=Object.assign({},Ug,t);let r=Ti(e),n=t.tokenizer||new Mo(r,t),i=Fn(n,t);if(i===xi)throw new Error(`${Te} did not find any content to decode`);if(i===Do)throw new Error(`${Te} got unexpected break`);return[i,e.subarray(n.pos())]}function ka(e,t){let[r,n]=Zf(e,t);if(n.length>0)throw new Error(`${Te} too many terminals, data makes no sense`);return r}var tl=42;function Lg(e){return e instanceof ArrayBuffer?new Uint8Array(e,0,e.byteLength):e}function jg(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=xt.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new se(L.tag,tl),new se(L.bytes,r)]}function Fg(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function Vg(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}function zg(e){for(let t of e.keys())if(typeof t!="string"||t.length===0)throw new Error("Non-string Map keys are not supported by the IPLD Data Model and cannot be encoded");return null}var el={float64:!0,typeEncoders:{Map:zg,Object:jg,undefined:Fg,number:Vg}},h$={...el,typeEncoders:{...el.typeEncoders}};function qg(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return xt.decode(e.subarray(1))}var Lo={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Lo.tags[tl]=qg;var y$={...Lo,tags:Lo.tags.slice()};var Ma=e=>ka(Lg(e),Lo);var Pr=wa(jo(),1),Ci={SHA2_256:18,LENGTH:32,DAG_PB:112},ja=40;function Vn(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=Pr.default.decode(e);return t.seek(Pr.default.decode.bytes),r}function Fa(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 Va(e){Pr.default.decode(e);let t=Pr.default.decode.bytes,r=Pr.default.decode(e.subarray(Pr.default.decode.bytes)),n=Pr.default.decode.bytes;return t+n+r}var Ur={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},Ni={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Ur.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Ur.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Ni["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=Ni["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Ur.Int,CarV1HeaderOrV2Pragma:e=>{if(Ur.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=Ni["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=Ni.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}},Ri={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Ur.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Ur.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Ri["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=Ri["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Ur.Int,CarV1HeaderOrV2Pragma:e=>{if(Ur.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=Ri["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=Ri.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}},za={toTyped:Ni.CarV1HeaderOrV2Pragma,toRepresentation:Ri.CarV1HeaderOrV2Pragma};var N$=Ba();var um=wa(jo(),1);var B$=[new se(L.map,2),new se(L.string,"version"),new se(L.uint,1),new se(L.string,"roots")],k$=new se(L.tag,42);async function qa(e,t){let r=Vn(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),i=Ma(n);if(za.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=Fa(await e.exactly(ja,!0));e.seek(o.dataOffset-e.pos);let s=await qa(e,1);return Object.assign(s,o)}async function fm(e){let t=await e.exactly(2,!1);if(t[0]===Ci.SHA2_256&&t[1]===Ci.LENGTH){let s=await e.exactly(34,!0),a=Eo(s);return xt.create(0,Ci.DAG_PB,a)}let r=Vn(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=Vn(await e.upTo(8),e),i=await e.exactly(Va(await e.upTo(8)),!0),o=Eo(i);return xt.create(r,n,o)}async function ll(e){let t=e.pos,r=Vn(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await fm(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function lm(e){let{cid:t,blockLength:r}=await ll(e);return{bytes:await e.exactly(r,!0),cid:t}}async function dm(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await ll(e),o={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(o.blockLength),o}function Fo(e){let t=(async()=>{let r=await qa(e);if(r.version===2){let n=e.pos-r.dataOffset;e=hm(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await lm(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await dm(e)}}}function $i(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 pm(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 f=await e();if(f==null)break;r<0?f.length>r&&a.push(f.subarray(-r)):a.push(f),r+=f.length}i=new Uint8Array(a.reduce((f,l)=>f+l.length,0));let u=0;for(let f of a)i.set(f,u),u+=f.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 pm(r)}function hm(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 nn=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 dl($i(t))}static async fromIterable(t){if(!t||typeof t[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return dl(Vo(t))}};async function dl(e){let t=Fo(e),r=await t.header(),n=[];for await(let i of t.blocks())n.push(i);return new nn(r,n)}var gm=wa(jo(),1);var mm={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"},bm=mm;function de(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:bm[e];throw typeof i=="function"&&(i=i.apply(null,r)),new Error("[MobX] "+i)}var vm={};function os(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:vm}var Rl=Object.assign,Xo=Object.getOwnPropertyDescriptor,ur=Object.defineProperty,Mi=Object.prototype,Yo=[];Object.freeze(Yo);var iu={};Object.freeze(iu);var _m=typeof Proxy<"u",wm=Object.toString();function $l(){_m||de("`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`")}function Pi(e){Y.verifyProxies&&de("MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to "+e)}function Lt(){return++Y.mobxGuid}function ou(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var qn=function(){};function Ke(e){return typeof e=="function"}function sn(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function ss(e){return e!==null&&typeof e=="object"}function Zt(e){if(!ss(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()===wm}function Pl(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function as(e,t,r){ur(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function Ul(e,t,r){ur(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}function Dr(e,t){var r="isMobX"+e;return t.prototype[r]=!0,function(n){return ss(n)&&n[r]===!0}}function Hn(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function Tm(e){var t=Object.getPrototypeOf(e),r=Object.getPrototypeOf(t),n=Object.getPrototypeOf(r);return n===null}function br(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var Bl=typeof Object.getOwnPropertySymbols<"u";function Am(e){var t=Object.keys(e);if(!Bl)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(n){return Mi.propertyIsEnumerable.call(e,n)})):t}var us=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Bl?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Wa(e){return typeof e=="string"?e:typeof e=="symbol"?e.toString():new String(e).toString()}function kl(e){return e===null?null:typeof e=="object"?""+e:e}function Bt(e,t){return Mi.hasOwnProperty.call(e,t)}var Om=Object.getOwnPropertyDescriptors||function(t){var r={};return us(t).forEach(function(n){r[n]=Xo(t,n)}),r};function vt(e,t){return!!(e&t)}function _t(e,t,r){return r?e|=t:e&=~t,e}function pl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function hl(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,Im(n.key),n)}}function Jn(e,t,r){return t&&hl(e.prototype,t),r&&hl(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Kn(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=Sm(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 wr(){return wr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},wr.apply(null,arguments)}function Ml(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ha(e,t)}function Ha(e,t){return Ha=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Ha(e,t)}function Em(e,t){if(typeof e!="object"||!e)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 Im(e){var t=Em(e,"string");return typeof t=="symbol"?t:t+""}function Sm(e,t){if(e){if(typeof e=="string")return pl(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?pl(e,t):void 0}}var lt=Symbol("mobx-stored-annotations");function cr(e){function t(r,n){if(Li(n))return e.decorate_20223_(r,n);Di(r,n,e)}return Object.assign(t,e)}function Di(e,t,r){if(Bt(e,lt)||as(e,lt,wr({},e[lt])),Qo(r)&&!Bt(e[lt],t)){var n=e.constructor.name+".prototype."+t.toString();de("'"+n+"' is decorated with 'override', but no such decorated member was found on prototype.")}xm(e,r,t),Qo(r)||(e[lt][t]=r)}function xm(e,t,r){if(!Qo(t)&&Bt(e[lt],r)){var n=e.constructor.name+".prototype."+r.toString(),i=e[lt][r].annotationType_,o=t.annotationType_;de("Cannot apply '@"+o+"' to '"+n+"':"+(`
|
|
3
|
+
The field is already decorated with '@`+i+"'.")+`
|
|
4
|
+
Re-decorating fields is not allowed.
|
|
5
|
+
Use '@override' decorator for methods overridden by subclass.`)}}function Cm(e){return Bt(e,lt)||as(e,lt,wr({},e[lt])),e[lt]}function Li(e){return typeof e=="object"&&typeof e.kind=="string"}function cs(e,t){t.includes(e.kind)||de("The decorator applied to '"+String(e.name)+"' cannot be used on a "+e.kind+" element")}var we=Symbol("mobx administration"),Lr=(function(){function e(r){r===void 0&&(r="Atom@"+Lt()),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=Ce.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 td(this)},t.reportChanged=function(){Pt(),rd(this),Ut()},t.toString=function(){return this.name_},Jn(e,[{key:"isBeingObserved",get:function(){return vt(this.flags_,e.isBeingObservedMask_)},set:function(n){this.flags_=_t(this.flags_,e.isBeingObservedMask_,n)}},{key:"isPendingUnobservation",get:function(){return vt(this.flags_,e.isPendingUnobservationMask_)},set:function(n){this.flags_=_t(this.flags_,e.isPendingUnobservationMask_,n)}},{key:"diffValue",get:function(){return vt(this.flags_,e.diffValueMask_)?1:0},set:function(n){this.flags_=_t(this.flags_,e.diffValueMask_,n===1)}}])})();Lr.isBeingObservedMask_=1;Lr.isPendingUnobservationMask_=2;Lr.diffValueMask_=4;var su=Dr("Atom",Lr);function Dl(e,t,r){t===void 0&&(t=qn),r===void 0&&(r=qn);var n=new Lr(e);return t!==qn&&Yn(n,t),r!==qn&&dn(n,r),n}function Nm(e,t){return e===t}function Rm(e,t){return hu(e,t)}function $m(e,t){return hu(e,t,1)}function Pm(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var We={identity:Nm,structural:Rm,default:Pm,shallow:$m};function an(e,t,r){return Wn(e)?e:Array.isArray(e)?Me.array(e,{name:r}):Zt(e)?Me.object(e,void 0,{name:r}):Hn(e)?Me.map(e,{name:r}):br(e)?Me.set(e,{name:r}):typeof e=="function"&&!Mr(e)&&!ki(e)?Pl(e)?Gn(e):Bi(r,e):e}function Um(e,t,r){if(e==null||fn(e)||Qn(e)||fr(e)||Jt(e))return e;if(Array.isArray(e))return Me.array(e,{name:r,deep:!1});if(Zt(e))return Me.object(e,void 0,{name:r,deep:!1});if(Hn(e))return Me.map(e,{name:r,deep:!1});if(br(e))return Me.set(e,{name:r,deep:!1});de("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets")}function fs(e){return e}function Bm(e,t){return Wn(e)&&de("observable.struct should not be used with observable values"),hu(e,t)?t:e}var km="override";function Qo(e){return e.annotationType_===km}function ji(e,t){return{annotationType_:e,options_:t,make_:Mm,extend_:Dm,decorate_20223_:Lm}}function Mm(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(Mr(r.value))return 1;var o=Ll(e,this,t,r,!1);return ur(n,t,o),2}function Dm(e,t,r,n){var i=Ll(e,this,t,r);return e.defineProperty_(t,i,n)}function Lm(e,t){cs(t,["method","field"]);var r=t.kind,n=t.name,i=t.addInitializer,o=this,s=function(f){var l,p,C,A;return un((l=(p=o.options_)==null?void 0:p.name)!=null?l:n.toString(),f,(C=(A=o.options_)==null?void 0:A.autoAction)!=null?C:!1)};if(r=="field")return function(u){var f,l=u;return Mr(l)||(l=s(l)),(f=o.options_)!=null&&f.bound&&(l=l.bind(this),l.isMobxAction=!0),l};if(r=="method"){var a;return Mr(e)||(e=s(e)),(a=this.options_)!=null&&a.bound&&i(function(){var u=this,f=u[n].bind(u);f.isMobxAction=!0,u[n]=f}),e}de("Cannot apply '"+o.annotationType_+"' to '"+String(n)+"' (kind: "+r+"):"+(`
|
|
6
|
+
'`+o.annotationType_+"' can only be used on properties with a function value."))}function jm(e,t,r,n){var i=t.annotationType_,o=n.value;Ke(o)||de("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
7
|
+
'`+i+"' can only be used on properties with a function value."))}function Ll(e,t,r,n,i){var o,s,a,u,f,l,p;i===void 0&&(i=Y.safeDescriptors),jm(e,t,r,n);var C=n.value;if((o=t.options_)!=null&&o.bound){var A;C=C.bind((A=e.proxy_)!=null?A:e.target_)}return{value:un((s=(a=t.options_)==null?void 0:a.name)!=null?s:r.toString(),C,(u=(f=t.options_)==null?void 0:f.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 jl(e,t){return{annotationType_:e,options_:t,make_:Fm,extend_:Vm,decorate_20223_:zm}}function Fm(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&&(!Bt(e.target_,t)||!ki(e.target_[t]))&&this.extend_(e,t,r,!1)===null)return 0;if(ki(r.value))return 1;var o=Fl(e,this,t,r,!1,!1);return ur(n,t,o),2}function Vm(e,t,r,n){var i,o=Fl(e,this,t,r,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,o,n)}function zm(e,t){var r;cs(t,["method"]);var n=t.name,i=t.addInitializer;return ki(e)||(e=Gn(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 qm(e,t,r,n){var i=t.annotationType_,o=n.value;Ke(o)||de("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
8
|
+
'`+i+"' can only be used on properties with a generator function value."))}function Fl(e,t,r,n,i,o){o===void 0&&(o=Y.safeDescriptors),qm(e,t,r,n);var s=n.value;if(ki(s)||(s=Gn(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 au(e,t){return{annotationType_:e,options_:t,make_:Km,extend_:Gm,decorate_20223_:Wm}}function Km(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function Gm(e,t,r,n){return Hm(e,this,t,r),e.defineComputedProperty_(t,wr({},this.options_,{get:r.get,set:r.set}),n)}function Wm(e,t){cs(t,["getter"]);var r=this,n=t.name,i=t.addInitializer;return i(function(){var o=Zn(this)[we],s=wr({},r.options_,{get:e,context:this});s.name||(s.name=o.name_+"."+n.toString()),o.values_.set(n,new Mt(s))}),function(){return this[we].getObservablePropValue_(n)}}function Hm(e,t,r,n){var i=t.annotationType_,o=n.get;o||de("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
9
|
+
'`+i+"' can only be used on getter(+setter) properties."))}function ls(e,t){return{annotationType_:e,options_:t,make_:Jm,extend_:Xm,decorate_20223_:Ym}}function Jm(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function Xm(e,t,r,n){var i,o;return Qm(e,this,t,r),e.defineObservableProperty_(t,r.value,(i=(o=this.options_)==null?void 0:o.enhancer)!=null?i:an,n)}function Ym(e,t){if(t.kind==="field")throw de("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");cs(t,["accessor"]);var r=this,n=t.kind,i=t.name,o=new WeakSet;function s(a,u){var f,l,p=Zn(a)[we],C=new kr(u,(f=(l=r.options_)==null?void 0:l.enhancer)!=null?f:an,p.name_+"."+i.toString(),!1);p.values_.set(i,C),o.add(a)}if(n=="accessor")return{get:function(){return o.has(this)||s(this,e.get.call(this)),this[we].getObservablePropValue_(i)},set:function(u){return o.has(this)||s(this,u),this[we].setObservablePropValue_(i,u)},init:function(u){return o.has(this)||s(this,u),u}}}function Qm(e,t,r,n){var i=t.annotationType_;"value"in n||de("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
10
|
+
'`+i+"' cannot be used on getter/setter properties"))}var Zm="true",eb=Vl();function Vl(e){return{annotationType_:Zm,options_:e,make_:tb,extend_:rb,decorate_20223_:nb}}function tb(e,t,r,n){var i,o;if(r.get)return Ve.make_(e,t,r,n);if(r.set){var s=un(t.toString(),r.set);return n===e.target_?e.defineProperty_(t,{configurable:Y.safeDescriptors?e.isPlainObject_:!0,set:s})===null?0:2:(ur(n,t,{configurable:!0,set:s}),2)}if(n!==e.target_&&typeof r.value=="function"){var a;if(Pl(r.value)){var u,f=(u=this.options_)!=null&&u.autoBind?Gn.bound:Gn;return f.make_(e,t,r,n)}var l=(a=this.options_)!=null&&a.autoBind?Bi.bound:Bi;return l.make_(e,t,r,n)}var p=((i=this.options_)==null?void 0:i.deep)===!1?Me.ref:Me;if(typeof r.value=="function"&&(o=this.options_)!=null&&o.autoBind){var C;r.value=r.value.bind((C=e.proxy_)!=null?C:e.target_)}return p.make_(e,t,r,n)}function rb(e,t,r,n){var i,o;if(r.get)return Ve.extend_(e,t,r,n);if(r.set)return e.defineProperty_(t,{configurable:Y.safeDescriptors?e.isPlainObject_:!0,set:un(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?Me.ref:Me;return a.extend_(e,t,r,n)}function nb(e,t){de("'"+this.annotationType_+"' cannot be used as a decorator")}var ib="observable",ob="observable.ref",sb="observable.shallow",ab="observable.struct",zl={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(zl);function zo(e){return e||zl}var Ja=ls(ib),ub=ls(ob,{enhancer:fs}),cb=ls(sb,{enhancer:Um}),fb=ls(ab,{enhancer:Bm}),ql=cr(Ja);function qo(e){return e.deep===!0?an:e.deep===!1?fs:db(e.defaultDecorator)}function lb(e){var t;return e?(t=e.defaultDecorator)!=null?t:Vl(e):void 0}function db(e){var t,r;return e&&(t=(r=e.options_)==null?void 0:r.enhancer)!=null?t:an}function Kl(e,t,r){if(Li(t))return Ja.decorate_20223_(e,t);if(sn(t)){Di(e,t,Ja);return}return Wn(e)?e:Zt(e)?Me.object(e,t,r):Array.isArray(e)?Me.array(e,t):Hn(e)?Me.map(e,t):br(e)?Me.set(e,t):typeof e=="object"&&e!==null?e:Me.box(e,t)}Rl(Kl,ql);var pb={box:function(t,r){var n=zo(r);return new kr(t,qo(n),n.name,!0,n.equals)},array:function(t,r){var n=zo(r);return(Y.useProxies===!1||n.proxy===!1?pv:nv)(t,qo(n),n.name)},map:function(t,r){var n=zo(r);return new md(t,qo(n),n.name)},set:function(t,r){var n=zo(r);return new bd(t,qo(n),n.name)},object:function(t,r,n){return pn(function(){return Gb(Y.useProxies===!1||n?.proxy===!1?Zn({},n):ev({},n),t,r)})},ref:cr(ub),shallow:cr(cb),deep:ql,struct:cr(fb)},Me=Rl(Kl,pb),Gl="computed",hb="computed.struct",Xa=au(Gl),yb=au(hb,{equals:We.structural}),Ve=function(t,r){if(Li(r))return Xa.decorate_20223_(t,r);if(sn(r))return Di(t,r,Xa);if(Zt(t))return cr(au(Gl,t));Ke(t)||de("First argument to `computed` should be an expression."),Ke(r)&&de("A setter as second argument is no longer supported, use `{ set: fn }` option instead");var n=Zt(r)?r:{};return n.get=t,n.name||(n.name=t.name||""),new Mt(n)};Object.assign(Ve,Xa);Ve.struct=cr(yb);var yl,gl,Zo=0,gb=1,mb=(yl=(gl=Xo(function(){},"name"))==null?void 0:gl.configurable)!=null?yl:!1,ml={value:"action",configurable:!0,writable:!1,enumerable:!1};function un(e,t,r,n){r===void 0&&(r=!1),Ke(t)||de("`action` can only be invoked on functions"),(typeof e!="string"||!e)&&de("actions should have valid names, got: '"+e+"'");function i(){return Wl(e,r,t,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},mb&&(ml.value=e,ur(i,"name",ml)),i}function Wl(e,t,r,n,i){var o=bb(e,t,n,i);try{return r.apply(n,i)}catch(s){throw o.error_=s,s}finally{vb(o)}}function bb(e,t,r,n){var i=tt()&&!!e,o=0;if(i){o=Date.now();var s=n?Array.from(n):Yo;wt({type:cu,name:e,object:r,arguments:s})}var a=Y.trackingDerivation,u=!t||!a;Pt();var f=Y.allowStateChanges;u&&(ln(),f=ds(!0));var l=uu(!0),p={runAsAction_:u,prevDerivation_:a,prevAllowStateChanges_:f,prevAllowStateReads_:l,notifySpy_:i,startTime_:o,actionId_:gb++,parentActionId_:Zo};return Zo=p.actionId_,p}function vb(e){Zo!==e.actionId_&&de(30),Zo=e.parentActionId_,e.error_!==void 0&&(Y.suppressReactionErrors=!0),ps(e.prevAllowStateChanges_),Ui(e.prevAllowStateReads_),Ut(),e.runAsAction_&&_r(e.prevDerivation_),e.notifySpy_&&Tt({time:Date.now()-e.startTime_}),Y.suppressReactionErrors=!1}function _b(e,t){var r=ds(e);try{return t()}finally{ps(r)}}function ds(e){var t=Y.allowStateChanges;return Y.allowStateChanges=e,t}function ps(e){Y.allowStateChanges=e}var wb="create",kr=(function(e){function t(n,i,o,s,a){var u;return o===void 0&&(o="ObservableValue@"+Lt()),s===void 0&&(s=!0),a===void 0&&(a=We.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&&tt()&&cn({type:wb,object:u,observableKind:"value",debugObjectName:u.name_,newValue:""+u.value_}),u}Ml(t,e);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!==Y.UNCHANGED){var s=tt();s&&wt({type:Xt,object:this,observableKind:"value",debugObjectName:this.name_,newValue:i,oldValue:o}),this.setNewValue_(i),s&&Tt()}},r.prepareNewValue_=function(i){if(ar(this),Rt(this)){var o=$t(this,{object:this,type:Xt,newValue:i});if(!o)return Y.UNCHANGED;i=o.newValue}return i=this.enhancer(i,this.value_,this.name_),this.equals(this.value_,i)?Y.UNCHANGED:i},r.setNewValue_=function(i){var o=this.value_;this.value_=i,this.reportChanged(),Yt(this)&&Qt(this,{type:Xt,object:this,newValue:i,oldValue:o})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(i){return qi(this,i)},r.observe_=function(i,o){return o&&i({observableKind:"value",debugObjectName:this.name_,object:this,type:Xt,newValue:this.value_,oldValue:void 0}),Ki(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 kl(this.get())},r[Symbol.toPrimitive]=function(){return this.valueOf()},t})(Lr),Tb=Dr("ObservableValue",kr),Mt=(function(){function e(r){this.dependenciesState_=Ce.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Ce.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new es(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=kt.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||de(31),this.derivation=r.get,this.name_=r.name||"ComputedValue@"+Lt(),r.set&&(this.setter_=un(this.name_+"-setter",r.set)),this.equals_=r.equals||(r.compareStructural||r.struct?We.structural:We.default),this.scope_=r.context,this.requiresReaction_=r.requiresReaction,this.keepAlive_=!!r.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){Rb(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&&de(32,this.name_,this.derivation),Y.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)Ya(this)&&(this.warnAboutUntrackedRead_(),Pt(),this.value_=this.computeValue_(!1),Ut());else if(td(this),Ya(this)){var n=Y.trackingContext;this.keepAlive_&&!n&&(Y.trackingContext=this),this.trackAndCompute()&&Nb(this),Y.trackingContext=n}var i=this.value_;if(Wo(i))throw i.cause;return i},t.set=function(n){if(this.setter_){this.isRunningSetter&&de(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,n)}finally{this.isRunningSetter=!1}}else de(34,this.name_)},t.trackAndCompute=function(){var n=this.value_,i=this.dependenciesState_===Ce.NOT_TRACKING_,o=this.computeValue_(!0),s=i||Wo(n)||Wo(o)||!this.equals_(n,o);return s&&(this.value_=o,tt()&&cn({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:n,newValue:o})),s},t.computeValue_=function(n){this.isComputing=!0;var i=ds(!1),o;if(n)o=Jl(this,this.derivation,this.scope_);else if(Y.disableErrorBoundaries===!0)o=this.derivation.call(this.scope_);else try{o=this.derivation.call(this.scope_)}catch(s){o=new es(s)}return ps(i),this.isComputing=!1,o},t.suspend_=function(){this.keepAlive_||(Qa(this),this.value_=void 0,this.isTracing_!==kt.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 jt(function(){var u=o.get();if(!s||i){var f=ln();n({observableKind:"computed",debugObjectName:o.name_,type:Xt,object:o,newValue:u,oldValue:a}),_r(f)}s=!1,a=u})},t.warnAboutUntrackedRead_=function(){this.isTracing_!==kt.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_:Y.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 kl(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},Jn(e,[{key:"isComputing",get:function(){return vt(this.flags_,e.isComputingMask_)},set:function(n){this.flags_=_t(this.flags_,e.isComputingMask_,n)}},{key:"isRunningSetter",get:function(){return vt(this.flags_,e.isRunningSetterMask_)},set:function(n){this.flags_=_t(this.flags_,e.isRunningSetterMask_,n)}},{key:"isBeingObserved",get:function(){return vt(this.flags_,e.isBeingObservedMask_)},set:function(n){this.flags_=_t(this.flags_,e.isBeingObservedMask_,n)}},{key:"isPendingUnobservation",get:function(){return vt(this.flags_,e.isPendingUnobservationMask_)},set:function(n){this.flags_=_t(this.flags_,e.isPendingUnobservationMask_,n)}},{key:"diffValue",get:function(){return vt(this.flags_,e.diffValueMask_)?1:0},set:function(n){this.flags_=_t(this.flags_,e.diffValueMask_,n===1)}}])})();Mt.isComputingMask_=1;Mt.isRunningSetterMask_=2;Mt.isBeingObservedMask_=4;Mt.isPendingUnobservationMask_=8;Mt.diffValueMask_=16;var Fi=Dr("ComputedValue",Mt),Ce;(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_"})(Ce||(Ce={}));var kt;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(kt||(kt={}));var es=function(t){this.cause=void 0,this.cause=t};function Wo(e){return e instanceof es}function Ya(e){switch(e.dependenciesState_){case Ce.UP_TO_DATE_:return!1;case Ce.NOT_TRACKING_:case Ce.STALE_:return!0;case Ce.POSSIBLY_STALE_:{for(var t=uu(!0),r=ln(),n=e.observing_,i=n.length,o=0;o<i;o++){var s=n[o];if(Fi(s)){if(Y.disableErrorBoundaries)s.get();else try{s.get()}catch{return _r(r),Ui(t),!0}if(e.dependenciesState_===Ce.STALE_)return _r(r),Ui(t),!0}}return Xl(e),_r(r),Ui(t),!1}}}function Hl(){return Y.trackingDerivation!==null}function ar(e){var t=e.observers_.size>0;!Y.allowStateChanges&&(t||Y.enforceActions==="always")&&console.warn("[MobX] "+(Y.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 Ab(e){!Y.allowStateReads&&Y.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}function Jl(e,t,r){var n=uu(!0);Xl(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++Y.runId;var i=Y.trackingDerivation;Y.trackingDerivation=e,Y.inBatch++;var o;if(Y.disableErrorBoundaries===!0)o=t.call(r);else try{o=t.call(r)}catch(s){o=new es(s)}return Y.inBatch--,Y.trackingDerivation=i,Eb(e),Ob(e),Ui(n),o}function Ob(e){e.observing_.length===0&&(typeof e.requiresObservable_=="boolean"?e.requiresObservable_:Y.reactionRequiresObservable)&&console.warn("[mobx] Derivation '"+e.name_+"' is created/updated without reading any observable value.")}function Eb(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=Ce.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&&Zl(u,e),u.diffValue=0}for(;i--;){var f=r[i];f.diffValue===1&&(f.diffValue=0,Cb(f,e))}n!==Ce.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}function Qa(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)Zl(t[r],e);e.dependenciesState_=Ce.NOT_TRACKING_}function ke(e){var t=ln();try{return e()}finally{_r(t)}}function ln(){var e=Y.trackingDerivation;return Y.trackingDerivation=null,e}function _r(e){Y.trackingDerivation=e}function uu(e){var t=Y.allowStateReads;return Y.allowStateReads=e,t}function Ui(e){Y.allowStateReads=e}function Xl(e){if(e.dependenciesState_!==Ce.UP_TO_DATE_){e.dependenciesState_=Ce.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Ce.UP_TO_DATE_}}var Ho=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},Jo=!0,Yl=!1,Y=(function(){var e=os();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Jo=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new Ho().version&&(Jo=!1),Jo?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Ho):(setTimeout(function(){Yl||de(35)},1),new Ho)})();function Ib(){if((Y.pendingReactions.length||Y.inBatch||Y.isRunningReactions)&&de(36),Yl=!0,Jo){var e=os();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),Y=new Ho}}function Ql(){return Y}function Sb(e){return e.observers_&&e.observers_.size>0}function xb(e){return e.observers_}function Cb(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Zl(e,t){e.observers_.delete(t),e.observers_.size===0&&ed(e)}function ed(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,Y.pendingUnobservations.push(e))}function Pt(){Y.inBatch++}function Ut(){if(--Y.inBatch===0){od();for(var e=Y.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 Mt&&r.suspend_())}Y.pendingUnobservations=[]}}function td(e){Ab(e);var t=Y.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&Y.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&Y.inBatch>0&&ed(e),!1)}function rd(e){e.lowestObserverState_!==Ce.STALE_&&(e.lowestObserverState_=Ce.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ce.UP_TO_DATE_&&(t.isTracing_!==kt.NONE&&nd(t,e),t.onBecomeStale_()),t.dependenciesState_=Ce.STALE_}))}function Nb(e){e.lowestObserverState_!==Ce.STALE_&&(e.lowestObserverState_=Ce.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ce.POSSIBLY_STALE_?(t.dependenciesState_=Ce.STALE_,t.isTracing_!==kt.NONE&&nd(t,e)):t.dependenciesState_===Ce.UP_TO_DATE_&&(e.lowestObserverState_=Ce.UP_TO_DATE_)}))}function Rb(e){e.lowestObserverState_===Ce.UP_TO_DATE_&&(e.lowestObserverState_=Ce.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Ce.UP_TO_DATE_&&(t.dependenciesState_=Ce.POSSIBLY_STALE_,t.onBecomeStale_())}))}function nd(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===kt.BREAK){var r=[];id(Vi(e),r,1),new Function(`debugger;
|
|
11
|
+
/*
|
|
12
|
+
Tracing '`+e.name_+`'
|
|
13
|
+
|
|
14
|
+
You are entering this break point because derivation '`+e.name_+"' is being traced and '"+t.name_+`' is now forcing it to update.
|
|
15
|
+
Just follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update
|
|
16
|
+
The stackframe you are looking for is at least ~6-8 stack-frames up.
|
|
17
|
+
|
|
18
|
+
`+(e instanceof Mt?e.derivation.toString().replace(/[*]\//g,"/"):"")+`
|
|
19
|
+
|
|
20
|
+
The dependencies for this derivation are:
|
|
21
|
+
|
|
22
|
+
`+r.join(`
|
|
23
|
+
`)+`
|
|
24
|
+
*/
|
|
25
|
+
`)()}}function id(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 id(n,t,r+1)})}var er=(function(){function e(r,n,i,o){r===void 0&&(r="Reaction@"+Lt()),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Ce.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=kt.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,Y.pendingReactions.push(this),od())},t.runReaction_=function(){if(!this.isDisposed){Pt(),this.isScheduled=!1;var n=Y.trackingContext;if(Y.trackingContext=this,Ya(this)){this.isTrackPending=!0;try{this.onInvalidate_(),this.isTrackPending&&tt()&&cn({name:this.name_,type:"scheduled-reaction"})}catch(i){this.reportExceptionInDerivation_(i)}}Y.trackingContext=n,Ut()}},t.track=function(n){if(!this.isDisposed){Pt();var i=tt(),o;i&&(o=Date.now(),wt({name:this.name_,type:"reaction"})),this.isRunning=!0;var s=Y.trackingContext;Y.trackingContext=this;var a=Jl(this,n,void 0);Y.trackingContext=s,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Qa(this),Wo(a)&&this.reportExceptionInDerivation_(a.cause),i&&Tt({time:Date.now()-o}),Ut()}},t.reportExceptionInDerivation_=function(n){var i=this;if(this.errorHandler_){this.errorHandler_(n,this);return}if(Y.disableErrorBoundaries)throw n;var o="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";Y.suppressReactionErrors?console.warn("[mobx] (error in reaction '"+this.name_+"' suppressed, fix error of causing action below)"):console.error(o,n),tt()&&cn({type:"error",name:this.name_,message:o,error:""+n}),Y.globalReactionErrorHandlers.forEach(function(s){return s(n,i)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Pt(),Qa(this),Ut()))},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[we]=this,o},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(n){n===void 0&&(n=!1),fu(this,n)},Jn(e,[{key:"isDisposed",get:function(){return vt(this.flags_,e.isDisposedMask_)},set:function(n){this.flags_=_t(this.flags_,e.isDisposedMask_,n)}},{key:"isScheduled",get:function(){return vt(this.flags_,e.isScheduledMask_)},set:function(n){this.flags_=_t(this.flags_,e.isScheduledMask_,n)}},{key:"isTrackPending",get:function(){return vt(this.flags_,e.isTrackPendingMask_)},set:function(n){this.flags_=_t(this.flags_,e.isTrackPendingMask_,n)}},{key:"isRunning",get:function(){return vt(this.flags_,e.isRunningMask_)},set:function(n){this.flags_=_t(this.flags_,e.isRunningMask_,n)}},{key:"diffValue",get:function(){return vt(this.flags_,e.diffValueMask_)?1:0},set:function(n){this.flags_=_t(this.flags_,e.diffValueMask_,n===1)}}])})();er.isDisposedMask_=1;er.isScheduledMask_=2;er.isTrackPendingMask_=4;er.isRunningMask_=8;er.diffValueMask_=16;var bl=100,Za=function(t){return t()};function od(){Y.inBatch>0||Y.isRunningReactions||Za($b)}function $b(){Y.isRunningReactions=!0;for(var e=Y.pendingReactions,t=0;e.length>0;){++t===bl&&(console.error("Reaction doesn't converge to a stable state after "+bl+" 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_()}Y.isRunningReactions=!1}var ts=Dr("Reaction",er);function Pb(e){var t=Za;Za=function(n){return e(function(){return t(n)})}}function tt(){return!!Y.spyListeners.length}function cn(e){if(Y.spyListeners.length)for(var t=Y.spyListeners,r=0,n=t.length;r<n;r++)t[r](e)}function wt(e){var t=wr({},e,{spyReportStart:!0});cn(t)}var Ub={type:"report-end",spyReportEnd:!0};function Tt(e){cn(e?wr({},e,{type:"report-end",spyReportEnd:!0}):Ub)}function Bb(e){return Y.spyListeners.push(e),ou(function(){Y.spyListeners=Y.spyListeners.filter(function(t){return t!==e})})}var cu="action",kb="action.bound",sd="autoAction",Mb="autoAction.bound",ad="<unnamed action>",eu=ji(cu),Db=ji(kb,{bound:!0}),tu=ji(sd,{autoAction:!0}),Lb=ji(Mb,{autoAction:!0,bound:!0});function ud(e){var t=function(n,i){if(Ke(n))return un(n.name||ad,n,e);if(Ke(i))return un(n,i,e);if(Li(i))return(e?tu:eu).decorate_20223_(n,i);if(sn(i))return Di(n,i,e?tu:eu);if(sn(n))return cr(ji(e?sd:cu,{name:n,autoAction:e}));de("Invalid arguments for `action`")};return t}var dt=ud(!1);Object.assign(dt,eu);var Bi=ud(!0);Object.assign(Bi,tu);dt.bound=cr(Db);Bi.bound=cr(Lb);function Xn(e){return Wl(e.name||ad,!1,e,this,void 0)}function Mr(e){return Ke(e)&&e.isMobxAction===!0}function jt(e,t){var r,n,i,o;t===void 0&&(t=iu),Ke(e)||de("Autorun expects a function as first argument"),Mr(e)&&de("Autorun does not accept actions since actions are untrackable");var s=(r=(n=t)==null?void 0:n.name)!=null?r:e.name||"Autorun@"+Lt(),a=!t.scheduler&&!t.delay,u;if(a)u=new er(s,function(){this.track(p)},t.onError,t.requiresObservable);else{var f=cd(t),l=!1;u=new er(s,function(){l||(l=!0,f(function(){l=!1,u.isDisposed||u.track(p)}))},t.onError,t.requiresObservable)}function p(){e(u)}return(i=t)!=null&&(i=i.signal)!=null&&i.aborted||u.schedule_(),u.getDisposer_((o=t)==null?void 0:o.signal)}var jb=function(t){return t()};function cd(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:jb}function fd(e,t,r){var n,i,o;r===void 0&&(r=iu),(!Ke(e)||!Ke(t))&&de("First and second argument to reaction should be functions"),Zt(r)||de("Third argument of reactions should be an object");var s=(n=r.name)!=null?n:"Reaction@"+Lt(),a=dt(s,r.onError?Fb(r.onError,t):t),u=!r.scheduler&&!r.delay,f=cd(r),l=!0,p=!1,C,A=r.compareStructural?We.structural:r.equals||We.default,S=new er(s,function(){l||u?z():p||(p=!0,f(z))},r.onError,r.requiresObservable);function z(){if(p=!1,!S.isDisposed){var X=!1,j=C;S.track(function(){var M=_b(!1,function(){return e(S)});X=l||!A(C,M),C=M}),(l&&r.fireImmediately||!l&&X)&&a(C,j,S),l=!1}}return(i=r)!=null&&(i=i.signal)!=null&&i.aborted||S.schedule_(),S.getDisposer_((o=r)==null?void 0:o.signal)}function Fb(e,t){return function(){try{return t.apply(this,arguments)}catch(r){e.call(this,r)}}}var Vb="onBO",zb="onBUO";function Yn(e,t,r){return ld(Vb,e,t,r)}function dn(e,t,r){return ld(zb,e,t,r)}function ld(e,t,r,n){var i=typeof n=="function"?Dt(t,r):Dt(t),o=Ke(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 qb="never",Ko="always",Kb="observed";function dd(e){e.isolateGlobalState===!0&&Ib();var t=e.useProxies,r=e.enforceActions;if(t!==void 0&&(Y.useProxies=t===Ko?!0:t===qb?!1:typeof Proxy<"u"),t==="ifavailable"&&(Y.verifyProxies=!0),r!==void 0){var n=r===Ko?Ko:r===Kb;Y.enforceActions=n,Y.allowStateChanges=!(n===!0||n===Ko)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in e&&(Y[i]=!!e[i])}),Y.allowStateReads=!Y.observableRequiresReaction,Y.disableErrorBoundaries===!0&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),e.reactionScheduler&&Pb(e.reactionScheduler)}function Gb(e,t,r,n){arguments.length>4&&de("'extendObservable' expected 2-4 arguments"),typeof e!="object"&&de("'extendObservable' expects an object as first argument"),fr(e)&&de("'extendObservable' should not be used on maps, use map.merge instead"),Zt(t)||de("'extendObservable' only accepts plain objects as second argument"),(Wn(t)||Wn(r))&&de("Extending an object with another observable (object) is not supported");var i=Om(t);return pn(function(){var o=Zn(e,n)[we];us(i).forEach(function(s){o.extend_(s,i[s],r&&s in r?r[s]:!0)})}),e}function Vi(e,t){return pd(Dt(e,t))}function pd(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=Wb(e.observing_).map(pd)),t}function zi(e,t){return hd(Dt(e,t))}function hd(e){var t={name:e.name_};return Sb(e)&&(t.observers=Array.from(xb(e)).map(hd)),t}function Wb(e){return Array.from(new Set(e))}var Hb=0;function yd(){this.message="FLOW_CANCELLED"}yd.prototype=Object.create(Error.prototype);var Ka=jl("flow"),Jb=jl("flow.bound",{bound:!0}),Gn=Object.assign(function(t,r){if(Li(r))return Ka.decorate_20223_(t,r);if(sn(r))return Di(t,r,Ka);arguments.length!==1&&de("Flow expects single argument with generator function");var n=t,i=n.name||"<unnamed flow>",o=function(){var a=this,u=arguments,f=++Hb,l=dt(i+" - runid: "+f+" - init",n).apply(a,u),p,C=void 0,A=new Promise(function(S,z){var X=0;p=z;function j(H){C=void 0;var V;try{V=dt(i+" - runid: "+f+" - yield "+X++,l.next).call(l,H)}catch(ee){return z(ee)}K(V)}function M(H){C=void 0;var V;try{V=dt(i+" - runid: "+f+" - yield "+X++,l.throw).call(l,H)}catch(ee){return z(ee)}K(V)}function K(H){if(Ke(H?.then)){H.then(K,z);return}return H.done?S(H.value):(C=Promise.resolve(H.value),C.then(j,M))}j(void 0)});return A.cancel=dt(i+" - runid: "+f+" - cancel",function(){try{C&&vl(C);var S=l.return(void 0),z=Promise.resolve(S.value);z.then(qn,qn),vl(z),p(new yd)}catch(X){p(X)}}),A};return o.isMobXFlow=!0,o},Ka);Gn.bound=cr(Jb);function vl(e){Ke(e.cancel)&&e.cancel()}function ki(e){return e?.isMobXFlow===!0}function Xb(e,t){return e?t!==void 0?fr(e)||Qn(e)?de("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead."):fn(e)?e[we].values_.has(t):!1:fn(e)||!!e[we]||su(e)||ts(e)||Fi(e):!1}function Wn(e){return arguments.length!==1&&de("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),Xb(e)}function Yb(e){if(fn(e))return e[we].ownKeys_();de(38)}function Go(e,t,r){return e.set(t,r),r}function zn(e,t){if(e==null||typeof e!="object"||e instanceof Date||!Wn(e))return e;if(Tb(e)||Fi(e))return zn(e.get(),t);if(t.has(e))return t.get(e);if(Qn(e)){var r=Go(t,e,new Array(e.length));return e.forEach(function(s,a){r[a]=zn(s,t)}),r}if(Jt(e)){var n=Go(t,e,new Set);return e.forEach(function(s){n.add(zn(s,t))}),n}if(fr(e)){var i=Go(t,e,new Map);return e.forEach(function(s,a){i.set(a,zn(s,t))}),i}else{var o=Go(t,e,{});return Yb(e).forEach(function(s){Mi.propertyIsEnumerable.call(e,s)&&(o[s]=zn(e[s],t))}),o}}function Tr(e,t){return t&&de("toJS no longer supports options"),zn(e,new Map)}function fu(){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=Qb(r);if(!i)return de("'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_===kt.NONE&&console.log("[mobx.trace] '"+i.name_+"' tracing enabled"),i.isTracing_=e?kt.BREAK:kt.LOG}function Qb(e){switch(e.length){case 0:return Y.trackingDerivation;case 1:return Dt(e[0]);case 2:return Dt(e[0],e[1])}}function vr(e,t){t===void 0&&(t=void 0),Pt();try{return e.apply(t)}finally{Ut()}}function on(e){return e[we]}var Zb={has:function(t,r){return Y.trackingDerivation&&Pi("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),on(t).has_(r)},get:function(t,r){return on(t).get_(r)},set:function(t,r,n){var i;return sn(r)?(on(t).values_.has(r)||Pi("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),(i=on(t).set_(r,n,!0))!=null?i:!0):!1},deleteProperty:function(t,r){var n;return Pi("delete properties from an observable object. Use 'remove' from 'mobx' instead."),sn(r)?(n=on(t).delete_(r,!0))!=null?n:!0:!1},defineProperty:function(t,r,n){var i;return Pi("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),(i=on(t).defineProperty_(r,n))!=null?i:!0},ownKeys:function(t){return Y.trackingDerivation&&Pi("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),on(t).ownKeys_()},preventExtensions:function(t){de(13)}};function ev(e,t){var r,n;return $l(),e=Zn(e,t),(n=(r=e[we]).proxy_)!=null?n:r.proxy_=new Proxy(e,Zb)}function Rt(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function qi(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),ou(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function $t(e,t){var r=ln();try{for(var n=[].concat(e.interceptors_||[]),i=0,o=n.length;i<o&&(t=n[i](t),t&&!t.type&&de(14),!!t);i++);return t}finally{_r(r)}}function Yt(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function Ki(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),ou(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function Qt(e,t){var r=ln(),n=e.changeListeners_;if(n){n=n.slice();for(var i=0,o=n.length;i<o;i++)n[i](t);_r(r)}}function jr(e,t,r){return pn(function(){var n,i=Zn(e,r)[we];t&&e[lt]&&de("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),(n=t)!=null||(t=Cm(e)),us(t).forEach(function(o){return i.make_(o,t[o])})}),e}var _l="splice",Xt="update",tv=1e4,rv={get:function(t,r){var n=t[we];return r===we?n:r==="length"?n.getArrayLength_():typeof r=="string"&&!isNaN(r)?n.get_(parseInt(r)):Bt(rs,r)?rs[r]:t[r]},set:function(t,r,n){var i=t[we];return r==="length"&&i.setArrayLength_(n),typeof r=="symbol"||isNaN(r)?t[r]=n:i.set_(parseInt(r),n),!0},preventExtensions:function(){de(15)}},lu=(function(){function e(r,n,i,o){r===void 0&&(r="ObservableArray@"+Lt()),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 Lr(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 qi(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}),Ki(this,n)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(n){(typeof n!="number"||isNaN(n)||n<0)&&de("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_&&de(16),this.lastKnownLength_+=i,this.legacyMode_&&i>0&&wd(n+i+1)},t.spliceWithArray_=function(n,i,o){var s=this;ar(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=Yo),Rt(this)){var u=$t(this,{object:this.proxy_,type:_l,index:n,removedCount:i,added:o});if(!u)return Yo;i=u.removedCount,o=u.added}o=o.length===0?o:o.map(function(p){return s.enhancer_(p,void 0)}),this.legacyMode_;var f=o.length-i;this.updateArrayLength_(a,f);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<tv){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 f=0;f<o.length;f++)this.values_[n+f]=o[f];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_&&tt(),a=Yt(this),u=a||s?{observableKind:"array",object:this.proxy_,type:Xt,debugObjectName:this.atom_.name_,index:n,newValue:i,oldValue:o}:null;s&&wt(u),this.atom_.reportChanged(),a&&Qt(this,u),s&&Tt()},t.notifyArraySplice_=function(n,i,o){var s=!this.owned_&&tt(),a=Yt(this),u=a||s?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:_l,index:n,removed:o,added:i,removedCount:o.length,addedCount:i.length}:null;s&&wt(u),this.atom_.reportChanged(),a&&Qt(this,u),s&&Tt()},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&&de(17,n,o.length),n<o.length){ar(this.atom_);var s=o[n];if(Rt(this)){var a=$t(this,{type:Xt,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 f=new Array(n+1-o.length),l=0;l<f.length-1;l++)f[l]=void 0;f[f.length-1]=i,this.spliceWithArray_(o.length,0,f)}},e})();function nv(e,t,r,n){return r===void 0&&(r="ObservableArray@"+Lt()),n===void 0&&(n=!1),$l(),pn(function(){var i=new lu(r,t,n,!1);Ul(i.values_,we,i);var o=new Proxy(i.values_,rv);return i.proxy_=o,e&&e.length&&i.spliceWithArray_(0,0,e),o})}var rs={clear:function(){return this.splice(0)},replace:function(t){var r=this[we];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[we];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[we].spliceWithArray_(t,r,n)},push:function(){for(var t=this[we],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[we].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[we],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 Y.trackingDerivation&&de(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Y.trackingDerivation&&de(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var r=this[we],n=r.dehanceValues_(r.values_).indexOf(t);return n>-1?(this.splice(n,1),!0):!1}};De("at",At);De("concat",At);De("flat",At);De("includes",At);De("indexOf",At);De("join",At);De("lastIndexOf",At);De("slice",At);De("toString",At);De("toLocaleString",At);De("toSorted",At);De("toSpliced",At);De("with",At);De("every",tr);De("filter",tr);De("find",tr);De("findIndex",tr);De("findLast",tr);De("findLastIndex",tr);De("flatMap",tr);De("forEach",tr);De("map",tr);De("some",tr);De("toReversed",tr);De("reduce",gd);De("reduceRight",gd);function De(e,t){typeof Array.prototype[e]=="function"&&(rs[e]=t(e))}function At(e){return function(){var t=this[we];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function tr(e){return function(t,r){var n=this,i=this[we];i.atom_.reportObserved();var o=i.dehanceValues_(i.values_);return o[e](function(s,a){return t.call(r,s,a,n)})}}function gd(e){return function(){var t=this,r=this[we];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 iv=Dr("ObservableArrayAdministration",lu);function Qn(e){return ss(e)&&iv(e[we])}var ov={},Br="add",ns="delete",md=(function(){function e(r,n,i){var o=this;n===void 0&&(n=an),i===void 0&&(i="ObservableMap@"+Lt()),this.enhancer_=void 0,this.name_=void 0,this[we]=ov,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,Ke(Map)||de(18),pn(function(){o.keysAtom_=Dl(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(!Y.trackingDerivation)return this.has_(n);var o=this.hasMap_.get(n);if(!o){var s=o=new kr(this.has_(n),fs,this.name_+"."+Wa(n)+"?",!1);this.hasMap_.set(n,s),dn(s,function(){return i.hasMap_.delete(n)})}return o.get()},t.set=function(n,i){var o=this.has_(n);if(Rt(this)){var s=$t(this,{type:o?Xt:Br,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(ar(this.keysAtom_),Rt(this)){var o=$t(this,{type:ns,object:this,name:n});if(!o)return!1}if(this.has_(n)){var s=tt(),a=Yt(this),u=a||s?{observableKind:"map",debugObjectName:this.name_,type:ns,object:this,oldValue:this.data_.get(n).value_,name:n}:null;return s&&wt(u),vr(function(){var f;i.keysAtom_.reportChanged(),(f=i.hasMap_.get(n))==null||f.setNewValue_(!1);var l=i.data_.get(n);l.setNewValue_(void 0),i.data_.delete(n)}),a&&Qt(this,u),s&&Tt(),!0}return!1},t.updateValue_=function(n,i){var o=this.data_.get(n);if(i=o.prepareNewValue_(i),i!==Y.UNCHANGED){var s=tt(),a=Yt(this),u=a||s?{observableKind:"map",debugObjectName:this.name_,type:Xt,object:this,oldValue:o.value_,name:n,newValue:i}:null;s&&wt(u),o.setNewValue_(i),a&&Qt(this,u),s&&Tt()}},t.addValue_=function(n,i){var o=this;ar(this.keysAtom_),vr(function(){var f,l=new kr(i,o.enhancer_,o.name_+"."+Wa(n),!1);o.data_.set(n,l),i=l.value_,(f=o.hasMap_.get(n))==null||f.setNewValue_(!0),o.keysAtom_.reportChanged()});var s=tt(),a=Yt(this),u=a||s?{observableKind:"map",debugObjectName:this.name_,type:Br,object:this,name:n,newValue:i}:null;s&&wt(u),a&&Qt(this,u),s&&Tt()},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 wl({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 wl({next:function(){var s=i.next(),a=s.done,u=s.value;return{done:a,value:a?void 0:[u,n.get(u)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(n,i){for(var o=Kn(this),s;!(s=o()).done;){var a=s.value,u=a[0],f=a[1];n.call(i,f,u,this)}},t.merge=function(n){var i=this;return fr(n)&&(n=new Map(n)),vr(function(){Zt(n)?Am(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)}):Hn(n)?(Tm(n)||de(19,n),n.forEach(function(o,s){return i.set(s,o)})):n!=null&&de(20,n)}),this},t.clear=function(){var n=this;vr(function(){ke(function(){for(var i=Kn(n.keys()),o;!(o=i()).done;){var s=o.value;n.delete(s)}})})},t.replace=function(n){var i=this;return vr(function(){for(var o=sv(n),s=new Map,a=!1,u=Kn(i.data_.keys()),f;!(f=u()).done;){var l=f.value;if(!o.has(l)){var p=i.delete(l);if(p)a=!0;else{var C=i.data_.get(l);s.set(l,C)}}}for(var A=Kn(o.entries()),S;!(S=A()).done;){var z=S.value,X=z[0],j=z[1],M=i.data_.has(X);if(i.set(X,j),i.data_.has(X)){var K=i.data_.get(X);s.set(X,K),M||(a=!0)}}if(!a)if(i.data_.size!==s.size)i.keysAtom_.reportChanged();else for(var H=i.data_.keys(),V=s.keys(),ee=H.next(),W=V.next();!ee.done;){if(ee.value!==W.value){i.keysAtom_.reportChanged();break}ee=H.next(),W=V.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&&de("`observe` doesn't support fireImmediately=true in combination with maps."),Ki(this,n)},t.intercept_=function(n){return qi(this,n)},Jn(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])})(),fr=Dr("ObservableMap",md);function wl(e){return e[Symbol.toStringTag]="MapIterator",yu(e)}function sv(e){if(Hn(e)||fr(e))return e;if(Array.isArray(e))return new Map(e);if(Zt(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}else return de(21,e)}var av={},bd=(function(){function e(r,n,i){var o=this;n===void 0&&(n=an),i===void 0&&(i="ObservableSet@"+Lt()),this.name_=void 0,this[we]=av,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,Ke(Set)||de(22),this.enhancer_=function(s,a){return n(s,a,i)},pn(function(){o.atom_=Dl(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;vr(function(){ke(function(){for(var i=Kn(n.data_.values()),o;!(o=i()).done;){var s=o.value;n.delete(s)}})})},t.forEach=function(n,i){for(var o=Kn(this),s;!(s=o()).done;){var a=s.value;n.call(i,a,a,this)}},t.add=function(n){var i=this;if(ar(this.atom_),Rt(this)){var o=$t(this,{type:Br,object:this,newValue:n});if(!o)return this;n=o.newValue}if(!this.has(n)){vr(function(){i.data_.add(i.enhancer_(n,void 0)),i.atom_.reportChanged()});var s=tt(),a=Yt(this),u=a||s?{observableKind:"set",debugObjectName:this.name_,type:Br,object:this,newValue:n}:null;s&&wt(u),a&&Qt(this,u),s&&Tt()}return this},t.delete=function(n){var i=this;if(Rt(this)){var o=$t(this,{type:ns,object:this,oldValue:n});if(!o)return!1}if(this.has(n)){var s=tt(),a=Yt(this),u=a||s?{observableKind:"set",debugObjectName:this.name_,type:ns,object:this,oldValue:n}:null;return s&&wt(u),vr(function(){i.atom_.reportChanged(),i.data_.delete(n)}),a&&Qt(this,u),s&&Tt(),!0}return!1},t.has=function(n){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(n))},t.entries=function(){var n=this.values();return Tl({next:function(){var o=n.next(),s=o.value,a=o.done;return a?{value:void 0,done:a}:{value:[s,s],done:a}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var n=this,i=this.data_.values();return Tl({next:function(){var s=i.next(),a=s.value,u=s.done;return u?{value:void 0,done:u}:{value:n.dehanceValue_(a),done:u}}})},t.intersection=function(n){if(br(n)&&!Jt(n))return n.intersection(this);var i=new Set(this);return i.intersection(n)},t.union=function(n){if(br(n)&&!Jt(n))return n.union(this);var i=new Set(this);return i.union(n)},t.difference=function(n){return new Set(this).difference(n)},t.symmetricDifference=function(n){if(br(n)&&!Jt(n))return n.symmetricDifference(this);var i=new Set(this);return i.symmetricDifference(n)},t.isSubsetOf=function(n){return new Set(this).isSubsetOf(n)},t.isSupersetOf=function(n){return new Set(this).isSupersetOf(n)},t.isDisjointFrom=function(n){if(br(n)&&!Jt(n))return n.isDisjointFrom(this);var i=new Set(this);return i.isDisjointFrom(n)},t.replace=function(n){var i=this;return Jt(n)&&(n=new Set(n)),vr(function(){Array.isArray(n)?(i.clear(),n.forEach(function(o){return i.add(o)})):br(n)?(i.clear(),n.forEach(function(o){return i.add(o)})):n!=null&&de("Cannot initialize set from "+n)}),this},t.observe_=function(n,i){return i===!0&&de("`observe` doesn't support fireImmediately=true in combination with sets."),Ki(this,n)},t.intercept_=function(n){return qi(this,n)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},Jn(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])})(),Jt=Dr("ObservableSet",bd);function Tl(e){return e[Symbol.toStringTag]="SetIterator",yu(e)}var Al=Object.create(null),Ol="remove",ru=(function(){function e(r,n,i,o){n===void 0&&(n=new Map),o===void 0&&(o=eb),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 Lr(this.name_+".keys"),this.isPlainObject_=Zt(this.target_),Td(this.defaultAnnotation_)||de("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 Mt)return o.set(i),!0;if(Rt(this)){var s=$t(this,{type:Xt,object:this.proxy_||this.target_,name:n,newValue:i});if(!s)return null;i=s.newValue}if(i=o.prepareNewValue_(i),i!==Y.UNCHANGED){var a=Yt(this),u=tt(),f=a||u?{type:Xt,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:o.value_,name:n,newValue:i}:null;u&&wt(f),o.setNewValue_(i),a&&Qt(this,f),u&&Tt()}return!0},t.get_=function(n){return Y.trackingDerivation&&!Bt(this.target_,n)&&this.has_(n),this.target_[n]},t.set_=function(n,i,o){return o===void 0&&(o=!1),Bt(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(!Y.trackingDerivation)return n in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var i=this.pendingKeys_.get(n);return i||(i=new kr(n in this.target_,fs,this.name_+"."+Wa(n)+"?",!1),this.pendingKeys_.set(n,i)),i.get()},t.make_=function(n,i){if(i===!0&&(i=this.defaultAnnotation_),i!==!1){if(Sl(this,i,n),!(n in this.target_)){var o;if((o=this.target_[lt])!=null&&o[n])return;de(1,i.annotationType_,this.name_+"."+n.toString())}for(var s=this.target_;s&&s!==Mi;){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)}Il(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);Sl(this,o,n);var a=o.extend_(this,n,i,s);return a&&Il(this,o,n),a},t.defineProperty_=function(n,i,o){o===void 0&&(o=!1),ar(this.keysAtom_);try{Pt();var s=this.delete_(n);if(!s)return s;if(Rt(this)){var a=$t(this,{object:this.proxy_||this.target_,name:n,type:Br,newValue:i.value});if(!a)return null;var u=a.newValue;i.value!==u&&(i=wr({},i,{value:u}))}if(o){if(!Reflect.defineProperty(this.target_,n,i))return!1}else ur(this.target_,n,i);this.notifyPropertyAddition_(n,i.value)}finally{Ut()}return!0},t.defineObservableProperty_=function(n,i,o,s){s===void 0&&(s=!1),ar(this.keysAtom_);try{Pt();var a=this.delete_(n);if(!a)return a;if(Rt(this)){var u=$t(this,{object:this.proxy_||this.target_,name:n,type:Br,newValue:i});if(!u)return null;i=u.newValue}var f=El(n),l={configurable:Y.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:f.get,set:f.set};if(s){if(!Reflect.defineProperty(this.target_,n,l))return!1}else ur(this.target_,n,l);var p=new kr(i,o,this.name_+"."+n.toString(),!1);this.values_.set(n,p),this.notifyPropertyAddition_(n,p.value_)}finally{Ut()}return!0},t.defineComputedProperty_=function(n,i,o){o===void 0&&(o=!1),ar(this.keysAtom_);try{Pt();var s=this.delete_(n);if(!s)return s;if(Rt(this)){var a=$t(this,{object:this.proxy_||this.target_,name:n,type:Br,newValue:void 0});if(!a)return null}i.name||(i.name=this.name_+"."+n.toString()),i.context=this.proxy_||this.target_;var u=El(n),f={configurable:Y.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:u.get,set:u.set};if(o){if(!Reflect.defineProperty(this.target_,n,f))return!1}else ur(this.target_,n,f);this.values_.set(n,new Mt(i)),this.notifyPropertyAddition_(n,void 0)}finally{Ut()}return!0},t.delete_=function(n,i){if(i===void 0&&(i=!1),ar(this.keysAtom_),!Bt(this.target_,n))return!0;if(Rt(this)){var o=$t(this,{object:this.proxy_||this.target_,name:n,type:Ol});if(!o)return null}try{var s;Pt();var a=Yt(this),u=tt(),f=this.values_.get(n),l=void 0;if(!f&&(a||u)){var p;l=(p=Xo(this.target_,n))==null?void 0:p.value}if(i){if(!Reflect.deleteProperty(this.target_,n))return!1}else delete this.target_[n];if(delete this.appliedAnnotations_[n],f&&(this.values_.delete(n),f instanceof kr&&(l=f.value_),rd(f)),this.keysAtom_.reportChanged(),(s=this.pendingKeys_)==null||(s=s.get(n))==null||s.set(n in this.target_),a||u){var C={type:Ol,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:l,name:n};u&&wt(C),a&&Qt(this,C),u&&Tt()}}finally{Ut()}return!0},t.observe_=function(n,i){return i===!0&&de("`observe` doesn't support the fire immediately property for observable objects."),Ki(this,n)},t.intercept_=function(n){return qi(this,n)},t.notifyPropertyAddition_=function(n,i){var o,s=Yt(this),a=tt();if(s||a){var u=s||a?{type:Br,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:n,newValue:i}:null;a&&wt(u),s&&Qt(this,u),a&&Tt()}(o=this.pendingKeys_)==null||(o=o.get(n))==null||o.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),us(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e})();function Zn(e,t){var r;if(t&&fn(e)&&de("Options can't be provided for already observable objects."),Bt(e,we))return pu(e)instanceof ru||de("Cannot convert '"+is(e)+`' into observable object:
|
|
26
|
+
The target is already observable of different type.
|
|
27
|
+
Extending builtins is not supported.`),e;Object.isExtensible(e)||de("Cannot make the designated object observable; it is not extensible");var n=(r=t?.name)!=null?r:(Zt(e)?"ObservableObject":e.constructor.name)+"@"+Lt(),i=new ru(e,new Map,String(n),lb(t));return as(e,we,i),e}var uv=Dr("ObservableObjectAdministration",ru);function El(e){return Al[e]||(Al[e]={get:function(){return this[we].getObservablePropValue_(e)},set:function(r){return this[we].setObservablePropValue_(e,r)}})}function fn(e){return ss(e)?uv(e[we]):!1}function Il(e,t,r){var n;e.appliedAnnotations_[r]=t,(n=e.target_[lt])==null||delete n[r]}function Sl(e,t,r){if(Td(t)||de("Cannot annotate '"+e.name_+"."+r.toString()+"': Invalid annotation."),!Qo(t)&&Bt(e.appliedAnnotations_,r)){var n=e.name_+"."+r.toString(),i=e.appliedAnnotations_[r].annotationType_,o=t.annotationType_;de("Cannot apply '"+o+"' to '"+n+"':"+(`
|
|
28
|
+
The field is already annotated with '`+i+"'.")+`
|
|
29
|
+
Re-annotating fields is not allowed.
|
|
30
|
+
Use 'override' annotation for methods overridden by subclass.`)}}var cv=_d(0),fv=(function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1})(),Ga=0,vd=function(){};function lv(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}lv(vd,Array.prototype);var du=(function(e){function t(n,i,o,s){var a;return o===void 0&&(o="ObservableArray@"+Lt()),s===void 0&&(s=!1),a=e.call(this)||this,pn(function(){var u=new lu(o,i,s,!0);u.proxy_=a,Ul(a,we,u),n&&n.length&&a.spliceWithArray(0,0,n),fv&&Object.defineProperty(a,"0",cv)}),a}Ml(t,e);var r=t.prototype;return r.concat=function(){this[we].atom_.reportObserved();for(var i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return Array.prototype.concat.apply(this.slice(),o.map(function(a){return Qn(a)?a.slice():a}))},r[Symbol.iterator]=function(){var n=this,i=0;return yu({next:function(){return i<n.length?{value:n[i++],done:!1}:{done:!0,value:void 0}}})},Jn(t,[{key:"length",get:function(){return this[we].getArrayLength_()},set:function(i){this[we].setArrayLength_(i)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])})(vd);Object.entries(rs).forEach(function(e){var t=e[0],r=e[1];t!=="concat"&&as(du.prototype,t,r)});function _d(e){return{enumerable:!1,configurable:!0,get:function(){return this[we].get_(e)},set:function(r){this[we].set_(e,r)}}}function dv(e){ur(du.prototype,""+e,_d(e))}function wd(e){if(e>Ga){for(var t=Ga;t<e+100;t++)dv(t);Ga=e}}wd(1e3);function pv(e,t,r){return new du(e,t,r)}function Dt(e,t){if(typeof e=="object"&&e!==null){if(Qn(e))return t!==void 0&&de(23),e[we].atom_;if(Jt(e))return e.atom_;if(fr(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||de(25,t,is(e)),r}if(fn(e)){if(!t)return de(26);var n=e[we].values_.get(t);return n||de(27,t,is(e)),n}if(su(e)||Fi(e)||ts(e))return e}else if(Ke(e)&&ts(e[we]))return e[we];de(28)}function pu(e,t){if(e||de(29),t!==void 0)return pu(Dt(e,t));if(su(e)||Fi(e)||ts(e)||fr(e)||Jt(e))return e;if(e[we])return e[we];de(24,e)}function is(e,t){var r;if(t!==void 0)r=Dt(e,t);else{if(Mr(e))return e.name;fn(e)||fr(e)||Jt(e)?r=pu(e):r=Dt(e)}return r.name_}function pn(e){var t=ln(),r=ds(!0);Pt();try{return e()}finally{Ut(),ps(r),_r(t)}}var xl=Mi.toString;function hu(e,t,r){return r===void 0&&(r=-1),nu(e,t,r)}function nu(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=xl.call(e);if(s!==xl.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=Cl(e),t=Cl(t);var a=s==="[object Array]";if(!a){if(typeof e!="object"||typeof t!="object")return!1;var u=e.constructor,f=t.constructor;if(u!==f&&!(Ke(u)&&u instanceof u&&Ke(f)&&f instanceof f)&&"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(!nu(e[l],t[l],r-1,n,i))return!1}else{var p=Object.keys(e),C=p.length;if(Object.keys(t).length!==C)return!1;for(var A=0;A<C;A++){var S=p[A];if(!(Bt(t,S)&&nu(e[S],t[S],r-1,n,i)))return!1}}return n.pop(),i.pop(),!0}function Cl(e){return Qn(e)?e.slice():Hn(e)||fr(e)||br(e)||Jt(e)?Array.from(e.entries()):e}var Nl,hv=((Nl=os().Iterator)==null?void 0:Nl.prototype)||{};function yu(e){return e[Symbol.iterator]=yv,Object.assign(Object.create(hv),e)}function yv(){return this}function Td(e){return e instanceof Object&&typeof e.annotationType_=="string"&&Ke(e.make_)&&Ke(e.extend_)}["Symbol","Map","Set"].forEach(function(e){var t=os();typeof t[e]>"u"&&de("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:Bb,extras:{getDebugName:is},$mobx:we});var gv=Object.create,gu=Object.defineProperty,mv=Object.getOwnPropertyDescriptor,Ad=Object.getOwnPropertyNames,bv=Object.getPrototypeOf,vv=Object.prototype.hasOwnProperty,ze=(e,t)=>function(){return t||(0,e[Ad(e)[0]])((t={exports:{}}).exports,t),t.exports},mu=(e,t)=>{for(var r in t)gu(e,r,{get:t[r],enumerable:!0})},_v=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ad(t))!vv.call(e,i)&&i!==r&&gu(e,i,{get:()=>t[i],enumerable:!(n=mv(t,i))||n.enumerable});return e},Ft=(e,t,r)=>(r=e!=null?gv(bv(e)):{},_v(t||!e||!e.__esModule?gu(r,"default",{value:e,enumerable:!0}):r,e));var Ar=ze({"../../../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 _=new Map;function I(){return new Map(_)}d.Entries=I;function U(){return _.clear()}d.Clear=U;function $(w){return _.delete(w)}d.Delete=$;function x(w){return _.has(w)}d.Has=x;function g(w,c){_.set(w,c)}d.Set=g;function T(w){return _.get(w)}d.Get=T})(t||(e.TypeRegistry=t={}));var r=class extends Error{constructor(d){super(d)}};e.TypeBoxError=r;var n;(function(d){let _=new Map;function I(){return new Map(_)}d.Entries=I;function U(){return _.clear()}d.Clear=U;function $(w){return _.delete(w)}d.Delete=$;function x(w){return _.has(w)}d.Has=x;function g(w,c){_.set(w,c)}d.Set=g;function T(w){return _.get(w)}d.Get=T})(n||(e.FormatRegistry=n={}));var i;(function(d){function _(v){return Array.isArray(v)}d.IsArray=_;function I(v){return typeof v=="bigint"}d.IsBigInt=I;function U(v){return typeof v=="boolean"}d.IsBoolean=U;function $(v){return v instanceof globalThis.Date}d.IsDate=$;function x(v){return v===null}d.IsNull=x;function g(v){return typeof v=="number"}d.IsNumber=g;function T(v){return typeof v=="object"&&v!==null}d.IsObject=T;function w(v){return typeof v=="string"}d.IsString=w;function c(v){return v instanceof globalThis.Uint8Array}d.IsUint8Array=c;function O(v){return v===void 0}d.IsUndefined=O})(i||(e.ValueGuard=i={}));var o=class extends r{};e.TypeGuardUnknownTypeError=o;var s;(function(d){function _(m){try{return new RegExp(m),!0}catch{return!1}}function I(m){if(!i.IsString(m))return!1;for(let Be=0;Be<m.length;Be++){let St=m.charCodeAt(Be);if(St>=7&&St<=13||St===27||St===127)return!1}return!0}function U(m){return g(m)||Je(m)}function $(m){return i.IsUndefined(m)||i.IsBigInt(m)}function x(m){return i.IsUndefined(m)||i.IsNumber(m)}function g(m){return i.IsUndefined(m)||i.IsBoolean(m)}function T(m){return i.IsUndefined(m)||i.IsString(m)}function w(m){return i.IsUndefined(m)||i.IsString(m)&&I(m)&&_(m)}function c(m){return i.IsUndefined(m)||i.IsString(m)&&I(m)}function O(m){return i.IsUndefined(m)||Je(m)}function v(m){return Oe(m,"Any")&&T(m.$id)}d.TAny=v;function b(m){return Oe(m,"Array")&&m.type==="array"&&T(m.$id)&&Je(m.items)&&x(m.minItems)&&x(m.maxItems)&&g(m.uniqueItems)&&O(m.contains)&&x(m.minContains)&&x(m.maxContains)}d.TArray=b;function N(m){return Oe(m,"AsyncIterator")&&m.type==="AsyncIterator"&&T(m.$id)&&Je(m.items)}d.TAsyncIterator=N;function G(m){return Oe(m,"BigInt")&&m.type==="bigint"&&T(m.$id)&&$(m.exclusiveMaximum)&&$(m.exclusiveMinimum)&&$(m.maximum)&&$(m.minimum)&&$(m.multipleOf)}d.TBigInt=G;function re(m){return Oe(m,"Boolean")&&m.type==="boolean"&&T(m.$id)}d.TBoolean=re;function ne(m){return Oe(m,"Constructor")&&m.type==="Constructor"&&T(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Be=>Je(Be))&&Je(m.returns)}d.TConstructor=ne;function ve(m){return Oe(m,"Date")&&m.type==="Date"&&T(m.$id)&&x(m.exclusiveMaximumTimestamp)&&x(m.exclusiveMinimumTimestamp)&&x(m.maximumTimestamp)&&x(m.minimumTimestamp)&&x(m.multipleOfTimestamp)}d.TDate=ve;function Ae(m){return Oe(m,"Function")&&m.type==="Function"&&T(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Be=>Je(Be))&&Je(m.returns)}d.TFunction=Ae;function Le(m){return Oe(m,"Integer")&&m.type==="integer"&&T(m.$id)&&x(m.exclusiveMaximum)&&x(m.exclusiveMinimum)&&x(m.maximum)&&x(m.minimum)&&x(m.multipleOf)}d.TInteger=Le;function Ge(m){return Oe(m,"Intersect")&&!(i.IsString(m.type)&&m.type!=="object")&&i.IsArray(m.allOf)&&m.allOf.every(Be=>Je(Be)&&!vi(Be))&&T(m.type)&&(g(m.unevaluatedProperties)||O(m.unevaluatedProperties))&&T(m.$id)}d.TIntersect=Ge;function Qr(m){return Oe(m,"Iterator")&&m.type==="Iterator"&&T(m.$id)&&Je(m.items)}d.TIterator=Qr;function Oe(m,Be){return Nr(m)&&m[e.Kind]===Be}d.TKindOf=Oe;function Nr(m){return i.IsObject(m)&&e.Kind in m&&i.IsString(m[e.Kind])}d.TKind=Nr;function Zr(m){return R(m)&&i.IsString(m.const)}d.TLiteralString=Zr;function E(m){return R(m)&&i.IsNumber(m.const)}d.TLiteralNumber=E;function pe(m){return R(m)&&i.IsBoolean(m.const)}d.TLiteralBoolean=pe;function R(m){return Oe(m,"Literal")&&T(m.$id)&&(i.IsBoolean(m.const)||i.IsNumber(m.const)||i.IsString(m.const))}d.TLiteral=R;function _e(m){return Oe(m,"Never")&&i.IsObject(m.not)&&Object.getOwnPropertyNames(m.not).length===0}d.TNever=_e;function ie(m){return Oe(m,"Not")&&Je(m.not)}d.TNot=ie;function ye(m){return Oe(m,"Null")&&m.type==="null"&&T(m.$id)}d.TNull=ye;function $e(m){return Oe(m,"Number")&&m.type==="number"&&T(m.$id)&&x(m.exclusiveMaximum)&&x(m.exclusiveMinimum)&&x(m.maximum)&&x(m.minimum)&&x(m.multipleOf)}d.TNumber=$e;function qe(m){return Oe(m,"Object")&&m.type==="object"&&T(m.$id)&&i.IsObject(m.properties)&&U(m.additionalProperties)&&x(m.minProperties)&&x(m.maxProperties)&&Object.entries(m.properties).every(([Be,St])=>I(Be)&&Je(St))}d.TObject=qe;function ut(m){return Oe(m,"Promise")&&m.type==="Promise"&&T(m.$id)&&Je(m.item)}d.TPromise=ut;function ot(m){return Oe(m,"Record")&&m.type==="object"&&T(m.$id)&&U(m.additionalProperties)&&i.IsObject(m.patternProperties)&&(Be=>{let St=Object.getOwnPropertyNames(Be.patternProperties);return St.length===1&&_(St[0])&&i.IsObject(Be.patternProperties)&&Je(Be.patternProperties[St[0]])})(m)}d.TRecord=ot;function ft(m){return i.IsObject(m)&&e.Hint in m&&m[e.Hint]==="Recursive"}d.TRecursive=ft;function gr(m){return Oe(m,"Ref")&&T(m.$id)&&i.IsString(m.$ref)}d.TRef=gr;function Bn(m){return Oe(m,"String")&&m.type==="string"&&T(m.$id)&&x(m.minLength)&&x(m.maxLength)&&w(m.pattern)&&c(m.format)}d.TString=Bn;function kn(m){return Oe(m,"Symbol")&&m.type==="symbol"&&T(m.$id)}d.TSymbol=kn;function en(m){return Oe(m,"TemplateLiteral")&&m.type==="string"&&i.IsString(m.pattern)&&m.pattern[0]==="^"&&m.pattern[m.pattern.length-1]==="$"}d.TTemplateLiteral=en;function wo(m){return Oe(m,"This")&&T(m.$id)&&i.IsString(m.$ref)}d.TThis=wo;function vi(m){return i.IsObject(m)&&e.Transform in m}d.TTransform=vi;function He(m){return Oe(m,"Tuple")&&m.type==="array"&&T(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(Be=>Je(Be)))}d.TTuple=He;function To(m){return Oe(m,"Undefined")&&m.type==="undefined"&&T(m.$id)}d.TUndefined=To;function ma(m){return tn(m)&&m.anyOf.every(Be=>Zr(Be)||E(Be))}d.TUnionLiteral=ma;function tn(m){return Oe(m,"Union")&&T(m.$id)&&i.IsObject(m)&&i.IsArray(m.anyOf)&&m.anyOf.every(Be=>Je(Be))}d.TUnion=tn;function Mn(m){return Oe(m,"Uint8Array")&&m.type==="Uint8Array"&&T(m.$id)&&x(m.minByteLength)&&x(m.maxByteLength)}d.TUint8Array=Mn;function ct(m){return Oe(m,"Unknown")&&T(m.$id)}d.TUnknown=ct;function Ao(m){return Oe(m,"Unsafe")}d.TUnsafe=Ao;function _i(m){return Oe(m,"Void")&&m.type==="void"&&T(m.$id)}d.TVoid=_i;function ba(m){return i.IsObject(m)&&m[e.Readonly]==="Readonly"}d.TReadonly=ba;function va(m){return i.IsObject(m)&&m[e.Optional]==="Optional"}d.TOptional=va;function Je(m){return i.IsObject(m)&&(v(m)||b(m)||re(m)||G(m)||N(m)||ne(m)||ve(m)||Ae(m)||Le(m)||Ge(m)||Qr(m)||R(m)||_e(m)||ie(m)||ye(m)||$e(m)||qe(m)||ut(m)||ot(m)||gr(m)||Bn(m)||kn(m)||en(m)||wo(m)||He(m)||To(m)||tn(m)||Mn(m)||ct(m)||Ao(m)||_i(m)||Nr(m)&&t.Has(m[e.Kind]))}d.TSchema=Je})(s||(e.TypeGuard=s={}));var a;(function(d){function _(I){return I[e.Kind]==="Intersect"?I.allOf.every(U=>_(U)):I[e.Kind]==="Union"?I.anyOf.some(U=>_(U)):I[e.Kind]==="Undefined"?!0:I[e.Kind]==="Not"?!_(I.not):!1}d.Check=_})(a||(e.ExtendsUndefined=a={}));var u=class extends r{};e.TypeExtendsError=u;var f;(function(d){d[d.Union=0]="Union",d[d.True=1]="True",d[d.False=2]="False"})(f||(e.TypeExtendsResult=f={}));var l;(function(d){function _(h){return h===f.False?h:f.True}function I(h){throw new u(h)}function U(h){return s.TNever(h)||s.TIntersect(h)||s.TUnion(h)||s.TUnknown(h)||s.TAny(h)}function $(h,y){return s.TNever(y)?Oe(h,y):s.TIntersect(y)?Ae(h,y):s.TUnion(y)?_a(h,y):s.TUnknown(y)?Xc(h,y):s.TAny(y)?x(h,y):I("StructuralRight")}function x(h,y){return f.True}function g(h,y){return s.TIntersect(y)?Ae(h,y):s.TUnion(y)&&y.anyOf.some(Se=>s.TAny(Se)||s.TUnknown(Se))?f.True:s.TUnion(y)?f.Union:s.TUnknown(y)||s.TAny(y)?f.True:f.Union}function T(h,y){return s.TUnknown(h)?f.False:s.TAny(h)?f.Union:s.TNever(h)?f.True:f.False}function w(h,y){return s.TObject(y)&&en(y)?f.True:U(y)?$(h,y):s.TArray(y)?_(Ue(h.items,y.items)):f.False}function c(h,y){return U(y)?$(h,y):s.TAsyncIterator(y)?_(Ue(h.items,y.items)):f.False}function O(h,y){return U(y)?$(h,y):s.TObject(y)?He(h,y):s.TRecord(y)?ct(h,y):s.TBigInt(y)?f.True:f.False}function v(h,y){return s.TLiteral(h)&&i.IsBoolean(h.const)||s.TBoolean(h)?f.True:f.False}function b(h,y){return U(y)?$(h,y):s.TObject(y)?He(h,y):s.TRecord(y)?ct(h,y):s.TBoolean(y)?f.True:f.False}function N(h,y){return U(y)?$(h,y):s.TObject(y)?He(h,y):s.TConstructor(y)?h.parameters.length>y.parameters.length?f.False:h.parameters.every((Se,Gt)=>_(Ue(y.parameters[Gt],Se))===f.True)?_(Ue(h.returns,y.returns)):f.False:f.False}function G(h,y){return U(y)?$(h,y):s.TObject(y)?He(h,y):s.TRecord(y)?ct(h,y):s.TDate(y)?f.True:f.False}function re(h,y){return U(y)?$(h,y):s.TObject(y)?He(h,y):s.TFunction(y)?h.parameters.length>y.parameters.length?f.False:h.parameters.every((Se,Gt)=>_(Ue(y.parameters[Gt],Se))===f.True)?_(Ue(h.returns,y.returns)):f.False:f.False}function ne(h,y){return s.TLiteral(h)&&i.IsNumber(h.const)||s.TNumber(h)||s.TInteger(h)?f.True:f.False}function ve(h,y){return s.TInteger(y)||s.TNumber(y)?f.True:U(y)?$(h,y):s.TObject(y)?He(h,y):s.TRecord(y)?ct(h,y):f.False}function Ae(h,y){return y.allOf.every(Se=>Ue(h,Se)===f.True)?f.True:f.False}function Le(h,y){return h.allOf.some(Se=>Ue(Se,y)===f.True)?f.True:f.False}function Ge(h,y){return U(y)?$(h,y):s.TIterator(y)?_(Ue(h.items,y.items)):f.False}function Qr(h,y){return s.TLiteral(y)&&y.const===h.const?f.True:U(y)?$(h,y):s.TObject(y)?He(h,y):s.TRecord(y)?ct(h,y):s.TString(y)?_i(h,y):s.TNumber(y)?R(h,y):s.TInteger(y)?ne(h,y):s.TBoolean(y)?v(h,y):f.False}function Oe(h,y){return f.False}function Nr(h,y){return f.True}function Zr(h){let[y,Se]=[h,0];for(;s.TNot(y);)y=y.not,Se+=1;return Se%2===0?y:e.Type.Unknown()}function E(h,y){return s.TNot(h)?Ue(Zr(h),y):s.TNot(y)?Ue(h,Zr(y)):I("Invalid fallthrough for Not")}function pe(h,y){return U(y)?$(h,y):s.TObject(y)?He(h,y):s.TRecord(y)?ct(h,y):s.TNull(y)?f.True:f.False}function R(h,y){return s.TLiteralNumber(h)||s.TNumber(h)||s.TInteger(h)?f.True:f.False}function _e(h,y){return U(y)?$(h,y):s.TObject(y)?He(h,y):s.TRecord(y)?ct(h,y):s.TInteger(y)||s.TNumber(y)?f.True:f.False}function ie(h,y){return Object.getOwnPropertyNames(h.properties).length===y}function ye(h){return en(h)}function $e(h){return ie(h,0)||ie(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 qe(h){return ie(h,0)}function ut(h){return ie(h,0)}function ot(h){return ie(h,0)}function ft(h){return ie(h,0)}function gr(h){return en(h)}function Bn(h){let y=e.Type.Number();return ie(h,0)||ie(h,1)&&"length"in h.properties&&_(Ue(h.properties.length,y))===f.True}function kn(h){return ie(h,0)}function en(h){let y=e.Type.Number();return ie(h,0)||ie(h,1)&&"length"in h.properties&&_(Ue(h.properties.length,y))===f.True}function wo(h){let y=e.Type.Function([e.Type.Any()],e.Type.Any());return ie(h,0)||ie(h,1)&&"then"in h.properties&&_(Ue(h.properties.then,y))===f.True}function vi(h,y){return Ue(h,y)===f.False||s.TOptional(h)&&!s.TOptional(y)?f.False:f.True}function He(h,y){return s.TUnknown(h)?f.False:s.TAny(h)?f.Union:s.TNever(h)||s.TLiteralString(h)&&ye(y)||s.TLiteralNumber(h)&&qe(y)||s.TLiteralBoolean(h)&&ut(y)||s.TSymbol(h)&&$e(y)||s.TBigInt(h)&&ot(y)||s.TString(h)&&ye(y)||s.TSymbol(h)&&$e(y)||s.TNumber(h)&&qe(y)||s.TInteger(h)&&qe(y)||s.TBoolean(h)&&ut(y)||s.TUint8Array(h)&&gr(y)||s.TDate(h)&&ft(y)||s.TConstructor(h)&&kn(y)||s.TFunction(h)&&Bn(y)?f.True:s.TRecord(h)&&s.TString(tn(h))?y[e.Hint]==="Record"?f.True:f.False:s.TRecord(h)&&s.TNumber(tn(h))&&ie(y,0)?f.True:f.False}function To(h,y){return U(y)?$(h,y):s.TRecord(y)?ct(h,y):s.TObject(y)?(()=>{for(let Se of Object.getOwnPropertyNames(y.properties)){if(!(Se in h.properties)&&!s.TOptional(y.properties[Se]))return f.False;if(s.TOptional(y.properties[Se]))return f.True;if(vi(h.properties[Se],y.properties[Se])===f.False)return f.False}return f.True})():f.False}function ma(h,y){return U(y)?$(h,y):s.TObject(y)&&wo(y)?f.True:s.TPromise(y)?_(Ue(h.item,y.item)):f.False}function tn(h){return e.PatternNumberExact in h.patternProperties?e.Type.Number():e.PatternStringExact in h.patternProperties?e.Type.String():I("Unknown record key pattern")}function Mn(h){return e.PatternNumberExact in h.patternProperties?h.patternProperties[e.PatternNumberExact]:e.PatternStringExact in h.patternProperties?h.patternProperties[e.PatternStringExact]:I("Unable to get record value schema")}function ct(h,y){let[Se,Gt]=[tn(y),Mn(y)];return s.TLiteralString(h)&&s.TNumber(Se)&&_(Ue(h,Gt))===f.True?f.True:s.TUint8Array(h)&&s.TNumber(Se)||s.TString(h)&&s.TNumber(Se)||s.TArray(h)&&s.TNumber(Se)?Ue(h,Gt):s.TObject(h)?(()=>{for(let lg of Object.getOwnPropertyNames(h.properties))if(vi(Gt,h.properties[lg])===f.False)return f.False;return f.True})():f.False}function Ao(h,y){return U(y)?$(h,y):s.TObject(y)?He(h,y):s.TRecord(y)?Ue(Mn(h),Mn(y)):f.False}function _i(h,y){return s.TLiteral(h)&&i.IsString(h.const)||s.TString(h)?f.True:f.False}function ba(h,y){return U(y)?$(h,y):s.TObject(y)?He(h,y):s.TRecord(y)?ct(h,y):s.TString(y)?f.True:f.False}function va(h,y){return U(y)?$(h,y):s.TObject(y)?He(h,y):s.TRecord(y)?ct(h,y):s.TSymbol(y)?f.True:f.False}function Je(h,y){return s.TTemplateLiteral(h)?Ue(V.Resolve(h),y):s.TTemplateLiteral(y)?Ue(h,V.Resolve(y)):I("Invalid fallthrough for TemplateLiteral")}function m(h,y){return s.TArray(y)&&h.items!==void 0&&h.items.every(Se=>Ue(Se,y.items)===f.True)}function Be(h,y){return s.TNever(h)?f.True:s.TUnknown(h)?f.False:s.TAny(h)?f.Union:f.False}function St(h,y){return U(y)?$(h,y):s.TObject(y)&&en(y)||s.TArray(y)&&m(h,y)?f.True:s.TTuple(y)?i.IsUndefined(h.items)&&!i.IsUndefined(y.items)||!i.IsUndefined(h.items)&&i.IsUndefined(y.items)?f.False:i.IsUndefined(h.items)&&!i.IsUndefined(y.items)||h.items.every((Se,Gt)=>Ue(Se,y.items[Gt])===f.True)?f.True:f.False:f.False}function ig(h,y){return U(y)?$(h,y):s.TObject(y)?He(h,y):s.TRecord(y)?ct(h,y):s.TUint8Array(y)?f.True:f.False}function og(h,y){return U(y)?$(h,y):s.TObject(y)?He(h,y):s.TRecord(y)?ct(h,y):s.TVoid(y)?ug(h,y):s.TUndefined(y)?f.True:f.False}function _a(h,y){return y.anyOf.some(Se=>Ue(h,Se)===f.True)?f.True:f.False}function sg(h,y){return h.anyOf.every(Se=>Ue(Se,y)===f.True)?f.True:f.False}function Xc(h,y){return f.True}function ag(h,y){return s.TNever(y)?Oe(h,y):s.TIntersect(y)?Ae(h,y):s.TUnion(y)?_a(h,y):s.TAny(y)?x(h,y):s.TString(y)?_i(h,y):s.TNumber(y)?R(h,y):s.TInteger(y)?ne(h,y):s.TBoolean(y)?v(h,y):s.TArray(y)?T(h,y):s.TTuple(y)?Be(h,y):s.TObject(y)?He(h,y):s.TUnknown(y)?f.True:f.False}function ug(h,y){return s.TUndefined(h)||s.TUndefined(h)?f.True:f.False}function cg(h,y){return s.TIntersect(y)?Ae(h,y):s.TUnion(y)?_a(h,y):s.TUnknown(y)?Xc(h,y):s.TAny(y)?x(h,y):s.TObject(y)?He(h,y):s.TVoid(y)?f.True:f.False}function Ue(h,y){return s.TTemplateLiteral(h)||s.TTemplateLiteral(y)?Je(h,y):s.TNot(h)||s.TNot(y)?E(h,y):s.TAny(h)?g(h,y):s.TArray(h)?w(h,y):s.TBigInt(h)?O(h,y):s.TBoolean(h)?b(h,y):s.TAsyncIterator(h)?c(h,y):s.TConstructor(h)?N(h,y):s.TDate(h)?G(h,y):s.TFunction(h)?re(h,y):s.TInteger(h)?ve(h,y):s.TIntersect(h)?Le(h,y):s.TIterator(h)?Ge(h,y):s.TLiteral(h)?Qr(h,y):s.TNever(h)?Nr(h,y):s.TNull(h)?pe(h,y):s.TNumber(h)?_e(h,y):s.TObject(h)?To(h,y):s.TRecord(h)?Ao(h,y):s.TString(h)?ba(h,y):s.TSymbol(h)?va(h,y):s.TTuple(h)?St(h,y):s.TPromise(h)?ma(h,y):s.TUint8Array(h)?ig(h,y):s.TUndefined(h)?og(h,y):s.TUnion(h)?sg(h,y):s.TUnknown(h)?ag(h,y):s.TVoid(h)?cg(h,y):I(`Unknown left type operand '${h[e.Kind]}'`)}function fg(h,y){return Ue(h,y)}d.Extends=fg})(l||(e.TypeExtends=l={}));var p;(function(d){function _(w){return w.map(c=>x(c))}function I(w){return new Date(w.getTime())}function U(w){return new Uint8Array(w)}function $(w){let c=Object.getOwnPropertyNames(w).reduce((v,b)=>({...v,[b]:x(w[b])}),{}),O=Object.getOwnPropertySymbols(w).reduce((v,b)=>({...v,[b]:x(w[b])}),{});return{...c,...O}}function x(w){return i.IsArray(w)?_(w):i.IsDate(w)?I(w):i.IsUint8Array(w)?U(w):i.IsObject(w)?$(w):w}function g(w){return w.map(c=>T(c))}d.Rest=g;function T(w,c={}){return{...x(w),...c}}d.Type=T})(p||(e.TypeClone=p={}));var C;(function(d){function _(N){return N.map(G=>{let{[e.Optional]:re,...ne}=p.Type(G);return ne})}function I(N){return N.every(G=>s.TOptional(G))}function U(N){return N.some(G=>s.TOptional(G))}function $(N){return I(N.allOf)?e.Type.Optional(e.Type.Intersect(_(N.allOf))):N}function x(N){return U(N.anyOf)?e.Type.Optional(e.Type.Union(_(N.anyOf))):N}function g(N){return N[e.Kind]==="Intersect"?$(N):N[e.Kind]==="Union"?x(N):N}function T(N,G){let re=N.allOf.reduce((ne,ve)=>{let Ae=v(ve,G);return Ae[e.Kind]==="Never"?ne:[...ne,Ae]},[]);return g(e.Type.Intersect(re))}function w(N,G){let re=N.anyOf.map(ne=>v(ne,G));return g(e.Type.Union(re))}function c(N,G){let re=N.properties[G];return i.IsUndefined(re)?e.Type.Never():e.Type.Union([re])}function O(N,G){let re=N.items;if(i.IsUndefined(re))return e.Type.Never();let ne=re[G];return i.IsUndefined(ne)?e.Type.Never():ne}function v(N,G){return N[e.Kind]==="Intersect"?T(N,G):N[e.Kind]==="Union"?w(N,G):N[e.Kind]==="Object"?c(N,G):N[e.Kind]==="Tuple"?O(N,G):e.Type.Never()}function b(N,G,re={}){let ne=G.map(ve=>v(N,ve.toString()));return g(e.Type.Union(ne,re))}d.Resolve=b})(C||(e.IndexedAccessor=C={}));var A;(function(d){function _(O){let[v,b]=[O.slice(0,1),O.slice(1)];return`${v.toLowerCase()}${b}`}function I(O){let[v,b]=[O.slice(0,1),O.slice(1)];return`${v.toUpperCase()}${b}`}function U(O){return O.toUpperCase()}function $(O){return O.toLowerCase()}function x(O,v){let b=W.ParseExact(O.pattern);if(!P.Check(b))return{...O,pattern:g(O.pattern,v)};let re=[...F.Generate(b)].map(Ae=>e.Type.Literal(Ae)),ne=T(re,v),ve=e.Type.Union(ne);return e.Type.TemplateLiteral([ve])}function g(O,v){return typeof O=="string"?v==="Uncapitalize"?_(O):v==="Capitalize"?I(O):v==="Uppercase"?U(O):v==="Lowercase"?$(O):O:O.toString()}function T(O,v){if(O.length===0)return[];let[b,...N]=O;return[c(b,v),...T(N,v)]}function w(O,v){return s.TTemplateLiteral(O)?x(O,v):s.TUnion(O)?e.Type.Union(T(O.anyOf,v)):s.TLiteral(O)?e.Type.Literal(g(O.const,v)):O}function c(O,v){return w(O,v)}d.Map=c})(A||(e.Intrinsic=A={}));var S;(function(d){function _(g,T){return e.Type.Intersect(g.allOf.map(w=>$(w,T)),{...g})}function I(g,T){return e.Type.Union(g.anyOf.map(w=>$(w,T)),{...g})}function U(g,T){return T(g)}function $(g,T){return g[e.Kind]==="Intersect"?_(g,T):g[e.Kind]==="Union"?I(g,T):g[e.Kind]==="Object"?U(g,T):g}function x(g,T,w){return{...$(p.Type(g),T),...w}}d.Map=x})(S||(e.ObjectMap=S={}));var z;(function(d){function _(c){return c[0]==="^"&&c[c.length-1]==="$"?c.slice(1,c.length-1):c}function I(c,O){return c.allOf.reduce((v,b)=>[...v,...g(b,O)],[])}function U(c,O){let v=c.anyOf.map(b=>g(b,O));return[...v.reduce((b,N)=>N.map(G=>v.every(re=>re.includes(G))?b.add(G):b)[0],new Set)]}function $(c,O){return Object.getOwnPropertyNames(c.properties)}function x(c,O){return O.includePatterns?Object.getOwnPropertyNames(c.patternProperties):[]}function g(c,O){return s.TIntersect(c)?I(c,O):s.TUnion(c)?U(c,O):s.TObject(c)?$(c,O):s.TRecord(c)?x(c,O):[]}function T(c,O){return[...new Set(g(c,O))]}d.ResolveKeys=T;function w(c){return`^(${T(c,{includePatterns:!0}).map(b=>`(${_(b)})`).join("|")})$`}d.ResolvePattern=w})(z||(e.KeyResolver=z={}));var X=class extends r{};e.KeyArrayResolverError=X;var j;(function(d){function _(I){return Array.isArray(I)?I:s.TUnionLiteral(I)?I.anyOf.map(U=>U.const.toString()):s.TLiteral(I)?[I.const]:s.TTemplateLiteral(I)?(()=>{let U=W.ParseExact(I.pattern);if(!P.Check(U))throw new X("Cannot resolve keys from infinite template expression");return[...F.Generate(U)]})():[]}d.Resolve=_})(j||(e.KeyArrayResolver=j={}));var M;(function(d){function*_(U){for(let $ of U.anyOf)$[e.Kind]==="Union"?yield*_($):yield $}function I(U){return e.Type.Union([..._(U)],{...U})}d.Resolve=I})(M||(e.UnionResolver=M={}));var K=class extends r{};e.TemplateLiteralPatternError=K;var H;(function(d){function _(x){throw new K(x)}function I(x){return x.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function U(x,g){return s.TTemplateLiteral(x)?x.pattern.slice(1,x.pattern.length-1):s.TUnion(x)?`(${x.anyOf.map(T=>U(T,g)).join("|")})`:s.TNumber(x)?`${g}${e.PatternNumber}`:s.TInteger(x)?`${g}${e.PatternNumber}`:s.TBigInt(x)?`${g}${e.PatternNumber}`:s.TString(x)?`${g}${e.PatternString}`:s.TLiteral(x)?`${g}${I(x.const.toString())}`:s.TBoolean(x)?`${g}${e.PatternBoolean}`:_(`Unexpected Kind '${x[e.Kind]}'`)}function $(x){return`^${x.map(g=>U(g,"")).join("")}$`}d.Create=$})(H||(e.TemplateLiteralPattern=H={}));var V;(function(d){function _(I){let U=W.ParseExact(I.pattern);if(!P.Check(U))return e.Type.String();let $=[...F.Generate(U)].map(x=>e.Type.Literal(x));return e.Type.Union($)}d.Resolve=_})(V||(e.TemplateLiteralResolver=V={}));var ee=class extends r{};e.TemplateLiteralParserError=ee;var W;(function(d){function _(N,G,re){return N[G]===re&&N.charCodeAt(G-1)!==92}function I(N,G){return _(N,G,"(")}function U(N,G){return _(N,G,")")}function $(N,G){return _(N,G,"|")}function x(N){if(!(I(N,0)&&U(N,N.length-1)))return!1;let G=0;for(let re=0;re<N.length;re++)if(I(N,re)&&(G+=1),U(N,re)&&(G-=1),G===0&&re!==N.length-1)return!1;return!0}function g(N){return N.slice(1,N.length-1)}function T(N){let G=0;for(let re=0;re<N.length;re++)if(I(N,re)&&(G+=1),U(N,re)&&(G-=1),$(N,re)&&G===0)return!0;return!1}function w(N){for(let G=0;G<N.length;G++)if(I(N,G))return!0;return!1}function c(N){let[G,re]=[0,0],ne=[];for(let Ae=0;Ae<N.length;Ae++)if(I(N,Ae)&&(G+=1),U(N,Ae)&&(G-=1),$(N,Ae)&&G===0){let Le=N.slice(re,Ae);Le.length>0&&ne.push(v(Le)),re=Ae+1}let ve=N.slice(re);return ve.length>0&&ne.push(v(ve)),ne.length===0?{type:"const",const:""}:ne.length===1?ne[0]:{type:"or",expr:ne}}function O(N){function G(ve,Ae){if(!I(ve,Ae))throw new ee("TemplateLiteralParser: Index must point to open parens");let Le=0;for(let Ge=Ae;Ge<ve.length;Ge++)if(I(ve,Ge)&&(Le+=1),U(ve,Ge)&&(Le-=1),Le===0)return[Ae,Ge];throw new ee("TemplateLiteralParser: Unclosed group parens in expression")}function re(ve,Ae){for(let Le=Ae;Le<ve.length;Le++)if(I(ve,Le))return[Ae,Le];return[Ae,ve.length]}let ne=[];for(let ve=0;ve<N.length;ve++)if(I(N,ve)){let[Ae,Le]=G(N,ve),Ge=N.slice(Ae,Le+1);ne.push(v(Ge)),ve=Le}else{let[Ae,Le]=re(N,ve),Ge=N.slice(Ae,Le);Ge.length>0&&ne.push(v(Ge)),ve=Le-1}return ne.length===0?{type:"const",const:""}:ne.length===1?ne[0]:{type:"and",expr:ne}}function v(N){return x(N)?v(g(N)):T(N)?c(N):w(N)?O(N):{type:"const",const:N}}d.Parse=v;function b(N){return v(N.slice(1,N.length-1))}d.ParseExact=b})(W||(e.TemplateLiteralParser=W={}));var he=class extends r{};e.TemplateLiteralFiniteError=he;var P;(function(d){function _(g){throw new he(g)}function I(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 U(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 $(g){return g.type==="const"&&g.const===".*"}function x(g){return U(g)?!0:I(g)||$(g)?!1:g.type==="and"?g.expr.every(T=>x(T)):g.type==="or"?g.expr.every(T=>x(T)):g.type==="const"?!0:_("Unknown expression type")}d.Check=x})(P||(e.TemplateLiteralFinite=P={}));var B=class extends r{};e.TemplateLiteralGeneratorError=B;var F;(function(d){function*_(g){if(g.length===1)return yield*g[0];for(let T of g[0])for(let w of _(g.slice(1)))yield`${T}${w}`}function*I(g){return yield*_(g.expr.map(T=>[...x(T)]))}function*U(g){for(let T of g.expr)yield*x(T)}function*$(g){return yield g.const}function*x(g){return g.type==="and"?yield*I(g):g.type==="or"?yield*U(g):g.type==="const"?yield*$(g):(()=>{throw new B("Unknown expression")})()}d.Generate=x})(F||(e.TemplateLiteralGenerator=F={}));var te;(function(d){function*_(x){let g=x.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 T=g.split("|").map(w=>e.Type.Literal(w.trim()));return T.length===0?e.Type.Never():T.length===1?T[0]:e.Type.Union(T)})()}function*I(x){if(x[1]!=="{"){let g=e.Type.Literal("$"),T=U(x.slice(1));return yield*[g,...T]}for(let g=2;g<x.length;g++)if(x[g]==="}"){let T=_(x.slice(2,g)),w=U(x.slice(g+1));return yield*[...T,...w]}yield e.Type.Literal(x)}function*U(x){for(let g=0;g<x.length;g++)if(x[g]==="$"){let T=e.Type.Literal(x.slice(0,g)),w=I(x.slice(g));return yield*[T,...w]}yield e.Type.Literal(x)}function $(x){return[...U(x)]}d.Parse=$})(te||(e.TemplateLiteralDslParser=te={}));var ue=class{constructor(d){this.schema=d}Decode(d){return new Z(this.schema,d)}};e.TransformDecodeBuilder=ue;var Z=class{constructor(d,_){this.schema=d,this.decode=_}Encode(d){let _=p.Type(this.schema);return s.TTransform(_)?(()=>{let $={Encode:x=>_[e.Transform].Encode(d(x)),Decode:x=>this.decode(_[e.Transform].Decode(x))};return{..._,[e.Transform]:$}})():(()=>{let I={Decode:this.decode,Encode:d};return{..._,[e.Transform]:I}})()}};e.TransformEncodeBuilder=Z;var fe=0,D=class extends r{};e.TypeBuilderError=D;var J=class{Create(d){return d}Throw(d){throw new D(d)}Discard(d,_){return _.reduce((I,U)=>{let{[U]:$,...x}=I;return x},d)}Strict(d){return JSON.parse(JSON.stringify(d))}};e.TypeBuilder=J;var Q=class extends J{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,_={}){return this.Create({..._,[e.Kind]:"Array",type:"array",items:p.Type(d)})}Boolean(d={}){return this.Create({...d,[e.Kind]:"Boolean",type:"boolean"})}Capitalize(d,_={}){return{...A.Map(p.Type(d),"Capitalize"),..._}}Composite(d,_){let I=e.Type.Intersect(d,{}),$=z.ResolveKeys(I,{includePatterns:!1}).reduce((x,g)=>({...x,[g]:e.Type.Index(I,[g])}),{});return e.Type.Object($,_)}Enum(d,_={}){if(i.IsUndefined(d))return this.Throw("Enum undefined or empty");let I=Object.getOwnPropertyNames(d).filter(x=>isNaN(x)).map(x=>d[x]),$=[...new Set(I)].map(x=>e.Type.Literal(x));return this.Union($,{..._,[e.Hint]:"Enum"})}Extends(d,_,I,U,$={}){switch(l.Extends(d,_)){case f.Union:return this.Union([p.Type(I,$),p.Type(U,$)]);case f.True:return p.Type(I,$);case f.False:return p.Type(U,$)}}Exclude(d,_,I={}){return s.TTemplateLiteral(d)?this.Exclude(V.Resolve(d),_,I):s.TTemplateLiteral(_)?this.Exclude(d,V.Resolve(_),I):s.TUnion(d)?(()=>{let U=d.anyOf.filter($=>l.Extends($,_)===f.False);return U.length===1?p.Type(U[0],I):this.Union(U,I)})():l.Extends(d,_)!==f.False?this.Never(I):p.Type(d,I)}Extract(d,_,I={}){return s.TTemplateLiteral(d)?this.Extract(V.Resolve(d),_,I):s.TTemplateLiteral(_)?this.Extract(d,V.Resolve(_),I):s.TUnion(d)?(()=>{let U=d.anyOf.filter($=>l.Extends($,_)!==f.False);return U.length===1?p.Type(U[0],I):this.Union(U,I)})():l.Extends(d,_)!==f.False?p.Type(d,I):this.Never(I)}Index(d,_,I={}){return s.TArray(d)&&s.TNumber(_)?p.Type(d.items,I):s.TTuple(d)&&s.TNumber(_)?(()=>{let $=(i.IsUndefined(d.items)?[]:d.items).map(x=>p.Type(x));return this.Union($,I)})():(()=>{let U=j.Resolve(_),$=p.Type(d);return C.Resolve($,U,I)})()}Integer(d={}){return this.Create({...d,[e.Kind]:"Integer",type:"integer"})}Intersect(d,_={}){if(d.length===0)return e.Type.Never();if(d.length===1)return p.Type(d[0],_);d.some(x=>s.TTransform(x))&&this.Throw("Cannot intersect transform types");let I=d.every(x=>s.TObject(x)),U=p.Rest(d),$=s.TSchema(_.unevaluatedProperties)?{unevaluatedProperties:p.Type(_.unevaluatedProperties)}:{};return _.unevaluatedProperties===!1||s.TSchema(_.unevaluatedProperties)||I?this.Create({..._,...$,[e.Kind]:"Intersect",type:"object",allOf:U}):this.Create({..._,...$,[e.Kind]:"Intersect",allOf:U})}KeyOf(d,_={}){return s.TRecord(d)?(()=>{let I=Object.getOwnPropertyNames(d.patternProperties)[0];return I===e.PatternNumberExact?this.Number(_):I===e.PatternStringExact?this.String(_):this.Throw("Unable to resolve key type from Record key pattern")})():s.TTuple(d)?(()=>{let U=(i.IsUndefined(d.items)?[]:d.items).map(($,x)=>e.Type.Literal(x.toString()));return this.Union(U,_)})():s.TArray(d)?this.Number(_):(()=>{let I=z.ResolveKeys(d,{includePatterns:!1});if(I.length===0)return this.Never(_);let U=I.map($=>this.Literal($));return this.Union(U,_)})()}Literal(d,_={}){return this.Create({..._,[e.Kind]:"Literal",const:d,type:typeof d})}Lowercase(d,_={}){return{...A.Map(p.Type(d),"Lowercase"),..._}}Never(d={}){return this.Create({...d,[e.Kind]:"Never",not:{}})}Not(d,_){return this.Create({..._,[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,_={}){let I=Object.getOwnPropertyNames(d),U=I.filter(T=>s.TOptional(d[T])),$=I.filter(T=>!U.includes(T)),x=s.TSchema(_.additionalProperties)?{additionalProperties:p.Type(_.additionalProperties)}:{},g=I.reduce((T,w)=>({...T,[w]:p.Type(d[w])}),{});return $.length>0?this.Create({..._,...x,[e.Kind]:"Object",type:"object",properties:g,required:$}):this.Create({..._,...x,[e.Kind]:"Object",type:"object",properties:g})}Omit(d,_,I={}){let U=j.Resolve(_);return S.Map(this.Discard(p.Type(d),["$id",e.Transform]),$=>{i.IsArray($.required)&&($.required=$.required.filter(x=>!U.includes(x)),$.required.length===0&&delete $.required);for(let x of Object.getOwnPropertyNames($.properties))U.includes(x)&&delete $.properties[x];return this.Create($)},I)}Partial(d,_={}){return S.Map(this.Discard(p.Type(d),["$id",e.Transform]),I=>{let U=Object.getOwnPropertyNames(I.properties).reduce(($,x)=>({...$,[x]:this.Optional(I.properties[x])}),{});return this.Object(U,this.Discard(I,["required"]))},_)}Pick(d,_,I={}){let U=j.Resolve(_);return S.Map(this.Discard(p.Type(d),["$id",e.Transform]),$=>{i.IsArray($.required)&&($.required=$.required.filter(x=>U.includes(x)),$.required.length===0&&delete $.required);for(let x of Object.getOwnPropertyNames($.properties))U.includes(x)||delete $.properties[x];return this.Create($)},I)}Record(d,_,I={}){return s.TTemplateLiteral(d)?(()=>{let U=W.ParseExact(d.pattern);return P.Check(U)?this.Object([...F.Generate(U)].reduce(($,x)=>({...$,[x]:p.Type(_)}),{}),I):this.Create({...I,[e.Kind]:"Record",type:"object",patternProperties:{[d.pattern]:p.Type(_)}})})():s.TUnion(d)?(()=>{let U=M.Resolve(d);if(s.TUnionLiteral(U)){let $=U.anyOf.reduce((x,g)=>({...x,[g.const]:p.Type(_)}),{});return this.Object($,{...I,[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(_)},I):this.Throw("Record key of type literal is not of type string or number"):s.TInteger(d)||s.TNumber(d)?this.Create({...I,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:p.Type(_)}}):s.TString(d)?(()=>{let U=i.IsUndefined(d.pattern)?e.PatternStringExact:d.pattern;return this.Create({...I,[e.Kind]:"Record",type:"object",patternProperties:{[U]:p.Type(_)}})})():this.Never()}Recursive(d,_={}){i.IsUndefined(_.$id)&&(_.$id=`T${fe++}`);let I=d({[e.Kind]:"This",$ref:`${_.$id}`});return I.$id=_.$id,this.Create({..._,[e.Hint]:"Recursive",...I})}Ref(d,_={}){return i.IsString(d)?this.Create({..._,[e.Kind]:"Ref",$ref:d}):(i.IsUndefined(d.$id)&&this.Throw("Reference target type must specify an $id"),this.Create({..._,[e.Kind]:"Ref",$ref:d.$id}))}Required(d,_={}){return S.Map(this.Discard(p.Type(d),["$id",e.Transform]),I=>{let U=Object.getOwnPropertyNames(I.properties).reduce(($,x)=>({...$,[x]:this.Discard(I.properties[x],[e.Optional])}),{});return this.Object(U,I)},_)}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,_={}){let I=i.IsString(d)?H.Create(te.Parse(d)):H.Create(d);return this.Create({..._,[e.Kind]:"TemplateLiteral",type:"string",pattern:I})}Transform(d){return new ue(d)}Tuple(d,_={}){let[I,U,$]=[!1,d.length,d.length],x=p.Rest(d),g=d.length>0?{..._,[e.Kind]:"Tuple",type:"array",items:x,additionalItems:I,minItems:U,maxItems:$}:{..._,[e.Kind]:"Tuple",type:"array",minItems:U,maxItems:$};return this.Create(g)}Uncapitalize(d,_={}){return{...A.Map(p.Type(d),"Uncapitalize"),..._}}Union(d,_={}){return s.TTemplateLiteral(d)?V.Resolve(d):(()=>{let I=d;if(I.length===0)return this.Never(_);if(I.length===1)return this.Create(p.Type(I[0],_));let U=p.Rest(I);return this.Create({..._,[e.Kind]:"Union",anyOf:U})})()}Unknown(d={}){return this.Create({...d,[e.Kind]:"Unknown"})}Unsafe(d={}){return this.Create({...d,[e.Kind]:d[e.Kind]||"Unsafe"})}Uppercase(d,_={}){return{...A.Map(p.Type(d),"Uppercase"),..._}}};e.JsonTypeBuilder=Q;var me=class extends Q{AsyncIterator(d,_={}){return this.Create({..._,[e.Kind]:"AsyncIterator",type:"AsyncIterator",items:p.Type(d)})}Awaited(d,_={}){let I=U=>U.length>0?(()=>{let[$,...x]=U;return[this.Awaited($),...I(x)]})():U;return s.TIntersect(d)?e.Type.Intersect(I(d.allOf)):s.TUnion(d)?e.Type.Union(I(d.anyOf)):s.TPromise(d)?this.Awaited(d.item):p.Type(d,_)}BigInt(d={}){return this.Create({...d,[e.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(d,_={}){return this.Tuple([...d.parameters],{..._})}Constructor(d,_,I){let[U,$]=[p.Rest(d),p.Type(_)];return this.Create({...I,[e.Kind]:"Constructor",type:"Constructor",parameters:U,returns:$})}Date(d={}){return this.Create({...d,[e.Kind]:"Date",type:"Date"})}Function(d,_,I){let[U,$]=[p.Rest(d),p.Type(_)];return this.Create({...I,[e.Kind]:"Function",type:"Function",parameters:U,returns:$})}InstanceType(d,_={}){return p.Type(d.returns,_)}Iterator(d,_={}){return this.Create({..._,[e.Kind]:"Iterator",type:"Iterator",items:p.Type(d)})}Parameters(d,_={}){return this.Tuple(d.parameters,{..._})}Promise(d,_={}){return this.Create({..._,[e.Kind]:"Promise",type:"Promise",item:p.Type(d)})}RegExp(d,_={}){let I=i.IsString(d)?d:d.source;return this.Create({..._,[e.Kind]:"String",type:"string",pattern:I})}RegEx(d,_={}){return this.RegExp(d,_)}ReturnType(d,_={}){return p.Type(d.returns,_)}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=me,e.JsonType=new Q,e.Type=new me}}),ei=Ft(Ar(),1),{String:wv,Optional:Tv,Boolean:Av,Object:Ov,Number:Ev}=ei.Type,Iv=wv.bind(ei.Type),Sv=Ev.bind(ei.Type),OP=Ov.bind(ei.Type),EP=Tv.bind(ei.Type),xv=Av.bind(ei.Type),IP=Iv(),SP=Sv(),xP=xv();function Od(e){return Array.isArray(e)?e:[e]}var Cv=ze({"../../../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}}),Nv=ze({"../../../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(f,l){var p={key:f,value:u[f]},C={key:l,value:u[l]};return a(p,C)}}})(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 f,l;if(Array.isArray(u)){for(l="[",f=0;f<u.length;f++)f&&(l+=","),l+=a(u[f])||"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,C=Object.keys(u).sort(o&&o(u));for(l="",f=0;f<C.length;f++){var A=C[f],S=a(u[A]);S&&(l&&(l+=","),l+=JSON.stringify(A)+":"+S)}return s.splice(p,1),"{"+l+"}"}})(r)}}}),Rv=ze({"../../../node_modules/.pnpm/safe-stable-stringify@2.5.0/node_modules/safe-stable-stringify/index.js"(e,t){"use strict";var{hasOwnProperty:r}=Object.prototype,n=j();n.configure=j,n.stringify=n,n.default=n,e.stringify=n,e.configure=j,t.exports=n;var i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function o(M){return M.length<5e3&&!i.test(M)?`"${M}"`:JSON.stringify(M)}function s(M,K){if(M.length>200||K)return M.sort(K);for(let H=1;H<M.length;H++){let V=M[H],ee=H;for(;ee!==0&&M[ee-1]>V;)M[ee]=M[ee-1],ee--;M[ee]=V}return M}var a=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function u(M){return a.call(M)!==void 0&&M.length!==0}function f(M,K,H){M.length<H&&(H=M.length);let V=K===","?"":" ",ee=`"0":${V}${M[0]}`;for(let W=1;W<H;W++)ee+=`${K}"${W}":${V}${M[W]}`;return ee}function l(M){if(r.call(M,"circularValue")){let K=M.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(M){let K;if(r.call(M,"deterministic")&&(K=M.deterministic,typeof K!="boolean"&&typeof K!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return K===void 0?!0:K}function C(M,K){let H;if(r.call(M,K)&&(H=M[K],typeof H!="boolean"))throw new TypeError(`The "${K}" argument must be of type boolean`);return H===void 0?!0:H}function A(M,K){let H;if(r.call(M,K)){if(H=M[K],typeof H!="number")throw new TypeError(`The "${K}" argument must be of type number`);if(!Number.isInteger(H))throw new TypeError(`The "${K}" argument must be an integer`);if(H<1)throw new RangeError(`The "${K}" argument must be >= 1`)}return H===void 0?1/0:H}function S(M){return M===1?"1 item":`${M} items`}function z(M){let K=new Set;for(let H of M)(typeof H=="string"||typeof H=="number")&&K.add(String(H));return K}function X(M){if(r.call(M,"strict")){let K=M.strict;if(typeof K!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(K)return H=>{let V=`Object can not safely be stringified. Received type ${typeof H}`;throw typeof H!="function"&&(V+=` (${H.toString()})`),new Error(V)}}}function j(M){M={...M};let K=X(M);K&&(M.bigint===void 0&&(M.bigint=!1),"circularValue"in M||(M.circularValue=Error));let H=l(M),V=C(M,"bigint"),ee=p(M),W=typeof ee=="function"?ee:void 0,he=A(M,"maximumDepth"),P=A(M,"maximumBreadth");function B(fe,D,J,Q,me,d){let _=D[fe];switch(typeof _=="object"&&_!==null&&typeof _.toJSON=="function"&&(_=_.toJSON(fe)),_=Q.call(D,fe,_),typeof _){case"string":return o(_);case"object":{if(_===null)return"null";if(J.indexOf(_)!==-1)return H;let I="",U=",",$=d;if(Array.isArray(_)){if(_.length===0)return"[]";if(he<J.length+1)return'"[Array]"';J.push(_),me!==""&&(d+=me,I+=`
|
|
31
|
+
${d}`,U=`,
|
|
32
|
+
${d}`);let O=Math.min(_.length,P),v=0;for(;v<O-1;v++){let N=B(String(v),_,J,Q,me,d);I+=N!==void 0?N:"null",I+=U}let b=B(String(v),_,J,Q,me,d);if(I+=b!==void 0?b:"null",_.length-1>P){let N=_.length-P-1;I+=`${U}"... ${S(N)} not stringified"`}return me!==""&&(I+=`
|
|
33
|
+
${$}`),J.pop(),`[${I}]`}let x=Object.keys(_),g=x.length;if(g===0)return"{}";if(he<J.length+1)return'"[Object]"';let T="",w="";me!==""&&(d+=me,U=`,
|
|
34
|
+
${d}`,T=" ");let c=Math.min(g,P);ee&&!u(_)&&(x=s(x,W)),J.push(_);for(let O=0;O<c;O++){let v=x[O],b=B(v,_,J,Q,me,d);b!==void 0&&(I+=`${w}${o(v)}:${T}${b}`,w=U)}if(g>P){let O=g-P;I+=`${w}"...":${T}"${S(O)} not stringified"`,w=U}return me!==""&&w.length>1&&(I=`
|
|
35
|
+
${d}${I}
|
|
36
|
+
${$}`),J.pop(),`{${I}}`}case"number":return isFinite(_)?String(_):K?K(_):"null";case"boolean":return _===!0?"true":"false";case"undefined":return;case"bigint":if(V)return String(_);default:return K?K(_):void 0}}function F(fe,D,J,Q,me,d){switch(typeof D=="object"&&D!==null&&typeof D.toJSON=="function"&&(D=D.toJSON(fe)),typeof D){case"string":return o(D);case"object":{if(D===null)return"null";if(J.indexOf(D)!==-1)return H;let _=d,I="",U=",";if(Array.isArray(D)){if(D.length===0)return"[]";if(he<J.length+1)return'"[Array]"';J.push(D),me!==""&&(d+=me,I+=`
|
|
37
|
+
${d}`,U=`,
|
|
38
|
+
${d}`);let g=Math.min(D.length,P),T=0;for(;T<g-1;T++){let c=F(String(T),D[T],J,Q,me,d);I+=c!==void 0?c:"null",I+=U}let w=F(String(T),D[T],J,Q,me,d);if(I+=w!==void 0?w:"null",D.length-1>P){let c=D.length-P-1;I+=`${U}"... ${S(c)} not stringified"`}return me!==""&&(I+=`
|
|
39
|
+
${_}`),J.pop(),`[${I}]`}J.push(D);let $="";me!==""&&(d+=me,U=`,
|
|
40
|
+
${d}`,$=" ");let x="";for(let g of Q){let T=F(g,D[g],J,Q,me,d);T!==void 0&&(I+=`${x}${o(g)}:${$}${T}`,x=U)}return me!==""&&x.length>1&&(I=`
|
|
41
|
+
${d}${I}
|
|
42
|
+
${_}`),J.pop(),`{${I}}`}case"number":return isFinite(D)?String(D):K?K(D):"null";case"boolean":return D===!0?"true":"false";case"undefined":return;case"bigint":if(V)return String(D);default:return K?K(D):void 0}}function te(fe,D,J,Q,me){switch(typeof D){case"string":return o(D);case"object":{if(D===null)return"null";if(typeof D.toJSON=="function"){if(D=D.toJSON(fe),typeof D!="object")return te(fe,D,J,Q,me);if(D===null)return"null"}if(J.indexOf(D)!==-1)return H;let d=me;if(Array.isArray(D)){if(D.length===0)return"[]";if(he<J.length+1)return'"[Array]"';J.push(D),me+=Q;let T=`
|
|
43
|
+
${me}`,w=`,
|
|
44
|
+
${me}`,c=Math.min(D.length,P),O=0;for(;O<c-1;O++){let b=te(String(O),D[O],J,Q,me);T+=b!==void 0?b:"null",T+=w}let v=te(String(O),D[O],J,Q,me);if(T+=v!==void 0?v:"null",D.length-1>P){let b=D.length-P-1;T+=`${w}"... ${S(b)} not stringified"`}return T+=`
|
|
45
|
+
${d}`,J.pop(),`[${T}]`}let _=Object.keys(D),I=_.length;if(I===0)return"{}";if(he<J.length+1)return'"[Object]"';me+=Q;let U=`,
|
|
46
|
+
${me}`,$="",x="",g=Math.min(I,P);u(D)&&($+=f(D,U,P),_=_.slice(D.length),g-=D.length,x=U),ee&&(_=s(_,W)),J.push(D);for(let T=0;T<g;T++){let w=_[T],c=te(w,D[w],J,Q,me);c!==void 0&&($+=`${x}${o(w)}: ${c}`,x=U)}if(I>P){let T=I-P;$+=`${x}"...": "${S(T)} not stringified"`,x=U}return x!==""&&($=`
|
|
47
|
+
${me}${$}
|
|
48
|
+
${d}`),J.pop(),`{${$}}`}case"number":return isFinite(D)?String(D):K?K(D):"null";case"boolean":return D===!0?"true":"false";case"undefined":return;case"bigint":if(V)return String(D);default:return K?K(D):void 0}}function ue(fe,D,J){switch(typeof D){case"string":return o(D);case"object":{if(D===null)return"null";if(typeof D.toJSON=="function"){if(D=D.toJSON(fe),typeof D!="object")return ue(fe,D,J);if(D===null)return"null"}if(J.indexOf(D)!==-1)return H;let Q="",me=D.length!==void 0;if(me&&Array.isArray(D)){if(D.length===0)return"[]";if(he<J.length+1)return'"[Array]"';J.push(D);let $=Math.min(D.length,P),x=0;for(;x<$-1;x++){let T=ue(String(x),D[x],J);Q+=T!==void 0?T:"null",Q+=","}let g=ue(String(x),D[x],J);if(Q+=g!==void 0?g:"null",D.length-1>P){let T=D.length-P-1;Q+=`,"... ${S(T)} not stringified"`}return J.pop(),`[${Q}]`}let d=Object.keys(D),_=d.length;if(_===0)return"{}";if(he<J.length+1)return'"[Object]"';let I="",U=Math.min(_,P);me&&u(D)&&(Q+=f(D,",",P),d=d.slice(D.length),U-=D.length,I=","),ee&&(d=s(d,W)),J.push(D);for(let $=0;$<U;$++){let x=d[$],g=ue(x,D[x],J);g!==void 0&&(Q+=`${I}${o(x)}:${g}`,I=",")}if(_>P){let $=_-P;Q+=`${I}"...":"${S($)} not stringified"`}return J.pop(),`{${Q}}`}case"number":return isFinite(D)?String(D):K?K(D):"null";case"boolean":return D===!0?"true":"false";case"undefined":return;case"bigint":if(V)return String(D);default:return K?K(D):void 0}}function Z(fe,D,J){if(arguments.length>1){let Q="";if(typeof J=="number"?Q=" ".repeat(Math.min(J,10)):typeof J=="string"&&(Q=J.slice(0,10)),D!=null){if(typeof D=="function")return B("",{"":fe},[],D,Q,"");if(Array.isArray(D))return F("",fe,[],z(D),Q,"")}if(Q.length!==0)return te("",fe,[],Q,"")}return ue("",fe,[])}return Z}}}),ni=ze({"../../../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(V){return f(V)&&Symbol.asyncIterator in V}e.IsAsyncIterator=t;function r(V){return f(V)&&Symbol.iterator in V}e.IsIterator=r;function n(V){return ArrayBuffer.isView(V)}e.IsTypedArray=n;function i(V){return V instanceof Promise}e.IsPromise=i;function o(V){return V instanceof Uint8Array}e.IsUint8Array=o;function s(V){return V instanceof Date&&Number.isFinite(V.getTime())}e.IsDate=s;function a(V,ee){return ee in V}e.HasPropertyKey=a;function u(V){return f(V)&&M(V.constructor)&&V.constructor.name==="Object"}e.IsPlainObject=u;function f(V){return V!==null&&typeof V=="object"}e.IsObject=f;function l(V){return Array.isArray(V)&&!ArrayBuffer.isView(V)}e.IsArray=l;function p(V){return V===void 0}e.IsUndefined=p;function C(V){return V===null}e.IsNull=C;function A(V){return typeof V=="boolean"}e.IsBoolean=A;function S(V){return typeof V=="number"}e.IsNumber=S;function z(V){return S(V)&&Number.isInteger(V)}e.IsInteger=z;function X(V){return typeof V=="bigint"}e.IsBigInt=X;function j(V){return typeof V=="string"}e.IsString=j;function M(V){return typeof V=="function"}e.IsFunction=M;function K(V){return typeof V=="symbol"}e.IsSymbol=K;function H(V){return X(V)||A(V)||C(V)||S(V)||j(V)||K(V)||p(V)}e.IsValueType=H}}),$p=ze({"../../../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=ni(),r=Ls(),n=Ar(),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(A,S){if(n.TypeRegistry.Has(A))throw new i(A);return n.TypeRegistry.Set(A,S),(z={})=>n.Type.Unsafe({...z,[n.Kind]:A})}l.Type=p;function C(A,S){if(n.FormatRegistry.Has(A))throw new o(A);return n.FormatRegistry.Set(A,S),A}l.Format=C})(s||(e.TypeSystem=s={}));var a;(function(l){let p=f;function C(){p=f}l.Reset=C;function A(z){p=z}l.Set=A;function S(){return p}l.Get=S})(a||(e.TypeSystemErrorFunction=a={}));var u;(function(l){l.ExactOptionalPropertyTypes=!1,l.AllowArrayObject=!1,l.AllowNaN=!1,l.AllowNullVoid=!1;function p(X,j){return l.ExactOptionalPropertyTypes?j in X:X[j]!==void 0}l.IsExactOptionalProperty=p;function C(X){let j=(0,t.IsObject)(X);return l.AllowArrayObject?j:j&&!(0,t.IsArray)(X)}l.IsObjectLike=C;function A(X){return C(X)&&!(X instanceof Date)&&!(X instanceof Uint8Array)}l.IsRecordLike=A;function S(X){let j=(0,t.IsNumber)(X);return l.AllowNaN?j:j&&Number.isFinite(X)}l.IsNumberLike=S;function z(X){let j=(0,t.IsUndefined)(X);return l.AllowNullVoid?j||X===null:j}l.IsVoidLike=z})(u||(e.TypeSystemPolicy=u={}));function f(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=f}}),Ds=ze({"../../../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=Ar(),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}}),zu=ze({"../../../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=ni(),r=class extends Error{constructor(B){super("Unable to hash value"),this.value=B}};e.ValueHashError=r;var n;(function(B){B[B.Undefined=0]="Undefined",B[B.Null=1]="Null",B[B.Boolean=2]="Boolean",B[B.Number=3]="Number",B[B.String=4]="String",B[B.Object=5]="Object",B[B.Array=6]="Array",B[B.Date=7]="Date",B[B.Uint8Array=8]="Uint8Array",B[B.Symbol=9]="Symbol",B[B.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((B,F)=>BigInt(F)),u=new Float64Array(1),f=new DataView(u.buffer),l=new Uint8Array(u.buffer);function*p(B){let F=B===0?1:Math.ceil(Math.floor(Math.log2(B)+1)/8);for(let te=0;te<F;te++)yield B>>8*(F-1-te)&255}function C(B){he(n.Array);for(let F of B)W(F)}function A(B){he(n.Boolean),he(B?1:0)}function S(B){he(n.BigInt),f.setBigInt64(0,B);for(let F of l)he(F)}function z(B){he(n.Date),W(B.getTime())}function X(B){he(n.Null)}function j(B){he(n.Number),f.setFloat64(0,B);for(let F of l)he(F)}function M(B){he(n.Object);for(let F of globalThis.Object.keys(B).sort())W(F),W(B[F])}function K(B){he(n.String);for(let F=0;F<B.length;F++)for(let te of p(B.charCodeAt(F)))he(te)}function H(B){he(n.Symbol),W(B.description)}function V(B){he(n.Uint8Array);for(let F=0;F<B.length;F++)he(B[F])}function ee(B){return he(n.Undefined)}function W(B){if((0,t.IsArray)(B))return C(B);if((0,t.IsBoolean)(B))return A(B);if((0,t.IsBigInt)(B))return S(B);if((0,t.IsDate)(B))return z(B);if((0,t.IsNull)(B))return X(B);if((0,t.IsNumber)(B))return j(B);if((0,t.IsPlainObject)(B))return M(B);if((0,t.IsString)(B))return K(B);if((0,t.IsSymbol)(B))return H(B);if((0,t.IsUint8Array)(B))return V(B);if((0,t.IsUndefined)(B))return ee(B);throw new r(B)}function he(B){i=i^a[B],i=i*o%s}function P(B){return i=BigInt("14695981039346656037"),W(B),i}e.Hash=P}}),Ls=ze({"../../../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=ni(),r=$p(),n=Ds(),i=zu(),o=Ar(),s;(function(c){c[c.ArrayContains=0]="ArrayContains",c[c.ArrayMaxContains=1]="ArrayMaxContains",c[c.ArrayMaxItems=2]="ArrayMaxItems",c[c.ArrayMinContains=3]="ArrayMinContains",c[c.ArrayMinItems=4]="ArrayMinItems",c[c.ArrayUniqueItems=5]="ArrayUniqueItems",c[c.Array=6]="Array",c[c.AsyncIterator=7]="AsyncIterator",c[c.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",c[c.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",c[c.BigIntMaximum=10]="BigIntMaximum",c[c.BigIntMinimum=11]="BigIntMinimum",c[c.BigIntMultipleOf=12]="BigIntMultipleOf",c[c.BigInt=13]="BigInt",c[c.Boolean=14]="Boolean",c[c.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",c[c.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",c[c.DateMaximumTimestamp=17]="DateMaximumTimestamp",c[c.DateMinimumTimestamp=18]="DateMinimumTimestamp",c[c.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",c[c.Date=20]="Date",c[c.Function=21]="Function",c[c.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",c[c.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",c[c.IntegerMaximum=24]="IntegerMaximum",c[c.IntegerMinimum=25]="IntegerMinimum",c[c.IntegerMultipleOf=26]="IntegerMultipleOf",c[c.Integer=27]="Integer",c[c.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",c[c.Intersect=29]="Intersect",c[c.Iterator=30]="Iterator",c[c.Kind=31]="Kind",c[c.Literal=32]="Literal",c[c.Never=33]="Never",c[c.Not=34]="Not",c[c.Null=35]="Null",c[c.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",c[c.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",c[c.NumberMaximum=38]="NumberMaximum",c[c.NumberMinimum=39]="NumberMinimum",c[c.NumberMultipleOf=40]="NumberMultipleOf",c[c.Number=41]="Number",c[c.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",c[c.ObjectMaxProperties=43]="ObjectMaxProperties",c[c.ObjectMinProperties=44]="ObjectMinProperties",c[c.ObjectRequiredProperty=45]="ObjectRequiredProperty",c[c.Object=46]="Object",c[c.Promise=47]="Promise",c[c.StringFormatUnknown=48]="StringFormatUnknown",c[c.StringFormat=49]="StringFormat",c[c.StringMaxLength=50]="StringMaxLength",c[c.StringMinLength=51]="StringMinLength",c[c.StringPattern=52]="StringPattern",c[c.String=53]="String",c[c.Symbol=54]="Symbol",c[c.TupleLength=55]="TupleLength",c[c.Tuple=56]="Tuple",c[c.Uint8ArrayMaxByteLength=57]="Uint8ArrayMaxByteLength",c[c.Uint8ArrayMinByteLength=58]="Uint8ArrayMinByteLength",c[c.Uint8Array=59]="Uint8Array",c[c.Undefined=60]="Undefined",c[c.Union=61]="Union",c[c.Void=62]="Void"})(s||(e.ValueErrorType=s={}));var a=class extends o.TypeBoxError{constructor(c){super("Unknown type"),this.schema=c}};e.ValueErrorsUnknownTypeError=a;function u(c){return c.replace(/~/g,"~0").replace(/\//g,"~1")}e.EscapeKey=u;function f(c){return c!==void 0}var l=class{constructor(c){this.iterator=c}[Symbol.iterator](){return this.iterator}First(){let c=this.iterator.next();return c.done?void 0:c.value}};e.ValueErrorIterator=l;function p(c,O,v,b){return{type:c,schema:O,path:v,value:b,message:r.TypeSystemErrorFunction.Get()(O,c)}}function*C(c,O,v,b){}function*A(c,O,v,b){if(!(0,t.IsArray)(b))return yield p(s.Array,c,v,b);f(c.minItems)&&!(b.length>=c.minItems)&&(yield p(s.ArrayMinItems,c,v,b)),f(c.maxItems)&&!(b.length<=c.maxItems)&&(yield p(s.ArrayMaxItems,c,v,b));for(let re=0;re<b.length;re++)yield*T(c.items,O,`${v}/${re}`,b[re]);if(c.uniqueItems===!0&&!(function(){let re=new Set;for(let ne of b){let ve=(0,i.Hash)(ne);if(re.has(ve))return!1;re.add(ve)}return!0})()&&(yield p(s.ArrayUniqueItems,c,v,b)),!(f(c.contains)||f(c.minContains)||f(c.maxContains)))return;let N=f(c.contains)?c.contains:o.Type.Never(),G=b.reduce((re,ne,ve)=>T(N,O,`${v}${ve}`,ne).next().done===!0?re+1:re,0);G===0&&(yield p(s.ArrayContains,c,v,b)),(0,t.IsNumber)(c.minContains)&&G<c.minContains&&(yield p(s.ArrayMinContains,c,v,b)),(0,t.IsNumber)(c.maxContains)&&G>c.maxContains&&(yield p(s.ArrayMaxContains,c,v,b))}function*S(c,O,v,b){(0,t.IsAsyncIterator)(b)||(yield p(s.AsyncIterator,c,v,b))}function*z(c,O,v,b){if(!(0,t.IsBigInt)(b))return yield p(s.BigInt,c,v,b);f(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield p(s.BigIntExclusiveMaximum,c,v,b)),f(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield p(s.BigIntExclusiveMinimum,c,v,b)),f(c.maximum)&&!(b<=c.maximum)&&(yield p(s.BigIntMaximum,c,v,b)),f(c.minimum)&&!(b>=c.minimum)&&(yield p(s.BigIntMinimum,c,v,b)),f(c.multipleOf)&&b%c.multipleOf!==BigInt(0)&&(yield p(s.BigIntMultipleOf,c,v,b))}function*X(c,O,v,b){(0,t.IsBoolean)(b)||(yield p(s.Boolean,c,v,b))}function*j(c,O,v,b){yield*T(c.returns,O,v,b.prototype)}function*M(c,O,v,b){if(!(0,t.IsDate)(b))return yield p(s.Date,c,v,b);f(c.exclusiveMaximumTimestamp)&&!(b.getTime()<c.exclusiveMaximumTimestamp)&&(yield p(s.DateExclusiveMaximumTimestamp,c,v,b)),f(c.exclusiveMinimumTimestamp)&&!(b.getTime()>c.exclusiveMinimumTimestamp)&&(yield p(s.DateExclusiveMinimumTimestamp,c,v,b)),f(c.maximumTimestamp)&&!(b.getTime()<=c.maximumTimestamp)&&(yield p(s.DateMaximumTimestamp,c,v,b)),f(c.minimumTimestamp)&&!(b.getTime()>=c.minimumTimestamp)&&(yield p(s.DateMinimumTimestamp,c,v,b)),f(c.multipleOfTimestamp)&&b.getTime()%c.multipleOfTimestamp!==0&&(yield p(s.DateMultipleOfTimestamp,c,v,b))}function*K(c,O,v,b){(0,t.IsFunction)(b)||(yield p(s.Function,c,v,b))}function*H(c,O,v,b){if(!(0,t.IsInteger)(b))return yield p(s.Integer,c,v,b);f(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield p(s.IntegerExclusiveMaximum,c,v,b)),f(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield p(s.IntegerExclusiveMinimum,c,v,b)),f(c.maximum)&&!(b<=c.maximum)&&(yield p(s.IntegerMaximum,c,v,b)),f(c.minimum)&&!(b>=c.minimum)&&(yield p(s.IntegerMinimum,c,v,b)),f(c.multipleOf)&&b%c.multipleOf!==0&&(yield p(s.IntegerMultipleOf,c,v,b))}function*V(c,O,v,b){for(let N of c.allOf){let G=T(N,O,v,b).next();G.done||(yield p(s.Intersect,c,v,b),yield G.value)}if(c.unevaluatedProperties===!1){let N=new RegExp(o.KeyResolver.ResolvePattern(c));for(let G of Object.getOwnPropertyNames(b))N.test(G)||(yield p(s.IntersectUnevaluatedProperties,c,`${v}/${G}`,b))}if(typeof c.unevaluatedProperties=="object"){let N=new RegExp(o.KeyResolver.ResolvePattern(c));for(let G of Object.getOwnPropertyNames(b))if(!N.test(G)){let re=T(c.unevaluatedProperties,O,`${v}/${G}`,b[G]).next();re.done||(yield re.value)}}}function*ee(c,O,v,b){(0,t.IsIterator)(b)||(yield p(s.Iterator,c,v,b))}function*W(c,O,v,b){b!==c.const&&(yield p(s.Literal,c,v,b))}function*he(c,O,v,b){yield p(s.Never,c,v,b)}function*P(c,O,v,b){T(c.not,O,v,b).next().done===!0&&(yield p(s.Not,c,v,b))}function*B(c,O,v,b){(0,t.IsNull)(b)||(yield p(s.Null,c,v,b))}function*F(c,O,v,b){if(!r.TypeSystemPolicy.IsNumberLike(b))return yield p(s.Number,c,v,b);f(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield p(s.NumberExclusiveMaximum,c,v,b)),f(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield p(s.NumberExclusiveMinimum,c,v,b)),f(c.maximum)&&!(b<=c.maximum)&&(yield p(s.NumberMaximum,c,v,b)),f(c.minimum)&&!(b>=c.minimum)&&(yield p(s.NumberMinimum,c,v,b)),f(c.multipleOf)&&b%c.multipleOf!==0&&(yield p(s.NumberMultipleOf,c,v,b))}function*te(c,O,v,b){if(!r.TypeSystemPolicy.IsObjectLike(b))return yield p(s.Object,c,v,b);f(c.minProperties)&&!(Object.getOwnPropertyNames(b).length>=c.minProperties)&&(yield p(s.ObjectMinProperties,c,v,b)),f(c.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=c.maxProperties)&&(yield p(s.ObjectMaxProperties,c,v,b));let N=Array.isArray(c.required)?c.required:[],G=Object.getOwnPropertyNames(c.properties),re=Object.getOwnPropertyNames(b);for(let ne of N)re.includes(ne)||(yield p(s.ObjectRequiredProperty,c.properties[ne],`${v}/${u(ne)}`,void 0));if(c.additionalProperties===!1)for(let ne of re)G.includes(ne)||(yield p(s.ObjectAdditionalProperties,c,`${v}/${u(ne)}`,b[ne]));if(typeof c.additionalProperties=="object")for(let ne of re)G.includes(ne)||(yield*T(c.additionalProperties,O,`${v}/${u(ne)}`,b[ne]));for(let ne of G){let ve=c.properties[ne];c.required&&c.required.includes(ne)?(yield*T(ve,O,`${v}/${u(ne)}`,b[ne]),o.ExtendsUndefined.Check(c)&&!(ne in b)&&(yield p(s.ObjectRequiredProperty,ve,`${v}/${u(ne)}`,void 0))):r.TypeSystemPolicy.IsExactOptionalProperty(b,ne)&&(yield*T(ve,O,`${v}/${u(ne)}`,b[ne]))}}function*ue(c,O,v,b){(0,t.IsPromise)(b)||(yield p(s.Promise,c,v,b))}function*Z(c,O,v,b){if(!r.TypeSystemPolicy.IsRecordLike(b))return yield p(s.Object,c,v,b);f(c.minProperties)&&!(Object.getOwnPropertyNames(b).length>=c.minProperties)&&(yield p(s.ObjectMinProperties,c,v,b)),f(c.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=c.maxProperties)&&(yield p(s.ObjectMaxProperties,c,v,b));let[N,G]=Object.entries(c.patternProperties)[0],re=new RegExp(N);for(let[ne,ve]of Object.entries(b))re.test(ne)&&(yield*T(G,O,`${v}/${u(ne)}`,ve));if(typeof c.additionalProperties=="object")for(let[ne,ve]of Object.entries(b))re.test(ne)||(yield*T(c.additionalProperties,O,`${v}/${u(ne)}`,ve));if(c.additionalProperties===!1){for(let[ne,ve]of Object.entries(b))if(!re.test(ne))return yield p(s.ObjectAdditionalProperties,c,`${v}/${u(ne)}`,ve)}}function*fe(c,O,v,b){yield*T((0,n.Deref)(c,O),O,v,b)}function*D(c,O,v,b){if(!(0,t.IsString)(b))return yield p(s.String,c,v,b);f(c.minLength)&&!(b.length>=c.minLength)&&(yield p(s.StringMinLength,c,v,b)),f(c.maxLength)&&!(b.length<=c.maxLength)&&(yield p(s.StringMaxLength,c,v,b)),(0,t.IsString)(c.pattern)&&(new RegExp(c.pattern).test(b)||(yield p(s.StringPattern,c,v,b))),(0,t.IsString)(c.format)&&(o.FormatRegistry.Has(c.format)?o.FormatRegistry.Get(c.format)(b)||(yield p(s.StringFormat,c,v,b)):yield p(s.StringFormatUnknown,c,v,b))}function*J(c,O,v,b){(0,t.IsSymbol)(b)||(yield p(s.Symbol,c,v,b))}function*Q(c,O,v,b){if(!(0,t.IsString)(b))return yield p(s.String,c,v,b);new RegExp(c.pattern).test(b)||(yield p(s.StringPattern,c,v,b))}function*me(c,O,v,b){yield*T((0,n.Deref)(c,O),O,v,b)}function*d(c,O,v,b){if(!(0,t.IsArray)(b))return yield p(s.Tuple,c,v,b);if(c.items===void 0&&b.length!==0)return yield p(s.TupleLength,c,v,b);if(b.length!==c.maxItems)return yield p(s.TupleLength,c,v,b);if(c.items)for(let N=0;N<c.items.length;N++)yield*T(c.items[N],O,`${v}/${N}`,b[N])}function*_(c,O,v,b){(0,t.IsUndefined)(b)||(yield p(s.Undefined,c,v,b))}function*I(c,O,v,b){let N=0;for(let G of c.anyOf){let re=[...T(G,O,v,b)];if(re.length===0)return;N+=re.length}N>0&&(yield p(s.Union,c,v,b))}function*U(c,O,v,b){if(!(0,t.IsUint8Array)(b))return yield p(s.Uint8Array,c,v,b);f(c.maxByteLength)&&!(b.length<=c.maxByteLength)&&(yield p(s.Uint8ArrayMaxByteLength,c,v,b)),f(c.minByteLength)&&!(b.length>=c.minByteLength)&&(yield p(s.Uint8ArrayMinByteLength,c,v,b))}function*$(c,O,v,b){}function*x(c,O,v,b){r.TypeSystemPolicy.IsVoidLike(b)||(yield p(s.Void,c,v,b))}function*g(c,O,v,b){o.TypeRegistry.Get(c[o.Kind])(c,b)||(yield p(s.Kind,c,v,b))}function*T(c,O,v,b){let N=f(c.$id)?[...O,c]:O,G=c;switch(G[o.Kind]){case"Any":return yield*C(G,N,v,b);case"Array":return yield*A(G,N,v,b);case"AsyncIterator":return yield*S(G,N,v,b);case"BigInt":return yield*z(G,N,v,b);case"Boolean":return yield*X(G,N,v,b);case"Constructor":return yield*j(G,N,v,b);case"Date":return yield*M(G,N,v,b);case"Function":return yield*K(G,N,v,b);case"Integer":return yield*H(G,N,v,b);case"Intersect":return yield*V(G,N,v,b);case"Iterator":return yield*ee(G,N,v,b);case"Literal":return yield*W(G,N,v,b);case"Never":return yield*he(G,N,v,b);case"Not":return yield*P(G,N,v,b);case"Null":return yield*B(G,N,v,b);case"Number":return yield*F(G,N,v,b);case"Object":return yield*te(G,N,v,b);case"Promise":return yield*ue(G,N,v,b);case"Record":return yield*Z(G,N,v,b);case"Ref":return yield*fe(G,N,v,b);case"String":return yield*D(G,N,v,b);case"Symbol":return yield*J(G,N,v,b);case"TemplateLiteral":return yield*Q(G,N,v,b);case"This":return yield*me(G,N,v,b);case"Tuple":return yield*d(G,N,v,b);case"Undefined":return yield*_(G,N,v,b);case"Union":return yield*I(G,N,v,b);case"Uint8Array":return yield*U(G,N,v,b);case"Unknown":return yield*$(G,N,v,b);case"Void":return yield*x(G,N,v,b);default:if(!o.TypeRegistry.Has(G[o.Kind]))throw new a(c);return yield*g(G,N,v,b)}}function w(...c){let O=c.length===3?T(c[0],c[1],"",c[2]):T(c[0],[],"",c[1]);return new l(O)}e.Errors=w}}),$v=ze({"../../../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(Ls(),e)}}),Pp=ze({"../../../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=Ls();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),r($p(),e)}}),Pv=ze({"../../../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=ni(),r=Pp(),n=Ds(),i=zu(),o=Ar(),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 f(g,T,w){return!0}function l(g,T,w){if(!(0,t.IsArray)(w)||u(g.minItems)&&!(w.length>=g.minItems)||u(g.maxItems)&&!(w.length<=g.maxItems)||!w.every(v=>$(g.items,T,v))||g.uniqueItems===!0&&!(function(){let v=new Set;for(let b of w){let N=(0,i.Hash)(b);if(v.has(N))return!1;v.add(N)}return!0})())return!1;if(!(u(g.contains)||(0,t.IsNumber)(g.minContains)||(0,t.IsNumber)(g.maxContains)))return!0;let c=u(g.contains)?g.contains:o.Type.Never(),O=w.reduce((v,b)=>$(c,T,b)?v+1:v,0);return!(O===0||(0,t.IsNumber)(g.minContains)&&O<g.minContains||(0,t.IsNumber)(g.maxContains)&&O>g.maxContains)}function p(g,T,w){return(0,t.IsAsyncIterator)(w)}function C(g,T,w){return!(!(0,t.IsBigInt)(w)||u(g.exclusiveMaximum)&&!(w<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(w>g.exclusiveMinimum)||u(g.maximum)&&!(w<=g.maximum)||u(g.minimum)&&!(w>=g.minimum)||u(g.multipleOf)&&w%g.multipleOf!==BigInt(0))}function A(g,T,w){return(0,t.IsBoolean)(w)}function S(g,T,w){return $(g.returns,T,w.prototype)}function z(g,T,w){return!(!(0,t.IsDate)(w)||u(g.exclusiveMaximumTimestamp)&&!(w.getTime()<g.exclusiveMaximumTimestamp)||u(g.exclusiveMinimumTimestamp)&&!(w.getTime()>g.exclusiveMinimumTimestamp)||u(g.maximumTimestamp)&&!(w.getTime()<=g.maximumTimestamp)||u(g.minimumTimestamp)&&!(w.getTime()>=g.minimumTimestamp)||u(g.multipleOfTimestamp)&&w.getTime()%g.multipleOfTimestamp!==0)}function X(g,T,w){return(0,t.IsFunction)(w)}function j(g,T,w){return!(!(0,t.IsInteger)(w)||u(g.exclusiveMaximum)&&!(w<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(w>g.exclusiveMinimum)||u(g.maximum)&&!(w<=g.maximum)||u(g.minimum)&&!(w>=g.minimum)||u(g.multipleOf)&&w%g.multipleOf!==0)}function M(g,T,w){let c=g.allOf.every(O=>$(O,T,w));if(g.unevaluatedProperties===!1){let O=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(w).every(b=>O.test(b));return c&&v}else if(o.TypeGuard.TSchema(g.unevaluatedProperties)){let O=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(w).every(b=>O.test(b)||$(g.unevaluatedProperties,T,w[b]));return c&&v}else return c}function K(g,T,w){return(0,t.IsIterator)(w)}function H(g,T,w){return w===g.const}function V(g,T,w){return!1}function ee(g,T,w){return!$(g.not,T,w)}function W(g,T,w){return(0,t.IsNull)(w)}function he(g,T,w){return!(!r.TypeSystemPolicy.IsNumberLike(w)||u(g.exclusiveMaximum)&&!(w<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(w>g.exclusiveMinimum)||u(g.minimum)&&!(w>=g.minimum)||u(g.maximum)&&!(w<=g.maximum)||u(g.multipleOf)&&w%g.multipleOf!==0)}function P(g,T,w){if(!r.TypeSystemPolicy.IsObjectLike(w)||u(g.minProperties)&&!(Object.getOwnPropertyNames(w).length>=g.minProperties)||u(g.maxProperties)&&!(Object.getOwnPropertyNames(w).length<=g.maxProperties))return!1;let c=Object.getOwnPropertyNames(g.properties);for(let O of c){let v=g.properties[O];if(g.required&&g.required.includes(O)){if(!$(v,T,w[O])||(o.ExtendsUndefined.Check(v)||a(v))&&!(O in w))return!1}else if(r.TypeSystemPolicy.IsExactOptionalProperty(w,O)&&!$(v,T,w[O]))return!1}if(g.additionalProperties===!1){let O=Object.getOwnPropertyNames(w);return g.required&&g.required.length===c.length&&O.length===c.length?!0:O.every(v=>c.includes(v))}else return typeof g.additionalProperties=="object"?Object.getOwnPropertyNames(w).every(v=>c.includes(v)||$(g.additionalProperties,T,w[v])):!0}function B(g,T,w){return(0,t.IsPromise)(w)}function F(g,T,w){if(!r.TypeSystemPolicy.IsRecordLike(w)||u(g.minProperties)&&!(Object.getOwnPropertyNames(w).length>=g.minProperties)||u(g.maxProperties)&&!(Object.getOwnPropertyNames(w).length<=g.maxProperties))return!1;let[c,O]=Object.entries(g.patternProperties)[0],v=new RegExp(c),b=Object.entries(w).every(([re,ne])=>v.test(re)?$(O,T,ne):!0),N=typeof g.additionalProperties=="object"?Object.entries(w).every(([re,ne])=>v.test(re)?!0:$(g.additionalProperties,T,ne)):!0,G=g.additionalProperties===!1?Object.getOwnPropertyNames(w).every(re=>v.test(re)):!0;return b&&N&&G}function te(g,T,w){return $((0,n.Deref)(g,T),T,w)}function ue(g,T,w){return!(0,t.IsString)(w)||u(g.minLength)&&!(w.length>=g.minLength)||u(g.maxLength)&&!(w.length<=g.maxLength)||u(g.pattern)&&!new RegExp(g.pattern).test(w)?!1:u(g.format)?o.FormatRegistry.Has(g.format)?o.FormatRegistry.Get(g.format)(w):!1:!0}function Z(g,T,w){return(0,t.IsSymbol)(w)}function fe(g,T,w){return(0,t.IsString)(w)&&new RegExp(g.pattern).test(w)}function D(g,T,w){return $((0,n.Deref)(g,T),T,w)}function J(g,T,w){if(!(0,t.IsArray)(w)||g.items===void 0&&w.length!==0||w.length!==g.maxItems)return!1;if(!g.items)return!0;for(let c=0;c<g.items.length;c++)if(!$(g.items[c],T,w[c]))return!1;return!0}function Q(g,T,w){return(0,t.IsUndefined)(w)}function me(g,T,w){return g.anyOf.some(c=>$(c,T,w))}function d(g,T,w){return!(!(0,t.IsUint8Array)(w)||u(g.maxByteLength)&&!(w.length<=g.maxByteLength)||u(g.minByteLength)&&!(w.length>=g.minByteLength))}function _(g,T,w){return!0}function I(g,T,w){return r.TypeSystemPolicy.IsVoidLike(w)}function U(g,T,w){return o.TypeRegistry.Has(g[o.Kind])?o.TypeRegistry.Get(g[o.Kind])(g,w):!1}function $(g,T,w){let c=u(g.$id)?[...T,g]:T,O=g;switch(O[o.Kind]){case"Any":return f(O,c,w);case"Array":return l(O,c,w);case"AsyncIterator":return p(O,c,w);case"BigInt":return C(O,c,w);case"Boolean":return A(O,c,w);case"Constructor":return S(O,c,w);case"Date":return z(O,c,w);case"Function":return X(O,c,w);case"Integer":return j(O,c,w);case"Intersect":return M(O,c,w);case"Iterator":return K(O,c,w);case"Literal":return H(O,c,w);case"Never":return V(O,c,w);case"Not":return ee(O,c,w);case"Null":return W(O,c,w);case"Number":return he(O,c,w);case"Object":return P(O,c,w);case"Promise":return B(O,c,w);case"Record":return F(O,c,w);case"Ref":return te(O,c,w);case"String":return ue(O,c,w);case"Symbol":return Z(O,c,w);case"TemplateLiteral":return fe(O,c,w);case"This":return D(O,c,w);case"Tuple":return J(O,c,w);case"Undefined":return Q(O,c,w);case"Union":return me(O,c,w);case"Uint8Array":return d(O,c,w);case"Unknown":return _(O,c,w);case"Void":return I(O,c,w);default:if(!o.TypeRegistry.Has(O[o.Kind]))throw new s(O);return U(O,c,w)}}function x(...g){return g.length===3?$(g[0],g[1],g[2]):$(g[0],[],g[1])}e.Check=x}}),Uv=ze({"../../../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=ni(),r=Ds(),n=Pv(),i=Ar(),o=class extends i.TypeBoxError{constructor(C,A,S){super("Unable to decode due to invalid value"),this.schema=C,this.value=A,this.error=S}};e.TransformDecodeCheckError=o;var s=class extends i.TypeBoxError{constructor(C,A,S){super("Unable to encode due to invalid value"),this.schema=C,this.value=A,this.error=S}};e.TransformEncodeCheckError=s;var a=class extends i.TypeBoxError{constructor(C,A,S){super(`${S instanceof Error?S.message:"Unknown error"}`),this.schema=C,this.value=A}};e.TransformDecodeError=a;var u=class extends i.TypeBoxError{constructor(C,A,S){super(`${S instanceof Error?S.message:"Unknown error"}`),this.schema=C,this.value=A}};e.TransformEncodeError=u;var f;(function(C){function A(Z,fe){return i.TypeGuard.TTransform(Z)||F(Z.items,fe)}function S(Z,fe){return i.TypeGuard.TTransform(Z)||F(Z.items,fe)}function z(Z,fe){return i.TypeGuard.TTransform(Z)||F(Z.returns,fe)||Z.parameters.some(D=>F(D,fe))}function X(Z,fe){return i.TypeGuard.TTransform(Z)||F(Z.returns,fe)||Z.parameters.some(D=>F(D,fe))}function j(Z,fe){return i.TypeGuard.TTransform(Z)||i.TypeGuard.TTransform(Z.unevaluatedProperties)||Z.allOf.some(D=>F(D,fe))}function M(Z,fe){return i.TypeGuard.TTransform(Z)||F(Z.items,fe)}function K(Z,fe){return i.TypeGuard.TTransform(Z)||F(Z.not,fe)}function H(Z,fe){return i.TypeGuard.TTransform(Z)||Object.values(Z.properties).some(D=>F(D,fe))||i.TypeGuard.TSchema(Z.additionalProperties)&&F(Z.additionalProperties,fe)}function V(Z,fe){return i.TypeGuard.TTransform(Z)||F(Z.item,fe)}function ee(Z,fe){let D=Object.getOwnPropertyNames(Z.patternProperties)[0],J=Z.patternProperties[D];return i.TypeGuard.TTransform(Z)||F(J,fe)||i.TypeGuard.TSchema(Z.additionalProperties)&&i.TypeGuard.TTransform(Z.additionalProperties)}function W(Z,fe){return i.TypeGuard.TTransform(Z)?!0:F((0,r.Deref)(Z,fe),fe)}function he(Z,fe){return i.TypeGuard.TTransform(Z)?!0:F((0,r.Deref)(Z,fe),fe)}function P(Z,fe){return i.TypeGuard.TTransform(Z)||!(0,t.IsUndefined)(Z.items)&&Z.items.some(D=>F(D,fe))}function B(Z,fe){return i.TypeGuard.TTransform(Z)||Z.anyOf.some(D=>F(D,fe))}function F(Z,fe){let D=(0,t.IsString)(Z.$id)?[...fe,Z]:fe,J=Z;if(Z.$id&&te.has(Z.$id))return!1;switch(Z.$id&&te.add(Z.$id),Z[i.Kind]){case"Array":return A(J,D);case"AsyncIterator":return S(J,D);case"Constructor":return z(J,D);case"Function":return X(J,D);case"Intersect":return j(J,D);case"Iterator":return M(J,D);case"Not":return K(J,D);case"Object":return H(J,D);case"Promise":return V(J,D);case"Record":return ee(J,D);case"Ref":return W(J,D);case"This":return he(J,D);case"Tuple":return P(J,D);case"Union":return B(J,D);default:return i.TypeGuard.TTransform(Z)}}let te=new Set;function ue(Z,fe){return te.clear(),F(Z,fe)}C.Has=ue})(f||(e.HasTransform=f={}));var l;(function(C){function A(P,B){try{return i.TypeGuard.TTransform(P)?P[i.Transform].Decode(B):B}catch(F){throw new a(P,B,F)}}function S(P,B,F){return(0,t.IsArray)(F)?A(P,F.map(te=>W(P.items,B,te))):A(P,F)}function z(P,B,F){if(!(0,t.IsPlainObject)(F)||(0,t.IsValueType)(F))return A(P,F);let te=i.KeyResolver.ResolveKeys(P,{includePatterns:!1}),ue=te.reduce((J,Q)=>Q in J?{...J,[Q]:W(i.IndexedAccessor.Resolve(P,[Q]),B,J[Q])}:J,F);if(!i.TypeGuard.TTransform(P.unevaluatedProperties))return A(P,ue);let Z=Object.getOwnPropertyNames(ue),fe=P.unevaluatedProperties,D=Z.reduce((J,Q)=>te.includes(Q)?J:{...J,[Q]:A(fe,J[Q])},ue);return A(P,D)}function X(P,B,F){return A(P,W(P.not,B,F))}function j(P,B,F){if(!(0,t.IsPlainObject)(F))return A(P,F);let te=i.KeyResolver.ResolveKeys(P,{includePatterns:!1}),ue=te.reduce((J,Q)=>Q in J?{...J,[Q]:W(P.properties[Q],B,J[Q])}:J,F);if(!i.TypeGuard.TSchema(P.additionalProperties))return A(P,ue);let Z=Object.getOwnPropertyNames(ue),fe=P.additionalProperties,D=Z.reduce((J,Q)=>te.includes(Q)?J:{...J,[Q]:A(fe,J[Q])},ue);return A(P,D)}function M(P,B,F){if(!(0,t.IsPlainObject)(F))return A(P,F);let te=Object.getOwnPropertyNames(P.patternProperties)[0],ue=new RegExp(te),Z=Object.getOwnPropertyNames(F).reduce((Q,me)=>ue.test(me)?{...Q,[me]:W(P.patternProperties[te],B,Q[me])}:Q,F);if(!i.TypeGuard.TSchema(P.additionalProperties))return A(P,Z);let fe=Object.getOwnPropertyNames(Z),D=P.additionalProperties,J=fe.reduce((Q,me)=>ue.test(me)?Q:{...Q,[me]:A(D,Q[me])},Z);return A(P,J)}function K(P,B,F){let te=(0,r.Deref)(P,B);return A(P,W(te,B,F))}function H(P,B,F){let te=(0,r.Deref)(P,B);return A(P,W(te,B,F))}function V(P,B,F){return(0,t.IsArray)(F)&&(0,t.IsArray)(P.items)?A(P,P.items.map((te,ue)=>W(te,B,F[ue]))):A(P,F)}function ee(P,B,F){let te=A(P,F);for(let ue of P.anyOf)if((0,n.Check)(ue,B,te))return W(ue,B,te);return te}function W(P,B,F){let te=typeof P.$id=="string"?[...B,P]:B,ue=P;switch(P[i.Kind]){case"Array":return S(ue,te,F);case"Intersect":return z(ue,te,F);case"Not":return X(ue,te,F);case"Object":return j(ue,te,F);case"Record":return M(ue,te,F);case"Ref":return K(ue,te,F);case"Symbol":return A(ue,F);case"This":return H(ue,te,F);case"Tuple":return V(ue,te,F);case"Union":return ee(ue,te,F);default:return A(ue,F)}}function he(P,B,F){return W(P,B,F)}C.Decode=he})(l||(e.DecodeTransform=l={}));var p;(function(C){function A(P,B){try{return i.TypeGuard.TTransform(P)?P[i.Transform].Encode(B):B}catch(F){throw new u(P,B,F)}}function S(P,B,F){let te=A(P,F);return(0,t.IsArray)(te)?te.map(ue=>W(P.items,B,ue)):te}function z(P,B,F){let te=A(P,F);if(!(0,t.IsPlainObject)(F)||(0,t.IsValueType)(F))return te;let ue=i.KeyResolver.ResolveKeys(P,{includePatterns:!1}),Z=ue.reduce((J,Q)=>Q in te?{...J,[Q]:W(i.IndexedAccessor.Resolve(P,[Q]),B,J[Q])}:J,te);if(!i.TypeGuard.TTransform(P.unevaluatedProperties))return A(P,Z);let fe=Object.getOwnPropertyNames(Z),D=P.unevaluatedProperties;return fe.reduce((J,Q)=>ue.includes(Q)?J:{...J,[Q]:A(D,J[Q])},Z)}function X(P,B,F){return A(P.not,A(P,F))}function j(P,B,F){let te=A(P,F);if(!(0,t.IsPlainObject)(F))return te;let ue=i.KeyResolver.ResolveKeys(P,{includePatterns:!1}),Z=ue.reduce((J,Q)=>Q in J?{...J,[Q]:W(P.properties[Q],B,J[Q])}:J,te);if(!i.TypeGuard.TSchema(P.additionalProperties))return Z;let fe=Object.getOwnPropertyNames(Z),D=P.additionalProperties;return fe.reduce((J,Q)=>ue.includes(Q)?J:{...J,[Q]:A(D,J[Q])},Z)}function M(P,B,F){let te=A(P,F);if(!(0,t.IsPlainObject)(F))return te;let ue=Object.getOwnPropertyNames(P.patternProperties)[0],Z=new RegExp(ue),fe=Object.getOwnPropertyNames(F).reduce((Q,me)=>Z.test(me)?{...Q,[me]:W(P.patternProperties[ue],B,Q[me])}:Q,te);if(!i.TypeGuard.TSchema(P.additionalProperties))return A(P,fe);let D=Object.getOwnPropertyNames(fe),J=P.additionalProperties;return D.reduce((Q,me)=>Z.test(me)?Q:{...Q,[me]:A(J,Q[me])},fe)}function K(P,B,F){let te=(0,r.Deref)(P,B),ue=W(te,B,F);return A(P,ue)}function H(P,B,F){let te=(0,r.Deref)(P,B),ue=W(te,B,F);return A(P,ue)}function V(P,B,F){let te=A(P,F);return(0,t.IsArray)(P.items)?P.items.map((ue,Z)=>W(ue,B,te[Z])):[]}function ee(P,B,F){for(let te of P.anyOf){if(!(0,n.Check)(te,B,F))continue;let ue=W(te,B,F);return A(P,ue)}for(let te of P.anyOf){let ue=W(te,B,F);if((0,n.Check)(P,B,ue))return A(P,ue)}return A(P,F)}function W(P,B,F){let te=typeof P.$id=="string"?[...B,P]:B,ue=P;switch(P[i.Kind]){case"Array":return S(ue,te,F);case"Intersect":return z(ue,te,F);case"Not":return X(ue,te,F);case"Object":return j(ue,te,F);case"Record":return M(ue,te,F);case"Ref":return K(ue,te,F);case"This":return H(ue,te,F);case"Tuple":return V(ue,te,F);case"Union":return ee(ue,te,F);default:return A(ue,F)}}function he(P,B,F){return W(P,B,F)}C.Encode=he})(p||(e.EncodeTransform=p={}))}}),Bv=ze({"../../../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=Uv(),r=ni(),n=Ls(),i=Pp(),o=Ds(),s=zu(),a=Ar(),u=class{constructor(j,M,K,H){this.schema=j,this.references=M,this.checkFunc=K,this.code=H,this.hasTransform=t.HasTransform.Has(j,M)}Code(){return this.code}Errors(j){return(0,n.Errors)(this.schema,this.references,j)}Check(j){return this.checkFunc(j)}Decode(j){if(!this.checkFunc(j))throw new t.TransformDecodeCheckError(this.schema,j,this.Errors(j).First());return this.hasTransform?t.DecodeTransform.Decode(this.schema,this.references,j):j}Encode(j){let M=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,j):j;if(!this.checkFunc(M))throw new t.TransformEncodeCheckError(this.schema,j,this.Errors(j).First());return M}};e.TypeCheck=u;var f;(function(j){function M(ee){return ee===36}j.DollarSign=M;function K(ee){return ee===95}j.IsUnderscore=K;function H(ee){return ee>=65&&ee<=90||ee>=97&&ee<=122}j.IsAlpha=H;function V(ee){return ee>=48&&ee<=57}j.IsNumeric=V})(f||(f={}));var l;(function(j){function M(ee){return ee.length===0?!1:f.IsNumeric(ee.charCodeAt(0))}function K(ee){if(M(ee))return!1;for(let W=0;W<ee.length;W++){let he=ee.charCodeAt(W);if(!(f.IsAlpha(he)||f.IsNumeric(he)||f.DollarSign(he)||f.IsUnderscore(he)))return!1}return!0}function H(ee){return ee.replace(/'/g,"\\'")}function V(ee,W){return K(W)?`${ee}.${W}`:`${ee}['${H(W)}']`}j.Encode=V})(l||(l={}));var p;(function(j){function M(K){let H=[];for(let V=0;V<K.length;V++){let ee=K.charCodeAt(V);f.IsNumeric(ee)||f.IsAlpha(ee)?H.push(K.charAt(V)):H.push(`_${ee}_`)}return H.join("").replace(/__/g,"_")}j.Encode=M})(p||(p={}));var C;(function(j){function M(K){return K.replace(/'/g,"\\'")}j.Escape=M})(C||(C={}));var A=class extends a.TypeBoxError{constructor(j){super("Unknown type"),this.schema=j}};e.TypeCompilerUnknownTypeError=A;var S=class extends a.TypeBoxError{constructor(j){super("Preflight validation check failed to guard for the given schema"),this.schema=j}};e.TypeCompilerTypeGuardError=S;var z;(function(j){function M(W,he,P){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${he}' in ${W} ? ${P} : true)`:`(${l.Encode(W,he)} !== undefined ? ${P} : true)`}j.IsExactOptionalProperty=M;function K(W){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${W} === 'object' && ${W} !== null)`:`(typeof ${W} === 'object' && ${W} !== null && !Array.isArray(${W}))`}j.IsObjectLike=K;function H(W){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${W} === 'object' && ${W} !== null && !(${W} instanceof Date) && !(${W} instanceof Uint8Array))`:`(typeof ${W} === 'object' && ${W} !== null && !Array.isArray(${W}) && !(${W} instanceof Date) && !(${W} instanceof Uint8Array))`}j.IsRecordLike=H;function V(W){return i.TypeSystemPolicy.AllowNaN?`typeof ${W} === 'number'`:`(typeof ${W} === 'number' && Number.isFinite(${W}))`}j.IsNumberLike=V;function ee(W){return i.TypeSystemPolicy.AllowNullVoid?`(${W} === undefined || ${W} === null)`:`${W} === undefined`}j.IsVoidLike=ee})(z||(e.Policy=z={}));var X;(function(j){function M(E){return E[a.Kind]==="Any"||E[a.Kind]==="Unknown"}function*K(E,pe,R){yield"true"}function*H(E,pe,R){yield`Array.isArray(${R})`;let[_e,ie]=[Ge("value","any"),Ge("acc","number")];(0,r.IsNumber)(E.maxItems)&&(yield`${R}.length <= ${E.maxItems}`),(0,r.IsNumber)(E.minItems)&&(yield`${R}.length >= ${E.minItems}`);let ye=ne(E.items,pe,"value");if(yield`${R}.every((${_e}) => ${ye})`,a.TypeGuard.TSchema(E.contains)||(0,r.IsNumber)(E.minContains)||(0,r.IsNumber)(E.maxContains)){let $e=a.TypeGuard.TSchema(E.contains)?E.contains:a.Type.Never(),qe=ne($e,pe,"value"),ut=(0,r.IsNumber)(E.minContains)?[`(count >= ${E.minContains})`]:[],ot=(0,r.IsNumber)(E.maxContains)?[`(count <= ${E.maxContains})`]:[],ft=`const count = value.reduce((${ie}, ${_e}) => ${qe} ? acc + 1 : acc, 0)`,gr=["(count > 0)",...ut,...ot].join(" && ");yield`((${_e}) => { ${ft}; return ${gr}})(${R})`}E.uniqueItems===!0&&(yield`((${_e}) => { 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 } )(${R})`)}function*V(E,pe,R){yield`(typeof value === 'object' && Symbol.asyncIterator in ${R})`}function*ee(E,pe,R){yield`(typeof ${R} === 'bigint')`,(0,r.IsBigInt)(E.exclusiveMaximum)&&(yield`${R} < BigInt(${E.exclusiveMaximum})`),(0,r.IsBigInt)(E.exclusiveMinimum)&&(yield`${R} > BigInt(${E.exclusiveMinimum})`),(0,r.IsBigInt)(E.maximum)&&(yield`${R} <= BigInt(${E.maximum})`),(0,r.IsBigInt)(E.minimum)&&(yield`${R} >= BigInt(${E.minimum})`),(0,r.IsBigInt)(E.multipleOf)&&(yield`(${R} % BigInt(${E.multipleOf})) === 0`)}function*W(E,pe,R){yield`(typeof ${R} === 'boolean')`}function*he(E,pe,R){yield*G(E.returns,pe,`${R}.prototype`)}function*P(E,pe,R){yield`(${R} instanceof Date) && Number.isFinite(${R}.getTime())`,(0,r.IsNumber)(E.exclusiveMaximumTimestamp)&&(yield`${R}.getTime() < ${E.exclusiveMaximumTimestamp}`),(0,r.IsNumber)(E.exclusiveMinimumTimestamp)&&(yield`${R}.getTime() > ${E.exclusiveMinimumTimestamp}`),(0,r.IsNumber)(E.maximumTimestamp)&&(yield`${R}.getTime() <= ${E.maximumTimestamp}`),(0,r.IsNumber)(E.minimumTimestamp)&&(yield`${R}.getTime() >= ${E.minimumTimestamp}`),(0,r.IsNumber)(E.multipleOfTimestamp)&&(yield`(${R}.getTime() % ${E.multipleOfTimestamp}) === 0`)}function*B(E,pe,R){yield`(typeof ${R} === 'function')`}function*F(E,pe,R){yield`(typeof ${R} === 'number' && Number.isInteger(${R}))`,(0,r.IsNumber)(E.exclusiveMaximum)&&(yield`${R} < ${E.exclusiveMaximum}`),(0,r.IsNumber)(E.exclusiveMinimum)&&(yield`${R} > ${E.exclusiveMinimum}`),(0,r.IsNumber)(E.maximum)&&(yield`${R} <= ${E.maximum}`),(0,r.IsNumber)(E.minimum)&&(yield`${R} >= ${E.minimum}`),(0,r.IsNumber)(E.multipleOf)&&(yield`(${R} % ${E.multipleOf}) === 0`)}function*te(E,pe,R){let _e=E.allOf.map(ie=>ne(ie,pe,R)).join(" && ");if(E.unevaluatedProperties===!1){let ie=Ae(`${new RegExp(a.KeyResolver.ResolvePattern(E))};`),ye=`Object.getOwnPropertyNames(${R}).every(key => ${ie}.test(key))`;yield`(${_e} && ${ye})`}else if(a.TypeGuard.TSchema(E.unevaluatedProperties)){let ie=Ae(`${new RegExp(a.KeyResolver.ResolvePattern(E))};`),ye=`Object.getOwnPropertyNames(${R}).every(key => ${ie}.test(key) || ${ne(E.unevaluatedProperties,pe,`${R}[key]`)})`;yield`(${_e} && ${ye})`}else yield`(${_e})`}function*ue(E,pe,R){yield`(typeof value === 'object' && Symbol.iterator in ${R})`}function*Z(E,pe,R){typeof E.const=="number"||typeof E.const=="boolean"?yield`(${R} === ${E.const})`:yield`(${R} === '${C.Escape(E.const)}')`}function*fe(E,pe,R){yield"false"}function*D(E,pe,R){yield`(!${ne(E.not,pe,R)})`}function*J(E,pe,R){yield`(${R} === null)`}function*Q(E,pe,R){yield z.IsNumberLike(R),(0,r.IsNumber)(E.exclusiveMaximum)&&(yield`${R} < ${E.exclusiveMaximum}`),(0,r.IsNumber)(E.exclusiveMinimum)&&(yield`${R} > ${E.exclusiveMinimum}`),(0,r.IsNumber)(E.maximum)&&(yield`${R} <= ${E.maximum}`),(0,r.IsNumber)(E.minimum)&&(yield`${R} >= ${E.minimum}`),(0,r.IsNumber)(E.multipleOf)&&(yield`(${R} % ${E.multipleOf}) === 0`)}function*me(E,pe,R){yield z.IsObjectLike(R),(0,r.IsNumber)(E.minProperties)&&(yield`Object.getOwnPropertyNames(${R}).length >= ${E.minProperties}`),(0,r.IsNumber)(E.maxProperties)&&(yield`Object.getOwnPropertyNames(${R}).length <= ${E.maxProperties}`);let _e=Object.getOwnPropertyNames(E.properties);for(let ie of _e){let ye=l.Encode(R,ie),$e=E.properties[ie];if(E.required&&E.required.includes(ie))yield*G($e,pe,ye),(a.ExtendsUndefined.Check($e)||M($e))&&(yield`('${ie}' in ${R})`);else{let qe=ne($e,pe,ye);yield z.IsExactOptionalProperty(R,ie,qe)}}if(E.additionalProperties===!1)if(E.required&&E.required.length===_e.length)yield`Object.getOwnPropertyNames(${R}).length === ${_e.length}`;else{let ie=`[${_e.map(ye=>`'${ye}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${R}).every(key => ${ie}.includes(key))`}if(typeof E.additionalProperties=="object"){let ie=ne(E.additionalProperties,pe,`${R}[key]`),ye=`[${_e.map($e=>`'${$e}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${R}).every(key => ${ye}.includes(key) || ${ie}))`}}function*d(E,pe,R){yield`(typeof value === 'object' && typeof ${R}.then === 'function')`}function*_(E,pe,R){yield z.IsRecordLike(R),(0,r.IsNumber)(E.minProperties)&&(yield`Object.getOwnPropertyNames(${R}).length >= ${E.minProperties}`),(0,r.IsNumber)(E.maxProperties)&&(yield`Object.getOwnPropertyNames(${R}).length <= ${E.maxProperties}`);let[_e,ie]=Object.entries(E.patternProperties)[0],ye=Ae(`${new RegExp(_e)}`),$e=ne(ie,pe,"value"),qe=a.TypeGuard.TSchema(E.additionalProperties)?ne(E.additionalProperties,pe,R):E.additionalProperties===!1?"false":"true",ut=`(${ye}.test(key) ? ${$e} : ${qe})`;yield`(Object.entries(${R}).every(([key, value]) => ${ut}))`}function*I(E,pe,R){let _e=(0,o.Deref)(E,pe);if(re.functions.has(E.$ref))return yield`${ve(E.$ref)}(${R})`;yield*G(_e,pe,R)}function*U(E,pe,R){yield`(typeof ${R} === 'string')`,(0,r.IsNumber)(E.maxLength)&&(yield`${R}.length <= ${E.maxLength}`),(0,r.IsNumber)(E.minLength)&&(yield`${R}.length >= ${E.minLength}`),E.pattern!==void 0&&(yield`${Ae(`${new RegExp(E.pattern)};`)}.test(${R})`),E.format!==void 0&&(yield`format('${E.format}', ${R})`)}function*$(E,pe,R){yield`(typeof ${R} === 'symbol')`}function*x(E,pe,R){yield`(typeof ${R} === 'string')`,yield`${Ae(`${new RegExp(E.pattern)};`)}.test(${R})`}function*g(E,pe,R){yield`${ve(E.$ref)}(${R})`}function*T(E,pe,R){if(yield`Array.isArray(${R})`,E.items===void 0)return yield`${R}.length === 0`;yield`(${R}.length === ${E.maxItems})`;for(let _e=0;_e<E.items.length;_e++)yield`${ne(E.items[_e],pe,`${R}[${_e}]`)}`}function*w(E,pe,R){yield`${R} === undefined`}function*c(E,pe,R){yield`(${E.anyOf.map(ie=>ne(ie,pe,R)).join(" || ")})`}function*O(E,pe,R){yield`${R} instanceof Uint8Array`,(0,r.IsNumber)(E.maxByteLength)&&(yield`(${R}.length <= ${E.maxByteLength})`),(0,r.IsNumber)(E.minByteLength)&&(yield`(${R}.length >= ${E.minByteLength})`)}function*v(E,pe,R){yield"true"}function*b(E,pe,R){yield z.IsVoidLike(R)}function*N(E,pe,R){let _e=re.instances.size;re.instances.set(_e,E),yield`kind('${E[a.Kind]}', ${_e}, ${R})`}function*G(E,pe,R,_e=!0){let ie=(0,r.IsString)(E.$id)?[...pe,E]:pe,ye=E;if(_e&&(0,r.IsString)(E.$id)){let $e=ve(E.$id);if(re.functions.has($e))return yield`${$e}(${R})`;{let qe=Le($e,E,pe,"value",!1);return re.functions.set($e,qe),yield`${$e}(${R})`}}switch(ye[a.Kind]){case"Any":return yield*K(ye,ie,R);case"Array":return yield*H(ye,ie,R);case"AsyncIterator":return yield*V(ye,ie,R);case"BigInt":return yield*ee(ye,ie,R);case"Boolean":return yield*W(ye,ie,R);case"Constructor":return yield*he(ye,ie,R);case"Date":return yield*P(ye,ie,R);case"Function":return yield*B(ye,ie,R);case"Integer":return yield*F(ye,ie,R);case"Intersect":return yield*te(ye,ie,R);case"Iterator":return yield*ue(ye,ie,R);case"Literal":return yield*Z(ye,ie,R);case"Never":return yield*fe(ye,ie,R);case"Not":return yield*D(ye,ie,R);case"Null":return yield*J(ye,ie,R);case"Number":return yield*Q(ye,ie,R);case"Object":return yield*me(ye,ie,R);case"Promise":return yield*d(ye,ie,R);case"Record":return yield*_(ye,ie,R);case"Ref":return yield*I(ye,ie,R);case"String":return yield*U(ye,ie,R);case"Symbol":return yield*$(ye,ie,R);case"TemplateLiteral":return yield*x(ye,ie,R);case"This":return yield*g(ye,ie,R);case"Tuple":return yield*T(ye,ie,R);case"Undefined":return yield*w(ye,ie,R);case"Union":return yield*c(ye,ie,R);case"Uint8Array":return yield*O(ye,ie,R);case"Unknown":return yield*v(ye,ie,R);case"Void":return yield*b(ye,ie,R);default:if(!a.TypeRegistry.Has(ye[a.Kind]))throw new A(E);return yield*N(ye,ie,R)}}let re={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function ne(E,pe,R,_e=!0){return`(${[...G(E,pe,R,_e)].join(" && ")})`}function ve(E){return`check_${p.Encode(E)}`}function Ae(E){let pe=`local_${re.variables.size}`;return re.variables.set(pe,`const ${pe} = ${E}`),pe}function Le(E,pe,R,_e,ie=!0){let[ye,$e]=[`
|
|
49
|
+
`,ft=>"".padStart(ft," ")],qe=Ge("value","any"),ut=Qr("boolean"),ot=[...G(pe,R,_e,ie)].map(ft=>`${$e(4)}${ft}`).join(` &&${ye}`);return`function ${E}(${qe})${ut} {${ye}${$e(2)}return (${ye}${ot}${ye}${$e(2)})
|
|
50
|
+
}`}function Ge(E,pe){let R=re.language==="typescript"?`: ${pe}`:"";return`${E}${R}`}function Qr(E){return re.language==="typescript"?`: ${E}`:""}function Oe(E,pe,R){let _e=Le("check",E,pe,"value"),ie=Ge("value","any"),ye=Qr("boolean"),$e=[...re.functions.values()],qe=[...re.variables.values()],ut=(0,r.IsString)(E.$id)?`return function check(${ie})${ye} {
|
|
51
|
+
return ${ve(E.$id)}(value)
|
|
52
|
+
}`:`return ${_e}`;return[...qe,...$e,ut].join(`
|
|
53
|
+
`)}function Nr(...E){let pe={language:"javascript"},[R,_e,ie]=E.length===2&&(0,r.IsArray)(E[1])?[E[0],E[1],pe]:E.length===2&&!(0,r.IsArray)(E[1])?[E[0],[],E[1]]:E.length===3?[E[0],E[1],E[2]]:E.length===1?[E[0],[],pe]:[null,[],pe];if(re.language=ie.language,re.variables.clear(),re.functions.clear(),re.instances.clear(),!a.TypeGuard.TSchema(R))throw new S(R);for(let ye of _e)if(!a.TypeGuard.TSchema(ye))throw new S(ye);return Oe(R,_e,ie)}j.Code=Nr;function Zr(E,pe=[]){let R=Nr(E,pe,{language:"javascript"}),_e=globalThis.Function("kind","format","hash",R),ie=new Map(re.instances);function ye(ot,ft,gr){if(!a.TypeRegistry.Has(ot)||!ie.has(ft))return!1;let Bn=a.TypeRegistry.Get(ot),kn=ie.get(ft);return Bn(kn,gr)}function $e(ot,ft){return a.FormatRegistry.Has(ot)?a.FormatRegistry.Get(ot)(ft):!1}function qe(ot){return(0,s.Hash)(ot)}let ut=_e(ye,$e,qe);return new u(E,pe,ut,R)}j.Compile=Zr})(X||(e.TypeCompiler=X={}))}}),kv=ze({"../../../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=$v();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),Object.defineProperty(e,"ValueErrorIterator",{enumerable:!0,get:function(){return n.ValueErrorIterator}}),r(Bv(),e)}}),ws=Ft(Cv(),1),Mv=Ft(Nv(),1),Up=!1,Bp=!1;ws.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(Up=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(Bp=process?.env?.LOGGER_PERF_PREFIX==="true"));var Dv={prefix:void 0,time:Up,delta:Bp,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},bu=[],kp=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(",")}]`}},Mp=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},Ji=!1,Pe=class pt{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=pt.INFO,r={}){r=Object.assign({},Dv,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,f)=>{function l(...C){let A=C[C.length-1];return A===i?A():(o(...C.slice(0,-1)),(async()=>{try{let S=A();return S instanceof Promise?await S:S}finally{console.groupEnd()}})())}let p=Object.assign(f.bind({}),{isEnabled:u,isDisabled:!u,group:l,force:f});return u?p:Object.assign(i.bind({}),{isEnabled:u,isDisabled:!u,group:l,force:p})},a=s(t>=pt.ERROR,this.wrapLog(console.error,r));return{ERROR:(...u)=>(a(...u),new Error(u.map(f=>typeof f=="string"?f:(0,Mv.default)(f)).join(" "))),WARN:s(t>=pt.WARN,this.wrapLog(console.warn,r)),LOG:s(t>=pt.INFO,this.wrapLog(console.log,r)),DEBUG:s(t>=pt.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:s(t>=pt.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(t,r){if(ws.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=ws.isBrowser&&navigator.userAgent.includes("Chrome")?["",pt.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(Ji?n.push(new Mp("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();pt.firstLog||(pt.firstLog=i,pt.lastLog=i);let o=new kp(i-pt.firstLog,i-pt.lastLog,t,r);return pt.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}}}};ws.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(bu&&bu.length){for(let t of bu)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof kp))return null;Ji||(Ji=!0);let t=Pe.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof Mp?(Ji||(Ji=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var Lv=typeof global=="object"&&global&&global.Object===Object&&global,Dp=Lv,jv=typeof self=="object"&&self&&self.Object===Object&&self,Fv=Dp||jv||Function("return this")(),Et=Fv,Vv=Et.Symbol,dr=Vv,Lp=Object.prototype,zv=Lp.hasOwnProperty,qv=Lp.toString,Gi=dr?dr.toStringTag:void 0;function Kv(e){var t=zv.call(e,Gi),r=e[Gi];try{e[Gi]=void 0;var n=!0}catch{}var i=qv.call(e);return n&&(t?e[Gi]=r:delete e[Gi]),i}var Gv=Kv,Wv=Object.prototype,Hv=Wv.toString;function Jv(e){return Hv.call(e)}var Xv=Jv,Yv="[object Null]",Qv="[object Undefined]",Ed=dr?dr.toStringTag:void 0;function Zv(e){return e==null?e===void 0?Qv:Yv:Ed&&Ed in Object(e)?Gv(e):Xv(e)}var ii=Zv;function e_(e){return e!=null&&typeof e=="object"}var Kr=e_,t_="[object Symbol]";function r_(e){return typeof e=="symbol"||Kr(e)&&ii(e)==t_}var ri=r_;function n_(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 jp=n_,i_=Array.isArray,ir=i_,o_=1/0,Id=dr?dr.prototype:void 0,Sd=Id?Id.toString:void 0;function Fp(e){if(typeof e=="string")return e;if(ir(e))return jp(e,Fp)+"";if(ri(e))return Sd?Sd.call(e):"";var t=e+"";return t=="0"&&1/e==-o_?"-0":t}var s_=Fp,a_=/\s/;function u_(e){for(var t=e.length;t--&&a_.test(e.charAt(t)););return t}var c_=u_,f_=/^\s+/;function l_(e){return e&&e.slice(0,c_(e)+1).replace(f_,"")}var d_=l_;function p_(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Or=p_,xd=NaN,h_=/^[-+]0x[0-9a-f]+$/i,y_=/^0b[01]+$/i,g_=/^0o[0-7]+$/i,m_=parseInt;function b_(e){if(typeof e=="number")return e;if(ri(e))return xd;if(Or(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Or(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=d_(e);var r=y_.test(e);return r||g_.test(e)?m_(e.slice(2),r?2:8):h_.test(e)?xd:+e}var v_=b_,Cd=1/0,__=17976931348623157e292;function w_(e){if(!e)return e===0?e:0;if(e=v_(e),e===Cd||e===-Cd){var t=e<0?-1:1;return t*__}return e===e?e:0}var T_=w_;function A_(e){var t=T_(e),r=t%1;return t===t?r?t-r:t:0}var Nd=A_;function O_(e){return e}var js=O_,E_="[object AsyncFunction]",I_="[object Function]",S_="[object GeneratorFunction]",x_="[object Proxy]";function C_(e){if(!Or(e))return!1;var t=ii(e);return t==I_||t==S_||t==E_||t==x_}var Vp=C_,N_=Et["__core-js_shared__"],vu=N_,Rd=(function(){var e=/[^.]+$/.exec(vu&&vu.keys&&vu.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function R_(e){return!!Rd&&Rd in e}var $_=R_,P_=Function.prototype,U_=P_.toString;function B_(e){if(e!=null){try{return U_.call(e)}catch{}try{return e+""}catch{}}return""}var _n=B_,k_=/[\\^$.*+?()[\]{}|]/g,M_=/^\[object .+?Constructor\]$/,D_=Function.prototype,L_=Object.prototype,j_=D_.toString,F_=L_.hasOwnProperty,V_=RegExp("^"+j_.call(F_).replace(k_,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function z_(e){if(!Or(e)||$_(e))return!1;var t=Vp(e)?V_:M_;return t.test(_n(e))}var q_=z_;function K_(e,t){return e?.[t]}var G_=K_;function W_(e,t){var r=G_(e,t);return q_(r)?r:void 0}var wn=W_,H_=wn(Et,"WeakMap"),Yi=H_,J_=Yi&&new Yi,Ts=J_,X_=Ts?function(e,t){return Ts.set(e,t),e}:js,zp=X_,$d=Object.create,Y_=(function(){function e(){}return function(t){if(!Or(t))return{};if($d)return $d(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}})(),qu=Y_;function Q_(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=qu(e.prototype),n=e.apply(r,t);return Or(n)?n:r}}var Qi=Q_,Z_=1;function ew(e,t,r){var n=t&Z_,i=Qi(e);function o(){var s=this&&this!==Et&&this instanceof o?i:e;return s.apply(n?r:this,arguments)}return o}var tw=ew;function rw(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=rw,nw=Math.max;function iw(e,t,r,n){for(var i=-1,o=e.length,s=r.length,a=-1,u=t.length,f=nw(o-s,0),l=Array(u+f),p=!n;++a<u;)l[a]=t[a];for(;++i<s;)(p||i<o)&&(l[r[i]]=e[i]);for(;f--;)l[a++]=e[i++];return l}var qp=iw,ow=Math.max;function sw(e,t,r,n){for(var i=-1,o=e.length,s=-1,a=r.length,u=-1,f=t.length,l=ow(o-a,0),p=Array(l+f),C=!n;++i<l;)p[i]=e[i];for(var A=i;++u<f;)p[A+u]=t[u];for(;++s<a;)(C||i<o)&&(p[A+r[s]]=e[i++]);return p}var Kp=sw;function aw(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}var uw=aw;function cw(){}var Gu=cw,fw=4294967295;function As(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=fw,this.__views__=[]}As.prototype=qu(Gu.prototype);As.prototype.constructor=As;var Wu=As;function lw(){}var Gp=lw,dw=Ts?function(e){return Ts.get(e)}:Gp,Wp=dw,pw={},Pd=pw,hw=Object.prototype,yw=hw.hasOwnProperty;function gw(e){for(var t=e.name+"",r=Pd[t],n=yw.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 mw=gw;function Os(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}Os.prototype=qu(Gu.prototype);Os.prototype.constructor=Os;var Nu=Os;function bw(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var Hp=bw;function vw(e){if(e instanceof Wu)return e.clone();var t=new Nu(e.__wrapped__,e.__chain__);return t.__actions__=Hp(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var _w=vw,ww=Object.prototype,Tw=ww.hasOwnProperty;function Es(e){if(Kr(e)&&!ir(e)&&!(e instanceof Wu)){if(e instanceof Nu)return e;if(Tw.call(e,"__wrapped__"))return _w(e)}return new Nu(e)}Es.prototype=Gu.prototype;Es.prototype.constructor=Es;var Aw=Es;function Ow(e){var t=mw(e),r=Aw[t];if(typeof r!="function"||!(t in Wu.prototype))return!1;if(e===r)return!0;var n=Wp(r);return!!n&&e===n[0]}var Ew=Ow,Iw=800,Sw=16,xw=Date.now;function Cw(e){var t=0,r=0;return function(){var n=xw(),i=Sw-(n-r);if(r=n,i>0){if(++t>=Iw)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Jp=Cw,Nw=Jp(zp),Xp=Nw,Rw=/\{\n\/\* \[wrapped with (.+)\] \*/,$w=/,? & /;function Pw(e){var t=e.match(Rw);return t?t[1].split($w):[]}var Uw=Pw,Bw=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function kw(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(Bw,`{
|
|
55
|
+
/* [wrapped with `+t+`] */
|
|
56
|
+
`)}var Mw=kw;function Dw(e){return function(){return e}}var Lw=Dw,jw=(function(){try{var e=wn(Object,"defineProperty");return e({},"",{}),e}catch{}})(),Is=jw,Fw=Is?function(e,t){return Is(e,"toString",{configurable:!0,enumerable:!1,value:Lw(t),writable:!0})}:js,Vw=Fw,zw=Jp(Vw),Hu=zw;function qw(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var Kw=qw;function Gw(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 Ww=Gw;function Hw(e){return e!==e}var Jw=Hw;function Xw(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}var Yw=Xw;function Qw(e,t,r){return t===t?Yw(e,t,r):Ww(e,Jw,r)}var Zw=Qw;function e0(e,t){var r=e==null?0:e.length;return!!r&&Zw(e,t,0)>-1}var Yp=e0,t0=1,r0=2,n0=8,i0=16,o0=32,s0=64,a0=128,u0=256,c0=512,f0=[["ary",a0],["bind",t0],["bindKey",r0],["curry",n0],["curryRight",i0],["flip",c0],["partial",o0],["partialRight",s0],["rearg",u0]];function l0(e,t){return Kw(f0,function(r){var n="_."+r[0];t&r[1]&&!Yp(e,n)&&e.push(n)}),e.sort()}var d0=l0;function p0(e,t,r){var n=t+"";return Hu(e,Mw(n,d0(Uw(n),r)))}var Qp=p0,h0=1,y0=2,g0=4,m0=8,Ud=32,Bd=64;function b0(e,t,r,n,i,o,s,a,u,f){var l=t&m0,p=l?s:void 0,C=l?void 0:s,A=l?o:void 0,S=l?void 0:o;t|=l?Ud:Bd,t&=~(l?Bd:Ud),t&g0||(t&=~(h0|y0));var z=[e,t,i,A,p,S,C,a,u,f],X=r.apply(void 0,z);return Ew(e)&&Xp(X,z),X.placeholder=n,Qp(X,e,t)}var Zp=b0;function v0(e){var t=e;return t.placeholder}var Ju=v0,_0=9007199254740991,w0=/^(?:0|[1-9]\d*)$/;function T0(e,t){var r=typeof e;return t=t??_0,!!t&&(r=="number"||r!="symbol"&&w0.test(e))&&e>-1&&e%1==0&&e<t}var Fs=T0,A0=Math.min;function O0(e,t){for(var r=e.length,n=A0(t.length,r),i=Hp(e);n--;){var o=t[n];e[n]=Fs(o,r)?i[o]:void 0}return e}var E0=O0,kd="__lodash_placeholder__";function I0(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var s=e[r];(s===t||s===kd)&&(e[r]=kd,o[i++]=r)}return o}var Zi=I0,S0=1,x0=2,C0=8,N0=16,R0=128,$0=512;function eh(e,t,r,n,i,o,s,a,u,f){var l=t&R0,p=t&S0,C=t&x0,A=t&(C0|N0),S=t&$0,z=C?void 0:Qi(e);function X(){for(var j=arguments.length,M=Array(j),K=j;K--;)M[K]=arguments[K];if(A)var H=Ju(X),V=uw(M,H);if(n&&(M=qp(M,n,i,A)),o&&(M=Kp(M,o,s,A)),j-=V,A&&j<f){var ee=Zi(M,H);return Zp(e,t,eh,X.placeholder,r,M,ee,a,u,f-j)}var W=p?r:this,he=C?W[e]:e;return j=M.length,a?M=E0(M,a):S&&j>1&&M.reverse(),l&&u<j&&(M.length=u),this&&this!==Et&&this instanceof X&&(he=z||Qi(he)),he.apply(W,M)}return X}var th=eh;function P0(e,t,r){var n=Qi(e);function i(){for(var o=arguments.length,s=Array(o),a=o,u=Ju(i);a--;)s[a]=arguments[a];var f=o<3&&s[0]!==u&&s[o-1]!==u?[]:Zi(s,u);if(o-=f.length,o<r)return Zp(e,t,th,i.placeholder,void 0,s,f,void 0,void 0,r-o);var l=this&&this!==Et&&this instanceof i?n:e;return Ku(l,this,s)}return i}var U0=P0,B0=1;function k0(e,t,r,n){var i=t&B0,o=Qi(e);function s(){for(var a=-1,u=arguments.length,f=-1,l=n.length,p=Array(l+u),C=this&&this!==Et&&this instanceof s?o:e;++f<l;)p[f]=n[f];for(;u--;)p[f++]=arguments[++a];return Ku(C,i?r:this,p)}return s}var M0=k0,Md="__lodash_placeholder__",_u=1,D0=2,L0=4,Dd=8,Wi=128,Ld=256,j0=Math.min;function F0(e,t){var r=e[1],n=t[1],i=r|n,o=i<(_u|D0|Wi),s=n==Wi&&r==Dd||n==Wi&&r==Ld&&e[7].length<=t[8]||n==(Wi|Ld)&&t[7].length<=t[8]&&r==Dd;if(!(o||s))return e;n&_u&&(e[2]=t[2],i|=r&_u?0:L0);var a=t[3];if(a){var u=e[3];e[3]=u?qp(u,a,t[4]):a,e[4]=u?Zi(e[3],Md):t[4]}return a=t[5],a&&(u=e[5],e[5]=u?Kp(u,a,t[6]):a,e[6]=u?Zi(e[5],Md):t[6]),a=t[7],a&&(e[7]=a),n&Wi&&(e[8]=e[8]==null?t[8]:j0(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}var V0=F0,z0="Expected a function",jd=1,q0=2,wu=8,Tu=16,Au=32,Fd=64,Vd=Math.max;function K0(e,t,r,n,i,o,s,a){var u=t&q0;if(!u&&typeof e!="function")throw new TypeError(z0);var f=n?n.length:0;if(f||(t&=~(Au|Fd),n=i=void 0),s=s===void 0?s:Vd(Nd(s),0),a=a===void 0?a:Nd(a),f-=i?i.length:0,t&Fd){var l=n,p=i;n=i=void 0}var C=u?void 0:Wp(e),A=[e,t,r,n,i,l,p,o,s,a];if(C&&V0(A,C),e=A[0],t=A[1],r=A[2],n=A[3],i=A[4],a=A[9]=A[9]===void 0?u?0:e.length:Vd(A[9]-f,0),!a&&t&(wu|Tu)&&(t&=~(wu|Tu)),!t||t==jd)var S=tw(e,t,r);else t==wu||t==Tu?S=U0(e,t,a):(t==Au||t==(jd|Au))&&!i.length?S=M0(e,t,r,n):S=th.apply(void 0,A);var z=C?zp:Xp;return Qp(z(S,A),e,t)}var G0=K0;function W0(e,t,r){t=="__proto__"&&Is?Is(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var H0=W0;function J0(e,t){return e===t||e!==e&&t!==t}var Xu=J0,X0=Object.prototype,Y0=X0.hasOwnProperty;function Q0(e,t,r){var n=e[t];(!(Y0.call(e,t)&&Xu(n,r))||r===void 0&&!(t in e))&&H0(e,t,r)}var Z0=Q0,zd=Math.max;function eT(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 rh=eT;function tT(e,t){return Hu(rh(e,t,js),e+"")}var nh=tT,rT=9007199254740991;function nT(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=rT}var Yu=nT;function iT(e){return e!=null&&Yu(e.length)&&!Vp(e)}var ih=iT,oT=Object.prototype;function sT(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||oT;return e===r}var aT=sT;function uT(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var cT=uT,fT="[object Arguments]";function lT(e){return Kr(e)&&ii(e)==fT}var qd=lT,oh=Object.prototype,dT=oh.hasOwnProperty,pT=oh.propertyIsEnumerable,hT=qd((function(){return arguments})())?qd:function(e){return Kr(e)&&dT.call(e,"callee")&&!pT.call(e,"callee")},Qu=hT;function yT(){return!1}var gT=yT,sh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Kd=sh&&typeof module=="object"&&module&&!module.nodeType&&module,mT=Kd&&Kd.exports===sh,Gd=mT?Et.Buffer:void 0,bT=Gd?Gd.isBuffer:void 0,vT=bT||gT,Ru=vT,_T="[object Arguments]",wT="[object Array]",TT="[object Boolean]",AT="[object Date]",OT="[object Error]",ET="[object Function]",IT="[object Map]",ST="[object Number]",xT="[object Object]",CT="[object RegExp]",NT="[object Set]",RT="[object String]",$T="[object WeakMap]",PT="[object ArrayBuffer]",UT="[object DataView]",BT="[object Float32Array]",kT="[object Float64Array]",MT="[object Int8Array]",DT="[object Int16Array]",LT="[object Int32Array]",jT="[object Uint8Array]",FT="[object Uint8ClampedArray]",VT="[object Uint16Array]",zT="[object Uint32Array]",je={};je[BT]=je[kT]=je[MT]=je[DT]=je[LT]=je[jT]=je[FT]=je[VT]=je[zT]=!0;je[_T]=je[wT]=je[PT]=je[TT]=je[UT]=je[AT]=je[OT]=je[ET]=je[IT]=je[ST]=je[xT]=je[CT]=je[NT]=je[RT]=je[$T]=!1;function qT(e){return Kr(e)&&Yu(e.length)&&!!je[ii(e)]}var KT=qT;function GT(e){return function(t){return e(t)}}var ah=GT,uh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Xi=uh&&typeof module=="object"&&module&&!module.nodeType&&module,WT=Xi&&Xi.exports===uh,Ou=WT&&Dp.process,HT=(function(){try{var e=Xi&&Xi.require&&Xi.require("util").types;return e||Ou&&Ou.binding&&Ou.binding("util")}catch{}})(),Wd=HT,Hd=Wd&&Wd.isTypedArray,JT=Hd?ah(Hd):KT,ch=JT,XT=Object.prototype,YT=XT.hasOwnProperty;function QT(e,t){var r=ir(e),n=!r&&Qu(e),i=!r&&!n&&Ru(e),o=!r&&!n&&!i&&ch(e),s=r||n||i||o,a=s?cT(e.length,String):[],u=a.length;for(var f in e)(t||YT.call(e,f))&&!(s&&(f=="length"||i&&(f=="offset"||f=="parent")||o&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Fs(f,u)))&&a.push(f);return a}var ZT=QT;function e1(e,t){return function(r){return e(t(r))}}var t1=e1,r1=t1(Object.keys,Object),n1=r1,i1=Object.prototype,o1=i1.hasOwnProperty;function s1(e){if(!aT(e))return n1(e);var t=[];for(var r in Object(e))o1.call(e,r)&&r!="constructor"&&t.push(r);return t}var a1=s1;function u1(e){return ih(e)?ZT(e):a1(e)}var fh=u1,c1=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,f1=/^\w*$/;function l1(e,t){if(ir(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||ri(e)?!0:f1.test(e)||!c1.test(e)||t!=null&&e in Object(t)}var Zu=l1,d1=wn(Object,"create"),eo=d1;function p1(){this.__data__=eo?eo(null):{},this.size=0}var h1=p1;function y1(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var g1=y1,m1="__lodash_hash_undefined__",b1=Object.prototype,v1=b1.hasOwnProperty;function _1(e){var t=this.__data__;if(eo){var r=t[e];return r===m1?void 0:r}return v1.call(t,e)?t[e]:void 0}var w1=_1,T1=Object.prototype,A1=T1.hasOwnProperty;function O1(e){var t=this.__data__;return eo?t[e]!==void 0:A1.call(t,e)}var E1=O1,I1="__lodash_hash_undefined__";function S1(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=eo&&t===void 0?I1:t,this}var x1=S1;function oi(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])}}oi.prototype.clear=h1;oi.prototype.delete=g1;oi.prototype.get=w1;oi.prototype.has=E1;oi.prototype.set=x1;var Jd=oi;function C1(){this.__data__=[],this.size=0}var N1=C1;function R1(e,t){for(var r=e.length;r--;)if(Xu(e[r][0],t))return r;return-1}var Vs=R1,$1=Array.prototype,P1=$1.splice;function U1(e){var t=this.__data__,r=Vs(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():P1.call(t,r,1),--this.size,!0}var B1=U1;function k1(e){var t=this.__data__,r=Vs(t,e);return r<0?void 0:t[r][1]}var M1=k1;function D1(e){return Vs(this.__data__,e)>-1}var L1=D1;function j1(e,t){var r=this.__data__,n=Vs(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var F1=j1;function si(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])}}si.prototype.clear=N1;si.prototype.delete=B1;si.prototype.get=M1;si.prototype.has=L1;si.prototype.set=F1;var zs=si,V1=wn(Et,"Map"),to=V1;function z1(){this.size=0,this.__data__={hash:new Jd,map:new(to||zs),string:new Jd}}var q1=z1;function K1(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var G1=K1;function W1(e,t){var r=e.__data__;return G1(t)?r[typeof t=="string"?"string":"hash"]:r.map}var qs=W1;function H1(e){var t=qs(this,e).delete(e);return this.size-=t?1:0,t}var J1=H1;function X1(e){return qs(this,e).get(e)}var Y1=X1;function Q1(e){return qs(this,e).has(e)}var Z1=Q1;function eA(e,t){var r=qs(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var tA=eA;function ai(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])}}ai.prototype.clear=q1;ai.prototype.delete=J1;ai.prototype.get=Y1;ai.prototype.has=Z1;ai.prototype.set=tA;var Ks=ai,rA="Expected a function";function ec(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(rA);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(ec.Cache||Ks),r}ec.Cache=Ks;var nA=ec,iA=500;function oA(e){var t=nA(e,function(n){return r.size===iA&&r.clear(),n}),r=t.cache;return t}var sA=oA,aA=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,uA=/\\(\\)?/g,cA=sA(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(aA,function(r,n,i,o){t.push(i?o.replace(uA,"$1"):n||r)}),t}),fA=cA;function lA(e){return e==null?"":s_(e)}var dA=lA;function pA(e,t){return ir(e)?e:Zu(e,t)?[e]:fA(dA(e))}var Gs=pA,hA=1/0;function yA(e){if(typeof e=="string"||ri(e))return e;var t=e+"";return t=="0"&&1/e==-hA?"-0":t}var io=yA;function gA(e,t){t=Gs(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[io(t[r++])];return r&&r==n?e:void 0}var tc=gA;function mA(e,t,r){var n=e==null?void 0:tc(e,t);return n===void 0?r:n}var bA=mA;function vA(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var lh=vA,Xd=dr?dr.isConcatSpreadable:void 0;function _A(e){return ir(e)||Qu(e)||!!(Xd&&e&&e[Xd])}var wA=_A;function dh(e,t,r,n,i){var o=-1,s=e.length;for(r||(r=wA),i||(i=[]);++o<s;){var a=e[o];t>0&&r(a)?t>1?dh(a,t-1,r,n,i):lh(i,a):n||(i[i.length]=a)}return i}var TA=dh;function AA(e){var t=e==null?0:e.length;return t?TA(e,1):[]}var OA=AA;function EA(e){return Hu(rh(e,void 0,OA),e+"")}var IA=EA;function SA(){this.__data__=new zs,this.size=0}var xA=SA;function CA(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var NA=CA;function RA(e){return this.__data__.get(e)}var $A=RA;function PA(e){return this.__data__.has(e)}var UA=PA,BA=200;function kA(e,t){var r=this.__data__;if(r instanceof zs){var n=r.__data__;if(!to||n.length<BA-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ks(n)}return r.set(e,t),this.size=r.size,this}var MA=kA;function ui(e){var t=this.__data__=new zs(e);this.size=t.size}ui.prototype.clear=xA;ui.prototype.delete=NA;ui.prototype.get=$A;ui.prototype.has=UA;ui.prototype.set=MA;var ys=ui;function DA(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 LA=DA;function jA(){return[]}var FA=jA,VA=Object.prototype,zA=VA.propertyIsEnumerable,Yd=Object.getOwnPropertySymbols,qA=Yd?function(e){return e==null?[]:(e=Object(e),LA(Yd(e),function(t){return zA.call(e,t)}))}:FA,KA=qA;function GA(e,t,r){var n=t(e);return ir(e)?n:lh(n,r(e))}var WA=GA;function HA(e){return WA(e,fh,KA)}var Qd=HA,JA=wn(Et,"DataView"),$u=JA,XA=wn(Et,"Promise"),Pu=XA,YA=wn(Et,"Set"),ti=YA,Zd="[object Map]",QA="[object Object]",ep="[object Promise]",tp="[object Set]",rp="[object WeakMap]",np="[object DataView]",ZA=_n($u),eO=_n(to),tO=_n(Pu),rO=_n(ti),nO=_n(Yi),gn=ii;($u&&gn(new $u(new ArrayBuffer(1)))!=np||to&&gn(new to)!=Zd||Pu&&gn(Pu.resolve())!=ep||ti&&gn(new ti)!=tp||Yi&&gn(new Yi)!=rp)&&(gn=function(e){var t=ii(e),r=t==QA?e.constructor:void 0,n=r?_n(r):"";if(n)switch(n){case ZA:return np;case eO:return Zd;case tO:return ep;case rO:return tp;case nO:return rp}return t});var ip=gn,iO=Et.Uint8Array,op=iO,oO="__lodash_hash_undefined__";function sO(e){return this.__data__.set(e,oO),this}var aO=sO;function uO(e){return this.__data__.has(e)}var cO=uO;function Ss(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Ks;++t<r;)this.add(e[t])}Ss.prototype.add=Ss.prototype.push=aO;Ss.prototype.has=cO;var ph=Ss;function fO(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 lO=fO;function dO(e,t){return e.has(t)}var hh=dO,pO=1,hO=2;function yO(e,t,r,n,i,o){var s=r&pO,a=e.length,u=t.length;if(a!=u&&!(s&&u>a))return!1;var f=o.get(e),l=o.get(t);if(f&&l)return f==t&&l==e;var p=-1,C=!0,A=r&hO?new ph:void 0;for(o.set(e,t),o.set(t,e);++p<a;){var S=e[p],z=t[p];if(n)var X=s?n(z,S,p,t,e,o):n(S,z,p,e,t,o);if(X!==void 0){if(X)continue;C=!1;break}if(A){if(!lO(t,function(j,M){if(!hh(A,M)&&(S===j||i(S,j,r,n,o)))return A.push(M)})){C=!1;break}}else if(!(S===z||i(S,z,r,n,o))){C=!1;break}}return o.delete(e),o.delete(t),C}var yh=yO;function gO(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var mO=gO;function bO(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var gh=bO,vO=1,_O=2,wO="[object Boolean]",TO="[object Date]",AO="[object Error]",OO="[object Map]",EO="[object Number]",IO="[object RegExp]",SO="[object Set]",xO="[object String]",CO="[object Symbol]",NO="[object ArrayBuffer]",RO="[object DataView]",sp=dr?dr.prototype:void 0,Eu=sp?sp.valueOf:void 0;function $O(e,t,r,n,i,o,s){switch(r){case RO:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case NO:return!(e.byteLength!=t.byteLength||!o(new op(e),new op(t)));case wO:case TO:case EO:return Xu(+e,+t);case AO:return e.name==t.name&&e.message==t.message;case IO:case xO:return e==t+"";case OO:var a=mO;case SO:var u=n&vO;if(a||(a=gh),e.size!=t.size&&!u)return!1;var f=s.get(e);if(f)return f==t;n|=_O,s.set(e,t);var l=yh(a(e),a(t),n,i,o,s);return s.delete(e),l;case CO:if(Eu)return Eu.call(e)==Eu.call(t)}return!1}var PO=$O,UO=1,BO=Object.prototype,kO=BO.hasOwnProperty;function MO(e,t,r,n,i,o){var s=r&UO,a=Qd(e),u=a.length,f=Qd(t),l=f.length;if(u!=l&&!s)return!1;for(var p=u;p--;){var C=a[p];if(!(s?C in t:kO.call(t,C)))return!1}var A=o.get(e),S=o.get(t);if(A&&S)return A==t&&S==e;var z=!0;o.set(e,t),o.set(t,e);for(var X=s;++p<u;){C=a[p];var j=e[C],M=t[C];if(n)var K=s?n(M,j,C,t,e,o):n(j,M,C,e,t,o);if(!(K===void 0?j===M||i(j,M,r,n,o):K)){z=!1;break}X||(X=C=="constructor")}if(z&&!X){var H=e.constructor,V=t.constructor;H!=V&&"constructor"in e&&"constructor"in t&&!(typeof H=="function"&&H instanceof H&&typeof V=="function"&&V instanceof V)&&(z=!1)}return o.delete(e),o.delete(t),z}var DO=MO,LO=1,ap="[object Arguments]",up="[object Array]",hs="[object Object]",jO=Object.prototype,cp=jO.hasOwnProperty;function FO(e,t,r,n,i,o){var s=ir(e),a=ir(t),u=s?up:ip(e),f=a?up:ip(t);u=u==ap?hs:u,f=f==ap?hs:f;var l=u==hs,p=f==hs,C=u==f;if(C&&Ru(e)){if(!Ru(t))return!1;s=!0,l=!1}if(C&&!l)return o||(o=new ys),s||ch(e)?yh(e,t,r,n,i,o):PO(e,t,u,r,n,i,o);if(!(r&LO)){var A=l&&cp.call(e,"__wrapped__"),S=p&&cp.call(t,"__wrapped__");if(A||S){var z=A?e.value():e,X=S?t.value():t;return o||(o=new ys),i(z,X,r,n,o)}}return C?(o||(o=new ys),DO(e,t,r,n,i,o)):!1}var VO=FO;function mh(e,t,r,n,i){return e===t?!0:e==null||t==null||!Kr(e)&&!Kr(t)?e!==e&&t!==t:VO(e,t,r,n,mh,i)}var bh=mh,zO=1,qO=2;function KO(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],f=e[u],l=a[1];if(s&&a[2]){if(f===void 0&&!(u in e))return!1}else{var p=new ys;if(n)var C=n(f,l,u,e,t,p);if(!(C===void 0?bh(l,f,zO|qO,n,p):C))return!1}}return!0}var GO=KO;function WO(e){return e===e&&!Or(e)}var vh=WO;function HO(e){for(var t=fh(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,vh(i)]}return t}var JO=HO;function XO(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var _h=XO;function YO(e){var t=JO(e);return t.length==1&&t[0][2]?_h(t[0][0],t[0][1]):function(r){return r===e||GO(r,e,t)}}var QO=YO;function ZO(e,t){return e!=null&&t in Object(e)}var eE=ZO;function tE(e,t,r){t=Gs(t,e);for(var n=-1,i=t.length,o=!1;++n<i;){var s=io(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&&Yu(i)&&Fs(s,i)&&(ir(e)||Qu(e)))}var rE=tE;function nE(e,t){return e!=null&&rE(e,t,eE)}var wh=nE,iE=1,oE=2;function sE(e,t){return Zu(e)&&vh(t)?_h(io(e),t):function(r){var n=bA(r,e);return n===void 0&&n===t?wh(r,e):bh(t,n,iE|oE)}}var aE=sE;function uE(e){return function(t){return t?.[e]}}var cE=uE;function fE(e){return function(t){return tc(t,e)}}var lE=fE;function dE(e){return Zu(e)?cE(io(e)):lE(e)}var pE=dE;function hE(e){return typeof e=="function"?e:e==null?js:typeof e=="object"?ir(e)?aE(e[0],e[1]):QO(e):pE(e)}var yE=hE;function gE(e){return Kr(e)&&ih(e)}var mE=gE;function bE(e,t,r){for(var n=-1,i=e==null?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}var vE=bE,_E=200;function wE(e,t,r,n){var i=-1,o=Yp,s=!0,a=e.length,u=[],f=t.length;if(!a)return u;r&&(t=jp(t,ah(r))),n?(o=vE,s=!1):t.length>=_E&&(o=hh,s=!1,t=new ph(t));e:for(;++i<a;){var l=e[i],p=r==null?l:r(l);if(l=n||l!==0?l:0,s&&p===p){for(var C=f;C--;)if(t[C]===p)continue e;u.push(l)}else o(t,p,n)||u.push(l)}return u}var TE=wE;function AE(e,t,r,n){if(!Or(e))return e;t=Gs(t,e);for(var i=-1,o=t.length,s=o-1,a=e;a!=null&&++i<o;){var u=io(t[i]),f=r;if(u==="__proto__"||u==="constructor"||u==="prototype")return e;if(i!=s){var l=a[u];f=n?n(l,u,a):void 0,f===void 0&&(f=Or(l)?l:Fs(t[i+1])?[]:{})}Z0(a,u,f),a=a[u]}return e}var OE=AE;function EE(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var s=t[n],a=tc(e,s);r(a,s)&&OE(o,Gs(s,e),a)}return o}var IE=EE,SE=32,rc=nh(function(e,t){var r=Zi(t,Ju(rc));return G0(e,SE,void 0,t,r)});rc.placeholder={};var xE=rc;function CE(e,t){return IE(e,t,function(r,n){return wh(e,n)})}var NE=CE,RE=IA(function(e,t){return e==null?{}:NE(e,t)}),fp=RE,$E=4294967295,PE=$E-1,UE=Math.floor,BE=Math.min;function kE(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=ri(t),f=t===void 0;i<o;){var l=UE((i+o)/2),p=r(e[l]),C=p!==void 0,A=p===null,S=p===p,z=ri(p);if(s)var X=n||S;else f?X=S&&(n||C):a?X=S&&C&&(n||!A):u?X=S&&C&&!A&&(n||!z):A||z?X=!1:X=n?p<=t:p<t;X?i=l+1:o=l}return BE(o,PE)}var ME=kE;function DE(e,t,r){return ME(e,t,yE(r,2))}var LE=DE,jE=1/0,WP=ti&&1/gh(new ti([,-0]))[1]==jE?function(e){return new ti(e)}:Gp;var FE=nh(function(e,t){return mE(e)?TE(e,t):[]}),lp=FE,Th=Ft(Rv(),1),HP=Th.default.configure,bn=Th.default,Iu=100,{WARN:VE,LOG:JP,DEBUG:Xe,VERBOSE:Ee,ERROR:XP}=Pe.setup(Pe.INFO),xs=Me.set();dd({enforceActions:"always"});if(!new class{xyz}().hasOwnProperty("xyz"))throw new Error("Transpiler is not configured correctly");var et=({caller:e,thread:t,pattern:r,args:n})=>ke(()=>(n=n||r,`${!Array.isArray(t)&&t?.name?t.name+" | ":""}${e??"caller?"}${n?`{${typeof n=="string"?n:bn(n)}}`:""}`));function Ah(e,t){return ke(()=>We.structural(e.get(),t.get()))}function ci(e,t){return We.shallow(e.applogs,t.applogs)}function Ws(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(Ee.isEnabled&&Ee("queryNodesComparer",r,n,i),!We.structural(n.variables,i.variables))return Ee.isEnabled&&Ee("[queryNodesComparer] changed vars:",r,n,i),!1;if(!ci(n.logsOfThisNode,i.logsOfThisNode))return Ee.isEnabled&&Ee("[queryNodesComparer] changed logsOfThisNode:",r,n,i),!1}return Ee.isEnabled&&Ee("[queryNodesComparer] equal:",{a:e,b:t}),!0}var zE=0;function hr(e,{name:t,equals:r}={}){let n=`observableArrayMap@${++zE}{${t}}`;Ee.isEnabled&&Ee(`[${n}] create`,{fnname:e.name,fn:e,name:t,equals:r});let i,o=Eh(e,a=>{i?ke(()=>(r??We.structural)(i,a))?Xe.isEnabled&&Xe(`[${n}] update skipped`,{updatedItems:a,observableArr:i}):(i.replace(a),Xe.isEnabled&&Xe(`[${n}] updated`,{updatedItems:a,observableArr:i})):i=Me.array(a,{deep:!1,name:t,equals:r})},{name:n});if(n.includes("useRoots")){var s=Dt(i);Xe(`[${n}] deps`,{disposeAutorun:o,rootsAtom:s,observableArr:i,observers:zi(i)}),Xn(()=>xs.add(s))}return Ee.isEnabled&&Yn(i,()=>{Ee(`[${n}] observed`,zi(i),{rootsAtom:s,observableArr:i})}),dn(i,()=>{Ee.isEnabled&&Ee(`[${n}] dispose`),s&&Xn(()=>xs.delete(s)),o()}),i}var qE=0;function Oh(e,{name:t}={}){let r=`observableSetMap@${++qE}{${t}}`;Ee.isEnabled&&Ee(`[${r}] create`,{fnname:e.name,fn:e,name:t});let n,i=Eh(e,s=>{if(!n)n=Me.set(s,{deep:!1,name:t});else{let{deleted:a,added:u}=ke(()=>{let f=new Set(n.values()),l=new Set;for(let p of s)n.has(p)?(Ee.isEnabled&&Ee(`[${r}] unchanged`,p,{updatedItems:s,observableSet:n}),f.delete(p)):l.add(p);return Xe.isEnabled&&Xe(`[${r}] updated:`,{unseen:f,added:l,updatedItems:s,observableSet:n}),{added:l,deleted:f}});for(let f of a)n.delete(f);for(let f of u)n.add(f)}},{name:r});if(r.includes("useRoots")){var o=Dt(n);Xe.isEnabled&&Xe(`[${r}] deps`,{disposeAutorun:i,rootsAtom:o,observableSet:n,observers:zi(n)}),Xn(()=>xs.add(o))}return Ee.isEnabled&&Yn(n,()=>{Ee(`[${r}] observed`,zi(n),{rootsAtom:o,observableSet:n})}),dn(n,()=>{Ee.isEnabled&&Ee(`[${r}] dispose`),o&&Xn(()=>xs.delete(o)),i()}),n}function Eh(e,t=null,{name:r}={}){Xe.isEnabled&&Xe("[autorunButAlsoImmediately] create",{fnname:e.name,fn:e,name:r});let n=`${r}.autorunImm`,i,o=new er(n,function(...f){Xe.isEnabled&&Xe(`[${n}] reaction.invalidate`,f),s()});function s(){o.track(function(){let f=Iu&&performance.now();Xe.isEnabled&&Xe(`[${n}] runAndTrack:`,{name:r??e.name,fn:e}),i=e(),Xe.isEnabled&&Xe(`[${n}] runAndTrack =>`,i),Xn(()=>{t?.(i)}),Iu&&performance.now()-f>Iu&&VE(`[${n}] took ${performance.now()-f}ms`)})}return s(),Xe.isEnabled&&Xe(`[${n}] deps of reaction`,{reaction:o,result:i,deps:Vi(o)}),()=>{Ee.isEnabled&&Ee(`[${n}] dispose`),setTimeout(()=>o.dispose())}}function nt(e,t,r=!1){if(Mr(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,f=ke(()=>{let A=a;for(let S=0;S<a.length;S++)a[S]instanceof vn&&a===A&&(A=a.slice());return A}),l=`computedFnDeepCompare(${e||t.name}#${++i})${o.argsDebugName?`{${o.argsDebugName(...a)}}`:""}`;for(let[A,S]of s.entries())if(GE(A,f)){u=S;break}else if(Ee.isEnabled)for(let z=0;z<A.length;z++)A[z]instanceof vn&&A[z].name===a[z].name&&We.structural(lp(A,A[z]),lp(f,f[z]))&&Ee.force(`[${l}] threadState mismatch => cachebust`,{diffFields:Object.keys(A[z]).filter(X=>!We.structural(A[z][X],a[z][X])),cacheArg:A[z],freshArg:a[z]});if(u){let A=u.get();return Ee.isEnabled&&Ee(`[${l}] cache hit`,{untrackedArgs:f,cachedResult:A}),A}if(!o.keepAlive&&!Hl())return!n&&Ql().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);Ee.isEnabled&&Ee(`[${l}] new computation`,{untrackedArgs:f});let p,C=Ve(()=>(Ee.isEnabled&&Ee(`[${l}] update->rerun`,ke(()=>({args:a})),t),Ee.isEnabled&&fu(),p=t.apply(this,a)),{...o,name:l});if(Ee.isEnabled&&Ee(`[${l}] deps`,Vi(C),{untrackedArgs:f}),s.set(f,C),!o.keepAlive){let A=dn(C,()=>{Ee.isEnabled&&Ee(`[${l}] dispose`,C),A(),s.delete(f),o.onCleanup&&o.onCleanup(p,...a),p=void 0})}return C.get()}}function KE(e){let t=0,r="",n=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("?r+=o+`
|
|
57
|
+
`+" ".repeat(++t):o===")"?r+=`
|
|
58
|
+
`+" ".repeat(--t)+o:o===","&&n===0?r+=o+`
|
|
59
|
+
`+" ".repeat(t):o==="{"&&n===0?(n++,r+=o+`
|
|
60
|
+
`+" ".repeat(t+1)):o==="}"&&n===1?(n--,r+=`
|
|
61
|
+
`+" ".repeat(t)+o):o==="{"&&n>0?(n++,r+=o):(o==="}"&&n>1&&n--,r+=o)}return r}function GE(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]instanceof vn){if(t[r]!==e[r])return!1}else if(!We.structural(e[r],t[r]))return!1;return!0}var{WARN:dp,LOG:YP,DEBUG:WE,VERBOSE:QP,ERROR:hn}=Pe.setup(Pe.INFO,{prefix:"[thread]"});function pr(e){return e.init!==void 0}var vn=class{constructor(e,t,r,n=[],i={}){this.name=e,this._applogs=n,this.parents=t===null?null:Od(t),this.filters=r,ke(()=>this.parents?.length===0)&&dp("[Thread] empty parents array",e),i.skipObservable||jr(this,{applogsCids:Ve,applogsByCid:Ve,insert:dt,size:Ve,isEmpty:Ve,firstLog:Ve,latestLog:Ve},{name:`Thread{${e}}`})}filters;parents;_subscribers=[];get readOnly(){return this.parents.length!==1?!0:this.parents[0].readOnly}insert(e){if(this.readOnly)throw hn("[Thread] insert() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw hn("[Thread] insert() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw hn("[Thread] insert() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insert(e)}insertRaw(e){if(this.readOnly)throw hn("[Thread] insertRaw() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw hn("[Thread] insertRaw() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw hn("[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):dp("unsubscribe called for non-existent",e)}notifySubscribers(e){WE(`[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 hn("[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 ke(()=>this.size)}get nameAndSizeUntracked(){return ke(()=>`${this.name} (${this.size})`)}get prettyName(){return KE(this.name)}get hasParents(){return!!this.parents?.length}};var nc=class Ih extends vn{static fromArray(t,r){return new Ih(r||"static",null,[],t)}constructor(t,r,n,i){super(t,r,n,i,{skipObservable:!0})}get readOnly(){return!0}},Sh={};mu(Sh,{code:()=>Wh,decode:()=>uo,encode:()=>mc,format:()=>Ap,name:()=>ix,parse:()=>sx,stringify:()=>Ap});var HE=["string","number","bigint","symbol"],JE=["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 XE(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(HE.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(YE(e))return"Buffer";let r=QE(e);return r||"Object"}function YE(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function QE(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(JE.includes(t))return t}var k=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}};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 oe=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}`}},fi=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",ZE=new TextDecoder,eI=new TextEncoder;function Cs(e){return fi&&globalThis.Buffer.isBuffer(e)}function ic(e){return e instanceof Uint8Array?Cs(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var tI=fi?((e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):hp(e,t,r)):((e,t,r)=>r-t>64?ZE.decode(e.subarray(t,r)):hp(e,t,r)),xh=fi?(e=>e.length>64?globalThis.Buffer.from(e):pp(e)):(e=>e.length>64?eI.encode(e):pp(e)),oc=fi?((e,t,r)=>Cs(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r)):((e,t,r)=>e.slice(t,r)),rI=fi?((e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),ic(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}),nI=fi?(e=>globalThis.Buffer.allocUnsafe(e)):(e=>new Uint8Array(e));function iI(e,t){if(Cs(e)&&Cs(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 pp(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 hp(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,f,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],f=e[t+3],(a&192)===128&&(u&192)===128&&(f&192)===128&&(l=(i&15)<<18|(a&63)<<12|(u&63)<<6|f&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 Ch(n)}var yp=4096;function Ch(e){let t=e.length;if(t<=yp)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=yp));return r}var oI=256,Nh=class{constructor(e=oI){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=nI(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=oc(r,0,this.cursor)}else t=rI(this.chunks,this.cursor);return e&&this.reset(),t}},be="CBOR decode error:",mn="CBOR encode error:",oo=[];oo[23]=1;oo[24]=2;oo[25]=3;oo[26]=5;oo[27]=9;function li(e,t,r){if(e.length-t<r)throw new Error(`${be} not enough data for type`)}var rt=[24,256,65536,4294967296,BigInt("18446744073709551616")];function Tn(e,t,r){li(e,t,1);let n=e[t];if(r.strict===!0&&n<rt[0])throw new Error(`${be} integer encoded in more bytes than necessary (strict decode)`);return n}function An(e,t,r){li(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<rt[1])throw new Error(`${be} integer encoded in more bytes than necessary (strict decode)`);return n}function On(e,t,r){li(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<rt[2])throw new Error(`${be} integer encoded in more bytes than necessary (strict decode)`);return n}function En(e,t,r){li(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<rt[3])throw new Error(`${be} 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(`${be} integers outside of the safe integer range are not supported`)}function sI(e,t,r,n){return new oe(k.uint,Tn(e,t+1,n),2)}function aI(e,t,r,n){return new oe(k.uint,An(e,t+1,n),3)}function uI(e,t,r,n){return new oe(k.uint,On(e,t+1,n),5)}function cI(e,t,r,n){return new oe(k.uint,En(e,t+1,n),9)}function In(e,t){return zt(e,0,t.value)}function zt(e,t,r){if(r<rt[0]){let n=Number(r);e.push([t|n])}else if(r<rt[1]){let n=Number(r);e.push([t|24,n])}else if(r<rt[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<rt[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<rt[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(`${be} encountered BigInt larger than allowable range`)}}In.encodedSize=function(t){return zt.encodedSize(t.value)};zt.encodedSize=function(t){return t<rt[0]?1:t<rt[1]?2:t<rt[2]?3:t<rt[3]?5:9};In.compareTokens=function(t,r){return t.value<r.value?-1:t.value>r.value?1:0};function fI(e,t,r,n){return new oe(k.negint,-1-Tn(e,t+1,n),2)}function lI(e,t,r,n){return new oe(k.negint,-1-An(e,t+1,n),3)}function dI(e,t,r,n){return new oe(k.negint,-1-On(e,t+1,n),5)}var sc=BigInt(-1),Rh=BigInt(1);function pI(e,t,r,n){let i=En(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new oe(k.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${be} integers outside of the safe integer range are not supported`);return new oe(k.negint,sc-BigInt(i),9)}function ac(e,t){let r=t.value,n=typeof r=="bigint"?r*sc-Rh:r*-1-1;zt(e,t.type.majorEncoded,n)}ac.encodedSize=function(t){let r=t.value,n=typeof r=="bigint"?r*sc-Rh:r*-1-1;return n<rt[0]?1:n<rt[1]?2:n<rt[2]?3:n<rt[3]?5:9};ac.compareTokens=function(t,r){return t.value<r.value?1:t.value>r.value?-1:0};function so(e,t,r,n){li(e,t,r+n);let i=oc(e,t+r,t+r+n);return new oe(k.bytes,i,r+n)}function hI(e,t,r,n){return so(e,t,1,r)}function yI(e,t,r,n){return so(e,t,2,Tn(e,t+1,n))}function gI(e,t,r,n){return so(e,t,3,An(e,t+1,n))}function mI(e,t,r,n){return so(e,t,5,On(e,t+1,n))}function bI(e,t,r,n){let i=En(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer bytes lengths not supported`);return so(e,t,9,i)}function Ns(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===k.string?xh(e.value):e.value),e.encodedBytes}function Hs(e,t){let r=Ns(t);zt(e,t.type.majorEncoded,r.length),e.push(r)}Hs.encodedSize=function(t){let r=Ns(t);return zt.encodedSize(r.length)+r.length};Hs.compareTokens=function(t,r){return vI(Ns(t),Ns(r))};function vI(e,t){return e.length<t.length?-1:e.length>t.length?1:iI(e,t)}function ao(e,t,r,n,i){let o=r+n;li(e,t,o);let s=new oe(k.string,tI(e,t+r,t+o),o);return i.retainStringBytes===!0&&(s.byteValue=oc(e,t+r,t+o)),s}function _I(e,t,r,n){return ao(e,t,1,r,n)}function wI(e,t,r,n){return ao(e,t,2,Tn(e,t+1,n),n)}function TI(e,t,r,n){return ao(e,t,3,An(e,t+1,n),n)}function AI(e,t,r,n){return ao(e,t,5,On(e,t+1,n),n)}function OI(e,t,r,n){let i=En(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer string lengths not supported`);return ao(e,t,9,i,n)}var EI=Hs;function di(e,t,r,n){return new oe(k.array,n,r)}function II(e,t,r,n){return di(e,t,1,r)}function SI(e,t,r,n){return di(e,t,2,Tn(e,t+1,n))}function xI(e,t,r,n){return di(e,t,3,An(e,t+1,n))}function CI(e,t,r,n){return di(e,t,5,On(e,t+1,n))}function NI(e,t,r,n){let i=En(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer array lengths not supported`);return di(e,t,9,i)}function RI(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${be} indefinite length items not allowed`);return di(e,t,1,1/0)}function uc(e,t){zt(e,k.array.majorEncoded,t.value)}uc.compareTokens=In.compareTokens;uc.encodedSize=function(t){return zt.encodedSize(t.value)};function pi(e,t,r,n){return new oe(k.map,n,r)}function $I(e,t,r,n){return pi(e,t,1,r)}function PI(e,t,r,n){return pi(e,t,2,Tn(e,t+1,n))}function UI(e,t,r,n){return pi(e,t,3,An(e,t+1,n))}function BI(e,t,r,n){return pi(e,t,5,On(e,t+1,n))}function kI(e,t,r,n){let i=En(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer map lengths not supported`);return pi(e,t,9,i)}function MI(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${be} indefinite length items not allowed`);return pi(e,t,1,1/0)}function cc(e,t){zt(e,k.map.majorEncoded,t.value)}cc.compareTokens=In.compareTokens;cc.encodedSize=function(t){return zt.encodedSize(t.value)};function DI(e,t,r,n){return new oe(k.tag,r,1)}function LI(e,t,r,n){return new oe(k.tag,Tn(e,t+1,n),2)}function jI(e,t,r,n){return new oe(k.tag,An(e,t+1,n),3)}function FI(e,t,r,n){return new oe(k.tag,On(e,t+1,n),5)}function VI(e,t,r,n){return new oe(k.tag,En(e,t+1,n),9)}function fc(e,t){zt(e,k.tag.majorEncoded,t.value)}fc.compareTokens=In.compareTokens;fc.encodedSize=function(t){return zt.encodedSize(t.value)};var zI=20,qI=21,KI=22,GI=23;function WI(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${be} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new oe(k.null,null,1):new oe(k.undefined,void 0,1)}function HI(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${be} indefinite length items not allowed`);return new oe(k.break,void 0,1)}function lc(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${be} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${be} Infinity values are not supported`)}return new oe(k.float,e,t)}function JI(e,t,r,n){return lc(pc(e,t+1),3,n)}function XI(e,t,r,n){return lc(hc(e,t+1),5,n)}function YI(e,t,r,n){return lc(Bh(e,t+1),9,n)}function dc(e,t,r){let n=t.value;if(n===!1)e.push([k.float.majorEncoded|zI]);else if(n===!0)e.push([k.float.majorEncoded|qI]);else if(n===null)e.push([k.float.majorEncoded|KI]);else if(n===void 0)e.push([k.float.majorEncoded|GI]);else{let i,o=!1;(!r||r.float64!==!0)&&(Ph(n),i=pc(nr,1),n===i||Number.isNaN(n)?(nr[0]=249,e.push(nr.slice(0,3)),o=!0):(Uh(n),i=hc(nr,1),n===i&&(nr[0]=250,e.push(nr.slice(0,5)),o=!0))),o||(QI(n),i=Bh(nr,1),nr[0]=251,e.push(nr.slice(0,9)))}}dc.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){Ph(n);let i=pc(nr,1);if(n===i||Number.isNaN(n))return 3;if(Uh(n),i=hc(nr,1),n===i)return 5}return 9};var $h=new ArrayBuffer(9),Vt=new DataView($h,1),nr=new Uint8Array($h,0);function Ph(e){if(e===1/0)Vt.setUint16(0,31744,!1);else if(e===-1/0)Vt.setUint16(0,64512,!1);else if(Number.isNaN(e))Vt.setUint16(0,32256,!1);else{Vt.setFloat32(0,e);let t=Vt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)Vt.setUint16(0,31744,!1);else if(r===0)Vt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?Vt.setUint16(0,0):i<-14?Vt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):Vt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function pc(e,t){if(e.length-t<2)throw new Error(`${be} 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 Uh(e){Vt.setFloat32(0,e,!1)}function hc(e,t){if(e.length-t<4)throw new Error(`${be} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function QI(e){Vt.setFloat64(0,e,!1)}function Bh(e,t){if(e.length-t<8)throw new Error(`${be} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}dc.compareTokens=In.compareTokens;function Ne(e,t,r){throw new Error(`${be} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Js(e){return()=>{throw new Error(`${be} ${e}`)}}var ce=[];for(let e=0;e<=23;e++)ce[e]=Ne;ce[24]=sI;ce[25]=aI;ce[26]=uI;ce[27]=cI;ce[28]=Ne;ce[29]=Ne;ce[30]=Ne;ce[31]=Ne;for(let e=32;e<=55;e++)ce[e]=Ne;ce[56]=fI;ce[57]=lI;ce[58]=dI;ce[59]=pI;ce[60]=Ne;ce[61]=Ne;ce[62]=Ne;ce[63]=Ne;for(let e=64;e<=87;e++)ce[e]=hI;ce[88]=yI;ce[89]=gI;ce[90]=mI;ce[91]=bI;ce[92]=Ne;ce[93]=Ne;ce[94]=Ne;ce[95]=Js("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ce[e]=_I;ce[120]=wI;ce[121]=TI;ce[122]=AI;ce[123]=OI;ce[124]=Ne;ce[125]=Ne;ce[126]=Ne;ce[127]=Js("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ce[e]=II;ce[152]=SI;ce[153]=xI;ce[154]=CI;ce[155]=NI;ce[156]=Ne;ce[157]=Ne;ce[158]=Ne;ce[159]=RI;for(let e=160;e<=183;e++)ce[e]=$I;ce[184]=PI;ce[185]=UI;ce[186]=BI;ce[187]=kI;ce[188]=Ne;ce[189]=Ne;ce[190]=Ne;ce[191]=MI;for(let e=192;e<=215;e++)ce[e]=DI;ce[216]=LI;ce[217]=jI;ce[218]=FI;ce[219]=VI;ce[220]=Ne;ce[221]=Ne;ce[222]=Ne;ce[223]=Ne;for(let e=224;e<=243;e++)ce[e]=Js("simple values are not supported");ce[244]=Ne;ce[245]=Ne;ce[246]=Ne;ce[247]=WI;ce[248]=Js("simple values are not supported");ce[249]=JI;ce[250]=XI;ce[251]=YI;ce[252]=Ne;ce[253]=Ne;ce[254]=Ne;ce[255]=HI;var yr=[];for(let e=0;e<24;e++)yr[e]=new oe(k.uint,e,1);for(let e=-1;e>=-24;e--)yr[31-e]=new oe(k.negint,e,1);yr[64]=new oe(k.bytes,new Uint8Array(0),1);yr[96]=new oe(k.string,"",1);yr[128]=new oe(k.array,0,1);yr[160]=new oe(k.map,0,1);yr[244]=new oe(k.false,!1,1);yr[245]=new oe(k.true,!0,1);yr[246]=new oe(k.null,null,1);function ZI(){let e=[];return e[k.uint.major]=In,e[k.negint.major]=ac,e[k.bytes.major]=Hs,e[k.string.major]=EI,e[k.array.major]=uc,e[k.map.major]=cc,e[k.tag.major]=fc,e[k.float.major]=dc,e}var ZP=ZI(),Su=new Nh,gp=class kh{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(`${mn} object contains circular references`);return new kh(r,t)}},Fr={null:new oe(k.null,null),undefined:new oe(k.undefined,void 0),true:new oe(k.true,!0),false:new oe(k.false,!1),emptyArray:new oe(k.array,0),emptyMap:new oe(k.map,0)},Gr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new oe(k.float,e):e>=0?new oe(k.uint,e):new oe(k.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new oe(k.uint,e):new oe(k.negint,e)},Uint8Array(e,t,r,n){return new oe(k.bytes,e)},string(e,t,r,n){return new oe(k.string,e)},boolean(e,t,r,n){return e?Fr.true:Fr.false},null(e,t,r,n){return Fr.null},undefined(e,t,r,n){return Fr.undefined},ArrayBuffer(e,t,r,n){return new oe(k.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new oe(k.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Fr.emptyArray,new oe(k.break)]:Fr.emptyArray;n=gp.createCheck(n,e);let i=[],o=0;for(let s of e)i[o++]=gs(s,r,n);return r.addBreakTokens?[new oe(k.array,e.length),i,new oe(k.break)]:[new oe(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?[Fr.emptyMap,new oe(k.break)]:Fr.emptyMap;n=gp.createCheck(n,e);let a=[],u=0;for(let f of o)a[u++]=[gs(f,r,n),gs(i?e.get(f):e[f],r,n)];return eS(a,r),r.addBreakTokens?[new oe(k.map,s),a,new oe(k.break)]:[new oe(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 gs(e,t={},r){let n=XE(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(`${mn} unsupported type: ${n}`);return o(e,n,t,r)}function eS(e,t){t.mapSorter&&e.sort(t.mapSorter)}function Mh(e,t,r,n){if(Array.isArray(t))for(let i of t)Mh(e,i,r,n);else r[t.type.major](e,t,n)}function tS(e,t,r){let n=gs(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 Nh(s);if(o(a,n,r),a.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return ic(a.chunks[0])}}return Su.reset(),Mh(Su,n,t,r),Su.toBytes(!0)}var rS={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},nS=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=yr[e];if(t===void 0){let r=ce[e];if(!r)throw new Error(`${be} 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}},ro=Symbol.for("DONE"),Xs=Symbol.for("BREAK");function iS(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=no(t,r);if(o===Xs){if(e.value===1/0)break;throw new Error(`${be} got unexpected break to lengthed array`)}if(o===ro)throw new Error(`${be} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function oS(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=no(t,r);if(a===Xs){if(e.value===1/0)break;throw new Error(`${be} got unexpected break to lengthed map`)}if(a===ro)throw new Error(`${be} found map but not enough entries (got ${s} [no key], expected ${e.value})`);if(n!==!0&&typeof a!="string")throw new Error(`${be} non-string keys not supported (got ${typeof a})`);if(r.rejectDuplicateMapKeys===!0&&(n&&o.has(a)||!n&&a in i))throw new Error(`${be} found repeat map key "${a}"`);let u=no(t,r);if(u===ro)throw new Error(`${be} 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 no(e,t){if(e.done())return ro;let r=e.next();if(r.type===k.break)return Xs;if(r.type.terminal)return r.value;if(r.type===k.array)return iS(r,e,t);if(r.type===k.map)return oS(r,e,t);if(r.type===k.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=no(e,t);return t.tags[r.value](n)}throw new Error(`${be} tag not supported (${r.value})`)}throw new Error("unsupported")}function sS(e,t){if(!(e instanceof Uint8Array))throw new Error(`${be} data to decode must be a Uint8Array`);t=Object.assign({},rS,t);let r=t.tokenizer||new nS(e,t),n=no(r,t);if(n===ro)throw new Error(`${be} did not find any content to decode`);if(n===Xs)throw new Error(`${be} got unexpected break`);return[n,e.subarray(r.pos())]}function aS(e,t){let[r,n]=sS(e,t);if(n.length>0)throw new Error(`${be} too many terminals, data makes no sense`);return r}var uS=class extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){let t=this.inRecursive[this.inRecursive.length-1];t&&(t.type===k.array&&(t.elements++,t.elements!==1&&e.push([44])),t.type===k.map&&(t.elements++,t.elements!==1&&(t.elements%2===1?e.push([44]):e.push([58]))))}[k.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)}[k.negint.major](e,t){this[k.uint.major](e,t)}[k.bytes.major](e,t){throw new Error(`${mn} unsupported type: Uint8Array`)}[k.string.major](e,t){this.prefix(e);let r=xh(JSON.stringify(t.value));e.push(r.length>32?ic(r):r)}[k.array.major](e,t){this.prefix(e),this.inRecursive.push({type:k.array,elements:0}),e.push([91])}[k.map.major](e,t){this.prefix(e),this.inRecursive.push({type:k.map,elements:0}),e.push([123])}[k.tag.major](e,t){}[k.float.major](e,t){if(t.type.name==="break"){let o=this.inRecursive.pop();if(o){if(o.type===k.array)e.push([93]);else if(o.type===k.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(`${mn} 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 cS(e,t){if(Array.isArray(e[0])||Array.isArray(t[0]))throw new Error(`${mn} complex map keys are not supported`);let r=e[0],n=t[0];if(r.type!==k.string||n.type!==k.string)throw new Error(`${mn} non-string map keys are not supported`);if(r<n)return-1;if(r>n)return 1;throw new Error(`${mn} unexpected duplicate map keys, this is not supported`)}var fS={addBreakTokens:!0,mapSorter:cS};function lS(e,t){return t=Object.assign({},fS,t),tS(e,new uS,t)}var Dh=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(`${be} 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(`${be} 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 oe(k.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(`${be} unexpected token at position ${this._pos}`);if(!this.done()&&this.ch()===46){if(r)throw new Error(`${be} 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 oe(k.float,o,this._pos-e):this.options.allowBigInt!==!0||Number.isSafeInteger(o)?new oe(o>=0?k.uint:k.negint,o,this._pos-e):new oe(o>=0?k.uint:k.negint,BigInt(i),this._pos-e)}parseString(){if(this.ch()!==34)throw new Error(`${be} 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 oe(k.string,a,o)}}let e=this._pos,t=[],r=()=>{if(this._pos+4>=this.data.length)throw new Error(`${be} 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(`${be} 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(`${be} unexpected unicode sequence at position ${this._pos}`);let a,u,f,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],f=this.data[this._pos+3],(a&192)===128&&(u&192)===128&&(f&192)===128&&(l=(i&15)<<18|(a&63)<<12|(u&63)<<6|f&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(`${be} 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(`${be} unexpected string escape character at position ${this._pos}`)}break;case 34:return this._pos++,new oe(k.string,Ch(t),this._pos-e);default:if(i<32)throw new Error(`${be} invalid control character at position ${this._pos}`);i<128?(t.push(i),this._pos++):n()}}throw new Error(`${be} unexpected end of string at position ${this._pos}`)}parseValue(){switch(this.ch()){case 123:return this.modeStack.push("obj-start"),this._pos++,new oe(k.map,1/0,1);case 91:return this.modeStack.push("array-start"),this._pos++,new oe(k.array,1/0,1);case 34:return this.parseString();case 110:return this.expect([110,117,108,108]),new oe(k.null,null,4);case 102:return this.expect([102,97,108,115,101]),new oe(k.false,!1,5);case 116:return this.expect([116,114,117,101]),new oe(k.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(`${be} 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 oe(k.break,void 0,1);if(this.ch()!==44)throw new Error(`${be} 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 oe(k.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 oe(k.break,void 0,1);if(this.ch()!==44)throw new Error(`${be} 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 oe(k.break,void 0,1);let e=this.parseString();if(this.skipWhitespace(),this.ch()!==58)throw new Error(`${be} 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(`${be} unexpected parse state at position ${this._pos}; this shouldn't happen`)}}};function dS(e,t){return t=Object.assign({tokenizer:new Dh(e,t)},t),aS(e,t)}var eU=new Uint8Array(0);function pS(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 yc(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 hS(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),f=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function p(S){if(S instanceof Uint8Array||(ArrayBuffer.isView(S)?S=new Uint8Array(S.buffer,S.byteOffset,S.byteLength):Array.isArray(S)&&(S=Uint8Array.from(S))),!(S instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(S.length===0)return"";for(var z=0,X=0,j=0,M=S.length;j!==M&&S[j]===0;)j++,z++;for(var K=(M-j)*l+1>>>0,H=new Uint8Array(K);j!==M;){for(var V=S[j],ee=0,W=K-1;(V!==0||ee<X)&&W!==-1;W--,ee++)V+=256*H[W]>>>0,H[W]=V%a>>>0,V=V/a>>>0;if(V!==0)throw new Error("Non-zero carry");X=ee,j++}for(var he=K-X;he!==K&&H[he]===0;)he++;for(var P=u.repeat(z);he<K;++he)P+=e.charAt(H[he]);return P}function C(S){if(typeof S!="string")throw new TypeError("Expected String");if(S.length===0)return new Uint8Array;var z=0;if(S[z]!==" "){for(var X=0,j=0;S[z]===u;)X++,z++;for(var M=(S.length-z)*f+1>>>0,K=new Uint8Array(M);S[z];){var H=r[S.charCodeAt(z)];if(H===255)return;for(var V=0,ee=M-1;(H!==0||V<j)&&ee!==-1;ee--,V++)H+=a*K[ee]>>>0,K[ee]=H%256>>>0,H=H/256>>>0;if(H!==0)throw new Error("Non-zero carry");j=V,z++}if(S[z]!==" "){for(var W=M-j;W!==M&&K[W]===0;)W++;for(var he=new Uint8Array(X+(M-W)),P=X;W!==M;)he[P++]=K[W++];return he}}}function A(S){var z=C(S);if(z)return z;throw new Error(`Non-${t} character`)}return{encode:p,decodeUnsafe:C,decode:A}}var yS=hS,gS=yS,mS=gS,bS=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")}},vS=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 Lh(this,e)}},_S=class{decoders;constructor(e){this.decoders=e}or(e){return Lh(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 Lh(e,t){return new _S({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var wS=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 bS(e,t,r),this.decoder=new vS(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function jh({name:e,prefix:t,encode:r,decode:n}){return new wS(e,t,r,n)}function Ys({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=mS(r,e);return jh({prefix:t,name:e,encode:n,decode:o=>yc(i(o))})}function TS(e,t,r,n){let i=e.length;for(;e[i-1]==="=";)--i;let o=new Uint8Array(i*r/8|0),s=0,a=0,u=0;for(let f=0;f<i;++f){let l=t[e[f]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<r|l,s+=r,s>=8&&(s-=8,o[u++]=255&a>>s)}if(s>=r||(255&a<<8-s)!==0)throw new SyntaxError("Unexpected end of data");return o}function AS(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)!==0;)o+="=";return o}function OS(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function It({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=OS(n);return jh({prefix:t,name:e,encode(o){return AS(o,n,r)},decode(o){return TS(o,i,r,e)}})}var ms=It({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),tU=It({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),rU=It({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),nU=It({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),iU=It({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),oU=It({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),sU=It({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),aU=It({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),uU=It({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),bs=Ys({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),cU=Ys({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),qr=Ys({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),fU=Ys({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Fh={};mu(Fh,{Digest:()=>Qs,create:()=>gc,decode:()=>zh,equals:()=>qh,hasCode:()=>zS});var ES=Vh,mp=128,IS=127,SS=~IS,xS=Math.pow(2,31);function Vh(e,t,r){t=t||[],r=r||0;for(var n=r;e>=xS;)t[r++]=e&255|mp,e/=128;for(;e&SS;)t[r++]=e&255|mp,e>>>=7;return t[r]=e|0,Vh.bytes=r-n+1,t}var CS=Uu,NS=128,bp=127;function Uu(e,n){var r=0,n=n||0,i=0,o=n,s,a=e.length;do{if(o>=a)throw Uu.bytes=0,new RangeError("Could not decode varint");s=e[o++],r+=i<28?(s&bp)<<i:(s&bp)*Math.pow(2,i),i+=7}while(s>=NS);return Uu.bytes=o-n,r}var RS=Math.pow(2,7),$S=Math.pow(2,14),PS=Math.pow(2,21),US=Math.pow(2,28),BS=Math.pow(2,35),kS=Math.pow(2,42),MS=Math.pow(2,49),DS=Math.pow(2,56),LS=Math.pow(2,63),jS=function(e){return e<RS?1:e<$S?2:e<PS?3:e<US?4:e<BS?5:e<kS?6:e<MS?7:e<DS?8:e<LS?9:10},FS={encode:ES,decode:CS,encodingLength:jS},VS=FS,Rs=VS;function Bu(e,t=0){return[Rs.decode(e,t),Rs.decode.bytes]}function $s(e,t,r=0){return Rs.encode(e,t,r),t}function Ps(e){return Rs.encodingLength(e)}function gc(e,t){let r=t.byteLength,n=Ps(e),i=n+Ps(r),o=new Uint8Array(i+r);return $s(e,o,0),$s(r,o,n),o.set(t,i),new Qs(e,r,t,o)}function zh(e){let t=yc(e),[r,n]=Bu(t),[i,o]=Bu(t.subarray(n)),s=t.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Qs(r,i,s,t)}function qh(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&pS(e.bytes,r.bytes)}}var Qs=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function zS(e,t){return e.code===t}function vp(e,t){let{bytes:r,version:n}=e;return n===0?KS(r,ku(e),t??qr.encoder):GS(r,ku(e),t??ms.encoder)}var _p=new WeakMap;function ku(e){let t=_p.get(e);if(t==null){let r=new Map;return _p.set(e,r),r}return t}var ht=class st{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!==Hi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==WS)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return st.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=gc(t,r);return st.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 st.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&qh(t.multihash,n.multihash)}toString(t){return vp(this,t)}toJSON(){return{"/":vp(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 st)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new st(n,i,o,s??wp(n,i,o.bytes))}else if(r[HS]===!0){let{version:n,multihash:i,code:o}=r,s=zh(i);return st.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!==Hi)throw new Error(`Version 0 CID must use dag-pb (code: ${Hi}) block encoding`);return new st(t,r,n,n.bytes)}case 1:{let i=wp(t,r,n.bytes);return new st(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return st.create(0,Hi,t)}static createV1(t,r){return st.create(1,t,r)}static decode(t){let[r,n]=st.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=st.inspectBytes(t),n=r.size-r.multihashSize,i=yc(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 Qs(r.multihashCode,r.digestSize,o,i);return[r.version===0?st.createV0(s):st.createV1(r.codec,s),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[p,C]=Bu(t.subarray(r));return r+=C,p},i=n(),o=Hi;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(),f=r+u,l=f-s;return{version:i,codec:o,multihashCode:a,digestSize:u,multihashSize:l,size:f}}static parse(t,r){let[n,i]=qS(t,r),o=st.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ku(o).set(n,t),o}};function qS(e,t){switch(e[0]){case"Q":{let r=t??qr;return[qr.prefix,r.decode(`${qr.prefix}${e}`)]}case qr.prefix:{let r=t??qr;return[qr.prefix,r.decode(e)]}case ms.prefix:{let r=t??ms;return[ms.prefix,r.decode(e)]}case bs.prefix:{let r=t??bs;return[bs.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 KS(e,t,r){let{prefix:n}=r;if(n!==qr.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 GS(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 Hi=112,WS=18;function wp(e,t,r){let n=Ps(e),i=n+Ps(t),o=new Uint8Array(i+r.byteLength);return $s(e,o,0),$s(t,o,n),o.set(r,i),o}var HS=Symbol.for("@ipld/js-cid/CID"),JS=20;function Kh({name:e,code:t,encode:r,minDigestLength:n,maxDigestLength:i}){return new XS(e,t,r,n,i)}var XS=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,r,n,i){this.name=e,this.code=t,this.encode=r,this.minDigestLength=n??JS,this.maxDigestLength=i}digest(e,t){if(t?.truncate!=null){if(t.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&t.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?Tp(r,this.code,t?.truncate):r.then(n=>Tp(n,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}};function Tp(e,t,r){if(r!=null&&r!==e.byteLength){if(r>e.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${e.byteLength}`);e=e.subarray(0,r)}return gc(t,e)}var Gh=It({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),lU=It({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),dU=It({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),pU=It({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function YS(e){return e instanceof ArrayBuffer?new Uint8Array(e,0,e.byteLength):e}function QS(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=ht.asCID(e);if(!t)return null;let r=t.toString();return[new oe(k.map,1/0,1),new oe(k.string,"/",1),new oe(k.string,r,r.length),new oe(k.break,void 0,1)]}function Us(e){let t=Gh.encode(e).slice(1);return[new oe(k.map,1/0,1),new oe(k.string,"/",1),new oe(k.map,1/0,1),new oe(k.string,"bytes",5),new oe(k.string,t,t.length),new oe(k.break,void 0,1),new oe(k.break,void 0,1)]}function rr(e){return Us(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function ZS(e){return Us(new Uint8Array(e))}function ex(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function tx(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 rx={typeEncoders:{Object:QS,Buffer:Us,Uint8Array:Us,Int8Array:rr,Uint16Array:rr,Int16Array:rr,Uint32Array:rr,Int32Array:rr,Float32Array:rr,Float64Array:rr,Uint8ClampedArray:rr,BigInt64Array:rr,BigUint64Array:rr,DataView:rr,ArrayBuffer:ZS,undefined:ex,number:tx}},nx=class extends Dh{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===k.map){let t=this._next();if(t.type===k.string&&t.value==="/"){let r=this._next();if(r.type===k.string){if(this._next().type!==k.break)throw new Error("Invalid encoded CID form");return this.tokenBuffer.push(r),new oe(k.tag,42,0)}if(r.type===k.map){let n=this._next();if(n.type===k.string&&n.value==="bytes"){let i=this._next();if(i.type===k.string){for(let s=0;s<2;s++)if(this._next().type!==k.break)throw new Error("Invalid encoded Bytes form");let o=Gh.decode(`m${i.value}`);return new oe(k.bytes,o,i.value.length)}this.tokenBuffer.push(i)}this.tokenBuffer.push(n)}this.tokenBuffer.push(r)}this.tokenBuffer.push(t)}return e}},Mu={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Mu.tags[42]=ht.parse;var ix="dag-json",Wh=297,mc=e=>lS(e,rx),uo=e=>{let t=YS(e),r=Object.assign(Mu,{tokenizer:new nx(t,Mu)});return dS(t,r)},Ap=e=>ox.decode(mc(e)),ox=new TextDecoder,sx=e=>uo(ax.encode(e)),ax=new TextEncoder;function ux(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Hh(e,t,r=""){let n=ux(e),i=e?.length,o=t!==void 0;if(!n||o&&i!==t){let s=r&&`"${r}" `,a=o?` of length ${t}`:"",u=n?`length=${i}`:`type=${typeof e}`;throw new Error(s+"expected Uint8Array"+a+", got "+u)}return e}function Op(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 cx(e,t){Hh(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw new Error('"digestInto() output" expected to be of length >='+r)}function Du(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function xu(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function lr(e,t){return e<<32-t|e>>>t}function fx(e,t={}){let r=(i,o)=>e(o).update(i).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.create=i=>e(i),Object.assign(r,t),Object.freeze(r)}var lx=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function dx(e,t,r){return e&t^~e&r}function px(e,t,r){return e&t^e&r^t&r}var hx=class{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,r,n){this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=xu(this.buffer)}update(e){Op(this),Hh(e);let{view:t,buffer:r,blockLen:n}=this,i=e.length;for(let o=0;o<i;){let s=Math.min(n-this.pos,i-o);if(s===n){let a=xu(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){Op(this),cx(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:o}=this;t[o++]=128,Du(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let l=o;l<n;l++)t[l]=0;r.setBigUint64(n-8,BigInt(this.length*8),i),this.process(r,0);let s=xu(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let u=a/4,f=this.get();if(u>f.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<u;l++)s.setUint32(4*l,f[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||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return e.destroyed=o,e.finished=i,e.length=n,e.pos=s,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}},Vr=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),yx=Uint32Array.from([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]),zr=new Uint32Array(64),gx=class extends hx{constructor(e){super(64,e,8,!1)}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)zr[l]=e.getUint32(t,!1);for(let l=16;l<64;l++){let p=zr[l-15],C=zr[l-2],A=lr(p,7)^lr(p,18)^p>>>3,S=lr(C,17)^lr(C,19)^C>>>10;zr[l]=S+zr[l-7]+A+zr[l-16]|0}let{A:r,B:n,C:i,D:o,E:s,F:a,G:u,H:f}=this;for(let l=0;l<64;l++){let p=lr(s,6)^lr(s,11)^lr(s,25),C=f+p+dx(s,a,u)+yx[l]+zr[l]|0,S=(lr(r,2)^lr(r,13)^lr(r,22))+px(r,n,i)|0;f=u,u=a,a=s,s=o+C|0,o=i,i=n,n=r,r=C+S|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,f=f+this.H|0,this.set(r,n,i,o,s,a,u,f)}roundClean(){Du(zr)}destroy(){this.set(0,0,0,0,0,0,0,0),Du(this.buffer)}},mx=class extends gx{A=Vr[0]|0;B=Vr[1]|0;C=Vr[2]|0;D=Vr[3]|0;E=Vr[4]|0;F=Vr[5]|0;G=Vr[6]|0;H=Vr[7]|0;constructor(){super(32)}},bx=fx(()=>new mx,lx(1));var Ze=Ft(Ar(),1),Jh=Ft(kv(),1),Lu=e=>Ze.Type.Union([e,Ze.Type.Null()]);var Xh=/^(k51qz|baguq)[0-9a-z]{56,57}$/,vx=/^[0-9A-Fa-f]{7,8}$/g;Ze.FormatRegistry.Set("EntityID",e=>!!e.match(vx)||!!e.match(Xh));var Yh=Ze.Type.String(),Zs=e=>e?.enc instanceof Uint8Array;Ze.FormatRegistry.Set("CID",e=>!!e.match(Xh));var bc=Ze.Type.String({format:"CID"}),_x=/^http([s]?):\/\/.*\..*/;Ze.FormatRegistry.Set("URL",e=>!!e.match(_x));var wx=Ze.Type.String({format:"URL"}),vc=Ze.Type.Object({en:Yh,at:Ze.Type.String(),vl:Lu(Ze.Type.Union([Ze.Type.String(),Ze.Type.Boolean(),Ze.Type.Number()])),ts:Ze.Type.String(),ag:Ze.Type.String(),pv:Lu(bc)}),ju=Jh.TypeCompiler.Compile(vc);var Tx=ju.Check.bind(ju),Qh=Ze.Type.Composite([Ze.Type.Object({cid:bc}),vc]),Bs=Jh.TypeCompiler.Compile(Qh),Zh=e=>Array.from(Bs.Errors(e)),_c=Bs.Check.bind(Bs);function ey(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var Ax=Kh({name:"sha2-256",code:18,encode:ey("SHA-256")}),hU=Kh({name:"sha2-512",code:19,encode:ey("SHA-512")}),{WARN:Ep,LOG:yU,DEBUG:Ox,VERBOSE:ks,ERROR:Ex}=Pe.setup(Pe.INFO),ty=114;function wc(e,t=["cid"]){if(!e)throw Ex("falsy log",e);let r=e.cid;if(Zs(e))return r||(r=ea(Tc(e).bytes).toString()),Ep("preparing an encrypted applog - really?"),{log:e,cid:r};let n={};for(let[i,o]of Object.entries(e))o===void 0&&(Ep(`log.${i} is undefined, which is not allowed - encoding as null`,e),o=null),t.includes(i)?ks("excluding app log",{key:i,val:o}):n[i]=o;return{log:n,cid:r}}function ry(e){return ea(ny(e).bytes)}function ny(e){return Tc(wc(e)?.log)}function ea(e){let t=bx(e),r=Fh.create(Ax.code,t),n=ht.create(1,Wh,r);return ks("[getCidSync]",{bytes:e,hash:t,digest:r,cid:n}),n}function Tc(e){Ox("[encodeBlock]",e);let t=mc(e);return{bytes:t,cid:ea(t)}}function Ac(e){let t=null,r=[];try{t=ht.parse(e)}catch(n){ks("[retrieveThread] couldn't parse pubID with default base"),r.push(n)}if(!t)try{t=ht.parse(e,bs)}catch(n){ks("[retrieveThread] couldn't parse pubID with base36"),r.push(n)}return{cid:t,errors:t?null:r,isIpns:t&&iy(t)}}function iy(e){return e.code===ty}function Fu(e){return typeof e=="string"?ht.parse(e):typeof e.toV1!="function"?ht.decode(e.bytes):e}function ta(e,t){if(!e||!t)throw new Error(`[areCidsEqual] invalid params: ${e}, ${t}`);if(e===t)return!0;let r=Fu(e),n=Fu(t);return r.toV1().toString()===n.toV1().toString()}function Ip(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 Ix(e,t){let r=Ip(e),n=Ip(t);return+r<+n}var{WARN:gU,LOG:mU,DEBUG:bU,VERBOSE:Sx,ERROR:Sp}=Pe.setup(Pe.INFO),oy=(e,t,r="asc")=>r==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),Oc=(e,t,r)=>We.structural(fp(t,e),fp(r,e)),sy=(e,t,r="asc")=>oy(e.ts,t.ts,r),xx=xE(Oc,["en","at"]);function Wr(e,t="asc"){return e.sort((r,n)=>sy(r,n,t))}var ay=(e,t)=>Ix(new Date(e.ts),new Date(t.ts));var Ec=e=>{let t=new Map;for(let r of e){if(!r)throw Sp("falsy entry in applogs",e),new Error("falsy entry in applogs");if(!r.cid)throw Sp("applog with missing CID",r),new Error("applog with missing CID");let n=r.cid;t.has(n)?Sx("Skipping duplicate applog:",[t.get(n),r]):t.set(n,r)}return Array.from(t.values())};function uy(e){return typeof e=="string"&&e.startsWith("?")}function cy(e){return e.slice(1)}function ra(e,t){let r={},n={};for(let[i,o]of Object.entries(e))if(uy(o)){let s=cy(o),a=t[s];a?n[i]=a:r[i]=s}else n[i]=o;return[n,r]}function fy(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 ly=function(t){for(var r=0,n=0,i=t.length;n<i;n++)r+=t[n];return r},xp=function(t){return ly(t)/t.length},Ot={max:function(e){return Math.max.apply(null,e)},min:function(e){return Math.min.apply(null,e)},range:function(e){return Ot.max(e)-Ot.min(e)},midrange:function(e){return Ot.range(e)/2},sum:ly,mean:xp,average:xp,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=Ot.mean(e);return Ot.mean(e.map(function(r){return Math.pow(r-t,2)}))},standardDeviation:function(e){return Math.sqrt(Ot.variance(e))},meanAbsoluteDeviation:function(e){var t=Ot.mean(e);return Ot.mean(e.map(function(r){return Math.abs(r-t)}))},zScores:function(e){var t=Ot.mean(e),r=Ot.standardDeviation(e);return e.map(function(n){return(n-t)/r})}};Ot.average=Ot.mean;function Ic(){return new Date().toISOString()}var{WARN:Cx,LOG:vU,DEBUG:Nx,VERBOSE:_U,ERROR:Ms}=Pe.setup(Pe.INFO);function dy(e,t){let r=Ic(),n=t;return e.map(o=>py(o,{ts:r,threadForPv:n}))}function py(e,{ts:t,threadForPv:r}={}){let n=gy(e,t??Ic()),i=my(n,r),o=ry(i).toString();e.cid&&e.cid!==o&&Cx("[finalizeApplogForInsert] overwriting wrong CID",{log:e,cid:o,logWithPv:i});let s={...i,cid:o};if(!_c(s))throw Ms(`Bogus Applog ${JSON.stringify(s)}`,Zh(s));return Object.freeze(s)}function hy(e){return!!e.ts}function yy(e){return!!e.pv}function gy(e,t){return hy(e)?e:{...e,ts:t}}function my(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(Oc(["en","at","vl","ts","ag"],e,i))throw Ms("[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(!yy(e))throw Ms("[withPvFrom] no thread and no pv:",e);return e}}function co(e){let t=()=>(ke(()=>e.length<2&&Nx(`joinThreads with count=${e.length}`)),Wr(Ec(e.flatMap(i=>{let o=i.applogs;if(!o)throw Ms("falsy applogs of thread",i),new Error("falsy applogs of thread");return o})))),r=ke(()=>t()),n=dt(function(i,o){return pr(i)?{init:ke(()=>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 na(ke(()=>`join(~ ${e.map(i=>i.name).join(", ")})`),e,["?"],r,n)}var{WARN:Cp,LOG:wU,DEBUG:Np,VERBOSE:yn,ERROR:Rp}=Pe.setup(Pe.INFO),na=class by extends vn{constructor(t,r,n,i,o,s=null){super(t,r,n,o?Me.array([...i],{deep:!1,name:`${t}.array`}):i),this.name=t,this._initialLogs=i,this._eventMapper=o,this._writeMapper=s,jr(this,{onParentUpdate:dt}),o&&this.subscribeToParents()}static mapWrites(t,r,n){return new by(`${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=jt(()=>{this.parents.length||Cp("MappedThread has no parents",this),yn(`[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)&&yn(`[MappedThread: ${this.name}] Skipping re-sub to parent`,n.nameAndSizeUntracked),yn(`[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)yn(`[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 Rp("triggerRemap on a thread that is not actually mapping?!",this.nameAndSizeUntracked);Np(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.length!==1&&Cp(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap with parentCount=${this.parents.length} - not meant for this`),this.parents.forEach(t=>{this.onParentUpdate(t,{init:ke(()=>Tr(t.applogs))})})}onParentUpdate(t,r){yn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate`,r);let n=this._eventMapper?this._eventMapper(r,t):r;if(this._eventMapper)if(yn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => mapped`,n),pr(n))this._applogs.replace([...n.init]);else{for(let i of n.added)this._applogs.splice(LE(this._applogs,i,"ts"),0,i);if(n.removed){for(let i of n.removed)if(!this._applogs.remove(i))if(!pr(r)&&r.removed?.includes(i))Np("Ignoring remove event for non-existent because it was part of parent event's removed",i,r);else throw Rp(`MappedThread{${this.name}} toRemove contained log that doesn't exist`,i,{thread:this,event:r,mapResult:n})}}yn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => deps?`,Vi(this._applogs)),this.notifySubscribers(n)}get readOnly(){return!1}},{WARN:TU,LOG:AU,DEBUG:OU,VERBOSE:Cu,ERROR:Rx}=Pe.setup(Pe.INFO),Er=nt("rollingFilter",function(t,r,n={}){let i=vy(r),o=Vu(i),s=Me.array(ke(function(){return o(t.applogs)}),{deep:!1,name:`${t.name} | ${n.name||`rollingFilter.array{${bn(i)}}`}`}),a=p=>{let C;return pr(p)?C={init:o(p.init)}:C={added:o(p.added),removed:p.removed},Cu(`rollingFilter{${t.nameAndSizeUntracked} | ${n.name?` '${n.name}'}`:""} parentUpdate`,i,p,"=>",C),C},u=new na(`${t.name} | ${n.name||`rollingFilter{${bn(i)}}`}`,t,[...t.filters,...n.extraFilterName?[n.extraFilterName]:[]],s,a),f=fd(()=>Tr(r),p=>{Cu(`rollingFilter<${t.nameAndSizeUntracked}>${n.name?` '${n.name}'`:""} patternUpdate`,i,"=>",p),i=p,o=Vu(i),u.triggerRemap()}),l=dn(s,()=>{Cu(`rollingFilter<${ke(()=>t.name)}>${n.name?` '${n.name}'`:""} unobserve`,i),f(),l()});return u},{equals:ci,argsDebugName:(e,t,r)=>et({caller:"rollingFilter",thread:e,pattern:t,args:r})}),Sc=nt("rollingMapper",function(t,r,n={}){let i=ke(()=>r.call(null,{init:t.applogs},t));if(!pr(i))throw Rx("Initial run must return init event");let o=i.init;return new na(`${t.name} | ${n.name||"rollingMapper"}`,t,[...t.filters,...n.extraFilterName?[n.extraFilterName]:[]],o,r)},{equals:ci,argsDebugName:(e,t,r)=>et({caller:"rollingMapper",thread:e,args:r})}),$x=nt("rollingAcc",function(t,r,n,i={}){let o=dt(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}`:""}}`}),vy=function(t){let r=ke(function(){return Object.fromEntries(Object.entries(Tr(t)).map(([i,o])=>[Tr(i),Tr(o)]))});if(!Object.entries(r).length)throw new Error("Pattern is empty");return r};function Vu(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(!fy(o,s,a))return!1}return!0})}}var{WARN:Px,LOG:Ux,DEBUG:Bx,VERBOSE:kx,ERROR:vs}=Pe.setup(Pe.INFO),_y=class extends vn{constructor(e,t=[],r){super(e,null,r,t),jr(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=dy(e,this);return this.insertRaw(t)}insertRaw(e){let t=Ec(e);if(t.length!==e.length)throw vs(`[insertRaw] duplicate applogs passed: ${e.length-t.length}`,{appLogsToInsert:e,deduplicated:t});let r=e.filter(o=>!_c(o));if(r.length)throw vs(`[insertRaw] bogus applogs passed: ${r.length}`,{bogus:r});let n=e.filter(o=>this.hasApplog(o,!1));if(n.length)throw vs(`[insertRaw] already existing applogs passed: ${n.length}`,{existing:n});if(!e.length){Px("[insertRaw] skipping empty insert empty logs array");return}(!this.hasParents&&!(this instanceof hi)?Ux:Bx)("Inserting:",e.length===1?e[0]:e,{ds:this}),Wr(e);let i=this._applogs.length&&ay(e[0],this._applogs[this._applogs.length-1]);return this._applogs.push(...e),i&&Wr(this._applogs),this.notifySubscribers({added:e,removed:null}),this.persist(e),e}get readOnly(){return!1}},hi=class _s extends _y{constructor(t,r,n,i){super(t,r,n),this._readOnly=i,jr(this,{_applogs:Me.shallow})}static empty(t){return _s.fromArray([],t??"empty in-memory",!1)}static fromArray(t,r,n=!1){return new _s(r??"in-memory",t,[],n)}static fromReadOnlyArray(t,r){return new _s(r??"in-memory",t,[],!0)}get readOnly(){return this._readOnly}async persist(t){if(kx("[InMem.persist] no persist for",t),this.readOnly)throw vs("[persist] called for readOnly thread")}},{WARN:EU,LOG:IU,DEBUG:SU,VERBOSE:xU,ERROR:CU}=Pe.setup(Pe.INFO);var{WARN:R2,LOG:$2,DEBUG:P2,VERBOSE:U2,ERROR:B2}=Pe.setup(Pe.INFO);var Dx=class{constructor(e,t,r=null){this.logsOfThisNode=e,this.variables=t,this.prevNode=r,jr(this,{threadOfTrail:Ve})}get record(){return this.variables}get threadOfTrail(){return this.prevNode?co([this.logsOfThisNode,this.prevNode.threadOfTrail]):this.logsOfThisNode}get trailLogs(){return this.threadOfTrail.applogs}},wy=class{constructor(e){this.nodes=e,jr(this,{threadOfAllTrails:Ve,size:Ve,isEmpty:Ve})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return ke(()=>this.records.length)}get records(){return hr(()=>this.nodes.map(({variables:e})=>e),{name:"QueryResult.records"})}get leafNodeThread(){return co(hr(()=>this.nodes.map(({logsOfThisNode:e})=>e),{name:"QueryResult.leafNodeThread"}))}get leafNodeLogSet(){return hr(()=>this.nodes.map(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogSet"})}get leafNodeLogs(){return hr(()=>this.nodes.flatMap(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogs"})}get threadOfAllTrails(){return co(hr(()=>this.nodes.map(e=>e.threadOfTrail),{name:"QueryResult.threadOfAllTrails"}))}get thread(){return this.threadOfAllTrails}get allApplogs(){return this.threadOfAllTrails.applogs}},{WARN:j2,LOG:ia,DEBUG:Ir,VERBOSE:Ie,ERROR:Sn}=Pe.setup(Pe.INFO,{prefix:"[q]"}),xc=null,Lx=nt("lastWriteWins",function(t,{inverseToOnlyReturnFirstLogs:r,tolerateAlreadyFiltered:n}={}){if(Ie(`lastWriteWins${r?".inversed":""} < ${t.nameAndSizeUntracked} > initializing`),t.filters.includes("lastWriteWins")){if(n)return Ir("[lastWriteWins] already filtered, but tolerateAlreadyFiltered=true, so returning"),t;throw Sn("thread already filtered lastWriteWins:",t.filters,{name:t.name})}let i,o=Sc(t,function(a,u){let f=pr(a),l,p=[],C=f?null:[];f?(i=new Map,l=a.init):l=a.added;let A;for(let S=r?0:l.length-1;r?S<l.length:S>=0;r?S++:S--){let z=l[S],X=z.en+"|"+z.at;if(A&&(r?A>z.ts:A<z.ts))throw Sn("lastWriteWins.mapper logs not sorted:",A,r?">":"<",z.ts,{log:z,i:S,newLogs:l,inverseToOnlyReturnFirstLogs:r});A=z.ts;let j=i.get(X);(!j||(r?j.ts>z.ts:j.ts<z.ts))&&(j&&!f&&C.push(j),p.push(z),i.set(X,z))}return Wr(p),Ie.isDisabled||Ie(`lastWriteWins${r?".inversed":""}<${t.nameAndSizeUntracked}> mapped event`,f?{...Object.fromEntries(Object.entries(a).map(([S,z])=>[S,z?.length])),toAdd:p.length,toRemove:C}:{...a,toAdd:p,toRemove:C}),f?{init:p}:{added:p,removed:C}},{name:`lastWriteWins${r?".inversed":""}`,extraFilterName:"lastWriteWins"});return Ie.isDisabled||jt(()=>{Ie(`lastWriteWins<${t.nameAndSizeUntracked}> filtered down to`,o.applogs.length)}),o},{equals:ci,argsDebugName:e=>et({caller:"lastWriteWins",thread:e})}),F2=nt("withoutDeleted",function(t){if(Ie.isEnabled&&Ie(`withoutDeleted<${t.nameAndSizeUntracked}>`),t.filters.includes("withoutDeleted"))throw Sn("thread already filtered withoutDeleted:",t.filters,{name:t.name});let r=Er(t,{at:["isDeleted","relation/isDeleted","block/isDeleted"],vl:!0},{name:"isDeleted"});Ie.isEnabled&&Ie(`withoutDeleted<${t.nameAndSizeUntracked}> deletionLogs:`,ke(function(){return[...r.applogs]}));let n=et({caller:"allDeletedEntities",thread:t}),i=Oh(function(){return r.map(s=>s.en)},{name:n});return Ie.isEnabled&&jt(()=>{Ie(`withoutDeleted<${t.nameAndSizeUntracked}> deleted:`,[...i])}),Er(t,{"!en":i},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:ci}),Ty=nt("query",function e(t,r,n={},i={}){Wx();let o=Ay(t);Ir(`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],f=jx(o,a,u,i);return Ie.isDisabled||jt(()=>Ie("query result:",Tr(f))),f},{equals:Ws,argsDebugName:(e,t,r)=>et({caller:"query",thread:e,args:r?{pattern:t,startVars:r}:t})}),jx=nt("queryStep",function(t,r,n,i={}){if(Ir(`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,f]=ra(n,a?.variables??{});Ie("[queryStep.doQuery] patternWithoutVars: ",u);let l=Er(t,u),p=oa(f),C=hr(function(){let S=l.map(z=>({log:z,vars:p(z)}));return Ie.isEnabled&&Ie("[queryStep.doQuery] step node:",a?.variables," =>",S,"from:",ke(()=>l.applogs)),S.map(({log:z,vars:X})=>{let j=Object.assign({},a?.variables,X);return new Dx(nc.fromArray([z],et({caller:"QueryNode",thread:l,pattern:`${bn(j)}@${bn(u)}`})),j,a)})},{name:et({caller:"doQuery.mapNodes",thread:l,pattern:n})});return Ie.isEnabled&&jt(()=>Ie("[queryStep.doQuery] resultNodes:",[...C])),i.debug&&ia("[queryStep] step result:",ke(()=>C.map(({variables:A,logsOfThisNode:S})=>({variables:A,thread:S})))),C}let s=hr(function(){return Ir(`[queryStep] Running with ${r?.nodes?.length} input nodes:`),r?[...r.nodes.flatMap(o)]:[...o(null)]},{name:et({caller:"queryStep",thread:t,pattern:n})});return Ie.isEnabled&&jt(()=>Ie("[queryStep] observableResultNodes:",[...s])),new wy(s)},{equals:Ws,argsDebugName:(e,t,r)=>et({caller:"queryStep",thread:e,pattern:r})}),V2=nt("queryNot",function(t,r,n,i={}){let o=r.nodes;Ir(`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:f}){let[l,p]=ra(a,f??{});Ie("[queryNot] patternWithoutVars: ",l);let C=Er(t,l);return Ie("[queryNot] step node:",f," =>",C.size,"applogs"),Ie.isDisabled||Ie("[queryNot] step node:",f," => empty?",ke(()=>C.applogs)),i.debug&&ia("[queryNot] node result:",f,"=>",C.applogs),C.isEmpty})}return new wy(o)},{equals:Ws,argsDebugName:(e,t,r)=>et({caller:"queryNot",thread:e,pattern:r})}),z2=nt("filterAndMap",function(t,r,n){Ir(`filterAndMap<${t.nameAndSizeUntracked}>`,r);let i=Er(t,r);Ie.isEnabled&&(Ie("[filterAndMap] filtered:",i.untrackedSize),jt(()=>Ie("[filterAndMap] filtered:",i.applogs)));let o=et({thread:t,pattern:r,caller:"filterAndMap"}),s=hr(()=>zx(i,n),{name:o});return Ie.isDisabled||jt(()=>Ie("[filterAndMap] mapped:",s)),s},{equals:We.structural,argsDebugName:(e,t)=>et({caller:"filterAndMap",thread:e,pattern:t})}),q2=nt("queryAndMap",function(t,r,n,i={}){let o=Ay(t);Ir(`queryAndMap<${o.nameAndSizeUntracked}>`,{patternOrPatterns:r,variables:i,map:n});let s=et({thread:o,caller:"queryAndMap"}),a=Ty(o,r);Ie("[queryAndMap] filtered count:",a.untrackedSize);let u=hr(()=>qx(a,n),{name:s});return Ie.isDisabled||jt(()=>Ie("[queryAndMap] result:",Tr(u))),u},{equals:We.structural,argsDebugName:(e,t)=>et({caller:"queryAndMap",thread:e,pattern:t})}),K2=nt("queryEntity",function(t,r,n,i){Ir(`queryEntity<${t.nameAndSizeUntracked}>`,n,r);let o=Er(t,{en:n,at:Kx(r,i)});return Ie("queryEntity applogs:",o.applogs),Ve(()=>o.isEmpty?null:Object.fromEntries(o.map(({at:s,vl:a})=>[s.slice(r.length+1),a])))},{equals:Ah,argsDebugName:(e,t,r)=>et({caller:"queryEntity",thread:e,args:{name:t,entityID:r}})}),G2=nt("agentsOfThread",function(t){Ir(`agentsOfThread<${t.nameAndSizeUntracked}>`);let r=Me.map(),n=dt(o=>{for(let s of pr(o)?o.init:o.added){let a=r.get(s.ag)??0;r.set(s.ag,a+1)}for(let s of!pr(o)&&o.removed||[]){let a=r.get(s.ag);if(!a||a<1)throw Sn("[agentsOfThread] number is now negative",{log:s,event:o,mapped:r,prev:a});r.set(s.ag,a-1)}ia(`agentsOfThread<${t.nameAndSizeUntracked}> processed event`,{event:o,mapped:r})});n({init:t.applogs});let i=t.subscribe(n);return Yn(r,i),r}),Fx=nt("entityOverlap",function(t,r){return ia(`entityOverlap<${t.nameAndSizeUntracked}, ${r.nameAndSizeUntracked}>`),Ve(()=>{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 W2=nt("entityOverlapCount",function(t,r){return Ve(()=>Fx(t,r).get().length)}),Vx=nt("querySingle",function(t,r,n={}){let i=Ty(t,r,n);return Ve(()=>{if(i.isEmpty)return null;if(i.size>1)throw Sn("[querySingle] got",i.size,"results:",i);let o=i.nodes[0].logsOfThisNode;if(o.size!=1)throw Sn("[querySingle] single result, but got",o.size,"logs:",o.applogs);return o.applogs[0]})},{equals:We.structural,argsDebugName:(e,t)=>et({caller:"querySingle",thread:e,pattern:t})}),H2=nt("querySingleAndMap",function(t,r,n,i={}){let o=Vx(t,r,i);return Ve(()=>{let s=o.get();if(s)return typeof n=="string"?s[n]:oa(n)(s)})},{equals:We.structural,argsDebugName:(e,t)=>et({caller:"querySingleAndMap",thread:e,pattern:t})}),zx=function(t,r){return typeof r=="function"?t.map(r):typeof r=="string"?t.map(n=>n[r]):t.map(oa(r))},qx=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 Sn(`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=>oa(r)(t))};function oa(e){return t=>Object.entries(e).reduce((r,[n,i])=>(r[i]=t[n],r),{})}function Kx(e,t){return t.map(r=>Gx(e,r))}function Gx(e,t){return`${e}/${t}`}function Ay(e,t){return Array.isArray(e)?hi.fromArray(e,t||`threadFromArray[${e.length}]`,!0):e}function Wx(){if(xc!=null&&performance.now()>=xc)throw new Hx(xc)}var Hx=class extends Error{constructor(e){super(e)}};var Yx=ze({"../../../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,f){if(Number.MAX_SAFE_INTEGER&&a>Number.MAX_SAFE_INTEGER)throw s.bytes=0,new RangeError("Could not encode varint");u=u||[],f=f||0;for(var l=f;a>=o;)u[f++]=a&255|r,a/=128;for(;a&i;)u[f++]=a&255|r,a>>>=7;return u[f]=a|0,s.bytes=f-l+1,u}}}),Qx=ze({"../../../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,f=0,l=u,p,C=o.length;do{if(l>=C||f>49)throw i.bytes=0,new RangeError("Could not decode varint");p=o[l++],a+=f<28?(p&n)<<f:(p&n)*Math.pow(2,f),f+=7}while(p>=r);return i.bytes=l-u,a}}}),Zx=ze({"../../../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),f=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<f?8:p<l?9:10}}}),Bc=ze({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/index.js"(e,t){"use strict";t.exports={encode:Yx(),decode:Qx(),encodingLength:Zx()}}}),eC=["Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function tC(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(t==="string"||t==="number"||t==="bigint"||t==="symbol")return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(e instanceof Uint8Array)return"Uint8Array";if(e.constructor===Object)return"Object";let r=rC(e);return r||"Object"}function rC(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(eC.includes(t))return t}var q=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}static equals(e,t){return e===t||e.major===t.major&&e.name===t.name}};q.uint=new q(0,"uint",!0);q.negint=new q(1,"negint",!0);q.bytes=new q(2,"bytes",!0);q.string=new q(3,"string",!0);q.array=new q(4,"array",!1);q.map=new q(5,"map",!1);q.tag=new q(6,"tag",!1);q.float=new q(7,"float",!0);q.false=new q(7,"false",!0);q.true=new q(7,"true",!0);q.null=new q(7,"null",!0);q.undefined=new q(7,"undefined",!0);q.break=new q(7,"break",!0);var ge=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}`}},ho=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",nC=new TextEncoder;function ua(e){return ho&&globalThis.Buffer.isBuffer(e)}function Uy(e){return e instanceof Uint8Array?ua(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var iC=24,oC=200,sC=ho?(e=>e.length>=iC?globalThis.Buffer.from(e):Oy(e)):(e=>e.length>=oC?nC.encode(e):Oy(e)),Sr=e=>Uint8Array.from(e),aC=ho?((e,t,r)=>ua(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r)):((e,t,r)=>e.slice(t,r)),uC=ho?((e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Uy(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}),cC=ho?(e=>globalThis.Buffer.allocUnsafe(e)):(e=>new Uint8Array(e));function By(e,t){if(ua(e)&&ua(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 Oy(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):(i>=55296&&i<=57343&&(i=65533),t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=i&63|128)}return t}var fC=256,ky=class{constructor(e=fC){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=cC(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=aC(r,0,this.cursor)}else t=uC(this.chunks,this.cursor);return e&&this.reset(),t}},lC=class{constructor(e){this.dest=e,this.cursor=0,this.chunks=[e]}reset(){this.cursor=0}push(e){if(this.cursor+e.length>this.dest.length)throw new Error("write out of bounds, destination buffer is too small");this.dest.set(e,this.cursor),this.cursor+=e.length}toBytes(e=!1){let t=this.dest.subarray(0,this.cursor);return e&&this.reset(),t}},Fe="CBOR decode error:",My="CBOR encode error:",yo=[];yo[23]=1;yo[24]=2;yo[25]=3;yo[26]=5;yo[27]=9;function gi(e,t,r){if(e.length-t<r)throw new Error(`${Fe} not enough data for type`)}var it=[24,256,65536,4294967296,BigInt("18446744073709551616")];function Cn(e,t,r){gi(e,t,1);let n=e[t];if(r.strict===!0&&n<it[0])throw new Error(`${Fe} integer encoded in more bytes than necessary (strict decode)`);return n}function Nn(e,t,r){gi(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<it[1])throw new Error(`${Fe} integer encoded in more bytes than necessary (strict decode)`);return n}function Rn(e,t,r){gi(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<it[2])throw new Error(`${Fe} integer encoded in more bytes than necessary (strict decode)`);return n}function $n(e,t,r){gi(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<it[3])throw new Error(`${Fe} 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(`${Fe} integers outside of the safe integer range are not supported`)}function dC(e,t,r,n){return new ge(q.uint,Cn(e,t+1,n),2)}function pC(e,t,r,n){return new ge(q.uint,Nn(e,t+1,n),3)}function hC(e,t,r,n){return new ge(q.uint,Rn(e,t+1,n),5)}function yC(e,t,r,n){return new ge(q.uint,$n(e,t+1,n),9)}function Pn(e,t){return Kt(e,0,t.value)}function Kt(e,t,r){if(r<it[0]){let n=Number(r);e.push([t|n])}else if(r<it[1]){let n=Number(r);e.push([t|24,n])}else if(r<it[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<it[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<it[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(`${Fe} encountered BigInt larger than allowable range`)}}Pn.encodedSize=function(t){return Kt.encodedSize(t.value)};Kt.encodedSize=function(t){return t<it[0]?1:t<it[1]?2:t<it[2]?3:t<it[3]?5:9};Pn.compareTokens=function(t,r){return t.value<r.value?-1:t.value>r.value?1:0};function gC(e,t,r,n){return new ge(q.negint,-1-Cn(e,t+1,n),2)}function mC(e,t,r,n){return new ge(q.negint,-1-Nn(e,t+1,n),3)}function bC(e,t,r,n){return new ge(q.negint,-1-Rn(e,t+1,n),5)}var kc=BigInt(-1),Dy=BigInt(1);function vC(e,t,r,n){let i=$n(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new ge(q.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${Fe} integers outside of the safe integer range are not supported`);return new ge(q.negint,kc-BigInt(i),9)}function Mc(e,t){let r=t.value,n=typeof r=="bigint"?r*kc-Dy:r*-1-1;Kt(e,t.type.majorEncoded,n)}Mc.encodedSize=function(t){let r=t.value,n=typeof r=="bigint"?r*kc-Dy:r*-1-1;return n<it[0]?1:n<it[1]?2:n<it[2]?3:n<it[3]?5:9};Mc.compareTokens=function(t,r){return t.value<r.value?1:t.value>r.value?-1:0};function go(e,t,r,n){gi(e,t,r+n);let i=e.slice(t+r,t+r+n);return new ge(q.bytes,i,r+n)}function _C(e,t,r,n){return go(e,t,1,r)}function wC(e,t,r,n){return go(e,t,2,Cn(e,t+1,n))}function TC(e,t,r,n){return go(e,t,3,Nn(e,t+1,n))}function AC(e,t,r,n){return go(e,t,5,Rn(e,t+1,n))}function OC(e,t,r,n){let i=$n(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Fe} 64-bit integer bytes lengths not supported`);return go(e,t,9,i)}function ca(e){return e.encodedBytes===void 0&&(e.encodedBytes=q.equals(e.type,q.string)?sC(e.value):e.value),e.encodedBytes}function pa(e,t){let r=ca(t);Kt(e,t.type.majorEncoded,r.length),e.push(r)}pa.encodedSize=function(t){let r=ca(t);return Kt.encodedSize(r.length)+r.length};pa.compareTokens=function(t,r){return EC(ca(t),ca(r))};function EC(e,t){return e.length<t.length?-1:e.length>t.length?1:By(e,t)}var Ey=new TextDecoder,IC=32;function SC(e,t,r){if(r-t<IC){let i="";for(let o=t;o<r;o++){let s=e[o];if(s&128)return Ey.decode(e.subarray(t,r));i+=String.fromCharCode(s)}return i}return Ey.decode(e.subarray(t,r))}function mo(e,t,r,n,i){let o=r+n;gi(e,t,o);let s=new ge(q.string,SC(e,t+r,t+o),o);return i.retainStringBytes===!0&&(s.byteValue=e.slice(t+r,t+o)),s}function xC(e,t,r,n){return mo(e,t,1,r,n)}function CC(e,t,r,n){return mo(e,t,2,Cn(e,t+1,n),n)}function NC(e,t,r,n){return mo(e,t,3,Nn(e,t+1,n),n)}function RC(e,t,r,n){return mo(e,t,5,Rn(e,t+1,n),n)}function $C(e,t,r,n){let i=$n(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Fe} 64-bit integer string lengths not supported`);return mo(e,t,9,i,n)}var PC=pa;function mi(e,t,r,n){return new ge(q.array,n,r)}function UC(e,t,r,n){return mi(e,t,1,r)}function BC(e,t,r,n){return mi(e,t,2,Cn(e,t+1,n))}function kC(e,t,r,n){return mi(e,t,3,Nn(e,t+1,n))}function MC(e,t,r,n){return mi(e,t,5,Rn(e,t+1,n))}function DC(e,t,r,n){let i=$n(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Fe} 64-bit integer array lengths not supported`);return mi(e,t,9,i)}function LC(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Fe} indefinite length items not allowed`);return mi(e,t,1,1/0)}function Dc(e,t){Kt(e,q.array.majorEncoded,t.value)}Dc.compareTokens=Pn.compareTokens;Dc.encodedSize=function(t){return Kt.encodedSize(t.value)};function bi(e,t,r,n){return new ge(q.map,n,r)}function jC(e,t,r,n){return bi(e,t,1,r)}function FC(e,t,r,n){return bi(e,t,2,Cn(e,t+1,n))}function VC(e,t,r,n){return bi(e,t,3,Nn(e,t+1,n))}function zC(e,t,r,n){return bi(e,t,5,Rn(e,t+1,n))}function qC(e,t,r,n){let i=$n(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Fe} 64-bit integer map lengths not supported`);return bi(e,t,9,i)}function KC(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Fe} indefinite length items not allowed`);return bi(e,t,1,1/0)}function Lc(e,t){Kt(e,q.map.majorEncoded,t.value)}Lc.compareTokens=Pn.compareTokens;Lc.encodedSize=function(t){return Kt.encodedSize(t.value)};function GC(e,t,r,n){return new ge(q.tag,r,1)}function WC(e,t,r,n){return new ge(q.tag,Cn(e,t+1,n),2)}function HC(e,t,r,n){return new ge(q.tag,Nn(e,t+1,n),3)}function JC(e,t,r,n){return new ge(q.tag,Rn(e,t+1,n),5)}function XC(e,t,r,n){return new ge(q.tag,$n(e,t+1,n),9)}function jc(e,t){Kt(e,q.tag.majorEncoded,t.value)}jc.compareTokens=Pn.compareTokens;jc.encodedSize=function(t){return Kt.encodedSize(t.value)};var Ly=20,jy=21,Fy=22,Vy=23;function YC(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${Fe} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ge(q.null,null,1):new ge(q.undefined,void 0,1)}function QC(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Fe} indefinite length items not allowed`);return new ge(q.break,void 0,1)}function Fc(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${Fe} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${Fe} Infinity values are not supported`)}return new ge(q.float,e,t)}function ZC(e,t,r,n){return Fc(zc(e,t+1),3,n)}function eN(e,t,r,n){return Fc(qc(e,t+1),5,n)}function tN(e,t,r,n){return Fc(Gy(e,t+1),9,n)}function Vc(e,t,r){let n=t.value;if(n===!1)e.push([q.float.majorEncoded|Ly]);else if(n===!0)e.push([q.float.majorEncoded|jy]);else if(n===null)e.push([q.float.majorEncoded|Fy]);else if(n===void 0)e.push([q.float.majorEncoded|Vy]);else{let i,o=!1;(!r||r.float64!==!0)&&(qy(n),i=zc(or,1),n===i||Number.isNaN(n)?(or[0]=249,e.push(or.slice(0,3)),o=!0):(Ky(n),i=qc(or,1),n===i&&(or[0]=250,e.push(or.slice(0,5)),o=!0))),o||(rN(n),i=Gy(or,1),or[0]=251,e.push(or.slice(0,9)))}}Vc.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){qy(n);let i=zc(or,1);if(n===i||Number.isNaN(n))return 3;if(Ky(n),i=qc(or,1),n===i)return 5}return 9};var zy=new ArrayBuffer(9),qt=new DataView(zy,1),or=new Uint8Array(zy,0);function qy(e){if(e===1/0)qt.setUint16(0,31744,!1);else if(e===-1/0)qt.setUint16(0,64512,!1);else if(Number.isNaN(e))qt.setUint16(0,32256,!1);else{qt.setFloat32(0,e);let t=qt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)qt.setUint16(0,31744,!1);else if(r===0)qt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?qt.setUint16(0,0):i<-14?qt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):qt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function zc(e,t){if(e.length-t<2)throw new Error(`${Fe} 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 Ky(e){qt.setFloat32(0,e,!1)}function qc(e,t){if(e.length-t<4)throw new Error(`${Fe} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function rN(e){qt.setFloat64(0,e,!1)}function Gy(e,t){if(e.length-t<8)throw new Error(`${Fe} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}Vc.compareTokens=Pn.compareTokens;function Re(e,t,r){throw new Error(`${Fe} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function ha(e){return()=>{throw new Error(`${Fe} ${e}`)}}var le=[];for(let e=0;e<=23;e++)le[e]=Re;le[24]=dC;le[25]=pC;le[26]=hC;le[27]=yC;le[28]=Re;le[29]=Re;le[30]=Re;le[31]=Re;for(let e=32;e<=55;e++)le[e]=Re;le[56]=gC;le[57]=mC;le[58]=bC;le[59]=vC;le[60]=Re;le[61]=Re;le[62]=Re;le[63]=Re;for(let e=64;e<=87;e++)le[e]=_C;le[88]=wC;le[89]=TC;le[90]=AC;le[91]=OC;le[92]=Re;le[93]=Re;le[94]=Re;le[95]=ha("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)le[e]=xC;le[120]=CC;le[121]=NC;le[122]=RC;le[123]=$C;le[124]=Re;le[125]=Re;le[126]=Re;le[127]=ha("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)le[e]=UC;le[152]=BC;le[153]=kC;le[154]=MC;le[155]=DC;le[156]=Re;le[157]=Re;le[158]=Re;le[159]=LC;for(let e=160;e<=183;e++)le[e]=jC;le[184]=FC;le[185]=VC;le[186]=zC;le[187]=qC;le[188]=Re;le[189]=Re;le[190]=Re;le[191]=KC;for(let e=192;e<=215;e++)le[e]=GC;le[216]=WC;le[217]=HC;le[218]=JC;le[219]=XC;le[220]=Re;le[221]=Re;le[222]=Re;le[223]=Re;for(let e=224;e<=243;e++)le[e]=ha("simple values are not supported");le[244]=Re;le[245]=Re;le[246]=Re;le[247]=YC;le[248]=ha("simple values are not supported");le[249]=ZC;le[250]=eN;le[251]=tN;le[252]=Re;le[253]=Re;le[254]=Re;le[255]=QC;var xr=[];for(let e=0;e<24;e++)xr[e]=new ge(q.uint,e,1);for(let e=-1;e>=-24;e--)xr[31-e]=new ge(q.negint,e,1);xr[64]=new ge(q.bytes,new Uint8Array(0),1);xr[96]=new ge(q.string,"",1);xr[128]=new ge(q.array,0,1);xr[160]=new ge(q.map,0,1);xr[244]=new ge(q.false,!1,1);xr[245]=new ge(q.true,!0,1);xr[246]=new ge(q.null,null,1);function nN(e){switch(e.type){case q.false:return Sr([244]);case q.true:return Sr([245]);case q.null:return Sr([246]);case q.bytes:return e.value.length?void 0:Sr([64]);case q.string:return e.value===""?Sr([96]):void 0;case q.array:return e.value===0?Sr([128]):void 0;case q.map:return e.value===0?Sr([160]):void 0;case q.uint:return e.value<24?Sr([Number(e.value)]):void 0;case q.negint:if(e.value>=-24)return Sr([31-Number(e.value)])}}var iN=Object.freeze({float64:!0,mapSorter:uN,quickEncodeToken:nN});function Wy(){let e=[];return e[q.uint.major]=Pn,e[q.negint.major]=Mc,e[q.bytes.major]=pa,e[q.string.major]=PC,e[q.array.major]=Dc,e[q.map.major]=Lc,e[q.tag.major]=jc,e[q.float.major]=Vc,e}var oN=Wy(),sN=new ky,Iy=class Hy{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(`${My} object contains circular references`);return new Hy(r,t)}},Hr={null:new ge(q.null,null),undefined:new ge(q.undefined,void 0),true:new ge(q.true,!0),false:new ge(q.false,!1),emptyArray:new ge(q.array,0),emptyMap:new ge(q.map,0)},Yr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ge(q.float,e):e>=0?new ge(q.uint,e):new ge(q.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ge(q.uint,e):new ge(q.negint,e)},Uint8Array(e,t,r,n){return new ge(q.bytes,e)},string(e,t,r,n){return new ge(q.string,e)},boolean(e,t,r,n){return e?Hr.true:Hr.false},null(e,t,r,n){return Hr.null},undefined(e,t,r,n){return Hr.undefined},ArrayBuffer(e,t,r,n){return new ge(q.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ge(q.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Hr.emptyArray,new ge(q.break)]:Hr.emptyArray;n=Iy.createCheck(n,e);let i=[],o=0;for(let s of e)i[o++]=sa(s,r,n);return r.addBreakTokens?[new ge(q.array,e.length),i,new ge(q.break)]:[new ge(q.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,a;if(s){a=new Array(s),n=Iy.createCheck(n,e);let u=!i&&r.ignoreUndefinedProperties,f=0;for(let l of o){let p=i?e.get(l):e[l];u&&p===void 0||(a[f++]=[sa(l,r,n),sa(p,r,n)])}f<s&&(a.length=f)}return a?.length?(aN(a,r),r.addBreakTokens?[new ge(q.map,a.length),a,new ge(q.break)]:[new ge(q.map,a.length),a]):r.addBreakTokens===!0?[Hr.emptyMap,new ge(q.break)]:Hr.emptyMap}};Yr.Map=Yr.Object;Yr.Buffer=Yr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Yr[`${e}Array`]=Yr.DataView;function sa(e,t={},r){let n=tC(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||Yr[n];if(typeof i=="function"){let s=i(e,n,t,r);if(s!=null)return s}let o=Yr[n];if(!o)throw new Error(`${My} unsupported type: ${n}`);return o(e,n,t,r)}function aN(e,t){t.mapSorter&&e.sort(t.mapSorter)}function uN(e,t){if(e[0]instanceof ge&&t[0]instanceof ge){let r=e[0],n=t[0];return r._keyBytes||(r._keyBytes=Sy(r.value)),n._keyBytes||(n._keyBytes=Sy(n.value)),By(r._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function Sy(e){return cN(e,oN,iN)}function Jy(e,t,r,n){if(Array.isArray(t))for(let i of t)Jy(e,i,r,n);else r[t.type.major](e,t,n)}var iB=q.uint.majorEncoded,oB=q.negint.majorEncoded,sB=q.bytes.majorEncoded,aB=q.string.majorEncoded,uB=q.array.majorEncoded,cB=q.float.majorEncoded|Ly,fB=q.float.majorEncoded|jy,lB=q.float.majorEncoded|Fy,dB=q.float.majorEncoded|Vy,pB=BigInt(-1),hB=BigInt(1);function cN(e,t,r,n){let i=n instanceof Uint8Array,o=i?new lC(n):sN,s=sa(e,r);if(!Array.isArray(s)&&r.quickEncodeToken){let a=r.quickEncodeToken(s);if(a)return i?(o.push(a),o.toBytes()):a;let u=t[s.type.major];if(u.encodedSize){let f=u.encodedSize(s,r);if(i||(o=new ky(f)),u(o,s,r),o.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${s} was wrong`);return i?o.toBytes():Uy(o.chunks[0])}}return o.reset(),Jy(o,s,t,r),o.toBytes(!0)}var yB=new Uint8Array(0);function fN(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 Kc(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 lN(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),f=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function p(S){if(S instanceof Uint8Array||(ArrayBuffer.isView(S)?S=new Uint8Array(S.buffer,S.byteOffset,S.byteLength):Array.isArray(S)&&(S=Uint8Array.from(S))),!(S instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(S.length===0)return"";for(var z=0,X=0,j=0,M=S.length;j!==M&&S[j]===0;)j++,z++;for(var K=(M-j)*l+1>>>0,H=new Uint8Array(K);j!==M;){for(var V=S[j],ee=0,W=K-1;(V!==0||ee<X)&&W!==-1;W--,ee++)V+=256*H[W]>>>0,H[W]=V%a>>>0,V=V/a>>>0;if(V!==0)throw new Error("Non-zero carry");X=ee,j++}for(var he=K-X;he!==K&&H[he]===0;)he++;for(var P=u.repeat(z);he<K;++he)P+=e.charAt(H[he]);return P}function C(S){if(typeof S!="string")throw new TypeError("Expected String");if(S.length===0)return new Uint8Array;var z=0;if(S[z]!==" "){for(var X=0,j=0;S[z]===u;)X++,z++;for(var M=(S.length-z)*f+1>>>0,K=new Uint8Array(M);S[z];){var H=r[S.charCodeAt(z)];if(H===255)return;for(var V=0,ee=M-1;(H!==0||V<j)&&ee!==-1;ee--,V++)H+=a*K[ee]>>>0,K[ee]=H%256>>>0,H=H/256>>>0;if(H!==0)throw new Error("Non-zero carry");j=V,z++}if(S[z]!==" "){for(var W=M-j;W!==M&&K[W]===0;)W++;for(var he=new Uint8Array(X+(M-W)),P=X;W!==M;)he[P++]=K[W++];return he}}}function A(S){var z=C(S);if(z)return z;throw new Error(`Non-${t} character`)}return{encode:p,decodeUnsafe:C,decode:A}}var dN=lN,pN=dN,hN=pN,yN=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")}},gN=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 Xy(this,e)}},mN=class{decoders;constructor(e){this.decoders=e}or(e){return Xy(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 Xy(e,t){return new mN({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var bN=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 yN(e,t,r),this.decoder=new gN(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Yy({name:e,prefix:t,encode:r,decode:n}){return new bN(e,t,r,n)}function ya({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=hN(r,e);return Yy({prefix:t,name:e,encode:n,decode:o=>Kc(i(o))})}function vN(e,t,r,n){let i=e.length;for(;e[i-1]==="=";)--i;let o=new Uint8Array(i*r/8|0),s=0,a=0,u=0;for(let f=0;f<i;++f){let l=t[e[f]];if(l===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<r|l,s+=r,s>=8&&(s-=8,o[u++]=255&a>>s)}if(s>=r||(255&a<<8-s)!==0)throw new SyntaxError("Unexpected end of data");return o}function _N(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)!==0;)o+="=";return o}function wN(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function Cr({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=wN(n);return Yy({prefix:t,name:e,encode(o){return _N(o,n,r)},decode(o){return vN(o,i,r,e)}})}var aa=Cr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),gB=Cr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),mB=Cr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),bB=Cr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),vB=Cr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),_B=Cr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),wB=Cr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),TB=Cr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),AB=Cr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Cc=ya({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),OB=ya({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Jr=ya({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),EB=ya({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),TN=Qy,xy=128,AN=127,ON=~AN,EN=Math.pow(2,31);function Qy(e,t,r){t=t||[],r=r||0;for(var n=r;e>=EN;)t[r++]=e&255|xy,e/=128;for(;e&ON;)t[r++]=e&255|xy,e>>>=7;return t[r]=e|0,Qy.bytes=r-n+1,t}var IN=Rc,SN=128,Cy=127;function Rc(e,n){var r=0,n=n||0,i=0,o=n,s,a=e.length;do{if(o>=a)throw Rc.bytes=0,new RangeError("Could not decode varint");s=e[o++],r+=i<28?(s&Cy)<<i:(s&Cy)*Math.pow(2,i),i+=7}while(s>=SN);return Rc.bytes=o-n,r}var xN=Math.pow(2,7),CN=Math.pow(2,14),NN=Math.pow(2,21),RN=Math.pow(2,28),$N=Math.pow(2,35),PN=Math.pow(2,42),UN=Math.pow(2,49),BN=Math.pow(2,56),kN=Math.pow(2,63),MN=function(e){return e<xN?1:e<CN?2:e<NN?3:e<RN?4:e<$N?5:e<PN?6:e<UN?7:e<BN?8:e<kN?9:10},DN={encode:TN,decode:IN,encodingLength:MN},LN=DN,fa=LN;function $c(e,t=0){return[fa.decode(e,t),fa.decode.bytes]}function la(e,t,r=0){return fa.encode(e,t,r),t}function da(e){return fa.encodingLength(e)}function jN(e,t){let r=t.byteLength,n=da(e),i=n+da(r),o=new Uint8Array(i+r);return la(e,o,0),la(r,o,n),o.set(t,i),new Gc(e,r,t,o)}function FN(e){let t=Kc(e),[r,n]=$c(t),[i,o]=$c(t.subarray(n)),s=t.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Gc(r,i,s,t)}function VN(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&fN(e.bytes,r.bytes)}}var Gc=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Ny(e,t){let{bytes:r,version:n}=e;return n===0?qN(r,Pc(e),t??Jr.encoder):KN(r,Pc(e),t??aa.encoder)}var Ry=new WeakMap;function Pc(e){let t=Ry.get(e);if(t==null){let r=new Map;return Ry.set(e,r),r}return t}var Zy=class at{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!==fo)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==GN)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return at.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=jN(t,r);return at.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 at.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&VN(t.multihash,n.multihash)}toString(t){return Ny(this,t)}toJSON(){return{"/":Ny(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 at)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new at(n,i,o,s??$y(n,i,o.bytes))}else if(r[WN]===!0){let{version:n,multihash:i,code:o}=r,s=FN(i);return at.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!==fo)throw new Error(`Version 0 CID must use dag-pb (code: ${fo}) block encoding`);return new at(t,r,n,n.bytes)}case 1:{let i=$y(t,r,n.bytes);return new at(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return at.create(0,fo,t)}static createV1(t,r){return at.create(1,t,r)}static decode(t){let[r,n]=at.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=at.inspectBytes(t),n=r.size-r.multihashSize,i=Kc(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 Gc(r.multihashCode,r.digestSize,o,i);return[r.version===0?at.createV0(s):at.createV1(r.codec,s),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[p,C]=$c(t.subarray(r));return r+=C,p},i=n(),o=fo;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(),f=r+u,l=f-s;return{version:i,codec:o,multihashCode:a,digestSize:u,multihashSize:l,size:f}}static parse(t,r){let[n,i]=zN(t,r),o=at.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Pc(o).set(n,t),o}};function zN(e,t){switch(e[0]){case"Q":{let r=t??Jr;return[Jr.prefix,r.decode(`${Jr.prefix}${e}`)]}case Jr.prefix:{let r=t??Jr;return[Jr.prefix,r.decode(e)]}case aa.prefix:{let r=t??aa;return[aa.prefix,r.decode(e)]}case Cc.prefix:{let r=t??Cc;return[Cc.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 qN(e,t,r){let{prefix:n}=r;if(n!==Jr.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 KN(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 fo=112,GN=18;function $y(e,t,r){let n=da(e),i=n+da(t),o=new Uint8Array(i+r.byteLength);return la(e,o,0),la(t,o,n),o.set(r,i),o}var WN=Symbol.for("@ipld/js-cid/CID"),eg=42;function HN(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Zy.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new ge(q.tag,eg),new ge(q.bytes,r)]}function JN(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function XN(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}function YN(e){for(let t of e.keys())if(typeof t!="string"||t.length===0)throw new Error("Non-string Map keys are not supported by the IPLD Data Model and cannot be encoded");return null}var Py={float64:!0,typeEncoders:{Map:YN,Object:HN,undefined:JN,number:XN}},IB={...Py,typeEncoders:{...Py.typeEncoders}};function QN(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Zy.decode(e.subarray(1))}var Uc={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Uc.tags[eg]=QN;var SB={...Uc,tags:Uc.tags.slice()};var xB=Ft(Bc(),1);var Xr={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)},lo={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Xr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":(e=>{if(Xr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=lo["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=lo["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}}),Int:Xr.Int,CarV1HeaderOrV2Pragma:(e=>{if(Xr.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=lo["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=lo.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})},po={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Xr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":(e=>{if(Xr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=po["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=po["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}}),Int:Xr.Int,CarV1HeaderOrV2Pragma:(e=>{if(Xr.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=po["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=po.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})},CB={toTyped:lo.CarV1HeaderOrV2Pragma,toRepresentation:po.CarV1HeaderOrV2Pragma},NB=Wy(),RB=Ft(Bc(),1),$B=[new ge(q.map,2),new ge(q.string,"version"),new ge(q.uint,1),new ge(q.string,"roots")],PB=new ge(q.tag,42);var UB=Ft(Bc(),1);var{WARN:tg,LOG:BB,DEBUG:Nc,VERBOSE:Wc,ERROR:yi}=Pe.setup(Pe.INFO);async function Hc(e){let t=await ng(e);return await rg(t)}async function rg({rootCID:e,blockStore:t},r=[],n){if(!e||!t)throw yi("Empty roots/blocks",{rootCID:e,blockStore:t});let i=[],o=null,s=e,a=new Set,u=null;for(;s;){let l=s.toString();if(a.has(l))throw yi("[decodePubFromBlocks] pub chain has a loop",{currentCID:l,visited:[...a]});a.add(l);let p=await xn(t,s);if(Wc("[decodePubFromBlocks] root:",l,p,{blockStore:t}),!p)throw yi("[decodePubFromBlocks] root not found in blockStore",{blockStore:t,currentCID:l});let C;if(p?.info){u||(u=p.applogs);let X=await xn(t,p.applogs);C=await eR(X,t),o||(o=await xn(t,p.info),Nc("new format - infoLogs",o.logs.map(j=>({[j.toString()]:j}))))}else C=p.applogs;let A=async X=>{let j=X,M=await xn(t,j);if(!M)throw yi("Could not find applog CID in pub blocks:",j.toString(),{cid:j,root:p,blockStore:t}),new Error(`Could not find applog CID in pub blocks: ${j.toString()}`);return M.pv instanceof ht&&(M.pv=M.pv.toV1().toString()),{...M,cid:j.toV1().toString()}},S=await Promise.all(C.map(A));if(i=i.concat(S),!p.prev)break;if(n&&ta(p.prev,n)){Nc("[decodePubFromBlocks] stopping at stopAtCID:",n.toString());break}if(!await t.get(p.prev))throw yi("[decodePubFromBlocks] prev snapshot missing from blockStore",{currentCID:l,prev:p.prev.toString(),stopAtCID:n?.toString(),visited:[...a]});s=p.prev}let f={cid:e,info:o?{...o,logs:await Promise.all(o.logs.map(async l=>{let p=l,C=await xn(t,p);if(!C)throw yi("Could not find info log CID in pub blocks:",p.toString(),{cid:p,blockStore:t}),new Error(`Could not find info log CID in pub blocks: ${p.toString()}`);return C.pv instanceof ht&&(C.pv=C.pv.toV1().toString()),{...C,cid:p.toV1().toString()}}))}:null,applogsCID:u,applogs:i};return Nc("[decodePubFromBlocks] result:",f,{rootCID:e.toString(),blockStore:t,applogs:i}),f}async function ng(e){let r=(await e.getRoots()).map(i=>(typeof i.toV1=="function"?i:ht.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:ht.decode(i.bytes);Wc({cidFromCarblocks:i,cid:s}),n.set(s.toV1().toString(),o)}return r.length!==1&&tg("Unexpected roots count:",r),{rootCID:ht.parse(r[0]),blockStore:{get:i=>n.get(i.toV1().toString())}}}async function xn(e,t){try{var r=await e.get(t);if(!r)return tg("returning null"),null}catch(n){if(n.message==="Not Found")return null;throw n}return uo(r)}function Jc(e){return(async function*(){for(;;){let{done:t,value:r}=await e.read();if(Wc("[car] chunk",{done:t,value:r}),t)break;yield r}})()}var{WARN:kB,LOG:MB,DEBUG:DB,VERBOSE:LB,ERROR:ZN}=Pe.setup(Pe.INFO);async function eR(e,t){return tR(e)?(await Promise.all(e.chunks.map(async r=>{let n=await xn(t,r);if(!n.logs)throw ZN("Weird chunk",n);return n.logs}))).flat():e.logs}function tR(e){return e.chunks}var{WARN:ga,LOG:Dk,DEBUG:bo,VERBOSE:Lk,ERROR:vo}=Ta.setup(Ta.INFO),_o=class extends Error{constructor(t){super(`IPNS key has never been published: ${t}`),this.name="IPNSNeverPublishedError"}},Un=class extends Error{constructor(t,r){super(`Failed to resolve IPNS ${t}: ${r}`),this.name="IPNSResolutionError",this.cause=r}};async function jk(e,t,{readOnly:r=!0,pinnedCID:n}={}){let{cid:i,errors:o,isIpns:s}=Ac(t);if(!i)throw vo("Failed to parse pubID",t,o);bo("[retrieveThread] parsedPubID",i);let a;if(n)bo("[retrieveThread] using pinnedCID"),s||ga("pubID isn't IPNS, but pinnedCID different:",{pubID:t,pinnedCID:n}),a=xt.parse(n);else if(!s)bo("[retrieveThread] pubID is not IPNS - using as CID"),a=i;else{if(!t)throw vo("[retrieveThread] neither pubID nor pinnedCID provided");if(!e.nameBaseUrl)throw vo("[retrieveThread] IPNS, but no nameBaseUrl");try{a=await rR(e,t),bo("Resolved pub to CID",a.toString())}catch(A){throw A instanceof _o||A instanceof Un?A:vo(`Failed to resolve IPNS ${t}:`,A)}}let u=await nR(e.gatewayBaseUrl,a),{applogs:f}=await Hc(u),l=f.filter(A=>Zs(A));l.length&&ga(`Found ${l.length} encrypted logs - skipping`);let p=f.filter(A=>!(A instanceof Uint8Array));Wr(p);let C=hi.fromArray(p,`preview${t&&t!==a.toString()?"-"+t:""}@${a.toString()}`,r);return{cid:a,thread:C,encryptedCount:l.length}}async function rR(e,t){let r=Aa(e.nameBaseUrl),n;try{n=await fetch(`${r}/name/${t}`)}catch(o){throw new Un(t,o)}if(!n.ok)throw n.status===404?new _o(t):new Un(t,`HTTP ${n.status}: ${n.statusText}`);let i;try{i=await n.json()}catch(o){throw new Un(t,`Invalid JSON response: ${o}`)}if(!i.value)throw new _o(t);i.value.startsWith("/ipfs/")||ga("IPNS value is not '/ipfs/..':",i);try{return xt.parse(i.value.replace("/ipfs/",""))}catch(o){throw new Un(t,`Invalid CID in IPNS value: ${o}`)}}async function nR(e,t){e=Aa(e),bo("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=vo(`[retrieveCar] unexpected response ${n?.statusText}`,{url:r}),ga("Gateway failed:",r,i)),i=Jc(n.body.getReader()),i instanceof Error)throw i;return await nn.fromIterable(i)}export{_o as a,Un as b,jk as c,rR as d,nR as e};
|
|
62
|
+
/*! Bundled license information:
|
|
63
|
+
|
|
64
|
+
lodash-es/lodash.js:
|
|
65
|
+
(**
|
|
66
|
+
* @license
|
|
67
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
68
|
+
* Build: `lodash modularize exports="es" -o ./`
|
|
69
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
70
|
+
* Released under MIT license <https://lodash.com/license>
|
|
71
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
72
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
73
|
+
*)
|
|
74
|
+
|
|
75
|
+
@noble/hashes/utils.js:
|
|
76
|
+
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
77
|
+
*/
|
|
78
|
+
//# sourceMappingURL=chunk-VFOYRUCV.min.js.map
|